@ztwoint/z-ui 0.1.71 → 0.1.72

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.
@@ -4,7 +4,6 @@ interface FilterConfirmationDialogProps {
4
4
  onKeepChanges: () => void;
5
5
  onRevertChanges: () => void;
6
6
  onApplyChanges: () => void;
7
- hasUnsavedChanges: boolean;
8
7
  }
9
8
  export declare const FilterConfirmationDialog: React.FC<FilterConfirmationDialogProps>;
10
9
  export {};
@@ -1,33 +1,32 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { Button as l } from "../../button/button.js";
3
- import { Z2Dialog as s, Z2DialogContent as d, Z2DialogHeader as h, Z2DialogTitle as c, Z2DialogDescription as g, Z2DialogFooter as m } from "../../dialog/dialog.js";
4
- const v = ({
5
- onClose: r,
6
- onKeepChanges: i,
7
- onRevertChanges: o,
8
- onApplyChanges: a,
9
- hasUnsavedChanges: t
10
- }) => t ? /* @__PURE__ */ e(s, { open: !0, onOpenChange: r, children: /* @__PURE__ */ n(d, { className: "max-w-md p-4 rounded-2xl", children: [
11
- /* @__PURE__ */ n(h, { children: [
2
+ import { Button as i } from "../../button/button.js";
3
+ import { Z2Dialog as t, Z2DialogContent as s, Z2DialogHeader as d, Z2DialogTitle as h, Z2DialogDescription as c, Z2DialogFooter as g } from "../../dialog/dialog.js";
4
+ const f = ({
5
+ onClose: l,
6
+ onKeepChanges: o,
7
+ onRevertChanges: r,
8
+ onApplyChanges: a
9
+ }) => /* @__PURE__ */ e(t, { open: !0, onOpenChange: l, children: /* @__PURE__ */ n(s, { className: "max-w-md p-4 rounded-2xl", children: [
10
+ /* @__PURE__ */ n(d, { children: [
12
11
  /* @__PURE__ */ n("div", { className: "flex justify-between", children: [
13
- /* @__PURE__ */ e(c, { children: "Unsaved Filter Changes" }),
12
+ /* @__PURE__ */ e(h, { children: "Unsaved Filter Changes" }),
14
13
  /* @__PURE__ */ e(
15
- l,
14
+ i,
16
15
  {
17
16
  "aria-label": "Close",
18
17
  className: "ml-4 p-2 text-xl leading-none font-bold bg-transparent border-none shadow-none hover:bg-gray-100 min-w-0 min-h-0",
19
- onClick: i,
18
+ onClick: o,
20
19
  children: "×"
21
20
  }
22
21
  )
23
22
  ] }),
24
- /* @__PURE__ */ e(g, { children: "You have unsaved filter changes. Would you like to keep these changes or revert to the previous state?" })
23
+ /* @__PURE__ */ e(c, { children: "You have unsaved filter changes. Would you like to keep these changes or revert to the previous state?" })
25
24
  ] }),
26
- /* @__PURE__ */ n(m, { children: [
27
- /* @__PURE__ */ e(l, { onClick: o, variant: "stroke", shade: "danger", size: "small", children: "Discard" }),
28
- /* @__PURE__ */ e(l, { onClick: a, variant: "filled", shade: "brand", size: "small", children: "Apply Changes" })
25
+ /* @__PURE__ */ n(g, { children: [
26
+ /* @__PURE__ */ e(i, { onClick: r, variant: "stroke", shade: "danger", size: "small", children: "Discard" }),
27
+ /* @__PURE__ */ e(i, { onClick: a, variant: "filled", shade: "brand", size: "small", children: "Apply Changes" })
29
28
  ] })
30
- ] }) }) : null;
29
+ ] }) });
31
30
  export {
32
- v as FilterConfirmationDialog
31
+ f as FilterConfirmationDialog
33
32
  };
@@ -2,8 +2,8 @@ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
2
  import * as y from "react";
3
3
  import * as m from "@radix-ui/react-popover";
4
4
  import { Button as u } from "../button/button.js";
5
- import { useTableFilterContext as U } from "./table-filter.context.js";
6
- import H from "./filters/text.js";
5
+ import { useTableFilterContext as H } from "./table-filter.context.js";
6
+ import U from "./filters/text.js";
7
7
  import V from "./filters/boolean.js";
8
8
  import q from "./filters/number/number.js";
9
9
  import E from "./filters/checkbox.js";
@@ -12,7 +12,7 @@ import { SelectedFiltersDisplay as J } from "./selected-filters-display/selected
12
12
  import { createFilterDisplayItems as L, calculateTotalCount as M } from "./selected-filters-display/selected-filters-display.utils.js";
13
13
  import { FilterConfirmationDialog as Q } from "./close-filter-confirm/filter-confirmation-dialog.js";
14
14
  import { hasUnsavedFilterChanges as C } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
15
- const ae = () => {
15
+ const ne = () => {
16
16
  const [F, a] = y.useState(!1), [x, n] = y.useState(!1), {
17
17
  selectedColumn: r,
18
18
  setSelectedColumn: N,
@@ -25,43 +25,43 @@ const ae = () => {
25
25
  hasActiveFilters: d,
26
26
  tempFilters: i,
27
27
  filterSchema: c,
28
- filter: p,
29
- filterComponents: f = {}
30
- } = U(), g = C(i, p.value), O = (e) => {
31
- !e && x ? g ? a(!0) : n(!1) : n(e);
32
- }, v = () => {
33
- D(), n(!1);
28
+ filter: h,
29
+ filterComponents: p = {}
30
+ } = H(), O = (e) => {
31
+ !e && x ? C(i, h.value) ? a(!0) : n(!1) : n(e);
32
+ }, g = () => {
33
+ D(), a(!1), n(!1);
34
34
  }, P = () => {
35
35
  a(!1), n(!1);
36
36
  }, S = () => {
37
37
  A(), a(!1), n(!1);
38
38
  }, T = () => {
39
39
  a(!1);
40
- }, $ = L(i, c), R = M($), z = () => {
40
+ }, $ = C(i, h.value), R = L(i, c), z = M(R), B = () => {
41
41
  if (!r) return null;
42
- const e = c.find((s) => s.filterKey === r), B = {
42
+ const e = c.find((o) => o.filterKey === r), v = {
43
43
  boolean: V,
44
- string: H,
44
+ string: U,
45
45
  number: q,
46
46
  checkbox: E
47
- }, b = (e == null ? void 0 : e.type) && (f == null ? void 0 : f[e.type]) || B[(e == null ? void 0 : e.type) ?? "string"];
47
+ }, b = (e == null ? void 0 : e.type) && (p == null ? void 0 : p[e.type]) || v[(e == null ? void 0 : e.type) ?? "string"];
48
48
  if (!b)
49
49
  return console.warn(
50
50
  `No filter component found for column "${e == null ? void 0 : e.filterKey}" with type "${e == null ? void 0 : e.type}". Provide a custom filter component or use supported types: "string", "number", "boolean", "checkbox".`
51
51
  ), null;
52
- const o = w(r), I = {
53
- condition: (o == null ? void 0 : o.condition) || "",
54
- value: (o == null ? void 0 : o.value) || ""
52
+ const s = w(r), I = {
53
+ condition: (s == null ? void 0 : s.condition) || "",
54
+ value: (s == null ? void 0 : s.value) || ""
55
55
  };
56
56
  return /* @__PURE__ */ t("div", { className: "flex-1 h-full", children: /* @__PURE__ */ t("div", { className: "mb-4 h-full", children: /* @__PURE__ */ t(
57
57
  b,
58
58
  {
59
59
  value: I,
60
- onChange: ({ condition: s, value: h }) => K(r, s, h),
61
- filterOptions: e != null && e.options ? Object.entries(e.options).map(([s, h]) => ({
62
- label: s,
63
- value: s,
64
- total: h
60
+ onChange: ({ condition: o, value: f }) => K(r, o, f),
61
+ filterOptions: e != null && e.options ? Object.entries(e.options).map(([o, f]) => ({
62
+ label: o,
63
+ value: o,
64
+ total: f
65
65
  })) : void 0
66
66
  },
67
67
  r
@@ -76,7 +76,7 @@ const ae = () => {
76
76
  size: "small",
77
77
  children: [
78
78
  "Filter ",
79
- d && `(${p.value.length})`
79
+ d && `(${h.value.length})`
80
80
  ]
81
81
  }
82
82
  ) }),
@@ -103,21 +103,21 @@ const ae = () => {
103
103
  e.filterKey
104
104
  ))
105
105
  ] }),
106
- /* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? z() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
106
+ /* @__PURE__ */ t("div", { className: "flex-1 flex flex-col", children: r ? B() : /* @__PURE__ */ t("div", { className: "flex-1 flex items-center justify-center text-text-neutral-muted", children: "Select a column to configure its filter" }) })
107
107
  ] }),
108
- g && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[73px]", children: [
108
+ $ && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[73px]", children: [
109
109
  /* @__PURE__ */ t(J, { selectedFilters: i, schema: c }),
110
110
  /* @__PURE__ */ l("div", { className: "flex justify-end gap-2", children: [
111
111
  /* @__PURE__ */ t(u, { onClick: j, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
112
112
  /* @__PURE__ */ t(
113
113
  u,
114
114
  {
115
- onClick: v,
115
+ onClick: g,
116
116
  variant: "filled",
117
117
  shade: "neutral",
118
118
  size: "small",
119
119
  className: "min-w-20",
120
- children: `Apply ${R || ""}`
120
+ children: `Apply ${z || ""}`
121
121
  }
122
122
  )
123
123
  ] })
@@ -131,12 +131,11 @@ const ae = () => {
131
131
  onClose: T,
132
132
  onKeepChanges: P,
133
133
  onRevertChanges: S,
134
- onApplyChanges: v,
135
- hasUnsavedChanges: C(i, p.value)
134
+ onApplyChanges: g
136
135
  }
137
136
  )
138
137
  ] });
139
138
  };
140
139
  export {
141
- ae as TableFilterButton
140
+ ne as TableFilterButton
142
141
  };
@@ -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
  ] });
@@ -4,7 +4,6 @@ interface FilterConfirmationDialogProps {
4
4
  onKeepChanges: () => void;
5
5
  onRevertChanges: () => void;
6
6
  onApplyChanges: () => void;
7
- hasUnsavedChanges: boolean;
8
7
  }
9
8
  export declare const FilterConfirmationDialog: React.FC<FilterConfirmationDialogProps>;
10
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztwoint/z-ui",
3
- "version": "0.1.71",
3
+ "version": "0.1.72",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",