@brightlocal/ui-components 2.7.0 → 2.9.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/component-meta.json +6 -4
- package/dist/alert.cjs +1 -1
- package/dist/alert.js +1 -1
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +74 -26
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +318 -296
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +39 -21
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +379 -425
- package/dist/callout.cjs +1 -1
- package/dist/callout.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +11 -11
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +24 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +327 -302
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +3 -3
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +90 -82
- package/dist/hooks/use-breakpoint.cjs +1 -0
- package/dist/hooks/use-breakpoint.d.ts +15 -0
- package/dist/hooks/use-breakpoint.d.ts.map +1 -0
- package/dist/hooks/use-breakpoint.js +30 -0
- package/dist/hooks/use-mobile.d.ts +13 -3
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +220 -215
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +5 -0
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +34 -25
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +15 -0
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/split-layout.js +40 -38
- package/package.json +3 -3
- package/src/blocks/data-table.tsx +139 -76
- package/src/blocks/sidebar.tsx +134 -148
- package/src/components/alert.tsx +1 -1
- package/src/components/callout.tsx +1 -1
- package/src/components/card.tsx +1 -1
- package/src/components/combobox.tsx +72 -11
- package/src/components/global-layout.tsx +49 -40
- package/src/components/scroll-area.tsx +15 -1
- package/src/components/split-layout.tsx +19 -2
- package/src/hooks/use-breakpoint.ts +58 -0
- package/src/hooks/use-mobile.ts +20 -40
- package/src/index.ts +1 -0
- package/dist/hooks/use-mobile.cjs +0 -1
- package/dist/hooks/use-mobile.js +0 -26
|
@@ -1,81 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { useReactTable as ne, getExpandedRowModel as oe, getFilteredRowModel as le, getSortedRowModel as ie, getPaginationRowModel as re, getCoreRowModel as se, flexRender as
|
|
1
|
+
import { jsx as a, jsxs as S, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import { useReactTable as ne, getExpandedRowModel as oe, getFilteredRowModel as le, getSortedRowModel as ie, getPaginationRowModel as re, getCoreRowModel as se, flexRender as A } from "@tanstack/react-table";
|
|
4
4
|
import { useVirtualizer as ce } from "@tanstack/react-virtual";
|
|
5
|
-
import { ArrowDown as de, ArrowUp as ue, ArrowUpDown as ge,
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
p.useEffect(() => {
|
|
5
|
+
import { ArrowDown as de, ArrowUp as ue, ArrowUpDown as ge, Search as me, X as pe } from "@brightlocal/icons";
|
|
6
|
+
import { cn as h } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { Button as H } from "../button.js";
|
|
8
|
+
import { Checkbox as V } from "../checkbox.js";
|
|
9
|
+
import { InputGroup as he, InputGroupAddon as M, InputGroupInput as fe } from "../input-group.js";
|
|
10
|
+
import { usePagination as be, Pagination as Se, PaginationContent as we, PaginationItem as z, PaginationPrevious as Ce, PaginationNext as xe, PaginationEllipsis as Pe, PaginationLink as ve } from "../pagination.js";
|
|
11
|
+
import { Skeleton as Re } from "../skeleton.js";
|
|
12
|
+
import { Table as j, TableBody as E, TableRow as C, TableCell as x, TableHeader as Te, TableHead as ke } from "../table.js";
|
|
13
|
+
function R(e, n, l) {
|
|
14
|
+
const [t, i] = m.useState(n), o = e !== void 0 ? e : t, r = m.useRef(o);
|
|
15
|
+
m.useEffect(() => {
|
|
17
16
|
r.current = o;
|
|
18
17
|
});
|
|
19
|
-
const c =
|
|
18
|
+
const c = e !== void 0, d = m.useCallback(
|
|
20
19
|
(s) => {
|
|
21
20
|
const u = typeof s == "function" ? s(r.current) : s;
|
|
22
|
-
c ||
|
|
21
|
+
c || i(u), l?.(u);
|
|
23
22
|
},
|
|
24
|
-
[c,
|
|
23
|
+
[c, l]
|
|
25
24
|
);
|
|
26
25
|
return [o, d];
|
|
27
26
|
}
|
|
28
|
-
function
|
|
27
|
+
function Qe(e) {
|
|
29
28
|
const {
|
|
30
29
|
columns: n,
|
|
31
|
-
data:
|
|
32
|
-
enableSorting:
|
|
33
|
-
enableGlobalFiltering:
|
|
30
|
+
data: l,
|
|
31
|
+
enableSorting: t = !0,
|
|
32
|
+
enableGlobalFiltering: i = !1,
|
|
34
33
|
enableRowSelection: o = !1,
|
|
35
34
|
enablePagination: r = !1,
|
|
36
35
|
pageSize: c = 10,
|
|
37
36
|
manualSorting: d = !1,
|
|
38
37
|
manualFiltering: s = !1,
|
|
39
38
|
manualPagination: u = !1,
|
|
40
|
-
rowCount:
|
|
39
|
+
rowCount: p,
|
|
41
40
|
pageCount: g,
|
|
42
|
-
enableExpanding:
|
|
41
|
+
enableExpanding: f = !1,
|
|
43
42
|
getSubRows: w,
|
|
44
43
|
getRowId: P,
|
|
45
|
-
pagination:
|
|
46
|
-
onPaginationChange:
|
|
47
|
-
sorting:
|
|
48
|
-
onSortingChange:
|
|
49
|
-
globalFilter:
|
|
50
|
-
onGlobalFilterChange:
|
|
51
|
-
rowSelection:
|
|
52
|
-
onRowSelectionChange:
|
|
53
|
-
expanded:
|
|
54
|
-
onExpandedChange:
|
|
55
|
-
} =
|
|
56
|
-
|
|
44
|
+
pagination: v,
|
|
45
|
+
onPaginationChange: k,
|
|
46
|
+
sorting: b,
|
|
47
|
+
onSortingChange: I,
|
|
48
|
+
globalFilter: y,
|
|
49
|
+
onGlobalFilterChange: N,
|
|
50
|
+
rowSelection: $,
|
|
51
|
+
onRowSelectionChange: D,
|
|
52
|
+
expanded: X,
|
|
53
|
+
onExpandedChange: q
|
|
54
|
+
} = e, [J, K] = R(
|
|
55
|
+
v,
|
|
57
56
|
{ pageIndex: 0, pageSize: c },
|
|
58
|
-
|
|
59
|
-
), [
|
|
60
|
-
|
|
57
|
+
k
|
|
58
|
+
), [O, Q] = R(
|
|
59
|
+
b,
|
|
61
60
|
[],
|
|
62
|
-
|
|
63
|
-
), [W, Y] =
|
|
64
|
-
|
|
61
|
+
I
|
|
62
|
+
), [W, Y] = R(
|
|
63
|
+
y,
|
|
65
64
|
"",
|
|
66
|
-
|
|
67
|
-
), [Z, ee] =
|
|
68
|
-
|
|
65
|
+
N
|
|
66
|
+
), [Z, ee] = R($, {}, D), [ae, te] = R(
|
|
67
|
+
X,
|
|
69
68
|
{},
|
|
70
|
-
|
|
69
|
+
q
|
|
71
70
|
);
|
|
72
71
|
return ne({
|
|
73
|
-
data:
|
|
72
|
+
data: l,
|
|
74
73
|
columns: n,
|
|
75
74
|
getCoreRowModel: se(),
|
|
76
75
|
...P && { getRowId: P },
|
|
77
76
|
...(r || u) && {
|
|
78
|
-
onPaginationChange:
|
|
77
|
+
onPaginationChange: K
|
|
79
78
|
},
|
|
80
79
|
...r && {
|
|
81
80
|
...!u && {
|
|
@@ -84,17 +83,17 @@ function Ze(t) {
|
|
|
84
83
|
},
|
|
85
84
|
...u && {
|
|
86
85
|
manualPagination: !0,
|
|
87
|
-
...
|
|
86
|
+
...p != null && { rowCount: p },
|
|
88
87
|
...g != null && { pageCount: g }
|
|
89
88
|
},
|
|
90
|
-
...
|
|
89
|
+
...t && {
|
|
91
90
|
...!d && {
|
|
92
91
|
getSortedRowModel: ie()
|
|
93
92
|
},
|
|
94
93
|
onSortingChange: Q,
|
|
95
94
|
...d && { manualSorting: !0 }
|
|
96
95
|
},
|
|
97
|
-
...
|
|
96
|
+
...i && {
|
|
98
97
|
...!s && {
|
|
99
98
|
getFilteredRowModel: le()
|
|
100
99
|
},
|
|
@@ -106,208 +105,208 @@ function Ze(t) {
|
|
|
106
105
|
enableRowSelection: !0,
|
|
107
106
|
onRowSelectionChange: ee
|
|
108
107
|
},
|
|
109
|
-
...
|
|
108
|
+
...f && {
|
|
110
109
|
getExpandedRowModel: oe(),
|
|
111
|
-
onExpandedChange:
|
|
110
|
+
onExpandedChange: te,
|
|
112
111
|
getSubRows: w
|
|
113
112
|
},
|
|
114
113
|
state: {
|
|
115
|
-
pagination:
|
|
116
|
-
sorting:
|
|
114
|
+
pagination: J,
|
|
115
|
+
sorting: O,
|
|
117
116
|
globalFilter: W,
|
|
118
117
|
rowSelection: Z,
|
|
119
|
-
expanded:
|
|
118
|
+
expanded: ae
|
|
120
119
|
}
|
|
121
120
|
});
|
|
122
121
|
}
|
|
123
|
-
function
|
|
124
|
-
table:
|
|
122
|
+
function ye({
|
|
123
|
+
table: e,
|
|
125
124
|
dataHook: n,
|
|
126
|
-
trackingEl:
|
|
127
|
-
trackingLabel:
|
|
128
|
-
isLoading:
|
|
125
|
+
trackingEl: l,
|
|
126
|
+
trackingLabel: t,
|
|
127
|
+
isLoading: i = !1,
|
|
129
128
|
skeletonRowCount: o,
|
|
130
129
|
noResultsMessage: r = "No results.",
|
|
131
130
|
stickyHeader: c = !1,
|
|
132
131
|
className: d,
|
|
133
132
|
footer: s
|
|
134
133
|
}) {
|
|
135
|
-
const u =
|
|
136
|
-
return /* @__PURE__ */
|
|
134
|
+
const u = e.getVisibleLeafColumns().length, p = o ?? e.getState().pagination.pageSize ?? 10;
|
|
135
|
+
return /* @__PURE__ */ a(
|
|
137
136
|
"div",
|
|
138
137
|
{
|
|
139
|
-
"aria-busy":
|
|
140
|
-
className:
|
|
138
|
+
"aria-busy": i || void 0,
|
|
139
|
+
className: h("border-border overflow-auto rounded-md border", d),
|
|
141
140
|
"data-hook": n,
|
|
142
141
|
"data-slot": "data-table-view",
|
|
143
|
-
"data-tracking-el":
|
|
144
|
-
"data-tracking-label":
|
|
145
|
-
children: /* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
/* @__PURE__ */
|
|
142
|
+
"data-tracking-el": l,
|
|
143
|
+
"data-tracking-label": t,
|
|
144
|
+
children: /* @__PURE__ */ S(j, { dataHook: `${n}-table`, children: [
|
|
145
|
+
/* @__PURE__ */ a(G, { stickyHeader: c, table: e }),
|
|
146
|
+
/* @__PURE__ */ a(E, { children: i ? /* @__PURE__ */ S(T, { children: [
|
|
147
|
+
/* @__PURE__ */ a(
|
|
149
148
|
B,
|
|
150
149
|
{
|
|
151
150
|
colCount: u,
|
|
152
|
-
rowCount:
|
|
151
|
+
rowCount: p
|
|
153
152
|
}
|
|
154
153
|
),
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
] }) : /* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ a(C, { className: "sr-only", children: /* @__PURE__ */ a(x, { colSpan: u, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
|
|
155
|
+
] }) : /* @__PURE__ */ a(T, { children: e.getRowModel().rows.length > 0 ? e.getRowModel().rows.map((g) => /* @__PURE__ */ a(L, { row: g }, g.id)) : /* @__PURE__ */ a(C, { children: /* @__PURE__ */ a(x, { colSpan: u, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: r }) }) }) }) }),
|
|
157
156
|
s
|
|
158
157
|
] })
|
|
159
158
|
}
|
|
160
159
|
);
|
|
161
160
|
}
|
|
162
|
-
|
|
161
|
+
ye.displayName = "DataTable";
|
|
163
162
|
function G({
|
|
164
|
-
table:
|
|
163
|
+
table: e,
|
|
165
164
|
stickyHeader: n
|
|
166
165
|
}) {
|
|
167
|
-
return /* @__PURE__ */
|
|
168
|
-
|
|
166
|
+
return /* @__PURE__ */ a(
|
|
167
|
+
Te,
|
|
169
168
|
{
|
|
170
|
-
className:
|
|
171
|
-
children:
|
|
172
|
-
const
|
|
173
|
-
return /* @__PURE__ */
|
|
174
|
-
|
|
169
|
+
className: h(n && "bg-background sticky top-0 z-10"),
|
|
170
|
+
children: e.getHeaderGroups().map((l) => /* @__PURE__ */ a(C, { children: l.headers.map((t) => {
|
|
171
|
+
const i = t.column.getCanSort() ? t.column.getIsSorted() : !1, o = i === "asc" ? "ascending" : i === "desc" ? "descending" : t.column.getCanSort() ? "none" : void 0;
|
|
172
|
+
return /* @__PURE__ */ a(
|
|
173
|
+
ke,
|
|
175
174
|
{
|
|
176
175
|
"aria-sort": o,
|
|
177
|
-
colSpan:
|
|
178
|
-
children:
|
|
179
|
-
|
|
180
|
-
|
|
176
|
+
colSpan: t.colSpan,
|
|
177
|
+
children: t.isPlaceholder ? null : A(
|
|
178
|
+
t.column.columnDef.header,
|
|
179
|
+
t.getContext()
|
|
181
180
|
)
|
|
182
181
|
},
|
|
183
|
-
|
|
182
|
+
t.id
|
|
184
183
|
);
|
|
185
|
-
}) },
|
|
184
|
+
}) }, l.id))
|
|
186
185
|
}
|
|
187
186
|
);
|
|
188
187
|
}
|
|
189
|
-
function L({ row:
|
|
190
|
-
return /* @__PURE__ */
|
|
188
|
+
function L({ row: e }) {
|
|
189
|
+
return /* @__PURE__ */ a(C, { "data-state": e.getIsSelected() ? "selected" : void 0, children: e.getVisibleCells().map((n) => /* @__PURE__ */ a(x, { children: A(n.column.columnDef.cell, n.getContext()) }, n.id)) });
|
|
191
190
|
}
|
|
192
191
|
function B({
|
|
193
|
-
rowCount:
|
|
192
|
+
rowCount: e,
|
|
194
193
|
colCount: n
|
|
195
194
|
}) {
|
|
196
|
-
return /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ a(T, { children: Array.from({ length: e }).map((l, t) => /* @__PURE__ */ a(C, { children: Array.from({ length: n }).map((i, o) => /* @__PURE__ */ a(x, { children: /* @__PURE__ */ a(Re, { className: "h-4 w-full" }) }, `skeleton-${t}-${o}`)) }, `skeleton-${t}`)) });
|
|
197
196
|
}
|
|
198
|
-
function
|
|
199
|
-
table:
|
|
197
|
+
function Ne({
|
|
198
|
+
table: e,
|
|
200
199
|
dataHook: n,
|
|
201
|
-
trackingEl:
|
|
202
|
-
trackingLabel:
|
|
203
|
-
isLoading:
|
|
200
|
+
trackingEl: l,
|
|
201
|
+
trackingLabel: t,
|
|
202
|
+
isLoading: i = !1,
|
|
204
203
|
skeletonRowCount: o,
|
|
205
204
|
noResultsMessage: r = "No results.",
|
|
206
205
|
stickyHeader: c = !1,
|
|
207
206
|
className: d,
|
|
208
207
|
footer: s,
|
|
209
208
|
height: u,
|
|
210
|
-
estimateSize:
|
|
209
|
+
estimateSize: p = 48,
|
|
211
210
|
overscan: g = 5
|
|
212
211
|
}) {
|
|
213
|
-
const
|
|
214
|
-
count:
|
|
212
|
+
const f = e.getVisibleLeafColumns().length, w = o ?? e.getState().pagination.pageSize ?? 10, P = m.useRef(null), v = e.getRowModel().rows, k = ce({
|
|
213
|
+
count: v.length,
|
|
215
214
|
getScrollElement: () => P.current,
|
|
216
|
-
estimateSize: () =>
|
|
215
|
+
estimateSize: () => p,
|
|
217
216
|
overscan: g
|
|
218
|
-
}),
|
|
219
|
-
return /* @__PURE__ */
|
|
217
|
+
}), b = k.getVirtualItems(), I = k.getTotalSize(), y = b.length > 0 ? b[0].start : 0, N = b.length > 0 ? I - b[b.length - 1].end : 0;
|
|
218
|
+
return /* @__PURE__ */ a(
|
|
220
219
|
"div",
|
|
221
220
|
{
|
|
222
221
|
ref: P,
|
|
223
|
-
"aria-busy":
|
|
224
|
-
className:
|
|
222
|
+
"aria-busy": i || void 0,
|
|
223
|
+
className: h("border-border overflow-auto rounded-md border", d),
|
|
225
224
|
"data-hook": n,
|
|
226
225
|
"data-slot": "data-table-view",
|
|
227
|
-
"data-tracking-el":
|
|
228
|
-
"data-tracking-label":
|
|
226
|
+
"data-tracking-el": l,
|
|
227
|
+
"data-tracking-label": t,
|
|
229
228
|
style: u != null ? { height: u } : void 0,
|
|
230
|
-
children: /* @__PURE__ */
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
/* @__PURE__ */
|
|
229
|
+
children: /* @__PURE__ */ S(j, { dataHook: `${n}-table`, children: [
|
|
230
|
+
/* @__PURE__ */ a(G, { stickyHeader: c, table: e }),
|
|
231
|
+
/* @__PURE__ */ a(E, { children: i ? /* @__PURE__ */ S(T, { children: [
|
|
232
|
+
/* @__PURE__ */ a(
|
|
234
233
|
B,
|
|
235
234
|
{
|
|
236
|
-
colCount:
|
|
235
|
+
colCount: f,
|
|
237
236
|
rowCount: w
|
|
238
237
|
}
|
|
239
238
|
),
|
|
240
|
-
/* @__PURE__ */
|
|
241
|
-
] }) :
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
return /* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ a(C, { className: "sr-only", children: /* @__PURE__ */ a(x, { colSpan: f, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: "Loading data…" }) }) })
|
|
240
|
+
] }) : v.length > 0 ? /* @__PURE__ */ S(T, { children: [
|
|
241
|
+
y > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: f, style: { height: y } }) }),
|
|
242
|
+
b.map(($) => {
|
|
243
|
+
const D = v[$.index];
|
|
244
|
+
return /* @__PURE__ */ a(L, { row: D }, D.id);
|
|
246
245
|
}),
|
|
247
|
-
|
|
248
|
-
] }) : /* @__PURE__ */
|
|
246
|
+
N > 0 && /* @__PURE__ */ a("tr", { "aria-hidden": "true", children: /* @__PURE__ */ a("td", { colSpan: f, style: { height: N } }) })
|
|
247
|
+
] }) : /* @__PURE__ */ a(C, { children: /* @__PURE__ */ a(x, { colSpan: f, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: r }) }) }) }),
|
|
249
248
|
s
|
|
250
249
|
] })
|
|
251
250
|
}
|
|
252
251
|
);
|
|
253
252
|
}
|
|
254
|
-
|
|
255
|
-
function
|
|
256
|
-
column:
|
|
253
|
+
Ne.displayName = "VirtualizedDataTable";
|
|
254
|
+
function De({
|
|
255
|
+
column: e,
|
|
257
256
|
title: n,
|
|
258
|
-
className:
|
|
259
|
-
dataHook:
|
|
260
|
-
trackingEl:
|
|
257
|
+
className: l,
|
|
258
|
+
dataHook: t,
|
|
259
|
+
trackingEl: i,
|
|
261
260
|
trackingLabel: o,
|
|
262
261
|
align: r = "left"
|
|
263
262
|
}) {
|
|
264
|
-
if (!
|
|
265
|
-
return /* @__PURE__ */
|
|
263
|
+
if (!e.getCanSort())
|
|
264
|
+
return /* @__PURE__ */ a(
|
|
266
265
|
"div",
|
|
267
266
|
{
|
|
268
|
-
className:
|
|
267
|
+
className: h(
|
|
269
268
|
"text-muted-foreground text-left text-sm leading-normal font-medium",
|
|
270
269
|
r === "right" && "text-right",
|
|
271
270
|
r === "center" && "text-center",
|
|
272
|
-
|
|
271
|
+
l
|
|
273
272
|
),
|
|
274
|
-
"data-hook":
|
|
273
|
+
"data-hook": t,
|
|
275
274
|
"data-slot": "data-table-column-header",
|
|
276
|
-
"data-tracking-el":
|
|
275
|
+
"data-tracking-el": i,
|
|
277
276
|
"data-tracking-label": o,
|
|
278
277
|
children: n
|
|
279
278
|
}
|
|
280
279
|
);
|
|
281
|
-
const c =
|
|
282
|
-
return /* @__PURE__ */
|
|
280
|
+
const c = e.getIsSorted(), d = c === "desc" ? `Sort by ${n}, currently descending` : c === "asc" ? `Sort by ${n}, currently ascending` : `Sort by ${n}`;
|
|
281
|
+
return /* @__PURE__ */ a(
|
|
283
282
|
"div",
|
|
284
283
|
{
|
|
285
|
-
className:
|
|
284
|
+
className: h(
|
|
286
285
|
"flex items-center",
|
|
287
286
|
r === "right" && "justify-end",
|
|
288
287
|
r === "center" && "justify-center",
|
|
289
|
-
|
|
288
|
+
l
|
|
290
289
|
),
|
|
291
290
|
"data-slot": "data-table-column-header",
|
|
292
|
-
"data-tracking-el":
|
|
291
|
+
"data-tracking-el": i,
|
|
293
292
|
"data-tracking-label": o,
|
|
294
|
-
children: /* @__PURE__ */
|
|
295
|
-
|
|
293
|
+
children: /* @__PURE__ */ S(
|
|
294
|
+
H,
|
|
296
295
|
{
|
|
297
296
|
"aria-label": d,
|
|
298
297
|
className: "text-muted-foreground h-auto p-0 text-sm font-medium",
|
|
299
|
-
dataHook:
|
|
298
|
+
dataHook: t || `column-header-${e.id}`,
|
|
300
299
|
size: "sm",
|
|
301
300
|
variant: "ghost",
|
|
302
|
-
onClick: () =>
|
|
301
|
+
onClick: () => e.toggleSorting(c === "asc"),
|
|
303
302
|
children: [
|
|
304
|
-
/* @__PURE__ */
|
|
305
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ a("span", { "aria-hidden": "true", children: n }),
|
|
304
|
+
/* @__PURE__ */ a(
|
|
306
305
|
"span",
|
|
307
306
|
{
|
|
308
307
|
"aria-hidden": "true",
|
|
309
308
|
className: "flex size-3 items-center justify-center",
|
|
310
|
-
children: c === "desc" ? /* @__PURE__ */
|
|
309
|
+
children: c === "desc" ? /* @__PURE__ */ a(de, { size: 12 }) : c === "asc" ? /* @__PURE__ */ a(ue, { size: 12 }) : /* @__PURE__ */ a(ge, { size: 12 })
|
|
311
310
|
}
|
|
312
311
|
)
|
|
313
312
|
]
|
|
@@ -316,229 +315,197 @@ function Me({
|
|
|
316
315
|
}
|
|
317
316
|
);
|
|
318
317
|
}
|
|
319
|
-
|
|
320
|
-
function
|
|
321
|
-
|
|
322
|
-
dataHook: n,
|
|
323
|
-
trackingEl: i,
|
|
324
|
-
trackingLabel: a,
|
|
325
|
-
ariaLabel: l = "Open row actions menu",
|
|
326
|
-
children: o
|
|
327
|
-
}) {
|
|
328
|
-
return /* @__PURE__ */ f(fe, { children: [
|
|
329
|
-
/* @__PURE__ */ e(be, { asChild: !0, "data-slot": "data-table-row-actions", children: /* @__PURE__ */ e(
|
|
330
|
-
F,
|
|
331
|
-
{
|
|
332
|
-
"aria-label": l,
|
|
333
|
-
dataHook: n || `row-actions-${t.id}`,
|
|
334
|
-
size: "sm",
|
|
335
|
-
trackingEl: i,
|
|
336
|
-
trackingLabel: a,
|
|
337
|
-
variant: "ghost",
|
|
338
|
-
children: /* @__PURE__ */ e(pe, {})
|
|
339
|
-
}
|
|
340
|
-
) }),
|
|
341
|
-
/* @__PURE__ */ e(
|
|
342
|
-
Se,
|
|
343
|
-
{
|
|
344
|
-
align: "end",
|
|
345
|
-
dataHook: n ? `${n}-menu` : `row-actions-${t.id}-menu`,
|
|
346
|
-
children: o
|
|
347
|
-
}
|
|
348
|
-
)
|
|
349
|
-
] });
|
|
350
|
-
}
|
|
351
|
-
Fe.displayName = "DataTableRowActions";
|
|
352
|
-
function Ae({
|
|
353
|
-
table: t,
|
|
318
|
+
De.displayName = "DataTableColumnHeader";
|
|
319
|
+
function ze({
|
|
320
|
+
table: e,
|
|
354
321
|
ariaLabel: n = "Search table",
|
|
355
|
-
placeholder:
|
|
356
|
-
...
|
|
322
|
+
placeholder: l = "Search...",
|
|
323
|
+
...t
|
|
357
324
|
}) {
|
|
358
|
-
const
|
|
359
|
-
|
|
325
|
+
const i = e.getState().globalFilter ?? "", o = (r) => {
|
|
326
|
+
e.setGlobalFilter(r);
|
|
360
327
|
};
|
|
361
|
-
return /* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */
|
|
363
|
-
/* @__PURE__ */
|
|
364
|
-
|
|
328
|
+
return /* @__PURE__ */ S(he, { "data-slot": "data-table-search", ...t, children: [
|
|
329
|
+
/* @__PURE__ */ a(M, { className: "pl-3", children: /* @__PURE__ */ a(me, {}) }),
|
|
330
|
+
/* @__PURE__ */ a(
|
|
331
|
+
fe,
|
|
365
332
|
{
|
|
366
333
|
"aria-label": n,
|
|
367
|
-
placeholder:
|
|
334
|
+
placeholder: l,
|
|
368
335
|
type: "text",
|
|
369
|
-
value:
|
|
336
|
+
value: i,
|
|
370
337
|
onChange: (r) => o(r.target.value)
|
|
371
338
|
}
|
|
372
339
|
),
|
|
373
|
-
|
|
374
|
-
|
|
340
|
+
i && /* @__PURE__ */ a(M, { className: "pr-1", children: /* @__PURE__ */ a(
|
|
341
|
+
H,
|
|
375
342
|
{
|
|
376
343
|
"aria-label": "Clear search",
|
|
377
344
|
className: "h-auto p-1",
|
|
378
345
|
"data-slot": "data-table-search-clear",
|
|
379
|
-
dataHook: `${
|
|
346
|
+
dataHook: `${t.dataHook}-clear`,
|
|
380
347
|
variant: "ghost",
|
|
381
348
|
onClick: () => o(""),
|
|
382
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ a(pe, { size: 14 })
|
|
383
350
|
}
|
|
384
351
|
) })
|
|
385
352
|
] });
|
|
386
353
|
}
|
|
387
|
-
|
|
388
|
-
function
|
|
389
|
-
const { pageIndex: n, pageSize:
|
|
390
|
-
(w) =>
|
|
391
|
-
[
|
|
392
|
-
),
|
|
393
|
-
(w) =>
|
|
394
|
-
[
|
|
354
|
+
ze.displayName = "DataTableSearch";
|
|
355
|
+
function Ie(e) {
|
|
356
|
+
const { pageIndex: n, pageSize: l } = e.getState().pagination, t = e.getRowCount(), i = e.getPageCount(), o = e.getCanPreviousPage(), r = e.getCanNextPage(), c = n + 1, d = t === 0 ? 0 : n * l + 1, s = Math.min(c * l, t), u = m.useCallback(
|
|
357
|
+
(w) => e.setPageIndex(w - 1),
|
|
358
|
+
[e]
|
|
359
|
+
), p = m.useCallback(() => e.nextPage(), [e]), g = m.useCallback(() => e.previousPage(), [e]), f = m.useCallback(
|
|
360
|
+
(w) => e.setPageSize(w),
|
|
361
|
+
[e]
|
|
395
362
|
);
|
|
396
|
-
return
|
|
363
|
+
return m.useMemo(
|
|
397
364
|
() => ({
|
|
398
365
|
pageIndex: n,
|
|
399
|
-
pageSize:
|
|
400
|
-
totalRows:
|
|
401
|
-
totalPages:
|
|
366
|
+
pageSize: l,
|
|
367
|
+
totalRows: t,
|
|
368
|
+
totalPages: i,
|
|
402
369
|
startRow: d,
|
|
403
370
|
endRow: s,
|
|
404
371
|
currentPage: c,
|
|
405
372
|
canPrev: o,
|
|
406
373
|
canNext: r,
|
|
407
374
|
goToPage: u,
|
|
408
|
-
nextPage:
|
|
375
|
+
nextPage: p,
|
|
409
376
|
previousPage: g,
|
|
410
|
-
setPageSize:
|
|
377
|
+
setPageSize: f
|
|
411
378
|
}),
|
|
412
379
|
[
|
|
413
380
|
n,
|
|
414
|
-
i,
|
|
415
|
-
a,
|
|
416
381
|
l,
|
|
382
|
+
t,
|
|
383
|
+
i,
|
|
417
384
|
d,
|
|
418
385
|
s,
|
|
419
386
|
c,
|
|
420
387
|
o,
|
|
421
388
|
r,
|
|
422
389
|
u,
|
|
423
|
-
|
|
390
|
+
p,
|
|
424
391
|
g,
|
|
425
|
-
|
|
392
|
+
f
|
|
426
393
|
]
|
|
427
394
|
);
|
|
428
395
|
}
|
|
429
|
-
const
|
|
396
|
+
const F = m.createContext(null);
|
|
430
397
|
function U() {
|
|
431
|
-
const
|
|
432
|
-
if (!
|
|
398
|
+
const e = m.useContext(F);
|
|
399
|
+
if (!e)
|
|
433
400
|
throw new Error(
|
|
434
401
|
"DataTablePagination sub-components must be used within <DataTablePagination>"
|
|
435
402
|
);
|
|
436
|
-
return
|
|
403
|
+
return e;
|
|
437
404
|
}
|
|
438
|
-
function
|
|
439
|
-
renderText:
|
|
405
|
+
function $e({
|
|
406
|
+
renderText: e,
|
|
440
407
|
className: n
|
|
441
408
|
}) {
|
|
442
|
-
const { info:
|
|
443
|
-
return d == null ? null : /* @__PURE__ */
|
|
409
|
+
const { info: l } = U(), { startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: c } = l, d = e ? e({ startRow: t, endRow: i, totalRows: o, pageIndex: r, pageSize: c }) : o === 0 ? null : `${t}-${i} of ${o}`;
|
|
410
|
+
return d == null ? null : /* @__PURE__ */ a(
|
|
444
411
|
"span",
|
|
445
412
|
{
|
|
446
|
-
className:
|
|
413
|
+
className: h("text-muted-foreground text-sm", n),
|
|
447
414
|
"data-slot": "data-table-pagination-row-count",
|
|
448
415
|
children: d
|
|
449
416
|
}
|
|
450
417
|
);
|
|
451
418
|
}
|
|
452
|
-
|
|
419
|
+
$e.displayName = "DataTablePaginationRowCount";
|
|
453
420
|
function _({
|
|
454
|
-
ariaLabel:
|
|
421
|
+
ariaLabel: e = "Table pagination",
|
|
455
422
|
dataHook: n,
|
|
456
|
-
className:
|
|
423
|
+
className: l
|
|
457
424
|
}) {
|
|
458
|
-
const { info:
|
|
459
|
-
page:
|
|
460
|
-
totalPages:
|
|
425
|
+
const { info: t } = U(), i = be({
|
|
426
|
+
page: t.currentPage,
|
|
427
|
+
totalPages: t.totalPages,
|
|
461
428
|
siblingCount: 1,
|
|
462
429
|
boundaryCount: 1
|
|
463
430
|
});
|
|
464
|
-
return /* @__PURE__ */
|
|
465
|
-
|
|
431
|
+
return /* @__PURE__ */ a(
|
|
432
|
+
Se,
|
|
466
433
|
{
|
|
467
|
-
ariaLabel:
|
|
468
|
-
className:
|
|
434
|
+
ariaLabel: e,
|
|
435
|
+
className: h("mx-0 w-auto justify-end", l),
|
|
469
436
|
dataHook: n ?? "pagination-nav",
|
|
470
|
-
children: /* @__PURE__ */
|
|
471
|
-
|
|
437
|
+
children: /* @__PURE__ */ a(we, { children: i.map((o, r) => o === "previous" ? /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(
|
|
438
|
+
Ce,
|
|
472
439
|
{
|
|
473
|
-
disabled: !
|
|
474
|
-
onClick: () =>
|
|
440
|
+
disabled: !t.canPrev,
|
|
441
|
+
onClick: () => t.previousPage()
|
|
475
442
|
}
|
|
476
|
-
) }, "previous") : o === "next" ? /* @__PURE__ */
|
|
477
|
-
|
|
443
|
+
) }, "previous") : o === "next" ? /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(
|
|
444
|
+
xe,
|
|
478
445
|
{
|
|
479
|
-
disabled: !
|
|
480
|
-
onClick: () =>
|
|
446
|
+
disabled: !t.canNext,
|
|
447
|
+
onClick: () => t.nextPage()
|
|
481
448
|
}
|
|
482
|
-
) }, "next") : o === "ellipsis" ? /* @__PURE__ */
|
|
483
|
-
|
|
449
|
+
) }, "next") : o === "ellipsis" ? /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(Pe, {}) }, `ellipsis-${r}`) : /* @__PURE__ */ a(z, { children: /* @__PURE__ */ a(
|
|
450
|
+
ve,
|
|
484
451
|
{
|
|
485
|
-
isActive: o ===
|
|
452
|
+
isActive: o === t.currentPage,
|
|
486
453
|
page: o,
|
|
487
|
-
onClick: () =>
|
|
454
|
+
onClick: () => t.goToPage(o)
|
|
488
455
|
}
|
|
489
456
|
) }, o)) })
|
|
490
457
|
}
|
|
491
458
|
);
|
|
492
459
|
}
|
|
493
460
|
_.displayName = "DataTablePaginationNav";
|
|
494
|
-
function
|
|
495
|
-
table:
|
|
461
|
+
function Fe({
|
|
462
|
+
table: e,
|
|
496
463
|
dataHook: n,
|
|
497
|
-
showRowCount:
|
|
498
|
-
renderRowCount:
|
|
499
|
-
trackingEl:
|
|
464
|
+
showRowCount: l = !0,
|
|
465
|
+
renderRowCount: t,
|
|
466
|
+
trackingEl: i,
|
|
500
467
|
trackingLabel: o,
|
|
501
468
|
className: r,
|
|
502
469
|
ariaLabel: c = "Table pagination",
|
|
503
470
|
children: d
|
|
504
471
|
}) {
|
|
505
|
-
const s =
|
|
472
|
+
const s = Ie(e), u = m.useMemo(
|
|
506
473
|
() => ({ info: s }),
|
|
507
474
|
[s]
|
|
508
|
-
),
|
|
475
|
+
), p = {
|
|
509
476
|
"data-hook": n,
|
|
510
477
|
"data-slot": "data-table-pagination",
|
|
511
|
-
"data-tracking-el":
|
|
478
|
+
"data-tracking-el": i,
|
|
512
479
|
"data-tracking-label": o
|
|
513
480
|
};
|
|
514
481
|
if (d)
|
|
515
|
-
return /* @__PURE__ */
|
|
482
|
+
return /* @__PURE__ */ a(F.Provider, { value: u, children: /* @__PURE__ */ a(
|
|
516
483
|
"div",
|
|
517
484
|
{
|
|
518
|
-
className:
|
|
519
|
-
...
|
|
485
|
+
className: h("flex w-full items-center gap-4", r),
|
|
486
|
+
...p,
|
|
520
487
|
children: d
|
|
521
488
|
}
|
|
522
489
|
) });
|
|
523
|
-
const g = !
|
|
490
|
+
const g = !l || t === null ? null : t ? t({
|
|
524
491
|
startRow: s.startRow,
|
|
525
492
|
endRow: s.endRow,
|
|
526
493
|
totalRows: s.totalRows,
|
|
527
494
|
pageIndex: s.pageIndex,
|
|
528
495
|
pageSize: s.pageSize
|
|
529
496
|
}) : s.totalRows === 0 ? null : `${s.startRow}-${s.endRow} of ${s.totalRows}`;
|
|
530
|
-
return /* @__PURE__ */
|
|
497
|
+
return /* @__PURE__ */ a(F.Provider, { value: u, children: /* @__PURE__ */ S(
|
|
531
498
|
"div",
|
|
532
499
|
{
|
|
533
|
-
className:
|
|
534
|
-
"flex items-center gap-4",
|
|
500
|
+
className: h(
|
|
501
|
+
"flex w-full items-center gap-4",
|
|
535
502
|
g != null ? "justify-between" : "justify-end",
|
|
536
503
|
r
|
|
537
504
|
),
|
|
538
|
-
...
|
|
505
|
+
...p,
|
|
539
506
|
children: [
|
|
540
|
-
g != null && /* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
507
|
+
g != null && /* @__PURE__ */ a("span", { className: "text-muted-foreground text-sm", children: g }),
|
|
508
|
+
/* @__PURE__ */ a(
|
|
542
509
|
_,
|
|
543
510
|
{
|
|
544
511
|
ariaLabel: c,
|
|
@@ -549,56 +516,111 @@ function Ve({
|
|
|
549
516
|
}
|
|
550
517
|
) });
|
|
551
518
|
}
|
|
552
|
-
|
|
553
|
-
function
|
|
554
|
-
table:
|
|
519
|
+
Fe.displayName = "DataTablePagination";
|
|
520
|
+
function Me({
|
|
521
|
+
table: e,
|
|
555
522
|
dataHook: n,
|
|
556
|
-
trackingEl:
|
|
557
|
-
trackingLabel:
|
|
523
|
+
trackingEl: l,
|
|
524
|
+
trackingLabel: t
|
|
558
525
|
}) {
|
|
559
|
-
return /* @__PURE__ */
|
|
560
|
-
|
|
526
|
+
return /* @__PURE__ */ a(
|
|
527
|
+
V,
|
|
561
528
|
{
|
|
562
529
|
"aria-label": "Select all",
|
|
563
|
-
checked:
|
|
530
|
+
checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
|
|
564
531
|
dataHook: n || "select-all-checkbox",
|
|
565
|
-
trackingEl:
|
|
566
|
-
trackingLabel:
|
|
567
|
-
onCheckedChange: (
|
|
532
|
+
trackingEl: l,
|
|
533
|
+
trackingLabel: t,
|
|
534
|
+
onCheckedChange: (i) => e.toggleAllPageRowsSelected(!!i)
|
|
568
535
|
}
|
|
569
536
|
);
|
|
570
537
|
}
|
|
571
|
-
|
|
572
|
-
function
|
|
573
|
-
row:
|
|
538
|
+
Me.displayName = "DataTableSelectAllCheckbox";
|
|
539
|
+
function Ae({
|
|
540
|
+
row: e,
|
|
574
541
|
dataHook: n,
|
|
575
|
-
trackingEl:
|
|
576
|
-
trackingLabel:
|
|
542
|
+
trackingEl: l,
|
|
543
|
+
trackingLabel: t
|
|
577
544
|
}) {
|
|
578
|
-
return /* @__PURE__ */
|
|
579
|
-
|
|
545
|
+
return /* @__PURE__ */ a(
|
|
546
|
+
V,
|
|
580
547
|
{
|
|
581
548
|
"aria-label": "Select row",
|
|
582
|
-
checked:
|
|
583
|
-
dataHook: n || `select-row-${
|
|
584
|
-
disabled: !
|
|
585
|
-
trackingEl:
|
|
586
|
-
trackingLabel:
|
|
587
|
-
onCheckedChange: (
|
|
549
|
+
checked: e.getIsSelected(),
|
|
550
|
+
dataHook: n || `select-row-${e.id}`,
|
|
551
|
+
disabled: !e.getCanSelect(),
|
|
552
|
+
trackingEl: l,
|
|
553
|
+
trackingLabel: t,
|
|
554
|
+
onCheckedChange: (i) => e.toggleSelected(!!i)
|
|
555
|
+
}
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
Ae.displayName = "DataTableSelectRowCheckbox";
|
|
559
|
+
function He({
|
|
560
|
+
dataHook: e,
|
|
561
|
+
className: n,
|
|
562
|
+
children: l
|
|
563
|
+
}) {
|
|
564
|
+
return /* @__PURE__ */ a(
|
|
565
|
+
"div",
|
|
566
|
+
{
|
|
567
|
+
className: h(
|
|
568
|
+
"flex flex-col gap-3 py-4 sm:flex-row sm:items-center",
|
|
569
|
+
n
|
|
570
|
+
),
|
|
571
|
+
"data-hook": e,
|
|
572
|
+
"data-slot": "data-table-toolbar",
|
|
573
|
+
children: l
|
|
574
|
+
}
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
He.displayName = "DataTableToolbar";
|
|
578
|
+
function Ve({
|
|
579
|
+
className: e,
|
|
580
|
+
children: n
|
|
581
|
+
}) {
|
|
582
|
+
return /* @__PURE__ */ a(
|
|
583
|
+
"div",
|
|
584
|
+
{
|
|
585
|
+
className: h(
|
|
586
|
+
"flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-1",
|
|
587
|
+
e
|
|
588
|
+
),
|
|
589
|
+
"data-slot": "data-table-toolbar-left",
|
|
590
|
+
children: n
|
|
591
|
+
}
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
Ve.displayName = "DataTableToolbarLeft";
|
|
595
|
+
function je({
|
|
596
|
+
className: e,
|
|
597
|
+
children: n
|
|
598
|
+
}) {
|
|
599
|
+
return /* @__PURE__ */ a(
|
|
600
|
+
"div",
|
|
601
|
+
{
|
|
602
|
+
className: h(
|
|
603
|
+
"flex w-full items-center justify-end gap-2 sm:w-auto",
|
|
604
|
+
e
|
|
605
|
+
),
|
|
606
|
+
"data-slot": "data-table-toolbar-right",
|
|
607
|
+
children: n
|
|
588
608
|
}
|
|
589
609
|
);
|
|
590
610
|
}
|
|
591
|
-
|
|
611
|
+
je.displayName = "DataTableToolbarRight";
|
|
592
612
|
export {
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
613
|
+
ye as DataTable,
|
|
614
|
+
De as DataTableColumnHeader,
|
|
615
|
+
Fe as DataTablePagination,
|
|
596
616
|
_ as DataTablePaginationNav,
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
617
|
+
$e as DataTablePaginationRowCount,
|
|
618
|
+
ze as DataTableSearch,
|
|
619
|
+
Me as DataTableSelectAllCheckbox,
|
|
620
|
+
Ae as DataTableSelectRowCheckbox,
|
|
621
|
+
He as DataTableToolbar,
|
|
622
|
+
Ve as DataTableToolbarLeft,
|
|
623
|
+
je as DataTableToolbarRight,
|
|
624
|
+
Ne as VirtualizedDataTable,
|
|
625
|
+
Qe as useDataTable
|
|
604
626
|
};
|