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