"use strict";

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

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 = _interopRequireDefault(require("react"));

var _box = _interopRequireDefault(require("../box"));

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

var _theme = _interopRequireDefault(require("./theme.css"));

var _uiUtilities = _interopRequireDefault(require("@teamleader/ui-utilities"));

var _Monospaced = _interopRequireDefault(require("../typography/Monospaced"));

var _excluded = ["children", "className", "color", "count", "maxCount", "size", "borderColor", "borderTint"];

var Counter = function Counter(_ref) {
  var _cx;

  var children = _ref.children,
      className = _ref.className,
      _ref$color = _ref.color,
      color = _ref$color === void 0 ? 'neutral' : _ref$color,
      count = _ref.count,
      maxCount = _ref.maxCount,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? 'medium' : _ref$size,
      borderColor = _ref.borderColor,
      borderTint = _ref.borderTint,
      others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var classNames = (0, _classnames.default)(_uiUtilities.default['reset-font-smoothing'], _theme.default['counter'], _theme.default[color], _theme.default[size], (_cx = {}, (0, _defineProperty2.default)(_cx, _theme.default["border-".concat(borderColor, "-").concat(borderTint)], borderColor && borderTint), (0, _defineProperty2.default)(_cx, _theme.default["border-".concat(borderColor)], borderColor && !borderTint), _cx), className);
  return /*#__PURE__*/_react.default.createElement(_box.default, (0, _extends2.default)({
    className: classNames,
    element: "span"
  }, others, {
    "data-teamleader-ui": "counter"
  }), /*#__PURE__*/_react.default.createElement(_Monospaced.default, null, count > maxCount ? "".concat(maxCount, "+") : count), " ", children);
};

var _default = Counter;
exports.default = _default;