Module: UI::PopoverBehavior
- Included in:
- Popover, PopoverComponent
- Defined in:
- app/helpers/ui/popover_behavior.rb,
app/behaviors/ui/popover_behavior.rb
Overview
UI::PopoverBehavior
Instance Method Summary collapse
-
#popover_classes ⇒ Object
Returns combined CSS classes for the popover.
-
#popover_data_attributes ⇒ Object
Returns data attributes for the popover controller.
-
#popover_html_attributes ⇒ Object
Returns HTML attributes for the popover container element When used with asChild, only data attributes are returned (no classes).
Instance Method Details
#popover_classes ⇒ Object
Returns combined CSS classes for the popover
21 22 23 24 25 26 27 28 |
# File 'app/helpers/ui/popover_behavior.rb', line 21 def popover_classes classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ popover_base_classes, classes_value ].compact.join(" ")) end |
#popover_data_attributes ⇒ Object
Returns data attributes for the popover controller
31 32 33 34 35 36 37 38 39 |
# File 'app/helpers/ui/popover_behavior.rb', line 31 def popover_data_attributes { controller: "ui--popover", ui__popover_placement_value: normalized_placement, ui__popover_offset_value: @offset, ui__popover_trigger_value: @trigger, ui__popover_hover_delay_value: @hover_delay } end |
#popover_html_attributes ⇒ Object
Returns HTML attributes for the popover container element When used with asChild, only data attributes are returned (no classes)
9 10 11 12 13 14 15 16 17 18 |
# File 'app/helpers/ui/popover_behavior.rb', line 9 def popover_html_attributes attributes_value = respond_to?(:attributes, true) ? attributes : @attributes user_data = attributes_value[:data] || {} other_attributes = attributes_value.except(:data) { class: popover_classes, data: popover_data_attributes.merge(user_data) }.merge(other_attributes) end |