@brightlocal/ui-components 2.26.0 → 3.0.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/README.md +9 -2
- package/component-meta.json +4010 -255
- package/deprecations.json +189 -2
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +155 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/progress-state.d.ts +121 -0
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/progress-state.js +368 -0
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +297 -296
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +44 -40
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +23 -23
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +23 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +94 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +183 -183
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +47 -44
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +4 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +143 -141
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +74 -77
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +182 -13
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +462 -314
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +29 -25
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +58 -6
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +278 -194
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +523 -494
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +51 -51
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +10 -8
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +8 -6
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +52 -20
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +87 -81
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +127 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +189 -98
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +37 -3
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +102 -64
- package/dist/route-progress.cjs +1 -0
- package/dist/route-progress.d.ts +103 -0
- package/dist/route-progress.d.ts.map +1 -0
- package/dist/route-progress.js +106 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -18
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +35 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +103 -66
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -36
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +57 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +35 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +23 -22
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +36 -29
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +116 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +84 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +113 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +81 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +42 -2
- package/src/blocks/empty-state.tsx +424 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/progress-state.tsx +542 -0
- package/src/blocks/sidebar.tsx +46 -40
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +9 -4
- package/src/components/button.tsx +5 -8
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +52 -17
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +43 -17
- package/src/components/chip.tsx +9 -6
- package/src/components/combobox.tsx +21 -12
- package/src/components/command.tsx +9 -10
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +405 -31
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +8 -4
- package/src/components/global-layout.tsx +264 -65
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/link.tsx +39 -5
- package/src/components/list.tsx +18 -14
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +279 -1
- package/src/components/progress.tsx +120 -11
- package/src/components/route-progress.tsx +354 -0
- package/src/components/select.tsx +5 -4
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +89 -7
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +5 -14
- package/src/components/spinner.tsx +94 -0
- package/src/components/stepper.tsx +6 -7
- package/src/components/table.tsx +11 -4
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +229 -0
- package/src/components/typography-text.tsx +225 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +12 -0
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
package/dist/data-table.js
CHANGED
|
@@ -1,316 +1,389 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { useReactTable as
|
|
4
|
-
import { useVirtualizer as
|
|
5
|
-
import { ArrowDown as
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
import { InputGroup as
|
|
10
|
-
import { usePagination as
|
|
11
|
-
import { Skeleton as
|
|
12
|
-
import { Table as
|
|
13
|
-
import { TypographyMuted as
|
|
14
|
-
function
|
|
15
|
-
const [
|
|
16
|
-
|
|
1
|
+
import { jsx as a, jsxs as f, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { useReactTable as re, getExpandedRowModel as se, getFilteredRowModel as de, getSortedRowModel as ce, getPaginationRowModel as ue, getCoreRowModel as ge, flexRender as G } from "@tanstack/react-table";
|
|
4
|
+
import { useVirtualizer as pe } from "@tanstack/react-virtual";
|
|
5
|
+
import { ArrowDown as me, ArrowUp as he, ArrowUpDown as be, ChevronRight as fe, Search as xe, X as Se } from "@brightlocal/icons";
|
|
6
|
+
import { cn as g } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { Button as V } from "./button.js";
|
|
8
|
+
import { Checkbox as L } from "./checkbox.js";
|
|
9
|
+
import { InputGroup as we, InputGroupAddon as j, InputGroupInput as Ce } from "./input-group.js";
|
|
10
|
+
import { usePagination as ke, Pagination as ve, PaginationContent as Te, PaginationItem as E, PaginationPrevious as Pe, PaginationNext as Re, PaginationEllipsis as ye, PaginationLink as De } from "./pagination.js";
|
|
11
|
+
import { Skeleton as B } from "./skeleton.js";
|
|
12
|
+
import { Table as _, TableBody as U, TableRow as k, TableCell as v, TableHeader as Ne, TableHead as ze } from "./table.js";
|
|
13
|
+
import { TypographyMuted as Ae } from "./typography.js";
|
|
14
|
+
function y(e, n, l) {
|
|
15
|
+
const [t, i] = p.useState(n), o = e !== void 0 ? e : t, r = p.useRef(o);
|
|
16
|
+
p.useEffect(() => {
|
|
17
17
|
r.current = o;
|
|
18
18
|
});
|
|
19
|
-
const
|
|
20
|
-
(
|
|
21
|
-
const u = typeof
|
|
22
|
-
|
|
19
|
+
const s = e !== void 0, d = p.useCallback(
|
|
20
|
+
(c) => {
|
|
21
|
+
const u = typeof c == "function" ? c(r.current) : c;
|
|
22
|
+
s || i(u), l?.(u);
|
|
23
23
|
},
|
|
24
|
-
[
|
|
24
|
+
[s, l]
|
|
25
25
|
);
|
|
26
26
|
return [o, d];
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function sa(e) {
|
|
29
29
|
const {
|
|
30
30
|
columns: n,
|
|
31
31
|
data: l,
|
|
32
|
-
enableSorting:
|
|
32
|
+
enableSorting: t = !0,
|
|
33
33
|
enableGlobalFiltering: i = !1,
|
|
34
34
|
enableRowSelection: o = !1,
|
|
35
35
|
enablePagination: r = !1,
|
|
36
|
-
pageSize:
|
|
36
|
+
pageSize: s = 10,
|
|
37
37
|
manualSorting: d = !1,
|
|
38
|
-
manualFiltering:
|
|
38
|
+
manualFiltering: c = !1,
|
|
39
39
|
manualPagination: u = !1,
|
|
40
40
|
rowCount: h,
|
|
41
|
-
pageCount:
|
|
42
|
-
enableExpanding:
|
|
43
|
-
getSubRows:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
D
|
|
41
|
+
pageCount: m,
|
|
42
|
+
enableExpanding: S = !1,
|
|
43
|
+
getSubRows: x,
|
|
44
|
+
getRowCanExpand: w,
|
|
45
|
+
paginateExpandedRows: P = !1,
|
|
46
|
+
getRowId: b,
|
|
47
|
+
pagination: I,
|
|
48
|
+
onPaginationChange: D,
|
|
49
|
+
sorting: R,
|
|
50
|
+
onSortingChange: N,
|
|
51
|
+
globalFilter: C,
|
|
52
|
+
onGlobalFilterChange: F,
|
|
53
|
+
rowSelection: z,
|
|
54
|
+
onRowSelectionChange: A,
|
|
55
|
+
expanded: M,
|
|
56
|
+
onExpandedChange: $
|
|
57
|
+
} = e, [Q, Y] = y(
|
|
58
|
+
I,
|
|
59
|
+
{ pageIndex: 0, pageSize: s },
|
|
60
|
+
D
|
|
61
|
+
), [Z, ee] = y(
|
|
62
|
+
R,
|
|
61
63
|
[],
|
|
62
|
-
|
|
63
|
-
), [
|
|
64
|
-
|
|
64
|
+
N
|
|
65
|
+
), [ae, te] = y(
|
|
66
|
+
C,
|
|
65
67
|
"",
|
|
66
|
-
|
|
67
|
-
), [
|
|
68
|
-
|
|
68
|
+
F
|
|
69
|
+
), [ne, oe] = y(z, {}, A), [le, ie] = y(
|
|
70
|
+
M,
|
|
69
71
|
{},
|
|
70
|
-
|
|
72
|
+
$
|
|
71
73
|
);
|
|
72
|
-
return
|
|
74
|
+
return re({
|
|
73
75
|
data: l,
|
|
74
76
|
columns: n,
|
|
75
|
-
getCoreRowModel:
|
|
76
|
-
...
|
|
77
|
+
getCoreRowModel: ge(),
|
|
78
|
+
...b && { getRowId: b },
|
|
77
79
|
...(r || u) && {
|
|
78
|
-
onPaginationChange:
|
|
80
|
+
onPaginationChange: Y
|
|
79
81
|
},
|
|
80
82
|
...r && {
|
|
81
83
|
...!u && {
|
|
82
|
-
getPaginationRowModel:
|
|
84
|
+
getPaginationRowModel: ue()
|
|
83
85
|
}
|
|
84
86
|
},
|
|
85
87
|
...u && {
|
|
86
88
|
manualPagination: !0,
|
|
87
89
|
...h != null && { rowCount: h },
|
|
88
|
-
...
|
|
90
|
+
...m != null && { pageCount: m }
|
|
89
91
|
},
|
|
90
92
|
// Always forward the flag — TanStack defaults `enableSorting` to true,
|
|
91
93
|
// so omitting it would leave `column.getCanSort()` returning true even
|
|
92
94
|
// when the consumer disabled sorting table-wide.
|
|
93
|
-
enableSorting:
|
|
94
|
-
...
|
|
95
|
+
enableSorting: t,
|
|
96
|
+
...t && {
|
|
95
97
|
...!d && {
|
|
96
|
-
getSortedRowModel:
|
|
98
|
+
getSortedRowModel: ce()
|
|
97
99
|
},
|
|
98
|
-
onSortingChange:
|
|
100
|
+
onSortingChange: ee,
|
|
99
101
|
...d && { manualSorting: !0 }
|
|
100
102
|
},
|
|
101
103
|
...i && {
|
|
102
|
-
...!
|
|
103
|
-
getFilteredRowModel:
|
|
104
|
+
...!c && {
|
|
105
|
+
getFilteredRowModel: de()
|
|
104
106
|
},
|
|
105
|
-
...
|
|
106
|
-
onGlobalFilterChange:
|
|
107
|
+
...c && { manualFiltering: !0 },
|
|
108
|
+
onGlobalFilterChange: te,
|
|
107
109
|
globalFilterFn: "includesString"
|
|
108
110
|
},
|
|
109
111
|
// Always forward — TanStack defaults `enableRowSelection` to true, so
|
|
110
112
|
// omitting it would leave `row.getCanSelect()` returning true and
|
|
111
113
|
// `DataTableSelectRowCheckbox` enabled on tables without selection.
|
|
112
114
|
enableRowSelection: o,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
// A predicate turns selection on for the table as a whole; individual rows
|
|
116
|
+
// opt out through `row.getCanSelect()`, so the state wiring is still needed.
|
|
117
|
+
...o !== !1 && {
|
|
118
|
+
onRowSelectionChange: oe
|
|
115
119
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
// Always forward the flag — TanStack defaults `enableExpanding` to true,
|
|
121
|
+
// so omitting it would leave `row.getCanExpand()` returning true and
|
|
122
|
+
// `DataTableExpandRowButton` interactive on tables without expanding.
|
|
123
|
+
enableExpanding: S,
|
|
124
|
+
...S && {
|
|
125
|
+
getExpandedRowModel: se(),
|
|
126
|
+
onExpandedChange: ie,
|
|
127
|
+
getSubRows: x,
|
|
128
|
+
...w && { getRowCanExpand: w },
|
|
129
|
+
// Forward only with client-side pagination: `paginateExpandedRows:
|
|
130
|
+
// false` defers expansion to the pagination row model, so without one
|
|
131
|
+
// it would suppress row expansion entirely.
|
|
132
|
+
...r && !u && { paginateExpandedRows: P }
|
|
120
133
|
},
|
|
121
134
|
state: {
|
|
122
|
-
pagination:
|
|
123
|
-
sorting:
|
|
124
|
-
globalFilter:
|
|
125
|
-
rowSelection:
|
|
126
|
-
expanded:
|
|
135
|
+
pagination: Q,
|
|
136
|
+
sorting: Z,
|
|
137
|
+
globalFilter: ae,
|
|
138
|
+
rowSelection: ne,
|
|
139
|
+
expanded: le
|
|
127
140
|
}
|
|
128
141
|
});
|
|
129
142
|
}
|
|
130
|
-
function
|
|
143
|
+
function $e({
|
|
131
144
|
table: e,
|
|
132
145
|
dataHook: n,
|
|
133
146
|
trackingEl: l,
|
|
134
|
-
trackingLabel:
|
|
147
|
+
trackingLabel: t,
|
|
135
148
|
isLoading: i = !1,
|
|
136
149
|
skeletonRowCount: o,
|
|
137
150
|
noResultsMessage: r = "No results.",
|
|
138
|
-
stickyHeader:
|
|
151
|
+
stickyHeader: s = !1,
|
|
139
152
|
className: d,
|
|
140
|
-
layout:
|
|
153
|
+
layout: c,
|
|
141
154
|
minWidth: u,
|
|
142
155
|
scrollRegionLabel: h,
|
|
143
|
-
footer:
|
|
156
|
+
footer: m,
|
|
157
|
+
getRowClassName: S,
|
|
158
|
+
renderExpandedContent: x
|
|
144
159
|
}) {
|
|
145
|
-
const
|
|
146
|
-
return /* @__PURE__ */
|
|
160
|
+
const w = e.getVisibleLeafColumns().length, P = o ?? e.getState().pagination.pageSize ?? 10;
|
|
161
|
+
return /* @__PURE__ */ a(
|
|
147
162
|
"div",
|
|
148
163
|
{
|
|
149
164
|
"aria-busy": i || void 0,
|
|
150
|
-
className:
|
|
165
|
+
className: g("border-border overflow-auto rounded-md border", d),
|
|
151
166
|
"data-hook": n,
|
|
152
167
|
"data-slot": "data-table-view",
|
|
153
168
|
"data-tracking-el": l,
|
|
154
|
-
"data-tracking-label":
|
|
155
|
-
children: /* @__PURE__ */
|
|
156
|
-
|
|
169
|
+
"data-tracking-label": t,
|
|
170
|
+
children: /* @__PURE__ */ f(
|
|
171
|
+
_,
|
|
157
172
|
{
|
|
158
173
|
dataHook: `${n}-table`,
|
|
159
|
-
layout:
|
|
174
|
+
layout: c,
|
|
160
175
|
minWidth: u,
|
|
161
176
|
scrollRegionLabel: h,
|
|
162
177
|
children: [
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
|
|
178
|
+
/* @__PURE__ */ a(W, { stickyHeader: s, table: e }),
|
|
179
|
+
/* @__PURE__ */ a(U, { children: i ? /* @__PURE__ */ f(T, { children: [
|
|
180
|
+
/* @__PURE__ */ a(
|
|
181
|
+
X,
|
|
167
182
|
{
|
|
168
|
-
colCount:
|
|
169
|
-
rowCount:
|
|
183
|
+
colCount: w,
|
|
184
|
+
rowCount: P
|
|
170
185
|
}
|
|
171
186
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
] }) : /* @__PURE__ */
|
|
174
|
-
|
|
187
|
+
/* @__PURE__ */ a(k, { className: "sr-only", children: /* @__PURE__ */ a(v, { colSpan: w, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
|
|
188
|
+
] }) : /* @__PURE__ */ a(T, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((b) => /* @__PURE__ */ a(
|
|
189
|
+
O,
|
|
190
|
+
{
|
|
191
|
+
columnCount: w,
|
|
192
|
+
getRowClassName: S,
|
|
193
|
+
renderExpandedContent: x,
|
|
194
|
+
row: b
|
|
195
|
+
},
|
|
196
|
+
b.id
|
|
197
|
+
)) : /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(v, { align: "center", colSpan: w, size: "lg", children: /* @__PURE__ */ a("div", { "aria-live": "polite", className: "py-6", role: "status", children: r }) }) }) }) }),
|
|
198
|
+
m
|
|
175
199
|
]
|
|
176
200
|
}
|
|
177
201
|
)
|
|
178
202
|
}
|
|
179
203
|
);
|
|
180
204
|
}
|
|
181
|
-
|
|
182
|
-
function
|
|
205
|
+
$e.displayName = "DataTable";
|
|
206
|
+
function W({
|
|
183
207
|
table: e,
|
|
184
208
|
stickyHeader: n
|
|
185
209
|
}) {
|
|
186
|
-
return /* @__PURE__ */
|
|
187
|
-
const i =
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
|
|
210
|
+
return /* @__PURE__ */ a(Ne, { className: g(n && "sticky top-0 z-10"), children: e.getHeaderGroups().map((l) => /* @__PURE__ */ a(k, { children: l.headers.map((t) => {
|
|
211
|
+
const i = t.column.getCanSort() ? t.column.getIsSorted() : !1, o = i === "asc" ? "ascending" : i === "desc" ? "descending" : t.column.getCanSort() ? "none" : void 0, r = t.column.columnDef.meta;
|
|
212
|
+
return /* @__PURE__ */ a(
|
|
213
|
+
ze,
|
|
190
214
|
{
|
|
191
215
|
"aria-sort": o,
|
|
192
|
-
colSpan:
|
|
216
|
+
colSpan: t.colSpan,
|
|
193
217
|
minWidth: r?.minWidth,
|
|
194
218
|
width: r?.width,
|
|
195
|
-
children:
|
|
196
|
-
|
|
197
|
-
|
|
219
|
+
children: t.isPlaceholder ? null : G(
|
|
220
|
+
t.column.columnDef.header,
|
|
221
|
+
t.getContext()
|
|
198
222
|
)
|
|
199
223
|
},
|
|
200
|
-
|
|
224
|
+
t.id
|
|
201
225
|
);
|
|
202
226
|
}) }, l.id)) });
|
|
203
227
|
}
|
|
204
|
-
function
|
|
205
|
-
|
|
228
|
+
function O({
|
|
229
|
+
row: e,
|
|
230
|
+
columnCount: n,
|
|
231
|
+
getRowClassName: l,
|
|
232
|
+
renderExpandedContent: t
|
|
233
|
+
}) {
|
|
234
|
+
const i = e.getCanExpand(), o = e.getIsExpanded(), r = t && i && o ? t(e) : null;
|
|
235
|
+
return /* @__PURE__ */ f(T, { children: [
|
|
236
|
+
/* @__PURE__ */ a(
|
|
237
|
+
k,
|
|
238
|
+
{
|
|
239
|
+
className: g(
|
|
240
|
+
// Rows have no hover of their own — the chevron/action buttons are
|
|
241
|
+
// the interactive elements. Ghost buttons (the only bg-transparent
|
|
242
|
+
// variant) get bg-secondary on hover because their default
|
|
243
|
+
// hover:bg-accent is invisible on bg-muted rows (accent equals
|
|
244
|
+
// muted in light mode). Scoped to .bg-transparent so variant
|
|
245
|
+
// buttons in cells (primary, destructive, …) keep their own hover.
|
|
246
|
+
"[&_[data-slot=button].bg-transparent:hover]:bg-secondary",
|
|
247
|
+
// Surfaces are mutually exclusive: an expanded parent shares the
|
|
248
|
+
// table head's bg-muted at ANY depth; other expanded-zone rows
|
|
249
|
+
// (sub-rows) get the lighter accent wash.
|
|
250
|
+
i && o ? "bg-muted" : e.depth > 0 && "bg-accent/50",
|
|
251
|
+
l?.(e)
|
|
252
|
+
),
|
|
253
|
+
"data-depth": e.depth,
|
|
254
|
+
"data-expanded": i ? String(o) : void 0,
|
|
255
|
+
"data-state": e.getIsSelected() ? "selected" : void 0,
|
|
256
|
+
children: e.getVisibleCells().map((s) => /* @__PURE__ */ a(v, { children: G(s.column.columnDef.cell, s.getContext()) }, s.id))
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
r != null && // No data-depth here: panels are not data rows, and sharing the
|
|
260
|
+
// parent's depth would break depth-based selectors and counts.
|
|
261
|
+
/* @__PURE__ */ a(
|
|
262
|
+
k,
|
|
263
|
+
{
|
|
264
|
+
className: "bg-accent/50 [&_[data-slot=button].bg-transparent:hover]:bg-secondary",
|
|
265
|
+
"data-slot": "data-table-expanded-row",
|
|
266
|
+
children: /* @__PURE__ */ a(v, { colSpan: n, children: r })
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
] });
|
|
206
270
|
}
|
|
207
|
-
function
|
|
271
|
+
function X({
|
|
208
272
|
rowCount: e,
|
|
209
273
|
colCount: n
|
|
210
274
|
}) {
|
|
211
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ a(T, { children: Array.from({ length: e }).map((l, t) => /* @__PURE__ */ a(k, { children: Array.from({ length: n }).map((i, o) => /* @__PURE__ */ a(v, { children: /* @__PURE__ */ a(B, { className: "h-4 w-full" }) }, `skeleton-${t}-${o}`)) }, `skeleton-${t}`)) });
|
|
212
276
|
}
|
|
213
|
-
function
|
|
277
|
+
function Ee({
|
|
214
278
|
table: e,
|
|
215
279
|
dataHook: n,
|
|
216
280
|
trackingEl: l,
|
|
217
|
-
trackingLabel:
|
|
281
|
+
trackingLabel: t,
|
|
218
282
|
isLoading: i = !1,
|
|
219
283
|
skeletonRowCount: o,
|
|
220
284
|
noResultsMessage: r = "No results.",
|
|
221
|
-
stickyHeader:
|
|
285
|
+
stickyHeader: s = !1,
|
|
222
286
|
className: d,
|
|
223
|
-
layout:
|
|
287
|
+
layout: c,
|
|
224
288
|
minWidth: u,
|
|
225
289
|
scrollRegionLabel: h,
|
|
226
|
-
footer:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
290
|
+
footer: m,
|
|
291
|
+
getRowClassName: S,
|
|
292
|
+
height: x,
|
|
293
|
+
estimateSize: w = 48,
|
|
294
|
+
overscan: P = 5
|
|
230
295
|
}) {
|
|
231
|
-
const
|
|
232
|
-
count:
|
|
296
|
+
const b = e.getVisibleLeafColumns().length, I = o ?? e.getState().pagination.pageSize ?? 10, D = p.useRef(null), R = e.getRowModel().rows, N = pe({
|
|
297
|
+
count: R.length,
|
|
233
298
|
getScrollElement: () => D.current,
|
|
234
|
-
estimateSize: () =>
|
|
235
|
-
overscan:
|
|
236
|
-
}),
|
|
237
|
-
return /* @__PURE__ */
|
|
299
|
+
estimateSize: () => w,
|
|
300
|
+
overscan: P
|
|
301
|
+
}), C = N.getVirtualItems(), F = N.getTotalSize(), z = C.length > 0 ? C[0].start : 0, A = C.length > 0 ? F - C[C.length - 1].end : 0;
|
|
302
|
+
return /* @__PURE__ */ a(
|
|
238
303
|
"div",
|
|
239
304
|
{
|
|
240
305
|
ref: D,
|
|
241
306
|
"aria-busy": i || void 0,
|
|
242
|
-
className:
|
|
307
|
+
className: g("border-border overflow-auto rounded-md border", d),
|
|
243
308
|
"data-hook": n,
|
|
244
309
|
"data-slot": "data-table-view",
|
|
245
310
|
"data-tracking-el": l,
|
|
246
|
-
"data-tracking-label":
|
|
247
|
-
style:
|
|
248
|
-
children: /* @__PURE__ */
|
|
249
|
-
|
|
311
|
+
"data-tracking-label": t,
|
|
312
|
+
style: x != null ? { height: x } : void 0,
|
|
313
|
+
children: /* @__PURE__ */ f(
|
|
314
|
+
_,
|
|
250
315
|
{
|
|
251
316
|
dataHook: `${n}-table`,
|
|
252
|
-
layout:
|
|
317
|
+
layout: c,
|
|
253
318
|
minWidth: u,
|
|
254
319
|
scrollRegionLabel: h,
|
|
255
320
|
children: [
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
|
|
321
|
+
/* @__PURE__ */ a(W, { stickyHeader: s, table: e }),
|
|
322
|
+
/* @__PURE__ */ a(U, { children: i ? /* @__PURE__ */ f(T, { children: [
|
|
323
|
+
/* @__PURE__ */ a(
|
|
324
|
+
X,
|
|
260
325
|
{
|
|
261
|
-
colCount:
|
|
262
|
-
rowCount:
|
|
326
|
+
colCount: b,
|
|
327
|
+
rowCount: I
|
|
263
328
|
}
|
|
264
329
|
),
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
] }) :
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
return /* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ a(k, { className: "sr-only", children: /* @__PURE__ */ a(v, { colSpan: b, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
|
|
331
|
+
] }) : R.length > 0 ? /* @__PURE__ */ f(T, { children: [
|
|
332
|
+
z > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: b, style: { height: z } }) }),
|
|
333
|
+
C.map((M) => {
|
|
334
|
+
const $ = R[M.index];
|
|
335
|
+
return /* @__PURE__ */ a(
|
|
336
|
+
O,
|
|
337
|
+
{
|
|
338
|
+
columnCount: b,
|
|
339
|
+
getRowClassName: S,
|
|
340
|
+
row: $
|
|
341
|
+
},
|
|
342
|
+
$.id
|
|
343
|
+
);
|
|
271
344
|
}),
|
|
272
|
-
|
|
273
|
-
] }) : /* @__PURE__ */
|
|
274
|
-
|
|
345
|
+
A > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: b, style: { height: A } }) })
|
|
346
|
+
] }) : /* @__PURE__ */ a(k, { children: /* @__PURE__ */ a(v, { align: "center", colSpan: b, size: "lg", children: /* @__PURE__ */ a("div", { "aria-live": "polite", className: "py-6", role: "status", children: r }) }) }) }),
|
|
347
|
+
m
|
|
275
348
|
]
|
|
276
349
|
}
|
|
277
350
|
)
|
|
278
351
|
}
|
|
279
352
|
);
|
|
280
353
|
}
|
|
281
|
-
|
|
282
|
-
function
|
|
354
|
+
Ee.displayName = "VirtualizedDataTable";
|
|
355
|
+
function Ie({
|
|
283
356
|
column: e,
|
|
284
357
|
title: n,
|
|
285
358
|
className: l,
|
|
286
|
-
dataHook:
|
|
359
|
+
dataHook: t,
|
|
287
360
|
trackingEl: i,
|
|
288
361
|
trackingLabel: o,
|
|
289
362
|
align: r = "left",
|
|
290
|
-
getSortLabel:
|
|
363
|
+
getSortLabel: s
|
|
291
364
|
}) {
|
|
292
365
|
if (!e.getCanSort())
|
|
293
|
-
return /* @__PURE__ */
|
|
366
|
+
return /* @__PURE__ */ a(
|
|
294
367
|
"div",
|
|
295
368
|
{
|
|
296
|
-
className:
|
|
297
|
-
"text-muted-foreground text-
|
|
369
|
+
className: g(
|
|
370
|
+
"text-muted-foreground text-label text-left font-semibold",
|
|
298
371
|
r === "right" && "text-right",
|
|
299
372
|
r === "center" && "text-center",
|
|
300
373
|
l
|
|
301
374
|
),
|
|
302
|
-
"data-hook":
|
|
375
|
+
"data-hook": t,
|
|
303
376
|
"data-slot": "data-table-column-header",
|
|
304
377
|
"data-tracking-el": i,
|
|
305
378
|
"data-tracking-label": o,
|
|
306
379
|
children: n
|
|
307
380
|
}
|
|
308
381
|
);
|
|
309
|
-
const d = e.getIsSorted(),
|
|
310
|
-
return /* @__PURE__ */
|
|
382
|
+
const d = e.getIsSorted(), c = s ? s(n, d) : d === "desc" ? `Sort by ${n}, currently descending` : d === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
|
|
383
|
+
return /* @__PURE__ */ a(
|
|
311
384
|
"div",
|
|
312
385
|
{
|
|
313
|
-
className:
|
|
386
|
+
className: g(
|
|
314
387
|
"flex items-center",
|
|
315
388
|
r === "right" && "justify-end",
|
|
316
389
|
r === "center" && "justify-center",
|
|
@@ -319,23 +392,23 @@ function Ae({
|
|
|
319
392
|
"data-slot": "data-table-column-header",
|
|
320
393
|
"data-tracking-el": i,
|
|
321
394
|
"data-tracking-label": o,
|
|
322
|
-
children: /* @__PURE__ */
|
|
323
|
-
|
|
395
|
+
children: /* @__PURE__ */ f(
|
|
396
|
+
V,
|
|
324
397
|
{
|
|
325
|
-
"aria-label":
|
|
326
|
-
className: "text-muted-foreground h-auto p-0
|
|
327
|
-
dataHook:
|
|
398
|
+
"aria-label": c,
|
|
399
|
+
className: "text-muted-foreground text-label h-auto p-0 font-semibold",
|
|
400
|
+
dataHook: t || `column-header-${e.id}`,
|
|
328
401
|
size: "sm",
|
|
329
402
|
variant: "ghost",
|
|
330
403
|
onClick: () => e.toggleSorting(d === "asc"),
|
|
331
404
|
children: [
|
|
332
|
-
/* @__PURE__ */
|
|
333
|
-
/* @__PURE__ */
|
|
405
|
+
/* @__PURE__ */ a("span", { "aria-hidden": "true", children: n }),
|
|
406
|
+
/* @__PURE__ */ a(
|
|
334
407
|
"span",
|
|
335
408
|
{
|
|
336
409
|
"aria-hidden": "true",
|
|
337
410
|
className: "flex size-3 items-center justify-center",
|
|
338
|
-
children: d === "desc" ? /* @__PURE__ */
|
|
411
|
+
children: d === "desc" ? /* @__PURE__ */ a(me, { size: 12 }) : d === "asc" ? /* @__PURE__ */ a(he, { size: 12 }) : /* @__PURE__ */ a(be, { size: 12 })
|
|
339
412
|
}
|
|
340
413
|
)
|
|
341
414
|
]
|
|
@@ -344,162 +417,162 @@ function Ae({
|
|
|
344
417
|
}
|
|
345
418
|
);
|
|
346
419
|
}
|
|
347
|
-
|
|
348
|
-
function
|
|
420
|
+
Ie.displayName = "DataTableColumnHeader";
|
|
421
|
+
function Fe({
|
|
349
422
|
table: e,
|
|
350
423
|
ariaLabel: n,
|
|
351
424
|
placeholder: l,
|
|
352
|
-
clearSearchAriaLabel:
|
|
425
|
+
clearSearchAriaLabel: t,
|
|
353
426
|
...i
|
|
354
427
|
}) {
|
|
355
|
-
const o = e.getState().globalFilter ?? "", r = (
|
|
356
|
-
e.setGlobalFilter(
|
|
428
|
+
const o = e.getState().globalFilter ?? "", r = (s) => {
|
|
429
|
+
e.setGlobalFilter(s);
|
|
357
430
|
};
|
|
358
|
-
return /* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
361
|
-
|
|
431
|
+
return /* @__PURE__ */ f(we, { "data-slot": "data-table-search", ...i, children: [
|
|
432
|
+
/* @__PURE__ */ a(j, { className: "pl-3", children: /* @__PURE__ */ a(xe, {}) }),
|
|
433
|
+
/* @__PURE__ */ a(
|
|
434
|
+
Ce,
|
|
362
435
|
{
|
|
363
436
|
"aria-label": n ?? "Search table",
|
|
364
437
|
placeholder: l ?? "Search...",
|
|
365
438
|
type: "text",
|
|
366
439
|
value: o,
|
|
367
|
-
onChange: (
|
|
440
|
+
onChange: (s) => r(s.target.value)
|
|
368
441
|
}
|
|
369
442
|
),
|
|
370
|
-
o && /* @__PURE__ */
|
|
371
|
-
|
|
443
|
+
o && /* @__PURE__ */ a(j, { className: "pr-1", children: /* @__PURE__ */ a(
|
|
444
|
+
V,
|
|
372
445
|
{
|
|
373
|
-
"aria-label":
|
|
374
|
-
className: "
|
|
446
|
+
"aria-label": t ?? "Clear search",
|
|
447
|
+
className: "size-6 p-0",
|
|
375
448
|
"data-slot": "data-table-search-clear",
|
|
376
449
|
dataHook: `${i.dataHook}-clear`,
|
|
377
450
|
variant: "ghost",
|
|
378
451
|
onClick: () => r(""),
|
|
379
|
-
children: /* @__PURE__ */
|
|
452
|
+
children: /* @__PURE__ */ a(Se, { size: 14 })
|
|
380
453
|
}
|
|
381
454
|
) })
|
|
382
455
|
] });
|
|
383
456
|
}
|
|
384
|
-
|
|
385
|
-
function
|
|
386
|
-
const { pageIndex: n, pageSize: l } = e.getState().pagination,
|
|
387
|
-
(
|
|
457
|
+
Fe.displayName = "DataTableSearch";
|
|
458
|
+
function Me(e) {
|
|
459
|
+
const { pageIndex: n, pageSize: l } = e.getState().pagination, t = e.getRowCount(), i = e.getPageCount(), o = e.getCanPreviousPage(), r = e.getCanNextPage(), s = n + 1, d = t === 0 ? 0 : n * l + 1, c = Math.min(s * l, t), u = p.useCallback(
|
|
460
|
+
(x) => e.setPageIndex(x - 1),
|
|
388
461
|
[e]
|
|
389
|
-
), h =
|
|
390
|
-
(
|
|
462
|
+
), h = p.useCallback(() => e.nextPage(), [e]), m = p.useCallback(() => e.previousPage(), [e]), S = p.useCallback(
|
|
463
|
+
(x) => e.setPageSize(x),
|
|
391
464
|
[e]
|
|
392
465
|
);
|
|
393
|
-
return
|
|
466
|
+
return p.useMemo(
|
|
394
467
|
() => ({
|
|
395
468
|
pageIndex: n,
|
|
396
469
|
pageSize: l,
|
|
397
|
-
totalRows:
|
|
470
|
+
totalRows: t,
|
|
398
471
|
totalPages: i,
|
|
399
472
|
startRow: d,
|
|
400
|
-
endRow:
|
|
401
|
-
currentPage:
|
|
473
|
+
endRow: c,
|
|
474
|
+
currentPage: s,
|
|
402
475
|
canPrev: o,
|
|
403
476
|
canNext: r,
|
|
404
477
|
goToPage: u,
|
|
405
478
|
nextPage: h,
|
|
406
|
-
previousPage:
|
|
407
|
-
setPageSize:
|
|
479
|
+
previousPage: m,
|
|
480
|
+
setPageSize: S
|
|
408
481
|
}),
|
|
409
482
|
[
|
|
410
483
|
n,
|
|
411
484
|
l,
|
|
412
|
-
|
|
485
|
+
t,
|
|
413
486
|
i,
|
|
414
487
|
d,
|
|
415
|
-
s,
|
|
416
488
|
c,
|
|
489
|
+
s,
|
|
417
490
|
o,
|
|
418
491
|
r,
|
|
419
492
|
u,
|
|
420
493
|
h,
|
|
421
|
-
|
|
422
|
-
|
|
494
|
+
m,
|
|
495
|
+
S
|
|
423
496
|
]
|
|
424
497
|
);
|
|
425
498
|
}
|
|
426
|
-
const
|
|
427
|
-
function
|
|
428
|
-
const e =
|
|
499
|
+
const H = p.createContext(null);
|
|
500
|
+
function q() {
|
|
501
|
+
const e = p.useContext(H);
|
|
429
502
|
if (!e)
|
|
430
503
|
throw new Error(
|
|
431
504
|
"DataTablePagination sub-components must be used within <DataTablePagination>"
|
|
432
505
|
);
|
|
433
506
|
return e;
|
|
434
507
|
}
|
|
435
|
-
function
|
|
508
|
+
function Be({
|
|
436
509
|
renderText: e,
|
|
437
510
|
className: n
|
|
438
511
|
}) {
|
|
439
|
-
const { info: l } =
|
|
440
|
-
return d == null ? null : /* @__PURE__ */
|
|
512
|
+
const { info: l } = q(), { startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: s } = l, d = e ? e({ startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: s }) : o === 0 ? null : `${t}-${i} of ${o}`;
|
|
513
|
+
return d == null ? null : /* @__PURE__ */ a(
|
|
441
514
|
"span",
|
|
442
515
|
{
|
|
443
|
-
className:
|
|
516
|
+
className: g("text-body-sm text-muted-foreground", n),
|
|
444
517
|
"data-slot": "data-table-pagination-row-count",
|
|
445
518
|
children: d
|
|
446
519
|
}
|
|
447
520
|
);
|
|
448
521
|
}
|
|
449
|
-
|
|
450
|
-
function
|
|
522
|
+
Be.displayName = "DataTablePaginationRowCount";
|
|
523
|
+
function J({
|
|
451
524
|
ariaLabel: e = "Table pagination",
|
|
452
525
|
dataHook: n,
|
|
453
526
|
className: l
|
|
454
527
|
}) {
|
|
455
|
-
const { info:
|
|
456
|
-
page:
|
|
457
|
-
totalPages:
|
|
528
|
+
const { info: t } = q(), i = ke({
|
|
529
|
+
page: t.currentPage,
|
|
530
|
+
totalPages: t.totalPages
|
|
458
531
|
});
|
|
459
|
-
return /* @__PURE__ */
|
|
460
|
-
|
|
532
|
+
return t.totalPages <= 1 ? null : /* @__PURE__ */ a(
|
|
533
|
+
ve,
|
|
461
534
|
{
|
|
462
535
|
ariaLabel: e,
|
|
463
|
-
className:
|
|
536
|
+
className: g("mx-0 w-auto justify-end", l),
|
|
464
537
|
dataHook: n ?? "pagination-nav",
|
|
465
|
-
children: /* @__PURE__ */
|
|
466
|
-
|
|
538
|
+
children: /* @__PURE__ */ a(Te, { children: i.map((o, r) => o === "previous" ? /* @__PURE__ */ a(E, { children: /* @__PURE__ */ a(
|
|
539
|
+
Pe,
|
|
467
540
|
{
|
|
468
|
-
disabled: !
|
|
469
|
-
onClick: () =>
|
|
541
|
+
disabled: !t.canPrev,
|
|
542
|
+
onClick: () => t.previousPage()
|
|
470
543
|
}
|
|
471
|
-
) }, "previous") : o === "next" ? /* @__PURE__ */
|
|
472
|
-
|
|
544
|
+
) }, "previous") : o === "next" ? /* @__PURE__ */ a(E, { children: /* @__PURE__ */ a(
|
|
545
|
+
Re,
|
|
473
546
|
{
|
|
474
|
-
disabled: !
|
|
475
|
-
onClick: () =>
|
|
547
|
+
disabled: !t.canNext,
|
|
548
|
+
onClick: () => t.nextPage()
|
|
476
549
|
}
|
|
477
|
-
) }, "next") : o === "ellipsis" ? /* @__PURE__ */
|
|
478
|
-
|
|
550
|
+
) }, "next") : o === "ellipsis" ? /* @__PURE__ */ a(E, { children: /* @__PURE__ */ a(ye, {}) }, `ellipsis-${r}`) : /* @__PURE__ */ a(E, { children: /* @__PURE__ */ a(
|
|
551
|
+
De,
|
|
479
552
|
{
|
|
480
|
-
isActive: o ===
|
|
553
|
+
isActive: o === t.currentPage,
|
|
481
554
|
page: o,
|
|
482
|
-
onClick: () =>
|
|
555
|
+
onClick: () => t.goToPage(o)
|
|
483
556
|
}
|
|
484
557
|
) }, o)) })
|
|
485
558
|
}
|
|
486
559
|
);
|
|
487
560
|
}
|
|
488
|
-
|
|
489
|
-
function
|
|
561
|
+
J.displayName = "DataTablePaginationNav";
|
|
562
|
+
function He({
|
|
490
563
|
table: e,
|
|
491
564
|
dataHook: n,
|
|
492
565
|
showRowCount: l = !0,
|
|
493
|
-
renderRowCount:
|
|
566
|
+
renderRowCount: t,
|
|
494
567
|
trackingEl: i,
|
|
495
568
|
trackingLabel: o,
|
|
496
569
|
className: r,
|
|
497
|
-
ariaLabel:
|
|
570
|
+
ariaLabel: s = "Table pagination",
|
|
498
571
|
children: d
|
|
499
572
|
}) {
|
|
500
|
-
const
|
|
501
|
-
() => ({ info:
|
|
502
|
-
[
|
|
573
|
+
const c = Me(e), u = p.useMemo(
|
|
574
|
+
() => ({ info: c }),
|
|
575
|
+
[c]
|
|
503
576
|
), h = {
|
|
504
577
|
"data-hook": n,
|
|
505
578
|
"data-slot": "data-table-pagination",
|
|
@@ -507,36 +580,36 @@ function Me({
|
|
|
507
580
|
"data-tracking-label": o
|
|
508
581
|
};
|
|
509
582
|
if (d)
|
|
510
|
-
return /* @__PURE__ */
|
|
583
|
+
return /* @__PURE__ */ a(H.Provider, { value: u, children: /* @__PURE__ */ a(
|
|
511
584
|
"div",
|
|
512
585
|
{
|
|
513
|
-
className:
|
|
586
|
+
className: g("flex w-full items-center gap-4", r),
|
|
514
587
|
...h,
|
|
515
588
|
children: d
|
|
516
589
|
}
|
|
517
590
|
) });
|
|
518
|
-
const
|
|
519
|
-
startRow:
|
|
520
|
-
endRow:
|
|
521
|
-
totalRows:
|
|
522
|
-
pageIndex:
|
|
523
|
-
pageSize:
|
|
524
|
-
}) :
|
|
525
|
-
return /* @__PURE__ */
|
|
591
|
+
const m = !l || t === null ? null : t ? t({
|
|
592
|
+
startRow: c.startRow,
|
|
593
|
+
endRow: c.endRow,
|
|
594
|
+
totalRows: c.totalRows,
|
|
595
|
+
pageIndex: c.pageIndex,
|
|
596
|
+
pageSize: c.pageSize
|
|
597
|
+
}) : c.totalRows === 0 ? null : `${c.startRow}-${c.endRow} of ${c.totalRows}`;
|
|
598
|
+
return m == null && c.totalPages <= 1 ? null : /* @__PURE__ */ a(H.Provider, { value: u, children: /* @__PURE__ */ f(
|
|
526
599
|
"div",
|
|
527
600
|
{
|
|
528
|
-
className:
|
|
529
|
-
"flex w-full items-center gap-4",
|
|
530
|
-
|
|
601
|
+
className: g(
|
|
602
|
+
"flex min-h-9 w-full items-center gap-4",
|
|
603
|
+
m != null ? "justify-between" : "justify-end",
|
|
531
604
|
r
|
|
532
605
|
),
|
|
533
606
|
...h,
|
|
534
607
|
children: [
|
|
535
|
-
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
|
|
608
|
+
m != null && /* @__PURE__ */ a("span", { className: "text-body-sm text-muted-foreground", children: m }),
|
|
609
|
+
/* @__PURE__ */ a(
|
|
610
|
+
J,
|
|
538
611
|
{
|
|
539
|
-
ariaLabel:
|
|
612
|
+
ariaLabel: s,
|
|
540
613
|
dataHook: `${n}-nav`
|
|
541
614
|
}
|
|
542
615
|
)
|
|
@@ -544,125 +617,198 @@ function Me({
|
|
|
544
617
|
}
|
|
545
618
|
) });
|
|
546
619
|
}
|
|
547
|
-
|
|
548
|
-
function
|
|
620
|
+
He.displayName = "DataTablePagination";
|
|
621
|
+
function Ve({
|
|
549
622
|
table: e,
|
|
550
623
|
dataHook: n,
|
|
551
624
|
trackingEl: l,
|
|
552
|
-
trackingLabel:
|
|
625
|
+
trackingLabel: t,
|
|
553
626
|
selectAllAriaLabel: i
|
|
554
627
|
}) {
|
|
555
|
-
return /* @__PURE__ */
|
|
556
|
-
|
|
628
|
+
return /* @__PURE__ */ a(
|
|
629
|
+
L,
|
|
557
630
|
{
|
|
558
631
|
"aria-label": i ?? "Select all",
|
|
559
632
|
checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
|
|
560
633
|
dataHook: n || "select-all-checkbox",
|
|
561
634
|
trackingEl: l,
|
|
562
|
-
trackingLabel:
|
|
635
|
+
trackingLabel: t,
|
|
563
636
|
onCheckedChange: (o) => e.toggleAllPageRowsSelected(!!o)
|
|
564
637
|
}
|
|
565
638
|
);
|
|
566
639
|
}
|
|
567
|
-
|
|
568
|
-
function
|
|
640
|
+
Ve.displayName = "DataTableSelectAllCheckbox";
|
|
641
|
+
function je({
|
|
569
642
|
row: e,
|
|
570
643
|
dataHook: n,
|
|
571
644
|
trackingEl: l,
|
|
572
|
-
trackingLabel:
|
|
645
|
+
trackingLabel: t,
|
|
573
646
|
selectRowAriaLabel: i
|
|
574
647
|
}) {
|
|
575
|
-
return /* @__PURE__ */
|
|
576
|
-
|
|
648
|
+
return /* @__PURE__ */ a(
|
|
649
|
+
L,
|
|
577
650
|
{
|
|
578
651
|
"aria-label": i ?? "Select row",
|
|
579
652
|
checked: e.getIsSelected(),
|
|
580
653
|
dataHook: n || `select-row-${e.id}`,
|
|
581
654
|
disabled: !e.getCanSelect(),
|
|
582
655
|
trackingEl: l,
|
|
583
|
-
trackingLabel:
|
|
656
|
+
trackingLabel: t,
|
|
584
657
|
onCheckedChange: (o) => e.toggleSelected(!!o)
|
|
585
658
|
}
|
|
586
659
|
);
|
|
587
660
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
661
|
+
je.displayName = "DataTableSelectRowCheckbox";
|
|
662
|
+
function Ge({
|
|
663
|
+
row: e,
|
|
664
|
+
rowName: n,
|
|
665
|
+
dataHook: l,
|
|
666
|
+
trackingEl: t,
|
|
667
|
+
trackingLabel: i,
|
|
668
|
+
expandLabel: o,
|
|
669
|
+
collapseLabel: r,
|
|
670
|
+
className: s
|
|
671
|
+
}) {
|
|
672
|
+
if (!e.getCanExpand())
|
|
673
|
+
return /* @__PURE__ */ a(
|
|
674
|
+
"span",
|
|
675
|
+
{
|
|
676
|
+
"aria-hidden": "true",
|
|
677
|
+
className: g("inline-block size-9", s),
|
|
678
|
+
"data-slot": "data-table-expand-row-spacer"
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
const d = e.getIsExpanded(), c = d ? r : o;
|
|
682
|
+
let u;
|
|
683
|
+
return c && (n !== void 0 || !c.includes("{name}")) ? u = c.replaceAll("{name}", n ?? "") : n !== void 0 ? u = d ? `Collapse details for ${n}` : `Expand details for ${n}` : u = d ? "Collapse row" : "Expand row", /* @__PURE__ */ a(
|
|
684
|
+
V,
|
|
685
|
+
{
|
|
686
|
+
iconOnly: !0,
|
|
687
|
+
"aria-expanded": d,
|
|
688
|
+
"aria-label": u,
|
|
689
|
+
className: s,
|
|
690
|
+
"data-state": d ? "open" : "closed",
|
|
691
|
+
dataHook: l || `expand-row-${e.id}`,
|
|
692
|
+
size: "sm",
|
|
693
|
+
trackingEl: t,
|
|
694
|
+
trackingLabel: i,
|
|
695
|
+
variant: "ghost",
|
|
696
|
+
onClick: e.getToggleExpandedHandler(),
|
|
697
|
+
children: /* @__PURE__ */ a(
|
|
698
|
+
fe,
|
|
699
|
+
{
|
|
700
|
+
"aria-hidden": "true",
|
|
701
|
+
className: g(
|
|
702
|
+
"duration-base transition-transform ease-in-out",
|
|
703
|
+
d && "rotate-90"
|
|
704
|
+
)
|
|
705
|
+
}
|
|
706
|
+
)
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
}
|
|
710
|
+
Ge.displayName = "DataTableExpandRowButton";
|
|
711
|
+
function Le({
|
|
712
|
+
fields: e = 3,
|
|
713
|
+
loadingLabel: n,
|
|
714
|
+
dataHook: l,
|
|
715
|
+
className: t
|
|
716
|
+
}) {
|
|
717
|
+
return /* @__PURE__ */ f(
|
|
718
|
+
"div",
|
|
719
|
+
{
|
|
720
|
+
className: g("relative flex flex-col gap-2 py-1", t),
|
|
721
|
+
"data-hook": l || "data-table-expanded-skeleton",
|
|
722
|
+
"data-slot": "data-table-expanded-skeleton",
|
|
723
|
+
role: "status",
|
|
724
|
+
children: [
|
|
725
|
+
/* @__PURE__ */ a("span", { className: "sr-only", children: n ?? "Loading details" }),
|
|
726
|
+
Array.from({ length: e }, (i, o) => /* @__PURE__ */ f("div", { "aria-hidden": "true", className: "flex items-center gap-4", children: [
|
|
727
|
+
/* @__PURE__ */ a(B, { className: "h-4 w-24 shrink-0" }),
|
|
728
|
+
/* @__PURE__ */ a(B, { className: "h-4 w-48 max-w-full" })
|
|
729
|
+
] }, o))
|
|
730
|
+
]
|
|
731
|
+
}
|
|
732
|
+
);
|
|
733
|
+
}
|
|
734
|
+
Le.displayName = "DataTableExpandedSkeleton";
|
|
735
|
+
const K = p.createContext(null);
|
|
736
|
+
function _e() {
|
|
737
|
+
const e = p.useContext(K);
|
|
592
738
|
if (!e)
|
|
593
739
|
throw new Error(
|
|
594
740
|
"DataTableBulkActions components must be used within <DataTableBulkActions>"
|
|
595
741
|
);
|
|
596
742
|
return e;
|
|
597
743
|
}
|
|
598
|
-
function
|
|
744
|
+
function Ue({
|
|
599
745
|
table: e,
|
|
600
746
|
dataHook: n,
|
|
601
747
|
trackingEl: l,
|
|
602
|
-
trackingLabel:
|
|
748
|
+
trackingLabel: t,
|
|
603
749
|
className: i,
|
|
604
750
|
children: o
|
|
605
751
|
}) {
|
|
606
|
-
const r = e.getFilteredSelectedRowModel().rows.length,
|
|
607
|
-
() => ({ selectedCount: r, totalCount:
|
|
608
|
-
[r,
|
|
752
|
+
const r = e.getFilteredSelectedRowModel().rows.length, s = e.getRowCount(), d = p.useMemo(
|
|
753
|
+
() => ({ selectedCount: r, totalCount: s }),
|
|
754
|
+
[r, s]
|
|
609
755
|
);
|
|
610
|
-
return r === 0 ? null : /* @__PURE__ */
|
|
756
|
+
return r === 0 ? null : /* @__PURE__ */ a(K.Provider, { value: d, children: /* @__PURE__ */ a(
|
|
611
757
|
"div",
|
|
612
758
|
{
|
|
613
|
-
className:
|
|
759
|
+
className: g("flex items-center gap-2.5", i),
|
|
614
760
|
"data-hook": n,
|
|
615
761
|
"data-slot": "data-table-bulk-actions",
|
|
616
762
|
"data-tracking-el": l ?? "data-table-bulk-actions",
|
|
617
|
-
"data-tracking-label":
|
|
763
|
+
"data-tracking-label": t,
|
|
618
764
|
children: o
|
|
619
765
|
}
|
|
620
766
|
) });
|
|
621
767
|
}
|
|
622
|
-
|
|
623
|
-
function
|
|
768
|
+
Ue.displayName = "DataTableBulkActions";
|
|
769
|
+
function We({
|
|
624
770
|
dataHook: e = "data-table-bulk-actions-summary",
|
|
625
771
|
className: n,
|
|
626
772
|
children: l
|
|
627
773
|
}) {
|
|
628
|
-
const { selectedCount:
|
|
774
|
+
const { selectedCount: t, totalCount: i } = _e();
|
|
629
775
|
let o;
|
|
630
|
-
return typeof l == "function" ? o = l({ selectedCount:
|
|
631
|
-
|
|
776
|
+
return typeof l == "function" ? o = l({ selectedCount: t, totalCount: i }) : l != null ? o = l : o = `${t} of ${i} row(s) selected.`, /* @__PURE__ */ a(
|
|
777
|
+
Ae,
|
|
632
778
|
{
|
|
633
779
|
asChild: !0,
|
|
634
|
-
className:
|
|
780
|
+
className: g("min-w-0", n),
|
|
635
781
|
dataHook: e,
|
|
636
|
-
children: /* @__PURE__ */
|
|
782
|
+
children: /* @__PURE__ */ a("span", { "data-slot": "data-table-bulk-actions-summary", role: "status", children: o })
|
|
637
783
|
}
|
|
638
784
|
);
|
|
639
785
|
}
|
|
640
|
-
|
|
641
|
-
function
|
|
786
|
+
We.displayName = "DataTableBulkActionsSummary";
|
|
787
|
+
function Oe({
|
|
642
788
|
dataHook: e = "data-table-bulk-actions-actions",
|
|
643
789
|
className: n,
|
|
644
790
|
children: l
|
|
645
791
|
}) {
|
|
646
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ a(
|
|
647
793
|
"div",
|
|
648
794
|
{
|
|
649
|
-
className:
|
|
795
|
+
className: g("flex shrink-0 items-center gap-2", n),
|
|
650
796
|
"data-hook": e,
|
|
651
797
|
"data-slot": "data-table-bulk-actions-actions",
|
|
652
798
|
children: l
|
|
653
799
|
}
|
|
654
800
|
);
|
|
655
801
|
}
|
|
656
|
-
|
|
657
|
-
function
|
|
802
|
+
Oe.displayName = "DataTableBulkActionsActions";
|
|
803
|
+
function Xe({
|
|
658
804
|
dataHook: e,
|
|
659
805
|
className: n,
|
|
660
806
|
children: l
|
|
661
807
|
}) {
|
|
662
|
-
return /* @__PURE__ */
|
|
808
|
+
return /* @__PURE__ */ a(
|
|
663
809
|
"div",
|
|
664
810
|
{
|
|
665
|
-
className:
|
|
811
|
+
className: g(
|
|
666
812
|
"flex flex-col gap-3 py-4 sm:flex-row sm:items-center",
|
|
667
813
|
n
|
|
668
814
|
),
|
|
@@ -672,15 +818,15 @@ function Le({
|
|
|
672
818
|
}
|
|
673
819
|
);
|
|
674
820
|
}
|
|
675
|
-
|
|
676
|
-
function
|
|
821
|
+
Xe.displayName = "DataTableToolbar";
|
|
822
|
+
function qe({
|
|
677
823
|
className: e,
|
|
678
824
|
children: n
|
|
679
825
|
}) {
|
|
680
|
-
return /* @__PURE__ */
|
|
826
|
+
return /* @__PURE__ */ a(
|
|
681
827
|
"div",
|
|
682
828
|
{
|
|
683
|
-
className:
|
|
829
|
+
className: g(
|
|
684
830
|
"flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-1",
|
|
685
831
|
e
|
|
686
832
|
),
|
|
@@ -689,15 +835,15 @@ function Ue({
|
|
|
689
835
|
}
|
|
690
836
|
);
|
|
691
837
|
}
|
|
692
|
-
|
|
693
|
-
function
|
|
838
|
+
qe.displayName = "DataTableToolbarLeft";
|
|
839
|
+
function Je({
|
|
694
840
|
className: e,
|
|
695
841
|
children: n
|
|
696
842
|
}) {
|
|
697
|
-
return /* @__PURE__ */
|
|
843
|
+
return /* @__PURE__ */ a(
|
|
698
844
|
"div",
|
|
699
845
|
{
|
|
700
|
-
className:
|
|
846
|
+
className: g(
|
|
701
847
|
"flex w-full items-center justify-end gap-2 sm:w-auto",
|
|
702
848
|
e
|
|
703
849
|
),
|
|
@@ -706,23 +852,25 @@ function We({
|
|
|
706
852
|
}
|
|
707
853
|
);
|
|
708
854
|
}
|
|
709
|
-
|
|
855
|
+
Je.displayName = "DataTableToolbarRight";
|
|
710
856
|
export {
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
Be as
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
857
|
+
$e as DataTable,
|
|
858
|
+
Ue as DataTableBulkActions,
|
|
859
|
+
Oe as DataTableBulkActionsActions,
|
|
860
|
+
We as DataTableBulkActionsSummary,
|
|
861
|
+
Ie as DataTableColumnHeader,
|
|
862
|
+
Ge as DataTableExpandRowButton,
|
|
863
|
+
Le as DataTableExpandedSkeleton,
|
|
864
|
+
He as DataTablePagination,
|
|
865
|
+
J as DataTablePaginationNav,
|
|
866
|
+
Be as DataTablePaginationRowCount,
|
|
867
|
+
Fe as DataTableSearch,
|
|
868
|
+
Ve as DataTableSelectAllCheckbox,
|
|
869
|
+
je as DataTableSelectRowCheckbox,
|
|
870
|
+
Xe as DataTableToolbar,
|
|
871
|
+
qe as DataTableToolbarLeft,
|
|
872
|
+
Je as DataTableToolbarRight,
|
|
873
|
+
Ee as VirtualizedDataTable,
|
|
874
|
+
sa as useDataTable,
|
|
875
|
+
_e as useDataTableBulkActionsContext
|
|
728
876
|
};
|