Module: UI::HoverCardBehavior

Included in:
HoverCard, HoverCardComponent
Defined in:
app/behaviors/ui/hover_card_behavior.rb

Overview

UI::HoverCardBehavior

Instance Method Summary collapse

Instance Method Details

#hover_card_classesObject

Returns combined CSS classes for the hover card



32
33
34
35
36
37
# File 'app/behaviors/ui/hover_card_behavior.rb', line 32

def hover_card_classes
  classes_value = respond_to?(:classes, true) ? classes : @classes
  TailwindMerge::Merger.new.merge([
    classes_value
  ].compact.join(" "))
end

#hover_card_data_attributesObject

Returns data attributes for the hover card controller



40
41
42
43
44
# File 'app/behaviors/ui/hover_card_behavior.rb', line 40

def hover_card_data_attributes
  {
    controller: "ui--hover-card"
  }
end

#hover_card_html_attributesObject

Returns HTML attributes for the hover card container element



23
24
25
26
27
28
29
# File 'app/behaviors/ui/hover_card_behavior.rb', line 23

def hover_card_html_attributes
  attributes_value = respond_to?(:attributes, true) ? attributes : @attributes
  {
    class: hover_card_classes,
    data: hover_card_data_attributes
  }.merge(attributes_value)
end