Class: UI::ComboboxWrapper
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- UI::ComboboxWrapper
- Includes:
- ComboboxBehavior
- Defined in:
- app/components/ui/combobox_wrapper.rb
Overview
Wrapper - Phlex 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) ⇒ ComboboxWrapper
constructor
A new instance of ComboboxWrapper.
- #view_template {|combobox_html_attributes.deep_merge(@attributes)| ... } ⇒ Object
Methods included from ComboboxBehavior
#combobox_html_attributes, #combobox_item_html_attributes, #combobox_text_html_attributes
Constructor Details
#initialize(value: "", **attributes) ⇒ ComboboxWrapper
Returns a new instance of ComboboxWrapper.
46 47 48 49 |
# File 'app/components/ui/combobox_wrapper.rb', line 46 def initialize(value: "", **attributes) @value = value @attributes = attributes end |
Instance Method Details
#view_template {|combobox_html_attributes.deep_merge(@attributes)| ... } ⇒ Object
51 52 53 54 55 56 |
# File 'app/components/ui/combobox_wrapper.rb', line 51 def view_template(&block) # Yield combobox attributes to be spread into container component # The block receives a hash of data attributes that should be passed # to the wrapping container (Popover/Drawer/DropdownMenu) yield(combobox_html_attributes.deep_merge(@attributes)) if block_given? end |