"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _uiIcons = require("@teamleader/ui-icons");

var _classnames = _interopRequireDefault(require("classnames"));

var _react = _interopRequireDefault(require("react"));

var _box = _interopRequireDefault(require("../box"));

var _iconButton = _interopRequireDefault(require("../iconButton"));

var _typography = require("../typography");

var _theme = _interopRequireDefault(require("./theme.css"));

var _excluded = ["children", "className", "onRemoveClick", "size"];

var Tag = function Tag(_ref) {
  var children = _ref.children,
      className = _ref.className,
      onRemoveClick = _ref.onRemoveClick,
      _ref$size = _ref.size,
      size = _ref$size === void 0 ? 'medium' : _ref$size,
      others = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var classNames = (0, _classnames.default)(_theme.default["is-".concat(size)], _theme.default['wrapper'], className);
  var TextElement = size === 'small' ? _typography.UITextSmall : size === 'large' ? _typography.UITextDisplay : _typography.UITextBody;
  return /*#__PURE__*/_react.default.createElement(_box.default, (0, _extends2.default)({}, others, {
    className: classNames,
    "data-teamleader-ui": "tag",
    display: "inline-flex"
  }), /*#__PURE__*/_react.default.createElement(TextElement, {
    color: "teal",
    marginLeft: size === 'small' ? 2 : 3,
    marginRight: onRemoveClick ? 1 : size === 'small' ? 2 : 3,
    marginVertical: size === 'small' ? 0 : 1,
    maxLines: 1,
    tint: "darkest"
  }, children), onRemoveClick && /*#__PURE__*/_react.default.createElement(_iconButton.default, {
    className: _theme.default['remove-button'],
    flexShrink: 0,
    icon: /*#__PURE__*/_react.default.createElement(_uiIcons.IconCloseSmallOutline, null),
    onClick: onRemoveClick
  }));
};

var _default = Tag;
exports.default = _default;