Class: UI::ComboboxWrapperComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::ComboboxWrapperComponent
- Includes:
- ComboboxBehavior
- Defined in:
- app/view_components/ui/combobox_wrapper_component.rb
Overview
WrapperComponent - ViewComponent implementation
Wrapper component that yields combobox attributes to be spread into a container component. Used to wrap Popover/Drawer/DropdownMenu with combobox selection functionality. Uses ComboboxBehavior concern for shared attribute generation logic.
The combobox pattern provides:
-
Selection state management via Stimulus controller
-
Automatic text update when item is selected
-
Check icon visibility control (opacity-0/100)
-
Container closing after selection
Instance Method Summary collapse
-
#initialize(value: "", **attributes) ⇒ ComboboxWrapperComponent
constructor
A new instance of ComboboxWrapperComponent.
Methods included from ComboboxBehavior
#combobox_html_attributes, #combobox_item_html_attributes, #combobox_text_html_attributes
Constructor Details
#initialize(value: "", **attributes) ⇒ ComboboxWrapperComponent
Returns a new instance of ComboboxWrapperComponent.
51 52 53 54 55 |
# File 'app/view_components/ui/combobox_wrapper_component.rb', line 51 def initialize(value: "", **attributes) @value = value @attributes = attributes @combobox_html_attrs = combobox_html_attributes.deep_merge(@attributes) end |