var _excluded = ["icon", "color", "hollow", "flavour", "size"];
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 (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
import React from "react";
import { Icon } from "../icon";
import { getPillColor } from "./mixins/colors";
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.createElement(Icon, _extends({
    color: color || (hollow ? getPillColor("color", flavour) : "bright"),
    "data-testid": "pill-icon",
    height: sizes[size] || sizes["default"],
    width: sizes[size] || sizes["default"],
    name: icon
  }, rest));
};
export default PillIcon;