reactaform 1.1.5 → 1.1.6
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 +1 -1
- package/dist/{common-BnnwzTl2.js → common-C-TIZ3UJ.js} +35 -26
- package/dist/{common-DLqVHgfX.js → common-CDu1xkTC.js} +39 -30
- package/dist/{common-BQcVe8MY.js → common-CkBVkhXb.js} +35 -26
- package/dist/{common-Bzz0clAC.js → common-D4RlfeS8.js} +28 -19
- package/dist/reactaform.cjs.js +6 -6
- package/dist/reactaform.es.js +1108 -1039
- package/package.json +1 -1
package/dist/reactaform.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import F, { createContext as hr, useContext as br, useRef as k, useEffect as C, useCallback as Z, useState as V, useMemo as G, memo as ve } from "react";
|
|
2
|
+
import Oe from "react-dom";
|
|
3
|
+
const yr = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
4
4
|
\r
|
|
5
5
|
/* Default Light Theme */\r
|
|
6
6
|
:root {\r
|
|
@@ -289,21 +289,21 @@ const xr = `/* ReactaForm CSS Custom Properties (CSS Variables) */\r
|
|
|
289
289
|
`;
|
|
290
290
|
var be = { exports: {} }, de = {};
|
|
291
291
|
var qe;
|
|
292
|
-
function
|
|
292
|
+
function xr() {
|
|
293
293
|
if (qe) return de;
|
|
294
294
|
qe = 1;
|
|
295
295
|
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
296
296
|
function n(o, t, a) {
|
|
297
|
-
var
|
|
298
|
-
if (a !== void 0 && (
|
|
297
|
+
var s = null;
|
|
298
|
+
if (a !== void 0 && (s = "" + a), t.key !== void 0 && (s = "" + t.key), "key" in t) {
|
|
299
299
|
a = {};
|
|
300
|
-
for (var
|
|
301
|
-
|
|
300
|
+
for (var i in t)
|
|
301
|
+
i !== "key" && (a[i] = t[i]);
|
|
302
302
|
} else a = t;
|
|
303
303
|
return t = a.ref, {
|
|
304
304
|
$$typeof: e,
|
|
305
305
|
type: o,
|
|
306
|
-
key:
|
|
306
|
+
key: s,
|
|
307
307
|
ref: t !== void 0 ? t : null,
|
|
308
308
|
props: a
|
|
309
309
|
};
|
|
@@ -312,25 +312,25 @@ function vr() {
|
|
|
312
312
|
}
|
|
313
313
|
var pe = {};
|
|
314
314
|
var Be;
|
|
315
|
-
function
|
|
315
|
+
function vr() {
|
|
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 === T ? null : h.displayName || h.name || null;
|
|
321
321
|
if (typeof h == "string") return h;
|
|
322
322
|
switch (h) {
|
|
323
323
|
case y:
|
|
324
324
|
return "Fragment";
|
|
325
|
-
case
|
|
325
|
+
case v:
|
|
326
326
|
return "Profiler";
|
|
327
327
|
case x:
|
|
328
328
|
return "StrictMode";
|
|
329
329
|
case j:
|
|
330
330
|
return "Suspense";
|
|
331
|
-
case
|
|
331
|
+
case N:
|
|
332
332
|
return "SuspenseList";
|
|
333
|
-
case
|
|
333
|
+
case O:
|
|
334
334
|
return "Activity";
|
|
335
335
|
}
|
|
336
336
|
if (typeof h == "object")
|
|
@@ -339,19 +339,19 @@ function wr() {
|
|
|
339
339
|
), h.$$typeof) {
|
|
340
340
|
case p:
|
|
341
341
|
return "Portal";
|
|
342
|
-
case
|
|
342
|
+
case R:
|
|
343
343
|
return h.displayName || "Context";
|
|
344
|
-
case
|
|
344
|
+
case A:
|
|
345
345
|
return (h._context.displayName || "Context") + ".Consumer";
|
|
346
346
|
case w:
|
|
347
|
-
var
|
|
348
|
-
return h = h.displayName, h || (h =
|
|
349
|
-
case
|
|
350
|
-
return
|
|
351
|
-
case
|
|
352
|
-
|
|
347
|
+
var E = h.render;
|
|
348
|
+
return h = h.displayName, h || (h = E.displayName || E.name || "", h = h !== "" ? "ForwardRef(" + h + ")" : "ForwardRef"), h;
|
|
349
|
+
case S:
|
|
350
|
+
return E = h.displayName || null, E !== null ? E : e(h.type) || "Memo";
|
|
351
|
+
case I:
|
|
352
|
+
E = h._payload, h = h._init;
|
|
353
353
|
try {
|
|
354
|
-
return e(h(
|
|
354
|
+
return e(h(E));
|
|
355
355
|
} catch {
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -363,15 +363,15 @@ function wr() {
|
|
|
363
363
|
function n(h) {
|
|
364
364
|
try {
|
|
365
365
|
r(h);
|
|
366
|
-
var
|
|
366
|
+
var E = !1;
|
|
367
367
|
} catch {
|
|
368
|
-
|
|
368
|
+
E = !0;
|
|
369
369
|
}
|
|
370
|
-
if (
|
|
371
|
-
|
|
372
|
-
var B =
|
|
370
|
+
if (E) {
|
|
371
|
+
E = console;
|
|
372
|
+
var B = E.error, U = typeof Symbol == "function" && Symbol.toStringTag && h[Symbol.toStringTag] || h.constructor.name || "Object";
|
|
373
373
|
return B.call(
|
|
374
|
-
|
|
374
|
+
E,
|
|
375
375
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
376
376
|
U
|
|
377
377
|
), r(h);
|
|
@@ -379,11 +379,11 @@ function wr() {
|
|
|
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 === I)
|
|
383
383
|
return "<...>";
|
|
384
384
|
try {
|
|
385
|
-
var
|
|
386
|
-
return
|
|
385
|
+
var E = e(h);
|
|
386
|
+
return E ? "<" + E + ">" : "<...>";
|
|
387
387
|
} catch {
|
|
388
388
|
return "<...>";
|
|
389
389
|
}
|
|
@@ -395,18 +395,18 @@ function wr() {
|
|
|
395
395
|
function a() {
|
|
396
396
|
return Error("react-stack-top-frame");
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function s(h) {
|
|
399
399
|
if (J.call(h, "key")) {
|
|
400
|
-
var
|
|
401
|
-
if (
|
|
400
|
+
var E = Object.getOwnPropertyDescriptor(h, "key").get;
|
|
401
|
+
if (E && E.isReactWarning) return !1;
|
|
402
402
|
}
|
|
403
403
|
return h.key !== void 0;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function i(h, E) {
|
|
406
406
|
function B() {
|
|
407
407
|
ue || (ue = !0, console.error(
|
|
408
408
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
409
|
-
|
|
409
|
+
E
|
|
410
410
|
));
|
|
411
411
|
}
|
|
412
412
|
B.isReactWarning = !0, Object.defineProperty(h, "key", {
|
|
@@ -420,12 +420,12 @@ function wr() {
|
|
|
420
420
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
421
421
|
)), h = this.props.ref, h !== void 0 ? h : null;
|
|
422
422
|
}
|
|
423
|
-
function m(h,
|
|
423
|
+
function m(h, E, B, U, ne, ae) {
|
|
424
424
|
var _ = B.ref;
|
|
425
425
|
return h = {
|
|
426
426
|
$$typeof: b,
|
|
427
427
|
type: h,
|
|
428
|
-
key:
|
|
428
|
+
key: E,
|
|
429
429
|
props: B,
|
|
430
430
|
_owner: U
|
|
431
431
|
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(h, "ref", {
|
|
@@ -453,25 +453,25 @@ function wr() {
|
|
|
453
453
|
value: ae
|
|
454
454
|
}), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
|
|
455
455
|
}
|
|
456
|
-
function l(h,
|
|
457
|
-
var _ =
|
|
456
|
+
function l(h, E, B, U, ne, ae) {
|
|
457
|
+
var _ = E.children;
|
|
458
458
|
if (_ !== void 0)
|
|
459
459
|
if (U)
|
|
460
460
|
if (ce(_)) {
|
|
461
461
|
for (U = 0; U < _.length; U++)
|
|
462
|
-
|
|
462
|
+
f(_[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
|
|
469
|
-
if (J.call(
|
|
468
|
+
else f(_);
|
|
469
|
+
if (J.call(E, "key")) {
|
|
470
470
|
_ = e(h);
|
|
471
|
-
var
|
|
471
|
+
var D = Object.keys(E).filter(function(K) {
|
|
472
472
|
return K !== "key";
|
|
473
473
|
});
|
|
474
|
-
U = 0 <
|
|
474
|
+
U = 0 < D.length ? "{key: someKey, " + D.join(": ..., ") + ": ...}" : "{key: someKey}", M[_ + U] || (D = 0 < D.length ? "{" + D.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,16 +480,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
480
480
|
<%s key={someKey} {...props} />`,
|
|
481
481
|
U,
|
|
482
482
|
_,
|
|
483
|
-
|
|
483
|
+
D,
|
|
484
484
|
_
|
|
485
|
-
),
|
|
485
|
+
), M[_ + U] = !0);
|
|
486
486
|
}
|
|
487
|
-
if (_ = null, B !== void 0 && (n(B), _ = "" + B),
|
|
487
|
+
if (_ = null, B !== void 0 && (n(B), _ = "" + B), s(E) && (n(E.key), _ = "" + E.key), "key" in E) {
|
|
488
488
|
B = {};
|
|
489
|
-
for (var q in
|
|
490
|
-
q !== "key" && (B[q] =
|
|
491
|
-
} else B =
|
|
492
|
-
return _ &&
|
|
489
|
+
for (var q in E)
|
|
490
|
+
q !== "key" && (B[q] = E[q]);
|
|
491
|
+
} else B = E;
|
|
492
|
+
return _ && i(
|
|
493
493
|
B,
|
|
494
494
|
typeof h == "function" ? h.displayName || h.name || "Unknown" : h
|
|
495
495
|
), m(
|
|
@@ -501,39 +501,39 @@ 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 f(h) {
|
|
505
|
+
c(h) ? h._store && (h._store.validated = 1) : typeof h == "object" && h !== null && h.$$typeof === I && (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
|
|
510
|
+
var d = F, b = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), x = Symbol.for("react.strict_mode"), v = Symbol.for("react.profiler"), A = Symbol.for("react.consumer"), R = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), N = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), T = 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 = {
|
|
514
514
|
react_stack_bottom_frame: function(h) {
|
|
515
515
|
return h();
|
|
516
516
|
}
|
|
517
517
|
};
|
|
518
|
-
var ue, Q = {}, oe =
|
|
519
|
-
|
|
518
|
+
var ue, Q = {}, oe = d.react_stack_bottom_frame.bind(
|
|
519
|
+
d,
|
|
520
520
|
a
|
|
521
|
-
)(), P = re(o(a)),
|
|
522
|
-
pe.Fragment = y, pe.jsx = function(h,
|
|
521
|
+
)(), P = re(o(a)), M = {};
|
|
522
|
+
pe.Fragment = y, pe.jsx = function(h, E, B) {
|
|
523
523
|
var U = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
524
524
|
return l(
|
|
525
525
|
h,
|
|
526
|
-
|
|
526
|
+
E,
|
|
527
527
|
B,
|
|
528
528
|
!1,
|
|
529
529
|
U ? Error("react-stack-top-frame") : oe,
|
|
530
530
|
U ? re(o(h)) : P
|
|
531
531
|
);
|
|
532
|
-
}, pe.jsxs = function(h,
|
|
532
|
+
}, pe.jsxs = function(h, E, B) {
|
|
533
533
|
var U = 1e4 > L.recentlyCreatedOwnerStacks++;
|
|
534
534
|
return l(
|
|
535
535
|
h,
|
|
536
|
-
|
|
536
|
+
E,
|
|
537
537
|
B,
|
|
538
538
|
!0,
|
|
539
539
|
U ? Error("react-stack-top-frame") : oe,
|
|
@@ -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 wr() {
|
|
547
|
+
return He || (He = 1, process.env.NODE_ENV === "production" ? be.exports = xr() : be.exports = vr()), be.exports;
|
|
548
548
|
}
|
|
549
|
-
var g =
|
|
550
|
-
const
|
|
551
|
-
const e =
|
|
549
|
+
var g = wr();
|
|
550
|
+
const Me = hr(void 0), z = () => {
|
|
551
|
+
const e = br(Me);
|
|
552
552
|
if (!e)
|
|
553
553
|
throw new Error("❌ useReactaFormContext must be used within a <ReactaFormProvider>");
|
|
554
554
|
return e;
|
|
@@ -591,8 +591,8 @@ class we {
|
|
|
591
591
|
return this.get(r) ?? n;
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
595
|
-
const o = k(void 0), t = k(e), a = k(null),
|
|
594
|
+
function Sr(e, r = 300, n) {
|
|
595
|
+
const o = k(void 0), t = k(e), a = k(null), s = k(!1);
|
|
596
596
|
C(() => {
|
|
597
597
|
t.current = e;
|
|
598
598
|
}, [e]), C(
|
|
@@ -601,30 +601,30 @@ function Cr(e, r = 300, n) {
|
|
|
601
601
|
},
|
|
602
602
|
[]
|
|
603
603
|
);
|
|
604
|
-
const
|
|
605
|
-
o.current !== void 0 && (window.clearTimeout(o.current), o.current = void 0), a.current = null,
|
|
604
|
+
const i = Z(() => {
|
|
605
|
+
o.current !== void 0 && (window.clearTimeout(o.current), o.current = void 0), a.current = null, s.current = !1;
|
|
606
606
|
}, []), u = Z(() => {
|
|
607
607
|
if (o.current !== void 0 && (window.clearTimeout(o.current), o.current = void 0), a.current)
|
|
608
608
|
try {
|
|
609
609
|
t.current(...a.current);
|
|
610
610
|
} finally {
|
|
611
|
-
a.current = null,
|
|
611
|
+
a.current = null, s.current = !1;
|
|
612
612
|
}
|
|
613
613
|
}, []);
|
|
614
614
|
return { callback: Z(
|
|
615
615
|
(...l) => {
|
|
616
|
-
if (n?.leading === !0 && !
|
|
617
|
-
|
|
618
|
-
|
|
616
|
+
if (n?.leading === !0 && !s.current) {
|
|
617
|
+
s.current = !0, t.current(...l), window.clearTimeout(o.current), o.current = window.setTimeout(() => {
|
|
618
|
+
s.current = !1, o.current = void 0;
|
|
619
619
|
}, r);
|
|
620
620
|
return;
|
|
621
621
|
}
|
|
622
622
|
a.current = l, window.clearTimeout(o.current), o.current = window.setTimeout(() => {
|
|
623
|
-
o.current = void 0, a.current && (t.current(...a.current), a.current = null,
|
|
623
|
+
o.current = void 0, a.current && (t.current(...a.current), a.current = null, s.current = !1);
|
|
624
624
|
}, r);
|
|
625
625
|
},
|
|
626
626
|
[r, n?.leading]
|
|
627
|
-
), cancel:
|
|
627
|
+
), cancel: i, flush: u };
|
|
628
628
|
}
|
|
629
629
|
const $ = {
|
|
630
630
|
field: "reactaform-field",
|
|
@@ -643,8 +643,8 @@ const $ = {
|
|
|
643
643
|
}));
|
|
644
644
|
return r.join(" ");
|
|
645
645
|
}, Ze = ({ content: e, size: r = "medium", animation: n = !0 }) => {
|
|
646
|
-
const { t: o, darkMode: t, formStyle: a, fieldStyle:
|
|
647
|
-
const
|
|
646
|
+
const { t: o, darkMode: t, formStyle: a, fieldStyle: s } = z(), [i, u] = V(!1), [m, l] = V({ x: 0, y: 0 }), [f, c] = V(!1), d = k(null), b = k(null), p = k(null), y = G(() => {
|
|
647
|
+
const R = {
|
|
648
648
|
icon: {
|
|
649
649
|
display: "inline-flex",
|
|
650
650
|
alignItems: "center",
|
|
@@ -686,53 +686,53 @@ const $ = {
|
|
|
686
686
|
opacity: 1,
|
|
687
687
|
visibility: "visible"
|
|
688
688
|
}
|
|
689
|
-
}, w = (
|
|
690
|
-
const
|
|
691
|
-
return (
|
|
689
|
+
}, w = (N, S, I) => {
|
|
690
|
+
const T = N?.[S];
|
|
691
|
+
return (I && T ? T[I] : void 0) ?? {};
|
|
692
692
|
};
|
|
693
693
|
return {
|
|
694
|
-
icon: { ...
|
|
695
|
-
text: { ...
|
|
696
|
-
textVisible:
|
|
694
|
+
icon: { ...R.icon, ...w(a, "tooltip", "icon"), ...w(s, "tooltip", "icon") },
|
|
695
|
+
text: { ...R.text, ...w(a, "tooltip", "text"), ...w(s, "tooltip", "text") },
|
|
696
|
+
textVisible: R.textVisible
|
|
697
697
|
};
|
|
698
|
-
}, [t, r, n, a,
|
|
698
|
+
}, [t, r, n, a, s]);
|
|
699
699
|
C(() => {
|
|
700
|
-
if (
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
703
|
-
const w =
|
|
700
|
+
if (i) {
|
|
701
|
+
const A = requestAnimationFrame(() => c(!1)), R = requestAnimationFrame(() => {
|
|
702
|
+
if (d.current) {
|
|
703
|
+
const w = d.current.getBoundingClientRect(), j = 8;
|
|
704
704
|
p.current = w;
|
|
705
|
-
const
|
|
706
|
-
l({ x:
|
|
705
|
+
const N = w.right + j, S = w.top;
|
|
706
|
+
l({ x: N, y: S }), c(!0);
|
|
707
707
|
}
|
|
708
708
|
});
|
|
709
709
|
return () => {
|
|
710
|
-
cancelAnimationFrame(
|
|
710
|
+
cancelAnimationFrame(R), cancelAnimationFrame(A);
|
|
711
711
|
};
|
|
712
712
|
} else
|
|
713
713
|
requestAnimationFrame(() => c(!1));
|
|
714
|
-
}, [
|
|
715
|
-
if (!
|
|
716
|
-
const
|
|
714
|
+
}, [i]), C(() => {
|
|
715
|
+
if (!f) return;
|
|
716
|
+
const A = requestAnimationFrame(() => {
|
|
717
717
|
if (!b.current) return;
|
|
718
|
-
const
|
|
719
|
-
let
|
|
720
|
-
const
|
|
721
|
-
|
|
718
|
+
const R = b.current.getBoundingClientRect(), w = 8, j = typeof window < "u" ? window.innerWidth : 1024, N = typeof window < "u" ? window.innerHeight : 768;
|
|
719
|
+
let S = m.x, I = m.y;
|
|
720
|
+
const O = p.current;
|
|
721
|
+
O && (S = O.right + w, I = O.top + O.height / 2 - R.height / 2 + -4, S + R.width > j - w && (S = O.left - w - R.width)), S + R.width > j - w && (S = Math.max(w, j - R.width - w)), S < w && (S = w), I + R.height > N - w && (I = Math.max(w, N - R.height - w)), I < w && (I = w), (S !== m.x || I !== m.y) && l({ x: S, y: I });
|
|
722
722
|
});
|
|
723
|
-
return () => cancelAnimationFrame(
|
|
724
|
-
}, [
|
|
725
|
-
const x = typeof document < "u" ? document.getElementById("popup-root") : null,
|
|
723
|
+
return () => cancelAnimationFrame(A);
|
|
724
|
+
}, [f, m.x, m.y]);
|
|
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: f ? "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
|
+
...f ? y.textVisible : {},
|
|
736
736
|
top: m.y,
|
|
737
737
|
left: m.x
|
|
738
738
|
},
|
|
@@ -745,7 +745,7 @@ const $ = {
|
|
|
745
745
|
"span",
|
|
746
746
|
{
|
|
747
747
|
"data-testid": "tooltip-icon",
|
|
748
|
-
ref:
|
|
748
|
+
ref: d,
|
|
749
749
|
onMouseEnter: () => u(!0),
|
|
750
750
|
onMouseLeave: () => u(!1),
|
|
751
751
|
style: {
|
|
@@ -754,7 +754,7 @@ const $ = {
|
|
|
754
754
|
children: "?"
|
|
755
755
|
}
|
|
756
756
|
),
|
|
757
|
-
|
|
757
|
+
i && (x ? Oe.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 } = z(), a = e?.labelLayout === "column-center" ? "center" : "left";
|
|
766
766
|
return /* @__PURE__ */ g.jsxs(
|
|
767
767
|
"div",
|
|
768
768
|
{
|
|
@@ -815,11 +815,11 @@ const Qe = ve(({
|
|
|
815
815
|
children: n,
|
|
816
816
|
rightAlign: o = !1
|
|
817
817
|
}) => {
|
|
818
|
-
const { t } =
|
|
818
|
+
const { t } = z(), a = G(() => ({
|
|
819
819
|
display: "flex",
|
|
820
820
|
flexDirection: "column",
|
|
821
821
|
gap: 0
|
|
822
|
-
}), []),
|
|
822
|
+
}), []), s = G(() => ({
|
|
823
823
|
display: "flex",
|
|
824
824
|
flexDirection: "row",
|
|
825
825
|
alignItems: "center",
|
|
@@ -836,7 +836,7 @@ const Qe = ve(({
|
|
|
836
836
|
}
|
|
837
837
|
),
|
|
838
838
|
/* @__PURE__ */ g.jsxs("div", { style: a, children: [
|
|
839
|
-
/* @__PURE__ */ g.jsxs("div", { style:
|
|
839
|
+
/* @__PURE__ */ g.jsxs("div", { style: s, children: [
|
|
840
840
|
o ? /* @__PURE__ */ g.jsx(
|
|
841
841
|
"div",
|
|
842
842
|
{
|
|
@@ -877,7 +877,7 @@ const W = ({
|
|
|
877
877
|
});
|
|
878
878
|
$e.displayName = "ErrorDiv";
|
|
879
879
|
const er = ve(({ name: e, onChange: r }) => {
|
|
880
|
-
const { t: n } =
|
|
880
|
+
const { t: n } = z();
|
|
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(
|
|
@@ -918,7 +918,7 @@ const er = ve(({ name: e, onChange: r }) => {
|
|
|
918
918
|
] });
|
|
919
919
|
});
|
|
920
920
|
er.displayName = "InstanceName";
|
|
921
|
-
class
|
|
921
|
+
class Cr extends we {
|
|
922
922
|
registerInCategory(r, n, o) {
|
|
923
923
|
this.get(r) || this.register(r, {});
|
|
924
924
|
const t = this.get(r);
|
|
@@ -934,17 +934,17 @@ class jr extends we {
|
|
|
934
934
|
return this.list();
|
|
935
935
|
}
|
|
936
936
|
}
|
|
937
|
-
const rr = new we(), tr = new
|
|
937
|
+
const rr = new we(), tr = new Cr();
|
|
938
938
|
function Xt(e, r) {
|
|
939
939
|
rr.register(e, r);
|
|
940
940
|
}
|
|
941
941
|
function Zt(e, r, n) {
|
|
942
942
|
tr.registerInCategory(e, r, n);
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function jr(e, r) {
|
|
945
945
|
return tr.getFromCategory(e, r) || null;
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function kr(e) {
|
|
948
948
|
return rr.get(e) || null;
|
|
949
949
|
}
|
|
950
950
|
const Ce = /* @__PURE__ */ new Map(), je = /* @__PURE__ */ new Map();
|
|
@@ -952,8 +952,8 @@ 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
|
|
956
|
-
Ce.set(t,
|
|
955
|
+
const s = jr(e, r.validationHandlerName);
|
|
956
|
+
Ce.set(t, s);
|
|
957
957
|
}
|
|
958
958
|
const a = Ce.get(t);
|
|
959
959
|
if (a)
|
|
@@ -961,11 +961,11 @@ function Y(e, r, n, o) {
|
|
|
961
961
|
}
|
|
962
962
|
return null;
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function Rr(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 = kr(o);
|
|
969
969
|
je.set(o, a);
|
|
970
970
|
}
|
|
971
971
|
const t = je.get(o);
|
|
@@ -977,7 +977,7 @@ function Er(e, r, n) {
|
|
|
977
977
|
function ie(e) {
|
|
978
978
|
return typeof e == "object" && e !== null;
|
|
979
979
|
}
|
|
980
|
-
function
|
|
980
|
+
function De(e) {
|
|
981
981
|
if (!ie(e)) return !1;
|
|
982
982
|
const r = e;
|
|
983
983
|
return typeof r.name == "string" && typeof r.displayName == "string";
|
|
@@ -985,7 +985,7 @@ function Ve(e) {
|
|
|
985
985
|
function nr(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) => De(n));
|
|
989
989
|
}
|
|
990
990
|
function Ee(e) {
|
|
991
991
|
try {
|
|
@@ -1001,8 +1001,8 @@ function Qt(e, r, n = {}) {
|
|
|
1001
1001
|
includeMetadata: o = !1,
|
|
1002
1002
|
dateFormat: t = "iso",
|
|
1003
1003
|
fileHandling: a = "metadata",
|
|
1004
|
-
prettify:
|
|
1005
|
-
excludeFields:
|
|
1004
|
+
prettify: s = !1,
|
|
1005
|
+
excludeFields: i = [],
|
|
1006
1006
|
includeOnlyFields: u = []
|
|
1007
1007
|
} = n;
|
|
1008
1008
|
if (!e || typeof e != "object")
|
|
@@ -1010,9 +1010,9 @@ 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 = [], f = {}, d = (nr(r) || ie(r) && Array.isArray(r.properties) ? r.properties : []).filter(De), b = new Map(d.map((y) => [y.name, y]));
|
|
1014
1014
|
for (const [y, x] of Object.entries(e)) {
|
|
1015
|
-
if (
|
|
1015
|
+
if (i.includes(y)) {
|
|
1016
1016
|
l.push(y);
|
|
1017
1017
|
continue;
|
|
1018
1018
|
}
|
|
@@ -1021,23 +1021,23 @@ function Qt(e, r, n = {}) {
|
|
|
1021
1021
|
continue;
|
|
1022
1022
|
}
|
|
1023
1023
|
if (x === void 0) continue;
|
|
1024
|
-
const
|
|
1024
|
+
const v = b.get(y);
|
|
1025
1025
|
try {
|
|
1026
|
-
|
|
1027
|
-
} catch (
|
|
1028
|
-
m.push(`Error serializing field '${y}': ${String(
|
|
1026
|
+
f[y] = Er(x, v, { dateFormat: t, fileHandling: a });
|
|
1027
|
+
} catch (A) {
|
|
1028
|
+
m.push(`Error serializing field '${y}': ${String(A)}`), f[y] = null;
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
1031
|
-
return o && (
|
|
1031
|
+
return o && (f._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(f).length - 1
|
|
1035
1035
|
// Exclude metadata itself
|
|
1036
1036
|
}), {
|
|
1037
1037
|
success: !0,
|
|
1038
|
-
data:
|
|
1038
|
+
data: s ? JSON.stringify(f, null, 2) : JSON.stringify(f),
|
|
1039
1039
|
metadata: {
|
|
1040
|
-
fieldCount: Object.keys(
|
|
1040
|
+
fieldCount: Object.keys(f).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 Er(e, r, n = {}) {
|
|
1053
1053
|
const { dateFormat: o = "iso", fileHandling: t = "metadata" } = n;
|
|
1054
1054
|
if (e == null)
|
|
1055
1055
|
return null;
|
|
@@ -1125,44 +1125,44 @@ function en(e, r, n = {}) {
|
|
|
1125
1125
|
strict: o = !1,
|
|
1126
1126
|
validateTypes: t = !0,
|
|
1127
1127
|
preserveUnknownFields: a = !0,
|
|
1128
|
-
dateFormat:
|
|
1128
|
+
dateFormat: s = "auto"
|
|
1129
1129
|
} = n;
|
|
1130
1130
|
if (!e || typeof e != "string")
|
|
1131
1131
|
return {
|
|
1132
1132
|
success: !1,
|
|
1133
1133
|
error: "Serialized data must be a non-empty string"
|
|
1134
1134
|
};
|
|
1135
|
-
let
|
|
1135
|
+
let i;
|
|
1136
1136
|
try {
|
|
1137
|
-
|
|
1137
|
+
i = JSON.parse(e);
|
|
1138
1138
|
} catch (p) {
|
|
1139
1139
|
return {
|
|
1140
1140
|
success: !1,
|
|
1141
1141
|
error: `Invalid JSON: ${p instanceof Error ? p.message : "Unknown parsing error"}`
|
|
1142
1142
|
};
|
|
1143
1143
|
}
|
|
1144
|
-
if (!
|
|
1144
|
+
if (!i || typeof i != "object")
|
|
1145
1145
|
return {
|
|
1146
1146
|
success: !1,
|
|
1147
1147
|
error: "Parsed data must be an object"
|
|
1148
1148
|
};
|
|
1149
|
-
const u = [], m = [], l = {}, c = (nr(r) || ie(r) && Array.isArray(r.properties) ? r.properties : []).filter(
|
|
1149
|
+
const u = [], m = [], l = {}, c = (nr(r) || ie(r) && Array.isArray(r.properties) ? r.properties : []).filter(De), d = new Map(c.map((p) => [p.name, p]));
|
|
1150
1150
|
for (const p of c) {
|
|
1151
|
-
const y = p.name, x =
|
|
1151
|
+
const y = p.name, x = i[y];
|
|
1152
1152
|
if (x === void 0) {
|
|
1153
1153
|
o && p.required && m.push(`Required field '${y}' is missing`);
|
|
1154
1154
|
continue;
|
|
1155
1155
|
}
|
|
1156
1156
|
try {
|
|
1157
|
-
l[y] =
|
|
1158
|
-
} catch (
|
|
1159
|
-
const
|
|
1160
|
-
o ? m.push(
|
|
1157
|
+
l[y] = Nr(x, p, { validateTypes: t, dateFormat: s });
|
|
1158
|
+
} catch (v) {
|
|
1159
|
+
const A = `Error deserializing field '${y}': ${String(v)}`;
|
|
1160
|
+
o ? m.push(A) : (u.push(A), l[y] = x);
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
1163
|
if (a)
|
|
1164
|
-
for (const [p, y] of Object.entries(
|
|
1165
|
-
!
|
|
1164
|
+
for (const [p, y] of Object.entries(i))
|
|
1165
|
+
!d.has(p) && p !== "_metadata" && (o && u.push(`Unknown field '${p}' preserved`), l[p] = 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 Nr(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 Ir(e, r, n = {}) {
|
|
|
1186
1186
|
case "date":
|
|
1187
1187
|
case "datetime":
|
|
1188
1188
|
case "date-time":
|
|
1189
|
-
return
|
|
1189
|
+
return Ir(e, t, o);
|
|
1190
1190
|
case "int":
|
|
1191
1191
|
case "integer":
|
|
1192
1192
|
return Ne(e, o);
|
|
@@ -1194,7 +1194,7 @@ function Ir(e, r, n = {}) {
|
|
|
1194
1194
|
case "number":
|
|
1195
1195
|
return Ie(e, o);
|
|
1196
1196
|
case "boolean":
|
|
1197
|
-
return
|
|
1197
|
+
return Ar(e, o);
|
|
1198
1198
|
case "int-array":
|
|
1199
1199
|
return Je(e, "integer", o);
|
|
1200
1200
|
case "float-array":
|
|
@@ -1263,11 +1263,11 @@ function tn(e, r = {}) {
|
|
|
1263
1263
|
success: !1,
|
|
1264
1264
|
error: "Input must be a string or object"
|
|
1265
1265
|
};
|
|
1266
|
-
const a = [],
|
|
1267
|
-
for (const l of
|
|
1266
|
+
const a = [], s = [], i = ["name", "version", "displayName"];
|
|
1267
|
+
for (const l of i)
|
|
1268
1268
|
if (!t[l])
|
|
1269
1269
|
if (n)
|
|
1270
|
-
|
|
1270
|
+
s.push(`Required field '${l}' is missing`);
|
|
1271
1271
|
else
|
|
1272
1272
|
switch (a.push(`Missing field '${l}', using default`), l) {
|
|
1273
1273
|
case "name":
|
|
@@ -1281,20 +1281,20 @@ 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,
|
|
1285
|
-
const c = ie(l) ? l : {},
|
|
1284
|
+
u ? t.properties = u.map((l, f) => {
|
|
1285
|
+
const c = ie(l) ? l : {}, d = { ...c };
|
|
1286
1286
|
if (!c.name) {
|
|
1287
|
-
const b = `Property at index ${
|
|
1288
|
-
n ?
|
|
1287
|
+
const b = `Property at index ${f} missing 'name'`;
|
|
1288
|
+
n ? s.push(b) : (a.push(`${b}, using 'field_${f}'`), d.name = `field_${f}`);
|
|
1289
1289
|
}
|
|
1290
|
-
return c.displayName || (
|
|
1291
|
-
}) : n ?
|
|
1292
|
-
const m =
|
|
1290
|
+
return c.displayName || (d.displayName = c.name || `Field ${f}`), c.type || (n && o ? s.push(`Property '${c.name || f}' missing 'type'`) : (a.push(`Property '${c.name || f}' missing 'type', using 'string'`), d.type = "string")), c.defaultValue === void 0 && (d.defaultValue = null), c.required === void 0 && (d.required = !1), d;
|
|
1291
|
+
}) : n ? s.push("Properties must be an array") : (a.push("Properties not found or invalid, using empty array"), t.properties = []);
|
|
1292
|
+
const m = s.length > 0;
|
|
1293
1293
|
return {
|
|
1294
1294
|
success: !m,
|
|
1295
1295
|
data: t,
|
|
1296
1296
|
warnings: a.length > 0 ? a : void 0,
|
|
1297
|
-
validationErrors: m ?
|
|
1297
|
+
validationErrors: m ? s : void 0
|
|
1298
1298
|
};
|
|
1299
1299
|
} catch (n) {
|
|
1300
1300
|
return {
|
|
@@ -1303,7 +1303,7 @@ function tn(e, r = {}) {
|
|
|
1303
1303
|
};
|
|
1304
1304
|
}
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function Ir(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 Ar(e, r) {
|
|
1352
1352
|
if (typeof e == "boolean")
|
|
1353
1353
|
return e;
|
|
1354
1354
|
if (typeof e == "string") {
|
|
@@ -1382,60 +1382,60 @@ function Je(e, r, n) {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
});
|
|
1384
1384
|
}
|
|
1385
|
-
const
|
|
1385
|
+
const Fr = (e, r) => {
|
|
1386
1386
|
const n = /* @__PURE__ */ new Map();
|
|
1387
1387
|
let o = null, t = null, a = 0;
|
|
1388
|
-
for (const
|
|
1389
|
-
const
|
|
1390
|
-
if (!
|
|
1388
|
+
for (const s of e) {
|
|
1389
|
+
const i = s.group;
|
|
1390
|
+
if (!i) {
|
|
1391
1391
|
o = null, t = null;
|
|
1392
1392
|
continue;
|
|
1393
1393
|
}
|
|
1394
|
-
if (
|
|
1395
|
-
r[
|
|
1394
|
+
if (i === o)
|
|
1395
|
+
r[s.name].group = t ?? i;
|
|
1396
1396
|
else {
|
|
1397
|
-
if (!n.has(
|
|
1398
|
-
n.set(
|
|
1397
|
+
if (!n.has(i))
|
|
1398
|
+
n.set(i, 1), t = null, r[s.name].group = i;
|
|
1399
1399
|
else {
|
|
1400
|
-
const u = n.get(
|
|
1401
|
-
n.set(
|
|
1400
|
+
const u = n.get(i), m = `${i}(${u})`;
|
|
1401
|
+
n.set(i, u + 1), t = m, r[s.name].group = m, a++;
|
|
1402
1402
|
}
|
|
1403
|
-
o =
|
|
1403
|
+
o = i;
|
|
1404
1404
|
}
|
|
1405
1405
|
}
|
|
1406
1406
|
return a;
|
|
1407
1407
|
}, Or = (e, r = {}) => {
|
|
1408
1408
|
const { includeEmpty: n = !0 } = r, o = [];
|
|
1409
|
-
let t = null, a = [],
|
|
1409
|
+
let t = null, a = [], s = 0;
|
|
1410
1410
|
for (const u of e) {
|
|
1411
1411
|
const m = u.group || null;
|
|
1412
|
-
m !== t ? ((a.length > 0 || n) && (a.length === 0 &&
|
|
1412
|
+
m !== t ? ((a.length > 0 || n) && (a.length === 0 && s++, o.push({ name: t, fields: a })), t = m, a = [u]) : a.push(u);
|
|
1413
1413
|
}
|
|
1414
|
-
(a.length > 0 || n) && (a.length === 0 &&
|
|
1415
|
-
const
|
|
1414
|
+
(a.length > 0 || n) && (a.length === 0 && s++, o.push({ name: t, fields: a }));
|
|
1415
|
+
const i = Math.max(0, ...o.map((u) => u.fields.length));
|
|
1416
1416
|
return {
|
|
1417
1417
|
groups: o,
|
|
1418
1418
|
metadata: {
|
|
1419
1419
|
totalGroups: o.length,
|
|
1420
|
-
emptyGroups:
|
|
1421
|
-
largestGroup:
|
|
1420
|
+
emptyGroups: s,
|
|
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(), Mr = 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-C-TIZ3UJ.js")).default;
|
|
1430
1430
|
break;
|
|
1431
1431
|
case "de":
|
|
1432
|
-
r = (await import("./common-
|
|
1432
|
+
r = (await import("./common-CkBVkhXb.js")).default;
|
|
1433
1433
|
break;
|
|
1434
1434
|
case "es":
|
|
1435
|
-
r = (await import("./common-
|
|
1435
|
+
r = (await import("./common-CDu1xkTC.js")).default;
|
|
1436
1436
|
break;
|
|
1437
1437
|
case "zh-cn":
|
|
1438
|
-
r = (await import("./common-
|
|
1438
|
+
r = (await import("./common-D4RlfeS8.js")).default;
|
|
1439
1439
|
break;
|
|
1440
1440
|
case "en":
|
|
1441
1441
|
r = {};
|
|
@@ -1455,7 +1455,7 @@ const Mr = (e, r) => {
|
|
|
1455
1455
|
error: `Failed to load common translations for ${e}: ${r}`
|
|
1456
1456
|
};
|
|
1457
1457
|
}
|
|
1458
|
-
},
|
|
1458
|
+
}, $r = 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 Mr = (e, r) => {
|
|
|
1467
1467
|
translations: ke.get(r) || {},
|
|
1468
1468
|
fromCache: !0
|
|
1469
1469
|
};
|
|
1470
|
-
const n = await
|
|
1470
|
+
const n = await Mr(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
|
+
}, Dr = async (e, r) => {
|
|
1477
1477
|
if (!e || !r)
|
|
1478
1478
|
return {
|
|
1479
1479
|
success: !1,
|
|
@@ -1518,19 +1518,19 @@ const Mr = (e, r) => {
|
|
|
1518
1518
|
!a.includes("application/json") && !a.includes("text/json") && or() && console.warn(
|
|
1519
1519
|
`Translation file at ${o} has unexpected content-type: ${a}`
|
|
1520
1520
|
);
|
|
1521
|
-
const
|
|
1522
|
-
if (!
|
|
1521
|
+
const s = await t.text();
|
|
1522
|
+
if (!s) {
|
|
1523
1523
|
const m = "Empty translation file";
|
|
1524
1524
|
return se.add(n), { success: !1, translations: {}, error: m };
|
|
1525
1525
|
}
|
|
1526
|
-
let
|
|
1526
|
+
let i;
|
|
1527
1527
|
try {
|
|
1528
|
-
|
|
1528
|
+
i = JSON.parse(s);
|
|
1529
1529
|
} catch (m) {
|
|
1530
1530
|
const l = `Invalid JSON in translation file: ${m instanceof Error ? m.message : String(m)}`;
|
|
1531
1531
|
return se.add(n), { success: !1, translations: {}, error: l };
|
|
1532
1532
|
}
|
|
1533
|
-
if (!
|
|
1533
|
+
if (!i || typeof i != "object") {
|
|
1534
1534
|
const m = "Invalid translation file format";
|
|
1535
1535
|
return se.add(n), {
|
|
1536
1536
|
success: !1,
|
|
@@ -1539,7 +1539,7 @@ const Mr = (e, r) => {
|
|
|
1539
1539
|
};
|
|
1540
1540
|
}
|
|
1541
1541
|
const u = Object.fromEntries(
|
|
1542
|
-
Object.entries(
|
|
1542
|
+
Object.entries(i).map(([m, l]) => [
|
|
1543
1543
|
m,
|
|
1544
1544
|
typeof l == "string" ? l : String(l)
|
|
1545
1545
|
])
|
|
@@ -1578,7 +1578,7 @@ function or() {
|
|
|
1578
1578
|
}
|
|
1579
1579
|
return !1;
|
|
1580
1580
|
}
|
|
1581
|
-
function
|
|
1581
|
+
function Vr(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 zr(e, r) {
|
|
|
1590
1590
|
}
|
|
1591
1591
|
});
|
|
1592
1592
|
}
|
|
1593
|
-
const
|
|
1594
|
-
let a = o,
|
|
1595
|
-
return !o || typeof o != "string" ? String(o || "") : (e.toLowerCase() === "en" ? (a = o,
|
|
1593
|
+
const Tr = (e, r, n) => (o, ...t) => {
|
|
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 = Vr(a, t), !s && or() && console.debug(
|
|
1596
1596
|
`Missing translation for "${o}" in language "${e}"`
|
|
1597
1597
|
), a);
|
|
1598
|
-
},
|
|
1598
|
+
}, Ve = {
|
|
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 Dr = (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
|
+
}, Te = {
|
|
1607
1607
|
length: {
|
|
1608
1608
|
m: "Meter (m)",
|
|
1609
1609
|
mm: "Millimeter (mm)",
|
|
@@ -1657,7 +1657,7 @@ const Dr = (e, r, n) => (o, ...t) => {
|
|
|
1657
1657
|
rad: "Radian (rad)",
|
|
1658
1658
|
rev: "Revolution (rev)"
|
|
1659
1659
|
}
|
|
1660
|
-
},
|
|
1660
|
+
}, ze = {
|
|
1661
1661
|
length: {
|
|
1662
1662
|
mm: 1e3,
|
|
1663
1663
|
cm: 100,
|
|
@@ -1712,52 +1712,52 @@ const Dr = (e, r, n) => (o, ...t) => {
|
|
|
1712
1712
|
rad: Math.PI / 180,
|
|
1713
1713
|
rev: 1 / 360
|
|
1714
1714
|
}
|
|
1715
|
-
}, Le = {},
|
|
1715
|
+
}, Le = {}, zr = /* @__PURE__ */ new Set([
|
|
1716
|
+
...Object.keys(Ve),
|
|
1716
1717
|
...Object.keys(Te),
|
|
1717
|
-
...Object.keys(ze)
|
|
1718
|
-
...Object.keys(De)
|
|
1718
|
+
...Object.keys(ze)
|
|
1719
1719
|
]);
|
|
1720
|
-
for (const e of
|
|
1721
|
-
const r = {}, n =
|
|
1720
|
+
for (const e of zr) {
|
|
1721
|
+
const r = {}, n = Ve[e] ?? [], o = Te[e] ?? {}, t = ze[e] ?? {};
|
|
1722
1722
|
for (const a of n) {
|
|
1723
|
-
const
|
|
1723
|
+
const s = o[a];
|
|
1724
1724
|
r[a] = {
|
|
1725
|
-
name: typeof
|
|
1725
|
+
name: typeof s == "string" ? s : String(a),
|
|
1726
1726
|
shortName: a,
|
|
1727
1727
|
factor: Object.prototype.hasOwnProperty.call(t, a) ? t[a] : void 0
|
|
1728
1728
|
};
|
|
1729
1729
|
}
|
|
1730
|
-
for (const [a,
|
|
1730
|
+
for (const [a, s] of Object.entries(o))
|
|
1731
1731
|
if (!r[a]) {
|
|
1732
|
-
const
|
|
1733
|
-
r[a] = { name:
|
|
1732
|
+
const i = typeof s == "string" ? s : String(a);
|
|
1733
|
+
r[a] = { name: i, shortName: a, factor: Object.prototype.hasOwnProperty.call(t, a) ? t[a] : void 0 };
|
|
1734
1734
|
}
|
|
1735
|
-
for (const [a,
|
|
1736
|
-
r[a] || (r[a] = { name: String(a), shortName: String(a), factor:
|
|
1735
|
+
for (const [a, s] of Object.entries(t))
|
|
1736
|
+
r[a] || (r[a] = { name: String(a), shortName: String(a), factor: s });
|
|
1737
1737
|
Le[e] = r;
|
|
1738
1738
|
}
|
|
1739
1739
|
const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1740
1740
|
__proto__: null,
|
|
1741
|
-
dimensionUnitDisplayMap:
|
|
1742
|
-
dimensionUnitsMap:
|
|
1743
|
-
dimensonUnitFactorsMap:
|
|
1741
|
+
dimensionUnitDisplayMap: Te,
|
|
1742
|
+
dimensionUnitsMap: Ve,
|
|
1743
|
+
dimensonUnitFactorsMap: ze,
|
|
1744
1744
|
unitsByDimension: Le
|
|
1745
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1745
|
+
}, Symbol.toStringTag, { value: "Module" })), Lr = ({
|
|
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 } = z(), s = k(o);
|
|
1752
1752
|
C(() => {
|
|
1753
|
-
|
|
1753
|
+
s.current = o;
|
|
1754
1754
|
}, [o]), C(() => {
|
|
1755
1755
|
const l = Y(t, e, r ?? !1, a);
|
|
1756
|
-
|
|
1756
|
+
s.current?.(l ?? null);
|
|
1757
1757
|
}, [r, e, t, a]);
|
|
1758
|
-
const
|
|
1759
|
-
const
|
|
1760
|
-
n?.(
|
|
1758
|
+
const i = (l) => {
|
|
1759
|
+
const f = l.target.checked;
|
|
1760
|
+
n?.(f, 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;
|
|
@@ -1778,7 +1778,7 @@ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1778
1778
|
"data-testid": "boolean-checkbox",
|
|
1779
1779
|
type: "checkbox",
|
|
1780
1780
|
checked: !!r,
|
|
1781
|
-
onChange:
|
|
1781
|
+
onChange: i,
|
|
1782
1782
|
onKeyDown: u,
|
|
1783
1783
|
"aria-checked": !!r,
|
|
1784
1784
|
style: {
|
|
@@ -1813,7 +1813,7 @@ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1813
1813
|
function ar(e) {
|
|
1814
1814
|
return /^#([0-9A-F]{3}){1,2}$/i.test(e);
|
|
1815
1815
|
}
|
|
1816
|
-
function
|
|
1816
|
+
function Pr(e) {
|
|
1817
1817
|
if (!ar(e)) return null;
|
|
1818
1818
|
const r = sr(e), n = parseInt(r.slice(1), 16);
|
|
1819
1819
|
return {
|
|
@@ -1825,39 +1825,39 @@ function _r(e) {
|
|
|
1825
1825
|
function sr(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 _r = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
1829
|
+
const { t, definitionName: a } = z(), [s, i] = V("#000000"), u = F.useRef(null), m = F.useRef(null), l = F.useRef(o);
|
|
1830
|
+
F.useEffect(() => {
|
|
1831
1831
|
l.current = o;
|
|
1832
1832
|
}, [o]), C(() => {
|
|
1833
|
-
const x = r && ar(r) ? r : "#000000",
|
|
1834
|
-
|
|
1835
|
-
}, [r]),
|
|
1833
|
+
const x = r && ar(r) ? r : "#000000", v = sr(x);
|
|
1834
|
+
i(v);
|
|
1835
|
+
}, [r]), F.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
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1839
|
+
const f = (x) => {
|
|
1840
|
+
const v = x.target.value;
|
|
1841
|
+
i(v), n?.(v, null);
|
|
1842
1842
|
}, c = (x) => {
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1845
|
-
},
|
|
1846
|
-
(x) => x.value ===
|
|
1847
|
-
), { r: b, g: p, b: y } =
|
|
1843
|
+
const v = x.target.value;
|
|
1844
|
+
i(v), n?.(v, null);
|
|
1845
|
+
}, d = Ge.find(
|
|
1846
|
+
(x) => x.value === s
|
|
1847
|
+
), { r: b, g: p, b: y } = Pr(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",
|
|
1851
1851
|
{
|
|
1852
1852
|
ref: u,
|
|
1853
1853
|
id: e.name,
|
|
1854
|
-
value:
|
|
1855
|
-
onChange:
|
|
1854
|
+
value: s,
|
|
1855
|
+
onChange: f,
|
|
1856
1856
|
style: { minWidth: "120px", flex: 1 },
|
|
1857
1857
|
className: X($.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
|
", ",
|
|
@@ -1865,7 +1865,7 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1865
1865
|
", ",
|
|
1866
1866
|
y,
|
|
1867
1867
|
")"
|
|
1868
|
-
] },
|
|
1868
|
+
] }, s)
|
|
1869
1869
|
]
|
|
1870
1870
|
}
|
|
1871
1871
|
),
|
|
@@ -1878,7 +1878,7 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1878
1878
|
display: "inline-block",
|
|
1879
1879
|
border: "1px solid #ccc",
|
|
1880
1880
|
borderRadius: "4px",
|
|
1881
|
-
backgroundColor:
|
|
1881
|
+
backgroundColor: s,
|
|
1882
1882
|
cursor: "pointer",
|
|
1883
1883
|
overflow: "hidden",
|
|
1884
1884
|
flexShrink: 0
|
|
@@ -1888,7 +1888,7 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1888
1888
|
{
|
|
1889
1889
|
ref: m,
|
|
1890
1890
|
type: "color",
|
|
1891
|
-
value:
|
|
1891
|
+
value: s,
|
|
1892
1892
|
onChange: c,
|
|
1893
1893
|
style: {
|
|
1894
1894
|
opacity: 0,
|
|
@@ -1907,7 +1907,7 @@ const qr = ({ 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
|
+
}, qr = (e) => {
|
|
1911
1911
|
if (!e) return "";
|
|
1912
1912
|
if (/^\d{4}-\d{2}-\d{2}$/.test(e))
|
|
1913
1913
|
return ge(e) ? e : "";
|
|
@@ -1917,19 +1917,19 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1917
1917
|
return `${o}-${t}-${a}`;
|
|
1918
1918
|
}
|
|
1919
1919
|
return "";
|
|
1920
|
-
},
|
|
1920
|
+
}, Br = ({
|
|
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 } = z(), { 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 = F.useCallback((c) => {
|
|
1931
1931
|
if (!c || c.trim() === "")
|
|
1932
|
-
return
|
|
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");
|
|
@@ -1945,9 +1945,9 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1945
1945
|
}
|
|
1946
1946
|
}
|
|
1947
1947
|
return Y(a, e, c, t) ?? null;
|
|
1948
|
-
}, [e, a, t,
|
|
1949
|
-
const
|
|
1950
|
-
n?.(
|
|
1948
|
+
}, [e, a, t, i]), f = (c) => {
|
|
1949
|
+
const d = c.target.value, b = l(d);
|
|
1950
|
+
n?.(d, b);
|
|
1951
1951
|
};
|
|
1952
1952
|
return C(() => {
|
|
1953
1953
|
const c = l(r);
|
|
@@ -1955,48 +1955,48 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
1955
1955
|
}, [r, l]), /* @__PURE__ */ g.jsx(W, { field: e, error: l(r), children: /* @__PURE__ */ g.jsx(
|
|
1956
1956
|
"input",
|
|
1957
1957
|
{
|
|
1958
|
-
id:
|
|
1958
|
+
id: s,
|
|
1959
1959
|
type: "date",
|
|
1960
|
-
value:
|
|
1961
|
-
onChange:
|
|
1960
|
+
value: qr(r),
|
|
1961
|
+
onChange: f,
|
|
1962
1962
|
className: X($.input, $.textInput),
|
|
1963
1963
|
...e.minDate ? { min: e.minDate } : {},
|
|
1964
1964
|
...e.maxDate ? { max: e.maxDate } : {},
|
|
1965
1965
|
"aria-invalid": !!l(r),
|
|
1966
|
-
"aria-describedby": l(r) ? `${
|
|
1966
|
+
"aria-describedby": l(r) ? `${s}-error` : void 0
|
|
1967
1967
|
}
|
|
1968
1968
|
) });
|
|
1969
|
-
},
|
|
1969
|
+
}, Hr = ({
|
|
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 } = z(), s = k(null), i = k(o);
|
|
1976
1976
|
C(() => {
|
|
1977
|
-
|
|
1977
|
+
i.current = o;
|
|
1978
1978
|
}, [o]);
|
|
1979
1979
|
const u = Z(
|
|
1980
1980
|
(l) => l === "" || l === null || l === void 0 ? t("Value required") : !e.options || e.options.length === 0 ? null : e.options.some((c) => c.value === l) ? Y(a, e, l, t) ?? null : t("Invalid option selected"),
|
|
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) : "", f = u(l);
|
|
1985
|
+
if (f && 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
|
-
|
|
1989
|
+
s.current && (s.current.value = l), i.current?.(f ?? null);
|
|
1990
1990
|
}, [r, u, n, e.options]);
|
|
1991
1991
|
const m = (l) => {
|
|
1992
|
-
const
|
|
1993
|
-
n?.(
|
|
1992
|
+
const f = l.target.value, c = u(f);
|
|
1993
|
+
n?.(f, c);
|
|
1994
1994
|
};
|
|
1995
1995
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
1996
1996
|
"select",
|
|
1997
1997
|
{
|
|
1998
1998
|
defaultValue: String(r ?? ""),
|
|
1999
|
-
ref:
|
|
1999
|
+
ref: s,
|
|
2000
2000
|
onChange: m,
|
|
2001
2001
|
className: X(
|
|
2002
2002
|
$.input,
|
|
@@ -2006,45 +2006,45 @@ const qr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
) });
|
|
2008
2008
|
};
|
|
2009
|
-
function
|
|
2009
|
+
function Ur(e) {
|
|
2010
2010
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
2011
2011
|
}
|
|
2012
|
-
const
|
|
2012
|
+
const Wr = ({
|
|
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 } = z(), s = k(null), i = F.useCallback(
|
|
2019
|
+
(f) => {
|
|
2020
|
+
const c = f.trim();
|
|
2021
|
+
return c === "" ? e.required ? a("Value required") : null : Ur(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, f, a) ?? null : a("Must be valid email format");
|
|
2024
2024
|
},
|
|
2025
2025
|
[e, t, a]
|
|
2026
|
-
), u = (
|
|
2027
|
-
const c =
|
|
2028
|
-
n?.(c,
|
|
2026
|
+
), u = (f) => {
|
|
2027
|
+
const c = f.target.value, d = i(c);
|
|
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
|
-
|
|
2035
|
-
}, [r,
|
|
2033
|
+
const f = r ?? "", c = i(f);
|
|
2034
|
+
s.current && s.current.value !== String(f) && (s.current.value = String(f)), c !== m.current && (m.current = c, l.current?.(c ?? null));
|
|
2035
|
+
}, [r, i]), /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
2036
2036
|
"input",
|
|
2037
2037
|
{
|
|
2038
2038
|
id: e.name,
|
|
2039
2039
|
type: "email",
|
|
2040
2040
|
defaultValue: String(r ?? ""),
|
|
2041
|
-
ref:
|
|
2041
|
+
ref: s,
|
|
2042
2042
|
onChange: u,
|
|
2043
2043
|
className: X($.input, $.textInput)
|
|
2044
2044
|
}
|
|
2045
2045
|
) });
|
|
2046
|
-
},
|
|
2047
|
-
const { darkMode: r } =
|
|
2046
|
+
}, Yr = ({ field: e }) => {
|
|
2047
|
+
const { darkMode: r } = z(), {
|
|
2048
2048
|
color: n = r ? "#444444" : "#CCCCCC",
|
|
2049
2049
|
thickness: o = 1,
|
|
2050
2050
|
margin: t = "8px 0"
|
|
@@ -2061,203 +2061,203 @@ const Yr = ({
|
|
|
2061
2061
|
}
|
|
2062
2062
|
}
|
|
2063
2063
|
);
|
|
2064
|
-
}
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2064
|
+
}, Jr = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
2065
|
+
const { t, definitionName: a } = z(), [s, i] = V(!1), u = k(null), m = k(o);
|
|
2066
|
+
C(() => {
|
|
2067
|
+
m.current = o;
|
|
2068
|
+
}, [o]);
|
|
2069
|
+
const l = F.useCallback(
|
|
2070
|
+
(v) => e.required && (!v || Array.isArray(v) && v.length === 0) ? t("Value required") : Y(a, e, v, t) ?? null,
|
|
2071
|
+
[e, a, t]
|
|
2072
|
+
), f = F.useMemo(() => l(r), [r, l]);
|
|
2073
|
+
C(() => {
|
|
2074
|
+
const v = l(r);
|
|
2075
|
+
n?.(r, v), m.current?.(v ?? null);
|
|
2076
|
+
}, [r, l]);
|
|
2077
|
+
const c = (v) => {
|
|
2078
|
+
const A = v.target.files;
|
|
2079
|
+
let R = null;
|
|
2080
|
+
if (A && A.length > 0) {
|
|
2081
|
+
const j = Array.from(A);
|
|
2082
|
+
e.multiple ? R = [...Array.isArray(r) ? r : [], ...j] : R = j[0];
|
|
2075
2083
|
}
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2084
|
+
const w = l(R);
|
|
2085
|
+
n?.(R, w);
|
|
2086
|
+
}, d = (v) => {
|
|
2087
|
+
v.preventDefault(), v.stopPropagation(), i(!1);
|
|
2088
|
+
const A = v.dataTransfer.files;
|
|
2089
|
+
if (A && A.length > 0) {
|
|
2090
|
+
const R = Array.from(A);
|
|
2091
|
+
let w = null;
|
|
2092
|
+
e.multiple ? w = [...Array.isArray(r) ? r : [], ...R] : w = R[0];
|
|
2093
|
+
const j = l(w);
|
|
2094
|
+
n?.(w, j);
|
|
2095
|
+
}
|
|
2096
|
+
}, b = (v) => {
|
|
2097
|
+
v.preventDefault(), v.stopPropagation(), i(!0);
|
|
2098
|
+
}, p = (v) => {
|
|
2099
|
+
v.preventDefault(), v.stopPropagation(), i(!1);
|
|
2100
|
+
}, y = (v) => {
|
|
2101
|
+
if (Array.isArray(r) && typeof v == "number") {
|
|
2102
|
+
const A = r.filter((j, N) => N !== v), R = A.length > 0 ? A : null, w = l(R);
|
|
2103
|
+
n?.(R, w);
|
|
2104
|
+
} else {
|
|
2105
|
+
const A = l(null);
|
|
2106
|
+
n?.(null, A);
|
|
2107
|
+
}
|
|
2108
|
+
}, x = () => {
|
|
2109
|
+
const v = Array.isArray(r) ? r : r ? [r] : [];
|
|
2110
|
+
return v.length === 0 ? null : /* @__PURE__ */ g.jsx("div", { style: {
|
|
2111
|
+
marginTop: "8px",
|
|
2112
|
+
display: "flex",
|
|
2113
|
+
flexDirection: "column",
|
|
2114
|
+
gap: "6px"
|
|
2115
|
+
}, children: v.map((A, R) => /* @__PURE__ */ g.jsxs(
|
|
2081
2116
|
"div",
|
|
2082
2117
|
{
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2118
|
+
style: {
|
|
2119
|
+
display: "flex",
|
|
2120
|
+
alignItems: "center",
|
|
2121
|
+
justifyContent: "space-between",
|
|
2122
|
+
padding: "6px 10px",
|
|
2123
|
+
backgroundColor: "var(--reactaform-input-bg, #fff)",
|
|
2124
|
+
border: "1px solid var(--reactaform-border-color, #d1d5db)",
|
|
2125
|
+
borderRadius: "4px",
|
|
2126
|
+
fontSize: "0.875rem",
|
|
2127
|
+
gap: "8px"
|
|
2086
2128
|
},
|
|
2129
|
+
children: [
|
|
2130
|
+
/* @__PURE__ */ g.jsx("div", { style: {
|
|
2131
|
+
flex: 1,
|
|
2132
|
+
minWidth: 0,
|
|
2133
|
+
overflow: "hidden",
|
|
2134
|
+
textOverflow: "ellipsis",
|
|
2135
|
+
whiteSpace: "nowrap"
|
|
2136
|
+
}, children: A.name }),
|
|
2137
|
+
/* @__PURE__ */ g.jsx(
|
|
2138
|
+
"button",
|
|
2139
|
+
{
|
|
2140
|
+
type: "button",
|
|
2141
|
+
onClick: () => y(Array.isArray(r) ? R : void 0),
|
|
2142
|
+
"aria-label": t("Remove file"),
|
|
2143
|
+
style: {
|
|
2144
|
+
background: "transparent",
|
|
2145
|
+
border: "none",
|
|
2146
|
+
color: "var(--reactaform-color-error, #ef4444)",
|
|
2147
|
+
cursor: "pointer",
|
|
2148
|
+
padding: "2px 6px",
|
|
2149
|
+
fontSize: "1.125rem",
|
|
2150
|
+
lineHeight: 1,
|
|
2151
|
+
borderRadius: "4px",
|
|
2152
|
+
transition: "background-color 0.2s",
|
|
2153
|
+
flexShrink: 0
|
|
2154
|
+
},
|
|
2155
|
+
onMouseEnter: (w) => {
|
|
2156
|
+
w.currentTarget.style.backgroundColor = "var(--reactaform-bg-hover, #fee)";
|
|
2157
|
+
},
|
|
2158
|
+
onMouseLeave: (w) => {
|
|
2159
|
+
w.currentTarget.style.backgroundColor = "transparent";
|
|
2160
|
+
},
|
|
2161
|
+
children: "×"
|
|
2162
|
+
}
|
|
2163
|
+
)
|
|
2164
|
+
]
|
|
2165
|
+
},
|
|
2166
|
+
`${A.name}-${R}`
|
|
2167
|
+
)) });
|
|
2168
|
+
};
|
|
2169
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: f, children: /* @__PURE__ */ g.jsxs("div", { style: { width: "100%" }, children: [
|
|
2170
|
+
/* @__PURE__ */ g.jsxs(
|
|
2171
|
+
"div",
|
|
2172
|
+
{
|
|
2173
|
+
onDrop: d,
|
|
2174
|
+
onDragOver: b,
|
|
2175
|
+
onDragLeave: p,
|
|
2087
2176
|
style: {
|
|
2088
|
-
position: "
|
|
2089
|
-
|
|
2090
|
-
left: d,
|
|
2091
|
-
backgroundColor: "var(--reactaform-primary-bg, #fff)",
|
|
2092
|
-
border: "1px solid var(--reactaform-border-color, #ccc)",
|
|
2177
|
+
position: "relative",
|
|
2178
|
+
border: `1px dashed ${s ? "var(--reactaform-color-primary, #2563eb)" : f ? "var(--reactaform-color-error, #ef4444)" : "var(--reactaform-border-color, #d1d5db)"}`,
|
|
2093
2179
|
borderRadius: "var(--reactaform-border-radius, 4px)",
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2180
|
+
padding: "8px 12px",
|
|
2181
|
+
textAlign: "center",
|
|
2182
|
+
backgroundColor: s ? "var(--reactaform-bg-hover, #f0f9ff)" : "var(--reactaform-input-bg, #fff)",
|
|
2183
|
+
transition: "all 0.2s ease",
|
|
2184
|
+
cursor: "pointer",
|
|
2185
|
+
minHeight: "var(--reactaform-input-height, 34px)",
|
|
2186
|
+
width: "100%",
|
|
2187
|
+
maxWidth: "100%",
|
|
2188
|
+
alignSelf: "stretch",
|
|
2189
|
+
boxSizing: "border-box",
|
|
2190
|
+
display: "flex",
|
|
2191
|
+
alignItems: "center",
|
|
2192
|
+
justifyContent: "center",
|
|
2193
|
+
gap: "8px"
|
|
2098
2194
|
},
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
"
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2195
|
+
onClick: () => u.current?.click(),
|
|
2196
|
+
children: [
|
|
2197
|
+
/* @__PURE__ */ g.jsx(
|
|
2198
|
+
"input",
|
|
2199
|
+
{
|
|
2200
|
+
id: e.name,
|
|
2201
|
+
ref: u,
|
|
2202
|
+
type: "file",
|
|
2203
|
+
accept: e.accept,
|
|
2204
|
+
multiple: e.multiple,
|
|
2205
|
+
style: {
|
|
2206
|
+
display: "none"
|
|
2207
|
+
},
|
|
2208
|
+
onChange: c
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
/* @__PURE__ */ g.jsx("div", { style: {
|
|
2212
|
+
fontSize: "1.25rem",
|
|
2213
|
+
opacity: 0.6,
|
|
2214
|
+
lineHeight: 1,
|
|
2215
|
+
flexShrink: 0
|
|
2216
|
+
}, children: "📁" }),
|
|
2217
|
+
/* @__PURE__ */ g.jsx("div", { style: {
|
|
2218
|
+
fontSize: "0.875rem",
|
|
2219
|
+
fontWeight: 400,
|
|
2220
|
+
color: "var(--reactaform-text-color, #111827)",
|
|
2221
|
+
flex: 1,
|
|
2222
|
+
textAlign: "left"
|
|
2223
|
+
}, children: s ? t("Drop files here") : e.multiple ? t("Choose Files or Drag & Drop") : t("Choose File or Drag & Drop") }),
|
|
2224
|
+
e.accept && /* @__PURE__ */ g.jsx("div", { style: {
|
|
2225
|
+
fontSize: "0.75rem",
|
|
2226
|
+
color: "var(--reactaform-text-muted, #6b7280)",
|
|
2227
|
+
whiteSpace: "nowrap",
|
|
2228
|
+
opacity: s ? 0 : 1,
|
|
2229
|
+
transition: "opacity 0.15s ease",
|
|
2230
|
+
pointerEvents: s ? "none" : "auto"
|
|
2231
|
+
}, children: e.accept })
|
|
2232
|
+
]
|
|
2128
2233
|
}
|
|
2129
2234
|
),
|
|
2130
|
-
|
|
2131
|
-
);
|
|
2132
|
-
}
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
C(() => {
|
|
2136
|
-
f.current = o;
|
|
2137
|
-
}, [o]);
|
|
2138
|
-
const b = A.useCallback(
|
|
2139
|
-
(S) => e.required && (!S || Array.isArray(S) && S.length === 0) ? t("Value required") : Y(a, e, S, t) ?? null,
|
|
2140
|
-
[e, a, t]
|
|
2141
|
-
), p = A.useMemo(() => b(r), [r, b]);
|
|
2142
|
-
C(() => {
|
|
2143
|
-
const S = b(r);
|
|
2144
|
-
n?.(r, S), f.current?.(S ?? null);
|
|
2145
|
-
}, [r, b]);
|
|
2146
|
-
const y = (S) => {
|
|
2147
|
-
const F = S.target.files;
|
|
2148
|
-
let I = null;
|
|
2149
|
-
F && F.length > 0 && (I = e.multiple ? Array.from(F) : F[0]);
|
|
2150
|
-
const w = b(I);
|
|
2151
|
-
n?.(I, w);
|
|
2152
|
-
}, x = (S) => {
|
|
2153
|
-
if (p)
|
|
2154
|
-
return;
|
|
2155
|
-
let F = null;
|
|
2156
|
-
try {
|
|
2157
|
-
F = S.currentTarget.getBoundingClientRect();
|
|
2158
|
-
} catch {
|
|
2159
|
-
F = null;
|
|
2160
|
-
}
|
|
2161
|
-
const I = F && typeof F.left == "number" ? F.left : 10, w = F && typeof F.bottom == "number" ? F.bottom : 20;
|
|
2162
|
-
m({ x: I, y: w });
|
|
2163
|
-
let j = [];
|
|
2164
|
-
Array.isArray(r) ? j = r ? r.map((E) => ({ label: E.name })) : [] : j = r ? [{ label: r.name }] : [], j.length === 0 && (j = [{ label: t("No file selected") }]), d(j), s((E) => !E);
|
|
2165
|
-
};
|
|
2166
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error: p, children: /* @__PURE__ */ g.jsxs(
|
|
2167
|
-
"div",
|
|
2168
|
-
{
|
|
2169
|
-
style: {
|
|
2170
|
-
display: "flex",
|
|
2171
|
-
alignItems: "center",
|
|
2172
|
-
gap: "var(--reactaform-inline-gap, 8px)",
|
|
2173
|
-
width: "100%"
|
|
2174
|
-
},
|
|
2175
|
-
children: [
|
|
2176
|
-
/* @__PURE__ */ g.jsx(
|
|
2177
|
-
"input",
|
|
2178
|
-
{
|
|
2179
|
-
id: e.name,
|
|
2180
|
-
ref: c,
|
|
2181
|
-
type: "file",
|
|
2182
|
-
accept: e.accept,
|
|
2183
|
-
multiple: e.multiple,
|
|
2184
|
-
style: {
|
|
2185
|
-
width: 0,
|
|
2186
|
-
height: 0,
|
|
2187
|
-
opacity: 0,
|
|
2188
|
-
position: "absolute",
|
|
2189
|
-
zIndex: -1
|
|
2190
|
-
},
|
|
2191
|
-
onChange: y
|
|
2192
|
-
}
|
|
2193
|
-
),
|
|
2194
|
-
/* @__PURE__ */ g.jsx(
|
|
2195
|
-
"label",
|
|
2196
|
-
{
|
|
2197
|
-
htmlFor: e.name,
|
|
2198
|
-
className: $.button,
|
|
2199
|
-
style: {
|
|
2200
|
-
width: "100%",
|
|
2201
|
-
height: "inherit",
|
|
2202
|
-
textAlign: "center"
|
|
2203
|
-
},
|
|
2204
|
-
children: e.multiple ? t("Choose Files...") : t("Choose File...")
|
|
2205
|
-
}
|
|
2206
|
-
),
|
|
2207
|
-
/* @__PURE__ */ g.jsx(
|
|
2208
|
-
"button",
|
|
2209
|
-
{
|
|
2210
|
-
onClick: x,
|
|
2211
|
-
"aria-haspopup": !0,
|
|
2212
|
-
"aria-expanded": i,
|
|
2213
|
-
"aria-label": t("Show selected files"),
|
|
2214
|
-
className: $.button,
|
|
2215
|
-
style: {
|
|
2216
|
-
height: "inherit",
|
|
2217
|
-
display: "inline-block"
|
|
2218
|
-
},
|
|
2219
|
-
children: /* @__PURE__ */ g.jsx("span", { children: "⋮" })
|
|
2220
|
-
}
|
|
2221
|
-
),
|
|
2222
|
-
i && u && l && l.length > 0 && /* @__PURE__ */ g.jsx(
|
|
2223
|
-
ir,
|
|
2224
|
-
{
|
|
2225
|
-
pos: u,
|
|
2226
|
-
options: l,
|
|
2227
|
-
onClose: () => {
|
|
2228
|
-
m(null), s(!1);
|
|
2229
|
-
},
|
|
2230
|
-
onClickOption: () => {
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
)
|
|
2234
|
-
]
|
|
2235
|
-
}
|
|
2236
|
-
) });
|
|
2237
|
-
}, Kr = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
2238
|
-
function Xr(e) {
|
|
2239
|
-
return e.split(",").map((r) => r.trim()).every((r) => Kr.test(r));
|
|
2235
|
+
x()
|
|
2236
|
+
] }) });
|
|
2237
|
+
}, Gr = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
2238
|
+
function Kr(e) {
|
|
2239
|
+
return e.split(",").map((r) => r.trim()).every((r) => Gr.test(r));
|
|
2240
2240
|
}
|
|
2241
|
-
const
|
|
2241
|
+
const Xr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim()).filter(Boolean).map(Number), Zr = ({
|
|
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 } = z(), [s, i] = V(
|
|
2248
2248
|
Array.isArray(r) ? r.join(", ") : String(r ?? "")
|
|
2249
|
-
), u =
|
|
2249
|
+
), u = F.useCallback(
|
|
2250
2250
|
(c) => {
|
|
2251
2251
|
if (c.trim() === "")
|
|
2252
2252
|
return e.required ? t("Value required") : null;
|
|
2253
|
-
if (!
|
|
2253
|
+
if (!Kr(c))
|
|
2254
2254
|
return t("Each value must be a valid float");
|
|
2255
|
-
const
|
|
2256
|
-
if (e.minCount !== void 0 &&
|
|
2255
|
+
const d = Xr(c);
|
|
2256
|
+
if (e.minCount !== void 0 && d.length < e.minCount)
|
|
2257
2257
|
return t("Minimum number of values: {{1}}", e.minCount);
|
|
2258
|
-
if (e.maxCount !== void 0 &&
|
|
2258
|
+
if (e.maxCount !== void 0 && d.length > e.maxCount)
|
|
2259
2259
|
return t("Maximum number of values: {{1}}", e.maxCount);
|
|
2260
|
-
for (const p of
|
|
2260
|
+
for (const p of d) {
|
|
2261
2261
|
if (e.min !== void 0 && (e.minInclusive ? p < e.min : p <= e.min))
|
|
2262
2262
|
return t(
|
|
2263
2263
|
"Each value must be {{1}} {{2}}",
|
|
@@ -2271,44 +2271,44 @@ const Zr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
|
|
|
2271
2271
|
e.max
|
|
2272
2272
|
);
|
|
2273
2273
|
}
|
|
2274
|
-
return Y(a, e,
|
|
2274
|
+
return Y(a, e, d, t) ?? null;
|
|
2275
2275
|
},
|
|
2276
2276
|
[a, e, t]
|
|
2277
2277
|
), m = (c) => {
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
}, l = k(null),
|
|
2278
|
+
const d = c.target.value, b = u(d);
|
|
2279
|
+
i(d), n?.(d, b);
|
|
2280
|
+
}, l = k(null), f = k(o);
|
|
2281
2281
|
return C(() => {
|
|
2282
|
-
|
|
2282
|
+
f.current = o;
|
|
2283
2283
|
}, [o]), C(() => {
|
|
2284
|
-
const c = Array.isArray(r) ? r.join(", ") : String(r ?? ""),
|
|
2285
|
-
|
|
2286
|
-
}, [r, e.required, u, t]), /* @__PURE__ */ g.jsx(W, { field: e, error: u(
|
|
2284
|
+
const c = Array.isArray(r) ? r.join(", ") : String(r ?? ""), d = u(c);
|
|
2285
|
+
d !== l.current && (l.current = d, f.current?.(d ?? null));
|
|
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
|
-
value:
|
|
2290
|
+
value: s,
|
|
2291
2291
|
onChange: m,
|
|
2292
2292
|
className: X($.input, $.textInput),
|
|
2293
2293
|
style: { flex: 1 }
|
|
2294
2294
|
}
|
|
2295
2295
|
) });
|
|
2296
|
-
},
|
|
2296
|
+
}, Qr = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, et = (e) => {
|
|
2297
2297
|
const r = Number.parseFloat(e);
|
|
2298
2298
|
return Number.isNaN(r) ? null : r;
|
|
2299
|
-
},
|
|
2299
|
+
}, rt = ({
|
|
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 } = z(), s = k(null), i = F.useCallback(
|
|
2306
|
+
(f) => {
|
|
2307
|
+
if (f.trim() === "")
|
|
2308
2308
|
return e.required ? t("Value required") : null;
|
|
2309
|
-
if (!
|
|
2309
|
+
if (!Qr.test(f))
|
|
2310
2310
|
return t("Must be a valid float");
|
|
2311
|
-
const c =
|
|
2311
|
+
const c = et(f);
|
|
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,20 +2324,20 @@ const Zr = (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)),
|
|
2329
|
-
}, [r, e,
|
|
2330
|
-
const l = (
|
|
2331
|
-
const c =
|
|
2332
|
-
n?.(c,
|
|
2327
|
+
const f = String(r ?? ""), c = i(f);
|
|
2328
|
+
c !== u.current && (u.current = c, m.current?.(c ?? null)), s.current && document.activeElement !== s.current && (s.current.value = f);
|
|
2329
|
+
}, [r, e, i, t]);
|
|
2330
|
+
const l = (f) => {
|
|
2331
|
+
const c = f.target.value, d = i(c);
|
|
2332
|
+
n?.(c, d);
|
|
2333
2333
|
};
|
|
2334
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error:
|
|
2334
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
2335
2335
|
"input",
|
|
2336
2336
|
{
|
|
2337
2337
|
id: e.name,
|
|
2338
2338
|
type: "text",
|
|
2339
2339
|
defaultValue: String(r ?? ""),
|
|
2340
|
-
ref:
|
|
2340
|
+
ref: s,
|
|
2341
2341
|
onChange: l,
|
|
2342
2342
|
className: X(
|
|
2343
2343
|
$.input,
|
|
@@ -2346,7 +2346,7 @@ const Zr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
|
|
|
2346
2346
|
}
|
|
2347
2347
|
) });
|
|
2348
2348
|
};
|
|
2349
|
-
function
|
|
2349
|
+
function tt() {
|
|
2350
2350
|
try {
|
|
2351
2351
|
return "/";
|
|
2352
2352
|
} catch {
|
|
@@ -2358,46 +2358,46 @@ function nt() {
|
|
|
2358
2358
|
}
|
|
2359
2359
|
return "/";
|
|
2360
2360
|
}
|
|
2361
|
-
const
|
|
2362
|
-
const { language: n, t: o } =
|
|
2361
|
+
const nt = ({ field: e, value: r }) => {
|
|
2362
|
+
const { language: n, t: o } = z(), t = e.alignment || "center", a = {
|
|
2363
2363
|
left: "flex-start",
|
|
2364
2364
|
center: "center",
|
|
2365
2365
|
right: "flex-end"
|
|
2366
|
-
},
|
|
2367
|
-
let
|
|
2368
|
-
|
|
2369
|
-
const u = e.localized?.split(";").map((y) => y.trim()), [m, l] =
|
|
2366
|
+
}, s = typeof r == "string" ? r : "";
|
|
2367
|
+
let i = s && s.trim() !== "" ? s : typeof e.defaultValue == "string" ? e.defaultValue : "";
|
|
2368
|
+
i && !i.startsWith("/") && (i = `${tt()}${i}`);
|
|
2369
|
+
const u = e.localized?.split(";").map((y) => y.trim()), [m, l] = V(i || ""), f = k(i || null);
|
|
2370
2370
|
if (C(() => {
|
|
2371
|
-
if (!
|
|
2372
|
-
const y =
|
|
2373
|
-
if (
|
|
2374
|
-
const
|
|
2371
|
+
if (!i) return;
|
|
2372
|
+
const y = i.split("/"), x = y.pop(), v = x.lastIndexOf(".");
|
|
2373
|
+
if (v === -1) return;
|
|
2374
|
+
const A = x.substring(0, v), R = x.substring(v);
|
|
2375
2375
|
let w = null;
|
|
2376
|
-
u?.includes(n) && (w = `${
|
|
2376
|
+
u?.includes(n) && (w = `${A}_${n}${R}`);
|
|
2377
2377
|
const j = new AbortController();
|
|
2378
2378
|
if (w) {
|
|
2379
|
-
const
|
|
2380
|
-
fetch(
|
|
2381
|
-
const
|
|
2382
|
-
|
|
2379
|
+
const N = [...y, w].join("/");
|
|
2380
|
+
fetch(N, { method: "HEAD", signal: j.signal }).then((S) => {
|
|
2381
|
+
const I = S.ok ? N : i;
|
|
2382
|
+
I !== f.current && (f.current = I, l(I));
|
|
2383
2383
|
}).catch(() => {
|
|
2384
|
-
|
|
2384
|
+
i !== f.current && (f.current = i, l(i));
|
|
2385
2385
|
});
|
|
2386
2386
|
} else {
|
|
2387
|
-
const
|
|
2388
|
-
|
|
2387
|
+
const N = i;
|
|
2388
|
+
N !== f.current && (f.current = N, requestAnimationFrame(() => l(N)));
|
|
2389
2389
|
}
|
|
2390
2390
|
return () => {
|
|
2391
2391
|
j.abort();
|
|
2392
2392
|
};
|
|
2393
|
-
}, [
|
|
2394
|
-
const { width: c, height:
|
|
2393
|
+
}, [i, n, u]), !m) return null;
|
|
2394
|
+
const { width: c, height: d } = e, b = {}, p = {
|
|
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 &&
|
|
2400
|
+
return c && d ? (b.width = c, b.height = d, p.width = `${c}px`, p.height = `${d}px`) : c && !d ? (b.width = c, p.width = `${c}px`, p.height = "auto") : !c && d && (b.height = d, p.width = "auto", p.height = `${d}px`), /* @__PURE__ */ g.jsx(W, { field: e, children: /* @__PURE__ */ g.jsx(
|
|
2401
2401
|
"div",
|
|
2402
2402
|
{
|
|
2403
2403
|
"data-testid": "image-wrapper",
|
|
@@ -2418,23 +2418,23 @@ const ot = ({ field: e, value: r }) => {
|
|
|
2418
2418
|
}
|
|
2419
2419
|
) });
|
|
2420
2420
|
};
|
|
2421
|
-
function
|
|
2421
|
+
function ot(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 at = ({
|
|
2426
2426
|
field: e,
|
|
2427
2427
|
value: r,
|
|
2428
2428
|
onChange: n,
|
|
2429
2429
|
onError: o
|
|
2430
2430
|
}) => {
|
|
2431
|
-
const { t, definitionName: a } =
|
|
2432
|
-
Array.isArray(r) ? r.join(
|
|
2433
|
-
), m = (b) => !b || b.trim() === "" ? [] : b.split(
|
|
2431
|
+
const { t, definitionName: a } = z(), s = ",", [i, u] = V(
|
|
2432
|
+
Array.isArray(r) ? r.join(s + " ") : String(r ?? "")
|
|
2433
|
+
), m = (b) => !b || b.trim() === "" ? [] : b.split(s).map((p) => p.trim()).filter(Boolean).map((p) => Number(p)), l = F.useCallback(
|
|
2434
2434
|
(b) => {
|
|
2435
2435
|
if (b.trim() === "")
|
|
2436
2436
|
return e.required ? t("Value required") : null;
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!ot(b))
|
|
2438
2438
|
return t("Each value must be a valid integer");
|
|
2439
2439
|
const p = m(b);
|
|
2440
2440
|
if (e.minCount !== void 0 && p.length < e.minCount)
|
|
@@ -2458,55 +2458,55 @@ const st = ({
|
|
|
2458
2458
|
return Y(a, e, p, t) ?? null;
|
|
2459
2459
|
},
|
|
2460
2460
|
[a, e, t]
|
|
2461
|
-
),
|
|
2461
|
+
), f = (b) => {
|
|
2462
2462
|
const p = b.target.value, y = l(p);
|
|
2463
2463
|
u(p), n?.(p, y);
|
|
2464
|
-
}, c = k(null),
|
|
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(
|
|
2471
|
-
p !== c.current && (c.current = p,
|
|
2472
|
-
}, [r, e.required, l, t]), /* @__PURE__ */ g.jsx(W, { field: e, error: l(
|
|
2470
|
+
const b = Array.isArray(r) ? r.join(s + " ") : String(r ?? ""), p = l(b);
|
|
2471
|
+
p !== c.current && (c.current = p, d.current?.(p ?? null));
|
|
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
|
-
value:
|
|
2477
|
-
onChange:
|
|
2476
|
+
value: i,
|
|
2477
|
+
onChange: f,
|
|
2478
2478
|
className: X($.input, $.textInput),
|
|
2479
2479
|
style: { flex: 1 }
|
|
2480
2480
|
}
|
|
2481
2481
|
) });
|
|
2482
2482
|
};
|
|
2483
|
-
function
|
|
2483
|
+
function st(e) {
|
|
2484
2484
|
return /^[-+]?\d*$/.test(e);
|
|
2485
2485
|
}
|
|
2486
|
-
const
|
|
2486
|
+
const it = ({
|
|
2487
2487
|
field: e,
|
|
2488
2488
|
value: r,
|
|
2489
2489
|
onChange: n,
|
|
2490
2490
|
onError: o
|
|
2491
2491
|
}) => {
|
|
2492
|
-
const { t, definitionName: a } =
|
|
2493
|
-
const
|
|
2494
|
-
return Number.isNaN(
|
|
2495
|
-
}, []), u =
|
|
2492
|
+
const { t, definitionName: a } = z(), s = k(null), i = Z((c) => {
|
|
2493
|
+
const d = parseInt(c, 10);
|
|
2494
|
+
return Number.isNaN(d) ? null : d;
|
|
2495
|
+
}, []), u = F.useCallback(
|
|
2496
2496
|
(c) => {
|
|
2497
2497
|
if (c.trim() === "")
|
|
2498
2498
|
return e.required ? t("Value required") : null;
|
|
2499
|
-
if (!
|
|
2499
|
+
if (!st(c))
|
|
2500
2500
|
return t("Must be a valid integer");
|
|
2501
|
-
const
|
|
2502
|
-
if (
|
|
2503
|
-
if (e.min !== void 0 && (e.minInclusive ?
|
|
2501
|
+
const d = i(c);
|
|
2502
|
+
if (d === null) return t("Must be a valid integer");
|
|
2503
|
+
if (e.min !== void 0 && (e.minInclusive ? d < e.min : d <= e.min))
|
|
2504
2504
|
return t(
|
|
2505
2505
|
"Must be {{1}} {{2}}",
|
|
2506
2506
|
e.minInclusive ? "≥" : ">",
|
|
2507
2507
|
e.min
|
|
2508
2508
|
);
|
|
2509
|
-
if (e.max !== void 0 && (e.maxInclusive ?
|
|
2509
|
+
if (e.max !== void 0 && (e.maxInclusive ? d > e.max : d >= e.max))
|
|
2510
2510
|
return t(
|
|
2511
2511
|
"Must be {{1}} {{2}}",
|
|
2512
2512
|
e.maxInclusive ? "≤" : "<",
|
|
@@ -2516,22 +2516,22 @@ const ct = ({
|
|
|
2516
2516
|
const p = Number(e.step);
|
|
2517
2517
|
if (!Number.isInteger(p))
|
|
2518
2518
|
return t("Invalid step value");
|
|
2519
|
-
if (
|
|
2519
|
+
if (d % p !== 0)
|
|
2520
2520
|
return t("Must be a multiple of {{1}}", p);
|
|
2521
2521
|
}
|
|
2522
|
-
return Y(a, e,
|
|
2522
|
+
return Y(a, e, d, t) ?? null;
|
|
2523
2523
|
},
|
|
2524
|
-
[e, a, t,
|
|
2524
|
+
[e, a, t, i]
|
|
2525
2525
|
), m = k(null), l = k(o);
|
|
2526
2526
|
C(() => {
|
|
2527
2527
|
l.current = o;
|
|
2528
2528
|
}, [o]), C(() => {
|
|
2529
|
-
const c = String(r ?? ""),
|
|
2530
|
-
|
|
2529
|
+
const c = String(r ?? ""), d = u(c);
|
|
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
|
|
2533
|
-
const
|
|
2534
|
-
n?.(
|
|
2532
|
+
const f = (c) => {
|
|
2533
|
+
const d = c.target.value, b = u(d);
|
|
2534
|
+
n?.(d, b);
|
|
2535
2535
|
};
|
|
2536
2536
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
2537
2537
|
"input",
|
|
@@ -2539,51 +2539,51 @@ const ct = ({
|
|
|
2539
2539
|
id: e.name,
|
|
2540
2540
|
type: "text",
|
|
2541
2541
|
defaultValue: String(r ?? ""),
|
|
2542
|
-
ref:
|
|
2543
|
-
onChange:
|
|
2542
|
+
ref: s,
|
|
2543
|
+
onChange: f,
|
|
2544
2544
|
className: X(
|
|
2545
2545
|
$.input,
|
|
2546
2546
|
$.inputNumber
|
|
2547
2547
|
)
|
|
2548
2548
|
}
|
|
2549
2549
|
) });
|
|
2550
|
-
},
|
|
2550
|
+
}, ct = ({
|
|
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 } = z(), s = e.minHeight ?? "80px", i = F.useRef(null), u = F.useRef(null), m = F.useRef(
|
|
2557
2557
|
o
|
|
2558
2558
|
);
|
|
2559
|
-
|
|
2559
|
+
F.useEffect(() => {
|
|
2560
2560
|
m.current = o;
|
|
2561
2561
|
}, [o]);
|
|
2562
|
-
const l =
|
|
2563
|
-
(
|
|
2562
|
+
const l = F.useCallback(
|
|
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 =
|
|
2565
|
+
), f = (d) => {
|
|
2566
|
+
const b = d.target.value, p = l(b);
|
|
2567
2567
|
n?.(b, p);
|
|
2568
2568
|
};
|
|
2569
2569
|
C(() => {
|
|
2570
|
-
const
|
|
2571
|
-
|
|
2570
|
+
const d = l(r);
|
|
2571
|
+
d !== u.current && (u.current = d, m.current?.(d ?? null)), i.current && i.current.value !== String(r ?? "") && (i.current.value = String(r ?? ""));
|
|
2572
2572
|
}, [r, l]);
|
|
2573
2573
|
const c = {
|
|
2574
2574
|
defaultValue: String(r ?? ""),
|
|
2575
|
-
ref:
|
|
2576
|
-
onChange:
|
|
2575
|
+
ref: i,
|
|
2576
|
+
onChange: f,
|
|
2577
2577
|
style: {
|
|
2578
2578
|
resize: "vertical",
|
|
2579
|
-
minHeight:
|
|
2579
|
+
minHeight: s,
|
|
2580
2580
|
width: "100%",
|
|
2581
2581
|
boxSizing: "border-box"
|
|
2582
2582
|
},
|
|
2583
2583
|
className: X($.input, $.textInput)
|
|
2584
2584
|
};
|
|
2585
2585
|
return /* @__PURE__ */ g.jsx(W, { field: e, error: l(r), children: /* @__PURE__ */ g.jsx("textarea", { ...c }) });
|
|
2586
|
-
},
|
|
2586
|
+
}, lt = ({
|
|
2587
2587
|
field: e,
|
|
2588
2588
|
value: r,
|
|
2589
2589
|
onChange: n,
|
|
@@ -2593,28 +2593,28 @@ const ct = ({
|
|
|
2593
2593
|
C(() => {
|
|
2594
2594
|
t.current = o;
|
|
2595
2595
|
}, [o]);
|
|
2596
|
-
const { t: a, darkMode:
|
|
2597
|
-
if (!
|
|
2598
|
-
const L =
|
|
2599
|
-
return (
|
|
2600
|
-
},
|
|
2596
|
+
const { t: a, darkMode: s, formStyle: i, fieldStyle: u, definitionName: m } = z(), l = (S, I, O) => {
|
|
2597
|
+
if (!I) return {};
|
|
2598
|
+
const L = S?.[I];
|
|
2599
|
+
return (O && L ? L[O] : void 0) ?? {};
|
|
2600
|
+
}, f = k(null), [c, d] = V(!1), [b, p] = V(
|
|
2601
2601
|
null
|
|
2602
2602
|
), y = G(
|
|
2603
|
-
() => e.options.map((
|
|
2603
|
+
() => e.options.map((S) => ({ value: S.value, label: a(S.label) })),
|
|
2604
2604
|
[e.options, a]
|
|
2605
2605
|
), x = G(() => {
|
|
2606
|
-
const
|
|
2607
|
-
return
|
|
2608
|
-
}, [r, y]),
|
|
2609
|
-
const
|
|
2610
|
-
return e.required &&
|
|
2611
|
-
},
|
|
2612
|
-
if (!
|
|
2613
|
-
const
|
|
2614
|
-
p({ x:
|
|
2615
|
-
},
|
|
2616
|
-
const
|
|
2617
|
-
t.current?.(
|
|
2606
|
+
const S = Array.isArray(r) ? r : [], I = new Set(y.map((O) => O.value));
|
|
2607
|
+
return S.filter((O) => I.has(O));
|
|
2608
|
+
}, [r, y]), v = (S) => {
|
|
2609
|
+
const I = Array.isArray(S) ? S : [];
|
|
2610
|
+
return e.required && I.length === 0 ? a("Value required") : Y(m, e, I, a) ?? null;
|
|
2611
|
+
}, A = () => {
|
|
2612
|
+
if (!f.current) return;
|
|
2613
|
+
const S = f.current.getBoundingClientRect();
|
|
2614
|
+
p({ x: S.left, y: S.bottom }), d((I) => !I);
|
|
2615
|
+
}, R = (S) => {
|
|
2616
|
+
const I = x.includes(S) ? x.filter((T) => T !== S) : [...x, S], O = v(I);
|
|
2617
|
+
t.current?.(O ?? null), n?.(I, O);
|
|
2618
2618
|
}, w = G(() => ({
|
|
2619
2619
|
height: "var(--reactaform-input-height, 2.5rem)",
|
|
2620
2620
|
padding: "var(--reactaform-input-padding, 8px)",
|
|
@@ -2627,9 +2627,9 @@ const ct = ({
|
|
|
2627
2627
|
border: "1px solid var(--reactaform-border-color, #ccc)",
|
|
2628
2628
|
background: "var(--reactaform-secondary-bg, #fff)",
|
|
2629
2629
|
color: "var(--reactaform-text-color, #000)",
|
|
2630
|
-
...l(
|
|
2630
|
+
...l(i, "multiSelect", "control"),
|
|
2631
2631
|
...l(u, void 0, "control")
|
|
2632
|
-
}), [
|
|
2632
|
+
}), [i, u]), j = G(() => ({
|
|
2633
2633
|
position: "absolute",
|
|
2634
2634
|
right: "1.5em",
|
|
2635
2635
|
top: "50%",
|
|
@@ -2640,9 +2640,9 @@ const ct = ({
|
|
|
2640
2640
|
fontSize: "0.8em",
|
|
2641
2641
|
color: "var(--reactaform-text-muted, #999)",
|
|
2642
2642
|
padding: 0,
|
|
2643
|
-
...l(
|
|
2643
|
+
...l(i, "multiSelect", "clearButton"),
|
|
2644
2644
|
...l(u, void 0, "clearButton")
|
|
2645
|
-
}), [
|
|
2645
|
+
}), [i, u]), N = G(() => ({
|
|
2646
2646
|
position: "absolute",
|
|
2647
2647
|
right: "0.7em",
|
|
2648
2648
|
top: "50%",
|
|
@@ -2650,23 +2650,23 @@ const ct = ({
|
|
|
2650
2650
|
pointerEvents: "none",
|
|
2651
2651
|
fontSize: "0.8em",
|
|
2652
2652
|
color: "var(--reactaform-text-muted, #999)",
|
|
2653
|
-
...l(
|
|
2653
|
+
...l(i, "multiSelect", "arrow"),
|
|
2654
2654
|
...l(u, void 0, "arrow")
|
|
2655
|
-
}), [
|
|
2655
|
+
}), [i, u]);
|
|
2656
2656
|
return /* @__PURE__ */ g.jsxs("div", { children: [
|
|
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: f,
|
|
2661
2661
|
className: "reactaform-multiselection-control",
|
|
2662
2662
|
style: w,
|
|
2663
|
-
onClick:
|
|
2663
|
+
onClick: A,
|
|
2664
2664
|
tabIndex: 0,
|
|
2665
2665
|
role: "button",
|
|
2666
2666
|
"aria-haspopup": "listbox",
|
|
2667
2667
|
"aria-expanded": c,
|
|
2668
|
-
onKeyDown: (
|
|
2669
|
-
(
|
|
2668
|
+
onKeyDown: (S) => {
|
|
2669
|
+
(S.key === "Enter" || S.key === " ") && (S.preventDefault(), A());
|
|
2670
2670
|
},
|
|
2671
2671
|
children: [
|
|
2672
2672
|
/* @__PURE__ */ g.jsxs(
|
|
@@ -2686,44 +2686,44 @@ const ct = ({
|
|
|
2686
2686
|
{
|
|
2687
2687
|
type: "button",
|
|
2688
2688
|
"aria-label": "Clear selections",
|
|
2689
|
-
onClick: (
|
|
2690
|
-
|
|
2689
|
+
onClick: (S) => {
|
|
2690
|
+
S.stopPropagation(), n?.([], null);
|
|
2691
2691
|
},
|
|
2692
2692
|
style: j,
|
|
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: N, "aria-hidden": !0, children: "▼" })
|
|
2697
2697
|
]
|
|
2698
2698
|
}
|
|
2699
2699
|
) }) }),
|
|
2700
2700
|
c && b && /* @__PURE__ */ g.jsx(
|
|
2701
|
-
|
|
2701
|
+
ut,
|
|
2702
2702
|
{
|
|
2703
2703
|
position: b,
|
|
2704
2704
|
options: y,
|
|
2705
2705
|
selectedValues: x,
|
|
2706
|
-
onToggleOption:
|
|
2707
|
-
onClose: () =>
|
|
2708
|
-
controlRef:
|
|
2709
|
-
darkMode:
|
|
2706
|
+
onToggleOption: R,
|
|
2707
|
+
onClose: () => d(!1),
|
|
2708
|
+
controlRef: f,
|
|
2709
|
+
darkMode: s
|
|
2710
2710
|
}
|
|
2711
2711
|
)
|
|
2712
2712
|
] });
|
|
2713
|
-
},
|
|
2713
|
+
}, ut = ({
|
|
2714
2714
|
position: e,
|
|
2715
2715
|
options: r,
|
|
2716
2716
|
selectedValues: n,
|
|
2717
2717
|
onToggleOption: o,
|
|
2718
2718
|
onClose: t,
|
|
2719
2719
|
controlRef: a,
|
|
2720
|
-
darkMode:
|
|
2720
|
+
darkMode: s
|
|
2721
2721
|
}) => {
|
|
2722
|
-
const
|
|
2723
|
-
if (!
|
|
2724
|
-
const
|
|
2725
|
-
return (
|
|
2726
|
-
},
|
|
2722
|
+
const i = k(null), [u, m] = V(-1), { formStyle: l, fieldStyle: f } = z(), c = (j, N, S) => {
|
|
2723
|
+
if (!N) return {};
|
|
2724
|
+
const O = j?.[N];
|
|
2725
|
+
return (S && O ? O[S] : void 0) ?? {};
|
|
2726
|
+
}, d = G(() => ({
|
|
2727
2727
|
maxHeight: 200,
|
|
2728
2728
|
overflowY: "auto",
|
|
2729
2729
|
background: "var(--reactaform-secondary-bg, #fff)",
|
|
@@ -2735,8 +2735,8 @@ const ct = ({
|
|
|
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(f, void 0, "popup")
|
|
2739
|
+
}), [l, f]), b = G(() => ({
|
|
2740
2740
|
padding: "6px 8px",
|
|
2741
2741
|
cursor: "pointer",
|
|
2742
2742
|
display: "flex",
|
|
@@ -2744,118 +2744,118 @@ const ct = ({
|
|
|
2744
2744
|
background: "transparent",
|
|
2745
2745
|
color: "var(--reactaform-text-color, #000)",
|
|
2746
2746
|
...c(l, "multiSelect", "option"),
|
|
2747
|
-
...c(
|
|
2748
|
-
}), [l,
|
|
2747
|
+
...c(f, void 0, "option")
|
|
2748
|
+
}), [l, f]);
|
|
2749
2749
|
C(() => {
|
|
2750
|
-
const j = (
|
|
2751
|
-
const
|
|
2752
|
-
!
|
|
2750
|
+
const j = (N) => {
|
|
2751
|
+
const S = N.target;
|
|
2752
|
+
!i.current?.contains(S) && !a.current?.contains(S) && t();
|
|
2753
2753
|
};
|
|
2754
2754
|
return document.addEventListener("mousedown", j), () => document.removeEventListener("mousedown", j);
|
|
2755
2755
|
}, [t, a]), C(() => {
|
|
2756
|
-
|
|
2756
|
+
i.current && r.length > 0 && requestAnimationFrame(() => m((j) => j === -1 ? 0 : j));
|
|
2757
2757
|
}, [r.length]), C(() => {
|
|
2758
|
-
if (!
|
|
2759
|
-
const j =
|
|
2758
|
+
if (!i.current || u < 0) return;
|
|
2759
|
+
const j = i.current.querySelector(`#multi-opt-${u}`);
|
|
2760
2760
|
j && requestAnimationFrame(() => j.focus());
|
|
2761
2761
|
}, [u]);
|
|
2762
|
-
const p = 250, y = 200, [x,
|
|
2762
|
+
const p = 250, y = 200, [x, v] = V(
|
|
2763
2763
|
null
|
|
2764
|
-
), [
|
|
2764
|
+
), [A, R] = V(null);
|
|
2765
2765
|
if (C(() => {
|
|
2766
2766
|
if (typeof window > "u") return;
|
|
2767
2767
|
const j = () => {
|
|
2768
|
-
let
|
|
2768
|
+
let I = e.x, O = e.y, T = p;
|
|
2769
2769
|
const L = a?.current;
|
|
2770
2770
|
if (L) {
|
|
2771
2771
|
const J = L.getBoundingClientRect();
|
|
2772
|
-
|
|
2772
|
+
I = J.left, O = J.bottom, T = Math.max(80, Math.round(J.width));
|
|
2773
2773
|
}
|
|
2774
|
-
|
|
2774
|
+
I = Math.min(I, window.innerWidth - T), O = Math.min(O, window.innerHeight - y), v({ left: I, top: O }), R(T);
|
|
2775
2775
|
};
|
|
2776
2776
|
j(), window.addEventListener("scroll", j, !0), window.addEventListener("resize", j);
|
|
2777
|
-
let
|
|
2778
|
-
const
|
|
2779
|
-
return typeof ResizeObserver < "u" &&
|
|
2780
|
-
window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j),
|
|
2777
|
+
let N = null;
|
|
2778
|
+
const S = a?.current;
|
|
2779
|
+
return typeof ResizeObserver < "u" && S && (N = new ResizeObserver(() => j()), N.observe(S)), () => {
|
|
2780
|
+
window.removeEventListener("scroll", j, !0), window.removeEventListener("resize", j), N && S && N.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)), Oe.createPortal(
|
|
2785
2785
|
/* @__PURE__ */ g.jsx(
|
|
2786
2786
|
"div",
|
|
2787
2787
|
{
|
|
2788
|
-
ref:
|
|
2788
|
+
ref: i,
|
|
2789
2789
|
role: "listbox",
|
|
2790
2790
|
"aria-activedescendant": u >= 0 ? `multi-opt-${u}` : void 0,
|
|
2791
2791
|
style: {
|
|
2792
2792
|
position: "absolute",
|
|
2793
2793
|
top: x ? x.top : e.y,
|
|
2794
2794
|
left: x ? x.left : e.x,
|
|
2795
|
-
width:
|
|
2795
|
+
width: A ?? p,
|
|
2796
2796
|
// spread the static popup styles
|
|
2797
|
-
...
|
|
2797
|
+
...d
|
|
2798
2798
|
},
|
|
2799
|
-
"data-reactaform-theme":
|
|
2800
|
-
children: r.map((j,
|
|
2801
|
-
const
|
|
2799
|
+
"data-reactaform-theme": s ? "dark" : "light",
|
|
2800
|
+
children: r.map((j, N) => {
|
|
2801
|
+
const S = n.includes(j.value), I = s ? "var(--reactaform-hover-bg, rgba(255,255,255,0.01))" : "var(--reactaform-hover-bg, #eee)", O = {
|
|
2802
2802
|
...b,
|
|
2803
|
-
background:
|
|
2803
|
+
background: N === u ? I : 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-${N}`,
|
|
2809
|
+
onMouseDown: (T) => {
|
|
2810
|
+
T.stopPropagation(), o(j.value);
|
|
2811
2811
|
},
|
|
2812
|
-
onKeyDown: (
|
|
2812
|
+
onKeyDown: (T) => {
|
|
2813
2813
|
const L = r.length;
|
|
2814
|
-
switch (
|
|
2814
|
+
switch (T.key) {
|
|
2815
2815
|
case "ArrowDown":
|
|
2816
|
-
|
|
2816
|
+
T.preventDefault(), m((J) => (J + 1) % L);
|
|
2817
2817
|
break;
|
|
2818
2818
|
case "ArrowUp":
|
|
2819
|
-
|
|
2819
|
+
T.preventDefault(), m((J) => (J - 1 + L) % L);
|
|
2820
2820
|
break;
|
|
2821
2821
|
case "Home":
|
|
2822
|
-
|
|
2822
|
+
T.preventDefault(), m(0);
|
|
2823
2823
|
break;
|
|
2824
2824
|
case "End":
|
|
2825
|
-
|
|
2825
|
+
T.preventDefault(), m(L - 1);
|
|
2826
2826
|
break;
|
|
2827
2827
|
case "Enter":
|
|
2828
2828
|
case " ":
|
|
2829
|
-
|
|
2829
|
+
T.preventDefault(), T.stopPropagation(), o(j.value);
|
|
2830
2830
|
break;
|
|
2831
2831
|
case "Escape":
|
|
2832
|
-
|
|
2832
|
+
T.preventDefault(), t(), a?.current?.focus();
|
|
2833
2833
|
break;
|
|
2834
2834
|
}
|
|
2835
2835
|
},
|
|
2836
|
-
tabIndex:
|
|
2836
|
+
tabIndex: N === u ? 0 : -1,
|
|
2837
2837
|
role: "option",
|
|
2838
|
-
"aria-selected":
|
|
2839
|
-
style:
|
|
2840
|
-
onMouseEnter: (
|
|
2841
|
-
|
|
2838
|
+
"aria-selected": S,
|
|
2839
|
+
style: O,
|
|
2840
|
+
onMouseEnter: (T) => {
|
|
2841
|
+
T.currentTarget.style.background = I, m(N);
|
|
2842
2842
|
},
|
|
2843
|
-
onMouseLeave: (
|
|
2844
|
-
|
|
2843
|
+
onMouseLeave: (T) => {
|
|
2844
|
+
T.currentTarget.style.background = "transparent", m((L) => L === N ? -1 : L);
|
|
2845
2845
|
},
|
|
2846
2846
|
children: [
|
|
2847
2847
|
/* @__PURE__ */ g.jsx(
|
|
2848
2848
|
"input",
|
|
2849
2849
|
{
|
|
2850
2850
|
type: "checkbox",
|
|
2851
|
-
checked:
|
|
2851
|
+
checked: S,
|
|
2852
2852
|
readOnly: !0,
|
|
2853
2853
|
style: {
|
|
2854
2854
|
marginRight: 8,
|
|
2855
2855
|
width: "1.125em",
|
|
2856
2856
|
height: "1.125em",
|
|
2857
2857
|
verticalAlign: "middle",
|
|
2858
|
-
accentColor:
|
|
2858
|
+
accentColor: s ? "#10b981" : "#22c55e",
|
|
2859
2859
|
cursor: "pointer"
|
|
2860
2860
|
}
|
|
2861
2861
|
}
|
|
@@ -2870,41 +2870,41 @@ const ct = ({
|
|
|
2870
2870
|
),
|
|
2871
2871
|
w
|
|
2872
2872
|
);
|
|
2873
|
-
},
|
|
2873
|
+
}, mt = ({
|
|
2874
2874
|
field: e,
|
|
2875
2875
|
value: r,
|
|
2876
2876
|
onChange: n,
|
|
2877
2877
|
onError: o
|
|
2878
2878
|
}) => {
|
|
2879
|
-
const { t, definitionName: a } =
|
|
2880
|
-
(p) => isNaN(p) ? t("Must be a valid integer") : Number.isInteger(p) ?
|
|
2881
|
-
[a, e, t,
|
|
2882
|
-
),
|
|
2879
|
+
const { t, definitionName: a } = z(), s = F.useRef(null), i = e.min ?? void 0, u = e.max ?? void 0, m = Math.max(1, Math.round(e.step ?? 1)), l = Z(
|
|
2880
|
+
(p) => isNaN(p) ? t("Must be a valid integer") : Number.isInteger(p) ? i !== void 0 && p < i ? t("Must be �?{{1}}", i) : u !== void 0 && p > u ? t("Must be �?{{1}}", u) : Y(a, e, p, t) ?? null : t("Must be an integer"),
|
|
2881
|
+
[a, e, t, i, u]
|
|
2882
|
+
), f = k(null), c = k(
|
|
2883
2883
|
o
|
|
2884
2884
|
);
|
|
2885
2885
|
C(() => {
|
|
2886
2886
|
c.current = o;
|
|
2887
2887
|
}, [o]), C(() => {
|
|
2888
|
-
if (document.activeElement ===
|
|
2888
|
+
if (document.activeElement === s.current) return;
|
|
2889
2889
|
const y = String(r), x = l(r);
|
|
2890
|
-
|
|
2890
|
+
s.current && (s.current.value = y), x !== f.current && (f.current = x, c.current?.(x ?? null));
|
|
2891
2891
|
}, [r, l]);
|
|
2892
|
-
const
|
|
2892
|
+
const d = (p) => {
|
|
2893
2893
|
if (p.trim() === "") return e.required ? t("Value required") : null;
|
|
2894
2894
|
const x = Number(p);
|
|
2895
2895
|
return l(x);
|
|
2896
2896
|
}, b = (p) => {
|
|
2897
|
-
const y = p.target.value, x = p.target.valueAsNumber,
|
|
2898
|
-
n?.(x,
|
|
2897
|
+
const y = p.target.value, x = p.target.valueAsNumber, v = d(y);
|
|
2898
|
+
n?.(x, v);
|
|
2899
2899
|
};
|
|
2900
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error:
|
|
2900
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: d(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
2901
2901
|
"input",
|
|
2902
2902
|
{
|
|
2903
|
-
ref:
|
|
2903
|
+
ref: s,
|
|
2904
2904
|
id: e.name,
|
|
2905
2905
|
type: "number",
|
|
2906
2906
|
defaultValue: String(r ?? ""),
|
|
2907
|
-
min:
|
|
2907
|
+
min: i,
|
|
2908
2908
|
max: u,
|
|
2909
2909
|
step: m,
|
|
2910
2910
|
onChange: b,
|
|
@@ -2912,15 +2912,15 @@ const ct = ({
|
|
|
2912
2912
|
className: $.input
|
|
2913
2913
|
}
|
|
2914
2914
|
) });
|
|
2915
|
-
},
|
|
2915
|
+
}, ft = ({
|
|
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 } = z(), a = F.useRef(null), { definitionName: s } = z(), i = Z(
|
|
2922
|
+
(f) => {
|
|
2923
|
+
const c = String(f ?? "").trim();
|
|
2924
2924
|
if (c === "")
|
|
2925
2925
|
return e.required ? t("Value required") : null;
|
|
2926
2926
|
if (e.pattern)
|
|
@@ -2932,26 +2932,26 @@ const ct = ({
|
|
|
2932
2932
|
);
|
|
2933
2933
|
} catch {
|
|
2934
2934
|
}
|
|
2935
|
-
return Y(
|
|
2935
|
+
return Y(s, e, c, t);
|
|
2936
2936
|
},
|
|
2937
|
-
[
|
|
2937
|
+
[s, e, t]
|
|
2938
2938
|
), u = k(null), m = k(o);
|
|
2939
2939
|
C(() => {
|
|
2940
2940
|
m.current = o;
|
|
2941
2941
|
}, [o]), C(() => {
|
|
2942
|
-
const
|
|
2943
|
-
a.current && a.current.value !== String(
|
|
2944
|
-
}, [r,
|
|
2945
|
-
const l = (
|
|
2946
|
-
const c =
|
|
2942
|
+
const f = String(r ?? ""), c = i(f);
|
|
2943
|
+
a.current && a.current.value !== String(f) && (a.current.value = String(f)), c !== u.current && (u.current = c, m.current?.(c ?? null));
|
|
2944
|
+
}, [r, i]);
|
|
2945
|
+
const l = (f) => {
|
|
2946
|
+
const c = f.target.value, d = c.trim();
|
|
2947
2947
|
let b = null;
|
|
2948
|
-
if (
|
|
2948
|
+
if (d === "") {
|
|
2949
2949
|
b = e.required ? t("Value required") : null, n?.(c, b);
|
|
2950
2950
|
return;
|
|
2951
2951
|
}
|
|
2952
|
-
!b && e.pattern && !new RegExp(e.pattern).test(
|
|
2952
|
+
!b && e.pattern && !new RegExp(e.pattern).test(d) && (b = t("Phone number does not match pattern: {{1}}", `${e.pattern}`)), n?.(c, b);
|
|
2953
2953
|
};
|
|
2954
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error:
|
|
2954
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
2955
2955
|
"input",
|
|
2956
2956
|
{
|
|
2957
2957
|
type: "tel",
|
|
@@ -2961,45 +2961,45 @@ const ct = ({
|
|
|
2961
2961
|
className: X($.input, $.textInput)
|
|
2962
2962
|
}
|
|
2963
2963
|
) });
|
|
2964
|
-
},
|
|
2965
|
-
const { t, definitionName: a } =
|
|
2964
|
+
}, dt = ({ field: e, value: r, onChange: n, onError: o }) => {
|
|
2965
|
+
const { t, definitionName: a } = z(), 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
|
+
(f) => f === "" || f === null || f === void 0 ? t("Value required") : !e.options || e.options.length === 0 ? null : e.options.some((d) => d.value === f) ? Y(a, e, f, t) ?? null : t("Invalid option selected"),
|
|
2971
2971
|
[e, t, a]
|
|
2972
2972
|
);
|
|
2973
2973
|
C(() => {
|
|
2974
|
-
const
|
|
2975
|
-
if (u.current?.(c ?? null),
|
|
2976
|
-
const
|
|
2977
|
-
|
|
2974
|
+
const f = r != null ? String(r) : "", c = m(f);
|
|
2975
|
+
if (u.current?.(c ?? null), i.current) {
|
|
2976
|
+
const d = Array.from(
|
|
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
|
-
|
|
2981
|
+
d.forEach((p) => p.checked = p.value === b), n?.(b, null);
|
|
2982
2982
|
} else
|
|
2983
|
-
|
|
2983
|
+
d.forEach((b) => b.checked = b.value === f);
|
|
2984
2984
|
}
|
|
2985
2985
|
}, [r, m, n, e.options]);
|
|
2986
|
-
const l = (
|
|
2987
|
-
const c =
|
|
2988
|
-
u.current?.(
|
|
2986
|
+
const l = (f) => {
|
|
2987
|
+
const c = f.target.value, d = m(c);
|
|
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(
|
|
2991
2991
|
"div",
|
|
2992
2992
|
{
|
|
2993
2993
|
style: {
|
|
2994
2994
|
display: "flex",
|
|
2995
|
-
flexDirection:
|
|
2996
|
-
flexWrap:
|
|
2997
|
-
gap:
|
|
2998
|
-
alignItems:
|
|
2995
|
+
flexDirection: s,
|
|
2996
|
+
flexWrap: s === "row" ? "wrap" : "nowrap",
|
|
2997
|
+
gap: s === "row" ? "12px" : "4px",
|
|
2998
|
+
alignItems: s === "row" ? "center" : "flex-start",
|
|
2999
2999
|
width: "100%"
|
|
3000
3000
|
},
|
|
3001
|
-
ref:
|
|
3002
|
-
children: (e.options ?? []).map((
|
|
3001
|
+
ref: i,
|
|
3002
|
+
children: (e.options ?? []).map((f) => /* @__PURE__ */ g.jsxs(
|
|
3003
3003
|
"label",
|
|
3004
3004
|
{
|
|
3005
3005
|
style: {
|
|
@@ -3014,22 +3014,22 @@ const ct = ({
|
|
|
3014
3014
|
{
|
|
3015
3015
|
type: "radio",
|
|
3016
3016
|
name: e.name,
|
|
3017
|
-
value: String(
|
|
3018
|
-
defaultChecked: String(r ?? "") === String(
|
|
3017
|
+
value: String(f.value),
|
|
3018
|
+
defaultChecked: String(r ?? "") === String(f.value),
|
|
3019
3019
|
onChange: l
|
|
3020
3020
|
}
|
|
3021
3021
|
),
|
|
3022
|
-
t(
|
|
3022
|
+
t(f.label)
|
|
3023
3023
|
]
|
|
3024
3024
|
},
|
|
3025
|
-
String(
|
|
3025
|
+
String(f.value)
|
|
3026
3026
|
))
|
|
3027
3027
|
}
|
|
3028
3028
|
) });
|
|
3029
|
-
},
|
|
3029
|
+
}, pt = {
|
|
3030
3030
|
display: "flex",
|
|
3031
3031
|
gap: 4
|
|
3032
|
-
},
|
|
3032
|
+
}, gt = {
|
|
3033
3033
|
cursor: "pointer",
|
|
3034
3034
|
fontSize: "1.5rem",
|
|
3035
3035
|
lineHeight: 1,
|
|
@@ -3037,42 +3037,42 @@ const ct = ({
|
|
|
3037
3037
|
marginRight: "0.25rem",
|
|
3038
3038
|
userSelect: "none",
|
|
3039
3039
|
transition: "color 0.12s ease"
|
|
3040
|
-
},
|
|
3040
|
+
}, ht = ({
|
|
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 } = z(), [s, i] = V(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), f = k(o);
|
|
3050
3050
|
C(() => {
|
|
3051
|
-
|
|
3051
|
+
f.current = o;
|
|
3052
3052
|
}, [o]), C(() => {
|
|
3053
3053
|
let b = r || 0;
|
|
3054
3054
|
r < 0 && (b = 0), r > u && (b = u);
|
|
3055
3055
|
const p = m(b);
|
|
3056
|
-
p !== l.current && (l.current = p,
|
|
3056
|
+
p !== l.current && (l.current = p, f.current?.(p ?? null));
|
|
3057
3057
|
}, [r, m, u]);
|
|
3058
3058
|
const c = (b) => {
|
|
3059
3059
|
const p = m(b);
|
|
3060
3060
|
n?.(b, p);
|
|
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(
|
|
3065
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: m(d), children: /* @__PURE__ */ g.jsx("div", { style: pt, children: (() => {
|
|
3066
3066
|
const b = e.icon, p = b && String(b).trim() ? String(b) : "★";
|
|
3067
3067
|
return [...Array(u)].map((y, x) => {
|
|
3068
|
-
const
|
|
3068
|
+
const v = x < d, R = s !== null && x <= s || v ? "gold" : "lightgray";
|
|
3069
3069
|
return /* @__PURE__ */ g.jsx(
|
|
3070
3070
|
"span",
|
|
3071
3071
|
{
|
|
3072
3072
|
onClick: () => c(x + 1),
|
|
3073
|
-
onMouseEnter: () =>
|
|
3074
|
-
onMouseLeave: () =>
|
|
3075
|
-
style: { ...
|
|
3073
|
+
onMouseEnter: () => i(x),
|
|
3074
|
+
onMouseLeave: () => i(null),
|
|
3075
|
+
style: { ...gt, color: R },
|
|
3076
3076
|
"aria-label": `Rating ${x + 1}`,
|
|
3077
3077
|
title: t(`${e.displayName} ${x + 1}`),
|
|
3078
3078
|
children: p
|
|
@@ -3081,22 +3081,22 @@ const ct = ({
|
|
|
3081
3081
|
);
|
|
3082
3082
|
});
|
|
3083
3083
|
})() }) });
|
|
3084
|
-
},
|
|
3085
|
-
function
|
|
3086
|
-
return
|
|
3084
|
+
}, bt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
|
|
3085
|
+
function yt(e) {
|
|
3086
|
+
return bt.test(e);
|
|
3087
3087
|
}
|
|
3088
|
-
const
|
|
3088
|
+
const xt = ({
|
|
3089
3089
|
field: e,
|
|
3090
3090
|
value: r,
|
|
3091
3091
|
onChange: n,
|
|
3092
3092
|
onError: o
|
|
3093
3093
|
}) => {
|
|
3094
|
-
const { t, definitionName: a } =
|
|
3094
|
+
const { t, definitionName: a } = z(), s = k(null), i = k(null), u = F.useCallback(
|
|
3095
3095
|
(b) => {
|
|
3096
3096
|
let p = null;
|
|
3097
3097
|
if (b.trim() === "")
|
|
3098
3098
|
return t("Value required");
|
|
3099
|
-
if (!
|
|
3099
|
+
if (!yt(b))
|
|
3100
3100
|
return t("Invalid number");
|
|
3101
3101
|
const y = Number(b);
|
|
3102
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) : (p || (p = Y(a, e, y, t)), p);
|
|
@@ -3107,9 +3107,9 @@ const vt = ({
|
|
|
3107
3107
|
l.current = o;
|
|
3108
3108
|
}, [o]), C(() => {
|
|
3109
3109
|
const b = String(r), p = u(b);
|
|
3110
|
-
|
|
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), p !== m.current && (m.current = p, l.current?.(p ?? null));
|
|
3111
3111
|
}, [r, u, e.min]);
|
|
3112
|
-
const
|
|
3112
|
+
const f = e.min ?? 0, c = e.max ?? 100, d = (b) => {
|
|
3113
3113
|
const p = b.target.value, y = u(p);
|
|
3114
3114
|
n?.(p, y);
|
|
3115
3115
|
};
|
|
@@ -3117,11 +3117,11 @@ const vt = ({
|
|
|
3117
3117
|
/* @__PURE__ */ g.jsx(
|
|
3118
3118
|
"input",
|
|
3119
3119
|
{
|
|
3120
|
-
ref:
|
|
3120
|
+
ref: i,
|
|
3121
3121
|
type: "range",
|
|
3122
|
-
defaultValue: isNaN(Number(r)) ? String(
|
|
3123
|
-
onChange:
|
|
3124
|
-
min:
|
|
3122
|
+
defaultValue: isNaN(Number(r)) ? String(f) : String(Number(r)),
|
|
3123
|
+
onChange: d,
|
|
3124
|
+
min: f,
|
|
3125
3125
|
max: c,
|
|
3126
3126
|
style: {
|
|
3127
3127
|
padding: "0px, 0px",
|
|
@@ -3134,10 +3134,10 @@ const vt = ({
|
|
|
3134
3134
|
/* @__PURE__ */ g.jsx(
|
|
3135
3135
|
"input",
|
|
3136
3136
|
{
|
|
3137
|
-
ref:
|
|
3137
|
+
ref: s,
|
|
3138
3138
|
type: "text",
|
|
3139
3139
|
defaultValue: String(r ?? ""),
|
|
3140
|
-
onChange:
|
|
3140
|
+
onChange: d,
|
|
3141
3141
|
required: !0,
|
|
3142
3142
|
style: {
|
|
3143
3143
|
width: "40px",
|
|
@@ -3150,24 +3150,24 @@ const vt = ({
|
|
|
3150
3150
|
}
|
|
3151
3151
|
)
|
|
3152
3152
|
] }) });
|
|
3153
|
-
},
|
|
3153
|
+
}, vt = ({
|
|
3154
3154
|
field: e,
|
|
3155
3155
|
value: r,
|
|
3156
3156
|
onChange: n,
|
|
3157
3157
|
onError: o
|
|
3158
3158
|
}) => {
|
|
3159
|
-
const { t, formStyle: a, fieldStyle:
|
|
3159
|
+
const { t, formStyle: a, fieldStyle: s, definitionName: i } = z(), u = a, m = s, l = (w, j, N) => {
|
|
3160
3160
|
if (!j) return {};
|
|
3161
|
-
const
|
|
3162
|
-
return (
|
|
3163
|
-
},
|
|
3161
|
+
const S = w?.[j];
|
|
3162
|
+
return (N && S ? S[N] : void 0) ?? {};
|
|
3163
|
+
}, f = F.useMemo(() => ({
|
|
3164
3164
|
display: "inline-block",
|
|
3165
3165
|
position: "relative",
|
|
3166
3166
|
width: 44,
|
|
3167
3167
|
height: 24,
|
|
3168
3168
|
...l(u, "switch", "label"),
|
|
3169
3169
|
...l(m, void 0, "label")
|
|
3170
|
-
}), [u, m]), c =
|
|
3170
|
+
}), [u, m]), c = F.useMemo(() => ({
|
|
3171
3171
|
position: "absolute",
|
|
3172
3172
|
opacity: 0,
|
|
3173
3173
|
top: 0,
|
|
@@ -3180,7 +3180,7 @@ const vt = ({
|
|
|
3180
3180
|
// Make hidden input non-interactive to avoid event conflicts
|
|
3181
3181
|
...l(u, "switch", "hiddenInput"),
|
|
3182
3182
|
...l(m, void 0, "hiddenInput")
|
|
3183
|
-
}), [u, m]),
|
|
3183
|
+
}), [u, m]), d = F.useMemo(() => ({
|
|
3184
3184
|
position: "absolute",
|
|
3185
3185
|
cursor: "pointer",
|
|
3186
3186
|
top: 0,
|
|
@@ -3199,7 +3199,7 @@ const vt = ({
|
|
|
3199
3199
|
borderColor: "transparent",
|
|
3200
3200
|
...l(u, "switch", "slider"),
|
|
3201
3201
|
...l(m, void 0, "slider")
|
|
3202
|
-
}), [u, m]), b =
|
|
3202
|
+
}), [u, m]), b = F.useMemo(() => ({
|
|
3203
3203
|
position: "absolute",
|
|
3204
3204
|
height: 16,
|
|
3205
3205
|
width: 16,
|
|
@@ -3211,28 +3211,28 @@ const vt = ({
|
|
|
3211
3211
|
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.3)",
|
|
3212
3212
|
...l(u, "switch", "knob"),
|
|
3213
3213
|
...l(m, void 0, "knob")
|
|
3214
|
-
}), [u, m]), p = !!r, y =
|
|
3215
|
-
const w = !p, j =
|
|
3214
|
+
}), [u, m]), p = !!r, y = F.useRef(null), x = F.useRef(o), v = F.useCallback((w) => w ? Y(i, e, w, t) ?? null : e.required ? t("Value required") : null, [e, t, i]), A = () => {
|
|
3215
|
+
const w = !p, j = v(w);
|
|
3216
3216
|
n?.(w, j);
|
|
3217
3217
|
};
|
|
3218
|
-
|
|
3218
|
+
F.useEffect(() => {
|
|
3219
3219
|
x.current = o;
|
|
3220
|
-
}, [o]),
|
|
3221
|
-
const w =
|
|
3220
|
+
}, [o]), F.useEffect(() => {
|
|
3221
|
+
const w = v(p);
|
|
3222
3222
|
w !== y.current && (y.current = w, x.current?.(w ?? null));
|
|
3223
|
-
}, [p, e,
|
|
3224
|
-
const
|
|
3225
|
-
return /* @__PURE__ */ g.jsx(W, { field: e, error:
|
|
3223
|
+
}, [p, e, v]);
|
|
3224
|
+
const R = e.name;
|
|
3225
|
+
return /* @__PURE__ */ g.jsx(W, { field: e, error: v(p), rightAlign: !1, children: /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
|
|
3226
3226
|
/* @__PURE__ */ g.jsx(
|
|
3227
3227
|
"label",
|
|
3228
3228
|
{
|
|
3229
3229
|
className: $.label,
|
|
3230
|
-
htmlFor:
|
|
3230
|
+
htmlFor: R,
|
|
3231
3231
|
style: { textAlign: "left", justifyContent: "flex-start" },
|
|
3232
3232
|
children: t(e.displayName)
|
|
3233
3233
|
}
|
|
3234
3234
|
),
|
|
3235
|
-
/* @__PURE__ */ g.jsxs("label", { style:
|
|
3235
|
+
/* @__PURE__ */ g.jsxs("label", { style: f, children: [
|
|
3236
3236
|
/* @__PURE__ */ g.jsx(
|
|
3237
3237
|
"input",
|
|
3238
3238
|
{
|
|
@@ -3252,12 +3252,12 @@ const vt = ({
|
|
|
3252
3252
|
"data-testid": "switch",
|
|
3253
3253
|
tabIndex: 0,
|
|
3254
3254
|
"aria-checked": p,
|
|
3255
|
-
onClick:
|
|
3255
|
+
onClick: A,
|
|
3256
3256
|
onKeyDown: (w) => {
|
|
3257
|
-
(w.key === " " || w.key === "Spacebar" || w.key === "Space" || w.key === "Enter") && (w.preventDefault(),
|
|
3257
|
+
(w.key === " " || w.key === "Spacebar" || w.key === "Space" || w.key === "Enter") && (w.preventDefault(), A());
|
|
3258
3258
|
},
|
|
3259
3259
|
className: `reactaform-switch ${p ? "active checked on" : ""} `,
|
|
3260
|
-
style: p ? { ...
|
|
3260
|
+
style: p ? { ...d, backgroundColor: "var(--reactaform-switch-on-bg, #22c55e)", borderColor: "var(--reactaform-switch-on-border, #16a34a)" } : d,
|
|
3261
3261
|
children: /* @__PURE__ */ g.jsx(
|
|
3262
3262
|
"span",
|
|
3263
3263
|
{
|
|
@@ -3277,52 +3277,52 @@ const vt = ({
|
|
|
3277
3277
|
onChange: n,
|
|
3278
3278
|
onError: o
|
|
3279
3279
|
}) => {
|
|
3280
|
-
const { t, definitionName: a } =
|
|
3280
|
+
const { t, definitionName: a } = z(), s = F.useRef(null), i = F.useRef(null), u = F.useRef(
|
|
3281
3281
|
o
|
|
3282
3282
|
);
|
|
3283
|
-
|
|
3283
|
+
F.useEffect(() => {
|
|
3284
3284
|
u.current = o;
|
|
3285
3285
|
}, [o]);
|
|
3286
3286
|
const m = G(
|
|
3287
3287
|
() => e.pattern ? new RegExp(e.pattern) : null,
|
|
3288
3288
|
[e.pattern]
|
|
3289
|
-
), l =
|
|
3289
|
+
), l = F.useCallback(
|
|
3290
3290
|
(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
3291
|
[e, a, t, m]
|
|
3292
|
-
),
|
|
3293
|
-
const
|
|
3294
|
-
n?.(
|
|
3292
|
+
), f = (c) => {
|
|
3293
|
+
const d = c.target.value, b = l(d);
|
|
3294
|
+
n?.(d, b);
|
|
3295
3295
|
};
|
|
3296
3296
|
return C(() => {
|
|
3297
3297
|
const c = l(r);
|
|
3298
|
-
|
|
3298
|
+
s.current && s.current.value !== String(r ?? "") && (s.current.value = String(r ?? "")), c !== i.current && (i.current = c, u.current?.(c ?? null));
|
|
3299
3299
|
}, [r, l]), /* @__PURE__ */ g.jsx(W, { field: e, error: l(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
3300
3300
|
"input",
|
|
3301
3301
|
{
|
|
3302
3302
|
id: e.name,
|
|
3303
3303
|
type: "text",
|
|
3304
3304
|
defaultValue: String(r ?? ""),
|
|
3305
|
-
ref:
|
|
3306
|
-
onChange:
|
|
3305
|
+
ref: s,
|
|
3306
|
+
onChange: f,
|
|
3307
3307
|
className: X($.input, $.textInput)
|
|
3308
3308
|
}
|
|
3309
3309
|
) });
|
|
3310
|
-
},
|
|
3310
|
+
}, wt = ({
|
|
3311
3311
|
field: e,
|
|
3312
3312
|
value: r,
|
|
3313
3313
|
onChange: n,
|
|
3314
3314
|
onError: o
|
|
3315
3315
|
}) => {
|
|
3316
|
-
const { t, definitionName: a } =
|
|
3316
|
+
const { t, definitionName: a } = z(), s = k(null), i = k(o), u = e.includeSeconds ?? !0;
|
|
3317
3317
|
C(() => {
|
|
3318
|
-
|
|
3318
|
+
i.current = o;
|
|
3319
3319
|
}, [o]);
|
|
3320
|
-
const m =
|
|
3321
|
-
if (!
|
|
3320
|
+
const m = F.useCallback((f) => {
|
|
3321
|
+
if (!f || f.trim() === "")
|
|
3322
3322
|
return e.required || e.min || e.max ? t("Value required") : null;
|
|
3323
3323
|
const c = (p) => {
|
|
3324
|
-
const y = p.split(":").map((
|
|
3325
|
-
if (y.some((
|
|
3324
|
+
const y = p.split(":").map((v) => parseInt(v, 10));
|
|
3325
|
+
if (y.some((v) => Number.isNaN(v))) return NaN;
|
|
3326
3326
|
let x = 0;
|
|
3327
3327
|
if (y.length === 3)
|
|
3328
3328
|
x = y[0] * 3600 + y[1] * 60 + y[2];
|
|
@@ -3333,26 +3333,26 @@ const vt = ({
|
|
|
3333
3333
|
else
|
|
3334
3334
|
return NaN;
|
|
3335
3335
|
return x;
|
|
3336
|
-
},
|
|
3337
|
-
if (Number.isNaN(
|
|
3336
|
+
}, d = c(f);
|
|
3337
|
+
if (Number.isNaN(d)) return t("Invalid time format");
|
|
3338
3338
|
if (e.min && typeof e.min == "string") {
|
|
3339
3339
|
const p = c(e.min);
|
|
3340
|
-
if (!Number.isNaN(p) &&
|
|
3340
|
+
if (!Number.isNaN(p) && d < p)
|
|
3341
3341
|
return t("Time must be on or after {{1}}", e.min);
|
|
3342
3342
|
}
|
|
3343
3343
|
if (e.max && typeof e.max == "string") {
|
|
3344
3344
|
const p = c(e.max);
|
|
3345
|
-
if (!Number.isNaN(p) &&
|
|
3345
|
+
if (!Number.isNaN(p) && d > p)
|
|
3346
3346
|
return t("Time must be on or before {{1}}", e.max);
|
|
3347
3347
|
}
|
|
3348
|
-
return Y(a, e,
|
|
3349
|
-
}, [e, a, t]), l = (
|
|
3350
|
-
const c =
|
|
3351
|
-
n?.(c,
|
|
3348
|
+
return Y(a, e, f, t) ?? null;
|
|
3349
|
+
}, [e, a, t]), l = (f) => {
|
|
3350
|
+
const c = f.target.value, d = m(c);
|
|
3351
|
+
n?.(c, d);
|
|
3352
3352
|
};
|
|
3353
3353
|
return C(() => {
|
|
3354
|
-
const
|
|
3355
|
-
|
|
3354
|
+
const f = m(r);
|
|
3355
|
+
f !== s.current && (s.current = f, i.current?.(f ?? null));
|
|
3356
3356
|
}, [r, m]), /* @__PURE__ */ g.jsx(W, { field: e, error: m(r), children: /* @__PURE__ */ g.jsx(
|
|
3357
3357
|
"input",
|
|
3358
3358
|
{
|
|
@@ -3366,16 +3366,85 @@ const vt = ({
|
|
|
3366
3366
|
className: X($.input, $.textInput)
|
|
3367
3367
|
}
|
|
3368
3368
|
) });
|
|
3369
|
-
}
|
|
3369
|
+
};
|
|
3370
|
+
function St({
|
|
3371
|
+
pos: e,
|
|
3372
|
+
options: r,
|
|
3373
|
+
onClose: n,
|
|
3374
|
+
onClickOption: o
|
|
3375
|
+
}) {
|
|
3376
|
+
const t = k(null), a = k(!1), s = typeof window < "u" ? document.getElementById("popup-root") || document.body : null;
|
|
3377
|
+
if (C(() => {
|
|
3378
|
+
function d(b) {
|
|
3379
|
+
a.current || b.target.dataset?.popupMenu === "item" || t.current && b.target instanceof Node && !t.current.contains(b.target) && n();
|
|
3380
|
+
}
|
|
3381
|
+
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
3382
|
+
}, [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), f = Math.max(0, Math.min(i, l)), c = Math.max(0, u);
|
|
3384
|
+
return Oe.createPortal(
|
|
3385
|
+
/* @__PURE__ */ g.jsx(
|
|
3386
|
+
"div",
|
|
3387
|
+
{
|
|
3388
|
+
ref: t,
|
|
3389
|
+
onMouseDown: (d) => {
|
|
3390
|
+
d.stopPropagation();
|
|
3391
|
+
},
|
|
3392
|
+
style: {
|
|
3393
|
+
position: "fixed",
|
|
3394
|
+
top: c,
|
|
3395
|
+
left: f,
|
|
3396
|
+
backgroundColor: "var(--reactaform-primary-bg, #fff)",
|
|
3397
|
+
border: "1px solid var(--reactaform-border-color, #ccc)",
|
|
3398
|
+
borderRadius: "var(--reactaform-border-radius, 4px)",
|
|
3399
|
+
boxShadow: "var(--reactaform-shadow, 0 2px 10px rgba(0,0,0,0.2))",
|
|
3400
|
+
zIndex: 9999,
|
|
3401
|
+
minWidth: "var(--reactaform-menu-min-width, 150px)",
|
|
3402
|
+
pointerEvents: "auto"
|
|
3403
|
+
},
|
|
3404
|
+
children: r.map((d, b) => /* @__PURE__ */ g.jsx(
|
|
3405
|
+
"div",
|
|
3406
|
+
{
|
|
3407
|
+
"data-popup-menu": "item",
|
|
3408
|
+
onMouseDown: (p) => {
|
|
3409
|
+
p.stopPropagation(), a.current = !0;
|
|
3410
|
+
},
|
|
3411
|
+
onClick: (p) => {
|
|
3412
|
+
p.stopPropagation(), p.preventDefault(), o(d), n(), setTimeout(() => {
|
|
3413
|
+
a.current = !1;
|
|
3414
|
+
}, 100);
|
|
3415
|
+
},
|
|
3416
|
+
style: {
|
|
3417
|
+
padding: "var(--reactaform-menu-item-padding, 8px 12px)",
|
|
3418
|
+
cursor: "pointer",
|
|
3419
|
+
fontSize: "var(--reactaform-menu-item-font-size, 0.8em)",
|
|
3420
|
+
borderBottom: b < r.length - 1 ? "1px solid var(--reactaform-border-light, #eee)" : void 0,
|
|
3421
|
+
transition: "background-color 0.15s ease"
|
|
3422
|
+
},
|
|
3423
|
+
onMouseEnter: (p) => {
|
|
3424
|
+
p.currentTarget.style.backgroundColor = "var(--reactaform-hover-bg, #e0e0e0)";
|
|
3425
|
+
},
|
|
3426
|
+
onMouseLeave: (p) => {
|
|
3427
|
+
p.currentTarget.style.backgroundColor = "transparent";
|
|
3428
|
+
},
|
|
3429
|
+
children: d.label
|
|
3430
|
+
},
|
|
3431
|
+
d.label ?? b
|
|
3432
|
+
))
|
|
3433
|
+
}
|
|
3434
|
+
),
|
|
3435
|
+
s
|
|
3436
|
+
);
|
|
3437
|
+
}
|
|
3438
|
+
const he = {};
|
|
3370
3439
|
function Ct(e, r) {
|
|
3371
3440
|
if (e in he)
|
|
3372
3441
|
return;
|
|
3373
3442
|
const n = Le[e] ?? {}, o = {}, t = {}, a = {};
|
|
3374
|
-
for (const [
|
|
3375
|
-
typeof u.factor == "number" && (o[
|
|
3376
|
-
const
|
|
3443
|
+
for (const [i, u] of Object.entries(n))
|
|
3444
|
+
typeof u.factor == "number" && (o[i] = u.factor), t[i] = r(i), a[r(i)] = i;
|
|
3445
|
+
const s = Object.keys(n)[0] ?? "";
|
|
3377
3446
|
he[e] = {
|
|
3378
|
-
default:
|
|
3447
|
+
default: s,
|
|
3379
3448
|
factors: o,
|
|
3380
3449
|
labels: t,
|
|
3381
3450
|
reverseLabels: a
|
|
@@ -3398,13 +3467,13 @@ function kt(e, r, n) {
|
|
|
3398
3467
|
if (!Number.isFinite(e)) return [];
|
|
3399
3468
|
if (n === he.temperature)
|
|
3400
3469
|
return Object.keys(n.labels).map((a) => {
|
|
3401
|
-
const
|
|
3402
|
-
return Number.isFinite(
|
|
3470
|
+
const s = jt(r, a, e);
|
|
3471
|
+
return Number.isFinite(s) ? { label: `${s.toFixed(6)} ${a}`, value: s.toString(), unit: a } : { label: `${String(s)} ${a}`, value: String(s), unit: a };
|
|
3403
3472
|
});
|
|
3404
3473
|
const t = n.factors[r];
|
|
3405
|
-
return t === void 0 ? [] : Object.entries(n.factors).map(([a,
|
|
3406
|
-
const
|
|
3407
|
-
return Number.isFinite(
|
|
3474
|
+
return t === void 0 ? [] : Object.entries(n.factors).map(([a, s]) => {
|
|
3475
|
+
const i = e / t * s;
|
|
3476
|
+
return Number.isFinite(i) ? { label: `${i.toFixed(6)} ${a}`, value: i.toString(), unit: a } : { label: `${String(i)} ${a}`, value: String(i), unit: a };
|
|
3408
3477
|
});
|
|
3409
3478
|
}
|
|
3410
3479
|
function xe(e, r) {
|
|
@@ -3417,68 +3486,68 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3417
3486
|
onChange: o,
|
|
3418
3487
|
onError: t
|
|
3419
3488
|
}) => {
|
|
3420
|
-
const { t: a, definitionName:
|
|
3421
|
-
(P,
|
|
3489
|
+
const { t: a, definitionName: s } = z(), i = k(null), u = k(null), m = k(null), [l, f] = V(null), [c, d] = V(null), [b, p] = V(!1), [y, x] = V(null), [v, A] = V([]), R = Z(
|
|
3490
|
+
(P, M) => {
|
|
3422
3491
|
if (!P || P.trim() === "")
|
|
3423
3492
|
return r.required ? a("Value required") : null;
|
|
3424
3493
|
if (!Rt.test(P)) return a("Must be a valid number");
|
|
3425
|
-
const h = Y(
|
|
3494
|
+
const h = Y(s, r, [P, M], a);
|
|
3426
3495
|
return h || null;
|
|
3427
3496
|
},
|
|
3428
|
-
[
|
|
3497
|
+
[s, r, a]
|
|
3429
3498
|
), w = e.reverseLabels !== void 0 ? e.reverseLabels : Object.fromEntries(
|
|
3430
|
-
Object.entries(e.labels).map(([P,
|
|
3499
|
+
Object.entries(e.labels).map(([P, M]) => [M, P])
|
|
3431
3500
|
);
|
|
3432
3501
|
C(() => {
|
|
3433
3502
|
const P = String(n[0]);
|
|
3434
|
-
let
|
|
3435
|
-
|
|
3503
|
+
let M = n[1] ?? e.default;
|
|
3504
|
+
M = xe(M, e) || M;
|
|
3436
3505
|
const h = document.activeElement;
|
|
3437
|
-
h ===
|
|
3438
|
-
m.current = null,
|
|
3506
|
+
h === i.current || h === u.current || (i.current && (i.current.value = P), u.current && (u.current.value = M), m.current !== null && (cancelAnimationFrame(m.current), m.current = null), m.current = requestAnimationFrame(() => {
|
|
3507
|
+
m.current = null, f(null), d(null);
|
|
3439
3508
|
}));
|
|
3440
3509
|
}, [n, e]), C(() => () => {
|
|
3441
3510
|
m.current !== null && (cancelAnimationFrame(m.current), m.current = null);
|
|
3442
3511
|
}, []);
|
|
3443
|
-
const j = k(null),
|
|
3512
|
+
const j = k(null), N = k(
|
|
3444
3513
|
t
|
|
3445
3514
|
);
|
|
3446
3515
|
C(() => {
|
|
3447
|
-
|
|
3516
|
+
N.current = t;
|
|
3448
3517
|
}, [t]), C(() => {
|
|
3449
3518
|
const P = String(n[0]);
|
|
3450
|
-
let
|
|
3451
|
-
|
|
3452
|
-
const h =
|
|
3453
|
-
h !== j.current && (j.current = h,
|
|
3454
|
-
}, [n, e,
|
|
3455
|
-
const
|
|
3456
|
-
const
|
|
3457
|
-
o?.([P,
|
|
3458
|
-
},
|
|
3459
|
-
const
|
|
3460
|
-
|
|
3461
|
-
},
|
|
3462
|
-
const
|
|
3463
|
-
|
|
3464
|
-
},
|
|
3465
|
-
const
|
|
3466
|
-
if (
|
|
3519
|
+
let M = n[1] ?? e.default;
|
|
3520
|
+
M = xe(M, e) || M;
|
|
3521
|
+
const h = R(P, M);
|
|
3522
|
+
h !== j.current && (j.current = h, N.current?.(h ?? null));
|
|
3523
|
+
}, [n, e, R]);
|
|
3524
|
+
const S = (P, M, h) => {
|
|
3525
|
+
const E = w[M] || M;
|
|
3526
|
+
o?.([P, E], h);
|
|
3527
|
+
}, I = (P) => {
|
|
3528
|
+
const M = P.target.value, h = u.current ? u.current.value : e.default, E = R(M, h);
|
|
3529
|
+
f(M), S(M, h, E);
|
|
3530
|
+
}, O = (P) => {
|
|
3531
|
+
const M = P.target.value, h = i.current ? i.current.value : String(n[0] ?? ""), E = R(h, M);
|
|
3532
|
+
d(M), u.current && (u.current.value = M), S(h, M, E);
|
|
3533
|
+
}, T = (P) => {
|
|
3534
|
+
const M = i.current ? i.current.value : String(n[0] ?? ""), h = parseFloat(M), E = u.current ? u.current.value : e.default;
|
|
3535
|
+
if (R(M, E) || !M.trim() || !Number.isFinite(h))
|
|
3467
3536
|
return;
|
|
3468
3537
|
const U = P.currentTarget.getBoundingClientRect(), ne = U.left, ae = U.bottom;
|
|
3469
3538
|
x({ x: ne, y: ae });
|
|
3470
|
-
const _ = kt(h,
|
|
3539
|
+
const _ = kt(h, E, e);
|
|
3471
3540
|
if (_.length === 0) {
|
|
3472
|
-
|
|
3541
|
+
A([]), p(!1);
|
|
3473
3542
|
return;
|
|
3474
3543
|
}
|
|
3475
|
-
|
|
3544
|
+
A(_), p((D) => !D);
|
|
3476
3545
|
}, L = (P) => {
|
|
3477
|
-
const { value:
|
|
3478
|
-
p(!1), x(null),
|
|
3479
|
-
const
|
|
3480
|
-
|
|
3481
|
-
}, J = String(n[0] ?? ""), ce = xe(n[1] ?? e.default, e) || (n[1] ?? e.default), re = l ?? J, Q = !!
|
|
3546
|
+
const { value: M, unit: h } = P;
|
|
3547
|
+
p(!1), x(null), i.current && (i.current.value = M), u.current && (u.current.value = h), f(M), d(h);
|
|
3548
|
+
const E = R(M, h);
|
|
3549
|
+
S(M, h, E);
|
|
3550
|
+
}, 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 = {
|
|
3482
3551
|
width: "var(--reactaform-unit-btn-width, 2.5em)",
|
|
3483
3552
|
height: "var(--reactaform-unit-btn-height, 2.5em)",
|
|
3484
3553
|
padding: "var(--reactaform-unit-btn-padding, 0)",
|
|
@@ -3492,14 +3561,14 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3492
3561
|
alignItems: "center",
|
|
3493
3562
|
justifyContent: "center"
|
|
3494
3563
|
};
|
|
3495
|
-
return /* @__PURE__ */ g.jsx(W, { field: r, error:
|
|
3564
|
+
return /* @__PURE__ */ g.jsx(W, { field: r, error: R(J, ce), children: /* @__PURE__ */ g.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "var(--reactaform-unit-gap, 8px)", width: "100%" }, children: [
|
|
3496
3565
|
/* @__PURE__ */ g.jsx(
|
|
3497
3566
|
"input",
|
|
3498
3567
|
{
|
|
3499
3568
|
type: "text",
|
|
3500
|
-
ref:
|
|
3569
|
+
ref: i,
|
|
3501
3570
|
defaultValue: String(n[0] ?? ""),
|
|
3502
|
-
onChange:
|
|
3571
|
+
onChange: I,
|
|
3503
3572
|
style: { width: "var(--reactaform-unit-input-width, 100px)" },
|
|
3504
3573
|
className: X($.input, $.textInput)
|
|
3505
3574
|
}
|
|
@@ -3509,7 +3578,7 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3509
3578
|
{
|
|
3510
3579
|
ref: u,
|
|
3511
3580
|
defaultValue: xe(n[1] ?? e.default, e) || (n[1] ?? e.default),
|
|
3512
|
-
onChange:
|
|
3581
|
+
onChange: O,
|
|
3513
3582
|
className: X(
|
|
3514
3583
|
$.input,
|
|
3515
3584
|
$.inputSelect
|
|
@@ -3521,7 +3590,7 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3521
3590
|
/* @__PURE__ */ g.jsx(
|
|
3522
3591
|
"button",
|
|
3523
3592
|
{
|
|
3524
|
-
onClick:
|
|
3593
|
+
onClick: T,
|
|
3525
3594
|
"aria-disabled": Q,
|
|
3526
3595
|
disabled: Q,
|
|
3527
3596
|
style: oe,
|
|
@@ -3540,11 +3609,11 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3540
3609
|
)
|
|
3541
3610
|
}
|
|
3542
3611
|
),
|
|
3543
|
-
b &&
|
|
3544
|
-
|
|
3612
|
+
b && v && /* @__PURE__ */ g.jsx(
|
|
3613
|
+
St,
|
|
3545
3614
|
{
|
|
3546
3615
|
pos: y,
|
|
3547
|
-
options:
|
|
3616
|
+
options: v,
|
|
3548
3617
|
onClose: () => {
|
|
3549
3618
|
x(null), p(!1);
|
|
3550
3619
|
},
|
|
@@ -3555,7 +3624,7 @@ const Rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, Et = ({
|
|
|
3555
3624
|
] }) });
|
|
3556
3625
|
};
|
|
3557
3626
|
function Nt({ field: e, value: r, onChange: n }) {
|
|
3558
|
-
const { t: o } =
|
|
3627
|
+
const { t: o } = z(), t = e.dimension;
|
|
3559
3628
|
if (!t) return null;
|
|
3560
3629
|
he[t] || Ct(t, o);
|
|
3561
3630
|
const a = he[t];
|
|
@@ -3581,35 +3650,35 @@ const It = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
|
|
|
3581
3650
|
onChange: n,
|
|
3582
3651
|
onError: o
|
|
3583
3652
|
}) => {
|
|
3584
|
-
const { t, definitionName: a } =
|
|
3585
|
-
(
|
|
3586
|
-
const c =
|
|
3653
|
+
const { t, definitionName: a } = z(), s = k(null), i = Z(
|
|
3654
|
+
(f) => {
|
|
3655
|
+
const c = f.trim();
|
|
3587
3656
|
return c === "" ? e.required ? t("Value required") : null : !It.test(c) && !At(c) ? t("Must be a valid URL") : Y(a, e, c, t) ?? null;
|
|
3588
3657
|
},
|
|
3589
3658
|
[a, e, t]
|
|
3590
|
-
), u = (
|
|
3591
|
-
const c =
|
|
3592
|
-
n?.(c.trim(),
|
|
3659
|
+
), u = (f) => {
|
|
3660
|
+
const c = f.target.value, d = i(c);
|
|
3661
|
+
n?.(c.trim(), d);
|
|
3593
3662
|
}, m = k(null), l = k(o);
|
|
3594
3663
|
return C(() => {
|
|
3595
3664
|
l.current = o;
|
|
3596
3665
|
}, [o]), C(() => {
|
|
3597
|
-
const
|
|
3598
|
-
|
|
3599
|
-
}, [r,
|
|
3666
|
+
const f = r ?? "", c = i(f);
|
|
3667
|
+
s.current && s.current.value !== String(f) && (s.current.value = String(f)), c !== m.current && (m.current = c, l.current?.(c ?? null));
|
|
3668
|
+
}, [r, i]), /* @__PURE__ */ g.jsx(W, { field: e, error: i(String(r ?? "")), children: /* @__PURE__ */ g.jsx(
|
|
3600
3669
|
"input",
|
|
3601
3670
|
{
|
|
3602
3671
|
id: e.name,
|
|
3603
3672
|
type: "url",
|
|
3604
3673
|
defaultValue: String(r ?? ""),
|
|
3605
|
-
ref:
|
|
3674
|
+
ref: s,
|
|
3606
3675
|
onChange: u,
|
|
3607
3676
|
style: { alignItems: "left" },
|
|
3608
3677
|
className: X($.input, $.textInput),
|
|
3609
3678
|
placeholder: "https://example.com"
|
|
3610
3679
|
}
|
|
3611
3680
|
) });
|
|
3612
|
-
}, Fe = new we(),
|
|
3681
|
+
}, Fe = new we(), Ot = /* @__PURE__ */ new Set([
|
|
3613
3682
|
"checkbox",
|
|
3614
3683
|
"switch",
|
|
3615
3684
|
"dropdown",
|
|
@@ -3619,46 +3688,46 @@ const It = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
|
|
|
3619
3688
|
"stepper",
|
|
3620
3689
|
"color",
|
|
3621
3690
|
"rating"
|
|
3622
|
-
]),
|
|
3623
|
-
checkbox:
|
|
3624
|
-
color:
|
|
3625
|
-
date:
|
|
3626
|
-
dropdown:
|
|
3627
|
-
email:
|
|
3628
|
-
file:
|
|
3629
|
-
float:
|
|
3630
|
-
"float-array":
|
|
3631
|
-
image:
|
|
3632
|
-
int:
|
|
3633
|
-
"int-array":
|
|
3634
|
-
"multi-selection":
|
|
3635
|
-
multiline:
|
|
3636
|
-
phone:
|
|
3637
|
-
radio:
|
|
3638
|
-
rating:
|
|
3639
|
-
separator:
|
|
3640
|
-
slider:
|
|
3691
|
+
]), ir = {
|
|
3692
|
+
checkbox: Lr,
|
|
3693
|
+
color: _r,
|
|
3694
|
+
date: Br,
|
|
3695
|
+
dropdown: Hr,
|
|
3696
|
+
email: Wr,
|
|
3697
|
+
file: Jr,
|
|
3698
|
+
float: rt,
|
|
3699
|
+
"float-array": Zr,
|
|
3700
|
+
image: nt,
|
|
3701
|
+
int: it,
|
|
3702
|
+
"int-array": at,
|
|
3703
|
+
"multi-selection": lt,
|
|
3704
|
+
multiline: ct,
|
|
3705
|
+
phone: ft,
|
|
3706
|
+
radio: dt,
|
|
3707
|
+
rating: ht,
|
|
3708
|
+
separator: Yr,
|
|
3709
|
+
slider: xt,
|
|
3641
3710
|
string: Ke,
|
|
3642
|
-
stepper:
|
|
3643
|
-
switch:
|
|
3711
|
+
stepper: mt,
|
|
3712
|
+
switch: vt,
|
|
3644
3713
|
text: Ke,
|
|
3645
|
-
time:
|
|
3714
|
+
time: wt,
|
|
3646
3715
|
unit: Nt,
|
|
3647
3716
|
url: Ft
|
|
3648
3717
|
};
|
|
3649
|
-
function
|
|
3650
|
-
if (!n && e in
|
|
3718
|
+
function cr(e, r, n) {
|
|
3719
|
+
if (!n && e in ir) {
|
|
3651
3720
|
console.warn(
|
|
3652
3721
|
`Can't Overwrite Base Component type "${e}".`
|
|
3653
3722
|
);
|
|
3654
3723
|
return;
|
|
3655
3724
|
}
|
|
3656
|
-
if (
|
|
3725
|
+
if (Ot.has(e)) {
|
|
3657
3726
|
Fe.register(e, r);
|
|
3658
3727
|
return;
|
|
3659
3728
|
}
|
|
3660
3729
|
const o = (t) => {
|
|
3661
|
-
const { callback:
|
|
3730
|
+
const { callback: s, cancel: i } = Sr(
|
|
3662
3731
|
(...u) => {
|
|
3663
3732
|
const m = t.onChange;
|
|
3664
3733
|
typeof m == "function" && m(...u);
|
|
@@ -3666,29 +3735,29 @@ function lr(e, r, n) {
|
|
|
3666
3735
|
200
|
|
3667
3736
|
);
|
|
3668
3737
|
return C(() => () => {
|
|
3669
|
-
|
|
3670
|
-
}, [
|
|
3738
|
+
i();
|
|
3739
|
+
}, [i]), F.createElement(r, { ...t, onChange: s });
|
|
3671
3740
|
};
|
|
3672
3741
|
Fe.register(e, o);
|
|
3673
3742
|
}
|
|
3674
3743
|
function on(e, r) {
|
|
3675
|
-
|
|
3744
|
+
cr(e, r, !1);
|
|
3676
3745
|
}
|
|
3677
|
-
function
|
|
3746
|
+
function Mt(e) {
|
|
3678
3747
|
return Fe.get(e);
|
|
3679
3748
|
}
|
|
3680
3749
|
let Xe = !1;
|
|
3681
|
-
function
|
|
3682
|
-
Xe || (Object.entries(
|
|
3683
|
-
|
|
3750
|
+
function lr() {
|
|
3751
|
+
Xe || (Object.entries(ir).forEach(([e, r]) => {
|
|
3752
|
+
cr(e, r, !0);
|
|
3684
3753
|
}), Xe = !0);
|
|
3685
3754
|
}
|
|
3686
|
-
const
|
|
3755
|
+
const ur = new we();
|
|
3687
3756
|
function $t(e, r) {
|
|
3688
|
-
|
|
3757
|
+
ur.register(e, r);
|
|
3689
3758
|
}
|
|
3690
|
-
function
|
|
3691
|
-
return
|
|
3759
|
+
function Dt(e) {
|
|
3760
|
+
return ur.get(e);
|
|
3692
3761
|
}
|
|
3693
3762
|
$t(
|
|
3694
3763
|
"Preset_AlertSubmitHandler",
|
|
@@ -3702,12 +3771,12 @@ $t(
|
|
|
3702
3771
|
alert(t);
|
|
3703
3772
|
}
|
|
3704
3773
|
);
|
|
3705
|
-
const
|
|
3706
|
-
const t =
|
|
3707
|
-
(
|
|
3774
|
+
const mr = F.memo(({ field: e, value: r, handleChange: n, handleError: o }) => {
|
|
3775
|
+
const t = Mt(e.type), a = F.useCallback(
|
|
3776
|
+
(i, u) => n(e.name, i, u),
|
|
3708
3777
|
[n, e.name]
|
|
3709
|
-
),
|
|
3710
|
-
(
|
|
3778
|
+
), s = F.useCallback(
|
|
3779
|
+
(i) => o?.(e.name, i),
|
|
3711
3780
|
[o, e.name]
|
|
3712
3781
|
);
|
|
3713
3782
|
return t ? /* @__PURE__ */ g.jsx(
|
|
@@ -3716,13 +3785,13 @@ const fr = A.memo(({ field: e, value: r, handleChange: n, handleError: o }) => {
|
|
|
3716
3785
|
field: e,
|
|
3717
3786
|
value: r,
|
|
3718
3787
|
onChange: a,
|
|
3719
|
-
onError:
|
|
3788
|
+
onError: s
|
|
3720
3789
|
}
|
|
3721
3790
|
) : null;
|
|
3722
3791
|
}, (e, r) => e.field === r.field && e.value === r.value && e.handleChange === r.handleChange && e.handleError === r.handleError);
|
|
3723
|
-
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3792
|
+
mr.displayName = "FieldWrapper";
|
|
3793
|
+
const fr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
3794
|
+
mr,
|
|
3726
3795
|
{
|
|
3727
3796
|
field: e,
|
|
3728
3797
|
value: r[e.name],
|
|
@@ -3730,8 +3799,8 @@ const dr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
|
3730
3799
|
handleError: o
|
|
3731
3800
|
},
|
|
3732
3801
|
e.name
|
|
3733
|
-
),
|
|
3734
|
-
const u =
|
|
3802
|
+
), dr = F.memo(({ groupName: e, isOpen: r, fields: n, valuesMap: o, handleChange: t, handleError: a, toggleGroup: s, t: i }) => {
|
|
3803
|
+
const u = F.useCallback(() => s(e), [s, e]), { formStyle: m, fieldStyle: l } = z(), f = F.useMemo(() => ({
|
|
3735
3804
|
border: "1px solid var(--reactaform-border-color, #bbb)",
|
|
3736
3805
|
padding: "var(--reactaform-fieldset-padding, 0.5em)",
|
|
3737
3806
|
borderRadius: "var(--reactaform-border-radius, 4px)",
|
|
@@ -3739,7 +3808,7 @@ const dr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
|
3739
3808
|
// allow per-form overrides if provider exposes them
|
|
3740
3809
|
...m?.fieldset || {},
|
|
3741
3810
|
...l?.fieldset || {}
|
|
3742
|
-
}), [m, l]), c =
|
|
3811
|
+
}), [m, l]), c = F.useMemo(() => ({
|
|
3743
3812
|
fontWeight: "bold",
|
|
3744
3813
|
cursor: "pointer",
|
|
3745
3814
|
display: "flex",
|
|
@@ -3750,40 +3819,40 @@ const dr = (e, r, n, o) => /* @__PURE__ */ g.jsx(
|
|
|
3750
3819
|
...m?.legend || {},
|
|
3751
3820
|
...l?.legend || {}
|
|
3752
3821
|
}), [m, l]);
|
|
3753
|
-
return /* @__PURE__ */ g.jsxs("fieldset", { style:
|
|
3822
|
+
return /* @__PURE__ */ g.jsxs("fieldset", { style: f, children: [
|
|
3754
3823
|
/* @__PURE__ */ g.jsxs("legend", { onClick: u, style: c, children: [
|
|
3755
|
-
/* @__PURE__ */ g.jsx("span", { children:
|
|
3824
|
+
/* @__PURE__ */ g.jsx("span", { children: i(e) }),
|
|
3756
3825
|
/* @__PURE__ */ g.jsx("span", { children: r ? "▼" : "▶" })
|
|
3757
3826
|
] }),
|
|
3758
|
-
r && n.map((
|
|
3827
|
+
r && n.map((d) => /* @__PURE__ */ g.jsx("div", { children: fr(d, o, t, a) }, d.name))
|
|
3759
3828
|
] });
|
|
3760
3829
|
});
|
|
3761
|
-
|
|
3762
|
-
const
|
|
3763
|
-
const m = r.slice(0,
|
|
3764
|
-
return
|
|
3765
|
-
if (
|
|
3766
|
-
const b = e[
|
|
3830
|
+
dr.displayName = "FieldGroup";
|
|
3831
|
+
const Vt = (e, r, n, o, t, a, s, i, u) => {
|
|
3832
|
+
const m = r.slice(0, i).filter((d) => s[d.name]), f = Or(m).groups, c = [];
|
|
3833
|
+
return f.forEach((d) => {
|
|
3834
|
+
if (d.name) {
|
|
3835
|
+
const b = e[d.name] ?? !0;
|
|
3767
3836
|
c.push(
|
|
3768
3837
|
/* @__PURE__ */ g.jsx(
|
|
3769
|
-
|
|
3838
|
+
dr,
|
|
3770
3839
|
{
|
|
3771
|
-
groupName:
|
|
3840
|
+
groupName: d.name,
|
|
3772
3841
|
isOpen: b,
|
|
3773
|
-
fields:
|
|
3842
|
+
fields: d.fields,
|
|
3774
3843
|
valuesMap: n,
|
|
3775
3844
|
handleChange: t,
|
|
3776
3845
|
handleError: a,
|
|
3777
3846
|
toggleGroup: u,
|
|
3778
3847
|
t: o
|
|
3779
3848
|
},
|
|
3780
|
-
|
|
3849
|
+
d.name
|
|
3781
3850
|
)
|
|
3782
3851
|
);
|
|
3783
3852
|
} else
|
|
3784
|
-
|
|
3853
|
+
d.fields.forEach((b) => c.push(/* @__PURE__ */ g.jsx("div", { children: fr(b, n, t, a) }, b.name)));
|
|
3785
3854
|
}), c;
|
|
3786
|
-
},
|
|
3855
|
+
}, Tt = (e) => {
|
|
3787
3856
|
const r = {};
|
|
3788
3857
|
return e.forEach((n) => {
|
|
3789
3858
|
r[n.name] = !1;
|
|
@@ -3791,27 +3860,27 @@ const Tt = (e, r, n, o, t, a, i, s, u) => {
|
|
|
3791
3860
|
}, Pe = (e, r, n, o) => {
|
|
3792
3861
|
const t = r[e];
|
|
3793
3862
|
if (!t?.children) return;
|
|
3794
|
-
const a = n[e],
|
|
3795
|
-
(t.children[
|
|
3863
|
+
const a = n[e], s = a != null ? String(a) : "";
|
|
3864
|
+
(t.children[s] || []).forEach((u) => {
|
|
3796
3865
|
o[u] = !0, Pe(u, r, n, o);
|
|
3797
3866
|
});
|
|
3798
|
-
},
|
|
3867
|
+
}, pr = (e, r, n) => {
|
|
3799
3868
|
const o = r[e];
|
|
3800
3869
|
o?.children && Object.values(o.children).flat().forEach((t) => {
|
|
3801
|
-
n[t] = !1,
|
|
3870
|
+
n[t] = !1, pr(t, r, n);
|
|
3802
3871
|
});
|
|
3803
|
-
},
|
|
3872
|
+
}, zt = (e, r, n, o) => {
|
|
3804
3873
|
const t = { ...n };
|
|
3805
3874
|
return e.forEach((a) => {
|
|
3806
3875
|
(!a.parents || Object.keys(a.parents).length === 0) && (t[a.name] = !0, Pe(a.name, o, r, t));
|
|
3807
3876
|
}), t;
|
|
3808
3877
|
}, Lt = (e, r, n, o, t) => {
|
|
3809
3878
|
const a = { ...e };
|
|
3810
|
-
if (
|
|
3811
|
-
const
|
|
3812
|
-
if (
|
|
3813
|
-
const
|
|
3814
|
-
(
|
|
3879
|
+
if (pr(o, r, a), t != null) {
|
|
3880
|
+
const s = r[o];
|
|
3881
|
+
if (s?.children) {
|
|
3882
|
+
const i = String(t);
|
|
3883
|
+
(s.children[i] || []).forEach((m) => {
|
|
3815
3884
|
a[m] = !0, Pe(m, r, n, a);
|
|
3816
3885
|
});
|
|
3817
3886
|
}
|
|
@@ -3826,34 +3895,34 @@ function Pt(e, r, n, o, t) {
|
|
|
3826
3895
|
message: o("Please fix validation errors before submitting."),
|
|
3827
3896
|
errors: a
|
|
3828
3897
|
};
|
|
3829
|
-
const
|
|
3898
|
+
const s = { ...n }, i = [];
|
|
3830
3899
|
if (e && Array.isArray(e.properties))
|
|
3831
3900
|
for (const m of e.properties) {
|
|
3832
|
-
const l = m.name,
|
|
3833
|
-
if (
|
|
3901
|
+
const l = m.name, f = s[l];
|
|
3902
|
+
if (f == null) continue;
|
|
3834
3903
|
const c = m.type;
|
|
3835
3904
|
try {
|
|
3836
|
-
if ((c === "int" || c === "number" || c === "float") && typeof
|
|
3837
|
-
const
|
|
3838
|
-
isNaN(
|
|
3839
|
-
} else if ((c === "int-array" || c === "float-array") && typeof
|
|
3840
|
-
const b = String(
|
|
3905
|
+
if ((c === "int" || c === "number" || c === "float") && typeof f == "string") {
|
|
3906
|
+
const d = Number(String(f).trim());
|
|
3907
|
+
isNaN(d) ? i.push(o(`Invalid number format for field ${m.displayName || l}`)) : s[l] = d;
|
|
3908
|
+
} else if ((c === "int-array" || c === "float-array") && typeof f == "string") {
|
|
3909
|
+
const b = String(f).split(",").map((p) => p.trim()).filter(Boolean).map((p) => {
|
|
3841
3910
|
const y = Number(p);
|
|
3842
|
-
return isNaN(y) ? (
|
|
3911
|
+
return isNaN(y) ? (i.push(o(`Invalid number "${p}" in array for field ${m.displayName || l}`)), 0) : y;
|
|
3843
3912
|
});
|
|
3844
|
-
|
|
3913
|
+
i.length === 0 && (s[l] = b);
|
|
3845
3914
|
}
|
|
3846
|
-
} catch (
|
|
3847
|
-
|
|
3915
|
+
} catch (d) {
|
|
3916
|
+
i.push(o(`Error processing field ${m.displayName || l}: ${d}`));
|
|
3848
3917
|
}
|
|
3849
3918
|
}
|
|
3850
|
-
if (
|
|
3919
|
+
if (i.length > 0)
|
|
3851
3920
|
return {
|
|
3852
3921
|
success: !1,
|
|
3853
3922
|
message: o("Data transformation errors occurred."),
|
|
3854
|
-
errors:
|
|
3923
|
+
errors: i
|
|
3855
3924
|
};
|
|
3856
|
-
const u =
|
|
3925
|
+
const u = Rr(e, s, o);
|
|
3857
3926
|
if (u && u.length > 0)
|
|
3858
3927
|
return {
|
|
3859
3928
|
success: !1,
|
|
@@ -3861,10 +3930,10 @@ function Pt(e, r, n, o, t) {
|
|
|
3861
3930
|
errors: u
|
|
3862
3931
|
};
|
|
3863
3932
|
if (e && typeof e.submitHandlerName == "string") {
|
|
3864
|
-
const m =
|
|
3933
|
+
const m = Dt(e.submitHandlerName);
|
|
3865
3934
|
if (m)
|
|
3866
3935
|
try {
|
|
3867
|
-
const l = m(e, r?.name ?? null,
|
|
3936
|
+
const l = m(e, r?.name ?? null, s, o);
|
|
3868
3937
|
if (l && l.length > 0)
|
|
3869
3938
|
return {
|
|
3870
3939
|
success: !1,
|
|
@@ -3882,7 +3951,7 @@ function Pt(e, r, n, o, t) {
|
|
|
3882
3951
|
return {
|
|
3883
3952
|
success: !0,
|
|
3884
3953
|
message: o("Form submitted successfully."),
|
|
3885
|
-
data:
|
|
3954
|
+
data: s
|
|
3886
3955
|
};
|
|
3887
3956
|
}
|
|
3888
3957
|
const _t = ({
|
|
@@ -3891,14 +3960,14 @@ const _t = ({
|
|
|
3891
3960
|
chunkSize: n = 50,
|
|
3892
3961
|
chunkDelay: o = 50
|
|
3893
3962
|
}) => {
|
|
3894
|
-
const { properties: t, displayName: a } = e,
|
|
3895
|
-
...
|
|
3896
|
-
definitionName: e?.name ??
|
|
3897
|
-
}, [
|
|
3963
|
+
const { properties: t, displayName: a } = e, s = z(), { t: i, formStyle: u, language: m } = s, l = {
|
|
3964
|
+
...s,
|
|
3965
|
+
definitionName: e?.name ?? s.definitionName
|
|
3966
|
+
}, [f, c] = V("en"), [d, b] = V([]), [p, y] = V({}), [x, v] = V(
|
|
3898
3967
|
{}
|
|
3899
|
-
), [
|
|
3968
|
+
), [A, R] = V({}), [w, j] = V({}), [N, S] = V({}), [I, O] = V(null), [T, L] = V(null), [J, ce] = V(0), [re, ue] = V(!1), [Q, oe] = V(!1), [P, M] = V(r.name || ""), h = k(r), E = k(!1);
|
|
3900
3969
|
C(() => {
|
|
3901
|
-
const
|
|
3970
|
+
const D = Object.fromEntries(
|
|
3902
3971
|
t.map((H) => [
|
|
3903
3972
|
H.name,
|
|
3904
3973
|
{ ...H, children: {} }
|
|
@@ -3906,19 +3975,19 @@ const _t = ({
|
|
|
3906
3975
|
);
|
|
3907
3976
|
t.forEach((H) => {
|
|
3908
3977
|
H.parents && Object.entries(H.parents).forEach(([me, Se]) => {
|
|
3909
|
-
const fe =
|
|
3910
|
-
fe && Se.forEach((
|
|
3978
|
+
const fe = D[me];
|
|
3979
|
+
fe && Se.forEach((gr) => {
|
|
3911
3980
|
fe.children || (fe.children = {});
|
|
3912
|
-
const _e = String(
|
|
3981
|
+
const _e = String(gr);
|
|
3913
3982
|
fe.children[_e] = [
|
|
3914
3983
|
...fe.children[_e] || [],
|
|
3915
3984
|
H.name
|
|
3916
3985
|
];
|
|
3917
3986
|
});
|
|
3918
3987
|
});
|
|
3919
|
-
}),
|
|
3988
|
+
}), Fr(t, D);
|
|
3920
3989
|
const q = Object.values(
|
|
3921
|
-
|
|
3990
|
+
D
|
|
3922
3991
|
), K = {};
|
|
3923
3992
|
q.forEach((H) => {
|
|
3924
3993
|
if (H.type === "unit") {
|
|
@@ -3927,84 +3996,84 @@ const _t = ({
|
|
|
3927
3996
|
} else
|
|
3928
3997
|
K[H.name] = H.defaultValue;
|
|
3929
3998
|
}), h.current = r, Object.keys(r.values).forEach((H) => {
|
|
3930
|
-
|
|
3999
|
+
D[H] !== void 0 && (K[H] = r.values[H]);
|
|
3931
4000
|
});
|
|
3932
|
-
const ee =
|
|
4001
|
+
const ee = Tt(q), te = {};
|
|
3933
4002
|
q.forEach((H) => {
|
|
3934
4003
|
H.group && !(H.group in te) && (te[H.group] = !0);
|
|
3935
4004
|
});
|
|
3936
4005
|
const le = requestAnimationFrame(() => {
|
|
3937
|
-
b(q), y(
|
|
3938
|
-
|
|
3939
|
-
), j(te), ue(!0),
|
|
4006
|
+
b(q), y(D), v(K), R(
|
|
4007
|
+
zt(q, K, ee, D)
|
|
4008
|
+
), j(te), ue(!0), M(r.name);
|
|
3940
4009
|
});
|
|
3941
4010
|
return () => cancelAnimationFrame(le);
|
|
3942
4011
|
}, [t, r, e]), C(() => {
|
|
3943
|
-
if (!re || J >=
|
|
3944
|
-
const
|
|
4012
|
+
if (!re || J >= d.length) return;
|
|
4013
|
+
const D = setTimeout(() => {
|
|
3945
4014
|
ce(
|
|
3946
|
-
(q) => Math.min(q + n,
|
|
4015
|
+
(q) => Math.min(q + n, d.length)
|
|
3947
4016
|
);
|
|
3948
4017
|
}, o);
|
|
3949
|
-
return () => clearTimeout(
|
|
3950
|
-
}, [re, J,
|
|
4018
|
+
return () => clearTimeout(D);
|
|
4019
|
+
}, [re, J, d.length, n, o]);
|
|
3951
4020
|
const B = Z(
|
|
3952
|
-
(
|
|
3953
|
-
|
|
3954
|
-
const te = { ...ee, [
|
|
4021
|
+
(D, q, K) => {
|
|
4022
|
+
O(null), L(null), v((ee) => {
|
|
4023
|
+
const te = { ...ee, [D]: q }, le = p[D];
|
|
3955
4024
|
return le && [
|
|
3956
4025
|
"checkbox",
|
|
3957
4026
|
"dropdown",
|
|
3958
4027
|
"multi-select",
|
|
3959
4028
|
"radio",
|
|
3960
4029
|
"switch"
|
|
3961
|
-
].includes(le.type) &&
|
|
4030
|
+
].includes(le.type) && R(
|
|
3962
4031
|
(me) => Lt(
|
|
3963
4032
|
me,
|
|
3964
4033
|
p,
|
|
3965
4034
|
te,
|
|
3966
|
-
|
|
4035
|
+
D,
|
|
3967
4036
|
String(q)
|
|
3968
4037
|
)
|
|
3969
4038
|
), te;
|
|
3970
|
-
}),
|
|
4039
|
+
}), S((ee) => K ? { ...ee, [D]: K } : Object.fromEntries(Object.entries(ee).filter(([le]) => le !== D)));
|
|
3971
4040
|
},
|
|
3972
|
-
[p,
|
|
4041
|
+
[p, O, L]
|
|
3973
4042
|
);
|
|
3974
4043
|
C(() => {
|
|
3975
|
-
let
|
|
3976
|
-
return
|
|
3977
|
-
m !==
|
|
3978
|
-
}), () => cancelAnimationFrame(
|
|
3979
|
-
}, [m,
|
|
3980
|
-
let
|
|
3981
|
-
return
|
|
3982
|
-
if (
|
|
3983
|
-
|
|
4044
|
+
let D = 0;
|
|
4045
|
+
return D = requestAnimationFrame(() => {
|
|
4046
|
+
m !== f && (c(m || "en"), O(null), L(null));
|
|
4047
|
+
}), () => cancelAnimationFrame(D);
|
|
4048
|
+
}, [m, f]), C(() => {
|
|
4049
|
+
let D = 0;
|
|
4050
|
+
return D = requestAnimationFrame(() => {
|
|
4051
|
+
if (E.current) {
|
|
4052
|
+
E.current = !1, h.current = r, M(r.name || "");
|
|
3984
4053
|
return;
|
|
3985
4054
|
}
|
|
3986
|
-
h.current = r,
|
|
3987
|
-
}), () => cancelAnimationFrame(
|
|
4055
|
+
h.current = r, O(null), L(null), M(r.name || "");
|
|
4056
|
+
}), () => cancelAnimationFrame(D);
|
|
3988
4057
|
}, [r, r.name]);
|
|
3989
|
-
const U = Z((
|
|
3990
|
-
|
|
4058
|
+
const U = Z((D, q) => {
|
|
4059
|
+
S((K) => q ? { ...K, [D]: String(q) } : Object.fromEntries(Object.entries(K).filter(([te]) => te !== D)));
|
|
3991
4060
|
}, []), ne = () => {
|
|
3992
|
-
|
|
3993
|
-
const
|
|
4061
|
+
E.current = !0;
|
|
4062
|
+
const D = h.current?.name;
|
|
3994
4063
|
h.current.name = P;
|
|
3995
|
-
const q = Pt(e, h.current, x,
|
|
4064
|
+
const q = Pt(e, h.current, x, i, N), K = typeof q.message == "string" ? q.message : String(q.message), ee = Object.values(q.errors ?? {}).join(`
|
|
3996
4065
|
`);
|
|
3997
|
-
|
|
3998
|
-
` + ee : K), L(q.success), q.success || (h.current.name =
|
|
3999
|
-
}, ae = (
|
|
4000
|
-
j((q) => ({ ...q, [
|
|
4066
|
+
O(ee ? K + `
|
|
4067
|
+
` + ee : K), L(q.success), q.success || (h.current.name = D ?? h.current.name, M(D ?? ""));
|
|
4068
|
+
}, ae = (D) => {
|
|
4069
|
+
j((q) => ({ ...q, [D]: !q[D] }));
|
|
4001
4070
|
}, _ = G(
|
|
4002
|
-
() => Object.values(
|
|
4003
|
-
[
|
|
4071
|
+
() => Object.values(N).some(Boolean),
|
|
4072
|
+
[N]
|
|
4004
4073
|
);
|
|
4005
|
-
return /* @__PURE__ */ g.jsx(
|
|
4006
|
-
a && /* @__PURE__ */ g.jsx("h2", { style: u.titleStyle, children:
|
|
4007
|
-
|
|
4074
|
+
return /* @__PURE__ */ g.jsx(Me.Provider, { value: l, children: /* @__PURE__ */ g.jsxs("div", { style: u.container, children: [
|
|
4075
|
+
a && /* @__PURE__ */ g.jsx("h2", { style: u.titleStyle, children: i(a) }),
|
|
4076
|
+
I && /* @__PURE__ */ g.jsxs(
|
|
4008
4077
|
"div",
|
|
4009
4078
|
{
|
|
4010
4079
|
role: "status",
|
|
@@ -4012,22 +4081,22 @@ const _t = ({
|
|
|
4012
4081
|
marginBottom: 12,
|
|
4013
4082
|
padding: 12,
|
|
4014
4083
|
borderRadius: 6,
|
|
4015
|
-
backgroundColor:
|
|
4016
|
-
border: `1px solid ${
|
|
4017
|
-
color:
|
|
4084
|
+
backgroundColor: T ? "rgba(76, 175, 80, 0.12)" : "rgba(225, 29, 72, 0.06)",
|
|
4085
|
+
border: `1px solid ${T ? "rgba(76,175,80,0.3)" : "rgba(225,29,72,0.12)"}`,
|
|
4086
|
+
color: T ? "var(--reactaform-success-color, #4CAF50)" : "var(--reactaform-error-color, #e11d48)",
|
|
4018
4087
|
display: "flex",
|
|
4019
4088
|
alignItems: "center",
|
|
4020
4089
|
justifyContent: "space-between"
|
|
4021
4090
|
},
|
|
4022
4091
|
children: [
|
|
4023
|
-
/* @__PURE__ */ g.jsx("div", { style: { whiteSpace: "pre-wrap", flex: 1 }, children:
|
|
4092
|
+
/* @__PURE__ */ g.jsx("div", { style: { whiteSpace: "pre-wrap", flex: 1 }, children: I }),
|
|
4024
4093
|
/* @__PURE__ */ g.jsx(
|
|
4025
4094
|
"button",
|
|
4026
4095
|
{
|
|
4027
4096
|
onClick: () => {
|
|
4028
|
-
|
|
4097
|
+
O(null), L(null);
|
|
4029
4098
|
},
|
|
4030
|
-
"aria-label":
|
|
4099
|
+
"aria-label": i("Dismiss"),
|
|
4031
4100
|
style: {
|
|
4032
4101
|
marginLeft: 12,
|
|
4033
4102
|
background: "transparent",
|
|
@@ -4047,24 +4116,24 @@ const _t = ({
|
|
|
4047
4116
|
er,
|
|
4048
4117
|
{
|
|
4049
4118
|
name: P,
|
|
4050
|
-
onChange: (
|
|
4051
|
-
|
|
4119
|
+
onChange: (D) => {
|
|
4120
|
+
M(D), O(null), L(null);
|
|
4052
4121
|
}
|
|
4053
4122
|
}
|
|
4054
4123
|
),
|
|
4055
4124
|
/* @__PURE__ */ g.jsxs(g.Fragment, { children: [
|
|
4056
|
-
|
|
4125
|
+
Vt(
|
|
4057
4126
|
w,
|
|
4058
|
-
|
|
4127
|
+
d,
|
|
4059
4128
|
x,
|
|
4060
|
-
|
|
4129
|
+
i,
|
|
4061
4130
|
B,
|
|
4062
4131
|
U,
|
|
4063
|
-
|
|
4132
|
+
A,
|
|
4064
4133
|
J,
|
|
4065
4134
|
ae
|
|
4066
4135
|
),
|
|
4067
|
-
J <
|
|
4136
|
+
J < d.length && /* @__PURE__ */ g.jsx(
|
|
4068
4137
|
"div",
|
|
4069
4138
|
{
|
|
4070
4139
|
style: {
|
|
@@ -4095,12 +4164,12 @@ const _t = ({
|
|
|
4095
4164
|
transition: "opacity 0.2s ease",
|
|
4096
4165
|
opacity: _ ? "var(--reactaform-button-disabled-opacity, 0.6)" : Q ? "var(--reactaform-button-hover-opacity, 0.9)" : "1"
|
|
4097
4166
|
},
|
|
4098
|
-
children:
|
|
4167
|
+
children: i("Submit")
|
|
4099
4168
|
}
|
|
4100
4169
|
)
|
|
4101
4170
|
] }) });
|
|
4102
4171
|
};
|
|
4103
|
-
|
|
4172
|
+
lr();
|
|
4104
4173
|
const qt = (e, r = !1) => ({
|
|
4105
4174
|
container: {
|
|
4106
4175
|
padding: "var(--reactaform-space-sm, 8px)",
|
|
@@ -4208,56 +4277,56 @@ const qt = (e, r = !1) => ({
|
|
|
4208
4277
|
defaultLanguage: o = "en",
|
|
4209
4278
|
defaultDarkMode: t = !1,
|
|
4210
4279
|
defaultLocalizeName: a = "",
|
|
4211
|
-
className:
|
|
4280
|
+
className: s = "reactaform-container"
|
|
4212
4281
|
}) => {
|
|
4213
|
-
const
|
|
4282
|
+
const i = r, u = a, m = t, l = o, f = G(
|
|
4214
4283
|
() => n ?? {},
|
|
4215
4284
|
[n]
|
|
4216
|
-
), [c,
|
|
4285
|
+
), [c, d] = V({}), [b, p] = V({}), [y, x] = V({}), [v, A] = V({});
|
|
4217
4286
|
C(() => {
|
|
4218
|
-
let
|
|
4287
|
+
let S = !0;
|
|
4219
4288
|
return (async () => {
|
|
4220
4289
|
if (l === "en") {
|
|
4221
|
-
|
|
4290
|
+
S && (d({}), p({}));
|
|
4222
4291
|
return;
|
|
4223
4292
|
}
|
|
4224
4293
|
try {
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4227
|
-
const L = await
|
|
4228
|
-
|
|
4294
|
+
const O = await $r(l), T = O.success ? O.translations : {};
|
|
4295
|
+
S && d(T);
|
|
4296
|
+
const L = await Dr(l, u), J = L.success ? L.translations : {};
|
|
4297
|
+
S && p(J);
|
|
4229
4298
|
} catch {
|
|
4230
|
-
|
|
4299
|
+
S && (d({}), p({}));
|
|
4231
4300
|
}
|
|
4232
4301
|
})(), () => {
|
|
4233
|
-
|
|
4302
|
+
S = !1;
|
|
4234
4303
|
};
|
|
4235
4304
|
}, [l, u]), C(() => {
|
|
4236
|
-
|
|
4237
|
-
}, [
|
|
4238
|
-
const
|
|
4239
|
-
() =>
|
|
4305
|
+
A(qt(f, m)), x(Bt(f, m));
|
|
4306
|
+
}, [f, m]);
|
|
4307
|
+
const R = G(
|
|
4308
|
+
() => Tr(l, c, b),
|
|
4240
4309
|
[l, c, b]
|
|
4241
4310
|
), w = Z(
|
|
4242
|
-
(
|
|
4243
|
-
[
|
|
4311
|
+
(S, ...I) => R(S, ...I),
|
|
4312
|
+
[R]
|
|
4244
4313
|
), j = G(
|
|
4245
4314
|
() => ({
|
|
4246
|
-
definitionName:
|
|
4315
|
+
definitionName: i,
|
|
4247
4316
|
language: l,
|
|
4248
4317
|
darkMode: m,
|
|
4249
|
-
formStyle:
|
|
4318
|
+
formStyle: v,
|
|
4250
4319
|
fieldStyle: y,
|
|
4251
4320
|
t: w
|
|
4252
4321
|
}),
|
|
4253
|
-
[
|
|
4254
|
-
),
|
|
4255
|
-
return /* @__PURE__ */ g.jsx(
|
|
4322
|
+
[i, l, m, y, v, w]
|
|
4323
|
+
), N = f?.height ? { height: "100%" } : void 0;
|
|
4324
|
+
return /* @__PURE__ */ g.jsx(Me.Provider, { value: j, children: /* @__PURE__ */ g.jsx(
|
|
4256
4325
|
"div",
|
|
4257
4326
|
{
|
|
4258
4327
|
"data-reactaform-theme": m ? "dark" : "light",
|
|
4259
|
-
className:
|
|
4260
|
-
style:
|
|
4328
|
+
className: s,
|
|
4329
|
+
style: N,
|
|
4261
4330
|
children: e
|
|
4262
4331
|
}
|
|
4263
4332
|
) });
|
|
@@ -4351,9 +4420,9 @@ function sn(e) {
|
|
|
4351
4420
|
};
|
|
4352
4421
|
}
|
|
4353
4422
|
}
|
|
4354
|
-
|
|
4423
|
+
lr();
|
|
4355
4424
|
function Yt(e) {
|
|
4356
|
-
const [r, n] =
|
|
4425
|
+
const [r, n] = V(null);
|
|
4357
4426
|
return C(() => {
|
|
4358
4427
|
const o = document.querySelector("[data-reactaform-theme]");
|
|
4359
4428
|
if (!o) return;
|
|
@@ -4361,11 +4430,11 @@ function Yt(e) {
|
|
|
4361
4430
|
if (!t) return;
|
|
4362
4431
|
const a = () => n(t.getAttribute("data-reactaform-theme"));
|
|
4363
4432
|
a();
|
|
4364
|
-
const
|
|
4365
|
-
for (const u of
|
|
4433
|
+
const s = new MutationObserver((i) => {
|
|
4434
|
+
for (const u of i)
|
|
4366
4435
|
u.type === "attributes" && u.attributeName === "data-reactaform-theme" && a();
|
|
4367
4436
|
});
|
|
4368
|
-
return
|
|
4437
|
+
return s.observe(t, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => s.disconnect();
|
|
4369
4438
|
}, [e]), r;
|
|
4370
4439
|
}
|
|
4371
4440
|
const cn = ({
|
|
@@ -4376,39 +4445,39 @@ const cn = ({
|
|
|
4376
4445
|
darkMode: t,
|
|
4377
4446
|
style: a
|
|
4378
4447
|
}) => {
|
|
4379
|
-
const
|
|
4448
|
+
const s = G(() => {
|
|
4380
4449
|
try {
|
|
4381
4450
|
return typeof e == "string" ? JSON.parse(e) : e ?? null;
|
|
4382
4451
|
} catch {
|
|
4383
4452
|
return null;
|
|
4384
4453
|
}
|
|
4385
|
-
}, [e]),
|
|
4454
|
+
}, [e]), i = { fontSize: "inherit", fontFamily: "inherit", ...a }, u = Yt(), m = t ?? u === "dark", l = n ?? "en";
|
|
4386
4455
|
if (C(() => {
|
|
4387
4456
|
let c = document.getElementById("popup-root");
|
|
4388
4457
|
c || (c = document.createElement("div"), c.id = "popup-root", document.body.appendChild(c));
|
|
4389
|
-
}, []), !
|
|
4458
|
+
}, []), !s)
|
|
4390
4459
|
return /* @__PURE__ */ g.jsx("div", { style: { color: "red" }, children: "Error: No form definition provided." });
|
|
4391
|
-
let
|
|
4392
|
-
if (!
|
|
4393
|
-
const c = Wt(
|
|
4460
|
+
let f = r;
|
|
4461
|
+
if (!f) {
|
|
4462
|
+
const c = Wt(s, s.name);
|
|
4394
4463
|
if (!c.success || !c.instance)
|
|
4395
4464
|
return /* @__PURE__ */ g.jsx("div", { style: { color: "red" }, children: "Error: Failed to create instance from definition." });
|
|
4396
|
-
|
|
4465
|
+
f = c.instance;
|
|
4397
4466
|
}
|
|
4398
4467
|
return /* @__PURE__ */ g.jsx(
|
|
4399
4468
|
Ht,
|
|
4400
4469
|
{
|
|
4401
|
-
definitionName:
|
|
4402
|
-
defaultStyle:
|
|
4470
|
+
definitionName: s.name,
|
|
4471
|
+
defaultStyle: i,
|
|
4403
4472
|
defaultLanguage: l,
|
|
4404
4473
|
defaultDarkMode: m,
|
|
4405
|
-
defaultLocalizeName:
|
|
4474
|
+
defaultLocalizeName: s.localization || "",
|
|
4406
4475
|
className: o,
|
|
4407
4476
|
children: /* @__PURE__ */ g.jsx(
|
|
4408
4477
|
_t,
|
|
4409
4478
|
{
|
|
4410
|
-
definition:
|
|
4411
|
-
instance:
|
|
4479
|
+
definition: s,
|
|
4480
|
+
instance: f
|
|
4412
4481
|
}
|
|
4413
4482
|
)
|
|
4414
4483
|
}
|
|
@@ -4418,7 +4487,7 @@ function Jt() {
|
|
|
4418
4487
|
if (!(typeof document > "u") && !document.getElementById("reactaform-styles"))
|
|
4419
4488
|
try {
|
|
4420
4489
|
const e = document.createElement("style");
|
|
4421
|
-
e.id = "reactaform-styles", e.textContent =
|
|
4490
|
+
e.id = "reactaform-styles", e.textContent = yr, document.head.appendChild(e);
|
|
4422
4491
|
} catch {
|
|
4423
4492
|
}
|
|
4424
4493
|
}
|
|
@@ -4434,7 +4503,7 @@ export {
|
|
|
4434
4503
|
Wt as createInstanceFromDefinition,
|
|
4435
4504
|
tn as deserializeDefinition,
|
|
4436
4505
|
en as deserializeInstance,
|
|
4437
|
-
|
|
4506
|
+
Mt as getComponent,
|
|
4438
4507
|
sn as loadInstance,
|
|
4439
4508
|
an as loadJsonDefinition,
|
|
4440
4509
|
on as registerComponent,
|
|
@@ -4443,8 +4512,8 @@ export {
|
|
|
4443
4512
|
$t as registerSubmissionHandler,
|
|
4444
4513
|
rn as serializeDefinition,
|
|
4445
4514
|
Qt as serializeInstance,
|
|
4446
|
-
|
|
4447
|
-
|
|
4515
|
+
Sr as useDebouncedCallback,
|
|
4516
|
+
z as useReactaFormContext,
|
|
4448
4517
|
Y as validateFieldValue,
|
|
4449
|
-
|
|
4518
|
+
Rr as validateFormValues
|
|
4450
4519
|
};
|