'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _Step = require('./Step');

var _Step2 = _interopRequireDefault(_Step);

var _StepList = require('./styles/StepList');

var _StepList2 = _interopRequireDefault(_StepList);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Steps = function (_React$Component) {
  (0, _inherits3.default)(Steps, _React$Component);

  function Steps() {
    var _ref;

    var _temp, _this, _ret;

    (0, _classCallCheck3.default)(this, Steps);

    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Steps.__proto__ || (0, _getPrototypeOf2.default)(Steps)).call.apply(_ref, [this].concat(args))), _this), _this.renderSteps = function () {
      return _react2.default.Children.map(_this.props.children, function (step, index) {
        return _react2.default.cloneElement(step, { number: index + 1 });
      });
    }, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
  }

  (0, _createClass3.default)(Steps, [{
    key: 'render',
    value: function render() {
      var List = this.props.List;


      return _react2.default.createElement(
        List,
        null,
        this.renderSteps()
      );
    }
  }]);
  return Steps;
}(_react2.default.Component);

Steps.propTypes = {
  /**
   * Children must be an array of Step components
   */
  children: _propTypes2.default.node.isRequired,
  /**
   * Override the component that renders the list container
   */
  List: _propTypes2.default.func
};
Steps.defaultProps = {
  List: _StepList2.default
};
exports.default = Steps;


Steps.Step = _Step2.default;