var _excluded = ["badgeColor", "color", "type", "weight", "children"];
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; }
import React from 'react';
import styled from 'styled-components';
import { Typography } from '../../../..';
import { BaseBadge } from '../BaseBadge';
import { PRIMARY_HORIZONTAL_PADDING, VERTICAL_PADDING, SECONDARY_HORIZONTAL_PADDING, PRIMARY_MIN_WIDTH, SECONDARY_MIN_WIDTH } from './LabelBadge.constants';
var StyledBaseBadge = styled(BaseBadge).withConfig({
  displayName: "LabelBadge__StyledBaseBadge",
  componentId: "sc-b31t10-0"
})(["border-radius:", ";", " ", ""], function (_ref) {
  var theme = _ref.theme;
  return theme.borderRadius2;
}, function (p) {
  return p.$type === 'primary' ? "padding: ".concat(p.theme.spacing.unit(VERTICAL_PADDING), "px ").concat(p.theme.spacing.unit(PRIMARY_HORIZONTAL_PADDING), "px;") : "padding: ".concat(p.theme.spacing.unit(VERTICAL_PADDING), "px ").concat(p.theme.spacing.unit(SECONDARY_HORIZONTAL_PADDING), "px;");
}, function (p) {
  return p.$type === 'primary' ? "min-width: ".concat(p.theme.spacing.unit(PRIMARY_MIN_WIDTH), "px;") : "min-width: ".concat(p.theme.spacing.unit(SECONDARY_MIN_WIDTH), "px;");
});
export var LabelBadge = React.forwardRef(function (_ref2, ref) {
  var _ref2$badgeColor = _ref2.badgeColor,
    badgeColor = _ref2$badgeColor === void 0 ? function (t) {
      return t.color.badgeBackground;
    } : _ref2$badgeColor,
    _ref2$color = _ref2.color,
    color = _ref2$color === void 0 ? function (t) {
      return t.color.badgeTextColor;
    } : _ref2$color,
    _ref2$type = _ref2.type,
    type = _ref2$type === void 0 ? 'primary' : _ref2$type,
    weight = _ref2.weight,
    children = _ref2.children,
    htmlProps = _objectWithoutProperties(_ref2, _excluded);
  return React.createElement(StyledBaseBadge, _extends({}, htmlProps, {
    ref: ref,
    badgeColor: badgeColor,
    $type: type,
    variant: "rect"
  }), React.createElement(Typography, {
    type: type === 'primary' ? 'secondary' : 'tertiary',
    color: color,
    weight: weight
  }, children));
});