<commit_before>import React from 'react'
import PropTypes from 'prop-types'
import ControlLabel from '../ControlLabel/ControlLabel'
import Flexbox from '../../layout/Flexbox/Flexbox'
import InputAdornment from '../InputAdornment/InputAdornment'
import InputHint from '../InputHint/InputHint'

/**
 * Full field component that composes ControlLabel, props.inputComponent,
 * InputHint and InputAdornment components.
 */
const FormField = ({
  label,
  hint,
  placeholder,
  meta: { error, valid, touched, dirty },
  inputComponent: InputComponent,
  input,
  ...props
}) => {
  return (
    <div style={{ padding: '0 0 17px' }}>
      <Flexbox horizontal>
        <ControlLabel>{label}</ControlLabel>
        {(touched && error && typeof error === 'string') && <InputHint invalid={true}>{error}</InputHint>}
        {(hint && (!error || !touched)) && <InputHint>{hint}</InputHint>}
      </Flexbox>
      <Flexbox horizontal>
        <InputComponent
          fullWidth
          invalid={touched && !!error}
          valid={touched && valid}
          placeholder={placeholder}
          touched={touched}
          {...input}
          {...props}
        />
        {(touched && (!!error || valid)) && (
          <InputAdornment
            invalid={!!error}
            valid={valid}
          />
        )}
      </Flexbox>
    </div>
  )
}

FormField.propTypes = {
  /** Label text. */
  label: PropTypes.string.isRequired,
  meta: PropTypes.shape({
    /** Valid style. */
    valid: PropTypes.bool,
    /** Error text. The invalid input style is based on existence of this prop. */
    error: PropTypes.oneOf[PropTypes.string, PropTypes.bool],
  }),
  /** Hint text. */
  hint: PropTypes.string,
  /** Placeholder text. */
  placeholder: PropTypes.string
}

FormField.defaultProps = {
  meta: {}
}

FormField.displayName = 'FormField'<commit_msg>chore(styleguide): fix warnings<commit_after>import React from 'react'
import PropTypes from 'prop-types'
import ControlLabel from '../ControlLabel/ControlLabel'
import Flexbox from '../../layout/Flexbox/Flexbox'
import InputAdornment from '../InputAdornment/InputAdornment'
import InputHint from '../InputHint/InputHint'

/**
 * Full field component that composes ControlLabel, props.inputComponent,
 * InputHint and InputAdornment components.
 */
const FormField = ({
  label,
  hint,
  placeholder,
  meta: { error, valid, touched, dirty },
  inputComponent: InputComponent,
  input,
  ...props
}) => {
  return (
    <div style={{ padding: '0 0 17px' }}>
      <Flexbox horizontal>
        <ControlLabel>{label}</ControlLabel>
        {(touched && error && typeof error === 'string') && <InputHint invalid={true}>{error}</InputHint>}
        {(hint && (!error || !touched)) && <InputHint>{hint}</InputHint>}
      </Flexbox>
      <Flexbox horizontal>
        <InputComponent
          fullWidth
          invalid={touched && !!error}
          valid={touched && valid}
          placeholder={placeholder}
          touched={touched}
          {...input}
          {...props}
        />
        {(touched && (!!error || valid)) && (
          <InputAdornment
            invalid={!!error}
            valid={valid}
          />
        )}
      </Flexbox>
    </div>
  )
}

FormField.propTypes = {
  /** Label text. */
  label: PropTypes.string.isRequired,
  meta: PropTypes.shape({
    /** Valid style. */
    valid: PropTypes.bool,
    /** Error text. The invalid input style is based on existence of this prop. */
    error: PropTypes.oneOfType([
      PropTypes.string,
      PropTypes.bool
    ]),
  }),
  /** Hint text. */
  hint: PropTypes.string,
  /** Placeholder text. */
  placeholder: PropTypes.string
}

FormField.defaultProps = {
  meta: {}
}

FormField.displayName = 'FormField'
{'fraction_non_alphanumeric': 0.15111940298507462, 'fraction_numerical': 0.0021321961620469083, 'mean_word_length': 2.605187319884726, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 33, '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': '7586928', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1094, 'n_words': 262}