Module: UI::SelectContentBehavior
- Included in:
- SelectContent, SelectContentComponent
- Defined in:
- app/helpers/ui/select_content_behavior.rb,
app/behaviors/ui/select_content_behavior.rb
Overview
UI::SelectContentBehavior
Shared behavior for Select dropdown content across ERB, ViewComponent, and Phlex implementations. This module provides consistent HTML attribute generation and styling.
Instance Method Summary collapse
-
#select_content_classes ⇒ Object
Returns combined CSS classes.
-
#select_content_html_attributes ⇒ Object
Returns HTML attributes for the select content element.
Instance Method Details
#select_content_classes ⇒ Object
Returns combined CSS classes
25 26 27 28 29 30 31 |
# File 'app/helpers/ui/select_content_behavior.rb', line 25 def select_content_classes classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ select_content_base_classes, classes_value ].compact.join(" ")) end |
#select_content_html_attributes ⇒ Object
Returns HTML attributes for the select content element
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/ui/select_content_behavior.rb', line 9 def select_content_html_attributes attributes_value = respond_to?(:attributes, true) ? attributes : @attributes { class: select_content_classes, data: { ui__select_target: "content", state: "closed", slot: "select-content" }, role: "listbox", # CSS variables for positioning (set by JavaScript) style: "box-sizing: border-box; display: flex; flex-direction: column; outline: none;" }.merge(attributes_value || {}) end |