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