@alexgorbatchev/shadcn 0.0.30 → 0.0.31

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.
Files changed (32) hide show
  1. package/README.md +25 -22
  2. package/THIRD_PARTY_NOTICES.md +6 -0
  3. package/dist/chunk-1xncv9gb.js +19 -0
  4. package/dist/chunk-2dxa9enk.js +98 -0
  5. package/dist/{chunk-g238nezp.js → chunk-pg9rhbgm.js} +4 -2
  6. package/dist/{chunk-5da3rzn5.js → chunk-s0typ7hv.js} +1 -1
  7. package/dist/{chunk-eehfrrdz.js → chunk-tnnf8ydf.js} +1 -15
  8. package/dist/chunk-yfr9syen.js +363 -0
  9. package/dist/components/Table.d.ts +1 -0
  10. package/dist/components/assistant-ui/elements/OptionList.js +3 -2
  11. package/dist/components/assistant-ui/elements/QuestionFlow.js +4 -3
  12. package/dist/components/assistant-ui/index.js +4 -3
  13. package/dist/components/data-grid/DataGrid.d.ts +48 -9
  14. package/dist/components/data-grid/DataGridColumnOptions.d.ts +14 -0
  15. package/dist/components/data-grid/DataGridColumnResizer.d.ts +13 -0
  16. package/dist/components/data-grid/getDataGridColumnSizeVariables.d.ts +6 -0
  17. package/dist/components/data-grid/hooks/useDataGridColumnSizes.d.ts +8 -0
  18. package/dist/components/data-grid/index.d.ts +3 -2
  19. package/dist/components/data-grid/index.js +124 -199
  20. package/dist/components/data-grid/moveDataGridColumn.d.ts +5 -0
  21. package/dist/components/event-calendar/index.js +4 -2
  22. package/dist/components/virtual-data-grid/VirtualDataGrid.d.ts +26 -0
  23. package/dist/components/virtual-data-grid/index.d.ts +2 -0
  24. package/dist/components/virtual-data-grid/index.js +88 -0
  25. package/dist/components/virtual-table/index.js +4 -96
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +5 -3
  28. package/llms/components/data-display/DataGridColumnOptions.md +22 -0
  29. package/llms/components/data-display/VirtualDataGrid.md +71 -0
  30. package/llms/setup.md +25 -22
  31. package/llms.txt +2 -0
  32. package/package.json +6 -2
@@ -1,100 +1,8 @@
1
1
  import"../../chunk-cp2m7y7v.js";
