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)
input_html = super(attribute, html_options)
return input_html unless clearable
render_input_group(
trailing: method(:clear_button),
error: false,
**merge_html_options(theme.resolve(:form_field_input_clearable), { data: { controller: "input-clearable" } })
) { input_html }
end
|