@devalok/shilp-sutra 0.15.0 → 0.16.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.
- package/dist/composed/activity-feed.d.ts +26 -0
- package/dist/composed/activity-feed.d.ts.map +1 -0
- package/dist/composed/activity-feed.js +132 -0
- package/dist/composed/empty-state.d.ts +2 -0
- package/dist/composed/empty-state.d.ts.map +1 -1
- package/dist/composed/empty-state.js +30 -24
- package/dist/composed/index.d.ts +4 -0
- package/dist/composed/index.d.ts.map +1 -1
- package/dist/composed/index.js +31 -26
- package/dist/composed/upload-progress.d.ts +33 -0
- package/dist/composed/upload-progress.d.ts.map +1 -0
- package/dist/composed/upload-progress.js +386 -0
- package/dist/shell/bottom-navbar.d.ts +2 -0
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +70 -52
- package/dist/shell/sidebar.d.ts +2 -0
- package/dist/shell/sidebar.d.ts.map +1 -1
- package/dist/shell/sidebar.js +99 -98
- package/dist/ui/data-table.d.ts +35 -1
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +453 -292
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +143 -136
- package/dist/ui/skeleton.d.ts +44 -1
- package/dist/ui/skeleton.d.ts.map +1 -1
- package/dist/ui/skeleton.js +209 -14
- package/dist/ui/stat-card.d.ts +20 -0
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +173 -37
- package/llms-full.txt +84 -2
- package/llms.txt +7 -0
- package/package.json +1 -1
package/dist/ui/data-table.js
CHANGED
|
@@ -1,43 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { useReactTable as
|
|
5
|
-
import { useVirtualizer as
|
|
6
|
-
import { IconArrowUp as
|
|
7
|
-
import { Table as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
2
|
+
import { jsxs as d, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import Pe, { useState as u, useRef as B, useEffect as D, useCallback as V, useMemo as et } from "react";
|
|
4
|
+
import { useReactTable as tt, getExpandedRowModel as lt, getPaginationRowModel as nt, getFilteredRowModel as ot, getSortedRowModel as st, getCoreRowModel as at, flexRender as ee } from "@tanstack/react-table";
|
|
5
|
+
import { useVirtualizer as rt } from "@tanstack/react-virtual";
|
|
6
|
+
import { IconArrowUp as ct, IconArrowDown as dt, IconArrowsSort as it, IconSearch as ut, IconChevronLeft as mt, IconChevronRight as ye, IconX as ft } from "@tabler/icons-react";
|
|
7
|
+
import { Table as gt, TableHeader as ht, TableRow as z, TableHead as Se, TableBody as H, TableCell as O } from "./table.js";
|
|
8
|
+
import { B as pt } from "../_chunks/button.js";
|
|
9
|
+
import { C as Ce } from "../_chunks/checkbox.js";
|
|
10
|
+
import { Skeleton as Ne } from "./skeleton.js";
|
|
11
|
+
import { c as a } from "../_chunks/utils.js";
|
|
12
|
+
import { DataTableToolbar as bt } from "./data-table-toolbar.js";
|
|
13
|
+
const xt = {
|
|
12
14
|
compact: "py-ds-02",
|
|
13
15
|
standard: "py-ds-05",
|
|
14
16
|
comfortable: "py-ds-07"
|
|
15
17
|
};
|
|
16
|
-
function
|
|
17
|
-
initialValue:
|
|
18
|
-
onSave:
|
|
19
|
-
onCancel:
|
|
18
|
+
function yt({
|
|
19
|
+
initialValue: A,
|
|
20
|
+
onSave: m,
|
|
21
|
+
onCancel: K
|
|
20
22
|
}) {
|
|
21
|
-
const [
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
(
|
|
23
|
+
const [I, S] = u(A), h = B(null);
|
|
24
|
+
D(() => {
|
|
25
|
+
var i, E;
|
|
26
|
+
(i = h.current) == null || i.focus(), (E = h.current) == null || E.select();
|
|
25
27
|
}, []);
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
return /* @__PURE__ */
|
|
28
|
+
const p = V(() => {
|
|
29
|
+
m(I);
|
|
30
|
+
}, [m, I]);
|
|
31
|
+
return /* @__PURE__ */ n(
|
|
30
32
|
"input",
|
|
31
33
|
{
|
|
32
|
-
ref:
|
|
34
|
+
ref: h,
|
|
33
35
|
type: "text",
|
|
34
|
-
value:
|
|
35
|
-
onChange: (
|
|
36
|
-
onBlur:
|
|
37
|
-
onKeyDown: (
|
|
38
|
-
|
|
36
|
+
value: I,
|
|
37
|
+
onChange: (i) => S(i.target.value),
|
|
38
|
+
onBlur: p,
|
|
39
|
+
onKeyDown: (i) => {
|
|
40
|
+
i.key === "Enter" ? (i.preventDefault(), p()) : i.key === "Escape" && (i.preventDefault(), K());
|
|
39
41
|
},
|
|
40
|
-
className:
|
|
42
|
+
className: a(
|
|
41
43
|
"h-ds-xs-plus w-full rounded-ds-md",
|
|
42
44
|
"border border-border-interactive bg-field",
|
|
43
45
|
"px-ds-02 text-ds-sm",
|
|
@@ -48,40 +50,97 @@ function Be({
|
|
|
48
50
|
}
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
53
|
+
const St = 'button, a, input, select, textarea, [role="checkbox"]';
|
|
54
|
+
function Ct({
|
|
55
|
+
columns: A,
|
|
56
|
+
data: m,
|
|
57
|
+
className: K,
|
|
58
|
+
noResultsText: I,
|
|
59
|
+
sortable: S = !1,
|
|
60
|
+
filterable: h = !1,
|
|
61
|
+
globalFilter: p = !1,
|
|
62
|
+
paginated: i = !1,
|
|
63
|
+
pageSize: E,
|
|
64
|
+
pageSizeOptions: we,
|
|
65
|
+
selectable: C = !1,
|
|
66
|
+
onSelectionChange: G,
|
|
67
|
+
toolbar: te = !1,
|
|
68
|
+
density: ke = "standard",
|
|
69
|
+
columnPinning: N,
|
|
70
|
+
editable: Re = !1,
|
|
71
|
+
onCellEdit: L,
|
|
72
|
+
expandable: j = !1,
|
|
73
|
+
renderExpanded: le,
|
|
74
|
+
virtualRows: b = !1,
|
|
75
|
+
virtualRowHeight: ze = 48,
|
|
76
|
+
maxHeight: De = 600,
|
|
77
|
+
onSort: T,
|
|
78
|
+
emptyState: ne,
|
|
79
|
+
loading: Ie = !1,
|
|
80
|
+
selectedIds: Y,
|
|
81
|
+
selectableFilter: oe,
|
|
82
|
+
getRowId: g,
|
|
83
|
+
pagination: o,
|
|
84
|
+
singleExpand: U = !1,
|
|
85
|
+
stickyHeader: Ee = !1,
|
|
86
|
+
onRowClick: F,
|
|
87
|
+
bulkActions: $
|
|
74
88
|
}) {
|
|
75
|
-
const [
|
|
76
|
-
pageIndex: 0,
|
|
77
|
-
pageSize:
|
|
78
|
-
}), [
|
|
79
|
-
left: (
|
|
80
|
-
right: (
|
|
81
|
-
}), [
|
|
89
|
+
const [Te, se] = u([]), [Fe, Me] = u([]), [W, X] = u(""), [Ve, q] = u({
|
|
90
|
+
pageIndex: o ? o.page - 1 : 0,
|
|
91
|
+
pageSize: (o == null ? void 0 : o.pageSize) ?? E ?? 10
|
|
92
|
+
}), [x, ae] = u({}), [je, $e] = u({}), [re, _e] = u({
|
|
93
|
+
left: (N == null ? void 0 : N.left) ?? [],
|
|
94
|
+
right: (N == null ? void 0 : N.right) ?? []
|
|
95
|
+
}), [ce, He] = u(ke), [w, J] = u(null), [Oe, de] = u({}), ie = B(null);
|
|
96
|
+
D(() => {
|
|
97
|
+
if (Y) {
|
|
98
|
+
const e = {};
|
|
99
|
+
Y.forEach((t) => {
|
|
100
|
+
e[t] = !0;
|
|
101
|
+
}), ae(e);
|
|
102
|
+
}
|
|
103
|
+
}, [Y]), D(() => {
|
|
104
|
+
o && q((e) => ({
|
|
105
|
+
...e,
|
|
106
|
+
pageIndex: o.page - 1,
|
|
107
|
+
pageSize: o.pageSize
|
|
108
|
+
}));
|
|
109
|
+
}, [o == null ? void 0 : o.page, o == null ? void 0 : o.pageSize]);
|
|
110
|
+
const Be = V(
|
|
111
|
+
(e) => {
|
|
112
|
+
se((t) => {
|
|
113
|
+
const l = typeof e == "function" ? e(t) : e;
|
|
114
|
+
return T && (l.length === 0 && t.length > 0 ? T(t[0].id, !1) : l.length > 0 && T(l[0].id, l[0].desc ? "desc" : "asc")), l;
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
[T]
|
|
118
|
+
), Ae = V(
|
|
119
|
+
(e) => {
|
|
120
|
+
de((t) => {
|
|
121
|
+
const l = typeof e == "function" ? e(t) : e;
|
|
122
|
+
if (!U || l === !0 || typeof l != "object") return l;
|
|
123
|
+
const s = typeof t == "object" ? Object.keys(t).filter((f) => t[f]) : [], R = Object.keys(l).filter((f) => l[f]).filter((f) => !s.includes(f));
|
|
124
|
+
return R.length > 0 ? { [R[R.length - 1]]: !0 } : l;
|
|
125
|
+
});
|
|
126
|
+
},
|
|
127
|
+
[U]
|
|
128
|
+
), Q = B(o == null ? void 0 : o.onPageChange);
|
|
129
|
+
D(() => {
|
|
130
|
+
Q.current = o == null ? void 0 : o.onPageChange;
|
|
131
|
+
}, [o == null ? void 0 : o.onPageChange]);
|
|
132
|
+
const Ke = V(
|
|
133
|
+
(e) => {
|
|
134
|
+
q((t) => {
|
|
135
|
+
const l = typeof e == "function" ? e(t) : e;
|
|
136
|
+
return Q.current && l.pageIndex !== t.pageIndex && Q.current(l.pageIndex + 1), l;
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
[]
|
|
140
|
+
), Ge = {
|
|
82
141
|
id: "_select",
|
|
83
|
-
header: ({ table: e }) => /* @__PURE__ */
|
|
84
|
-
|
|
142
|
+
header: ({ table: e }) => /* @__PURE__ */ n(
|
|
143
|
+
Ce,
|
|
85
144
|
{
|
|
86
145
|
checked: e.getIsAllPageRowsSelected(),
|
|
87
146
|
indeterminate: e.getIsSomePageRowsSelected(),
|
|
@@ -89,10 +148,11 @@ function Ge({
|
|
|
89
148
|
"aria-label": "Select all rows"
|
|
90
149
|
}
|
|
91
150
|
),
|
|
92
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
93
|
-
|
|
151
|
+
cell: ({ row: e }) => /* @__PURE__ */ n(
|
|
152
|
+
Ce,
|
|
94
153
|
{
|
|
95
154
|
checked: e.getIsSelected(),
|
|
155
|
+
disabled: !e.getCanSelect(),
|
|
96
156
|
onCheckedChange: (t) => e.toggleSelected(!!t),
|
|
97
157
|
"aria-label": "Select row"
|
|
98
158
|
}
|
|
@@ -100,21 +160,21 @@ function Ge({
|
|
|
100
160
|
enableSorting: !1,
|
|
101
161
|
enableColumnFilter: !1,
|
|
102
162
|
enableHiding: !1
|
|
103
|
-
},
|
|
163
|
+
}, Le = {
|
|
104
164
|
id: "_expand",
|
|
105
165
|
header: () => null,
|
|
106
|
-
cell: ({ row: e }) => /* @__PURE__ */
|
|
166
|
+
cell: ({ row: e }) => /* @__PURE__ */ n(
|
|
107
167
|
"button",
|
|
108
168
|
{
|
|
109
169
|
type: "button",
|
|
110
170
|
onClick: () => e.toggleExpanded(),
|
|
111
171
|
"aria-label": e.getIsExpanded() ? "Collapse row" : "Expand row",
|
|
112
172
|
className: "flex items-center justify-center p-ds-01 rounded-ds-sm hover:bg-layer-02 transition-colors",
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
|
|
173
|
+
children: /* @__PURE__ */ n(
|
|
174
|
+
ye,
|
|
115
175
|
{
|
|
116
176
|
size: 16,
|
|
117
|
-
className:
|
|
177
|
+
className: a(
|
|
118
178
|
"transition-transform duration-moderate-02",
|
|
119
179
|
e.getIsExpanded() && "rotate-90"
|
|
120
180
|
),
|
|
@@ -126,280 +186,336 @@ function Ge({
|
|
|
126
186
|
enableSorting: !1,
|
|
127
187
|
enableColumnFilter: !1,
|
|
128
188
|
enableHiding: !1
|
|
129
|
-
},
|
|
130
|
-
...
|
|
131
|
-
...
|
|
132
|
-
...
|
|
133
|
-
],
|
|
134
|
-
columnVisibility:
|
|
135
|
-
columnPinning:
|
|
189
|
+
}, k = [
|
|
190
|
+
...C ? [Ge] : [],
|
|
191
|
+
...j ? [Le] : [],
|
|
192
|
+
...A
|
|
193
|
+
], M = !!o, Z = i || M, y = {
|
|
194
|
+
columnVisibility: je,
|
|
195
|
+
columnPinning: re
|
|
136
196
|
};
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
data:
|
|
140
|
-
columns:
|
|
141
|
-
state:
|
|
142
|
-
onColumnVisibilityChange:
|
|
143
|
-
onColumnPinningChange:
|
|
144
|
-
getCoreRowModel:
|
|
145
|
-
...
|
|
146
|
-
onSortingChange:
|
|
147
|
-
getSortedRowModel:
|
|
197
|
+
S && (y.sorting = Te), (h || p) && (y.columnFilters = Fe, y.globalFilter = W), Z && (y.pagination = Ve), C && (y.rowSelection = x), j && (y.expanded = Oe);
|
|
198
|
+
const ue = S && !!T, r = tt({
|
|
199
|
+
data: m,
|
|
200
|
+
columns: k,
|
|
201
|
+
state: y,
|
|
202
|
+
onColumnVisibilityChange: $e,
|
|
203
|
+
onColumnPinningChange: _e,
|
|
204
|
+
getCoreRowModel: at(),
|
|
205
|
+
...S && {
|
|
206
|
+
onSortingChange: ue ? Be : se,
|
|
207
|
+
...ue ? { manualSorting: !0 } : { getSortedRowModel: st() }
|
|
208
|
+
},
|
|
209
|
+
...(h || p) && {
|
|
210
|
+
onColumnFiltersChange: Me,
|
|
211
|
+
onGlobalFilterChange: X,
|
|
212
|
+
getFilteredRowModel: ot()
|
|
148
213
|
},
|
|
149
|
-
...
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
214
|
+
...Z && {
|
|
215
|
+
onPaginationChange: M ? Ke : q,
|
|
216
|
+
...M ? {
|
|
217
|
+
manualPagination: !0,
|
|
218
|
+
pageCount: Math.ceil(
|
|
219
|
+
o.total / o.pageSize
|
|
220
|
+
)
|
|
221
|
+
} : { getPaginationRowModel: nt() }
|
|
153
222
|
},
|
|
154
|
-
...
|
|
155
|
-
|
|
156
|
-
|
|
223
|
+
...C && {
|
|
224
|
+
onRowSelectionChange: ae,
|
|
225
|
+
enableRowSelection: oe ? (e) => oe(e.original) : !0
|
|
157
226
|
},
|
|
158
|
-
...
|
|
159
|
-
|
|
160
|
-
|
|
227
|
+
...j && {
|
|
228
|
+
onExpandedChange: U ? Ae : de,
|
|
229
|
+
getExpandedRowModel: lt()
|
|
161
230
|
},
|
|
162
|
-
...
|
|
163
|
-
|
|
164
|
-
getExpandedRowModel: Ie()
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
Q(() => {
|
|
168
|
-
if (R) {
|
|
169
|
-
const e = n.getFilteredSelectedRowModel().rows.map((t) => t.original);
|
|
170
|
-
R(e);
|
|
231
|
+
...g && {
|
|
232
|
+
getRowId: (e) => g(e)
|
|
171
233
|
}
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
234
|
+
}), v = B(G);
|
|
235
|
+
D(() => {
|
|
236
|
+
v.current = G;
|
|
237
|
+
}, [G]), D(() => {
|
|
238
|
+
if (!v.current) return;
|
|
239
|
+
const e = Object.keys(x).filter((l) => x[l]), t = m.filter((l, s) => {
|
|
240
|
+
const c = g ? g(m[s]) : String(s);
|
|
241
|
+
return e.includes(c);
|
|
242
|
+
});
|
|
243
|
+
v.current(t);
|
|
244
|
+
}, [x, m, g]);
|
|
245
|
+
function me(e) {
|
|
246
|
+
const { left: t = [], right: l = [] } = re, s = t.indexOf(e), c = l.indexOf(e);
|
|
247
|
+
return s !== -1 ? {
|
|
176
248
|
className: "sticky bg-layer-01 z-raised",
|
|
177
249
|
style: { left: 0 }
|
|
178
|
-
} :
|
|
250
|
+
} : c !== -1 ? {
|
|
179
251
|
className: "sticky bg-layer-01 z-raised",
|
|
180
252
|
style: { right: 0 }
|
|
181
253
|
} : { className: "", style: {} };
|
|
182
254
|
}
|
|
183
|
-
function
|
|
184
|
-
if (!
|
|
185
|
-
const t =
|
|
255
|
+
function Ye(e) {
|
|
256
|
+
if (!Re || e === "_select" || e === "_expand") return !1;
|
|
257
|
+
const t = r.getColumn(e);
|
|
186
258
|
if (!t) return !1;
|
|
187
|
-
const
|
|
188
|
-
return (
|
|
259
|
+
const l = t.columnDef.meta;
|
|
260
|
+
return (l == null ? void 0 : l.enableEditing) !== !1;
|
|
189
261
|
}
|
|
190
|
-
const
|
|
191
|
-
count:
|
|
192
|
-
getScrollElement: () =>
|
|
193
|
-
estimateSize: () =>
|
|
262
|
+
const fe = xt[ce], _ = r.getRowModel().rows, ge = rt({
|
|
263
|
+
count: b ? _.length : 0,
|
|
264
|
+
getScrollElement: () => ie.current,
|
|
265
|
+
estimateSize: () => ze,
|
|
194
266
|
overscan: 10
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
267
|
+
}), Ue = (o == null ? void 0 : o.pageSize) ?? E ?? 5, We = k.length, Xe = V(
|
|
268
|
+
(e, t) => {
|
|
269
|
+
!F || t.target.closest(St) || F(e);
|
|
270
|
+
},
|
|
271
|
+
[F]
|
|
272
|
+
);
|
|
273
|
+
function he(e, t) {
|
|
274
|
+
const l = e.getVisibleCells();
|
|
275
|
+
return /* @__PURE__ */ n(
|
|
276
|
+
z,
|
|
200
277
|
{
|
|
201
278
|
"data-state": e.getIsSelected() && "selected",
|
|
202
279
|
style: t,
|
|
203
|
-
className:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
280
|
+
className: a(
|
|
281
|
+
b ? "absolute w-full flex" : void 0,
|
|
282
|
+
F && "cursor-pointer"
|
|
283
|
+
),
|
|
284
|
+
onClick: F ? (s) => Xe(e.original, s) : void 0,
|
|
285
|
+
children: l.map((s) => {
|
|
286
|
+
const c = me(s.column.id), R = (w == null ? void 0 : w.rowIndex) === e.index && (w == null ? void 0 : w.columnId) === s.column.id;
|
|
287
|
+
return /* @__PURE__ */ n(
|
|
288
|
+
O,
|
|
208
289
|
{
|
|
209
|
-
className:
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
290
|
+
className: a(
|
|
291
|
+
fe,
|
|
292
|
+
c.className,
|
|
293
|
+
b && "flex-1"
|
|
213
294
|
),
|
|
214
|
-
style:
|
|
295
|
+
style: c.style,
|
|
215
296
|
onDoubleClick: () => {
|
|
216
|
-
|
|
297
|
+
Ye(s.column.id) && J({
|
|
217
298
|
rowIndex: e.index,
|
|
218
|
-
columnId:
|
|
299
|
+
columnId: s.column.id
|
|
219
300
|
});
|
|
220
301
|
},
|
|
221
|
-
children:
|
|
222
|
-
|
|
302
|
+
children: R ? /* @__PURE__ */ n(
|
|
303
|
+
yt,
|
|
223
304
|
{
|
|
224
|
-
initialValue: String(
|
|
225
|
-
onSave: (
|
|
226
|
-
|
|
305
|
+
initialValue: String(s.getValue() ?? ""),
|
|
306
|
+
onSave: (f) => {
|
|
307
|
+
L == null || L(e.index, s.column.id, f), J(null);
|
|
227
308
|
},
|
|
228
|
-
onCancel: () =>
|
|
309
|
+
onCancel: () => J(null)
|
|
229
310
|
}
|
|
230
|
-
) :
|
|
311
|
+
) : ee(s.column.columnDef.cell, s.getContext())
|
|
231
312
|
},
|
|
232
|
-
|
|
313
|
+
s.id
|
|
233
314
|
);
|
|
234
315
|
})
|
|
235
316
|
},
|
|
236
317
|
e.id
|
|
237
318
|
);
|
|
238
319
|
}
|
|
239
|
-
function
|
|
240
|
-
return !
|
|
241
|
-
|
|
320
|
+
function qe(e, t) {
|
|
321
|
+
return !j || !e.getIsExpanded() || !le ? null : /* @__PURE__ */ n(
|
|
322
|
+
z,
|
|
242
323
|
{
|
|
243
324
|
style: t,
|
|
244
|
-
className:
|
|
245
|
-
children: /* @__PURE__ */
|
|
246
|
-
|
|
325
|
+
className: b ? "absolute w-full flex" : void 0,
|
|
326
|
+
children: /* @__PURE__ */ n(
|
|
327
|
+
O,
|
|
247
328
|
{
|
|
248
|
-
colSpan:
|
|
249
|
-
className:
|
|
329
|
+
colSpan: k.length,
|
|
330
|
+
className: a(
|
|
250
331
|
"bg-layer-02 p-ds-05",
|
|
251
|
-
|
|
332
|
+
b && "flex-1"
|
|
252
333
|
),
|
|
253
|
-
children:
|
|
334
|
+
children: le(e.original)
|
|
254
335
|
}
|
|
255
336
|
)
|
|
256
337
|
},
|
|
257
338
|
`${e.id}-expanded`
|
|
258
339
|
);
|
|
259
340
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
341
|
+
function Je() {
|
|
342
|
+
const e = ["w-3/4", "w-1/2", "w-2/3", "w-full"];
|
|
343
|
+
return /* @__PURE__ */ n(H, { children: Array.from({ length: Ue }, (t, l) => /* @__PURE__ */ n(z, { children: Array.from({ length: We }, (s, c) => {
|
|
344
|
+
var be, xe;
|
|
345
|
+
const f = (((be = k[c]) == null ? void 0 : be.id) ?? ((xe = k[c]) == null ? void 0 : xe.header)) === "_select";
|
|
346
|
+
return /* @__PURE__ */ n(
|
|
347
|
+
O,
|
|
264
348
|
{
|
|
265
|
-
|
|
266
|
-
className: "h-
|
|
267
|
-
|
|
349
|
+
className: fe,
|
|
350
|
+
children: f ? /* @__PURE__ */ n(Ne, { variant: "text", className: "h-4 w-4", animation: "pulse" }) : /* @__PURE__ */ n(Ne, { variant: "text", className: a("h-4", e[c % e.length]), animation: "pulse" })
|
|
351
|
+
},
|
|
352
|
+
`skeleton-${l}-${c}`
|
|
353
|
+
);
|
|
354
|
+
}) }, `skeleton-${l}`)) });
|
|
355
|
+
}
|
|
356
|
+
function Qe() {
|
|
357
|
+
if (Ie)
|
|
358
|
+
return Je();
|
|
359
|
+
if (!_.length)
|
|
360
|
+
return /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(z, { children: /* @__PURE__ */ n(
|
|
361
|
+
O,
|
|
362
|
+
{
|
|
363
|
+
colSpan: k.length,
|
|
364
|
+
className: a(
|
|
365
|
+
"h-24 text-center",
|
|
366
|
+
!ne && "text-text-tertiary"
|
|
367
|
+
),
|
|
368
|
+
children: ne || I || "No results."
|
|
268
369
|
}
|
|
269
370
|
) }) });
|
|
270
|
-
if (
|
|
271
|
-
const e =
|
|
272
|
-
return /* @__PURE__ */
|
|
273
|
-
|
|
371
|
+
if (b) {
|
|
372
|
+
const e = ge.getVirtualItems(), t = ge.getTotalSize();
|
|
373
|
+
return /* @__PURE__ */ n(
|
|
374
|
+
H,
|
|
274
375
|
{
|
|
275
376
|
style: {
|
|
276
377
|
height: `${t}px`,
|
|
277
378
|
position: "relative"
|
|
278
379
|
},
|
|
279
|
-
children: e.map((
|
|
280
|
-
const
|
|
281
|
-
return
|
|
380
|
+
children: e.map((l) => {
|
|
381
|
+
const s = _[l.index];
|
|
382
|
+
return he(s, {
|
|
282
383
|
position: "absolute",
|
|
283
384
|
top: 0,
|
|
284
385
|
left: 0,
|
|
285
386
|
width: "100%",
|
|
286
|
-
height: `${
|
|
287
|
-
transform: `translateY(${
|
|
387
|
+
height: `${l.size}px`,
|
|
388
|
+
transform: `translateY(${l.start}px)`
|
|
288
389
|
});
|
|
289
390
|
})
|
|
290
391
|
}
|
|
291
392
|
);
|
|
292
393
|
}
|
|
293
|
-
return /* @__PURE__ */
|
|
294
|
-
|
|
295
|
-
|
|
394
|
+
return /* @__PURE__ */ n(H, { children: _.map((e) => /* @__PURE__ */ d(Pe.Fragment, { children: [
|
|
395
|
+
he(e),
|
|
396
|
+
qe(e)
|
|
296
397
|
] }, e.id)) });
|
|
297
398
|
}
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
399
|
+
const P = et(() => {
|
|
400
|
+
if (!$ || !C) return [];
|
|
401
|
+
const e = Object.keys(x).filter((t) => x[t]);
|
|
402
|
+
return m.filter((t, l) => {
|
|
403
|
+
const s = g ? g(m[l]) : String(l);
|
|
404
|
+
return e.includes(s);
|
|
405
|
+
});
|
|
406
|
+
}, [$, C, x, m, g]), Ze = P.length > 0, ve = M ? o.total : r.getFilteredRowModel().rows.length, pe = /* @__PURE__ */ d(gt, { children: [
|
|
407
|
+
/* @__PURE__ */ d(
|
|
408
|
+
ht,
|
|
409
|
+
{
|
|
410
|
+
className: a(
|
|
411
|
+
Ee && "sticky top-0 z-10 bg-surface"
|
|
412
|
+
),
|
|
413
|
+
children: [
|
|
414
|
+
r.getHeaderGroups().map((e) => /* @__PURE__ */ n(z, { children: e.headers.map((t) => {
|
|
415
|
+
const l = S && t.column.getCanSort(), s = t.column.getIsSorted(), c = me(t.column.id);
|
|
416
|
+
return /* @__PURE__ */ n(
|
|
417
|
+
Se,
|
|
309
418
|
{
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
"
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
t.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
419
|
+
className: c.className,
|
|
420
|
+
style: c.style,
|
|
421
|
+
children: t.isPlaceholder ? null : l ? /* @__PURE__ */ d(
|
|
422
|
+
"button",
|
|
423
|
+
{
|
|
424
|
+
type: "button",
|
|
425
|
+
className: a(
|
|
426
|
+
"flex items-center gap-ds-01 font-medium",
|
|
427
|
+
"cursor-pointer select-none",
|
|
428
|
+
"-ml-ds-01 rounded-ds-sm px-ds-01 py-ds-01",
|
|
429
|
+
"hover:bg-layer-02 transition-colors"
|
|
430
|
+
),
|
|
431
|
+
onClick: t.column.getToggleSortingHandler(),
|
|
432
|
+
"aria-label": `Sort by ${typeof t.column.columnDef.header == "string" ? t.column.columnDef.header : t.column.id}`,
|
|
433
|
+
children: [
|
|
434
|
+
ee(
|
|
435
|
+
t.column.columnDef.header,
|
|
436
|
+
t.getContext()
|
|
437
|
+
),
|
|
438
|
+
s === "asc" ? /* @__PURE__ */ n(
|
|
439
|
+
ct,
|
|
440
|
+
{
|
|
441
|
+
className: "h-ico-sm w-ico-sm text-text-secondary",
|
|
442
|
+
"aria-hidden": "true"
|
|
443
|
+
}
|
|
444
|
+
) : s === "desc" ? /* @__PURE__ */ n(
|
|
445
|
+
dt,
|
|
446
|
+
{
|
|
447
|
+
className: "h-ico-sm w-ico-sm text-text-secondary",
|
|
448
|
+
"aria-hidden": "true"
|
|
449
|
+
}
|
|
450
|
+
) : /* @__PURE__ */ n(
|
|
451
|
+
it,
|
|
452
|
+
{
|
|
453
|
+
className: "h-ico-sm w-ico-sm text-text-tertiary",
|
|
454
|
+
"aria-hidden": "true"
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
) : ee(
|
|
460
|
+
t.column.columnDef.header,
|
|
461
|
+
t.getContext()
|
|
462
|
+
)
|
|
463
|
+
},
|
|
464
|
+
t.id
|
|
465
|
+
);
|
|
466
|
+
}) }, e.id)),
|
|
467
|
+
h && r.getHeaderGroups().map((e) => /* @__PURE__ */ n(z, { children: e.headers.map((t) => /* @__PURE__ */ n(Se, { className: "py-ds-01", children: t.isPlaceholder || t.column.columnDef.enableColumnFilter === !1 ? null : /* @__PURE__ */ n(
|
|
468
|
+
"input",
|
|
469
|
+
{
|
|
470
|
+
type: "text",
|
|
471
|
+
value: t.column.getFilterValue() ?? "",
|
|
472
|
+
onChange: (l) => t.column.setFilterValue(l.target.value),
|
|
473
|
+
placeholder: `Filter ${typeof t.column.columnDef.header == "string" ? t.column.columnDef.header : ""}...`,
|
|
474
|
+
"aria-label": `Filter ${typeof t.column.columnDef.header == "string" ? t.column.columnDef.header : t.column.id}`,
|
|
475
|
+
className: a(
|
|
476
|
+
"h-ds-xs-plus w-full rounded-ds-md",
|
|
477
|
+
"border border-border bg-field",
|
|
478
|
+
"px-ds-02 text-ds-sm",
|
|
479
|
+
"text-text-primary placeholder:text-text-placeholder",
|
|
480
|
+
"outline-none focus:border-[var(--color-border-focus)]"
|
|
481
|
+
)
|
|
482
|
+
}
|
|
483
|
+
) }, `${t.id}-filter`)) }, `${e.id}-filters`))
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
),
|
|
487
|
+
Qe()
|
|
372
488
|
] });
|
|
373
|
-
return /* @__PURE__ */
|
|
374
|
-
|
|
375
|
-
|
|
489
|
+
return /* @__PURE__ */ d("div", { className: a(K), children: [
|
|
490
|
+
te && /* @__PURE__ */ n(
|
|
491
|
+
bt,
|
|
376
492
|
{
|
|
377
|
-
table:
|
|
378
|
-
globalFilter:
|
|
379
|
-
globalFilterValue:
|
|
380
|
-
onGlobalFilterChange:
|
|
381
|
-
density:
|
|
382
|
-
onDensityChange:
|
|
493
|
+
table: r,
|
|
494
|
+
globalFilter: p,
|
|
495
|
+
globalFilterValue: W,
|
|
496
|
+
onGlobalFilterChange: X,
|
|
497
|
+
density: ce,
|
|
498
|
+
onDensityChange: He
|
|
383
499
|
}
|
|
384
500
|
),
|
|
385
|
-
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
|
|
501
|
+
p && !te && /* @__PURE__ */ d("div", { className: "flex items-center gap-ds-03 pb-ds-04 border-b border-border-subtle mb-ds-04", children: [
|
|
502
|
+
/* @__PURE__ */ n(
|
|
503
|
+
ut,
|
|
388
504
|
{
|
|
389
505
|
size: 16,
|
|
390
506
|
className: "text-icon-secondary",
|
|
391
507
|
"aria-hidden": "true"
|
|
392
508
|
}
|
|
393
509
|
),
|
|
394
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ n(
|
|
395
511
|
"input",
|
|
396
512
|
{
|
|
397
513
|
type: "text",
|
|
398
|
-
value:
|
|
399
|
-
onChange: (e) =>
|
|
514
|
+
value: W,
|
|
515
|
+
onChange: (e) => X(e.target.value),
|
|
400
516
|
placeholder: "Search all columns...",
|
|
401
517
|
"aria-label": "Search all columns",
|
|
402
|
-
className:
|
|
518
|
+
className: a(
|
|
403
519
|
"flex-1 bg-transparent text-ds-md",
|
|
404
520
|
"text-text-primary placeholder:text-text-placeholder",
|
|
405
521
|
"outline-none"
|
|
@@ -407,86 +523,131 @@ function Ge({
|
|
|
407
523
|
}
|
|
408
524
|
)
|
|
409
525
|
] }),
|
|
410
|
-
|
|
526
|
+
b ? /* @__PURE__ */ n(
|
|
411
527
|
"div",
|
|
412
528
|
{
|
|
413
|
-
ref:
|
|
414
|
-
style: { maxHeight: `${
|
|
415
|
-
children:
|
|
529
|
+
ref: ie,
|
|
530
|
+
style: { maxHeight: `${De}px`, overflowY: "auto" },
|
|
531
|
+
children: pe
|
|
416
532
|
}
|
|
417
|
-
) :
|
|
418
|
-
|
|
419
|
-
/* @__PURE__ */
|
|
420
|
-
|
|
533
|
+
) : pe,
|
|
534
|
+
Z && /* @__PURE__ */ d("div", { className: "flex items-center justify-between px-ds-03 py-ds-04 border-t border-border-subtle", children: [
|
|
535
|
+
/* @__PURE__ */ d("span", { className: "text-ds-sm text-text-secondary", children: [
|
|
536
|
+
ve,
|
|
421
537
|
" total rows"
|
|
422
538
|
] }),
|
|
423
|
-
/* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */
|
|
539
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-ds-03", children: [
|
|
540
|
+
!M && /* @__PURE__ */ n(
|
|
425
541
|
"select",
|
|
426
542
|
{
|
|
427
|
-
value:
|
|
543
|
+
value: r.getState().pagination.pageSize,
|
|
428
544
|
onChange: (e) => {
|
|
429
|
-
|
|
545
|
+
r.setPageSize(Number(e.target.value));
|
|
430
546
|
},
|
|
431
547
|
"aria-label": "Rows per page",
|
|
432
|
-
className:
|
|
548
|
+
className: a(
|
|
433
549
|
"h-ds-sm rounded-ds-md",
|
|
434
550
|
"border border-border bg-field",
|
|
435
551
|
"px-ds-03 text-ds-sm",
|
|
436
552
|
"text-text-primary"
|
|
437
553
|
),
|
|
438
|
-
children: (
|
|
554
|
+
children: (we ?? [10, 20, 50, 100]).map((e) => /* @__PURE__ */ d("option", { value: e, children: [
|
|
439
555
|
e,
|
|
440
556
|
" rows"
|
|
441
557
|
] }, e))
|
|
442
558
|
}
|
|
443
559
|
),
|
|
444
|
-
/* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ n(
|
|
445
561
|
"button",
|
|
446
562
|
{
|
|
447
563
|
type: "button",
|
|
448
|
-
disabled: !
|
|
449
|
-
onClick: () =>
|
|
564
|
+
disabled: !r.getCanPreviousPage(),
|
|
565
|
+
onClick: () => r.previousPage(),
|
|
450
566
|
"aria-label": "Previous page",
|
|
451
|
-
className:
|
|
567
|
+
className: a(
|
|
452
568
|
"h-ds-sm w-ds-sm flex items-center justify-center",
|
|
453
569
|
"rounded-ds-md border border-border",
|
|
454
570
|
"enabled:hover:bg-layer-02",
|
|
455
571
|
"disabled:opacity-[0.38] disabled:cursor-not-allowed",
|
|
456
572
|
"transition-colors"
|
|
457
573
|
),
|
|
458
|
-
children: /* @__PURE__ */
|
|
574
|
+
children: /* @__PURE__ */ n(mt, { size: 16, "aria-hidden": "true" })
|
|
459
575
|
}
|
|
460
576
|
),
|
|
461
|
-
/* @__PURE__ */
|
|
577
|
+
/* @__PURE__ */ d("span", { className: "text-ds-sm text-text-secondary", children: [
|
|
462
578
|
"Page ",
|
|
463
|
-
|
|
579
|
+
r.getState().pagination.pageIndex + 1,
|
|
464
580
|
" of",
|
|
465
581
|
" ",
|
|
466
|
-
|
|
582
|
+
r.getPageCount()
|
|
467
583
|
] }),
|
|
468
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ n(
|
|
469
585
|
"button",
|
|
470
586
|
{
|
|
471
587
|
type: "button",
|
|
472
|
-
disabled: !
|
|
473
|
-
onClick: () =>
|
|
588
|
+
disabled: !r.getCanNextPage(),
|
|
589
|
+
onClick: () => r.nextPage(),
|
|
474
590
|
"aria-label": "Next page",
|
|
475
|
-
className:
|
|
591
|
+
className: a(
|
|
476
592
|
"h-ds-sm w-ds-sm flex items-center justify-center",
|
|
477
593
|
"rounded-ds-md border border-border",
|
|
478
594
|
"enabled:hover:bg-layer-02",
|
|
479
595
|
"disabled:opacity-[0.38] disabled:cursor-not-allowed",
|
|
480
596
|
"transition-colors"
|
|
481
597
|
),
|
|
482
|
-
children: /* @__PURE__ */
|
|
598
|
+
children: /* @__PURE__ */ n(ye, { size: 16, "aria-hidden": "true" })
|
|
483
599
|
}
|
|
484
600
|
)
|
|
485
601
|
] })
|
|
486
|
-
] })
|
|
602
|
+
] }),
|
|
603
|
+
$ && C && Ze && /* @__PURE__ */ d(
|
|
604
|
+
"div",
|
|
605
|
+
{
|
|
606
|
+
className: a(
|
|
607
|
+
"fixed bottom-6 left-1/2 -translate-x-1/2 z-50",
|
|
608
|
+
"flex items-center gap-ds-04 px-ds-05 py-ds-03",
|
|
609
|
+
"rounded-ds-lg border border-border bg-surface shadow-lg",
|
|
610
|
+
"animate-in slide-in-from-bottom-2"
|
|
611
|
+
),
|
|
612
|
+
role: "toolbar",
|
|
613
|
+
"aria-label": "Bulk actions",
|
|
614
|
+
children: [
|
|
615
|
+
/* @__PURE__ */ d("span", { className: "text-ds-sm font-medium text-text-primary whitespace-nowrap", children: [
|
|
616
|
+
P.length,
|
|
617
|
+
" selected"
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ n("div", { className: "h-5 w-px bg-border", "aria-hidden": "true" }),
|
|
620
|
+
$.map((e) => /* @__PURE__ */ n(
|
|
621
|
+
pt,
|
|
622
|
+
{
|
|
623
|
+
size: "sm",
|
|
624
|
+
variant: e.color === "error" ? "destructive" : "outline",
|
|
625
|
+
disabled: e.disabled,
|
|
626
|
+
onClick: () => e.onClick(P),
|
|
627
|
+
children: e.label
|
|
628
|
+
},
|
|
629
|
+
e.label
|
|
630
|
+
)),
|
|
631
|
+
/* @__PURE__ */ n(
|
|
632
|
+
"button",
|
|
633
|
+
{
|
|
634
|
+
type: "button",
|
|
635
|
+
onClick: () => r.resetRowSelection(),
|
|
636
|
+
"aria-label": "Clear selection",
|
|
637
|
+
className: a(
|
|
638
|
+
"flex items-center justify-center p-ds-01",
|
|
639
|
+
"rounded-ds-sm hover:bg-layer-02 transition-colors",
|
|
640
|
+
"text-text-secondary hover:text-text-primary"
|
|
641
|
+
),
|
|
642
|
+
children: /* @__PURE__ */ n(ft, { size: 16, "aria-hidden": "true" })
|
|
643
|
+
}
|
|
644
|
+
)
|
|
645
|
+
]
|
|
646
|
+
}
|
|
647
|
+
)
|
|
487
648
|
] });
|
|
488
649
|
}
|
|
489
|
-
|
|
650
|
+
Ct.displayName = "DataTable";
|
|
490
651
|
export {
|
|
491
|
-
|
|
652
|
+
Ct as DataTable
|
|
492
653
|
};
|