import { defineComponent as C, useSlots as F, inject as k, computed as p, openBlock as e, createElementBlock as o, createBlock as a, resolveDynamicComponent as x, withCtx as f, createElementVNode as r, toDisplayString as n, createCommentVNode as l, normalizeClass as I, unref as c, createTextVNode as g, renderSlot as D } from "vue";
import { t as u } from "./locale.js";
import E from "./Chip.js";
import { D as S } from "./DataViewFilters.keys-BLu07FiP.js";
import N from "./Icon.js";
const T = { class: "stash-filter-drawer-item" }, A = { class: "flex items-center justify-between self-stretch" }, V = { class: "flex flex-col items-start" }, B = {
  key: 0,
  class: "text-xs",
  "data-test": "description"
}, O = {
  key: 0,
  class: "gap-3 p-6"
}, R = /* @__PURE__ */ C({
  __name: "FilterDrawerItem",
  props: {
    group: {},
    title: {},
    description: {}
  },
  emits: ["navigate"],
  setup(v, { emit: _ }) {
    const i = v, h = _, b = F(), t = k(S.key);
    if (!(t != null && t.useFiltersInstance))
      throw new Error(
        "FilterDropdown must be used within a <DataViewFilters> that receives an instance of useFilters()."
      );
    const { activeFiltersCounts: w } = t.useFiltersInstance, d = p(() => w.value[i.group]), s = p(() => t.drawerStyle === "cascade");
    return (y, m) => (e(), o("div", T, [
      (e(), a(x(s.value ? "div" : "button"), {
        "data-test": "stash-filter-drawer-item|dynamic-component",
        class: "outline-hidden w-full border-b border-ice-500 py-4 focus:outline-blue-500",
        onClick: m[0] || (m[0] = (j) => s.value ? void 0 : h("navigate"))
      }, {
        default: f(() => [
          r("div", A, [
            r("div", V, [
              r("h4", null, n(i.title), 1),
              i.description ? (e(), o("div", B, n(i.description), 1)) : l("", !0)
            ]),
            r("div", {
              class: I(["inline-flex items-center gap-6", { "mb-0.5 mr-2": s.value }])
            }, [
              d.value ? (e(), a(E, {
                key: 0,
                color: "blue",
                radius: "pill",
                shade: "main",
                "aria-label": c(u)("ll.numberOfActiveFilters"),
                title: c(u)("ll.numberOfActiveFilters")
              }, {
                default: f(() => [
                  g(n(d.value), 1)
                ]),
                _: 1
              }, 8, ["aria-label", "title"])) : l("", !0),
              s.value ? l("", !0) : (e(), a(N, {
                key: 1,
                name: "chevron-right",
                title: c(u)("ll.viewFilterGroup")
              }, null, 8, ["title"]))
            ], 2)
          ])
        ]),
        _: 1
      })),
      s.value && b.default ? (e(), o("div", O, [
        D(y.$slots, "default")
      ])) : l("", !0)
    ]));
  }
});
export {
  R as default
};
//# sourceMappingURL=FilterDrawerItem.js.map
