reactaform 1.4.0 → 1.4.2

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.
@@ -1,4 +1,4 @@
1
- import { jsx as y, jsxs as O, Fragment as Ye } from "react/jsx-runtime";
1
+ import { jsx as h, jsxs as O, Fragment as Ye } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
3
  import { createContext as xr, useContext as wr, useRef as ue, useEffect as He, useCallback as ye } from "react";
4
4
  import * as Ie from "react-dom";
@@ -367,7 +367,7 @@ function Cr(e, r = 300, t) {
367
367
  [r, t?.leading]
368
368
  ), cancel: c, flush: s };
369
369
  }
370
- const M = {
370
+ const N = {
371
371
  field: "reactaform-field",
372
372
  label: "reactaform-label",
373
373
  input: "reactaform-input",
@@ -384,7 +384,7 @@ const M = {
384
384
  }));
385
385
  return r.join(" ");
386
386
  }, Xe = ({ content: e, size: r = "medium", animation: t = !0 }) => {
387
- const { t: o, darkMode: n, formStyle: a, fieldStyle: l } = F(), [c, s] = i.useState(!1), [m, u] = i.useState({ x: 0, y: 0 }), [d, f] = i.useState(!1), g = i.useRef(null), h = i.useRef(null), p = i.useRef(null), b = i.useId(), C = i.useMemo(() => {
387
+ const { t: o, darkMode: n, formStyle: a, fieldStyle: l } = F(), [c, s] = i.useState(!1), [m, u] = i.useState({ x: 0, y: 0 }), [d, f] = i.useState(!1), g = i.useRef(null), b = i.useRef(null), p = i.useRef(null), y = i.useId(), S = i.useMemo(() => {
388
388
  const w = {
389
389
  icon: {
390
390
  display: "inline-flex",
@@ -429,8 +429,8 @@ const M = {
429
429
  opacity: 1,
430
430
  pointerEvents: "auto"
431
431
  }
432
- }, x = ($, S, E) => {
433
- const z = $?.[S];
432
+ }, x = (V, R, E) => {
433
+ const z = V?.[R];
434
434
  return (E && z ? z[E] : void 0) ?? {};
435
435
  };
436
436
  return {
@@ -440,33 +440,28 @@ const M = {
440
440
  };
441
441
  }, [n, r, t, a, l]);
442
442
  i.useLayoutEffect(() => {
443
- if (!c || !g.current || !h.current) return;
444
- const N = g.current.getBoundingClientRect(), w = h.current.getBoundingClientRect(), x = 8, R = window.innerWidth, $ = window.innerHeight;
445
- let S = N.right + x, E = N.top + N.height / 2 - w.height / 2;
446
- S + w.width > R - x && (S = N.left - x - w.width), S = Math.max(x, Math.min(S, R - w.width - x)), E = Math.max(x, Math.min(E, $ - w.height - x)), u({ x: S, y: E }), f(!0);
447
- }, [c]), i.useEffect(() => {
448
- if (!d) return;
449
- const N = requestAnimationFrame(() => {
450
- if (!h.current) return;
451
- const w = h.current.getBoundingClientRect(), x = 8, R = typeof window < "u" ? window.innerWidth : 1024, $ = typeof window < "u" ? window.innerHeight : 768;
452
- let S = m.x, E = m.y;
453
- const I = p.current;
454
- I && (S = I.right + x, E = I.top + I.height / 2 - w.height / 2 + -4, S + w.width > R - x && (S = I.left - x - w.width)), S + w.width > R - x && (S = Math.max(x, R - w.width - x)), S < x && (S = x), E + w.height > $ - x && (E = Math.max(x, $ - w.height - x)), E < x && (E = x), (S !== m.x || E !== m.y) && u({ x: S, y: E });
455
- });
456
- return () => cancelAnimationFrame(N);
457
- }, [d, m.x, m.y]);
458
- const v = typeof document < "u" ? document.getElementById("popup-root") : null, k = /* @__PURE__ */ y(
443
+ if (!c || !g.current || !b.current) {
444
+ f(!1);
445
+ return;
446
+ }
447
+ const I = g.current.getBoundingClientRect();
448
+ p.current = I;
449
+ const w = b.current.getBoundingClientRect(), x = 8, k = window.innerWidth, V = window.innerHeight, R = -4;
450
+ let E = I.right + x, M = I.top + I.height / 2 - w.height / 2 + R;
451
+ E + w.width > k - x && (E = I.left - x - w.width), E = Math.max(x, Math.min(E, k - w.width - x)), M = Math.max(x, Math.min(M, V - w.height - x)), u({ x: E, y: M }), f(!0);
452
+ }, [c]);
453
+ const v = typeof document < "u" ? document.getElementById("popup-root") : null, C = /* @__PURE__ */ h(
459
454
  "div",
460
455
  {
461
- ref: h,
462
- "data-tooltip-id": b,
456
+ ref: b,
457
+ "data-tooltip-id": y,
463
458
  style: {
464
- ...C.text,
459
+ ...S.text,
465
460
  transform: d ? "translateY(0) scale(1)" : "translateY(-4px) scale(0.98)",
466
461
  transition: "opacity 120ms ease, transform 120ms ease, visibility 120ms ease",
467
462
  width: 240,
468
463
  // When positioned is true, apply the visible styles
469
- ...d ? C.textVisible : {},
464
+ ...d ? S.textVisible : {},
470
465
  top: m.y,
471
466
  left: m.x
472
467
  },
@@ -475,21 +470,21 @@ const M = {
475
470
  }
476
471
  );
477
472
  return /* @__PURE__ */ O(Ye, { children: [
478
- /* @__PURE__ */ y(
473
+ /* @__PURE__ */ h(
479
474
  "span",
480
475
  {
481
476
  "data-testid": "tooltip-icon",
482
477
  ref: g,
483
- "aria-describedby": c ? b : void 0,
478
+ "aria-describedby": c ? y : void 0,
484
479
  onMouseEnter: () => s(!0),
485
480
  onMouseLeave: () => s(!1),
486
481
  style: {
487
- ...C.icon
482
+ ...S.icon
488
483
  },
489
484
  children: "?"
490
485
  }
491
486
  ),
492
- c && (v ? Ie.createPortal(k, v) : k)
487
+ c && (v ? Ie.createPortal(C, v) : C)
493
488
  ] });
494
489
  }, Se = i.memo(({
495
490
  field: e,
@@ -501,7 +496,7 @@ const M = {
501
496
  return /* @__PURE__ */ O(
502
497
  "div",
503
498
  {
504
- className: `${M.field} column-layout`,
499
+ className: `${N.field} column-layout`,
505
500
  style: {
506
501
  display: "flex",
507
502
  flexDirection: "column",
@@ -509,11 +504,11 @@ const M = {
509
504
  "--label-align": a
510
505
  },
511
506
  children: [
512
- o && /* @__PURE__ */ y("div", { style: { textAlign: a, width: "100%" }, children: /* @__PURE__ */ y(
507
+ o && /* @__PURE__ */ h("div", { style: { textAlign: a, width: "100%" }, children: /* @__PURE__ */ h(
513
508
  "label",
514
509
  {
515
510
  id: `${e.name}-label`,
516
- className: M.label,
511
+ className: N.label,
517
512
  htmlFor: e.name,
518
513
  style: {
519
514
  textAlign: a,
@@ -535,12 +530,12 @@ const M = {
535
530
  width: "100%"
536
531
  },
537
532
  children: [
538
- /* @__PURE__ */ y("div", { style: { flex: 1, minWidth: 0, maxWidth: "100%" }, children: /* @__PURE__ */ y("div", { style: { width: "100%" }, children: t }) }),
539
- e.tooltip && /* @__PURE__ */ y(Xe, { content: e.tooltip })
533
+ /* @__PURE__ */ h("div", { style: { flex: 1, minWidth: 0, maxWidth: "100%" }, children: /* @__PURE__ */ h("div", { style: { width: "100%" }, children: t }) }),
534
+ e.tooltip && /* @__PURE__ */ h(Xe, { content: e.tooltip })
540
535
  ]
541
536
  }
542
537
  ),
543
- r && /* @__PURE__ */ y($e, { id: `${e.name}-error`, children: r })
538
+ r && /* @__PURE__ */ h($e, { id: `${e.name}-error`, children: r })
544
539
  ]
545
540
  }
546
541
  );
@@ -562,12 +557,12 @@ const Ze = i.memo(({
562
557
  alignItems: "center",
563
558
  gap: "3px"
564
559
  }), []);
565
- return /* @__PURE__ */ O("div", { className: `${M.field} row-layout`, children: [
566
- /* @__PURE__ */ y(
560
+ return /* @__PURE__ */ O("div", { className: `${N.field} row-layout`, children: [
561
+ /* @__PURE__ */ h(
567
562
  "label",
568
563
  {
569
564
  id: `${e.name}-label`,
570
- className: M.label,
565
+ className: N.label,
571
566
  htmlFor: e.name,
572
567
  style: { textAlign: "left", justifyContent: "flex-start" },
573
568
  children: n(e.displayName)
@@ -575,7 +570,7 @@ const Ze = i.memo(({
575
570
  ),
576
571
  /* @__PURE__ */ O("div", { style: a, children: [
577
572
  /* @__PURE__ */ O("div", { style: l, children: [
578
- o ? /* @__PURE__ */ y(
573
+ o ? /* @__PURE__ */ h(
579
574
  "div",
580
575
  {
581
576
  style: {
@@ -588,9 +583,9 @@ const Ze = i.memo(({
588
583
  children: t
589
584
  }
590
585
  ) : t,
591
- e.tooltip && /* @__PURE__ */ y(Xe, { content: e.tooltip })
586
+ e.tooltip && /* @__PURE__ */ h(Xe, { content: e.tooltip })
592
587
  ] }),
593
- r && /* @__PURE__ */ y($e, { id: `${e.name}-error`, children: r })
588
+ r && /* @__PURE__ */ h($e, { id: `${e.name}-error`, children: r })
594
589
  ] })
595
590
  ] });
596
591
  });
@@ -600,7 +595,7 @@ const T = ({
600
595
  error: r,
601
596
  children: t,
602
597
  rightAlign: o = !1
603
- }) => e.labelLayout === "column-left" || e.labelLayout === "column-center" ? /* @__PURE__ */ y(Se, { field: e, error: r, showLabel: !0, children: t }) : e.type === "checkbox" || e.type === "switch" ? /* @__PURE__ */ y(Se, { field: e, error: r, showLabel: !1, children: t }) : /* @__PURE__ */ y(Ze, { field: e, error: r, rightAlign: o, children: t }), $e = i.memo(({ children: e, id: r }) => {
598
+ }) => e.labelLayout === "column-left" || e.labelLayout === "column-center" ? /* @__PURE__ */ h(Se, { field: e, error: r, showLabel: !0, children: t }) : e.type === "checkbox" || e.type === "switch" ? /* @__PURE__ */ h(Se, { field: e, error: r, showLabel: !1, children: t }) : /* @__PURE__ */ h(Ze, { field: e, error: r, rightAlign: o, children: t }), $e = i.memo(({ children: e, id: r }) => {
604
599
  const t = i.useMemo(() => ({
605
600
  color: "var(--reactaform-error-color)",
606
601
  fontSize: "13px",
@@ -611,14 +606,14 @@ const T = ({
611
606
  justifyContent: "flex-start",
612
607
  alignItems: "flex-start"
613
608
  }), []);
614
- return /* @__PURE__ */ y("div", { id: r, style: t, children: e });
609
+ return /* @__PURE__ */ h("div", { id: r, style: t, children: e });
615
610
  });
616
611
  $e.displayName = "ErrorDiv";
617
612
  const Qe = i.memo(({ name: e, onChange: r }) => {
618
613
  const { t } = F();
619
614
  return /* @__PURE__ */ O("div", { style: { marginBottom: 16 }, children: [
620
615
  /* @__PURE__ */ O("div", { style: { display: "grid", gridTemplateColumns: "1fr 2fr", gap: 12, alignItems: "center" }, children: [
621
- /* @__PURE__ */ y(
616
+ /* @__PURE__ */ h(
622
617
  "label",
623
618
  {
624
619
  htmlFor: "instance-name-input",
@@ -631,7 +626,7 @@ const Qe = i.memo(({ name: e, onChange: r }) => {
631
626
  children: t("Instance Name")
632
627
  }
633
628
  ),
634
- /* @__PURE__ */ y(
629
+ /* @__PURE__ */ h(
635
630
  "input",
636
631
  {
637
632
  id: "instance-name-input",
@@ -652,7 +647,7 @@ const Qe = i.memo(({ name: e, onChange: r }) => {
652
647
  }
653
648
  )
654
649
  ] }),
655
- /* @__PURE__ */ y("div", { style: { height: "1px", backgroundColor: "var(--reactaform-separator, #e6e6e6)", marginTop: 12, marginBottom: 12 } })
650
+ /* @__PURE__ */ h("div", { style: { height: "1px", backgroundColor: "var(--reactaform-separator, #e6e6e6)", marginTop: 12, marginBottom: 12 } })
656
651
  ] });
657
652
  });
658
653
  Qe.displayName = "InstanceName";
@@ -712,7 +707,7 @@ function H(e, r, t, o) {
712
707
  const c = ve.get(l);
713
708
  if (c)
714
709
  try {
715
- return c(t, o) || null;
710
+ return c(r.name, t, o) || null;
716
711
  } catch (s) {
717
712
  return String(s instanceof Error ? s.message : s);
718
713
  }
@@ -757,7 +752,7 @@ function Ce(e) {
757
752
  return !!r && typeof r.name == "string" && typeof r.size == "number";
758
753
  }
759
754
  }
760
- function Zt(e, r, t = {}) {
755
+ function Yt(e, r, t = {}) {
761
756
  try {
762
757
  const {
763
758
  includeMetadata: o = !1,
@@ -772,22 +767,22 @@ function Zt(e, r, t = {}) {
772
767
  success: !1,
773
768
  error: "Instance must be a valid object"
774
769
  };
775
- const m = [], u = [], d = {}, g = (or(r) || Z(r) && Array.isArray(r.properties) ? r.properties : []).filter(Ve), h = new Map(g.map((b) => [b.name, b]));
776
- for (const [b, C] of Object.entries(e)) {
777
- if (c.includes(b)) {
778
- u.push(b);
770
+ const m = [], u = [], d = {}, g = (or(r) || Z(r) && Array.isArray(r.properties) ? r.properties : []).filter(Ve), b = new Map(g.map((y) => [y.name, y]));
771
+ for (const [y, S] of Object.entries(e)) {
772
+ if (c.includes(y)) {
773
+ u.push(y);
779
774
  continue;
780
775
  }
781
- if (s.length > 0 && !s.includes(b)) {
782
- u.push(b);
776
+ if (s.length > 0 && !s.includes(y)) {
777
+ u.push(y);
783
778
  continue;
784
779
  }
785
- if (C === void 0) continue;
786
- const v = h.get(b);
780
+ if (S === void 0) continue;
781
+ const v = b.get(y);
787
782
  try {
788
- d[b] = Mr(C, v, { dateFormat: n, fileHandling: a });
789
- } catch (k) {
790
- m.push(`Error serializing field '${b}': ${String(k)}`), d[b] = null;
783
+ d[y] = Mr(S, v, { dateFormat: n, fileHandling: a });
784
+ } catch (C) {
785
+ m.push(`Error serializing field '${y}': ${String(C)}`), d[y] = null;
791
786
  }
792
787
  }
793
788
  return o && (d._metadata = {
@@ -881,7 +876,7 @@ function Be(e, r) {
881
876
  _note: "Base64 encoding requires async implementation"
882
877
  };
883
878
  }
884
- function Qt(e, r, t = {}) {
879
+ function Xt(e, r, t = {}) {
885
880
  try {
886
881
  const {
887
882
  strict: o = !1,
@@ -910,27 +905,27 @@ function Qt(e, r, t = {}) {
910
905
  };
911
906
  const s = [], m = [], u = {}, f = (or(r) || Z(r) && Array.isArray(r.properties) ? r.properties : []).filter(Ve), g = new Map(f.map((p) => [p.name, p]));
912
907
  for (const p of f) {
913
- const b = p.name, C = c[b];
914
- if (C === void 0) {
915
- o && p.required && m.push(`Required field '${b}' is missing`);
908
+ const y = p.name, S = c[y];
909
+ if (S === void 0) {
910
+ o && p.required && m.push(`Required field '${y}' is missing`);
916
911
  continue;
917
912
  }
918
913
  try {
919
- u[b] = $r(C, p, { validateTypes: n, dateFormat: l });
914
+ u[y] = $r(S, p, { validateTypes: n, dateFormat: l });
920
915
  } catch (v) {
921
- const k = `Error deserializing field '${b}': ${String(v)}`;
922
- o ? m.push(k) : (s.push(k), u[b] = C);
916
+ const C = `Error deserializing field '${y}': ${String(v)}`;
917
+ o ? m.push(C) : (s.push(C), u[y] = S);
923
918
  }
924
919
  }
925
920
  if (a)
926
- for (const [p, b] of Object.entries(c))
927
- !g.has(p) && p !== "_metadata" && (o && s.push(`Unknown field '${p}' preserved`), u[p] = b);
928
- const h = m.length > 0;
921
+ for (const [p, y] of Object.entries(c))
922
+ !g.has(p) && p !== "_metadata" && (o && s.push(`Unknown field '${p}' preserved`), u[p] = y);
923
+ const b = m.length > 0;
929
924
  return {
930
- success: !h,
925
+ success: !b,
931
926
  data: u,
932
927
  warnings: s.length > 0 ? s : void 0,
933
- validationErrors: h ? m : void 0
928
+ validationErrors: b ? m : void 0
934
929
  };
935
930
  } catch (o) {
936
931
  return {
@@ -976,7 +971,7 @@ function $r(e, r, t = {}) {
976
971
  return e;
977
972
  }
978
973
  }
979
- function en(e, r = {}) {
974
+ function Zt(e, r = {}) {
980
975
  try {
981
976
  const { prettify: t = !0, includeMetadata: o = !0 } = r;
982
977
  if (!e || typeof e != "object")
@@ -1005,7 +1000,7 @@ function en(e, r = {}) {
1005
1000
  };
1006
1001
  }
1007
1002
  }
1008
- function rn(e, r = {}) {
1003
+ function Qt(e, r = {}) {
1009
1004
  try {
1010
1005
  const { strict: t = !1, validateTypes: o = !0 } = r;
1011
1006
  let n;
@@ -1046,8 +1041,8 @@ function rn(e, r = {}) {
1046
1041
  s ? n.properties = s.map((u, d) => {
1047
1042
  const f = Z(u) ? u : {}, g = { ...f };
1048
1043
  if (!f.name) {
1049
- const h = `Property at index ${d} missing 'name'`;
1050
- t ? l.push(h) : (a.push(`${h}, using 'field_${d}'`), g.name = `field_${d}`);
1044
+ const b = `Property at index ${d} missing 'name'`;
1045
+ t ? l.push(b) : (a.push(`${b}, using 'field_${d}'`), g.name = `field_${d}`);
1051
1046
  }
1052
1047
  return f.displayName || (g.displayName = f.name || `Field ${d}`), f.type || (t && o ? l.push(`Property '${f.name || d}' missing 'type'`) : (a.push(`Property '${f.name || d}' missing 'type', using 'string'`), g.type = "string")), f.defaultValue === void 0 && (g.defaultValue = null), f.required === void 0 && (g.required = !1), g;
1053
1048
  }) : t ? l.push("Properties must be an array") : (a.push("Properties not found or invalid, using empty array"), n.properties = []);
@@ -1498,7 +1493,7 @@ for (const e of Hr) {
1498
1493
  r[a] || (r[a] = { name: String(a), shortName: String(a), factor: l });
1499
1494
  Oe[e] = r;
1500
1495
  }
1501
- const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1496
+ const en = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1502
1497
  __proto__: null,
1503
1498
  dimensionUnitDisplayMap: Fe,
1504
1499
  dimensionUnitsMap: Ae,
@@ -1523,17 +1518,17 @@ const tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1523
1518
  }, s = (d) => {
1524
1519
  (d.key === " " || d.key === "Spacebar" || d.key === "Space" || d.key === "Enter") && (d.preventDefault(), t?.(!r, null));
1525
1520
  }, m = e.name, u = H(n, e, r ?? !1, a);
1526
- return /* @__PURE__ */ y(T, { field: e, rightAlign: !1, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
1527
- /* @__PURE__ */ y(
1521
+ return /* @__PURE__ */ h(T, { field: e, rightAlign: !1, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
1522
+ /* @__PURE__ */ h(
1528
1523
  "label",
1529
1524
  {
1530
- className: M.label,
1525
+ className: N.label,
1531
1526
  htmlFor: m,
1532
1527
  style: { textAlign: "left", justifyContent: "flex-start" },
1533
1528
  children: a(e.displayName)
1534
1529
  }
1535
1530
  ),
1536
- /* @__PURE__ */ y(
1531
+ /* @__PURE__ */ h(
1537
1532
  "input",
1538
1533
  {
1539
1534
  id: m,
@@ -1594,22 +1589,22 @@ const Br = ({ field: e, value: r, onChange: t, onError: o }) => {
1594
1589
  i.useEffect(() => {
1595
1590
  u.current = o;
1596
1591
  }, [o]), i.useEffect(() => {
1597
- const v = r && sr(r) ? r : "#000000", k = ir(v);
1598
- c(k);
1592
+ const v = r && sr(r) ? r : "#000000", C = ir(v);
1593
+ c(C);
1599
1594
  }, [r]), i.useEffect(() => {
1600
1595
  const v = H(a, e, r ?? "#000000", n);
1601
1596
  u.current?.(v ?? null);
1602
1597
  }, [r, e, a, n]);
1603
1598
  const d = H(a, e, r ?? "#000000", n), f = (v) => {
1604
- const k = v.target.value;
1605
- c(k), t?.(k, null);
1599
+ const C = v.target.value;
1600
+ c(C), t?.(C, null);
1606
1601
  }, g = (v) => {
1607
- const k = v.target.value;
1608
- c(k), t?.(k, null);
1609
- }, h = We.find(
1602
+ const C = v.target.value;
1603
+ c(C), t?.(C, null);
1604
+ }, b = We.find(
1610
1605
  (v) => v.value === l
1611
- ), { r: p, g: b, b: C } = qr(l) || { r: 0, g: 0, b: 0 };
1612
- return /* @__PURE__ */ y(T, { field: e, error: d, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
1606
+ ), { r: p, g: y, b: S } = qr(l) || { r: 0, g: 0, b: 0 };
1607
+ return /* @__PURE__ */ h(T, { field: e, error: d, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
1613
1608
  /* @__PURE__ */ O(
1614
1609
  "select",
1615
1610
  {
@@ -1618,24 +1613,24 @@ const Br = ({ field: e, value: r, onChange: t, onError: o }) => {
1618
1613
  value: l,
1619
1614
  onChange: f,
1620
1615
  style: { minWidth: "120px", flex: 1 },
1621
- className: B(M.input, M.inputSelect),
1616
+ className: B(N.input, N.inputSelect),
1622
1617
  "aria-invalid": !!d,
1623
1618
  "aria-describedby": d ? `${e.name}-error` : void 0,
1624
1619
  children: [
1625
- We.map((v) => /* @__PURE__ */ y("option", { value: v.value, children: n(v.label) }, v.value)),
1626
- h ? null : /* @__PURE__ */ O("option", { value: l, children: [
1620
+ We.map((v) => /* @__PURE__ */ h("option", { value: v.value, children: n(v.label) }, v.value)),
1621
+ b ? null : /* @__PURE__ */ O("option", { value: l, children: [
1627
1622
  "(",
1628
1623
  p,
1629
1624
  ", ",
1630
- b,
1625
+ y,
1631
1626
  ", ",
1632
- C,
1627
+ S,
1633
1628
  ")"
1634
1629
  ] }, l)
1635
1630
  ]
1636
1631
  }
1637
1632
  ),
1638
- /* @__PURE__ */ y(
1633
+ /* @__PURE__ */ h(
1639
1634
  "label",
1640
1635
  {
1641
1636
  style: {
@@ -1649,7 +1644,7 @@ const Br = ({ field: e, value: r, onChange: t, onError: o }) => {
1649
1644
  overflow: "hidden",
1650
1645
  flexShrink: 0
1651
1646
  },
1652
- children: /* @__PURE__ */ y(
1647
+ children: /* @__PURE__ */ h(
1653
1648
  "input",
1654
1649
  {
1655
1650
  ref: m,
@@ -1700,35 +1695,35 @@ const Br = ({ field: e, value: r, onChange: t, onError: o }) => {
1700
1695
  if (!f || f.trim() === "")
1701
1696
  return c ? n("Value required") : null;
1702
1697
  if (f) {
1703
- const h = se(f);
1704
- if (!h) return n("Invalid date format");
1698
+ const b = se(f);
1699
+ if (!b) return n("Invalid date format");
1705
1700
  if (e.minDate) {
1706
1701
  const p = se(e.minDate);
1707
- if (p && h.getTime() < p.getTime())
1702
+ if (p && b.getTime() < p.getTime())
1708
1703
  return n("Date must be on or after {{1}}", e.minDate);
1709
1704
  }
1710
1705
  if (e.maxDate) {
1711
1706
  const p = se(e.maxDate);
1712
- if (p && h.getTime() > p.getTime())
1707
+ if (p && b.getTime() > p.getTime())
1713
1708
  return n("Date must be on or before {{1}}", e.maxDate);
1714
1709
  }
1715
1710
  }
1716
1711
  return H(a, e, f, n) ?? null;
1717
1712
  }, [e, a, n, c]), d = (f) => {
1718
- const g = f.target.value, h = u(g);
1719
- t?.(g, h);
1713
+ const g = f.target.value, b = u(g);
1714
+ t?.(g, b);
1720
1715
  };
1721
1716
  return i.useEffect(() => {
1722
1717
  const f = u(r);
1723
1718
  f !== s.current && (s.current = f, m.current?.(f ?? null));
1724
- }, [r, u]), /* @__PURE__ */ y(T, { field: e, error: u(r), children: /* @__PURE__ */ y(
1719
+ }, [r, u]), /* @__PURE__ */ h(T, { field: e, error: u(r), children: /* @__PURE__ */ h(
1725
1720
  "input",
1726
1721
  {
1727
1722
  id: l,
1728
1723
  type: "date",
1729
1724
  value: Ur(r),
1730
1725
  onChange: d,
1731
- className: B(M.input, M.textInput),
1726
+ className: B(N.input, N.textInput),
1732
1727
  ...e.minDate ? { min: e.minDate } : {},
1733
1728
  ...e.maxDate ? { max: e.maxDate } : {},
1734
1729
  "aria-invalid": !!u(r),
@@ -1761,7 +1756,7 @@ const Br = ({ field: e, value: r, onChange: t, onError: o }) => {
1761
1756
  const d = u.target.value, f = s(d);
1762
1757
  t?.(d, f);
1763
1758
  };
1764
- return /* @__PURE__ */ y(T, { field: e, error: s(String(r ?? "")), children: /* @__PURE__ */ y(
1759
+ return /* @__PURE__ */ h(T, { field: e, error: s(String(r ?? "")), children: /* @__PURE__ */ h(
1765
1760
  "select",
1766
1761
  {
1767
1762
  id: e.name,
@@ -1771,10 +1766,10 @@ const Br = ({ field: e, value: r, onChange: t, onError: o }) => {
1771
1766
  ref: l,
1772
1767
  onChange: m,
1773
1768
  className: B(
1774
- M.input,
1775
- M.inputSelect
1769
+ N.input,
1770
+ N.inputSelect
1776
1771
  ),
1777
- children: (e.options ?? []).map((u) => /* @__PURE__ */ y("option", { value: String(u.value), children: n(u.label) }, String(u.value)))
1772
+ children: (e.options ?? []).map((u) => /* @__PURE__ */ h("option", { value: String(u.value), children: n(u.label) }, String(u.value)))
1778
1773
  }
1779
1774
  ) });
1780
1775
  };
@@ -1790,9 +1785,7 @@ const Jr = ({
1790
1785
  const { definitionName: n, t: a } = F(), l = i.useRef(null), c = i.useCallback(
1791
1786
  (d) => {
1792
1787
  const f = d.trim();
1793
- return f === "" ? e.required ? a("Value required") : null : Kr(f) ? e.pattern && !new RegExp(e.pattern).test(f) ? e.patternErrorMessage ? a(e.patternErrorMessage) : a("Email does not match pattern: {{%1}}", {
1794
- "%1": `${e.pattern}`
1795
- }) : H(n, e, d, a) ?? null : a("Must be valid email format");
1788
+ return f === "" ? e.required ? a("Value required") : null : Kr(f) ? e.pattern && !new RegExp(e.pattern).test(f) ? e.patternErrorMessage ? a(e.patternErrorMessage) : a("Email does not match pattern: {{1}}", e.pattern) : H(n, e, d, a) ?? null : a("Must be valid email format");
1796
1789
  },
1797
1790
  [e, n, a]
1798
1791
  ), s = (d) => {
@@ -1804,7 +1797,7 @@ const Jr = ({
1804
1797
  }, [o]), i.useEffect(() => {
1805
1798
  const d = r ?? "", f = c(d);
1806
1799
  l.current && l.current.value !== String(d) && (l.current.value = String(d)), f !== m.current && (m.current = f, u.current?.(f ?? null));
1807
- }, [r, c]), /* @__PURE__ */ y(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ y(
1800
+ }, [r, c]), /* @__PURE__ */ h(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ h(
1808
1801
  "input",
1809
1802
  {
1810
1803
  id: e.name,
@@ -1812,7 +1805,7 @@ const Jr = ({
1812
1805
  defaultValue: String(r ?? ""),
1813
1806
  ref: l,
1814
1807
  onChange: s,
1815
- className: B(M.input, M.textInput),
1808
+ className: B(N.input, N.textInput),
1816
1809
  "aria-invalid": !!c(String(r ?? "")),
1817
1810
  "aria-describedby": c(String(r ?? "")) ? `${e.name}-error` : void 0
1818
1811
  }
@@ -1823,7 +1816,7 @@ const Jr = ({
1823
1816
  thickness: o = 1,
1824
1817
  margin: n = "8px 0"
1825
1818
  } = e;
1826
- return /* @__PURE__ */ y(
1819
+ return /* @__PURE__ */ h(
1827
1820
  "div",
1828
1821
  {
1829
1822
  style: {
@@ -1849,44 +1842,44 @@ const Jr = ({
1849
1842
  t?.(r, v), m.current?.(v ?? null);
1850
1843
  }, [r, u]);
1851
1844
  const f = (v) => {
1852
- const k = v.target.files;
1853
- let N = null;
1854
- if (k && k.length > 0) {
1855
- const x = Array.from(k);
1856
- e.multiple ? N = [...Array.isArray(r) ? r : [], ...x] : N = x[0];
1845
+ const C = v.target.files;
1846
+ let I = null;
1847
+ if (C && C.length > 0) {
1848
+ const x = Array.from(C);
1849
+ e.multiple ? I = [...Array.isArray(r) ? r : [], ...x] : I = x[0];
1857
1850
  }
1858
- const w = u(N);
1859
- t?.(N, w);
1851
+ const w = u(I);
1852
+ t?.(I, w);
1860
1853
  }, g = (v) => {
1861
1854
  v.preventDefault(), v.stopPropagation(), c(!1);
1862
- const k = v.dataTransfer.files;
1863
- if (k && k.length > 0) {
1864
- const N = Array.from(k);
1855
+ const C = v.dataTransfer.files;
1856
+ if (C && C.length > 0) {
1857
+ const I = Array.from(C);
1865
1858
  let w = null;
1866
- e.multiple ? w = [...Array.isArray(r) ? r : [], ...N] : w = N[0];
1859
+ e.multiple ? w = [...Array.isArray(r) ? r : [], ...I] : w = I[0];
1867
1860
  const x = u(w);
1868
1861
  t?.(w, x);
1869
1862
  }
1870
- }, h = (v) => {
1863
+ }, b = (v) => {
1871
1864
  v.preventDefault(), v.stopPropagation(), c(!0);
1872
1865
  }, p = (v) => {
1873
1866
  v.preventDefault(), v.stopPropagation(), c(!1);
1874
- }, b = (v) => {
1867
+ }, y = (v) => {
1875
1868
  if (Array.isArray(r) && typeof v == "number") {
1876
- const k = r.filter((x, R) => R !== v), N = k.length > 0 ? k : null, w = u(N);
1877
- t?.(N, w);
1869
+ const C = r.filter((x, k) => k !== v), I = C.length > 0 ? C : null, w = u(I);
1870
+ t?.(I, w);
1878
1871
  } else {
1879
- const k = u(null);
1880
- t?.(null, k);
1872
+ const C = u(null);
1873
+ t?.(null, C);
1881
1874
  }
1882
- }, C = () => {
1875
+ }, S = () => {
1883
1876
  const v = Array.isArray(r) ? r : r ? [r] : [];
1884
- return v.length === 0 ? null : /* @__PURE__ */ y("div", { style: {
1877
+ return v.length === 0 ? null : /* @__PURE__ */ h("div", { style: {
1885
1878
  marginTop: "8px",
1886
1879
  display: "flex",
1887
1880
  flexDirection: "column",
1888
1881
  gap: "6px"
1889
- }, children: v.map((k, N) => /* @__PURE__ */ O(
1882
+ }, children: v.map((C, I) => /* @__PURE__ */ O(
1890
1883
  "div",
1891
1884
  {
1892
1885
  style: {
@@ -1901,18 +1894,18 @@ const Jr = ({
1901
1894
  gap: "8px"
1902
1895
  },
1903
1896
  children: [
1904
- /* @__PURE__ */ y("div", { style: {
1897
+ /* @__PURE__ */ h("div", { style: {
1905
1898
  flex: 1,
1906
1899
  minWidth: 0,
1907
1900
  overflow: "hidden",
1908
1901
  textOverflow: "ellipsis",
1909
1902
  whiteSpace: "nowrap"
1910
- }, children: k.name }),
1911
- /* @__PURE__ */ y(
1903
+ }, children: C.name }),
1904
+ /* @__PURE__ */ h(
1912
1905
  "button",
1913
1906
  {
1914
1907
  type: "button",
1915
- onClick: () => b(Array.isArray(r) ? N : void 0),
1908
+ onClick: () => y(Array.isArray(r) ? I : void 0),
1916
1909
  "aria-label": n("Remove file"),
1917
1910
  style: {
1918
1911
  background: "transparent",
@@ -1937,15 +1930,15 @@ const Jr = ({
1937
1930
  )
1938
1931
  ]
1939
1932
  },
1940
- `${k.name}-${N}`
1933
+ `${C.name}-${I}`
1941
1934
  )) });
1942
1935
  };
1943
- return /* @__PURE__ */ y(T, { field: e, error: d, children: /* @__PURE__ */ O("div", { style: { width: "100%" }, children: [
1936
+ return /* @__PURE__ */ h(T, { field: e, error: d, children: /* @__PURE__ */ O("div", { style: { width: "100%" }, children: [
1944
1937
  /* @__PURE__ */ O(
1945
1938
  "div",
1946
1939
  {
1947
1940
  onDrop: g,
1948
- onDragOver: h,
1941
+ onDragOver: b,
1949
1942
  onDragLeave: p,
1950
1943
  style: {
1951
1944
  position: "relative",
@@ -1975,7 +1968,7 @@ const Jr = ({
1975
1968
  "aria-invalid": !!d,
1976
1969
  "aria-describedby": d ? `${e.name}-error` : void 0,
1977
1970
  children: [
1978
- /* @__PURE__ */ y(
1971
+ /* @__PURE__ */ h(
1979
1972
  "input",
1980
1973
  {
1981
1974
  id: e.name,
@@ -1989,20 +1982,20 @@ const Jr = ({
1989
1982
  onChange: f
1990
1983
  }
1991
1984
  ),
1992
- /* @__PURE__ */ y("div", { style: {
1985
+ /* @__PURE__ */ h("div", { style: {
1993
1986
  fontSize: "1.25rem",
1994
1987
  opacity: 0.6,
1995
1988
  lineHeight: 1,
1996
1989
  flexShrink: 0
1997
1990
  }, children: "📁" }),
1998
- /* @__PURE__ */ y("div", { style: {
1991
+ /* @__PURE__ */ h("div", { style: {
1999
1992
  fontSize: "0.875rem",
2000
1993
  fontWeight: 400,
2001
1994
  color: "var(--reactaform-text-color, #111827)",
2002
1995
  flex: 1,
2003
1996
  textAlign: "left"
2004
1997
  }, children: l ? n("Drop files here") : e.multiple ? n("Choose Files or Drag & Drop") : n("Choose File or Drag & Drop") }),
2005
- e.accept && /* @__PURE__ */ y("div", { style: {
1998
+ e.accept && /* @__PURE__ */ h("div", { style: {
2006
1999
  fontSize: "0.75rem",
2007
2000
  color: "var(--reactaform-text-muted, #6b7280)",
2008
2001
  whiteSpace: "nowrap",
@@ -2013,7 +2006,7 @@ const Jr = ({
2013
2006
  ]
2014
2007
  }
2015
2008
  ),
2016
- C()
2009
+ S()
2017
2010
  ] }) });
2018
2011
  }, Xr = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
2019
2012
  function Zr(e) {
@@ -2056,66 +2049,66 @@ const Qr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
2056
2049
  },
2057
2050
  [a, e, n]
2058
2051
  ), m = (f) => {
2059
- const g = f.target.value, h = s(g);
2060
- c(g), t?.(g, h);
2061
- }, u = i.useRef(null), d = i.useRef(o);
2052
+ const g = f.target.value, b = s(g);
2053
+ c(g), t?.(g, b);
2054
+ }, u = i.useRef(null), d = i.useRef(
2055
+ o
2056
+ );
2062
2057
  return i.useEffect(() => {
2063
2058
  d.current = o;
2064
2059
  }, [o]), i.useEffect(() => {
2065
2060
  const f = Array.isArray(r) ? r.join(", ") : String(r ?? ""), g = s(f);
2066
2061
  g !== u.current && (u.current = g, d.current?.(g ?? null));
2067
- }, [r, e.required, s, n]), /* @__PURE__ */ y(T, { field: e, error: s(l), children: /* @__PURE__ */ y(
2062
+ }, [r, e.required, s, n]), /* @__PURE__ */ h(T, { field: e, error: s(l), children: /* @__PURE__ */ h(
2068
2063
  "input",
2069
2064
  {
2070
2065
  id: e.name,
2071
2066
  type: "text",
2072
2067
  value: l,
2073
2068
  onChange: m,
2074
- className: B(M.input, M.textInput),
2069
+ className: B(N.input, N.textInput),
2075
2070
  style: { flex: 1 },
2076
2071
  "aria-invalid": !!s(l),
2077
2072
  "aria-describedby": s(l) ? `${e.name}-error` : void 0
2078
2073
  }
2079
2074
  ) });
2080
- }, rt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, tt = (e) => {
2081
- const r = Number.parseFloat(e);
2082
- return Number.isNaN(r) ? null : r;
2083
- }, nt = ({
2075
+ }, rt = ({
2084
2076
  field: e,
2085
2077
  value: r,
2086
2078
  onChange: t,
2087
2079
  onError: o
2088
2080
  }) => {
2089
2081
  const { t: n, definitionName: a } = F(), l = i.useRef(null), c = i.useCallback(
2090
- (d) => {
2091
- if (d.trim() === "")
2082
+ (f) => {
2083
+ if (f.trim() === "")
2092
2084
  return e.required ? n("Value required") : null;
2093
- if (!rt.test(d))
2094
- return n("Must be a valid float");
2095
- const f = tt(d);
2096
- return f === null ? n("Must be a valid float") : e.min !== void 0 && (e.minInclusive ? f < e.min : f <= e.min) ? n(
2085
+ const g = Number.parseFloat(f);
2086
+ return Number.isNaN(g) ? n("Must be a valid float") : e.min !== void 0 && (e.minInclusive ? g < e.min : g <= e.min) ? n(
2097
2087
  "Must be {{1}} {{2}}",
2098
2088
  e.minInclusive ? "≥" : ">",
2099
2089
  e.min
2100
- ) : e.max !== void 0 && (e.maxInclusive ? f > e.max : f >= e.max) ? n(
2090
+ ) : e.max !== void 0 && (e.maxInclusive ? g > e.max : g >= e.max) ? n(
2101
2091
  "Must be {{1}} {{2}}",
2102
2092
  e.maxInclusive ? "≤" : "<",
2103
2093
  e.max
2104
- ) : H(a, e, f, n) ?? null;
2094
+ ) : H(a, e, g, n) ?? null;
2105
2095
  },
2106
2096
  [e, a, n]
2107
2097
  ), s = i.useRef(null), m = i.useRef(o);
2108
2098
  i.useEffect(() => {
2109
2099
  m.current = o;
2110
2100
  }, [o]), i.useEffect(() => {
2111
- const d = String(r ?? ""), f = c(d);
2112
- f !== s.current && (s.current = f, m.current?.(f ?? null)), l.current && document.activeElement !== l.current && (l.current.value = d);
2101
+ const f = String(r ?? ""), g = c(f);
2102
+ g !== s.current && (s.current = g, m.current?.(g ?? null)), l.current && document.activeElement !== l.current && (l.current.value = f);
2113
2103
  }, [r, e, c, n]);
2114
- const u = (d) => {
2115
- const f = d.target.value, g = c(f);
2116
- t?.(f, g);
2117
- };
2118
- return /* @__PURE__ */ y(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ y(
2104
+ const u = (f) => {
2105
+ const g = f.target.value, b = c(g);
2106
+ t?.(g, b);
2107
+ }, d = i.useMemo(
2108
+ () => c(String(r ?? "")),
2109
+ [r, c]
2110
+ );
2111
+ return /* @__PURE__ */ h(T, { field: e, error: d, children: /* @__PURE__ */ h(
2119
2112
  "input",
2120
2113
  {
2121
2114
  id: e.name,
@@ -2124,15 +2117,15 @@ const Qr = (e) => !e || e.trim() === "" ? [] : e.split(",").map((r) => r.trim())
2124
2117
  ref: l,
2125
2118
  onChange: u,
2126
2119
  className: B(
2127
- M.input,
2128
- M.inputNumber
2120
+ N.input,
2121
+ N.inputNumber
2129
2122
  ),
2130
- "aria-invalid": !!c(String(r ?? "")),
2131
- "aria-describedby": c(String(r ?? "")) ? `${e.name}-error` : void 0
2123
+ "aria-invalid": !!d,
2124
+ "aria-describedby": d ? `${e.name}-error` : void 0
2132
2125
  }
2133
2126
  ) });
2134
2127
  };
2135
- function ot() {
2128
+ function tt() {
2136
2129
  try {
2137
2130
  return "/";
2138
2131
  } catch {
@@ -2144,46 +2137,46 @@ function ot() {
2144
2137
  }
2145
2138
  return "/";
2146
2139
  }
2147
- const at = ({ field: e, value: r }) => {
2140
+ const nt = ({ field: e, value: r }) => {
2148
2141
  const { language: t, t: o } = F(), n = e.alignment || "center", a = {
2149
2142
  left: "flex-start",
2150
2143
  center: "center",
2151
2144
  right: "flex-end"
2152
2145
  }, l = typeof r == "string" ? r : "";
2153
2146
  let c = l && l.trim() !== "" ? l : typeof e.defaultValue == "string" ? e.defaultValue : "";
2154
- c && !c.startsWith("/") && (c = `${ot()}${c}`);
2155
- const s = e.localized?.split(";").map((b) => b.trim()), [m, u] = i.useState(c || ""), d = i.useRef(c || null);
2147
+ c && !c.startsWith("/") && (c = `${tt()}${c}`);
2148
+ const s = e.localized?.split(";").map((y) => y.trim()), [m, u] = i.useState(c || ""), d = i.useRef(c || null);
2156
2149
  if (i.useEffect(() => {
2157
2150
  if (!c) return;
2158
- const b = c.split("/"), C = b.pop(), v = C.lastIndexOf(".");
2151
+ const y = c.split("/"), S = y.pop(), v = S.lastIndexOf(".");
2159
2152
  if (v === -1) return;
2160
- const k = C.substring(0, v), N = C.substring(v);
2153
+ const C = S.substring(0, v), I = S.substring(v);
2161
2154
  let w = null;
2162
- s?.includes(t) && (w = `${k}_${t}${N}`);
2155
+ s?.includes(t) && (w = `${C}_${t}${I}`);
2163
2156
  const x = new AbortController();
2164
2157
  if (w) {
2165
- const R = [...b, w].join("/");
2166
- fetch(R, { method: "HEAD", signal: x.signal }).then(($) => {
2167
- const S = $.ok ? R : c;
2168
- S !== d.current && (d.current = S, u(S));
2158
+ const k = [...y, w].join("/");
2159
+ fetch(k, { method: "HEAD", signal: x.signal }).then((V) => {
2160
+ const R = V.ok ? k : c;
2161
+ R !== d.current && (d.current = R, u(R));
2169
2162
  }).catch(() => {
2170
2163
  c !== d.current && (d.current = c, u(c));
2171
2164
  });
2172
2165
  } else {
2173
- const R = c;
2174
- R !== d.current && (d.current = R, requestAnimationFrame(() => u(R)));
2166
+ const k = c;
2167
+ k !== d.current && (d.current = k, requestAnimationFrame(() => u(k)));
2175
2168
  }
2176
2169
  return () => {
2177
2170
  x.abort();
2178
2171
  };
2179
2172
  }, [c, t, s]), !m) return null;
2180
- const { width: f, height: g } = e, h = {}, p = {
2173
+ const { width: f, height: g } = e, b = {}, p = {
2181
2174
  borderRadius: "8px",
2182
2175
  objectFit: "contain",
2183
2176
  boxShadow: "0 2px 6px rgba(0,0,0,0.1)",
2184
2177
  margin: "0 0 8px 0"
2185
2178
  };
2186
- return f && g ? (h.width = f, h.height = g, p.width = `${f}px`, p.height = `${g}px`) : f && !g ? (h.width = f, p.width = `${f}px`, p.height = "auto") : !f && g && (h.height = g, p.width = "auto", p.height = `${g}px`), /* @__PURE__ */ y(T, { field: e, children: /* @__PURE__ */ y(
2179
+ return f && g ? (b.width = f, b.height = g, p.width = `${f}px`, p.height = `${g}px`) : f && !g ? (b.width = f, p.width = `${f}px`, p.height = "auto") : !f && g && (b.height = g, p.width = "auto", p.height = `${g}px`), /* @__PURE__ */ h(T, { field: e, children: /* @__PURE__ */ h(
2187
2180
  "div",
2188
2181
  {
2189
2182
  "data-testid": "image-wrapper",
@@ -2192,23 +2185,23 @@ const at = ({ field: e, value: r }) => {
2192
2185
  justifyContent: a[n] || "center",
2193
2186
  margin: "0 0"
2194
2187
  },
2195
- children: /* @__PURE__ */ y(
2188
+ children: /* @__PURE__ */ h(
2196
2189
  "img",
2197
2190
  {
2198
2191
  src: m,
2199
2192
  alt: o?.(e.displayName || "Image") || e.displayName || "Image",
2200
- ...h,
2193
+ ...b,
2201
2194
  style: p
2202
2195
  }
2203
2196
  )
2204
2197
  }
2205
2198
  ) });
2206
2199
  };
2207
- function st(e) {
2200
+ function ot(e) {
2208
2201
  const r = /^-?\d+$/;
2209
2202
  return e.split(",").map((t) => t.trim()).every((t) => r.test(t));
2210
2203
  }
2211
- const it = ({
2204
+ const at = ({
2212
2205
  field: e,
2213
2206
  value: r,
2214
2207
  onChange: t,
@@ -2216,18 +2209,18 @@ const it = ({
2216
2209
  }) => {
2217
2210
  const { t: n, definitionName: a } = F(), l = ",", [c, s] = i.useState(
2218
2211
  Array.isArray(r) ? r.join(l + " ") : String(r ?? "")
2219
- ), m = (p) => !p || p.trim() === "" ? [] : p.split(l).map((b) => b.trim()).filter(Boolean).map((b) => Number(b)), u = i.useCallback(
2212
+ ), m = (p) => !p || p.trim() === "" ? [] : p.split(l).map((y) => y.trim()).filter(Boolean).map((y) => Number(y)), u = i.useCallback(
2220
2213
  (p) => {
2221
2214
  if (p.trim() === "")
2222
2215
  return e.required ? n("Value required") : null;
2223
- if (!st(p))
2216
+ if (!ot(p))
2224
2217
  return n("Each value must be a valid integer");
2225
- const b = m(p);
2226
- if (e.minCount !== void 0 && b.length < e.minCount)
2218
+ const y = m(p);
2219
+ if (e.minCount !== void 0 && y.length < e.minCount)
2227
2220
  return n("Minimum number of values: {{1}}", `${e.minCount}`);
2228
- if (e.maxCount !== void 0 && b.length > e.maxCount)
2221
+ if (e.maxCount !== void 0 && y.length > e.maxCount)
2229
2222
  return n("Maximum number of values: {{1}}", `${e.maxCount}`);
2230
- for (const v of b) {
2223
+ for (const v of y) {
2231
2224
  if (e.min !== void 0 && (e.minInclusive ? v < e.min : v <= e.min))
2232
2225
  return n(
2233
2226
  "Each value must be {{1}} {{2}}",
@@ -2241,106 +2234,106 @@ const it = ({
2241
2234
  e.max
2242
2235
  );
2243
2236
  }
2244
- return H(a, e, b, n) ?? null;
2237
+ return H(a, e, y, n) ?? null;
2245
2238
  },
2246
2239
  [a, e, n]
2247
2240
  ), d = (p) => {
2248
- const b = p.target.value, C = u(b);
2249
- s(b), t?.(b, C);
2241
+ const y = p.target.value, S = u(y);
2242
+ s(y), t?.(y, S);
2250
2243
  }, f = i.useRef(null), g = i.useRef(
2251
2244
  o
2252
2245
  );
2253
2246
  i.useEffect(() => {
2254
2247
  g.current = o;
2255
2248
  }, [o]), i.useEffect(() => {
2256
- const p = Array.isArray(r) ? r.join(l + " ") : String(r ?? ""), b = u(p);
2257
- b !== f.current && (f.current = b, g.current?.(b ?? null));
2249
+ const p = Array.isArray(r) ? r.join(l + " ") : String(r ?? ""), y = u(p);
2250
+ y !== f.current && (f.current = y, g.current?.(y ?? null));
2258
2251
  }, [r, e.required, u, n]);
2259
- const h = u(c);
2260
- return /* @__PURE__ */ y(T, { field: e, error: h, children: /* @__PURE__ */ y(
2252
+ const b = u(c);
2253
+ return /* @__PURE__ */ h(T, { field: e, error: b, children: /* @__PURE__ */ h(
2261
2254
  "input",
2262
2255
  {
2263
2256
  id: e.name,
2264
2257
  type: "text",
2265
2258
  value: c,
2266
2259
  onChange: d,
2267
- className: B(M.input, M.textInput),
2260
+ className: B(N.input, N.textInput),
2268
2261
  style: { flex: 1 },
2269
- "aria-invalid": !!h,
2270
- "aria-describedby": h ? `${e.name}-error` : void 0
2262
+ "aria-invalid": !!b,
2263
+ "aria-describedby": b ? `${e.name}-error` : void 0
2271
2264
  }
2272
2265
  ) });
2273
2266
  };
2274
- function ct(e) {
2267
+ function st(e) {
2275
2268
  return /^[-+]?\d*$/.test(e);
2276
2269
  }
2277
- const lt = ({
2270
+ const it = ({
2278
2271
  field: e,
2279
2272
  value: r,
2280
2273
  onChange: t,
2281
2274
  onError: o
2282
2275
  }) => {
2283
- const { t: n, definitionName: a } = F(), l = i.useRef(null), c = i.useCallback((g) => {
2284
- const h = parseInt(g, 10);
2285
- return Number.isNaN(h) ? null : h;
2286
- }, []), s = i.useCallback(
2287
- (g) => {
2288
- if (g.trim() === "")
2276
+ const { t: n, definitionName: a } = F(), l = i.useRef(null), c = i.useCallback(
2277
+ (f) => {
2278
+ if (f.trim() === "")
2289
2279
  return e.required ? n("Value required") : null;
2290
- if (!ct(g))
2280
+ if (!st(f))
2291
2281
  return n("Must be a valid integer");
2292
- const h = c(g);
2293
- if (h === null) return n("Must be a valid integer");
2294
- if (e.min !== void 0 && (e.minInclusive ? h < e.min : h <= e.min))
2282
+ const g = parseInt(f, 10);
2283
+ if (Number.isNaN(g)) return n("Must be a valid integer");
2284
+ if (e.min !== void 0 && (e.minInclusive ? g < e.min : g <= e.min))
2295
2285
  return n(
2296
2286
  "Must be {{1}} {{2}}",
2297
2287
  e.minInclusive ? "≥" : ">",
2298
2288
  e.min
2299
2289
  );
2300
- if (e.max !== void 0 && (e.maxInclusive ? h > e.max : h >= e.max))
2290
+ if (e.max !== void 0 && (e.maxInclusive ? g > e.max : g >= e.max))
2301
2291
  return n(
2302
2292
  "Must be {{1}} {{2}}",
2303
2293
  e.maxInclusive ? "≤" : "<",
2304
2294
  e.max
2305
2295
  );
2306
2296
  if (e.step !== void 0) {
2307
- const b = Number(e.step);
2308
- if (!Number.isInteger(b))
2297
+ const p = Number(e.step);
2298
+ if (!Number.isInteger(p))
2309
2299
  return n("Invalid step value");
2310
- if (h % b !== 0)
2311
- return n("Must be a multiple of {{1}}", b);
2300
+ if (g % p !== 0)
2301
+ return n("Must be a multiple of {{1}}", p);
2312
2302
  }
2313
- return H(a, e, h, n) ?? null;
2303
+ return H(a, e, g, n) ?? null;
2314
2304
  },
2315
- [e, a, n, c]
2316
- ), m = i.useRef(null), u = i.useRef(o);
2305
+ [e, a, n]
2306
+ ), s = i.useRef(null), m = i.useRef(o);
2317
2307
  i.useEffect(() => {
2318
- u.current = o;
2308
+ m.current = o;
2319
2309
  }, [o]), i.useEffect(() => {
2320
- const g = String(r ?? ""), h = s(g);
2321
- h !== m.current && (m.current = h, u.current?.(h ?? null)), l.current && document.activeElement !== l.current && (l.current.value = g);
2322
- }, [r, e, s, n]);
2323
- const d = (g) => {
2324
- const h = g.target.value, p = s(h);
2325
- t?.(h, p);
2326
- }, f = s(String(r ?? ""));
2327
- return /* @__PURE__ */ y(T, { field: e, error: f, children: /* @__PURE__ */ y(
2310
+ const f = String(r ?? ""), g = c(f);
2311
+ g !== s.current && (s.current = g, m.current?.(g ?? null)), l.current && document.activeElement !== l.current && (l.current.value = f);
2312
+ }, [r, e, c, n]);
2313
+ const u = (f) => {
2314
+ const g = f.target.value, b = c(g);
2315
+ t?.(g, b);
2316
+ }, d = i.useMemo(
2317
+ () => c(String(r ?? "")),
2318
+ [r, c]
2319
+ );
2320
+ return /* @__PURE__ */ h(T, { field: e, error: d, children: /* @__PURE__ */ h(
2328
2321
  "input",
2329
2322
  {
2330
2323
  id: e.name,
2331
2324
  type: "text",
2332
2325
  defaultValue: String(r ?? ""),
2333
2326
  ref: l,
2334
- onChange: d,
2327
+ onChange: u,
2335
2328
  className: B(
2336
- M.input,
2337
- M.inputNumber
2329
+ N.input,
2330
+ N.inputNumber
2338
2331
  ),
2339
- "aria-invalid": !!f,
2340
- "aria-describedby": f ? `${e.name}-error` : void 0
2332
+ "aria-invalid": !!d,
2333
+ "aria-describedby": d ? `${e.name}-error` : void 0
2341
2334
  }
2342
2335
  ) });
2343
- }, ut = ({
2336
+ }, ct = ({
2344
2337
  field: e,
2345
2338
  value: r,
2346
2339
  onChange: t,
@@ -2353,15 +2346,15 @@ const lt = ({
2353
2346
  m.current = o;
2354
2347
  }, [o]);
2355
2348
  const u = i.useCallback(
2356
- (h) => h.trim() === "" ? e.required ? n("Value required") : null : e.minLength !== void 0 && h.length < e.minLength ? n("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && h.length > e.maxLength ? n("Must be at most {{1}} characters", e.maxLength) : H(a, e, h, n),
2349
+ (b) => b.trim() === "" ? e.required ? n("Value required") : null : e.minLength !== void 0 && b.length < e.minLength ? n("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && b.length > e.maxLength ? n("Must be at most {{1}} characters", e.maxLength) : H(a, e, b, n),
2357
2350
  [e, a, n]
2358
- ), d = (h) => {
2359
- const p = h.target.value, b = u(p);
2360
- t?.(p, b);
2351
+ ), d = (b) => {
2352
+ const p = b.target.value, y = u(p);
2353
+ t?.(p, y);
2361
2354
  };
2362
2355
  i.useEffect(() => {
2363
- const h = u(r);
2364
- h !== s.current && (s.current = h, m.current?.(h ?? null)), c.current && c.current.value !== String(r ?? "") && (c.current.value = String(r ?? ""));
2356
+ const b = u(r);
2357
+ b !== s.current && (s.current = b, m.current?.(b ?? null)), c.current && c.current.value !== String(r ?? "") && (c.current.value = String(r ?? ""));
2365
2358
  }, [r, u]);
2366
2359
  const f = {
2367
2360
  id: e.name,
@@ -2374,9 +2367,9 @@ const lt = ({
2374
2367
  width: "100%",
2375
2368
  boxSizing: "border-box"
2376
2369
  },
2377
- className: B(M.input, M.textInput)
2370
+ className: B(N.input, N.textInput)
2378
2371
  }, g = u(r);
2379
- return /* @__PURE__ */ y(T, { field: e, error: g, children: /* @__PURE__ */ y(
2372
+ return /* @__PURE__ */ h(T, { field: e, error: g, children: /* @__PURE__ */ h(
2380
2373
  "textarea",
2381
2374
  {
2382
2375
  ...f,
@@ -2384,7 +2377,7 @@ const lt = ({
2384
2377
  "aria-describedby": g ? `${e.name}-error` : void 0
2385
2378
  }
2386
2379
  ) });
2387
- }, ft = ({
2380
+ }, lt = ({
2388
2381
  field: e,
2389
2382
  value: r,
2390
2383
  onChange: t,
@@ -2394,28 +2387,28 @@ const lt = ({
2394
2387
  i.useEffect(() => {
2395
2388
  n.current = o;
2396
2389
  }, [o]);
2397
- const { t: a, darkMode: l, formStyle: c, fieldStyle: s, definitionName: m } = F(), u = (S, E, I) => {
2390
+ const { t: a, darkMode: l, formStyle: c, fieldStyle: s, definitionName: m } = F(), u = (R, E, M) => {
2398
2391
  if (!E) return {};
2399
- const q = S?.[E];
2400
- return (I && q ? q[I] : void 0) ?? {};
2401
- }, d = i.useRef(null), [f, g] = i.useState(!1), [h, p] = i.useState(
2392
+ const q = R?.[E];
2393
+ return (M && q ? q[M] : void 0) ?? {};
2394
+ }, d = i.useRef(null), [f, g] = i.useState(!1), [b, p] = i.useState(
2402
2395
  null
2403
- ), b = i.useMemo(
2404
- () => e.options.map((S) => ({ value: S.value, label: a(S.label) })),
2396
+ ), y = i.useMemo(
2397
+ () => e.options.map((R) => ({ value: R.value, label: a(R.label) })),
2405
2398
  [e.options, a]
2406
- ), C = i.useMemo(() => {
2407
- const S = Array.isArray(r) ? r : [], E = new Set(b.map((I) => I.value));
2408
- return S.filter((I) => E.has(I));
2409
- }, [r, b]), v = (S) => {
2410
- const E = Array.isArray(S) ? S : [];
2399
+ ), S = i.useMemo(() => {
2400
+ const R = Array.isArray(r) ? r : [], E = new Set(y.map((M) => M.value));
2401
+ return R.filter((M) => E.has(M));
2402
+ }, [r, y]), v = (R) => {
2403
+ const E = Array.isArray(R) ? R : [];
2411
2404
  return e.required && E.length === 0 ? a("Value required") : H(m, e, E, a) ?? null;
2412
- }, k = () => {
2405
+ }, C = () => {
2413
2406
  if (!d.current) return;
2414
- const S = d.current.getBoundingClientRect();
2415
- p({ x: S.left, y: S.bottom }), g((E) => !E);
2416
- }, N = (S) => {
2417
- const E = C.includes(S) ? C.filter((z) => z !== S) : [...C, S], I = v(E);
2418
- n.current?.(I ?? null), t?.(E, I);
2407
+ const R = d.current.getBoundingClientRect();
2408
+ p({ x: R.left, y: R.bottom }), g((E) => !E);
2409
+ }, I = (R) => {
2410
+ const E = S.includes(R) ? S.filter((z) => z !== R) : [...S, R], M = v(E);
2411
+ n.current?.(M ?? null), t?.(E, M);
2419
2412
  }, w = i.useMemo(() => ({
2420
2413
  height: "var(--reactaform-input-height, 2.5rem)",
2421
2414
  padding: "var(--reactaform-input-padding, 8px)",
@@ -2443,7 +2436,7 @@ const lt = ({
2443
2436
  padding: 0,
2444
2437
  ...u(c, "multiSelect", "clearButton"),
2445
2438
  ...u(s, void 0, "clearButton")
2446
- }), [c, s]), R = i.useMemo(() => ({
2439
+ }), [c, s]), k = i.useMemo(() => ({
2447
2440
  position: "absolute",
2448
2441
  right: "0.7em",
2449
2442
  top: "50%",
@@ -2453,61 +2446,61 @@ const lt = ({
2453
2446
  color: "var(--reactaform-text-muted, #999)",
2454
2447
  ...u(c, "multiSelect", "arrow"),
2455
2448
  ...u(s, void 0, "arrow")
2456
- }), [c, s]), $ = v(Array.isArray(r) ? r : []);
2449
+ }), [c, s]), V = v(Array.isArray(r) ? r : []);
2457
2450
  return /* @__PURE__ */ O("div", { children: [
2458
- /* @__PURE__ */ y(T, { field: e, error: null, children: /* @__PURE__ */ y("div", { style: { width: "100%" }, children: /* @__PURE__ */ O(
2451
+ /* @__PURE__ */ h(T, { field: e, error: null, children: /* @__PURE__ */ h("div", { style: { width: "100%" }, children: /* @__PURE__ */ O(
2459
2452
  "div",
2460
2453
  {
2461
2454
  ref: d,
2462
2455
  className: "reactaform-multiselection-control",
2463
2456
  style: w,
2464
- onClick: k,
2457
+ onClick: C,
2465
2458
  tabIndex: 0,
2466
2459
  role: "button",
2467
2460
  "aria-haspopup": "listbox",
2468
2461
  "aria-expanded": f,
2469
- "aria-invalid": !!$,
2470
- "aria-describedby": $ ? `${e.name}-error` : void 0,
2471
- onKeyDown: (S) => {
2472
- (S.key === "Enter" || S.key === " ") && (S.preventDefault(), k());
2462
+ "aria-invalid": !!V,
2463
+ "aria-describedby": V ? `${e.name}-error` : void 0,
2464
+ onKeyDown: (R) => {
2465
+ (R.key === "Enter" || R.key === " ") && (R.preventDefault(), C());
2473
2466
  },
2474
2467
  children: [
2475
2468
  /* @__PURE__ */ O("span", { style: { flex: 1, color: "var(--reactaform-text-muted, #888)" }, children: [
2476
- C.length,
2469
+ S.length,
2477
2470
  " / ",
2478
- b.length,
2471
+ y.length,
2479
2472
  " selected"
2480
2473
  ] }),
2481
- C.length > 0 && /* @__PURE__ */ y(
2474
+ S.length > 0 && /* @__PURE__ */ h(
2482
2475
  "button",
2483
2476
  {
2484
2477
  type: "button",
2485
2478
  "aria-label": "Clear selections",
2486
- onClick: (S) => {
2487
- S.stopPropagation(), t?.([], null);
2479
+ onClick: (R) => {
2480
+ R.stopPropagation(), t?.([], null);
2488
2481
  },
2489
2482
  style: x,
2490
- children: /* @__PURE__ */ y("span", { style: x, "aria-hidden": !0, children: "✖" })
2483
+ children: /* @__PURE__ */ h("span", { style: x, "aria-hidden": !0, children: "✖" })
2491
2484
  }
2492
2485
  ),
2493
- /* @__PURE__ */ y("span", { style: R, "aria-hidden": !0, children: "▼" })
2486
+ /* @__PURE__ */ h("span", { style: k, "aria-hidden": !0, children: "▼" })
2494
2487
  ]
2495
2488
  }
2496
2489
  ) }) }),
2497
- f && h && /* @__PURE__ */ y(
2498
- mt,
2490
+ f && b && /* @__PURE__ */ h(
2491
+ ut,
2499
2492
  {
2500
- position: h,
2501
- options: b,
2502
- selectedValues: C,
2503
- onToggleOption: N,
2493
+ position: b,
2494
+ options: y,
2495
+ selectedValues: S,
2496
+ onToggleOption: I,
2504
2497
  onClose: () => g(!1),
2505
2498
  controlRef: d,
2506
2499
  darkMode: l
2507
2500
  }
2508
2501
  )
2509
2502
  ] });
2510
- }, mt = ({
2503
+ }, ut = ({
2511
2504
  position: e,
2512
2505
  options: r,
2513
2506
  selectedValues: t,
@@ -2516,10 +2509,10 @@ const lt = ({
2516
2509
  controlRef: a,
2517
2510
  darkMode: l
2518
2511
  }) => {
2519
- const c = i.useRef(null), [s, m] = i.useState(-1), { formStyle: u, fieldStyle: d } = F(), f = (x, R, $) => {
2520
- if (!R) return {};
2521
- const E = x?.[R];
2522
- return ($ && E ? E[$] : void 0) ?? {};
2512
+ const c = i.useRef(null), [s, m] = i.useState(-1), { formStyle: u, fieldStyle: d } = F(), f = (x, k, V) => {
2513
+ if (!k) return {};
2514
+ const E = x?.[k];
2515
+ return (V && E ? E[V] : void 0) ?? {};
2523
2516
  }, g = i.useMemo(() => ({
2524
2517
  maxHeight: 200,
2525
2518
  overflowY: "auto",
@@ -2533,7 +2526,7 @@ const lt = ({
2533
2526
  fontSize: "var(--reactaform-popup-font-size, 0.875rem)",
2534
2527
  ...f(u, "multiSelect", "popup"),
2535
2528
  ...f(d, void 0, "popup")
2536
- }), [u, d]), h = i.useMemo(() => ({
2529
+ }), [u, d]), b = i.useMemo(() => ({
2537
2530
  padding: "6px 8px",
2538
2531
  cursor: "pointer",
2539
2532
  display: "flex",
@@ -2544,9 +2537,9 @@ const lt = ({
2544
2537
  ...f(d, void 0, "option")
2545
2538
  }), [u, d]);
2546
2539
  i.useEffect(() => {
2547
- const x = (R) => {
2548
- const $ = R.target;
2549
- !c.current?.contains($) && !a.current?.contains($) && n();
2540
+ const x = (k) => {
2541
+ const V = k.target;
2542
+ !c.current?.contains(V) && !a.current?.contains(V) && n();
2550
2543
  };
2551
2544
  return document.addEventListener("mousedown", x), () => document.removeEventListener("mousedown", x);
2552
2545
  }, [n, a]), i.useEffect(() => {
@@ -2556,30 +2549,30 @@ const lt = ({
2556
2549
  const x = c.current.querySelector(`#multi-opt-${s}`);
2557
2550
  x && requestAnimationFrame(() => x.focus());
2558
2551
  }, [s]);
2559
- const p = 250, b = 200, [C, v] = i.useState(
2552
+ const p = 250, y = 200, [S, v] = i.useState(
2560
2553
  null
2561
- ), [k, N] = i.useState(null);
2554
+ ), [C, I] = i.useState(null);
2562
2555
  if (i.useEffect(() => {
2563
2556
  if (typeof window > "u") return;
2564
2557
  const x = () => {
2565
- let S = e.x, E = e.y, I = p;
2558
+ let R = e.x, E = e.y, M = p;
2566
2559
  const z = a?.current;
2567
2560
  if (z) {
2568
2561
  const q = z.getBoundingClientRect();
2569
- S = q.left, E = q.bottom, I = Math.max(80, Math.round(q.width));
2562
+ R = q.left, E = q.bottom, M = Math.max(80, Math.round(q.width));
2570
2563
  }
2571
- S = Math.min(S, window.innerWidth - I), E = Math.min(E, window.innerHeight - b), v({ left: S, top: E }), N(I);
2564
+ R = Math.min(R, window.innerWidth - M), E = Math.min(E, window.innerHeight - y), v({ left: R, top: E }), I(M);
2572
2565
  };
2573
2566
  x(), window.addEventListener("scroll", x, !0), window.addEventListener("resize", x);
2574
- let R = null;
2575
- const $ = a?.current;
2576
- return typeof ResizeObserver < "u" && $ && (R = new ResizeObserver(() => x()), R.observe($)), () => {
2577
- window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x), R && $ && R.unobserve($);
2567
+ let k = null;
2568
+ const V = a?.current;
2569
+ return typeof ResizeObserver < "u" && V && (k = new ResizeObserver(() => x()), k.observe(V)), () => {
2570
+ window.removeEventListener("scroll", x, !0), window.removeEventListener("resize", x), k && V && k.unobserve(V);
2578
2571
  };
2579
2572
  }, [a, e.x, e.y]), typeof window > "u") return null;
2580
2573
  let w = document.getElementById("popup-root");
2581
2574
  return w || (w = document.createElement("div"), w.id = "popup-root", document.body.appendChild(w)), Ie.createPortal(
2582
- /* @__PURE__ */ y(
2575
+ /* @__PURE__ */ h(
2583
2576
  "div",
2584
2577
  {
2585
2578
  ref: c,
@@ -2587,65 +2580,65 @@ const lt = ({
2587
2580
  "aria-activedescendant": s >= 0 ? `multi-opt-${s}` : void 0,
2588
2581
  style: {
2589
2582
  position: "absolute",
2590
- top: C ? C.top : e.y,
2591
- left: C ? C.left : e.x,
2592
- width: k ?? p,
2583
+ top: S ? S.top : e.y,
2584
+ left: S ? S.left : e.x,
2585
+ width: C ?? p,
2593
2586
  // spread the static popup styles
2594
2587
  ...g
2595
2588
  },
2596
2589
  "data-reactaform-theme": l ? "dark" : "light",
2597
- children: r.map((x, R) => {
2598
- const $ = t.includes(x.value), S = l ? "var(--reactaform-hover-bg, rgba(255,255,255,0.01))" : "var(--reactaform-hover-bg, #eee)", E = {
2599
- ...h,
2600
- background: R === s ? S : h.background
2590
+ children: r.map((x, k) => {
2591
+ const V = t.includes(x.value), R = l ? "var(--reactaform-hover-bg, rgba(255,255,255,0.01))" : "var(--reactaform-hover-bg, #eee)", E = {
2592
+ ...b,
2593
+ background: k === s ? R : b.background
2601
2594
  };
2602
2595
  return /* @__PURE__ */ O(
2603
2596
  "div",
2604
2597
  {
2605
- id: `multi-opt-${R}`,
2606
- onMouseDown: (I) => {
2607
- I.stopPropagation(), o(x.value);
2598
+ id: `multi-opt-${k}`,
2599
+ onMouseDown: (M) => {
2600
+ M.stopPropagation(), o(x.value);
2608
2601
  },
2609
- onKeyDown: (I) => {
2602
+ onKeyDown: (M) => {
2610
2603
  const z = r.length;
2611
- switch (I.key) {
2604
+ switch (M.key) {
2612
2605
  case "ArrowDown":
2613
- I.preventDefault(), m((q) => (q + 1) % z);
2606
+ M.preventDefault(), m((q) => (q + 1) % z);
2614
2607
  break;
2615
2608
  case "ArrowUp":
2616
- I.preventDefault(), m((q) => (q - 1 + z) % z);
2609
+ M.preventDefault(), m((q) => (q - 1 + z) % z);
2617
2610
  break;
2618
2611
  case "Home":
2619
- I.preventDefault(), m(0);
2612
+ M.preventDefault(), m(0);
2620
2613
  break;
2621
2614
  case "End":
2622
- I.preventDefault(), m(z - 1);
2615
+ M.preventDefault(), m(z - 1);
2623
2616
  break;
2624
2617
  case "Enter":
2625
2618
  case " ":
2626
- I.preventDefault(), I.stopPropagation(), o(x.value);
2619
+ M.preventDefault(), M.stopPropagation(), o(x.value);
2627
2620
  break;
2628
2621
  case "Escape":
2629
- I.preventDefault(), n(), a?.current?.focus();
2622
+ M.preventDefault(), n(), a?.current?.focus();
2630
2623
  break;
2631
2624
  }
2632
2625
  },
2633
- tabIndex: R === s ? 0 : -1,
2626
+ tabIndex: k === s ? 0 : -1,
2634
2627
  role: "option",
2635
- "aria-selected": $,
2628
+ "aria-selected": V,
2636
2629
  style: E,
2637
- onMouseEnter: (I) => {
2638
- I.currentTarget.style.background = S, m(R);
2630
+ onMouseEnter: (M) => {
2631
+ M.currentTarget.style.background = R, m(k);
2639
2632
  },
2640
- onMouseLeave: (I) => {
2641
- I.currentTarget.style.background = "transparent", m((z) => z === R ? -1 : z);
2633
+ onMouseLeave: (M) => {
2634
+ M.currentTarget.style.background = "transparent", m((z) => z === k ? -1 : z);
2642
2635
  },
2643
2636
  children: [
2644
- /* @__PURE__ */ y(
2637
+ /* @__PURE__ */ h(
2645
2638
  "input",
2646
2639
  {
2647
2640
  type: "checkbox",
2648
- checked: $,
2641
+ checked: V,
2649
2642
  readOnly: !0,
2650
2643
  style: {
2651
2644
  marginRight: 8,
@@ -2667,14 +2660,14 @@ const lt = ({
2667
2660
  ),
2668
2661
  w
2669
2662
  );
2670
- }, dt = ({
2663
+ }, ft = ({
2671
2664
  field: e,
2672
2665
  value: r,
2673
2666
  onChange: t,
2674
2667
  onError: o
2675
2668
  }) => {
2676
2669
  const { t: n, definitionName: a } = F(), l = i.useRef(null), c = e.min ?? void 0, s = e.max ?? void 0, m = Math.max(1, Math.round(e.step ?? 1)), u = i.useCallback(
2677
- (b) => isNaN(b) ? n("Must be a valid integer") : Number.isInteger(b) ? c !== void 0 && b < c ? n("Must be �?{{1}}", c) : s !== void 0 && b > s ? n("Must be �?{{1}}", s) : H(a, e, b, n) ?? null : n("Must be an integer"),
2670
+ (y) => isNaN(y) ? n("Must be a valid integer") : Number.isInteger(y) ? c !== void 0 && y < c ? n("Must be {{1}}", c) : s !== void 0 && y > s ? n("Must be {{1}}", s) : H(a, e, y, n) ?? null : n("Must be an integer"),
2678
2671
  [a, e, n, c, s]
2679
2672
  ), d = i.useRef(null), f = i.useRef(
2680
2673
  o
@@ -2683,18 +2676,18 @@ const lt = ({
2683
2676
  f.current = o;
2684
2677
  }, [o]), i.useEffect(() => {
2685
2678
  if (document.activeElement === l.current) return;
2686
- const C = String(r), v = u(r);
2687
- l.current && (l.current.value = C), v !== d.current && (d.current = v, f.current?.(v ?? null));
2679
+ const S = String(r), v = u(r);
2680
+ l.current && (l.current.value = S), v !== d.current && (d.current = v, f.current?.(v ?? null));
2688
2681
  }, [r, u]);
2689
- const g = (b) => {
2690
- if (b.trim() === "") return e.required ? n("Value required") : null;
2691
- const v = Number(b);
2682
+ const g = (y) => {
2683
+ if (y.trim() === "") return e.required ? n("Value required") : null;
2684
+ const v = Number(y);
2692
2685
  return u(v);
2693
- }, h = (b) => {
2694
- const C = b.target.value, v = b.target.valueAsNumber, k = g(C);
2695
- t?.(v, k);
2686
+ }, b = (y) => {
2687
+ const S = y.target.value, v = y.target.valueAsNumber, C = g(S);
2688
+ t?.(v, C);
2696
2689
  }, p = g(String(r ?? ""));
2697
- return /* @__PURE__ */ y(T, { field: e, error: p, children: /* @__PURE__ */ y(
2690
+ return /* @__PURE__ */ h(T, { field: e, error: p, children: /* @__PURE__ */ h(
2698
2691
  "input",
2699
2692
  {
2700
2693
  ref: l,
@@ -2704,14 +2697,14 @@ const lt = ({
2704
2697
  min: c,
2705
2698
  max: s,
2706
2699
  step: m,
2707
- onChange: h,
2700
+ onChange: b,
2708
2701
  style: { width: "100%", height: "100%" },
2709
- className: M.input,
2702
+ className: N.input,
2710
2703
  "aria-invalid": !!p,
2711
2704
  "aria-describedby": p ? `${e.name}-error` : void 0
2712
2705
  }
2713
2706
  ) });
2714
- }, pt = ({
2707
+ }, mt = ({
2715
2708
  field: e,
2716
2709
  value: r,
2717
2710
  onChange: t,
@@ -2743,14 +2736,14 @@ const lt = ({
2743
2736
  }, [r, c]);
2744
2737
  const u = (d) => {
2745
2738
  const f = d.target.value, g = f.trim();
2746
- let h = null;
2739
+ let b = null;
2747
2740
  if (g === "") {
2748
- h = e.required ? n("Value required") : null, t?.(f, h);
2741
+ b = e.required ? n("Value required") : null, t?.(f, b);
2749
2742
  return;
2750
2743
  }
2751
- h || (h = c(f)), t?.(f, h);
2744
+ b || (b = c(f)), t?.(f, b);
2752
2745
  };
2753
- return /* @__PURE__ */ y(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ y(
2746
+ return /* @__PURE__ */ h(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ h(
2754
2747
  "input",
2755
2748
  {
2756
2749
  id: e.name,
@@ -2758,12 +2751,12 @@ const lt = ({
2758
2751
  defaultValue: String(r ?? ""),
2759
2752
  ref: a,
2760
2753
  onChange: u,
2761
- className: B(M.input, M.textInput),
2754
+ className: B(N.input, N.textInput),
2762
2755
  "aria-invalid": !!c(String(r ?? "")),
2763
2756
  "aria-describedby": c(String(r ?? "")) ? `${e.name}-error` : void 0
2764
2757
  }
2765
2758
  ) });
2766
- }, gt = ({
2759
+ }, dt = ({
2767
2760
  field: e,
2768
2761
  value: r,
2769
2762
  onChange: t,
@@ -2784,20 +2777,20 @@ const lt = ({
2784
2777
  c.current.querySelectorAll("input[type=radio]")
2785
2778
  );
2786
2779
  if (f && e.options && e.options.length > 0) {
2787
- const h = String(e.options[0].value);
2788
- g.forEach((p) => p.checked = p.value === h), t?.(h, null);
2780
+ const b = String(e.options[0].value);
2781
+ g.forEach((p) => p.checked = p.value === b), t?.(b, null);
2789
2782
  } else
2790
- g.forEach((h) => h.checked = h.value === d);
2783
+ g.forEach((b) => b.checked = b.value === d);
2791
2784
  }
2792
2785
  }, [r, m, t, e.options]);
2793
2786
  const u = (d) => {
2794
2787
  const f = d.target.value, g = m(f);
2795
2788
  s.current?.(g ?? null), t?.(f, g);
2796
2789
  };
2797
- return /* @__PURE__ */ y(T, { field: e, error: m(String(r ?? "")), children: /* @__PURE__ */ y(
2790
+ return /* @__PURE__ */ h(T, { field: e, error: m(String(r ?? "")), children: /* @__PURE__ */ h(
2798
2791
  "div",
2799
2792
  {
2800
- className: M.input,
2793
+ className: N.input,
2801
2794
  role: "radiogroup",
2802
2795
  "aria-labelledby": `${e.name}-label`,
2803
2796
  "aria-invalid": !!m(String(r ?? "")),
@@ -2815,7 +2808,7 @@ const lt = ({
2815
2808
  children: (e.options ?? []).map((d) => /* @__PURE__ */ O(
2816
2809
  "label",
2817
2810
  {
2818
- className: B(M.label),
2811
+ className: B(N.label),
2819
2812
  style: {
2820
2813
  display: l === "column" ? "flex" : "inline-flex",
2821
2814
  gap: "8px",
@@ -2827,7 +2820,7 @@ const lt = ({
2827
2820
  justifyContent: "flex-start"
2828
2821
  },
2829
2822
  children: [
2830
- /* @__PURE__ */ y(
2823
+ /* @__PURE__ */ h(
2831
2824
  "input",
2832
2825
  {
2833
2826
  type: "radio",
@@ -2838,7 +2831,7 @@ const lt = ({
2838
2831
  style: { width: "1.1em", height: "1.1em" }
2839
2832
  }
2840
2833
  ),
2841
- /* @__PURE__ */ y(
2834
+ /* @__PURE__ */ h(
2842
2835
  "span",
2843
2836
  {
2844
2837
  style: {
@@ -2857,10 +2850,10 @@ const lt = ({
2857
2850
  ))
2858
2851
  }
2859
2852
  ) });
2860
- }, ht = {
2853
+ }, pt = {
2861
2854
  display: "flex",
2862
2855
  gap: 4
2863
- }, bt = {
2856
+ }, gt = {
2864
2857
  cursor: "pointer",
2865
2858
  fontSize: "1.5rem",
2866
2859
  lineHeight: 1,
@@ -2868,7 +2861,7 @@ const lt = ({
2868
2861
  marginRight: "0.25rem",
2869
2862
  userSelect: "none",
2870
2863
  transition: "color 0.12s ease"
2871
- }, yt = ({
2864
+ }, ht = ({
2872
2865
  field: e,
2873
2866
  value: r,
2874
2867
  onChange: t,
@@ -2883,55 +2876,55 @@ const lt = ({
2883
2876
  }, [o]), i.useEffect(() => {
2884
2877
  let p = r || 0;
2885
2878
  r < 0 && (p = 0), r > m && (p = m);
2886
- const b = u(p);
2887
- b !== d.current && (d.current = b, f.current?.(b ?? null));
2879
+ const y = u(p);
2880
+ y !== d.current && (d.current = y, f.current?.(y ?? null));
2888
2881
  }, [r, u, m]);
2889
2882
  const g = (p) => {
2890
- const b = u(p);
2891
- t?.(p, b);
2892
- }, h = (() => {
2883
+ const y = u(p);
2884
+ t?.(p, y);
2885
+ }, b = (() => {
2893
2886
  let p = r || 0;
2894
2887
  return p < 0 && (p = 0), p > m && (p = m), p;
2895
2888
  })();
2896
- return /* @__PURE__ */ y(T, { field: e, error: u(h), children: /* @__PURE__ */ y(
2889
+ return /* @__PURE__ */ h(T, { field: e, error: u(b), children: /* @__PURE__ */ h(
2897
2890
  "div",
2898
2891
  {
2899
2892
  role: "radiogroup",
2900
2893
  "aria-labelledby": `${e.name}-label`,
2901
- style: ht,
2902
- "aria-invalid": !!u(h),
2903
- "aria-describedby": u(h) ? `${e.name}-error` : void 0,
2894
+ style: pt,
2895
+ "aria-invalid": !!u(b),
2896
+ "aria-describedby": u(b) ? `${e.name}-error` : void 0,
2904
2897
  children: (() => {
2905
- const p = e.icon, b = p && String(p).trim() ? String(p) : "★";
2906
- return [...Array(m)].map((C, v) => {
2907
- const k = v < h, w = l !== null && v <= l || k ? "gold" : "lightgray";
2908
- return /* @__PURE__ */ y(
2898
+ const p = e.icon, y = p && String(p).trim() ? String(p) : "★";
2899
+ return [...Array(m)].map((S, v) => {
2900
+ const C = v < b, w = l !== null && v <= l || C ? "gold" : "lightgray";
2901
+ return /* @__PURE__ */ h(
2909
2902
  "span",
2910
2903
  {
2911
2904
  ref: (x) => s.current[v] = x,
2912
2905
  role: "radio",
2913
- tabIndex: h > 0 ? v === h - 1 ? 0 : -1 : v === 0 ? 0 : -1,
2914
- "aria-checked": k,
2906
+ tabIndex: b > 0 ? v === b - 1 ? 0 : -1 : v === 0 ? 0 : -1,
2907
+ "aria-checked": C,
2915
2908
  onClick: () => g(v + 1),
2916
2909
  onKeyDown: (x) => {
2917
2910
  if (x.key === "Enter" || x.key === " ")
2918
2911
  x.preventDefault(), g(v + 1);
2919
2912
  else if (x.key === "ArrowRight" || x.key === "ArrowUp") {
2920
2913
  x.preventDefault();
2921
- const R = Math.min(m - 1, v + 1);
2922
- s.current[R]?.focus();
2914
+ const k = Math.min(m - 1, v + 1);
2915
+ s.current[k]?.focus();
2923
2916
  } else if (x.key === "ArrowLeft" || x.key === "ArrowDown") {
2924
2917
  x.preventDefault();
2925
- const R = Math.max(0, v - 1);
2926
- s.current[R]?.focus();
2918
+ const k = Math.max(0, v - 1);
2919
+ s.current[k]?.focus();
2927
2920
  }
2928
2921
  },
2929
2922
  onMouseEnter: () => c(v),
2930
2923
  onMouseLeave: () => c(null),
2931
- style: { ...bt, color: w },
2924
+ style: { ...gt, color: w },
2932
2925
  "aria-label": `Rating ${v + 1}`,
2933
2926
  title: n(`${e.displayName} ${v + 1}`),
2934
- children: b
2927
+ children: y
2935
2928
  },
2936
2929
  v
2937
2930
  );
@@ -2939,7 +2932,7 @@ const lt = ({
2939
2932
  })()
2940
2933
  }
2941
2934
  ) });
2942
- }, vt = ({
2935
+ }, bt = ({
2943
2936
  field: e,
2944
2937
  value: r,
2945
2938
  onChange: t,
@@ -2958,16 +2951,16 @@ const lt = ({
2958
2951
  (p) => p === "" ? e.required ? n("Value required") : null : e.minLength !== void 0 && p.length < e.minLength ? n("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && p.length > e.maxLength ? n("Must be at most {{1}} characters", e.maxLength) : m && !m.test(p) ? e.patternErrorMessage ? n(e.patternErrorMessage) : n("Input does not match pattern: {{1}}", e.pattern) : H(a, e, p, n),
2959
2952
  [e, a, n, m]
2960
2953
  ), d = (p) => {
2961
- const b = p.target.value, C = u(b);
2962
- t?.(b, C);
2954
+ const y = p.target.value, S = u(y);
2955
+ t?.(y, S);
2963
2956
  };
2964
2957
  i.useEffect(() => {
2965
2958
  const p = u(r ?? "");
2966
2959
  l.current && l.current.value !== String(r ?? "") && (l.current.value = String(r ?? "")), p !== c.current && (c.current = p, s.current?.(p ?? null));
2967
2960
  }, [r, u]);
2968
- const [f, g] = i.useState(!1), h = () => g((p) => !p);
2969
- return /* @__PURE__ */ y(T, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: 8, width: "100%" }, children: [
2970
- /* @__PURE__ */ y(
2961
+ const [f, g] = i.useState(!1), b = () => g((p) => !p);
2962
+ return /* @__PURE__ */ h(T, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: 8, width: "100%" }, children: [
2963
+ /* @__PURE__ */ h(
2971
2964
  "input",
2972
2965
  {
2973
2966
  id: e.name,
@@ -2975,17 +2968,17 @@ const lt = ({
2975
2968
  defaultValue: String(r ?? ""),
2976
2969
  ref: l,
2977
2970
  onChange: d,
2978
- className: B(M.input, M.textInput),
2971
+ className: B(N.input, N.textInput),
2979
2972
  style: { flex: 1, minWidth: 0 },
2980
2973
  "aria-invalid": !!u(String(r ?? "")),
2981
2974
  "aria-describedby": u(String(r ?? "")) ? `${e.name}-error` : void 0
2982
2975
  }
2983
2976
  ),
2984
- /* @__PURE__ */ y(
2977
+ /* @__PURE__ */ h(
2985
2978
  "button",
2986
2979
  {
2987
2980
  type: "button",
2988
- onClick: h,
2981
+ onClick: b,
2989
2982
  "aria-label": n(f ? "Hide password" : "Show password"),
2990
2983
  style: {
2991
2984
  background: "transparent",
@@ -3000,40 +2993,40 @@ const lt = ({
3000
2993
  }
3001
2994
  )
3002
2995
  ] }) });
3003
- }, xt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
3004
- function wt(e) {
3005
- return xt.test(e);
2996
+ }, yt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/;
2997
+ function vt(e) {
2998
+ return yt.test(e);
3006
2999
  }
3007
- const St = ({
3000
+ const xt = ({
3008
3001
  field: e,
3009
3002
  value: r,
3010
3003
  onChange: t,
3011
3004
  onError: o
3012
3005
  }) => {
3013
3006
  const { t: n, definitionName: a } = F(), l = i.useRef(null), c = i.useRef(null), s = i.useCallback(
3014
- (h) => {
3007
+ (b) => {
3015
3008
  let p = null;
3016
- if (h.trim() === "")
3009
+ if (b.trim() === "")
3017
3010
  return n("Value required");
3018
- if (!wt(h))
3011
+ if (!vt(b))
3019
3012
  return n("Invalid number");
3020
- const b = Number(h);
3021
- return typeof e.min == "number" && b < e.min ? n("Value should be at least {{1}}", e.min) : typeof e.max == "number" && b > e.max ? n("Value should be at most {{1}}", e.max) : (p || (p = H(a, e, b, n)), p);
3013
+ const y = Number(b);
3014
+ return typeof e.min == "number" && y < e.min ? n("Value should be at least {{1}}", e.min) : typeof e.max == "number" && y > e.max ? n("Value should be at most {{1}}", e.max) : (p || (p = H(a, e, y, n)), p);
3022
3015
  },
3023
3016
  [a, e, n]
3024
3017
  ), m = i.useRef(null), u = i.useRef(o);
3025
3018
  i.useEffect(() => {
3026
3019
  u.current = o;
3027
3020
  }, [o]), i.useEffect(() => {
3028
- const h = String(r), p = s(h);
3029
- c.current && document.activeElement !== c.current && (c.current.value = isNaN(Number(h)) ? String(e.min ?? 0) : String(Number(h))), l.current && document.activeElement !== l.current && (l.current.value = h), p !== m.current && (m.current = p, u.current?.(p ?? null));
3021
+ const b = String(r), p = s(b);
3022
+ c.current && document.activeElement !== c.current && (c.current.value = isNaN(Number(b)) ? String(e.min ?? 0) : String(Number(b))), l.current && document.activeElement !== l.current && (l.current.value = b), p !== m.current && (m.current = p, u.current?.(p ?? null));
3030
3023
  }, [r, s, e.min]);
3031
- const d = e.min ?? 0, f = e.max ?? 100, g = (h) => {
3032
- const p = h.target.value, b = s(p);
3033
- t?.(p, b);
3024
+ const d = e.min ?? 0, f = e.max ?? 100, g = (b) => {
3025
+ const p = b.target.value, y = s(p);
3026
+ t?.(p, y);
3034
3027
  };
3035
- return /* @__PURE__ */ y(T, { field: e, error: s(String(r ?? "")), children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
3036
- /* @__PURE__ */ y(
3028
+ return /* @__PURE__ */ h(T, { field: e, error: s(String(r ?? "")), children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "8px", width: "100%" }, children: [
3029
+ /* @__PURE__ */ h(
3037
3030
  "input",
3038
3031
  {
3039
3032
  ref: c,
@@ -3044,16 +3037,16 @@ const St = ({
3044
3037
  min: d,
3045
3038
  max: f,
3046
3039
  style: {
3047
- padding: "0px, 0px",
3040
+ padding: 0,
3048
3041
  // Remove padding to make Chrome browser works fine.
3049
3042
  flex: 1
3050
3043
  },
3051
- className: M.rangeInput,
3044
+ className: N.rangeInput,
3052
3045
  "aria-invalid": !!s(String(r ?? "")),
3053
3046
  "aria-describedby": s(String(r ?? "")) ? `${e.name}-error` : void 0
3054
3047
  }
3055
3048
  ),
3056
- /* @__PURE__ */ y(
3049
+ /* @__PURE__ */ h(
3057
3050
  "input",
3058
3051
  {
3059
3052
  id: e.name,
@@ -3069,22 +3062,22 @@ const St = ({
3069
3062
  textAlign: "center",
3070
3063
  flexShrink: 0
3071
3064
  },
3072
- className: B(M.input, M.textInput),
3065
+ className: B(N.input, N.textInput),
3073
3066
  "aria-invalid": !!s(String(r ?? "")),
3074
3067
  "aria-describedby": s(String(r ?? "")) ? `${e.name}-error` : void 0
3075
3068
  }
3076
3069
  )
3077
3070
  ] }) });
3078
- }, Ct = ({
3071
+ }, wt = ({
3079
3072
  field: e,
3080
3073
  value: r,
3081
3074
  onChange: t,
3082
3075
  onError: o
3083
3076
  }) => {
3084
- const { t: n, formStyle: a, fieldStyle: l, definitionName: c } = F(), s = a, m = l, u = (w, x, R) => {
3077
+ const { t: n, formStyle: a, fieldStyle: l, definitionName: c } = F(), s = a, m = l, u = (w, x, k) => {
3085
3078
  if (!x) return {};
3086
- const $ = w?.[x];
3087
- return (R && $ ? $[R] : void 0) ?? {};
3079
+ const V = w?.[x];
3080
+ return (k && V ? V[k] : void 0) ?? {};
3088
3081
  }, d = i.useMemo(() => ({
3089
3082
  display: "inline-block",
3090
3083
  position: "relative",
@@ -3124,7 +3117,7 @@ const St = ({
3124
3117
  borderColor: "transparent",
3125
3118
  ...u(s, "switch", "slider"),
3126
3119
  ...u(m, void 0, "slider")
3127
- }), [s, m]), h = i.useMemo(() => ({
3120
+ }), [s, m]), b = i.useMemo(() => ({
3128
3121
  position: "absolute",
3129
3122
  height: 16,
3130
3123
  width: 16,
@@ -3136,29 +3129,29 @@ const St = ({
3136
3129
  boxShadow: "0 1px 3px rgba(0, 0, 0, 0.3)",
3137
3130
  ...u(s, "switch", "knob"),
3138
3131
  ...u(m, void 0, "knob")
3139
- }), [s, m]), p = !!r, b = i.useRef(null), C = i.useRef(o), v = i.useCallback((w) => w ? H(c, e, w, n) ?? null : e.required ? n("Value required") : null, [e, n, c]), k = () => {
3132
+ }), [s, m]), p = !!r, y = i.useRef(null), S = i.useRef(o), v = i.useCallback((w) => w ? H(c, e, w, n) ?? null : e.required ? n("Value required") : null, [e, n, c]), C = () => {
3140
3133
  const w = !p, x = v(w);
3141
3134
  t?.(w, x);
3142
3135
  };
3143
3136
  i.useEffect(() => {
3144
- C.current = o;
3137
+ S.current = o;
3145
3138
  }, [o]), i.useEffect(() => {
3146
3139
  const w = v(p);
3147
- w !== b.current && (b.current = w, C.current?.(w ?? null));
3140
+ w !== y.current && (y.current = w, S.current?.(w ?? null));
3148
3141
  }, [p, e, v]);
3149
- const N = e.name;
3150
- return /* @__PURE__ */ y(T, { field: e, error: v(p), rightAlign: !1, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
3151
- /* @__PURE__ */ y(
3142
+ const I = e.name;
3143
+ return /* @__PURE__ */ h(T, { field: e, error: v(p), rightAlign: !1, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
3144
+ /* @__PURE__ */ h(
3152
3145
  "label",
3153
3146
  {
3154
- className: M.label,
3155
- htmlFor: N,
3147
+ className: N.label,
3148
+ htmlFor: I,
3156
3149
  style: { textAlign: "left", justifyContent: "flex-start" },
3157
3150
  children: n(e.displayName)
3158
3151
  }
3159
3152
  ),
3160
3153
  /* @__PURE__ */ O("label", { style: d, children: [
3161
- /* @__PURE__ */ y(
3154
+ /* @__PURE__ */ h(
3162
3155
  "input",
3163
3156
  {
3164
3157
  id: e.name,
@@ -3172,7 +3165,7 @@ const St = ({
3172
3165
  tabIndex: -1
3173
3166
  }
3174
3167
  ),
3175
- /* @__PURE__ */ y(
3168
+ /* @__PURE__ */ h(
3176
3169
  "span",
3177
3170
  {
3178
3171
  role: "switch",
@@ -3181,17 +3174,17 @@ const St = ({
3181
3174
  "aria-checked": p,
3182
3175
  "aria-invalid": !!v(p),
3183
3176
  "aria-describedby": v(p) ? `${e.name}-error` : void 0,
3184
- onClick: k,
3177
+ onClick: C,
3185
3178
  onKeyDown: (w) => {
3186
- (w.key === " " || w.key === "Spacebar" || w.key === "Space" || w.key === "Enter") && (w.preventDefault(), k());
3179
+ (w.key === " " || w.key === "Spacebar" || w.key === "Space" || w.key === "Enter") && (w.preventDefault(), C());
3187
3180
  },
3188
3181
  className: `reactaform-switch ${p ? "active checked on" : ""} `,
3189
3182
  style: p ? { ...g, backgroundColor: "var(--reactaform-switch-on-bg, #22c55e)", borderColor: "var(--reactaform-switch-on-border, #16a34a)" } : g,
3190
- children: /* @__PURE__ */ y(
3183
+ children: /* @__PURE__ */ h(
3191
3184
  "span",
3192
3185
  {
3193
3186
  style: {
3194
- ...h,
3187
+ ...b,
3195
3188
  transform: p ? "translateX(20px)" : void 0
3196
3189
  }
3197
3190
  }
@@ -3219,13 +3212,13 @@ const St = ({
3219
3212
  (f) => f.trim() === "" ? e.required ? n("Value required") : null : e.minLength !== void 0 && f.length < e.minLength ? n("Must be at least {{1}} characters", e.minLength) : e.maxLength !== void 0 && f.length > e.maxLength ? n("Must be at most {{1}} characters", e.maxLength) : m && !m.test(f) ? e.patternErrorMessage ? n(e.patternErrorMessage) : n("Input does not match pattern: {{1}}", e.pattern) : H(a, e, f, n),
3220
3213
  [e, a, n, m]
3221
3214
  ), d = (f) => {
3222
- const g = f.target.value, h = u(g);
3223
- t?.(g, h);
3215
+ const g = f.target.value, b = u(g);
3216
+ t?.(g, b);
3224
3217
  };
3225
3218
  return i.useEffect(() => {
3226
3219
  const f = u(r);
3227
3220
  l.current && l.current.value !== String(r ?? "") && (l.current.value = String(r ?? "")), f !== c.current && (c.current = f, s.current?.(f ?? null));
3228
- }, [r, u]), /* @__PURE__ */ y(T, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ y(
3221
+ }, [r, u]), /* @__PURE__ */ h(T, { field: e, error: u(String(r ?? "")), children: /* @__PURE__ */ h(
3229
3222
  "input",
3230
3223
  {
3231
3224
  id: e.name,
@@ -3235,10 +3228,10 @@ const St = ({
3235
3228
  defaultValue: String(r ?? ""),
3236
3229
  ref: l,
3237
3230
  onChange: d,
3238
- className: B(M.input, M.textInput)
3231
+ className: B(N.input, N.textInput)
3239
3232
  }
3240
3233
  ) });
3241
- }, kt = ({
3234
+ }, St = ({
3242
3235
  field: e,
3243
3236
  value: r,
3244
3237
  onChange: t,
@@ -3252,18 +3245,18 @@ const St = ({
3252
3245
  if (!d || d.trim() === "")
3253
3246
  return e.required || e.min || e.max ? n("Value required") : null;
3254
3247
  const f = (p) => {
3255
- const b = p.split(":").map((v) => parseInt(v, 10));
3256
- if (b.some((v) => Number.isNaN(v))) return NaN;
3257
- let C = 0;
3258
- if (b.length === 3)
3259
- C = b[0] * 3600 + b[1] * 60 + b[2];
3260
- else if (b.length === 2)
3261
- C = b[0] * 3600 + b[1] * 60;
3262
- else if (b.length === 1)
3263
- C = b[0] * 3600;
3248
+ const y = p.split(":").map((v) => parseInt(v, 10));
3249
+ if (y.some((v) => Number.isNaN(v))) return NaN;
3250
+ let S = 0;
3251
+ if (y.length === 3)
3252
+ S = y[0] * 3600 + y[1] * 60 + y[2];
3253
+ else if (y.length === 2)
3254
+ S = y[0] * 3600 + y[1] * 60;
3255
+ else if (y.length === 1)
3256
+ S = y[0] * 3600;
3264
3257
  else
3265
3258
  return NaN;
3266
- return C;
3259
+ return S;
3267
3260
  }, g = f(d);
3268
3261
  if (Number.isNaN(g)) return n("Invalid time format");
3269
3262
  if (e.min && typeof e.min == "string") {
@@ -3284,7 +3277,7 @@ const St = ({
3284
3277
  return i.useEffect(() => {
3285
3278
  const d = m(r);
3286
3279
  d !== l.current && (l.current = d, c.current?.(d ?? null));
3287
- }, [r, m]), /* @__PURE__ */ y(T, { field: e, error: m(r), children: /* @__PURE__ */ y(
3280
+ }, [r, m]), /* @__PURE__ */ h(T, { field: e, error: m(r), children: /* @__PURE__ */ h(
3288
3281
  "input",
3289
3282
  {
3290
3283
  id: e.name,
@@ -3294,13 +3287,13 @@ const St = ({
3294
3287
  onChange: u,
3295
3288
  min: typeof e.min == "string" ? e.min : void 0,
3296
3289
  max: typeof e.max == "string" ? e.max : void 0,
3297
- className: B(M.input, M.textInput),
3290
+ className: B(N.input, N.textInput),
3298
3291
  "aria-invalid": !!m(r),
3299
3292
  "aria-describedby": m(r) ? `${e.name}-error` : void 0
3300
3293
  }
3301
3294
  ) });
3302
3295
  };
3303
- function Rt({
3296
+ function Ct({
3304
3297
  pos: e,
3305
3298
  options: r,
3306
3299
  onClose: t,
@@ -3308,14 +3301,14 @@ function Rt({
3308
3301
  }) {
3309
3302
  const n = i.useRef(null), a = i.useRef(!1), l = typeof window < "u" ? document.getElementById("popup-root") || document.body : null;
3310
3303
  if (i.useEffect(() => {
3311
- function g(h) {
3312
- a.current || h.target.dataset?.popupMenu === "item" || n.current && h.target instanceof Node && !n.current.contains(h.target) && t();
3304
+ function g(b) {
3305
+ a.current || b.target.dataset?.popupMenu === "item" || n.current && b.target instanceof Node && !n.current.contains(b.target) && t();
3313
3306
  }
3314
3307
  return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
3315
3308
  }, [t]), !l || r === void 0 || r.length === 0 || !e || e.x == null || e.y == null) return null;
3316
3309
  const c = e.x, s = e.y, m = typeof window < "u" ? window.innerWidth : 1024, u = Math.max(0, m - 160), d = Math.max(0, Math.min(c, u)), f = Math.max(0, s);
3317
3310
  return Ie.createPortal(
3318
- /* @__PURE__ */ y(
3311
+ /* @__PURE__ */ h(
3319
3312
  "div",
3320
3313
  {
3321
3314
  ref: n,
@@ -3334,7 +3327,7 @@ function Rt({
3334
3327
  minWidth: "var(--reactaform-menu-min-width, 150px)",
3335
3328
  pointerEvents: "auto"
3336
3329
  },
3337
- children: r.map((g, h) => /* @__PURE__ */ y(
3330
+ children: r.map((g, b) => /* @__PURE__ */ h(
3338
3331
  "div",
3339
3332
  {
3340
3333
  "data-popup-menu": "item",
@@ -3350,7 +3343,7 @@ function Rt({
3350
3343
  padding: "var(--reactaform-menu-item-padding, 8px 12px)",
3351
3344
  cursor: "pointer",
3352
3345
  fontSize: "var(--reactaform-menu-item-font-size, 0.8em)",
3353
- borderBottom: h < r.length - 1 ? "1px solid var(--reactaform-border-light, #eee)" : void 0,
3346
+ borderBottom: b < r.length - 1 ? "1px solid var(--reactaform-border-light, #eee)" : void 0,
3354
3347
  transition: "background-color 0.15s ease"
3355
3348
  },
3356
3349
  onMouseEnter: (p) => {
@@ -3361,7 +3354,7 @@ function Rt({
3361
3354
  },
3362
3355
  children: g.label
3363
3356
  },
3364
- g.label ?? h
3357
+ g.label ?? b
3365
3358
  ))
3366
3359
  }
3367
3360
  ),
@@ -3369,7 +3362,7 @@ function Rt({
3369
3362
  );
3370
3363
  }
3371
3364
  const ie = {};
3372
- function Et(e, r) {
3365
+ function kt(e, r) {
3373
3366
  if (e in ie)
3374
3367
  return;
3375
3368
  const t = Oe[e] ?? {}, o = {}, n = {}, a = {};
@@ -3383,7 +3376,7 @@ function Et(e, r) {
3383
3376
  reverseLabels: a
3384
3377
  };
3385
3378
  }
3386
- function Nt(e, r, t) {
3379
+ function Rt(e, r, t) {
3387
3380
  if (e === "C") {
3388
3381
  if (r === "F") return t * (9 / 5) + 32;
3389
3382
  if (r === "K") return t + 273.15;
@@ -3396,11 +3389,11 @@ function Nt(e, r, t) {
3396
3389
  }
3397
3390
  return t;
3398
3391
  }
3399
- function It(e, r, t) {
3392
+ function Et(e, r, t) {
3400
3393
  if (!Number.isFinite(e)) return [];
3401
3394
  if (t === ie.temperature)
3402
3395
  return Object.keys(t.labels).map((a) => {
3403
- const l = Nt(r, a, e);
3396
+ const l = Rt(r, a, e);
3404
3397
  return Number.isFinite(l) ? { label: `${l.toFixed(6)} ${a}`, value: l.toString(), unit: a } : { label: `${String(l)} ${a}`, value: String(l), unit: a };
3405
3398
  });
3406
3399
  const n = t.factors[r];
@@ -3412,75 +3405,75 @@ function It(e, r, t) {
3412
3405
  function me(e, r) {
3413
3406
  return e in r.labels ? e : r.reverseLabels && r.reverseLabels[e] ? r.reverseLabels[e] : null;
3414
3407
  }
3415
- const Mt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, $t = ({
3408
+ const Nt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, It = ({
3416
3409
  unitFactors: e,
3417
3410
  field: r,
3418
3411
  value: t,
3419
3412
  onChange: o,
3420
3413
  onError: n
3421
3414
  }) => {
3422
- const { t: a, definitionName: l } = F(), c = i.useRef(null), s = i.useRef(null), m = i.useRef(null), [u, d] = i.useState(null), [f, g] = i.useState(null), [h, p] = i.useState(!1), [b, C] = i.useState(null), [v, k] = i.useState([]), N = i.useCallback(
3423
- (D, V) => {
3415
+ const { t: a, definitionName: l } = F(), c = i.useRef(null), s = i.useRef(null), m = i.useRef(null), [u, d] = i.useState(null), [f, g] = i.useState(null), [b, p] = i.useState(!1), [y, S] = i.useState(null), [v, C] = i.useState([]), I = i.useCallback(
3416
+ (D, $) => {
3424
3417
  if (!D || D.trim() === "")
3425
3418
  return r.required ? a("Value required") : null;
3426
- if (!Mt.test(D)) return a("Must be a valid number");
3427
- const L = H(l, r, [D, V], a);
3419
+ if (!Nt.test(D)) return a("Must be a valid number");
3420
+ const L = H(l, r, [D, $], a);
3428
3421
  return L || null;
3429
3422
  },
3430
3423
  [l, r, a]
3431
3424
  ), w = e.reverseLabels !== void 0 ? e.reverseLabels : Object.fromEntries(
3432
- Object.entries(e.labels).map(([D, V]) => [V, D])
3425
+ Object.entries(e.labels).map(([D, $]) => [$, D])
3433
3426
  );
3434
3427
  i.useEffect(() => {
3435
3428
  const D = String(t[0]);
3436
- let V = t[1] ?? e.default;
3437
- V = me(V, e) || V;
3429
+ let $ = t[1] ?? e.default;
3430
+ $ = me($, e) || $;
3438
3431
  const L = document.activeElement;
3439
- L === c.current || L === s.current || (c.current && (c.current.value = D), s.current && (s.current.value = V), m.current !== null && (cancelAnimationFrame(m.current), m.current = null), m.current = requestAnimationFrame(() => {
3432
+ L === c.current || L === s.current || (c.current && (c.current.value = D), s.current && (s.current.value = $), m.current !== null && (cancelAnimationFrame(m.current), m.current = null), m.current = requestAnimationFrame(() => {
3440
3433
  m.current = null, d(null), g(null);
3441
3434
  }));
3442
3435
  }, [t, e]), i.useEffect(() => () => {
3443
3436
  m.current !== null && (cancelAnimationFrame(m.current), m.current = null);
3444
3437
  }, []);
3445
- const x = i.useRef(null), R = i.useRef(
3438
+ const x = i.useRef(null), k = i.useRef(
3446
3439
  n
3447
3440
  );
3448
3441
  i.useEffect(() => {
3449
- R.current = n;
3442
+ k.current = n;
3450
3443
  }, [n]), i.useEffect(() => {
3451
3444
  const D = String(t[0]);
3452
- let V = t[1] ?? e.default;
3453
- V = me(V, e) || V;
3454
- const L = N(D, V);
3455
- L !== x.current && (x.current = L, R.current?.(L ?? null));
3456
- }, [t, e, N]);
3457
- const $ = (D, V, L) => {
3458
- const _ = w[V] || V;
3445
+ let $ = t[1] ?? e.default;
3446
+ $ = me($, e) || $;
3447
+ const L = I(D, $);
3448
+ L !== x.current && (x.current = L, k.current?.(L ?? null));
3449
+ }, [t, e, I]);
3450
+ const V = (D, $, L) => {
3451
+ const _ = w[$] || $;
3459
3452
  o?.([D, _], L);
3460
- }, S = (D) => {
3461
- const V = D.target.value, L = s.current ? s.current.value : e.default, _ = N(V, L);
3462
- d(V), $(V, L, _);
3453
+ }, R = (D) => {
3454
+ const $ = D.target.value, L = s.current ? s.current.value : e.default, _ = I($, L);
3455
+ d($), V($, L, _);
3463
3456
  }, E = (D) => {
3464
- const V = D.target.value, L = c.current ? c.current.value : String(t[0] ?? ""), _ = N(L, V);
3465
- g(V), s.current && (s.current.value = V), $(L, V, _);
3466
- }, I = (D) => {
3467
- const V = c.current ? c.current.value : String(t[0] ?? ""), L = parseFloat(V), _ = s.current ? s.current.value : e.default;
3468
- if (N(V, _) || !V.trim() || !Number.isFinite(L))
3457
+ const $ = D.target.value, L = c.current ? c.current.value : String(t[0] ?? ""), _ = I(L, $);
3458
+ g($), s.current && (s.current.value = $), V(L, $, _);
3459
+ }, M = (D) => {
3460
+ const $ = c.current ? c.current.value : String(t[0] ?? ""), L = parseFloat($), _ = s.current ? s.current.value : e.default;
3461
+ if (I($, _) || !$.trim() || !Number.isFinite(L))
3469
3462
  return;
3470
3463
  const le = D.currentTarget.getBoundingClientRect(), he = le.left, ee = le.bottom;
3471
- C({ x: he, y: ee });
3472
- const A = It(L, _, e);
3464
+ S({ x: he, y: ee });
3465
+ const A = Et(L, _, e);
3473
3466
  if (A.length === 0) {
3474
- k([]), p(!1);
3467
+ C([]), p(!1);
3475
3468
  return;
3476
3469
  }
3477
- k(A), p((j) => !j);
3470
+ C(A), p((j) => !j);
3478
3471
  }, z = (D) => {
3479
- const { value: V, unit: L } = D;
3480
- p(!1), C(null), c.current && (c.current.value = V), s.current && (s.current.value = L), d(V), g(L);
3481
- const _ = N(V, L);
3482
- $(V, L, _);
3483
- }, q = String(t[0] ?? ""), te = me(t[1] ?? e.default, e) || (t[1] ?? e.default), ne = u ?? q, Y = !!N(ne, f ?? te) || !ne.trim(), ce = {
3472
+ const { value: $, unit: L } = D;
3473
+ p(!1), S(null), c.current && (c.current.value = $), s.current && (s.current.value = L), d($), g(L);
3474
+ const _ = I($, L);
3475
+ V($, L, _);
3476
+ }, q = String(t[0] ?? ""), te = me(t[1] ?? e.default, e) || (t[1] ?? e.default), ne = u ?? q, Y = !!I(ne, f ?? te) || !ne.trim(), ce = {
3484
3477
  width: "var(--reactaform-unit-btn-width, 2.5em)",
3485
3478
  height: "var(--reactaform-unit-btn-height, 2.5em)",
3486
3479
  padding: "var(--reactaform-unit-btn-padding, 0)",
@@ -3493,23 +3486,23 @@ const Mt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, $t = ({
3493
3486
  display: "flex",
3494
3487
  alignItems: "center",
3495
3488
  justifyContent: "center"
3496
- }, G = N(q, te);
3497
- return /* @__PURE__ */ y(T, { field: r, error: G, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "var(--reactaform-unit-gap, 8px)", width: "100%" }, children: [
3498
- /* @__PURE__ */ y(
3489
+ }, G = I(q, te);
3490
+ return /* @__PURE__ */ h(T, { field: r, error: G, children: /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center", gap: "var(--reactaform-unit-gap, 8px)", width: "100%" }, children: [
3491
+ /* @__PURE__ */ h(
3499
3492
  "input",
3500
3493
  {
3501
3494
  id: r.name,
3502
3495
  type: "text",
3503
3496
  ref: c,
3504
3497
  defaultValue: String(t[0] ?? ""),
3505
- onChange: S,
3498
+ onChange: R,
3506
3499
  style: { width: "var(--reactaform-unit-input-width, 100px)" },
3507
- className: B(M.input, M.textInput),
3500
+ className: B(N.input, N.textInput),
3508
3501
  "aria-invalid": !!G,
3509
3502
  "aria-describedby": G ? `${r.name}-error` : void 0
3510
3503
  }
3511
3504
  ),
3512
- /* @__PURE__ */ y(
3505
+ /* @__PURE__ */ h(
3513
3506
  "select",
3514
3507
  {
3515
3508
  id: `${r.name}-unit`,
@@ -3517,24 +3510,24 @@ const Mt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, $t = ({
3517
3510
  defaultValue: me(t[1] ?? e.default, e) || (t[1] ?? e.default),
3518
3511
  onChange: E,
3519
3512
  className: B(
3520
- M.input,
3521
- M.inputSelect
3513
+ N.input,
3514
+ N.inputSelect
3522
3515
  ),
3523
3516
  "aria-invalid": !!G,
3524
3517
  "aria-describedby": G ? `${r.name}-error` : void 0,
3525
- children: Object.keys(e.labels).map((D) => /* @__PURE__ */ y("option", { value: D, children: e.labels[D] ?? D }, D))
3518
+ children: Object.keys(e.labels).map((D) => /* @__PURE__ */ h("option", { value: D, children: e.labels[D] ?? D }, D))
3526
3519
  }
3527
3520
  ),
3528
3521
  /* @__PURE__ */ O("div", { style: { display: "flex", alignItems: "center" }, children: [
3529
- /* @__PURE__ */ y(
3522
+ /* @__PURE__ */ h(
3530
3523
  "button",
3531
3524
  {
3532
- onClick: I,
3525
+ onClick: M,
3533
3526
  "aria-disabled": Y,
3534
3527
  disabled: Y,
3535
3528
  style: ce,
3536
- className: M.button,
3537
- children: /* @__PURE__ */ y(
3529
+ className: N.button,
3530
+ children: /* @__PURE__ */ h(
3538
3531
  "span",
3539
3532
  {
3540
3533
  style: {
@@ -3548,13 +3541,13 @@ const Mt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, $t = ({
3548
3541
  )
3549
3542
  }
3550
3543
  ),
3551
- h && v && /* @__PURE__ */ y(
3552
- Rt,
3544
+ b && v && /* @__PURE__ */ h(
3545
+ Ct,
3553
3546
  {
3554
- pos: b,
3547
+ pos: y,
3555
3548
  options: v,
3556
3549
  onClose: () => {
3557
- C(null), p(!1);
3550
+ S(null), p(!1);
3558
3551
  },
3559
3552
  onClickOption: z
3560
3553
  }
@@ -3562,13 +3555,13 @@ const Mt = /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][-+]?\d+)?$/, $t = ({
3562
3555
  ] })
3563
3556
  ] }) });
3564
3557
  };
3565
- function Vt({ field: e, value: r, onChange: t }) {
3558
+ function Mt({ field: e, value: r, onChange: t }) {
3566
3559
  const { t: o } = F(), n = e.dimension;
3567
3560
  if (!n) return null;
3568
- ie[n] || Et(n, o);
3561
+ ie[n] || kt(n, o);
3569
3562
  const a = ie[n];
3570
- return a ? /* @__PURE__ */ y(
3571
- $t,
3563
+ return a ? /* @__PURE__ */ h(
3564
+ It,
3572
3565
  {
3573
3566
  unitFactors: a,
3574
3567
  field: e,
@@ -3583,7 +3576,7 @@ const Ke = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
3583
3576
  } catch {
3584
3577
  return !1;
3585
3578
  }
3586
- }, At = ({
3579
+ }, $t = ({
3587
3580
  field: e,
3588
3581
  value: r,
3589
3582
  onChange: t,
@@ -3595,11 +3588,11 @@ const Ke = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
3595
3588
  if (f === "")
3596
3589
  return e.required ? n("Value required") : null;
3597
3590
  if (!Ke.test(f) && !Je(f)) {
3598
- const h = e.allowRelative === !0;
3591
+ const b = e.allowRelative === !0;
3599
3592
  let p = !1;
3600
3593
  if (Ke.test(f) || Je(f))
3601
3594
  p = !0;
3602
- else if (h)
3595
+ else if (b)
3603
3596
  try {
3604
3597
  new URL(f, "http://example.com"), p = !0;
3605
3598
  } catch {
@@ -3619,7 +3612,7 @@ const Ke = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
3619
3612
  }, [o]), i.useEffect(() => {
3620
3613
  const d = r ?? "", f = c(d);
3621
3614
  l.current && l.current.value !== String(d) && (l.current.value = String(d)), f !== m.current && (m.current = f, u.current?.(f ?? null));
3622
- }, [r, c]), /* @__PURE__ */ y(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ y(
3615
+ }, [r, c]), /* @__PURE__ */ h(T, { field: e, error: c(String(r ?? "")), children: /* @__PURE__ */ h(
3623
3616
  "input",
3624
3617
  {
3625
3618
  id: e.name,
@@ -3628,13 +3621,13 @@ const Ke = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
3628
3621
  ref: l,
3629
3622
  onChange: s,
3630
3623
  style: { alignItems: "left" },
3631
- className: B(M.input, M.textInput),
3624
+ className: B(N.input, N.textInput),
3632
3625
  placeholder: "https://example.com",
3633
3626
  "aria-invalid": !!c(String(r ?? "")),
3634
3627
  "aria-describedby": c(String(r ?? "")) ? `${e.name}-error` : void 0
3635
3628
  }
3636
3629
  ) });
3637
- }, Ne = new pe(), Ft = /* @__PURE__ */ new Set([
3630
+ }, Ne = new pe(), Vt = /* @__PURE__ */ new Set([
3638
3631
  "checkbox",
3639
3632
  "switch",
3640
3633
  "dropdown",
@@ -3651,26 +3644,26 @@ const Ke = /^(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|]
3651
3644
  dropdown: _r,
3652
3645
  email: Jr,
3653
3646
  file: Yr,
3654
- float: nt,
3647
+ float: rt,
3655
3648
  "float-array": et,
3656
- image: at,
3657
- int: lt,
3658
- "int-array": it,
3659
- "multi-selection": ft,
3660
- multiline: ut,
3661
- password: vt,
3662
- phone: pt,
3663
- radio: gt,
3664
- rating: yt,
3649
+ image: nt,
3650
+ int: it,
3651
+ "int-array": at,
3652
+ "multi-selection": lt,
3653
+ multiline: ct,
3654
+ password: bt,
3655
+ phone: mt,
3656
+ radio: dt,
3657
+ rating: ht,
3665
3658
  separator: Gr,
3666
- slider: St,
3659
+ slider: xt,
3667
3660
  string: _e,
3668
- stepper: dt,
3669
- switch: Ct,
3661
+ stepper: ft,
3662
+ switch: wt,
3670
3663
  text: _e,
3671
- time: kt,
3672
- unit: Vt,
3673
- url: At
3664
+ time: St,
3665
+ unit: Mt,
3666
+ url: $t
3674
3667
  };
3675
3668
  function lr(e, r, t) {
3676
3669
  const o = r;
@@ -3680,7 +3673,7 @@ function lr(e, r, t) {
3680
3673
  );
3681
3674
  return;
3682
3675
  }
3683
- if (Ft.has(e)) {
3676
+ if (Vt.has(e)) {
3684
3677
  Ne.register(e, o);
3685
3678
  return;
3686
3679
  }
@@ -3718,10 +3711,10 @@ const ze = new pe();
3718
3711
  function dr(e, r) {
3719
3712
  ze.register(e, r);
3720
3713
  }
3721
- function Dt(e) {
3714
+ function At(e) {
3722
3715
  return ze.get(e);
3723
3716
  }
3724
- function Ot(e) {
3717
+ function Ft(e) {
3725
3718
  return ze.get(e);
3726
3719
  }
3727
3720
  dr(
@@ -3764,7 +3757,7 @@ function pr(e, r, t) {
3764
3757
  return !1;
3765
3758
  }
3766
3759
  }
3767
- function zt(e) {
3760
+ function Dt(e) {
3768
3761
  const r = [];
3769
3762
  if (e.components) {
3770
3763
  for (const t of Object.keys(e.components))
@@ -3801,7 +3794,7 @@ function zt(e) {
3801
3794
  }
3802
3795
  if (e.submissionHandlers)
3803
3796
  for (const t of Object.keys(e.submissionHandlers)) {
3804
- const o = Ot(t), n = W.submissionHandlers.get(t);
3797
+ const o = Ft(t), n = W.submissionHandlers.get(t);
3805
3798
  o && n && n !== e.name && r.push({
3806
3799
  type: "submissionHandler",
3807
3800
  name: t,
@@ -3822,7 +3815,7 @@ function de(e, r, t, o, n, a, l, c) {
3822
3815
  r.set(s, o.name), t(s, e[s]);
3823
3816
  }
3824
3817
  }
3825
- function nn(e, r) {
3818
+ function rn(e, r) {
3826
3819
  const t = r?.conflictResolution || "error";
3827
3820
  if (Q.has(e.name)) {
3828
3821
  const n = {
@@ -3833,7 +3826,7 @@ function nn(e, r) {
3833
3826
  };
3834
3827
  if (!pr(n, t, r?.onConflict)) return;
3835
3828
  }
3836
- const o = zt(e);
3829
+ const o = Dt(e);
3837
3830
  if (e.components && de(
3838
3831
  e.components,
3839
3832
  W.components,
@@ -3872,7 +3865,7 @@ function nn(e, r) {
3872
3865
  r?.onConflict
3873
3866
  ), e.setup && e.setup(), Q.set(e.name, e);
3874
3867
  }
3875
- function on(e, r = !1) {
3868
+ function tn(e, r = !1) {
3876
3869
  const t = Q.get(e);
3877
3870
  if (!t) return !1;
3878
3871
  if (t.cleanup && t.cleanup(), r) {
@@ -3897,16 +3890,16 @@ function on(e, r = !1) {
3897
3890
  }
3898
3891
  return Q.delete(e), !0;
3899
3892
  }
3900
- function an(e) {
3893
+ function nn(e) {
3901
3894
  return Q.get(e);
3902
3895
  }
3903
- function sn() {
3896
+ function on() {
3904
3897
  return Array.from(Q.values());
3905
3898
  }
3906
- function cn(e) {
3899
+ function an(e) {
3907
3900
  return Q.has(e);
3908
3901
  }
3909
- function ln(e) {
3902
+ function sn(e) {
3910
3903
  for (const [r, t] of Object.entries(e))
3911
3904
  ur(r, t);
3912
3905
  }
@@ -3918,7 +3911,7 @@ const gr = i.memo(({ field: e, value: r, handleChange: t, handleError: o }) => {
3918
3911
  (c) => o?.(e.name, c),
3919
3912
  [o, e.name]
3920
3913
  );
3921
- return n ? /* @__PURE__ */ y(
3914
+ return n ? /* @__PURE__ */ h(
3922
3915
  n,
3923
3916
  {
3924
3917
  field: e,
@@ -3929,7 +3922,7 @@ const gr = i.memo(({ field: e, value: r, handleChange: t, handleError: o }) => {
3929
3922
  ) : null;
3930
3923
  }, (e, r) => e.field === r.field && e.value === r.value && e.handleChange === r.handleChange && e.handleError === r.handleError);
3931
3924
  gr.displayName = "FieldWrapper";
3932
- const hr = (e, r, t, o) => /* @__PURE__ */ y(
3925
+ const hr = (e, r, t, o) => /* @__PURE__ */ h(
3933
3926
  gr,
3934
3927
  {
3935
3928
  field: e,
@@ -3960,24 +3953,24 @@ const hr = (e, r, t, o) => /* @__PURE__ */ y(
3960
3953
  }), [m, u]);
3961
3954
  return /* @__PURE__ */ O("fieldset", { style: d, children: [
3962
3955
  /* @__PURE__ */ O("legend", { onClick: s, style: f, children: [
3963
- /* @__PURE__ */ y("span", { children: c(e) }),
3964
- /* @__PURE__ */ y("span", { children: r ? "▼" : "▶" })
3956
+ /* @__PURE__ */ h("span", { children: c(e) }),
3957
+ /* @__PURE__ */ h("span", { children: r ? "▼" : "▶" })
3965
3958
  ] }),
3966
- r && t.map((g) => /* @__PURE__ */ y("div", { children: hr(g, o, n, a) }, g.name))
3959
+ r && t.map((g) => /* @__PURE__ */ h("div", { children: hr(g, o, n, a) }, g.name))
3967
3960
  ] });
3968
3961
  });
3969
3962
  br.displayName = "FieldGroup";
3970
- const Lt = (e, r, t, o, n, a, l, c, s) => {
3963
+ const Ot = (e, r, t, o, n, a, l, c, s) => {
3971
3964
  const m = r.slice(0, c).filter((g) => l[g.name]), d = Dr(m).groups, f = [];
3972
3965
  return d.forEach((g) => {
3973
3966
  if (g.name) {
3974
- const h = e[g.name] ?? !0;
3967
+ const b = e[g.name] ?? !0;
3975
3968
  f.push(
3976
- /* @__PURE__ */ y(
3969
+ /* @__PURE__ */ h(
3977
3970
  br,
3978
3971
  {
3979
3972
  groupName: g.name,
3980
- isOpen: h,
3973
+ isOpen: b,
3981
3974
  fields: g.fields,
3982
3975
  valuesMap: t,
3983
3976
  handleChange: n,
@@ -3989,9 +3982,9 @@ const Lt = (e, r, t, o, n, a, l, c, s) => {
3989
3982
  )
3990
3983
  );
3991
3984
  } else
3992
- g.fields.forEach((h) => f.push(/* @__PURE__ */ y("div", { children: hr(h, t, n, a) }, h.name)));
3985
+ g.fields.forEach((b) => f.push(/* @__PURE__ */ h("div", { children: hr(b, t, n, a) }, b.name)));
3993
3986
  }), f;
3994
- }, jt = (e) => {
3987
+ }, zt = (e) => {
3995
3988
  const r = {};
3996
3989
  return e.forEach((t) => {
3997
3990
  r[t.name] = !1;
@@ -4008,12 +4001,12 @@ const Lt = (e, r, t, o, n, a, l, c, s) => {
4008
4001
  o?.children && Object.values(o.children).flat().forEach((n) => {
4009
4002
  t[n] = !1, yr(n, r, t);
4010
4003
  });
4011
- }, Pt = (e, r, t, o) => {
4004
+ }, Lt = (e, r, t, o) => {
4012
4005
  const n = { ...t };
4013
4006
  return e.forEach((a) => {
4014
4007
  (!a.parents || Object.keys(a.parents).length === 0) && (n[a.name] = !0, Le(a.name, o, r, n));
4015
4008
  }), n;
4016
- }, Ht = (e, r, t, o, n) => {
4009
+ }, jt = (e, r, t, o, n) => {
4017
4010
  const a = { ...e };
4018
4011
  if (yr(o, r, a), n != null) {
4019
4012
  const l = r[o];
@@ -4026,7 +4019,7 @@ const Lt = (e, r, t, o, n, a, l, c, s) => {
4026
4019
  }
4027
4020
  return a;
4028
4021
  };
4029
- async function Tt(e, r, t, o, n) {
4022
+ async function Pt(e, r, t, o, n) {
4030
4023
  const a = Object.values(n).filter(Boolean);
4031
4024
  if (a.length > 0)
4032
4025
  return {
@@ -4045,11 +4038,11 @@ async function Tt(e, r, t, o, n) {
4045
4038
  const g = Number(String(d).trim());
4046
4039
  isNaN(g) ? c.push(o(`Invalid number format for field ${m.displayName || u}`)) : l[u] = g;
4047
4040
  } else if (f === "int-array" || f === "float-array") {
4048
- const h = String(d).split(",").map((p) => p.trim()).filter(Boolean).map((p) => {
4049
- const b = Number(p);
4050
- return isNaN(b) ? (c.push(o(`Invalid number "${p}" in array for field ${m.displayName || u}`)), 0) : b;
4041
+ const b = String(d).split(",").map((p) => p.trim()).filter(Boolean).map((p) => {
4042
+ const y = Number(p);
4043
+ return isNaN(y) ? (c.push(o(`Invalid number "${p}" in array for field ${m.displayName || u}`)), 0) : y;
4051
4044
  });
4052
- c.length === 0 && (l[u] = h);
4045
+ c.length === 0 && (l[u] = b);
4053
4046
  }
4054
4047
  } catch (g) {
4055
4048
  c.push(o(`Error processing field ${m.displayName || u}: ${g}`));
@@ -4069,7 +4062,7 @@ async function Tt(e, r, t, o, n) {
4069
4062
  errors: s
4070
4063
  };
4071
4064
  if (e && typeof e.submitHandlerName == "string") {
4072
- const m = Dt(e.submitHandlerName);
4065
+ const m = At(e.submitHandlerName);
4073
4066
  if (m)
4074
4067
  try {
4075
4068
  const u = await m(e, r?.name ?? null, l, o);
@@ -4093,7 +4086,7 @@ async function Tt(e, r, t, o, n) {
4093
4086
  data: l
4094
4087
  };
4095
4088
  }
4096
- const qt = ({
4089
+ const Ht = ({
4097
4090
  definition: e,
4098
4091
  instance: r,
4099
4092
  chunkSize: t = 50,
@@ -4102,9 +4095,9 @@ const qt = ({
4102
4095
  const { properties: n, displayName: a } = e, l = F(), { t: c, formStyle: s, language: m } = l, u = {
4103
4096
  ...l,
4104
4097
  definitionName: e?.name ?? l.definitionName
4105
- }, [d, f] = i.useState("en"), [g, h] = i.useState([]), [p, b] = i.useState({}), [C, v] = i.useState(
4098
+ }, [d, f] = i.useState("en"), [g, b] = i.useState([]), [p, y] = i.useState({}), [S, v] = i.useState(
4106
4099
  {}
4107
- ), [k, N] = i.useState({}), [w, x] = i.useState({}), [R, $] = i.useState({}), [S, E] = i.useState(null), [I, z] = i.useState(null), [q, te] = i.useState(0), [ne, je] = i.useState(!1), [Y, ce] = i.useState(!1), [G, D] = i.useState(r.name || ""), V = i.useRef(r), L = i.useRef(!1);
4100
+ ), [C, I] = i.useState({}), [w, x] = i.useState({}), [k, V] = i.useState({}), [R, E] = i.useState(null), [M, z] = i.useState(null), [q, te] = i.useState(0), [ne, je] = i.useState(!1), [Y, ce] = i.useState(!1), [G, D] = i.useState(r.name || ""), $ = i.useRef(r), L = i.useRef(!1);
4108
4101
  i.useEffect(() => {
4109
4102
  const A = Object.fromEntries(
4110
4103
  n.map((P) => [
@@ -4134,16 +4127,16 @@ const qt = ({
4134
4127
  U[P.name] = [oe, be];
4135
4128
  } else
4136
4129
  U[P.name] = P.defaultValue;
4137
- }), V.current = r, Object.keys(r.values).forEach((P) => {
4130
+ }), $.current = r, Object.keys(r.values).forEach((P) => {
4138
4131
  A[P] !== void 0 && (U[P] = r.values[P]);
4139
4132
  });
4140
- const K = jt(j), J = {};
4133
+ const K = zt(j), J = {};
4141
4134
  j.forEach((P) => {
4142
4135
  P.group && !(P.group in J) && (J[P.group] = !0);
4143
4136
  });
4144
4137
  const re = requestAnimationFrame(() => {
4145
- h(j), b(A), v(U), N(
4146
- Pt(j, U, K, A)
4138
+ b(j), y(A), v(U), I(
4139
+ Lt(j, U, K, A)
4147
4140
  ), x(J), je(!0), D(r.name);
4148
4141
  });
4149
4142
  return () => cancelAnimationFrame(re);
@@ -4166,8 +4159,8 @@ const qt = ({
4166
4159
  "multi-select",
4167
4160
  "radio",
4168
4161
  "switch"
4169
- ].includes(re.type) && N(
4170
- (oe) => Ht(
4162
+ ].includes(re.type) && I(
4163
+ (oe) => jt(
4171
4164
  oe,
4172
4165
  p,
4173
4166
  J,
@@ -4175,7 +4168,7 @@ const qt = ({
4175
4168
  String(j)
4176
4169
  )
4177
4170
  ), J;
4178
- }), $((K) => U ? { ...K, [A]: U } : Object.fromEntries(Object.entries(K).filter(([re]) => re !== A)));
4171
+ }), V((K) => U ? { ...K, [A]: U } : Object.fromEntries(Object.entries(K).filter(([re]) => re !== A)));
4179
4172
  },
4180
4173
  [p, E, z]
4181
4174
  );
@@ -4188,31 +4181,31 @@ const qt = ({
4188
4181
  let A = 0;
4189
4182
  return A = requestAnimationFrame(() => {
4190
4183
  if (L.current) {
4191
- L.current = !1, V.current = r, D(r.name || "");
4184
+ L.current = !1, $.current = r, D(r.name || "");
4192
4185
  return;
4193
4186
  }
4194
- V.current = r, E(null), z(null), D(r.name || "");
4187
+ $.current = r, E(null), z(null), D(r.name || "");
4195
4188
  }), () => cancelAnimationFrame(A);
4196
4189
  }, [r, r.name]);
4197
4190
  const ge = i.useCallback((A, j) => {
4198
- $((U) => j ? { ...U, [A]: String(j) } : Object.fromEntries(Object.entries(U).filter(([J]) => J !== A)));
4191
+ V((U) => j ? { ...U, [A]: String(j) } : Object.fromEntries(Object.entries(U).filter(([J]) => J !== A)));
4199
4192
  }, []), le = async () => {
4200
4193
  L.current = !0;
4201
- const A = V.current?.name;
4202
- V.current.name = G;
4203
- const j = await Tt(e, V.current, C, c, R), U = typeof j.message == "string" ? j.message : String(j.message), K = Object.values(j.errors ?? {}).join(`
4194
+ const A = $.current?.name;
4195
+ $.current.name = G;
4196
+ const j = await Pt(e, $.current, S, c, k), U = typeof j.message == "string" ? j.message : String(j.message), K = Object.values(j.errors ?? {}).join(`
4204
4197
  `);
4205
4198
  E(K ? U + `
4206
- ` + K : U), z(j.success), j.success || (V.current.name = A ?? V.current.name, D(A ?? ""));
4199
+ ` + K : U), z(j.success), j.success || ($.current.name = A ?? $.current.name, D(A ?? ""));
4207
4200
  }, he = (A) => {
4208
4201
  x((j) => ({ ...j, [A]: !j[A] }));
4209
4202
  }, ee = i.useMemo(
4210
- () => Object.values(R).some(Boolean),
4211
- [R]
4203
+ () => Object.values(k).some(Boolean),
4204
+ [k]
4212
4205
  );
4213
- return /* @__PURE__ */ y(Me.Provider, { value: u, children: /* @__PURE__ */ O("div", { style: s.container, children: [
4214
- a && /* @__PURE__ */ y("h2", { style: s.titleStyle, children: c(a) }),
4215
- S && /* @__PURE__ */ O(
4206
+ return /* @__PURE__ */ h(Me.Provider, { value: u, children: /* @__PURE__ */ O("div", { style: s.container, children: [
4207
+ a && /* @__PURE__ */ h("h2", { style: s.titleStyle, children: c(a) }),
4208
+ R && /* @__PURE__ */ O(
4216
4209
  "div",
4217
4210
  {
4218
4211
  role: "status",
@@ -4220,16 +4213,16 @@ const qt = ({
4220
4213
  marginBottom: 12,
4221
4214
  padding: 12,
4222
4215
  borderRadius: 6,
4223
- backgroundColor: I ? "rgba(76, 175, 80, 0.12)" : "rgba(225, 29, 72, 0.06)",
4224
- border: `1px solid ${I ? "rgba(76,175,80,0.3)" : "rgba(225,29,72,0.12)"}`,
4225
- color: I ? "var(--reactaform-success-color, #4CAF50)" : "var(--reactaform-error-color, #e11d48)",
4216
+ backgroundColor: M ? "rgba(76, 175, 80, 0.12)" : "rgba(225, 29, 72, 0.06)",
4217
+ border: `1px solid ${M ? "rgba(76,175,80,0.3)" : "rgba(225,29,72,0.12)"}`,
4218
+ color: M ? "var(--reactaform-success-color, #4CAF50)" : "var(--reactaform-error-color, #e11d48)",
4226
4219
  display: "flex",
4227
4220
  alignItems: "center",
4228
4221
  justifyContent: "space-between"
4229
4222
  },
4230
4223
  children: [
4231
- /* @__PURE__ */ y("div", { style: { whiteSpace: "pre-wrap", flex: 1 }, children: S }),
4232
- /* @__PURE__ */ y(
4224
+ /* @__PURE__ */ h("div", { style: { whiteSpace: "pre-wrap", flex: 1 }, children: R }),
4225
+ /* @__PURE__ */ h(
4233
4226
  "button",
4234
4227
  {
4235
4228
  onClick: () => {
@@ -4251,7 +4244,7 @@ const qt = ({
4251
4244
  ]
4252
4245
  }
4253
4246
  ),
4254
- r && /* @__PURE__ */ y(
4247
+ r && /* @__PURE__ */ h(
4255
4248
  Qe,
4256
4249
  {
4257
4250
  name: G,
@@ -4261,18 +4254,18 @@ const qt = ({
4261
4254
  }
4262
4255
  ),
4263
4256
  /* @__PURE__ */ O(Ye, { children: [
4264
- Lt(
4257
+ Ot(
4265
4258
  w,
4266
4259
  g,
4267
- C,
4260
+ S,
4268
4261
  c,
4269
4262
  _,
4270
4263
  ge,
4271
- k,
4264
+ C,
4272
4265
  q,
4273
4266
  he
4274
4267
  ),
4275
- q < g.length && /* @__PURE__ */ y(
4268
+ q < g.length && /* @__PURE__ */ h(
4276
4269
  "div",
4277
4270
  {
4278
4271
  style: {
@@ -4282,7 +4275,7 @@ const qt = ({
4282
4275
  }
4283
4276
  )
4284
4277
  ] }),
4285
- /* @__PURE__ */ y(
4278
+ /* @__PURE__ */ h(
4286
4279
  "button",
4287
4280
  {
4288
4281
  onClick: le,
@@ -4309,7 +4302,7 @@ const qt = ({
4309
4302
  ] }) });
4310
4303
  };
4311
4304
  mr();
4312
- const Bt = (e, r = !1) => ({
4305
+ const Tt = (e, r = !1) => ({
4313
4306
  container: {
4314
4307
  padding: "var(--reactaform-space-sm, 8px)",
4315
4308
  margin: "0 auto",
@@ -4350,7 +4343,7 @@ const Bt = (e, r = !1) => ({
4350
4343
  lineHeight: "1.2",
4351
4344
  textAlign: "left"
4352
4345
  }
4353
- }), Ut = (e, r = !1) => {
4346
+ }), qt = (e, r = !1) => {
4354
4347
  const t = {
4355
4348
  color: "var(--reactaform-color-text)",
4356
4349
  fontFamily: e?.fontFamily || "var(--reactaform-font-family, inherit)",
@@ -4409,7 +4402,7 @@ const Bt = (e, r = !1) => ({
4409
4402
  display: "block"
4410
4403
  }
4411
4404
  };
4412
- }, Wt = ({
4405
+ }, Bt = ({
4413
4406
  children: e,
4414
4407
  definitionName: r = "",
4415
4408
  defaultStyle: t,
@@ -4421,56 +4414,56 @@ const Bt = (e, r = !1) => ({
4421
4414
  const c = r, s = a, m = n, u = o, d = i.useMemo(
4422
4415
  () => t ?? {},
4423
4416
  [t]
4424
- ), [f, g] = i.useState({}), [h, p] = i.useState({}), [b, C] = i.useState({}), [v, k] = i.useState({});
4417
+ ), [f, g] = i.useState({}), [b, p] = i.useState({}), [y, S] = i.useState({}), [v, C] = i.useState({});
4425
4418
  i.useEffect(() => {
4426
- let $ = !0;
4419
+ let V = !0;
4427
4420
  return (async () => {
4428
4421
  if (u === "en") {
4429
- $ && (g({}), p({}));
4422
+ V && (g({}), p({}));
4430
4423
  return;
4431
4424
  }
4432
4425
  try {
4433
- const E = await zr(u), I = E.success ? E.translations : {};
4434
- $ && g(I);
4426
+ const E = await zr(u), M = E.success ? E.translations : {};
4427
+ V && g(M);
4435
4428
  const z = await Lr(u, s), q = z.success ? z.translations : {};
4436
- $ && p(q);
4429
+ V && p(q);
4437
4430
  } catch {
4438
- $ && (g({}), p({}));
4431
+ V && (g({}), p({}));
4439
4432
  }
4440
4433
  })(), () => {
4441
- $ = !1;
4434
+ V = !1;
4442
4435
  };
4443
4436
  }, [u, s]), i.useEffect(() => {
4444
- k(Bt(d, m)), C(Ut(d, m));
4437
+ C(Tt(d, m)), S(qt(d, m));
4445
4438
  }, [d, m]);
4446
- const N = i.useMemo(
4447
- () => Pr(u, f, h),
4448
- [u, f, h]
4439
+ const I = i.useMemo(
4440
+ () => Pr(u, f, b),
4441
+ [u, f, b]
4449
4442
  ), w = i.useCallback(
4450
- ($, ...S) => N($, ...S),
4451
- [N]
4443
+ (V, ...R) => I(V, ...R),
4444
+ [I]
4452
4445
  ), x = i.useMemo(
4453
4446
  () => ({
4454
4447
  definitionName: c,
4455
4448
  language: u,
4456
4449
  darkMode: m,
4457
4450
  formStyle: v,
4458
- fieldStyle: b,
4451
+ fieldStyle: y,
4459
4452
  t: w
4460
4453
  }),
4461
- [c, u, m, b, v, w]
4462
- ), R = d?.height ? { height: "100%" } : void 0;
4463
- return /* @__PURE__ */ y(Me.Provider, { value: x, children: /* @__PURE__ */ y(
4454
+ [c, u, m, y, v, w]
4455
+ ), k = d?.height ? { height: "100%" } : void 0;
4456
+ return /* @__PURE__ */ h(Me.Provider, { value: x, children: /* @__PURE__ */ h(
4464
4457
  "div",
4465
4458
  {
4466
4459
  "data-reactaform-theme": m ? "dark" : "light",
4467
4460
  className: l,
4468
- style: R,
4461
+ style: k,
4469
4462
  children: e
4470
4463
  }
4471
4464
  ) });
4472
4465
  };
4473
- function _t(e) {
4466
+ function Ut(e) {
4474
4467
  if (!e || typeof e != "object") return "Definition must be an object";
4475
4468
  const r = e;
4476
4469
  if (!r.name || typeof r.name != "string") return "Definition must include a 'name' string";
@@ -4485,7 +4478,7 @@ function _t(e) {
4485
4478
  }
4486
4479
  return null;
4487
4480
  }
4488
- async function un(e, r = {}) {
4481
+ async function cn(e, r = {}) {
4489
4482
  const { validateSchema: t = !0 } = r;
4490
4483
  try {
4491
4484
  if (!e || typeof e != "string")
@@ -4503,7 +4496,7 @@ async function un(e, r = {}) {
4503
4496
  };
4504
4497
  }
4505
4498
  if (t) {
4506
- const a = _t(n);
4499
+ const a = Ut(n);
4507
4500
  if (a)
4508
4501
  return { success: !1, error: `Schema validation failed: ${a}` };
4509
4502
  }
@@ -4512,7 +4505,7 @@ async function un(e, r = {}) {
4512
4505
  return { success: !1, error: `Unexpected error loading definition: ${o instanceof Error ? o.message : "Unknown error"}` };
4513
4506
  }
4514
4507
  }
4515
- function Kt(e, r) {
4508
+ function Wt(e, r) {
4516
4509
  try {
4517
4510
  if (!e)
4518
4511
  return { success: !1, error: "Definition is required" };
@@ -4526,7 +4519,11 @@ function Kt(e, r) {
4526
4519
  }, o = e.properties || [];
4527
4520
  return Array.isArray(o) && o.forEach((n) => {
4528
4521
  const a = n;
4529
- a.defaultValue !== void 0 && (t.values[a.name] = a.defaultValue);
4522
+ if (a.type === "unit") {
4523
+ const l = a.defaultUnit, c = Number(a.defaultValue) || void 0;
4524
+ t.values[a.name] = [c || 0, l || "m"];
4525
+ } else
4526
+ a.defaultValue !== void 0 && (t.values[a.name] = a.defaultValue);
4530
4527
  }), { success: !0, instance: t };
4531
4528
  } catch (t) {
4532
4529
  return {
@@ -4535,7 +4532,7 @@ function Kt(e, r) {
4535
4532
  };
4536
4533
  }
4537
4534
  }
4538
- function fn(e) {
4535
+ function ln(e) {
4539
4536
  try {
4540
4537
  if (!e)
4541
4538
  return { success: !1, error: "Instance data is required" };
@@ -4559,14 +4556,14 @@ function fn(e) {
4559
4556
  };
4560
4557
  }
4561
4558
  }
4562
- function mn(e, r, t) {
4559
+ function un(e, r, t) {
4563
4560
  try {
4564
4561
  if (!e)
4565
4562
  return { success: !1, error: "Instance is required" };
4566
4563
  if (!r)
4567
4564
  return { success: !1, error: "Latest definition is required" };
4568
4565
  if (e.definition === r.name && e.version === r.version)
4569
- return { success: !0, upgradedInstance: e };
4566
+ return { success: !0, instance: e };
4570
4567
  const o = {
4571
4568
  name: e.name || r.name + "-instance",
4572
4569
  definition: r.name,
@@ -4622,7 +4619,7 @@ function mn(e, r, t) {
4622
4619
  } catch (s) {
4623
4620
  return { success: !1, error: `Upgrade callback error: ${s instanceof Error ? s.message : String(s)}` };
4624
4621
  }
4625
- return { success: !0, upgradedInstance: o };
4622
+ return { success: !0, instance: o };
4626
4623
  } catch (o) {
4627
4624
  return {
4628
4625
  success: !1,
@@ -4631,7 +4628,7 @@ function mn(e, r, t) {
4631
4628
  }
4632
4629
  }
4633
4630
  mr();
4634
- function Jt(e) {
4631
+ function _t(e) {
4635
4632
  const [r, t] = i.useState(null);
4636
4633
  return i.useEffect(() => {
4637
4634
  const o = document.querySelector("[data-reactaform-theme]");
@@ -4647,7 +4644,7 @@ function Jt(e) {
4647
4644
  return l.observe(n, { attributes: !0, attributeFilter: ["data-reactaform-theme"] }), () => l.disconnect();
4648
4645
  }, [e]), r;
4649
4646
  }
4650
- const dn = ({
4647
+ const fn = ({
4651
4648
  definitionData: e,
4652
4649
  instance: r,
4653
4650
  language: t,
@@ -4661,21 +4658,21 @@ const dn = ({
4661
4658
  } catch {
4662
4659
  return null;
4663
4660
  }
4664
- }, [e]), c = { fontSize: "inherit", fontFamily: "inherit", ...a }, s = Jt(), m = n ?? s === "dark", u = t ?? "en";
4661
+ }, [e]), c = { fontSize: "inherit", fontFamily: "inherit", ...a }, s = _t(), m = n ?? s === "dark", u = t ?? "en";
4665
4662
  if (i.useEffect(() => {
4666
4663
  let f = document.getElementById("popup-root");
4667
4664
  f || (f = document.createElement("div"), f.id = "popup-root", document.body.appendChild(f));
4668
4665
  }, []), !l)
4669
- return /* @__PURE__ */ y("div", { style: { color: "red" }, children: "Error: No form definition provided." });
4666
+ return /* @__PURE__ */ h("div", { style: { color: "red" }, children: "Error: No form definition provided." });
4670
4667
  let d = r;
4671
4668
  if (!d) {
4672
- const f = Kt(l, l.name);
4669
+ const f = Wt(l, l.name);
4673
4670
  if (!f.success || !f.instance)
4674
- return /* @__PURE__ */ y("div", { style: { color: "red" }, children: "Error: Failed to create instance from definition." });
4671
+ return /* @__PURE__ */ h("div", { style: { color: "red" }, children: "Error: Failed to create instance from definition." });
4675
4672
  d = f.instance;
4676
4673
  }
4677
- return /* @__PURE__ */ y(
4678
- Wt,
4674
+ return /* @__PURE__ */ h(
4675
+ Bt,
4679
4676
  {
4680
4677
  definitionName: l.name,
4681
4678
  defaultStyle: c,
@@ -4683,8 +4680,8 @@ const dn = ({
4683
4680
  defaultDarkMode: m,
4684
4681
  defaultLocalizeName: l.localization || "",
4685
4682
  className: o,
4686
- children: /* @__PURE__ */ y(
4687
- qt,
4683
+ children: /* @__PURE__ */ h(
4684
+ Ht,
4688
4685
  {
4689
4686
  definition: l,
4690
4687
  instance: d
@@ -4693,7 +4690,7 @@ const dn = ({
4693
4690
  }
4694
4691
  );
4695
4692
  };
4696
- function Gt() {
4693
+ function Kt() {
4697
4694
  if (!document.getElementById("reactaform-styles"))
4698
4695
  try {
4699
4696
  const e = document.createElement("style");
@@ -4701,37 +4698,36 @@ function Gt() {
4701
4698
  } catch {
4702
4699
  }
4703
4700
  }
4704
- typeof document < "u" && Gt();
4701
+ typeof document < "u" && Kt();
4705
4702
  export {
4706
- M as CSS_CLASSES,
4707
- dn as ReactaForm,
4708
- Wt as ReactaFormProvider,
4709
- qt as ReactaFormRenderer,
4703
+ N as CSS_CLASSES,
4704
+ fn as ReactaForm,
4705
+ Bt as ReactaFormProvider,
4706
+ Ht as ReactaFormRenderer,
4710
4707
  T as StandardFieldLayout,
4711
- tn as Units,
4708
+ en as Units,
4712
4709
  B as combineClasses,
4713
- Kt as createInstanceFromDefinition,
4714
- rn as deserializeDefinition,
4715
- Qt as deserializeInstance,
4716
- sn as getAllPlugins,
4710
+ Wt as createInstanceFromDefinition,
4711
+ Qt as deserializeDefinition,
4712
+ Xt as deserializeInstance,
4713
+ on as getAllPlugins,
4717
4714
  fr as getComponent,
4718
- an as getPlugin,
4719
- cn as hasPlugin,
4720
- Gt as injectReactaFormStyles,
4721
- fn as loadInstance,
4722
- un as loadJsonDefinition,
4715
+ nn as getPlugin,
4716
+ an as hasPlugin,
4717
+ Kt as injectReactaFormStyles,
4718
+ ln as loadInstance,
4719
+ cn as loadJsonDefinition,
4723
4720
  ur as registerComponent,
4724
- ln as registerComponents,
4721
+ sn as registerComponents,
4725
4722
  Er as registerFieldValidationHandler,
4726
4723
  Rr as registerFormValidationHandler,
4727
- nn as registerPlugin,
4724
+ rn as registerPlugin,
4728
4725
  dr as registerSubmissionHandler,
4729
- en as serializeDefinition,
4730
- Zt as serializeInstance,
4731
- on as unregisterPlugin,
4732
- mn as upgradeInstanceToLatestDefinition,
4726
+ Zt as serializeDefinition,
4727
+ Yt as serializeInstance,
4728
+ tn as unregisterPlugin,
4729
+ un as upgradeInstanceToLatestDefinition,
4733
4730
  Cr as useDebouncedCallback,
4734
4731
  F as useReactaFormContext,
4735
- H as validateFieldValue,
4736
- Ir as validateFormValues
4732
+ H as validateFieldValue
4737
4733
  };