"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf3=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),React=_interopRequireWildcard(require("react")),_classnames=_interopRequireDefault(require("classnames")),_lodash=_interopRequireDefault(require("lodash")),_propTypes=_interopRequireDefault(require("prop-types")),_withStyles=_interopRequireDefault(require("../../hoc/withStyles")),_ErrorBoundary=_interopRequireDefault(require("../../hoc/ErrorBoundary")),_styles=_interopRequireDefault(require("./styles")),WizardSteps=/*#__PURE__*/function(_React$Component){function WizardSteps(){var _getPrototypeOf2,_this;(0,_classCallCheck2.default)(this,WizardSteps);for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return _this=(0,_possibleConstructorReturn2.default)(this,(_getPrototypeOf2=(0,_getPrototypeOf3.default)(WizardSteps)).call.apply(_getPrototypeOf2,[this].concat(args))),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)((0,_assertThisInitialized2.default)(_this)),"_getActiveStep",function(){var steps=_this.props.steps;return _lodash.default.find(steps,{active:!0})}),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)((0,_assertThisInitialized2.default)(_this)),"_renderStepComponent",function(){var activeStep=_this._getActiveStep();return activeStep?activeStep.component:null}),_this}return(0,_inherits2.default)(WizardSteps,_React$Component),(0,_createClass2.default)(WizardSteps,[{key:"_renderSteps",value:function _renderSteps(){var _this$props=this.props,classes=_this$props.classes,steps=_this$props.steps,onStepClick=_this$props.onStepClick;return React.createElement("div",{className:classes.steps},steps.map(function(step,index){var _cx,isLastStep=steps.length-1===index,stepClasses=(0,_classnames.default)(classes.step,(_cx={},(0,_defineProperty2.default)(_cx,classes.lastStep,isLastStep),(0,_defineProperty2.default)(_cx,"active",step.active),(0,_defineProperty2.default)(_cx,"visited",step.visited),_cx));return React.createElement("div",{className:stepClasses,key:index,onClick:function onClick(){onStepClick&&onStepClick(step,index)}},React.createElement("div",{className:classes.barWrapper},React.createElement("div",{className:classes.stepCircle},React.createElement("div",{className:classes.stepNumber},index+1),React.createElement("div",{className:classes.stepLabel},step.label)),!isLastStep&&React.createElement("div",{className:classes.stepBar})))}))}},{key:"render",value:function render(){var classes=this.props.classes;return React.createElement(_ErrorBoundary.default,null,React.createElement("div",{className:classes.component},React.createElement("div",{className:classes.wrapper},this._renderSteps(),this._renderStepComponent())))}}]),WizardSteps}(React.Component);(0,_defineProperty2.default)(WizardSteps,"propTypes",{steps:_propTypes.default.arrayOf(_propTypes.default.shape({visited:_propTypes.default.bool,active:_propTypes.default.bool,label:_propTypes.default.string.isRequired,component:_propTypes.default.node.isRequired})),activeColor:_propTypes.default.string,visitedColor:_propTypes.default.string,onStepClick:_propTypes.default.func,classes:_propTypes.default.object// comes from withStyles HOC
}),(0,_defineProperty2.default)(WizardSteps,"defaultProps",{onStepClick:function onStepClick(){}});var _default=(0,_withStyles.default)(_styles.default)(WizardSteps);exports.default=_default;