@alexgorbatchev/shadcn 0.0.65 → 0.0.67
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/README.md +6 -0
- package/dist/{chunk-p56he2j7.js → chunk-9n617bte.js} +5 -3
- package/dist/{chunk-7gjmprwx.js → chunk-c3e28a4k.js} +1 -1
- package/dist/{chunk-g975kjdm.js → chunk-c94nwxaf.js} +1 -1
- package/dist/{chunk-ma6zs655.js → chunk-d8vf8j23.js} +3 -2
- package/dist/{chunk-efm3b1py.js → chunk-dnnxz673.js} +1 -1
- package/dist/components/ToggleGroup.d.ts +3 -1
- package/dist/components/assistant-ui/elements/FeedbackDialog.js +2 -2
- package/dist/components/assistant-ui/elements/MessageActions.js +2 -2
- package/dist/components/assistant-ui/elements/ReasoningEffort.js +2 -2
- package/dist/components/assistant-ui/index.js +4 -4
- package/dist/components/json-render/index.js +1 -1
- package/dist/components/resizable/SplitView.d.ts +6 -1
- package/dist/components/resizable/index.js +13 -7
- package/dist/components/virtual-data-grid/VirtualDataGrid.d.ts +3 -1
- package/dist/components/virtual-data-grid/index.js +5 -3
- package/dist/components/virtual-table/VirtualTable.d.ts +3 -1
- package/dist/components/virtual-table/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/dist/toggle-group/types.d.ts +1 -0
- package/llms/components/actions/ToggleGroup.md +27 -0
- package/llms/components/data-display/VirtualDataGrid.md +10 -0
- package/llms/components/data-display/VirtualTable.md +11 -0
- package/llms/components/layout/SplitView.md +13 -0
- package/llms/setup.md +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -281,6 +281,8 @@ Set `wrap` on `ItemTitle` to keep complete titles visible in narrow items, inclu
|
|
|
281
281
|
|
|
282
282
|
`ToggleGroup` supports optional single selection by default and independent selections with `multiple`. Set `required` for a single selection that stays pressed when activated again by pointer, Space, or Enter. Required groups accept exactly one initial item through the controlled `value` or uncontrolled `defaultValue` tuple and cannot use `multiple`. Empty selection requests are canceled through Base UI before consumer callbacks or analytics run; accepted changes retain the native array value and event-details API. This selection rule does not add form submission or validation behavior.
|
|
283
283
|
|
|
284
|
+
`ToggleGroup` defaults to `layout="content"`, fitting its items. Set `layout="fill"` to fill the parent width and give horizontal items equal flexible widths. Items inherit the layout automatically; vertical groups fill the width while retaining their control heights. Use `spacing={0}` for joined items. Layout does not change selection, keyboard navigation, density or disabled behavior.
|
|
285
|
+
|
|
284
286
|
`ScrollArea` supplies a native scroll viewport and one vertical `ScrollBar` by default. Set `scrollbars={<ScrollBar orientation="horizontal" />}` for a wide horizontal layout, or supply a fragment containing vertical and horizontal parts for both axes. The tracks stay outside the viewport and reserve their shared corner. `keepMounted` belongs to `ScrollBar`; root and track className callbacks receive native overflow/scroll state. Focus the viewport for native keyboard scrolling.
|
|
285
287
|
|
|
286
288
|
Scrolling is intentional: cards, panels, dialogs, sheets, and floating surfaces carry `data-scroll="none"`. Put long content in a nested `ScrollArea` or an explicitly styled native scroll viewport; the outer surface stays stationary. `DialogContent` bounds its height to the viewport and uses a flex column, so give a nested `ScrollArea` `className="min-h-0"` to let it shrink within the dialog. Headers and footers stay outside that scroll area when they need to remain visible.
|
|
@@ -435,6 +437,8 @@ The editor inherits the containing label's font size and line height and occupie
|
|
|
435
437
|
|
|
436
438
|
`VirtualDataGrid` renders a TanStack Table instance built with `dataGridFeatures` through `VirtualTable`: every filtered and sorted row, without pagination, in a fixed-layout table. Column `meta` sets `label`, `textAlign`, `truncate`, `visibleFrom`, `fill`, and `sortColumnIds`; a `fill` column takes the width the sized columns leave, and `sortColumnIds` names other columns the header sorts with its own buttons so its `aria-sort` reports them. Other resizable columns get a window-splitter handle that resizes by dragging, by the arrow keys, Home, and End, and resets on double-click. Set `columnResizeMode: "onChange"` so columns follow the pointer while dragging; TanStack's default `"onEnd"` resizes only on release. Widths change through CSS variables, so a `useTable` selector can omit `columnSizing` and `columnResizing` to keep resizing from rendering rows. `renderRow` receives each row and its measurement props; spread the props onto a `TableRow` and render `DataGridCells` inside it to wrap rows in menus or drag sources. `retainedRowIds` keeps rows mounted while they hold editors. `DataGridColumnOptions` shows, hides, and reorders the columns that allow hiding; its reset restores the table's initial visibility, order, and sizes.
|
|
437
439
|
|
|
440
|
+
`VirtualDataGrid` and `VirtualTable` default to `height="auto"` and their existing `maxHeight` behavior. Set `height="fill"` inside a bounded parent to consume available height, ignoring `maxHeight`; the table viewport owns scrolling and keeps its column headers sticky. A fill grid reserves space for its column-fitting notice before sizing that viewport. Flex ancestors between a bounded container and these components must allow shrinking with `min-height: 0`.
|
|
441
|
+
|
|
438
442
|
Column `meta.filter` offers a column in `DataGridFilters`, hidden columns included. A `range` filter edits `[min, max]` bounds, `null` for an open end, for `filterFn: "inNumberRange"`; its inputs suggest the range of the rows the other filters leave, formatted through the filter's `Intl.NumberFormatOptions`. An `options` filter chooses among labelled string values, one or several, listed in its `options` or, when they depend on runtime data, in the `options` prop of `DataGridFilters` and `DataGridFilterSummary` keyed by column ID, for `filterFn: "arrHas"` (one value per row), `"arrIncludesSome"` (an array per row), or a custom `filterFn`; each option counts the rows the other filters leave with that value, so a column whose rows hold several values or values in another form supplies them through `getUniqueValues`. Column filters combine with each other and with the global filter. `DataGridFilterSummary` lists the active filters with buttons that remove them, and both controls clear every column filter at once.
|
|
439
443
|
|
|
440
444
|
Import `DataGridSelectHeader` and `DataGridSelectCell` from `@alexgorbatchev/shadcn/data-grid`. Pass the current `useTable` result as `table` to both controls, and pass `row` and an accessible `label` to each cell. The header selects selectable filtered rows across all pages and preserves selections hidden by filters. It shows a mixed state when some of those rows are selected and disables itself when none are selectable. Its default label is "Select all filtered rows"; provide `label` to name the scope in your application. Cells follow native row selection rules, including disabled rows and partially selected parents. The controls observe selection changes without requiring the parent table selector to include selection state.
|
|
@@ -467,6 +471,8 @@ Embedded actions, links, menus, editable fields, and media controls retain their
|
|
|
467
471
|
|
|
468
472
|
`SplitView` pairs a `sidebar` with its `children` in equally padded, borderless panels. Provide `sidebarLabel`, `contentLabel`, and `resizeLabel` for accessibility and a unique `storageKey` to remember the resized layout in localStorage. The desktop sidebar defaults to 325px (`defaultSidebarSize`), with a 200px minimum and a 50% maximum. Its 2px divider supports mouse, touch, and keyboard resizing. Below 1024px, the panels stack vertically while preserving the desktop preference. Storage failures leave the layout usable.
|
|
469
473
|
|
|
474
|
+
`SplitView` defaults to `layout="content"` and `sidebarPadding="panel"` / `contentPadding="panel"`. Choose `"none"` padding for children that own their spacing. With a bounded parent, `layout="fill"` fills the available height, scrolls overflowing navigation independently, and leaves the content panel available for a scrolling child. On narrow screens the stacked navigation uses at most 35% of the split height.
|
|
475
|
+
|
|
470
476
|
`ResizableHandle thickness="strong"` and `Separator thickness="strong"` use 2px dividers; their default thickness is 1px.
|
|
471
477
|
|
|
472
478
|
`TableHead` and `TableCell` accept `textAlign="start"`, `"center"`, or `"end"` to align labels and numeric columns consistently in either text direction.
|
|
@@ -59,6 +59,7 @@ function ToggleGroup2({
|
|
|
59
59
|
variant,
|
|
60
60
|
size,
|
|
61
61
|
spacing = 2,
|
|
62
|
+
layout = "content",
|
|
62
63
|
orientation = "horizontal",
|
|
63
64
|
children,
|
|
64
65
|
style,
|
|
@@ -72,12 +73,13 @@ function ToggleGroup2({
|
|
|
72
73
|
"data-variant": variant,
|
|
73
74
|
"data-size": size,
|
|
74
75
|
"data-spacing": spacing,
|
|
76
|
+
"data-layout": layout,
|
|
75
77
|
orientation,
|
|
76
78
|
style: (state) => ({
|
|
77
79
|
gap: `calc(var(--spacing) * ${spacing})`,
|
|
78
80
|
...typeof style === "function" ? style(state) : style
|
|
79
81
|
}),
|
|
80
|
-
className: (state) => cn2("group/toggle-group flex w-fit flex-row items-center rounded-sm data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", typeof className === "function" ? className(state) : className),
|
|
82
|
+
className: (state) => cn2("group/toggle-group flex w-fit flex-row items-center rounded-sm data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", layout === "fill" && "w-full", typeof className === "function" ? className(state) : className),
|
|
81
83
|
...props,
|
|
82
84
|
onValueChange: (value, details) => {
|
|
83
85
|
if (required && value.length === 0) {
|
|
@@ -87,7 +89,7 @@ function ToggleGroup2({
|
|
|
87
89
|
trackedOnValueChange(value, details);
|
|
88
90
|
},
|
|
89
91
|
children: /* @__PURE__ */ jsx2(ToggleGroupContext.Provider, {
|
|
90
|
-
value: { variant, size, spacing },
|
|
92
|
+
value: { variant, size, spacing, layout },
|
|
91
93
|
children
|
|
92
94
|
})
|
|
93
95
|
});
|
|
@@ -106,7 +108,7 @@ function ToggleGroupItem2({
|
|
|
106
108
|
"data-variant": context.variant ?? variant,
|
|
107
109
|
"data-size": context.size ?? size,
|
|
108
110
|
"data-spacing": context.spacing,
|
|
109
|
-
className: (state) => cn2("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none focus:relative focus:z-10 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:first:rounded-s-sm group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:first:rounded-t-sm group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:last:rounded-e-sm group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:last:rounded-b-sm group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-s-0 group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-s group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t", toggleVariants2({ variant: context.variant ?? variant, size: context.size ?? size }), typeof className === "function" ? className(state) : className),
|
|
111
|
+
className: (state) => cn2("shrink-0 group-data-[spacing=0]/toggle-group:rounded-none focus:relative focus:z-10 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:first:rounded-s-sm group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:first:rounded-t-sm group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:last:rounded-e-sm group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:last:rounded-b-sm group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-s-0 group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-[orientation=horizontal]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-s group-data-[orientation=vertical]/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t", toggleVariants2({ variant: context.variant ?? variant, size: context.size ?? size }), context.layout === "fill" && "min-w-0 group-data-[orientation=horizontal]/toggle-group:flex-1", typeof className === "function" ? className(state) : className),
|
|
110
112
|
...props
|
|
111
113
|
});
|
|
112
114
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ToggleGroup2,
|
|
6
6
|
ToggleGroupItem2
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-9n617bte.js";
|
|
8
8
|
|
|
9
9
|
// src/components/assistant-ui/elements/MessageActions.tsx
|
|
10
10
|
import { CheckIcon, CopyIcon, EllipsisIcon, RefreshCwIcon, ThumbsDownIcon, ThumbsUpIcon } from "lucide-react";
|
|
@@ -22,6 +22,7 @@ function VirtualTable2({
|
|
|
22
22
|
columns,
|
|
23
23
|
label,
|
|
24
24
|
maxHeight = "65vh",
|
|
25
|
+
height = "auto",
|
|
25
26
|
estimateRowHeight = 80,
|
|
26
27
|
overscan = 5,
|
|
27
28
|
retainedKeys,
|
|
@@ -49,8 +50,8 @@ function VirtualTable2({
|
|
|
49
50
|
role: "region",
|
|
50
51
|
"aria-label": label,
|
|
51
52
|
tabIndex: 0,
|
|
52
|
-
className: "min-w-0 overflow-auto overscroll-contain",
|
|
53
|
-
style: { maxHeight },
|
|
53
|
+
className: height === "fill" ? "h-full min-h-0 min-w-0 flex-1 overflow-auto overscroll-contain" : "min-w-0 overflow-auto overscroll-contain",
|
|
54
|
+
style: height === "fill" ? undefined : { maxHeight },
|
|
54
55
|
onFocusCapture: (event) => {
|
|
55
56
|
const row = event.target.closest("tr[data-index]");
|
|
56
57
|
const item = items[Number(row?.dataset.index)];
|
|
@@ -21,7 +21,9 @@ type RequiredToggleGroupSelection = {
|
|
|
21
21
|
});
|
|
22
22
|
interface IToggleGroupLayout {
|
|
23
23
|
spacing?: number;
|
|
24
|
+
/** Fill the parent width and distribute horizontal items equally. */
|
|
25
|
+
layout?: "content" | "fill";
|
|
24
26
|
}
|
|
25
|
-
export declare function ToggleGroup({ analytics, density, className, variant, size, spacing, orientation, children, style, required, ...props }: ToggleGroupProps): ReactElement;
|
|
27
|
+
export declare function ToggleGroup({ analytics, density, className, variant, size, spacing, layout, orientation, children, style, required, ...props }: ToggleGroupProps): ReactElement;
|
|
26
28
|
export declare function ToggleGroupItem({ density, className, variant, size, ...props }: ToggleProps): ReactElement;
|
|
27
29
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FeedbackDialog2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-c3e28a4k.js";
|
|
4
|
+
import"../../../chunk-9n617bte.js";
|
|
5
5
|
import"../../../chunk-9n0axzd5.js";
|
|
6
6
|
import"../../../chunk-k1f35j55.js";
|
|
7
7
|
import"../../../chunk-m32ptxf3.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MessageActions2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-c94nwxaf.js";
|
|
4
|
+
import"../../../chunk-9n617bte.js";
|
|
5
5
|
import"../../../chunk-bd09gygt.js";
|
|
6
6
|
import"../../../chunk-x90xmrba.js";
|
|
7
7
|
import"../../../chunk-jpvw9xqy.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ReasoningEffort2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-dnnxz673.js";
|
|
4
|
+
import"../../../chunk-9n617bte.js";
|
|
5
5
|
import"../../../chunk-bcwbh20z.js";
|
|
6
6
|
import"../../../chunk-5mydsjp3.js";
|
|
7
7
|
import"../../../chunk-8ssktt4b.js";
|
|
@@ -259,10 +259,10 @@ import"../../chunk-2b5f37wj.js";
|
|
|
259
259
|
import {
|
|
260
260
|
EveAskQuestion2
|
|
261
261
|
} from "../../chunk-t5e0s8q6.js";
|
|
262
|
-
import"../../chunk-
|
|
262
|
+
import"../../chunk-9n617bte.js";
|
|
263
263
|
import {
|
|
264
264
|
FeedbackDialog2
|
|
265
|
-
} from "../../chunk-
|
|
265
|
+
} from "../../chunk-c3e28a4k.js";
|
|
266
266
|
import {
|
|
267
267
|
FileRoot2,
|
|
268
268
|
FileIconDisplay2,
|
|
@@ -352,7 +352,7 @@ import {
|
|
|
352
352
|
} from "../../chunk-4zm4dn1a.js";
|
|
353
353
|
import {
|
|
354
354
|
MessageActions2
|
|
355
|
-
} from "../../chunk-
|
|
355
|
+
} from "../../chunk-c94nwxaf.js";
|
|
356
356
|
import {
|
|
357
357
|
MessageAttachments2
|
|
358
358
|
} from "../../chunk-tw8f1ew4.js";
|
|
@@ -462,7 +462,7 @@ import {
|
|
|
462
462
|
} from "../../chunk-x0p3g392.js";
|
|
463
463
|
import {
|
|
464
464
|
ReasoningEffort2
|
|
465
|
-
} from "../../chunk-
|
|
465
|
+
} from "../../chunk-dnnxz673.js";
|
|
466
466
|
import {
|
|
467
467
|
SwapLabel2
|
|
468
468
|
} from "../../chunk-39q6906v.js";
|
|
@@ -9,6 +9,11 @@ interface ISplitViewProps {
|
|
|
9
9
|
contentLabel: string;
|
|
10
10
|
resizeLabel: string;
|
|
11
11
|
defaultSidebarSize?: number;
|
|
12
|
+
/** Panel padding; use none when children supply their own spacing. */
|
|
13
|
+
sidebarPadding?: "none" | "panel";
|
|
14
|
+
contentPadding?: "none" | "panel";
|
|
15
|
+
/** Fill a bounded parent; mobile navigation scrolls within at most 35% of its height. */
|
|
16
|
+
layout?: "content" | "fill";
|
|
12
17
|
}
|
|
13
|
-
export declare function SplitView({ sidebar, children, storageKey, storage, sidebarLabel, contentLabel, resizeLabel, defaultSidebarSize, }: ISplitViewProps): ReactElement;
|
|
18
|
+
export declare function SplitView({ sidebar, children, storageKey, storage, sidebarLabel, contentLabel, resizeLabel, defaultSidebarSize, sidebarPadding, contentPadding, layout: layoutMode, }: ISplitViewProps): ReactElement;
|
|
14
19
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import"../../chunk-7ny0vyek.js";
|
|
2
2
|
import"../../chunk-8ssktt4b.js";
|
|
3
|
-
import
|
|
3
|
+
import {
|
|
4
|
+
cn2
|
|
5
|
+
} from "../../chunk-en44w1pn.js";
|
|
4
6
|
import {
|
|
5
7
|
Resizable2,
|
|
6
8
|
ResizablePanel2,
|
|
@@ -44,17 +46,21 @@ function SplitView({
|
|
|
44
46
|
sidebarLabel,
|
|
45
47
|
contentLabel,
|
|
46
48
|
resizeLabel,
|
|
47
|
-
defaultSidebarSize = 325
|
|
49
|
+
defaultSidebarSize = 325,
|
|
50
|
+
sidebarPadding = "panel",
|
|
51
|
+
contentPadding = "panel",
|
|
52
|
+
layout: layoutMode = "content"
|
|
48
53
|
}) {
|
|
54
|
+
const isFill = layoutMode === "fill";
|
|
49
55
|
const isWide = useMediaQuery("(min-width: 1024px)");
|
|
50
56
|
const layout = useDefaultLayout({ id: storageKey, storage, onlySaveAfterUserInteractions: true });
|
|
51
57
|
if (!isWide)
|
|
52
58
|
return /* @__PURE__ */ jsxs("div", {
|
|
53
|
-
className: "flex min-w-0 flex-col bg-card",
|
|
59
|
+
className: cn2("flex min-w-0 flex-col bg-card", isFill && "h-full min-h-0 overflow-hidden"),
|
|
54
60
|
children: [
|
|
55
61
|
/* @__PURE__ */ jsx("aside", {
|
|
56
62
|
"aria-label": sidebarLabel,
|
|
57
|
-
className: "min-w-0 p-4",
|
|
63
|
+
className: cn2("min-w-0", sidebarPadding === "panel" && "p-4", isFill && "max-h-[35%] shrink-0 overflow-y-auto"),
|
|
58
64
|
children: sidebar
|
|
59
65
|
}),
|
|
60
66
|
/* @__PURE__ */ jsx(Separator2, {
|
|
@@ -62,7 +68,7 @@ function SplitView({
|
|
|
62
68
|
}),
|
|
63
69
|
/* @__PURE__ */ jsx("section", {
|
|
64
70
|
"aria-label": contentLabel,
|
|
65
|
-
className: "min-w-0 p-4",
|
|
71
|
+
className: cn2("min-w-0", contentPadding === "panel" && "p-4", isFill && "flex min-h-0 flex-1 flex-col overflow-hidden"),
|
|
66
72
|
children
|
|
67
73
|
})
|
|
68
74
|
]
|
|
@@ -79,7 +85,7 @@ function SplitView({
|
|
|
79
85
|
maxSize: "50%",
|
|
80
86
|
children: /* @__PURE__ */ jsx("aside", {
|
|
81
87
|
"aria-label": sidebarLabel,
|
|
82
|
-
className: "h-full min-w-0 bg-card p-4",
|
|
88
|
+
className: cn2("h-full min-w-0 bg-card", sidebarPadding === "panel" && "p-4", isFill && "min-h-0 overflow-y-auto"),
|
|
83
89
|
children: sidebar
|
|
84
90
|
})
|
|
85
91
|
}),
|
|
@@ -92,7 +98,7 @@ function SplitView({
|
|
|
92
98
|
minSize: "35%",
|
|
93
99
|
children: /* @__PURE__ */ jsx("section", {
|
|
94
100
|
"aria-label": contentLabel,
|
|
95
|
-
className: "h-full min-w-0 bg-card p-4",
|
|
101
|
+
className: cn2("h-full min-w-0 bg-card", contentPadding === "panel" && "p-4", isFill && "flex min-h-0 flex-col overflow-hidden"),
|
|
96
102
|
children
|
|
97
103
|
})
|
|
98
104
|
})
|
|
@@ -6,6 +6,8 @@ interface IVirtualDataGridProps<T extends RowData, TSelected> {
|
|
|
6
6
|
table: DataGridTable<T, TSelected>;
|
|
7
7
|
label: string;
|
|
8
8
|
maxHeight?: number | string;
|
|
9
|
+
/** Fill a bounded parent instead of using maxHeight. */
|
|
10
|
+
height?: "auto" | "fill";
|
|
9
11
|
estimateRowHeight?: number;
|
|
10
12
|
overscan?: number;
|
|
11
13
|
/**
|
|
@@ -33,5 +35,5 @@ interface IVirtualDataGridProps<T extends RowData, TSelected> {
|
|
|
33
35
|
* Column widths change through CSS variables, so a `useTable` selector can leave out sizing state and resizing never
|
|
34
36
|
* renders rows again.
|
|
35
37
|
*/
|
|
36
|
-
export declare function VirtualDataGrid<T extends RowData, TSelected>({ table, label, maxHeight, estimateRowHeight, overscan, fitColumns, onFitWidthChange, retainedRowIds, renderRow, }: IVirtualDataGridProps<T, TSelected>): ReactElement;
|
|
38
|
+
export declare function VirtualDataGrid<T extends RowData, TSelected>({ table, label, maxHeight, height, estimateRowHeight, overscan, fitColumns, onFitWidthChange, retainedRowIds, renderRow, }: IVirtualDataGridProps<T, TSelected>): ReactElement;
|
|
37
39
|
export {};
|
|
@@ -22,7 +22,7 @@ import"../../chunk-7jpsybag.js";
|
|
|
22
22
|
import"../../chunk-7vg045gd.js";
|
|
23
23
|
import {
|
|
24
24
|
VirtualTable2
|
|
25
|
-
} from "../../chunk-
|
|
25
|
+
} from "../../chunk-d8vf8j23.js";
|
|
26
26
|
import"../../chunk-5mydsjp3.js";
|
|
27
27
|
|
|
28
28
|
// src/components/virtual-data-grid/VirtualDataGrid.tsx
|
|
@@ -94,6 +94,7 @@ function VirtualDataGrid({
|
|
|
94
94
|
table,
|
|
95
95
|
label,
|
|
96
96
|
maxHeight,
|
|
97
|
+
height = "auto",
|
|
97
98
|
estimateRowHeight,
|
|
98
99
|
overscan,
|
|
99
100
|
fitColumns = false,
|
|
@@ -108,12 +109,12 @@ function VirtualDataGrid({
|
|
|
108
109
|
return /* @__PURE__ */ jsx("div", {
|
|
109
110
|
ref: scope,
|
|
110
111
|
"data-testid": "VirtualDataGrid",
|
|
111
|
-
className: "min-w-0",
|
|
112
|
+
className: height === "fill" ? "flex h-full min-h-0 min-w-0 flex-col" : "min-w-0",
|
|
112
113
|
children: /* @__PURE__ */ jsxs(DataGridColumnFitContext, {
|
|
113
114
|
value: fit,
|
|
114
115
|
children: [
|
|
115
116
|
hiddenLabels.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
116
|
-
className: "mb-2 text-xs text-muted-foreground",
|
|
117
|
+
className: "mb-2 shrink-0 text-xs text-muted-foreground",
|
|
117
118
|
children: [
|
|
118
119
|
/* @__PURE__ */ jsxs("p", {
|
|
119
120
|
children: [
|
|
@@ -132,6 +133,7 @@ function VirtualDataGrid({
|
|
|
132
133
|
getItemKey: (row) => row.id,
|
|
133
134
|
label,
|
|
134
135
|
maxHeight,
|
|
136
|
+
height,
|
|
135
137
|
estimateRowHeight,
|
|
136
138
|
overscan,
|
|
137
139
|
retainedKeys: retainedRowIds,
|
|
@@ -13,10 +13,12 @@ interface IVirtualTableProps<T> {
|
|
|
13
13
|
columns?: ReactNode;
|
|
14
14
|
label: string;
|
|
15
15
|
maxHeight?: number | string;
|
|
16
|
+
/** Fill a bounded parent instead of using maxHeight. */
|
|
17
|
+
height?: "auto" | "fill";
|
|
16
18
|
estimateRowHeight?: number;
|
|
17
19
|
overscan?: number;
|
|
18
20
|
retainedKeys?: readonly Key[];
|
|
19
21
|
layout?: ComponentProps<typeof Table>["layout"];
|
|
20
22
|
}
|
|
21
|
-
export declare function VirtualTable<T>({ items, getItemKey, renderRow, header, columns, label, maxHeight, estimateRowHeight, overscan, retainedKeys, layout, }: IVirtualTableProps<T>): ReactElement;
|
|
23
|
+
export declare function VirtualTable<T>({ items, getItemKey, renderRow, header, columns, label, maxHeight, height, estimateRowHeight, overscan, retainedKeys, layout, }: IVirtualTableProps<T>): ReactElement;
|
|
22
24
|
export {};
|
package/dist/index.js
CHANGED
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.67",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -31,6 +31,7 @@ ToggleGroup
|
|
|
31
31
|
variant: { control: "select", options: ["default", "outline"] },
|
|
32
32
|
orientation: { control: "select", options: ["horizontal", "vertical"] },
|
|
33
33
|
spacing: { control: "number" },
|
|
34
|
+
layout: { control: "select", options: ["content", "fill"] },
|
|
34
35
|
}
|
|
35
36
|
```
|
|
36
37
|
|
|
@@ -124,6 +125,32 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
124
125
|
}
|
|
125
126
|
```
|
|
126
127
|
|
|
128
|
+
### Fill
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
{
|
|
132
|
+
args: { layout: "fill", spacing: 0, variant: "outline", size: "sm" },
|
|
133
|
+
decorators: [
|
|
134
|
+
(Story) => (<div style={{ width: 360, maxWidth: "100%" }}>
|
|
135
|
+
<Story />
|
|
136
|
+
</div>),
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### FillVertical
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
{
|
|
145
|
+
args: { ...Fill.args, orientation: "vertical" },
|
|
146
|
+
decorators: [
|
|
147
|
+
(Story) => (<div style={{ width: 360, maxWidth: "100%" }}>
|
|
148
|
+
<Story />
|
|
149
|
+
</div>),
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
127
154
|
### Vertical
|
|
128
155
|
|
|
129
156
|
```tsx
|
|
@@ -99,3 +99,13 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
99
99
|
render: () => <VirtualDataGridExample files={fixture_gridFiles} width={420} fitColumns grouped/>
|
|
100
100
|
}
|
|
101
101
|
```
|
|
102
|
+
|
|
103
|
+
### Fill
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
{
|
|
107
|
+
render: () => (<div style={{ height: 400 }}>
|
|
108
|
+
<VirtualDataGridExample files={fixture_gridFiles} height="fill" width={300} fitColumns/>
|
|
109
|
+
</div>)
|
|
110
|
+
}
|
|
111
|
+
```
|
|
@@ -83,3 +83,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
83
83
|
</div>)
|
|
84
84
|
}
|
|
85
85
|
```
|
|
86
|
+
|
|
87
|
+
### Fill
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
{
|
|
91
|
+
args: { height: "fill", maxHeight: 100 },
|
|
92
|
+
render: (args) => (<div style={{ height: 400 }}>
|
|
93
|
+
<VirtualTable {...args}/>
|
|
94
|
+
</div>)
|
|
95
|
+
}
|
|
96
|
+
```
|
|
@@ -90,3 +90,16 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
```
|
|
93
|
+
|
|
94
|
+
### Fill
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
{
|
|
98
|
+
args: { layout: "fill", sidebarPadding: "none", contentPadding: "none" },
|
|
99
|
+
render: (args) => (<div style={{ height: 400 }}>
|
|
100
|
+
<SplitView {...args} sidebar={<div style={{ height: 800 }}>Scrollable navigation</div>}>
|
|
101
|
+
<h2>Bounded content</h2>
|
|
102
|
+
</SplitView>
|
|
103
|
+
</div>)
|
|
104
|
+
}
|
|
105
|
+
```
|
package/llms/setup.md
CHANGED
|
@@ -281,6 +281,8 @@ Set `wrap` on `ItemTitle` to keep complete titles visible in narrow items, inclu
|
|
|
281
281
|
|
|
282
282
|
`ToggleGroup` supports optional single selection by default and independent selections with `multiple`. Set `required` for a single selection that stays pressed when activated again by pointer, Space, or Enter. Required groups accept exactly one initial item through the controlled `value` or uncontrolled `defaultValue` tuple and cannot use `multiple`. Empty selection requests are canceled through Base UI before consumer callbacks or analytics run; accepted changes retain the native array value and event-details API. This selection rule does not add form submission or validation behavior.
|
|
283
283
|
|
|
284
|
+
`ToggleGroup` defaults to `layout="content"`, fitting its items. Set `layout="fill"` to fill the parent width and give horizontal items equal flexible widths. Items inherit the layout automatically; vertical groups fill the width while retaining their control heights. Use `spacing={0}` for joined items. Layout does not change selection, keyboard navigation, density or disabled behavior.
|
|
285
|
+
|
|
284
286
|
`ScrollArea` supplies a native scroll viewport and one vertical `ScrollBar` by default. Set `scrollbars={<ScrollBar orientation="horizontal" />}` for a wide horizontal layout, or supply a fragment containing vertical and horizontal parts for both axes. The tracks stay outside the viewport and reserve their shared corner. `keepMounted` belongs to `ScrollBar`; root and track className callbacks receive native overflow/scroll state. Focus the viewport for native keyboard scrolling.
|
|
285
287
|
|
|
286
288
|
Scrolling is intentional: cards, panels, dialogs, sheets, and floating surfaces carry `data-scroll="none"`. Put long content in a nested `ScrollArea` or an explicitly styled native scroll viewport; the outer surface stays stationary. `DialogContent` bounds its height to the viewport and uses a flex column, so give a nested `ScrollArea` `className="min-h-0"` to let it shrink within the dialog. Headers and footers stay outside that scroll area when they need to remain visible.
|
|
@@ -435,6 +437,8 @@ The editor inherits the containing label's font size and line height and occupie
|
|
|
435
437
|
|
|
436
438
|
`VirtualDataGrid` renders a TanStack Table instance built with `dataGridFeatures` through `VirtualTable`: every filtered and sorted row, without pagination, in a fixed-layout table. Column `meta` sets `label`, `textAlign`, `truncate`, `visibleFrom`, `fill`, and `sortColumnIds`; a `fill` column takes the width the sized columns leave, and `sortColumnIds` names other columns the header sorts with its own buttons so its `aria-sort` reports them. Other resizable columns get a window-splitter handle that resizes by dragging, by the arrow keys, Home, and End, and resets on double-click. Set `columnResizeMode: "onChange"` so columns follow the pointer while dragging; TanStack's default `"onEnd"` resizes only on release. Widths change through CSS variables, so a `useTable` selector can omit `columnSizing` and `columnResizing` to keep resizing from rendering rows. `renderRow` receives each row and its measurement props; spread the props onto a `TableRow` and render `DataGridCells` inside it to wrap rows in menus or drag sources. `retainedRowIds` keeps rows mounted while they hold editors. `DataGridColumnOptions` shows, hides, and reorders the columns that allow hiding; its reset restores the table's initial visibility, order, and sizes.
|
|
437
439
|
|
|
440
|
+
`VirtualDataGrid` and `VirtualTable` default to `height="auto"` and their existing `maxHeight` behavior. Set `height="fill"` inside a bounded parent to consume available height, ignoring `maxHeight`; the table viewport owns scrolling and keeps its column headers sticky. A fill grid reserves space for its column-fitting notice before sizing that viewport. Flex ancestors between a bounded container and these components must allow shrinking with `min-height: 0`.
|
|
441
|
+
|
|
438
442
|
Column `meta.filter` offers a column in `DataGridFilters`, hidden columns included. A `range` filter edits `[min, max]` bounds, `null` for an open end, for `filterFn: "inNumberRange"`; its inputs suggest the range of the rows the other filters leave, formatted through the filter's `Intl.NumberFormatOptions`. An `options` filter chooses among labelled string values, one or several, listed in its `options` or, when they depend on runtime data, in the `options` prop of `DataGridFilters` and `DataGridFilterSummary` keyed by column ID, for `filterFn: "arrHas"` (one value per row), `"arrIncludesSome"` (an array per row), or a custom `filterFn`; each option counts the rows the other filters leave with that value, so a column whose rows hold several values or values in another form supplies them through `getUniqueValues`. Column filters combine with each other and with the global filter. `DataGridFilterSummary` lists the active filters with buttons that remove them, and both controls clear every column filter at once.
|
|
439
443
|
|
|
440
444
|
Import `DataGridSelectHeader` and `DataGridSelectCell` from `@alexgorbatchev/shadcn/data-grid`. Pass the current `useTable` result as `table` to both controls, and pass `row` and an accessible `label` to each cell. The header selects selectable filtered rows across all pages and preserves selections hidden by filters. It shows a mixed state when some of those rows are selected and disables itself when none are selectable. Its default label is "Select all filtered rows"; provide `label` to name the scope in your application. Cells follow native row selection rules, including disabled rows and partially selected parents. The controls observe selection changes without requiring the parent table selector to include selection state.
|
|
@@ -467,6 +471,8 @@ Embedded actions, links, menus, editable fields, and media controls retain their
|
|
|
467
471
|
|
|
468
472
|
`SplitView` pairs a `sidebar` with its `children` in equally padded, borderless panels. Provide `sidebarLabel`, `contentLabel`, and `resizeLabel` for accessibility and a unique `storageKey` to remember the resized layout in localStorage. The desktop sidebar defaults to 325px (`defaultSidebarSize`), with a 200px minimum and a 50% maximum. Its 2px divider supports mouse, touch, and keyboard resizing. Below 1024px, the panels stack vertically while preserving the desktop preference. Storage failures leave the layout usable.
|
|
469
473
|
|
|
474
|
+
`SplitView` defaults to `layout="content"` and `sidebarPadding="panel"` / `contentPadding="panel"`. Choose `"none"` padding for children that own their spacing. With a bounded parent, `layout="fill"` fills the available height, scrolls overflowing navigation independently, and leaves the content panel available for a scrolling child. On narrow screens the stacked navigation uses at most 35% of the split height.
|
|
475
|
+
|
|
470
476
|
`ResizableHandle thickness="strong"` and `Separator thickness="strong"` use 2px dividers; their default thickness is 1px.
|
|
471
477
|
|
|
472
478
|
`TableHead` and `TableCell` accept `textAlign="start"`, `"center"`, or `"end"` to align labels and numeric columns consistently in either text direction.
|