"use strict";

exports.__esModule = true;
exports.default = void 0;
var _keys2 = _interopRequireDefault(require("lodash/fp/keys"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames = _interopRequireDefault(require("classnames"));
var _icon = _interopRequireDefault(require("../icon"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const TAG_STYLES = {
  default: _style.default.defaultStyle,
  success: _style.default.success,
  failure: _style.default.failure,
  warning: _style.default.warning,
  progress: _style.default.progress,
  info: _style.default.info
};
const TAG_SIZE = {
  S: _style.default.small,
  M: _style.default.medium,
  L: _style.default.large
};
const Tag = ({
  label,
  type = 'default',
  size = 'M',
  customStyle = {},
  icon = {}
}) => {
  const {
    position,
    ...iconProps
  } = icon;
  return /*#__PURE__*/_react.default.createElement("span", {
    className: (0, _classnames.default)(TAG_STYLES[type], TAG_SIZE[size]),
    "data-name": `content-tag-${label}`,
    style: customStyle
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.content
  }, position === 'left' ? /*#__PURE__*/_react.default.createElement(_icon.default, iconProps) : null, /*#__PURE__*/_react.default.createElement("div", null, label), position === 'right' ? /*#__PURE__*/_react.default.createElement(_icon.default, iconProps) : null));
};
Tag.propTypes = process.env.NODE_ENV !== "production" ? {
  label: _propTypes.default.string,
  type: _propTypes.default.oneOf((0, _keys2.default)(TAG_STYLES)),
  size: _propTypes.default.oneOf(['S', 'M', 'L']),
  customStyle: _propTypes.default.objectOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])),
  icon: _propTypes.default.shape({
    ..._icon.default.propTypes,
    position: _propTypes.default.oneOf(['left', 'right'])
  })
} : {};
var _default = exports.default = Tag;
//# sourceMappingURL=index.js.map