"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _theme = _interopRequireDefault(require("./theme.css"));

var _box = _interopRequireDefault(require("../box"));

var _ProgressStep = _interopRequireDefault(require("./ProgressStep"));

var ProgressTracker = function ProgressTracker(_ref) {
  var _ref$color = _ref.color,
      color = _ref$color === void 0 ? 'mint' : _ref$color,
      children = _ref.children,
      _ref$currentStep = _ref.currentStep,
      currentStep = _ref$currentStep === void 0 ? 0 : _ref$currentStep,
      done = _ref.done,
      _ref$labelPosition = _ref.labelPosition,
      labelPosition = _ref$labelPosition === void 0 ? 'top' : _ref$labelPosition;
  var classNames = (0, _classnames.default)(_theme.default['tracker'], _theme.default[color], _theme.default["tracker-".concat(labelPosition)]);
  return /*#__PURE__*/_react.default.createElement(_box.default, {
    className: classNames
  }, _react.default.Children.map(children, function (child, index) {
    var activeStep = Math.max(0, currentStep);
    var childProps = /*#__PURE__*/_react.default.isValidElement(child) && child.props;
    return /*#__PURE__*/_react.default.createElement(_ProgressStep.default, (0, _extends2.default)({
      active: done ? false : index === activeStep,
      completed: done || index < activeStep
    }, childProps));
  }));
};

ProgressTracker.ProgressStep = _ProgressStep.default;
var _default = ProgressTracker;
exports.default = _default;