@alexgorbatchev/shadcn 0.0.104 → 0.0.106
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/chunk-38barrma.js +110 -0
- package/dist/{chunk-p8bdmafq.js → chunk-j7fvvgyp.js} +2 -2
- package/dist/{chunk-23ppkypt.js → chunk-me64e034.js} +1 -100
- package/dist/{chunk-e1hkq1mw.js → chunk-rxmcz0j1.js} +617 -481
- package/dist/components/ActionBar.d.ts +31 -0
- package/dist/components/ErrorSummary.d.ts +21 -0
- package/dist/components/Outline.d.ts +20 -0
- package/dist/components/data-grid/index.js +7 -5
- package/dist/components/image-viewer/ImageRegionFields.d.ts +15 -0
- package/dist/components/image-viewer/ImageRegionSelect.d.ts +11 -6
- package/dist/components/image-viewer/imageRegion.d.ts +21 -0
- package/dist/components/image-viewer/index.d.ts +3 -0
- package/dist/components/image-viewer/index.js +247 -92
- package/dist/components/json-render/JsonDropdownMenu.d.ts +4 -0
- package/dist/components/json-render/JsonForm.d.ts +90 -0
- package/dist/components/json-render/catalog.js +1 -1
- package/dist/components/json-render/index.d.ts +2 -0
- package/dist/components/json-render/index.js +487 -228
- package/dist/index.d.ts +5 -0
- package/dist/index.js +26 -10
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ImageViewer.md +2 -2
- package/llms/components/data-display/JsonRenderForm.md +99 -0
- package/llms/components/feedback/ErrorSummary.md +46 -0
- package/llms/components/layout/ActionBar.md +65 -0
- package/llms/components/navigation/Outline.md +42 -0
- package/llms.txt +5 -1
- package/package.json +1 -1
|
@@ -26,10 +26,12 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-rxmcz0j1.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
33
|
+
MenuRadioGroup2,
|
|
34
|
+
MenuRadioItem2,
|
|
33
35
|
DropdownMenu2,
|
|
34
36
|
DropdownMenuTrigger2
|
|
35
37
|
} from "../../chunk-dbxmw9ya.js";
|
|
@@ -92,7 +94,7 @@ import {
|
|
|
92
94
|
CardContent2
|
|
93
95
|
} from "../../chunk-r7krv555.js";
|
|
94
96
|
import"../../chunk-mm3a9s11.js";
|
|
95
|
-
import"../../chunk-
|
|
97
|
+
import"../../chunk-me64e034.js";
|
|
96
98
|
import {
|
|
97
99
|
Tabs2,
|
|
98
100
|
TabsList2,
|
|
@@ -153,6 +155,7 @@ import"../../chunk-m4geb1s5.js";
|
|
|
153
155
|
import"../../chunk-9ecf92s6.js";
|
|
154
156
|
import"../../chunk-fe33dx54.js";
|
|
155
157
|
import"../../chunk-tcefvfr8.js";
|
|
158
|
+
import"../../chunk-38barrma.js";
|
|
156
159
|
import"../../chunk-tcbjvdem.js";
|
|
157
160
|
import {
|
|
158
161
|
Carousel2,
|
|
@@ -166,7 +169,7 @@ import {
|
|
|
166
169
|
} from "../../chunk-2jsgsjas.js";
|
|
167
170
|
import {
|
|
168
171
|
componentDefinitions2
|
|
169
|
-
} from "../../chunk-
|
|
172
|
+
} from "../../chunk-j7fvvgyp.js";
|
|
170
173
|
import"../../chunk-5mydsjp3.js";
|
|
171
174
|
|
|
172
175
|
// src/components/json-render/JsonCard.tsx
|
|
@@ -266,7 +269,109 @@ var JsonSeparator = ({ props }) => {
|
|
|
266
269
|
// src/components/json-render/JsonTabs.tsx
|
|
267
270
|
import { useState } from "react";
|
|
268
271
|
import { useBoundProp } from "@json-render/react";
|
|
272
|
+
|
|
273
|
+
// src/components/json-render/JsonForm.tsx
|
|
274
|
+
import { createContext, use, useCallback, useId, useMemo } from "react";
|
|
269
275
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
276
|
+
var JsonFormContext = createContext(undefined);
|
|
277
|
+
var noErrors = {};
|
|
278
|
+
function JsonFormProvider({ mode = "edit", errors = noErrors, children }) {
|
|
279
|
+
const value = useMemo(() => ({ mode, errors }), [mode, errors]);
|
|
280
|
+
return /* @__PURE__ */ jsx5(JsonFormContext, {
|
|
281
|
+
value,
|
|
282
|
+
children
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
function useJsonForm() {
|
|
286
|
+
return use(JsonFormContext);
|
|
287
|
+
}
|
|
288
|
+
var JsonRevealContext = createContext(() => {});
|
|
289
|
+
function JsonRevealScope({ onReveal, children }) {
|
|
290
|
+
const parent = use(JsonRevealContext);
|
|
291
|
+
const reveal = useCallback(() => {
|
|
292
|
+
parent();
|
|
293
|
+
onReveal();
|
|
294
|
+
}, [parent, onReveal]);
|
|
295
|
+
return /* @__PURE__ */ jsx5(JsonRevealContext, {
|
|
296
|
+
value: reveal,
|
|
297
|
+
children
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
function useJsonReveal() {
|
|
301
|
+
return use(JsonRevealContext);
|
|
302
|
+
}
|
|
303
|
+
function stripRequiredMark(label) {
|
|
304
|
+
return label.replace(/\s*\*+\s*$/, "");
|
|
305
|
+
}
|
|
306
|
+
function useJsonField({ path, label, checks, ownErrors = [] }) {
|
|
307
|
+
const form = useJsonForm();
|
|
308
|
+
const messageId = useId();
|
|
309
|
+
const isRequired = (checks ?? []).some((check) => check.type === "required");
|
|
310
|
+
const error = form ? path ? form.errors[path] : undefined : ownErrors[0];
|
|
311
|
+
return {
|
|
312
|
+
label: stripRequiredMark(label ?? ""),
|
|
313
|
+
isRequired,
|
|
314
|
+
error,
|
|
315
|
+
mode: form?.mode ?? "edit",
|
|
316
|
+
messageId,
|
|
317
|
+
controlProps: {
|
|
318
|
+
"aria-required": isRequired ? true : undefined,
|
|
319
|
+
"aria-invalid": error ? true : undefined,
|
|
320
|
+
"aria-describedby": error ? messageId : undefined
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function JsonFieldLabel({ field, id, htmlFor }) {
|
|
325
|
+
if (!field.label && !field.isRequired)
|
|
326
|
+
return null;
|
|
327
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
328
|
+
"data-slot": "json-field-label",
|
|
329
|
+
className: "flex flex-wrap items-center gap-2",
|
|
330
|
+
children: [
|
|
331
|
+
field.label && /* @__PURE__ */ jsx5(Label2, {
|
|
332
|
+
id,
|
|
333
|
+
htmlFor,
|
|
334
|
+
children: field.label
|
|
335
|
+
}),
|
|
336
|
+
field.isRequired && /* @__PURE__ */ jsx5(Badge2, {
|
|
337
|
+
variant: "outline",
|
|
338
|
+
children: "Required"
|
|
339
|
+
})
|
|
340
|
+
]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function JsonFieldMessage({ field }) {
|
|
344
|
+
if (!field.error)
|
|
345
|
+
return null;
|
|
346
|
+
return /* @__PURE__ */ jsx5("p", {
|
|
347
|
+
id: field.messageId,
|
|
348
|
+
"data-slot": "json-field-message",
|
|
349
|
+
className: "text-sm text-destructive",
|
|
350
|
+
children: field.error
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function JsonFieldValue({ field, text }) {
|
|
354
|
+
const labelId = useId();
|
|
355
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
356
|
+
role: "group",
|
|
357
|
+
"aria-labelledby": field.label ? labelId : undefined,
|
|
358
|
+
"data-slot": "json-field-value",
|
|
359
|
+
className: "flex w-full flex-col gap-1",
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ jsx5(JsonFieldLabel, {
|
|
362
|
+
field,
|
|
363
|
+
id: labelId
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ jsx5("p", {
|
|
366
|
+
className: text ? "text-sm whitespace-pre-wrap" : "text-sm text-muted-foreground",
|
|
367
|
+
children: text || "No answer"
|
|
368
|
+
})
|
|
369
|
+
]
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// src/components/json-render/JsonTabs.tsx
|
|
374
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
270
375
|
function toChildList(children) {
|
|
271
376
|
if (Array.isArray(children))
|
|
272
377
|
return children;
|
|
@@ -282,23 +387,26 @@ var JsonTabs = ({ props, children, bindings, emit }) => {
|
|
|
282
387
|
const childList = toChildList(children);
|
|
283
388
|
const hasPanels = childList.length > 0;
|
|
284
389
|
const extraChildren = childList.slice(tabs.length);
|
|
285
|
-
return /* @__PURE__ */
|
|
390
|
+
return /* @__PURE__ */ jsxs3(Tabs2, {
|
|
286
391
|
value,
|
|
287
392
|
onValueChange: (v) => {
|
|
288
393
|
setValue(v);
|
|
289
394
|
emit("change");
|
|
290
395
|
},
|
|
291
396
|
children: [
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
children: tabs.map((tab) => /* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ jsx6(TabsList2, {
|
|
398
|
+
children: tabs.map((tab) => /* @__PURE__ */ jsx6(TabsTrigger2, {
|
|
294
399
|
value: tab.value,
|
|
295
400
|
children: tab.label
|
|
296
401
|
}, tab.value))
|
|
297
402
|
}),
|
|
298
|
-
hasPanels && tabs.map((tab, index) => /* @__PURE__ */
|
|
403
|
+
hasPanels && tabs.map((tab, index) => /* @__PURE__ */ jsx6(TabsContent2, {
|
|
299
404
|
value: tab.value,
|
|
300
405
|
keepMounted: true,
|
|
301
|
-
children:
|
|
406
|
+
children: /* @__PURE__ */ jsx6(JsonRevealScope, {
|
|
407
|
+
onReveal: () => setValue(tab.value),
|
|
408
|
+
children: childList[index]
|
|
409
|
+
})
|
|
302
410
|
}, tab.value)),
|
|
303
411
|
extraChildren
|
|
304
412
|
]
|
|
@@ -306,29 +414,29 @@ var JsonTabs = ({ props, children, bindings, emit }) => {
|
|
|
306
414
|
};
|
|
307
415
|
|
|
308
416
|
// src/components/json-render/JsonAccordion.tsx
|
|
309
|
-
import { jsx as
|
|
417
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
310
418
|
var JsonAccordion = ({ props }) => {
|
|
311
419
|
const items = props.items ?? [];
|
|
312
420
|
const isMultiple = props.type === "multiple";
|
|
313
|
-
const itemElements = items.map((item, i) => /* @__PURE__ */
|
|
421
|
+
const itemElements = items.map((item, i) => /* @__PURE__ */ jsxs4(AccordionItem2, {
|
|
314
422
|
value: `item-${i}`,
|
|
315
423
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ jsx7(AccordionTrigger2, {
|
|
317
425
|
children: item.title
|
|
318
426
|
}),
|
|
319
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ jsx7(AccordionContent2, {
|
|
320
428
|
children: item.content
|
|
321
429
|
})
|
|
322
430
|
]
|
|
323
431
|
}, i));
|
|
324
432
|
if (isMultiple) {
|
|
325
|
-
return /* @__PURE__ */
|
|
433
|
+
return /* @__PURE__ */ jsx7(Accordion2, {
|
|
326
434
|
multiple: true,
|
|
327
435
|
className: "w-full",
|
|
328
436
|
children: itemElements
|
|
329
437
|
});
|
|
330
438
|
}
|
|
331
|
-
return /* @__PURE__ */
|
|
439
|
+
return /* @__PURE__ */ jsx7(Accordion2, {
|
|
332
440
|
multiple: false,
|
|
333
441
|
className: "w-full",
|
|
334
442
|
children: itemElements
|
|
@@ -336,30 +444,31 @@ var JsonAccordion = ({ props }) => {
|
|
|
336
444
|
};
|
|
337
445
|
|
|
338
446
|
// src/components/json-render/JsonCollapsible.tsx
|
|
339
|
-
import { useState as useState2 } from "react";
|
|
340
|
-
import { jsx as
|
|
447
|
+
import { useCallback as useCallback2, useState as useState2 } from "react";
|
|
448
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
341
449
|
var JsonCollapsible = ({ props, children }) => {
|
|
342
450
|
const [open, setOpen] = useState2(props.defaultOpen ?? false);
|
|
343
|
-
|
|
451
|
+
const reveal = useCallback2(() => setOpen(true), []);
|
|
452
|
+
return /* @__PURE__ */ jsxs5(Collapsible2, {
|
|
344
453
|
open,
|
|
345
454
|
onOpenChange: setOpen,
|
|
346
455
|
className: "w-full",
|
|
347
456
|
children: [
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
render: /* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ jsxs5(CollapsibleTrigger2, {
|
|
458
|
+
render: /* @__PURE__ */ jsx8(Button2, {
|
|
350
459
|
variant: "outline",
|
|
351
460
|
fullWidth: true,
|
|
352
461
|
align: "start"
|
|
353
462
|
}),
|
|
354
463
|
children: [
|
|
355
464
|
props.title,
|
|
356
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ jsx8("svg", {
|
|
357
466
|
className: `h-4 w-4 transition-transform ${open ? "rotate-180" : ""}`,
|
|
358
467
|
fill: "none",
|
|
359
468
|
viewBox: "0 0 24 24",
|
|
360
469
|
stroke: "currentColor",
|
|
361
470
|
strokeWidth: 2,
|
|
362
|
-
children: /* @__PURE__ */
|
|
471
|
+
children: /* @__PURE__ */ jsx8("path", {
|
|
363
472
|
strokeLinecap: "round",
|
|
364
473
|
strokeLinejoin: "round",
|
|
365
474
|
d: "M19 9l-7 7-7-7"
|
|
@@ -367,9 +476,13 @@ var JsonCollapsible = ({ props, children }) => {
|
|
|
367
476
|
})
|
|
368
477
|
]
|
|
369
478
|
}),
|
|
370
|
-
/* @__PURE__ */
|
|
479
|
+
/* @__PURE__ */ jsx8(CollapsibleContent2, {
|
|
371
480
|
className: "pt-2",
|
|
372
|
-
|
|
481
|
+
keepMounted: true,
|
|
482
|
+
children: /* @__PURE__ */ jsx8(JsonRevealScope, {
|
|
483
|
+
onReveal: reveal,
|
|
484
|
+
children
|
|
485
|
+
})
|
|
373
486
|
})
|
|
374
487
|
]
|
|
375
488
|
});
|
|
@@ -377,20 +490,20 @@ var JsonCollapsible = ({ props, children }) => {
|
|
|
377
490
|
|
|
378
491
|
// src/components/json-render/JsonDialog.tsx
|
|
379
492
|
import { useStateBinding } from "@json-render/react";
|
|
380
|
-
import { jsx as
|
|
493
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
381
494
|
var JsonDialog = ({ props, children }) => {
|
|
382
495
|
const [open, setOpen] = useStateBinding(props.openPath ?? "");
|
|
383
|
-
return /* @__PURE__ */
|
|
496
|
+
return /* @__PURE__ */ jsx9(Dialog2, {
|
|
384
497
|
open: open ?? false,
|
|
385
498
|
onOpenChange: (v) => setOpen(v),
|
|
386
|
-
children: /* @__PURE__ */
|
|
499
|
+
children: /* @__PURE__ */ jsxs6(DialogContent2, {
|
|
387
500
|
children: [
|
|
388
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ jsxs6(DialogHeader2, {
|
|
389
502
|
children: [
|
|
390
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ jsx9(DialogTitle2, {
|
|
391
504
|
children: props.title
|
|
392
505
|
}),
|
|
393
|
-
props.description && /* @__PURE__ */
|
|
506
|
+
props.description && /* @__PURE__ */ jsx9(DialogDescription2, {
|
|
394
507
|
children: props.description
|
|
395
508
|
})
|
|
396
509
|
]
|
|
@@ -403,25 +516,25 @@ var JsonDialog = ({ props, children }) => {
|
|
|
403
516
|
|
|
404
517
|
// src/components/json-render/JsonDrawer.tsx
|
|
405
518
|
import { useStateBinding as useStateBinding2 } from "@json-render/react";
|
|
406
|
-
import { jsx as
|
|
519
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
407
520
|
var JsonDrawer = ({ props, children }) => {
|
|
408
521
|
const [open, setOpen] = useStateBinding2(props.openPath ?? "");
|
|
409
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ jsx10(Drawer2, {
|
|
410
523
|
open: open ?? false,
|
|
411
524
|
onOpenChange: (v) => setOpen(v),
|
|
412
|
-
children: /* @__PURE__ */
|
|
525
|
+
children: /* @__PURE__ */ jsxs7(DrawerContent2, {
|
|
413
526
|
children: [
|
|
414
|
-
/* @__PURE__ */
|
|
527
|
+
/* @__PURE__ */ jsxs7(DrawerHeader2, {
|
|
415
528
|
children: [
|
|
416
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ jsx10(DrawerTitle2, {
|
|
417
530
|
children: props.title
|
|
418
531
|
}),
|
|
419
|
-
props.description && /* @__PURE__ */
|
|
532
|
+
props.description && /* @__PURE__ */ jsx10(DrawerDescription2, {
|
|
420
533
|
children: props.description
|
|
421
534
|
})
|
|
422
535
|
]
|
|
423
536
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ jsx10("div", {
|
|
425
538
|
className: "p-4",
|
|
426
539
|
children
|
|
427
540
|
})
|
|
@@ -431,23 +544,23 @@ var JsonDrawer = ({ props, children }) => {
|
|
|
431
544
|
};
|
|
432
545
|
|
|
433
546
|
// src/components/json-render/JsonCarousel.tsx
|
|
434
|
-
import { jsx as
|
|
547
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
435
548
|
var JsonCarousel = ({ props }) => {
|
|
436
549
|
const items = props.items ?? [];
|
|
437
|
-
return /* @__PURE__ */
|
|
550
|
+
return /* @__PURE__ */ jsxs8(Carousel2, {
|
|
438
551
|
className: "w-full",
|
|
439
552
|
children: [
|
|
440
|
-
/* @__PURE__ */
|
|
441
|
-
children: items.map((item, i) => /* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ jsx11(CarouselContent2, {
|
|
554
|
+
children: items.map((item, i) => /* @__PURE__ */ jsx11(CarouselItem2, {
|
|
442
555
|
className: "basis-3/4 md:basis-1/2 lg:basis-1/3",
|
|
443
|
-
children: /* @__PURE__ */
|
|
556
|
+
children: /* @__PURE__ */ jsxs8("div", {
|
|
444
557
|
className: "border border-border rounded-lg p-4 bg-card h-full",
|
|
445
558
|
children: [
|
|
446
|
-
item.title && /* @__PURE__ */
|
|
559
|
+
item.title && /* @__PURE__ */ jsx11("h4", {
|
|
447
560
|
className: "font-semibold text-sm mb-1",
|
|
448
561
|
children: item.title
|
|
449
562
|
}),
|
|
450
|
-
item.description && /* @__PURE__ */
|
|
563
|
+
item.description && /* @__PURE__ */ jsx11("p", {
|
|
451
564
|
className: "text-sm text-muted-foreground",
|
|
452
565
|
children: item.description
|
|
453
566
|
})
|
|
@@ -455,34 +568,34 @@ var JsonCarousel = ({ props }) => {
|
|
|
455
568
|
})
|
|
456
569
|
}, i))
|
|
457
570
|
}),
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
571
|
+
/* @__PURE__ */ jsx11(CarouselPrevious2, {}),
|
|
572
|
+
/* @__PURE__ */ jsx11(CarouselNext2, {})
|
|
460
573
|
]
|
|
461
574
|
});
|
|
462
575
|
};
|
|
463
576
|
|
|
464
577
|
// src/components/json-render/JsonTable.tsx
|
|
465
|
-
import { jsx as
|
|
578
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
466
579
|
var JsonTable = ({ props }) => {
|
|
467
580
|
const columns = props.columns ?? [];
|
|
468
581
|
const rows = (props.rows ?? []).map((row) => row.map(String));
|
|
469
|
-
return /* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ jsx12("div", {
|
|
470
583
|
className: "w-full min-w-0 rounded-md border border-border overflow-hidden",
|
|
471
|
-
children: /* @__PURE__ */
|
|
584
|
+
children: /* @__PURE__ */ jsxs9(Table2, {
|
|
472
585
|
children: [
|
|
473
|
-
props.caption && /* @__PURE__ */
|
|
586
|
+
props.caption && /* @__PURE__ */ jsx12(TableCaption2, {
|
|
474
587
|
children: props.caption
|
|
475
588
|
}),
|
|
476
|
-
/* @__PURE__ */
|
|
477
|
-
children: /* @__PURE__ */
|
|
478
|
-
children: columns.map((col) => /* @__PURE__ */
|
|
589
|
+
/* @__PURE__ */ jsx12(TableHeader2, {
|
|
590
|
+
children: /* @__PURE__ */ jsx12(TableRow2, {
|
|
591
|
+
children: columns.map((col) => /* @__PURE__ */ jsx12(TableHead2, {
|
|
479
592
|
children: col
|
|
480
593
|
}, col))
|
|
481
594
|
})
|
|
482
595
|
}),
|
|
483
|
-
/* @__PURE__ */
|
|
484
|
-
children: rows.map((row, i) => /* @__PURE__ */
|
|
485
|
-
children: row.map((cell, j) => /* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ jsx12(TableBody2, {
|
|
597
|
+
children: rows.map((row, i) => /* @__PURE__ */ jsx12(TableRow2, {
|
|
598
|
+
children: row.map((cell, j) => /* @__PURE__ */ jsx12(TableCell2, {
|
|
486
599
|
children: cell
|
|
487
600
|
}, j))
|
|
488
601
|
}, i))
|
|
@@ -493,59 +606,59 @@ var JsonTable = ({ props }) => {
|
|
|
493
606
|
};
|
|
494
607
|
|
|
495
608
|
// src/components/json-render/JsonHeading.tsx
|
|
496
|
-
import { jsx as
|
|
609
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
497
610
|
var JsonHeading = ({ props }) => {
|
|
498
611
|
const level = props.level ?? "h2";
|
|
499
612
|
const headingClass = level === "h1" ? "text-2xl font-bold" : level === "h3" ? "text-base font-semibold" : level === "h4" ? "text-sm font-semibold" : "text-lg font-semibold";
|
|
500
613
|
if (level === "h1")
|
|
501
|
-
return /* @__PURE__ */
|
|
614
|
+
return /* @__PURE__ */ jsx13("h1", {
|
|
502
615
|
className: `${headingClass} text-left`,
|
|
503
616
|
children: props.text
|
|
504
617
|
});
|
|
505
618
|
if (level === "h3")
|
|
506
|
-
return /* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ jsx13("h3", {
|
|
507
620
|
className: `${headingClass} text-left`,
|
|
508
621
|
children: props.text
|
|
509
622
|
});
|
|
510
623
|
if (level === "h4")
|
|
511
|
-
return /* @__PURE__ */
|
|
624
|
+
return /* @__PURE__ */ jsx13("h4", {
|
|
512
625
|
className: `${headingClass} text-left`,
|
|
513
626
|
children: props.text
|
|
514
627
|
});
|
|
515
|
-
return /* @__PURE__ */
|
|
628
|
+
return /* @__PURE__ */ jsx13("h2", {
|
|
516
629
|
className: `${headingClass} text-left`,
|
|
517
630
|
children: props.text
|
|
518
631
|
});
|
|
519
632
|
};
|
|
520
633
|
|
|
521
634
|
// src/components/json-render/JsonText.tsx
|
|
522
|
-
import { jsx as
|
|
635
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
523
636
|
var JsonText = ({ props }) => {
|
|
524
637
|
const textClass = props.variant === "caption" ? "text-xs" : props.variant === "muted" ? "text-sm text-muted-foreground" : props.variant === "lead" ? "text-xl text-muted-foreground" : props.variant === "code" ? "font-mono text-sm bg-muted px-1.5 py-0.5 rounded" : "text-sm";
|
|
525
638
|
if (props.variant === "code") {
|
|
526
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ jsx14("code", {
|
|
527
640
|
className: `${textClass} text-left`,
|
|
528
641
|
children: props.text
|
|
529
642
|
});
|
|
530
643
|
}
|
|
531
|
-
return /* @__PURE__ */
|
|
644
|
+
return /* @__PURE__ */ jsx14("p", {
|
|
532
645
|
className: `${textClass} text-left`,
|
|
533
646
|
children: props.text
|
|
534
647
|
});
|
|
535
648
|
};
|
|
536
649
|
|
|
537
650
|
// src/components/json-render/JsonImage.tsx
|
|
538
|
-
import { jsx as
|
|
651
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
539
652
|
var JsonImage = ({ props }) => {
|
|
540
653
|
if (props.src) {
|
|
541
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ jsx15(FramedImage2, {
|
|
542
655
|
src: props.src,
|
|
543
656
|
alt: props.alt ?? "",
|
|
544
657
|
width: props.width ?? undefined,
|
|
545
658
|
height: props.height ?? undefined
|
|
546
659
|
});
|
|
547
660
|
}
|
|
548
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
549
662
|
className: "bg-muted border border-border rounded flex items-center justify-center text-xs text-muted-foreground",
|
|
550
663
|
style: { width: props.width ?? 80, height: props.height ?? 60 },
|
|
551
664
|
children: props.alt || "img"
|
|
@@ -553,19 +666,19 @@ var JsonImage = ({ props }) => {
|
|
|
553
666
|
};
|
|
554
667
|
|
|
555
668
|
// src/components/json-render/JsonAvatar.tsx
|
|
556
|
-
import { jsx as
|
|
669
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
557
670
|
var JsonAvatar = ({ props }) => {
|
|
558
671
|
const name = props.name || "?";
|
|
559
672
|
const initials = name.split(" ").map((n) => n[0]).join("").slice(0, 2).toUpperCase();
|
|
560
673
|
const sizeClass = props.size === "lg" ? "h-12 w-12" : props.size === "sm" ? "h-8 w-8" : "h-10 w-10";
|
|
561
|
-
return /* @__PURE__ */
|
|
674
|
+
return /* @__PURE__ */ jsxs10(Avatar2, {
|
|
562
675
|
className: sizeClass,
|
|
563
676
|
children: [
|
|
564
|
-
props.src && /* @__PURE__ */
|
|
677
|
+
props.src && /* @__PURE__ */ jsx16(AvatarImage2, {
|
|
565
678
|
src: props.src,
|
|
566
679
|
alt: name
|
|
567
680
|
}),
|
|
568
|
-
/* @__PURE__ */
|
|
681
|
+
/* @__PURE__ */ jsx16(AvatarFallback2, {
|
|
569
682
|
children: initials
|
|
570
683
|
})
|
|
571
684
|
]
|
|
@@ -573,24 +686,24 @@ var JsonAvatar = ({ props }) => {
|
|
|
573
686
|
};
|
|
574
687
|
|
|
575
688
|
// src/components/json-render/JsonBadge.tsx
|
|
576
|
-
import { jsx as
|
|
689
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
577
690
|
var JsonBadge = ({ props }) => {
|
|
578
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ jsx17(Badge2, {
|
|
579
692
|
variant: props.variant ?? "default",
|
|
580
693
|
children: props.text
|
|
581
694
|
});
|
|
582
695
|
};
|
|
583
696
|
|
|
584
697
|
// src/components/json-render/JsonAlert.tsx
|
|
585
|
-
import { jsx as
|
|
698
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
586
699
|
var JsonAlert = ({ props }) => {
|
|
587
|
-
return /* @__PURE__ */
|
|
700
|
+
return /* @__PURE__ */ jsxs11(Alert2, {
|
|
588
701
|
variant: props.type === "error" ? "destructive" : props.type ?? "default",
|
|
589
702
|
children: [
|
|
590
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ jsx18(AlertTitle2, {
|
|
591
704
|
children: props.title
|
|
592
705
|
}),
|
|
593
|
-
props.message && /* @__PURE__ */
|
|
706
|
+
props.message && /* @__PURE__ */ jsx18(AlertDescription2, {
|
|
594
707
|
children: props.message
|
|
595
708
|
})
|
|
596
709
|
]
|
|
@@ -598,17 +711,17 @@ var JsonAlert = ({ props }) => {
|
|
|
598
711
|
};
|
|
599
712
|
|
|
600
713
|
// src/components/json-render/JsonProgress.tsx
|
|
601
|
-
import { jsx as
|
|
714
|
+
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
602
715
|
var JsonProgress = ({ props }) => {
|
|
603
716
|
const value = Math.min(100, Math.max(0, props.value || 0));
|
|
604
|
-
return /* @__PURE__ */
|
|
717
|
+
return /* @__PURE__ */ jsxs12("div", {
|
|
605
718
|
className: "space-y-2",
|
|
606
719
|
children: [
|
|
607
|
-
props.label && /* @__PURE__ */
|
|
720
|
+
props.label && /* @__PURE__ */ jsx19(Label2, {
|
|
608
721
|
className: "text-sm text-muted-foreground",
|
|
609
722
|
children: props.label
|
|
610
723
|
}),
|
|
611
|
-
/* @__PURE__ */
|
|
724
|
+
/* @__PURE__ */ jsx19(Progress2, {
|
|
612
725
|
value
|
|
613
726
|
})
|
|
614
727
|
]
|
|
@@ -616,9 +729,9 @@ var JsonProgress = ({ props }) => {
|
|
|
616
729
|
};
|
|
617
730
|
|
|
618
731
|
// src/components/json-render/JsonSkeleton.tsx
|
|
619
|
-
import { jsx as
|
|
732
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
620
733
|
var JsonSkeleton = ({ props }) => {
|
|
621
|
-
return /* @__PURE__ */
|
|
734
|
+
return /* @__PURE__ */ jsx20(Skeleton2, {
|
|
622
735
|
className: props.rounded ? "rounded-full" : "rounded-md",
|
|
623
736
|
style: {
|
|
624
737
|
width: props.width ?? "100%",
|
|
@@ -628,28 +741,28 @@ var JsonSkeleton = ({ props }) => {
|
|
|
628
741
|
};
|
|
629
742
|
|
|
630
743
|
// src/components/json-render/JsonSpinner.tsx
|
|
631
|
-
import { jsx as
|
|
744
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
632
745
|
var JsonSpinner = ({ props }) => {
|
|
633
|
-
return /* @__PURE__ */
|
|
746
|
+
return /* @__PURE__ */ jsx21(Spinner2, {
|
|
634
747
|
"aria-label": props.label ?? "Loading",
|
|
635
748
|
className: props.size === "lg" ? "size-8" : props.size === "sm" ? "size-4" : "size-6"
|
|
636
749
|
});
|
|
637
750
|
};
|
|
638
751
|
|
|
639
752
|
// src/components/json-render/JsonTooltip.tsx
|
|
640
|
-
import { jsx as
|
|
753
|
+
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
641
754
|
var JsonTooltip = ({ props }) => {
|
|
642
|
-
return /* @__PURE__ */
|
|
643
|
-
children: /* @__PURE__ */
|
|
755
|
+
return /* @__PURE__ */ jsx22(TooltipProvider2, {
|
|
756
|
+
children: /* @__PURE__ */ jsxs13(Tooltip2, {
|
|
644
757
|
children: [
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
render: /* @__PURE__ */
|
|
758
|
+
/* @__PURE__ */ jsx22(TooltipTrigger2, {
|
|
759
|
+
render: /* @__PURE__ */ jsx22(Button2, {
|
|
647
760
|
variant: "link"
|
|
648
761
|
}),
|
|
649
762
|
children: props.text
|
|
650
763
|
}),
|
|
651
|
-
/* @__PURE__ */
|
|
652
|
-
children: /* @__PURE__ */
|
|
764
|
+
/* @__PURE__ */ jsx22(TooltipContent2, {
|
|
765
|
+
children: /* @__PURE__ */ jsx22("p", {
|
|
653
766
|
children: props.content
|
|
654
767
|
})
|
|
655
768
|
})
|
|
@@ -659,19 +772,19 @@ var JsonTooltip = ({ props }) => {
|
|
|
659
772
|
};
|
|
660
773
|
|
|
661
774
|
// src/components/json-render/JsonPopover.tsx
|
|
662
|
-
import { jsx as
|
|
775
|
+
import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
663
776
|
var JsonPopover = ({ props }) => {
|
|
664
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ jsxs14(Popover2, {
|
|
665
778
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
render: /* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ jsx23(PopoverTrigger2, {
|
|
780
|
+
render: /* @__PURE__ */ jsx23(Button2, {
|
|
668
781
|
variant: "outline"
|
|
669
782
|
}),
|
|
670
783
|
children: props.trigger
|
|
671
784
|
}),
|
|
672
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ jsx23(PopoverContent2, {
|
|
673
786
|
className: "w-64",
|
|
674
|
-
children: /* @__PURE__ */
|
|
787
|
+
children: /* @__PURE__ */ jsx23("p", {
|
|
675
788
|
className: "text-sm",
|
|
676
789
|
children: props.content
|
|
677
790
|
})
|
|
@@ -681,33 +794,42 @@ var JsonPopover = ({ props }) => {
|
|
|
681
794
|
};
|
|
682
795
|
|
|
683
796
|
// src/components/json-render/JsonInput.tsx
|
|
684
|
-
import { useId, useState as useState3 } from "react";
|
|
797
|
+
import { useId as useId2, useState as useState3 } from "react";
|
|
685
798
|
import { useBoundProp as useBoundProp2 } from "@json-render/react";
|
|
686
799
|
import { useFieldValidation } from "@json-render/react";
|
|
687
|
-
import { jsx as
|
|
800
|
+
import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
688
801
|
var JsonInput = ({ props, bindings, emit }) => {
|
|
689
|
-
const id =
|
|
802
|
+
const id = useId2();
|
|
803
|
+
const form = useJsonForm();
|
|
690
804
|
const [boundValue, setBoundValue] = useBoundProp2(props.value ?? undefined, bindings?.value);
|
|
691
805
|
const [localValue, setLocalValue] = useState3(props.value ?? "");
|
|
692
806
|
const isBound = !!bindings?.value;
|
|
693
807
|
const value = isBound ? boundValue ?? "" : localValue;
|
|
694
808
|
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
695
809
|
const validateOn = props.validateOn ?? "blur";
|
|
696
|
-
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
810
|
+
const hasValidation = !!(bindings?.value && props.checks?.length) && !form;
|
|
697
811
|
const { errors, validate } = useFieldValidation(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
|
|
698
|
-
|
|
812
|
+
const field = useJsonField({ path: bindings?.value, label: props.label, checks: props.checks, ownErrors: errors });
|
|
813
|
+
if (field.mode === "values")
|
|
814
|
+
return /* @__PURE__ */ jsx24(JsonFieldValue, {
|
|
815
|
+
field,
|
|
816
|
+
text: value
|
|
817
|
+
});
|
|
818
|
+
return /* @__PURE__ */ jsxs15("div", {
|
|
699
819
|
className: "w-full space-y-2",
|
|
700
820
|
children: [
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
821
|
+
/* @__PURE__ */ jsx24(JsonFieldLabel, {
|
|
822
|
+
field,
|
|
823
|
+
htmlFor: id
|
|
704
824
|
}),
|
|
705
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ jsx24(Input2, {
|
|
706
826
|
id,
|
|
707
827
|
name: props.name ?? undefined,
|
|
708
828
|
type: props.type ?? "text",
|
|
709
829
|
placeholder: props.placeholder ?? "",
|
|
710
830
|
value,
|
|
831
|
+
disabled: field.mode === "locked",
|
|
832
|
+
...field.controlProps,
|
|
711
833
|
onChange: (e) => {
|
|
712
834
|
setValue(e.target.value);
|
|
713
835
|
if (hasValidation && validateOn === "change")
|
|
@@ -724,42 +846,50 @@ var JsonInput = ({ props, bindings, emit }) => {
|
|
|
724
846
|
emit("blur");
|
|
725
847
|
}
|
|
726
848
|
}),
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
children: errors[0]
|
|
849
|
+
/* @__PURE__ */ jsx24(JsonFieldMessage, {
|
|
850
|
+
field
|
|
730
851
|
})
|
|
731
852
|
]
|
|
732
853
|
});
|
|
733
854
|
};
|
|
734
855
|
|
|
735
856
|
// src/components/json-render/JsonTextarea.tsx
|
|
736
|
-
import { useId as
|
|
857
|
+
import { useId as useId3, useState as useState4 } from "react";
|
|
737
858
|
import { useBoundProp as useBoundProp3 } from "@json-render/react";
|
|
738
859
|
import { useFieldValidation as useFieldValidation2 } from "@json-render/react";
|
|
739
|
-
import { jsx as
|
|
860
|
+
import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
740
861
|
var JsonTextarea = ({ props, bindings }) => {
|
|
741
|
-
const id =
|
|
862
|
+
const id = useId3();
|
|
863
|
+
const form = useJsonForm();
|
|
742
864
|
const [boundValue, setBoundValue] = useBoundProp3(props.value ?? undefined, bindings?.value);
|
|
743
865
|
const [localValue, setLocalValue] = useState4(props.value ?? "");
|
|
744
866
|
const isBound = !!bindings?.value;
|
|
745
867
|
const value = isBound ? boundValue ?? "" : localValue;
|
|
746
868
|
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
747
869
|
const validateOn = props.validateOn ?? "blur";
|
|
748
|
-
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
870
|
+
const hasValidation = !!(bindings?.value && props.checks?.length) && !form;
|
|
749
871
|
const { errors, validate } = useFieldValidation2(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
|
|
750
|
-
|
|
872
|
+
const field = useJsonField({ path: bindings?.value, label: props.label, checks: props.checks, ownErrors: errors });
|
|
873
|
+
if (field.mode === "values")
|
|
874
|
+
return /* @__PURE__ */ jsx25(JsonFieldValue, {
|
|
875
|
+
field,
|
|
876
|
+
text: value
|
|
877
|
+
});
|
|
878
|
+
return /* @__PURE__ */ jsxs16("div", {
|
|
751
879
|
className: "w-full space-y-2",
|
|
752
880
|
children: [
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
881
|
+
/* @__PURE__ */ jsx25(JsonFieldLabel, {
|
|
882
|
+
field,
|
|
883
|
+
htmlFor: id
|
|
756
884
|
}),
|
|
757
|
-
/* @__PURE__ */
|
|
885
|
+
/* @__PURE__ */ jsx25(Textarea2, {
|
|
758
886
|
id,
|
|
759
887
|
name: props.name ?? undefined,
|
|
760
888
|
placeholder: props.placeholder ?? "",
|
|
761
889
|
rows: props.rows ?? 3,
|
|
762
890
|
value,
|
|
891
|
+
disabled: field.mode === "locked",
|
|
892
|
+
...field.controlProps,
|
|
763
893
|
onChange: (e) => {
|
|
764
894
|
setValue(e.target.value);
|
|
765
895
|
if (hasValidation && validateOn === "change")
|
|
@@ -770,21 +900,21 @@ var JsonTextarea = ({ props, bindings }) => {
|
|
|
770
900
|
validate();
|
|
771
901
|
}
|
|
772
902
|
}),
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
children: errors[0]
|
|
903
|
+
/* @__PURE__ */ jsx25(JsonFieldMessage, {
|
|
904
|
+
field
|
|
776
905
|
})
|
|
777
906
|
]
|
|
778
907
|
});
|
|
779
908
|
};
|
|
780
909
|
|
|
781
910
|
// src/components/json-render/JsonSelect.tsx
|
|
782
|
-
import { useId as
|
|
911
|
+
import { useId as useId4, useState as useState5 } from "react";
|
|
783
912
|
import { useBoundProp as useBoundProp4 } from "@json-render/react";
|
|
784
913
|
import { useFieldValidation as useFieldValidation3 } from "@json-render/react";
|
|
785
|
-
import { jsx as
|
|
914
|
+
import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
786
915
|
var JsonSelect = ({ props, bindings, emit }) => {
|
|
787
|
-
const id =
|
|
916
|
+
const id = useId4();
|
|
917
|
+
const form = useJsonForm();
|
|
788
918
|
const [boundValue, setBoundValue] = useBoundProp4(props.value ?? undefined, bindings?.value);
|
|
789
919
|
const [localValue, setLocalValue] = useState5(props.value ?? "");
|
|
790
920
|
const isBound = !!bindings?.value;
|
|
@@ -793,17 +923,24 @@ var JsonSelect = ({ props, bindings, emit }) => {
|
|
|
793
923
|
const rawOptions = props.options ?? [];
|
|
794
924
|
const options = rawOptions.map((opt) => typeof opt === "string" ? opt : String(opt ?? ""));
|
|
795
925
|
const validateOn = props.validateOn ?? "change";
|
|
796
|
-
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
926
|
+
const hasValidation = !!(bindings?.value && props.checks?.length) && !form;
|
|
797
927
|
const { errors, validate } = useFieldValidation3(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
|
|
798
|
-
|
|
928
|
+
const field = useJsonField({ path: bindings?.value, label: props.label, checks: props.checks, ownErrors: errors });
|
|
929
|
+
if (field.mode === "values")
|
|
930
|
+
return /* @__PURE__ */ jsx26(JsonFieldValue, {
|
|
931
|
+
field,
|
|
932
|
+
text: value
|
|
933
|
+
});
|
|
934
|
+
return /* @__PURE__ */ jsxs17("div", {
|
|
799
935
|
className: "space-y-2",
|
|
800
936
|
children: [
|
|
801
|
-
/* @__PURE__ */
|
|
802
|
-
|
|
803
|
-
|
|
937
|
+
/* @__PURE__ */ jsx26(JsonFieldLabel, {
|
|
938
|
+
field,
|
|
939
|
+
htmlFor: id
|
|
804
940
|
}),
|
|
805
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ jsxs17(Select2, {
|
|
806
942
|
value,
|
|
943
|
+
disabled: field.mode === "locked",
|
|
807
944
|
onValueChange: (v) => {
|
|
808
945
|
setValue(v ?? "");
|
|
809
946
|
if (hasValidation && validateOn === "change")
|
|
@@ -811,53 +948,62 @@ var JsonSelect = ({ props, bindings, emit }) => {
|
|
|
811
948
|
emit("change");
|
|
812
949
|
},
|
|
813
950
|
children: [
|
|
814
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ jsx26(SelectTrigger2, {
|
|
815
952
|
id,
|
|
816
953
|
className: "w-full",
|
|
817
|
-
|
|
954
|
+
...field.controlProps,
|
|
955
|
+
children: /* @__PURE__ */ jsx26(SelectValue2, {
|
|
818
956
|
placeholder: props.placeholder ?? "Select..."
|
|
819
957
|
})
|
|
820
958
|
}),
|
|
821
|
-
/* @__PURE__ */
|
|
822
|
-
children: options.map((opt, idx) => /* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ jsx26(SelectContent2, {
|
|
960
|
+
children: options.map((opt, idx) => /* @__PURE__ */ jsx26(SelectItem2, {
|
|
823
961
|
value: opt || `option-${idx}`,
|
|
824
962
|
children: opt
|
|
825
963
|
}, `${idx}-${opt}`))
|
|
826
964
|
})
|
|
827
965
|
]
|
|
828
966
|
}),
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
children: errors[0]
|
|
967
|
+
/* @__PURE__ */ jsx26(JsonFieldMessage, {
|
|
968
|
+
field
|
|
832
969
|
})
|
|
833
970
|
]
|
|
834
971
|
});
|
|
835
972
|
};
|
|
836
973
|
|
|
837
974
|
// src/components/json-render/JsonCheckbox.tsx
|
|
838
|
-
import { useId as
|
|
975
|
+
import { useId as useId5, useState as useState6 } from "react";
|
|
839
976
|
import { useBoundProp as useBoundProp5 } from "@json-render/react";
|
|
840
977
|
import { useFieldValidation as useFieldValidation4 } from "@json-render/react";
|
|
841
|
-
import { jsx as
|
|
978
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
842
979
|
var JsonCheckbox = ({ props, bindings, emit }) => {
|
|
843
|
-
const id =
|
|
980
|
+
const id = useId5();
|
|
981
|
+
const form = useJsonForm();
|
|
844
982
|
const [boundChecked, setBoundChecked] = useBoundProp5(props.checked ?? undefined, bindings?.checked);
|
|
845
983
|
const [localChecked, setLocalChecked] = useState6(!!props.checked);
|
|
846
984
|
const isBound = !!bindings?.checked;
|
|
847
985
|
const checked = isBound ? boundChecked ?? false : localChecked;
|
|
848
986
|
const setChecked = isBound ? setBoundChecked : setLocalChecked;
|
|
849
987
|
const validateOn = props.validateOn ?? "change";
|
|
850
|
-
const hasValidation = !!(bindings?.checked && props.checks?.length);
|
|
988
|
+
const hasValidation = !!(bindings?.checked && props.checks?.length) && !form;
|
|
851
989
|
const { errors, validate } = useFieldValidation4(bindings?.checked ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
|
|
852
|
-
|
|
990
|
+
const field = useJsonField({ path: bindings?.checked, label: props.label, checks: props.checks, ownErrors: errors });
|
|
991
|
+
if (field.mode === "values")
|
|
992
|
+
return /* @__PURE__ */ jsx27(JsonFieldValue, {
|
|
993
|
+
field,
|
|
994
|
+
text: checked ? "Yes" : "No"
|
|
995
|
+
});
|
|
996
|
+
return /* @__PURE__ */ jsxs18("div", {
|
|
853
997
|
className: "space-y-1",
|
|
854
998
|
children: [
|
|
855
|
-
/* @__PURE__ */
|
|
999
|
+
/* @__PURE__ */ jsxs18(Field2, {
|
|
856
1000
|
orientation: "horizontal",
|
|
857
1001
|
children: [
|
|
858
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ jsx27(Checkbox2, {
|
|
859
1003
|
id,
|
|
860
1004
|
checked,
|
|
1005
|
+
disabled: field.mode === "locked",
|
|
1006
|
+
...field.controlProps,
|
|
861
1007
|
onCheckedChange: (c) => {
|
|
862
1008
|
setChecked(c === true);
|
|
863
1009
|
if (hasValidation && validateOn === "change")
|
|
@@ -865,27 +1011,31 @@ var JsonCheckbox = ({ props, bindings, emit }) => {
|
|
|
865
1011
|
emit("change");
|
|
866
1012
|
}
|
|
867
1013
|
}),
|
|
868
|
-
/* @__PURE__ */
|
|
1014
|
+
/* @__PURE__ */ jsx27(FieldLabel2, {
|
|
869
1015
|
htmlFor: id,
|
|
870
|
-
children:
|
|
1016
|
+
children: field.label
|
|
1017
|
+
}),
|
|
1018
|
+
field.isRequired && /* @__PURE__ */ jsx27(Badge2, {
|
|
1019
|
+
variant: "outline",
|
|
1020
|
+
children: "Required"
|
|
871
1021
|
})
|
|
872
1022
|
]
|
|
873
1023
|
}),
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
children: errors[0]
|
|
1024
|
+
/* @__PURE__ */ jsx27(JsonFieldMessage, {
|
|
1025
|
+
field
|
|
877
1026
|
})
|
|
878
1027
|
]
|
|
879
1028
|
});
|
|
880
1029
|
};
|
|
881
1030
|
|
|
882
1031
|
// src/components/json-render/JsonRadio.tsx
|
|
883
|
-
import { useId as
|
|
1032
|
+
import { useId as useId6, useState as useState7 } from "react";
|
|
884
1033
|
import { useBoundProp as useBoundProp6 } from "@json-render/react";
|
|
885
1034
|
import { useFieldValidation as useFieldValidation5 } from "@json-render/react";
|
|
886
|
-
import { jsx as
|
|
1035
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
887
1036
|
var JsonRadio = ({ props, bindings, emit }) => {
|
|
888
|
-
const id =
|
|
1037
|
+
const id = useId6();
|
|
1038
|
+
const form = useJsonForm();
|
|
889
1039
|
const rawOptions = props.options ?? [];
|
|
890
1040
|
const options = rawOptions.map((opt) => typeof opt === "string" ? opt : String(opt ?? ""));
|
|
891
1041
|
const [boundValue, setBoundValue] = useBoundProp6(props.value ?? undefined, bindings?.value);
|
|
@@ -894,74 +1044,95 @@ var JsonRadio = ({ props, bindings, emit }) => {
|
|
|
894
1044
|
const value = isBound ? boundValue ?? "" : localValue;
|
|
895
1045
|
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
896
1046
|
const validateOn = props.validateOn ?? "change";
|
|
897
|
-
const hasValidation = !!(bindings?.value && props.checks?.length);
|
|
1047
|
+
const hasValidation = !!(bindings?.value && props.checks?.length) && !form;
|
|
898
1048
|
const { errors, validate } = useFieldValidation5(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
|
|
899
|
-
|
|
1049
|
+
const field = useJsonField({ path: bindings?.value, label: props.label, checks: props.checks, ownErrors: errors });
|
|
1050
|
+
if (field.mode === "values")
|
|
1051
|
+
return /* @__PURE__ */ jsx28(JsonFieldValue, {
|
|
1052
|
+
field,
|
|
1053
|
+
text: value
|
|
1054
|
+
});
|
|
1055
|
+
return /* @__PURE__ */ jsxs19("div", {
|
|
900
1056
|
className: "space-y-2",
|
|
901
1057
|
children: [
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1058
|
+
/* @__PURE__ */ jsx28(JsonFieldLabel, {
|
|
1059
|
+
field,
|
|
1060
|
+
id
|
|
905
1061
|
}),
|
|
906
|
-
/* @__PURE__ */
|
|
907
|
-
"aria-labelledby":
|
|
1062
|
+
/* @__PURE__ */ jsx28(RadioGroup2, {
|
|
1063
|
+
"aria-labelledby": field.label ? id : undefined,
|
|
1064
|
+
tabIndex: -1,
|
|
908
1065
|
value,
|
|
1066
|
+
disabled: field.mode === "locked",
|
|
1067
|
+
...field.controlProps,
|
|
909
1068
|
onValueChange: (v) => {
|
|
910
1069
|
setValue(v);
|
|
911
1070
|
if (hasValidation && validateOn === "change")
|
|
912
1071
|
validate();
|
|
913
1072
|
emit("change");
|
|
914
1073
|
},
|
|
915
|
-
children: options.map((opt, idx) => /* @__PURE__ */
|
|
1074
|
+
children: options.map((opt, idx) => /* @__PURE__ */ jsxs19(Field2, {
|
|
916
1075
|
orientation: "horizontal",
|
|
917
1076
|
children: [
|
|
918
|
-
/* @__PURE__ */
|
|
1077
|
+
/* @__PURE__ */ jsx28(RadioGroupItem2, {
|
|
919
1078
|
value: opt || `option-${idx}`,
|
|
920
1079
|
id: `${id}-${idx}`
|
|
921
1080
|
}),
|
|
922
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ jsx28(FieldLabel2, {
|
|
923
1082
|
htmlFor: `${id}-${idx}`,
|
|
924
1083
|
children: opt
|
|
925
1084
|
})
|
|
926
1085
|
]
|
|
927
1086
|
}, `${idx}-${opt}`))
|
|
928
1087
|
}),
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
children: errors[0]
|
|
1088
|
+
/* @__PURE__ */ jsx28(JsonFieldMessage, {
|
|
1089
|
+
field
|
|
932
1090
|
})
|
|
933
1091
|
]
|
|
934
1092
|
});
|
|
935
1093
|
};
|
|
936
1094
|
|
|
937
1095
|
// src/components/json-render/JsonSwitch.tsx
|
|
938
|
-
import { useId as
|
|
1096
|
+
import { useId as useId7, useState as useState8 } from "react";
|
|
939
1097
|
import { useBoundProp as useBoundProp7 } from "@json-render/react";
|
|
940
1098
|
import { useFieldValidation as useFieldValidation6 } from "@json-render/react";
|
|
941
|
-
import { jsx as
|
|
1099
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
942
1100
|
var JsonSwitch = ({ props, bindings, emit }) => {
|
|
943
|
-
const id =
|
|
1101
|
+
const id = useId7();
|
|
1102
|
+
const form = useJsonForm();
|
|
944
1103
|
const [boundChecked, setBoundChecked] = useBoundProp7(props.checked ?? undefined, bindings?.checked);
|
|
945
1104
|
const [localChecked, setLocalChecked] = useState8(!!props.checked);
|
|
946
1105
|
const isBound = !!bindings?.checked;
|
|
947
1106
|
const checked = isBound ? boundChecked ?? false : localChecked;
|
|
948
1107
|
const setChecked = isBound ? setBoundChecked : setLocalChecked;
|
|
949
1108
|
const validateOn = props.validateOn ?? "change";
|
|
950
|
-
const hasValidation = !!(bindings?.checked && props.checks?.length);
|
|
1109
|
+
const hasValidation = !!(bindings?.checked && props.checks?.length) && !form;
|
|
951
1110
|
const { errors, validate } = useFieldValidation6(bindings?.checked ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
|
|
952
|
-
|
|
1111
|
+
const field = useJsonField({ path: bindings?.checked, label: props.label, checks: props.checks, ownErrors: errors });
|
|
1112
|
+
if (field.mode === "values")
|
|
1113
|
+
return /* @__PURE__ */ jsx29(JsonFieldValue, {
|
|
1114
|
+
field,
|
|
1115
|
+
text: checked ? "On" : "Off"
|
|
1116
|
+
});
|
|
1117
|
+
return /* @__PURE__ */ jsxs20("div", {
|
|
953
1118
|
className: "space-y-1",
|
|
954
1119
|
children: [
|
|
955
|
-
/* @__PURE__ */
|
|
1120
|
+
/* @__PURE__ */ jsxs20(Field2, {
|
|
956
1121
|
orientation: "horizontal",
|
|
957
1122
|
children: [
|
|
958
|
-
/* @__PURE__ */
|
|
1123
|
+
/* @__PURE__ */ jsx29(FieldLabel2, {
|
|
959
1124
|
htmlFor: id,
|
|
960
|
-
children:
|
|
1125
|
+
children: field.label
|
|
961
1126
|
}),
|
|
962
|
-
/* @__PURE__ */
|
|
1127
|
+
field.isRequired && /* @__PURE__ */ jsx29(Badge2, {
|
|
1128
|
+
variant: "outline",
|
|
1129
|
+
children: "Required"
|
|
1130
|
+
}),
|
|
1131
|
+
/* @__PURE__ */ jsx29(Switch2, {
|
|
963
1132
|
id,
|
|
964
1133
|
checked,
|
|
1134
|
+
disabled: field.mode === "locked",
|
|
1135
|
+
...field.controlProps,
|
|
965
1136
|
onCheckedChange: (c) => {
|
|
966
1137
|
setChecked(c);
|
|
967
1138
|
if (hasValidation && validateOn === "change")
|
|
@@ -971,48 +1142,54 @@ var JsonSwitch = ({ props, bindings, emit }) => {
|
|
|
971
1142
|
})
|
|
972
1143
|
]
|
|
973
1144
|
}),
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
children: errors[0]
|
|
1145
|
+
/* @__PURE__ */ jsx29(JsonFieldMessage, {
|
|
1146
|
+
field
|
|
977
1147
|
})
|
|
978
1148
|
]
|
|
979
1149
|
});
|
|
980
1150
|
};
|
|
981
1151
|
|
|
982
1152
|
// src/components/json-render/JsonSlider.tsx
|
|
983
|
-
import { useId as
|
|
1153
|
+
import { useId as useId8, useState as useState9 } from "react";
|
|
984
1154
|
import { useBoundProp as useBoundProp8 } from "@json-render/react";
|
|
985
|
-
import { jsx as
|
|
1155
|
+
import { jsx as jsx30, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
986
1156
|
var JsonSlider = ({ props, bindings, emit }) => {
|
|
987
|
-
const id =
|
|
1157
|
+
const id = useId8();
|
|
988
1158
|
const [boundValue, setBoundValue] = useBoundProp8(props.value ?? undefined, bindings?.value);
|
|
989
1159
|
const [localValue, setLocalValue] = useState9(props.value ?? props.min ?? 0);
|
|
990
1160
|
const isBound = !!bindings?.value;
|
|
991
1161
|
const value = isBound ? boundValue ?? props.min ?? 0 : localValue;
|
|
992
1162
|
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
993
|
-
|
|
1163
|
+
const field = useJsonField({ path: bindings?.value, label: props.label });
|
|
1164
|
+
if (field.mode === "values")
|
|
1165
|
+
return /* @__PURE__ */ jsx30(JsonFieldValue, {
|
|
1166
|
+
field,
|
|
1167
|
+
text: String(value)
|
|
1168
|
+
});
|
|
1169
|
+
return /* @__PURE__ */ jsxs21("div", {
|
|
994
1170
|
className: "space-y-2",
|
|
995
1171
|
children: [
|
|
996
|
-
|
|
1172
|
+
field.label && /* @__PURE__ */ jsxs21("div", {
|
|
997
1173
|
className: "flex justify-between",
|
|
998
1174
|
children: [
|
|
999
|
-
/* @__PURE__ */
|
|
1175
|
+
/* @__PURE__ */ jsx30(Label2, {
|
|
1000
1176
|
id,
|
|
1001
1177
|
className: "text-sm",
|
|
1002
|
-
children:
|
|
1178
|
+
children: field.label
|
|
1003
1179
|
}),
|
|
1004
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ jsx30("span", {
|
|
1005
1181
|
className: "text-sm text-muted-foreground",
|
|
1006
1182
|
children: value
|
|
1007
1183
|
})
|
|
1008
1184
|
]
|
|
1009
1185
|
}),
|
|
1010
|
-
/* @__PURE__ */
|
|
1011
|
-
getAriaLabel: () =>
|
|
1186
|
+
/* @__PURE__ */ jsx30(Slider2, {
|
|
1187
|
+
getAriaLabel: () => field.label || "Value",
|
|
1012
1188
|
value: [value],
|
|
1013
1189
|
min: props.min ?? 0,
|
|
1014
1190
|
max: props.max ?? 100,
|
|
1015
1191
|
step: props.step ?? 1,
|
|
1192
|
+
disabled: field.mode === "locked",
|
|
1016
1193
|
onValueChange: (v) => {
|
|
1017
1194
|
setValue(v[0] ?? 0);
|
|
1018
1195
|
emit("change");
|
|
@@ -1023,10 +1200,10 @@ var JsonSlider = ({ props, bindings, emit }) => {
|
|
|
1023
1200
|
};
|
|
1024
1201
|
|
|
1025
1202
|
// src/components/json-render/JsonButton.tsx
|
|
1026
|
-
import { jsx as
|
|
1203
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1027
1204
|
var JsonButton = ({ props, emit }) => {
|
|
1028
1205
|
const variant = props.variant === "danger" ? "destructive" : props.variant === "secondary" ? "secondary" : "default";
|
|
1029
|
-
return /* @__PURE__ */
|
|
1206
|
+
return /* @__PURE__ */ jsx31(Button2, {
|
|
1030
1207
|
variant,
|
|
1031
1208
|
disabled: props.disabled ?? false,
|
|
1032
1209
|
onClick: () => emit("press"),
|
|
@@ -1035,9 +1212,9 @@ var JsonButton = ({ props, emit }) => {
|
|
|
1035
1212
|
};
|
|
1036
1213
|
|
|
1037
1214
|
// src/components/json-render/JsonLink.tsx
|
|
1038
|
-
import { jsx as
|
|
1215
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1039
1216
|
var JsonLink = ({ props, on }) => {
|
|
1040
|
-
return /* @__PURE__ */
|
|
1217
|
+
return /* @__PURE__ */ jsx32(ButtonLink2, {
|
|
1041
1218
|
variant: "link",
|
|
1042
1219
|
size: "inline",
|
|
1043
1220
|
href: props.href ?? "#",
|
|
@@ -1052,27 +1229,75 @@ var JsonLink = ({ props, on }) => {
|
|
|
1052
1229
|
};
|
|
1053
1230
|
|
|
1054
1231
|
// src/components/json-render/JsonDropdownMenu.tsx
|
|
1232
|
+
import { useId as useId9 } from "react";
|
|
1055
1233
|
import { useBoundProp as useBoundProp9 } from "@json-render/react";
|
|
1056
|
-
import { jsx as
|
|
1234
|
+
import { jsx as jsx33, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1057
1235
|
var JsonDropdownMenu = ({ props, bindings, emit }) => {
|
|
1236
|
+
const labelId = useId9();
|
|
1058
1237
|
const items = props.items ?? [];
|
|
1059
|
-
const [, setBoundValue] = useBoundProp9(props.value ?? undefined, bindings?.value);
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1238
|
+
const [boundValue, setBoundValue] = useBoundProp9(props.value ?? undefined, bindings?.value);
|
|
1239
|
+
const field = useJsonField({ path: bindings?.value, label: props.label });
|
|
1240
|
+
if (!bindings?.value)
|
|
1241
|
+
return /* @__PURE__ */ jsxs22(DropdownMenu2, {
|
|
1242
|
+
children: [
|
|
1243
|
+
/* @__PURE__ */ jsx33(DropdownMenuTrigger2, {
|
|
1244
|
+
render: /* @__PURE__ */ jsx33(Button2, {
|
|
1245
|
+
variant: "outline"
|
|
1246
|
+
}),
|
|
1247
|
+
children: props.label
|
|
1065
1248
|
}),
|
|
1066
|
-
|
|
1249
|
+
/* @__PURE__ */ jsx33(MenuPopup, {
|
|
1250
|
+
children: items.map((item) => /* @__PURE__ */ jsx33(MenuItem2, {
|
|
1251
|
+
onClick: () => {
|
|
1252
|
+
setBoundValue(item.value);
|
|
1253
|
+
emit("select");
|
|
1254
|
+
},
|
|
1255
|
+
children: item.label
|
|
1256
|
+
}, item.value))
|
|
1257
|
+
})
|
|
1258
|
+
]
|
|
1259
|
+
});
|
|
1260
|
+
const chosen = items.find((item) => item.value === boundValue);
|
|
1261
|
+
if (field.mode === "values")
|
|
1262
|
+
return /* @__PURE__ */ jsx33(JsonFieldValue, {
|
|
1263
|
+
field,
|
|
1264
|
+
text: chosen?.label ?? ""
|
|
1265
|
+
});
|
|
1266
|
+
return /* @__PURE__ */ jsxs22("div", {
|
|
1267
|
+
className: "space-y-2",
|
|
1268
|
+
children: [
|
|
1269
|
+
/* @__PURE__ */ jsx33(JsonFieldLabel, {
|
|
1270
|
+
field,
|
|
1271
|
+
id: labelId
|
|
1067
1272
|
}),
|
|
1068
|
-
/* @__PURE__ */
|
|
1069
|
-
children:
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1273
|
+
/* @__PURE__ */ jsxs22(DropdownMenu2, {
|
|
1274
|
+
children: [
|
|
1275
|
+
/* @__PURE__ */ jsx33(DropdownMenuTrigger2, {
|
|
1276
|
+
render: /* @__PURE__ */ jsx33(Button2, {
|
|
1277
|
+
variant: "outline"
|
|
1278
|
+
}),
|
|
1279
|
+
disabled: field.mode === "locked",
|
|
1280
|
+
"aria-labelledby": field.label ? `${labelId} ${labelId}-value` : undefined,
|
|
1281
|
+
children: /* @__PURE__ */ jsx33("span", {
|
|
1282
|
+
id: `${labelId}-value`,
|
|
1283
|
+
children: chosen?.label ?? "Choose…"
|
|
1284
|
+
})
|
|
1285
|
+
}),
|
|
1286
|
+
/* @__PURE__ */ jsx33(MenuPopup, {
|
|
1287
|
+
children: /* @__PURE__ */ jsx33(MenuRadioGroup2, {
|
|
1288
|
+
value: chosen?.value ?? "",
|
|
1289
|
+
onValueChange: (value) => {
|
|
1290
|
+
setBoundValue(value);
|
|
1291
|
+
emit("select");
|
|
1292
|
+
},
|
|
1293
|
+
children: items.map((item) => /* @__PURE__ */ jsx33(MenuRadioItem2, {
|
|
1294
|
+
value: item.value,
|
|
1295
|
+
closeOnClick: true,
|
|
1296
|
+
children: item.label
|
|
1297
|
+
}, item.value))
|
|
1298
|
+
})
|
|
1299
|
+
})
|
|
1300
|
+
]
|
|
1076
1301
|
})
|
|
1077
1302
|
]
|
|
1078
1303
|
});
|
|
@@ -1081,16 +1306,24 @@ var JsonDropdownMenu = ({ props, bindings, emit }) => {
|
|
|
1081
1306
|
// src/components/json-render/JsonToggle.tsx
|
|
1082
1307
|
import { useState as useState10 } from "react";
|
|
1083
1308
|
import { useBoundProp as useBoundProp10 } from "@json-render/react";
|
|
1084
|
-
import { jsx as
|
|
1309
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1085
1310
|
var JsonToggle = ({ props, bindings, emit }) => {
|
|
1086
1311
|
const [boundPressed, setBoundPressed] = useBoundProp10(props.pressed ?? undefined, bindings?.pressed);
|
|
1087
1312
|
const [localPressed, setLocalPressed] = useState10(props.pressed ?? false);
|
|
1088
1313
|
const isBound = !!bindings?.pressed;
|
|
1089
1314
|
const pressed = isBound ? boundPressed ?? false : localPressed;
|
|
1090
1315
|
const setPressed = isBound ? setBoundPressed : setLocalPressed;
|
|
1091
|
-
|
|
1316
|
+
const field = useJsonField({ path: bindings?.pressed, label: props.label });
|
|
1317
|
+
const mode = isBound ? field.mode : "edit";
|
|
1318
|
+
if (mode === "values")
|
|
1319
|
+
return /* @__PURE__ */ jsx34(JsonFieldValue, {
|
|
1320
|
+
field,
|
|
1321
|
+
text: pressed ? "On" : "Off"
|
|
1322
|
+
});
|
|
1323
|
+
return /* @__PURE__ */ jsx34(Toggle2, {
|
|
1092
1324
|
variant: props.variant ?? "default",
|
|
1093
1325
|
pressed,
|
|
1326
|
+
disabled: mode === "locked",
|
|
1094
1327
|
onPressedChange: (v) => {
|
|
1095
1328
|
setPressed(v);
|
|
1096
1329
|
emit("change");
|
|
@@ -1102,7 +1335,7 @@ var JsonToggle = ({ props, bindings, emit }) => {
|
|
|
1102
1335
|
// src/components/json-render/JsonToggleGroup.tsx
|
|
1103
1336
|
import { useState as useState11 } from "react";
|
|
1104
1337
|
import { useBoundProp as useBoundProp11 } from "@json-render/react";
|
|
1105
|
-
import { jsx as
|
|
1338
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1106
1339
|
var JsonToggleGroup = ({ props, bindings, emit }) => {
|
|
1107
1340
|
const type = props.type ?? "single";
|
|
1108
1341
|
const items = props.items ?? [];
|
|
@@ -1111,14 +1344,23 @@ var JsonToggleGroup = ({ props, bindings, emit }) => {
|
|
|
1111
1344
|
const isBound = !!bindings?.value;
|
|
1112
1345
|
const value = isBound ? boundValue ?? "" : localValue;
|
|
1113
1346
|
const setValue = isBound ? setBoundValue : setLocalValue;
|
|
1114
|
-
|
|
1347
|
+
const field = useJsonField({ path: bindings?.value });
|
|
1348
|
+
const mode = isBound ? field.mode : "edit";
|
|
1349
|
+
const selected = value ? value.split(",") : [];
|
|
1350
|
+
if (mode === "values")
|
|
1351
|
+
return /* @__PURE__ */ jsx35(JsonFieldValue, {
|
|
1352
|
+
field,
|
|
1353
|
+
text: items.filter((item) => selected.includes(item.value)).map((item) => item.label).join(", ")
|
|
1354
|
+
});
|
|
1355
|
+
return /* @__PURE__ */ jsx35(ToggleGroup2, {
|
|
1115
1356
|
multiple: type === "multiple",
|
|
1116
|
-
|
|
1357
|
+
disabled: mode === "locked",
|
|
1358
|
+
value: selected,
|
|
1117
1359
|
onValueChange: (values) => {
|
|
1118
1360
|
setValue(values.join(","));
|
|
1119
1361
|
emit("change");
|
|
1120
1362
|
},
|
|
1121
|
-
children: items.map((item) => /* @__PURE__ */
|
|
1363
|
+
children: items.map((item) => /* @__PURE__ */ jsx35(ToggleGroupItem2, {
|
|
1122
1364
|
value: item.value,
|
|
1123
1365
|
children: item.label
|
|
1124
1366
|
}, item.value))
|
|
@@ -1128,7 +1370,7 @@ var JsonToggleGroup = ({ props, bindings, emit }) => {
|
|
|
1128
1370
|
// src/components/json-render/JsonButtonGroup.tsx
|
|
1129
1371
|
import { useState as useState12 } from "react";
|
|
1130
1372
|
import { useBoundProp as useBoundProp12 } from "@json-render/react";
|
|
1131
|
-
import { jsx as
|
|
1373
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1132
1374
|
var JsonButtonGroup = ({ props, bindings, emit }) => {
|
|
1133
1375
|
const buttons = props.buttons ?? [];
|
|
1134
1376
|
const [boundSelected, setBoundSelected] = useBoundProp12(props.selected ?? undefined, bindings?.selected);
|
|
@@ -1136,15 +1378,23 @@ var JsonButtonGroup = ({ props, bindings, emit }) => {
|
|
|
1136
1378
|
const isBound = !!bindings?.selected;
|
|
1137
1379
|
const value = isBound ? boundSelected ?? "" : localValue;
|
|
1138
1380
|
const setValue = isBound ? setBoundSelected : setLocalValue;
|
|
1139
|
-
|
|
1381
|
+
const field = useJsonField({ path: bindings?.selected });
|
|
1382
|
+
const mode = isBound ? field.mode : "edit";
|
|
1383
|
+
if (mode === "values")
|
|
1384
|
+
return /* @__PURE__ */ jsx36(JsonFieldValue, {
|
|
1385
|
+
field,
|
|
1386
|
+
text: buttons.find((button) => button.value === value)?.label ?? ""
|
|
1387
|
+
});
|
|
1388
|
+
return /* @__PURE__ */ jsx36(ToggleGroup2, {
|
|
1140
1389
|
variant: "outline",
|
|
1141
1390
|
spacing: 0,
|
|
1391
|
+
disabled: mode === "locked",
|
|
1142
1392
|
value: value ? [value] : [],
|
|
1143
1393
|
onValueChange: (values) => {
|
|
1144
1394
|
setValue(values[0] ?? "");
|
|
1145
1395
|
emit("change");
|
|
1146
1396
|
},
|
|
1147
|
-
children: buttons.map((button) => /* @__PURE__ */
|
|
1397
|
+
children: buttons.map((button) => /* @__PURE__ */ jsx36(ToggleGroupItem2, {
|
|
1148
1398
|
value: button.value,
|
|
1149
1399
|
children: button.label
|
|
1150
1400
|
}, button.value))
|
|
@@ -1178,7 +1428,7 @@ function getPaginationRange(current, total) {
|
|
|
1178
1428
|
}
|
|
1179
1429
|
|
|
1180
1430
|
// src/components/json-render/JsonPagination.tsx
|
|
1181
|
-
import { jsx as
|
|
1431
|
+
import { jsx as jsx37, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1182
1432
|
var JsonPagination = ({ props, bindings, emit }) => {
|
|
1183
1433
|
const [boundPage, setBoundPage] = useBoundProp13(props.page ?? undefined, bindings?.page);
|
|
1184
1434
|
const [localPage, setLocalPage] = useState13(props.page ?? 1);
|
|
@@ -1186,11 +1436,11 @@ var JsonPagination = ({ props, bindings, emit }) => {
|
|
|
1186
1436
|
const setPage = bindings?.page ? setBoundPage : setLocalPage;
|
|
1187
1437
|
const totalPages = props.totalPages ?? 1;
|
|
1188
1438
|
const pages = getPaginationRange(currentPage, totalPages);
|
|
1189
|
-
return /* @__PURE__ */
|
|
1190
|
-
children: /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ jsx37(Pagination2, {
|
|
1440
|
+
children: /* @__PURE__ */ jsxs23(PaginationContent2, {
|
|
1191
1441
|
children: [
|
|
1192
|
-
/* @__PURE__ */
|
|
1193
|
-
children: /* @__PURE__ */
|
|
1442
|
+
/* @__PURE__ */ jsx37(PaginationItem2, {
|
|
1443
|
+
children: /* @__PURE__ */ jsx37(PaginationPrevious2, {
|
|
1194
1444
|
href: "#",
|
|
1195
1445
|
onClick: (e) => {
|
|
1196
1446
|
e.preventDefault();
|
|
@@ -1201,10 +1451,10 @@ var JsonPagination = ({ props, bindings, emit }) => {
|
|
|
1201
1451
|
}
|
|
1202
1452
|
})
|
|
1203
1453
|
}),
|
|
1204
|
-
pages.map((page, idx) => page === "ellipsis" ? /* @__PURE__ */
|
|
1205
|
-
children: /* @__PURE__ */
|
|
1206
|
-
}, `ellipsis-${idx}`) : /* @__PURE__ */
|
|
1207
|
-
children: /* @__PURE__ */
|
|
1454
|
+
pages.map((page, idx) => page === "ellipsis" ? /* @__PURE__ */ jsx37(PaginationItem2, {
|
|
1455
|
+
children: /* @__PURE__ */ jsx37(PaginationEllipsis2, {})
|
|
1456
|
+
}, `ellipsis-${idx}`) : /* @__PURE__ */ jsx37(PaginationItem2, {
|
|
1457
|
+
children: /* @__PURE__ */ jsx37(PaginationLink2, {
|
|
1208
1458
|
href: "#",
|
|
1209
1459
|
isActive: page === currentPage,
|
|
1210
1460
|
onClick: (e) => {
|
|
@@ -1215,8 +1465,8 @@ var JsonPagination = ({ props, bindings, emit }) => {
|
|
|
1215
1465
|
children: page
|
|
1216
1466
|
})
|
|
1217
1467
|
}, page)),
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
children: /* @__PURE__ */
|
|
1468
|
+
/* @__PURE__ */ jsx37(PaginationItem2, {
|
|
1469
|
+
children: /* @__PURE__ */ jsx37(PaginationNext2, {
|
|
1220
1470
|
href: "#",
|
|
1221
1471
|
onClick: (e) => {
|
|
1222
1472
|
e.preventDefault();
|
|
@@ -1272,6 +1522,15 @@ var components = {
|
|
|
1272
1522
|
Pagination: JsonPagination
|
|
1273
1523
|
};
|
|
1274
1524
|
export {
|
|
1525
|
+
JsonFieldLabel,
|
|
1526
|
+
JsonFieldMessage,
|
|
1527
|
+
JsonFieldValue,
|
|
1528
|
+
JsonFormProvider,
|
|
1529
|
+
JsonRevealScope,
|
|
1275
1530
|
componentDefinitions2 as componentDefinitions,
|
|
1276
|
-
components
|
|
1531
|
+
components,
|
|
1532
|
+
stripRequiredMark,
|
|
1533
|
+
useJsonField,
|
|
1534
|
+
useJsonForm,
|
|
1535
|
+
useJsonReveal
|
|
1277
1536
|
};
|