@alexgorbatchev/shadcn 0.0.30 → 0.0.32

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 (93) hide show
  1. package/README.md +26 -22
  2. package/THIRD_PARTY_NOTICES.md +10 -0
  3. package/dist/{chunk-0ewzb2ax.js → chunk-0kyfh857.js} +1 -1
  4. package/dist/chunk-1xncv9gb.js +19 -0
  5. package/dist/chunk-2dxa9enk.js +98 -0
  6. package/dist/{chunk-8wfy03bp.js → chunk-6kwf9644.js} +1 -1
  7. package/dist/{chunk-82e7fbmq.js → chunk-9vyg3854.js} +2 -1
  8. package/dist/chunk-c6g2rbhv.js +3940 -0
  9. package/dist/chunk-dzvsjw59.js +200 -0
  10. package/dist/{chunk-g238nezp.js → chunk-pg9rhbgm.js} +4 -2
  11. package/dist/{chunk-5da3rzn5.js → chunk-s0typ7hv.js} +1 -1
  12. package/dist/chunk-tch86q2w.js +6050 -0
  13. package/dist/{chunk-eehfrrdz.js → chunk-tnnf8ydf.js} +1 -15
  14. package/dist/chunk-yfr9syen.js +363 -0
  15. package/dist/{chunk-53q730zs.js → chunk-zdt8xxzy.js} +3 -0
  16. package/dist/components/Alert.d.ts +1 -1
  17. package/dist/components/Table.d.ts +1 -0
  18. package/dist/components/assistant-ui/elements/Chart.js +2 -2
  19. package/dist/components/assistant-ui/elements/GuardrailNotice.js +2 -2
  20. package/dist/components/assistant-ui/elements/OptionList.js +3 -2
  21. package/dist/components/assistant-ui/elements/QuestionFlow.js +4 -3
  22. package/dist/components/assistant-ui/index.js +8 -7
  23. package/dist/components/assistant-ui/native/Sources.d.ts +1 -1
  24. package/dist/components/carousel/index.js +15 -204
  25. package/dist/components/chart/AnalyticsChart.d.ts +3 -2
  26. package/dist/components/chart/Chart.d.ts +1 -1
  27. package/dist/components/chart/index.js +24 -10
  28. package/dist/components/chart/types.d.ts +1 -0
  29. package/dist/components/data-grid/DataGrid.d.ts +48 -9
  30. package/dist/components/data-grid/DataGridColumnOptions.d.ts +14 -0
  31. package/dist/components/data-grid/DataGridColumnResizer.d.ts +13 -0
  32. package/dist/components/data-grid/getDataGridColumnSizeVariables.d.ts +6 -0
  33. package/dist/components/data-grid/hooks/useDataGridColumnSizes.d.ts +8 -0
  34. package/dist/components/data-grid/index.d.ts +3 -2
  35. package/dist/components/data-grid/index.js +124 -199
  36. package/dist/components/data-grid/moveDataGridColumn.d.ts +5 -0
  37. package/dist/components/event-calendar/index.js +4 -2
  38. package/dist/components/json-render/JsonAccordion.d.ts +3 -0
  39. package/dist/components/json-render/JsonAlert.d.ts +3 -0
  40. package/dist/components/json-render/JsonAvatar.d.ts +3 -0
  41. package/dist/components/json-render/JsonBadge.d.ts +3 -0
  42. package/dist/components/json-render/JsonButton.d.ts +3 -0
  43. package/dist/components/json-render/JsonButtonGroup.d.ts +3 -0
  44. package/dist/components/json-render/JsonCard.d.ts +3 -0
  45. package/dist/components/json-render/JsonCarousel.d.ts +3 -0
  46. package/dist/components/json-render/JsonCheckbox.d.ts +3 -0
  47. package/dist/components/json-render/JsonCollapsible.d.ts +3 -0
  48. package/dist/components/json-render/JsonDialog.d.ts +3 -0
  49. package/dist/components/json-render/JsonDrawer.d.ts +3 -0
  50. package/dist/components/json-render/JsonDropdownMenu.d.ts +3 -0
  51. package/dist/components/json-render/JsonGrid.d.ts +3 -0
  52. package/dist/components/json-render/JsonHeading.d.ts +3 -0
  53. package/dist/components/json-render/JsonImage.d.ts +3 -0
  54. package/dist/components/json-render/JsonInput.d.ts +3 -0
  55. package/dist/components/json-render/JsonLink.d.ts +3 -0
  56. package/dist/components/json-render/JsonPagination.d.ts +3 -0
  57. package/dist/components/json-render/JsonPopover.d.ts +3 -0
  58. package/dist/components/json-render/JsonProgress.d.ts +3 -0
  59. package/dist/components/json-render/JsonRadio.d.ts +3 -0
  60. package/dist/components/json-render/JsonSelect.d.ts +3 -0
  61. package/dist/components/json-render/JsonSeparator.d.ts +3 -0
  62. package/dist/components/json-render/JsonSkeleton.d.ts +3 -0
  63. package/dist/components/json-render/JsonSlider.d.ts +3 -0
  64. package/dist/components/json-render/JsonSpinner.d.ts +3 -0
  65. package/dist/components/json-render/JsonStack.d.ts +3 -0
  66. package/dist/components/json-render/JsonSwitch.d.ts +3 -0
  67. package/dist/components/json-render/JsonTable.d.ts +3 -0
  68. package/dist/components/json-render/JsonTabs.d.ts +3 -0
  69. package/dist/components/json-render/JsonText.d.ts +3 -0
  70. package/dist/components/json-render/JsonTextarea.d.ts +3 -0
  71. package/dist/components/json-render/JsonToggle.d.ts +3 -0
  72. package/dist/components/json-render/JsonToggleGroup.d.ts +3 -0
  73. package/dist/components/json-render/JsonTooltip.d.ts +3 -0
  74. package/dist/components/json-render/catalog.d.ts +548 -0
  75. package/dist/components/json-render/catalog.js +6 -0
  76. package/dist/components/json-render/getPaginationRange.d.ts +1 -0
  77. package/dist/components/json-render/index.d.ts +39 -0
  78. package/dist/components/json-render/index.js +1254 -0
  79. package/dist/components/virtual-data-grid/VirtualDataGrid.d.ts +26 -0
  80. package/dist/components/virtual-data-grid/index.d.ts +2 -0
  81. package/dist/components/virtual-data-grid/index.js +88 -0
  82. package/dist/components/virtual-table/index.js +4 -96
  83. package/dist/index.d.ts +1 -0
  84. package/dist/index.js +569 -4189
  85. package/licenses/json-render-APACHE-2.0.txt +201 -0
  86. package/llms/components/data-display/AnalyticsChart.md +34 -0
  87. package/llms/components/data-display/DataGridColumnOptions.md +22 -0
  88. package/llms/components/data-display/JsonRender.md +476 -0
  89. package/llms/components/data-display/VirtualDataGrid.md +71 -0
  90. package/llms/components/feedback/Alert.md +20 -4
  91. package/llms/setup.md +26 -22
  92. package/llms.txt +3 -0
  93. package/package.json +24 -2
