@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.
@@ -1,182 +1,191 @@
1
- import { jsx as e, jsxs as z, Fragment as ge } from "react/jsx-runtime";
2
- import { createContext as xe, useContext as ze, useEffect as q, useState as fe, useRef as ye, useCallback as Te } from "react";
3
- import { rankWith as N, isStringControl as ke, or as me, isNumberControl as Oe, isIntegerControl as Le, isBooleanControl as Fe, isEnumControl as we, isOneOfControl as Ce, isDateControl as Re, isDateTimeControl as Ae, isTimeControl as Ue, uiTypeIs as ie, and as _e, schemaMatches as Ie, createDefaultValue as je, isObjectArrayControl as Ve, isPrimitiveArrayControl as We } from "@jsonforms/core";
4
- import { withJsonFormsControlProps as Q, JsonFormsDispatch as se, withJsonFormsArrayControlProps as Ye } from "@jsonforms/react";
5
- import { Box as U, Flex as R, Text as D, TextField as oe, Checkbox as Ne, RadioGroup as ve, Select as ce, Tabs as ae, Heading as Se, Card as De, Button as pe, IconButton as Ee } from "@radix-ui/themes";
6
- import { FileTextIcon as He, CheckCircledIcon as Pe, Cross2Icon as Be, ExclamationTriangleIcon as Je, UploadIcon as Ge, TrashIcon as qe, PlusIcon as Ke } from "@radix-ui/react-icons";
7
- const Me = xe(null);
8
- function Bt({
9
- children: o,
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: t
12
+ getDownloadUrl: n
12
13
  }) {
13
- const y = { onUpload: r, getDownloadUrl: t };
14
- return /* @__PURE__ */ e(Me.Provider, { value: y, children: o });
14
+ const a = { onUpload: r, getDownloadUrl: n };
15
+ return /* @__PURE__ */ e(Oe.Provider, { value: a, children: t });
15
16
  }
