@ztwoint/z-ui 0.1.77 → 0.1.78

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,4 +1,4 @@
1
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
2
  import { Table as r } from "../table/table-provider.js";
3
3
  import "react";
4
4
  import { cn as d } from "../../lib/utils.js";
@@ -31,7 +31,7 @@ import "../stepper-item/stepper-item.js";
31
31
  import "@radix-ui/react-tabs";
32
32
  import "../tooltip/tooltip.js";
33
33
  import { Filter as p } from "../table-filter/index.js";
34
- import q from "../assets/icons/octagon-warning-Copy.js";
34
+ import S from "../assets/icons/octagon-warning-Copy.js";
35
35
  import "../badge/badge.js";
36
36
  import "../avatar/avatar.js";
37
37
  import "../text-preset/text-preset.js";
@@ -39,16 +39,16 @@ import "react-dom";
39
39
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js";
40
40
  import "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js";
41
41
  import "../table/table.context.js";
42
- const we = ({
43
- dataSource: f,
42
+ const fe = ({
43
+ dataSource: w,
44
44
  schema: B,
45
- loading: H,
46
- emptyMessage: k,
47
- className: T,
45
+ loading: b,
46
+ emptyMessage: H,
47
+ className: j,
48
48
  rounded: i = !0,
49
49
  bordered: n = !0,
50
- showHeader: P = !0,
51
- headerClassName: _,
50
+ showHeader: g = !0,
51
+ headerClassName: k,
52
52
  search: m,
53
53
  filter: t,
54
54
  headerLeftContent: h,
@@ -58,40 +58,38 @@ const we = ({
58
58
  className: "",
59
59
  stickyHeader: !0
60
60
  },
61
- showFooter: g = !0,
62
- footerClassName: j,
61
+ showFooter: P = !0,
62
+ footerClassName: T,
63
63
  pagination: o,
64
64
  paginationInfo: c,
65
- paginationQuickJumper: s,
65
+ paginationQuickJumper: a,
66
66
  error: x = !1,
67
- dataSourceError: R = !1,
68
- freeze: S = !1
67
+ dataSourceError: _ = !1
69
68
  }) => {
70
- var F;
69
+ var f;
71
70
  if (x)
72
- return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
73
- /* @__PURE__ */ e(q, { className: "mt-1.5" }),
74
- /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
71
+ return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
72
+ /* @__PURE__ */ e(S, { className: "mt-1.5" }),
73
+ /* @__PURE__ */ s("div", { className: "flex flex-col gap-2", children: [
75
74
  /* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
76
75
  /* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
77
76
  typeof x == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: x })
78
77
  ] })
79
78
  ] }) });
80
- const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, v = m || t || h || u, b = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
81
- return /* @__PURE__ */ a("div", { className: d("flex flex-col overflow-hidden relative", T), children: [
82
- S && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full cursor-not-allowed bg-white/50" }),
83
- /* @__PURE__ */ a(r, { dataSource: f, schema: B, loading: H, emptyMessage: k, children: [
84
- P && v && /* @__PURE__ */ a(
79
+ const N = a && a.totalPage && a.totalPage >= 2, v = o && o.totalPage && o.totalPage >= 2 || !!c || N, C = m || t || h || u, R = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
80
+ return /* @__PURE__ */ s("div", { className: d("flex flex-col overflow-hidden relative", j), children: [
81
+ /* @__PURE__ */ s(r, { dataSource: w, schema: B, emptyMessage: H, children: [
82
+ g && C && /* @__PURE__ */ s(
85
83
  r.Header,
86
84
  {
87
85
  className: d(
88
86
  "flex-shrink-0",
89
87
  n && "border-stroke-solid-medium border-1 border-b-0",
90
88
  i && "rounded-t-xl",
91
- _
89
+ k
92
90
  ),
93
91
  children: [
94
- /* @__PURE__ */ a(r.HeaderContent, { children: [
92
+ /* @__PURE__ */ s(r.HeaderContent, { children: [
95
93
  h && h,
96
94
  m && /* @__PURE__ */ e(
97
95
  r.Search,
@@ -105,7 +103,7 @@ const we = ({
105
103
  className: m.className
106
104
  }
107
105
  ),
108
- t && /* @__PURE__ */ a(
106
+ t && /* @__PURE__ */ s(
109
107
  p,
110
108
  {
111
109
  filterSchema: t.filterSchema,
@@ -115,8 +113,8 @@ const we = ({
115
113
  })
116
114
  },
117
115
  children: [
118
- b && /* @__PURE__ */ e(p.FilterButton, {}),
119
- (F = t == null ? void 0 : t.quickFilters) == null ? void 0 : F.map((w) => /* @__PURE__ */ e(p.FilterColumnButton, { filterName: w }, w))
116
+ R && /* @__PURE__ */ e(p.FilterButton, {}),
117
+ (f = t == null ? void 0 : t.quickFilters) == null ? void 0 : f.map((F) => /* @__PURE__ */ e(p.FilterColumnButton, { filterName: F }, F))
120
118
  ]
121
119
  }
122
120
  )
@@ -128,14 +126,14 @@ const we = ({
128
126
  /* @__PURE__ */ e(
129
127
  r.Body,
130
128
  {
131
- dataSourceError: R,
129
+ dataSourceError: _,
132
130
  cell: l == null ? void 0 : l.cell,
133
131
  sort: l == null ? void 0 : l.sort,
134
132
  className: d(
135
133
  "flex-1 min-h-0",
136
134
  n && "border-stroke-solid-light border-1",
137
- i && !(P && v) && "rounded-t-xl",
138
- i && !(g && N) && "rounded-b-xl",
135
+ i && !(g && C) && "rounded-t-xl",
136
+ i && !(P && v) && "rounded-b-xl",
139
137
  n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
140
138
  n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
141
139
  l == null ? void 0 : l.className
@@ -143,14 +141,14 @@ const we = ({
143
141
  stickyHeader: l == null ? void 0 : l.stickyHeader
144
142
  }
145
143
  ),
146
- g && N && /* @__PURE__ */ a(
144
+ P && v && /* @__PURE__ */ s(
147
145
  r.Footer,
148
146
  {
149
147
  className: d(
150
148
  "flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
151
149
  n && "border",
152
150
  i && "rounded-b-xl",
153
- j
151
+ T
154
152
  ),
155
153
  children: [
156
154
  c ? /* @__PURE__ */ e(r.FooterContent, { children: /* @__PURE__ */ e(
@@ -161,16 +159,16 @@ const we = ({
161
159
  currentPage: c.currentPage,
162
160
  itemsPerPage: c.itemsPerPage
163
161
  }
164
- ) }) : s || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
165
- (s || o) && /* @__PURE__ */ a(r.FooterContent, { children: [
166
- C && /* @__PURE__ */ e(
162
+ ) }) : a || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
163
+ (a || o) && /* @__PURE__ */ s(r.FooterContent, { children: [
164
+ N && /* @__PURE__ */ e(
167
165
  r.PaginationQuickJumper,
168
166
  {
169
- currentPage: s.currentPage,
170
- totalPage: s.totalPage,
171
- onChange: s.onChange || (() => {
167
+ currentPage: a.currentPage,
168
+ totalPage: a.totalPage,
169
+ onChange: a.onChange || (() => {
172
170
  }),
173
- disabled: s.disabled
171
+ disabled: a.disabled
174
172
  }
175
173
  ),
176
174
  o && /* @__PURE__ */ e(
@@ -187,9 +185,13 @@ const we = ({
187
185
  ]
188
186
  }
189
187
  )
190
- ] })
188
+ ] }),
189
+ b && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-3", children: [
190
+ /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
191
+ /* @__PURE__ */ e("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
192
+ ] }) })
191
193
  ] });
192
194
  };
193
195
  export {
194
- we as default
196
+ fe as default
195
197
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
- import * as y from "react";
2
+ import * as F from "react";
3
3
  import * as m from "@radix-ui/react-popover";
4
- import { Button as u } from "../button/button.js";
4
+ import { Button as x } from "../button/button.js";
5
5
  import { useTableFilterContext as H } from "./table-filter.context.js";
6
6
  import U from "./filters/text.js";
7
7
  import V from "./filters/boolean.js";
@@ -11,65 +11,65 @@ import G from "../assets/icons/circle-check-filled.js";
11
11
  import { SelectedFiltersDisplay as J } from "./selected-filters-display/selected-filters-display.js";
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
- import { hasUnsavedFilterChanges as C } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
14
+ import { hasUnsavedFilterChanges as N } from "./close-filter-confirm/filter-confirmation-dialog.utils.js";
15
15
  const ne = () => {
16
- const [F, a] = y.useState(!1), [x, n] = y.useState(!1), {
16
+ const [w, a] = F.useState(!1), [g, n] = F.useState(!1), {
17
17
  selectedColumn: r,
18
- setSelectedColumn: N,
19
- getFilterForColumn: w,
20
- hasFilterForColumn: k,
21
- updateColumnFilter: K,
22
- clearAllFilters: j,
23
- resetToAppliedFilters: A,
24
- applyFilters: D,
18
+ setSelectedColumn: k,
19
+ getFilterForColumn: K,
20
+ hasFilterForColumn: j,
21
+ updateColumnFilter: A,
22
+ clearAllFilters: D,
23
+ resetToAppliedFilters: O,
24
+ applyFilters: P,
25
25
  hasActiveFilters: d,
26
26
  tempFilters: i,
27
27
  filterSchema: c,
28
28
  filter: h,
29
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
- }, P = () => {
35
- a(!1), n(!1);
36
- }, S = () => {
37
- A(), a(!1), n(!1);
30
+ } = H(), S = (e) => {
31
+ !e && g ? N(i, h.value) ? a(!0) : n(!1) : n(e);
32
+ }, v = () => {
33
+ P(), a(!1), n(!1);
38
34
  }, T = () => {
35
+ a(!1), n(!1);
36
+ }, $ = () => {
37
+ O(), a(!1), n(!1);
38
+ }, R = () => {
39
39
  a(!1);
40
- }, $ = C(i, h.value), R = L(i, c), z = M(R), B = () => {
40
+ }, b = N(i, h.value), z = L(i, c), f = M(z), B = () => {
41
41
  if (!r) return null;
42
- const e = c.find((o) => o.filterKey === r), v = {
42
+ const e = c.find((o) => o.filterKey === r), y = {
43
43
  boolean: V,
44
44
  string: U,
45
45
  number: q,
46
46
  checkbox: E
47
- }, b = (e == null ? void 0 : e.type) && (p == null ? void 0 : p[e.type]) || v[(e == null ? void 0 : e.type) ?? "string"];
48
- if (!b)
47
+ }, C = (e == null ? void 0 : e.type) && (p == null ? void 0 : p[e.type]) || y[(e == null ? void 0 : e.type) ?? "string"];
48
+ if (!C)
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 s = w(r), I = {
52
+ const s = K(r), I = {
53
53
  condition: (s == null ? void 0 : s.condition) || "",
54
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
- b,
57
+ C,
58
58
  {
59
59
  value: I,
60
- onChange: ({ condition: o, value: f }) => K(r, o, f),
61
- filterOptions: e != null && e.options ? Object.entries(e.options).map(([o, f]) => ({
60
+ onChange: ({ condition: o, value: u }) => A(r, o, u),
61
+ filterOptions: e != null && e.options ? Object.entries(e.options).map(([o, u]) => ({
62
62
  label: o,
63
63
  value: o,
64
- total: f
64
+ total: u
65
65
  })) : void 0
66
66
  },
67
67
  r
68
68
  ) }) });
69
69
  };
70
- return /* @__PURE__ */ l(m.Root, { open: x, onOpenChange: O, children: [
70
+ return /* @__PURE__ */ l(m.Root, { open: g, onOpenChange: S, children: [
71
71
  /* @__PURE__ */ t(m.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
72
- u,
72
+ x,
73
73
  {
74
74
  variant: d ? "filled" : "stroke",
75
75
  shade: d ? "brand" : "neutral",
@@ -93,11 +93,11 @@ const ne = () => {
93
93
  c.map((e) => /* @__PURE__ */ l(
94
94
  "button",
95
95
  {
96
- onClick: () => N(e.filterKey),
96
+ onClick: () => k(e.filterKey),
97
97
  className: `w-full text-left p-2 text-sm flex items-center justify-between hover:bg-surface-neutral-hovered transition-colors rounded-lg ${r === e.filterKey ? "bg-surface-neutral-focused text-text-brand-primary" : "text-text-neutral-primary"}`,
98
98
  children: [
99
99
  /* @__PURE__ */ t("span", { className: "truncate", children: e.title }),
100
- k(e.filterKey) && /* @__PURE__ */ t(G, { className: "w-4 h-4 text-text-brand-secondary flex-shrink-0 ml-2" })
100
+ j(e.filterKey) && /* @__PURE__ */ t(G, { className: "w-4 h-4 text-text-brand-secondary flex-shrink-0 ml-2" })
101
101
  ]
102
102
  },
103
103
  e.filterKey
@@ -105,19 +105,19 @@ const ne = () => {
105
105
  ] }),
106
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
- $ && /* @__PURE__ */ l("div", { className: "flex justify-between items-end p-4 border-t border-stroke-solid-medium min-h-[73px]", children: [
108
+ (!!f || b) && /* @__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
- /* @__PURE__ */ t(u, { onClick: j, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
112
- /* @__PURE__ */ t(
113
- u,
111
+ !!f && /* @__PURE__ */ t(x, { onClick: D, variant: "stroke", shade: "neutral", size: "small", children: "Clear All" }),
112
+ !!b && /* @__PURE__ */ t(
113
+ x,
114
114
  {
115
- onClick: g,
115
+ onClick: v,
116
116
  variant: "filled",
117
117
  shade: "neutral",
118
118
  size: "small",
119
119
  className: "min-w-20",
120
- children: `Apply ${z || ""}`
120
+ children: `Apply ${f || ""}`
121
121
  }
122
122
  )
123
123
  ] })
@@ -125,13 +125,13 @@ const ne = () => {
125
125
  ]
126
126
  }
127
127
  ) }),
128
- F && /* @__PURE__ */ t(
128
+ w && /* @__PURE__ */ t(
129
129
  Q,
130
130
  {
131
- onClose: T,
132
- onKeepChanges: P,
133
- onRevertChanges: S,
134
- onApplyChanges: g
131
+ onClose: R,
132
+ onKeepChanges: T,
133
+ onRevertChanges: $,
134
+ onApplyChanges: v
135
135
  }
136
136
  )
137
137
  ] });