zaravand-ui 7.0.2 → 7.1.1

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.
Files changed (66) hide show
  1. package/dist/components/Input/Input.formatting.cjs +1 -1
  2. package/dist/components/Input/Input.formatting.js +35 -17
  3. package/dist/components/Input/Input.interface.d.cts +5 -1
  4. package/dist/components/Input/Input.interface.d.ts +5 -1
  5. package/dist/components/OtpInput/OtpInput.cjs +1 -0
  6. package/dist/components/OtpInput/OtpInput.d.cts +10 -0
  7. package/dist/components/OtpInput/OtpInput.d.ts +10 -0
  8. package/dist/components/OtpInput/OtpInput.interface.d.cts +49 -0
  9. package/dist/components/OtpInput/OtpInput.interface.d.ts +49 -0
  10. package/dist/components/OtpInput/OtpInput.js +150 -0
  11. package/dist/components/OtpInput/OtpInput.variant.cjs +1 -0
  12. package/dist/components/OtpInput/OtpInput.variant.d.cts +6 -0
  13. package/dist/components/OtpInput/OtpInput.variant.d.ts +6 -0
  14. package/dist/components/OtpInput/OtpInput.variant.js +15 -0
  15. package/dist/components/Table/Table.cjs +1 -1
  16. package/dist/components/Table/Table.interface.d.cts +42 -1
  17. package/dist/components/Table/Table.interface.d.ts +42 -1
  18. package/dist/components/Table/Table.js +414 -373
  19. package/dist/components/Table/Table.utils.cjs +1 -1
  20. package/dist/components/Table/Table.utils.d.cts +2 -0
  21. package/dist/components/Table/Table.utils.d.ts +2 -0
  22. package/dist/components/Table/Table.utils.js +20 -16
  23. package/dist/components/Table/TableActionsContext.cjs +1 -0
  24. package/dist/components/Table/TableActionsContext.d.cts +26 -0
  25. package/dist/components/Table/TableActionsContext.d.ts +26 -0
  26. package/dist/components/Table/TableActionsContext.js +5 -0
  27. package/dist/components/Table/TableActiveFilters.d.cts +1 -1
  28. package/dist/components/Table/TableActiveFilters.d.ts +1 -1
  29. package/dist/components/Table/TableColumnFilter.cjs +1 -1
  30. package/dist/components/Table/TableColumnFilter.d.cts +3 -0
  31. package/dist/components/Table/TableColumnFilter.d.ts +3 -0
  32. package/dist/components/Table/TableColumnFilter.js +58 -28
  33. package/dist/components/Table/TableFilterRegistry.cjs +1 -0
  34. package/dist/components/Table/TableFilterRegistry.d.cts +13 -0
  35. package/dist/components/Table/TableFilterRegistry.d.ts +13 -0
  36. package/dist/components/Table/TableFilterRegistry.js +5 -0
  37. package/dist/components/Table/TableParts.cjs +1 -1
  38. package/dist/components/Table/TableParts.js +56 -34
  39. package/dist/components/Table/TableRowActions.cjs +1 -0
  40. package/dist/components/Table/TableRowActions.d.cts +14 -0
  41. package/dist/components/Table/TableRowActions.d.ts +14 -0
  42. package/dist/components/Table/TableRowActions.js +110 -0
  43. package/dist/components/VerticalTabs/VerticalTabs.cjs +1 -0
  44. package/dist/components/VerticalTabs/VerticalTabs.d.cts +4 -0
  45. package/dist/components/VerticalTabs/VerticalTabs.d.ts +4 -0
  46. package/dist/components/VerticalTabs/VerticalTabs.interface.d.cts +41 -0
  47. package/dist/components/VerticalTabs/VerticalTabs.interface.d.ts +41 -0
  48. package/dist/components/VerticalTabs/VerticalTabs.js +196 -0
  49. package/dist/components/VerticalTabs/VerticalTabs.variant.cjs +1 -0
  50. package/dist/components/VerticalTabs/VerticalTabs.variant.d.cts +19 -0
  51. package/dist/components/VerticalTabs/VerticalTabs.variant.d.ts +19 -0
  52. package/dist/components/VerticalTabs/VerticalTabs.variant.js +48 -0
  53. package/dist/components/shared/responsiveScale.cjs +1 -1
  54. package/dist/components/shared/responsiveScale.d.cts +3 -1
  55. package/dist/components/shared/responsiveScale.d.ts +3 -1
  56. package/dist/components/shared/responsiveScale.js +2 -2
  57. package/dist/config/messages.cjs +1 -1
  58. package/dist/config/messages.d.cts +4 -0
  59. package/dist/config/messages.d.ts +4 -0
  60. package/dist/config/messages.js +2 -0
  61. package/dist/index.cjs +1 -1
  62. package/dist/index.css +1 -1
  63. package/dist/index.d.cts +7 -1
  64. package/dist/index.d.ts +7 -1
  65. package/dist/index.js +20 -16
  66. package/package.json +1 -1
@@ -3,44 +3,51 @@ import { useZuiConfig as e } from "../../config/useZuiConfig.js";
3
3
  import { localizeDigits as t } from "../../services/localizeDigits/localizeDigits.js";
4
4
  import { cn as n, mergeRefs as r } from "../../lib/utils.js";
5
5
  import { CONTROL_HEIGHT_SM as i } from "../shared/responsiveScale.js";
6
- import a from "../Button/Button.js";
7
- import o from "../shared/ActionSheet.js";
8
- import { CLEAR_ICON_CLASS as s } from "../shared/FieldClearButton.js";
9
- import { IconActionButton as c, ListToolbar as ee, ToolbarIconButton as l } from "../shared/IconActionButton.js";
10
- import { useExclusiveAction as te } from "../shared/useExclusiveAction.js";
11
- import { useStickyToolbar as ne } from "../shared/useStickyToolbar.js";
12
- import { useIsMobileViewport as re } from "../shared/viewport.js";
13
- import ie from "../Select/Select.js";
6
+ import a from "../shared/ActionSheet.js";
7
+ import { CLEAR_ICON_CLASS as o } from "../shared/FieldClearButton.js";
8
+ import { IconActionButton as s, ListToolbar as c, ToolbarIconButton as l } from "../shared/IconActionButton.js";
9
+ import { useExclusiveAction as ee } from "../shared/useExclusiveAction.js";
10
+ import { useStickyToolbar as te } from "../shared/useStickyToolbar.js";
11
+ import { useIsMobileViewport as ne } from "../shared/viewport.js";
12
+ import re from "../Select/Select.js";
13
+ import { TableActionsContext as ie } from "./TableActionsContext.js";
14
14
  import { actionIconClassName as ae, actionsColumnClassName as oe, actionsColumnStickyClassName as se, pagingToggleIconClassName as ce, rowActionButtonClassName as le, rowNumberColumnClassName as ue, stickyHeaderCellClassName as de } from "./Table.constants.js";
