Class: PhlexKit::ComboboxToggleAllCheckbox

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb

Overview

"Select all" checkbox for a multi-select combobox — wrap it in a PhlexKit::ComboboxItem as the FIRST row inside the ComboboxList (the item carries role="option", which is only valid inside the listbox, and arrow-key nav walks the list's rows). Hidden while a filter term is active. See combobox.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ ComboboxToggleAllCheckbox

Returns a new instance of ComboboxToggleAllCheckbox.



8
9
10
# File 'app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb', line 8

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb', line 12

def view_template
  input(**mix({
    type: :checkbox,
    class: "pk-combobox-checkbox",
    # The option label is the interactive surface (ARIA option); the real
    # input must not be a second tab stop inside it — same as
    # ComboboxCheckbox/ComboboxRadio.
    tabindex: "-1",
    data: {
      phlex_kit__combobox_target: "toggleAll",
      action: "change->phlex-kit--combobox#toggleAllItems"
    }
  }, @attrs))
end