Module: UI::HoverCardTriggerBehavior
- Included in:
- HoverCardTrigger, HoverCardTriggerComponent
- Defined in:
- app/behaviors/ui/hover_card_trigger_behavior.rb
Overview
Shared behavior for HoverCardTrigger component Provides HTML attributes and styling for the trigger element Supports asChild pattern for composition
Instance Method Summary collapse
-
#trigger_classes ⇒ Object
Returns combined CSS classes for the hover card trigger.
-
#trigger_data_attributes ⇒ Object
Returns data attributes for the hover card trigger.
-
#trigger_html_attributes ⇒ Object
Returns HTML attributes for the hover card trigger element.
Instance Method Details
#trigger_classes ⇒ Object
Returns combined CSS classes for the hover card trigger
17 18 19 20 21 22 23 |
# File 'app/behaviors/ui/hover_card_trigger_behavior.rb', line 17 def trigger_classes classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ trigger_base_classes, classes_value ].compact.join(" ")) end |
#trigger_data_attributes ⇒ Object
Returns data attributes for the hover card trigger
26 27 28 29 30 31 |
# File 'app/behaviors/ui/hover_card_trigger_behavior.rb', line 26 def trigger_data_attributes { ui__hover_card_target: "trigger", action: "mouseenter->ui--hover-card#show mouseleave->ui--hover-card#hide" } end |
#trigger_html_attributes ⇒ Object
Returns HTML attributes for the hover card trigger element
8 9 10 11 12 13 14 |
# File 'app/behaviors/ui/hover_card_trigger_behavior.rb', line 8 def trigger_html_attributes attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { class: trigger_classes, data: trigger_data_attributes }.merge(attributes_value) end |