"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 _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 _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigContext"));

var _excluded = ["prefixCls", "className", "color", "children", "pending", "dot"];

var TimelineItem = function TimelineItem(props) {
  var _classNames, _classNames2;

  var customizePrefixCls = props.prefixCls,
      className = props.className,
      _props$color = props.color,
      color = _props$color === void 0 ? '' : _props$color,
      children = props.children,
      pending = props.pending,
      dot = props.dot,
      restProps = (0, _objectWithoutProperties2["default"])(props, _excluded);

  var _useContext = (0, _react.useContext)(_ConfigContext["default"]),
      getPrefixCls = _useContext.getPrefixCls;

  var prefixCls = getPrefixCls('timeline', customizePrefixCls);
  var itemClassName = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-item"), true), (0, _defineProperty2["default"])(_classNames, "".concat(prefixCls, "-item-pending"), pending), _classNames), className);
  var dotClassName = (0, _classnames["default"])((_classNames2 = {}, (0, _defineProperty2["default"])(_classNames2, "".concat(prefixCls, "-item-head"), true), (0, _defineProperty2["default"])(_classNames2, "".concat(prefixCls, "-item-head-custom"), dot), (0, _defineProperty2["default"])(_classNames2, "".concat(prefixCls, "-item-head-").concat(color), true), _classNames2));
  var customColor = /blue|red|green/.test(color) ? undefined : color;
  return /*#__PURE__*/_react["default"].createElement("li", (0, _extends2["default"])({}, restProps, {
    className: itemClassName
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-tail")
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: dotClassName,
    style: {
      borderColor: customColor,
      color: customColor
    }
  }, dot), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-item-content")
  }, children));
};

TimelineItem.displayName = 'TimelineItem';
TimelineItem.defaultProps = {
  color: 'blue',
  pending: false
};
var _default = TimelineItem;
exports["default"] = _default;
//# sourceMappingURL=TimelineItem.js.map
