"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _icon = require("../icon");
var _colors = require("./mixins/colors");
var _excluded = ["icon", "color", "hollow", "flavour", "size"];
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
var sizes = {
  "default": "14px",
  large: "16px"
};
var PillIcon = function PillIcon(_ref) {
  var icon = _ref.icon,
    color = _ref.color,
    hollow = _ref.hollow,
    flavour = _ref.flavour,
    size = _ref.size,
    rest = _objectWithoutPropertiesLoose(_ref, _excluded);
  if (!icon) return null;
  if (typeof icon !== "string") return icon;
  return /*#__PURE__*/_react["default"].createElement(_icon.Icon, _extends({
    color: color || (hollow ? (0, _colors.getPillColor)("color", flavour) : "bright"),
    "data-testid": "pill-icon",
    height: sizes[size] || sizes["default"],
    width: sizes[size] || sizes["default"],
    name: icon
  }, rest));
};
var _default = exports["default"] = PillIcon;