@alexgorbatchev/shadcn 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +26 -22
  2. package/THIRD_PARTY_NOTICES.md +10 -0
  3. package/dist/{chunk-0ewzb2ax.js → chunk-0kyfh857.js} +1 -1
  4. package/dist/chunk-1xncv9gb.js +19 -0
  5. package/dist/chunk-2dxa9enk.js +98 -0
  6. package/dist/{chunk-8wfy03bp.js → chunk-6kwf9644.js} +1 -1
  7. package/dist/{chunk-82e7fbmq.js → chunk-9vyg3854.js} +2 -1
  8. package/dist/chunk-c6g2rbhv.js +3940 -0
  9. package/dist/chunk-dzvsjw59.js +200 -0
  10. package/dist/{chunk-g238nezp.js → chunk-pg9rhbgm.js} +4 -2
  11. package/dist/{chunk-5da3rzn5.js → chunk-s0typ7hv.js} +1 -1
  12. package/dist/chunk-tch86q2w.js +6050 -0
  13. package/dist/{chunk-eehfrrdz.js → chunk-tnnf8ydf.js} +1 -15
  14. package/dist/chunk-yfr9syen.js +363 -0
  15. package/dist/{chunk-53q730zs.js → chunk-zdt8xxzy.js} +3 -0
  16. package/dist/components/Alert.d.ts +1 -1
  17. package/dist/components/Table.d.ts +1 -0
  18. package/dist/components/assistant-ui/elements/Chart.js +2 -2
  19. package/dist/components/assistant-ui/elements/GuardrailNotice.js +2 -2
  20. package/dist/components/assistant-ui/elements/OptionList.js +3 -2
  21. package/dist/components/assistant-ui/elements/QuestionFlow.js +4 -3
  22. package/dist/components/assistant-ui/index.js +8 -7
  23. package/dist/components/assistant-ui/native/Sources.d.ts +1 -1
  24. package/dist/components/carousel/index.js +15 -204
  25. package/dist/components/chart/AnalyticsChart.d.ts +3 -2
  26. package/dist/components/chart/Chart.d.ts +1 -1
  27. package/dist/components/chart/index.js +24 -10
  28. package/dist/components/chart/types.d.ts +1 -0
  29. package/dist/components/data-grid/DataGrid.d.ts +48 -9
  30. package/dist/components/data-grid/DataGridColumnOptions.d.ts +14 -0
  31. package/dist/components/data-grid/DataGridColumnResizer.d.ts +13 -0
  32. package/dist/components/data-grid/getDataGridColumnSizeVariables.d.ts +6 -0
  33. package/dist/components/data-grid/hooks/useDataGridColumnSizes.d.ts +8 -0
  34. package/dist/components/data-grid/index.d.ts +3 -2
  35. package/dist/components/data-grid/index.js +124 -199
  36. package/dist/components/data-grid/moveDataGridColumn.d.ts +5 -0
  37. package/dist/components/event-calendar/index.js +4 -2
  38. package/dist/components/json-render/JsonAccordion.d.ts +3 -0
  39. package/dist/components/json-render/JsonAlert.d.ts +3 -0
  40. package/dist/components/json-render/JsonAvatar.d.ts +3 -0
  41. package/dist/components/json-render/JsonBadge.d.ts +3 -0
  42. package/dist/components/json-render/JsonButton.d.ts +3 -0
  43. package/dist/components/json-render/JsonButtonGroup.d.ts +3 -0
  44. package/dist/components/json-render/JsonCard.d.ts +3 -0
  45. package/dist/components/json-render/JsonCarousel.d.ts +3 -0
  46. package/dist/components/json-render/JsonCheckbox.d.ts +3 -0
  47. package/dist/components/json-render/JsonCollapsible.d.ts +3 -0
  48. package/dist/components/json-render/JsonDialog.d.ts +3 -0
  49. package/dist/components/json-render/JsonDrawer.d.ts +3 -0
  50. package/dist/components/json-render/JsonDropdownMenu.d.ts +3 -0
  51. package/dist/components/json-render/JsonGrid.d.ts +3 -0
  52. package/dist/components/json-render/JsonHeading.d.ts +3 -0
  53. package/dist/components/json-render/JsonImage.d.ts +3 -0
  54. package/dist/components/json-render/JsonInput.d.ts +3 -0
  55. package/dist/components/json-render/JsonLink.d.ts +3 -0
  56. package/dist/components/json-render/JsonPagination.d.ts +3 -0
  57. package/dist/components/json-render/JsonPopover.d.ts +3 -0
  58. package/dist/components/json-render/JsonProgress.d.ts +3 -0
  59. package/dist/components/json-render/JsonRadio.d.ts +3 -0
  60. package/dist/components/json-render/JsonSelect.d.ts +3 -0
  61. package/dist/components/json-render/JsonSeparator.d.ts +3 -0
  62. package/dist/components/json-render/JsonSkeleton.d.ts +3 -0
  63. package/dist/components/json-render/JsonSlider.d.ts +3 -0
  64. package/dist/components/json-render/JsonSpinner.d.ts +3 -0
  65. package/dist/components/json-render/JsonStack.d.ts +3 -0
  66. package/dist/components/json-render/JsonSwitch.d.ts +3 -0
  67. package/dist/components/json-render/JsonTable.d.ts +3 -0
  68. package/dist/components/json-render/JsonTabs.d.ts +3 -0
  69. package/dist/components/json-render/JsonText.d.ts +3 -0
  70. package/dist/components/json-render/JsonTextarea.d.ts +3 -0
  71. package/dist/components/json-render/JsonToggle.d.ts +3 -0
  72. package/dist/components/json-render/JsonToggleGroup.d.ts +3 -0
  73. package/dist/components/json-render/JsonTooltip.d.ts +3 -0
  74. package/dist/components/json-render/catalog.d.ts +548 -0
  75. package/dist/components/json-render/catalog.js +6 -0
  76. package/dist/components/json-render/getPaginationRange.d.ts +1 -0
  77. package/dist/components/json-render/index.d.ts +39 -0
  78. package/dist/components/json-render/index.js +1254 -0
  79. package/dist/components/virtual-data-grid/VirtualDataGrid.d.ts +26 -0
  80. package/dist/components/virtual-data-grid/index.d.ts +2 -0
  81. package/dist/components/virtual-data-grid/index.js +88 -0
  82. package/dist/components/virtual-table/index.js +4 -96
  83. package/dist/index.d.ts +1 -0
  84. package/dist/index.js +569 -4189
  85. package/licenses/json-render-APACHE-2.0.txt +201 -0
  86. package/llms/components/data-display/AnalyticsChart.md +34 -0
  87. package/llms/components/data-display/DataGridColumnOptions.md +22 -0
  88. package/llms/components/data-display/JsonRender.md +476 -0
  89. package/llms/components/data-display/VirtualDataGrid.md +71 -0
  90. package/llms/components/feedback/Alert.md +20 -4
  91. package/llms/setup.md +26 -22
  92. package/llms.txt +3 -0
  93. package/package.json +24 -2
