@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 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`, `columnCount`, `label`, and `renderRow`; spread the supplied measurement props onto each native row. Optional `columns` accepts a colgroup. `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.
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
 
@@ -21,7 +21,7 @@ import {
21
21
  TableHead2,
22
22
  TableCell2,
23
23
  TableCaption2
24
- } from "./chunk-v0k5jnk5.js";
24
+ } from "./chunk-zte6pw69.js";
25
25
  import {
26
26
  safeHref
27
27
  } from "./chunk-xhtsnwnb.js";
@@ -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
- /** A sized column; give it the same `visibleFrom` as its header and cells. */
30
- declare function TableColumn({ className, visibleFrom, ...props }: TableColumnProps): ReactElement;
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-3z5gpbh0.js";
3
+ } from "../../../chunk-987zth0a.js";
4
4
  import"../../../chunk-1wz92wgg.js";
5
- import"../../../chunk-v0k5jnk5.js";
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-3z5gpbh0.js";
203
- import"../../chunk-v0k5jnk5.js";
202
+ } from "../../chunk-987zth0a.js";
203
+ import"../../chunk-zte6pw69.js";
204
204
  import {
205
205
  DaySeparator2
206
206
  } from "../../chunk-jhw9q2eq.js";
@@ -9,7 +9,7 @@ import {
9
9
  TableRow2,
10
10
  TableHead2,
11
11
  TableCell2
12
- } from "../../chunk-v0k5jnk5.js";
12
+ } from "../../chunk-zte6pw69.js";
13
13
  import {
14
14
  NativeSelect2,
15
15
  NativeSelectOption2
@@ -24,7 +24,7 @@ import {
24
24
  TableRow2,
25
25
  TableHead2,
26
26
  TableCell2
27
- } from "../../chunk-v0k5jnk5.js";
27
+ } from "../../chunk-zte6pw69.js";
28
28
 
29
29
  // src/components/gantt/Gantt.tsx
30
30
  import { useId, useState } from "react";
@@ -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, columnCount, label, maxHeight, estimateRowHeight, overscan, retainedKeys, layout, }: IVirtualTableProps<T>): ReactElement;
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-v0k5jnk5.js";
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
@@ -198,7 +198,7 @@ import {
198
198
  TableColumnGroup2,
199
199
  TableColumn2,
200
200
  TableCaption2
201
- } from "./chunk-v0k5jnk5.js";
201
+ } from "./chunk-zte6pw69.js";
202
202
  import {
203
203
  NativeSelect2,
204
204
  NativeSelectOption2,
@@ -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" style={{ width: 60 }}/>
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`, `columnCount`, `label`, and `renderRow`; spread the supplied measurement props onto each native row. Optional `columns` accepts a colgroup. `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.
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {