reactaform 1.9.1 → 1.9.21
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/reactaform.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as p, jsxs as
|
|
1
|
+
import { jsx as p, jsxs as z, Fragment as Ie } from "react/jsx-runtime";
|
|
2
2
|
import * as l from "react";
|
|
3
|
-
import { createContext as
|
|
3
|
+
import { createContext as st, useContext as ct, useRef as pe, useEffect as Ue, useCallback as ge } from "react";
|
|
4
4
|
import * as de from "react-dom";
|
|
5
|
-
const
|
|
5
|
+
const lt = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
6
6
|
\r
|
|
7
7
|
/* Default Light Theme */\r
|
|
8
8
|
:root {\r
|
|
@@ -394,8 +394,8 @@ const ct = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
|
394
394
|
\r
|
|
395
395
|
\r
|
|
396
396
|
}\r
|
|
397
|
-
`, Ee =
|
|
398
|
-
const e =
|
|
397
|
+
`, Ee = st(void 0), B = () => {
|
|
398
|
+
const e = ct(Ee);
|
|
399
399
|
if (!e)
|
|
400
400
|
throw new Error("❌ useReactaFormContext must be used within a <ReactaFormProvider>");
|
|
401
401
|
return e;
|
|
@@ -446,36 +446,36 @@ class ne {
|
|
|
446
446
|
return n !== void 0 ? n : t;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
451
|
-
const n = pe(),
|
|
449
|
+
const or = typeof process < "u" && process.env.NODE_ENV === "test";
|
|
450
|
+
function ut(e, r = 300, t) {
|
|
451
|
+
const n = pe(), o = pe(e), a = pe(null), c = t?.leading === !0, s = t?.trailing !== !1;
|
|
452
452
|
Ue(() => {
|
|
453
|
-
|
|
453
|
+
o.current = e;
|
|
454
454
|
}, [e]), Ue(() => () => {
|
|
455
455
|
n.current && clearTimeout(n.current);
|
|
456
456
|
}, []);
|
|
457
457
|
const i = (f) => {
|
|
458
|
-
|
|
458
|
+
o.current(...f);
|
|
459
459
|
}, d = ge(() => {
|
|
460
|
-
n.current && (clearTimeout(n.current), n.current = void 0),
|
|
460
|
+
n.current && (clearTimeout(n.current), n.current = void 0), a.current = null;
|
|
461
461
|
}, []), m = ge(() => {
|
|
462
|
-
n.current && (clearTimeout(n.current), n.current = void 0), s &&
|
|
462
|
+
n.current && (clearTimeout(n.current), n.current = void 0), s && a.current && (i(a.current), a.current = null);
|
|
463
463
|
}, [s]);
|
|
464
464
|
return { callback: ge(
|
|
465
465
|
(...f) => {
|
|
466
|
-
if (
|
|
466
|
+
if (or) {
|
|
467
467
|
i(f);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
470
|
const b = c && !n.current;
|
|
471
|
-
|
|
472
|
-
n.current = void 0, s &&
|
|
471
|
+
a.current = f, b && i(f), n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
472
|
+
n.current = void 0, s && a.current && (i(a.current), a.current = null);
|
|
473
473
|
}, r);
|
|
474
474
|
},
|
|
475
475
|
[c, s, r]
|
|
476
476
|
), cancel: d, flush: m };
|
|
477
477
|
}
|
|
478
|
-
const
|
|
478
|
+
const $ = {
|
|
479
479
|
field: "reactaform-field",
|
|
480
480
|
label: "reactaform-label",
|
|
481
481
|
input: "reactaform-input",
|
|
@@ -488,29 +488,29 @@ const V = {
|
|
|
488
488
|
}, U = (...e) => {
|
|
489
489
|
const r = [];
|
|
490
490
|
for (const t of e)
|
|
491
|
-
t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n,
|
|
492
|
-
|
|
491
|
+
t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n, o]) => {
|
|
492
|
+
o && r.push(n);
|
|
493
493
|
}));
|
|
494
494
|
return r.join(" ");
|
|
495
495
|
};
|
|
496
496
|
function ie(e) {
|
|
497
497
|
return e.toLowerCase().includes("dark");
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function mt(e) {
|
|
500
500
|
if (!e) return !1;
|
|
501
501
|
const r = e.trim();
|
|
502
|
-
let t = 0, n = 0,
|
|
502
|
+
let t = 0, n = 0, o = 0;
|
|
503
503
|
if (r.startsWith("#")) {
|
|
504
504
|
const c = r.substring(1);
|
|
505
|
-
c.length === 3 || c.length === 4 ? (t = parseInt(c[0] + c[0], 16), n = parseInt(c[1] + c[1], 16),
|
|
505
|
+
c.length === 3 || c.length === 4 ? (t = parseInt(c[0] + c[0], 16), n = parseInt(c[1] + c[1], 16), o = parseInt(c[2] + c[2], 16)) : (c.length === 6 || c.length === 8) && (t = parseInt(c.substring(0, 2), 16), n = parseInt(c.substring(2, 4), 16), o = parseInt(c.substring(4, 6), 16));
|
|
506
506
|
} else if (r.startsWith("rgb")) {
|
|
507
507
|
const c = r.match(/\d+(\.\d+)?/g);
|
|
508
|
-
c && c.length >= 3 && (t = Math.min(255, Math.max(0, parseFloat(c[0]))), n = Math.min(255, Math.max(0, parseFloat(c[1]))),
|
|
508
|
+
c && c.length >= 3 && (t = Math.min(255, Math.max(0, parseFloat(c[0]))), n = Math.min(255, Math.max(0, parseFloat(c[1]))), o = Math.min(255, Math.max(0, parseFloat(c[2]))));
|
|
509
509
|
} else
|
|
510
510
|
return !1;
|
|
511
|
-
return (t * 299 + n * 587 +
|
|
511
|
+
return (t * 299 + n * 587 + o * 114) / 1e3 < 128;
|
|
512
512
|
}
|
|
513
|
-
const
|
|
513
|
+
const dt = () => /* @__PURE__ */ z(
|
|
514
514
|
"svg",
|
|
515
515
|
{
|
|
516
516
|
width: "1em",
|
|
@@ -526,18 +526,18 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
526
526
|
/* @__PURE__ */ p("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
527
527
|
]
|
|
528
528
|
}
|
|
529
|
-
),
|
|
530
|
-
const { t: n, theme:
|
|
529
|
+
), ft = ({ content: e, size: r = "medium", animation: t = !0 }) => {
|
|
530
|
+
const { t: n, theme: o, formStyle: a, fieldStyle: c } = B(), [s, i] = l.useState(!1), [d, m] = l.useState({ x: 0, y: 0 }), [u, f] = l.useState(!1), b = l.useRef(null), C = l.useRef(null), N = l.useRef(null), h = l.useId(), y = ie(o), [E, M] = l.useState(void 0);
|
|
531
531
|
l.useLayoutEffect(() => {
|
|
532
532
|
if (!b.current) return;
|
|
533
533
|
const I = "rgba(255,255,255,0.1)", g = getComputedStyle(b.current).getPropertyValue("--reactaform-primary-bg").trim();
|
|
534
534
|
if (g && typeof CSS < "u" && CSS.supports?.("color: color-mix(in srgb, red, blue)")) {
|
|
535
|
-
const w =
|
|
536
|
-
|
|
535
|
+
const w = mt(g) ? "black" : "white";
|
|
536
|
+
M(`color-mix(in srgb, var(--reactaform-primary-bg) 85%, ${w} 15%)`);
|
|
537
537
|
} else
|
|
538
|
-
|
|
538
|
+
M(I);
|
|
539
539
|
}, []);
|
|
540
|
-
const
|
|
540
|
+
const F = l.useMemo(() => {
|
|
541
541
|
const v = {
|
|
542
542
|
icon: {
|
|
543
543
|
display: "inline-flex",
|
|
@@ -587,11 +587,11 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
587
587
|
return (S && j ? j[S] : void 0) ?? {};
|
|
588
588
|
};
|
|
589
589
|
return {
|
|
590
|
-
icon: { ...v.icon, ...g(
|
|
591
|
-
text: { ...v.text, ...g(
|
|
590
|
+
icon: { ...v.icon, ...g(a, "tooltip", "icon"), ...g(c, "tooltip", "icon") },
|
|
591
|
+
text: { ...v.text, ...g(a, "tooltip", "text"), ...g(c, "tooltip", "text") },
|
|
592
592
|
textVisible: v.textVisible
|
|
593
593
|
};
|
|
594
|
-
}, [y, r, t,
|
|
594
|
+
}, [y, r, t, a, c, E]);
|
|
595
595
|
l.useLayoutEffect(() => {
|
|
596
596
|
if (!s || !b.current || !C.current) {
|
|
597
597
|
f(!1);
|
|
@@ -614,25 +614,25 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
614
614
|
);
|
|
615
615
|
}
|
|
616
616
|
}, [s]);
|
|
617
|
-
const
|
|
617
|
+
const V = typeof document < "u" ? document.getElementById("popup-root") : null, R = /* @__PURE__ */ p(
|
|
618
618
|
"div",
|
|
619
619
|
{
|
|
620
620
|
ref: C,
|
|
621
621
|
"data-tooltip-id": h,
|
|
622
622
|
style: {
|
|
623
|
-
...
|
|
623
|
+
...F.text,
|
|
624
624
|
transform: u ? "translateY(0) scale(1)" : "translateY(-4px) scale(0.98)",
|
|
625
625
|
transition: "opacity 120ms ease, transform 120ms ease, visibility 120ms ease",
|
|
626
626
|
width: 240,
|
|
627
627
|
// When positioned is true, apply the visible styles
|
|
628
|
-
...u ?
|
|
628
|
+
...u ? F.textVisible : {},
|
|
629
629
|
top: d.y,
|
|
630
630
|
left: d.x
|
|
631
631
|
},
|
|
632
632
|
children: n(e)
|
|
633
633
|
}
|
|
634
634
|
);
|
|
635
|
-
return /* @__PURE__ */
|
|
635
|
+
return /* @__PURE__ */ z(Ie, { children: [
|
|
636
636
|
/* @__PURE__ */ p(
|
|
637
637
|
"span",
|
|
638
638
|
{
|
|
@@ -642,54 +642,54 @@ const mt = () => /* @__PURE__ */ D(
|
|
|
642
642
|
onMouseEnter: () => i(!0),
|
|
643
643
|
onMouseLeave: () => i(!1),
|
|
644
644
|
style: {
|
|
645
|
-
...
|
|
645
|
+
...F.icon
|
|
646
646
|
},
|
|
647
|
-
children: /* @__PURE__ */ p(
|
|
647
|
+
children: /* @__PURE__ */ p(dt, {})
|
|
648
648
|
}
|
|
649
649
|
),
|
|
650
|
-
s && (
|
|
650
|
+
s && (V ? de.createPortal(R, V) : R)
|
|
651
651
|
] });
|
|
652
|
-
},
|
|
652
|
+
}, ar = l.memo(ft), ve = l.memo(({
|
|
653
653
|
field: e,
|
|
654
654
|
error: r,
|
|
655
655
|
children: t,
|
|
656
656
|
showLabel: n = !0
|
|
657
657
|
}) => {
|
|
658
|
-
const { t:
|
|
658
|
+
const { t: o } = B(), a = e.labelLayout === "column-center" ? "center" : "left", c = l.useMemo(() => {
|
|
659
659
|
const d = {
|
|
660
660
|
display: "flex",
|
|
661
661
|
flexDirection: "column",
|
|
662
662
|
gap: "var(--reactaform-label-gap, 4px)"
|
|
663
663
|
};
|
|
664
|
-
return d["--label-align"] =
|
|
665
|
-
}, [
|
|
666
|
-
textAlign:
|
|
664
|
+
return d["--label-align"] = a, d;
|
|
665
|
+
}, [a]), s = l.useMemo(() => ({
|
|
666
|
+
textAlign: a,
|
|
667
667
|
width: "100%",
|
|
668
668
|
minWidth: "unset",
|
|
669
669
|
display: "block",
|
|
670
670
|
marginBottom: "10px"
|
|
671
|
-
}), [
|
|
671
|
+
}), [a]), i = l.useMemo(() => ({
|
|
672
672
|
display: "flex",
|
|
673
673
|
alignItems: "center",
|
|
674
674
|
gap: "var(--reactaform-inline-gap, 8px)",
|
|
675
675
|
width: "100%"
|
|
676
676
|
}), []);
|
|
677
|
-
return /* @__PURE__ */
|
|
677
|
+
return /* @__PURE__ */ z("div", { className: `${$.field} column-layout`, style: c, children: [
|
|
678
678
|
n && /* @__PURE__ */ p(
|
|
679
679
|
"label",
|
|
680
680
|
{
|
|
681
681
|
id: `${e.name}-label`,
|
|
682
|
-
className:
|
|
682
|
+
className: $.label,
|
|
683
683
|
htmlFor: e.name,
|
|
684
684
|
style: s,
|
|
685
|
-
children:
|
|
685
|
+
children: o(e.displayName)
|
|
686
686
|
}
|
|
687
687
|
),
|
|
688
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ z("div", { style: i, children: [
|
|
689
689
|
/* @__PURE__ */ p("div", { style: { flex: 1, minWidth: 0 }, children: t }),
|
|
690
|
-
e.tooltip && /* @__PURE__ */ p(
|
|
690
|
+
e.tooltip && /* @__PURE__ */ p(ar, { content: e.tooltip })
|
|
691
691
|
] }),
|
|
692
|
-
r && /* @__PURE__ */ p(
|
|
692
|
+
r && /* @__PURE__ */ p(Fe, { id: `${e.name}-error`, children: r })
|
|
693
693
|
] });
|
|
694
694
|
});
|
|
695
695
|
ve.displayName = "ColumnFieldLayout";
|
|
@@ -699,40 +699,40 @@ const ir = l.memo(({
|
|
|
699
699
|
children: t,
|
|
700
700
|
rightAlign: n = !1
|
|
701
701
|
}) => {
|
|
702
|
-
const { t:
|
|
702
|
+
const { t: o } = B(), a = l.useMemo(() => ({
|
|
703
703
|
display: "flex",
|
|
704
704
|
alignItems: "center",
|
|
705
705
|
gap: "3px"
|
|
706
706
|
}), []);
|
|
707
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ z("div", { className: `${$.field} row-layout`, children: [
|
|
708
708
|
/* @__PURE__ */ p(
|
|
709
709
|
"label",
|
|
710
710
|
{
|
|
711
711
|
id: `${e.name}-label`,
|
|
712
|
-
className:
|
|
712
|
+
className: $.label,
|
|
713
713
|
htmlFor: e.name,
|
|
714
714
|
style: { textAlign: "left" },
|
|
715
|
-
children:
|
|
715
|
+
children: o(e.displayName)
|
|
716
716
|
}
|
|
717
717
|
),
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ z("div", { children: [
|
|
719
|
+
/* @__PURE__ */ z("div", { style: a, children: [
|
|
720
720
|
n ? /* @__PURE__ */ p("div", { style: { display: "flex", flex: 1, justifyContent: "flex-end" }, children: t }) : t,
|
|
721
|
-
e.tooltip && /* @__PURE__ */ p(
|
|
721
|
+
e.tooltip && /* @__PURE__ */ p(ar, { content: e.tooltip })
|
|
722
722
|
] }),
|
|
723
|
-
r && /* @__PURE__ */ p(
|
|
723
|
+
r && /* @__PURE__ */ p(Fe, { id: `${e.name}-error`, children: r })
|
|
724
724
|
] })
|
|
725
725
|
] });
|
|
726
726
|
});
|
|
727
727
|
ir.displayName = "RowFieldLayout";
|
|
728
|
-
const
|
|
728
|
+
const L = l.memo(({
|
|
729
729
|
field: e,
|
|
730
730
|
error: r,
|
|
731
731
|
children: t,
|
|
732
732
|
rightAlign: n = !1
|
|
733
733
|
}) => e.labelLayout === "column-left" || e.labelLayout === "column-center" ? /* @__PURE__ */ p(ve, { field: e, error: r, showLabel: !0, children: t }) : e.type === "checkbox" || e.type === "switch" ? /* @__PURE__ */ p(ve, { field: e, error: r, showLabel: !1, children: t }) : /* @__PURE__ */ p(ir, { field: e, error: r, rightAlign: n, children: t }));
|
|
734
|
-
|
|
735
|
-
const
|
|
734
|
+
L.displayName = "StandardFieldLayout";
|
|
735
|
+
const Fe = l.memo(({ children: e, id: r }) => {
|
|
736
736
|
const t = l.useMemo(() => ({
|
|
737
737
|
color: "var(--reactaform-error-color, red)",
|
|
738
738
|
fontSize: "13px",
|
|
@@ -746,11 +746,11 @@ const Me = l.memo(({ children: e, id: r }) => {
|
|
|
746
746
|
}), []);
|
|
747
747
|
return /* @__PURE__ */ p("div", { id: r, style: t, children: e });
|
|
748
748
|
});
|
|
749
|
-
|
|
749
|
+
Fe.displayName = "ErrorDiv";
|
|
750
750
|
const sr = l.memo(({ name: e, onChange: r }) => {
|
|
751
751
|
const { t } = B();
|
|
752
|
-
return /* @__PURE__ */
|
|
753
|
-
/* @__PURE__ */
|
|
752
|
+
return /* @__PURE__ */ z("div", { style: { marginBottom: 16 }, children: [
|
|
753
|
+
/* @__PURE__ */ z("div", { style: { display: "grid", gridTemplateColumns: "1fr 2fr", gap: 12, alignItems: "center" }, children: [
|
|
754
754
|
/* @__PURE__ */ p(
|
|
755
755
|
"label",
|
|
756
756
|
{
|
|
@@ -770,7 +770,7 @@ const sr = l.memo(({ name: e, onChange: r }) => {
|
|
|
770
770
|
id: "instance-name-input",
|
|
771
771
|
type: "text",
|
|
772
772
|
value: e,
|
|
773
|
-
className: U(
|
|
773
|
+
className: U($.input, $.textInput),
|
|
774
774
|
onChange: (n) => r(n.target.value),
|
|
775
775
|
placeholder: t("Enter instance name")
|
|
776
776
|
}
|
|
@@ -780,11 +780,11 @@ const sr = l.memo(({ name: e, onChange: r }) => {
|
|
|
780
780
|
] });
|
|
781
781
|
});
|
|
782
782
|
sr.displayName = "InstanceName";
|
|
783
|
-
class
|
|
783
|
+
class pt extends ne {
|
|
784
784
|
registerInCategory(r, t, n) {
|
|
785
785
|
this.get(r) || this.register(r, {});
|
|
786
|
-
const
|
|
787
|
-
|
|
786
|
+
const o = this.get(r);
|
|
787
|
+
o[t] = n;
|
|
788
788
|
}
|
|
789
789
|
getFromCategory(r, t) {
|
|
790
790
|
return this.get(r)?.[t];
|
|
@@ -796,24 +796,24 @@ class ft extends ne {
|
|
|
796
796
|
return this.list();
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
|
-
const cr = new ne(), lr = new
|
|
800
|
-
function
|
|
799
|
+
const cr = new ne(), lr = new pt(), Me = new ne();
|
|
800
|
+
function gt(e, r) {
|
|
801
801
|
cr.register(e, r);
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function ht(e, r, t) {
|
|
804
804
|
lr.registerInCategory(e, r, t);
|
|
805
805
|
}
|
|
806
|
-
function
|
|
806
|
+
function bt(e, r) {
|
|
807
807
|
if (an(e)) {
|
|
808
808
|
console.warn(
|
|
809
809
|
`[ReactaForm] Can't override builtin type field validation handler for type "${e}".`
|
|
810
810
|
);
|
|
811
811
|
return;
|
|
812
812
|
}
|
|
813
|
-
|
|
813
|
+
Me.register(e, r);
|
|
814
814
|
}
|
|
815
815
|
function H(e, r) {
|
|
816
|
-
|
|
816
|
+
Me.register(e, r);
|
|
817
817
|
}
|
|
818
818
|
function ur(e, r) {
|
|
819
819
|
return lr.getFromCategory(e, r) || null;
|
|
@@ -822,31 +822,31 @@ function mr(e) {
|
|
|
822
822
|
return cr.get(e) || null;
|
|
823
823
|
}
|
|
824
824
|
function dr(e) {
|
|
825
|
-
return
|
|
825
|
+
return Me.get(e) || null;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function yt(e) {
|
|
828
828
|
return (typeof e == "object" || typeof e == "function") && e !== null && typeof e.then == "function";
|
|
829
829
|
}
|
|
830
830
|
const We = /* @__PURE__ */ new Map(), _e = /* @__PURE__ */ new Map();
|
|
831
831
|
function fr(e, r, t, n) {
|
|
832
832
|
if (!r || !r.validationHandlerName)
|
|
833
833
|
return null;
|
|
834
|
-
let
|
|
834
|
+
let o, a;
|
|
835
835
|
if (typeof r.validationHandlerName == "string")
|
|
836
|
-
|
|
836
|
+
o = e, a = r.validationHandlerName;
|
|
837
837
|
else if (Array.isArray(r.validationHandlerName)) {
|
|
838
838
|
const [i, d] = r.validationHandlerName;
|
|
839
839
|
if (d)
|
|
840
|
-
|
|
840
|
+
o = i, a = d;
|
|
841
841
|
else if (i)
|
|
842
|
-
|
|
842
|
+
o = e, a = i;
|
|
843
843
|
else
|
|
844
844
|
return null;
|
|
845
845
|
} else
|
|
846
846
|
return null;
|
|
847
|
-
const c = `${
|
|
847
|
+
const c = `${o}:${a}`;
|
|
848
848
|
let s = We.get(c);
|
|
849
|
-
if (s === void 0 && (s = ur(
|
|
849
|
+
if (s === void 0 && (s = ur(o, a) || null, We.set(c, s)), s)
|
|
850
850
|
try {
|
|
851
851
|
return s(r.name, t, n) || null;
|
|
852
852
|
} catch (i) {
|
|
@@ -854,38 +854,38 @@ function fr(e, r, t, n) {
|
|
|
854
854
|
}
|
|
855
855
|
return null;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
857
|
+
function mo(e, r, t, n) {
|
|
858
858
|
return fr(e, r, t, n);
|
|
859
859
|
}
|
|
860
860
|
function pr(e, r, t, n) {
|
|
861
|
-
const
|
|
862
|
-
if (
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
865
|
-
return
|
|
861
|
+
const o = dr(r.type);
|
|
862
|
+
if (o) {
|
|
863
|
+
const a = o(r, t, n);
|
|
864
|
+
if (a)
|
|
865
|
+
return a;
|
|
866
866
|
} else if (String(t ?? "").trim() === "")
|
|
867
867
|
return r.required ? n("Value required") : null;
|
|
868
868
|
return fr(e, r, t, n);
|
|
869
869
|
}
|
|
870
|
-
async function
|
|
870
|
+
async function vt(e, r, t) {
|
|
871
871
|
if (!e || typeof e.validationHandlerName != "string")
|
|
872
872
|
return null;
|
|
873
873
|
const n = e.validationHandlerName;
|
|
874
|
-
let
|
|
875
|
-
if (
|
|
874
|
+
let o = _e.get(n);
|
|
875
|
+
if (o === void 0 && (o = mr(n) || null, _e.set(n, o)), o)
|
|
876
876
|
try {
|
|
877
|
-
const
|
|
878
|
-
return
|
|
879
|
-
} catch (
|
|
880
|
-
return [String(
|
|
877
|
+
const a = o(r, t);
|
|
878
|
+
return yt(a) ? await a || null : a || null;
|
|
879
|
+
} catch (a) {
|
|
880
|
+
return [String(a instanceof Error ? a.message : a)];
|
|
881
881
|
}
|
|
882
882
|
return null;
|
|
883
883
|
}
|
|
884
884
|
function T(e, r) {
|
|
885
|
-
const { definitionName: t, t: n, fieldValidationMode:
|
|
885
|
+
const { definitionName: t, t: n, fieldValidationMode: o } = B();
|
|
886
886
|
return l.useCallback(
|
|
887
|
-
(
|
|
888
|
-
[t, e, n,
|
|
887
|
+
(a) => o === "onEdit" || o === "realTime" ? pr(t, e, a, n) : r ?? null,
|
|
888
|
+
[t, e, n, o, r]
|
|
889
889
|
);
|
|
890
890
|
}
|
|
891
891
|
const gr = ({
|
|
@@ -893,12 +893,12 @@ const gr = ({
|
|
|
893
893
|
value: r = !1,
|
|
894
894
|
onChange: t,
|
|
895
895
|
onError: n,
|
|
896
|
-
error:
|
|
896
|
+
error: o
|
|
897
897
|
}) => {
|
|
898
|
-
const { t:
|
|
898
|
+
const { t: a } = B(), s = T(e, o)(r);
|
|
899
899
|
l.useEffect(() => {
|
|
900
|
-
|
|
901
|
-
}, [s,
|
|
900
|
+
o || n?.(s);
|
|
901
|
+
}, [s, o, n]);
|
|
902
902
|
const i = l.useCallback(
|
|
903
903
|
(u) => {
|
|
904
904
|
t?.(u.target.checked);
|
|
@@ -910,7 +910,7 @@ const gr = ({
|
|
|
910
910
|
},
|
|
911
911
|
[t, r]
|
|
912
912
|
), m = e.name;
|
|
913
|
-
return /* @__PURE__ */ p(
|
|
913
|
+
return /* @__PURE__ */ p(L, { field: e, rightAlign: !1, error: s, children: /* @__PURE__ */ z(
|
|
914
914
|
"div",
|
|
915
915
|
{
|
|
916
916
|
style: {
|
|
@@ -923,10 +923,10 @@ const gr = ({
|
|
|
923
923
|
/* @__PURE__ */ p(
|
|
924
924
|
"label",
|
|
925
925
|
{
|
|
926
|
-
className:
|
|
926
|
+
className: $.label,
|
|
927
927
|
htmlFor: m,
|
|
928
928
|
style: { textAlign: "left", justifyContent: "flex-start" },
|
|
929
|
-
children:
|
|
929
|
+
children: a(e.displayName)
|
|
930
930
|
}
|
|
931
931
|
),
|
|
932
932
|
/* @__PURE__ */ p(
|
|
@@ -956,26 +956,26 @@ const gr = ({
|
|
|
956
956
|
) });
|
|
957
957
|
};
|
|
958
958
|
gr.displayName = "CheckboxInput";
|
|
959
|
-
const
|
|
959
|
+
const xt = l.memo(gr);
|
|
960
960
|
function _({ value: e, onChange: r, onError: t, validate: n }) {
|
|
961
|
-
const
|
|
961
|
+
const o = l.useRef(null), a = l.useRef(null), c = l.useRef(t), [s, i] = l.useState(null);
|
|
962
962
|
l.useEffect(() => {
|
|
963
963
|
c.current = t;
|
|
964
964
|
}, [t]), l.useEffect(() => {
|
|
965
965
|
const m = String(e ?? "");
|
|
966
|
-
if (!(document.activeElement ===
|
|
966
|
+
if (!(document.activeElement === o.current)) {
|
|
967
967
|
const f = n(m);
|
|
968
|
-
f !==
|
|
968
|
+
f !== a.current && (a.current = f, c.current?.(f ?? null), i(f)), o.current && o.current.value !== m && (o.current.value = m);
|
|
969
969
|
}
|
|
970
970
|
}, [e, n]);
|
|
971
971
|
const d = l.useCallback(
|
|
972
972
|
(m) => {
|
|
973
973
|
const u = m.target.value, f = n(u);
|
|
974
|
-
f !==
|
|
974
|
+
f !== a.current && (a.current = f, i(f), c.current?.(f ?? null)), r?.(u);
|
|
975
975
|
},
|
|
976
976
|
[r, n]
|
|
977
977
|
);
|
|
978
|
-
return { inputRef:
|
|
978
|
+
return { inputRef: o, error: s, handleChange: d };
|
|
979
979
|
}
|
|
980
980
|
const Ke = [
|
|
981
981
|
{ label: "Black", value: "#000000" },
|
|
@@ -992,11 +992,11 @@ const Ke = [
|
|
|
992
992
|
{ label: "Gray", value: "#808080" },
|
|
993
993
|
{ label: "Light Gray", value: "#d3d3d3" },
|
|
994
994
|
{ label: "Pink", value: "#ffc0cb" }
|
|
995
|
-
],
|
|
996
|
-
if (!e || !
|
|
995
|
+
], wt = /^#([0-9A-F]{3}){1,2}$/i, St = "#000000", Ct = (e) => wt.test(e), he = (e) => {
|
|
996
|
+
if (!e || !Ct(e)) return St;
|
|
997
997
|
const r = e.toLowerCase();
|
|
998
998
|
return r.length === 4 ? "#" + r.slice(1).split("").map((t) => t + t).join("") : r;
|
|
999
|
-
},
|
|
999
|
+
}, Nt = (e) => {
|
|
1000
1000
|
const r = parseInt(e.slice(1), 16);
|
|
1001
1001
|
return {
|
|
1002
1002
|
r: r >> 16 & 255,
|
|
@@ -1008,9 +1008,9 @@ const Ke = [
|
|
|
1008
1008
|
value: r,
|
|
1009
1009
|
onChange: t,
|
|
1010
1010
|
onError: n,
|
|
1011
|
-
error:
|
|
1011
|
+
error: o
|
|
1012
1012
|
}) => {
|
|
1013
|
-
const { t:
|
|
1013
|
+
const { t: a } = B(), c = T(e, o), s = l.useMemo(
|
|
1014
1014
|
() => he(r),
|
|
1015
1015
|
[r]
|
|
1016
1016
|
), { inputRef: i, error: d, handleChange: m } = _({
|
|
@@ -1023,29 +1023,29 @@ const Ke = [
|
|
|
1023
1023
|
f(s);
|
|
1024
1024
|
}, [s]);
|
|
1025
1025
|
const b = l.useCallback(
|
|
1026
|
-
(
|
|
1027
|
-
const
|
|
1028
|
-
f(
|
|
1029
|
-
target: { value:
|
|
1026
|
+
(F) => {
|
|
1027
|
+
const V = he(F.target.value);
|
|
1028
|
+
f(V), m({
|
|
1029
|
+
target: { value: V }
|
|
1030
1030
|
});
|
|
1031
1031
|
},
|
|
1032
1032
|
[m]
|
|
1033
1033
|
), C = l.useCallback(
|
|
1034
|
-
(
|
|
1035
|
-
const
|
|
1036
|
-
f(
|
|
1037
|
-
target: { value:
|
|
1034
|
+
(F) => {
|
|
1035
|
+
const V = he(F.target.value);
|
|
1036
|
+
f(V), m({
|
|
1037
|
+
target: { value: V }
|
|
1038
1038
|
});
|
|
1039
1039
|
},
|
|
1040
1040
|
[m]
|
|
1041
1041
|
), h = l.useMemo(
|
|
1042
|
-
() => new Set(Ke.map((
|
|
1042
|
+
() => new Set(Ke.map((F) => F.value)),
|
|
1043
1043
|
[]
|
|
1044
|
-
).has(u), { r: y, g: E, b:
|
|
1045
|
-
() =>
|
|
1044
|
+
).has(u), { r: y, g: E, b: M } = l.useMemo(
|
|
1045
|
+
() => Nt(u),
|
|
1046
1046
|
[u]
|
|
1047
1047
|
);
|
|
1048
|
-
return /* @__PURE__ */ p(
|
|
1048
|
+
return /* @__PURE__ */ p(L, { field: e, error: d, children: /* @__PURE__ */ z(
|
|
1049
1049
|
"div",
|
|
1050
1050
|
{
|
|
1051
1051
|
style: {
|
|
@@ -1055,26 +1055,26 @@ const Ke = [
|
|
|
1055
1055
|
width: "100%"
|
|
1056
1056
|
},
|
|
1057
1057
|
children: [
|
|
1058
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ z(
|
|
1059
1059
|
"select",
|
|
1060
1060
|
{
|
|
1061
1061
|
id: e.name,
|
|
1062
1062
|
value: u,
|
|
1063
1063
|
onChange: C,
|
|
1064
1064
|
className: U(
|
|
1065
|
-
|
|
1066
|
-
|
|
1065
|
+
$.input,
|
|
1066
|
+
$.inputSelect
|
|
1067
1067
|
),
|
|
1068
1068
|
"aria-invalid": !!d,
|
|
1069
1069
|
children: [
|
|
1070
|
-
Ke.map((
|
|
1071
|
-
!h && /* @__PURE__ */
|
|
1070
|
+
Ke.map((F) => /* @__PURE__ */ p("option", { value: F.value, children: a(F.label) }, F.value)),
|
|
1071
|
+
!h && /* @__PURE__ */ z("option", { value: u, children: [
|
|
1072
1072
|
"(",
|
|
1073
1073
|
y,
|
|
1074
1074
|
", ",
|
|
1075
1075
|
E,
|
|
1076
1076
|
", ",
|
|
1077
|
-
|
|
1077
|
+
M,
|
|
1078
1078
|
")"
|
|
1079
1079
|
] })
|
|
1080
1080
|
]
|
|
@@ -1112,7 +1112,7 @@ const Ke = [
|
|
|
1112
1112
|
) });
|
|
1113
1113
|
};
|
|
1114
1114
|
hr.displayName = "ColorInput";
|
|
1115
|
-
const
|
|
1115
|
+
const kt = l.memo(hr), Ge = (e) => {
|
|
1116
1116
|
if (!e) return null;
|
|
1117
1117
|
const r = new Date(e);
|
|
1118
1118
|
return isNaN(r.getTime()) ? null : r;
|
|
@@ -1122,8 +1122,8 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1122
1122
|
return Ge(e) ? e : "";
|
|
1123
1123
|
const t = Ge(e);
|
|
1124
1124
|
if (t) {
|
|
1125
|
-
const n = t.getUTCFullYear(),
|
|
1126
|
-
return `${n}-${
|
|
1125
|
+
const n = t.getUTCFullYear(), o = String(t.getUTCMonth() + 1).padStart(2, "0"), a = String(t.getUTCDate()).padStart(2, "0");
|
|
1126
|
+
return `${n}-${o}-${a}`;
|
|
1127
1127
|
}
|
|
1128
1128
|
return "";
|
|
1129
1129
|
}, br = ({
|
|
@@ -1131,15 +1131,15 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1131
1131
|
value: r,
|
|
1132
1132
|
onChange: t,
|
|
1133
1133
|
onError: n,
|
|
1134
|
-
error:
|
|
1134
|
+
error: o
|
|
1135
1135
|
}) => {
|
|
1136
|
-
const
|
|
1136
|
+
const a = T(e, o), c = Je(r), { inputRef: s, error: i, handleChange: d } = _({
|
|
1137
1137
|
value: c,
|
|
1138
1138
|
onChange: t,
|
|
1139
1139
|
onError: n,
|
|
1140
|
-
validate:
|
|
1140
|
+
validate: a
|
|
1141
1141
|
});
|
|
1142
|
-
return /* @__PURE__ */ p(
|
|
1142
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1143
1143
|
"input",
|
|
1144
1144
|
{
|
|
1145
1145
|
id: e.name,
|
|
@@ -1147,7 +1147,7 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1147
1147
|
ref: s,
|
|
1148
1148
|
defaultValue: Je(r),
|
|
1149
1149
|
onChange: d,
|
|
1150
|
-
className: U(
|
|
1150
|
+
className: U($.input, $.textInput),
|
|
1151
1151
|
...e.minDate ? { min: e.minDate } : {},
|
|
1152
1152
|
...e.maxDate ? { max: e.maxDate } : {},
|
|
1153
1153
|
"aria-invalid": !!i,
|
|
@@ -1156,30 +1156,30 @@ const Nt = l.memo(hr), Ge = (e) => {
|
|
|
1156
1156
|
) });
|
|
1157
1157
|
};
|
|
1158
1158
|
br.displayName = "DateInput";
|
|
1159
|
-
const
|
|
1160
|
-
const { t: r } = B(), { displayText: t = "", textAlign: n = "left", allowHtml:
|
|
1159
|
+
const It = l.memo(br), yr = ({ field: e }) => {
|
|
1160
|
+
const { t: r } = B(), { displayText: t = "", textAlign: n = "left", allowHtml: o = !1 } = e;
|
|
1161
1161
|
return /* @__PURE__ */ p(
|
|
1162
1162
|
"div",
|
|
1163
1163
|
{
|
|
1164
|
-
className:
|
|
1164
|
+
className: $.description,
|
|
1165
1165
|
style: { textAlign: n },
|
|
1166
|
-
...
|
|
1166
|
+
...o ? { dangerouslySetInnerHTML: { __html: r(t) } } : { children: r(t) }
|
|
1167
1167
|
}
|
|
1168
1168
|
);
|
|
1169
1169
|
};
|
|
1170
1170
|
yr.displayName = "Description";
|
|
1171
|
-
const
|
|
1171
|
+
const Et = l.memo(yr), vr = ({
|
|
1172
1172
|
field: e,
|
|
1173
1173
|
value: r,
|
|
1174
1174
|
onChange: t,
|
|
1175
1175
|
onError: n,
|
|
1176
|
-
error:
|
|
1176
|
+
error: o
|
|
1177
1177
|
}) => {
|
|
1178
|
-
const { t:
|
|
1178
|
+
const { t: a, theme: c, formStyle: s, fieldStyle: i } = B(), d = l.useRef(null), m = l.useRef(n), [u, f] = l.useState(!1), [b, C] = l.useState(null);
|
|
1179
1179
|
l.useEffect(() => {
|
|
1180
1180
|
m.current = n;
|
|
1181
1181
|
}, [n]);
|
|
1182
|
-
const N = T(e,
|
|
1182
|
+
const N = T(e, o), [h, y] = l.useState(null), E = l.useRef(null);
|
|
1183
1183
|
l.useEffect(() => {
|
|
1184
1184
|
const g = String(r ?? "");
|
|
1185
1185
|
let w = N(g);
|
|
@@ -1189,17 +1189,17 @@ const It = l.memo(yr), vr = ({
|
|
|
1189
1189
|
}
|
|
1190
1190
|
w !== E.current && (E.current = w, y(w), m.current?.(w ?? null));
|
|
1191
1191
|
}, [r, N, t, e.options]);
|
|
1192
|
-
const
|
|
1192
|
+
const M = () => {
|
|
1193
1193
|
if (!d.current) return;
|
|
1194
1194
|
const g = d.current.getBoundingClientRect();
|
|
1195
1195
|
C({ x: g.left, y: g.bottom }), f((w) => !w);
|
|
1196
|
-
},
|
|
1196
|
+
}, F = (g) => {
|
|
1197
1197
|
const w = N(g);
|
|
1198
1198
|
w !== E.current && (E.current = w, y(w), m.current?.(w ?? null)), t?.(g), f(!1);
|
|
1199
|
-
},
|
|
1199
|
+
}, V = l.useMemo(() => {
|
|
1200
1200
|
const g = e.options.find((w) => String(w.value) === String(r));
|
|
1201
|
-
return g ?
|
|
1202
|
-
}, [e.options, r,
|
|
1201
|
+
return g ? a(g.label) : "";
|
|
1202
|
+
}, [e.options, r, a]), R = (g, w, x) => {
|
|
1203
1203
|
if (!w) return {};
|
|
1204
1204
|
const S = g?.[w];
|
|
1205
1205
|
return (x && S ? S[x] : void 0) ?? {};
|
|
@@ -1225,14 +1225,14 @@ const It = l.memo(yr), vr = ({
|
|
|
1225
1225
|
...R(s, "dropdown", "arrow"),
|
|
1226
1226
|
...R(i, void 0, "arrow")
|
|
1227
1227
|
}), [s, i]);
|
|
1228
|
-
return /* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */ p(
|
|
1228
|
+
return /* @__PURE__ */ z("div", { children: [
|
|
1229
|
+
/* @__PURE__ */ p(L, { field: e, error: h, children: /* @__PURE__ */ z(
|
|
1230
1230
|
"div",
|
|
1231
1231
|
{
|
|
1232
1232
|
ref: d,
|
|
1233
1233
|
className: "reactaform-input",
|
|
1234
1234
|
style: I,
|
|
1235
|
-
onClick:
|
|
1235
|
+
onClick: M,
|
|
1236
1236
|
tabIndex: 0,
|
|
1237
1237
|
role: "combobox",
|
|
1238
1238
|
"aria-haspopup": "listbox",
|
|
@@ -1240,42 +1240,42 @@ const It = l.memo(yr), vr = ({
|
|
|
1240
1240
|
"aria-invalid": !!h,
|
|
1241
1241
|
"aria-describedby": h ? `${e.name}-error` : void 0,
|
|
1242
1242
|
onKeyDown: (g) => {
|
|
1243
|
-
(g.key === "Enter" || g.key === " ") && (g.preventDefault(),
|
|
1243
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), M());
|
|
1244
1244
|
},
|
|
1245
1245
|
children: [
|
|
1246
|
-
/* @__PURE__ */ p("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", paddingRight: "1.8em", display: "block" }, children:
|
|
1246
|
+
/* @__PURE__ */ p("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", paddingRight: "1.8em", display: "block" }, children: V }),
|
|
1247
1247
|
/* @__PURE__ */ p("span", { style: v, "aria-hidden": !0, children: "▼" })
|
|
1248
1248
|
]
|
|
1249
1249
|
}
|
|
1250
1250
|
) }),
|
|
1251
1251
|
u && b && /* @__PURE__ */ p(
|
|
1252
|
-
|
|
1252
|
+
Ft,
|
|
1253
1253
|
{
|
|
1254
1254
|
position: b,
|
|
1255
1255
|
options: e.options,
|
|
1256
1256
|
selectedValue: String(r),
|
|
1257
|
-
onSelect:
|
|
1257
|
+
onSelect: F,
|
|
1258
1258
|
onClose: () => f(!1),
|
|
1259
1259
|
controlRef: d,
|
|
1260
1260
|
theme: c,
|
|
1261
|
-
t:
|
|
1261
|
+
t: a
|
|
1262
1262
|
}
|
|
1263
1263
|
)
|
|
1264
1264
|
] });
|
|
1265
|
-
},
|
|
1265
|
+
}, Ft = ({
|
|
1266
1266
|
position: e,
|
|
1267
1267
|
options: r,
|
|
1268
1268
|
selectedValue: t,
|
|
1269
1269
|
onSelect: n,
|
|
1270
|
-
onClose:
|
|
1271
|
-
controlRef:
|
|
1270
|
+
onClose: o,
|
|
1271
|
+
controlRef: a,
|
|
1272
1272
|
theme: c,
|
|
1273
1273
|
t: s
|
|
1274
1274
|
}) => {
|
|
1275
1275
|
const i = l.useRef(null), [d, m] = l.useState(-1), { formStyle: u, fieldStyle: f } = B(), b = ie(c ?? "light");
|
|
1276
1276
|
l.useLayoutEffect(() => {
|
|
1277
|
-
if (!
|
|
1278
|
-
const v =
|
|
1277
|
+
if (!a.current) return;
|
|
1278
|
+
const v = a.current.closest("[data-reactaform-theme]"), g = document.getElementById("popup-root");
|
|
1279
1279
|
if (v && g) {
|
|
1280
1280
|
const w = getComputedStyle(v);
|
|
1281
1281
|
g.style.setProperty(
|
|
@@ -1289,7 +1289,7 @@ const It = l.memo(yr), vr = ({
|
|
|
1289
1289
|
w.getPropertyValue("--reactaform-option-menu-hover-bg")
|
|
1290
1290
|
);
|
|
1291
1291
|
}
|
|
1292
|
-
}, [
|
|
1292
|
+
}, [a]);
|
|
1293
1293
|
const C = (v, g, w) => {
|
|
1294
1294
|
if (!g) return {};
|
|
1295
1295
|
const k = v?.[g];
|
|
@@ -1320,10 +1320,10 @@ const It = l.memo(yr), vr = ({
|
|
|
1320
1320
|
l.useEffect(() => {
|
|
1321
1321
|
const v = (g) => {
|
|
1322
1322
|
const w = g.target;
|
|
1323
|
-
!i.current?.contains(w) && !
|
|
1323
|
+
!i.current?.contains(w) && !a.current?.contains(w) && o();
|
|
1324
1324
|
};
|
|
1325
1325
|
return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
|
|
1326
|
-
}, [
|
|
1326
|
+
}, [o, a]), l.useEffect(() => {
|
|
1327
1327
|
if (i.current && r.length > 0) {
|
|
1328
1328
|
const v = r.findIndex((g) => String(g.value) === t);
|
|
1329
1329
|
requestAnimationFrame(() => m(v >= 0 ? v : 0));
|
|
@@ -1333,25 +1333,25 @@ const It = l.memo(yr), vr = ({
|
|
|
1333
1333
|
const v = i.current.querySelector(`#opt-${d}`);
|
|
1334
1334
|
v && requestAnimationFrame(() => v.focus());
|
|
1335
1335
|
}, [d]);
|
|
1336
|
-
const y = 250, E = 200, [
|
|
1336
|
+
const y = 250, E = 200, [M, F] = l.useState(null), [V, R] = l.useState(null);
|
|
1337
1337
|
if (l.useEffect(() => {
|
|
1338
1338
|
if (typeof window > "u") return;
|
|
1339
1339
|
const v = () => {
|
|
1340
1340
|
let x = e.x, k = e.y, S = y;
|
|
1341
|
-
const A =
|
|
1341
|
+
const A = a?.current;
|
|
1342
1342
|
if (A) {
|
|
1343
1343
|
const j = A.getBoundingClientRect();
|
|
1344
1344
|
x = j.left, k = j.bottom, S = Math.max(80, Math.round(j.width));
|
|
1345
1345
|
}
|
|
1346
|
-
x = Math.min(x, window.innerWidth - S), k = Math.min(k, window.innerHeight - E),
|
|
1346
|
+
x = Math.min(x, window.innerWidth - S), k = Math.min(k, window.innerHeight - E), F({ left: x, top: k }), R(S);
|
|
1347
1347
|
};
|
|
1348
1348
|
v(), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v);
|
|
1349
1349
|
let g = null;
|
|
1350
|
-
const w =
|
|
1350
|
+
const w = a?.current;
|
|
1351
1351
|
return typeof ResizeObserver < "u" && w && (g = new ResizeObserver(() => v()), g.observe(w)), () => {
|
|
1352
1352
|
window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v), g && w && g.unobserve(w);
|
|
1353
1353
|
};
|
|
1354
|
-
}, [
|
|
1354
|
+
}, [a, e.x, e.y]), typeof window > "u") return null;
|
|
1355
1355
|
let I = document.getElementById("popup-root");
|
|
1356
1356
|
return I || (I = document.createElement("div"), I.id = "popup-root", document.body.appendChild(I)), de.createPortal(
|
|
1357
1357
|
/* @__PURE__ */ p(
|
|
@@ -1362,9 +1362,9 @@ const It = l.memo(yr), vr = ({
|
|
|
1362
1362
|
"aria-activedescendant": d >= 0 ? `opt-${d}` : void 0,
|
|
1363
1363
|
style: {
|
|
1364
1364
|
position: "fixed",
|
|
1365
|
-
top:
|
|
1366
|
-
left:
|
|
1367
|
-
width:
|
|
1365
|
+
top: M ? M.top : e.y,
|
|
1366
|
+
left: M ? M.left : e.x,
|
|
1367
|
+
width: V ?? y,
|
|
1368
1368
|
...N
|
|
1369
1369
|
},
|
|
1370
1370
|
"data-reactaform-theme": c ?? "light",
|
|
@@ -1401,7 +1401,7 @@ const It = l.memo(yr), vr = ({
|
|
|
1401
1401
|
S.preventDefault(), S.stopPropagation(), n(String(v.value));
|
|
1402
1402
|
break;
|
|
1403
1403
|
case "Escape":
|
|
1404
|
-
S.preventDefault(),
|
|
1404
|
+
S.preventDefault(), o(), a?.current?.focus();
|
|
1405
1405
|
break;
|
|
1406
1406
|
}
|
|
1407
1407
|
},
|
|
@@ -1431,15 +1431,15 @@ const Mt = l.memo(vr), xr = ({
|
|
|
1431
1431
|
value: r,
|
|
1432
1432
|
onChange: t,
|
|
1433
1433
|
onError: n,
|
|
1434
|
-
error:
|
|
1434
|
+
error: o
|
|
1435
1435
|
}) => {
|
|
1436
|
-
const
|
|
1436
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1437
1437
|
value: r,
|
|
1438
1438
|
onChange: t,
|
|
1439
1439
|
onError: n,
|
|
1440
|
-
validate:
|
|
1440
|
+
validate: a
|
|
1441
1441
|
});
|
|
1442
|
-
return /* @__PURE__ */ p(
|
|
1442
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1443
1443
|
"input",
|
|
1444
1444
|
{
|
|
1445
1445
|
id: e.name,
|
|
@@ -1447,18 +1447,18 @@ const Mt = l.memo(vr), xr = ({
|
|
|
1447
1447
|
defaultValue: String(r ?? ""),
|
|
1448
1448
|
ref: c,
|
|
1449
1449
|
onChange: i,
|
|
1450
|
-
className: U(
|
|
1450
|
+
className: U($.input, $.textInput),
|
|
1451
1451
|
"aria-invalid": !!s,
|
|
1452
1452
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
1453
1453
|
}
|
|
1454
1454
|
) });
|
|
1455
1455
|
};
|
|
1456
1456
|
xr.displayName = "EmailInput";
|
|
1457
|
-
const
|
|
1457
|
+
const Vt = l.memo(xr), wr = ({ field: e }) => {
|
|
1458
1458
|
const { theme: r } = B(), {
|
|
1459
1459
|
color: t = ie(r) ? "#444444" : "#CCCCCC",
|
|
1460
1460
|
thickness: n = 1,
|
|
1461
|
-
margin:
|
|
1461
|
+
margin: o = "8px 0"
|
|
1462
1462
|
} = e;
|
|
1463
1463
|
return /* @__PURE__ */ p(
|
|
1464
1464
|
"div",
|
|
@@ -1468,20 +1468,20 @@ const Ft = l.memo(xr), wr = ({ field: e }) => {
|
|
|
1468
1468
|
height: "0",
|
|
1469
1469
|
// ensures only 1 line
|
|
1470
1470
|
borderTop: `${n}px solid ${t}`,
|
|
1471
|
-
margin:
|
|
1471
|
+
margin: o
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
1474
|
);
|
|
1475
1475
|
};
|
|
1476
1476
|
wr.displayName = "FieldSeparator";
|
|
1477
|
-
const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, error:
|
|
1478
|
-
const { t:
|
|
1477
|
+
const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
|
|
1478
|
+
const { t: a, theme: c } = B(), [s, i] = l.useState(!1), d = l.useRef(null), m = l.useRef(n), u = l.useRef(null), [f, b] = l.useState(null), C = ie(c);
|
|
1479
1479
|
l.useEffect(() => {
|
|
1480
1480
|
m.current = n;
|
|
1481
1481
|
}, [n]);
|
|
1482
1482
|
const N = (g, w) => w.some(
|
|
1483
1483
|
(x) => x.name === g.name && x.size === g.size && x.lastModified === g.lastModified
|
|
1484
|
-
), h = T(e,
|
|
1484
|
+
), h = T(e, o);
|
|
1485
1485
|
l.useEffect(() => {
|
|
1486
1486
|
const g = h(r ?? []);
|
|
1487
1487
|
t?.(r), g !== u.current && (u.current = g, b(g), m.current?.(g ?? null));
|
|
@@ -1513,11 +1513,11 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1513
1513
|
const S = h(k);
|
|
1514
1514
|
S !== u.current && (u.current = S, b(S), m.current?.(S ?? null)), t?.(k);
|
|
1515
1515
|
}
|
|
1516
|
-
}, F = (g) => {
|
|
1517
|
-
g.preventDefault(), g.stopPropagation(), i(!0);
|
|
1518
1516
|
}, M = (g) => {
|
|
1517
|
+
g.preventDefault(), g.stopPropagation(), i(!0);
|
|
1518
|
+
}, F = (g) => {
|
|
1519
1519
|
g.preventDefault(), g.stopPropagation(), i(!1);
|
|
1520
|
-
},
|
|
1520
|
+
}, V = (g) => {
|
|
1521
1521
|
if (Array.isArray(r) && typeof g == "number") {
|
|
1522
1522
|
const w = r.filter((S, A) => A !== g), x = w.length > 0 ? w : null, k = h(x ?? []);
|
|
1523
1523
|
k !== u.current && (u.current = k, b(k), m.current?.(k ?? null)), t?.(x);
|
|
@@ -1535,7 +1535,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1535
1535
|
gap: "6px",
|
|
1536
1536
|
maxHeight: "200px",
|
|
1537
1537
|
overflowY: "auto"
|
|
1538
|
-
}, children: g.map((w, x) => /* @__PURE__ */
|
|
1538
|
+
}, children: g.map((w, x) => /* @__PURE__ */ z(
|
|
1539
1539
|
"div",
|
|
1540
1540
|
{
|
|
1541
1541
|
style: {
|
|
@@ -1565,8 +1565,8 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1565
1565
|
"button",
|
|
1566
1566
|
{
|
|
1567
1567
|
type: "button",
|
|
1568
|
-
onClick: () =>
|
|
1569
|
-
"aria-label":
|
|
1568
|
+
onClick: () => V(Array.isArray(r) ? x : void 0),
|
|
1569
|
+
"aria-label": a("Remove file"),
|
|
1570
1570
|
style: {
|
|
1571
1571
|
background: "transparent",
|
|
1572
1572
|
border: "none",
|
|
@@ -1593,14 +1593,14 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1593
1593
|
`${w.name}-${x}`
|
|
1594
1594
|
)) });
|
|
1595
1595
|
}, [I, v] = l.useState(!1);
|
|
1596
|
-
return /* @__PURE__ */ p(
|
|
1597
|
-
/* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ p(L, { field: e, error: f, children: /* @__PURE__ */ z("div", { style: { width: "100%" }, children: [
|
|
1597
|
+
/* @__PURE__ */ z(
|
|
1598
1598
|
"div",
|
|
1599
1599
|
{
|
|
1600
1600
|
className: "reactaform-input",
|
|
1601
1601
|
onDrop: E,
|
|
1602
|
-
onDragOver:
|
|
1603
|
-
onDragLeave:
|
|
1602
|
+
onDragOver: M,
|
|
1603
|
+
onDragLeave: F,
|
|
1604
1604
|
onMouseEnter: () => v(!0),
|
|
1605
1605
|
onMouseLeave: () => v(!1),
|
|
1606
1606
|
style: {
|
|
@@ -1630,7 +1630,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1630
1630
|
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), d.current?.click());
|
|
1631
1631
|
},
|
|
1632
1632
|
role: "button",
|
|
1633
|
-
"aria-label": e.multiple ?
|
|
1633
|
+
"aria-label": e.multiple ? a("Choose Files or Drag & Drop") : a("Choose File or Drag & Drop"),
|
|
1634
1634
|
"aria-invalid": !!f,
|
|
1635
1635
|
"aria-describedby": f ? `${e.name}-error` : void 0,
|
|
1636
1636
|
children: [
|
|
@@ -1660,7 +1660,7 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1660
1660
|
color: "var(--reactaform-text-color, #111827)",
|
|
1661
1661
|
flex: 1,
|
|
1662
1662
|
textAlign: "left"
|
|
1663
|
-
}, children: s ?
|
|
1663
|
+
}, children: s ? a("Drop files here") : e.multiple ? a("Choose Files or Drag & Drop") : a("Choose File or Drag & Drop") })
|
|
1664
1664
|
]
|
|
1665
1665
|
}
|
|
1666
1666
|
),
|
|
@@ -1668,20 +1668,20 @@ const $t = l.memo(wr), Sr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
1668
1668
|
] }) });
|
|
1669
1669
|
};
|
|
1670
1670
|
Sr.displayName = "FileInput";
|
|
1671
|
-
const
|
|
1671
|
+
const At = l.memo(Sr), Cr = ({
|
|
1672
1672
|
field: e,
|
|
1673
1673
|
value: r,
|
|
1674
1674
|
onChange: t,
|
|
1675
1675
|
onError: n,
|
|
1676
|
-
error:
|
|
1676
|
+
error: o
|
|
1677
1677
|
}) => {
|
|
1678
|
-
const
|
|
1678
|
+
const a = T(e, o), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
|
|
1679
1679
|
value: c,
|
|
1680
1680
|
onChange: t,
|
|
1681
1681
|
onError: n,
|
|
1682
|
-
validate:
|
|
1682
|
+
validate: a
|
|
1683
1683
|
});
|
|
1684
|
-
return /* @__PURE__ */ p(
|
|
1684
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1685
1685
|
"input",
|
|
1686
1686
|
{
|
|
1687
1687
|
id: e.name,
|
|
@@ -1689,7 +1689,7 @@ const Vt = l.memo(Sr), Cr = ({
|
|
|
1689
1689
|
defaultValue: c,
|
|
1690
1690
|
ref: s,
|
|
1691
1691
|
onChange: d,
|
|
1692
|
-
className: U(
|
|
1692
|
+
className: U($.input, $.textInput),
|
|
1693
1693
|
style: { flex: 1 },
|
|
1694
1694
|
"aria-invalid": !!i,
|
|
1695
1695
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
@@ -1697,20 +1697,20 @@ const Vt = l.memo(Sr), Cr = ({
|
|
|
1697
1697
|
) });
|
|
1698
1698
|
};
|
|
1699
1699
|
Cr.displayName = "FloatArrayInput";
|
|
1700
|
-
const
|
|
1700
|
+
const Rt = l.memo(Cr), Nr = ({
|
|
1701
1701
|
field: e,
|
|
1702
1702
|
value: r,
|
|
1703
1703
|
onChange: t,
|
|
1704
1704
|
onError: n,
|
|
1705
|
-
error:
|
|
1705
|
+
error: o
|
|
1706
1706
|
}) => {
|
|
1707
|
-
const
|
|
1707
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1708
1708
|
value: r,
|
|
1709
1709
|
onChange: t,
|
|
1710
1710
|
onError: n,
|
|
1711
|
-
validate:
|
|
1711
|
+
validate: a
|
|
1712
1712
|
});
|
|
1713
|
-
return /* @__PURE__ */ p(
|
|
1713
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1714
1714
|
"input",
|
|
1715
1715
|
{
|
|
1716
1716
|
id: e.name,
|
|
@@ -1719,8 +1719,8 @@ const At = l.memo(Cr), Nr = ({
|
|
|
1719
1719
|
defaultValue: String(r ?? ""),
|
|
1720
1720
|
onChange: i,
|
|
1721
1721
|
className: U(
|
|
1722
|
-
|
|
1723
|
-
|
|
1722
|
+
$.input,
|
|
1723
|
+
$.inputNumber
|
|
1724
1724
|
),
|
|
1725
1725
|
"aria-invalid": !!s,
|
|
1726
1726
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
@@ -1728,8 +1728,8 @@ const At = l.memo(Cr), Nr = ({
|
|
|
1728
1728
|
) });
|
|
1729
1729
|
};
|
|
1730
1730
|
Nr.displayName = "FloatInput";
|
|
1731
|
-
const
|
|
1732
|
-
function
|
|
1731
|
+
const Dt = l.memo(Nr);
|
|
1732
|
+
function zt() {
|
|
1733
1733
|
try {
|
|
1734
1734
|
return "/";
|
|
1735
1735
|
} catch {
|
|
@@ -1742,24 +1742,24 @@ function Dt() {
|
|
|
1742
1742
|
return "/";
|
|
1743
1743
|
}
|
|
1744
1744
|
const kr = ({ field: e, value: r }) => {
|
|
1745
|
-
const { language: t, t: n } = B(),
|
|
1745
|
+
const { language: t, t: n } = B(), o = e.alignment || "center", a = {
|
|
1746
1746
|
left: "flex-start",
|
|
1747
1747
|
center: "center",
|
|
1748
1748
|
right: "flex-end"
|
|
1749
1749
|
}, c = typeof r == "string" ? r : "";
|
|
1750
1750
|
let s = c && c.trim() !== "" ? c : typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
1751
|
-
s && !s.startsWith("/") && (s = `${
|
|
1751
|
+
s && !s.startsWith("/") && (s = `${zt()}${s}`);
|
|
1752
1752
|
const i = e.localized?.split(";").map((h) => h.trim()), [d, m] = l.useState(s || ""), u = l.useRef(s || null);
|
|
1753
1753
|
if (l.useEffect(() => {
|
|
1754
1754
|
if (!s) return;
|
|
1755
1755
|
const h = s.split("/"), y = h.pop(), E = y.lastIndexOf(".");
|
|
1756
1756
|
if (E === -1) return;
|
|
1757
|
-
const
|
|
1758
|
-
let
|
|
1759
|
-
i?.includes(t) && (
|
|
1757
|
+
const M = y.substring(0, E), F = y.substring(E);
|
|
1758
|
+
let V = null;
|
|
1759
|
+
i?.includes(t) && (V = `${M}_${t}${F}`);
|
|
1760
1760
|
const R = new AbortController();
|
|
1761
|
-
if (
|
|
1762
|
-
const I = [...h,
|
|
1761
|
+
if (V) {
|
|
1762
|
+
const I = [...h, V].join("/");
|
|
1763
1763
|
fetch(I, { method: "HEAD", signal: R.signal }).then((v) => {
|
|
1764
1764
|
const g = v.ok ? I : s;
|
|
1765
1765
|
g !== u.current && (u.current = g, m(g));
|
|
@@ -1780,13 +1780,13 @@ const kr = ({ field: e, value: r }) => {
|
|
|
1780
1780
|
boxShadow: "0 2px 6px rgba(0,0,0,0.1)",
|
|
1781
1781
|
margin: "0 0 8px 0"
|
|
1782
1782
|
};
|
|
1783
|
-
return f && b ? (C.width = f, C.height = b, N.width = `${f}px`, N.height = `${b}px`) : f && !b ? (C.width = f, N.width = `${f}px`, N.height = "auto") : !f && b && (C.height = b, N.width = "auto", N.height = `${b}px`), /* @__PURE__ */ p(
|
|
1783
|
+
return f && b ? (C.width = f, C.height = b, N.width = `${f}px`, N.height = `${b}px`) : f && !b ? (C.width = f, N.width = `${f}px`, N.height = "auto") : !f && b && (C.height = b, N.width = "auto", N.height = `${b}px`), /* @__PURE__ */ p(L, { field: e, children: /* @__PURE__ */ p(
|
|
1784
1784
|
"div",
|
|
1785
1785
|
{
|
|
1786
1786
|
"data-testid": "image-wrapper",
|
|
1787
1787
|
style: {
|
|
1788
1788
|
display: "flex",
|
|
1789
|
-
justifyContent: o
|
|
1789
|
+
justifyContent: a[o] || "center",
|
|
1790
1790
|
margin: "0 0"
|
|
1791
1791
|
},
|
|
1792
1792
|
children: /* @__PURE__ */ p(
|
|
@@ -1802,20 +1802,20 @@ const kr = ({ field: e, value: r }) => {
|
|
|
1802
1802
|
) });
|
|
1803
1803
|
};
|
|
1804
1804
|
kr.displayName = "ImageDisplay";
|
|
1805
|
-
const
|
|
1805
|
+
const Pt = l.memo(kr), Ir = ({
|
|
1806
1806
|
field: e,
|
|
1807
1807
|
value: r,
|
|
1808
1808
|
onChange: t,
|
|
1809
1809
|
onError: n,
|
|
1810
|
-
error:
|
|
1810
|
+
error: o
|
|
1811
1811
|
}) => {
|
|
1812
|
-
const
|
|
1812
|
+
const a = T(e, o), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: s, error: i, handleChange: d } = _({
|
|
1813
1813
|
value: c,
|
|
1814
1814
|
onChange: t,
|
|
1815
1815
|
onError: n,
|
|
1816
|
-
validate:
|
|
1816
|
+
validate: a
|
|
1817
1817
|
});
|
|
1818
|
-
return /* @__PURE__ */ p(
|
|
1818
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1819
1819
|
"input",
|
|
1820
1820
|
{
|
|
1821
1821
|
id: e.name,
|
|
@@ -1823,7 +1823,7 @@ const zt = l.memo(kr), Ir = ({
|
|
|
1823
1823
|
defaultValue: c,
|
|
1824
1824
|
ref: s,
|
|
1825
1825
|
onChange: d,
|
|
1826
|
-
className: U(
|
|
1826
|
+
className: U($.input, $.textInput),
|
|
1827
1827
|
style: { flex: 1 },
|
|
1828
1828
|
"aria-invalid": !!i,
|
|
1829
1829
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
@@ -1831,20 +1831,20 @@ const zt = l.memo(kr), Ir = ({
|
|
|
1831
1831
|
) });
|
|
1832
1832
|
};
|
|
1833
1833
|
Ir.displayName = "IntegerArrayInput";
|
|
1834
|
-
const
|
|
1834
|
+
const Ot = l.memo(Ir), Er = ({
|
|
1835
1835
|
field: e,
|
|
1836
1836
|
value: r,
|
|
1837
1837
|
onChange: t,
|
|
1838
1838
|
onError: n,
|
|
1839
|
-
error:
|
|
1839
|
+
error: o
|
|
1840
1840
|
}) => {
|
|
1841
|
-
const
|
|
1841
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1842
1842
|
value: r,
|
|
1843
1843
|
onChange: t,
|
|
1844
1844
|
onError: n,
|
|
1845
|
-
validate:
|
|
1845
|
+
validate: a
|
|
1846
1846
|
});
|
|
1847
|
-
return /* @__PURE__ */ p(
|
|
1847
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1848
1848
|
"input",
|
|
1849
1849
|
{
|
|
1850
1850
|
id: e.name,
|
|
@@ -1852,27 +1852,27 @@ const Pt = l.memo(Ir), Er = ({
|
|
|
1852
1852
|
defaultValue: String(r ?? ""),
|
|
1853
1853
|
ref: c,
|
|
1854
1854
|
onChange: i,
|
|
1855
|
-
className: U(
|
|
1855
|
+
className: U($.input, $.inputNumber),
|
|
1856
1856
|
"aria-invalid": !!s,
|
|
1857
1857
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
1858
1858
|
}
|
|
1859
1859
|
) });
|
|
1860
1860
|
};
|
|
1861
1861
|
Er.displayName = "IntegerInput";
|
|
1862
|
-
const Lt = l.memo(Er),
|
|
1862
|
+
const Lt = l.memo(Er), Fr = ({
|
|
1863
1863
|
field: e,
|
|
1864
1864
|
value: r,
|
|
1865
1865
|
onChange: t,
|
|
1866
1866
|
onError: n,
|
|
1867
|
-
error:
|
|
1867
|
+
error: o
|
|
1868
1868
|
}) => {
|
|
1869
|
-
const
|
|
1869
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
1870
1870
|
value: r,
|
|
1871
1871
|
onChange: t,
|
|
1872
1872
|
onError: n,
|
|
1873
|
-
validate:
|
|
1873
|
+
validate: a
|
|
1874
1874
|
});
|
|
1875
|
-
return /* @__PURE__ */ p(
|
|
1875
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1876
1876
|
"textarea",
|
|
1877
1877
|
{
|
|
1878
1878
|
id: e.name,
|
|
@@ -1885,25 +1885,25 @@ const Lt = l.memo(Er), Mr = ({
|
|
|
1885
1885
|
width: "100%",
|
|
1886
1886
|
boxSizing: "border-box"
|
|
1887
1887
|
},
|
|
1888
|
-
className: U(
|
|
1888
|
+
className: U($.input, $.textInput),
|
|
1889
1889
|
"aria-invalid": !!s,
|
|
1890
1890
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
1891
1891
|
}
|
|
1892
1892
|
) });
|
|
1893
1893
|
};
|
|
1894
|
-
|
|
1895
|
-
const
|
|
1894
|
+
Fr.displayName = "MultilineTextInput";
|
|
1895
|
+
const Tt = l.memo(Fr), Mr = ({
|
|
1896
1896
|
field: e,
|
|
1897
1897
|
value: r,
|
|
1898
1898
|
onChange: t,
|
|
1899
1899
|
onError: n,
|
|
1900
|
-
error:
|
|
1900
|
+
error: o
|
|
1901
1901
|
}) => {
|
|
1902
|
-
const
|
|
1902
|
+
const a = l.useRef(
|
|
1903
1903
|
n
|
|
1904
1904
|
);
|
|
1905
1905
|
l.useEffect(() => {
|
|
1906
|
-
|
|
1906
|
+
a.current = n;
|
|
1907
1907
|
}, [n]);
|
|
1908
1908
|
const { t: c, theme: s, formStyle: i, fieldStyle: d } = B(), m = (x, k, S) => {
|
|
1909
1909
|
if (!k) return {};
|
|
@@ -1915,10 +1915,10 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1915
1915
|
), y = l.useMemo(() => {
|
|
1916
1916
|
const x = Array.isArray(r) ? r : [], k = new Set(h.map((S) => S.value));
|
|
1917
1917
|
return x.filter((S) => k.has(S));
|
|
1918
|
-
}, [r, h]), E = T(e,
|
|
1918
|
+
}, [r, h]), E = T(e, o), [M, F] = l.useState(null), V = l.useRef(null);
|
|
1919
1919
|
l.useEffect(() => {
|
|
1920
1920
|
const x = E(Array.isArray(r) ? r : []);
|
|
1921
|
-
x !==
|
|
1921
|
+
x !== V.current && (V.current = x, F(x), a.current?.(x ?? null));
|
|
1922
1922
|
}, [r, E]);
|
|
1923
1923
|
const R = () => {
|
|
1924
1924
|
if (!u.current) return;
|
|
@@ -1926,7 +1926,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1926
1926
|
N({ x: x.left, y: x.bottom }), b((k) => !k);
|
|
1927
1927
|
}, I = (x) => {
|
|
1928
1928
|
const k = y.includes(x) ? y.filter((A) => A !== x) : [...y, x], S = E(k);
|
|
1929
|
-
S !==
|
|
1929
|
+
S !== V.current && (V.current = S, F(S), a.current?.(S ?? null)), t?.(k);
|
|
1930
1930
|
}, v = l.useMemo(
|
|
1931
1931
|
() => ({
|
|
1932
1932
|
height: "var(--reactaform-input-height, 2.5rem)",
|
|
@@ -1969,8 +1969,8 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1969
1969
|
}),
|
|
1970
1970
|
[i, d]
|
|
1971
1971
|
);
|
|
1972
|
-
return /* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */ p(
|
|
1972
|
+
return /* @__PURE__ */ z("div", { children: [
|
|
1973
|
+
/* @__PURE__ */ p(L, { field: e, error: M, children: /* @__PURE__ */ p("div", { style: { width: "100%" }, children: /* @__PURE__ */ z(
|
|
1974
1974
|
"div",
|
|
1975
1975
|
{
|
|
1976
1976
|
ref: u,
|
|
@@ -1980,13 +1980,13 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
1980
1980
|
role: "button",
|
|
1981
1981
|
"aria-haspopup": "listbox",
|
|
1982
1982
|
"aria-expanded": f,
|
|
1983
|
-
"aria-invalid": !!
|
|
1984
|
-
"aria-describedby":
|
|
1983
|
+
"aria-invalid": !!M,
|
|
1984
|
+
"aria-describedby": M ? `${e.name}-error` : void 0,
|
|
1985
1985
|
onKeyDown: (x) => {
|
|
1986
1986
|
(x.key === "Enter" || x.key === " ") && (x.preventDefault(), R());
|
|
1987
1987
|
},
|
|
1988
1988
|
children: [
|
|
1989
|
-
/* @__PURE__ */
|
|
1989
|
+
/* @__PURE__ */ z(
|
|
1990
1990
|
"span",
|
|
1991
1991
|
{
|
|
1992
1992
|
style: { flex: 1, color: "var(--reactaform-text-muted, #888)" },
|
|
@@ -2015,7 +2015,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2015
2015
|
}
|
|
2016
2016
|
) }) }),
|
|
2017
2017
|
f && C && /* @__PURE__ */ p(
|
|
2018
|
-
|
|
2018
|
+
jt,
|
|
2019
2019
|
{
|
|
2020
2020
|
position: C,
|
|
2021
2021
|
options: h,
|
|
@@ -2027,19 +2027,19 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2027
2027
|
}
|
|
2028
2028
|
)
|
|
2029
2029
|
] });
|
|
2030
|
-
},
|
|
2030
|
+
}, jt = ({
|
|
2031
2031
|
position: e,
|
|
2032
2032
|
options: r,
|
|
2033
2033
|
selectedValues: t,
|
|
2034
2034
|
onToggleOption: n,
|
|
2035
|
-
onClose:
|
|
2036
|
-
controlRef:
|
|
2035
|
+
onClose: o,
|
|
2036
|
+
controlRef: a,
|
|
2037
2037
|
theme: c
|
|
2038
2038
|
}) => {
|
|
2039
2039
|
const s = l.useRef(null), [i, d] = l.useState(-1), { formStyle: m, fieldStyle: u } = B(), f = ie(c ?? "light");
|
|
2040
2040
|
l.useLayoutEffect(() => {
|
|
2041
|
-
if (!
|
|
2042
|
-
const I =
|
|
2041
|
+
if (!a.current) return;
|
|
2042
|
+
const I = a.current.closest("[data-reactaform-theme]"), v = document.getElementById("popup-root");
|
|
2043
2043
|
if (I && v) {
|
|
2044
2044
|
const g = getComputedStyle(I);
|
|
2045
2045
|
v.style.setProperty(
|
|
@@ -2053,7 +2053,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2053
2053
|
g.getPropertyValue("--reactaform-option-menu-hover-bg")
|
|
2054
2054
|
);
|
|
2055
2055
|
}
|
|
2056
|
-
}, [
|
|
2056
|
+
}, [a]);
|
|
2057
2057
|
const b = (I, v, g) => {
|
|
2058
2058
|
if (!v) return {};
|
|
2059
2059
|
const x = I?.[v];
|
|
@@ -2090,10 +2090,10 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2090
2090
|
l.useEffect(() => {
|
|
2091
2091
|
const I = (v) => {
|
|
2092
2092
|
const g = v.target;
|
|
2093
|
-
!s.current?.contains(g) && !
|
|
2093
|
+
!s.current?.contains(g) && !a.current?.contains(g) && o();
|
|
2094
2094
|
};
|
|
2095
2095
|
return document.addEventListener("mousedown", I), () => document.removeEventListener("mousedown", I);
|
|
2096
|
-
}, [
|
|
2096
|
+
}, [o, a]), l.useEffect(() => {
|
|
2097
2097
|
s.current && r.length > 0 && requestAnimationFrame(
|
|
2098
2098
|
() => d((I) => I === -1 ? 0 : I)
|
|
2099
2099
|
);
|
|
@@ -2104,25 +2104,25 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2104
2104
|
);
|
|
2105
2105
|
I && requestAnimationFrame(() => I.focus());
|
|
2106
2106
|
}, [i]);
|
|
2107
|
-
const h = 250, y = 200, [E,
|
|
2107
|
+
const h = 250, y = 200, [E, M] = l.useState(null), [F, V] = l.useState(null);
|
|
2108
2108
|
if (l.useEffect(() => {
|
|
2109
2109
|
if (typeof window > "u") return;
|
|
2110
2110
|
const I = () => {
|
|
2111
2111
|
let w = e.x, x = e.y, k = h;
|
|
2112
|
-
const S =
|
|
2112
|
+
const S = a?.current;
|
|
2113
2113
|
if (S) {
|
|
2114
2114
|
const A = S.getBoundingClientRect();
|
|
2115
2115
|
w = A.left, x = A.bottom, k = Math.max(80, Math.round(A.width));
|
|
2116
2116
|
}
|
|
2117
|
-
w = Math.min(w, window.innerWidth - k), x = Math.min(x, window.innerHeight - y),
|
|
2117
|
+
w = Math.min(w, window.innerWidth - k), x = Math.min(x, window.innerHeight - y), M({ left: w, top: x }), V(k);
|
|
2118
2118
|
};
|
|
2119
2119
|
I(), window.addEventListener("scroll", I, !0), window.addEventListener("resize", I);
|
|
2120
2120
|
let v = null;
|
|
2121
|
-
const g =
|
|
2121
|
+
const g = a?.current;
|
|
2122
2122
|
return typeof ResizeObserver < "u" && g && (v = new ResizeObserver(() => I()), v.observe(g)), () => {
|
|
2123
2123
|
window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), v && g && v.unobserve(g);
|
|
2124
2124
|
};
|
|
2125
|
-
}, [
|
|
2125
|
+
}, [a, e.x, e.y]), typeof window > "u") return null;
|
|
2126
2126
|
let R = document.getElementById("popup-root");
|
|
2127
2127
|
return R || (R = document.createElement("div"), R.id = "popup-root", document.body.appendChild(R)), de.createPortal(
|
|
2128
2128
|
/* @__PURE__ */ p(
|
|
@@ -2135,7 +2135,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2135
2135
|
position: "fixed",
|
|
2136
2136
|
top: E ? E.top : e.y,
|
|
2137
2137
|
left: E ? E.left : e.x,
|
|
2138
|
-
width:
|
|
2138
|
+
width: F ?? h,
|
|
2139
2139
|
// spread the static popup styles
|
|
2140
2140
|
...C
|
|
2141
2141
|
},
|
|
@@ -2145,7 +2145,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2145
2145
|
...N,
|
|
2146
2146
|
background: v === i ? w : N.background
|
|
2147
2147
|
};
|
|
2148
|
-
return /* @__PURE__ */
|
|
2148
|
+
return /* @__PURE__ */ z(
|
|
2149
2149
|
"div",
|
|
2150
2150
|
{
|
|
2151
2151
|
id: `multi-opt-${v}`,
|
|
@@ -2172,7 +2172,7 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2172
2172
|
k.preventDefault(), k.stopPropagation(), n(I.value);
|
|
2173
2173
|
break;
|
|
2174
2174
|
case "Escape":
|
|
2175
|
-
k.preventDefault(),
|
|
2175
|
+
k.preventDefault(), o(), a?.current?.focus();
|
|
2176
2176
|
break;
|
|
2177
2177
|
}
|
|
2178
2178
|
},
|
|
@@ -2214,21 +2214,21 @@ const Ot = l.memo(Mr), Fr = ({
|
|
|
2214
2214
|
R
|
|
2215
2215
|
);
|
|
2216
2216
|
};
|
|
2217
|
-
|
|
2218
|
-
const
|
|
2217
|
+
Mr.displayName = "MultiSelect";
|
|
2218
|
+
const Bt = l.memo(Mr), Vr = ({
|
|
2219
2219
|
field: e,
|
|
2220
2220
|
value: r,
|
|
2221
2221
|
onChange: t,
|
|
2222
2222
|
onError: n,
|
|
2223
|
-
error:
|
|
2223
|
+
error: o
|
|
2224
2224
|
}) => {
|
|
2225
|
-
const
|
|
2225
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2226
2226
|
value: String(r ?? ""),
|
|
2227
2227
|
onChange: t,
|
|
2228
2228
|
onError: n,
|
|
2229
|
-
validate:
|
|
2229
|
+
validate: a
|
|
2230
2230
|
}), d = Math.max(1, Math.round(e.step ?? 1));
|
|
2231
|
-
return /* @__PURE__ */ p(
|
|
2231
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2232
2232
|
"input",
|
|
2233
2233
|
{
|
|
2234
2234
|
id: e.name,
|
|
@@ -2243,27 +2243,27 @@ const jt = l.memo(Fr), $r = ({
|
|
|
2243
2243
|
width: "100%",
|
|
2244
2244
|
height: "100%"
|
|
2245
2245
|
},
|
|
2246
|
-
className:
|
|
2246
|
+
className: $.input,
|
|
2247
2247
|
"aria-invalid": !!s,
|
|
2248
2248
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
2249
2249
|
}
|
|
2250
2250
|
) });
|
|
2251
2251
|
};
|
|
2252
|
-
|
|
2253
|
-
const
|
|
2252
|
+
Vr.displayName = "NumericStepperInput";
|
|
2253
|
+
const Ht = l.memo(Vr), $r = ({
|
|
2254
2254
|
field: e,
|
|
2255
2255
|
value: r,
|
|
2256
2256
|
onChange: t,
|
|
2257
2257
|
onError: n,
|
|
2258
|
-
error:
|
|
2258
|
+
error: o
|
|
2259
2259
|
}) => {
|
|
2260
|
-
const
|
|
2260
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2261
2261
|
value: r,
|
|
2262
2262
|
onChange: t,
|
|
2263
2263
|
onError: n,
|
|
2264
|
-
validate:
|
|
2264
|
+
validate: a
|
|
2265
2265
|
});
|
|
2266
|
-
return /* @__PURE__ */ p(
|
|
2266
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2267
2267
|
"input",
|
|
2268
2268
|
{
|
|
2269
2269
|
id: e.name,
|
|
@@ -2271,21 +2271,21 @@ const Bt = l.memo($r), Vr = ({
|
|
|
2271
2271
|
defaultValue: String(r ?? ""),
|
|
2272
2272
|
ref: c,
|
|
2273
2273
|
onChange: i,
|
|
2274
|
-
className: U(
|
|
2274
|
+
className: U($.input, $.textInput),
|
|
2275
2275
|
"aria-invalid": !!s,
|
|
2276
2276
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
2277
2277
|
}
|
|
2278
2278
|
) });
|
|
2279
2279
|
};
|
|
2280
|
-
|
|
2281
|
-
const
|
|
2280
|
+
$r.displayName = "PhoneInput";
|
|
2281
|
+
const qt = l.memo($r), Ar = ({
|
|
2282
2282
|
field: e,
|
|
2283
2283
|
value: r,
|
|
2284
2284
|
onChange: t,
|
|
2285
2285
|
onError: n,
|
|
2286
|
-
error:
|
|
2286
|
+
error: o
|
|
2287
2287
|
}) => {
|
|
2288
|
-
const { t:
|
|
2288
|
+
const { t: a } = B(), c = T(e, o), s = e.layout?.toLowerCase() === "horizontal" ? "row" : "column", i = l.useRef(n);
|
|
2289
2289
|
l.useEffect(() => {
|
|
2290
2290
|
i.current = n;
|
|
2291
2291
|
}, [n]);
|
|
@@ -2325,21 +2325,21 @@ const Ht = l.memo(Vr), Ar = ({
|
|
|
2325
2325
|
width: s === "column" ? "100%" : void 0,
|
|
2326
2326
|
justifyContent: "flex-start"
|
|
2327
2327
|
};
|
|
2328
|
-
return /* @__PURE__ */ p(
|
|
2328
|
+
return /* @__PURE__ */ p(L, { field: e, error: d, children: /* @__PURE__ */ p(
|
|
2329
2329
|
"div",
|
|
2330
2330
|
{
|
|
2331
|
-
className:
|
|
2331
|
+
className: $.input,
|
|
2332
2332
|
"aria-labelledby": `${e.name}-label`,
|
|
2333
2333
|
"aria-invalid": !!d,
|
|
2334
2334
|
style: C,
|
|
2335
2335
|
children: e.options.map((h) => {
|
|
2336
2336
|
const y = String(h.value), E = `${e.name}-${y}`;
|
|
2337
|
-
return /* @__PURE__ */
|
|
2337
|
+
return /* @__PURE__ */ z(
|
|
2338
2338
|
"label",
|
|
2339
2339
|
{
|
|
2340
|
-
className: U(
|
|
2340
|
+
className: U($.label),
|
|
2341
2341
|
style: N,
|
|
2342
|
-
onMouseDown: (
|
|
2342
|
+
onMouseDown: (M) => M.preventDefault(),
|
|
2343
2343
|
onClick: () => {
|
|
2344
2344
|
String(r ?? "") !== y && b({ target: { value: y } });
|
|
2345
2345
|
},
|
|
@@ -2365,7 +2365,7 @@ const Ht = l.memo(Vr), Ar = ({
|
|
|
2365
2365
|
flex: s === "column" ? 1 : void 0,
|
|
2366
2366
|
fontWeight: 400
|
|
2367
2367
|
},
|
|
2368
|
-
children:
|
|
2368
|
+
children: a(h.label)
|
|
2369
2369
|
}
|
|
2370
2370
|
)
|
|
2371
2371
|
]
|
|
@@ -2377,10 +2377,10 @@ const Ht = l.memo(Vr), Ar = ({
|
|
|
2377
2377
|
) });
|
|
2378
2378
|
};
|
|
2379
2379
|
Ar.displayName = "RadioInput";
|
|
2380
|
-
const
|
|
2380
|
+
const Ut = l.memo(Ar), Wt = {
|
|
2381
2381
|
display: "flex",
|
|
2382
2382
|
gap: 4
|
|
2383
|
-
},
|
|
2383
|
+
}, _t = {
|
|
2384
2384
|
cursor: "pointer",
|
|
2385
2385
|
fontSize: "1.5rem",
|
|
2386
2386
|
lineHeight: 1,
|
|
@@ -2388,8 +2388,8 @@ const qt = l.memo(Ar), Ut = {
|
|
|
2388
2388
|
marginRight: "0.25rem",
|
|
2389
2389
|
userSelect: "none",
|
|
2390
2390
|
transition: "color 0.12s ease"
|
|
2391
|
-
}, Rr = ({ field: e, value: r, onChange: t, onError: n, error:
|
|
2392
|
-
const { t:
|
|
2391
|
+
}, Rr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
|
|
2392
|
+
const { t: a } = B(), c = T(e, o), s = e.max ?? 5, i = e.icon?.trim() || "★", [d, m] = l.useState(null), u = l.useRef([]), f = l.useMemo(() => Math.min(Math.max(r ?? 0, 0), s), [r, s]), b = l.useMemo(() => c(f) ?? null, [c, f]);
|
|
2393
2393
|
l.useEffect(() => {
|
|
2394
2394
|
n?.(b);
|
|
2395
2395
|
}, [b, n]);
|
|
@@ -2418,30 +2418,30 @@ const qt = l.memo(Ar), Ut = {
|
|
|
2418
2418
|
},
|
|
2419
2419
|
[s, C]
|
|
2420
2420
|
);
|
|
2421
|
-
return /* @__PURE__ */ p(
|
|
2421
|
+
return /* @__PURE__ */ p(L, { field: e, error: b, children: /* @__PURE__ */ p(
|
|
2422
2422
|
"div",
|
|
2423
2423
|
{
|
|
2424
2424
|
role: "radiogroup",
|
|
2425
2425
|
"aria-labelledby": `${e.name}-label`,
|
|
2426
2426
|
"aria-invalid": !!b,
|
|
2427
2427
|
"aria-describedby": b ? `${e.name}-error` : void 0,
|
|
2428
|
-
style:
|
|
2428
|
+
style: Wt,
|
|
2429
2429
|
children: Array.from({ length: s }, (h, y) => {
|
|
2430
|
-
const E = y < f,
|
|
2430
|
+
const E = y < f, F = d !== null && y <= d || E ? "gold" : "lightgray";
|
|
2431
2431
|
return /* @__PURE__ */ p(
|
|
2432
2432
|
"span",
|
|
2433
2433
|
{
|
|
2434
|
-
ref: (
|
|
2434
|
+
ref: (V) => u.current[y] = V,
|
|
2435
2435
|
role: "radio",
|
|
2436
2436
|
tabIndex: f > 0 ? y === f - 1 ? 0 : -1 : y === 0 ? 0 : -1,
|
|
2437
2437
|
"aria-checked": E,
|
|
2438
2438
|
"aria-label": `Rating ${y + 1}`,
|
|
2439
|
-
title:
|
|
2439
|
+
title: a(`${e.displayName} ${y + 1}`),
|
|
2440
2440
|
onClick: () => C(y + 1),
|
|
2441
|
-
onKeyDown: (
|
|
2441
|
+
onKeyDown: (V) => N(V, y),
|
|
2442
2442
|
onMouseEnter: () => m(y),
|
|
2443
2443
|
onMouseLeave: () => m(null),
|
|
2444
|
-
style: { ...
|
|
2444
|
+
style: { ..._t, color: F },
|
|
2445
2445
|
children: i
|
|
2446
2446
|
},
|
|
2447
2447
|
y
|
|
@@ -2451,20 +2451,20 @@ const qt = l.memo(Ar), Ut = {
|
|
|
2451
2451
|
) });
|
|
2452
2452
|
};
|
|
2453
2453
|
Rr.displayName = "RatingInput";
|
|
2454
|
-
const
|
|
2454
|
+
const Kt = l.memo(Rr), Dr = ({
|
|
2455
2455
|
field: e,
|
|
2456
2456
|
value: r,
|
|
2457
2457
|
onChange: t,
|
|
2458
2458
|
onError: n,
|
|
2459
|
-
error:
|
|
2459
|
+
error: o
|
|
2460
2460
|
}) => {
|
|
2461
|
-
const { t:
|
|
2461
|
+
const { t: a } = B(), c = T(e, o), { inputRef: s, error: i, handleChange: d } = _({
|
|
2462
2462
|
value: r,
|
|
2463
2463
|
onChange: t,
|
|
2464
2464
|
onError: n,
|
|
2465
2465
|
validate: c
|
|
2466
2466
|
}), [m, u] = l.useState(!1), f = () => u((b) => !b);
|
|
2467
|
-
return /* @__PURE__ */ p(
|
|
2467
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: 8, width: "100%" }, children: [
|
|
2468
2468
|
/* @__PURE__ */ p(
|
|
2469
2469
|
"input",
|
|
2470
2470
|
{
|
|
@@ -2473,7 +2473,7 @@ const _t = l.memo(Rr), Dr = ({
|
|
|
2473
2473
|
defaultValue: String(r ?? ""),
|
|
2474
2474
|
ref: s,
|
|
2475
2475
|
onChange: d,
|
|
2476
|
-
className: U(
|
|
2476
|
+
className: U($.input, $.textInput),
|
|
2477
2477
|
style: { flex: 1, minWidth: 0 },
|
|
2478
2478
|
"aria-invalid": !!i,
|
|
2479
2479
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
@@ -2484,7 +2484,7 @@ const _t = l.memo(Rr), Dr = ({
|
|
|
2484
2484
|
{
|
|
2485
2485
|
type: "button",
|
|
2486
2486
|
onClick: f,
|
|
2487
|
-
"aria-label":
|
|
2487
|
+
"aria-label": a(m ? "Hide password" : "Show password"),
|
|
2488
2488
|
style: {
|
|
2489
2489
|
background: "transparent",
|
|
2490
2490
|
border: "none",
|
|
@@ -2500,15 +2500,15 @@ const _t = l.memo(Rr), Dr = ({
|
|
|
2500
2500
|
] }) });
|
|
2501
2501
|
};
|
|
2502
2502
|
Dr.displayName = "PasswordInput";
|
|
2503
|
-
const
|
|
2504
|
-
const
|
|
2503
|
+
const Gt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, error: o }) => {
|
|
2504
|
+
const a = T(e, o), c = e.min ?? 0, s = e.max ?? 100, [i, d] = l.useState(
|
|
2505
2505
|
() => isNaN(Number(r)) ? String(c) : String(Number(r))
|
|
2506
2506
|
);
|
|
2507
2507
|
l.useEffect(() => {
|
|
2508
2508
|
const b = isNaN(Number(r)) ? String(c) : String(Number(r));
|
|
2509
2509
|
d(b);
|
|
2510
2510
|
}, [r, c]);
|
|
2511
|
-
const m = l.useMemo(() =>
|
|
2511
|
+
const m = l.useMemo(() => a(i) ?? null, [a, i]);
|
|
2512
2512
|
l.useEffect(() => {
|
|
2513
2513
|
n?.(m);
|
|
2514
2514
|
}, [m, n]);
|
|
@@ -2519,7 +2519,7 @@ const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
2519
2519
|
},
|
|
2520
2520
|
[t]
|
|
2521
2521
|
), f = isNaN(Number(i)) ? String(c) : String(Number(i));
|
|
2522
|
-
return /* @__PURE__ */ p(
|
|
2522
|
+
return /* @__PURE__ */ p(L, { field: e, error: m, children: /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
|
|
2523
2523
|
/* @__PURE__ */ p(
|
|
2524
2524
|
"input",
|
|
2525
2525
|
{
|
|
@@ -2534,7 +2534,7 @@ const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
2534
2534
|
padding: 0,
|
|
2535
2535
|
flex: 1
|
|
2536
2536
|
},
|
|
2537
|
-
className:
|
|
2537
|
+
className: $.rangeInput,
|
|
2538
2538
|
"aria-invalid": !!m,
|
|
2539
2539
|
"aria-describedby": m ? `${e.name}-error` : void 0
|
|
2540
2540
|
}
|
|
@@ -2554,7 +2554,7 @@ const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
2554
2554
|
textAlign: "center",
|
|
2555
2555
|
flexShrink: 0
|
|
2556
2556
|
},
|
|
2557
|
-
className: U(
|
|
2557
|
+
className: U($.input, $.textInput),
|
|
2558
2558
|
"aria-invalid": !!m,
|
|
2559
2559
|
"aria-describedby": m ? `${e.name}-error` : void 0
|
|
2560
2560
|
}
|
|
@@ -2562,21 +2562,21 @@ const Kt = l.memo(Dr), zr = ({ field: e, value: r, onChange: t, onError: n, erro
|
|
|
2562
2562
|
] }) });
|
|
2563
2563
|
};
|
|
2564
2564
|
zr.displayName = "SliderInput";
|
|
2565
|
-
const
|
|
2565
|
+
const Jt = l.memo(zr), Pr = ({
|
|
2566
2566
|
field: e,
|
|
2567
2567
|
value: r,
|
|
2568
2568
|
onChange: t,
|
|
2569
2569
|
onError: n,
|
|
2570
|
-
error:
|
|
2570
|
+
error: o
|
|
2571
2571
|
}) => {
|
|
2572
|
-
const { t:
|
|
2572
|
+
const { t: a, formStyle: c, fieldStyle: s } = B(), d = T(e, o)(r);
|
|
2573
2573
|
l.useEffect(() => {
|
|
2574
2574
|
n?.(d);
|
|
2575
2575
|
}, [d, n]);
|
|
2576
|
-
const m = c, u = s, f = (
|
|
2577
|
-
if (!
|
|
2578
|
-
const R =
|
|
2579
|
-
return (
|
|
2576
|
+
const m = c, u = s, f = (M, F, V) => {
|
|
2577
|
+
if (!F) return {};
|
|
2578
|
+
const R = M?.[F];
|
|
2579
|
+
return (V && R ? R[V] : void 0) ?? {};
|
|
2580
2580
|
}, b = l.useMemo(() => ({
|
|
2581
2581
|
display: "inline-block",
|
|
2582
2582
|
position: "relative",
|
|
@@ -2631,17 +2631,17 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2631
2631
|
}), [m, u]), y = !!r, E = () => {
|
|
2632
2632
|
t?.(!y);
|
|
2633
2633
|
};
|
|
2634
|
-
return /* @__PURE__ */ p(
|
|
2634
|
+
return /* @__PURE__ */ p(L, { field: e, error: null, rightAlign: !1, children: /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
|
|
2635
2635
|
/* @__PURE__ */ p(
|
|
2636
2636
|
"label",
|
|
2637
2637
|
{
|
|
2638
|
-
className:
|
|
2638
|
+
className: $.label,
|
|
2639
2639
|
htmlFor: e.name,
|
|
2640
2640
|
style: { textAlign: "left", justifyContent: "flex-start" },
|
|
2641
|
-
children:
|
|
2641
|
+
children: a(e.displayName)
|
|
2642
2642
|
}
|
|
2643
2643
|
),
|
|
2644
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ z("label", { style: b, children: [
|
|
2645
2645
|
/* @__PURE__ */ p(
|
|
2646
2646
|
"input",
|
|
2647
2647
|
{
|
|
@@ -2649,7 +2649,7 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2649
2649
|
type: "checkbox",
|
|
2650
2650
|
checked: y,
|
|
2651
2651
|
readOnly: !0,
|
|
2652
|
-
"aria-label":
|
|
2652
|
+
"aria-label": a(e.displayName),
|
|
2653
2653
|
"aria-invalid": !1,
|
|
2654
2654
|
"aria-describedby": void 0,
|
|
2655
2655
|
style: C,
|
|
@@ -2666,8 +2666,8 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2666
2666
|
"aria-invalid": !1,
|
|
2667
2667
|
"aria-describedby": void 0,
|
|
2668
2668
|
onClick: E,
|
|
2669
|
-
onKeyDown: (
|
|
2670
|
-
(
|
|
2669
|
+
onKeyDown: (M) => {
|
|
2670
|
+
(M.key === " " || M.key === "Spacebar" || M.key === "Space" || M.key === "Enter") && (M.preventDefault(), E());
|
|
2671
2671
|
},
|
|
2672
2672
|
className: `reactaform-switch ${y ? "active checked on" : ""} `,
|
|
2673
2673
|
style: y ? { ...N, backgroundColor: "var(--reactaform-switch-on-bg, #22c55e)", borderColor: "var(--reactaform-switch-on-border, #16a34a)" } : N,
|
|
@@ -2686,20 +2686,20 @@ const Gt = l.memo(zr), Pr = ({
|
|
|
2686
2686
|
] }) });
|
|
2687
2687
|
};
|
|
2688
2688
|
Pr.displayName = "SwitchInput";
|
|
2689
|
-
const
|
|
2689
|
+
const Yt = l.memo(Pr), xe = ({
|
|
2690
2690
|
field: e,
|
|
2691
2691
|
value: r,
|
|
2692
2692
|
onChange: t,
|
|
2693
2693
|
onError: n,
|
|
2694
|
-
error:
|
|
2694
|
+
error: o
|
|
2695
2695
|
}) => {
|
|
2696
|
-
const
|
|
2696
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2697
2697
|
value: r,
|
|
2698
2698
|
onChange: t,
|
|
2699
2699
|
onError: n,
|
|
2700
|
-
validate:
|
|
2700
|
+
validate: a
|
|
2701
2701
|
});
|
|
2702
|
-
return /* @__PURE__ */ p(
|
|
2702
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2703
2703
|
"input",
|
|
2704
2704
|
{
|
|
2705
2705
|
id: e.name,
|
|
@@ -2707,7 +2707,7 @@ const Jt = l.memo(Pr), xe = ({
|
|
|
2707
2707
|
defaultValue: String(r ?? ""),
|
|
2708
2708
|
ref: c,
|
|
2709
2709
|
onChange: i,
|
|
2710
|
-
className: U(
|
|
2710
|
+
className: U($.input, $.textInput),
|
|
2711
2711
|
placeholder: e.placeholder,
|
|
2712
2712
|
"aria-invalid": !!s,
|
|
2713
2713
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
@@ -2715,20 +2715,20 @@ const Jt = l.memo(Pr), xe = ({
|
|
|
2715
2715
|
) });
|
|
2716
2716
|
};
|
|
2717
2717
|
xe.displayName = "TextInput";
|
|
2718
|
-
const
|
|
2718
|
+
const Or = ({
|
|
2719
2719
|
field: e,
|
|
2720
2720
|
value: r,
|
|
2721
2721
|
onChange: t,
|
|
2722
2722
|
onError: n,
|
|
2723
|
-
error:
|
|
2723
|
+
error: o
|
|
2724
2724
|
}) => {
|
|
2725
|
-
const
|
|
2725
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
2726
2726
|
value: r,
|
|
2727
2727
|
onChange: t,
|
|
2728
2728
|
onError: n,
|
|
2729
|
-
validate:
|
|
2729
|
+
validate: a
|
|
2730
2730
|
});
|
|
2731
|
-
return /* @__PURE__ */ p(
|
|
2731
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
2732
2732
|
"input",
|
|
2733
2733
|
{
|
|
2734
2734
|
id: e.name,
|
|
@@ -2739,41 +2739,41 @@ const Lr = ({
|
|
|
2739
2739
|
onChange: i,
|
|
2740
2740
|
min: typeof e.min == "string" ? e.min : void 0,
|
|
2741
2741
|
max: typeof e.max == "string" ? e.max : void 0,
|
|
2742
|
-
className: U(
|
|
2742
|
+
className: U($.input, $.textInput),
|
|
2743
2743
|
"aria-invalid": !!s,
|
|
2744
2744
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
2745
2745
|
}
|
|
2746
2746
|
) });
|
|
2747
2747
|
};
|
|
2748
|
-
|
|
2749
|
-
const
|
|
2750
|
-
function
|
|
2748
|
+
Or.displayName = "TimeInput";
|
|
2749
|
+
const Xt = l.memo(Or);
|
|
2750
|
+
function Zt({
|
|
2751
2751
|
pos: e,
|
|
2752
2752
|
options: r,
|
|
2753
2753
|
onClose: t,
|
|
2754
2754
|
onClickOption: n
|
|
2755
2755
|
}) {
|
|
2756
|
-
const
|
|
2756
|
+
const o = l.useRef(null), a = l.useRef(!1), [c, s] = l.useState({
|
|
2757
2757
|
top: e?.y ?? 0,
|
|
2758
2758
|
left: e?.x ?? 0,
|
|
2759
2759
|
ready: !1
|
|
2760
2760
|
}), i = typeof window < "u" ? document.getElementById("popup-root") || document.body : null;
|
|
2761
2761
|
return l.useEffect(() => {
|
|
2762
2762
|
function d(m) {
|
|
2763
|
-
|
|
2763
|
+
a.current || m.target.dataset?.popupMenu === "item" || o.current && m.target instanceof Node && !o.current.contains(m.target) && t();
|
|
2764
2764
|
}
|
|
2765
2765
|
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
2766
2766
|
}, [t]), l.useLayoutEffect(() => {
|
|
2767
|
-
if (!
|
|
2767
|
+
if (!o.current || !e || e.x == null || e.y == null)
|
|
2768
2768
|
return;
|
|
2769
|
-
const d =
|
|
2769
|
+
const d = o.current.getBoundingClientRect(), m = window.innerWidth, u = window.innerHeight;
|
|
2770
2770
|
let f = e.x, b = e.y;
|
|
2771
2771
|
f + d.width > m && (f = Math.max(0, m - d.width - 10)), b + d.height > u && (b = Math.max(0, e.y - d.height - 5)), s({ top: b, left: f, ready: !0 });
|
|
2772
2772
|
}, [e, r]), !i || r === void 0 || r.length === 0 || !e || e.x == null || e.y == null ? null : de.createPortal(
|
|
2773
2773
|
/* @__PURE__ */ p(
|
|
2774
2774
|
"div",
|
|
2775
2775
|
{
|
|
2776
|
-
ref:
|
|
2776
|
+
ref: o,
|
|
2777
2777
|
onMouseDown: (d) => {
|
|
2778
2778
|
d.stopPropagation();
|
|
2779
2779
|
},
|
|
@@ -2797,11 +2797,11 @@ function Xt({
|
|
|
2797
2797
|
{
|
|
2798
2798
|
"data-popup-menu": "item",
|
|
2799
2799
|
onMouseDown: (u) => {
|
|
2800
|
-
u.stopPropagation(),
|
|
2800
|
+
u.stopPropagation(), a.current = !0;
|
|
2801
2801
|
},
|
|
2802
2802
|
onClick: (u) => {
|
|
2803
2803
|
u.stopPropagation(), u.preventDefault(), n(d), t(), setTimeout(() => {
|
|
2804
|
-
|
|
2804
|
+
a.current = !1;
|
|
2805
2805
|
}, 100);
|
|
2806
2806
|
},
|
|
2807
2807
|
style: {
|
|
@@ -2826,7 +2826,7 @@ function Xt({
|
|
|
2826
2826
|
i
|
|
2827
2827
|
);
|
|
2828
2828
|
}
|
|
2829
|
-
const
|
|
2829
|
+
const Ve = {
|
|
2830
2830
|
length: ["m", "cm", "mm", "km", "in", "ft", "yd", "mi"],
|
|
2831
2831
|
area: ["m^2", "cm^2", "mm^2", "in^2", "ft^2", "yd^2"],
|
|
2832
2832
|
volume: ["L", "m^3", "cm^3", "mL", "in^3", "ft^3", "yd^3"],
|
|
@@ -2834,7 +2834,7 @@ const $e = {
|
|
|
2834
2834
|
time: ["min", "s", "h", "ms", "d"],
|
|
2835
2835
|
temperature: ["C", "F", "K"],
|
|
2836
2836
|
angle: ["deg", "rad", "rev"]
|
|
2837
|
-
},
|
|
2837
|
+
}, $e = {
|
|
2838
2838
|
length: {
|
|
2839
2839
|
m: "Meter (m)",
|
|
2840
2840
|
mm: "Millimeter (mm)",
|
|
@@ -2943,31 +2943,31 @@ const $e = {
|
|
|
2943
2943
|
rad: Math.PI / 180,
|
|
2944
2944
|
rev: 1 / 360
|
|
2945
2945
|
}
|
|
2946
|
-
}, Re = {},
|
|
2947
|
-
...Object.keys($e),
|
|
2946
|
+
}, Re = {}, Qt = /* @__PURE__ */ new Set([
|
|
2948
2947
|
...Object.keys(Ve),
|
|
2948
|
+
...Object.keys($e),
|
|
2949
2949
|
...Object.keys(Ae)
|
|
2950
2950
|
]);
|
|
2951
|
-
for (const e of
|
|
2952
|
-
const r = {}, t =
|
|
2953
|
-
for (const
|
|
2954
|
-
const c = n[
|
|
2955
|
-
r[
|
|
2956
|
-
name: typeof c == "string" ? c : String(
|
|
2957
|
-
shortName:
|
|
2958
|
-
factor:
|
|
2951
|
+
for (const e of Qt) {
|
|
2952
|
+
const r = {}, t = Ve[e] ?? [], n = $e[e] ?? {}, o = Ae[e] ?? {};
|
|
2953
|
+
for (const a of t) {
|
|
2954
|
+
const c = n[a];
|
|
2955
|
+
r[a] = {
|
|
2956
|
+
name: typeof c == "string" ? c : String(a),
|
|
2957
|
+
shortName: a,
|
|
2958
|
+
factor: a in o ? o[a] : void 0
|
|
2959
2959
|
};
|
|
2960
2960
|
}
|
|
2961
|
-
for (const [
|
|
2962
|
-
if (!r[
|
|
2963
|
-
const s = typeof c == "string" ? c : String(
|
|
2964
|
-
r[
|
|
2961
|
+
for (const [a, c] of Object.entries(n))
|
|
2962
|
+
if (!r[a]) {
|
|
2963
|
+
const s = typeof c == "string" ? c : String(a);
|
|
2964
|
+
r[a] = { name: s, shortName: a, factor: a in o ? o[a] : void 0 };
|
|
2965
2965
|
}
|
|
2966
|
-
for (const [
|
|
2967
|
-
r[
|
|
2966
|
+
for (const [a, c] of Object.entries(o))
|
|
2967
|
+
r[a] || (r[a] = { name: String(a), shortName: String(a), factor: c });
|
|
2968
2968
|
Re[e] = r;
|
|
2969
2969
|
}
|
|
2970
|
-
function
|
|
2970
|
+
function Lr(e, r, t) {
|
|
2971
2971
|
if (e === "C") {
|
|
2972
2972
|
if (r === "F") return t * (9 / 5) + 32;
|
|
2973
2973
|
if (r === "K") return t + 273.15;
|
|
@@ -2984,19 +2984,19 @@ function Tr(e) {
|
|
|
2984
2984
|
const r = Re[e];
|
|
2985
2985
|
if (!r) return null;
|
|
2986
2986
|
const t = {}, n = [];
|
|
2987
|
-
for (const [
|
|
2988
|
-
typeof c.factor == "number" && (t[
|
|
2987
|
+
for (const [a, c] of Object.entries(r))
|
|
2988
|
+
typeof c.factor == "number" && (t[a] = c.factor), n.push(a);
|
|
2989
2989
|
return {
|
|
2990
2990
|
default: Object.keys(r)[0] ?? "",
|
|
2991
2991
|
units: n,
|
|
2992
2992
|
factors: t
|
|
2993
2993
|
};
|
|
2994
2994
|
}
|
|
2995
|
-
const
|
|
2995
|
+
const fo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2996
2996
|
__proto__: null,
|
|
2997
|
-
convertTemperature:
|
|
2998
|
-
dimensionUnitDisplayMap:
|
|
2999
|
-
dimensionUnitsMap:
|
|
2997
|
+
convertTemperature: Lr,
|
|
2998
|
+
dimensionUnitDisplayMap: $e,
|
|
2999
|
+
dimensionUnitsMap: Ve,
|
|
3000
3000
|
dimensonUnitFactorsMap: Ae,
|
|
3001
3001
|
getUnitFactors: Tr,
|
|
3002
3002
|
unitsByDimension: Re
|
|
@@ -3005,8 +3005,8 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3005
3005
|
inputValue: r,
|
|
3006
3006
|
selectedUnit: t,
|
|
3007
3007
|
dimension: n,
|
|
3008
|
-
unitFactors:
|
|
3009
|
-
onConversionSelect:
|
|
3008
|
+
unitFactors: o,
|
|
3009
|
+
onConversionSelect: a,
|
|
3010
3010
|
t: c
|
|
3011
3011
|
}) => {
|
|
3012
3012
|
const [s, i] = l.useState(!1), [d, m] = l.useState(null), [u, f] = l.useState([]), b = l.useCallback(
|
|
@@ -3016,39 +3016,39 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3016
3016
|
if (!Number.isFinite(y)) return;
|
|
3017
3017
|
const E = h.currentTarget.getBoundingClientRect();
|
|
3018
3018
|
m({ x: E.left, y: E.bottom });
|
|
3019
|
-
const
|
|
3019
|
+
const M = [];
|
|
3020
3020
|
if (n === "temperature")
|
|
3021
|
-
|
|
3022
|
-
const R =
|
|
3023
|
-
Number.isFinite(R) &&
|
|
3024
|
-
label: `${R.toFixed(6)} ${c(
|
|
3021
|
+
o.units.forEach((V) => {
|
|
3022
|
+
const R = Lr(t, V, y);
|
|
3023
|
+
Number.isFinite(R) && M.push({
|
|
3024
|
+
label: `${R.toFixed(6)} ${c(V)}`,
|
|
3025
3025
|
value: R.toString(),
|
|
3026
|
-
unit:
|
|
3026
|
+
unit: V
|
|
3027
3027
|
});
|
|
3028
3028
|
});
|
|
3029
3029
|
else {
|
|
3030
|
-
const
|
|
3031
|
-
|
|
3032
|
-
const v = y /
|
|
3033
|
-
Number.isFinite(v) &&
|
|
3030
|
+
const V = o.factors[t];
|
|
3031
|
+
V !== void 0 && Object.entries(o.factors).forEach(([R, I]) => {
|
|
3032
|
+
const v = y / V * I;
|
|
3033
|
+
Number.isFinite(v) && M.push({
|
|
3034
3034
|
label: `${v.toFixed(6)} ${c(R)}`,
|
|
3035
3035
|
value: v.toString(),
|
|
3036
3036
|
unit: R
|
|
3037
3037
|
});
|
|
3038
3038
|
});
|
|
3039
3039
|
}
|
|
3040
|
-
f(
|
|
3040
|
+
f(M), i(M.length > 0);
|
|
3041
3041
|
},
|
|
3042
|
-
[e, r, t, n,
|
|
3042
|
+
[e, r, t, n, o, c]
|
|
3043
3043
|
), C = l.useCallback(
|
|
3044
3044
|
(h) => {
|
|
3045
|
-
i(!1), m(null),
|
|
3045
|
+
i(!1), m(null), a(h);
|
|
3046
3046
|
},
|
|
3047
|
-
[
|
|
3047
|
+
[a]
|
|
3048
3048
|
), N = l.useCallback(() => {
|
|
3049
3049
|
i(!1), m(null);
|
|
3050
3050
|
}, []);
|
|
3051
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ z(Ie, { children: [
|
|
3052
3052
|
/* @__PURE__ */ p(
|
|
3053
3053
|
"button",
|
|
3054
3054
|
{
|
|
@@ -3076,7 +3076,7 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3076
3076
|
}
|
|
3077
3077
|
),
|
|
3078
3078
|
s && u.length > 0 && /* @__PURE__ */ p(
|
|
3079
|
-
|
|
3079
|
+
Zt,
|
|
3080
3080
|
{
|
|
3081
3081
|
pos: d,
|
|
3082
3082
|
options: u,
|
|
@@ -3088,40 +3088,40 @@ const ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
3088
3088
|
});
|
|
3089
3089
|
jr.displayName = "ConversionButton";
|
|
3090
3090
|
const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
3091
|
-
const { t:
|
|
3091
|
+
const { t: o } = B(), a = T(e), c = e.dimension, s = l.useMemo(() => c ? Tr(c) : null, [c]), i = String(r?.[0] ?? ""), d = String(r?.[1] ?? s?.default ?? ""), [m, u] = l.useState(i), [f, b] = l.useState(d);
|
|
3092
3092
|
l.useEffect(() => {
|
|
3093
3093
|
u(i);
|
|
3094
3094
|
}, [i]), l.useEffect(() => {
|
|
3095
3095
|
b(d);
|
|
3096
3096
|
}, [d]);
|
|
3097
|
-
const C =
|
|
3097
|
+
const C = a([m, f]);
|
|
3098
3098
|
l.useEffect(() => {
|
|
3099
3099
|
n?.(C);
|
|
3100
3100
|
}, [C, n]);
|
|
3101
3101
|
const N = l.useCallback(
|
|
3102
|
-
(
|
|
3103
|
-
const
|
|
3104
|
-
u(
|
|
3102
|
+
(F) => {
|
|
3103
|
+
const V = F.target.value;
|
|
3104
|
+
u(V), a([V, f]), t?.([V, f]);
|
|
3105
3105
|
},
|
|
3106
|
-
[f,
|
|
3106
|
+
[f, a, t]
|
|
3107
3107
|
), h = l.useCallback(
|
|
3108
|
-
(
|
|
3109
|
-
const
|
|
3110
|
-
b(
|
|
3108
|
+
(F) => {
|
|
3109
|
+
const V = F.target.value;
|
|
3110
|
+
b(V), a([m, V]), t?.([m, V]);
|
|
3111
3111
|
},
|
|
3112
|
-
[m,
|
|
3112
|
+
[m, a, t]
|
|
3113
3113
|
), y = l.useCallback(
|
|
3114
|
-
(
|
|
3115
|
-
u(
|
|
3114
|
+
(F) => {
|
|
3115
|
+
u(F.value), b(F.unit), t?.([F.value, F.unit]);
|
|
3116
3116
|
},
|
|
3117
3117
|
[t]
|
|
3118
3118
|
), E = l.useMemo(
|
|
3119
|
-
() => s ? s.units.map((
|
|
3120
|
-
[s,
|
|
3119
|
+
() => s ? s.units.map((F) => /* @__PURE__ */ p("option", { value: F, children: o(F) }, F)) : [],
|
|
3120
|
+
[s, o]
|
|
3121
3121
|
);
|
|
3122
3122
|
if (!c || !s) return null;
|
|
3123
|
-
const
|
|
3124
|
-
return /* @__PURE__ */ p(
|
|
3123
|
+
const M = !!C || !m.trim();
|
|
3124
|
+
return /* @__PURE__ */ p(L, { field: e, error: C, children: /* @__PURE__ */ z("div", { style: { display: "flex", alignItems: "center", gap: "var(--reactaform-unit-gap, 8px)", width: "100%" }, children: [
|
|
3125
3125
|
/* @__PURE__ */ p(
|
|
3126
3126
|
"input",
|
|
3127
3127
|
{
|
|
@@ -3130,7 +3130,7 @@ const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
3130
3130
|
value: m,
|
|
3131
3131
|
onChange: N,
|
|
3132
3132
|
style: { flex: "2 1 0" },
|
|
3133
|
-
className: U(
|
|
3133
|
+
className: U($.input, $.textInput),
|
|
3134
3134
|
"aria-invalid": !!C,
|
|
3135
3135
|
"aria-describedby": C ? `${e.name}-error` : void 0
|
|
3136
3136
|
}
|
|
@@ -3142,7 +3142,7 @@ const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
3142
3142
|
value: f,
|
|
3143
3143
|
onChange: h,
|
|
3144
3144
|
style: { flex: "1 1 0" },
|
|
3145
|
-
className: U(
|
|
3145
|
+
className: U($.input, $.inputSelect),
|
|
3146
3146
|
"aria-invalid": !!C,
|
|
3147
3147
|
"aria-describedby": C ? `${e.name}-error` : void 0,
|
|
3148
3148
|
children: E
|
|
@@ -3151,32 +3151,32 @@ const Br = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
3151
3151
|
/* @__PURE__ */ p(
|
|
3152
3152
|
jr,
|
|
3153
3153
|
{
|
|
3154
|
-
disabled:
|
|
3154
|
+
disabled: M,
|
|
3155
3155
|
inputValue: m,
|
|
3156
3156
|
selectedUnit: f,
|
|
3157
3157
|
dimension: c,
|
|
3158
3158
|
unitFactors: s,
|
|
3159
3159
|
onConversionSelect: y,
|
|
3160
|
-
t:
|
|
3160
|
+
t: o
|
|
3161
3161
|
}
|
|
3162
3162
|
)
|
|
3163
3163
|
] }) });
|
|
3164
3164
|
};
|
|
3165
3165
|
Br.displayName = "UnitValueInput";
|
|
3166
|
-
const
|
|
3166
|
+
const en = l.memo(Br), Hr = ({
|
|
3167
3167
|
field: e,
|
|
3168
3168
|
value: r,
|
|
3169
3169
|
onChange: t,
|
|
3170
3170
|
onError: n,
|
|
3171
|
-
error:
|
|
3171
|
+
error: o
|
|
3172
3172
|
}) => {
|
|
3173
|
-
const
|
|
3173
|
+
const a = T(e, o), { inputRef: c, error: s, handleChange: i } = _({
|
|
3174
3174
|
value: r,
|
|
3175
3175
|
onChange: t,
|
|
3176
3176
|
onError: n,
|
|
3177
|
-
validate:
|
|
3177
|
+
validate: a
|
|
3178
3178
|
});
|
|
3179
|
-
return /* @__PURE__ */ p(
|
|
3179
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
3180
3180
|
"input",
|
|
3181
3181
|
{
|
|
3182
3182
|
id: e.name,
|
|
@@ -3184,7 +3184,7 @@ const Qt = l.memo(Br), Hr = ({
|
|
|
3184
3184
|
defaultValue: String(r ?? ""),
|
|
3185
3185
|
ref: c,
|
|
3186
3186
|
onChange: i,
|
|
3187
|
-
className: U(
|
|
3187
|
+
className: U($.input, $.textInput),
|
|
3188
3188
|
placeholder: "https://example.com",
|
|
3189
3189
|
"aria-invalid": !!s,
|
|
3190
3190
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
@@ -3192,20 +3192,20 @@ const Qt = l.memo(Br), Hr = ({
|
|
|
3192
3192
|
) });
|
|
3193
3193
|
};
|
|
3194
3194
|
Hr.displayName = "UrlInput";
|
|
3195
|
-
const
|
|
3196
|
-
function
|
|
3195
|
+
const rn = l.memo(Hr), se = new ne();
|
|
3196
|
+
function po(e, r) {
|
|
3197
3197
|
se.register(e, r);
|
|
3198
3198
|
}
|
|
3199
|
-
function
|
|
3199
|
+
function tn(e) {
|
|
3200
3200
|
return se.get(e);
|
|
3201
3201
|
}
|
|
3202
|
-
function
|
|
3202
|
+
function go(e) {
|
|
3203
3203
|
return se.has(e);
|
|
3204
3204
|
}
|
|
3205
|
-
function
|
|
3205
|
+
function ho(e) {
|
|
3206
3206
|
return se.unregister(e);
|
|
3207
3207
|
}
|
|
3208
|
-
function
|
|
3208
|
+
function bo() {
|
|
3209
3209
|
return se.list();
|
|
3210
3210
|
}
|
|
3211
3211
|
const qr = ({
|
|
@@ -3214,12 +3214,12 @@ const qr = ({
|
|
|
3214
3214
|
handleChange: t,
|
|
3215
3215
|
handleError: n
|
|
3216
3216
|
}) => {
|
|
3217
|
-
const { t:
|
|
3217
|
+
const { t: o } = B(), [a, c] = l.useState(!1), [s, i] = l.useState(null), d = l.useCallback(async () => {
|
|
3218
3218
|
if (!e.action) {
|
|
3219
3219
|
console.warn(`Button "${e.name}" has no action defined`);
|
|
3220
3220
|
return;
|
|
3221
3221
|
}
|
|
3222
|
-
const f =
|
|
3222
|
+
const f = tn(e.action);
|
|
3223
3223
|
if (!f) {
|
|
3224
3224
|
const b = `Button handler "${e.action}" not found`;
|
|
3225
3225
|
console.error(b), i(b);
|
|
@@ -3227,33 +3227,33 @@ const qr = ({
|
|
|
3227
3227
|
}
|
|
3228
3228
|
c(!0), i(null);
|
|
3229
3229
|
try {
|
|
3230
|
-
await f(r, t, n,
|
|
3230
|
+
await f(r, t, n, o);
|
|
3231
3231
|
} catch (b) {
|
|
3232
3232
|
const C = b instanceof Error ? b.message : String(b);
|
|
3233
3233
|
console.error(`Button handler "${e.action}" failed:`, C), i(C);
|
|
3234
3234
|
} finally {
|
|
3235
3235
|
c(!1);
|
|
3236
3236
|
}
|
|
3237
|
-
}, [e, r, t, n,
|
|
3238
|
-
cursor:
|
|
3239
|
-
opacity:
|
|
3237
|
+
}, [e, r, t, n, o]), u = { ...{
|
|
3238
|
+
cursor: a ? "wait" : "pointer",
|
|
3239
|
+
opacity: a ? 0.6 : 1
|
|
3240
3240
|
} };
|
|
3241
|
-
return e.width && typeof e.width == "number" && e.width > 0 && (u.width = `${e.width}px`), /* @__PURE__ */ p(
|
|
3241
|
+
return e.width && typeof e.width == "number" && e.width > 0 && (u.width = `${e.width}px`), /* @__PURE__ */ p(L, { field: e, rightAlign: !0, error: s, children: /* @__PURE__ */ p(
|
|
3242
3242
|
"button",
|
|
3243
3243
|
{
|
|
3244
3244
|
type: "button",
|
|
3245
|
-
className:
|
|
3245
|
+
className: $.button,
|
|
3246
3246
|
onClick: d,
|
|
3247
|
-
disabled:
|
|
3248
|
-
"aria-label":
|
|
3249
|
-
"aria-busy":
|
|
3247
|
+
disabled: a,
|
|
3248
|
+
"aria-label": o(e.displayName),
|
|
3249
|
+
"aria-busy": a,
|
|
3250
3250
|
style: u,
|
|
3251
|
-
children: a
|
|
3251
|
+
children: o(a ? "Processing..." : e.displayName)
|
|
3252
3252
|
}
|
|
3253
3253
|
) });
|
|
3254
3254
|
};
|
|
3255
3255
|
qr.displayName = "Button";
|
|
3256
|
-
const
|
|
3256
|
+
const nn = l.memo(qr), on = {
|
|
3257
3257
|
// No debounce
|
|
3258
3258
|
checkbox: !1,
|
|
3259
3259
|
switch: !1,
|
|
@@ -3286,57 +3286,57 @@ const tn = l.memo(qr), nn = {
|
|
|
3286
3286
|
slider: { wait: 100, leading: !0, trailing: !0 },
|
|
3287
3287
|
stepper: { wait: 100, leading: !0, trailing: !0 }
|
|
3288
3288
|
}, me = new ne(), De = {
|
|
3289
|
-
button:
|
|
3290
|
-
checkbox:
|
|
3291
|
-
color:
|
|
3292
|
-
date:
|
|
3293
|
-
description:
|
|
3289
|
+
button: nn,
|
|
3290
|
+
checkbox: xt,
|
|
3291
|
+
color: kt,
|
|
3292
|
+
date: It,
|
|
3293
|
+
description: Et,
|
|
3294
3294
|
dropdown: Mt,
|
|
3295
|
-
email:
|
|
3296
|
-
file:
|
|
3297
|
-
float:
|
|
3298
|
-
"float-array":
|
|
3299
|
-
image:
|
|
3295
|
+
email: Vt,
|
|
3296
|
+
file: At,
|
|
3297
|
+
float: Dt,
|
|
3298
|
+
"float-array": Rt,
|
|
3299
|
+
image: Pt,
|
|
3300
3300
|
int: Lt,
|
|
3301
|
-
"int-array":
|
|
3302
|
-
"multi-selection":
|
|
3303
|
-
multiline:
|
|
3304
|
-
password:
|
|
3305
|
-
phone:
|
|
3306
|
-
radio:
|
|
3307
|
-
rating:
|
|
3301
|
+
"int-array": Ot,
|
|
3302
|
+
"multi-selection": Bt,
|
|
3303
|
+
multiline: Tt,
|
|
3304
|
+
password: Gt,
|
|
3305
|
+
phone: qt,
|
|
3306
|
+
radio: Ut,
|
|
3307
|
+
rating: Kt,
|
|
3308
3308
|
separator: $t,
|
|
3309
|
-
slider:
|
|
3309
|
+
slider: Jt,
|
|
3310
3310
|
string: xe,
|
|
3311
|
-
stepper:
|
|
3312
|
-
switch:
|
|
3311
|
+
stepper: Ht,
|
|
3312
|
+
switch: Yt,
|
|
3313
3313
|
text: xe,
|
|
3314
|
-
time:
|
|
3315
|
-
unit:
|
|
3316
|
-
url:
|
|
3314
|
+
time: Xt,
|
|
3315
|
+
unit: en,
|
|
3316
|
+
url: rn
|
|
3317
3317
|
};
|
|
3318
3318
|
function an(e) {
|
|
3319
3319
|
return e in De;
|
|
3320
3320
|
}
|
|
3321
|
-
function
|
|
3322
|
-
const { wait: t = 200, leading: n, trailing:
|
|
3321
|
+
function sn(e, r) {
|
|
3322
|
+
const { wait: t = 200, leading: n, trailing: o } = r, a = l.memo((c) => {
|
|
3323
3323
|
const s = l.useRef(c.onChange);
|
|
3324
3324
|
l.useEffect(() => {
|
|
3325
3325
|
s.current = c.onChange;
|
|
3326
3326
|
}, [c.onChange]);
|
|
3327
|
-
const { callback: i, cancel: d } =
|
|
3327
|
+
const { callback: i, cancel: d } = ut(
|
|
3328
3328
|
(...m) => {
|
|
3329
3329
|
s.current?.(...m);
|
|
3330
3330
|
},
|
|
3331
3331
|
t,
|
|
3332
|
-
{ leading: n, trailing:
|
|
3332
|
+
{ leading: n, trailing: o }
|
|
3333
3333
|
);
|
|
3334
3334
|
return l.useEffect(() => d, [d]), l.createElement(
|
|
3335
3335
|
e,
|
|
3336
3336
|
{ ...c, onChange: i }
|
|
3337
3337
|
);
|
|
3338
3338
|
});
|
|
3339
|
-
return
|
|
3339
|
+
return a.displayName = "DebouncedFieldWrapper", a;
|
|
3340
3340
|
}
|
|
3341
3341
|
function Ur(e, r, t) {
|
|
3342
3342
|
const n = r;
|
|
@@ -3344,15 +3344,15 @@ function Ur(e, r, t) {
|
|
|
3344
3344
|
console.warn(`Can't overwrite base component type "${e}".`);
|
|
3345
3345
|
return;
|
|
3346
3346
|
}
|
|
3347
|
-
const
|
|
3348
|
-
if (
|
|
3347
|
+
const o = on[e];
|
|
3348
|
+
if (o === !1) {
|
|
3349
3349
|
me.register(e, n);
|
|
3350
3350
|
return;
|
|
3351
3351
|
}
|
|
3352
|
-
const
|
|
3353
|
-
|
|
3352
|
+
const a = o ?? { wait: 200 };
|
|
3353
|
+
or ? me.register(e, n) : me.register(
|
|
3354
3354
|
e,
|
|
3355
|
-
|
|
3355
|
+
sn(n, a)
|
|
3356
3356
|
);
|
|
3357
3357
|
}
|
|
3358
3358
|
function Wr(e, r) {
|
|
@@ -3362,21 +3362,21 @@ function _r(e) {
|
|
|
3362
3362
|
return me.get(e);
|
|
3363
3363
|
}
|
|
3364
3364
|
let Ye = !1;
|
|
3365
|
-
function
|
|
3365
|
+
function cn() {
|
|
3366
3366
|
Ye || (Object.entries(De).forEach(([e, r]) => {
|
|
3367
3367
|
Ur(e, r, !0);
|
|
3368
3368
|
}), Ye = !0);
|
|
3369
3369
|
}
|
|
3370
3370
|
const ze = l.memo(
|
|
3371
|
-
({ field: e, valuesMap: r, handleChange: t, handleError: n, errorsMap:
|
|
3372
|
-
const
|
|
3371
|
+
({ field: e, valuesMap: r, handleChange: t, handleError: n, errorsMap: o }) => {
|
|
3372
|
+
const a = _r(e.type), c = r[e.name], s = o ? o[e.name] ?? null : void 0, i = l.useMemo(() => c, [c]), d = l.useCallback(
|
|
3373
3373
|
(u) => t(e.name, u),
|
|
3374
3374
|
[t, e.name]
|
|
3375
3375
|
), m = l.useCallback(
|
|
3376
3376
|
(u) => n?.(e.name, u),
|
|
3377
3377
|
[n, e.name]
|
|
3378
3378
|
);
|
|
3379
|
-
return
|
|
3379
|
+
return a ? e.type === "button" ? /* @__PURE__ */ p(a, { ...{
|
|
3380
3380
|
field: e,
|
|
3381
3381
|
value: null,
|
|
3382
3382
|
valuesMap: r,
|
|
@@ -3384,7 +3384,7 @@ const ze = l.memo(
|
|
|
3384
3384
|
handleError: n || (() => {
|
|
3385
3385
|
})
|
|
3386
3386
|
} }) : /* @__PURE__ */ p(
|
|
3387
|
-
|
|
3387
|
+
a,
|
|
3388
3388
|
{
|
|
3389
3389
|
field: e,
|
|
3390
3390
|
value: i,
|
|
@@ -3398,10 +3398,10 @@ const ze = l.memo(
|
|
|
3398
3398
|
);
|
|
3399
3399
|
ze.displayName = "FieldRenderer";
|
|
3400
3400
|
const Kr = l.memo(
|
|
3401
|
-
({ groupName: e, defaultOpen: r = !0, fields: t, valuesMap: n, handleChange:
|
|
3401
|
+
({ groupName: e, defaultOpen: r = !0, fields: t, valuesMap: n, handleChange: o, handleError: a, errorsMap: c, t: s }) => {
|
|
3402
3402
|
const [i, d] = l.useState(r), m = l.useCallback(() => d((u) => !u), []);
|
|
3403
|
-
return /* @__PURE__ */
|
|
3404
|
-
/* @__PURE__ */
|
|
3403
|
+
return /* @__PURE__ */ z("fieldset", { className: "reactaform-group", children: [
|
|
3404
|
+
/* @__PURE__ */ z("legend", { onClick: m, className: "reactaform-group_legend", children: [
|
|
3405
3405
|
/* @__PURE__ */ p("span", { children: s(e) }),
|
|
3406
3406
|
/* @__PURE__ */ p("span", { className: "reactaform-group_legend_arrow", children: i ? "▼" : "▶" })
|
|
3407
3407
|
] }),
|
|
@@ -3410,8 +3410,8 @@ const Kr = l.memo(
|
|
|
3410
3410
|
{
|
|
3411
3411
|
field: u,
|
|
3412
3412
|
valuesMap: n,
|
|
3413
|
-
handleChange:
|
|
3414
|
-
handleError:
|
|
3413
|
+
handleChange: o,
|
|
3414
|
+
handleError: a,
|
|
3415
3415
|
errorsMap: c
|
|
3416
3416
|
},
|
|
3417
3417
|
u.name
|
|
@@ -3421,62 +3421,86 @@ const Kr = l.memo(
|
|
|
3421
3421
|
);
|
|
3422
3422
|
Kr.displayName = "FieldGroup";
|
|
3423
3423
|
const Pe = (e, r, t, n) => {
|
|
3424
|
-
const
|
|
3425
|
-
if (!
|
|
3426
|
-
const
|
|
3424
|
+
const o = r[e];
|
|
3425
|
+
if (!o?.children) return;
|
|
3426
|
+
const a = t[e], c = a != null ? String(a) : "", s = o.children[c];
|
|
3427
3427
|
if (Array.isArray(s))
|
|
3428
3428
|
for (const i of s)
|
|
3429
3429
|
typeof i == "string" && r[i] && (n[i] = !0, Pe(i, r, t, n));
|
|
3430
3430
|
}, Gr = (e, r, t) => {
|
|
3431
3431
|
const n = r[e];
|
|
3432
3432
|
if (!n?.children) return;
|
|
3433
|
-
const
|
|
3434
|
-
for (const
|
|
3435
|
-
typeof
|
|
3436
|
-
},
|
|
3437
|
-
const
|
|
3438
|
-
return e.forEach((
|
|
3439
|
-
(!
|
|
3440
|
-
}),
|
|
3441
|
-
},
|
|
3442
|
-
const
|
|
3443
|
-
if (Gr(n, r,
|
|
3444
|
-
const s = String(
|
|
3433
|
+
const o = Object.values(n.children).flat();
|
|
3434
|
+
for (const a of o)
|
|
3435
|
+
typeof a == "string" && a in t && (t[a] = !1, Gr(a, r, t));
|
|
3436
|
+
}, ln = (e, r, t, n) => {
|
|
3437
|
+
const o = { ...t };
|
|
3438
|
+
return e.forEach((a) => {
|
|
3439
|
+
(!a.parents || Object.keys(a.parents).length === 0) && (o[a.name] = !0, Pe(a.name, n, r, o));
|
|
3440
|
+
}), o;
|
|
3441
|
+
}, un = (e, r, t, n, o) => {
|
|
3442
|
+
const a = { ...e }, c = r[n];
|
|
3443
|
+
if (Gr(n, r, a), o != null && c?.children) {
|
|
3444
|
+
const s = String(o), i = c.children[s];
|
|
3445
3445
|
if (Array.isArray(i))
|
|
3446
3446
|
for (const d of i)
|
|
3447
|
-
typeof d == "string" && r[d] && (
|
|
3447
|
+
typeof d == "string" && r[d] && (a[d] = !0, Pe(d, r, t, a));
|
|
3448
|
+
}
|
|
3449
|
+
for (const [s, i] of Object.entries(r))
|
|
3450
|
+
i.parents && n in i.parents && (a[s] = Jr(s, r, t));
|
|
3451
|
+
return a;
|
|
3452
|
+
}, Jr = (e, r, t) => {
|
|
3453
|
+
const n = r[e];
|
|
3454
|
+
if (!n) return !1;
|
|
3455
|
+
if (!n.parents || Object.keys(n.parents).length === 0)
|
|
3456
|
+
return !0;
|
|
3457
|
+
for (const [o, a] of Object.entries(n.parents)) {
|
|
3458
|
+
if (!r[o] || !Jr(o, r, t))
|
|
3459
|
+
continue;
|
|
3460
|
+
const s = t[o];
|
|
3461
|
+
if (s == null)
|
|
3462
|
+
continue;
|
|
3463
|
+
const i = a.map((d) => String(d));
|
|
3464
|
+
if (Array.isArray(s)) {
|
|
3465
|
+
if (s.map((u) => String(u)).some((u) => i.includes(u)))
|
|
3466
|
+
return !0;
|
|
3467
|
+
} else {
|
|
3468
|
+
const d = String(s);
|
|
3469
|
+
if (i.includes(d))
|
|
3470
|
+
return !0;
|
|
3471
|
+
}
|
|
3448
3472
|
}
|
|
3449
|
-
return
|
|
3450
|
-
},
|
|
3473
|
+
return !1;
|
|
3474
|
+
}, mn = (e, r) => {
|
|
3451
3475
|
const t = /* @__PURE__ */ new Map();
|
|
3452
|
-
let n = null,
|
|
3476
|
+
let n = null, o = null, a = 0;
|
|
3453
3477
|
for (const c of e) {
|
|
3454
3478
|
const s = c.group;
|
|
3455
3479
|
if (!s) {
|
|
3456
|
-
n = null,
|
|
3480
|
+
n = null, o = null;
|
|
3457
3481
|
continue;
|
|
3458
3482
|
}
|
|
3459
3483
|
if (s === n)
|
|
3460
|
-
r[c.name].group =
|
|
3484
|
+
r[c.name].group = o ?? s;
|
|
3461
3485
|
else {
|
|
3462
3486
|
if (!t.has(s))
|
|
3463
|
-
t.set(s, 1),
|
|
3487
|
+
t.set(s, 1), o = null, r[c.name].group = s;
|
|
3464
3488
|
else {
|
|
3465
3489
|
const i = t.get(s), d = `${s}(${i})`;
|
|
3466
|
-
t.set(s, i + 1),
|
|
3490
|
+
t.set(s, i + 1), o = d, r[c.name].group = d, a++;
|
|
3467
3491
|
}
|
|
3468
3492
|
n = s;
|
|
3469
3493
|
}
|
|
3470
3494
|
}
|
|
3471
|
-
return
|
|
3472
|
-
},
|
|
3495
|
+
return a;
|
|
3496
|
+
}, dn = (e, r = {}) => {
|
|
3473
3497
|
const { includeEmpty: t = !0 } = r, n = [];
|
|
3474
|
-
let
|
|
3498
|
+
let o = null, a = [], c = 0;
|
|
3475
3499
|
for (const i of e) {
|
|
3476
3500
|
const d = i.group || null;
|
|
3477
|
-
d !==
|
|
3501
|
+
d !== o ? ((a.length > 0 || t) && n.push({ name: o, fields: a }), o = d, a = [i]) : a.push(i);
|
|
3478
3502
|
}
|
|
3479
|
-
(
|
|
3503
|
+
(a.length > 0 || t) && n.push({ name: o, fields: a }), c = n.filter((i) => i.fields.length === 0).length;
|
|
3480
3504
|
const s = Math.max(0, ...n.map((i) => i.fields.length));
|
|
3481
3505
|
return {
|
|
3482
3506
|
groups: n,
|
|
@@ -3486,17 +3510,17 @@ const Pe = (e, r, t, n) => {
|
|
|
3486
3510
|
largestGroup: s
|
|
3487
3511
|
}
|
|
3488
3512
|
};
|
|
3489
|
-
},
|
|
3490
|
-
function
|
|
3491
|
-
|
|
3492
|
-
}
|
|
3493
|
-
function dn(e) {
|
|
3494
|
-
return Le.get(e);
|
|
3513
|
+
}, Oe = new ne();
|
|
3514
|
+
function Yr(e, r) {
|
|
3515
|
+
Oe.register(e, r);
|
|
3495
3516
|
}
|
|
3496
3517
|
function fn(e) {
|
|
3497
|
-
return
|
|
3518
|
+
return Oe.get(e);
|
|
3519
|
+
}
|
|
3520
|
+
function pn(e) {
|
|
3521
|
+
return Oe.get(e);
|
|
3498
3522
|
}
|
|
3499
|
-
|
|
3523
|
+
Yr(
|
|
3500
3524
|
"Preset_AlertSubmitHandler",
|
|
3501
3525
|
(e, r, t) => {
|
|
3502
3526
|
const n = {
|
|
@@ -3504,12 +3528,12 @@ Jr(
|
|
|
3504
3528
|
version: e.version,
|
|
3505
3529
|
definition: e.name,
|
|
3506
3530
|
values: t
|
|
3507
|
-
},
|
|
3508
|
-
alert(
|
|
3531
|
+
}, o = JSON.stringify(n, null, 2);
|
|
3532
|
+
alert(o);
|
|
3509
3533
|
}
|
|
3510
3534
|
);
|
|
3511
|
-
async function
|
|
3512
|
-
const s =
|
|
3535
|
+
async function gn(e, r, t, n, o, a, c) {
|
|
3536
|
+
const s = o ? Object.values(o).filter(Boolean) : [];
|
|
3513
3537
|
if (s.length > 0)
|
|
3514
3538
|
return {
|
|
3515
3539
|
success: !1,
|
|
@@ -3543,12 +3567,12 @@ async function pn(e, r, t, n, a, o, c) {
|
|
|
3543
3567
|
const N = String(b).split(",").map((E) => E.trim()).filter(Boolean), h = [];
|
|
3544
3568
|
let y = !1;
|
|
3545
3569
|
for (const E of N) {
|
|
3546
|
-
const
|
|
3547
|
-
if (isNaN(
|
|
3570
|
+
const M = Number(E);
|
|
3571
|
+
if (isNaN(M)) {
|
|
3548
3572
|
d.push(n("Invalid number {{1}} in array for field {{2}}", E, u.displayName || f)), y = !0;
|
|
3549
3573
|
break;
|
|
3550
3574
|
}
|
|
3551
|
-
h.push(
|
|
3575
|
+
h.push(M);
|
|
3552
3576
|
}
|
|
3553
3577
|
y || (i[f] = h);
|
|
3554
3578
|
}
|
|
@@ -3571,7 +3595,7 @@ async function pn(e, r, t, n, a, o, c) {
|
|
|
3571
3595
|
errors: u
|
|
3572
3596
|
};
|
|
3573
3597
|
} else {
|
|
3574
|
-
const u = await
|
|
3598
|
+
const u = await vt(e, i, n);
|
|
3575
3599
|
if (u && u.length > 0)
|
|
3576
3600
|
return {
|
|
3577
3601
|
success: !1,
|
|
@@ -3580,9 +3604,9 @@ async function pn(e, r, t, n, a, o, c) {
|
|
|
3580
3604
|
};
|
|
3581
3605
|
}
|
|
3582
3606
|
const m = (u) => u ? Array.isArray(u) ? u.map((f) => String(f)) : typeof u == "string" ? u.trim() ? [u] : [] : [String(u)] : [];
|
|
3583
|
-
if (
|
|
3607
|
+
if (a)
|
|
3584
3608
|
try {
|
|
3585
|
-
const u = await
|
|
3609
|
+
const u = await a(e, r?.name ?? null, i, n), f = m(u);
|
|
3586
3610
|
if (f.length > 0)
|
|
3587
3611
|
return {
|
|
3588
3612
|
success: !1,
|
|
@@ -3597,7 +3621,7 @@ async function pn(e, r, t, n, a, o, c) {
|
|
|
3597
3621
|
};
|
|
3598
3622
|
}
|
|
3599
3623
|
else if (e && typeof e.submitHandlerName == "string") {
|
|
3600
|
-
const u =
|
|
3624
|
+
const u = fn(e.submitHandlerName);
|
|
3601
3625
|
if (u)
|
|
3602
3626
|
try {
|
|
3603
3627
|
const f = await u(e, r?.name ?? null, i, n), b = m(f);
|
|
@@ -3621,12 +3645,12 @@ async function pn(e, r, t, n, a, o, c) {
|
|
|
3621
3645
|
data: i
|
|
3622
3646
|
};
|
|
3623
3647
|
}
|
|
3624
|
-
const
|
|
3648
|
+
const Xr = ({
|
|
3625
3649
|
message: e,
|
|
3626
3650
|
success: r,
|
|
3627
3651
|
onDismiss: t,
|
|
3628
3652
|
t: n
|
|
3629
|
-
}) => e ? /* @__PURE__ */
|
|
3653
|
+
}) => e ? /* @__PURE__ */ z(
|
|
3630
3654
|
"div",
|
|
3631
3655
|
{
|
|
3632
3656
|
role: "status",
|
|
@@ -3663,16 +3687,16 @@ const Yr = ({
|
|
|
3663
3687
|
]
|
|
3664
3688
|
}
|
|
3665
3689
|
) : null;
|
|
3666
|
-
|
|
3667
|
-
const
|
|
3668
|
-
const [n,
|
|
3690
|
+
Xr.displayName = "SubmissionMessage";
|
|
3691
|
+
const hn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
3692
|
+
const [n, o] = l.useState(!1);
|
|
3669
3693
|
return /* @__PURE__ */ p(
|
|
3670
3694
|
"button",
|
|
3671
3695
|
{
|
|
3672
3696
|
onClick: e,
|
|
3673
3697
|
disabled: r,
|
|
3674
|
-
onMouseEnter: () =>
|
|
3675
|
-
onMouseLeave: () =>
|
|
3698
|
+
onMouseEnter: () => o(!0),
|
|
3699
|
+
onMouseLeave: () => o(!1),
|
|
3676
3700
|
style: {
|
|
3677
3701
|
padding: "var(--reactaform-button-padding, var(--reactaform-space) 12px)",
|
|
3678
3702
|
backgroundColor: r ? "var(--reactaform-button-disabled-bg, #cccccc)" : "var(--reactaform-button-bg, var(--reactaform-success-color))",
|
|
@@ -3690,131 +3714,133 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3690
3714
|
children: t("Submit")
|
|
3691
3715
|
}
|
|
3692
3716
|
);
|
|
3693
|
-
},
|
|
3717
|
+
}, bn = ({
|
|
3694
3718
|
definition: e,
|
|
3695
3719
|
instance: r,
|
|
3696
3720
|
onSubmit: t = void 0,
|
|
3697
3721
|
onValidation: n = void 0,
|
|
3698
|
-
chunkSize:
|
|
3699
|
-
chunkDelay:
|
|
3722
|
+
chunkSize: o = 50,
|
|
3723
|
+
chunkDelay: a = 50
|
|
3700
3724
|
}) => {
|
|
3701
3725
|
const { properties: c, displayName: s } = e, i = B(), { t: d, formStyle: m, language: u, displayInstanceName: f } = i, b = {
|
|
3702
3726
|
...i,
|
|
3703
3727
|
definitionName: e?.name ?? i.definitionName
|
|
3704
|
-
}, [C, N] = l.useState("en"), [h, y] = l.useState([]), [E,
|
|
3728
|
+
}, [C, N] = l.useState("en"), [h, y] = l.useState([]), [E, M] = l.useState({}), [F, V] = l.useState(
|
|
3705
3729
|
{}
|
|
3706
|
-
), [R, I] = l.useState({}), [v, g] = l.useState({}), [w, x] = l.useState(null), [k, S] = l.useState(null), [A, j] = l.useState(0), [K, ce] = l.useState(!1), [je,
|
|
3730
|
+
), [R, I] = l.useState({}), [v, g] = l.useState({}), [w, x] = l.useState(null), [k, S] = l.useState(null), [A, j] = l.useState(0), [K, ce] = l.useState(!1), [je, oe] = l.useState(r.name || ""), X = l.useRef(r), fe = l.useRef(!1);
|
|
3707
3731
|
l.useEffect(() => {
|
|
3708
|
-
const
|
|
3709
|
-
c.map((
|
|
3710
|
-
|
|
3711
|
-
{ ...
|
|
3732
|
+
const P = Object.fromEntries(
|
|
3733
|
+
c.map((D) => [
|
|
3734
|
+
D.name,
|
|
3735
|
+
{ ...D, children: {} }
|
|
3712
3736
|
])
|
|
3713
3737
|
);
|
|
3714
|
-
c.forEach((
|
|
3715
|
-
|
|
3716
|
-
const
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
const qe = String(
|
|
3720
|
-
|
|
3721
|
-
...
|
|
3722
|
-
|
|
3738
|
+
c.forEach((D) => {
|
|
3739
|
+
D.parents && Object.entries(D.parents).forEach(([J, re]) => {
|
|
3740
|
+
const Z = P[J];
|
|
3741
|
+
Z && re.forEach((it) => {
|
|
3742
|
+
Z.children || (Z.children = {});
|
|
3743
|
+
const qe = String(it);
|
|
3744
|
+
Z.children[qe] = [
|
|
3745
|
+
...Z.children[qe] || [],
|
|
3746
|
+
D.name
|
|
3723
3747
|
];
|
|
3724
3748
|
});
|
|
3725
3749
|
});
|
|
3726
|
-
}),
|
|
3750
|
+
}), mn(c, P);
|
|
3727
3751
|
const q = Object.values(
|
|
3728
|
-
|
|
3729
|
-
),
|
|
3730
|
-
q.forEach((
|
|
3731
|
-
if (
|
|
3732
|
-
const
|
|
3733
|
-
|
|
3752
|
+
P
|
|
3753
|
+
), O = {};
|
|
3754
|
+
q.forEach((D) => {
|
|
3755
|
+
if (D.type === "unit") {
|
|
3756
|
+
const J = typeof D.defaultValue == "number" ? String(D.defaultValue) : "", re = typeof D.defaultUnit == "string" ? D.defaultUnit : String(D.defaultUnit ?? "m");
|
|
3757
|
+
O[D.name] = [J, re];
|
|
3734
3758
|
} else
|
|
3735
|
-
|
|
3736
|
-
}),
|
|
3737
|
-
|
|
3759
|
+
O[D.name] = D.defaultValue;
|
|
3760
|
+
}), X.current = r, Object.keys(r.values).forEach((D) => {
|
|
3761
|
+
P[D] !== void 0 && (O[D] = r.values[D]);
|
|
3738
3762
|
});
|
|
3739
|
-
const
|
|
3740
|
-
y(q),
|
|
3741
|
-
|
|
3742
|
-
), ce(!0),
|
|
3763
|
+
const Y = Object.fromEntries(q.map((D) => [D.name, !1])), G = requestAnimationFrame(() => {
|
|
3764
|
+
y(q), M(P), V(O), I(
|
|
3765
|
+
ln(q, O, Y, P)
|
|
3766
|
+
), ce(!0), oe(r.name);
|
|
3743
3767
|
});
|
|
3744
3768
|
return () => cancelAnimationFrame(G);
|
|
3745
3769
|
}, [c, r, e]), l.useEffect(() => {
|
|
3746
3770
|
if (!K || A >= h.length) return;
|
|
3747
|
-
const
|
|
3771
|
+
const P = setTimeout(() => {
|
|
3748
3772
|
j(
|
|
3749
|
-
(q) => Math.min(q +
|
|
3773
|
+
(q) => Math.min(q + o, h.length)
|
|
3750
3774
|
);
|
|
3751
|
-
},
|
|
3752
|
-
return () => clearTimeout(
|
|
3753
|
-
}, [K, A, h.length,
|
|
3775
|
+
}, a);
|
|
3776
|
+
return () => clearTimeout(P);
|
|
3777
|
+
}, [K, A, h.length, o, a]);
|
|
3754
3778
|
const Be = l.useCallback(
|
|
3755
|
-
(
|
|
3756
|
-
x(null), S(null),
|
|
3757
|
-
const
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3779
|
+
(P, q) => {
|
|
3780
|
+
x(null), S(null), V((D) => ({ ...D, [P]: q }));
|
|
3781
|
+
const O = E[P], Y = O && O.children && Object.keys(O.children).length > 0, G = Object.values(E).some(
|
|
3782
|
+
(D) => D.parents && P in D.parents
|
|
3783
|
+
);
|
|
3784
|
+
(Y || G) && I((D) => {
|
|
3785
|
+
const J = { ...F, [P]: q };
|
|
3786
|
+
return un(
|
|
3787
|
+
D,
|
|
3762
3788
|
E,
|
|
3763
|
-
|
|
3764
|
-
|
|
3789
|
+
J,
|
|
3790
|
+
P,
|
|
3765
3791
|
q
|
|
3766
3792
|
);
|
|
3767
3793
|
});
|
|
3768
3794
|
},
|
|
3769
|
-
[E,
|
|
3795
|
+
[E, F]
|
|
3770
3796
|
);
|
|
3771
3797
|
l.useEffect(() => {
|
|
3772
|
-
let
|
|
3773
|
-
return
|
|
3798
|
+
let P = 0;
|
|
3799
|
+
return P = requestAnimationFrame(() => {
|
|
3774
3800
|
u !== C && (N(u || "en"), x(null), S(null));
|
|
3775
|
-
}), () => cancelAnimationFrame(
|
|
3801
|
+
}), () => cancelAnimationFrame(P);
|
|
3776
3802
|
}, [u, C]), l.useEffect(() => {
|
|
3777
|
-
let
|
|
3778
|
-
return
|
|
3803
|
+
let P = 0;
|
|
3804
|
+
return P = requestAnimationFrame(() => {
|
|
3779
3805
|
if (fe.current) {
|
|
3780
|
-
fe.current = !1,
|
|
3806
|
+
fe.current = !1, X.current = r, oe(r.name || "");
|
|
3781
3807
|
return;
|
|
3782
3808
|
}
|
|
3783
|
-
|
|
3784
|
-
}), () => cancelAnimationFrame(
|
|
3809
|
+
X.current = r, x(null), S(null), oe(r.name || "");
|
|
3810
|
+
}), () => cancelAnimationFrame(P);
|
|
3785
3811
|
}, [r, r.name]);
|
|
3786
|
-
const He = l.useCallback((
|
|
3787
|
-
g((
|
|
3788
|
-
}, []),
|
|
3812
|
+
const He = l.useCallback((P, q) => {
|
|
3813
|
+
g((O) => q ? { ...O, [P]: String(q) } : Object.fromEntries(Object.entries(O).filter(([G]) => G !== P)));
|
|
3814
|
+
}, []), ot = async () => {
|
|
3789
3815
|
fe.current = !0;
|
|
3790
|
-
const
|
|
3791
|
-
|
|
3816
|
+
const P = X.current?.name;
|
|
3817
|
+
X.current.name = je;
|
|
3792
3818
|
let q = v;
|
|
3793
3819
|
if (b.fieldValidationMode === "onSubmission") {
|
|
3794
|
-
const
|
|
3795
|
-
if (h.forEach((
|
|
3796
|
-
const re =
|
|
3820
|
+
const D = {};
|
|
3821
|
+
if (h.forEach((J) => {
|
|
3822
|
+
const re = F[J.name];
|
|
3797
3823
|
if (re === void 0) return;
|
|
3798
|
-
const
|
|
3799
|
-
|
|
3800
|
-
}), g(
|
|
3824
|
+
const Z = pr(b.definitionName, J, re, d);
|
|
3825
|
+
Z && (D[J.name] = Z);
|
|
3826
|
+
}), g(D), q = D, Object.keys(D).length > 0) {
|
|
3801
3827
|
x(d("Please fix validation errors before submitting the form.")), S(!1);
|
|
3802
3828
|
return;
|
|
3803
3829
|
} else
|
|
3804
3830
|
x(null), S(null);
|
|
3805
3831
|
}
|
|
3806
|
-
const
|
|
3832
|
+
const O = await gn(e, X.current, F, d, q, t, n), Y = typeof O.message == "string" ? O.message : String(O.message), G = Object.values(O.errors ?? {}).join(`
|
|
3807
3833
|
`);
|
|
3808
|
-
x(G ?
|
|
3809
|
-
` + G :
|
|
3834
|
+
x(G ? Y + `
|
|
3835
|
+
` + G : Y), S(O.success), O.success || (X.current.name = P ?? X.current.name, oe(P ?? ""));
|
|
3810
3836
|
}, at = l.useMemo(
|
|
3811
|
-
() => b.fieldValidationMode === "realTime" ? Object.values(v).some(Boolean) : !1,
|
|
3837
|
+
() => b.fieldValidationMode === "onEdit" || b.fieldValidationMode === "realTime" ? Object.values(v).some(Boolean) : !1,
|
|
3812
3838
|
[v, b.fieldValidationMode]
|
|
3813
3839
|
);
|
|
3814
|
-
return /* @__PURE__ */ p(Ee.Provider, { value: b, children: /* @__PURE__ */
|
|
3840
|
+
return /* @__PURE__ */ p(Ee.Provider, { value: b, children: /* @__PURE__ */ z("div", { style: m.container, children: [
|
|
3815
3841
|
s && /* @__PURE__ */ p("h2", { style: m.titleStyle, children: d(s) }),
|
|
3816
3842
|
/* @__PURE__ */ p(
|
|
3817
|
-
|
|
3843
|
+
Xr,
|
|
3818
3844
|
{
|
|
3819
3845
|
message: w,
|
|
3820
3846
|
success: k,
|
|
@@ -3828,38 +3854,38 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3828
3854
|
sr,
|
|
3829
3855
|
{
|
|
3830
3856
|
name: je,
|
|
3831
|
-
onChange: (
|
|
3832
|
-
|
|
3857
|
+
onChange: (P) => {
|
|
3858
|
+
oe(P), x(null), S(null);
|
|
3833
3859
|
}
|
|
3834
3860
|
}
|
|
3835
3861
|
),
|
|
3836
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ z(Ie, { children: [
|
|
3837
3863
|
(() => {
|
|
3838
|
-
const
|
|
3839
|
-
return q.map((
|
|
3864
|
+
const P = h.slice(0, A).filter((O) => R[O.name]), { groups: q } = dn(P);
|
|
3865
|
+
return q.map((O, Y) => O.name ? /* @__PURE__ */ p(
|
|
3840
3866
|
Kr,
|
|
3841
3867
|
{
|
|
3842
|
-
groupName:
|
|
3868
|
+
groupName: O.name,
|
|
3843
3869
|
defaultOpen: !0,
|
|
3844
|
-
fields:
|
|
3845
|
-
valuesMap:
|
|
3870
|
+
fields: O.fields,
|
|
3871
|
+
valuesMap: F,
|
|
3846
3872
|
handleChange: Be,
|
|
3847
3873
|
handleError: He,
|
|
3848
3874
|
errorsMap: v,
|
|
3849
3875
|
t: d
|
|
3850
3876
|
},
|
|
3851
|
-
|
|
3852
|
-
) : /* @__PURE__ */ p(l.Fragment, { children:
|
|
3877
|
+
O.name
|
|
3878
|
+
) : /* @__PURE__ */ p(l.Fragment, { children: O.fields.map((G) => /* @__PURE__ */ p(
|
|
3853
3879
|
ze,
|
|
3854
3880
|
{
|
|
3855
3881
|
field: G,
|
|
3856
|
-
valuesMap:
|
|
3882
|
+
valuesMap: F,
|
|
3857
3883
|
handleChange: Be,
|
|
3858
3884
|
handleError: He,
|
|
3859
3885
|
errorsMap: v
|
|
3860
3886
|
},
|
|
3861
3887
|
G.name
|
|
3862
|
-
)) }, `ungrouped-${
|
|
3888
|
+
)) }, `ungrouped-${Y}`));
|
|
3863
3889
|
})(),
|
|
3864
3890
|
A < h.length && /* @__PURE__ */ p(
|
|
3865
3891
|
"div",
|
|
@@ -3872,9 +3898,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3872
3898
|
}
|
|
3873
3899
|
)
|
|
3874
3900
|
] }),
|
|
3875
|
-
/* @__PURE__ */ p(
|
|
3901
|
+
/* @__PURE__ */ p(hn, { onClick: ot, disabled: at, t: d })
|
|
3876
3902
|
] }) });
|
|
3877
|
-
},
|
|
3903
|
+
}, Zr = {
|
|
3878
3904
|
en: { name: "English", nativeName: "English" },
|
|
3879
3905
|
fr: { name: "French", nativeName: "Français" },
|
|
3880
3906
|
de: { name: "German", nativeName: "Deutsch" },
|
|
@@ -3905,15 +3931,15 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3905
3931
|
uk: { name: "Ukrainian", nativeName: "Українська" },
|
|
3906
3932
|
vi: { name: "Vietnamese", nativeName: "Tiếng Việt" },
|
|
3907
3933
|
"zh-tw": { name: "Chinese (Traditional)", nativeName: "繁體中文" }
|
|
3908
|
-
},
|
|
3934
|
+
}, yo = () => Zr, be = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set(), we = /* @__PURE__ */ new Map(), yn = async (e) => {
|
|
3909
3935
|
try {
|
|
3910
3936
|
let r = {};
|
|
3911
3937
|
const t = e.toLowerCase();
|
|
3912
3938
|
if (t === "en")
|
|
3913
3939
|
r = {};
|
|
3914
|
-
else if (
|
|
3915
|
-
const
|
|
3916
|
-
|
|
3940
|
+
else if (Zr[t]) {
|
|
3941
|
+
const o = `https://reactaform.com/locales/${t}/common.json`, a = await fetch(o);
|
|
3942
|
+
a.ok && (r = await a.json());
|
|
3917
3943
|
} else
|
|
3918
3944
|
r = {};
|
|
3919
3945
|
return {
|
|
@@ -3928,7 +3954,7 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3928
3954
|
error: `Failed to load common translations for ${e}: ${r}`
|
|
3929
3955
|
};
|
|
3930
3956
|
}
|
|
3931
|
-
},
|
|
3957
|
+
}, vn = async (e) => {
|
|
3932
3958
|
if (!e || e.toLowerCase() === "en")
|
|
3933
3959
|
return { success: !0, translations: {}, fromCache: !1 };
|
|
3934
3960
|
const r = e.toLowerCase();
|
|
@@ -3938,13 +3964,13 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3938
3964
|
translations: be.get(r) || {},
|
|
3939
3965
|
fromCache: !0
|
|
3940
3966
|
};
|
|
3941
|
-
const t = await
|
|
3967
|
+
const t = await yn(r);
|
|
3942
3968
|
return t.success && (be.set(r, t.translations), we.set(r, {
|
|
3943
3969
|
loadedAt: /* @__PURE__ */ new Date(),
|
|
3944
3970
|
size: Object.keys(t.translations).length,
|
|
3945
3971
|
source: "common"
|
|
3946
3972
|
})), t;
|
|
3947
|
-
},
|
|
3973
|
+
}, xn = async (e, r) => {
|
|
3948
3974
|
if (!e || !r)
|
|
3949
3975
|
return {
|
|
3950
3976
|
success: !1,
|
|
@@ -3968,9 +3994,9 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3968
3994
|
try {
|
|
3969
3995
|
let n = r;
|
|
3970
3996
|
!r.includes("/") && !r.includes(".") && (n = `/locales/${e}/${r}.json`);
|
|
3971
|
-
const
|
|
3972
|
-
if (!
|
|
3973
|
-
return
|
|
3997
|
+
const o = await fetch(n);
|
|
3998
|
+
if (!o.ok)
|
|
3999
|
+
return o.status === 404 ? (le.set(t, {}), we.set(t, {
|
|
3974
4000
|
loadedAt: /* @__PURE__ */ new Date(),
|
|
3975
4001
|
size: 0,
|
|
3976
4002
|
source: "user"
|
|
@@ -3981,14 +4007,14 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3981
4007
|
}) : (te.add(t), {
|
|
3982
4008
|
success: !1,
|
|
3983
4009
|
translations: {},
|
|
3984
|
-
error: `HTTP ${
|
|
4010
|
+
error: `HTTP ${o.status}`,
|
|
3985
4011
|
fromCache: !1
|
|
3986
4012
|
});
|
|
3987
|
-
const
|
|
3988
|
-
!
|
|
3989
|
-
`Translation file at ${n} has unexpected content-type: ${
|
|
4013
|
+
const a = o.headers.get("content-type") || "";
|
|
4014
|
+
!a.includes("application/json") && !a.includes("text/json") && Qr() && console.warn(
|
|
4015
|
+
`Translation file at ${n} has unexpected content-type: ${a}`
|
|
3990
4016
|
);
|
|
3991
|
-
const c = await
|
|
4017
|
+
const c = await o.text();
|
|
3992
4018
|
if (!c) {
|
|
3993
4019
|
const d = "Empty translation file";
|
|
3994
4020
|
return te.add(t), { success: !1, translations: {}, error: d };
|
|
@@ -4024,15 +4050,15 @@ const gn = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
4024
4050
|
fromCache: !1
|
|
4025
4051
|
};
|
|
4026
4052
|
} catch (n) {
|
|
4027
|
-
const
|
|
4053
|
+
const o = `Failed to load user translations: ${n instanceof Error ? n.message : "Unknown error"}`;
|
|
4028
4054
|
return te.add(t), {
|
|
4029
4055
|
success: !1,
|
|
4030
4056
|
translations: {},
|
|
4031
|
-
error:
|
|
4057
|
+
error: o
|
|
4032
4058
|
};
|
|
4033
4059
|
}
|
|
4034
4060
|
};
|
|
4035
|
-
function
|
|
4061
|
+
function Qr() {
|
|
4036
4062
|
try {
|
|
4037
4063
|
if (typeof process < "u" && process?.env?.NODE_ENV === "development")
|
|
4038
4064
|
return !0;
|
|
@@ -4040,72 +4066,72 @@ function Zr() {
|
|
|
4040
4066
|
}
|
|
4041
4067
|
return !1;
|
|
4042
4068
|
}
|
|
4043
|
-
function
|
|
4069
|
+
function wn(e, r) {
|
|
4044
4070
|
return r.length === 0 ? e : e.replace(/\{\{(\d+)\}\}/g, (t, n) => {
|
|
4045
|
-
const
|
|
4046
|
-
return
|
|
4071
|
+
const o = parseInt(n, 10) - 1, a = r[o];
|
|
4072
|
+
return a == null ? t : String(a);
|
|
4047
4073
|
});
|
|
4048
4074
|
}
|
|
4049
|
-
const
|
|
4050
|
-
let
|
|
4051
|
-
return !n || typeof n != "string" ? String(n || "") : (e.toLowerCase() === "en" ? (
|
|
4075
|
+
const Sn = (e, r, t) => (n, ...o) => {
|
|
4076
|
+
let a = n, c = !1;
|
|
4077
|
+
return !n || typeof n != "string" ? String(n || "") : (e.toLowerCase() === "en" ? (a = n, c = !0) : n in t ? (a = t[n], c = !0) : n in r ? (a = r[n], c = !0) : a = n, a = wn(a, o), !c && Qr() && console.debug(
|
|
4052
4078
|
`Missing translation for "${n}" in language "${e}"`
|
|
4053
|
-
),
|
|
4079
|
+
), a);
|
|
4054
4080
|
};
|
|
4055
|
-
function
|
|
4081
|
+
function Cn(e) {
|
|
4056
4082
|
return /^[-+]?\d*$/.test(e);
|
|
4057
4083
|
}
|
|
4058
|
-
function
|
|
4084
|
+
function Nn(e) {
|
|
4059
4085
|
const r = /^[-+]?\d*$/;
|
|
4060
4086
|
return e.split(",").map((t) => t.trim()).every((t) => r.test(t));
|
|
4061
4087
|
}
|
|
4062
|
-
const
|
|
4088
|
+
const kn = ",", In = (e) => !e || e.trim() === "" ? [] : e.split(kn).map((r) => r.trim()).filter(Boolean).map((r) => Number(r)), Xe = (e, r, t) => {
|
|
4063
4089
|
const n = String(r);
|
|
4064
4090
|
if (n.trim() === "")
|
|
4065
4091
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4066
|
-
if (!
|
|
4092
|
+
if (!Cn(n))
|
|
4067
4093
|
return t("Must be a valid integer");
|
|
4068
|
-
const
|
|
4069
|
-
if (Number.isNaN(
|
|
4070
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
4094
|
+
const o = parseInt(n, 10);
|
|
4095
|
+
if (Number.isNaN(o)) return t("Must be a valid integer");
|
|
4096
|
+
if (e.min !== void 0 && (e.minInclusive ? o < e.min : o <= e.min))
|
|
4071
4097
|
return t(
|
|
4072
4098
|
"Must be {{1}} {{2}}",
|
|
4073
4099
|
e.minInclusive ? "≥" : ">",
|
|
4074
4100
|
e.min
|
|
4075
4101
|
);
|
|
4076
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
4102
|
+
if (e.max !== void 0 && (e.maxInclusive ? o > e.max : o >= e.max))
|
|
4077
4103
|
return t(
|
|
4078
4104
|
"Must be {{1}} {{2}}",
|
|
4079
4105
|
e.maxInclusive ? "≤" : "<",
|
|
4080
4106
|
e.max
|
|
4081
4107
|
);
|
|
4082
4108
|
if (e.step !== void 0) {
|
|
4083
|
-
const
|
|
4084
|
-
if (!Number.isInteger(
|
|
4109
|
+
const a = Number(e.step);
|
|
4110
|
+
if (!Number.isInteger(a))
|
|
4085
4111
|
return t("Invalid step value");
|
|
4086
|
-
if (
|
|
4087
|
-
return t("Must be a multiple of {{1}}",
|
|
4112
|
+
if (o % a !== 0)
|
|
4113
|
+
return t("Must be a multiple of {{1}}", a);
|
|
4088
4114
|
}
|
|
4089
4115
|
};
|
|
4090
|
-
function
|
|
4116
|
+
function En(e, r, t) {
|
|
4091
4117
|
const n = String(r);
|
|
4092
4118
|
if (n.trim() === "")
|
|
4093
4119
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4094
|
-
if (!
|
|
4120
|
+
if (!Nn(n))
|
|
4095
4121
|
return t("Each value must be a valid integer");
|
|
4096
|
-
const
|
|
4097
|
-
if (e.minCount !== void 0 &&
|
|
4122
|
+
const o = In(n);
|
|
4123
|
+
if (e.minCount !== void 0 && o.length < e.minCount)
|
|
4098
4124
|
return t("Minimum number of values: {{1}}", `${e.minCount}`);
|
|
4099
|
-
if (e.maxCount !== void 0 &&
|
|
4125
|
+
if (e.maxCount !== void 0 && o.length > e.maxCount)
|
|
4100
4126
|
return t("Maximum number of values: {{1}}", `${e.maxCount}`);
|
|
4101
|
-
for (const
|
|
4102
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
4127
|
+
for (const a of o) {
|
|
4128
|
+
if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
|
|
4103
4129
|
return t(
|
|
4104
4130
|
"Each value must be {{1}} {{2}}",
|
|
4105
4131
|
e.minInclusive ? "≥" : ">",
|
|
4106
4132
|
e.min
|
|
4107
4133
|
);
|
|
4108
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
4134
|
+
if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
|
|
4109
4135
|
return t(
|
|
4110
4136
|
"Each value must be {{1}} {{2}}",
|
|
4111
4137
|
e.maxInclusive ? "≤" : "<",
|
|
@@ -4113,55 +4139,55 @@ function In(e, r, t) {
|
|
|
4113
4139
|
);
|
|
4114
4140
|
}
|
|
4115
4141
|
}
|
|
4116
|
-
function
|
|
4142
|
+
function et(e, r, t) {
|
|
4117
4143
|
const n = String(r);
|
|
4118
4144
|
if (n.trim() === "")
|
|
4119
4145
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4120
|
-
const
|
|
4121
|
-
if (Number.isNaN(
|
|
4146
|
+
const o = Number(n);
|
|
4147
|
+
if (Number.isNaN(o)) return t("Must be a valid float");
|
|
4122
4148
|
if (e.min !== void 0) {
|
|
4123
|
-
const
|
|
4124
|
-
if (
|
|
4149
|
+
const a = e.type === "slider" ? !0 : e.minInclusive ?? !0;
|
|
4150
|
+
if (a ? o < e.min : o <= e.min)
|
|
4125
4151
|
return t(
|
|
4126
4152
|
"Must be {{1}} {{2}}",
|
|
4127
|
-
|
|
4153
|
+
a ? "≥" : ">",
|
|
4128
4154
|
e.min
|
|
4129
4155
|
);
|
|
4130
4156
|
}
|
|
4131
4157
|
if (e.max !== void 0) {
|
|
4132
|
-
const
|
|
4133
|
-
if (
|
|
4158
|
+
const a = e.type === "slider" ? !0 : e.maxInclusive ?? !0;
|
|
4159
|
+
if (a ? o > e.max : o >= e.max)
|
|
4134
4160
|
return t(
|
|
4135
4161
|
"Must be {{1}} {{2}}",
|
|
4136
|
-
|
|
4162
|
+
a ? "≤" : "<",
|
|
4137
4163
|
e.max
|
|
4138
4164
|
);
|
|
4139
4165
|
}
|
|
4140
4166
|
}
|
|
4141
|
-
const
|
|
4167
|
+
const Fn = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
4142
4168
|
function Mn(e) {
|
|
4143
|
-
return e.split(",").map((r) => r.trim()).every((r) =>
|
|
4169
|
+
return e.split(",").map((r) => r.trim()).every((r) => Fn.test(r));
|
|
4144
4170
|
}
|
|
4145
|
-
const
|
|
4146
|
-
function
|
|
4171
|
+
const Vn = ",", $n = (e) => !e || e.trim() === "" ? [] : e.split(Vn).map((r) => r.trim()).filter(Boolean).map((r) => Number(r));
|
|
4172
|
+
function An(e, r, t) {
|
|
4147
4173
|
const n = String(r);
|
|
4148
4174
|
if (n.trim() === "")
|
|
4149
4175
|
return e.min !== void 0 || e.max !== void 0 ? t("Value required when min or max constraints is set") : e.required ? t("Value required") : void 0;
|
|
4150
4176
|
if (!Mn(n))
|
|
4151
4177
|
return t("Each value must be a valid float");
|
|
4152
|
-
const
|
|
4153
|
-
if (e.minCount !== void 0 &&
|
|
4178
|
+
const o = $n(n);
|
|
4179
|
+
if (e.minCount !== void 0 && o.length < e.minCount)
|
|
4154
4180
|
return t("Minimum number of values: {{1}}", e.minCount);
|
|
4155
|
-
if (e.maxCount !== void 0 &&
|
|
4181
|
+
if (e.maxCount !== void 0 && o.length > e.maxCount)
|
|
4156
4182
|
return t("Maximum number of values: {{1}}", e.maxCount);
|
|
4157
|
-
for (const
|
|
4158
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
4183
|
+
for (const a of o) {
|
|
4184
|
+
if (e.min !== void 0 && (e.minInclusive ? a < e.min : a <= e.min))
|
|
4159
4185
|
return t(
|
|
4160
4186
|
"Each value must be {{1}} {{2}}",
|
|
4161
4187
|
e.minInclusive ? "≥" : ">",
|
|
4162
4188
|
e.min
|
|
4163
4189
|
);
|
|
4164
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
4190
|
+
if (e.max !== void 0 && (e.maxInclusive ? a > e.max : a >= e.max))
|
|
4165
4191
|
return t(
|
|
4166
4192
|
"Each value must be {{1}} {{2}}",
|
|
4167
4193
|
e.maxInclusive ? "≤" : "<",
|
|
@@ -4170,10 +4196,10 @@ function Vn(e, r, t) {
|
|
|
4170
4196
|
}
|
|
4171
4197
|
}
|
|
4172
4198
|
const ye = /* @__PURE__ */ new WeakMap();
|
|
4173
|
-
function
|
|
4199
|
+
function Le(e, r, t, n, ...o) {
|
|
4174
4200
|
if (e.pattern == null)
|
|
4175
4201
|
return;
|
|
4176
|
-
const
|
|
4202
|
+
const a = String(r);
|
|
4177
4203
|
let c = null;
|
|
4178
4204
|
if (e.pattern) {
|
|
4179
4205
|
const s = ye.get(e);
|
|
@@ -4187,44 +4213,44 @@ function Oe(e, r, t, n, ...a) {
|
|
|
4187
4213
|
ye.set(e, { pattern: e.pattern, regex: null }), c = null;
|
|
4188
4214
|
}
|
|
4189
4215
|
}
|
|
4190
|
-
if (c && !c.test(
|
|
4191
|
-
return e.patternErrorMessage ? t(e.patternErrorMessage) : n ? t(n, ...
|
|
4216
|
+
if (c && !c.test(a))
|
|
4217
|
+
return e.patternErrorMessage ? t(e.patternErrorMessage) : n ? t(n, ...o) : t("Input does not match pattern: {{1}}", e.pattern);
|
|
4192
4218
|
}
|
|
4193
4219
|
function ue(e, r, t) {
|
|
4194
4220
|
const n = String(r);
|
|
4195
4221
|
if (n === "")
|
|
4196
4222
|
return e.minLength !== void 0 || e.maxLength !== void 0 ? e.required ? t("Value required when minLength or maxLength is set") : void 0 : e.required ? t("Value required") : void 0;
|
|
4197
|
-
const
|
|
4198
|
-
return n.length <
|
|
4223
|
+
const o = Math.max(e.minLength ?? 0, 0);
|
|
4224
|
+
return n.length < o ? t("Must be at least {{1}} characters", o) : e.maxLength !== void 0 && n.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : Le(e, r, t, "Invalid text format");
|
|
4199
4225
|
}
|
|
4200
4226
|
const Se = (e) => {
|
|
4201
4227
|
if (!e) return null;
|
|
4202
4228
|
const r = Date.parse(e);
|
|
4203
4229
|
return Number.isNaN(r) ? null : r;
|
|
4204
|
-
}, Ze = /* @__PURE__ */ new WeakMap(),
|
|
4230
|
+
}, Ze = /* @__PURE__ */ new WeakMap(), Rn = (e) => {
|
|
4205
4231
|
let r = Ze.get(e);
|
|
4206
4232
|
return r || (r = {
|
|
4207
4233
|
minTime: Se(e.minDate),
|
|
4208
4234
|
maxTime: Se(e.maxDate)
|
|
4209
4235
|
}, Ze.set(e, r)), r;
|
|
4210
4236
|
};
|
|
4211
|
-
function
|
|
4237
|
+
function Dn(e, r, t) {
|
|
4212
4238
|
if (r == null || String(r).trim() === "")
|
|
4213
4239
|
return e.required ? t("Value required") : void 0;
|
|
4214
|
-
const n = String(r).trim(),
|
|
4215
|
-
if (
|
|
4240
|
+
const n = String(r).trim(), o = Se(n);
|
|
4241
|
+
if (o === null)
|
|
4216
4242
|
return t("Invalid date format");
|
|
4217
|
-
const { minTime:
|
|
4218
|
-
if (
|
|
4243
|
+
const { minTime: a, maxTime: c } = Rn(e);
|
|
4244
|
+
if (a !== null && o < a)
|
|
4219
4245
|
return t("Date must be on or after {{1}}", e.minDate);
|
|
4220
|
-
if (c !== null &&
|
|
4246
|
+
if (c !== null && o > c)
|
|
4221
4247
|
return t("Date must be on or before {{1}}", e.maxDate);
|
|
4222
4248
|
}
|
|
4223
|
-
function
|
|
4249
|
+
function zn(e, r, t) {
|
|
4224
4250
|
const n = String(r);
|
|
4225
4251
|
if (!n || n.trim() === "")
|
|
4226
4252
|
return e.required || e.min || e.max ? t("Value required") : void 0;
|
|
4227
|
-
const
|
|
4253
|
+
const o = (c) => {
|
|
4228
4254
|
const s = c.split(":").map((m) => parseInt(m, 10));
|
|
4229
4255
|
if (s.some((m) => Number.isNaN(m))) return NaN;
|
|
4230
4256
|
const i = s.length;
|
|
@@ -4241,42 +4267,42 @@ function Dn(e, r, t) {
|
|
|
4241
4267
|
else
|
|
4242
4268
|
return NaN;
|
|
4243
4269
|
return d;
|
|
4244
|
-
},
|
|
4245
|
-
if (Number.isNaN(
|
|
4270
|
+
}, a = o(n);
|
|
4271
|
+
if (Number.isNaN(a)) return t("Invalid time format");
|
|
4246
4272
|
if (e.min && typeof e.min == "string") {
|
|
4247
|
-
const c =
|
|
4248
|
-
if (!Number.isNaN(c) &&
|
|
4273
|
+
const c = o(e.min);
|
|
4274
|
+
if (!Number.isNaN(c) && a < c)
|
|
4249
4275
|
return t("Time must be on or after {{1}}", e.min);
|
|
4250
4276
|
}
|
|
4251
4277
|
if (e.max && typeof e.max == "string") {
|
|
4252
|
-
const c =
|
|
4253
|
-
if (!Number.isNaN(c) &&
|
|
4278
|
+
const c = o(e.max);
|
|
4279
|
+
if (!Number.isNaN(c) && a > c)
|
|
4254
4280
|
return t("Time must be on or before {{1}}", e.max);
|
|
4255
4281
|
}
|
|
4256
4282
|
}
|
|
4257
|
-
function
|
|
4283
|
+
function Pn(e) {
|
|
4258
4284
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
4259
4285
|
}
|
|
4260
|
-
function
|
|
4286
|
+
function On(e, r, t) {
|
|
4261
4287
|
const n = String(r ?? "").trim();
|
|
4262
|
-
return n === "" ? e.required ? t("Value required") : void 0 :
|
|
4288
|
+
return n === "" ? e.required ? t("Value required") : void 0 : Pn(n) ? Le(e, r, t, t("Email does not match pattern: {{1}}", e.pattern)) : t("Must be valid email format");
|
|
4263
4289
|
}
|
|
4264
4290
|
function Ln(e, r, t) {
|
|
4265
4291
|
const n = String(r ?? "").trim();
|
|
4266
|
-
return n === "" ? e.required ? t("Value required") : void 0 :
|
|
4292
|
+
return n === "" ? e.required ? t("Value required") : void 0 : Le(e, n, t, "Invalid phone number format");
|
|
4267
4293
|
}
|
|
4268
|
-
const
|
|
4294
|
+
const Tn = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]$/i, jn = (e) => {
|
|
4269
4295
|
try {
|
|
4270
4296
|
return new URL(e), !0;
|
|
4271
4297
|
} catch {
|
|
4272
4298
|
return !1;
|
|
4273
4299
|
}
|
|
4274
4300
|
};
|
|
4275
|
-
function
|
|
4301
|
+
function Bn(e, r, t) {
|
|
4276
4302
|
const n = String(r ?? "").trim();
|
|
4277
4303
|
if (n === "")
|
|
4278
4304
|
return e.required ? t("Value required") : void 0;
|
|
4279
|
-
if (!(
|
|
4305
|
+
if (!(Tn.test(n) || jn(n))) {
|
|
4280
4306
|
if (e.allowRelative === !0) {
|
|
4281
4307
|
if (!n.startsWith("/") || encodeURI(n) !== n)
|
|
4282
4308
|
return t("Must be a valid URL");
|
|
@@ -4290,11 +4316,11 @@ function jn(e, r, t) {
|
|
|
4290
4316
|
return t("Must be a valid URL");
|
|
4291
4317
|
}
|
|
4292
4318
|
}
|
|
4293
|
-
function Bn(e, r, t) {
|
|
4294
|
-
const n = Array.isArray(r) ? r : [], a = n[0], o = n[1] ? String(n[1]).trim() : "";
|
|
4295
|
-
return String(a ?? "").trim() === "" || o === "" ? e.required ? t("Value required") : void 0 : Qr(e, a, t);
|
|
4296
|
-
}
|
|
4297
4319
|
function Hn(e, r, t) {
|
|
4320
|
+
const n = Array.isArray(r) ? r : [], o = n[0], a = n[1] ? String(n[1]).trim() : "";
|
|
4321
|
+
return String(o ?? "").trim() === "" || a === "" ? e.required ? t("Value required") : void 0 : et(e, o, t);
|
|
4322
|
+
}
|
|
4323
|
+
function qn(e, r, t) {
|
|
4298
4324
|
if (Array.isArray(r))
|
|
4299
4325
|
return r.length === 0 ? t("Select a file") : r.every((n) => n instanceof File) ? void 0 : t("Invalid file input");
|
|
4300
4326
|
if (!(r instanceof File)) {
|
|
@@ -4302,62 +4328,62 @@ function Hn(e, r, t) {
|
|
|
4302
4328
|
return e.required && (r == null || typeof n == "string" && n.trim() === "") ? t("Select a file") : t("Invalid file input: {{1}}", n);
|
|
4303
4329
|
}
|
|
4304
4330
|
}
|
|
4305
|
-
function
|
|
4331
|
+
function Un(e, r, t) {
|
|
4306
4332
|
const n = String(r);
|
|
4307
4333
|
if (n === "" || n === null || n === void 0)
|
|
4308
4334
|
return e.required ? t("Value required") : void 0;
|
|
4309
|
-
if (!e.options?.some((
|
|
4335
|
+
if (!e.options?.some((o) => String(o.value) === n))
|
|
4310
4336
|
return t("Invalid option selected");
|
|
4311
4337
|
}
|
|
4312
|
-
function
|
|
4313
|
-
const
|
|
4314
|
-
if (
|
|
4338
|
+
function Wn(e, r, t) {
|
|
4339
|
+
const o = String(r ?? "").trim();
|
|
4340
|
+
if (o === "")
|
|
4315
4341
|
return e.required ? t("Value required") : void 0;
|
|
4316
|
-
const
|
|
4317
|
-
if (
|
|
4342
|
+
const a = o.split(",").map((c) => c.trim()).filter((c) => c !== "");
|
|
4343
|
+
if (a.length === 0)
|
|
4318
4344
|
return e.required ? t("Value required") : void 0;
|
|
4319
|
-
for (const c of
|
|
4345
|
+
for (const c of a)
|
|
4320
4346
|
if (!e.options?.some((s) => String(s.value) === c))
|
|
4321
4347
|
return t("Invalid option selected");
|
|
4322
4348
|
}
|
|
4323
|
-
const
|
|
4324
|
-
function
|
|
4349
|
+
const _n = /^#([0-9A-F]{3}){1,2}$/i, Kn = (e) => _n.test(e);
|
|
4350
|
+
function Gn(e, r, t) {
|
|
4325
4351
|
const n = String(r).trim();
|
|
4326
4352
|
if (n === "")
|
|
4327
4353
|
return e.required ? t("Value required") : void 0;
|
|
4328
|
-
if (!
|
|
4354
|
+
if (!Kn(n))
|
|
4329
4355
|
return t("Invalid color format");
|
|
4330
4356
|
}
|
|
4331
|
-
function
|
|
4357
|
+
function Jn(e, r, t) {
|
|
4332
4358
|
const n = String(r ?? "").trim();
|
|
4333
4359
|
if (n === "")
|
|
4334
4360
|
return e.required ? t("Value required") : void 0;
|
|
4335
|
-
let
|
|
4336
|
-
if (typeof r != "number" && (
|
|
4361
|
+
let o = r;
|
|
4362
|
+
if (typeof r != "number" && (o = parseFloat(n)), Number.isNaN(o) || o <= 0)
|
|
4337
4363
|
return t("Invalid value");
|
|
4338
|
-
if (e.max !== void 0 &&
|
|
4364
|
+
if (e.max !== void 0 && o > e.max)
|
|
4339
4365
|
return t("Must be ≤ {{1}}", e.max);
|
|
4340
4366
|
}
|
|
4341
|
-
function
|
|
4367
|
+
function Yn(e, r, t) {
|
|
4342
4368
|
const n = String(r);
|
|
4343
4369
|
if (n.trim() === "")
|
|
4344
4370
|
return e.required ? t("Value required") : void 0;
|
|
4345
|
-
const
|
|
4346
|
-
if (Number.isNaN(
|
|
4347
|
-
const
|
|
4348
|
-
if (
|
|
4349
|
-
return t("Must be ≥ {{1}}",
|
|
4350
|
-
if (
|
|
4371
|
+
const o = Number(n);
|
|
4372
|
+
if (Number.isNaN(o)) return t("Must be a valid float");
|
|
4373
|
+
const a = e.min ?? 0, c = e.max ?? 100;
|
|
4374
|
+
if (o < a)
|
|
4375
|
+
return t("Must be ≥ {{1}}", a);
|
|
4376
|
+
if (o > c)
|
|
4351
4377
|
return t("Must be ≤ {{1}}", c);
|
|
4352
4378
|
}
|
|
4353
4379
|
let Qe = !1;
|
|
4354
|
-
function
|
|
4355
|
-
Qe || (H("int", Xe), H("stepper", Xe), H("int-array",
|
|
4380
|
+
function rt() {
|
|
4381
|
+
Qe || (H("int", Xe), H("stepper", Xe), H("int-array", En), H("float", et), H("slider", Yn), H("float-array", An), H("text", ue), H("string", ue), H("multiline", ue), H("password", ue), H("email", On), H("date", Dn), H("time", zn), H("url", Bn), H("phone", Ln), H("unit", Hn), H("dropdown", Un), H("multi-selection", Wn), H("color", Gn), H("rating", Jn), H("file", qn), Qe = !0);
|
|
4356
4382
|
}
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
const
|
|
4383
|
+
rt();
|
|
4384
|
+
cn();
|
|
4385
|
+
rt();
|
|
4386
|
+
const Xn = (e) => ({
|
|
4361
4387
|
container: {
|
|
4362
4388
|
padding: "var(--reactaform-space-sm, 8px)",
|
|
4363
4389
|
margin: "0 auto",
|
|
@@ -4398,7 +4424,7 @@ const Yn = (e) => ({
|
|
|
4398
4424
|
lineHeight: "1.2",
|
|
4399
4425
|
textAlign: "left"
|
|
4400
4426
|
}
|
|
4401
|
-
}),
|
|
4427
|
+
}), Zn = (e) => {
|
|
4402
4428
|
const r = {
|
|
4403
4429
|
color: "var(--reactaform-color-text)",
|
|
4404
4430
|
fontFamily: e?.fontFamily || "var(--reactaform-font-family, inherit)",
|
|
@@ -4457,18 +4483,18 @@ const Yn = (e) => ({
|
|
|
4457
4483
|
display: "block"
|
|
4458
4484
|
}
|
|
4459
4485
|
};
|
|
4460
|
-
},
|
|
4486
|
+
}, Qn = ({
|
|
4461
4487
|
children: e,
|
|
4462
4488
|
definitionName: r = "",
|
|
4463
4489
|
defaultStyle: t,
|
|
4464
4490
|
defaultLanguage: n = "en",
|
|
4465
|
-
defaultTheme:
|
|
4466
|
-
defaultLocalizeName:
|
|
4467
|
-
defaultFieldValidationMode: c = "
|
|
4491
|
+
defaultTheme: o = "light",
|
|
4492
|
+
defaultLocalizeName: a = "",
|
|
4493
|
+
defaultFieldValidationMode: c = "onEdit",
|
|
4468
4494
|
className: s = "reactaform-container",
|
|
4469
4495
|
defaultDisplayInstanceName: i = !0
|
|
4470
4496
|
}) => {
|
|
4471
|
-
const d = r, m =
|
|
4497
|
+
const d = r, m = a, u = o, f = n, b = l.useMemo(
|
|
4472
4498
|
() => t ?? {},
|
|
4473
4499
|
[t]
|
|
4474
4500
|
), [C, N] = l.useState({}), [h, y] = l.useState({});
|
|
@@ -4480,9 +4506,9 @@ const Yn = (e) => ({
|
|
|
4480
4506
|
return;
|
|
4481
4507
|
}
|
|
4482
4508
|
try {
|
|
4483
|
-
const w = await
|
|
4509
|
+
const w = await vn(f), x = w.success ? w.translations : {};
|
|
4484
4510
|
v && N(x);
|
|
4485
|
-
const k = await
|
|
4511
|
+
const k = await xn(f, m), S = k.success ? k.translations : {};
|
|
4486
4512
|
v && y(S);
|
|
4487
4513
|
} catch {
|
|
4488
4514
|
v && (N({}), y({}));
|
|
@@ -4491,20 +4517,20 @@ const Yn = (e) => ({
|
|
|
4491
4517
|
v = !1;
|
|
4492
4518
|
};
|
|
4493
4519
|
}, [f, m]);
|
|
4494
|
-
const E = l.useMemo(() =>
|
|
4495
|
-
() =>
|
|
4520
|
+
const E = l.useMemo(() => Xn(b), [b]), M = l.useMemo(() => Zn(b), [b]), F = l.useMemo(
|
|
4521
|
+
() => Sn(f, C, h),
|
|
4496
4522
|
[f, C, h]
|
|
4497
|
-
),
|
|
4498
|
-
(v, ...g) =>
|
|
4499
|
-
[
|
|
4523
|
+
), V = l.useCallback(
|
|
4524
|
+
(v, ...g) => F(v, ...g),
|
|
4525
|
+
[F]
|
|
4500
4526
|
), R = l.useMemo(
|
|
4501
4527
|
() => ({
|
|
4502
4528
|
definitionName: d,
|
|
4503
4529
|
language: f,
|
|
4504
4530
|
theme: u,
|
|
4505
4531
|
formStyle: E,
|
|
4506
|
-
fieldStyle:
|
|
4507
|
-
t:
|
|
4532
|
+
fieldStyle: M,
|
|
4533
|
+
t: V,
|
|
4508
4534
|
fieldValidationMode: c,
|
|
4509
4535
|
displayInstanceName: i
|
|
4510
4536
|
}),
|
|
@@ -4512,9 +4538,9 @@ const Yn = (e) => ({
|
|
|
4512
4538
|
d,
|
|
4513
4539
|
f,
|
|
4514
4540
|
u,
|
|
4515
|
-
|
|
4541
|
+
M,
|
|
4516
4542
|
E,
|
|
4517
|
-
|
|
4543
|
+
V,
|
|
4518
4544
|
c,
|
|
4519
4545
|
i
|
|
4520
4546
|
]
|
|
@@ -4529,7 +4555,7 @@ const Yn = (e) => ({
|
|
|
4529
4555
|
}
|
|
4530
4556
|
) });
|
|
4531
4557
|
};
|
|
4532
|
-
function
|
|
4558
|
+
function eo(e) {
|
|
4533
4559
|
if (!e || typeof e != "object")
|
|
4534
4560
|
return "Definition must be an object";
|
|
4535
4561
|
const r = e;
|
|
@@ -4557,7 +4583,7 @@ function Qn(e) {
|
|
|
4557
4583
|
}
|
|
4558
4584
|
return null;
|
|
4559
4585
|
}
|
|
4560
|
-
async function
|
|
4586
|
+
async function vo(e, r = {}) {
|
|
4561
4587
|
const { validateSchema: t = !0 } = r;
|
|
4562
4588
|
try {
|
|
4563
4589
|
if (!e || typeof e != "string")
|
|
@@ -4565,26 +4591,26 @@ async function ba(e, r = {}) {
|
|
|
4565
4591
|
const n = e.trim();
|
|
4566
4592
|
if (!n)
|
|
4567
4593
|
return { success: !1, error: "jsonData is empty" };
|
|
4568
|
-
let
|
|
4594
|
+
let o;
|
|
4569
4595
|
try {
|
|
4570
|
-
|
|
4571
|
-
} catch (
|
|
4596
|
+
o = JSON.parse(n);
|
|
4597
|
+
} catch (a) {
|
|
4572
4598
|
return {
|
|
4573
4599
|
success: !1,
|
|
4574
|
-
error: `Invalid JSON format: ${
|
|
4600
|
+
error: `Invalid JSON format: ${a instanceof Error ? a.message : "Unknown parsing error"}`
|
|
4575
4601
|
};
|
|
4576
4602
|
}
|
|
4577
4603
|
if (t) {
|
|
4578
|
-
const
|
|
4579
|
-
if (
|
|
4580
|
-
return { success: !1, error: `Schema validation failed: ${
|
|
4604
|
+
const a = eo(o);
|
|
4605
|
+
if (a)
|
|
4606
|
+
return { success: !1, error: `Schema validation failed: ${a}` };
|
|
4581
4607
|
}
|
|
4582
|
-
return { success: !0, definition:
|
|
4608
|
+
return { success: !0, definition: o };
|
|
4583
4609
|
} catch (n) {
|
|
4584
4610
|
return { success: !1, error: `Unexpected error loading definition: ${n instanceof Error ? n.message : "Unknown error"}` };
|
|
4585
4611
|
}
|
|
4586
4612
|
}
|
|
4587
|
-
function
|
|
4613
|
+
function ro(e, r) {
|
|
4588
4614
|
try {
|
|
4589
4615
|
if (!e)
|
|
4590
4616
|
return { success: !1, error: "Definition is required" };
|
|
@@ -4596,13 +4622,13 @@ function ea(e, r) {
|
|
|
4596
4622
|
version: e.version ?? "1.0.0",
|
|
4597
4623
|
values: {}
|
|
4598
4624
|
}, n = e.properties || [];
|
|
4599
|
-
return Array.isArray(n) && n.forEach((
|
|
4600
|
-
const
|
|
4601
|
-
if (
|
|
4602
|
-
const c =
|
|
4603
|
-
t.values[
|
|
4625
|
+
return Array.isArray(n) && n.forEach((o) => {
|
|
4626
|
+
const a = o;
|
|
4627
|
+
if (a.type === "unit") {
|
|
4628
|
+
const c = a.defaultUnit, s = Number(a.defaultValue) || void 0;
|
|
4629
|
+
t.values[a.name] = [s || 0, c || "m"];
|
|
4604
4630
|
} else
|
|
4605
|
-
|
|
4631
|
+
a.defaultValue !== void 0 && (t.values[a.name] = a.defaultValue);
|
|
4606
4632
|
}), { success: !0, instance: t };
|
|
4607
4633
|
} catch (t) {
|
|
4608
4634
|
return {
|
|
@@ -4611,7 +4637,7 @@ function ea(e, r) {
|
|
|
4611
4637
|
};
|
|
4612
4638
|
}
|
|
4613
4639
|
}
|
|
4614
|
-
function
|
|
4640
|
+
function xo(e) {
|
|
4615
4641
|
try {
|
|
4616
4642
|
if (!e)
|
|
4617
4643
|
return { success: !1, error: "Instance data is required" };
|
|
@@ -4635,7 +4661,7 @@ function ya(e) {
|
|
|
4635
4661
|
};
|
|
4636
4662
|
}
|
|
4637
4663
|
}
|
|
4638
|
-
function
|
|
4664
|
+
function wo(e, r, t) {
|
|
4639
4665
|
try {
|
|
4640
4666
|
if (!e)
|
|
4641
4667
|
return { success: !1, error: "Instance is required" };
|
|
@@ -4648,9 +4674,9 @@ function va(e, r, t) {
|
|
|
4648
4674
|
definition: r.name,
|
|
4649
4675
|
version: r.version,
|
|
4650
4676
|
values: {}
|
|
4651
|
-
},
|
|
4677
|
+
}, o = n.values, a = {};
|
|
4652
4678
|
(r.properties || []).forEach((i) => {
|
|
4653
|
-
|
|
4679
|
+
a[i.name] = i;
|
|
4654
4680
|
});
|
|
4655
4681
|
const c = (i, d, m) => {
|
|
4656
4682
|
if (i == null) return i;
|
|
@@ -4695,14 +4721,14 @@ function va(e, r, t) {
|
|
|
4695
4721
|
return i;
|
|
4696
4722
|
}, s = e.values || {};
|
|
4697
4723
|
Object.keys(s).forEach((i) => {
|
|
4698
|
-
const d = s[i], m =
|
|
4724
|
+
const d = s[i], m = a[i];
|
|
4699
4725
|
if (!m)
|
|
4700
4726
|
return;
|
|
4701
4727
|
const u = Array.isArray(d) ? "array" : d === null ? "null" : typeof d, f = (m.type || "").toLowerCase();
|
|
4702
|
-
u === f || f === "string" && typeof d == "string" ?
|
|
4728
|
+
u === f || f === "string" && typeof d == "string" ? o[i] = d : o[i] = c(d, f, m);
|
|
4703
4729
|
}), (r.properties || []).forEach((i) => {
|
|
4704
4730
|
const d = i.name;
|
|
4705
|
-
d in
|
|
4731
|
+
d in o || (o[d] = i.defaultValue);
|
|
4706
4732
|
});
|
|
4707
4733
|
try {
|
|
4708
4734
|
typeof t == "function" && t?.(e, n, r);
|
|
@@ -4717,30 +4743,30 @@ function va(e, r, t) {
|
|
|
4717
4743
|
};
|
|
4718
4744
|
}
|
|
4719
4745
|
}
|
|
4720
|
-
function
|
|
4746
|
+
function to(e) {
|
|
4721
4747
|
const [r, t] = l.useState(null);
|
|
4722
4748
|
return l.useEffect(() => {
|
|
4723
4749
|
const n = document.querySelector("[data-reactaform-theme]");
|
|
4724
4750
|
if (!n) return;
|
|
4725
|
-
const
|
|
4726
|
-
if (!
|
|
4727
|
-
const
|
|
4728
|
-
|
|
4751
|
+
const o = n.closest("[data-reactaform-theme]");
|
|
4752
|
+
if (!o) return;
|
|
4753
|
+
const a = () => t(o.getAttribute("data-reactaform-theme"));
|
|
4754
|
+
a();
|
|
4729
4755
|
const c = new MutationObserver((s) => {
|
|
4730
4756
|
for (const i of s)
|
|
4731
|
-
i.type === "attributes" && i.attributeName === "data-reactaform-theme" &&
|
|
4757
|
+
i.type === "attributes" && i.attributeName === "data-reactaform-theme" && a();
|
|
4732
4758
|
});
|
|
4733
|
-
return c.observe(
|
|
4759
|
+
return c.observe(o, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => c.disconnect();
|
|
4734
4760
|
}, [e]), r;
|
|
4735
4761
|
}
|
|
4736
|
-
const
|
|
4762
|
+
const So = ({
|
|
4737
4763
|
definitionData: e,
|
|
4738
4764
|
instance: r,
|
|
4739
4765
|
language: t,
|
|
4740
4766
|
className: n,
|
|
4741
|
-
theme:
|
|
4742
|
-
style:
|
|
4743
|
-
fieldValidationMode: c = "
|
|
4767
|
+
theme: o,
|
|
4768
|
+
style: a,
|
|
4769
|
+
fieldValidationMode: c = "onEdit",
|
|
4744
4770
|
displayInstanceName: s = !0,
|
|
4745
4771
|
onSubmit: i = void 0,
|
|
4746
4772
|
onValidation: d = void 0
|
|
@@ -4751,7 +4777,7 @@ const xa = ({
|
|
|
4751
4777
|
} catch {
|
|
4752
4778
|
return null;
|
|
4753
4779
|
}
|
|
4754
|
-
}, [e]), u = { fontSize: "inherit", fontFamily: "inherit", ...
|
|
4780
|
+
}, [e]), u = { fontSize: "inherit", fontFamily: "inherit", ...a }, f = to(), b = o ?? f ?? "light", C = t ?? "en";
|
|
4755
4781
|
l.useEffect(() => {
|
|
4756
4782
|
let h = document.getElementById("popup-root");
|
|
4757
4783
|
h || (h = document.createElement("div"), h.id = "popup-root", document.body.appendChild(h));
|
|
@@ -4759,11 +4785,11 @@ const xa = ({
|
|
|
4759
4785
|
const N = l.useMemo(() => {
|
|
4760
4786
|
if (r) return r;
|
|
4761
4787
|
if (!m) return null;
|
|
4762
|
-
const h =
|
|
4788
|
+
const h = ro(m, m.name);
|
|
4763
4789
|
return !h.success || !h.instance ? null : h.instance;
|
|
4764
4790
|
}, [r, m]);
|
|
4765
4791
|
return m ? N ? /* @__PURE__ */ p(
|
|
4766
|
-
|
|
4792
|
+
Qn,
|
|
4767
4793
|
{
|
|
4768
4794
|
definitionName: m.name,
|
|
4769
4795
|
defaultStyle: u,
|
|
@@ -4774,7 +4800,7 @@ const xa = ({
|
|
|
4774
4800
|
defaultFieldValidationMode: c,
|
|
4775
4801
|
defaultDisplayInstanceName: s,
|
|
4776
4802
|
children: /* @__PURE__ */ p(
|
|
4777
|
-
|
|
4803
|
+
bn,
|
|
4778
4804
|
{
|
|
4779
4805
|
definition: m,
|
|
4780
4806
|
instance: N,
|
|
@@ -4784,7 +4810,7 @@ const xa = ({
|
|
|
4784
4810
|
)
|
|
4785
4811
|
}
|
|
4786
4812
|
) : /* @__PURE__ */ p("div", { style: { color: "red" }, children: "Error: Failed to create instance from definition." }) : /* @__PURE__ */ p("div", { style: { color: "red" }, children: "Error: No form definition provided." });
|
|
4787
|
-
},
|
|
4813
|
+
}, Q = /* @__PURE__ */ new Map(), W = {
|
|
4788
4814
|
components: /* @__PURE__ */ new Map(),
|
|
4789
4815
|
fieldValidators: /* @__PURE__ */ new Map(),
|
|
4790
4816
|
// category -> name -> plugin
|
|
@@ -4792,7 +4818,7 @@ const xa = ({
|
|
|
4792
4818
|
formValidators: /* @__PURE__ */ new Map(),
|
|
4793
4819
|
submissionHandlers: /* @__PURE__ */ new Map()
|
|
4794
4820
|
};
|
|
4795
|
-
function
|
|
4821
|
+
function tt(e, r, t) {
|
|
4796
4822
|
if (!e) return !0;
|
|
4797
4823
|
if (t && !t(e))
|
|
4798
4824
|
return !1;
|
|
@@ -4813,73 +4839,73 @@ function rt(e, r, t) {
|
|
|
4813
4839
|
return !1;
|
|
4814
4840
|
}
|
|
4815
4841
|
}
|
|
4816
|
-
function
|
|
4842
|
+
function no(e) {
|
|
4817
4843
|
const r = [];
|
|
4818
4844
|
if (e.components)
|
|
4819
4845
|
for (const t of Object.keys(e.components)) {
|
|
4820
4846
|
const n = _r(t);
|
|
4821
4847
|
if (n) {
|
|
4822
|
-
let
|
|
4823
|
-
for (const [
|
|
4848
|
+
let o;
|
|
4849
|
+
for (const [a, c] of Q)
|
|
4824
4850
|
if (c.components && c.components[t] === n) {
|
|
4825
|
-
|
|
4851
|
+
o = a;
|
|
4826
4852
|
break;
|
|
4827
4853
|
}
|
|
4828
|
-
|
|
4854
|
+
o && o !== e.name && r.push({
|
|
4829
4855
|
type: "component",
|
|
4830
4856
|
name: t,
|
|
4831
|
-
existingPlugin:
|
|
4857
|
+
existingPlugin: o,
|
|
4832
4858
|
newPlugin: e.name
|
|
4833
4859
|
});
|
|
4834
4860
|
}
|
|
4835
4861
|
}
|
|
4836
4862
|
if (e.fieldCustomValidators)
|
|
4837
4863
|
for (const [t, n] of Object.entries(e.fieldCustomValidators))
|
|
4838
|
-
for (const
|
|
4839
|
-
const c = W.fieldValidators.get(t)?.get(
|
|
4840
|
-
ur(t,
|
|
4864
|
+
for (const o of Object.keys(n)) {
|
|
4865
|
+
const c = W.fieldValidators.get(t)?.get(o);
|
|
4866
|
+
ur(t, o) && c && c !== e.name && r.push({
|
|
4841
4867
|
type: "fieldCustomValidator",
|
|
4842
|
-
name: `${t}:${
|
|
4868
|
+
name: `${t}:${o}`,
|
|
4843
4869
|
existingPlugin: c,
|
|
4844
4870
|
newPlugin: e.name
|
|
4845
4871
|
});
|
|
4846
4872
|
}
|
|
4847
4873
|
if (e.fieldTypeValidators)
|
|
4848
4874
|
for (const t of Object.keys(e.fieldTypeValidators)) {
|
|
4849
|
-
const n = dr(t),
|
|
4850
|
-
n &&
|
|
4875
|
+
const n = dr(t), o = W.fieldTypeValidators.get(t);
|
|
4876
|
+
n && o && o !== e.name && r.push({
|
|
4851
4877
|
type: "fieldTypeValidator",
|
|
4852
4878
|
name: `type:${t}`,
|
|
4853
|
-
existingPlugin:
|
|
4879
|
+
existingPlugin: o,
|
|
4854
4880
|
newPlugin: e.name
|
|
4855
4881
|
});
|
|
4856
4882
|
}
|
|
4857
4883
|
if (e.formValidators)
|
|
4858
4884
|
for (const t of Object.keys(e.formValidators)) {
|
|
4859
|
-
const n = mr(t),
|
|
4860
|
-
n &&
|
|
4885
|
+
const n = mr(t), o = W.formValidators.get(t);
|
|
4886
|
+
n && o && o !== e.name && r.push({
|
|
4861
4887
|
type: "formValidator",
|
|
4862
4888
|
name: t,
|
|
4863
|
-
existingPlugin:
|
|
4889
|
+
existingPlugin: o,
|
|
4864
4890
|
newPlugin: e.name
|
|
4865
4891
|
});
|
|
4866
4892
|
}
|
|
4867
4893
|
if (e.submissionHandlers)
|
|
4868
4894
|
for (const t of Object.keys(e.submissionHandlers)) {
|
|
4869
|
-
const n =
|
|
4870
|
-
n &&
|
|
4895
|
+
const n = pn(t), o = W.submissionHandlers.get(t);
|
|
4896
|
+
n && o && o !== e.name && r.push({
|
|
4871
4897
|
type: "submissionHandler",
|
|
4872
4898
|
name: t,
|
|
4873
|
-
existingPlugin:
|
|
4899
|
+
existingPlugin: o,
|
|
4874
4900
|
newPlugin: e.name
|
|
4875
4901
|
});
|
|
4876
4902
|
}
|
|
4877
4903
|
return r;
|
|
4878
4904
|
}
|
|
4879
|
-
function
|
|
4905
|
+
function ae(e, r, t, n, o, a, c, s) {
|
|
4880
4906
|
for (const i of Object.keys(e)) {
|
|
4881
4907
|
let d;
|
|
4882
|
-
if (s ? d =
|
|
4908
|
+
if (s ? d = o.find((m) => m.type === "fieldCustomValidator" && m.name === `${s}:${i}`) : e === n.components ? d = o.find((m) => m.type === "component" && m.name === i) : e === n.formValidators ? d = o.find((m) => m.type === "formValidator" && m.name === i) : e === n.fieldTypeValidators ? d = o.find((m) => m.type === "fieldTypeValidator" && m.name === `type:${i}`) : e === n.submissionHandlers && (d = o.find((m) => m.type === "submissionHandler" && m.name === i)), tt(d || null, a, c))
|
|
4883
4909
|
if (s) {
|
|
4884
4910
|
const m = r.get(s) || /* @__PURE__ */ new Map();
|
|
4885
4911
|
m.set(i, n.name), r.set(s, m), t(i, e[i]);
|
|
@@ -4890,19 +4916,19 @@ function oe(e, r, t, n, a, o, c, s) {
|
|
|
4890
4916
|
) : r.set(i, n.name), t(i, e[i]);
|
|
4891
4917
|
}
|
|
4892
4918
|
}
|
|
4893
|
-
function
|
|
4919
|
+
function Co(e, r) {
|
|
4894
4920
|
const t = r?.conflictResolution || "error";
|
|
4895
|
-
if (
|
|
4896
|
-
const
|
|
4921
|
+
if (Q.has(e.name)) {
|
|
4922
|
+
const o = {
|
|
4897
4923
|
type: "plugin",
|
|
4898
4924
|
name: e.name,
|
|
4899
4925
|
existingPlugin: e.name,
|
|
4900
4926
|
newPlugin: e.name
|
|
4901
4927
|
};
|
|
4902
|
-
if (!
|
|
4928
|
+
if (!tt(o, t, r?.onConflict)) return;
|
|
4903
4929
|
}
|
|
4904
|
-
const n =
|
|
4905
|
-
if (e.components &&
|
|
4930
|
+
const n = no(e);
|
|
4931
|
+
if (e.components && ae(
|
|
4906
4932
|
e.components,
|
|
4907
4933
|
W.components,
|
|
4908
4934
|
Wr,
|
|
@@ -4911,57 +4937,57 @@ function wa(e, r) {
|
|
|
4911
4937
|
t,
|
|
4912
4938
|
r?.onConflict
|
|
4913
4939
|
), e.fieldCustomValidators)
|
|
4914
|
-
for (const [
|
|
4915
|
-
|
|
4916
|
-
|
|
4940
|
+
for (const [o, a] of Object.entries(e.fieldCustomValidators))
|
|
4941
|
+
ae(
|
|
4942
|
+
a,
|
|
4917
4943
|
W.fieldValidators,
|
|
4918
|
-
(c, s) =>
|
|
4944
|
+
(c, s) => ht(o, c, s),
|
|
4919
4945
|
e,
|
|
4920
4946
|
n,
|
|
4921
4947
|
t,
|
|
4922
4948
|
r?.onConflict,
|
|
4923
|
-
|
|
4949
|
+
o
|
|
4924
4950
|
);
|
|
4925
|
-
e.formValidators &&
|
|
4951
|
+
e.formValidators && ae(
|
|
4926
4952
|
e.formValidators,
|
|
4927
4953
|
W.formValidators,
|
|
4928
|
-
|
|
4954
|
+
gt,
|
|
4929
4955
|
e,
|
|
4930
4956
|
n,
|
|
4931
4957
|
t,
|
|
4932
4958
|
r?.onConflict
|
|
4933
|
-
), e.fieldTypeValidators &&
|
|
4959
|
+
), e.fieldTypeValidators && ae(
|
|
4934
4960
|
e.fieldTypeValidators,
|
|
4935
4961
|
W.fieldTypeValidators,
|
|
4936
|
-
|
|
4962
|
+
bt,
|
|
4937
4963
|
e,
|
|
4938
4964
|
n,
|
|
4939
4965
|
t,
|
|
4940
4966
|
r?.onConflict
|
|
4941
|
-
), e.submissionHandlers &&
|
|
4967
|
+
), e.submissionHandlers && ae(
|
|
4942
4968
|
e.submissionHandlers,
|
|
4943
4969
|
W.submissionHandlers,
|
|
4944
|
-
|
|
4970
|
+
Yr,
|
|
4945
4971
|
e,
|
|
4946
4972
|
n,
|
|
4947
4973
|
t,
|
|
4948
4974
|
r?.onConflict
|
|
4949
|
-
), e.setup && e.setup(),
|
|
4975
|
+
), e.setup && e.setup(), Q.set(e.name, e);
|
|
4950
4976
|
}
|
|
4951
|
-
function
|
|
4952
|
-
const t =
|
|
4977
|
+
function No(e, r = !1) {
|
|
4978
|
+
const t = Q.get(e);
|
|
4953
4979
|
if (!t) return !1;
|
|
4954
4980
|
if (t.cleanup && t.cleanup(), r) {
|
|
4955
4981
|
if (t.components)
|
|
4956
4982
|
for (const n of Object.keys(t.components))
|
|
4957
4983
|
W.components.delete(n);
|
|
4958
4984
|
if (t.fieldCustomValidators)
|
|
4959
|
-
for (const [n,
|
|
4960
|
-
const
|
|
4961
|
-
if (
|
|
4962
|
-
for (const c of Object.keys(
|
|
4963
|
-
|
|
4964
|
-
|
|
4985
|
+
for (const [n, o] of Object.entries(t.fieldCustomValidators)) {
|
|
4986
|
+
const a = W.fieldValidators.get(n);
|
|
4987
|
+
if (a) {
|
|
4988
|
+
for (const c of Object.keys(o))
|
|
4989
|
+
a.delete(c);
|
|
4990
|
+
a.size === 0 && W.fieldValidators.delete(n);
|
|
4965
4991
|
}
|
|
4966
4992
|
}
|
|
4967
4993
|
if (t.formValidators)
|
|
@@ -4974,18 +5000,18 @@ function Sa(e, r = !1) {
|
|
|
4974
5000
|
for (const n of Object.keys(t.submissionHandlers))
|
|
4975
5001
|
W.submissionHandlers.delete(n);
|
|
4976
5002
|
}
|
|
4977
|
-
return
|
|
5003
|
+
return Q.delete(e), !0;
|
|
4978
5004
|
}
|
|
4979
|
-
function
|
|
4980
|
-
return
|
|
5005
|
+
function ko(e) {
|
|
5006
|
+
return Q.get(e);
|
|
4981
5007
|
}
|
|
4982
|
-
function
|
|
4983
|
-
return Array.from(
|
|
5008
|
+
function Io() {
|
|
5009
|
+
return Array.from(Q.values());
|
|
4984
5010
|
}
|
|
4985
|
-
function
|
|
4986
|
-
return
|
|
5011
|
+
function Eo(e) {
|
|
5012
|
+
return Q.has(e);
|
|
4987
5013
|
}
|
|
4988
|
-
function
|
|
5014
|
+
function Fo(e) {
|
|
4989
5015
|
for (const [r, t] of Object.entries(e))
|
|
4990
5016
|
Wr(r, t);
|
|
4991
5017
|
}
|
|
@@ -4997,7 +5023,7 @@ function Te(e) {
|
|
|
4997
5023
|
const r = e;
|
|
4998
5024
|
return typeof r.name == "string" && typeof r.displayName == "string";
|
|
4999
5025
|
}
|
|
5000
|
-
function
|
|
5026
|
+
function nt(e) {
|
|
5001
5027
|
if (!ee(e)) return !1;
|
|
5002
5028
|
const r = e;
|
|
5003
5029
|
return typeof r.name != "string" || typeof r.version != "string" || !Array.isArray(r.properties) ? !1 : r.properties.every((t) => Te(t));
|
|
@@ -5010,12 +5036,12 @@ function Ce(e) {
|
|
|
5010
5036
|
return !!r && typeof r.name == "string" && typeof r.size == "number";
|
|
5011
5037
|
}
|
|
5012
5038
|
}
|
|
5013
|
-
function
|
|
5039
|
+
function Mo(e, r, t = {}) {
|
|
5014
5040
|
try {
|
|
5015
5041
|
const {
|
|
5016
5042
|
includeMetadata: n = !1,
|
|
5017
|
-
dateFormat:
|
|
5018
|
-
fileHandling:
|
|
5043
|
+
dateFormat: o = "iso",
|
|
5044
|
+
fileHandling: a = "metadata",
|
|
5019
5045
|
prettify: c = !1,
|
|
5020
5046
|
excludeFields: s = [],
|
|
5021
5047
|
includeOnlyFields: i = []
|
|
@@ -5025,7 +5051,7 @@ function Ea(e, r, t = {}) {
|
|
|
5025
5051
|
success: !1,
|
|
5026
5052
|
error: "Instance must be a valid object"
|
|
5027
5053
|
};
|
|
5028
|
-
const d = [], m = [], u = {}, b = (
|
|
5054
|
+
const d = [], m = [], u = {}, b = (nt(r) || ee(r) && Array.isArray(r.properties) ? r.properties : []).filter(Te), C = new Map(b.map((h) => [h.name, h]));
|
|
5029
5055
|
for (const [h, y] of Object.entries(e)) {
|
|
5030
5056
|
if (s.includes(h)) {
|
|
5031
5057
|
m.push(h);
|
|
@@ -5038,9 +5064,9 @@ function Ea(e, r, t = {}) {
|
|
|
5038
5064
|
if (y === void 0) continue;
|
|
5039
5065
|
const E = C.get(h);
|
|
5040
5066
|
try {
|
|
5041
|
-
u[h] =
|
|
5042
|
-
} catch (
|
|
5043
|
-
d.push(`Error serializing field '${h}': ${String(
|
|
5067
|
+
u[h] = oo(y, E, { dateFormat: o, fileHandling: a });
|
|
5068
|
+
} catch (M) {
|
|
5069
|
+
d.push(`Error serializing field '${h}': ${String(M)}`), u[h] = null;
|
|
5044
5070
|
}
|
|
5045
5071
|
}
|
|
5046
5072
|
return n && (u._metadata = {
|
|
@@ -5064,8 +5090,8 @@ function Ea(e, r, t = {}) {
|
|
|
5064
5090
|
};
|
|
5065
5091
|
}
|
|
5066
5092
|
}
|
|
5067
|
-
function
|
|
5068
|
-
const { dateFormat: n = "iso", fileHandling:
|
|
5093
|
+
function oo(e, r, t = {}) {
|
|
5094
|
+
const { dateFormat: n = "iso", fileHandling: o = "metadata" } = t;
|
|
5069
5095
|
if (e == null)
|
|
5070
5096
|
return null;
|
|
5071
5097
|
if (r)
|
|
@@ -5075,7 +5101,7 @@ function na(e, r, t = {}) {
|
|
|
5075
5101
|
case "date-time":
|
|
5076
5102
|
return er(e, n);
|
|
5077
5103
|
case "file":
|
|
5078
|
-
return rr(e,
|
|
5104
|
+
return rr(e, o);
|
|
5079
5105
|
case "int":
|
|
5080
5106
|
case "integer":
|
|
5081
5107
|
return typeof e == "string" ? parseInt(e, 10) : e;
|
|
@@ -5086,11 +5112,11 @@ function na(e, r, t = {}) {
|
|
|
5086
5112
|
return typeof e == "string" ? e === "true" : !!e;
|
|
5087
5113
|
case "int-array":
|
|
5088
5114
|
case "float-array":
|
|
5089
|
-
return Array.isArray(e) ? e.map((
|
|
5115
|
+
return Array.isArray(e) ? e.map((a) => typeof a == "string" ? Number(a) : a) : e;
|
|
5090
5116
|
default:
|
|
5091
5117
|
return e;
|
|
5092
5118
|
}
|
|
5093
|
-
return e instanceof Date ? er(e, n) : Ce(e) || Array.isArray(e) && Ce(e[0]) ? rr(e,
|
|
5119
|
+
return e instanceof Date ? er(e, n) : Ce(e) || Array.isArray(e) && Ce(e[0]) ? rr(e, o) : e;
|
|
5094
5120
|
}
|
|
5095
5121
|
function er(e, r) {
|
|
5096
5122
|
let t = null;
|
|
@@ -5134,12 +5160,12 @@ function tr(e, r) {
|
|
|
5134
5160
|
_note: "Base64 encoding requires async implementation"
|
|
5135
5161
|
};
|
|
5136
5162
|
}
|
|
5137
|
-
function
|
|
5163
|
+
function Vo(e, r, t = {}) {
|
|
5138
5164
|
try {
|
|
5139
5165
|
const {
|
|
5140
5166
|
strict: n = !1,
|
|
5141
|
-
validateTypes:
|
|
5142
|
-
preserveUnknownFields:
|
|
5167
|
+
validateTypes: o = !0,
|
|
5168
|
+
preserveUnknownFields: a = !0,
|
|
5143
5169
|
dateFormat: c = "auto"
|
|
5144
5170
|
} = t;
|
|
5145
5171
|
if (!e || typeof e != "string")
|
|
@@ -5161,7 +5187,7 @@ function Ma(e, r, t = {}) {
|
|
|
5161
5187
|
success: !1,
|
|
5162
5188
|
error: "Parsed data must be an object"
|
|
5163
5189
|
};
|
|
5164
|
-
const i = [], d = [], m = {}, f = (
|
|
5190
|
+
const i = [], d = [], m = {}, f = (nt(r) || ee(r) && Array.isArray(r.properties) ? r.properties : []).filter(Te), b = new Map(f.map((N) => [N.name, N]));
|
|
5165
5191
|
for (const N of f) {
|
|
5166
5192
|
const h = N.name, y = s[h];
|
|
5167
5193
|
if (y === void 0) {
|
|
@@ -5169,13 +5195,13 @@ function Ma(e, r, t = {}) {
|
|
|
5169
5195
|
continue;
|
|
5170
5196
|
}
|
|
5171
5197
|
try {
|
|
5172
|
-
m[h] =
|
|
5198
|
+
m[h] = ao(y, N, { validateTypes: o, dateFormat: c });
|
|
5173
5199
|
} catch (E) {
|
|
5174
|
-
const
|
|
5175
|
-
n ? d.push(
|
|
5200
|
+
const M = `Error deserializing field '${h}': ${String(E)}`;
|
|
5201
|
+
n ? d.push(M) : (i.push(M), m[h] = y);
|
|
5176
5202
|
}
|
|
5177
5203
|
}
|
|
5178
|
-
if (
|
|
5204
|
+
if (a)
|
|
5179
5205
|
for (const [N, h] of Object.entries(s))
|
|
5180
5206
|
!b.has(N) && N !== "_metadata" && (n && i.push(`Unknown field '${N}' preserved`), m[N] = h);
|
|
5181
5207
|
const C = d.length > 0;
|
|
@@ -5192,8 +5218,8 @@ function Ma(e, r, t = {}) {
|
|
|
5192
5218
|
};
|
|
5193
5219
|
}
|
|
5194
5220
|
}
|
|
5195
|
-
function
|
|
5196
|
-
const { validateTypes: n = !0, dateFormat:
|
|
5221
|
+
function ao(e, r, t = {}) {
|
|
5222
|
+
const { validateTypes: n = !0, dateFormat: o = "auto" } = t;
|
|
5197
5223
|
if (e == null)
|
|
5198
5224
|
return e;
|
|
5199
5225
|
try {
|
|
@@ -5201,7 +5227,7 @@ function aa(e, r, t = {}) {
|
|
|
5201
5227
|
case "date":
|
|
5202
5228
|
case "datetime":
|
|
5203
5229
|
case "date-time":
|
|
5204
|
-
return
|
|
5230
|
+
return io(e, o, n);
|
|
5205
5231
|
case "int":
|
|
5206
5232
|
case "integer":
|
|
5207
5233
|
return Ne(e, n);
|
|
@@ -5209,7 +5235,7 @@ function aa(e, r, t = {}) {
|
|
|
5209
5235
|
case "number":
|
|
5210
5236
|
return ke(e, n);
|
|
5211
5237
|
case "boolean":
|
|
5212
|
-
return
|
|
5238
|
+
return so(e, n);
|
|
5213
5239
|
case "int-array":
|
|
5214
5240
|
return nr(e, "integer", n);
|
|
5215
5241
|
case "float-array":
|
|
@@ -5223,13 +5249,13 @@ function aa(e, r, t = {}) {
|
|
|
5223
5249
|
default:
|
|
5224
5250
|
return e;
|
|
5225
5251
|
}
|
|
5226
|
-
} catch (
|
|
5252
|
+
} catch (a) {
|
|
5227
5253
|
if (n)
|
|
5228
|
-
throw new Error(`Type conversion failed: ${String(
|
|
5254
|
+
throw new Error(`Type conversion failed: ${String(a)}`);
|
|
5229
5255
|
return e;
|
|
5230
5256
|
}
|
|
5231
5257
|
}
|
|
5232
|
-
function
|
|
5258
|
+
function $o(e, r = {}) {
|
|
5233
5259
|
try {
|
|
5234
5260
|
const { prettify: t = !0, includeMetadata: n = !0 } = r;
|
|
5235
5261
|
if (!e || typeof e != "object")
|
|
@@ -5237,16 +5263,16 @@ function Fa(e, r = {}) {
|
|
|
5237
5263
|
success: !1,
|
|
5238
5264
|
error: "Definition must be a valid object"
|
|
5239
5265
|
};
|
|
5240
|
-
const
|
|
5241
|
-
return n && (
|
|
5266
|
+
const o = { ...e };
|
|
5267
|
+
return n && (o._metadata = {
|
|
5242
5268
|
serializedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5243
|
-
version:
|
|
5244
|
-
propertyCount: (Array.isArray(
|
|
5269
|
+
version: o.version || "1.0.0",
|
|
5270
|
+
propertyCount: (Array.isArray(o.properties) ? o.properties.length : 0) || 0
|
|
5245
5271
|
}), {
|
|
5246
5272
|
success: !0,
|
|
5247
|
-
data: t ? JSON.stringify(
|
|
5273
|
+
data: t ? JSON.stringify(o, null, 2) : JSON.stringify(o),
|
|
5248
5274
|
metadata: {
|
|
5249
|
-
fieldCount: (Array.isArray(
|
|
5275
|
+
fieldCount: (Array.isArray(o.properties) ? o.properties.length : 0) || 0,
|
|
5250
5276
|
excludedFields: [],
|
|
5251
5277
|
warnings: []
|
|
5252
5278
|
}
|
|
@@ -5258,13 +5284,13 @@ function Fa(e, r = {}) {
|
|
|
5258
5284
|
};
|
|
5259
5285
|
}
|
|
5260
5286
|
}
|
|
5261
|
-
function
|
|
5287
|
+
function Ao(e, r = {}) {
|
|
5262
5288
|
try {
|
|
5263
5289
|
const { strict: t = !1, validateTypes: n = !0 } = r;
|
|
5264
|
-
let
|
|
5290
|
+
let o;
|
|
5265
5291
|
if (typeof e == "string")
|
|
5266
5292
|
try {
|
|
5267
|
-
|
|
5293
|
+
o = JSON.parse(e);
|
|
5268
5294
|
} catch (m) {
|
|
5269
5295
|
return {
|
|
5270
5296
|
success: !1,
|
|
@@ -5272,43 +5298,43 @@ function $a(e, r = {}) {
|
|
|
5272
5298
|
};
|
|
5273
5299
|
}
|
|
5274
5300
|
else if (e && typeof e == "object")
|
|
5275
|
-
|
|
5301
|
+
o = { ...e };
|
|
5276
5302
|
else
|
|
5277
5303
|
return {
|
|
5278
5304
|
success: !1,
|
|
5279
5305
|
error: "Input must be a string or object"
|
|
5280
5306
|
};
|
|
5281
|
-
const
|
|
5307
|
+
const a = [], c = [], s = ["name", "version", "displayName"];
|
|
5282
5308
|
for (const m of s)
|
|
5283
|
-
if (!(m in
|
|
5309
|
+
if (!(m in o) || !o[m])
|
|
5284
5310
|
if (t)
|
|
5285
5311
|
c.push(`Required field '${m}' is missing`);
|
|
5286
5312
|
else
|
|
5287
|
-
switch (
|
|
5313
|
+
switch (a.push(`Missing field '${m}', using default`), m) {
|
|
5288
5314
|
case "name":
|
|
5289
|
-
|
|
5315
|
+
o.name = "unnamed-definition";
|
|
5290
5316
|
break;
|
|
5291
5317
|
case "version":
|
|
5292
|
-
|
|
5318
|
+
o.version = "1.0.0";
|
|
5293
5319
|
break;
|
|
5294
5320
|
case "displayName":
|
|
5295
|
-
|
|
5321
|
+
o.displayName = o.name || "Unnamed Definition";
|
|
5296
5322
|
break;
|
|
5297
5323
|
}
|
|
5298
|
-
const i = Array.isArray(
|
|
5299
|
-
i ?
|
|
5324
|
+
const i = Array.isArray(o.properties) ? o.properties : null;
|
|
5325
|
+
i ? o.properties = i.map((m, u) => {
|
|
5300
5326
|
const f = ee(m) ? m : {}, b = { ...f };
|
|
5301
5327
|
if (!f.name) {
|
|
5302
5328
|
const C = `Property at index ${u} missing 'name'`;
|
|
5303
|
-
t ? c.push(C) : (
|
|
5329
|
+
t ? c.push(C) : (a.push(`${C}, using 'field_${u}'`), b.name = `field_${u}`);
|
|
5304
5330
|
}
|
|
5305
|
-
return f.displayName || (b.displayName = f.name || `Field ${u}`), f.type || (t && n ? c.push(`Property '${f.name || u}' missing 'type'`) : (
|
|
5306
|
-
}) : t ? c.push("Properties must be an array") : (
|
|
5331
|
+
return f.displayName || (b.displayName = f.name || `Field ${u}`), f.type || (t && n ? c.push(`Property '${f.name || u}' missing 'type'`) : (a.push(`Property '${f.name || u}' missing 'type', using 'string'`), b.type = "string")), f.defaultValue === void 0 && (b.defaultValue = null), f.required === void 0 && (b.required = !1), b;
|
|
5332
|
+
}) : t ? c.push("Properties must be an array") : (a.push("Properties not found or invalid, using empty array"), o.properties = []);
|
|
5307
5333
|
const d = c.length > 0;
|
|
5308
5334
|
return {
|
|
5309
5335
|
success: !d,
|
|
5310
|
-
data:
|
|
5311
|
-
warnings:
|
|
5336
|
+
data: o,
|
|
5337
|
+
warnings: a.length > 0 ? a : void 0,
|
|
5312
5338
|
validationErrors: d ? c : void 0
|
|
5313
5339
|
};
|
|
5314
5340
|
} catch (t) {
|
|
@@ -5318,7 +5344,7 @@ function $a(e, r = {}) {
|
|
|
5318
5344
|
};
|
|
5319
5345
|
}
|
|
5320
5346
|
}
|
|
5321
|
-
function
|
|
5347
|
+
function io(e, r, t) {
|
|
5322
5348
|
if (e instanceof Date)
|
|
5323
5349
|
return e;
|
|
5324
5350
|
if (typeof e == "number") {
|
|
@@ -5383,7 +5409,7 @@ function ke(e, r) {
|
|
|
5383
5409
|
throw new Error(`Cannot convert ${typeof e} to number`);
|
|
5384
5410
|
return e;
|
|
5385
5411
|
}
|
|
5386
|
-
function
|
|
5412
|
+
function so(e, r) {
|
|
5387
5413
|
if (typeof e == "boolean")
|
|
5388
5414
|
return e;
|
|
5389
5415
|
if (typeof e == "string") {
|
|
@@ -5402,70 +5428,70 @@ function ia(e, r) {
|
|
|
5402
5428
|
function nr(e, r, t) {
|
|
5403
5429
|
if (!Array.isArray(e)) {
|
|
5404
5430
|
if (typeof e == "string")
|
|
5405
|
-
return e.split(",").map((
|
|
5431
|
+
return e.split(",").map((o) => o.trim()).filter(Boolean).map((o) => r === "integer" ? Ne(o, t) : ke(o, t));
|
|
5406
5432
|
if (t)
|
|
5407
5433
|
throw new Error(`Expected array, got ${typeof e}`);
|
|
5408
5434
|
return e;
|
|
5409
5435
|
}
|
|
5410
|
-
return e.map((n,
|
|
5436
|
+
return e.map((n, o) => {
|
|
5411
5437
|
try {
|
|
5412
5438
|
return r === "integer" ? Ne(n, t) : ke(n, t);
|
|
5413
|
-
} catch (
|
|
5439
|
+
} catch (a) {
|
|
5414
5440
|
if (t)
|
|
5415
|
-
throw new Error(`Array element ${
|
|
5441
|
+
throw new Error(`Array element ${o}: ${a}`);
|
|
5416
5442
|
return n;
|
|
5417
5443
|
}
|
|
5418
5444
|
});
|
|
5419
5445
|
}
|
|
5420
|
-
function
|
|
5446
|
+
function co() {
|
|
5421
5447
|
if (!document.getElementById("reactaform-styles"))
|
|
5422
5448
|
try {
|
|
5423
5449
|
const e = document.createElement("style");
|
|
5424
|
-
e.id = "reactaform-styles", e.textContent =
|
|
5450
|
+
e.id = "reactaform-styles", e.textContent = lt, document.head.appendChild(e);
|
|
5425
5451
|
} catch {
|
|
5426
5452
|
}
|
|
5427
5453
|
}
|
|
5428
|
-
typeof document < "u" &&
|
|
5454
|
+
typeof document < "u" && co();
|
|
5429
5455
|
export {
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5456
|
+
$ as CSS_CLASSES,
|
|
5457
|
+
So as ReactaForm,
|
|
5458
|
+
Qn as ReactaFormProvider,
|
|
5459
|
+
bn as ReactaFormRenderer,
|
|
5460
|
+
L as StandardFieldLayout,
|
|
5461
|
+
fo as Units,
|
|
5436
5462
|
U as combineClasses,
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
|
|
5463
|
+
ro as createInstanceFromDefinition,
|
|
5464
|
+
Ao as deserializeDefinition,
|
|
5465
|
+
Vo as deserializeInstance,
|
|
5466
|
+
Io as getAllPlugins,
|
|
5467
|
+
tn as getButtonHandler,
|
|
5442
5468
|
_r as getComponent,
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5469
|
+
ko as getPlugin,
|
|
5470
|
+
yo as getSupportedLanguages,
|
|
5471
|
+
go as hasButtonHandler,
|
|
5472
|
+
Eo as hasPlugin,
|
|
5473
|
+
co as injectReactaFormStyles,
|
|
5448
5474
|
ie as isDarkTheme,
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5475
|
+
bo as listButtonHandlers,
|
|
5476
|
+
xo as loadInstance,
|
|
5477
|
+
vo as loadJsonDefinition,
|
|
5478
|
+
po as registerButtonHandler,
|
|
5453
5479
|
Wr as registerComponent,
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5480
|
+
Fo as registerComponents,
|
|
5481
|
+
ht as registerFieldCustomValidationHandler,
|
|
5482
|
+
bt as registerFieldTypeValidationHandler,
|
|
5483
|
+
gt as registerFormValidationHandler,
|
|
5484
|
+
Co as registerPlugin,
|
|
5485
|
+
Yr as registerSubmissionHandler,
|
|
5486
|
+
$o as serializeDefinition,
|
|
5487
|
+
Mo as serializeInstance,
|
|
5488
|
+
ho as unregisterButtonHandler,
|
|
5489
|
+
No as unregisterPlugin,
|
|
5490
|
+
wo as upgradeInstanceToLatestDefinition,
|
|
5491
|
+
ut as useDebouncedCallback,
|
|
5466
5492
|
T as useFieldValidator,
|
|
5467
5493
|
B as useReactaFormContext,
|
|
5468
5494
|
_ as useUncontrolledValidatedInput,
|
|
5469
|
-
|
|
5495
|
+
mo as validateFieldValue,
|
|
5470
5496
|
fr as validateFieldWithCustomHandler
|
|
5471
5497
|
};
|