<commit_before>import React, {Component, PropTypes} from 'react';
import radium from 'radium';
import classNames from 'classnames';
import $ from 'jquery';

/**
 * A versatile checkbox with many styles.
 *
 * @example
 * // Regular checkbox
 * <Checkbox />
 *
 * @example
 * // Slider style checkbox
 * <Checkbox type='slider' />
 *
 * @example
 * // Toggle switch style checkbox
 * <Checkbox type='toggle' />
 */
@radium
export default class Checkbox extends Component {
  static propTypes = {
    className: PropTypes.string,
    defaultChecked: PropTypes.bool,
    label: PropTypes.string,
    name: PropTypes.string,
    onChange: PropTypes.func,
    style: PropTypes.array,
    type: PropTypes.string,
  };

  static defaultProps = {
    name: 'checkbox',
    type: 'checkbox',
  };

  componentDidMount() {
    this.container = $(React.findDOMNode(this.refs.container));
    this.checkbox = $(React.findDOMNode(this.refs.checkbox));

    this.container.checkbox({
      onChange: () => {
        this.props.onChange(this.checkbox.is(':checked'));
      }
    });
  }

  componentWillUnmount() {
    this.container.off();
  }

  render() {
    let classes = classNames(
      'sd-checkbox',
      'ui',
      this.props.className,
      {fitted: !this.props.label},
      'checkbox'
    );
    return (
      <div className={classes} ref='container'>
        <input {...this.props} ref='checkbox' />
        <label>{this.props.label}</label>
      </div>
    );
  }
}
<commit_msg>only spread non class props on checkbox input<commit_after>import _ from 'lodash';
import React, {Component, PropTypes} from 'react';
import radium from 'radium';
import classNames from 'classnames';
import $ from 'jquery';

/**
 * A versatile checkbox with many styles.
 *
 * @example
 * // Regular checkbox
 * <Checkbox />
 *
 * @example
 * // Slider style checkbox
 * <Checkbox type='slider' />
 *
 * @example
 * // Toggle switch style checkbox
 * <Checkbox type='toggle' />
 */
@radium
export default class Checkbox extends Component {
  static propTypes = {
    className: PropTypes.string,
    defaultChecked: PropTypes.bool,
    label: PropTypes.string,
    name: PropTypes.string,
    onChange: PropTypes.func,
    style: PropTypes.array,
    type: PropTypes.string,
  };

  static defaultProps = {
    name: 'checkbox',
    type: 'checkbox',
  };

  componentDidMount() {
    this.container = $(React.findDOMNode(this.refs.container));
    this.checkbox = $(React.findDOMNode(this.refs.checkbox));

    this.container.checkbox({
      onChange: () => {
        this.props.onChange(this.checkbox.is(':checked'));
      }
    });
  }

  componentWillUnmount() {
    this.container.off();
  }

  render() {
    let classes = classNames(
      'sd-checkbox',
      'ui',
      this.props.className,
      {fitted: !this.props.label},
      'checkbox'
    );
    let checkboxProps = _.clone(this.props);
    delete checkboxProps.className;
    return (
      <div className={classes} ref='container'>
        <input {...checkboxProps} ref='checkbox' />
        <label>{this.props.label}</label>
      </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.14855305466237942, 'fraction_numerical': 0.0, 'mean_word_length': 2.898496240601504, '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': '5983456', 'n_tokens_mistral': 954, 'n_tokens_neox': 949, 'n_words': 211}