@adapttable/mui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1884 @@
1
+ import { rowClickProps, resolveDisabledReason, runRowAction, useSavedViews, useTableChrome, useFilterTriggerToggle, useChromeScrollReset, useChromeBodyData, useTableData, isDeclarativeFilters, resolveLabels, ACTIONS_COLUMN_KEY, useColumnDragState, columnMenuRows, GripIcon, columnReorderKeyProps, nextPinSide, pinActionLabel, resolveVirtualRows, tableRenderModel, headerGroupRow, useHorizontalOverflow, PIN_Z, pinnedCellStyle, tableMinWidth, columnResizeHandleProps, pageSizeOptions, useBulkActionRunner, EyeIcon, PinIcon, edgePinStyle, pinnedColumnWidth, RANGE_SUFFIXES, RANGE_OP_LABEL_KEYS, readRangeWidget, filterLabel, RANGE_OPS, useFilterOptions, writeRangeWidget } from '@adapttable/core';
2
+ export { createHistoryAdapter, createMemoryAdapter, defaultConfirm, defaultLabels, deriveSortByOptions, getHistoryAdapter, useBackendData, useDataTable, useFrontendData, useSavedViews, useTableUrlState } from '@adapttable/core';
3
+ import { TableRow, TableCell, Checkbox, IconButton, Stack, Tooltip, Typography, Box, Button, Popover, Divider, TextField, Paper, LinearProgress, Skeleton, Card, CardContent, Table, TableHead, TableSortLabel, TableBody, TableFooter, Badge, InputAdornment, MenuItem, Chip, Alert, Pagination, Drawer, Popper, ClickAwayListener, FormControl, FormLabel, FormGroup, CircularProgress, FormControlLabel } from '@mui/material';
4
+ import { memo, useState, useRef, useMemo, useCallback, useEffect } from 'react';
5
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
6
+
7
+ // src/components/SavedViewsMenu.tsx
8
+ function SavedViewsMenu({
9
+ options,
10
+ labels
11
+ }) {
12
+ const { views, save, apply, remove } = useSavedViews(options);
13
+ const [anchor, setAnchor] = useState(null);
14
+ const [name, setName] = useState("");
15
+ const trimmed = name.trim();
16
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
17
+ /* @__PURE__ */ jsx(
18
+ Button,
19
+ {
20
+ size: "small",
21
+ variant: "outlined",
22
+ "aria-expanded": anchor !== null,
23
+ "aria-haspopup": "true",
24
+ onClick: (e) => setAnchor(e.currentTarget),
25
+ children: labels.savedViews
26
+ }
27
+ ),
28
+ /* @__PURE__ */ jsx(
29
+ Popover,
30
+ {
31
+ anchorEl: anchor,
32
+ open: anchor !== null,
33
+ onClose: () => setAnchor(null),
34
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
35
+ children: /* @__PURE__ */ jsxs(Box, { sx: { p: 0.75, minWidth: 250 }, children: [
36
+ views.map((view) => /* @__PURE__ */ jsxs(
37
+ Stack,
38
+ {
39
+ direction: "row",
40
+ alignItems: "center",
41
+ spacing: 0.5,
42
+ children: [
43
+ /* @__PURE__ */ jsx(
44
+ Button,
45
+ {
46
+ size: "small",
47
+ fullWidth: true,
48
+ sx: { justifyContent: "flex-start" },
49
+ onClick: () => {
50
+ apply(view.name);
51
+ setAnchor(null);
52
+ },
53
+ children: view.name
54
+ }
55
+ ),
56
+ /* @__PURE__ */ jsx(
57
+ IconButton,
58
+ {
59
+ size: "small",
60
+ "aria-label": `${labels.deleteView}: ${view.name}`,
61
+ onClick: () => remove(view.name),
62
+ children: "\xD7"
63
+ }
64
+ )
65
+ ]
66
+ },
67
+ view.name
68
+ )),
69
+ /* @__PURE__ */ jsx(Divider, { sx: { my: 0.5 } }),
70
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
71
+ /* @__PURE__ */ jsx(
72
+ TextField,
73
+ {
74
+ size: "small",
75
+ value: name,
76
+ placeholder: labels.viewName,
77
+ slotProps: { htmlInput: { "aria-label": labels.viewName } },
78
+ onChange: (e) => setName(e.target.value)
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(
82
+ Button,
83
+ {
84
+ size: "small",
85
+ variant: "contained",
86
+ disabled: trimmed === "",
87
+ onClick: () => {
88
+ save(trimmed);
89
+ setName("");
90
+ },
91
+ children: labels.saveView
92
+ }
93
+ )
94
+ ] })
95
+ ] })
96
+ }
97
+ )
98
+ ] });
99
+ }
100
+ function scalarText(value) {
101
+ return typeof value === "string" || typeof value === "number" ? String(value) : "";
102
+ }
103
+ function selectedList(value) {
104
+ return Array.isArray(value) ? value : [];
105
+ }
106
+ function TextFilter({ def, source }) {
107
+ return /* @__PURE__ */ jsx(
108
+ TextField,
109
+ {
110
+ size: "small",
111
+ label: filterLabel(def),
112
+ placeholder: def.placeholder,
113
+ value: scalarText(source.extra[def.key]),
114
+ onChange: (e) => source.setExtra(def.key, e.target.value)
115
+ }
116
+ );
117
+ }
118
+ function SelectFilter({ def, source }) {
119
+ const { options, loading } = useFilterOptions(def);
120
+ return /* @__PURE__ */ jsxs(
121
+ TextField,
122
+ {
123
+ select: true,
124
+ size: "small",
125
+ label: filterLabel(def),
126
+ value: scalarText(source.extra[def.key]),
127
+ onChange: (e) => source.setExtra(def.key, e.target.value),
128
+ slotProps: {
129
+ select: { native: true },
130
+ inputLabel: { shrink: true }
131
+ },
132
+ children: [
133
+ /* @__PURE__ */ jsx("option", { value: "", children: "All" }),
134
+ loading && /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "\u2026" }),
135
+ options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
136
+ ]
137
+ }
138
+ );
139
+ }
140
+ function MultiSelectFilter({ def, source }) {
141
+ const { options, loading } = useFilterOptions(def);
142
+ const checked = selectedList(source.extra[def.key]);
143
+ const toggle = (value, on) => {
144
+ const next = on ? [...checked, value] : checked.filter((v) => v !== value);
145
+ source.setExtra(def.key, next);
146
+ };
147
+ return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", variant: "standard", children: [
148
+ /* @__PURE__ */ jsx(FormLabel, { component: "legend", children: filterLabel(def) }),
149
+ /* @__PURE__ */ jsx(FormGroup, { row: true, sx: { columnGap: 1.5 }, children: loading ? /* @__PURE__ */ jsx(CircularProgress, { size: 16 }) : options.map((option) => /* @__PURE__ */ jsx(
150
+ FormControlLabel,
151
+ {
152
+ label: option.label,
153
+ control: /* @__PURE__ */ jsx(
154
+ Checkbox,
155
+ {
156
+ size: "small",
157
+ checked: checked.includes(option.value),
158
+ onChange: (_, on) => toggle(option.value, on)
159
+ }
160
+ )
161
+ },
162
+ option.value
163
+ )) })
164
+ ] });
165
+ }
166
+ function RangeFilter({
167
+ def,
168
+ type,
169
+ source,
170
+ labels
171
+ }) {
172
+ const suffixes = RANGE_SUFFIXES[type];
173
+ const lowKey = def.key + suffixes.start;
174
+ const highKey = def.key + suffixes.end;
175
+ const opLabelKeys = RANGE_OP_LABEL_KEYS[type === "dateRange" ? "date" : "number"];
176
+ const state = readRangeWidget(source.extra, lowKey, highKey);
177
+ const [op, setOp] = useState(state.op);
178
+ const single = op === "lte" ? state.b : state.a;
179
+ const commit = (next, a, b) => source.setExtras(writeRangeWidget(next, a, b, lowKey, highKey));
180
+ const changeOp = (raw) => {
181
+ const next = RANGE_OPS.find((candidate) => candidate === raw);
182
+ setOp(next);
183
+ commit(next, single, op === "between" ? state.b : "");
184
+ };
185
+ const input = (label, value, write) => /* @__PURE__ */ jsx(
186
+ TextField,
187
+ {
188
+ size: "small",
189
+ sx: { flex: "1 1 7rem", minWidth: "7rem" },
190
+ type: type === "dateRange" ? "date" : "number",
191
+ label,
192
+ value,
193
+ onChange: (e) => write(e.target.value),
194
+ slotProps: { inputLabel: { shrink: true } }
195
+ }
196
+ );
197
+ let bounds = null;
198
+ if (op === "between") {
199
+ bounds = /* @__PURE__ */ jsxs(Fragment, { children: [
200
+ input(labels.from, state.a, (raw) => commit("between", raw, state.b)),
201
+ input(labels.to, state.b, (raw) => commit("between", state.a, raw))
202
+ ] });
203
+ } else if (op !== void 0) {
204
+ bounds = input(labels.value, single, (raw) => commit(op, raw, ""));
205
+ }
206
+ return /* @__PURE__ */ jsxs(FormControl, { component: "fieldset", variant: "standard", sx: { width: "100%" }, children: [
207
+ /* @__PURE__ */ jsx(FormLabel, { component: "legend", sx: { mb: 0.75 }, children: filterLabel(def) }),
208
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: [
209
+ /* @__PURE__ */ jsxs(
210
+ TextField,
211
+ {
212
+ select: true,
213
+ size: "small",
214
+ label: labels.operator,
215
+ value: op ?? "",
216
+ onChange: (e) => changeOp(e.target.value),
217
+ slotProps: {
218
+ select: { native: true },
219
+ inputLabel: { shrink: true }
220
+ },
221
+ sx: { flex: "0 0 8.5rem", width: "8.5rem" },
222
+ children: [
223
+ /* @__PURE__ */ jsx("option", { value: "" }),
224
+ RANGE_OPS.map((candidate) => /* @__PURE__ */ jsx("option", { value: candidate, children: labels[opLabelKeys[candidate]] }, candidate))
225
+ ]
226
+ }
227
+ ),
228
+ bounds
229
+ ] })
230
+ ] });
231
+ }
232
+ function FilterField({
233
+ def,
234
+ source,
235
+ labels
236
+ }) {
237
+ switch (def.type) {
238
+ case "text":
239
+ return /* @__PURE__ */ jsx(TextFilter, { def, source });
240
+ case "select":
241
+ return /* @__PURE__ */ jsx(SelectFilter, { def, source });
242
+ case "multiSelect":
243
+ return /* @__PURE__ */ jsx(MultiSelectFilter, { def, source });
244
+ case "dateRange":
245
+ case "numberRange":
246
+ return /* @__PURE__ */ jsx(
247
+ RangeFilter,
248
+ {
249
+ def,
250
+ type: def.type,
251
+ source,
252
+ labels
253
+ }
254
+ );
255
+ }
256
+ }
257
+ function AutoFilterForm({
258
+ defs,
259
+ source,
260
+ labels
261
+ }) {
262
+ return /* @__PURE__ */ jsx(Stack, { spacing: 1.5, children: defs.map((def) => /* @__PURE__ */ jsx(FilterField, { def, source, labels }, def.key)) });
263
+ }
264
+ function FilterPopover({
265
+ open,
266
+ onClose,
267
+ anchorEl,
268
+ filters,
269
+ activeFilterCount,
270
+ onClearFilters,
271
+ labels,
272
+ dir = "ltr"
273
+ }) {
274
+ useEffect(() => {
275
+ if (!open) return;
276
+ const onKeyDown = (event) => {
277
+ if (event.key === "Escape") onClose();
278
+ };
279
+ document.addEventListener("keydown", onKeyDown);
280
+ return () => document.removeEventListener("keydown", onKeyDown);
281
+ }, [open, onClose]);
282
+ return /* @__PURE__ */ jsx(
283
+ Popper,
284
+ {
285
+ open: open && anchorEl !== null,
286
+ anchorEl,
287
+ placement: dir === "rtl" ? "bottom-start" : "bottom-end",
288
+ modifiers: [{ name: "offset", options: { offset: [0, 4] } }],
289
+ style: { zIndex: 1300 },
290
+ children: /* @__PURE__ */ jsx(ClickAwayListener, { mouseEvent: "onMouseDown", onClickAway: onClose, children: /* @__PURE__ */ jsx(
291
+ Paper,
292
+ {
293
+ elevation: 8,
294
+ sx: {
295
+ width: 360,
296
+ maxWidth: "calc(100vw - 32px)",
297
+ borderRadius: 2
298
+ },
299
+ children: /* @__PURE__ */ jsxs(Box, { sx: { p: 2, display: "flex", flexDirection: "column", gap: 2 }, children: [
300
+ /* @__PURE__ */ jsxs(
301
+ Stack,
302
+ {
303
+ direction: "row",
304
+ justifyContent: "space-between",
305
+ alignItems: "center",
306
+ children: [
307
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", fontWeight: 600, children: labels.filters }),
308
+ /* @__PURE__ */ jsx(
309
+ Button,
310
+ {
311
+ size: "small",
312
+ onClick: onClearFilters,
313
+ disabled: activeFilterCount === 0,
314
+ children: labels.clearAll
315
+ }
316
+ )
317
+ ]
318
+ }
319
+ ),
320
+ /* @__PURE__ */ jsx(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: filters })
321
+ ] })
322
+ }
323
+ ) })
324
+ }
325
+ );
326
+ }
327
+ function FiltersIcon() {
328
+ return /* @__PURE__ */ jsx(
329
+ "svg",
330
+ {
331
+ width: "16",
332
+ height: "16",
333
+ viewBox: "0 0 24 24",
334
+ fill: "none",
335
+ stroke: "currentColor",
336
+ strokeWidth: "1.8",
337
+ strokeLinecap: "round",
338
+ strokeLinejoin: "round",
339
+ "aria-hidden": "true",
340
+ children: /* @__PURE__ */ jsx("path", { d: "M3 5h18l-7 8v5l-4 2v-7L3 5Z" })
341
+ }
342
+ );
343
+ }
344
+ function SearchIcon() {
345
+ return /* @__PURE__ */ jsxs(
346
+ "svg",
347
+ {
348
+ width: "18",
349
+ height: "18",
350
+ viewBox: "0 0 24 24",
351
+ fill: "none",
352
+ stroke: "currentColor",
353
+ strokeWidth: "1.8",
354
+ strokeLinecap: "round",
355
+ strokeLinejoin: "round",
356
+ "aria-hidden": "true",
357
+ children: [
358
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
359
+ /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
360
+ ]
361
+ }
362
+ );
363
+ }
364
+ var srOnly = {
365
+ position: "absolute",
366
+ width: 1,
367
+ height: 1,
368
+ padding: 0,
369
+ margin: -1,
370
+ overflow: "hidden",
371
+ clip: "rect(0 0 0 0)",
372
+ whiteSpace: "nowrap",
373
+ border: 0
374
+ };
375
+ function Toolbar({
376
+ table,
377
+ hideSearch,
378
+ searchPlaceholder,
379
+ sortByOptions,
380
+ customToolbar,
381
+ hasFilters,
382
+ activeFilterCount,
383
+ showRowsPerPage,
384
+ filtersMode,
385
+ filters,
386
+ filtersOpen,
387
+ onToggleFilters,
388
+ onFiltersTriggerPointerDown,
389
+ onCloseFilters,
390
+ onClearFilters,
391
+ dir,
392
+ columnMenu
393
+ }) {
394
+ const { labels, source } = table;
395
+ const sortOptions = sortByOptions ?? (table.isMobile ? table.sortByOptions : void 0);
396
+ const searchProps = table.getSearchInputProps(
397
+ searchPlaceholder ? { placeholder: searchPlaceholder } : void 0
398
+ );
399
+ const filtersAnchorRef = useRef(null);
400
+ const filtersButton = hasFilters ? /* @__PURE__ */ jsx(Badge, { color: "primary", badgeContent: activeFilterCount, children: /* @__PURE__ */ jsx(
401
+ Button,
402
+ {
403
+ ref: filtersAnchorRef,
404
+ variant: "outlined",
405
+ size: "small",
406
+ startIcon: /* @__PURE__ */ jsx(FiltersIcon, {}),
407
+ "aria-expanded": filtersMode === "popover" ? filtersOpen : void 0,
408
+ onPointerDown: onFiltersTriggerPointerDown,
409
+ onClick: onToggleFilters,
410
+ children: labels.filters
411
+ }
412
+ ) }) : null;
413
+ return /* @__PURE__ */ jsxs(
414
+ Stack,
415
+ {
416
+ direction: "row",
417
+ spacing: 1,
418
+ flexWrap: "wrap",
419
+ useFlexGap: true,
420
+ alignItems: "center",
421
+ justifyContent: "space-between",
422
+ children: [
423
+ !hideSearch && /* @__PURE__ */ jsx(
424
+ TextField,
425
+ {
426
+ size: "small",
427
+ value: searchProps.value,
428
+ placeholder: searchProps.placeholder,
429
+ slotProps: {
430
+ htmlInput: { "aria-label": labels.search, type: "search" },
431
+ input: {
432
+ startAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx(SearchIcon, {}) })
433
+ }
434
+ },
435
+ onChange: searchProps.onChange,
436
+ sx: { flex: 1, minWidth: 160, maxWidth: 360 }
437
+ }
438
+ ),
439
+ /* @__PURE__ */ jsxs(
440
+ Stack,
441
+ {
442
+ direction: "row",
443
+ spacing: 1,
444
+ alignItems: "center",
445
+ flexWrap: "wrap",
446
+ useFlexGap: true,
447
+ children: [
448
+ sortOptions && sortOptions.length > 0 && /* @__PURE__ */ jsxs(
449
+ TextField,
450
+ {
451
+ select: true,
452
+ size: "small",
453
+ label: labels.sortBy,
454
+ value: source.sortBy ?? "",
455
+ onChange: (e) => source.setSort(
456
+ e.target.value || void 0,
457
+ source.sortDir ?? "asc"
458
+ ),
459
+ sx: { minWidth: 160 },
460
+ children: [
461
+ /* @__PURE__ */ jsx(MenuItem, { value: "", children: "\u2014" }),
462
+ sortOptions.map((o) => /* @__PURE__ */ jsx(MenuItem, { value: o.value, children: o.label }, o.value))
463
+ ]
464
+ }
465
+ ),
466
+ customToolbar,
467
+ filtersButton,
468
+ hasFilters && filtersMode === "popover" && /* @__PURE__ */ jsx(
469
+ FilterPopover,
470
+ {
471
+ open: filtersOpen,
472
+ onClose: onCloseFilters,
473
+ anchorEl: filtersAnchorRef.current,
474
+ filters,
475
+ activeFilterCount,
476
+ onClearFilters,
477
+ labels,
478
+ dir
479
+ }
480
+ ),
481
+ columnMenu,
482
+ showRowsPerPage && /* @__PURE__ */ jsx(
483
+ TextField,
484
+ {
485
+ select: true,
486
+ size: "small",
487
+ label: labels.rowsPerPage,
488
+ value: source.limit,
489
+ onChange: (e) => source.setLimit(Number(e.target.value)),
490
+ sx: { minWidth: 110 },
491
+ children: pageSizeOptions(source.limit).map((n) => /* @__PURE__ */ jsx(MenuItem, { value: n, children: n }, n))
492
+ }
493
+ )
494
+ ]
495
+ }
496
+ )
497
+ ]
498
+ }
499
+ );
500
+ }
501
+ function Chips({
502
+ chips,
503
+ onClearAll,
504
+ labels
505
+ }) {
506
+ if (chips.length === 0) return null;
507
+ return /* @__PURE__ */ jsxs(
508
+ Stack,
509
+ {
510
+ direction: "row",
511
+ spacing: 0.5,
512
+ flexWrap: "wrap",
513
+ useFlexGap: true,
514
+ component: "ul",
515
+ sx: { listStyle: "none", p: 0, m: 0 },
516
+ "aria-label": labels.filters,
517
+ children: [
518
+ chips.map((chip) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
519
+ Chip,
520
+ {
521
+ label: chip.label,
522
+ size: "small",
523
+ onDelete: chip.onRemove,
524
+ deleteIcon: /* @__PURE__ */ jsx("span", { "aria-label": `${labels.clearAll}: ${chip.label}`, children: "\xD7" })
525
+ }
526
+ ) }, chip.key)),
527
+ /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Button, { size: "small", onClick: onClearAll, children: labels.clearAll }) })
528
+ ]
529
+ }
530
+ );
531
+ }
532
+ function BulkBar({
533
+ selection,
534
+ total,
535
+ bulkActions,
536
+ confirm,
537
+ labels
538
+ }) {
539
+ const {
540
+ selectedIds,
541
+ selectedCount,
542
+ headerState,
543
+ visibleIds,
544
+ allMatching,
545
+ selectAllMatching,
546
+ clear
547
+ } = selection;
548
+ const { pending, run } = useBulkActionRunner({
549
+ confirm,
550
+ cancelLabel: labels.cancel,
551
+ onComplete: clear
552
+ });
553
+ if (selectedCount === 0) return null;
554
+ const ids = [...selectedIds];
555
+ const showBanner = headerState === "all" && total > visibleIds.length;
556
+ return /* @__PURE__ */ jsxs(
557
+ Stack,
558
+ {
559
+ direction: "row",
560
+ spacing: 1,
561
+ alignItems: "center",
562
+ justifyContent: "space-between",
563
+ flexWrap: "wrap",
564
+ useFlexGap: true,
565
+ children: [
566
+ /* @__PURE__ */ jsxs(
567
+ Stack,
568
+ {
569
+ direction: "row",
570
+ spacing: 1,
571
+ alignItems: "center",
572
+ flexWrap: "wrap",
573
+ useFlexGap: true,
574
+ children: [
575
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", children: labels.selectedCount(selectedCount) }),
576
+ showBanner && (allMatching ? /* @__PURE__ */ jsxs(Fragment, { children: [
577
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: labels.allMatchingSelected(total) }),
578
+ /* @__PURE__ */ jsx(
579
+ Button,
580
+ {
581
+ size: "small",
582
+ variant: "text",
583
+ onClick: clear,
584
+ disabled: pending !== null,
585
+ children: labels.clearAll
586
+ }
587
+ )
588
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
589
+ /* @__PURE__ */ jsx(Typography, { variant: "body2", color: "text.secondary", children: labels.pageSelected(visibleIds.length) }),
590
+ /* @__PURE__ */ jsx(
591
+ Button,
592
+ {
593
+ size: "small",
594
+ variant: "text",
595
+ onClick: selectAllMatching,
596
+ disabled: pending !== null,
597
+ children: labels.selectAllMatching(total)
598
+ }
599
+ )
600
+ ] }))
601
+ ]
602
+ }
603
+ ),
604
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, flexWrap: "wrap", useFlexGap: true, children: [
605
+ /* @__PURE__ */ jsx(
606
+ Button,
607
+ {
608
+ size: "small",
609
+ variant: "text",
610
+ onClick: clear,
611
+ disabled: pending !== null,
612
+ children: labels.clearAll
613
+ }
614
+ ),
615
+ bulkActions.map((action) => {
616
+ const reason = resolveDisabledReason(action.disabledReason?.(ids));
617
+ return /* @__PURE__ */ jsx(Tooltip, { title: reason ?? "", children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
618
+ Button,
619
+ {
620
+ size: "small",
621
+ variant: "contained",
622
+ color: action.color,
623
+ startIcon: action.icon,
624
+ disabled: reason !== void 0 || pending !== null,
625
+ onClick: () => run(
626
+ action,
627
+ ids,
628
+ allMatching ? { allMatching: true, total } : void 0
629
+ ),
630
+ children: action.label
631
+ }
632
+ ) }) }, action.key);
633
+ })
634
+ ] })
635
+ ]
636
+ }
637
+ );
638
+ }
639
+ function Footer({
640
+ pagination,
641
+ total,
642
+ limit,
643
+ setPage,
644
+ setLimit,
645
+ labels
646
+ }) {
647
+ return /* @__PURE__ */ jsxs(
648
+ Stack,
649
+ {
650
+ direction: "row",
651
+ spacing: 2,
652
+ alignItems: "center",
653
+ justifyContent: "space-between",
654
+ flexWrap: "wrap",
655
+ useFlexGap: true,
656
+ children: [
657
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1.5, alignItems: "center", useFlexGap: true, children: [
658
+ /* @__PURE__ */ jsx(
659
+ TextField,
660
+ {
661
+ select: true,
662
+ size: "small",
663
+ label: labels.rowsPerPage,
664
+ value: String(limit),
665
+ onChange: (e) => setLimit(Number(e.target.value)),
666
+ sx: { minWidth: 100 },
667
+ children: pageSizeOptions(limit).map((n) => /* @__PURE__ */ jsx(MenuItem, { value: String(n), children: n }, n))
668
+ }
669
+ ),
670
+ total > 0 && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: labels.showing({
671
+ from: pagination.fromIndex,
672
+ to: pagination.toIndex,
673
+ total
674
+ }) })
675
+ ] }),
676
+ /* @__PURE__ */ jsx(
677
+ Pagination,
678
+ {
679
+ count: pagination.totalPages,
680
+ page: pagination.safePage,
681
+ onChange: (_, page) => setPage(page),
682
+ size: "small",
683
+ getItemAriaLabel: (type, page) => {
684
+ if (type === "page") return labels.goToPage(page);
685
+ return type === "previous" ? labels.previousPage : labels.nextPage;
686
+ }
687
+ }
688
+ )
689
+ ]
690
+ }
691
+ );
692
+ }
693
+ function ErrorState({
694
+ error,
695
+ labels,
696
+ onRetry
697
+ }) {
698
+ return /* @__PURE__ */ jsxs(
699
+ Alert,
700
+ {
701
+ severity: "error",
702
+ action: onRetry ? /* @__PURE__ */ jsx(Button, { color: "inherit", size: "small", onClick: onRetry, children: labels.retry }) : void 0,
703
+ children: [
704
+ /* @__PURE__ */ jsx("strong", { children: labels.errorTitle }),
705
+ " \u2014 ",
706
+ error.message
707
+ ]
708
+ }
709
+ );
710
+ }
711
+ function LoadingState({
712
+ rows,
713
+ columns,
714
+ loadingLabel
715
+ }) {
716
+ return /* @__PURE__ */ jsxs(
717
+ Box,
718
+ {
719
+ role: "status",
720
+ "aria-busy": "true",
721
+ "aria-live": "polite",
722
+ "data-testid": "adapttable-loading",
723
+ children: [
724
+ Array.from({ length: rows }, (_, r) => /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 2, sx: { py: 1 }, children: Array.from({ length: Math.max(columns, 1) }, (_2, c) => /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: c === 0 ? "30%" : "20%" }, c)) }, r)),
725
+ loadingLabel ? /* @__PURE__ */ jsx(Box, { component: "span", sx: srOnly, children: loadingLabel }) : null
726
+ ]
727
+ }
728
+ );
729
+ }
730
+ function FilterDrawer({
731
+ open,
732
+ onClose,
733
+ filters,
734
+ activeFilterCount,
735
+ onClearFilters,
736
+ labels,
737
+ dir = "ltr"
738
+ }) {
739
+ return /* @__PURE__ */ jsx(
740
+ Drawer,
741
+ {
742
+ anchor: dir === "rtl" ? "left" : "right",
743
+ open,
744
+ onClose,
745
+ children: /* @__PURE__ */ jsxs(
746
+ Box,
747
+ {
748
+ sx: {
749
+ width: 360,
750
+ p: 2,
751
+ display: "flex",
752
+ flexDirection: "column",
753
+ gap: 2,
754
+ height: "100%"
755
+ },
756
+ children: [
757
+ /* @__PURE__ */ jsx(Typography, { variant: "h6", children: labels.filters }),
758
+ /* @__PURE__ */ jsx(Box, { sx: { flex: 1, display: "flex", flexDirection: "column", gap: 2 }, children: filters }),
759
+ /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", children: [
760
+ /* @__PURE__ */ jsx(Button, { onClick: onClearFilters, disabled: activeFilterCount === 0, children: labels.clearAll }),
761
+ /* @__PURE__ */ jsx(Button, { variant: "contained", onClick: onClose, children: labels.applyFilters })
762
+ ] })
763
+ ]
764
+ }
765
+ )
766
+ }
767
+ );
768
+ }
769
+ function VisibilityToggle({
770
+ hidden,
771
+ name,
772
+ labels,
773
+ onToggle
774
+ }) {
775
+ return /* @__PURE__ */ jsx(
776
+ IconButton,
777
+ {
778
+ size: "small",
779
+ "aria-label": `${hidden ? labels.showColumn : labels.hideColumn}: ${name}`,
780
+ "aria-pressed": !hidden,
781
+ color: hidden ? "default" : "primary",
782
+ onClick: onToggle,
783
+ children: /* @__PURE__ */ jsx(EyeIcon, { off: hidden })
784
+ }
785
+ );
786
+ }
787
+ function RowName({
788
+ hidden,
789
+ name
790
+ }) {
791
+ return /* @__PURE__ */ jsx(
792
+ Typography,
793
+ {
794
+ variant: "body2",
795
+ sx: {
796
+ flex: 1,
797
+ color: hidden ? "text.disabled" : "text.primary",
798
+ textDecoration: hidden ? "line-through" : "none"
799
+ },
800
+ children: name
801
+ }
802
+ );
803
+ }
804
+ function PinToggle({
805
+ active,
806
+ label,
807
+ onClick
808
+ }) {
809
+ return /* @__PURE__ */ jsx(
810
+ IconButton,
811
+ {
812
+ size: "small",
813
+ color: active ? "primary" : "default",
814
+ "aria-label": label,
815
+ onClick,
816
+ children: /* @__PURE__ */ jsx(PinIcon, {})
817
+ }
818
+ );
819
+ }
820
+ function ActionsRow({
821
+ layout,
822
+ labels
823
+ }) {
824
+ const hidden = layout.isHidden(ACTIONS_COLUMN_KEY);
825
+ const pinned = layout.state.pinned[ACTIONS_COLUMN_KEY] === "right";
826
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
827
+ /* @__PURE__ */ jsx(Divider, { sx: { my: 0.5 } }),
828
+ /* @__PURE__ */ jsxs(
829
+ Stack,
830
+ {
831
+ direction: "row",
832
+ alignItems: "center",
833
+ spacing: 0.5,
834
+ sx: { px: 0.5, py: 0.25 },
835
+ children: [
836
+ /* @__PURE__ */ jsx(Box, { "aria-hidden": true, sx: { width: 24 } }),
837
+ /* @__PURE__ */ jsx(
838
+ VisibilityToggle,
839
+ {
840
+ hidden,
841
+ name: labels.actions,
842
+ labels,
843
+ onToggle: () => layout.toggleVisible(ACTIONS_COLUMN_KEY)
844
+ }
845
+ ),
846
+ /* @__PURE__ */ jsx(RowName, { hidden, name: labels.actions }),
847
+ /* @__PURE__ */ jsx(
848
+ PinToggle,
849
+ {
850
+ active: pinned,
851
+ label: `${pinned ? labels.unpin : labels.pinRight}: ${labels.actions}`,
852
+ onClick: () => layout.setPinned(ACTIONS_COLUMN_KEY, pinned ? void 0 : "right")
853
+ }
854
+ )
855
+ ]
856
+ }
857
+ )
858
+ ] });
859
+ }
860
+ function ColumnMenu({
861
+ allColumns,
862
+ layout,
863
+ labels,
864
+ hasRowActions
865
+ }) {
866
+ const drag = useColumnDragState();
867
+ const [anchor, setAnchor] = useState(null);
868
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
869
+ /* @__PURE__ */ jsx(
870
+ Button,
871
+ {
872
+ size: "small",
873
+ variant: "outlined",
874
+ "aria-expanded": anchor !== null,
875
+ "aria-haspopup": "true",
876
+ onClick: (e) => setAnchor(e.currentTarget),
877
+ children: labels.columns
878
+ }
879
+ ),
880
+ /* @__PURE__ */ jsx(
881
+ Popover,
882
+ {
883
+ anchorEl: anchor,
884
+ open: anchor !== null,
885
+ onClose: () => setAnchor(null),
886
+ anchorOrigin: { vertical: "bottom", horizontal: "left" },
887
+ children: /* @__PURE__ */ jsxs(Box, { sx: { p: 0.75, minWidth: 250 }, children: [
888
+ /* @__PURE__ */ jsx(
889
+ Typography,
890
+ {
891
+ variant: "caption",
892
+ sx: {
893
+ display: "block",
894
+ px: 1,
895
+ pb: 0.5,
896
+ fontWeight: 600,
897
+ textTransform: "uppercase",
898
+ letterSpacing: "0.06em",
899
+ color: "text.secondary"
900
+ },
901
+ children: labels.columns
902
+ }
903
+ ),
904
+ columnMenuRows(allColumns, layout).map((r) => {
905
+ const indicator = drag.rowAttrs(r.key, r.index);
906
+ const edge = indicator["data-drop"];
907
+ const edgeOffset = edge === "before" ? "2px" : "-2px";
908
+ return /* @__PURE__ */ jsxs(
909
+ Stack,
910
+ {
911
+ direction: "row",
912
+ alignItems: "center",
913
+ spacing: 0.5,
914
+ sx: {
915
+ px: 0.5,
916
+ py: 0.25,
917
+ cursor: "grab",
918
+ opacity: "data-dragging" in indicator ? 0.4 : void 0,
919
+ boxShadow: edge ? (theme) => `inset 0 ${edgeOffset} 0 0 ${theme.palette.primary.main}` : void 0
920
+ },
921
+ ...drag.rowDragProps(r.key, r.index),
922
+ ...drag.dropProps(r.index, layout.move),
923
+ ...indicator,
924
+ children: [
925
+ /* @__PURE__ */ jsx(
926
+ IconButton,
927
+ {
928
+ size: "small",
929
+ sx: { cursor: "grab", color: "text.disabled" },
930
+ ...columnReorderKeyProps(
931
+ r.key,
932
+ r.index,
933
+ layout.move,
934
+ `${labels.moveLeft} / ${labels.moveRight}: ${r.name}`
935
+ ),
936
+ children: /* @__PURE__ */ jsx(GripIcon, {})
937
+ }
938
+ ),
939
+ /* @__PURE__ */ jsx(
940
+ VisibilityToggle,
941
+ {
942
+ hidden: r.hidden,
943
+ name: r.name,
944
+ labels,
945
+ onToggle: () => layout.toggleVisible(r.key)
946
+ }
947
+ ),
948
+ /* @__PURE__ */ jsx(RowName, { hidden: r.hidden, name: r.name }),
949
+ /* @__PURE__ */ jsx(
950
+ PinToggle,
951
+ {
952
+ active: r.pinned !== void 0,
953
+ label: `${pinActionLabel(r.pinned, labels)}: ${r.name}`,
954
+ onClick: () => layout.setPinned(r.key, nextPinSide(r.pinned))
955
+ }
956
+ )
957
+ ]
958
+ },
959
+ r.key
960
+ );
961
+ }),
962
+ hasRowActions && /* @__PURE__ */ jsx(ActionsRow, { layout, labels }),
963
+ /* @__PURE__ */ jsx(Divider, { sx: { my: 0.5 } }),
964
+ /* @__PURE__ */ jsx(
965
+ Button,
966
+ {
967
+ size: "small",
968
+ fullWidth: true,
969
+ sx: { justifyContent: "flex-start" },
970
+ onClick: () => layout.reset(),
971
+ children: labels.resetColumns
972
+ }
973
+ )
974
+ ] })
975
+ }
976
+ )
977
+ ] });
978
+ }
979
+ var RESIZE_HANDLE_SX = {
980
+ position: "absolute",
981
+ insetInlineEnd: 0,
982
+ top: 0,
983
+ height: "100%",
984
+ width: 8,
985
+ cursor: "col-resize",
986
+ touchAction: "none",
987
+ userSelect: "none"
988
+ };
989
+ function muiColor(color) {
990
+ return color === "danger" || color === "red" || color === "error" ? "error" : "default";
991
+ }
992
+ var EXPAND_WIDTH = 48;
993
+ function useStableToggle(target) {
994
+ const ref = useRef(target);
995
+ ref.current = target;
996
+ return useCallback((id) => ref.current?.toggle(id), []);
997
+ }
998
+ function ExpandChevron({
999
+ expanded,
1000
+ dir
1001
+ }) {
1002
+ let transform;
1003
+ if (expanded) transform = "rotate(90deg)";
1004
+ else if (dir === "rtl") transform = "rotate(180deg)";
1005
+ return /* @__PURE__ */ jsx(
1006
+ Box,
1007
+ {
1008
+ component: "span",
1009
+ "aria-hidden": true,
1010
+ sx: { display: "inline-flex", transition: "transform 150ms", transform },
1011
+ children: /* @__PURE__ */ jsx(
1012
+ "svg",
1013
+ {
1014
+ width: "1em",
1015
+ height: "1em",
1016
+ viewBox: "0 0 24 24",
1017
+ fill: "none",
1018
+ stroke: "currentColor",
1019
+ strokeWidth: "2",
1020
+ strokeLinecap: "round",
1021
+ strokeLinejoin: "round",
1022
+ children: /* @__PURE__ */ jsx("path", { d: "M9 6l6 6-6 6" })
1023
+ }
1024
+ )
1025
+ }
1026
+ );
1027
+ }
1028
+ function ExpandToggle({
1029
+ id,
1030
+ expanded,
1031
+ onToggle,
1032
+ dir,
1033
+ expandLabel,
1034
+ collapseLabel
1035
+ }) {
1036
+ return /* @__PURE__ */ jsx(
1037
+ IconButton,
1038
+ {
1039
+ size: "small",
1040
+ "aria-expanded": expanded,
1041
+ "aria-label": expanded ? collapseLabel : expandLabel,
1042
+ onClick: () => onToggle(id),
1043
+ children: /* @__PURE__ */ jsx(ExpandChevron, { expanded, dir })
1044
+ }
1045
+ );
1046
+ }
1047
+ function muiAlign(align) {
1048
+ if (align === "center") return "center";
1049
+ if (align === "end") return "end";
1050
+ return "start";
1051
+ }
1052
+ function RowActionButtons({
1053
+ row,
1054
+ actions,
1055
+ confirm,
1056
+ cancelLabel
1057
+ }) {
1058
+ return /* @__PURE__ */ jsx(Stack, { direction: "row", spacing: 0.5, justifyContent: "flex-end", children: actions.map((action) => {
1059
+ if (action.isHidden?.(row)) return null;
1060
+ const reason = resolveDisabledReason(action.disabledReason?.(row));
1061
+ const disabled = reason !== void 0 || (action.isDisabled?.(row) ?? false);
1062
+ return /* @__PURE__ */ jsx(Tooltip, { title: reason ?? action.label, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
1063
+ IconButton,
1064
+ {
1065
+ size: "small",
1066
+ color: muiColor(action.color),
1067
+ disabled,
1068
+ "aria-label": action.label,
1069
+ onClick: (
1070
+ // The disabled attribute already blocks activation, so
1071
+ // attach the handler only when the action can run.
1072
+ disabled ? void 0 : (e) => {
1073
+ e.stopPropagation();
1074
+ runRowAction(action, row, confirm, cancelLabel);
1075
+ }
1076
+ ),
1077
+ children: action.icon ?? /* @__PURE__ */ jsx(Typography, { variant: "caption", children: action.label })
1078
+ }
1079
+ ) }) }, action.key);
1080
+ }) });
1081
+ }
1082
+ var DESKTOP_ROW_COMPARED = [
1083
+ "row",
1084
+ "index",
1085
+ "selected",
1086
+ "expanded",
1087
+ "columns",
1088
+ "sx",
1089
+ "columnSpan",
1090
+ "size",
1091
+ "dir",
1092
+ "className",
1093
+ "hasSelection",
1094
+ "hasExpansion",
1095
+ "showActions",
1096
+ "selectRowLabel",
1097
+ "cancelLabel",
1098
+ "expandLabel",
1099
+ "collapseLabel"
1100
+ ];
1101
+ function desktopRowPropsAreEqual(prev, next) {
1102
+ return DESKTOP_ROW_COMPARED.every((key) => prev[key] === next[key]);
1103
+ }
1104
+ function DesktopRowImpl({
1105
+ row,
1106
+ index,
1107
+ selected,
1108
+ expanded,
1109
+ columns,
1110
+ sx,
1111
+ columnSpan,
1112
+ dir,
1113
+ className,
1114
+ hasSelection,
1115
+ hasExpansion,
1116
+ showActions,
1117
+ selectRowLabel,
1118
+ cancelLabel,
1119
+ expandLabel,
1120
+ collapseLabel,
1121
+ id,
1122
+ rowActions,
1123
+ confirm,
1124
+ renderRowDetail,
1125
+ onToggleSelect,
1126
+ onToggleExpand,
1127
+ onRowClick,
1128
+ prefetch,
1129
+ measureElement
1130
+ }) {
1131
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1132
+ /* @__PURE__ */ jsxs(
1133
+ TableRow,
1134
+ {
1135
+ ...rowClickProps(row, onRowClick),
1136
+ className,
1137
+ ref: measureElement,
1138
+ "data-index": index,
1139
+ hover: true,
1140
+ selected,
1141
+ onMouseEnter: prefetch ? () => prefetch(row) : void 0,
1142
+ children: [
1143
+ hasExpansion && /* @__PURE__ */ jsx(TableCell, { padding: "checkbox", sx: sx.expand, children: /* @__PURE__ */ jsx(
1144
+ ExpandToggle,
1145
+ {
1146
+ id,
1147
+ expanded,
1148
+ onToggle: onToggleExpand,
1149
+ dir,
1150
+ expandLabel,
1151
+ collapseLabel
1152
+ }
1153
+ ) }),
1154
+ hasSelection && /* @__PURE__ */ jsx(TableCell, { padding: "checkbox", sx: sx.selection, children: /* @__PURE__ */ jsx(
1155
+ Checkbox,
1156
+ {
1157
+ slotProps: { input: { "aria-label": selectRowLabel } },
1158
+ checked: selected,
1159
+ onChange: () => onToggleSelect(id)
1160
+ }
1161
+ ) }),
1162
+ columns.map((column) => /* @__PURE__ */ jsx(TableCell, { sx: sx.cells[column.key], children: column.Cell ? /* @__PURE__ */ jsx(column.Cell, { row, rowIndex: index }) : column.accessor?.(row) }, column.key)),
1163
+ showActions && /* @__PURE__ */ jsx(TableCell, { sx: sx.actions, children: /* @__PURE__ */ jsx(
1164
+ RowActionButtons,
1165
+ {
1166
+ row,
1167
+ actions: rowActions,
1168
+ confirm,
1169
+ cancelLabel
1170
+ }
1171
+ ) })
1172
+ ]
1173
+ }
1174
+ ),
1175
+ expanded && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: columnSpan, children: renderRowDetail(row) }) })
1176
+ ] });
1177
+ }
1178
+ var DesktopRow = memo(
1179
+ DesktopRowImpl,
1180
+ desktopRowPropsAreEqual
1181
+ );
1182
+ function DesktopTable({
1183
+ table,
1184
+ rows,
1185
+ rowActions,
1186
+ confirm,
1187
+ getRowId,
1188
+ size,
1189
+ dir,
1190
+ prefetch,
1191
+ onRowClick,
1192
+ rowClassName,
1193
+ renderRowDetail,
1194
+ summaryRow,
1195
+ expansion,
1196
+ rowEntries,
1197
+ paddingTop = 0,
1198
+ paddingBottom = 0,
1199
+ measureElement,
1200
+ stickyHeader = false,
1201
+ stickyTop = 0,
1202
+ pinOffset,
1203
+ maxHeight,
1204
+ virtualScrollRef,
1205
+ setWidth,
1206
+ columnWidths,
1207
+ resizeLabel = "Resize column",
1208
+ actionsPinned = false
1209
+ }) {
1210
+ const { columns, selection, labels, showActions, entries, columnSpan } = tableRenderModel({
1211
+ table,
1212
+ rows,
1213
+ rowActions,
1214
+ getRowId,
1215
+ rowEntries,
1216
+ renderRowDetail,
1217
+ expansion
1218
+ });
1219
+ const groupRow = headerGroupRow(columns);
1220
+ const summaryCells = summaryRow?.(rows);
1221
+ const isExpanded = expansion && renderRowDetail ? expansion.isExpanded : void 0;
1222
+ const expandActive = isExpanded !== void 0;
1223
+ const onToggleSelect = useStableToggle(selection);
1224
+ const onToggleExpand = useStableToggle(expansion);
1225
+ const hasPinned = actionsPinned || table.columns.some((c) => pinOffset?.(c.key) != null);
1226
+ const overflow = useHorizontalOverflow();
1227
+ const inScrollBox = maxHeight != null || hasPinned || overflow.overflowing;
1228
+ const headSx = stickyHeader ? {
1229
+ position: "sticky",
1230
+ top: inScrollBox ? 0 : stickyTop,
1231
+ zIndex: PIN_Z.header,
1232
+ bgcolor: "background.paper"
1233
+ } : void 0;
1234
+ const selectionWidth = 48;
1235
+ const actionsWidth = 120;
1236
+ const leadLeft = (expandActive ? EXPAND_WIDTH : 0) + (selection ? selectionWidth : 0);
1237
+ const leadRight = showActions ? actionsWidth : 0;
1238
+ const leads = { left: leadLeft, right: leadRight };
1239
+ const selectionLead = expandActive ? EXPAND_WIDTH : 0;
1240
+ const hasLeftPin = table.columns.some(
1241
+ (c) => pinOffset?.(c.key)?.side === "left"
1242
+ );
1243
+ const hasRightPin = table.columns.some(
1244
+ (c) => pinOffset?.(c.key)?.side === "right"
1245
+ );
1246
+ const stickActions = hasRightPin || actionsPinned;
1247
+ const headCellSx = (column) => {
1248
+ const pin = pinnedCellStyle(
1249
+ pinOffset?.(column.key),
1250
+ PIN_Z.headerPinned,
1251
+ leads
1252
+ );
1253
+ const width = pin ? pinnedColumnWidth(column, columnWidths) : columnWidths?.[column.key] ?? column.width;
1254
+ const needsRelative = Boolean(setWidth) && !headSx && !pin;
1255
+ return {
1256
+ ...headSx,
1257
+ ...pin && { ...pin, bgcolor: "background.paper" },
1258
+ ...needsRelative && { position: "relative" },
1259
+ textAlign: muiAlign(column.align),
1260
+ ...width != null && { width }
1261
+ };
1262
+ };
1263
+ const edgeHeadSx = (side, active, lead = 0) => {
1264
+ const pin = edgePinStyle(side, active, PIN_Z.headerPinned);
1265
+ return {
1266
+ ...headSx,
1267
+ ...pin && { ...pin, bgcolor: "background.paper" },
1268
+ ...pin && lead > 0 && { insetInlineStart: lead }
1269
+ };
1270
+ };
1271
+ const rowSx = useMemo(() => {
1272
+ const edge = (side, active, lead = 0) => {
1273
+ const pin = edgePinStyle(side, active, PIN_Z.body);
1274
+ if (!pin) return void 0;
1275
+ return {
1276
+ ...pin,
1277
+ ...lead > 0 && { insetInlineStart: lead },
1278
+ bgcolor: "background.paper"
1279
+ };
1280
+ };
1281
+ const cells = {};
1282
+ for (const column of columns) {
1283
+ const pin = pinnedCellStyle(pinOffset?.(column.key), PIN_Z.body, {
1284
+ left: leadLeft,
1285
+ right: leadRight
1286
+ });
1287
+ cells[column.key] = {
1288
+ ...pin && { ...pin, bgcolor: "background.paper" },
1289
+ textAlign: muiAlign(column.align)
1290
+ };
1291
+ }
1292
+ return {
1293
+ cells,
1294
+ expand: edge("left", hasLeftPin),
1295
+ selection: edge("left", hasLeftPin, selectionLead),
1296
+ actions: { ...edge("right", stickActions), textAlign: "end" }
1297
+ };
1298
+ }, [
1299
+ columns,
1300
+ pinOffset,
1301
+ leadLeft,
1302
+ leadRight,
1303
+ hasLeftPin,
1304
+ stickActions,
1305
+ selectionLead
1306
+ ]);
1307
+ let boxSx;
1308
+ if (maxHeight != null) {
1309
+ boxSx = { maxHeight, overflow: "auto" };
1310
+ } else if (hasPinned || overflow.overflowing) {
1311
+ boxSx = { overflowX: "auto" };
1312
+ }
1313
+ const minWidth = tableMinWidth(columns, {
1314
+ widths: columnWidths,
1315
+ extra: leadLeft + leadRight
1316
+ });
1317
+ return /* @__PURE__ */ jsx(
1318
+ Box,
1319
+ {
1320
+ ref: (node) => {
1321
+ overflow.ref(node);
1322
+ virtualScrollRef?.(node);
1323
+ },
1324
+ sx: boxSx,
1325
+ children: /* @__PURE__ */ jsxs(
1326
+ Table,
1327
+ {
1328
+ size,
1329
+ "aria-label": table.getTableProps()["aria-label"],
1330
+ sx: minWidth > 0 ? { minWidth } : void 0,
1331
+ children: [
1332
+ /* @__PURE__ */ jsxs(TableHead, { children: [
1333
+ groupRow && // Decorative group row. It deliberately skips the sticky `headSx`
1334
+ // treatment: sticking both header rows at the same `top` would
1335
+ // overlap them, so only the sortable header row pins.
1336
+ /* @__PURE__ */ jsxs(TableRow, { children: [
1337
+ expandActive && /* @__PURE__ */ jsx(TableCell, { padding: "checkbox" }),
1338
+ selection && /* @__PURE__ */ jsx(TableCell, { padding: "checkbox" }),
1339
+ groupRow.map((cell) => /* @__PURE__ */ jsx(
1340
+ TableCell,
1341
+ {
1342
+ colSpan: cell.span,
1343
+ sx: { textAlign: "center", fontWeight: 600 },
1344
+ children: cell.label
1345
+ },
1346
+ cell.key
1347
+ )),
1348
+ showActions && /* @__PURE__ */ jsx(TableCell, {})
1349
+ ] }),
1350
+ /* @__PURE__ */ jsxs(TableRow, { children: [
1351
+ expandActive && /* @__PURE__ */ jsx(
1352
+ TableCell,
1353
+ {
1354
+ padding: "checkbox",
1355
+ sx: edgeHeadSx("left", hasLeftPin)
1356
+ }
1357
+ ),
1358
+ selection && /* @__PURE__ */ jsx(
1359
+ TableCell,
1360
+ {
1361
+ padding: "checkbox",
1362
+ sx: edgeHeadSx("left", hasLeftPin, selectionLead),
1363
+ children: /* @__PURE__ */ jsx(
1364
+ Checkbox,
1365
+ {
1366
+ slotProps: { input: { "aria-label": labels.selectAll } },
1367
+ checked: selection.headerState === "all",
1368
+ indeterminate: selection.headerState === "some",
1369
+ onChange: selection.toggleAll
1370
+ }
1371
+ )
1372
+ }
1373
+ ),
1374
+ columns.map((column) => {
1375
+ const headerCellProps = table.getHeaderCellProps(column);
1376
+ const ariaSort = headerCellProps["aria-sort"];
1377
+ const active = ariaSort === "ascending" || ariaSort === "descending";
1378
+ const sortIndex = headerCellProps["data-sort-index"];
1379
+ return /* @__PURE__ */ jsxs(
1380
+ TableCell,
1381
+ {
1382
+ "aria-sort": ariaSort,
1383
+ "data-sort-index": sortIndex,
1384
+ sx: headCellSx(column),
1385
+ children: [
1386
+ column.sortable ? /* @__PURE__ */ jsxs(
1387
+ TableSortLabel,
1388
+ {
1389
+ active,
1390
+ direction: ariaSort === "descending" ? "desc" : "asc",
1391
+ onClick: table.getSortButtonProps(column).onClick,
1392
+ children: [
1393
+ column.header,
1394
+ sortIndex !== void 0 && /* @__PURE__ */ jsx(Box, { component: "span", sx: { fontSize: 10, ml: 0.5 }, children: sortIndex })
1395
+ ]
1396
+ }
1397
+ ) : column.header,
1398
+ setWidth && /* @__PURE__ */ jsx(
1399
+ Box,
1400
+ {
1401
+ component: "span",
1402
+ sx: RESIZE_HANDLE_SX,
1403
+ ...columnResizeHandleProps(
1404
+ column.key,
1405
+ setWidth,
1406
+ `${resizeLabel}: ${typeof column.header === "string" ? column.header : column.key}`
1407
+ )
1408
+ }
1409
+ )
1410
+ ]
1411
+ },
1412
+ column.key
1413
+ );
1414
+ }),
1415
+ showActions && /* @__PURE__ */ jsx(
1416
+ TableCell,
1417
+ {
1418
+ sx: { ...edgeHeadSx("right", stickActions), textAlign: "end" },
1419
+ children: labels.actions
1420
+ }
1421
+ )
1422
+ ] })
1423
+ ] }),
1424
+ /* @__PURE__ */ jsxs(TableBody, { children: [
1425
+ paddingTop > 0 && /* @__PURE__ */ jsx(TableRow, { "aria-hidden": true, children: /* @__PURE__ */ jsx(
1426
+ TableCell,
1427
+ {
1428
+ colSpan: columnSpan,
1429
+ sx: { height: paddingTop, p: 0 }
1430
+ }
1431
+ ) }),
1432
+ entries.map(({ row, index, key }) => {
1433
+ const id = getRowId(row);
1434
+ return /* @__PURE__ */ jsx(
1435
+ DesktopRow,
1436
+ {
1437
+ row,
1438
+ index,
1439
+ selected: selection?.isSelected(id) ?? false,
1440
+ expanded: isExpanded ? isExpanded(id) : false,
1441
+ columns,
1442
+ sx: rowSx,
1443
+ columnSpan,
1444
+ size,
1445
+ dir,
1446
+ className: rowClassName?.(row, index),
1447
+ hasSelection: Boolean(selection),
1448
+ hasExpansion: expandActive,
1449
+ showActions,
1450
+ selectRowLabel: labels.selectRow,
1451
+ cancelLabel: labels.cancel,
1452
+ expandLabel: labels.expandRow,
1453
+ collapseLabel: labels.collapseRow,
1454
+ id,
1455
+ rowActions,
1456
+ confirm,
1457
+ renderRowDetail,
1458
+ onToggleSelect,
1459
+ onToggleExpand,
1460
+ onRowClick,
1461
+ prefetch,
1462
+ measureElement
1463
+ },
1464
+ key
1465
+ );
1466
+ }),
1467
+ paddingBottom > 0 && /* @__PURE__ */ jsx(TableRow, { "aria-hidden": true, children: /* @__PURE__ */ jsx(
1468
+ TableCell,
1469
+ {
1470
+ colSpan: columnSpan,
1471
+ sx: { height: paddingBottom, p: 0 }
1472
+ }
1473
+ ) })
1474
+ ] }),
1475
+ summaryCells && /* @__PURE__ */ jsx(TableFooter, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
1476
+ expandActive && /* @__PURE__ */ jsx(TableCell, { padding: "checkbox" }),
1477
+ selection && /* @__PURE__ */ jsx(TableCell, { padding: "checkbox" }),
1478
+ columns.map((column) => (
1479
+ // One cell per column keeps the summary aligned under its
1480
+ // column; keys absent from the result render empty cells.
1481
+ /* @__PURE__ */ jsx(
1482
+ TableCell,
1483
+ {
1484
+ sx: { textAlign: muiAlign(column.align) },
1485
+ children: summaryCells[column.key]
1486
+ },
1487
+ column.key
1488
+ )
1489
+ )),
1490
+ showActions && /* @__PURE__ */ jsx(TableCell, {})
1491
+ ] }) })
1492
+ ]
1493
+ }
1494
+ )
1495
+ }
1496
+ );
1497
+ }
1498
+ function mobileLabel(column) {
1499
+ return column.mobileLabel ?? (typeof column.header === "string" ? column.header : column.key);
1500
+ }
1501
+ function MobileCards({
1502
+ table,
1503
+ rows,
1504
+ rowActions,
1505
+ confirm,
1506
+ getRowId,
1507
+ size,
1508
+ dir,
1509
+ onRowClick,
1510
+ rowClassName,
1511
+ renderRowDetail,
1512
+ summaryRow,
1513
+ expansion,
1514
+ rowEntries,
1515
+ paddingTop = 0,
1516
+ paddingBottom = 0,
1517
+ measureElement
1518
+ }) {
1519
+ const { columns, selection, labels } = table;
1520
+ const entries = resolveVirtualRows(rows, getRowId, rowEntries);
1521
+ const compact = size === "small";
1522
+ const expand = expansion && renderRowDetail ? expansion : void 0;
1523
+ const summaryCells = summaryRow?.(rows);
1524
+ return /* @__PURE__ */ jsxs(
1525
+ Stack,
1526
+ {
1527
+ spacing: compact ? 1 : 1.5,
1528
+ role: "list",
1529
+ "aria-label": table.getTableProps()["aria-label"],
1530
+ children: [
1531
+ paddingTop > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": true, sx: { height: paddingTop } }),
1532
+ entries.map(({ row, index, key }) => {
1533
+ const id = getRowId(row);
1534
+ return /* @__PURE__ */ jsx(
1535
+ Card,
1536
+ {
1537
+ ref: measureElement,
1538
+ "data-index": index,
1539
+ variant: "outlined",
1540
+ role: "listitem",
1541
+ className: rowClassName?.(row, index),
1542
+ ...rowClickProps(row, onRowClick),
1543
+ children: /* @__PURE__ */ jsxs(
1544
+ CardContent,
1545
+ {
1546
+ sx: compact ? { p: 1.25, "&:last-child": { pb: 1.25 } } : void 0,
1547
+ children: [
1548
+ selection && /* @__PURE__ */ jsx(
1549
+ Checkbox,
1550
+ {
1551
+ slotProps: { input: { "aria-label": labels.selectRow } },
1552
+ checked: selection.isSelected(id),
1553
+ onChange: () => selection.toggle(id)
1554
+ }
1555
+ ),
1556
+ expand && /* @__PURE__ */ jsx(
1557
+ ExpandToggle,
1558
+ {
1559
+ id,
1560
+ expanded: expand.isExpanded(id),
1561
+ onToggle: expand.toggle,
1562
+ dir,
1563
+ expandLabel: labels.expandRow,
1564
+ collapseLabel: labels.collapseRow
1565
+ }
1566
+ ),
1567
+ columns.map((column) => /* @__PURE__ */ jsxs(Box, { sx: { mb: compact ? 0.5 : 1 }, children: [
1568
+ /* @__PURE__ */ jsx(
1569
+ Typography,
1570
+ {
1571
+ variant: "caption",
1572
+ color: "text.secondary",
1573
+ display: "block",
1574
+ children: mobileLabel(column)
1575
+ }
1576
+ ),
1577
+ /* @__PURE__ */ jsx(Typography, { component: "div", variant: "body2", children: column.Cell ? /* @__PURE__ */ jsx(column.Cell, { row, rowIndex: index }) : column.accessor?.(row) })
1578
+ ] }, column.key)),
1579
+ rowActions && rowActions.length > 0 && /* @__PURE__ */ jsx(
1580
+ RowActionButtons,
1581
+ {
1582
+ row,
1583
+ actions: rowActions,
1584
+ confirm,
1585
+ cancelLabel: labels.cancel
1586
+ }
1587
+ ),
1588
+ expand?.isExpanded(id) && // Inside the card — and therefore inside the measured
1589
+ // element — so virtualization keeps accurate card heights.
1590
+ /* @__PURE__ */ jsx(Box, { sx: { mt: 1 }, children: renderRowDetail(row) })
1591
+ ]
1592
+ }
1593
+ )
1594
+ },
1595
+ key
1596
+ );
1597
+ }),
1598
+ summaryCells && /* @__PURE__ */ jsx(Card, { variant: "outlined", role: "listitem", children: /* @__PURE__ */ jsx(
1599
+ CardContent,
1600
+ {
1601
+ sx: compact ? { p: 1.25, "&:last-child": { pb: 1.25 } } : void 0,
1602
+ children: columns.map((column) => {
1603
+ const value = summaryCells[column.key];
1604
+ if (value === void 0) return null;
1605
+ return /* @__PURE__ */ jsxs(Box, { sx: { mb: compact ? 0.5 : 1 }, children: [
1606
+ /* @__PURE__ */ jsx(
1607
+ Typography,
1608
+ {
1609
+ variant: "caption",
1610
+ color: "text.secondary",
1611
+ display: "block",
1612
+ children: mobileLabel(column)
1613
+ }
1614
+ ),
1615
+ /* @__PURE__ */ jsx(Typography, { component: "div", variant: "body2", children: value })
1616
+ ] }, column.key);
1617
+ })
1618
+ }
1619
+ ) }),
1620
+ paddingBottom > 0 && /* @__PURE__ */ jsx(Box, { "aria-hidden": true, sx: { height: paddingBottom } })
1621
+ ]
1622
+ }
1623
+ );
1624
+ }
1625
+ function tableSize(size, density) {
1626
+ if (size) return size;
1627
+ return density === "compact" ? "small" : "medium";
1628
+ }
1629
+ function resizeSetter(enabled, setWidth) {
1630
+ return enabled ? setWidth : void 0;
1631
+ }
1632
+ function resolveActionsColumn(declared, layout) {
1633
+ const hasRowActions = (declared?.length ?? 0) > 0;
1634
+ const rowActions = hasRowActions && !layout.isHidden(ACTIONS_COLUMN_KEY) ? declared : void 0;
1635
+ const actionsPinned = rowActions !== void 0 && layout.state.pinned[ACTIONS_COLUMN_KEY] === "right";
1636
+ return { hasRowActions, rowActions, actionsPinned };
1637
+ }
1638
+ function useChromeProps(props) {
1639
+ const { source, runtime } = useTableData({
1640
+ locale: props.locale,
1641
+ source: props.source,
1642
+ data: props.data,
1643
+ total: props.total,
1644
+ loading: props.loading,
1645
+ onQueryChange: props.onQueryChange,
1646
+ columns: props.columns,
1647
+ filters: props.filters,
1648
+ adapter: props.urlSync === false ? void 0 : props.urlAdapter,
1649
+ enabled: props.urlSync,
1650
+ urlKey: props.urlKey
1651
+ });
1652
+ let filtersNode;
1653
+ if (isDeclarativeFilters(props.filters) || props.filters === void 0) {
1654
+ filtersNode = runtime.defs.length > 0 ? /* @__PURE__ */ jsx(
1655
+ AutoFilterForm,
1656
+ {
1657
+ defs: runtime.defs,
1658
+ source,
1659
+ labels: resolveLabels(props.labels)
1660
+ }
1661
+ ) : void 0;
1662
+ } else {
1663
+ filtersNode = props.filters;
1664
+ }
1665
+ return {
1666
+ ...props,
1667
+ source,
1668
+ filters: filtersNode,
1669
+ filterLabels: { ...runtime.filterLabels, ...props.filterLabels }
1670
+ };
1671
+ }
1672
+ function DataTable(props) {
1673
+ const { slots, className } = props;
1674
+ const size = tableSize(props.size, props.density);
1675
+ const { filtersMode = "popover" } = props;
1676
+ const chromeProps = useChromeProps(props);
1677
+ const { source, filters: filtersNode } = chromeProps;
1678
+ const c = useTableChrome(chromeProps);
1679
+ const { table, confirm, getRowId } = c;
1680
+ const { labels } = table;
1681
+ const [filtersOpen, setFiltersOpen] = useState(false);
1682
+ const filtersTrigger = useFilterTriggerToggle(filtersOpen, setFiltersOpen);
1683
+ const rootRef = useRef(null);
1684
+ useChromeScrollReset(rootRef, c, chromeProps);
1685
+ const { virtualization, loadMoreRef, canLoadMore, virtualScrollRef } = useChromeBodyData(c, chromeProps);
1686
+ const { hasRowActions, rowActions, actionsPinned } = resolveActionsColumn(
1687
+ props.rowActions,
1688
+ c.columnLayout
1689
+ );
1690
+ const columnMenu = props.enableColumnMenu && !c.isMobile && /* @__PURE__ */ jsx(
1691
+ ColumnMenu,
1692
+ {
1693
+ allColumns: c.allColumns,
1694
+ layout: c.columnLayout,
1695
+ labels,
1696
+ hasRowActions
1697
+ }
1698
+ );
1699
+ const savedViewsMenu = props.savedViews && /* @__PURE__ */ jsx(
1700
+ SavedViewsMenu,
1701
+ {
1702
+ options: {
1703
+ adapter: props.urlAdapter,
1704
+ urlKey: props.urlKey,
1705
+ ...props.savedViews
1706
+ },
1707
+ labels
1708
+ }
1709
+ );
1710
+ let body;
1711
+ if (c.body === "skeleton") {
1712
+ body = slots?.skeleton ?? /* @__PURE__ */ jsx(
1713
+ LoadingState,
1714
+ {
1715
+ rows: props.skeletonRows ?? source.limit,
1716
+ columns: table.columns.length,
1717
+ loadingLabel: labels.loading
1718
+ }
1719
+ );
1720
+ } else if (c.body === "empty") {
1721
+ body = slots?.empty ?? /* @__PURE__ */ jsxs(Stack, { role: "status", spacing: 1.5, alignItems: "center", sx: { py: 6 }, children: [
1722
+ /* @__PURE__ */ jsx(Typography, { color: "text.secondary", align: "center", children: c.emptyVariant === "noResults" ? labels.noResults : labels.noData }),
1723
+ c.emptyVariant === "noResults" && /* @__PURE__ */ jsx(Button, { variant: "outlined", size: "small", onClick: c.clearFilters, children: labels.clearAll })
1724
+ ] });
1725
+ } else if (c.body === "mobile") {
1726
+ body = /* @__PURE__ */ jsx(
1727
+ MobileCards,
1728
+ {
1729
+ table,
1730
+ rows: source.rows,
1731
+ rowActions,
1732
+ confirm,
1733
+ getRowId,
1734
+ size,
1735
+ dir: props.dir,
1736
+ onRowClick: props.onRowClick,
1737
+ rowClassName: props.rowClassName,
1738
+ renderRowDetail: props.renderRowDetail,
1739
+ summaryRow: props.summaryRow,
1740
+ expansion: c.detail?.expansion,
1741
+ rowEntries: virtualization.enabled ? virtualization.rows : void 0,
1742
+ paddingTop: virtualization.paddingTop,
1743
+ paddingBottom: virtualization.paddingBottom,
1744
+ measureElement: virtualization.measureElement
1745
+ }
1746
+ );
1747
+ } else {
1748
+ body = /* @__PURE__ */ jsx(
1749
+ DesktopTable,
1750
+ {
1751
+ table,
1752
+ rows: source.rows,
1753
+ rowActions,
1754
+ actionsPinned,
1755
+ confirm,
1756
+ getRowId,
1757
+ size,
1758
+ dir: props.dir,
1759
+ prefetch: props.prefetch,
1760
+ onRowClick: props.onRowClick,
1761
+ rowClassName: props.rowClassName,
1762
+ renderRowDetail: props.renderRowDetail,
1763
+ summaryRow: props.summaryRow,
1764
+ expansion: c.detail?.expansion,
1765
+ rowEntries: virtualization.enabled ? virtualization.rows : void 0,
1766
+ paddingTop: virtualization.paddingTop,
1767
+ paddingBottom: virtualization.paddingBottom,
1768
+ measureElement: virtualization.measureElement,
1769
+ stickyHeader: props.stickyHeader,
1770
+ stickyTop: props.stickyTop,
1771
+ pinOffset: c.columnLayout.pinOffset,
1772
+ maxHeight: props.maxHeight,
1773
+ virtualScrollRef,
1774
+ setWidth: resizeSetter(props.resizableColumns, c.columnLayout.setWidth),
1775
+ columnWidths: c.columnLayout.state.widths,
1776
+ resizeLabel: labels.resizeColumn
1777
+ }
1778
+ );
1779
+ }
1780
+ return /* @__PURE__ */ jsxs(
1781
+ Paper,
1782
+ {
1783
+ ref: rootRef,
1784
+ variant: "outlined",
1785
+ dir: props.dir,
1786
+ className,
1787
+ "aria-busy": c.isRefreshing || void 0,
1788
+ sx: { p: 1.5 },
1789
+ children: [
1790
+ /* @__PURE__ */ jsxs(Stack, { spacing: 1.5, children: [
1791
+ /* @__PURE__ */ jsx(
1792
+ Toolbar,
1793
+ {
1794
+ table,
1795
+ hideSearch: props.hideSearch,
1796
+ searchPlaceholder: props.searchPlaceholder,
1797
+ sortByOptions: props.sortByOptions,
1798
+ customToolbar: /* @__PURE__ */ jsxs(Fragment, { children: [
1799
+ savedViewsMenu,
1800
+ props.toolbar
1801
+ ] }),
1802
+ hasFilters: Boolean(filtersNode),
1803
+ activeFilterCount: c.activeFilterCount,
1804
+ showRowsPerPage: canLoadMore,
1805
+ filtersMode,
1806
+ filters: filtersNode,
1807
+ filtersOpen,
1808
+ onToggleFilters: filtersTrigger.onClick,
1809
+ onFiltersTriggerPointerDown: filtersTrigger.onPointerDown,
1810
+ onCloseFilters: () => setFiltersOpen(false),
1811
+ onClearFilters: c.clearFilters,
1812
+ dir: props.dir,
1813
+ columnMenu
1814
+ }
1815
+ ),
1816
+ c.isRefreshing && /* @__PURE__ */ jsx(LinearProgress, { "aria-label": labels.loading }),
1817
+ /* @__PURE__ */ jsx(
1818
+ Chips,
1819
+ {
1820
+ chips: c.mergedChips,
1821
+ onClearAll: c.clearFilters,
1822
+ labels
1823
+ }
1824
+ ),
1825
+ table.selection && props.bulkActions && /* @__PURE__ */ jsx(
1826
+ BulkBar,
1827
+ {
1828
+ selection: table.selection,
1829
+ total: source.total,
1830
+ bulkActions: props.bulkActions,
1831
+ confirm,
1832
+ labels
1833
+ }
1834
+ ),
1835
+ source.error ? /* @__PURE__ */ jsx(
1836
+ ErrorState,
1837
+ {
1838
+ error: source.error,
1839
+ labels,
1840
+ onRetry: source.refetch ? () => void source.refetch?.() : void 0
1841
+ }
1842
+ ) : body,
1843
+ canLoadMore && source.hasNextPage && /* @__PURE__ */ jsx(Box, { ref: loadMoreRef, display: "flex", justifyContent: "center", py: 1, children: /* @__PURE__ */ jsx(
1844
+ Button,
1845
+ {
1846
+ variant: "outlined",
1847
+ size: "small",
1848
+ disabled: source.isFetchingNextPage,
1849
+ onClick: () => source.fetchNextPage(),
1850
+ children: labels.loadMore
1851
+ }
1852
+ ) }),
1853
+ c.showFooter && /* @__PURE__ */ jsx(
1854
+ Footer,
1855
+ {
1856
+ pagination: table.pagination,
1857
+ total: source.total,
1858
+ limit: source.limit,
1859
+ setPage: source.setPage,
1860
+ setLimit: source.setLimit,
1861
+ labels
1862
+ }
1863
+ )
1864
+ ] }),
1865
+ filtersNode && filtersMode === "drawer" && /* @__PURE__ */ jsx(
1866
+ FilterDrawer,
1867
+ {
1868
+ open: filtersOpen,
1869
+ onClose: () => setFiltersOpen(false),
1870
+ filters: filtersNode,
1871
+ activeFilterCount: c.activeFilterCount,
1872
+ onClearFilters: c.clearFilters,
1873
+ labels,
1874
+ dir: props.dir
1875
+ }
1876
+ )
1877
+ ]
1878
+ }
1879
+ );
1880
+ }
1881
+
1882
+ export { DataTable, SavedViewsMenu };
1883
+ //# sourceMappingURL=index.js.map
1884
+ //# sourceMappingURL=index.js.map