@ztwoint/z-ui 0.1.72 → 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,25 +1,25 @@
1
1
  import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { DEFAULT_EMPTY_MESSAGE as S, TABLE_CSS_CLASSES as n } from "./table.const.js";
4
- import { TableHeader as g } from "./components/table-header/table-header.js";
2
+ import * as S from "react";
3
+ import { DEFAULT_EMPTY_MESSAGE as g, TABLE_CSS_CLASSES as m } from "./table.const.js";
4
+ import { TableHeader as y } from "./components/table-header/table-header.js";
5
5
  import { TableRow as T } from "./components/table-row.js";
6
- import { TableEmptyState as w } from "./components/table-empty-state.js";
7
- import { TableContext as E } from "./table.context.js";
8
- import { cn as m } from "../../lib/utils.js";
9
- const j = ({ cell: a = { hasBorder: !0 }, sort: d, className: i, stickyHeader: c = !1, ...f }) => {
10
- const p = y.useContext(E), {
6
+ import { TableEmptyState as E } from "./components/table-empty-state.js";
7
+ import { TableContext as v } from "./table.context.js";
8
+ import { cn as n } from "../../lib/utils.js";
9
+ const j = ({ cell: a = { hasBorder: !0 }, sort: i, className: d, stickyHeader: c = !1, ...f }) => {
10
+ const u = S.useContext(v), {
11
11
  dataSource: t = [],
12
12
  schema: o = [],
13
13
  loading: r = !1,
14
- emptyMessage: u = S,
15
- customCells: h
16
- } = p || f, b = () => !t || t.length === 0 && !r ? /* @__PURE__ */ e(w, { colSpan: o.length, message: u }) : /* @__PURE__ */ e("tbody", { children: t.map((x, s) => /* @__PURE__ */ e(
14
+ emptyMessage: p = g,
15
+ customCells: b
16
+ } = u || f, h = () => !t || t.length === 0 && !r ? /* @__PURE__ */ e(E, { colSpan: o.length, message: p }) : /* @__PURE__ */ e("tbody", { children: t.map((x, s) => /* @__PURE__ */ e(
17
17
  T,
18
18
  {
19
19
  record: x,
20
20
  index: s,
21
21
  schema: o,
22
- customCells: h,
22
+ customCells: b,
23
23
  cell: a
24
24
  },
25
25
  s
@@ -27,17 +27,17 @@ const j = ({ cell: a = { hasBorder: !0 }, sort: d, className: i, stickyHeader: c
27
27
  return /* @__PURE__ */ l(
28
28
  "div",
29
29
  {
30
- className: m(
31
- r ? "overflow-y-hidden" : "overflow-y-auto",
32
- n.bordered[a.hasBorder && !r && t.length > 0 ? "true" : "false"],
33
- i
30
+ className: n(
31
+ r ? "relative" : "overflow-y-auto",
32
+ m.bordered[a.hasBorder && !r && t.length > 0 ? "true" : "false"],
33
+ d
34
34
  ),
35
35
  children: [
36
- /* @__PURE__ */ l("table", { className: m(n.table, "w-full"), children: [
37
- b(),
38
- /* @__PURE__ */ e(g, { schema: o, sort: d, cell: a, stickyHeader: c })
36
+ /* @__PURE__ */ l("table", { className: n(m.table, "w-full"), children: [
37
+ h(),
38
+ /* @__PURE__ */ e(y, { schema: o, sort: i, cell: a, stickyHeader: c })
39
39
  ] }),
40
- r && /* @__PURE__ */ e("div", { className: "sticky top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-3", children: [
40
+ r && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-3", children: [
41
41
  /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
42
42
  /* @__PURE__ */ e("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
43
43
  ] }) })
@@ -1,7 +1,7 @@
1
- import { jsx as t, jsxs as m } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
2
  import { Table as r } from "../table/table-provider.js";
3
3
  import "react";
4
- import { cn as i } from "../../lib/utils.js";
4
+ import { cn as d } from "../../lib/utils.js";
5
5
  /* empty css */
6
6
  import "../alert/alert.const.js";
7
7
  import "../button/button.js";
@@ -30,8 +30,8 @@ import "../stepper/stepper.js";
30
30
  import "../stepper-item/stepper-item.js";
31
31
  import "@radix-ui/react-tabs";
32
32
  import "../tooltip/tooltip.js";
33
- import { Filter as P } from "../table-filter/index.js";
34
- import S from "../assets/icons/octagon-warning-Copy.js";
33
+ import { Filter as p } from "../table-filter/index.js";
34
+ import b 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,18 +39,18 @@ 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 vt = ({
43
- dataSource: w,
44
- schema: H,
45
- loading: k,
46
- emptyMessage: T,
47
- className: _,
48
- rounded: d = !0,
42
+ const Fe = ({
43
+ dataSource: B,
44
+ schema: f,
45
+ loading: H,
46
+ emptyMessage: k,
47
+ className: T,
48
+ rounded: i = !0,
49
49
  bordered: n = !0,
50
- showHeader: p = !0,
51
- headerClassName: f,
52
- search: a,
53
- filter: e,
50
+ showHeader: P = !0,
51
+ headerClassName: _,
52
+ search: m,
53
+ filter: t,
54
54
  headerLeftContent: h,
55
55
  headerActions: u,
56
56
  body: l = {
@@ -63,127 +63,131 @@ const vt = ({
63
63
  pagination: o,
64
64
  paginationInfo: c,
65
65
  paginationQuickJumper: s,
66
- error: x = !1
66
+ error: x = !1,
67
+ freeze: R = !1
67
68
  }) => {
68
69
  var F;
69
70
  if (x)
70
- return /* @__PURE__ */ t("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ m("div", { className: "flex gap-2", children: [
71
- /* @__PURE__ */ t(S, { className: "mt-1.5" }),
72
- /* @__PURE__ */ m("div", { className: "flex flex-col gap-2", children: [
73
- /* @__PURE__ */ t("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
74
- /* @__PURE__ */ t("div", { className: "text-sm", children: "Please try again later" }),
75
- typeof x == "string" && /* @__PURE__ */ t("div", { className: "text-text-warning-secondary text-sm", children: x })
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__ */ a("div", { className: "flex gap-2", children: [
72
+ /* @__PURE__ */ e(b, { className: "mt-1.5" }),
73
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
74
+ /* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
75
+ /* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
76
+ typeof x == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: x })
76
77
  ] })
77
78
  ] }) });
78
- const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, v = a || e || h || u, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
79
- return /* @__PURE__ */ t("div", { className: i("flex flex-col overflow-hidden", _), children: /* @__PURE__ */ m(r, { dataSource: w, schema: H, loading: k, emptyMessage: T, children: [
80
- p && v && /* @__PURE__ */ m(
81
- r.Header,
82
- {
83
- className: i(
84
- "flex-shrink-0",
85
- n && "border-stroke-solid-medium border-1 border-b-0",
86
- d && "rounded-t-xl",
87
- f
88
- ),
89
- children: [
90
- /* @__PURE__ */ m(r.HeaderContent, { children: [
91
- h && h,
92
- a && /* @__PURE__ */ t(
93
- r.Search,
79
+ const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, v = m || t || h || u, S = typeof (t == null ? void 0 : t.showFilterButton) > "u" ? !0 : t == null ? void 0 : t.showFilterButton;
80
+ return /* @__PURE__ */ a("div", { className: d("flex flex-col overflow-hidden relative", T), children: [
81
+ R && /* @__PURE__ */ e("div", { className: "absolute top-0 inset-0 w-full h-full cursor-not-allowed bg-white/50" }),
82
+ /* @__PURE__ */ a(r, { dataSource: B, schema: f, loading: H, emptyMessage: k, children: [
83
+ P && v && /* @__PURE__ */ a(
84
+ r.Header,
85
+ {
86
+ className: d(
87
+ "flex-shrink-0",
88
+ n && "border-stroke-solid-medium border-1 border-b-0",
89
+ i && "rounded-t-xl",
90
+ _
91
+ ),
92
+ children: [
93
+ /* @__PURE__ */ a(r.HeaderContent, { children: [
94
+ h && h,
95
+ m && /* @__PURE__ */ e(
96
+ r.Search,
97
+ {
98
+ search: {
99
+ value: m.value || "",
100
+ onChange: m.onChange || (() => {
101
+ }),
102
+ placeholder: m.placeholder
103
+ },
104
+ className: m.className
105
+ }
106
+ ),
107
+ t && /* @__PURE__ */ a(
108
+ p,
109
+ {
110
+ filterSchema: t.filterSchema,
111
+ filter: {
112
+ value: t.value || [],
113
+ onChange: t.onChange || (() => {
114
+ })
115
+ },
116
+ children: [
117
+ S && /* @__PURE__ */ e(p.FilterButton, {}),
118
+ (F = t == null ? void 0 : t.quickFilters) == null ? void 0 : F.map((w) => /* @__PURE__ */ e(p.FilterColumnButton, { filterName: w }, w))
119
+ ]
120
+ }
121
+ )
122
+ ] }),
123
+ u && /* @__PURE__ */ e(r.HeaderContent, { children: u })
124
+ ]
125
+ }
126
+ ),
127
+ /* @__PURE__ */ e(
128
+ r.Body,
129
+ {
130
+ cell: l == null ? void 0 : l.cell,
131
+ sort: l == null ? void 0 : l.sort,
132
+ className: d(
133
+ "flex-1 min-h-0",
134
+ n && "border-stroke-solid-light border-1",
135
+ i && !(P && v) && "rounded-t-xl",
136
+ i && !(g && N) && "rounded-b-xl",
137
+ n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
138
+ n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
139
+ l == null ? void 0 : l.className
140
+ ),
141
+ stickyHeader: l == null ? void 0 : l.stickyHeader
142
+ }
143
+ ),
144
+ g && N && /* @__PURE__ */ a(
145
+ r.Footer,
146
+ {
147
+ className: d(
148
+ "flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
149
+ n && "border",
150
+ i && "rounded-b-xl",
151
+ j
152
+ ),
153
+ children: [
154
+ c ? /* @__PURE__ */ e(r.FooterContent, { children: /* @__PURE__ */ e(
155
+ r.PaginationInfo,
94
156
  {
95
- search: {
96
- value: a.value || "",
97
- onChange: a.onChange || (() => {
98
- }),
99
- placeholder: a.placeholder
100
- },
101
- className: a.className
102
- }
103
- ),
104
- e && /* @__PURE__ */ m(
105
- P,
106
- {
107
- filterSchema: e.filterSchema,
108
- filter: {
109
- value: e.value || [],
110
- onChange: e.onChange || (() => {
111
- })
112
- },
113
- children: [
114
- R && /* @__PURE__ */ t(P.FilterButton, {}),
115
- (F = e == null ? void 0 : e.quickFilters) == null ? void 0 : F.map((B) => /* @__PURE__ */ t(P.FilterColumnButton, { filterName: B }, B))
116
- ]
117
- }
118
- )
119
- ] }),
120
- u && /* @__PURE__ */ t(r.HeaderContent, { children: u })
121
- ]
122
- }
123
- ),
124
- /* @__PURE__ */ t(
125
- r.Body,
126
- {
127
- cell: l == null ? void 0 : l.cell,
128
- sort: l == null ? void 0 : l.sort,
129
- className: i(
130
- "flex-1 min-h-0",
131
- n && "border-stroke-solid-light border-1",
132
- d && !(p && v) && "rounded-t-xl",
133
- d && !(g && N) && "rounded-b-xl",
134
- n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
135
- n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
136
- l == null ? void 0 : l.className
137
- ),
138
- stickyHeader: l == null ? void 0 : l.stickyHeader
139
- }
140
- ),
141
- g && N && /* @__PURE__ */ m(
142
- r.Footer,
143
- {
144
- className: i(
145
- "flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
146
- n && "border",
147
- d && "rounded-b-xl",
148
- j
149
- ),
150
- children: [
151
- c ? /* @__PURE__ */ t(r.FooterContent, { children: /* @__PURE__ */ t(
152
- r.PaginationInfo,
153
- {
154
- showTotal: c.showTotal,
155
- totalItems: c.totalItems,
156
- currentPage: c.currentPage,
157
- itemsPerPage: c.itemsPerPage
158
- }
159
- ) }) : s || o ? /* @__PURE__ */ t(r.FooterContent, { children: null }) : null,
160
- (s || o) && /* @__PURE__ */ m(r.FooterContent, { children: [
161
- C && /* @__PURE__ */ t(
162
- r.PaginationQuickJumper,
163
- {
164
- currentPage: s.currentPage,
165
- totalPage: s.totalPage,
166
- onChange: s.onChange || (() => {
167
- }),
168
- disabled: s.disabled
157
+ showTotal: c.showTotal,
158
+ totalItems: c.totalItems,
159
+ currentPage: c.currentPage,
160
+ itemsPerPage: c.itemsPerPage
169
161
  }
170
- ),
171
- o && /* @__PURE__ */ t(
172
- r.Pagination,
173
- {
174
- currentPage: o.currentPage,
175
- totalPage: o.totalPage,
176
- onChange: o.onChange || (() => {
177
- }),
178
- totalItems: o.totalItems
179
- }
180
- )
181
- ] })
182
- ]
183
- }
184
- )
185
- ] }) });
162
+ ) }) : s || o ? /* @__PURE__ */ e(r.FooterContent, { children: null }) : null,
163
+ (s || o) && /* @__PURE__ */ a(r.FooterContent, { children: [
164
+ C && /* @__PURE__ */ e(
165
+ r.PaginationQuickJumper,
166
+ {
167
+ currentPage: s.currentPage,
168
+ totalPage: s.totalPage,
169
+ onChange: s.onChange || (() => {
170
+ }),
171
+ disabled: s.disabled
172
+ }
173
+ ),
174
+ o && /* @__PURE__ */ e(
175
+ r.Pagination,
176
+ {
177
+ currentPage: o.currentPage,
178
+ totalPage: o.totalPage,
179
+ onChange: o.onChange || (() => {
180
+ }),
181
+ totalItems: o.totalItems
182
+ }
183
+ )
184
+ ] })
185
+ ]
186
+ }
187
+ )
188
+ ] })
189
+ ] });
186
190
  };
187
191
  export {
188
- vt as default
192
+ Fe as default
189
193
  };
@@ -34,4 +34,5 @@ export interface TableCardProps {
34
34
  loading?: boolean;
35
35
  emptyMessage?: string;
36
36
  error?: boolean | string;
37
+ freeze?: boolean;
37
38
  }