<commit_before>import React from 'react'
import classNames from 'classnames'
import uncontrollableInput from 'uncontrollable-input'

import Component from '../../base-component'
import Icon from '../../icon'
import propTypes from '../../prop-types'

import styles from './index.css'

@uncontrollableInput()
@propTypes({
  className: propTypes.string,
  onChange: propTypes.func,
  icon: propTypes.string,
  iconOn: propTypes.string,
  iconOff: propTypes.string,
  iconSize: propTypes.number,
  value: propTypes.bool
})
export default class Toggle extends Component {
  static defaultProps = {
    iconOn: 'toggle-on',
    iconOff: 'toggle-off',
    iconSize: 2
  }

  render () {
    const { props } = this

    return (
      <label
        className={classNames(
          props.disabled ? 'text-muted' : props.value ? 'text-success' : null,
          props.className
        )}
      >
        <Icon
          icon={props.icon || (props.value ? props.iconOn : props.iconOff)}
          size={props.iconSize}
        />
        <input
          checked={props.value || false}
          className={styles.checkbox}
          disabled={props.disabled}
          onChange={props.onChange}
          type='checkbox'
        />
      </label>
    )
  }
}<commit_msg>fix(form/Toggle): onChange now emits the raw value<commit_after>import React from 'react'
import classNames from 'classnames'
import uncontrollableInput from 'uncontrollable-input'

import Component from '../../base-component'
import Icon from '../../icon'
import propTypes from '../../prop-types'

import styles from './index.css'

@uncontrollableInput()
@propTypes({
  className: propTypes.string,
  onChange: propTypes.func,
  icon: propTypes.string,
  iconOn: propTypes.string,
  iconOff: propTypes.string,
  iconSize: propTypes.number,
  value: propTypes.bool
})
export default class Toggle extends Component {
  static defaultProps = {
    iconOn: 'toggle-on',
    iconOff: 'toggle-off',
    iconSize: 2
  }

  _onChange = event => this.props.onChange(event.target.checked)

  render () {
    const { props } = this

    return (
      <label
        className={classNames(
          props.disabled ? 'text-muted' : props.value ? 'text-success' : null,
          props.className
        )}
      >
        <Icon
          icon={props.icon || (props.value ? props.iconOn : props.iconOff)}
          size={props.iconSize}
        />
        <input
          checked={props.value || false}
          className={styles.checkbox}
          disabled={props.disabled}
          onChange={this._onChange}
          type='checkbox'
        />
      </label>
    )
  }
}
{'fraction_non_alphanumeric': 0.12818562190947128, 'fraction_numerical': 0.0007607455306200076, 'mean_word_length': 2.4880636604774535, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, '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': '4205177', 'n_tokens_mistral': 775, 'n_tokens_neox': 769, 'n_words': 179}