Class: StimulusPlumbers::Components::Combobox::Trigger
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Combobox::Trigger
- Defined in:
- lib/stimulus_plumbers/components/combobox/trigger.rb
Constant Summary
Constants included from Plumber::HtmlOptions
Plumber::HtmlOptions::STIMULUS_SPACEJOIN_KEYS
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
Methods inherited from Plumber::Base
Methods included from Plumber::HtmlOptions
#merge_data_options, #merge_html_options, #merge_string_option, #normalize_part
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Instance Method Details
#render(stimulus_controller:, popover_id:, haspopup:, readonly: true, aria_autocomplete: nil, aria_label: nil, data: {}, **_rest) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/stimulus_plumbers/components/combobox/trigger.rb', line 7 def render( stimulus_controller:, popover_id:, haspopup:, readonly: true, aria_autocomplete: nil, aria_label: nil, data: {}, **_rest ) base_data = { "#{stimulus_controller}_target": "trigger", input_format_target: "input", action: "focus->#{stimulus_controller}#open keydown.esc->#{stimulus_controller}#close" } aria = { haspopup: haspopup, expanded: "false", controls: popover_id } aria[:autocomplete] = aria_autocomplete if aria_autocomplete aria[:label] = aria_label if aria_label template.tag.input( type: "text", readonly: (readonly ? true : nil), role: "combobox", aria: aria, data: (base_data, data.symbolize_keys) ) end |