json-schema-builder-react 0.0.7 → 0.0.9

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-lib/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { jsx as e, jsxs as s, Fragment as le } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import { useContext as ke, createContext as Ie, useState as O, useEffect as Z, useMemo as Se, useCallback as E } from "react";
4
- import { Slot as Te } from "@radix-ui/react-slot";
5
- import { cva as de } from "class-variance-authority";
6
- import { clsx as De } from "clsx";
7
- import { twMerge as je } from "tailwind-merge";
8
- import { ChevronDown as ee, Check as oe, ChevronUp as qe, X as Le, Type as Pe, Hash as se, CheckSquare as Oe, Braces as Re, List as Ee, FileText as Fe, Plus as B, Pencil as ze, Trash2 as ce, CheckCircle2 as Be, Copy as Ae, Download as Me, ChevronRight as $e, Moon as Ke, Sun as Je, Upload as Ve } from "lucide-react";
1
+ import { jsx as e, jsxs as s, Fragment as me } from "react/jsx-runtime";
2
+ import * as x from "react";
3
+ import { useContext as Ee, createContext as Re, useState as q, useEffect as ae, useMemo as Le, useCallback as P } from "react";
4
+ import { Slot as je } from "@radix-ui/react-slot";
5
+ import { cva as ue } from "class-variance-authority";
6
+ import { clsx as qe } from "clsx";
7
+ import { twMerge as Oe } from "tailwind-merge";
8
+ import { ChevronDown as ie, Check as he, ChevronUp as Pe, X as Fe, Asterisk as oe, Type as ze, Hash as de, CheckSquare as Be, Braces as Ae, List as Me, FileText as $e, Plus as B, Pencil as Ke, Trash2 as fe, CheckCircle2 as Je, Copy as Ve, Download as He, ChevronRight as _e, Moon as Ue, Sun as Xe, Upload as Ge } from "lucide-react";
9
9
  import * as F from "@radix-ui/react-tooltip";
10
10
  import * as w from "@radix-ui/react-select";
