@dynamic-labs-sdk/droplet 1.49.1 → 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.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as Button, c as cn, i as Input, n as Switch, o as buttonVariants, r as Label, s as Spinner, t as ToggleRow } from "./toggle-row-PqelNVXI.esm.js";
|
|
2
|
-
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { AnimatePresence, motion, useAnimation, useReducedMotion } from "motion/react";
|
|
4
4
|
import { HugeiconsIcon } from "@hugeicons/react";
|
|
5
|
-
import { Add01Icon, Alert01Icon, AlertCircleIcon, ArrowDown01Icon, ArrowLeft01Icon, ArrowRight01Icon, ArrowUp01Icon, Cancel01Icon, CheckmarkCircle02Icon, Copy01Icon, InformationCircleIcon, MoreHorizontalIcon, Search01Icon, Tick01Icon, WebhookIcon } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { Add01Icon, Alert01Icon, AlertCircleIcon, ArrowDown01Icon, ArrowLeft01Icon, ArrowRight01Icon, ArrowUp01Icon, Cancel01Icon, CheckmarkCircle02Icon, Copy01Icon, FilterIcon, InformationCircleIcon, LayoutThreeColumnIcon, MoreHorizontalIcon, Search01Icon, Table01Icon, Tick01Icon, WebhookIcon } from "@hugeicons/core-free-icons";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
7
|
import { Slot } from "@radix-ui/react-slot";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -24,8 +24,10 @@ import { Content as Content$4, Group as Group$1, Icon as Icon$1, Item as Item$2,
|
|
|
24
24
|
import { Root as Root$5 } from "@radix-ui/react-separator";
|
|
25
25
|
import { useTheme } from "next-themes";
|
|
26
26
|
import { Toaster as Toaster$1, toast } from "sonner";
|
|
27
|
+
import { createColumnHelper as createColumnHelper$1, flexRender, functionalUpdate, getCoreRowModel, getExpandedRowModel, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
28
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
27
29
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
28
|
-
import { Content as Content$5, Portal as Portal$4, Provider, Root as Root$6, Trigger as Trigger$5 } from "@radix-ui/react-tooltip";
|
|
30
|
+
import { Arrow, Content as Content$5, Portal as Portal$4, Provider, Root as Root$6, Trigger as Trigger$5 } from "@radix-ui/react-tooltip";
|
|
29
31
|
import Link from "next/link";
|
|
30
32
|
|
|
31
33
|
//#region src/components/unsaved-changes-bar/unsaved-changes-bar.tsx
|
|
@@ -1686,7 +1688,7 @@ const PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs("sp
|
|
|
1686
1688
|
/**
|
|
1687
1689
|
* Pre-assembled cursor-based pagination bar.
|
|
1688
1690
|
*
|
|
1689
|
-
* Renders
|
|
1691
|
+
* Renders an optional label, such as a record range, followed by previous and next arrow buttons, aligned to the end.
|
|
1690
1692
|
* Each button is disabled automatically when there is no page in that direction.
|
|
1691
1693
|
* Designed for dashboard tables and lists that use cursor/keyset pagination rather
|
|
1692
1694
|
* than numbered pages — which is the dominant pattern in the Redcoast design system.
|
|
@@ -1702,39 +1704,41 @@ const PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs("sp
|
|
|
1702
1704
|
* />
|
|
1703
1705
|
* ```
|
|
1704
1706
|
*/
|
|
1705
|
-
const CursorPagination = ({ hasPrevious, hasNext, onPrevious, onNext, label, className }) => /* @__PURE__ */ jsxs("
|
|
1707
|
+
const CursorPagination = ({ hasPrevious, hasNext, onPrevious, onNext, label, className }) => /* @__PURE__ */ jsxs("nav", {
|
|
1708
|
+
"aria-label": "Pagination",
|
|
1706
1709
|
"data-slot": "cursor-pagination",
|
|
1707
|
-
className: cn("flex items-center justify-
|
|
1708
|
-
children: [
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1710
|
+
className: cn("flex items-center justify-end gap-3", className),
|
|
1711
|
+
children: [label !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
1712
|
+
className: "text-[13px] text-muted-foreground tabular-nums",
|
|
1713
|
+
children: label
|
|
1714
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1715
|
+
className: "flex items-center gap-2",
|
|
1716
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1717
|
+
variant: "outline",
|
|
1718
|
+
size: "icon-sm",
|
|
1719
|
+
className: "size-8 before:-inset-1",
|
|
1712
1720
|
disabled: !hasPrevious,
|
|
1713
1721
|
onClick: onPrevious,
|
|
1714
1722
|
"aria-label": "Go to previous page",
|
|
1715
|
-
children:
|
|
1723
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1716
1724
|
icon: ArrowLeft01Icon,
|
|
1717
|
-
size:
|
|
1725
|
+
size: 16,
|
|
1718
1726
|
"aria-hidden": "true"
|
|
1719
|
-
})
|
|
1720
|
-
}),
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}),
|
|
1725
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
1726
|
-
variant: "ghost",
|
|
1727
|
-
size: "sm",
|
|
1727
|
+
})
|
|
1728
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1729
|
+
variant: "outline",
|
|
1730
|
+
size: "icon-sm",
|
|
1731
|
+
className: "size-8 before:-inset-1",
|
|
1728
1732
|
disabled: !hasNext,
|
|
1729
1733
|
onClick: onNext,
|
|
1730
1734
|
"aria-label": "Go to next page",
|
|
1731
|
-
children:
|
|
1735
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1732
1736
|
icon: ArrowRight01Icon,
|
|
1733
|
-
size:
|
|
1737
|
+
size: 16,
|
|
1734
1738
|
"aria-hidden": "true"
|
|
1735
|
-
})
|
|
1736
|
-
})
|
|
1737
|
-
]
|
|
1739
|
+
})
|
|
1740
|
+
})]
|
|
1741
|
+
})]
|
|
1738
1742
|
});
|
|
1739
1743
|
|
|
1740
1744
|
//#endregion
|
|
@@ -2169,6 +2173,13 @@ const Stepper = ({ steps, currentStep, className, ...props }) => /* @__PURE__ */
|
|
|
2169
2173
|
const SCROLLBAR_INSET = 8;
|
|
2170
2174
|
/** A wider drag target lets the visible thumb stay visually quiet. */
|
|
2171
2175
|
const SCROLLBAR_HIT_AREA = 12;
|
|
2176
|
+
/** Point several refs, function or object, at the same element. */
|
|
2177
|
+
const mergeRefs = (...refs) => (node) => {
|
|
2178
|
+
refs.forEach((ref) => {
|
|
2179
|
+
if (typeof ref === "function") ref(node);
|
|
2180
|
+
else if (ref) ref.current = node;
|
|
2181
|
+
});
|
|
2182
|
+
};
|
|
2172
2183
|
/** Collect a row group's leading cells, skipping rows covered by an earlier rowSpan. */
|
|
2173
2184
|
const collectSectionPinnedCells = ({ pinnedCells, section }) => {
|
|
2174
2185
|
let occupiedRows = 0;
|
|
@@ -2202,8 +2213,9 @@ const measureShelfTop = ({ scrollArea, table }) => {
|
|
|
2202
2213
|
return body ? body.getBoundingClientRect().top - scrollArea.getBoundingClientRect().top + scrollArea.scrollTop : 0;
|
|
2203
2214
|
};
|
|
2204
2215
|
/** Render a table in a stable tray with keyboard access only when content overflows. */
|
|
2205
|
-
const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...props }) => {
|
|
2216
|
+
const Table = ({ className, fill = false, scrollAreaProps = {}, stickyFirstColumn = false, viewportRef, ...props }) => {
|
|
2206
2217
|
const scrollAreaRef = useRef(null);
|
|
2218
|
+
const setViewportRef = useMemo(() => mergeRefs(scrollAreaRef, viewportRef), [viewportRef]);
|
|
2207
2219
|
const [overflow, setOverflow] = useState({
|
|
2208
2220
|
horizontal: false,
|
|
2209
2221
|
vertical: false
|
|
@@ -2308,8 +2320,9 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2308
2320
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2309
2321
|
"data-slot": "table-container",
|
|
2310
2322
|
"data-tray": "header",
|
|
2323
|
+
"data-fill": fill || void 0,
|
|
2311
2324
|
dir: props.dir,
|
|
2312
|
-
className: 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)]",
|
|
2325
|
+
className: 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"),
|
|
2313
2326
|
children: [
|
|
2314
2327
|
/* @__PURE__ */ jsx("div", {
|
|
2315
2328
|
"aria-hidden": "true",
|
|
@@ -2319,7 +2332,7 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2319
2332
|
}),
|
|
2320
2333
|
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, {
|
|
2321
2334
|
...viewportProps,
|
|
2322
|
-
ref:
|
|
2335
|
+
ref: setViewportRef,
|
|
2323
2336
|
"data-slot": "table-scroll-area",
|
|
2324
2337
|
"data-caption-top": topCaptionHeight > 0,
|
|
2325
2338
|
"data-native-scrollbars": useNativeScrollbars,
|
|
@@ -2334,7 +2347,7 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2334
2347
|
scrollPaddingTop: headerHeight + topCaptionHeight,
|
|
2335
2348
|
...scrollAreaStyle
|
|
2336
2349
|
},
|
|
2337
|
-
className: cn("relative min-w-0 overflow-auto overscroll-
|
|
2350
|
+
className: 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),
|
|
2338
2351
|
children: /* @__PURE__ */ jsx("table", {
|
|
2339
2352
|
"data-slot": "table",
|
|
2340
2353
|
"data-sticky-first-column": stickyFirstColumn || void 0,
|
|
@@ -2415,13 +2428,13 @@ const TableFooter = ({ className, ...props }) => {
|
|
|
2415
2428
|
...props
|
|
2416
2429
|
});
|
|
2417
2430
|
};
|
|
2418
|
-
const TableRow = ({ className, ...props }) => {
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2431
|
+
const TableRow = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", {
|
|
2432
|
+
ref,
|
|
2433
|
+
"data-slot": "table-row",
|
|
2434
|
+
className: 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),
|
|
2435
|
+
...props
|
|
2436
|
+
}));
|
|
2437
|
+
TableRow.displayName = "TableRow";
|
|
2425
2438
|
const TableHead = ({ className, scope, ...props }) => {
|
|
2426
2439
|
return /* @__PURE__ */ jsx("th", {
|
|
2427
2440
|
"data-slot": "table-head",
|
|
@@ -2445,6 +2458,1315 @@ const TableCaption = ({ className, ...props }) => {
|
|
|
2445
2458
|
});
|
|
2446
2459
|
};
|
|
2447
2460
|
|
|
2461
|
+
//#endregion
|
|
2462
|
+
//#region src/components/ui/data-table/create-column-helper.ts
|
|
2463
|
+
/**
|
|
2464
|
+
* 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.
|
|
2465
|
+
*
|
|
2466
|
+
* @example
|
|
2467
|
+
* ```tsx
|
|
2468
|
+
* const columnHelper = createColumnHelper<User>();
|
|
2469
|
+
*
|
|
2470
|
+
* const columns = [
|
|
2471
|
+
* columnHelper.accessor('name', { header: 'Name' }),
|
|
2472
|
+
* columnHelper.accessor('email', { header: 'Email' }),
|
|
2473
|
+
* ];
|
|
2474
|
+
* ```
|
|
2475
|
+
* @returns A column helper for rows of type `TData`.
|
|
2476
|
+
* @see ColumnDef
|
|
2477
|
+
* @see useDataTable
|
|
2478
|
+
*/
|
|
2479
|
+
const createColumnHelper = createColumnHelper$1;
|
|
2480
|
+
|
|
2481
|
+
//#endregion
|
|
2482
|
+
//#region src/components/ui/data-table/data-table-context.ts
|
|
2483
|
+
const DataTableContext = createContext(null);
|
|
2484
|
+
/**
|
|
2485
|
+
* Read the state of the nearest `DataTable`, for building custom table parts.
|
|
2486
|
+
* Throws when called outside a `DataTable`.
|
|
2487
|
+
*/
|
|
2488
|
+
const useDataTableContext = () => {
|
|
2489
|
+
const context = useContext(DataTableContext);
|
|
2490
|
+
if (!context) throw new Error("DataTable parts must be used inside a DataTable");
|
|
2491
|
+
return context;
|
|
2492
|
+
};
|
|
2493
|
+
|
|
2494
|
+
//#endregion
|
|
2495
|
+
//#region src/components/ui/data-table/data-table.tsx
|
|
2496
|
+
/**
|
|
2497
|
+
* Root of a data table. Holds the table state for `DataTableContent`, `DataTablePagination` and the other parts.
|
|
2498
|
+
*
|
|
2499
|
+
* @example
|
|
2500
|
+
* ```tsx
|
|
2501
|
+
* const dataTable = useDataTable({ columns, data });
|
|
2502
|
+
*
|
|
2503
|
+
* <DataTable table={dataTable}>
|
|
2504
|
+
* <DataTableToolbar>
|
|
2505
|
+
* <DataTableColumnVisibility />
|
|
2506
|
+
* </DataTableToolbar>
|
|
2507
|
+
* <DataTableContent />
|
|
2508
|
+
* </DataTable>
|
|
2509
|
+
* ```
|
|
2510
|
+
* @returns The rendered data table root element.
|
|
2511
|
+
* @see useDataTable
|
|
2512
|
+
* @see DataTableContent
|
|
2513
|
+
* @see DataTableToolbar
|
|
2514
|
+
*/
|
|
2515
|
+
const DataTable = ({ children, className, fill = false, table, ...props }) => {
|
|
2516
|
+
const contextValue = useMemo(() => ({
|
|
2517
|
+
...table,
|
|
2518
|
+
fill
|
|
2519
|
+
}), [table, fill]);
|
|
2520
|
+
return /* @__PURE__ */ jsx(DataTableContext.Provider, {
|
|
2521
|
+
value: contextValue,
|
|
2522
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2523
|
+
"data-slot": "data-table",
|
|
2524
|
+
"data-fill": fill || void 0,
|
|
2525
|
+
className: cn("flex min-w-0 flex-col gap-3", fill && "min-h-0 flex-1", className),
|
|
2526
|
+
...props,
|
|
2527
|
+
children
|
|
2528
|
+
})
|
|
2529
|
+
});
|
|
2530
|
+
};
|
|
2531
|
+
/**
|
|
2532
|
+
* Row above the table for search, filters and actions.
|
|
2533
|
+
*
|
|
2534
|
+
* @example
|
|
2535
|
+
* ```tsx
|
|
2536
|
+
* <DataTableToolbar>
|
|
2537
|
+
* <Input placeholder="Search users" />
|
|
2538
|
+
* <DataTableColumnVisibility />
|
|
2539
|
+
* </DataTableToolbar>
|
|
2540
|
+
* ```
|
|
2541
|
+
* @returns The rendered toolbar element.
|
|
2542
|
+
* @see DataTable
|
|
2543
|
+
* @see DataTableColumnVisibility
|
|
2544
|
+
*/
|
|
2545
|
+
const DataTableToolbar = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
2546
|
+
"data-slot": "data-table-toolbar",
|
|
2547
|
+
className: cn("flex flex-wrap items-center gap-2", className),
|
|
2548
|
+
...props
|
|
2549
|
+
});
|
|
2550
|
+
|
|
2551
|
+
//#endregion
|
|
2552
|
+
//#region src/components/ui/data-table/get-column-label.ts
|
|
2553
|
+
/**
|
|
2554
|
+
* 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.
|
|
2555
|
+
*/
|
|
2556
|
+
const getColumnLabel = (column) => {
|
|
2557
|
+
const { header, meta } = column.columnDef;
|
|
2558
|
+
const fallback = typeof header === "string" ? header : column.id;
|
|
2559
|
+
return meta?.label ?? fallback;
|
|
2560
|
+
};
|
|
2561
|
+
|
|
2562
|
+
//#endregion
|
|
2563
|
+
//#region src/components/ui/data-table/data-table-column-filter.tsx
|
|
2564
|
+
const TEXT_FILTER_PLACEHOLDER = "Contains";
|
|
2565
|
+
const EMPTY_OPTIONS_TEXT = "No values";
|
|
2566
|
+
/**
|
|
2567
|
+
* Turn cell values into checklist options. List-valued cells count as one value each in TanStack's facets, so their items are
|
|
2568
|
+
* spread out first: a tags column then offers each tag rather than each combination. Empty values offer nothing to check.
|
|
2569
|
+
*/
|
|
2570
|
+
const toOptions = ({ values }) => {
|
|
2571
|
+
const items = values.flatMap((value) => Array.isArray(value) ? value : [value]).filter((value) => value !== void 0 && value !== null && value !== "").map(String);
|
|
2572
|
+
return [...new Set(items)].sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
|
|
2573
|
+
};
|
|
2574
|
+
/**
|
|
2575
|
+
* The values a `values` filter offers: the column's `filterOptions`, else the values in the data.
|
|
2576
|
+
* Client filtering reads TanStack's facets, which leave out the column's own filter so unchecked values stay offered.
|
|
2577
|
+
* Manual filtering has no facets, so it falls back to the values in the rows currently loaded.
|
|
2578
|
+
* Checked values stay listed even when other filters hide every row that holds them, so they can be unchecked.
|
|
2579
|
+
*/
|
|
2580
|
+
const getFilterOptions = ({ column, selected, table }) => {
|
|
2581
|
+
const filterOptions = column.columnDef.meta?.filterOptions;
|
|
2582
|
+
if (filterOptions) return filterOptions;
|
|
2583
|
+
return toOptions({ values: [...table.options.manualFiltering ? table.getCoreRowModel().flatRows.map((row) => row.getValue(column.id)) : [...column.getFacetedUniqueValues().keys()], ...selected] });
|
|
2584
|
+
};
|
|
2585
|
+
/** The checklist of a `values` filter. The checked values are the filter value; unchecking the last one removes the filter. */
|
|
2586
|
+
const DataTableValuesFilter = ({ column, filterValue }) => {
|
|
2587
|
+
const { table } = useDataTableContext();
|
|
2588
|
+
const selected = Array.isArray(filterValue) ? filterValue.map(String) : [];
|
|
2589
|
+
const options = getFilterOptions({
|
|
2590
|
+
column,
|
|
2591
|
+
selected,
|
|
2592
|
+
table
|
|
2593
|
+
});
|
|
2594
|
+
const toggle = ({ checked, option }) => {
|
|
2595
|
+
const next = checked ? [...selected, option] : selected.filter((value) => value !== option);
|
|
2596
|
+
column.setFilterValue(next.length > 0 ? next : void 0);
|
|
2597
|
+
};
|
|
2598
|
+
if (options.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
2599
|
+
className: "text-sm text-muted-foreground",
|
|
2600
|
+
children: EMPTY_OPTIONS_TEXT
|
|
2601
|
+
});
|
|
2602
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2603
|
+
"data-slot": "data-table-column-filter-options",
|
|
2604
|
+
className: "-m-1 flex max-h-60 flex-col gap-2 overflow-y-auto p-1",
|
|
2605
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(Label, {
|
|
2606
|
+
className: "flex items-center gap-2 text-sm font-normal",
|
|
2607
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
2608
|
+
checked: selected.includes(option),
|
|
2609
|
+
onCheckedChange: (checked) => toggle({
|
|
2610
|
+
checked: checked === true,
|
|
2611
|
+
option
|
|
2612
|
+
})
|
|
2613
|
+
}), option]
|
|
2614
|
+
}, option))
|
|
2615
|
+
});
|
|
2616
|
+
};
|
|
2617
|
+
/**
|
|
2618
|
+
* A filter button that opens a column's filter: a text field for `meta.filter: 'text'`, or a checklist for `meta.filter: 'values'`.
|
|
2619
|
+
* `DataTableContent` already adds it to each filterable header; render it yourself only in a header you build without `DataTableContent`.
|
|
2620
|
+
* The checklist offers `meta.filterOptions`, else the values in the data. With manual filtering and no `filterOptions`,
|
|
2621
|
+
* it can only offer the values in the rows currently loaded, so pass `filterOptions` when the server holds more.
|
|
2622
|
+
*
|
|
2623
|
+
* @example
|
|
2624
|
+
* ```tsx
|
|
2625
|
+
* const columns: ColumnDef<User>[] = [
|
|
2626
|
+
* { accessorKey: 'role', header: 'Role', meta: { filter: 'values' } },
|
|
2627
|
+
* ];
|
|
2628
|
+
*
|
|
2629
|
+
* // In a header row you render yourself:
|
|
2630
|
+
* <th>
|
|
2631
|
+
* Role
|
|
2632
|
+
* <DataTableColumnFilter column={header.column} />
|
|
2633
|
+
* </th>
|
|
2634
|
+
* ```
|
|
2635
|
+
* @returns The rendered filter button and its popover.
|
|
2636
|
+
* @see DataTableContent
|
|
2637
|
+
* @see DataTableActiveFilters
|
|
2638
|
+
* @see DataTableSearch
|
|
2639
|
+
*/
|
|
2640
|
+
const DataTableColumnFilter = ({ className, column }) => {
|
|
2641
|
+
const label = getColumnLabel(column);
|
|
2642
|
+
const isFiltered = column.getIsFiltered();
|
|
2643
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
2644
|
+
asChild: true,
|
|
2645
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
2646
|
+
"aria-label": isFiltered ? `Filter ${label}, filtered` : `Filter ${label}`,
|
|
2647
|
+
"data-slot": "data-table-column-filter",
|
|
2648
|
+
"data-filtered": isFiltered || void 0,
|
|
2649
|
+
size: "icon-xs",
|
|
2650
|
+
variant: "ghost",
|
|
2651
|
+
className: cn("ms-1 align-middle before:-inset-1 data-[filtered=true]:text-foreground", className),
|
|
2652
|
+
children: [/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2653
|
+
icon: FilterIcon,
|
|
2654
|
+
"aria-hidden": "true"
|
|
2655
|
+
}), isFiltered && /* @__PURE__ */ jsx("span", {
|
|
2656
|
+
"aria-hidden": "true",
|
|
2657
|
+
className: "absolute end-0.5 top-0.5 size-1.5 rounded-full bg-[var(--action)]"
|
|
2658
|
+
})]
|
|
2659
|
+
})
|
|
2660
|
+
}), /* @__PURE__ */ jsx(DataTableColumnFilterContent, { column })] });
|
|
2661
|
+
};
|
|
2662
|
+
/** The body of a column's filter popover, shared by the header filter button and the active-filter chips. */
|
|
2663
|
+
const DataTableColumnFilterContent = ({ column }) => {
|
|
2664
|
+
const label = getColumnLabel(column);
|
|
2665
|
+
const filterValue = column.getFilterValue();
|
|
2666
|
+
return /* @__PURE__ */ jsxs(PopoverContent, {
|
|
2667
|
+
"aria-label": `Filter ${label}`,
|
|
2668
|
+
align: "start",
|
|
2669
|
+
className: "flex w-56 flex-col gap-3 p-3",
|
|
2670
|
+
children: [column.columnDef.meta?.filter === "values" ? /* @__PURE__ */ jsx(DataTableValuesFilter, {
|
|
2671
|
+
column,
|
|
2672
|
+
filterValue
|
|
2673
|
+
}) : /* @__PURE__ */ jsx(Input, {
|
|
2674
|
+
"aria-label": `Filter ${label}`,
|
|
2675
|
+
placeholder: TEXT_FILTER_PLACEHOLDER,
|
|
2676
|
+
value: typeof filterValue === "string" ? filterValue : "",
|
|
2677
|
+
onChange: (event) => column.setFilterValue(event.target.value)
|
|
2678
|
+
}), column.getIsFiltered() && /* @__PURE__ */ jsx("div", {
|
|
2679
|
+
"data-slot": "data-table-column-filter-footer",
|
|
2680
|
+
className: "-mx-3 flex justify-end border-t border-[var(--border-divider)] px-3 pt-3",
|
|
2681
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
2682
|
+
size: "sm",
|
|
2683
|
+
variant: "secondary",
|
|
2684
|
+
onClick: () => column.setFilterValue(void 0),
|
|
2685
|
+
children: "Clear"
|
|
2686
|
+
})
|
|
2687
|
+
})]
|
|
2688
|
+
});
|
|
2689
|
+
};
|
|
2690
|
+
|
|
2691
|
+
//#endregion
|
|
2692
|
+
//#region src/components/ui/data-table/data-table-active-filters.tsx
|
|
2693
|
+
/** A `values` filter holds the checked values; a `text` filter holds the text. */
|
|
2694
|
+
const toFilterValues = (value) => Array.isArray(value) ? value.map(String) : [String(value)];
|
|
2695
|
+
const MAX_SHOWN_VALUES = 2;
|
|
2696
|
+
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)]";
|
|
2697
|
+
const DataTableFilterChip = ({ column, label, onRemove, removeLabel, values }) => {
|
|
2698
|
+
const fullValue = values.join(", ");
|
|
2699
|
+
const hiddenCount = values.length - MAX_SHOWN_VALUES;
|
|
2700
|
+
const shownValue = /* @__PURE__ */ jsxs(Fragment$1, { children: [values.slice(0, MAX_SHOWN_VALUES).join(", "), hiddenCount > 0 && /* @__PURE__ */ jsxs("span", {
|
|
2701
|
+
className: "ms-1 text-muted-foreground",
|
|
2702
|
+
children: ["+", hiddenCount]
|
|
2703
|
+
})] });
|
|
2704
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
2705
|
+
"data-slot": "data-table-filter-chip",
|
|
2706
|
+
title: hiddenCount > 0 ? fullValue : void 0,
|
|
2707
|
+
className: "inline-flex h-8 items-center rounded-md bg-white p-1 text-[13px] shadow-[var(--shadow-secondary)] dark:bg-input/30",
|
|
2708
|
+
children: [
|
|
2709
|
+
/* @__PURE__ */ jsx("button", {
|
|
2710
|
+
type: "button",
|
|
2711
|
+
"aria-label": removeLabel,
|
|
2712
|
+
onClick: onRemove,
|
|
2713
|
+
className: cn(CHIP_CONTROL, "w-6 justify-center text-muted-foreground/70 hover:text-foreground"),
|
|
2714
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2715
|
+
icon: Cancel01Icon,
|
|
2716
|
+
size: 12,
|
|
2717
|
+
strokeWidth: 2,
|
|
2718
|
+
"aria-hidden": "true"
|
|
2719
|
+
})
|
|
2720
|
+
}),
|
|
2721
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2722
|
+
className: "ps-1 pe-2 text-muted-foreground",
|
|
2723
|
+
children: [label, /* @__PURE__ */ jsx("span", {
|
|
2724
|
+
className: "sr-only",
|
|
2725
|
+
children: ": "
|
|
2726
|
+
})]
|
|
2727
|
+
}),
|
|
2728
|
+
/* @__PURE__ */ jsx("span", {
|
|
2729
|
+
"aria-hidden": "true",
|
|
2730
|
+
className: "h-4 w-px bg-[var(--border-divider)]"
|
|
2731
|
+
}),
|
|
2732
|
+
column ? /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
2733
|
+
asChild: true,
|
|
2734
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
2735
|
+
type: "button",
|
|
2736
|
+
"aria-label": `Change ${label} filter: ${fullValue}`,
|
|
2737
|
+
className: cn(CHIP_CONTROL, "ms-1 gap-1 ps-1.5 pe-1 font-medium text-[var(--action)]"),
|
|
2738
|
+
children: [shownValue, /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2739
|
+
icon: ArrowDown01Icon,
|
|
2740
|
+
size: 14,
|
|
2741
|
+
"aria-hidden": "true",
|
|
2742
|
+
className: "opacity-60"
|
|
2743
|
+
})]
|
|
2744
|
+
})
|
|
2745
|
+
}), /* @__PURE__ */ jsx(DataTableColumnFilterContent, { column })] }) : /* @__PURE__ */ jsx("span", {
|
|
2746
|
+
className: "ps-2 pe-1.5 font-medium text-[var(--action)]",
|
|
2747
|
+
children: shownValue
|
|
2748
|
+
})
|
|
2749
|
+
]
|
|
2750
|
+
});
|
|
2751
|
+
};
|
|
2752
|
+
/**
|
|
2753
|
+
* One chip per active filter, each with a button that removes it, plus a button that clears them all.
|
|
2754
|
+
* The search text gets a chip too. Renders nothing while no filter is active.
|
|
2755
|
+
*
|
|
2756
|
+
* @example
|
|
2757
|
+
* ```tsx
|
|
2758
|
+
* <DataTable table={dataTable}>
|
|
2759
|
+
* <DataTableToolbar>
|
|
2760
|
+
* <DataTableSearch />
|
|
2761
|
+
* </DataTableToolbar>
|
|
2762
|
+
* <DataTableActiveFilters />
|
|
2763
|
+
* <DataTableContent />
|
|
2764
|
+
* </DataTable>
|
|
2765
|
+
* ```
|
|
2766
|
+
* @returns The rendered filter chips, or nothing when no filter is active.
|
|
2767
|
+
* @see DataTableColumnFilter
|
|
2768
|
+
* @see DataTableSearch
|
|
2769
|
+
* @see useDataTable
|
|
2770
|
+
*/
|
|
2771
|
+
const DataTableActiveFilters = ({ className }) => {
|
|
2772
|
+
const { table } = useDataTableContext();
|
|
2773
|
+
const { columnFilters, globalFilter } = table.getState();
|
|
2774
|
+
const search = typeof globalFilter === "string" ? globalFilter : "";
|
|
2775
|
+
if (columnFilters.length === 0 && search === "") return null;
|
|
2776
|
+
const clearAll = () => {
|
|
2777
|
+
table.setColumnFilters([]);
|
|
2778
|
+
table.setGlobalFilter("");
|
|
2779
|
+
};
|
|
2780
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
2781
|
+
"aria-label": "Active filters",
|
|
2782
|
+
"data-slot": "data-table-active-filters",
|
|
2783
|
+
className: cn("flex min-w-0 flex-wrap items-center gap-2", className),
|
|
2784
|
+
children: [
|
|
2785
|
+
search !== "" && /* @__PURE__ */ jsx(DataTableFilterChip, {
|
|
2786
|
+
label: "Search",
|
|
2787
|
+
onRemove: () => table.setGlobalFilter(""),
|
|
2788
|
+
removeLabel: "Remove search filter",
|
|
2789
|
+
values: [search]
|
|
2790
|
+
}),
|
|
2791
|
+
columnFilters.map(({ id, value }) => {
|
|
2792
|
+
const column = table.getAllFlatColumns().find((candidate) => candidate.id === id);
|
|
2793
|
+
const label = column ? getColumnLabel(column) : id;
|
|
2794
|
+
return /* @__PURE__ */ jsx(DataTableFilterChip, {
|
|
2795
|
+
column: column?.columnDef.meta?.filter ? column : void 0,
|
|
2796
|
+
label,
|
|
2797
|
+
onRemove: () => table.setColumnFilters((old) => old.filter((filter) => filter.id !== id)),
|
|
2798
|
+
removeLabel: `Remove ${label} filter`,
|
|
2799
|
+
values: toFilterValues(value)
|
|
2800
|
+
}, id);
|
|
2801
|
+
}),
|
|
2802
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2803
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
2804
|
+
variant: "ghost",
|
|
2805
|
+
onClick: clearAll,
|
|
2806
|
+
children: "Clear filters"
|
|
2807
|
+
})
|
|
2808
|
+
]
|
|
2809
|
+
});
|
|
2810
|
+
};
|
|
2811
|
+
|
|
2812
|
+
//#endregion
|
|
2813
|
+
//#region src/components/ui/data-table/data-table-column-visibility.tsx
|
|
2814
|
+
/**
|
|
2815
|
+
* Lets people choose which columns are shown, from a menu with a checkbox per column.
|
|
2816
|
+
*
|
|
2817
|
+
* @example
|
|
2818
|
+
* ```tsx
|
|
2819
|
+
* <DataTable table={dataTable}>
|
|
2820
|
+
* <DataTableToolbar>
|
|
2821
|
+
* <DataTableColumnVisibility label="Columns" />
|
|
2822
|
+
* </DataTableToolbar>
|
|
2823
|
+
* <DataTableContent />
|
|
2824
|
+
* </DataTable>
|
|
2825
|
+
* ```
|
|
2826
|
+
* @returns The rendered column picker menu.
|
|
2827
|
+
* @see DataTable
|
|
2828
|
+
* @see DataTableToolbar
|
|
2829
|
+
* @see useDataTable
|
|
2830
|
+
*/
|
|
2831
|
+
const DataTableColumnVisibility = ({ className, label = "Columns" }) => {
|
|
2832
|
+
const { table } = useDataTableContext();
|
|
2833
|
+
const columns = table.getAllLeafColumns().filter((column) => column.getCanHide());
|
|
2834
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
2835
|
+
asChild: true,
|
|
2836
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
2837
|
+
"data-slot": "data-table-column-visibility",
|
|
2838
|
+
className,
|
|
2839
|
+
variant: "outline",
|
|
2840
|
+
children: [
|
|
2841
|
+
/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2842
|
+
icon: LayoutThreeColumnIcon,
|
|
2843
|
+
"aria-hidden": "true"
|
|
2844
|
+
}),
|
|
2845
|
+
label,
|
|
2846
|
+
/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2847
|
+
icon: ArrowDown01Icon,
|
|
2848
|
+
"aria-hidden": "true"
|
|
2849
|
+
})
|
|
2850
|
+
]
|
|
2851
|
+
})
|
|
2852
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
2853
|
+
align: "start",
|
|
2854
|
+
children: columns.map((column) => {
|
|
2855
|
+
const visible = column.getIsVisible();
|
|
2856
|
+
return /* @__PURE__ */ jsxs(CheckboxItem, {
|
|
2857
|
+
"data-slot": "data-table-column-visibility-item",
|
|
2858
|
+
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",
|
|
2859
|
+
checked: visible,
|
|
2860
|
+
onCheckedChange: (checked) => column.toggleVisibility(checked === true),
|
|
2861
|
+
onSelect: (event) => event.preventDefault(),
|
|
2862
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
2863
|
+
checked: visible,
|
|
2864
|
+
tabIndex: -1,
|
|
2865
|
+
"aria-hidden": "true",
|
|
2866
|
+
className: "pointer-events-none"
|
|
2867
|
+
}), getColumnLabel(column)]
|
|
2868
|
+
}, column.id);
|
|
2869
|
+
})
|
|
2870
|
+
})] });
|
|
2871
|
+
};
|
|
2872
|
+
|
|
2873
|
+
//#endregion
|
|
2874
|
+
//#region src/components/empty-state/empty-state.tsx
|
|
2875
|
+
const EmptyState = ({ icon: Icon$2, title, description, action, className }) => {
|
|
2876
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2877
|
+
className: cn("flex flex-col items-center justify-center py-16 px-8 text-center", className),
|
|
2878
|
+
children: [
|
|
2879
|
+
/* @__PURE__ */ jsx("div", {
|
|
2880
|
+
className: "flex size-12 items-center justify-center rounded-xl bg-muted mb-4",
|
|
2881
|
+
children: /* @__PURE__ */ jsx(Icon$2, { className: "size-6 text-muted-foreground" })
|
|
2882
|
+
}),
|
|
2883
|
+
/* @__PURE__ */ jsx("h3", {
|
|
2884
|
+
className: "text-sm font-semibold",
|
|
2885
|
+
children: title
|
|
2886
|
+
}),
|
|
2887
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
2888
|
+
className: "text-sm text-muted-foreground mt-1 max-w-sm",
|
|
2889
|
+
children: description
|
|
2890
|
+
}),
|
|
2891
|
+
action && /* @__PURE__ */ jsx("div", {
|
|
2892
|
+
className: "mt-4",
|
|
2893
|
+
children: action
|
|
2894
|
+
})
|
|
2895
|
+
]
|
|
2896
|
+
});
|
|
2897
|
+
};
|
|
2898
|
+
|
|
2899
|
+
//#endregion
|
|
2900
|
+
//#region src/components/ui/data-table/data-table-placeholder-rows.tsx
|
|
2901
|
+
/** Varied bar widths read as real content rather than one repeated block. */
|
|
2902
|
+
const PLACEHOLDER_BARS = [
|
|
2903
|
+
"w-28",
|
|
2904
|
+
"w-14",
|
|
2905
|
+
"w-24",
|
|
2906
|
+
"w-36",
|
|
2907
|
+
"w-24",
|
|
2908
|
+
"w-14"
|
|
2909
|
+
];
|
|
2910
|
+
const GHOST_ROW_COUNT = 6;
|
|
2911
|
+
/** Placeholder, group and detail rows are not interactive, so they must not take the row hover fill. */
|
|
2912
|
+
const STATIC_ROW = "hover:bg-transparent hover:[--table-row-overlay:transparent]";
|
|
2913
|
+
const getBarWidth = (columnIndex) => PLACEHOLDER_BARS[columnIndex % PLACEHOLDER_BARS.length];
|
|
2914
|
+
/** Skeleton rows shown while data loads. Only the first bar is announced, so screen readers hear "Loading" once. */
|
|
2915
|
+
const DataTableSkeletonRows = ({ columnCount, rowCount }) => /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: rowCount }, (_, rowIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
2916
|
+
"data-slot": "data-table-skeleton-row",
|
|
2917
|
+
className: STATIC_ROW,
|
|
2918
|
+
children: Array.from({ length: columnCount }, (_$1, columnIndex) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, {
|
|
2919
|
+
"aria-hidden": rowIndex > 0 || columnIndex > 0 || void 0,
|
|
2920
|
+
className: cn("h-4 max-w-full", getBarWidth(columnIndex))
|
|
2921
|
+
}) }, columnIndex))
|
|
2922
|
+
}, rowIndex)) });
|
|
2923
|
+
/** Ghost rows keep the table's shape behind an icon and title. */
|
|
2924
|
+
const DataTableEmptyRow = ({ action, columnCount, icon, title }) => /* @__PURE__ */ jsx(TableRow, {
|
|
2925
|
+
"data-slot": "data-table-empty",
|
|
2926
|
+
className: STATIC_ROW,
|
|
2927
|
+
children: /* @__PURE__ */ jsx(TableCell, {
|
|
2928
|
+
colSpan: columnCount,
|
|
2929
|
+
className: "p-0 whitespace-normal",
|
|
2930
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2931
|
+
className: "grid",
|
|
2932
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2933
|
+
"aria-hidden": "true",
|
|
2934
|
+
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%)]",
|
|
2935
|
+
children: Array.from({ length: GHOST_ROW_COUNT }, (_, rowIndex) => /* @__PURE__ */ jsx("div", {
|
|
2936
|
+
"data-slot": "data-table-ghost-row",
|
|
2937
|
+
className: "grid items-center border-b border-[var(--border-divider)] py-3.5 last:border-b-0",
|
|
2938
|
+
style: { gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` },
|
|
2939
|
+
children: Array.from({ length: columnCount }, (_$1, columnIndex) => /* @__PURE__ */ jsx("span", {
|
|
2940
|
+
className: "px-4",
|
|
2941
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("block h-2.5 max-w-full rounded-full bg-[var(--bg-accented)]", getBarWidth(columnIndex)) })
|
|
2942
|
+
}, columnIndex))
|
|
2943
|
+
}, rowIndex))
|
|
2944
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
2945
|
+
className: "sticky start-0 col-start-1 row-start-1 flex w-[100cqw] items-center justify-center justify-self-start",
|
|
2946
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
2947
|
+
action,
|
|
2948
|
+
className: "py-0",
|
|
2949
|
+
icon,
|
|
2950
|
+
title
|
|
2951
|
+
})
|
|
2952
|
+
})]
|
|
2953
|
+
})
|
|
2954
|
+
})
|
|
2955
|
+
});
|
|
2956
|
+
|
|
2957
|
+
//#endregion
|
|
2958
|
+
//#region src/components/ui/data-table/expand-chevron.tsx
|
|
2959
|
+
/** A right-pointing chevron that turns to point down while its group is open. */
|
|
2960
|
+
const ExpandChevron = ({ isOpen }) => /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2961
|
+
icon: ArrowRight01Icon,
|
|
2962
|
+
"aria-hidden": "true",
|
|
2963
|
+
className: cn("transition-transform duration-150 motion-reduce:transition-none", isOpen && "rotate-90")
|
|
2964
|
+
});
|
|
2965
|
+
|
|
2966
|
+
//#endregion
|
|
2967
|
+
//#region src/components/ui/data-table/get-pinned-cell-props.ts
|
|
2968
|
+
/** Pinned cells need an opaque base so scrolling text cannot show through; the body overlay still follows row hover and selection. */
|
|
2969
|
+
const PINNED_BACKGROUND = {
|
|
2970
|
+
body: "bg-card bg-[image:linear-gradient(var(--table-row-overlay,transparent),var(--table-row-overlay,transparent))]",
|
|
2971
|
+
header: "bg-[var(--tray-chrome)]"
|
|
2972
|
+
};
|
|
2973
|
+
/** A 1px divider marks where pinned columns meet the scrolling ones. */
|
|
2974
|
+
const PINNED_EDGE = {
|
|
2975
|
+
left: "shadow-[inset_-1px_0_0_var(--border-divider)]",
|
|
2976
|
+
right: "shadow-[inset_1px_0_0_var(--border-divider)]"
|
|
2977
|
+
};
|
|
2978
|
+
/** Sticky position, background and edge divider for a cell in a pinned column. */
|
|
2979
|
+
const getPinnedCellProps = ({ column, section }) => {
|
|
2980
|
+
const side = column.getIsPinned();
|
|
2981
|
+
if (!side) return {};
|
|
2982
|
+
const isEdge = side === "left" ? column.getIsLastColumn("left") : column.getIsFirstColumn("right");
|
|
2983
|
+
return {
|
|
2984
|
+
className: cn("sticky z-10", PINNED_BACKGROUND[section], isEdge && PINNED_EDGE[side]),
|
|
2985
|
+
"data-pinned": side,
|
|
2986
|
+
style: side === "left" ? { insetInlineStart: column.getStart("left") } : { insetInlineEnd: column.getAfter("right") }
|
|
2987
|
+
};
|
|
2988
|
+
};
|
|
2989
|
+
|
|
2990
|
+
//#endregion
|
|
2991
|
+
//#region src/components/ui/data-table/selection-column.tsx
|
|
2992
|
+
/**
|
|
2993
|
+
* Id of the checkbox column added by `selectionColumn`. Use it to find that column, for example when pinning it to the start edge.
|
|
2994
|
+
*
|
|
2995
|
+
* @example
|
|
2996
|
+
* ```tsx
|
|
2997
|
+
* const columnPinning = { initial: { left: [SELECTION_COLUMN_ID] } };
|
|
2998
|
+
* ```
|
|
2999
|
+
* @see selectionColumn
|
|
3000
|
+
* @see useDataTable
|
|
3001
|
+
*/
|
|
3002
|
+
const SELECTION_COLUMN_ID = "select";
|
|
3003
|
+
/** Fixed width in px; DataTableContent sizes headers from it when resizing or pinning is on. */
|
|
3004
|
+
const SELECTION_COLUMN_SIZE = 40;
|
|
3005
|
+
const getAllRowsCheckedState = (table) => {
|
|
3006
|
+
if (table.getIsAllPageRowsSelected()) return true;
|
|
3007
|
+
return table.getIsSomePageRowsSelected() ? "indeterminate" : false;
|
|
3008
|
+
};
|
|
3009
|
+
const SelectionCell = ({ row }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
3010
|
+
"aria-label": "Select row",
|
|
3011
|
+
checked: row.getIsSelected(),
|
|
3012
|
+
disabled: !row.getCanSelect(),
|
|
3013
|
+
onCheckedChange: (checked) => row.toggleSelected(checked === true)
|
|
3014
|
+
});
|
|
3015
|
+
const SelectionHeader = ({ table }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
3016
|
+
"aria-label": "Select all rows",
|
|
3017
|
+
checked: getAllRowsCheckedState(table),
|
|
3018
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked === true)
|
|
3019
|
+
});
|
|
3020
|
+
/**
|
|
3021
|
+
* A checkbox column for row selection. Put it first in `columns` and pass `selection` to `useDataTable`.
|
|
3022
|
+
*
|
|
3023
|
+
* @example
|
|
3024
|
+
* const columns = [selectionColumn<User>(), { accessorKey: 'name', header: 'Name' }];
|
|
3025
|
+
* @returns A column definition that renders a checkbox for each row and a select-all checkbox in the header.
|
|
3026
|
+
* @see SELECTION_COLUMN_ID
|
|
3027
|
+
* @see useDataTable
|
|
3028
|
+
*/
|
|
3029
|
+
const selectionColumn = () => ({
|
|
3030
|
+
cell: SelectionCell,
|
|
3031
|
+
enableHiding: false,
|
|
3032
|
+
enableResizing: false,
|
|
3033
|
+
enableSorting: false,
|
|
3034
|
+
header: SelectionHeader,
|
|
3035
|
+
id: SELECTION_COLUMN_ID,
|
|
3036
|
+
size: SELECTION_COLUMN_SIZE
|
|
3037
|
+
});
|
|
3038
|
+
|
|
3039
|
+
//#endregion
|
|
3040
|
+
//#region src/components/ui/data-table/data-table-rows.tsx
|
|
3041
|
+
/** Fixed layout cells clip and truncate, so a narrowed column cannot spill into its neighbour. The checkbox column never needs it. */
|
|
3042
|
+
const FIXED_LAYOUT_CELL_CLASS = "overflow-hidden text-ellipsis";
|
|
3043
|
+
/**
|
|
3044
|
+
* Pins full-width row content to the visible part of a horizontally scrolling table. The single spanning cell has no
|
|
3045
|
+
* pinned part of its own, so without this the content scrolls off to the start. 100cqw is the tray's width, since the
|
|
3046
|
+
* tray is an inline-size container. The cell drops its padding and this element carries it, so the content is exactly
|
|
3047
|
+
* the visible width and never widens the table.
|
|
3048
|
+
*/
|
|
3049
|
+
const STICKY_ROW_CONTENT = "sticky start-0 w-[100cqw] px-4 py-2.5";
|
|
3050
|
+
/** Shown for a group whose rows have no value in the grouped column. */
|
|
3051
|
+
const EMPTY_GROUP_LABEL = "None";
|
|
3052
|
+
/** The checkbox column holds one control, so it stays narrow and never clips. */
|
|
3053
|
+
const isControlColumn = (columnId) => columnId === SELECTION_COLUMN_ID;
|
|
3054
|
+
/** Rows inside groups step in by 1.25rem per level from the cell's own 1rem padding. */
|
|
3055
|
+
const getIndent = (depth) => `calc(1rem + ${depth} * 1.25rem)`;
|
|
3056
|
+
const getGroupLabel = ({ groupingColumnId, row }) => {
|
|
3057
|
+
const value = row.getGroupingValue(groupingColumnId);
|
|
3058
|
+
return `${value === void 0 || value === null || value === "" ? EMPTY_GROUP_LABEL : String(value)} (${row.getLeafRows().filter((leaf) => !leaf.getIsGrouped()).length})`;
|
|
3059
|
+
};
|
|
3060
|
+
const DataTableRow = ({ hasFixedLayout, row, rowRef, ...props }) => {
|
|
3061
|
+
const cells = row.getVisibleCells();
|
|
3062
|
+
const indentedCellId = row.depth > 0 ? cells.find((cell) => !isControlColumn(cell.column.id))?.id : void 0;
|
|
3063
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
3064
|
+
ref: rowRef,
|
|
3065
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
3066
|
+
...props,
|
|
3067
|
+
children: cells.map((cell) => {
|
|
3068
|
+
const pinned = getPinnedCellProps({
|
|
3069
|
+
column: cell.column,
|
|
3070
|
+
section: "body"
|
|
3071
|
+
});
|
|
3072
|
+
return /* @__PURE__ */ jsx(TableCell, {
|
|
3073
|
+
"data-pinned": pinned["data-pinned"],
|
|
3074
|
+
className: cn(hasFixedLayout && !isControlColumn(cell.column.id) && FIXED_LAYOUT_CELL_CLASS, pinned.className),
|
|
3075
|
+
style: cell.id === indentedCellId ? {
|
|
3076
|
+
...pinned.style,
|
|
3077
|
+
paddingInlineStart: getIndent(row.depth)
|
|
3078
|
+
} : pinned.style,
|
|
3079
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
3080
|
+
}, cell.id);
|
|
3081
|
+
})
|
|
3082
|
+
});
|
|
3083
|
+
};
|
|
3084
|
+
/** One full-width row naming the group and how many rows it holds, with a button that opens or closes it. */
|
|
3085
|
+
const DataTableGroupRow = ({ columnCount, groupingColumnId, row, rowRef, ...props }) => {
|
|
3086
|
+
const isOpen = row.getIsExpanded();
|
|
3087
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
3088
|
+
ref: rowRef,
|
|
3089
|
+
"data-slot": "data-table-group-row",
|
|
3090
|
+
className: STATIC_ROW,
|
|
3091
|
+
...props,
|
|
3092
|
+
children: /* @__PURE__ */ jsx(TableCell, {
|
|
3093
|
+
colSpan: columnCount,
|
|
3094
|
+
className: "p-0 font-medium",
|
|
3095
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3096
|
+
className: STICKY_ROW_CONTENT,
|
|
3097
|
+
style: row.depth > 0 ? { paddingInlineStart: getIndent(row.depth) } : void 0,
|
|
3098
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
3099
|
+
type: "button",
|
|
3100
|
+
"aria-expanded": isOpen,
|
|
3101
|
+
onClick: row.getToggleExpandedHandler(),
|
|
3102
|
+
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",
|
|
3103
|
+
children: [/* @__PURE__ */ jsx(ExpandChevron, { isOpen }), getGroupLabel({
|
|
3104
|
+
groupingColumnId,
|
|
3105
|
+
row
|
|
3106
|
+
})]
|
|
3107
|
+
})
|
|
3108
|
+
})
|
|
3109
|
+
})
|
|
3110
|
+
});
|
|
3111
|
+
};
|
|
3112
|
+
/** One table row, as a group header or a data row. Row props and `rowRef` land on its `<tr>`. */
|
|
3113
|
+
const DataTableBodyRow = ({ columnCount, hasFixedLayout, row, ...props }) => {
|
|
3114
|
+
const { groupingColumnId } = row;
|
|
3115
|
+
if (groupingColumnId) return /* @__PURE__ */ jsx(DataTableGroupRow, {
|
|
3116
|
+
columnCount,
|
|
3117
|
+
groupingColumnId,
|
|
3118
|
+
row,
|
|
3119
|
+
...props
|
|
3120
|
+
});
|
|
3121
|
+
return /* @__PURE__ */ jsx(DataTableRow, {
|
|
3122
|
+
hasFixedLayout,
|
|
3123
|
+
row,
|
|
3124
|
+
...props
|
|
3125
|
+
});
|
|
3126
|
+
};
|
|
3127
|
+
|
|
3128
|
+
//#endregion
|
|
3129
|
+
//#region src/components/ui/data-table/data-table-content.tsx
|
|
3130
|
+
const DEFAULT_EMPTY_TITLE = "No results";
|
|
3131
|
+
const DEFAULT_EMPTY_FILTERED_TITLE = "No matching results";
|
|
3132
|
+
const DEFAULT_LOADING_ROW_COUNT = 5;
|
|
3133
|
+
const ARIA_SORT = {
|
|
3134
|
+
asc: "ascending",
|
|
3135
|
+
desc: "descending"
|
|
3136
|
+
};
|
|
3137
|
+
const SORT_ICON = {
|
|
3138
|
+
asc: ArrowUp01Icon,
|
|
3139
|
+
desc: ArrowDown01Icon
|
|
3140
|
+
};
|
|
3141
|
+
/** Arrow keys resize in 16px steps, matching the 4px spacing grid. */
|
|
3142
|
+
const RESIZE_STEP = {
|
|
3143
|
+
ArrowLeft: -16,
|
|
3144
|
+
ArrowRight: 16
|
|
3145
|
+
};
|
|
3146
|
+
/** TanStack's default minimum column width. */
|
|
3147
|
+
const MIN_COLUMN_SIZE = 20;
|
|
3148
|
+
/** TanStack leaves columns unbounded; screen readers get a usable range instead. */
|
|
3149
|
+
const MAX_COLUMN_SIZE = 1e3;
|
|
3150
|
+
/** Rows rendered beyond each edge of the view when virtualization sets no overscan. */
|
|
3151
|
+
const DEFAULT_OVERSCAN = 8;
|
|
3152
|
+
const DefaultEmptyIcon = ({ className, size }) => /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3153
|
+
className,
|
|
3154
|
+
icon: Table01Icon,
|
|
3155
|
+
size
|
|
3156
|
+
});
|
|
3157
|
+
const getMaxColumnSize = (maxSize) => maxSize === void 0 || maxSize === Number.MAX_SAFE_INTEGER ? MAX_COLUMN_SIZE : maxSize;
|
|
3158
|
+
const DataTableResizeHandle = ({ header }) => {
|
|
3159
|
+
const { column } = header;
|
|
3160
|
+
const { table } = header.getContext();
|
|
3161
|
+
const size = column.getSize();
|
|
3162
|
+
const handleKeyDown = (event) => {
|
|
3163
|
+
const step = RESIZE_STEP[event.key];
|
|
3164
|
+
if (!step) return;
|
|
3165
|
+
event.preventDefault();
|
|
3166
|
+
table.setColumnSizing((sizing) => ({
|
|
3167
|
+
...sizing,
|
|
3168
|
+
[column.id]: size + step
|
|
3169
|
+
}));
|
|
3170
|
+
};
|
|
3171
|
+
const resize = header.getResizeHandler();
|
|
3172
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3173
|
+
role: "separator",
|
|
3174
|
+
"aria-label": `Resize ${getColumnLabel(column)}`,
|
|
3175
|
+
"aria-orientation": "vertical",
|
|
3176
|
+
"aria-valuemax": getMaxColumnSize(column.columnDef.maxSize),
|
|
3177
|
+
"aria-valuemin": column.columnDef.minSize ?? MIN_COLUMN_SIZE,
|
|
3178
|
+
"aria-valuenow": size,
|
|
3179
|
+
"aria-valuetext": `${size} pixels`,
|
|
3180
|
+
tabIndex: 0,
|
|
3181
|
+
"data-slot": "data-table-resize-handle",
|
|
3182
|
+
"data-resizing": column.getIsResizing() || void 0,
|
|
3183
|
+
onDoubleClick: () => column.resetSize(),
|
|
3184
|
+
onKeyDown: handleKeyDown,
|
|
3185
|
+
onMouseDown: resize,
|
|
3186
|
+
onTouchStart: resize,
|
|
3187
|
+
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"
|
|
3188
|
+
});
|
|
3189
|
+
};
|
|
3190
|
+
const DataTableHeadCell = ({ header, hasFixedLayout }) => {
|
|
3191
|
+
const { column } = header;
|
|
3192
|
+
const sorted = column.getIsSorted();
|
|
3193
|
+
const sortIndex = column.getSortIndex();
|
|
3194
|
+
const isMultiSort = header.getContext().table.getState().sorting.length > 1;
|
|
3195
|
+
const sortPriority = sorted && isMultiSort ? sortIndex + 1 : void 0;
|
|
3196
|
+
const pinned = getPinnedCellProps({
|
|
3197
|
+
column,
|
|
3198
|
+
section: "header"
|
|
3199
|
+
});
|
|
3200
|
+
const content = header.isPlaceholder ? null : flexRender(column.columnDef.header, header.getContext());
|
|
3201
|
+
return /* @__PURE__ */ jsxs(TableHead, {
|
|
3202
|
+
colSpan: header.colSpan,
|
|
3203
|
+
"aria-sort": sorted && sortIndex === 0 ? ARIA_SORT[sorted] : void 0,
|
|
3204
|
+
"data-pinned": pinned["data-pinned"],
|
|
3205
|
+
className: cn(column.getCanResize() && "relative", isControlColumn(column.id) && "w-px", hasFixedLayout && !isControlColumn(column.id) && FIXED_LAYOUT_CELL_CLASS, pinned.className),
|
|
3206
|
+
style: {
|
|
3207
|
+
...pinned.style,
|
|
3208
|
+
width: hasFixedLayout ? header.getSize() : void 0
|
|
3209
|
+
},
|
|
3210
|
+
children: [
|
|
3211
|
+
!header.isPlaceholder && column.getCanSort() ? /* @__PURE__ */ jsxs("button", {
|
|
3212
|
+
type: "button",
|
|
3213
|
+
onClick: column.getToggleSortingHandler(),
|
|
3214
|
+
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)]",
|
|
3215
|
+
children: [
|
|
3216
|
+
content,
|
|
3217
|
+
sorted && /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3218
|
+
icon: SORT_ICON[sorted],
|
|
3219
|
+
size: 12,
|
|
3220
|
+
"aria-hidden": "true"
|
|
3221
|
+
}),
|
|
3222
|
+
sortPriority !== void 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
3223
|
+
"aria-hidden": "true",
|
|
3224
|
+
className: "text-[10px] tabular-nums",
|
|
3225
|
+
children: sortPriority
|
|
3226
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
3227
|
+
className: "sr-only",
|
|
3228
|
+
children: [", sort priority ", sortPriority]
|
|
3229
|
+
})] })
|
|
3230
|
+
]
|
|
3231
|
+
}) : content,
|
|
3232
|
+
!header.isPlaceholder && column.getCanFilter() && column.columnDef.meta?.filter && /* @__PURE__ */ jsx(DataTableColumnFilter, { column }),
|
|
3233
|
+
column.getCanResize() && /* @__PURE__ */ jsx(DataTableResizeHandle, { header })
|
|
3234
|
+
]
|
|
3235
|
+
});
|
|
3236
|
+
};
|
|
3237
|
+
/** Holds the height of the rows virtualization leaves unrendered above or below the view. */
|
|
3238
|
+
const DataTableVirtualSpacer = ({ columnCount, height }) => /* @__PURE__ */ jsx("tr", {
|
|
3239
|
+
"aria-hidden": "true",
|
|
3240
|
+
"data-slot": "data-table-virtual-spacer",
|
|
3241
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
3242
|
+
colSpan: columnCount,
|
|
3243
|
+
className: "p-0",
|
|
3244
|
+
style: {
|
|
3245
|
+
borderWidth: 0,
|
|
3246
|
+
height
|
|
3247
|
+
}
|
|
3248
|
+
})
|
|
3249
|
+
});
|
|
3250
|
+
/**
|
|
3251
|
+
* The table itself: headers, rows, and the loading and empty states.
|
|
3252
|
+
*
|
|
3253
|
+
* @example
|
|
3254
|
+
* ```tsx
|
|
3255
|
+
* const dataTable = useDataTable({ columns, data, sorting: { mode: 'client' } });
|
|
3256
|
+
*
|
|
3257
|
+
* <DataTable table={dataTable}>
|
|
3258
|
+
* <DataTableContent emptyTitle="No users yet" />
|
|
3259
|
+
* </DataTable>
|
|
3260
|
+
* ```
|
|
3261
|
+
* @returns The rendered table element.
|
|
3262
|
+
* @see DataTable
|
|
3263
|
+
* @see useDataTable
|
|
3264
|
+
* @see DataTablePagination
|
|
3265
|
+
*/
|
|
3266
|
+
const DataTableContent = ({ className, emptyFilteredTitle = DEFAULT_EMPTY_FILTERED_TITLE, emptyIcon = DefaultEmptyIcon, emptyTitle = DEFAULT_EMPTY_TITLE, loadingRowCount = DEFAULT_LOADING_ROW_COUNT, style, ...props }) => {
|
|
3267
|
+
const { fill, loading, table, virtualization } = useDataTableContext();
|
|
3268
|
+
const viewportRef = useRef(null);
|
|
3269
|
+
const hasFixedLayout = table.options.enableColumnResizing === true || table.options.enableColumnPinning === true || virtualization !== void 0;
|
|
3270
|
+
const columnCount = table.getVisibleLeafColumns().length;
|
|
3271
|
+
const { rows } = table.getRowModel();
|
|
3272
|
+
const headerGroups = table.getHeaderGroups();
|
|
3273
|
+
const headerRowCount = headerGroups.length;
|
|
3274
|
+
const isVirtualized = virtualization !== void 0 && !loading && rows.length > 0;
|
|
3275
|
+
const { estimateRowHeight = 0, overscan = DEFAULT_OVERSCAN } = virtualization ?? {};
|
|
3276
|
+
const getItemKey = useCallback((index) => rows[index].id, [rows]);
|
|
3277
|
+
const virtualizer = useVirtualizer({
|
|
3278
|
+
count: isVirtualized ? rows.length : 0,
|
|
3279
|
+
enabled: isVirtualized,
|
|
3280
|
+
estimateSize: () => estimateRowHeight,
|
|
3281
|
+
getItemKey,
|
|
3282
|
+
getScrollElement: () => viewportRef.current,
|
|
3283
|
+
overscan
|
|
3284
|
+
});
|
|
3285
|
+
const renderVirtualRows = () => {
|
|
3286
|
+
const virtualRows = virtualizer.getVirtualItems();
|
|
3287
|
+
const firstRow = virtualRows.at(0);
|
|
3288
|
+
const lastRow = virtualRows.at(-1);
|
|
3289
|
+
const topHeight = firstRow ? firstRow.start : 0;
|
|
3290
|
+
const bottomHeight = lastRow ? virtualizer.getTotalSize() - lastRow.end : 0;
|
|
3291
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3292
|
+
topHeight > 0 && /* @__PURE__ */ jsx(DataTableVirtualSpacer, {
|
|
3293
|
+
columnCount,
|
|
3294
|
+
height: topHeight
|
|
3295
|
+
}),
|
|
3296
|
+
virtualRows.map(({ index }) => {
|
|
3297
|
+
const row = rows[index];
|
|
3298
|
+
return /* @__PURE__ */ jsx(DataTableBodyRow, {
|
|
3299
|
+
"aria-rowindex": headerRowCount + index + 1,
|
|
3300
|
+
columnCount,
|
|
3301
|
+
"data-index": index,
|
|
3302
|
+
hasFixedLayout,
|
|
3303
|
+
row,
|
|
3304
|
+
rowRef: virtualizer.measureElement
|
|
3305
|
+
}, row.id);
|
|
3306
|
+
}),
|
|
3307
|
+
bottomHeight > 0 && /* @__PURE__ */ jsx(DataTableVirtualSpacer, {
|
|
3308
|
+
columnCount,
|
|
3309
|
+
height: bottomHeight
|
|
3310
|
+
})
|
|
3311
|
+
] });
|
|
3312
|
+
};
|
|
3313
|
+
const renderEmptyRow = () => {
|
|
3314
|
+
const { columnFilters, globalFilter } = table.getState();
|
|
3315
|
+
if (columnFilters.length === 0 && globalFilter === "") return /* @__PURE__ */ jsx(DataTableEmptyRow, {
|
|
3316
|
+
columnCount,
|
|
3317
|
+
icon: emptyIcon,
|
|
3318
|
+
title: emptyTitle
|
|
3319
|
+
});
|
|
3320
|
+
const clearFilters = () => {
|
|
3321
|
+
table.setColumnFilters([]);
|
|
3322
|
+
table.setGlobalFilter("");
|
|
3323
|
+
};
|
|
3324
|
+
return /* @__PURE__ */ jsx(DataTableEmptyRow, {
|
|
3325
|
+
action: /* @__PURE__ */ jsx(Button, {
|
|
3326
|
+
variant: "outline",
|
|
3327
|
+
size: "sm",
|
|
3328
|
+
onClick: clearFilters,
|
|
3329
|
+
children: "Clear filters"
|
|
3330
|
+
}),
|
|
3331
|
+
columnCount,
|
|
3332
|
+
icon: emptyIcon,
|
|
3333
|
+
title: emptyFilteredTitle
|
|
3334
|
+
});
|
|
3335
|
+
};
|
|
3336
|
+
const renderBody = () => {
|
|
3337
|
+
if (loading) return /* @__PURE__ */ jsx(DataTableSkeletonRows, {
|
|
3338
|
+
columnCount,
|
|
3339
|
+
rowCount: loadingRowCount
|
|
3340
|
+
});
|
|
3341
|
+
if (rows.length === 0) return renderEmptyRow();
|
|
3342
|
+
if (isVirtualized) return renderVirtualRows();
|
|
3343
|
+
return rows.map((row) => /* @__PURE__ */ jsx(DataTableBodyRow, {
|
|
3344
|
+
columnCount,
|
|
3345
|
+
hasFixedLayout,
|
|
3346
|
+
row
|
|
3347
|
+
}, row.id));
|
|
3348
|
+
};
|
|
3349
|
+
return /* @__PURE__ */ jsxs(Table, {
|
|
3350
|
+
fill,
|
|
3351
|
+
"aria-busy": loading || void 0,
|
|
3352
|
+
"aria-rowcount": isVirtualized ? rows.length + headerRowCount : void 0,
|
|
3353
|
+
className: cn(hasFixedLayout && "w-auto table-fixed", className),
|
|
3354
|
+
style: hasFixedLayout ? {
|
|
3355
|
+
minWidth: "100%",
|
|
3356
|
+
width: table.getTotalSize(),
|
|
3357
|
+
...style
|
|
3358
|
+
} : style,
|
|
3359
|
+
...props,
|
|
3360
|
+
viewportRef,
|
|
3361
|
+
children: [/* @__PURE__ */ jsx(TableHeader, { children: headerGroups.map((headerGroup, headerIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
3362
|
+
"aria-rowindex": isVirtualized ? headerIndex + 1 : void 0,
|
|
3363
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(DataTableHeadCell, {
|
|
3364
|
+
header,
|
|
3365
|
+
hasFixedLayout
|
|
3366
|
+
}, header.id))
|
|
3367
|
+
}, headerGroup.id)) }), /* @__PURE__ */ jsx(TableBody, { children: renderBody() })]
|
|
3368
|
+
});
|
|
3369
|
+
};
|
|
3370
|
+
|
|
3371
|
+
//#endregion
|
|
3372
|
+
//#region src/components/ui/data-table/data-table-pagination.tsx
|
|
3373
|
+
/**
|
|
3374
|
+
* Previous and next buttons beside the visible row range, for client or server pagination. Renders nothing when pagination is off.
|
|
3375
|
+
*
|
|
3376
|
+
* @example
|
|
3377
|
+
* ```tsx
|
|
3378
|
+
* const dataTable = useDataTable({
|
|
3379
|
+
* columns,
|
|
3380
|
+
* data,
|
|
3381
|
+
* pagination: { mode: 'client', pageSize: 25 },
|
|
3382
|
+
* });
|
|
3383
|
+
*
|
|
3384
|
+
* <DataTable table={dataTable}>
|
|
3385
|
+
* <DataTableContent />
|
|
3386
|
+
* <DataTablePagination />
|
|
3387
|
+
* </DataTable>
|
|
3388
|
+
* ```
|
|
3389
|
+
* @returns The rendered pagination controls, or `null` when pagination is off.
|
|
3390
|
+
* @see useDataTable
|
|
3391
|
+
* @see DataTable
|
|
3392
|
+
*/
|
|
3393
|
+
const DataTablePagination = ({ className }) => {
|
|
3394
|
+
const { table } = useDataTableContext();
|
|
3395
|
+
if (!table.options.getPaginationRowModel && !table.options.manualPagination) return null;
|
|
3396
|
+
const { pageIndex, pageSize } = table.getState().pagination;
|
|
3397
|
+
const rowCount = table.getRowCount();
|
|
3398
|
+
const start = pageIndex * pageSize + 1;
|
|
3399
|
+
const end = Math.min((pageIndex + 1) * pageSize, rowCount);
|
|
3400
|
+
return /* @__PURE__ */ jsx(CursorPagination, {
|
|
3401
|
+
className,
|
|
3402
|
+
hasNext: table.getCanNextPage(),
|
|
3403
|
+
hasPrevious: table.getCanPreviousPage(),
|
|
3404
|
+
label: rowCount > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3405
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3406
|
+
className: "text-foreground",
|
|
3407
|
+
children: [
|
|
3408
|
+
start,
|
|
3409
|
+
"–",
|
|
3410
|
+
end
|
|
3411
|
+
]
|
|
3412
|
+
}),
|
|
3413
|
+
" ",
|
|
3414
|
+
"of ",
|
|
3415
|
+
rowCount
|
|
3416
|
+
] }) : void 0,
|
|
3417
|
+
onNext: () => table.nextPage(),
|
|
3418
|
+
onPrevious: () => table.previousPage()
|
|
3419
|
+
});
|
|
3420
|
+
};
|
|
3421
|
+
|
|
3422
|
+
//#endregion
|
|
3423
|
+
//#region src/components/ui/data-table/data-table-search.tsx
|
|
3424
|
+
/**
|
|
3425
|
+
* A search field that matches its text across the table's columns. Needs `filtering` in `useDataTable`, and renders nothing without it.
|
|
3426
|
+
* With manual filtering the app receives the text as `globalFilter` and filters the data itself.
|
|
3427
|
+
*
|
|
3428
|
+
* @example
|
|
3429
|
+
* ```tsx
|
|
3430
|
+
* const dataTable = useDataTable({ columns, data, filtering: { mode: 'client' } });
|
|
3431
|
+
*
|
|
3432
|
+
* <DataTable table={dataTable}>
|
|
3433
|
+
* <DataTableToolbar>
|
|
3434
|
+
* <DataTableSearch placeholder="Search users" />
|
|
3435
|
+
* </DataTableToolbar>
|
|
3436
|
+
* <DataTableContent />
|
|
3437
|
+
* </DataTable>
|
|
3438
|
+
* ```
|
|
3439
|
+
* @returns The rendered search field, or nothing when filtering is off.
|
|
3440
|
+
* @see DataTableToolbar
|
|
3441
|
+
* @see DataTableActiveFilters
|
|
3442
|
+
* @see useDataTable
|
|
3443
|
+
*/
|
|
3444
|
+
const DataTableSearch = ({ className, placeholder = "Search" }) => {
|
|
3445
|
+
const { table } = useDataTableContext();
|
|
3446
|
+
if (!table.options.enableGlobalFilter) return null;
|
|
3447
|
+
const { globalFilter } = table.getState();
|
|
3448
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3449
|
+
"data-slot": "data-table-search",
|
|
3450
|
+
className: cn("relative w-full max-w-64", className),
|
|
3451
|
+
children: [/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3452
|
+
icon: Search01Icon,
|
|
3453
|
+
size: 16,
|
|
3454
|
+
"aria-hidden": "true",
|
|
3455
|
+
className: "pointer-events-none absolute start-2 top-1/2 -translate-y-1/2 text-muted-foreground/70"
|
|
3456
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
3457
|
+
type: "search",
|
|
3458
|
+
"aria-label": placeholder,
|
|
3459
|
+
placeholder,
|
|
3460
|
+
value: typeof globalFilter === "string" ? globalFilter : "",
|
|
3461
|
+
onChange: (event) => table.setGlobalFilter(event.target.value),
|
|
3462
|
+
className: "ps-8"
|
|
3463
|
+
})]
|
|
3464
|
+
});
|
|
3465
|
+
};
|
|
3466
|
+
|
|
3467
|
+
//#endregion
|
|
3468
|
+
//#region src/components/ui/data-table/use-data-table.ts
|
|
3469
|
+
/** Keeps the pagination state complete when the app has not turned pagination on. */
|
|
3470
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
3471
|
+
/** Columns filter only when they opt in with `meta.filter` (see `withColumnFilters`). A module constant, so the table gets the same object each render. */
|
|
3472
|
+
const DEFAULT_COLUMN = { enableColumnFilter: false };
|
|
3473
|
+
const isControlled = (feature) => feature !== void 0 && "state" in feature;
|
|
3474
|
+
/**
|
|
3475
|
+
* 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.
|
|
3476
|
+
* When it is not only the end edge that gained, the start edge wins.
|
|
3477
|
+
*/
|
|
3478
|
+
const toOneEdge = ({ next, previous }) => {
|
|
3479
|
+
const left = next.left ?? [];
|
|
3480
|
+
const right = next.right ?? [];
|
|
3481
|
+
if (left.length > 0 && right.length > 0) {
|
|
3482
|
+
const previousLeft = previous.left ?? [];
|
|
3483
|
+
const previousRight = previous.right ?? [];
|
|
3484
|
+
return right.some((id) => !previousRight.includes(id)) && left.every((id) => previousLeft.includes(id)) ? { right } : { left };
|
|
3485
|
+
}
|
|
3486
|
+
return right.length > 0 ? { right } : { left };
|
|
3487
|
+
};
|
|
3488
|
+
const getInitialState = ({ fallback, feature }) => feature && !isControlled(feature) ? feature.initial ?? fallback : fallback;
|
|
3489
|
+
/** The table hands over updaters; the app expects the next value, resolved against its current state. */
|
|
3490
|
+
const toTableFeatureState = (feature) => ({
|
|
3491
|
+
onChange: (updater) => feature.onChange(functionalUpdate(updater, feature.state)),
|
|
3492
|
+
state: feature.state
|
|
3493
|
+
});
|
|
3494
|
+
/** Use the app's state when it owns the feature, otherwise the table's own. */
|
|
3495
|
+
const resolveFeatureState = ({ feature, internal, setInternal }) => isControlled(feature) ? toTableFeatureState(feature) : {
|
|
3496
|
+
onChange: setInternal,
|
|
3497
|
+
state: internal
|
|
3498
|
+
};
|
|
3499
|
+
/**
|
|
3500
|
+
* Matches a row when its value is one of the checked values, or, for a list value, when any item is.
|
|
3501
|
+
* TanStack's `arrIncludesSome` calls `includes` on the row value, which matches substrings of strings and throws on numbers.
|
|
3502
|
+
* Clearing every value removes the filter.
|
|
3503
|
+
*/
|
|
3504
|
+
const includesSomeValue = Object.assign((row, columnId, filterValue) => {
|
|
3505
|
+
const value = row.getValue(columnId);
|
|
3506
|
+
return Array.isArray(value) ? value.some((item) => filterValue.includes(String(item))) : filterValue.includes(String(value));
|
|
3507
|
+
}, { autoRemove: (value) => !Array.isArray(value) || value.length === 0 });
|
|
3508
|
+
/**
|
|
3509
|
+
* Give each column with `meta.filter` a matching filter function and let it filter, recursing into column groups.
|
|
3510
|
+
* TanStack's `auto` filter guesses from the first row's value, so a checklist of values over string cells would get a string filter.
|
|
3511
|
+
*/
|
|
3512
|
+
const withColumnFilters = (columns) => columns.map((column) => {
|
|
3513
|
+
const withGroups = "columns" in column && column.columns ? {
|
|
3514
|
+
...column,
|
|
3515
|
+
columns: withColumnFilters(column.columns)
|
|
3516
|
+
} : column;
|
|
3517
|
+
const filter = column.meta?.filter;
|
|
3518
|
+
if (!filter) return withGroups;
|
|
3519
|
+
return {
|
|
3520
|
+
...withGroups,
|
|
3521
|
+
enableColumnFilter: column.enableColumnFilter ?? true,
|
|
3522
|
+
filterFn: column.filterFn ?? (filter === "values" ? includesSomeValue : "includesString")
|
|
3523
|
+
};
|
|
3524
|
+
});
|
|
3525
|
+
/** The filters a table starts with: the app's seed for client filtering, nothing otherwise. */
|
|
3526
|
+
const getInitialFilters = ({ filtering }) => {
|
|
3527
|
+
const initial = filtering?.mode === "client" ? filtering.initial : void 0;
|
|
3528
|
+
return {
|
|
3529
|
+
columnFilters: initial?.columnFilters ?? [],
|
|
3530
|
+
globalFilter: initial?.globalFilter ?? ""
|
|
3531
|
+
};
|
|
3532
|
+
};
|
|
3533
|
+
/**
|
|
3534
|
+
* Filter state and change handlers for search and column filters, which share one state.
|
|
3535
|
+
* `onFiltersChange` runs after every change, so the caller can react to it (pagination returns to the first page).
|
|
3536
|
+
*/
|
|
3537
|
+
const useFilterState = ({ filtering, onFiltersChange }) => {
|
|
3538
|
+
const [internalFilters, setInternalFilters] = useState(() => getInitialFilters({ filtering }));
|
|
3539
|
+
const manual = filtering?.mode === "manual" ? filtering : void 0;
|
|
3540
|
+
const latestManualFilters = useRef(void 0);
|
|
3541
|
+
latestManualFilters.current = manual?.state;
|
|
3542
|
+
const updateFilters = (updater) => {
|
|
3543
|
+
if (manual) {
|
|
3544
|
+
const next = functionalUpdate(updater, latestManualFilters.current ?? manual.state);
|
|
3545
|
+
latestManualFilters.current = next;
|
|
3546
|
+
manual.onChange(next);
|
|
3547
|
+
} else setInternalFilters(updater);
|
|
3548
|
+
onFiltersChange();
|
|
3549
|
+
};
|
|
3550
|
+
return {
|
|
3551
|
+
filterState: manual ? manual.state : internalFilters,
|
|
3552
|
+
handleColumnFiltersChange: (updater) => updateFilters((old) => ({
|
|
3553
|
+
...old,
|
|
3554
|
+
columnFilters: functionalUpdate(updater, old.columnFilters)
|
|
3555
|
+
})),
|
|
3556
|
+
handleGlobalFilterChange: (updater) => updateFilters((old) => ({
|
|
3557
|
+
...old,
|
|
3558
|
+
globalFilter: functionalUpdate(updater, old.globalFilter) ?? ""
|
|
3559
|
+
}))
|
|
3560
|
+
};
|
|
3561
|
+
};
|
|
3562
|
+
/** Pinning state where every change goes through toOneEdge, so the table and a controlled onChange only ever see one pinned edge. */
|
|
3563
|
+
const resolvePinningState = ({ columnPinning, internal, setInternal }) => {
|
|
3564
|
+
if (isControlled(columnPinning)) return {
|
|
3565
|
+
onChange: (updater) => columnPinning.onChange(toOneEdge({
|
|
3566
|
+
next: functionalUpdate(updater, columnPinning.state),
|
|
3567
|
+
previous: columnPinning.state
|
|
3568
|
+
})),
|
|
3569
|
+
state: columnPinning.state
|
|
3570
|
+
};
|
|
3571
|
+
return {
|
|
3572
|
+
onChange: (updater) => setInternal((old) => toOneEdge({
|
|
3573
|
+
next: functionalUpdate(updater, old),
|
|
3574
|
+
previous: old
|
|
3575
|
+
})),
|
|
3576
|
+
state: internal
|
|
3577
|
+
};
|
|
3578
|
+
};
|
|
3579
|
+
/** Row models for the features the table runs in memory; manual features leave their step to the app. */
|
|
3580
|
+
const getRowModels = ({ filtering, grouping, pagination, sorting }) => {
|
|
3581
|
+
const clientFiltering = filtering?.mode === "client";
|
|
3582
|
+
return {
|
|
3583
|
+
getExpandedRowModel: grouping ? getExpandedRowModel() : void 0,
|
|
3584
|
+
getFacetedRowModel: clientFiltering ? getFacetedRowModel() : void 0,
|
|
3585
|
+
getFacetedUniqueValues: clientFiltering ? getFacetedUniqueValues() : void 0,
|
|
3586
|
+
getFilteredRowModel: clientFiltering ? getFilteredRowModel() : void 0,
|
|
3587
|
+
getGroupedRowModel: grouping ? getGroupedRowModel() : void 0,
|
|
3588
|
+
getPaginationRowModel: pagination?.mode === "client" ? getPaginationRowModel() : void 0,
|
|
3589
|
+
getSortedRowModel: sorting?.mode === "client" ? getSortedRowModel() : void 0
|
|
3590
|
+
};
|
|
3591
|
+
};
|
|
3592
|
+
/**
|
|
3593
|
+
* Page resets are off (see autoResetPageIndex), so when the data shrinks the page can run past the end.
|
|
3594
|
+
* Clamping only when out of range keeps a fresh data array each render from looping.
|
|
3595
|
+
*/
|
|
3596
|
+
const useClampedPageIndex = ({ isClientPagination, pageIndex, table }) => {
|
|
3597
|
+
const lastPageIndex = Math.max(0, table.getPageCount() - 1);
|
|
3598
|
+
useEffect(() => {
|
|
3599
|
+
if (isClientPagination && pageIndex > lastPageIndex) table.setPageIndex(lastPageIndex);
|
|
3600
|
+
}, [
|
|
3601
|
+
isClientPagination,
|
|
3602
|
+
lastPageIndex,
|
|
3603
|
+
pageIndex,
|
|
3604
|
+
table
|
|
3605
|
+
]);
|
|
3606
|
+
};
|
|
3607
|
+
/**
|
|
3608
|
+
* Create the state for a `DataTable`. Each feature stays off until its option is passed.
|
|
3609
|
+
* Pass `{ state, onChange }` to own a feature's state, or `mode: 'manual'` for server-driven sorting and pagination.
|
|
3610
|
+
* `onChange` receives the next state, ready to store.
|
|
3611
|
+
*
|
|
3612
|
+
* @example
|
|
3613
|
+
* const dataTable = useDataTable({
|
|
3614
|
+
* columns,
|
|
3615
|
+
* data,
|
|
3616
|
+
* pagination: { mode: 'client', pageSize: 25 },
|
|
3617
|
+
* sorting: { mode: 'client' },
|
|
3618
|
+
* });
|
|
3619
|
+
*
|
|
3620
|
+
* <DataTable table={dataTable}>
|
|
3621
|
+
* <DataTableContent />
|
|
3622
|
+
* <DataTablePagination />
|
|
3623
|
+
* </DataTable>
|
|
3624
|
+
* @returns A table instance to pass to `DataTable` as `table`.
|
|
3625
|
+
* @see UseDataTableOptions
|
|
3626
|
+
* @see DataTable
|
|
3627
|
+
* @see DataTableContent
|
|
3628
|
+
*/
|
|
3629
|
+
const useDataTable = ({ columnPinning, columnSizing, columnVisibility, columns, data, filtering, getRowId, grouping, loading = false, pagination, selection, sorting, virtualization }) => {
|
|
3630
|
+
const [internalSorting, setInternalSorting] = useState(sorting?.mode === "client" ? sorting.initial ?? [] : []);
|
|
3631
|
+
const [internalPagination, setInternalPagination] = useState({
|
|
3632
|
+
pageIndex: 0,
|
|
3633
|
+
pageSize: pagination?.mode === "client" ? pagination.pageSize : DEFAULT_PAGE_SIZE
|
|
3634
|
+
});
|
|
3635
|
+
const [internalSelection, setInternalSelection] = useState(getInitialState({
|
|
3636
|
+
fallback: {},
|
|
3637
|
+
feature: selection
|
|
3638
|
+
}));
|
|
3639
|
+
const [internalVisibility, setInternalVisibility] = useState(getInitialState({
|
|
3640
|
+
fallback: {},
|
|
3641
|
+
feature: columnVisibility
|
|
3642
|
+
}));
|
|
3643
|
+
const [internalPinning, setInternalPinning] = useState(getInitialState({
|
|
3644
|
+
fallback: { left: [] },
|
|
3645
|
+
feature: columnPinning
|
|
3646
|
+
}));
|
|
3647
|
+
const [internalSizing, setInternalSizing] = useState(getInitialState({
|
|
3648
|
+
fallback: {},
|
|
3649
|
+
feature: columnSizing
|
|
3650
|
+
}));
|
|
3651
|
+
const [expandedGroups, setExpandedGroups] = useState(true);
|
|
3652
|
+
const [internalGrouping, setInternalGrouping] = useState(getInitialState({
|
|
3653
|
+
fallback: [],
|
|
3654
|
+
feature: grouping
|
|
3655
|
+
}));
|
|
3656
|
+
const tableColumns = useMemo(() => withColumnFilters(columns), [columns]);
|
|
3657
|
+
const isClientPagination = pagination?.mode === "client";
|
|
3658
|
+
const handleClientSortingChange = (updater) => {
|
|
3659
|
+
setInternalSorting(updater);
|
|
3660
|
+
if (isClientPagination) setInternalPagination((old) => ({
|
|
3661
|
+
...old,
|
|
3662
|
+
pageIndex: 0
|
|
3663
|
+
}));
|
|
3664
|
+
};
|
|
3665
|
+
const { filterState, handleColumnFiltersChange, handleGlobalFilterChange } = useFilterState({
|
|
3666
|
+
filtering,
|
|
3667
|
+
onFiltersChange: () => {
|
|
3668
|
+
if (isClientPagination) setInternalPagination((old) => ({
|
|
3669
|
+
...old,
|
|
3670
|
+
pageIndex: 0
|
|
3671
|
+
}));
|
|
3672
|
+
}
|
|
3673
|
+
});
|
|
3674
|
+
const sortingState = sorting?.mode === "manual" ? toTableFeatureState(sorting) : {
|
|
3675
|
+
onChange: handleClientSortingChange,
|
|
3676
|
+
state: internalSorting
|
|
3677
|
+
};
|
|
3678
|
+
const paginationState = pagination?.mode === "manual" ? toTableFeatureState(pagination) : {
|
|
3679
|
+
onChange: setInternalPagination,
|
|
3680
|
+
state: internalPagination
|
|
3681
|
+
};
|
|
3682
|
+
const selectionState = resolveFeatureState({
|
|
3683
|
+
feature: selection,
|
|
3684
|
+
internal: internalSelection,
|
|
3685
|
+
setInternal: setInternalSelection
|
|
3686
|
+
});
|
|
3687
|
+
const visibilityState = resolveFeatureState({
|
|
3688
|
+
feature: columnVisibility,
|
|
3689
|
+
internal: internalVisibility,
|
|
3690
|
+
setInternal: setInternalVisibility
|
|
3691
|
+
});
|
|
3692
|
+
const pinningState = resolvePinningState({
|
|
3693
|
+
columnPinning,
|
|
3694
|
+
internal: internalPinning,
|
|
3695
|
+
setInternal: setInternalPinning
|
|
3696
|
+
});
|
|
3697
|
+
const sizingState = resolveFeatureState({
|
|
3698
|
+
feature: columnSizing,
|
|
3699
|
+
internal: internalSizing,
|
|
3700
|
+
setInternal: setInternalSizing
|
|
3701
|
+
});
|
|
3702
|
+
const groupingState = resolveFeatureState({
|
|
3703
|
+
feature: grouping,
|
|
3704
|
+
internal: internalGrouping,
|
|
3705
|
+
setInternal: setInternalGrouping
|
|
3706
|
+
});
|
|
3707
|
+
const table = useReactTable({
|
|
3708
|
+
autoResetExpanded: false,
|
|
3709
|
+
autoResetPageIndex: false,
|
|
3710
|
+
columnResizeMode: "onChange",
|
|
3711
|
+
columns: tableColumns,
|
|
3712
|
+
data,
|
|
3713
|
+
defaultColumn: DEFAULT_COLUMN,
|
|
3714
|
+
enableColumnFilters: filtering !== void 0,
|
|
3715
|
+
enableColumnPinning: columnPinning !== void 0,
|
|
3716
|
+
enableColumnResizing: columnSizing !== void 0,
|
|
3717
|
+
enableExpanding: grouping !== void 0,
|
|
3718
|
+
enableGlobalFilter: filtering !== void 0,
|
|
3719
|
+
enableGrouping: grouping !== void 0,
|
|
3720
|
+
enableRowSelection: selection === void 0 ? false : (row) => !row.getIsGrouped(),
|
|
3721
|
+
enableSorting: sorting !== void 0,
|
|
3722
|
+
getCoreRowModel: getCoreRowModel(),
|
|
3723
|
+
...getRowModels({
|
|
3724
|
+
filtering,
|
|
3725
|
+
grouping,
|
|
3726
|
+
pagination,
|
|
3727
|
+
sorting
|
|
3728
|
+
}),
|
|
3729
|
+
getRowId,
|
|
3730
|
+
groupedColumnMode: false,
|
|
3731
|
+
manualFiltering: filtering?.mode === "manual",
|
|
3732
|
+
manualPagination: pagination?.mode === "manual",
|
|
3733
|
+
manualSorting: sorting?.mode === "manual",
|
|
3734
|
+
onColumnFiltersChange: handleColumnFiltersChange,
|
|
3735
|
+
onColumnPinningChange: pinningState.onChange,
|
|
3736
|
+
onColumnSizingChange: sizingState.onChange,
|
|
3737
|
+
onColumnVisibilityChange: visibilityState.onChange,
|
|
3738
|
+
onExpandedChange: setExpandedGroups,
|
|
3739
|
+
onGlobalFilterChange: handleGlobalFilterChange,
|
|
3740
|
+
onGroupingChange: groupingState.onChange,
|
|
3741
|
+
onPaginationChange: paginationState.onChange,
|
|
3742
|
+
onRowSelectionChange: selectionState.onChange,
|
|
3743
|
+
onSortingChange: sortingState.onChange,
|
|
3744
|
+
rowCount: pagination?.mode === "manual" ? pagination.rowCount : void 0,
|
|
3745
|
+
state: {
|
|
3746
|
+
columnFilters: filterState.columnFilters,
|
|
3747
|
+
columnPinning: pinningState.state,
|
|
3748
|
+
columnSizing: sizingState.state,
|
|
3749
|
+
columnVisibility: visibilityState.state,
|
|
3750
|
+
expanded: expandedGroups,
|
|
3751
|
+
globalFilter: filterState.globalFilter,
|
|
3752
|
+
grouping: groupingState.state,
|
|
3753
|
+
pagination: paginationState.state,
|
|
3754
|
+
rowSelection: selectionState.state,
|
|
3755
|
+
sorting: sortingState.state
|
|
3756
|
+
}
|
|
3757
|
+
});
|
|
3758
|
+
useClampedPageIndex({
|
|
3759
|
+
isClientPagination,
|
|
3760
|
+
pageIndex: paginationState.state.pageIndex,
|
|
3761
|
+
table
|
|
3762
|
+
});
|
|
3763
|
+
return {
|
|
3764
|
+
loading,
|
|
3765
|
+
table,
|
|
3766
|
+
virtualization
|
|
3767
|
+
};
|
|
3768
|
+
};
|
|
3769
|
+
|
|
2448
3770
|
//#endregion
|
|
2449
3771
|
//#region src/components/ui/tabs/tabs.tsx
|
|
2450
3772
|
const Tabs = ({ className, orientation = "horizontal", ...props }) => {
|
|
@@ -2464,14 +3786,14 @@ const tabsListVariants = cva("rounded-lg p-[3px] group-data-[orientation=horizon
|
|
|
2464
3786
|
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"
|
|
2465
3787
|
} }
|
|
2466
3788
|
});
|
|
2467
|
-
const TabsList = ({ className, variant = "default", ...props }) => {
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
3789
|
+
const TabsList = forwardRef(({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
3790
|
+
ref,
|
|
3791
|
+
"data-slot": "tabs-list",
|
|
3792
|
+
"data-variant": variant,
|
|
3793
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
3794
|
+
...props
|
|
3795
|
+
}));
|
|
3796
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
2475
3797
|
const TabsTrigger = ({ className, ...props }) => {
|
|
2476
3798
|
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, {
|
|
2477
3799
|
"data-slot": "tabs-trigger",
|
|
@@ -2633,11 +3955,23 @@ const Textarea = ({ className, ...props }) => {
|
|
|
2633
3955
|
const TooltipProvider = Provider;
|
|
2634
3956
|
const Tooltip = Root$6;
|
|
2635
3957
|
const TooltipTrigger = Trigger$5;
|
|
2636
|
-
const TooltipContent = forwardRef(({ className, sideOffset =
|
|
3958
|
+
const TooltipContent = forwardRef(({ children, className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Portal$4, { children: /* @__PURE__ */ jsxs(Content$5, {
|
|
2637
3959
|
ref,
|
|
3960
|
+
"data-slot": "tooltip-content",
|
|
2638
3961
|
sideOffset,
|
|
2639
|
-
className: cn("z-50 max-w-xs
|
|
2640
|
-
...props
|
|
3962
|
+
className: 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),
|
|
3963
|
+
...props,
|
|
3964
|
+
children: [children, /* @__PURE__ */ jsx(Arrow, {
|
|
3965
|
+
asChild: true,
|
|
3966
|
+
height: 5,
|
|
3967
|
+
width: 10,
|
|
3968
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
3969
|
+
"aria-hidden": "true",
|
|
3970
|
+
className: "-translate-y-px fill-[var(--tooltip-bg)]",
|
|
3971
|
+
viewBox: "0 0 10 5",
|
|
3972
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0H10L5.88 4.12a1.25 1.25 0 0 1-1.76 0Z" })
|
|
3973
|
+
})
|
|
3974
|
+
})]
|
|
2641
3975
|
}) }));
|
|
2642
3976
|
TooltipContent.displayName = Content$5.displayName;
|
|
2643
3977
|
|
|
@@ -3076,32 +4410,6 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
|
|
|
3076
4410
|
});
|
|
3077
4411
|
};
|
|
3078
4412
|
|
|
3079
|
-
//#endregion
|
|
3080
|
-
//#region src/components/empty-state/empty-state.tsx
|
|
3081
|
-
const EmptyState = ({ icon: Icon$2, title, description, action, className }) => {
|
|
3082
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3083
|
-
className: cn("flex flex-col items-center justify-center py-16 px-8 text-center", className),
|
|
3084
|
-
children: [
|
|
3085
|
-
/* @__PURE__ */ jsx("div", {
|
|
3086
|
-
className: "flex size-12 items-center justify-center rounded-xl bg-muted mb-4",
|
|
3087
|
-
children: /* @__PURE__ */ jsx(Icon$2, { className: "size-6 text-muted-foreground" })
|
|
3088
|
-
}),
|
|
3089
|
-
/* @__PURE__ */ jsx("h3", {
|
|
3090
|
-
className: "text-sm font-semibold",
|
|
3091
|
-
children: title
|
|
3092
|
-
}),
|
|
3093
|
-
/* @__PURE__ */ jsx("p", {
|
|
3094
|
-
className: "text-sm text-muted-foreground mt-1 max-w-sm",
|
|
3095
|
-
children: description
|
|
3096
|
-
}),
|
|
3097
|
-
action && /* @__PURE__ */ jsx("div", {
|
|
3098
|
-
className: "mt-4",
|
|
3099
|
-
children: action
|
|
3100
|
-
})
|
|
3101
|
-
]
|
|
3102
|
-
});
|
|
3103
|
-
};
|
|
3104
|
-
|
|
3105
4413
|
//#endregion
|
|
3106
4414
|
//#region src/components/info-banner/info-banner.tsx
|
|
3107
4415
|
const spring$1 = {
|
|
@@ -3393,47 +4701,40 @@ const SettingsSection = ({ title, description, children, variant = "default", cl
|
|
|
3393
4701
|
//#region src/components/status-badge/status-badge.tsx
|
|
3394
4702
|
const statusConfig = {
|
|
3395
4703
|
active: {
|
|
3396
|
-
dot: true,
|
|
3397
4704
|
label: "Active",
|
|
3398
4705
|
variant: "success"
|
|
3399
4706
|
},
|
|
3400
4707
|
blocked: {
|
|
3401
|
-
dot: true,
|
|
3402
4708
|
label: "Blocked",
|
|
3403
4709
|
variant: "danger"
|
|
3404
4710
|
},
|
|
3405
4711
|
inactive: {
|
|
3406
|
-
dot: true,
|
|
3407
4712
|
label: "Inactive",
|
|
3408
4713
|
variant: "inactive"
|
|
3409
4714
|
},
|
|
3410
4715
|
live: {
|
|
3411
|
-
dot: true,
|
|
3412
4716
|
label: "Live",
|
|
3413
4717
|
variant: "success"
|
|
3414
4718
|
},
|
|
3415
4719
|
pending: {
|
|
3416
|
-
dot: true,
|
|
3417
4720
|
label: "Pending",
|
|
3418
4721
|
variant: "warning"
|
|
3419
4722
|
},
|
|
3420
4723
|
processing: {
|
|
3421
|
-
dot: true,
|
|
3422
4724
|
label: "Processing",
|
|
3423
4725
|
variant: "process"
|
|
3424
4726
|
},
|
|
3425
4727
|
sandbox: {
|
|
3426
|
-
dot: true,
|
|
3427
4728
|
label: "Sandbox",
|
|
3428
4729
|
variant: "warning"
|
|
3429
4730
|
}
|
|
3430
4731
|
};
|
|
3431
4732
|
const StatusBadge = ({ status, label, className }) => {
|
|
3432
4733
|
const config = statusConfig[status];
|
|
3433
|
-
return /* @__PURE__ */
|
|
4734
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
3434
4735
|
variant: config.variant,
|
|
3435
|
-
className
|
|
3436
|
-
children:
|
|
4736
|
+
className,
|
|
4737
|
+
children: label || config.label
|
|
3437
4738
|
});
|
|
3438
4739
|
};
|
|
3439
4740
|
|
|
@@ -3467,8 +4768,24 @@ const StatusBadge = ({ status, label, className }) => {
|
|
|
3467
4768
|
const TabNavigation = ({ children, defaultValue, items, listLabel, onValueChange, value, ...props }) => {
|
|
3468
4769
|
const [internalValue, setInternalValue] = useState(defaultValue ?? items.find((item) => !item.disabled)?.value);
|
|
3469
4770
|
const selectedValue = value ?? internalValue;
|
|
3470
|
-
const indicatorId = useId();
|
|
3471
4771
|
const shouldReduceMotion = useReducedMotion();
|
|
4772
|
+
const listRef = useRef(null);
|
|
4773
|
+
const [indicator, setIndicator] = useState();
|
|
4774
|
+
useLayoutEffect(() => {
|
|
4775
|
+
const list = listRef.current;
|
|
4776
|
+
if (!list) return;
|
|
4777
|
+
const measure = () => {
|
|
4778
|
+
const active = list.querySelector("[data-slot=\"tabs-trigger\"][data-state=\"active\"]");
|
|
4779
|
+
setIndicator(active ? {
|
|
4780
|
+
left: active.offsetLeft,
|
|
4781
|
+
width: active.offsetWidth
|
|
4782
|
+
} : void 0);
|
|
4783
|
+
};
|
|
4784
|
+
measure();
|
|
4785
|
+
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(measure);
|
|
4786
|
+
list.querySelectorAll("[data-slot=\"tabs-trigger\"]").forEach((trigger) => observer?.observe(trigger));
|
|
4787
|
+
return () => observer?.disconnect();
|
|
4788
|
+
}, [selectedValue, items]);
|
|
3472
4789
|
const [prevItems, setPrevItems] = useState(items);
|
|
3473
4790
|
if (prevItems !== items) {
|
|
3474
4791
|
setPrevItems(items);
|
|
@@ -3481,27 +4798,33 @@ const TabNavigation = ({ children, defaultValue, items, listLabel, onValueChange
|
|
|
3481
4798
|
setInternalValue(nextValue);
|
|
3482
4799
|
onValueChange?.(nextValue);
|
|
3483
4800
|
},
|
|
3484
|
-
children: [/* @__PURE__ */
|
|
4801
|
+
children: [/* @__PURE__ */ jsxs(TabsList, {
|
|
3485
4802
|
variant: "navigation",
|
|
3486
4803
|
"aria-label": listLabel,
|
|
3487
|
-
|
|
4804
|
+
ref: listRef,
|
|
4805
|
+
className: "relative",
|
|
4806
|
+
children: [items.map(({ disabled, label, value: value$1 }) => /* @__PURE__ */ jsx(TabsTrigger, {
|
|
3488
4807
|
value: value$1,
|
|
3489
4808
|
disabled,
|
|
3490
|
-
children:
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
4809
|
+
children: label
|
|
4810
|
+
}, value$1)), indicator && /* @__PURE__ */ jsx(motion.span, {
|
|
4811
|
+
"aria-hidden": "true",
|
|
4812
|
+
className: "pointer-events-none absolute left-0 -bottom-px h-px bg-(--action)",
|
|
4813
|
+
initial: false,
|
|
4814
|
+
animate: {
|
|
4815
|
+
width: indicator.width,
|
|
4816
|
+
x: indicator.left
|
|
4817
|
+
},
|
|
4818
|
+
transition: shouldReduceMotion ? { duration: 0 } : {
|
|
4819
|
+
duration: .2,
|
|
4820
|
+
ease: [
|
|
4821
|
+
.645,
|
|
4822
|
+
.045,
|
|
4823
|
+
.355,
|
|
4824
|
+
1
|
|
4825
|
+
]
|
|
4826
|
+
}
|
|
4827
|
+
})]
|
|
3505
4828
|
}), children]
|
|
3506
4829
|
});
|
|
3507
4830
|
};
|
|
@@ -5276,5 +6599,5 @@ const UsersIcon = forwardRef((props, ref) => /* @__PURE__ */ jsx(AnimatedIcon, {
|
|
|
5276
6599
|
UsersIcon.displayName = "UsersIcon";
|
|
5277
6600
|
|
|
5278
6601
|
//#endregion
|
|
5279
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AnimatedIcon, ArrowUpRightIcon, AskAIAction, AssetIcon, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartBarIncreasingIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ClaudeLogo, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyButton, CopyCheckIcon, CopyIcon, CursorLogo, CursorPagination, DangerZone, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DollarSignIcon, DomainList, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FingerprintIcon, FlushCardStack, HomeIcon, Icon, IconConfigProvider, InfoBanner, Input, Kbd, KeyIcon, Label, LayoutPanelTopIcon, LinkIcon, MetricCard, MoonIcon, OpenAILogo, PageHeader, PageSkeleton, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelLeftCloseIcon, PanelLeftOpenIcon, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductPageLayout, Progress, Radio, RadioField, RadioGroup, RadioGroupItem, RefreshCWIcon, ScrollArea, ScrollBar, SearchIcon, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCard, Separator, SettingsIcon, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShieldCheckIcon, Skeleton, Slider, Spinner, StatCardSkeleton, StatusBadge, Stepper, SunIcon, Switch, TabNavigation, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TerminalIcon, Textarea, Toaster, ToggleCard, ToggleGroup, ToggleGroupItem, ToggleRow, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UnsavedChangesBar, UsersIcon, VSCodeLogo, WebhooksAction, Well, WellReveal, WindsurfLogo, badgeVariants, buttonVariants, cn, toast, useIconConfig, useUnsavedChanges, wellVariants };
|
|
6602
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AnimatedIcon, ArrowUpRightIcon, AskAIAction, AssetIcon, Avatar, AvatarBadge, AvatarFallback, AvatarGroup, AvatarGroupCount, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartBarIncreasingIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ClaudeLogo, CodeBlock, Collapsible, CollapsibleContent, CollapsibleTrigger, Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyButton, CopyCheckIcon, CopyIcon, CursorLogo, CursorPagination, DangerZone, DataTable, DataTableActiveFilters, DataTableColumnFilter, DataTableColumnVisibility, DataTableContent, DataTablePagination, DataTableSearch, DataTableToolbar, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DollarSignIcon, DomainList, DownloadIcon, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, Field, FingerprintIcon, FlushCardStack, HomeIcon, Icon, IconConfigProvider, InfoBanner, Input, Kbd, KeyIcon, Label, LayoutPanelTopIcon, LinkIcon, MetricCard, MoonIcon, OpenAILogo, PageHeader, PageSkeleton, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PanelLeftCloseIcon, PanelLeftOpenIcon, PlusIcon, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProductPageLayout, Progress, Radio, RadioField, RadioGroup, RadioGroupItem, RefreshCWIcon, SELECTION_COLUMN_ID, ScrollArea, ScrollBar, SearchIcon, SearchInput, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectableCard, Separator, SettingsIcon, SettingsSection, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, ShieldCheckIcon, Skeleton, Slider, Spinner, StatCardSkeleton, StatusBadge, Stepper, SunIcon, Switch, TabNavigation, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TerminalIcon, Textarea, Toaster, ToggleCard, ToggleGroup, ToggleGroupItem, ToggleRow, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, UnsavedChangesBar, UsersIcon, VSCodeLogo, WebhooksAction, Well, WellReveal, WindsurfLogo, badgeVariants, buttonVariants, cn, createColumnHelper, selectionColumn, toast, useDataTable, useIconConfig, useUnsavedChanges, wellVariants };
|
|
5280
6603
|
//# sourceMappingURL=index.esm.js.map
|