15
- import { formatCellValue as fe, isEmptyFilterValue as pe, replaceRowByIdentifier as me, resolveAriaSort as he, resolveColumnWidthPercentages as ge, resolveFilterOptions as _e, resolveFilterText as ve, resolveLoadingRowsCount as ye, resolvePlaceholder as be, resolveSafeRowId as xe } from "./Table.utils.js";
16
- import { tableContainerVariants as Se, tableVariants as Ce } from "./Table.variant.js";
17
- import we from "./TableActiveFilters.js";
18
- import Te, { TableColumnFilterSheet as Ee } from "./TableColumnFilter.js";
19
- import De from "./TableEmptyState.js";
20
- import Oe from "./TablePaginationControls.js";
21
- import { TableBody as ke, TableCell as u, TableHead as Ae, TableHeader as je, TableRow as Me } from "./TableParts.js";
22
- import Ne from "./TableSkeletonRows.js";
23
- import Pe from "./TableSortToggle.js";
24
- import { useTablePagination as Fe } from "./hooks/useTablePagination.js";
25
- import { useTableCardLabels as Ie } from "./hooks/useTableCardLabels.js";
26
- import { useTableFilter as Le } from "./hooks/useTableFilter.js";
27
- import { useTableSearch as Re } from "./hooks/useTableSearch.js";
28
- import { useTableSort as ze } from "./hooks/useTableSort.js";
15
+ import { formatCellValue as fe, isEmptyFilterValue as pe, isInsideInteractiveControl as me, replaceRowByIdentifier as he, resolveAriaSort as ge, resolveColumnWidthPercentages as _e, resolveFilterOptions as ve, resolveFilterText as ye, resolveLoadingRowsCount as be, resolvePlaceholder as xe, resolveSafeRowId as Se } from "./Table.utils.js";
16
+ import { tableContainerVariants as Ce, tableVariants as we } from "./Table.variant.js";
17
+ import Te from "./TableActiveFilters.js";
18
+ import { TableFilterRegistryContext as Ee } from "./TableFilterRegistry.js";
19
+ import De, { TableColumnFilterSheet as Oe } from "./TableColumnFilter.js";
20
+ import ke from "./TableEmptyState.js";
21
+ import Ae from "./TablePaginationControls.js";
22
+ import { TableBody as je, TableCell as u, TableHead as Me, TableHeader as Ne, TableRow as Pe } from "./TableParts.js";
23
+ import Fe from "./TableSkeletonRows.js";
24
+ import Ie from "./TableSortToggle.js";
25
+ import { useTablePagination as Le } from "./hooks/useTablePagination.js";
26
+ import { useTableCardLabels as Re } from "./hooks/useTableCardLabels.js";
27
+ import { useTableFilter as ze } from "./hooks/useTableFilter.js";
28
+ import { useTableSearch as Be } from "./hooks/useTableSearch.js";
29
+ import { useTableSort as Ve } from "./hooks/useTableSort.js";
29
30
  import * as d from "react";
30
31
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
31
- import { ArrowDown as Be, ArrowUp as Ve, ArrowUpDown as He, EllipsisVertical as Ue, Eye as We, FileSpreadsheet as Ge, Funnel as Ke, Infinity as qe, Pencil as Je, Plus as Ye, Printer as Xe, RotateCcw as Ze, Rows3 as Qe, Trash2 as $e } from "lucide-react";
32
+ import { ArrowDown as He, ArrowUp as Ue, ArrowUpDown as We, EllipsisVertical as Ge, Eye as Ke, FileSpreadsheet as qe, Funnel as Je, Infinity as Ye, Pencil as Xe, Plus as Ze, Printer as Qe, RotateCcw as $e, Rows3 as et, Trash2 as tt } from "lucide-react";
32
33
  //#region src/components/Table/Table.tsx
