<commit_before>var React = require('react/addons');

var LaddaButton = React.createClass({
  displayName: 'LaddaButton',
  mixins: [React.addons.PureRenderMixin],

  propTypes: {
    active: React.PropTypes.bool,
    progress: React.PropTypes.number,
    style: React.PropTypes.string,
    color: React.PropTypes.string,
    size: React.PropTypes.string,
    spinnerSize: React.PropTypes.number,
    spinnerColor: React.PropTypes.string,
    children: React.PropTypes.node.isRequired
  },

  getDefaultProps: function() {
    return { style: 'expand-left' };
  },

  componentDidMount: function() {
    this.laddaButton = require('ladda/dist/ladda.min').create(this.getDOMNode());
  },

  componentWillUnmount: function() {
    if (this.laddaButton.remove) {
      this.laddaButton.remove();
    }
  },

  componentDidUpdate: function() {
    if (!this.laddaButton) {
      return;
    }

    if (this.props.active) {
      if (!this.active) {
        this.active = true;
        this.laddaButton.start();
      }
    } else {
      this.active = false;
      this.laddaButton.stop();
    }
    if (this.props.progress) {
      this.laddaButton.setProgress(this.props.progress);
    }
  },

  render: function() {
    var props = {className: 'ladda-button'};
    var laddaOptions = {
      style: 'data-style',
      color: 'data-color',
      size: 'data-size',
      spinnerSize: 'data-spinner-size',
      spinnerColor: 'data-spinner-color'
    };

    for (var prop in laddaOptions) {
      var dataAttr = laddaOptions[prop];
      if (this.props[prop]) {
        props[dataAttr] = this.props[prop];
      }
    }

    return React.addons.cloneWithProps(this.props.children, props);
  }
});

module.exports = LaddaButton;
<commit_msg>Fix overwriting of disabled property on DOM button<commit_after>var React = require('react/addons');

var LaddaButton = React.createClass({
  displayName: 'LaddaButton',
  mixins: [React.addons.PureRenderMixin],

  propTypes: {
    active: React.PropTypes.bool,
    progress: React.PropTypes.number,
    style: React.PropTypes.string,
    color: React.PropTypes.string,
    size: React.PropTypes.string,
    spinnerSize: React.PropTypes.number,
    spinnerColor: React.PropTypes.string,
    children: React.PropTypes.node.isRequired
  },

  getDefaultProps: function() {
    return { style: 'expand-left' };
  },

  componentDidMount: function() {
    this.laddaButton = require('ladda/dist/ladda.min').create(this.getDOMNode());
  },

  componentWillUnmount: function() {
    if (this.laddaButton.remove) {
      this.laddaButton.remove();
    }
  },

  componentDidUpdate: function() {
    if (!this.laddaButton) {
      return;
    }

    // skip if the button was initially disabled
    if (!this.props.active && this.props.children.props.disabled) {
      return;
    }

    if (this.props.active) {
      if (!this.active) {
        this.active = true;
        this.laddaButton.start();
      }
    } else {
      this.active = false;
      this.laddaButton.stop();
    }
    if (this.props.progress) {
      this.laddaButton.setProgress(this.props.progress);
    }
  },

  render: function() {
    var props = {className: 'ladda-button'};
    var laddaOptions = {
      style: 'data-style',
      color: 'data-color',
      size: 'data-size',
      spinnerSize: 'data-spinner-size',
      spinnerColor: 'data-spinner-color'
    };

    for (var prop in laddaOptions) {
      var dataAttr = laddaOptions[prop];
      if (this.props[prop]) {
        props[dataAttr] = this.props[prop];
      }
    }

    return React.addons.cloneWithProps(this.props.children, props);
  }
});

module.exports = LaddaButton;

{'fraction_non_alphanumeric': 0.13968775677896467, 'fraction_numerical': 0.0, 'mean_word_length': 2.8121085594989563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6373949', 'n_tokens_mistral': 1238, 'n_tokens_neox': 1190, 'n_words': 208}