11
- import * as P from "@radix-ui/react-dialog";
12
- import * as me from "@radix-ui/react-label";
13
- import * as V from "@radix-ui/react-checkbox";
14
- function p(...t) {
15
- return je(De(t));
11
+ import * as L from "@radix-ui/react-dialog";
12
+ import * as pe from "@radix-ui/react-label";
13
+ import * as U from "@radix-ui/react-checkbox";
14
+ function h(...t) {
15
+ return Oe(qe(t));
16
16
  }
17
- const He = de(
17
+ const Qe = ue(
18
18
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
19
19
  {
20
20
  variants: {
@@ -38,266 +38,266 @@ const He = de(
38
38
  size: "default"
39
39
  }
40
40
  }
41
- ), S = y.forwardRef(
42
- ({ className: t, variant: i, size: a, asChild: d = !1, ...n }, l) => /* @__PURE__ */ e(
43
- d ? Te : "button",
41
+ ), S = x.forwardRef(
42
+ ({ className: t, variant: i, size: a, asChild: l = !1, ...n }, o) => /* @__PURE__ */ e(
43
+ l ? je : "button",
44
44
  {
45
- className: p(He({ variant: i, size: a, className: t })),
46
- ref: l,
45
+ className: h(Qe({ variant: i, size: a, className: t })),
46
+ ref: o,
47
47
  ...n
48
48
  }
49
49
  )
50
50
  );
51
51
  S.displayName = "Button";
52
- const D = y.forwardRef(
53
- ({ className: t, type: i, ...a }, d) => /* @__PURE__ */ e(
52
+ const T = x.forwardRef(
53
+ ({ className: t, type: i, ...a }, l) => /* @__PURE__ */ e(
54
54
  "input",
55
55
  {
56
56
  type: i,
57
- className: p(
57
+ className: h(
58
58
  "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
59
59
  t
60
60
  ),
61
- ref: d,
61
+ ref: l,
62
62
  ...a
63
63
  }
64
64
  )
65
65
  );
66
- D.displayName = "Input";
67
- const _e = F.Provider, Ue = F.Root, Xe = F.Trigger, ue = y.forwardRef(({ className: t, sideOffset: i = 4, ...a }, d) => /* @__PURE__ */ e(F.Portal, { children: /* @__PURE__ */ e(
66
+ T.displayName = "Input";
67
+ const We = F.Provider, Ye = F.Root, Ze = F.Trigger, ge = x.forwardRef(({ className: t, sideOffset: i = 4, ...a }, l) => /* @__PURE__ */ e(F.Portal, { children: /* @__PURE__ */ e(
68
68
  F.Content,
69
69
  {
70
- ref: d,
70
+ ref: l,
71
71
  sideOffset: i,
72
- className: p(
72
+ className: h(
73
73
  "z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
74
74
  t
75
75
  ),
76
76
  ...a
77
77
  }
78
78
  ) }));
79
- ue.displayName = F.Content.displayName;
80
- const H = w.Root, _ = w.Value, $ = y.forwardRef(({ className: t, children: i, ...a }, d) => /* @__PURE__ */ s(
79
+ ge.displayName = F.Content.displayName;
80
+ const X = w.Root, G = w.Value, J = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
81
81
  w.Trigger,
82
82
  {
83
- ref: d,
84
- className: p(
83
+ ref: l,
84
+ className: h(
85
85
  "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
86
86
  t
87
87
  ),
88
88
  ...a,
89
89
  children: [
90
90
  i,
91
- /* @__PURE__ */ e(w.Icon, { asChild: !0, children: /* @__PURE__ */ e(ee, { className: "h-4 w-4 opacity-50" }) })
91
+ /* @__PURE__ */ e(w.Icon, { asChild: !0, children: /* @__PURE__ */ e(ie, { className: "h-4 w-4 opacity-50" }) })
92
92
  ]
93
93
  }
94
94
  ));
95
- $.displayName = w.Trigger.displayName;
96
- const he = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
95
+ J.displayName = w.Trigger.displayName;
96
+ const ye = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
97
97
  w.ScrollUpButton,
98
98
  {
99
99
  ref: a,
100
- className: p(
100
+ className: h(
101
101
  "flex cursor-default items-center justify-center py-1",
102
102
  t
103
103
  ),
104
104
  ...i,
105
- children: /* @__PURE__ */ e(qe, { className: "h-4 w-4" })
105
+ children: /* @__PURE__ */ e(Pe, { className: "h-4 w-4" })
106
106
  }
107
107
  ));
108
- he.displayName = w.ScrollUpButton.displayName;
109
- const fe = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
108
+ ye.displayName = w.ScrollUpButton.displayName;
109
+ const ve = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
110
110
  w.ScrollDownButton,
111
111
  {
112
112
  ref: a,
113
- className: p(
113
+ className: h(
114
114
  "flex cursor-default items-center justify-center py-1",
115
115
  t
116
116
  ),
117
117
  ...i,
118
- children: /* @__PURE__ */ e(ee, { className: "h-4 w-4" })
118
+ children: /* @__PURE__ */ e(ie, { className: "h-4 w-4" })
119
119
  }
120
120
  ));
121
- fe.displayName = w.ScrollDownButton.displayName;
122
- const K = y.forwardRef(({ className: t, children: i, position: a = "popper", ...d }, n) => /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ s(
121
+ ve.displayName = w.ScrollDownButton.displayName;
122
+ const V = x.forwardRef(({ className: t, children: i, position: a = "popper", ...l }, n) => /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ s(
123
123
  w.Content,
124
124
  {
125
125
  ref: n,
126
- className: p(
126
+ className: h(
127
127
  "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
128
128
  a === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
129
129
  t
130
130
  ),
131
131
  position: a,
132
- ...d,
132
+ ...l,
133
133
  children: [
134
- /* @__PURE__ */ e(he, {}),
134
+ /* @__PURE__ */ e(ye, {}),
135
135
  /* @__PURE__ */ e(
136
136
  w.Viewport,
137
137
  {
138
- className: p(
138
+ className: h(
139
139
  "p-1",
140
140
  a === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
141
141
  ),
142
142
  children: i
143
143
  }
144
144
  ),
145
- /* @__PURE__ */ e(fe, {})
145
+ /* @__PURE__ */ e(ve, {})
146
146
  ]
147
147
  }
148
148
  ) }));
149
- K.displayName = w.Content.displayName;
150
- const Ge = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
149
+ V.displayName = w.Content.displayName;
150
+ const et = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
151
151
  w.Label,
152
152
  {
153
153
  ref: a,
154
- className: p("px-2 py-1.5 text-sm font-semibold", t),
154
+ className: h("px-2 py-1.5 text-sm font-semibold", t),
155
155
  ...i
156
156
  }
157
157
  ));
158
- Ge.displayName = w.Label.displayName;
159
- const k = y.forwardRef(({ className: t, children: i, ...a }, d) => /* @__PURE__ */ s(
158
+ et.displayName = w.Label.displayName;
159
+ const I = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
160
160
  w.Item,
161
161
  {
162
- ref: d,
163
- className: p(
162
+ ref: l,
163
+ className: h(
164
164
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
165
165
  t
166
166
  ),
167
167
  ...a,
168
168
  children: [
169
- /* @__PURE__ */ e("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(w.ItemIndicator, { children: /* @__PURE__ */ e(oe, { className: "h-4 w-4" }) }) }),
169
+ /* @__PURE__ */ e("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(w.ItemIndicator, { children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) }) }),
170
170
  /* @__PURE__ */ e(w.ItemText, { children: i })
171
171
  ]
172
172
  }
173
173
  ));
174
- k.displayName = w.Item.displayName;
175
- const Qe = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
174
+ I.displayName = w.Item.displayName;
175
+ const tt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
176
176
  w.Separator,
177
177
  {
178
178
  ref: a,
179
- className: p("-mx-1 my-1 h-px bg-muted", t),
179
+ className: h("-mx-1 my-1 h-px bg-muted", t),
180
180
  ...i
181
181
  }
182
182
  ));
183
- Qe.displayName = w.Separator.displayName;
184
- const We = P.Root, Ye = P.Portal, pe = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
185
- P.Overlay,
183
+ tt.displayName = w.Separator.displayName;
184
+ const at = L.Root, it = L.Portal, xe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
185
+ L.Overlay,
186
186
  {
187
187
  ref: a,
188
- className: p(
188
+ className: h(
189
189
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
190
190
  t
191
191
  ),
192
192
  ...i
193
193
  }
194
194
  ));
195
- pe.displayName = P.Overlay.displayName;
196
- const ge = y.forwardRef(({ className: t, children: i, ...a }, d) => /* @__PURE__ */ s(Ye, { children: [
197
- /* @__PURE__ */ e(pe, {}),
195
+ xe.displayName = L.Overlay.displayName;
196
+ const be = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(it, { children: [
197
+ /* @__PURE__ */ e(xe, {}),
198
198
  /* @__PURE__ */ s(
199
- P.Content,
199
+ L.Content,
200
200
  {
201
- ref: d,
202
- className: p(
201
+ ref: l,
202
+ className: h(
203
203
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
204
204
  t
205
205
  ),
206
206
  ...a,
207
207
  children: [
208
208
  i,
209
- /* @__PURE__ */ s(P.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
210
- /* @__PURE__ */ e(Le, { className: "h-4 w-4" }),
209
+ /* @__PURE__ */ s(L.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
210
+ /* @__PURE__ */ e(Fe, { className: "h-4 w-4" }),
211
211
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
212
212
  ] })
213
213
  ]
214
214
  }
215
215
  )
216
216
  ] }));
217
- ge.displayName = P.Content.displayName;
218
- const ve = ({
217
+ be.displayName = L.Content.displayName;
218
+ const Ne = ({
219
219
  className: t,
220
220
  ...i
221
221
  }) => /* @__PURE__ */ e(
222
222
  "div",
223
223
  {
224
- className: p(
224
+ className: h(
225
225
  "flex flex-col space-y-1.5 text-center sm:text-left",
226
226
  t
227
227
  ),
228
228
  ...i
229
229
  }
230
230
  );
231
- ve.displayName = "DialogHeader";
232
- const ye = ({
231
+ Ne.displayName = "DialogHeader";
232
+ const we = ({
233
233
  className: t,
234
234
  ...i
235
235
  }) => /* @__PURE__ */ e(
236
236
  "div",
237
237
  {
238
- className: p(
238
+ className: h(
239
239
  "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
240
240
  t
241
241
  ),
242
242
  ...i
243
243
  }
244
244
  );
245
- ye.displayName = "DialogFooter";
246
- const xe = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
247
- P.Title,
245
+ we.displayName = "DialogFooter";
246
+ const Ce = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
247
+ L.Title,
248
248
  {
249
249
  ref: a,
250
- className: p(
250
+ className: h(
251
251
  "text-lg font-semibold leading-none tracking-tight",
252
252
  t
253
253
  ),
254
254
  ...i
255
255
  }
256
256
  ));
257
- xe.displayName = P.Title.displayName;
258
- const Ze = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
259
- P.Description,
257
+ Ce.displayName = L.Title.displayName;
258
+ const nt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
259
+ L.Description,
260
260
  {
261
261
  ref: a,
262
- className: p("text-sm text-muted-foreground", t),
262
+ className: h("text-sm text-muted-foreground", t),
263
263
  ...i
264
264
  }
265
265
  ));
266
- Ze.displayName = P.Description.displayName;
267
- const et = de(
266
+ nt.displayName = L.Description.displayName;
267
+ const st = ue(
268
268
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
269
- ), N = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
270
- me.Root,
269
+ ), N = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
270
+ pe.Root,
271
271
  {
272
272
  ref: a,
273
- className: p(et(), t),
273
+ className: h(st(), t),
274
274
  ...i
275
275
  }
276
276
  ));
277
- N.displayName = me.Root.displayName;
278
- const U = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
279
- V.Root,
277
+ N.displayName = pe.Root.displayName;
278
+ const Q = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
279
+ U.Root,
280
280
  {
281
281
  ref: a,
282
- className: p(
282
+ className: h(
283
283
  "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
284
284
  t
285
285
  ),
286
286
  ...i,
287
287
  children: /* @__PURE__ */ e(
288
- V.Indicator,
288
+ U.Indicator,
289
289
  {
290
- className: p("grid place-content-center text-current"),
291
- children: /* @__PURE__ */ e(oe, { className: "h-4 w-4" })
290
+ className: h("grid place-content-center text-current"),
291
+ children: /* @__PURE__ */ e(he, { className: "h-4 w-4" })
292
292
  }
293
293
  )
294
294
  }
295
295
  ));
296
- U.displayName = V.Root.displayName;
297
- const te = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
296
+ Q.displayName = U.Root.displayName;
297
+ const ne = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
298
298
  "textarea",
299
299
  {
300
- className: p(
300
+ className: h(
301
301
  "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
302
302
  t
303
303
  ),
@@ -305,33 +305,33 @@ const te = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
305
305
  ...i
306
306
  }
307
307
  ));
308
- te.displayName = "Textarea";
309
- const tt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_"), at = (t, i, a = !1, d = !1) => {
310
- const n = (c, o) => {
311
- i({ ...t, [c]: o });
308
+ ne.displayName = "Textarea";
309
+ const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_"), lt = (t, i, a = !1, l = !1) => {
310
+ const n = (p, g) => {
311
+ i({ ...t, [p]: g });
312
312
  };
313
313
  return {
314
- handleTitleChange: (c) => {
315
- n("title", c);
314
+ handleTitleChange: (p) => {
315
+ n("title", p);
316
316
  },
317
317
  handleTitleBlur: () => {
318
318
  if (a && t.title) {
319
- const c = tt(t.title);
320
- n("key", c);
319
+ const p = rt(t.title);
320
+ n("key", p);
321
321
  }
322
322
  },
323
- handleKeyChange: (c) => {
324
- (a || d) && n("key", c);
323
+ handleKeyChange: (p) => {
324
+ (a || l) && n("key", p);
325
325
  },
326
326
  handleFieldChange: n,
327
- handleConstraintChange: (c, o) => {
327
+ handleConstraintChange: (p, g) => {
328
328
  i({
329
329
  ...t,
330
- [c]: o
330
+ [p]: g
331
331
  });
332
332
  }
333
333
  };
334
- }, X = {
334
+ }, W = {
335
335
  string: "String",
336
336
  number: "Number",
337
337
  integer: "Integer",
@@ -340,60 +340,68 @@ const tt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g,
340
340
  array: "Array",
341
341
  null: "Null",
342
342
  file: "File"
343
- }, be = Ie({
344
- getTypeLabel: (t) => X[t],
345
- typeLabels: X
346
- });
347
- function it({
343
+ }, K = {
344
+ getTypeLabel: (t) => W[t],
345
+ typeLabels: W,
346
+ propertyLabel: { singular: "property", plural: "properties" },
347
+ showRegex: !1,
348
+ keyEditable: !1
349
+ }, ke = Re(K);
350
+ function ot({
348
351
  children: t,
349
- customLabels: i = {}
352
+ config: i = {}
350
353
  }) {
351
- const a = { ...X, ...i }, d = (n) => a[n] || n;
352
- return /* @__PURE__ */ e(be.Provider, { value: { getTypeLabel: d, typeLabels: a }, children: t });
354
+ const a = { ...W, ...i.typeLabels }, l = i.propertyLabel || K.propertyLabel, n = i.showRegex ?? K.showRegex, o = i.keyEditable ?? K.keyEditable, r = (m) => a[m] || m;
355
+ return /* @__PURE__ */ e(
356
+ ke.Provider,
357
+ {
358
+ value: { getTypeLabel: r, typeLabels: a, propertyLabel: l, showRegex: n, keyEditable: o },
359
+ children: t
360
+ }
361
+ );
353
362
  }
354
- function Ne() {
355
- return ke(be);
363
+ function Ie() {
364
+ return Ee(ke);
356
365
  }
357
- function G({
366
+ function Y({
358
367
  property: t,
359
368
  open: i,
360
369
  onOpenChange: a,
361
- onSave: d,
370
+ onSave: l,
362
371
  isArrayItem: n = !1,
363
- isNewProperty: l = !1,
364
- propertyLabel: r = { singular: "Property", plural: "Properties" },
365
- showRegex: u = !1,
366
- keyEditable: C = !1
372
+ isNewProperty: o = !1,
373
+ propertyLabel: r,
374
+ showRegex: m,
375
+ keyEditable: D,
376
+ typeLabels: p
367
377
  }) {
368
- var L;
369
- const { typeLabels: c } = Ne(), [o, v] = O(t);
370
- Z(() => {
371
- i && v(t);
378
+ const g = Ie(), u = p || g.typeLabels, b = r || g.propertyLabel, v = m ?? g.showRegex, y = D ?? g.keyEditable, [d, k] = q(t);
379
+ ae(() => {
380
+ i && k(t);
372
381
  }, [t, i]);
373
382
  const {
374
- handleTitleChange: x,
375
- handleTitleBlur: g,
383
+ handleTitleChange: E,
384
+ handleTitleBlur: R,
376
385
  handleKeyChange: f,
377
- handleFieldChange: I,
378
- handleConstraintChange: b
379
- } = at(
386
+ handleFieldChange: O,
387
+ handleConstraintChange: C
388
+ } = lt(
389
+ d,
390
+ k,
380
391
  o,
381
- v,
382
- l,
383
- C
384
- ), q = () => {
385
- var m;
386
- (m = o.title) != null && m.trim() && (d(o), a(!1));
387
- }, h = () => {
388
- v(t), a(!1);
392
+ y
393
+ ), H = () => {
394
+ d.title?.trim() && (l(d), a(!1));
395
+ }, _ = () => {
396
+ k(t), a(!1);
389
397
  };
390
- return /* @__PURE__ */ e(We, { open: i, onOpenChange: a, children: /* @__PURE__ */ s(
391
- ge,
398
+ return /* @__PURE__ */ e(at, { open: i, onOpenChange: a, children: /* @__PURE__ */ s(
399
+ be,
392
400
  {
393
401
  className: "max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0",
394
402
  "data-testid": "dialog-edit-property",
395
403
  children: [
396
- /* @__PURE__ */ e(ve, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(xe, { children: l ? `Add ${r.singular}` : `Edit ${r.singular}` }) }),
404
+ /* @__PURE__ */ e(Ne, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(Ce, { children: o ? `Add ${b.singular}` : `Edit ${b.singular}` }) }),
397
405
  /* @__PURE__ */ s("div", { className: "space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0", children: [
398
406
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
399
407
  /* @__PURE__ */ s(N, { className: "flex items-center gap-1.5", children: [
@@ -401,22 +409,22 @@ function G({
401
409
  "Type"
402
410
  ] }),
403
411
  /* @__PURE__ */ s(
404
- H,
412
+ X,
405
413
  {
406
- value: o.type,
407
- onValueChange: (m) => I("type", m),
414
+ value: d.type,
415
+ onValueChange: (c) => O("type", c),
408
416
  "data-testid": "select-type-dialog",
409
417
  children: [
410
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(_, {}) }),
411
- /* @__PURE__ */ s(K, { children: [
412
- /* @__PURE__ */ e(k, { value: "string", children: c.string }),
413
- /* @__PURE__ */ e(k, { value: "number", children: c.number }),
414
- /* @__PURE__ */ e(k, { value: "integer", children: c.integer }),
415
- /* @__PURE__ */ e(k, { value: "boolean", children: c.boolean }),
416
- /* @__PURE__ */ e(k, { value: "object", children: c.object }),
417
- /* @__PURE__ */ e(k, { value: "array", children: c.array }),
418
- /* @__PURE__ */ e(k, { value: "file", children: c.file }),
419
- /* @__PURE__ */ e(k, { value: "null", children: c.null })
418
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(G, {}) }),
419
+ /* @__PURE__ */ s(V, { children: [
420
+ /* @__PURE__ */ e(I, { value: "string", children: u.string }),
421
+ /* @__PURE__ */ e(I, { value: "number", children: u.number }),
422
+ /* @__PURE__ */ e(I, { value: "integer", children: u.integer }),
423
+ /* @__PURE__ */ e(I, { value: "boolean", children: u.boolean }),
424
+ /* @__PURE__ */ e(I, { value: "object", children: u.object }),
425
+ /* @__PURE__ */ e(I, { value: "array", children: u.array }),
426
+ /* @__PURE__ */ e(I, { value: "file", children: u.file }),
427
+ /* @__PURE__ */ e(I, { value: "null", children: u.null })
420
428
  ] })
421
429
  ]
422
430
  }
@@ -428,77 +436,77 @@ function G({
428
436
  "Title"
429
437
  ] }),
430
438
  /* @__PURE__ */ e(
431
- D,
439
+ T,
432
440
  {
433
- value: o.title || "",
434
- onChange: (m) => x(m.target.value),
435
- onBlur: g,
441
+ value: d.title || "",
442
+ onChange: (c) => E(c.target.value),
443
+ onBlur: R,
436
444
  placeholder: "Property Title",
437
445
  "data-testid": "input-title-dialog",
438
446
  required: !0
439
447
  }
440
448
  ),
441
- !l && o.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
449
+ !o && d.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
442
450
  "Key: ",
443
- o.key
451
+ d.key
444
452
  ] })
445
453
  ] }),
446
- (l || C) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
454
+ (o || y) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
447
455
  /* @__PURE__ */ e(N, { children: "Key" }),
448
456
  /* @__PURE__ */ e(
449
- D,
457
+ T,
450
458
  {
451
- value: o.key,
452
- onChange: (m) => f(m.target.value),
459
+ value: d.key,
460
+ onChange: (c) => f(c.target.value),
453
461
  placeholder: "property_key",
454
462
  "data-testid": "input-key-dialog"
455
463
  }
456
464
  ),
457
- !l && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
465
+ !o && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
458
466
  ] }),
459
467
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
460
468
  /* @__PURE__ */ e(N, { children: "Description" }),
461
469
  /* @__PURE__ */ e(
462
- te,
470
+ ne,
463
471
  {
464
472
  placeholder: "Optional description",
465
- value: o.description || "",
466
- onChange: (m) => I("description", m.target.value),
473
+ value: d.description || "",
474
+ onChange: (c) => O("description", c.target.value),
467
475
  rows: 2,
468
476
  "data-testid": "input-edit-description"
469
477
  }
470
478
  )
471
479
  ] }),
472
- o.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
480
+ d.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
473
481
  /* @__PURE__ */ s(N, { className: "font-semibold text-xs text-muted-foreground", children: [
474
- c.array,
482
+ u.array,
475
483
  " Items"
476
484
  ] }),
477
- o.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
485
+ d.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
478
486
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
479
487
  /* @__PURE__ */ e(N, { children: "Item Type" }),
480
488
  /* @__PURE__ */ s(
481
- H,
489
+ X,
482
490
  {
483
- value: o.items.type,
484
- onValueChange: (m) => v({
485
- ...o,
491
+ value: d.items.type,
492
+ onValueChange: (c) => k({
493
+ ...d,
486
494
  items: {
487
- ...o.items,
488
- type: m
495
+ ...d.items,
496
+ type: c
489
497
  }
490
498
  }),
491
499
  children: [
492
- /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(_, {}) }),
493
- /* @__PURE__ */ s(K, { children: [
494
- /* @__PURE__ */ e(k, { value: "string", children: c.string }),
495
- /* @__PURE__ */ e(k, { value: "number", children: c.number }),
496
- /* @__PURE__ */ e(k, { value: "integer", children: c.integer }),
497
- /* @__PURE__ */ e(k, { value: "boolean", children: c.boolean }),
498
- /* @__PURE__ */ e(k, { value: "object", children: c.object }),
499
- /* @__PURE__ */ e(k, { value: "array", children: c.array }),
500
- /* @__PURE__ */ e(k, { value: "file", children: c.file }),
501
- /* @__PURE__ */ e(k, { value: "null", children: c.null })
500
+ /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(G, {}) }),
501
+ /* @__PURE__ */ s(V, { children: [
502
+ /* @__PURE__ */ e(I, { value: "string", children: u.string }),
503
+ /* @__PURE__ */ e(I, { value: "number", children: u.number }),
504
+ /* @__PURE__ */ e(I, { value: "integer", children: u.integer }),
505
+ /* @__PURE__ */ e(I, { value: "boolean", children: u.boolean }),
506
+ /* @__PURE__ */ e(I, { value: "object", children: u.object }),
507
+ /* @__PURE__ */ e(I, { value: "array", children: u.array }),
508
+ /* @__PURE__ */ e(I, { value: "file", children: u.file }),
509
+ /* @__PURE__ */ e(I, { value: "null", children: u.null })
502
510
  ] })
503
511
  ]
504
512
  }
@@ -507,14 +515,14 @@ function G({
507
515
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
508
516
  /* @__PURE__ */ e(N, { children: "Item Title" }),
509
517
  /* @__PURE__ */ e(
510
- D,
518
+ T,
511
519
  {
512
- value: o.items.title || "",
513
- onChange: (m) => v({
514
- ...o,
520
+ value: d.items.title || "",
521
+ onChange: (c) => k({
522
+ ...d,
515
523
  items: {
516
- ...o.items,
517
- title: m.target.value
524
+ ...d.items,
525
+ title: c.target.value
518
526
  }
519
527
  }),
520
528
  placeholder: "Item Title"
@@ -527,10 +535,10 @@ function G({
527
535
  variant: "ghost",
528
536
  size: "sm",
529
537
  className: "mt-2",
530
- onClick: () => v({ ...o, items: void 0 }),
538
+ onClick: () => k({ ...d, items: void 0 }),
531
539
  children: [
532
540
  "Remove ",
533
- c.array,
541
+ u.array,
534
542
  " Item Schema"
535
543
  ]
536
544
  }
@@ -541,8 +549,8 @@ function G({
541
549
  variant: "outline",
542
550
  size: "sm",
543
551
  onClick: () => {
544
- v({
545
- ...o,
552
+ k({
553
+ ...d,
546
554
  items: {
547
555
  id: Date.now().toString() + Math.random(),
548
556
  key: "item",
@@ -553,7 +561,7 @@ function G({
553
561
  },
554
562
  children: [
555
563
  "Add ",
556
- c.array,
564
+ u.array,
557
565
  " Item Schema"
558
566
  ]
559
567
  }
@@ -561,19 +569,19 @@ function G({
561
569
  ] }),
562
570
  !n && /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
563
571
  /* @__PURE__ */ e(
564
- U,
572
+ Q,
565
573
  {
566
574
  id: "prop-required",
567
- checked: o.required,
568
- onCheckedChange: (m) => I("required", m),
575
+ checked: d.required,
576
+ onCheckedChange: (c) => O("required", c),
569
577
  "data-testid": "checkbox-edit-required"
570
578
  }
571
579
  ),
572
580
  /* @__PURE__ */ e(N, { htmlFor: "prop-required", className: "cursor-pointer", children: "Required field" })
573
581
  ] }),
574
- o.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
582
+ d.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
575
583
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
576
- c.string,
584
+ u.string,
577
585
  " Constraints"
578
586
  ] }) }),
579
587
  /* @__PURE__ */ s("div", { className: "space-y-4 p-4 pt-0", children: [
@@ -581,15 +589,15 @@ function G({
581
589
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
582
590
  /* @__PURE__ */ e(N, { htmlFor: "min-length", children: "Minimum Length" }),
583
591
  /* @__PURE__ */ e(
584
- D,
592
+ T,
585
593
  {
586
594
  id: "min-length",
587
595
  type: "number",
588
596
  placeholder: "0",
589
- value: o.minLength || "",
590
- onChange: (m) => b(
597
+ value: d.minLength || "",
598
+ onChange: (c) => C(
591
599
  "minLength",
592
- m.target.value ? parseInt(m.target.value) : void 0
600
+ c.target.value ? parseInt(c.target.value) : void 0
593
601
  ),
594
602
  "data-testid": "input-edit-minlength"
595
603
  }
@@ -598,30 +606,30 @@ function G({
598
606
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
599
607
  /* @__PURE__ */ e(N, { htmlFor: "max-length", children: "Maximum Length" }),
600
608
  /* @__PURE__ */ e(
601
- D,
609
+ T,
602
610
  {
603
611
  id: "max-length",
604
612
  type: "number",
605
613
  placeholder: "∞",
606
- value: o.maxLength || "",
607
- onChange: (m) => b(
614
+ value: d.maxLength || "",
615
+ onChange: (c) => C(
608
616
  "maxLength",
609
- m.target.value ? parseInt(m.target.value) : void 0
617
+ c.target.value ? parseInt(c.target.value) : void 0
610
618
  ),
611
619
  "data-testid": "input-edit-maxlength"
612
620
  }
613
621
  )
614
622
  ] })
615
623
  ] }),
616
- u && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
624
+ v && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
617
625
  /* @__PURE__ */ e(N, { htmlFor: "pattern", children: "Pattern (regex)" }),
618
626
  /* @__PURE__ */ e(
619
- D,
627
+ T,
620
628
  {
621
629
  id: "pattern",
622
630
  placeholder: "^[a-z]+$",
623
- value: o.pattern || "",
624
- onChange: (m) => b("pattern", m.target.value),
631
+ value: d.pattern || "",
632
+ onChange: (c) => C("pattern", c.target.value),
625
633
  className: "font-mono text-sm",
626
634
  "data-testid": "input-edit-pattern"
627
635
  }
@@ -629,57 +637,54 @@ function G({
629
637
  ] }),
630
638
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
631
639
  /* @__PURE__ */ e(N, { children: "Enum Values" }),
632
- /* @__PURE__ */ e("div", { className: "space-y-2", children: [...o.enum || [], ""].map((m, j) => {
633
- var A;
634
- return /* @__PURE__ */ e(
635
- D,
636
- {
637
- placeholder: j === (((A = o.enum) == null ? void 0 : A.length) || 0) ? "Add new value..." : "Enum value",
638
- value: m,
639
- onChange: (J) => {
640
- const T = J.target.value, R = o.enum || [];
641
- if (j === R.length)
642
- T.trim() && b("enum", [
643
- ...R,
644
- T.trim()
645
- ]);
646
- else if (T.trim()) {
647
- const z = [...R];
648
- z[j] = T.trim(), b("enum", z);
649
- } else {
650
- const z = R.filter(
651
- (vt, Ce) => Ce !== j
652
- );
653
- b(
654
- "enum",
655
- z.length > 0 ? z : void 0
656
- );
657
- }
658
- },
659
- "data-testid": `input-edit-enum-${j}`
640
+ /* @__PURE__ */ e("div", { className: "space-y-2", children: [...d.enum || [], ""].map((c, j) => /* @__PURE__ */ e(
641
+ T,
642
+ {
643
+ placeholder: j === (d.enum?.length || 0) ? "Add new value..." : "Enum value",
644
+ value: c,
645
+ onChange: (Te) => {
646
+ const A = Te.target.value, M = d.enum || [];
647
+ if (j === M.length)
648
+ A.trim() && C("enum", [
649
+ ...M,
650
+ A.trim()
651
+ ]);
652
+ else if (A.trim()) {
653
+ const z = [...M];
654
+ z[j] = A.trim(), C("enum", z);
655
+ } else {
656
+ const z = M.filter(
657
+ (wt, De) => De !== j
658
+ );
659
+ C(
660
+ "enum",
661
+ z.length > 0 ? z : void 0
662
+ );
663
+ }
660
664
  },
661
- j
662
- );
663
- }) }),
665
+ "data-testid": `input-edit-enum-${j}`
666
+ },
667
+ j
668
+ )) }),
664
669
  /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Enter allowed values (empty fields will be removed)" })
665
670
  ] })
666
671
  ] })
667
672
  ] }),
668
- (o.type === "number" || o.type === "integer") && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
673
+ (d.type === "number" || d.type === "integer") && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
669
674
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ e("h4", { className: "text-sm font-medium inline", children: "Numeric Constraints" }) }),
670
675
  /* @__PURE__ */ e("div", { className: "space-y-4 p-4 pt-0", children: /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
671
676
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
672
677
  /* @__PURE__ */ e(N, { htmlFor: "minimum", children: "Minimum Value" }),
673
678
  /* @__PURE__ */ e(
674
- D,
679
+ T,
675
680
  {
676
681
  id: "minimum",
677
682
  type: "number",
678
683
  placeholder: "-∞",
679
- value: o.minimum ?? "",
680
- onChange: (m) => b(
684
+ value: d.minimum ?? "",
685
+ onChange: (c) => C(
681
686
  "minimum",
682
- m.target.value ? parseFloat(m.target.value) : void 0
687
+ c.target.value ? parseFloat(c.target.value) : void 0
683
688
  ),
684
689
  "data-testid": "input-edit-minimum"
685
690
  }
@@ -688,15 +693,15 @@ function G({
688
693
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
689
694
  /* @__PURE__ */ e(N, { htmlFor: "maximum", children: "Maximum Value" }),
690
695
  /* @__PURE__ */ e(
691
- D,
696
+ T,
692
697
  {
693
698
  id: "maximum",
694
699
  type: "number",
695
700
  placeholder: "∞",
696
- value: o.maximum ?? "",
697
- onChange: (m) => b(
701
+ value: d.maximum ?? "",
702
+ onChange: (c) => C(
698
703
  "maximum",
699
- m.target.value ? parseFloat(m.target.value) : void 0
704
+ c.target.value ? parseFloat(c.target.value) : void 0
700
705
  ),
701
706
  "data-testid": "input-edit-maximum"
702
707
  }
@@ -704,9 +709,9 @@ function G({
704
709
  ] })
705
710
  ] }) })
706
711
  ] }),
707
- o.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
712
+ d.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
708
713
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
709
- c.array,
714
+ u.array,
710
715
  " Constraints"
711
716
  ] }) }),
712
717
  /* @__PURE__ */ s("div", { className: "space-y-4 p-4 pt-0", children: [
@@ -714,15 +719,15 @@ function G({
714
719
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
715
720
  /* @__PURE__ */ e(N, { htmlFor: "min-items", children: "Minimum Items" }),
716
721
  /* @__PURE__ */ e(
717
- D,
722
+ T,
718
723
  {
719
724
  id: "min-items",
720
725
  type: "number",
721
726
  placeholder: "0",
722
- value: o.minItems || "",
723
- onChange: (m) => b(
727
+ value: d.minItems || "",
728
+ onChange: (c) => C(
724
729
  "minItems",
725
- m.target.value ? parseInt(m.target.value) : void 0
730
+ c.target.value ? parseInt(c.target.value) : void 0
726
731
  ),
727
732
  "data-testid": "input-edit-minitems"
728
733
  }
@@ -731,15 +736,15 @@ function G({
731
736
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
732
737
  /* @__PURE__ */ e(N, { htmlFor: "max-items", children: "Maximum Items" }),
733
738
  /* @__PURE__ */ e(
734
- D,
739
+ T,
735
740
  {
736
741
  id: "max-items",
737
742
  type: "number",
738
743
  placeholder: "∞",
739
- value: o.maxItems || "",
740
- onChange: (m) => b(
744
+ value: d.maxItems || "",
745
+ onChange: (c) => C(
741
746
  "maxItems",
742
- m.target.value ? parseInt(m.target.value) : void 0
747
+ c.target.value ? parseInt(c.target.value) : void 0
743
748
  ),
744
749
  "data-testid": "input-edit-maxitems"
745
750
  }
@@ -748,11 +753,11 @@ function G({
748
753
  ] }),
749
754
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
750
755
  /* @__PURE__ */ e(
751
- U,
756
+ Q,
752
757
  {
753
758
  id: "unique-items",
754
- checked: o.uniqueItems || !1,
755
- onCheckedChange: (m) => b("uniqueItems", m),
759
+ checked: d.uniqueItems || !1,
760
+ onCheckedChange: (c) => C("uniqueItems", c),
756
761
  "data-testid": "checkbox-edit-unique"
757
762
  }
758
763
  ),
@@ -761,12 +766,12 @@ function G({
761
766
  ] })
762
767
  ] })
763
768
  ] }),
764
- /* @__PURE__ */ s(ye, { className: "px-6 py-4 border-t bg-background shrink-0", children: [
769
+ /* @__PURE__ */ s(we, { className: "px-6 py-4 border-t bg-background shrink-0", children: [
765
770
  /* @__PURE__ */ e(
766
771
  S,
767
772
  {
768
773
  variant: "outline",
769
- onClick: h,
774
+ onClick: _,
770
775
  "data-testid": "button-cancel",
771
776
  children: "Cancel"
772
777
  }
@@ -774,9 +779,9 @@ function G({
774
779
  /* @__PURE__ */ e(
775
780
  S,
776
781
  {
777
- onClick: q,
782
+ onClick: H,
778
783
  "data-testid": "button-save",
779
- disabled: !((L = o.title) != null && L.trim()),
784
+ disabled: !d.title?.trim(),
780
785
  children: "Save Changes"
781
786
  }
782
787
  )
@@ -785,42 +790,42 @@ function G({
785
790
  }
786
791
  ) });
787
792
  }
788
- function re(t, i, a = {}) {
789
- const { allowEmpty: d = !1, onEditStart: n, onEditCancel: l } = a, [r, u] = O(!1), [C, c] = O(t);
790
- Z(() => {
791
- r || c(t);
793
+ function ce(t, i, a = {}) {
794
+ const { allowEmpty: l = !1, onEditStart: n, onEditCancel: o } = a, [r, m] = q(!1), [D, p] = q(t);
795
+ ae(() => {
796
+ r || p(t);
792
797
  }, [t, r]);
793
- const o = () => {
794
- c(t), u(!0), n == null || n();
795
- }, v = (f) => {
796
- c(f);
797
- }, x = () => {
798
- const f = C.trim();
799
- if (!d && !f) {
800
- c(t), u(!1);
798
+ const g = () => {
799
+ p(t), m(!0), n?.();
800
+ }, u = (y) => {
801
+ p(y);
802
+ }, b = () => {
803
+ const y = D.trim();
804
+ if (!l && !y) {
805
+ p(t), m(!1);
801
806
  return;
802
807
  }
803
- f !== t && i(f), u(!1);
808
+ y !== t && i(y), m(!1);
804
809
  };
805
810
  return {
806
811
  isEditing: r,
807
- value: C,
808
- startEdit: o,
809
- handleChange: v,
810
- handleBlur: x,
811
- handleKeyDown: (f) => {
812
- f.key === "Enter" ? x() : f.key === "Escape" && (c(t), u(!1), l == null || l());
812
+ value: D,
813
+ startEdit: g,
814
+ handleChange: u,
815
+ handleBlur: b,
816
+ handleKeyDown: (y) => {
817
+ y.key === "Enter" ? b() : y.key === "Escape" && (p(t), m(!1), o?.());
813
818
  }
814
819
  };
815
820
  }
816
- function nt(t, i) {
817
- const [a, d] = O(!1);
821
+ function dt(t, i) {
822
+ const [a, l] = q(!1);
818
823
  return {
819
824
  isChangingType: a,
820
- setIsChangingType: d,
825
+ setIsChangingType: l,
821
826
  handleTypeChange: (r) => {
822
- const u = { ...t, type: r };
823
- r !== "string" && (delete u.minLength, delete u.maxLength, delete u.pattern, delete u.enum), r !== "number" && r !== "integer" && (delete u.minimum, delete u.maximum), r !== "array" && (delete u.minItems, delete u.maxItems, delete u.uniqueItems, delete u.items), r !== "object" && delete u.children, i(u), d(!1);
827
+ const m = { ...t, type: r };
828
+ r !== "string" && (delete m.minLength, delete m.maxLength, delete m.pattern, delete m.enum), r !== "number" && r !== "integer" && (delete m.minimum, delete m.maximum), r !== "array" && (delete m.minItems, delete m.maxItems, delete m.uniqueItems, delete m.items), r !== "object" && delete m.children, i(m), l(!1);
824
829
  },
825
830
  availableTypes: [
826
831
  "string",
@@ -833,52 +838,52 @@ function nt(t, i) {
833
838
  ]
834
839
  };
835
840
  }
836
- const ae = () => `${Date.now()}-${Math.random()}`;
837
- function ie(t = {}) {
838
- const { onConfirm: i, onCancel: a, createInitialData: d } = t, [n, l] = O(!1), [r, u] = O(null), C = (x) => {
839
- const g = x ?? (d ? d() : null);
840
- u(g), l(!0);
841
- }, c = () => {
842
- l(!1), u(null), a == null || a();
841
+ const se = () => `${Date.now()}-${Math.random()}`;
842
+ function re(t = {}) {
843
+ const { onConfirm: i, onCancel: a, createInitialData: l } = t, [n, o] = q(!1), [r, m] = q(null), D = (b) => {
844
+ const v = b ?? (l ? l() : null);
845
+ m(v), o(!0);
846
+ }, p = () => {
847
+ o(!1), m(null), a?.();
843
848
  };
844
849
  return {
845
850
  isOpen: n,
846
851
  data: r,
847
- open: C,
848
- close: c,
849
- confirm: (x) => {
850
- i == null || i(x), l(!1), u(null);
852
+ open: D,
853
+ close: p,
854
+ confirm: (b) => {
855
+ i?.(b), o(!1), m(null);
851
856
  },
852
- setIsOpen: (x) => {
853
- x ? l(!0) : c();
857
+ setIsOpen: (b) => {
858
+ b ? o(!0) : p();
854
859
  }
855
860
  };
856
861
  }
857
- function st(t, i) {
858
- const a = ie({
862
+ function ct(t, i) {
863
+ const a = re({
859
864
  createInitialData: () => ({
860
- id: ae(),
865
+ id: se(),
861
866
  key: "",
862
867
  type: "string",
863
868
  required: !1
864
869
  }),
865
- onConfirm: (l) => {
870
+ onConfirm: (o) => {
866
871
  i({
867
872
  ...t,
868
- children: [...t.children || [], l]
873
+ children: [...t.children || [], o]
869
874
  });
870
875
  }
871
876
  });
872
877
  return {
873
878
  addChild: () => a.open(),
874
- updateChild: (l, r) => {
875
- const u = t.children.map(
876
- (C) => C.id === l ? r : C
879
+ updateChild: (o, r) => {
880
+ const m = t.children.map(
881
+ (D) => D.id === o ? r : D
877
882
  );
878
- i({ ...t, children: u });
883
+ i({ ...t, children: m });
879
884
  },
880
- deleteChild: (l) => {
881
- const r = t.children.filter((u) => u.id !== l);
885
+ deleteChild: (o) => {
886
+ const r = t.children.filter((m) => m.id !== o);
882
887
  i({ ...t, children: r });
883
888
  },
884
889
  addChildDialog: {
@@ -889,31 +894,36 @@ function st(t, i) {
889
894
  }
890
895
  };
891
896
  }
892
- function Q({
897
+ function Z({
893
898
  property: t,
894
899
  onUpdate: i,
895
900
  onDelete: a,
896
- level: d = 1,
897
- isArrayItem: n = !1,
898
- showRegex: l = !1,
899
- keyEditable: r = !1
901
+ level: l = 1,
902
+ isArrayItem: n = !1
900
903
  }) {
901
- const { getTypeLabel: u, typeLabels: C } = Ne(), c = ie(), o = re(
904
+ const { getTypeLabel: o, typeLabels: r, showRegex: m, keyEditable: D } = Ie(), p = re(), g = ce(
902
905
  t.title || t.key || "",
903
- (h) => i({ ...t, title: h }),
906
+ (f) => i({ ...t, title: f }),
904
907
  { allowEmpty: !1 }
905
- ), v = re(
908
+ ), u = ce(
906
909
  t.description || "",
907
- (h) => i({ ...t, description: h || void 0 }),
910
+ (f) => i({ ...t, description: f || void 0 }),
908
911
  { allowEmpty: !0 }
909
- ), x = nt(t, i), g = st(t, i), f = `h${Math.min(d, 6)}`, I = t.type === "object", b = I && t.children && t.children.length > 0, q = {
912
+ ), b = dt(t, i), v = ct(t, i), y = `h${Math.min(l, 6)}`, d = t.type === "object", k = d && t.children && t.children.length > 0, E = {
910
913
  1: "text-lg font-semibold",
911
914
  2: "text-base",
912
915
  3: "text-base",
913
916
  4: "text-base",
914
917
  5: "text-sm",
915
918
  6: "text-sm"
916
- }[d] || "text-sm";
919
+ }[l] || "text-sm", R = {
920
+ 1: "h-5 w-5",
921
+ 2: "h-4 w-4",
922
+ 3: "h-4 w-4",
923
+ 4: "h-4 w-4",
924
+ 5: "h-4 w-4",
925
+ 6: "h-4 w-4"
926
+ }[l] || "h-5 w-5";
917
927
  return /* @__PURE__ */ s("div", { className: "group", children: [
918
928
  /* @__PURE__ */ s("div", { className: "flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50", children: [
919
929
  /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
@@ -921,64 +931,126 @@ function Q({
921
931
  "button",
922
932
  {
923
933
  onClick: () => i({ ...t, required: !t.required }),
924
- className: "shrink-0 transition-all hover:scale-110 mt-0.5",
934
+ className: "shrink-0 transition-all hover:scale-110 -mt-[3px]",
925
935
  title: t.required ? "Required field - click to make optional" : "Optional field - click to make required",
926
- children: t.required ? /* @__PURE__ */ e("span", { className: "block w-4 h-4 rounded-full bg-primary" }) : /* @__PURE__ */ e("span", { className: "block w-4 h-4 rounded-full border border-dashed border-gray-400" })
936
+ children: t.required ? (
937
+ // <span className="block w-4 h-4 rounded-full bg-primary"></span>
938
+ /* @__PURE__ */ e(oe, { className: "w-6 h-6 text-primary" })
939
+ ) : (
940
+ // <span className="block w-4 h-4 rounded-full border border-dashed border-gray-400"></span>
941
+ /* @__PURE__ */ e(oe, { className: "w-6 h-6 text-border" })
942
+ )
927
943
  }
928
944
  ),
929
- o.isEditing ? /* @__PURE__ */ e(
930
- D,
945
+ g.isEditing ? /* @__PURE__ */ e(
946
+ T,
931
947
  {
932
- value: o.value,
933
- onChange: (h) => o.handleChange(h.target.value),
934
- onBlur: o.handleBlur,
935
- onKeyDown: o.handleKeyDown,
948
+ value: g.value,
949
+ onChange: (f) => g.handleChange(f.target.value),
950
+ onBlur: g.handleBlur,
951
+ onKeyDown: g.handleKeyDown,
936
952
  autoFocus: !0,
937
- className: q,
953
+ className: E,
938
954
  placeholder: "Enter title"
939
955
  }
940
956
  ) : /* @__PURE__ */ s("div", { className: "flex gap-2 flex-wrap flex-1", children: [
941
957
  /* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
942
958
  /* @__PURE__ */ e(
943
- f,
959
+ y,
944
960
  {
945
- className: `${q} cursor-pointer hover:text-primary transition-colors leading-none`,
946
- onClick: o.startEdit,
961
+ className: `${E} cursor-pointer hover:text-primary transition-colors leading-none`,
962
+ onClick: g.startEdit,
947
963
  children: t.title || t.key || /* @__PURE__ */ e("span", { className: "text-muted-foreground italic", children: "unnamed" })
948
964
  }
949
965
  ),
950
- x.isChangingType ? /* @__PURE__ */ s(
951
- H,
966
+ b.isChangingType ? /* @__PURE__ */ s(
967
+ X,
952
968
  {
953
969
  value: t.type,
954
- onValueChange: (h) => x.handleTypeChange(h),
955
- open: x.isChangingType,
956
- onOpenChange: x.setIsChangingType,
970
+ onValueChange: (f) => b.handleTypeChange(f),
971
+ open: b.isChangingType,
972
+ onOpenChange: b.setIsChangingType,
957
973
  children: [
958
- /* @__PURE__ */ e($, { className: "w-[140px] h-7", children: /* @__PURE__ */ e(_, {}) }),
959
- /* @__PURE__ */ e(K, { children: x.availableTypes.map((h) => /* @__PURE__ */ e(k, { value: h, children: C[h] }, h)) })
974
+ /* @__PURE__ */ e(J, { className: "w-[140px] h-7", children: /* @__PURE__ */ e(G, {}) }),
975
+ /* @__PURE__ */ e(V, { children: b.availableTypes.map((f) => /* @__PURE__ */ e(I, { value: f, children: r[f] }, f)) })
960
976
  ]
961
977
  }
962
- ) : /* @__PURE__ */ e(_e, { children: /* @__PURE__ */ s(Ue, { children: [
963
- /* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ s(
978
+ ) : /* @__PURE__ */ e(We, { children: /* @__PURE__ */ s(Ye, { children: [
979
+ /* @__PURE__ */ e(Ze, { asChild: !0, children: /* @__PURE__ */ s(
964
980
  "button",
965
981
  {
966
- onClick: () => x.setIsChangingType(!0),
967
- className: "cursor-pointer hover:bg-accent rounded p-0.5 transition-colors",
982
+ onClick: () => b.setIsChangingType(!0),
983
+ className: "cursor-pointer hover:bg-accent rounded p-0.5 -mt-0.5 transition-colors",
968
984
  children: [
969
- t.type === "string" && /* @__PURE__ */ e(Pe, { className: "w-5 h-5 text-muted-foreground" }),
970
- t.type === "number" && /* @__PURE__ */ e(se, { className: "w-5 h-5 text-muted-foreground" }),
971
- t.type === "integer" && /* @__PURE__ */ e(se, { className: "w-5 h-5 text-muted-foreground" }),
972
- t.type === "boolean" && /* @__PURE__ */ e(Oe, { className: "w-5 h-5 text-muted-foreground" }),
973
- t.type === "object" && /* @__PURE__ */ e(Re, { className: "w-5 h-5 text-muted-foreground" }),
974
- t.type === "array" && /* @__PURE__ */ e(Ee, { className: "w-5 h-5 text-muted-foreground" }),
975
- t.type === "file" && /* @__PURE__ */ e(Fe, { className: "w-5 h-5 text-muted-foreground" })
985
+ t.type === "string" && /* @__PURE__ */ e(
986
+ ze,
987
+ {
988
+ className: h(
989
+ R,
990
+ "text-muted-foreground"
991
+ )
992
+ }
993
+ ),
994
+ t.type === "number" && /* @__PURE__ */ e(
995
+ de,
996
+ {
997
+ className: h(
998
+ R,
999
+ "text-muted-foreground"
1000
+ )
1001
+ }
1002
+ ),
1003
+ t.type === "integer" && /* @__PURE__ */ e(
1004
+ de,
1005
+ {
1006
+ className: h(
1007
+ R,
1008
+ "text-muted-foreground"
1009
+ )
1010
+ }
1011
+ ),
1012
+ t.type === "boolean" && /* @__PURE__ */ e(
1013
+ Be,
1014
+ {
1015
+ className: h(
1016
+ R,
1017
+ "text-muted-foreground"
1018
+ )
1019
+ }
1020
+ ),
1021
+ t.type === "object" && /* @__PURE__ */ e(
1022
+ Ae,
1023
+ {
1024
+ className: h(
1025
+ R,
1026
+ "text-muted-foreground"
1027
+ )
1028
+ }
1029
+ ),
1030
+ t.type === "array" && /* @__PURE__ */ e(
1031
+ Me,
1032
+ {
1033
+ className: h(
1034
+ R,
1035
+ "text-muted-foreground"
1036
+ )
1037
+ }
1038
+ ),
1039
+ t.type === "file" && /* @__PURE__ */ e(
1040
+ $e,
1041
+ {
1042
+ className: h(
1043
+ R,
1044
+ "text-muted-foreground"
1045
+ )
1046
+ }
1047
+ )
976
1048
  ]
977
1049
  }
978
1050
  ) }),
979
- /* @__PURE__ */ s(ue, { children: [
980
- u(t.type),
981
- t.type === "array" && t.items ? ` of ${u(t.items.type)}` : "",
1051
+ /* @__PURE__ */ s(ge, { children: [
1052
+ o(t.type),
1053
+ t.type === "array" && t.items ? ` of ${o(t.items.type)}` : "",
982
1054
  /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground mt-1", children: "Click to change type" })
983
1055
  ] })
984
1056
  ] }) }),
@@ -987,37 +1059,37 @@ function Q({
987
1059
  {
988
1060
  variant: "ghost",
989
1061
  size: "icon",
990
- className: "opacity-0 group-hover:opacity-100 h-6 w-6",
991
- onClick: g.addChild,
1062
+ className: "h-4 w-4",
1063
+ onClick: v.addChild,
992
1064
  "data-testid": `button-add-child-${t.id}`,
993
- children: /* @__PURE__ */ e(B, { className: "!w-5 !h-5" })
1065
+ children: /* @__PURE__ */ e(B, {})
994
1066
  }
995
1067
  )
996
1068
  ] }),
997
- /* @__PURE__ */ e("div", { className: "flex-1", children: v.isEditing ? /* @__PURE__ */ e(
998
- D,
1069
+ /* @__PURE__ */ e("div", { className: "flex-1", children: u.isEditing ? /* @__PURE__ */ e(
1070
+ T,
999
1071
  {
1000
- value: v.value,
1001
- onChange: (h) => v.handleChange(h.target.value),
1002
- onBlur: v.handleBlur,
1003
- onKeyDown: v.handleKeyDown,
1072
+ value: u.value,
1073
+ onChange: (f) => u.handleChange(f.target.value),
1074
+ onBlur: u.handleBlur,
1075
+ onKeyDown: u.handleKeyDown,
1004
1076
  autoFocus: !0,
1005
1077
  className: "text-sm flex-1",
1006
1078
  placeholder: "Enter description"
1007
1079
  }
1008
- ) : /* @__PURE__ */ e(le, { children: t.description ? /* @__PURE__ */ e(
1080
+ ) : /* @__PURE__ */ e(me, { children: t.description ? /* @__PURE__ */ e(
1009
1081
  "p",
1010
1082
  {
1011
1083
  className: "text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors",
1012
1084
  "data-testid": `text-description-${t.id}`,
1013
- onClick: v.startEdit,
1085
+ onClick: u.startEdit,
1014
1086
  children: t.description
1015
1087
  }
1016
1088
  ) : /* @__PURE__ */ e(
1017
1089
  "p",
1018
1090
  {
1019
1091
  className: "text-sm text-muted-foreground/50 flex-1 min-w-[200px] cursor-pointer hover:text-muted-foreground italic transition-colors",
1020
- onClick: v.startEdit,
1092
+ onClick: u.startEdit,
1021
1093
  children: "Add description..."
1022
1094
  }
1023
1095
  ) }) })
@@ -1030,18 +1102,18 @@ function Q({
1030
1102
  variant: "ghost",
1031
1103
  size: "icon",
1032
1104
  className: "h-7 w-7",
1033
- onClick: () => c.open(t),
1105
+ onClick: () => p.open(t),
1034
1106
  "data-testid": `button-edit-${t.id}`,
1035
- children: /* @__PURE__ */ e(ze, { className: "w-3 h-3" })
1107
+ children: /* @__PURE__ */ e(Ke, { className: "w-3 h-3" })
1036
1108
  }
1037
1109
  ),
1038
- I && t.type !== "object" && /* @__PURE__ */ e(
1110
+ d && t.type !== "object" && /* @__PURE__ */ e(
1039
1111
  S,
1040
1112
  {
1041
1113
  variant: "ghost",
1042
1114
  size: "icon",
1043
1115
  className: "h-7 w-7",
1044
- onClick: g.addChild,
1116
+ onClick: v.addChild,
1045
1117
  "data-testid": `button-add-child-${t.id}`,
1046
1118
  children: /* @__PURE__ */ e(B, { className: "w-3 h-3" })
1047
1119
  }
@@ -1054,158 +1126,145 @@ function Q({
1054
1126
  className: "h-7 w-7 text-muted-foreground hover:text-destructive",
1055
1127
  onClick: a,
1056
1128
  "data-testid": `button-delete-${t.id}`,
1057
- children: /* @__PURE__ */ e(ce, { className: "w-3 h-3" })
1129
+ children: /* @__PURE__ */ e(fe, { className: "w-3 h-3" })
1058
1130
  }
1059
1131
  )
1060
1132
  ] })
1061
1133
  ] }),
1062
- b && /* @__PURE__ */ e(
1134
+ k && /* @__PURE__ */ e(
1063
1135
  "div",
1064
1136
  {
1065
- className: d === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1066
- children: t.children.map((h) => /* @__PURE__ */ e(
1067
- Q,
1137
+ className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1138
+ children: t.children.map((f) => /* @__PURE__ */ e(
1139
+ Z,
1068
1140
  {
1069
- property: h,
1070
- onUpdate: (L) => g.updateChild(h.id, L),
1071
- onDelete: () => g.deleteChild(h.id),
1072
- level: d + 1,
1073
- showRegex: l,
1074
- keyEditable: r
1141
+ property: f,
1142
+ onUpdate: (O) => v.updateChild(f.id, O),
1143
+ onDelete: () => v.deleteChild(f.id),
1144
+ level: l + 1
1075
1145
  },
1076
- h.id
1146
+ f.id
1077
1147
  ))
1078
1148
  }
1079
1149
  ),
1080
1150
  t.type === "array" && t.items && /* @__PURE__ */ s(
1081
1151
  "div",
1082
1152
  {
1083
- className: d === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1153
+ className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1084
1154
  children: [
1085
1155
  /* @__PURE__ */ s("div", { className: "mb-2 text-xs text-muted-foreground font-semibold uppercase", children: [
1086
- u("array"),
1156
+ o("array"),
1087
1157
  " Items"
1088
1158
  ] }),
1089
1159
  /* @__PURE__ */ e(
1090
- Q,
1160
+ Z,
1091
1161
  {
1092
1162
  property: t.items,
1093
- onUpdate: (h) => i({ ...t, items: h }),
1163
+ onUpdate: (f) => i({ ...t, items: f }),
1094
1164
  onDelete: () => i({ ...t, items: void 0 }),
1095
- level: d + 1,
1096
- isArrayItem: !0,
1097
- showRegex: l,
1098
- keyEditable: r
1165
+ level: l + 1,
1166
+ isArrayItem: !0
1099
1167
  }
1100
1168
  )
1101
1169
  ]
1102
1170
  }
1103
1171
  ),
1104
1172
  /* @__PURE__ */ e(
1105
- G,
1173
+ Y,
1106
1174
  {
1107
- property: c.data || t,
1108
- open: c.isOpen,
1109
- onOpenChange: c.setIsOpen,
1110
- onSave: (h) => {
1111
- i(h), c.close();
1175
+ property: p.data || t,
1176
+ open: p.isOpen,
1177
+ onOpenChange: p.setIsOpen,
1178
+ onSave: (f) => {
1179
+ i(f), p.close();
1112
1180
  },
1113
1181
  isArrayItem: n,
1114
- isNewProperty: !1,
1115
- showRegex: l,
1116
- keyEditable: r
1182
+ isNewProperty: !1
1117
1183
  }
1118
1184
  ),
1119
- g.addChildDialog.isOpen && g.addChildDialog.data && /* @__PURE__ */ e(
1120
- G,
1185
+ v.addChildDialog.isOpen && v.addChildDialog.data && /* @__PURE__ */ e(
1186
+ Y,
1121
1187
  {
1122
- property: g.addChildDialog.data,
1123
- open: g.addChildDialog.isOpen,
1188
+ property: v.addChildDialog.data,
1189
+ open: v.addChildDialog.isOpen,
1124
1190
  isNewProperty: !0,
1125
- onOpenChange: g.addChildDialog.setIsOpen,
1126
- onSave: g.addChildDialog.confirm,
1127
- showRegex: l,
1128
- keyEditable: r
1191
+ onOpenChange: v.addChildDialog.setIsOpen,
1192
+ onSave: v.addChildDialog.confirm
1129
1193
  }
1130
1194
  )
1131
1195
  ] });
1132
1196
  }
1133
- const ne = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1197
+ const le = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1134
1198
  "div",
1135
1199
  {
1136
1200
  ref: a,
1137
- className: p(
1138
- "rounded-xl border bg-card text-card-foreground shadow",
1139
- t
1140
- ),
1201
+ className: h("rounded-xl border bg-card text-card-foreground", t),
1141
1202
  ...i
1142
1203
  }
1143
1204
  ));
1144
- ne.displayName = "Card";
1145
- const rt = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1205
+ le.displayName = "Card";
1206
+ const mt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1146
1207
  "div",
1147
1208
  {
1148
1209
  ref: a,
1149
- className: p("flex flex-col space-y-1.5 p-6", t),
1210
+ className: h("flex flex-col space-y-1.5 p-6", t),
1150
1211
  ...i
1151
1212
  }
1152
1213
  ));
1153
- rt.displayName = "CardHeader";
1154
- const lt = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1214
+ mt.displayName = "CardHeader";
1215
+ const ut = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1155
1216
  "div",
1156
1217
  {
1157
1218
  ref: a,
1158
- className: p("font-semibold leading-none tracking-tight", t),
1219
+ className: h("font-semibold leading-none tracking-tight", t),
1159
1220
  ...i
1160
1221
  }
1161
1222
  ));
1162
- lt.displayName = "CardTitle";
1163
- const dt = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1223
+ ut.displayName = "CardTitle";
1224
+ const ht = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1164
1225
  "div",
1165
1226
  {
1166
1227
  ref: a,
1167
- className: p("text-sm text-muted-foreground", t),
1228
+ className: h("text-sm text-muted-foreground", t),
1168
1229
  ...i
1169
1230
  }
1170
1231
  ));
1171
- dt.displayName = "CardDescription";
1172
- const ot = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e("div", { ref: a, className: p("p-6 pt-0", t), ...i }));
1173
- ot.displayName = "CardContent";
1174
- const ct = y.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1232
+ ht.displayName = "CardDescription";
1233
+ const ft = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e("div", { ref: a, className: h("p-6 pt-0", t), ...i }));
1234
+ ft.displayName = "CardContent";
1235
+ const pt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1175
1236
  "div",
1176
1237
  {
1177
1238
  ref: a,
1178
- className: p("flex items-center p-6 pt-0", t),
1239
+ className: h("flex items-center p-6 pt-0", t),
1179
1240
  ...i
1180
1241
  }
1181
1242
  ));
1182
- ct.displayName = "CardFooter";
1183
- const mt = () => new Promise((t, i) => {
1243
+ pt.displayName = "CardFooter";
1244
+ const gt = () => new Promise((t, i) => {
1184
1245
  const a = document.createElement("input");
1185
- a.type = "file", a.accept = ".json", a.onchange = (d) => {
1186
- var r;
1187
- const n = (r = d.target.files) == null ? void 0 : r[0];
1246
+ a.type = "file", a.accept = ".json", a.onchange = (l) => {
1247
+ const n = l.target.files?.[0];
1188
1248
  if (!n) {
1189
1249
  i(new Error("No file selected"));
1190
1250
  return;
1191
1251
  }
1192
- const l = new FileReader();
1193
- l.onload = (u) => {
1194
- var C;
1252
+ const o = new FileReader();
1253
+ o.onload = (r) => {
1195
1254
  try {
1196
- const c = JSON.parse((C = u.target) == null ? void 0 : C.result);
1197
- t(c);
1255
+ const m = JSON.parse(r.target?.result);
1256
+ t(m);
1198
1257
  } catch {
1199
1258
  i(new Error("Invalid JSON file"));
1200
1259
  }
1201
- }, l.onerror = () => i(new Error("Failed to read file")), l.readAsText(n);
1260
+ }, o.onerror = () => i(new Error("Failed to read file")), o.readAsText(n);
1202
1261
  }, a.click();
1203
- }), we = (t, i = "schema.json") => {
1204
- const a = JSON.stringify(t, null, 2), d = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(d), l = document.createElement("a");
1205
- l.href = n, l.download = i, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(n);
1262
+ }), Se = (t, i = "schema.json") => {
1263
+ const a = JSON.stringify(t, null, 2), l = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(l), o = document.createElement("a");
1264
+ o.href = n, o.download = i, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(n);
1206
1265
  };
1207
- function ut({ schema: t }) {
1208
- const [i, a] = O(!1), d = JSON.stringify(t, null, 2);
1266
+ function yt({ schema: t }) {
1267
+ const [i, a] = q(!1), l = JSON.stringify(t, null, 2);
1209
1268
  return /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1210
1269
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between p-4 border-b", children: [
1211
1270
  /* @__PURE__ */ e("h2", { className: "text-sm font-medium", children: "JSON Schema Output" }),
@@ -1216,10 +1275,10 @@ function ut({ schema: t }) {
1216
1275
  variant: "outline",
1217
1276
  size: "sm",
1218
1277
  onClick: async () => {
1219
- await navigator.clipboard.writeText(d), a(!0), setTimeout(() => a(!1), 2e3);
1278
+ await navigator.clipboard.writeText(l), a(!0), setTimeout(() => a(!1), 2e3);
1220
1279
  },
1221
1280
  "data-testid": "button-copy",
1222
- children: i ? /* @__PURE__ */ e(Be, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Ae, { className: "w-4 h-4" })
1281
+ children: i ? /* @__PURE__ */ e(Je, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Ve, { className: "w-4 h-4" })
1223
1282
  }
1224
1283
  ),
1225
1284
  /* @__PURE__ */ e(
@@ -1228,42 +1287,42 @@ function ut({ schema: t }) {
1228
1287
  variant: "outline",
1229
1288
  size: "sm",
1230
1289
  onClick: () => {
1231
- we(t, "schema.json");
1290
+ Se(t, "schema.json");
1232
1291
  },
1233
1292
  "data-testid": "button-download",
1234
- children: /* @__PURE__ */ e(Me, { className: "w-4 h-4" })
1293
+ children: /* @__PURE__ */ e(He, { className: "w-4 h-4" })
1235
1294
  }
1236
1295
  )
1237
1296
  ] })
1238
1297
  ] }),
1239
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(ne, { className: "m-4 bg-muted/30", children: /* @__PURE__ */ e(
1298
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(le, { className: "m-4 bg-muted/30", children: /* @__PURE__ */ e(
1240
1299
  "pre",
1241
1300
  {
1242
1301
  className: "p-6 text-xs font-mono overflow-auto",
1243
1302
  "data-testid": "text-json-output",
1244
- children: /* @__PURE__ */ e("code", { children: d })
1303
+ children: /* @__PURE__ */ e("code", { children: l })
1245
1304
  }
1246
1305
  ) }) })
1247
1306
  ] });
1248
1307
  }
1249
- function ht({
1308
+ function vt({
1250
1309
  title: t,
1251
1310
  description: i,
1252
1311
  version: a,
1253
- onUpdate: d
1312
+ onUpdate: l
1254
1313
  }) {
1255
- const [n, l] = O(!1);
1256
- return /* @__PURE__ */ s(ne, { className: "p-4", children: [
1314
+ const [n, o] = q(!1);
1315
+ return /* @__PURE__ */ s(le, { className: "p-4", children: [
1257
1316
  /* @__PURE__ */ s(
1258
1317
  S,
1259
1318
  {
1260
1319
  variant: "ghost",
1261
- onClick: () => l(!n),
1320
+ onClick: () => o(!n),
1262
1321
  className: "w-full justify-between px-2 h-auto hover:bg-transparent",
1263
1322
  "data-testid": "button-toggle-metadata",
1264
1323
  children: [
1265
1324
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium", children: "Schema Metadata" }),
1266
- n ? /* @__PURE__ */ e(ee, { className: "w-4 h-4" }) : /* @__PURE__ */ e($e, { className: "w-4 h-4" })
1325
+ n ? /* @__PURE__ */ e(ie, { className: "w-4 h-4" }) : /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
1267
1326
  ]
1268
1327
  }
1269
1328
  ),
@@ -1278,12 +1337,12 @@ function ht({
1278
1337
  }
1279
1338
  ),
1280
1339
  /* @__PURE__ */ e(
1281
- D,
1340
+ T,
1282
1341
  {
1283
1342
  id: "schema-title",
1284
1343
  placeholder: "My Schema",
1285
1344
  value: t,
1286
- onChange: (r) => d("title", r.target.value),
1345
+ onChange: (r) => l("title", r.target.value),
1287
1346
  "data-testid": "input-title"
1288
1347
  }
1289
1348
  )
@@ -1298,12 +1357,12 @@ function ht({
1298
1357
  }
1299
1358
  ),
1300
1359
  /* @__PURE__ */ e(
1301
- te,
1360
+ ne,
1302
1361
  {
1303
1362
  id: "schema-description",
1304
1363
  placeholder: "Describe your schema...",
1305
1364
  value: i,
1306
- onChange: (r) => d("description", r.target.value),
1365
+ onChange: (r) => l("description", r.target.value),
1307
1366
  className: "resize-none",
1308
1367
  rows: 3,
1309
1368
  "data-testid": "input-schema-description"
@@ -1320,12 +1379,12 @@ function ht({
1320
1379
  }
1321
1380
  ),
1322
1381
  /* @__PURE__ */ e(
1323
- D,
1382
+ T,
1324
1383
  {
1325
1384
  id: "schema-version",
1326
1385
  placeholder: "1.0.0",
1327
1386
  value: a,
1328
- onChange: (r) => d("version", r.target.value),
1387
+ onChange: (r) => l("version", r.target.value),
1329
1388
  "data-testid": "input-version"
1330
1389
  }
1331
1390
  )
@@ -1333,30 +1392,30 @@ function ht({
1333
1392
  ] })
1334
1393
  ] });
1335
1394
  }
1336
- const M = (t, i, a = !0) => {
1337
- const d = {
1395
+ const $ = (t, i, a = !0) => {
1396
+ const l = {
1338
1397
  type: "object"
1339
1398
  };
1340
- a && i && (i.title && (d.title = i.title), i.description && (d.description = i.description));
1341
- const n = W(t);
1342
- Object.keys(n).length > 0 && (d.properties = n);
1343
- const l = t.filter((r) => r.required && r.key).map((r) => r.key);
1344
- return l.length > 0 && (d.required = l), d;
1345
- }, W = (t) => {
1399
+ a && i && (i.title && (l.title = i.title), i.description && (l.description = i.description));
1400
+ const n = ee(t);
1401
+ Object.keys(n).length > 0 && (l.properties = n);
1402
+ const o = t.filter((r) => r.required && r.key).map((r) => r.key);
1403
+ return o.length > 0 && (l.required = o), l;
1404
+ }, ee = (t) => {
1346
1405
  const i = {};
1347
1406
  return t.forEach((a) => {
1348
1407
  if (!a.key) return;
1349
1408
  const n = { type: a.type === "file" ? "string" : a.type };
1350
- if (a.title && (n.title = a.title), a.description && (n.description = a.description), a.type === "file" && (n.format = "filename"), a.type === "string" && (a.minLength !== void 0 && (n.minLength = a.minLength), a.maxLength !== void 0 && (n.maxLength = a.maxLength), a.pattern && (n.pattern = a.pattern), a.enum && a.enum.length > 0 && (n.enum = a.enum)), (a.type === "number" || a.type === "integer") && (a.minimum !== void 0 && (n.minimum = a.minimum), a.maximum !== void 0 && (n.maximum = a.maximum)), a.type === "array" && (a.minItems !== void 0 && (n.minItems = a.minItems), a.maxItems !== void 0 && (n.maxItems = a.maxItems), a.uniqueItems && (n.uniqueItems = a.uniqueItems), a.items && (n.items = W([a.items])[a.items.key] || {
1409
+ if (a.title && (n.title = a.title), a.description && (n.description = a.description), a.type === "file" && (n.format = "filename"), a.type === "string" && (a.minLength !== void 0 && (n.minLength = a.minLength), a.maxLength !== void 0 && (n.maxLength = a.maxLength), a.pattern && (n.pattern = a.pattern), a.enum && a.enum.length > 0 && (n.enum = a.enum)), (a.type === "number" || a.type === "integer") && (a.minimum !== void 0 && (n.minimum = a.minimum), a.maximum !== void 0 && (n.maximum = a.maximum)), a.type === "array" && (a.minItems !== void 0 && (n.minItems = a.minItems), a.maxItems !== void 0 && (n.maxItems = a.maxItems), a.uniqueItems && (n.uniqueItems = a.uniqueItems), a.items && (n.items = ee([a.items])[a.items.key] || {
1351
1410
  type: a.items.type
1352
1411
  })), a.type === "object" && a.children && a.children.length > 0) {
1353
- n.properties = W(a.children);
1354
- const l = a.children.filter((r) => r.required && r.key).map((r) => r.key);
1355
- l.length > 0 && (n.required = l);
1412
+ n.properties = ee(a.children);
1413
+ const o = a.children.filter((r) => r.required && r.key).map((r) => r.key);
1414
+ o.length > 0 && (n.required = o);
1356
1415
  }
1357
1416
  i[a.key] = n;
1358
1417
  }), i;
1359
- }, ft = (t) => {
1418
+ }, xt = (t) => {
1360
1419
  const i = {
1361
1420
  properties: []
1362
1421
  };
@@ -1365,103 +1424,103 @@ const M = (t, i, a = !0) => {
1365
1424
  description: typeof t.description == "string" ? t.description : "",
1366
1425
  version: "1.0.0"
1367
1426
  // Default version
1368
- }), t.properties && typeof t.properties == "object" && (i.properties = Y(
1427
+ }), t.properties && typeof t.properties == "object" && (i.properties = te(
1369
1428
  t.properties,
1370
1429
  Array.isArray(t.required) ? t.required : []
1371
1430
  )), i;
1372
- }, Y = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, d]) => {
1373
- const n = d;
1374
- let l = typeof n.type == "string" ? n.type : "string";
1375
- l === "string" && n.format === "filename" && (l = "file");
1431
+ }, te = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, l]) => {
1432
+ const n = l;
1433
+ let o = typeof n.type == "string" ? n.type : "string";
1434
+ o === "string" && n.format === "filename" && (o = "file");
1376
1435
  const r = {
1377
- id: ae(),
1436
+ id: se(),
1378
1437
  key: a,
1379
1438
  title: typeof n.title == "string" ? n.title : void 0,
1380
- type: l,
1439
+ type: o,
1381
1440
  description: typeof n.description == "string" ? n.description : void 0,
1382
1441
  required: i.includes(a)
1383
1442
  };
1384
- return n.minLength !== void 0 && (r.minLength = n.minLength), n.maxLength !== void 0 && (r.maxLength = n.maxLength), n.pattern && (r.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (r.enum = n.enum), n.minimum !== void 0 && (r.minimum = n.minimum), n.maximum !== void 0 && (r.maximum = n.maximum), n.minItems !== void 0 && (r.minItems = n.minItems), n.maxItems !== void 0 && (r.maxItems = n.maxItems), n.uniqueItems && (r.uniqueItems = n.uniqueItems), r.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (r.items = Y(
1443
+ return n.minLength !== void 0 && (r.minLength = n.minLength), n.maxLength !== void 0 && (r.maxLength = n.maxLength), n.pattern && (r.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (r.enum = n.enum), n.minimum !== void 0 && (r.minimum = n.minimum), n.maximum !== void 0 && (r.maximum = n.maximum), n.minItems !== void 0 && (r.minItems = n.minItems), n.maxItems !== void 0 && (r.maxItems = n.maxItems), n.uniqueItems && (r.uniqueItems = n.uniqueItems), r.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (r.items = te(
1385
1444
  { item: n.items },
1386
1445
  []
1387
- ).find((u) => u.key === "item")), n.properties && typeof n.properties == "object" && (r.children = Y(
1446
+ ).find((m) => m.key === "item")), n.properties && typeof n.properties == "object" && (r.children = te(
1388
1447
  n.properties,
1389
1448
  Array.isArray(n.required) ? n.required : []
1390
1449
  )), r;
1391
- }) : [], pt = ({
1450
+ }) : [], bt = ({
1392
1451
  schema: t,
1393
1452
  onChange: i,
1394
1453
  includeMetadata: a = !0
1395
1454
  }) => {
1396
- const { properties: d, metadata: n } = Se(
1397
- () => ft(t),
1455
+ const { properties: l, metadata: n } = Le(
1456
+ () => xt(t),
1398
1457
  [t]
1399
- ), l = d, r = n || {
1458
+ ), o = l, r = n || {
1400
1459
  title: "",
1401
1460
  description: "",
1402
1461
  version: ""
1403
- }, u = E(() => ({
1404
- id: ae(),
1462
+ }, m = P(() => ({
1463
+ id: se(),
1405
1464
  key: "",
1406
1465
  type: "string",
1407
1466
  required: !1
1408
- }), []), C = E(
1409
- (f, I) => {
1410
- const b = l.some((L) => L.id === f);
1411
- let q;
1412
- b ? q = l.map((L) => L.id === f ? I : L) : q = [...l, I];
1413
- const h = M(
1414
- q,
1467
+ }), []), D = P(
1468
+ (y, d) => {
1469
+ const k = o.some((f) => f.id === y);
1470
+ let E;
1471
+ k ? E = o.map((f) => f.id === y ? d : f) : E = [...o, d];
1472
+ const R = $(
1473
+ E,
1415
1474
  r,
1416
1475
  a
1417
1476
  );
1418
- i(h);
1477
+ i(R);
1419
1478
  },
1420
- [l, r, a, i]
1421
- ), c = E(
1422
- (f) => {
1423
- const I = l.filter((q) => q.id !== f), b = M(
1424
- I,
1479
+ [o, r, a, i]
1480
+ ), p = P(
1481
+ (y) => {
1482
+ const d = o.filter((E) => E.id !== y), k = $(
1483
+ d,
1425
1484
  r,
1426
1485
  a
1427
1486
  );
1428
- i(b);
1487
+ i(k);
1429
1488
  },
1430
- [l, r, a, i]
1431
- ), o = E(() => {
1432
- const I = M([], { title: "", description: "" }, a);
1433
- i(I);
1434
- }, [a, i]), v = E(
1435
- (f, I) => {
1436
- const b = { ...r, [f]: I }, q = M(
1437
- l,
1438
- b,
1489
+ [o, r, a, i]
1490
+ ), g = P(() => {
1491
+ const d = $([], { title: "", description: "" }, a);
1492
+ i(d);
1493
+ }, [a, i]), u = P(
1494
+ (y, d) => {
1495
+ const k = { ...r, [y]: d }, E = $(
1496
+ o,
1497
+ k,
1439
1498
  a
1440
1499
  );
1441
- i(q);
1500
+ i(E);
1442
1501
  },
1443
- [l, r, a, i]
1444
- ), x = E(async () => {
1445
- const f = await mt();
1446
- i(f);
1447
- }, [i]), g = E(() => {
1448
- we(t, "schema.json");
1502
+ [o, r, a, i]
1503
+ ), b = P(async () => {
1504
+ const y = await gt();
1505
+ i(y);
1506
+ }, [i]), v = P(() => {
1507
+ Se(t, "schema.json");
1449
1508
  }, [t]);
1450
1509
  return {
1451
- properties: l,
1510
+ properties: o,
1452
1511
  metadata: r,
1453
- addProperty: u,
1454
- updateProperty: C,
1455
- deleteProperty: c,
1456
- clearAll: o,
1457
- updateMetadata: v,
1458
- importSchema: x,
1459
- downloadSchema: g
1512
+ addProperty: m,
1513
+ updateProperty: D,
1514
+ deleteProperty: p,
1515
+ clearAll: g,
1516
+ updateMetadata: u,
1517
+ importSchema: b,
1518
+ downloadSchema: v
1460
1519
  };
1461
1520
  };
1462
- function gt() {
1463
- const [t, i] = O("light");
1464
- return Z(() => {
1521
+ function Nt() {
1522
+ const [t, i] = q("light");
1523
+ return ae(() => {
1465
1524
  const n = localStorage.getItem("theme") || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
1466
1525
  i(n), document.documentElement.classList.toggle("dark", n === "dark");
1467
1526
  }, []), /* @__PURE__ */ e(
@@ -1470,173 +1529,177 @@ function gt() {
1470
1529
  variant: "ghost",
1471
1530
  size: "icon",
1472
1531
  onClick: () => {
1473
- const d = t === "light" ? "dark" : "light";
1474
- i(d), localStorage.setItem("theme", d), document.documentElement.classList.toggle("dark", d === "dark");
1532
+ const l = t === "light" ? "dark" : "light";
1533
+ i(l), localStorage.setItem("theme", l), document.documentElement.classList.toggle("dark", l === "dark");
1475
1534
  },
1476
1535
  "data-testid": "button-theme-toggle",
1477
- children: t === "light" ? /* @__PURE__ */ e(Ke, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Je, { className: "w-4 h-4" })
1536
+ children: t === "light" ? /* @__PURE__ */ e(Ue, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Xe, { className: "w-4 h-4" })
1478
1537
  }
1479
1538
  );
1480
1539
  }
1481
- function It({
1540
+ function Rt({
1482
1541
  schema: t,
1483
1542
  onChange: i,
1484
1543
  showMetadata: a = !1,
1485
- showImport: d = !0,
1544
+ showImport: l = !0,
1486
1545
  showClear: n = !0,
1487
- showOutput: l = !0,
1546
+ showOutput: o = !0,
1488
1547
  showHeader: r = !0,
1489
- className: u = "",
1490
- showSummary: C = !1,
1491
- typeLabels: c,
1492
- propertyLabel: o = { singular: "property", plural: "properties" },
1493
- showRegex: v = !1,
1494
- keyEditable: x = !1
1548
+ className: m = "",
1549
+ showSummary: D = !1,
1550
+ typeLabels: p,
1551
+ propertyLabel: g = { singular: "property", plural: "properties" },
1552
+ showRegex: u = !1,
1553
+ keyEditable: b = !1
1495
1554
  }) {
1496
1555
  const {
1497
- properties: g,
1498
- metadata: f,
1499
- addProperty: I,
1500
- updateProperty: b,
1501
- deleteProperty: q,
1502
- clearAll: h,
1503
- updateMetadata: L,
1504
- importSchema: m
1505
- } = pt({
1556
+ properties: v,
1557
+ metadata: y,
1558
+ addProperty: d,
1559
+ updateProperty: k,
1560
+ deleteProperty: E,
1561
+ clearAll: R,
1562
+ updateMetadata: f,
1563
+ importSchema: O
1564
+ } = bt({
1506
1565
  schema: t,
1507
1566
  onChange: i,
1508
1567
  includeMetadata: a
1509
- }), j = ie({
1510
- createInitialData: () => I(),
1511
- onConfirm: (T) => {
1512
- b(T.id, T);
1568
+ }), C = re({
1569
+ createInitialData: () => d(),
1570
+ onConfirm: (c) => {
1571
+ k(c.id, c);
1513
1572
  }
1514
- }), A = () => {
1515
- h();
1516
- }, J = async () => {
1517
- await m();
1573
+ }), H = () => {
1574
+ R();
1575
+ }, _ = async () => {
1576
+ await O();
1518
1577
  };
1519
- return /* @__PURE__ */ e(it, { customLabels: c, children: /* @__PURE__ */ s("div", { className: `${u} flex flex-col json-schema-builder-react`, children: [
1520
- r && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
1521
- d && /* @__PURE__ */ e(
1522
- S,
1523
- {
1524
- variant: "outline",
1525
- size: "sm",
1526
- onClick: J,
1527
- "data-testid": "button-import",
1528
- children: /* @__PURE__ */ e(Ve, { className: "w-4 h-4" })
1529
- }
1530
- ),
1531
- n && /* @__PURE__ */ e(
1532
- S,
1533
- {
1534
- variant: "outline",
1535
- size: "sm",
1536
- onClick: A,
1537
- disabled: g.length === 0,
1538
- "data-testid": "button-clear",
1539
- children: /* @__PURE__ */ e(ce, { className: "w-4 h-4" })
1540
- }
1541
- ),
1542
- /* @__PURE__ */ e(gt, {})
1543
- ] }) }),
1544
- /* @__PURE__ */ s("div", { className: "flex-1 flex overflow-hidden", children: [
1545
- /* @__PURE__ */ e("div", { className: l ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1546
- /* @__PURE__ */ s("div", { className: "flex-1 overflow-auto p-2 space-y-4", children: [
1547
- a && /* @__PURE__ */ e(
1548
- ht,
1578
+ return /* @__PURE__ */ e(
1579
+ ot,
1580
+ {
1581
+ config: {
1582
+ typeLabels: p,
1583
+ propertyLabel: g,
1584
+ showRegex: u,
1585
+ keyEditable: b
1586
+ },
1587
+ children: /* @__PURE__ */ s("div", { className: `${m} flex flex-col json-schema-builder-react`, children: [
1588
+ r && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
1589
+ l && /* @__PURE__ */ e(
1590
+ S,
1549
1591
  {
1550
- title: f.title,
1551
- description: f.description,
1552
- version: f.version,
1553
- onUpdate: (T, R) => L(T, R)
1592
+ variant: "outline",
1593
+ size: "sm",
1594
+ onClick: _,
1595
+ "data-testid": "button-import",
1596
+ children: /* @__PURE__ */ e(Ge, { className: "w-4 h-4" })
1554
1597
  }
1555
1598
  ),
1556
- g.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
1557
- /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4", children: /* @__PURE__ */ e(B, { className: "w-8 h-8 text-muted-foreground" }) }),
1558
- /* @__PURE__ */ s("h2", { className: "text-lg font-medium mb-2", children: [
1559
- "No ",
1560
- o.plural,
1561
- " yet"
1562
- ] }),
1563
- /* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground mb-6 max-w-sm", children: [
1564
- "Start building your JSON schema by adding your first",
1565
- " ",
1566
- o.singular
1599
+ n && /* @__PURE__ */ e(
1600
+ S,
1601
+ {
1602
+ variant: "outline",
1603
+ size: "sm",
1604
+ onClick: H,
1605
+ disabled: v.length === 0,
1606
+ "data-testid": "button-clear",
1607
+ children: /* @__PURE__ */ e(fe, { className: "w-4 h-4" })
1608
+ }
1609
+ ),
1610
+ /* @__PURE__ */ e(Nt, {})
1611
+ ] }) }),
1612
+ /* @__PURE__ */ s("div", { className: "flex-1 flex overflow-hidden", children: [
1613
+ /* @__PURE__ */ e("div", { className: o ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1614
+ /* @__PURE__ */ s("div", { className: "flex-1 overflow-auto p-2 space-y-4", children: [
1615
+ a && /* @__PURE__ */ e(
1616
+ vt,
1617
+ {
1618
+ title: y.title,
1619
+ description: y.description,
1620
+ version: y.version,
1621
+ onUpdate: (c, j) => f(c, j)
1622
+ }
1623
+ ),
1624
+ v.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
1625
+ /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4", children: /* @__PURE__ */ e(B, { className: "w-8 h-8 text-muted-foreground" }) }),
1626
+ /* @__PURE__ */ s("h2", { className: "text-lg font-medium mb-2", children: [
1627
+ "No ",
1628
+ g.plural,
1629
+ " yet"
1630
+ ] }),
1631
+ /* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground mb-6 max-w-sm", children: [
1632
+ "Start building your JSON schema by adding your first",
1633
+ " ",
1634
+ g.singular
1635
+ ] }),
1636
+ /* @__PURE__ */ s(
1637
+ S,
1638
+ {
1639
+ onClick: () => C.open(),
1640
+ "data-testid": "button-add-first",
1641
+ children: [
1642
+ /* @__PURE__ */ e(B, { className: "w-4 h-4 mr-2" }),
1643
+ "Add ",
1644
+ g.singular
1645
+ ]
1646
+ }
1647
+ )
1648
+ ] }) : /* @__PURE__ */ s(me, { children: [
1649
+ /* @__PURE__ */ e("div", { className: "space-y-1", children: v.map((c) => /* @__PURE__ */ e(
1650
+ Z,
1651
+ {
1652
+ property: c,
1653
+ onUpdate: (j) => k(c.id, j),
1654
+ onDelete: () => E(c.id)
1655
+ },
1656
+ c.id
1657
+ )) }),
1658
+ D && /* @__PURE__ */ s("div", { className: "pt-4 border-t flex items-center justify-between text-sm text-muted-foreground", children: [
1659
+ /* @__PURE__ */ s("span", { children: [
1660
+ v.length,
1661
+ " ",
1662
+ v.length === 1 ? g.singular : g.plural
1663
+ ] }),
1664
+ /* @__PURE__ */ s("span", { children: [
1665
+ v.filter((c) => c.required).length,
1666
+ " required"
1667
+ ] })
1668
+ ] })
1669
+ ] })
1567
1670
  ] }),
1568
- /* @__PURE__ */ s(
1671
+ v.length > 0 && /* @__PURE__ */ e("div", { className: "border-t p-2 pt-4 bg-background", children: /* @__PURE__ */ s(
1569
1672
  S,
1570
1673
  {
1571
- onClick: () => j.open(),
1572
- "data-testid": "button-add-first",
1674
+ onClick: () => C.open(),
1675
+ className: "w-full",
1676
+ variant: "outline",
1677
+ "data-testid": "button-add-property",
1573
1678
  children: [
1574
- /* @__PURE__ */ e(B, { className: "w-4 h-4 mr-2" }),
1679
+ /* @__PURE__ */ e(B, { className: "w-4 h-4" }),
1575
1680
  "Add ",
1576
- o.singular
1681
+ g.singular
1577
1682
  ]
1578
1683
  }
1579
- )
1580
- ] }) : /* @__PURE__ */ s(le, { children: [
1581
- /* @__PURE__ */ e("div", { className: "space-y-1", children: g.map((T) => /* @__PURE__ */ e(
1582
- Q,
1583
- {
1584
- property: T,
1585
- onUpdate: (R) => b(T.id, R),
1586
- onDelete: () => q(T.id),
1587
- showRegex: v,
1588
- keyEditable: x
1589
- },
1590
- T.id
1591
- )) }),
1592
- C && /* @__PURE__ */ s("div", { className: "pt-4 border-t flex items-center justify-between text-sm text-muted-foreground", children: [
1593
- /* @__PURE__ */ s("span", { children: [
1594
- g.length,
1595
- " ",
1596
- g.length === 1 ? o.singular : o.plural
1597
- ] }),
1598
- /* @__PURE__ */ s("span", { children: [
1599
- g.filter((T) => T.required).length,
1600
- " required"
1601
- ] })
1602
- ] })
1603
- ] })
1684
+ ) })
1685
+ ] }) }),
1686
+ o && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(yt, { schema: t }) })
1604
1687
  ] }),
1605
- g.length > 0 && /* @__PURE__ */ e("div", { className: "border-t p-2 pt-4 bg-background", children: /* @__PURE__ */ s(
1606
- S,
1688
+ C.isOpen && C.data && /* @__PURE__ */ e(
1689
+ Y,
1607
1690
  {
1608
- onClick: () => j.open(),
1609
- className: "w-full",
1610
- variant: "outline",
1611
- "data-testid": "button-add-property",
1612
- children: [
1613
- /* @__PURE__ */ e(B, { className: "w-4 h-4" }),
1614
- "Add ",
1615
- o.singular
1616
- ]
1691
+ property: C.data,
1692
+ open: C.isOpen,
1693
+ isNewProperty: !0,
1694
+ onOpenChange: C.setIsOpen,
1695
+ onSave: C.confirm
1617
1696
  }
1618
- ) })
1619
- ] }) }),
1620
- l && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(ut, { schema: t }) })
1621
- ] }),
1622
- j.isOpen && j.data && /* @__PURE__ */ e(
1623
- G,
1624
- {
1625
- property: j.data,
1626
- open: j.isOpen,
1627
- isNewProperty: !0,
1628
- onOpenChange: j.setIsOpen,
1629
- propertyLabel: o,
1630
- onSave: j.confirm,
1631
- showRegex: v,
1632
- keyEditable: x
1633
- }
1634
- )
1635
- ] }) });
1697
+ )
1698
+ ] })
1699
+ }
1700
+ );
1636
1701
  }
1637
1702
  export {
1638
- It as JsonSchemaBuilder,
1639
- G as PropertyEditDialog,
1640
- it as TypeLabelsProvider
1703
+ Rt as JsonSchemaBuilder,
1704
+ Y as PropertyEditDialog
1641
1705
  };
1642
- //# sourceMappingURL=index.js.map