16
- function Ze() {
17
- return ze(Me);
17
+ function ir() {
18
+ return ze(Oe);
18
19
  }
19
- const X = (o, r) => o ? o.split(`
20
- `).map((t) => t.trim() === "is a required property" ? `${r || "This field"} is required` : t).join(`
21
- `) : "", Qe = ({
22
- data: o,
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: t,
25
- label: y,
26
- required: x,
27
- errors: S,
28
- uischema: a,
29
- schema: M,
30
- enabled: h,
31
- visible: f = !0
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 T;
34
- if (q(() => {
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 d = S.length === 0;
39
- return /* @__PURE__ */ e(U, { mb: "4", children: /* @__PURE__ */ z(R, { direction: "column", gap: "1", children: [
40
- /* @__PURE__ */ z(D, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
41
- y,
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
- x && /* @__PURE__ */ e(D, { color: "red", children: "*" })
58
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
44
59
  ] }),
45
60
  /* @__PURE__ */ e(
46
- oe.Root,
61
+ Y.Root,
47
62
  {
48
- value: o || "",
49
- onChange: (w) => r(t, w.target.value),
50
- disabled: !h,
51
- placeholder: (T = a.options) == null ? void 0 : T.placeholder,
52
- color: d ? void 0 : "red",
53
- id: t
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
- !d && /* @__PURE__ */ e(D, { color: "red", size: "1", children: X(S, y) }),
57
- M.description && /* @__PURE__ */ e(D, { size: "1", color: "gray", children: M.description })
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
- }, Xe = N(1, ke), et = Q(Qe), tt = ({
60
- data: o,
74
+ }, ar = D(1, Ee), dr = J(sr), ur = ({
75
+ data: t,
61
76
  handleChange: r,
62
- path: t,
63
- label: y,
64
- required: x,
65
- errors: S,
66
- uischema: a,
67
- schema: M,
68
- enabled: h,
69
- visible: f = !0
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 w;
72
- if (q(() => {
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 d = S.length === 0, T = ($) => {
77
- if ($ === "") {
78
- r(t, void 0);
89
+ const l = h.length === 0, x = (o) => {
90
+ if (o === "") {
91
+ r(n, void 0);
79
92
  return;
80
93
  }
81
- const m = Number($);
82
- isNaN(m) || r(t, m);
94
+ const u = Number(o);
95
+ isNaN(u) || r(n, u);
83
96
  };
84
- return /* @__PURE__ */ e(U, { mb: "4", children: /* @__PURE__ */ z(R, { direction: "column", gap: "1", children: [
85
- /* @__PURE__ */ z(D, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
86
- y,
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
- x && /* @__PURE__ */ e(D, { color: "red", children: "*" })
101
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
89
102
  ] }),
90
103
  /* @__PURE__ */ e(
91
- oe.Root,
104
+ Y.Root,
92
105
  {
93
106
  type: "number",
94
- value: o ?? "",
95
- onChange: ($) => T($.target.value),
96
- disabled: !h,
97
- placeholder: (w = a.options) == null ? void 0 : w.placeholder,
98
- color: d ? void 0 : "red",
99
- id: t
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
- !d && /* @__PURE__ */ e(D, { color: "red", size: "1", children: X(S, y) }),
103
- M.description && /* @__PURE__ */ e(D, { size: "1", color: "gray", children: M.description })
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
- }, rt = N(2, me(Oe, Le)), nt = Q(tt), ot = ({
106
- data: o,
118
+ }, fr = D(2, ge(Ve, je)), pr = J(ur), hr = ({
119
+ data: t,
107
120
  handleChange: r,
108
- path: t,
109
- label: y,
110
- required: x,
111
- errors: S,
112
- schema: a,
113
- enabled: M,
114
- visible: h = !0
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 (q(() => {
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 f = S.length === 0;
121
- return /* @__PURE__ */ z(U, { mb: "4", children: [
122
- /* @__PURE__ */ z(R, { gap: "2", align: "center", children: [
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
- Ne,
135
+ _e,
125
136
  {
126
- checked: !!o,
127
- onCheckedChange: (d) => r(t, d === !0),
128
- disabled: !M,
129
- id: t
137
+ checked: !!t,
138
+ onCheckedChange: (l) => r(n, l === !0),
139
+ disabled: !v,
140
+ id: n
130
141
  }
131
142
  ),
132
- /* @__PURE__ */ z(D, { as: "label", size: "2", htmlFor: t, children: [
133
- y,
143
+ /* @__PURE__ */ f(c, { as: "label", size: "2", htmlFor: n, children: [
144
+ a,
134
145
  " ",
135
- x && "*"
146
+ y && "*"
136
147
  ] })
137
148
  ] }),
138
- !f && /* @__PURE__ */ e(D, { color: "red", size: "1", className: "block mt-1", children: X(S, y) }),
139
- a.description && /* @__PURE__ */ e(D, { size: "1", color: "gray", className: "block mt-1", children: a.description })
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
- }, it = N(2, Fe), st = Q(ot), lt = ({
142
- data: o,
152
+ }, gr = D(2, Ne), mr = J(hr), yr = ({
153
+ data: t,
143
154
  handleChange: r,
144
- path: t,
145
- label: y,
146
- required: x,
147
- errors: S,
148
- schema: a,
149
- enabled: M,
150
- visible: h = !0
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 (q(() => {
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 f = S.length === 0;
157
- let d = [];
158
- a.enum ? d = a.enum.map((w) => ({ value: w, label: String(w) })) : a.oneOf && (d = a.oneOf.map((w) => ({
159
- value: w.const,
160
- label: w.title || String(w.const)
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 T = o;
163
- return /* @__PURE__ */ e(U, { mb: "4", children: /* @__PURE__ */ z(R, { direction: "column", gap: "1", children: [
164
- /* @__PURE__ */ z(D, { as: "div", size: "2", weight: "bold", children: [
165
- y,
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
- x && /* @__PURE__ */ e(D, { color: "red", children: "*" })
176
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
168
177
  ] }),
169
178
  /* @__PURE__ */ e(
170
- ve.Root,
179
+ we.Root,
171
180
  {
172
- value: T !== void 0 ? String(T) : "",
173
- onValueChange: (w) => {
174
- const $ = d.find((m) => String(m.value) === w);
175
- $ && r(t, $.value);
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: !M,
186
+ disabled: !v,
178
187
  children: /* @__PURE__ */ e(
179
- R,
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: d.map((w) => /* @__PURE__ */ z(R, { align: "center", gap: "2", style: { minWidth: "max-content" }, children: [
188
- /* @__PURE__ */ e(ve.Item, { value: String(w.value) }),
189
- /* @__PURE__ */ e(D, { size: "2", color: M ? void 0 : "gray", children: w.label })
190
- ] }, String(w.value)))
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
- !f && /* @__PURE__ */ e(D, { color: "red", size: "1", children: X(S, y) }),
196
- a.description && /* @__PURE__ */ e(D, { size: "1", color: "gray", children: a.description })
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
- }, ct = (o, r, t) => {
199
- var x;
200
- return me(we, Ce)(o, r, t) && ((x = o == null ? void 0 : o.options) == null ? void 0 : x.format) === "radio" ? 3 : -1;
201
- }, at = Q(lt), ut = ({
202
- data: o,
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: t,
205
- label: y,
206
- required: x,
207
- errors: S,
208
- schema: a,
209
- uischema: M,
210
- enabled: h,
211
- visible: f = !0
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 (q(() => {
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 d = S.length === 0;
219
- let T = [];
220
- a.enum ? T = a.enum.map((m) => ({ value: String(m), label: String(m) })) : a.oneOf && (T = a.oneOf.map((m) => ({
221
- value: String(m.const),
222
- label: m.title || String(m.const)
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 w = o !== void 0 ? String(o) : "";
225
- return /* @__PURE__ */ e(U, { mb: "4", children: /* @__PURE__ */ z(R, { direction: "column", gap: "1", children: [
226
- /* @__PURE__ */ z(D, { as: "label", size: "2", weight: "bold", htmlFor: t, children: [
227
- y,
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
- x && /* @__PURE__ */ e(D, { color: "red", children: "*" })
236
+ y && /* @__PURE__ */ e(c, { color: "red", children: "*" })
230
237
  ] }),
231
- /* @__PURE__ */ z(ce.Root, { value: w, onValueChange: (m) => r(t, m), disabled: !h, children: [
238
+ /* @__PURE__ */ f(de.Root, { value: p, onValueChange: (u) => r(n, u), disabled: !d, children: [
232
239
  /* @__PURE__ */ e(
233
- ce.Trigger,
240
+ de.Trigger,
234
241
  {
235
- placeholder: (($ = M.options) == null ? void 0 : $.placeholder) || "Select an option",
236
- color: d ? void 0 : "red",
237
- id: t
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(ce.Content, { children: T.map((m) => /* @__PURE__ */ e(ce.Item, { value: m.value, children: m.label }, m.value)) })
247
+ /* @__PURE__ */ e(de.Content, { children: x.map((u) => /* @__PURE__ */ e(de.Item, { value: u.value, children: u.label }, u.value)) })
241
248
  ] }),
242
- !d && /* @__PURE__ */ e(D, { color: "red", size: "1", children: X(S, y) }),
243
- a.description && /* @__PURE__ */ e(D, { size: "1", color: "gray", children: a.description })
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
- }, dt = N(2, me(we, Ce)), ft = Q(ut);
246
- function ht(o) {
247
- return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
248
- }
249
- var he = { exports: {} }, mt = he.exports, $e;
250
- function pt() {
251
- return $e || ($e = 1, (function(o, r) {
252
- (function(t, y) {
253
- o.exports = y();
254
- })(mt, (function() {
255
- var t = 1e3, y = 6e4, x = 36e5, S = "millisecond", a = "second", M = "minute", h = "hour", f = "day", d = "week", T = "month", w = "quarter", $ = "year", m = "date", _ = "Invalid Date", I = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, O = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, A = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(u) {
256
- var l = ["th", "st", "nd", "rd"], n = u % 100;
257
- return "[" + u + (l[(n - 20) % 10] || l[n] || l[0]) + "]";
258
- } }, J = function(u, l, n) {
259
- var c = String(u);
260
- return !c || c.length >= l ? u : "" + Array(l + 1 - c.length).join(n) + u;
261
- }, K = { s: J, z: function(u) {
262
- var l = -u.utcOffset(), n = Math.abs(l), c = Math.floor(n / 60), i = n % 60;
263
- return (l <= 0 ? "+" : "-") + J(c, 2, "0") + ":" + J(i, 2, "0");
264
- }, m: function u(l, n) {
265
- if (l.date() < n.date()) return -u(n, l);
266
- var c = 12 * (n.year() - l.year()) + (n.month() - l.month()), i = l.clone().add(c, T), p = n - i < 0, g = l.clone().add(c + (p ? -1 : 1), T);
267
- return +(-(c + (n - i) / (p ? i - g : g - i)) || 0);
268
- }, a: function(u) {
269
- return u < 0 ? Math.ceil(u) || 0 : Math.floor(u);
270
- }, p: function(u) {
271
- return { M: T, y: $, w: d, d: f, D: m, h, m: M, s: a, ms: S, Q: w }[u] || String(u || "").toLowerCase().replace(/s$/, "");
272
- }, u: function(u) {
273
- return u === void 0;
274
- } }, H = "en", j = {};
275
- j[H] = A;
276
- var te = "$isDayjsObject", ee = function(u) {
277
- return u instanceof B || !(!u || !u[te]);
278
- }, P = function u(l, n, c) {
279
- var i;
280
- if (!l) return H;
281
- if (typeof l == "string") {
282
- var p = l.toLowerCase();
283
- j[p] && (i = p), n && (j[p] = n, i = p);
284
- var g = l.split("-");
285
- if (!i && g.length > 1) return u(g[0]);
286
- } else {
287
- var s = l.name;
288
- j[s] = l, i = s;
289
- }
290
- return !c && i && (H = i), i || !c && H;
291
- }, L = function(u, l) {
292
- if (ee(u)) return u.clone();
293
- var n = typeof l == "object" ? l : {};
294
- return n.date = u, n.args = arguments, new B(n);
295
- }, C = K;
296
- C.l = P, C.i = ee, C.w = function(u, l) {
297
- return L(u, { locale: l.$L, utc: l.$u, x: l.$x, $offset: l.$offset });
298
- };
299
- var B = (function() {
300
- function u(n) {
301
- this.$L = P(n.locale, null, !0), this.parse(n), this.$x = this.$x || n.x || {}, this[te] = !0;
302
- }
303
- var l = u.prototype;
304
- return l.parse = function(n) {
305
- this.$d = (function(c) {
306
- var i = c.date, p = c.utc;
307
- if (i === null) return /* @__PURE__ */ new Date(NaN);
308
- if (C.u(i)) return /* @__PURE__ */ new Date();
309
- if (i instanceof Date) return new Date(i);
310
- if (typeof i == "string" && !/Z$/i.test(i)) {
311
- var g = i.match(I);
312
- if (g) {
313
- var s = g[2] - 1 || 0, v = (g[7] || "0").substring(0, 3);
314
- return p ? new Date(Date.UTC(g[1], s, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, v)) : new Date(g[1], s, g[3] || 1, g[4] || 0, g[5] || 0, g[6] || 0, v);
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
- return new Date(i);
318
- })(n), this.init();
319
- }, l.init = function() {
320
- var n = this.$d;
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
- return null;
458
- })(W) || g.replace(":", "");
459
- }));
460
- }, l.utcOffset = function() {
461
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
462
- }, l.diff = function(n, c, i) {
463
- var p, g = this, s = C.p(c), v = L(n), k = (v.utcOffset() - this.utcOffset()) * y, b = this - v, F = function() {
464
- return C.m(g, v);
465
- };
466
- switch (s) {
467
- case $:
468
- p = F() / 12;
469
- break;
470
- case T:
471
- p = F();
472
- break;
473
- case w:
474
- p = F() / 3;
475
- break;
476
- case d:
477
- p = (b - k) / 6048e5;
478
- break;
479
- case f:
480
- p = (b - k) / 864e5;
481
- break;
482
- case h:
483
- p = b / x;
484
- break;
485
- case M:
486
- p = b / y;
487
- break;
488
- case a:
489
- p = b / t;
490
- break;
491
- default:
492
- p = b;
493
- }
494
- return i ? p : C.a(p);
495
- }, l.daysInMonth = function() {
496
- return this.endOf(T).$D;
497
- }, l.$locale = function() {
498
- return j[this.$L];
499
- }, l.locale = function(n, c) {
500
- if (!n) return this.$L;
501
- var i = this.clone(), p = P(n, c, !0);
502
- return p && (i.$L = p), i;
503
- }, l.clone = function() {
504
- return C.w(this.$d, this);
505
- }, l.toDate = function() {
506
- return new Date(this.valueOf());
507
- }, l.toJSON = function() {
508
- return this.isValid() ? this.toISOString() : null;
509
- }, l.toISOString = function() {
510
- return this.$d.toISOString();
511
- }, l.toString = function() {
512
- return this.$d.toUTCString();
513
- }, u;
514
- })(), re = B.prototype;
515
- return L.prototype = re, [["$ms", S], ["$s", a], ["$m", M], ["$H", h], ["$W", f], ["$M", T], ["$y", $], ["$D", m]].forEach((function(u) {
516
- re[u[1]] = function(l) {
517
- return this.$g(l, u[0], u[1]);
518
- };
519
- })), L.extend = function(u, l) {
520
- return u.$i || (u(l, B, L), u.$i = !0), L;
521
- }, L.locale = P, L.isDayjs = ee, L.unix = function(u) {
522
- return L(1e3 * u);
523
- }, L.en = j[H], L.Ls = j, L.p = {}, L;
524
- }));
525
- })(he)), he.exports;
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
- t && /* @__PURE__ */ e(D, { color: "red", children: "*" })
458
+ n && /* @__PURE__ */ e(c, { color: "red", children: "*" })
535
459
  ] }),
536
- S,
537
- !a && /* @__PURE__ */ e(D, { color: "red", size: "1", children: X(y, r) }),
538
- x && /* @__PURE__ */ e(D, { size: "1", color: "gray", children: x })
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
- }, bt = ({
541
- data: o,
464
+ }, Fr = ({
465
+ data: t,
542
466
  handleChange: r,
543
- path: t,
544
- label: y,
545
- required: x,
546
- errors: S,
547
- schema: a,
548
- enabled: M,
549
- visible: h = !0
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 (q(() => {
552
- h === !1 && r(t, void 0);
553
- }, [h, t, r]), h === !1)
475
+ if (X(() => {
476
+ d === !1 && r(n, void 0);
477
+ }, [d, n, r]), d === !1)
554
478
  return null;
555
- const f = S.length === 0, d = typeof o == "string" ? o : "", T = (O) => /* @__PURE__ */ e($t, { path: t, label: y, required: x, errors: S, description: a.description, children: O });
556
- if (a.format === "time")
557
- return T(
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
- oe.Root,
483
+ Y.Root,
560
484
  {
561
485
  type: "time",
562
- value: d,
563
- onChange: (O) => r(t, O.target.value),
564
- disabled: !M,
565
- color: f ? void 0 : "red",
566
- id: t
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 w = a.format === "date-time", [$ = "", m = ""] = d.split("T"), _ = m.slice(0, 5), I = (O, A) => {
571
- if (!O) {
572
- r(t, void 0);
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(t, w ? vt(O, A || "00:00") : O);
499
+ r(n, p ? kr(w, R || "00:00") : w);
576
500
  };
577
- return T(
578
- /* @__PURE__ */ z(R, { gap: "2", align: "center", children: [
501
+ return x(
502
+ /* @__PURE__ */ f(z, { gap: "2", align: "center", children: [
579
503
  /* @__PURE__ */ e(
580
- oe.Root,
504
+ Y.Root,
581
505
  {
582
506
  type: "date",
583
- value: $,
584
- disabled: !M,
585
- color: f ? void 0 : "red",
586
- onChange: (O) => I(O.target.value, _),
587
- id: t,
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
- w && /* @__PURE__ */ e(
592
- oe.Root,
515
+ p && /* @__PURE__ */ e(
516
+ Y.Root,
593
517
  {
594
518
  type: "time",
595
- value: _,
596
- disabled: !M || !$,
597
- color: f ? void 0 : "red",
598
- onChange: (O) => I($, O.target.value),
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
- }, wt = N(2, me(Re, Ae, Ue)), Ct = Q(bt), St = ({
605
- uischema: o,
528
+ }, Dr = D(2, ge(Pe, Be, Me)), Or = J(Fr), Ir = ({
529
+ uischema: t,
606
530
  schema: r,
607
- path: t,
608
- renderers: y,
609
- cells: x,
610
- enabled: S,
611
- visible: a = !0
531
+ path: n,
532
+ renderers: a,
533
+ cells: y,
534
+ enabled: h,
535
+ visible: s = !0
612
536
  }) => {
613
- const h = o.elements;
614
- return a === !1 ? null : /* @__PURE__ */ e(R, { direction: "column", gap: "4", children: h.map((f, d) => /* @__PURE__ */ e(
615
- se,
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: f,
541
+ uischema: g,
618
542
  schema: r,
619
- path: t,
620
- renderers: y,
621
- cells: x,
622
- enabled: S
543
+ path: n,
544
+ renderers: a,
545
+ cells: y,
546
+ enabled: h
623
547
  },
624
- `${t}-${d}`
548
+ `${n}-${l}`
625
549
  )) });
626
- }, Dt = N(1, ie("VerticalLayout")), Mt = ({
627
- uischema: o,
550
+ }, Lr = D(1, ie("VerticalLayout")), Ar = ({
551
+ uischema: t,
628
552
  schema: r,
629
- path: t,
630
- renderers: y,
631
- cells: x,
632
- enabled: S,
633
- visible: a = !0
553
+ path: n,
554
+ renderers: a,
555
+ cells: y,
556
+ enabled: h,
557
+ visible: s = !0
634
558
  }) => {
635
- const h = o.elements;
636
- return a === !1 ? null : /* @__PURE__ */ e(R, { direction: "row", gap: "4", children: h.map((f, d) => /* @__PURE__ */ e(U, { style: { flex: 1 }, children: /* @__PURE__ */ e(
637
- se,
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: f,
563
+ uischema: g,
640
564
  schema: r,
641
- path: t,
642
- renderers: y,
643
- cells: x,
644
- enabled: S
565
+ path: n,
566
+ renderers: a,
567
+ cells: y,
568
+ enabled: h
645
569
  }
646
- ) }, `${t}-${d}`)) });
647
- }, xt = N(1, ie("HorizontalLayout")), zt = ({
648
- uischema: o,
570
+ ) }, `${n}-${l}`)) });
571
+ }, Ur = D(1, ie("HorizontalLayout")), Er = ({
572
+ uischema: t,
649
573
  schema: r,
650
- path: t,
651
- renderers: y,
652
- cells: x,
653
- enabled: S,
654
- visible: a = !0
574
+ path: n,
575
+ renderers: a,
576
+ cells: y,
577
+ enabled: h,
578
+ visible: s = !0
655
579
  }) => {
656
- const M = o, h = M.elements;
657
- return a === !1 ? null : /* @__PURE__ */ z(U, { mb: "6", children: [
658
- M.label && /* @__PURE__ */ e(Se, { size: "3", mb: "3", className: "text-gray-500 uppercase tracking-wide font-semibold", children: M.label }),
659
- /* @__PURE__ */ e(R, { direction: "column", gap: "4", children: h.map((f, d) => /* @__PURE__ */ e(
660
- se,
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: f,
586
+ uischema: g,
663
587
  schema: r,
664
- path: t,
665
- renderers: y,
666
- cells: x,
667
- enabled: S
588
+ path: n,
589
+ renderers: a,
590
+ cells: y,
591
+ enabled: h
668
592
  },
669
- `${t}-${d}`
593
+ `${n}-${l}`
670
594
  )) })
671
595
  ] });
672
- }, Tt = N(1, ie("Group")), kt = ({
673
- uischema: o,
596
+ }, Vr = D(1, ie("Group")), jr = ({
597
+ uischema: t,
674
598
  schema: r,
675
- path: t,
676
- renderers: y,
677
- cells: x,
678
- enabled: S,
679
- visible: a = !0
599
+ path: n,
600
+ renderers: a,
601
+ cells: y,
602
+ enabled: h,
603
+ visible: s = !0
680
604
  }) => {
681
- var w;
682
- const h = o.elements.filter(($) => $.type === "Category"), [f, d] = fe(((w = h[0]) == null ? void 0 : w.label) || "");
683
- if (a === !1 || !h.length) return null;
684
- const T = h.find(($) => $.label === f) ? f : h[0].label;
685
- return /* @__PURE__ */ z(ae.Root, { value: T, onValueChange: d, children: [
686
- /* @__PURE__ */ e(ae.List, { children: h.map(($, m) => /* @__PURE__ */ e(ae.Trigger, { value: $.label, children: $.label }, `${t}-${m}`)) }),
687
- /* @__PURE__ */ e(U, { pt: "3", children: h.map(($, m) => /* @__PURE__ */ e(ae.Content, { value: $.label, children: /* @__PURE__ */ e(R, { direction: "column", gap: "4", children: $.elements.map((_, I) => /* @__PURE__ */ e(
688
- se,
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: t,
693
- renderers: y,
694
- cells: x,
695
- enabled: S
616
+ path: n,
617
+ renderers: a,
618
+ cells: y,
619
+ enabled: h
696
620
  },
697
- `${t}-${m}-${I}`
698
- )) }) }, `${t}-${m}`)) })
621
+ `${n}-${u}-${$}`
622
+ )) }) }, `${n}-${u}`)) })
699
623
  ] });
700
- }, Ot = N(1, ie("Categorization"));
701
- function Lt(o) {
702
- return o ? Array.isArray(o) ? o : [o] : [];
624
+ }, Nr = D(1, ie("Categorization"));
625
+ function Pr(t) {
626
+ return t ? Array.isArray(t) ? t : [t] : [];
703
627
  }
704
- function ue(o) {
705
- return o >= 1024 * 1024 ? `${(o / (1024 * 1024)).toFixed(0)} MB` : o >= 1024 ? `${(o / 1024).toFixed(0)} KB` : `${o} B`;
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 de(o) {
708
- return o.split(",").map((r) => {
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 t = r.split("/")[1];
714
- return t ? t.toUpperCase() : r;
637
+ const n = r.split("/")[1];
638
+ return n ? n.toUpperCase() : r;
715
639
  }).join(", ");
716
640
  }
717
- const Ft = ({
718
- data: o,
641
+ const Br = ({
642
+ data: t,
719
643
  handleChange: r,
720
- path: t,
721
- label: y,
722
- required: x,
723
- uischema: S,
724
- schema: a,
725
- enabled: M,
726
- errors: h,
727
- visible: f = !0
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 d = Ze();
730
- if (q(() => {
731
- f === !1 && r(t, null);
732
- }, [f, t, r]), f === !1)
733
- return null;
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 re = Te(
739
- async (s) => {
740
- if (j(null), C.length >= m) {
741
- j(`Maximum ${m} file${m > 1 ? "s" : ""} allowed.`);
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 (s.size > _) {
745
- j(`File exceeds the ${ue(_)} limit.`);
665
+ if (i.size > S) {
666
+ j(`File exceeds the ${fe(S)} limit.`);
746
667
  return;
747
668
  }
748
- if (!I.split(",").map((b) => b.trim()).some((b) => b === "*" || b === "*/*" ? !0 : b.endsWith("/*") ? s.type.startsWith(b.slice(0, -1)) : b.startsWith(".") ? s.name.toLowerCase().endsWith(b.toLowerCase()) : s.type === b)) {
749
- j(`Invalid type. Accepted: ${de(I)}`);
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 (!(d != null && d.onUpload)) {
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 d.onUpload(s), F = URL.createObjectURL(s);
758
- P.current.add(F);
759
- const V = { key: b.key, name: b.name ?? s.name, blobUrl: F };
760
- ee((E) => ({ ...E, [b.key]: V }));
761
- const Y = [...C, b.key];
762
- r(t, O ? Y : Y[0]);
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."), L.current && (L.current.value = "");
685
+ j("Upload failed. Please try again."), U.current && (U.current.value = "");
765
686
  }
766
687
  },
767
- [C, m, _, I, d, t, r, O]
768
- ), u = (s) => {
769
- s.preventDefault(), s.stopPropagation(), !(!A || B) && K(s.type === "dragenter" || s.type === "dragover");
770
- }, l = (s) => {
771
- var v;
772
- s.preventDefault(), s.stopPropagation(), K(!1), !(!A || B) && (v = s.dataTransfer.files) != null && v[0] && re(s.dataTransfer.files[0]);
773
- }, n = (s) => {
774
- var v;
775
- (v = s.target.files) != null && v[0] && (re(s.target.files[0]), s.target.value = "");
776
- }, c = (s) => {
777
- if (!A) return;
778
- ee((k) => {
779
- var V;
780
- const b = { ...k }, F = (V = b[s]) == null ? void 0 : V.blobUrl;
781
- return F && (URL.revokeObjectURL(F), P.current.delete(F)), delete b[s], b;
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 v = C.filter((k) => k !== s);
784
- r(t, O ? v.length > 0 ? v : null : v[0] ?? null);
785
- }, i = async (s, v) => {
786
- var F, V, Y;
787
- s.preventDefault();
788
- const k = (F = te[v]) == null ? void 0 : F.blobUrl;
789
- if (k) {
790
- (V = window.open(k, "_blank", "noopener,noreferrer")) == null || V.focus();
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 E = await ((Y = d == null ? void 0 : d.getDownloadUrl) == null ? void 0 : Y.call(d, v));
797
- E != null && E.url ? b.location.href = E.url : b.close();
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 (!A && C.length === 0) return null;
803
- const p = m - C.length, g = A && !B;
804
- return /* @__PURE__ */ z(U, { mb: "4", children: [
805
- /* @__PURE__ */ z(R, { align: "center", justify: "between", mb: "2", children: [
806
- /* @__PURE__ */ z(D, { as: "label", size: "2", weight: "bold", children: [
807
- y,
808
- x && /* @__PURE__ */ e(D, { color: "red", children: " *" })
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(D, { size: "1", color: "gray", children: O ? `Up to ${m} files · ${ue(_)} each · ${de(I)}` : `${ue(_)} · ${de(I)}` })
734
+ /* @__PURE__ */ e(c, { size: "1", color: "gray", children: w ? `Up to ${u} files · ${fe(S)} each · ${pe($)}` : `${fe(S)} · ${pe($)}` })
811
735
  ] }),
812
- C.map((s) => {
813
- var v;
814
- return /* @__PURE__ */ e(De, { size: "2", variant: "surface", mb: "2", children: /* @__PURE__ */ z(R, { align: "center", gap: "3", children: [
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
- U,
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(He, { width: "20", height: "20" })
749
+ children: /* @__PURE__ */ e(Xe, { width: "20", height: "20" })
826
750
  }
827
751
  ),
828
- /* @__PURE__ */ e(U, { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
829
- D,
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: ((v = te[s]) == null ? void 0 : v.name) ?? "Uploaded File"
763
+ children: ((T = te[i]) == null ? void 0 : T.name) ?? "Uploaded File"
840
764
  }
841
765
  ) }),
842
- /* @__PURE__ */ z(R, { align: "center", gap: "2", style: { flexShrink: 0 }, children: [
843
- /* @__PURE__ */ e(pe, { variant: "soft", color: "blue", size: "1", onClick: (k) => i(k, s), children: "View" }),
844
- /* @__PURE__ */ e(Pe, { style: { color: "var(--green-9)", width: 18, height: 18 } }),
845
- A && /* @__PURE__ */ e(Ee, { variant: "ghost", color: "gray", onClick: () => c(s), children: /* @__PURE__ */ e(Be, {}) })
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
- ] }) }, s);
771
+ ] }) }, i);
848
772
  }),
849
- g && /* @__PURE__ */ z(
773
+ Z && /* @__PURE__ */ f(
850
774
  "div",
851
775
  {
852
776
  role: "button",
853
777
  tabIndex: 0,
854
778
  onClick: () => {
855
- var s;
856
- return (s = L.current) == null ? void 0 : s.click();
779
+ var i;
780
+ return (i = U.current) == null ? void 0 : i.click();
857
781
  },
858
- onKeyDown: (s) => {
859
- var v;
860
- (s.key === "Enter" || s.key === " ") && (s.preventDefault(), (v = L.current) == null || v.click());
782
+ onKeyDown: (i) => {
783
+ var T;
784
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), (T = U.current) == null || T.click());
861
785
  },
862
- onDragEnter: u,
863
- onDragLeave: u,
864
- onDragOver: u,
865
- onDrop: l,
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
- J ? "border-blue-500 bg-blue-50" : H ? "border-red-300 bg-red-50" : "border-gray-300 hover:border-blue-400 hover:bg-gray-50"
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: L, type: "file", style: { display: "none" }, accept: I, onChange: n }),
874
- /* @__PURE__ */ e(R, { direction: "column", align: "center", gap: "2", children: H ? /* @__PURE__ */ z(ge, { children: [
875
- /* @__PURE__ */ e(Je, { style: { width: 32, height: 32, color: "var(--red-9)" } }),
876
- /* @__PURE__ */ e(D, { size: "2", color: "red", weight: "medium", children: H }),
877
- /* @__PURE__ */ e(D, { size: "1", color: "gray", children: "Click to try again" })
878
- ] }) : /* @__PURE__ */ z(ge, { children: [
879
- /* @__PURE__ */ e(Ge, { style: { width: 32, height: 32, color: "var(--gray-8)" } }),
880
- /* @__PURE__ */ e(D, { size: "2", weight: "medium", children: C.length > 0 ? `Add another file (${p} remaining)` : "Click to upload or drag and drop" }),
881
- /* @__PURE__ */ z(D, { size: "1", color: "gray", children: [
882
- ue(_),
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
- de(I)
808
+ pe($)
885
809
  ] })
886
810
  ] }) })
887
811
  ]
888
812
  }
889
813
  ),
890
- A && B && O && /* @__PURE__ */ z(D, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
814
+ R && B && w && /* @__PURE__ */ f(c, { size: "1", color: "gray", mt: "1", style: { display: "block", textAlign: "center" }, children: [
891
815
  "Maximum ",
892
- m,
816
+ u,
893
817
  " files uploaded. Remove one to replace it."
894
818
  ] }),
895
- !T && /* @__PURE__ */ e(D, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: X(h, y) })
819
+ !x && /* @__PURE__ */ e(c, { color: "red", size: "1", mt: "2", style: { display: "block" }, children: _(d, a) })
896
820
  ] });
897
- }, Rt = Q(Ft), At = N(
821
+ }, Mr = J(Br), Wr = D(
898
822
  10,
899
823
  // high rank to beat default array renderer
900
- _e(
824
+ We(
901
825
  // Match both single-file (type: string) and multi-file (type: array)
902
- Ie((o) => {
903
- if (o.type === "string" && o.format === "file") return !0;
904
- if (o.type === "array") {
905
- const r = o.items;
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
- ), Ut = ({
912
- data: o,
835
+ ), Hr = ({
836
+ data: t,
913
837
  path: r,
914
- schema: t,
915
- uischema: y,
916
- enabled: x,
917
- visible: S,
918
- addItem: a,
919
- removeItems: M,
920
- rootSchema: h,
921
- arraySchema: f
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 d = f ? t : t.items, T = f || t;
924
- if (S === !1 || !d || typeof d != "object" || Array.isArray(d))
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 w = d, $ = Array.isArray(o) ? o : [], m = T.title || "Array Items", _ = () => {
927
- const O = je(w, h);
928
- a && a(r, O)();
929
- }, I = (O) => {
930
- if (M) {
931
- const A = M(r, [O]);
932
- A && A();
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(U, { mb: "6", children: /* @__PURE__ */ z(R, { direction: "column", gap: "4", children: [
936
- /* @__PURE__ */ e(D, { as: "div", size: "4", weight: "bold", children: m }),
937
- $.length === 0 && /* @__PURE__ */ e(U, { py: "4", px: "4", style: { backgroundColor: "var(--gray-3)", borderRadius: "var(--radius-3)" }, children: /* @__PURE__ */ e(D, { size: "2", color: "gray", children: "No items have been added yet." }) }),
938
- $.map((O, A) => {
939
- var K;
940
- const J = `${r}.${A}`;
941
- return /* @__PURE__ */ e(De, { size: "3", variant: "surface", children: /* @__PURE__ */ z(R, { direction: "column", gap: "4", children: [
942
- /* @__PURE__ */ z(R, { justify: "between", align: "center", children: [
943
- /* @__PURE__ */ z(D, { size: "3", weight: "bold", children: [
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
- A + 1
869
+ R + 1
946
870
  ] }),
947
- x && /* @__PURE__ */ z(
948
- pe,
871
+ y && /* @__PURE__ */ f(
872
+ he,
949
873
  {
950
874
  type: "button",
951
875
  color: "red",
952
876
  variant: "soft",
953
- onClick: () => I(A),
877
+ onClick: () => $(R),
954
878
  title: "Remove item",
955
879
  children: [
956
- /* @__PURE__ */ e(qe, {}),
880
+ /* @__PURE__ */ e(nr, {}),
957
881
  "Remove"
958
882
  ]
959
883
  }
960
884
  )
961
885
  ] }),
962
- /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(
963
- se,
886
+ /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
887
+ ce,
964
888
  {
965
- schema: w,
966
- uischema: ((K = y.options) == null ? void 0 : K.detail) || (w.type === "object" || w.properties ? {
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(w.properties || {}).map((H) => ({
892
+ elements: Object.keys(p.properties || {}).map((O) => ({
969
893
  type: "Control",
970
- scope: `#/properties/${H}`
894
+ scope: `#/properties/${O}`
971
895
  }))
972
896
  } : {
973
897
  type: "Control",
974
898
  scope: "#"
975
899
  }),
976
- path: J,
977
- enabled: x,
900
+ path: k,
901
+ enabled: y,
978
902
  renderers: void 0,
979
903
  cells: void 0
980
904
  }
981
905
  ) })
982
- ] }) }, J);
906
+ ] }) }, k);
983
907
  }),
984
- x && /* @__PURE__ */ e(U, { mt: "2", children: /* @__PURE__ */ z(pe, { type: "button", variant: "surface", onClick: _, children: [
985
- /* @__PURE__ */ e(Ke, {}),
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
- }, be = Ye(Ut), _t = N(3, Ve), It = ({ uischema: o, visible: r }) => {
990
- const t = o;
991
- return r === !1 ? null : /* @__PURE__ */ e(U, { mb: "4", children: /* @__PURE__ */ e(Se, { size: "4", children: t.text }) });
992
- }, jt = N(1, ie("Label")), Vt = N(3, We), Jt = [
993
- { tester: Xe, renderer: et },
994
- { tester: rt, renderer: nt },
995
- { tester: it, renderer: st },
996
- { tester: ct, renderer: at },
997
- { tester: dt, renderer: ft },
998
- { tester: wt, renderer: Ct },
999
- { tester: Dt, renderer: St },
1000
- { tester: xt, renderer: Mt },
1001
- { tester: Tt, renderer: zt },
1002
- { tester: Ot, renderer: kt },
1003
- { tester: At, renderer: Rt },
1004
- { tester: _t, renderer: be },
1005
- { tester: Vt, renderer: be },
1006
- { tester: jt, renderer: It }
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
- be as ArrayControl,
1010
- _t as ArrayControlTester,
1011
- ot as BooleanControl,
1012
- it as BooleanControlTester,
1013
- kt as CategorizationLayoutRenderer,
1014
- Ot as CategorizationLayoutTester,
1015
- bt as DateControl,
1016
- wt as DateControlTester,
1017
- Rt as FileControl,
1018
- At as FileControlTester,
1019
- zt as GroupLayoutRenderer,
1020
- Tt as GroupLayoutTester,
1021
- Mt as HorizontalLayoutRenderer,
1022
- xt as HorizontalLayoutTester,
1023
- It as LabelRenderer,
1024
- jt as LabelTester,
1025
- tt as NumberControl,
1026
- rt as NumberControlTester,
1027
- lt as RadioControl,
1028
- ct as RadioControlTester,
1029
- ut as SelectControl,
1030
- dt as SelectControlTester,
1031
- Qe as TextControl,
1032
- Xe as TextControlTester,
1033
- Bt as UploadProvider,
1034
- St as VerticalLayoutRenderer,
1035
- Dt as VerticalLayoutTester,
1036
- X as getErrorMessage,
1037
- Jt as radixRenderers,
1038
- Ze as useUpload
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
  };