reactaform 1.1.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/{common-C-TIZ3UJ.js → common-CTK4jqc5.js} +8 -6
- package/dist/{common-CkBVkhXb.js → common-ClNcU_yE.js} +8 -6
- package/dist/{common-D4RlfeS8.js → common-DRxsgpaH.js} +8 -6
- package/dist/{common-CDu1xkTC.js → common-DXEjsP3o.js} +12 -10
- package/dist/index.d.ts +1 -1
- package/dist/reactaform.cjs.js +6 -6
- package/dist/reactaform.es.js +802 -727
- package/package.json +1 -1
package/dist/reactaform.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import N, { createContext as yr, useContext as xr, useRef as k, useEffect as C, useCallback as Z, useState as D, useMemo as G, memo as ve } from "react";
|
|
2
|
+
import Me from "react-dom";
|
|
3
|
+
const vr = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
4
4
|
\r
|
|
5
5
|
/* Default Light Theme */\r
|
|
6
6
|
:root {\r
|
|
@@ -289,7 +289,7 @@ const yr = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
|
289
289
|
`;
|
|
290
290
|
var be = { exports: {} }, de = {};
|
|
291
291
|
var qe;
|
|
292
|
-
function
|
|
292
|
+
function wr() {
|
|
293
293
|
if (qe) return de;
|
|
294
294
|
qe = 1;
|
|
295
295
|
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
@@ -312,12 +312,12 @@ function xr() {
|
|
|
312
312
|
}
|
|
313
313
|
var pe = {};
|
|
314
314
|
var Be;
|
|
315
|
-
function
|
|
315
|
+
function Sr() {
|
|
316
316
|
return Be || (Be = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
317
317
|
function e(h) {
|
|
318
318
|
if (h == null) return null;
|
|
319
319
|
if (typeof h == "function")
|
|
320
|
-
return h.$$typeof ===
|
|
320
|
+
return h.$$typeof === z ? null : h.displayName || h.name || null;
|
|
321
321
|
if (typeof h == "string") return h;
|
|
322
322
|
switch (h) {
|
|
323
323
|
case y:
|
|
@@ -328,27 +328,27 @@ function vr() {
|
|
|
328
328
|
return "StrictMode";
|
|
329
329
|
case j:
|
|
330
330
|
return "Suspense";
|
|
331
|
-
case
|
|
331
|
+
case I:
|
|
332
332
|
return "SuspenseList";
|
|
333
|
-
case
|
|
333
|
+
case M:
|
|
334
334
|
return "Activity";
|
|
335
335
|
}
|
|
336
336
|
if (typeof h == "object")
|
|
337
337
|
switch (typeof h.tag == "number" && console.error(
|
|
338
338
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
339
339
|
), h.$$typeof) {
|
|
340
|
-
case
|
|
340
|
+
case f:
|
|
341
341
|
return "Portal";
|
|
342
342
|
case R:
|
|
343
343
|
return h.displayName || "Context";
|
|
344
|
-
case
|
|
344
|
+
case F:
|
|
345
345
|
return (h._context.displayName || "Context") + ".Consumer";
|
|
346
346
|
case w:
|
|
347
347
|
var E = h.render;
|
|
348
348
|
return h = h.displayName, h || (h = E.displayName || E.name || "", h = h !== "" ? "ForwardRef(" + h + ")" : "ForwardRef"), h;
|
|
349
349
|
case S:
|
|
350
350
|
return E = h.displayName || null, E !== null ? E : e(h.type) || "Memo";
|
|
351
|
-
case
|
|
351
|
+
case A:
|
|
352
352
|
E = h._payload, h = h._init;
|
|
353
353
|
try {
|
|
354
354
|
return e(h(E));
|
|
@@ -379,7 +379,7 @@ function vr() {
|
|
|
379
379
|
}
|
|
380
380
|
function o(h) {
|
|
381
381
|
if (h === y) return "<>";
|
|
382
|
-
if (typeof h == "object" && h !== null && h.$$typeof ===
|
|
382
|
+
if (typeof h == "object" && h !== null && h.$$typeof === A)
|
|
383
383
|
return "<...>";
|
|
384
384
|
try {
|
|
385
385
|
var E = e(h);
|
|
@@ -459,19 +459,19 @@ function vr() {
|
|
|
459
459
|
if (U)
|
|
460
460
|
if (ce(_)) {
|
|
461
461
|
for (U = 0; U < _.length; U++)
|
|
462
|
-
|
|
462
|
+
p(_[U]);
|
|
463
463
|
Object.freeze && Object.freeze(_);
|
|
464
464
|
} else
|
|
465
465
|
console.error(
|
|
466
466
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
467
467
|
);
|
|
468
|
-
else
|
|
468
|
+
else p(_);
|
|
469
469
|
if (J.call(E, "key")) {
|
|
470
470
|
_ = e(h);
|
|
471
|
-
var
|
|
472
|
-
return
|
|
471
|
+
var V = Object.keys(E).filter(function(X) {
|
|
472
|
+
return X !== "key";
|
|
473
473
|
});
|
|
474
|
-
U = 0 <
|
|
474
|
+
U = 0 < V.length ? "{key: someKey, " + V.join(": ..., ") + ": ...}" : "{key: someKey}", O[_ + U] || (V = 0 < V.length ? "{" + V.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
475
475
|
`A props object containing a "key" prop is being spread into JSX:
|
|
476
476
|
let props = %s;
|
|
477
477
|
<%s {...props} />
|
|
@@ -480,9 +480,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
480
480
|
<%s key={someKey} {...props} />`,
|
|
481
481
|
U,
|
|
482
482
|
_,
|
|
483
|
-
|
|
483
|
+
V,
|
|
484
484
|
_
|
|
485
|
-
),
|
|
485
|
+
), O[_ + U] = !0);
|
|
486
486
|
}
|
|
487
487
|
if (_ = null, B !== void 0 && (n(B), _ = "" + B), s(E) && (n(E.key), _ = "" + E.key), "key" in E) {
|
|
488
488
|
B = {};
|
|
@@ -501,13 +501,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
501
501
|
ae
|
|
502
502
|
);
|
|
503
503
|
}
|
|
504
|
-
function
|
|
505
|
-
c(h) ? h._store && (h._store.validated = 1) : typeof h == "object" && h !== null && h.$$typeof ===
|
|
504
|
+
function p(h) {
|
|
505
|
+
c(h) ? h._store && (h._store.validated = 1) : typeof h == "object" && h !== null && h.$$typeof === A && (h._payload.status === "fulfilled" ? c(h._payload.value) && h._payload.value._store && (h._payload.value._store.validated = 1) : h._store && (h._store.validated = 1));
|
|
506
506
|
}
|
|
507
507
|
function c(h) {
|
|
508
508
|
return typeof h == "object" && h !== null && h.$$typeof === b;
|
|
509
509
|
}
|
|
510
|
-
var d =
|
|
510
|
+
var d = N, b = Symbol.for("react.transitional.element"), f = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), F = Symbol.for("react.consumer"), R = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), M = Symbol.for("react.activity"), z = Symbol.for("react.client.reference"), L = d.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ce = Array.isArray, re = console.createTask ? console.createTask : function() {
|
|
511
511
|
return null;
|
|
512
512
|
};
|
|
513
513
|
d = {
|
|
@@ -518,7 +518,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
518
518
|
var ue, Q = {}, oe = d.react_stack_bottom_frame.bind(
|
|
519
519
|
d,
|
|
520
520
|
a
|
|
521
|
-
)(), P = re(o(a)),
|
|
521
|
+
)(), P = re(o(a)), O = {};
|
|
522
522
|
pe.Fragment = y, pe.jsx = function(h, E, B) {
|
|
523
523
|
var U = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
524
524
|
return l(
|
|
@@ -543,12 +543,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
543
543
|
})()), pe;
|
|
544
544
|
}
|
|
545
545
|
var He;
|
|
546
|
-
function
|
|
547
|
-
return He || (He = 1, process.env.NODE_ENV === "production" ? be.exports =
|
|
546
|
+
function Cr() {
|
|
547
|
+
return He || (He = 1, process.env.NODE_ENV === "production" ? be.exports = wr() : be.exports = Sr()), be.exports;
|
|
548
548
|
}
|
|
549
|
-
var g =
|
|
550
|
-
const
|
|
551
|
-
const e =
|
|
549
|
+
var g = Cr();
|
|
550
|
+
const Oe = yr(void 0), T = () => {
|
|
551
|
+
const e = xr(Oe);
|
|
552
552
|
if (!e)
|
|
553
553
|
throw new Error("❌ useReactaFormContext must be used within a <ReactaFormProvider>");
|
|
554
554
|
return e;
|
|
@@ -591,7 +591,7 @@ class we {
|
|
|
591
591
|
return this.get(r) ?? n;
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function jr(e, r = 300, n) {
|
|
595
595
|
const o = k(void 0), t = k(e), a = k(null), s = k(!1);
|
|
596
596
|
C(() => {
|
|
597
597
|
t.current = e;
|
|
@@ -635,15 +635,15 @@ const $ = {
|
|
|
635
635
|
inputSelect: "reactaform-select",
|
|
636
636
|
rangeInput: "reactaform-input--range",
|
|
637
637
|
button: "reactaform-button"
|
|
638
|
-
},
|
|
638
|
+
}, K = (...e) => {
|
|
639
639
|
const r = [];
|
|
640
640
|
for (const n of e)
|
|
641
641
|
n && (typeof n == "string" ? r.push(n) : typeof n == "object" && Object.entries(n).forEach(([o, t]) => {
|
|
642
642
|
t && r.push(o);
|
|
643
643
|
}));
|
|
644
644
|
return r.join(" ");
|
|
645
|
-
},
|
|
646
|
-
const { t: o, darkMode: t, formStyle: a, fieldStyle: s } =
|
|
645
|
+
}, er = ({ content: e, size: r = "medium", animation: n = !0 }) => {
|
|
646
|
+
const { t: o, darkMode: t, formStyle: a, fieldStyle: s } = T(), [i, u] = D(!1), [m, l] = D({ x: 0, y: 0 }), [p, c] = D(!1), d = k(null), b = k(null), f = k(null), y = G(() => {
|
|
647
647
|
const R = {
|
|
648
648
|
icon: {
|
|
649
649
|
display: "inline-flex",
|
|
@@ -686,9 +686,9 @@ const $ = {
|
|
|
686
686
|
opacity: 1,
|
|
687
687
|
visibility: "visible"
|
|
688
688
|
}
|
|
689
|
-
}, w = (
|
|
690
|
-
const
|
|
691
|
-
return (
|
|
689
|
+
}, w = (I, S, A) => {
|
|
690
|
+
const z = I?.[S];
|
|
691
|
+
return (A && z ? z[A] : void 0) ?? {};
|
|
692
692
|
};
|
|
693
693
|
return {
|
|
694
694
|
icon: { ...R.icon, ...w(a, "tooltip", "icon"), ...w(s, "tooltip", "icon") },
|
|
@@ -698,41 +698,41 @@ const $ = {
|
|
|
698
698
|
}, [t, r, n, a, s]);
|
|
699
699
|
C(() => {
|
|
700
700
|
if (i) {
|
|
701
|
-
const
|
|
701
|
+
const F = requestAnimationFrame(() => c(!1)), R = requestAnimationFrame(() => {
|
|
702
702
|
if (d.current) {
|
|
703
703
|
const w = d.current.getBoundingClientRect(), j = 8;
|
|
704
|
-
|
|
705
|
-
const
|
|
706
|
-
l({ x:
|
|
704
|
+
f.current = w;
|
|
705
|
+
const I = w.right + j, S = w.top;
|
|
706
|
+
l({ x: I, y: S }), c(!0);
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
709
|
return () => {
|
|
710
|
-
cancelAnimationFrame(R), cancelAnimationFrame(
|
|
710
|
+
cancelAnimationFrame(R), cancelAnimationFrame(F);
|
|
711
711
|
};
|
|
712
712
|
} else
|
|
713
713
|
requestAnimationFrame(() => c(!1));
|
|
714
714
|
}, [i]), C(() => {
|
|
715
|
-
if (!
|
|
716
|
-
const
|
|
715
|
+
if (!p) return;
|
|
716
|
+
const F = requestAnimationFrame(() => {
|
|
717
717
|
if (!b.current) return;
|
|
718
|
-
const R = b.current.getBoundingClientRect(), w = 8, j = typeof window < "u" ? window.innerWidth : 1024,
|
|
719
|
-
let S = m.x,
|
|
720
|
-
const
|
|
721
|
-
|
|
718
|
+
const R = b.current.getBoundingClientRect(), w = 8, j = typeof window < "u" ? window.innerWidth : 1024, I = typeof window < "u" ? window.innerHeight : 768;
|
|
719
|
+
let S = m.x, A = m.y;
|
|
720
|
+
const M = f.current;
|
|
721
|
+
M && (S = M.right + w, A = M.top + M.height / 2 - R.height / 2 + -4, S + R.width > j - w && (S = M.left - w - R.width)), S + R.width > j - w && (S = Math.max(w, j - R.width - w)), S < w && (S = w), A + R.height > I - w && (A = Math.max(w, I - R.height - w)), A < w && (A = w), (S !== m.x || A !== m.y) && l({ x: S, y: A });
|
|
722
722
|
});
|
|
723
|
-
return () => cancelAnimationFrame(
|
|
724
|
-
}, [
|
|
723
|
+
return () => cancelAnimationFrame(F);
|
|
724
|
+
}, [p, m.x, m.y]);
|
|
725
725
|
const x = typeof document < "u" ? document.getElementById("popup-root") : null, v = /* @__PURE__ */ g.jsx(
|
|
726
726
|
"div",
|
|
727
727
|
{
|
|
728
728
|
ref: b,
|
|
729
729
|
style: {
|
|
730
730
|
...y.text,
|
|
731
|
-
transform:
|
|
731
|
+
transform: p ? "translateY(0) scale(1)" : "translateY(-4px) scale(0.98)",
|
|
732
732
|
transition: "opacity 120ms ease, transform 120ms ease, visibility 120ms ease",
|
|
733
733
|
width: 240,
|
|
734
734
|
// When positioned is true, apply the visible styles
|
|
735
|
-
...
|
|
735
|
+
...p ? y.textVisible : {},
|
|
736
736
|
top: m.y,
|
|
737
737
|
left: m.x
|
|
738
738
|
},
|
|
@@ -754,7 +754,7 @@ const $ = {
|
|
|
754
754
|
children: "?"
|
|
755
755
|
}
|
|
756
756
|
),
|
|
757
|
-
i && (x ?
|
|
757
|
+
i && (x ? Me.createPortal(v, x) : v)
|
|
758
758
|
] });
|
|
759
759
|
}, Re = ve(({
|
|
760
760
|
field: e,
|
|
@@ -762,7 +762,7 @@ const $ = {
|
|
|
762
762
|
children: n,
|
|
763
763
|
showLabel: o = !0
|
|
764
764
|
}) => {
|
|
765
|
-
const { t } =
|
|
765
|
+
const { t } = T(), a = e?.labelLayout === "column-center" ? "center" : "left";
|
|
766
766
|
return /* @__PURE__ */ g.jsxs(
|
|
767
767
|
"div",
|
|
768
768
|
{
|
|
@@ -799,7 +799,7 @@ const $ = {
|
|
|
799
799
|
},
|
|
800
800
|
children: [
|
|
801
801
|
/* @__PURE__ */ g.jsx("div", { style: { flex: 1, minWidth: 0, maxWidth: "100%" }, children: /* @__PURE__ */ g.jsx("div", { style: { width: "100%" }, children: n }) }),
|
|
802
|
-
e.tooltip && /* @__PURE__ */ g.jsx(
|
|
802
|
+
e.tooltip && /* @__PURE__ */ g.jsx(er, { content: e.tooltip })
|
|
803
803
|
]
|
|
804
804
|
}
|
|
805
805
|
),
|
|
@@ -809,13 +809,13 @@ const $ = {
|
|
|
809
809
|
);
|
|
810
810
|
});
|
|
811
811
|
Re.displayName = "ColumnFieldLayout";
|
|
812
|
-
const
|
|
812
|
+
const rr = ve(({
|
|
813
813
|
field: e,
|
|
814
814
|
error: r,
|
|
815
815
|
children: n,
|
|
816
816
|
rightAlign: o = !1
|
|
817
817
|
}) => {
|
|
818
|
-
const { t } =
|
|
818
|
+
const { t } = T(), a = G(() => ({
|
|
819
819
|
display: "flex",
|
|
820
820
|
flexDirection: "column",
|
|
821
821
|
gap: 0
|
|
@@ -850,19 +850,19 @@ const Qe = ve(({
|
|
|
850
850
|
children: n
|
|
851
851
|
}
|
|
852
852
|
) : n,
|
|
853
|
-
e.tooltip && /* @__PURE__ */ g.jsx(
|
|
853
|
+
e.tooltip && /* @__PURE__ */ g.jsx(er, { content: e.tooltip })
|
|
854
854
|
] }),
|
|
855
855
|
r && /* @__PURE__ */ g.jsx($e, { children: r })
|
|
856
856
|
] })
|
|
857
857
|
] });
|
|
858
858
|
});
|
|
859
|
-
|
|
859
|
+
rr.displayName = "RowFieldLayout";
|
|
860
860
|
const W = ({
|
|
861
861
|
field: e,
|
|
862
862
|
error: r,
|
|
863
863
|
children: n,
|
|
864
864
|
rightAlign: o = !1
|
|
865
|
-
}) => e?.labelLayout === "column-left" || e?.labelLayout === "column-center" ? /* @__PURE__ */ g.jsx(Re, { field: e, error: r, showLabel: !0, children: n }) : e?.type === "checkbox" || e?.type === "switch" ? /* @__PURE__ */ g.jsx(Re, { field: e, error: r, showLabel: !1, children: n }) : /* @__PURE__ */ g.jsx(
|
|
865
|
+
}) => e?.labelLayout === "column-left" || e?.labelLayout === "column-center" ? /* @__PURE__ */ g.jsx(Re, { field: e, error: r, showLabel: !0, children: n }) : e?.type === "checkbox" || e?.type === "switch" ? /* @__PURE__ */ g.jsx(Re, { field: e, error: r, showLabel: !1, children: n }) : /* @__PURE__ */ g.jsx(rr, { field: e, error: r, rightAlign: o, children: n }), $e = ve(({ children: e }) => {
|
|
866
866
|
const r = G(() => ({
|
|
867
867
|
color: "var(--reactaform-error-color)",
|
|
868
868
|
fontSize: "13px",
|
|
@@ -876,8 +876,8 @@ const W = ({
|
|
|
876
876
|
return /* @__PURE__ */ g.jsx("div", { style: r, children: e });
|
|
877
877
|
});
|
|
878
878
|
$e.displayName = "ErrorDiv";
|
|
879
|
-
const
|
|
880
|
-
const { t: n } =
|
|
879
|
+
const tr = ve(({ name: e, onChange: r }) => {
|
|
880
|
+
const { t: n } = T();
|
|
881
881
|
return /* @__PURE__ */ g.jsxs("div", { style: { marginBottom: 16 }, children: [
|
|
882
882
|
/* @__PURE__ */ g.jsxs("div", { style: { display: "grid", gridTemplateColumns: "1fr 2fr", gap: 12, alignItems: "center" }, children: [
|
|
883
883
|
/* @__PURE__ */ g.jsx(
|
|
@@ -917,8 +917,8 @@ const er = ve(({ name: e, onChange: r }) => {
|
|
|
917
917
|
/* @__PURE__ */ g.jsx("div", { style: { height: "1px", backgroundColor: "var(--reactaform-separator, #e6e6e6)", marginTop: 12, marginBottom: 12 } })
|
|
918
918
|
] });
|
|
919
919
|
});
|
|
920
|
-
|
|
921
|
-
class
|
|
920
|
+
tr.displayName = "InstanceName";
|
|
921
|
+
class kr extends we {
|
|
922
922
|
registerInCategory(r, n, o) {
|
|
923
923
|
this.get(r) || this.register(r, {});
|
|
924
924
|
const t = this.get(r);
|
|
@@ -934,25 +934,25 @@ class Cr extends we {
|
|
|
934
934
|
return this.list();
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
|
-
const
|
|
938
|
-
function
|
|
939
|
-
|
|
937
|
+
const nr = new we(), or = new kr();
|
|
938
|
+
function Zt(e, r) {
|
|
939
|
+
nr.register(e, r);
|
|
940
940
|
}
|
|
941
|
-
function
|
|
942
|
-
|
|
941
|
+
function Qt(e, r, n) {
|
|
942
|
+
or.registerInCategory(e, r, n);
|
|
943
943
|
}
|
|
944
|
-
function
|
|
945
|
-
return
|
|
944
|
+
function Rr(e, r) {
|
|
945
|
+
return or.getFromCategory(e, r) || null;
|
|
946
946
|
}
|
|
947
|
-
function
|
|
948
|
-
return
|
|
947
|
+
function Er(e) {
|
|
948
|
+
return nr.get(e) || null;
|
|
949
949
|
}
|
|
950
950
|
const Ce = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Map();
|
|
951
951
|
function Y(e, r, n, o) {
|
|
952
952
|
if (r && typeof r.validationHandlerName == "string") {
|
|
953
953
|
const t = `${e}:${r.validationHandlerName}`;
|
|
954
954
|
if (!Ce.has(t)) {
|
|
955
|
-
const s =
|
|
955
|
+
const s = Rr(e, r.validationHandlerName);
|
|
956
956
|
Ce.set(t, s);
|
|
957
957
|
}
|
|
958
958
|
const a = Ce.get(t);
|
|
@@ -961,11 +961,11 @@ function Y(e, r, n, o) {
|
|
|
961
961
|
}
|
|
962
962
|
return null;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function Nr(e, r, n) {
|
|
965
965
|
if (e && typeof e.validationHandlerName == "string") {
|
|
966
966
|
const o = e.validationHandlerName;
|
|
967
967
|
if (!je.has(o)) {
|
|
968
|
-
const a =
|
|
968
|
+
const a = Er(o);
|
|
969
969
|
je.set(o, a);
|
|
970
970
|
}
|
|
971
971
|
const t = je.get(o);
|
|
@@ -977,15 +977,15 @@ function Rr(e, r, n) {
|
|
|
977
977
|
function ie(e) {
|
|
978
978
|
return typeof e == "object" && e !== null;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function Ve(e) {
|
|
981
981
|
if (!ie(e)) return !1;
|
|
982
982
|
const r = e;
|
|
983
983
|
return typeof r.name == "string" && typeof r.displayName == "string";
|
|
984
984
|
}
|
|
985
|
-
function
|
|
985
|
+
function ar(e) {
|
|
986
986
|
if (!ie(e)) return !1;
|
|
987
987
|
const r = e;
|
|
988
|
-
return typeof r.name != "string" || typeof r.version != "string" || !Array.isArray(r.properties) ? !1 : r.properties.every((n) =>
|
|
988
|
+
return typeof r.name != "string" || typeof r.version != "string" || !Array.isArray(r.properties) ? !1 : r.properties.every((n) => Ve(n));
|
|
989
989
|
}
|
|
990
990
|
function Ee(e) {
|
|
991
991
|
try {
|
|
@@ -995,7 +995,7 @@ function Ee(e) {
|
|
|
995
995
|
return !!r && typeof r.name == "string" && typeof r.size == "number";
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
function
|
|
998
|
+
function en(e, r, n = {}) {
|
|
999
999
|
try {
|
|
1000
1000
|
const {
|
|
1001
1001
|
includeMetadata: o = !1,
|
|
@@ -1010,7 +1010,7 @@ function Qt(e, r, n = {}) {
|
|
|
1010
1010
|
success: !1,
|
|
1011
1011
|
error: "Instance must be a valid object"
|
|
1012
1012
|
};
|
|
1013
|
-
const m = [], l = [],
|
|
1013
|
+
const m = [], l = [], p = {}, d = (ar(r) || ie(r) && Array.isArray(r.properties) ? r.properties : []).filter(Ve), b = new Map(d.map((y) => [y.name, y]));
|
|
1014
1014
|
for (const [y, x] of Object.entries(e)) {
|
|
1015
1015
|
if (i.includes(y)) {
|
|
1016
1016
|
l.push(y);
|
|
@@ -1023,21 +1023,21 @@ function Qt(e, r, n = {}) {
|
|
|
1023
1023
|
if (x === void 0) continue;
|
|
1024
1024
|
const v = b.get(y);
|
|
1025
1025
|
try {
|
|
1026
|
-
|
|
1027
|
-
} catch (
|
|
1028
|
-
m.push(`Error serializing field '${y}': ${String(
|
|
1026
|
+
p[y] = Ir(x, v, { dateFormat: t, fileHandling: a });
|
|
1027
|
+
} catch (F) {
|
|
1028
|
+
m.push(`Error serializing field '${y}': ${String(F)}`), p[y] = null;
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
|
-
return o && (
|
|
1031
|
+
return o && (p._metadata = {
|
|
1032
1032
|
serializedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1033
1033
|
version: (ie(r) ? r.version : void 0) || "1.0.0",
|
|
1034
|
-
fieldCount: Object.keys(
|
|
1034
|
+
fieldCount: Object.keys(p).length - 1
|
|
1035
1035
|
// Exclude metadata itself
|
|
1036
1036
|
}), {
|
|
1037
1037
|
success: !0,
|
|
1038
|
-
data: s ? JSON.stringify(
|
|
1038
|
+
data: s ? JSON.stringify(p, null, 2) : JSON.stringify(p),
|
|
1039
1039
|
metadata: {
|
|
1040
|
-
fieldCount: Object.keys(
|
|
1040
|
+
fieldCount: Object.keys(p).length,
|
|
1041
1041
|
excludedFields: l,
|
|
1042
1042
|
warnings: m
|
|
1043
1043
|
}
|
|
@@ -1049,7 +1049,7 @@ function Qt(e, r, n = {}) {
|
|
|
1049
1049
|
};
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
|
-
function
|
|
1052
|
+
function Ir(e, r, n = {}) {
|
|
1053
1053
|
const { dateFormat: o = "iso", fileHandling: t = "metadata" } = n;
|
|
1054
1054
|
if (e == null)
|
|
1055
1055
|
return null;
|
|
@@ -1119,7 +1119,7 @@ function Ye(e, r) {
|
|
|
1119
1119
|
_note: "Base64 encoding requires async implementation"
|
|
1120
1120
|
};
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1122
|
+
function rn(e, r, n = {}) {
|
|
1123
1123
|
try {
|
|
1124
1124
|
const {
|
|
1125
1125
|
strict: o = !1,
|
|
@@ -1135,10 +1135,10 @@ function en(e, r, n = {}) {
|
|
|
1135
1135
|
let i;
|
|
1136
1136
|
try {
|
|
1137
1137
|
i = JSON.parse(e);
|
|
1138
|
-
} catch (
|
|
1138
|
+
} catch (f) {
|
|
1139
1139
|
return {
|
|
1140
1140
|
success: !1,
|
|
1141
|
-
error: `Invalid JSON: ${
|
|
1141
|
+
error: `Invalid JSON: ${f instanceof Error ? f.message : "Unknown parsing error"}`
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
1144
|
if (!i || typeof i != "object")
|
|
@@ -1146,23 +1146,23 @@ function en(e, r, n = {}) {
|
|
|
1146
1146
|
success: !1,
|
|
1147
1147
|
error: "Parsed data must be an object"
|
|
1148
1148
|
};
|
|
1149
|
-
const u = [], m = [], l = {}, c = (
|
|
1150
|
-
for (const
|
|
1151
|
-
const y =
|
|
1149
|
+
const u = [], m = [], l = {}, c = (ar(r) || ie(r) && Array.isArray(r.properties) ? r.properties : []).filter(Ve), d = new Map(c.map((f) => [f.name, f]));
|
|
1150
|
+
for (const f of c) {
|
|
1151
|
+
const y = f.name, x = i[y];
|
|
1152
1152
|
if (x === void 0) {
|
|
1153
|
-
o &&
|
|
1153
|
+
o && f.required && m.push(`Required field '${y}' is missing`);
|
|
1154
1154
|
continue;
|
|
1155
1155
|
}
|
|
1156
1156
|
try {
|
|
1157
|
-
l[y] =
|
|
1157
|
+
l[y] = Ar(x, f, { validateTypes: t, dateFormat: s });
|
|
1158
1158
|
} catch (v) {
|
|
1159
|
-
const
|
|
1160
|
-
o ? m.push(
|
|
1159
|
+
const F = `Error deserializing field '${y}': ${String(v)}`;
|
|
1160
|
+
o ? m.push(F) : (u.push(F), l[y] = x);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
1163
|
if (a)
|
|
1164
|
-
for (const [
|
|
1165
|
-
!d.has(
|
|
1164
|
+
for (const [f, y] of Object.entries(i))
|
|
1165
|
+
!d.has(f) && f !== "_metadata" && (o && u.push(`Unknown field '${f}' preserved`), l[f] = y);
|
|
1166
1166
|
const b = m.length > 0;
|
|
1167
1167
|
return {
|
|
1168
1168
|
success: !b,
|
|
@@ -1177,7 +1177,7 @@ function en(e, r, n = {}) {
|
|
|
1177
1177
|
};
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function Ar(e, r, n = {}) {
|
|
1181
1181
|
const { validateTypes: o = !0, dateFormat: t = "auto" } = n;
|
|
1182
1182
|
if (e == null)
|
|
1183
1183
|
return e;
|
|
@@ -1186,7 +1186,7 @@ function Nr(e, r, n = {}) {
|
|
|
1186
1186
|
case "date":
|
|
1187
1187
|
case "datetime":
|
|
1188
1188
|
case "date-time":
|
|
1189
|
-
return
|
|
1189
|
+
return Fr(e, t, o);
|
|
1190
1190
|
case "int":
|
|
1191
1191
|
case "integer":
|
|
1192
1192
|
return Ne(e, o);
|
|
@@ -1194,7 +1194,7 @@ function Nr(e, r, n = {}) {
|
|
|
1194
1194
|
case "number":
|
|
1195
1195
|
return Ie(e, o);
|
|
1196
1196
|
case "boolean":
|
|
1197
|
-
return
|
|
1197
|
+
return Mr(e, o);
|
|
1198
1198
|
case "int-array":
|
|
1199
1199
|
return Je(e, "integer", o);
|
|
1200
1200
|
case "float-array":
|
|
@@ -1214,7 +1214,7 @@ function Nr(e, r, n = {}) {
|
|
|
1214
1214
|
return e;
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1217
|
+
function tn(e, r = {}) {
|
|
1218
1218
|
try {
|
|
1219
1219
|
const { prettify: n = !0, includeMetadata: o = !0 } = r;
|
|
1220
1220
|
if (!e || typeof e != "object")
|
|
@@ -1243,7 +1243,7 @@ function rn(e, r = {}) {
|
|
|
1243
1243
|
};
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function nn(e, r = {}) {
|
|
1247
1247
|
try {
|
|
1248
1248
|
const { strict: n = !1, validateTypes: o = !0 } = r;
|
|
1249
1249
|
let t;
|
|
@@ -1281,13 +1281,13 @@ function tn(e, r = {}) {
|
|
|
1281
1281
|
break;
|
|
1282
1282
|
}
|
|
1283
1283
|
const u = Array.isArray(t.properties) ? t.properties : null;
|
|
1284
|
-
u ? t.properties = u.map((l,
|
|
1284
|
+
u ? t.properties = u.map((l, p) => {
|
|
1285
1285
|
const c = ie(l) ? l : {}, d = { ...c };
|
|
1286
1286
|
if (!c.name) {
|
|
1287
|
-
const b = `Property at index ${
|
|
1288
|
-
n ? s.push(b) : (a.push(`${b}, using 'field_${
|
|
1287
|
+
const b = `Property at index ${p} missing 'name'`;
|
|
1288
|
+
n ? s.push(b) : (a.push(`${b}, using 'field_${p}'`), d.name = `field_${p}`);
|
|
1289
1289
|
}
|
|
1290
|
-
return c.displayName || (d.displayName = c.name || `Field ${
|
|
1290
|
+
return c.displayName || (d.displayName = c.name || `Field ${p}`), c.type || (n && o ? s.push(`Property '${c.name || p}' missing 'type'`) : (a.push(`Property '${c.name || p}' missing 'type', using 'string'`), d.type = "string")), c.defaultValue === void 0 && (d.defaultValue = null), c.required === void 0 && (d.required = !1), d;
|
|
1291
1291
|
}) : n ? s.push("Properties must be an array") : (a.push("Properties not found or invalid, using empty array"), t.properties = []);
|
|
1292
1292
|
const m = s.length > 0;
|
|
1293
1293
|
return {
|
|
@@ -1303,7 +1303,7 @@ function tn(e, r = {}) {
|
|
|
1303
1303
|
};
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function Fr(e, r, n) {
|
|
1307
1307
|
if (e instanceof Date)
|
|
1308
1308
|
return e;
|
|
1309
1309
|
if (typeof e == "number") {
|
|
@@ -1348,7 +1348,7 @@ function Ie(e, r) {
|
|
|
1348
1348
|
throw new Error(`Cannot convert ${typeof e} to number`);
|
|
1349
1349
|
return e;
|
|
1350
1350
|
}
|
|
1351
|
-
function
|
|
1351
|
+
function Mr(e, r) {
|
|
1352
1352
|
if (typeof e == "boolean")
|
|
1353
1353
|
return e;
|
|
1354
1354
|
if (typeof e == "string") {
|
|
@@ -1382,7 +1382,7 @@ function Je(e, r, n) {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
});
|
|
1384
1384
|
}
|
|
1385
|
-
const
|
|
1385
|
+
const Or = (e, r) => {
|
|
1386
1386
|
const n = /* @__PURE__ */ new Map();
|
|
1387
1387
|
let o = null, t = null, a = 0;
|
|
1388
1388
|
for (const s of e) {
|
|
@@ -1404,7 +1404,7 @@ const Fr = (e, r) => {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
1406
|
return a;
|
|
1407
|
-
},
|
|
1407
|
+
}, $r = (e, r = {}) => {
|
|
1408
1408
|
const { includeEmpty: n = !0 } = r, o = [];
|
|
1409
1409
|
let t = null, a = [], s = 0;
|
|
1410
1410
|
for (const u of e) {
|
|
@@ -1421,21 +1421,21 @@ const Fr = (e, r) => {
|
|
|
1421
1421
|
largestGroup: i
|
|
1422
1422
|
}
|
|
1423
1423
|
};
|
|
1424
|
-
}, ke = /* @__PURE__ */ new Map(), ye = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Set(), Ae = /* @__PURE__ */ new Map(),
|
|
1424
|
+
}, ke = /* @__PURE__ */ new Map(), ye = /* @__PURE__ */ new Map(), se = /* @__PURE__ */ new Set(), Ae = /* @__PURE__ */ new Map(), Vr = async (e) => {
|
|
1425
1425
|
try {
|
|
1426
1426
|
let r;
|
|
1427
1427
|
switch (e.toLowerCase()) {
|
|
1428
1428
|
case "fr":
|
|
1429
|
-
r = (await import("./common-
|
|
1429
|
+
r = (await import("./common-CTK4jqc5.js")).default;
|
|
1430
1430
|
break;
|
|
1431
1431
|
case "de":
|
|
1432
|
-
r = (await import("./common-
|
|
1432
|
+
r = (await import("./common-ClNcU_yE.js")).default;
|
|
1433
1433
|
break;
|
|
1434
1434
|
case "es":
|
|
1435
|
-
r = (await import("./common-
|
|
1435
|
+
r = (await import("./common-DXEjsP3o.js")).default;
|
|
1436
1436
|
break;
|
|
1437
1437
|
case "zh-cn":
|
|
1438
|
-
r = (await import("./common-
|
|
1438
|
+
r = (await import("./common-DRxsgpaH.js")).default;
|
|
1439
1439
|
break;
|
|
1440
1440
|
case "en":
|
|
1441
1441
|
r = {};
|
|
@@ -1455,7 +1455,7 @@ const Fr = (e, r) => {
|
|
|
1455
1455
|
error: `Failed to load common translations for ${e}: ${r}`
|
|
1456
1456
|
};
|
|
1457
1457
|
}
|
|
1458
|
-
},
|
|
1458
|
+
}, Dr = async (e) => {
|
|
1459
1459
|
if (!e)
|
|
1460
1460
|
return { success: !1, translations: {}, error: "Language is required" };
|
|
1461
1461
|
const r = e.toLowerCase();
|
|
@@ -1467,13 +1467,13 @@ const Fr = (e, r) => {
|
|
|
1467
1467
|
translations: ke.get(r) || {},
|
|
1468
1468
|
fromCache: !0
|
|
1469
1469
|
};
|
|
1470
|
-
const n = await
|
|
1470
|
+
const n = await Vr(r);
|
|
1471
1471
|
return n.success && (ke.set(r, n.translations), Ae.set(r, {
|
|
1472
1472
|
loadedAt: /* @__PURE__ */ new Date(),
|
|
1473
1473
|
size: Object.keys(n.translations).length,
|
|
1474
1474
|
source: "common"
|
|
1475
1475
|
})), n;
|
|
1476
|
-
},
|
|
1476
|
+
}, zr = async (e, r) => {
|
|
1477
1477
|
if (!e || !r)
|
|
1478
1478
|
return {
|
|
1479
1479
|
success: !1,
|
|
@@ -1515,7 +1515,7 @@ const Fr = (e, r) => {
|
|
|
1515
1515
|
});
|
|
1516
1516
|
}
|
|
1517
1517
|
const a = t.headers.get("content-type") || "";
|
|
1518
|
-
!a.includes("application/json") && !a.includes("text/json") &&
|
|
1518
|
+
!a.includes("application/json") && !a.includes("text/json") && sr() && console.warn(
|
|
1519
1519
|
`Translation file at ${o} has unexpected content-type: ${a}`
|
|
1520
1520
|
);
|
|
1521
1521
|
const s = await t.text();
|
|
@@ -1570,7 +1570,7 @@ const Fr = (e, r) => {
|
|
|
1570
1570
|
};
|
|
1571
1571
|
}
|
|
1572
1572
|
};
|
|
1573
|
-
function
|
|
1573
|
+
function sr() {
|
|
1574
1574
|
try {
|
|
1575
1575
|
if (typeof process < "u" && process?.env?.NODE_ENV === "development")
|
|
1576
1576
|
return !0;
|
|
@@ -1578,7 +1578,7 @@ function or() {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
return !1;
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1581
|
+
function Tr(e, r) {
|
|
1582
1582
|
return r.length === 0 ? e : e.replace(/\{\{(\d+)\}\}/g, (n, o) => {
|
|
1583
1583
|
const t = parseInt(o, 10) - 1, a = r[t];
|
|
1584
1584
|
if (a == null)
|
|
@@ -1590,12 +1590,12 @@ function Vr(e, r) {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
});
|
|
1592
1592
|
}
|
|
1593
|
-
const
|
|
1593
|
+
const Lr = (e, r, n) => (o, ...t) => {
|
|
1594
1594
|
let a = o, s = !1;
|
|
1595
|
-
return !o || typeof o != "string" ? String(o || "") : (e.toLowerCase() === "en" ? (a = o, s = !0) : Object.prototype.hasOwnProperty.call(n, o) ? (a = n[o], s = !0) : Object.prototype.hasOwnProperty.call(r, o) ? (a = r[o], s = !0) : a = o, a =
|
|
1595
|
+
return !o || typeof o != "string" ? String(o || "") : (e.toLowerCase() === "en" ? (a = o, s = !0) : Object.prototype.hasOwnProperty.call(n, o) ? (a = n[o], s = !0) : Object.prototype.hasOwnProperty.call(r, o) ? (a = r[o], s = !0) : a = o, a = Tr(a, t), !s && sr() && console.debug(
|
|
1596
1596
|
`Missing translation for "${o}" in language "${e}"`
|
|
1597
1597
|
), a);
|
|
1598
|
-
},
|
|
1598
|
+
}, De = {
|
|
1599
1599
|
length: ["m", "cm", "mm", "km", "in", "ft", "yd", "mi"],
|
|
1600
1600
|
area: ["m^2", "cm^2", "mm^2", "in^2", "ft^2", "yd^2"],
|
|
1601
1601
|
volume: ["L", "m^3", "cm^3", "mL", "in^3", "ft^3", "yd^3"],
|
|
@@ -1603,7 +1603,7 @@ const Tr = (e, r, n) => (o, ...t) => {
|
|
|
1603
1603
|
time: ["min", "s", "h", "ms", "d"],
|
|
1604
1604
|
temperature: ["C", "F", "K"],
|
|
1605
1605
|
angle: ["deg", "rad", "rev"]
|
|
1606
|
-
},
|
|
1606
|
+
}, ze = {
|
|
1607
1607
|
length: {
|
|
1608
1608
|
m: "Meter (m)",
|
|
1609
1609
|
mm: "Millimeter (mm)",
|
|
@@ -1657,7 +1657,7 @@ const Tr = (e, r, n) => (o, ...t) => {
|
|
|
1657
1657
|
rad: "Radian (rad)",
|
|
1658
1658
|
rev: "Revolution (rev)"
|
|
1659
1659
|
}
|
|
1660
|
-
},
|
|
1660
|
+
}, Te = {
|
|
1661
1661
|
length: {
|
|
1662
1662
|
mm: 1e3,
|
|
1663
1663
|
cm: 100,
|
|
@@ -1712,13 +1712,13 @@ const Tr = (e, r, n) => (o, ...t) => {
|
|
|
1712
1712
|
rad: Math.PI / 180,
|
|
1713
1713
|
rev: 1 / 360
|
|
1714
1714
|
}
|
|
1715
|
-
}, Le = {},
|
|
1716
|
-
...Object.keys(
|
|
1717
|
-
...Object.keys(
|
|
1718
|
-
...Object.keys(
|
|
1715
|
+
}, Le = {}, Pr = /* @__PURE__ */ new Set([
|
|
1716
|
+
...Object.keys(De),
|
|
1717
|
+
...Object.keys(ze),
|
|
1718
|
+
...Object.keys(Te)
|
|
1719
1719
|
]);
|
|
1720
|
-
for (const e of
|
|
1721
|
-
const r = {}, n =
|
|
1720
|
+
for (const e of Pr) {
|
|
1721
|
+
const r = {}, n = De[e] ?? [], o = ze[e] ?? {}, t = Te[e] ?? {};
|
|
1722
1722
|
for (const a of n) {
|
|
1723
1723
|
const s = o[a];
|
|
1724
1724
|
r[a] = {
|
|
@@ -1736,19 +1736,19 @@ for (const e of zr) {
|
|
|
1736
1736
|
r[a] || (r[a] = { name: String(a), shortName: String(a), factor: s });
|
|
1737
1737
|
Le[e] = r;
|
|
1738
1738
|
}
|
|
1739
|
-
const
|
|
1739
|
+
const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1740
1740
|
__proto__: null,
|
|
1741
|
-
dimensionUnitDisplayMap:
|
|
1742
|
-
dimensionUnitsMap:
|
|
1743
|
-
dimensonUnitFactorsMap:
|
|
1741
|
+
dimensionUnitDisplayMap: ze,
|
|
1742
|
+
dimensionUnitsMap: De,
|
|
1743
|
+
dimensonUnitFactorsMap: Te,
|
|
1744
1744
|
unitsByDimension: Le
|
|
1745
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1745
|
+
}, Symbol.toStringTag, { value: "Module" })), _r = ({
|
|
1746
1746
|
field: e,
|
|
1747
1747
|
value: r,
|
|
1748
1748
|
onChange: n,
|
|
1749
1749
|
onError: o
|
|
1750
1750
|
}) => {
|
|
1751
|
-
const { definitionName: t, t: a } =
|
|
1751
|
+
const { definitionName: t, t: a } = T(), s = k(o);
|
|
1752
1752
|
C(() => {
|
|
1753
1753
|
s.current = o;
|
|
1754
1754
|
}, [o]), C(() => {
|
|
@@ -1756,8 +1756,8 @@ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1756
1756
|
s.current?.(l ?? null);
|
|
1757
1757
|
}, [r, e, t, a]);
|
|
1758
1758
|
const i = (l) => {
|
|
1759
|
-
const
|
|
1760
|
-
n?.(
|
|
1759
|
+
const p = l.target.checked;
|
|
1760
|
+
n?.(p, null);
|
|
1761
1761
|
}, u = (l) => {
|
|
1762
1762
|
(l.key === " " || l.key === "Spacebar" || l.key === "Space" || l.key === "Enter") && (l.preventDefault(), n?.(!r, null));
|
|
1763
1763
|
}, m = e.name;
|
|
@@ -1810,33 +1810,33 @@ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1810
1810
|
{ label: "Light Gray", value: "#d3d3d3" },
|
|
1811
1811
|
{ label: "Pink", value: "#ffc0cb" }
|
|
1812
1812
|
];
|
|
1813
|
-
function
|
|
1813
|
+
function ir(e) {
|
|
1814
1814
|
return /^#([0-9A-F]{3}){1,2}$/i.test(e);
|
|
1815
1815
|
}
|
|
1816
|
-
function
|
|
1817
|
-
if (!
|
|
1818
|
-
const r =
|
|
1816
|
+
function qr(e) {
|
|
1817
|
+
if (!ir(e)) return null;
|
|
1818
|
+
const r = cr(e), n = parseInt(r.slice(1), 16);
|
|
1819
1819
|
return {
|
|
1820
1820
|
r: n >> 16 & 255,
|
|
1821
1821
|
g: n >> 8 & 255,
|
|
1822
1822
|
b: n & 255
|
|
1823
1823
|
};
|
|
1824
1824
|
}
|
|
1825
|
-
function
|
|
1825
|
+
function cr(e) {
|
|
1826
1826
|
return e ? (e = e.toLowerCase(), /^#([a-f0-9]){3}$/i.test(e) ? "#" + e.slice(1).split("").map((r) => r + r).join("") : e) : "#000000";
|
|
1827
1827
|
}
|
|
1828
|
-
const
|
|
1829
|
-
const { t, definitionName: a } =
|
|
1830
|
-
|
|
1828
|
+
const Br = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
1829
|
+
const { t, definitionName: a } = T(), [s, i] = D("#000000"), u = N.useRef(null), m = N.useRef(null), l = N.useRef(o);
|
|
1830
|
+
N.useEffect(() => {
|
|
1831
1831
|
l.current = o;
|
|
1832
1832
|
}, [o]), C(() => {
|
|
1833
|
-
const x = r &&
|
|
1833
|
+
const x = r && ir(r) ? r : "#000000", v = cr(x);
|
|
1834
1834
|
i(v);
|
|
1835
|
-
}, [r]),
|
|
1835
|
+
}, [r]), N.useEffect(() => {
|
|
1836
1836
|
const x = Y(a, e, r ?? "#000000", t);
|
|
1837
1837
|
l.current?.(x ?? null);
|
|
1838
1838
|
}, [r, e, a, t]);
|
|
1839
|
-
const
|
|
1839
|
+
const p = (x) => {
|
|
1840
1840
|
const v = x.target.value;
|
|
1841
1841
|
i(v), n?.(v, null);
|
|
1842
1842
|
}, c = (x) => {
|
|
@@ -1844,7 +1844,7 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1844
1844
|
i(v), n?.(v, null);
|
|
1845
1845
|
}, d = Ge.find(
|
|
1846
1846
|
(x) => x.value === s
|
|
1847
|
-
), { r: b, g:
|
|
1847
|
+
), { r: b, g: f, b: y } = qr(s) || { r: 0, g: 0, b: 0 };
|
|
1848
1848
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: null, children: /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
|
|
1849
1849
|
/* @__PURE__ */ g.jsxs(
|
|
1850
1850
|
"select",
|
|
@@ -1852,16 +1852,16 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1852
1852
|
ref: u,
|
|
1853
1853
|
id: e.name,
|
|
1854
1854
|
value: s,
|
|
1855
|
-
onChange:
|
|
1855
|
+
onChange: p,
|
|
1856
1856
|
style: { minWidth: "120px", flex: 1 },
|
|
1857
|
-
className:
|
|
1857
|
+
className: K($.input, $.inputSelect),
|
|
1858
1858
|
children: [
|
|
1859
1859
|
Ge.map((x) => /* @__PURE__ */ g.jsx("option", { value: x.value, children: t(x.label) }, x.value)),
|
|
1860
1860
|
d ? null : /* @__PURE__ */ g.jsxs("option", { value: s, children: [
|
|
1861
1861
|
"(",
|
|
1862
1862
|
b,
|
|
1863
1863
|
", ",
|
|
1864
|
-
|
|
1864
|
+
f,
|
|
1865
1865
|
", ",
|
|
1866
1866
|
y,
|
|
1867
1867
|
")"
|
|
@@ -1907,7 +1907,7 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1907
1907
|
if (!e) return null;
|
|
1908
1908
|
const r = new Date(e);
|
|
1909
1909
|
return isNaN(r.getTime()) ? null : r;
|
|
1910
|
-
},
|
|
1910
|
+
}, Hr = (e) => {
|
|
1911
1911
|
if (!e) return "";
|
|
1912
1912
|
if (/^\d{4}-\d{2}-\d{2}$/.test(e))
|
|
1913
1913
|
return ge(e) ? e : "";
|
|
@@ -1917,35 +1917,35 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1917
1917
|
return `${o}-${t}-${a}`;
|
|
1918
1918
|
}
|
|
1919
1919
|
return "";
|
|
1920
|
-
},
|
|
1920
|
+
}, Ur = ({
|
|
1921
1921
|
field: e,
|
|
1922
1922
|
value: r,
|
|
1923
1923
|
onChange: n,
|
|
1924
1924
|
onError: o
|
|
1925
1925
|
}) => {
|
|
1926
|
-
const { t, definitionName: a } =
|
|
1926
|
+
const { t, definitionName: a } = T(), { name: s, required: i } = e, u = k(null), m = k(o);
|
|
1927
1927
|
C(() => {
|
|
1928
1928
|
m.current = o;
|
|
1929
1929
|
}, [o]);
|
|
1930
|
-
const l =
|
|
1930
|
+
const l = N.useCallback((c) => {
|
|
1931
1931
|
if (!c || c.trim() === "")
|
|
1932
1932
|
return i ? t("Value required") : null;
|
|
1933
1933
|
if (c) {
|
|
1934
1934
|
const b = ge(c);
|
|
1935
1935
|
if (!b) return t("Invalid date format");
|
|
1936
1936
|
if (e.minDate) {
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1937
|
+
const f = ge(e.minDate);
|
|
1938
|
+
if (f && b.getTime() < f.getTime())
|
|
1939
1939
|
return t("Date must be on or after {{1}}", e.minDate);
|
|
1940
1940
|
}
|
|
1941
1941
|
if (e.maxDate) {
|
|
1942
|
-
const
|
|
1943
|
-
if (
|
|
1942
|
+
const f = ge(e.maxDate);
|
|
1943
|
+
if (f && b.getTime() > f.getTime())
|
|
1944
1944
|
return t("Date must be on or before {{1}}", e.maxDate);
|
|
1945
1945
|
}
|
|
1946
1946
|
}
|
|
1947
1947
|
return Y(a, e, c, t) ?? null;
|
|
1948
|
-
}, [e, a, t, i]),
|
|
1948
|
+
}, [e, a, t, i]), p = (c) => {
|
|
1949
1949
|
const d = c.target.value, b = l(d);
|
|
1950
1950
|
n?.(d, b);
|
|
1951
1951
|
};
|
|
@@ -1957,22 +1957,22 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1957
1957
|
{
|
|
1958
1958
|
id: s,
|
|
1959
1959
|
type: "date",
|
|
1960
|
-
value:
|
|
1961
|
-
onChange:
|
|
1962
|
-
className:
|
|
1960
|
+
value: Hr(r),
|
|
1961
|
+
onChange: p,
|
|
1962
|
+
className: K($.input, $.textInput),
|
|
1963
1963
|
...e.minDate ? { min: e.minDate } : {},
|
|
1964
1964
|
...e.maxDate ? { max: e.maxDate } : {},
|
|
1965
1965
|
"aria-invalid": !!l(r),
|
|
1966
1966
|
"aria-describedby": l(r) ? `${s}-error` : void 0
|
|
1967
1967
|
}
|
|
1968
1968
|
) });
|
|
1969
|
-
},
|
|
1969
|
+
}, Wr = ({
|
|
1970
1970
|
field: e,
|
|
1971
1971
|
value: r,
|
|
1972
1972
|
onChange: n,
|
|
1973
1973
|
onError: o
|
|
1974
1974
|
}) => {
|
|
1975
|
-
const { t, definitionName: a } =
|
|
1975
|
+
const { t, definitionName: a } = T(), s = k(null), i = k(o);
|
|
1976
1976
|
C(() => {
|
|
1977
1977
|
i.current = o;
|
|
1978
1978
|
}, [o]);
|
|
@@ -1981,16 +1981,16 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1981
1981
|
[e, t, a]
|
|
1982
1982
|
);
|
|
1983
1983
|
C(() => {
|
|
1984
|
-
const l = r != null ? String(r) : "",
|
|
1985
|
-
if (
|
|
1984
|
+
const l = r != null ? String(r) : "", p = u(l);
|
|
1985
|
+
if (p && e.options && e.options.length > 0) {
|
|
1986
1986
|
const c = String(e.options[0].value);
|
|
1987
1987
|
s.current && (s.current.value = c), n?.(c, null), i.current?.(null);
|
|
1988
1988
|
} else
|
|
1989
|
-
s.current && (s.current.value = l), i.current?.(
|
|
1989
|
+
s.current && (s.current.value = l), i.current?.(p ?? null);
|
|
1990
1990
|
}, [r, u, n, e.options]);
|
|
1991
1991
|
const m = (l) => {
|
|
1992
|
-
const
|
|
1993
|
-
n?.(
|
|
1992
|
+
const p = l.target.value, c = u(p);
|
|
1993
|
+
n?.(p, c);
|
|
1994
1994
|
};
|
|
1995
1995
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
1996
1996
|
"select",
|
|
@@ -1998,7 +1998,7 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1998
1998
|
defaultValue: String(r ?? ""),
|
|
1999
1999
|
ref: s,
|
|
2000
2000
|
onChange: m,
|
|
2001
|
-
className:
|
|
2001
|
+
className: K(
|
|
2002
2002
|
$.input,
|
|
2003
2003
|
$.inputSelect
|
|
2004
2004
|
),
|
|
@@ -2006,32 +2006,32 @@ const _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
) });
|
|
2008
2008
|
};
|
|
2009
|
-
function
|
|
2009
|
+
function Yr(e) {
|
|
2010
2010
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
2011
2011
|
}
|
|
2012
|
-
const
|
|
2012
|
+
const Jr = ({
|
|
2013
2013
|
field: e,
|
|
2014
2014
|
value: r,
|
|
2015
2015
|
onChange: n,
|
|
2016
2016
|
onError: o
|
|
2017
2017
|
}) => {
|
|
2018
|
-
const { definitionName: t, t: a } =
|
|
2019
|
-
(
|
|
2020
|
-
const c =
|
|
2021
|
-
return c === "" ? e.required ? a("Value required") : null :
|
|
2018
|
+
const { definitionName: t, t: a } = T(), s = k(null), i = N.useCallback(
|
|
2019
|
+
(p) => {
|
|
2020
|
+
const c = p.trim();
|
|
2021
|
+
return c === "" ? e.required ? a("Value required") : null : Yr(c) ? e.pattern && !new RegExp(e.pattern).test(c) ? a("Email does not match pattern: {{%1}}", {
|
|
2022
2022
|
"%1": `${e.pattern}`
|
|
2023
|
-
}) : Y(t, e,
|
|
2023
|
+
}) : Y(t, e, p, a) ?? null : a("Must be valid email format");
|
|
2024
2024
|
},
|
|
2025
2025
|
[e, t, a]
|
|
2026
|
-
), u = (
|
|
2027
|
-
const c =
|
|
2026
|
+
), u = (p) => {
|
|
2027
|
+
const c = p.target.value, d = i(c);
|
|
2028
2028
|
n?.(c, d);
|
|
2029
2029
|
}, m = k(null), l = k(o);
|
|
2030
2030
|
return C(() => {
|
|
2031
2031
|
l.current = o;
|
|
2032
2032
|
}, [o]), C(() => {
|
|
2033
|
-
const
|
|
2034
|
-
s.current && s.current.value !== String(
|
|
2033
|
+
const p = r ?? "", c = i(p);
|
|
2034
|
+
s.current && s.current.value !== String(p) && (s.current.value = String(p)), c !== m.current && (m.current = c, l.current?.(c ?? null));
|
|
2035
2035
|
}, [r, i]), /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
2036
2036
|
"input",
|
|
2037
2037
|
{
|
|
@@ -2040,11 +2040,11 @@ const Wr = ({
|
|
|
2040
2040
|
defaultValue: String(r ?? ""),
|
|
2041
2041
|
ref: s,
|
|
2042
2042
|
onChange: u,
|
|
2043
|
-
className:
|
|
2043
|
+
className: K($.input, $.textInput)
|
|
2044
2044
|
}
|
|
2045
2045
|
) });
|
|
2046
|
-
},
|
|
2047
|
-
const { darkMode: r } =
|
|
2046
|
+
}, Gr = ({ field: e }) => {
|
|
2047
|
+
const { darkMode: r } = T(), {
|
|
2048
2048
|
color: n = r ? "#444444" : "#CCCCCC",
|
|
2049
2049
|
thickness: o = 1,
|
|
2050
2050
|
margin: t = "8px 0"
|
|
@@ -2061,33 +2061,33 @@ const Wr = ({
|
|
|
2061
2061
|
}
|
|
2062
2062
|
}
|
|
2063
2063
|
);
|
|
2064
|
-
},
|
|
2065
|
-
const { t, definitionName: a } =
|
|
2064
|
+
}, Kr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
2065
|
+
const { t, definitionName: a } = T(), [s, i] = D(!1), u = k(null), m = k(o);
|
|
2066
2066
|
C(() => {
|
|
2067
2067
|
m.current = o;
|
|
2068
2068
|
}, [o]);
|
|
2069
|
-
const l =
|
|
2069
|
+
const l = N.useCallback(
|
|
2070
2070
|
(v) => e.required && (!v || Array.isArray(v) && v.length === 0) ? t("Value required") : Y(a, e, v, t) ?? null,
|
|
2071
2071
|
[e, a, t]
|
|
2072
|
-
),
|
|
2072
|
+
), p = N.useMemo(() => l(r), [r, l]);
|
|
2073
2073
|
C(() => {
|
|
2074
2074
|
const v = l(r);
|
|
2075
2075
|
n?.(r, v), m.current?.(v ?? null);
|
|
2076
2076
|
}, [r, l]);
|
|
2077
2077
|
const c = (v) => {
|
|
2078
|
-
const
|
|
2078
|
+
const F = v.target.files;
|
|
2079
2079
|
let R = null;
|
|
2080
|
-
if (
|
|
2081
|
-
const j = Array.from(
|
|
2080
|
+
if (F && F.length > 0) {
|
|
2081
|
+
const j = Array.from(F);
|
|
2082
2082
|
e.multiple ? R = [...Array.isArray(r) ? r : [], ...j] : R = j[0];
|
|
2083
2083
|
}
|
|
2084
2084
|
const w = l(R);
|
|
2085
2085
|
n?.(R, w);
|
|
2086
2086
|
}, d = (v) => {
|
|
2087
2087
|
v.preventDefault(), v.stopPropagation(), i(!1);
|
|
2088
|
-
const
|
|
2089
|
-
if (
|
|
2090
|
-
const R = Array.from(
|
|
2088
|
+
const F = v.dataTransfer.files;
|
|
2089
|
+
if (F && F.length > 0) {
|
|
2090
|
+
const R = Array.from(F);
|
|
2091
2091
|
let w = null;
|
|
2092
2092
|
e.multiple ? w = [...Array.isArray(r) ? r : [], ...R] : w = R[0];
|
|
2093
2093
|
const j = l(w);
|
|
@@ -2095,15 +2095,15 @@ const Wr = ({
|
|
|
2095
2095
|
}
|
|
2096
2096
|
}, b = (v) => {
|
|
2097
2097
|
v.preventDefault(), v.stopPropagation(), i(!0);
|
|
2098
|
-
},
|
|
2098
|
+
}, f = (v) => {
|
|
2099
2099
|
v.preventDefault(), v.stopPropagation(), i(!1);
|
|
2100
2100
|
}, y = (v) => {
|
|
2101
2101
|
if (Array.isArray(r) && typeof v == "number") {
|
|
2102
|
-
const
|
|
2102
|
+
const F = r.filter((j, I) => I !== v), R = F.length > 0 ? F : null, w = l(R);
|
|
2103
2103
|
n?.(R, w);
|
|
2104
2104
|
} else {
|
|
2105
|
-
const
|
|
2106
|
-
n?.(null,
|
|
2105
|
+
const F = l(null);
|
|
2106
|
+
n?.(null, F);
|
|
2107
2107
|
}
|
|
2108
2108
|
}, x = () => {
|
|
2109
2109
|
const v = Array.isArray(r) ? r : r ? [r] : [];
|
|
@@ -2112,7 +2112,7 @@ const Wr = ({
|
|
|
2112
2112
|
display: "flex",
|
|
2113
2113
|
flexDirection: "column",
|
|
2114
2114
|
gap: "6px"
|
|
2115
|
-
}, children: v.map((
|
|
2115
|
+
}, children: v.map((F, R) => /* @__PURE__ */ g.jsxs(
|
|
2116
2116
|
"div",
|
|
2117
2117
|
{
|
|
2118
2118
|
style: {
|
|
@@ -2133,7 +2133,7 @@ const Wr = ({
|
|
|
2133
2133
|
overflow: "hidden",
|
|
2134
2134
|
textOverflow: "ellipsis",
|
|
2135
2135
|
whiteSpace: "nowrap"
|
|
2136
|
-
}, children:
|
|
2136
|
+
}, children: F.name }),
|
|
2137
2137
|
/* @__PURE__ */ g.jsx(
|
|
2138
2138
|
"button",
|
|
2139
2139
|
{
|
|
@@ -2163,19 +2163,19 @@ const Wr = ({
|
|
|
2163
2163
|
)
|
|
2164
2164
|
]
|
|
2165
2165
|
},
|
|
2166
|
-
`${
|
|
2166
|
+
`${F.name}-${R}`
|
|
2167
2167
|
)) });
|
|
2168
2168
|
};
|
|
2169
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error:
|
|
2169
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: p, children: /* @__PURE__ */ g.jsxs("div", { style: { width: "100%" }, children: [
|
|
2170
2170
|
/* @__PURE__ */ g.jsxs(
|
|
2171
2171
|
"div",
|
|
2172
2172
|
{
|
|
2173
2173
|
onDrop: d,
|
|
2174
2174
|
onDragOver: b,
|
|
2175
|
-
onDragLeave:
|
|
2175
|
+
onDragLeave: f,
|
|
2176
2176
|
style: {
|
|
2177
2177
|
position: "relative",
|
|
2178
|
-
border: `1px dashed ${s ? "var(--reactaform-color-primary, #2563eb)" :
|
|
2178
|
+
border: `1px dashed ${s ? "var(--reactaform-color-primary, #2563eb)" : p ? "var(--reactaform-color-error, #ef4444)" : "var(--reactaform-border-color, #d1d5db)"}`,
|
|
2179
2179
|
borderRadius: "var(--reactaform-border-radius, 4px)",
|
|
2180
2180
|
padding: "8px 12px",
|
|
2181
2181
|
textAlign: "center",
|
|
@@ -2234,37 +2234,37 @@ const Wr = ({
|
|
|
2234
2234
|
),
|
|
2235
2235
|
x()
|
|
2236
2236
|
] }) });
|
|
2237
|
-
},
|
|
2238
|
-
function
|
|
2239
|
-
return e.split(",").map((r) => r.trim()).every((r) =>
|
|
2237
|
+
}, Xr = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
2238
|
+
function Zr(e) {
|
|
2239
|
+
return e.split(",").map((r) => r.trim()).every((r) => Xr.test(r));
|
|
2240
2240
|
}
|
|
2241
|
-
const
|
|
2241
|
+
const Qr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim()).filter(Boolean).map(Number), et = ({
|
|
2242
2242
|
field: e,
|
|
2243
2243
|
value: r,
|
|
2244
2244
|
onChange: n,
|
|
2245
2245
|
onError: o
|
|
2246
2246
|
}) => {
|
|
2247
|
-
const { t, definitionName: a } =
|
|
2247
|
+
const { t, definitionName: a } = T(), [s, i] = D(
|
|
2248
2248
|
Array.isArray(r) ? r.join(", ") : String(r ?? "")
|
|
2249
|
-
), u =
|
|
2249
|
+
), u = N.useCallback(
|
|
2250
2250
|
(c) => {
|
|
2251
2251
|
if (c.trim() === "")
|
|
2252
2252
|
return e.required ? t("Value required") : null;
|
|
2253
|
-
if (!
|
|
2253
|
+
if (!Zr(c))
|
|
2254
2254
|
return t("Each value must be a valid float");
|
|
2255
|
-
const d =
|
|
2255
|
+
const d = Qr(c);
|
|
2256
2256
|
if (e.minCount !== void 0 && d.length < e.minCount)
|
|
2257
2257
|
return t("Minimum number of values: {{1}}", e.minCount);
|
|
2258
2258
|
if (e.maxCount !== void 0 && d.length > e.maxCount)
|
|
2259
2259
|
return t("Maximum number of values: {{1}}", e.maxCount);
|
|
2260
|
-
for (const
|
|
2261
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
2260
|
+
for (const f of d) {
|
|
2261
|
+
if (e.min !== void 0 && (e.minInclusive ? f < e.min : f <= e.min))
|
|
2262
2262
|
return t(
|
|
2263
2263
|
"Each value must be {{1}} {{2}}",
|
|
2264
2264
|
e.minInclusive ? "≥" : ">",
|
|
2265
2265
|
e.min
|
|
2266
2266
|
);
|
|
2267
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
2267
|
+
if (e.max !== void 0 && (e.maxInclusive ? f > e.max : f >= e.max))
|
|
2268
2268
|
return t(
|
|
2269
2269
|
"Each value must be {{1}} {{2}}",
|
|
2270
2270
|
e.maxInclusive ? "≤" : "<",
|
|
@@ -2277,38 +2277,38 @@ const Xr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
|
|
|
2277
2277
|
), m = (c) => {
|
|
2278
2278
|
const d = c.target.value, b = u(d);
|
|
2279
2279
|
i(d), n?.(d, b);
|
|
2280
|
-
}, l = k(null),
|
|
2280
|
+
}, l = k(null), p = k(o);
|
|
2281
2281
|
return C(() => {
|
|
2282
|
-
|
|
2282
|
+
p.current = o;
|
|
2283
2283
|
}, [o]), C(() => {
|
|
2284
2284
|
const c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), d = u(c);
|
|
2285
|
-
d !== l.current && (l.current = d,
|
|
2285
|
+
d !== l.current && (l.current = d, p.current?.(d ?? null));
|
|
2286
2286
|
}, [r, e.required, u, t]), /* @__PURE__ */ g.jsx(W, { field: e, error: u(s), children: /* @__PURE__ */ g.jsx(
|
|
2287
2287
|
"input",
|
|
2288
2288
|
{
|
|
2289
2289
|
type: "text",
|
|
2290
2290
|
value: s,
|
|
2291
2291
|
onChange: m,
|
|
2292
|
-
className:
|
|
2292
|
+
className: K($.input, $.textInput),
|
|
2293
2293
|
style: { flex: 1 }
|
|
2294
2294
|
}
|
|
2295
2295
|
) });
|
|
2296
|
-
},
|
|
2296
|
+
}, rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, tt = (e) => {
|
|
2297
2297
|
const r = Number.parseFloat(e);
|
|
2298
2298
|
return Number.isNaN(r) ? null : r;
|
|
2299
|
-
},
|
|
2299
|
+
}, nt = ({
|
|
2300
2300
|
field: e,
|
|
2301
2301
|
value: r,
|
|
2302
2302
|
onChange: n,
|
|
2303
2303
|
onError: o
|
|
2304
2304
|
}) => {
|
|
2305
|
-
const { t, definitionName: a } =
|
|
2306
|
-
(
|
|
2307
|
-
if (
|
|
2305
|
+
const { t, definitionName: a } = T(), s = k(null), i = N.useCallback(
|
|
2306
|
+
(p) => {
|
|
2307
|
+
if (p.trim() === "")
|
|
2308
2308
|
return e.required ? t("Value required") : null;
|
|
2309
|
-
if (!
|
|
2309
|
+
if (!rt.test(p))
|
|
2310
2310
|
return t("Must be a valid float");
|
|
2311
|
-
const c =
|
|
2311
|
+
const c = tt(p);
|
|
2312
2312
|
return c === null ? t("Must be a valid float") : e.min !== void 0 && (e.minInclusive ? c < e.min : c <= e.min) ? t(
|
|
2313
2313
|
"Must be {{1}} {{2}}",
|
|
2314
2314
|
e.minInclusive ? "≥" : ">",
|
|
@@ -2324,11 +2324,11 @@ const Xr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
|
|
|
2324
2324
|
C(() => {
|
|
2325
2325
|
m.current = o;
|
|
2326
2326
|
}, [o]), C(() => {
|
|
2327
|
-
const
|
|
2328
|
-
c !== u.current && (u.current = c, m.current?.(c ?? null)), s.current && document.activeElement !== s.current && (s.current.value =
|
|
2327
|
+
const p = String(r ?? ""), c = i(p);
|
|
2328
|
+
c !== u.current && (u.current = c, m.current?.(c ?? null)), s.current && document.activeElement !== s.current && (s.current.value = p);
|
|
2329
2329
|
}, [r, e, i, t]);
|
|
2330
|
-
const l = (
|
|
2331
|
-
const c =
|
|
2330
|
+
const l = (p) => {
|
|
2331
|
+
const c = p.target.value, d = i(c);
|
|
2332
2332
|
n?.(c, d);
|
|
2333
2333
|
};
|
|
2334
2334
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
@@ -2339,14 +2339,14 @@ const Xr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
|
|
|
2339
2339
|
defaultValue: String(r ?? ""),
|
|
2340
2340
|
ref: s,
|
|
2341
2341
|
onChange: l,
|
|
2342
|
-
className:
|
|
2342
|
+
className: K(
|
|
2343
2343
|
$.input,
|
|
2344
2344
|
$.inputNumber
|
|
2345
2345
|
)
|
|
2346
2346
|
}
|
|
2347
2347
|
) });
|
|
2348
2348
|
};
|
|
2349
|
-
function
|
|
2349
|
+
function ot() {
|
|
2350
2350
|
try {
|
|
2351
2351
|
return "/";
|
|
2352
2352
|
} catch {
|
|
@@ -2358,46 +2358,46 @@ function tt() {
|
|
|
2358
2358
|
}
|
|
2359
2359
|
return "/";
|
|
2360
2360
|
}
|
|
2361
|
-
const
|
|
2362
|
-
const { language: n, t: o } =
|
|
2361
|
+
const at = ({ field: e, value: r }) => {
|
|
2362
|
+
const { language: n, t: o } = T(), t = e.alignment || "center", a = {
|
|
2363
2363
|
left: "flex-start",
|
|
2364
2364
|
center: "center",
|
|
2365
2365
|
right: "flex-end"
|
|
2366
2366
|
}, s = typeof r == "string" ? r : "";
|
|
2367
2367
|
let i = s && s.trim() !== "" ? s : typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
2368
|
-
i && !i.startsWith("/") && (i = `${
|
|
2369
|
-
const u = e.localized?.split(";").map((y) => y.trim()), [m, l] =
|
|
2368
|
+
i && !i.startsWith("/") && (i = `${ot()}${i}`);
|
|
2369
|
+
const u = e.localized?.split(";").map((y) => y.trim()), [m, l] = D(i || ""), p = k(i || null);
|
|
2370
2370
|
if (C(() => {
|
|
2371
2371
|
if (!i) return;
|
|
2372
2372
|
const y = i.split("/"), x = y.pop(), v = x.lastIndexOf(".");
|
|
2373
2373
|
if (v === -1) return;
|
|
2374
|
-
const
|
|
2374
|
+
const F = x.substring(0, v), R = x.substring(v);
|
|
2375
2375
|
let w = null;
|
|
2376
|
-
u?.includes(n) && (w = `${
|
|
2376
|
+
u?.includes(n) && (w = `${F}_${n}${R}`);
|
|
2377
2377
|
const j = new AbortController();
|
|
2378
2378
|
if (w) {
|
|
2379
|
-
const
|
|
2380
|
-
fetch(
|
|
2381
|
-
const
|
|
2382
|
-
|
|
2379
|
+
const I = [...y, w].join("/");
|
|
2380
|
+
fetch(I, { method: "HEAD", signal: j.signal }).then((S) => {
|
|
2381
|
+
const A = S.ok ? I : i;
|
|
2382
|
+
A !== p.current && (p.current = A, l(A));
|
|
2383
2383
|
}).catch(() => {
|
|
2384
|
-
i !==
|
|
2384
|
+
i !== p.current && (p.current = i, l(i));
|
|
2385
2385
|
});
|
|
2386
2386
|
} else {
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2387
|
+
const I = i;
|
|
2388
|
+
I !== p.current && (p.current = I, requestAnimationFrame(() => l(I)));
|
|
2389
2389
|
}
|
|
2390
2390
|
return () => {
|
|
2391
2391
|
j.abort();
|
|
2392
2392
|
};
|
|
2393
2393
|
}, [i, n, u]), !m) return null;
|
|
2394
|
-
const { width: c, height: d } = e, b = {},
|
|
2394
|
+
const { width: c, height: d } = e, b = {}, f = {
|
|
2395
2395
|
borderRadius: "8px",
|
|
2396
2396
|
objectFit: "contain",
|
|
2397
2397
|
boxShadow: "0 2px 6px rgba(0,0,0,0.1)",
|
|
2398
2398
|
margin: "0 0 8px 0"
|
|
2399
2399
|
};
|
|
2400
|
-
return c && d ? (b.width = c, b.height = d,
|
|
2400
|
+
return c && d ? (b.width = c, b.height = d, f.width = `${c}px`, f.height = `${d}px`) : c && !d ? (b.width = c, f.width = `${c}px`, f.height = "auto") : !c && d && (b.height = d, f.width = "auto", f.height = `${d}px`), /* @__PURE__ */ g.jsx(W, { field: e, children: /* @__PURE__ */ g.jsx(
|
|
2401
2401
|
"div",
|
|
2402
2402
|
{
|
|
2403
2403
|
"data-testid": "image-wrapper",
|
|
@@ -2412,36 +2412,36 @@ const nt = ({ field: e, value: r }) => {
|
|
|
2412
2412
|
src: m,
|
|
2413
2413
|
alt: o?.(e.displayName || "Image") || e.displayName || "Image",
|
|
2414
2414
|
...b,
|
|
2415
|
-
style:
|
|
2415
|
+
style: f
|
|
2416
2416
|
}
|
|
2417
2417
|
)
|
|
2418
2418
|
}
|
|
2419
2419
|
) });
|
|
2420
2420
|
};
|
|
2421
|
-
function
|
|
2421
|
+
function st(e) {
|
|
2422
2422
|
const r = /^-?\d+$/;
|
|
2423
2423
|
return e.split(",").map((n) => n.trim()).every((n) => r.test(n));
|
|
2424
2424
|
}
|
|
2425
|
-
const
|
|
2425
|
+
const it = ({
|
|
2426
2426
|
field: e,
|
|
2427
2427
|
value: r,
|
|
2428
2428
|
onChange: n,
|
|
2429
2429
|
onError: o
|
|
2430
2430
|
}) => {
|
|
2431
|
-
const { t, definitionName: a } =
|
|
2431
|
+
const { t, definitionName: a } = T(), s = ",", [i, u] = D(
|
|
2432
2432
|
Array.isArray(r) ? r.join(s + " ") : String(r ?? "")
|
|
2433
|
-
), m = (b) => !b || b.trim() === "" ? [] : b.split(s).map((
|
|
2433
|
+
), m = (b) => !b || b.trim() === "" ? [] : b.split(s).map((f) => f.trim()).filter(Boolean).map((f) => Number(f)), l = N.useCallback(
|
|
2434
2434
|
(b) => {
|
|
2435
2435
|
if (b.trim() === "")
|
|
2436
2436
|
return e.required ? t("Value required") : null;
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!st(b))
|
|
2438
2438
|
return t("Each value must be a valid integer");
|
|
2439
|
-
const
|
|
2440
|
-
if (e.minCount !== void 0 &&
|
|
2439
|
+
const f = m(b);
|
|
2440
|
+
if (e.minCount !== void 0 && f.length < e.minCount)
|
|
2441
2441
|
return t("Minimum number of values: {{1}}", `${e.minCount}`);
|
|
2442
|
-
if (e.maxCount !== void 0 &&
|
|
2442
|
+
if (e.maxCount !== void 0 && f.length > e.maxCount)
|
|
2443
2443
|
return t("Maximum number of values: {{1}}", `${e.maxCount}`);
|
|
2444
|
-
for (const x of
|
|
2444
|
+
for (const x of f) {
|
|
2445
2445
|
if (e.min !== void 0 && (e.minInclusive ? x < e.min : x <= e.min))
|
|
2446
2446
|
return t(
|
|
2447
2447
|
"Each value must be {{1}} {{2}}",
|
|
@@ -2455,48 +2455,48 @@ const at = ({
|
|
|
2455
2455
|
e.max
|
|
2456
2456
|
);
|
|
2457
2457
|
}
|
|
2458
|
-
return Y(a, e,
|
|
2458
|
+
return Y(a, e, f, t) ?? null;
|
|
2459
2459
|
},
|
|
2460
2460
|
[a, e, t]
|
|
2461
|
-
),
|
|
2462
|
-
const
|
|
2463
|
-
u(
|
|
2461
|
+
), p = (b) => {
|
|
2462
|
+
const f = b.target.value, y = l(f);
|
|
2463
|
+
u(f), n?.(f, y);
|
|
2464
2464
|
}, c = k(null), d = k(
|
|
2465
2465
|
o
|
|
2466
2466
|
);
|
|
2467
2467
|
return C(() => {
|
|
2468
2468
|
d.current = o;
|
|
2469
2469
|
}, [o]), C(() => {
|
|
2470
|
-
const b = Array.isArray(r) ? r.join(s + " ") : String(r ?? ""),
|
|
2471
|
-
|
|
2470
|
+
const b = Array.isArray(r) ? r.join(s + " ") : String(r ?? ""), f = l(b);
|
|
2471
|
+
f !== c.current && (c.current = f, d.current?.(f ?? null));
|
|
2472
2472
|
}, [r, e.required, l, t]), /* @__PURE__ */ g.jsx(W, { field: e, error: l(i), children: /* @__PURE__ */ g.jsx(
|
|
2473
2473
|
"input",
|
|
2474
2474
|
{
|
|
2475
2475
|
type: "text",
|
|
2476
2476
|
value: i,
|
|
2477
|
-
onChange:
|
|
2478
|
-
className:
|
|
2477
|
+
onChange: p,
|
|
2478
|
+
className: K($.input, $.textInput),
|
|
2479
2479
|
style: { flex: 1 }
|
|
2480
2480
|
}
|
|
2481
2481
|
) });
|
|
2482
2482
|
};
|
|
2483
|
-
function
|
|
2483
|
+
function ct(e) {
|
|
2484
2484
|
return /^[-+]?\d*$/.test(e);
|
|
2485
2485
|
}
|
|
2486
|
-
const
|
|
2486
|
+
const lt = ({
|
|
2487
2487
|
field: e,
|
|
2488
2488
|
value: r,
|
|
2489
2489
|
onChange: n,
|
|
2490
2490
|
onError: o
|
|
2491
2491
|
}) => {
|
|
2492
|
-
const { t, definitionName: a } =
|
|
2492
|
+
const { t, definitionName: a } = T(), s = k(null), i = Z((c) => {
|
|
2493
2493
|
const d = parseInt(c, 10);
|
|
2494
2494
|
return Number.isNaN(d) ? null : d;
|
|
2495
|
-
}, []), u =
|
|
2495
|
+
}, []), u = N.useCallback(
|
|
2496
2496
|
(c) => {
|
|
2497
2497
|
if (c.trim() === "")
|
|
2498
2498
|
return e.required ? t("Value required") : null;
|
|
2499
|
-
if (!
|
|
2499
|
+
if (!ct(c))
|
|
2500
2500
|
return t("Must be a valid integer");
|
|
2501
2501
|
const d = i(c);
|
|
2502
2502
|
if (d === null) return t("Must be a valid integer");
|
|
@@ -2513,11 +2513,11 @@ const it = ({
|
|
|
2513
2513
|
e.max
|
|
2514
2514
|
);
|
|
2515
2515
|
if (e.step !== void 0) {
|
|
2516
|
-
const
|
|
2517
|
-
if (!Number.isInteger(
|
|
2516
|
+
const f = Number(e.step);
|
|
2517
|
+
if (!Number.isInteger(f))
|
|
2518
2518
|
return t("Invalid step value");
|
|
2519
|
-
if (d %
|
|
2520
|
-
return t("Must be a multiple of {{1}}",
|
|
2519
|
+
if (d % f !== 0)
|
|
2520
|
+
return t("Must be a multiple of {{1}}", f);
|
|
2521
2521
|
}
|
|
2522
2522
|
return Y(a, e, d, t) ?? null;
|
|
2523
2523
|
},
|
|
@@ -2529,7 +2529,7 @@ const it = ({
|
|
|
2529
2529
|
const c = String(r ?? ""), d = u(c);
|
|
2530
2530
|
d !== m.current && (m.current = d, l.current?.(d ?? null)), s.current && document.activeElement !== s.current && (s.current.value = c);
|
|
2531
2531
|
}, [r, e, u, t]);
|
|
2532
|
-
const
|
|
2532
|
+
const p = (c) => {
|
|
2533
2533
|
const d = c.target.value, b = u(d);
|
|
2534
2534
|
n?.(d, b);
|
|
2535
2535
|
};
|
|
@@ -2540,31 +2540,31 @@ const it = ({
|
|
|
2540
2540
|
type: "text",
|
|
2541
2541
|
defaultValue: String(r ?? ""),
|
|
2542
2542
|
ref: s,
|
|
2543
|
-
onChange:
|
|
2544
|
-
className:
|
|
2543
|
+
onChange: p,
|
|
2544
|
+
className: K(
|
|
2545
2545
|
$.input,
|
|
2546
2546
|
$.inputNumber
|
|
2547
2547
|
)
|
|
2548
2548
|
}
|
|
2549
2549
|
) });
|
|
2550
|
-
},
|
|
2550
|
+
}, ut = ({
|
|
2551
2551
|
field: e,
|
|
2552
2552
|
value: r,
|
|
2553
2553
|
onChange: n,
|
|
2554
2554
|
onError: o
|
|
2555
2555
|
}) => {
|
|
2556
|
-
const { t, definitionName: a } =
|
|
2556
|
+
const { t, definitionName: a } = T(), s = e.minHeight ?? "80px", i = N.useRef(null), u = N.useRef(null), m = N.useRef(
|
|
2557
2557
|
o
|
|
2558
2558
|
);
|
|
2559
|
-
|
|
2559
|
+
N.useEffect(() => {
|
|
2560
2560
|
m.current = o;
|
|
2561
2561
|
}, [o]);
|
|
2562
|
-
const l =
|
|
2562
|
+
const l = N.useCallback(
|
|
2563
2563
|
(d) => d.trim() === "" ? e.required ? t("Value required") : null : e.minLength !== void 0 && d.length < e.minLength ? t("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && d.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : Y(a, e, d, t),
|
|
2564
2564
|
[e, a, t]
|
|
2565
|
-
),
|
|
2566
|
-
const b = d.target.value,
|
|
2567
|
-
n?.(b,
|
|
2565
|
+
), p = (d) => {
|
|
2566
|
+
const b = d.target.value, f = l(b);
|
|
2567
|
+
n?.(b, f);
|
|
2568
2568
|
};
|
|
2569
2569
|
C(() => {
|
|
2570
2570
|
const d = l(r);
|
|
@@ -2573,17 +2573,17 @@ const it = ({
|
|
|
2573
2573
|
const c = {
|
|
2574
2574
|
defaultValue: String(r ?? ""),
|
|
2575
2575
|
ref: i,
|
|
2576
|
-
onChange:
|
|
2576
|
+
onChange: p,
|
|
2577
2577
|
style: {
|
|
2578
2578
|
resize: "vertical",
|
|
2579
2579
|
minHeight: s,
|
|
2580
2580
|
width: "100%",
|
|
2581
2581
|
boxSizing: "border-box"
|
|
2582
2582
|
},
|
|
2583
|
-
className:
|
|
2583
|
+
className: K($.input, $.textInput)
|
|
2584
2584
|
};
|
|
2585
2585
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: l(r), children: /* @__PURE__ */ g.jsx("textarea", { ...c }) });
|
|
2586
|
-
},
|
|
2586
|
+
}, mt = ({
|
|
2587
2587
|
field: e,
|
|
2588
2588
|
value: r,
|
|
2589
2589
|
onChange: n,
|
|
@@ -2593,28 +2593,28 @@ const it = ({
|
|
|
2593
2593
|
C(() => {
|
|
2594
2594
|
t.current = o;
|
|
2595
2595
|
}, [o]);
|
|
2596
|
-
const { t: a, darkMode: s, formStyle: i, fieldStyle: u, definitionName: m } =
|
|
2597
|
-
if (!
|
|
2598
|
-
const L = S?.[
|
|
2599
|
-
return (
|
|
2600
|
-
},
|
|
2596
|
+
const { t: a, darkMode: s, formStyle: i, fieldStyle: u, definitionName: m } = T(), l = (S, A, M) => {
|
|
2597
|
+
if (!A) return {};
|
|
2598
|
+
const L = S?.[A];
|
|
2599
|
+
return (M && L ? L[M] : void 0) ?? {};
|
|
2600
|
+
}, p = k(null), [c, d] = D(!1), [b, f] = D(
|
|
2601
2601
|
null
|
|
2602
2602
|
), y = G(
|
|
2603
2603
|
() => e.options.map((S) => ({ value: S.value, label: a(S.label) })),
|
|
2604
2604
|
[e.options, a]
|
|
2605
2605
|
), x = G(() => {
|
|
2606
|
-
const S = Array.isArray(r) ? r : [],
|
|
2607
|
-
return S.filter((
|
|
2606
|
+
const S = Array.isArray(r) ? r : [], A = new Set(y.map((M) => M.value));
|
|
2607
|
+
return S.filter((M) => A.has(M));
|
|
2608
2608
|
}, [r, y]), v = (S) => {
|
|
2609
|
-
const
|
|
2610
|
-
return e.required &&
|
|
2611
|
-
},
|
|
2612
|
-
if (!
|
|
2613
|
-
const S =
|
|
2614
|
-
|
|
2609
|
+
const A = Array.isArray(S) ? S : [];
|
|
2610
|
+
return e.required && A.length === 0 ? a("Value required") : Y(m, e, A, a) ?? null;
|
|
2611
|
+
}, F = () => {
|
|
2612
|
+
if (!p.current) return;
|
|
2613
|
+
const S = p.current.getBoundingClientRect();
|
|
2614
|
+
f({ x: S.left, y: S.bottom }), d((A) => !A);
|
|
2615
2615
|
}, R = (S) => {
|
|
2616
|
-
const
|
|
2617
|
-
t.current?.(
|
|
2616
|
+
const A = x.includes(S) ? x.filter((z) => z !== S) : [...x, S], M = v(A);
|
|
2617
|
+
t.current?.(M ?? null), n?.(A, M);
|
|
2618
2618
|
}, w = G(() => ({
|
|
2619
2619
|
height: "var(--reactaform-input-height, 2.5rem)",
|
|
2620
2620
|
padding: "var(--reactaform-input-padding, 8px)",
|
|
@@ -2642,7 +2642,7 @@ const it = ({
|
|
|
2642
2642
|
padding: 0,
|
|
2643
2643
|
...l(i, "multiSelect", "clearButton"),
|
|
2644
2644
|
...l(u, void 0, "clearButton")
|
|
2645
|
-
}), [i, u]),
|
|
2645
|
+
}), [i, u]), I = G(() => ({
|
|
2646
2646
|
position: "absolute",
|
|
2647
2647
|
right: "0.7em",
|
|
2648
2648
|
top: "50%",
|
|
@@ -2657,16 +2657,16 @@ const it = ({
|
|
|
2657
2657
|
/* @__PURE__ */ g.jsx(W, { field: e, error: null, children: /* @__PURE__ */ g.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ g.jsxs(
|
|
2658
2658
|
"div",
|
|
2659
2659
|
{
|
|
2660
|
-
ref:
|
|
2660
|
+
ref: p,
|
|
2661
2661
|
className: "reactaform-multiselection-control",
|
|
2662
2662
|
style: w,
|
|
2663
|
-
onClick:
|
|
2663
|
+
onClick: F,
|
|
2664
2664
|
tabIndex: 0,
|
|
2665
2665
|
role: "button",
|
|
2666
2666
|
"aria-haspopup": "listbox",
|
|
2667
2667
|
"aria-expanded": c,
|
|
2668
2668
|
onKeyDown: (S) => {
|
|
2669
|
-
(S.key === "Enter" || S.key === " ") && (S.preventDefault(),
|
|
2669
|
+
(S.key === "Enter" || S.key === " ") && (S.preventDefault(), F());
|
|
2670
2670
|
},
|
|
2671
2671
|
children: [
|
|
2672
2672
|
/* @__PURE__ */ g.jsxs(
|
|
@@ -2693,24 +2693,24 @@ const it = ({
|
|
|
2693
2693
|
children: /* @__PURE__ */ g.jsx("span", { style: j, "aria-hidden": !0, children: "✖" })
|
|
2694
2694
|
}
|
|
2695
2695
|
),
|
|
2696
|
-
/* @__PURE__ */ g.jsx("span", { style:
|
|
2696
|
+
/* @__PURE__ */ g.jsx("span", { style: I, "aria-hidden": !0, children: "▼" })
|
|
2697
2697
|
]
|
|
2698
2698
|
}
|
|
2699
2699
|
) }) }),
|
|
2700
2700
|
c && b && /* @__PURE__ */ g.jsx(
|
|
2701
|
-
|
|
2701
|
+
ft,
|
|
2702
2702
|
{
|
|
2703
2703
|
position: b,
|
|
2704
2704
|
options: y,
|
|
2705
2705
|
selectedValues: x,
|
|
2706
2706
|
onToggleOption: R,
|
|
2707
2707
|
onClose: () => d(!1),
|
|
2708
|
-
controlRef:
|
|
2708
|
+
controlRef: p,
|
|
2709
2709
|
darkMode: s
|
|
2710
2710
|
}
|
|
2711
2711
|
)
|
|
2712
2712
|
] });
|
|
2713
|
-
},
|
|
2713
|
+
}, ft = ({
|
|
2714
2714
|
position: e,
|
|
2715
2715
|
options: r,
|
|
2716
2716
|
selectedValues: n,
|
|
@@ -2719,10 +2719,10 @@ const it = ({
|
|
|
2719
2719
|
controlRef: a,
|
|
2720
2720
|
darkMode: s
|
|
2721
2721
|
}) => {
|
|
2722
|
-
const i = k(null), [u, m] =
|
|
2723
|
-
if (!
|
|
2724
|
-
const
|
|
2725
|
-
return (S &&
|
|
2722
|
+
const i = k(null), [u, m] = D(-1), { formStyle: l, fieldStyle: p } = T(), c = (j, I, S) => {
|
|
2723
|
+
if (!I) return {};
|
|
2724
|
+
const M = j?.[I];
|
|
2725
|
+
return (S && M ? M[S] : void 0) ?? {};
|
|
2726
2726
|
}, d = G(() => ({
|
|
2727
2727
|
maxHeight: 200,
|
|
2728
2728
|
overflowY: "auto",
|
|
@@ -2735,8 +2735,8 @@ const it = ({
|
|
|
2735
2735
|
color: "var(--reactaform-text-color, #000)",
|
|
2736
2736
|
fontSize: "var(--reactaform-popup-font-size, 0.875rem)",
|
|
2737
2737
|
...c(l, "multiSelect", "popup"),
|
|
2738
|
-
...c(
|
|
2739
|
-
}), [l,
|
|
2738
|
+
...c(p, void 0, "popup")
|
|
2739
|
+
}), [l, p]), b = G(() => ({
|
|
2740
2740
|
padding: "6px 8px",
|
|
2741
2741
|
cursor: "pointer",
|
|
2742
2742
|
display: "flex",
|
|
@@ -2744,11 +2744,11 @@ const it = ({
|
|
|
2744
2744
|
background: "transparent",
|
|
2745
2745
|
color: "var(--reactaform-text-color, #000)",
|
|
2746
2746
|
...c(l, "multiSelect", "option"),
|
|
2747
|
-
...c(
|
|
2748
|
-
}), [l,
|
|
2747
|
+
...c(p, void 0, "option")
|
|
2748
|
+
}), [l, p]);
|
|
2749
2749
|
C(() => {
|
|
2750
|
-
const j = (
|
|
2751
|
-
const S =
|
|
2750
|
+
const j = (I) => {
|
|
2751
|
+
const S = I.target;
|
|
2752
2752
|
!i.current?.contains(S) && !a.current?.contains(S) && t();
|
|
2753
2753
|
};
|
|
2754
2754
|
return document.addEventListener("mousedown", j), () => document.removeEventListener("mousedown", j);
|
|
@@ -2759,29 +2759,29 @@ const it = ({
|
|
|
2759
2759
|
const j = i.current.querySelector(`#multi-opt-${u}`);
|
|
2760
2760
|
j && requestAnimationFrame(() => j.focus());
|
|
2761
2761
|
}, [u]);
|
|
2762
|
-
const
|
|
2762
|
+
const f = 250, y = 200, [x, v] = D(
|
|
2763
2763
|
null
|
|
2764
|
-
), [
|
|
2764
|
+
), [F, R] = D(null);
|
|
2765
2765
|
if (C(() => {
|
|
2766
2766
|
if (typeof window > "u") return;
|
|
2767
2767
|
const j = () => {
|
|
2768
|
-
let
|
|
2768
|
+
let A = e.x, M = e.y, z = f;
|
|
2769
2769
|
const L = a?.current;
|
|
2770
2770
|
if (L) {
|
|
2771
2771
|
const J = L.getBoundingClientRect();
|
|
2772
|
-
|
|
2772
|
+
A = J.left, M = J.bottom, z = Math.max(80, Math.round(J.width));
|
|
2773
2773
|
}
|
|
2774
|
-
|
|
2774
|
+
A = Math.min(A, window.innerWidth - z), M = Math.min(M, window.innerHeight - y), v({ left: A, top: M }), R(z);
|
|
2775
2775
|
};
|
|
2776
2776
|
j(), window.addEventListener("scroll", j, !0), window.addEventListener("resize", j);
|
|
2777
|
-
let
|
|
2777
|
+
let I = null;
|
|
2778
2778
|
const S = a?.current;
|
|
2779
|
-
return typeof ResizeObserver < "u" && S && (
|
|
2780
|
-
window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j),
|
|
2779
|
+
return typeof ResizeObserver < "u" && S && (I = new ResizeObserver(() => j()), I.observe(S)), () => {
|
|
2780
|
+
window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j), I && S && I.unobserve(S);
|
|
2781
2781
|
};
|
|
2782
2782
|
}, [a, e.x, e.y]), typeof window > "u") return null;
|
|
2783
2783
|
let w = document.getElementById("popup-root");
|
|
2784
|
-
return w || (w = document.createElement("div"), w.id = "popup-root", document.body.appendChild(w)),
|
|
2784
|
+
return w || (w = document.createElement("div"), w.id = "popup-root", document.body.appendChild(w)), Me.createPortal(
|
|
2785
2785
|
/* @__PURE__ */ g.jsx(
|
|
2786
2786
|
"div",
|
|
2787
2787
|
{
|
|
@@ -2792,56 +2792,56 @@ const it = ({
|
|
|
2792
2792
|
position: "absolute",
|
|
2793
2793
|
top: x ? x.top : e.y,
|
|
2794
2794
|
left: x ? x.left : e.x,
|
|
2795
|
-
width:
|
|
2795
|
+
width: F ?? f,
|
|
2796
2796
|
// spread the static popup styles
|
|
2797
2797
|
...d
|
|
2798
2798
|
},
|
|
2799
2799
|
"data-reactaform-theme": s ? "dark" : "light",
|
|
2800
|
-
children: r.map((j,
|
|
2801
|
-
const S = n.includes(j.value),
|
|
2800
|
+
children: r.map((j, I) => {
|
|
2801
|
+
const S = n.includes(j.value), A = s ? "var(--reactaform-hover-bg, rgba(255,255,255,0.01))" : "var(--reactaform-hover-bg, #eee)", M = {
|
|
2802
2802
|
...b,
|
|
2803
|
-
background:
|
|
2803
|
+
background: I === u ? A : b.background
|
|
2804
2804
|
};
|
|
2805
2805
|
return /* @__PURE__ */ g.jsxs(
|
|
2806
2806
|
"div",
|
|
2807
2807
|
{
|
|
2808
|
-
id: `multi-opt-${
|
|
2809
|
-
onMouseDown: (
|
|
2810
|
-
|
|
2808
|
+
id: `multi-opt-${I}`,
|
|
2809
|
+
onMouseDown: (z) => {
|
|
2810
|
+
z.stopPropagation(), o(j.value);
|
|
2811
2811
|
},
|
|
2812
|
-
onKeyDown: (
|
|
2812
|
+
onKeyDown: (z) => {
|
|
2813
2813
|
const L = r.length;
|
|
2814
|
-
switch (
|
|
2814
|
+
switch (z.key) {
|
|
2815
2815
|
case "ArrowDown":
|
|
2816
|
-
|
|
2816
|
+
z.preventDefault(), m((J) => (J + 1) % L);
|
|
2817
2817
|
break;
|
|
2818
2818
|
case "ArrowUp":
|
|
2819
|
-
|
|
2819
|
+
z.preventDefault(), m((J) => (J - 1 + L) % L);
|
|
2820
2820
|
break;
|
|
2821
2821
|
case "Home":
|
|
2822
|
-
|
|
2822
|
+
z.preventDefault(), m(0);
|
|
2823
2823
|
break;
|
|
2824
2824
|
case "End":
|
|
2825
|
-
|
|
2825
|
+
z.preventDefault(), m(L - 1);
|
|
2826
2826
|
break;
|
|
2827
2827
|
case "Enter":
|
|
2828
2828
|
case " ":
|
|
2829
|
-
|
|
2829
|
+
z.preventDefault(), z.stopPropagation(), o(j.value);
|
|
2830
2830
|
break;
|
|
2831
2831
|
case "Escape":
|
|
2832
|
-
|
|
2832
|
+
z.preventDefault(), t(), a?.current?.focus();
|
|
2833
2833
|
break;
|
|
2834
2834
|
}
|
|
2835
2835
|
},
|
|
2836
|
-
tabIndex:
|
|
2836
|
+
tabIndex: I === u ? 0 : -1,
|
|
2837
2837
|
role: "option",
|
|
2838
2838
|
"aria-selected": S,
|
|
2839
|
-
style:
|
|
2840
|
-
onMouseEnter: (
|
|
2841
|
-
|
|
2839
|
+
style: M,
|
|
2840
|
+
onMouseEnter: (z) => {
|
|
2841
|
+
z.currentTarget.style.background = A, m(I);
|
|
2842
2842
|
},
|
|
2843
|
-
onMouseLeave: (
|
|
2844
|
-
|
|
2843
|
+
onMouseLeave: (z) => {
|
|
2844
|
+
z.currentTarget.style.background = "transparent", m((L) => L === I ? -1 : L);
|
|
2845
2845
|
},
|
|
2846
2846
|
children: [
|
|
2847
2847
|
/* @__PURE__ */ g.jsx(
|
|
@@ -2870,16 +2870,16 @@ const it = ({
|
|
|
2870
2870
|
),
|
|
2871
2871
|
w
|
|
2872
2872
|
);
|
|
2873
|
-
},
|
|
2873
|
+
}, dt = ({
|
|
2874
2874
|
field: e,
|
|
2875
2875
|
value: r,
|
|
2876
2876
|
onChange: n,
|
|
2877
2877
|
onError: o
|
|
2878
2878
|
}) => {
|
|
2879
|
-
const { t, definitionName: a } =
|
|
2880
|
-
(
|
|
2879
|
+
const { t, definitionName: a } = T(), s = N.useRef(null), i = e.min ?? void 0, u = e.max ?? void 0, m = Math.max(1, Math.round(e.step ?? 1)), l = Z(
|
|
2880
|
+
(f) => isNaN(f) ? t("Must be a valid integer") : Number.isInteger(f) ? i !== void 0 && f < i ? t("Must be �?{{1}}", i) : u !== void 0 && f > u ? t("Must be �?{{1}}", u) : Y(a, e, f, t) ?? null : t("Must be an integer"),
|
|
2881
2881
|
[a, e, t, i, u]
|
|
2882
|
-
),
|
|
2882
|
+
), p = k(null), c = k(
|
|
2883
2883
|
o
|
|
2884
2884
|
);
|
|
2885
2885
|
C(() => {
|
|
@@ -2887,14 +2887,14 @@ const it = ({
|
|
|
2887
2887
|
}, [o]), C(() => {
|
|
2888
2888
|
if (document.activeElement === s.current) return;
|
|
2889
2889
|
const y = String(r), x = l(r);
|
|
2890
|
-
s.current && (s.current.value = y), x !==
|
|
2890
|
+
s.current && (s.current.value = y), x !== p.current && (p.current = x, c.current?.(x ?? null));
|
|
2891
2891
|
}, [r, l]);
|
|
2892
|
-
const d = (
|
|
2893
|
-
if (
|
|
2894
|
-
const x = Number(
|
|
2892
|
+
const d = (f) => {
|
|
2893
|
+
if (f.trim() === "") return e.required ? t("Value required") : null;
|
|
2894
|
+
const x = Number(f);
|
|
2895
2895
|
return l(x);
|
|
2896
|
-
}, b = (
|
|
2897
|
-
const y =
|
|
2896
|
+
}, b = (f) => {
|
|
2897
|
+
const y = f.target.value, x = f.target.valueAsNumber, v = d(y);
|
|
2898
2898
|
n?.(x, v);
|
|
2899
2899
|
};
|
|
2900
2900
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: d(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
@@ -2912,15 +2912,15 @@ const it = ({
|
|
|
2912
2912
|
className: $.input
|
|
2913
2913
|
}
|
|
2914
2914
|
) });
|
|
2915
|
-
},
|
|
2915
|
+
}, pt = ({
|
|
2916
2916
|
field: e,
|
|
2917
2917
|
value: r,
|
|
2918
2918
|
onChange: n,
|
|
2919
2919
|
onError: o
|
|
2920
2920
|
}) => {
|
|
2921
|
-
const { t } =
|
|
2922
|
-
(
|
|
2923
|
-
const c = String(
|
|
2921
|
+
const { t } = T(), a = N.useRef(null), { definitionName: s } = T(), i = Z(
|
|
2922
|
+
(p) => {
|
|
2923
|
+
const c = String(p ?? "").trim();
|
|
2924
2924
|
if (c === "")
|
|
2925
2925
|
return e.required ? t("Value required") : null;
|
|
2926
2926
|
if (e.pattern)
|
|
@@ -2939,11 +2939,11 @@ const it = ({
|
|
|
2939
2939
|
C(() => {
|
|
2940
2940
|
m.current = o;
|
|
2941
2941
|
}, [o]), C(() => {
|
|
2942
|
-
const
|
|
2943
|
-
a.current && a.current.value !== String(
|
|
2942
|
+
const p = String(r ?? ""), c = i(p);
|
|
2943
|
+
a.current && a.current.value !== String(p) && (a.current.value = String(p)), c !== u.current && (u.current = c, m.current?.(c ?? null));
|
|
2944
2944
|
}, [r, i]);
|
|
2945
|
-
const l = (
|
|
2946
|
-
const c =
|
|
2945
|
+
const l = (p) => {
|
|
2946
|
+
const c = p.target.value, d = c.trim();
|
|
2947
2947
|
let b = null;
|
|
2948
2948
|
if (d === "") {
|
|
2949
2949
|
b = e.required ? t("Value required") : null, n?.(c, b);
|
|
@@ -2958,33 +2958,33 @@ const it = ({
|
|
|
2958
2958
|
defaultValue: String(r ?? ""),
|
|
2959
2959
|
ref: a,
|
|
2960
2960
|
onChange: l,
|
|
2961
|
-
className:
|
|
2961
|
+
className: K($.input, $.textInput)
|
|
2962
2962
|
}
|
|
2963
2963
|
) });
|
|
2964
|
-
},
|
|
2965
|
-
const { t, definitionName: a } =
|
|
2964
|
+
}, gt = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
2965
|
+
const { t, definitionName: a } = T(), s = e.layout?.toLowerCase() === "horizontal" ? "row" : "column", i = k(null), u = k(o);
|
|
2966
2966
|
C(() => {
|
|
2967
2967
|
u.current = o;
|
|
2968
2968
|
}, [o]);
|
|
2969
2969
|
const m = Z(
|
|
2970
|
-
(
|
|
2970
|
+
(p) => p === "" || p === null || p === void 0 ? t("Value required") : !e.options || e.options.length === 0 ? null : e.options.some((d) => d.value === p) ? Y(a, e, p, t) ?? null : t("Invalid option selected"),
|
|
2971
2971
|
[e, t, a]
|
|
2972
2972
|
);
|
|
2973
2973
|
C(() => {
|
|
2974
|
-
const
|
|
2974
|
+
const p = r != null ? String(r) : "", c = m(p);
|
|
2975
2975
|
if (u.current?.(c ?? null), i.current) {
|
|
2976
2976
|
const d = Array.from(
|
|
2977
2977
|
i.current.querySelectorAll("input[type=radio]")
|
|
2978
2978
|
);
|
|
2979
2979
|
if (c && e.options && e.options.length > 0) {
|
|
2980
2980
|
const b = String(e.options[0].value);
|
|
2981
|
-
d.forEach((
|
|
2981
|
+
d.forEach((f) => f.checked = f.value === b), n?.(b, null);
|
|
2982
2982
|
} else
|
|
2983
|
-
d.forEach((b) => b.checked = b.value ===
|
|
2983
|
+
d.forEach((b) => b.checked = b.value === p);
|
|
2984
2984
|
}
|
|
2985
2985
|
}, [r, m, n, e.options]);
|
|
2986
|
-
const l = (
|
|
2987
|
-
const c =
|
|
2986
|
+
const l = (p) => {
|
|
2987
|
+
const c = p.target.value, d = m(c);
|
|
2988
2988
|
u.current?.(d ?? null), n?.(c, d);
|
|
2989
2989
|
};
|
|
2990
2990
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: m(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
@@ -2999,7 +2999,7 @@ const it = ({
|
|
|
2999
2999
|
width: "100%"
|
|
3000
3000
|
},
|
|
3001
3001
|
ref: i,
|
|
3002
|
-
children: (e.options ?? []).map((
|
|
3002
|
+
children: (e.options ?? []).map((p) => /* @__PURE__ */ g.jsxs(
|
|
3003
3003
|
"label",
|
|
3004
3004
|
{
|
|
3005
3005
|
style: {
|
|
@@ -3014,22 +3014,22 @@ const it = ({
|
|
|
3014
3014
|
{
|
|
3015
3015
|
type: "radio",
|
|
3016
3016
|
name: e.name,
|
|
3017
|
-
value: String(
|
|
3018
|
-
defaultChecked: String(r ?? "") === String(
|
|
3017
|
+
value: String(p.value),
|
|
3018
|
+
defaultChecked: String(r ?? "") === String(p.value),
|
|
3019
3019
|
onChange: l
|
|
3020
3020
|
}
|
|
3021
3021
|
),
|
|
3022
|
-
t(
|
|
3022
|
+
t(p.label)
|
|
3023
3023
|
]
|
|
3024
3024
|
},
|
|
3025
|
-
String(
|
|
3025
|
+
String(p.value)
|
|
3026
3026
|
))
|
|
3027
3027
|
}
|
|
3028
3028
|
) });
|
|
3029
|
-
},
|
|
3029
|
+
}, ht = {
|
|
3030
3030
|
display: "flex",
|
|
3031
3031
|
gap: 4
|
|
3032
|
-
},
|
|
3032
|
+
}, bt = {
|
|
3033
3033
|
cursor: "pointer",
|
|
3034
3034
|
fontSize: "1.5rem",
|
|
3035
3035
|
lineHeight: 1,
|
|
@@ -3037,33 +3037,33 @@ const it = ({
|
|
|
3037
3037
|
marginRight: "0.25rem",
|
|
3038
3038
|
userSelect: "none",
|
|
3039
3039
|
transition: "color 0.12s ease"
|
|
3040
|
-
},
|
|
3040
|
+
}, yt = ({
|
|
3041
3041
|
field: e,
|
|
3042
3042
|
value: r,
|
|
3043
3043
|
onChange: n,
|
|
3044
3044
|
onError: o
|
|
3045
3045
|
}) => {
|
|
3046
|
-
const { t, definitionName: a } =
|
|
3046
|
+
const { t, definitionName: a } = T(), [s, i] = D(null), u = e.max || 5, m = Z(
|
|
3047
3047
|
(b) => e.required && b === 0 ? t("Value required") : Y(a, e, b, t) ?? null,
|
|
3048
3048
|
[e, t, a]
|
|
3049
|
-
), l = k(null),
|
|
3049
|
+
), l = k(null), p = k(o);
|
|
3050
3050
|
C(() => {
|
|
3051
|
-
|
|
3051
|
+
p.current = o;
|
|
3052
3052
|
}, [o]), C(() => {
|
|
3053
3053
|
let b = r || 0;
|
|
3054
3054
|
r < 0 && (b = 0), r > u && (b = u);
|
|
3055
|
-
const
|
|
3056
|
-
|
|
3055
|
+
const f = m(b);
|
|
3056
|
+
f !== l.current && (l.current = f, p.current?.(f ?? null));
|
|
3057
3057
|
}, [r, m, u]);
|
|
3058
3058
|
const c = (b) => {
|
|
3059
|
-
const
|
|
3060
|
-
n?.(b,
|
|
3059
|
+
const f = m(b);
|
|
3060
|
+
n?.(b, f);
|
|
3061
3061
|
}, d = (() => {
|
|
3062
3062
|
let b = r || 0;
|
|
3063
3063
|
return b < 0 && (b = 0), b > u && (b = u), b;
|
|
3064
3064
|
})();
|
|
3065
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error: m(d), children: /* @__PURE__ */ g.jsx("div", { style:
|
|
3066
|
-
const b = e.icon,
|
|
3065
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: m(d), children: /* @__PURE__ */ g.jsx("div", { style: ht, children: (() => {
|
|
3066
|
+
const b = e.icon, f = b && String(b).trim() ? String(b) : "★";
|
|
3067
3067
|
return [...Array(u)].map((y, x) => {
|
|
3068
3068
|
const v = x < d, R = s !== null && x <= s || v ? "gold" : "lightgray";
|
|
3069
3069
|
return /* @__PURE__ */ g.jsx(
|
|
@@ -3072,46 +3072,105 @@ const it = ({
|
|
|
3072
3072
|
onClick: () => c(x + 1),
|
|
3073
3073
|
onMouseEnter: () => i(x),
|
|
3074
3074
|
onMouseLeave: () => i(null),
|
|
3075
|
-
style: { ...
|
|
3075
|
+
style: { ...bt, color: R },
|
|
3076
3076
|
"aria-label": `Rating ${x + 1}`,
|
|
3077
3077
|
title: t(`${e.displayName} ${x + 1}`),
|
|
3078
|
-
children:
|
|
3078
|
+
children: f
|
|
3079
3079
|
},
|
|
3080
3080
|
x
|
|
3081
3081
|
);
|
|
3082
3082
|
});
|
|
3083
3083
|
})() }) });
|
|
3084
|
-
},
|
|
3085
|
-
|
|
3086
|
-
|
|
3084
|
+
}, xt = ({
|
|
3085
|
+
field: e,
|
|
3086
|
+
value: r,
|
|
3087
|
+
onChange: n,
|
|
3088
|
+
onError: o
|
|
3089
|
+
}) => {
|
|
3090
|
+
const { t, definitionName: a } = T(), s = N.useRef(null), i = N.useRef(null), u = N.useRef(
|
|
3091
|
+
o
|
|
3092
|
+
);
|
|
3093
|
+
N.useEffect(() => {
|
|
3094
|
+
u.current = o;
|
|
3095
|
+
}, [o]);
|
|
3096
|
+
const m = G(
|
|
3097
|
+
() => e.pattern ? new RegExp(e.pattern) : null,
|
|
3098
|
+
[e.pattern]
|
|
3099
|
+
), l = N.useCallback(
|
|
3100
|
+
(f) => f === "" ? e.required ? t("Value required") : null : e.minLength !== void 0 && f.length < e.minLength ? t("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && f.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : m && !m.test(f) ? t("Input does not match pattern: {{1}}", e.pattern) : Y(a, e, f, t),
|
|
3101
|
+
[e, a, t, m]
|
|
3102
|
+
), p = (f) => {
|
|
3103
|
+
const y = f.target.value, x = l(y);
|
|
3104
|
+
n?.(y, x);
|
|
3105
|
+
};
|
|
3106
|
+
C(() => {
|
|
3107
|
+
const f = l(r ?? "");
|
|
3108
|
+
s.current && s.current.value !== String(r ?? "") && (s.current.value = String(r ?? "")), f !== i.current && (i.current = f, u.current?.(f ?? null));
|
|
3109
|
+
}, [r, l]);
|
|
3110
|
+
const [c, d] = N.useState(!1), b = () => d((f) => !f);
|
|
3111
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: l(String(r ?? "")), children: /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, width: "100%" }, children: [
|
|
3112
|
+
/* @__PURE__ */ g.jsx(
|
|
3113
|
+
"input",
|
|
3114
|
+
{
|
|
3115
|
+
id: e.name,
|
|
3116
|
+
type: c ? "text" : "password",
|
|
3117
|
+
defaultValue: String(r ?? ""),
|
|
3118
|
+
ref: s,
|
|
3119
|
+
onChange: p,
|
|
3120
|
+
className: K($.input, $.textInput),
|
|
3121
|
+
style: { flex: 1, minWidth: 0 }
|
|
3122
|
+
}
|
|
3123
|
+
),
|
|
3124
|
+
/* @__PURE__ */ g.jsx(
|
|
3125
|
+
"button",
|
|
3126
|
+
{
|
|
3127
|
+
type: "button",
|
|
3128
|
+
onClick: b,
|
|
3129
|
+
"aria-label": t(c ? "Hide password" : "Show password"),
|
|
3130
|
+
style: {
|
|
3131
|
+
background: "transparent",
|
|
3132
|
+
border: "none",
|
|
3133
|
+
cursor: "pointer",
|
|
3134
|
+
fontSize: 16,
|
|
3135
|
+
lineHeight: 1,
|
|
3136
|
+
padding: "4px 6px",
|
|
3137
|
+
flexShrink: 0
|
|
3138
|
+
},
|
|
3139
|
+
children: c ? "🙈" : "👁️"
|
|
3140
|
+
}
|
|
3141
|
+
)
|
|
3142
|
+
] }) });
|
|
3143
|
+
}, vt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
3144
|
+
function wt(e) {
|
|
3145
|
+
return vt.test(e);
|
|
3087
3146
|
}
|
|
3088
|
-
const
|
|
3147
|
+
const St = ({
|
|
3089
3148
|
field: e,
|
|
3090
3149
|
value: r,
|
|
3091
3150
|
onChange: n,
|
|
3092
3151
|
onError: o
|
|
3093
3152
|
}) => {
|
|
3094
|
-
const { t, definitionName: a } =
|
|
3153
|
+
const { t, definitionName: a } = T(), s = k(null), i = k(null), u = N.useCallback(
|
|
3095
3154
|
(b) => {
|
|
3096
|
-
let
|
|
3155
|
+
let f = null;
|
|
3097
3156
|
if (b.trim() === "")
|
|
3098
3157
|
return t("Value required");
|
|
3099
|
-
if (!
|
|
3158
|
+
if (!wt(b))
|
|
3100
3159
|
return t("Invalid number");
|
|
3101
3160
|
const y = Number(b);
|
|
3102
|
-
return typeof e.min == "number" && y < e.min ? t("Value should be at least {{1}}", e.min) : typeof e.max == "number" && y > e.max ? t("Value should be at most {{1}}", e.max) : (
|
|
3161
|
+
return typeof e.min == "number" && y < e.min ? t("Value should be at least {{1}}", e.min) : typeof e.max == "number" && y > e.max ? t("Value should be at most {{1}}", e.max) : (f || (f = Y(a, e, y, t)), f);
|
|
3103
3162
|
},
|
|
3104
3163
|
[a, e, t]
|
|
3105
3164
|
), m = k(null), l = k(o);
|
|
3106
3165
|
C(() => {
|
|
3107
3166
|
l.current = o;
|
|
3108
3167
|
}, [o]), C(() => {
|
|
3109
|
-
const b = String(r),
|
|
3110
|
-
i.current && document.activeElement !== i.current && (i.current.value = isNaN(Number(b)) ? String(e.min ?? 0) : String(Number(b))), s.current && document.activeElement !== s.current && (s.current.value = b),
|
|
3168
|
+
const b = String(r), f = u(b);
|
|
3169
|
+
i.current && document.activeElement !== i.current && (i.current.value = isNaN(Number(b)) ? String(e.min ?? 0) : String(Number(b))), s.current && document.activeElement !== s.current && (s.current.value = b), f !== m.current && (m.current = f, l.current?.(f ?? null));
|
|
3111
3170
|
}, [r, u, e.min]);
|
|
3112
|
-
const
|
|
3113
|
-
const
|
|
3114
|
-
n?.(
|
|
3171
|
+
const p = e.min ?? 0, c = e.max ?? 100, d = (b) => {
|
|
3172
|
+
const f = b.target.value, y = u(f);
|
|
3173
|
+
n?.(f, y);
|
|
3115
3174
|
};
|
|
3116
3175
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
|
|
3117
3176
|
/* @__PURE__ */ g.jsx(
|
|
@@ -3119,9 +3178,9 @@ const xt = ({
|
|
|
3119
3178
|
{
|
|
3120
3179
|
ref: i,
|
|
3121
3180
|
type: "range",
|
|
3122
|
-
defaultValue: isNaN(Number(r)) ? String(
|
|
3181
|
+
defaultValue: isNaN(Number(r)) ? String(p) : String(Number(r)),
|
|
3123
3182
|
onChange: d,
|
|
3124
|
-
min:
|
|
3183
|
+
min: p,
|
|
3125
3184
|
max: c,
|
|
3126
3185
|
style: {
|
|
3127
3186
|
padding: "0px, 0px",
|
|
@@ -3146,28 +3205,28 @@ const xt = ({
|
|
|
3146
3205
|
textAlign: "center",
|
|
3147
3206
|
flexShrink: 0
|
|
3148
3207
|
},
|
|
3149
|
-
className:
|
|
3208
|
+
className: K($.input, $.textInput)
|
|
3150
3209
|
}
|
|
3151
3210
|
)
|
|
3152
3211
|
] }) });
|
|
3153
|
-
},
|
|
3212
|
+
}, Ct = ({
|
|
3154
3213
|
field: e,
|
|
3155
3214
|
value: r,
|
|
3156
3215
|
onChange: n,
|
|
3157
3216
|
onError: o
|
|
3158
3217
|
}) => {
|
|
3159
|
-
const { t, formStyle: a, fieldStyle: s, definitionName: i } =
|
|
3218
|
+
const { t, formStyle: a, fieldStyle: s, definitionName: i } = T(), u = a, m = s, l = (w, j, I) => {
|
|
3160
3219
|
if (!j) return {};
|
|
3161
3220
|
const S = w?.[j];
|
|
3162
|
-
return (
|
|
3163
|
-
},
|
|
3221
|
+
return (I && S ? S[I] : void 0) ?? {};
|
|
3222
|
+
}, p = N.useMemo(() => ({
|
|
3164
3223
|
display: "inline-block",
|
|
3165
3224
|
position: "relative",
|
|
3166
3225
|
width: 44,
|
|
3167
3226
|
height: 24,
|
|
3168
3227
|
...l(u, "switch", "label"),
|
|
3169
3228
|
...l(m, void 0, "label")
|
|
3170
|
-
}), [u, m]), c =
|
|
3229
|
+
}), [u, m]), c = N.useMemo(() => ({
|
|
3171
3230
|
position: "absolute",
|
|
3172
3231
|
opacity: 0,
|
|
3173
3232
|
top: 0,
|
|
@@ -3180,7 +3239,7 @@ const xt = ({
|
|
|
3180
3239
|
// Make hidden input non-interactive to avoid event conflicts
|
|
3181
3240
|
...l(u, "switch", "hiddenInput"),
|
|
3182
3241
|
...l(m, void 0, "hiddenInput")
|
|
3183
|
-
}), [u, m]), d =
|
|
3242
|
+
}), [u, m]), d = N.useMemo(() => ({
|
|
3184
3243
|
position: "absolute",
|
|
3185
3244
|
cursor: "pointer",
|
|
3186
3245
|
top: 0,
|
|
@@ -3199,7 +3258,7 @@ const xt = ({
|
|
|
3199
3258
|
borderColor: "transparent",
|
|
3200
3259
|
...l(u, "switch", "slider"),
|
|
3201
3260
|
...l(m, void 0, "slider")
|
|
3202
|
-
}), [u, m]), b =
|
|
3261
|
+
}), [u, m]), b = N.useMemo(() => ({
|
|
3203
3262
|
position: "absolute",
|
|
3204
3263
|
height: 16,
|
|
3205
3264
|
width: 16,
|
|
@@ -3211,18 +3270,18 @@ const xt = ({
|
|
|
3211
3270
|
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.3)",
|
|
3212
3271
|
...l(u, "switch", "knob"),
|
|
3213
3272
|
...l(m, void 0, "knob")
|
|
3214
|
-
}), [u, m]),
|
|
3215
|
-
const w = !
|
|
3273
|
+
}), [u, m]), f = !!r, y = N.useRef(null), x = N.useRef(o), v = N.useCallback((w) => w ? Y(i, e, w, t) ?? null : e.required ? t("Value required") : null, [e, t, i]), F = () => {
|
|
3274
|
+
const w = !f, j = v(w);
|
|
3216
3275
|
n?.(w, j);
|
|
3217
3276
|
};
|
|
3218
|
-
|
|
3277
|
+
N.useEffect(() => {
|
|
3219
3278
|
x.current = o;
|
|
3220
|
-
}, [o]),
|
|
3221
|
-
const w = v(
|
|
3279
|
+
}, [o]), N.useEffect(() => {
|
|
3280
|
+
const w = v(f);
|
|
3222
3281
|
w !== y.current && (y.current = w, x.current?.(w ?? null));
|
|
3223
|
-
}, [
|
|
3282
|
+
}, [f, e, v]);
|
|
3224
3283
|
const R = e.name;
|
|
3225
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error: v(
|
|
3284
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: v(f), rightAlign: !1, children: /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
|
|
3226
3285
|
/* @__PURE__ */ g.jsx(
|
|
3227
3286
|
"label",
|
|
3228
3287
|
{
|
|
@@ -3232,13 +3291,13 @@ const xt = ({
|
|
|
3232
3291
|
children: t(e.displayName)
|
|
3233
3292
|
}
|
|
3234
3293
|
),
|
|
3235
|
-
/* @__PURE__ */ g.jsxs("label", { style:
|
|
3294
|
+
/* @__PURE__ */ g.jsxs("label", { style: p, children: [
|
|
3236
3295
|
/* @__PURE__ */ g.jsx(
|
|
3237
3296
|
"input",
|
|
3238
3297
|
{
|
|
3239
3298
|
id: e.name,
|
|
3240
3299
|
type: "checkbox",
|
|
3241
|
-
checked:
|
|
3300
|
+
checked: f,
|
|
3242
3301
|
readOnly: !0,
|
|
3243
3302
|
"aria-label": t(e.displayName),
|
|
3244
3303
|
style: c,
|
|
@@ -3251,19 +3310,19 @@ const xt = ({
|
|
|
3251
3310
|
role: "switch",
|
|
3252
3311
|
"data-testid": "switch",
|
|
3253
3312
|
tabIndex: 0,
|
|
3254
|
-
"aria-checked":
|
|
3255
|
-
onClick:
|
|
3313
|
+
"aria-checked": f,
|
|
3314
|
+
onClick: F,
|
|
3256
3315
|
onKeyDown: (w) => {
|
|
3257
|
-
(w.key === " " || w.key === "Spacebar" || w.key === "Space" || w.key === "Enter") && (w.preventDefault(),
|
|
3316
|
+
(w.key === " " || w.key === "Spacebar" || w.key === "Space" || w.key === "Enter") && (w.preventDefault(), F());
|
|
3258
3317
|
},
|
|
3259
|
-
className: `reactaform-switch ${
|
|
3260
|
-
style:
|
|
3318
|
+
className: `reactaform-switch ${f ? "active checked on" : ""} `,
|
|
3319
|
+
style: f ? { ...d, backgroundColor: "var(--reactaform-switch-on-bg, #22c55e)", borderColor: "var(--reactaform-switch-on-border, #16a34a)" } : d,
|
|
3261
3320
|
children: /* @__PURE__ */ g.jsx(
|
|
3262
3321
|
"span",
|
|
3263
3322
|
{
|
|
3264
3323
|
style: {
|
|
3265
3324
|
...b,
|
|
3266
|
-
transform:
|
|
3325
|
+
transform: f ? "translateX(20px)" : void 0
|
|
3267
3326
|
}
|
|
3268
3327
|
}
|
|
3269
3328
|
)
|
|
@@ -3277,19 +3336,19 @@ const xt = ({
|
|
|
3277
3336
|
onChange: n,
|
|
3278
3337
|
onError: o
|
|
3279
3338
|
}) => {
|
|
3280
|
-
const { t, definitionName: a } =
|
|
3339
|
+
const { t, definitionName: a } = T(), s = N.useRef(null), i = N.useRef(null), u = N.useRef(
|
|
3281
3340
|
o
|
|
3282
3341
|
);
|
|
3283
|
-
|
|
3342
|
+
N.useEffect(() => {
|
|
3284
3343
|
u.current = o;
|
|
3285
3344
|
}, [o]);
|
|
3286
3345
|
const m = G(
|
|
3287
3346
|
() => e.pattern ? new RegExp(e.pattern) : null,
|
|
3288
3347
|
[e.pattern]
|
|
3289
|
-
), l =
|
|
3348
|
+
), l = N.useCallback(
|
|
3290
3349
|
(c) => c.trim() === "" ? e.required ? t("Value required") : null : e.minLength !== void 0 && c.length < e.minLength ? t("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && c.length > e.maxLength ? t("Must be at most {{1}} characters", e.maxLength) : m && !m.test(c) ? t("Input does not match pattern: {{1}}", e.pattern) : Y(a, e, c, t),
|
|
3291
3350
|
[e, a, t, m]
|
|
3292
|
-
),
|
|
3351
|
+
), p = (c) => {
|
|
3293
3352
|
const d = c.target.value, b = l(d);
|
|
3294
3353
|
n?.(d, b);
|
|
3295
3354
|
};
|
|
@@ -3303,25 +3362,25 @@ const xt = ({
|
|
|
3303
3362
|
type: "text",
|
|
3304
3363
|
defaultValue: String(r ?? ""),
|
|
3305
3364
|
ref: s,
|
|
3306
|
-
onChange:
|
|
3307
|
-
className:
|
|
3365
|
+
onChange: p,
|
|
3366
|
+
className: K($.input, $.textInput)
|
|
3308
3367
|
}
|
|
3309
3368
|
) });
|
|
3310
|
-
},
|
|
3369
|
+
}, jt = ({
|
|
3311
3370
|
field: e,
|
|
3312
3371
|
value: r,
|
|
3313
3372
|
onChange: n,
|
|
3314
3373
|
onError: o
|
|
3315
3374
|
}) => {
|
|
3316
|
-
const { t, definitionName: a } =
|
|
3375
|
+
const { t, definitionName: a } = T(), s = k(null), i = k(o), u = e.includeSeconds ?? !0;
|
|
3317
3376
|
C(() => {
|
|
3318
3377
|
i.current = o;
|
|
3319
3378
|
}, [o]);
|
|
3320
|
-
const m =
|
|
3321
|
-
if (!
|
|
3379
|
+
const m = N.useCallback((p) => {
|
|
3380
|
+
if (!p || p.trim() === "")
|
|
3322
3381
|
return e.required || e.min || e.max ? t("Value required") : null;
|
|
3323
|
-
const c = (
|
|
3324
|
-
const y =
|
|
3382
|
+
const c = (f) => {
|
|
3383
|
+
const y = f.split(":").map((v) => parseInt(v, 10));
|
|
3325
3384
|
if (y.some((v) => Number.isNaN(v))) return NaN;
|
|
3326
3385
|
let x = 0;
|
|
3327
3386
|
if (y.length === 3)
|
|
@@ -3333,26 +3392,26 @@ const xt = ({
|
|
|
3333
3392
|
else
|
|
3334
3393
|
return NaN;
|
|
3335
3394
|
return x;
|
|
3336
|
-
}, d = c(
|
|
3395
|
+
}, d = c(p);
|
|
3337
3396
|
if (Number.isNaN(d)) return t("Invalid time format");
|
|
3338
3397
|
if (e.min && typeof e.min == "string") {
|
|
3339
|
-
const
|
|
3340
|
-
if (!Number.isNaN(
|
|
3398
|
+
const f = c(e.min);
|
|
3399
|
+
if (!Number.isNaN(f) && d < f)
|
|
3341
3400
|
return t("Time must be on or after {{1}}", e.min);
|
|
3342
3401
|
}
|
|
3343
3402
|
if (e.max && typeof e.max == "string") {
|
|
3344
|
-
const
|
|
3345
|
-
if (!Number.isNaN(
|
|
3403
|
+
const f = c(e.max);
|
|
3404
|
+
if (!Number.isNaN(f) && d > f)
|
|
3346
3405
|
return t("Time must be on or before {{1}}", e.max);
|
|
3347
3406
|
}
|
|
3348
|
-
return Y(a, e,
|
|
3349
|
-
}, [e, a, t]), l = (
|
|
3350
|
-
const c =
|
|
3407
|
+
return Y(a, e, p, t) ?? null;
|
|
3408
|
+
}, [e, a, t]), l = (p) => {
|
|
3409
|
+
const c = p.target.value, d = m(c);
|
|
3351
3410
|
n?.(c, d);
|
|
3352
3411
|
};
|
|
3353
3412
|
return C(() => {
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3413
|
+
const p = m(r);
|
|
3414
|
+
p !== s.current && (s.current = p, i.current?.(p ?? null));
|
|
3356
3415
|
}, [r, m]), /* @__PURE__ */ g.jsx(W, { field: e, error: m(r), children: /* @__PURE__ */ g.jsx(
|
|
3357
3416
|
"input",
|
|
3358
3417
|
{
|
|
@@ -3363,11 +3422,11 @@ const xt = ({
|
|
|
3363
3422
|
onChange: l,
|
|
3364
3423
|
min: typeof e.min == "string" ? e.min : void 0,
|
|
3365
3424
|
max: typeof e.max == "string" ? e.max : void 0,
|
|
3366
|
-
className:
|
|
3425
|
+
className: K($.input, $.textInput)
|
|
3367
3426
|
}
|
|
3368
3427
|
) });
|
|
3369
3428
|
};
|
|
3370
|
-
function
|
|
3429
|
+
function kt({
|
|
3371
3430
|
pos: e,
|
|
3372
3431
|
options: r,
|
|
3373
3432
|
onClose: n,
|
|
@@ -3380,8 +3439,8 @@ function St({
|
|
|
3380
3439
|
}
|
|
3381
3440
|
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
3382
3441
|
}, [n]), !s || r === void 0 || r.length === 0 || !e || e.x == null || e.y == null) return null;
|
|
3383
|
-
const i = e.x, u = e.y, m = typeof window < "u" ? window.innerWidth : 1024, l = Math.max(0, m - 160),
|
|
3384
|
-
return
|
|
3442
|
+
const i = e.x, u = e.y, m = typeof window < "u" ? window.innerWidth : 1024, l = Math.max(0, m - 160), p = Math.max(0, Math.min(i, l)), c = Math.max(0, u);
|
|
3443
|
+
return Me.createPortal(
|
|
3385
3444
|
/* @__PURE__ */ g.jsx(
|
|
3386
3445
|
"div",
|
|
3387
3446
|
{
|
|
@@ -3392,7 +3451,7 @@ function St({
|
|
|
3392
3451
|
style: {
|
|
3393
3452
|
position: "fixed",
|
|
3394
3453
|
top: c,
|
|
3395
|
-
left:
|
|
3454
|
+
left: p,
|
|
3396
3455
|
backgroundColor: "var(--reactaform-primary-bg, #fff)",
|
|
3397
3456
|
border: "1px solid var(--reactaform-border-color, #ccc)",
|
|
3398
3457
|
borderRadius: "var(--reactaform-border-radius, 4px)",
|
|
@@ -3405,11 +3464,11 @@ function St({
|
|
|
3405
3464
|
"div",
|
|
3406
3465
|
{
|
|
3407
3466
|
"data-popup-menu": "item",
|
|
3408
|
-
onMouseDown: (
|
|
3409
|
-
|
|
3467
|
+
onMouseDown: (f) => {
|
|
3468
|
+
f.stopPropagation(), a.current = !0;
|
|
3410
3469
|
},
|
|
3411
|
-
onClick: (
|
|
3412
|
-
|
|
3470
|
+
onClick: (f) => {
|
|
3471
|
+
f.stopPropagation(), f.preventDefault(), o(d), n(), setTimeout(() => {
|
|
3413
3472
|
a.current = !1;
|
|
3414
3473
|
}, 100);
|
|
3415
3474
|
},
|
|
@@ -3420,11 +3479,11 @@ function St({
|
|
|
3420
3479
|
borderBottom: b < r.length - 1 ? "1px solid var(--reactaform-border-light, #eee)" : void 0,
|
|
3421
3480
|
transition: "background-color 0.15s ease"
|
|
3422
3481
|
},
|
|
3423
|
-
onMouseEnter: (
|
|
3424
|
-
|
|
3482
|
+
onMouseEnter: (f) => {
|
|
3483
|
+
f.currentTarget.style.backgroundColor = "var(--reactaform-hover-bg, #e0e0e0)";
|
|
3425
3484
|
},
|
|
3426
|
-
onMouseLeave: (
|
|
3427
|
-
|
|
3485
|
+
onMouseLeave: (f) => {
|
|
3486
|
+
f.currentTarget.style.backgroundColor = "transparent";
|
|
3428
3487
|
},
|
|
3429
3488
|
children: d.label
|
|
3430
3489
|
},
|
|
@@ -3436,7 +3495,7 @@ function St({
|
|
|
3436
3495
|
);
|
|
3437
3496
|
}
|
|
3438
3497
|
const he = {};
|
|
3439
|
-
function
|
|
3498
|
+
function Rt(e, r) {
|
|
3440
3499
|
if (e in he)
|
|
3441
3500
|
return;
|
|
3442
3501
|
const n = Le[e] ?? {}, o = {}, t = {}, a = {};
|
|
@@ -3450,7 +3509,7 @@ function Ct(e, r) {
|
|
|
3450
3509
|
reverseLabels: a
|
|
3451
3510
|
};
|
|
3452
3511
|
}
|
|
3453
|
-
function
|
|
3512
|
+
function Et(e, r, n) {
|
|
3454
3513
|
if (e === "C") {
|
|
3455
3514
|
if (r === "F") return n * (9 / 5) + 32;
|
|
3456
3515
|
if (r === "K") return n + 273.15;
|
|
@@ -3463,11 +3522,11 @@ function jt(e, r, n) {
|
|
|
3463
3522
|
}
|
|
3464
3523
|
return n;
|
|
3465
3524
|
}
|
|
3466
|
-
function
|
|
3525
|
+
function Nt(e, r, n) {
|
|
3467
3526
|
if (!Number.isFinite(e)) return [];
|
|
3468
3527
|
if (n === he.temperature)
|
|
3469
3528
|
return Object.keys(n.labels).map((a) => {
|
|
3470
|
-
const s =
|
|
3529
|
+
const s = Et(r, a, e);
|
|
3471
3530
|
return Number.isFinite(s) ? { label: `${s.toFixed(6)} ${a}`, value: s.toString(), unit: a } : { label: `${String(s)} ${a}`, value: String(s), unit: a };
|
|
3472
3531
|
});
|
|
3473
3532
|
const t = n.factors[r];
|
|
@@ -3479,74 +3538,74 @@ function kt(e, r, n) {
|
|
|
3479
3538
|
function xe(e, r) {
|
|
3480
3539
|
return e in r.labels ? e : r.reverseLabels && r.reverseLabels[e] ? r.reverseLabels[e] : null;
|
|
3481
3540
|
}
|
|
3482
|
-
const
|
|
3541
|
+
const It = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, At = ({
|
|
3483
3542
|
unitFactors: e,
|
|
3484
3543
|
field: r,
|
|
3485
3544
|
value: n,
|
|
3486
3545
|
onChange: o,
|
|
3487
3546
|
onError: t
|
|
3488
3547
|
}) => {
|
|
3489
|
-
const { t: a, definitionName: s } =
|
|
3490
|
-
(P,
|
|
3548
|
+
const { t: a, definitionName: s } = T(), i = k(null), u = k(null), m = k(null), [l, p] = D(null), [c, d] = D(null), [b, f] = D(!1), [y, x] = D(null), [v, F] = D([]), R = Z(
|
|
3549
|
+
(P, O) => {
|
|
3491
3550
|
if (!P || P.trim() === "")
|
|
3492
3551
|
return r.required ? a("Value required") : null;
|
|
3493
|
-
if (!
|
|
3494
|
-
const h = Y(s, r, [P,
|
|
3552
|
+
if (!It.test(P)) return a("Must be a valid number");
|
|
3553
|
+
const h = Y(s, r, [P, O], a);
|
|
3495
3554
|
return h || null;
|
|
3496
3555
|
},
|
|
3497
3556
|
[s, r, a]
|
|
3498
3557
|
), w = e.reverseLabels !== void 0 ? e.reverseLabels : Object.fromEntries(
|
|
3499
|
-
Object.entries(e.labels).map(([P,
|
|
3558
|
+
Object.entries(e.labels).map(([P, O]) => [O, P])
|
|
3500
3559
|
);
|
|
3501
3560
|
C(() => {
|
|
3502
3561
|
const P = String(n[0]);
|
|
3503
|
-
let
|
|
3504
|
-
|
|
3562
|
+
let O = n[1] ?? e.default;
|
|
3563
|
+
O = xe(O, e) || O;
|
|
3505
3564
|
const h = document.activeElement;
|
|
3506
|
-
h === i.current || h === u.current || (i.current && (i.current.value = P), u.current && (u.current.value =
|
|
3507
|
-
m.current = null,
|
|
3565
|
+
h === i.current || h === u.current || (i.current && (i.current.value = P), u.current && (u.current.value = O), m.current !== null && (cancelAnimationFrame(m.current), m.current = null), m.current = requestAnimationFrame(() => {
|
|
3566
|
+
m.current = null, p(null), d(null);
|
|
3508
3567
|
}));
|
|
3509
3568
|
}, [n, e]), C(() => () => {
|
|
3510
3569
|
m.current !== null && (cancelAnimationFrame(m.current), m.current = null);
|
|
3511
3570
|
}, []);
|
|
3512
|
-
const j = k(null),
|
|
3571
|
+
const j = k(null), I = k(
|
|
3513
3572
|
t
|
|
3514
3573
|
);
|
|
3515
3574
|
C(() => {
|
|
3516
|
-
|
|
3575
|
+
I.current = t;
|
|
3517
3576
|
}, [t]), C(() => {
|
|
3518
3577
|
const P = String(n[0]);
|
|
3519
|
-
let
|
|
3520
|
-
|
|
3521
|
-
const h = R(P,
|
|
3522
|
-
h !== j.current && (j.current = h,
|
|
3578
|
+
let O = n[1] ?? e.default;
|
|
3579
|
+
O = xe(O, e) || O;
|
|
3580
|
+
const h = R(P, O);
|
|
3581
|
+
h !== j.current && (j.current = h, I.current?.(h ?? null));
|
|
3523
3582
|
}, [n, e, R]);
|
|
3524
|
-
const S = (P,
|
|
3525
|
-
const E = w[
|
|
3583
|
+
const S = (P, O, h) => {
|
|
3584
|
+
const E = w[O] || O;
|
|
3526
3585
|
o?.([P, E], h);
|
|
3527
|
-
},
|
|
3528
|
-
const
|
|
3529
|
-
|
|
3530
|
-
},
|
|
3531
|
-
const
|
|
3532
|
-
d(
|
|
3533
|
-
},
|
|
3534
|
-
const
|
|
3535
|
-
if (R(
|
|
3586
|
+
}, A = (P) => {
|
|
3587
|
+
const O = P.target.value, h = u.current ? u.current.value : e.default, E = R(O, h);
|
|
3588
|
+
p(O), S(O, h, E);
|
|
3589
|
+
}, M = (P) => {
|
|
3590
|
+
const O = P.target.value, h = i.current ? i.current.value : String(n[0] ?? ""), E = R(h, O);
|
|
3591
|
+
d(O), u.current && (u.current.value = O), S(h, O, E);
|
|
3592
|
+
}, z = (P) => {
|
|
3593
|
+
const O = i.current ? i.current.value : String(n[0] ?? ""), h = parseFloat(O), E = u.current ? u.current.value : e.default;
|
|
3594
|
+
if (R(O, E) || !O.trim() || !Number.isFinite(h))
|
|
3536
3595
|
return;
|
|
3537
3596
|
const U = P.currentTarget.getBoundingClientRect(), ne = U.left, ae = U.bottom;
|
|
3538
3597
|
x({ x: ne, y: ae });
|
|
3539
|
-
const _ =
|
|
3598
|
+
const _ = Nt(h, E, e);
|
|
3540
3599
|
if (_.length === 0) {
|
|
3541
|
-
|
|
3600
|
+
F([]), f(!1);
|
|
3542
3601
|
return;
|
|
3543
3602
|
}
|
|
3544
|
-
|
|
3603
|
+
F(_), f((V) => !V);
|
|
3545
3604
|
}, L = (P) => {
|
|
3546
|
-
const { value:
|
|
3547
|
-
|
|
3548
|
-
const E = R(
|
|
3549
|
-
S(
|
|
3605
|
+
const { value: O, unit: h } = P;
|
|
3606
|
+
f(!1), x(null), i.current && (i.current.value = O), u.current && (u.current.value = h), p(O), d(h);
|
|
3607
|
+
const E = R(O, h);
|
|
3608
|
+
S(O, h, E);
|
|
3550
3609
|
}, J = String(n[0] ?? ""), ce = xe(n[1] ?? e.default, e) || (n[1] ?? e.default), re = l ?? J, Q = !!R(re, c ?? ce) || !re.trim(), oe = {
|
|
3551
3610
|
width: "var(--reactaform-unit-btn-width, 2.5em)",
|
|
3552
3611
|
height: "var(--reactaform-unit-btn-height, 2.5em)",
|
|
@@ -3568,9 +3627,9 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3568
3627
|
type: "text",
|
|
3569
3628
|
ref: i,
|
|
3570
3629
|
defaultValue: String(n[0] ?? ""),
|
|
3571
|
-
onChange:
|
|
3630
|
+
onChange: A,
|
|
3572
3631
|
style: { width: "var(--reactaform-unit-input-width, 100px)" },
|
|
3573
|
-
className:
|
|
3632
|
+
className: K($.input, $.textInput)
|
|
3574
3633
|
}
|
|
3575
3634
|
),
|
|
3576
3635
|
/* @__PURE__ */ g.jsx(
|
|
@@ -3578,8 +3637,8 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3578
3637
|
{
|
|
3579
3638
|
ref: u,
|
|
3580
3639
|
defaultValue: xe(n[1] ?? e.default, e) || (n[1] ?? e.default),
|
|
3581
|
-
onChange:
|
|
3582
|
-
className:
|
|
3640
|
+
onChange: M,
|
|
3641
|
+
className: K(
|
|
3583
3642
|
$.input,
|
|
3584
3643
|
$.inputSelect
|
|
3585
3644
|
),
|
|
@@ -3590,7 +3649,7 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3590
3649
|
/* @__PURE__ */ g.jsx(
|
|
3591
3650
|
"button",
|
|
3592
3651
|
{
|
|
3593
|
-
onClick:
|
|
3652
|
+
onClick: z,
|
|
3594
3653
|
"aria-disabled": Q,
|
|
3595
3654
|
disabled: Q,
|
|
3596
3655
|
style: oe,
|
|
@@ -3610,12 +3669,12 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3610
3669
|
}
|
|
3611
3670
|
),
|
|
3612
3671
|
b && v && /* @__PURE__ */ g.jsx(
|
|
3613
|
-
|
|
3672
|
+
kt,
|
|
3614
3673
|
{
|
|
3615
3674
|
pos: y,
|
|
3616
3675
|
options: v,
|
|
3617
3676
|
onClose: () => {
|
|
3618
|
-
x(null),
|
|
3677
|
+
x(null), f(!1);
|
|
3619
3678
|
},
|
|
3620
3679
|
onClickOption: L
|
|
3621
3680
|
}
|
|
@@ -3623,13 +3682,13 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3623
3682
|
] })
|
|
3624
3683
|
] }) });
|
|
3625
3684
|
};
|
|
3626
|
-
function
|
|
3627
|
-
const { t: o } =
|
|
3685
|
+
function Ft({ field: e, value: r, onChange: n }) {
|
|
3686
|
+
const { t: o } = T(), t = e.dimension;
|
|
3628
3687
|
if (!t) return null;
|
|
3629
|
-
he[t] ||
|
|
3688
|
+
he[t] || Rt(t, o);
|
|
3630
3689
|
const a = he[t];
|
|
3631
3690
|
return a ? /* @__PURE__ */ g.jsx(
|
|
3632
|
-
|
|
3691
|
+
At,
|
|
3633
3692
|
{
|
|
3634
3693
|
unitFactors: a,
|
|
3635
3694
|
field: e,
|
|
@@ -3638,33 +3697,48 @@ function Nt({ field: e, value: r, onChange: n }) {
|
|
|
3638
3697
|
}
|
|
3639
3698
|
) : null;
|
|
3640
3699
|
}
|
|
3641
|
-
const
|
|
3700
|
+
const Xe = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]$/i, Ze = (e) => {
|
|
3642
3701
|
try {
|
|
3643
3702
|
return new URL(e), !0;
|
|
3644
3703
|
} catch {
|
|
3645
3704
|
return !1;
|
|
3646
3705
|
}
|
|
3647
|
-
},
|
|
3706
|
+
}, Mt = ({
|
|
3648
3707
|
field: e,
|
|
3649
3708
|
value: r,
|
|
3650
3709
|
onChange: n,
|
|
3651
3710
|
onError: o
|
|
3652
3711
|
}) => {
|
|
3653
|
-
const { t, definitionName: a } =
|
|
3654
|
-
(
|
|
3655
|
-
const c =
|
|
3656
|
-
|
|
3712
|
+
const { t, definitionName: a } = T(), s = k(null), i = Z(
|
|
3713
|
+
(p) => {
|
|
3714
|
+
const c = p.trim();
|
|
3715
|
+
if (c === "")
|
|
3716
|
+
return e.required ? t("Value required") : null;
|
|
3717
|
+
if (!Xe.test(c) && !Ze(c)) {
|
|
3718
|
+
const b = e.allowRelative === !0;
|
|
3719
|
+
let f = !1;
|
|
3720
|
+
if (Xe.test(c) || Ze(c))
|
|
3721
|
+
f = !0;
|
|
3722
|
+
else if (b)
|
|
3723
|
+
try {
|
|
3724
|
+
new URL(c, "http://example.com"), f = !0;
|
|
3725
|
+
} catch {
|
|
3726
|
+
f = !1;
|
|
3727
|
+
}
|
|
3728
|
+
if (!f) return t("Must be a valid URL");
|
|
3729
|
+
}
|
|
3730
|
+
return Y(a, e, c, t) ?? null;
|
|
3657
3731
|
},
|
|
3658
3732
|
[a, e, t]
|
|
3659
|
-
), u = (
|
|
3660
|
-
const c =
|
|
3733
|
+
), u = (p) => {
|
|
3734
|
+
const c = p.target.value, d = i(c);
|
|
3661
3735
|
n?.(c.trim(), d);
|
|
3662
3736
|
}, m = k(null), l = k(o);
|
|
3663
3737
|
return C(() => {
|
|
3664
3738
|
l.current = o;
|
|
3665
3739
|
}, [o]), C(() => {
|
|
3666
|
-
const
|
|
3667
|
-
s.current && s.current.value !== String(
|
|
3740
|
+
const p = r ?? "", c = i(p);
|
|
3741
|
+
s.current && s.current.value !== String(p) && (s.current.value = String(p)), c !== m.current && (m.current = c, l.current?.(c ?? null));
|
|
3668
3742
|
}, [r, i]), /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
3669
3743
|
"input",
|
|
3670
3744
|
{
|
|
@@ -3674,7 +3748,7 @@ const It = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
|
|
|
3674
3748
|
ref: s,
|
|
3675
3749
|
onChange: u,
|
|
3676
3750
|
style: { alignItems: "left" },
|
|
3677
|
-
className:
|
|
3751
|
+
className: K($.input, $.textInput),
|
|
3678
3752
|
placeholder: "https://example.com"
|
|
3679
3753
|
}
|
|
3680
3754
|
) });
|
|
@@ -3688,35 +3762,36 @@ const It = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
|
|
|
3688
3762
|
"stepper",
|
|
3689
3763
|
"color",
|
|
3690
3764
|
"rating"
|
|
3691
|
-
]),
|
|
3692
|
-
checkbox:
|
|
3693
|
-
color:
|
|
3694
|
-
date:
|
|
3695
|
-
dropdown:
|
|
3696
|
-
email:
|
|
3697
|
-
file:
|
|
3698
|
-
float:
|
|
3699
|
-
"float-array":
|
|
3700
|
-
image:
|
|
3701
|
-
int:
|
|
3702
|
-
"int-array":
|
|
3703
|
-
"multi-selection":
|
|
3704
|
-
multiline:
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3765
|
+
]), lr = {
|
|
3766
|
+
checkbox: _r,
|
|
3767
|
+
color: Br,
|
|
3768
|
+
date: Ur,
|
|
3769
|
+
dropdown: Wr,
|
|
3770
|
+
email: Jr,
|
|
3771
|
+
file: Kr,
|
|
3772
|
+
float: nt,
|
|
3773
|
+
"float-array": et,
|
|
3774
|
+
image: at,
|
|
3775
|
+
int: lt,
|
|
3776
|
+
"int-array": it,
|
|
3777
|
+
"multi-selection": mt,
|
|
3778
|
+
multiline: ut,
|
|
3779
|
+
password: xt,
|
|
3780
|
+
phone: pt,
|
|
3781
|
+
radio: gt,
|
|
3782
|
+
rating: yt,
|
|
3783
|
+
separator: Gr,
|
|
3784
|
+
slider: St,
|
|
3710
3785
|
string: Ke,
|
|
3711
|
-
stepper:
|
|
3712
|
-
switch:
|
|
3786
|
+
stepper: dt,
|
|
3787
|
+
switch: Ct,
|
|
3713
3788
|
text: Ke,
|
|
3714
|
-
time:
|
|
3715
|
-
unit:
|
|
3716
|
-
url:
|
|
3789
|
+
time: jt,
|
|
3790
|
+
unit: Ft,
|
|
3791
|
+
url: Mt
|
|
3717
3792
|
};
|
|
3718
|
-
function
|
|
3719
|
-
if (!n && e in
|
|
3793
|
+
function ur(e, r, n) {
|
|
3794
|
+
if (!n && e in lr) {
|
|
3720
3795
|
console.warn(
|
|
3721
3796
|
`Can't Overwrite Base Component type "${e}".`
|
|
3722
3797
|
);
|
|
@@ -3727,7 +3802,7 @@ function cr(e, r, n) {
|
|
|
3727
3802
|
return;
|
|
3728
3803
|
}
|
|
3729
3804
|
const o = (t) => {
|
|
3730
|
-
const { callback: s, cancel: i } =
|
|
3805
|
+
const { callback: s, cancel: i } = jr(
|
|
3731
3806
|
(...u) => {
|
|
3732
3807
|
const m = t.onChange;
|
|
3733
3808
|
typeof m == "function" && m(...u);
|
|
@@ -3736,30 +3811,30 @@ function cr(e, r, n) {
|
|
|
3736
3811
|
);
|
|
3737
3812
|
return C(() => () => {
|
|
3738
3813
|
i();
|
|
3739
|
-
}, [i]),
|
|
3814
|
+
}, [i]), N.createElement(r, { ...t, onChange: s });
|
|
3740
3815
|
};
|
|
3741
3816
|
Fe.register(e, o);
|
|
3742
3817
|
}
|
|
3743
|
-
function
|
|
3744
|
-
|
|
3818
|
+
function an(e, r) {
|
|
3819
|
+
ur(e, r, !1);
|
|
3745
3820
|
}
|
|
3746
|
-
function
|
|
3821
|
+
function $t(e) {
|
|
3747
3822
|
return Fe.get(e);
|
|
3748
3823
|
}
|
|
3749
|
-
let
|
|
3750
|
-
function
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
}),
|
|
3824
|
+
let Qe = !1;
|
|
3825
|
+
function mr() {
|
|
3826
|
+
Qe || (Object.entries(lr).forEach(([e, r]) => {
|
|
3827
|
+
ur(e, r, !0);
|
|
3828
|
+
}), Qe = !0);
|
|
3754
3829
|
}
|
|
3755
|
-
const
|
|
3756
|
-
function
|
|
3757
|
-
|
|
3830
|
+
const fr = new we();
|
|
3831
|
+
function Vt(e, r) {
|
|
3832
|
+
fr.register(e, r);
|
|
3758
3833
|
}
|
|
3759
3834
|
function Dt(e) {
|
|
3760
|
-
return
|
|
3835
|
+
return fr.get(e);
|
|
3761
3836
|
}
|
|
3762
|
-
|
|
3837
|
+
Vt(
|
|
3763
3838
|
"Preset_AlertSubmitHandler",
|
|
3764
3839
|
(e, r, n) => {
|
|
3765
3840
|
const o = {
|
|
@@ -3771,11 +3846,11 @@ $t(
|
|
|
3771
3846
|
alert(t);
|
|
3772
3847
|
}
|
|
3773
3848
|
);
|
|
3774
|
-
const
|
|
3775
|
-
const t =
|
|
3849
|
+
const dr = N.memo(({ field: e, value: r, handleChange: n, handleError: o }) => {
|
|
3850
|
+
const t = $t(e.type), a = N.useCallback(
|
|
3776
3851
|
(i, u) => n(e.name, i, u),
|
|
3777
3852
|
[n, e.name]
|
|
3778
|
-
), s =
|
|
3853
|
+
), s = N.useCallback(
|
|
3779
3854
|
(i) => o?.(e.name, i),
|
|
3780
3855
|
[o, e.name]
|
|
3781
3856
|
);
|
|
@@ -3789,9 +3864,9 @@ const mr = F.memo(({ field: e, value: r, handleChange: n, handleError: o }) => {
|
|
|
3789
3864
|
}
|
|
3790
3865
|
) : null;
|
|
3791
3866
|
}, (e, r) => e.field === r.field && e.value === r.value && e.handleChange === r.handleChange && e.handleError === r.handleError);
|
|
3792
|
-
|
|
3793
|
-
const
|
|
3794
|
-
|
|
3867
|
+
dr.displayName = "FieldWrapper";
|
|
3868
|
+
const pr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
3869
|
+
dr,
|
|
3795
3870
|
{
|
|
3796
3871
|
field: e,
|
|
3797
3872
|
value: r[e.name],
|
|
@@ -3799,8 +3874,8 @@ const fr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
|
3799
3874
|
handleError: o
|
|
3800
3875
|
},
|
|
3801
3876
|
e.name
|
|
3802
|
-
),
|
|
3803
|
-
const u =
|
|
3877
|
+
), gr = N.memo(({ groupName: e, isOpen: r, fields: n, valuesMap: o, handleChange: t, handleError: a, toggleGroup: s, t: i }) => {
|
|
3878
|
+
const u = N.useCallback(() => s(e), [s, e]), { formStyle: m, fieldStyle: l } = T(), p = N.useMemo(() => ({
|
|
3804
3879
|
border: "1px solid var(--reactaform-border-color, #bbb)",
|
|
3805
3880
|
padding: "var(--reactaform-fieldset-padding, 0.5em)",
|
|
3806
3881
|
borderRadius: "var(--reactaform-border-radius, 4px)",
|
|
@@ -3808,7 +3883,7 @@ const fr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
|
3808
3883
|
// allow per-form overrides if provider exposes them
|
|
3809
3884
|
...m?.fieldset || {},
|
|
3810
3885
|
...l?.fieldset || {}
|
|
3811
|
-
}), [m, l]), c =
|
|
3886
|
+
}), [m, l]), c = N.useMemo(() => ({
|
|
3812
3887
|
fontWeight: "bold",
|
|
3813
3888
|
cursor: "pointer",
|
|
3814
3889
|
display: "flex",
|
|
@@ -3819,23 +3894,23 @@ const fr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
|
3819
3894
|
...m?.legend || {},
|
|
3820
3895
|
...l?.legend || {}
|
|
3821
3896
|
}), [m, l]);
|
|
3822
|
-
return /* @__PURE__ */ g.jsxs("fieldset", { style:
|
|
3897
|
+
return /* @__PURE__ */ g.jsxs("fieldset", { style: p, children: [
|
|
3823
3898
|
/* @__PURE__ */ g.jsxs("legend", { onClick: u, style: c, children: [
|
|
3824
3899
|
/* @__PURE__ */ g.jsx("span", { children: i(e) }),
|
|
3825
3900
|
/* @__PURE__ */ g.jsx("span", { children: r ? "▼" : "▶" })
|
|
3826
3901
|
] }),
|
|
3827
|
-
r && n.map((d) => /* @__PURE__ */ g.jsx("div", { children:
|
|
3902
|
+
r && n.map((d) => /* @__PURE__ */ g.jsx("div", { children: pr(d, o, t, a) }, d.name))
|
|
3828
3903
|
] });
|
|
3829
3904
|
});
|
|
3830
|
-
|
|
3831
|
-
const
|
|
3832
|
-
const m = r.slice(0, i).filter((d) => s[d.name]),
|
|
3833
|
-
return
|
|
3905
|
+
gr.displayName = "FieldGroup";
|
|
3906
|
+
const zt = (e, r, n, o, t, a, s, i, u) => {
|
|
3907
|
+
const m = r.slice(0, i).filter((d) => s[d.name]), p = $r(m).groups, c = [];
|
|
3908
|
+
return p.forEach((d) => {
|
|
3834
3909
|
if (d.name) {
|
|
3835
3910
|
const b = e[d.name] ?? !0;
|
|
3836
3911
|
c.push(
|
|
3837
3912
|
/* @__PURE__ */ g.jsx(
|
|
3838
|
-
|
|
3913
|
+
gr,
|
|
3839
3914
|
{
|
|
3840
3915
|
groupName: d.name,
|
|
3841
3916
|
isOpen: b,
|
|
@@ -3850,7 +3925,7 @@ const Vt = (e, r, n, o, t, a, s, i, u) => {
|
|
|
3850
3925
|
)
|
|
3851
3926
|
);
|
|
3852
3927
|
} else
|
|
3853
|
-
d.fields.forEach((b) => c.push(/* @__PURE__ */ g.jsx("div", { children:
|
|
3928
|
+
d.fields.forEach((b) => c.push(/* @__PURE__ */ g.jsx("div", { children: pr(b, n, t, a) }, b.name)));
|
|
3854
3929
|
}), c;
|
|
3855
3930
|
}, Tt = (e) => {
|
|
3856
3931
|
const r = {};
|
|
@@ -3864,19 +3939,19 @@ const Vt = (e, r, n, o, t, a, s, i, u) => {
|
|
|
3864
3939
|
(t.children[s] || []).forEach((u) => {
|
|
3865
3940
|
o[u] = !0, Pe(u, r, n, o);
|
|
3866
3941
|
});
|
|
3867
|
-
},
|
|
3942
|
+
}, hr = (e, r, n) => {
|
|
3868
3943
|
const o = r[e];
|
|
3869
3944
|
o?.children && Object.values(o.children).flat().forEach((t) => {
|
|
3870
|
-
n[t] = !1,
|
|
3945
|
+
n[t] = !1, hr(t, r, n);
|
|
3871
3946
|
});
|
|
3872
|
-
},
|
|
3947
|
+
}, Lt = (e, r, n, o) => {
|
|
3873
3948
|
const t = { ...n };
|
|
3874
3949
|
return e.forEach((a) => {
|
|
3875
3950
|
(!a.parents || Object.keys(a.parents).length === 0) && (t[a.name] = !0, Pe(a.name, o, r, t));
|
|
3876
3951
|
}), t;
|
|
3877
|
-
},
|
|
3952
|
+
}, Pt = (e, r, n, o, t) => {
|
|
3878
3953
|
const a = { ...e };
|
|
3879
|
-
if (
|
|
3954
|
+
if (hr(o, r, a), t != null) {
|
|
3880
3955
|
const s = r[o];
|
|
3881
3956
|
if (s?.children) {
|
|
3882
3957
|
const i = String(t);
|
|
@@ -3887,7 +3962,7 @@ const Vt = (e, r, n, o, t, a, s, i, u) => {
|
|
|
3887
3962
|
}
|
|
3888
3963
|
return a;
|
|
3889
3964
|
};
|
|
3890
|
-
function
|
|
3965
|
+
function _t(e, r, n, o, t) {
|
|
3891
3966
|
const a = Object.values(t).filter(Boolean);
|
|
3892
3967
|
if (a.length > 0)
|
|
3893
3968
|
return {
|
|
@@ -3898,17 +3973,17 @@ function Pt(e, r, n, o, t) {
|
|
|
3898
3973
|
const s = { ...n }, i = [];
|
|
3899
3974
|
if (e && Array.isArray(e.properties))
|
|
3900
3975
|
for (const m of e.properties) {
|
|
3901
|
-
const l = m.name,
|
|
3902
|
-
if (
|
|
3976
|
+
const l = m.name, p = s[l];
|
|
3977
|
+
if (p == null) continue;
|
|
3903
3978
|
const c = m.type;
|
|
3904
3979
|
try {
|
|
3905
|
-
if (
|
|
3906
|
-
const d = Number(String(
|
|
3980
|
+
if (c === "int" || c === "number" || c === "float") {
|
|
3981
|
+
const d = Number(String(p).trim());
|
|
3907
3982
|
isNaN(d) ? i.push(o(`Invalid number format for field ${m.displayName || l}`)) : s[l] = d;
|
|
3908
|
-
} else if (
|
|
3909
|
-
const b = String(
|
|
3910
|
-
const y = Number(
|
|
3911
|
-
return isNaN(y) ? (i.push(o(`Invalid number "${
|
|
3983
|
+
} else if (c === "int-array" || c === "float-array") {
|
|
3984
|
+
const b = String(p).split(",").map((f) => f.trim()).filter(Boolean).map((f) => {
|
|
3985
|
+
const y = Number(f);
|
|
3986
|
+
return isNaN(y) ? (i.push(o(`Invalid number "${f}" in array for field ${m.displayName || l}`)), 0) : y;
|
|
3912
3987
|
});
|
|
3913
3988
|
i.length === 0 && (s[l] = b);
|
|
3914
3989
|
}
|
|
@@ -3922,7 +3997,7 @@ function Pt(e, r, n, o, t) {
|
|
|
3922
3997
|
message: o("Data transformation errors occurred."),
|
|
3923
3998
|
errors: i
|
|
3924
3999
|
};
|
|
3925
|
-
const u =
|
|
4000
|
+
const u = Nr(e, s, o);
|
|
3926
4001
|
if (u && u.length > 0)
|
|
3927
4002
|
return {
|
|
3928
4003
|
success: !1,
|
|
@@ -3954,20 +4029,20 @@ function Pt(e, r, n, o, t) {
|
|
|
3954
4029
|
data: s
|
|
3955
4030
|
};
|
|
3956
4031
|
}
|
|
3957
|
-
const
|
|
4032
|
+
const qt = ({
|
|
3958
4033
|
definition: e,
|
|
3959
4034
|
instance: r,
|
|
3960
4035
|
chunkSize: n = 50,
|
|
3961
4036
|
chunkDelay: o = 50
|
|
3962
4037
|
}) => {
|
|
3963
|
-
const { properties: t, displayName: a } = e, s =
|
|
4038
|
+
const { properties: t, displayName: a } = e, s = T(), { t: i, formStyle: u, language: m } = s, l = {
|
|
3964
4039
|
...s,
|
|
3965
4040
|
definitionName: e?.name ?? s.definitionName
|
|
3966
|
-
}, [
|
|
4041
|
+
}, [p, c] = D("en"), [d, b] = D([]), [f, y] = D({}), [x, v] = D(
|
|
3967
4042
|
{}
|
|
3968
|
-
), [
|
|
4043
|
+
), [F, R] = D({}), [w, j] = D({}), [I, S] = D({}), [A, M] = D(null), [z, L] = D(null), [J, ce] = D(0), [re, ue] = D(!1), [Q, oe] = D(!1), [P, O] = D(r.name || ""), h = k(r), E = k(!1);
|
|
3969
4044
|
C(() => {
|
|
3970
|
-
const
|
|
4045
|
+
const V = Object.fromEntries(
|
|
3971
4046
|
t.map((H) => [
|
|
3972
4047
|
H.name,
|
|
3973
4048
|
{ ...H, children: {} }
|
|
@@ -3975,52 +4050,52 @@ const _t = ({
|
|
|
3975
4050
|
);
|
|
3976
4051
|
t.forEach((H) => {
|
|
3977
4052
|
H.parents && Object.entries(H.parents).forEach(([me, Se]) => {
|
|
3978
|
-
const fe =
|
|
3979
|
-
fe && Se.forEach((
|
|
4053
|
+
const fe = V[me];
|
|
4054
|
+
fe && Se.forEach((br) => {
|
|
3980
4055
|
fe.children || (fe.children = {});
|
|
3981
|
-
const _e = String(
|
|
4056
|
+
const _e = String(br);
|
|
3982
4057
|
fe.children[_e] = [
|
|
3983
4058
|
...fe.children[_e] || [],
|
|
3984
4059
|
H.name
|
|
3985
4060
|
];
|
|
3986
4061
|
});
|
|
3987
4062
|
});
|
|
3988
|
-
}),
|
|
4063
|
+
}), Or(t, V);
|
|
3989
4064
|
const q = Object.values(
|
|
3990
|
-
|
|
3991
|
-
),
|
|
4065
|
+
V
|
|
4066
|
+
), X = {};
|
|
3992
4067
|
q.forEach((H) => {
|
|
3993
4068
|
if (H.type === "unit") {
|
|
3994
4069
|
const me = typeof H.defaultValue == "number" ? String(H.defaultValue) : "", Se = typeof H.defaultUnit == "string" ? H.defaultUnit : String(H.defaultUnit ?? "m");
|
|
3995
|
-
|
|
4070
|
+
X[H.name] = [me, Se];
|
|
3996
4071
|
} else
|
|
3997
|
-
|
|
4072
|
+
X[H.name] = H.defaultValue;
|
|
3998
4073
|
}), h.current = r, Object.keys(r.values).forEach((H) => {
|
|
3999
|
-
|
|
4074
|
+
V[H] !== void 0 && (X[H] = r.values[H]);
|
|
4000
4075
|
});
|
|
4001
4076
|
const ee = Tt(q), te = {};
|
|
4002
4077
|
q.forEach((H) => {
|
|
4003
4078
|
H.group && !(H.group in te) && (te[H.group] = !0);
|
|
4004
4079
|
});
|
|
4005
4080
|
const le = requestAnimationFrame(() => {
|
|
4006
|
-
b(q), y(
|
|
4007
|
-
|
|
4008
|
-
), j(te), ue(!0),
|
|
4081
|
+
b(q), y(V), v(X), R(
|
|
4082
|
+
Lt(q, X, ee, V)
|
|
4083
|
+
), j(te), ue(!0), O(r.name);
|
|
4009
4084
|
});
|
|
4010
4085
|
return () => cancelAnimationFrame(le);
|
|
4011
4086
|
}, [t, r, e]), C(() => {
|
|
4012
4087
|
if (!re || J >= d.length) return;
|
|
4013
|
-
const
|
|
4088
|
+
const V = setTimeout(() => {
|
|
4014
4089
|
ce(
|
|
4015
4090
|
(q) => Math.min(q + n, d.length)
|
|
4016
4091
|
);
|
|
4017
4092
|
}, o);
|
|
4018
|
-
return () => clearTimeout(
|
|
4093
|
+
return () => clearTimeout(V);
|
|
4019
4094
|
}, [re, J, d.length, n, o]);
|
|
4020
4095
|
const B = Z(
|
|
4021
|
-
(
|
|
4022
|
-
|
|
4023
|
-
const te = { ...ee, [
|
|
4096
|
+
(V, q, X) => {
|
|
4097
|
+
M(null), L(null), v((ee) => {
|
|
4098
|
+
const te = { ...ee, [V]: q }, le = f[V];
|
|
4024
4099
|
return le && [
|
|
4025
4100
|
"checkbox",
|
|
4026
4101
|
"dropdown",
|
|
@@ -4028,52 +4103,52 @@ const _t = ({
|
|
|
4028
4103
|
"radio",
|
|
4029
4104
|
"switch"
|
|
4030
4105
|
].includes(le.type) && R(
|
|
4031
|
-
(me) =>
|
|
4106
|
+
(me) => Pt(
|
|
4032
4107
|
me,
|
|
4033
|
-
|
|
4108
|
+
f,
|
|
4034
4109
|
te,
|
|
4035
|
-
|
|
4110
|
+
V,
|
|
4036
4111
|
String(q)
|
|
4037
4112
|
)
|
|
4038
4113
|
), te;
|
|
4039
|
-
}), S((ee) =>
|
|
4114
|
+
}), S((ee) => X ? { ...ee, [V]: X } : Object.fromEntries(Object.entries(ee).filter(([le]) => le !== V)));
|
|
4040
4115
|
},
|
|
4041
|
-
[
|
|
4116
|
+
[f, M, L]
|
|
4042
4117
|
);
|
|
4043
4118
|
C(() => {
|
|
4044
|
-
let
|
|
4045
|
-
return
|
|
4046
|
-
m !==
|
|
4047
|
-
}), () => cancelAnimationFrame(
|
|
4048
|
-
}, [m,
|
|
4049
|
-
let
|
|
4050
|
-
return
|
|
4119
|
+
let V = 0;
|
|
4120
|
+
return V = requestAnimationFrame(() => {
|
|
4121
|
+
m !== p && (c(m || "en"), M(null), L(null));
|
|
4122
|
+
}), () => cancelAnimationFrame(V);
|
|
4123
|
+
}, [m, p]), C(() => {
|
|
4124
|
+
let V = 0;
|
|
4125
|
+
return V = requestAnimationFrame(() => {
|
|
4051
4126
|
if (E.current) {
|
|
4052
|
-
E.current = !1, h.current = r,
|
|
4127
|
+
E.current = !1, h.current = r, O(r.name || "");
|
|
4053
4128
|
return;
|
|
4054
4129
|
}
|
|
4055
|
-
h.current = r,
|
|
4056
|
-
}), () => cancelAnimationFrame(
|
|
4130
|
+
h.current = r, M(null), L(null), O(r.name || "");
|
|
4131
|
+
}), () => cancelAnimationFrame(V);
|
|
4057
4132
|
}, [r, r.name]);
|
|
4058
|
-
const U = Z((
|
|
4059
|
-
S((
|
|
4133
|
+
const U = Z((V, q) => {
|
|
4134
|
+
S((X) => q ? { ...X, [V]: String(q) } : Object.fromEntries(Object.entries(X).filter(([te]) => te !== V)));
|
|
4060
4135
|
}, []), ne = () => {
|
|
4061
4136
|
E.current = !0;
|
|
4062
|
-
const
|
|
4137
|
+
const V = h.current?.name;
|
|
4063
4138
|
h.current.name = P;
|
|
4064
|
-
const q =
|
|
4139
|
+
const q = _t(e, h.current, x, i, I), X = typeof q.message == "string" ? q.message : String(q.message), ee = Object.values(q.errors ?? {}).join(`
|
|
4065
4140
|
`);
|
|
4066
|
-
|
|
4067
|
-
` + ee :
|
|
4068
|
-
}, ae = (
|
|
4069
|
-
j((q) => ({ ...q, [
|
|
4141
|
+
M(ee ? X + `
|
|
4142
|
+
` + ee : X), L(q.success), q.success || (h.current.name = V ?? h.current.name, O(V ?? ""));
|
|
4143
|
+
}, ae = (V) => {
|
|
4144
|
+
j((q) => ({ ...q, [V]: !q[V] }));
|
|
4070
4145
|
}, _ = G(
|
|
4071
|
-
() => Object.values(
|
|
4072
|
-
[
|
|
4146
|
+
() => Object.values(I).some(Boolean),
|
|
4147
|
+
[I]
|
|
4073
4148
|
);
|
|
4074
|
-
return /* @__PURE__ */ g.jsx(
|
|
4149
|
+
return /* @__PURE__ */ g.jsx(Oe.Provider, { value: l, children: /* @__PURE__ */ g.jsxs("div", { style: u.container, children: [
|
|
4075
4150
|
a && /* @__PURE__ */ g.jsx("h2", { style: u.titleStyle, children: i(a) }),
|
|
4076
|
-
|
|
4151
|
+
A && /* @__PURE__ */ g.jsxs(
|
|
4077
4152
|
"div",
|
|
4078
4153
|
{
|
|
4079
4154
|
role: "status",
|
|
@@ -4081,20 +4156,20 @@ const _t = ({
|
|
|
4081
4156
|
marginBottom: 12,
|
|
4082
4157
|
padding: 12,
|
|
4083
4158
|
borderRadius: 6,
|
|
4084
|
-
backgroundColor:
|
|
4085
|
-
border: `1px solid ${
|
|
4086
|
-
color:
|
|
4159
|
+
backgroundColor: z ? "rgba(76, 175, 80, 0.12)" : "rgba(225, 29, 72, 0.06)",
|
|
4160
|
+
border: `1px solid ${z ? "rgba(76,175,80,0.3)" : "rgba(225,29,72,0.12)"}`,
|
|
4161
|
+
color: z ? "var(--reactaform-success-color, #4CAF50)" : "var(--reactaform-error-color, #e11d48)",
|
|
4087
4162
|
display: "flex",
|
|
4088
4163
|
alignItems: "center",
|
|
4089
4164
|
justifyContent: "space-between"
|
|
4090
4165
|
},
|
|
4091
4166
|
children: [
|
|
4092
|
-
/* @__PURE__ */ g.jsx("div", { style: { whiteSpace: "pre-wrap", flex: 1 }, children:
|
|
4167
|
+
/* @__PURE__ */ g.jsx("div", { style: { whiteSpace: "pre-wrap", flex: 1 }, children: A }),
|
|
4093
4168
|
/* @__PURE__ */ g.jsx(
|
|
4094
4169
|
"button",
|
|
4095
4170
|
{
|
|
4096
4171
|
onClick: () => {
|
|
4097
|
-
|
|
4172
|
+
M(null), L(null);
|
|
4098
4173
|
},
|
|
4099
4174
|
"aria-label": i("Dismiss"),
|
|
4100
4175
|
style: {
|
|
@@ -4113,23 +4188,23 @@ const _t = ({
|
|
|
4113
4188
|
}
|
|
4114
4189
|
),
|
|
4115
4190
|
r && /* @__PURE__ */ g.jsx(
|
|
4116
|
-
|
|
4191
|
+
tr,
|
|
4117
4192
|
{
|
|
4118
4193
|
name: P,
|
|
4119
|
-
onChange: (
|
|
4120
|
-
|
|
4194
|
+
onChange: (V) => {
|
|
4195
|
+
O(V), M(null), L(null);
|
|
4121
4196
|
}
|
|
4122
4197
|
}
|
|
4123
4198
|
),
|
|
4124
4199
|
/* @__PURE__ */ g.jsxs(g.Fragment, { children: [
|
|
4125
|
-
|
|
4200
|
+
zt(
|
|
4126
4201
|
w,
|
|
4127
4202
|
d,
|
|
4128
4203
|
x,
|
|
4129
4204
|
i,
|
|
4130
4205
|
B,
|
|
4131
4206
|
U,
|
|
4132
|
-
|
|
4207
|
+
F,
|
|
4133
4208
|
J,
|
|
4134
4209
|
ae
|
|
4135
4210
|
),
|
|
@@ -4169,8 +4244,8 @@ const _t = ({
|
|
|
4169
4244
|
)
|
|
4170
4245
|
] }) });
|
|
4171
4246
|
};
|
|
4172
|
-
|
|
4173
|
-
const
|
|
4247
|
+
mr();
|
|
4248
|
+
const Bt = (e, r = !1) => ({
|
|
4174
4249
|
container: {
|
|
4175
4250
|
padding: "var(--reactaform-space-sm, 8px)",
|
|
4176
4251
|
margin: "0 auto",
|
|
@@ -4211,7 +4286,7 @@ const qt = (e, r = !1) => ({
|
|
|
4211
4286
|
lineHeight: "1.2",
|
|
4212
4287
|
textAlign: "left"
|
|
4213
4288
|
}
|
|
4214
|
-
}),
|
|
4289
|
+
}), Ht = (e, r = !1) => {
|
|
4215
4290
|
const n = {
|
|
4216
4291
|
color: "var(--reactaform-color-text)",
|
|
4217
4292
|
fontFamily: e?.fontFamily || "var(--reactaform-font-family, inherit)",
|
|
@@ -4270,7 +4345,7 @@ const qt = (e, r = !1) => ({
|
|
|
4270
4345
|
display: "block"
|
|
4271
4346
|
}
|
|
4272
4347
|
};
|
|
4273
|
-
},
|
|
4348
|
+
}, Ut = ({
|
|
4274
4349
|
children: e,
|
|
4275
4350
|
definitionName: r = "",
|
|
4276
4351
|
defaultStyle: n,
|
|
@@ -4279,36 +4354,36 @@ const qt = (e, r = !1) => ({
|
|
|
4279
4354
|
defaultLocalizeName: a = "",
|
|
4280
4355
|
className: s = "reactaform-container"
|
|
4281
4356
|
}) => {
|
|
4282
|
-
const i = r, u = a, m = t, l = o,
|
|
4357
|
+
const i = r, u = a, m = t, l = o, p = G(
|
|
4283
4358
|
() => n ?? {},
|
|
4284
4359
|
[n]
|
|
4285
|
-
), [c, d] =
|
|
4360
|
+
), [c, d] = D({}), [b, f] = D({}), [y, x] = D({}), [v, F] = D({});
|
|
4286
4361
|
C(() => {
|
|
4287
4362
|
let S = !0;
|
|
4288
4363
|
return (async () => {
|
|
4289
4364
|
if (l === "en") {
|
|
4290
|
-
S && (d({}),
|
|
4365
|
+
S && (d({}), f({}));
|
|
4291
4366
|
return;
|
|
4292
4367
|
}
|
|
4293
4368
|
try {
|
|
4294
|
-
const
|
|
4295
|
-
S && d(
|
|
4296
|
-
const L = await
|
|
4297
|
-
S &&
|
|
4369
|
+
const M = await Dr(l), z = M.success ? M.translations : {};
|
|
4370
|
+
S && d(z);
|
|
4371
|
+
const L = await zr(l, u), J = L.success ? L.translations : {};
|
|
4372
|
+
S && f(J);
|
|
4298
4373
|
} catch {
|
|
4299
|
-
S && (d({}),
|
|
4374
|
+
S && (d({}), f({}));
|
|
4300
4375
|
}
|
|
4301
4376
|
})(), () => {
|
|
4302
4377
|
S = !1;
|
|
4303
4378
|
};
|
|
4304
4379
|
}, [l, u]), C(() => {
|
|
4305
|
-
|
|
4306
|
-
}, [
|
|
4380
|
+
F(Bt(p, m)), x(Ht(p, m));
|
|
4381
|
+
}, [p, m]);
|
|
4307
4382
|
const R = G(
|
|
4308
|
-
() =>
|
|
4383
|
+
() => Lr(l, c, b),
|
|
4309
4384
|
[l, c, b]
|
|
4310
4385
|
), w = Z(
|
|
4311
|
-
(S, ...
|
|
4386
|
+
(S, ...A) => R(S, ...A),
|
|
4312
4387
|
[R]
|
|
4313
4388
|
), j = G(
|
|
4314
4389
|
() => ({
|
|
@@ -4320,18 +4395,18 @@ const qt = (e, r = !1) => ({
|
|
|
4320
4395
|
t: w
|
|
4321
4396
|
}),
|
|
4322
4397
|
[i, l, m, y, v, w]
|
|
4323
|
-
),
|
|
4324
|
-
return /* @__PURE__ */ g.jsx(
|
|
4398
|
+
), I = p?.height ? { height: "100%" } : void 0;
|
|
4399
|
+
return /* @__PURE__ */ g.jsx(Oe.Provider, { value: j, children: /* @__PURE__ */ g.jsx(
|
|
4325
4400
|
"div",
|
|
4326
4401
|
{
|
|
4327
4402
|
"data-reactaform-theme": m ? "dark" : "light",
|
|
4328
4403
|
className: s,
|
|
4329
|
-
style:
|
|
4404
|
+
style: I,
|
|
4330
4405
|
children: e
|
|
4331
4406
|
}
|
|
4332
4407
|
) });
|
|
4333
4408
|
};
|
|
4334
|
-
function
|
|
4409
|
+
function Wt(e) {
|
|
4335
4410
|
if (!e || typeof e != "object") return "Definition must be an object";
|
|
4336
4411
|
const r = e;
|
|
4337
4412
|
if (!r.name || typeof r.name != "string") return "Definition must include a 'name' string";
|
|
@@ -4346,7 +4421,7 @@ function Ut(e) {
|
|
|
4346
4421
|
}
|
|
4347
4422
|
return null;
|
|
4348
4423
|
}
|
|
4349
|
-
async function
|
|
4424
|
+
async function sn(e, r = {}) {
|
|
4350
4425
|
const { validateSchema: n = !0 } = r;
|
|
4351
4426
|
try {
|
|
4352
4427
|
if (!e || typeof e != "string")
|
|
@@ -4364,7 +4439,7 @@ async function an(e, r = {}) {
|
|
|
4364
4439
|
};
|
|
4365
4440
|
}
|
|
4366
4441
|
if (n) {
|
|
4367
|
-
const a =
|
|
4442
|
+
const a = Wt(t);
|
|
4368
4443
|
if (a)
|
|
4369
4444
|
return { success: !1, error: `Schema validation failed: ${a}` };
|
|
4370
4445
|
}
|
|
@@ -4373,7 +4448,7 @@ async function an(e, r = {}) {
|
|
|
4373
4448
|
return { success: !1, error: `Unexpected error loading definition: ${o instanceof Error ? o.message : "Unknown error"}` };
|
|
4374
4449
|
}
|
|
4375
4450
|
}
|
|
4376
|
-
function
|
|
4451
|
+
function Yt(e, r) {
|
|
4377
4452
|
try {
|
|
4378
4453
|
if (!e)
|
|
4379
4454
|
return { success: !1, error: "Definition is required" };
|
|
@@ -4396,7 +4471,7 @@ function Wt(e, r) {
|
|
|
4396
4471
|
};
|
|
4397
4472
|
}
|
|
4398
4473
|
}
|
|
4399
|
-
function
|
|
4474
|
+
function cn(e) {
|
|
4400
4475
|
try {
|
|
4401
4476
|
if (!e)
|
|
4402
4477
|
return { success: !1, error: "Instance data is required" };
|
|
@@ -4420,9 +4495,9 @@ function sn(e) {
|
|
|
4420
4495
|
};
|
|
4421
4496
|
}
|
|
4422
4497
|
}
|
|
4423
|
-
|
|
4424
|
-
function
|
|
4425
|
-
const [r, n] =
|
|
4498
|
+
mr();
|
|
4499
|
+
function Jt(e) {
|
|
4500
|
+
const [r, n] = D(null);
|
|
4426
4501
|
return C(() => {
|
|
4427
4502
|
const o = document.querySelector("[data-reactaform-theme]");
|
|
4428
4503
|
if (!o) return;
|
|
@@ -4437,7 +4512,7 @@ function Yt(e) {
|
|
|
4437
4512
|
return s.observe(t, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => s.disconnect();
|
|
4438
4513
|
}, [e]), r;
|
|
4439
4514
|
}
|
|
4440
|
-
const
|
|
4515
|
+
const ln = ({
|
|
4441
4516
|
definitionData: e,
|
|
4442
4517
|
instance: r,
|
|
4443
4518
|
language: n,
|
|
@@ -4451,21 +4526,21 @@ const cn = ({
|
|
|
4451
4526
|
} catch {
|
|
4452
4527
|
return null;
|
|
4453
4528
|
}
|
|
4454
|
-
}, [e]), i = { fontSize: "inherit", fontFamily: "inherit", ...a }, u =
|
|
4529
|
+
}, [e]), i = { fontSize: "inherit", fontFamily: "inherit", ...a }, u = Jt(), m = t ?? u === "dark", l = n ?? "en";
|
|
4455
4530
|
if (C(() => {
|
|
4456
4531
|
let c = document.getElementById("popup-root");
|
|
4457
4532
|
c || (c = document.createElement("div"), c.id = "popup-root", document.body.appendChild(c));
|
|
4458
4533
|
}, []), !s)
|
|
4459
4534
|
return /* @__PURE__ */ g.jsx("div", { style: { color: "red" }, children: "Error: No form definition provided." });
|
|
4460
|
-
let
|
|
4461
|
-
if (!
|
|
4462
|
-
const c =
|
|
4535
|
+
let p = r;
|
|
4536
|
+
if (!p) {
|
|
4537
|
+
const c = Yt(s, s.name);
|
|
4463
4538
|
if (!c.success || !c.instance)
|
|
4464
4539
|
return /* @__PURE__ */ g.jsx("div", { style: { color: "red" }, children: "Error: Failed to create instance from definition." });
|
|
4465
|
-
|
|
4540
|
+
p = c.instance;
|
|
4466
4541
|
}
|
|
4467
4542
|
return /* @__PURE__ */ g.jsx(
|
|
4468
|
-
|
|
4543
|
+
Ut,
|
|
4469
4544
|
{
|
|
4470
4545
|
definitionName: s.name,
|
|
4471
4546
|
defaultStyle: i,
|
|
@@ -4474,46 +4549,46 @@ const cn = ({
|
|
|
4474
4549
|
defaultLocalizeName: s.localization || "",
|
|
4475
4550
|
className: o,
|
|
4476
4551
|
children: /* @__PURE__ */ g.jsx(
|
|
4477
|
-
|
|
4552
|
+
qt,
|
|
4478
4553
|
{
|
|
4479
4554
|
definition: s,
|
|
4480
|
-
instance:
|
|
4555
|
+
instance: p
|
|
4481
4556
|
}
|
|
4482
4557
|
)
|
|
4483
4558
|
}
|
|
4484
4559
|
);
|
|
4485
4560
|
};
|
|
4486
|
-
function
|
|
4561
|
+
function Gt() {
|
|
4487
4562
|
if (!(typeof document > "u") && !document.getElementById("reactaform-styles"))
|
|
4488
4563
|
try {
|
|
4489
4564
|
const e = document.createElement("style");
|
|
4490
|
-
e.id = "reactaform-styles", e.textContent =
|
|
4565
|
+
e.id = "reactaform-styles", e.textContent = vr, document.head.appendChild(e);
|
|
4491
4566
|
} catch {
|
|
4492
4567
|
}
|
|
4493
4568
|
}
|
|
4494
|
-
|
|
4569
|
+
Gt();
|
|
4495
4570
|
export {
|
|
4496
4571
|
$ as CSS_CLASSES,
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4572
|
+
ln as ReactaForm,
|
|
4573
|
+
Ut as ReactaFormProvider,
|
|
4574
|
+
qt as ReactaFormRenderer,
|
|
4500
4575
|
W as StandardFieldLayout,
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4576
|
+
on as Units,
|
|
4577
|
+
K as combineClasses,
|
|
4578
|
+
Yt as createInstanceFromDefinition,
|
|
4579
|
+
nn as deserializeDefinition,
|
|
4580
|
+
rn as deserializeInstance,
|
|
4581
|
+
$t as getComponent,
|
|
4582
|
+
cn as loadInstance,
|
|
4583
|
+
sn as loadJsonDefinition,
|
|
4584
|
+
an as registerComponent,
|
|
4585
|
+
Qt as registerFieldValidationHandler,
|
|
4586
|
+
Zt as registerFormValidationHandler,
|
|
4587
|
+
Vt as registerSubmissionHandler,
|
|
4588
|
+
tn as serializeDefinition,
|
|
4589
|
+
en as serializeInstance,
|
|
4590
|
+
jr as useDebouncedCallback,
|
|
4591
|
+
T as useReactaFormContext,
|
|
4517
4592
|
Y as validateFieldValue,
|
|
4518
|
-
|
|
4593
|
+
Nr as validateFormValues
|
|
4519
4594
|
};
|