@brightlocal/ui-components 2.20.0 → 2.22.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/AI_USAGE.md +2 -0
- package/README.md +26 -13
- package/component-meta.json +41 -14
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +35 -3
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +178 -154
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -2
- package/dist/blocks/sidebar.js +18 -18
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +9 -6
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +12 -12
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +45 -45
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -68
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +7 -5
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +2 -2
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +17 -0
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +120 -90
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +12 -8
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +117 -113
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +28 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +90 -49
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +22 -2
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -43
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +36 -36
- package/package.json +7 -3
- package/src/blocks/data-table.tsx +56 -4
- package/src/blocks/sidebar.tsx +5 -5
- package/src/components/breadcrumb.tsx +6 -3
- package/src/components/button.tsx +7 -1
- package/src/components/hover-card.tsx +6 -3
- package/src/components/logo.tsx +3 -3
- package/src/components/navigation-menu.tsx +113 -32
- package/src/components/pagination.tsx +47 -67
- package/src/components/progress.tsx +118 -14
- package/src/components/skeleton.tsx +1 -1
- package/src/components/sonner.tsx +1 -1
- package/src/components/table.tsx +44 -7
- package/src/components/tooltip.tsx +8 -5
- package/src/lib/utils.ts +3 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
1
|
+
import { jsx as a, jsxs as w, Fragment as k } from "react/jsx-runtime";
|
|
2
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
|
|
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
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
|
|
6
|
-
import { cn as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Checkbox as
|
|
9
|
-
import { InputGroup as
|
|
10
|
-
import { usePagination as be, Pagination as Se, PaginationContent as we, PaginationItem as
|
|
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
11
|
import { Skeleton as Re } from "../skeleton.js";
|
|
12
|
-
import { Table as
|
|
13
|
-
function
|
|
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
14
|
const [t, i] = m.useState(n), o = e !== void 0 ? e : t, r = m.useRef(o);
|
|
15
15
|
m.useEffect(() => {
|
|
16
16
|
r.current = o;
|
|
@@ -24,7 +24,7 @@ function R(e, n, l) {
|
|
|
24
24
|
);
|
|
25
25
|
return [o, c];
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Oe(e) {
|
|
28
28
|
const {
|
|
29
29
|
columns: n,
|
|
30
30
|
data: l,
|
|
@@ -36,45 +36,45 @@ function Qe(e) {
|
|
|
36
36
|
manualSorting: c = !1,
|
|
37
37
|
manualFiltering: s = !1,
|
|
38
38
|
manualPagination: u = !1,
|
|
39
|
-
rowCount:
|
|
39
|
+
rowCount: h,
|
|
40
40
|
pageCount: g,
|
|
41
41
|
enableExpanding: f = !1,
|
|
42
|
-
getSubRows:
|
|
43
|
-
getRowId:
|
|
44
|
-
pagination:
|
|
45
|
-
onPaginationChange:
|
|
46
|
-
sorting:
|
|
47
|
-
onSortingChange:
|
|
48
|
-
globalFilter:
|
|
49
|
-
onGlobalFilterChange:
|
|
50
|
-
rowSelection:
|
|
51
|
-
onRowSelectionChange:
|
|
52
|
-
expanded:
|
|
53
|
-
onExpandedChange:
|
|
54
|
-
} = e, [
|
|
55
|
-
|
|
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
56
|
{ pageIndex: 0, pageSize: d },
|
|
57
|
-
|
|
58
|
-
), [
|
|
59
|
-
|
|
57
|
+
F
|
|
58
|
+
), [K, O] = T(
|
|
59
|
+
D,
|
|
60
60
|
[],
|
|
61
|
-
|
|
62
|
-
), [
|
|
63
|
-
|
|
61
|
+
R
|
|
62
|
+
), [Q, Y] = T(
|
|
63
|
+
N,
|
|
64
64
|
"",
|
|
65
|
-
|
|
66
|
-
), [Z, ee] =
|
|
67
|
-
|
|
65
|
+
S
|
|
66
|
+
), [Z, ee] = T(M, {}, y), [ae, te] = T(
|
|
67
|
+
z,
|
|
68
68
|
{},
|
|
69
|
-
|
|
69
|
+
A
|
|
70
70
|
);
|
|
71
71
|
return ne({
|
|
72
72
|
data: l,
|
|
73
73
|
columns: n,
|
|
74
74
|
getCoreRowModel: se(),
|
|
75
|
-
...
|
|
75
|
+
...C && { getRowId: C },
|
|
76
76
|
...(r || u) && {
|
|
77
|
-
onPaginationChange:
|
|
77
|
+
onPaginationChange: J
|
|
78
78
|
},
|
|
79
79
|
...r && {
|
|
80
80
|
...!u && {
|
|
@@ -83,14 +83,14 @@ function Qe(e) {
|
|
|
83
83
|
},
|
|
84
84
|
...u && {
|
|
85
85
|
manualPagination: !0,
|
|
86
|
-
...
|
|
86
|
+
...h != null && { rowCount: h },
|
|
87
87
|
...g != null && { pageCount: g }
|
|
88
88
|
},
|
|
89
89
|
...t && {
|
|
90
90
|
...!c && {
|
|
91
91
|
getSortedRowModel: ie()
|
|
92
92
|
},
|
|
93
|
-
onSortingChange:
|
|
93
|
+
onSortingChange: O,
|
|
94
94
|
...c && { manualSorting: !0 }
|
|
95
95
|
},
|
|
96
96
|
...i && {
|
|
@@ -108,18 +108,18 @@ function Qe(e) {
|
|
|
108
108
|
...f && {
|
|
109
109
|
getExpandedRowModel: oe(),
|
|
110
110
|
onExpandedChange: te,
|
|
111
|
-
getSubRows:
|
|
111
|
+
getSubRows: b
|
|
112
112
|
},
|
|
113
113
|
state: {
|
|
114
|
-
pagination:
|
|
115
|
-
sorting:
|
|
116
|
-
globalFilter:
|
|
114
|
+
pagination: I,
|
|
115
|
+
sorting: K,
|
|
116
|
+
globalFilter: Q,
|
|
117
117
|
rowSelection: Z,
|
|
118
118
|
expanded: ae
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function De({
|
|
123
123
|
table: e,
|
|
124
124
|
dataHook: n,
|
|
125
125
|
trackingEl: l,
|
|
@@ -129,52 +129,66 @@ function ye({
|
|
|
129
129
|
noResultsMessage: r = "No results.",
|
|
130
130
|
stickyHeader: d = !1,
|
|
131
131
|
className: c,
|
|
132
|
-
|
|
132
|
+
layout: s,
|
|
133
|
+
minWidth: u,
|
|
134
|
+
scrollRegionLabel: h,
|
|
135
|
+
footer: g
|
|
133
136
|
}) {
|
|
134
|
-
const
|
|
137
|
+
const f = e.getVisibleLeafColumns().length, b = o ?? e.getState().pagination.pageSize ?? 10;
|
|
135
138
|
return /* @__PURE__ */ a(
|
|
136
139
|
"div",
|
|
137
140
|
{
|
|
138
141
|
"aria-busy": i || void 0,
|
|
139
|
-
className:
|
|
142
|
+
className: p("border-border overflow-auto rounded-md border", c),
|
|
140
143
|
"data-hook": n,
|
|
141
144
|
"data-slot": "data-table-view",
|
|
142
145
|
"data-tracking-el": l,
|
|
143
146
|
"data-tracking-label": t,
|
|
144
|
-
children: /* @__PURE__ */
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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, { colSpan: f, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: r }) }) }) }) }),
|
|
166
|
+
g
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
)
|
|
158
170
|
}
|
|
159
171
|
);
|
|
160
172
|
}
|
|
161
|
-
|
|
162
|
-
function
|
|
173
|
+
De.displayName = "DataTable";
|
|
174
|
+
function U({
|
|
163
175
|
table: e,
|
|
164
176
|
stickyHeader: n
|
|
165
177
|
}) {
|
|
166
178
|
return /* @__PURE__ */ a(
|
|
167
179
|
Te,
|
|
168
180
|
{
|
|
169
|
-
className:
|
|
170
|
-
children: e.getHeaderGroups().map((l) => /* @__PURE__ */ a(
|
|
171
|
-
const i = t.column.getCanSort() ? t.column.getIsSorted() : !1, o = i === "asc" ? "ascending" : i === "desc" ? "descending" : t.column.getCanSort() ? "none" : void 0;
|
|
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;
|
|
172
184
|
return /* @__PURE__ */ a(
|
|
173
185
|
ke,
|
|
174
186
|
{
|
|
175
187
|
"aria-sort": o,
|
|
176
188
|
colSpan: t.colSpan,
|
|
177
|
-
|
|
189
|
+
minWidth: r?.minWidth,
|
|
190
|
+
width: r?.width,
|
|
191
|
+
children: t.isPlaceholder ? null : j(
|
|
178
192
|
t.column.columnDef.header,
|
|
179
193
|
t.getContext()
|
|
180
194
|
)
|
|
@@ -185,14 +199,14 @@ function G({
|
|
|
185
199
|
}
|
|
186
200
|
);
|
|
187
201
|
}
|
|
188
|
-
function
|
|
189
|
-
return /* @__PURE__ */ a(
|
|
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)) });
|
|
190
204
|
}
|
|
191
|
-
function
|
|
205
|
+
function _({
|
|
192
206
|
rowCount: e,
|
|
193
207
|
colCount: n
|
|
194
208
|
}) {
|
|
195
|
-
return /* @__PURE__ */ a(
|
|
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}`)) });
|
|
196
210
|
}
|
|
197
211
|
function Ne({
|
|
198
212
|
table: e,
|
|
@@ -204,54 +218,66 @@ function Ne({
|
|
|
204
218
|
noResultsMessage: r = "No results.",
|
|
205
219
|
stickyHeader: d = !1,
|
|
206
220
|
className: c,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
221
|
+
layout: s,
|
|
222
|
+
minWidth: u,
|
|
223
|
+
scrollRegionLabel: h,
|
|
224
|
+
footer: g,
|
|
225
|
+
height: f,
|
|
226
|
+
estimateSize: b = 48,
|
|
227
|
+
overscan: C = 5
|
|
211
228
|
}) {
|
|
212
|
-
const
|
|
213
|
-
count:
|
|
214
|
-
getScrollElement: () =>
|
|
215
|
-
estimateSize: () =>
|
|
216
|
-
overscan:
|
|
217
|
-
}),
|
|
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;
|
|
218
235
|
return /* @__PURE__ */ a(
|
|
219
236
|
"div",
|
|
220
237
|
{
|
|
221
|
-
ref:
|
|
238
|
+
ref: D,
|
|
222
239
|
"aria-busy": i || void 0,
|
|
223
|
-
className:
|
|
240
|
+
className: p("border-border overflow-auto rounded-md border", c),
|
|
224
241
|
"data-hook": n,
|
|
225
242
|
"data-slot": "data-table-view",
|
|
226
243
|
"data-tracking-el": l,
|
|
227
244
|
"data-tracking-label": t,
|
|
228
|
-
style:
|
|
229
|
-
children: /* @__PURE__ */
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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, { colSpan: x, children: /* @__PURE__ */ a("div", { "aria-live": "polite", role: "status", children: r }) }) }) }),
|
|
272
|
+
g
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
)
|
|
250
276
|
}
|
|
251
277
|
);
|
|
252
278
|
}
|
|
253
279
|
Ne.displayName = "VirtualizedDataTable";
|
|
254
|
-
function
|
|
280
|
+
function ye({
|
|
255
281
|
column: e,
|
|
256
282
|
title: n,
|
|
257
283
|
className: l,
|
|
@@ -265,7 +291,7 @@ function De({
|
|
|
265
291
|
return /* @__PURE__ */ a(
|
|
266
292
|
"div",
|
|
267
293
|
{
|
|
268
|
-
className:
|
|
294
|
+
className: p(
|
|
269
295
|
"text-muted-foreground text-left text-sm leading-normal font-medium",
|
|
270
296
|
r === "right" && "text-right",
|
|
271
297
|
r === "center" && "text-center",
|
|
@@ -282,7 +308,7 @@ function De({
|
|
|
282
308
|
return /* @__PURE__ */ a(
|
|
283
309
|
"div",
|
|
284
310
|
{
|
|
285
|
-
className:
|
|
311
|
+
className: p(
|
|
286
312
|
"flex items-center",
|
|
287
313
|
r === "right" && "justify-end",
|
|
288
314
|
r === "center" && "justify-center",
|
|
@@ -291,8 +317,8 @@ function De({
|
|
|
291
317
|
"data-slot": "data-table-column-header",
|
|
292
318
|
"data-tracking-el": i,
|
|
293
319
|
"data-tracking-label": o,
|
|
294
|
-
children: /* @__PURE__ */
|
|
295
|
-
|
|
320
|
+
children: /* @__PURE__ */ w(
|
|
321
|
+
E,
|
|
296
322
|
{
|
|
297
323
|
"aria-label": s,
|
|
298
324
|
className: "text-muted-foreground h-auto p-0 text-sm font-medium",
|
|
@@ -316,7 +342,7 @@ function De({
|
|
|
316
342
|
}
|
|
317
343
|
);
|
|
318
344
|
}
|
|
319
|
-
|
|
345
|
+
ye.displayName = "DataTableColumnHeader";
|
|
320
346
|
function ze({
|
|
321
347
|
table: e,
|
|
322
348
|
ariaLabel: n,
|
|
@@ -327,8 +353,8 @@ function ze({
|
|
|
327
353
|
const o = e.getState().globalFilter ?? "", r = (d) => {
|
|
328
354
|
e.setGlobalFilter(d);
|
|
329
355
|
};
|
|
330
|
-
return /* @__PURE__ */
|
|
331
|
-
/* @__PURE__ */ a(
|
|
356
|
+
return /* @__PURE__ */ w(pe, { "data-slot": "data-table-search", ...i, children: [
|
|
357
|
+
/* @__PURE__ */ a(V, { className: "pl-3", children: /* @__PURE__ */ a(me, {}) }),
|
|
332
358
|
/* @__PURE__ */ a(
|
|
333
359
|
fe,
|
|
334
360
|
{
|
|
@@ -339,8 +365,8 @@ function ze({
|
|
|
339
365
|
onChange: (d) => r(d.target.value)
|
|
340
366
|
}
|
|
341
367
|
),
|
|
342
|
-
o && /* @__PURE__ */ a(
|
|
343
|
-
|
|
368
|
+
o && /* @__PURE__ */ a(V, { className: "pr-1", children: /* @__PURE__ */ a(
|
|
369
|
+
E,
|
|
344
370
|
{
|
|
345
371
|
"aria-label": t ?? "Clear search",
|
|
346
372
|
className: "h-auto p-1",
|
|
@@ -348,7 +374,7 @@ function ze({
|
|
|
348
374
|
dataHook: `${i.dataHook}-clear`,
|
|
349
375
|
variant: "ghost",
|
|
350
376
|
onClick: () => r(""),
|
|
351
|
-
children: /* @__PURE__ */ a(
|
|
377
|
+
children: /* @__PURE__ */ a(he, { size: 14 })
|
|
352
378
|
}
|
|
353
379
|
) })
|
|
354
380
|
] });
|
|
@@ -356,10 +382,10 @@ function ze({
|
|
|
356
382
|
ze.displayName = "DataTableSearch";
|
|
357
383
|
function Ie(e) {
|
|
358
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(
|
|
359
|
-
(
|
|
385
|
+
(b) => e.setPageIndex(b - 1),
|
|
360
386
|
[e]
|
|
361
|
-
),
|
|
362
|
-
(
|
|
387
|
+
), h = m.useCallback(() => e.nextPage(), [e]), g = m.useCallback(() => e.previousPage(), [e]), f = m.useCallback(
|
|
388
|
+
(b) => e.setPageSize(b),
|
|
363
389
|
[e]
|
|
364
390
|
);
|
|
365
391
|
return m.useMemo(
|
|
@@ -374,7 +400,7 @@ function Ie(e) {
|
|
|
374
400
|
canPrev: o,
|
|
375
401
|
canNext: r,
|
|
376
402
|
goToPage: u,
|
|
377
|
-
nextPage:
|
|
403
|
+
nextPage: h,
|
|
378
404
|
previousPage: g,
|
|
379
405
|
setPageSize: f
|
|
380
406
|
}),
|
|
@@ -389,15 +415,15 @@ function Ie(e) {
|
|
|
389
415
|
o,
|
|
390
416
|
r,
|
|
391
417
|
u,
|
|
392
|
-
|
|
418
|
+
h,
|
|
393
419
|
g,
|
|
394
420
|
f
|
|
395
421
|
]
|
|
396
422
|
);
|
|
397
423
|
}
|
|
398
|
-
const
|
|
399
|
-
function
|
|
400
|
-
const e = m.useContext(
|
|
424
|
+
const H = m.createContext(null);
|
|
425
|
+
function X() {
|
|
426
|
+
const e = m.useContext(H);
|
|
401
427
|
if (!e)
|
|
402
428
|
throw new Error(
|
|
403
429
|
"DataTablePagination sub-components must be used within <DataTablePagination>"
|
|
@@ -408,47 +434,45 @@ function $e({
|
|
|
408
434
|
renderText: e,
|
|
409
435
|
className: n
|
|
410
436
|
}) {
|
|
411
|
-
const { info: l } =
|
|
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}`;
|
|
412
438
|
return c == null ? null : /* @__PURE__ */ a(
|
|
413
439
|
"span",
|
|
414
440
|
{
|
|
415
|
-
className:
|
|
441
|
+
className: p("text-muted-foreground text-sm", n),
|
|
416
442
|
"data-slot": "data-table-pagination-row-count",
|
|
417
443
|
children: c
|
|
418
444
|
}
|
|
419
445
|
);
|
|
420
446
|
}
|
|
421
447
|
$e.displayName = "DataTablePaginationRowCount";
|
|
422
|
-
function
|
|
448
|
+
function q({
|
|
423
449
|
ariaLabel: e = "Table pagination",
|
|
424
450
|
dataHook: n,
|
|
425
451
|
className: l
|
|
426
452
|
}) {
|
|
427
|
-
const { info: t } =
|
|
453
|
+
const { info: t } = X(), i = be({
|
|
428
454
|
page: t.currentPage,
|
|
429
|
-
totalPages: t.totalPages
|
|
430
|
-
siblingCount: 1,
|
|
431
|
-
boundaryCount: 1
|
|
455
|
+
totalPages: t.totalPages
|
|
432
456
|
});
|
|
433
457
|
return /* @__PURE__ */ a(
|
|
434
458
|
Se,
|
|
435
459
|
{
|
|
436
460
|
ariaLabel: e,
|
|
437
|
-
className:
|
|
461
|
+
className: p("mx-0 w-auto justify-end", l),
|
|
438
462
|
dataHook: n ?? "pagination-nav",
|
|
439
|
-
children: /* @__PURE__ */ a(we, { children: i.map((o, r) => o === "previous" ? /* @__PURE__ */ a(
|
|
463
|
+
children: /* @__PURE__ */ a(we, { children: i.map((o, r) => o === "previous" ? /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
|
|
440
464
|
Ce,
|
|
441
465
|
{
|
|
442
466
|
disabled: !t.canPrev,
|
|
443
467
|
onClick: () => t.previousPage()
|
|
444
468
|
}
|
|
445
|
-
) }, "previous") : o === "next" ? /* @__PURE__ */ a(
|
|
469
|
+
) }, "previous") : o === "next" ? /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
|
|
446
470
|
xe,
|
|
447
471
|
{
|
|
448
472
|
disabled: !t.canNext,
|
|
449
473
|
onClick: () => t.nextPage()
|
|
450
474
|
}
|
|
451
|
-
) }, "next") : o === "ellipsis" ? /* @__PURE__ */ a(
|
|
475
|
+
) }, "next") : o === "ellipsis" ? /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(Pe, {}) }, `ellipsis-${r}`) : /* @__PURE__ */ a($, { children: /* @__PURE__ */ a(
|
|
452
476
|
ve,
|
|
453
477
|
{
|
|
454
478
|
isActive: o === t.currentPage,
|
|
@@ -459,7 +483,7 @@ function _({
|
|
|
459
483
|
}
|
|
460
484
|
);
|
|
461
485
|
}
|
|
462
|
-
|
|
486
|
+
q.displayName = "DataTablePaginationNav";
|
|
463
487
|
function Fe({
|
|
464
488
|
table: e,
|
|
465
489
|
dataHook: n,
|
|
@@ -474,18 +498,18 @@ function Fe({
|
|
|
474
498
|
const s = Ie(e), u = m.useMemo(
|
|
475
499
|
() => ({ info: s }),
|
|
476
500
|
[s]
|
|
477
|
-
),
|
|
501
|
+
), h = {
|
|
478
502
|
"data-hook": n,
|
|
479
503
|
"data-slot": "data-table-pagination",
|
|
480
504
|
"data-tracking-el": i,
|
|
481
505
|
"data-tracking-label": o
|
|
482
506
|
};
|
|
483
507
|
if (c)
|
|
484
|
-
return /* @__PURE__ */ a(
|
|
508
|
+
return /* @__PURE__ */ a(H.Provider, { value: u, children: /* @__PURE__ */ a(
|
|
485
509
|
"div",
|
|
486
510
|
{
|
|
487
|
-
className:
|
|
488
|
-
...
|
|
511
|
+
className: p("flex w-full items-center gap-4", r),
|
|
512
|
+
...h,
|
|
489
513
|
children: c
|
|
490
514
|
}
|
|
491
515
|
) });
|
|
@@ -496,19 +520,19 @@ function Fe({
|
|
|
496
520
|
pageIndex: s.pageIndex,
|
|
497
521
|
pageSize: s.pageSize
|
|
498
522
|
}) : s.totalRows === 0 ? null : `${s.startRow}-${s.endRow} of ${s.totalRows}`;
|
|
499
|
-
return /* @__PURE__ */ a(
|
|
523
|
+
return /* @__PURE__ */ a(H.Provider, { value: u, children: /* @__PURE__ */ w(
|
|
500
524
|
"div",
|
|
501
525
|
{
|
|
502
|
-
className:
|
|
526
|
+
className: p(
|
|
503
527
|
"flex w-full items-center gap-4",
|
|
504
528
|
g != null ? "justify-between" : "justify-end",
|
|
505
529
|
r
|
|
506
530
|
),
|
|
507
|
-
...
|
|
531
|
+
...h,
|
|
508
532
|
children: [
|
|
509
533
|
g != null && /* @__PURE__ */ a("span", { className: "text-muted-foreground text-sm", children: g }),
|
|
510
534
|
/* @__PURE__ */ a(
|
|
511
|
-
|
|
535
|
+
q,
|
|
512
536
|
{
|
|
513
537
|
ariaLabel: d,
|
|
514
538
|
dataHook: `${n}-nav`
|
|
@@ -527,7 +551,7 @@ function Me({
|
|
|
527
551
|
selectAllAriaLabel: i
|
|
528
552
|
}) {
|
|
529
553
|
return /* @__PURE__ */ a(
|
|
530
|
-
|
|
554
|
+
G,
|
|
531
555
|
{
|
|
532
556
|
"aria-label": i ?? "Select all",
|
|
533
557
|
checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
|
|
@@ -547,7 +571,7 @@ function Ae({
|
|
|
547
571
|
selectRowAriaLabel: i
|
|
548
572
|
}) {
|
|
549
573
|
return /* @__PURE__ */ a(
|
|
550
|
-
|
|
574
|
+
G,
|
|
551
575
|
{
|
|
552
576
|
"aria-label": i ?? "Select row",
|
|
553
577
|
checked: e.getIsSelected(),
|
|
@@ -568,7 +592,7 @@ function He({
|
|
|
568
592
|
return /* @__PURE__ */ a(
|
|
569
593
|
"div",
|
|
570
594
|
{
|
|
571
|
-
className:
|
|
595
|
+
className: p(
|
|
572
596
|
"flex flex-col gap-3 py-4 sm:flex-row sm:items-center",
|
|
573
597
|
n
|
|
574
598
|
),
|
|
@@ -586,7 +610,7 @@ function Ve({
|
|
|
586
610
|
return /* @__PURE__ */ a(
|
|
587
611
|
"div",
|
|
588
612
|
{
|
|
589
|
-
className:
|
|
613
|
+
className: p(
|
|
590
614
|
"flex w-full min-w-0 items-center gap-2 sm:w-auto sm:flex-1",
|
|
591
615
|
e
|
|
592
616
|
),
|
|
@@ -603,7 +627,7 @@ function je({
|
|
|
603
627
|
return /* @__PURE__ */ a(
|
|
604
628
|
"div",
|
|
605
629
|
{
|
|
606
|
-
className:
|
|
630
|
+
className: p(
|
|
607
631
|
"flex w-full items-center justify-end gap-2 sm:w-auto",
|
|
608
632
|
e
|
|
609
633
|
),
|
|
@@ -614,10 +638,10 @@ function je({
|
|
|
614
638
|
}
|
|
615
639
|
je.displayName = "DataTableToolbarRight";
|
|
616
640
|
export {
|
|
617
|
-
|
|
618
|
-
|
|
641
|
+
De as DataTable,
|
|
642
|
+
ye as DataTableColumnHeader,
|
|
619
643
|
Fe as DataTablePagination,
|
|
620
|
-
|
|
644
|
+
q as DataTablePaginationNav,
|
|
621
645
|
$e as DataTablePaginationRowCount,
|
|
622
646
|
ze as DataTableSearch,
|
|
623
647
|
Me as DataTableSelectAllCheckbox,
|
|
@@ -626,5 +650,5 @@ export {
|
|
|
626
650
|
Ve as DataTableToolbarLeft,
|
|
627
651
|
je as DataTableToolbarRight,
|
|
628
652
|
Ne as VirtualizedDataTable,
|
|
629
|
-
|
|
653
|
+
Oe as useDataTable
|
|
630
654
|
};
|