@dynamic-labs-sdk/droplet 1.49.0 → 1.50.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/components/empty-state/empty-state.d.ts +3 -3
- package/dist/components/empty-state/empty-state.d.ts.map +1 -1
- package/dist/components/status-badge/status-badge.d.ts.map +1 -1
- package/dist/components/tab-navigation/tab-navigation.d.ts.map +1 -1
- package/dist/components/ui/data-table/create-column-helper.d.ts +20 -0
- package/dist/components/ui/data-table/create-column-helper.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-active-filters.d.ts +37 -0
- package/dist/components/ui/data-table/data-table-active-filters.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-column-filter.d.ts +48 -0
- package/dist/components/ui/data-table/data-table-column-filter.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-column-visibility.d.ts +37 -0
- package/dist/components/ui/data-table/data-table-column-visibility.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-content.d.ts +43 -0
- package/dist/components/ui/data-table/data-table-content.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-context.d.ts +13 -0
- package/dist/components/ui/data-table/data-table-context.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-pagination.d.ts +38 -0
- package/dist/components/ui/data-table/data-table-pagination.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-placeholder-rows.d.ts +21 -0
- package/dist/components/ui/data-table/data-table-placeholder-rows.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-rows.d.ts +22 -0
- package/dist/components/ui/data-table/data-table-rows.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table-search.d.ts +40 -0
- package/dist/components/ui/data-table/data-table-search.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table.d.ts +56 -0
- package/dist/components/ui/data-table/data-table.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table.stories.d.ts +32 -0
- package/dist/components/ui/data-table/data-table.stories.d.ts.map +1 -0
- package/dist/components/ui/data-table/data-table.types.d.ts +189 -0
- package/dist/components/ui/data-table/data-table.types.d.ts.map +1 -0
- package/dist/components/ui/data-table/expand-chevron.d.ts +7 -0
- package/dist/components/ui/data-table/expand-chevron.d.ts.map +1 -0
- package/dist/components/ui/data-table/get-column-label.d.ts +7 -0
- package/dist/components/ui/data-table/get-column-label.d.ts.map +1 -0
- package/dist/components/ui/data-table/get-pinned-cell-props.d.ts +15 -0
- package/dist/components/ui/data-table/get-pinned-cell-props.d.ts.map +1 -0
- package/dist/components/ui/data-table/selection-column.d.ts +24 -0
- package/dist/components/ui/data-table/selection-column.d.ts.map +1 -0
- package/dist/components/ui/data-table/use-data-table.d.ts +157 -0
- package/dist/components/ui/data-table/use-data-table.d.ts.map +1 -0
- package/dist/components/ui/pagination/pagination.d.ts +2 -2
- package/dist/components/ui/pagination/pagination.d.ts.map +1 -1
- package/dist/components/ui/table/table.d.ts +7 -3
- package/dist/components/ui/table/table.d.ts.map +1 -1
- package/dist/components/ui/table/table.stories.d.ts +3 -1
- package/dist/components/ui/table/table.stories.d.ts.map +1 -1
- package/dist/components/ui/tabs/tabs.d.ts +3 -1
- package/dist/components/ui/tabs/tabs.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/index.cjs +1434 -99
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1426 -103
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -1
- package/src/styles/globals.css +44 -1
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,8 @@ let _radix_ui_react_select = require("@radix-ui/react-select");
|
|
|
57
57
|
let _radix_ui_react_separator = require("@radix-ui/react-separator");
|
|
58
58
|
let next_themes = require("next-themes");
|
|
59
59
|
let sonner = require("sonner");
|
|
60
|
+
let _tanstack_react_table = require("@tanstack/react-table");
|
|
61
|
+
let _tanstack_react_virtual = require("@tanstack/react-virtual");
|
|
60
62
|
let _radix_ui_react_tabs = require("@radix-ui/react-tabs");
|
|
61
63
|
_radix_ui_react_tabs = __toESM(_radix_ui_react_tabs);
|
|
62
64
|
let _radix_ui_react_tooltip = require("@radix-ui/react-tooltip");
|
|
@@ -1721,7 +1723,7 @@ const PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ (0, reac
|
|
|
1721
1723
|
/**
|
|
1722
1724
|
* Pre-assembled cursor-based pagination bar.
|
|
1723
1725
|
*
|
|
1724
|
-
* Renders
|
|
1726
|
+
* Renders an optional label, such as a record range, followed by previous and next arrow buttons, aligned to the end.
|
|
1725
1727
|
* Each button is disabled automatically when there is no page in that direction.
|
|
1726
1728
|
* Designed for dashboard tables and lists that use cursor/keyset pagination rather
|
|
1727
1729
|
* than numbered pages — which is the dominant pattern in the Redcoast design system.
|
|
@@ -1737,39 +1739,41 @@ const PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ (0, reac
|
|
|
1737
1739
|
* />
|
|
1738
1740
|
* ```
|
|
1739
1741
|
*/
|
|
1740
|
-
const CursorPagination = ({ hasPrevious, hasNext, onPrevious, onNext, label, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
1742
|
+
const CursorPagination = ({ hasPrevious, hasNext, onPrevious, onNext, label, className }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
|
|
1743
|
+
"aria-label": "Pagination",
|
|
1741
1744
|
"data-slot": "cursor-pagination",
|
|
1742
|
-
className: require_toggle_row.cn("flex items-center justify-
|
|
1743
|
-
children: [
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1745
|
+
className: require_toggle_row.cn("flex items-center justify-end gap-3", className),
|
|
1746
|
+
children: [label !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1747
|
+
className: "text-[13px] text-muted-foreground tabular-nums",
|
|
1748
|
+
children: label
|
|
1749
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1750
|
+
className: "flex items-center gap-2",
|
|
1751
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Button, {
|
|
1752
|
+
variant: "outline",
|
|
1753
|
+
size: "icon-sm",
|
|
1754
|
+
className: "size-8 before:-inset-1",
|
|
1747
1755
|
disabled: !hasPrevious,
|
|
1748
1756
|
onClick: onPrevious,
|
|
1749
1757
|
"aria-label": "Go to previous page",
|
|
1750
|
-
children:
|
|
1758
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
1751
1759
|
icon: _hugeicons_core_free_icons.ArrowLeft01Icon,
|
|
1752
|
-
size:
|
|
1760
|
+
size: 16,
|
|
1753
1761
|
"aria-hidden": "true"
|
|
1754
|
-
})
|
|
1755
|
-
}),
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
}),
|
|
1760
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Button, {
|
|
1761
|
-
variant: "ghost",
|
|
1762
|
-
size: "sm",
|
|
1762
|
+
})
|
|
1763
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Button, {
|
|
1764
|
+
variant: "outline",
|
|
1765
|
+
size: "icon-sm",
|
|
1766
|
+
className: "size-8 before:-inset-1",
|
|
1763
1767
|
disabled: !hasNext,
|
|
1764
1768
|
onClick: onNext,
|
|
1765
1769
|
"aria-label": "Go to next page",
|
|
1766
|
-
children:
|
|
1770
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
1767
1771
|
icon: _hugeicons_core_free_icons.ArrowRight01Icon,
|
|
1768
|
-
size:
|
|
1772
|
+
size: 16,
|
|
1769
1773
|
"aria-hidden": "true"
|
|
1770
|
-
})
|
|
1771
|
-
})
|
|
1772
|
-
]
|
|
1774
|
+
})
|
|
1775
|
+
})]
|
|
1776
|
+
})]
|
|
1773
1777
|
});
|
|
1774
1778
|
|
|
1775
1779
|
//#endregion
|
|
@@ -2204,6 +2208,13 @@ const Stepper = ({ steps, currentStep, className, ...props }) => /* @__PURE__ */
|
|
|
2204
2208
|
const SCROLLBAR_INSET = 8;
|
|
2205
2209
|
/** A wider drag target lets the visible thumb stay visually quiet. */
|
|
2206
2210
|
const SCROLLBAR_HIT_AREA = 12;
|
|
2211
|
+
/** Point several refs, function or object, at the same element. */
|
|
2212
|
+
const mergeRefs = (...refs) => (node) => {
|
|
2213
|
+
refs.forEach((ref) => {
|
|
2214
|
+
if (typeof ref === "function") ref(node);
|
|
2215
|
+
else if (ref) ref.current = node;
|
|
2216
|
+
});
|
|
2217
|
+
};
|
|
2207
2218
|
/** Collect a row group's leading cells, skipping rows covered by an earlier rowSpan. */
|
|
2208
2219
|
const collectSectionPinnedCells = ({ pinnedCells, section }) => {
|
|
2209
2220
|
let occupiedRows = 0;
|
|
@@ -2237,8 +2248,9 @@ const measureShelfTop = ({ scrollArea, table }) => {
|
|
|
2237
2248
|
return body ? body.getBoundingClientRect().top - scrollArea.getBoundingClientRect().top + scrollArea.scrollTop : 0;
|
|
2238
2249
|
};
|
|
2239
2250
|
/** Render a table in a stable tray with keyboard access only when content overflows. */
|
|
2240
|
-
const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...props }) => {
|
|
2251
|
+
const Table = ({ className, fill = false, scrollAreaProps = {}, stickyFirstColumn = false, viewportRef, ...props }) => {
|
|
2241
2252
|
const scrollAreaRef = (0, react.useRef)(null);
|
|
2253
|
+
const setViewportRef = (0, react.useMemo)(() => mergeRefs(scrollAreaRef, viewportRef), [viewportRef]);
|
|
2242
2254
|
const [overflow, setOverflow] = (0, react.useState)({
|
|
2243
2255
|
horizontal: false,
|
|
2244
2256
|
vertical: false
|
|
@@ -2343,8 +2355,9 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2343
2355
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2344
2356
|
"data-slot": "table-container",
|
|
2345
2357
|
"data-tray": "header",
|
|
2358
|
+
"data-fill": fill || void 0,
|
|
2346
2359
|
dir: props.dir,
|
|
2347
|
-
className: require_toggle_row.cn("group/table relative min-w-0 w-full [--table-radius:16px] [--table-shelf-radius:calc(var(--table-radius)_-_var(--tray-inset))] rounded-[var(--table-radius)] bg-[var(--tray-chrome)] px-[var(--tray-inset)] pb-[var(--tray-inset)]",
|
|
2360
|
+
className: require_toggle_row.cn("group/table relative min-w-0 w-full overflow-hidden [container-type:inline-size] [--table-radius:16px] [--table-shelf-radius:calc(var(--table-radius)_-_var(--tray-inset))] rounded-[var(--table-radius)] bg-[var(--tray-chrome)] px-[var(--tray-inset)] pb-[var(--tray-inset)]", fill && "flex min-h-0 flex-1 flex-col"),
|
|
2348
2361
|
children: [
|
|
2349
2362
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2350
2363
|
"aria-hidden": "true",
|
|
@@ -2354,7 +2367,7 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2354
2367
|
}),
|
|
2355
2368
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_scroll_area.Viewport, {
|
|
2356
2369
|
...viewportProps,
|
|
2357
|
-
ref:
|
|
2370
|
+
ref: setViewportRef,
|
|
2358
2371
|
"data-slot": "table-scroll-area",
|
|
2359
2372
|
"data-caption-top": topCaptionHeight > 0,
|
|
2360
2373
|
"data-native-scrollbars": useNativeScrollbars,
|
|
@@ -2369,7 +2382,7 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2369
2382
|
scrollPaddingTop: headerHeight + topCaptionHeight,
|
|
2370
2383
|
...scrollAreaStyle
|
|
2371
2384
|
},
|
|
2372
|
-
className: require_toggle_row.cn("relative min-w-0 overflow-auto overscroll-
|
|
2385
|
+
className: require_toggle_row.cn("relative min-w-0 overflow-auto overscroll-none rounded-[var(--table-shelf-radius)] data-[native-scrollbars=true]:[scrollbar-width:auto] data-[native-scrollbars=true]:[&::-webkit-scrollbar]:block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[var(--ring)]", fill && "min-h-0 flex-1", scrollAreaClassName),
|
|
2373
2386
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("table", {
|
|
2374
2387
|
"data-slot": "table",
|
|
2375
2388
|
"data-sticky-first-column": stickyFirstColumn || void 0,
|
|
@@ -2450,13 +2463,13 @@ const TableFooter = ({ className, ...props }) => {
|
|
|
2450
2463
|
...props
|
|
2451
2464
|
});
|
|
2452
2465
|
};
|
|
2453
|
-
const TableRow = ({ className, ...props }) => {
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2466
|
+
const TableRow = (0, react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
2467
|
+
ref,
|
|
2468
|
+
"data-slot": "table-row",
|
|
2469
|
+
className: require_toggle_row.cn("hover:bg-[var(--overlay-hover)] data-[state=selected]:bg-[var(--table-row-selected)] data-[state=selected]:hover:bg-[var(--table-row-selected-hover)] border-b border-[var(--border-divider)]", "hover:[--table-row-overlay:var(--overlay-hover)] data-[state=selected]:[--table-row-overlay:var(--table-row-selected)] data-[state=selected]:hover:[--table-row-overlay:var(--table-row-selected-hover)]", className),
|
|
2470
|
+
...props
|
|
2471
|
+
}));
|
|
2472
|
+
TableRow.displayName = "TableRow";
|
|
2460
2473
|
const TableHead = ({ className, scope, ...props }) => {
|
|
2461
2474
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
2462
2475
|
"data-slot": "table-head",
|
|
@@ -2480,6 +2493,1315 @@ const TableCaption = ({ className, ...props }) => {
|
|
|
2480
2493
|
});
|
|
2481
2494
|
};
|
|
2482
2495
|
|
|
2496
|
+
//#endregion
|
|
2497
|
+
//#region src/components/ui/data-table/create-column-helper.ts
|
|
2498
|
+
/**
|
|
2499
|
+
* Creates a helper that builds typed column definitions for rows of type `TData`. Its `accessor`, `display` and `group` methods infer each column's value type.
|
|
2500
|
+
*
|
|
2501
|
+
* @example
|
|
2502
|
+
* ```tsx
|
|
2503
|
+
* const columnHelper = createColumnHelper<User>();
|
|
2504
|
+
*
|
|
2505
|
+
* const columns = [
|
|
2506
|
+
* columnHelper.accessor('name', { header: 'Name' }),
|
|
2507
|
+
* columnHelper.accessor('email', { header: 'Email' }),
|
|
2508
|
+
* ];
|
|
2509
|
+
* ```
|
|
2510
|
+
* @returns A column helper for rows of type `TData`.
|
|
2511
|
+
* @see ColumnDef
|
|
2512
|
+
* @see useDataTable
|
|
2513
|
+
*/
|
|
2514
|
+
const createColumnHelper = _tanstack_react_table.createColumnHelper;
|
|
2515
|
+
|
|
2516
|
+
//#endregion
|
|
2517
|
+
//#region src/components/ui/data-table/data-table-context.ts
|
|
2518
|
+
const DataTableContext = (0, react.createContext)(null);
|
|
2519
|
+
/**
|
|
2520
|
+
* Read the state of the nearest `DataTable`, for building custom table parts.
|
|
2521
|
+
* Throws when called outside a `DataTable`.
|
|
2522
|
+
*/
|
|
2523
|
+
const useDataTableContext = () => {
|
|
2524
|
+
const context = (0, react.useContext)(DataTableContext);
|
|
2525
|
+
if (!context) throw new Error("DataTable parts must be used inside a DataTable");
|
|
2526
|
+
return context;
|
|
2527
|
+
};
|
|
2528
|
+
|
|
2529
|
+
//#endregion
|
|
2530
|
+
//#region src/components/ui/data-table/data-table.tsx
|
|
2531
|
+
/**
|
|
2532
|
+
* Root of a data table. Holds the table state for `DataTableContent`, `DataTablePagination` and the other parts.
|
|
2533
|
+
*
|
|
2534
|
+
* @example
|
|
2535
|
+
* ```tsx
|
|
2536
|
+
* const dataTable = useDataTable({ columns, data });
|
|
2537
|
+
*
|
|
2538
|
+
* <DataTable table={dataTable}>
|
|
2539
|
+
* <DataTableToolbar>
|
|
2540
|
+
* <DataTableColumnVisibility />
|
|
2541
|
+
* </DataTableToolbar>
|
|
2542
|
+
* <DataTableContent />
|
|
2543
|
+
* </DataTable>
|
|
2544
|
+
* ```
|
|
2545
|
+
* @returns The rendered data table root element.
|
|
2546
|
+
* @see useDataTable
|
|
2547
|
+
* @see DataTableContent
|
|
2548
|
+
* @see DataTableToolbar
|
|
2549
|
+
*/
|
|
2550
|
+
const DataTable = ({ children, className, fill = false, table, ...props }) => {
|
|
2551
|
+
const contextValue = (0, react.useMemo)(() => ({
|
|
2552
|
+
...table,
|
|
2553
|
+
fill
|
|
2554
|
+
}), [table, fill]);
|
|
2555
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableContext.Provider, {
|
|
2556
|
+
value: contextValue,
|
|
2557
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2558
|
+
"data-slot": "data-table",
|
|
2559
|
+
"data-fill": fill || void 0,
|
|
2560
|
+
className: require_toggle_row.cn("flex min-w-0 flex-col gap-3", fill && "min-h-0 flex-1", className),
|
|
2561
|
+
...props,
|
|
2562
|
+
children
|
|
2563
|
+
})
|
|
2564
|
+
});
|
|
2565
|
+
};
|
|
2566
|
+
/**
|
|
2567
|
+
* Row above the table for search, filters and actions.
|
|
2568
|
+
*
|
|
2569
|
+
* @example
|
|
2570
|
+
* ```tsx
|
|
2571
|
+
* <DataTableToolbar>
|
|
2572
|
+
* <Input placeholder="Search users" />
|
|
2573
|
+
* <DataTableColumnVisibility />
|
|
2574
|
+
* </DataTableToolbar>
|
|
2575
|
+
* ```
|
|
2576
|
+
* @returns The rendered toolbar element.
|
|
2577
|
+
* @see DataTable
|
|
2578
|
+
* @see DataTableColumnVisibility
|
|
2579
|
+
*/
|
|
2580
|
+
const DataTableToolbar = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2581
|
+
"data-slot": "data-table-toolbar",
|
|
2582
|
+
className: require_toggle_row.cn("flex flex-wrap items-center gap-2", className),
|
|
2583
|
+
...props
|
|
2584
|
+
});
|
|
2585
|
+
|
|
2586
|
+
//#endregion
|
|
2587
|
+
//#region src/components/ui/data-table/get-column-label.ts
|
|
2588
|
+
/**
|
|
2589
|
+
* Read a column the way users see it, so menus and handles name it: its `meta.label`, then a plain-text header, then its id.
|
|
2590
|
+
*/
|
|
2591
|
+
const getColumnLabel = (column) => {
|
|
2592
|
+
const { header, meta } = column.columnDef;
|
|
2593
|
+
const fallback = typeof header === "string" ? header : column.id;
|
|
2594
|
+
return meta?.label ?? fallback;
|
|
2595
|
+
};
|
|
2596
|
+
|
|
2597
|
+
//#endregion
|
|
2598
|
+
//#region src/components/ui/data-table/data-table-column-filter.tsx
|
|
2599
|
+
const TEXT_FILTER_PLACEHOLDER = "Contains";
|
|
2600
|
+
const EMPTY_OPTIONS_TEXT = "No values";
|
|
2601
|
+
/**
|
|
2602
|
+
* Turn cell values into checklist options. List-valued cells count as one value each in TanStack's facets, so their items are
|
|
2603
|
+
* spread out first: a tags column then offers each tag rather than each combination. Empty values offer nothing to check.
|
|
2604
|
+
*/
|
|
2605
|
+
const toOptions = ({ values }) => {
|
|
2606
|
+
const items = values.flatMap((value) => Array.isArray(value) ? value : [value]).filter((value) => value !== void 0 && value !== null && value !== "").map(String);
|
|
2607
|
+
return [...new Set(items)].sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
|
|
2608
|
+
};
|
|
2609
|
+
/**
|
|
2610
|
+
* The values a `values` filter offers: the column's `filterOptions`, else the values in the data.
|
|
2611
|
+
* Client filtering reads TanStack's facets, which leave out the column's own filter so unchecked values stay offered.
|
|
2612
|
+
* Manual filtering has no facets, so it falls back to the values in the rows currently loaded.
|
|
2613
|
+
* Checked values stay listed even when other filters hide every row that holds them, so they can be unchecked.
|
|
2614
|
+
*/
|
|
2615
|
+
const getFilterOptions = ({ column, selected, table }) => {
|
|
2616
|
+
const filterOptions = column.columnDef.meta?.filterOptions;
|
|
2617
|
+
if (filterOptions) return filterOptions;
|
|
2618
|
+
return toOptions({ values: [...table.options.manualFiltering ? table.getCoreRowModel().flatRows.map((row) => row.getValue(column.id)) : [...column.getFacetedUniqueValues().keys()], ...selected] });
|
|
2619
|
+
};
|
|
2620
|
+
/** The checklist of a `values` filter. The checked values are the filter value; unchecking the last one removes the filter. */
|
|
2621
|
+
const DataTableValuesFilter = ({ column, filterValue }) => {
|
|
2622
|
+
const { table } = useDataTableContext();
|
|
2623
|
+
const selected = Array.isArray(filterValue) ? filterValue.map(String) : [];
|
|
2624
|
+
const options = getFilterOptions({
|
|
2625
|
+
column,
|
|
2626
|
+
selected,
|
|
2627
|
+
table
|
|
2628
|
+
});
|
|
2629
|
+
const toggle = ({ checked, option }) => {
|
|
2630
|
+
const next = checked ? [...selected, option] : selected.filter((value) => value !== option);
|
|
2631
|
+
column.setFilterValue(next.length > 0 ? next : void 0);
|
|
2632
|
+
};
|
|
2633
|
+
if (options.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2634
|
+
className: "text-sm text-muted-foreground",
|
|
2635
|
+
children: EMPTY_OPTIONS_TEXT
|
|
2636
|
+
});
|
|
2637
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2638
|
+
"data-slot": "data-table-column-filter-options",
|
|
2639
|
+
className: "-m-1 flex max-h-60 flex-col gap-2 overflow-y-auto p-1",
|
|
2640
|
+
children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Label, {
|
|
2641
|
+
className: "flex items-center gap-2 text-sm font-normal",
|
|
2642
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, {
|
|
2643
|
+
checked: selected.includes(option),
|
|
2644
|
+
onCheckedChange: (checked) => toggle({
|
|
2645
|
+
checked: checked === true,
|
|
2646
|
+
option
|
|
2647
|
+
})
|
|
2648
|
+
}), option]
|
|
2649
|
+
}, option))
|
|
2650
|
+
});
|
|
2651
|
+
};
|
|
2652
|
+
/**
|
|
2653
|
+
* A filter button that opens a column's filter: a text field for `meta.filter: 'text'`, or a checklist for `meta.filter: 'values'`.
|
|
2654
|
+
* `DataTableContent` already adds it to each filterable header; render it yourself only in a header you build without `DataTableContent`.
|
|
2655
|
+
* The checklist offers `meta.filterOptions`, else the values in the data. With manual filtering and no `filterOptions`,
|
|
2656
|
+
* it can only offer the values in the rows currently loaded, so pass `filterOptions` when the server holds more.
|
|
2657
|
+
*
|
|
2658
|
+
* @example
|
|
2659
|
+
* ```tsx
|
|
2660
|
+
* const columns: ColumnDef<User>[] = [
|
|
2661
|
+
* { accessorKey: 'role', header: 'Role', meta: { filter: 'values' } },
|
|
2662
|
+
* ];
|
|
2663
|
+
*
|
|
2664
|
+
* // In a header row you render yourself:
|
|
2665
|
+
* <th>
|
|
2666
|
+
* Role
|
|
2667
|
+
* <DataTableColumnFilter column={header.column} />
|
|
2668
|
+
* </th>
|
|
2669
|
+
* ```
|
|
2670
|
+
* @returns The rendered filter button and its popover.
|
|
2671
|
+
* @see DataTableContent
|
|
2672
|
+
* @see DataTableActiveFilters
|
|
2673
|
+
* @see DataTableSearch
|
|
2674
|
+
*/
|
|
2675
|
+
const DataTableColumnFilter = ({ className, column }) => {
|
|
2676
|
+
const label = getColumnLabel(column);
|
|
2677
|
+
const isFiltered = column.getIsFiltered();
|
|
2678
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Popover, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverTrigger, {
|
|
2679
|
+
asChild: true,
|
|
2680
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Button, {
|
|
2681
|
+
"aria-label": isFiltered ? `Filter ${label}, filtered` : `Filter ${label}`,
|
|
2682
|
+
"data-slot": "data-table-column-filter",
|
|
2683
|
+
"data-filtered": isFiltered || void 0,
|
|
2684
|
+
size: "icon-xs",
|
|
2685
|
+
variant: "ghost",
|
|
2686
|
+
className: require_toggle_row.cn("ms-1 align-middle before:-inset-1 data-[filtered=true]:text-foreground", className),
|
|
2687
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2688
|
+
icon: _hugeicons_core_free_icons.FilterIcon,
|
|
2689
|
+
"aria-hidden": "true"
|
|
2690
|
+
}), isFiltered && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2691
|
+
"aria-hidden": "true",
|
|
2692
|
+
className: "absolute end-0.5 top-0.5 size-1.5 rounded-full bg-[var(--action)]"
|
|
2693
|
+
})]
|
|
2694
|
+
})
|
|
2695
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableColumnFilterContent, { column })] });
|
|
2696
|
+
};
|
|
2697
|
+
/** The body of a column's filter popover, shared by the header filter button and the active-filter chips. */
|
|
2698
|
+
const DataTableColumnFilterContent = ({ column }) => {
|
|
2699
|
+
const label = getColumnLabel(column);
|
|
2700
|
+
const filterValue = column.getFilterValue();
|
|
2701
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(PopoverContent, {
|
|
2702
|
+
"aria-label": `Filter ${label}`,
|
|
2703
|
+
align: "start",
|
|
2704
|
+
className: "flex w-56 flex-col gap-3 p-3",
|
|
2705
|
+
children: [column.columnDef.meta?.filter === "values" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableValuesFilter, {
|
|
2706
|
+
column,
|
|
2707
|
+
filterValue
|
|
2708
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Input, {
|
|
2709
|
+
"aria-label": `Filter ${label}`,
|
|
2710
|
+
placeholder: TEXT_FILTER_PLACEHOLDER,
|
|
2711
|
+
value: typeof filterValue === "string" ? filterValue : "",
|
|
2712
|
+
onChange: (event) => column.setFilterValue(event.target.value)
|
|
2713
|
+
}), column.getIsFiltered() && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2714
|
+
"data-slot": "data-table-column-filter-footer",
|
|
2715
|
+
className: "-mx-3 flex justify-end border-t border-[var(--border-divider)] px-3 pt-3",
|
|
2716
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Button, {
|
|
2717
|
+
size: "sm",
|
|
2718
|
+
variant: "secondary",
|
|
2719
|
+
onClick: () => column.setFilterValue(void 0),
|
|
2720
|
+
children: "Clear"
|
|
2721
|
+
})
|
|
2722
|
+
})]
|
|
2723
|
+
});
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
//#endregion
|
|
2727
|
+
//#region src/components/ui/data-table/data-table-active-filters.tsx
|
|
2728
|
+
/** A `values` filter holds the checked values; a `text` filter holds the text. */
|
|
2729
|
+
const toFilterValues = (value) => Array.isArray(value) ? value.map(String) : [String(value)];
|
|
2730
|
+
const MAX_SHOWN_VALUES = 2;
|
|
2731
|
+
const CHIP_CONTROL = "inline-flex h-6 items-center rounded-[4px] outline-none transition-[color,background-color] duration-150 ease-out hover:bg-[var(--overlay-hover)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]";
|
|
2732
|
+
const DataTableFilterChip = ({ column, label, onRemove, removeLabel, values }) => {
|
|
2733
|
+
const fullValue = values.join(", ");
|
|
2734
|
+
const hiddenCount = values.length - MAX_SHOWN_VALUES;
|
|
2735
|
+
const shownValue = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [values.slice(0, MAX_SHOWN_VALUES).join(", "), hiddenCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2736
|
+
className: "ms-1 text-muted-foreground",
|
|
2737
|
+
children: ["+", hiddenCount]
|
|
2738
|
+
})] });
|
|
2739
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2740
|
+
"data-slot": "data-table-filter-chip",
|
|
2741
|
+
title: hiddenCount > 0 ? fullValue : void 0,
|
|
2742
|
+
className: "inline-flex h-8 items-center rounded-md bg-white p-1 text-[13px] shadow-[var(--shadow-secondary)] dark:bg-input/30",
|
|
2743
|
+
children: [
|
|
2744
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2745
|
+
type: "button",
|
|
2746
|
+
"aria-label": removeLabel,
|
|
2747
|
+
onClick: onRemove,
|
|
2748
|
+
className: require_toggle_row.cn(CHIP_CONTROL, "w-6 justify-center text-muted-foreground/70 hover:text-foreground"),
|
|
2749
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2750
|
+
icon: _hugeicons_core_free_icons.Cancel01Icon,
|
|
2751
|
+
size: 12,
|
|
2752
|
+
strokeWidth: 2,
|
|
2753
|
+
"aria-hidden": "true"
|
|
2754
|
+
})
|
|
2755
|
+
}),
|
|
2756
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2757
|
+
className: "ps-1 pe-2 text-muted-foreground",
|
|
2758
|
+
children: [label, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2759
|
+
className: "sr-only",
|
|
2760
|
+
children: ": "
|
|
2761
|
+
})]
|
|
2762
|
+
}),
|
|
2763
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2764
|
+
"aria-hidden": "true",
|
|
2765
|
+
className: "h-4 w-px bg-[var(--border-divider)]"
|
|
2766
|
+
}),
|
|
2767
|
+
column ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Popover, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PopoverTrigger, {
|
|
2768
|
+
asChild: true,
|
|
2769
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2770
|
+
type: "button",
|
|
2771
|
+
"aria-label": `Change ${label} filter: ${fullValue}`,
|
|
2772
|
+
className: require_toggle_row.cn(CHIP_CONTROL, "ms-1 gap-1 ps-1.5 pe-1 font-medium text-[var(--action)]"),
|
|
2773
|
+
children: [shownValue, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2774
|
+
icon: _hugeicons_core_free_icons.ArrowDown01Icon,
|
|
2775
|
+
size: 14,
|
|
2776
|
+
"aria-hidden": "true",
|
|
2777
|
+
className: "opacity-60"
|
|
2778
|
+
})]
|
|
2779
|
+
})
|
|
2780
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableColumnFilterContent, { column })] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2781
|
+
className: "ps-2 pe-1.5 font-medium text-[var(--action)]",
|
|
2782
|
+
children: shownValue
|
|
2783
|
+
})
|
|
2784
|
+
]
|
|
2785
|
+
});
|
|
2786
|
+
};
|
|
2787
|
+
/**
|
|
2788
|
+
* One chip per active filter, each with a button that removes it, plus a button that clears them all.
|
|
2789
|
+
* The search text gets a chip too. Renders nothing while no filter is active.
|
|
2790
|
+
*
|
|
2791
|
+
* @example
|
|
2792
|
+
* ```tsx
|
|
2793
|
+
* <DataTable table={dataTable}>
|
|
2794
|
+
* <DataTableToolbar>
|
|
2795
|
+
* <DataTableSearch />
|
|
2796
|
+
* </DataTableToolbar>
|
|
2797
|
+
* <DataTableActiveFilters />
|
|
2798
|
+
* <DataTableContent />
|
|
2799
|
+
* </DataTable>
|
|
2800
|
+
* ```
|
|
2801
|
+
* @returns The rendered filter chips, or nothing when no filter is active.
|
|
2802
|
+
* @see DataTableColumnFilter
|
|
2803
|
+
* @see DataTableSearch
|
|
2804
|
+
* @see useDataTable
|
|
2805
|
+
*/
|
|
2806
|
+
const DataTableActiveFilters = ({ className }) => {
|
|
2807
|
+
const { table } = useDataTableContext();
|
|
2808
|
+
const { columnFilters, globalFilter } = table.getState();
|
|
2809
|
+
const search = typeof globalFilter === "string" ? globalFilter : "";
|
|
2810
|
+
if (columnFilters.length === 0 && search === "") return null;
|
|
2811
|
+
const clearAll = () => {
|
|
2812
|
+
table.setColumnFilters([]);
|
|
2813
|
+
table.setGlobalFilter("");
|
|
2814
|
+
};
|
|
2815
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
2816
|
+
"aria-label": "Active filters",
|
|
2817
|
+
"data-slot": "data-table-active-filters",
|
|
2818
|
+
className: require_toggle_row.cn("flex min-w-0 flex-wrap items-center gap-2", className),
|
|
2819
|
+
children: [
|
|
2820
|
+
search !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableFilterChip, {
|
|
2821
|
+
label: "Search",
|
|
2822
|
+
onRemove: () => table.setGlobalFilter(""),
|
|
2823
|
+
removeLabel: "Remove search filter",
|
|
2824
|
+
values: [search]
|
|
2825
|
+
}),
|
|
2826
|
+
columnFilters.map(({ id, value }) => {
|
|
2827
|
+
const column = table.getAllFlatColumns().find((candidate) => candidate.id === id);
|
|
2828
|
+
const label = column ? getColumnLabel(column) : id;
|
|
2829
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableFilterChip, {
|
|
2830
|
+
column: column?.columnDef.meta?.filter ? column : void 0,
|
|
2831
|
+
label,
|
|
2832
|
+
onRemove: () => table.setColumnFilters((old) => old.filter((filter) => filter.id !== id)),
|
|
2833
|
+
removeLabel: `Remove ${label} filter`,
|
|
2834
|
+
values: toFilterValues(value)
|
|
2835
|
+
}, id);
|
|
2836
|
+
}),
|
|
2837
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Button, {
|
|
2838
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
2839
|
+
variant: "ghost",
|
|
2840
|
+
onClick: clearAll,
|
|
2841
|
+
children: "Clear filters"
|
|
2842
|
+
})
|
|
2843
|
+
]
|
|
2844
|
+
});
|
|
2845
|
+
};
|
|
2846
|
+
|
|
2847
|
+
//#endregion
|
|
2848
|
+
//#region src/components/ui/data-table/data-table-column-visibility.tsx
|
|
2849
|
+
/**
|
|
2850
|
+
* Lets people choose which columns are shown, from a menu with a checkbox per column.
|
|
2851
|
+
*
|
|
2852
|
+
* @example
|
|
2853
|
+
* ```tsx
|
|
2854
|
+
* <DataTable table={dataTable}>
|
|
2855
|
+
* <DataTableToolbar>
|
|
2856
|
+
* <DataTableColumnVisibility label="Columns" />
|
|
2857
|
+
* </DataTableToolbar>
|
|
2858
|
+
* <DataTableContent />
|
|
2859
|
+
* </DataTable>
|
|
2860
|
+
* ```
|
|
2861
|
+
* @returns The rendered column picker menu.
|
|
2862
|
+
* @see DataTable
|
|
2863
|
+
* @see DataTableToolbar
|
|
2864
|
+
* @see useDataTable
|
|
2865
|
+
*/
|
|
2866
|
+
const DataTableColumnVisibility = ({ className, label = "Columns" }) => {
|
|
2867
|
+
const { table } = useDataTableContext();
|
|
2868
|
+
const columns = table.getAllLeafColumns().filter((column) => column.getCanHide());
|
|
2869
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenu, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuTrigger, {
|
|
2870
|
+
asChild: true,
|
|
2871
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Button, {
|
|
2872
|
+
"data-slot": "data-table-column-visibility",
|
|
2873
|
+
className,
|
|
2874
|
+
variant: "outline",
|
|
2875
|
+
children: [
|
|
2876
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2877
|
+
icon: _hugeicons_core_free_icons.LayoutThreeColumnIcon,
|
|
2878
|
+
"aria-hidden": "true"
|
|
2879
|
+
}),
|
|
2880
|
+
label,
|
|
2881
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2882
|
+
icon: _hugeicons_core_free_icons.ArrowDown01Icon,
|
|
2883
|
+
"aria-hidden": "true"
|
|
2884
|
+
})
|
|
2885
|
+
]
|
|
2886
|
+
})
|
|
2887
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuContent, {
|
|
2888
|
+
align: "start",
|
|
2889
|
+
children: columns.map((column) => {
|
|
2890
|
+
const visible = column.getIsVisible();
|
|
2891
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dropdown_menu.CheckboxItem, {
|
|
2892
|
+
"data-slot": "data-table-column-visibility-item",
|
|
2893
|
+
className: "relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-2 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
2894
|
+
checked: visible,
|
|
2895
|
+
onCheckedChange: (checked) => column.toggleVisibility(checked === true),
|
|
2896
|
+
onSelect: (event) => event.preventDefault(),
|
|
2897
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, {
|
|
2898
|
+
checked: visible,
|
|
2899
|
+
tabIndex: -1,
|
|
2900
|
+
"aria-hidden": "true",
|
|
2901
|
+
className: "pointer-events-none"
|
|
2902
|
+
}), getColumnLabel(column)]
|
|
2903
|
+
}, column.id);
|
|
2904
|
+
})
|
|
2905
|
+
})] });
|
|
2906
|
+
};
|
|
2907
|
+
|
|
2908
|
+
//#endregion
|
|
2909
|
+
//#region src/components/empty-state/empty-state.tsx
|
|
2910
|
+
const EmptyState = ({ icon: Icon$2, title, description, action, className }) => {
|
|
2911
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2912
|
+
className: require_toggle_row.cn("flex flex-col items-center justify-center py-16 px-8 text-center", className),
|
|
2913
|
+
children: [
|
|
2914
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2915
|
+
className: "flex size-12 items-center justify-center rounded-xl bg-muted mb-4",
|
|
2916
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$2, { className: "size-6 text-muted-foreground" })
|
|
2917
|
+
}),
|
|
2918
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
2919
|
+
className: "text-sm font-semibold",
|
|
2920
|
+
children: title
|
|
2921
|
+
}),
|
|
2922
|
+
description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2923
|
+
className: "text-sm text-muted-foreground mt-1 max-w-sm",
|
|
2924
|
+
children: description
|
|
2925
|
+
}),
|
|
2926
|
+
action && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2927
|
+
className: "mt-4",
|
|
2928
|
+
children: action
|
|
2929
|
+
})
|
|
2930
|
+
]
|
|
2931
|
+
});
|
|
2932
|
+
};
|
|
2933
|
+
|
|
2934
|
+
//#endregion
|
|
2935
|
+
//#region src/components/ui/data-table/data-table-placeholder-rows.tsx
|
|
2936
|
+
/** Varied bar widths read as real content rather than one repeated block. */
|
|
2937
|
+
const PLACEHOLDER_BARS = [
|
|
2938
|
+
"w-28",
|
|
2939
|
+
"w-14",
|
|
2940
|
+
"w-24",
|
|
2941
|
+
"w-36",
|
|
2942
|
+
"w-24",
|
|
2943
|
+
"w-14"
|
|
2944
|
+
];
|
|
2945
|
+
const GHOST_ROW_COUNT = 6;
|
|
2946
|
+
/** Placeholder, group and detail rows are not interactive, so they must not take the row hover fill. */
|
|
2947
|
+
const STATIC_ROW = "hover:bg-transparent hover:[--table-row-overlay:transparent]";
|
|
2948
|
+
const getBarWidth = (columnIndex) => PLACEHOLDER_BARS[columnIndex % PLACEHOLDER_BARS.length];
|
|
2949
|
+
/** Skeleton rows shown while data loads. Only the first bar is announced, so screen readers hear "Loading" once. */
|
|
2950
|
+
const DataTableSkeletonRows = ({ columnCount, rowCount }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Array.from({ length: rowCount }, (_, rowIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
2951
|
+
"data-slot": "data-table-skeleton-row",
|
|
2952
|
+
className: STATIC_ROW,
|
|
2953
|
+
children: Array.from({ length: columnCount }, (_$1, columnIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, {
|
|
2954
|
+
"aria-hidden": rowIndex > 0 || columnIndex > 0 || void 0,
|
|
2955
|
+
className: require_toggle_row.cn("h-4 max-w-full", getBarWidth(columnIndex))
|
|
2956
|
+
}) }, columnIndex))
|
|
2957
|
+
}, rowIndex)) });
|
|
2958
|
+
/** Ghost rows keep the table's shape behind an icon and title. */
|
|
2959
|
+
const DataTableEmptyRow = ({ action, columnCount, icon, title }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
2960
|
+
"data-slot": "data-table-empty",
|
|
2961
|
+
className: STATIC_ROW,
|
|
2962
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, {
|
|
2963
|
+
colSpan: columnCount,
|
|
2964
|
+
className: "p-0 whitespace-normal",
|
|
2965
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2966
|
+
className: "grid",
|
|
2967
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2968
|
+
"aria-hidden": "true",
|
|
2969
|
+
className: "pointer-events-none col-start-1 row-start-1 select-none opacity-45 [mask-image:radial-gradient(ellipse_at_center,transparent_48%,black_88%)]",
|
|
2970
|
+
children: Array.from({ length: GHOST_ROW_COUNT }, (_, rowIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2971
|
+
"data-slot": "data-table-ghost-row",
|
|
2972
|
+
className: "grid items-center border-b border-[var(--border-divider)] py-3.5 last:border-b-0",
|
|
2973
|
+
style: { gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` },
|
|
2974
|
+
children: Array.from({ length: columnCount }, (_$1, columnIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2975
|
+
className: "px-4",
|
|
2976
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_toggle_row.cn("block h-2.5 max-w-full rounded-full bg-[var(--bg-accented)]", getBarWidth(columnIndex)) })
|
|
2977
|
+
}, columnIndex))
|
|
2978
|
+
}, rowIndex))
|
|
2979
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2980
|
+
className: "sticky start-0 col-start-1 row-start-1 flex w-[100cqw] items-center justify-center justify-self-start",
|
|
2981
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EmptyState, {
|
|
2982
|
+
action,
|
|
2983
|
+
className: "py-0",
|
|
2984
|
+
icon,
|
|
2985
|
+
title
|
|
2986
|
+
})
|
|
2987
|
+
})]
|
|
2988
|
+
})
|
|
2989
|
+
})
|
|
2990
|
+
});
|
|
2991
|
+
|
|
2992
|
+
//#endregion
|
|
2993
|
+
//#region src/components/ui/data-table/expand-chevron.tsx
|
|
2994
|
+
/** A right-pointing chevron that turns to point down while its group is open. */
|
|
2995
|
+
const ExpandChevron = ({ isOpen }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
2996
|
+
icon: _hugeicons_core_free_icons.ArrowRight01Icon,
|
|
2997
|
+
"aria-hidden": "true",
|
|
2998
|
+
className: require_toggle_row.cn("transition-transform duration-150 motion-reduce:transition-none", isOpen && "rotate-90")
|
|
2999
|
+
});
|
|
3000
|
+
|
|
3001
|
+
//#endregion
|
|
3002
|
+
//#region src/components/ui/data-table/get-pinned-cell-props.ts
|
|
3003
|
+
/** Pinned cells need an opaque base so scrolling text cannot show through; the body overlay still follows row hover and selection. */
|
|
3004
|
+
const PINNED_BACKGROUND = {
|
|
3005
|
+
body: "bg-card bg-[image:linear-gradient(var(--table-row-overlay,transparent),var(--table-row-overlay,transparent))]",
|
|
3006
|
+
header: "bg-[var(--tray-chrome)]"
|
|
3007
|
+
};
|
|
3008
|
+
/** A 1px divider marks where pinned columns meet the scrolling ones. */
|
|
3009
|
+
const PINNED_EDGE = {
|
|
3010
|
+
left: "shadow-[inset_-1px_0_0_var(--border-divider)]",
|
|
3011
|
+
right: "shadow-[inset_1px_0_0_var(--border-divider)]"
|
|
3012
|
+
};
|
|
3013
|
+
/** Sticky position, background and edge divider for a cell in a pinned column. */
|
|
3014
|
+
const getPinnedCellProps = ({ column, section }) => {
|
|
3015
|
+
const side = column.getIsPinned();
|
|
3016
|
+
if (!side) return {};
|
|
3017
|
+
const isEdge = side === "left" ? column.getIsLastColumn("left") : column.getIsFirstColumn("right");
|
|
3018
|
+
return {
|
|
3019
|
+
className: require_toggle_row.cn("sticky z-10", PINNED_BACKGROUND[section], isEdge && PINNED_EDGE[side]),
|
|
3020
|
+
"data-pinned": side,
|
|
3021
|
+
style: side === "left" ? { insetInlineStart: column.getStart("left") } : { insetInlineEnd: column.getAfter("right") }
|
|
3022
|
+
};
|
|
3023
|
+
};
|
|
3024
|
+
|
|
3025
|
+
//#endregion
|
|
3026
|
+
//#region src/components/ui/data-table/selection-column.tsx
|
|
3027
|
+
/**
|
|
3028
|
+
* Id of the checkbox column added by `selectionColumn`. Use it to find that column, for example when pinning it to the start edge.
|
|
3029
|
+
*
|
|
3030
|
+
* @example
|
|
3031
|
+
* ```tsx
|
|
3032
|
+
* const columnPinning = { initial: { left: [SELECTION_COLUMN_ID] } };
|
|
3033
|
+
* ```
|
|
3034
|
+
* @see selectionColumn
|
|
3035
|
+
* @see useDataTable
|
|
3036
|
+
*/
|
|
3037
|
+
const SELECTION_COLUMN_ID = "select";
|
|
3038
|
+
/** Fixed width in px; DataTableContent sizes headers from it when resizing or pinning is on. */
|
|
3039
|
+
const SELECTION_COLUMN_SIZE = 40;
|
|
3040
|
+
const getAllRowsCheckedState = (table) => {
|
|
3041
|
+
if (table.getIsAllPageRowsSelected()) return true;
|
|
3042
|
+
return table.getIsSomePageRowsSelected() ? "indeterminate" : false;
|
|
3043
|
+
};
|
|
3044
|
+
const SelectionCell = ({ row }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, {
|
|
3045
|
+
"aria-label": "Select row",
|
|
3046
|
+
checked: row.getIsSelected(),
|
|
3047
|
+
disabled: !row.getCanSelect(),
|
|
3048
|
+
onCheckedChange: (checked) => row.toggleSelected(checked === true)
|
|
3049
|
+
});
|
|
3050
|
+
const SelectionHeader = ({ table }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Checkbox, {
|
|
3051
|
+
"aria-label": "Select all rows",
|
|
3052
|
+
checked: getAllRowsCheckedState(table),
|
|
3053
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked === true)
|
|
3054
|
+
});
|
|
3055
|
+
/**
|
|
3056
|
+
* A checkbox column for row selection. Put it first in `columns` and pass `selection` to `useDataTable`.
|
|
3057
|
+
*
|
|
3058
|
+
* @example
|
|
3059
|
+
* const columns = [selectionColumn<User>(), { accessorKey: 'name', header: 'Name' }];
|
|
3060
|
+
* @returns A column definition that renders a checkbox for each row and a select-all checkbox in the header.
|
|
3061
|
+
* @see SELECTION_COLUMN_ID
|
|
3062
|
+
* @see useDataTable
|
|
3063
|
+
*/
|
|
3064
|
+
const selectionColumn = () => ({
|
|
3065
|
+
cell: SelectionCell,
|
|
3066
|
+
enableHiding: false,
|
|
3067
|
+
enableResizing: false,
|
|
3068
|
+
enableSorting: false,
|
|
3069
|
+
header: SelectionHeader,
|
|
3070
|
+
id: SELECTION_COLUMN_ID,
|
|
3071
|
+
size: SELECTION_COLUMN_SIZE
|
|
3072
|
+
});
|
|
3073
|
+
|
|
3074
|
+
//#endregion
|
|
3075
|
+
//#region src/components/ui/data-table/data-table-rows.tsx
|
|
3076
|
+
/** Fixed layout cells clip and truncate, so a narrowed column cannot spill into its neighbour. The checkbox column never needs it. */
|
|
3077
|
+
const FIXED_LAYOUT_CELL_CLASS = "overflow-hidden text-ellipsis";
|
|
3078
|
+
/**
|
|
3079
|
+
* Pins full-width row content to the visible part of a horizontally scrolling table. The single spanning cell has no
|
|
3080
|
+
* pinned part of its own, so without this the content scrolls off to the start. 100cqw is the tray's width, since the
|
|
3081
|
+
* tray is an inline-size container. The cell drops its padding and this element carries it, so the content is exactly
|
|
3082
|
+
* the visible width and never widens the table.
|
|
3083
|
+
*/
|
|
3084
|
+
const STICKY_ROW_CONTENT = "sticky start-0 w-[100cqw] px-4 py-2.5";
|
|
3085
|
+
/** Shown for a group whose rows have no value in the grouped column. */
|
|
3086
|
+
const EMPTY_GROUP_LABEL = "None";
|
|
3087
|
+
/** The checkbox column holds one control, so it stays narrow and never clips. */
|
|
3088
|
+
const isControlColumn = (columnId) => columnId === SELECTION_COLUMN_ID;
|
|
3089
|
+
/** Rows inside groups step in by 1.25rem per level from the cell's own 1rem padding. */
|
|
3090
|
+
const getIndent = (depth) => `calc(1rem + ${depth} * 1.25rem)`;
|
|
3091
|
+
const getGroupLabel = ({ groupingColumnId, row }) => {
|
|
3092
|
+
const value = row.getGroupingValue(groupingColumnId);
|
|
3093
|
+
return `${value === void 0 || value === null || value === "" ? EMPTY_GROUP_LABEL : String(value)} (${row.getLeafRows().filter((leaf) => !leaf.getIsGrouped()).length})`;
|
|
3094
|
+
};
|
|
3095
|
+
const DataTableRow = ({ hasFixedLayout, row, rowRef, ...props }) => {
|
|
3096
|
+
const cells = row.getVisibleCells();
|
|
3097
|
+
const indentedCellId = row.depth > 0 ? cells.find((cell) => !isControlColumn(cell.column.id))?.id : void 0;
|
|
3098
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
3099
|
+
ref: rowRef,
|
|
3100
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
3101
|
+
...props,
|
|
3102
|
+
children: cells.map((cell) => {
|
|
3103
|
+
const pinned = getPinnedCellProps({
|
|
3104
|
+
column: cell.column,
|
|
3105
|
+
section: "body"
|
|
3106
|
+
});
|
|
3107
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, {
|
|
3108
|
+
"data-pinned": pinned["data-pinned"],
|
|
3109
|
+
className: require_toggle_row.cn(hasFixedLayout && !isControlColumn(cell.column.id) && FIXED_LAYOUT_CELL_CLASS, pinned.className),
|
|
3110
|
+
style: cell.id === indentedCellId ? {
|
|
3111
|
+
...pinned.style,
|
|
3112
|
+
paddingInlineStart: getIndent(row.depth)
|
|
3113
|
+
} : pinned.style,
|
|
3114
|
+
children: (0, _tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
3115
|
+
}, cell.id);
|
|
3116
|
+
})
|
|
3117
|
+
});
|
|
3118
|
+
};
|
|
3119
|
+
/** One full-width row naming the group and how many rows it holds, with a button that opens or closes it. */
|
|
3120
|
+
const DataTableGroupRow = ({ columnCount, groupingColumnId, row, rowRef, ...props }) => {
|
|
3121
|
+
const isOpen = row.getIsExpanded();
|
|
3122
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
3123
|
+
ref: rowRef,
|
|
3124
|
+
"data-slot": "data-table-group-row",
|
|
3125
|
+
className: STATIC_ROW,
|
|
3126
|
+
...props,
|
|
3127
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableCell, {
|
|
3128
|
+
colSpan: columnCount,
|
|
3129
|
+
className: "p-0 font-medium",
|
|
3130
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3131
|
+
className: STICKY_ROW_CONTENT,
|
|
3132
|
+
style: row.depth > 0 ? { paddingInlineStart: getIndent(row.depth) } : void 0,
|
|
3133
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3134
|
+
type: "button",
|
|
3135
|
+
"aria-expanded": isOpen,
|
|
3136
|
+
onClick: row.getToggleExpandedHandler(),
|
|
3137
|
+
className: "-mx-1.5 inline-flex items-center gap-1.5 rounded-md px-1.5 py-1 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] [&_svg]:size-3.5",
|
|
3138
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExpandChevron, { isOpen }), getGroupLabel({
|
|
3139
|
+
groupingColumnId,
|
|
3140
|
+
row
|
|
3141
|
+
})]
|
|
3142
|
+
})
|
|
3143
|
+
})
|
|
3144
|
+
})
|
|
3145
|
+
});
|
|
3146
|
+
};
|
|
3147
|
+
/** One table row, as a group header or a data row. Row props and `rowRef` land on its `<tr>`. */
|
|
3148
|
+
const DataTableBodyRow = ({ columnCount, hasFixedLayout, row, ...props }) => {
|
|
3149
|
+
const { groupingColumnId } = row;
|
|
3150
|
+
if (groupingColumnId) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableGroupRow, {
|
|
3151
|
+
columnCount,
|
|
3152
|
+
groupingColumnId,
|
|
3153
|
+
row,
|
|
3154
|
+
...props
|
|
3155
|
+
});
|
|
3156
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableRow, {
|
|
3157
|
+
hasFixedLayout,
|
|
3158
|
+
row,
|
|
3159
|
+
...props
|
|
3160
|
+
});
|
|
3161
|
+
};
|
|
3162
|
+
|
|
3163
|
+
//#endregion
|
|
3164
|
+
//#region src/components/ui/data-table/data-table-content.tsx
|
|
3165
|
+
const DEFAULT_EMPTY_TITLE = "No results";
|
|
3166
|
+
const DEFAULT_EMPTY_FILTERED_TITLE = "No matching results";
|
|
3167
|
+
const DEFAULT_LOADING_ROW_COUNT = 5;
|
|
3168
|
+
const ARIA_SORT = {
|
|
3169
|
+
asc: "ascending",
|
|
3170
|
+
desc: "descending"
|
|
3171
|
+
};
|
|
3172
|
+
const SORT_ICON = {
|
|
3173
|
+
asc: _hugeicons_core_free_icons.ArrowUp01Icon,
|
|
3174
|
+
desc: _hugeicons_core_free_icons.ArrowDown01Icon
|
|
3175
|
+
};
|
|
3176
|
+
/** Arrow keys resize in 16px steps, matching the 4px spacing grid. */
|
|
3177
|
+
const RESIZE_STEP = {
|
|
3178
|
+
ArrowLeft: -16,
|
|
3179
|
+
ArrowRight: 16
|
|
3180
|
+
};
|
|
3181
|
+
/** TanStack's default minimum column width. */
|
|
3182
|
+
const MIN_COLUMN_SIZE = 20;
|
|
3183
|
+
/** TanStack leaves columns unbounded; screen readers get a usable range instead. */
|
|
3184
|
+
const MAX_COLUMN_SIZE = 1e3;
|
|
3185
|
+
/** Rows rendered beyond each edge of the view when virtualization sets no overscan. */
|
|
3186
|
+
const DEFAULT_OVERSCAN = 8;
|
|
3187
|
+
const DefaultEmptyIcon = ({ className, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
3188
|
+
className,
|
|
3189
|
+
icon: _hugeicons_core_free_icons.Table01Icon,
|
|
3190
|
+
size
|
|
3191
|
+
});
|
|
3192
|
+
const getMaxColumnSize = (maxSize) => maxSize === void 0 || maxSize === Number.MAX_SAFE_INTEGER ? MAX_COLUMN_SIZE : maxSize;
|
|
3193
|
+
const DataTableResizeHandle = ({ header }) => {
|
|
3194
|
+
const { column } = header;
|
|
3195
|
+
const { table } = header.getContext();
|
|
3196
|
+
const size = column.getSize();
|
|
3197
|
+
const handleKeyDown = (event) => {
|
|
3198
|
+
const step = RESIZE_STEP[event.key];
|
|
3199
|
+
if (!step) return;
|
|
3200
|
+
event.preventDefault();
|
|
3201
|
+
table.setColumnSizing((sizing) => ({
|
|
3202
|
+
...sizing,
|
|
3203
|
+
[column.id]: size + step
|
|
3204
|
+
}));
|
|
3205
|
+
};
|
|
3206
|
+
const resize = header.getResizeHandler();
|
|
3207
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3208
|
+
role: "separator",
|
|
3209
|
+
"aria-label": `Resize ${getColumnLabel(column)}`,
|
|
3210
|
+
"aria-orientation": "vertical",
|
|
3211
|
+
"aria-valuemax": getMaxColumnSize(column.columnDef.maxSize),
|
|
3212
|
+
"aria-valuemin": column.columnDef.minSize ?? MIN_COLUMN_SIZE,
|
|
3213
|
+
"aria-valuenow": size,
|
|
3214
|
+
"aria-valuetext": `${size} pixels`,
|
|
3215
|
+
tabIndex: 0,
|
|
3216
|
+
"data-slot": "data-table-resize-handle",
|
|
3217
|
+
"data-resizing": column.getIsResizing() || void 0,
|
|
3218
|
+
onDoubleClick: () => column.resetSize(),
|
|
3219
|
+
onKeyDown: handleKeyDown,
|
|
3220
|
+
onMouseDown: resize,
|
|
3221
|
+
onTouchStart: resize,
|
|
3222
|
+
className: "absolute inset-y-0 end-0 w-2 cursor-col-resize touch-none select-none outline-none after:absolute after:inset-y-2 after:end-0 after:w-px after:bg-[var(--border-divider)] after:opacity-0 hover:after:opacity-100 focus-visible:after:bg-[var(--ring)] focus-visible:after:opacity-100 data-[resizing=true]:after:opacity-100"
|
|
3223
|
+
});
|
|
3224
|
+
};
|
|
3225
|
+
const DataTableHeadCell = ({ header, hasFixedLayout }) => {
|
|
3226
|
+
const { column } = header;
|
|
3227
|
+
const sorted = column.getIsSorted();
|
|
3228
|
+
const sortIndex = column.getSortIndex();
|
|
3229
|
+
const isMultiSort = header.getContext().table.getState().sorting.length > 1;
|
|
3230
|
+
const sortPriority = sorted && isMultiSort ? sortIndex + 1 : void 0;
|
|
3231
|
+
const pinned = getPinnedCellProps({
|
|
3232
|
+
column,
|
|
3233
|
+
section: "header"
|
|
3234
|
+
});
|
|
3235
|
+
const content = header.isPlaceholder ? null : (0, _tanstack_react_table.flexRender)(column.columnDef.header, header.getContext());
|
|
3236
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TableHead, {
|
|
3237
|
+
colSpan: header.colSpan,
|
|
3238
|
+
"aria-sort": sorted && sortIndex === 0 ? ARIA_SORT[sorted] : void 0,
|
|
3239
|
+
"data-pinned": pinned["data-pinned"],
|
|
3240
|
+
className: require_toggle_row.cn(column.getCanResize() && "relative", isControlColumn(column.id) && "w-px", hasFixedLayout && !isControlColumn(column.id) && FIXED_LAYOUT_CELL_CLASS, pinned.className),
|
|
3241
|
+
style: {
|
|
3242
|
+
...pinned.style,
|
|
3243
|
+
width: hasFixedLayout ? header.getSize() : void 0
|
|
3244
|
+
},
|
|
3245
|
+
children: [
|
|
3246
|
+
!header.isPlaceholder && column.getCanSort() ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
3247
|
+
type: "button",
|
|
3248
|
+
onClick: column.getToggleSortingHandler(),
|
|
3249
|
+
className: "-mx-1.5 inline-flex items-center gap-1 rounded-md px-1.5 py-1 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]",
|
|
3250
|
+
children: [
|
|
3251
|
+
content,
|
|
3252
|
+
sorted && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
3253
|
+
icon: SORT_ICON[sorted],
|
|
3254
|
+
size: 12,
|
|
3255
|
+
"aria-hidden": "true"
|
|
3256
|
+
}),
|
|
3257
|
+
sortPriority !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3258
|
+
"aria-hidden": "true",
|
|
3259
|
+
className: "text-[10px] tabular-nums",
|
|
3260
|
+
children: sortPriority
|
|
3261
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3262
|
+
className: "sr-only",
|
|
3263
|
+
children: [", sort priority ", sortPriority]
|
|
3264
|
+
})] })
|
|
3265
|
+
]
|
|
3266
|
+
}) : content,
|
|
3267
|
+
!header.isPlaceholder && column.getCanFilter() && column.columnDef.meta?.filter && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableColumnFilter, { column }),
|
|
3268
|
+
column.getCanResize() && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableResizeHandle, { header })
|
|
3269
|
+
]
|
|
3270
|
+
});
|
|
3271
|
+
};
|
|
3272
|
+
/** Holds the height of the rows virtualization leaves unrendered above or below the view. */
|
|
3273
|
+
const DataTableVirtualSpacer = ({ columnCount, height }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
|
|
3274
|
+
"aria-hidden": "true",
|
|
3275
|
+
"data-slot": "data-table-virtual-spacer",
|
|
3276
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
|
|
3277
|
+
colSpan: columnCount,
|
|
3278
|
+
className: "p-0",
|
|
3279
|
+
style: {
|
|
3280
|
+
borderWidth: 0,
|
|
3281
|
+
height
|
|
3282
|
+
}
|
|
3283
|
+
})
|
|
3284
|
+
});
|
|
3285
|
+
/**
|
|
3286
|
+
* The table itself: headers, rows, and the loading and empty states.
|
|
3287
|
+
*
|
|
3288
|
+
* @example
|
|
3289
|
+
* ```tsx
|
|
3290
|
+
* const dataTable = useDataTable({ columns, data, sorting: { mode: 'client' } });
|
|
3291
|
+
*
|
|
3292
|
+
* <DataTable table={dataTable}>
|
|
3293
|
+
* <DataTableContent emptyTitle="No users yet" />
|
|
3294
|
+
* </DataTable>
|
|
3295
|
+
* ```
|
|
3296
|
+
* @returns The rendered table element.
|
|
3297
|
+
* @see DataTable
|
|
3298
|
+
* @see useDataTable
|
|
3299
|
+
* @see DataTablePagination
|
|
3300
|
+
*/
|
|
3301
|
+
const DataTableContent = ({ className, emptyFilteredTitle = DEFAULT_EMPTY_FILTERED_TITLE, emptyIcon = DefaultEmptyIcon, emptyTitle = DEFAULT_EMPTY_TITLE, loadingRowCount = DEFAULT_LOADING_ROW_COUNT, style, ...props }) => {
|
|
3302
|
+
const { fill, loading, table, virtualization } = useDataTableContext();
|
|
3303
|
+
const viewportRef = (0, react.useRef)(null);
|
|
3304
|
+
const hasFixedLayout = table.options.enableColumnResizing === true || table.options.enableColumnPinning === true || virtualization !== void 0;
|
|
3305
|
+
const columnCount = table.getVisibleLeafColumns().length;
|
|
3306
|
+
const { rows } = table.getRowModel();
|
|
3307
|
+
const headerGroups = table.getHeaderGroups();
|
|
3308
|
+
const headerRowCount = headerGroups.length;
|
|
3309
|
+
const isVirtualized = virtualization !== void 0 && !loading && rows.length > 0;
|
|
3310
|
+
const { estimateRowHeight = 0, overscan = DEFAULT_OVERSCAN } = virtualization ?? {};
|
|
3311
|
+
const getItemKey = (0, react.useCallback)((index) => rows[index].id, [rows]);
|
|
3312
|
+
const virtualizer = (0, _tanstack_react_virtual.useVirtualizer)({
|
|
3313
|
+
count: isVirtualized ? rows.length : 0,
|
|
3314
|
+
enabled: isVirtualized,
|
|
3315
|
+
estimateSize: () => estimateRowHeight,
|
|
3316
|
+
getItemKey,
|
|
3317
|
+
getScrollElement: () => viewportRef.current,
|
|
3318
|
+
overscan
|
|
3319
|
+
});
|
|
3320
|
+
const renderVirtualRows = () => {
|
|
3321
|
+
const virtualRows = virtualizer.getVirtualItems();
|
|
3322
|
+
const firstRow = virtualRows.at(0);
|
|
3323
|
+
const lastRow = virtualRows.at(-1);
|
|
3324
|
+
const topHeight = firstRow ? firstRow.start : 0;
|
|
3325
|
+
const bottomHeight = lastRow ? virtualizer.getTotalSize() - lastRow.end : 0;
|
|
3326
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3327
|
+
topHeight > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableVirtualSpacer, {
|
|
3328
|
+
columnCount,
|
|
3329
|
+
height: topHeight
|
|
3330
|
+
}),
|
|
3331
|
+
virtualRows.map(({ index }) => {
|
|
3332
|
+
const row = rows[index];
|
|
3333
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableBodyRow, {
|
|
3334
|
+
"aria-rowindex": headerRowCount + index + 1,
|
|
3335
|
+
columnCount,
|
|
3336
|
+
"data-index": index,
|
|
3337
|
+
hasFixedLayout,
|
|
3338
|
+
row,
|
|
3339
|
+
rowRef: virtualizer.measureElement
|
|
3340
|
+
}, row.id);
|
|
3341
|
+
}),
|
|
3342
|
+
bottomHeight > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableVirtualSpacer, {
|
|
3343
|
+
columnCount,
|
|
3344
|
+
height: bottomHeight
|
|
3345
|
+
})
|
|
3346
|
+
] });
|
|
3347
|
+
};
|
|
3348
|
+
const renderEmptyRow = () => {
|
|
3349
|
+
const { columnFilters, globalFilter } = table.getState();
|
|
3350
|
+
if (columnFilters.length === 0 && globalFilter === "") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableEmptyRow, {
|
|
3351
|
+
columnCount,
|
|
3352
|
+
icon: emptyIcon,
|
|
3353
|
+
title: emptyTitle
|
|
3354
|
+
});
|
|
3355
|
+
const clearFilters = () => {
|
|
3356
|
+
table.setColumnFilters([]);
|
|
3357
|
+
table.setGlobalFilter("");
|
|
3358
|
+
};
|
|
3359
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableEmptyRow, {
|
|
3360
|
+
action: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Button, {
|
|
3361
|
+
variant: "outline",
|
|
3362
|
+
size: "sm",
|
|
3363
|
+
onClick: clearFilters,
|
|
3364
|
+
children: "Clear filters"
|
|
3365
|
+
}),
|
|
3366
|
+
columnCount,
|
|
3367
|
+
icon: emptyIcon,
|
|
3368
|
+
title: emptyFilteredTitle
|
|
3369
|
+
});
|
|
3370
|
+
};
|
|
3371
|
+
const renderBody = () => {
|
|
3372
|
+
if (loading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableSkeletonRows, {
|
|
3373
|
+
columnCount,
|
|
3374
|
+
rowCount: loadingRowCount
|
|
3375
|
+
});
|
|
3376
|
+
if (rows.length === 0) return renderEmptyRow();
|
|
3377
|
+
if (isVirtualized) return renderVirtualRows();
|
|
3378
|
+
return rows.map((row) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableBodyRow, {
|
|
3379
|
+
columnCount,
|
|
3380
|
+
hasFixedLayout,
|
|
3381
|
+
row
|
|
3382
|
+
}, row.id));
|
|
3383
|
+
};
|
|
3384
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Table, {
|
|
3385
|
+
fill,
|
|
3386
|
+
"aria-busy": loading || void 0,
|
|
3387
|
+
"aria-rowcount": isVirtualized ? rows.length + headerRowCount : void 0,
|
|
3388
|
+
className: require_toggle_row.cn(hasFixedLayout && "w-auto table-fixed", className),
|
|
3389
|
+
style: hasFixedLayout ? {
|
|
3390
|
+
minWidth: "100%",
|
|
3391
|
+
width: table.getTotalSize(),
|
|
3392
|
+
...style
|
|
3393
|
+
} : style,
|
|
3394
|
+
...props,
|
|
3395
|
+
viewportRef,
|
|
3396
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableHeader, { children: headerGroups.map((headerGroup, headerIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableRow, {
|
|
3397
|
+
"aria-rowindex": isVirtualized ? headerIndex + 1 : void 0,
|
|
3398
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataTableHeadCell, {
|
|
3399
|
+
header,
|
|
3400
|
+
hasFixedLayout
|
|
3401
|
+
}, header.id))
|
|
3402
|
+
}, headerGroup.id)) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TableBody, { children: renderBody() })]
|
|
3403
|
+
});
|
|
3404
|
+
};
|
|
3405
|
+
|
|
3406
|
+
//#endregion
|
|
3407
|
+
//#region src/components/ui/data-table/data-table-pagination.tsx
|
|
3408
|
+
/**
|
|
3409
|
+
* Previous and next buttons beside the visible row range, for client or server pagination. Renders nothing when pagination is off.
|
|
3410
|
+
*
|
|
3411
|
+
* @example
|
|
3412
|
+
* ```tsx
|
|
3413
|
+
* const dataTable = useDataTable({
|
|
3414
|
+
* columns,
|
|
3415
|
+
* data,
|
|
3416
|
+
* pagination: { mode: 'client', pageSize: 25 },
|
|
3417
|
+
* });
|
|
3418
|
+
*
|
|
3419
|
+
* <DataTable table={dataTable}>
|
|
3420
|
+
* <DataTableContent />
|
|
3421
|
+
* <DataTablePagination />
|
|
3422
|
+
* </DataTable>
|
|
3423
|
+
* ```
|
|
3424
|
+
* @returns The rendered pagination controls, or `null` when pagination is off.
|
|
3425
|
+
* @see useDataTable
|
|
3426
|
+
* @see DataTable
|
|
3427
|
+
*/
|
|
3428
|
+
const DataTablePagination = ({ className }) => {
|
|
3429
|
+
const { table } = useDataTableContext();
|
|
3430
|
+
if (!table.options.getPaginationRowModel && !table.options.manualPagination) return null;
|
|
3431
|
+
const { pageIndex, pageSize } = table.getState().pagination;
|
|
3432
|
+
const rowCount = table.getRowCount();
|
|
3433
|
+
const start = pageIndex * pageSize + 1;
|
|
3434
|
+
const end = Math.min((pageIndex + 1) * pageSize, rowCount);
|
|
3435
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CursorPagination, {
|
|
3436
|
+
className,
|
|
3437
|
+
hasNext: table.getCanNextPage(),
|
|
3438
|
+
hasPrevious: table.getCanPreviousPage(),
|
|
3439
|
+
label: rowCount > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
3440
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3441
|
+
className: "text-foreground",
|
|
3442
|
+
children: [
|
|
3443
|
+
start,
|
|
3444
|
+
"–",
|
|
3445
|
+
end
|
|
3446
|
+
]
|
|
3447
|
+
}),
|
|
3448
|
+
" ",
|
|
3449
|
+
"of ",
|
|
3450
|
+
rowCount
|
|
3451
|
+
] }) : void 0,
|
|
3452
|
+
onNext: () => table.nextPage(),
|
|
3453
|
+
onPrevious: () => table.previousPage()
|
|
3454
|
+
});
|
|
3455
|
+
};
|
|
3456
|
+
|
|
3457
|
+
//#endregion
|
|
3458
|
+
//#region src/components/ui/data-table/data-table-search.tsx
|
|
3459
|
+
/**
|
|
3460
|
+
* A search field that matches its text across the table's columns. Needs `filtering` in `useDataTable`, and renders nothing without it.
|
|
3461
|
+
* With manual filtering the app receives the text as `globalFilter` and filters the data itself.
|
|
3462
|
+
*
|
|
3463
|
+
* @example
|
|
3464
|
+
* ```tsx
|
|
3465
|
+
* const dataTable = useDataTable({ columns, data, filtering: { mode: 'client' } });
|
|
3466
|
+
*
|
|
3467
|
+
* <DataTable table={dataTable}>
|
|
3468
|
+
* <DataTableToolbar>
|
|
3469
|
+
* <DataTableSearch placeholder="Search users" />
|
|
3470
|
+
* </DataTableToolbar>
|
|
3471
|
+
* <DataTableContent />
|
|
3472
|
+
* </DataTable>
|
|
3473
|
+
* ```
|
|
3474
|
+
* @returns The rendered search field, or nothing when filtering is off.
|
|
3475
|
+
* @see DataTableToolbar
|
|
3476
|
+
* @see DataTableActiveFilters
|
|
3477
|
+
* @see useDataTable
|
|
3478
|
+
*/
|
|
3479
|
+
const DataTableSearch = ({ className, placeholder = "Search" }) => {
|
|
3480
|
+
const { table } = useDataTableContext();
|
|
3481
|
+
if (!table.options.enableGlobalFilter) return null;
|
|
3482
|
+
const { globalFilter } = table.getState();
|
|
3483
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3484
|
+
"data-slot": "data-table-search",
|
|
3485
|
+
className: require_toggle_row.cn("relative w-full max-w-64", className),
|
|
3486
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
3487
|
+
icon: _hugeicons_core_free_icons.Search01Icon,
|
|
3488
|
+
size: 16,
|
|
3489
|
+
"aria-hidden": "true",
|
|
3490
|
+
className: "pointer-events-none absolute start-2 top-1/2 -translate-y-1/2 text-muted-foreground/70"
|
|
3491
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_toggle_row.Input, {
|
|
3492
|
+
type: "search",
|
|
3493
|
+
"aria-label": placeholder,
|
|
3494
|
+
placeholder,
|
|
3495
|
+
value: typeof globalFilter === "string" ? globalFilter : "",
|
|
3496
|
+
onChange: (event) => table.setGlobalFilter(event.target.value),
|
|
3497
|
+
className: "ps-8"
|
|
3498
|
+
})]
|
|
3499
|
+
});
|
|
3500
|
+
};
|
|
3501
|
+
|
|
3502
|
+
//#endregion
|
|
3503
|
+
//#region src/components/ui/data-table/use-data-table.ts
|
|
3504
|
+
/** Keeps the pagination state complete when the app has not turned pagination on. */
|
|
3505
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
3506
|
+
/** Columns filter only when they opt in with `meta.filter` (see `withColumnFilters`). A module constant, so the table gets the same object each render. */
|
|
3507
|
+
const DEFAULT_COLUMN = { enableColumnFilter: false };
|
|
3508
|
+
const isControlled = (feature) => feature !== void 0 && "state" in feature;
|
|
3509
|
+
/**
|
|
3510
|
+
* A table pins to one edge only, so when a change leaves columns on both edges, keep the edge that just gained a column and unpin the other.
|
|
3511
|
+
* When it is not only the end edge that gained, the start edge wins.
|
|
3512
|
+
*/
|
|
3513
|
+
const toOneEdge = ({ next, previous }) => {
|
|
3514
|
+
const left = next.left ?? [];
|
|
3515
|
+
const right = next.right ?? [];
|
|
3516
|
+
if (left.length > 0 && right.length > 0) {
|
|
3517
|
+
const previousLeft = previous.left ?? [];
|
|
3518
|
+
const previousRight = previous.right ?? [];
|
|
3519
|
+
return right.some((id) => !previousRight.includes(id)) && left.every((id) => previousLeft.includes(id)) ? { right } : { left };
|
|
3520
|
+
}
|
|
3521
|
+
return right.length > 0 ? { right } : { left };
|
|
3522
|
+
};
|
|
3523
|
+
const getInitialState = ({ fallback, feature }) => feature && !isControlled(feature) ? feature.initial ?? fallback : fallback;
|
|
3524
|
+
/** The table hands over updaters; the app expects the next value, resolved against its current state. */
|
|
3525
|
+
const toTableFeatureState = (feature) => ({
|
|
3526
|
+
onChange: (updater) => feature.onChange((0, _tanstack_react_table.functionalUpdate)(updater, feature.state)),
|
|
3527
|
+
state: feature.state
|
|
3528
|
+
});
|
|
3529
|
+
/** Use the app's state when it owns the feature, otherwise the table's own. */
|
|
3530
|
+
const resolveFeatureState = ({ feature, internal, setInternal }) => isControlled(feature) ? toTableFeatureState(feature) : {
|
|
3531
|
+
onChange: setInternal,
|
|
3532
|
+
state: internal
|
|
3533
|
+
};
|
|
3534
|
+
/**
|
|
3535
|
+
* Matches a row when its value is one of the checked values, or, for a list value, when any item is.
|
|
3536
|
+
* TanStack's `arrIncludesSome` calls `includes` on the row value, which matches substrings of strings and throws on numbers.
|
|
3537
|
+
* Clearing every value removes the filter.
|
|
3538
|
+
*/
|
|
3539
|
+
const includesSomeValue = Object.assign((row, columnId, filterValue) => {
|
|
3540
|
+
const value = row.getValue(columnId);
|
|
3541
|
+
return Array.isArray(value) ? value.some((item) => filterValue.includes(String(item))) : filterValue.includes(String(value));
|
|
3542
|
+
}, { autoRemove: (value) => !Array.isArray(value) || value.length === 0 });
|
|
3543
|
+
/**
|
|
3544
|
+
* Give each column with `meta.filter` a matching filter function and let it filter, recursing into column groups.
|
|
3545
|
+
* TanStack's `auto` filter guesses from the first row's value, so a checklist of values over string cells would get a string filter.
|
|
3546
|
+
*/
|
|
3547
|
+
const withColumnFilters = (columns) => columns.map((column) => {
|
|
3548
|
+
const withGroups = "columns" in column && column.columns ? {
|
|
3549
|
+
...column,
|
|
3550
|
+
columns: withColumnFilters(column.columns)
|
|
3551
|
+
} : column;
|
|
3552
|
+
const filter = column.meta?.filter;
|
|
3553
|
+
if (!filter) return withGroups;
|
|
3554
|
+
return {
|
|
3555
|
+
...withGroups,
|
|
3556
|
+
enableColumnFilter: column.enableColumnFilter ?? true,
|
|
3557
|
+
filterFn: column.filterFn ?? (filter === "values" ? includesSomeValue : "includesString")
|
|
3558
|
+
};
|
|
3559
|
+
});
|
|
3560
|
+
/** The filters a table starts with: the app's seed for client filtering, nothing otherwise. */
|
|
3561
|
+
const getInitialFilters = ({ filtering }) => {
|
|
3562
|
+
const initial = filtering?.mode === "client" ? filtering.initial : void 0;
|
|
3563
|
+
return {
|
|
3564
|
+
columnFilters: initial?.columnFilters ?? [],
|
|
3565
|
+
globalFilter: initial?.globalFilter ?? ""
|
|
3566
|
+
};
|
|
3567
|
+
};
|
|
3568
|
+
/**
|
|
3569
|
+
* Filter state and change handlers for search and column filters, which share one state.
|
|
3570
|
+
* `onFiltersChange` runs after every change, so the caller can react to it (pagination returns to the first page).
|
|
3571
|
+
*/
|
|
3572
|
+
const useFilterState = ({ filtering, onFiltersChange }) => {
|
|
3573
|
+
const [internalFilters, setInternalFilters] = (0, react.useState)(() => getInitialFilters({ filtering }));
|
|
3574
|
+
const manual = filtering?.mode === "manual" ? filtering : void 0;
|
|
3575
|
+
const latestManualFilters = (0, react.useRef)(void 0);
|
|
3576
|
+
latestManualFilters.current = manual?.state;
|
|
3577
|
+
const updateFilters = (updater) => {
|
|
3578
|
+
if (manual) {
|
|
3579
|
+
const next = (0, _tanstack_react_table.functionalUpdate)(updater, latestManualFilters.current ?? manual.state);
|
|
3580
|
+
latestManualFilters.current = next;
|
|
3581
|
+
manual.onChange(next);
|
|
3582
|
+
} else setInternalFilters(updater);
|
|
3583
|
+
onFiltersChange();
|
|
3584
|
+
};
|
|
3585
|
+
return {
|
|
3586
|
+
filterState: manual ? manual.state : internalFilters,
|
|
3587
|
+
handleColumnFiltersChange: (updater) => updateFilters((old) => ({
|
|
3588
|
+
...old,
|
|
3589
|
+
columnFilters: (0, _tanstack_react_table.functionalUpdate)(updater, old.columnFilters)
|
|
3590
|
+
})),
|
|
3591
|
+
handleGlobalFilterChange: (updater) => updateFilters((old) => ({
|
|
3592
|
+
...old,
|
|
3593
|
+
globalFilter: (0, _tanstack_react_table.functionalUpdate)(updater, old.globalFilter) ?? ""
|
|
3594
|
+
}))
|
|
3595
|
+
};
|
|
3596
|
+
};
|
|
3597
|
+
/** Pinning state where every change goes through toOneEdge, so the table and a controlled onChange only ever see one pinned edge. */
|
|
3598
|
+
const resolvePinningState = ({ columnPinning, internal, setInternal }) => {
|
|
3599
|
+
if (isControlled(columnPinning)) return {
|
|
3600
|
+
onChange: (updater) => columnPinning.onChange(toOneEdge({
|
|
3601
|
+
next: (0, _tanstack_react_table.functionalUpdate)(updater, columnPinning.state),
|
|
3602
|
+
previous: columnPinning.state
|
|
3603
|
+
})),
|
|
3604
|
+
state: columnPinning.state
|
|
3605
|
+
};
|
|
3606
|
+
return {
|
|
3607
|
+
onChange: (updater) => setInternal((old) => toOneEdge({
|
|
3608
|
+
next: (0, _tanstack_react_table.functionalUpdate)(updater, old),
|
|
3609
|
+
previous: old
|
|
3610
|
+
})),
|
|
3611
|
+
state: internal
|
|
3612
|
+
};
|
|
3613
|
+
};
|
|
3614
|
+
/** Row models for the features the table runs in memory; manual features leave their step to the app. */
|
|
3615
|
+
const getRowModels = ({ filtering, grouping, pagination, sorting }) => {
|
|
3616
|
+
const clientFiltering = filtering?.mode === "client";
|
|
3617
|
+
return {
|
|
3618
|
+
getExpandedRowModel: grouping ? (0, _tanstack_react_table.getExpandedRowModel)() : void 0,
|
|
3619
|
+
getFacetedRowModel: clientFiltering ? (0, _tanstack_react_table.getFacetedRowModel)() : void 0,
|
|
3620
|
+
getFacetedUniqueValues: clientFiltering ? (0, _tanstack_react_table.getFacetedUniqueValues)() : void 0,
|
|
3621
|
+
getFilteredRowModel: clientFiltering ? (0, _tanstack_react_table.getFilteredRowModel)() : void 0,
|
|
3622
|
+
getGroupedRowModel: grouping ? (0, _tanstack_react_table.getGroupedRowModel)() : void 0,
|
|
3623
|
+
getPaginationRowModel: pagination?.mode === "client" ? (0, _tanstack_react_table.getPaginationRowModel)() : void 0,
|
|
3624
|
+
getSortedRowModel: sorting?.mode === "client" ? (0, _tanstack_react_table.getSortedRowModel)() : void 0
|
|
3625
|
+
};
|
|
3626
|
+
};
|
|
3627
|
+
/**
|
|
3628
|
+
* Page resets are off (see autoResetPageIndex), so when the data shrinks the page can run past the end.
|
|
3629
|
+
* Clamping only when out of range keeps a fresh data array each render from looping.
|
|
3630
|
+
*/
|
|
3631
|
+
const useClampedPageIndex = ({ isClientPagination, pageIndex, table }) => {
|
|
3632
|
+
const lastPageIndex = Math.max(0, table.getPageCount() - 1);
|
|
3633
|
+
(0, react.useEffect)(() => {
|
|
3634
|
+
if (isClientPagination && pageIndex > lastPageIndex) table.setPageIndex(lastPageIndex);
|
|
3635
|
+
}, [
|
|
3636
|
+
isClientPagination,
|
|
3637
|
+
lastPageIndex,
|
|
3638
|
+
pageIndex,
|
|
3639
|
+
table
|
|
3640
|
+
]);
|
|
3641
|
+
};
|
|
3642
|
+
/**
|
|
3643
|
+
* Create the state for a `DataTable`. Each feature stays off until its option is passed.
|
|
3644
|
+
* Pass `{ state, onChange }` to own a feature's state, or `mode: 'manual'` for server-driven sorting and pagination.
|
|
3645
|
+
* `onChange` receives the next state, ready to store.
|
|
3646
|
+
*
|
|
3647
|
+
* @example
|
|
3648
|
+
* const dataTable = useDataTable({
|
|
3649
|
+
* columns,
|
|
3650
|
+
* data,
|
|
3651
|
+
* pagination: { mode: 'client', pageSize: 25 },
|
|
3652
|
+
* sorting: { mode: 'client' },
|
|
3653
|
+
* });
|
|
3654
|
+
*
|
|
3655
|
+
* <DataTable table={dataTable}>
|
|
3656
|
+
* <DataTableContent />
|
|
3657
|
+
* <DataTablePagination />
|
|
3658
|
+
* </DataTable>
|
|
3659
|
+
* @returns A table instance to pass to `DataTable` as `table`.
|
|
3660
|
+
* @see UseDataTableOptions
|
|
3661
|
+
* @see DataTable
|
|
3662
|
+
* @see DataTableContent
|
|
3663
|
+
*/
|
|
3664
|
+
const useDataTable = ({ columnPinning, columnSizing, columnVisibility, columns, data, filtering, getRowId, grouping, loading = false, pagination, selection, sorting, virtualization }) => {
|
|
3665
|
+
const [internalSorting, setInternalSorting] = (0, react.useState)(sorting?.mode === "client" ? sorting.initial ?? [] : []);
|
|
3666
|
+
const [internalPagination, setInternalPagination] = (0, react.useState)({
|
|
3667
|
+
pageIndex: 0,
|
|
3668
|
+
pageSize: pagination?.mode === "client" ? pagination.pageSize : DEFAULT_PAGE_SIZE
|
|
3669
|
+
});
|
|
3670
|
+
const [internalSelection, setInternalSelection] = (0, react.useState)(getInitialState({
|
|
3671
|
+
fallback: {},
|
|
3672
|
+
feature: selection
|
|
3673
|
+
}));
|
|
3674
|
+
const [internalVisibility, setInternalVisibility] = (0, react.useState)(getInitialState({
|
|
3675
|
+
fallback: {},
|
|
3676
|
+
feature: columnVisibility
|
|
3677
|
+
}));
|
|
3678
|
+
const [internalPinning, setInternalPinning] = (0, react.useState)(getInitialState({
|
|
3679
|
+
fallback: { left: [] },
|
|
3680
|
+
feature: columnPinning
|
|
3681
|
+
}));
|
|
3682
|
+
const [internalSizing, setInternalSizing] = (0, react.useState)(getInitialState({
|
|
3683
|
+
fallback: {},
|
|
3684
|
+
feature: columnSizing
|
|
3685
|
+
}));
|
|
3686
|
+
const [expandedGroups, setExpandedGroups] = (0, react.useState)(true);
|
|
3687
|
+
const [internalGrouping, setInternalGrouping] = (0, react.useState)(getInitialState({
|
|
3688
|
+
fallback: [],
|
|
3689
|
+
feature: grouping
|
|
3690
|
+
}));
|
|
3691
|
+
const tableColumns = (0, react.useMemo)(() => withColumnFilters(columns), [columns]);
|
|
3692
|
+
const isClientPagination = pagination?.mode === "client";
|
|
3693
|
+
const handleClientSortingChange = (updater) => {
|
|
3694
|
+
setInternalSorting(updater);
|
|
3695
|
+
if (isClientPagination) setInternalPagination((old) => ({
|
|
3696
|
+
...old,
|
|
3697
|
+
pageIndex: 0
|
|
3698
|
+
}));
|
|
3699
|
+
};
|
|
3700
|
+
const { filterState, handleColumnFiltersChange, handleGlobalFilterChange } = useFilterState({
|
|
3701
|
+
filtering,
|
|
3702
|
+
onFiltersChange: () => {
|
|
3703
|
+
if (isClientPagination) setInternalPagination((old) => ({
|
|
3704
|
+
...old,
|
|
3705
|
+
pageIndex: 0
|
|
3706
|
+
}));
|
|
3707
|
+
}
|
|
3708
|
+
});
|
|
3709
|
+
const sortingState = sorting?.mode === "manual" ? toTableFeatureState(sorting) : {
|
|
3710
|
+
onChange: handleClientSortingChange,
|
|
3711
|
+
state: internalSorting
|
|
3712
|
+
};
|
|
3713
|
+
const paginationState = pagination?.mode === "manual" ? toTableFeatureState(pagination) : {
|
|
3714
|
+
onChange: setInternalPagination,
|
|
3715
|
+
state: internalPagination
|
|
3716
|
+
};
|
|
3717
|
+
const selectionState = resolveFeatureState({
|
|
3718
|
+
feature: selection,
|
|
3719
|
+
internal: internalSelection,
|
|
3720
|
+
setInternal: setInternalSelection
|
|
3721
|
+
});
|
|
3722
|
+
const visibilityState = resolveFeatureState({
|
|
3723
|
+
feature: columnVisibility,
|
|
3724
|
+
internal: internalVisibility,
|
|
3725
|
+
setInternal: setInternalVisibility
|
|
3726
|
+
});
|
|
3727
|
+
const pinningState = resolvePinningState({
|
|
3728
|
+
columnPinning,
|
|
3729
|
+
internal: internalPinning,
|
|
3730
|
+
setInternal: setInternalPinning
|
|
3731
|
+
});
|
|
3732
|
+
const sizingState = resolveFeatureState({
|
|
3733
|
+
feature: columnSizing,
|
|
3734
|
+
internal: internalSizing,
|
|
3735
|
+
setInternal: setInternalSizing
|
|
3736
|
+
});
|
|
3737
|
+
const groupingState = resolveFeatureState({
|
|
3738
|
+
feature: grouping,
|
|
3739
|
+
internal: internalGrouping,
|
|
3740
|
+
setInternal: setInternalGrouping
|
|
3741
|
+
});
|
|
3742
|
+
const table = (0, _tanstack_react_table.useReactTable)({
|
|
3743
|
+
autoResetExpanded: false,
|
|
3744
|
+
autoResetPageIndex: false,
|
|
3745
|
+
columnResizeMode: "onChange",
|
|
3746
|
+
columns: tableColumns,
|
|
3747
|
+
data,
|
|
3748
|
+
defaultColumn: DEFAULT_COLUMN,
|
|
3749
|
+
enableColumnFilters: filtering !== void 0,
|
|
3750
|
+
enableColumnPinning: columnPinning !== void 0,
|
|
3751
|
+
enableColumnResizing: columnSizing !== void 0,
|
|
3752
|
+
enableExpanding: grouping !== void 0,
|
|
3753
|
+
enableGlobalFilter: filtering !== void 0,
|
|
3754
|
+
enableGrouping: grouping !== void 0,
|
|
3755
|
+
enableRowSelection: selection === void 0 ? false : (row) => !row.getIsGrouped(),
|
|
3756
|
+
enableSorting: sorting !== void 0,
|
|
3757
|
+
getCoreRowModel: (0, _tanstack_react_table.getCoreRowModel)(),
|
|
3758
|
+
...getRowModels({
|
|
3759
|
+
filtering,
|
|
3760
|
+
grouping,
|
|
3761
|
+
pagination,
|
|
3762
|
+
sorting
|
|
3763
|
+
}),
|
|
3764
|
+
getRowId,
|
|
3765
|
+
groupedColumnMode: false,
|
|
3766
|
+
manualFiltering: filtering?.mode === "manual",
|
|
3767
|
+
manualPagination: pagination?.mode === "manual",
|
|
3768
|
+
manualSorting: sorting?.mode === "manual",
|
|
3769
|
+
onColumnFiltersChange: handleColumnFiltersChange,
|
|
3770
|
+
onColumnPinningChange: pinningState.onChange,
|
|
3771
|
+
onColumnSizingChange: sizingState.onChange,
|
|
3772
|
+
onColumnVisibilityChange: visibilityState.onChange,
|
|
3773
|
+
onExpandedChange: setExpandedGroups,
|
|
3774
|
+
onGlobalFilterChange: handleGlobalFilterChange,
|
|
3775
|
+
onGroupingChange: groupingState.onChange,
|
|
3776
|
+
onPaginationChange: paginationState.onChange,
|
|
3777
|
+
onRowSelectionChange: selectionState.onChange,
|
|
3778
|
+
onSortingChange: sortingState.onChange,
|
|
3779
|
+
rowCount: pagination?.mode === "manual" ? pagination.rowCount : void 0,
|
|
3780
|
+
state: {
|
|
3781
|
+
columnFilters: filterState.columnFilters,
|
|
3782
|
+
columnPinning: pinningState.state,
|
|
3783
|
+
columnSizing: sizingState.state,
|
|
3784
|
+
columnVisibility: visibilityState.state,
|
|
3785
|
+
expanded: expandedGroups,
|
|
3786
|
+
globalFilter: filterState.globalFilter,
|
|
3787
|
+
grouping: groupingState.state,
|
|
3788
|
+
pagination: paginationState.state,
|
|
3789
|
+
rowSelection: selectionState.state,
|
|
3790
|
+
sorting: sortingState.state
|
|
3791
|
+
}
|
|
3792
|
+
});
|
|
3793
|
+
useClampedPageIndex({
|
|
3794
|
+
isClientPagination,
|
|
3795
|
+
pageIndex: paginationState.state.pageIndex,
|
|
3796
|
+
table
|
|
3797
|
+
});
|
|
3798
|
+
return {
|
|
3799
|
+
loading,
|
|
3800
|
+
table,
|
|
3801
|
+
virtualization
|
|
3802
|
+
};
|
|
3803
|
+
};
|
|
3804
|
+
|
|
2483
3805
|
//#endregion
|
|
2484
3806
|
//#region src/components/ui/tabs/tabs.tsx
|
|
2485
3807
|
const Tabs = ({ className, orientation = "horizontal", ...props }) => {
|
|
@@ -2499,14 +3821,14 @@ const tabsListVariants = (0, class_variance_authority.cva)("rounded-lg p-[3px] g
|
|
|
2499
3821
|
navigation: "group-data-[orientation=horizontal]/tabs:h-auto w-full justify-start gap-5 rounded-none border-b border-border-divider bg-transparent p-0"
|
|
2500
3822
|
} }
|
|
2501
3823
|
});
|
|
2502
|
-
const TabsList = ({ className, variant = "default", ...props }) => {
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
3824
|
+
const TabsList = (0, react.forwardRef)(({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tabs.List, {
|
|
3825
|
+
ref,
|
|
3826
|
+
"data-slot": "tabs-list",
|
|
3827
|
+
"data-variant": variant,
|
|
3828
|
+
className: require_toggle_row.cn(tabsListVariants({ variant }), className),
|
|
3829
|
+
...props
|
|
3830
|
+
}));
|
|
3831
|
+
TabsList.displayName = _radix_ui_react_tabs.List.displayName;
|
|
2510
3832
|
const TabsTrigger = ({ className, ...props }) => {
|
|
2511
3833
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tabs.Trigger, {
|
|
2512
3834
|
"data-slot": "tabs-trigger",
|
|
@@ -2668,11 +3990,23 @@ const Textarea = ({ className, ...props }) => {
|
|
|
2668
3990
|
const TooltipProvider = _radix_ui_react_tooltip.Provider;
|
|
2669
3991
|
const Tooltip = _radix_ui_react_tooltip.Root;
|
|
2670
3992
|
const TooltipTrigger = _radix_ui_react_tooltip.Trigger;
|
|
2671
|
-
const TooltipContent = (0, react.forwardRef)(({ className, sideOffset =
|
|
3993
|
+
const TooltipContent = (0, react.forwardRef)(({ children, className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_tooltip.Content, {
|
|
2672
3994
|
ref,
|
|
3995
|
+
"data-slot": "tooltip-content",
|
|
2673
3996
|
sideOffset,
|
|
2674
|
-
className: require_toggle_row.cn("z-50 max-w-xs
|
|
2675
|
-
...props
|
|
3997
|
+
className: require_toggle_row.cn("z-50 max-w-xs rounded-[6px] bg-[var(--tooltip-bg)] px-2 py-1 text-xs leading-4 font-medium text-balance text-[var(--tooltip-fg)] shadow-[inset_0_1px_0_0_oklch(1_0_0/0.08)] [filter:var(--tooltip-drop)]", className),
|
|
3998
|
+
...props,
|
|
3999
|
+
children: [children, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Arrow, {
|
|
4000
|
+
asChild: true,
|
|
4001
|
+
height: 5,
|
|
4002
|
+
width: 10,
|
|
4003
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
4004
|
+
"aria-hidden": "true",
|
|
4005
|
+
className: "-translate-y-px fill-[var(--tooltip-bg)]",
|
|
4006
|
+
viewBox: "0 0 10 5",
|
|
4007
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M0 0H10L5.88 4.12a1.25 1.25 0 0 1-1.76 0Z" })
|
|
4008
|
+
})
|
|
4009
|
+
})]
|
|
2676
4010
|
}) }));
|
|
2677
4011
|
TooltipContent.displayName = _radix_ui_react_tooltip.Content.displayName;
|
|
2678
4012
|
|
|
@@ -3111,32 +4445,6 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
|
|
|
3111
4445
|
});
|
|
3112
4446
|
};
|
|
3113
4447
|
|
|
3114
|
-
//#endregion
|
|
3115
|
-
//#region src/components/empty-state/empty-state.tsx
|
|
3116
|
-
const EmptyState = ({ icon: Icon$2, title, description, action, className }) => {
|
|
3117
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3118
|
-
className: require_toggle_row.cn("flex flex-col items-center justify-center py-16 px-8 text-center", className),
|
|
3119
|
-
children: [
|
|
3120
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3121
|
-
className: "flex size-12 items-center justify-center rounded-xl bg-muted mb-4",
|
|
3122
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon$2, { className: "size-6 text-muted-foreground" })
|
|
3123
|
-
}),
|
|
3124
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
3125
|
-
className: "text-sm font-semibold",
|
|
3126
|
-
children: title
|
|
3127
|
-
}),
|
|
3128
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
3129
|
-
className: "text-sm text-muted-foreground mt-1 max-w-sm",
|
|
3130
|
-
children: description
|
|
3131
|
-
}),
|
|
3132
|
-
action && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
3133
|
-
className: "mt-4",
|
|
3134
|
-
children: action
|
|
3135
|
-
})
|
|
3136
|
-
]
|
|
3137
|
-
});
|
|
3138
|
-
};
|
|
3139
|
-
|
|
3140
4448
|
//#endregion
|
|
3141
4449
|
//#region src/components/info-banner/info-banner.tsx
|
|
3142
4450
|
const spring$1 = {
|
|
@@ -3428,47 +4736,40 @@ const SettingsSection = ({ title, description, children, variant = "default", cl
|
|
|
3428
4736
|
//#region src/components/status-badge/status-badge.tsx
|
|
3429
4737
|
const statusConfig = {
|
|
3430
4738
|
active: {
|
|
3431
|
-
dot: true,
|
|
3432
4739
|
label: "Active",
|
|
3433
4740
|
variant: "success"
|
|
3434
4741
|
},
|
|
3435
4742
|
blocked: {
|
|
3436
|
-
dot: true,
|
|
3437
4743
|
label: "Blocked",
|
|
3438
4744
|
variant: "danger"
|
|
3439
4745
|
},
|
|
3440
4746
|
inactive: {
|
|
3441
|
-
dot: true,
|
|
3442
4747
|
label: "Inactive",
|
|
3443
4748
|
variant: "inactive"
|
|
3444
4749
|
},
|
|
3445
4750
|
live: {
|
|
3446
|
-
dot: true,
|
|
3447
4751
|
label: "Live",
|
|
3448
4752
|
variant: "success"
|
|
3449
4753
|
},
|
|
3450
4754
|
pending: {
|
|
3451
|
-
dot: true,
|
|
3452
4755
|
label: "Pending",
|
|
3453
4756
|
variant: "warning"
|
|
3454
4757
|
},
|
|
3455
4758
|
processing: {
|
|
3456
|
-
dot: true,
|
|
3457
4759
|
label: "Processing",
|
|
3458
4760
|
variant: "process"
|
|
3459
4761
|
},
|
|
3460
4762
|
sandbox: {
|
|
3461
|
-
dot: true,
|
|
3462
4763
|
label: "Sandbox",
|
|
3463
4764
|
variant: "warning"
|
|
3464
4765
|
}
|
|
3465
4766
|
};
|
|
3466
4767
|
const StatusBadge = ({ status, label, className }) => {
|
|
3467
4768
|
const config = statusConfig[status];
|
|
3468
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
4769
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Badge, {
|
|
3469
4770
|
variant: config.variant,
|
|
3470
|
-
className
|
|
3471
|
-
children:
|
|
4771
|
+
className,
|
|
4772
|
+
children: label || config.label
|
|
3472
4773
|
});
|
|
3473
4774
|
};
|
|
3474
4775
|
|
|
@@ -3502,8 +4803,24 @@ const StatusBadge = ({ status, label, className }) => {
|
|
|
3502
4803
|
const TabNavigation = ({ children, defaultValue, items, listLabel, onValueChange, value, ...props }) => {
|
|
3503
4804
|
const [internalValue, setInternalValue] = (0, react.useState)(defaultValue ?? items.find((item) => !item.disabled)?.value);
|
|
3504
4805
|
const selectedValue = value ?? internalValue;
|
|
3505
|
-
const indicatorId = (0, react.useId)();
|
|
3506
4806
|
const shouldReduceMotion = (0, motion_react.useReducedMotion)();
|
|
4807
|
+
const listRef = (0, react.useRef)(null);
|
|
4808
|
+
const [indicator, setIndicator] = (0, react.useState)();
|
|
4809
|
+
(0, react.useLayoutEffect)(() => {
|
|
4810
|
+
const list = listRef.current;
|
|
4811
|
+
if (!list) return;
|
|
4812
|
+
const measure = () => {
|
|
4813
|
+
const active = list.querySelector("[data-slot=\"tabs-trigger\"][data-state=\"active\"]");
|
|
4814
|
+
setIndicator(active ? {
|
|
4815
|
+
left: active.offsetLeft,
|
|
4816
|
+
width: active.offsetWidth
|
|
4817
|
+
} : void 0);
|
|
4818
|
+
};
|
|
4819
|
+
measure();
|
|
4820
|
+
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(measure);
|
|
4821
|
+
list.querySelectorAll("[data-slot=\"tabs-trigger\"]").forEach((trigger) => observer?.observe(trigger));
|
|
4822
|
+
return () => observer?.disconnect();
|
|
4823
|
+
}, [selectedValue, items]);
|
|
3507
4824
|
const [prevItems, setPrevItems] = (0, react.useState)(items);
|
|
3508
4825
|
if (prevItems !== items) {
|
|
3509
4826
|
setPrevItems(items);
|
|
@@ -3516,27 +4833,33 @@ const TabNavigation = ({ children, defaultValue, items, listLabel, onValueChange
|
|
|
3516
4833
|
setInternalValue(nextValue);
|
|
3517
4834
|
onValueChange?.(nextValue);
|
|
3518
4835
|
},
|
|
3519
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
4836
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(TabsList, {
|
|
3520
4837
|
variant: "navigation",
|
|
3521
4838
|
"aria-label": listLabel,
|
|
3522
|
-
|
|
4839
|
+
ref: listRef,
|
|
4840
|
+
className: "relative",
|
|
4841
|
+
children: [items.map(({ disabled, label, value: value$1 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabsTrigger, {
|
|
3523
4842
|
value: value$1,
|
|
3524
4843
|
disabled,
|
|
3525
|
-
children:
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
4844
|
+
children: label
|
|
4845
|
+
}, value$1)), indicator && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(motion_react.motion.span, {
|
|
4846
|
+
"aria-hidden": "true",
|
|
4847
|
+
className: "pointer-events-none absolute left-0 -bottom-px h-px bg-(--action)",
|
|
4848
|
+
initial: false,
|
|
4849
|
+
animate: {
|
|
4850
|
+
width: indicator.width,
|
|
4851
|
+
x: indicator.left
|
|
4852
|
+
},
|
|
4853
|
+
transition: shouldReduceMotion ? { duration: 0 } : {
|
|
4854
|
+
duration: .2,
|
|
4855
|
+
ease: [
|
|
4856
|
+
.645,
|
|
4857
|
+
.045,
|
|
4858
|
+
.355,
|
|
4859
|
+
1
|
|
4860
|
+
]
|
|
4861
|
+
}
|
|
4862
|
+
})]
|
|
3540
4863
|
}), children]
|
|
3541
4864
|
});
|
|
3542
4865
|
};
|
|
@@ -5378,6 +6701,14 @@ exports.CopyIcon = CopyIcon;
|
|
|
5378
6701
|
exports.CursorLogo = CursorLogo;
|
|
5379
6702
|
exports.CursorPagination = CursorPagination;
|
|
5380
6703
|
exports.DangerZone = DangerZone;
|
|
6704
|
+
exports.DataTable = DataTable;
|
|
6705
|
+
exports.DataTableActiveFilters = DataTableActiveFilters;
|
|
6706
|
+
exports.DataTableColumnFilter = DataTableColumnFilter;
|
|
6707
|
+
exports.DataTableColumnVisibility = DataTableColumnVisibility;
|
|
6708
|
+
exports.DataTableContent = DataTableContent;
|
|
6709
|
+
exports.DataTablePagination = DataTablePagination;
|
|
6710
|
+
exports.DataTableSearch = DataTableSearch;
|
|
6711
|
+
exports.DataTableToolbar = DataTableToolbar;
|
|
5381
6712
|
exports.Dialog = Dialog;
|
|
5382
6713
|
exports.DialogBody = DialogBody;
|
|
5383
6714
|
exports.DialogClose = DialogClose;
|
|
@@ -5446,6 +6777,7 @@ exports.RadioField = RadioField;
|
|
|
5446
6777
|
exports.RadioGroup = RadioGroup;
|
|
5447
6778
|
exports.RadioGroupItem = RadioGroupItem;
|
|
5448
6779
|
exports.RefreshCWIcon = RefreshCWIcon;
|
|
6780
|
+
exports.SELECTION_COLUMN_ID = SELECTION_COLUMN_ID;
|
|
5449
6781
|
exports.ScrollArea = ScrollArea;
|
|
5450
6782
|
exports.ScrollBar = ScrollBar;
|
|
5451
6783
|
exports.SearchIcon = SearchIcon;
|
|
@@ -5517,12 +6849,15 @@ exports.__toESM = __toESM;
|
|
|
5517
6849
|
exports.badgeVariants = badgeVariants;
|
|
5518
6850
|
exports.buttonVariants = require_toggle_row.buttonVariants;
|
|
5519
6851
|
exports.cn = require_toggle_row.cn;
|
|
6852
|
+
exports.createColumnHelper = createColumnHelper;
|
|
6853
|
+
exports.selectionColumn = selectionColumn;
|
|
5520
6854
|
Object.defineProperty(exports, 'toast', {
|
|
5521
6855
|
enumerable: true,
|
|
5522
6856
|
get: function () {
|
|
5523
6857
|
return sonner.toast;
|
|
5524
6858
|
}
|
|
5525
6859
|
});
|
|
6860
|
+
exports.useDataTable = useDataTable;
|
|
5526
6861
|
exports.useIconConfig = useIconConfig;
|
|
5527
6862
|
exports.useUnsavedChanges = useUnsavedChanges;
|
|
5528
6863
|
exports.wellVariants = wellVariants;
|