@@ -0,0 +1,1254 @@
1
+ import {
2
+ cn2
3
+ } from "../../chunk-cp2m7y7v.js";
4
+ import {
5
+ Button2
6
+ } from "../../chunk-q7p28b89.js";
7
+ import {
8
+ ButtonLink2,
9
+ Accordion2,
10
+ AccordionItem2,
11
+ AccordionTrigger2,
12
+ AccordionContent2,
13
+ Select2,
14
+ SelectValue2,
15
+ SelectTrigger2,
16
+ SelectContent2,
17
+ SelectItem2,
18
+ Pagination2,
19
+ PaginationContent2,
20
+ PaginationItem2,
21
+ PaginationLink2,
22
+ PaginationPrevious2,
23
+ PaginationNext2,
24
+ PaginationEllipsis2,
25
+ Drawer2,
26
+ DrawerContent2,
27
+ DrawerHeader2,
28
+ DrawerTitle2,
29
+ DrawerDescription2
30
+ } from "../../chunk-c6g2rbhv.js";
31
+ import"../../chunk-e6hk39ev.js";
32
+ import"../../chunk-j89xg1ak.js";
33
+ import"../../chunk-aa7m22zj.js";
34
+ import"../../chunk-jpvw9xqy.js";
35
+ import {
36
+ DropdownMenu2,
37
+ DropdownMenuTrigger2,
38
+ DropdownMenuContent2,
39
+ DropdownMenuItem2
40
+ } from "../../chunk-d4bm5rzy.js";
41
+ import {
42
+ Popover2,
43
+ PopoverTrigger2,
44
+ PopoverContent2
45
+ } from "../../chunk-4djw71cv.js";
46
+ import {
47
+ Skeleton2
48
+ } from "../../chunk-d70rcwk7.js";
49
+ import {
50
+ Input2
51
+ } from "../../chunk-59p19t57.js";
52
+ import {
53
+ Label2
54
+ } from "../../chunk-jcxxjkqx.js";
55
+ import {
56
+ Separator2
57
+ } from "../../chunk-rajgnfbr.js";
58
+ import {
59
+ Field2,
60
+ FieldLabel2
61
+ } from "../../chunk-6jpz5geq.js";
62
+ import {
63
+ Dialog2,
64
+ DialogContent2,
65
+ DialogHeader2,
66
+ DialogTitle2,
67
+ DialogDescription2
68
+ } from "../../chunk-ex1zk6ta.js";
69
+ import {
70
+ Slider2
71
+ } from "../../chunk-644cnngf.js";
72
+ import {
73
+ Switch2
74
+ } from "../../chunk-8ye0k6z7.js";
75
+ import {
76
+ Textarea2
77
+ } from "../../chunk-hz9azhzx.js";
78
+ import {
79
+ TooltipProvider2,
80
+ Tooltip2,
81
+ TooltipTrigger2,
82
+ TooltipContent2
83
+ } from "../../chunk-mz3e810d.js";
84
+ import {
85
+ RadioGroup2,
86
+ RadioGroupItem2
87
+ } from "../../chunk-wndqbss9.js";
88
+ import {
89
+ Card2,
90
+ CardHeader2,
91
+ CardTitle2,
92
+ CardDescription2,
93
+ CardContent2
94
+ } from "../../chunk-bygq5yqf.js";
95
+ import"../../chunk-57jj9v64.js";
96
+ import {
97
+ Tabs2,
98
+ TabsList2,
99
+ TabsTrigger2
100
+ } from "../../chunk-6grcm62s.js";
101
+ import {
102
+ Badge2
103
+ } from "../../chunk-wjx6zf94.js";
104
+ import"../../chunk-9de1htr5.js";
105
+ import {
106
+ Checkbox2
107
+ } from "../../chunk-tnnf8ydf.js";
108
+ import"../../chunk-1j2hz3w9.js";
109
+ import"../../chunk-k99h6evz.js";
110
+ import {
111
+ Toggle2,
112
+ ToggleGroup2,
113
+ ToggleGroupItem2
114
+ } from "../../chunk-aexby8h3.js";
115
+ import {
116
+ Alert2,
117
+ AlertTitle2,
118
+ AlertDescription2
119
+ } from "../../chunk-zdt8xxzy.js";
120
+ import {
121
+ Avatar2,
122
+ AvatarImage2,
123
+ AvatarFallback2
124
+ } from "../../chunk-hyq4nwg2.js";
125
+ import {
126
+ Progress2
127
+ } from "../../chunk-5j39rehg.js";
128
+ import {
129
+ Collapsible2,
130
+ CollapsibleTrigger2,
131
+ CollapsibleContent2
132
+ } from "../../chunk-24d68cjp.js";
133
+ import {
134
+ Spinner2
135
+ } from "../../chunk-1xncv9gb.js";
136
+ import {
137
+ Table2,
138
+ TableHeader2,
139
+ TableBody2,
140
+ TableRow2,
141
+ TableHead2,
142
+ TableCell2,
143
+ TableCaption2
144
+ } from "../../chunk-zte6pw69.js";
145
+ import"../../chunk-r9qrb6b6.js";
146
+ import"../../chunk-vyve5wf3.js";
147
+ import"../../chunk-hh43wg05.js";
148
+ import"../../chunk-8vfh3ez0.js";
149
+ import"../../chunk-83zjj4jd.js";
150
+ import {
151
+ Carousel2,
152
+ CarouselContent2,
153
+ CarouselItem2,
154
+ CarouselPrevious2,
155
+ CarouselNext2
156
+ } from "../../chunk-dzvsjw59.js";
157
+ import {
158
+ componentDefinitions2
159
+ } from "../../chunk-tch86q2w.js";
160
+
161
+ // src/components/json-render/JsonCard.tsx
162
+ import { jsx, jsxs } from "react/jsx-runtime";
163
+ var JsonCard = ({ props, children }) => {
164
+ const maxWidthClass = props.maxWidth === "sm" ? "max-w-xs sm:min-w-[280px]" : props.maxWidth === "md" ? "max-w-sm sm:min-w-[320px]" : props.maxWidth === "lg" ? "max-w-md sm:min-w-[360px]" : "w-full";
165
+ const centeredClass = props.centered ? "mx-auto" : "";
166
+ return /* @__PURE__ */ jsxs(Card2, {
167
+ className: cn2(maxWidthClass, centeredClass, props.className),
168
+ children: [
169
+ (props.title || props.description) && /* @__PURE__ */ jsxs(CardHeader2, {
170
+ children: [
171
+ props.title && /* @__PURE__ */ jsx(CardTitle2, {
172
+ children: props.title
173
+ }),
174
+ props.description && /* @__PURE__ */ jsx(CardDescription2, {
175
+ children: props.description
176
+ })
177
+ ]
178
+ }),
179
+ /* @__PURE__ */ jsx(CardContent2, {
180
+ className: "flex flex-col gap-3",
181
+ children
182
+ })
183
+ ]
184
+ });
185
+ };
186
+
187
+ // src/components/json-render/JsonStack.tsx
188
+ import { jsx as jsx2 } from "react/jsx-runtime";
189
+ var JsonStack = ({ props, children }) => {
190
+ const isHorizontal = props.direction === "horizontal";
191
+ const gapMap = {
192
+ none: "gap-0",
193
+ sm: "gap-2",
194
+ md: "gap-3",
195
+ lg: "gap-4",
196
+ xl: "gap-6"
197
+ };
198
+ const alignMap = {
199
+ start: "items-start",
200
+ center: "items-center",
201
+ end: "items-end",
202
+ stretch: "items-stretch"
203
+ };
204
+ const justifyMap = {
205
+ start: "",
206
+ center: "justify-center",
207
+ end: "justify-end",
208
+ between: "justify-between",
209
+ around: "justify-around"
210
+ };
211
+ const gapClass = gapMap[props.gap ?? "md"] ?? "gap-3";
212
+ const alignClass = alignMap[props.align ?? "start"] ?? "items-start";
213
+ const justifyClass = justifyMap[props.justify ?? ""] ?? "";
214
+ return /* @__PURE__ */ jsx2("div", {
215
+ className: cn2("flex", isHorizontal ? "flex-row flex-wrap" : "flex-col", gapClass, alignClass, justifyClass, props.className),
216
+ children
217
+ });
218
+ };
219
+
220
+ // src/components/json-render/JsonGrid.tsx
221
+ import { jsx as jsx3 } from "react/jsx-runtime";
222
+ var JsonGrid = ({ props, children }) => {
223
+ const colsMap = {
224
+ 1: "grid-cols-1",
225
+ 2: "grid-cols-2",
226
+ 3: "grid-cols-3",
227
+ 4: "grid-cols-4",
228
+ 5: "grid-cols-5",
229
+ 6: "grid-cols-6"
230
+ };
231
+ const gridGapMap = {
232
+ sm: "gap-2",
233
+ md: "gap-3",
234
+ lg: "gap-4",
235
+ xl: "gap-6"
236
+ };
237
+ const n = Math.max(1, Math.min(6, props.columns ?? 1));
238
+ const cols = colsMap[n] ?? "grid-cols-1";
239
+ const gridGap = gridGapMap[props.gap ?? "md"] ?? "gap-3";
240
+ return /* @__PURE__ */ jsx3("div", {
241
+ className: cn2("grid", cols, gridGap, props.className),
242
+ children
243
+ });
244
+ };
245
+
246
+ // src/components/json-render/JsonSeparator.tsx
247
+ import { jsx as jsx4 } from "react/jsx-runtime";
248
+ var JsonSeparator = ({ props }) => {
249
+ return /* @__PURE__ */ jsx4(Separator2, {
250
+ orientation: props.orientation ?? "horizontal",
251
+ className: props.orientation === "vertical" ? "h-full mx-2" : "my-3"
252
+ });
253
+ };
254
+
255
+ // src/components/json-render/JsonTabs.tsx
256
+ import { useState } from "react";
257
+ import { useBoundProp } from "@json-render/react";
258
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
259
+ var JsonTabs = ({ props, children, bindings, emit }) => {
260
+ const tabs = props.tabs ?? [];
261
+ const [boundValue, setBoundValue] = useBoundProp(props.value ?? undefined, bindings?.value);
262
+ const [localValue, setLocalValue] = useState(props.value ?? props.defaultValue ?? tabs[0]?.value ?? "");
263
+ const isBound = !!bindings?.value;
264
+ const value = isBound ? boundValue ?? tabs[0]?.value ?? "" : localValue;
265
+ const setValue = isBound ? setBoundValue : setLocalValue;
266
+ return /* @__PURE__ */ jsxs2(Tabs2, {
267
+ value,
268
+ onValueChange: (v) => {
269
+ setValue(v);
270
+ emit("change");
271
+ },
272
+ children: [
273
+ /* @__PURE__ */ jsx5(TabsList2, {
274
+ children: tabs.map((tab) => /* @__PURE__ */ jsx5(TabsTrigger2, {
275
+ value: tab.value,
276
+ children: tab.label
277
+ }, tab.value))
278
+ }),
279
+ children
280
+ ]
281
+ });
282
+ };
283
+
284
+ // src/components/json-render/JsonAccordion.tsx
285
+ import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
286
+ var JsonAccordion = ({ props }) => {
287
+ const items = props.items ?? [];
288
+ const isMultiple = props.type === "multiple";
289
+ const itemElements = items.map((item, i) => /* @__PURE__ */ jsxs3(AccordionItem2, {
290
+ value: `item-${i}`,
291
+ children: [
292
+ /* @__PURE__ */ jsx6(AccordionTrigger2, {
293
+ children: item.title
294
+ }),
295
+ /* @__PURE__ */ jsx6(AccordionContent2, {
296
+ children: item.content
297
+ })
298
+ ]
299
+ }, i));
300
+ if (isMultiple) {
301
+ return /* @__PURE__ */ jsx6(Accordion2, {
302
+ multiple: true,
303
+ className: "w-full",
304
+ children: itemElements
305
+ });
306
+ }
307
+ return /* @__PURE__ */ jsx6(Accordion2, {
308
+ multiple: false,
309
+ className: "w-full",
310
+ children: itemElements
311
+ });
312
+ };
313
+
314
+ // src/components/json-render/JsonCollapsible.tsx
315
+ import { useState as useState2 } from "react";
316
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
317
+ var JsonCollapsible = ({ props, children }) => {
318
+ const [open, setOpen] = useState2(props.defaultOpen ?? false);
319
+ return /* @__PURE__ */ jsxs4(Collapsible2, {
320
+ open,
321
+ onOpenChange: setOpen,
322
+ className: "w-full",
323
+ children: [
324
+ /* @__PURE__ */ jsxs4(CollapsibleTrigger2, {
325
+ render: /* @__PURE__ */ jsx7(Button2, {
326
+ variant: "outline",
327
+ fullWidth: true,
328
+ align: "start"
329
+ }),
330
+ children: [
331
+ props.title,
332
+ /* @__PURE__ */ jsx7("svg", {
333
+ className: `h-4 w-4 transition-transform ${open ? "rotate-180" : ""}`,
334
+ fill: "none",
335
+ viewBox: "0 0 24 24",
336
+ stroke: "currentColor",
337
+ strokeWidth: 2,
338
+ children: /* @__PURE__ */ jsx7("path", {
339
+ strokeLinecap: "round",
340
+ strokeLinejoin: "round",
341
+ d: "M19 9l-7 7-7-7"
342
+ })
343
+ })
344
+ ]
345
+ }),
346
+ /* @__PURE__ */ jsx7(CollapsibleContent2, {
347
+ className: "pt-2",
348
+ children
349
+ })
350
+ ]
351
+ });
352
+ };
353
+
354
+ // src/components/json-render/JsonDialog.tsx
355
+ import { useStateBinding } from "@json-render/react";
356
+ import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
357
+ var JsonDialog = ({ props, children }) => {
358
+ const [open, setOpen] = useStateBinding(props.openPath ?? "");
359
+ return /* @__PURE__ */ jsx8(Dialog2, {
360
+ open: open ?? false,
361
+ onOpenChange: (v) => setOpen(v),
362
+ children: /* @__PURE__ */ jsxs5(DialogContent2, {
363
+ children: [
364
+ /* @__PURE__ */ jsxs5(DialogHeader2, {
365
+ children: [
366
+ /* @__PURE__ */ jsx8(DialogTitle2, {
367
+ children: props.title
368
+ }),
369
+ props.description && /* @__PURE__ */ jsx8(DialogDescription2, {
370
+ children: props.description
371
+ })
372
+ ]
373
+ }),
374
+ children
375
+ ]
376
+ })
377
+ });
378
+ };
379
+
380
+ // src/components/json-render/JsonDrawer.tsx
381
+ import { useStateBinding as useStateBinding2 } from "@json-render/react";
382
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
383
+ var JsonDrawer = ({ props, children }) => {
384
+ const [open, setOpen] = useStateBinding2(props.openPath ?? "");
385
+ return /* @__PURE__ */ jsx9(Drawer2, {
386
+ open: open ?? false,
387
+ onOpenChange: (v) => setOpen(v),
388
+ children: /* @__PURE__ */ jsxs6(DrawerContent2, {
389
+ children: [
390
+ /* @__PURE__ */ jsxs6(DrawerHeader2, {
391
+ children: [
392
+ /* @__PURE__ */ jsx9(DrawerTitle2, {
393
+ children: props.title
394
+ }),
395
+ props.description && /* @__PURE__ */ jsx9(DrawerDescription2, {
396
+ children: props.description
397
+ })
398
+ ]
399
+ }),
400
+ /* @__PURE__ */ jsx9("div", {
401
+ className: "p-4",
402
+ children
403
+ })
404
+ ]
405
+ })
406
+ });
407
+ };
408
+
409
+ // src/components/json-render/JsonCarousel.tsx
410
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
411
+ var JsonCarousel = ({ props }) => {
412
+ const items = props.items ?? [];
413
+ return /* @__PURE__ */ jsxs7(Carousel2, {
414
+ className: "w-full",
415
+ children: [
416
+ /* @__PURE__ */ jsx10(CarouselContent2, {
417
+ children: items.map((item, i) => /* @__PURE__ */ jsx10(CarouselItem2, {
418
+ className: "basis-3/4 md:basis-1/2 lg:basis-1/3",
419
+ children: /* @__PURE__ */ jsxs7("div", {
420
+ className: "border border-border rounded-lg p-4 bg-card h-full",
421
+ children: [
422
+ item.title && /* @__PURE__ */ jsx10("h4", {
423
+ className: "font-semibold text-sm mb-1",
424
+ children: item.title
425
+ }),
426
+ item.description && /* @__PURE__ */ jsx10("p", {
427
+ className: "text-sm text-muted-foreground",
428
+ children: item.description
429
+ })
430
+ ]
431
+ })
432
+ }, i))
433
+ }),
434
+ /* @__PURE__ */ jsx10(CarouselPrevious2, {}),
435
+ /* @__PURE__ */ jsx10(CarouselNext2, {})
436
+ ]
437
+ });
438
+ };
439
+
440
+ // src/components/json-render/JsonTable.tsx
441
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
442
+ var JsonTable = ({ props }) => {
443
+ const columns = props.columns ?? [];
444
+ const rows = (props.rows ?? []).map((row) => row.map(String));
445
+ return /* @__PURE__ */ jsx11("div", {
446
+ className: "rounded-md border border-border overflow-hidden",
447
+ children: /* @__PURE__ */ jsxs8(Table2, {
448
+ children: [
449
+ props.caption && /* @__PURE__ */ jsx11(TableCaption2, {
450
+ children: props.caption
451
+ }),
452
+ /* @__PURE__ */ jsx11(TableHeader2, {
453
+ children: /* @__PURE__ */ jsx11(TableRow2, {
454
+ children: columns.map((col) => /* @__PURE__ */ jsx11(TableHead2, {
455
+ children: col
456
+ }, col))
457
+ })
458
+ }),
459
+ /* @__PURE__ */ jsx11(TableBody2, {
460
+ children: rows.map((row, i) => /* @__PURE__ */ jsx11(TableRow2, {
461
+ children: row.map((cell, j) => /* @__PURE__ */ jsx11(TableCell2, {
462
+ children: cell
463
+ }, j))
464
+ }, i))
465
+ })
466
+ ]
467
+ })
468
+ });
469
+ };
470
+
471
+ // src/components/json-render/JsonHeading.tsx
472
+ import { jsx as jsx12 } from "react/jsx-runtime";
473
+ var JsonHeading = ({ props }) => {
474
+ const level = props.level ?? "h2";
475
+ const headingClass = level === "h1" ? "text-2xl font-bold" : level === "h3" ? "text-base font-semibold" : level === "h4" ? "text-sm font-semibold" : "text-lg font-semibold";
476
+ if (level === "h1")
477
+ return /* @__PURE__ */ jsx12("h1", {
478
+ className: `${headingClass} text-left`,
479
+ children: props.text
480
+ });
481
+ if (level === "h3")
482
+ return /* @__PURE__ */ jsx12("h3", {
483
+ className: `${headingClass} text-left`,
484
+ children: props.text
485
+ });
486
+ if (level === "h4")
487
+ return /* @__PURE__ */ jsx12("h4", {
488
+ className: `${headingClass} text-left`,
489
+ children: props.text
490
+ });
491
+ return /* @__PURE__ */ jsx12("h2", {
492
+ className: `${headingClass} text-left`,
493
+ children: props.text
494
+ });
495
+ };
496
+
497
+ // src/components/json-render/JsonText.tsx
498
+ import { jsx as jsx13 } from "react/jsx-runtime";
499
+ var JsonText = ({ props }) => {
500
+ 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";
501
+ if (props.variant === "code") {
502
+ return /* @__PURE__ */ jsx13("code", {
503
+ className: `${textClass} text-left`,
504
+ children: props.text
505
+ });
506
+ }
507
+ return /* @__PURE__ */ jsx13("p", {
508
+ className: `${textClass} text-left`,
509
+ children: props.text
510
+ });
511
+ };
512
+
513
+ // src/components/json-render/JsonImage.tsx
514
+ import { jsx as jsx14 } from "react/jsx-runtime";
515
+ var JsonImage = ({ props }) => {
516
+ if (props.src) {
517
+ return /* @__PURE__ */ jsx14("img", {
518
+ src: props.src,
519
+ alt: props.alt ?? "",
520
+ width: props.width ?? undefined,
521
+ height: props.height ?? undefined,
522
+ className: "rounded max-w-full"
523
+ });
524
+ }
525
+ return /* @__PURE__ */ jsx14("div", {
526
+ className: "bg-muted border border-border rounded flex items-center justify-center text-xs text-muted-foreground",
527
+ style: { width: props.width ?? 80, height: props.height ?? 60 },
528
+ children: props.alt || "img"
529
+ });
530
+ };
531
+
532
+ // src/components/json-render/JsonAvatar.tsx
533
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
534
+ var JsonAvatar = ({ props }) => {
535
+ const name = props.name || "?";
536
+ const initials = name.split(" ").map((n) => n[0]).join("").slice(0, 2).toUpperCase();
537
+ const sizeClass = props.size === "lg" ? "h-12 w-12" : props.size === "sm" ? "h-8 w-8" : "h-10 w-10";
538
+ return /* @__PURE__ */ jsxs9(Avatar2, {
539
+ className: sizeClass,
540
+ children: [
541
+ props.src && /* @__PURE__ */ jsx15(AvatarImage2, {
542
+ src: props.src,
543
+ alt: name
544
+ }),
545
+ /* @__PURE__ */ jsx15(AvatarFallback2, {
546
+ children: initials
547
+ })
548
+ ]
549
+ });
550
+ };
551
+
552
+ // src/components/json-render/JsonBadge.tsx
553
+ import { jsx as jsx16 } from "react/jsx-runtime";
554
+ var JsonBadge = ({ props }) => {
555
+ return /* @__PURE__ */ jsx16(Badge2, {
556
+ variant: props.variant ?? "default",
557
+ children: props.text
558
+ });
559
+ };
560
+
561
+ // src/components/json-render/JsonAlert.tsx
562
+ import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
563
+ var JsonAlert = ({ props }) => {
564
+ return /* @__PURE__ */ jsxs10(Alert2, {
565
+ variant: props.type === "error" ? "destructive" : props.type ?? "default",
566
+ children: [
567
+ /* @__PURE__ */ jsx17(AlertTitle2, {
568
+ children: props.title
569
+ }),
570
+ props.message && /* @__PURE__ */ jsx17(AlertDescription2, {
571
+ children: props.message
572
+ })
573
+ ]
574
+ });
575
+ };
576
+
577
+ // src/components/json-render/JsonProgress.tsx
578
+ import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
579
+ var JsonProgress = ({ props }) => {
580
+ const value = Math.min(100, Math.max(0, props.value || 0));
581
+ return /* @__PURE__ */ jsxs11("div", {
582
+ className: "space-y-2",
583
+ children: [
584
+ props.label && /* @__PURE__ */ jsx18(Label2, {
585
+ className: "text-sm text-muted-foreground",
586
+ children: props.label
587
+ }),
588
+ /* @__PURE__ */ jsx18(Progress2, {
589
+ value
590
+ })
591
+ ]
592
+ });
593
+ };
594
+
595
+ // src/components/json-render/JsonSkeleton.tsx
596
+ import { jsx as jsx19 } from "react/jsx-runtime";
597
+ var JsonSkeleton = ({ props }) => {
598
+ return /* @__PURE__ */ jsx19(Skeleton2, {
599
+ className: props.rounded ? "rounded-full" : "rounded-md",
600
+ style: {
601
+ width: props.width ?? "100%",
602
+ height: props.height ?? "1.25rem"
603
+ }
604
+ });
605
+ };
606
+
607
+ // src/components/json-render/JsonSpinner.tsx
608
+ import { jsx as jsx20 } from "react/jsx-runtime";
609
+ var JsonSpinner = ({ props }) => {
610
+ return /* @__PURE__ */ jsx20(Spinner2, {
611
+ "aria-label": props.label ?? "Loading",
612
+ className: props.size === "lg" ? "size-8" : props.size === "sm" ? "size-4" : "size-6"
613
+ });
614
+ };
615
+
616
+ // src/components/json-render/JsonTooltip.tsx
617
+ import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
618
+ var JsonTooltip = ({ props }) => {
619
+ return /* @__PURE__ */ jsx21(TooltipProvider2, {
620
+ children: /* @__PURE__ */ jsxs12(Tooltip2, {
621
+ children: [
622
+ /* @__PURE__ */ jsx21(TooltipTrigger2, {
623
+ render: /* @__PURE__ */ jsx21(Button2, {
624
+ variant: "link"
625
+ }),
626
+ children: props.text
627
+ }),
628
+ /* @__PURE__ */ jsx21(TooltipContent2, {
629
+ children: /* @__PURE__ */ jsx21("p", {
630
+ children: props.content
631
+ })
632
+ })
633
+ ]
634
+ })
635
+ });
636
+ };
637
+
638
+ // src/components/json-render/JsonPopover.tsx
639
+ import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
640
+ var JsonPopover = ({ props }) => {
641
+ return /* @__PURE__ */ jsxs13(Popover2, {
642
+ children: [
643
+ /* @__PURE__ */ jsx22(PopoverTrigger2, {
644
+ render: /* @__PURE__ */ jsx22(Button2, {
645
+ variant: "outline"
646
+ }),
647
+ children: props.trigger
648
+ }),
649
+ /* @__PURE__ */ jsx22(PopoverContent2, {
650
+ className: "w-64",
651
+ children: /* @__PURE__ */ jsx22("p", {
652
+ className: "text-sm",
653
+ children: props.content
654
+ })
655
+ })
656
+ ]
657
+ });
658
+ };
659
+
660
+ // src/components/json-render/JsonInput.tsx
661
+ import { useId, useState as useState3 } from "react";
662
+ import { useBoundProp as useBoundProp2 } from "@json-render/react";
663
+ import { useFieldValidation } from "@json-render/react";
664
+ import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
665
+ var JsonInput = ({ props, bindings, emit }) => {
666
+ const id = useId();
667
+ const [boundValue, setBoundValue] = useBoundProp2(props.value ?? undefined, bindings?.value);
668
+ const [localValue, setLocalValue] = useState3(props.value ?? "");
669
+ const isBound = !!bindings?.value;
670
+ const value = isBound ? boundValue ?? "" : localValue;
671
+ const setValue = isBound ? setBoundValue : setLocalValue;
672
+ const validateOn = props.validateOn ?? "blur";
673
+ const hasValidation = !!(bindings?.value && props.checks?.length);
674
+ const { errors, validate } = useFieldValidation(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
675
+ return /* @__PURE__ */ jsxs14("div", {
676
+ className: "space-y-2",
677
+ children: [
678
+ props.label && /* @__PURE__ */ jsx23(Label2, {
679
+ htmlFor: id,
680
+ children: props.label
681
+ }),
682
+ /* @__PURE__ */ jsx23(Input2, {
683
+ id,
684
+ name: props.name ?? undefined,
685
+ type: props.type ?? "text",
686
+ placeholder: props.placeholder ?? "",
687
+ value,
688
+ onChange: (e) => {
689
+ setValue(e.target.value);
690
+ if (hasValidation && validateOn === "change")
691
+ validate();
692
+ },
693
+ onKeyDown: (e) => {
694
+ if (e.key === "Enter")
695
+ emit("submit");
696
+ },
697
+ onFocus: () => emit("focus"),
698
+ onBlur: () => {
699
+ if (hasValidation && validateOn === "blur")
700
+ validate();
701
+ emit("blur");
702
+ }
703
+ }),
704
+ errors.length > 0 && /* @__PURE__ */ jsx23("p", {
705
+ className: "text-sm text-destructive",
706
+ children: errors[0]
707
+ })
708
+ ]
709
+ });
710
+ };
711
+
712
+ // src/components/json-render/JsonTextarea.tsx
713
+ import { useId as useId2, useState as useState4 } from "react";
714
+ import { useBoundProp as useBoundProp3 } from "@json-render/react";
715
+ import { useFieldValidation as useFieldValidation2 } from "@json-render/react";
716
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
717
+ var JsonTextarea = ({ props, bindings }) => {
718
+ const id = useId2();
719
+ const [boundValue, setBoundValue] = useBoundProp3(props.value ?? undefined, bindings?.value);
720
+ const [localValue, setLocalValue] = useState4(props.value ?? "");
721
+ const isBound = !!bindings?.value;
722
+ const value = isBound ? boundValue ?? "" : localValue;
723
+ const setValue = isBound ? setBoundValue : setLocalValue;
724
+ const validateOn = props.validateOn ?? "blur";
725
+ const hasValidation = !!(bindings?.value && props.checks?.length);
726
+ const { errors, validate } = useFieldValidation2(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
727
+ return /* @__PURE__ */ jsxs15("div", {
728
+ className: "space-y-2",
729
+ children: [
730
+ props.label && /* @__PURE__ */ jsx24(Label2, {
731
+ htmlFor: id,
732
+ children: props.label
733
+ }),
734
+ /* @__PURE__ */ jsx24(Textarea2, {
735
+ id,
736
+ name: props.name ?? undefined,
737
+ placeholder: props.placeholder ?? "",
738
+ rows: props.rows ?? 3,
739
+ value,
740
+ onChange: (e) => {
741
+ setValue(e.target.value);
742
+ if (hasValidation && validateOn === "change")
743
+ validate();
744
+ },
745
+ onBlur: () => {
746
+ if (hasValidation && validateOn === "blur")
747
+ validate();
748
+ }
749
+ }),
750
+ errors.length > 0 && /* @__PURE__ */ jsx24("p", {
751
+ className: "text-sm text-destructive",
752
+ children: errors[0]
753
+ })
754
+ ]
755
+ });
756
+ };
757
+
758
+ // src/components/json-render/JsonSelect.tsx
759
+ import { useId as useId3, useState as useState5 } from "react";
760
+ import { useBoundProp as useBoundProp4 } from "@json-render/react";
761
+ import { useFieldValidation as useFieldValidation3 } from "@json-render/react";
762
+ import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
763
+ var JsonSelect = ({ props, bindings, emit }) => {
764
+ const id = useId3();
765
+ const [boundValue, setBoundValue] = useBoundProp4(props.value ?? undefined, bindings?.value);
766
+ const [localValue, setLocalValue] = useState5(props.value ?? "");
767
+ const isBound = !!bindings?.value;
768
+ const value = isBound ? boundValue ?? "" : localValue;
769
+ const setValue = isBound ? setBoundValue : setLocalValue;
770
+ const rawOptions = props.options ?? [];
771
+ const options = rawOptions.map((opt) => typeof opt === "string" ? opt : String(opt ?? ""));
772
+ const validateOn = props.validateOn ?? "change";
773
+ const hasValidation = !!(bindings?.value && props.checks?.length);
774
+ const { errors, validate } = useFieldValidation3(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
775
+ return /* @__PURE__ */ jsxs16("div", {
776
+ className: "space-y-2",
777
+ children: [
778
+ /* @__PURE__ */ jsx25(Label2, {
779
+ htmlFor: id,
780
+ children: props.label
781
+ }),
782
+ /* @__PURE__ */ jsxs16(Select2, {
783
+ value,
784
+ onValueChange: (v) => {
785
+ setValue(v ?? "");
786
+ if (hasValidation && validateOn === "change")
787
+ validate();
788
+ emit("change");
789
+ },
790
+ children: [
791
+ /* @__PURE__ */ jsx25(SelectTrigger2, {
792
+ id,
793
+ className: "w-full",
794
+ children: /* @__PURE__ */ jsx25(SelectValue2, {
795
+ placeholder: props.placeholder ?? "Select..."
796
+ })
797
+ }),
798
+ /* @__PURE__ */ jsx25(SelectContent2, {
799
+ children: options.map((opt, idx) => /* @__PURE__ */ jsx25(SelectItem2, {
800
+ value: opt || `option-${idx}`,
801
+ children: opt
802
+ }, `${idx}-${opt}`))
803
+ })
804
+ ]
805
+ }),
806
+ errors.length > 0 && /* @__PURE__ */ jsx25("p", {
807
+ className: "text-sm text-destructive",
808
+ children: errors[0]
809
+ })
810
+ ]
811
+ });
812
+ };
813
+
814
+ // src/components/json-render/JsonCheckbox.tsx
815
+ import { useId as useId4, useState as useState6 } from "react";
816
+ import { useBoundProp as useBoundProp5 } from "@json-render/react";
817
+ import { useFieldValidation as useFieldValidation4 } from "@json-render/react";
818
+ import { jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
819
+ var JsonCheckbox = ({ props, bindings, emit }) => {
820
+ const id = useId4();
821
+ const [boundChecked, setBoundChecked] = useBoundProp5(props.checked ?? undefined, bindings?.checked);
822
+ const [localChecked, setLocalChecked] = useState6(!!props.checked);
823
+ const isBound = !!bindings?.checked;
824
+ const checked = isBound ? boundChecked ?? false : localChecked;
825
+ const setChecked = isBound ? setBoundChecked : setLocalChecked;
826
+ const validateOn = props.validateOn ?? "change";
827
+ const hasValidation = !!(bindings?.checked && props.checks?.length);
828
+ const { errors, validate } = useFieldValidation4(bindings?.checked ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
829
+ return /* @__PURE__ */ jsxs17("div", {
830
+ className: "space-y-1",
831
+ children: [
832
+ /* @__PURE__ */ jsxs17(Field2, {
833
+ orientation: "horizontal",
834
+ children: [
835
+ /* @__PURE__ */ jsx26(Checkbox2, {
836
+ id,
837
+ checked,
838
+ onCheckedChange: (c) => {
839
+ setChecked(c === true);
840
+ if (hasValidation && validateOn === "change")
841
+ validate();
842
+ emit("change");
843
+ }
844
+ }),
845
+ /* @__PURE__ */ jsx26(FieldLabel2, {
846
+ htmlFor: id,
847
+ children: props.label
848
+ })
849
+ ]
850
+ }),
851
+ errors.length > 0 && /* @__PURE__ */ jsx26("p", {
852
+ className: "text-sm text-destructive",
853
+ children: errors[0]
854
+ })
855
+ ]
856
+ });
857
+ };
858
+
859
+ // src/components/json-render/JsonRadio.tsx
860
+ import { useId as useId5, useState as useState7 } from "react";
861
+ import { useBoundProp as useBoundProp6 } from "@json-render/react";
862
+ import { useFieldValidation as useFieldValidation5 } from "@json-render/react";
863
+ import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
864
+ var JsonRadio = ({ props, bindings, emit }) => {
865
+ const id = useId5();
866
+ const rawOptions = props.options ?? [];
867
+ const options = rawOptions.map((opt) => typeof opt === "string" ? opt : String(opt ?? ""));
868
+ const [boundValue, setBoundValue] = useBoundProp6(props.value ?? undefined, bindings?.value);
869
+ const [localValue, setLocalValue] = useState7(props.value ?? options[0] ?? "");
870
+ const isBound = !!bindings?.value;
871
+ const value = isBound ? boundValue ?? "" : localValue;
872
+ const setValue = isBound ? setBoundValue : setLocalValue;
873
+ const validateOn = props.validateOn ?? "change";
874
+ const hasValidation = !!(bindings?.value && props.checks?.length);
875
+ const { errors, validate } = useFieldValidation5(bindings?.value ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
876
+ return /* @__PURE__ */ jsxs18("div", {
877
+ className: "space-y-2",
878
+ children: [
879
+ props.label && /* @__PURE__ */ jsx27(Label2, {
880
+ id,
881
+ children: props.label
882
+ }),
883
+ /* @__PURE__ */ jsx27(RadioGroup2, {
884
+ "aria-labelledby": props.label ? id : undefined,
885
+ value,
886
+ onValueChange: (v) => {
887
+ setValue(v);
888
+ if (hasValidation && validateOn === "change")
889
+ validate();
890
+ emit("change");
891
+ },
892
+ children: options.map((opt, idx) => /* @__PURE__ */ jsxs18(Field2, {
893
+ orientation: "horizontal",
894
+ children: [
895
+ /* @__PURE__ */ jsx27(RadioGroupItem2, {
896
+ value: opt || `option-${idx}`,
897
+ id: `${id}-${idx}`
898
+ }),
899
+ /* @__PURE__ */ jsx27(FieldLabel2, {
900
+ htmlFor: `${id}-${idx}`,
901
+ children: opt
902
+ })
903
+ ]
904
+ }, `${idx}-${opt}`))
905
+ }),
906
+ errors.length > 0 && /* @__PURE__ */ jsx27("p", {
907
+ className: "text-sm text-destructive",
908
+ children: errors[0]
909
+ })
910
+ ]
911
+ });
912
+ };
913
+
914
+ // src/components/json-render/JsonSwitch.tsx
915
+ import { useId as useId6, useState as useState8 } from "react";
916
+ import { useBoundProp as useBoundProp7 } from "@json-render/react";
917
+ import { useFieldValidation as useFieldValidation6 } from "@json-render/react";
918
+ import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
919
+ var JsonSwitch = ({ props, bindings, emit }) => {
920
+ const id = useId6();
921
+ const [boundChecked, setBoundChecked] = useBoundProp7(props.checked ?? undefined, bindings?.checked);
922
+ const [localChecked, setLocalChecked] = useState8(!!props.checked);
923
+ const isBound = !!bindings?.checked;
924
+ const checked = isBound ? boundChecked ?? false : localChecked;
925
+ const setChecked = isBound ? setBoundChecked : setLocalChecked;
926
+ const validateOn = props.validateOn ?? "change";
927
+ const hasValidation = !!(bindings?.checked && props.checks?.length);
928
+ const { errors, validate } = useFieldValidation6(bindings?.checked ?? "", hasValidation ? { checks: props.checks ?? [], validateOn } : undefined);
929
+ return /* @__PURE__ */ jsxs19("div", {
930
+ className: "space-y-1",
931
+ children: [
932
+ /* @__PURE__ */ jsxs19(Field2, {
933
+ orientation: "horizontal",
934
+ children: [
935
+ /* @__PURE__ */ jsx28(FieldLabel2, {
936
+ htmlFor: id,
937
+ children: props.label
938
+ }),
939
+ /* @__PURE__ */ jsx28(Switch2, {
940
+ id,
941
+ checked,
942
+ onCheckedChange: (c) => {
943
+ setChecked(c);
944
+ if (hasValidation && validateOn === "change")
945
+ validate();
946
+ emit("change");
947
+ }
948
+ })
949
+ ]
950
+ }),
951
+ errors.length > 0 && /* @__PURE__ */ jsx28("p", {
952
+ className: "text-sm text-destructive",
953
+ children: errors[0]
954
+ })
955
+ ]
956
+ });
957
+ };
958
+
959
+ // src/components/json-render/JsonSlider.tsx
960
+ import { useId as useId7, useState as useState9 } from "react";
961
+ import { useBoundProp as useBoundProp8 } from "@json-render/react";
962
+ import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
963
+ var JsonSlider = ({ props, bindings, emit }) => {
964
+ const id = useId7();
965
+ const [boundValue, setBoundValue] = useBoundProp8(props.value ?? undefined, bindings?.value);
966
+ const [localValue, setLocalValue] = useState9(props.value ?? props.min ?? 0);
967
+ const isBound = !!bindings?.value;
968
+ const value = isBound ? boundValue ?? props.min ?? 0 : localValue;
969
+ const setValue = isBound ? setBoundValue : setLocalValue;
970
+ return /* @__PURE__ */ jsxs20("div", {
971
+ className: "space-y-2",
972
+ children: [
973
+ props.label && /* @__PURE__ */ jsxs20("div", {
974
+ className: "flex justify-between",
975
+ children: [
976
+ /* @__PURE__ */ jsx29(Label2, {
977
+ id,
978
+ className: "text-sm",
979
+ children: props.label
980
+ }),
981
+ /* @__PURE__ */ jsx29("span", {
982
+ className: "text-sm text-muted-foreground",
983
+ children: value
984
+ })
985
+ ]
986
+ }),
987
+ /* @__PURE__ */ jsx29(Slider2, {
988
+ getAriaLabel: () => props.label ?? "Value",
989
+ value: [value],
990
+ min: props.min ?? 0,
991
+ max: props.max ?? 100,
992
+ step: props.step ?? 1,
993
+ onValueChange: (v) => {
994
+ setValue(v[0] ?? 0);
995
+ emit("change");
996
+ }
997
+ })
998
+ ]
999
+ });
1000
+ };
1001
+
1002
+ // src/components/json-render/JsonButton.tsx
1003
+ import { jsx as jsx30 } from "react/jsx-runtime";
1004
+ var JsonButton = ({ props, emit }) => {
1005
+ const variant = props.variant === "danger" ? "destructive" : props.variant === "secondary" ? "secondary" : "default";
1006
+ return /* @__PURE__ */ jsx30(Button2, {
1007
+ variant,
1008
+ disabled: props.disabled ?? false,
1009
+ onClick: () => emit("press"),
1010
+ children: props.label
1011
+ });
1012
+ };
1013
+
1014
+ // src/components/json-render/JsonLink.tsx
1015
+ import { jsx as jsx31 } from "react/jsx-runtime";
1016
+ var JsonLink = ({ props, on }) => {
1017
+ return /* @__PURE__ */ jsx31(ButtonLink2, {
1018
+ variant: "link",
1019
+ size: "inline",
1020
+ href: props.href ?? "#",
1021
+ onClick: (e) => {
1022
+ const press = on("press");
1023
+ if (press.shouldPreventDefault)
1024
+ e.preventDefault();
1025
+ press.emit();
1026
+ },
1027
+ children: props.label
1028
+ });
1029
+ };
1030
+
1031
+ // src/components/json-render/JsonDropdownMenu.tsx
1032
+ import { useBoundProp as useBoundProp9 } from "@json-render/react";
1033
+ import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
1034
+ var JsonDropdownMenu = ({ props, bindings, emit }) => {
1035
+ const items = props.items ?? [];
1036
+ const [, setBoundValue] = useBoundProp9(props.value ?? undefined, bindings?.value);
1037
+ return /* @__PURE__ */ jsxs21(DropdownMenu2, {
1038
+ children: [
1039
+ /* @__PURE__ */ jsx32(DropdownMenuTrigger2, {
1040
+ render: /* @__PURE__ */ jsx32(Button2, {
1041
+ variant: "outline"
1042
+ }),
1043
+ children: props.label
1044
+ }),
1045
+ /* @__PURE__ */ jsx32(DropdownMenuContent2, {
1046
+ children: items.map((item) => /* @__PURE__ */ jsx32(DropdownMenuItem2, {
1047
+ onClick: () => {
1048
+ setBoundValue(item.value);
1049
+ emit("select");
1050
+ },
1051
+ children: item.label
1052
+ }, item.value))
1053
+ })
1054
+ ]
1055
+ });
1056
+ };
1057
+
1058
+ // src/components/json-render/JsonToggle.tsx
1059
+ import { useState as useState10 } from "react";
1060
+ import { useBoundProp as useBoundProp10 } from "@json-render/react";
1061
+ import { jsx as jsx33 } from "react/jsx-runtime";
1062
+ var JsonToggle = ({ props, bindings, emit }) => {
1063
+ const [boundPressed, setBoundPressed] = useBoundProp10(props.pressed ?? undefined, bindings?.pressed);
1064
+ const [localPressed, setLocalPressed] = useState10(props.pressed ?? false);
1065
+ const isBound = !!bindings?.pressed;
1066
+ const pressed = isBound ? boundPressed ?? false : localPressed;
1067
+ const setPressed = isBound ? setBoundPressed : setLocalPressed;
1068
+ return /* @__PURE__ */ jsx33(Toggle2, {
1069
+ variant: props.variant ?? "default",
1070
+ pressed,
1071
+ onPressedChange: (v) => {
1072
+ setPressed(v);
1073
+ emit("change");
1074
+ },
1075
+ children: props.label
1076
+ });
1077
+ };
1078
+
1079
+ // src/components/json-render/JsonToggleGroup.tsx
1080
+ import { useState as useState11 } from "react";
1081
+ import { useBoundProp as useBoundProp11 } from "@json-render/react";
1082
+ import { jsx as jsx34 } from "react/jsx-runtime";
1083
+ var JsonToggleGroup = ({ props, bindings, emit }) => {
1084
+ const type = props.type ?? "single";
1085
+ const items = props.items ?? [];
1086
+ const [boundValue, setBoundValue] = useBoundProp11(props.value ?? undefined, bindings?.value);
1087
+ const [localValue, setLocalValue] = useState11(props.value ?? items[0]?.value ?? "");
1088
+ const isBound = !!bindings?.value;
1089
+ const value = isBound ? boundValue ?? "" : localValue;
1090
+ const setValue = isBound ? setBoundValue : setLocalValue;
1091
+ return /* @__PURE__ */ jsx34(ToggleGroup2, {
1092
+ multiple: type === "multiple",
1093
+ value: value ? value.split(",") : [],
1094
+ onValueChange: (values) => {
1095
+ setValue(values.join(","));
1096
+ emit("change");
1097
+ },
1098
+ children: items.map((item) => /* @__PURE__ */ jsx34(ToggleGroupItem2, {
1099
+ value: item.value,
1100
+ children: item.label
1101
+ }, item.value))
1102
+ });
1103
+ };
1104
+
1105
+ // src/components/json-render/JsonButtonGroup.tsx
1106
+ import { useState as useState12 } from "react";
1107
+ import { useBoundProp as useBoundProp12 } from "@json-render/react";
1108
+ import { jsx as jsx35 } from "react/jsx-runtime";
1109
+ var JsonButtonGroup = ({ props, bindings, emit }) => {
1110
+ const buttons = props.buttons ?? [];
1111
+ const [boundSelected, setBoundSelected] = useBoundProp12(props.selected ?? undefined, bindings?.selected);
1112
+ const [localValue, setLocalValue] = useState12(props.selected ?? buttons[0]?.value ?? "");
1113
+ const isBound = !!bindings?.selected;
1114
+ const value = isBound ? boundSelected ?? "" : localValue;
1115
+ const setValue = isBound ? setBoundSelected : setLocalValue;
1116
+ return /* @__PURE__ */ jsx35(ToggleGroup2, {
1117
+ variant: "outline",
1118
+ spacing: 0,
1119
+ value: value ? [value] : [],
1120
+ onValueChange: (values) => {
1121
+ setValue(values[0] ?? "");
1122
+ emit("change");
1123
+ },
1124
+ children: buttons.map((button) => /* @__PURE__ */ jsx35(ToggleGroupItem2, {
1125
+ value: button.value,
1126
+ children: button.label
1127
+ }, button.value))
1128
+ });
1129
+ };
1130
+
1131
+ // src/components/json-render/JsonPagination.tsx
1132
+ import { useState as useState13 } from "react";
1133
+ import { useBoundProp as useBoundProp13 } from "@json-render/react";
1134
+
1135
+ // src/components/json-render/getPaginationRange.ts
1136
+ function getPaginationRange(current, total) {
1137
+ if (total <= 7) {
1138
+ return Array.from({ length: total }, (_, i) => i + 1);
1139
+ }
1140
+ const pages = [];
1141
+ pages.push(1);
1142
+ if (current > 3) {
1143
+ pages.push("ellipsis");
1144
+ }
1145
+ const start = Math.max(2, current - 1);
1146
+ const end = Math.min(total - 1, current + 1);
1147
+ for (let i = start;i <= end; i++) {
1148
+ pages.push(i);
1149
+ }
1150
+ if (current < total - 2) {
1151
+ pages.push("ellipsis");
1152
+ }
1153
+ pages.push(total);
1154
+ return pages;
1155
+ }
1156
+
1157
+ // src/components/json-render/JsonPagination.tsx
1158
+ import { jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
1159
+ var JsonPagination = ({ props, bindings, emit }) => {
1160
+ const [boundPage, setBoundPage] = useBoundProp13(props.page ?? undefined, bindings?.page);
1161
+ const [localPage, setLocalPage] = useState13(props.page ?? 1);
1162
+ const currentPage = bindings?.page ? boundPage ?? 1 : localPage;
1163
+ const setPage = bindings?.page ? setBoundPage : setLocalPage;
1164
+ const totalPages = props.totalPages ?? 1;
1165
+ const pages = getPaginationRange(currentPage, totalPages);
1166
+ return /* @__PURE__ */ jsx36(Pagination2, {
1167
+ children: /* @__PURE__ */ jsxs22(PaginationContent2, {
1168
+ children: [
1169
+ /* @__PURE__ */ jsx36(PaginationItem2, {
1170
+ children: /* @__PURE__ */ jsx36(PaginationPrevious2, {
1171
+ href: "#",
1172
+ onClick: (e) => {
1173
+ e.preventDefault();
1174
+ if (currentPage > 1) {
1175
+ setPage(currentPage - 1);
1176
+ emit("change");
1177
+ }
1178
+ }
1179
+ })
1180
+ }),
1181
+ pages.map((page, idx) => page === "ellipsis" ? /* @__PURE__ */ jsx36(PaginationItem2, {
1182
+ children: /* @__PURE__ */ jsx36(PaginationEllipsis2, {})
1183
+ }, `ellipsis-${idx}`) : /* @__PURE__ */ jsx36(PaginationItem2, {
1184
+ children: /* @__PURE__ */ jsx36(PaginationLink2, {
1185
+ href: "#",
1186
+ isActive: page === currentPage,
1187
+ onClick: (e) => {
1188
+ e.preventDefault();
1189
+ setPage(page);
1190
+ emit("change");
1191
+ },
1192
+ children: page
1193
+ })
1194
+ }, page)),
1195
+ /* @__PURE__ */ jsx36(PaginationItem2, {
1196
+ children: /* @__PURE__ */ jsx36(PaginationNext2, {
1197
+ href: "#",
1198
+ onClick: (e) => {
1199
+ e.preventDefault();
1200
+ if (currentPage < totalPages) {
1201
+ setPage(currentPage + 1);
1202
+ emit("change");
1203
+ }
1204
+ }
1205
+ })
1206
+ })
1207
+ ]
1208
+ })
1209
+ });
1210
+ };
1211
+
1212
+ // src/components/json-render/index.ts
1213
+ var components = {
1214
+ Card: JsonCard,
1215
+ Stack: JsonStack,
1216
+ Grid: JsonGrid,
1217
+ Separator: JsonSeparator,
1218
+ Tabs: JsonTabs,
1219
+ Accordion: JsonAccordion,
1220
+ Collapsible: JsonCollapsible,
1221
+ Dialog: JsonDialog,
1222
+ Drawer: JsonDrawer,
1223
+ Carousel: JsonCarousel,
1224
+ Table: JsonTable,
1225
+ Heading: JsonHeading,
1226
+ Text: JsonText,
1227
+ Image: JsonImage,
1228
+ Avatar: JsonAvatar,
1229
+ Badge: JsonBadge,
1230
+ Alert: JsonAlert,
1231
+ Progress: JsonProgress,
1232
+ Skeleton: JsonSkeleton,
1233
+ Spinner: JsonSpinner,
1234
+ Tooltip: JsonTooltip,
1235
+ Popover: JsonPopover,
1236
+ Input: JsonInput,
1237
+ Textarea: JsonTextarea,
1238
+ Select: JsonSelect,
1239
+ Checkbox: JsonCheckbox,
1240
+ Radio: JsonRadio,
1241
+ Switch: JsonSwitch,
1242
+ Slider: JsonSlider,
1243
+ Button: JsonButton,
1244
+ Link: JsonLink,
1245
+ DropdownMenu: JsonDropdownMenu,
1246
+ Toggle: JsonToggle,
1247
+ ToggleGroup: JsonToggleGroup,
1248
+ ButtonGroup: JsonButtonGroup,
1249
+ Pagination: JsonPagination
1250
+ };
1251
+ export {
1252
+ componentDefinitions2 as componentDefinitions,
1253
+ components
1254
+ };