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 is_react?

def is_react?
  pills || !is_multi
end

def typeahead_react_options

def typeahead_react_options
  base_options = {
    dark: dark,
    defaultValue: default_options,
    id: id,
    inline: inline,
    isMulti: is_multi,
    label: label,
    multiKit: multi_kit,
    name: name,
    options: options,
    placeholder: placeholder,
    plusIcon: plus_icon,
  }
  base_options[:getOptionLabel] = get_option_label if get_option_label.present?
  base_options[:getOptionValue] = get_option_value if get_option_value.present?
  if async
    base_options[:async] = true
    base_options[:loadOptions] = load_options
  end
  base_options
end