<commit_before>import React, {PropTypes} from 'react'
import FormBuilderPropTypes from '../FormBuilderPropTypes'
import Select from 'part:@sanity/components/selects/default'
import RadioSelect from 'part:@sanity/components/selects/radio'

export default class StringSelect extends React.PureComponent {
  static displayName = 'StringSelect';

  static propTypes = {
    type: FormBuilderPropTypes.type.isRequired,
    level: PropTypes.number.isRequired,
    value: PropTypes.string,
    focus: PropTypes.bool,
    onChange: PropTypes.func,
    onEnter: PropTypes.func,
  };

  static defaultProps = {
    value: '',
    onChange() {},
    onEnter() {},
    onFocus() {}
  }

  constructor(props, context) {
    super(props, context)
    this.handleChange = this.handleChange.bind(this)
    this.setInputElement = this.setInputElement.bind(this)
    this.state = {
      hasFocus: this.props.focus
    }
  }

  setInputElement(element) {
    this.inputElement = element
  }

  handleChange(item) {
    console.log('CHANGE', item)
    if (typeof (item) === 'object') {
      console.log('object', item.value)
      this.props.onChange({patch: {type: 'set', value: item.value}})
    }

    if (typeof (item) === 'string') {
      console.log('string', item)
      this.props.onChange({patch: {type: 'set', value: item}})
    }
  }

  handleFocus = () => {
    this.setState({
      hasFocus: true
    })
  }

  handleBlur = () => {
    this.setState({
      hasFocus: false<commit_msg>removing console logs<commit_after>import React, {PropTypes} from 'react'
import FormBuilderPropTypes from '../FormBuilderPropTypes'
import Select from 'part:@sanity/components/selects/default'
import RadioSelect from 'part:@sanity/components/selects/radio'

export default class StringSelect extends React.PureComponent {
  static displayName = 'StringSelect';

  static propTypes = {
    type: FormBuilderPropTypes.type.isRequired,
    level: PropTypes.number.isRequired,
    value: PropTypes.string,
    focus: PropTypes.bool,
    onChange: PropTypes.func,
    onEnter: PropTypes.func,
  };

  static defaultProps = {
    value: '',
    onChange() {},
    onEnter() {},
    onFocus() {}
  }

  constructor(props, context) {
    super(props, context)
    this.handleChange = this.handleChange.bind(this)
    this.setInputElement = this.setInputElement.bind(this)
    this.state = {
      hasFocus: this.props.focus
    }
  }

  setInputElement(element) {
    this.inputElement = element
  }

  handleChange(item) {
    if (typeof (item) === 'object') {
      this.props.onChange({patch: {type: 'set', value: item.value}})
    }

    if (typeof (item) === 'string') {
      this.props.onChange({patch: {type: 'set', value: item}})
    }
  }

  handleFocus = () => {
    this.setState({
      hasFocus: true
    })
  }

  handleBlur = () => {
    this.setState({
      hasFocus: false
{'fraction_non_alphanumeric': 0.13852058618283322, 'fraction_numerical': 0.0, 'mean_word_length': 3.2855007473841553, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '824311', 'n_tokens_mistral': 894, 'n_tokens_neox': 896, 'n_words': 181}