<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import css from './Select.css';
import formStyles from '../sharedStyles/form.css';
import sharedInputStylesHelper from '../sharedStyles/sharedInputStylesHelper';
import omitProps from '../../util/omitProps';
import Icon from '../Icon';

const propTypes = {
  dataOptions: PropTypes.arrayOf(PropTypes.object),
  meta: PropTypes.object,
  fullWidth: PropTypes.bool,
  input: PropTypes.object,
  placeholder: PropTypes.string,
  value: PropTypes.string,
  error: PropTypes.bool,
  required: PropTypes.bool,
  validationEnabled: PropTypes.bool,
  marginBottom0: PropTypes.bool,
  rounded: PropTypes.bool,
  id: PropTypes.string,
};

const defaultProps = {
  meta: {},
  rounded: true,
  validationEnabled: true,
};

class Select extends React.Component {
  getRootClass() {
    return classNames(
      css.root,
      formStyles.inputGroup,
      { [`${css.fullWidth}`]: this.props.fullWidth },
    );
  }

  getLabelClass() {
    return classNames(
      formStyles.label,
      { [`${css.required}`]: this.props.required },
    );
  }

  getSelectClass() {
    return classNames(
      css.selectControl,
      // placeholder styling
      {
        [`${css.placeholder}`]: this.props.input ?
          this.props.placeholder && !this.props.input.value :
          this.props.placeholder && !this.props.value,
      }, // end placeholder
      sharedInputStylesHelper(this.props),
    );
  }

  render() {
    const { input, meta: { error, warning, touched }, ...rest } = this.props;
    const { ...selectAttr } = input;
    const {
      label,
      placeholder,
      dataOptions,
      children,
      fullWidth, // eslint-disable-line no-unused-vars
      marginBottom0, // eslint-disable-line no-unused-vars
      ...selectCustom
    } = rest;

    const options = [];

    if (this.props.placeholder) options.push(<option value="" key="x" disabled>{placeholder}</option>);

    if (dataOptions) {
      dataOptions.forEach((option, i) => {
        options.push(<option value={option.value} key={option.id || `option-${i}`}>{option.label}</option>);
      });
    }

    const component = (
      <select className={this.getSelectClass()} {...selectAttr} {...omitProps(selectCustom, ['rounded'])} >
        {options}
        {children}
      </select>
    );

    const errorElem = touched && error ?
      <div className={formStyles.feedbackError}>{error}</div> : null;<commit_msg>Suck `validationEnabled` out of properties<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import css from './Select.css';
import formStyles from '../sharedStyles/form.css';
import sharedInputStylesHelper from '../sharedStyles/sharedInputStylesHelper';
import omitProps from '../../util/omitProps';
import Icon from '../Icon';

const propTypes = {
  dataOptions: PropTypes.arrayOf(PropTypes.object),
  meta: PropTypes.object,
  fullWidth: PropTypes.bool,
  input: PropTypes.object,
  placeholder: PropTypes.string,
  value: PropTypes.string,
  error: PropTypes.bool,
  required: PropTypes.bool,
  validationEnabled: PropTypes.bool,
  marginBottom0: PropTypes.bool,
  rounded: PropTypes.bool,
  id: PropTypes.string,
};

const defaultProps = {
  meta: {},
  rounded: true,
  validationEnabled: true,
};

class Select extends React.Component {
  getRootClass() {
    return classNames(
      css.root,
      formStyles.inputGroup,
      { [`${css.fullWidth}`]: this.props.fullWidth },
    );
  }

  getLabelClass() {
    return classNames(
      formStyles.label,
      { [`${css.required}`]: this.props.required },
    );
  }

  getSelectClass() {
    return classNames(
      css.selectControl,
      // placeholder styling
      {
        [`${css.placeholder}`]: this.props.input ?
          this.props.placeholder && !this.props.input.value :
          this.props.placeholder && !this.props.value,
      }, // end placeholder
      sharedInputStylesHelper(this.props),
    );
  }

  render() {
    const { input, meta: { error, warning, touched }, ...rest } = this.props;
    const { ...selectAttr } = input;
    const {
      label,
      placeholder,
      dataOptions,
      children,
      fullWidth, // eslint-disable-line no-unused-vars
      marginBottom0, // eslint-disable-line no-unused-vars
      validationEnabled, // eslint-disable-line no-unused-vars
      ...selectCustom
    } = rest;

    const options = [];

    if (this.props.placeholder) options.push(<option value="" key="x" disabled>{placeholder}</option>);

    if (dataOptions) {
      dataOptions.forEach((option, i) => {
        options.push(<option value={option.value} key={option.id || `option-${i}`}>{option.label}</option>);
      });
    }

    const component = (
      <select className={this.getSelectClass()} {...selectAttr} {...omitProps(selectCustom, ['rounded'])} >
        {options}
        {children}
      </select>
    );

    const errorElem = touched && error ?
      <div className={formStyles.feedbackError}>{error}</div> : null;
{'fraction_non_alphanumeric': 0.1489403453689168, 'fraction_numerical': 0.0007849293563579278, 'mean_word_length': 2.9976470588235293, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '2444400', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1519, 'n_words': 316}