@overmap-ai/forms 1.0.17-radio-field.18 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/form/fields/RadioField/RadioField.d.ts +1 -1
- package/dist/form/fields/utils.d.ts +1 -1
- package/dist/forms.js +949 -940
- package/dist/forms.umd.cjs +18 -18
- package/package.json +1 -1
package/dist/forms.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var dr = Object.defineProperty;
|
|
2
2
|
var ur = (t, n, e) => n in t ? dr(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
3
|
var I = (t, n, e) => ur(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
-
import { jsx as l, jsxs as
|
|
5
|
-
import { RiIcon as L, Text as
|
|
4
|
+
import { jsx as l, jsxs as E, Fragment as pe } from "react/jsx-runtime";
|
|
5
|
+
import { RiIcon as L, Text as ae, Spinner as Kt, useToast as bt, ButtonGroup as Xt, Tooltip as Ee, IconButton as Q, Separator as jn, Input as ee, Badge as Ot, Checkbox as at, Popover as Be, Button as K, DayPicker as fr, Menu as B, RadioGroup as It, TextArea as qn, Card as Ge, Heading as Hn, HoverCard as St, useAlertDialog as mr, Tabs as Ie } from "@overmap-ai/blocks";
|
|
6
6
|
import { cx as je } from "class-variance-authority";
|
|
7
7
|
import * as h from "react";
|
|
8
|
-
import { memo as P, useMemo as O, forwardRef as Ke, useCallback as
|
|
8
|
+
import { memo as P, useMemo as O, forwardRef as Ke, useCallback as R, createContext as Gn, useContext as hr, useState as G, useRef as Xe, useEffect as H, Fragment as Kn, useId as pr, use as Yt, useReducer as gr } from "react";
|
|
9
9
|
import { useField as Qt, useFormikContext as xe, useFormik as Jt, FormikProvider as Zt } from "formik";
|
|
10
|
-
import { RiListCheck as vr, RiCheckboxCircleLine as yr, RiCalendarLine as br, RiCheckboxLine as xr, RiHashtag as wr, RiQrCodeLine as Cr, RiRadioButtonFill as Er, RiMenuFoldLine as Ir, RiInputField as Sr, RiAlignJustify as Nr, RiUpload2Line as
|
|
10
|
+
import { RiListCheck as vr, RiCheckboxCircleLine as yr, RiCalendarLine as br, RiCheckboxLine as xr, RiHashtag as wr, RiQrCodeLine as Cr, RiRadioButtonFill as Er, RiMenuFoldLine as Ir, RiInputField as Sr, RiAlignJustify as Nr, RiUpload2Line as Tr, RiFileCopyLine as Rr, RiDeleteBin7Fill as Fr, RiImageLine as Lr, RiArrowDownLine as Dr, RiArrowUpLine as Ar } from "react-icons/ri";
|
|
11
11
|
import { DragDropContext as Xn, Droppable as en, Draggable as tn } from "@hello-pangea/dnd";
|
|
12
|
-
import
|
|
12
|
+
import se from "lodash.get";
|
|
13
13
|
import * as Pr from "react-dom";
|
|
14
14
|
import Or from "react-dom";
|
|
15
15
|
import { saveAs as Yn } from "file-saver";
|
|
@@ -23,15 +23,15 @@ const zr = ["image/jpeg", "image/png", "image/svg+xml"], _r = [
|
|
|
23
23
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
24
24
|
// .xls
|
|
25
25
|
"application/vnd.ms-excel"
|
|
26
|
-
],
|
|
27
|
-
const { fileType: n } = t, e = O(() => _r.includes(n) ? /* @__PURE__ */ l(L, { icon: "RiFileExcelLine" }) :
|
|
26
|
+
], Br = ["application/pdf"], nn = P((t) => {
|
|
27
|
+
const { fileType: n } = t, e = O(() => _r.includes(n) ? /* @__PURE__ */ l(L, { icon: "RiFileExcelLine" }) : Br.includes(n) ? /* @__PURE__ */ l(L, { icon: "RiFilePdfLine" }) : zr.includes(n) ? /* @__PURE__ */ l(L, { icon: "RiFileImageLine" }) : /* @__PURE__ */ l(L, { icon: "RiFileLine" }), [n]);
|
|
28
28
|
return /* @__PURE__ */ l("div", { className: "h-max w-max", children: e });
|
|
29
29
|
});
|
|
30
30
|
nn.displayName = "FileIcon";
|
|
31
31
|
const Qn = P(
|
|
32
32
|
Ke((t, n) => {
|
|
33
33
|
const { file: e, className: i, error: r, rightSlot: o, ...s } = t;
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ E(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: je(
|
|
@@ -45,7 +45,7 @@ const Qn = P(
|
|
|
45
45
|
...s,
|
|
46
46
|
children: [
|
|
47
47
|
r ? /* @__PURE__ */ l(L, { icon: "RiFileWarningLine" }) : /* @__PURE__ */ l(nn, { fileType: (e == null ? void 0 : e.type) ?? "" }),
|
|
48
|
-
r || (e ? /* @__PURE__ */ l(
|
|
48
|
+
r || (e ? /* @__PURE__ */ l(ae, { className: "truncate", children: e.name }) : /* @__PURE__ */ l("div", { className: "flex w-full justify-center", children: /* @__PURE__ */ l(Kt, {}) })),
|
|
49
49
|
o
|
|
50
50
|
]
|
|
51
51
|
}
|
|
@@ -88,10 +88,10 @@ const Z = {
|
|
|
88
88
|
description: "",
|
|
89
89
|
required: !1
|
|
90
90
|
};
|
|
91
|
-
class
|
|
91
|
+
class W extends Jn {
|
|
92
92
|
constructor(e) {
|
|
93
|
-
const { label: i, required: r, image: o, fieldValidators: s = [], formValidators: a = [], ...
|
|
94
|
-
super(
|
|
93
|
+
const { label: i, required: r, image: o, fieldValidators: s = [], formValidators: a = [], ...u } = e;
|
|
94
|
+
super(u);
|
|
95
95
|
I(this, "required");
|
|
96
96
|
I(this, "formValidators");
|
|
97
97
|
I(this, "fieldValidators");
|
|
@@ -150,18 +150,18 @@ class U extends Jn {
|
|
|
150
150
|
return JSON.parse(e);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
I(
|
|
153
|
+
I(W, "fieldTypeName"), I(W, "fieldTypeDescription");
|
|
154
154
|
const J = (t) => {
|
|
155
|
-
const { id: n, field: e, formId: i, size: r, showInputOnly: o, onValuesChange: s, ...a } = t, [
|
|
156
|
-
...
|
|
155
|
+
const { id: n, field: e, formId: i, size: r, showInputOnly: o, onValuesChange: s, ...a } = t, [u, f, m] = Qt(e.getId()), { touched: d } = f, p = f.error ?? e.description, b = f.error ? "danger" : void 0, y = n ?? `${i}-${e.getId()}-input`, c = `${y}-label`, v = e.required ? `${e.label} *` : e.label, w = O(() => ({
|
|
156
|
+
...u,
|
|
157
157
|
// name and value not being overridden
|
|
158
158
|
onChange: (S) => {
|
|
159
|
-
|
|
159
|
+
m.setValue(S, !1).then(), s == null || s(e.getId(), S), (d || !e.onlyValidateAfterTouched) && m.setError(e.getError(S));
|
|
160
160
|
},
|
|
161
161
|
onBlur: (S) => {
|
|
162
|
-
|
|
162
|
+
m.setTouched(!0, !1).then(), m.setError(e.getError(S));
|
|
163
163
|
}
|
|
164
|
-
}), [e,
|
|
164
|
+
}), [e, u, m, s, d]);
|
|
165
165
|
return [
|
|
166
166
|
{
|
|
167
167
|
helpText: p,
|
|
@@ -172,9 +172,9 @@ const J = (t) => {
|
|
|
172
172
|
label: v,
|
|
173
173
|
showInputOnly: o,
|
|
174
174
|
fieldProps: w,
|
|
175
|
-
helpers:
|
|
175
|
+
helpers: m,
|
|
176
176
|
field: e,
|
|
177
|
-
touched:
|
|
177
|
+
touched: d
|
|
178
178
|
},
|
|
179
179
|
/* Props that should be spread on the html element representing the field */
|
|
180
180
|
{ ...a, "aria-labelledby": c }
|
|
@@ -182,16 +182,16 @@ const J = (t) => {
|
|
|
182
182
|
}, rn = [];
|
|
183
183
|
let Qe;
|
|
184
184
|
const Vr = new Uint8Array(16);
|
|
185
|
-
function
|
|
185
|
+
function $r() {
|
|
186
186
|
if (!Qe && (Qe = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Qe))
|
|
187
187
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
188
188
|
return Qe(Vr);
|
|
189
189
|
}
|
|
190
|
-
const
|
|
190
|
+
const U = [];
|
|
191
191
|
for (let t = 0; t < 256; ++t)
|
|
192
|
-
|
|
192
|
+
U.push((t + 256).toString(16).slice(1));
|
|
193
193
|
function Ur(t, n = 0) {
|
|
194
|
-
return
|
|
194
|
+
return U[t[n + 0]] + U[t[n + 1]] + U[t[n + 2]] + U[t[n + 3]] + "-" + U[t[n + 4]] + U[t[n + 5]] + "-" + U[t[n + 6]] + U[t[n + 7]] + "-" + U[t[n + 8]] + U[t[n + 9]] + "-" + U[t[n + 10]] + U[t[n + 11]] + U[t[n + 12]] + U[t[n + 13]] + U[t[n + 14]] + U[t[n + 15]];
|
|
195
195
|
}
|
|
196
196
|
const Wr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), In = {
|
|
197
197
|
randomUUID: Wr
|
|
@@ -200,7 +200,7 @@ function jr(t, n, e) {
|
|
|
200
200
|
if (In.randomUUID && !t)
|
|
201
201
|
return In.randomUUID();
|
|
202
202
|
t = t || {};
|
|
203
|
-
const i = t.random || (t.rng ||
|
|
203
|
+
const i = t.random || (t.rng || $r)();
|
|
204
204
|
return i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, Ur(i);
|
|
205
205
|
}
|
|
206
206
|
const me = (t) => t.type === "section", ct = (t = "", n = []) => ({
|
|
@@ -243,7 +243,7 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
243
243
|
const o = {
|
|
244
244
|
...e,
|
|
245
245
|
identifier: on()
|
|
246
|
-
}, s =
|
|
246
|
+
}, s = se(i, t);
|
|
247
247
|
if (s === void 0)
|
|
248
248
|
throw new Error("Parent path must point to an existing field.");
|
|
249
249
|
if (!Array.isArray(s))
|
|
@@ -257,48 +257,48 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
257
257
|
};
|
|
258
258
|
ut("fields", t, i, n, e);
|
|
259
259
|
}, sn = () => {
|
|
260
|
-
const { showError: t } = bt(), n =
|
|
261
|
-
(i, r, o, s, a,
|
|
262
|
-
const
|
|
263
|
-
if (!
|
|
264
|
-
let
|
|
260
|
+
const { showError: t } = bt(), n = R(
|
|
261
|
+
(i, r, o, s, a, u) => {
|
|
262
|
+
const f = i[r];
|
|
263
|
+
if (!f) throw new Error("Could not find section context.");
|
|
264
|
+
let m = typeof f.conditionIndex < "u" ? (
|
|
265
265
|
// cannot move a section with a condition before the condition's field
|
|
266
|
-
Math.max(
|
|
266
|
+
Math.max(f.conditionIndex + 1, s)
|
|
267
267
|
) : s;
|
|
268
|
-
for (const
|
|
269
|
-
|
|
270
|
-
if (
|
|
268
|
+
for (const d of Object.values(i))
|
|
269
|
+
d.conditionIndex === o && (m = Math.min(m, d.index - 1));
|
|
270
|
+
if (m !== s) {
|
|
271
271
|
t({
|
|
272
272
|
title: "Could not reorder sections",
|
|
273
273
|
description: "Sections with conditions must be below the fields they reference."
|
|
274
274
|
});
|
|
275
275
|
return;
|
|
276
276
|
}
|
|
277
|
-
|
|
277
|
+
u("fields", Mt(a.fields, o, m));
|
|
278
278
|
},
|
|
279
279
|
[t]
|
|
280
|
-
), e =
|
|
281
|
-
(i, r, o, s, a,
|
|
282
|
-
var
|
|
280
|
+
), e = R(
|
|
281
|
+
(i, r, o, s, a, u, f) => {
|
|
282
|
+
var m;
|
|
283
283
|
if (!(i != null && i.fields) || !s) throw new Error("Could not find section with fields.");
|
|
284
284
|
if (i.identifier === s.identifier)
|
|
285
|
-
|
|
285
|
+
f(
|
|
286
286
|
`fields.${r}.fields`,
|
|
287
|
-
Mt(i.fields, o,
|
|
287
|
+
Mt(i.fields, o, u)
|
|
288
288
|
).then();
|
|
289
289
|
else {
|
|
290
|
-
const
|
|
291
|
-
if (!
|
|
292
|
-
if (((
|
|
290
|
+
const d = i.fields[o];
|
|
291
|
+
if (!d) throw new Error("Could not find field to reorder.");
|
|
292
|
+
if (((m = s.condition) == null ? void 0 : m.identifier) === d.identifier) {
|
|
293
293
|
t({
|
|
294
294
|
title: "Could not reorder field",
|
|
295
295
|
description: "Field must be above the section whose condition references it."
|
|
296
296
|
});
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
|
-
|
|
299
|
+
f(`fields.${r}.fields`, dt(i.fields, o)).then(), f(
|
|
300
300
|
`fields.${a}.fields`,
|
|
301
|
-
Zn(s.fields,
|
|
301
|
+
Zn(s.fields, u, d)
|
|
302
302
|
).then();
|
|
303
303
|
}
|
|
304
304
|
},
|
|
@@ -307,14 +307,14 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
307
307
|
return { reorderSection: n, reorderField: e };
|
|
308
308
|
}, ni = (t) => {
|
|
309
309
|
const { helpText: n, children: e, severity: i } = t, r = i ? ge[i] : "base";
|
|
310
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ E("div", { className: "flex flex-col gap-1", children: [
|
|
311
311
|
e,
|
|
312
|
-
!!n && /* @__PURE__ */ l("div", { className: "flex flex-col w-full", children: /* @__PURE__ */ l(
|
|
312
|
+
!!n && /* @__PURE__ */ l("div", { className: "flex flex-col w-full", children: /* @__PURE__ */ l(ae, { accentColor: r, size: "xs", children: n }) })
|
|
313
313
|
] });
|
|
314
314
|
}, ii = Gn(() => {
|
|
315
315
|
throw new Error("No ImageViewerProvider found");
|
|
316
316
|
}), ln = () => hr(ii);
|
|
317
|
-
function
|
|
317
|
+
function fe(t, n, { checkForDefaultPrevented: e = !0 } = {}) {
|
|
318
318
|
return function(r) {
|
|
319
319
|
if (t == null || t(r), e === !1 || !r.defaultPrevented)
|
|
320
320
|
return n == null ? void 0 : n(r);
|
|
@@ -346,8 +346,8 @@ function we(...t) {
|
|
|
346
346
|
}
|
|
347
347
|
function Gr(t, n) {
|
|
348
348
|
const e = h.createContext(n), i = (o) => {
|
|
349
|
-
const { children: s, ...a } = o,
|
|
350
|
-
return /* @__PURE__ */ l(e.Provider, { value:
|
|
349
|
+
const { children: s, ...a } = o, u = h.useMemo(() => a, Object.values(a));
|
|
350
|
+
return /* @__PURE__ */ l(e.Provider, { value: u, children: s });
|
|
351
351
|
};
|
|
352
352
|
i.displayName = t + "Provider";
|
|
353
353
|
function r(o) {
|
|
@@ -361,30 +361,30 @@ function Gr(t, n) {
|
|
|
361
361
|
function Kr(t, n = []) {
|
|
362
362
|
let e = [];
|
|
363
363
|
function i(o, s) {
|
|
364
|
-
const a = h.createContext(s),
|
|
364
|
+
const a = h.createContext(s), u = e.length;
|
|
365
365
|
e = [...e, s];
|
|
366
|
-
const
|
|
366
|
+
const f = (d) => {
|
|
367
367
|
var w;
|
|
368
|
-
const { scope: p, children: b, ...y } =
|
|
368
|
+
const { scope: p, children: b, ...y } = d, c = ((w = p == null ? void 0 : p[t]) == null ? void 0 : w[u]) || a, v = h.useMemo(() => y, Object.values(y));
|
|
369
369
|
return /* @__PURE__ */ l(c.Provider, { value: v, children: b });
|
|
370
370
|
};
|
|
371
|
-
|
|
372
|
-
function
|
|
371
|
+
f.displayName = o + "Provider";
|
|
372
|
+
function m(d, p) {
|
|
373
373
|
var c;
|
|
374
|
-
const b = ((c = p == null ? void 0 : p[t]) == null ? void 0 : c[
|
|
374
|
+
const b = ((c = p == null ? void 0 : p[t]) == null ? void 0 : c[u]) || a, y = h.useContext(b);
|
|
375
375
|
if (y) return y;
|
|
376
376
|
if (s !== void 0) return s;
|
|
377
|
-
throw new Error(`\`${
|
|
377
|
+
throw new Error(`\`${d}\` must be used within \`${o}\``);
|
|
378
378
|
}
|
|
379
|
-
return [
|
|
379
|
+
return [f, m];
|
|
380
380
|
}
|
|
381
381
|
const r = () => {
|
|
382
382
|
const o = e.map((s) => h.createContext(s));
|
|
383
383
|
return function(a) {
|
|
384
|
-
const
|
|
384
|
+
const u = (a == null ? void 0 : a[t]) || o;
|
|
385
385
|
return h.useMemo(
|
|
386
|
-
() => ({ [`__scope${t}`]: { ...a, [t]:
|
|
387
|
-
[a,
|
|
386
|
+
() => ({ [`__scope${t}`]: { ...a, [t]: u } }),
|
|
387
|
+
[a, u]
|
|
388
388
|
);
|
|
389
389
|
};
|
|
390
390
|
};
|
|
@@ -399,9 +399,9 @@ function Xr(...t) {
|
|
|
399
399
|
scopeName: r.scopeName
|
|
400
400
|
}));
|
|
401
401
|
return function(o) {
|
|
402
|
-
const s = i.reduce((a, { useScope:
|
|
403
|
-
const
|
|
404
|
-
return { ...a, ...
|
|
402
|
+
const s = i.reduce((a, { useScope: u, scopeName: f }) => {
|
|
403
|
+
const d = u(o)[`__scope${f}`];
|
|
404
|
+
return { ...a, ...d };
|
|
405
405
|
}, {});
|
|
406
406
|
return h.useMemo(() => ({ [`__scope${n.scopeName}`]: s }), [s]);
|
|
407
407
|
};
|
|
@@ -432,17 +432,17 @@ function Jr({
|
|
|
432
432
|
onChange: e = () => {
|
|
433
433
|
}
|
|
434
434
|
}) {
|
|
435
|
-
const [i, r] = Zr({ defaultProp: n, onChange: e }), o = t !== void 0, s = o ? t : i, a = ve(e),
|
|
436
|
-
(
|
|
435
|
+
const [i, r] = Zr({ defaultProp: n, onChange: e }), o = t !== void 0, s = o ? t : i, a = ve(e), u = h.useCallback(
|
|
436
|
+
(f) => {
|
|
437
437
|
if (o) {
|
|
438
|
-
const
|
|
439
|
-
|
|
438
|
+
const d = typeof f == "function" ? f(t) : f;
|
|
439
|
+
d !== t && a(d);
|
|
440
440
|
} else
|
|
441
|
-
r(
|
|
441
|
+
r(f);
|
|
442
442
|
},
|
|
443
443
|
[o, t, r, a]
|
|
444
444
|
);
|
|
445
|
-
return [s,
|
|
445
|
+
return [s, u];
|
|
446
446
|
}
|
|
447
447
|
function Zr({
|
|
448
448
|
defaultProp: t,
|
|
@@ -456,7 +456,7 @@ function Zr({
|
|
|
456
456
|
var an = h.forwardRef((t, n) => {
|
|
457
457
|
const { children: e, ...i } = t, r = h.Children.toArray(e), o = r.find(to);
|
|
458
458
|
if (o) {
|
|
459
|
-
const s = o.props.children, a = r.map((
|
|
459
|
+
const s = o.props.children, a = r.map((u) => u === o ? h.Children.count(s) > 1 ? h.Children.only(null) : h.isValidElement(s) ? s.props.children : null : u);
|
|
460
460
|
return /* @__PURE__ */ l(kt, { ...i, ref: n, children: h.isValidElement(s) ? h.cloneElement(s, void 0, a) : null });
|
|
461
461
|
}
|
|
462
462
|
return /* @__PURE__ */ l(kt, { ...i, ref: n, children: e });
|
|
@@ -511,7 +511,7 @@ var ro = [
|
|
|
511
511
|
"span",
|
|
512
512
|
"svg",
|
|
513
513
|
"ul"
|
|
514
|
-
],
|
|
514
|
+
], ce = ro.reduce((t, n) => {
|
|
515
515
|
const e = h.forwardRef((i, r) => {
|
|
516
516
|
const { asChild: o, ...s } = i, a = o ? an : n;
|
|
517
517
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(a, { ...s, ref: r });
|
|
@@ -543,40 +543,40 @@ var lo = "DismissableLayer", zt = "dismissableLayer.update", ao = "dismissableLa
|
|
|
543
543
|
onFocusOutside: o,
|
|
544
544
|
onInteractOutside: s,
|
|
545
545
|
onDismiss: a,
|
|
546
|
-
...
|
|
547
|
-
} = t,
|
|
548
|
-
const
|
|
549
|
-
!S ||
|
|
546
|
+
...u
|
|
547
|
+
} = t, f = h.useContext(oi), [m, d] = h.useState(null), p = (m == null ? void 0 : m.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, b] = h.useState({}), y = we(n, (N) => d(N)), c = Array.from(f.layers), [v] = [...f.layersWithOutsidePointerEventsDisabled].slice(-1), w = c.indexOf(v), C = m ? c.indexOf(m) : -1, g = f.layersWithOutsidePointerEventsDisabled.size > 0, S = C >= w, x = mo((N) => {
|
|
548
|
+
const T = N.target, D = [...f.branches].some((M) => M.contains(T));
|
|
549
|
+
!S || D || (r == null || r(N), s == null || s(N), N.defaultPrevented || a == null || a());
|
|
550
550
|
}, p), F = ho((N) => {
|
|
551
|
-
const
|
|
552
|
-
[...
|
|
551
|
+
const T = N.target;
|
|
552
|
+
[...f.branches].some((M) => M.contains(T)) || (o == null || o(N), s == null || s(N), N.defaultPrevented || a == null || a());
|
|
553
553
|
}, p);
|
|
554
554
|
return so((N) => {
|
|
555
|
-
|
|
555
|
+
C === f.layers.size - 1 && (i == null || i(N), !N.defaultPrevented && a && (N.preventDefault(), a()));
|
|
556
556
|
}, p), h.useEffect(() => {
|
|
557
|
-
if (
|
|
558
|
-
return e && (
|
|
559
|
-
e &&
|
|
557
|
+
if (m)
|
|
558
|
+
return e && (f.layersWithOutsidePointerEventsDisabled.size === 0 && (Nn = p.body.style.pointerEvents, p.body.style.pointerEvents = "none"), f.layersWithOutsidePointerEventsDisabled.add(m)), f.layers.add(m), Tn(), () => {
|
|
559
|
+
e && f.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents = Nn);
|
|
560
560
|
};
|
|
561
|
-
}, [
|
|
562
|
-
|
|
563
|
-
}, [
|
|
561
|
+
}, [m, p, e, f]), h.useEffect(() => () => {
|
|
562
|
+
m && (f.layers.delete(m), f.layersWithOutsidePointerEventsDisabled.delete(m), Tn());
|
|
563
|
+
}, [m, f]), h.useEffect(() => {
|
|
564
564
|
const N = () => b({});
|
|
565
565
|
return document.addEventListener(zt, N), () => document.removeEventListener(zt, N);
|
|
566
566
|
}, []), /* @__PURE__ */ l(
|
|
567
|
-
|
|
567
|
+
ce.div,
|
|
568
568
|
{
|
|
569
|
-
...
|
|
569
|
+
...u,
|
|
570
570
|
ref: y,
|
|
571
571
|
style: {
|
|
572
572
|
pointerEvents: g ? S ? "auto" : "none" : void 0,
|
|
573
573
|
...t.style
|
|
574
574
|
},
|
|
575
|
-
onFocusCapture:
|
|
576
|
-
onBlurCapture:
|
|
577
|
-
onPointerDownCapture:
|
|
575
|
+
onFocusCapture: fe(t.onFocusCapture, F.onFocusCapture),
|
|
576
|
+
onBlurCapture: fe(t.onBlurCapture, F.onBlurCapture),
|
|
577
|
+
onPointerDownCapture: fe(
|
|
578
578
|
t.onPointerDownCapture,
|
|
579
|
-
|
|
579
|
+
x.onPointerDownCapture
|
|
580
580
|
)
|
|
581
581
|
}
|
|
582
582
|
);
|
|
@@ -591,7 +591,7 @@ var uo = "DismissableLayerBranch", fo = h.forwardRef((t, n) => {
|
|
|
591
591
|
return e.branches.add(o), () => {
|
|
592
592
|
e.branches.delete(o);
|
|
593
593
|
};
|
|
594
|
-
}, [e.branches]), /* @__PURE__ */ l(
|
|
594
|
+
}, [e.branches]), /* @__PURE__ */ l(ce.div, { ...t, ref: r });
|
|
595
595
|
});
|
|
596
596
|
fo.displayName = uo;
|
|
597
597
|
function mo(t, n = globalThis == null ? void 0 : globalThis.document) {
|
|
@@ -600,16 +600,16 @@ function mo(t, n = globalThis == null ? void 0 : globalThis.document) {
|
|
|
600
600
|
return h.useEffect(() => {
|
|
601
601
|
const o = (a) => {
|
|
602
602
|
if (a.target && !i.current) {
|
|
603
|
-
let
|
|
603
|
+
let u = function() {
|
|
604
604
|
li(
|
|
605
605
|
ao,
|
|
606
606
|
e,
|
|
607
|
-
|
|
607
|
+
f,
|
|
608
608
|
{ discrete: !0 }
|
|
609
609
|
);
|
|
610
610
|
};
|
|
611
|
-
const
|
|
612
|
-
a.pointerType === "touch" ? (n.removeEventListener("click", r.current), r.current =
|
|
611
|
+
const f = { originalEvent: a };
|
|
612
|
+
a.pointerType === "touch" ? (n.removeEventListener("click", r.current), r.current = u, n.addEventListener("click", r.current, { once: !0 })) : u();
|
|
613
613
|
} else
|
|
614
614
|
n.removeEventListener("click", r.current);
|
|
615
615
|
i.current = !1;
|
|
@@ -638,7 +638,7 @@ function ho(t, n = globalThis == null ? void 0 : globalThis.document) {
|
|
|
638
638
|
onBlurCapture: () => i.current = !1
|
|
639
639
|
};
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function Tn() {
|
|
642
642
|
const t = new CustomEvent(zt);
|
|
643
643
|
document.dispatchEvent(t);
|
|
644
644
|
}
|
|
@@ -646,14 +646,14 @@ function li(t, n, e, { discrete: i }) {
|
|
|
646
646
|
const r = e.originalEvent.target, o = new CustomEvent(t, { bubbles: !1, cancelable: !0, detail: e });
|
|
647
647
|
n && r.addEventListener(t, n, { once: !0 }), i ? oo(r, o) : r.dispatchEvent(o);
|
|
648
648
|
}
|
|
649
|
-
var
|
|
649
|
+
var Tt = "focusScope.autoFocusOnMount", Rt = "focusScope.autoFocusOnUnmount", Rn = { bubbles: !1, cancelable: !0 }, po = "FocusScope", ai = h.forwardRef((t, n) => {
|
|
650
650
|
const {
|
|
651
651
|
loop: e = !1,
|
|
652
652
|
trapped: i = !1,
|
|
653
653
|
onMountAutoFocus: r,
|
|
654
654
|
onUnmountAutoFocus: o,
|
|
655
655
|
...s
|
|
656
|
-
} = t, [a,
|
|
656
|
+
} = t, [a, u] = h.useState(null), f = ve(r), m = ve(o), d = h.useRef(null), p = we(n, (c) => u(c)), b = h.useRef({
|
|
657
657
|
paused: !1,
|
|
658
658
|
pause() {
|
|
659
659
|
this.paused = !0;
|
|
@@ -667,20 +667,20 @@ var Rt = "focusScope.autoFocusOnMount", Tt = "focusScope.autoFocusOnUnmount", Tn
|
|
|
667
667
|
let c = function(g) {
|
|
668
668
|
if (b.paused || !a) return;
|
|
669
669
|
const S = g.target;
|
|
670
|
-
a.contains(S) ?
|
|
670
|
+
a.contains(S) ? d.current = S : ue(d.current, { select: !0 });
|
|
671
671
|
}, v = function(g) {
|
|
672
672
|
if (b.paused || !a) return;
|
|
673
673
|
const S = g.relatedTarget;
|
|
674
|
-
S !== null && (a.contains(S) ||
|
|
674
|
+
S !== null && (a.contains(S) || ue(d.current, { select: !0 }));
|
|
675
675
|
}, w = function(g) {
|
|
676
676
|
if (document.activeElement === document.body)
|
|
677
|
-
for (const
|
|
678
|
-
|
|
677
|
+
for (const x of g)
|
|
678
|
+
x.removedNodes.length > 0 && ue(a);
|
|
679
679
|
};
|
|
680
680
|
document.addEventListener("focusin", c), document.addEventListener("focusout", v);
|
|
681
|
-
const
|
|
682
|
-
return a &&
|
|
683
|
-
document.removeEventListener("focusin", c), document.removeEventListener("focusout", v),
|
|
681
|
+
const C = new MutationObserver(w);
|
|
682
|
+
return a && C.observe(a, { childList: !0, subtree: !0 }), () => {
|
|
683
|
+
document.removeEventListener("focusin", c), document.removeEventListener("focusout", v), C.disconnect();
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
686
|
}, [i, a, b.paused]), h.useEffect(() => {
|
|
@@ -688,35 +688,35 @@ var Rt = "focusScope.autoFocusOnMount", Tt = "focusScope.autoFocusOnUnmount", Tn
|
|
|
688
688
|
Ln.add(b);
|
|
689
689
|
const c = document.activeElement;
|
|
690
690
|
if (!a.contains(c)) {
|
|
691
|
-
const w = new CustomEvent(
|
|
692
|
-
a.addEventListener(
|
|
691
|
+
const w = new CustomEvent(Tt, Rn);
|
|
692
|
+
a.addEventListener(Tt, f), a.dispatchEvent(w), w.defaultPrevented || (go(wo(ci(a)), { select: !0 }), document.activeElement === c && ue(a));
|
|
693
693
|
}
|
|
694
694
|
return () => {
|
|
695
|
-
a.removeEventListener(
|
|
696
|
-
const w = new CustomEvent(
|
|
697
|
-
a.addEventListener(
|
|
695
|
+
a.removeEventListener(Tt, f), setTimeout(() => {
|
|
696
|
+
const w = new CustomEvent(Rt, Rn);
|
|
697
|
+
a.addEventListener(Rt, m), a.dispatchEvent(w), w.defaultPrevented || ue(c ?? document.body, { select: !0 }), a.removeEventListener(Rt, m), Ln.remove(b);
|
|
698
698
|
}, 0);
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
|
-
}, [a,
|
|
701
|
+
}, [a, f, m, b]);
|
|
702
702
|
const y = h.useCallback(
|
|
703
703
|
(c) => {
|
|
704
704
|
if (!e && !i || b.paused) return;
|
|
705
705
|
const v = c.key === "Tab" && !c.altKey && !c.ctrlKey && !c.metaKey, w = document.activeElement;
|
|
706
706
|
if (v && w) {
|
|
707
|
-
const
|
|
708
|
-
g && S ? !c.shiftKey && w === S ? (c.preventDefault(), e &&
|
|
707
|
+
const C = c.currentTarget, [g, S] = vo(C);
|
|
708
|
+
g && S ? !c.shiftKey && w === S ? (c.preventDefault(), e && ue(g, { select: !0 })) : c.shiftKey && w === g && (c.preventDefault(), e && ue(S, { select: !0 })) : w === C && c.preventDefault();
|
|
709
709
|
}
|
|
710
710
|
},
|
|
711
711
|
[e, i, b.paused]
|
|
712
712
|
);
|
|
713
|
-
return /* @__PURE__ */ l(
|
|
713
|
+
return /* @__PURE__ */ l(ce.div, { tabIndex: -1, ...s, ref: p, onKeyDown: y });
|
|
714
714
|
});
|
|
715
715
|
ai.displayName = po;
|
|
716
716
|
function go(t, { select: n = !1 } = {}) {
|
|
717
717
|
const e = document.activeElement;
|
|
718
718
|
for (const i of t)
|
|
719
|
-
if (
|
|
719
|
+
if (ue(i, { select: n }), document.activeElement !== e) return;
|
|
720
720
|
}
|
|
721
721
|
function vo(t) {
|
|
722
722
|
const n = ci(t), e = Fn(n, t), i = Fn(n.reverse(), t);
|
|
@@ -748,7 +748,7 @@ function yo(t, { upTo: n }) {
|
|
|
748
748
|
function bo(t) {
|
|
749
749
|
return t instanceof HTMLInputElement && "select" in t;
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function ue(t, { select: n = !1 } = {}) {
|
|
752
752
|
if (t && t.focus) {
|
|
753
753
|
const e = document.activeElement;
|
|
754
754
|
t.focus({ preventScroll: !0 }), t !== e && bo(t) && n && t.select();
|
|
@@ -780,7 +780,7 @@ var Co = "Portal", di = h.forwardRef((t, n) => {
|
|
|
780
780
|
const { container: e, ...i } = t, [r, o] = h.useState(!1);
|
|
781
781
|
ft(() => o(!0), []);
|
|
782
782
|
const s = e || r && ((a = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : a.body);
|
|
783
|
-
return s ? Or.createPortal(/* @__PURE__ */ l(
|
|
783
|
+
return s ? Or.createPortal(/* @__PURE__ */ l(ce.div, { ...i, ref: n }), s) : null;
|
|
784
784
|
});
|
|
785
785
|
di.displayName = Co;
|
|
786
786
|
function Eo(t, n) {
|
|
@@ -792,7 +792,7 @@ var xt = (t) => {
|
|
|
792
792
|
};
|
|
793
793
|
xt.displayName = "Presence";
|
|
794
794
|
function Io(t) {
|
|
795
|
-
const [n, e] = h.useState(), i = h.useRef({}), r = h.useRef(t), o = h.useRef("none"), s = t ? "mounted" : "unmounted", [a,
|
|
795
|
+
const [n, e] = h.useState(), i = h.useRef({}), r = h.useRef(t), o = h.useRef("none"), s = t ? "mounted" : "unmounted", [a, u] = Eo(s, {
|
|
796
796
|
mounted: {
|
|
797
797
|
UNMOUNT: "unmounted",
|
|
798
798
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -806,37 +806,37 @@ function Io(t) {
|
|
|
806
806
|
}
|
|
807
807
|
});
|
|
808
808
|
return h.useEffect(() => {
|
|
809
|
-
const
|
|
810
|
-
o.current = a === "mounted" ?
|
|
809
|
+
const f = Je(i.current);
|
|
810
|
+
o.current = a === "mounted" ? f : "none";
|
|
811
811
|
}, [a]), ft(() => {
|
|
812
|
-
const
|
|
813
|
-
if (
|
|
814
|
-
const p = o.current, b = Je(
|
|
815
|
-
t ?
|
|
812
|
+
const f = i.current, m = r.current;
|
|
813
|
+
if (m !== t) {
|
|
814
|
+
const p = o.current, b = Je(f);
|
|
815
|
+
t ? u("MOUNT") : b === "none" || (f == null ? void 0 : f.display) === "none" ? u("UNMOUNT") : u(m && p !== b ? "ANIMATION_OUT" : "UNMOUNT"), r.current = t;
|
|
816
816
|
}
|
|
817
|
-
}, [t,
|
|
817
|
+
}, [t, u]), ft(() => {
|
|
818
818
|
if (n) {
|
|
819
|
-
let
|
|
820
|
-
const
|
|
819
|
+
let f;
|
|
820
|
+
const m = n.ownerDocument.defaultView ?? window, d = (b) => {
|
|
821
821
|
const c = Je(i.current).includes(b.animationName);
|
|
822
|
-
if (b.target === n && c && (
|
|
822
|
+
if (b.target === n && c && (u("ANIMATION_END"), !r.current)) {
|
|
823
823
|
const v = n.style.animationFillMode;
|
|
824
|
-
n.style.animationFillMode = "forwards",
|
|
824
|
+
n.style.animationFillMode = "forwards", f = m.setTimeout(() => {
|
|
825
825
|
n.style.animationFillMode === "forwards" && (n.style.animationFillMode = v);
|
|
826
826
|
});
|
|
827
827
|
}
|
|
828
828
|
}, p = (b) => {
|
|
829
829
|
b.target === n && (o.current = Je(i.current));
|
|
830
830
|
};
|
|
831
|
-
return n.addEventListener("animationstart", p), n.addEventListener("animationcancel",
|
|
832
|
-
|
|
831
|
+
return n.addEventListener("animationstart", p), n.addEventListener("animationcancel", d), n.addEventListener("animationend", d), () => {
|
|
832
|
+
m.clearTimeout(f), n.removeEventListener("animationstart", p), n.removeEventListener("animationcancel", d), n.removeEventListener("animationend", d);
|
|
833
833
|
};
|
|
834
834
|
} else
|
|
835
|
-
|
|
836
|
-
}, [n,
|
|
835
|
+
u("ANIMATION_END");
|
|
836
|
+
}, [n, u]), {
|
|
837
837
|
isPresent: ["mounted", "unmountSuspended"].includes(a),
|
|
838
|
-
ref: h.useCallback((
|
|
839
|
-
|
|
838
|
+
ref: h.useCallback((f) => {
|
|
839
|
+
f && (i.current = getComputedStyle(f)), e(f);
|
|
840
840
|
}, [])
|
|
841
841
|
};
|
|
842
842
|
}
|
|
@@ -861,14 +861,14 @@ function An() {
|
|
|
861
861
|
const t = document.createElement("span");
|
|
862
862
|
return t.setAttribute("data-radix-focus-guard", ""), t.tabIndex = 0, t.style.outline = "none", t.style.opacity = "0", t.style.position = "fixed", t.style.pointerEvents = "none", t;
|
|
863
863
|
}
|
|
864
|
-
var
|
|
865
|
-
return
|
|
864
|
+
var oe = function() {
|
|
865
|
+
return oe = Object.assign || function(n) {
|
|
866
866
|
for (var e, i = 1, r = arguments.length; i < r; i++) {
|
|
867
867
|
e = arguments[i];
|
|
868
868
|
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (n[o] = e[o]);
|
|
869
869
|
}
|
|
870
870
|
return n;
|
|
871
|
-
},
|
|
871
|
+
}, oe.apply(this, arguments);
|
|
872
872
|
};
|
|
873
873
|
function ui(t, n) {
|
|
874
874
|
var e = {};
|
|
@@ -878,12 +878,12 @@ function ui(t, n) {
|
|
|
878
878
|
n.indexOf(i[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, i[r]) && (e[i[r]] = t[i[r]]);
|
|
879
879
|
return e;
|
|
880
880
|
}
|
|
881
|
-
function
|
|
881
|
+
function To(t, n, e) {
|
|
882
882
|
if (e || arguments.length === 2) for (var i = 0, r = n.length, o; i < r; i++)
|
|
883
883
|
(o || !(i in n)) && (o || (o = Array.prototype.slice.call(n, 0, i)), o[i] = n[i]);
|
|
884
884
|
return t.concat(o || Array.prototype.slice.call(n));
|
|
885
885
|
}
|
|
886
|
-
var it = "right-scroll-bar-position", rt = "width-before-scroll-bar",
|
|
886
|
+
var it = "right-scroll-bar-position", rt = "width-before-scroll-bar", Ro = "with-scroll-bars-hidden", Fo = "--removed-body-scroll-bar-size";
|
|
887
887
|
function Lt(t, n) {
|
|
888
888
|
return typeof t == "function" ? t(n) : t && (t.current = n), t;
|
|
889
889
|
}
|
|
@@ -968,18 +968,18 @@ function Oo(t, n) {
|
|
|
968
968
|
var a = e;
|
|
969
969
|
e = [], a.forEach(o), s = e;
|
|
970
970
|
}
|
|
971
|
-
var
|
|
972
|
-
var
|
|
973
|
-
s = [],
|
|
974
|
-
},
|
|
975
|
-
return Promise.resolve().then(
|
|
971
|
+
var u = function() {
|
|
972
|
+
var m = s;
|
|
973
|
+
s = [], m.forEach(o);
|
|
974
|
+
}, f = function() {
|
|
975
|
+
return Promise.resolve().then(u);
|
|
976
976
|
};
|
|
977
|
-
|
|
978
|
-
push: function(
|
|
979
|
-
s.push(
|
|
977
|
+
f(), e = {
|
|
978
|
+
push: function(m) {
|
|
979
|
+
s.push(m), f();
|
|
980
980
|
},
|
|
981
|
-
filter: function(
|
|
982
|
-
return s = s.filter(
|
|
981
|
+
filter: function(m) {
|
|
982
|
+
return s = s.filter(m), e;
|
|
983
983
|
}
|
|
984
984
|
};
|
|
985
985
|
}
|
|
@@ -989,7 +989,7 @@ function Oo(t, n) {
|
|
|
989
989
|
function Mo(t) {
|
|
990
990
|
t === void 0 && (t = {});
|
|
991
991
|
var n = Oo(null);
|
|
992
|
-
return n.options =
|
|
992
|
+
return n.options = oe({ async: !0, ssr: !1 }, t), n;
|
|
993
993
|
}
|
|
994
994
|
var fi = function(t) {
|
|
995
995
|
var n = t.sideCar, e = ui(t, ["sideCar"]);
|
|
@@ -998,7 +998,7 @@ var fi = function(t) {
|
|
|
998
998
|
var i = n.read();
|
|
999
999
|
if (!i)
|
|
1000
1000
|
throw new Error("Sidecar medium not found");
|
|
1001
|
-
return h.createElement(i,
|
|
1001
|
+
return h.createElement(i, oe({}, e));
|
|
1002
1002
|
};
|
|
1003
1003
|
fi.isSideCarExport = !0;
|
|
1004
1004
|
function ko(t, n) {
|
|
@@ -1010,12 +1010,12 @@ var mi = Mo(), Dt = function() {
|
|
|
1010
1010
|
onScrollCapture: Dt,
|
|
1011
1011
|
onWheelCapture: Dt,
|
|
1012
1012
|
onTouchMoveCapture: Dt
|
|
1013
|
-
}), r = i[0], o = i[1], s = t.forwardProps, a = t.children,
|
|
1013
|
+
}), r = i[0], o = i[1], s = t.forwardProps, a = t.children, u = t.className, f = t.removeScrollBar, m = t.enabled, d = t.shards, p = t.sideCar, b = t.noIsolation, y = t.inert, c = t.allowPinchZoom, v = t.as, w = v === void 0 ? "div" : v, C = t.gapMode, g = ui(t, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = p, x = Ao([e, n]), F = oe(oe({}, g), r);
|
|
1014
1014
|
return h.createElement(
|
|
1015
1015
|
h.Fragment,
|
|
1016
1016
|
null,
|
|
1017
|
-
|
|
1018
|
-
s ? h.cloneElement(h.Children.only(a),
|
|
1017
|
+
m && h.createElement(S, { sideCar: mi, removeScrollBar: f, shards: d, noIsolation: b, inert: y, setCallbacks: o, allowPinchZoom: !!c, lockRef: e, gapMode: C }),
|
|
1018
|
+
s ? h.cloneElement(h.Children.only(a), oe(oe({}, F), { ref: x })) : h.createElement(w, oe({}, F, { className: u, ref: x }), a)
|
|
1019
1019
|
);
|
|
1020
1020
|
});
|
|
1021
1021
|
wt.defaultProps = {
|
|
@@ -1039,25 +1039,25 @@ function _o() {
|
|
|
1039
1039
|
var n = zo();
|
|
1040
1040
|
return n && t.setAttribute("nonce", n), t;
|
|
1041
1041
|
}
|
|
1042
|
-
function
|
|
1042
|
+
function Bo(t, n) {
|
|
1043
1043
|
t.styleSheet ? t.styleSheet.cssText = n : t.appendChild(document.createTextNode(n));
|
|
1044
1044
|
}
|
|
1045
1045
|
function Vo(t) {
|
|
1046
1046
|
var n = document.head || document.getElementsByTagName("head")[0];
|
|
1047
1047
|
n.appendChild(t);
|
|
1048
1048
|
}
|
|
1049
|
-
var
|
|
1049
|
+
var $o = function() {
|
|
1050
1050
|
var t = 0, n = null;
|
|
1051
1051
|
return {
|
|
1052
1052
|
add: function(e) {
|
|
1053
|
-
t == 0 && (n = _o()) && (
|
|
1053
|
+
t == 0 && (n = _o()) && (Bo(n, e), Vo(n)), t++;
|
|
1054
1054
|
},
|
|
1055
1055
|
remove: function() {
|
|
1056
1056
|
t--, !t && n && (n.parentNode && n.parentNode.removeChild(n), n = null);
|
|
1057
1057
|
}
|
|
1058
1058
|
};
|
|
1059
1059
|
}, Uo = function() {
|
|
1060
|
-
var t =
|
|
1060
|
+
var t = $o();
|
|
1061
1061
|
return function(n, e) {
|
|
1062
1062
|
h.useEffect(function() {
|
|
1063
1063
|
return t.add(n), function() {
|
|
@@ -1091,14 +1091,14 @@ var Bo = function() {
|
|
|
1091
1091
|
right: n[2],
|
|
1092
1092
|
gap: Math.max(0, i - e + n[2] - n[0])
|
|
1093
1093
|
};
|
|
1094
|
-
}, Ho = hi(),
|
|
1094
|
+
}, Ho = hi(), $e = "data-scroll-locked", Go = function(t, n, e, i) {
|
|
1095
1095
|
var r = t.left, o = t.top, s = t.right, a = t.gap;
|
|
1096
1096
|
return e === void 0 && (e = "margin"), `
|
|
1097
|
-
.`.concat(
|
|
1097
|
+
.`.concat(Ro, ` {
|
|
1098
1098
|
overflow: hidden `).concat(i, `;
|
|
1099
1099
|
padding-right: `).concat(a, "px ").concat(i, `;
|
|
1100
1100
|
}
|
|
1101
|
-
body[`).concat(
|
|
1101
|
+
body[`).concat($e, `] {
|
|
1102
1102
|
overflow: hidden `).concat(i, `;
|
|
1103
1103
|
overscroll-behavior: contain;
|
|
1104
1104
|
`).concat([
|
|
@@ -1131,18 +1131,18 @@ var Bo = function() {
|
|
|
1131
1131
|
margin-right: 0 `).concat(i, `;
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
|
-
body[`).concat(
|
|
1134
|
+
body[`).concat($e, `] {
|
|
1135
1135
|
`).concat(Fo, ": ").concat(a, `px;
|
|
1136
1136
|
}
|
|
1137
1137
|
`);
|
|
1138
1138
|
}, On = function() {
|
|
1139
|
-
var t = parseInt(document.body.getAttribute(
|
|
1139
|
+
var t = parseInt(document.body.getAttribute($e) || "0", 10);
|
|
1140
1140
|
return isFinite(t) ? t : 0;
|
|
1141
1141
|
}, Ko = function() {
|
|
1142
1142
|
h.useEffect(function() {
|
|
1143
|
-
return document.body.setAttribute(
|
|
1143
|
+
return document.body.setAttribute($e, (On() + 1).toString()), function() {
|
|
1144
1144
|
var t = On() - 1;
|
|
1145
|
-
t <= 0 ? document.body.removeAttribute(
|
|
1145
|
+
t <= 0 ? document.body.removeAttribute($e) : document.body.setAttribute($e, t.toString());
|
|
1146
1146
|
};
|
|
1147
1147
|
}, []);
|
|
1148
1148
|
}, Xo = function(t) {
|
|
@@ -1213,16 +1213,16 @@ var Se = _t ? { passive: !1 } : !1, Yo = function(t) {
|
|
|
1213
1213
|
}, ts = function(t, n) {
|
|
1214
1214
|
return t === "h" && n === "rtl" ? -1 : 1;
|
|
1215
1215
|
}, ns = function(t, n, e, i, r) {
|
|
1216
|
-
var o = ts(t, window.getComputedStyle(n).direction), s = o * i, a = e.target,
|
|
1216
|
+
var o = ts(t, window.getComputedStyle(n).direction), s = o * i, a = e.target, u = n.contains(a), f = !1, m = s > 0, d = 0, p = 0;
|
|
1217
1217
|
do {
|
|
1218
1218
|
var b = vi(t, a), y = b[0], c = b[1], v = b[2], w = c - v - o * y;
|
|
1219
|
-
(y || w) && gi(t, a) && (
|
|
1219
|
+
(y || w) && gi(t, a) && (d += w, p += y), a instanceof ShadowRoot ? a = a.host : a = a.parentNode;
|
|
1220
1220
|
} while (
|
|
1221
1221
|
// portaled content
|
|
1222
|
-
!
|
|
1223
|
-
|
|
1222
|
+
!u && a !== document.body || // self content
|
|
1223
|
+
u && (n.contains(a) || n === a)
|
|
1224
1224
|
);
|
|
1225
|
-
return (
|
|
1225
|
+
return (m && Math.abs(d) < 1 || !m && Math.abs(p) < 1) && (f = !0), f;
|
|
1226
1226
|
}, et = function(t) {
|
|
1227
1227
|
return "changedTouches" in t ? [t.changedTouches[0].clientX, t.changedTouches[0].clientY] : [0, 0];
|
|
1228
1228
|
}, kn = function(t) {
|
|
@@ -1244,7 +1244,7 @@ function ss(t) {
|
|
|
1244
1244
|
}, [t]), h.useEffect(function() {
|
|
1245
1245
|
if (t.inert) {
|
|
1246
1246
|
document.body.classList.add("block-interactivity-".concat(r));
|
|
1247
|
-
var c =
|
|
1247
|
+
var c = To([t.lockRef.current], (t.shards || []).map(zn), !0).filter(Boolean);
|
|
1248
1248
|
return c.forEach(function(v) {
|
|
1249
1249
|
return v.classList.add("allow-interactivity-".concat(r));
|
|
1250
1250
|
}), function() {
|
|
@@ -1257,58 +1257,58 @@ function ss(t) {
|
|
|
1257
1257
|
var a = h.useCallback(function(c, v) {
|
|
1258
1258
|
if ("touches" in c && c.touches.length === 2 || c.type === "wheel" && c.ctrlKey)
|
|
1259
1259
|
return !s.current.allowPinchZoom;
|
|
1260
|
-
var w = et(c),
|
|
1260
|
+
var w = et(c), C = e.current, g = "deltaX" in c ? c.deltaX : C[0] - w[0], S = "deltaY" in c ? c.deltaY : C[1] - w[1], x, F = c.target, N = Math.abs(g) > Math.abs(S) ? "h" : "v";
|
|
1261
1261
|
if ("touches" in c && N === "h" && F.type === "range")
|
|
1262
1262
|
return !1;
|
|
1263
|
-
var
|
|
1264
|
-
if (!
|
|
1263
|
+
var T = Mn(N, F);
|
|
1264
|
+
if (!T)
|
|
1265
1265
|
return !0;
|
|
1266
|
-
if (
|
|
1266
|
+
if (T ? x = N : (x = N === "v" ? "h" : "v", T = Mn(N, F)), !T)
|
|
1267
1267
|
return !1;
|
|
1268
|
-
if (!i.current && "changedTouches" in c && (g || S) && (i.current =
|
|
1268
|
+
if (!i.current && "changedTouches" in c && (g || S) && (i.current = x), !x)
|
|
1269
1269
|
return !0;
|
|
1270
|
-
var
|
|
1271
|
-
return ns(
|
|
1272
|
-
}, []),
|
|
1270
|
+
var D = i.current || x;
|
|
1271
|
+
return ns(D, v, c, D === "h" ? g : S);
|
|
1272
|
+
}, []), u = h.useCallback(function(c) {
|
|
1273
1273
|
var v = c;
|
|
1274
1274
|
if (!(!Ne.length || Ne[Ne.length - 1] !== o)) {
|
|
1275
|
-
var w = "deltaY" in v ? kn(v) : et(v),
|
|
1276
|
-
return
|
|
1275
|
+
var w = "deltaY" in v ? kn(v) : et(v), C = n.current.filter(function(x) {
|
|
1276
|
+
return x.name === v.type && (x.target === v.target || v.target === x.shadowParent) && is(x.delta, w);
|
|
1277
1277
|
})[0];
|
|
1278
|
-
if (
|
|
1278
|
+
if (C && C.should) {
|
|
1279
1279
|
v.cancelable && v.preventDefault();
|
|
1280
1280
|
return;
|
|
1281
1281
|
}
|
|
1282
|
-
if (!
|
|
1283
|
-
var g = (s.current.shards || []).map(zn).filter(Boolean).filter(function(
|
|
1284
|
-
return
|
|
1282
|
+
if (!C) {
|
|
1283
|
+
var g = (s.current.shards || []).map(zn).filter(Boolean).filter(function(x) {
|
|
1284
|
+
return x.contains(v.target);
|
|
1285
1285
|
}), S = g.length > 0 ? a(v, g[0]) : !s.current.noIsolation;
|
|
1286
1286
|
S && v.cancelable && v.preventDefault();
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
|
-
}, []),
|
|
1290
|
-
var g = { name: c, delta: v, target: w, should:
|
|
1289
|
+
}, []), f = h.useCallback(function(c, v, w, C) {
|
|
1290
|
+
var g = { name: c, delta: v, target: w, should: C, shadowParent: ls(w) };
|
|
1291
1291
|
n.current.push(g), setTimeout(function() {
|
|
1292
1292
|
n.current = n.current.filter(function(S) {
|
|
1293
1293
|
return S !== g;
|
|
1294
1294
|
});
|
|
1295
1295
|
}, 1);
|
|
1296
|
-
}, []),
|
|
1296
|
+
}, []), m = h.useCallback(function(c) {
|
|
1297
1297
|
e.current = et(c), i.current = void 0;
|
|
1298
|
-
}, []),
|
|
1299
|
-
|
|
1298
|
+
}, []), d = h.useCallback(function(c) {
|
|
1299
|
+
f(c.type, kn(c), c.target, a(c, t.lockRef.current));
|
|
1300
1300
|
}, []), p = h.useCallback(function(c) {
|
|
1301
|
-
|
|
1301
|
+
f(c.type, et(c), c.target, a(c, t.lockRef.current));
|
|
1302
1302
|
}, []);
|
|
1303
1303
|
h.useEffect(function() {
|
|
1304
1304
|
return Ne.push(o), t.setCallbacks({
|
|
1305
|
-
onScrollCapture:
|
|
1306
|
-
onWheelCapture:
|
|
1305
|
+
onScrollCapture: d,
|
|
1306
|
+
onWheelCapture: d,
|
|
1307
1307
|
onTouchMoveCapture: p
|
|
1308
|
-
}), document.addEventListener("wheel",
|
|
1308
|
+
}), document.addEventListener("wheel", u, Se), document.addEventListener("touchmove", u, Se), document.addEventListener("touchstart", m, Se), function() {
|
|
1309
1309
|
Ne = Ne.filter(function(c) {
|
|
1310
1310
|
return c !== o;
|
|
1311
|
-
}), document.removeEventListener("wheel",
|
|
1311
|
+
}), document.removeEventListener("wheel", u, Se), document.removeEventListener("touchmove", u, Se), document.removeEventListener("touchstart", m, Se);
|
|
1312
1312
|
};
|
|
1313
1313
|
}, []);
|
|
1314
1314
|
var b = t.removeScrollBar, y = t.inert;
|
|
@@ -1326,7 +1326,7 @@ function ls(t) {
|
|
|
1326
1326
|
}
|
|
1327
1327
|
const as = ko(mi, ss);
|
|
1328
1328
|
var yi = h.forwardRef(function(t, n) {
|
|
1329
|
-
return h.createElement(wt,
|
|
1329
|
+
return h.createElement(wt, oe({}, t, { ref: n, sideCar: as }));
|
|
1330
1330
|
});
|
|
1331
1331
|
yi.classNames = wt.classNames;
|
|
1332
1332
|
var cs = function(t) {
|
|
@@ -1334,7 +1334,7 @@ var cs = function(t) {
|
|
|
1334
1334
|
return null;
|
|
1335
1335
|
var n = Array.isArray(t) ? t[0] : t;
|
|
1336
1336
|
return n.ownerDocument.body;
|
|
1337
|
-
},
|
|
1337
|
+
}, Te = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), nt = {}, Pt = 0, bi = function(t) {
|
|
1338
1338
|
return t && (t.host || bi(t.parentNode));
|
|
1339
1339
|
}, ds = function(t, n) {
|
|
1340
1340
|
return n.map(function(e) {
|
|
@@ -1348,28 +1348,28 @@ var cs = function(t) {
|
|
|
1348
1348
|
}, us = function(t, n, e, i) {
|
|
1349
1349
|
var r = ds(n, Array.isArray(t) ? t : [t]);
|
|
1350
1350
|
nt[e] || (nt[e] = /* @__PURE__ */ new WeakMap());
|
|
1351
|
-
var o = nt[e], s = [], a = /* @__PURE__ */ new Set(),
|
|
1352
|
-
!
|
|
1351
|
+
var o = nt[e], s = [], a = /* @__PURE__ */ new Set(), u = new Set(r), f = function(d) {
|
|
1352
|
+
!d || a.has(d) || (a.add(d), f(d.parentNode));
|
|
1353
1353
|
};
|
|
1354
|
-
r.forEach(
|
|
1355
|
-
var
|
|
1356
|
-
!
|
|
1354
|
+
r.forEach(f);
|
|
1355
|
+
var m = function(d) {
|
|
1356
|
+
!d || u.has(d) || Array.prototype.forEach.call(d.children, function(p) {
|
|
1357
1357
|
if (a.has(p))
|
|
1358
|
-
|
|
1358
|
+
m(p);
|
|
1359
1359
|
else
|
|
1360
1360
|
try {
|
|
1361
|
-
var b = p.getAttribute(i), y = b !== null && b !== "false", c = (
|
|
1362
|
-
|
|
1361
|
+
var b = p.getAttribute(i), y = b !== null && b !== "false", c = (Te.get(p) || 0) + 1, v = (o.get(p) || 0) + 1;
|
|
1362
|
+
Te.set(p, c), o.set(p, v), s.push(p), c === 1 && y && tt.set(p, !0), v === 1 && p.setAttribute(e, "true"), y || p.setAttribute(i, "true");
|
|
1363
1363
|
} catch (w) {
|
|
1364
1364
|
console.error("aria-hidden: cannot operate on ", p, w);
|
|
1365
1365
|
}
|
|
1366
1366
|
});
|
|
1367
1367
|
};
|
|
1368
|
-
return
|
|
1369
|
-
s.forEach(function(
|
|
1370
|
-
var p =
|
|
1371
|
-
|
|
1372
|
-
}), Pt--, Pt || (
|
|
1368
|
+
return m(n), a.clear(), Pt++, function() {
|
|
1369
|
+
s.forEach(function(d) {
|
|
1370
|
+
var p = Te.get(d) - 1, b = o.get(d) - 1;
|
|
1371
|
+
Te.set(d, p), o.set(d, b), p || (tt.has(d) || d.removeAttribute(i), tt.delete(d)), b || d.removeAttribute(e);
|
|
1372
|
+
}), Pt--, Pt || (Te = /* @__PURE__ */ new WeakMap(), Te = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), nt = {});
|
|
1373
1373
|
};
|
|
1374
1374
|
}, fs = function(t, n, e) {
|
|
1375
1375
|
e === void 0 && (e = "data-aria-hidden");
|
|
@@ -1377,7 +1377,7 @@ var cs = function(t) {
|
|
|
1377
1377
|
return r ? (i.push.apply(i, Array.from(r.querySelectorAll("[aria-live]"))), us(i, r, e, "aria-hidden")) : function() {
|
|
1378
1378
|
return null;
|
|
1379
1379
|
};
|
|
1380
|
-
}, cn = "Dialog", [xi, cl] = Kr(cn), [ms,
|
|
1380
|
+
}, cn = "Dialog", [xi, cl] = Kr(cn), [ms, te] = xi(cn), wi = (t) => {
|
|
1381
1381
|
const {
|
|
1382
1382
|
__scopeDialog: n,
|
|
1383
1383
|
children: e,
|
|
@@ -1385,7 +1385,7 @@ var cs = function(t) {
|
|
|
1385
1385
|
defaultOpen: r,
|
|
1386
1386
|
onOpenChange: o,
|
|
1387
1387
|
modal: s = !0
|
|
1388
|
-
} = t, a = h.useRef(null),
|
|
1388
|
+
} = t, a = h.useRef(null), u = h.useRef(null), [f = !1, m] = Jr({
|
|
1389
1389
|
prop: i,
|
|
1390
1390
|
defaultProp: r,
|
|
1391
1391
|
onChange: o
|
|
@@ -1395,13 +1395,13 @@ var cs = function(t) {
|
|
|
1395
1395
|
{
|
|
1396
1396
|
scope: n,
|
|
1397
1397
|
triggerRef: a,
|
|
1398
|
-
contentRef:
|
|
1398
|
+
contentRef: u,
|
|
1399
1399
|
contentId: Nt(),
|
|
1400
1400
|
titleId: Nt(),
|
|
1401
1401
|
descriptionId: Nt(),
|
|
1402
|
-
open:
|
|
1403
|
-
onOpenChange:
|
|
1404
|
-
onOpenToggle: h.useCallback(() =>
|
|
1402
|
+
open: f,
|
|
1403
|
+
onOpenChange: m,
|
|
1404
|
+
onOpenToggle: h.useCallback(() => m((d) => !d), [m]),
|
|
1405
1405
|
modal: s,
|
|
1406
1406
|
children: e
|
|
1407
1407
|
}
|
|
@@ -1410,9 +1410,9 @@ var cs = function(t) {
|
|
|
1410
1410
|
wi.displayName = cn;
|
|
1411
1411
|
var Ci = "DialogTrigger", Ei = h.forwardRef(
|
|
1412
1412
|
(t, n) => {
|
|
1413
|
-
const { __scopeDialog: e, ...i } = t, r =
|
|
1413
|
+
const { __scopeDialog: e, ...i } = t, r = te(Ci, e), o = we(n, r.triggerRef);
|
|
1414
1414
|
return /* @__PURE__ */ l(
|
|
1415
|
-
|
|
1415
|
+
ce.button,
|
|
1416
1416
|
{
|
|
1417
1417
|
type: "button",
|
|
1418
1418
|
"aria-haspopup": "dialog",
|
|
@@ -1421,7 +1421,7 @@ var Ci = "DialogTrigger", Ei = h.forwardRef(
|
|
|
1421
1421
|
"data-state": fn(r.open),
|
|
1422
1422
|
...i,
|
|
1423
1423
|
ref: o,
|
|
1424
|
-
onClick:
|
|
1424
|
+
onClick: fe(t.onClick, r.onOpenToggle)
|
|
1425
1425
|
}
|
|
1426
1426
|
);
|
|
1427
1427
|
}
|
|
@@ -1430,25 +1430,25 @@ Ei.displayName = Ci;
|
|
|
1430
1430
|
var dn = "DialogPortal", [hs, Ii] = xi(dn, {
|
|
1431
1431
|
forceMount: void 0
|
|
1432
1432
|
}), Si = (t) => {
|
|
1433
|
-
const { __scopeDialog: n, forceMount: e, children: i, container: r } = t, o =
|
|
1433
|
+
const { __scopeDialog: n, forceMount: e, children: i, container: r } = t, o = te(dn, n);
|
|
1434
1434
|
return /* @__PURE__ */ l(hs, { scope: n, forceMount: e, children: h.Children.map(i, (s) => /* @__PURE__ */ l(xt, { present: e || o.open, children: /* @__PURE__ */ l(di, { asChild: !0, container: r, children: s }) })) });
|
|
1435
1435
|
};
|
|
1436
1436
|
Si.displayName = dn;
|
|
1437
1437
|
var mt = "DialogOverlay", Ni = h.forwardRef(
|
|
1438
1438
|
(t, n) => {
|
|
1439
|
-
const e = Ii(mt, t.__scopeDialog), { forceMount: i = e.forceMount, ...r } = t, o =
|
|
1439
|
+
const e = Ii(mt, t.__scopeDialog), { forceMount: i = e.forceMount, ...r } = t, o = te(mt, t.__scopeDialog);
|
|
1440
1440
|
return o.modal ? /* @__PURE__ */ l(xt, { present: i || o.open, children: /* @__PURE__ */ l(ps, { ...r, ref: n }) }) : null;
|
|
1441
1441
|
}
|
|
1442
1442
|
);
|
|
1443
1443
|
Ni.displayName = mt;
|
|
1444
1444
|
var ps = h.forwardRef(
|
|
1445
1445
|
(t, n) => {
|
|
1446
|
-
const { __scopeDialog: e, ...i } = t, r =
|
|
1446
|
+
const { __scopeDialog: e, ...i } = t, r = te(mt, e);
|
|
1447
1447
|
return (
|
|
1448
1448
|
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
1449
1449
|
// ie. when `Overlay` and `Content` are siblings
|
|
1450
1450
|
/* @__PURE__ */ l(yi, { as: an, allowPinchZoom: !0, shards: [r.contentRef], children: /* @__PURE__ */ l(
|
|
1451
|
-
|
|
1451
|
+
ce.div,
|
|
1452
1452
|
{
|
|
1453
1453
|
"data-state": fn(r.open),
|
|
1454
1454
|
...i,
|
|
@@ -1458,35 +1458,35 @@ var ps = h.forwardRef(
|
|
|
1458
1458
|
) })
|
|
1459
1459
|
);
|
|
1460
1460
|
}
|
|
1461
|
-
), ye = "DialogContent",
|
|
1461
|
+
), ye = "DialogContent", Ti = h.forwardRef(
|
|
1462
1462
|
(t, n) => {
|
|
1463
|
-
const e = Ii(ye, t.__scopeDialog), { forceMount: i = e.forceMount, ...r } = t, o =
|
|
1463
|
+
const e = Ii(ye, t.__scopeDialog), { forceMount: i = e.forceMount, ...r } = t, o = te(ye, t.__scopeDialog);
|
|
1464
1464
|
return /* @__PURE__ */ l(xt, { present: i || o.open, children: o.modal ? /* @__PURE__ */ l(gs, { ...r, ref: n }) : /* @__PURE__ */ l(vs, { ...r, ref: n }) });
|
|
1465
1465
|
}
|
|
1466
1466
|
);
|
|
1467
|
-
|
|
1467
|
+
Ti.displayName = ye;
|
|
1468
1468
|
var gs = h.forwardRef(
|
|
1469
1469
|
(t, n) => {
|
|
1470
|
-
const e =
|
|
1470
|
+
const e = te(ye, t.__scopeDialog), i = h.useRef(null), r = we(n, e.contentRef, i);
|
|
1471
1471
|
return h.useEffect(() => {
|
|
1472
1472
|
const o = i.current;
|
|
1473
1473
|
if (o) return fs(o);
|
|
1474
1474
|
}, []), /* @__PURE__ */ l(
|
|
1475
|
-
|
|
1475
|
+
Ri,
|
|
1476
1476
|
{
|
|
1477
1477
|
...t,
|
|
1478
1478
|
ref: r,
|
|
1479
1479
|
trapFocus: e.open,
|
|
1480
1480
|
disableOutsidePointerEvents: !0,
|
|
1481
|
-
onCloseAutoFocus:
|
|
1481
|
+
onCloseAutoFocus: fe(t.onCloseAutoFocus, (o) => {
|
|
1482
1482
|
var s;
|
|
1483
1483
|
o.preventDefault(), (s = e.triggerRef.current) == null || s.focus();
|
|
1484
1484
|
}),
|
|
1485
|
-
onPointerDownOutside:
|
|
1485
|
+
onPointerDownOutside: fe(t.onPointerDownOutside, (o) => {
|
|
1486
1486
|
const s = o.detail.originalEvent, a = s.button === 0 && s.ctrlKey === !0;
|
|
1487
1487
|
(s.button === 2 || a) && o.preventDefault();
|
|
1488
1488
|
}),
|
|
1489
|
-
onFocusOutside:
|
|
1489
|
+
onFocusOutside: fe(
|
|
1490
1490
|
t.onFocusOutside,
|
|
1491
1491
|
(o) => o.preventDefault()
|
|
1492
1492
|
)
|
|
@@ -1495,9 +1495,9 @@ var gs = h.forwardRef(
|
|
|
1495
1495
|
}
|
|
1496
1496
|
), vs = h.forwardRef(
|
|
1497
1497
|
(t, n) => {
|
|
1498
|
-
const e =
|
|
1498
|
+
const e = te(ye, t.__scopeDialog), i = h.useRef(!1), r = h.useRef(!1);
|
|
1499
1499
|
return /* @__PURE__ */ l(
|
|
1500
|
-
|
|
1500
|
+
Ri,
|
|
1501
1501
|
{
|
|
1502
1502
|
...t,
|
|
1503
1503
|
ref: n,
|
|
@@ -1508,18 +1508,18 @@ var gs = h.forwardRef(
|
|
|
1508
1508
|
(s = t.onCloseAutoFocus) == null || s.call(t, o), o.defaultPrevented || (i.current || (a = e.triggerRef.current) == null || a.focus(), o.preventDefault()), i.current = !1, r.current = !1;
|
|
1509
1509
|
},
|
|
1510
1510
|
onInteractOutside: (o) => {
|
|
1511
|
-
var
|
|
1512
|
-
(
|
|
1511
|
+
var u, f;
|
|
1512
|
+
(u = t.onInteractOutside) == null || u.call(t, o), o.defaultPrevented || (i.current = !0, o.detail.originalEvent.type === "pointerdown" && (r.current = !0));
|
|
1513
1513
|
const s = o.target;
|
|
1514
|
-
((
|
|
1514
|
+
((f = e.triggerRef.current) == null ? void 0 : f.contains(s)) && o.preventDefault(), o.detail.originalEvent.type === "focusin" && r.current && o.preventDefault();
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
1517
|
);
|
|
1518
1518
|
}
|
|
1519
|
-
),
|
|
1519
|
+
), Ri = h.forwardRef(
|
|
1520
1520
|
(t, n) => {
|
|
1521
|
-
const { __scopeDialog: e, trapFocus: i, onOpenAutoFocus: r, onCloseAutoFocus: o, ...s } = t, a =
|
|
1522
|
-
return No(), /* @__PURE__ */
|
|
1521
|
+
const { __scopeDialog: e, trapFocus: i, onOpenAutoFocus: r, onCloseAutoFocus: o, ...s } = t, a = te(ye, e), u = h.useRef(null), f = we(n, u);
|
|
1522
|
+
return No(), /* @__PURE__ */ E(pe, { children: [
|
|
1523
1523
|
/* @__PURE__ */ l(
|
|
1524
1524
|
ai,
|
|
1525
1525
|
{
|
|
@@ -1537,42 +1537,42 @@ var gs = h.forwardRef(
|
|
|
1537
1537
|
"aria-labelledby": a.titleId,
|
|
1538
1538
|
"data-state": fn(a.open),
|
|
1539
1539
|
...s,
|
|
1540
|
-
ref:
|
|
1540
|
+
ref: f,
|
|
1541
1541
|
onDismiss: () => a.onOpenChange(!1)
|
|
1542
1542
|
}
|
|
1543
1543
|
)
|
|
1544
1544
|
}
|
|
1545
1545
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1546
|
+
/* @__PURE__ */ E(pe, { children: [
|
|
1547
1547
|
/* @__PURE__ */ l(xs, { titleId: a.titleId }),
|
|
1548
|
-
/* @__PURE__ */ l(Cs, { contentRef:
|
|
1548
|
+
/* @__PURE__ */ l(Cs, { contentRef: u, descriptionId: a.descriptionId })
|
|
1549
1549
|
] })
|
|
1550
1550
|
] });
|
|
1551
1551
|
}
|
|
1552
1552
|
), un = "DialogTitle", ys = h.forwardRef(
|
|
1553
1553
|
(t, n) => {
|
|
1554
|
-
const { __scopeDialog: e, ...i } = t, r =
|
|
1555
|
-
return /* @__PURE__ */ l(
|
|
1554
|
+
const { __scopeDialog: e, ...i } = t, r = te(un, e);
|
|
1555
|
+
return /* @__PURE__ */ l(ce.h2, { id: r.titleId, ...i, ref: n });
|
|
1556
1556
|
}
|
|
1557
1557
|
);
|
|
1558
1558
|
ys.displayName = un;
|
|
1559
1559
|
var Fi = "DialogDescription", bs = h.forwardRef(
|
|
1560
1560
|
(t, n) => {
|
|
1561
|
-
const { __scopeDialog: e, ...i } = t, r =
|
|
1562
|
-
return /* @__PURE__ */ l(
|
|
1561
|
+
const { __scopeDialog: e, ...i } = t, r = te(Fi, e);
|
|
1562
|
+
return /* @__PURE__ */ l(ce.p, { id: r.descriptionId, ...i, ref: n });
|
|
1563
1563
|
}
|
|
1564
1564
|
);
|
|
1565
1565
|
bs.displayName = Fi;
|
|
1566
1566
|
var Li = "DialogClose", Di = h.forwardRef(
|
|
1567
1567
|
(t, n) => {
|
|
1568
|
-
const { __scopeDialog: e, ...i } = t, r =
|
|
1568
|
+
const { __scopeDialog: e, ...i } = t, r = te(Li, e);
|
|
1569
1569
|
return /* @__PURE__ */ l(
|
|
1570
|
-
|
|
1570
|
+
ce.button,
|
|
1571
1571
|
{
|
|
1572
1572
|
type: "button",
|
|
1573
1573
|
...i,
|
|
1574
1574
|
ref: n,
|
|
1575
|
-
onClick:
|
|
1575
|
+
onClick: fe(t.onClick, () => r.onOpenChange(!1))
|
|
1576
1576
|
}
|
|
1577
1577
|
);
|
|
1578
1578
|
}
|
|
@@ -1601,16 +1601,16 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
1601
1601
|
const r = (o = t.current) == null ? void 0 : o.getAttribute("aria-describedby");
|
|
1602
1602
|
n && r && (document.getElementById(n) || console.warn(i));
|
|
1603
1603
|
}, [i, t, n]), null;
|
|
1604
|
-
}, Oi = wi, Es = Ei, Mi = Si, ki = Ni, zi =
|
|
1605
|
-
const
|
|
1606
|
-
const { file: n, onClose: e } = t, i = Xe(null), r =
|
|
1604
|
+
}, Oi = wi, Es = Ei, Mi = Si, ki = Ni, zi = Ti, _i = Di;
|
|
1605
|
+
const Bi = P((t) => {
|
|
1606
|
+
const { file: n, onClose: e } = t, i = Xe(null), r = R(() => {
|
|
1607
1607
|
var a;
|
|
1608
1608
|
if (!i.current) return;
|
|
1609
1609
|
const s = document.createElement("canvas");
|
|
1610
|
-
s.width = i.current.width, s.height = i.current.height, (a = s.getContext("2d")) == null || a.drawImage(i.current, 0, 0, i.current.width, i.current.height), s.toBlob((
|
|
1611
|
-
|
|
1610
|
+
s.width = i.current.width, s.height = i.current.height, (a = s.getContext("2d")) == null || a.drawImage(i.current, 0, 0, i.current.width, i.current.height), s.toBlob((u) => {
|
|
1611
|
+
u && navigator.clipboard.write([new ClipboardItem({ "image/png": u })]);
|
|
1612
1612
|
}, "image/png");
|
|
1613
|
-
}, []), o =
|
|
1613
|
+
}, []), o = R(() => {
|
|
1614
1614
|
Yn(n, n.name);
|
|
1615
1615
|
}, [n]);
|
|
1616
1616
|
return /* @__PURE__ */ l(Oi, { open: !0, onOpenChange: e, children: /* @__PURE__ */ l(Mi, { children: /* @__PURE__ */ l(
|
|
@@ -1618,25 +1618,25 @@ const $i = P((t) => {
|
|
|
1618
1618
|
{
|
|
1619
1619
|
className: "bg-(--color-background) fixed inset-0 data-[state='open']:fade-in-0 data-[state='open']:zoom-in-95 data-[state='closed']:animate-out data-[state='closed']:fade-out-0 data-[state='closed']:zoom-out-95 data-[state='open']:animate-in",
|
|
1620
1620
|
"data-floating-content": "",
|
|
1621
|
-
children: /* @__PURE__ */
|
|
1621
|
+
children: /* @__PURE__ */ E(
|
|
1622
1622
|
zi,
|
|
1623
1623
|
{
|
|
1624
1624
|
className: "absolute inset-0 py-12",
|
|
1625
1625
|
"data-floating-content": "",
|
|
1626
1626
|
onOpenAutoFocus: (s) => s.preventDefault(),
|
|
1627
1627
|
children: [
|
|
1628
|
-
/* @__PURE__ */
|
|
1628
|
+
/* @__PURE__ */ E(
|
|
1629
1629
|
Xt,
|
|
1630
1630
|
{
|
|
1631
1631
|
className: "flex gap-2 items-center top-0 absolute right-0 p-2",
|
|
1632
1632
|
accentColor: "base",
|
|
1633
1633
|
variant: "ghost",
|
|
1634
1634
|
children: [
|
|
1635
|
-
/* @__PURE__ */
|
|
1635
|
+
/* @__PURE__ */ E(Ee.Root, { children: [
|
|
1636
1636
|
/* @__PURE__ */ l(Ee.Trigger, { asChild: !0, children: /* @__PURE__ */ l(Q, { onClick: r, "aria-label": "copy to clipboard", children: /* @__PURE__ */ l(L, { icon: "RiFileCopyLine" }) }) }),
|
|
1637
1637
|
/* @__PURE__ */ l(Ee.Content, { size: "sm", children: "Copy" })
|
|
1638
1638
|
] }),
|
|
1639
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ E(Ee.Root, { children: [
|
|
1640
1640
|
/* @__PURE__ */ l(Ee.Trigger, { asChild: !0, children: /* @__PURE__ */ l(Q, { onClick: o, "aria-label": "download", children: /* @__PURE__ */ l(L, { icon: "RiDownload2Line" }) }) }),
|
|
1641
1641
|
/* @__PURE__ */ l(Ee.Content, { size: "sm", children: "Download" })
|
|
1642
1642
|
] }),
|
|
@@ -1660,92 +1660,92 @@ const $i = P((t) => {
|
|
|
1660
1660
|
}
|
|
1661
1661
|
) }) });
|
|
1662
1662
|
});
|
|
1663
|
-
|
|
1663
|
+
Bi.displayName = "ImageViewer";
|
|
1664
1664
|
const Is = P((t) => {
|
|
1665
|
-
const { children: n } = t, [e, i] = G(null), r =
|
|
1665
|
+
const { children: n } = t, [e, i] = G(null), r = R(() => {
|
|
1666
1666
|
i(null);
|
|
1667
|
-
}, []), o =
|
|
1668
|
-
(
|
|
1669
|
-
i(
|
|
1667
|
+
}, []), o = R(
|
|
1668
|
+
(u) => {
|
|
1669
|
+
i(u(r));
|
|
1670
1670
|
},
|
|
1671
1671
|
[r]
|
|
1672
|
-
), s =
|
|
1672
|
+
), s = R(() => {
|
|
1673
1673
|
e && (e.onClose && e.onClose(), r());
|
|
1674
1674
|
}, [r, e]), a = O(() => o, [o]);
|
|
1675
|
-
return /* @__PURE__ */
|
|
1675
|
+
return /* @__PURE__ */ E(ii.Provider, { value: a, children: [
|
|
1676
1676
|
n,
|
|
1677
|
-
e && /* @__PURE__ */ l(
|
|
1677
|
+
e && /* @__PURE__ */ l(Bi, { file: e.file, onClose: s })
|
|
1678
1678
|
] });
|
|
1679
1679
|
});
|
|
1680
1680
|
Is.displayName = "FileViewerProvider";
|
|
1681
|
-
const
|
|
1682
|
-
const { className: n, label: e, children: i, severity: r, inputId: o, labelId: s, image: a } = t, [
|
|
1683
|
-
|
|
1684
|
-
a instanceof Promise ? a.then(
|
|
1681
|
+
const ne = (t) => {
|
|
1682
|
+
const { className: n, label: e, children: i, severity: r, inputId: o, labelId: s, image: a } = t, [u, f] = G(void 0), m = ln(), d = r ? ge[r] : "base";
|
|
1683
|
+
H(() => {
|
|
1684
|
+
a instanceof Promise ? a.then(f).catch(console.error) : f(a);
|
|
1685
1685
|
}, [a]);
|
|
1686
|
-
const p =
|
|
1687
|
-
|
|
1688
|
-
file:
|
|
1686
|
+
const p = u ? URL.createObjectURL(u) : void 0, b = R(() => {
|
|
1687
|
+
u && m(() => ({
|
|
1688
|
+
file: u
|
|
1689
1689
|
}));
|
|
1690
|
-
}, [
|
|
1691
|
-
return /* @__PURE__ */
|
|
1692
|
-
|
|
1690
|
+
}, [m, u]);
|
|
1691
|
+
return /* @__PURE__ */ E("div", { className: "flex flex-col gap-1", children: [
|
|
1692
|
+
u && /* @__PURE__ */ l(
|
|
1693
1693
|
"img",
|
|
1694
1694
|
{
|
|
1695
1695
|
className: "h-[100px] w-full min-w-[300px] cursor-pointer rounded-md object-cover",
|
|
1696
1696
|
src: p,
|
|
1697
|
-
alt:
|
|
1697
|
+
alt: u.name,
|
|
1698
1698
|
onClick: b
|
|
1699
1699
|
}
|
|
1700
1700
|
),
|
|
1701
|
-
/* @__PURE__ */ l("label", { className: je(n, "flex flex-col gap-1 w-max max-w-full"), htmlFor: o, children: /* @__PURE__ */ l(
|
|
1701
|
+
/* @__PURE__ */ l("label", { className: je(n, "flex flex-col gap-1 w-max max-w-full"), htmlFor: o, children: /* @__PURE__ */ l(ae, { accentColor: d, size: "sm", id: s, weight: "medium", className: "text-wrap", children: e }) }),
|
|
1702
1702
|
i
|
|
1703
1703
|
] });
|
|
1704
|
-
},
|
|
1704
|
+
}, ie = (t) => {
|
|
1705
1705
|
const { children: n, ...e } = t;
|
|
1706
1706
|
return /* @__PURE__ */ l(ni, { ...e, children: n });
|
|
1707
1707
|
}, Vi = P((t) => {
|
|
1708
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
1709
|
-
(
|
|
1710
|
-
y(
|
|
1708
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = J(t), d = o ? null : a, p = o ? "" : u, { name: b, onChange: y, onBlur: c } = f, v = `${n}-droppable`, { disabled: w } = m, C = f.value ?? rn, [g, S] = G(""), [x, F] = G(""), N = x || d, T = R(
|
|
1709
|
+
(z) => {
|
|
1710
|
+
y(z), c(z);
|
|
1711
1711
|
},
|
|
1712
1712
|
[y, c]
|
|
1713
|
-
),
|
|
1714
|
-
(
|
|
1715
|
-
|
|
1713
|
+
), D = R(
|
|
1714
|
+
(z) => {
|
|
1715
|
+
C && C.findIndex((Y) => Y === z.target.value.trim()) >= 0 ? F("All options must be unique") : z.target.value ? F("") : F("Option cannot be empty"), S(z.target.value);
|
|
1716
1716
|
},
|
|
1717
|
-
[S,
|
|
1718
|
-
),
|
|
1719
|
-
if (
|
|
1717
|
+
[S, C]
|
|
1718
|
+
), M = R(() => {
|
|
1719
|
+
if (x) return;
|
|
1720
1720
|
if (!g.trim()) {
|
|
1721
1721
|
F("Option cannot be empty");
|
|
1722
1722
|
return;
|
|
1723
1723
|
}
|
|
1724
|
-
const
|
|
1725
|
-
|
|
1726
|
-
}, [g,
|
|
1727
|
-
(
|
|
1728
|
-
|
|
1724
|
+
const z = g.trim();
|
|
1725
|
+
T([...C, z]), S("");
|
|
1726
|
+
}, [g, x, T, C]), k = R(
|
|
1727
|
+
(z) => {
|
|
1728
|
+
z.key === "Enter" && (z.preventDefault(), M());
|
|
1729
1729
|
},
|
|
1730
|
-
[
|
|
1731
|
-
),
|
|
1732
|
-
(
|
|
1733
|
-
|
|
1730
|
+
[M]
|
|
1731
|
+
), V = R(
|
|
1732
|
+
(z) => {
|
|
1733
|
+
T(dt(C, z));
|
|
1734
1734
|
},
|
|
1735
|
-
[
|
|
1736
|
-
), X =
|
|
1737
|
-
(
|
|
1738
|
-
if (!
|
|
1739
|
-
const Y =
|
|
1740
|
-
|
|
1735
|
+
[C, T]
|
|
1736
|
+
), X = R(
|
|
1737
|
+
(z) => {
|
|
1738
|
+
if (!z.destination) return;
|
|
1739
|
+
const Y = z.source.index, Ce = z.destination.index;
|
|
1740
|
+
T(Mt(C, Y, Ce));
|
|
1741
1741
|
},
|
|
1742
|
-
[
|
|
1743
|
-
),
|
|
1744
|
-
c(
|
|
1745
|
-
}, [c,
|
|
1746
|
-
return /* @__PURE__ */ l(Xn, { onDragEnd: X, children: /* @__PURE__ */
|
|
1747
|
-
/* @__PURE__ */ l(
|
|
1748
|
-
|
|
1742
|
+
[T, C]
|
|
1743
|
+
), le = R(() => {
|
|
1744
|
+
c(C);
|
|
1745
|
+
}, [c, C]);
|
|
1746
|
+
return /* @__PURE__ */ l(Xn, { onDragEnd: X, children: /* @__PURE__ */ E("div", { className: "flex flex-col gap-2", children: [
|
|
1747
|
+
/* @__PURE__ */ l(ie, { helpText: N, severity: r, children: /* @__PURE__ */ l(
|
|
1748
|
+
ne,
|
|
1749
1749
|
{
|
|
1750
1750
|
size: i,
|
|
1751
1751
|
severity: r,
|
|
@@ -1753,18 +1753,18 @@ const te = (t) => {
|
|
|
1753
1753
|
labelId: e,
|
|
1754
1754
|
label: p,
|
|
1755
1755
|
image: o ? void 0 : s.image,
|
|
1756
|
-
children: (!w ||
|
|
1757
|
-
/* @__PURE__ */ l(
|
|
1758
|
-
|
|
1756
|
+
children: (!w || C.length === 0) && /* @__PURE__ */ E("div", { className: "flex gap-2", children: [
|
|
1757
|
+
/* @__PURE__ */ l(ee.Root, { className: "grow", accentColor: "base", variant: "surface", size: "sm", children: /* @__PURE__ */ l(
|
|
1758
|
+
ee.Field,
|
|
1759
1759
|
{
|
|
1760
1760
|
value: g,
|
|
1761
|
-
onChange:
|
|
1762
|
-
onKeyDown:
|
|
1761
|
+
onChange: D,
|
|
1762
|
+
onKeyDown: k,
|
|
1763
1763
|
id: n,
|
|
1764
1764
|
placeholder: s.placeholder,
|
|
1765
|
-
onBlur:
|
|
1765
|
+
onBlur: le,
|
|
1766
1766
|
name: b,
|
|
1767
|
-
...
|
|
1767
|
+
...m
|
|
1768
1768
|
}
|
|
1769
1769
|
) }),
|
|
1770
1770
|
/* @__PURE__ */ l(
|
|
@@ -1775,32 +1775,32 @@ const te = (t) => {
|
|
|
1775
1775
|
variant: "soft",
|
|
1776
1776
|
type: "button",
|
|
1777
1777
|
"aria-label": "Add option",
|
|
1778
|
-
disabled: !!
|
|
1779
|
-
onClick:
|
|
1778
|
+
disabled: !!x || w,
|
|
1779
|
+
onClick: M,
|
|
1780
1780
|
children: /* @__PURE__ */ l(L, { icon: "RiAddLine" })
|
|
1781
1781
|
}
|
|
1782
1782
|
)
|
|
1783
1783
|
] })
|
|
1784
1784
|
}
|
|
1785
1785
|
) }),
|
|
1786
|
-
/* @__PURE__ */ l(en, { droppableId: v, children: (
|
|
1786
|
+
/* @__PURE__ */ l(en, { droppableId: v, children: (z) => /* @__PURE__ */ E(
|
|
1787
1787
|
"div",
|
|
1788
1788
|
{
|
|
1789
1789
|
className: "flex flex-col",
|
|
1790
|
-
...
|
|
1791
|
-
ref:
|
|
1790
|
+
...z.droppableProps,
|
|
1791
|
+
ref: z.innerRef,
|
|
1792
1792
|
children: [
|
|
1793
|
-
|
|
1793
|
+
C.map((Y, Ce) => /* @__PURE__ */ l(
|
|
1794
1794
|
tn,
|
|
1795
1795
|
{
|
|
1796
1796
|
draggableId: `${Y}-draggable`,
|
|
1797
1797
|
index: Ce,
|
|
1798
1798
|
isDragDisabled: w,
|
|
1799
|
-
children: ({ draggableProps:
|
|
1799
|
+
children: ({ draggableProps: de, dragHandleProps: Et, innerRef: Ye }) => /* @__PURE__ */ E(
|
|
1800
1800
|
Ot,
|
|
1801
1801
|
{
|
|
1802
1802
|
...Et,
|
|
1803
|
-
...
|
|
1803
|
+
...de,
|
|
1804
1804
|
ref: Ye,
|
|
1805
1805
|
className: "mb-1 flex items-center justify-between gap-2",
|
|
1806
1806
|
accentColor: "base",
|
|
@@ -1822,7 +1822,7 @@ const te = (t) => {
|
|
|
1822
1822
|
accentColor: "base",
|
|
1823
1823
|
disabled: w,
|
|
1824
1824
|
onClick: () => {
|
|
1825
|
-
|
|
1825
|
+
V(Ce);
|
|
1826
1826
|
},
|
|
1827
1827
|
children: /* @__PURE__ */ l(L, { icon: "RiCloseLargeLine" })
|
|
1828
1828
|
}
|
|
@@ -1833,7 +1833,7 @@ const te = (t) => {
|
|
|
1833
1833
|
},
|
|
1834
1834
|
Y
|
|
1835
1835
|
)),
|
|
1836
|
-
|
|
1836
|
+
z.placeholder
|
|
1837
1837
|
]
|
|
1838
1838
|
}
|
|
1839
1839
|
) })
|
|
@@ -1845,7 +1845,7 @@ const Ss = {
|
|
|
1845
1845
|
type: "multi-string",
|
|
1846
1846
|
minimum_length: 0,
|
|
1847
1847
|
maximum_length: null
|
|
1848
|
-
},
|
|
1848
|
+
}, Re = class Re extends W {
|
|
1849
1849
|
constructor(e) {
|
|
1850
1850
|
const { minimum_length: i, maximum_length: r, placeholder: o, ...s } = e;
|
|
1851
1851
|
super({ ...s, type: "multi-string" });
|
|
@@ -1884,12 +1884,12 @@ const Ss = {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
static deserialize(e) {
|
|
1886
1886
|
if (e.type !== "multi-string") throw new Error("Type mismatch.");
|
|
1887
|
-
return new
|
|
1887
|
+
return new Re(e);
|
|
1888
1888
|
}
|
|
1889
1889
|
};
|
|
1890
|
-
I(
|
|
1891
|
-
let
|
|
1892
|
-
class
|
|
1890
|
+
I(Re, "fieldTypeName", "Multi-string"), I(Re, "fieldTypeDescription", "Allows the user to provide multiple unique strings."), I(Re, "Icon", vr);
|
|
1891
|
+
let qe = Re;
|
|
1892
|
+
class $i extends W {
|
|
1893
1893
|
constructor(e) {
|
|
1894
1894
|
const { placeholder: i = "", ...r } = e;
|
|
1895
1895
|
super(r);
|
|
@@ -1914,7 +1914,7 @@ class Bi extends U {
|
|
|
1914
1914
|
const i = e && `${e}.`;
|
|
1915
1915
|
return [
|
|
1916
1916
|
{
|
|
1917
|
-
field: new
|
|
1917
|
+
field: new qe({
|
|
1918
1918
|
label: "Options",
|
|
1919
1919
|
description: "List possible options for the user to select from.",
|
|
1920
1920
|
required: !0,
|
|
@@ -1927,16 +1927,16 @@ class Bi extends U {
|
|
|
1927
1927
|
}
|
|
1928
1928
|
}
|
|
1929
1929
|
const Ui = P((t) => {
|
|
1930
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
1930
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = J(t), { name: d, onBlur: p, onChange: b, value: y } = f, c = o ? null : a, v = o ? "" : u, w = R(
|
|
1931
1931
|
(g) => {
|
|
1932
1932
|
b(!!g), p(!!g);
|
|
1933
1933
|
},
|
|
1934
1934
|
[p, b]
|
|
1935
|
-
),
|
|
1935
|
+
), C = R(() => {
|
|
1936
1936
|
p(y);
|
|
1937
1937
|
}, [p, y]);
|
|
1938
|
-
return /* @__PURE__ */ l(
|
|
1939
|
-
|
|
1938
|
+
return /* @__PURE__ */ l(ie, { helpText: c, severity: r, children: /* @__PURE__ */ l(
|
|
1939
|
+
ne,
|
|
1940
1940
|
{
|
|
1941
1941
|
size: i,
|
|
1942
1942
|
severity: r,
|
|
@@ -1949,14 +1949,14 @@ const Ui = P((t) => {
|
|
|
1949
1949
|
at.Root,
|
|
1950
1950
|
{
|
|
1951
1951
|
id: n,
|
|
1952
|
-
name:
|
|
1952
|
+
name: d,
|
|
1953
1953
|
checked: y ?? !1,
|
|
1954
1954
|
onCheckedChange: w,
|
|
1955
|
-
onBlur:
|
|
1955
|
+
onBlur: C,
|
|
1956
1956
|
size: "sm",
|
|
1957
1957
|
accentColor: "primary",
|
|
1958
1958
|
variant: "surface",
|
|
1959
|
-
...
|
|
1959
|
+
...m,
|
|
1960
1960
|
children: /* @__PURE__ */ l(at.Indicator, { children: /* @__PURE__ */ l(L, { icon: "RiCheckLine" }) })
|
|
1961
1961
|
}
|
|
1962
1962
|
)
|
|
@@ -1967,7 +1967,7 @@ Ui.displayName = "BooleanInput";
|
|
|
1967
1967
|
const Ns = {
|
|
1968
1968
|
...Z,
|
|
1969
1969
|
type: "boolean"
|
|
1970
|
-
}, Fe = class Fe extends
|
|
1970
|
+
}, Fe = class Fe extends W {
|
|
1971
1971
|
constructor(e) {
|
|
1972
1972
|
super({ ...e, type: "boolean" });
|
|
1973
1973
|
I(this, "onlyValidateAfterTouched", !1);
|
|
@@ -1988,12 +1988,12 @@ const Ns = {
|
|
|
1988
1988
|
}
|
|
1989
1989
|
};
|
|
1990
1990
|
I(Fe, "fieldTypeName", "Checkbox"), I(Fe, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), I(Fe, "Icon", yr);
|
|
1991
|
-
let
|
|
1992
|
-
const
|
|
1991
|
+
let He = Fe;
|
|
1992
|
+
const Ts = {
|
|
1993
1993
|
...Z,
|
|
1994
1994
|
type: "custom"
|
|
1995
1995
|
};
|
|
1996
|
-
class ht extends
|
|
1996
|
+
class ht extends W {
|
|
1997
1997
|
constructor(e, i) {
|
|
1998
1998
|
super({ ...e, type: "custom" });
|
|
1999
1999
|
I(this, "Component");
|
|
@@ -2011,19 +2011,19 @@ class ht extends U {
|
|
|
2011
2011
|
}
|
|
2012
2012
|
I(ht, "fieldTypeName", "Custom"), I(ht, "fieldTypeDescription", "Allows re-rendering of field already in the form");
|
|
2013
2013
|
const Wi = P((t) => {
|
|
2014
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2015
|
-
(
|
|
2016
|
-
p(
|
|
2014
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = J(t), { name: d, onChange: p, onBlur: b } = f, [y, c] = G(!1), v = o ? null : a, w = o ? "" : u, C = f.value ? new Date(f.value) : void 0, g = R(
|
|
2015
|
+
(x) => {
|
|
2016
|
+
p(x == null ? void 0 : x.toISOString()), c(!1);
|
|
2017
2017
|
},
|
|
2018
2018
|
[p]
|
|
2019
|
-
), S =
|
|
2020
|
-
(
|
|
2021
|
-
c(
|
|
2019
|
+
), S = R(
|
|
2020
|
+
(x) => {
|
|
2021
|
+
c(x), x || b(f.value);
|
|
2022
2022
|
},
|
|
2023
|
-
[
|
|
2023
|
+
[f.value, b]
|
|
2024
2024
|
);
|
|
2025
|
-
return /* @__PURE__ */ l(
|
|
2026
|
-
|
|
2025
|
+
return /* @__PURE__ */ l(ie, { helpText: v, severity: r, children: /* @__PURE__ */ l(
|
|
2026
|
+
ne,
|
|
2027
2027
|
{
|
|
2028
2028
|
size: i,
|
|
2029
2029
|
severity: r,
|
|
@@ -2031,20 +2031,20 @@ const Wi = P((t) => {
|
|
|
2031
2031
|
labelId: e,
|
|
2032
2032
|
label: w,
|
|
2033
2033
|
image: o ? void 0 : s.image,
|
|
2034
|
-
children: /* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */ l(
|
|
2036
|
-
|
|
2034
|
+
children: /* @__PURE__ */ E(Be.Root, { open: y, onOpenChange: S, children: [
|
|
2035
|
+
/* @__PURE__ */ l(Be.Trigger, { asChild: !0, children: /* @__PURE__ */ E(
|
|
2036
|
+
K,
|
|
2037
2037
|
{
|
|
2038
2038
|
id: n,
|
|
2039
|
-
name:
|
|
2039
|
+
name: d,
|
|
2040
2040
|
type: "button",
|
|
2041
2041
|
className: "!justify-between",
|
|
2042
2042
|
accentColor: "base",
|
|
2043
2043
|
variant: "surface",
|
|
2044
2044
|
size: "sm",
|
|
2045
|
-
...
|
|
2045
|
+
...m,
|
|
2046
2046
|
children: [
|
|
2047
|
-
|
|
2047
|
+
C ? C.toLocaleString(void 0, {
|
|
2048
2048
|
year: "numeric",
|
|
2049
2049
|
month: "2-digit",
|
|
2050
2050
|
day: "2-digit"
|
|
@@ -2053,13 +2053,13 @@ const Wi = P((t) => {
|
|
|
2053
2053
|
]
|
|
2054
2054
|
}
|
|
2055
2055
|
) }),
|
|
2056
|
-
/* @__PURE__ */ l(
|
|
2056
|
+
/* @__PURE__ */ l(Be.Content, { align: "start", children: /* @__PURE__ */ l(
|
|
2057
2057
|
fr,
|
|
2058
2058
|
{
|
|
2059
2059
|
required: !1,
|
|
2060
2060
|
mode: "single",
|
|
2061
2061
|
variant: "solid",
|
|
2062
|
-
selected:
|
|
2062
|
+
selected: C,
|
|
2063
2063
|
onSelect: g
|
|
2064
2064
|
}
|
|
2065
2065
|
) })
|
|
@@ -2068,10 +2068,10 @@ const Wi = P((t) => {
|
|
|
2068
2068
|
) });
|
|
2069
2069
|
});
|
|
2070
2070
|
Wi.displayName = "DateInput";
|
|
2071
|
-
const
|
|
2071
|
+
const Rs = {
|
|
2072
2072
|
...Z,
|
|
2073
2073
|
type: "date"
|
|
2074
|
-
}, Le = class Le extends
|
|
2074
|
+
}, Le = class Le extends W {
|
|
2075
2075
|
constructor(e) {
|
|
2076
2076
|
super({ ...e, type: "date" });
|
|
2077
2077
|
I(this, "onlyValidateAfterTouched", !1);
|
|
@@ -2088,22 +2088,22 @@ const Ts = {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
};
|
|
2090
2090
|
I(Le, "fieldTypeName", "Date"), I(Le, "fieldTypeDescription", "Allows specifying a date."), I(Le, "Icon", br);
|
|
2091
|
-
let
|
|
2091
|
+
let Bt = Le;
|
|
2092
2092
|
const ji = P((t) => {
|
|
2093
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2093
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = J(t), { name: d, onChange: p, onBlur: b } = f, y = o ? null : a, c = o ? "" : u, v = f.value ?? rn, w = R(
|
|
2094
2094
|
(g) => {
|
|
2095
2095
|
const S = g.length > 0 ? g : void 0;
|
|
2096
2096
|
p(S), b(S);
|
|
2097
2097
|
},
|
|
2098
2098
|
[b, p]
|
|
2099
|
-
),
|
|
2099
|
+
), C = R(
|
|
2100
2100
|
(g) => {
|
|
2101
2101
|
g || b(v);
|
|
2102
2102
|
},
|
|
2103
2103
|
[v, b]
|
|
2104
2104
|
);
|
|
2105
|
-
return /* @__PURE__ */ l(
|
|
2106
|
-
|
|
2105
|
+
return /* @__PURE__ */ l(ie, { helpText: y, severity: r, children: /* @__PURE__ */ l(
|
|
2106
|
+
ne,
|
|
2107
2107
|
{
|
|
2108
2108
|
size: i,
|
|
2109
2109
|
severity: r,
|
|
@@ -2111,31 +2111,31 @@ const ji = P((t) => {
|
|
|
2111
2111
|
labelId: e,
|
|
2112
2112
|
label: c,
|
|
2113
2113
|
image: o ? void 0 : s.image,
|
|
2114
|
-
children: /* @__PURE__ */
|
|
2115
|
-
/* @__PURE__ */ l(
|
|
2116
|
-
|
|
2114
|
+
children: /* @__PURE__ */ E(B.Root, { onOpenChange: C, align: "start", children: [
|
|
2115
|
+
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(
|
|
2116
|
+
K,
|
|
2117
2117
|
{
|
|
2118
2118
|
id: n,
|
|
2119
|
-
name:
|
|
2119
|
+
name: d,
|
|
2120
2120
|
className: "!justify-between",
|
|
2121
2121
|
variant: "surface",
|
|
2122
2122
|
type: "button",
|
|
2123
2123
|
size: "sm",
|
|
2124
2124
|
accentColor: "base",
|
|
2125
|
-
...
|
|
2125
|
+
...m,
|
|
2126
2126
|
children: [
|
|
2127
2127
|
/* @__PURE__ */ l("span", { className: "truncate", children: v && v.length > 0 ? v.join(", ") : s.placeholder }),
|
|
2128
2128
|
/* @__PURE__ */ l(L, { icon: "RiArrowDownSLine" })
|
|
2129
2129
|
]
|
|
2130
2130
|
}
|
|
2131
2131
|
) }),
|
|
2132
|
-
/* @__PURE__ */ l(
|
|
2133
|
-
/* @__PURE__ */
|
|
2134
|
-
/* @__PURE__ */ l(
|
|
2132
|
+
/* @__PURE__ */ l(B.Content, { children: /* @__PURE__ */ l(B.Scroll, { children: /* @__PURE__ */ E(B.MultiSelectGroup, { values: v, onValuesChange: w, children: [
|
|
2133
|
+
/* @__PURE__ */ E(B.SelectAllItem, { children: [
|
|
2134
|
+
/* @__PURE__ */ l(B.CheckboxItemIndicator, { children: (g) => g ? /* @__PURE__ */ l(L, { icon: "RiSubtractLine" }) : /* @__PURE__ */ l(L, { icon: "RiCheckLine" }) }),
|
|
2135
2135
|
"Select all"
|
|
2136
2136
|
] }),
|
|
2137
|
-
s.options.map((g) => /* @__PURE__ */
|
|
2138
|
-
/* @__PURE__ */ l(
|
|
2137
|
+
s.options.map((g) => /* @__PURE__ */ E(B.MultiSelectItem, { value: g.value, children: [
|
|
2138
|
+
/* @__PURE__ */ l(B.SelectedIndicator, { children: /* @__PURE__ */ l(L, { icon: "RiCheckLine" }) }),
|
|
2139
2139
|
g.label
|
|
2140
2140
|
] }, g.value))
|
|
2141
2141
|
] }) }) })
|
|
@@ -2148,7 +2148,7 @@ const Fs = {
|
|
|
2148
2148
|
...Z,
|
|
2149
2149
|
type: "multi-select",
|
|
2150
2150
|
options: []
|
|
2151
|
-
}, De = class De extends
|
|
2151
|
+
}, De = class De extends $i {
|
|
2152
2152
|
constructor(n) {
|
|
2153
2153
|
const { placeholder: e = "Select one or more...", ...i } = n;
|
|
2154
2154
|
super({ ...i, placeholder: e, type: "multi-select" });
|
|
@@ -2174,36 +2174,36 @@ I(De, "fieldTypeName", "Multi-select"), I(De, "fieldTypeDescription", "Allows th
|
|
|
2174
2174
|
let pt = De;
|
|
2175
2175
|
const qi = P((t) => {
|
|
2176
2176
|
const [
|
|
2177
|
-
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2177
|
+
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f, touched: m, helpers: d },
|
|
2178
2178
|
p
|
|
2179
|
-
] = J(t), { name: b, onBlur: y, onChange: c, value: v } =
|
|
2180
|
-
|
|
2179
|
+
] = J(t), { name: b, onBlur: y, onChange: c, value: v } = f, w = o ? null : a, C = o ? "" : u, [g, S] = G(void 0);
|
|
2180
|
+
H(() => {
|
|
2181
2181
|
S(v);
|
|
2182
2182
|
}, [v]);
|
|
2183
|
-
const
|
|
2183
|
+
const x = R(
|
|
2184
2184
|
(N) => {
|
|
2185
|
-
const
|
|
2186
|
-
S(
|
|
2185
|
+
const T = N.target.valueAsNumber, D = Number.isNaN(T) ? void 0 : T;
|
|
2186
|
+
S(D), (m || !s.onlyValidateAfterTouched) && d.setError(s.getError(D));
|
|
2187
2187
|
},
|
|
2188
|
-
[s,
|
|
2189
|
-
), F =
|
|
2188
|
+
[s, d, m]
|
|
2189
|
+
), F = R(() => {
|
|
2190
2190
|
c(g), y(g);
|
|
2191
2191
|
}, [g, y, c]);
|
|
2192
|
-
return /* @__PURE__ */ l(
|
|
2193
|
-
|
|
2192
|
+
return /* @__PURE__ */ l(ie, { helpText: w, severity: r, children: /* @__PURE__ */ l(
|
|
2193
|
+
ne,
|
|
2194
2194
|
{
|
|
2195
2195
|
size: i,
|
|
2196
2196
|
severity: r,
|
|
2197
2197
|
inputId: n,
|
|
2198
2198
|
labelId: e,
|
|
2199
|
-
label:
|
|
2199
|
+
label: C,
|
|
2200
2200
|
image: o ? void 0 : s.image,
|
|
2201
|
-
children: /* @__PURE__ */ l(
|
|
2202
|
-
|
|
2201
|
+
children: /* @__PURE__ */ l(ee.Root, { accentColor: "base", variant: "surface", size: "sm", children: /* @__PURE__ */ l(
|
|
2202
|
+
ee.Field,
|
|
2203
2203
|
{
|
|
2204
2204
|
id: n,
|
|
2205
2205
|
name: b,
|
|
2206
|
-
onChange:
|
|
2206
|
+
onChange: x,
|
|
2207
2207
|
onBlur: F,
|
|
2208
2208
|
value: g ?? "",
|
|
2209
2209
|
type: "number",
|
|
@@ -2224,7 +2224,7 @@ const Ls = {
|
|
|
2224
2224
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2225
2225
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2226
2226
|
integers: !1
|
|
2227
|
-
}, _n = (t) => "fields" in t,
|
|
2227
|
+
}, _n = (t) => "fields" in t, re = class re extends W {
|
|
2228
2228
|
constructor(e) {
|
|
2229
2229
|
const {
|
|
2230
2230
|
minimum: i = Number.MIN_SAFE_INTEGER,
|
|
@@ -2244,7 +2244,7 @@ const Ls = {
|
|
|
2244
2244
|
const i = e && `${e}.`;
|
|
2245
2245
|
return [
|
|
2246
2246
|
{
|
|
2247
|
-
field: new
|
|
2247
|
+
field: new re({
|
|
2248
2248
|
label: "Minimum",
|
|
2249
2249
|
description: "Minimum value",
|
|
2250
2250
|
integers: !0,
|
|
@@ -2255,7 +2255,7 @@ const Ls = {
|
|
|
2255
2255
|
showDirectly: !1
|
|
2256
2256
|
},
|
|
2257
2257
|
{
|
|
2258
|
-
field: new
|
|
2258
|
+
field: new re({
|
|
2259
2259
|
label: "Maximum",
|
|
2260
2260
|
description: "Maximum value",
|
|
2261
2261
|
integers: !0,
|
|
@@ -2266,7 +2266,7 @@ const Ls = {
|
|
|
2266
2266
|
showDirectly: !1
|
|
2267
2267
|
},
|
|
2268
2268
|
{
|
|
2269
|
-
field: new
|
|
2269
|
+
field: new He({
|
|
2270
2270
|
label: "Integers",
|
|
2271
2271
|
description: "Whole numbers only",
|
|
2272
2272
|
required: !1,
|
|
@@ -2300,92 +2300,104 @@ const Ls = {
|
|
|
2300
2300
|
}
|
|
2301
2301
|
static deserialize(e) {
|
|
2302
2302
|
if (e.type !== "number") throw new Error("Type mismatch.");
|
|
2303
|
-
return new
|
|
2303
|
+
return new re(e);
|
|
2304
2304
|
}
|
|
2305
2305
|
getInput(e) {
|
|
2306
2306
|
return /* @__PURE__ */ l(qi, { field: this, ...e });
|
|
2307
2307
|
}
|
|
2308
2308
|
};
|
|
2309
|
-
I(
|
|
2310
|
-
const o = _n(r) ?
|
|
2309
|
+
I(re, "fieldTypeName", "Number"), I(re, "fieldTypeDescription", "Allows specifying a number within a given range."), I(re, "Icon", wr), I(re, "_validateMin", (e) => (i, r) => {
|
|
2310
|
+
const o = _n(r) ? se(r, e) : r;
|
|
2311
2311
|
return typeof o.maximum == "number" && typeof i == "number" && o.maximum < i ? "Minimum cannot be greater than minimum." : null;
|
|
2312
|
-
}), I(
|
|
2313
|
-
const o = _n(r) ?
|
|
2312
|
+
}), I(re, "_validateMax", (e) => (i, r) => {
|
|
2313
|
+
const o = _n(r) ? se(r, e) : r;
|
|
2314
2314
|
return typeof o.minimum == "number" && typeof i == "number" && o.minimum > i ? "Maximum cannot be less than minimum." : null;
|
|
2315
2315
|
});
|
|
2316
|
-
let be =
|
|
2316
|
+
let be = re;
|
|
2317
2317
|
const Hi = P((t) => {
|
|
2318
|
-
const [
|
|
2319
|
-
|
|
2320
|
-
|
|
2318
|
+
const [
|
|
2319
|
+
{ inputId: n, labelId: e, label: i, helpText: r, size: o, severity: s, showInputOnly: a, field: u, fieldProps: f, helpers: m, touched: d },
|
|
2320
|
+
p
|
|
2321
|
+
] = J(t), { name: b, onBlur: y, onChange: c, value: v } = f, [w, C] = G(!1), g = a ? null : r, S = a ? "" : i, [x, F] = G(void 0);
|
|
2322
|
+
H(() => {
|
|
2323
|
+
F(v);
|
|
2324
|
+
}, [v]);
|
|
2325
|
+
const N = R(
|
|
2326
|
+
(V) => {
|
|
2327
|
+
F(V.target.value || void 0), (d || !u.onlyValidateAfterTouched) && m.setError(u.getError(V.target.value));
|
|
2321
2328
|
},
|
|
2322
|
-
[
|
|
2323
|
-
),
|
|
2324
|
-
|
|
2325
|
-
}, [
|
|
2326
|
-
(
|
|
2327
|
-
|
|
2329
|
+
[u, m, d]
|
|
2330
|
+
), T = R(() => {
|
|
2331
|
+
c(x), y(x);
|
|
2332
|
+
}, [x, y, c]), D = R(
|
|
2333
|
+
(V) => {
|
|
2334
|
+
c(V), C(!1);
|
|
2328
2335
|
},
|
|
2329
|
-
[
|
|
2336
|
+
[c]
|
|
2337
|
+
), M = R(() => {
|
|
2338
|
+
c(void 0);
|
|
2339
|
+
}, [c]), k = R(
|
|
2340
|
+
(V) => {
|
|
2341
|
+
C(V), V || y(v);
|
|
2342
|
+
},
|
|
2343
|
+
[y, v]
|
|
2330
2344
|
);
|
|
2331
|
-
return /* @__PURE__ */ l(
|
|
2332
|
-
|
|
2345
|
+
return /* @__PURE__ */ l(ie, { helpText: g, severity: s, children: /* @__PURE__ */ l(
|
|
2346
|
+
ne,
|
|
2333
2347
|
{
|
|
2334
2348
|
size: o,
|
|
2335
2349
|
severity: s,
|
|
2336
2350
|
inputId: n,
|
|
2337
2351
|
labelId: e,
|
|
2338
|
-
label:
|
|
2339
|
-
image: a ? void 0 :
|
|
2352
|
+
label: S,
|
|
2353
|
+
image: a ? void 0 : u.image,
|
|
2340
2354
|
className: "flex-col items-start justify-start gap-2",
|
|
2341
|
-
children: [
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */ x(Oi, { open: c, onOpenChange: C, children: [
|
|
2344
|
-
/* @__PURE__ */ l(Es, { asChild: !0, children: /* @__PURE__ */ x(
|
|
2345
|
-
H,
|
|
2346
|
-
{
|
|
2347
|
-
id: n,
|
|
2348
|
-
name: u,
|
|
2349
|
-
type: "button",
|
|
2350
|
-
variant: "soft",
|
|
2351
|
-
size: "sm",
|
|
2352
|
-
accentColor: "base",
|
|
2353
|
-
...f,
|
|
2354
|
-
children: [
|
|
2355
|
-
/* @__PURE__ */ l(L, { icon: "RiQrCodeLine" }),
|
|
2356
|
-
"Scan"
|
|
2357
|
-
]
|
|
2358
|
-
}
|
|
2359
|
-
) }),
|
|
2360
|
-
/* @__PURE__ */ x(Mi, { children: [
|
|
2361
|
-
/* @__PURE__ */ l(ki, { className: "light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)" }),
|
|
2362
|
-
/* @__PURE__ */ l(zi, { className: "fixed inset-0", children: /* @__PURE__ */ l(Gi, { onQrScan: g }) })
|
|
2363
|
-
] })
|
|
2364
|
-
] }),
|
|
2365
|
-
y && /* @__PURE__ */ l(L, { icon: "RiCheckLine", className: "align-bottom text-(--primary-a11)" })
|
|
2366
|
-
] }),
|
|
2367
|
-
!!y && /* @__PURE__ */ l(qe, { className: "max-w-full w-max", size: "sm", children: /* @__PURE__ */ x("div", { className: "max-w-full w-max flex justify-between gap-2", children: [
|
|
2368
|
-
/* @__PURE__ */ l("code", { className: "bg-(--base-a3) truncate text-sm", children: y }),
|
|
2355
|
+
children: /* @__PURE__ */ E("div", { className: "flex w-full items-center gap-2", children: [
|
|
2356
|
+
/* @__PURE__ */ E(ee.Root, { className: "grow", accentColor: "base", variant: "surface", size: "sm", children: [
|
|
2369
2357
|
/* @__PURE__ */ l(
|
|
2358
|
+
ee.Field,
|
|
2359
|
+
{
|
|
2360
|
+
id: n,
|
|
2361
|
+
className: "truncate",
|
|
2362
|
+
name: b,
|
|
2363
|
+
value: x ?? "",
|
|
2364
|
+
type: "text",
|
|
2365
|
+
placeholder: "Enter a qr code",
|
|
2366
|
+
onChange: N,
|
|
2367
|
+
onBlur: T,
|
|
2368
|
+
...p
|
|
2369
|
+
}
|
|
2370
|
+
),
|
|
2371
|
+
!!v && /* @__PURE__ */ l(ee.Slot, { children: /* @__PURE__ */ l(
|
|
2370
2372
|
Q,
|
|
2371
2373
|
{
|
|
2372
2374
|
accentColor: "base",
|
|
2373
2375
|
variant: "ghost",
|
|
2374
2376
|
"aria-label": "delete",
|
|
2375
|
-
size: "
|
|
2376
|
-
onClick:
|
|
2377
|
+
size: "xs",
|
|
2378
|
+
onClick: M,
|
|
2377
2379
|
children: /* @__PURE__ */ l(L, { icon: "RiCloseLine" })
|
|
2378
2380
|
}
|
|
2379
|
-
)
|
|
2380
|
-
] })
|
|
2381
|
-
|
|
2381
|
+
) })
|
|
2382
|
+
] }),
|
|
2383
|
+
/* @__PURE__ */ E(Oi, { open: w, onOpenChange: k, children: [
|
|
2384
|
+
/* @__PURE__ */ l(Es, { asChild: !0, children: /* @__PURE__ */ E(K, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
|
|
2385
|
+
/* @__PURE__ */ l(L, { icon: "RiQrCodeLine" }),
|
|
2386
|
+
"Scan"
|
|
2387
|
+
] }) }),
|
|
2388
|
+
/* @__PURE__ */ E(Mi, { children: [
|
|
2389
|
+
/* @__PURE__ */ l(ki, { className: "light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)" }),
|
|
2390
|
+
/* @__PURE__ */ l(zi, { className: "fixed inset-0", children: /* @__PURE__ */ l(Gi, { onQrScan: D }) })
|
|
2391
|
+
] })
|
|
2392
|
+
] })
|
|
2393
|
+
] })
|
|
2382
2394
|
}
|
|
2383
2395
|
) });
|
|
2384
2396
|
});
|
|
2385
2397
|
Hi.displayName = "QrInput";
|
|
2386
2398
|
const Gi = P((t) => {
|
|
2387
2399
|
const { onQrScan: n } = t, e = Xe(null), [i, r] = G(!1);
|
|
2388
|
-
return
|
|
2400
|
+
return H(() => {
|
|
2389
2401
|
if (!e.current) return;
|
|
2390
2402
|
const o = new Mr(
|
|
2391
2403
|
e.current,
|
|
@@ -2402,9 +2414,9 @@ const Gi = P((t) => {
|
|
|
2402
2414
|
r(!0), o.start().finally(() => {
|
|
2403
2415
|
r(!1);
|
|
2404
2416
|
});
|
|
2405
|
-
}, [n]), /* @__PURE__ */
|
|
2417
|
+
}, [n]), /* @__PURE__ */ E("div", { className: "relative flex h-full w-full flex-col justify-center gap-2 bg-(--color-background)", children: [
|
|
2406
2418
|
/* @__PURE__ */ l("div", { className: "absolute top-0 flex w-full p-2", children: /* @__PURE__ */ l(_i, { asChild: !0, children: /* @__PURE__ */ l(Q, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ l(L, { icon: "RiCloseLine" }) }) }) }),
|
|
2407
|
-
/* @__PURE__ */
|
|
2419
|
+
/* @__PURE__ */ E("div", { className: "relative max-h-full max-w-full **:stroke-(--primary-indicator)", children: [
|
|
2408
2420
|
/* @__PURE__ */ l("video", { className: "size-full", ref: e }),
|
|
2409
2421
|
i && /* @__PURE__ */ l("div", { className: "absolute inset-0 flex items-center justify-center bg-(--color-background)", children: /* @__PURE__ */ l(Kt, {}) })
|
|
2410
2422
|
] })
|
|
@@ -2414,7 +2426,7 @@ Gi.displayName = "QrScanner";
|
|
|
2414
2426
|
const Ds = {
|
|
2415
2427
|
...Z,
|
|
2416
2428
|
type: "qr"
|
|
2417
|
-
}, Ae = class Ae extends
|
|
2429
|
+
}, Ae = class Ae extends W {
|
|
2418
2430
|
constructor(e) {
|
|
2419
2431
|
super({ ...e, type: "qr" });
|
|
2420
2432
|
I(this, "onlyValidateAfterTouched", !1);
|
|
@@ -2433,16 +2445,16 @@ const Ds = {
|
|
|
2433
2445
|
I(Ae, "fieldTypeName", "QR"), I(Ae, "fieldTypeDescription", "Used for scanning/reading QR codes."), I(Ae, "Icon", Cr);
|
|
2434
2446
|
let Vt = Ae;
|
|
2435
2447
|
const Ki = P((t) => {
|
|
2436
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2448
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = J(t), { name: d, onChange: p, onBlur: b, value: y } = f, c = o ? null : a, v = o ? "" : u, w = R(
|
|
2437
2449
|
(g) => {
|
|
2438
2450
|
p(g ?? void 0), b(g ?? void 0);
|
|
2439
2451
|
},
|
|
2440
2452
|
[b, p]
|
|
2441
|
-
),
|
|
2453
|
+
), C = R(() => {
|
|
2442
2454
|
p(void 0), b(void 0);
|
|
2443
2455
|
}, [b, p]);
|
|
2444
|
-
return /* @__PURE__ */ l(
|
|
2445
|
-
|
|
2456
|
+
return /* @__PURE__ */ l(ie, { helpText: c, severity: r, children: /* @__PURE__ */ l(
|
|
2457
|
+
ne,
|
|
2446
2458
|
{
|
|
2447
2459
|
size: i,
|
|
2448
2460
|
severity: r,
|
|
@@ -2450,27 +2462,27 @@ const Ki = P((t) => {
|
|
|
2450
2462
|
labelId: e,
|
|
2451
2463
|
label: v,
|
|
2452
2464
|
image: o ? void 0 : s.image,
|
|
2453
|
-
children: /* @__PURE__ */
|
|
2465
|
+
children: /* @__PURE__ */ E(
|
|
2454
2466
|
It.Root,
|
|
2455
2467
|
{
|
|
2456
2468
|
id: n,
|
|
2457
|
-
name:
|
|
2469
|
+
name: d,
|
|
2458
2470
|
className: "flex flex-col gap-1",
|
|
2459
2471
|
accentColor: "base",
|
|
2460
2472
|
variant: "surface",
|
|
2461
2473
|
size: "sm",
|
|
2462
2474
|
value: y ?? "",
|
|
2463
2475
|
onValueChange: w,
|
|
2464
|
-
...
|
|
2476
|
+
...m,
|
|
2465
2477
|
children: [
|
|
2466
|
-
s.options.map((g) => /* @__PURE__ */
|
|
2478
|
+
s.options.map((g) => /* @__PURE__ */ E("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
2467
2479
|
/* @__PURE__ */ l(It.Item, { value: g.value, children: /* @__PURE__ */ l(It.Indicator, { children: /* @__PURE__ */ l(L, { icon: "RiCircleFill" }) }) }, g.value),
|
|
2468
|
-
/* @__PURE__ */ l(
|
|
2480
|
+
/* @__PURE__ */ l(ae, { size: "sm", accentColor: "base", className: "truncate", children: g.label })
|
|
2469
2481
|
] })),
|
|
2470
|
-
!!y && /* @__PURE__ */
|
|
2471
|
-
|
|
2482
|
+
!!y && /* @__PURE__ */ E(
|
|
2483
|
+
K,
|
|
2472
2484
|
{
|
|
2473
|
-
onClick:
|
|
2485
|
+
onClick: C,
|
|
2474
2486
|
className: "w-max -mx-2",
|
|
2475
2487
|
type: "button",
|
|
2476
2488
|
variant: "ghost",
|
|
@@ -2493,7 +2505,7 @@ const As = {
|
|
|
2493
2505
|
...Z,
|
|
2494
2506
|
type: "radio",
|
|
2495
2507
|
options: []
|
|
2496
|
-
}, Pe = class Pe extends
|
|
2508
|
+
}, Pe = class Pe extends W {
|
|
2497
2509
|
constructor(e) {
|
|
2498
2510
|
const { options: i, ...r } = e;
|
|
2499
2511
|
super({ ...r, type: "radio" });
|
|
@@ -2519,7 +2531,7 @@ const As = {
|
|
|
2519
2531
|
const i = e && `${e}.`;
|
|
2520
2532
|
return [
|
|
2521
2533
|
{
|
|
2522
|
-
field: new
|
|
2534
|
+
field: new qe({
|
|
2523
2535
|
label: "Options",
|
|
2524
2536
|
description: "List possible options for the user to select from.",
|
|
2525
2537
|
required: !0,
|
|
@@ -2534,17 +2546,17 @@ const As = {
|
|
|
2534
2546
|
return /* @__PURE__ */ l(Ki, { field: this, ...e });
|
|
2535
2547
|
}
|
|
2536
2548
|
};
|
|
2537
|
-
I(Pe, "fieldTypeName", "
|
|
2538
|
-
let
|
|
2549
|
+
I(Pe, "fieldTypeName", "Option list"), I(Pe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), I(Pe, "Icon", Er);
|
|
2550
|
+
let $t = Pe;
|
|
2539
2551
|
const Xi = P((t) => {
|
|
2540
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2552
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = J(t), { name: d, onChange: p, onBlur: b, value: y } = f, c = o ? null : a, v = o ? "" : u, w = R(
|
|
2541
2553
|
(g) => {
|
|
2542
2554
|
p(g), b(g);
|
|
2543
2555
|
},
|
|
2544
2556
|
[b, p]
|
|
2545
|
-
),
|
|
2546
|
-
return /* @__PURE__ */ l(
|
|
2547
|
-
|
|
2557
|
+
), C = O(() => s.options.find((g) => g.value === y), [s.options, y]);
|
|
2558
|
+
return /* @__PURE__ */ l(ie, { helpText: c, severity: r, children: /* @__PURE__ */ l(
|
|
2559
|
+
ne,
|
|
2548
2560
|
{
|
|
2549
2561
|
size: i,
|
|
2550
2562
|
severity: r,
|
|
@@ -2552,26 +2564,26 @@ const Xi = P((t) => {
|
|
|
2552
2564
|
labelId: e,
|
|
2553
2565
|
label: v,
|
|
2554
2566
|
image: o ? void 0 : s.image,
|
|
2555
|
-
children: /* @__PURE__ */
|
|
2556
|
-
/* @__PURE__ */ l(
|
|
2557
|
-
|
|
2567
|
+
children: /* @__PURE__ */ E(B.Root, { align: "start", children: [
|
|
2568
|
+
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(
|
|
2569
|
+
K,
|
|
2558
2570
|
{
|
|
2559
2571
|
id: n,
|
|
2560
|
-
name:
|
|
2572
|
+
name: d,
|
|
2561
2573
|
className: "!justify-between",
|
|
2562
2574
|
accentColor: "base",
|
|
2563
2575
|
variant: "surface",
|
|
2564
2576
|
type: "button",
|
|
2565
2577
|
size: "sm",
|
|
2566
|
-
...
|
|
2578
|
+
...m,
|
|
2567
2579
|
children: [
|
|
2568
|
-
/* @__PURE__ */ l("span", { className: "truncate", children:
|
|
2580
|
+
/* @__PURE__ */ l("span", { className: "truncate", children: C ? C.label : s.placeholder }),
|
|
2569
2581
|
/* @__PURE__ */ l(L, { icon: "RiArrowDownSLine" })
|
|
2570
2582
|
]
|
|
2571
2583
|
}
|
|
2572
2584
|
) }),
|
|
2573
|
-
/* @__PURE__ */ l(
|
|
2574
|
-
/* @__PURE__ */ l(
|
|
2585
|
+
/* @__PURE__ */ l(B.Content, { children: /* @__PURE__ */ l(B.Scroll, { children: /* @__PURE__ */ l(B.SelectGroup, { required: !1, value: y ?? void 0, onValueChange: w, children: s.options.map((g) => /* @__PURE__ */ E(B.SelectItem, { value: g.value, children: [
|
|
2586
|
+
/* @__PURE__ */ l(B.SelectedIndicator, { children: /* @__PURE__ */ l(L, { icon: "RiCheckLine" }) }),
|
|
2575
2587
|
g.label
|
|
2576
2588
|
] }, g.value)) }) }) })
|
|
2577
2589
|
] })
|
|
@@ -2583,7 +2595,7 @@ const Ps = {
|
|
|
2583
2595
|
...Z,
|
|
2584
2596
|
type: "select",
|
|
2585
2597
|
options: []
|
|
2586
|
-
}, Oe = class Oe extends
|
|
2598
|
+
}, Oe = class Oe extends $i {
|
|
2587
2599
|
constructor(n) {
|
|
2588
2600
|
const { placeholder: e = "Select one...", ...i } = n;
|
|
2589
2601
|
super({ ...i, placeholder: e, type: "select" });
|
|
@@ -2601,8 +2613,8 @@ const Ps = {
|
|
|
2601
2613
|
};
|
|
2602
2614
|
I(Oe, "fieldTypeName", "Dropdown"), I(Oe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), I(Oe, "Icon", Ir);
|
|
2603
2615
|
let gt = Oe;
|
|
2604
|
-
const ot = 500, Ue = 1e4,
|
|
2605
|
-
class vt extends
|
|
2616
|
+
const ot = 500, Ue = 1e4, Bn = (t) => "fields" in t;
|
|
2617
|
+
class vt extends W {
|
|
2606
2618
|
constructor(e) {
|
|
2607
2619
|
const { minLength: i, maxLength: r, placeholder: o = "", ...s } = e;
|
|
2608
2620
|
super(s);
|
|
@@ -2673,7 +2685,7 @@ class vt extends U {
|
|
|
2673
2685
|
* equal to the value given for "maximum length".
|
|
2674
2686
|
*/
|
|
2675
2687
|
I(vt, "_validateMin", (e) => (i, r) => {
|
|
2676
|
-
const o =
|
|
2688
|
+
const o = Bn(r) ? se(r, e) : r;
|
|
2677
2689
|
return typeof o.maximum_length == "number" && typeof i == "number" && o.maximum_length < i ? "Minimum cannot be greater than maximum." : null;
|
|
2678
2690
|
}), /**
|
|
2679
2691
|
* This function returns a function that validates that the value given for "maximum length" (when creating a new field) is greater than or
|
|
@@ -2681,36 +2693,36 @@ I(vt, "_validateMin", (e) => (i, r) => {
|
|
|
2681
2693
|
*/
|
|
2682
2694
|
I(vt, "_validateMax", (e) => (i, r) => {
|
|
2683
2695
|
if (typeof i != "number") return null;
|
|
2684
|
-
const { minimum_length: o } =
|
|
2696
|
+
const { minimum_length: o } = Bn(r) ? se(r, e) : r;
|
|
2685
2697
|
return typeof o != "number" ? null : o > i ? "Maximum cannot be less than minimum." : null;
|
|
2686
2698
|
});
|
|
2687
2699
|
const Yi = P((t) => {
|
|
2688
2700
|
const [
|
|
2689
|
-
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2701
|
+
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f, touched: m, helpers: d },
|
|
2690
2702
|
p
|
|
2691
|
-
] = J(t), { name: b, onBlur: y, onChange: c, value: v } =
|
|
2692
|
-
|
|
2703
|
+
] = J(t), { name: b, onBlur: y, onChange: c, value: v } = f, w = o ? null : a, C = o ? "" : u, [g, S] = G(void 0);
|
|
2704
|
+
H(() => {
|
|
2693
2705
|
S(v);
|
|
2694
2706
|
}, [v]);
|
|
2695
|
-
const
|
|
2707
|
+
const x = R(
|
|
2696
2708
|
(N) => {
|
|
2697
|
-
S(N.target.value || void 0), (
|
|
2709
|
+
S(N.target.value || void 0), (m || !s.onlyValidateAfterTouched) && d.setError(s.getError(N.target.value));
|
|
2698
2710
|
},
|
|
2699
|
-
[s,
|
|
2700
|
-
), F =
|
|
2711
|
+
[s, d, m]
|
|
2712
|
+
), F = R(() => {
|
|
2701
2713
|
c(g), y(g);
|
|
2702
2714
|
}, [g, y, c]);
|
|
2703
|
-
return /* @__PURE__ */ l(
|
|
2704
|
-
|
|
2715
|
+
return /* @__PURE__ */ l(ie, { helpText: w, severity: r, children: /* @__PURE__ */ l(
|
|
2716
|
+
ne,
|
|
2705
2717
|
{
|
|
2706
2718
|
size: i,
|
|
2707
2719
|
severity: r,
|
|
2708
2720
|
inputId: n,
|
|
2709
2721
|
labelId: e,
|
|
2710
|
-
label:
|
|
2722
|
+
label: C,
|
|
2711
2723
|
image: o ? void 0 : s.image,
|
|
2712
|
-
children: /* @__PURE__ */ l(
|
|
2713
|
-
|
|
2724
|
+
children: /* @__PURE__ */ l(ee.Root, { accentColor: "base", variant: "surface", size: "sm", children: /* @__PURE__ */ l(
|
|
2725
|
+
ee.Field,
|
|
2714
2726
|
{
|
|
2715
2727
|
id: n,
|
|
2716
2728
|
className: "truncate",
|
|
@@ -2718,7 +2730,7 @@ const Yi = P((t) => {
|
|
|
2718
2730
|
value: g ?? "",
|
|
2719
2731
|
type: s.inputType,
|
|
2720
2732
|
placeholder: s.placeholder,
|
|
2721
|
-
onChange:
|
|
2733
|
+
onChange: x,
|
|
2722
2734
|
onBlur: F,
|
|
2723
2735
|
...p
|
|
2724
2736
|
}
|
|
@@ -2761,28 +2773,28 @@ I(Me, "fieldTypeName", "Short Text"), I(Me, "fieldTypeDescription", `Short text
|
|
|
2761
2773
|
let Ut = Me;
|
|
2762
2774
|
const Qi = P((t) => {
|
|
2763
2775
|
const [
|
|
2764
|
-
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label:
|
|
2776
|
+
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f, touched: m, helpers: d },
|
|
2765
2777
|
p
|
|
2766
|
-
] = J(t), { name: b, onBlur: y, onChange: c, value: v } =
|
|
2767
|
-
|
|
2778
|
+
] = J(t), { name: b, onBlur: y, onChange: c, value: v } = f, w = o ? null : a, C = o ? "" : u, [g, S] = G(void 0);
|
|
2779
|
+
H(() => {
|
|
2768
2780
|
S(v);
|
|
2769
2781
|
}, [v]);
|
|
2770
|
-
const
|
|
2782
|
+
const x = R(
|
|
2771
2783
|
(N) => {
|
|
2772
|
-
S(N.target.value || void 0), (
|
|
2784
|
+
S(N.target.value || void 0), (m || !s.onlyValidateAfterTouched) && d.setError(s.getError(N.target.value));
|
|
2773
2785
|
},
|
|
2774
|
-
[s,
|
|
2775
|
-
), F =
|
|
2786
|
+
[s, d, m]
|
|
2787
|
+
), F = R(() => {
|
|
2776
2788
|
c(g), y(g);
|
|
2777
2789
|
}, [g, y, c]);
|
|
2778
|
-
return /* @__PURE__ */ l(
|
|
2779
|
-
|
|
2790
|
+
return /* @__PURE__ */ l(ie, { helpText: w, severity: r, children: /* @__PURE__ */ l(
|
|
2791
|
+
ne,
|
|
2780
2792
|
{
|
|
2781
2793
|
size: i,
|
|
2782
2794
|
severity: r,
|
|
2783
2795
|
inputId: n,
|
|
2784
2796
|
labelId: e,
|
|
2785
|
-
label:
|
|
2797
|
+
label: C,
|
|
2786
2798
|
image: o ? void 0 : s.image,
|
|
2787
2799
|
children: /* @__PURE__ */ l(
|
|
2788
2800
|
qn,
|
|
@@ -2790,7 +2802,7 @@ const Qi = P((t) => {
|
|
|
2790
2802
|
id: n,
|
|
2791
2803
|
value: g ?? "",
|
|
2792
2804
|
name: b,
|
|
2793
|
-
onChange:
|
|
2805
|
+
onChange: x,
|
|
2794
2806
|
onBlur: F,
|
|
2795
2807
|
className: "field-sizing-content min-h-12",
|
|
2796
2808
|
placeholder: s.placeholder,
|
|
@@ -2836,7 +2848,7 @@ let Wt = ke;
|
|
|
2836
2848
|
const ks = P(
|
|
2837
2849
|
Ke((t, n) => {
|
|
2838
2850
|
const { file: e, alt: i, error: r, rightSlot: o, className: s, ...a } = t;
|
|
2839
|
-
return /* @__PURE__ */
|
|
2851
|
+
return /* @__PURE__ */ E(
|
|
2840
2852
|
"div",
|
|
2841
2853
|
{
|
|
2842
2854
|
className: je(
|
|
@@ -2855,7 +2867,7 @@ const ks = P(
|
|
|
2855
2867
|
alt: i ?? e.name
|
|
2856
2868
|
}
|
|
2857
2869
|
) }),
|
|
2858
|
-
/* @__PURE__ */
|
|
2870
|
+
/* @__PURE__ */ E(
|
|
2859
2871
|
"div",
|
|
2860
2872
|
{
|
|
2861
2873
|
className: je("flex h-max w-full items-center gap-1 bg-(--base-2) px-2 py-1", {
|
|
@@ -2863,7 +2875,7 @@ const ks = P(
|
|
|
2863
2875
|
}),
|
|
2864
2876
|
children: [
|
|
2865
2877
|
r ? /* @__PURE__ */ l(L, { icon: "RiFileWarningLine" }) : e && /* @__PURE__ */ l(nn, { fileType: e.type }),
|
|
2866
|
-
/* @__PURE__ */ l(
|
|
2878
|
+
/* @__PURE__ */ l(ae, { className: "truncate", size: "sm", children: r ?? (e == null ? void 0 : e.name) }),
|
|
2867
2879
|
o
|
|
2868
2880
|
]
|
|
2869
2881
|
}
|
|
@@ -2885,47 +2897,47 @@ const ks = P(
|
|
|
2885
2897
|
}).format(e);
|
|
2886
2898
|
}, Ji = P((t) => {
|
|
2887
2899
|
var N;
|
|
2888
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, helpText: o, showInputOnly: s, field: a, fieldProps:
|
|
2900
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, helpText: o, showInputOnly: s, field: a, fieldProps: u }, f] = J(t), { name: m, onChange: d, onBlur: p } = u;
|
|
2889
2901
|
let [{ label: b }] = J(t);
|
|
2890
2902
|
b = s ? "" : b;
|
|
2891
|
-
const y =
|
|
2892
|
-
var
|
|
2893
|
-
(
|
|
2894
|
-
}, []),
|
|
2903
|
+
const y = u.value ?? rn, c = Xe(null), v = O(() => s ? null : o || (a.maxFileSize ? `Maximum file size: ${a.maxFileSize}MB` : null), [a.maxFileSize, o, s]), w = R(() => {
|
|
2904
|
+
var T;
|
|
2905
|
+
(T = c.current) == null || T.click();
|
|
2906
|
+
}, []), C = R(() => {
|
|
2895
2907
|
if (!c.current) return;
|
|
2896
|
-
const
|
|
2897
|
-
if (!
|
|
2908
|
+
const T = c.current.files;
|
|
2909
|
+
if (!T) {
|
|
2898
2910
|
p([]);
|
|
2899
2911
|
return;
|
|
2900
2912
|
}
|
|
2901
|
-
const
|
|
2902
|
-
|
|
2903
|
-
}, [p,
|
|
2904
|
-
(
|
|
2905
|
-
const
|
|
2906
|
-
|
|
2913
|
+
const D = Array.from(T), M = [...y, ...D];
|
|
2914
|
+
d(M), p(M);
|
|
2915
|
+
}, [p, d, y]), g = R(
|
|
2916
|
+
(T) => {
|
|
2917
|
+
const D = [...y];
|
|
2918
|
+
D.splice(T, 1), d(D.length > 0 ? D : void 0);
|
|
2907
2919
|
},
|
|
2908
|
-
[y,
|
|
2920
|
+
[y, d]
|
|
2909
2921
|
);
|
|
2910
|
-
|
|
2922
|
+
H(() => {
|
|
2911
2923
|
if (!c.current) return;
|
|
2912
|
-
const
|
|
2924
|
+
const T = new AbortController();
|
|
2913
2925
|
return c.current.addEventListener(
|
|
2914
2926
|
"cancel",
|
|
2915
2927
|
() => {
|
|
2916
2928
|
p(void 0);
|
|
2917
2929
|
},
|
|
2918
2930
|
{
|
|
2919
|
-
signal:
|
|
2931
|
+
signal: T.signal
|
|
2920
2932
|
}
|
|
2921
2933
|
), () => {
|
|
2922
|
-
|
|
2934
|
+
T.abort();
|
|
2923
2935
|
};
|
|
2924
2936
|
}, [p, y]);
|
|
2925
|
-
const
|
|
2926
|
-
return /* @__PURE__ */
|
|
2927
|
-
/* @__PURE__ */ l(
|
|
2928
|
-
|
|
2937
|
+
const F = a.maxFiles > 1 ? "Select files" : "Select a file";
|
|
2938
|
+
return /* @__PURE__ */ E("div", { className: "flex flex-col gap-2", children: [
|
|
2939
|
+
/* @__PURE__ */ l(ie, { helpText: v, severity: r, children: /* @__PURE__ */ E(
|
|
2940
|
+
ne,
|
|
2929
2941
|
{
|
|
2930
2942
|
size: i,
|
|
2931
2943
|
severity: r,
|
|
@@ -2934,8 +2946,8 @@ const ks = P(
|
|
|
2934
2946
|
label: b,
|
|
2935
2947
|
image: s ? void 0 : a.image,
|
|
2936
2948
|
children: [
|
|
2937
|
-
/* @__PURE__ */ l("div", { className: "flex gap-2", children: /* @__PURE__ */
|
|
2938
|
-
|
|
2949
|
+
/* @__PURE__ */ l("div", { className: "flex gap-2", children: /* @__PURE__ */ E(
|
|
2950
|
+
K,
|
|
2939
2951
|
{
|
|
2940
2952
|
className: "w-max",
|
|
2941
2953
|
size: "sm",
|
|
@@ -2944,7 +2956,7 @@ const ks = P(
|
|
|
2944
2956
|
onClick: w,
|
|
2945
2957
|
id: "upload-input-upload-button",
|
|
2946
2958
|
type: "button",
|
|
2947
|
-
...
|
|
2959
|
+
...f,
|
|
2948
2960
|
children: [
|
|
2949
2961
|
/* @__PURE__ */ l(L, { icon: "RiUpload2Line" }),
|
|
2950
2962
|
" ",
|
|
@@ -2956,56 +2968,56 @@ const ks = P(
|
|
|
2956
2968
|
"input",
|
|
2957
2969
|
{
|
|
2958
2970
|
id: n,
|
|
2959
|
-
name:
|
|
2971
|
+
name: m,
|
|
2960
2972
|
type: "file",
|
|
2961
2973
|
ref: c,
|
|
2962
2974
|
accept: (N = a.extensions) == null ? void 0 : N.join(","),
|
|
2963
2975
|
multiple: a.maxFiles > 1,
|
|
2964
2976
|
className: "hidden",
|
|
2965
|
-
onChange:
|
|
2977
|
+
onChange: C,
|
|
2966
2978
|
value: ""
|
|
2967
2979
|
}
|
|
2968
2980
|
)
|
|
2969
2981
|
]
|
|
2970
2982
|
}
|
|
2971
2983
|
) }),
|
|
2972
|
-
Array.isArray(y) && y.length > 0 && /* @__PURE__ */ l("div", { className: "flex h-max flex-col gap-2", children: y.map((
|
|
2984
|
+
Array.isArray(y) && y.length > 0 && /* @__PURE__ */ l("div", { className: "flex h-max flex-col gap-2", children: y.map((T, D) => /* @__PURE__ */ l(
|
|
2973
2985
|
Zi,
|
|
2974
2986
|
{
|
|
2975
2987
|
field: a,
|
|
2976
|
-
file:
|
|
2988
|
+
file: T,
|
|
2977
2989
|
onRemove: () => {
|
|
2978
|
-
g(
|
|
2990
|
+
g(D);
|
|
2979
2991
|
},
|
|
2980
|
-
disabled:
|
|
2992
|
+
disabled: f.disabled
|
|
2981
2993
|
},
|
|
2982
|
-
|
|
2994
|
+
D
|
|
2983
2995
|
)) })
|
|
2984
2996
|
] });
|
|
2985
2997
|
});
|
|
2986
2998
|
Ji.displayName = "UploadInput";
|
|
2987
2999
|
const Zi = P((t) => {
|
|
2988
|
-
const { file: n, field: e, onRemove: i, disabled: r } = t, [o, s] = G(null), a = ln(),
|
|
3000
|
+
const { file: n, field: e, onRemove: i, disabled: r } = t, [o, s] = G(null), a = ln(), u = O(() => o && e.getError([o]), [e, o]), { url: f, name: m } = O(() => {
|
|
2989
3001
|
let c = null, v, w;
|
|
2990
3002
|
return o != null && o.type.startsWith("image/") && (c = URL.createObjectURL(o)), o ? (v = o.name, w = zs(o.size)) : (v = "Downloading...", w = "..."), { url: c, name: v, size: w };
|
|
2991
3003
|
}, [o]);
|
|
2992
|
-
|
|
3004
|
+
H(() => {
|
|
2993
3005
|
n instanceof Promise ? n.then(s).catch(console.error) : s(n);
|
|
2994
3006
|
}, [n]);
|
|
2995
|
-
const
|
|
3007
|
+
const d = R(
|
|
2996
3008
|
(c) => {
|
|
2997
3009
|
if (c.stopPropagation(), !o)
|
|
2998
3010
|
throw new Error("Cannot download a file that is not resolved.");
|
|
2999
3011
|
const v = new Blob([o]);
|
|
3000
|
-
Yn(v,
|
|
3012
|
+
Yn(v, m);
|
|
3001
3013
|
},
|
|
3002
|
-
[
|
|
3003
|
-
), p =
|
|
3014
|
+
[m, o]
|
|
3015
|
+
), p = R(
|
|
3004
3016
|
(c) => {
|
|
3005
3017
|
c.stopPropagation(), i();
|
|
3006
3018
|
},
|
|
3007
3019
|
[i]
|
|
3008
|
-
), b =
|
|
3020
|
+
), b = R(() => {
|
|
3009
3021
|
o && a((c) => ({
|
|
3010
3022
|
file: o,
|
|
3011
3023
|
onDelete: r ? void 0 : () => {
|
|
@@ -3013,31 +3025,31 @@ const Zi = P((t) => {
|
|
|
3013
3025
|
}
|
|
3014
3026
|
}));
|
|
3015
3027
|
}, [r, i, a, o]), y = O(
|
|
3016
|
-
() => /* @__PURE__ */
|
|
3028
|
+
() => /* @__PURE__ */ E(Xt, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
3017
3029
|
/* @__PURE__ */ l(
|
|
3018
3030
|
Q,
|
|
3019
3031
|
{
|
|
3020
|
-
"aria-label": `Download ${
|
|
3032
|
+
"aria-label": `Download ${m}`,
|
|
3021
3033
|
type: "button",
|
|
3022
|
-
onClick:
|
|
3034
|
+
onClick: d,
|
|
3023
3035
|
disabled: !o,
|
|
3024
3036
|
children: /* @__PURE__ */ l(L, { icon: "RiDownload2Line" })
|
|
3025
3037
|
}
|
|
3026
3038
|
),
|
|
3027
|
-
!r && /* @__PURE__ */ l(Q, { type: "button", "aria-label": `Remove ${
|
|
3039
|
+
!r && /* @__PURE__ */ l(Q, { type: "button", "aria-label": `Remove ${m}`, disabled: r, onClick: p, children: /* @__PURE__ */ l(L, { icon: "RiDeleteBin7Fill" }) })
|
|
3028
3040
|
] }),
|
|
3029
|
-
[r, p,
|
|
3041
|
+
[r, p, d, m, o]
|
|
3030
3042
|
);
|
|
3031
|
-
return
|
|
3043
|
+
return f ? /* @__PURE__ */ l(
|
|
3032
3044
|
ks,
|
|
3033
3045
|
{
|
|
3034
3046
|
className: "cursor-pointer",
|
|
3035
3047
|
onClick: b,
|
|
3036
3048
|
file: o,
|
|
3037
|
-
error:
|
|
3049
|
+
error: u ?? void 0,
|
|
3038
3050
|
rightSlot: y
|
|
3039
3051
|
}
|
|
3040
|
-
) : /* @__PURE__ */ l(Qn, { file: o, error:
|
|
3052
|
+
) : /* @__PURE__ */ l(Qn, { file: o, error: u ?? void 0, rightSlot: y });
|
|
3041
3053
|
});
|
|
3042
3054
|
Zi.displayName = "DisplayFile";
|
|
3043
3055
|
const _s = {
|
|
@@ -3050,7 +3062,7 @@ const _s = {
|
|
|
3050
3062
|
function Vn(t, n) {
|
|
3051
3063
|
return t.name === n.name && t.size === n.size && t.type === n.type;
|
|
3052
3064
|
}
|
|
3053
|
-
const ze = class ze extends
|
|
3065
|
+
const ze = class ze extends W {
|
|
3054
3066
|
constructor(e) {
|
|
3055
3067
|
const { extensions: i, maximum_files: r, maximum_size: o, ...s } = e;
|
|
3056
3068
|
super({ ...s, type: "upload" });
|
|
@@ -3153,29 +3165,29 @@ const ze = class ze extends U {
|
|
|
3153
3165
|
return /* @__PURE__ */ l(Ji, { field: this, ...e });
|
|
3154
3166
|
}
|
|
3155
3167
|
};
|
|
3156
|
-
I(ze, "fieldTypeName", "Upload"), I(ze, "fieldTypeDescription", "Allows a file to be uploaded."), I(ze, "Icon",
|
|
3168
|
+
I(ze, "fieldTypeName", "Upload"), I(ze, "fieldTypeDescription", "Allows a file to be uploaded."), I(ze, "Icon", Tr);
|
|
3157
3169
|
let jt = ze;
|
|
3158
3170
|
const mn = {
|
|
3159
|
-
date:
|
|
3171
|
+
date: Bt,
|
|
3160
3172
|
number: be,
|
|
3161
|
-
boolean:
|
|
3173
|
+
boolean: He,
|
|
3162
3174
|
select: gt,
|
|
3163
3175
|
string: Ut,
|
|
3164
3176
|
text: Wt,
|
|
3165
3177
|
custom: ht,
|
|
3166
3178
|
upload: jt,
|
|
3167
3179
|
qr: Vt,
|
|
3168
|
-
"multi-string":
|
|
3180
|
+
"multi-string": qe,
|
|
3169
3181
|
"multi-select": pt,
|
|
3170
|
-
radio:
|
|
3171
|
-
},
|
|
3172
|
-
date:
|
|
3182
|
+
radio: $t
|
|
3183
|
+
}, Bs = {
|
|
3184
|
+
date: Rs,
|
|
3173
3185
|
number: Ls,
|
|
3174
3186
|
boolean: Ns,
|
|
3175
3187
|
select: Ps,
|
|
3176
3188
|
string: Os,
|
|
3177
3189
|
text: Ms,
|
|
3178
|
-
custom:
|
|
3190
|
+
custom: Ts,
|
|
3179
3191
|
upload: _s,
|
|
3180
3192
|
qr: Ds,
|
|
3181
3193
|
"multi-string": Ss,
|
|
@@ -3195,7 +3207,7 @@ const mn = {
|
|
|
3195
3207
|
custom: "RiCodeSSlashLine",
|
|
3196
3208
|
section: "RiFolderLine",
|
|
3197
3209
|
radio: "RiRadioButtonFill"
|
|
3198
|
-
}, st = 50, Vs = st * 1e3,
|
|
3210
|
+
}, st = 50, Vs = st * 1e3, $s = Vs * 1e3, er = P((t) => {
|
|
3199
3211
|
const { field: n, ...e } = t, [{ value: i }] = Qt(n.options.clonedFieldIdentifier), r = O(() => {
|
|
3200
3212
|
const o = n.options.getFieldToClone(i);
|
|
3201
3213
|
return o ? hn(o) : null;
|
|
@@ -3211,18 +3223,18 @@ class Us extends ht {
|
|
|
3211
3223
|
const tr = (t) => {
|
|
3212
3224
|
const n = t.type;
|
|
3213
3225
|
return mn[n].deserialize(t);
|
|
3214
|
-
}, hn = (t) => t.type === "section" ?
|
|
3226
|
+
}, hn = (t) => t.type === "section" ? q.deserialize(t) : tr(t);
|
|
3215
3227
|
function Ws(t) {
|
|
3216
3228
|
return t.map((n) => hn(n));
|
|
3217
3229
|
}
|
|
3218
3230
|
function pn(t) {
|
|
3219
3231
|
const n = [];
|
|
3220
3232
|
for (const e of t)
|
|
3221
|
-
if (e instanceof
|
|
3233
|
+
if (e instanceof q)
|
|
3222
3234
|
for (const i of e.fields)
|
|
3223
3235
|
n.push(i);
|
|
3224
3236
|
else {
|
|
3225
|
-
if (!(e instanceof
|
|
3237
|
+
if (!(e instanceof W))
|
|
3226
3238
|
throw new Error(`Invalid field type: ${e.type}`);
|
|
3227
3239
|
n.push(e);
|
|
3228
3240
|
}
|
|
@@ -3268,25 +3280,22 @@ const ir = (t, n) => O(() => !n || !t ? null : t.getInput(n), [t, n]), yt = (t,
|
|
|
3268
3280
|
const e = O(() => t.map((i) => /* @__PURE__ */ l(Kn, { children: i.getInput(n) }, i.getId())), [t, n]);
|
|
3269
3281
|
return /* @__PURE__ */ l("div", { className: "flex flex-col gap-4", children: e });
|
|
3270
3282
|
}, rr = P((t) => {
|
|
3271
|
-
const { field: n, ...e } = t, { label: i, description: r, fields: o, condition: s } = n, { values: a, setFieldValue:
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
);
|
|
3275
|
-
q(() => {
|
|
3276
|
-
if (!f)
|
|
3283
|
+
const { field: n, ...e } = t, { label: i, description: r, fields: o, condition: s } = n, { values: a, setFieldValue: u } = xe(), f = s != null && s.identifier ? se(a, s.identifier) : void 0, m = O(() => nr(s, f), [s, f]);
|
|
3284
|
+
H(() => {
|
|
3285
|
+
if (!m)
|
|
3277
3286
|
for (const p of o)
|
|
3278
|
-
|
|
3279
|
-
}, [
|
|
3280
|
-
const
|
|
3281
|
-
return
|
|
3282
|
-
(i || r) && /* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3287
|
+
u(p.getId(), "").then();
|
|
3288
|
+
}, [m, o, u]);
|
|
3289
|
+
const d = yt(o, e);
|
|
3290
|
+
return m ? /* @__PURE__ */ l(Ge, { variant: "soft", children: /* @__PURE__ */ E("div", { className: "flex flex-col gap-4", children: [
|
|
3291
|
+
(i || r) && /* @__PURE__ */ E(pe, { children: [
|
|
3292
|
+
/* @__PURE__ */ E("div", { className: "flex flex-col", children: [
|
|
3284
3293
|
/* @__PURE__ */ l(Hn, { size: "md", children: i }),
|
|
3285
|
-
/* @__PURE__ */ l(
|
|
3294
|
+
/* @__PURE__ */ l(ae, { accentColor: "base", children: r })
|
|
3286
3295
|
] }),
|
|
3287
3296
|
/* @__PURE__ */ l(jn, { size: "full" })
|
|
3288
3297
|
] }),
|
|
3289
|
-
|
|
3298
|
+
d
|
|
3290
3299
|
] }) }) : null;
|
|
3291
3300
|
});
|
|
3292
3301
|
rr.displayName = "FieldSectionLayout";
|
|
@@ -3304,7 +3313,7 @@ const _e = class _e extends Jn {
|
|
|
3304
3313
|
const r = i && `${i}.`;
|
|
3305
3314
|
return [
|
|
3306
3315
|
{
|
|
3307
|
-
field: new
|
|
3316
|
+
field: new He({
|
|
3308
3317
|
label: "Conditionally render section",
|
|
3309
3318
|
identifier: `${r}conditional`,
|
|
3310
3319
|
required: !1
|
|
@@ -3388,7 +3397,7 @@ const _e = class _e extends Jn {
|
|
|
3388
3397
|
getErrors(e) {
|
|
3389
3398
|
const i = {};
|
|
3390
3399
|
for (const r of this.fields) {
|
|
3391
|
-
const o = r.getId(), s = r.getError(
|
|
3400
|
+
const o = r.getId(), s = r.getError(se(e, o), e);
|
|
3392
3401
|
s && Ve(i, r.getId(), s);
|
|
3393
3402
|
}
|
|
3394
3403
|
return i;
|
|
@@ -3398,27 +3407,27 @@ const _e = class _e extends Jn {
|
|
|
3398
3407
|
}
|
|
3399
3408
|
};
|
|
3400
3409
|
I(_e, "fieldTypeName", "Section"), I(_e, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
3401
|
-
let
|
|
3410
|
+
let q = _e;
|
|
3402
3411
|
const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
3403
3412
|
const e = {};
|
|
3404
3413
|
for (const i of t)
|
|
3405
|
-
if (i instanceof
|
|
3414
|
+
if (i instanceof q) {
|
|
3406
3415
|
if (i.condition) {
|
|
3407
3416
|
const { identifier: r } = i.condition;
|
|
3408
|
-
if (!nr(i.condition,
|
|
3417
|
+
if (!nr(i.condition, se(n, r)))
|
|
3409
3418
|
continue;
|
|
3410
3419
|
}
|
|
3411
3420
|
Object.assign(e, i.getErrors(n));
|
|
3412
3421
|
} else {
|
|
3413
|
-
if (!(i instanceof
|
|
3422
|
+
if (!(i instanceof W))
|
|
3414
3423
|
throw new Error("Invalid field type");
|
|
3415
|
-
const r = i.getId(), o = i.getError(
|
|
3424
|
+
const r = i.getId(), o = i.getError(se(n, r), n);
|
|
3416
3425
|
o && Ve(e, r, o);
|
|
3417
3426
|
}
|
|
3418
3427
|
if (he(e)) return e;
|
|
3419
3428
|
}, vn = (t, n) => t.reduce(
|
|
3420
3429
|
(e, i) => {
|
|
3421
|
-
if (i instanceof
|
|
3430
|
+
if (i instanceof q)
|
|
3422
3431
|
return { ...e, ...vn(i.fields, n) };
|
|
3423
3432
|
const r = i.getId(), o = e[r];
|
|
3424
3433
|
switch (o) {
|
|
@@ -3440,9 +3449,9 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3440
3449
|
// unknown reason.
|
|
3441
3450
|
kr(n)
|
|
3442
3451
|
), or = (t, n, e) => t.reduce((i, r) => {
|
|
3443
|
-
if (r instanceof
|
|
3452
|
+
if (r instanceof q)
|
|
3444
3453
|
return { ...i, ...or(r.fields, n, e) };
|
|
3445
|
-
if (r instanceof
|
|
3454
|
+
if (r instanceof W) {
|
|
3446
3455
|
const o = r.getId(), s = n[o], a = e[o];
|
|
3447
3456
|
r.isEqual(s, a) || Ve(i, o, a);
|
|
3448
3457
|
}
|
|
@@ -3456,71 +3465,71 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3456
3465
|
onSubmit: o,
|
|
3457
3466
|
submitText: s = "Submit",
|
|
3458
3467
|
cancelText: a,
|
|
3459
|
-
onCancel:
|
|
3460
|
-
onDirty:
|
|
3461
|
-
onDirtyChange:
|
|
3468
|
+
onCancel: u,
|
|
3469
|
+
onDirty: f,
|
|
3470
|
+
onDirtyChange: m,
|
|
3462
3471
|
// if the title isn't provided, hide it by default
|
|
3463
|
-
hideTitle:
|
|
3472
|
+
hideTitle: d = !e.title,
|
|
3464
3473
|
hideDescription: p,
|
|
3465
3474
|
className: b,
|
|
3466
3475
|
buttonProps: y,
|
|
3467
3476
|
enableReinitialize: c = !1,
|
|
3468
3477
|
excludeUnchangedFields: v = !1
|
|
3469
|
-
} = t, { readonly: w } = e.meta,
|
|
3470
|
-
(
|
|
3471
|
-
o == null || o(v ? or(e.fields, g,
|
|
3478
|
+
} = t, { readonly: w } = e.meta, C = pr(), g = O(() => vn(e.fields, i), [e.fields, i]), S = R(
|
|
3479
|
+
(k) => {
|
|
3480
|
+
o == null || o(v ? or(e.fields, g, k) : k);
|
|
3472
3481
|
},
|
|
3473
3482
|
[v, g, o, e.fields]
|
|
3474
|
-
),
|
|
3483
|
+
), x = Jt({
|
|
3475
3484
|
initialValues: g,
|
|
3476
3485
|
onSubmit: S,
|
|
3477
|
-
validate: (
|
|
3486
|
+
validate: (k) => gn(e.fields, k),
|
|
3478
3487
|
// only validate the entire form on submit
|
|
3479
3488
|
validateOnBlur: !1,
|
|
3480
3489
|
validateOnChange: !1,
|
|
3481
3490
|
enableReinitialize: c
|
|
3482
|
-
}), { dirty: F } =
|
|
3491
|
+
}), { dirty: F } = x, N = O(
|
|
3483
3492
|
() => typeof e.title == "string" ? /* @__PURE__ */ l(Hn, { size: "md", children: e.title }) : e.title,
|
|
3484
3493
|
[e.title]
|
|
3485
|
-
),
|
|
3486
|
-
() => typeof e.description == "string" ? /* @__PURE__ */ l(
|
|
3494
|
+
), T = O(
|
|
3495
|
+
() => typeof e.description == "string" ? /* @__PURE__ */ l(ae, { accentColor: "base", children: e.description }) : e.description,
|
|
3487
3496
|
[e.description]
|
|
3488
|
-
),
|
|
3489
|
-
(
|
|
3490
|
-
js(e.fields)[
|
|
3497
|
+
), D = R(
|
|
3498
|
+
(k, V) => {
|
|
3499
|
+
js(e.fields)[k].isEqual(g[k], V) || r == null || r({ ...x.values, [k]: V }, { [k]: V });
|
|
3491
3500
|
},
|
|
3492
|
-
[
|
|
3493
|
-
),
|
|
3494
|
-
return
|
|
3495
|
-
F &&
|
|
3496
|
-
}, [F,
|
|
3501
|
+
[x.values, g, r, e.fields]
|
|
3502
|
+
), M = yt(e.fields, { formId: C, disabled: w, onValuesChange: D });
|
|
3503
|
+
return H(() => {
|
|
3504
|
+
F && f && f(), m && m(F);
|
|
3505
|
+
}, [F, f, m]), /* @__PURE__ */ l(Zt, { value: x, children: /* @__PURE__ */ E(
|
|
3497
3506
|
"form",
|
|
3498
3507
|
{
|
|
3499
|
-
id:
|
|
3508
|
+
id: C,
|
|
3500
3509
|
ref: n,
|
|
3501
3510
|
className: je(b, "flex flex-col gap-2"),
|
|
3502
|
-
onSubmit:
|
|
3511
|
+
onSubmit: x.handleSubmit,
|
|
3503
3512
|
children: [
|
|
3504
|
-
!
|
|
3513
|
+
!d && /* @__PURE__ */ l(Ge, { variant: "soft", children: /* @__PURE__ */ E("div", { className: "flex flex-col gap-1", children: [
|
|
3505
3514
|
N,
|
|
3506
|
-
!p &&
|
|
3515
|
+
!p && T
|
|
3507
3516
|
] }) }),
|
|
3508
|
-
|
|
3509
|
-
!w && /* @__PURE__ */
|
|
3510
|
-
a && /* @__PURE__ */
|
|
3511
|
-
|
|
3517
|
+
M,
|
|
3518
|
+
!w && /* @__PURE__ */ E("div", { className: "flex items-center justify-end gap-2", children: [
|
|
3519
|
+
a && /* @__PURE__ */ E(
|
|
3520
|
+
K,
|
|
3512
3521
|
{
|
|
3513
3522
|
accentColor: ge.danger,
|
|
3514
3523
|
...y,
|
|
3515
3524
|
type: "button",
|
|
3516
|
-
onClick:
|
|
3525
|
+
onClick: u,
|
|
3517
3526
|
children: [
|
|
3518
3527
|
/* @__PURE__ */ l(L, { icon: "RiCloseLine" }),
|
|
3519
3528
|
a
|
|
3520
3529
|
]
|
|
3521
3530
|
}
|
|
3522
3531
|
),
|
|
3523
|
-
/* @__PURE__ */
|
|
3532
|
+
/* @__PURE__ */ E(K, { ...y, type: "submit", disabled: !x.isValid, accentColor: "success", children: [
|
|
3524
3533
|
/* @__PURE__ */ l(L, { icon: "RiCheckLine" }),
|
|
3525
3534
|
s
|
|
3526
3535
|
] })
|
|
@@ -3531,13 +3540,13 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3531
3540
|
})
|
|
3532
3541
|
), We = P((t) => {
|
|
3533
3542
|
const { name: n, render: e } = t, { submitForm: i } = xe(), [r, o, s] = Qt(n), a = O(() => {
|
|
3534
|
-
const
|
|
3535
|
-
s.setValue(
|
|
3543
|
+
const u = (f) => {
|
|
3544
|
+
s.setValue(f, !1);
|
|
3536
3545
|
};
|
|
3537
3546
|
return e({
|
|
3538
3547
|
value: r.value,
|
|
3539
3548
|
meta: o,
|
|
3540
|
-
setValue:
|
|
3549
|
+
setValue: u,
|
|
3541
3550
|
patchValue: () => {
|
|
3542
3551
|
i();
|
|
3543
3552
|
}
|
|
@@ -3548,48 +3557,48 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3548
3557
|
We.displayName = "PatchField";
|
|
3549
3558
|
const hl = P(
|
|
3550
3559
|
Ke((t, n) => {
|
|
3551
|
-
const { children: e, schema: i, values: r, onPatch: o, onError: s, requiresDiff: a = !0, onDirtyChange:
|
|
3552
|
-
(
|
|
3560
|
+
const { children: e, schema: i, values: r, onPatch: o, onError: s, requiresDiff: a = !0, onDirtyChange: u, ...f } = t, m = O(() => vn(i.fields, r), [i.fields, r]), d = R(
|
|
3561
|
+
(C) => {
|
|
3553
3562
|
const g = {};
|
|
3554
|
-
for (const S in
|
|
3555
|
-
const
|
|
3556
|
-
|
|
3563
|
+
for (const S in C) {
|
|
3564
|
+
const x = C[S];
|
|
3565
|
+
x !== m[S] && x !== void 0 && (g[S] = x);
|
|
3557
3566
|
}
|
|
3558
3567
|
return g;
|
|
3559
3568
|
},
|
|
3560
|
-
[
|
|
3561
|
-
), p =
|
|
3562
|
-
(
|
|
3563
|
-
const g =
|
|
3569
|
+
[m]
|
|
3570
|
+
), p = R(
|
|
3571
|
+
(C) => {
|
|
3572
|
+
const g = d(C);
|
|
3564
3573
|
a && !he(g) || o(g);
|
|
3565
3574
|
},
|
|
3566
|
-
[
|
|
3567
|
-
), b =
|
|
3568
|
-
(
|
|
3569
|
-
const g = gn(i.fields,
|
|
3570
|
-
if (g && s(g),
|
|
3571
|
-
const S =
|
|
3572
|
-
|
|
3575
|
+
[d, o, a]
|
|
3576
|
+
), b = R(
|
|
3577
|
+
(C) => {
|
|
3578
|
+
const g = gn(i.fields, C);
|
|
3579
|
+
if (g && s(g), u) {
|
|
3580
|
+
const S = d(C);
|
|
3581
|
+
u(he(S));
|
|
3573
3582
|
}
|
|
3574
3583
|
return g;
|
|
3575
3584
|
},
|
|
3576
|
-
[i.fields,
|
|
3585
|
+
[i.fields, u, s, d]
|
|
3577
3586
|
), y = Jt({
|
|
3578
|
-
initialValues:
|
|
3587
|
+
initialValues: m,
|
|
3579
3588
|
onSubmit: p,
|
|
3580
3589
|
validate: b,
|
|
3581
3590
|
// only validate the entire form on submit
|
|
3582
3591
|
validateOnBlur: !1,
|
|
3583
3592
|
validateOnChange: !1
|
|
3584
|
-
}), c =
|
|
3585
|
-
if (
|
|
3586
|
-
const
|
|
3587
|
-
he(
|
|
3593
|
+
}), c = R(() => {
|
|
3594
|
+
if (u) {
|
|
3595
|
+
const C = d(y.values);
|
|
3596
|
+
he(C) && u(!0);
|
|
3588
3597
|
}
|
|
3589
|
-
}, [y.values,
|
|
3590
|
-
return
|
|
3591
|
-
he(v) && w({ values:
|
|
3592
|
-
}, [v,
|
|
3598
|
+
}, [y.values, d, u]), { errors: v, resetForm: w } = y;
|
|
3599
|
+
return H(() => {
|
|
3600
|
+
he(v) && w({ values: m, errors: {} });
|
|
3601
|
+
}, [v, m, w]), /* @__PURE__ */ l(Zt, { value: y, children: /* @__PURE__ */ l("form", { ...f, ref: n, onSubmit: y.handleSubmit, onChange: c, children: e }) });
|
|
3593
3602
|
})
|
|
3594
3603
|
), lt = "form-builder", Hs = [
|
|
3595
3604
|
["string", "text"],
|
|
@@ -3597,7 +3606,7 @@ const hl = P(
|
|
|
3597
3606
|
["boolean", "date", "number", "multi-string"]
|
|
3598
3607
|
], Ht = {
|
|
3599
3608
|
...mn,
|
|
3600
|
-
section:
|
|
3609
|
+
section: q
|
|
3601
3610
|
}, Ct = Gn({}), Gs = (t, n) => {
|
|
3602
3611
|
var i;
|
|
3603
3612
|
const e = { ...t };
|
|
@@ -3622,16 +3631,16 @@ const hl = P(
|
|
|
3622
3631
|
if (r.identifier === n) return e;
|
|
3623
3632
|
}
|
|
3624
3633
|
}
|
|
3625
|
-
},
|
|
3634
|
+
}, $n = (t) => {
|
|
3626
3635
|
var e, i, r;
|
|
3627
3636
|
const n = {};
|
|
3628
3637
|
for (let o = 0; o < t.length; o++) {
|
|
3629
3638
|
const s = t[o];
|
|
3630
3639
|
if (!s) throw new Error("Field is undefined.");
|
|
3631
|
-
const a = o > 0 ? (e = n[t[o - 1].identifier]) == null ? void 0 : e.conditionFields : void 0,
|
|
3632
|
-
(i = s.condition) != null && i.identifier &&
|
|
3640
|
+
const a = o > 0 ? (e = n[t[o - 1].identifier]) == null ? void 0 : e.conditionFields : void 0, u = new Set(a);
|
|
3641
|
+
(i = s.condition) != null && i.identifier && u.add(s.condition.identifier), n[s.identifier] = {
|
|
3633
3642
|
disabled: !1,
|
|
3634
|
-
conditionFields:
|
|
3643
|
+
conditionFields: u,
|
|
3635
3644
|
conditionIndex: Ks(t, (r = s.condition) == null ? void 0 : r.identifier),
|
|
3636
3645
|
index: o,
|
|
3637
3646
|
label: s.label
|
|
@@ -3642,31 +3651,31 @@ const hl = P(
|
|
|
3642
3651
|
const { index: n, type: e, sectionIndex: i, remove: r, duplicate: o, move: s, upload: a } = t;
|
|
3643
3652
|
if (e !== "section" && !a)
|
|
3644
3653
|
throw new Error("Upload function prop must be defined for non-section fields.");
|
|
3645
|
-
const { values:
|
|
3646
|
-
const
|
|
3654
|
+
const { values: u } = xe(), f = Xe(null), m = O(() => {
|
|
3655
|
+
const d = [
|
|
3647
3656
|
{
|
|
3648
|
-
Icon:
|
|
3657
|
+
Icon: Rr,
|
|
3649
3658
|
key: "duplicate",
|
|
3650
3659
|
text: "Duplicate",
|
|
3651
3660
|
buttonProps: { onClick: o }
|
|
3652
3661
|
}
|
|
3653
3662
|
];
|
|
3654
|
-
return
|
|
3663
|
+
return d.push({
|
|
3655
3664
|
Icon: Fr,
|
|
3656
3665
|
key: "delete",
|
|
3657
3666
|
text: "Delete",
|
|
3658
3667
|
buttonProps: { onClick: r }
|
|
3659
|
-
}), e !== "section" &&
|
|
3668
|
+
}), e !== "section" && d.unshift({
|
|
3660
3669
|
Icon: Lr,
|
|
3661
3670
|
key: "upload",
|
|
3662
3671
|
text: "Upload image",
|
|
3663
3672
|
buttonProps: {
|
|
3664
3673
|
onClick: () => {
|
|
3665
3674
|
var p;
|
|
3666
|
-
(p =
|
|
3675
|
+
(p = f.current) == null || p.click();
|
|
3667
3676
|
}
|
|
3668
3677
|
}
|
|
3669
|
-
}), (i === void 0 && n !==
|
|
3678
|
+
}), (i === void 0 && n !== u.fields.length - 1 || i !== void 0 && (i < u.fields.length - 1 || n !== u.fields[i].fields.length - 1)) && d.unshift({
|
|
3670
3679
|
Icon: Dr,
|
|
3671
3680
|
key: "moveDown",
|
|
3672
3681
|
text: "Move down",
|
|
@@ -3675,7 +3684,7 @@ const hl = P(
|
|
|
3675
3684
|
s("down");
|
|
3676
3685
|
}
|
|
3677
3686
|
}
|
|
3678
|
-
}), (i === void 0 && n !== 0 || i !== void 0 && (i !== 0 || n !== 0)) &&
|
|
3687
|
+
}), (i === void 0 && n !== 0 || i !== void 0 && (i !== 0 || n !== 0)) && d.unshift({
|
|
3679
3688
|
Icon: Ar,
|
|
3680
3689
|
key: "moveUp",
|
|
3681
3690
|
text: "Move up",
|
|
@@ -3684,21 +3693,21 @@ const hl = P(
|
|
|
3684
3693
|
s("up");
|
|
3685
3694
|
}
|
|
3686
3695
|
}
|
|
3687
|
-
}),
|
|
3688
|
-
}, [o, n, s, r, i, e,
|
|
3689
|
-
return /* @__PURE__ */
|
|
3690
|
-
/* @__PURE__ */ l(Xt, { className: "mx-2 hidden flex-col gap-0.5 sm:flex", variant: "ghost", accentColor: "base", size: "sm", children:
|
|
3696
|
+
}), d;
|
|
3697
|
+
}, [o, n, s, r, i, e, u.fields]);
|
|
3698
|
+
return /* @__PURE__ */ E(pe, { children: [
|
|
3699
|
+
/* @__PURE__ */ l(Xt, { className: "mx-2 hidden flex-col gap-0.5 sm:flex", variant: "ghost", accentColor: "base", size: "sm", children: m.map((d) => /* @__PURE__ */ l(
|
|
3691
3700
|
Q,
|
|
3692
3701
|
{
|
|
3693
3702
|
type: "button",
|
|
3694
|
-
"aria-label":
|
|
3695
|
-
...
|
|
3696
|
-
children: /* @__PURE__ */ l(
|
|
3703
|
+
"aria-label": d.text,
|
|
3704
|
+
...d.buttonProps,
|
|
3705
|
+
children: /* @__PURE__ */ l(d.Icon, {})
|
|
3697
3706
|
},
|
|
3698
|
-
|
|
3707
|
+
d.key
|
|
3699
3708
|
)) }),
|
|
3700
|
-
/* @__PURE__ */ l("div", { className: "sm:hidden", children: /* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */ l(
|
|
3709
|
+
/* @__PURE__ */ l("div", { className: "sm:hidden", children: /* @__PURE__ */ E(B.Root, { children: [
|
|
3710
|
+
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ l(
|
|
3702
3711
|
Q,
|
|
3703
3712
|
{
|
|
3704
3713
|
variant: "ghost",
|
|
@@ -3709,23 +3718,23 @@ const hl = P(
|
|
|
3709
3718
|
children: /* @__PURE__ */ l(L, { icon: "RiMore2Line" })
|
|
3710
3719
|
}
|
|
3711
3720
|
) }),
|
|
3712
|
-
/* @__PURE__ */ l(
|
|
3721
|
+
/* @__PURE__ */ l(B.Content, { children: m.map((d) => {
|
|
3713
3722
|
var p;
|
|
3714
|
-
return /* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */ l(
|
|
3716
|
-
|
|
3717
|
-
] },
|
|
3723
|
+
return /* @__PURE__ */ E(B.Item, { onClick: (p = d.buttonProps) == null ? void 0 : p.onClick, children: [
|
|
3724
|
+
/* @__PURE__ */ l(d.Icon, {}),
|
|
3725
|
+
d.text
|
|
3726
|
+
] }, d.key);
|
|
3718
3727
|
}) })
|
|
3719
3728
|
] }) }),
|
|
3720
|
-
e !== "section" && /* @__PURE__ */ l("input", { style: { display: "none" }, ref:
|
|
3729
|
+
e !== "section" && /* @__PURE__ */ l("input", { style: { display: "none" }, ref: f, type: "file", accept: "image/*", onChange: a })
|
|
3721
3730
|
] });
|
|
3722
3731
|
});
|
|
3723
3732
|
yn.displayName = "FieldActions";
|
|
3724
3733
|
const Gt = P((t) => {
|
|
3725
3734
|
const { popoverInputs: n, hasError: e, ...i } = t;
|
|
3726
|
-
return /* @__PURE__ */
|
|
3727
|
-
/* @__PURE__ */ l(
|
|
3728
|
-
|
|
3735
|
+
return /* @__PURE__ */ E(Be.Root, { children: [
|
|
3736
|
+
/* @__PURE__ */ l(Be.Trigger, { asChild: !0, children: /* @__PURE__ */ E(
|
|
3737
|
+
K,
|
|
3729
3738
|
{
|
|
3730
3739
|
variant: "soft",
|
|
3731
3740
|
type: "button",
|
|
@@ -3740,7 +3749,7 @@ const Gt = P((t) => {
|
|
|
3740
3749
|
},
|
|
3741
3750
|
"settings"
|
|
3742
3751
|
) }),
|
|
3743
|
-
/* @__PURE__ */ l(
|
|
3752
|
+
/* @__PURE__ */ l(Be.Content, { size: "sm", ...i, children: /* @__PURE__ */ l("div", { className: "flex w-full max-w-[350px] flex-col", children: n }) })
|
|
3744
3753
|
] });
|
|
3745
3754
|
});
|
|
3746
3755
|
Gt.displayName = "FieldSettingsPopover";
|
|
@@ -3756,39 +3765,39 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3756
3765
|
};
|
|
3757
3766
|
})), [t]), Un = 576, bn = P((t) => {
|
|
3758
3767
|
var Ye, xn, wn, Cn, En;
|
|
3759
|
-
const { parentPath: n, index: e, initial: i, conditionalSourceFields: r } = t, { values: o, setFieldValue: s, errors: a } = xe(),
|
|
3760
|
-
|
|
3768
|
+
const { parentPath: n, index: e, initial: i, conditionalSourceFields: r } = t, { values: o, setFieldValue: s, errors: a } = xe(), u = sr(), f = ln(), { disableRequiredFields: m } = Yt(Ct), d = Xe(null), [p, b] = G(
|
|
3769
|
+
d.current && d.current.getBoundingClientRect().width >= Un
|
|
3761
3770
|
);
|
|
3762
|
-
|
|
3763
|
-
const
|
|
3764
|
-
if (
|
|
3765
|
-
const
|
|
3766
|
-
|
|
3771
|
+
H(() => {
|
|
3772
|
+
const A = d.current;
|
|
3773
|
+
if (A) {
|
|
3774
|
+
const _ = new ResizeObserver((j) => {
|
|
3775
|
+
j[0] && b(j[0].contentRect.width >= Un);
|
|
3767
3776
|
});
|
|
3768
|
-
return
|
|
3769
|
-
|
|
3777
|
+
return _.observe(A), () => {
|
|
3778
|
+
_.disconnect();
|
|
3770
3779
|
};
|
|
3771
3780
|
}
|
|
3772
3781
|
}, []);
|
|
3773
3782
|
const [y, c] = G(void 0);
|
|
3774
|
-
|
|
3783
|
+
H(() => {
|
|
3775
3784
|
me(i) ? c(void 0) : i.image instanceof Promise ? i.image.then(c).catch(console.error) : c(i.image);
|
|
3776
3785
|
}, [i]);
|
|
3777
|
-
const v = y ? URL.createObjectURL(y) : void 0, w =
|
|
3778
|
-
(
|
|
3779
|
-
|
|
3780
|
-
const { image:
|
|
3781
|
-
s(`${n}.${e}`,
|
|
3786
|
+
const v = y ? URL.createObjectURL(y) : void 0, w = R(
|
|
3787
|
+
(A) => {
|
|
3788
|
+
A.stopPropagation();
|
|
3789
|
+
const { image: _, ...j } = i;
|
|
3790
|
+
s(`${n}.${e}`, j).then();
|
|
3782
3791
|
},
|
|
3783
3792
|
[e, i, n, s]
|
|
3784
3793
|
);
|
|
3785
|
-
|
|
3794
|
+
H(() => {
|
|
3786
3795
|
me(i) && !i.conditional && s(`${n}.${e}.condition`, null).then();
|
|
3787
3796
|
}, [e, i, n, s]);
|
|
3788
|
-
const
|
|
3797
|
+
const C = O(
|
|
3789
3798
|
() => {
|
|
3790
|
-
var
|
|
3791
|
-
return me(i) ? (
|
|
3799
|
+
var A, _;
|
|
3800
|
+
return me(i) ? (_ = ei(o.fields, (A = i.condition) == null ? void 0 : A.identifier)) == null ? void 0 : _.label : void 0;
|
|
3792
3801
|
},
|
|
3793
3802
|
[i, o.fields]
|
|
3794
3803
|
), g = me(i) ? Array.isArray((Ye = i.condition) == null ? void 0 : Ye.value) ? "contains all of" : "equals" : void 0;
|
|
@@ -3796,74 +3805,74 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3796
3805
|
if (me(i)) {
|
|
3797
3806
|
if (qt((xn = i.condition) == null ? void 0 : xn.value))
|
|
3798
3807
|
throw new Error("File values are not supported for conditions.");
|
|
3799
|
-
S = Array.isArray((wn = i.condition) == null ? void 0 : wn.value) ? i.condition.value.map((
|
|
3808
|
+
S = Array.isArray((wn = i.condition) == null ? void 0 : wn.value) ? i.condition.value.map((A) => typeof A == "string" ? A : A.label).join(", ") : (En = (Cn = i.condition) == null ? void 0 : Cn.value) == null ? void 0 : En.toString();
|
|
3800
3809
|
}
|
|
3801
|
-
const
|
|
3802
|
-
|
|
3803
|
-
}, []), F =
|
|
3804
|
-
|
|
3805
|
-
}, []), N = i.type,
|
|
3806
|
-
let
|
|
3807
|
-
if (
|
|
3810
|
+
const x = R((A) => {
|
|
3811
|
+
A.target.parentNode instanceof HTMLElement && (A.target.parentNode.dataset.replicatedValue = A.target.value);
|
|
3812
|
+
}, []), F = R((A) => {
|
|
3813
|
+
A.target.parentNode instanceof HTMLElement && (A.target.parentNode.dataset.replicatedValue = A.target.value);
|
|
3814
|
+
}, []), N = i.type, T = Ht[N], [D, M] = O(() => {
|
|
3815
|
+
let A = [], _ = [];
|
|
3816
|
+
if (T === q) {
|
|
3808
3817
|
if (r === void 0)
|
|
3809
3818
|
throw new Error("Conditional source fields must be provided when changing sections.");
|
|
3810
|
-
const
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
),
|
|
3814
|
-
|
|
3819
|
+
const j = T.getFieldCreationSchema(r, `${n}.${e}`);
|
|
3820
|
+
A = A.concat(
|
|
3821
|
+
j.filter(($) => $.showDirectly).map(($) => $.field)
|
|
3822
|
+
), _ = _.concat(
|
|
3823
|
+
j.filter(($) => !$.showDirectly).map(($) => $.field)
|
|
3815
3824
|
);
|
|
3816
3825
|
} else {
|
|
3817
|
-
if (!(
|
|
3818
|
-
throw new Error(`Field must be an instance of BaseField. Got ${
|
|
3819
|
-
const
|
|
3826
|
+
if (!(T.prototype instanceof W))
|
|
3827
|
+
throw new Error(`Field must be an instance of BaseField. Got ${T.toString()}.`);
|
|
3828
|
+
const j = T.getFieldCreationSchema(
|
|
3820
3829
|
`${n}.${e}`
|
|
3821
3830
|
);
|
|
3822
|
-
p ? (
|
|
3823
|
-
...
|
|
3824
|
-
...
|
|
3825
|
-
],
|
|
3826
|
-
...
|
|
3827
|
-
...
|
|
3828
|
-
]) :
|
|
3831
|
+
p ? (A = [
|
|
3832
|
+
...A,
|
|
3833
|
+
...j.filter(($) => $.showDirectly).map(($) => $.field)
|
|
3834
|
+
], _ = [
|
|
3835
|
+
..._,
|
|
3836
|
+
...j.filter(($) => !$.showDirectly).map(($) => $.field)
|
|
3837
|
+
]) : _ = [..._, ...j.map(($) => $.field)];
|
|
3829
3838
|
}
|
|
3830
|
-
return [
|
|
3831
|
-
}, [
|
|
3839
|
+
return [A, _];
|
|
3840
|
+
}, [T, r, n, e, p]), k = yt(D, {
|
|
3832
3841
|
formId: lt,
|
|
3833
3842
|
disabled: !1,
|
|
3834
|
-
...
|
|
3835
|
-
}),
|
|
3843
|
+
...T === q && { size: "sm" }
|
|
3844
|
+
}), V = yt(M, {
|
|
3836
3845
|
formId: lt,
|
|
3837
3846
|
disabled: !1
|
|
3838
3847
|
});
|
|
3839
|
-
let X =
|
|
3840
|
-
me(i) &&
|
|
3841
|
-
const
|
|
3842
|
-
const
|
|
3843
|
-
return
|
|
3844
|
-
}),
|
|
3845
|
-
() =>
|
|
3846
|
-
[
|
|
3847
|
-
), Et =
|
|
3848
|
-
y &&
|
|
3848
|
+
let X = M.length > 0;
|
|
3849
|
+
me(i) && M.length > 0 && (X = i.conditional);
|
|
3850
|
+
const le = M.some((A) => {
|
|
3851
|
+
const _ = se(a, T === q ? `${n}.${e}.condition` : A.getId());
|
|
3852
|
+
return _ && (typeof _ != "object" || he(_));
|
|
3853
|
+
}), z = le ? ge.danger : void 0, Y = O(() => hn(i), [i]), Ce = ir(Y, { formId: lt, showInputOnly: !1 }), de = O(
|
|
3854
|
+
() => u.flat().find((A) => A.value === N),
|
|
3855
|
+
[u, N]
|
|
3856
|
+
), Et = R(() => {
|
|
3857
|
+
y && f(() => ({
|
|
3849
3858
|
file: y
|
|
3850
3859
|
}));
|
|
3851
|
-
}, [
|
|
3852
|
-
return /* @__PURE__ */ l("div", { className: "flex grow items-center w-full", ref:
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
X && /* @__PURE__ */
|
|
3860
|
+
}, [f, y]);
|
|
3861
|
+
return /* @__PURE__ */ l("div", { className: "flex grow items-center w-full", ref: d, children: /* @__PURE__ */ E("div", { className: "flex w-full flex-col gap-2", children: [
|
|
3862
|
+
T === q && (D.length > 0 || X) && /* @__PURE__ */ E("div", { className: "flex flex-col gap-2", children: [
|
|
3863
|
+
k,
|
|
3864
|
+
X && /* @__PURE__ */ E("div", { className: "flex items-center gap-4", children: [
|
|
3856
3865
|
/* @__PURE__ */ l(
|
|
3857
3866
|
Gt,
|
|
3858
3867
|
{
|
|
3859
|
-
popoverInputs:
|
|
3860
|
-
hasError:
|
|
3868
|
+
popoverInputs: V,
|
|
3869
|
+
hasError: le,
|
|
3861
3870
|
align: "start"
|
|
3862
3871
|
}
|
|
3863
3872
|
),
|
|
3864
|
-
me(i) && i.conditional && /* @__PURE__ */ l("span", { className: "text-sm text-(--accent-a11)", "data-accent-color":
|
|
3873
|
+
me(i) && i.conditional && /* @__PURE__ */ l("span", { className: "text-sm text-(--accent-a11)", "data-accent-color": z, children: /* @__PURE__ */ E("em", { children: [
|
|
3865
3874
|
"Display only if ",
|
|
3866
|
-
/* @__PURE__ */ l("strong", { children:
|
|
3875
|
+
/* @__PURE__ */ l("strong", { children: C }),
|
|
3867
3876
|
" ",
|
|
3868
3877
|
g,
|
|
3869
3878
|
" ",
|
|
@@ -3871,27 +3880,27 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3871
3880
|
] }) })
|
|
3872
3881
|
] })
|
|
3873
3882
|
] }),
|
|
3874
|
-
|
|
3875
|
-
/* @__PURE__ */
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
|
|
3878
|
-
|
|
3883
|
+
T !== q && /* @__PURE__ */ E("div", { className: "flex gap-2 w-full justify-between", children: [
|
|
3884
|
+
/* @__PURE__ */ E("div", { className: "flex gap-2 items-center", children: [
|
|
3885
|
+
/* @__PURE__ */ E(Ot, { accentColor: "base", variant: "soft", size: "sm", children: [
|
|
3886
|
+
de == null ? void 0 : de.icon,
|
|
3887
|
+
de == null ? void 0 : de.children
|
|
3879
3888
|
] }),
|
|
3880
|
-
!
|
|
3889
|
+
!m && /* @__PURE__ */ l(
|
|
3881
3890
|
We,
|
|
3882
3891
|
{
|
|
3883
3892
|
name: `${n}.${e}.required`,
|
|
3884
|
-
render: ({ setValue:
|
|
3893
|
+
render: ({ setValue: A, value: _ }) => /* @__PURE__ */ E("div", { className: "flex items-center gap-2", children: [
|
|
3885
3894
|
/* @__PURE__ */ l(
|
|
3886
3895
|
at.Root,
|
|
3887
3896
|
{
|
|
3888
|
-
checked:
|
|
3889
|
-
onCheckedChange:
|
|
3897
|
+
checked: _,
|
|
3898
|
+
onCheckedChange: A,
|
|
3890
3899
|
size: "sm",
|
|
3891
3900
|
children: /* @__PURE__ */ l(at.Indicator, { children: /* @__PURE__ */ l(L, { icon: "RiCheckLine" }) })
|
|
3892
3901
|
}
|
|
3893
3902
|
),
|
|
3894
|
-
/* @__PURE__ */ l(
|
|
3903
|
+
/* @__PURE__ */ l(ae, { size: "sm", accentColor: "base", children: "Required" })
|
|
3895
3904
|
] })
|
|
3896
3905
|
}
|
|
3897
3906
|
)
|
|
@@ -3899,13 +3908,13 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3899
3908
|
X && /* @__PURE__ */ l(
|
|
3900
3909
|
Gt,
|
|
3901
3910
|
{
|
|
3902
|
-
popoverInputs:
|
|
3903
|
-
hasError:
|
|
3911
|
+
popoverInputs: V,
|
|
3912
|
+
hasError: le,
|
|
3904
3913
|
align: "end"
|
|
3905
3914
|
}
|
|
3906
3915
|
)
|
|
3907
3916
|
] }),
|
|
3908
|
-
y && /* @__PURE__ */
|
|
3917
|
+
y && /* @__PURE__ */ E("div", { className: "group relative inline-block w-full min-w-[300px]", children: [
|
|
3909
3918
|
/* @__PURE__ */ l(
|
|
3910
3919
|
"img",
|
|
3911
3920
|
{
|
|
@@ -3932,16 +3941,16 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3932
3941
|
We,
|
|
3933
3942
|
{
|
|
3934
3943
|
name: `${n}.${e}.label`,
|
|
3935
|
-
render: ({ setValue:
|
|
3944
|
+
render: ({ setValue: A, value: _ }) => /* @__PURE__ */ l(
|
|
3936
3945
|
"input",
|
|
3937
3946
|
{
|
|
3938
3947
|
className: "bg-transparent outline-none text-sm placeholder-(--base-a9)",
|
|
3939
3948
|
placeholder: N === "section" ? "Enter a section label (optional)" : "Enter your question",
|
|
3940
|
-
value:
|
|
3941
|
-
onChange: (
|
|
3942
|
-
|
|
3949
|
+
value: _,
|
|
3950
|
+
onChange: (j) => {
|
|
3951
|
+
A(j.target.value);
|
|
3943
3952
|
},
|
|
3944
|
-
onInput:
|
|
3953
|
+
onInput: x,
|
|
3945
3954
|
maxLength: 200
|
|
3946
3955
|
}
|
|
3947
3956
|
)
|
|
@@ -3951,14 +3960,14 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3951
3960
|
We,
|
|
3952
3961
|
{
|
|
3953
3962
|
name: `${n}.${e}.description`,
|
|
3954
|
-
render: ({ setValue:
|
|
3963
|
+
render: ({ setValue: A, value: _ }) => /* @__PURE__ */ l(
|
|
3955
3964
|
"textarea",
|
|
3956
3965
|
{
|
|
3957
3966
|
className: "bg-transparent outline-none text-sm field-sizing-content grow placeholder-(--base-a9)",
|
|
3958
3967
|
placeholder: `Enter a ${N === "section" ? "section" : "field"} description (optional)`,
|
|
3959
|
-
value:
|
|
3960
|
-
onChange: (
|
|
3961
|
-
|
|
3968
|
+
value: _,
|
|
3969
|
+
onChange: (j) => {
|
|
3970
|
+
A(j.target.value);
|
|
3962
3971
|
},
|
|
3963
3972
|
onInput: F,
|
|
3964
3973
|
maxLength: 1e3
|
|
@@ -3966,9 +3975,9 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3966
3975
|
)
|
|
3967
3976
|
}
|
|
3968
3977
|
),
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
/* @__PURE__ */
|
|
3978
|
+
T !== q && D.length > 0 && /* @__PURE__ */ l("div", { className: "w-full", children: k }),
|
|
3979
|
+
T !== q && /* @__PURE__ */ E(Ge, { className: "flex gap-4 bg-(--accent-a2) items-center", children: [
|
|
3980
|
+
/* @__PURE__ */ E(St.Root, { children: [
|
|
3972
3981
|
/* @__PURE__ */ l(St.Trigger, { asChild: !0, children: /* @__PURE__ */ l(Ot, { icon: !0, size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ l(L, { icon: "RiEyeLine" }) }) }),
|
|
3973
3982
|
/* @__PURE__ */ l(St.Content, { className: "w-[225px]", size: "sm", align: "start", children: "This is a preview of the field as it will be rendered in the form." })
|
|
3974
3983
|
] }),
|
|
@@ -3978,69 +3987,69 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3978
3987
|
});
|
|
3979
3988
|
bn.displayName = "FieldBuilder";
|
|
3980
3989
|
const lr = P((t) => {
|
|
3981
|
-
const { field: n, index: e, sectionIndex: i, remove: r } = t, { setFieldValue: o, values: s } = xe(), { reorderField: a } = sn(), { showInfo:
|
|
3990
|
+
const { field: n, index: e, sectionIndex: i, remove: r } = t, { setFieldValue: o, values: s } = xe(), { reorderField: a } = sn(), { showInfo: u, showError: f } = bt(), m = `fields.${i}.fields`, d = O(
|
|
3982
3991
|
() => ({
|
|
3983
3992
|
index: e,
|
|
3984
|
-
parentPath:
|
|
3993
|
+
parentPath: m,
|
|
3985
3994
|
initial: n
|
|
3986
3995
|
}),
|
|
3987
|
-
[n, e,
|
|
3988
|
-
), p =
|
|
3996
|
+
[n, e, m]
|
|
3997
|
+
), p = R(() => {
|
|
3989
3998
|
const c = n.label || "Unlabelled field", v = {
|
|
3990
3999
|
...n,
|
|
3991
4000
|
label: c
|
|
3992
4001
|
};
|
|
3993
|
-
ut(
|
|
4002
|
+
ut(m, e + 1, v, s, o), u({
|
|
3994
4003
|
title: "Field duplicated",
|
|
3995
4004
|
description: `The field "${c}" has been duplicated`
|
|
3996
4005
|
});
|
|
3997
|
-
}, [n,
|
|
4006
|
+
}, [n, m, e, s, o, u]), b = R(
|
|
3998
4007
|
(c) => {
|
|
3999
4008
|
const v = i, w = s.fields[v];
|
|
4000
|
-
let
|
|
4001
|
-
c === "up" && e === 0 ? (
|
|
4002
|
-
const S = s.fields[
|
|
4009
|
+
let C = i, g = c === "up" ? e - 1 : e + 1;
|
|
4010
|
+
c === "up" && e === 0 ? (C = i - 1, g = s.fields[C].fields.length) : c === "down" && e === w.fields.length - 1 && (C = i + 1, g = 0);
|
|
4011
|
+
const S = s.fields[C];
|
|
4003
4012
|
a(
|
|
4004
4013
|
w,
|
|
4005
4014
|
v,
|
|
4006
4015
|
e,
|
|
4007
4016
|
S,
|
|
4008
|
-
|
|
4017
|
+
C,
|
|
4009
4018
|
g,
|
|
4010
4019
|
o
|
|
4011
4020
|
);
|
|
4012
4021
|
},
|
|
4013
4022
|
[i, s.fields, e, a, o]
|
|
4014
|
-
), y =
|
|
4023
|
+
), y = R(
|
|
4015
4024
|
(c) => {
|
|
4016
4025
|
const { files: v } = c.target;
|
|
4017
4026
|
if (!v || v.length !== 1) return;
|
|
4018
4027
|
const w = v.item(0);
|
|
4019
4028
|
if (w) {
|
|
4020
|
-
if (w.size >
|
|
4021
|
-
|
|
4029
|
+
if (w.size > $s) {
|
|
4030
|
+
f({
|
|
4022
4031
|
title: "File upload error",
|
|
4023
4032
|
description: `The file ${w.name} exceeded the maximum file size`
|
|
4024
4033
|
});
|
|
4025
4034
|
return;
|
|
4026
4035
|
}
|
|
4027
|
-
o(`${
|
|
4036
|
+
o(`${m}.${e}`, {
|
|
4028
4037
|
...n,
|
|
4029
4038
|
image: w
|
|
4030
4039
|
}).then();
|
|
4031
4040
|
}
|
|
4032
4041
|
},
|
|
4033
|
-
[n, e,
|
|
4042
|
+
[n, e, m, o, f]
|
|
4034
4043
|
);
|
|
4035
4044
|
return /* @__PURE__ */ l(tn, { draggableId: n.identifier, index: e, children: (c) => /* @__PURE__ */ l(
|
|
4036
|
-
|
|
4045
|
+
Ge,
|
|
4037
4046
|
{
|
|
4038
4047
|
ref: c.innerRef,
|
|
4039
4048
|
...c.draggableProps,
|
|
4040
4049
|
...c.dragHandleProps,
|
|
4041
4050
|
className: "mb-4",
|
|
4042
|
-
children: /* @__PURE__ */
|
|
4043
|
-
/* @__PURE__ */ l(bn, { ...
|
|
4051
|
+
children: /* @__PURE__ */ E("div", { className: "flex items-center justify-between gap-4 w-full", children: [
|
|
4052
|
+
/* @__PURE__ */ l(bn, { ...d }),
|
|
4044
4053
|
/* @__PURE__ */ l(
|
|
4045
4054
|
yn,
|
|
4046
4055
|
{
|
|
@@ -4060,63 +4069,63 @@ const lr = P((t) => {
|
|
|
4060
4069
|
lr.displayName = "FieldWithActions";
|
|
4061
4070
|
const ar = P((t) => {
|
|
4062
4071
|
var S;
|
|
4063
|
-
const { field: n, index: e, dropState: i } = t, r = (S = i[n.identifier]) == null ? void 0 : S.disabled, { setFieldValue: o, values: s } = xe(), a = mr(), { reorderSection:
|
|
4064
|
-
(
|
|
4065
|
-
for (const N of
|
|
4066
|
-
const
|
|
4067
|
-
o(`fields.${
|
|
4072
|
+
const { field: n, index: e, dropState: i } = t, r = (S = i[n.identifier]) == null ? void 0 : S.disabled, { setFieldValue: o, values: s } = xe(), a = mr(), { reorderSection: u } = sn(), { showInfo: f } = bt(), { fieldsOnly: m } = Yt(Ct), d = R(
|
|
4073
|
+
(x, F) => {
|
|
4074
|
+
for (const N of x) {
|
|
4075
|
+
const T = F.indexOf(N);
|
|
4076
|
+
o(`fields.${T}.condition`, null).then(), o(`fields.${T}.conditional`, !1).then();
|
|
4068
4077
|
}
|
|
4069
4078
|
},
|
|
4070
4079
|
[o]
|
|
4071
|
-
), p =
|
|
4072
|
-
(
|
|
4073
|
-
var
|
|
4074
|
-
const F = n.fields[
|
|
4080
|
+
), p = R(
|
|
4081
|
+
(x) => {
|
|
4082
|
+
var T;
|
|
4083
|
+
const F = n.fields[x];
|
|
4075
4084
|
if (!F) throw new Error("Could not find field to remove.");
|
|
4076
4085
|
const N = [];
|
|
4077
|
-
for (const
|
|
4078
|
-
((
|
|
4086
|
+
for (const D of s.fields)
|
|
4087
|
+
((T = D.condition) == null ? void 0 : T.identifier) === F.identifier && N.push(D);
|
|
4079
4088
|
return {
|
|
4080
4089
|
removing: F,
|
|
4081
4090
|
affectedSections: N,
|
|
4082
|
-
action: () => o(`fields.${e}.fields`, dt(n.fields,
|
|
4091
|
+
action: () => o(`fields.${e}.fields`, dt(n.fields, x))
|
|
4083
4092
|
};
|
|
4084
4093
|
},
|
|
4085
4094
|
[n.fields, s.fields, o, e]
|
|
4086
|
-
), b =
|
|
4087
|
-
(
|
|
4088
|
-
const { affectedSections: F, action: N, removing:
|
|
4089
|
-
N().then(),
|
|
4095
|
+
), b = R(
|
|
4096
|
+
(x) => {
|
|
4097
|
+
const { affectedSections: F, action: N, removing: T } = p(x), D = () => {
|
|
4098
|
+
N().then(), d(F, s.fields);
|
|
4090
4099
|
};
|
|
4091
4100
|
if (F.length > 0) {
|
|
4092
|
-
const
|
|
4101
|
+
const M = F.map((k) => k.label).join(", ");
|
|
4093
4102
|
a({
|
|
4094
4103
|
title: "Remove condition?",
|
|
4095
|
-
description: `${
|
|
4104
|
+
description: `${T.label} is being used as a condition, deleting it will remove the condition from the ${M} section(s).`,
|
|
4096
4105
|
action: "Remove",
|
|
4097
|
-
onAction:
|
|
4106
|
+
onAction: D
|
|
4098
4107
|
});
|
|
4099
4108
|
return;
|
|
4100
4109
|
}
|
|
4101
|
-
|
|
4110
|
+
D();
|
|
4102
4111
|
},
|
|
4103
|
-
[p,
|
|
4104
|
-
), y =
|
|
4105
|
-
const F = n.fields.map((X,
|
|
4112
|
+
[p, d, s.fields, a]
|
|
4113
|
+
), y = R(() => {
|
|
4114
|
+
const F = n.fields.map((X, le) => p(le)).flatMap((X) => X.affectedSections), N = F.length ? "Remove fields and conditions?" : "Remove fields?", T = n.fields.length, D = F.map((X) => X.label).join(", "), M = F.length ? `Deleting this section will remove the ${T} field(s) it contains and will remove the conditions from following sections: ${D}` : `Deleting this section will remove the ${T} field(s) it contains.`, k = dt(s.fields, e), V = () => o("fields", k);
|
|
4106
4115
|
if (F.length > 0) {
|
|
4107
4116
|
a({
|
|
4108
4117
|
title: N,
|
|
4109
|
-
description:
|
|
4118
|
+
description: M,
|
|
4110
4119
|
action: "Remove",
|
|
4111
4120
|
onAction: () => {
|
|
4112
|
-
|
|
4113
|
-
|
|
4121
|
+
V().then(() => {
|
|
4122
|
+
d(F, k);
|
|
4114
4123
|
});
|
|
4115
4124
|
}
|
|
4116
4125
|
});
|
|
4117
4126
|
return;
|
|
4118
4127
|
}
|
|
4119
|
-
|
|
4128
|
+
V().then();
|
|
4120
4129
|
}, [
|
|
4121
4130
|
n.fields,
|
|
4122
4131
|
s.fields,
|
|
@@ -4124,13 +4133,13 @@ const ar = P((t) => {
|
|
|
4124
4133
|
p,
|
|
4125
4134
|
o,
|
|
4126
4135
|
a,
|
|
4127
|
-
|
|
4128
|
-
]), c =
|
|
4129
|
-
(
|
|
4130
|
-
const F =
|
|
4131
|
-
|
|
4136
|
+
d
|
|
4137
|
+
]), c = R(
|
|
4138
|
+
(x) => {
|
|
4139
|
+
const F = x === "up" ? e - 1 : e + 1;
|
|
4140
|
+
u(i, n.identifier, e, F, s, o);
|
|
4132
4141
|
},
|
|
4133
|
-
[e,
|
|
4142
|
+
[e, u, i, n.identifier, s, o]
|
|
4134
4143
|
), v = O(
|
|
4135
4144
|
() => ({
|
|
4136
4145
|
index: e,
|
|
@@ -4139,70 +4148,70 @@ const ar = P((t) => {
|
|
|
4139
4148
|
conditionalSourceFields: ti(s.fields, e)
|
|
4140
4149
|
}),
|
|
4141
4150
|
[n, e, s.fields]
|
|
4142
|
-
), w =
|
|
4143
|
-
const
|
|
4144
|
-
...
|
|
4151
|
+
), w = R(() => {
|
|
4152
|
+
const x = n.label || "Untitled section", F = n.fields.map((T) => ({
|
|
4153
|
+
...T,
|
|
4145
4154
|
identifier: on()
|
|
4146
|
-
})), N = { ...n, label:
|
|
4147
|
-
ut("fields", e + 1, N, s, o),
|
|
4155
|
+
})), N = { ...n, label: x, fields: F };
|
|
4156
|
+
ut("fields", e + 1, N, s, o), f({
|
|
4148
4157
|
title: "Section duplicated",
|
|
4149
|
-
description: `The section "${
|
|
4158
|
+
description: `The section "${x}" has been duplicated.`
|
|
4150
4159
|
});
|
|
4151
|
-
}, [n, e, s, o,
|
|
4152
|
-
(
|
|
4160
|
+
}, [n, e, s, o, f]), C = R(
|
|
4161
|
+
(x) => {
|
|
4153
4162
|
ut(
|
|
4154
4163
|
`fields.${e}.fields`,
|
|
4155
4164
|
n.fields.length,
|
|
4156
|
-
|
|
4165
|
+
Bs[x],
|
|
4157
4166
|
s,
|
|
4158
4167
|
o
|
|
4159
4168
|
);
|
|
4160
4169
|
},
|
|
4161
4170
|
[e, n.fields.length, s, o]
|
|
4162
|
-
), g = sr(
|
|
4163
|
-
return /* @__PURE__ */ l(tn, { draggableId: n.identifier, index: e, children: (
|
|
4164
|
-
|
|
4171
|
+
), g = sr(C);
|
|
4172
|
+
return /* @__PURE__ */ l(tn, { draggableId: n.identifier, index: e, children: (x) => /* @__PURE__ */ l(
|
|
4173
|
+
Ge,
|
|
4165
4174
|
{
|
|
4166
|
-
ref:
|
|
4167
|
-
...
|
|
4168
|
-
...
|
|
4175
|
+
ref: x.innerRef,
|
|
4176
|
+
...x.draggableProps,
|
|
4177
|
+
...x.dragHandleProps,
|
|
4169
4178
|
variant: "outline",
|
|
4170
4179
|
className: "mb-4 w-full",
|
|
4171
|
-
children: /* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4173
|
-
!
|
|
4180
|
+
children: /* @__PURE__ */ E("div", { className: "flex items-center justify-between gap-3 w-full", children: [
|
|
4181
|
+
/* @__PURE__ */ E("div", { className: "flex grow flex-col gap-2 w-full", children: [
|
|
4182
|
+
!m && /* @__PURE__ */ l(bn, { ...v }),
|
|
4174
4183
|
/* @__PURE__ */ l(
|
|
4175
4184
|
en,
|
|
4176
4185
|
{
|
|
4177
4186
|
droppableId: n.identifier,
|
|
4178
4187
|
type: "SECTION",
|
|
4179
4188
|
isDropDisabled: r,
|
|
4180
|
-
children: (F) => /* @__PURE__ */
|
|
4189
|
+
children: (F) => /* @__PURE__ */ E(
|
|
4181
4190
|
"div",
|
|
4182
4191
|
{
|
|
4183
4192
|
className: "flex flex-col gap-0 w-full",
|
|
4184
4193
|
ref: F.innerRef,
|
|
4185
4194
|
...F.droppableProps,
|
|
4186
4195
|
children: [
|
|
4187
|
-
n.fields.map((N,
|
|
4196
|
+
n.fields.map((N, T) => /* @__PURE__ */ l(
|
|
4188
4197
|
lr,
|
|
4189
4198
|
{
|
|
4190
4199
|
field: N,
|
|
4191
|
-
index:
|
|
4200
|
+
index: T,
|
|
4192
4201
|
sectionIndex: e,
|
|
4193
4202
|
remove: () => {
|
|
4194
|
-
b(
|
|
4203
|
+
b(T);
|
|
4195
4204
|
}
|
|
4196
4205
|
},
|
|
4197
4206
|
N.identifier
|
|
4198
4207
|
)),
|
|
4199
4208
|
F.placeholder,
|
|
4200
|
-
/* @__PURE__ */
|
|
4201
|
-
/* @__PURE__ */ l(
|
|
4209
|
+
/* @__PURE__ */ E(B.Root, { children: [
|
|
4210
|
+
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(K, { type: "button", variant: "soft", size: "sm", children: [
|
|
4202
4211
|
/* @__PURE__ */ l(L, { icon: "RiAddLine" }),
|
|
4203
4212
|
" Add field"
|
|
4204
4213
|
] }) }),
|
|
4205
|
-
/* @__PURE__ */ l(
|
|
4214
|
+
/* @__PURE__ */ l(B.Content, { children: g.flat().map((N) => /* @__PURE__ */ E(B.Item, { onSelect: N.onSelect, children: [
|
|
4206
4215
|
N.icon,
|
|
4207
4216
|
N.children
|
|
4208
4217
|
] }, N.value)) })
|
|
@@ -4213,7 +4222,7 @@ const ar = P((t) => {
|
|
|
4213
4222
|
}
|
|
4214
4223
|
)
|
|
4215
4224
|
] }),
|
|
4216
|
-
!
|
|
4225
|
+
!m && /* @__PURE__ */ l(
|
|
4217
4226
|
yn,
|
|
4218
4227
|
{
|
|
4219
4228
|
index: e,
|
|
@@ -4232,58 +4241,58 @@ const Wn = (t, n) => {
|
|
|
4232
4241
|
for (const [e, i] of Object.entries(t))
|
|
4233
4242
|
if (i.identifier === n) return [i, e];
|
|
4234
4243
|
}, cr = P(() => {
|
|
4235
|
-
const { values: t, setFieldValue: n } = xe(), [e, i] = gr(Gs, t.fields,
|
|
4236
|
-
|
|
4237
|
-
i({ type: "update", state:
|
|
4244
|
+
const { values: t, setFieldValue: n } = xe(), [e, i] = gr(Gs, t.fields, $n), { reorderSection: r, reorderField: o } = sn(), { fieldsOnly: s } = Yt(Ct);
|
|
4245
|
+
H(() => {
|
|
4246
|
+
i({ type: "update", state: $n(t.fields) });
|
|
4238
4247
|
}, [i, t.fields]);
|
|
4239
|
-
const a =
|
|
4240
|
-
|
|
4241
|
-
}, []),
|
|
4242
|
-
(
|
|
4243
|
-
const { source:
|
|
4248
|
+
const a = R((m) => {
|
|
4249
|
+
m.type === "SECTION" && i({ type: "hold", fieldId: m.draggableId });
|
|
4250
|
+
}, []), u = R(
|
|
4251
|
+
(m) => {
|
|
4252
|
+
const { source: d, destination: p, type: b, reason: y, draggableId: c } = m;
|
|
4244
4253
|
if (i({ type: "release" }), !p || y === "CANCEL") return;
|
|
4245
4254
|
if (b === "ROOT") {
|
|
4246
|
-
r(e, c,
|
|
4255
|
+
r(e, c, d.index, p.index, t, n);
|
|
4247
4256
|
return;
|
|
4248
4257
|
}
|
|
4249
4258
|
if (b !== "SECTION") throw new Error("Unexpected droppable type.");
|
|
4250
|
-
const [v, w] = Wn(t.fields,
|
|
4259
|
+
const [v, w] = Wn(t.fields, d.droppableId) ?? [], [C, g] = Wn(t.fields, p.droppableId) ?? [];
|
|
4251
4260
|
o(
|
|
4252
4261
|
v,
|
|
4253
4262
|
w,
|
|
4254
|
-
|
|
4255
|
-
|
|
4263
|
+
d.index,
|
|
4264
|
+
C,
|
|
4256
4265
|
g,
|
|
4257
4266
|
p.index,
|
|
4258
4267
|
n
|
|
4259
4268
|
);
|
|
4260
4269
|
},
|
|
4261
4270
|
[t, o, n, r, e]
|
|
4262
|
-
),
|
|
4263
|
-
(
|
|
4264
|
-
Hr(
|
|
4271
|
+
), f = R(
|
|
4272
|
+
(m) => {
|
|
4273
|
+
Hr(m + 1, t, n);
|
|
4265
4274
|
},
|
|
4266
4275
|
[t, n]
|
|
4267
4276
|
);
|
|
4268
|
-
return /* @__PURE__ */ l(Xn, { onDragStart: a, onDragEnd:
|
|
4277
|
+
return /* @__PURE__ */ l(Xn, { onDragStart: a, onDragEnd: u, children: /* @__PURE__ */ l(en, { droppableId: "droppable", type: "ROOT", children: (m) => /* @__PURE__ */ E(
|
|
4269
4278
|
"div",
|
|
4270
4279
|
{
|
|
4271
4280
|
className: "flex flex-col gap-0",
|
|
4272
|
-
ref:
|
|
4273
|
-
...
|
|
4281
|
+
ref: m.innerRef,
|
|
4282
|
+
...m.droppableProps,
|
|
4274
4283
|
children: [
|
|
4275
|
-
t.fields.map((
|
|
4284
|
+
t.fields.map((d, p) => /* @__PURE__ */ E(Kn, { children: [
|
|
4276
4285
|
/* @__PURE__ */ l(
|
|
4277
4286
|
ar,
|
|
4278
4287
|
{
|
|
4279
|
-
field:
|
|
4288
|
+
field: d,
|
|
4280
4289
|
index: p,
|
|
4281
4290
|
dropState: e,
|
|
4282
4291
|
fieldsOnly: s
|
|
4283
4292
|
}
|
|
4284
4293
|
),
|
|
4285
|
-
!s && p !== t.fields.length - 1 && /* @__PURE__ */
|
|
4286
|
-
|
|
4294
|
+
!s && p !== t.fields.length - 1 && /* @__PURE__ */ E(
|
|
4295
|
+
K,
|
|
4287
4296
|
{
|
|
4288
4297
|
className: "mb-4",
|
|
4289
4298
|
type: "button",
|
|
@@ -4291,7 +4300,7 @@ const Wn = (t, n) => {
|
|
|
4291
4300
|
size: "sm",
|
|
4292
4301
|
accentColor: "base",
|
|
4293
4302
|
onClick: () => {
|
|
4294
|
-
|
|
4303
|
+
f(p);
|
|
4295
4304
|
},
|
|
4296
4305
|
children: [
|
|
4297
4306
|
/* @__PURE__ */ l(L, { icon: "RiAddLine" }),
|
|
@@ -4299,9 +4308,9 @@ const Wn = (t, n) => {
|
|
|
4299
4308
|
]
|
|
4300
4309
|
}
|
|
4301
4310
|
)
|
|
4302
|
-
] },
|
|
4303
|
-
/* @__PURE__ */
|
|
4304
|
-
|
|
4311
|
+
] }, d.identifier)),
|
|
4312
|
+
/* @__PURE__ */ E(
|
|
4313
|
+
K,
|
|
4305
4314
|
{
|
|
4306
4315
|
className: "mb-4",
|
|
4307
4316
|
type: "button",
|
|
@@ -4309,7 +4318,7 @@ const Wn = (t, n) => {
|
|
|
4309
4318
|
accentColor: "base",
|
|
4310
4319
|
size: "sm",
|
|
4311
4320
|
onClick: () => {
|
|
4312
|
-
|
|
4321
|
+
f(t.fields.length);
|
|
4313
4322
|
},
|
|
4314
4323
|
children: [
|
|
4315
4324
|
/* @__PURE__ */ l(L, { icon: "RiAddLine" }),
|
|
@@ -4317,7 +4326,7 @@ const Wn = (t, n) => {
|
|
|
4317
4326
|
]
|
|
4318
4327
|
}
|
|
4319
4328
|
),
|
|
4320
|
-
|
|
4329
|
+
m.placeholder
|
|
4321
4330
|
]
|
|
4322
4331
|
}
|
|
4323
4332
|
) }) });
|
|
@@ -4332,28 +4341,28 @@ const pl = P(
|
|
|
4332
4341
|
initialDescription: o,
|
|
4333
4342
|
initialFields: s,
|
|
4334
4343
|
showExplainerText: a = !0,
|
|
4335
|
-
showFormTitle:
|
|
4336
|
-
fieldsOnly:
|
|
4337
|
-
showTabs:
|
|
4338
|
-
disableRequiredFields:
|
|
4344
|
+
showFormTitle: u = !0,
|
|
4345
|
+
fieldsOnly: f = !1,
|
|
4346
|
+
showTabs: m = !0,
|
|
4347
|
+
disableRequiredFields: d = !1,
|
|
4339
4348
|
tabsListClassName: p
|
|
4340
|
-
} = t, { showError: b } = bt(), y =
|
|
4349
|
+
} = t, { showError: b } = bt(), y = R(
|
|
4341
4350
|
(g) => {
|
|
4342
4351
|
const S = {};
|
|
4343
4352
|
g.title || (S.title = "Title is required."), (!g.fields || g.fields.length === 0) && (S.fields = "At least one field is required.");
|
|
4344
|
-
let
|
|
4345
|
-
for (const [N,
|
|
4346
|
-
const
|
|
4353
|
+
let x = [];
|
|
4354
|
+
for (const [N, T] of g.fields.entries()) {
|
|
4355
|
+
const M = Ht.section.getFieldCreationSchema(
|
|
4347
4356
|
ti(g.fields, N),
|
|
4348
4357
|
`fields.${N}`
|
|
4349
|
-
).map((
|
|
4350
|
-
|
|
4351
|
-
for (const [
|
|
4352
|
-
const
|
|
4353
|
-
|
|
4358
|
+
).map((k) => k.field);
|
|
4359
|
+
x = [...x, ...M];
|
|
4360
|
+
for (const [k, V] of T.fields.entries()) {
|
|
4361
|
+
const le = Ht[V.type].getFieldCreationSchema(`fields.${N}.fields.${k}`).map((z) => z.field);
|
|
4362
|
+
x = [...x, ...le];
|
|
4354
4363
|
}
|
|
4355
4364
|
}
|
|
4356
|
-
const F = gn(
|
|
4365
|
+
const F = gn(x, g);
|
|
4357
4366
|
if (F && (S.fields = F.fields), he(S))
|
|
4358
4367
|
return b({
|
|
4359
4368
|
title: "Some form settings are invalid",
|
|
@@ -4381,29 +4390,29 @@ const pl = P(
|
|
|
4381
4390
|
meta: {
|
|
4382
4391
|
readonly: !1
|
|
4383
4392
|
}
|
|
4384
|
-
}), [v.values]),
|
|
4385
|
-
disableRequiredFields:
|
|
4386
|
-
fieldsOnly:
|
|
4387
|
-
}), [
|
|
4388
|
-
return /* @__PURE__ */ l(Ct, { value:
|
|
4389
|
-
|
|
4393
|
+
}), [v.values]), C = O(() => ({
|
|
4394
|
+
disableRequiredFields: d,
|
|
4395
|
+
fieldsOnly: f
|
|
4396
|
+
}), [d, f]);
|
|
4397
|
+
return /* @__PURE__ */ l(Ct, { value: C, children: /* @__PURE__ */ l(Ie.Root, { ref: n, defaultValue: "edit", children: /* @__PURE__ */ E("div", { className: "flex flex-col gap-2", children: [
|
|
4398
|
+
m && /* @__PURE__ */ E(
|
|
4390
4399
|
Ie.List,
|
|
4391
4400
|
{
|
|
4392
4401
|
className: je("sticky top-0 z-[2000] flex bg-(--color-background)", p),
|
|
4393
4402
|
children: [
|
|
4394
|
-
/* @__PURE__ */ l(Ie.Trigger, { className: "grow", value: "edit", children: /* @__PURE__ */
|
|
4403
|
+
/* @__PURE__ */ l(Ie.Trigger, { className: "grow", value: "edit", children: /* @__PURE__ */ E("div", { className: "flex items-center gap-2", children: [
|
|
4395
4404
|
/* @__PURE__ */ l(L, { icon: "RiPencilLine" }),
|
|
4396
4405
|
"Edit form"
|
|
4397
4406
|
] }) }),
|
|
4398
|
-
/* @__PURE__ */ l(Ie.Trigger, { className: "grow", value: "preview", children: /* @__PURE__ */
|
|
4407
|
+
/* @__PURE__ */ l(Ie.Trigger, { className: "grow", value: "preview", children: /* @__PURE__ */ E("div", { className: "flex items-center gap-2", children: [
|
|
4399
4408
|
/* @__PURE__ */ l(L, { icon: "RiEyeLine" }),
|
|
4400
4409
|
"Preview form"
|
|
4401
4410
|
] }) })
|
|
4402
4411
|
]
|
|
4403
4412
|
}
|
|
4404
4413
|
),
|
|
4405
|
-
/* @__PURE__ */
|
|
4406
|
-
a && /* @__PURE__ */
|
|
4414
|
+
/* @__PURE__ */ E(Ie.Content, { value: "edit", children: [
|
|
4415
|
+
a && /* @__PURE__ */ E(ae, { children: [
|
|
4407
4416
|
"Create your form using various field types. Sections can be",
|
|
4408
4417
|
" ",
|
|
4409
4418
|
/* @__PURE__ */ l("strong", { children: "conditionally rendered" }),
|
|
@@ -4411,21 +4420,21 @@ const pl = P(
|
|
|
4411
4420
|
" ",
|
|
4412
4421
|
/* @__PURE__ */ l("strong", { children: "answers to fields in preceding sections. " })
|
|
4413
4422
|
] }),
|
|
4414
|
-
/* @__PURE__ */
|
|
4415
|
-
/* @__PURE__ */
|
|
4416
|
-
|
|
4423
|
+
/* @__PURE__ */ E("form", { className: "mt-3 flex flex-col gap-2", id: lt, onSubmit: v.handleSubmit, children: [
|
|
4424
|
+
/* @__PURE__ */ E(Zt, { value: v, children: [
|
|
4425
|
+
u && /* @__PURE__ */ E(pe, { children: [
|
|
4417
4426
|
/* @__PURE__ */ l(
|
|
4418
4427
|
We,
|
|
4419
4428
|
{
|
|
4420
4429
|
name: "title",
|
|
4421
|
-
render: ({ setValue: g, value: S, meta:
|
|
4422
|
-
|
|
4430
|
+
render: ({ setValue: g, value: S, meta: x }) => /* @__PURE__ */ l(ni, { severity: "danger", helpText: x.error ?? null, children: /* @__PURE__ */ l(
|
|
4431
|
+
ee.Root,
|
|
4423
4432
|
{
|
|
4424
4433
|
variant: "outline",
|
|
4425
4434
|
size: "md",
|
|
4426
|
-
accentColor:
|
|
4435
|
+
accentColor: x.error ? ge.danger : "primary",
|
|
4427
4436
|
children: /* @__PURE__ */ l(
|
|
4428
|
-
|
|
4437
|
+
ee.Field,
|
|
4429
4438
|
{
|
|
4430
4439
|
placeholder: "Form title",
|
|
4431
4440
|
value: S,
|
|
@@ -4449,8 +4458,8 @@ const pl = P(
|
|
|
4449
4458
|
className: "field-sizing-content",
|
|
4450
4459
|
placeholder: "Explain the purpose of this form",
|
|
4451
4460
|
value: S,
|
|
4452
|
-
onChange: (
|
|
4453
|
-
g(
|
|
4461
|
+
onChange: (x) => {
|
|
4462
|
+
g(x.target.value);
|
|
4454
4463
|
},
|
|
4455
4464
|
resize: "vertical",
|
|
4456
4465
|
maxLength: 1e3,
|
|
@@ -4470,42 +4479,42 @@ const pl = P(
|
|
|
4470
4479
|
}
|
|
4471
4480
|
)
|
|
4472
4481
|
] }),
|
|
4473
|
-
/* @__PURE__ */
|
|
4474
|
-
e && /* @__PURE__ */ l(
|
|
4475
|
-
/* @__PURE__ */ l(
|
|
4482
|
+
/* @__PURE__ */ E("div", { className: "flex items-center justify-end gap-2", children: [
|
|
4483
|
+
e && /* @__PURE__ */ l(K, { type: "button", variant: "solid", accentColor: "base", onClick: e, children: "Cancel" }),
|
|
4484
|
+
/* @__PURE__ */ l(K, { type: "submit", children: "Save form" })
|
|
4476
4485
|
] })
|
|
4477
4486
|
] })
|
|
4478
4487
|
] }),
|
|
4479
|
-
/* @__PURE__ */ l(Ie.Content, { value: "preview", children: /* @__PURE__ */ l(qs, { schema: w, hideTitle: !
|
|
4488
|
+
/* @__PURE__ */ l(Ie.Content, { value: "preview", children: /* @__PURE__ */ l(qs, { schema: w, hideTitle: !u }) })
|
|
4480
4489
|
] }) }) });
|
|
4481
4490
|
})
|
|
4482
4491
|
);
|
|
4483
4492
|
export {
|
|
4484
|
-
|
|
4493
|
+
W as BaseField,
|
|
4485
4494
|
Jn as BaseFormElement,
|
|
4486
|
-
|
|
4487
|
-
|
|
4495
|
+
$i as BaseSelectField,
|
|
4496
|
+
He as BooleanField,
|
|
4488
4497
|
Ui as BooleanInput,
|
|
4489
|
-
|
|
4498
|
+
Bt as DateField,
|
|
4490
4499
|
Wi as DateInput,
|
|
4491
|
-
|
|
4500
|
+
q as FieldSection,
|
|
4492
4501
|
rr as FieldSectionLayout,
|
|
4493
4502
|
mn as FieldTypeToClsMapping,
|
|
4494
|
-
|
|
4503
|
+
Bs as FieldTypeToEmptyFieldMapping,
|
|
4495
4504
|
Qn as FileCard,
|
|
4496
4505
|
nn as FileIcon,
|
|
4497
4506
|
pl as FormBuilder,
|
|
4498
4507
|
qs as FormRenderer,
|
|
4499
4508
|
ks as ImageCard,
|
|
4500
|
-
|
|
4509
|
+
Bi as ImageViewer,
|
|
4501
4510
|
Is as ImageViewerProvider,
|
|
4502
4511
|
ni as InputWithHelpText,
|
|
4503
|
-
|
|
4504
|
-
|
|
4512
|
+
ne as InputWithLabel,
|
|
4513
|
+
ie as InputWithLabelAndHelpText,
|
|
4505
4514
|
Ue as LONG_TEXT_FIELD_MAX_LENGTH,
|
|
4506
4515
|
pt as MultiSelectField,
|
|
4507
4516
|
ji as MultiSelectInput,
|
|
4508
|
-
|
|
4517
|
+
qe as MultiStringField,
|
|
4509
4518
|
Vi as MultiStringInput,
|
|
4510
4519
|
be as NumberField,
|
|
4511
4520
|
qi as NumberInput,
|
|
@@ -4514,12 +4523,12 @@ export {
|
|
|
4514
4523
|
Vt as QrField,
|
|
4515
4524
|
Hi as QrInput,
|
|
4516
4525
|
Gi as QrScanner,
|
|
4517
|
-
|
|
4526
|
+
$t as RadioField,
|
|
4518
4527
|
Ki as RadioInput,
|
|
4519
4528
|
ge as SEVERITY_COLOR_MAPPING,
|
|
4520
4529
|
ot as SHORT_TEXT_FIELD_MAX_LENGTH,
|
|
4521
4530
|
zr as SUPPORTED_IMAGE_FILE_TYPES,
|
|
4522
|
-
|
|
4531
|
+
Br as SUPPORTED_PDF_FILE_TYPES,
|
|
4523
4532
|
_r as SUPPORTED_SPREADSHEET_FILE_EXTENSIONS,
|
|
4524
4533
|
gt as SelectField,
|
|
4525
4534
|
Xi as SelectInput,
|
|
@@ -4536,7 +4545,7 @@ export {
|
|
|
4536
4545
|
Ws as deserializeFields,
|
|
4537
4546
|
Z as emptyBaseField,
|
|
4538
4547
|
Ns as emptyBooleanField,
|
|
4539
|
-
|
|
4548
|
+
Rs as emptyDateField,
|
|
4540
4549
|
Fs as emptyMultiSelectField,
|
|
4541
4550
|
Ss as emptyMultiStringField,
|
|
4542
4551
|
Ls as emptyNumberField,
|
|
@@ -4552,7 +4561,7 @@ export {
|
|
|
4552
4561
|
js as getFieldsMapping,
|
|
4553
4562
|
vn as initializeFormValues,
|
|
4554
4563
|
nr as isConditionMet,
|
|
4555
|
-
|
|
4564
|
+
$s as maxFileSizeB,
|
|
4556
4565
|
Vs as maxFileSizeKB,
|
|
4557
4566
|
st as maxFileSizeMB,
|
|
4558
4567
|
ir as useFieldInput,
|