@ztwoint/z-ui 0.1.71 → 0.1.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { jsxs as i, jsx as l } from "react/jsx-runtime";
1
+ import { jsxs as a, jsx as l } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
- import * as a from "@radix-ui/react-popover";
4
- import { Button as f } from "../button/button.js";
3
+ import * as p from "@radix-ui/react-popover";
4
+ import { Button as h } from "../button/button.js";
5
5
  import { useTableFilterContext as V } from "./table-filter.context.js";
6
6
  import q from "./filters/text.js";
7
7
  import E from "./filters/boolean.js";
@@ -12,27 +12,27 @@ import { getFilterCount as L } from "./selected-filters-display/selected-filters
12
12
  import { FilterConfirmationDialog as M } from "./close-filter-confirm/filter-confirmation-dialog.js";
13
13
  import { hasUnsavedFilterChangesForColumn as w } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
14
14
  const le = ({ filterName: n }) => {
15
- const [k, r] = x.useState(!1), [u, s] = x.useState(!1), {
15
+ const [k, r] = x.useState(!1), [f, s] = x.useState(!1), {
16
16
  getFilterForColumn: A,
17
17
  hasAppliedFilterForColumn: O,
18
- updateColumnFilter: C,
19
- applyFilters: p,
18
+ updateColumnFilter: u,
19
+ applyFilters: c,
20
20
  resetToAppliedFilters: P,
21
21
  filterSchema: T,
22
22
  filterComponents: d = {},
23
- tempFilters: g,
24
- filter: v
25
- } = V(), c = w(n, g, v.value), $ = (o) => {
26
- !o && u ? c ? r(!0) : s(!1) : s(o);
23
+ tempFilters: C,
24
+ filter: g
25
+ } = V(), $ = (o) => {
26
+ !o && f ? w(n, C, g.value) ? r(!0) : s(!1) : s(o);
27
27
  }, j = () => {
28
- p(), s(!1);
28
+ c(), r(!1), s(!1);
29
29
  }, D = () => {
30
30
  r(!1), s(!1);
31
31
  }, K = () => {
32
32
  P(), r(!1), s(!1);
33
33
  }, R = () => {
34
34
  r(!1);
35
- }, t = T.find((o) => o.filterKey === n);
35
+ }, v = w(n, C, g.value), t = T.find((o) => o.filterKey === n);
36
36
  if (!t)
37
37
  return console.warn(`Column "${n}" not found in schema`), null;
38
38
  const S = {
@@ -45,34 +45,34 @@ const le = ({ filterName: n }) => {
45
45
  return console.warn(
46
46
  `No filter component found for column "${t.filterKey}" with type "${t.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
47
47
  ), null;
48
- const e = A(n), m = O(n), b = t.options ? Object.entries(t.options).map(([o, h]) => ({
48
+ const e = A(n), m = O(n), b = t.options ? Object.entries(t.options).map(([o, i]) => ({
49
49
  label: o,
50
50
  value: o,
51
- total: h
51
+ total: i
52
52
  })) : void 0, y = e ? L(e, b) : void 0, z = e != null && e.value ? Array.isArray(e.value) ? e.value.length : 1 : 0, B = {
53
53
  condition: (e == null ? void 0 : e.condition) || "",
54
54
  value: (e == null ? void 0 : e.value) || ""
55
55
  }, I = () => {
56
- const o = C(n, "", "");
57
- p(o), s(!1);
56
+ const o = u(n, "", "");
57
+ c(o), s(!1);
58
58
  }, U = () => {
59
- p(), s(!1);
59
+ c(), s(!1);
60
60
  };
61
- return /* @__PURE__ */ i(a.Root, { open: u, onOpenChange: $, children: [
62
- /* @__PURE__ */ l(a.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
63
- f,
61
+ return /* @__PURE__ */ a(p.Root, { open: f, onOpenChange: $, children: [
62
+ /* @__PURE__ */ l(p.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
63
+ h,
64
64
  {
65
65
  variant: m ? "filled" : "stroke",
66
66
  shade: m ? "brand" : "neutral",
67
67
  size: "small",
68
- children: /* @__PURE__ */ i("span", { className: "flex items-center gap-2", children: [
68
+ children: /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
69
69
  t.title,
70
70
  m && /* @__PURE__ */ l(J, { className: "w-4 h-4 text-white flex-shrink-0" })
71
71
  ] })
72
72
  }
73
73
  ) }),
74
- /* @__PURE__ */ l(a.Portal, { children: /* @__PURE__ */ i(
75
- a.Content,
74
+ /* @__PURE__ */ l(p.Portal, { children: /* @__PURE__ */ a(
75
+ p.Content,
76
76
  {
77
77
  className: "w-80 bg-surface-neutral-default border border-stroke-solid-light rounded-2xl overflow-hidden shadow-lg",
78
78
  sideOffset: 8,
@@ -82,13 +82,13 @@ const le = ({ filterName: n }) => {
82
82
  F,
83
83
  {
84
84
  value: B,
85
- onChange: ({ condition: o, value: h }) => C(n, o, h),
85
+ onChange: ({ condition: o, value: i }) => u(n, o, i),
86
86
  filterOptions: b
87
87
  }
88
88
  ),
89
- (c || !!z) && /* @__PURE__ */ i("div", { className: "flex justify-between gap-2 p-3 border-t border-stroke-solid-medium", children: [
90
- /* @__PURE__ */ l(f, { onClick: I, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
91
- c && /* @__PURE__ */ l(f, { onClick: U, variant: "filled", shade: "neutral", size: "small", children: `Apply${y !== void 0 ? ` ${y}` : ""}` })
89
+ (v || !!z) && /* @__PURE__ */ a("div", { className: "flex justify-between gap-2 p-3 border-t border-stroke-solid-medium", children: [
90
+ /* @__PURE__ */ l(h, { onClick: I, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
91
+ v && /* @__PURE__ */ l(h, { onClick: U, variant: "filled", shade: "neutral", size: "small", children: `Apply${y !== void 0 ? ` ${y}` : ""}` })
92
92
  ] })
93
93
  ]
94
94
  }
@@ -99,12 +99,7 @@ const le = ({ filterName: n }) => {
99
99
  onClose: R,
100
100
  onKeepChanges: D,
101
101
  onRevertChanges: K,
102
- onApplyChanges: j,
103
- hasUnsavedChanges: w(
104
- n,
105
- g,
106
- v.value
107
- )
102
+ onApplyChanges: j
108
103
  }
109
104
  )
110
105
  ] });