reactaform 1.8.2 → 1.8.3
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/components/renderFields.d.ts +2 -2
- package/dist/reactaform.cjs.js +4 -4
- package/dist/reactaform.es.js +171 -171
- package/package.json +1 -1
package/dist/reactaform.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as p, jsxs as A, Fragment as Ne } from "react/jsx-runtime";
|
|
2
2
|
import * as u from "react";
|
|
3
|
-
import { createContext as zr, useContext as
|
|
3
|
+
import { createContext as zr, useContext as Lr, useRef as pe, useEffect as je, useCallback as ge } from "react";
|
|
4
4
|
import * as me from "react-dom";
|
|
5
|
-
const
|
|
5
|
+
const Or = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
6
6
|
\r
|
|
7
7
|
/* Default Light Theme */\r
|
|
8
8
|
:root {\r
|
|
@@ -302,7 +302,7 @@ const Lr = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
|
302
302
|
\r
|
|
303
303
|
}\r
|
|
304
304
|
`, Ie = zr(void 0), j = () => {
|
|
305
|
-
const e =
|
|
305
|
+
const e = Lr(Ie);
|
|
306
306
|
if (!e)
|
|
307
307
|
throw new Error("❌ useReactaFormContext must be used within a <ReactaFormProvider>");
|
|
308
308
|
return e;
|
|
@@ -391,7 +391,7 @@ const R = {
|
|
|
391
391
|
inputSelect: "reactaform-select",
|
|
392
392
|
rangeInput: "reactaform-input--range",
|
|
393
393
|
button: "reactaform-button"
|
|
394
|
-
},
|
|
394
|
+
}, q = (...e) => {
|
|
395
395
|
const r = [];
|
|
396
396
|
for (const t of e)
|
|
397
397
|
t && (typeof t == "string" ? r.push(t) : typeof t == "object" && Object.entries(t).forEach(([n, a]) => {
|
|
@@ -508,13 +508,13 @@ const Hr = () => /* @__PURE__ */ A(
|
|
|
508
508
|
const h = w.current.getBoundingClientRect(), y = 8, C = window.innerWidth, E = window.innerHeight, I = -4;
|
|
509
509
|
let M = b.right + y, P = b.top + b.height / 2 - h.height / 2 + I;
|
|
510
510
|
M + h.width > C - y && (M = b.left - y - h.width), M = Math.max(y, Math.min(M, C - h.width - y)), P = Math.max(y, Math.min(P, E - h.height - y)), l({ x: M, y: P }), d(!0);
|
|
511
|
-
const H = g.current.closest("[data-reactaform-theme]"),
|
|
512
|
-
if (H &&
|
|
511
|
+
const H = g.current.closest("[data-reactaform-theme]"), Y = document.getElementById("popup-root");
|
|
512
|
+
if (H && Y) {
|
|
513
513
|
const ne = getComputedStyle(H);
|
|
514
|
-
|
|
514
|
+
Y.style.setProperty(
|
|
515
515
|
"--reactaform-tooltip-color-bg",
|
|
516
516
|
ne.getPropertyValue("--reactaform-tooltip-color-bg")
|
|
517
|
-
),
|
|
517
|
+
), Y.style.setProperty(
|
|
518
518
|
"--reactaform-tooltip-color",
|
|
519
519
|
ne.getPropertyValue("--reactaform-tooltip-color")
|
|
520
520
|
);
|
|
@@ -630,13 +630,13 @@ const nr = u.memo(({
|
|
|
630
630
|
] });
|
|
631
631
|
});
|
|
632
632
|
nr.displayName = "RowFieldLayout";
|
|
633
|
-
const
|
|
633
|
+
const L = u.memo(({
|
|
634
634
|
field: e,
|
|
635
635
|
error: r,
|
|
636
636
|
children: t,
|
|
637
637
|
rightAlign: n = !1
|
|
638
638
|
}) => 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(nr, { field: e, error: r, rightAlign: n, children: t }));
|
|
639
|
-
|
|
639
|
+
L.displayName = "StandardFieldLayout";
|
|
640
640
|
const Me = u.memo(({ children: e, id: r }) => {
|
|
641
641
|
const t = u.useMemo(() => ({
|
|
642
642
|
color: "var(--reactaform-error-color)",
|
|
@@ -674,7 +674,7 @@ const ar = u.memo(({ name: e, onChange: r }) => {
|
|
|
674
674
|
id: "instance-name-input",
|
|
675
675
|
type: "text",
|
|
676
676
|
value: e,
|
|
677
|
-
className:
|
|
677
|
+
className: q(R.input, R.textInput),
|
|
678
678
|
onChange: (n) => r(n.target.value),
|
|
679
679
|
placeholder: t("Enter instance name")
|
|
680
680
|
}
|
|
@@ -785,7 +785,7 @@ async function Gr(e, r, t) {
|
|
|
785
785
|
}
|
|
786
786
|
return null;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function O(e, r) {
|
|
789
789
|
const { definitionName: t, t: n, fieldValidationMode: a } = j();
|
|
790
790
|
return u.useCallback(
|
|
791
791
|
(o) => a === "realTime" ? mr(t, e, o, n) : r ?? null,
|
|
@@ -799,7 +799,7 @@ const Jr = ({
|
|
|
799
799
|
onError: n,
|
|
800
800
|
error: a
|
|
801
801
|
}) => {
|
|
802
|
-
const { t: o } = j(), i =
|
|
802
|
+
const { t: o } = j(), i = O(e, a)(r);
|
|
803
803
|
u.useEffect(() => {
|
|
804
804
|
a || n?.(i);
|
|
805
805
|
}, [i, a, n]);
|
|
@@ -814,7 +814,7 @@ const Jr = ({
|
|
|
814
814
|
},
|
|
815
815
|
[t, r]
|
|
816
816
|
), l = e.name;
|
|
817
|
-
return /* @__PURE__ */ p(
|
|
817
|
+
return /* @__PURE__ */ p(L, { field: e, rightAlign: !1, error: i, children: /* @__PURE__ */ A(
|
|
818
818
|
"div",
|
|
819
819
|
{
|
|
820
820
|
style: {
|
|
@@ -912,7 +912,7 @@ const qe = [
|
|
|
912
912
|
onError: n,
|
|
913
913
|
error: a
|
|
914
914
|
}) => {
|
|
915
|
-
const { t: o } = j(), c =
|
|
915
|
+
const { t: o } = j(), c = O(e, a), i = u.useMemo(
|
|
916
916
|
() => he(r),
|
|
917
917
|
[r]
|
|
918
918
|
), { inputRef: s, error: m, handleChange: l } = _({
|
|
@@ -949,7 +949,7 @@ const qe = [
|
|
|
949
949
|
() => Qr(f),
|
|
950
950
|
[f]
|
|
951
951
|
);
|
|
952
|
-
return /* @__PURE__ */ p(
|
|
952
|
+
return /* @__PURE__ */ p(L, { field: e, error: m, children: /* @__PURE__ */ A(
|
|
953
953
|
"div",
|
|
954
954
|
{
|
|
955
955
|
style: {
|
|
@@ -965,7 +965,7 @@ const qe = [
|
|
|
965
965
|
id: e.name,
|
|
966
966
|
value: f,
|
|
967
967
|
onChange: w,
|
|
968
|
-
className:
|
|
968
|
+
className: q(
|
|
969
969
|
R.input,
|
|
970
970
|
R.inputSelect
|
|
971
971
|
),
|
|
@@ -1035,7 +1035,7 @@ const qe = [
|
|
|
1035
1035
|
onError: n,
|
|
1036
1036
|
error: a
|
|
1037
1037
|
}) => {
|
|
1038
|
-
const o =
|
|
1038
|
+
const o = O(e, a), c = We(r), { inputRef: i, error: s, handleChange: m } = _({
|
|
1039
1039
|
value: c,
|
|
1040
1040
|
onChange: t,
|
|
1041
1041
|
onError: n,
|
|
@@ -1043,7 +1043,7 @@ const qe = [
|
|
|
1043
1043
|
});
|
|
1044
1044
|
return u.useEffect(() => {
|
|
1045
1045
|
a || n?.(s);
|
|
1046
|
-
}, [s, a, n]), /* @__PURE__ */ p(
|
|
1046
|
+
}, [s, a, n]), /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1047
1047
|
"input",
|
|
1048
1048
|
{
|
|
1049
1049
|
id: e.name,
|
|
@@ -1051,7 +1051,7 @@ const qe = [
|
|
|
1051
1051
|
ref: i,
|
|
1052
1052
|
defaultValue: We(r),
|
|
1053
1053
|
onChange: m,
|
|
1054
|
-
className:
|
|
1054
|
+
className: q(R.input, R.textInput),
|
|
1055
1055
|
...e.minDate ? { min: e.minDate } : {},
|
|
1056
1056
|
...e.maxDate ? { max: e.maxDate } : {},
|
|
1057
1057
|
"aria-invalid": !!s,
|
|
@@ -1069,7 +1069,7 @@ const qe = [
|
|
|
1069
1069
|
u.useEffect(() => {
|
|
1070
1070
|
l.current = n;
|
|
1071
1071
|
}, [n]);
|
|
1072
|
-
const F =
|
|
1072
|
+
const F = O(e, a), [S, v] = u.useState(null), k = u.useRef(null);
|
|
1073
1073
|
u.useEffect(() => {
|
|
1074
1074
|
const y = String(r ?? "");
|
|
1075
1075
|
let C = F(y);
|
|
@@ -1113,7 +1113,7 @@ const qe = [
|
|
|
1113
1113
|
...V(s, void 0, "arrow")
|
|
1114
1114
|
}), [i, s]);
|
|
1115
1115
|
return /* @__PURE__ */ A("div", { children: [
|
|
1116
|
-
/* @__PURE__ */ p(
|
|
1116
|
+
/* @__PURE__ */ p(L, { field: e, error: S, children: /* @__PURE__ */ A(
|
|
1117
1117
|
"div",
|
|
1118
1118
|
{
|
|
1119
1119
|
ref: m,
|
|
@@ -1318,13 +1318,13 @@ const qe = [
|
|
|
1318
1318
|
onError: n,
|
|
1319
1319
|
error: a
|
|
1320
1320
|
}) => {
|
|
1321
|
-
const o =
|
|
1321
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
1322
1322
|
value: r,
|
|
1323
1323
|
onChange: t,
|
|
1324
1324
|
onError: n,
|
|
1325
1325
|
validate: o
|
|
1326
1326
|
});
|
|
1327
|
-
return /* @__PURE__ */ p(
|
|
1327
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1328
1328
|
"input",
|
|
1329
1329
|
{
|
|
1330
1330
|
id: e.name,
|
|
@@ -1332,7 +1332,7 @@ const qe = [
|
|
|
1332
1332
|
defaultValue: String(r ?? ""),
|
|
1333
1333
|
ref: c,
|
|
1334
1334
|
onChange: s,
|
|
1335
|
-
className:
|
|
1335
|
+
className: q(R.input, R.textInput),
|
|
1336
1336
|
"aria-invalid": !!i,
|
|
1337
1337
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
1338
1338
|
}
|
|
@@ -1362,7 +1362,7 @@ const qe = [
|
|
|
1362
1362
|
}, [n]);
|
|
1363
1363
|
const g = (x, V) => V.some(
|
|
1364
1364
|
(b) => b.name === x.name && b.size === x.size && b.lastModified === x.lastModified
|
|
1365
|
-
), w =
|
|
1365
|
+
), w = O(e, a);
|
|
1366
1366
|
u.useEffect(() => {
|
|
1367
1367
|
const x = w(r ?? []);
|
|
1368
1368
|
t?.(r), x !== l.current && (l.current = x, d(x), m.current?.(x ?? null));
|
|
@@ -1474,7 +1474,7 @@ const qe = [
|
|
|
1474
1474
|
`${V.name}-${b}`
|
|
1475
1475
|
)) });
|
|
1476
1476
|
};
|
|
1477
|
-
return /* @__PURE__ */ p(
|
|
1477
|
+
return /* @__PURE__ */ p(L, { field: e, error: f, children: /* @__PURE__ */ A("div", { style: { width: "100%" }, children: [
|
|
1478
1478
|
/* @__PURE__ */ A(
|
|
1479
1479
|
"div",
|
|
1480
1480
|
{
|
|
@@ -1559,13 +1559,13 @@ const qe = [
|
|
|
1559
1559
|
onError: n,
|
|
1560
1560
|
error: a
|
|
1561
1561
|
}) => {
|
|
1562
|
-
const o =
|
|
1562
|
+
const o = O(e, a), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: i, error: s, handleChange: m } = _({
|
|
1563
1563
|
value: c,
|
|
1564
1564
|
onChange: t,
|
|
1565
1565
|
onError: n,
|
|
1566
1566
|
validate: o
|
|
1567
1567
|
});
|
|
1568
|
-
return /* @__PURE__ */ p(
|
|
1568
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1569
1569
|
"input",
|
|
1570
1570
|
{
|
|
1571
1571
|
id: e.name,
|
|
@@ -1573,7 +1573,7 @@ const qe = [
|
|
|
1573
1573
|
defaultValue: c,
|
|
1574
1574
|
ref: i,
|
|
1575
1575
|
onChange: m,
|
|
1576
|
-
className:
|
|
1576
|
+
className: q(R.input, R.textInput),
|
|
1577
1577
|
style: { flex: 1 },
|
|
1578
1578
|
"aria-invalid": !!s,
|
|
1579
1579
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
@@ -1586,13 +1586,13 @@ const qe = [
|
|
|
1586
1586
|
onError: n,
|
|
1587
1587
|
error: a
|
|
1588
1588
|
}) => {
|
|
1589
|
-
const o =
|
|
1589
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
1590
1590
|
value: r,
|
|
1591
1591
|
onChange: t,
|
|
1592
1592
|
onError: n,
|
|
1593
1593
|
validate: o
|
|
1594
1594
|
}), m = a ?? i;
|
|
1595
|
-
return /* @__PURE__ */ p(
|
|
1595
|
+
return /* @__PURE__ */ p(L, { field: e, error: m, children: /* @__PURE__ */ p(
|
|
1596
1596
|
"input",
|
|
1597
1597
|
{
|
|
1598
1598
|
id: e.name,
|
|
@@ -1600,7 +1600,7 @@ const qe = [
|
|
|
1600
1600
|
ref: c,
|
|
1601
1601
|
defaultValue: String(r ?? ""),
|
|
1602
1602
|
onChange: s,
|
|
1603
|
-
className:
|
|
1603
|
+
className: q(
|
|
1604
1604
|
R.input,
|
|
1605
1605
|
R.inputNumber
|
|
1606
1606
|
),
|
|
@@ -1660,7 +1660,7 @@ const ut = ({ field: e, value: r }) => {
|
|
|
1660
1660
|
boxShadow: "0 2px 6px rgba(0,0,0,0.1)",
|
|
1661
1661
|
margin: "0 0 8px 0"
|
|
1662
1662
|
};
|
|
1663
|
-
return d && g ? (w.width = d, w.height = g, F.width = `${d}px`, F.height = `${g}px`) : d && !g ? (w.width = d, F.width = `${d}px`, F.height = "auto") : !d && g && (w.height = g, F.width = "auto", F.height = `${g}px`), /* @__PURE__ */ p(
|
|
1663
|
+
return d && g ? (w.width = d, w.height = g, F.width = `${d}px`, F.height = `${g}px`) : d && !g ? (w.width = d, F.width = `${d}px`, F.height = "auto") : !d && g && (w.height = g, F.width = "auto", F.height = `${g}px`), /* @__PURE__ */ p(L, { field: e, children: /* @__PURE__ */ p(
|
|
1664
1664
|
"div",
|
|
1665
1665
|
{
|
|
1666
1666
|
"data-testid": "image-wrapper",
|
|
@@ -1687,13 +1687,13 @@ const ut = ({ field: e, value: r }) => {
|
|
|
1687
1687
|
onError: n,
|
|
1688
1688
|
error: a
|
|
1689
1689
|
}) => {
|
|
1690
|
-
const o =
|
|
1690
|
+
const o = O(e, a), c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), { inputRef: i, error: s, handleChange: m } = _({
|
|
1691
1691
|
value: c,
|
|
1692
1692
|
onChange: t,
|
|
1693
1693
|
onError: n,
|
|
1694
1694
|
validate: o
|
|
1695
1695
|
});
|
|
1696
|
-
return /* @__PURE__ */ p(
|
|
1696
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ p(
|
|
1697
1697
|
"input",
|
|
1698
1698
|
{
|
|
1699
1699
|
id: e.name,
|
|
@@ -1701,7 +1701,7 @@ const ut = ({ field: e, value: r }) => {
|
|
|
1701
1701
|
defaultValue: c,
|
|
1702
1702
|
ref: i,
|
|
1703
1703
|
onChange: m,
|
|
1704
|
-
className:
|
|
1704
|
+
className: q(R.input, R.textInput),
|
|
1705
1705
|
style: { flex: 1 },
|
|
1706
1706
|
"aria-invalid": !!s,
|
|
1707
1707
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
@@ -1714,13 +1714,13 @@ const ut = ({ field: e, value: r }) => {
|
|
|
1714
1714
|
onError: n,
|
|
1715
1715
|
error: a
|
|
1716
1716
|
}) => {
|
|
1717
|
-
const o =
|
|
1717
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
1718
1718
|
value: r,
|
|
1719
1719
|
onChange: t,
|
|
1720
1720
|
onError: n,
|
|
1721
1721
|
validate: o
|
|
1722
1722
|
});
|
|
1723
|
-
return /* @__PURE__ */ p(
|
|
1723
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1724
1724
|
"input",
|
|
1725
1725
|
{
|
|
1726
1726
|
id: e.name,
|
|
@@ -1728,7 +1728,7 @@ const ut = ({ field: e, value: r }) => {
|
|
|
1728
1728
|
defaultValue: String(r ?? ""),
|
|
1729
1729
|
ref: c,
|
|
1730
1730
|
onChange: s,
|
|
1731
|
-
className:
|
|
1731
|
+
className: q(R.input, R.inputNumber),
|
|
1732
1732
|
"aria-invalid": !!i,
|
|
1733
1733
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
1734
1734
|
}
|
|
@@ -1742,13 +1742,13 @@ const ft = u.memo(fr), dt = ({
|
|
|
1742
1742
|
onError: n,
|
|
1743
1743
|
error: a
|
|
1744
1744
|
}) => {
|
|
1745
|
-
const o =
|
|
1745
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
1746
1746
|
value: r,
|
|
1747
1747
|
onChange: t,
|
|
1748
1748
|
onError: n,
|
|
1749
1749
|
validate: o
|
|
1750
1750
|
});
|
|
1751
|
-
return /* @__PURE__ */ p(
|
|
1751
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
1752
1752
|
"textarea",
|
|
1753
1753
|
{
|
|
1754
1754
|
id: e.name,
|
|
@@ -1761,7 +1761,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
1761
1761
|
width: "100%",
|
|
1762
1762
|
boxSizing: "border-box"
|
|
1763
1763
|
},
|
|
1764
|
-
className:
|
|
1764
|
+
className: q(R.input, R.textInput),
|
|
1765
1765
|
"aria-invalid": !!i,
|
|
1766
1766
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
1767
1767
|
}
|
|
@@ -1789,7 +1789,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
1789
1789
|
), v = u.useMemo(() => {
|
|
1790
1790
|
const E = Array.isArray(r) ? r : [], I = new Set(S.map((M) => M.value));
|
|
1791
1791
|
return E.filter((M) => I.has(M));
|
|
1792
|
-
}, [r, S]), k =
|
|
1792
|
+
}, [r, S]), k = O(e, a), [$, N] = u.useState(null), x = u.useRef(null);
|
|
1793
1793
|
u.useEffect(() => {
|
|
1794
1794
|
const E = k(Array.isArray(r) ? r : []);
|
|
1795
1795
|
E !== x.current && (x.current = E, N(E), o.current?.(E ?? null));
|
|
@@ -1843,7 +1843,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
1843
1843
|
[s, m]
|
|
1844
1844
|
);
|
|
1845
1845
|
return /* @__PURE__ */ A("div", { children: [
|
|
1846
|
-
/* @__PURE__ */ p(
|
|
1846
|
+
/* @__PURE__ */ p(L, { field: e, error: $, children: /* @__PURE__ */ p("div", { style: { width: "100%" }, children: /* @__PURE__ */ A(
|
|
1847
1847
|
"div",
|
|
1848
1848
|
{
|
|
1849
1849
|
ref: f,
|
|
@@ -2093,13 +2093,13 @@ const ft = u.memo(fr), dt = ({
|
|
|
2093
2093
|
onError: n,
|
|
2094
2094
|
error: a
|
|
2095
2095
|
}) => {
|
|
2096
|
-
const o =
|
|
2096
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
2097
2097
|
value: String(r ?? ""),
|
|
2098
2098
|
onChange: t,
|
|
2099
2099
|
onError: n,
|
|
2100
2100
|
validate: o
|
|
2101
2101
|
}), m = Math.max(1, Math.round(e.step ?? 1));
|
|
2102
|
-
return /* @__PURE__ */ p(
|
|
2102
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
2103
2103
|
"input",
|
|
2104
2104
|
{
|
|
2105
2105
|
id: e.name,
|
|
@@ -2126,13 +2126,13 @@ const ft = u.memo(fr), dt = ({
|
|
|
2126
2126
|
onError: n,
|
|
2127
2127
|
error: a
|
|
2128
2128
|
}) => {
|
|
2129
|
-
const o =
|
|
2129
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
2130
2130
|
value: r,
|
|
2131
2131
|
onChange: t,
|
|
2132
2132
|
onError: n,
|
|
2133
2133
|
validate: o
|
|
2134
2134
|
});
|
|
2135
|
-
return /* @__PURE__ */ p(
|
|
2135
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
2136
2136
|
"input",
|
|
2137
2137
|
{
|
|
2138
2138
|
id: e.name,
|
|
@@ -2140,7 +2140,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2140
2140
|
defaultValue: String(r ?? ""),
|
|
2141
2141
|
ref: c,
|
|
2142
2142
|
onChange: s,
|
|
2143
|
-
className:
|
|
2143
|
+
className: q(R.input, R.textInput),
|
|
2144
2144
|
"aria-invalid": !!i,
|
|
2145
2145
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
2146
2146
|
}
|
|
@@ -2152,7 +2152,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2152
2152
|
onError: n,
|
|
2153
2153
|
error: a
|
|
2154
2154
|
}) => {
|
|
2155
|
-
const { t: o } = j(), c =
|
|
2155
|
+
const { t: o } = j(), c = O(e, a), i = e.layout?.toLowerCase() === "horizontal" ? "row" : "column", s = u.useRef(null), m = u.useRef(n);
|
|
2156
2156
|
u.useEffect(() => {
|
|
2157
2157
|
m.current = n;
|
|
2158
2158
|
}, [n]);
|
|
@@ -2194,7 +2194,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2194
2194
|
width: i === "column" ? "100%" : void 0,
|
|
2195
2195
|
justifyContent: "flex-start"
|
|
2196
2196
|
};
|
|
2197
|
-
return /* @__PURE__ */ p(
|
|
2197
|
+
return /* @__PURE__ */ p(L, { field: e, error: l, children: /* @__PURE__ */ p(
|
|
2198
2198
|
"div",
|
|
2199
2199
|
{
|
|
2200
2200
|
ref: s,
|
|
@@ -2208,7 +2208,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2208
2208
|
return /* @__PURE__ */ A(
|
|
2209
2209
|
"label",
|
|
2210
2210
|
{
|
|
2211
|
-
className:
|
|
2211
|
+
className: q(R.label),
|
|
2212
2212
|
style: S,
|
|
2213
2213
|
children: [
|
|
2214
2214
|
/* @__PURE__ */ p(
|
|
@@ -2253,7 +2253,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2253
2253
|
userSelect: "none",
|
|
2254
2254
|
transition: "color 0.12s ease"
|
|
2255
2255
|
}, wt = ({ field: e, value: r, onChange: t, onError: n, error: a }) => {
|
|
2256
|
-
const { t: o } = j(), c =
|
|
2256
|
+
const { t: o } = j(), c = O(e, a), i = e.max ?? 5, s = e.icon?.trim() || "★", [m, l] = u.useState(null), f = u.useRef([]), d = u.useMemo(() => Math.min(Math.max(r ?? 0, 0), i), [r, i]), g = u.useMemo(() => c(d) ?? null, [c, d]);
|
|
2257
2257
|
u.useEffect(() => {
|
|
2258
2258
|
n?.(g);
|
|
2259
2259
|
}, [g, n]);
|
|
@@ -2282,7 +2282,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2282
2282
|
},
|
|
2283
2283
|
[i, w]
|
|
2284
2284
|
);
|
|
2285
|
-
return /* @__PURE__ */ p(
|
|
2285
|
+
return /* @__PURE__ */ p(L, { field: e, error: g, children: /* @__PURE__ */ p(
|
|
2286
2286
|
"div",
|
|
2287
2287
|
{
|
|
2288
2288
|
role: "radiogroup",
|
|
@@ -2320,13 +2320,13 @@ const ft = u.memo(fr), dt = ({
|
|
|
2320
2320
|
onError: n,
|
|
2321
2321
|
error: a
|
|
2322
2322
|
}) => {
|
|
2323
|
-
const { t: o } = j(), c =
|
|
2323
|
+
const { t: o } = j(), c = O(e, a), { inputRef: i, error: s, handleChange: m } = _({
|
|
2324
2324
|
value: r,
|
|
2325
2325
|
onChange: t,
|
|
2326
2326
|
onError: n,
|
|
2327
2327
|
validate: c
|
|
2328
2328
|
}), [l, f] = u.useState(!1), d = () => f((g) => !g);
|
|
2329
|
-
return /* @__PURE__ */ p(
|
|
2329
|
+
return /* @__PURE__ */ p(L, { field: e, error: s, children: /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", gap: 8, width: "100%" }, children: [
|
|
2330
2330
|
/* @__PURE__ */ p(
|
|
2331
2331
|
"input",
|
|
2332
2332
|
{
|
|
@@ -2335,7 +2335,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2335
2335
|
defaultValue: String(r ?? ""),
|
|
2336
2336
|
ref: i,
|
|
2337
2337
|
onChange: m,
|
|
2338
|
-
className:
|
|
2338
|
+
className: q(R.input, R.textInput),
|
|
2339
2339
|
style: { flex: 1, minWidth: 0 },
|
|
2340
2340
|
"aria-invalid": !!s,
|
|
2341
2341
|
"aria-describedby": s ? `${e.name}-error` : void 0
|
|
@@ -2361,7 +2361,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2361
2361
|
)
|
|
2362
2362
|
] }) });
|
|
2363
2363
|
}, Ct = ({ field: e, value: r, onChange: t, onError: n, error: a }) => {
|
|
2364
|
-
const o =
|
|
2364
|
+
const o = O(e, a), c = e.min ?? 0, i = e.max ?? 100, [s, m] = u.useState(
|
|
2365
2365
|
() => isNaN(Number(r)) ? String(c) : String(Number(r))
|
|
2366
2366
|
);
|
|
2367
2367
|
u.useEffect(() => {
|
|
@@ -2379,7 +2379,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2379
2379
|
},
|
|
2380
2380
|
[o, t]
|
|
2381
2381
|
), d = isNaN(Number(s)) ? String(c) : String(Number(s));
|
|
2382
|
-
return /* @__PURE__ */ p(
|
|
2382
|
+
return /* @__PURE__ */ p(L, { field: e, error: l, children: /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
|
|
2383
2383
|
/* @__PURE__ */ p(
|
|
2384
2384
|
"input",
|
|
2385
2385
|
{
|
|
@@ -2414,7 +2414,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2414
2414
|
textAlign: "center",
|
|
2415
2415
|
flexShrink: 0
|
|
2416
2416
|
},
|
|
2417
|
-
className:
|
|
2417
|
+
className: q(R.input, R.textInput),
|
|
2418
2418
|
"aria-invalid": !!l,
|
|
2419
2419
|
"aria-describedby": l ? `${e.name}-error` : void 0
|
|
2420
2420
|
}
|
|
@@ -2427,7 +2427,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2427
2427
|
onError: n,
|
|
2428
2428
|
error: a
|
|
2429
2429
|
}) => {
|
|
2430
|
-
const { t: o, formStyle: c, fieldStyle: i, fieldValidationMode: s } = j(), l =
|
|
2430
|
+
const { t: o, formStyle: c, fieldStyle: i, fieldValidationMode: s } = j(), l = O(e, a)(r);
|
|
2431
2431
|
u.useEffect(() => {
|
|
2432
2432
|
s === "realTime" && n?.(l);
|
|
2433
2433
|
}, [l, s, n]);
|
|
@@ -2489,7 +2489,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2489
2489
|
}), [f, d]), k = !!r, $ = () => {
|
|
2490
2490
|
t?.(!k);
|
|
2491
2491
|
};
|
|
2492
|
-
return /* @__PURE__ */ p(
|
|
2492
|
+
return /* @__PURE__ */ p(L, { field: e, error: null, rightAlign: !1, children: /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
|
|
2493
2493
|
/* @__PURE__ */ p(
|
|
2494
2494
|
"label",
|
|
2495
2495
|
{
|
|
@@ -2549,13 +2549,13 @@ const ft = u.memo(fr), dt = ({
|
|
|
2549
2549
|
onError: n,
|
|
2550
2550
|
error: a
|
|
2551
2551
|
}) => {
|
|
2552
|
-
const o =
|
|
2552
|
+
const o = O(e, a), { inputRef: c, error: i, handleChange: s } = _({
|
|
2553
2553
|
value: r,
|
|
2554
2554
|
onChange: t,
|
|
2555
2555
|
onError: n,
|
|
2556
2556
|
validate: o
|
|
2557
2557
|
});
|
|
2558
|
-
return /* @__PURE__ */ p(
|
|
2558
|
+
return /* @__PURE__ */ p(L, { field: e, error: i, children: /* @__PURE__ */ p(
|
|
2559
2559
|
"input",
|
|
2560
2560
|
{
|
|
2561
2561
|
id: e.name,
|
|
@@ -2563,7 +2563,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2563
2563
|
defaultValue: String(r ?? ""),
|
|
2564
2564
|
ref: c,
|
|
2565
2565
|
onChange: s,
|
|
2566
|
-
className:
|
|
2566
|
+
className: q(R.input, R.textInput),
|
|
2567
2567
|
placeholder: e.placeholder,
|
|
2568
2568
|
"aria-invalid": !!i,
|
|
2569
2569
|
"aria-describedby": i ? `${e.name}-error` : void 0
|
|
@@ -2576,13 +2576,13 @@ const ft = u.memo(fr), dt = ({
|
|
|
2576
2576
|
onError: n,
|
|
2577
2577
|
error: a
|
|
2578
2578
|
}) => {
|
|
2579
|
-
const o =
|
|
2579
|
+
const o = O(e), { inputRef: c, error: i, handleChange: s } = _({
|
|
2580
2580
|
value: r,
|
|
2581
2581
|
onChange: t,
|
|
2582
2582
|
onError: n,
|
|
2583
2583
|
validate: o
|
|
2584
2584
|
}), m = a ?? i;
|
|
2585
|
-
return /* @__PURE__ */ p(
|
|
2585
|
+
return /* @__PURE__ */ p(L, { field: e, error: m, children: /* @__PURE__ */ p(
|
|
2586
2586
|
"input",
|
|
2587
2587
|
{
|
|
2588
2588
|
id: e.name,
|
|
@@ -2593,7 +2593,7 @@ const ft = u.memo(fr), dt = ({
|
|
|
2593
2593
|
onChange: s,
|
|
2594
2594
|
min: typeof e.min == "string" ? e.min : void 0,
|
|
2595
2595
|
max: typeof e.max == "string" ? e.max : void 0,
|
|
2596
|
-
className:
|
|
2596
|
+
className: q(R.input, R.textInput),
|
|
2597
2597
|
"aria-invalid": !!m,
|
|
2598
2598
|
"aria-describedby": m ? `${e.name}-error` : void 0
|
|
2599
2599
|
}
|
|
@@ -2938,7 +2938,7 @@ const jn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2938
2938
|
});
|
|
2939
2939
|
gr.displayName = "ConversionButton";
|
|
2940
2940
|
const Mt = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
2941
|
-
const { t: a } = j(), o =
|
|
2941
|
+
const { t: a } = j(), o = O(e), c = e.dimension, i = u.useMemo(() => c ? pr(c) : null, [c]), s = String(r?.[0] ?? ""), m = String(r?.[1] ?? i?.default ?? ""), [l, f] = u.useState(s), [d, g] = u.useState(m);
|
|
2942
2942
|
u.useEffect(() => {
|
|
2943
2943
|
f(s);
|
|
2944
2944
|
}, [s]), u.useEffect(() => {
|
|
@@ -2971,7 +2971,7 @@ const Mt = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
2971
2971
|
);
|
|
2972
2972
|
if (!c || !i) return null;
|
|
2973
2973
|
const $ = !!w || !l.trim();
|
|
2974
|
-
return /* @__PURE__ */ p(
|
|
2974
|
+
return /* @__PURE__ */ p(L, { field: e, error: w, children: /* @__PURE__ */ A("div", { style: { display: "flex", alignItems: "center", gap: "var(--reactaform-unit-gap, 8px)", width: "100%" }, children: [
|
|
2975
2975
|
/* @__PURE__ */ p(
|
|
2976
2976
|
"input",
|
|
2977
2977
|
{
|
|
@@ -2980,7 +2980,7 @@ const Mt = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
2980
2980
|
value: l,
|
|
2981
2981
|
onChange: F,
|
|
2982
2982
|
style: { flex: "2 1 0" },
|
|
2983
|
-
className:
|
|
2983
|
+
className: q(R.input, R.textInput),
|
|
2984
2984
|
"aria-invalid": !!w,
|
|
2985
2985
|
"aria-describedby": w ? `${e.name}-error` : void 0
|
|
2986
2986
|
}
|
|
@@ -2992,7 +2992,7 @@ const Mt = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
2992
2992
|
value: d,
|
|
2993
2993
|
onChange: S,
|
|
2994
2994
|
style: { flex: "1 1 0" },
|
|
2995
|
-
className:
|
|
2995
|
+
className: q(R.input, R.inputSelect),
|
|
2996
2996
|
"aria-invalid": !!w,
|
|
2997
2997
|
"aria-describedby": w ? `${e.name}-error` : void 0,
|
|
2998
2998
|
children: k
|
|
@@ -3018,13 +3018,13 @@ const Mt = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
3018
3018
|
onError: n,
|
|
3019
3019
|
error: a
|
|
3020
3020
|
}) => {
|
|
3021
|
-
const o =
|
|
3021
|
+
const o = O(e), { inputRef: c, error: i, handleChange: s } = _({
|
|
3022
3022
|
value: r,
|
|
3023
3023
|
onChange: t,
|
|
3024
3024
|
onError: n,
|
|
3025
3025
|
validate: o
|
|
3026
3026
|
}), m = a ?? i;
|
|
3027
|
-
return /* @__PURE__ */ p(
|
|
3027
|
+
return /* @__PURE__ */ p(L, { field: e, error: m, children: /* @__PURE__ */ p(
|
|
3028
3028
|
"input",
|
|
3029
3029
|
{
|
|
3030
3030
|
id: e.name,
|
|
@@ -3032,7 +3032,7 @@ const Mt = ({ field: e, value: r, onChange: t, onError: n }) => {
|
|
|
3032
3032
|
defaultValue: String(r ?? ""),
|
|
3033
3033
|
ref: c,
|
|
3034
3034
|
onChange: s,
|
|
3035
|
-
className:
|
|
3035
|
+
className: q(R.input, R.textInput),
|
|
3036
3036
|
placeholder: "https://example.com",
|
|
3037
3037
|
"aria-invalid": !!m,
|
|
3038
3038
|
"aria-describedby": m ? `${e.name}-error` : void 0
|
|
@@ -3188,7 +3188,7 @@ const Pt = (e, r) => {
|
|
|
3188
3188
|
};
|
|
3189
3189
|
}, vr = u.memo(({ field: e, value: r, handleChange: t, handleError: n, error: a }) => {
|
|
3190
3190
|
const o = br(e.type), c = u.useMemo(() => r, [r]), i = u.useCallback(
|
|
3191
|
-
(m
|
|
3191
|
+
(m) => t(e.name, m),
|
|
3192
3192
|
[t, e.name]
|
|
3193
3193
|
), s = u.useCallback(
|
|
3194
3194
|
(m) => n?.(e.name, m),
|
|
@@ -3237,7 +3237,7 @@ const xr = (e, r, t, n, a) => {
|
|
|
3237
3237
|
] });
|
|
3238
3238
|
});
|
|
3239
3239
|
wr.displayName = "FieldGroup";
|
|
3240
|
-
const
|
|
3240
|
+
const Lt = (e, r, t, n, a, o, c, i, s, m) => {
|
|
3241
3241
|
const l = r.slice(0, i).filter((g) => c[g.name]), f = zt(l), d = [];
|
|
3242
3242
|
return f.groups.forEach((g) => {
|
|
3243
3243
|
if (g.name) {
|
|
@@ -3262,7 +3262,7 @@ const Ot = (e, r, t, n, a, o, c, i, s, m) => {
|
|
|
3262
3262
|
} else
|
|
3263
3263
|
g.fields.forEach((w) => d.push(xr(w, t, a, o, m)));
|
|
3264
3264
|
}), d;
|
|
3265
|
-
},
|
|
3265
|
+
}, Ot = (e) => {
|
|
3266
3266
|
const r = {};
|
|
3267
3267
|
return e.forEach((t) => {
|
|
3268
3268
|
r[t.name] = !1;
|
|
@@ -3476,122 +3476,122 @@ const Ut = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3476
3476
|
definitionName: e?.name ?? c.definitionName
|
|
3477
3477
|
}, [f, d] = u.useState("en"), [g, w] = u.useState([]), [F, S] = u.useState({}), [v, k] = u.useState(
|
|
3478
3478
|
{}
|
|
3479
|
-
), [$, N] = u.useState({}), [x, V] = u.useState({}), [b, h] = u.useState({}), [y, C] = u.useState(null), [E, I] = u.useState(null), [M, P] = u.useState(0), [H,
|
|
3479
|
+
), [$, N] = u.useState({}), [x, V] = u.useState({}), [b, h] = u.useState({}), [y, C] = u.useState(null), [E, I] = u.useState(null), [M, P] = u.useState(0), [H, Y] = u.useState(!1), [ne, ae] = u.useState(r.name || ""), G = u.useRef(r), de = u.useRef(!1);
|
|
3480
3480
|
u.useEffect(() => {
|
|
3481
|
-
const
|
|
3482
|
-
a.map((
|
|
3483
|
-
|
|
3484
|
-
{ ...
|
|
3481
|
+
const z = Object.fromEntries(
|
|
3482
|
+
a.map((D) => [
|
|
3483
|
+
D.name,
|
|
3484
|
+
{ ...D, children: {} }
|
|
3485
3485
|
])
|
|
3486
3486
|
);
|
|
3487
|
-
a.forEach((
|
|
3488
|
-
|
|
3489
|
-
const oe =
|
|
3487
|
+
a.forEach((D) => {
|
|
3488
|
+
D.parents && Object.entries(D.parents).forEach(([ee, re]) => {
|
|
3489
|
+
const oe = z[ee];
|
|
3490
3490
|
oe && re.forEach((Pr) => {
|
|
3491
3491
|
oe.children || (oe.children = {});
|
|
3492
3492
|
const Te = String(Pr);
|
|
3493
3493
|
oe.children[Te] = [
|
|
3494
3494
|
...oe.children[Te] || [],
|
|
3495
|
-
|
|
3495
|
+
D.name
|
|
3496
3496
|
];
|
|
3497
3497
|
});
|
|
3498
3498
|
});
|
|
3499
|
-
}), Pt(a,
|
|
3499
|
+
}), Pt(a, z);
|
|
3500
3500
|
const B = Object.values(
|
|
3501
|
-
|
|
3502
|
-
),
|
|
3503
|
-
B.forEach((
|
|
3504
|
-
if (
|
|
3505
|
-
const
|
|
3506
|
-
|
|
3501
|
+
z
|
|
3502
|
+
), U = {};
|
|
3503
|
+
B.forEach((D) => {
|
|
3504
|
+
if (D.type === "unit") {
|
|
3505
|
+
const ee = typeof D.defaultValue == "number" ? String(D.defaultValue) : "", re = typeof D.defaultUnit == "string" ? D.defaultUnit : String(D.defaultUnit ?? "m");
|
|
3506
|
+
U[D.name] = [ee, re];
|
|
3507
3507
|
} else
|
|
3508
|
-
|
|
3509
|
-
}),
|
|
3510
|
-
D
|
|
3508
|
+
U[D.name] = D.defaultValue;
|
|
3509
|
+
}), G.current = r, Object.keys(r.values).forEach((D) => {
|
|
3510
|
+
z[D] !== void 0 && (U[D] = r.values[D]);
|
|
3511
3511
|
});
|
|
3512
|
-
const J =
|
|
3513
|
-
B.forEach((
|
|
3514
|
-
|
|
3512
|
+
const J = Ot(B), K = {};
|
|
3513
|
+
B.forEach((D) => {
|
|
3514
|
+
D.group && !(D.group in K) && (K[D.group] = !0);
|
|
3515
3515
|
});
|
|
3516
|
-
const
|
|
3517
|
-
w(B), S(
|
|
3518
|
-
Tt(B,
|
|
3519
|
-
), V(K),
|
|
3516
|
+
const X = requestAnimationFrame(() => {
|
|
3517
|
+
w(B), S(z), k(U), N(
|
|
3518
|
+
Tt(B, U, J, z)
|
|
3519
|
+
), V(K), Y(!0), ae(r.name);
|
|
3520
3520
|
});
|
|
3521
|
-
return () => cancelAnimationFrame(
|
|
3521
|
+
return () => cancelAnimationFrame(X);
|
|
3522
3522
|
}, [a, r, e]), u.useEffect(() => {
|
|
3523
3523
|
if (!H || M >= g.length) return;
|
|
3524
|
-
const
|
|
3524
|
+
const z = setTimeout(() => {
|
|
3525
3525
|
P(
|
|
3526
3526
|
(B) => Math.min(B + t, g.length)
|
|
3527
3527
|
);
|
|
3528
3528
|
}, n);
|
|
3529
|
-
return () => clearTimeout(
|
|
3529
|
+
return () => clearTimeout(z);
|
|
3530
3530
|
}, [H, M, g.length, t, n]);
|
|
3531
3531
|
const Vr = u.useCallback(
|
|
3532
|
-
(
|
|
3533
|
-
C(null), I(null), k((
|
|
3534
|
-
const
|
|
3535
|
-
return
|
|
3532
|
+
(z, B) => {
|
|
3533
|
+
C(null), I(null), k((U) => {
|
|
3534
|
+
const J = { ...U, [z]: B }, K = F[z];
|
|
3535
|
+
return K && [
|
|
3536
3536
|
"checkbox",
|
|
3537
3537
|
"dropdown",
|
|
3538
3538
|
"multi-select",
|
|
3539
3539
|
"radio",
|
|
3540
3540
|
"switch"
|
|
3541
|
-
].includes(
|
|
3542
|
-
(
|
|
3543
|
-
X,
|
|
3544
|
-
F,
|
|
3545
|
-
K,
|
|
3541
|
+
].includes(K.type) && N(
|
|
3542
|
+
(D) => jt(
|
|
3546
3543
|
D,
|
|
3544
|
+
F,
|
|
3545
|
+
J,
|
|
3546
|
+
z,
|
|
3547
3547
|
String(B)
|
|
3548
3548
|
)
|
|
3549
|
-
),
|
|
3550
|
-
})
|
|
3549
|
+
), J;
|
|
3550
|
+
});
|
|
3551
3551
|
},
|
|
3552
3552
|
[F, C, I]
|
|
3553
3553
|
);
|
|
3554
3554
|
u.useEffect(() => {
|
|
3555
|
-
let
|
|
3556
|
-
return
|
|
3555
|
+
let z = 0;
|
|
3556
|
+
return z = requestAnimationFrame(() => {
|
|
3557
3557
|
m !== f && (d(m || "en"), C(null), I(null));
|
|
3558
|
-
}), () => cancelAnimationFrame(
|
|
3558
|
+
}), () => cancelAnimationFrame(z);
|
|
3559
3559
|
}, [m, f]), u.useEffect(() => {
|
|
3560
|
-
let
|
|
3561
|
-
return
|
|
3560
|
+
let z = 0;
|
|
3561
|
+
return z = requestAnimationFrame(() => {
|
|
3562
3562
|
if (de.current) {
|
|
3563
|
-
de.current = !1,
|
|
3563
|
+
de.current = !1, G.current = r, ae(r.name || "");
|
|
3564
3564
|
return;
|
|
3565
3565
|
}
|
|
3566
|
-
|
|
3567
|
-
}), () => cancelAnimationFrame(
|
|
3566
|
+
G.current = r, C(null), I(null), ae(r.name || "");
|
|
3567
|
+
}), () => cancelAnimationFrame(z);
|
|
3568
3568
|
}, [r, r.name]);
|
|
3569
|
-
const $r = u.useCallback((
|
|
3570
|
-
h((
|
|
3569
|
+
const $r = u.useCallback((z, B) => {
|
|
3570
|
+
h((U) => B ? { ...U, [z]: String(B) } : Object.fromEntries(Object.entries(U).filter(([K]) => K !== z)));
|
|
3571
3571
|
}, []), Rr = async () => {
|
|
3572
3572
|
de.current = !0;
|
|
3573
|
-
const
|
|
3574
|
-
|
|
3573
|
+
const z = G.current?.name;
|
|
3574
|
+
G.current.name = ne;
|
|
3575
3575
|
let B = b;
|
|
3576
3576
|
if (l.fieldValidationMode === "onSubmission") {
|
|
3577
|
-
const
|
|
3578
|
-
if (g.forEach((
|
|
3579
|
-
const
|
|
3580
|
-
if (
|
|
3581
|
-
const re = mr(l.definitionName,
|
|
3582
|
-
re && (
|
|
3583
|
-
}), h(
|
|
3577
|
+
const X = {};
|
|
3578
|
+
if (g.forEach((D) => {
|
|
3579
|
+
const ee = v[D.name];
|
|
3580
|
+
if (ee === void 0) return;
|
|
3581
|
+
const re = mr(l.definitionName, D, ee, i);
|
|
3582
|
+
re && (X[D.name] = re);
|
|
3583
|
+
}), h(X), B = X, Object.keys(X).length > 0) {
|
|
3584
3584
|
C(i("Please fix validation errors before submitting the form.")), I(!1);
|
|
3585
3585
|
return;
|
|
3586
3586
|
} else
|
|
3587
3587
|
C(null), I(null);
|
|
3588
3588
|
}
|
|
3589
|
-
const
|
|
3589
|
+
const U = await qt(e, G.current, v, i, B), J = typeof U.message == "string" ? U.message : String(U.message), K = Object.values(U.errors ?? {}).join(`
|
|
3590
3590
|
`);
|
|
3591
3591
|
C(K ? J + `
|
|
3592
|
-
` + K : J), I(
|
|
3593
|
-
}, Ar = (
|
|
3594
|
-
V((B) => ({ ...B, [
|
|
3592
|
+
` + K : J), I(U.success), U.success || (G.current.name = z ?? G.current.name, ae(z ?? ""));
|
|
3593
|
+
}, Ar = (z) => {
|
|
3594
|
+
V((B) => ({ ...B, [z]: !B[z] }));
|
|
3595
3595
|
}, Dr = u.useMemo(
|
|
3596
3596
|
() => l.fieldValidationMode === "realTime" ? Object.values(b).some(Boolean) : !1,
|
|
3597
3597
|
[b, l.fieldValidationMode]
|
|
@@ -3613,13 +3613,13 @@ const Ut = ({ onClick: e, disabled: r = !1, t }) => {
|
|
|
3613
3613
|
ar,
|
|
3614
3614
|
{
|
|
3615
3615
|
name: ne,
|
|
3616
|
-
onChange: (
|
|
3617
|
-
ae(
|
|
3616
|
+
onChange: (z) => {
|
|
3617
|
+
ae(z), C(null), I(null);
|
|
3618
3618
|
}
|
|
3619
3619
|
}
|
|
3620
3620
|
),
|
|
3621
3621
|
/* @__PURE__ */ A(Ne, { children: [
|
|
3622
|
-
|
|
3622
|
+
Lt(
|
|
3623
3623
|
x,
|
|
3624
3624
|
g,
|
|
3625
3625
|
v,
|
|
@@ -3962,7 +3962,7 @@ function sn(e, r, t) {
|
|
|
3962
3962
|
return null;
|
|
3963
3963
|
}
|
|
3964
3964
|
const be = /* @__PURE__ */ new WeakMap();
|
|
3965
|
-
function
|
|
3965
|
+
function Le(e, r, t, n, ...a) {
|
|
3966
3966
|
if (e.pattern == null)
|
|
3967
3967
|
return null;
|
|
3968
3968
|
const o = String(r);
|
|
@@ -3983,7 +3983,7 @@ function Oe(e, r, t, n, ...a) {
|
|
|
3983
3983
|
}
|
|
3984
3984
|
function le(e, r, t) {
|
|
3985
3985
|
const n = String(r);
|
|
3986
|
-
return n.trim() === "" ? e.required ? t("Value required") : null : e.minLength !== void 0 && n.length < e.minLength ? t("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && n.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) :
|
|
3986
|
+
return n.trim() === "" ? e.required ? t("Value required") : null : e.minLength !== void 0 && n.length < e.minLength ? t("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && n.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : Le(e, r, t, "Invalid text format");
|
|
3987
3987
|
}
|
|
3988
3988
|
const Se = (e) => {
|
|
3989
3989
|
if (!e) return null;
|
|
@@ -4045,11 +4045,11 @@ function mn(e) {
|
|
|
4045
4045
|
}
|
|
4046
4046
|
function fn(e, r, t) {
|
|
4047
4047
|
const n = String(r ?? "").trim();
|
|
4048
|
-
return n === "" ? e.required ? t("Value required") : null : mn(n) ?
|
|
4048
|
+
return n === "" ? e.required ? t("Value required") : null : mn(n) ? Le(e, r, t, t("Email does not match pattern: {{1}}", e.pattern)) : t("Must be valid email format");
|
|
4049
4049
|
}
|
|
4050
4050
|
function dn(e, r, t) {
|
|
4051
4051
|
const n = String(r ?? "").trim();
|
|
4052
|
-
return n === "" ? e.required ? t("Value required") : null :
|
|
4052
|
+
return n === "" ? e.required ? t("Value required") : null : Le(e, n, t, "Invalid phone number format");
|
|
4053
4053
|
}
|
|
4054
4054
|
const pn = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]$/i, gn = (e) => {
|
|
4055
4055
|
try {
|
|
@@ -4533,7 +4533,7 @@ const Wn = ({
|
|
|
4533
4533
|
)
|
|
4534
4534
|
}
|
|
4535
4535
|
) : /* @__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." });
|
|
4536
|
-
},
|
|
4536
|
+
}, Z = /* @__PURE__ */ new Map(), W = {
|
|
4537
4537
|
components: /* @__PURE__ */ new Map(),
|
|
4538
4538
|
fieldValidators: /* @__PURE__ */ new Map(),
|
|
4539
4539
|
// category -> name -> plugin
|
|
@@ -4632,7 +4632,7 @@ function ie(e, r, t, n, a, o, c, i) {
|
|
|
4632
4632
|
}
|
|
4633
4633
|
function _n(e, r) {
|
|
4634
4634
|
const t = r?.conflictResolution || "error";
|
|
4635
|
-
if (
|
|
4635
|
+
if (Z.has(e.name)) {
|
|
4636
4636
|
const a = {
|
|
4637
4637
|
type: "plugin",
|
|
4638
4638
|
name: e.name,
|
|
@@ -4686,10 +4686,10 @@ function _n(e, r) {
|
|
|
4686
4686
|
n,
|
|
4687
4687
|
t,
|
|
4688
4688
|
r?.onConflict
|
|
4689
|
-
), e.setup && e.setup(),
|
|
4689
|
+
), e.setup && e.setup(), Z.set(e.name, e);
|
|
4690
4690
|
}
|
|
4691
4691
|
function Kn(e, r = !1) {
|
|
4692
|
-
const t =
|
|
4692
|
+
const t = Z.get(e);
|
|
4693
4693
|
if (!t) return !1;
|
|
4694
4694
|
if (t.cleanup && t.cleanup(), r) {
|
|
4695
4695
|
if (t.components)
|
|
@@ -4714,39 +4714,39 @@ function Kn(e, r = !1) {
|
|
|
4714
4714
|
for (const n of Object.keys(t.submissionHandlers))
|
|
4715
4715
|
W.submissionHandlers.delete(n);
|
|
4716
4716
|
}
|
|
4717
|
-
return
|
|
4717
|
+
return Z.delete(e), !0;
|
|
4718
4718
|
}
|
|
4719
4719
|
function Gn(e) {
|
|
4720
|
-
return
|
|
4720
|
+
return Z.get(e);
|
|
4721
4721
|
}
|
|
4722
4722
|
function Jn() {
|
|
4723
|
-
return Array.from(
|
|
4723
|
+
return Array.from(Z.values());
|
|
4724
4724
|
}
|
|
4725
4725
|
function Yn(e) {
|
|
4726
|
-
return
|
|
4726
|
+
return Z.has(e);
|
|
4727
4727
|
}
|
|
4728
4728
|
function Xn(e) {
|
|
4729
4729
|
for (const [r, t] of Object.entries(e))
|
|
4730
4730
|
yr(r, t);
|
|
4731
4731
|
}
|
|
4732
|
-
function
|
|
4732
|
+
function Q(e) {
|
|
4733
4733
|
return typeof e == "object" && e !== null;
|
|
4734
4734
|
}
|
|
4735
|
-
function
|
|
4736
|
-
if (!
|
|
4735
|
+
function Oe(e) {
|
|
4736
|
+
if (!Q(e)) return !1;
|
|
4737
4737
|
const r = e;
|
|
4738
4738
|
return typeof r.name == "string" && typeof r.displayName == "string";
|
|
4739
4739
|
}
|
|
4740
4740
|
function Fr(e) {
|
|
4741
|
-
if (!
|
|
4741
|
+
if (!Q(e)) return !1;
|
|
4742
4742
|
const r = e;
|
|
4743
|
-
return typeof r.name != "string" || typeof r.version != "string" || !Array.isArray(r.properties) ? !1 : r.properties.every((t) =>
|
|
4743
|
+
return typeof r.name != "string" || typeof r.version != "string" || !Array.isArray(r.properties) ? !1 : r.properties.every((t) => Oe(t));
|
|
4744
4744
|
}
|
|
4745
4745
|
function Ce(e) {
|
|
4746
4746
|
try {
|
|
4747
4747
|
return typeof File < "u" && e instanceof File;
|
|
4748
4748
|
} catch {
|
|
4749
|
-
const r =
|
|
4749
|
+
const r = Q(e) ? e : void 0;
|
|
4750
4750
|
return !!r && typeof r.name == "string" && typeof r.size == "number";
|
|
4751
4751
|
}
|
|
4752
4752
|
}
|
|
@@ -4765,7 +4765,7 @@ function Zn(e, r, t = {}) {
|
|
|
4765
4765
|
success: !1,
|
|
4766
4766
|
error: "Instance must be a valid object"
|
|
4767
4767
|
};
|
|
4768
|
-
const m = [], l = [], f = {}, g = (Fr(r) ||
|
|
4768
|
+
const m = [], l = [], f = {}, g = (Fr(r) || Q(r) && Array.isArray(r.properties) ? r.properties : []).filter(Oe), w = new Map(g.map((S) => [S.name, S]));
|
|
4769
4769
|
for (const [S, v] of Object.entries(e)) {
|
|
4770
4770
|
if (i.includes(S)) {
|
|
4771
4771
|
l.push(S);
|
|
@@ -4785,7 +4785,7 @@ function Zn(e, r, t = {}) {
|
|
|
4785
4785
|
}
|
|
4786
4786
|
return n && (f._metadata = {
|
|
4787
4787
|
serializedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4788
|
-
version: (
|
|
4788
|
+
version: (Q(r) ? r.version : void 0) || "1.0.0",
|
|
4789
4789
|
fieldCount: Object.keys(f).length - 1
|
|
4790
4790
|
// Exclude metadata itself
|
|
4791
4791
|
}), {
|
|
@@ -4901,7 +4901,7 @@ function Qn(e, r, t = {}) {
|
|
|
4901
4901
|
success: !1,
|
|
4902
4902
|
error: "Parsed data must be an object"
|
|
4903
4903
|
};
|
|
4904
|
-
const s = [], m = [], l = {}, d = (Fr(r) ||
|
|
4904
|
+
const s = [], m = [], l = {}, d = (Fr(r) || Q(r) && Array.isArray(r.properties) ? r.properties : []).filter(Oe), g = new Map(d.map((F) => [F.name, F]));
|
|
4905
4905
|
for (const F of d) {
|
|
4906
4906
|
const S = F.name, v = i[S];
|
|
4907
4907
|
if (v === void 0) {
|
|
@@ -5037,7 +5037,7 @@ function ra(e, r = {}) {
|
|
|
5037
5037
|
}
|
|
5038
5038
|
const s = Array.isArray(a.properties) ? a.properties : null;
|
|
5039
5039
|
s ? a.properties = s.map((l, f) => {
|
|
5040
|
-
const d =
|
|
5040
|
+
const d = Q(l) ? l : {}, g = { ...d };
|
|
5041
5041
|
if (!d.name) {
|
|
5042
5042
|
const w = `Property at index ${f} missing 'name'`;
|
|
5043
5043
|
t ? c.push(w) : (o.push(`${w}, using 'field_${f}'`), g.name = `field_${f}`);
|
|
@@ -5161,7 +5161,7 @@ function zn() {
|
|
|
5161
5161
|
if (!document.getElementById("reactaform-styles"))
|
|
5162
5162
|
try {
|
|
5163
5163
|
const e = document.createElement("style");
|
|
5164
|
-
e.id = "reactaform-styles", e.textContent =
|
|
5164
|
+
e.id = "reactaform-styles", e.textContent = Or, document.head.appendChild(e);
|
|
5165
5165
|
} catch {
|
|
5166
5166
|
}
|
|
5167
5167
|
}
|
|
@@ -5171,9 +5171,9 @@ export {
|
|
|
5171
5171
|
Wn as ReactaForm,
|
|
5172
5172
|
In as ReactaFormProvider,
|
|
5173
5173
|
Wt as ReactaFormRenderer,
|
|
5174
|
-
|
|
5174
|
+
L as StandardFieldLayout,
|
|
5175
5175
|
jn as Units,
|
|
5176
|
-
|
|
5176
|
+
q as combineClasses,
|
|
5177
5177
|
Fn as createInstanceFromDefinition,
|
|
5178
5178
|
ra as deserializeDefinition,
|
|
5179
5179
|
Qn as deserializeInstance,
|
|
@@ -5198,7 +5198,7 @@ export {
|
|
|
5198
5198
|
Kn as unregisterPlugin,
|
|
5199
5199
|
Un as upgradeInstanceToLatestDefinition,
|
|
5200
5200
|
Tr as useDebouncedCallback,
|
|
5201
|
-
|
|
5201
|
+
O as useFieldValidator,
|
|
5202
5202
|
j as useReactaFormContext,
|
|
5203
5203
|
_ as useUncontrolledValidatedInput,
|
|
5204
5204
|
Tn as validateFieldValue,
|