import _extends from "@babel/runtime/helpers/extends";
import React, { forwardRef, useContext } from 'react';
import classNames from 'classnames';
import StatisticNumber from './Number';
import Countdown from './Countdown';
import ConfigContext from '../config-provider/ConfigContext';
var Statistic = /*#__PURE__*/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 = useContext(ConfigContext),
      getPrefixCls = _useContext.getPrefixCls;

  var prefixCls = getPrefixCls('statistic', customizePrefixCls);
  var valueNode = /*#__PURE__*/React.createElement(StatisticNumber, _extends({}, props, {
    prefixCls: prefixCls,
    value: value
  }));
  var cls = classNames(prefixCls, className);
  return /*#__PURE__*/React.createElement("div", {
    className: cls,
    style: style,
    onMouseEnter: onMouseEnter,
    onMouseLeave: onMouseLeave
  }, title && /*#__PURE__*/React.createElement("div", {
    className: "".concat(prefixCls, "-title")
  }, title), /*#__PURE__*/React.createElement("div", {
    style: valueStyle,
    className: "".concat(prefixCls, "-content")
  }, prefix && /*#__PURE__*/React.createElement("span", {
    className: "".concat(prefixCls, "-content-prefix")
  }, prefix), valueRender ? valueRender(valueNode) : valueNode, suffix && /*#__PURE__*/React.createElement("span", {
    className: "".concat(prefixCls, "-content-suffix")
  }, suffix)));
});
Statistic.displayName = 'Statistic';
Statistic.defaultProps = {
  decimalSeparator: '.',
  groupSeparator: ','
};
Statistic.Countdown = Countdown;
export default Statistic;
//# sourceMappingURL=Statistic.js.map