2
+ import"../../chunk-zte6pw69.js";
2
3
  import {
3
- Table2,
4
- TableHeader2,
5
- TableBody2
6
- } from "../../chunk-zte6pw69.js";
7
-
8
- // src/components/virtual-table/VirtualTable.tsx
9
- import {
10
- Fragment,
11
- useCallback,
12
- useMemo,
13
- useRef,
14
- useState
15
- } from "react";
16
- import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
17
- import { jsx, jsxs } from "react/jsx-runtime";
18
- function VirtualTable({
19
- items,
20
- getItemKey,
21
- renderRow,
22
- header,
23
- columns,
24
- label,
25
- maxHeight = "65vh",
26
- estimateRowHeight = 80,
27
- overscan = 5,
28
- retainedKeys,
29
- layout = "fixed"
30
- }) {
31
- const viewport = useRef(null);
32
- const [focusedKey, setFocusedKey] = useState();
33
- const retained = useMemo(() => items.flatMap((item, index) => retainedKeys?.includes(getItemKey(item)) || getItemKey(item) === focusedKey ? [index] : []), [items, retainedKeys, getItemKey, focusedKey]);
34
- const rangeExtractor = useCallback((range) => [...new Set([...defaultRangeExtractor(range), ...retained])].sort((a, b) => a - b), [retained]);
35
- const itemKey = useCallback((index) => getItemKey(items[index]), [items, getItemKey]);
36
- const virtualizer = useVirtualizer({
37
- count: items.length,
38
- getScrollElement: () => viewport.current,
39
- getItemKey: itemKey,
40
- estimateSize: () => estimateRowHeight,
41
- overscan,
42
- rangeExtractor
43
- });
44
- const rows = virtualizer.getVirtualItems();
45
- const last = rows.at(-1);
46
- return /* @__PURE__ */ jsx("div", {
47
- ref: viewport,
48
- "data-testid": "VirtualTable",
49
- role: "region",
50
- "aria-label": label,
51
- tabIndex: 0,
52
- className: "min-w-0 overflow-auto overscroll-contain",
53
- style: { maxHeight },
54
- onFocusCapture: (event) => {
55
- const row = event.target.closest("tr[data-index]");
56
- const item = items[Number(row?.dataset.index)];
57
- if (row && item)
58
- setFocusedKey(getItemKey(item));
59
- },
60
- children: /* @__PURE__ */ jsxs(Table2, {
61
- layout,
62
- "aria-label": label,
63
- "aria-rowcount": items.length + 1,
64
- children: [
65
- columns,
66
- /* @__PURE__ */ jsx(TableHeader2, {
67
- children: header
68
- }),
69
- /* @__PURE__ */ jsxs(TableBody2, {
70
- children: [
71
- rows.map((row, index) => /* @__PURE__ */ jsxs(Fragment, {
72
- children: [
73
- row.start > (rows[index - 1]?.end ?? 0) && /* @__PURE__ */ jsx("tr", {
74
- "aria-hidden": "true",
75
- children: /* @__PURE__ */ jsx("td", {
76
- style: { height: row.start - (rows[index - 1]?.end ?? 0), padding: 0, border: 0 }
77
- })
78
- }),
79
- renderRow(items[row.index], {
80
- ref: virtualizer.measureElement,
81
- "data-index": row.index,
82
- "aria-rowindex": row.index + 2
83
- })
84
- ]
85
- }, row.key)),
86
- last && virtualizer.getTotalSize() > last.end && /* @__PURE__ */ jsx("tr", {
87
- "aria-hidden": "true",
88
- children: /* @__PURE__ */ jsx("td", {
89
- style: { height: virtualizer.getTotalSize() - last.end, padding: 0, border: 0 }
90
- })
91
- })
92
- ]
93
- })
94
- ]
95
- })
96
- });
97
- }
4
+ VirtualTable2
5
+ } from "../../chunk-2dxa9enk.js";
98
6
  export {
99
- VirtualTable
7
+ VirtualTable2 as VirtualTable
100
8
  };
package/dist/index.d.ts CHANGED
@@ -60,6 +60,7 @@ export { Progress, ProgressTrack, ProgressIndicator, ProgressLabel, ProgressValu
60
60
  export { Collapsible, CollapsibleTrigger, CollapsibleContent } from "./components/Collapsible.js";
61
61
  export { Spinner } from "./components/Spinner.js";
62
62
  export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, TableColumnGroup, TableColumn, } from "./components/Table.js";
63
+ export type { TableTextAlign, TableVisibility } from "./components/Table.js";
63
64
  export { NativeSelect, NativeSelectOptGroup, NativeSelectOption } from "./components/NativeSelect.js";
64
65
  export { Kbd, KbdGroup } from "./components/Kbd.js";
65
66
  export { Item, ItemMedia, ItemContent, ItemActions, ItemGroup, ItemSeparator, ItemTitle, ItemDescription, ItemHeader, ItemFooter, } from "./components/Item.js";
package/dist/index.js CHANGED
@@ -145,9 +145,8 @@ import {
145
145
  EmptyContent2
146
146
  } from "./chunk-9de1htr5.js";
