class Playbook::PbTypeahead::Typeahead

def classname

def classname
  generate_classname("pb_typeahead_kit")
end

def data

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

def inline_class

def inline_class
  inline ? " inline" : ""
end

def typeahead_with_pills_options

def typeahead_with_pills_options
  base_options = {
    dark: dark,
    defaultValue: default_options,
    id: id,
    inline: inline,
    isMulti: true,
    label: label,
    multiKit: multi_kit,
    name: name,
    options: options,
    placeholder: placeholder,
    plusIcon: plus_icon,
  }
  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