Class: Playbook::PbTypeahead::Typeahead

Inherits:
Object
  • Object
show all
Includes:
Playbook::Props
Defined in:
app/pb_kits/playbook/pb_typeahead/typeahead.rb

Instance Method Summary collapse

Methods included from Playbook::Props

#dark_props, #generate_classname, #generate_classname_without_spacing, #initialize, #prop, #spacing_options, #spacing_props, #spacing_values

Instance Method Details

#classnameObject



26
27
28
# File 'app/pb_kits/playbook/pb_typeahead/typeahead.rb', line 26

def classname
  generate_classname("pb_typeahead_kit")
end

#dataObject



30
31
32
33
34
35
36
# File 'app/pb_kits/playbook/pb_typeahead/typeahead.rb', line 30

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_optionsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/pb_kits/playbook/pb_typeahead/typeahead.rb', line 38

def typeahead_with_pills_options
  base_options = {
    defaultValue: default_options,
    id: id,
    isMulti: true,
    label: label,
    options: options,
    placeholder: placeholder
  }

  base_options.merge!({
    async: true,
    loadOptions: load_options,
  }) if async

  base_options
end