Module: StimulusPlumbers::Form::Fields::Inputs::Search

Includes:
Combobox
Included in:
Builder
Defined in:
lib/stimulus_plumbers/form/fields/inputs/search.rb

Instance Method Summary collapse

Instance Method Details

#search_field(attribute, options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/stimulus_plumbers/form/fields/inputs/search.rb', line 12

def search_field(attribute, options = {})
  clearable    = options.delete(:clearable) { false }
  data         = clearable ? { data: { input_clearable_target: "input" } } : {}
  html_options = merge_html_options(theme.resolve(:form_field_input), options, data)
  render_input_group(
    trailing: clearable ? method(:clear_button) : nil,
    error:    false,
    **merge_html_options(
      theme.resolve(:form_field_input_clearable),
      clearable ? { data: { controller: "input-clearable" } } : {}
    )
  ) { super(attribute, html_options) }
end