@alexgorbatchev/shadcn 0.0.28 → 0.0.29
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
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
|
|
|
@@ -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 {};
|
|
@@ -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
|
})
|
|
@@ -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" style={{ width: 80 }}/>
|
|
66
|
+
<TableColumn style={{ 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
|
|