33
- var et = d.forwardRef(function({ className: et, containerClassName: tt, loading: h = !1, isMutating: g = !1, stickyHeaderOnScroll: nt = !0, maxVisibleRowsBeforeScroll: rt, allowInfiniteMode: it = !0, stickyToolbar: at = !0, schema: _, data: v, setData: ot, onAdd: y, onImportExcel: b, onEdit: x, onDelete: st, onPrint: ct, onPreviewPrint: lt, actions: ut, onCellSelectChange: dt, getRowId: S, showNumberRow: ft = !1, showColumnBorder: pt = !1, showRowBorder: mt = !1, toolbarExtra: ht, children: gt }, _t) {
34
- let { messages: C, digits: w, dir: T } = e(), E = d.useMemo(() => ({
35
- digits: w,
36
- messages: C
37
- }), [w, C]), D = d.Children.count(gt) > 0, O = re(), vt = d.useRef(null), yt = d.useMemo(() => r(_t, vt), [_t]);
38
- Ie(vt, D);
39
- let k = d.useMemo(() => _.columns.filter((e) => e.view), [_.columns]), bt = d.useMemo(() => k.filter((e) => e.sortable), [k]), A = d.useMemo(() => k.filter((e) => e.filterable), [k]), xt = typeof y == "function", j = typeof b == "function", M = typeof x == "function", N = typeof st == "function", P = typeof ct == "function", F = typeof lt == "function", I = ut ?? [], St = I.length > 0, L = _.searchable ?? !1, R = ft && !D, Ct = ht != null && ht !== !1, wt = _.pagination, Tt = wt?.onSearchChange, Et = typeof Tt == "function", z = M || N || St, { rowNumberColumnStyle: Dt, columnStyleByKey: Ot, actionsColumnStyle: kt } = d.useMemo(() => ge(k, R, z), [
34
+ var nt = d.forwardRef(function({ className: nt, containerClassName: rt, loading: h = !1, isMutating: g = !1, stickyHeaderOnScroll: it = !0, maxVisibleRowsBeforeScroll: at, allowInfiniteMode: ot = !0, stickyToolbar: st = !0, schema: _, data: v, setData: ct, onAdd: y, onImportExcel: lt, onEdit: ut, onDelete: dt, onPrint: ft, onPreviewPrint: b, actions: pt, onCellSelectChange: mt, getRowId: x, showNumberRow: ht = !1, showColumnBorder: gt = !1, showRowBorder: _t = !1, toolbarExtra: vt, children: yt }, bt) {
35
+ let { messages: S, digits: C, dir: w } = e(), T = d.useMemo(() => ({
36
+ digits: C,
37
+ messages: S
38
+ }), [C, S]), E = d.Children.count(yt) > 0, [xt, St] = d.useState({}), Ct = d.useMemo(() => ({
39
+ register: (e) => St((t) => ({
40
+ ...t,
41
+ [e.column.key]: e
42
+ })),
43
+ unregister: (e) => St((t) => Object.fromEntries(Object.entries(t).filter(([t]) => t !== e)))
44
+ }), []), wt = Object.values(xt), D = ne(), Tt = d.useRef(null), Et = d.useMemo(() => r(bt, Tt), [bt]);
45
+ Re(Tt, E);
46
+ let O = d.useMemo(() => _.columns.filter((e) => e.view), [_.columns]), Dt = d.useMemo(() => O.filter((e) => e.sortable), [O]), k = d.useMemo(() => O.filter((e) => e.filterable), [O]), A = typeof y == "function", j = typeof lt == "function", M = typeof ut == "function", N = typeof dt == "function", P = typeof ft == "function", F = typeof b == "function", I = (pt ?? []).filter((e) => !e.hidden), Ot = I.length > 0, L = _.searchable ?? !1, R = ht && !E, kt = vt != null && vt !== !1, At = _.pagination, jt = At?.onSearchChange, Mt = typeof jt == "function", Nt = M || N || Ot, z = Nt && !D, { rowNumberColumnStyle: Pt, columnStyleByKey: Ft, actionsColumnStyle: It } = d.useMemo(() => _e(O, R, z), [
40
47
  z,
41
48
  R,
42
- k
43
- ]), At = d.useMemo(() => {
49
+ O
50
+ ]), Lt = d.useMemo(() => {
44
51
  let e = _.columns.map((e) => {
45
52
  if (e.type !== "select" && e.type !== "radio") return [e.key, []];
46
53
  if (Array.isArray(e.options) && e.options.length > 0) return [e.key, e.options];
@@ -58,48 +65,63 @@ var et = d.forwardRef(function({ className: et, containerClassName: tt, loading:
58
65
  }))];
59
66
  });
60
67
  return Object.fromEntries(e);
61
- }, [v, _.columns]), [jt, B] = te(), [Mt, Nt] = d.useState(!1), [Pt, Ft] = d.useState(!1), [It, Lt] = d.useState(!1), [Rt, zt] = d.useState(null), [Bt, Vt] = d.useState(!1), [Ht, Ut] = d.useState({
68
+ }, [v, _.columns]), [Rt, B] = ee(), [zt, Bt] = d.useState(!1), [Vt, Ht] = d.useState(!1), [Ut, Wt] = d.useState(!1), [Gt, Kt] = d.useState(null), [qt, Jt] = d.useState(!1), [Yt, Xt] = d.useState({
62
69
  open: !1,
63
70
  actions: []
64
- }), V = g || jt, Wt = d.useCallback(async () => {
71
+ }), V = g || Rt, Zt = d.useCallback(async () => {
65
72
  g || !y || await B(y);
66
73
  }, [
67
74
  g,
68
75
  y,
69
76
  B
70
- ]), Gt = d.useCallback(async () => {
71
- g || !b || await B(b);
77
+ ]), Qt = d.useCallback(async () => {
78
+ g || !lt || await B(lt);
72
79
  }, [
73
80
  g,
74
- b,
81
+ lt,
75
82
  B
76
83
  ]), H = d.useCallback(async (e, t, n, r) => {
77
84
  g || await B(() => e({
78
85
  row: t,
79
86
  rowIndex: n,
80
- rowId: r ?? xe(t, n, S)
87
+ rowId: r ?? Se(t, n, x)
81
88
  }));
82
89
  }, [
83
- S,
90
+ x,
91
+ g,
92
+ B
93
+ ]), $t = d.useCallback(async (e, t, n) => {
94
+ ut && await H(ut, e, t, n);
95
+ }, [ut, H]), en = d.useCallback(async (e, t, n) => {
96
+ dt && await H(dt, e, t, n);
97
+ }, [dt, H]), tn = d.useMemo(() => ({
98
+ isMobile: D,
99
+ isBusy: V,
100
+ run: async (e) => {
101
+ g || await B(e);
102
+ },
103
+ openRowSheet: (e) => Xt({
104
+ open: !0,
105
+ actions: e
106
+ })
107
+ }), [
108
+ V,
109
+ D,
84
110
  g,
85
111
  B
86
- ]), Kt = d.useCallback(async (e, t, n) => {
87
- x && await H(x, e, t, n);
88
- }, [x, H]), qt = d.useCallback(async (e, t, n) => {
89
- st && await H(st, e, t, n);
90
- }, [st, H]), Jt = d.useCallback(async (e, t, n, r) => {
112
+ ]), nn = d.useCallback(async (e, t, n, r) => {
91
113
  await H(e.onClick, t, n, r);
92
- }, [H]), Yt = d.useCallback(async (e, t, n, r, i) => {
114
+ }, [H]), rn = d.useCallback(async (e, t, n, r, i) => {
93
115
  if (g) return;
94
116
  let a = i.trim(), o = a.length > 0 ? a : null;
95
117
  if (e[r] === o) return;
96
- let s = n ?? xe(e, t, S), c = {
118
+ let s = n ?? Se(e, t, x), c = {
97
119
  ...e,
98
120
  [r]: o
99
121
  };
100
122
  await B(async () => {
101
123
  try {
102
- if (dt && await dt({
124
+ if (mt && await mt({
103
125
  row: c,
104
126
  previousRow: e,
105
127
  rowIndex: t,
@@ -107,549 +129,568 @@ var et = d.forwardRef(function({ className: et, containerClassName: tt, loading:
107
129
  columnKey: r,
108
130
  value: a
109
131
  }) === !1) return;
110
- ot((e) => me(e, t, s, S, c));
132
+ ct((e) => he(e, t, s, x, c));
111
133
  } catch {
112
134
  return;
113
135
  }
114
136
  });
115
137
  }, [
116
- S,
138
+ x,
117
139
  g,
118
- dt,
140
+ mt,
119
141
  B,
120
- ot
121
- ]), Xt = d.useCallback((e, t, r) => {
142
+ ct
143
+ ]), an = d.useCallback((e, t, r) => {
122
144
  let i = (e) => /* @__PURE__ */ p("span", {
123
- className: n("zui:inline-flex", s, "zui:[&>svg]:size-full"),
145
+ className: n("zui:inline-flex", o, "zui:[&>svg]:size-full"),
124
146
  children: e
125
147
  }), a = [];
126
148
  M && a.push({
127
149
  key: "edit",
128
- label: C.common.edit,
129
- icon: i(/* @__PURE__ */ p(Je, { "aria-hidden": "true" })),
130
- onSelect: () => void Kt(e, t, r)
150
+ label: S.common.edit,
151
+ icon: i(/* @__PURE__ */ p(Xe, { "aria-hidden": "true" })),
152
+ onSelect: () => void $t(e, t, r)
131
153
  }), I.forEach((n, o) => {
132
154
  a.push({
133
155
  key: `custom-${o}`,
134
156
  label: n.tooltip,
135
157
  icon: i(n.icon),
136
- onSelect: () => void Jt(n, e, t, r)
158
+ danger: n.danger,
159
+ disabled: n.disabled,
160
+ onSelect: () => void nn(n, e, t, r)
137
161
  });
138
162
  }), N && a.push({
139
163
  key: "delete",
140
- label: C.common.delete,
141
- icon: i(/* @__PURE__ */ p($e, { "aria-hidden": "true" })),
164
+ label: S.common.delete,
165
+ icon: i(/* @__PURE__ */ p(tt, { "aria-hidden": "true" })),
142
166
  danger: !0,
143
- onSelect: () => void qt(e, t, r)
144
- }), Ut({
167
+ onSelect: () => void en(e, t, r)
168
+ }), Xt({
145
169
  open: !0,
146
170
  actions: a
147
171
  });
148
172
  }, [
149
- Jt,
150
- qt,
151
- Kt,
152
- C.common.delete,
153
- C.common.edit,
173
+ nn,
174
+ en,
175
+ $t,
176
+ S.common.delete,
177
+ S.common.edit,
154
178
  I,
155
179
  N,
156
180
  M
157
- ]), { searchTerm: Zt, normalizedSearchTerm: Qt, filteredRows: $t, handleSearchInputChange: en } = Re({
181
+ ]), { searchTerm: on, normalizedSearchTerm: sn, filteredRows: cn, handleSearchInputChange: ln } = Be({
158
182
  data: v,
159
- visibleColumns: k,
183
+ visibleColumns: O,
160
184
  showSearchInput: L,
161
- hasRemoteSearchHandler: Et,
162
- onSearchChange: Tt,
163
- getRowId: S,
164
- cellFormatOptions: E
165
- }), { filteredRows: tn, filterValues: U, activeFilterCount: nn, filterKey: rn, handleFilterChange: an, handleFilterClear: on } = Le({
166
- rows: $t,
185
+ hasRemoteSearchHandler: Mt,
186
+ onSearchChange: jt,
187
+ getRowId: x,
188
+ cellFormatOptions: T
189
+ }), { filteredRows: un, filterValues: U, activeFilterCount: dn, filterKey: fn, handleFilterChange: pn, handleFilterClear: mn } = ze({
190
+ rows: cn,
167
191
  columns: _.columns,
168
192
  filterConfig: _.filter
169
- }), W = d.useMemo(() => Object.fromEntries(A.map((e) => [e.key, _e(e, v, E)])), [
170
- E,
193
+ }), W = d.useMemo(() => Object.fromEntries(k.map((e) => [e.key, ve(e, v, T)])), [
194
+ T,
171
195
  v,
172
- A
173
- ]), { sortedRows: G, activeSort: K, handleSortToggle: sn, handleSortClear: cn } = ze({
174
- rows: tn,
196
+ k
197
+ ]), { sortedRows: G, activeSort: K, handleSortToggle: hn, handleSortClear: gn } = Ve({
198
+ rows: un,
175
199
  columns: _.columns,
176
200
  sortConfig: _.sort
177
- }), ln = d.useCallback(async () => {
178
- ct && await ct({
201
+ }), _n = d.useCallback(async () => {
202
+ ft && await ft({
179
203
  rows: G.map(({ row: e }) => e),
180
- columns: k
204
+ columns: O
181
205
  });
182
206
  }, [
183
- ct,
207
+ ft,
184
208
  G,
185
- k
186
- ]), un = d.useCallback(async () => {
187
- lt && await lt({
209
+ O
210
+ ]), vn = d.useCallback(async () => {
211
+ b && await b({
188
212
  rows: G.map(({ row: e }) => e),
189
- columns: k
213
+ columns: O
190
214
  });
191
215
  }, [
192
- lt,
216
+ b,
193
217
  G,
194
- k
195
- ]), { pagingMode: q, currentPage: dn, totalPages: fn, resolvedPageSize: pn, visibleRows: J, showPagingModeToggle: mn, shouldRenderPagination: hn, shouldRenderInfiniteMode: gn, canLoadMoreInInfiniteMode: _n, shouldUseRemotePaging: vn, shouldUseScrollableRows: yn, tableScrollViewportRef: bn, tableScrollViewportStyle: xn, handlePageChange: Sn, handlePagingModeToggle: Cn, handleTableScrollViewport: wn, isInfiniteRequestPending: Tn } = Fe({
196
- hasChildren: D,
218
+ O
219
+ ]), { pagingMode: q, currentPage: yn, totalPages: bn, resolvedPageSize: xn, visibleRows: J, showPagingModeToggle: Sn, shouldRenderPagination: Cn, shouldRenderInfiniteMode: wn, canLoadMoreInInfiniteMode: Tn, shouldUseRemotePaging: En, shouldUseScrollableRows: Dn, tableScrollViewportRef: On, tableScrollViewportStyle: kn, handlePageChange: An, handlePagingModeToggle: jn, handleTableScrollViewport: Mn, isInfiniteRequestPending: Nn } = Le({
220
+ hasChildren: E,
197
221
  filteredRows: G,
198
- paginationConfig: wt,
222
+ paginationConfig: At,
199
223
  loading: h,
200
224
  isRowActionBusy: V,
201
- searchKey: `${Qt}|${rn}`,
225
+ searchKey: `${sn}|${fn}`,
202
226
  sortKey: K ? `${K.sortKey}:${K.direction}` : "",
203
- maxVisibleRowsBeforeScroll: rt,
204
- allowInfiniteMode: it
205
- }), En = yn && nt, Dn = d.useMemo(() => ye(_.pagination?.pageSize, v.length), [v.length, _.pagination?.pageSize]), On = h && (J.length === 0 || vn && q === "pagination"), kn = gn && h && J.length > 0, An = gn && J.length > 0, jn = An && (h || Tn), Mn = An && _n && !h && !Tn, Nn = An && !_n && !h && !Tn, Pn = Math.min(Dn, Math.max(1, Math.min(pn, 3))), Y = h || V, Fn = +!!M + I.length + +!!N, In = q === "pagination" ? C.table.switchToInfinite : C.table.switchToPagination, Ln = xt || j || mn || P || F, X = O && !D && bt.length > 0, Z = O && !D && A.length > 0, Q = !D && (L || Ln || X || Z), Rn = d.useRef(null), zn = d.useRef(null);
206
- ne(Rn, zn, O && at && Q);
207
- let Bn = d.useMemo(() => {
227
+ maxVisibleRowsBeforeScroll: at,
228
+ allowInfiniteMode: ot
229
+ }), Pn = Dn && it, Fn = d.useMemo(() => be(_.pagination?.pageSize, v.length), [v.length, _.pagination?.pageSize]), In = h && (J.length === 0 || En && q === "pagination"), Ln = wn && h && J.length > 0, Rn = wn && J.length > 0, zn = Rn && (h || Nn), Bn = Rn && Tn && !h && !Nn, Vn = Rn && !Tn && !h && !Nn, Hn = Math.min(Fn, Math.max(1, Math.min(xn, 3))), Y = h || V, Un = D ? 0 : +!!M + I.length + +!!N, Wn = q === "pagination" ? S.table.switchToInfinite : S.table.switchToPagination, Gn = A || j || Sn || P || F, X = D && !E && Dt.length > 0, Z = D && !E && k.length > 0, Q = !E && (L || Gn || X || Z), Kn = d.useRef(null), qn = d.useRef(null);
230
+ te(Kn, qn, D && st && Q);
231
+ let Jn = d.useMemo(() => {
208
232
  let e = (e) => /* @__PURE__ */ p(e, {
209
- className: s,
233
+ className: o,
210
234
  "aria-hidden": "true"
211
- }), n = bt.map((n) => {
212
- let r = K?.sortKey === n.key ? K.direction : void 0, i = t(n.label, w);
235
+ }), n = Dt.map((n) => {
236
+ let r = K?.sortKey === n.key ? K.direction : void 0, i = t(n.label, C);
213
237
  return {
214
238
  key: n.key,
215
- label: r === void 0 ? i : `${i} (${r === "asc" ? C.table.sortAscending : C.table.sortDescending})`,
216
- icon: e(r === "asc" ? Ve : r === "desc" ? Be : He),
239
+ label: r === void 0 ? i : `${i} (${r === "asc" ? S.table.sortAscending : S.table.sortDescending})`,
240
+ icon: e(r === "asc" ? Ue : r === "desc" ? He : We),
217
241
  active: r !== void 0,
218
- onSelect: () => sn(n.key)
242
+ onSelect: () => hn(n.key)
219
243
  };
220
244
  });
221
245
  return K && n.push({
222
246
  key: "clear-sort",
223
- label: C.table.sortDefault,
224
- icon: e(Ze),
225
- onSelect: cn
247
+ label: S.table.sortDefault,
248
+ icon: e($e),
249
+ onSelect: gn
226
250
  }), n;
227
251
  }, [
228
252
  K,
229
- w,
230
- cn,
231
- sn,
232
- C.table.sortAscending,
233
- C.table.sortDefault,
234
- C.table.sortDescending,
235
- bt
236
- ]), Vn = d.useCallback((e) => {
237
- zt(e), Vt(!0);
238
- }, []), Hn = d.useMemo(() => A.map((e) => {
239
- let n = U[e.key], r = n !== void 0 && !pe(n), i = t(e.label, w), a = r ? t(ve(n, W[e.key] ?? []), w) : "";
253
+ C,
254
+ gn,
255
+ hn,
256
+ S.table.sortAscending,
257
+ S.table.sortDefault,
258
+ S.table.sortDescending,
259
+ Dt
260
+ ]), Yn = d.useCallback((e) => {
261
+ Kt(e), Jt(!0);
262
+ }, []), Xn = d.useMemo(() => k.map((e) => {
263
+ let n = U[e.key], r = n !== void 0 && !pe(n), i = t(e.label, C), a = r ? t(ye(n, W[e.key] ?? []), C) : "";
240
264
  return {
241
265
  key: e.key,
242
266
  label: r ? `${i}: ${a}` : i,
243
- icon: /* @__PURE__ */ p(Ke, {
244
- className: s,
267
+ icon: /* @__PURE__ */ p(Je, {
268
+ className: o,
245
269
  fill: r ? "currentColor" : "none",
246
270
  "aria-hidden": "true"
247
271
  }),
248
272
  active: r,
249
- onSelect: () => Vn(e.key)
273
+ onSelect: () => Yn(e.key)
250
274
  };
251
275
  }), [
252
- w,
276
+ C,
253
277
  W,
254
278
  U,
255
- A,
256
- Vn
257
- ]), $ = A.find((e) => e.key === Rt), Un = d.useMemo(() => {
279
+ k,
280
+ Yn
281
+ ]), $ = k.find((e) => e.key === Gt), Zn = d.useMemo(() => {
258
282
  let e = (e) => /* @__PURE__ */ p(e, {
259
- className: s,
283
+ className: o,
260
284
  "aria-hidden": "true"
261
285
  });
262
286
  return [
263
- xt ? {
287
+ A ? {
264
288
  key: "add",
265
- label: C.common.add,
266
- icon: e(Ye),
267
- onSelect: () => void Wt()
289
+ label: S.common.add,
290
+ icon: e(Ze),
291
+ onSelect: () => void Zt()
268
292
  } : null,
269
293
  j ? {
270
294
  key: "import",
271
- label: C.table.importExcel,
272
- icon: e(Ge),
273
- onSelect: () => void Gt()
295
+ label: S.table.importExcel,
296
+ icon: e(qe),
297
+ onSelect: () => void Qt()
274
298
  } : null,
275
299
  P ? {
276
300
  key: "print",
277
- label: C.table.print,
278
- icon: e(Xe),
279
- onSelect: () => void ln()
301
+ label: S.table.print,
302
+ icon: e(Qe),
303
+ onSelect: () => void _n()
280
304
  } : null,
281
305
  F ? {
282
306
  key: "preview-print",
283
- label: C.table.printPreview,
284
- icon: e(We),
285
- onSelect: () => void un()
307
+ label: S.table.printPreview,
308
+ icon: e(Ke),
309
+ onSelect: () => void vn()
286
310
  } : null,
287
- mn ? {
311
+ Sn ? {
288
312
  key: "paging-mode",
289
- label: In,
290
- icon: e(q === "pagination" ? qe : Qe),
291
- onSelect: Cn
313
+ label: Wn,
314
+ icon: e(q === "pagination" ? Ye : et),
315
+ onSelect: jn
292
316
  } : null
293
317
  ].filter((e) => e !== null);
294
318
  }, [
295
- Wt,
296
- Gt,
297
- Cn,
298
- un,
299
- ln,
300
- C.common.add,
301
- C.table.importExcel,
302
- C.table.print,
303
- C.table.printPreview,
319
+ Zt,
320
+ Qt,
321
+ jn,
322
+ vn,
323
+ _n,
324
+ S.common.add,
325
+ S.table.importExcel,
326
+ S.table.print,
327
+ S.table.printPreview,
304
328
  q,
305
- In,
306
- xt,
329
+ Wn,
330
+ A,
307
331
  j,
308
- mn,
332
+ Sn,
309
333
  F,
310
334
  P
311
- ]), Wn = O && (Un.length > 0 || X || Z), Gn = O && Un.length > 1, Kn = Ct && Q && L, qn = Ct && Q && !L, Jn = Ct && !Q, Yn = /* @__PURE__ */ p("div", {
335
+ ]), Qn = D && (Zn.length > 0 || X || Z), $n = D && Zn.length > 1, er = kt && Q && L, tr = kt && Q && !L, nr = kt && !Q, rr = /* @__PURE__ */ p("div", {
312
336
  "data-slot": "table-toolbar-extra",
313
337
  className: n("zui:flex zui:w-full zui:items-center", i),
314
- children: ht
338
+ children: vt
315
339
  });
316
340
  return /* @__PURE__ */ m("div", {
317
341
  "data-slot": "table-container",
318
- dir: T,
319
- className: n(Se(), tt),
342
+ dir: w,
343
+ className: n(Ce(), rt),
320
344
  children: [
321
- Jn ? /* @__PURE__ */ p("div", {
345
+ E ? /* @__PURE__ */ p(Te, {
346
+ columns: wt.map((e) => e.column),
347
+ values: Object.fromEntries(wt.flatMap((e) => e.value ? [[e.column.key, e.value]] : [])),
348
+ optionsByColumn: Object.fromEntries(wt.map((e) => [e.column.key, e.options])),
349
+ onRemove: (e) => xt[e]?.onChange(void 0)
350
+ }) : /* @__PURE__ */ p(Te, {
351
+ columns: O,
352
+ values: U,
353
+ optionsByColumn: W,
354
+ onRemove: (e) => pn(e, void 0),
355
+ onSelect: D ? Yn : void 0
356
+ }),
357
+ nr ? /* @__PURE__ */ p("div", {
322
358
  "data-slot": "table-toolbar-extra-row",
323
359
  className: "zui:mb-3",
324
- children: Yn
360
+ children: rr
325
361
  }) : null,
326
362
  Q ? /* @__PURE__ */ m(f, { children: [
327
363
  /* @__PURE__ */ p("div", {
328
- ref: zn,
364
+ ref: qn,
329
365
  "aria-hidden": "true",
330
366
  "data-slot": "table-sticky-sentinel"
331
367
  }),
332
368
  /* @__PURE__ */ m("div", {
333
- ref: Rn,
369
+ ref: Kn,
334
370
  "data-slot": "table-sticky-toolbar",
335
- "data-sticky-toolbar": O && at ? "true" : void 0,
371
+ "data-sticky-toolbar": D && st ? "true" : void 0,
336
372
  className: "zui:mb-3",
337
- children: [Kn ? /* @__PURE__ */ p("div", {
373
+ children: [er ? /* @__PURE__ */ p("div", {
338
374
  "data-slot": "table-toolbar-extra-row",
339
375
  className: "zui:mb-2",
340
- children: Yn
341
- }) : null, /* @__PURE__ */ p(ee, {
376
+ children: rr
377
+ }) : null, /* @__PURE__ */ p(c, {
342
378
  "data-slot": "table-controls",
343
379
  searchSlot: "table-search-input",
344
380
  actionsSlot: "table-add-action",
345
- inlineActionsOnMobile: Wn,
381
+ inlineActionsOnMobile: Qn,
346
382
  search: L ? {
347
- value: Zt,
348
- onChange: en,
349
- placeholder: C.common.searchPlaceholder,
350
- ariaLabel: C.table.searchAriaLabel,
383
+ value: on,
384
+ onChange: ln,
385
+ placeholder: S.common.searchPlaceholder,
386
+ ariaLabel: S.table.searchAriaLabel,
351
387
  disabled: V
352
388
  } : void 0,
353
- leading: qn ? Yn : void 0,
354
- actions: X || Z || Gn || Ln ? /* @__PURE__ */ m(f, { children: [
389
+ leading: tr ? rr : void 0,
390
+ actions: X || Z || $n || Gn ? /* @__PURE__ */ m(f, { children: [
355
391
  X ? /* @__PURE__ */ p(l, {
356
392
  "data-slot": "table-sort-button",
357
- label: C.table.sortBy,
393
+ label: S.table.sortBy,
358
394
  disabled: Y,
359
- onClick: () => Ft(!0),
360
- icon: /* @__PURE__ */ p(He, { "aria-hidden": "true" })
395
+ onClick: () => Ht(!0),
396
+ icon: /* @__PURE__ */ p(We, { "aria-hidden": "true" })
361
397
  }) : null,
362
398
  Z ? /* @__PURE__ */ p(l, {
363
399
  "data-slot": "table-filter-button",
364
- label: C.table.filterBy,
400
+ label: S.table.filterBy,
365
401
  disabled: Y,
366
- onClick: () => Lt(!0),
402
+ onClick: () => Wt(!0),
367
403
  icon: /* @__PURE__ */ m("span", {
368
404
  className: "zui:relative zui:inline-flex",
369
- children: [/* @__PURE__ */ p(Ke, {
370
- fill: nn > 0 ? "currentColor" : "none",
405
+ children: [/* @__PURE__ */ p(Je, {
406
+ fill: dn > 0 ? "currentColor" : "none",
371
407
  "aria-hidden": "true"
372
- }), nn > 0 ? /* @__PURE__ */ p("span", {
408
+ }), dn > 0 ? /* @__PURE__ */ p("span", {
373
409
  "aria-hidden": "true",
374
410
  "data-slot": "table-filter-active-dot",
375
411
  className: "zui:absolute zui:-end-1 zui:-top-1 zui:size-2 zui:rounded-full zui:bg-[var(--zui-theme-action-primary)] zui:ring-2 zui:ring-[var(--zui-color-surface)]"
376
412
  }) : null]
377
413
  })
378
414
  }) : null,
379
- Gn ? /* @__PURE__ */ p(l, {
415
+ $n ? /* @__PURE__ */ p(l, {
380
416
  "data-slot": "table-toolbar-menu-button",
381
- label: C.table.actions,
417
+ label: S.table.actions,
382
418
  disabled: Y,
383
- onClick: () => Nt(!0),
384
- icon: /* @__PURE__ */ p(Ue, { "aria-hidden": "true" })
385
- }) : Ln ? /* @__PURE__ */ m(f, { children: [
386
- mn ? /* @__PURE__ */ p(l, {
419
+ onClick: () => Bt(!0),
420
+ icon: /* @__PURE__ */ p(Ge, { "aria-hidden": "true" })
421
+ }) : Gn ? /* @__PURE__ */ m(f, { children: [
422
+ Sn ? /* @__PURE__ */ p(l, {
387
423
  "data-slot": "table-paging-mode-toggle-button",
388
- label: In,
424
+ label: Wn,
389
425
  disabled: Y,
390
- onClick: Cn,
391
- icon: p(q === "pagination" ? qe : Qe, {
426
+ onClick: jn,
427
+ icon: p(q === "pagination" ? Ye : et, {
392
428
  className: ce,
393
429
  "aria-hidden": "true"
394
430
  })
395
431
  }) : null,
396
432
  F ? /* @__PURE__ */ p(l, {
397
433
  "data-slot": "table-action-preview-print-button",
398
- label: C.table.printPreview,
434
+ label: S.table.printPreview,
399
435
  disabled: Y,
400
- onClick: () => void un(),
401
- icon: /* @__PURE__ */ p(We, {})
436
+ onClick: () => void vn(),
437
+ icon: /* @__PURE__ */ p(Ke, {})
402
438
  }) : null,
403
439
  P ? /* @__PURE__ */ p(l, {
404
440
  "data-slot": "table-action-print-button",
405
- label: C.table.print,
441
+ label: S.table.print,
406
442
  disabled: Y,
407
- onClick: () => void ln(),
408
- icon: /* @__PURE__ */ p(Xe, {})
443
+ onClick: () => void _n(),
444
+ icon: /* @__PURE__ */ p(Qe, {})
409
445
  }) : null,
410
446
  j ? /* @__PURE__ */ p(l, {
411
447
  "data-slot": "table-action-import-excel-button",
412
- label: C.table.importExcel,
448
+ label: S.table.importExcel,
413
449
  disabled: Y,
414
- onClick: () => void Gt(),
415
- icon: /* @__PURE__ */ p(Ge, {})
450
+ onClick: () => void Qt(),
451
+ icon: /* @__PURE__ */ p(qe, {})
416
452
  }) : null,
417
- xt ? /* @__PURE__ */ p(l, {
453
+ A ? /* @__PURE__ */ p(l, {
418
454
  "data-slot": "table-action-add-button",
419
- label: C.common.add,
455
+ label: S.common.add,
420
456
  disabled: Y,
421
- onClick: () => void Wt(),
422
- icon: /* @__PURE__ */ p(Ye, {})
457
+ onClick: () => void Zt(),
458
+ icon: /* @__PURE__ */ p(Ze, {})
423
459
  }) : null
424
460
  ] }) : null
425
461
  ] }) : void 0
426
462
  })]
427
463
  }),
428
- X ? /* @__PURE__ */ p(o, {
429
- open: Pt,
430
- onOpenChange: Ft,
431
- actions: Bn,
432
- label: C.table.sortBy
464
+ X ? /* @__PURE__ */ p(a, {
465
+ open: Vt,
466
+ onOpenChange: Ht,
467
+ actions: Jn,
468
+ label: S.table.sortBy
433
469
  }) : null,
434
- Z ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(o, {
435
- open: It,
436
- onOpenChange: Lt,
437
- actions: Hn,
438
- label: C.table.filterBy
439
- }), $ ? /* @__PURE__ */ p(Ee, {
470
+ Z ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(a, {
471
+ open: Ut,
472
+ onOpenChange: Wt,
473
+ actions: Xn,
474
+ label: S.table.filterBy
475
+ }), $ ? /* @__PURE__ */ p(Oe, {
440
476
  column: $,
441
477
  value: U[$.key],
442
- onChange: (e) => an($.key, e),
478
+ onChange: (e) => pn($.key, e),
443
479
  options: W[$.key] ?? [],
444
- open: Bt,
445
- onOpenChange: Vt
480
+ open: qt,
481
+ onOpenChange: Jt
446
482
  }, $.key) : null] }) : null,
447
- Gn ? /* @__PURE__ */ p(o, {
448
- open: Mt,
449
- onOpenChange: Nt,
450
- actions: Un.map((e) => ({
483
+ $n ? /* @__PURE__ */ p(a, {
484
+ open: zt,
485
+ onOpenChange: Bt,
486
+ actions: Zn.map((e) => ({
451
487
  ...e,
452
488
  disabled: Y
453
489
  })),
454
- label: C.table.actions
490
+ label: S.table.actions
455
491
  }) : null
456
492
  ] }) : null,
457
- D ? null : /* @__PURE__ */ p(we, {
458
- columns: k,
459
- values: U,
460
- optionsByColumn: W,
461
- onRemove: (e) => an(e, void 0),
462
- onSelect: O ? Vn : void 0
463
- }),
464
493
  /* @__PURE__ */ p("div", {
465
- ref: bn,
494
+ ref: On,
466
495
  "data-slot": "table-scroll-viewport",
467
- className: n("zui:relative zui:w-full zui:min-w-0 zui:overflow-x-auto zui-radius-xs zui:bg-[var(--zui-color-surface)] zui:shadow-[0_4px_14px_-12px_var(--zui-effect-shadow-ink-35)]", yn ? "zui:overflow-y-auto" : void 0),
468
- style: xn,
469
- onScroll: wn,
496
+ className: n("zui:relative zui:w-full zui:min-w-0 zui:overflow-x-auto zui-radius-xs zui:bg-[var(--zui-color-surface)] zui:shadow-[0_4px_14px_-12px_var(--zui-effect-shadow-ink-35)]", Dn ? "zui:overflow-y-auto" : void 0),
497
+ style: kn,
498
+ onScroll: Mn,
470
499
  children: /* @__PURE__ */ p("table", {
471
- ref: yt,
500
+ ref: Et,
472
501
  "data-slot": "table",
473
- className: n(Ce({
474
- showColumnBorder: pt,
475
- showRowBorder: mt
476
- }), et),
477
- dir: T,
478
- children: D ? gt : k.length === 0 ? /* @__PURE__ */ p(ke, { children: /* @__PURE__ */ p(Me, { children: /* @__PURE__ */ p(u, {
502
+ className: n(we({
503
+ showColumnBorder: gt,
504
+ showRowBorder: _t
505
+ }), nt),
506
+ dir: w,
507
+ children: E ? /* @__PURE__ */ p(ie.Provider, {
508
+ value: tn,
509
+ children: /* @__PURE__ */ p(Ee.Provider, {
510
+ value: Ct,
511
+ children: yt
512
+ })
513
+ }) : O.length === 0 ? /* @__PURE__ */ p(je, { children: /* @__PURE__ */ p(Pe, { children: /* @__PURE__ */ p(u, {
479
514
  className: "zui:py-7 zui:text-center zui:text-[var(--zui-color-text)]",
480
- children: C.table.noColumns
515
+ children: S.table.noColumns
481
516
  }) }) }) : /* @__PURE__ */ m(f, { children: [
482
517
  /* @__PURE__ */ m("colgroup", { children: [
483
- R ? /* @__PURE__ */ p("col", { style: Dt }) : null,
484
- k.map((e) => /* @__PURE__ */ p("col", { style: Ot[e.key] }, `col-${e.key}`)),
485
- z ? /* @__PURE__ */ p("col", { style: kt }) : null
518
+ R ? /* @__PURE__ */ p("col", { style: Pt }) : null,
519
+ O.map((e) => /* @__PURE__ */ p("col", { style: Ft[e.key] }, `col-${e.key}`)),
520
+ z ? /* @__PURE__ */ p("col", { style: It }) : null
486
521
  ] }),
487
- /* @__PURE__ */ p(je, { children: /* @__PURE__ */ m(Me, { children: [
488
- R ? /* @__PURE__ */ p(Ae, {
522
+ /* @__PURE__ */ p(Ne, { children: /* @__PURE__ */ m(Pe, { children: [
523
+ R ? /* @__PURE__ */ p(Me, {
489
524
  align: "center",
490
- className: n(ue, En ? de : void 0),
491
- children: C.table.rowNumber
525
+ className: n(ue, Pn ? de : void 0),
526
+ children: S.table.rowNumber
492
527
  }) : null,
493
- k.map((e) => {
494
- let n = e.sortable && K?.sortKey === e.key ? K.direction : void 0, r = e.sortable ? /* @__PURE__ */ p(Pe, {
528
+ O.map((e) => {
529
+ let n = e.sortable && K?.sortKey === e.key ? K.direction : void 0, r = e.sortable ? /* @__PURE__ */ p(Ie, {
495
530
  columnLabel: e.label,
496
531
  direction: n,
497
- onToggle: () => sn(e.key)
498
- }) : null, i = e.filterable ? /* @__PURE__ */ p(Te, {
532
+ onToggle: () => hn(e.key)
533
+ }) : null, i = e.filterable ? /* @__PURE__ */ p(De, {
499
534
  column: e,
500
535
  value: U[e.key],
501
- onChange: (t) => an(e.key, t),
536
+ onChange: (t) => pn(e.key, t),
502
537
  options: W[e.key] ?? []
503
538
  }) : null;
504
- return /* @__PURE__ */ p(Ae, {
539
+ return /* @__PURE__ */ p(Me, {
505
540
  align: e.align,
506
- className: En ? de : void 0,
507
- "aria-sort": e.sortable ? he(n) : void 0,
541
+ className: Pn ? de : void 0,
542
+ "aria-sort": e.sortable ? ge(n) : void 0,
508
543
  children: e.sortable || e.filterable ? /* @__PURE__ */ m("span", {
509
544
  className: "zui:inline-flex zui:items-center zui:gap-2",
510
- children: [t(e.label, w), /* @__PURE__ */ m("span", {
545
+ children: [t(e.label, C), /* @__PURE__ */ m("span", {
511
546
  className: "zui:inline-flex zui:items-center",
512
- children: [T === "rtl" ? r : i, T === "rtl" ? i : r]
547
+ children: [w === "rtl" ? r : i, w === "rtl" ? i : r]
513
548
  })]
514
- }) : t(e.label, w)
549
+ }) : t(e.label, C)
515
550
  }, `head-${e.key}`);
516
551
  }),
517
- z ? /* @__PURE__ */ p(Ae, {
552
+ z ? /* @__PURE__ */ p(Me, {
518
553
  align: "center",
519
- className: n(oe, se, En ? de : void 0),
520
- children: C.table.actions
554
+ className: n(oe, se, Pn ? de : void 0),
555
+ children: S.table.actions
521
556
  }) : null
522
557
  ] }) }),
523
- /* @__PURE__ */ p(ke, { children: On ? /* @__PURE__ */ p(Ne, {
524
- count: Dn,
558
+ /* @__PURE__ */ p(je, { children: In ? /* @__PURE__ */ p(Fe, {
559
+ count: Fn,
525
560
  keyPrefix: "loading",
526
561
  showRowNumbers: R,
527
- columns: k,
528
- actionsCount: Fn
529
- }) : J.length === 0 ? /* @__PURE__ */ p(De, {
530
- colSpan: k.length + +!!z + +!!R,
562
+ columns: O,
563
+ actionsCount: Un
564
+ }) : J.length === 0 ? /* @__PURE__ */ p(ke, {
565
+ colSpan: O.length + +!!z + +!!R,
531
566
  showSearchInput: L,
532
- normalizedSearchTerm: Qt,
533
- hasActiveFilters: nn > 0,
534
- onClearFilters: on
535
- }) : /* @__PURE__ */ m(f, { children: [J.map(({ row: e, rowIndex: r, rowId: i }, o) => {
536
- let s = i === void 0 ? `row-${r}` : `row-id-${String(i)}`, ee = hn ? (dn - 1) * pn + o + 1 : o + 1;
537
- return /* @__PURE__ */ m(Me, { children: [
538
- R ? /* @__PURE__ */ p(u, {
539
- align: "center",
540
- className: ue,
541
- "data-label": C.table.rowNumber,
542
- children: t(String(ee), w)
543
- }) : null,
544
- k.map((n) => {
545
- let a = `cell-${n.key}-${s}`;
546
- if (n.viewType === "select") {
547
- let o = At[n.key] ?? [], s = e[n.key], c = typeof s == "string" || typeof s == "number" ? String(s) : "";
567
+ normalizedSearchTerm: sn,
568
+ hasActiveFilters: dn > 0,
569
+ onClearFilters: mn
570
+ }) : /* @__PURE__ */ m(f, { children: [J.map(({ row: e, rowIndex: r, rowId: i }, a) => {
571
+ let o = i === void 0 ? `row-${r}` : `row-id-${String(i)}`, c = Cn ? (yn - 1) * xn + a + 1 : a + 1;
572
+ return /* @__PURE__ */ m(Pe, {
573
+ ...D && Nt ? {
574
+ tabIndex: 0,
575
+ "aria-haspopup": "dialog",
576
+ "data-actionable": "true",
577
+ onClick: (t) => {
578
+ me(t) || an(e, r, i);
579
+ },
580
+ onKeyDown: (t) => {
581
+ t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), an(e, r, i));
582
+ }
583
+ } : {},
584
+ children: [
585
+ R ? /* @__PURE__ */ p(u, {
586
+ align: "center",
587
+ className: ue,
588
+ "data-label": S.table.rowNumber,
589
+ children: t(String(c), C)
590
+ }) : null,
591
+ O.map((n) => {
592
+ let a = `cell-${n.key}-${o}`;
593
+ if (n.viewType === "select") {
594
+ let o = Lt[n.key] ?? [], s = e[n.key], c = typeof s == "string" || typeof s == "number" ? String(s) : "";
595
+ return /* @__PURE__ */ p(u, {
596
+ align: n.align,
597
+ "data-label": t(n.label, C),
598
+ children: /* @__PURE__ */ p(re, {
599
+ disabled: V || o.length === 0 && !n.optionsSource,
600
+ placeholder: xe(n),
601
+ options: o,
602
+ remoteOptions: n.optionsSource,
603
+ value: c,
604
+ onValueChange: (t) => {
605
+ let a = Array.isArray(t) ? t[0] ?? "" : t;
606
+ rn(e, r, i, n.key, a);
607
+ }
608
+ })
609
+ }, a);
610
+ }
548
611
  return /* @__PURE__ */ p(u, {
549
612
  align: n.align,
550
- "data-label": t(n.label, w),
551
- children: /* @__PURE__ */ p(ie, {
552
- disabled: V || o.length === 0 && !n.optionsSource,
553
- placeholder: be(n),
554
- options: o,
555
- remoteOptions: n.optionsSource,
556
- value: c,
557
- onValueChange: (t) => {
558
- let a = Array.isArray(t) ? t[0] ?? "" : t;
559
- Yt(e, r, i, n.key, a);
560
- }
561
- })
613
+ "data-label": t(n.label, C),
614
+ children: fe(e[n.key], n, T)
562
615
  }, a);
563
- }
564
- return /* @__PURE__ */ p(u, {
565
- align: n.align,
566
- "data-label": t(n.label, w),
567
- children: fe(e[n.key], n, E)
568
- }, a);
569
- }),
570
- z ? /* @__PURE__ */ p(u, {
571
- align: "center",
572
- "data-cell": "actions",
573
- className: n(oe, se),
574
- children: O ? /* @__PURE__ */ p(a, {
575
- "data-slot": "table-row-actions-button",
576
- kind: "cancel",
577
- fullWidth: !0,
578
- label: C.table.actions,
579
- disabled: V,
580
- onClick: () => Xt(e, r, i)
581
- }) : /* @__PURE__ */ m("div", {
582
- "data-slot": "table-row-actions",
583
- className: "zui:flex zui:items-center zui:justify-center zui:gap-0.5",
584
- children: [
585
- M ? /* @__PURE__ */ p(c, {
586
- "data-slot": "table-action-edit-button",
587
- label: C.common.edit,
588
- icon: /* @__PURE__ */ p(Je, {
589
- className: ae,
590
- "aria-hidden": "true"
591
- }),
592
- disabled: V,
593
- className: n(le, "zui:text-[var(--zui-theme-text-primary)]"),
594
- onClick: () => void Kt(e, r, i)
595
- }) : null,
596
- I.map((t, a) => /* @__PURE__ */ p(c, {
597
- "data-slot": "table-action-custom-button",
598
- label: t.tooltip,
599
- icon: t.icon,
600
- disabled: V,
601
- className: n(le, "zui:text-[var(--zui-theme-text-primary)]"),
602
- onClick: () => void Jt(t, e, r, i)
603
- }, `${t.tooltip}-${a}`)),
604
- N ? /* @__PURE__ */ p(c, {
605
- "data-slot": "table-action-delete-button",
606
- label: C.common.delete,
607
- icon: /* @__PURE__ */ p($e, {
608
- className: ae,
609
- "aria-hidden": "true"
610
- }),
611
- disabled: V,
612
- className: n(le, "zui:text-[var(--zui-theme-status-danger)]"),
613
- onClick: () => void qt(e, r, i)
614
- }) : null
615
- ]
616
- })
617
- }) : null
618
- ] }, s);
619
- }), kn ? /* @__PURE__ */ p(Ne, {
620
- count: Pn,
616
+ }),
617
+ z ? /* @__PURE__ */ p(u, {
618
+ align: "center",
619
+ "data-cell": "actions",
620
+ className: n(oe, se),
621
+ children: /* @__PURE__ */ m("div", {
622
+ "data-slot": "table-row-actions",
623
+ className: "zui:flex zui:items-center zui:justify-center zui:gap-0.5",
624
+ children: [
625
+ M ? /* @__PURE__ */ p(s, {
626
+ "data-slot": "table-action-edit-button",
627
+ label: S.common.edit,
628
+ icon: /* @__PURE__ */ p(Xe, {
629
+ className: ae,
630
+ "aria-hidden": "true"
631
+ }),
632
+ disabled: V,
633
+ className: n(le, "zui:text-[var(--zui-theme-text-primary)]"),
634
+ onClick: () => void $t(e, r, i)
635
+ }) : null,
636
+ I.map((t, a) => /* @__PURE__ */ p(s, {
637
+ "data-slot": "table-action-custom-button",
638
+ label: t.tooltip,
639
+ icon: t.icon,
640
+ disabled: V || t.disabled,
641
+ className: n(le, t.danger ? "zui:text-[var(--zui-theme-status-danger)]" : "zui:text-[var(--zui-theme-text-primary)]", t.className),
642
+ onClick: () => void nn(t, e, r, i)
643
+ }, `${t.tooltip}-${a}`)),
644
+ N ? /* @__PURE__ */ p(s, {
645
+ "data-slot": "table-action-delete-button",
646
+ label: S.common.delete,
647
+ icon: /* @__PURE__ */ p(tt, {
648
+ className: ae,
649
+ "aria-hidden": "true"
650
+ }),
651
+ disabled: V,
652
+ className: n(le, "zui:text-[var(--zui-theme-status-danger)]"),
653
+ onClick: () => void en(e, r, i)
654
+ }) : null
655
+ ]
656
+ })
657
+ }) : null
658
+ ]
659
+ }, o);
660
+ }), Ln ? /* @__PURE__ */ p(Fe, {
661
+ count: Hn,
621
662
  keyPrefix: "infinite-loading",
622
663
  showRowNumbers: R,
623
- columns: k,
624
- actionsCount: Fn
664
+ columns: O,
665
+ actionsCount: Un
625
666
  }) : null] }) })
626
667
  ] })
627
668
  })
628
669
  }),
629
- O && z ? /* @__PURE__ */ p(o, {
630
- open: Ht.open,
631
- onOpenChange: (e) => Ut((t) => ({
670
+ D && (Nt || E) ? /* @__PURE__ */ p(a, {
671
+ open: Yt.open,
672
+ onOpenChange: (e) => Xt((t) => ({
632
673
  ...t,
633
674
  open: e
634
675
  })),
635
- actions: Ht.actions,
636
- label: C.table.actions
676
+ actions: Yt.actions,
677
+ label: S.table.actions
637
678
  }) : null,
638
- /* @__PURE__ */ p(Oe, {
639
- shouldRenderInfiniteMode: gn,
640
- shouldShowInfiniteLoadingStatus: jn,
641
- shouldShowInfiniteReadyStatus: Mn,
642
- shouldShowInfiniteCompletedStatus: Nn,
643
- shouldRenderPagination: hn,
679
+ /* @__PURE__ */ p(Ae, {
680
+ shouldRenderInfiniteMode: wn,
681
+ shouldShowInfiniteLoadingStatus: zn,
682
+ shouldShowInfiniteReadyStatus: Bn,
683
+ shouldShowInfiniteCompletedStatus: Vn,
684
+ shouldRenderPagination: Cn,
644
685
  loading: h,
645
686
  isRowActionBusy: V,
646
- currentPage: dn,
647
- totalPages: fn,
648
- onPageChange: Sn
687
+ currentPage: yn,
688
+ totalPages: bn,
689
+ onPageChange: An
649
690
  })
650
691
  ]
651
692
  });
652
693
  });
653
- et.displayName = "Table";
694
+ nt.displayName = "Table";
654
695
  //#endregion
655
- export { et as default };
696
+ export { nt as default };