"use strict";

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

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

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

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

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

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

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

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

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

var _noop = _interopRequireDefault(require("lodash/noop"));

var _RenderIcon = _interopRequireDefault(require("./RenderIcon"));

var _icon = _interopRequireDefault(require("../../icon"));

var _excluded = ["className", "prefixCls", "style", "itemWidth", "status", "iconPrefix", "icon", "wrapperStyle", "adjustMarginRight", "stepNumber", "description", "title", "progressDot", "tailContent", "onChange", "onClick", "navigation"];

var Step = function Step(props) {
  var className = props.className,
      prefixCls = props.prefixCls,
      style = props.style,
      itemWidth = props.itemWidth,
      _props$status = props.status,
      status = _props$status === void 0 ? 'wait' : _props$status,
      iconPrefix = props.iconPrefix,
      icon = props.icon,
      wrapperStyle = props.wrapperStyle,
      adjustMarginRight = props.adjustMarginRight,
      stepNumber = props.stepNumber,
      description = props.description,
      title = props.title,
      progressDot = props.progressDot,
      tailContent = props.tailContent,
      onChange = props.onChange,
      _props$onClick = props.onClick,
      onClick = _props$onClick === void 0 ? _noop["default"] : _props$onClick,
      navigation = props.navigation,
      restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
  var onClickItem = (0, _react.useCallback)(function (e) {
    onClick(e);

    if (onChange) {
      onChange(Number(stepNumber) - 1);
    }
  }, [stepNumber, onChange, onClick]);
  var classString = (0, _classnames["default"])("".concat(prefixCls, "-item"), "".concat(prefixCls, "-item-").concat(status), className, (0, _defineProperty2["default"])({}, "".concat(prefixCls, "-item-custom"), icon));
  var stepItemStyle = (0, _objectSpread2["default"])({}, style);

  if (itemWidth) {
    stepItemStyle.width = itemWidth;
  }

  if (adjustMarginRight) {
    stepItemStyle.marginRight = adjustMarginRight;
  }

  if (onChange) {
    stepItemStyle.cursor = 'pointer';
  }

  return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, restProps, {
    className: classString,
    style: stepItemStyle,
    onClick: onClickItem
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-tail")
  }, tailContent), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-icon")
  }, /*#__PURE__*/_react["default"].createElement(_RenderIcon["default"], props)), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-content")
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-title")
  }, title, navigation && /*#__PURE__*/_react["default"].createElement(_icon["default"], {
    type: "navigate_next",
    className: "".concat(prefixCls, "-item-title-icon")
  })), description && /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-description")
  }, description)));
};

Step.displayName = 'RcStep';
var _default = Step;
exports["default"] = _default;
//# sourceMappingURL=Step.js.map
