"use strict";

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

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

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

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

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

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

var _Number = _interopRequireDefault(require("./Number"));

var _Countdown = _interopRequireDefault(require("./Countdown"));

var _ConfigContext = _interopRequireDefault(require("../config-provider/ConfigContext"));

var Statistic = /*#__PURE__*/(0, _react.forwardRef)(function Statistic(props, _ref) {
  var customizePrefixCls = props.prefixCls,
      className = props.className,
      style = props.style,
      valueStyle = props.valueStyle,
      _props$value = props.value,
      value = _props$value === void 0 ? 0 : _props$value,
      title = props.title,
      valueRender = props.valueRender,
      prefix = props.prefix,
      suffix = props.suffix,
      onMouseEnter = props.onMouseEnter,
      onMouseLeave = props.onMouseLeave;

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

  var prefixCls = getPrefixCls('statistic', customizePrefixCls);

  var valueNode = /*#__PURE__*/_react["default"].createElement(_Number["default"], (0, _extends2["default"])({}, props, {
    prefixCls: prefixCls,
    value: value
  }));

  var cls = (0, _classnames["default"])(prefixCls, className);
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: cls,
    style: style,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave
  }, title && /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(prefixCls, "-title")
  }, title), /*#__PURE__*/_react["default"].createElement("div", {
    style: valueStyle,
    className: "".concat(prefixCls, "-content")
  }, prefix && /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(prefixCls, "-content-prefix")
  }, prefix), valueRender ? valueRender(valueNode) : valueNode, suffix && /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(prefixCls, "-content-suffix")
  }, suffix)));
});
Statistic.displayName = 'Statistic';
Statistic.defaultProps = {
  decimalSeparator: '.',
  groupSeparator: ','
};
Statistic.Countdown = _Countdown["default"];
var _default = Statistic;
exports["default"] = _default;
//# sourceMappingURL=Statistic.js.map
