@overmap-ai/forms 1.0.17 → 1.0.18
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/builder/constants.d.ts +1 -1
- package/dist/form/builder/utils.d.ts +1 -1
- package/dist/form/fields/ScanField/ScanField.d.ts +21 -0
- package/dist/form/fields/ScanField/ScanInput.d.ts +8 -0
- package/dist/form/fields/ScanField/index.d.ts +3 -0
- package/dist/form/fields/{QrField → ScanField}/typings.d.ts +1 -1
- package/dist/form/fields/constants.d.ts +2 -2
- package/dist/form/fields/index.d.ts +1 -1
- package/dist/form/fields/typings.d.ts +2 -2
- package/dist/forms.js +396 -403
- package/dist/forms.umd.cjs +6 -6
- package/package.json +5 -5
- package/dist/form/fields/QrField/QrField.d.ts +0 -21
- package/dist/form/fields/QrField/QrInput.d.ts +0 -8
- package/dist/form/fields/QrField/index.d.ts +0 -3
package/dist/forms.js
CHANGED
|
@@ -2,18 +2,18 @@ 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
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
|
|
5
|
+
import { RiIcon as L, Text as ae, Spinner as Wn, useToast as Ge, ButtonGroup as Kt, Tooltip as Ee, IconButton as J, Separator as jn, Input as ee, Badge as Ot, Checkbox as at, Popover as Be, Button as G, DayPicker as fr, Menu as B, RadioGroup as It, TextArea as qn, Card as Ke, 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
|
|
9
|
-
import { useField as
|
|
10
|
-
import { RiListCheck as vr, RiCheckboxCircleLine as yr, RiCalendarLine as br, RiCheckboxLine as xr, RiHashtag as wr,
|
|
11
|
-
import { DragDropContext as Xn, Droppable as
|
|
8
|
+
import { memo as P, useMemo as O, forwardRef as Xe, useCallback as R, createContext as Gn, useContext as hr, useState as K, useRef as bt, useEffect as H, Fragment as Kn, useId as pr, use as Xt, useReducer as gr } from "react";
|
|
9
|
+
import { useField as Yt, 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, RiRadioButtonFill as Cr, RiFullscreenLine 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
|
+
import { DragDropContext as Xn, Droppable as Qt, Draggable as en } from "@hello-pangea/dnd";
|
|
12
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";
|
|
16
|
-
import Mr from "
|
|
16
|
+
import { useZxing as Mr } from "react-zxing";
|
|
17
17
|
import Ve from "lodash.set";
|
|
18
18
|
import kr from "lodash.clonedeep";
|
|
19
19
|
const zr = ["image/jpeg", "image/png", "image/svg+xml"], _r = [
|
|
@@ -23,13 +23,13 @@ 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
|
-
], Br = ["application/pdf"],
|
|
26
|
+
], Br = ["application/pdf"], tn = P((t) => {
|
|
27
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
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
tn.displayName = "FileIcon";
|
|
31
|
+
const Jn = P(
|
|
32
|
+
Xe((t, n) => {
|
|
33
33
|
const { file: e, className: i, error: r, rightSlot: o, ...s } = t;
|
|
34
34
|
return /* @__PURE__ */ E(
|
|
35
35
|
"div",
|
|
@@ -44,22 +44,22 @@ const Qn = P(
|
|
|
44
44
|
ref: n,
|
|
45
45
|
...s,
|
|
46
46
|
children: [
|
|
47
|
-
r ? /* @__PURE__ */ l(L, { icon: "RiFileWarningLine" }) : /* @__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(
|
|
47
|
+
r ? /* @__PURE__ */ l(L, { icon: "RiFileWarningLine" }) : /* @__PURE__ */ l(tn, { fileType: (e == null ? void 0 : e.type) ?? "" }),
|
|
48
|
+
r || (e ? /* @__PURE__ */ l(ae, { className: "truncate", children: e.name }) : /* @__PURE__ */ l("div", { className: "flex w-full justify-center", children: /* @__PURE__ */ l(Wn, {}) })),
|
|
49
49
|
o
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
53
|
})
|
|
54
54
|
);
|
|
55
|
-
|
|
55
|
+
Jn.displayName = "FileCard";
|
|
56
56
|
const ge = {
|
|
57
57
|
danger: "danger",
|
|
58
58
|
warning: "warning",
|
|
59
59
|
info: "base",
|
|
60
60
|
success: "success"
|
|
61
61
|
};
|
|
62
|
-
class
|
|
62
|
+
class Zn {
|
|
63
63
|
constructor(n) {
|
|
64
64
|
I(this, "type");
|
|
65
65
|
I(this, "identifier");
|
|
@@ -83,12 +83,12 @@ class Jn {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
const
|
|
86
|
+
const Q = {
|
|
87
87
|
label: "",
|
|
88
88
|
description: "",
|
|
89
89
|
required: !1
|
|
90
90
|
};
|
|
91
|
-
class W extends
|
|
91
|
+
class W extends Zn {
|
|
92
92
|
constructor(e) {
|
|
93
93
|
const { label: i, required: r, image: o, fieldValidators: s = [], formValidators: a = [], ...u } = e;
|
|
94
94
|
super(u);
|
|
@@ -151,8 +151,8 @@ class W extends Jn {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
I(W, "fieldTypeName"), I(W, "fieldTypeDescription");
|
|
154
|
-
const
|
|
155
|
-
const { id: n, field: e, formId: i, size: r, showInputOnly: o, onValuesChange: s, ...a } = t, [u, f, m] =
|
|
154
|
+
const Z = (t) => {
|
|
155
|
+
const { id: n, field: e, formId: i, size: r, showInputOnly: o, onValuesChange: s, ...a } = t, [u, f, m] = Yt(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
156
|
...u,
|
|
157
157
|
// name and value not being overridden
|
|
158
158
|
onChange: (S) => {
|
|
@@ -179,13 +179,13 @@ const J = (t) => {
|
|
|
179
179
|
/* Props that should be spread on the html element representing the field */
|
|
180
180
|
{ ...a, "aria-labelledby": c }
|
|
181
181
|
];
|
|
182
|
-
},
|
|
183
|
-
let
|
|
182
|
+
}, nn = [];
|
|
183
|
+
let Je;
|
|
184
184
|
const Vr = new Uint8Array(16);
|
|
185
185
|
function $r() {
|
|
186
|
-
if (!
|
|
186
|
+
if (!Je && (Je = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Je))
|
|
187
187
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
188
|
-
return
|
|
188
|
+
return Je(Vr);
|
|
189
189
|
}
|
|
190
190
|
const U = [];
|
|
191
191
|
for (let t = 0; t < 256; ++t)
|
|
@@ -193,12 +193,12 @@ for (let t = 0; t < 256; ++t)
|
|
|
193
193
|
function Ur(t, n = 0) {
|
|
194
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
|
-
const Wr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto),
|
|
196
|
+
const Wr = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), En = {
|
|
197
197
|
randomUUID: Wr
|
|
198
198
|
};
|
|
199
199
|
function jr(t, n, e) {
|
|
200
|
-
if (
|
|
201
|
-
return
|
|
200
|
+
if (En.randomUUID && !t)
|
|
201
|
+
return En.randomUUID();
|
|
202
202
|
t = t || {};
|
|
203
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);
|
|
@@ -222,7 +222,7 @@ function Mt(t, n, e) {
|
|
|
222
222
|
if (!r) throw new Error("Could not find field to reorder.");
|
|
223
223
|
return i.splice(e, 0, r), i;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function Qn(t, n, e) {
|
|
226
226
|
const i = Array.from(t ?? []);
|
|
227
227
|
return i.splice(n, 0, e), i;
|
|
228
228
|
}
|
|
@@ -230,7 +230,7 @@ function dt(t, n) {
|
|
|
230
230
|
const e = Array.from(t);
|
|
231
231
|
return e.splice(n, 1), e;
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const rn = () => jr(), ei = (t, n) => {
|
|
234
234
|
if (!n) return null;
|
|
235
235
|
for (const e of t)
|
|
236
236
|
if (e.type === "section") {
|
|
@@ -242,13 +242,13 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
242
242
|
}, ti = (t, n) => t.filter((e, i) => i < n).flatMap((e) => e.fields), ut = (t, n, e, i, r) => {
|
|
243
243
|
const o = {
|
|
244
244
|
...e,
|
|
245
|
-
identifier:
|
|
245
|
+
identifier: rn()
|
|
246
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))
|
|
250
250
|
throw new Error("Parent path must point to an array.");
|
|
251
|
-
const a =
|
|
251
|
+
const a = Qn(s, n, o);
|
|
252
252
|
r(t, a).then();
|
|
253
253
|
}, Hr = (t, n, e) => {
|
|
254
254
|
const i = {
|
|
@@ -256,8 +256,8 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
256
256
|
label: ""
|
|
257
257
|
};
|
|
258
258
|
ut("fields", t, i, n, e);
|
|
259
|
-
},
|
|
260
|
-
const { showError: t } =
|
|
259
|
+
}, on = () => {
|
|
260
|
+
const { showError: t } = Ge(), n = R(
|
|
261
261
|
(i, r, o, s, a, u) => {
|
|
262
262
|
const f = i[r];
|
|
263
263
|
if (!f) throw new Error("Could not find section context.");
|
|
@@ -298,7 +298,7 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
298
298
|
}
|
|
299
299
|
f(`fields.${r}.fields`, dt(i.fields, o)).then(), f(
|
|
300
300
|
`fields.${a}.fields`,
|
|
301
|
-
|
|
301
|
+
Qn(s.fields, u, d)
|
|
302
302
|
).then();
|
|
303
303
|
}
|
|
304
304
|
},
|
|
@@ -313,14 +313,14 @@ const on = () => jr(), ei = (t, n) => {
|
|
|
313
313
|
] });
|
|
314
314
|
}, ii = Gn(() => {
|
|
315
315
|
throw new Error("No ImageViewerProvider found");
|
|
316
|
-
}),
|
|
316
|
+
}), sn = () => hr(ii);
|
|
317
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);
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function In(t, n) {
|
|
324
324
|
if (typeof t == "function")
|
|
325
325
|
return t(n);
|
|
326
326
|
t != null && (t.current = n);
|
|
@@ -329,14 +329,14 @@ function ri(...t) {
|
|
|
329
329
|
return (n) => {
|
|
330
330
|
let e = !1;
|
|
331
331
|
const i = t.map((r) => {
|
|
332
|
-
const o =
|
|
332
|
+
const o = In(r, n);
|
|
333
333
|
return !e && typeof o == "function" && (e = !0), o;
|
|
334
334
|
});
|
|
335
335
|
if (e)
|
|
336
336
|
return () => {
|
|
337
337
|
for (let r = 0; r < i.length; r++) {
|
|
338
338
|
const o = i[r];
|
|
339
|
-
typeof o == "function" ? o() :
|
|
339
|
+
typeof o == "function" ? o() : In(t[r], null);
|
|
340
340
|
}
|
|
341
341
|
};
|
|
342
342
|
};
|
|
@@ -410,11 +410,11 @@ function Xr(...t) {
|
|
|
410
410
|
}
|
|
411
411
|
var ft = globalThis != null && globalThis.document ? h.useLayoutEffect : () => {
|
|
412
412
|
}, Yr = h.useId || (() => {
|
|
413
|
-
}),
|
|
413
|
+
}), Jr = 0;
|
|
414
414
|
function Nt(t) {
|
|
415
415
|
const [n, e] = h.useState(Yr());
|
|
416
416
|
return ft(() => {
|
|
417
|
-
e((i) => i ?? String(
|
|
417
|
+
e((i) => i ?? String(Jr++));
|
|
418
418
|
}, [t]), t || (n ? `radix-${n}` : "");
|
|
419
419
|
}
|
|
420
420
|
function ve(t) {
|
|
@@ -426,13 +426,13 @@ function ve(t) {
|
|
|
426
426
|
return (i = n.current) == null ? void 0 : i.call(n, ...e);
|
|
427
427
|
}, []);
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function Zr({
|
|
430
430
|
prop: t,
|
|
431
431
|
defaultProp: n,
|
|
432
432
|
onChange: e = () => {
|
|
433
433
|
}
|
|
434
434
|
}) {
|
|
435
|
-
const [i, r] =
|
|
435
|
+
const [i, r] = Qr({ defaultProp: n, onChange: e }), o = t !== void 0, s = o ? t : i, a = ve(e), u = h.useCallback(
|
|
436
436
|
(f) => {
|
|
437
437
|
if (o) {
|
|
438
438
|
const d = typeof f == "function" ? f(t) : f;
|
|
@@ -444,7 +444,7 @@ function Jr({
|
|
|
444
444
|
);
|
|
445
445
|
return [s, u];
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function Qr({
|
|
448
448
|
defaultProp: t,
|
|
449
449
|
onChange: n
|
|
450
450
|
}) {
|
|
@@ -453,7 +453,7 @@ function Zr({
|
|
|
453
453
|
r.current !== i && (o(i), r.current = i);
|
|
454
454
|
}, [i, r, o]), e;
|
|
455
455
|
}
|
|
456
|
-
var
|
|
456
|
+
var ln = 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
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);
|
|
@@ -461,7 +461,7 @@ var an = h.forwardRef((t, n) => {
|
|
|
461
461
|
}
|
|
462
462
|
return /* @__PURE__ */ l(kt, { ...i, ref: n, children: e });
|
|
463
463
|
});
|
|
464
|
-
|
|
464
|
+
ln.displayName = "Slot";
|
|
465
465
|
var kt = h.forwardRef((t, n) => {
|
|
466
466
|
const { children: e, ...i } = t;
|
|
467
467
|
if (h.isValidElement(e)) {
|
|
@@ -513,7 +513,7 @@ var ro = [
|
|
|
513
513
|
"ul"
|
|
514
514
|
], ce = ro.reduce((t, n) => {
|
|
515
515
|
const e = h.forwardRef((i, r) => {
|
|
516
|
-
const { asChild: o, ...s } = i, a = o ?
|
|
516
|
+
const { asChild: o, ...s } = i, a = o ? ln : n;
|
|
517
517
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ l(a, { ...s, ref: r });
|
|
518
518
|
});
|
|
519
519
|
return e.displayName = `Primitive.${n}`, { ...t, [n]: e };
|
|
@@ -530,7 +530,7 @@ function so(t, n = globalThis == null ? void 0 : globalThis.document) {
|
|
|
530
530
|
return n.addEventListener("keydown", i, { capture: !0 }), () => n.removeEventListener("keydown", i, { capture: !0 });
|
|
531
531
|
}, [e, n]);
|
|
532
532
|
}
|
|
533
|
-
var lo = "DismissableLayer", zt = "dismissableLayer.update", ao = "dismissableLayer.pointerDownOutside", co = "dismissableLayer.focusOutside",
|
|
533
|
+
var lo = "DismissableLayer", zt = "dismissableLayer.update", ao = "dismissableLayer.pointerDownOutside", co = "dismissableLayer.focusOutside", Sn, oi = h.createContext({
|
|
534
534
|
layers: /* @__PURE__ */ new Set(),
|
|
535
535
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
536
536
|
branches: /* @__PURE__ */ new Set()
|
|
@@ -555,11 +555,11 @@ var lo = "DismissableLayer", zt = "dismissableLayer.update", ao = "dismissableLa
|
|
|
555
555
|
C === f.layers.size - 1 && (i == null || i(N), !N.defaultPrevented && a && (N.preventDefault(), a()));
|
|
556
556
|
}, p), h.useEffect(() => {
|
|
557
557
|
if (m)
|
|
558
|
-
return e && (f.layersWithOutsidePointerEventsDisabled.size === 0 && (
|
|
559
|
-
e && f.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents =
|
|
558
|
+
return e && (f.layersWithOutsidePointerEventsDisabled.size === 0 && (Sn = p.body.style.pointerEvents, p.body.style.pointerEvents = "none"), f.layersWithOutsidePointerEventsDisabled.add(m)), f.layers.add(m), Nn(), () => {
|
|
559
|
+
e && f.layersWithOutsidePointerEventsDisabled.size === 1 && (p.body.style.pointerEvents = Sn);
|
|
560
560
|
};
|
|
561
561
|
}, [m, p, e, f]), h.useEffect(() => () => {
|
|
562
|
-
m && (f.layers.delete(m), f.layersWithOutsidePointerEventsDisabled.delete(m),
|
|
562
|
+
m && (f.layers.delete(m), f.layersWithOutsidePointerEventsDisabled.delete(m), Nn());
|
|
563
563
|
}, [m, f]), h.useEffect(() => {
|
|
564
564
|
const N = () => b({});
|
|
565
565
|
return document.addEventListener(zt, N), () => document.removeEventListener(zt, N);
|
|
@@ -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 Nn() {
|
|
642
642
|
const t = new CustomEvent(zt);
|
|
643
643
|
document.dispatchEvent(t);
|
|
644
644
|
}
|
|
@@ -646,7 +646,7 @@ 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 Tt = "focusScope.autoFocusOnMount", Rt = "focusScope.autoFocusOnUnmount",
|
|
649
|
+
var Tt = "focusScope.autoFocusOnMount", Rt = "focusScope.autoFocusOnUnmount", Tn = { bubbles: !1, cancelable: !0 }, po = "FocusScope", ai = h.forwardRef((t, n) => {
|
|
650
650
|
const {
|
|
651
651
|
loop: e = !1,
|
|
652
652
|
trapped: i = !1,
|
|
@@ -685,16 +685,16 @@ var Tt = "focusScope.autoFocusOnMount", Rt = "focusScope.autoFocusOnUnmount", Rn
|
|
|
685
685
|
}
|
|
686
686
|
}, [i, a, b.paused]), h.useEffect(() => {
|
|
687
687
|
if (a) {
|
|
688
|
-
|
|
688
|
+
Fn.add(b);
|
|
689
689
|
const c = document.activeElement;
|
|
690
690
|
if (!a.contains(c)) {
|
|
691
|
-
const w = new CustomEvent(Tt,
|
|
691
|
+
const w = new CustomEvent(Tt, Tn);
|
|
692
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
695
|
a.removeEventListener(Tt, f), setTimeout(() => {
|
|
696
|
-
const w = new CustomEvent(Rt,
|
|
697
|
-
a.addEventListener(Rt, m), a.dispatchEvent(w), w.defaultPrevented || ue(c ?? document.body, { select: !0 }), a.removeEventListener(Rt, m),
|
|
696
|
+
const w = new CustomEvent(Rt, Tn);
|
|
697
|
+
a.addEventListener(Rt, m), a.dispatchEvent(w), w.defaultPrevented || ue(c ?? document.body, { select: !0 }), a.removeEventListener(Rt, m), Fn.remove(b);
|
|
698
698
|
}, 0);
|
|
699
699
|
};
|
|
700
700
|
}
|
|
@@ -719,7 +719,7 @@ function go(t, { select: n = !1 } = {}) {
|
|
|
719
719
|
if (ue(i, { select: n }), document.activeElement !== e) return;
|
|
720
720
|
}
|
|
721
721
|
function vo(t) {
|
|
722
|
-
const n = ci(t), e =
|
|
722
|
+
const n = ci(t), e = Rn(n, t), i = Rn(n.reverse(), t);
|
|
723
723
|
return [e, i];
|
|
724
724
|
}
|
|
725
725
|
function ci(t) {
|
|
@@ -732,7 +732,7 @@ function ci(t) {
|
|
|
732
732
|
for (; e.nextNode(); ) n.push(e.currentNode);
|
|
733
733
|
return n;
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function Rn(t, n) {
|
|
736
736
|
for (const e of t)
|
|
737
737
|
if (!yo(e, { upTo: n })) return e;
|
|
738
738
|
}
|
|
@@ -754,21 +754,21 @@ function ue(t, { select: n = !1 } = {}) {
|
|
|
754
754
|
t.focus({ preventScroll: !0 }), t !== e && bo(t) && n && t.select();
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
|
-
var
|
|
757
|
+
var Fn = xo();
|
|
758
758
|
function xo() {
|
|
759
759
|
let t = [];
|
|
760
760
|
return {
|
|
761
761
|
add(n) {
|
|
762
762
|
const e = t[0];
|
|
763
|
-
n !== e && (e == null || e.pause()), t =
|
|
763
|
+
n !== e && (e == null || e.pause()), t = Ln(t, n), t.unshift(n);
|
|
764
764
|
},
|
|
765
765
|
remove(n) {
|
|
766
766
|
var e;
|
|
767
|
-
t =
|
|
767
|
+
t = Ln(t, n), (e = t[0]) == null || e.resume();
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Ln(t, n) {
|
|
772
772
|
const e = [...t], i = e.indexOf(n);
|
|
773
773
|
return i !== -1 && e.splice(i, 1), e;
|
|
774
774
|
}
|
|
@@ -806,19 +806,19 @@ function Io(t) {
|
|
|
806
806
|
}
|
|
807
807
|
});
|
|
808
808
|
return h.useEffect(() => {
|
|
809
|
-
const f =
|
|
809
|
+
const f = Ze(i.current);
|
|
810
810
|
o.current = a === "mounted" ? f : "none";
|
|
811
811
|
}, [a]), ft(() => {
|
|
812
812
|
const f = i.current, m = r.current;
|
|
813
813
|
if (m !== t) {
|
|
814
|
-
const p = o.current, b =
|
|
814
|
+
const p = o.current, b = Ze(f);
|
|
815
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
817
|
}, [t, u]), ft(() => {
|
|
818
818
|
if (n) {
|
|
819
819
|
let f;
|
|
820
820
|
const m = n.ownerDocument.defaultView ?? window, d = (b) => {
|
|
821
|
-
const c =
|
|
821
|
+
const c = Ze(i.current).includes(b.animationName);
|
|
822
822
|
if (b.target === n && c && (u("ANIMATION_END"), !r.current)) {
|
|
823
823
|
const v = n.style.animationFillMode;
|
|
824
824
|
n.style.animationFillMode = "forwards", f = m.setTimeout(() => {
|
|
@@ -826,7 +826,7 @@ function Io(t) {
|
|
|
826
826
|
});
|
|
827
827
|
}
|
|
828
828
|
}, p = (b) => {
|
|
829
|
-
b.target === n && (o.current =
|
|
829
|
+
b.target === n && (o.current = Ze(i.current));
|
|
830
830
|
};
|
|
831
831
|
return n.addEventListener("animationstart", p), n.addEventListener("animationcancel", d), n.addEventListener("animationend", d), () => {
|
|
832
832
|
m.clearTimeout(f), n.removeEventListener("animationstart", p), n.removeEventListener("animationcancel", d), n.removeEventListener("animationend", d);
|
|
@@ -840,7 +840,7 @@ function Io(t) {
|
|
|
840
840
|
}, [])
|
|
841
841
|
};
|
|
842
842
|
}
|
|
843
|
-
function
|
|
843
|
+
function Ze(t) {
|
|
844
844
|
return (t == null ? void 0 : t.animationName) || "none";
|
|
845
845
|
}
|
|
846
846
|
function So(t) {
|
|
@@ -852,12 +852,12 @@ var Ft = 0;
|
|
|
852
852
|
function No() {
|
|
853
853
|
h.useEffect(() => {
|
|
854
854
|
const t = document.querySelectorAll("[data-radix-focus-guard]");
|
|
855
|
-
return document.body.insertAdjacentElement("afterbegin", t[0] ??
|
|
855
|
+
return document.body.insertAdjacentElement("afterbegin", t[0] ?? Dn()), document.body.insertAdjacentElement("beforeend", t[1] ?? Dn()), Ft++, () => {
|
|
856
856
|
Ft === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((n) => n.remove()), Ft--;
|
|
857
857
|
};
|
|
858
858
|
}, []);
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function Dn() {
|
|
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
|
}
|
|
@@ -888,7 +888,7 @@ function Lt(t, n) {
|
|
|
888
888
|
return typeof t == "function" ? t(n) : t && (t.current = n), t;
|
|
889
889
|
}
|
|
890
890
|
function Lo(t, n) {
|
|
891
|
-
var e =
|
|
891
|
+
var e = K(function() {
|
|
892
892
|
return {
|
|
893
893
|
// value
|
|
894
894
|
value: t,
|
|
@@ -908,7 +908,7 @@ function Lo(t, n) {
|
|
|
908
908
|
})[0];
|
|
909
909
|
return e.callback = n, e.facade;
|
|
910
910
|
}
|
|
911
|
-
var Do = typeof window < "u" ? h.useLayoutEffect : h.useEffect,
|
|
911
|
+
var Do = typeof window < "u" ? h.useLayoutEffect : h.useEffect, An = /* @__PURE__ */ new WeakMap();
|
|
912
912
|
function Ao(t, n) {
|
|
913
913
|
var e = Lo(null, function(i) {
|
|
914
914
|
return t.forEach(function(r) {
|
|
@@ -916,7 +916,7 @@ function Ao(t, n) {
|
|
|
916
916
|
});
|
|
917
917
|
});
|
|
918
918
|
return Do(function() {
|
|
919
|
-
var i =
|
|
919
|
+
var i = An.get(e);
|
|
920
920
|
if (i) {
|
|
921
921
|
var r = new Set(i), o = new Set(t), s = e.current;
|
|
922
922
|
r.forEach(function(a) {
|
|
@@ -925,7 +925,7 @@ function Ao(t, n) {
|
|
|
925
925
|
r.has(a) || Lt(a, s);
|
|
926
926
|
});
|
|
927
927
|
}
|
|
928
|
-
|
|
928
|
+
An.set(e, t);
|
|
929
929
|
}, [t]), e;
|
|
930
930
|
}
|
|
931
931
|
function Po(t) {
|
|
@@ -1135,13 +1135,13 @@ var $o = function() {
|
|
|
1135
1135
|
`).concat(Fo, ": ").concat(a, `px;
|
|
1136
1136
|
}
|
|
1137
1137
|
`);
|
|
1138
|
-
},
|
|
1138
|
+
}, Pn = function() {
|
|
1139
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($e, (
|
|
1144
|
-
var t =
|
|
1143
|
+
return document.body.setAttribute($e, (Pn() + 1).toString()), function() {
|
|
1144
|
+
var t = Pn() - 1;
|
|
1145
1145
|
t <= 0 ? document.body.removeAttribute($e) : document.body.setAttribute($e, t.toString());
|
|
1146
1146
|
};
|
|
1147
1147
|
}, []);
|
|
@@ -1155,12 +1155,12 @@ var $o = function() {
|
|
|
1155
1155
|
}, _t = !1;
|
|
1156
1156
|
if (typeof window < "u")
|
|
1157
1157
|
try {
|
|
1158
|
-
var
|
|
1158
|
+
var Qe = Object.defineProperty({}, "passive", {
|
|
1159
1159
|
get: function() {
|
|
1160
1160
|
return _t = !0, !0;
|
|
1161
1161
|
}
|
|
1162
1162
|
});
|
|
1163
|
-
window.addEventListener("test",
|
|
1163
|
+
window.addEventListener("test", Qe, Qe), window.removeEventListener("test", Qe, Qe);
|
|
1164
1164
|
} catch {
|
|
1165
1165
|
_t = !1;
|
|
1166
1166
|
}
|
|
@@ -1175,11 +1175,11 @@ var Se = _t ? { passive: !1 } : !1, Yo = function(t) {
|
|
|
1175
1175
|
e[n] !== "hidden" && // contains scroll inside self
|
|
1176
1176
|
!(e.overflowY === e.overflowX && !Yo(t) && e[n] === "visible")
|
|
1177
1177
|
);
|
|
1178
|
-
}, Qo = function(t) {
|
|
1179
|
-
return pi(t, "overflowY");
|
|
1180
1178
|
}, Jo = function(t) {
|
|
1179
|
+
return pi(t, "overflowY");
|
|
1180
|
+
}, Zo = function(t) {
|
|
1181
1181
|
return pi(t, "overflowX");
|
|
1182
|
-
},
|
|
1182
|
+
}, On = function(t, n) {
|
|
1183
1183
|
var e = n.ownerDocument, i = n;
|
|
1184
1184
|
do {
|
|
1185
1185
|
typeof ShadowRoot < "u" && i instanceof ShadowRoot && (i = i.host);
|
|
@@ -1192,7 +1192,7 @@ var Se = _t ? { passive: !1 } : !1, Yo = function(t) {
|
|
|
1192
1192
|
i = i.parentNode;
|
|
1193
1193
|
} while (i && i !== e.body);
|
|
1194
1194
|
return !1;
|
|
1195
|
-
},
|
|
1195
|
+
}, Qo = function(t) {
|
|
1196
1196
|
var n = t.scrollTop, e = t.scrollHeight, i = t.clientHeight;
|
|
1197
1197
|
return [
|
|
1198
1198
|
n,
|
|
@@ -1207,9 +1207,9 @@ var Se = _t ? { passive: !1 } : !1, Yo = function(t) {
|
|
|
1207
1207
|
i
|
|
1208
1208
|
];
|
|
1209
1209
|
}, gi = function(t, n) {
|
|
1210
|
-
return t === "v" ?
|
|
1210
|
+
return t === "v" ? Jo(n) : Zo(n);
|
|
1211
1211
|
}, vi = function(t, n) {
|
|
1212
|
-
return t === "v" ?
|
|
1212
|
+
return t === "v" ? Qo(n) : es(n);
|
|
1213
1213
|
}, ts = function(t, n) {
|
|
1214
1214
|
return t === "h" && n === "rtl" ? -1 : 1;
|
|
1215
1215
|
}, ns = function(t, n, e, i, r) {
|
|
@@ -1225,9 +1225,9 @@ var Se = _t ? { passive: !1 } : !1, Yo = function(t) {
|
|
|
1225
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
|
+
}, Mn = function(t) {
|
|
1229
1229
|
return [t.deltaX, t.deltaY];
|
|
1230
|
-
},
|
|
1230
|
+
}, kn = function(t) {
|
|
1231
1231
|
return t && "current" in t ? t.current : t;
|
|
1232
1232
|
}, is = function(t, n) {
|
|
1233
1233
|
return t[0] === n[0] && t[1] === n[1];
|
|
@@ -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 = To([t.lockRef.current], (t.shards || []).map(
|
|
1247
|
+
var c = To([t.lockRef.current], (t.shards || []).map(kn), !0).filter(Boolean);
|
|
1248
1248
|
return c.forEach(function(v) {
|
|
1249
1249
|
return v.classList.add("allow-interactivity-".concat(r));
|
|
1250
1250
|
}), function() {
|
|
@@ -1260,10 +1260,10 @@ function ss(t) {
|
|
|
1260
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 T =
|
|
1263
|
+
var T = On(N, F);
|
|
1264
1264
|
if (!T)
|
|
1265
1265
|
return !0;
|
|
1266
|
-
if (T ? x = N : (x = N === "v" ? "h" : "v", T =
|
|
1266
|
+
if (T ? x = N : (x = N === "v" ? "h" : "v", T = On(N, F)), !T)
|
|
1267
1267
|
return !1;
|
|
1268
1268
|
if (!i.current && "changedTouches" in c && (g || S) && (i.current = x), !x)
|
|
1269
1269
|
return !0;
|
|
@@ -1272,7 +1272,7 @@ function ss(t) {
|
|
|
1272
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 ?
|
|
1275
|
+
var w = "deltaY" in v ? Mn(v) : et(v), C = n.current.filter(function(x) {
|
|
1276
1276
|
return x.name === v.type && (x.target === v.target || v.target === x.shadowParent) && is(x.delta, w);
|
|
1277
1277
|
})[0];
|
|
1278
1278
|
if (C && C.should) {
|
|
@@ -1280,7 +1280,7 @@ function ss(t) {
|
|
|
1280
1280
|
return;
|
|
1281
1281
|
}
|
|
1282
1282
|
if (!C) {
|
|
1283
|
-
var g = (s.current.shards || []).map(
|
|
1283
|
+
var g = (s.current.shards || []).map(kn).filter(Boolean).filter(function(x) {
|
|
1284
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();
|
|
@@ -1296,7 +1296,7 @@ function ss(t) {
|
|
|
1296
1296
|
}, []), m = h.useCallback(function(c) {
|
|
1297
1297
|
e.current = et(c), i.current = void 0;
|
|
1298
1298
|
}, []), d = h.useCallback(function(c) {
|
|
1299
|
-
f(c.type,
|
|
1299
|
+
f(c.type, Mn(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
|
}, []);
|
|
@@ -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
|
-
},
|
|
1380
|
+
}, an = "Dialog", [xi, cl] = Kr(an), [ms, te] = xi(an), 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), u = h.useRef(null), [f = !1, m] =
|
|
1388
|
+
} = t, a = h.useRef(null), u = h.useRef(null), [f = !1, m] = Zr({
|
|
1389
1389
|
prop: i,
|
|
1390
1390
|
defaultProp: r,
|
|
1391
1391
|
onChange: o
|
|
@@ -1407,7 +1407,7 @@ var cs = function(t) {
|
|
|
1407
1407
|
}
|
|
1408
1408
|
);
|
|
1409
1409
|
};
|
|
1410
|
-
wi.displayName =
|
|
1410
|
+
wi.displayName = an;
|
|
1411
1411
|
var Ci = "DialogTrigger", Ei = h.forwardRef(
|
|
1412
1412
|
(t, n) => {
|
|
1413
1413
|
const { __scopeDialog: e, ...i } = t, r = te(Ci, e), o = we(n, r.triggerRef);
|
|
@@ -1418,7 +1418,7 @@ var Ci = "DialogTrigger", Ei = h.forwardRef(
|
|
|
1418
1418
|
"aria-haspopup": "dialog",
|
|
1419
1419
|
"aria-expanded": r.open,
|
|
1420
1420
|
"aria-controls": r.contentId,
|
|
1421
|
-
"data-state":
|
|
1421
|
+
"data-state": un(r.open),
|
|
1422
1422
|
...i,
|
|
1423
1423
|
ref: o,
|
|
1424
1424
|
onClick: fe(t.onClick, r.onOpenToggle)
|
|
@@ -1427,13 +1427,13 @@ var Ci = "DialogTrigger", Ei = h.forwardRef(
|
|
|
1427
1427
|
}
|
|
1428
1428
|
);
|
|
1429
1429
|
Ei.displayName = Ci;
|
|
1430
|
-
var
|
|
1430
|
+
var cn = "DialogPortal", [hs, Ii] = xi(cn, {
|
|
1431
1431
|
forceMount: void 0
|
|
1432
1432
|
}), Si = (t) => {
|
|
1433
|
-
const { __scopeDialog: n, forceMount: e, children: i, container: r } = t, o = te(
|
|
1433
|
+
const { __scopeDialog: n, forceMount: e, children: i, container: r } = t, o = te(cn, 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
|
-
Si.displayName =
|
|
1436
|
+
Si.displayName = cn;
|
|
1437
1437
|
var mt = "DialogOverlay", Ni = h.forwardRef(
|
|
1438
1438
|
(t, n) => {
|
|
1439
1439
|
const e = Ii(mt, t.__scopeDialog), { forceMount: i = e.forceMount, ...r } = t, o = te(mt, t.__scopeDialog);
|
|
@@ -1447,10 +1447,10 @@ var ps = h.forwardRef(
|
|
|
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
|
-
/* @__PURE__ */ l(yi, { as:
|
|
1450
|
+
/* @__PURE__ */ l(yi, { as: ln, allowPinchZoom: !0, shards: [r.contentRef], children: /* @__PURE__ */ l(
|
|
1451
1451
|
ce.div,
|
|
1452
1452
|
{
|
|
1453
|
-
"data-state":
|
|
1453
|
+
"data-state": un(r.open),
|
|
1454
1454
|
...i,
|
|
1455
1455
|
ref: n,
|
|
1456
1456
|
style: { pointerEvents: "auto", ...i.style }
|
|
@@ -1535,7 +1535,7 @@ var gs = h.forwardRef(
|
|
|
1535
1535
|
id: a.contentId,
|
|
1536
1536
|
"aria-describedby": a.descriptionId,
|
|
1537
1537
|
"aria-labelledby": a.titleId,
|
|
1538
|
-
"data-state":
|
|
1538
|
+
"data-state": un(a.open),
|
|
1539
1539
|
...s,
|
|
1540
1540
|
ref: f,
|
|
1541
1541
|
onDismiss: () => a.onOpenChange(!1)
|
|
@@ -1549,13 +1549,13 @@ var gs = h.forwardRef(
|
|
|
1549
1549
|
] })
|
|
1550
1550
|
] });
|
|
1551
1551
|
}
|
|
1552
|
-
),
|
|
1552
|
+
), dn = "DialogTitle", ys = h.forwardRef(
|
|
1553
1553
|
(t, n) => {
|
|
1554
|
-
const { __scopeDialog: e, ...i } = t, r = te(
|
|
1554
|
+
const { __scopeDialog: e, ...i } = t, r = te(dn, e);
|
|
1555
1555
|
return /* @__PURE__ */ l(ce.h2, { id: r.titleId, ...i, ref: n });
|
|
1556
1556
|
}
|
|
1557
1557
|
);
|
|
1558
|
-
ys.displayName =
|
|
1558
|
+
ys.displayName = dn;
|
|
1559
1559
|
var Fi = "DialogDescription", bs = h.forwardRef(
|
|
1560
1560
|
(t, n) => {
|
|
1561
1561
|
const { __scopeDialog: e, ...i } = t, r = te(Fi, e);
|
|
@@ -1578,12 +1578,12 @@ var Li = "DialogClose", Di = h.forwardRef(
|
|
|
1578
1578
|
}
|
|
1579
1579
|
);
|
|
1580
1580
|
Di.displayName = Li;
|
|
1581
|
-
function
|
|
1581
|
+
function un(t) {
|
|
1582
1582
|
return t ? "open" : "closed";
|
|
1583
1583
|
}
|
|
1584
1584
|
var Ai = "DialogTitleWarning", [dl, Pi] = Gr(Ai, {
|
|
1585
1585
|
contentName: ye,
|
|
1586
|
-
titleName:
|
|
1586
|
+
titleName: dn,
|
|
1587
1587
|
docsSlug: "dialog"
|
|
1588
1588
|
}), xs = ({ titleId: t }) => {
|
|
1589
1589
|
const n = Pi(Ai), e = `\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.
|
|
@@ -1603,7 +1603,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
1603
1603
|
}, [i, t, n]), null;
|
|
1604
1604
|
}, Oi = wi, Es = Ei, Mi = Si, ki = Ni, zi = Ti, _i = Di;
|
|
1605
1605
|
const Bi = P((t) => {
|
|
1606
|
-
const { file: n, onClose: e } = t, i =
|
|
1606
|
+
const { file: n, onClose: e } = t, i = bt(null), r = R(() => {
|
|
1607
1607
|
var a;
|
|
1608
1608
|
if (!i.current) return;
|
|
1609
1609
|
const s = document.createElement("canvas");
|
|
@@ -1626,22 +1626,22 @@ const Bi = P((t) => {
|
|
|
1626
1626
|
onOpenAutoFocus: (s) => s.preventDefault(),
|
|
1627
1627
|
children: [
|
|
1628
1628
|
/* @__PURE__ */ E(
|
|
1629
|
-
|
|
1629
|
+
Kt,
|
|
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
1635
|
/* @__PURE__ */ E(Ee.Root, { children: [
|
|
1636
|
-
/* @__PURE__ */ l(Ee.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1636
|
+
/* @__PURE__ */ l(Ee.Trigger, { asChild: !0, children: /* @__PURE__ */ l(J, { 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
1639
|
/* @__PURE__ */ E(Ee.Root, { children: [
|
|
1640
|
-
/* @__PURE__ */ l(Ee.Trigger, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1640
|
+
/* @__PURE__ */ l(Ee.Trigger, { asChild: !0, children: /* @__PURE__ */ l(J, { onClick: o, "aria-label": "download", children: /* @__PURE__ */ l(L, { icon: "RiDownload2Line" }) }) }),
|
|
1641
1641
|
/* @__PURE__ */ l(Ee.Content, { size: "sm", children: "Download" })
|
|
1642
1642
|
] }),
|
|
1643
1643
|
/* @__PURE__ */ l(jn, { orientation: "vertical", size: "sm" }),
|
|
1644
|
-
/* @__PURE__ */ l(_i, { asChild: !0, children: /* @__PURE__ */ l(
|
|
1644
|
+
/* @__PURE__ */ l(_i, { asChild: !0, children: /* @__PURE__ */ l(J, { onClick: e, "aria-label": "close", children: /* @__PURE__ */ l(L, { icon: "RiCloseLine" }) }) })
|
|
1645
1645
|
]
|
|
1646
1646
|
}
|
|
1647
1647
|
),
|
|
@@ -1662,7 +1662,7 @@ const Bi = P((t) => {
|
|
|
1662
1662
|
});
|
|
1663
1663
|
Bi.displayName = "ImageViewer";
|
|
1664
1664
|
const Is = P((t) => {
|
|
1665
|
-
const { children: n } = t, [e, i] =
|
|
1665
|
+
const { children: n } = t, [e, i] = K(null), r = R(() => {
|
|
1666
1666
|
i(null);
|
|
1667
1667
|
}, []), o = R(
|
|
1668
1668
|
(u) => {
|
|
@@ -1679,7 +1679,7 @@ const Is = P((t) => {
|
|
|
1679
1679
|
});
|
|
1680
1680
|
Is.displayName = "FileViewerProvider";
|
|
1681
1681
|
const ne = (t) => {
|
|
1682
|
-
const { className: n, label: e, children: i, severity: r, inputId: o, labelId: s, image: a } = t, [u, f] =
|
|
1682
|
+
const { className: n, label: e, children: i, severity: r, inputId: o, labelId: s, image: a } = t, [u, f] = K(void 0), m = sn(), d = r ? ge[r] : "base";
|
|
1683
1683
|
H(() => {
|
|
1684
1684
|
a instanceof Promise ? a.then(f).catch(console.error) : f(a);
|
|
1685
1685
|
}, [a]);
|
|
@@ -1705,7 +1705,7 @@ const ne = (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: u, fieldProps: f }, m] =
|
|
1708
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = Z(t), d = o ? null : a, p = o ? "" : u, { name: b, onChange: y, onBlur: c } = f, v = `${n}-droppable`, { disabled: w } = m, C = f.value ?? nn, [g, S] = K(""), [x, F] = K(""), N = x || d, T = R(
|
|
1709
1709
|
(z) => {
|
|
1710
1710
|
y(z), c(z);
|
|
1711
1711
|
},
|
|
@@ -1768,7 +1768,7 @@ const ne = (t) => {
|
|
|
1768
1768
|
}
|
|
1769
1769
|
) }),
|
|
1770
1770
|
/* @__PURE__ */ l(
|
|
1771
|
-
|
|
1771
|
+
J,
|
|
1772
1772
|
{
|
|
1773
1773
|
size: "sm",
|
|
1774
1774
|
accentColor: "base",
|
|
@@ -1783,7 +1783,7 @@ const ne = (t) => {
|
|
|
1783
1783
|
] })
|
|
1784
1784
|
}
|
|
1785
1785
|
) }),
|
|
1786
|
-
/* @__PURE__ */ l(
|
|
1786
|
+
/* @__PURE__ */ l(Qt, { droppableId: v, children: (z) => /* @__PURE__ */ E(
|
|
1787
1787
|
"div",
|
|
1788
1788
|
{
|
|
1789
1789
|
className: "flex flex-col",
|
|
@@ -1791,7 +1791,7 @@ const ne = (t) => {
|
|
|
1791
1791
|
ref: z.innerRef,
|
|
1792
1792
|
children: [
|
|
1793
1793
|
C.map((Y, Ce) => /* @__PURE__ */ l(
|
|
1794
|
-
|
|
1794
|
+
en,
|
|
1795
1795
|
{
|
|
1796
1796
|
draggableId: `${Y}-draggable`,
|
|
1797
1797
|
index: Ce,
|
|
@@ -1813,7 +1813,7 @@ const ne = (t) => {
|
|
|
1813
1813
|
children: typeof Y == "object" && "label" in Y ? Y.label : Y
|
|
1814
1814
|
}),
|
|
1815
1815
|
/* @__PURE__ */ l(
|
|
1816
|
-
|
|
1816
|
+
J,
|
|
1817
1817
|
{
|
|
1818
1818
|
size: "xs",
|
|
1819
1819
|
variant: "ghost",
|
|
@@ -1841,7 +1841,7 @@ const ne = (t) => {
|
|
|
1841
1841
|
});
|
|
1842
1842
|
Vi.displayName = "MultiStringInput";
|
|
1843
1843
|
const Ss = {
|
|
1844
|
-
...
|
|
1844
|
+
...Q,
|
|
1845
1845
|
type: "multi-string",
|
|
1846
1846
|
minimum_length: 0,
|
|
1847
1847
|
maximum_length: null
|
|
@@ -1927,7 +1927,7 @@ class $i extends W {
|
|
|
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: u, fieldProps: f }, m] =
|
|
1930
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = Z(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
|
},
|
|
@@ -1965,7 +1965,7 @@ const Ui = P((t) => {
|
|
|
1965
1965
|
});
|
|
1966
1966
|
Ui.displayName = "BooleanInput";
|
|
1967
1967
|
const Ns = {
|
|
1968
|
-
...
|
|
1968
|
+
...Q,
|
|
1969
1969
|
type: "boolean"
|
|
1970
1970
|
}, Fe = class Fe extends W {
|
|
1971
1971
|
constructor(e) {
|
|
@@ -1990,7 +1990,7 @@ const Ns = {
|
|
|
1990
1990
|
I(Fe, "fieldTypeName", "Checkbox"), I(Fe, "fieldTypeDescription", "Perfect for both optional and required yes/no questions."), I(Fe, "Icon", yr);
|
|
1991
1991
|
let He = Fe;
|
|
1992
1992
|
const Ts = {
|
|
1993
|
-
...
|
|
1993
|
+
...Q,
|
|
1994
1994
|
type: "custom"
|
|
1995
1995
|
};
|
|
1996
1996
|
class ht extends W {
|
|
@@ -2011,7 +2011,7 @@ class ht extends W {
|
|
|
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: u, fieldProps: f }, m] =
|
|
2014
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = Z(t), { name: d, onChange: p, onBlur: b } = f, [y, c] = K(!1), v = o ? null : a, w = o ? "" : u, C = f.value ? new Date(f.value) : void 0, g = R(
|
|
2015
2015
|
(x) => {
|
|
2016
2016
|
p(x == null ? void 0 : x.toISOString()), c(!1);
|
|
2017
2017
|
},
|
|
@@ -2033,7 +2033,7 @@ const Wi = P((t) => {
|
|
|
2033
2033
|
image: o ? void 0 : s.image,
|
|
2034
2034
|
children: /* @__PURE__ */ E(Be.Root, { open: y, onOpenChange: S, children: [
|
|
2035
2035
|
/* @__PURE__ */ l(Be.Trigger, { asChild: !0, children: /* @__PURE__ */ E(
|
|
2036
|
-
|
|
2036
|
+
G,
|
|
2037
2037
|
{
|
|
2038
2038
|
id: n,
|
|
2039
2039
|
name: d,
|
|
@@ -2069,7 +2069,7 @@ const Wi = P((t) => {
|
|
|
2069
2069
|
});
|
|
2070
2070
|
Wi.displayName = "DateInput";
|
|
2071
2071
|
const Rs = {
|
|
2072
|
-
...
|
|
2072
|
+
...Q,
|
|
2073
2073
|
type: "date"
|
|
2074
2074
|
}, Le = class Le extends W {
|
|
2075
2075
|
constructor(e) {
|
|
@@ -2090,7 +2090,7 @@ const Rs = {
|
|
|
2090
2090
|
I(Le, "fieldTypeName", "Date"), I(Le, "fieldTypeDescription", "Allows specifying a date."), I(Le, "Icon", br);
|
|
2091
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: u, fieldProps: f }, m] =
|
|
2093
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = Z(t), { name: d, onChange: p, onBlur: b } = f, y = o ? null : a, c = o ? "" : u, v = f.value ?? nn, w = R(
|
|
2094
2094
|
(g) => {
|
|
2095
2095
|
const S = g.length > 0 ? g : void 0;
|
|
2096
2096
|
p(S), b(S);
|
|
@@ -2113,7 +2113,7 @@ const ji = P((t) => {
|
|
|
2113
2113
|
image: o ? void 0 : s.image,
|
|
2114
2114
|
children: /* @__PURE__ */ E(B.Root, { onOpenChange: C, align: "start", children: [
|
|
2115
2115
|
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(
|
|
2116
|
-
|
|
2116
|
+
G,
|
|
2117
2117
|
{
|
|
2118
2118
|
id: n,
|
|
2119
2119
|
name: d,
|
|
@@ -2145,7 +2145,7 @@ const ji = P((t) => {
|
|
|
2145
2145
|
});
|
|
2146
2146
|
ji.displayName = "MultiSelectInput";
|
|
2147
2147
|
const Fs = {
|
|
2148
|
-
...
|
|
2148
|
+
...Q,
|
|
2149
2149
|
type: "multi-select",
|
|
2150
2150
|
options: []
|
|
2151
2151
|
}, De = class De extends $i {
|
|
@@ -2176,7 +2176,7 @@ const qi = P((t) => {
|
|
|
2176
2176
|
const [
|
|
2177
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
|
-
] =
|
|
2179
|
+
] = Z(t), { name: b, onBlur: y, onChange: c, value: v } = f, w = o ? null : a, C = o ? "" : u, [g, S] = K(void 0);
|
|
2180
2180
|
H(() => {
|
|
2181
2181
|
S(v);
|
|
2182
2182
|
}, [v]);
|
|
@@ -2219,12 +2219,12 @@ const qi = P((t) => {
|
|
|
2219
2219
|
});
|
|
2220
2220
|
qi.displayName = "NumberInput";
|
|
2221
2221
|
const Ls = {
|
|
2222
|
-
...
|
|
2222
|
+
...Q,
|
|
2223
2223
|
type: "number",
|
|
2224
2224
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2225
2225
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2226
2226
|
integers: !1
|
|
2227
|
-
},
|
|
2227
|
+
}, zn = (t) => "fields" in t, re = class re extends W {
|
|
2228
2228
|
constructor(e) {
|
|
2229
2229
|
const {
|
|
2230
2230
|
minimum: i = Number.MIN_SAFE_INTEGER,
|
|
@@ -2307,145 +2307,15 @@ const Ls = {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
};
|
|
2309
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 =
|
|
2310
|
+
const o = zn(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
2312
|
}), I(re, "_validateMax", (e) => (i, r) => {
|
|
2313
|
-
const o =
|
|
2313
|
+
const o = zn(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
2316
|
let be = re;
|
|
2317
2317
|
const Hi = P((t) => {
|
|
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));
|
|
2328
|
-
},
|
|
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);
|
|
2335
|
-
},
|
|
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]
|
|
2344
|
-
);
|
|
2345
|
-
return /* @__PURE__ */ l(ie, { helpText: g, severity: s, children: /* @__PURE__ */ l(
|
|
2346
|
-
ne,
|
|
2347
|
-
{
|
|
2348
|
-
size: o,
|
|
2349
|
-
severity: s,
|
|
2350
|
-
inputId: n,
|
|
2351
|
-
labelId: e,
|
|
2352
|
-
label: S,
|
|
2353
|
-
image: a ? void 0 : u.image,
|
|
2354
|
-
className: "flex-col items-start justify-start gap-2",
|
|
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: [
|
|
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(
|
|
2372
|
-
Q,
|
|
2373
|
-
{
|
|
2374
|
-
accentColor: "base",
|
|
2375
|
-
variant: "ghost",
|
|
2376
|
-
"aria-label": "delete",
|
|
2377
|
-
size: "xs",
|
|
2378
|
-
onClick: M,
|
|
2379
|
-
children: /* @__PURE__ */ l(L, { icon: "RiCloseLine" })
|
|
2380
|
-
}
|
|
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
|
-
] })
|
|
2394
|
-
}
|
|
2395
|
-
) });
|
|
2396
|
-
});
|
|
2397
|
-
Hi.displayName = "QrInput";
|
|
2398
|
-
const Gi = P((t) => {
|
|
2399
|
-
const { onQrScan: n } = t, e = Xe(null), [i, r] = G(!1);
|
|
2400
|
-
return H(() => {
|
|
2401
|
-
if (!e.current) return;
|
|
2402
|
-
const o = new Mr(
|
|
2403
|
-
e.current,
|
|
2404
|
-
(s) => {
|
|
2405
|
-
const a = s.data;
|
|
2406
|
-
n(a), o.destroy();
|
|
2407
|
-
},
|
|
2408
|
-
{
|
|
2409
|
-
highlightCodeOutline: !0,
|
|
2410
|
-
highlightScanRegion: !0,
|
|
2411
|
-
maxScansPerSecond: 1
|
|
2412
|
-
}
|
|
2413
|
-
);
|
|
2414
|
-
r(!0), o.start().finally(() => {
|
|
2415
|
-
r(!1);
|
|
2416
|
-
});
|
|
2417
|
-
}, [n]), /* @__PURE__ */ E("div", { className: "relative flex h-full w-full flex-col justify-center gap-2 bg-(--color-background)", children: [
|
|
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" }) }) }) }),
|
|
2419
|
-
/* @__PURE__ */ E("div", { className: "relative max-h-full max-w-full **:stroke-(--primary-indicator)", children: [
|
|
2420
|
-
/* @__PURE__ */ l("video", { className: "size-full", ref: e }),
|
|
2421
|
-
i && /* @__PURE__ */ l("div", { className: "absolute inset-0 flex items-center justify-center bg-(--color-background)", children: /* @__PURE__ */ l(Kt, {}) })
|
|
2422
|
-
] })
|
|
2423
|
-
] });
|
|
2424
|
-
});
|
|
2425
|
-
Gi.displayName = "QrScanner";
|
|
2426
|
-
const Ds = {
|
|
2427
|
-
...Z,
|
|
2428
|
-
type: "qr"
|
|
2429
|
-
}, Ae = class Ae extends W {
|
|
2430
|
-
constructor(e) {
|
|
2431
|
-
super({ ...e, type: "qr" });
|
|
2432
|
-
I(this, "onlyValidateAfterTouched", !1);
|
|
2433
|
-
}
|
|
2434
|
-
serialize() {
|
|
2435
|
-
return super._serialize();
|
|
2436
|
-
}
|
|
2437
|
-
static deserialize(e) {
|
|
2438
|
-
if (e.type !== "qr") throw new Error("Type mismatch.");
|
|
2439
|
-
return new Ae(e);
|
|
2440
|
-
}
|
|
2441
|
-
getInput(e) {
|
|
2442
|
-
return /* @__PURE__ */ l(Hi, { ...e, field: this });
|
|
2443
|
-
}
|
|
2444
|
-
};
|
|
2445
|
-
I(Ae, "fieldTypeName", "QR"), I(Ae, "fieldTypeDescription", "Used for scanning/reading QR codes."), I(Ae, "Icon", Cr);
|
|
2446
|
-
let Vt = Ae;
|
|
2447
|
-
const Ki = P((t) => {
|
|
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(
|
|
2318
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = Z(t), { name: d, onChange: p, onBlur: b, value: y } = f, c = o ? null : a, v = o ? "" : u, w = R(
|
|
2449
2319
|
(g) => {
|
|
2450
2320
|
p(g ?? void 0), b(g ?? void 0);
|
|
2451
2321
|
},
|
|
@@ -2480,7 +2350,7 @@ const Ki = P((t) => {
|
|
|
2480
2350
|
/* @__PURE__ */ l(ae, { size: "sm", accentColor: "base", className: "truncate", children: g.label })
|
|
2481
2351
|
] })),
|
|
2482
2352
|
!!y && /* @__PURE__ */ E(
|
|
2483
|
-
|
|
2353
|
+
G,
|
|
2484
2354
|
{
|
|
2485
2355
|
onClick: C,
|
|
2486
2356
|
className: "w-max -mx-2",
|
|
@@ -2500,12 +2370,12 @@ const Ki = P((t) => {
|
|
|
2500
2370
|
}
|
|
2501
2371
|
) });
|
|
2502
2372
|
});
|
|
2503
|
-
|
|
2504
|
-
const
|
|
2505
|
-
...
|
|
2373
|
+
Hi.displayName = "SelectInput";
|
|
2374
|
+
const Ds = {
|
|
2375
|
+
...Q,
|
|
2506
2376
|
type: "radio",
|
|
2507
2377
|
options: []
|
|
2508
|
-
},
|
|
2378
|
+
}, Ae = class Ae extends W {
|
|
2509
2379
|
constructor(e) {
|
|
2510
2380
|
const { options: i, ...r } = e;
|
|
2511
2381
|
super({ ...r, type: "radio" });
|
|
@@ -2525,7 +2395,7 @@ const As = {
|
|
|
2525
2395
|
}
|
|
2526
2396
|
static deserialize(e) {
|
|
2527
2397
|
if (e.type !== "radio") throw new Error("Type mismatch.");
|
|
2528
|
-
return new
|
|
2398
|
+
return new Ae(e);
|
|
2529
2399
|
}
|
|
2530
2400
|
static getFieldCreationSchema(e = "") {
|
|
2531
2401
|
const i = e && `${e}.`;
|
|
@@ -2543,13 +2413,136 @@ const As = {
|
|
|
2543
2413
|
];
|
|
2544
2414
|
}
|
|
2545
2415
|
getInput(e) {
|
|
2546
|
-
return /* @__PURE__ */ l(
|
|
2416
|
+
return /* @__PURE__ */ l(Hi, { field: this, ...e });
|
|
2417
|
+
}
|
|
2418
|
+
};
|
|
2419
|
+
I(Ae, "fieldTypeName", "Option list"), I(Ae, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), I(Ae, "Icon", Cr);
|
|
2420
|
+
let Vt = Ae;
|
|
2421
|
+
const Gi = P((t) => {
|
|
2422
|
+
const [
|
|
2423
|
+
{ inputId: n, labelId: e, label: i, helpText: r, size: o, severity: s, showInputOnly: a, field: u, fieldProps: f, helpers: m, touched: d },
|
|
2424
|
+
p
|
|
2425
|
+
] = Z(t), { name: b, onBlur: y, onChange: c, value: v } = f, [w, C] = K(!1), g = a ? null : r, S = a ? "" : i, [x, F] = K(void 0);
|
|
2426
|
+
H(() => {
|
|
2427
|
+
F(v);
|
|
2428
|
+
}, [v]);
|
|
2429
|
+
const N = R(
|
|
2430
|
+
(V) => {
|
|
2431
|
+
F(V.target.value || void 0), (d || !u.onlyValidateAfterTouched) && m.setError(u.getError(V.target.value));
|
|
2432
|
+
},
|
|
2433
|
+
[u, m, d]
|
|
2434
|
+
), T = R(() => {
|
|
2435
|
+
c(x), y(x);
|
|
2436
|
+
}, [x, y, c]), D = R(
|
|
2437
|
+
(V) => {
|
|
2438
|
+
c(V), C(!1);
|
|
2439
|
+
},
|
|
2440
|
+
[c]
|
|
2441
|
+
), M = R(() => {
|
|
2442
|
+
c(void 0);
|
|
2443
|
+
}, [c]), k = R(
|
|
2444
|
+
(V) => {
|
|
2445
|
+
C(V), V || y(v);
|
|
2446
|
+
},
|
|
2447
|
+
[y, v]
|
|
2448
|
+
);
|
|
2449
|
+
return /* @__PURE__ */ l(ie, { helpText: g, severity: s, children: /* @__PURE__ */ l(
|
|
2450
|
+
ne,
|
|
2451
|
+
{
|
|
2452
|
+
size: o,
|
|
2453
|
+
severity: s,
|
|
2454
|
+
inputId: n,
|
|
2455
|
+
labelId: e,
|
|
2456
|
+
label: S,
|
|
2457
|
+
image: a ? void 0 : u.image,
|
|
2458
|
+
className: "flex-col items-start justify-start gap-2",
|
|
2459
|
+
children: /* @__PURE__ */ E("div", { className: "flex w-full items-center gap-2", children: [
|
|
2460
|
+
/* @__PURE__ */ E(ee.Root, { className: "grow", accentColor: "base", variant: "surface", size: "sm", children: [
|
|
2461
|
+
/* @__PURE__ */ l(
|
|
2462
|
+
ee.Field,
|
|
2463
|
+
{
|
|
2464
|
+
id: n,
|
|
2465
|
+
className: "truncate",
|
|
2466
|
+
name: b,
|
|
2467
|
+
value: x ?? "",
|
|
2468
|
+
type: "text",
|
|
2469
|
+
placeholder: "Enter a qr or barcode",
|
|
2470
|
+
onChange: N,
|
|
2471
|
+
onBlur: T,
|
|
2472
|
+
...p
|
|
2473
|
+
}
|
|
2474
|
+
),
|
|
2475
|
+
!!v && /* @__PURE__ */ l(ee.Slot, { children: /* @__PURE__ */ l(
|
|
2476
|
+
J,
|
|
2477
|
+
{
|
|
2478
|
+
accentColor: "base",
|
|
2479
|
+
variant: "ghost",
|
|
2480
|
+
"aria-label": "delete",
|
|
2481
|
+
size: "xs",
|
|
2482
|
+
onClick: M,
|
|
2483
|
+
children: /* @__PURE__ */ l(L, { icon: "RiCloseLine" })
|
|
2484
|
+
}
|
|
2485
|
+
) })
|
|
2486
|
+
] }),
|
|
2487
|
+
/* @__PURE__ */ E(Oi, { open: w, onOpenChange: k, children: [
|
|
2488
|
+
/* @__PURE__ */ l(Es, { asChild: !0, children: /* @__PURE__ */ E(G, { type: "button", variant: "soft", size: "sm", accentColor: "base", children: [
|
|
2489
|
+
/* @__PURE__ */ l(L, { icon: "RiQrCodeLine" }),
|
|
2490
|
+
"Scan"
|
|
2491
|
+
] }) }),
|
|
2492
|
+
/* @__PURE__ */ E(Mi, { children: [
|
|
2493
|
+
/* @__PURE__ */ l(ki, { className: "light:bg-(--black-a6) fixed inset-0 dark:bg-(--black-a8)" }),
|
|
2494
|
+
/* @__PURE__ */ l(zi, { className: "fixed inset-0", children: /* @__PURE__ */ l(Ki, { onScan: D }) })
|
|
2495
|
+
] })
|
|
2496
|
+
] })
|
|
2497
|
+
] })
|
|
2498
|
+
}
|
|
2499
|
+
) });
|
|
2500
|
+
});
|
|
2501
|
+
Gi.displayName = "QrInput";
|
|
2502
|
+
const Ki = P((t) => {
|
|
2503
|
+
const { onScan: n } = t, { showError: e } = Ge(), i = R(
|
|
2504
|
+
(s) => {
|
|
2505
|
+
n(s.getText());
|
|
2506
|
+
},
|
|
2507
|
+
[n]
|
|
2508
|
+
), r = R(() => {
|
|
2509
|
+
e({
|
|
2510
|
+
title: "Scan Error",
|
|
2511
|
+
description: "An unknown error occurred while scanning."
|
|
2512
|
+
});
|
|
2513
|
+
}, [e]), { ref: o } = Mr({
|
|
2514
|
+
onDecodeResult: i,
|
|
2515
|
+
onError: r
|
|
2516
|
+
});
|
|
2517
|
+
return /* @__PURE__ */ E("div", { className: "relative flex h-full w-full flex-col justify-center gap-2 bg-(--color-background)", children: [
|
|
2518
|
+
/* @__PURE__ */ l("div", { className: "absolute top-0 flex w-full p-2", children: /* @__PURE__ */ l(_i, { asChild: !0, children: /* @__PURE__ */ l(J, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ l(L, { icon: "RiCloseLine" }) }) }) }),
|
|
2519
|
+
/* @__PURE__ */ l("div", { className: "relative max-h-full max-w-full **:stroke-(--primary-indicator)", children: /* @__PURE__ */ l("video", { className: "rotate-y-180 size-full", ref: o }) })
|
|
2520
|
+
] });
|
|
2521
|
+
});
|
|
2522
|
+
Ki.displayName = "QrScanner";
|
|
2523
|
+
const As = {
|
|
2524
|
+
...Q,
|
|
2525
|
+
type: "qr"
|
|
2526
|
+
}, Pe = class Pe extends W {
|
|
2527
|
+
constructor(e) {
|
|
2528
|
+
super({ ...e, type: "qr" });
|
|
2529
|
+
I(this, "onlyValidateAfterTouched", !1);
|
|
2530
|
+
}
|
|
2531
|
+
serialize() {
|
|
2532
|
+
return super._serialize();
|
|
2533
|
+
}
|
|
2534
|
+
static deserialize(e) {
|
|
2535
|
+
if (e.type !== "qr") throw new Error("Type mismatch.");
|
|
2536
|
+
return new Pe(e);
|
|
2537
|
+
}
|
|
2538
|
+
getInput(e) {
|
|
2539
|
+
return /* @__PURE__ */ l(Gi, { ...e, field: this });
|
|
2547
2540
|
}
|
|
2548
2541
|
};
|
|
2549
|
-
I(Pe, "fieldTypeName", "
|
|
2542
|
+
I(Pe, "fieldTypeName", "Scan"), I(Pe, "fieldTypeDescription", "Used for scanning/reading QR and barcodes."), I(Pe, "Icon", Er);
|
|
2550
2543
|
let $t = Pe;
|
|
2551
2544
|
const Xi = P((t) => {
|
|
2552
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] =
|
|
2545
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f }, m] = Z(t), { name: d, onChange: p, onBlur: b, value: y } = f, c = o ? null : a, v = o ? "" : u, w = R(
|
|
2553
2546
|
(g) => {
|
|
2554
2547
|
p(g), b(g);
|
|
2555
2548
|
},
|
|
@@ -2566,7 +2559,7 @@ const Xi = P((t) => {
|
|
|
2566
2559
|
image: o ? void 0 : s.image,
|
|
2567
2560
|
children: /* @__PURE__ */ E(B.Root, { align: "start", children: [
|
|
2568
2561
|
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(
|
|
2569
|
-
|
|
2562
|
+
G,
|
|
2570
2563
|
{
|
|
2571
2564
|
id: n,
|
|
2572
2565
|
name: d,
|
|
@@ -2592,7 +2585,7 @@ const Xi = P((t) => {
|
|
|
2592
2585
|
});
|
|
2593
2586
|
Xi.displayName = "SelectInput";
|
|
2594
2587
|
const Ps = {
|
|
2595
|
-
...
|
|
2588
|
+
...Q,
|
|
2596
2589
|
type: "select",
|
|
2597
2590
|
options: []
|
|
2598
2591
|
}, Oe = class Oe extends $i {
|
|
@@ -2613,7 +2606,7 @@ const Ps = {
|
|
|
2613
2606
|
};
|
|
2614
2607
|
I(Oe, "fieldTypeName", "Dropdown"), I(Oe, "fieldTypeDescription", "Allows the user to select a single option from a list of options."), I(Oe, "Icon", Ir);
|
|
2615
2608
|
let gt = Oe;
|
|
2616
|
-
const ot = 500, Ue = 1e4,
|
|
2609
|
+
const ot = 500, Ue = 1e4, _n = (t) => "fields" in t;
|
|
2617
2610
|
class vt extends W {
|
|
2618
2611
|
constructor(e) {
|
|
2619
2612
|
const { minLength: i, maxLength: r, placeholder: o = "", ...s } = e;
|
|
@@ -2685,7 +2678,7 @@ class vt extends W {
|
|
|
2685
2678
|
* equal to the value given for "maximum length".
|
|
2686
2679
|
*/
|
|
2687
2680
|
I(vt, "_validateMin", (e) => (i, r) => {
|
|
2688
|
-
const o =
|
|
2681
|
+
const o = _n(r) ? se(r, e) : r;
|
|
2689
2682
|
return typeof o.maximum_length == "number" && typeof i == "number" && o.maximum_length < i ? "Minimum cannot be greater than maximum." : null;
|
|
2690
2683
|
}), /**
|
|
2691
2684
|
* This function returns a function that validates that the value given for "maximum length" (when creating a new field) is greater than or
|
|
@@ -2693,14 +2686,14 @@ I(vt, "_validateMin", (e) => (i, r) => {
|
|
|
2693
2686
|
*/
|
|
2694
2687
|
I(vt, "_validateMax", (e) => (i, r) => {
|
|
2695
2688
|
if (typeof i != "number") return null;
|
|
2696
|
-
const { minimum_length: o } =
|
|
2689
|
+
const { minimum_length: o } = _n(r) ? se(r, e) : r;
|
|
2697
2690
|
return typeof o != "number" ? null : o > i ? "Maximum cannot be less than minimum." : null;
|
|
2698
2691
|
});
|
|
2699
2692
|
const Yi = P((t) => {
|
|
2700
2693
|
const [
|
|
2701
2694
|
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f, touched: m, helpers: d },
|
|
2702
2695
|
p
|
|
2703
|
-
] =
|
|
2696
|
+
] = Z(t), { name: b, onBlur: y, onChange: c, value: v } = f, w = o ? null : a, C = o ? "" : u, [g, S] = K(void 0);
|
|
2704
2697
|
H(() => {
|
|
2705
2698
|
S(v);
|
|
2706
2699
|
}, [v]);
|
|
@@ -2740,7 +2733,7 @@ const Yi = P((t) => {
|
|
|
2740
2733
|
});
|
|
2741
2734
|
Yi.displayName = "StringInput";
|
|
2742
2735
|
const Os = {
|
|
2743
|
-
...
|
|
2736
|
+
...Q,
|
|
2744
2737
|
type: "string",
|
|
2745
2738
|
maximum_length: ot,
|
|
2746
2739
|
input_type: "text"
|
|
@@ -2771,11 +2764,11 @@ const Os = {
|
|
|
2771
2764
|
};
|
|
2772
2765
|
I(Me, "fieldTypeName", "Short Text"), I(Me, "fieldTypeDescription", `Short text fields can hold up to ${ot} characters on a single line.`), I(Me, "Icon", Sr);
|
|
2773
2766
|
let Ut = Me;
|
|
2774
|
-
const
|
|
2767
|
+
const Ji = P((t) => {
|
|
2775
2768
|
const [
|
|
2776
2769
|
{ inputId: n, labelId: e, size: i, severity: r, showInputOnly: o, field: s, helpText: a, label: u, fieldProps: f, touched: m, helpers: d },
|
|
2777
2770
|
p
|
|
2778
|
-
] =
|
|
2771
|
+
] = Z(t), { name: b, onBlur: y, onChange: c, value: v } = f, w = o ? null : a, C = o ? "" : u, [g, S] = K(void 0);
|
|
2779
2772
|
H(() => {
|
|
2780
2773
|
S(v);
|
|
2781
2774
|
}, [v]);
|
|
@@ -2816,9 +2809,9 @@ const Qi = P((t) => {
|
|
|
2816
2809
|
}
|
|
2817
2810
|
) });
|
|
2818
2811
|
});
|
|
2819
|
-
|
|
2812
|
+
Ji.displayName = "TextInput";
|
|
2820
2813
|
const Ms = {
|
|
2821
|
-
...
|
|
2814
|
+
...Q,
|
|
2822
2815
|
type: "text",
|
|
2823
2816
|
maximum_length: Ue
|
|
2824
2817
|
}, ke = class ke extends vt {
|
|
@@ -2840,13 +2833,13 @@ const Ms = {
|
|
|
2840
2833
|
});
|
|
2841
2834
|
}
|
|
2842
2835
|
getInput(n) {
|
|
2843
|
-
return /* @__PURE__ */ l(
|
|
2836
|
+
return /* @__PURE__ */ l(Ji, { field: this, ...n });
|
|
2844
2837
|
}
|
|
2845
2838
|
};
|
|
2846
2839
|
I(ke, "fieldTypeName", "Paragraph"), I(ke, "fieldTypeDescription", `Paragraph fields can hold up to ${Ue} characters and can have multiple lines.`), I(ke, "Icon", Nr);
|
|
2847
2840
|
let Wt = ke;
|
|
2848
2841
|
const ks = P(
|
|
2849
|
-
|
|
2842
|
+
Xe((t, n) => {
|
|
2850
2843
|
const { file: e, alt: i, error: r, rightSlot: o, className: s, ...a } = t;
|
|
2851
2844
|
return /* @__PURE__ */ E(
|
|
2852
2845
|
"div",
|
|
@@ -2858,7 +2851,7 @@ const ks = P(
|
|
|
2858
2851
|
ref: n,
|
|
2859
2852
|
...a,
|
|
2860
2853
|
children: [
|
|
2861
|
-
!e && !r && /* @__PURE__ */ l("div", { className: "absolute flex h-full w-full flex-col items-center justify-center", children: /* @__PURE__ */ l(
|
|
2854
|
+
!e && !r && /* @__PURE__ */ l("div", { className: "absolute flex h-full w-full flex-col items-center justify-center", children: /* @__PURE__ */ l(Wn, {}) }),
|
|
2862
2855
|
/* @__PURE__ */ l("div", { className: "-m-4 flex max-w-full grow items-center justify-center overflow-hidden bg-clip-padding", children: e && !r && /* @__PURE__ */ l(
|
|
2863
2856
|
"img",
|
|
2864
2857
|
{
|
|
@@ -2874,7 +2867,7 @@ const ks = P(
|
|
|
2874
2867
|
"bg-transparent": !e
|
|
2875
2868
|
}),
|
|
2876
2869
|
children: [
|
|
2877
|
-
r ? /* @__PURE__ */ l(L, { icon: "RiFileWarningLine" }) : e && /* @__PURE__ */ l(
|
|
2870
|
+
r ? /* @__PURE__ */ l(L, { icon: "RiFileWarningLine" }) : e && /* @__PURE__ */ l(tn, { fileType: e.type }),
|
|
2878
2871
|
/* @__PURE__ */ l(ae, { className: "truncate", size: "sm", children: r ?? (e == null ? void 0 : e.name) }),
|
|
2879
2872
|
o
|
|
2880
2873
|
]
|
|
@@ -2895,12 +2888,12 @@ const ks = P(
|
|
|
2895
2888
|
style: "unit",
|
|
2896
2889
|
unit: n[i]
|
|
2897
2890
|
}).format(e);
|
|
2898
|
-
},
|
|
2891
|
+
}, Zi = P((t) => {
|
|
2899
2892
|
var N;
|
|
2900
|
-
const [{ inputId: n, labelId: e, size: i, severity: r, helpText: o, showInputOnly: s, field: a, fieldProps: u }, f] =
|
|
2901
|
-
let [{ label: b }] =
|
|
2893
|
+
const [{ inputId: n, labelId: e, size: i, severity: r, helpText: o, showInputOnly: s, field: a, fieldProps: u }, f] = Z(t), { name: m, onChange: d, onBlur: p } = u;
|
|
2894
|
+
let [{ label: b }] = Z(t);
|
|
2902
2895
|
b = s ? "" : b;
|
|
2903
|
-
const y = u.value ??
|
|
2896
|
+
const y = u.value ?? nn, c = bt(null), v = O(() => s ? null : o || (a.maxFileSize ? `Maximum file size: ${a.maxFileSize}MB` : null), [a.maxFileSize, o, s]), w = R(() => {
|
|
2904
2897
|
var T;
|
|
2905
2898
|
(T = c.current) == null || T.click();
|
|
2906
2899
|
}, []), C = R(() => {
|
|
@@ -2947,7 +2940,7 @@ const ks = P(
|
|
|
2947
2940
|
image: s ? void 0 : a.image,
|
|
2948
2941
|
children: [
|
|
2949
2942
|
/* @__PURE__ */ l("div", { className: "flex gap-2", children: /* @__PURE__ */ E(
|
|
2950
|
-
|
|
2943
|
+
G,
|
|
2951
2944
|
{
|
|
2952
2945
|
className: "w-max",
|
|
2953
2946
|
size: "sm",
|
|
@@ -2982,7 +2975,7 @@ const ks = P(
|
|
|
2982
2975
|
}
|
|
2983
2976
|
) }),
|
|
2984
2977
|
Array.isArray(y) && y.length > 0 && /* @__PURE__ */ l("div", { className: "flex h-max flex-col gap-2", children: y.map((T, D) => /* @__PURE__ */ l(
|
|
2985
|
-
|
|
2978
|
+
Qi,
|
|
2986
2979
|
{
|
|
2987
2980
|
field: a,
|
|
2988
2981
|
file: T,
|
|
@@ -2995,9 +2988,9 @@ const ks = P(
|
|
|
2995
2988
|
)) })
|
|
2996
2989
|
] });
|
|
2997
2990
|
});
|
|
2998
|
-
|
|
2999
|
-
const
|
|
3000
|
-
const { file: n, field: e, onRemove: i, disabled: r } = t, [o, s] =
|
|
2991
|
+
Zi.displayName = "UploadInput";
|
|
2992
|
+
const Qi = P((t) => {
|
|
2993
|
+
const { file: n, field: e, onRemove: i, disabled: r } = t, [o, s] = K(null), a = sn(), u = O(() => o && e.getError([o]), [e, o]), { url: f, name: m } = O(() => {
|
|
3001
2994
|
let c = null, v, w;
|
|
3002
2995
|
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 };
|
|
3003
2996
|
}, [o]);
|
|
@@ -3025,9 +3018,9 @@ const Zi = P((t) => {
|
|
|
3025
3018
|
}
|
|
3026
3019
|
}));
|
|
3027
3020
|
}, [r, i, a, o]), y = O(
|
|
3028
|
-
() => /* @__PURE__ */ E(
|
|
3021
|
+
() => /* @__PURE__ */ E(Kt, { className: "flex grow justify-end", variant: "ghost", accentColor: "base", size: "sm", children: [
|
|
3029
3022
|
/* @__PURE__ */ l(
|
|
3030
|
-
|
|
3023
|
+
J,
|
|
3031
3024
|
{
|
|
3032
3025
|
"aria-label": `Download ${m}`,
|
|
3033
3026
|
type: "button",
|
|
@@ -3036,7 +3029,7 @@ const Zi = P((t) => {
|
|
|
3036
3029
|
children: /* @__PURE__ */ l(L, { icon: "RiDownload2Line" })
|
|
3037
3030
|
}
|
|
3038
3031
|
),
|
|
3039
|
-
!r && /* @__PURE__ */ l(
|
|
3032
|
+
!r && /* @__PURE__ */ l(J, { type: "button", "aria-label": `Remove ${m}`, disabled: r, onClick: p, children: /* @__PURE__ */ l(L, { icon: "RiDeleteBin7Fill" }) })
|
|
3040
3033
|
] }),
|
|
3041
3034
|
[r, p, d, m, o]
|
|
3042
3035
|
);
|
|
@@ -3049,17 +3042,17 @@ const Zi = P((t) => {
|
|
|
3049
3042
|
error: u ?? void 0,
|
|
3050
3043
|
rightSlot: y
|
|
3051
3044
|
}
|
|
3052
|
-
) : /* @__PURE__ */ l(
|
|
3045
|
+
) : /* @__PURE__ */ l(Jn, { file: o, error: u ?? void 0, rightSlot: y });
|
|
3053
3046
|
});
|
|
3054
|
-
|
|
3047
|
+
Qi.displayName = "DisplayFile";
|
|
3055
3048
|
const _s = {
|
|
3056
|
-
...
|
|
3049
|
+
...Q,
|
|
3057
3050
|
type: "upload",
|
|
3058
3051
|
extensions: [],
|
|
3059
3052
|
maximum_size: void 0,
|
|
3060
3053
|
maximum_files: 1
|
|
3061
3054
|
};
|
|
3062
|
-
function
|
|
3055
|
+
function Bn(t, n) {
|
|
3063
3056
|
return t.name === n.name && t.size === n.size && t.type === n.type;
|
|
3064
3057
|
}
|
|
3065
3058
|
const ze = class ze extends W {
|
|
@@ -3076,7 +3069,7 @@ const ze = class ze extends W {
|
|
|
3076
3069
|
return super.isBlank(e) || (e == null ? void 0 : e.length) === 0;
|
|
3077
3070
|
}
|
|
3078
3071
|
isEqual(e, i) {
|
|
3079
|
-
return e === void 0 && i === void 0 ? !0 : !(e === void 0 || i === void 0 || !e.every((r) => i.some((o) =>
|
|
3072
|
+
return e === void 0 && i === void 0 ? !0 : !(e === void 0 || i === void 0 || !e.every((r) => i.some((o) => Bn(r, o))) || !i.every((r) => e.some((o) => Bn(o, r))));
|
|
3080
3073
|
}
|
|
3081
3074
|
static getFieldCreationSchema(e = "") {
|
|
3082
3075
|
const i = e && `${e}.`;
|
|
@@ -3162,12 +3155,12 @@ const ze = class ze extends W {
|
|
|
3162
3155
|
return new ze(e);
|
|
3163
3156
|
}
|
|
3164
3157
|
getInput(e) {
|
|
3165
|
-
return /* @__PURE__ */ l(
|
|
3158
|
+
return /* @__PURE__ */ l(Zi, { field: this, ...e });
|
|
3166
3159
|
}
|
|
3167
3160
|
};
|
|
3168
3161
|
I(ze, "fieldTypeName", "Upload"), I(ze, "fieldTypeDescription", "Allows a file to be uploaded."), I(ze, "Icon", Tr);
|
|
3169
3162
|
let jt = ze;
|
|
3170
|
-
const
|
|
3163
|
+
const fn = {
|
|
3171
3164
|
date: Bt,
|
|
3172
3165
|
number: be,
|
|
3173
3166
|
boolean: He,
|
|
@@ -3176,10 +3169,10 @@ const mn = {
|
|
|
3176
3169
|
text: Wt,
|
|
3177
3170
|
custom: ht,
|
|
3178
3171
|
upload: jt,
|
|
3179
|
-
qr:
|
|
3172
|
+
qr: $t,
|
|
3180
3173
|
"multi-string": qe,
|
|
3181
3174
|
"multi-select": pt,
|
|
3182
|
-
radio:
|
|
3175
|
+
radio: Vt
|
|
3183
3176
|
}, Bs = {
|
|
3184
3177
|
date: Rs,
|
|
3185
3178
|
number: Ls,
|
|
@@ -3189,16 +3182,16 @@ const mn = {
|
|
|
3189
3182
|
text: Ms,
|
|
3190
3183
|
custom: Ts,
|
|
3191
3184
|
upload: _s,
|
|
3192
|
-
qr:
|
|
3185
|
+
qr: As,
|
|
3193
3186
|
"multi-string": Ss,
|
|
3194
3187
|
"multi-select": Fs,
|
|
3195
|
-
radio:
|
|
3188
|
+
radio: Ds
|
|
3196
3189
|
}, ul = {
|
|
3197
3190
|
boolean: "RiCheckboxCircleLine",
|
|
3198
3191
|
date: "RiCalendarLine",
|
|
3199
3192
|
"multi-string": "RiListCheck",
|
|
3200
3193
|
number: "RiHashtag",
|
|
3201
|
-
qr: "
|
|
3194
|
+
qr: "RiFullscreenLine",
|
|
3202
3195
|
"multi-select": "RiCheckboxLine",
|
|
3203
3196
|
select: "RiMenuFoldLine",
|
|
3204
3197
|
string: "RiInputField",
|
|
@@ -3208,9 +3201,9 @@ const mn = {
|
|
|
3208
3201
|
section: "RiFolderLine",
|
|
3209
3202
|
radio: "RiRadioButtonFill"
|
|
3210
3203
|
}, st = 50, Vs = st * 1e3, $s = Vs * 1e3, er = P((t) => {
|
|
3211
|
-
const { field: n, ...e } = t, [{ value: i }] =
|
|
3204
|
+
const { field: n, ...e } = t, [{ value: i }] = Yt(n.options.clonedFieldIdentifier), r = O(() => {
|
|
3212
3205
|
const o = n.options.getFieldToClone(i);
|
|
3213
|
-
return o ?
|
|
3206
|
+
return o ? mn(o) : null;
|
|
3214
3207
|
}, [n.options, i]);
|
|
3215
3208
|
return ir(r, e);
|
|
3216
3209
|
});
|
|
@@ -3222,12 +3215,12 @@ class Us extends ht {
|
|
|
3222
3215
|
}
|
|
3223
3216
|
const tr = (t) => {
|
|
3224
3217
|
const n = t.type;
|
|
3225
|
-
return
|
|
3226
|
-
},
|
|
3218
|
+
return fn[n].deserialize(t);
|
|
3219
|
+
}, mn = (t) => t.type === "section" ? q.deserialize(t) : tr(t);
|
|
3227
3220
|
function Ws(t) {
|
|
3228
|
-
return t.map((n) =>
|
|
3221
|
+
return t.map((n) => mn(n));
|
|
3229
3222
|
}
|
|
3230
|
-
function
|
|
3223
|
+
function hn(t) {
|
|
3231
3224
|
const n = [];
|
|
3232
3225
|
for (const e of t)
|
|
3233
3226
|
if (e instanceof q)
|
|
@@ -3241,13 +3234,13 @@ function pn(t) {
|
|
|
3241
3234
|
return n;
|
|
3242
3235
|
}
|
|
3243
3236
|
function js(t) {
|
|
3244
|
-
const n =
|
|
3237
|
+
const n = hn(t), e = {};
|
|
3245
3238
|
for (const i of n)
|
|
3246
3239
|
e[i.identifier] = i;
|
|
3247
3240
|
return e;
|
|
3248
3241
|
}
|
|
3249
3242
|
function fl(t, n) {
|
|
3250
|
-
const e =
|
|
3243
|
+
const e = hn(t), i = {};
|
|
3251
3244
|
for (const r of e) {
|
|
3252
3245
|
const o = n[r.identifier] ?? null;
|
|
3253
3246
|
o !== null ? i[r.identifier] = r.decodeJsonToValue(o) : i[r.identifier] = o;
|
|
@@ -3255,7 +3248,7 @@ function fl(t, n) {
|
|
|
3255
3248
|
return i;
|
|
3256
3249
|
}
|
|
3257
3250
|
function ml(t, n) {
|
|
3258
|
-
const e =
|
|
3251
|
+
const e = hn(t), i = {};
|
|
3259
3252
|
for (const r of e) {
|
|
3260
3253
|
const o = n[r.identifier];
|
|
3261
3254
|
i[r.identifier] = r.encodeValueToJson(o);
|
|
@@ -3287,7 +3280,7 @@ const ir = (t, n) => O(() => !n || !t ? null : t.getInput(n), [t, n]), yt = (t,
|
|
|
3287
3280
|
u(p.getId(), "").then();
|
|
3288
3281
|
}, [m, o, u]);
|
|
3289
3282
|
const d = yt(o, e);
|
|
3290
|
-
return m ? /* @__PURE__ */ l(
|
|
3283
|
+
return m ? /* @__PURE__ */ l(Ke, { variant: "soft", children: /* @__PURE__ */ E("div", { className: "flex flex-col gap-4", children: [
|
|
3291
3284
|
(i || r) && /* @__PURE__ */ E(pe, { children: [
|
|
3292
3285
|
/* @__PURE__ */ E("div", { className: "flex flex-col", children: [
|
|
3293
3286
|
/* @__PURE__ */ l(Hn, { size: "md", children: i }),
|
|
@@ -3299,7 +3292,7 @@ const ir = (t, n) => O(() => !n || !t ? null : t.getInput(n), [t, n]), yt = (t,
|
|
|
3299
3292
|
] }) }) : null;
|
|
3300
3293
|
});
|
|
3301
3294
|
rr.displayName = "FieldSectionLayout";
|
|
3302
|
-
const _e = class _e extends
|
|
3295
|
+
const _e = class _e extends Zn {
|
|
3303
3296
|
constructor(e) {
|
|
3304
3297
|
const { label: i = null, fields: r, condition: o = null, conditional: s, ...a } = e;
|
|
3305
3298
|
super({ ...a, type: "section" });
|
|
@@ -3408,7 +3401,7 @@ const _e = class _e extends Jn {
|
|
|
3408
3401
|
};
|
|
3409
3402
|
I(_e, "fieldTypeName", "Section"), I(_e, "fieldTypeDescription", "Sections can be useful for grouping fields together. They can also be conditionally shown or hidden.");
|
|
3410
3403
|
let q = _e;
|
|
3411
|
-
const he = (t) => Object.keys(t).length > 0,
|
|
3404
|
+
const he = (t) => Object.keys(t).length > 0, pn = (t, n) => {
|
|
3412
3405
|
const e = {};
|
|
3413
3406
|
for (const i of t)
|
|
3414
3407
|
if (i instanceof q) {
|
|
@@ -3425,10 +3418,10 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3425
3418
|
o && Ve(e, r, o);
|
|
3426
3419
|
}
|
|
3427
3420
|
if (he(e)) return e;
|
|
3428
|
-
},
|
|
3421
|
+
}, gn = (t, n) => t.reduce(
|
|
3429
3422
|
(e, i) => {
|
|
3430
3423
|
if (i instanceof q)
|
|
3431
|
-
return { ...e, ...
|
|
3424
|
+
return { ...e, ...gn(i.fields, n) };
|
|
3432
3425
|
const r = i.getId(), o = e[r];
|
|
3433
3426
|
switch (o) {
|
|
3434
3427
|
case "":
|
|
@@ -3457,7 +3450,7 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3457
3450
|
}
|
|
3458
3451
|
return i;
|
|
3459
3452
|
}, {}), qs = P(
|
|
3460
|
-
|
|
3453
|
+
Xe((t, n) => {
|
|
3461
3454
|
const {
|
|
3462
3455
|
schema: e,
|
|
3463
3456
|
values: i = {},
|
|
@@ -3475,7 +3468,7 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3475
3468
|
buttonProps: y,
|
|
3476
3469
|
enableReinitialize: c = !1,
|
|
3477
3470
|
excludeUnchangedFields: v = !1
|
|
3478
|
-
} = t, { readonly: w } = e.meta, C = pr(), g = O(() =>
|
|
3471
|
+
} = t, { readonly: w } = e.meta, C = pr(), g = O(() => gn(e.fields, i), [e.fields, i]), S = R(
|
|
3479
3472
|
(k) => {
|
|
3480
3473
|
o == null || o(v ? or(e.fields, g, k) : k);
|
|
3481
3474
|
},
|
|
@@ -3483,7 +3476,7 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3483
3476
|
), x = Jt({
|
|
3484
3477
|
initialValues: g,
|
|
3485
3478
|
onSubmit: S,
|
|
3486
|
-
validate: (k) =>
|
|
3479
|
+
validate: (k) => pn(e.fields, k),
|
|
3487
3480
|
// only validate the entire form on submit
|
|
3488
3481
|
validateOnBlur: !1,
|
|
3489
3482
|
validateOnChange: !1,
|
|
@@ -3510,14 +3503,14 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3510
3503
|
className: je(b, "flex flex-col gap-2"),
|
|
3511
3504
|
onSubmit: x.handleSubmit,
|
|
3512
3505
|
children: [
|
|
3513
|
-
!d && /* @__PURE__ */ l(
|
|
3506
|
+
!d && /* @__PURE__ */ l(Ke, { variant: "soft", children: /* @__PURE__ */ E("div", { className: "flex flex-col gap-1", children: [
|
|
3514
3507
|
N,
|
|
3515
3508
|
!p && T
|
|
3516
3509
|
] }) }),
|
|
3517
3510
|
M,
|
|
3518
3511
|
!w && /* @__PURE__ */ E("div", { className: "flex items-center justify-end gap-2", children: [
|
|
3519
3512
|
a && /* @__PURE__ */ E(
|
|
3520
|
-
|
|
3513
|
+
G,
|
|
3521
3514
|
{
|
|
3522
3515
|
accentColor: ge.danger,
|
|
3523
3516
|
...y,
|
|
@@ -3529,7 +3522,7 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3529
3522
|
]
|
|
3530
3523
|
}
|
|
3531
3524
|
),
|
|
3532
|
-
/* @__PURE__ */ E(
|
|
3525
|
+
/* @__PURE__ */ E(G, { ...y, type: "submit", disabled: !x.isValid, accentColor: "success", children: [
|
|
3533
3526
|
/* @__PURE__ */ l(L, { icon: "RiCheckLine" }),
|
|
3534
3527
|
s
|
|
3535
3528
|
] })
|
|
@@ -3539,7 +3532,7 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3539
3532
|
) });
|
|
3540
3533
|
})
|
|
3541
3534
|
), We = P((t) => {
|
|
3542
|
-
const { name: n, render: e } = t, { submitForm: i } = xe(), [r, o, s] =
|
|
3535
|
+
const { name: n, render: e } = t, { submitForm: i } = xe(), [r, o, s] = Yt(n), a = O(() => {
|
|
3543
3536
|
const u = (f) => {
|
|
3544
3537
|
s.setValue(f, !1);
|
|
3545
3538
|
};
|
|
@@ -3556,8 +3549,8 @@ const he = (t) => Object.keys(t).length > 0, gn = (t, n) => {
|
|
|
3556
3549
|
});
|
|
3557
3550
|
We.displayName = "PatchField";
|
|
3558
3551
|
const hl = P(
|
|
3559
|
-
|
|
3560
|
-
const { children: e, schema: i, values: r, onPatch: o, onError: s, requiresDiff: a = !0, onDirtyChange: u, ...f } = t, m = O(() =>
|
|
3552
|
+
Xe((t, n) => {
|
|
3553
|
+
const { children: e, schema: i, values: r, onPatch: o, onError: s, requiresDiff: a = !0, onDirtyChange: u, ...f } = t, m = O(() => gn(i.fields, r), [i.fields, r]), d = R(
|
|
3561
3554
|
(C) => {
|
|
3562
3555
|
const g = {};
|
|
3563
3556
|
for (const S in C) {
|
|
@@ -3575,7 +3568,7 @@ const hl = P(
|
|
|
3575
3568
|
[d, o, a]
|
|
3576
3569
|
), b = R(
|
|
3577
3570
|
(C) => {
|
|
3578
|
-
const g =
|
|
3571
|
+
const g = pn(i.fields, C);
|
|
3579
3572
|
if (g && s(g), u) {
|
|
3580
3573
|
const S = d(C);
|
|
3581
3574
|
u(he(S));
|
|
@@ -3605,7 +3598,7 @@ const hl = P(
|
|
|
3605
3598
|
["select", "multi-select", "upload", "qr", "radio"],
|
|
3606
3599
|
["boolean", "date", "number", "multi-string"]
|
|
3607
3600
|
], Ht = {
|
|
3608
|
-
...
|
|
3601
|
+
...fn,
|
|
3609
3602
|
section: q
|
|
3610
3603
|
}, Ct = Gn({}), Gs = (t, n) => {
|
|
3611
3604
|
var i;
|
|
@@ -3631,7 +3624,7 @@ const hl = P(
|
|
|
3631
3624
|
if (r.identifier === n) return e;
|
|
3632
3625
|
}
|
|
3633
3626
|
}
|
|
3634
|
-
},
|
|
3627
|
+
}, Vn = (t) => {
|
|
3635
3628
|
var e, i, r;
|
|
3636
3629
|
const n = {};
|
|
3637
3630
|
for (let o = 0; o < t.length; o++) {
|
|
@@ -3647,11 +3640,11 @@ const hl = P(
|
|
|
3647
3640
|
};
|
|
3648
3641
|
}
|
|
3649
3642
|
return n;
|
|
3650
|
-
},
|
|
3643
|
+
}, vn = P((t) => {
|
|
3651
3644
|
const { index: n, type: e, sectionIndex: i, remove: r, duplicate: o, move: s, upload: a } = t;
|
|
3652
3645
|
if (e !== "section" && !a)
|
|
3653
3646
|
throw new Error("Upload function prop must be defined for non-section fields.");
|
|
3654
|
-
const { values: u } = xe(), f =
|
|
3647
|
+
const { values: u } = xe(), f = bt(null), m = O(() => {
|
|
3655
3648
|
const d = [
|
|
3656
3649
|
{
|
|
3657
3650
|
Icon: Rr,
|
|
@@ -3696,8 +3689,8 @@ const hl = P(
|
|
|
3696
3689
|
}), d;
|
|
3697
3690
|
}, [o, n, s, r, i, e, u.fields]);
|
|
3698
3691
|
return /* @__PURE__ */ E(pe, { children: [
|
|
3699
|
-
/* @__PURE__ */ l(
|
|
3700
|
-
|
|
3692
|
+
/* @__PURE__ */ l(Kt, { className: "mx-2 hidden flex-col gap-0.5 sm:flex", variant: "ghost", accentColor: "base", size: "sm", children: m.map((d) => /* @__PURE__ */ l(
|
|
3693
|
+
J,
|
|
3701
3694
|
{
|
|
3702
3695
|
type: "button",
|
|
3703
3696
|
"aria-label": d.text,
|
|
@@ -3708,7 +3701,7 @@ const hl = P(
|
|
|
3708
3701
|
)) }),
|
|
3709
3702
|
/* @__PURE__ */ l("div", { className: "sm:hidden", children: /* @__PURE__ */ E(B.Root, { children: [
|
|
3710
3703
|
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ l(
|
|
3711
|
-
|
|
3704
|
+
J,
|
|
3712
3705
|
{
|
|
3713
3706
|
variant: "ghost",
|
|
3714
3707
|
accentColor: "base",
|
|
@@ -3729,12 +3722,12 @@ const hl = P(
|
|
|
3729
3722
|
e !== "section" && /* @__PURE__ */ l("input", { style: { display: "none" }, ref: f, type: "file", accept: "image/*", onChange: a })
|
|
3730
3723
|
] });
|
|
3731
3724
|
});
|
|
3732
|
-
|
|
3725
|
+
vn.displayName = "FieldActions";
|
|
3733
3726
|
const Gt = P((t) => {
|
|
3734
3727
|
const { popoverInputs: n, hasError: e, ...i } = t;
|
|
3735
3728
|
return /* @__PURE__ */ E(Be.Root, { children: [
|
|
3736
3729
|
/* @__PURE__ */ l(Be.Trigger, { asChild: !0, children: /* @__PURE__ */ E(
|
|
3737
|
-
|
|
3730
|
+
G,
|
|
3738
3731
|
{
|
|
3739
3732
|
variant: "soft",
|
|
3740
3733
|
type: "button",
|
|
@@ -3754,7 +3747,7 @@ const Gt = P((t) => {
|
|
|
3754
3747
|
});
|
|
3755
3748
|
Gt.displayName = "FieldSettingsPopover";
|
|
3756
3749
|
const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
3757
|
-
const i =
|
|
3750
|
+
const i = fn[e], r = i.Icon;
|
|
3758
3751
|
return {
|
|
3759
3752
|
children: i.fieldTypeName,
|
|
3760
3753
|
icon: /* @__PURE__ */ l(r, {}),
|
|
@@ -3763,23 +3756,23 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3763
3756
|
t(e);
|
|
3764
3757
|
}
|
|
3765
3758
|
};
|
|
3766
|
-
})), [t]),
|
|
3767
|
-
var Ye, xn, wn, Cn
|
|
3768
|
-
const { parentPath: n, index: e, initial: i, conditionalSourceFields: r } = t, { values: o, setFieldValue: s, errors: a } = xe(), u = sr(), f =
|
|
3769
|
-
d.current && d.current.getBoundingClientRect().width >=
|
|
3759
|
+
})), [t]), $n = 576, yn = P((t) => {
|
|
3760
|
+
var Ye, bn, xn, wn, Cn;
|
|
3761
|
+
const { parentPath: n, index: e, initial: i, conditionalSourceFields: r } = t, { values: o, setFieldValue: s, errors: a } = xe(), u = sr(), f = sn(), { disableRequiredFields: m } = Xt(Ct), d = bt(null), [p, b] = K(
|
|
3762
|
+
d.current && d.current.getBoundingClientRect().width >= $n
|
|
3770
3763
|
);
|
|
3771
3764
|
H(() => {
|
|
3772
3765
|
const A = d.current;
|
|
3773
3766
|
if (A) {
|
|
3774
3767
|
const _ = new ResizeObserver((j) => {
|
|
3775
|
-
j[0] && b(j[0].contentRect.width >=
|
|
3768
|
+
j[0] && b(j[0].contentRect.width >= $n);
|
|
3776
3769
|
});
|
|
3777
3770
|
return _.observe(A), () => {
|
|
3778
3771
|
_.disconnect();
|
|
3779
3772
|
};
|
|
3780
3773
|
}
|
|
3781
3774
|
}, []);
|
|
3782
|
-
const [y, c] =
|
|
3775
|
+
const [y, c] = K(void 0);
|
|
3783
3776
|
H(() => {
|
|
3784
3777
|
me(i) ? c(void 0) : i.image instanceof Promise ? i.image.then(c).catch(console.error) : c(i.image);
|
|
3785
3778
|
}, [i]);
|
|
@@ -3803,9 +3796,9 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3803
3796
|
), g = me(i) ? Array.isArray((Ye = i.condition) == null ? void 0 : Ye.value) ? "contains all of" : "equals" : void 0;
|
|
3804
3797
|
let S;
|
|
3805
3798
|
if (me(i)) {
|
|
3806
|
-
if (qt((
|
|
3799
|
+
if (qt((bn = i.condition) == null ? void 0 : bn.value))
|
|
3807
3800
|
throw new Error("File values are not supported for conditions.");
|
|
3808
|
-
S = Array.isArray((
|
|
3801
|
+
S = Array.isArray((xn = i.condition) == null ? void 0 : xn.value) ? i.condition.value.map((A) => typeof A == "string" ? A : A.label).join(", ") : (Cn = (wn = i.condition) == null ? void 0 : wn.value) == null ? void 0 : Cn.toString();
|
|
3809
3802
|
}
|
|
3810
3803
|
const x = R((A) => {
|
|
3811
3804
|
A.target.parentNode instanceof HTMLElement && (A.target.parentNode.dataset.replicatedValue = A.target.value);
|
|
@@ -3850,7 +3843,7 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3850
3843
|
const le = M.some((A) => {
|
|
3851
3844
|
const _ = se(a, T === q ? `${n}.${e}.condition` : A.getId());
|
|
3852
3845
|
return _ && (typeof _ != "object" || he(_));
|
|
3853
|
-
}), z = le ? ge.danger : void 0, Y = O(() =>
|
|
3846
|
+
}), z = le ? ge.danger : void 0, Y = O(() => mn(i), [i]), Ce = ir(Y, { formId: lt, showInputOnly: !1 }), de = O(
|
|
3854
3847
|
() => u.flat().find((A) => A.value === N),
|
|
3855
3848
|
[u, N]
|
|
3856
3849
|
), Et = R(() => {
|
|
@@ -3925,7 +3918,7 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3925
3918
|
}
|
|
3926
3919
|
),
|
|
3927
3920
|
/* @__PURE__ */ l(
|
|
3928
|
-
|
|
3921
|
+
J,
|
|
3929
3922
|
{
|
|
3930
3923
|
className: "absolute top-2 right-2 hidden group-hover:not-disabled:flex",
|
|
3931
3924
|
variant: "solid",
|
|
@@ -3976,7 +3969,7 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3976
3969
|
}
|
|
3977
3970
|
),
|
|
3978
3971
|
T !== q && D.length > 0 && /* @__PURE__ */ l("div", { className: "w-full", children: k }),
|
|
3979
|
-
T !== q && /* @__PURE__ */ E(
|
|
3972
|
+
T !== q && /* @__PURE__ */ E(Ke, { className: "flex gap-4 bg-(--accent-a2) items-center", children: [
|
|
3980
3973
|
/* @__PURE__ */ E(St.Root, { children: [
|
|
3981
3974
|
/* @__PURE__ */ l(St.Trigger, { asChild: !0, children: /* @__PURE__ */ l(Ot, { icon: !0, size: "sm", variant: "soft", accentColor: "base", children: /* @__PURE__ */ l(L, { icon: "RiEyeLine" }) }) }),
|
|
3982
3975
|
/* @__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." })
|
|
@@ -3985,9 +3978,9 @@ const sr = (t = () => null) => O(() => Hs.map((n) => n.map((e) => {
|
|
|
3985
3978
|
] })
|
|
3986
3979
|
] }) });
|
|
3987
3980
|
});
|
|
3988
|
-
|
|
3981
|
+
yn.displayName = "FieldBuilder";
|
|
3989
3982
|
const lr = P((t) => {
|
|
3990
|
-
const { field: n, index: e, sectionIndex: i, remove: r } = t, { setFieldValue: o, values: s } = xe(), { reorderField: a } =
|
|
3983
|
+
const { field: n, index: e, sectionIndex: i, remove: r } = t, { setFieldValue: o, values: s } = xe(), { reorderField: a } = on(), { showInfo: u, showError: f } = Ge(), m = `fields.${i}.fields`, d = O(
|
|
3991
3984
|
() => ({
|
|
3992
3985
|
index: e,
|
|
3993
3986
|
parentPath: m,
|
|
@@ -4041,17 +4034,17 @@ const lr = P((t) => {
|
|
|
4041
4034
|
},
|
|
4042
4035
|
[n, e, m, o, f]
|
|
4043
4036
|
);
|
|
4044
|
-
return /* @__PURE__ */ l(
|
|
4045
|
-
|
|
4037
|
+
return /* @__PURE__ */ l(en, { draggableId: n.identifier, index: e, children: (c) => /* @__PURE__ */ l(
|
|
4038
|
+
Ke,
|
|
4046
4039
|
{
|
|
4047
4040
|
ref: c.innerRef,
|
|
4048
4041
|
...c.draggableProps,
|
|
4049
4042
|
...c.dragHandleProps,
|
|
4050
4043
|
className: "mb-4",
|
|
4051
4044
|
children: /* @__PURE__ */ E("div", { className: "flex items-center justify-between gap-4 w-full", children: [
|
|
4052
|
-
/* @__PURE__ */ l(
|
|
4045
|
+
/* @__PURE__ */ l(yn, { ...d }),
|
|
4053
4046
|
/* @__PURE__ */ l(
|
|
4054
|
-
|
|
4047
|
+
vn,
|
|
4055
4048
|
{
|
|
4056
4049
|
index: e,
|
|
4057
4050
|
type: n.type,
|
|
@@ -4069,7 +4062,7 @@ const lr = P((t) => {
|
|
|
4069
4062
|
lr.displayName = "FieldWithActions";
|
|
4070
4063
|
const ar = P((t) => {
|
|
4071
4064
|
var S;
|
|
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 } =
|
|
4065
|
+
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 } = on(), { showInfo: f } = Ge(), { fieldsOnly: m } = Xt(Ct), d = R(
|
|
4073
4066
|
(x, F) => {
|
|
4074
4067
|
for (const N of x) {
|
|
4075
4068
|
const T = F.indexOf(N);
|
|
@@ -4151,7 +4144,7 @@ const ar = P((t) => {
|
|
|
4151
4144
|
), w = R(() => {
|
|
4152
4145
|
const x = n.label || "Untitled section", F = n.fields.map((T) => ({
|
|
4153
4146
|
...T,
|
|
4154
|
-
identifier:
|
|
4147
|
+
identifier: rn()
|
|
4155
4148
|
})), N = { ...n, label: x, fields: F };
|
|
4156
4149
|
ut("fields", e + 1, N, s, o), f({
|
|
4157
4150
|
title: "Section duplicated",
|
|
@@ -4169,8 +4162,8 @@ const ar = P((t) => {
|
|
|
4169
4162
|
},
|
|
4170
4163
|
[e, n.fields.length, s, o]
|
|
4171
4164
|
), g = sr(C);
|
|
4172
|
-
return /* @__PURE__ */ l(
|
|
4173
|
-
|
|
4165
|
+
return /* @__PURE__ */ l(en, { draggableId: n.identifier, index: e, children: (x) => /* @__PURE__ */ l(
|
|
4166
|
+
Ke,
|
|
4174
4167
|
{
|
|
4175
4168
|
ref: x.innerRef,
|
|
4176
4169
|
...x.draggableProps,
|
|
@@ -4179,9 +4172,9 @@ const ar = P((t) => {
|
|
|
4179
4172
|
className: "mb-4 w-full",
|
|
4180
4173
|
children: /* @__PURE__ */ E("div", { className: "flex items-center justify-between gap-3 w-full", children: [
|
|
4181
4174
|
/* @__PURE__ */ E("div", { className: "flex grow flex-col gap-2 w-full", children: [
|
|
4182
|
-
!m && /* @__PURE__ */ l(
|
|
4175
|
+
!m && /* @__PURE__ */ l(yn, { ...v }),
|
|
4183
4176
|
/* @__PURE__ */ l(
|
|
4184
|
-
|
|
4177
|
+
Qt,
|
|
4185
4178
|
{
|
|
4186
4179
|
droppableId: n.identifier,
|
|
4187
4180
|
type: "SECTION",
|
|
@@ -4207,7 +4200,7 @@ const ar = P((t) => {
|
|
|
4207
4200
|
)),
|
|
4208
4201
|
F.placeholder,
|
|
4209
4202
|
/* @__PURE__ */ E(B.Root, { children: [
|
|
4210
|
-
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(
|
|
4203
|
+
/* @__PURE__ */ l(B.ClickTrigger, { children: /* @__PURE__ */ E(G, { type: "button", variant: "soft", size: "sm", children: [
|
|
4211
4204
|
/* @__PURE__ */ l(L, { icon: "RiAddLine" }),
|
|
4212
4205
|
" Add field"
|
|
4213
4206
|
] }) }),
|
|
@@ -4223,7 +4216,7 @@ const ar = P((t) => {
|
|
|
4223
4216
|
)
|
|
4224
4217
|
] }),
|
|
4225
4218
|
!m && /* @__PURE__ */ l(
|
|
4226
|
-
|
|
4219
|
+
vn,
|
|
4227
4220
|
{
|
|
4228
4221
|
index: e,
|
|
4229
4222
|
type: n.type,
|
|
@@ -4237,13 +4230,13 @@ const ar = P((t) => {
|
|
|
4237
4230
|
) });
|
|
4238
4231
|
});
|
|
4239
4232
|
ar.displayName = "FieldSectionWithActions";
|
|
4240
|
-
const
|
|
4233
|
+
const Un = (t, n) => {
|
|
4241
4234
|
for (const [e, i] of Object.entries(t))
|
|
4242
4235
|
if (i.identifier === n) return [i, e];
|
|
4243
4236
|
}, cr = P(() => {
|
|
4244
|
-
const { values: t, setFieldValue: n } = xe(), [e, i] = gr(Gs, t.fields,
|
|
4237
|
+
const { values: t, setFieldValue: n } = xe(), [e, i] = gr(Gs, t.fields, Vn), { reorderSection: r, reorderField: o } = on(), { fieldsOnly: s } = Xt(Ct);
|
|
4245
4238
|
H(() => {
|
|
4246
|
-
i({ type: "update", state:
|
|
4239
|
+
i({ type: "update", state: Vn(t.fields) });
|
|
4247
4240
|
}, [i, t.fields]);
|
|
4248
4241
|
const a = R((m) => {
|
|
4249
4242
|
m.type === "SECTION" && i({ type: "hold", fieldId: m.draggableId });
|
|
@@ -4256,7 +4249,7 @@ const Wn = (t, n) => {
|
|
|
4256
4249
|
return;
|
|
4257
4250
|
}
|
|
4258
4251
|
if (b !== "SECTION") throw new Error("Unexpected droppable type.");
|
|
4259
|
-
const [v, w] =
|
|
4252
|
+
const [v, w] = Un(t.fields, d.droppableId) ?? [], [C, g] = Un(t.fields, p.droppableId) ?? [];
|
|
4260
4253
|
o(
|
|
4261
4254
|
v,
|
|
4262
4255
|
w,
|
|
@@ -4274,7 +4267,7 @@ const Wn = (t, n) => {
|
|
|
4274
4267
|
},
|
|
4275
4268
|
[t, n]
|
|
4276
4269
|
);
|
|
4277
|
-
return /* @__PURE__ */ l(Xn, { onDragStart: a, onDragEnd: u, children: /* @__PURE__ */ l(
|
|
4270
|
+
return /* @__PURE__ */ l(Xn, { onDragStart: a, onDragEnd: u, children: /* @__PURE__ */ l(Qt, { droppableId: "droppable", type: "ROOT", children: (m) => /* @__PURE__ */ E(
|
|
4278
4271
|
"div",
|
|
4279
4272
|
{
|
|
4280
4273
|
className: "flex flex-col gap-0",
|
|
@@ -4292,7 +4285,7 @@ const Wn = (t, n) => {
|
|
|
4292
4285
|
}
|
|
4293
4286
|
),
|
|
4294
4287
|
!s && p !== t.fields.length - 1 && /* @__PURE__ */ E(
|
|
4295
|
-
|
|
4288
|
+
G,
|
|
4296
4289
|
{
|
|
4297
4290
|
className: "mb-4",
|
|
4298
4291
|
type: "button",
|
|
@@ -4310,7 +4303,7 @@ const Wn = (t, n) => {
|
|
|
4310
4303
|
)
|
|
4311
4304
|
] }, d.identifier)),
|
|
4312
4305
|
/* @__PURE__ */ E(
|
|
4313
|
-
|
|
4306
|
+
G,
|
|
4314
4307
|
{
|
|
4315
4308
|
className: "mb-4",
|
|
4316
4309
|
type: "button",
|
|
@@ -4333,7 +4326,7 @@ const Wn = (t, n) => {
|
|
|
4333
4326
|
});
|
|
4334
4327
|
cr.displayName = "FieldsEditor";
|
|
4335
4328
|
const pl = P(
|
|
4336
|
-
|
|
4329
|
+
Xe((t, n) => {
|
|
4337
4330
|
const {
|
|
4338
4331
|
onCancel: e,
|
|
4339
4332
|
onSave: i,
|
|
@@ -4346,7 +4339,7 @@ const pl = P(
|
|
|
4346
4339
|
showTabs: m = !0,
|
|
4347
4340
|
disableRequiredFields: d = !1,
|
|
4348
4341
|
tabsListClassName: p
|
|
4349
|
-
} = t, { showError: b } =
|
|
4342
|
+
} = t, { showError: b } = Ge(), y = R(
|
|
4350
4343
|
(g) => {
|
|
4351
4344
|
const S = {};
|
|
4352
4345
|
g.title || (S.title = "Title is required."), (!g.fields || g.fields.length === 0) && (S.fields = "At least one field is required.");
|
|
@@ -4362,7 +4355,7 @@ const pl = P(
|
|
|
4362
4355
|
x = [...x, ...le];
|
|
4363
4356
|
}
|
|
4364
4357
|
}
|
|
4365
|
-
const F =
|
|
4358
|
+
const F = pn(x, g);
|
|
4366
4359
|
if (F && (S.fields = F.fields), he(S))
|
|
4367
4360
|
return b({
|
|
4368
4361
|
title: "Some form settings are invalid",
|
|
@@ -4374,7 +4367,7 @@ const pl = P(
|
|
|
4374
4367
|
() => ({
|
|
4375
4368
|
title: r ?? "",
|
|
4376
4369
|
description: o ?? "",
|
|
4377
|
-
fields: s ? qr(s) : [{ ...ct(
|
|
4370
|
+
fields: s ? qr(s) : [{ ...ct(rn()), label: "" }]
|
|
4378
4371
|
}),
|
|
4379
4372
|
[o, s, r]
|
|
4380
4373
|
), v = Jt({
|
|
@@ -4480,8 +4473,8 @@ const pl = P(
|
|
|
4480
4473
|
)
|
|
4481
4474
|
] }),
|
|
4482
4475
|
/* @__PURE__ */ E("div", { className: "flex items-center justify-end gap-2", children: [
|
|
4483
|
-
e && /* @__PURE__ */ l(
|
|
4484
|
-
/* @__PURE__ */ l(
|
|
4476
|
+
e && /* @__PURE__ */ l(G, { type: "button", variant: "solid", accentColor: "base", onClick: e, children: "Cancel" }),
|
|
4477
|
+
/* @__PURE__ */ l(G, { type: "submit", children: "Save form" })
|
|
4485
4478
|
] })
|
|
4486
4479
|
] })
|
|
4487
4480
|
] }),
|
|
@@ -4491,7 +4484,7 @@ const pl = P(
|
|
|
4491
4484
|
);
|
|
4492
4485
|
export {
|
|
4493
4486
|
W as BaseField,
|
|
4494
|
-
|
|
4487
|
+
Zn as BaseFormElement,
|
|
4495
4488
|
$i as BaseSelectField,
|
|
4496
4489
|
He as BooleanField,
|
|
4497
4490
|
Ui as BooleanInput,
|
|
@@ -4499,10 +4492,10 @@ export {
|
|
|
4499
4492
|
Wi as DateInput,
|
|
4500
4493
|
q as FieldSection,
|
|
4501
4494
|
rr as FieldSectionLayout,
|
|
4502
|
-
|
|
4495
|
+
fn as FieldTypeToClsMapping,
|
|
4503
4496
|
Bs as FieldTypeToEmptyFieldMapping,
|
|
4504
|
-
|
|
4505
|
-
|
|
4497
|
+
Jn as FileCard,
|
|
4498
|
+
tn as FileIcon,
|
|
4506
4499
|
pl as FormBuilder,
|
|
4507
4500
|
qs as FormRenderer,
|
|
4508
4501
|
ks as ImageCard,
|
|
@@ -4520,54 +4513,54 @@ export {
|
|
|
4520
4513
|
qi as NumberInput,
|
|
4521
4514
|
We as PatchField,
|
|
4522
4515
|
hl as PatchFormProvider,
|
|
4523
|
-
Vt as
|
|
4524
|
-
Hi as
|
|
4525
|
-
Gi as QrScanner,
|
|
4526
|
-
$t as RadioField,
|
|
4527
|
-
Ki as RadioInput,
|
|
4516
|
+
Vt as RadioField,
|
|
4517
|
+
Hi as RadioInput,
|
|
4528
4518
|
ge as SEVERITY_COLOR_MAPPING,
|
|
4529
4519
|
ot as SHORT_TEXT_FIELD_MAX_LENGTH,
|
|
4530
4520
|
zr as SUPPORTED_IMAGE_FILE_TYPES,
|
|
4531
4521
|
Br as SUPPORTED_PDF_FILE_TYPES,
|
|
4532
4522
|
_r as SUPPORTED_SPREADSHEET_FILE_EXTENSIONS,
|
|
4523
|
+
$t as ScanField,
|
|
4524
|
+
Gi as ScanInput,
|
|
4525
|
+
Ki as Scanner,
|
|
4533
4526
|
gt as SelectField,
|
|
4534
4527
|
Xi as SelectInput,
|
|
4535
4528
|
Ut as StringField,
|
|
4536
4529
|
Yi as StringInput,
|
|
4537
4530
|
vt as StringOrTextField,
|
|
4538
4531
|
Wt as TextField,
|
|
4539
|
-
|
|
4532
|
+
Ji as TextInput,
|
|
4540
4533
|
jt as UploadField,
|
|
4541
|
-
|
|
4534
|
+
Zi as UploadInput,
|
|
4542
4535
|
fl as decodeFieldValues,
|
|
4543
|
-
|
|
4536
|
+
mn as deserialize,
|
|
4544
4537
|
tr as deserializeField,
|
|
4545
4538
|
Ws as deserializeFields,
|
|
4546
|
-
|
|
4539
|
+
Q as emptyBaseField,
|
|
4547
4540
|
Ns as emptyBooleanField,
|
|
4548
4541
|
Rs as emptyDateField,
|
|
4549
4542
|
Fs as emptyMultiSelectField,
|
|
4550
4543
|
Ss as emptyMultiStringField,
|
|
4551
4544
|
Ls as emptyNumberField,
|
|
4552
|
-
Ds as
|
|
4553
|
-
As as
|
|
4545
|
+
Ds as emptyRadioField,
|
|
4546
|
+
As as emptyScanField,
|
|
4554
4547
|
Ps as emptySelectField,
|
|
4555
4548
|
Os as emptyStringField,
|
|
4556
4549
|
Ms as emptyTextField,
|
|
4557
4550
|
_s as emptyUploadField,
|
|
4558
4551
|
ml as encodeFieldValues,
|
|
4559
4552
|
ul as fieldIcons,
|
|
4560
|
-
|
|
4553
|
+
hn as flattenFields,
|
|
4561
4554
|
js as getFieldsMapping,
|
|
4562
|
-
|
|
4555
|
+
gn as initializeFormValues,
|
|
4563
4556
|
nr as isConditionMet,
|
|
4564
4557
|
$s as maxFileSizeB,
|
|
4565
4558
|
Vs as maxFileSizeKB,
|
|
4566
4559
|
st as maxFileSizeMB,
|
|
4567
4560
|
ir as useFieldInput,
|
|
4568
4561
|
yt as useFieldInputs,
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4562
|
+
Z as useFormikInput,
|
|
4563
|
+
sn as useImageViewer,
|
|
4564
|
+
pn as validateFields,
|
|
4572
4565
|
qt as valueIsFile
|
|
4573
4566
|
};
|