"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _faXmark = require("@fortawesome/free-solid-svg-icons/faXmark");
var _fontAwesomeIcon = require("../font-awesome-icon");
var _truncateWithTooltip = require("../truncate-with-tooltip");
var _button = require("../button");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function FilterItem({
  id,
  filter,
  onClearOne,
  deleteFilterItemText
}) {
  const {
    content,
    className,
    label,
    testId,
    tooltipText
  } = filter;
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
    id: id,
    className: (0, _classnames.default)('filter-item', className),
    role: "listitem",
    "test-id": testId,
    children: [label && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
      className: "filter-item-label",
      children: [label, ":"]
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_truncateWithTooltip.TruncateWithTooltip, {
      className: "filter-item-content",
      tooltipText: tooltipText,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
        "test-id": `${testId}-content`,
        children: content
      })
    }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
      onClick: () => onClearOne(filter),
      className: "button command",
      "test-id": "filter-remove",
      "aria-label": deleteFilterItemText,
      "aria-labelledby": id,
      type: _button.BUTTON_TYPES.BUTTON,
      children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_fontAwesomeIcon.FontAwesomeIcon, {
        icon: _faXmark.faXmark
      })
    })]
  });
}
var _default = exports.default = FilterItem;