@opennsw/jsonforms-renderers 0.3.1 → 0.4.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/README.md +3 -3
- package/dist/index.d.ts +33 -3
- package/dist/jsonforms-renderers.css +1 -1
- package/dist/renderers.cjs.js +3 -3
- package/dist/renderers.es.js +711 -783
- package/package.json +29 -9
package/dist/renderers.es.js
CHANGED
|
@@ -1,182 +1,191 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { rankWith as
|
|
4
|
-
import { withJsonFormsControlProps as
|
|
5
|
-
import { Box as
|
|
6
|
-
import { FileTextIcon as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as e, jsxs as f, Fragment as be } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as ze, createContext as Se, useMemo as Ue, useEffect as X, useState as A, useRef as Q, useCallback as Te } from "react";
|
|
3
|
+
import { rankWith as D, isStringControl as Ee, or as ge, isNumberControl as Ve, isIntegerControl as je, isBooleanControl as Ne, isEnumControl as Re, isOneOfControl as ke, schemaMatches as $e, isDateControl as Pe, isDateTimeControl as Be, isTimeControl as Me, uiTypeIs as ie, and as We, createDefaultValue as He, isObjectArrayControl as Ke, isPrimitiveArrayControl as Ge } from "@jsonforms/core";
|
|
4
|
+
import { withJsonFormsControlProps as J, JsonFormsDispatch as ce, withJsonFormsArrayControlProps as Je } from "@jsonforms/react";
|
|
5
|
+
import { Box as C, Flex as z, Text as c, TextField as Y, Checkbox as _e, RadioGroup as we, Select as de, ScrollArea as qe, Spinner as Ce, Button as he, Tabs as ue, Heading as Fe, Card as De, IconButton as Ze } from "@radix-ui/themes";
|
|
6
|
+
import { ChevronDownIcon as Qe, FileTextIcon as Xe, CheckCircledIcon as Ye, Cross2Icon as er, ExclamationTriangleIcon as rr, UploadIcon as tr, TrashIcon as nr, PlusIcon as or } from "@radix-ui/react-icons";
|
|
7
|
+
import lr from "dayjs";
|
|
8
|
+
const Oe = Se(null);
|
|
9
|
+
function tt({
|
|
10
|
+
children: t,
|
|
10
11
|
onUpload: r,
|
|
11
|
-
getDownloadUrl:
|
|
12
|
+
getDownloadUrl: n
|
|
12
13
|
}) {
|
|
13
|
-
const
|
|
14
|
-
return /* @__PURE__ */ e(
|
|
14
|
+
const a = { onUpload: r, getDownloadUrl: n };
|
|
15
|
+
return /* @__PURE__ */ e(Oe.Provider, { value: a, children: t });
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
return ze(
|
|
17
|
+
function ir() {
|
|
18
|
+
return ze(Oe);
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const Ie = Se(null);
|
|
21
|
+
function nt({
|
|
22
|
+
children: t,
|
|
23
|
+
services: r
|
|
24
|
+
}) {
|
|
25
|
+
const n = Ue(() => r, [r]);
|
|
26
|
+
return /* @__PURE__ */ e(Ie.Provider, { value: n, children: t });
|
|
27
|
+
}
|
|
28
|
+
function cr(t) {
|
|
29
|
+
const r = ze(Ie);
|
|
30
|
+
return !r || !t ? null : r[t] ?? null;
|
|
31
|
+
}
|
|
32
|
+
const ee = (t, r, n, a = void 0) => {
|
|
33
|
+
X(() => {
|
|
34
|
+
t === !1 && n(r, a);
|
|
35
|
+
}, [t, r, n, a]);
|
|
36
|
+
}, _ = (t, r) => t ? t.split(`
|
|
37
|
+
`).map((n) => n.trim() === "is a required property" ? `${r || "This field"} is required` : n).join(`
|
|
38
|
+
`) : "", sr = ({
|
|
39
|
+
data: t,
|
|
23
40
|
handleChange: r,
|
|
24
|
-
path:
|
|
25
|
-
label:
|
|
26
|
-
required:
|
|
27
|
-
errors:
|
|
28
|
-
uischema:
|
|
29
|
-
schema:
|
|
30
|
-
enabled:
|
|
31
|
-
visible:
|
|
41
|
+
path: n,
|
|
42
|
+
label: a,
|
|
43
|
+
required: y,
|
|
44
|
+
errors: h,
|
|
45
|
+
uischema: s,
|
|
46
|
+
schema: v,
|
|
47
|
+
enabled: d,
|
|
48
|
+
visible: g = !0
|
|
32
49
|
}) => {
|
|
33
|
-
var
|
|
34
|
-
if (
|
|
35
|
-
f === !1 && r(t, void 0);
|
|
36
|
-
}, [f, t, r]), f === !1)
|
|
50
|
+
var x;
|
|
51
|
+
if (ee(g, n, r), g === !1)
|
|
37
52
|
return null;
|
|
38
|
-
const
|
|
39
|
-
return /* @__PURE__ */ e(
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
53
|
+
const l = h.length === 0;
|
|
54
|
+
return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
|
|
55
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
|
|
56
|
+
a,
|
|
42
57
|
" ",
|
|
43
|
-
|
|
58
|
+
y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
44
59
|
] }),
|
|
45
60
|
/* @__PURE__ */ e(
|
|
46
|
-
|
|
61
|
+
Y.Root,
|
|
47
62
|
{
|
|
48
|
-
value:
|
|
49
|
-
onChange: (
|
|
50
|
-
disabled: !
|
|
51
|
-
placeholder: (
|
|
52
|
-
color:
|
|
53
|
-
id:
|
|
63
|
+
value: t || "",
|
|
64
|
+
onChange: (p) => r(n, p.target.value),
|
|
65
|
+
disabled: !d,
|
|
66
|
+
placeholder: (x = s.options) == null ? void 0 : x.placeholder,
|
|
67
|
+
color: l ? void 0 : "red",
|
|
68
|
+
id: n
|
|
54
69
|
}
|
|
55
70
|
),
|
|
56
|
-
!
|
|
57
|
-
|
|
71
|
+
!l && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
|
|
72
|
+
v.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: v.description })
|
|
58
73
|
] }) });
|
|
59
|
-
},
|
|
60
|
-
data:
|
|
74
|
+
}, ar = D(1, Ee), dr = J(sr), ur = ({
|
|
75
|
+
data: t,
|
|
61
76
|
handleChange: r,
|
|
62
|
-
path:
|
|
63
|
-
label:
|
|
64
|
-
required:
|
|
65
|
-
errors:
|
|
66
|
-
uischema:
|
|
67
|
-
schema:
|
|
68
|
-
enabled:
|
|
69
|
-
visible:
|
|
77
|
+
path: n,
|
|
78
|
+
label: a,
|
|
79
|
+
required: y,
|
|
80
|
+
errors: h,
|
|
81
|
+
uischema: s,
|
|
82
|
+
schema: v,
|
|
83
|
+
enabled: d,
|
|
84
|
+
visible: g = !0
|
|
70
85
|
}) => {
|
|
71
|
-
var
|
|
72
|
-
if (
|
|
73
|
-
f === !1 && r(t, void 0);
|
|
74
|
-
}, [f, t, r]), f === !1)
|
|
86
|
+
var p;
|
|
87
|
+
if (ee(g, n, r), g === !1)
|
|
75
88
|
return null;
|
|
76
|
-
const
|
|
77
|
-
if (
|
|
78
|
-
r(
|
|
89
|
+
const l = h.length === 0, x = (o) => {
|
|
90
|
+
if (o === "") {
|
|
91
|
+
r(n, void 0);
|
|
79
92
|
return;
|
|
80
93
|
}
|
|
81
|
-
const
|
|
82
|
-
isNaN(
|
|
94
|
+
const u = Number(o);
|
|
95
|
+
isNaN(u) || r(n, u);
|
|
83
96
|
};
|
|
84
|
-
return /* @__PURE__ */ e(
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
97
|
+
return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
|
|
98
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
|
|
99
|
+
a,
|
|
87
100
|
" ",
|
|
88
|
-
|
|
101
|
+
y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
89
102
|
] }),
|
|
90
103
|
/* @__PURE__ */ e(
|
|
91
|
-
|
|
104
|
+
Y.Root,
|
|
92
105
|
{
|
|
93
106
|
type: "number",
|
|
94
|
-
value:
|
|
95
|
-
onChange: (
|
|
96
|
-
disabled: !
|
|
97
|
-
placeholder: (
|
|
98
|
-
color:
|
|
99
|
-
id:
|
|
107
|
+
value: t ?? "",
|
|
108
|
+
onChange: (o) => x(o.target.value),
|
|
109
|
+
disabled: !d,
|
|
110
|
+
placeholder: (p = s.options) == null ? void 0 : p.placeholder,
|
|
111
|
+
color: l ? void 0 : "red",
|
|
112
|
+
id: n
|
|
100
113
|
}
|
|
101
114
|
),
|
|
102
|
-
!
|
|
103
|
-
|
|
115
|
+
!l && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
|
|
116
|
+
v.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: v.description })
|
|
104
117
|
] }) });
|
|
105
|
-
},
|
|
106
|
-
data:
|
|
118
|
+
}, fr = D(2, ge(Ve, je)), pr = J(ur), hr = ({
|
|
119
|
+
data: t,
|
|
107
120
|
handleChange: r,
|
|
108
|
-
path:
|
|
109
|
-
label:
|
|
110
|
-
required:
|
|
111
|
-
errors:
|
|
112
|
-
schema:
|
|
113
|
-
enabled:
|
|
114
|
-
visible:
|
|
121
|
+
path: n,
|
|
122
|
+
label: a,
|
|
123
|
+
required: y,
|
|
124
|
+
errors: h,
|
|
125
|
+
schema: s,
|
|
126
|
+
enabled: v,
|
|
127
|
+
visible: d = !0
|
|
115
128
|
}) => {
|
|
116
|
-
if (
|
|
117
|
-
h === !1 && r(t, void 0);
|
|
118
|
-
}, [h, t, r]), h === !1)
|
|
129
|
+
if (ee(d, n, r), d === !1)
|
|
119
130
|
return null;
|
|
120
|
-
const
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */ z
|
|
131
|
+
const g = h.length === 0;
|
|
132
|
+
return /* @__PURE__ */ f(C, { mb: "4", children: [
|
|
133
|
+
/* @__PURE__ */ f(z, { gap: "2", align: "center", children: [
|
|
123
134
|
/* @__PURE__ */ e(
|
|
124
|
-
|
|
135
|
+
_e,
|
|
125
136
|
{
|
|
126
|
-
checked: !!
|
|
127
|
-
onCheckedChange: (
|
|
128
|
-
disabled: !
|
|
129
|
-
id:
|
|
137
|
+
checked: !!t,
|
|
138
|
+
onCheckedChange: (l) => r(n, l === !0),
|
|
139
|
+
disabled: !v,
|
|
140
|
+
id: n
|
|
130
141
|
}
|
|
131
142
|
),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
|
|
143
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", htmlFor: n, children: [
|
|
144
|
+
a,
|
|
134
145
|
" ",
|
|
135
|
-
|
|
146
|
+
y && "*"
|
|
136
147
|
] })
|
|
137
148
|
] }),
|
|
138
|
-
!
|
|
139
|
-
|
|
149
|
+
!g && /* @__PURE__ */ e(c, { color: "red", size: "1", className: "block mt-1", children: _(h, a) }),
|
|
150
|
+
s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", className: "block mt-1", children: s.description })
|
|
140
151
|
] });
|
|
141
|
-
},
|
|
142
|
-
data:
|
|
152
|
+
}, gr = D(2, Ne), mr = J(hr), yr = ({
|
|
153
|
+
data: t,
|
|
143
154
|
handleChange: r,
|
|
144
|
-
path:
|
|
145
|
-
label:
|
|
146
|
-
required:
|
|
147
|
-
errors:
|
|
148
|
-
schema:
|
|
149
|
-
enabled:
|
|
150
|
-
visible:
|
|
155
|
+
path: n,
|
|
156
|
+
label: a,
|
|
157
|
+
required: y,
|
|
158
|
+
errors: h,
|
|
159
|
+
schema: s,
|
|
160
|
+
enabled: v,
|
|
161
|
+
visible: d = !0
|
|
151
162
|
}) => {
|
|
152
|
-
if (
|
|
153
|
-
h === !1 && r(t, void 0);
|
|
154
|
-
}, [h, t, r]), h === !1)
|
|
163
|
+
if (ee(d, n, r), d === !1)
|
|
155
164
|
return null;
|
|
156
|
-
const
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
value:
|
|
160
|
-
label:
|
|
165
|
+
const g = h.length === 0;
|
|
166
|
+
let l = [];
|
|
167
|
+
s.enum ? l = s.enum.map((p) => ({ value: p, label: String(p) })) : s.oneOf && (l = s.oneOf.map((p) => ({
|
|
168
|
+
value: p.const,
|
|
169
|
+
label: p.title || String(p.const)
|
|
161
170
|
})));
|
|
162
|
-
const
|
|
163
|
-
return /* @__PURE__ */ e(
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
|
|
171
|
+
const x = t;
|
|
172
|
+
return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
|
|
173
|
+
/* @__PURE__ */ f(c, { as: "div", size: "2", weight: "bold", children: [
|
|
174
|
+
a,
|
|
166
175
|
" ",
|
|
167
|
-
|
|
176
|
+
y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
168
177
|
] }),
|
|
169
178
|
/* @__PURE__ */ e(
|
|
170
|
-
|
|
179
|
+
we.Root,
|
|
171
180
|
{
|
|
172
|
-
value:
|
|
173
|
-
onValueChange: (
|
|
174
|
-
const
|
|
175
|
-
|
|
181
|
+
value: x !== void 0 ? String(x) : "",
|
|
182
|
+
onValueChange: (p) => {
|
|
183
|
+
const o = l.find((u) => String(u.value) === p);
|
|
184
|
+
o && r(n, o.value);
|
|
176
185
|
},
|
|
177
|
-
disabled: !
|
|
186
|
+
disabled: !v,
|
|
178
187
|
children: /* @__PURE__ */ e(
|
|
179
|
-
|
|
188
|
+
z,
|
|
180
189
|
{
|
|
181
190
|
direction: "row",
|
|
182
191
|
style: {
|
|
@@ -184,636 +193,551 @@ const X = (o, r) => o ? o.split(`
|
|
|
184
193
|
columnGap: "clamp(14px, 3vw, 36px)",
|
|
185
194
|
rowGap: "clamp(8px, 1.6vw, 14px)"
|
|
186
195
|
},
|
|
187
|
-
children:
|
|
188
|
-
/* @__PURE__ */ e(
|
|
189
|
-
/* @__PURE__ */ e(
|
|
190
|
-
] }, String(
|
|
196
|
+
children: l.map((p) => /* @__PURE__ */ f(z, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
|
|
197
|
+
/* @__PURE__ */ e(we.Item, { value: String(p.value) }),
|
|
198
|
+
/* @__PURE__ */ e(c, { size: "2", color: v ? void 0 : "gray", children: p.label })
|
|
199
|
+
] }, String(p.value)))
|
|
191
200
|
}
|
|
192
201
|
)
|
|
193
202
|
}
|
|
194
203
|
),
|
|
195
|
-
!
|
|
196
|
-
|
|
204
|
+
!g && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
|
|
205
|
+
s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: s.description })
|
|
197
206
|
] }) });
|
|
198
|
-
},
|
|
199
|
-
var
|
|
200
|
-
return
|
|
201
|
-
},
|
|
202
|
-
data:
|
|
207
|
+
}, vr = (t, r, n) => {
|
|
208
|
+
var y;
|
|
209
|
+
return ge(Re, ke)(t, r, n) && ((y = t == null ? void 0 : t.options) == null ? void 0 : y.format) === "radio" ? 3 : -1;
|
|
210
|
+
}, br = J(yr), wr = ({
|
|
211
|
+
data: t,
|
|
203
212
|
handleChange: r,
|
|
204
|
-
path:
|
|
205
|
-
label:
|
|
206
|
-
required:
|
|
207
|
-
errors:
|
|
208
|
-
schema:
|
|
209
|
-
uischema:
|
|
210
|
-
enabled:
|
|
211
|
-
visible:
|
|
213
|
+
path: n,
|
|
214
|
+
label: a,
|
|
215
|
+
required: y,
|
|
216
|
+
errors: h,
|
|
217
|
+
schema: s,
|
|
218
|
+
uischema: v,
|
|
219
|
+
enabled: d,
|
|
220
|
+
visible: g = !0
|
|
212
221
|
}) => {
|
|
213
|
-
var
|
|
214
|
-
if (
|
|
215
|
-
f === !1 && r(t, void 0);
|
|
216
|
-
}, [f, t, r]), f === !1)
|
|
222
|
+
var o;
|
|
223
|
+
if (ee(g, n, r), g === !1)
|
|
217
224
|
return null;
|
|
218
|
-
const
|
|
219
|
-
let
|
|
220
|
-
|
|
221
|
-
value: String(
|
|
222
|
-
label:
|
|
225
|
+
const l = h.length === 0;
|
|
226
|
+
let x = [];
|
|
227
|
+
s.enum ? x = s.enum.map((u) => ({ value: String(u), label: String(u) })) : s.oneOf && (x = s.oneOf.map((u) => ({
|
|
228
|
+
value: String(u.const),
|
|
229
|
+
label: u.title || String(u.const)
|
|
223
230
|
})));
|
|
224
|
-
const
|
|
225
|
-
return /* @__PURE__ */ e(
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
|
|
231
|
+
const p = t !== void 0 ? String(t) : "";
|
|
232
|
+
return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
|
|
233
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
|
|
234
|
+
a,
|
|
228
235
|
" ",
|
|
229
|
-
|
|
236
|
+
y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
230
237
|
] }),
|
|
231
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ f(de.Root, { value: p, onValueChange: (u) => r(n, u), disabled: !d, children: [
|
|
232
239
|
/* @__PURE__ */ e(
|
|
233
|
-
|
|
240
|
+
de.Trigger,
|
|
234
241
|
{
|
|
235
|
-
placeholder: ((
|
|
236
|
-
color:
|
|
237
|
-
id:
|
|
242
|
+
placeholder: ((o = v.options) == null ? void 0 : o.placeholder) || "Select an option",
|
|
243
|
+
color: l ? void 0 : "red",
|
|
244
|
+
id: n
|
|
238
245
|
}
|
|
239
246
|
),
|
|
240
|
-
/* @__PURE__ */ e(
|
|
247
|
+
/* @__PURE__ */ e(de.Content, { children: x.map((u) => /* @__PURE__ */ e(de.Item, { value: u.value, children: u.label }, u.value)) })
|
|
241
248
|
] }),
|
|
242
|
-
!
|
|
243
|
-
|
|
249
|
+
!l && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
|
|
250
|
+
s.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: s.description })
|
|
244
251
|
] }) });
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
252
|
+
}, Cr = D(2, ge(Re, ke)), xr = J(wr), zr = {
|
|
253
|
+
"small-list": { fetchOnOpen: !0, searchable: !1, paginated: !1 },
|
|
254
|
+
"large-searchable-list": { fetchOnOpen: !0, searchable: !0, paginated: !1 },
|
|
255
|
+
"large-paginated-list": { fetchOnOpen: !1, searchable: !0, paginated: !0 }
|
|
256
|
+
}, Sr = ({
|
|
257
|
+
data: t,
|
|
258
|
+
handleChange: r,
|
|
259
|
+
path: n,
|
|
260
|
+
label: a,
|
|
261
|
+
required: y,
|
|
262
|
+
errors: h,
|
|
263
|
+
enabled: s,
|
|
264
|
+
visible: v = !0,
|
|
265
|
+
schema: d,
|
|
266
|
+
uischema: g
|
|
267
|
+
}) => {
|
|
268
|
+
var me;
|
|
269
|
+
const l = (d == null ? void 0 : d["x-search"]) ?? { service: "" }, x = l.service ?? "", p = l.mode ?? "large-paginated-list", o = zr[p], u = (o == null ? void 0 : o.fetchOnOpen) ?? !1, S = cr(x), $ = x ? S ? o ? null : `Invalid x-search.mode "${p}". Expected "small-list", "large-searchable-list", or "large-paginated-list".` : `Search service "${x}" is not registered.` : "Search not configured.", w = s !== !1, R = !h || h.length === 0, [k, V] = A(!1), [O, j] = A(""), [te, N] = A([]), [re, U] = A(!1), [I, B] = A(!1), [ne, M] = A(!1), [oe, W] = A(null), [le, q] = A(void 0), H = Q(void 0), Z = Q(null), i = Q(null), T = Q(null), F = Q(void 0);
|
|
270
|
+
X(() => {
|
|
271
|
+
if (!t) {
|
|
272
|
+
q(void 0), F.current = void 0;
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (F.current === t || (F.current = t, q({ id: t, name: t }), !(S != null && S.resolve))) return;
|
|
276
|
+
let m = !1;
|
|
277
|
+
return S.resolve(t).then((E) => {
|
|
278
|
+
!m && E && q(E);
|
|
279
|
+
}).catch(() => {
|
|
280
|
+
}), () => {
|
|
281
|
+
m = !0;
|
|
282
|
+
};
|
|
283
|
+
}, [t, S]);
|
|
284
|
+
const b = Te(
|
|
285
|
+
async (m, E = !1) => {
|
|
286
|
+
var ye;
|
|
287
|
+
if (!S) {
|
|
288
|
+
W("Search service not configured.");
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
(ye = i.current) == null || ye.abort();
|
|
292
|
+
const se = new AbortController();
|
|
293
|
+
i.current = se, E ? M(!0) : (B(!0), M(!1), W(null));
|
|
294
|
+
try {
|
|
295
|
+
const ae = await S.search({
|
|
296
|
+
query: m,
|
|
297
|
+
cursor: E ? H.current : void 0,
|
|
298
|
+
signal: se.signal
|
|
299
|
+
}), ve = ae.options ?? [];
|
|
300
|
+
N(E ? (Ae) => [...Ae, ...ve] : ve), H.current = ae.nextCursor, U(((o == null ? void 0 : o.paginated) ?? !1) && ae.nextCursor != null);
|
|
301
|
+
} catch {
|
|
302
|
+
if (se.signal.aborted) return;
|
|
303
|
+
W("Failed to load results. Please try again.");
|
|
304
|
+
} finally {
|
|
305
|
+
se.signal.aborted || (E ? M(!1) : B(!1));
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
[S, o == null ? void 0 : o.paginated]
|
|
309
|
+
);
|
|
310
|
+
if (X(() => {
|
|
311
|
+
if (!k) return;
|
|
312
|
+
const m = (E) => {
|
|
313
|
+
T.current && !T.current.contains(E.target) && V(!1);
|
|
314
|
+
};
|
|
315
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
316
|
+
}, [k]), X(() => {
|
|
317
|
+
var m;
|
|
318
|
+
k || ((m = i.current) == null || m.abort(), j(""), N([]), U(!1), W(null), B(!1), M(!1), H.current = void 0);
|
|
319
|
+
}, [k]), X(() => {
|
|
320
|
+
if (!k) return;
|
|
321
|
+
if (!O && !u) {
|
|
322
|
+
N([]), U(!1), W(null), H.current = void 0;
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
Z.current && clearTimeout(Z.current);
|
|
326
|
+
const m = O ? 300 : 0;
|
|
327
|
+
return Z.current = setTimeout(() => {
|
|
328
|
+
N([]), U(!1), H.current = void 0, b(O);
|
|
329
|
+
}, m), () => {
|
|
330
|
+
Z.current && clearTimeout(Z.current);
|
|
331
|
+
};
|
|
332
|
+
}, [O, k, u, b]), ee(v, n, r, null), v === !1)
|
|
333
|
+
return null;
|
|
334
|
+
const L = () => {
|
|
335
|
+
j(""), N([]), U(!1), W(null), H.current = void 0, V(!0);
|
|
336
|
+
}, P = (m) => {
|
|
337
|
+
r(n, m.id), q(m), F.current = m.id, V(!1);
|
|
338
|
+
}, K = (m) => {
|
|
339
|
+
m.stopPropagation(), r(n, null), q(void 0);
|
|
340
|
+
}, G = (m) => {
|
|
341
|
+
(m.key === "Enter" || m.key === " ") && K(m);
|
|
342
|
+
}, Le = ((me = g == null ? void 0 : g.options) == null ? void 0 : me.placeholder) ?? "Select an option";
|
|
343
|
+
return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
|
|
344
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: n, children: [
|
|
345
|
+
a,
|
|
346
|
+
" ",
|
|
347
|
+
y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
348
|
+
] }),
|
|
349
|
+
/* @__PURE__ */ f("div", { ref: T, style: { position: "relative" }, children: [
|
|
350
|
+
/* @__PURE__ */ e(
|
|
351
|
+
Y.Root,
|
|
352
|
+
{
|
|
353
|
+
id: n,
|
|
354
|
+
value: k ? O : (le == null ? void 0 : le.name) ?? "",
|
|
355
|
+
placeholder: k && (o != null && o.searchable) ? "Search..." : Le,
|
|
356
|
+
disabled: !w,
|
|
357
|
+
readOnly: k && !(o != null && o.searchable),
|
|
358
|
+
style: R ? void 0 : { outline: "2px solid var(--red-7)", outlineOffset: "-1px" },
|
|
359
|
+
onChange: (m) => {
|
|
360
|
+
o != null && o.searchable && (j(m.target.value), k || L());
|
|
361
|
+
},
|
|
362
|
+
onFocus: () => {
|
|
363
|
+
w && !k && L();
|
|
364
|
+
},
|
|
365
|
+
onKeyDown: (m) => {
|
|
366
|
+
m.key === "Escape" && V(!1);
|
|
367
|
+
},
|
|
368
|
+
children: /* @__PURE__ */ e(Y.Slot, { side: "right", children: /* @__PURE__ */ f(z, { align: "center", gap: "1", children: [
|
|
369
|
+
t && w && /* @__PURE__ */ e(
|
|
370
|
+
"span",
|
|
371
|
+
{
|
|
372
|
+
role: "button",
|
|
373
|
+
tabIndex: 0,
|
|
374
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
375
|
+
onClick: K,
|
|
376
|
+
onKeyDown: G,
|
|
377
|
+
style: { lineHeight: 1, color: "var(--gray-9)", padding: "0 2px", cursor: "pointer" },
|
|
378
|
+
"aria-label": "Clear selection",
|
|
379
|
+
children: "×"
|
|
315
380
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
this.$y = n.getFullYear(), this.$M = n.getMonth(), this.$D = n.getDate(), this.$W = n.getDay(), this.$H = n.getHours(), this.$m = n.getMinutes(), this.$s = n.getSeconds(), this.$ms = n.getMilliseconds();
|
|
322
|
-
}, l.$utils = function() {
|
|
323
|
-
return C;
|
|
324
|
-
}, l.isValid = function() {
|
|
325
|
-
return this.$d.toString() !== _;
|
|
326
|
-
}, l.isSame = function(n, c) {
|
|
327
|
-
var i = L(n);
|
|
328
|
-
return this.startOf(c) <= i && i <= this.endOf(c);
|
|
329
|
-
}, l.isAfter = function(n, c) {
|
|
330
|
-
return L(n) < this.startOf(c);
|
|
331
|
-
}, l.isBefore = function(n, c) {
|
|
332
|
-
return this.endOf(c) < L(n);
|
|
333
|
-
}, l.$g = function(n, c, i) {
|
|
334
|
-
return C.u(n) ? this[c] : this.set(i, n);
|
|
335
|
-
}, l.unix = function() {
|
|
336
|
-
return Math.floor(this.valueOf() / 1e3);
|
|
337
|
-
}, l.valueOf = function() {
|
|
338
|
-
return this.$d.getTime();
|
|
339
|
-
}, l.startOf = function(n, c) {
|
|
340
|
-
var i = this, p = !!C.u(c) || c, g = C.p(n), s = function(Z, W) {
|
|
341
|
-
var G = C.w(i.$u ? Date.UTC(i.$y, W, Z) : new Date(i.$y, W, Z), i);
|
|
342
|
-
return p ? G : G.endOf(f);
|
|
343
|
-
}, v = function(Z, W) {
|
|
344
|
-
return C.w(i.toDate()[Z].apply(i.toDate("s"), (p ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(W)), i);
|
|
345
|
-
}, k = this.$W, b = this.$M, F = this.$D, V = "set" + (this.$u ? "UTC" : "");
|
|
346
|
-
switch (g) {
|
|
347
|
-
case $:
|
|
348
|
-
return p ? s(1, 0) : s(31, 11);
|
|
349
|
-
case T:
|
|
350
|
-
return p ? s(1, b) : s(0, b + 1);
|
|
351
|
-
case d:
|
|
352
|
-
var Y = this.$locale().weekStart || 0, E = (k < Y ? k + 7 : k) - Y;
|
|
353
|
-
return s(p ? F - E : F + (6 - E), b);
|
|
354
|
-
case f:
|
|
355
|
-
case m:
|
|
356
|
-
return v(V + "Hours", 0);
|
|
357
|
-
case h:
|
|
358
|
-
return v(V + "Minutes", 1);
|
|
359
|
-
case M:
|
|
360
|
-
return v(V + "Seconds", 2);
|
|
361
|
-
case a:
|
|
362
|
-
return v(V + "Milliseconds", 3);
|
|
363
|
-
default:
|
|
364
|
-
return this.clone();
|
|
365
|
-
}
|
|
366
|
-
}, l.endOf = function(n) {
|
|
367
|
-
return this.startOf(n, !1);
|
|
368
|
-
}, l.$set = function(n, c) {
|
|
369
|
-
var i, p = C.p(n), g = "set" + (this.$u ? "UTC" : ""), s = (i = {}, i[f] = g + "Date", i[m] = g + "Date", i[T] = g + "Month", i[$] = g + "FullYear", i[h] = g + "Hours", i[M] = g + "Minutes", i[a] = g + "Seconds", i[S] = g + "Milliseconds", i)[p], v = p === f ? this.$D + (c - this.$W) : c;
|
|
370
|
-
if (p === T || p === $) {
|
|
371
|
-
var k = this.clone().set(m, 1);
|
|
372
|
-
k.$d[s](v), k.init(), this.$d = k.set(m, Math.min(this.$D, k.daysInMonth())).$d;
|
|
373
|
-
} else s && this.$d[s](v);
|
|
374
|
-
return this.init(), this;
|
|
375
|
-
}, l.set = function(n, c) {
|
|
376
|
-
return this.clone().$set(n, c);
|
|
377
|
-
}, l.get = function(n) {
|
|
378
|
-
return this[C.p(n)]();
|
|
379
|
-
}, l.add = function(n, c) {
|
|
380
|
-
var i, p = this;
|
|
381
|
-
n = Number(n);
|
|
382
|
-
var g = C.p(c), s = function(b) {
|
|
383
|
-
var F = L(p);
|
|
384
|
-
return C.w(F.date(F.date() + Math.round(b * n)), p);
|
|
385
|
-
};
|
|
386
|
-
if (g === T) return this.set(T, this.$M + n);
|
|
387
|
-
if (g === $) return this.set($, this.$y + n);
|
|
388
|
-
if (g === f) return s(1);
|
|
389
|
-
if (g === d) return s(7);
|
|
390
|
-
var v = (i = {}, i[M] = y, i[h] = x, i[a] = t, i)[g] || 1, k = this.$d.getTime() + n * v;
|
|
391
|
-
return C.w(k, this);
|
|
392
|
-
}, l.subtract = function(n, c) {
|
|
393
|
-
return this.add(-1 * n, c);
|
|
394
|
-
}, l.format = function(n) {
|
|
395
|
-
var c = this, i = this.$locale();
|
|
396
|
-
if (!this.isValid()) return i.invalidDate || _;
|
|
397
|
-
var p = n || "YYYY-MM-DDTHH:mm:ssZ", g = C.z(this), s = this.$H, v = this.$m, k = this.$M, b = i.weekdays, F = i.months, V = i.meridiem, Y = function(W, G, ne, le) {
|
|
398
|
-
return W && (W[G] || W(c, p)) || ne[G].slice(0, le);
|
|
399
|
-
}, E = function(W) {
|
|
400
|
-
return C.s(s % 12 || 12, W, "0");
|
|
401
|
-
}, Z = V || function(W, G, ne) {
|
|
402
|
-
var le = W < 12 ? "AM" : "PM";
|
|
403
|
-
return ne ? le.toLowerCase() : le;
|
|
404
|
-
};
|
|
405
|
-
return p.replace(O, (function(W, G) {
|
|
406
|
-
return G || (function(ne) {
|
|
407
|
-
switch (ne) {
|
|
408
|
-
case "YY":
|
|
409
|
-
return String(c.$y).slice(-2);
|
|
410
|
-
case "YYYY":
|
|
411
|
-
return C.s(c.$y, 4, "0");
|
|
412
|
-
case "M":
|
|
413
|
-
return k + 1;
|
|
414
|
-
case "MM":
|
|
415
|
-
return C.s(k + 1, 2, "0");
|
|
416
|
-
case "MMM":
|
|
417
|
-
return Y(i.monthsShort, k, F, 3);
|
|
418
|
-
case "MMMM":
|
|
419
|
-
return Y(F, k);
|
|
420
|
-
case "D":
|
|
421
|
-
return c.$D;
|
|
422
|
-
case "DD":
|
|
423
|
-
return C.s(c.$D, 2, "0");
|
|
424
|
-
case "d":
|
|
425
|
-
return String(c.$W);
|
|
426
|
-
case "dd":
|
|
427
|
-
return Y(i.weekdaysMin, c.$W, b, 2);
|
|
428
|
-
case "ddd":
|
|
429
|
-
return Y(i.weekdaysShort, c.$W, b, 3);
|
|
430
|
-
case "dddd":
|
|
431
|
-
return b[c.$W];
|
|
432
|
-
case "H":
|
|
433
|
-
return String(s);
|
|
434
|
-
case "HH":
|
|
435
|
-
return C.s(s, 2, "0");
|
|
436
|
-
case "h":
|
|
437
|
-
return E(1);
|
|
438
|
-
case "hh":
|
|
439
|
-
return E(2);
|
|
440
|
-
case "a":
|
|
441
|
-
return Z(s, v, !0);
|
|
442
|
-
case "A":
|
|
443
|
-
return Z(s, v, !1);
|
|
444
|
-
case "m":
|
|
445
|
-
return String(v);
|
|
446
|
-
case "mm":
|
|
447
|
-
return C.s(v, 2, "0");
|
|
448
|
-
case "s":
|
|
449
|
-
return String(c.$s);
|
|
450
|
-
case "ss":
|
|
451
|
-
return C.s(c.$s, 2, "0");
|
|
452
|
-
case "SSS":
|
|
453
|
-
return C.s(c.$ms, 3, "0");
|
|
454
|
-
case "Z":
|
|
455
|
-
return g;
|
|
381
|
+
),
|
|
382
|
+
/* @__PURE__ */ e(
|
|
383
|
+
Qe,
|
|
384
|
+
{
|
|
385
|
+
style: { transform: k ? "rotate(180deg)" : void 0, transition: "transform 150ms" }
|
|
456
386
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
}
|
|
527
|
-
var gt = pt();
|
|
528
|
-
const yt = /* @__PURE__ */ ht(gt), vt = (o, r) => yt(`${o}T${r}`).format(), $t = ({ path: o, label: r, required: t, errors: y, description: x, children: S }) => {
|
|
529
|
-
const a = y.length === 0;
|
|
530
|
-
return /* @__PURE__ */ e(U, { mb: "4", children: /* @__PURE__ */ z(R, { direction: "column", gap: "1", children: [
|
|
531
|
-
/* @__PURE__ */ z(D, { as: "label", size: "2", weight: "bold", htmlFor: o, children: [
|
|
387
|
+
)
|
|
388
|
+
] }) })
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
k && /* @__PURE__ */ e(
|
|
392
|
+
C,
|
|
393
|
+
{
|
|
394
|
+
style: {
|
|
395
|
+
position: "absolute",
|
|
396
|
+
top: "calc(100% + 4px)",
|
|
397
|
+
left: 0,
|
|
398
|
+
right: 0,
|
|
399
|
+
zIndex: 50,
|
|
400
|
+
background: "var(--color-panel-solid)",
|
|
401
|
+
borderRadius: "var(--radius-3)",
|
|
402
|
+
boxShadow: "var(--shadow-5)",
|
|
403
|
+
border: "1px solid var(--gray-a6)",
|
|
404
|
+
overflow: "hidden"
|
|
405
|
+
},
|
|
406
|
+
children: $ ? /* @__PURE__ */ e(C, { p: "3", children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: $ }) }) : /* @__PURE__ */ e(qe, { style: { maxHeight: 240 }, children: /* @__PURE__ */ f(C, { p: "1", children: [
|
|
407
|
+
I && /* @__PURE__ */ e(z, { justify: "center", p: "4", children: /* @__PURE__ */ e(Ce, {}) }),
|
|
408
|
+
!I && oe && /* @__PURE__ */ e(C, { px: "3", py: "2", children: /* @__PURE__ */ e(c, { size: "2", color: "red", children: oe }) }),
|
|
409
|
+
!I && !oe && te.length === 0 && /* @__PURE__ */ e(C, { px: "3", py: "2", children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: O || u ? "No results found." : "Type to search…" }) }),
|
|
410
|
+
te.map((m) => /* @__PURE__ */ e(
|
|
411
|
+
C,
|
|
412
|
+
{
|
|
413
|
+
px: "3",
|
|
414
|
+
py: "2",
|
|
415
|
+
onMouseDown: (E) => E.preventDefault(),
|
|
416
|
+
onClick: () => P(m),
|
|
417
|
+
style: {
|
|
418
|
+
cursor: "pointer",
|
|
419
|
+
borderRadius: "var(--radius-2)",
|
|
420
|
+
backgroundColor: m.id === t ? "var(--accent-3)" : void 0
|
|
421
|
+
},
|
|
422
|
+
className: "hover:bg-(--gray-3)",
|
|
423
|
+
children: /* @__PURE__ */ e(c, { size: "2", children: m.name })
|
|
424
|
+
},
|
|
425
|
+
m.id
|
|
426
|
+
)),
|
|
427
|
+
(o == null ? void 0 : o.paginated) && re && !ne && /* @__PURE__ */ e(C, { px: "3", py: "2", children: /* @__PURE__ */ e(
|
|
428
|
+
he,
|
|
429
|
+
{
|
|
430
|
+
variant: "ghost",
|
|
431
|
+
size: "1",
|
|
432
|
+
style: { width: "100%" },
|
|
433
|
+
onMouseDown: (m) => m.preventDefault(),
|
|
434
|
+
onClick: () => void b(O, !0),
|
|
435
|
+
children: "Load more"
|
|
436
|
+
}
|
|
437
|
+
) }),
|
|
438
|
+
ne && /* @__PURE__ */ e(z, { justify: "center", p: "2", children: /* @__PURE__ */ e(Ce, {}) })
|
|
439
|
+
] }) })
|
|
440
|
+
}
|
|
441
|
+
)
|
|
442
|
+
] }),
|
|
443
|
+
!R && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(h, a) }),
|
|
444
|
+
d.description && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: d.description })
|
|
445
|
+
] }) });
|
|
446
|
+
}, Tr = J(Sr), Rr = D(
|
|
447
|
+
3,
|
|
448
|
+
$e((t) => {
|
|
449
|
+
const r = t["x-search"];
|
|
450
|
+
return t.type === "string" && typeof (r == null ? void 0 : r.service) == "string" && r.service !== "";
|
|
451
|
+
})
|
|
452
|
+
), kr = (t, r) => lr(`${t}T${r}`).format(), $r = ({ path: t, label: r, required: n, errors: a, description: y, children: h }) => {
|
|
453
|
+
const s = a.length === 0;
|
|
454
|
+
return /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ f(z, { direction: "column", gap: "1", children: [
|
|
455
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
|
|
532
456
|
r,
|
|
533
457
|
" ",
|
|
534
|
-
|
|
458
|
+
n && /* @__PURE__ */ e(c, { color: "red", children: "*" })
|
|
535
459
|
] }),
|
|
536
|
-
|
|
537
|
-
!
|
|
538
|
-
|
|
460
|
+
h,
|
|
461
|
+
!s && /* @__PURE__ */ e(c, { color: "red", size: "1", children: _(a, r) }),
|
|
462
|
+
y && /* @__PURE__ */ e(c, { size: "1", color: "gray", children: y })
|
|
539
463
|
] }) });
|
|
540
|
-
},
|
|
541
|
-
data:
|
|
464
|
+
}, Fr = ({
|
|
465
|
+
data: t,
|
|
542
466
|
handleChange: r,
|
|
543
|
-
path:
|
|
544
|
-
label:
|
|
545
|
-
required:
|
|
546
|
-
errors:
|
|
547
|
-
schema:
|
|
548
|
-
enabled:
|
|
549
|
-
visible:
|
|
467
|
+
path: n,
|
|
468
|
+
label: a,
|
|
469
|
+
required: y,
|
|
470
|
+
errors: h,
|
|
471
|
+
schema: s,
|
|
472
|
+
enabled: v,
|
|
473
|
+
visible: d = !0
|
|
550
474
|
}) => {
|
|
551
|
-
if (
|
|
552
|
-
|
|
553
|
-
}, [
|
|
475
|
+
if (X(() => {
|
|
476
|
+
d === !1 && r(n, void 0);
|
|
477
|
+
}, [d, n, r]), d === !1)
|
|
554
478
|
return null;
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
return
|
|
479
|
+
const g = h.length === 0, l = typeof t == "string" ? t : "", x = (w) => /* @__PURE__ */ e($r, { path: n, label: a, required: y, errors: h, description: s.description, children: w });
|
|
480
|
+
if (s.format === "time")
|
|
481
|
+
return x(
|
|
558
482
|
/* @__PURE__ */ e(
|
|
559
|
-
|
|
483
|
+
Y.Root,
|
|
560
484
|
{
|
|
561
485
|
type: "time",
|
|
562
|
-
value:
|
|
563
|
-
onChange: (
|
|
564
|
-
disabled: !
|
|
565
|
-
color:
|
|
566
|
-
id:
|
|
486
|
+
value: l,
|
|
487
|
+
onChange: (w) => r(n, w.target.value),
|
|
488
|
+
disabled: !v,
|
|
489
|
+
color: g ? void 0 : "red",
|
|
490
|
+
id: n
|
|
567
491
|
}
|
|
568
492
|
)
|
|
569
493
|
);
|
|
570
|
-
const
|
|
571
|
-
if (!
|
|
572
|
-
r(
|
|
494
|
+
const p = s.format === "date-time", [o = "", u = ""] = l.split("T"), S = u.slice(0, 5), $ = (w, R) => {
|
|
495
|
+
if (!w) {
|
|
496
|
+
r(n, void 0);
|
|
573
497
|
return;
|
|
574
498
|
}
|
|
575
|
-
r(
|
|
499
|
+
r(n, p ? kr(w, R || "00:00") : w);
|
|
576
500
|
};
|
|
577
|
-
return
|
|
578
|
-
/* @__PURE__ */ z
|
|
501
|
+
return x(
|
|
502
|
+
/* @__PURE__ */ f(z, { gap: "2", align: "center", children: [
|
|
579
503
|
/* @__PURE__ */ e(
|
|
580
|
-
|
|
504
|
+
Y.Root,
|
|
581
505
|
{
|
|
582
506
|
type: "date",
|
|
583
|
-
value:
|
|
584
|
-
disabled: !
|
|
585
|
-
color:
|
|
586
|
-
onChange: (
|
|
587
|
-
id:
|
|
507
|
+
value: o,
|
|
508
|
+
disabled: !v,
|
|
509
|
+
color: g ? void 0 : "red",
|
|
510
|
+
onChange: (w) => $(w.target.value, S),
|
|
511
|
+
id: n,
|
|
588
512
|
style: { flex: 1 }
|
|
589
513
|
}
|
|
590
514
|
),
|
|
591
|
-
|
|
592
|
-
|
|
515
|
+
p && /* @__PURE__ */ e(
|
|
516
|
+
Y.Root,
|
|
593
517
|
{
|
|
594
518
|
type: "time",
|
|
595
|
-
value:
|
|
596
|
-
disabled: !
|
|
597
|
-
color:
|
|
598
|
-
onChange: (
|
|
519
|
+
value: S,
|
|
520
|
+
disabled: !v || !o,
|
|
521
|
+
color: g ? void 0 : "red",
|
|
522
|
+
onChange: (w) => $(o, w.target.value),
|
|
599
523
|
style: { flex: 1 }
|
|
600
524
|
}
|
|
601
525
|
)
|
|
602
526
|
] })
|
|
603
527
|
);
|
|
604
|
-
},
|
|
605
|
-
uischema:
|
|
528
|
+
}, Dr = D(2, ge(Pe, Be, Me)), Or = J(Fr), Ir = ({
|
|
529
|
+
uischema: t,
|
|
606
530
|
schema: r,
|
|
607
|
-
path:
|
|
608
|
-
renderers:
|
|
609
|
-
cells:
|
|
610
|
-
enabled:
|
|
611
|
-
visible:
|
|
531
|
+
path: n,
|
|
532
|
+
renderers: a,
|
|
533
|
+
cells: y,
|
|
534
|
+
enabled: h,
|
|
535
|
+
visible: s = !0
|
|
612
536
|
}) => {
|
|
613
|
-
const
|
|
614
|
-
return
|
|
615
|
-
|
|
537
|
+
const d = t.elements;
|
|
538
|
+
return s === !1 ? null : /* @__PURE__ */ e(z, { direction: "column", gap: "4", children: d.map((g, l) => /* @__PURE__ */ e(
|
|
539
|
+
ce,
|
|
616
540
|
{
|
|
617
|
-
uischema:
|
|
541
|
+
uischema: g,
|
|
618
542
|
schema: r,
|
|
619
|
-
path:
|
|
620
|
-
renderers:
|
|
621
|
-
cells:
|
|
622
|
-
enabled:
|
|
543
|
+
path: n,
|
|
544
|
+
renderers: a,
|
|
545
|
+
cells: y,
|
|
546
|
+
enabled: h
|
|
623
547
|
},
|
|
624
|
-
`${
|
|
548
|
+
`${n}-${l}`
|
|
625
549
|
)) });
|
|
626
|
-
},
|
|
627
|
-
uischema:
|
|
550
|
+
}, Lr = D(1, ie("VerticalLayout")), Ar = ({
|
|
551
|
+
uischema: t,
|
|
628
552
|
schema: r,
|
|
629
|
-
path:
|
|
630
|
-
renderers:
|
|
631
|
-
cells:
|
|
632
|
-
enabled:
|
|
633
|
-
visible:
|
|
553
|
+
path: n,
|
|
554
|
+
renderers: a,
|
|
555
|
+
cells: y,
|
|
556
|
+
enabled: h,
|
|
557
|
+
visible: s = !0
|
|
634
558
|
}) => {
|
|
635
|
-
const
|
|
636
|
-
return
|
|
637
|
-
|
|
559
|
+
const d = t.elements;
|
|
560
|
+
return s === !1 ? null : /* @__PURE__ */ e(z, { direction: "row", gap: "4", children: d.map((g, l) => /* @__PURE__ */ e(C, { style: { flex: 1 }, children: /* @__PURE__ */ e(
|
|
561
|
+
ce,
|
|
638
562
|
{
|
|
639
|
-
uischema:
|
|
563
|
+
uischema: g,
|
|
640
564
|
schema: r,
|
|
641
|
-
path:
|
|
642
|
-
renderers:
|
|
643
|
-
cells:
|
|
644
|
-
enabled:
|
|
565
|
+
path: n,
|
|
566
|
+
renderers: a,
|
|
567
|
+
cells: y,
|
|
568
|
+
enabled: h
|
|
645
569
|
}
|
|
646
|
-
) }, `${
|
|
647
|
-
},
|
|
648
|
-
uischema:
|
|
570
|
+
) }, `${n}-${l}`)) });
|
|
571
|
+
}, Ur = D(1, ie("HorizontalLayout")), Er = ({
|
|
572
|
+
uischema: t,
|
|
649
573
|
schema: r,
|
|
650
|
-
path:
|
|
651
|
-
renderers:
|
|
652
|
-
cells:
|
|
653
|
-
enabled:
|
|
654
|
-
visible:
|
|
574
|
+
path: n,
|
|
575
|
+
renderers: a,
|
|
576
|
+
cells: y,
|
|
577
|
+
enabled: h,
|
|
578
|
+
visible: s = !0
|
|
655
579
|
}) => {
|
|
656
|
-
const
|
|
657
|
-
return
|
|
658
|
-
|
|
659
|
-
/* @__PURE__ */ e(
|
|
660
|
-
|
|
580
|
+
const v = t, d = v.elements;
|
|
581
|
+
return s === !1 ? null : /* @__PURE__ */ f(C, { mb: "6", children: [
|
|
582
|
+
v.label && /* @__PURE__ */ e(Fe, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: v.label }),
|
|
583
|
+
/* @__PURE__ */ e(z, { direction: "column", gap: "4", children: d.map((g, l) => /* @__PURE__ */ e(
|
|
584
|
+
ce,
|
|
661
585
|
{
|
|
662
|
-
uischema:
|
|
586
|
+
uischema: g,
|
|
663
587
|
schema: r,
|
|
664
|
-
path:
|
|
665
|
-
renderers:
|
|
666
|
-
cells:
|
|
667
|
-
enabled:
|
|
588
|
+
path: n,
|
|
589
|
+
renderers: a,
|
|
590
|
+
cells: y,
|
|
591
|
+
enabled: h
|
|
668
592
|
},
|
|
669
|
-
`${
|
|
593
|
+
`${n}-${l}`
|
|
670
594
|
)) })
|
|
671
595
|
] });
|
|
672
|
-
},
|
|
673
|
-
uischema:
|
|
596
|
+
}, Vr = D(1, ie("Group")), jr = ({
|
|
597
|
+
uischema: t,
|
|
674
598
|
schema: r,
|
|
675
|
-
path:
|
|
676
|
-
renderers:
|
|
677
|
-
cells:
|
|
678
|
-
enabled:
|
|
679
|
-
visible:
|
|
599
|
+
path: n,
|
|
600
|
+
renderers: a,
|
|
601
|
+
cells: y,
|
|
602
|
+
enabled: h,
|
|
603
|
+
visible: s = !0
|
|
680
604
|
}) => {
|
|
681
|
-
var
|
|
682
|
-
const
|
|
683
|
-
if (
|
|
684
|
-
const
|
|
685
|
-
return /* @__PURE__ */
|
|
686
|
-
/* @__PURE__ */ e(
|
|
687
|
-
/* @__PURE__ */ e(
|
|
688
|
-
|
|
605
|
+
var p;
|
|
606
|
+
const d = t.elements.filter((o) => o.type === "Category"), [g, l] = A(((p = d[0]) == null ? void 0 : p.label) || "");
|
|
607
|
+
if (s === !1 || !d.length) return null;
|
|
608
|
+
const x = d.find((o) => o.label === g) ? g : d[0].label;
|
|
609
|
+
return /* @__PURE__ */ f(ue.Root, { value: x, onValueChange: l, children: [
|
|
610
|
+
/* @__PURE__ */ e(ue.List, { children: d.map((o, u) => /* @__PURE__ */ e(ue.Trigger, { value: o.label, children: o.label }, `${n}-${u}`)) }),
|
|
611
|
+
/* @__PURE__ */ e(C, { pt: "3", children: d.map((o, u) => /* @__PURE__ */ e(ue.Content, { value: o.label, children: /* @__PURE__ */ e(z, { direction: "column", gap: "4", children: o.elements.map((S, $) => /* @__PURE__ */ e(
|
|
612
|
+
ce,
|
|
689
613
|
{
|
|
690
|
-
uischema:
|
|
614
|
+
uischema: S,
|
|
691
615
|
schema: r,
|
|
692
|
-
path:
|
|
693
|
-
renderers:
|
|
694
|
-
cells:
|
|
695
|
-
enabled:
|
|
616
|
+
path: n,
|
|
617
|
+
renderers: a,
|
|
618
|
+
cells: y,
|
|
619
|
+
enabled: h
|
|
696
620
|
},
|
|
697
|
-
`${
|
|
698
|
-
)) }) }, `${
|
|
621
|
+
`${n}-${u}-${$}`
|
|
622
|
+
)) }) }, `${n}-${u}`)) })
|
|
699
623
|
] });
|
|
700
|
-
},
|
|
701
|
-
function
|
|
702
|
-
return
|
|
624
|
+
}, Nr = D(1, ie("Categorization"));
|
|
625
|
+
function Pr(t) {
|
|
626
|
+
return t ? Array.isArray(t) ? t : [t] : [];
|
|
703
627
|
}
|
|
704
|
-
function
|
|
705
|
-
return
|
|
628
|
+
function fe(t) {
|
|
629
|
+
return t >= 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(0)} MB` : t >= 1024 ? `${(t / 1024).toFixed(0)} KB` : `${t} B`;
|
|
706
630
|
}
|
|
707
|
-
function
|
|
708
|
-
return
|
|
631
|
+
function pe(t) {
|
|
632
|
+
return t.split(",").map((r) => {
|
|
709
633
|
if (r = r.trim(), r.endsWith("/*"))
|
|
710
634
|
return r.split("/")[0].toUpperCase() + "S";
|
|
711
635
|
if (r.startsWith("."))
|
|
712
636
|
return r.slice(1).toUpperCase();
|
|
713
|
-
const
|
|
714
|
-
return
|
|
637
|
+
const n = r.split("/")[1];
|
|
638
|
+
return n ? n.toUpperCase() : r;
|
|
715
639
|
}).join(", ");
|
|
716
640
|
}
|
|
717
|
-
const
|
|
718
|
-
data:
|
|
641
|
+
const Br = ({
|
|
642
|
+
data: t,
|
|
719
643
|
handleChange: r,
|
|
720
|
-
path:
|
|
721
|
-
label:
|
|
722
|
-
required:
|
|
723
|
-
uischema:
|
|
724
|
-
schema:
|
|
725
|
-
enabled:
|
|
726
|
-
errors:
|
|
727
|
-
visible:
|
|
644
|
+
path: n,
|
|
645
|
+
label: a,
|
|
646
|
+
required: y,
|
|
647
|
+
uischema: h,
|
|
648
|
+
schema: s,
|
|
649
|
+
enabled: v,
|
|
650
|
+
errors: d,
|
|
651
|
+
visible: g = !0
|
|
728
652
|
}) => {
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
const T = !h || h.length === 0, w = (a == null ? void 0 : a["x-file"]) ?? {}, $ = (S == null ? void 0 : S.options) ?? {}, m = w.maxFiles ?? $.maxFiles ?? 1, _ = w.maxSize ?? $.maxSize ?? 5 * 1024 * 1024, I = w.accept ?? $.accept ?? "image/*,application/pdf", O = m > 1, A = M !== !1, [J, K] = fe(!1), [H, j] = fe(null), [te, ee] = fe({}), P = ye(/* @__PURE__ */ new Set()), L = ye(null), C = Lt(o), B = C.length >= m;
|
|
735
|
-
q(() => () => {
|
|
736
|
-
P.current.forEach((s) => URL.revokeObjectURL(s)), P.current.clear();
|
|
653
|
+
const l = ir();
|
|
654
|
+
ee(g, n, r, null);
|
|
655
|
+
const x = !d || d.length === 0, p = (s == null ? void 0 : s["x-file"]) ?? {}, o = (h == null ? void 0 : h.options) ?? {}, u = p.maxFiles ?? o.maxFiles ?? 1, S = p.maxSize ?? o.maxSize ?? 5 * 1024 * 1024, $ = p.accept ?? o.accept ?? "image/*,application/pdf", w = u > 1, R = v !== !1, [k, V] = A(!1), [O, j] = A(null), [te, N] = A({}), re = Q(/* @__PURE__ */ new Set()), U = Q(null), I = Pr(t), B = I.length >= u;
|
|
656
|
+
X(() => () => {
|
|
657
|
+
re.current.forEach((i) => URL.revokeObjectURL(i)), re.current.clear();
|
|
737
658
|
}, []);
|
|
738
|
-
const
|
|
739
|
-
async (
|
|
740
|
-
if (j(null),
|
|
741
|
-
j(`Maximum ${
|
|
659
|
+
const ne = Te(
|
|
660
|
+
async (i) => {
|
|
661
|
+
if (j(null), I.length >= u) {
|
|
662
|
+
j(`Maximum ${u} file${u > 1 ? "s" : ""} allowed.`);
|
|
742
663
|
return;
|
|
743
664
|
}
|
|
744
|
-
if (
|
|
745
|
-
j(`File exceeds the ${
|
|
665
|
+
if (i.size > S) {
|
|
666
|
+
j(`File exceeds the ${fe(S)} limit.`);
|
|
746
667
|
return;
|
|
747
668
|
}
|
|
748
|
-
if (
|
|
749
|
-
j(`Invalid type. Accepted: ${
|
|
669
|
+
if (!$.split(",").map((b) => b.trim()).some((b) => b === "*" || b === "*/*" ? !0 : b.endsWith("/*") ? i.type.startsWith(b.slice(0, -1)) : b.startsWith(".") ? i.name.toLowerCase().endsWith(b.toLowerCase()) : i.type === b)) {
|
|
670
|
+
j(`Invalid type. Accepted: ${pe($)}`);
|
|
750
671
|
return;
|
|
751
672
|
}
|
|
752
|
-
if (!(
|
|
673
|
+
if (!(l != null && l.onUpload)) {
|
|
753
674
|
j("Upload service not configured.");
|
|
754
675
|
return;
|
|
755
676
|
}
|
|
756
677
|
try {
|
|
757
|
-
const b = await
|
|
758
|
-
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
r(
|
|
678
|
+
const b = await l.onUpload(i), L = URL.createObjectURL(i);
|
|
679
|
+
re.current.add(L);
|
|
680
|
+
const P = { key: b.key, name: b.name ?? i.name, blobUrl: L };
|
|
681
|
+
N((G) => ({ ...G, [b.key]: P }));
|
|
682
|
+
const K = [...I, b.key];
|
|
683
|
+
r(n, w ? K : K[0]);
|
|
763
684
|
} catch {
|
|
764
|
-
j("Upload failed. Please try again."),
|
|
685
|
+
j("Upload failed. Please try again."), U.current && (U.current.value = "");
|
|
765
686
|
}
|
|
766
687
|
},
|
|
767
|
-
[
|
|
768
|
-
)
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
},
|
|
774
|
-
var
|
|
775
|
-
(
|
|
776
|
-
},
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
688
|
+
[I, u, S, $, l, n, r, w]
|
|
689
|
+
);
|
|
690
|
+
if (g === !1)
|
|
691
|
+
return null;
|
|
692
|
+
const M = (i) => {
|
|
693
|
+
i.preventDefault(), i.stopPropagation(), !(!R || B) && V(i.type === "dragenter" || i.type === "dragover");
|
|
694
|
+
}, oe = (i) => {
|
|
695
|
+
var T;
|
|
696
|
+
i.preventDefault(), i.stopPropagation(), V(!1), !(!R || B) && (T = i.dataTransfer.files) != null && T[0] && ne(i.dataTransfer.files[0]);
|
|
697
|
+
}, W = (i) => {
|
|
698
|
+
var T;
|
|
699
|
+
(T = i.target.files) != null && T[0] && (ne(i.target.files[0]), i.target.value = "");
|
|
700
|
+
}, le = (i) => {
|
|
701
|
+
if (!R) return;
|
|
702
|
+
N((F) => {
|
|
703
|
+
var P;
|
|
704
|
+
const b = { ...F }, L = (P = b[i]) == null ? void 0 : P.blobUrl;
|
|
705
|
+
return L && (URL.revokeObjectURL(L), re.current.delete(L)), delete b[i], b;
|
|
782
706
|
});
|
|
783
|
-
const
|
|
784
|
-
r(
|
|
785
|
-
},
|
|
786
|
-
var
|
|
787
|
-
|
|
788
|
-
const
|
|
789
|
-
if (
|
|
790
|
-
(
|
|
707
|
+
const T = I.filter((F) => F !== i);
|
|
708
|
+
r(n, w ? T.length > 0 ? T : null : T[0] ?? null);
|
|
709
|
+
}, q = async (i, T) => {
|
|
710
|
+
var L, P, K;
|
|
711
|
+
i.preventDefault();
|
|
712
|
+
const F = (L = te[T]) == null ? void 0 : L.blobUrl;
|
|
713
|
+
if (F) {
|
|
714
|
+
(P = window.open(F, "_blank", "noopener,noreferrer")) == null || P.focus();
|
|
791
715
|
return;
|
|
792
716
|
}
|
|
793
717
|
const b = window.open("", "_blank");
|
|
794
718
|
if (b)
|
|
795
719
|
try {
|
|
796
|
-
const
|
|
797
|
-
|
|
720
|
+
const G = await ((K = l == null ? void 0 : l.getDownloadUrl) == null ? void 0 : K.call(l, T));
|
|
721
|
+
G != null && G.url ? b.location.href = G.url : b.close();
|
|
798
722
|
} catch {
|
|
799
723
|
b.close();
|
|
800
724
|
}
|
|
801
725
|
};
|
|
802
|
-
if (!
|
|
803
|
-
const
|
|
804
|
-
return /* @__PURE__ */
|
|
805
|
-
/* @__PURE__ */ z
|
|
806
|
-
/* @__PURE__ */
|
|
807
|
-
|
|
808
|
-
|
|
726
|
+
if (!R && I.length === 0) return null;
|
|
727
|
+
const H = u - I.length, Z = R && !B;
|
|
728
|
+
return /* @__PURE__ */ f(C, { mb: "4", children: [
|
|
729
|
+
/* @__PURE__ */ f(z, { align: "center", justify: "between", mb: "2", children: [
|
|
730
|
+
/* @__PURE__ */ f(c, { as: "label", size: "2", weight: "bold", children: [
|
|
731
|
+
a,
|
|
732
|
+
y && /* @__PURE__ */ e(c, { color: "red", children: " *" })
|
|
809
733
|
] }),
|
|
810
|
-
/* @__PURE__ */ e(
|
|
734
|
+
/* @__PURE__ */ e(c, { size: "1", color: "gray", children: w ? `Up to ${u} files · ${fe(S)} each · ${pe($)}` : `${fe(S)} · ${pe($)}` })
|
|
811
735
|
] }),
|
|
812
|
-
|
|
813
|
-
var
|
|
814
|
-
return /* @__PURE__ */ e(De, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ z
|
|
736
|
+
I.map((i) => {
|
|
737
|
+
var T;
|
|
738
|
+
return /* @__PURE__ */ e(De, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ f(z, { align: "center", gap: "3", children: [
|
|
815
739
|
/* @__PURE__ */ e(
|
|
816
|
-
|
|
740
|
+
C,
|
|
817
741
|
{
|
|
818
742
|
style: {
|
|
819
743
|
background: "var(--blue-3)",
|
|
@@ -822,11 +746,11 @@ const Ft = ({
|
|
|
822
746
|
color: "var(--blue-9)",
|
|
823
747
|
flexShrink: 0
|
|
824
748
|
},
|
|
825
|
-
children: /* @__PURE__ */ e(
|
|
749
|
+
children: /* @__PURE__ */ e(Xe, { width: "20", height: "20" })
|
|
826
750
|
}
|
|
827
751
|
),
|
|
828
|
-
/* @__PURE__ */ e(
|
|
829
|
-
|
|
752
|
+
/* @__PURE__ */ e(C, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
|
|
753
|
+
c,
|
|
830
754
|
{
|
|
831
755
|
size: "2",
|
|
832
756
|
weight: "bold",
|
|
@@ -836,204 +760,208 @@ const Ft = ({
|
|
|
836
760
|
textOverflow: "ellipsis",
|
|
837
761
|
whiteSpace: "nowrap"
|
|
838
762
|
},
|
|
839
|
-
children: ((
|
|
763
|
+
children: ((T = te[i]) == null ? void 0 : T.name) ?? "Uploaded File"
|
|
840
764
|
}
|
|
841
765
|
) }),
|
|
842
|
-
/* @__PURE__ */ z
|
|
843
|
-
/* @__PURE__ */ e(
|
|
844
|
-
/* @__PURE__ */ e(
|
|
845
|
-
|
|
766
|
+
/* @__PURE__ */ f(z, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
|
|
767
|
+
/* @__PURE__ */ e(he, { variant: "soft", color: "blue", size: "1", onClick: (F) => q(F, i), children: "View" }),
|
|
768
|
+
/* @__PURE__ */ e(Ye, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
|
|
769
|
+
R && /* @__PURE__ */ e(Ze, { variant: "ghost", color: "gray", onClick: () => le(i), children: /* @__PURE__ */ e(er, {}) })
|
|
846
770
|
] })
|
|
847
|
-
] }) },
|
|
771
|
+
] }) }, i);
|
|
848
772
|
}),
|
|
849
|
-
|
|
773
|
+
Z && /* @__PURE__ */ f(
|
|
850
774
|
"div",
|
|
851
775
|
{
|
|
852
776
|
role: "button",
|
|
853
777
|
tabIndex: 0,
|
|
854
778
|
onClick: () => {
|
|
855
|
-
var
|
|
856
|
-
return (
|
|
779
|
+
var i;
|
|
780
|
+
return (i = U.current) == null ? void 0 : i.click();
|
|
857
781
|
},
|
|
858
|
-
onKeyDown: (
|
|
859
|
-
var
|
|
860
|
-
(
|
|
782
|
+
onKeyDown: (i) => {
|
|
783
|
+
var T;
|
|
784
|
+
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), (T = U.current) == null || T.click());
|
|
861
785
|
},
|
|
862
|
-
onDragEnter:
|
|
863
|
-
onDragLeave:
|
|
864
|
-
onDragOver:
|
|
865
|
-
onDrop:
|
|
786
|
+
onDragEnter: M,
|
|
787
|
+
onDragLeave: M,
|
|
788
|
+
onDragOver: M,
|
|
789
|
+
onDrop: oe,
|
|
866
790
|
style: { cursor: "pointer" },
|
|
867
791
|
className: [
|
|
868
792
|
"border-2 border-dashed rounded-lg p-6 text-center",
|
|
869
793
|
"transition-all duration-200 ease-in-out",
|
|
870
|
-
|
|
794
|
+
k ? "border-blue-500 bg-blue-50" : O ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
|
|
871
795
|
].join(" "),
|
|
872
796
|
children: [
|
|
873
|
-
/* @__PURE__ */ e("input", { ref:
|
|
874
|
-
/* @__PURE__ */ e(
|
|
875
|
-
/* @__PURE__ */ e(
|
|
876
|
-
/* @__PURE__ */ e(
|
|
877
|
-
/* @__PURE__ */ e(
|
|
878
|
-
] }) : /* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */ e(
|
|
880
|
-
/* @__PURE__ */ e(
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
|
|
797
|
+
/* @__PURE__ */ e("input", { ref: U, type: "file", style: { display: "none" }, accept: $, onChange: W }),
|
|
798
|
+
/* @__PURE__ */ e(z, { direction: "column", align: "center", gap: "2", children: O ? /* @__PURE__ */ f(be, { children: [
|
|
799
|
+
/* @__PURE__ */ e(rr, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
|
|
800
|
+
/* @__PURE__ */ e(c, { size: "2", color: "red", weight: "medium", children: O }),
|
|
801
|
+
/* @__PURE__ */ e(c, { size: "1", color: "gray", children: "Click to try again" })
|
|
802
|
+
] }) : /* @__PURE__ */ f(be, { children: [
|
|
803
|
+
/* @__PURE__ */ e(tr, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
|
|
804
|
+
/* @__PURE__ */ e(c, { size: "2", weight: "medium", children: I.length > 0 ? `Add another file (${H} remaining)` : "Click to upload or drag and drop" }),
|
|
805
|
+
/* @__PURE__ */ f(c, { size: "1", color: "gray", children: [
|
|
806
|
+
fe(S),
|
|
883
807
|
" max · ",
|
|
884
|
-
|
|
808
|
+
pe($)
|
|
885
809
|
] })
|
|
886
810
|
] }) })
|
|
887
811
|
]
|
|
888
812
|
}
|
|
889
813
|
),
|
|
890
|
-
|
|
814
|
+
R && B && w && /* @__PURE__ */ f(c, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
|
|
891
815
|
"Maximum ",
|
|
892
|
-
|
|
816
|
+
u,
|
|
893
817
|
" files uploaded. Remove one to replace it."
|
|
894
818
|
] }),
|
|
895
|
-
!
|
|
819
|
+
!x && /* @__PURE__ */ e(c, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: _(d, a) })
|
|
896
820
|
] });
|
|
897
|
-
},
|
|
821
|
+
}, Mr = J(Br), Wr = D(
|
|
898
822
|
10,
|
|
899
823
|
// high rank to beat default array renderer
|
|
900
|
-
|
|
824
|
+
We(
|
|
901
825
|
// Match both single-file (type: string) and multi-file (type: array)
|
|
902
|
-
|
|
903
|
-
if (
|
|
904
|
-
if (
|
|
905
|
-
const r =
|
|
826
|
+
$e((t) => {
|
|
827
|
+
if (t.type === "string" && t.format === "file") return !0;
|
|
828
|
+
if (t.type === "array") {
|
|
829
|
+
const r = t.items;
|
|
906
830
|
return (r == null ? void 0 : r.type) === "string" && (r == null ? void 0 : r.format) === "file";
|
|
907
831
|
}
|
|
908
832
|
return !1;
|
|
909
833
|
})
|
|
910
834
|
)
|
|
911
|
-
),
|
|
912
|
-
data:
|
|
835
|
+
), Hr = ({
|
|
836
|
+
data: t,
|
|
913
837
|
path: r,
|
|
914
|
-
schema:
|
|
915
|
-
uischema:
|
|
916
|
-
enabled:
|
|
917
|
-
visible:
|
|
918
|
-
addItem:
|
|
919
|
-
removeItems:
|
|
920
|
-
rootSchema:
|
|
921
|
-
arraySchema:
|
|
838
|
+
schema: n,
|
|
839
|
+
uischema: a,
|
|
840
|
+
enabled: y,
|
|
841
|
+
visible: h,
|
|
842
|
+
addItem: s,
|
|
843
|
+
removeItems: v,
|
|
844
|
+
rootSchema: d,
|
|
845
|
+
arraySchema: g
|
|
922
846
|
}) => {
|
|
923
|
-
const
|
|
924
|
-
if (
|
|
847
|
+
const l = g ? n : n.items, x = g || n;
|
|
848
|
+
if (h === !1 || !l || typeof l != "object" || Array.isArray(l))
|
|
925
849
|
return null;
|
|
926
|
-
const
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
},
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
932
|
-
|
|
850
|
+
const p = l, o = Array.isArray(t) ? t : [], u = x.title || "Array Items", S = () => {
|
|
851
|
+
const w = He(p, d);
|
|
852
|
+
s && s(r, w)();
|
|
853
|
+
}, $ = (w) => {
|
|
854
|
+
if (v) {
|
|
855
|
+
const R = v(r, [w]);
|
|
856
|
+
R && R();
|
|
933
857
|
}
|
|
934
858
|
};
|
|
935
|
-
return /* @__PURE__ */ e(
|
|
936
|
-
/* @__PURE__ */ e(
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
var
|
|
940
|
-
const
|
|
941
|
-
return /* @__PURE__ */ e(De, { size: "3", variant: "surface", children: /* @__PURE__ */ z
|
|
942
|
-
/* @__PURE__ */ z
|
|
943
|
-
/* @__PURE__ */
|
|
859
|
+
return /* @__PURE__ */ e(C, { mb: "6", children: /* @__PURE__ */ f(z, { direction: "column", gap: "4", children: [
|
|
860
|
+
/* @__PURE__ */ e(c, { as: "div", size: "4", weight: "bold", children: u }),
|
|
861
|
+
o.length === 0 && /* @__PURE__ */ e(C, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ e(c, { size: "2", color: "gray", children: "No items have been added yet." }) }),
|
|
862
|
+
o.map((w, R) => {
|
|
863
|
+
var V;
|
|
864
|
+
const k = `${r}.${R}`;
|
|
865
|
+
return /* @__PURE__ */ e(De, { size: "3", variant: "surface", children: /* @__PURE__ */ f(z, { direction: "column", gap: "4", children: [
|
|
866
|
+
/* @__PURE__ */ f(z, { justify: "between", align: "center", children: [
|
|
867
|
+
/* @__PURE__ */ f(c, { size: "3", weight: "bold", children: [
|
|
944
868
|
"Item ",
|
|
945
|
-
|
|
869
|
+
R + 1
|
|
946
870
|
] }),
|
|
947
|
-
|
|
948
|
-
|
|
871
|
+
y && /* @__PURE__ */ f(
|
|
872
|
+
he,
|
|
949
873
|
{
|
|
950
874
|
type: "button",
|
|
951
875
|
color: "red",
|
|
952
876
|
variant: "soft",
|
|
953
|
-
onClick: () =>
|
|
877
|
+
onClick: () => $(R),
|
|
954
878
|
title: "Remove item",
|
|
955
879
|
children: [
|
|
956
|
-
/* @__PURE__ */ e(
|
|
880
|
+
/* @__PURE__ */ e(nr, {}),
|
|
957
881
|
"Remove"
|
|
958
882
|
]
|
|
959
883
|
}
|
|
960
884
|
)
|
|
961
885
|
] }),
|
|
962
|
-
/* @__PURE__ */ e(
|
|
963
|
-
|
|
886
|
+
/* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
887
|
+
ce,
|
|
964
888
|
{
|
|
965
|
-
schema:
|
|
966
|
-
uischema: ((
|
|
889
|
+
schema: p,
|
|
890
|
+
uischema: ((V = a.options) == null ? void 0 : V.detail) || (p.type === "object" || p.properties ? {
|
|
967
891
|
type: "VerticalLayout",
|
|
968
|
-
elements: Object.keys(
|
|
892
|
+
elements: Object.keys(p.properties || {}).map((O) => ({
|
|
969
893
|
type: "Control",
|
|
970
|
-
scope: `#/properties/${
|
|
894
|
+
scope: `#/properties/${O}`
|
|
971
895
|
}))
|
|
972
896
|
} : {
|
|
973
897
|
type: "Control",
|
|
974
898
|
scope: "#"
|
|
975
899
|
}),
|
|
976
|
-
path:
|
|
977
|
-
enabled:
|
|
900
|
+
path: k,
|
|
901
|
+
enabled: y,
|
|
978
902
|
renderers: void 0,
|
|
979
903
|
cells: void 0
|
|
980
904
|
}
|
|
981
905
|
) })
|
|
982
|
-
] }) },
|
|
906
|
+
] }) }, k);
|
|
983
907
|
}),
|
|
984
|
-
|
|
985
|
-
/* @__PURE__ */ e(
|
|
908
|
+
y && /* @__PURE__ */ e(C, { mt: "2", children: /* @__PURE__ */ f(he, { type: "button", variant: "surface", onClick: S, children: [
|
|
909
|
+
/* @__PURE__ */ e(or, {}),
|
|
986
910
|
"Add Item"
|
|
987
911
|
] }) })
|
|
988
912
|
] }) });
|
|
989
|
-
},
|
|
990
|
-
const
|
|
991
|
-
return r === !1 ? null : /* @__PURE__ */ e(
|
|
992
|
-
},
|
|
993
|
-
{ tester:
|
|
994
|
-
{ tester:
|
|
995
|
-
{ tester:
|
|
996
|
-
{ tester:
|
|
997
|
-
{ tester:
|
|
998
|
-
{ tester:
|
|
999
|
-
{ tester:
|
|
1000
|
-
{ tester:
|
|
1001
|
-
{ tester:
|
|
1002
|
-
{ tester:
|
|
1003
|
-
{ tester:
|
|
1004
|
-
{ tester:
|
|
1005
|
-
{ tester:
|
|
1006
|
-
{ tester:
|
|
913
|
+
}, xe = Je(Hr), Kr = D(3, Ke), Gr = ({ uischema: t, visible: r }) => {
|
|
914
|
+
const n = t;
|
|
915
|
+
return r === !1 ? null : /* @__PURE__ */ e(C, { mb: "4", children: /* @__PURE__ */ e(Fe, { size: "4", children: n.text }) });
|
|
916
|
+
}, Jr = D(1, ie("Label")), _r = D(3, Ge), ot = [
|
|
917
|
+
{ tester: ar, renderer: dr },
|
|
918
|
+
{ tester: fr, renderer: pr },
|
|
919
|
+
{ tester: gr, renderer: mr },
|
|
920
|
+
{ tester: vr, renderer: br },
|
|
921
|
+
{ tester: Rr, renderer: Tr },
|
|
922
|
+
{ tester: Cr, renderer: xr },
|
|
923
|
+
{ tester: Dr, renderer: Or },
|
|
924
|
+
{ tester: Lr, renderer: Ir },
|
|
925
|
+
{ tester: Ur, renderer: Ar },
|
|
926
|
+
{ tester: Vr, renderer: Er },
|
|
927
|
+
{ tester: Nr, renderer: jr },
|
|
928
|
+
{ tester: Wr, renderer: Mr },
|
|
929
|
+
{ tester: Kr, renderer: xe },
|
|
930
|
+
{ tester: _r, renderer: xe },
|
|
931
|
+
{ tester: Jr, renderer: Gr }
|
|
1007
932
|
];
|
|
1008
933
|
export {
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
934
|
+
xe as ArrayControl,
|
|
935
|
+
Kr as ArrayControlTester,
|
|
936
|
+
hr as BooleanControl,
|
|
937
|
+
gr as BooleanControlTester,
|
|
938
|
+
jr as CategorizationLayoutRenderer,
|
|
939
|
+
Nr as CategorizationLayoutTester,
|
|
940
|
+
Fr as DateControl,
|
|
941
|
+
Dr as DateControlTester,
|
|
942
|
+
Mr as FileControl,
|
|
943
|
+
Wr as FileControlTester,
|
|
944
|
+
Er as GroupLayoutRenderer,
|
|
945
|
+
Vr as GroupLayoutTester,
|
|
946
|
+
Ar as HorizontalLayoutRenderer,
|
|
947
|
+
Ur as HorizontalLayoutTester,
|
|
948
|
+
Gr as LabelRenderer,
|
|
949
|
+
Jr as LabelTester,
|
|
950
|
+
ur as NumberControl,
|
|
951
|
+
fr as NumberControlTester,
|
|
952
|
+
yr as RadioControl,
|
|
953
|
+
vr as RadioControlTester,
|
|
954
|
+
Tr as SearchSelectControl,
|
|
955
|
+
Rr as SearchSelectControlTester,
|
|
956
|
+
nt as SearchServiceProvider,
|
|
957
|
+
wr as SelectControl,
|
|
958
|
+
Cr as SelectControlTester,
|
|
959
|
+
sr as TextControl,
|
|
960
|
+
ar as TextControlTester,
|
|
961
|
+
tt as UploadProvider,
|
|
962
|
+
Ir as VerticalLayoutRenderer,
|
|
963
|
+
Lr as VerticalLayoutTester,
|
|
964
|
+
ot as radixRenderers,
|
|
965
|
+
cr as useSearchService,
|
|
966
|
+
ir as useUpload
|
|
1039
967
|
};
|