147
147
  import {
148
- Checkbox2,
149
- Spinner2
150
- } from "./chunk-eehfrrdz.js";
148
+ Checkbox2
149
+ } from "./chunk-tnnf8ydf.js";
151
150
  import {
152
151
  ThemeContext,
153
152
  useTheme2
@@ -187,6 +186,9 @@ import {
187
186
  CollapsibleTrigger2,
188
187
  CollapsibleContent2
189
188
  } from "./chunk-24d68cjp.js";
189
+ import {
190
+ Spinner2
191
+ } from "./chunk-1xncv9gb.js";
190
192
  import {
191
193
  Table2,
192
194
  TableHeader2,
@@ -0,0 +1,22 @@
1
+ # DataGridColumnOptions
2
+
3
+ Story: @alexgorbatchev/shadcn/components/data-display/DataGridColumnOptions
4
+ Source: src/components/stories/data-display/DataGridColumnOptions.stories.tsx
5
+
6
+ [Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/DataGridColumnOptions.stories.tsx)
7
+
8
+ ## Default render
9
+
10
+ ```tsx
11
+ () => <VirtualDataGridExample files={fixture_gridFiles}/>
12
+ ```
13
+
14
+ ## Examples
15
+
16
+ Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
17
+
18
+ ### Default
19
+
20
+ ```tsx
21
+ {}
22
+ ```
@@ -0,0 +1,71 @@
1
+ # VirtualDataGrid
2
+
3
+ Story: @alexgorbatchev/shadcn/components/data-display/VirtualDataGrid
4
+ Source: src/components/stories/data-display/VirtualDataGrid.stories.tsx
5
+
6
+ [Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/VirtualDataGrid.stories.tsx)
7
+
8
+ ## Public imports
9
+
10
+ ```tsx
11
+ import { DataGridCells } from "@alexgorbatchev/shadcn/data-grid";
12
+ import { TableRow } from "@alexgorbatchev/shadcn";
13
+ ```
14
+
15
+ ## Supporting imports
16
+
17
+ ```tsx
18
+ import { useState, type ReactElement } from "react";
19
+ ```
20
+
21
+ ## Default render
22
+
23
+ ```tsx
24
+ () => <VirtualDataGridExample files={fixture_gridFiles}/>
25
+ ```
26
+
27
+ ## Examples
28
+
29
+ Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
30
+
31
+ ### LargeCollection
32
+
33
+ ```tsx
34
+ {}
35
+ ```
36
+
37
+ ### SelectedRow
38
+
39
+ ```tsx
40
+ {}
41
+ ```
42
+
43
+ ### KeyboardResizing
44
+
45
+ ```tsx
46
+ {}
47
+ ```
48
+
49
+ ### CustomRows
50
+
51
+ ```tsx
52
+ {
53
+ render: () => <CustomRowsExample />
54
+ }
55
+ ```
56
+
57
+ ### RetainedRow
58
+
59
+ ```tsx
60
+ {
61
+ render: () => <VirtualDataGridExample files={fixture_gridFiles} retainedRowIds={["file-500"]}/>
62
+ }
63
+ ```
64
+
65
+ ### NarrowContainer
66
+
67
+ ```tsx
68
+ {
69
+ render: () => <VirtualDataGridExample files={fixture_gridFiles} width={360}/>
70
+ }
71
+ ```
package/llms/setup.md CHANGED
@@ -50,28 +50,29 @@ Package preparation and contributor commands are documented in [AGENTS.md](https
50
50
 
51
51
  Import shared controls and providers from `@alexgorbatchev/shadcn`. Import the following features from their dedicated entry points and install only the peers you use. These features, their hooks, and their types are not exported from the package root.
52
52
 
53
- | Import path suffix | Components | Install alongside the package |
54
- | ------------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
55
- | `/chart` | Chart parts, AnalyticsChart, Sparkline, hooks and types | `bun add recharts@3.8.0 cssesc@3.0.0 es-toolkit@1.52.0` |
56
- | `/calendar` | Calendar, CalendarDayButton, DatePicker, DateRangePicker | `bun add @daypicker/react@^10.0.2` |
57
- | `/persian-calendar` | PersianCalendar | `bun add @daypicker/persian@^10.0.2 @daypicker/react@^10.0.2` |
58
- | `/carousel` | Carousel components, useCarousel, and carousel types | `bun add embla-carousel-react@^8.6.0` |
59
- | `/command` | Command components, including CommandDialog | `bun add cmdk@^1.1.1` |
60
- | `/resizable` | Resizable components and SplitView | `bun add react-resizable-panels@^4.14.3` |
61
- | `/fonts.css` | JetBrains Mono font stylesheet | `bun add @fontsource-variable/jetbrains-mono@^5.3.0` |
62
- | `/sonner` | Sonner, SonnerToaster, Toaster, toast, useSonner | No additional install; patched implementation is bundled |
63
- | `/input-otp` | InputOTP components | No additional install; patched implementation is bundled |
64
- | `/virtual-table` | VirtualTable and row measurement props | `@tanstack/react-virtual@3.14.13` |
65
- | `/message-scroller` | MessageScroller components, hooks, and types | No additional install; patched implementation is bundled |
66
- | `/questionnaire` | Questionnaire components and types | No additional install; patched implementation is bundled |
67
- | `/data-grid` | DataGrid and native table helpers | `bun add @tanstack/react-table@9.2.8` |
68
- | `/file-upload` | FileUpload selection and validation | `bun add react-dropzone@^20.1.4` |
69
- | `/color-picker` | ColorPicker | `bun add react-colorful@^5.8.1` |
70
- | `/image-crop` | ImageCrop and native export helpers | `bun add react-image-crop@^11.1.2` |
71
- | `/tree` | Tree, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0` |
72
- | `/editor` | RichTextEditor, native Tiptap hooks and StarterKit | `bun add @tiptap/core@^3.32.0 @tiptap/react@^3.32.0 @tiptap/pm@^3.32.0 @tiptap/starter-kit@^3.32.0` |
73
- | `/event-calendar` | EventCalendar, EventForm and native calendar APIs | `bun add date-fns@^4.4.0`; TypeScript: `bun add -d @types/react-big-calendar@^1.16.3` |
74
- | `/gantt` | Gantt and Roadmap | `bun add date-fns@^4.4.0 @date-fns/tz@^1.5.0` |
53
+ | Import path suffix | Components | Install alongside the package |
54
+ | -------------------- | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
55
+ | `/chart` | Chart parts, AnalyticsChart, Sparkline, hooks and types | `bun add recharts@3.8.0 cssesc@3.0.0 es-toolkit@1.52.0` |
56
+ | `/calendar` | Calendar, CalendarDayButton, DatePicker, DateRangePicker | `bun add @daypicker/react@^10.0.2` |
57
+ | `/persian-calendar` | PersianCalendar | `bun add @daypicker/persian@^10.0.2 @daypicker/react@^10.0.2` |
58
+ | `/carousel` | Carousel components, useCarousel, and carousel types | `bun add embla-carousel-react@^8.6.0` |
59
+ | `/command` | Command components, including CommandDialog | `bun add cmdk@^1.1.1` |
60
+ | `/resizable` | Resizable components and SplitView | `bun add react-resizable-panels@^4.14.3` |
61
+ | `/fonts.css` | JetBrains Mono font stylesheet | `bun add @fontsource-variable/jetbrains-mono@^5.3.0` |
62
+ | `/sonner` | Sonner, SonnerToaster, Toaster, toast, useSonner | No additional install; patched implementation is bundled |
63
+ | `/input-otp` | InputOTP components | No additional install; patched implementation is bundled |
64
+ | `/virtual-table` | VirtualTable and row measurement props | `@tanstack/react-virtual@3.14.13` |
65
+ | `/message-scroller` | MessageScroller components, hooks, and types | No additional install; patched implementation is bundled |
66
+ | `/questionnaire` | Questionnaire components and types | No additional install; patched implementation is bundled |
67
+ | `/data-grid` | DataGrid, column picker, and native table helpers | `bun add @tanstack/react-table@9.2.8` |
68
+ | `/virtual-data-grid` | VirtualDataGrid and row measurement props | `bun add @tanstack/react-table@9.2.8 @tanstack/react-virtual@3.14.13` |
69
+ | `/file-upload` | FileUpload selection and validation | `bun add react-dropzone@^20.1.4` |
70
+ | `/color-picker` | ColorPicker | `bun add react-colorful@^5.8.1` |
71
+ | `/image-crop` | ImageCrop and native export helpers | `bun add react-image-crop@^11.1.2` |
72
+ | `/tree` | Tree, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0` |
73
+ | `/editor` | RichTextEditor, native Tiptap hooks and StarterKit | `bun add @tiptap/core@^3.32.0 @tiptap/react@^3.32.0 @tiptap/pm@^3.32.0 @tiptap/starter-kit@^3.32.0` |
74
+ | `/event-calendar` | EventCalendar, EventForm and native calendar APIs | `bun add date-fns@^4.4.0`; TypeScript: `bun add -d @types/react-big-calendar@^1.16.3` |
75
+ | `/gantt` | Gantt and Roadmap | `bun add date-fns@^4.4.0 @date-fns/tz@^1.5.0` |
75
76
 
76
77
  Import `@alexgorbatchev/shadcn/event-calendar.css` for EventCalendar, and `react-image-crop/dist/ReactCrop.css` for ImageCrop. The root also provides application shells, dashboard and billing layouts, authentication/settings forms, account/workspace controls, Kanban, facets, tags, number fields, toolbars, meters, stat cards and status displays. See the [component catalog reference](https://github.com/alexgorbatchev/shadcn/blob/main/docs/internal/component-catalog.md) for source groups, native APIs, dependency costs and consumer responsibilities.
77
78
 
@@ -302,6 +303,8 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
302
303
 
303
304
  `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
305
 
306
+ `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
+
305
308
  `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
309
 
307
310
  `DialogContent size="wide"` uses a desktop maximum width of 576px; `size="narrow"` uses 192px, and the default uses 384px. Dialogs remain bounded by the viewport. `FieldGroup columns={2}` arranges fields in two columns on desktop and one on mobile.
package/llms.txt CHANGED
@@ -333,6 +333,7 @@ Generated from the public package exports and Storybook sources.
333
333
  - [Carousel](./llms/components/data-display/Carousel.md)
334
334
  - [Chart](./llms/components/data-display/Chart.md)
335
335
  - [DataGrid](./llms/components/data-display/DataGrid.md)
336
+ - [DataGridColumnOptions](./llms/components/data-display/DataGridColumnOptions.md)
336
337
  - [Item](./llms/components/data-display/Item.md)
337
338
  - [JsonViewer](./llms/components/data-display/JsonViewer.md)
338
339
  - [Kbd](./llms/components/data-display/Kbd.md)
@@ -341,6 +342,7 @@ Generated from the public package exports and Storybook sources.
341
342
  - [StatCard](./llms/components/data-display/StatCard.md)
342
343
  - [StatusTracker](./llms/components/data-display/StatusTracker.md)
343
344
  - [Table](./llms/components/data-display/Table.md)
345
+ - [VirtualDataGrid](./llms/components/data-display/VirtualDataGrid.md)
344
346
  - [VirtualTable](./llms/components/data-display/VirtualTable.md)
345
347
 
346
348
  ## dates
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexgorbatchev/shadcn",
3
- "version": "0.0.30",
3
+ "version": "0.0.31",
4
4
  "description": "Sharp, monospace React components with compact and comfortable densities.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1020,6 +1020,10 @@
1020
1020
  "types": "./dist/components/data-grid/index.d.ts",
1021
1021
  "import": "./dist/components/data-grid/index.js"
1022
1022
  },
1023
+ "./virtual-data-grid": {
1024
+ "types": "./dist/components/virtual-data-grid/index.d.ts",
1025
+ "import": "./dist/components/virtual-data-grid/index.js"
1026
+ },
1023
1027
  "./event-calendar": {
1024
1028
  "types": "./dist/components/event-calendar/index.d.ts",
1025
1029
  "import": "./dist/components/event-calendar/index.js"
@@ -1141,7 +1145,7 @@
1141
1145
  "strip-ansi": "7.2.0",
1142
1146
  "tailwindcss": "^4.3.3",
1143
1147
  "ts-unused": "3.7.1",
1144
- "typescript": "^6.0.3",
1148
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
1145
1149
  "vite": "^8.3.4",
1146
1150
  "vitest": "^4.1.6",
1147
1151
  "vitest-browser-react": "^2.3.0",