@alexgorbatchev/shadcn 0.0.65 → 0.0.66
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 +4 -0
- package/dist/{chunk-ma6zs655.js → chunk-d8vf8j23.js} +3 -2
- 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/prototype.js +1 -1
- 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 +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -435,6 +435,8 @@ The editor inherits the containing label's font size and line height and occupie
|
|
|
435
435
|
|
|
436
436
|
`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
437
|
|
|
438
|
+
`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`.
|
|
439
|
+
|
|
438
440
|
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
441
|
|
|
440
442
|
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 +469,8 @@ Embedded actions, links, menus, editable fields, and media controls retain their
|
|
|
467
469
|
|
|
468
470
|
`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
471
|
|
|
472
|
+
`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.
|
|
473
|
+
|
|
470
474
|
`ResizableHandle thickness="strong"` and `Separator thickness="strong"` use 2px dividers; their default thickness is 1px.
|
|
471
475
|
|
|
472
476
|
`TableHead` and `TableCell` accept `textAlign="start"`, `"center"`, or `"end"` to align labels and numeric columns consistently in either text direction.
|
|
@@ -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)];
|
|
@@ -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/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.66",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -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
|
@@ -435,6 +435,8 @@ The editor inherits the containing label's font size and line height and occupie
|
|
|
435
435
|
|
|
436
436
|
`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
437
|
|
|
438
|
+
`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`.
|
|
439
|
+
|
|
438
440
|
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
441
|
|
|
440
442
|
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 +469,8 @@ Embedded actions, links, menus, editable fields, and media controls retain their
|
|
|
467
469
|
|
|
468
470
|
`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
471
|
|
|
472
|
+
`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.
|
|
473
|
+
|
|
470
474
|
`ResizableHandle thickness="strong"` and `Separator thickness="strong"` use 2px dividers; their default thickness is 1px.
|
|
471
475
|
|
|
472
476
|
`TableHead` and `TableCell` accept `textAlign="start"`, `"center"`, or `"end"` to align labels and numeric columns consistently in either text direction.
|