@dynamic-labs-sdk/droplet 1.49.1 → 1.51.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/copy-button/copy-button.d.ts +3 -1
- package/dist/components/copy-button/copy-button.d.ts.map +1 -1
- package/dist/components/copy-button/copy-button.stories.d.ts +1 -1
- 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/migration/field/field.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/toggle-card/toggle-card.d.ts +10 -0
- package/dist/components/toggle-card/toggle-card.d.ts.map +1 -1
- package/dist/components/toggle-card/toggle-card.stories.d.ts +5 -0
- package/dist/components/toggle-card/toggle-card.stories.d.ts.map +1 -1
- package/dist/components/toggle-row/toggle-row.d.ts +22 -1
- package/dist/components/toggle-row/toggle-row.d.ts.map +1 -1
- package/dist/components/toggle-row/toggle-row.stories.d.ts +10 -6
- package/dist/components/toggle-row/toggle-row.stories.d.ts.map +1 -1
- package/dist/components/ui/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +54 -12
- package/dist/components/ui/combobox/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox/combobox.stories.d.ts +12 -1
- package/dist/components/ui/combobox/combobox.stories.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/field/field-control-context.d.ts +20 -0
- package/dist/components/ui/field/field-control-context.d.ts.map +1 -0
- package/dist/components/ui/field/field.d.ts +20 -4
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.stories.d.ts +18 -6
- package/dist/components/ui/field/field.stories.d.ts.map +1 -1
- package/dist/components/ui/label/label.d.ts +15 -0
- package/dist/components/ui/label/label.d.ts.map +1 -1
- 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/select/select.d.ts.map +1 -1
- package/dist/components/ui/select/select.stories.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 +1722 -247
- 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 +1714 -251
- package/dist/index.esm.js.map +1 -1
- package/dist/migration.cjs +1 -1
- package/dist/migration.cjs.map +1 -1
- package/dist/migration.esm.js +1 -1
- package/dist/migration.esm.js.map +1 -1
- package/dist/{toggle-row-PqelNVXI.esm.js → toggle-row-CeiCy3Aa.esm.js} +33 -8
- package/dist/toggle-row-CeiCy3Aa.esm.js.map +1 -0
- package/dist/{toggle-row-BBTk7_bT.cjs → toggle-row-DcV81G3w.cjs} +33 -8
- package/dist/toggle-row-DcV81G3w.cjs.map +1 -0
- package/package.json +3 -1
- package/src/styles/globals.css +54 -15
- package/dist/toggle-row-BBTk7_bT.cjs.map +0 -1
- package/dist/toggle-row-PqelNVXI.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
2
|
-
import { Children, Fragment, cloneElement, createContext, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
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-CeiCy3Aa.esm.js";
|
|
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";
|
|
@@ -18,14 +18,16 @@ import { Close, Content as Content$2, Description as Description$1, Overlay as O
|
|
|
18
18
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
19
19
|
import { CheckboxItem, Content as Content$3, Group, Item as Item$1, ItemIndicator, Label as Label$1, Portal as Portal$2, RadioGroup as RadioGroup$1, RadioItem, Root as Root$3, Separator as Separator$1, Sub, SubContent, SubTrigger, Trigger as Trigger$3 } from "@radix-ui/react-dropdown-menu";
|
|
20
20
|
import { CheckIcon as CheckIcon$1, ChevronRightIcon as ChevronRightIcon$1, CircleIcon } from "lucide-react";
|
|
21
|
+
import { Content as Content$4, Group as Group$1, Icon as Icon$1, Item as Item$2, ItemIndicator as ItemIndicator$1, ItemText, Label as Label$2, Portal as Portal$3, Root as Root$4, ScrollDownButton, ScrollUpButton, Separator as Separator$2, Trigger as Trigger$4, Value, Viewport } from "@radix-ui/react-select";
|
|
21
22
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
22
23
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
23
|
-
import { Content as Content$4, Group as Group$1, Icon as Icon$1, Item as Item$2, ItemIndicator as ItemIndicator$1, ItemText, Label as Label$2, Portal as Portal$3, Root as Root$4, ScrollDownButton, ScrollUpButton, Separator as Separator$2, Trigger as Trigger$4, Value, Viewport } from "@radix-ui/react-select";
|
|
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
|
|
@@ -831,7 +833,8 @@ const Checkbox = ({ className, ...props }) => {
|
|
|
831
833
|
className: "relative grid place-content-center text-current size-full",
|
|
832
834
|
forceMount: true,
|
|
833
835
|
children: [/* @__PURE__ */ jsx("svg", {
|
|
834
|
-
|
|
836
|
+
"aria-hidden": "true",
|
|
837
|
+
className: "size-3.5 text-current absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=indeterminate]:opacity-100 group-data-[state=indeterminate]:scale-100 group-data-[state=indeterminate]:blur-none",
|
|
835
838
|
viewBox: "0 0 24 24",
|
|
836
839
|
fill: "none",
|
|
837
840
|
stroke: "currentColor",
|
|
@@ -843,7 +846,8 @@ const Checkbox = ({ className, ...props }) => {
|
|
|
843
846
|
strokeWidth: 3
|
|
844
847
|
})
|
|
845
848
|
}), /* @__PURE__ */ jsx("svg", {
|
|
846
|
-
|
|
849
|
+
"aria-hidden": "true",
|
|
850
|
+
className: "size-3.5 text-current absolute inset-0 m-auto transition-[opacity,transform,filter] duration-200 motion-reduce:transition-none opacity-0 scale-[0.25] blur-[4px] group-data-[state=checked]:opacity-100 group-data-[state=checked]:scale-100 group-data-[state=checked]:blur-none",
|
|
847
851
|
viewBox: "0 0 24 24",
|
|
848
852
|
fill: "none",
|
|
849
853
|
stroke: "currentColor",
|
|
@@ -1075,13 +1079,37 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ jsx(PopoverPrimitive.Anc
|
|
|
1075
1079
|
|
|
1076
1080
|
//#endregion
|
|
1077
1081
|
//#region src/components/ui/combobox/combobox.tsx
|
|
1082
|
+
/** cmdk value of the select-all row; never matches a real option. */
|
|
1083
|
+
const SELECT_ALL_VALUE = "__droplet-combobox-select-all__";
|
|
1084
|
+
/**
|
|
1085
|
+
* Decorative `Checkbox` inside a multi-select option. The option row is the
|
|
1086
|
+
* control: it owns focus, the click target and the checked state for
|
|
1087
|
+
* assistive tech, so the checkbox is hidden from them and ignores pointer
|
|
1088
|
+
* events to avoid a second tab stop or a second announcement.
|
|
1089
|
+
*/
|
|
1090
|
+
const OptionCheckbox = ({ checked }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
1091
|
+
checked,
|
|
1092
|
+
"aria-hidden": true,
|
|
1093
|
+
tabIndex: -1,
|
|
1094
|
+
className: "pointer-events-none after:hidden in-data-[selected=true]:data-[state=unchecked]:shadow-[var(--shadow-control-hover)]"
|
|
1095
|
+
});
|
|
1096
|
+
/** Checkbox state of the select-all row: indeterminate while only some are selected. */
|
|
1097
|
+
const getSelectAllState = ({ selectedCount, totalCount }) => {
|
|
1098
|
+
if (selectedCount === 0) return false;
|
|
1099
|
+
if (selectedCount === totalCount) return true;
|
|
1100
|
+
return "indeterminate";
|
|
1101
|
+
};
|
|
1078
1102
|
/**
|
|
1079
|
-
* Searchable single-select
|
|
1103
|
+
* Searchable Combobox, single-select by default or multi-select with `multiple`.
|
|
1104
|
+
*
|
|
1105
|
+
* Composes `Popover`, `Command` and `Checkbox` from the droplet design system.
|
|
1106
|
+
* The trigger is styled like `SelectTrigger` with a rotating chevron that
|
|
1107
|
+
* signals open/closed state.
|
|
1080
1108
|
*
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1109
|
+
* - Single-select: picking an item closes the popover, fires `onValueChange`
|
|
1110
|
+
* and shows a check mark next to the active selection.
|
|
1111
|
+
* - Multi-select: each option shows a `Checkbox`, picking an item toggles it
|
|
1112
|
+
* and keeps the popover open, and the trigger lists the selected labels.
|
|
1085
1113
|
*
|
|
1086
1114
|
* @example
|
|
1087
1115
|
* ```tsx
|
|
@@ -1092,18 +1120,49 @@ const PopoverAnchor = ({ ...props }) => /* @__PURE__ */ jsx(PopoverPrimitive.Anc
|
|
|
1092
1120
|
* onValueChange={setChain}
|
|
1093
1121
|
* placeholder="Select a chain"
|
|
1094
1122
|
* />
|
|
1123
|
+
*
|
|
1124
|
+
* const [chains, setChains] = useState<string[]>([]);
|
|
1125
|
+
* <Combobox
|
|
1126
|
+
* multiple
|
|
1127
|
+
* options={[{ value: 'eth', label: 'Ethereum' }, { value: 'sol', label: 'Solana' }]}
|
|
1128
|
+
* value={chains}
|
|
1129
|
+
* onValueChange={setChains}
|
|
1130
|
+
* selectAllLabel="All chains"
|
|
1131
|
+
* />
|
|
1095
1132
|
* ```
|
|
1096
1133
|
*/
|
|
1097
|
-
const Combobox = (
|
|
1134
|
+
const Combobox = (props) => {
|
|
1135
|
+
const { options, placeholder = "Select…", searchPlaceholder = "Search…", emptyText = "No results.", className, disabled = false } = props;
|
|
1098
1136
|
const [open, setOpen] = useState(false);
|
|
1099
|
-
const
|
|
1137
|
+
const [search, setSearch] = useState("");
|
|
1138
|
+
const selectedValues = props.multiple ? props.value : [props.value];
|
|
1139
|
+
const selectedOptions = options.filter((opt) => selectedValues.includes(opt.value));
|
|
1140
|
+
const selectedLabels = selectedOptions.map((opt) => opt.label);
|
|
1141
|
+
const selectedLabel = props.multiple && props.formatSelected && selectedLabels.length > 0 ? props.formatSelected(selectedLabels) : selectedLabels.join(", ") || void 0;
|
|
1142
|
+
const selectAllState = getSelectAllState({
|
|
1143
|
+
selectedCount: selectedOptions.length,
|
|
1144
|
+
totalCount: options.length
|
|
1145
|
+
});
|
|
1146
|
+
const showSelectAll = props.multiple && props.selectAllLabel !== void 0 && search === "";
|
|
1100
1147
|
const handleSelect = (selectedValue) => {
|
|
1101
|
-
|
|
1102
|
-
|
|
1148
|
+
if (!props.multiple) {
|
|
1149
|
+
props.onValueChange(selectedValue);
|
|
1150
|
+
handleOpenChange(false);
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
props.onValueChange(props.value.includes(selectedValue) ? props.value.filter((v) => v !== selectedValue) : [...props.value, selectedValue]);
|
|
1154
|
+
};
|
|
1155
|
+
const handleSelectAll = () => {
|
|
1156
|
+
if (!props.multiple) return;
|
|
1157
|
+
props.onValueChange(selectAllState === true ? [] : options.map((opt) => opt.value));
|
|
1158
|
+
};
|
|
1159
|
+
const handleOpenChange = (nextOpen) => {
|
|
1160
|
+
setOpen(nextOpen);
|
|
1161
|
+
if (!nextOpen) setSearch("");
|
|
1103
1162
|
};
|
|
1104
1163
|
return /* @__PURE__ */ jsxs(Popover, {
|
|
1105
1164
|
open,
|
|
1106
|
-
onOpenChange:
|
|
1165
|
+
onOpenChange: handleOpenChange,
|
|
1107
1166
|
children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
1108
1167
|
asChild: true,
|
|
1109
1168
|
children: /* @__PURE__ */ jsxs("button", {
|
|
@@ -1128,12 +1187,32 @@ const Combobox = ({ options, value, onValueChange, placeholder = "Select…", se
|
|
|
1128
1187
|
sideOffset: 4,
|
|
1129
1188
|
children: /* @__PURE__ */ jsxs(Command, {
|
|
1130
1189
|
className: "rounded-[inherit]",
|
|
1131
|
-
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1190
|
+
children: [/* @__PURE__ */ jsx(CommandInput, {
|
|
1191
|
+
placeholder: searchPlaceholder,
|
|
1192
|
+
value: search,
|
|
1193
|
+
onValueChange: setSearch
|
|
1194
|
+
}), /* @__PURE__ */ jsxs(CommandList, {
|
|
1195
|
+
"aria-multiselectable": props.multiple || void 0,
|
|
1196
|
+
children: [
|
|
1197
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyText }),
|
|
1198
|
+
showSelectAll && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(CommandItem, {
|
|
1199
|
+
value: SELECT_ALL_VALUE,
|
|
1200
|
+
"aria-checked": selectAllState === "indeterminate" ? "mixed" : selectAllState,
|
|
1201
|
+
onSelect: handleSelectAll,
|
|
1202
|
+
children: [/* @__PURE__ */ jsx(OptionCheckbox, { checked: selectAllState }), props.selectAllLabel]
|
|
1203
|
+
}), /* @__PURE__ */ jsx(CommandSeparator, { className: "my-1" })] }),
|
|
1204
|
+
options.map((opt) => {
|
|
1205
|
+
const isSelected = selectedValues.includes(opt.value);
|
|
1206
|
+
return /* @__PURE__ */ jsxs(CommandItem, {
|
|
1207
|
+
value: opt.value,
|
|
1208
|
+
keywords: [opt.label],
|
|
1209
|
+
"aria-checked": props.multiple ? isSelected : void 0,
|
|
1210
|
+
onSelect: handleSelect,
|
|
1211
|
+
children: [props.multiple ? /* @__PURE__ */ jsx(OptionCheckbox, { checked: isSelected }) : /* @__PURE__ */ jsx(CheckIcon, { className: cn("shrink-0", isSelected ? "opacity-100" : "opacity-0") }), opt.label]
|
|
1212
|
+
}, opt.value);
|
|
1213
|
+
})
|
|
1214
|
+
]
|
|
1215
|
+
})]
|
|
1137
1216
|
})
|
|
1138
1217
|
})]
|
|
1139
1218
|
});
|
|
@@ -1387,9 +1466,114 @@ const Icon = (props) => {
|
|
|
1387
1466
|
});
|
|
1388
1467
|
};
|
|
1389
1468
|
|
|
1469
|
+
//#endregion
|
|
1470
|
+
//#region src/components/ui/field/field-control-context.ts
|
|
1471
|
+
/**
|
|
1472
|
+
* Carries a `Field`'s control attributes to a control that renders its focusable
|
|
1473
|
+
* element deeper than `Field`'s direct child.
|
|
1474
|
+
*
|
|
1475
|
+
* `Field` injects `id` and the `aria-*` attributes onto its direct child. That
|
|
1476
|
+
* works for `Input` and `Textarea`, but `Select` renders no element of its own,
|
|
1477
|
+
* so `SelectTrigger` reads them from here instead.
|
|
1478
|
+
*/
|
|
1479
|
+
const FieldControlContext = createContext(null);
|
|
1480
|
+
|
|
1481
|
+
//#endregion
|
|
1482
|
+
//#region src/components/ui/select/select.tsx
|
|
1483
|
+
const Select = ({ ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
1484
|
+
"data-slot": "select",
|
|
1485
|
+
...props
|
|
1486
|
+
});
|
|
1487
|
+
const SelectGroup = ({ ...props }) => /* @__PURE__ */ jsx(Group$1, {
|
|
1488
|
+
"data-slot": "select-group",
|
|
1489
|
+
...props
|
|
1490
|
+
});
|
|
1491
|
+
const SelectValue = ({ ...props }) => /* @__PURE__ */ jsx(Value, {
|
|
1492
|
+
"data-slot": "select-value",
|
|
1493
|
+
...props
|
|
1494
|
+
});
|
|
1495
|
+
const SelectTrigger = ({ className, size = "default", children, ...props }) => {
|
|
1496
|
+
const fieldControlProps = useContext(FieldControlContext);
|
|
1497
|
+
return /* @__PURE__ */ jsxs(Trigger$4, {
|
|
1498
|
+
...fieldControlProps,
|
|
1499
|
+
"data-slot": "select-trigger",
|
|
1500
|
+
"data-size": size,
|
|
1501
|
+
className: cn("data-[placeholder]:text-muted-foreground/60 [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit touch-manipulation items-center justify-between gap-1.5 rounded-md border-0 bg-transparent px-3 py-2 text-[13px] whitespace-nowrap shadow-[var(--shadow-input)] hover:shadow-[var(--shadow-input-hover)] transition-[color,box-shadow] duration-100 ease-out outline-none focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)] aria-invalid:shadow-[0_0_0_1px_var(--destructive)] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:text-[13px] data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:[&>svg:last-of-type]:rotate-180", className),
|
|
1502
|
+
...props,
|
|
1503
|
+
...fieldControlProps ? { id: fieldControlProps.id } : {},
|
|
1504
|
+
children: [children, /* @__PURE__ */ jsx(Icon$1, {
|
|
1505
|
+
asChild: true,
|
|
1506
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1507
|
+
icon: ArrowDown01Icon,
|
|
1508
|
+
size: 16,
|
|
1509
|
+
className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
|
|
1510
|
+
})
|
|
1511
|
+
})]
|
|
1512
|
+
});
|
|
1513
|
+
};
|
|
1514
|
+
const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ jsx(Portal$3, { children: /* @__PURE__ */ jsxs(Content$4, {
|
|
1515
|
+
"data-slot": "select-content",
|
|
1516
|
+
className: cn("bg-popover text-popover-foreground will-change-[opacity,transform] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-0 shadow-[var(--shadow-elevated)]", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
1517
|
+
position,
|
|
1518
|
+
align,
|
|
1519
|
+
...props,
|
|
1520
|
+
children: [
|
|
1521
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1522
|
+
/* @__PURE__ */ jsx(Viewport, {
|
|
1523
|
+
className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
1524
|
+
children
|
|
1525
|
+
}),
|
|
1526
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
1527
|
+
]
|
|
1528
|
+
}) });
|
|
1529
|
+
const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Label$2, {
|
|
1530
|
+
"data-slot": "select-label",
|
|
1531
|
+
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
1532
|
+
...props
|
|
1533
|
+
});
|
|
1534
|
+
const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Item$2, {
|
|
1535
|
+
"data-slot": "select-item",
|
|
1536
|
+
className: cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:font-medium [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
1537
|
+
...props,
|
|
1538
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1539
|
+
"data-slot": "select-item-indicator",
|
|
1540
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
1541
|
+
children: /* @__PURE__ */ jsx(ItemIndicator$1, { children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1542
|
+
icon: Tick01Icon,
|
|
1543
|
+
size: 14
|
|
1544
|
+
}) })
|
|
1545
|
+
}), /* @__PURE__ */ jsx(ItemText, { children })]
|
|
1546
|
+
});
|
|
1547
|
+
const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Separator$2, {
|
|
1548
|
+
"data-slot": "select-separator",
|
|
1549
|
+
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
1550
|
+
...props
|
|
1551
|
+
});
|
|
1552
|
+
const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollUpButton, {
|
|
1553
|
+
"data-slot": "select-scroll-up-button",
|
|
1554
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1555
|
+
...props,
|
|
1556
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1557
|
+
icon: ArrowUp01Icon,
|
|
1558
|
+
size: 16,
|
|
1559
|
+
"aria-hidden": true
|
|
1560
|
+
})
|
|
1561
|
+
});
|
|
1562
|
+
const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollDownButton, {
|
|
1563
|
+
"data-slot": "select-scroll-down-button",
|
|
1564
|
+
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1565
|
+
...props,
|
|
1566
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1567
|
+
icon: ArrowDown01Icon,
|
|
1568
|
+
size: 16,
|
|
1569
|
+
"aria-hidden": true
|
|
1570
|
+
})
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1390
1573
|
//#endregion
|
|
1391
1574
|
//#region src/components/ui/field/field.tsx
|
|
1392
|
-
const
|
|
1575
|
+
const FIELD_GAP_CLASS_NAME = "grid [--field-gap:6px] [--label-gap:10px] gap-[var(--field-gap)]";
|
|
1576
|
+
const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--label-gap)-var(--field-gap))]";
|
|
1393
1577
|
/**
|
|
1394
1578
|
* A generic labeled form-field wrapper.
|
|
1395
1579
|
*
|
|
@@ -1397,16 +1581,26 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
|
|
|
1397
1581
|
* an error message together with the correct `id`/`htmlFor`/`aria-describedby`
|
|
1398
1582
|
* associations so callers don't have to hand-assemble these.
|
|
1399
1583
|
*
|
|
1584
|
+
* Always wrap a form control in `Field` rather than pairing a bare `<Label>`
|
|
1585
|
+
* with it: `Field` owns the label-to-control gap (10px) and the gap to the
|
|
1586
|
+
* error (6px). Don't add helper text: the error is the only message under a
|
|
1587
|
+
* control.
|
|
1588
|
+
*
|
|
1400
1589
|
* When there is exactly one child element, `Field` uses `cloneElement` to
|
|
1401
1590
|
* inject:
|
|
1402
1591
|
* - `id` — links the label's `htmlFor` to the control
|
|
1592
|
+
* - `aria-labelledby` — names group controls such as `RadioGroup`, which a
|
|
1593
|
+
* `<label for>` cannot name
|
|
1403
1594
|
* - `aria-describedby` — references the description and/or error paragraph ids
|
|
1404
1595
|
* - `aria-invalid` — `true` when `error` is present
|
|
1405
1596
|
*
|
|
1597
|
+
* `Select` renders no element of its own, so `SelectTrigger` picks up `id`,
|
|
1598
|
+
* `aria-describedby` and `aria-invalid` from `Field` instead.
|
|
1599
|
+
*
|
|
1406
1600
|
* @example
|
|
1407
1601
|
* ```tsx
|
|
1408
|
-
* <Field label="Email"
|
|
1409
|
-
* <Input type="email" />
|
|
1602
|
+
* <Field label="Email" required>
|
|
1603
|
+
* <Input type="email" required />
|
|
1410
1604
|
* </Field>
|
|
1411
1605
|
*
|
|
1412
1606
|
* <Field label="Email" error="Enter a valid email address.">
|
|
@@ -1415,25 +1609,39 @@ const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-fi
|
|
|
1415
1609
|
* ```
|
|
1416
1610
|
*/
|
|
1417
1611
|
const Field = ({ label, description, error, required, htmlFor, children, className }) => {
|
|
1612
|
+
const childArray = Children.toArray(children);
|
|
1613
|
+
const singleChild = childArray.length === 1 && isValidElement(childArray[0]) ? childArray[0] : null;
|
|
1614
|
+
const childId = (singleChild?.props)?.id;
|
|
1418
1615
|
const generatedId = useId();
|
|
1419
|
-
const controlId = htmlFor ?? generatedId;
|
|
1616
|
+
const controlId = (typeof childId === "string" ? childId : void 0) ?? htmlFor ?? generatedId;
|
|
1420
1617
|
const descriptionId = `${controlId}-description`;
|
|
1421
1618
|
const errorId = `${controlId}-error`;
|
|
1422
|
-
const
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1619
|
+
const labelId = label ? `${controlId}-label` : void 0;
|
|
1620
|
+
const showDescription = Boolean(description) && !error;
|
|
1621
|
+
let ariaDescribedBy;
|
|
1622
|
+
if (error) ariaDescribedBy = errorId;
|
|
1623
|
+
else if (showDescription) ariaDescribedBy = descriptionId;
|
|
1624
|
+
const hasError = Boolean(error);
|
|
1625
|
+
const controlProps = useMemo(() => ({
|
|
1626
|
+
"aria-describedby": ariaDescribedBy,
|
|
1627
|
+
id: controlId,
|
|
1628
|
+
...hasError ? { "aria-invalid": true } : {}
|
|
1629
|
+
}), [
|
|
1630
|
+
ariaDescribedBy,
|
|
1631
|
+
controlId,
|
|
1632
|
+
hasError
|
|
1633
|
+
]);
|
|
1428
1634
|
const enrichedChild = singleChild ? cloneElement(singleChild, {
|
|
1429
1635
|
"aria-describedby": singleChild.props["aria-describedby"] ?? ariaDescribedBy,
|
|
1430
|
-
|
|
1636
|
+
"aria-labelledby": singleChild.props["aria-labelledby"] ?? labelId,
|
|
1637
|
+
id: controlId,
|
|
1431
1638
|
...error ? { "aria-invalid": true } : {}
|
|
1432
1639
|
}) : null;
|
|
1433
1640
|
return /* @__PURE__ */ jsxs("div", {
|
|
1434
|
-
className: cn(
|
|
1641
|
+
className: cn(FIELD_GAP_CLASS_NAME, className),
|
|
1435
1642
|
children: [
|
|
1436
1643
|
label && /* @__PURE__ */ jsxs(Label, {
|
|
1644
|
+
id: labelId,
|
|
1437
1645
|
htmlFor: controlId,
|
|
1438
1646
|
"data-slot": "field-label",
|
|
1439
1647
|
className: LABEL_GAP_CLASS_NAME,
|
|
@@ -1443,8 +1651,11 @@ const Field = ({ label, description, error, required, htmlFor, children, classNa
|
|
|
1443
1651
|
children: "*"
|
|
1444
1652
|
})]
|
|
1445
1653
|
}),
|
|
1446
|
-
|
|
1447
|
-
|
|
1654
|
+
/* @__PURE__ */ jsx(FieldControlContext.Provider, {
|
|
1655
|
+
value: singleChild?.type === Select ? controlProps : null,
|
|
1656
|
+
children: enrichedChild ?? children
|
|
1657
|
+
}),
|
|
1658
|
+
showDescription && /* @__PURE__ */ jsx("p", {
|
|
1448
1659
|
id: descriptionId,
|
|
1449
1660
|
className: "text-sm text-muted-foreground",
|
|
1450
1661
|
children: description
|
|
@@ -1686,7 +1897,7 @@ const PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs("sp
|
|
|
1686
1897
|
/**
|
|
1687
1898
|
* Pre-assembled cursor-based pagination bar.
|
|
1688
1899
|
*
|
|
1689
|
-
* Renders
|
|
1900
|
+
* Renders an optional label, such as a record range, followed by previous and next arrow buttons, aligned to the end.
|
|
1690
1901
|
* Each button is disabled automatically when there is no page in that direction.
|
|
1691
1902
|
* Designed for dashboard tables and lists that use cursor/keyset pagination rather
|
|
1692
1903
|
* than numbered pages — which is the dominant pattern in the Redcoast design system.
|
|
@@ -1702,39 +1913,41 @@ const PaginationEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs("sp
|
|
|
1702
1913
|
* />
|
|
1703
1914
|
* ```
|
|
1704
1915
|
*/
|
|
1705
|
-
const CursorPagination = ({ hasPrevious, hasNext, onPrevious, onNext, label, className }) => /* @__PURE__ */ jsxs("
|
|
1916
|
+
const CursorPagination = ({ hasPrevious, hasNext, onPrevious, onNext, label, className }) => /* @__PURE__ */ jsxs("nav", {
|
|
1917
|
+
"aria-label": "Pagination",
|
|
1706
1918
|
"data-slot": "cursor-pagination",
|
|
1707
|
-
className: cn("flex items-center justify-
|
|
1708
|
-
children: [
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1919
|
+
className: cn("flex items-center justify-end gap-3", className),
|
|
1920
|
+
children: [label !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
1921
|
+
className: "text-[13px] text-muted-foreground tabular-nums",
|
|
1922
|
+
children: label
|
|
1923
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1924
|
+
className: "flex items-center gap-2",
|
|
1925
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1926
|
+
variant: "outline",
|
|
1927
|
+
size: "icon-sm",
|
|
1928
|
+
className: "size-8 before:-inset-1",
|
|
1712
1929
|
disabled: !hasPrevious,
|
|
1713
1930
|
onClick: onPrevious,
|
|
1714
1931
|
"aria-label": "Go to previous page",
|
|
1715
|
-
children:
|
|
1932
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1716
1933
|
icon: ArrowLeft01Icon,
|
|
1717
|
-
size:
|
|
1934
|
+
size: 16,
|
|
1718
1935
|
"aria-hidden": "true"
|
|
1719
|
-
})
|
|
1720
|
-
}),
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}),
|
|
1725
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
1726
|
-
variant: "ghost",
|
|
1727
|
-
size: "sm",
|
|
1936
|
+
})
|
|
1937
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1938
|
+
variant: "outline",
|
|
1939
|
+
size: "icon-sm",
|
|
1940
|
+
className: "size-8 before:-inset-1",
|
|
1728
1941
|
disabled: !hasNext,
|
|
1729
1942
|
onClick: onNext,
|
|
1730
1943
|
"aria-label": "Go to next page",
|
|
1731
|
-
children:
|
|
1944
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1732
1945
|
icon: ArrowRight01Icon,
|
|
1733
|
-
size:
|
|
1946
|
+
size: 16,
|
|
1734
1947
|
"aria-hidden": "true"
|
|
1735
|
-
})
|
|
1736
|
-
})
|
|
1737
|
-
]
|
|
1948
|
+
})
|
|
1949
|
+
})]
|
|
1950
|
+
})]
|
|
1738
1951
|
});
|
|
1739
1952
|
|
|
1740
1953
|
//#endregion
|
|
@@ -1792,93 +2005,6 @@ const SearchInput = ({ className, placeholder = "Search...", shortcut = "⌘K",
|
|
|
1792
2005
|
});
|
|
1793
2006
|
};
|
|
1794
2007
|
|
|
1795
|
-
//#endregion
|
|
1796
|
-
//#region src/components/ui/select/select.tsx
|
|
1797
|
-
const Select = ({ ...props }) => /* @__PURE__ */ jsx(Root$4, {
|
|
1798
|
-
"data-slot": "select",
|
|
1799
|
-
...props
|
|
1800
|
-
});
|
|
1801
|
-
const SelectGroup = ({ ...props }) => /* @__PURE__ */ jsx(Group$1, {
|
|
1802
|
-
"data-slot": "select-group",
|
|
1803
|
-
...props
|
|
1804
|
-
});
|
|
1805
|
-
const SelectValue = ({ ...props }) => /* @__PURE__ */ jsx(Value, {
|
|
1806
|
-
"data-slot": "select-value",
|
|
1807
|
-
...props
|
|
1808
|
-
});
|
|
1809
|
-
const SelectTrigger = ({ className, size = "default", children, ...props }) => /* @__PURE__ */ jsxs(Trigger$4, {
|
|
1810
|
-
"data-slot": "select-trigger",
|
|
1811
|
-
"data-size": size,
|
|
1812
|
-
className: cn("data-[placeholder]:text-muted-foreground/60 [&_svg:not([class*='text-'])]:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 flex w-fit touch-manipulation items-center justify-between gap-1.5 rounded-md border-0 bg-transparent px-3 py-2 text-[13px] whitespace-nowrap shadow-[var(--shadow-input)] hover:shadow-[var(--shadow-input-hover)] transition-[color,box-shadow] duration-100 ease-out outline-none focus-visible:shadow-[0_0_0_1px_var(--ring),0_0_0_4px_var(--ring-halo,#0072EF26)] aria-invalid:shadow-[0_0_0_1px_var(--destructive)] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:text-[13px] data-[size=sm]:px-2.5 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:[&>svg:last-of-type]:rotate-180", className),
|
|
1813
|
-
...props,
|
|
1814
|
-
children: [children, /* @__PURE__ */ jsx(Icon$1, {
|
|
1815
|
-
asChild: true,
|
|
1816
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1817
|
-
icon: ArrowDown01Icon,
|
|
1818
|
-
size: 16,
|
|
1819
|
-
className: "opacity-50 transition-transform duration-150 ease-out motion-reduce:transition-none"
|
|
1820
|
-
})
|
|
1821
|
-
})]
|
|
1822
|
-
});
|
|
1823
|
-
const SelectContent = ({ className, children, position = "popper", align = "start", ...props }) => /* @__PURE__ */ jsx(Portal$3, { children: /* @__PURE__ */ jsxs(Content$4, {
|
|
1824
|
-
"data-slot": "select-content",
|
|
1825
|
-
className: cn("bg-popover text-popover-foreground will-change-[opacity,transform] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 motion-reduce:animate-none relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-xl border-0 shadow-[var(--shadow-elevated)]", position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", className),
|
|
1826
|
-
position,
|
|
1827
|
-
align,
|
|
1828
|
-
...props,
|
|
1829
|
-
children: [
|
|
1830
|
-
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
1831
|
-
/* @__PURE__ */ jsx(Viewport, {
|
|
1832
|
-
className: cn("p-1", position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
|
|
1833
|
-
children
|
|
1834
|
-
}),
|
|
1835
|
-
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
1836
|
-
]
|
|
1837
|
-
}) });
|
|
1838
|
-
const SelectLabel = ({ className, ...props }) => /* @__PURE__ */ jsx(Label$2, {
|
|
1839
|
-
"data-slot": "select-label",
|
|
1840
|
-
className: cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
1841
|
-
...props
|
|
1842
|
-
});
|
|
1843
|
-
const SelectItem = ({ className, children, ...props }) => /* @__PURE__ */ jsxs(Item$2, {
|
|
1844
|
-
"data-slot": "select-item",
|
|
1845
|
-
className: cn("data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[state=checked]:font-medium [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", className),
|
|
1846
|
-
...props,
|
|
1847
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1848
|
-
"data-slot": "select-item-indicator",
|
|
1849
|
-
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
1850
|
-
children: /* @__PURE__ */ jsx(ItemIndicator$1, { children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1851
|
-
icon: Tick01Icon,
|
|
1852
|
-
size: 14
|
|
1853
|
-
}) })
|
|
1854
|
-
}), /* @__PURE__ */ jsx(ItemText, { children })]
|
|
1855
|
-
});
|
|
1856
|
-
const SelectSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(Separator$2, {
|
|
1857
|
-
"data-slot": "select-separator",
|
|
1858
|
-
className: cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
1859
|
-
...props
|
|
1860
|
-
});
|
|
1861
|
-
const SelectScrollUpButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollUpButton, {
|
|
1862
|
-
"data-slot": "select-scroll-up-button",
|
|
1863
|
-
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1864
|
-
...props,
|
|
1865
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1866
|
-
icon: ArrowUp01Icon,
|
|
1867
|
-
size: 16,
|
|
1868
|
-
"aria-hidden": true
|
|
1869
|
-
})
|
|
1870
|
-
});
|
|
1871
|
-
const SelectScrollDownButton = ({ className, ...props }) => /* @__PURE__ */ jsx(ScrollDownButton, {
|
|
1872
|
-
"data-slot": "select-scroll-down-button",
|
|
1873
|
-
className: cn("flex cursor-default items-center justify-center py-1", className),
|
|
1874
|
-
...props,
|
|
1875
|
-
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
1876
|
-
icon: ArrowDown01Icon,
|
|
1877
|
-
size: 16,
|
|
1878
|
-
"aria-hidden": true
|
|
1879
|
-
})
|
|
1880
|
-
});
|
|
1881
|
-
|
|
1882
2008
|
//#endregion
|
|
1883
2009
|
//#region src/components/ui/selectable-card/selectable-card.tsx
|
|
1884
2010
|
const SelectableCard = ({ badge, className, description, icon, iconSize = 20, label, selected, ...props }) => /* @__PURE__ */ jsxs("button", {
|
|
@@ -2169,6 +2295,13 @@ const Stepper = ({ steps, currentStep, className, ...props }) => /* @__PURE__ */
|
|
|
2169
2295
|
const SCROLLBAR_INSET = 8;
|
|
2170
2296
|
/** A wider drag target lets the visible thumb stay visually quiet. */
|
|
2171
2297
|
const SCROLLBAR_HIT_AREA = 12;
|
|
2298
|
+
/** Point several refs, function or object, at the same element. */
|
|
2299
|
+
const mergeRefs = (...refs) => (node) => {
|
|
2300
|
+
refs.forEach((ref) => {
|
|
2301
|
+
if (typeof ref === "function") ref(node);
|
|
2302
|
+
else if (ref) ref.current = node;
|
|
2303
|
+
});
|
|
2304
|
+
};
|
|
2172
2305
|
/** Collect a row group's leading cells, skipping rows covered by an earlier rowSpan. */
|
|
2173
2306
|
const collectSectionPinnedCells = ({ pinnedCells, section }) => {
|
|
2174
2307
|
let occupiedRows = 0;
|
|
@@ -2202,8 +2335,9 @@ const measureShelfTop = ({ scrollArea, table }) => {
|
|
|
2202
2335
|
return body ? body.getBoundingClientRect().top - scrollArea.getBoundingClientRect().top + scrollArea.scrollTop : 0;
|
|
2203
2336
|
};
|
|
2204
2337
|
/** Render a table in a stable tray with keyboard access only when content overflows. */
|
|
2205
|
-
const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...props }) => {
|
|
2338
|
+
const Table = ({ className, fill = false, scrollAreaProps = {}, stickyFirstColumn = false, viewportRef, ...props }) => {
|
|
2206
2339
|
const scrollAreaRef = useRef(null);
|
|
2340
|
+
const setViewportRef = useMemo(() => mergeRefs(scrollAreaRef, viewportRef), [viewportRef]);
|
|
2207
2341
|
const [overflow, setOverflow] = useState({
|
|
2208
2342
|
horizontal: false,
|
|
2209
2343
|
vertical: false
|
|
@@ -2308,8 +2442,9 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2308
2442
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2309
2443
|
"data-slot": "table-container",
|
|
2310
2444
|
"data-tray": "header",
|
|
2445
|
+
"data-fill": fill || void 0,
|
|
2311
2446
|
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)]",
|
|
2447
|
+
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
2448
|
children: [
|
|
2314
2449
|
/* @__PURE__ */ jsx("div", {
|
|
2315
2450
|
"aria-hidden": "true",
|
|
@@ -2319,7 +2454,7 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2319
2454
|
}),
|
|
2320
2455
|
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, {
|
|
2321
2456
|
...viewportProps,
|
|
2322
|
-
ref:
|
|
2457
|
+
ref: setViewportRef,
|
|
2323
2458
|
"data-slot": "table-scroll-area",
|
|
2324
2459
|
"data-caption-top": topCaptionHeight > 0,
|
|
2325
2460
|
"data-native-scrollbars": useNativeScrollbars,
|
|
@@ -2334,7 +2469,7 @@ const Table = ({ className, scrollAreaProps = {}, stickyFirstColumn = false, ...
|
|
|
2334
2469
|
scrollPaddingTop: headerHeight + topCaptionHeight,
|
|
2335
2470
|
...scrollAreaStyle
|
|
2336
2471
|
},
|
|
2337
|
-
className: cn("relative min-w-0 overflow-auto overscroll-
|
|
2472
|
+
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
2473
|
children: /* @__PURE__ */ jsx("table", {
|
|
2339
2474
|
"data-slot": "table",
|
|
2340
2475
|
"data-sticky-first-column": stickyFirstColumn || void 0,
|
|
@@ -2415,13 +2550,13 @@ const TableFooter = ({ className, ...props }) => {
|
|
|
2415
2550
|
...props
|
|
2416
2551
|
});
|
|
2417
2552
|
};
|
|
2418
|
-
const TableRow = ({ className, ...props }) => {
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2553
|
+
const TableRow = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("tr", {
|
|
2554
|
+
ref,
|
|
2555
|
+
"data-slot": "table-row",
|
|
2556
|
+
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),
|
|
2557
|
+
...props
|
|
2558
|
+
}));
|
|
2559
|
+
TableRow.displayName = "TableRow";
|
|
2425
2560
|
const TableHead = ({ className, scope, ...props }) => {
|
|
2426
2561
|
return /* @__PURE__ */ jsx("th", {
|
|
2427
2562
|
"data-slot": "table-head",
|
|
@@ -2446,17 +2581,1326 @@ const TableCaption = ({ className, ...props }) => {
|
|
|
2446
2581
|
};
|
|
2447
2582
|
|
|
2448
2583
|
//#endregion
|
|
2449
|
-
//#region src/components/ui/
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2584
|
+
//#region src/components/ui/data-table/create-column-helper.ts
|
|
2585
|
+
/**
|
|
2586
|
+
* 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.
|
|
2587
|
+
*
|
|
2588
|
+
* @example
|
|
2589
|
+
* ```tsx
|
|
2590
|
+
* const columnHelper = createColumnHelper<User>();
|
|
2591
|
+
*
|
|
2592
|
+
* const columns = [
|
|
2593
|
+
* columnHelper.accessor('name', { header: 'Name' }),
|
|
2594
|
+
* columnHelper.accessor('email', { header: 'Email' }),
|
|
2595
|
+
* ];
|
|
2596
|
+
* ```
|
|
2597
|
+
* @returns A column helper for rows of type `TData`.
|
|
2598
|
+
* @see ColumnDef
|
|
2599
|
+
* @see useDataTable
|
|
2600
|
+
*/
|
|
2601
|
+
const createColumnHelper = createColumnHelper$1;
|
|
2602
|
+
|
|
2603
|
+
//#endregion
|
|
2604
|
+
//#region src/components/ui/data-table/data-table-context.ts
|
|
2605
|
+
const DataTableContext = createContext(null);
|
|
2606
|
+
/**
|
|
2607
|
+
* Read the state of the nearest `DataTable`, for building custom table parts.
|
|
2608
|
+
* Throws when called outside a `DataTable`.
|
|
2609
|
+
*/
|
|
2610
|
+
const useDataTableContext = () => {
|
|
2611
|
+
const context = useContext(DataTableContext);
|
|
2612
|
+
if (!context) throw new Error("DataTable parts must be used inside a DataTable");
|
|
2613
|
+
return context;
|
|
2614
|
+
};
|
|
2615
|
+
|
|
2616
|
+
//#endregion
|
|
2617
|
+
//#region src/components/ui/data-table/data-table.tsx
|
|
2618
|
+
/**
|
|
2619
|
+
* Root of a data table. Holds the table state for `DataTableContent`, `DataTablePagination` and the other parts.
|
|
2620
|
+
*
|
|
2621
|
+
* @example
|
|
2622
|
+
* ```tsx
|
|
2623
|
+
* const dataTable = useDataTable({ columns, data });
|
|
2624
|
+
*
|
|
2625
|
+
* <DataTable table={dataTable}>
|
|
2626
|
+
* <DataTableToolbar>
|
|
2627
|
+
* <DataTableColumnVisibility />
|
|
2628
|
+
* </DataTableToolbar>
|
|
2629
|
+
* <DataTableContent />
|
|
2630
|
+
* </DataTable>
|
|
2631
|
+
* ```
|
|
2632
|
+
* @returns The rendered data table root element.
|
|
2633
|
+
* @see useDataTable
|
|
2634
|
+
* @see DataTableContent
|
|
2635
|
+
* @see DataTableToolbar
|
|
2636
|
+
*/
|
|
2637
|
+
const DataTable = ({ children, className, fill = false, table, ...props }) => {
|
|
2638
|
+
const contextValue = useMemo(() => ({
|
|
2639
|
+
...table,
|
|
2640
|
+
fill
|
|
2641
|
+
}), [table, fill]);
|
|
2642
|
+
return /* @__PURE__ */ jsx(DataTableContext.Provider, {
|
|
2643
|
+
value: contextValue,
|
|
2644
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2645
|
+
"data-slot": "data-table",
|
|
2646
|
+
"data-fill": fill || void 0,
|
|
2647
|
+
className: cn("flex min-w-0 flex-col gap-3", fill && "min-h-0 flex-1", className),
|
|
2648
|
+
...props,
|
|
2649
|
+
children
|
|
2650
|
+
})
|
|
2457
2651
|
});
|
|
2458
2652
|
};
|
|
2459
|
-
|
|
2653
|
+
/**
|
|
2654
|
+
* Row above the table for search, filters and actions.
|
|
2655
|
+
*
|
|
2656
|
+
* @example
|
|
2657
|
+
* ```tsx
|
|
2658
|
+
* <DataTableToolbar>
|
|
2659
|
+
* <Input placeholder="Search users" />
|
|
2660
|
+
* <DataTableColumnVisibility />
|
|
2661
|
+
* </DataTableToolbar>
|
|
2662
|
+
* ```
|
|
2663
|
+
* @returns The rendered toolbar element.
|
|
2664
|
+
* @see DataTable
|
|
2665
|
+
* @see DataTableColumnVisibility
|
|
2666
|
+
*/
|
|
2667
|
+
const DataTableToolbar = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
2668
|
+
"data-slot": "data-table-toolbar",
|
|
2669
|
+
className: cn("flex flex-wrap items-center gap-2", className),
|
|
2670
|
+
...props
|
|
2671
|
+
});
|
|
2672
|
+
|
|
2673
|
+
//#endregion
|
|
2674
|
+
//#region src/components/ui/data-table/get-column-label.ts
|
|
2675
|
+
/**
|
|
2676
|
+
* 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.
|
|
2677
|
+
*/
|
|
2678
|
+
const getColumnLabel = (column) => {
|
|
2679
|
+
const { header, meta } = column.columnDef;
|
|
2680
|
+
const fallback = typeof header === "string" ? header : column.id;
|
|
2681
|
+
return meta?.label ?? fallback;
|
|
2682
|
+
};
|
|
2683
|
+
|
|
2684
|
+
//#endregion
|
|
2685
|
+
//#region src/components/ui/data-table/data-table-column-filter.tsx
|
|
2686
|
+
const TEXT_FILTER_PLACEHOLDER = "Contains";
|
|
2687
|
+
const EMPTY_OPTIONS_TEXT = "No values";
|
|
2688
|
+
/**
|
|
2689
|
+
* Turn cell values into checklist options. List-valued cells count as one value each in TanStack's facets, so their items are
|
|
2690
|
+
* spread out first: a tags column then offers each tag rather than each combination. Empty values offer nothing to check.
|
|
2691
|
+
*/
|
|
2692
|
+
const toOptions = ({ values }) => {
|
|
2693
|
+
const items = values.flatMap((value) => Array.isArray(value) ? value : [value]).filter((value) => value !== void 0 && value !== null && value !== "").map(String);
|
|
2694
|
+
return [...new Set(items)].sort((a, b) => a.localeCompare(b, void 0, { numeric: true }));
|
|
2695
|
+
};
|
|
2696
|
+
/**
|
|
2697
|
+
* The values a `values` filter offers: the column's `filterOptions`, else the values in the data.
|
|
2698
|
+
* Client filtering reads TanStack's facets, which leave out the column's own filter so unchecked values stay offered.
|
|
2699
|
+
* Manual filtering has no facets, so it falls back to the values in the rows currently loaded.
|
|
2700
|
+
* Checked values stay listed even when other filters hide every row that holds them, so they can be unchecked.
|
|
2701
|
+
*/
|
|
2702
|
+
const getFilterOptions = ({ column, selected, table }) => {
|
|
2703
|
+
const filterOptions = column.columnDef.meta?.filterOptions;
|
|
2704
|
+
if (filterOptions) return filterOptions;
|
|
2705
|
+
return toOptions({ values: [...table.options.manualFiltering ? table.getCoreRowModel().flatRows.map((row) => row.getValue(column.id)) : [...column.getFacetedUniqueValues().keys()], ...selected] });
|
|
2706
|
+
};
|
|
2707
|
+
/** The checklist of a `values` filter. The checked values are the filter value; unchecking the last one removes the filter. */
|
|
2708
|
+
const DataTableValuesFilter = ({ column, filterValue }) => {
|
|
2709
|
+
const { table } = useDataTableContext();
|
|
2710
|
+
const selected = Array.isArray(filterValue) ? filterValue.map(String) : [];
|
|
2711
|
+
const options = getFilterOptions({
|
|
2712
|
+
column,
|
|
2713
|
+
selected,
|
|
2714
|
+
table
|
|
2715
|
+
});
|
|
2716
|
+
const toggle = ({ checked, option }) => {
|
|
2717
|
+
const next = checked ? [...selected, option] : selected.filter((value) => value !== option);
|
|
2718
|
+
column.setFilterValue(next.length > 0 ? next : void 0);
|
|
2719
|
+
};
|
|
2720
|
+
if (options.length === 0) return /* @__PURE__ */ jsx("p", {
|
|
2721
|
+
className: "text-sm text-muted-foreground",
|
|
2722
|
+
children: EMPTY_OPTIONS_TEXT
|
|
2723
|
+
});
|
|
2724
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2725
|
+
"data-slot": "data-table-column-filter-options",
|
|
2726
|
+
className: "-m-1 flex max-h-60 flex-col gap-2 overflow-y-auto p-1",
|
|
2727
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(Label, {
|
|
2728
|
+
className: "flex items-center gap-2 text-sm font-normal",
|
|
2729
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
2730
|
+
checked: selected.includes(option),
|
|
2731
|
+
onCheckedChange: (checked) => toggle({
|
|
2732
|
+
checked: checked === true,
|
|
2733
|
+
option
|
|
2734
|
+
})
|
|
2735
|
+
}), option]
|
|
2736
|
+
}, option))
|
|
2737
|
+
});
|
|
2738
|
+
};
|
|
2739
|
+
/**
|
|
2740
|
+
* A filter button that opens a column's filter: a text field for `meta.filter: 'text'`, or a checklist for `meta.filter: 'values'`.
|
|
2741
|
+
* `DataTableContent` already adds it to each filterable header; render it yourself only in a header you build without `DataTableContent`.
|
|
2742
|
+
* The checklist offers `meta.filterOptions`, else the values in the data. With manual filtering and no `filterOptions`,
|
|
2743
|
+
* it can only offer the values in the rows currently loaded, so pass `filterOptions` when the server holds more.
|
|
2744
|
+
*
|
|
2745
|
+
* @example
|
|
2746
|
+
* ```tsx
|
|
2747
|
+
* const columns: ColumnDef<User>[] = [
|
|
2748
|
+
* { accessorKey: 'role', header: 'Role', meta: { filter: 'values' } },
|
|
2749
|
+
* ];
|
|
2750
|
+
*
|
|
2751
|
+
* // In a header row you render yourself:
|
|
2752
|
+
* <th>
|
|
2753
|
+
* Role
|
|
2754
|
+
* <DataTableColumnFilter column={header.column} />
|
|
2755
|
+
* </th>
|
|
2756
|
+
* ```
|
|
2757
|
+
* @returns The rendered filter button and its popover.
|
|
2758
|
+
* @see DataTableContent
|
|
2759
|
+
* @see DataTableActiveFilters
|
|
2760
|
+
* @see DataTableSearch
|
|
2761
|
+
*/
|
|
2762
|
+
const DataTableColumnFilter = ({ className, column }) => {
|
|
2763
|
+
const label = getColumnLabel(column);
|
|
2764
|
+
const isFiltered = column.getIsFiltered();
|
|
2765
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
2766
|
+
asChild: true,
|
|
2767
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
2768
|
+
"aria-label": isFiltered ? `Filter ${label}, filtered` : `Filter ${label}`,
|
|
2769
|
+
"data-slot": "data-table-column-filter",
|
|
2770
|
+
"data-filtered": isFiltered || void 0,
|
|
2771
|
+
size: "icon-xs",
|
|
2772
|
+
variant: "ghost",
|
|
2773
|
+
className: cn("ms-1 align-middle before:-inset-1 data-[filtered=true]:text-foreground", className),
|
|
2774
|
+
children: [/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2775
|
+
icon: FilterIcon,
|
|
2776
|
+
"aria-hidden": "true"
|
|
2777
|
+
}), isFiltered && /* @__PURE__ */ jsx("span", {
|
|
2778
|
+
"aria-hidden": "true",
|
|
2779
|
+
className: "absolute end-0.5 top-0.5 size-1.5 rounded-full bg-[var(--action)]"
|
|
2780
|
+
})]
|
|
2781
|
+
})
|
|
2782
|
+
}), /* @__PURE__ */ jsx(DataTableColumnFilterContent, { column })] });
|
|
2783
|
+
};
|
|
2784
|
+
/** The body of a column's filter popover, shared by the header filter button and the active-filter chips. */
|
|
2785
|
+
const DataTableColumnFilterContent = ({ column }) => {
|
|
2786
|
+
const label = getColumnLabel(column);
|
|
2787
|
+
const filterValue = column.getFilterValue();
|
|
2788
|
+
return /* @__PURE__ */ jsxs(PopoverContent, {
|
|
2789
|
+
"aria-label": `Filter ${label}`,
|
|
2790
|
+
align: "start",
|
|
2791
|
+
className: "flex w-56 flex-col gap-3 p-3",
|
|
2792
|
+
children: [column.columnDef.meta?.filter === "values" ? /* @__PURE__ */ jsx(DataTableValuesFilter, {
|
|
2793
|
+
column,
|
|
2794
|
+
filterValue
|
|
2795
|
+
}) : /* @__PURE__ */ jsx(Input, {
|
|
2796
|
+
"aria-label": `Filter ${label}`,
|
|
2797
|
+
placeholder: TEXT_FILTER_PLACEHOLDER,
|
|
2798
|
+
value: typeof filterValue === "string" ? filterValue : "",
|
|
2799
|
+
onChange: (event) => column.setFilterValue(event.target.value)
|
|
2800
|
+
}), column.getIsFiltered() && /* @__PURE__ */ jsx("div", {
|
|
2801
|
+
"data-slot": "data-table-column-filter-footer",
|
|
2802
|
+
className: "-mx-3 flex justify-end border-t border-[var(--border-divider)] px-3 pt-3",
|
|
2803
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
2804
|
+
size: "sm",
|
|
2805
|
+
variant: "secondary",
|
|
2806
|
+
onClick: () => column.setFilterValue(void 0),
|
|
2807
|
+
children: "Clear"
|
|
2808
|
+
})
|
|
2809
|
+
})]
|
|
2810
|
+
});
|
|
2811
|
+
};
|
|
2812
|
+
|
|
2813
|
+
//#endregion
|
|
2814
|
+
//#region src/components/ui/data-table/data-table-active-filters.tsx
|
|
2815
|
+
/** A `values` filter holds the checked values; a `text` filter holds the text. */
|
|
2816
|
+
const toFilterValues = (value) => Array.isArray(value) ? value.map(String) : [String(value)];
|
|
2817
|
+
const MAX_SHOWN_VALUES = 2;
|
|
2818
|
+
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)]";
|
|
2819
|
+
const DataTableFilterChip = ({ column, label, onRemove, removeLabel, values }) => {
|
|
2820
|
+
const fullValue = values.join(", ");
|
|
2821
|
+
const hiddenCount = values.length - MAX_SHOWN_VALUES;
|
|
2822
|
+
const shownValue = /* @__PURE__ */ jsxs(Fragment$1, { children: [values.slice(0, MAX_SHOWN_VALUES).join(", "), hiddenCount > 0 && /* @__PURE__ */ jsxs("span", {
|
|
2823
|
+
className: "ms-1 text-muted-foreground",
|
|
2824
|
+
children: ["+", hiddenCount]
|
|
2825
|
+
})] });
|
|
2826
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
2827
|
+
"data-slot": "data-table-filter-chip",
|
|
2828
|
+
title: hiddenCount > 0 ? fullValue : void 0,
|
|
2829
|
+
className: "inline-flex h-8 items-center rounded-md bg-white p-1 text-[13px] shadow-[var(--shadow-secondary)] dark:bg-input/30",
|
|
2830
|
+
children: [
|
|
2831
|
+
/* @__PURE__ */ jsx("button", {
|
|
2832
|
+
type: "button",
|
|
2833
|
+
"aria-label": removeLabel,
|
|
2834
|
+
onClick: onRemove,
|
|
2835
|
+
className: cn(CHIP_CONTROL, "w-6 justify-center text-muted-foreground/70 hover:text-foreground"),
|
|
2836
|
+
children: /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2837
|
+
icon: Cancel01Icon,
|
|
2838
|
+
size: 12,
|
|
2839
|
+
strokeWidth: 2,
|
|
2840
|
+
"aria-hidden": "true"
|
|
2841
|
+
})
|
|
2842
|
+
}),
|
|
2843
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2844
|
+
className: "ps-1 pe-2 text-muted-foreground",
|
|
2845
|
+
children: [label, /* @__PURE__ */ jsx("span", {
|
|
2846
|
+
className: "sr-only",
|
|
2847
|
+
children: ": "
|
|
2848
|
+
})]
|
|
2849
|
+
}),
|
|
2850
|
+
/* @__PURE__ */ jsx("span", {
|
|
2851
|
+
"aria-hidden": "true",
|
|
2852
|
+
className: "h-4 w-px bg-[var(--border-divider)]"
|
|
2853
|
+
}),
|
|
2854
|
+
column ? /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
|
|
2855
|
+
asChild: true,
|
|
2856
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
2857
|
+
type: "button",
|
|
2858
|
+
"aria-label": `Change ${label} filter: ${fullValue}`,
|
|
2859
|
+
className: cn(CHIP_CONTROL, "ms-1 gap-1 ps-1.5 pe-1 font-medium text-[var(--action)]"),
|
|
2860
|
+
children: [shownValue, /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2861
|
+
icon: ArrowDown01Icon,
|
|
2862
|
+
size: 14,
|
|
2863
|
+
"aria-hidden": "true",
|
|
2864
|
+
className: "opacity-60"
|
|
2865
|
+
})]
|
|
2866
|
+
})
|
|
2867
|
+
}), /* @__PURE__ */ jsx(DataTableColumnFilterContent, { column })] }) : /* @__PURE__ */ jsx("span", {
|
|
2868
|
+
className: "ps-2 pe-1.5 font-medium text-[var(--action)]",
|
|
2869
|
+
children: shownValue
|
|
2870
|
+
})
|
|
2871
|
+
]
|
|
2872
|
+
});
|
|
2873
|
+
};
|
|
2874
|
+
/**
|
|
2875
|
+
* One chip per active filter, each with a button that removes it, plus a button that clears them all.
|
|
2876
|
+
* The search text gets a chip too. Renders nothing while no filter is active.
|
|
2877
|
+
*
|
|
2878
|
+
* @example
|
|
2879
|
+
* ```tsx
|
|
2880
|
+
* <DataTable table={dataTable}>
|
|
2881
|
+
* <DataTableToolbar>
|
|
2882
|
+
* <DataTableSearch />
|
|
2883
|
+
* </DataTableToolbar>
|
|
2884
|
+
* <DataTableActiveFilters />
|
|
2885
|
+
* <DataTableContent />
|
|
2886
|
+
* </DataTable>
|
|
2887
|
+
* ```
|
|
2888
|
+
* @returns The rendered filter chips, or nothing when no filter is active.
|
|
2889
|
+
* @see DataTableColumnFilter
|
|
2890
|
+
* @see DataTableSearch
|
|
2891
|
+
* @see useDataTable
|
|
2892
|
+
*/
|
|
2893
|
+
const DataTableActiveFilters = ({ className }) => {
|
|
2894
|
+
const { table } = useDataTableContext();
|
|
2895
|
+
const { columnFilters, globalFilter } = table.getState();
|
|
2896
|
+
const search = typeof globalFilter === "string" ? globalFilter : "";
|
|
2897
|
+
if (columnFilters.length === 0 && search === "") return null;
|
|
2898
|
+
const clearAll = () => {
|
|
2899
|
+
table.setColumnFilters([]);
|
|
2900
|
+
table.setGlobalFilter("");
|
|
2901
|
+
};
|
|
2902
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
2903
|
+
"aria-label": "Active filters",
|
|
2904
|
+
"data-slot": "data-table-active-filters",
|
|
2905
|
+
className: cn("flex min-w-0 flex-wrap items-center gap-2", className),
|
|
2906
|
+
children: [
|
|
2907
|
+
search !== "" && /* @__PURE__ */ jsx(DataTableFilterChip, {
|
|
2908
|
+
label: "Search",
|
|
2909
|
+
onRemove: () => table.setGlobalFilter(""),
|
|
2910
|
+
removeLabel: "Remove search filter",
|
|
2911
|
+
values: [search]
|
|
2912
|
+
}),
|
|
2913
|
+
columnFilters.map(({ id, value }) => {
|
|
2914
|
+
const column = table.getAllFlatColumns().find((candidate) => candidate.id === id);
|
|
2915
|
+
const label = column ? getColumnLabel(column) : id;
|
|
2916
|
+
return /* @__PURE__ */ jsx(DataTableFilterChip, {
|
|
2917
|
+
column: column?.columnDef.meta?.filter ? column : void 0,
|
|
2918
|
+
label,
|
|
2919
|
+
onRemove: () => table.setColumnFilters((old) => old.filter((filter) => filter.id !== id)),
|
|
2920
|
+
removeLabel: `Remove ${label} filter`,
|
|
2921
|
+
values: toFilterValues(value)
|
|
2922
|
+
}, id);
|
|
2923
|
+
}),
|
|
2924
|
+
/* @__PURE__ */ jsx(Button, {
|
|
2925
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
2926
|
+
variant: "ghost",
|
|
2927
|
+
onClick: clearAll,
|
|
2928
|
+
children: "Clear filters"
|
|
2929
|
+
})
|
|
2930
|
+
]
|
|
2931
|
+
});
|
|
2932
|
+
};
|
|
2933
|
+
|
|
2934
|
+
//#endregion
|
|
2935
|
+
//#region src/components/ui/data-table/data-table-column-visibility.tsx
|
|
2936
|
+
/**
|
|
2937
|
+
* Lets people choose which columns are shown, from a menu with a checkbox per column.
|
|
2938
|
+
*
|
|
2939
|
+
* @example
|
|
2940
|
+
* ```tsx
|
|
2941
|
+
* <DataTable table={dataTable}>
|
|
2942
|
+
* <DataTableToolbar>
|
|
2943
|
+
* <DataTableColumnVisibility label="Columns" />
|
|
2944
|
+
* </DataTableToolbar>
|
|
2945
|
+
* <DataTableContent />
|
|
2946
|
+
* </DataTable>
|
|
2947
|
+
* ```
|
|
2948
|
+
* @returns The rendered column picker menu.
|
|
2949
|
+
* @see DataTable
|
|
2950
|
+
* @see DataTableToolbar
|
|
2951
|
+
* @see useDataTable
|
|
2952
|
+
*/
|
|
2953
|
+
const DataTableColumnVisibility = ({ className, label = "Columns" }) => {
|
|
2954
|
+
const { table } = useDataTableContext();
|
|
2955
|
+
const columns = table.getAllLeafColumns().filter((column) => column.getCanHide());
|
|
2956
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
2957
|
+
asChild: true,
|
|
2958
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
2959
|
+
"data-slot": "data-table-column-visibility",
|
|
2960
|
+
className,
|
|
2961
|
+
variant: "outline",
|
|
2962
|
+
children: [
|
|
2963
|
+
/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2964
|
+
icon: LayoutThreeColumnIcon,
|
|
2965
|
+
"aria-hidden": "true"
|
|
2966
|
+
}),
|
|
2967
|
+
label,
|
|
2968
|
+
/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
2969
|
+
icon: ArrowDown01Icon,
|
|
2970
|
+
"aria-hidden": "true"
|
|
2971
|
+
})
|
|
2972
|
+
]
|
|
2973
|
+
})
|
|
2974
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
2975
|
+
align: "start",
|
|
2976
|
+
children: columns.map((column) => {
|
|
2977
|
+
const visible = column.getIsVisible();
|
|
2978
|
+
return /* @__PURE__ */ jsxs(CheckboxItem, {
|
|
2979
|
+
"data-slot": "data-table-column-visibility-item",
|
|
2980
|
+
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",
|
|
2981
|
+
checked: visible,
|
|
2982
|
+
onCheckedChange: (checked) => column.toggleVisibility(checked === true),
|
|
2983
|
+
onSelect: (event) => event.preventDefault(),
|
|
2984
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
2985
|
+
checked: visible,
|
|
2986
|
+
tabIndex: -1,
|
|
2987
|
+
"aria-hidden": "true",
|
|
2988
|
+
className: "pointer-events-none"
|
|
2989
|
+
}), getColumnLabel(column)]
|
|
2990
|
+
}, column.id);
|
|
2991
|
+
})
|
|
2992
|
+
})] });
|
|
2993
|
+
};
|
|
2994
|
+
|
|
2995
|
+
//#endregion
|
|
2996
|
+
//#region src/components/empty-state/empty-state.tsx
|
|
2997
|
+
const EmptyState = ({ icon: Icon$2, title, description, action, className }) => {
|
|
2998
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2999
|
+
className: cn("flex flex-col items-center justify-center py-16 px-8 text-center", className),
|
|
3000
|
+
children: [
|
|
3001
|
+
/* @__PURE__ */ jsx("div", {
|
|
3002
|
+
className: "flex size-12 items-center justify-center rounded-xl bg-muted mb-4",
|
|
3003
|
+
children: /* @__PURE__ */ jsx(Icon$2, { className: "size-6 text-muted-foreground" })
|
|
3004
|
+
}),
|
|
3005
|
+
/* @__PURE__ */ jsx("h3", {
|
|
3006
|
+
className: "text-sm font-semibold",
|
|
3007
|
+
children: title
|
|
3008
|
+
}),
|
|
3009
|
+
description && /* @__PURE__ */ jsx("p", {
|
|
3010
|
+
className: "text-sm text-muted-foreground mt-1 max-w-sm",
|
|
3011
|
+
children: description
|
|
3012
|
+
}),
|
|
3013
|
+
action && /* @__PURE__ */ jsx("div", {
|
|
3014
|
+
className: "mt-4",
|
|
3015
|
+
children: action
|
|
3016
|
+
})
|
|
3017
|
+
]
|
|
3018
|
+
});
|
|
3019
|
+
};
|
|
3020
|
+
|
|
3021
|
+
//#endregion
|
|
3022
|
+
//#region src/components/ui/data-table/data-table-placeholder-rows.tsx
|
|
3023
|
+
/** Varied bar widths read as real content rather than one repeated block. */
|
|
3024
|
+
const PLACEHOLDER_BARS = [
|
|
3025
|
+
"w-28",
|
|
3026
|
+
"w-14",
|
|
3027
|
+
"w-24",
|
|
3028
|
+
"w-36",
|
|
3029
|
+
"w-24",
|
|
3030
|
+
"w-14"
|
|
3031
|
+
];
|
|
3032
|
+
const GHOST_ROW_COUNT = 6;
|
|
3033
|
+
/** Placeholder, group and detail rows are not interactive, so they must not take the row hover fill. */
|
|
3034
|
+
const STATIC_ROW = "hover:bg-transparent hover:[--table-row-overlay:transparent]";
|
|
3035
|
+
const getBarWidth = (columnIndex) => PLACEHOLDER_BARS[columnIndex % PLACEHOLDER_BARS.length];
|
|
3036
|
+
/** Skeleton rows shown while data loads. Only the first bar is announced, so screen readers hear "Loading" once. */
|
|
3037
|
+
const DataTableSkeletonRows = ({ columnCount, rowCount }) => /* @__PURE__ */ jsx(Fragment$1, { children: Array.from({ length: rowCount }, (_, rowIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
3038
|
+
"data-slot": "data-table-skeleton-row",
|
|
3039
|
+
className: STATIC_ROW,
|
|
3040
|
+
children: Array.from({ length: columnCount }, (_$1, columnIndex) => /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Skeleton, {
|
|
3041
|
+
"aria-hidden": rowIndex > 0 || columnIndex > 0 || void 0,
|
|
3042
|
+
className: cn("h-4 max-w-full", getBarWidth(columnIndex))
|
|
3043
|
+
}) }, columnIndex))
|
|
3044
|
+
}, rowIndex)) });
|
|
3045
|
+
/** Ghost rows keep the table's shape behind an icon and title. */
|
|
3046
|
+
const DataTableEmptyRow = ({ action, columnCount, icon, title }) => /* @__PURE__ */ jsx(TableRow, {
|
|
3047
|
+
"data-slot": "data-table-empty",
|
|
3048
|
+
className: STATIC_ROW,
|
|
3049
|
+
children: /* @__PURE__ */ jsx(TableCell, {
|
|
3050
|
+
colSpan: columnCount,
|
|
3051
|
+
className: "p-0 whitespace-normal",
|
|
3052
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3053
|
+
className: "grid",
|
|
3054
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3055
|
+
"aria-hidden": "true",
|
|
3056
|
+
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%)]",
|
|
3057
|
+
children: Array.from({ length: GHOST_ROW_COUNT }, (_, rowIndex) => /* @__PURE__ */ jsx("div", {
|
|
3058
|
+
"data-slot": "data-table-ghost-row",
|
|
3059
|
+
className: "grid items-center border-b border-[var(--border-divider)] py-3.5 last:border-b-0",
|
|
3060
|
+
style: { gridTemplateColumns: `repeat(${columnCount}, minmax(0, 1fr))` },
|
|
3061
|
+
children: Array.from({ length: columnCount }, (_$1, columnIndex) => /* @__PURE__ */ jsx("span", {
|
|
3062
|
+
className: "px-4",
|
|
3063
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("block h-2.5 max-w-full rounded-full bg-[var(--bg-accented)]", getBarWidth(columnIndex)) })
|
|
3064
|
+
}, columnIndex))
|
|
3065
|
+
}, rowIndex))
|
|
3066
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
3067
|
+
className: "sticky start-0 col-start-1 row-start-1 flex w-[100cqw] items-center justify-center justify-self-start",
|
|
3068
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
3069
|
+
action,
|
|
3070
|
+
className: "py-0",
|
|
3071
|
+
icon,
|
|
3072
|
+
title
|
|
3073
|
+
})
|
|
3074
|
+
})]
|
|
3075
|
+
})
|
|
3076
|
+
})
|
|
3077
|
+
});
|
|
3078
|
+
|
|
3079
|
+
//#endregion
|
|
3080
|
+
//#region src/components/ui/data-table/expand-chevron.tsx
|
|
3081
|
+
/** A right-pointing chevron that turns to point down while its group is open. */
|
|
3082
|
+
const ExpandChevron = ({ isOpen }) => /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3083
|
+
icon: ArrowRight01Icon,
|
|
3084
|
+
"aria-hidden": "true",
|
|
3085
|
+
className: cn("transition-transform duration-150 motion-reduce:transition-none", isOpen && "rotate-90")
|
|
3086
|
+
});
|
|
3087
|
+
|
|
3088
|
+
//#endregion
|
|
3089
|
+
//#region src/components/ui/data-table/get-pinned-cell-props.ts
|
|
3090
|
+
/** Pinned cells need an opaque base so scrolling text cannot show through; the body overlay still follows row hover and selection. */
|
|
3091
|
+
const PINNED_BACKGROUND = {
|
|
3092
|
+
body: "bg-card bg-[image:linear-gradient(var(--table-row-overlay,transparent),var(--table-row-overlay,transparent))]",
|
|
3093
|
+
header: "bg-[var(--tray-chrome)]"
|
|
3094
|
+
};
|
|
3095
|
+
/** A 1px divider marks where pinned columns meet the scrolling ones. */
|
|
3096
|
+
const PINNED_EDGE = {
|
|
3097
|
+
left: "shadow-[inset_-1px_0_0_var(--border-divider)]",
|
|
3098
|
+
right: "shadow-[inset_1px_0_0_var(--border-divider)]"
|
|
3099
|
+
};
|
|
3100
|
+
/** Sticky position, background and edge divider for a cell in a pinned column. */
|
|
3101
|
+
const getPinnedCellProps = ({ column, section }) => {
|
|
3102
|
+
const side = column.getIsPinned();
|
|
3103
|
+
if (!side) return {};
|
|
3104
|
+
const isEdge = side === "left" ? column.getIsLastColumn("left") : column.getIsFirstColumn("right");
|
|
3105
|
+
return {
|
|
3106
|
+
className: cn("sticky z-10", PINNED_BACKGROUND[section], isEdge && PINNED_EDGE[side]),
|
|
3107
|
+
"data-pinned": side,
|
|
3108
|
+
style: side === "left" ? { insetInlineStart: column.getStart("left") } : { insetInlineEnd: column.getAfter("right") }
|
|
3109
|
+
};
|
|
3110
|
+
};
|
|
3111
|
+
|
|
3112
|
+
//#endregion
|
|
3113
|
+
//#region src/components/ui/data-table/selection-column.tsx
|
|
3114
|
+
/**
|
|
3115
|
+
* Id of the checkbox column added by `selectionColumn`. Use it to find that column, for example when pinning it to the start edge.
|
|
3116
|
+
*
|
|
3117
|
+
* @example
|
|
3118
|
+
* ```tsx
|
|
3119
|
+
* const columnPinning = { initial: { left: [SELECTION_COLUMN_ID] } };
|
|
3120
|
+
* ```
|
|
3121
|
+
* @see selectionColumn
|
|
3122
|
+
* @see useDataTable
|
|
3123
|
+
*/
|
|
3124
|
+
const SELECTION_COLUMN_ID = "select";
|
|
3125
|
+
/** Fixed width in px; DataTableContent sizes headers from it when resizing or pinning is on. */
|
|
3126
|
+
const SELECTION_COLUMN_SIZE = 40;
|
|
3127
|
+
const getAllRowsCheckedState = (table) => {
|
|
3128
|
+
if (table.getIsAllPageRowsSelected()) return true;
|
|
3129
|
+
return table.getIsSomePageRowsSelected() ? "indeterminate" : false;
|
|
3130
|
+
};
|
|
3131
|
+
const SelectionCell = ({ row }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
3132
|
+
"aria-label": "Select row",
|
|
3133
|
+
checked: row.getIsSelected(),
|
|
3134
|
+
disabled: !row.getCanSelect(),
|
|
3135
|
+
onCheckedChange: (checked) => row.toggleSelected(checked === true)
|
|
3136
|
+
});
|
|
3137
|
+
const SelectionHeader = ({ table }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
3138
|
+
"aria-label": "Select all rows",
|
|
3139
|
+
checked: getAllRowsCheckedState(table),
|
|
3140
|
+
onCheckedChange: (checked) => table.toggleAllPageRowsSelected(checked === true)
|
|
3141
|
+
});
|
|
3142
|
+
/**
|
|
3143
|
+
* A checkbox column for row selection. Put it first in `columns` and pass `selection` to `useDataTable`.
|
|
3144
|
+
*
|
|
3145
|
+
* @example
|
|
3146
|
+
* const columns = [selectionColumn<User>(), { accessorKey: 'name', header: 'Name' }];
|
|
3147
|
+
* @returns A column definition that renders a checkbox for each row and a select-all checkbox in the header.
|
|
3148
|
+
* @see SELECTION_COLUMN_ID
|
|
3149
|
+
* @see useDataTable
|
|
3150
|
+
*/
|
|
3151
|
+
const selectionColumn = () => ({
|
|
3152
|
+
cell: SelectionCell,
|
|
3153
|
+
enableHiding: false,
|
|
3154
|
+
enableResizing: false,
|
|
3155
|
+
enableSorting: false,
|
|
3156
|
+
header: SelectionHeader,
|
|
3157
|
+
id: SELECTION_COLUMN_ID,
|
|
3158
|
+
size: SELECTION_COLUMN_SIZE
|
|
3159
|
+
});
|
|
3160
|
+
|
|
3161
|
+
//#endregion
|
|
3162
|
+
//#region src/components/ui/data-table/data-table-rows.tsx
|
|
3163
|
+
/** Fixed layout cells clip and truncate, so a narrowed column cannot spill into its neighbour. The checkbox column never needs it. */
|
|
3164
|
+
const FIXED_LAYOUT_CELL_CLASS = "overflow-hidden text-ellipsis";
|
|
3165
|
+
/**
|
|
3166
|
+
* Pins full-width row content to the visible part of a horizontally scrolling table. The single spanning cell has no
|
|
3167
|
+
* pinned part of its own, so without this the content scrolls off to the start. 100cqw is the tray's width, since the
|
|
3168
|
+
* tray is an inline-size container. The cell drops its padding and this element carries it, so the content is exactly
|
|
3169
|
+
* the visible width and never widens the table.
|
|
3170
|
+
*/
|
|
3171
|
+
const STICKY_ROW_CONTENT = "sticky start-0 w-[100cqw] px-4 py-2.5";
|
|
3172
|
+
/** Shown for a group whose rows have no value in the grouped column. */
|
|
3173
|
+
const EMPTY_GROUP_LABEL = "None";
|
|
3174
|
+
/** The checkbox column holds one control, so it stays narrow and never clips. */
|
|
3175
|
+
const isControlColumn = (columnId) => columnId === SELECTION_COLUMN_ID;
|
|
3176
|
+
/** Rows inside groups step in by 1.25rem per level from the cell's own 1rem padding. */
|
|
3177
|
+
const getIndent = (depth) => `calc(1rem + ${depth} * 1.25rem)`;
|
|
3178
|
+
const getGroupLabel = ({ groupingColumnId, row }) => {
|
|
3179
|
+
const value = row.getGroupingValue(groupingColumnId);
|
|
3180
|
+
return `${value === void 0 || value === null || value === "" ? EMPTY_GROUP_LABEL : String(value)} (${row.getLeafRows().filter((leaf) => !leaf.getIsGrouped()).length})`;
|
|
3181
|
+
};
|
|
3182
|
+
const DataTableRow = ({ hasFixedLayout, row, rowRef, ...props }) => {
|
|
3183
|
+
const cells = row.getVisibleCells();
|
|
3184
|
+
const indentedCellId = row.depth > 0 ? cells.find((cell) => !isControlColumn(cell.column.id))?.id : void 0;
|
|
3185
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
3186
|
+
ref: rowRef,
|
|
3187
|
+
"data-state": row.getIsSelected() ? "selected" : void 0,
|
|
3188
|
+
...props,
|
|
3189
|
+
children: cells.map((cell) => {
|
|
3190
|
+
const pinned = getPinnedCellProps({
|
|
3191
|
+
column: cell.column,
|
|
3192
|
+
section: "body"
|
|
3193
|
+
});
|
|
3194
|
+
return /* @__PURE__ */ jsx(TableCell, {
|
|
3195
|
+
"data-pinned": pinned["data-pinned"],
|
|
3196
|
+
className: cn(hasFixedLayout && !isControlColumn(cell.column.id) && FIXED_LAYOUT_CELL_CLASS, pinned.className),
|
|
3197
|
+
style: cell.id === indentedCellId ? {
|
|
3198
|
+
...pinned.style,
|
|
3199
|
+
paddingInlineStart: getIndent(row.depth)
|
|
3200
|
+
} : pinned.style,
|
|
3201
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
3202
|
+
}, cell.id);
|
|
3203
|
+
})
|
|
3204
|
+
});
|
|
3205
|
+
};
|
|
3206
|
+
/** One full-width row naming the group and how many rows it holds, with a button that opens or closes it. */
|
|
3207
|
+
const DataTableGroupRow = ({ columnCount, groupingColumnId, row, rowRef, ...props }) => {
|
|
3208
|
+
const isOpen = row.getIsExpanded();
|
|
3209
|
+
return /* @__PURE__ */ jsx(TableRow, {
|
|
3210
|
+
ref: rowRef,
|
|
3211
|
+
"data-slot": "data-table-group-row",
|
|
3212
|
+
className: STATIC_ROW,
|
|
3213
|
+
...props,
|
|
3214
|
+
children: /* @__PURE__ */ jsx(TableCell, {
|
|
3215
|
+
colSpan: columnCount,
|
|
3216
|
+
className: "p-0 font-medium",
|
|
3217
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
3218
|
+
className: STICKY_ROW_CONTENT,
|
|
3219
|
+
style: row.depth > 0 ? { paddingInlineStart: getIndent(row.depth) } : void 0,
|
|
3220
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
3221
|
+
type: "button",
|
|
3222
|
+
"aria-expanded": isOpen,
|
|
3223
|
+
onClick: row.getToggleExpandedHandler(),
|
|
3224
|
+
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",
|
|
3225
|
+
children: [/* @__PURE__ */ jsx(ExpandChevron, { isOpen }), getGroupLabel({
|
|
3226
|
+
groupingColumnId,
|
|
3227
|
+
row
|
|
3228
|
+
})]
|
|
3229
|
+
})
|
|
3230
|
+
})
|
|
3231
|
+
})
|
|
3232
|
+
});
|
|
3233
|
+
};
|
|
3234
|
+
/** One table row, as a group header or a data row. Row props and `rowRef` land on its `<tr>`. */
|
|
3235
|
+
const DataTableBodyRow = ({ columnCount, hasFixedLayout, row, ...props }) => {
|
|
3236
|
+
const { groupingColumnId } = row;
|
|
3237
|
+
if (groupingColumnId) return /* @__PURE__ */ jsx(DataTableGroupRow, {
|
|
3238
|
+
columnCount,
|
|
3239
|
+
groupingColumnId,
|
|
3240
|
+
row,
|
|
3241
|
+
...props
|
|
3242
|
+
});
|
|
3243
|
+
return /* @__PURE__ */ jsx(DataTableRow, {
|
|
3244
|
+
hasFixedLayout,
|
|
3245
|
+
row,
|
|
3246
|
+
...props
|
|
3247
|
+
});
|
|
3248
|
+
};
|
|
3249
|
+
|
|
3250
|
+
//#endregion
|
|
3251
|
+
//#region src/components/ui/data-table/data-table-content.tsx
|
|
3252
|
+
const DEFAULT_EMPTY_TITLE = "No results";
|
|
3253
|
+
const DEFAULT_EMPTY_FILTERED_TITLE = "No matching results";
|
|
3254
|
+
const DEFAULT_LOADING_ROW_COUNT = 5;
|
|
3255
|
+
const ARIA_SORT = {
|
|
3256
|
+
asc: "ascending",
|
|
3257
|
+
desc: "descending"
|
|
3258
|
+
};
|
|
3259
|
+
const SORT_ICON = {
|
|
3260
|
+
asc: ArrowUp01Icon,
|
|
3261
|
+
desc: ArrowDown01Icon
|
|
3262
|
+
};
|
|
3263
|
+
/** Arrow keys resize in 16px steps, matching the 4px spacing grid. */
|
|
3264
|
+
const RESIZE_STEP = {
|
|
3265
|
+
ArrowLeft: -16,
|
|
3266
|
+
ArrowRight: 16
|
|
3267
|
+
};
|
|
3268
|
+
/** TanStack's default minimum column width. */
|
|
3269
|
+
const MIN_COLUMN_SIZE = 20;
|
|
3270
|
+
/** TanStack leaves columns unbounded; screen readers get a usable range instead. */
|
|
3271
|
+
const MAX_COLUMN_SIZE = 1e3;
|
|
3272
|
+
/** Rows rendered beyond each edge of the view when virtualization sets no overscan. */
|
|
3273
|
+
const DEFAULT_OVERSCAN = 8;
|
|
3274
|
+
const DefaultEmptyIcon = ({ className, size }) => /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3275
|
+
className,
|
|
3276
|
+
icon: Table01Icon,
|
|
3277
|
+
size
|
|
3278
|
+
});
|
|
3279
|
+
const getMaxColumnSize = (maxSize) => maxSize === void 0 || maxSize === Number.MAX_SAFE_INTEGER ? MAX_COLUMN_SIZE : maxSize;
|
|
3280
|
+
const DataTableResizeHandle = ({ header }) => {
|
|
3281
|
+
const { column } = header;
|
|
3282
|
+
const { table } = header.getContext();
|
|
3283
|
+
const size = column.getSize();
|
|
3284
|
+
const handleKeyDown = (event) => {
|
|
3285
|
+
const step = RESIZE_STEP[event.key];
|
|
3286
|
+
if (!step) return;
|
|
3287
|
+
event.preventDefault();
|
|
3288
|
+
table.setColumnSizing((sizing) => ({
|
|
3289
|
+
...sizing,
|
|
3290
|
+
[column.id]: size + step
|
|
3291
|
+
}));
|
|
3292
|
+
};
|
|
3293
|
+
const resize = header.getResizeHandler();
|
|
3294
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3295
|
+
role: "separator",
|
|
3296
|
+
"aria-label": `Resize ${getColumnLabel(column)}`,
|
|
3297
|
+
"aria-orientation": "vertical",
|
|
3298
|
+
"aria-valuemax": getMaxColumnSize(column.columnDef.maxSize),
|
|
3299
|
+
"aria-valuemin": column.columnDef.minSize ?? MIN_COLUMN_SIZE,
|
|
3300
|
+
"aria-valuenow": size,
|
|
3301
|
+
"aria-valuetext": `${size} pixels`,
|
|
3302
|
+
tabIndex: 0,
|
|
3303
|
+
"data-slot": "data-table-resize-handle",
|
|
3304
|
+
"data-resizing": column.getIsResizing() || void 0,
|
|
3305
|
+
onDoubleClick: () => column.resetSize(),
|
|
3306
|
+
onKeyDown: handleKeyDown,
|
|
3307
|
+
onMouseDown: resize,
|
|
3308
|
+
onTouchStart: resize,
|
|
3309
|
+
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"
|
|
3310
|
+
});
|
|
3311
|
+
};
|
|
3312
|
+
const DataTableHeadCell = ({ header, hasFixedLayout }) => {
|
|
3313
|
+
const { column } = header;
|
|
3314
|
+
const sorted = column.getIsSorted();
|
|
3315
|
+
const sortIndex = column.getSortIndex();
|
|
3316
|
+
const isMultiSort = header.getContext().table.getState().sorting.length > 1;
|
|
3317
|
+
const sortPriority = sorted && isMultiSort ? sortIndex + 1 : void 0;
|
|
3318
|
+
const pinned = getPinnedCellProps({
|
|
3319
|
+
column,
|
|
3320
|
+
section: "header"
|
|
3321
|
+
});
|
|
3322
|
+
const content = header.isPlaceholder ? null : flexRender(column.columnDef.header, header.getContext());
|
|
3323
|
+
return /* @__PURE__ */ jsxs(TableHead, {
|
|
3324
|
+
colSpan: header.colSpan,
|
|
3325
|
+
"aria-sort": sorted && sortIndex === 0 ? ARIA_SORT[sorted] : void 0,
|
|
3326
|
+
"data-pinned": pinned["data-pinned"],
|
|
3327
|
+
className: cn(column.getCanResize() && "relative", isControlColumn(column.id) && "w-px", hasFixedLayout && !isControlColumn(column.id) && FIXED_LAYOUT_CELL_CLASS, pinned.className),
|
|
3328
|
+
style: {
|
|
3329
|
+
...pinned.style,
|
|
3330
|
+
width: hasFixedLayout ? header.getSize() : void 0
|
|
3331
|
+
},
|
|
3332
|
+
children: [
|
|
3333
|
+
!header.isPlaceholder && column.getCanSort() ? /* @__PURE__ */ jsxs("button", {
|
|
3334
|
+
type: "button",
|
|
3335
|
+
onClick: column.getToggleSortingHandler(),
|
|
3336
|
+
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)]",
|
|
3337
|
+
children: [
|
|
3338
|
+
content,
|
|
3339
|
+
sorted && /* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3340
|
+
icon: SORT_ICON[sorted],
|
|
3341
|
+
size: 12,
|
|
3342
|
+
"aria-hidden": "true"
|
|
3343
|
+
}),
|
|
3344
|
+
sortPriority !== void 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
3345
|
+
"aria-hidden": "true",
|
|
3346
|
+
className: "text-[10px] tabular-nums",
|
|
3347
|
+
children: sortPriority
|
|
3348
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
3349
|
+
className: "sr-only",
|
|
3350
|
+
children: [", sort priority ", sortPriority]
|
|
3351
|
+
})] })
|
|
3352
|
+
]
|
|
3353
|
+
}) : content,
|
|
3354
|
+
!header.isPlaceholder && column.getCanFilter() && column.columnDef.meta?.filter && /* @__PURE__ */ jsx(DataTableColumnFilter, { column }),
|
|
3355
|
+
column.getCanResize() && /* @__PURE__ */ jsx(DataTableResizeHandle, { header })
|
|
3356
|
+
]
|
|
3357
|
+
});
|
|
3358
|
+
};
|
|
3359
|
+
/** Holds the height of the rows virtualization leaves unrendered above or below the view. */
|
|
3360
|
+
const DataTableVirtualSpacer = ({ columnCount, height }) => /* @__PURE__ */ jsx("tr", {
|
|
3361
|
+
"aria-hidden": "true",
|
|
3362
|
+
"data-slot": "data-table-virtual-spacer",
|
|
3363
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
3364
|
+
colSpan: columnCount,
|
|
3365
|
+
className: "p-0",
|
|
3366
|
+
style: {
|
|
3367
|
+
borderWidth: 0,
|
|
3368
|
+
height
|
|
3369
|
+
}
|
|
3370
|
+
})
|
|
3371
|
+
});
|
|
3372
|
+
/**
|
|
3373
|
+
* The table itself: headers, rows, and the loading and empty states.
|
|
3374
|
+
*
|
|
3375
|
+
* @example
|
|
3376
|
+
* ```tsx
|
|
3377
|
+
* const dataTable = useDataTable({ columns, data, sorting: { mode: 'client' } });
|
|
3378
|
+
*
|
|
3379
|
+
* <DataTable table={dataTable}>
|
|
3380
|
+
* <DataTableContent emptyTitle="No users yet" />
|
|
3381
|
+
* </DataTable>
|
|
3382
|
+
* ```
|
|
3383
|
+
* @returns The rendered table element.
|
|
3384
|
+
* @see DataTable
|
|
3385
|
+
* @see useDataTable
|
|
3386
|
+
* @see DataTablePagination
|
|
3387
|
+
*/
|
|
3388
|
+
const DataTableContent = ({ className, emptyFilteredTitle = DEFAULT_EMPTY_FILTERED_TITLE, emptyIcon = DefaultEmptyIcon, emptyTitle = DEFAULT_EMPTY_TITLE, loadingRowCount = DEFAULT_LOADING_ROW_COUNT, style, ...props }) => {
|
|
3389
|
+
const { fill, loading, table, virtualization } = useDataTableContext();
|
|
3390
|
+
const viewportRef = useRef(null);
|
|
3391
|
+
const hasFixedLayout = table.options.enableColumnResizing === true || table.options.enableColumnPinning === true || virtualization !== void 0;
|
|
3392
|
+
const columnCount = table.getVisibleLeafColumns().length;
|
|
3393
|
+
const { rows } = table.getRowModel();
|
|
3394
|
+
const headerGroups = table.getHeaderGroups();
|
|
3395
|
+
const headerRowCount = headerGroups.length;
|
|
3396
|
+
const isVirtualized = virtualization !== void 0 && !loading && rows.length > 0;
|
|
3397
|
+
const { estimateRowHeight = 0, overscan = DEFAULT_OVERSCAN } = virtualization ?? {};
|
|
3398
|
+
const getItemKey = useCallback((index) => rows[index].id, [rows]);
|
|
3399
|
+
const virtualizer = useVirtualizer({
|
|
3400
|
+
count: isVirtualized ? rows.length : 0,
|
|
3401
|
+
enabled: isVirtualized,
|
|
3402
|
+
estimateSize: () => estimateRowHeight,
|
|
3403
|
+
getItemKey,
|
|
3404
|
+
getScrollElement: () => viewportRef.current,
|
|
3405
|
+
overscan
|
|
3406
|
+
});
|
|
3407
|
+
const renderVirtualRows = () => {
|
|
3408
|
+
const virtualRows = virtualizer.getVirtualItems();
|
|
3409
|
+
const firstRow = virtualRows.at(0);
|
|
3410
|
+
const lastRow = virtualRows.at(-1);
|
|
3411
|
+
const topHeight = firstRow ? firstRow.start : 0;
|
|
3412
|
+
const bottomHeight = lastRow ? virtualizer.getTotalSize() - lastRow.end : 0;
|
|
3413
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3414
|
+
topHeight > 0 && /* @__PURE__ */ jsx(DataTableVirtualSpacer, {
|
|
3415
|
+
columnCount,
|
|
3416
|
+
height: topHeight
|
|
3417
|
+
}),
|
|
3418
|
+
virtualRows.map(({ index }) => {
|
|
3419
|
+
const row = rows[index];
|
|
3420
|
+
return /* @__PURE__ */ jsx(DataTableBodyRow, {
|
|
3421
|
+
"aria-rowindex": headerRowCount + index + 1,
|
|
3422
|
+
columnCount,
|
|
3423
|
+
"data-index": index,
|
|
3424
|
+
hasFixedLayout,
|
|
3425
|
+
row,
|
|
3426
|
+
rowRef: virtualizer.measureElement
|
|
3427
|
+
}, row.id);
|
|
3428
|
+
}),
|
|
3429
|
+
bottomHeight > 0 && /* @__PURE__ */ jsx(DataTableVirtualSpacer, {
|
|
3430
|
+
columnCount,
|
|
3431
|
+
height: bottomHeight
|
|
3432
|
+
})
|
|
3433
|
+
] });
|
|
3434
|
+
};
|
|
3435
|
+
const renderEmptyRow = () => {
|
|
3436
|
+
const { columnFilters, globalFilter } = table.getState();
|
|
3437
|
+
if (columnFilters.length === 0 && globalFilter === "") return /* @__PURE__ */ jsx(DataTableEmptyRow, {
|
|
3438
|
+
columnCount,
|
|
3439
|
+
icon: emptyIcon,
|
|
3440
|
+
title: emptyTitle
|
|
3441
|
+
});
|
|
3442
|
+
const clearFilters = () => {
|
|
3443
|
+
table.setColumnFilters([]);
|
|
3444
|
+
table.setGlobalFilter("");
|
|
3445
|
+
};
|
|
3446
|
+
return /* @__PURE__ */ jsx(DataTableEmptyRow, {
|
|
3447
|
+
action: /* @__PURE__ */ jsx(Button, {
|
|
3448
|
+
variant: "outline",
|
|
3449
|
+
size: "sm",
|
|
3450
|
+
onClick: clearFilters,
|
|
3451
|
+
children: "Clear filters"
|
|
3452
|
+
}),
|
|
3453
|
+
columnCount,
|
|
3454
|
+
icon: emptyIcon,
|
|
3455
|
+
title: emptyFilteredTitle
|
|
3456
|
+
});
|
|
3457
|
+
};
|
|
3458
|
+
const renderBody = () => {
|
|
3459
|
+
if (loading) return /* @__PURE__ */ jsx(DataTableSkeletonRows, {
|
|
3460
|
+
columnCount,
|
|
3461
|
+
rowCount: loadingRowCount
|
|
3462
|
+
});
|
|
3463
|
+
if (rows.length === 0) return renderEmptyRow();
|
|
3464
|
+
if (isVirtualized) return renderVirtualRows();
|
|
3465
|
+
return rows.map((row) => /* @__PURE__ */ jsx(DataTableBodyRow, {
|
|
3466
|
+
columnCount,
|
|
3467
|
+
hasFixedLayout,
|
|
3468
|
+
row
|
|
3469
|
+
}, row.id));
|
|
3470
|
+
};
|
|
3471
|
+
return /* @__PURE__ */ jsxs(Table, {
|
|
3472
|
+
fill,
|
|
3473
|
+
"aria-busy": loading || void 0,
|
|
3474
|
+
"aria-rowcount": isVirtualized ? rows.length + headerRowCount : void 0,
|
|
3475
|
+
className: cn(hasFixedLayout && "w-auto table-fixed", className),
|
|
3476
|
+
style: hasFixedLayout ? {
|
|
3477
|
+
minWidth: "100%",
|
|
3478
|
+
width: table.getTotalSize(),
|
|
3479
|
+
...style
|
|
3480
|
+
} : style,
|
|
3481
|
+
...props,
|
|
3482
|
+
viewportRef,
|
|
3483
|
+
children: [/* @__PURE__ */ jsx(TableHeader, { children: headerGroups.map((headerGroup, headerIndex) => /* @__PURE__ */ jsx(TableRow, {
|
|
3484
|
+
"aria-rowindex": isVirtualized ? headerIndex + 1 : void 0,
|
|
3485
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(DataTableHeadCell, {
|
|
3486
|
+
header,
|
|
3487
|
+
hasFixedLayout
|
|
3488
|
+
}, header.id))
|
|
3489
|
+
}, headerGroup.id)) }), /* @__PURE__ */ jsx(TableBody, { children: renderBody() })]
|
|
3490
|
+
});
|
|
3491
|
+
};
|
|
3492
|
+
|
|
3493
|
+
//#endregion
|
|
3494
|
+
//#region src/components/ui/data-table/data-table-pagination.tsx
|
|
3495
|
+
/**
|
|
3496
|
+
* Previous and next buttons beside the visible row range, for client or server pagination. Renders nothing when pagination is off.
|
|
3497
|
+
*
|
|
3498
|
+
* @example
|
|
3499
|
+
* ```tsx
|
|
3500
|
+
* const dataTable = useDataTable({
|
|
3501
|
+
* columns,
|
|
3502
|
+
* data,
|
|
3503
|
+
* pagination: { mode: 'client', pageSize: 25 },
|
|
3504
|
+
* });
|
|
3505
|
+
*
|
|
3506
|
+
* <DataTable table={dataTable}>
|
|
3507
|
+
* <DataTableContent />
|
|
3508
|
+
* <DataTablePagination />
|
|
3509
|
+
* </DataTable>
|
|
3510
|
+
* ```
|
|
3511
|
+
* @returns The rendered pagination controls, or `null` when pagination is off.
|
|
3512
|
+
* @see useDataTable
|
|
3513
|
+
* @see DataTable
|
|
3514
|
+
*/
|
|
3515
|
+
const DataTablePagination = ({ className }) => {
|
|
3516
|
+
const { table } = useDataTableContext();
|
|
3517
|
+
if (!table.options.getPaginationRowModel && !table.options.manualPagination) return null;
|
|
3518
|
+
const { pageIndex, pageSize } = table.getState().pagination;
|
|
3519
|
+
const rowCount = table.getRowCount();
|
|
3520
|
+
const start = pageIndex * pageSize + 1;
|
|
3521
|
+
const end = Math.min((pageIndex + 1) * pageSize, rowCount);
|
|
3522
|
+
return /* @__PURE__ */ jsx(CursorPagination, {
|
|
3523
|
+
className,
|
|
3524
|
+
hasNext: table.getCanNextPage(),
|
|
3525
|
+
hasPrevious: table.getCanPreviousPage(),
|
|
3526
|
+
label: rowCount > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3527
|
+
/* @__PURE__ */ jsxs("span", {
|
|
3528
|
+
className: "text-foreground",
|
|
3529
|
+
children: [
|
|
3530
|
+
start,
|
|
3531
|
+
"–",
|
|
3532
|
+
end
|
|
3533
|
+
]
|
|
3534
|
+
}),
|
|
3535
|
+
" ",
|
|
3536
|
+
"of ",
|
|
3537
|
+
rowCount
|
|
3538
|
+
] }) : void 0,
|
|
3539
|
+
onNext: () => table.nextPage(),
|
|
3540
|
+
onPrevious: () => table.previousPage()
|
|
3541
|
+
});
|
|
3542
|
+
};
|
|
3543
|
+
|
|
3544
|
+
//#endregion
|
|
3545
|
+
//#region src/components/ui/data-table/data-table-search.tsx
|
|
3546
|
+
/**
|
|
3547
|
+
* A search field that matches its text across the table's columns. Needs `filtering` in `useDataTable`, and renders nothing without it.
|
|
3548
|
+
* With manual filtering the app receives the text as `globalFilter` and filters the data itself.
|
|
3549
|
+
*
|
|
3550
|
+
* @example
|
|
3551
|
+
* ```tsx
|
|
3552
|
+
* const dataTable = useDataTable({ columns, data, filtering: { mode: 'client' } });
|
|
3553
|
+
*
|
|
3554
|
+
* <DataTable table={dataTable}>
|
|
3555
|
+
* <DataTableToolbar>
|
|
3556
|
+
* <DataTableSearch placeholder="Search users" />
|
|
3557
|
+
* </DataTableToolbar>
|
|
3558
|
+
* <DataTableContent />
|
|
3559
|
+
* </DataTable>
|
|
3560
|
+
* ```
|
|
3561
|
+
* @returns The rendered search field, or nothing when filtering is off.
|
|
3562
|
+
* @see DataTableToolbar
|
|
3563
|
+
* @see DataTableActiveFilters
|
|
3564
|
+
* @see useDataTable
|
|
3565
|
+
*/
|
|
3566
|
+
const DataTableSearch = ({ className, placeholder = "Search" }) => {
|
|
3567
|
+
const { table } = useDataTableContext();
|
|
3568
|
+
if (!table.options.enableGlobalFilter) return null;
|
|
3569
|
+
const { globalFilter } = table.getState();
|
|
3570
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3571
|
+
"data-slot": "data-table-search",
|
|
3572
|
+
className: cn("relative w-full max-w-64", className),
|
|
3573
|
+
children: [/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
3574
|
+
icon: Search01Icon,
|
|
3575
|
+
size: 16,
|
|
3576
|
+
"aria-hidden": "true",
|
|
3577
|
+
className: "pointer-events-none absolute start-2 top-1/2 -translate-y-1/2 text-muted-foreground/70"
|
|
3578
|
+
}), /* @__PURE__ */ jsx(Input, {
|
|
3579
|
+
type: "search",
|
|
3580
|
+
"aria-label": placeholder,
|
|
3581
|
+
placeholder,
|
|
3582
|
+
value: typeof globalFilter === "string" ? globalFilter : "",
|
|
3583
|
+
onChange: (event) => table.setGlobalFilter(event.target.value),
|
|
3584
|
+
className: "ps-8"
|
|
3585
|
+
})]
|
|
3586
|
+
});
|
|
3587
|
+
};
|
|
3588
|
+
|
|
3589
|
+
//#endregion
|
|
3590
|
+
//#region src/components/ui/data-table/use-data-table.ts
|
|
3591
|
+
/** Keeps the pagination state complete when the app has not turned pagination on. */
|
|
3592
|
+
const DEFAULT_PAGE_SIZE = 25;
|
|
3593
|
+
/** Columns filter only when they opt in with `meta.filter` (see `withColumnFilters`). A module constant, so the table gets the same object each render. */
|
|
3594
|
+
const DEFAULT_COLUMN = { enableColumnFilter: false };
|
|
3595
|
+
const isControlled = (feature) => feature !== void 0 && "state" in feature;
|
|
3596
|
+
/**
|
|
3597
|
+
* 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.
|
|
3598
|
+
* When it is not only the end edge that gained, the start edge wins.
|
|
3599
|
+
*/
|
|
3600
|
+
const toOneEdge = ({ next, previous }) => {
|
|
3601
|
+
const left = next.left ?? [];
|
|
3602
|
+
const right = next.right ?? [];
|
|
3603
|
+
if (left.length > 0 && right.length > 0) {
|
|
3604
|
+
const previousLeft = previous.left ?? [];
|
|
3605
|
+
const previousRight = previous.right ?? [];
|
|
3606
|
+
return right.some((id) => !previousRight.includes(id)) && left.every((id) => previousLeft.includes(id)) ? { right } : { left };
|
|
3607
|
+
}
|
|
3608
|
+
return right.length > 0 ? { right } : { left };
|
|
3609
|
+
};
|
|
3610
|
+
const getInitialState = ({ fallback, feature }) => feature && !isControlled(feature) ? feature.initial ?? fallback : fallback;
|
|
3611
|
+
/** The table hands over updaters; the app expects the next value, resolved against its current state. */
|
|
3612
|
+
const toTableFeatureState = (feature) => ({
|
|
3613
|
+
onChange: (updater) => feature.onChange(functionalUpdate(updater, feature.state)),
|
|
3614
|
+
state: feature.state
|
|
3615
|
+
});
|
|
3616
|
+
/** Use the app's state when it owns the feature, otherwise the table's own. */
|
|
3617
|
+
const resolveFeatureState = ({ feature, internal, setInternal }) => isControlled(feature) ? toTableFeatureState(feature) : {
|
|
3618
|
+
onChange: setInternal,
|
|
3619
|
+
state: internal
|
|
3620
|
+
};
|
|
3621
|
+
/**
|
|
3622
|
+
* Matches a row when its value is one of the checked values, or, for a list value, when any item is.
|
|
3623
|
+
* TanStack's `arrIncludesSome` calls `includes` on the row value, which matches substrings of strings and throws on numbers.
|
|
3624
|
+
* Clearing every value removes the filter.
|
|
3625
|
+
*/
|
|
3626
|
+
const includesSomeValue = Object.assign((row, columnId, filterValue) => {
|
|
3627
|
+
const value = row.getValue(columnId);
|
|
3628
|
+
return Array.isArray(value) ? value.some((item) => filterValue.includes(String(item))) : filterValue.includes(String(value));
|
|
3629
|
+
}, { autoRemove: (value) => !Array.isArray(value) || value.length === 0 });
|
|
3630
|
+
/**
|
|
3631
|
+
* Give each column with `meta.filter` a matching filter function and let it filter, recursing into column groups.
|
|
3632
|
+
* TanStack's `auto` filter guesses from the first row's value, so a checklist of values over string cells would get a string filter.
|
|
3633
|
+
*/
|
|
3634
|
+
const withColumnFilters = (columns) => columns.map((column) => {
|
|
3635
|
+
const withGroups = "columns" in column && column.columns ? {
|
|
3636
|
+
...column,
|
|
3637
|
+
columns: withColumnFilters(column.columns)
|
|
3638
|
+
} : column;
|
|
3639
|
+
const filter = column.meta?.filter;
|
|
3640
|
+
if (!filter) return withGroups;
|
|
3641
|
+
return {
|
|
3642
|
+
...withGroups,
|
|
3643
|
+
enableColumnFilter: column.enableColumnFilter ?? true,
|
|
3644
|
+
filterFn: column.filterFn ?? (filter === "values" ? includesSomeValue : "includesString")
|
|
3645
|
+
};
|
|
3646
|
+
});
|
|
3647
|
+
/** The filters a table starts with: the app's seed for client filtering, nothing otherwise. */
|
|
3648
|
+
const getInitialFilters = ({ filtering }) => {
|
|
3649
|
+
const initial = filtering?.mode === "client" ? filtering.initial : void 0;
|
|
3650
|
+
return {
|
|
3651
|
+
columnFilters: initial?.columnFilters ?? [],
|
|
3652
|
+
globalFilter: initial?.globalFilter ?? ""
|
|
3653
|
+
};
|
|
3654
|
+
};
|
|
3655
|
+
/**
|
|
3656
|
+
* Filter state and change handlers for search and column filters, which share one state.
|
|
3657
|
+
* `onFiltersChange` runs after every change, so the caller can react to it (pagination returns to the first page).
|
|
3658
|
+
*/
|
|
3659
|
+
const useFilterState = ({ filtering, onFiltersChange }) => {
|
|
3660
|
+
const [internalFilters, setInternalFilters] = useState(() => getInitialFilters({ filtering }));
|
|
3661
|
+
const manual = filtering?.mode === "manual" ? filtering : void 0;
|
|
3662
|
+
const latestManualFilters = useRef(void 0);
|
|
3663
|
+
latestManualFilters.current = manual?.state;
|
|
3664
|
+
const updateFilters = (updater) => {
|
|
3665
|
+
if (manual) {
|
|
3666
|
+
const next = functionalUpdate(updater, latestManualFilters.current ?? manual.state);
|
|
3667
|
+
latestManualFilters.current = next;
|
|
3668
|
+
manual.onChange(next);
|
|
3669
|
+
} else setInternalFilters(updater);
|
|
3670
|
+
onFiltersChange();
|
|
3671
|
+
};
|
|
3672
|
+
return {
|
|
3673
|
+
filterState: manual ? manual.state : internalFilters,
|
|
3674
|
+
handleColumnFiltersChange: (updater) => updateFilters((old) => ({
|
|
3675
|
+
...old,
|
|
3676
|
+
columnFilters: functionalUpdate(updater, old.columnFilters)
|
|
3677
|
+
})),
|
|
3678
|
+
handleGlobalFilterChange: (updater) => updateFilters((old) => ({
|
|
3679
|
+
...old,
|
|
3680
|
+
globalFilter: functionalUpdate(updater, old.globalFilter) ?? ""
|
|
3681
|
+
}))
|
|
3682
|
+
};
|
|
3683
|
+
};
|
|
3684
|
+
/** Pinning state where every change goes through toOneEdge, so the table and a controlled onChange only ever see one pinned edge. */
|
|
3685
|
+
const resolvePinningState = ({ columnPinning, internal, setInternal }) => {
|
|
3686
|
+
if (isControlled(columnPinning)) return {
|
|
3687
|
+
onChange: (updater) => columnPinning.onChange(toOneEdge({
|
|
3688
|
+
next: functionalUpdate(updater, columnPinning.state),
|
|
3689
|
+
previous: columnPinning.state
|
|
3690
|
+
})),
|
|
3691
|
+
state: columnPinning.state
|
|
3692
|
+
};
|
|
3693
|
+
return {
|
|
3694
|
+
onChange: (updater) => setInternal((old) => toOneEdge({
|
|
3695
|
+
next: functionalUpdate(updater, old),
|
|
3696
|
+
previous: old
|
|
3697
|
+
})),
|
|
3698
|
+
state: internal
|
|
3699
|
+
};
|
|
3700
|
+
};
|
|
3701
|
+
/** Row models for the features the table runs in memory; manual features leave their step to the app. */
|
|
3702
|
+
const getRowModels = ({ filtering, grouping, pagination, sorting }) => {
|
|
3703
|
+
const clientFiltering = filtering?.mode === "client";
|
|
3704
|
+
return {
|
|
3705
|
+
getExpandedRowModel: grouping ? getExpandedRowModel() : void 0,
|
|
3706
|
+
getFacetedRowModel: clientFiltering ? getFacetedRowModel() : void 0,
|
|
3707
|
+
getFacetedUniqueValues: clientFiltering ? getFacetedUniqueValues() : void 0,
|
|
3708
|
+
getFilteredRowModel: clientFiltering ? getFilteredRowModel() : void 0,
|
|
3709
|
+
getGroupedRowModel: grouping ? getGroupedRowModel() : void 0,
|
|
3710
|
+
getPaginationRowModel: pagination?.mode === "client" ? getPaginationRowModel() : void 0,
|
|
3711
|
+
getSortedRowModel: sorting?.mode === "client" ? getSortedRowModel() : void 0
|
|
3712
|
+
};
|
|
3713
|
+
};
|
|
3714
|
+
/**
|
|
3715
|
+
* Page resets are off (see autoResetPageIndex), so when the data shrinks the page can run past the end.
|
|
3716
|
+
* Clamping only when out of range keeps a fresh data array each render from looping.
|
|
3717
|
+
*/
|
|
3718
|
+
const useClampedPageIndex = ({ isClientPagination, pageIndex, table }) => {
|
|
3719
|
+
const lastPageIndex = Math.max(0, table.getPageCount() - 1);
|
|
3720
|
+
useEffect(() => {
|
|
3721
|
+
if (isClientPagination && pageIndex > lastPageIndex) table.setPageIndex(lastPageIndex);
|
|
3722
|
+
}, [
|
|
3723
|
+
isClientPagination,
|
|
3724
|
+
lastPageIndex,
|
|
3725
|
+
pageIndex,
|
|
3726
|
+
table
|
|
3727
|
+
]);
|
|
3728
|
+
};
|
|
3729
|
+
/**
|
|
3730
|
+
* Create the state for a `DataTable`. Each feature stays off until its option is passed.
|
|
3731
|
+
* Pass `{ state, onChange }` to own a feature's state, or `mode: 'manual'` for server-driven sorting and pagination.
|
|
3732
|
+
* `onChange` receives the next state, ready to store.
|
|
3733
|
+
*
|
|
3734
|
+
* @example
|
|
3735
|
+
* const dataTable = useDataTable({
|
|
3736
|
+
* columns,
|
|
3737
|
+
* data,
|
|
3738
|
+
* pagination: { mode: 'client', pageSize: 25 },
|
|
3739
|
+
* sorting: { mode: 'client' },
|
|
3740
|
+
* });
|
|
3741
|
+
*
|
|
3742
|
+
* <DataTable table={dataTable}>
|
|
3743
|
+
* <DataTableContent />
|
|
3744
|
+
* <DataTablePagination />
|
|
3745
|
+
* </DataTable>
|
|
3746
|
+
* @returns A table instance to pass to `DataTable` as `table`.
|
|
3747
|
+
* @see UseDataTableOptions
|
|
3748
|
+
* @see DataTable
|
|
3749
|
+
* @see DataTableContent
|
|
3750
|
+
*/
|
|
3751
|
+
const useDataTable = ({ columnPinning, columnSizing, columnVisibility, columns, data, filtering, getRowId, grouping, loading = false, pagination, selection, sorting, virtualization }) => {
|
|
3752
|
+
const [internalSorting, setInternalSorting] = useState(sorting?.mode === "client" ? sorting.initial ?? [] : []);
|
|
3753
|
+
const [internalPagination, setInternalPagination] = useState({
|
|
3754
|
+
pageIndex: 0,
|
|
3755
|
+
pageSize: pagination?.mode === "client" ? pagination.pageSize : DEFAULT_PAGE_SIZE
|
|
3756
|
+
});
|
|
3757
|
+
const [internalSelection, setInternalSelection] = useState(getInitialState({
|
|
3758
|
+
fallback: {},
|
|
3759
|
+
feature: selection
|
|
3760
|
+
}));
|
|
3761
|
+
const [internalVisibility, setInternalVisibility] = useState(getInitialState({
|
|
3762
|
+
fallback: {},
|
|
3763
|
+
feature: columnVisibility
|
|
3764
|
+
}));
|
|
3765
|
+
const [internalPinning, setInternalPinning] = useState(getInitialState({
|
|
3766
|
+
fallback: { left: [] },
|
|
3767
|
+
feature: columnPinning
|
|
3768
|
+
}));
|
|
3769
|
+
const [internalSizing, setInternalSizing] = useState(getInitialState({
|
|
3770
|
+
fallback: {},
|
|
3771
|
+
feature: columnSizing
|
|
3772
|
+
}));
|
|
3773
|
+
const [expandedGroups, setExpandedGroups] = useState(true);
|
|
3774
|
+
const [internalGrouping, setInternalGrouping] = useState(getInitialState({
|
|
3775
|
+
fallback: [],
|
|
3776
|
+
feature: grouping
|
|
3777
|
+
}));
|
|
3778
|
+
const tableColumns = useMemo(() => withColumnFilters(columns), [columns]);
|
|
3779
|
+
const isClientPagination = pagination?.mode === "client";
|
|
3780
|
+
const handleClientSortingChange = (updater) => {
|
|
3781
|
+
setInternalSorting(updater);
|
|
3782
|
+
if (isClientPagination) setInternalPagination((old) => ({
|
|
3783
|
+
...old,
|
|
3784
|
+
pageIndex: 0
|
|
3785
|
+
}));
|
|
3786
|
+
};
|
|
3787
|
+
const { filterState, handleColumnFiltersChange, handleGlobalFilterChange } = useFilterState({
|
|
3788
|
+
filtering,
|
|
3789
|
+
onFiltersChange: () => {
|
|
3790
|
+
if (isClientPagination) setInternalPagination((old) => ({
|
|
3791
|
+
...old,
|
|
3792
|
+
pageIndex: 0
|
|
3793
|
+
}));
|
|
3794
|
+
}
|
|
3795
|
+
});
|
|
3796
|
+
const sortingState = sorting?.mode === "manual" ? toTableFeatureState(sorting) : {
|
|
3797
|
+
onChange: handleClientSortingChange,
|
|
3798
|
+
state: internalSorting
|
|
3799
|
+
};
|
|
3800
|
+
const paginationState = pagination?.mode === "manual" ? toTableFeatureState(pagination) : {
|
|
3801
|
+
onChange: setInternalPagination,
|
|
3802
|
+
state: internalPagination
|
|
3803
|
+
};
|
|
3804
|
+
const selectionState = resolveFeatureState({
|
|
3805
|
+
feature: selection,
|
|
3806
|
+
internal: internalSelection,
|
|
3807
|
+
setInternal: setInternalSelection
|
|
3808
|
+
});
|
|
3809
|
+
const visibilityState = resolveFeatureState({
|
|
3810
|
+
feature: columnVisibility,
|
|
3811
|
+
internal: internalVisibility,
|
|
3812
|
+
setInternal: setInternalVisibility
|
|
3813
|
+
});
|
|
3814
|
+
const pinningState = resolvePinningState({
|
|
3815
|
+
columnPinning,
|
|
3816
|
+
internal: internalPinning,
|
|
3817
|
+
setInternal: setInternalPinning
|
|
3818
|
+
});
|
|
3819
|
+
const sizingState = resolveFeatureState({
|
|
3820
|
+
feature: columnSizing,
|
|
3821
|
+
internal: internalSizing,
|
|
3822
|
+
setInternal: setInternalSizing
|
|
3823
|
+
});
|
|
3824
|
+
const groupingState = resolveFeatureState({
|
|
3825
|
+
feature: grouping,
|
|
3826
|
+
internal: internalGrouping,
|
|
3827
|
+
setInternal: setInternalGrouping
|
|
3828
|
+
});
|
|
3829
|
+
const table = useReactTable({
|
|
3830
|
+
autoResetExpanded: false,
|
|
3831
|
+
autoResetPageIndex: false,
|
|
3832
|
+
columnResizeMode: "onChange",
|
|
3833
|
+
columns: tableColumns,
|
|
3834
|
+
data,
|
|
3835
|
+
defaultColumn: DEFAULT_COLUMN,
|
|
3836
|
+
enableColumnFilters: filtering !== void 0,
|
|
3837
|
+
enableColumnPinning: columnPinning !== void 0,
|
|
3838
|
+
enableColumnResizing: columnSizing !== void 0,
|
|
3839
|
+
enableExpanding: grouping !== void 0,
|
|
3840
|
+
enableGlobalFilter: filtering !== void 0,
|
|
3841
|
+
enableGrouping: grouping !== void 0,
|
|
3842
|
+
enableRowSelection: selection === void 0 ? false : (row) => !row.getIsGrouped(),
|
|
3843
|
+
enableSorting: sorting !== void 0,
|
|
3844
|
+
getCoreRowModel: getCoreRowModel(),
|
|
3845
|
+
...getRowModels({
|
|
3846
|
+
filtering,
|
|
3847
|
+
grouping,
|
|
3848
|
+
pagination,
|
|
3849
|
+
sorting
|
|
3850
|
+
}),
|
|
3851
|
+
getRowId,
|
|
3852
|
+
groupedColumnMode: false,
|
|
3853
|
+
manualFiltering: filtering?.mode === "manual",
|
|
3854
|
+
manualPagination: pagination?.mode === "manual",
|
|
3855
|
+
manualSorting: sorting?.mode === "manual",
|
|
3856
|
+
onColumnFiltersChange: handleColumnFiltersChange,
|
|
3857
|
+
onColumnPinningChange: pinningState.onChange,
|
|
3858
|
+
onColumnSizingChange: sizingState.onChange,
|
|
3859
|
+
onColumnVisibilityChange: visibilityState.onChange,
|
|
3860
|
+
onExpandedChange: setExpandedGroups,
|
|
3861
|
+
onGlobalFilterChange: handleGlobalFilterChange,
|
|
3862
|
+
onGroupingChange: groupingState.onChange,
|
|
3863
|
+
onPaginationChange: paginationState.onChange,
|
|
3864
|
+
onRowSelectionChange: selectionState.onChange,
|
|
3865
|
+
onSortingChange: sortingState.onChange,
|
|
3866
|
+
rowCount: pagination?.mode === "manual" ? pagination.rowCount : void 0,
|
|
3867
|
+
state: {
|
|
3868
|
+
columnFilters: filterState.columnFilters,
|
|
3869
|
+
columnPinning: pinningState.state,
|
|
3870
|
+
columnSizing: sizingState.state,
|
|
3871
|
+
columnVisibility: visibilityState.state,
|
|
3872
|
+
expanded: expandedGroups,
|
|
3873
|
+
globalFilter: filterState.globalFilter,
|
|
3874
|
+
grouping: groupingState.state,
|
|
3875
|
+
pagination: paginationState.state,
|
|
3876
|
+
rowSelection: selectionState.state,
|
|
3877
|
+
sorting: sortingState.state
|
|
3878
|
+
}
|
|
3879
|
+
});
|
|
3880
|
+
useClampedPageIndex({
|
|
3881
|
+
isClientPagination,
|
|
3882
|
+
pageIndex: paginationState.state.pageIndex,
|
|
3883
|
+
table
|
|
3884
|
+
});
|
|
3885
|
+
return {
|
|
3886
|
+
loading,
|
|
3887
|
+
table,
|
|
3888
|
+
virtualization
|
|
3889
|
+
};
|
|
3890
|
+
};
|
|
3891
|
+
|
|
3892
|
+
//#endregion
|
|
3893
|
+
//#region src/components/ui/tabs/tabs.tsx
|
|
3894
|
+
const Tabs = ({ className, orientation = "horizontal", ...props }) => {
|
|
3895
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Root, {
|
|
3896
|
+
"data-slot": "tabs",
|
|
3897
|
+
"data-orientation": orientation,
|
|
3898
|
+
orientation,
|
|
3899
|
+
className: cn("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col", className),
|
|
3900
|
+
...props
|
|
3901
|
+
});
|
|
3902
|
+
};
|
|
3903
|
+
const tabsListVariants = cva("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col", {
|
|
2460
3904
|
defaultVariants: { variant: "default" },
|
|
2461
3905
|
variants: { variant: {
|
|
2462
3906
|
default: "bg-muted",
|
|
@@ -2464,14 +3908,14 @@ const tabsListVariants = cva("rounded-lg p-[3px] group-data-[orientation=horizon
|
|
|
2464
3908
|
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
3909
|
} }
|
|
2466
3910
|
});
|
|
2467
|
-
const TabsList = ({ className, variant = "default", ...props }) => {
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
3911
|
+
const TabsList = forwardRef(({ className, variant = "default", ...props }, ref) => /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
3912
|
+
ref,
|
|
3913
|
+
"data-slot": "tabs-list",
|
|
3914
|
+
"data-variant": variant,
|
|
3915
|
+
className: cn(tabsListVariants({ variant }), className),
|
|
3916
|
+
...props
|
|
3917
|
+
}));
|
|
3918
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
2475
3919
|
const TabsTrigger = ({ className, ...props }) => {
|
|
2476
3920
|
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, {
|
|
2477
3921
|
"data-slot": "tabs-trigger",
|
|
@@ -2633,11 +4077,23 @@ const Textarea = ({ className, ...props }) => {
|
|
|
2633
4077
|
const TooltipProvider = Provider;
|
|
2634
4078
|
const Tooltip = Root$6;
|
|
2635
4079
|
const TooltipTrigger = Trigger$5;
|
|
2636
|
-
const TooltipContent = forwardRef(({ className, sideOffset =
|
|
4080
|
+
const TooltipContent = forwardRef(({ children, className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Portal$4, { children: /* @__PURE__ */ jsxs(Content$5, {
|
|
2637
4081
|
ref,
|
|
4082
|
+
"data-slot": "tooltip-content",
|
|
2638
4083
|
sideOffset,
|
|
2639
|
-
className: cn("z-50 max-w-xs
|
|
2640
|
-
...props
|
|
4084
|
+
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),
|
|
4085
|
+
...props,
|
|
4086
|
+
children: [children, /* @__PURE__ */ jsx(Arrow, {
|
|
4087
|
+
asChild: true,
|
|
4088
|
+
height: 5,
|
|
4089
|
+
width: 10,
|
|
4090
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
4091
|
+
"aria-hidden": "true",
|
|
4092
|
+
className: "-translate-y-px fill-[var(--tooltip-bg)]",
|
|
4093
|
+
viewBox: "0 0 10 5",
|
|
4094
|
+
children: /* @__PURE__ */ jsx("path", { d: "M0 0H10L5.88 4.12a1.25 1.25 0 0 1-1.76 0Z" })
|
|
4095
|
+
})
|
|
4096
|
+
})]
|
|
2641
4097
|
}) }));
|
|
2642
4098
|
TooltipContent.displayName = Content$5.displayName;
|
|
2643
4099
|
|
|
@@ -2694,9 +4150,10 @@ const AssetIcon = ({ symbol, size = 32, className }) => {
|
|
|
2694
4150
|
//#endregion
|
|
2695
4151
|
//#region src/components/copy-button/copy-button.tsx
|
|
2696
4152
|
const TIMING = {
|
|
2697
|
-
|
|
2698
|
-
iconSwap:
|
|
2699
|
-
reset: 120
|
|
4153
|
+
errorHold: 2e3,
|
|
4154
|
+
iconSwap: 200,
|
|
4155
|
+
reset: 120,
|
|
4156
|
+
successHold: 1e3
|
|
2700
4157
|
};
|
|
2701
4158
|
const COPY_STAGE = {
|
|
2702
4159
|
copied: 1,
|
|
@@ -2704,12 +4161,18 @@ const COPY_STAGE = {
|
|
|
2704
4161
|
idle: 0
|
|
2705
4162
|
};
|
|
2706
4163
|
const ICON = {
|
|
4164
|
+
activeBlur: "blur(0px)",
|
|
2707
4165
|
activeScale: 1,
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
4166
|
+
inactiveBlur: "blur(4px)",
|
|
4167
|
+
inactiveScale: .25,
|
|
4168
|
+
transition: {
|
|
4169
|
+
duration: TIMING.iconSwap / 1e3,
|
|
4170
|
+
ease: [
|
|
4171
|
+
.4,
|
|
4172
|
+
0,
|
|
4173
|
+
.2,
|
|
4174
|
+
1
|
|
4175
|
+
]
|
|
2713
4176
|
}
|
|
2714
4177
|
};
|
|
2715
4178
|
const LABEL = {
|
|
@@ -2730,6 +4193,7 @@ const HIDDEN_RESET_TRANSITION = {
|
|
|
2730
4193
|
duration: 0
|
|
2731
4194
|
};
|
|
2732
4195
|
const ICON_RESET_TRANSITION = {
|
|
4196
|
+
filter: HIDDEN_RESET_TRANSITION,
|
|
2733
4197
|
opacity: RESET_TRANSITION,
|
|
2734
4198
|
scale: HIDDEN_RESET_TRANSITION
|
|
2735
4199
|
};
|
|
@@ -2739,12 +4203,11 @@ const LABEL_RESET_TRANSITION = {
|
|
|
2739
4203
|
};
|
|
2740
4204
|
const REDUCED_MOTION_TRANSITION = { duration: 0 };
|
|
2741
4205
|
/** Copies a value and presents stable, accessible success or failure feedback. */
|
|
2742
|
-
const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", className }) => {
|
|
4206
|
+
const CopyButton = ({ value, ariaLabel: idleAriaLabel, label, variant = "outline", size = "icon-xs", className }) => {
|
|
2743
4207
|
const [stage, setStage] = useState(COPY_STAGE.idle);
|
|
2744
4208
|
const timeoutRef = useRef(null);
|
|
2745
4209
|
const requestIdRef = useRef(0);
|
|
2746
4210
|
const shouldReduceMotion = useReducedMotion();
|
|
2747
|
-
const animationStyle = { willChange: shouldReduceMotion ? "auto" : "transform, opacity" };
|
|
2748
4211
|
useEffect(() => {
|
|
2749
4212
|
return () => {
|
|
2750
4213
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
@@ -2753,7 +4216,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
2753
4216
|
const showFeedback = (nextStage) => {
|
|
2754
4217
|
setStage(nextStage);
|
|
2755
4218
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2756
|
-
timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), TIMING.
|
|
4219
|
+
timeoutRef.current = setTimeout(() => setStage(COPY_STAGE.idle), nextStage === COPY_STAGE.error ? TIMING.errorHold : TIMING.successHold);
|
|
2757
4220
|
};
|
|
2758
4221
|
const handleCopy = async () => {
|
|
2759
4222
|
const requestId = ++requestIdRef.current;
|
|
@@ -2764,7 +4227,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
2764
4227
|
if (requestId === requestIdRef.current) showFeedback(COPY_STAGE.error);
|
|
2765
4228
|
}
|
|
2766
4229
|
};
|
|
2767
|
-
let ariaLabel = label || "Copy to clipboard";
|
|
4230
|
+
let ariaLabel = idleAriaLabel || label || "Copy to clipboard";
|
|
2768
4231
|
let announcement = "";
|
|
2769
4232
|
if (stage === COPY_STAGE.copied) {
|
|
2770
4233
|
ariaLabel = "Copied";
|
|
@@ -2773,7 +4236,7 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
2773
4236
|
ariaLabel = "Copy failed";
|
|
2774
4237
|
announcement = "Copy failed";
|
|
2775
4238
|
}
|
|
2776
|
-
let iconTransition = ICON.
|
|
4239
|
+
let iconTransition = ICON.transition;
|
|
2777
4240
|
let labelTransition = LABEL.spring;
|
|
2778
4241
|
if (stage === COPY_STAGE.idle) {
|
|
2779
4242
|
iconTransition = ICON_RESET_TRANSITION;
|
|
@@ -2794,8 +4257,8 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
2794
4257
|
},
|
|
2795
4258
|
{
|
|
2796
4259
|
icon: /* @__PURE__ */ jsx(CheckIcon, {
|
|
2797
|
-
|
|
2798
|
-
|
|
4260
|
+
className: "[&_path]:[stroke-width:var(--icon-stroke-width,1.75)]",
|
|
4261
|
+
size: null
|
|
2799
4262
|
}),
|
|
2800
4263
|
label: label ? "Copied" : void 0,
|
|
2801
4264
|
stage: COPY_STAGE.copied
|
|
@@ -2825,17 +4288,18 @@ const CopyButton = ({ value, label, variant = "outline", size = "icon-xs", class
|
|
|
2825
4288
|
className: "col-start-1 row-start-1 flex items-center gap-1.5",
|
|
2826
4289
|
children: [/* @__PURE__ */ jsx(motion.span, {
|
|
2827
4290
|
initial: false,
|
|
4291
|
+
"data-slot": visualState.stage === COPY_STAGE.copied ? "copy-button-check" : void 0,
|
|
4292
|
+
"data-state": isActive ? "checked" : "unchecked",
|
|
2828
4293
|
animate: {
|
|
4294
|
+
filter: isIdleVisual || isActive ? ICON.activeBlur : ICON.inactiveBlur,
|
|
2829
4295
|
opacity: isActive ? 1 : 0,
|
|
2830
4296
|
scale: isIdleVisual || isActive ? ICON.activeScale : ICON.inactiveScale
|
|
2831
4297
|
},
|
|
2832
4298
|
transition: iconTransition,
|
|
2833
|
-
style: animationStyle,
|
|
2834
4299
|
className: "flex items-center",
|
|
2835
4300
|
children: visualState.icon
|
|
2836
4301
|
}), visualState.label && /* @__PURE__ */ jsx(motion.span, {
|
|
2837
4302
|
initial: false,
|
|
2838
|
-
style: animationStyle,
|
|
2839
4303
|
animate: {
|
|
2840
4304
|
opacity: isActive ? 1 : 0,
|
|
2841
4305
|
y: isIdleVisual || isActive ? LABEL.activeOffset : LABEL.inactiveOffset
|
|
@@ -3060,7 +4524,7 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
|
|
|
3060
4524
|
children: domains.map((domain) => /* @__PURE__ */ jsxs("li", {
|
|
3061
4525
|
className: "flex items-center justify-between gap-2 rounded-md border bg-[var(--bg-bottom)] px-3 py-2 text-sm",
|
|
3062
4526
|
children: [/* @__PURE__ */ jsx("span", {
|
|
3063
|
-
className: "
|
|
4527
|
+
className: "text-sm tabular-nums truncate",
|
|
3064
4528
|
children: domain
|
|
3065
4529
|
}), /* @__PURE__ */ jsx("button", {
|
|
3066
4530
|
type: "button",
|
|
@@ -3076,32 +4540,6 @@ const DomainList = ({ className, domains, onChange, placeholder = "https://examp
|
|
|
3076
4540
|
});
|
|
3077
4541
|
};
|
|
3078
4542
|
|
|
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
4543
|
//#endregion
|
|
3106
4544
|
//#region src/components/info-banner/info-banner.tsx
|
|
3107
4545
|
const spring$1 = {
|
|
@@ -3393,47 +4831,40 @@ const SettingsSection = ({ title, description, children, variant = "default", cl
|
|
|
3393
4831
|
//#region src/components/status-badge/status-badge.tsx
|
|
3394
4832
|
const statusConfig = {
|
|
3395
4833
|
active: {
|
|
3396
|
-
dot: true,
|
|
3397
4834
|
label: "Active",
|
|
3398
4835
|
variant: "success"
|
|
3399
4836
|
},
|
|
3400
4837
|
blocked: {
|
|
3401
|
-
dot: true,
|
|
3402
4838
|
label: "Blocked",
|
|
3403
4839
|
variant: "danger"
|
|
3404
4840
|
},
|
|
3405
4841
|
inactive: {
|
|
3406
|
-
dot: true,
|
|
3407
4842
|
label: "Inactive",
|
|
3408
4843
|
variant: "inactive"
|
|
3409
4844
|
},
|
|
3410
4845
|
live: {
|
|
3411
|
-
dot: true,
|
|
3412
4846
|
label: "Live",
|
|
3413
4847
|
variant: "success"
|
|
3414
4848
|
},
|
|
3415
4849
|
pending: {
|
|
3416
|
-
dot: true,
|
|
3417
4850
|
label: "Pending",
|
|
3418
4851
|
variant: "warning"
|
|
3419
4852
|
},
|
|
3420
4853
|
processing: {
|
|
3421
|
-
dot: true,
|
|
3422
4854
|
label: "Processing",
|
|
3423
4855
|
variant: "process"
|
|
3424
4856
|
},
|
|
3425
4857
|
sandbox: {
|
|
3426
|
-
dot: true,
|
|
3427
4858
|
label: "Sandbox",
|
|
3428
4859
|
variant: "warning"
|
|
3429
4860
|
}
|
|
3430
4861
|
};
|
|
3431
4862
|
const StatusBadge = ({ status, label, className }) => {
|
|
3432
4863
|
const config = statusConfig[status];
|
|
3433
|
-
return /* @__PURE__ */
|
|
4864
|
+
return /* @__PURE__ */ jsx(Badge, {
|
|
3434
4865
|
variant: config.variant,
|
|
3435
|
-
className
|
|
3436
|
-
children:
|
|
4866
|
+
className,
|
|
4867
|
+
children: label || config.label
|
|
3437
4868
|
});
|
|
3438
4869
|
};
|
|
3439
4870
|
|
|
@@ -3467,8 +4898,24 @@ const StatusBadge = ({ status, label, className }) => {
|
|
|
3467
4898
|
const TabNavigation = ({ children, defaultValue, items, listLabel, onValueChange, value, ...props }) => {
|
|
3468
4899
|
const [internalValue, setInternalValue] = useState(defaultValue ?? items.find((item) => !item.disabled)?.value);
|
|
3469
4900
|
const selectedValue = value ?? internalValue;
|
|
3470
|
-
const indicatorId = useId();
|
|
3471
4901
|
const shouldReduceMotion = useReducedMotion();
|
|
4902
|
+
const listRef = useRef(null);
|
|
4903
|
+
const [indicator, setIndicator] = useState();
|
|
4904
|
+
useLayoutEffect(() => {
|
|
4905
|
+
const list = listRef.current;
|
|
4906
|
+
if (!list) return;
|
|
4907
|
+
const measure = () => {
|
|
4908
|
+
const active = list.querySelector("[data-slot=\"tabs-trigger\"][data-state=\"active\"]");
|
|
4909
|
+
setIndicator(active ? {
|
|
4910
|
+
left: active.offsetLeft,
|
|
4911
|
+
width: active.offsetWidth
|
|
4912
|
+
} : void 0);
|
|
4913
|
+
};
|
|
4914
|
+
measure();
|
|
4915
|
+
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(measure);
|
|
4916
|
+
list.querySelectorAll("[data-slot=\"tabs-trigger\"]").forEach((trigger) => observer?.observe(trigger));
|
|
4917
|
+
return () => observer?.disconnect();
|
|
4918
|
+
}, [selectedValue, items]);
|
|
3472
4919
|
const [prevItems, setPrevItems] = useState(items);
|
|
3473
4920
|
if (prevItems !== items) {
|
|
3474
4921
|
setPrevItems(items);
|
|
@@ -3481,27 +4928,33 @@ const TabNavigation = ({ children, defaultValue, items, listLabel, onValueChange
|
|
|
3481
4928
|
setInternalValue(nextValue);
|
|
3482
4929
|
onValueChange?.(nextValue);
|
|
3483
4930
|
},
|
|
3484
|
-
children: [/* @__PURE__ */
|
|
4931
|
+
children: [/* @__PURE__ */ jsxs(TabsList, {
|
|
3485
4932
|
variant: "navigation",
|
|
3486
4933
|
"aria-label": listLabel,
|
|
3487
|
-
|
|
4934
|
+
ref: listRef,
|
|
4935
|
+
className: "relative",
|
|
4936
|
+
children: [items.map(({ disabled, label, value: value$1 }) => /* @__PURE__ */ jsx(TabsTrigger, {
|
|
3488
4937
|
value: value$1,
|
|
3489
4938
|
disabled,
|
|
3490
|
-
children:
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
4939
|
+
children: label
|
|
4940
|
+
}, value$1)), indicator && /* @__PURE__ */ jsx(motion.span, {
|
|
4941
|
+
"aria-hidden": "true",
|
|
4942
|
+
className: "pointer-events-none absolute left-0 -bottom-px h-px bg-(--action)",
|
|
4943
|
+
initial: false,
|
|
4944
|
+
animate: {
|
|
4945
|
+
width: indicator.width,
|
|
4946
|
+
x: indicator.left
|
|
4947
|
+
},
|
|
4948
|
+
transition: shouldReduceMotion ? { duration: 0 } : {
|
|
4949
|
+
duration: .2,
|
|
4950
|
+
ease: [
|
|
4951
|
+
.645,
|
|
4952
|
+
.045,
|
|
4953
|
+
.355,
|
|
4954
|
+
1
|
|
4955
|
+
]
|
|
4956
|
+
}
|
|
4957
|
+
})]
|
|
3505
4958
|
}), children]
|
|
3506
4959
|
});
|
|
3507
4960
|
};
|
|
@@ -3592,6 +5045,16 @@ const renderInput = (input, id) => {
|
|
|
3592
5045
|
})
|
|
3593
5046
|
});
|
|
3594
5047
|
};
|
|
5048
|
+
/**
|
|
5049
|
+
* DEPRECATED. Never use in new code. Use `FlushCardStack` with a `ToggleRow`
|
|
5050
|
+
* header instead; put sub-options in the item's reveal.
|
|
5051
|
+
*
|
|
5052
|
+
* Kept so existing callers keep rendering while they migrate.
|
|
5053
|
+
*
|
|
5054
|
+
* @deprecated Use `FlushCardStack` + `ToggleRow`.
|
|
5055
|
+
* @see FlushCardStack
|
|
5056
|
+
* @see ToggleRow
|
|
5057
|
+
*/
|
|
3595
5058
|
const ToggleCard = ({ accordionKey, title, description, inputProps, allowExpand = true, defaultExpanded, value, onValueChange, collapsible = true, Tags, RightSideTags, notification, actionLink, customActionIcon, onCardClick: _onCardClick, children, disabled, triggerTestId, className, triggerClassName }) => {
|
|
3596
5059
|
const generatedId = useId();
|
|
3597
5060
|
const inputId = inputProps?.id ?? generatedId;
|
|
@@ -5276,5 +6739,5 @@ const UsersIcon = forwardRef((props, ref) => /* @__PURE__ */ jsx(AnimatedIcon, {
|
|
|
5276
6739
|
UsersIcon.displayName = "UsersIcon";
|
|
5277
6740
|
|
|
5278
6741
|
//#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 };
|
|
6742
|
+
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
6743
|
//# sourceMappingURL=index.esm.js.map
|