package/README.md CHANGED
@@ -50,28 +50,30 @@ Package preparation and contributor commands are documented in [AGENTS.md](./AGE
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
+ | `/json-render` | JSON Render component registry and catalog | `bun add @json-render/core@0.21.1 @json-render/react@0.21.1 embla-carousel-react@^8.6.0` |
56
+ | `/chart` | Chart parts, AnalyticsChart, Sparkline, hooks and types | `bun add recharts@3.8.0 cssesc@3.0.0 es-toolkit@1.52.0` |
57
+ | `/calendar` | Calendar, CalendarDayButton, DatePicker, DateRangePicker | `bun add @daypicker/react@^10.0.2` |
58
+ | `/persian-calendar` | PersianCalendar | `bun add @daypicker/persian@^10.0.2 @daypicker/react@^10.0.2` |
59
+ | `/carousel` | Carousel components, useCarousel, and carousel types | `bun add embla-carousel-react@^8.6.0` |
60
+ | `/command` | Command components, including CommandDialog | `bun add cmdk@^1.1.1` |
61
+ | `/resizable` | Resizable components and SplitView | `bun add react-resizable-panels@^4.14.3` |
62
+ | `/fonts.css` | JetBrains Mono font stylesheet | `bun add @fontsource-variable/jetbrains-mono@^5.3.0` |
63
+ | `/sonner` | Sonner, SonnerToaster, Toaster, toast, useSonner | No additional install; patched implementation is bundled |
64
+ | `/input-otp` | InputOTP components | No additional install; patched implementation is bundled |
65
+ | `/virtual-table` | VirtualTable and row measurement props | `@tanstack/react-virtual@3.14.13` |
66
+ | `/message-scroller` | MessageScroller components, hooks, and types | No additional install; patched implementation is bundled |
67
+ | `/questionnaire` | Questionnaire components and types | No additional install; patched implementation is bundled |
68
+ | `/data-grid` | DataGrid, column picker, and native table helpers | `bun add @tanstack/react-table@9.2.8` |
69
+ | `/virtual-data-grid` | VirtualDataGrid and row measurement props | `bun add @tanstack/react-table@9.2.8 @tanstack/react-virtual@3.14.13` |
70
+ | `/file-upload` | FileUpload selection and validation | `bun add react-dropzone@^20.1.4` |
71
+ | `/color-picker` | ColorPicker | `bun add react-colorful@^5.8.1` |
72
+ | `/image-crop` | ImageCrop and native export helpers | `bun add react-image-crop@^11.1.2` |
73
+ | `/tree` | Tree, native hooks and features | `bun add @headless-tree/core@^1.8.0 @headless-tree/react@^1.8.0` |
74
+ | `/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` |
75
+ | `/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` |
76
+ | `/gantt` | Gantt and Roadmap | `bun add date-fns@^4.4.0 @date-fns/tz@^1.5.0` |
75
77
 
76
78
  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](./docs/internal/component-catalog.md) for source groups, native APIs, dependency costs and consumer responsibilities.
