Class: Playbook::PbTypeahead::Typeahead
- Inherits:
-
KitBase
- Object
- ViewComponent::Base
- KitBase
- Playbook::PbTypeahead::Typeahead
show all
- Defined in:
- app/pb_kits/playbook/pb_typeahead/typeahead.rb
Instance Method Summary
collapse
Methods inherited from KitBase
#object
Methods included from ZIndex
included
Methods included from Spacing
included, #max_width_options, #max_width_props, #max_width_values, #spacing_options, #spacing_props, #spacing_values
Methods included from Classnames
#generate_classname, #generate_classname_without_spacing, included
#initialize, #prop
#pb_rails
#pb_form_with
Instance Method Details
#classname ⇒ Object
21
22
23
|
# File 'app/pb_kits/playbook/pb_typeahead/typeahead.rb', line 21
def classname
generate_classname("pb_typeahead_kit")
end
|
#data ⇒ Object
25
26
27
28
29
30
31
|
# File 'app/pb_kits/playbook/pb_typeahead/typeahead.rb', line 25
def data
Hash(values[:data]).merge(
pb_typeahead_kit: true,
pb_typeahead_kit_search_term_minimum_length: search_term_minimum_length,
pb_typeahead_kit_search_debounce_timeout: search_debounce_timeout
)
end
|
#typeahead_with_pills_options ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'app/pb_kits/playbook/pb_typeahead/typeahead.rb', line 33
def typeahead_with_pills_options
base_options = {
dark: dark,
defaultValue: default_options,
id: id,
isMulti: true,
label: label,
name: name,
options: options,
placeholder: placeholder,
}
base_options.merge!({ getOptionLabel: get_option_label }) if get_option_label.present?
base_options.merge!({ getOptionValue: get_option_value }) if get_option_value.present?
base_options.merge!({ async: true, loadOptions: load_options }) if async
base_options
end
|