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