@alexgorbatchev/shadcn 0.0.28 → 0.0.30
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 +1 -1
- package/dist/{chunk-3z5gpbh0.js → chunk-987zth0a.js} +1 -1
- package/dist/{chunk-v0k5jnk5.js → chunk-zte6pw69.js} +2 -1
- package/dist/components/Table.d.ts +6 -3
- package/dist/components/assistant-ui/elements/DataTable.js +2 -2
- package/dist/components/assistant-ui/index.js +2 -2
- package/dist/components/data-grid/index.js +1 -1
- package/dist/components/gantt/index.js +1 -1
- package/dist/components/virtual-table/VirtualTable.d.ts +1 -2
- package/dist/components/virtual-table/index.js +1 -4
- package/dist/index.js +1 -1
- package/llms/components/data-display/Table.md +1 -1
- package/llms/components/data-display/VirtualTable.md +30 -2
- package/llms/setup.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -300,7 +300,7 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
|
|
|
300
300
|
|
|
301
301
|
`InlineEdit` mounts an edit session with a controlled `value`, `onValueChange`, `onCommit`, and `onCancel`. Mount it in place of the displayed label. Its input focuses and selects its text by default; `shouldSelectOnMount={false}` preserves the initial caret. Enter or blur commits once, Escape cancels without committing, and asynchronous saves disable the input until completion. Rejected saves display an error and allow retry.
|
|
302
302
|
|
|
303
|
-
`VirtualTable` renders a bounded, dynamically measured set of native table rows using TanStack Virtual. Supply `items`, stable `getItemKey`, `header`, `
|
|
303
|
+
`VirtualTable` renders a bounded, dynamically measured set of native table rows using TanStack Virtual. Supply `items`, stable `getItemKey`, `header`, `label`, and `renderRow`; spread the supplied measurement props onto each native row. Optional `columns` accepts a `TableColumnGroup`; responsive columns keep their widths aligned with cells that share their `visibleFrom`. `maxHeight` defaults to `65vh`, `estimateRowHeight` to 80 pixels, and `overscan` to five rows. `retainedKeys` keeps editing rows mounted; the focused row is retained automatically. Filtering and selection belong to the consumer.
|
|
304
304
|
|
|
305
305
|
`StarRating` takes a controlled numeric `value` from 0 to 5, `onValueChange`, and an accessible `label`. Its native radio buttons support keyboard selection and an Unrated option to clear the rating. Set `disabled` while saving. `Avatar shape="square"` displays square artwork with matching image, fallback, and border corners.
|
|
306
306
|
|
|
@@ -103,10 +103,11 @@ function TableColumnGroup2(props) {
|
|
|
103
103
|
...props
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
function TableColumn2({ className, visibleFrom, ...props }) {
|
|
106
|
+
function TableColumn2({ className, style, visibleFrom, width, ...props }) {
|
|
107
107
|
return /* @__PURE__ */ jsx("col", {
|
|
108
108
|
"data-slot": "table-column",
|
|
109
109
|
className: cn2(visibleFrom && columnVisibilityClasses[visibleFrom], className),
|
|
110
|
+
style: width === undefined ? style : { ...style, width },
|
|
110
111
|
...props
|
|
111
112
|
});
|
|
112
113
|
}
|
|
@@ -25,9 +25,12 @@ type TableCellProps = ComponentProps<"td"> & IDensityProps & ITableCellOptions;
|
|
|
25
25
|
declare function TableCell({ density, className, truncate, textAlign, visibleFrom, ...props }: TableCellProps): ReactElement;
|
|
26
26
|
type TableColumnGroupProps = ComponentProps<"colgroup">;
|
|
27
27
|
declare function TableColumnGroup(props: TableColumnGroupProps): ReactElement;
|
|
28
|
-
type TableColumnProps = ComponentProps<"col"> & Pick<ITableCellOptions, "visibleFrom"
|
|
29
|
-
/**
|
|
30
|
-
|
|
28
|
+
type TableColumnProps = ComponentProps<"col"> & Pick<ITableCellOptions, "visibleFrom"> & {
|
|
29
|
+
/** Fixed column width; numbers are pixels. Columns without one share the remaining width. */
|
|
30
|
+
width?: number | string;
|
|
31
|
+
};
|
|
32
|
+
/** A column; give it the same `visibleFrom` as its header and cells. */
|
|
33
|
+
declare function TableColumn({ className, style, visibleFrom, width, ...props }: TableColumnProps): ReactElement;
|
|
31
34
|
type TableCaptionProps = ComponentProps<"caption"> & IDensityProps;
|
|
32
35
|
declare function TableCaption({ density, className, ...props }: TableCaptionProps): ReactElement;
|
|
33
36
|
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TableColumnGroup, TableColumn, };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataTable2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-987zth0a.js";
|
|
4
4
|
import"../../../chunk-1wz92wgg.js";
|
|
5
|
-
import"../../../chunk-
|
|
5
|
+
import"../../../chunk-zte6pw69.js";
|
|
6
6
|
import"../../../chunk-bygq5yqf.js";
|
|
7
7
|
import"../../../chunk-wjx6zf94.js";
|
|
8
8
|
import"../../../chunk-q7p28b89.js";
|
|
@@ -199,8 +199,8 @@ import"../../chunk-1wz92wgg.js";
|
|
|
199
199
|
import"../../chunk-wjx6zf94.js";
|
|
200
200
|
import {
|
|
201
201
|
DataTable2
|
|
202
|
-
} from "../../chunk-
|
|
203
|
-
import"../../chunk-
|
|
202
|
+
} from "../../chunk-987zth0a.js";
|
|
203
|
+
import"../../chunk-zte6pw69.js";
|
|
204
204
|
import {
|
|
205
205
|
DaySeparator2
|
|
206
206
|
} from "../../chunk-jhw9q2eq.js";
|
|
@@ -11,7 +11,6 @@ interface IVirtualTableProps<T> {
|
|
|
11
11
|
renderRow: (item: T, props: IVirtualTableRowProps) => ReactNode;
|
|
12
12
|
header: ReactNode;
|
|
13
13
|
columns?: ReactNode;
|
|
14
|
-
columnCount: number;
|
|
15
14
|
label: string;
|
|
16
15
|
maxHeight?: number | string;
|
|
17
16
|
estimateRowHeight?: number;
|
|
@@ -19,5 +18,5 @@ interface IVirtualTableProps<T> {
|
|
|
19
18
|
retainedKeys?: readonly Key[];
|
|
20
19
|
layout?: ComponentProps<typeof Table>["layout"];
|
|
21
20
|
}
|
|
22
|
-
export declare function VirtualTable<T>({ items, getItemKey, renderRow, header, columns,
|
|
21
|
+
export declare function VirtualTable<T>({ items, getItemKey, renderRow, header, columns, label, maxHeight, estimateRowHeight, overscan, retainedKeys, layout, }: IVirtualTableProps<T>): ReactElement;
|
|
23
22
|
export {};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
Table2,
|
|
4
4
|
TableHeader2,
|
|
5
5
|
TableBody2
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-zte6pw69.js";
|
|
7
7
|
|
|
8
8
|
// src/components/virtual-table/VirtualTable.tsx
|
|
9
9
|
import {
|
|
@@ -21,7 +21,6 @@ function VirtualTable({
|
|
|
21
21
|
renderRow,
|
|
22
22
|
header,
|
|
23
23
|
columns,
|
|
24
|
-
columnCount,
|
|
25
24
|
label,
|
|
26
25
|
maxHeight = "65vh",
|
|
27
26
|
estimateRowHeight = 80,
|
|
@@ -74,7 +73,6 @@ function VirtualTable({
|
|
|
74
73
|
row.start > (rows[index - 1]?.end ?? 0) && /* @__PURE__ */ jsx("tr", {
|
|
75
74
|
"aria-hidden": "true",
|
|
76
75
|
children: /* @__PURE__ */ jsx("td", {
|
|
77
|
-
colSpan: columnCount,
|
|
78
76
|
style: { height: row.start - (rows[index - 1]?.end ?? 0), padding: 0, border: 0 }
|
|
79
77
|
})
|
|
80
78
|
}),
|
|
@@ -88,7 +86,6 @@ function VirtualTable({
|
|
|
88
86
|
last && virtualizer.getTotalSize() > last.end && /* @__PURE__ */ jsx("tr", {
|
|
89
87
|
"aria-hidden": "true",
|
|
90
88
|
children: /* @__PURE__ */ jsx("td", {
|
|
91
|
-
colSpan: columnCount,
|
|
92
89
|
style: { height: virtualizer.getTotalSize() - last.end, padding: 0, border: 0 }
|
|
93
90
|
})
|
|
94
91
|
})
|
package/dist/index.js
CHANGED
|
@@ -266,7 +266,7 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
266
266
|
<Table layout="fixed">
|
|
267
267
|
<TableColumnGroup>
|
|
268
268
|
<TableColumn />
|
|
269
|
-
<TableColumn visibleFrom="container-sm"
|
|
269
|
+
<TableColumn visibleFrom="container-sm" width={60}/>
|
|
270
270
|
</TableColumnGroup>
|
|
271
271
|
<TableHeader>
|
|
272
272
|
<TableRow>
|
|
@@ -9,7 +9,7 @@ Source: src/components/stories/data-display/VirtualTable.stories.tsx
|
|
|
9
9
|
|
|
10
10
|
```tsx
|
|
11
11
|
import { VirtualTable } from "@alexgorbatchev/shadcn/virtual-table";
|
|
12
|
-
import { TableCell, TableHead, TableRow, Button } from "@alexgorbatchev/shadcn";
|
|
12
|
+
import { TableCell, TableColumn, TableColumnGroup, TableHead, TableRow, Button } from "@alexgorbatchev/shadcn";
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Default component
|
|
@@ -26,7 +26,6 @@ VirtualTable
|
|
|
26
26
|
getItemKey: (item) => item,
|
|
27
27
|
label: "Items",
|
|
28
28
|
maxHeight: 300,
|
|
29
|
-
columnCount: 1,
|
|
30
29
|
header: (<TableRow>
|
|
31
30
|
<TableHead scope="col">Name</TableHead>
|
|
32
31
|
</TableRow>),
|
|
@@ -55,3 +54,32 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
55
54
|
args: { retainedKeys: ["Item 500"] }
|
|
56
55
|
}
|
|
57
56
|
```
|
|
57
|
+
|
|
58
|
+
### ResponsiveColumns
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
{
|
|
62
|
+
args: {
|
|
63
|
+
columns: (<TableColumnGroup>
|
|
64
|
+
<TableColumn />
|
|
65
|
+
<TableColumn visibleFrom="container-sm" width={80}/>
|
|
66
|
+
<TableColumn width={60}/>
|
|
67
|
+
</TableColumnGroup>),
|
|
68
|
+
header: (<TableRow>
|
|
69
|
+
<TableHead scope="col">Name</TableHead>
|
|
70
|
+
<TableHead scope="col" visibleFrom="container-sm">
|
|
71
|
+
Kind
|
|
72
|
+
</TableHead>
|
|
73
|
+
<TableHead scope="col">Size</TableHead>
|
|
74
|
+
</TableRow>),
|
|
75
|
+
renderRow: (item, props) => (<TableRow {...props}>
|
|
76
|
+
<TableCell>{item}</TableCell>
|
|
77
|
+
<TableCell visibleFrom="container-sm">File</TableCell>
|
|
78
|
+
<TableCell>1 KB</TableCell>
|
|
79
|
+
</TableRow>),
|
|
80
|
+
},
|
|
81
|
+
render: (args) => (<div style={{ width: 350 }}>
|
|
82
|
+
<VirtualTable {...args}/>
|
|
83
|
+
</div>)
|
|
84
|
+
}
|
|
85
|
+
```
|
package/llms/setup.md
CHANGED
|
@@ -300,7 +300,7 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
|
|
|
300
300
|
|
|
301
301
|
`InlineEdit` mounts an edit session with a controlled `value`, `onValueChange`, `onCommit`, and `onCancel`. Mount it in place of the displayed label. Its input focuses and selects its text by default; `shouldSelectOnMount={false}` preserves the initial caret. Enter or blur commits once, Escape cancels without committing, and asynchronous saves disable the input until completion. Rejected saves display an error and allow retry.
|
|
302
302
|
|
|
303
|
-
`VirtualTable` renders a bounded, dynamically measured set of native table rows using TanStack Virtual. Supply `items`, stable `getItemKey`, `header`, `
|
|
303
|
+
`VirtualTable` renders a bounded, dynamically measured set of native table rows using TanStack Virtual. Supply `items`, stable `getItemKey`, `header`, `label`, and `renderRow`; spread the supplied measurement props onto each native row. Optional `columns` accepts a `TableColumnGroup`; responsive columns keep their widths aligned with cells that share their `visibleFrom`. `maxHeight` defaults to `65vh`, `estimateRowHeight` to 80 pixels, and `overscan` to five rows. `retainedKeys` keeps editing rows mounted; the focused row is retained automatically. Filtering and selection belong to the consumer.
|
|
304
304
|
|
|
305
305
|
`StarRating` takes a controlled numeric `value` from 0 to 5, `onValueChange`, and an accessible `label`. Its native radio buttons support keyboard selection and an Unrated option to clear the rating. Set `disabled` while saving. `Avatar shape="square"` displays square artwork with matching image, fallback, and border corners.
|
|
306
306
|
|