@json-render/shadcn 0.0.1

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.
@@ -0,0 +1,501 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * shadcn/ui component definitions for json-render catalogs.
5
+ *
6
+ * These can be used directly or extended with custom components.
7
+ * All components are built using Radix UI primitives + Tailwind CSS.
8
+ */
9
+ declare const shadcnComponentDefinitions: {
10
+ Card: {
11
+ props: z.ZodObject<{
12
+ title: z.ZodNullable<z.ZodString>;
13
+ description: z.ZodNullable<z.ZodString>;
14
+ maxWidth: z.ZodNullable<z.ZodEnum<{
15
+ sm: "sm";
16
+ md: "md";
17
+ lg: "lg";
18
+ full: "full";
19
+ }>>;
20
+ centered: z.ZodNullable<z.ZodBoolean>;
21
+ }, z.core.$strip>;
22
+ slots: string[];
23
+ description: string;
24
+ example: {
25
+ title: string;
26
+ description: string;
27
+ };
28
+ };
29
+ Stack: {
30
+ props: z.ZodObject<{
31
+ direction: z.ZodNullable<z.ZodEnum<{
32
+ horizontal: "horizontal";
33
+ vertical: "vertical";
34
+ }>>;
35
+ gap: z.ZodNullable<z.ZodEnum<{
36
+ sm: "sm";
37
+ md: "md";
38
+ lg: "lg";
39
+ none: "none";
40
+ }>>;
41
+ align: z.ZodNullable<z.ZodEnum<{
42
+ start: "start";
43
+ center: "center";
44
+ end: "end";
45
+ stretch: "stretch";
46
+ }>>;
47
+ justify: z.ZodNullable<z.ZodEnum<{
48
+ start: "start";
49
+ center: "center";
50
+ end: "end";
51
+ between: "between";
52
+ around: "around";
53
+ }>>;
54
+ }, z.core.$strip>;
55
+ slots: string[];
56
+ description: string;
57
+ example: {
58
+ direction: string;
59
+ gap: string;
60
+ };
61
+ };
62
+ Grid: {
63
+ props: z.ZodObject<{
64
+ columns: z.ZodNullable<z.ZodNumber>;
65
+ gap: z.ZodNullable<z.ZodEnum<{
66
+ sm: "sm";
67
+ md: "md";
68
+ lg: "lg";
69
+ }>>;
70
+ }, z.core.$strip>;
71
+ slots: string[];
72
+ description: string;
73
+ example: {
74
+ columns: number;
75
+ gap: string;
76
+ };
77
+ };
78
+ Separator: {
79
+ props: z.ZodObject<{
80
+ orientation: z.ZodNullable<z.ZodEnum<{
81
+ horizontal: "horizontal";
82
+ vertical: "vertical";
83
+ }>>;
84
+ }, z.core.$strip>;
85
+ description: string;
86
+ };
87
+ Tabs: {
88
+ props: z.ZodObject<{
89
+ tabs: z.ZodArray<z.ZodObject<{
90
+ label: z.ZodString;
91
+ value: z.ZodString;
92
+ }, z.core.$strip>>;
93
+ defaultValue: z.ZodNullable<z.ZodString>;
94
+ value: z.ZodNullable<z.ZodString>;
95
+ }, z.core.$strip>;
96
+ slots: string[];
97
+ events: string[];
98
+ description: string;
99
+ };
100
+ Accordion: {
101
+ props: z.ZodObject<{
102
+ items: z.ZodArray<z.ZodObject<{
103
+ title: z.ZodString;
104
+ content: z.ZodString;
105
+ }, z.core.$strip>>;
106
+ type: z.ZodNullable<z.ZodEnum<{
107
+ single: "single";
108
+ multiple: "multiple";
109
+ }>>;
110
+ }, z.core.$strip>;
111
+ description: string;
112
+ };
113
+ Collapsible: {
114
+ props: z.ZodObject<{
115
+ title: z.ZodString;
116
+ defaultOpen: z.ZodNullable<z.ZodBoolean>;
117
+ }, z.core.$strip>;
118
+ slots: string[];
119
+ description: string;
120
+ };
121
+ Dialog: {
122
+ props: z.ZodObject<{
123
+ title: z.ZodString;
124
+ description: z.ZodNullable<z.ZodString>;
125
+ openPath: z.ZodString;
126
+ }, z.core.$strip>;
127
+ slots: string[];
128
+ description: string;
129
+ };
130
+ Drawer: {
131
+ props: z.ZodObject<{
132
+ title: z.ZodString;
133
+ description: z.ZodNullable<z.ZodString>;
134
+ openPath: z.ZodString;
135
+ }, z.core.$strip>;
136
+ slots: string[];
137
+ description: string;
138
+ };
139
+ Carousel: {
140
+ props: z.ZodObject<{
141
+ items: z.ZodArray<z.ZodObject<{
142
+ title: z.ZodNullable<z.ZodString>;
143
+ description: z.ZodNullable<z.ZodString>;
144
+ }, z.core.$strip>>;
145
+ }, z.core.$strip>;
146
+ description: string;
147
+ };
148
+ Table: {
149
+ props: z.ZodObject<{
150
+ columns: z.ZodArray<z.ZodString>;
151
+ rows: z.ZodArray<z.ZodArray<z.ZodString>>;
152
+ caption: z.ZodNullable<z.ZodString>;
153
+ }, z.core.$strip>;
154
+ description: string;
155
+ example: {
156
+ columns: string[];
157
+ rows: string[][];
158
+ };
159
+ };
160
+ Heading: {
161
+ props: z.ZodObject<{
162
+ text: z.ZodString;
163
+ level: z.ZodNullable<z.ZodEnum<{
164
+ h1: "h1";
165
+ h2: "h2";
166
+ h3: "h3";
167
+ h4: "h4";
168
+ }>>;
169
+ }, z.core.$strip>;
170
+ description: string;
171
+ example: {
172
+ text: string;
173
+ level: string;
174
+ };
175
+ };
176
+ Text: {
177
+ props: z.ZodObject<{
178
+ text: z.ZodString;
179
+ variant: z.ZodNullable<z.ZodEnum<{
180
+ caption: "caption";
181
+ body: "body";
182
+ muted: "muted";
183
+ lead: "lead";
184
+ code: "code";
185
+ }>>;
186
+ }, z.core.$strip>;
187
+ description: string;
188
+ example: {
189
+ text: string;
190
+ };
191
+ };
192
+ Image: {
193
+ props: z.ZodObject<{
194
+ src: z.ZodNullable<z.ZodString>;
195
+ alt: z.ZodString;
196
+ width: z.ZodNullable<z.ZodNumber>;
197
+ height: z.ZodNullable<z.ZodNumber>;
198
+ }, z.core.$strip>;
199
+ description: string;
200
+ };
201
+ Avatar: {
202
+ props: z.ZodObject<{
203
+ src: z.ZodNullable<z.ZodString>;
204
+ name: z.ZodString;
205
+ size: z.ZodNullable<z.ZodEnum<{
206
+ sm: "sm";
207
+ md: "md";
208
+ lg: "lg";
209
+ }>>;
210
+ }, z.core.$strip>;
211
+ description: string;
212
+ example: {
213
+ name: string;
214
+ size: string;
215
+ };
216
+ };
217
+ Badge: {
218
+ props: z.ZodObject<{
219
+ text: z.ZodString;
220
+ variant: z.ZodNullable<z.ZodEnum<{
221
+ default: "default";
222
+ secondary: "secondary";
223
+ destructive: "destructive";
224
+ outline: "outline";
225
+ }>>;
226
+ }, z.core.$strip>;
227
+ description: string;
228
+ example: {
229
+ text: string;
230
+ variant: string;
231
+ };
232
+ };
233
+ Alert: {
234
+ props: z.ZodObject<{
235
+ title: z.ZodString;
236
+ message: z.ZodNullable<z.ZodString>;
237
+ type: z.ZodNullable<z.ZodEnum<{
238
+ success: "success";
239
+ info: "info";
240
+ warning: "warning";
241
+ error: "error";
242
+ }>>;
243
+ }, z.core.$strip>;
244
+ description: string;
245
+ example: {
246
+ title: string;
247
+ message: string;
248
+ type: string;
249
+ };
250
+ };
251
+ Progress: {
252
+ props: z.ZodObject<{
253
+ value: z.ZodNumber;
254
+ max: z.ZodNullable<z.ZodNumber>;
255
+ label: z.ZodNullable<z.ZodString>;
256
+ }, z.core.$strip>;
257
+ description: string;
258
+ example: {
259
+ value: number;
260
+ max: number;
261
+ label: string;
262
+ };
263
+ };
264
+ Skeleton: {
265
+ props: z.ZodObject<{
266
+ width: z.ZodNullable<z.ZodString>;
267
+ height: z.ZodNullable<z.ZodString>;
268
+ rounded: z.ZodNullable<z.ZodBoolean>;
269
+ }, z.core.$strip>;
270
+ description: string;
271
+ };
272
+ Spinner: {
273
+ props: z.ZodObject<{
274
+ size: z.ZodNullable<z.ZodEnum<{
275
+ sm: "sm";
276
+ md: "md";
277
+ lg: "lg";
278
+ }>>;
279
+ label: z.ZodNullable<z.ZodString>;
280
+ }, z.core.$strip>;
281
+ description: string;
282
+ };
283
+ Tooltip: {
284
+ props: z.ZodObject<{
285
+ content: z.ZodString;
286
+ text: z.ZodString;
287
+ }, z.core.$strip>;
288
+ description: string;
289
+ };
290
+ Popover: {
291
+ props: z.ZodObject<{
292
+ trigger: z.ZodString;
293
+ content: z.ZodString;
294
+ }, z.core.$strip>;
295
+ description: string;
296
+ };
297
+ Input: {
298
+ props: z.ZodObject<{
299
+ label: z.ZodString;
300
+ name: z.ZodString;
301
+ type: z.ZodNullable<z.ZodEnum<{
302
+ number: "number";
303
+ text: "text";
304
+ email: "email";
305
+ password: "password";
306
+ }>>;
307
+ placeholder: z.ZodNullable<z.ZodString>;
308
+ value: z.ZodNullable<z.ZodString>;
309
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
310
+ type: z.ZodString;
311
+ message: z.ZodString;
312
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
313
+ }, z.core.$strip>>>;
314
+ }, z.core.$strip>;
315
+ events: string[];
316
+ description: string;
317
+ example: {
318
+ label: string;
319
+ name: string;
320
+ type: string;
321
+ placeholder: string;
322
+ };
323
+ };
324
+ Textarea: {
325
+ props: z.ZodObject<{
326
+ label: z.ZodString;
327
+ name: z.ZodString;
328
+ placeholder: z.ZodNullable<z.ZodString>;
329
+ rows: z.ZodNullable<z.ZodNumber>;
330
+ value: z.ZodNullable<z.ZodString>;
331
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
332
+ type: z.ZodString;
333
+ message: z.ZodString;
334
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
335
+ }, z.core.$strip>>>;
336
+ }, z.core.$strip>;
337
+ description: string;
338
+ };
339
+ Select: {
340
+ props: z.ZodObject<{
341
+ label: z.ZodString;
342
+ name: z.ZodString;
343
+ options: z.ZodArray<z.ZodString>;
344
+ placeholder: z.ZodNullable<z.ZodString>;
345
+ value: z.ZodNullable<z.ZodString>;
346
+ checks: z.ZodNullable<z.ZodArray<z.ZodObject<{
347
+ type: z.ZodString;
348
+ message: z.ZodString;
349
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
350
+ }, z.core.$strip>>>;
351
+ }, z.core.$strip>;
352
+ events: string[];
353
+ description: string;
354
+ };
355
+ Checkbox: {
356
+ props: z.ZodObject<{
357
+ label: z.ZodString;
358
+ name: z.ZodString;
359
+ checked: z.ZodNullable<z.ZodBoolean>;
360
+ }, z.core.$strip>;
361
+ events: string[];
362
+ description: string;
363
+ };
364
+ Radio: {
365
+ props: z.ZodObject<{
366
+ label: z.ZodString;
367
+ name: z.ZodString;
368
+ options: z.ZodArray<z.ZodString>;
369
+ value: z.ZodNullable<z.ZodString>;
370
+ }, z.core.$strip>;
371
+ events: string[];
372
+ description: string;
373
+ };
374
+ Switch: {
375
+ props: z.ZodObject<{
376
+ label: z.ZodString;
377
+ name: z.ZodString;
378
+ checked: z.ZodNullable<z.ZodBoolean>;
379
+ }, z.core.$strip>;
380
+ events: string[];
381
+ description: string;
382
+ };
383
+ Slider: {
384
+ props: z.ZodObject<{
385
+ label: z.ZodNullable<z.ZodString>;
386
+ min: z.ZodNullable<z.ZodNumber>;
387
+ max: z.ZodNullable<z.ZodNumber>;
388
+ step: z.ZodNullable<z.ZodNumber>;
389
+ value: z.ZodNullable<z.ZodNumber>;
390
+ }, z.core.$strip>;
391
+ events: string[];
392
+ description: string;
393
+ };
394
+ Button: {
395
+ props: z.ZodObject<{
396
+ label: z.ZodString;
397
+ variant: z.ZodNullable<z.ZodEnum<{
398
+ secondary: "secondary";
399
+ primary: "primary";
400
+ danger: "danger";
401
+ }>>;
402
+ disabled: z.ZodNullable<z.ZodBoolean>;
403
+ }, z.core.$strip>;
404
+ events: string[];
405
+ description: string;
406
+ example: {
407
+ label: string;
408
+ variant: string;
409
+ };
410
+ };
411
+ Link: {
412
+ props: z.ZodObject<{
413
+ label: z.ZodString;
414
+ href: z.ZodString;
415
+ }, z.core.$strip>;
416
+ events: string[];
417
+ description: string;
418
+ };
419
+ DropdownMenu: {
420
+ props: z.ZodObject<{
421
+ label: z.ZodString;
422
+ items: z.ZodArray<z.ZodObject<{
423
+ label: z.ZodString;
424
+ value: z.ZodString;
425
+ }, z.core.$strip>>;
426
+ value: z.ZodNullable<z.ZodString>;
427
+ }, z.core.$strip>;
428
+ events: string[];
429
+ description: string;
430
+ };
431
+ Toggle: {
432
+ props: z.ZodObject<{
433
+ label: z.ZodString;
434
+ pressed: z.ZodNullable<z.ZodBoolean>;
435
+ variant: z.ZodNullable<z.ZodEnum<{
436
+ default: "default";
437
+ outline: "outline";
438
+ }>>;
439
+ }, z.core.$strip>;
440
+ events: string[];
441
+ description: string;
442
+ };
443
+ ToggleGroup: {
444
+ props: z.ZodObject<{
445
+ items: z.ZodArray<z.ZodObject<{
446
+ label: z.ZodString;
447
+ value: z.ZodString;
448
+ }, z.core.$strip>>;
449
+ type: z.ZodNullable<z.ZodEnum<{
450
+ single: "single";
451
+ multiple: "multiple";
452
+ }>>;
453
+ value: z.ZodNullable<z.ZodString>;
454
+ }, z.core.$strip>;
455
+ events: string[];
456
+ description: string;
457
+ };
458
+ ButtonGroup: {
459
+ props: z.ZodObject<{
460
+ buttons: z.ZodArray<z.ZodObject<{
461
+ label: z.ZodString;
462
+ value: z.ZodString;
463
+ }, z.core.$strip>>;
464
+ selected: z.ZodNullable<z.ZodString>;
465
+ }, z.core.$strip>;
466
+ events: string[];
467
+ description: string;
468
+ };
469
+ Pagination: {
470
+ props: z.ZodObject<{
471
+ totalPages: z.ZodNumber;
472
+ page: z.ZodNullable<z.ZodNumber>;
473
+ }, z.core.$strip>;
474
+ events: string[];
475
+ description: string;
476
+ };
477
+ };
478
+ /**
479
+ * Type for a component definition
480
+ */
481
+ type ComponentDefinition = {
482
+ props: z.ZodType;
483
+ slots?: string[];
484
+ events?: string[];
485
+ description: string;
486
+ example?: Record<string, unknown>;
487
+ };
488
+ /**
489
+ * Infer the props type for a shadcn component by name.
490
+ * Derives the TypeScript type directly from the Zod schema,
491
+ * so component implementations stay in sync with catalog definitions.
492
+ *
493
+ * @example
494
+ * ```ts
495
+ * type CardProps = ShadcnProps<"Card">;
496
+ * // { title: string | null; description: string | null; ... }
497
+ * ```
498
+ */
499
+ type ShadcnProps<K extends keyof typeof shadcnComponentDefinitions> = z.output<(typeof shadcnComponentDefinitions)[K]["props"]>;
500
+
501
+ export { type ComponentDefinition, type ShadcnProps, shadcnComponentDefinitions };