77
79
 
@@ -302,6 +304,8 @@ Compose `QuestionnaireItem`, `QuestionnaireTitle`, and answer controls inside `Q
302
304
 
303
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.
304
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.
308
+
305
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.
306
310
 
307
311
  `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.
@@ -164,6 +164,12 @@ DataGrid, FilterBar, Stepper, FileUpload, Tree, Kanban and planning compositions
164
164
 
165
165
  Reviewed source: https://github.com/keenthemes/reui/tree/067aa0dc7f8bbfec1cd76fc5ad31f842be5f569a
166
166
 
167
+ ## TanStack Table examples
168
+
169
+ VirtualDataGrid and DataGridColumnOptions follow the MIT-licensed TanStack Table React examples for virtualized rows, performant column resizing through CSS variables, column ordering, and column visibility. The package implementation, styling, keyboard resizing and behavioral tests are package-owned.
170
+
171
+ Reviewed source: https://github.com/TanStack/table/tree/main/examples/react
172
+
167
173
  MIT License
168
174
 
169
175
  Copyright (c) 2025 Keenthemes Inc
@@ -219,3 +225,7 @@ The optional feature imports use external, separately installed react-dropzone 2
219
225
  ## React Big Calendar and uncontrollable
220
226
 
221
227
  The `/event-calendar` entry point bundles React Big Calendar 1.20.0 (https://github.com/bigcalendar/react-big-calendar), uncontrollable 7.2.1 (https://github.com/jquense/uncontrollable), and their runtime dependencies. The version-pinned patch replaces uncontrollable’s obsolete compiled JSX calls with React’s JSX runtime in its ESM and CommonJS builds. Native state ownership, callbacks and ref forwarding are retained. React and declared peers remain external. Complete bundled dependency notices are included in [licenses/event-calendar.txt](./licenses/event-calendar.txt).
228
+
229
+ ## JSON Render
230
+
231
+ The optional `/json-render` catalog adapts component schemas and renderers from `@json-render/shadcn` 0.21.1, https://github.com/vercel-labs/json-render. Local modifications use this package’s Base UI components, native composition APIs, semantic variants, accessible labels, and explicit feature exports. JSON Render remains an external optional peer. The Apache License 2.0 is included in [licenses/json-render-APACHE-2.0.txt](./licenses/json-render-APACHE-2.0.txt).
@@ -12,7 +12,7 @@ import {
12
12
  Chart3,
13
13
  ChartTooltipContent2,
14
14
  ChartTooltip2
15
- } from "./chunk-82e7fbmq.js";
15
+ } from "./chunk-9vyg3854.js";
16
16
  import {
17
17
  take
18
18
  } from "./chunk-v8ks0cfq.js";
