<commit_before>import React from 'react';
import createReactClass from 'create-react-class';
import ComponentMixin from './mixins/component';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import MuiFormControl from './MuiFormControl';
import MuiFormHelper from './MuiFormHelper';


const MuiSwitch = createReactClass({
  
  mixins: [ComponentMixin],
  
  getDefaultProps: function () {
    return {
      label: '',
      rowLabel: '',
      value: false
    };
  },
  
  changeValue: function (event) {
    const target = event.target;
    const value = target.checked;
    
    //this.setValue(value);
    this.props.onChange(this.props.name, value);
    
    setTimeout(() => {document.activeElement.blur();});
  },
  
  render: function () {
    
    const element = this.renderElement();
    
    if (this.props.layout === 'elementOnly') {
      return element;
    }
    
    return (
      <MuiFormControl {...this.getFormControlProperties()} label={this.props.rowLabel}
        htmlFor={this.getId()}
      >
        {element}
        <MuiFormHelper {...this.getFormHelperProperties()}/>
      </MuiFormControl><commit_msg>Fix onChange function on MuiSwitch component<commit_after>import React from 'react';
import createReactClass from 'create-react-class';
import ComponentMixin from './mixins/component';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import MuiFormControl from './MuiFormControl';
import MuiFormHelper from './MuiFormHelper';


const MuiSwitch = createReactClass({
  
  mixins: [ComponentMixin],
  
  getDefaultProps: function () {
    return {
      label: '',
      rowLabel: '',
      value: false
    };
  },
  
  changeValue: function (event) {
    const target = event.target;
    const value = target.checked;
    
    //this.setValue(value);
    this.props.onChange(value);
    
    setTimeout(() => {document.activeElement.blur();});
  },
  
  render: function () {
    
    const element = this.renderElement();
    
    if (this.props.layout === 'elementOnly') {
      return element;
    }
    
    return (
      <MuiFormControl {...this.getFormControlProperties()} label={this.props.rowLabel}
        htmlFor={this.getId()}
      >
        {element}
        <MuiFormHelper {...this.getFormHelperProperties()}/>
      </MuiFormControl>
{'fraction_non_alphanumeric': 0.13557213930348258, 'fraction_numerical': 0.0, 'mean_word_length': 3.0554621848739494, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '5109635', 'n_tokens_mistral': 707, 'n_tokens_neox': 719, 'n_words': 149}