@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.
- package/README.md +26 -22
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/dist/{chunk-0ewzb2ax.js → chunk-0kyfh857.js} +1 -1
- package/dist/chunk-1xncv9gb.js +19 -0
- package/dist/chunk-2dxa9enk.js +98 -0
- package/dist/{chunk-8wfy03bp.js → chunk-6kwf9644.js} +1 -1
- package/dist/{chunk-82e7fbmq.js → chunk-9vyg3854.js} +2 -1
- package/dist/chunk-c6g2rbhv.js +3940 -0
- package/dist/chunk-dzvsjw59.js +200 -0
- package/dist/{chunk-g238nezp.js → chunk-pg9rhbgm.js} +4 -2
- package/dist/{chunk-5da3rzn5.js → chunk-s0typ7hv.js} +1 -1
- package/dist/chunk-tch86q2w.js +6050 -0
- package/dist/{chunk-eehfrrdz.js → chunk-tnnf8ydf.js} +1 -15
- package/dist/chunk-yfr9syen.js +363 -0
- package/dist/{chunk-53q730zs.js → chunk-zdt8xxzy.js} +3 -0
- package/dist/components/Alert.d.ts +1 -1
- package/dist/components/Table.d.ts +1 -0
- package/dist/components/assistant-ui/elements/Chart.js +2 -2
- package/dist/components/assistant-ui/elements/GuardrailNotice.js +2 -2
- package/dist/components/assistant-ui/elements/OptionList.js +3 -2
- package/dist/components/assistant-ui/elements/QuestionFlow.js +4 -3
- package/dist/components/assistant-ui/index.js +8 -7
- package/dist/components/assistant-ui/native/Sources.d.ts +1 -1
- package/dist/components/carousel/index.js +15 -204
- package/dist/components/chart/AnalyticsChart.d.ts +3 -2
- package/dist/components/chart/Chart.d.ts +1 -1
- package/dist/components/chart/index.js +24 -10
- package/dist/components/chart/types.d.ts +1 -0
- package/dist/components/data-grid/DataGrid.d.ts +48 -9
- package/dist/components/data-grid/DataGridColumnOptions.d.ts +14 -0
- package/dist/components/data-grid/DataGridColumnResizer.d.ts +13 -0
- package/dist/components/data-grid/getDataGridColumnSizeVariables.d.ts +6 -0
- package/dist/components/data-grid/hooks/useDataGridColumnSizes.d.ts +8 -0
- package/dist/components/data-grid/index.d.ts +3 -2
- package/dist/components/data-grid/index.js +124 -199
- package/dist/components/data-grid/moveDataGridColumn.d.ts +5 -0
- package/dist/components/event-calendar/index.js +4 -2
- package/dist/components/json-render/JsonAccordion.d.ts +3 -0
- package/dist/components/json-render/JsonAlert.d.ts +3 -0
- package/dist/components/json-render/JsonAvatar.d.ts +3 -0
- package/dist/components/json-render/JsonBadge.d.ts +3 -0
- package/dist/components/json-render/JsonButton.d.ts +3 -0
- package/dist/components/json-render/JsonButtonGroup.d.ts +3 -0
- package/dist/components/json-render/JsonCard.d.ts +3 -0
- package/dist/components/json-render/JsonCarousel.d.ts +3 -0
- package/dist/components/json-render/JsonCheckbox.d.ts +3 -0
- package/dist/components/json-render/JsonCollapsible.d.ts +3 -0
- package/dist/components/json-render/JsonDialog.d.ts +3 -0
- package/dist/components/json-render/JsonDrawer.d.ts +3 -0
- package/dist/components/json-render/JsonDropdownMenu.d.ts +3 -0
- package/dist/components/json-render/JsonGrid.d.ts +3 -0
- package/dist/components/json-render/JsonHeading.d.ts +3 -0
- package/dist/components/json-render/JsonImage.d.ts +3 -0
- package/dist/components/json-render/JsonInput.d.ts +3 -0
- package/dist/components/json-render/JsonLink.d.ts +3 -0
- package/dist/components/json-render/JsonPagination.d.ts +3 -0
- package/dist/components/json-render/JsonPopover.d.ts +3 -0
- package/dist/components/json-render/JsonProgress.d.ts +3 -0
- package/dist/components/json-render/JsonRadio.d.ts +3 -0
- package/dist/components/json-render/JsonSelect.d.ts +3 -0
- package/dist/components/json-render/JsonSeparator.d.ts +3 -0
- package/dist/components/json-render/JsonSkeleton.d.ts +3 -0
- package/dist/components/json-render/JsonSlider.d.ts +3 -0
- package/dist/components/json-render/JsonSpinner.d.ts +3 -0
- package/dist/components/json-render/JsonStack.d.ts +3 -0
- package/dist/components/json-render/JsonSwitch.d.ts +3 -0
- package/dist/components/json-render/JsonTable.d.ts +3 -0
- package/dist/components/json-render/JsonTabs.d.ts +3 -0
- package/dist/components/json-render/JsonText.d.ts +3 -0
- package/dist/components/json-render/JsonTextarea.d.ts +3 -0
- package/dist/components/json-render/JsonToggle.d.ts +3 -0
- package/dist/components/json-render/JsonToggleGroup.d.ts +3 -0
- package/dist/components/json-render/JsonTooltip.d.ts +3 -0
- package/dist/components/json-render/catalog.d.ts +548 -0
- package/dist/components/json-render/catalog.js +6 -0
- package/dist/components/json-render/getPaginationRange.d.ts +1 -0
- package/dist/components/json-render/index.d.ts +39 -0
- package/dist/components/json-render/index.js +1254 -0
- package/dist/components/virtual-data-grid/VirtualDataGrid.d.ts +26 -0
- package/dist/components/virtual-data-grid/index.d.ts +2 -0
- package/dist/components/virtual-data-grid/index.js +88 -0
- package/dist/components/virtual-table/index.js +4 -96
- package/dist/index.d.ts +1 -0
- package/dist/index.js +569 -4189
- package/licenses/json-render-APACHE-2.0.txt +201 -0
- package/llms/components/data-display/AnalyticsChart.md +34 -0
- package/llms/components/data-display/DataGridColumnOptions.md +22 -0
- package/llms/components/data-display/JsonRender.md +476 -0
- package/llms/components/data-display/VirtualDataGrid.md +71 -0
- package/llms/components/feedback/Alert.md +20 -4
- package/llms/setup.md +26 -22
- package/llms.txt +3 -0
- package/package.json +24 -2
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
# JsonRender
|
|
2
|
+
|
|
3
|
+
Story: @alexgorbatchev/shadcn/components/data-display/JsonRender
|
|
4
|
+
Source: src/components/stories/data-display/JsonRender.stories.tsx
|
|
5
|
+
|
|
6
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/JsonRender.stories.tsx)
|
|
7
|
+
|
|
8
|
+
## Public imports
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { components, componentDefinitions } from "@alexgorbatchev/shadcn/json-render";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Supporting imports
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import { useState, type ReactElement } from "react";
|
|
18
|
+
import { createStateStore, defineCatalog, type Spec } from "@json-render/core";
|
|
19
|
+
import { JSONUIProvider, Renderer, defineRegistry } from "@json-render/react";
|
|
20
|
+
import { schema } from "@json-render/react/schema";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Default component
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
JsonExample
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Examples
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
### Form
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
{
|
|
37
|
+
args: {
|
|
38
|
+
spec: {
|
|
39
|
+
root: "form",
|
|
40
|
+
elements: {
|
|
41
|
+
form: {
|
|
42
|
+
type: "Stack",
|
|
43
|
+
props: {},
|
|
44
|
+
children: [
|
|
45
|
+
"input",
|
|
46
|
+
"textarea",
|
|
47
|
+
"select",
|
|
48
|
+
"checkbox",
|
|
49
|
+
"radio",
|
|
50
|
+
"switch",
|
|
51
|
+
"slider",
|
|
52
|
+
"toggle",
|
|
53
|
+
"toggles",
|
|
54
|
+
"buttons",
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
input: { type: "Input", props: { label: "Name", value: "Ada" } },
|
|
58
|
+
textarea: { type: "Textarea", props: { label: "Notes", value: "Initial notes" } },
|
|
59
|
+
select: { type: "Select", props: { label: "Plan", options: ["Free", "Pro"], value: "Free" } },
|
|
60
|
+
checkbox: { type: "Checkbox", props: { label: "Agree" } },
|
|
61
|
+
radio: { type: "Radio", props: { label: "Frequency", options: ["Daily", "Weekly"] } },
|
|
62
|
+
switch: { type: "Switch", props: { label: "Notifications" } },
|
|
63
|
+
slider: { type: "Slider", props: { label: "Volume", min: 0, max: 10 } },
|
|
64
|
+
toggle: { type: "Toggle", props: { label: "Bold" } },
|
|
65
|
+
toggles: {
|
|
66
|
+
type: "ToggleGroup",
|
|
67
|
+
props: {
|
|
68
|
+
type: "multiple",
|
|
69
|
+
items: [
|
|
70
|
+
{ label: "Left", value: "left" },
|
|
71
|
+
{ label: "Right", value: "right" },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
buttons: {
|
|
76
|
+
type: "ButtonGroup",
|
|
77
|
+
props: {
|
|
78
|
+
buttons: [
|
|
79
|
+
{ label: "Day", value: "day" },
|
|
80
|
+
{ label: "Month", value: "month" },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Overlays
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
{
|
|
94
|
+
args: {
|
|
95
|
+
spec: {
|
|
96
|
+
root: "root",
|
|
97
|
+
elements: {
|
|
98
|
+
root: {
|
|
99
|
+
type: "Stack",
|
|
100
|
+
props: {},
|
|
101
|
+
children: ["tabs", "accordion", "collapse", "tooltip", "popover", "dropdown"],
|
|
102
|
+
},
|
|
103
|
+
tabs: {
|
|
104
|
+
type: "Tabs",
|
|
105
|
+
props: {
|
|
106
|
+
tabs: [
|
|
107
|
+
{ value: "one", label: "First tab" },
|
|
108
|
+
{ value: "two", label: "Second tab" },
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
accordion: {
|
|
113
|
+
type: "Accordion",
|
|
114
|
+
props: {
|
|
115
|
+
type: "multiple",
|
|
116
|
+
items: [
|
|
117
|
+
{ title: "Details", content: "Expanded details" },
|
|
118
|
+
{ title: "More", content: "More details" },
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
collapse: { type: "Collapsible", props: { title: "Expand section", defaultOpen: false }, children: ["text"] },
|
|
123
|
+
text: { type: "Text", props: { text: "Collapsed content" } },
|
|
124
|
+
tooltip: { type: "Tooltip", props: { content: "Keyboard help", text: "Help trigger" } },
|
|
125
|
+
popover: { type: "Popover", props: { trigger: "Show popover", content: "Popover content" } },
|
|
126
|
+
dropdown: {
|
|
127
|
+
type: "DropdownMenu",
|
|
128
|
+
props: { label: "Open menu", items: [{ label: "Choose item", value: "item" }] },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Display
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
{
|
|
140
|
+
args: {
|
|
141
|
+
spec: {
|
|
142
|
+
root: "card",
|
|
143
|
+
elements: {
|
|
144
|
+
card: {
|
|
145
|
+
type: "Card",
|
|
146
|
+
props: { title: "Archive", description: "Rendered from JSON", maxWidth: "full" },
|
|
147
|
+
children: ["grid", "table", "progress", "spinner", "skeleton", "separator", "carousel"],
|
|
148
|
+
},
|
|
149
|
+
grid: {
|
|
150
|
+
type: "Grid",
|
|
151
|
+
props: { columns: 2 },
|
|
152
|
+
children: ["heading", "text", "badge", "alert", "avatar", "image", "link", "button"],
|
|
153
|
+
},
|
|
154
|
+
heading: { type: "Heading", props: { text: "Measurements", level: "h2" } },
|
|
155
|
+
text: { type: "Text", props: { text: "Last updated today", variant: "muted" } },
|
|
156
|
+
badge: { type: "Badge", props: { text: "Ready", variant: "secondary" } },
|
|
157
|
+
alert: { type: "Alert", props: { title: "Synced", message: "All records imported", type: "success" } },
|
|
158
|
+
avatar: { type: "Avatar", props: { name: "Ada Lovelace" } },
|
|
159
|
+
image: {
|
|
160
|
+
type: "Image",
|
|
161
|
+
props: {
|
|
162
|
+
src: new URL("../fixtures/avatar.svg", import.meta.url).href,
|
|
163
|
+
alt: "Profile",
|
|
164
|
+
width: 40,
|
|
165
|
+
height: 40,
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
link: { type: "Link", props: { label: "Read documentation", href: "#docs" } },
|
|
169
|
+
button: { type: "Button", props: { label: "Sync records", variant: "secondary" } },
|
|
170
|
+
table: {
|
|
171
|
+
type: "Table",
|
|
172
|
+
props: { caption: "Measurements", columns: ["Day", "Score"], rows: [["Monday", "80"]] },
|
|
173
|
+
},
|
|
174
|
+
progress: { type: "Progress", props: { value: 50, max: 100, label: "Import progress" } },
|
|
175
|
+
spinner: { type: "Spinner", props: { size: "md", label: "Loading records" } },
|
|
176
|
+
skeleton: { type: "Skeleton", props: { width: "100%", height: "20px" } },
|
|
177
|
+
separator: { type: "Separator", props: {} },
|
|
178
|
+
carousel: {
|
|
179
|
+
type: "Carousel",
|
|
180
|
+
props: {
|
|
181
|
+
items: [
|
|
182
|
+
{ title: "First slide", description: "First record" },
|
|
183
|
+
{ title: "Second slide", description: "Second record" },
|
|
184
|
+
],
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### BoundForm
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
{
|
|
197
|
+
args: {
|
|
198
|
+
state: {
|
|
199
|
+
name: "Ada",
|
|
200
|
+
notes: "Initial notes",
|
|
201
|
+
plan: "Free",
|
|
202
|
+
agree: false,
|
|
203
|
+
frequency: "Daily",
|
|
204
|
+
notifications: false,
|
|
205
|
+
volume: 0,
|
|
206
|
+
bold: false,
|
|
207
|
+
position: "left",
|
|
208
|
+
period: "day",
|
|
209
|
+
},
|
|
210
|
+
spec: {
|
|
211
|
+
root: "root",
|
|
212
|
+
elements: {
|
|
213
|
+
root: {
|
|
214
|
+
type: "Stack",
|
|
215
|
+
props: {},
|
|
216
|
+
children: [
|
|
217
|
+
"input",
|
|
218
|
+
"textarea",
|
|
219
|
+
"select",
|
|
220
|
+
"checkbox",
|
|
221
|
+
"radio",
|
|
222
|
+
"switch",
|
|
223
|
+
"slider",
|
|
224
|
+
"toggle",
|
|
225
|
+
"toggles",
|
|
226
|
+
"buttons",
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
input: {
|
|
230
|
+
type: "Input",
|
|
231
|
+
props: {
|
|
232
|
+
label: "Name",
|
|
233
|
+
value: { $bindState: "/name" },
|
|
234
|
+
checks: [{ type: "required", message: "Name required" }],
|
|
235
|
+
validateOn: "change",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
textarea: {
|
|
239
|
+
type: "Textarea",
|
|
240
|
+
props: {
|
|
241
|
+
label: "Notes",
|
|
242
|
+
value: { $bindState: "/notes" },
|
|
243
|
+
checks: [{ type: "required", message: "Notes required" }],
|
|
244
|
+
validateOn: "blur",
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
select: {
|
|
248
|
+
type: "Select",
|
|
249
|
+
props: {
|
|
250
|
+
label: "Plan",
|
|
251
|
+
options: ["Free", "Pro"],
|
|
252
|
+
value: { $bindState: "/plan" },
|
|
253
|
+
checks: [{ type: "required", message: "Plan required" }],
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
checkbox: {
|
|
257
|
+
type: "Checkbox",
|
|
258
|
+
props: {
|
|
259
|
+
label: "Agree",
|
|
260
|
+
checked: { $bindState: "/agree" },
|
|
261
|
+
checks: [{ type: "matches", args: { other: true }, message: "Agreement required" }],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
radio: {
|
|
265
|
+
type: "Radio",
|
|
266
|
+
props: {
|
|
267
|
+
label: "Frequency",
|
|
268
|
+
options: ["Daily", "Weekly"],
|
|
269
|
+
value: { $bindState: "/frequency" },
|
|
270
|
+
checks: [{ type: "required", message: "Frequency required" }],
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
switch: {
|
|
274
|
+
type: "Switch",
|
|
275
|
+
props: {
|
|
276
|
+
label: "Notifications",
|
|
277
|
+
checked: { $bindState: "/notifications" },
|
|
278
|
+
checks: [{ type: "matches", args: { other: true }, message: "Notification preference required" }],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
slider: { type: "Slider", props: { label: "Volume", min: 0, max: 10, value: { $bindState: "/volume" } } },
|
|
282
|
+
toggle: { type: "Toggle", props: { label: "Bold", pressed: { $bindState: "/bold" } } },
|
|
283
|
+
toggles: {
|
|
284
|
+
type: "ToggleGroup",
|
|
285
|
+
props: {
|
|
286
|
+
type: "multiple",
|
|
287
|
+
value: { $bindState: "/position" },
|
|
288
|
+
items: [
|
|
289
|
+
{ label: "Left", value: "left" },
|
|
290
|
+
{ label: "Right", value: "right" },
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
buttons: {
|
|
295
|
+
type: "ButtonGroup",
|
|
296
|
+
props: {
|
|
297
|
+
selected: { $bindState: "/period" },
|
|
298
|
+
buttons: [
|
|
299
|
+
{ label: "Day", value: "day" },
|
|
300
|
+
{ label: "Month", value: "month" },
|
|
301
|
+
],
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### MissingBoundValues
|
|
311
|
+
|
|
312
|
+
```tsx
|
|
313
|
+
{
|
|
314
|
+
args: { ...BoundForm.args, state: {} }
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### PaginationAndDialog
|
|
319
|
+
|
|
320
|
+
```tsx
|
|
321
|
+
{
|
|
322
|
+
args: {
|
|
323
|
+
state: { page: 1, show: false, drawer: false },
|
|
324
|
+
spec: {
|
|
325
|
+
root: "root",
|
|
326
|
+
elements: {
|
|
327
|
+
root: { type: "Stack", props: {}, children: ["pagination", "open", "dialog", "openDrawer", "drawer"] },
|
|
328
|
+
pagination: { type: "Pagination", props: { page: { $bindState: "/page" }, totalPages: 20 } },
|
|
329
|
+
open: {
|
|
330
|
+
type: "Button",
|
|
331
|
+
props: { label: "Open dialog" },
|
|
332
|
+
on: { press: { action: "setState", params: { statePath: "/show", value: true } } },
|
|
333
|
+
},
|
|
334
|
+
dialog: {
|
|
335
|
+
type: "Dialog",
|
|
336
|
+
props: { title: "Confirm import", description: "Import your records", openPath: "/show" },
|
|
337
|
+
},
|
|
338
|
+
openDrawer: {
|
|
339
|
+
type: "Button",
|
|
340
|
+
props: { label: "Open drawer" },
|
|
341
|
+
on: { press: { action: "setState", params: { statePath: "/drawer", value: true } } },
|
|
342
|
+
},
|
|
343
|
+
drawer: {
|
|
344
|
+
type: "Drawer",
|
|
345
|
+
props: { title: "Archive details", description: "Stored records", openPath: "/drawer" },
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### TypographyAndPlaceholders
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
{
|
|
357
|
+
args: {
|
|
358
|
+
spec: {
|
|
359
|
+
root: "root",
|
|
360
|
+
elements: {
|
|
361
|
+
root: {
|
|
362
|
+
type: "Stack",
|
|
363
|
+
props: { direction: "horizontal", gap: "lg", align: "center", justify: "between" },
|
|
364
|
+
children: [
|
|
365
|
+
"small",
|
|
366
|
+
"medium",
|
|
367
|
+
"large",
|
|
368
|
+
"empty",
|
|
369
|
+
"placeholder",
|
|
370
|
+
"avatar",
|
|
371
|
+
"spinner",
|
|
372
|
+
"skeleton",
|
|
373
|
+
"progress",
|
|
374
|
+
"separator",
|
|
375
|
+
"table",
|
|
376
|
+
],
|
|
377
|
+
},
|
|
378
|
+
small: {
|
|
379
|
+
type: "Card",
|
|
380
|
+
props: { maxWidth: "sm", centered: true, title: "Small card" },
|
|
381
|
+
children: ["h1", "caption", "alert"],
|
|
382
|
+
},
|
|
383
|
+
medium: {
|
|
384
|
+
type: "Card",
|
|
385
|
+
props: { maxWidth: "md", description: "Medium card" },
|
|
386
|
+
children: ["h3", "lead", "warning"],
|
|
387
|
+
},
|
|
388
|
+
large: { type: "Card", props: { maxWidth: "lg" }, children: ["h4", "code", "info"] },
|
|
389
|
+
empty: { type: "Card", props: {}, children: ["body", "badge"] },
|
|
390
|
+
h1: { type: "Heading", props: { text: "Page heading", level: "h1" } },
|
|
391
|
+
h3: { type: "Heading", props: { text: "Section heading", level: "h3" } },
|
|
392
|
+
h4: { type: "Heading", props: { text: "Detail heading", level: "h4" } },
|
|
393
|
+
caption: { type: "Text", props: { text: "Caption", variant: "caption" } },
|
|
394
|
+
lead: { type: "Text", props: { text: "Lead paragraph", variant: "lead" } },
|
|
395
|
+
code: { type: "Text", props: { text: "const ready = true", variant: "code" } },
|
|
396
|
+
body: { type: "Text", props: { text: "Body paragraph" } },
|
|
397
|
+
badge: { type: "Badge", props: { text: "Default badge" } },
|
|
398
|
+
alert: { type: "Alert", props: { title: "Import failed", type: "error" } },
|
|
399
|
+
warning: { type: "Alert", props: { title: "Warning", type: "warning" } },
|
|
400
|
+
info: { type: "Alert", props: { title: "Default notice" } },
|
|
401
|
+
placeholder: { type: "Image", props: { src: null, alt: "Missing photograph" } },
|
|
402
|
+
avatar: { type: "Avatar", props: { name: "", size: "lg" } },
|
|
403
|
+
spinner: { type: "Spinner", props: { size: "sm" } },
|
|
404
|
+
skeleton: { type: "Skeleton", props: { rounded: true } },
|
|
405
|
+
progress: { type: "Progress", props: { value: 20 } },
|
|
406
|
+
separator: { type: "Separator", props: { orientation: "vertical" } },
|
|
407
|
+
table: { type: "Table", props: { columns: ["Name"], rows: [["Ada"]] } },
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### InitialSelections
|
|
415
|
+
|
|
416
|
+
```tsx
|
|
417
|
+
{
|
|
418
|
+
args: {
|
|
419
|
+
spec: {
|
|
420
|
+
root: "root",
|
|
421
|
+
elements: {
|
|
422
|
+
root: {
|
|
423
|
+
type: "Grid",
|
|
424
|
+
props: { columns: 1, gap: "sm" },
|
|
425
|
+
children: [
|
|
426
|
+
"buttons",
|
|
427
|
+
"tabs",
|
|
428
|
+
"toggles",
|
|
429
|
+
"pagination",
|
|
430
|
+
"slider",
|
|
431
|
+
"accordion",
|
|
432
|
+
"image",
|
|
433
|
+
"avatar",
|
|
434
|
+
"spinner",
|
|
435
|
+
"button",
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
buttons: {
|
|
439
|
+
type: "ButtonGroup",
|
|
440
|
+
props: {
|
|
441
|
+
selected: "month",
|
|
442
|
+
buttons: [
|
|
443
|
+
{ label: "Day view", value: "day" },
|
|
444
|
+
{ label: "Month view", value: "month" },
|
|
445
|
+
],
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
tabs: {
|
|
449
|
+
type: "Tabs",
|
|
450
|
+
props: {
|
|
451
|
+
value: "second",
|
|
452
|
+
tabs: [
|
|
453
|
+
{ label: "One", value: "first" },
|
|
454
|
+
{ label: "Two", value: "second" },
|
|
455
|
+
],
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
toggles: { type: "ToggleGroup", props: { value: "", items: [{ label: "Pin", value: "pin" }] } },
|
|
459
|
+
pagination: { type: "Pagination", props: { totalPages: 3 } },
|
|
460
|
+
slider: { type: "Slider", props: { value: 20 } },
|
|
461
|
+
accordion: { type: "Accordion", props: { items: [{ title: "Single details", content: "Single expanded" }] } },
|
|
462
|
+
image: {
|
|
463
|
+
type: "Image",
|
|
464
|
+
props: { src: new URL("../fixtures/avatar.svg", import.meta.url).href, alt: "Small profile" },
|
|
465
|
+
},
|
|
466
|
+
avatar: {
|
|
467
|
+
type: "Avatar",
|
|
468
|
+
props: { name: "Ada", size: "sm", src: new URL("../fixtures/avatar.svg", import.meta.url).href },
|
|
469
|
+
},
|
|
470
|
+
spinner: { type: "Spinner", props: { size: "lg", label: "Large loader" } },
|
|
471
|
+
button: { type: "Button", props: { label: "Delete", variant: "danger", disabled: true } },
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
```
|
|
@@ -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
|
+
```
|
|
@@ -26,7 +26,7 @@ Alert
|
|
|
26
26
|
## Story controls
|
|
27
27
|
|
|
28
28
|
```tsx
|
|
29
|
-
{ variant: { control: "select", options: ["default", "destructive"] } }
|
|
29
|
+
{ variant: { control: "select", options: ["default", "destructive", "success", "warning", "info"] } }
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Default render
|
|
@@ -57,6 +57,22 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
57
57
|
}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
+
### Success
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
{
|
|
64
|
+
args: { variant: "success" }
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Info
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
{
|
|
72
|
+
args: { variant: "info" }
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
60
76
|
### Compact
|
|
61
77
|
|
|
62
78
|
```tsx
|
|
@@ -80,14 +96,14 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
80
96
|
}
|
|
81
97
|
```
|
|
82
98
|
|
|
83
|
-
###
|
|
99
|
+
### Warning
|
|
84
100
|
|
|
85
101
|
```tsx
|
|
86
102
|
{
|
|
87
|
-
render: (args) => (<Alert {...args}
|
|
103
|
+
render: (args) => (<Alert {...args} variant="warning">
|
|
88
104
|
<TriangleAlertIcon aria-hidden="true"/>
|
|
89
105
|
<AlertTitle>Subscription expires soon</AlertTitle>
|
|
90
|
-
<AlertDescription
|
|
106
|
+
<AlertDescription>Renew your subscription to keep access.</AlertDescription>
|
|
91
107
|
</Alert>)
|
|
92
108
|
}
|
|
93
109
|
```
|
package/llms/setup.md
CHANGED
|
@@ -50,28 +50,30 @@ 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
|
|
54
|
-
|
|
|
55
|
-
| `/
|
|
56
|
-
| `/
|
|
57
|
-
| `/
|
|
58
|
-
| `/
|
|
59
|
-
| `/
|
|
60
|
-
| `/
|
|
61
|
-
| `/
|
|
62
|
-
| `/
|
|
63
|
-
| `/
|
|
64
|
-
| `/
|
|
65
|
-
| `/
|
|
66
|
-
| `/
|
|
67
|
-
| `/
|
|
68
|
-
| `/
|
|
69
|
-
| `/
|
|
70
|
-
| `/
|
|
71
|
-
| `/
|
|
72
|
-
| `/
|
|
73
|
-
| `/
|
|
74
|
-
| `/
|
|
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](https://github.com/alexgorbatchev/shadcn/blob/main/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.
|