@@ -0,0 +1,19 @@
1
+ import {
2
+ cn2
3
+ } from "./chunk-cp2m7y7v.js";
4
+
5
+ // src/components/Spinner.tsx
6
+ import { Loader2Icon } from "lucide-react";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function Spinner2({ density, className, ...props }) {
9
+ return /* @__PURE__ */ jsx(Loader2Icon, {
10
+ "data-density": density,
11
+ "data-slot": "spinner",
12
+ role: "status",
13
+ "aria-label": "Loading",
14
+ className: cn2("size-4 animate-spin", className),
15
+ ...props
16
+ });
17
+ }
18
+
19
+ export { Spinner2 };
@@ -0,0 +1,98 @@
1
+ import {
2
+ Table2,
3
+ TableHeader2,
4
+ TableBody2
5
+ } from "./chunk-zte6pw69.js";
6
+
7
+ // src/components/virtual-table/VirtualTable.tsx
8
+ import {
9
+ Fragment,
10
+ useCallback,
11
+ useMemo,
12
+ useRef,
13
+ useState
14
+ } from "react";
15
+ import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
16
+ import { jsx, jsxs } from "react/jsx-runtime";
17
+ function VirtualTable2({
18
+ items,
19
+ getItemKey,
20
+ renderRow,
21
+ header,
22
+ columns,
23
+ label,
24
+ maxHeight = "65vh",
25
+ estimateRowHeight = 80,
26
+ overscan = 5,
27
+ retainedKeys,
28
+ layout = "fixed"
29
+ }) {
30
+ const viewport = useRef(null);
31
+ const [focusedKey, setFocusedKey] = useState();
32
+ const retained = useMemo(() => items.flatMap((item, index) => retainedKeys?.includes(getItemKey(item)) || getItemKey(item) === focusedKey ? [index] : []), [items, retainedKeys, getItemKey, focusedKey]);
33
+ const rangeExtractor = useCallback((range) => [...new Set([...defaultRangeExtractor(range), ...retained])].sort((a, b) => a - b), [retained]);
34
+ const itemKey = useCallback((index) => getItemKey(items[index]), [items, getItemKey]);
35
+ const virtualizer = useVirtualizer({
36
+ count: items.length,
37
+ getScrollElement: () => viewport.current,
38
+ getItemKey: itemKey,
39
+ estimateSize: () => estimateRowHeight,
40
+ overscan,
41
+ rangeExtractor
42
+ });
43
+ const rows = virtualizer.getVirtualItems();
44
+ const last = rows.at(-1);
45
+ return /* @__PURE__ */ jsx("div", {
46
+ ref: viewport,
47
+ "data-testid": "VirtualTable",
48
+ role: "region",
49
+ "aria-label": label,
50
+ tabIndex: 0,
51
+ className: "min-w-0 overflow-auto overscroll-contain",
52
+ style: { maxHeight },
53
+ onFocusCapture: (event) => {
54
+ const row = event.target.closest("tr[data-index]");
55
+ const item = items[Number(row?.dataset.index)];
56
+ if (row && item)
57
+ setFocusedKey(getItemKey(item));
58
+ },
59
+ children: /* @__PURE__ */ jsxs(Table2, {
60
+ layout,
61
+ "aria-label": label,
62
+ "aria-rowcount": items.length + 1,
63
+ children: [
64
+ columns,
65
+ /* @__PURE__ */ jsx(TableHeader2, {
66
+ children: header
67
+ }),
68
+ /* @__PURE__ */ jsxs(TableBody2, {
69
+ children: [
70
+ rows.map((row, index) => /* @__PURE__ */ jsxs(Fragment, {
71
+ children: [
72
+ row.start > (rows[index - 1]?.end ?? 0) && /* @__PURE__ */ jsx("tr", {
73
+ "aria-hidden": "true",
74
+ children: /* @__PURE__ */ jsx("td", {
75
+ style: { height: row.start - (rows[index - 1]?.end ?? 0), padding: 0, border: 0 }
76
+ })
77
+ }),
78
+ renderRow(items[row.index], {
79
+ ref: virtualizer.measureElement,
80
+ "data-index": row.index,
81
+ "aria-rowindex": row.index + 2
82
+ })
83
+ ]
84
+ }, row.key)),
85
+ last && virtualizer.getTotalSize() > last.end && /* @__PURE__ */ jsx("tr", {
86
+ "aria-hidden": "true",
87
+ children: /* @__PURE__ */ jsx("td", {
88
+ style: { height: virtualizer.getTotalSize() - last.end, padding: 0, border: 0 }
89
+ })
90
+ })
91
+ ]
92
+ })
93
+ ]
94
+ })
95
+ });
96
+ }
97
+
98
+ export { VirtualTable2 };
@@ -8,7 +8,7 @@ import {
8
8
  Alert2,
9
9
  AlertTitle2,
10
10
  AlertDescription2
11
- } from "./chunk-53q730zs.js";
11
+ } from "./chunk-zdt8xxzy.js";
12
12
  import {
13
13
  mono
14
14
  } from "./chunk-fgmcbtyt.js";
@@ -111,6 +111,7 @@ function ChartTooltipContent2({
111
111
  hideIndicator = false,
112
112
  label,
113
113
  labelFormatter,
114
+ valueFormatter,
114
115
  labelClassName,
115
116
  formatter,
116
117
  color,
@@ -202,7 +203,7 @@ function ChartTooltipContent2({
202
203
  }),
203
204
  item.value != null && /* @__PURE__ */ jsx2("span", {
204
205
  className: "font-mono font-medium tabular-nums",
205
- children: typeof item.value === "number" ? item.value.toLocaleString() : String(item.value)
206
+ children: typeof item.value === "number" ? valueFormatter?.(item.value) ?? item.value.toLocaleString() : String(item.value)
206
207
  })
207
208
  ]
208
209
  })