@alexgorbatchev/shadcn 0.0.33 → 0.0.35

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
@@ -304,7 +304,7 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
304
304
 
305
305
  `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.
306
306
 
307
- `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`, and `fill`; a `fill` column takes the width the sized columns leave. Other resizable columns get a window-splitter handle that resizes by dragging, by the arrow keys, Home, and End, and resets on double-click. 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.
307
+ `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.
308
308
 
309
309
  `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.
310
310
 
@@ -38,7 +38,8 @@ function VirtualTable2({
38
38
  getItemKey: itemKey,
39
39
  estimateSize: () => estimateRowHeight,
40
40
  overscan,
41
- rangeExtractor
41
+ rangeExtractor,
42
+ useAnimationFrameWithResizeObserver: true
42
43
  });
43
44
  const rows = virtualizer.getVirtualItems();
44
45
  const last = rows.at(-1);
@@ -118,9 +118,10 @@ function getDataGridColumnLabel(column) {
118
118
  return column.columnDef.meta?.label ?? (typeof header === "string" ? header : column.id);
119
119
  }
120
120
  function getAriaSort(column) {
121
- if (!column.getCanSort())
121
+ const sortable = [column.id, ...column.columnDef.meta?.sortColumnIds ?? []].map((id) => column.table.getColumn(id)).filter((candidate) => candidate?.getCanSort());
122
+ if (sortable.length === 0)
122
123
  return;
123
- const sorted = column.getIsSorted();
124
+ const sorted = sortable.map((candidate) => candidate?.getIsSorted()).find(Boolean);
124
125
  return sorted === "asc" ? "ascending" : sorted === "desc" ? "descending" : "none";
125
126
  }
126
127
  function DataGridHeaderCell({ header, isResizable }) {
@@ -267,7 +268,7 @@ function DataGridColumnHeader2({
267
268
  return column.getCanSort() ? /* @__PURE__ */ jsxs(Button2, {
268
269
  type: "button",
269
270
  variant: "ghost",
270
- size: "sm",
271
+ size: "inline",
271
272
  onClick: column.getToggleSortingHandler(),
272
273
  children: [
273
274
  children,
@@ -12,6 +12,11 @@ interface IDataGridColumnMeta {
12
12
  visibleFrom?: TableVisibility;
13
13
  /** Takes the width the sized columns leave, so it has no fixed size of its own. */
14
14
  fill?: boolean;
15
+ /**
16
+ * Other columns this header sorts with its own controls, such as a hidden column behind a second sort button. The
17
+ * header's `aria-sort` reports whichever of them, or the column itself, is sorted.
18
+ */
19
+ sortColumnIds?: readonly string[];
15
20
  }
16
21
  declare const dataGridFeatures: {
17
22
  columnFilteringFeature: import("@tanstack/react-table").TableFeature;
@@ -13,7 +13,7 @@ import {
13
13
  DataGridColumnHeader2,
14
14
  DataGridFilter2,
15
15
  DataGridPagination2
16
- } from "../../chunk-yfr9syen.js";
16
+ } from "../../chunk-h5kjmt32.js";
17
17
  import {
18
18
  Checkbox2
19
19
  } from "../../chunk-tnnf8ydf.js";
@@ -10,10 +10,10 @@ import {
10
10
  DataGridHeaderRows,
11
11
  DataGridCells2,
12
12
  DataGridColumns
13
- } from "../../chunk-yfr9syen.js";
13
+ } from "../../chunk-h5kjmt32.js";
14
14
  import {
15
15
  VirtualTable2
16
- } from "../../chunk-2dxa9enk.js";
16
+ } from "../../chunk-efs4bk5b.js";
17
17
 
18
18
  // src/components/virtual-data-grid/VirtualDataGrid.tsx
19
19
  import { useRef } from "react";
@@ -2,7 +2,7 @@ import"../../chunk-cp2m7y7v.js";
2
2
  import"../../chunk-zte6pw69.js";
3
3
  import {
4
4
  VirtualTable2
5
- } from "../../chunk-2dxa9enk.js";
5
+ } from "../../chunk-efs4bk5b.js";
6
6
  export {
7
7
  VirtualTable2 as VirtualTable
8
8
  };
@@ -49,3 +49,11 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
49
49
  render: () => <Example pagination={false}/>
50
50
  }
51
51
  ```
52
+
53
+ ### CombinedSortHeader
54
+
55
+ ```tsx
56
+ {
57
+ render: () => <CombinedSortExample />
58
+ }
59
+ ```
@@ -62,6 +62,12 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
62
62
  }
63
63
  ```
64
64
 
65
+ ### AlignedHeaders
66
+
67
+ ```tsx
68
+ {}
69
+ ```
70
+
65
71
  ### NarrowContainer
66
72
 
67
73
  ```tsx
package/llms/setup.md CHANGED
@@ -304,7 +304,7 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
304
304
 
305
305
  `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.
306
306
 
307
- `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`, and `fill`; a `fill` column takes the width the sized columns leave. Other resizable columns get a window-splitter handle that resizes by dragging, by the arrow keys, Home, and End, and resets on double-click. 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.
307
+ `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.
308
308
 
309
309
  `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.
310
310
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {