import { defineComponent as _, useCssModule as h, computed as v, openBlock as s, createBlock as b, normalizeClass as l, unref as t, withCtx as C, createElementVNode as w, renderSlot as k, createElementBlock as n, toDisplayString as y, createCommentVNode as i, createVNode as D } from "vue";
import { t as c } from "./locale.js";
import x from "./Chip.js";
import B from "./Icon.js";
import { _ as S } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const F = { class: "flex items-center" }, O = ["aria-label", "title"], g = { key: 1 }, z = /* @__PURE__ */ _({
  __name: "FilterChip",
  props: {
    filterCount: { default: void 0 },
    hasDropdown: { type: Boolean, default: !1 },
    isDropdownOpen: { type: Boolean, default: !1 },
    isRemovable: { type: Boolean, default: !1 },
    isSelected: { type: Boolean, default: !1 }
  },
  emits: ["click", "remove"],
  setup(d, { emit: p }) {
    const e = d, a = p, o = h(), r = v(() => Number(e.filterCount) > 0);
    function m() {
      a("click");
    }
    function u() {
      a("remove");
    }
    return (f, M) => (s(), b(x, {
      "should-override-colors": "",
      tabindex: "0",
      class: l(["stash-filter-chip text-sm font-normal normal-case leading-5 text-ice-900", [
        t(o).root,
        {
          [t(o)["is-selected"]]: e.isSelected,
          [t(o)["is-removable"]]: e.isRemovable,
          [t(o)["is-dropdown-open"]]: e.isDropdownOpen,
          [t(o)["has-dropdown"]]: e.hasDropdown,
          [t(o)["has-filter-count"]]: r.value
        }
      ]]),
      radius: "pill",
      "is-removable": e.isSelected && e.isRemovable && !e.hasDropdown,
      onClick: m,
      onRemove: u
    }, {
      default: C(() => [
        w("div", F, [
          k(f.$slots, "default"),
          r.value ? (s(), n("span", {
            key: 0,
            "data-test": "span|filter-count",
            class: l(t(o)["filter-count"]),
            "aria-label": t(c)("ll.numberOfActiveFilters"),
            title: t(c)("ll.numberOfActiveFilters")
          }, y(e.filterCount), 11, O)) : i("", !0),
          e.hasDropdown ? (s(), n("span", g, [
            D(B, {
              "data-test": "icon|caret",
              name: "caret-down",
              class: l([
                t(o).caret,
                {
                  [t(o)["caret-rotate"]]: e.isDropdownOpen
                }
              ])
            }, null, 8, ["class"])
          ])) : i("", !0)
        ])
      ]),
      _: 3
    }, 8, ["class", "is-removable"]));
  }
}), E = "_root_F7YeE", R = "_caret_KD1Eg", N = {
  root: E,
  "is-selected": "_is-selected_zzOkI",
  "is-removable": "_is-removable_zfS-g",
  "has-filter-count": "_has-filter-count_xbyxj",
  "has-dropdown": "_has-dropdown_vzsjD",
  "filter-count": "_filter-count_ESg8_",
  caret: R,
  "caret-rotate": "_caret-rotate_QC02I"
}, I = {
  $style: N
}, Q = /* @__PURE__ */ S(z, [["__cssModules", I]]);
export {
  Q as default
};
//# sourceMappingURL=FilterChip.js.map
