Class: Ariadne::UI::Popover::Component

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/ariadne/ui/popover/component.rb

Constant Summary collapse

ALIGNMENT_DEFAULT =
:center
ALIGNMENT_OPTIONS =
[:left, :right, ALIGNMENT_DEFAULT]
POSITION_DEFAULT =
:auto
POSITION_OPTIONS =
[POSITION_DEFAULT, :above, :below]

Constants inherited from BaseComponent

BaseComponent::ACCEPT_ANYTHING

Constants included from ViewHelper

ViewHelper::HELPERS

Constants included from AttributesHelper

AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from BaseComponent

#class_for, #component, component_id, #component_id, component_name, #html_attributes, i18n_scope, #in_turbo_frame, #in_turbo_stream, #options, stimulus_name, #styles, translate, #validate_aria_label!

Methods included from ViewHelper

generate_id

Methods included from AttributesHelper

#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute

Methods included from ViewComponent::StyleVariants

#merged_styles

Instance Method Details

#popover_placementObject



57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/components/ariadne/ui/popover/component.rb', line 57

def popover_placement
  placement =
    case @position
    when :above then "top"
    when :below then "bottom"
    else
      "bottom"
    end
  placement += "-start" if @alignment == :left
  placement += "-end" if @alignment == :right
  placement
end

#target_idObject



70
71
72
# File 'app/components/ariadne/ui/popover/component.rb', line 70

def target_id
  @target_id ||= ::Ariadne::ViewHelper.generate_id
end