<commit_before>import React from 'react';
import Select from 'react-select';

export const TypeDropdown = ({ type, typeState, typeOptions, onChange, onInputChange, onSubmit }) => {
  const options = [];

  if (Object.keys(typeOptions).length === 0) {
    return (
      <div className='col-md-5'>
        <form onSubmit={onSubmit}>
          <input
            className='input-type form-control col-xs-11'
            value={typeState}
            onChange={onInputChange}
            onBlur={onSubmit}
            autoFocus={true}
          />
        </form>
      </div>
    );
  }

  for (const key in typeOptions) {
    if (typeOptions.hasOwnProperty(key)) {
      options.push({
        label: typeOptions[key].name,
        value: typeOptions[key].name
      });
    }
  }
  return (
    <div className='col-md-5'>
      <form onSubmit={onSubmit}>
        <Select
          autoBlur={false}
          openOnFocus={true}
          className={`form-control edit-${type}-type__input`}
          clearable={false}
          value={typeState}
          onChange={(option) => onChange(option ? option.value : null)}
          onBlur={onSubmit}
          autofocus={true}
          options={options}
        />
      </form>
    </div>
  );
};

TypeDropdown.propTypes = {
  onChange: React.PropTypes.func.isRequired,
  onInputChange: React.PropTypes.func.isRequired,<commit_msg>Add className<commit_after>import React from 'react';
import Select from 'react-select';

export const TypeDropdown = ({ type, typeState, typeOptions, onChange, onInputChange, onSubmit }) => {
  const options = [];

  if (Object.keys(typeOptions).length === 0) {
    return (
      <div className='type-dropdown col-md-5'>
        <form onSubmit={onSubmit}>
          <input
            className='input-type form-control col-xs-11'
            value={typeState}
            onChange={onInputChange}
            onBlur={onSubmit}
            autoFocus={true}
          />
        </form>
      </div>
    );
  }

  for (const key in typeOptions) {
    if (typeOptions.hasOwnProperty(key)) {
      options.push({
        label: typeOptions[key].name,
        value: typeOptions[key].name
      });
    }
  }
  return (
    <div className='type-dropdown col-md-5'>
      <form onSubmit={onSubmit}>
        <Select
          autoBlur={false}
          openOnFocus={true}
          className={`form-control edit-${type}-type__input`}
          clearable={false}
          value={typeState}
          onChange={(option) => onChange(option ? option.value : null)}
          onBlur={onSubmit}
          autofocus={true}
          options={options}
        />
      </form>
    </div>
  );
};

TypeDropdown.propTypes = {
  onChange: React.PropTypes.func.isRequired,
  onInputChange: React.PropTypes.func.isRequired,
{'fraction_non_alphanumeric': 0.13711414213926776, 'fraction_numerical': 0.003589375448671931, 'mean_word_length': 2.1961009174311927, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6337849', 'n_tokens_mistral': 828, 'n_tokens_neox': 831, 'n_words': 152}