@fragno-dev/jsonforms-shadcn-renderers 0.0.0

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/dist/index.js ADDED
@@ -0,0 +1,1241 @@
1
+ import { Generate, and, categorizationHasCategory, findUISchema, isBooleanControl, isDateControl, isDateTimeControl, isEnumControl, isIntegerControl, isNumberControl, isObjectControl, isOneOfEnumControl, isRangeControl, isStringControl, isTimeControl, optionIs, rankWith, uiTypeIs } from "@jsonforms/core";
2
+ import { JsonFormsDispatch, withJsonFormsCellProps, withJsonFormsControlProps, withJsonFormsDetailProps, withJsonFormsEnumCellProps, withJsonFormsEnumProps, withJsonFormsLayoutProps, withJsonFormsOneOfEnumCellProps, withJsonFormsOneOfEnumProps } from "@jsonforms/react";
3
+ import { Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldSeparator, FieldSet } from "@/components/ui/field";
4
+ import { Fragment, memo, useMemo, useState } from "react";
5
+ import { Checkbox } from "@/components/ui/checkbox";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Switch } from "@/components/ui/switch";
8
+ import { Input } from "@/components/ui/input";
9
+ import { Textarea } from "@/components/ui/textarea";
10
+ import { cn } from "@/lib/utils";
11
+ import { Button } from "@/components/ui/button";
12
+ import { Calendar } from "@/components/ui/calendar";
13
+ import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
14
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
15
+ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
16
+ import { Label } from "@/components/ui/label";
17
+ import { Slider } from "@/components/ui/slider";
18
+ import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
19
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
20
+
21
+ //#region src/shadcn-controls/ShadcnCheckbox.tsx
22
+ const ShadcnCheckbox = memo(function ShadcnCheckbox$1(props) {
23
+ const { data, className, id, enabled, path, handleChange } = props;
24
+ return /* @__PURE__ */ jsx(Checkbox, {
25
+ checked: !!data,
26
+ onCheckedChange: (isChecked) => handleChange(path, isChecked === true),
27
+ className,
28
+ id,
29
+ disabled: !enabled
30
+ });
31
+ });
32
+
33
+ //#endregion
34
+ //#region src/controls/ShadcnBooleanControl.tsx
35
+ const ShadcnBooleanControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
36
+ const isValid = errors.length === 0;
37
+ if (!visible) return null;
38
+ return /* @__PURE__ */ jsxs(Field, {
39
+ orientation: "horizontal",
40
+ "data-invalid": !isValid || void 0,
41
+ "data-disabled": !enabled || void 0,
42
+ children: [/* @__PURE__ */ jsx(ShadcnCheckbox, {
43
+ id: `${id}-input`,
44
+ data,
45
+ enabled,
46
+ visible,
47
+ path,
48
+ uischema,
49
+ schema,
50
+ rootSchema,
51
+ handleChange,
52
+ errors,
53
+ config,
54
+ isValid
55
+ }), /* @__PURE__ */ jsxs(FieldContent, { children: [
56
+ /* @__PURE__ */ jsx(FieldLabel, {
57
+ htmlFor: `${id}-input`,
58
+ children: label
59
+ }),
60
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
61
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
62
+ ] })]
63
+ });
64
+ };
65
+ const shadcnBooleanControlTester = rankWith(2, isBooleanControl);
66
+ const ShadcnBooleanControlContext = withJsonFormsControlProps(ShadcnBooleanControl);
67
+
68
+ //#endregion
69
+ //#region src/shadcn-controls/ShadcnSwitch.tsx
70
+ const ShadcnSwitch = memo(function ShadcnSwitch$1(props) {
71
+ const { data, className, id, enabled, path, handleChange } = props;
72
+ return /* @__PURE__ */ jsx(Switch, {
73
+ checked: !!data,
74
+ onCheckedChange: (isChecked) => handleChange(path, isChecked),
75
+ className,
76
+ id,
77
+ disabled: !enabled
78
+ });
79
+ });
80
+
81
+ //#endregion
82
+ //#region src/controls/ShadcnBooleanToggleControl.tsx
83
+ const ShadcnBooleanToggleControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
84
+ const isValid = errors.length === 0;
85
+ if (!visible) return null;
86
+ return /* @__PURE__ */ jsxs(Field, {
87
+ orientation: "horizontal",
88
+ "data-invalid": !isValid || void 0,
89
+ "data-disabled": !enabled || void 0,
90
+ children: [/* @__PURE__ */ jsx(ShadcnSwitch, {
91
+ id: `${id}-input`,
92
+ data,
93
+ enabled,
94
+ visible,
95
+ path,
96
+ uischema,
97
+ schema,
98
+ rootSchema,
99
+ handleChange,
100
+ errors,
101
+ config,
102
+ isValid
103
+ }), /* @__PURE__ */ jsxs(FieldContent, { children: [
104
+ /* @__PURE__ */ jsx(FieldLabel, {
105
+ htmlFor: `${id}-input`,
106
+ children: label
107
+ }),
108
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
109
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
110
+ ] })]
111
+ });
112
+ };
113
+ const shadcnBooleanToggleControlTester = rankWith(3, and(isBooleanControl, optionIs("toggle", true)));
114
+ const ShadcnBooleanToggleControlContext = withJsonFormsControlProps(ShadcnBooleanToggleControl);
115
+
116
+ //#endregion
117
+ //#region src/shadcn-controls/ShadcnInput.tsx
118
+ const ShadcnInput = memo(function ShadcnInput$1(props) {
119
+ const { data, className, id, enabled, path, handleChange, schema } = props;
120
+ return /* @__PURE__ */ jsx(Input, {
121
+ type: "text",
122
+ value: data ?? "",
123
+ onChange: (e) => handleChange(path, e.target.value || void 0),
124
+ className,
125
+ id,
126
+ disabled: !enabled,
127
+ maxLength: schema.maxLength
128
+ });
129
+ });
130
+
131
+ //#endregion
132
+ //#region src/controls/ShadcnTextControl.tsx
133
+ const ShadcnTextControl = ({ data, visible, label, id, enabled, schema, handleChange, errors, path, description }) => {
134
+ const isValid = errors.length === 0;
135
+ if (!visible) return null;
136
+ return /* @__PURE__ */ jsxs(Field, {
137
+ "data-invalid": !isValid || void 0,
138
+ "data-disabled": !enabled || void 0,
139
+ children: [
140
+ /* @__PURE__ */ jsx(FieldLabel, {
141
+ htmlFor: `${id}-input`,
142
+ children: label
143
+ }),
144
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
145
+ /* @__PURE__ */ jsx(ShadcnInput, {
146
+ id: `${id}-input`,
147
+ data,
148
+ enabled,
149
+ path,
150
+ schema,
151
+ handleChange
152
+ }),
153
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
154
+ ]
155
+ });
156
+ };
157
+ const shadcnTextControlTester = rankWith(1, isStringControl);
158
+ const ShadcnTextControlContext = withJsonFormsControlProps(ShadcnTextControl);
159
+
160
+ //#endregion
161
+ //#region src/shadcn-controls/ShadcnTextarea.tsx
162
+ const ShadcnTextarea = memo(function ShadcnTextarea$1(props) {
163
+ const { data, className, id, enabled, path, handleChange, schema } = props;
164
+ return /* @__PURE__ */ jsx(Textarea, {
165
+ value: data ?? "",
166
+ onChange: (e) => handleChange(path, e.target.value || void 0),
167
+ className,
168
+ id,
169
+ disabled: !enabled,
170
+ maxLength: schema.maxLength
171
+ });
172
+ });
173
+
174
+ //#endregion
175
+ //#region src/controls/ShadcnTextAreaControl.tsx
176
+ const ShadcnTextAreaControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
177
+ const isValid = errors.length === 0;
178
+ if (!visible) return null;
179
+ return /* @__PURE__ */ jsxs(Field, {
180
+ "data-invalid": !isValid || void 0,
181
+ "data-disabled": !enabled || void 0,
182
+ children: [
183
+ /* @__PURE__ */ jsx(FieldLabel, {
184
+ htmlFor: `${id}-input`,
185
+ children: label
186
+ }),
187
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
188
+ /* @__PURE__ */ jsx(ShadcnTextarea, {
189
+ id: `${id}-input`,
190
+ data,
191
+ enabled,
192
+ visible,
193
+ path,
194
+ uischema,
195
+ schema,
196
+ rootSchema,
197
+ handleChange,
198
+ errors,
199
+ config,
200
+ isValid
201
+ }),
202
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
203
+ ]
204
+ });
205
+ };
206
+ const shadcnTextAreaControlTester = rankWith(2, and(isStringControl, optionIs("multi", true)));
207
+ const ShadcnTextAreaControlContext = withJsonFormsControlProps(ShadcnTextAreaControl);
208
+
209
+ //#endregion
210
+ //#region src/icons/ChevronDown.tsx
211
+ function ChevronDownIcon({ className }) {
212
+ return /* @__PURE__ */ jsx("svg", {
213
+ className,
214
+ xmlns: "http://www.w3.org/2000/svg",
215
+ width: "24",
216
+ height: "24",
217
+ viewBox: "0 0 24 24",
218
+ fill: "none",
219
+ stroke: "currentColor",
220
+ strokeWidth: "2",
221
+ strokeLinecap: "round",
222
+ strokeLinejoin: "round",
223
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
224
+ });
225
+ }
226
+
227
+ //#endregion
228
+ //#region src/util/date-time.ts
229
+ function parseDate(value) {
230
+ if (!value) return;
231
+ const date = new Date(value);
232
+ return isNaN(date.getTime()) ? void 0 : date;
233
+ }
234
+ function formatDateForSave(date) {
235
+ if (!date) return;
236
+ return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
237
+ }
238
+ function toTimeInputValue(value) {
239
+ if (!value) return "";
240
+ return value.substring(0, 5);
241
+ }
242
+ function formatTimeForSave(value) {
243
+ if (!value) return;
244
+ return value.length === 5 ? `${value}:00` : value;
245
+ }
246
+ function formatTimeFromDate(date) {
247
+ return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
248
+ }
249
+
250
+ //#endregion
251
+ //#region src/shadcn-controls/ShadcnDatePicker.tsx
252
+ const ShadcnDatePicker = memo(function ShadcnDatePicker$1(props) {
253
+ const { data, className, id, enabled, path, handleChange } = props;
254
+ const [open, setOpen] = useState(false);
255
+ const selectedDate = useMemo(() => parseDate(data), [data]);
256
+ const handleSelect = (date) => {
257
+ handleChange(path, formatDateForSave(date));
258
+ setOpen(false);
259
+ };
260
+ return /* @__PURE__ */ jsxs(Popover, {
261
+ open,
262
+ onOpenChange: setOpen,
263
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
264
+ asChild: true,
265
+ children: /* @__PURE__ */ jsxs(Button, {
266
+ id,
267
+ variant: "outline",
268
+ disabled: !enabled,
269
+ className: cn("w-full justify-between font-normal", !selectedDate && "text-muted-foreground", className),
270
+ children: [selectedDate ? selectedDate.toLocaleDateString() : "Select date", /* @__PURE__ */ jsx(ChevronDownIcon, {})]
271
+ })
272
+ }), /* @__PURE__ */ jsx(PopoverContent, {
273
+ className: "w-auto overflow-hidden p-0",
274
+ align: "start",
275
+ children: /* @__PURE__ */ jsx(Calendar, {
276
+ mode: "single",
277
+ selected: selectedDate,
278
+ captionLayout: "dropdown",
279
+ onSelect: handleSelect
280
+ })
281
+ })]
282
+ });
283
+ });
284
+
285
+ //#endregion
286
+ //#region src/controls/ShadcnDateControl.tsx
287
+ const ShadcnDateControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
288
+ const isValid = errors.length === 0;
289
+ if (!visible) return null;
290
+ return /* @__PURE__ */ jsxs(Field, {
291
+ "data-invalid": !isValid || void 0,
292
+ "data-disabled": !enabled || void 0,
293
+ children: [
294
+ /* @__PURE__ */ jsx(FieldLabel, {
295
+ htmlFor: `${id}-input`,
296
+ children: label
297
+ }),
298
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
299
+ /* @__PURE__ */ jsx(ShadcnDatePicker, {
300
+ id: `${id}-input`,
301
+ data,
302
+ enabled,
303
+ visible,
304
+ path,
305
+ uischema,
306
+ schema,
307
+ rootSchema,
308
+ handleChange,
309
+ errors,
310
+ config,
311
+ isValid
312
+ }),
313
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
314
+ ]
315
+ });
316
+ };
317
+ const shadcnDateControlTester = rankWith(4, isDateControl);
318
+ const ShadcnDateControlContext = withJsonFormsControlProps(ShadcnDateControl);
319
+
320
+ //#endregion
321
+ //#region src/shadcn-controls/ShadcnTimePicker.tsx
322
+ const ShadcnTimePicker = memo(function ShadcnTimePicker$1(props) {
323
+ const { data, className, id, enabled, path, handleChange } = props;
324
+ return /* @__PURE__ */ jsx(Input, {
325
+ type: "time",
326
+ id,
327
+ value: useMemo(() => toTimeInputValue(data), [data]),
328
+ onChange: (e) => handleChange(path, formatTimeForSave(e.target.value)),
329
+ disabled: !enabled,
330
+ className: cn("bg-background w-full appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none", className)
331
+ });
332
+ });
333
+
334
+ //#endregion
335
+ //#region src/controls/ShadcnTimeControl.tsx
336
+ const ShadcnTimeControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
337
+ const isValid = errors.length === 0;
338
+ if (!visible) return null;
339
+ return /* @__PURE__ */ jsxs(Field, {
340
+ "data-invalid": !isValid || void 0,
341
+ "data-disabled": !enabled || void 0,
342
+ children: [
343
+ /* @__PURE__ */ jsx(FieldLabel, {
344
+ htmlFor: `${id}-input`,
345
+ children: label
346
+ }),
347
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
348
+ /* @__PURE__ */ jsx(ShadcnTimePicker, {
349
+ id: `${id}-input`,
350
+ data,
351
+ enabled,
352
+ visible,
353
+ path,
354
+ uischema,
355
+ schema,
356
+ rootSchema,
357
+ handleChange,
358
+ errors,
359
+ config,
360
+ isValid
361
+ }),
362
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
363
+ ]
364
+ });
365
+ };
366
+ const shadcnTimeControlTester = rankWith(4, isTimeControl);
367
+ const ShadcnTimeControlContext = withJsonFormsControlProps(ShadcnTimeControl);
368
+
369
+ //#endregion
370
+ //#region src/shadcn-controls/ShadcnDateTimePicker.tsx
371
+ function parseDateTime(value) {
372
+ if (!value) return {
373
+ date: void 0,
374
+ time: ""
375
+ };
376
+ const dateTime = new Date(value);
377
+ if (isNaN(dateTime.getTime())) return {
378
+ date: void 0,
379
+ time: ""
380
+ };
381
+ return {
382
+ date: dateTime,
383
+ time: formatTimeFromDate(dateTime)
384
+ };
385
+ }
386
+ function formatDateTimeForSave(date, time) {
387
+ if (!date) return;
388
+ const [hours, minutes] = time ? time.split(":").map(Number) : [0, 0];
389
+ const dateTime = new Date(date);
390
+ dateTime.setHours(hours || 0, minutes || 0, 0, 0);
391
+ return dateTime.toISOString();
392
+ }
393
+ const ShadcnDateTimePicker = memo(function ShadcnDateTimePicker$1(props) {
394
+ const { data, className, id, enabled, path, handleChange } = props;
395
+ const [open, setOpen] = useState(false);
396
+ const { date: selectedDate, time: selectedTime } = useMemo(() => parseDateTime(data), [data]);
397
+ const handleDateSelect = (date) => {
398
+ handleChange(path, formatDateTimeForSave(date, selectedTime || "00:00"));
399
+ setOpen(false);
400
+ };
401
+ const handleTimeChange = (e) => {
402
+ const newTime = e.target.value;
403
+ handleChange(path, formatDateTimeForSave(selectedDate, newTime));
404
+ };
405
+ return /* @__PURE__ */ jsxs("div", {
406
+ className: cn("flex gap-2", className),
407
+ children: [/* @__PURE__ */ jsxs(Popover, {
408
+ open,
409
+ onOpenChange: setOpen,
410
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
411
+ asChild: true,
412
+ children: /* @__PURE__ */ jsxs(Button, {
413
+ id,
414
+ variant: "outline",
415
+ disabled: !enabled,
416
+ className: cn("flex-1 justify-between font-normal", !selectedDate && "text-muted-foreground"),
417
+ children: [selectedDate ? selectedDate.toLocaleDateString() : "Select date", /* @__PURE__ */ jsx(ChevronDownIcon, {})]
418
+ })
419
+ }), /* @__PURE__ */ jsx(PopoverContent, {
420
+ className: "w-auto overflow-hidden p-0",
421
+ align: "start",
422
+ children: /* @__PURE__ */ jsx(Calendar, {
423
+ mode: "single",
424
+ selected: selectedDate,
425
+ captionLayout: "dropdown",
426
+ onSelect: handleDateSelect
427
+ })
428
+ })]
429
+ }), /* @__PURE__ */ jsx(Input, {
430
+ type: "time",
431
+ value: selectedTime,
432
+ onChange: handleTimeChange,
433
+ disabled: !enabled,
434
+ className: "bg-background w-28 appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
435
+ })]
436
+ });
437
+ });
438
+
439
+ //#endregion
440
+ //#region src/controls/ShadcnDateTimeControl.tsx
441
+ const ShadcnDateTimeControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
442
+ const isValid = errors.length === 0;
443
+ if (!visible) return null;
444
+ return /* @__PURE__ */ jsxs(Field, {
445
+ "data-invalid": !isValid || void 0,
446
+ "data-disabled": !enabled || void 0,
447
+ children: [
448
+ /* @__PURE__ */ jsx(FieldLabel, {
449
+ htmlFor: `${id}-input`,
450
+ children: label
451
+ }),
452
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
453
+ /* @__PURE__ */ jsx(ShadcnDateTimePicker, {
454
+ id: `${id}-input`,
455
+ data,
456
+ enabled,
457
+ visible,
458
+ path,
459
+ uischema,
460
+ schema,
461
+ rootSchema,
462
+ handleChange,
463
+ errors,
464
+ config,
465
+ isValid
466
+ }),
467
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
468
+ ]
469
+ });
470
+ };
471
+ const shadcnDateTimeControlTester = rankWith(4, isDateTimeControl);
472
+ const ShadcnDateTimeControlContext = withJsonFormsControlProps(ShadcnDateTimeControl);
473
+
474
+ //#endregion
475
+ //#region src/shadcn-controls/ShadcnNumberInput.tsx
476
+ const ShadcnNumberInput = memo(function ShadcnNumberInput$1(props) {
477
+ const { data, className, id, enabled, path, handleChange, schema, step } = props;
478
+ const handleInputChange = (e) => {
479
+ const value = e.target.value;
480
+ if (value === "") handleChange(path, void 0);
481
+ else {
482
+ const parsed = Number(value);
483
+ handleChange(path, isNaN(parsed) ? void 0 : parsed);
484
+ }
485
+ };
486
+ return /* @__PURE__ */ jsx(Input, {
487
+ type: "number",
488
+ value: data ?? "",
489
+ onChange: handleInputChange,
490
+ className,
491
+ id,
492
+ disabled: !enabled,
493
+ min: schema.minimum,
494
+ max: schema.maximum,
495
+ step: step ?? (schema.multipleOf ? String(schema.multipleOf) : void 0)
496
+ });
497
+ });
498
+
499
+ //#endregion
500
+ //#region src/controls/ShadcnIntegerControl.tsx
501
+ const ShadcnIntegerControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
502
+ const isValid = errors.length === 0;
503
+ if (!visible) return null;
504
+ return /* @__PURE__ */ jsxs(Field, {
505
+ "data-invalid": !isValid || void 0,
506
+ "data-disabled": !enabled || void 0,
507
+ children: [
508
+ /* @__PURE__ */ jsx(FieldLabel, {
509
+ htmlFor: `${id}-input`,
510
+ children: label
511
+ }),
512
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
513
+ /* @__PURE__ */ jsx(ShadcnNumberInput, {
514
+ id: `${id}-input`,
515
+ data,
516
+ enabled,
517
+ visible,
518
+ path,
519
+ uischema,
520
+ schema,
521
+ rootSchema,
522
+ handleChange,
523
+ errors,
524
+ config,
525
+ isValid,
526
+ step: "1"
527
+ }),
528
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
529
+ ]
530
+ });
531
+ };
532
+ const shadcnIntegerControlTester = rankWith(4, isIntegerControl);
533
+ const ShadcnIntegerControlContext = withJsonFormsControlProps(ShadcnIntegerControl);
534
+
535
+ //#endregion
536
+ //#region src/controls/ShadcnNumberControl.tsx
537
+ const ShadcnNumberControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
538
+ const isValid = errors.length === 0;
539
+ if (!visible) return null;
540
+ return /* @__PURE__ */ jsxs(Field, {
541
+ "data-invalid": !isValid || void 0,
542
+ "data-disabled": !enabled || void 0,
543
+ children: [
544
+ /* @__PURE__ */ jsx(FieldLabel, {
545
+ htmlFor: `${id}-input`,
546
+ children: label
547
+ }),
548
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
549
+ /* @__PURE__ */ jsx(ShadcnNumberInput, {
550
+ id: `${id}-input`,
551
+ data,
552
+ enabled,
553
+ visible,
554
+ path,
555
+ uischema,
556
+ schema,
557
+ rootSchema,
558
+ handleChange,
559
+ errors,
560
+ config,
561
+ isValid
562
+ }),
563
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
564
+ ]
565
+ });
566
+ };
567
+ const shadcnNumberControlTester = rankWith(4, isNumberControl);
568
+ const ShadcnNumberControlContext = withJsonFormsControlProps(ShadcnNumberControl);
569
+
570
+ //#endregion
571
+ //#region src/shadcn-controls/ShadcnSelect.tsx
572
+ const ShadcnSelect = memo(function ShadcnSelect$1(props) {
573
+ const { data, className, id, enabled, path, handleChange, options } = props;
574
+ return /* @__PURE__ */ jsxs(Select, {
575
+ value: data ?? "",
576
+ onValueChange: (value) => handleChange(path, value || void 0),
577
+ disabled: !enabled,
578
+ children: [/* @__PURE__ */ jsx(SelectTrigger, {
579
+ id,
580
+ className: cn("w-full", className),
581
+ children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select an option" })
582
+ }), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
583
+ value: String(option.value),
584
+ children: option.label
585
+ }, String(option.value))) })]
586
+ });
587
+ });
588
+
589
+ //#endregion
590
+ //#region src/controls/ShadcnEnumControl.tsx
591
+ const ShadcnEnumControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description, options }) => {
592
+ const isValid = errors.length === 0;
593
+ if (!visible) return null;
594
+ return /* @__PURE__ */ jsxs(Field, {
595
+ "data-invalid": !isValid || void 0,
596
+ "data-disabled": !enabled || void 0,
597
+ children: [
598
+ /* @__PURE__ */ jsx(FieldLabel, {
599
+ htmlFor: `${id}-input`,
600
+ children: label
601
+ }),
602
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
603
+ /* @__PURE__ */ jsx(ShadcnSelect, {
604
+ id: `${id}-input`,
605
+ data,
606
+ enabled,
607
+ visible,
608
+ path,
609
+ uischema,
610
+ schema,
611
+ rootSchema,
612
+ handleChange,
613
+ errors,
614
+ config,
615
+ isValid,
616
+ options: options ?? []
617
+ }),
618
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
619
+ ]
620
+ });
621
+ };
622
+ const shadcnEnumControlTester = rankWith(2, isEnumControl);
623
+ const ShadcnEnumControlContext = withJsonFormsEnumProps(ShadcnEnumControl);
624
+
625
+ //#endregion
626
+ //#region src/shadcn-controls/ShadcnRadioGroup.tsx
627
+ const ShadcnRadioGroup = memo(function ShadcnRadioGroup$1(props) {
628
+ const { data, className, id, enabled, path, handleChange, options } = props;
629
+ return /* @__PURE__ */ jsx(RadioGroup, {
630
+ value: data ?? "",
631
+ onValueChange: (value) => handleChange(path, value || void 0),
632
+ disabled: !enabled,
633
+ className: cn("flex flex-col gap-2", className),
634
+ children: options.map((option) => {
635
+ const optionId = `${id}-${String(option.value)}`;
636
+ return /* @__PURE__ */ jsxs("div", {
637
+ className: "flex items-center gap-2",
638
+ children: [/* @__PURE__ */ jsx(RadioGroupItem, {
639
+ value: String(option.value),
640
+ id: optionId
641
+ }), /* @__PURE__ */ jsx(Label, {
642
+ htmlFor: optionId,
643
+ className: "font-normal",
644
+ children: option.label
645
+ })]
646
+ }, String(option.value));
647
+ })
648
+ });
649
+ });
650
+
651
+ //#endregion
652
+ //#region src/controls/ShadcnEnumRadioControl.tsx
653
+ const ShadcnEnumRadioControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description, options }) => {
654
+ const isValid = errors.length === 0;
655
+ if (!visible) return null;
656
+ return /* @__PURE__ */ jsxs(Field, {
657
+ "data-invalid": !isValid || void 0,
658
+ "data-disabled": !enabled || void 0,
659
+ children: [
660
+ /* @__PURE__ */ jsx(FieldLabel, { children: label }),
661
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
662
+ /* @__PURE__ */ jsx(ShadcnRadioGroup, {
663
+ id: `${id}-input`,
664
+ data,
665
+ enabled,
666
+ visible,
667
+ path,
668
+ uischema,
669
+ schema,
670
+ rootSchema,
671
+ handleChange,
672
+ errors,
673
+ config,
674
+ isValid,
675
+ options: options ?? []
676
+ }),
677
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
678
+ ]
679
+ });
680
+ };
681
+ const shadcnEnumRadioControlTester = rankWith(20, and(isEnumControl, optionIs("format", "radio")));
682
+ const ShadcnEnumRadioControlContext = withJsonFormsEnumProps(ShadcnEnumRadioControl);
683
+
684
+ //#endregion
685
+ //#region src/controls/ShadcnOneOfEnumControl.tsx
686
+ const ShadcnOneOfEnumControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description, options }) => {
687
+ const isValid = errors.length === 0;
688
+ if (!visible) return null;
689
+ return /* @__PURE__ */ jsxs(Field, {
690
+ "data-invalid": !isValid || void 0,
691
+ "data-disabled": !enabled || void 0,
692
+ children: [
693
+ /* @__PURE__ */ jsx(FieldLabel, {
694
+ htmlFor: `${id}-input`,
695
+ children: label
696
+ }),
697
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
698
+ /* @__PURE__ */ jsx(ShadcnSelect, {
699
+ id: `${id}-input`,
700
+ data,
701
+ enabled,
702
+ visible,
703
+ path,
704
+ uischema,
705
+ schema,
706
+ rootSchema,
707
+ handleChange,
708
+ errors,
709
+ config,
710
+ isValid,
711
+ options: options ?? []
712
+ }),
713
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
714
+ ]
715
+ });
716
+ };
717
+ const shadcnOneOfEnumControlTester = rankWith(5, isOneOfEnumControl);
718
+ const ShadcnOneOfEnumControlContext = withJsonFormsOneOfEnumProps(ShadcnOneOfEnumControl);
719
+
720
+ //#endregion
721
+ //#region src/shadcn-controls/ShadcnSlider.tsx
722
+ const ShadcnSlider = memo(function ShadcnSlider$1(props) {
723
+ const { data, className, id, enabled, path, handleChange, schema } = props;
724
+ const min = schema.minimum ?? 0;
725
+ const max = schema.maximum ?? 100;
726
+ const step = schema.multipleOf ?? 1;
727
+ const defaultValue = schema.default ?? min;
728
+ const handleSliderChange = (value) => {
729
+ handleChange(path, value[0]);
730
+ };
731
+ return /* @__PURE__ */ jsx(Slider, {
732
+ value: [data ?? defaultValue],
733
+ onValueChange: handleSliderChange,
734
+ className,
735
+ id,
736
+ disabled: !enabled,
737
+ min,
738
+ max,
739
+ step
740
+ });
741
+ });
742
+
743
+ //#endregion
744
+ //#region src/controls/ShadcnSliderControl.tsx
745
+ const ShadcnSliderControl = ({ data, visible, label, id, enabled, uischema, schema, rootSchema, handleChange, errors, path, config, description }) => {
746
+ const isValid = errors.length === 0;
747
+ if (!visible) return null;
748
+ const min = schema.minimum ?? 0;
749
+ const max = schema.maximum ?? 100;
750
+ const defaultValue = schema.default ?? min;
751
+ const currentValue = data ?? defaultValue;
752
+ return /* @__PURE__ */ jsxs(Field, {
753
+ "data-invalid": !isValid || void 0,
754
+ "data-disabled": !enabled || void 0,
755
+ children: [
756
+ /* @__PURE__ */ jsxs(FieldContent, { children: [/* @__PURE__ */ jsx(FieldLabel, {
757
+ htmlFor: `${id}-input`,
758
+ children: label
759
+ }), description && /* @__PURE__ */ jsx(FieldDescription, { children: description })] }),
760
+ /* @__PURE__ */ jsxs("div", {
761
+ className: "flex items-center justify-between",
762
+ children: [/* @__PURE__ */ jsx("span", { children: " " }), /* @__PURE__ */ jsx("span", {
763
+ className: "text-muted-foreground text-sm tabular-nums",
764
+ children: currentValue
765
+ })]
766
+ }),
767
+ /* @__PURE__ */ jsx(ShadcnSlider, {
768
+ id: `${id}-input`,
769
+ data,
770
+ enabled,
771
+ visible,
772
+ path,
773
+ uischema,
774
+ schema,
775
+ rootSchema,
776
+ handleChange,
777
+ errors,
778
+ config,
779
+ isValid
780
+ }),
781
+ /* @__PURE__ */ jsxs("div", {
782
+ className: "text-muted-foreground flex justify-between text-xs",
783
+ children: [/* @__PURE__ */ jsx("span", { children: min }), /* @__PURE__ */ jsx("span", { children: max })]
784
+ }),
785
+ !isValid && /* @__PURE__ */ jsx(FieldError, { errors: [{ message: errors }] })
786
+ ]
787
+ });
788
+ };
789
+ const shadcnSliderControlTester = rankWith(5, isRangeControl);
790
+ const ShadcnSliderControlContext = withJsonFormsControlProps(ShadcnSliderControl);
791
+
792
+ //#endregion
793
+ //#region src/controls/ShadcnObjectControl.tsx
794
+ const ShadcnObjectControl = ({ renderers, cells, uischemas, schema, label, path, visible, enabled, uischema, rootSchema }) => {
795
+ const detailUiSchema = useMemo(() => findUISchema(uischemas ?? [], schema, uischema.scope, path, () => !path ? Generate.uiSchema(schema, "VerticalLayout", void 0, rootSchema) : {
796
+ ...Generate.uiSchema(schema, "Group", void 0, rootSchema),
797
+ label
798
+ }, uischema, rootSchema), [
799
+ uischemas,
800
+ schema,
801
+ uischema.scope,
802
+ path,
803
+ label,
804
+ uischema,
805
+ rootSchema
806
+ ]);
807
+ if (!visible) return null;
808
+ return /* @__PURE__ */ jsx(JsonFormsDispatch, {
809
+ visible,
810
+ enabled,
811
+ schema,
812
+ uischema: detailUiSchema,
813
+ path,
814
+ renderers,
815
+ cells
816
+ });
817
+ };
818
+ const shadcnObjectControlTester = rankWith(2, isObjectControl);
819
+ const ShadcnObjectControlContext = withJsonFormsDetailProps(ShadcnObjectControl);
820
+
821
+ //#endregion
822
+ //#region src/cells/ShadcnBooleanCell.tsx
823
+ const ShadcnBooleanCell = (props) => {
824
+ return /* @__PURE__ */ jsx(ShadcnCheckbox, { ...props });
825
+ };
826
+ const shadcnBooleanCellTester = rankWith(2, isBooleanControl);
827
+ const ShadcnBooleanCellContext = withJsonFormsCellProps(ShadcnBooleanCell);
828
+
829
+ //#endregion
830
+ //#region src/cells/ShadcnBooleanToggleCell.tsx
831
+ const ShadcnBooleanToggleCell = (props) => {
832
+ return /* @__PURE__ */ jsx(ShadcnSwitch, { ...props });
833
+ };
834
+ const shadcnBooleanToggleCellTester = rankWith(3, and(isBooleanControl, optionIs("toggle", true)));
835
+ const ShadcnBooleanToggleCellContext = withJsonFormsCellProps(ShadcnBooleanToggleCell);
836
+
837
+ //#endregion
838
+ //#region src/cells/ShadcnTextCell.tsx
839
+ const ShadcnTextCell = (props) => {
840
+ return /* @__PURE__ */ jsx(ShadcnInput, { ...props });
841
+ };
842
+ const shadcnTextCellTester = rankWith(1, isStringControl);
843
+ const ShadcnTextCellContext = withJsonFormsCellProps(ShadcnTextCell);
844
+
845
+ //#endregion
846
+ //#region src/cells/ShadcnDateCell.tsx
847
+ const ShadcnDateCell = (props) => {
848
+ return /* @__PURE__ */ jsx(ShadcnDatePicker, { ...props });
849
+ };
850
+ const shadcnDateCellTester = rankWith(2, isDateControl);
851
+ const ShadcnDateCellContext = withJsonFormsCellProps(ShadcnDateCell);
852
+
853
+ //#endregion
854
+ //#region src/cells/ShadcnTimeCell.tsx
855
+ const ShadcnTimeCell = (props) => {
856
+ return /* @__PURE__ */ jsx(ShadcnTimePicker, { ...props });
857
+ };
858
+ const shadcnTimeCellTester = rankWith(2, isTimeControl);
859
+ const ShadcnTimeCellContext = withJsonFormsCellProps(ShadcnTimeCell);
860
+
861
+ //#endregion
862
+ //#region src/cells/ShadcnDateTimeCell.tsx
863
+ const ShadcnDateTimeCell = (props) => {
864
+ return /* @__PURE__ */ jsx(ShadcnDateTimePicker, { ...props });
865
+ };
866
+ const shadcnDateTimeCellTester = rankWith(2, isDateTimeControl);
867
+ const ShadcnDateTimeCellContext = withJsonFormsCellProps(ShadcnDateTimeCell);
868
+
869
+ //#endregion
870
+ //#region src/cells/ShadcnIntegerCell.tsx
871
+ const ShadcnIntegerCell = (props) => {
872
+ return /* @__PURE__ */ jsx(ShadcnNumberInput, {
873
+ ...props,
874
+ step: "1"
875
+ });
876
+ };
877
+ const shadcnIntegerCellTester = rankWith(2, isIntegerControl);
878
+ const ShadcnIntegerCellContext = withJsonFormsCellProps(ShadcnIntegerCell);
879
+
880
+ //#endregion
881
+ //#region src/cells/ShadcnNumberCell.tsx
882
+ const ShadcnNumberCell = (props) => {
883
+ return /* @__PURE__ */ jsx(ShadcnNumberInput, { ...props });
884
+ };
885
+ const shadcnNumberCellTester = rankWith(2, isNumberControl);
886
+ const ShadcnNumberCellContext = withJsonFormsCellProps(ShadcnNumberCell);
887
+
888
+ //#endregion
889
+ //#region src/cells/ShadcnEnumCell.tsx
890
+ const ShadcnEnumCell = (props) => {
891
+ return /* @__PURE__ */ jsx(ShadcnSelect, {
892
+ ...props,
893
+ options: props.options ?? []
894
+ });
895
+ };
896
+ const shadcnEnumCellTester = rankWith(2, isEnumControl);
897
+ const ShadcnEnumCellContext = withJsonFormsEnumCellProps(ShadcnEnumCell);
898
+
899
+ //#endregion
900
+ //#region src/cells/ShadcnEnumRadioCell.tsx
901
+ const ShadcnEnumRadioCell = (props) => {
902
+ return /* @__PURE__ */ jsx(ShadcnRadioGroup, {
903
+ ...props,
904
+ options: props.options ?? []
905
+ });
906
+ };
907
+ const shadcnEnumRadioCellTester = rankWith(20, and(isEnumControl, optionIs("format", "radio")));
908
+ const ShadcnEnumRadioCellContext = withJsonFormsEnumCellProps(ShadcnEnumRadioCell);
909
+
910
+ //#endregion
911
+ //#region src/cells/ShadcnOneOfEnumCell.tsx
912
+ const ShadcnOneOfEnumCell = (props) => {
913
+ return /* @__PURE__ */ jsx(ShadcnSelect, {
914
+ ...props,
915
+ options: props.options ?? []
916
+ });
917
+ };
918
+ const shadcnOneOfEnumCellTester = rankWith(2, isOneOfEnumControl);
919
+ const ShadcnOneOfEnumCellContext = withJsonFormsOneOfEnumCellProps(ShadcnOneOfEnumCell);
920
+
921
+ //#endregion
922
+ //#region src/cells/ShadcnSliderCell.tsx
923
+ const ShadcnSliderCell = (props) => {
924
+ const { visible } = props;
925
+ if (!visible) return null;
926
+ return /* @__PURE__ */ jsx(ShadcnSlider, { ...props });
927
+ };
928
+ const shadcnSliderCellTester = rankWith(2, isRangeControl);
929
+ const ShadcnSliderCellContext = withJsonFormsCellProps(ShadcnSliderCell);
930
+
931
+ //#endregion
932
+ //#region src/layouts/ShadcnVerticalLayout.tsx
933
+ const ShadcnVerticalLayout = ({ uischema, schema, path, enabled, visible, renderers, cells }) => {
934
+ const verticalLayout = uischema;
935
+ if (!visible || !verticalLayout.elements || verticalLayout.elements.length === 0) return null;
936
+ return /* @__PURE__ */ jsx(FieldGroup, { children: verticalLayout.elements.map((child, index) => {
937
+ const isGroup = child.type === "Group";
938
+ const prevIsGroup = verticalLayout.elements[index - 1]?.type === "Group";
939
+ return /* @__PURE__ */ jsxs(Fragment, { children: [index > 0 && (isGroup || prevIsGroup) && /* @__PURE__ */ jsx(FieldSeparator, {}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(JsonFormsDispatch, {
940
+ uischema: child,
941
+ schema,
942
+ path,
943
+ enabled,
944
+ renderers,
945
+ cells
946
+ }) })] }, `${path}-${index}`);
947
+ }) });
948
+ };
949
+ const shadcnVerticalLayoutTester = rankWith(1, uiTypeIs("VerticalLayout"));
950
+ const ShadcnVerticalLayoutContext = withJsonFormsLayoutProps(ShadcnVerticalLayout);
951
+
952
+ //#endregion
953
+ //#region src/layouts/ShadcnHorizontalLayout.tsx
954
+ const ShadcnHorizontalLayout = ({ uischema, schema, path, enabled, visible, renderers, cells }) => {
955
+ const horizontalLayout = uischema;
956
+ if (!visible || !horizontalLayout.elements || horizontalLayout.elements.length === 0) return null;
957
+ return /* @__PURE__ */ jsx("div", {
958
+ className: "flex flex-row gap-4",
959
+ children: horizontalLayout.elements.map((child, index) => /* @__PURE__ */ jsx("div", {
960
+ className: "flex-1",
961
+ children: /* @__PURE__ */ jsx(JsonFormsDispatch, {
962
+ uischema: child,
963
+ schema,
964
+ path,
965
+ enabled,
966
+ renderers,
967
+ cells
968
+ })
969
+ }, `${path}-${index}`))
970
+ });
971
+ };
972
+ const shadcnHorizontalLayoutTester = rankWith(1, uiTypeIs("HorizontalLayout"));
973
+ const ShadcnHorizontalLayoutContext = withJsonFormsLayoutProps(ShadcnHorizontalLayout);
974
+
975
+ //#endregion
976
+ //#region src/layouts/ShadcnGroupLayout.tsx
977
+ const ShadcnGroupLayout = ({ uischema, schema, path, enabled, visible, renderers, cells, label }) => {
978
+ const groupLayout = uischema;
979
+ const description = groupLayout.options?.["description"];
980
+ if (!visible) return null;
981
+ const hasElements = groupLayout.elements && groupLayout.elements.length > 0;
982
+ return /* @__PURE__ */ jsxs(FieldSet, { children: [
983
+ label && /* @__PURE__ */ jsx(FieldLabel, { children: label }),
984
+ description && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
985
+ hasElements && groupLayout.elements.map((child, index) => /* @__PURE__ */ jsx(JsonFormsDispatch, {
986
+ uischema: child,
987
+ schema,
988
+ path,
989
+ enabled,
990
+ renderers,
991
+ cells
992
+ }, `${path}-${index}`))
993
+ ] });
994
+ };
995
+ const shadcnGroupLayoutTester = rankWith(1, uiTypeIs("Group"));
996
+ const ShadcnGroupLayoutContext = withJsonFormsLayoutProps(ShadcnGroupLayout);
997
+
998
+ //#endregion
999
+ //#region src/layouts/ShadcnCategorizationLayout.tsx
1000
+ const ShadcnCategorizationLayout = ({ uischema, schema, path, enabled, visible, renderers, cells }) => {
1001
+ const categories = uischema.elements || [];
1002
+ const [activeTab, setActiveTab] = useState(categories.length > 0 ? categories[0].label || "tab-0" : "tab-0");
1003
+ if (!visible) return null;
1004
+ if (categories.length === 0) return null;
1005
+ const getTabValue = (category, index) => category.label || `tab-${index}`;
1006
+ return /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsxs(Tabs, {
1007
+ value: activeTab,
1008
+ onValueChange: setActiveTab,
1009
+ className: "w-full",
1010
+ children: [/* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(TabsList, {
1011
+ className: "w-full",
1012
+ children: categories.map((category, index) => /* @__PURE__ */ jsx(TabsTrigger, {
1013
+ value: getTabValue(category, index),
1014
+ className: "flex-1",
1015
+ children: category.label || `Tab ${index + 1}`
1016
+ }, index))
1017
+ }) }), categories.map((category, categoryIndex) => /* @__PURE__ */ jsx(TabsContent, {
1018
+ value: getTabValue(category, categoryIndex),
1019
+ className: "mt-0",
1020
+ children: /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", {
1021
+ className: "flex flex-col gap-4",
1022
+ children: category.elements?.map((element, elementIndex) => /* @__PURE__ */ jsx(JsonFormsDispatch, {
1023
+ uischema: element,
1024
+ schema,
1025
+ path,
1026
+ enabled,
1027
+ renderers,
1028
+ cells
1029
+ }, `${path}-${categoryIndex}-${elementIndex}`))
1030
+ }) })
1031
+ }, categoryIndex))]
1032
+ }) });
1033
+ };
1034
+ const shadcnCategorizationLayoutTester = rankWith(1, and(uiTypeIs("Categorization"), categorizationHasCategory));
1035
+ const ShadcnCategorizationLayoutContext = withJsonFormsLayoutProps(ShadcnCategorizationLayout);
1036
+
1037
+ //#endregion
1038
+ //#region src/layouts/ShadcnCategorizationStepperLayout.tsx
1039
+ const ShadcnCategorizationStepperLayout = ({ uischema, schema, path, enabled, visible, renderers, cells }) => {
1040
+ const categories = uischema.elements || [];
1041
+ const [currentStep, setCurrentStep] = useState(0);
1042
+ if (!visible) return null;
1043
+ if (categories.length === 0) return null;
1044
+ const currentCategory = categories[currentStep];
1045
+ const isFirstStep = currentStep === 0;
1046
+ const isLastStep = currentStep === categories.length - 1;
1047
+ const handleNext = () => {
1048
+ if (!isLastStep) setCurrentStep(currentStep + 1);
1049
+ };
1050
+ const handlePrevious = () => {
1051
+ if (!isFirstStep) setCurrentStep(currentStep - 1);
1052
+ };
1053
+ const handleStepClick = (stepIndex) => {
1054
+ setCurrentStep(stepIndex);
1055
+ };
1056
+ return /* @__PURE__ */ jsxs(Card, { children: [
1057
+ /* @__PURE__ */ jsxs(CardHeader, { children: [/* @__PURE__ */ jsx("div", {
1058
+ className: "flex w-full items-center",
1059
+ children: categories.map((category, index) => /* @__PURE__ */ jsxs("div", {
1060
+ className: "flex flex-1 items-center last:flex-none",
1061
+ children: [/* @__PURE__ */ jsx("button", {
1062
+ type: "button",
1063
+ onClick: () => handleStepClick(index),
1064
+ className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-medium transition-colors", index === currentStep ? "bg-primary text-primary-foreground" : index < currentStep ? "bg-primary/20 text-primary hover:bg-primary/30" : "bg-muted text-muted-foreground hover:bg-muted/80"),
1065
+ title: category.label,
1066
+ children: index + 1
1067
+ }), index < categories.length - 1 && /* @__PURE__ */ jsx("div", { className: cn("mx-2 h-0.5 flex-1", index < currentStep ? "bg-primary/50" : "bg-muted") })]
1068
+ }, index))
1069
+ }), currentCategory.label && /* @__PURE__ */ jsx(CardTitle, {
1070
+ className: "pt-4",
1071
+ children: currentCategory.label
1072
+ })] }),
1073
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsx("div", {
1074
+ className: "flex flex-col gap-4",
1075
+ children: currentCategory.elements?.map((element, index) => /* @__PURE__ */ jsx(JsonFormsDispatch, {
1076
+ uischema: element,
1077
+ schema,
1078
+ path,
1079
+ enabled,
1080
+ renderers,
1081
+ cells
1082
+ }, `${path}-${currentStep}-${index}`))
1083
+ }) }),
1084
+ /* @__PURE__ */ jsxs(CardFooter, {
1085
+ className: "flex justify-between",
1086
+ children: [/* @__PURE__ */ jsx(Button, {
1087
+ type: "button",
1088
+ variant: "outline",
1089
+ onClick: handlePrevious,
1090
+ disabled: isFirstStep,
1091
+ children: "Previous"
1092
+ }), !isLastStep && /* @__PURE__ */ jsx(Button, {
1093
+ type: "button",
1094
+ onClick: handleNext,
1095
+ children: "Next"
1096
+ })]
1097
+ })
1098
+ ] });
1099
+ };
1100
+ const shadcnCategorizationStepperLayoutTester = rankWith(2, and(uiTypeIs("Categorization"), categorizationHasCategory, optionIs("variant", "stepper")));
1101
+ const ShadcnCategorizationStepperLayoutContext = withJsonFormsLayoutProps(ShadcnCategorizationStepperLayout);
1102
+
1103
+ //#endregion
1104
+ //#region src/index.ts
1105
+ /**
1106
+ * Shadcn renderers for JSON Forms.
1107
+ * Register these with JSON Forms to use shadcn/ui components for form rendering.
1108
+ */
1109
+ const shadcnRenderers = [
1110
+ {
1111
+ tester: shadcnCategorizationStepperLayoutTester,
1112
+ renderer: ShadcnCategorizationStepperLayoutContext
1113
+ },
1114
+ {
1115
+ tester: shadcnCategorizationLayoutTester,
1116
+ renderer: ShadcnCategorizationLayoutContext
1117
+ },
1118
+ {
1119
+ tester: shadcnVerticalLayoutTester,
1120
+ renderer: ShadcnVerticalLayoutContext
1121
+ },
1122
+ {
1123
+ tester: shadcnHorizontalLayoutTester,
1124
+ renderer: ShadcnHorizontalLayoutContext
1125
+ },
1126
+ {
1127
+ tester: shadcnGroupLayoutTester,
1128
+ renderer: ShadcnGroupLayoutContext
1129
+ },
1130
+ {
1131
+ tester: shadcnDateTimeControlTester,
1132
+ renderer: ShadcnDateTimeControlContext
1133
+ },
1134
+ {
1135
+ tester: shadcnTimeControlTester,
1136
+ renderer: ShadcnTimeControlContext
1137
+ },
1138
+ {
1139
+ tester: shadcnDateControlTester,
1140
+ renderer: ShadcnDateControlContext
1141
+ },
1142
+ {
1143
+ tester: shadcnTextAreaControlTester,
1144
+ renderer: ShadcnTextAreaControlContext
1145
+ },
1146
+ {
1147
+ tester: shadcnBooleanToggleControlTester,
1148
+ renderer: ShadcnBooleanToggleControlContext
1149
+ },
1150
+ {
1151
+ tester: shadcnBooleanControlTester,
1152
+ renderer: ShadcnBooleanControlContext
1153
+ },
1154
+ {
1155
+ tester: shadcnTextControlTester,
1156
+ renderer: ShadcnTextControlContext
1157
+ },
1158
+ {
1159
+ tester: shadcnIntegerControlTester,
1160
+ renderer: ShadcnIntegerControlContext
1161
+ },
1162
+ {
1163
+ tester: shadcnNumberControlTester,
1164
+ renderer: ShadcnNumberControlContext
1165
+ },
1166
+ {
1167
+ tester: shadcnEnumControlTester,
1168
+ renderer: ShadcnEnumControlContext
1169
+ },
1170
+ {
1171
+ tester: shadcnEnumRadioControlTester,
1172
+ renderer: ShadcnEnumRadioControlContext
1173
+ },
1174
+ {
1175
+ tester: shadcnOneOfEnumControlTester,
1176
+ renderer: ShadcnOneOfEnumControlContext
1177
+ },
1178
+ {
1179
+ tester: shadcnSliderControlTester,
1180
+ renderer: ShadcnSliderControlContext
1181
+ },
1182
+ {
1183
+ tester: shadcnObjectControlTester,
1184
+ renderer: ShadcnObjectControlContext
1185
+ }
1186
+ ];
1187
+ /** Shadcn cells for JSON Forms (lightweight renderers for tables/arrays). */
1188
+ const shadcnCells = [
1189
+ {
1190
+ tester: shadcnBooleanCellTester,
1191
+ cell: ShadcnBooleanCellContext
1192
+ },
1193
+ {
1194
+ tester: shadcnBooleanToggleCellTester,
1195
+ cell: ShadcnBooleanToggleCellContext
1196
+ },
1197
+ {
1198
+ tester: shadcnTextCellTester,
1199
+ cell: ShadcnTextCellContext
1200
+ },
1201
+ {
1202
+ tester: shadcnDateCellTester,
1203
+ cell: ShadcnDateCellContext
1204
+ },
1205
+ {
1206
+ tester: shadcnTimeCellTester,
1207
+ cell: ShadcnTimeCellContext
1208
+ },
1209
+ {
1210
+ tester: shadcnDateTimeCellTester,
1211
+ cell: ShadcnDateTimeCellContext
1212
+ },
1213
+ {
1214
+ tester: shadcnIntegerCellTester,
1215
+ cell: ShadcnIntegerCellContext
1216
+ },
1217
+ {
1218
+ tester: shadcnNumberCellTester,
1219
+ cell: ShadcnNumberCellContext
1220
+ },
1221
+ {
1222
+ tester: shadcnEnumCellTester,
1223
+ cell: ShadcnEnumCellContext
1224
+ },
1225
+ {
1226
+ tester: shadcnEnumRadioCellTester,
1227
+ cell: ShadcnEnumRadioCellContext
1228
+ },
1229
+ {
1230
+ tester: shadcnOneOfEnumCellTester,
1231
+ cell: ShadcnOneOfEnumCellContext
1232
+ },
1233
+ {
1234
+ tester: shadcnSliderCellTester,
1235
+ cell: ShadcnSliderCellContext
1236
+ }
1237
+ ];
1238
+
1239
+ //#endregion
1240
+ export { ShadcnBooleanCell, ShadcnBooleanCellContext, ShadcnBooleanControl, ShadcnBooleanControlContext, ShadcnBooleanToggleCell, ShadcnBooleanToggleCellContext, ShadcnBooleanToggleControl, ShadcnBooleanToggleControlContext, ShadcnCategorizationLayout, ShadcnCategorizationLayoutContext, ShadcnCategorizationStepperLayout, ShadcnCategorizationStepperLayoutContext, ShadcnCheckbox, ShadcnDateCell, ShadcnDateCellContext, ShadcnDateControl, ShadcnDateControlContext, ShadcnDatePicker, ShadcnDateTimeCell, ShadcnDateTimeCellContext, ShadcnDateTimeControl, ShadcnDateTimeControlContext, ShadcnDateTimePicker, ShadcnEnumCell, ShadcnEnumCellContext, ShadcnEnumControl, ShadcnEnumControlContext, ShadcnEnumRadioCell, ShadcnEnumRadioCellContext, ShadcnEnumRadioControl, ShadcnEnumRadioControlContext, ShadcnGroupLayout, ShadcnGroupLayoutContext, ShadcnHorizontalLayout, ShadcnHorizontalLayoutContext, ShadcnInput, ShadcnIntegerCell, ShadcnIntegerCellContext, ShadcnIntegerControl, ShadcnIntegerControlContext, ShadcnNumberCell, ShadcnNumberCellContext, ShadcnNumberControl, ShadcnNumberControlContext, ShadcnNumberInput, ShadcnObjectControl, ShadcnObjectControlContext, ShadcnOneOfEnumCell, ShadcnOneOfEnumCellContext, ShadcnOneOfEnumControl, ShadcnOneOfEnumControlContext, ShadcnRadioGroup, ShadcnSelect, ShadcnSlider, ShadcnSliderCell, ShadcnSliderCellContext, ShadcnSliderControl, ShadcnSliderControlContext, ShadcnSwitch, ShadcnTextAreaControl, ShadcnTextAreaControlContext, ShadcnTextCell, ShadcnTextCellContext, ShadcnTextControl, ShadcnTextControlContext, ShadcnTextarea, ShadcnTimeCell, ShadcnTimeCellContext, ShadcnTimeControl, ShadcnTimeControlContext, ShadcnTimePicker, ShadcnVerticalLayout, ShadcnVerticalLayoutContext, shadcnBooleanCellTester, shadcnBooleanControlTester, shadcnBooleanToggleCellTester, shadcnBooleanToggleControlTester, shadcnCategorizationLayoutTester, shadcnCategorizationStepperLayoutTester, shadcnCells, shadcnDateCellTester, shadcnDateControlTester, shadcnDateTimeCellTester, shadcnDateTimeControlTester, shadcnEnumCellTester, shadcnEnumControlTester, shadcnEnumRadioCellTester, shadcnEnumRadioControlTester, shadcnGroupLayoutTester, shadcnHorizontalLayoutTester, shadcnIntegerCellTester, shadcnIntegerControlTester, shadcnNumberCellTester, shadcnNumberControlTester, shadcnObjectControlTester, shadcnOneOfEnumCellTester, shadcnOneOfEnumControlTester, shadcnRenderers, shadcnSliderCellTester, shadcnSliderControlTester, shadcnTextAreaControlTester, shadcnTextCellTester, shadcnTextControlTester, shadcnTimeCellTester, shadcnTimeControlTester, shadcnVerticalLayoutTester };
1241
+ //# sourceMappingURL=index.js.map