Module: UI::MenubarRadioGroupBehavior
- Included in:
- MenubarRadioGroup, MenubarRadioGroupComponent
- Defined in:
- app/behaviors/ui/menubar_radio_group_behavior.rb
Overview
MenubarRadioGroupBehavior
Shared behavior for MenubarRadioGroup component across ERB, ViewComponent, and Phlex implementations.
Instance Method Summary collapse
-
#menubar_radio_group_classes ⇒ Object
Returns combined CSS classes for the radio group.
-
#menubar_radio_group_data_attributes ⇒ Object
Returns data attributes for the radio group.
-
#menubar_radio_group_html_attributes ⇒ Object
Returns HTML attributes for the radio group.
Instance Method Details
#menubar_radio_group_classes ⇒ Object
Returns combined CSS classes for the radio group
17 18 19 20 21 22 |
# File 'app/behaviors/ui/menubar_radio_group_behavior.rb', line 17 def classes_value = respond_to?(:classes, true) ? classes : @classes TailwindMerge::Merger.new.merge([ classes_value ].compact.join(" ")) end |
#menubar_radio_group_data_attributes ⇒ Object
Returns data attributes for the radio group
25 26 27 28 29 30 31 32 33 |
# File 'app/behaviors/ui/menubar_radio_group_behavior.rb', line 25 def attributes_value = respond_to?(:attributes, true) ? attributes : @attributes base_data = {} # Store the current value if provided base_data[:"ui--menubar-radio-value"] = @value if defined?(@value) && @value (attributes_value&.fetch(:data, {}) || {}).merge(base_data) end |
#menubar_radio_group_html_attributes ⇒ Object
Returns HTML attributes for the radio group
8 9 10 11 12 13 14 |
# File 'app/behaviors/ui/menubar_radio_group_behavior.rb', line 8 def { class: , data: , role: "group" } end |