Module: UI::PopoverContentBehavior

Included in:
PopoverContent, PopoverContentComponent
Defined in:
app/helpers/ui/popover_content_behavior.rb,
app/behaviors/ui/popover_content_behavior.rb

Overview

PopoverContentBehavior

Shared behavior for PopoverContent component across ERB, ViewComponent, and Phlex implementations. This module provides consistent styling and HTML attribute generation.

Instance Method Summary collapse

Instance Method Details

#popover_content_classesObject

Returns combined CSS classes for the popover content



18
19
20
21
22
23
24
25
# File 'app/helpers/ui/popover_content_behavior.rb', line 18

def popover_content_classes
  classes_value = respond_to?(:classes, true) ? classes : @classes
  TailwindMerge::Merger.new.merge([
    popover_content_base_classes,
    classes_value

  ].compact.join(" "))
end

#popover_content_data_attributesObject

Returns data attributes for the popover content



28
29
30
31
32
33
# File 'app/helpers/ui/popover_content_behavior.rb', line 28

def popover_content_data_attributes
  {
    ui__popover_target: "content",
    state: "closed"
  }
end

#popover_content_html_attributesObject

Returns HTML attributes for the popover content element



9
10
11
12
13
14
15
# File 'app/helpers/ui/popover_content_behavior.rb', line 9

def popover_content_html_attributes
  attributes_value = respond_to?(:attributes, true) ? attributes : @attributes
  {
    class: popover_content_classes,
    data: popover_content_data_attributes
  }.merge(attributes_value)
end