<commit_before>import PropTypes from 'prop-types';
import React, { Component } from 'react';
import classnames from 'classnames';

const propTypes = {
  label: PropTypes.string,
  className: PropTypes.string,
  current: PropTypes.bool,
  complete: PropTypes.bool,
  incomplete: PropTypes.bool,
  description: PropTypes.string,
};

const ProgressStep = ({ ...props }) => {
  const {
    label,
    description,
    className,
    current,
    complete,
    incomplete,
  } = props;

  const classes = classnames({
    'bx--progress-step': true,
    'bx--progress-step--current': current,
    'bx--progress-step--complete': complete,
    'bx--progress-step--incomplete': incomplete,
    [className]: className,
  });

  return (
    <li className={classes}>
      <svg>
        <title>{description}</title>
        {current
          ? <g>
              <circle
                stroke="#3d70b2"
                strokeWidth="5"
                fill="transparent"
                cx="12"
                cy="12"
                r="12"
              />
              <circle fill="#3d70b2" cx="12" cy="12" r="6" />
            </g>
          : null}
        {complete
          ? <g>
              <circle cx="12" cy="12" r="12" />
              <polygon points="10.3 13.6 7.7 11 6.3 12.4 10.3 16.4 17.8 9 16.4 7.6" />
            </g>
          : null}
        {incomplete ? <circle cx="12" cy="12" r="12" /> : null}
      </svg>
      <p className="bx--progress-label">{label}</p>
      <span className="bx--progress-line" />
    </li>
  );
};
ProgressStep.propTypes = propTypes;

class ProgressIndicator extends Component {
  static propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    currentIndex: PropTypes.number,
  };

  static defaultProps = {
    currentIndex: 0,
  };

  state = {
    currentIndex: this.props.currentIndex,
  };

  componentWillReceiveProps(nextProps) {
    if (nextProps.currentIndex !== this.props.currentIndex) {
      this.setState({ currentIndex: nextProps.currentIndex });
    }
  }

  renderSteps = () =>
    React.Children.map(this.props.children, (child, index) => {
      if (index === this.state.currentIndex) {
        return React.cloneElement(child, {
          current: true,
        });
      } else if (index < this.state.currentIndex) {
        return React.cloneElement(child, {
          complete: true,
        });
      } else if (index > this.state.currentIndex) {
        return React.cloneElement(child, {
          incomplete: true,
        });
      }
      return null;
    });

  render() {
    const { className, currentIndex, ...other } = this.props;
    const classes = classnames({
      'bx--progress': true,
      [className]: className,
    });
    if (currentIndex) {
      return (
        <ul className={classes} {...other}><commit_msg>fix(ProgressIndicator): label text as defaultProps (il8n) (#130)<commit_after>import PropTypes from 'prop-types';
import React, { Component } from 'react';
import classnames from 'classnames';

const propTypes = {
  label: PropTypes.string,
  className: PropTypes.string,
  current: PropTypes.bool,
  complete: PropTypes.bool,
  incomplete: PropTypes.bool,
  description: PropTypes.string
};

const defaultProps = {
  label: 'Provide label'
};

const ProgressStep = ({ ...props }) => {
  const { label, description, className, current, complete, incomplete } = props;

  const classes = classnames({
    'bx--progress-step': true,
    'bx--progress-step--current': current,
    'bx--progress-step--complete': complete,
    'bx--progress-step--incomplete': incomplete,
    [className]: className
  });

  return (
    <li className={classes}>
      <svg>
        <title>{description}</title>
        {current
          ? <g>
              <circle
                stroke="#3d70b2"
                strokeWidth="5"
                fill="transparent"
                cx="12"
                cy="12"
                r="12"
              />
              <circle fill="#3d70b2" cx="12" cy="12" r="6" />
            </g>
          : null}
        {complete
          ? <g>
              <circle cx="12" cy="12" r="12" />
              <polygon points="10.3 13.6 7.7 11 6.3 12.4 10.3 16.4 17.8 9 16.4 7.6" />
            </g>
          : null}
        {incomplete ? <circle cx="12" cy="12" r="12" /> : null}
      </svg>
      <p className="bx--progress-label">{label}</p>
      <span className="bx--progress-line" />
    </li>
  );
};

ProgressStep.propTypes = propTypes;
ProgressStep.defaultProps = defaultProps;

class ProgressIndicator extends Component {
  static propTypes = {
    children: PropTypes.node,
    className: PropTypes.string,
    currentIndex: PropTypes.number
  };

  static defaultProps = {
    currentIndex: 0
  };

  state = {
    currentIndex: this.props.currentIndex
  };

  componentWillReceiveProps(nextProps) {
    if (nextProps.currentIndex !== this.props.currentIndex) {
      this.setState({ currentIndex: nextProps.currentIndex });
    }
  }

  renderSteps = () =>
    React.Children.map(this.props.children, (child, index) => {
      if (index === this.state.currentIndex) {
        return React.cloneElement(child, {
          current: true
        });
      } else if (index < this.state.currentIndex) {
        return React.cloneElement(child, {
          complete: true
        });
      } else if (index > this.state.currentIndex) {
        return React.cloneElement(child, {
          incomplete: true
        });
      }
      return null;
    });

  render() {
    const { className, currentIndex, ...other } = this.props;
    const classes = classnames({
      'bx--progress': true,
      [className]: className
    });
    if (currentIndex) {
      return (
        <ul className={classes} {...other}>
{'fraction_non_alphanumeric': 0.14612981603609856, 'fraction_numerical': 0.022561610551891705, 'mean_word_length': 2.1067385444743936, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 49, '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': '1055051', 'n_tokens_mistral': 1810, 'n_tokens_neox': 1721, 'n_words': 374}