"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TooltipBadge = void 0;
var _react = _interopRequireDefault(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _ = require("..");
var _Typography = _interopRequireDefault(require("../../../../Atoms/Typography"));
var _Button = _interopRequireDefault(require("../../../Button"));
var _TooltipBadge = require("./TooltipBadge.constants");
var _excluded = ["baseBadgeSize"],
  _excluded2 = ["badgeSize", "onClick"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var StyledTypography = (0, _styledComponents.default)(_Typography.default).withConfig({
  displayName: "TooltipBadge__StyledTypography",
  componentId: "sc-q66su9-0"
})(["font-weight:800;cursor:default;"]);
var StyledBaseBadge = (0, _styledComponents.default)(_.BaseBadge).withConfig({
  displayName: "TooltipBadge__StyledBaseBadge",
  componentId: "sc-q66su9-1"
})(["background-color:", ";"], function (_ref) {
  var theme = _ref.theme;
  return theme.colorTokens.neutral.background_strong;
});
var StyledButton = (0, _styledComponents.default)(_Button.default).withConfig({
  displayName: "TooltipBadge__StyledButton",
  componentId: "sc-q66su9-2"
})(["", ""], function (_ref2) {
  var theme = _ref2.theme;
  return "\n    :hover {\n      cursor: pointer;\n      ".concat(StyledTypography, " {\n        color: ").concat(theme.colorTokens.action.text_default, ";\n        cursor: pointer;\n      }\n      ").concat(StyledBaseBadge, " {\n        background-color: ").concat(theme.colorTokens.action.background_weak, ";\n      }\n    }\n    :focus {\n      cursor: pointer;\n      ").concat(StyledTypography, " {\n        color: ").concat(theme.colorTokens.neutral.text_default, ";\n        cursor: pointer;\n      }\n      ").concat(StyledBaseBadge, " {\n        border: 2px solid ").concat(theme.colorTokens.action.border_focus, ";\n      }\n    }");
});
var TooltipBadgeContent = _react.default.forwardRef(function (_ref3, ref) {
  var baseBadgeSize = _ref3.baseBadgeSize,
    htmlProps = _objectWithoutProperties(_ref3, _excluded);
  var typographyType = baseBadgeSize === _TooltipBadge.TooltipBadgeSize.s ? 'caption' : 'secondary';
  return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(StyledBaseBadge, _extends({}, htmlProps, {
    ref: ref,
    badgeColor: function badgeColor(t) {
      return t.colorTokens.neutral.text_default;
    },
    badgeSize: baseBadgeSize,
    symmetricShape: true
  }), _react.default.createElement(StyledTypography, {
    type: typographyType
  }, "?")));
});
var TooltipBadge = exports.TooltipBadge = _react.default.forwardRef(function (_ref4, ref) {
  var _ref4$badgeSize = _ref4.badgeSize,
    badgeSize = _ref4$badgeSize === void 0 ? 'l' : _ref4$badgeSize,
    onClick = _ref4.onClick,
    htmlProps = _objectWithoutProperties(_ref4, _excluded2);
  var baseBadgeSize = typeof badgeSize === 'number' ? badgeSize : _TooltipBadge.TooltipBadgeSize[badgeSize];
  return onClick ? _react.default.createElement(StyledButton, {
    variant: "neutral",
    onClick: onClick
  }, _react.default.createElement(TooltipBadgeContent, _extends({}, htmlProps, {
    ref: ref,
    baseBadgeSize: baseBadgeSize
  }))) : _react.default.createElement(TooltipBadgeContent, _extends({}, htmlProps, {
    ref: ref,
    baseBadgeSize: baseBadgeSize
  }));
});