suprform 1.1.2 → 1.1.4

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,5 +1,5 @@
1
1
  import { jsx as ee, jsxs as dt, Fragment as Qt } from "react/jsx-runtime";
2
- import b, { createContext as Gt, useContext as zt, useMemo as he, cloneElement as Ae, useImperativeHandle as bt, useEffect as Kt, Children as Yt, isValidElement as Jt } from "react";
2
+ import b, { createContext as Gt, useContext as zt, useMemo as he, cloneElement as Ae, useImperativeHandle as bt, Children as Kt, isValidElement as Yt, useEffect as Jt } from "react";
3
3
  var ve = (t) => t.type === "checkbox", le = (t) => t instanceof Date, G = (t) => t == null;
4
4
  const At = (t) => typeof t == "object";
5
5
  var P = (t) => !G(t) && !Array.isArray(t) && At(t) && !le(t), pt = (t) => P(t) && t.target ? ve(t.target) ? t.target.checked : t.target.value : t, Xt = (t) => t.substring(0, t.search(/\.\d+(\.|$)/)) || t, xt = (t, r) => t.has(Xt(r)), Zt = (t) => {
@@ -78,7 +78,7 @@ var St = (t, r, e, s = !0) => {
78
78
  });
79
79
  return u;
80
80
  };
81
- const Ce = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
81
+ const ke = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
82
82
  function tr(t) {
83
83
  const r = Ve(), { control: e = r.control, disabled: s, name: u, exact: i } = t || {}, [c, l] = b.useState(e._formState), V = b.useRef({
84
84
  isDirty: !1,
@@ -90,7 +90,7 @@ function tr(t) {
90
90
  isValid: !1,
91
91
  errors: !1
92
92
  });
93
- return Ce(() => e._subscribe({
93
+ return ke(() => e._subscribe({
94
94
  name: u,
95
95
  formState: V.current,
96
96
  exact: i,
@@ -147,7 +147,7 @@ function Je(t) {
147
147
  L(d);
148
148
  }
149
149
  }, [e._formValues, e._names, i, s]);
150
- Ce(() => ((g.current !== e || !te(F.current, s)) && (g.current = e, F.current = s, N()), e._subscribe({
150
+ ke(() => ((g.current !== e || !te(F.current, s)) && (g.current = e, F.current = s, N()), e._subscribe({
151
151
  name: s,
152
152
  formState: {
153
153
  values: !0
@@ -326,13 +326,13 @@ var or = (t) => {
326
326
  return !0;
327
327
  return !1;
328
328
  };
329
- function Ct(t) {
329
+ function kt(t) {
330
330
  return Array.isArray(t) || P(t) && !or(t);
331
331
  }
332
332
  function je(t, r = {}) {
333
333
  for (const e in t) {
334
334
  const s = t[e];
335
- Ct(s) ? (r[e] = Array.isArray(s) ? [] : {}, je(s, r[e])) : O(s) || (r[e] = !0);
335
+ kt(s) ? (r[e] = Array.isArray(s) ? [] : {}, je(s, r[e])) : O(s) || (r[e] = !0);
336
336
  }
337
337
  return r;
338
338
  }
@@ -340,7 +340,7 @@ function fe(t, r, e) {
340
340
  e || (e = je(r));
341
341
  for (const s in t) {
342
342
  const u = t[s];
343
- if (Ct(u))
343
+ if (kt(u))
344
344
  O(r) || qe(e[s]) ? e[s] = je(u, Array.isArray(u) ? [] : {}) : fe(u, G(r) ? {} : r[s], e[s]);
345
345
  else {
346
346
  const i = r[s];
@@ -353,7 +353,7 @@ const yt = {
353
353
  value: !1,
354
354
  isValid: !1
355
355
  }, mt = { value: !0, isValid: !0 };
356
- var kt = (t) => {
356
+ var Ct = (t) => {
357
357
  if (Array.isArray(t)) {
358
358
  if (t.length > 1) {
359
359
  const r = t.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
@@ -376,7 +376,7 @@ var Rt = (t) => Array.isArray(t) ? t.reduce((r, e) => e && e.checked && !e.disab
376
376
  } : r, _t) : _t;
377
377
  function gt(t) {
378
378
  const r = t.ref;
379
- return Xe(r) ? r.files : Ze(r) ? Rt(t.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: e }) => e) : ve(r) ? kt(t.refs).value : Dt(O(r.value) ? t.ref.value : r.value, t);
379
+ return Xe(r) ? r.files : Ze(r) ? Rt(t.refs).value : wt(r) ? [...r.selectedOptions].map(({ value: e }) => e) : ve(r) ? Ct(t.refs).value : Dt(O(r.value) ? t.ref.value : r.value, t);
380
380
  }
381
381
  var lr = (t, r, e, s) => {
382
382
  const u = {};
@@ -467,20 +467,20 @@ var de = (t) => P(t) && !Se(t) ? t : {
467
467
  const { ref: c, refs: l, required: V, maxLength: v, minLength: x, min: g, max: F, pattern: $, validate: L, name: w, valueAsNumber: N, mount: H } = t._f, S = m(e, w);
468
468
  if (!H || r.has(w))
469
469
  return {};
470
- const M = l ? l[0] : c, f = (C) => {
471
- u && M.reportValidity && (M.setCustomValidity(K(C) ? "" : C || ""), M.reportValidity());
472
- }, d = {}, p = Ze(c), E = ve(c), Z = p || E, W = (N || Xe(c)) && O(c.value) && O(S) || xe(c) && c.value === "" || S === "" || Array.isArray(S) && !S.length, oe = ar.bind(null, w, s, d), se = (C, D, I, j = ne.maxLength, Q = ne.minLength) => {
473
- const ae = C ? D : I;
470
+ const M = l ? l[0] : c, f = (k) => {
471
+ u && M.reportValidity && (M.setCustomValidity(K(k) ? "" : k || ""), M.reportValidity());
472
+ }, d = {}, p = Ze(c), E = ve(c), Z = p || E, W = (N || Xe(c)) && O(c.value) && O(S) || xe(c) && c.value === "" || S === "" || Array.isArray(S) && !S.length, oe = ar.bind(null, w, s, d), se = (k, D, I, j = ne.maxLength, Q = ne.minLength) => {
473
+ const ae = k ? D : I;
474
474
  d[w] = {
475
- type: C ? j : Q,
475
+ type: k ? j : Q,
476
476
  message: ae,
477
477
  ref: c,
478
- ...oe(C ? j : Q, ae)
478
+ ...oe(k ? j : Q, ae)
479
479
  };
480
480
  };
481
- if (i ? !Array.isArray(S) || !S.length : V && (!Z && (W || G(S)) || K(S) && !S || E && !kt(l).isValid || p && !Rt(l).isValid)) {
482
- const { value: C, message: D } = Y(V) ? { value: !!V, message: V } : de(V);
483
- if (C && (d[w] = {
481
+ if (i ? !Array.isArray(S) || !S.length : V && (!Z && (W || G(S)) || K(S) && !S || E && !Ct(l).isValid || p && !Rt(l).isValid)) {
482
+ const { value: k, message: D } = Y(V) ? { value: !!V, message: V } : de(V);
483
+ if (k && (d[w] = {
484
484
  type: ne.required,
485
485
  message: D,
486
486
  ref: M,
@@ -489,26 +489,26 @@ var de = (t) => P(t) && !Se(t) ? t : {
489
489
  return f(D), d;
490
490
  }
491
491
  if (!W && (!G(g) || !G(F))) {
492
- let C, D;
492
+ let k, D;
493
493
  const I = de(F), j = de(g);
494
494
  if (!G(S) && !isNaN(S)) {
495
495
  const Q = c.valueAsNumber || S && +S;
496
- G(I.value) || (C = Q > I.value), G(j.value) || (D = Q < j.value);
496
+ G(I.value) || (k = Q > I.value), G(j.value) || (D = Q < j.value);
497
497
  } else {
498
498
  const Q = c.valueAsDate || new Date(S), ae = (Fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + Fe), _e = c.type == "time", ce = c.type == "week";
499
- Y(I.value) && S && (C = _e ? ae(S) > ae(I.value) : ce ? S > I.value : Q > new Date(I.value)), Y(j.value) && S && (D = _e ? ae(S) < ae(j.value) : ce ? S < j.value : Q < new Date(j.value));
499
+ Y(I.value) && S && (k = _e ? ae(S) > ae(I.value) : ce ? S > I.value : Q > new Date(I.value)), Y(j.value) && S && (D = _e ? ae(S) < ae(j.value) : ce ? S < j.value : Q < new Date(j.value));
500
500
  }
501
- if ((C || D) && (se(!!C, I.message, j.message, ne.max, ne.min), !s))
501
+ if ((k || D) && (se(!!k, I.message, j.message, ne.max, ne.min), !s))
502
502
  return f(d[w].message), d;
503
503
  }
504
504
  if ((v || x) && !W && (Y(S) || i && Array.isArray(S))) {
505
- const C = de(v), D = de(x), I = !G(C.value) && S.length > +C.value, j = !G(D.value) && S.length < +D.value;
506
- if ((I || j) && (se(I, C.message, D.message), !s))
505
+ const k = de(v), D = de(x), I = !G(k.value) && S.length > +k.value, j = !G(D.value) && S.length < +D.value;
506
+ if ((I || j) && (se(I, k.message, D.message), !s))
507
507
  return f(d[w].message), d;
508
508
  }
509
509
  if ($ && !W && Y(S)) {
510
- const { value: C, message: D } = de($);
511
- if (Se(C) && !S.match(C) && (d[w] = {
510
+ const { value: k, message: D } = de($);
511
+ if (Se(k) && !S.match(k) && (d[w] = {
512
512
  type: ne.pattern,
513
513
  message: D,
514
514
  ref: c,
@@ -518,26 +518,26 @@ var de = (t) => P(t) && !Se(t) ? t : {
518
518
  }
519
519
  if (L) {
520
520
  if (re(L)) {
521
- const C = await L(S, e), D = Vt(C, M);
521
+ const k = await L(S, e), D = Vt(k, M);
522
522
  if (D && (d[w] = {
523
523
  ...D,
524
524
  ...oe(ne.validate, D.message)
525
525
  }, !s))
526
526
  return f(D.message), d;
527
527
  } else if (P(L)) {
528
- let C = {};
528
+ let k = {};
529
529
  for (const D in L) {
530
- if (!q(C) && !s)
530
+ if (!q(k) && !s)
531
531
  break;
532
532
  const I = Vt(await L[D](S, e), M, D);
533
- I && (C = {
533
+ I && (k = {
534
534
  ...I,
535
535
  ...oe(D, I.message)
536
- }, f(I.message), s && (d[w] = C));
536
+ }, f(I.message), s && (d[w] = k));
537
537
  }
538
- if (!q(C) && (d[w] = {
538
+ if (!q(k) && (d[w] = {
539
539
  ref: M,
540
- ...C
540
+ ...k
541
541
  }, !s))
542
542
  return d;
543
543
  }
@@ -650,22 +650,22 @@ function hr(t = {}) {
650
650
  }
651
651
  }, d = (a, n, o, h, _) => {
652
652
  let y = !1, A = !1;
653
- const k = {
653
+ const C = {
654
654
  name: a
655
655
  };
656
656
  if (!r.disabled) {
657
657
  if (!o || h) {
658
- (x.isDirty || g.isDirty) && (A = e.isDirty, e.isDirty = k.isDirty = se(), y = A !== k.isDirty);
658
+ (x.isDirty || g.isDirty) && (A = e.isDirty, e.isDirty = C.isDirty = se(), y = A !== C.isDirty);
659
659
  const T = te(m(u, a), n);
660
- A = !!m(e.dirtyFields, a), T ? B(e.dirtyFields, a) : R(e.dirtyFields, a, !0), k.dirtyFields = e.dirtyFields, y = y || (x.dirtyFields || g.dirtyFields) && A !== !T;
660
+ A = !!m(e.dirtyFields, a), T ? B(e.dirtyFields, a) : R(e.dirtyFields, a, !0), C.dirtyFields = e.dirtyFields, y = y || (x.dirtyFields || g.dirtyFields) && A !== !T;
661
661
  }
662
662
  if (o) {
663
663
  const T = m(e.touchedFields, a);
664
- T || (R(e.touchedFields, a, o), k.touchedFields = e.touchedFields, y = y || (x.touchedFields || g.touchedFields) && T !== o);
664
+ T || (R(e.touchedFields, a, o), C.touchedFields = e.touchedFields, y = y || (x.touchedFields || g.touchedFields) && T !== o);
665
665
  }
666
- y && _ && F.state.next(k);
666
+ y && _ && F.state.next(C);
667
667
  }
668
- return y ? k : {};
668
+ return y ? C : {};
669
669
  }, p = (a, n, o, h) => {
670
670
  const _ = m(e.errors, a), y = (x.isValid || g.isValid) && K(n) && e.isValid !== n;
671
671
  if (r.delayError && o ? (V = L(() => S(a, o)), V(r.delayError)) : (clearTimeout(v), V = null, o ? R(e.errors, a, o) : B(e.errors, a)), (o ? !te(_, o) : _) || !q(h) || y) {
@@ -702,12 +702,12 @@ function hr(t = {}) {
702
702
  if (_) {
703
703
  const { _f: y, ...A } = _;
704
704
  if (y) {
705
- const k = l.array.has(y.name), T = _._f && cr(_._f);
705
+ const C = l.array.has(y.name), T = _._f && cr(_._f);
706
706
  T && x.validatingFields && N([y.name], !0);
707
- const J = await Ge(_, l.disabled, i, $, r.shouldUseNativeValidation && !n, k);
707
+ const J = await Ge(_, l.disabled, i, $, r.shouldUseNativeValidation && !n, C);
708
708
  if (T && x.validatingFields && N([y.name]), J[y.name] && (o.valid = !1, n))
709
709
  break;
710
- !n && (m(J, y.name) ? k ? Tt(e.errors, J, y.name) : R(e.errors, y.name, J[y.name]) : B(e.errors, y.name));
710
+ !n && (m(J, y.name) ? C ? Tt(e.errors, J, y.name) : R(e.errors, y.name, J[y.name]) : B(e.errors, y.name));
711
711
  }
712
712
  !q(A) && await W(A, n, o);
713
713
  }
@@ -716,10 +716,10 @@ function hr(t = {}) {
716
716
  }, oe = () => {
717
717
  for (const a of l.unMount) {
718
718
  const n = m(s, a);
719
- n && (n._f.refs ? n._f.refs.every((o) => !Ue(o)) : !Ue(n._f.ref)) && ke(a);
719
+ n && (n._f.refs ? n._f.refs.every((o) => !Ue(o)) : !Ue(n._f.ref)) && Ce(a);
720
720
  }
721
721
  l.unMount = /* @__PURE__ */ new Set();
722
- }, se = (a, n) => !r.disabled && (a && n && R(i, a, n), !te(Fe(), u)), C = (a, n, o) => He(a, l, {
722
+ }, se = (a, n) => !r.disabled && (a && n && R(i, a, n), !te(Fe(), u)), k = (a, n, o) => He(a, l, {
723
723
  ...c.mount ? i : O(n) ? u : Y(a) ? { [a]: n } : n
724
724
  }, o, n), D = (a) => we(m(c.mount ? i : u, a, r.shouldUnregister ? m(u, a, []) : [])), I = (a, n, o = {}) => {
725
725
  const h = m(s, a);
@@ -727,7 +727,7 @@ function hr(t = {}) {
727
727
  if (h) {
728
728
  const y = h._f;
729
729
  y && (!y.disabled && R(i, a, Dt(n, y)), _ = xe(y.ref) && G(n) ? "" : n, wt(y.ref) ? [...y.ref.options].forEach((A) => A.selected = _.includes(A.value)) : y.refs ? ve(y.ref) ? y.refs.forEach((A) => {
730
- (!A.defaultChecked || !A.disabled) && (Array.isArray(_) ? A.checked = !!_.find((k) => k === A.value) : A.checked = _ === A.value || !!_);
730
+ (!A.defaultChecked || !A.disabled) && (Array.isArray(_) ? A.checked = !!_.find((C) => C === A.value) : A.checked = _ === A.value || !!_);
731
731
  }) : y.refs.forEach((A) => A.checked = A.value === _) : Xe(y.ref) ? y.ref.value = "" : (y.ref.value = _, y.ref.type || F.state.next({
732
732
  name: a,
733
733
  values: U(i)
@@ -760,10 +760,10 @@ function hr(t = {}) {
760
760
  let o = n.name, h = !0;
761
761
  const _ = m(s, o), y = (T) => {
762
762
  h = Number.isNaN(T) || le(T) && isNaN(T.getTime()) || te(T, m(i, o, T));
763
- }, A = ye(r.mode), k = ye(r.reValidateMode);
763
+ }, A = ye(r.mode), C = ye(r.reValidateMode);
764
764
  if (_) {
765
765
  let T, J;
766
- const be = n.type ? gt(_._f) : pt(a), ie = a.type === pe.BLUR || a.type === pe.FOCUS_OUT, Ht = !dr(_._f) && !r.resolver && !m(e.errors, o) && !_._f.deps || mr(ie, m(e.touchedFields, o), e.isSubmitted, k, A), Te = Qe(o, l, ie);
766
+ const be = n.type ? gt(_._f) : pt(a), ie = a.type === pe.BLUR || a.type === pe.FOCUS_OUT, Ht = !dr(_._f) && !r.resolver && !m(e.errors, o) && !_._f.deps || mr(ie, m(e.touchedFields, o), e.isSubmitted, C, A), Te = Qe(o, l, ie);
767
767
  R(i, o, be), ie ? (!n || !n.readOnly) && (_._f.onBlur && _._f.onBlur(a), V && V(0)) : _._f.onChange && _._f.onChange(a);
768
768
  const Oe = d(o, be, ie), qt = !q(Oe) || Te;
769
769
  if (!ie && F.state.next({
@@ -816,7 +816,7 @@ function hr(t = {}) {
816
816
  errors: a ? e.errors : {}
817
817
  });
818
818
  }, rt = (a, n, o) => {
819
- const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: A, type: k, ...T } = _;
819
+ const h = (m(s, a, { _f: {} })._f || {}).ref, _ = m(e.errors, a) || {}, { ref: y, message: A, type: C, ...T } = _;
820
820
  R(e.errors, a, {
821
821
  ...T,
822
822
  ...n,
@@ -827,8 +827,8 @@ function hr(t = {}) {
827
827
  isValid: !1
828
828
  }), o && o.shouldFocus && h && h.focus && h.focus();
829
829
  }, Mt = (a, n) => re(a) ? F.state.subscribe({
830
- next: (o) => "values" in o && a(C(void 0, n), o)
831
- }) : C(a, n, !0), st = (a) => F.state.subscribe({
830
+ next: (o) => "values" in o && a(k(void 0, n), o)
831
+ }) : k(a, n, !0), st = (a) => F.state.subscribe({
832
832
  next: (n) => {
833
833
  yr(a.name, n.name, a.exact) && fr(n, a.formState || x, $t, a.reRenderRoot) && a.callback({
834
834
  values: { ...i },
@@ -843,7 +843,7 @@ function hr(t = {}) {
843
843
  }, st({
844
844
  ...a,
845
845
  formState: g
846
- })), ke = (a, n = {}) => {
846
+ })), Ce = (a, n = {}) => {
847
847
  for (const o of a ? z(a) : l.mount)
848
848
  l.mount.delete(o), l.array.delete(o), n.keepValue || (B(s, o), B(i, o)), !n.keepError && B(e.errors, o), !n.keepDirty && B(e.dirtyFields, o), !n.keepTouched && B(e.touchedFields, o), !n.keepIsValidating && B(e.validatingFields, o), !r.shouldUnregister && !n.keepDefaultValue && B(u, o);
849
849
  F.state.next({
@@ -884,15 +884,15 @@ function hr(t = {}) {
884
884
  ref: (_) => {
885
885
  if (_) {
886
886
  De(a, n), o = m(s, a);
887
- const y = O(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, A = nr(y), k = o._f.refs || [];
888
- if (A ? k.find((T) => T === y) : y === o._f.ref)
887
+ const y = O(_.value) && _.querySelectorAll && _.querySelectorAll("input,select,textarea")[0] || _, A = nr(y), C = o._f.refs || [];
888
+ if (A ? C.find((T) => T === y) : y === o._f.ref)
889
889
  return;
890
890
  R(s, a, {
891
891
  _f: {
892
892
  ...o._f,
893
893
  ...A ? {
894
894
  refs: [
895
- ...k.filter(Ue),
895
+ ...C.filter(Ue),
896
896
  y,
897
897
  ...Array.isArray(m(u, a)) ? [{}] : []
898
898
  ],
@@ -954,14 +954,14 @@ function hr(t = {}) {
954
954
  ...l.mount,
955
955
  ...Object.keys(fe(u, i))
956
956
  ]);
957
- for (const k of Array.from(A))
958
- m(e.dirtyFields, k) ? R(y, k, m(i, k)) : Q(k, m(y, k));
957
+ for (const C of Array.from(A))
958
+ m(e.dirtyFields, C) ? R(y, C, m(i, C)) : Q(C, m(y, C));
959
959
  } else {
960
960
  if (ze && O(a))
961
961
  for (const A of l.mount) {
962
- const k = m(s, A);
963
- if (k && k._f) {
964
- const T = Array.isArray(k._f.refs) ? k._f.refs[0] : k._f.ref;
962
+ const C = m(s, A);
963
+ if (C && C._f) {
964
+ const T = Array.isArray(C._f.refs) ? C._f.refs[0] : C._f.ref;
965
965
  if (xe(T)) {
966
966
  const J = T.closest("form");
967
967
  if (J) {
@@ -1016,14 +1016,14 @@ function hr(t = {}) {
1016
1016
  }, ot = {
1017
1017
  control: {
1018
1018
  register: De,
1019
- unregister: ke,
1019
+ unregister: Ce,
1020
1020
  getFieldState: tt,
1021
1021
  handleSubmit: nt,
1022
1022
  setError: rt,
1023
1023
  _subscribe: st,
1024
1024
  _runSchema: E,
1025
1025
  _focusError: Re,
1026
- _getWatch: C,
1026
+ _getWatch: k,
1027
1027
  _getDirty: se,
1028
1028
  _setValid: w,
1029
1029
  _setFieldArray: H,
@@ -1084,7 +1084,7 @@ function hr(t = {}) {
1084
1084
  reset: ut,
1085
1085
  resetField: Pt,
1086
1086
  clearErrors: Lt,
1087
- unregister: ke,
1087
+ unregister: Ce,
1088
1088
  setError: rt,
1089
1089
  setFocus: Wt,
1090
1090
  getFieldState: tt
@@ -1130,7 +1130,7 @@ var We = (t, r) => O(r) ? [] : vr(t, z(r).sort((e, s) => e - s)), $e = (t, r, e)
1130
1130
  }, Ft = (t, r, e) => (t[r] = e, t);
1131
1131
  function Vr(t) {
1132
1132
  const r = Ve(), { control: e = r.control, name: s, keyName: u = "id", shouldUnregister: i, rules: c } = t, [l, V] = b.useState(e._getFieldArray(s)), v = b.useRef(e._getFieldArray(s).map(ue)), x = b.useRef(!1);
1133
- e._names.array.add(s), b.useMemo(() => c && l.length >= 0 && e.register(s, c), [e, s, l.length, c]), Ce(() => e._subjects.array.subscribe({
1133
+ e._names.array.add(s), b.useMemo(() => c && l.length >= 0 && e.register(s, c), [e, s, l.length, c]), ke(() => e._subjects.array.subscribe({
1134
1134
  next: ({ values: f, name: d }) => {
1135
1135
  if (d === s || !d) {
1136
1136
  const p = m(f, s);
@@ -1260,7 +1260,7 @@ function Fr(t = {}) {
1260
1260
  };
1261
1261
  }
1262
1262
  const i = r.current.control;
1263
- return i._options = t, Ce(() => {
1263
+ return i._options = t, ke(() => {
1264
1264
  const c = i._subscribe({
1265
1265
  formState: i._proxyFormState,
1266
1266
  callback: () => u({ ...i._formState }),
@@ -1335,69 +1335,14 @@ const pr = ({
1335
1335
  children: t,
1336
1336
  visibility: r
1337
1337
  }) => {
1338
- const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e }), u = he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !0 : Ut(e, s, r), [r, e, s]);
1339
- return console.log(
1340
- "ConditionChecker - evaluateCondition:",
1341
- u,
1342
- "namesToWatch:",
1343
- e
1344
- ), u ? t : null;
1338
+ const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e });
1339
+ return he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !0 : Ut(e, s, r), [r, e, s]) ? t : null;
1345
1340
  }, xr = ({
1346
1341
  children: t,
1347
1342
  disabled: r
1348
1343
  }) => {
1349
1344
  const e = he(() => typeof r == "boolean" ? [] : (r == null ? void 0 : r.conditions.map((i) => i.name)) || [], [r]), s = Je({ name: e }), u = he(() => typeof r == "boolean" ? r : !r || (r == null ? void 0 : r.conditions.length) === 0 ? !1 : Ut(e, s, r), [r, e, s]);
1350
- return console.log("DisabilityChecker - isDisabled:", u, "namesToWatch:", e), Ae(t, { ...t.props, disabled: u });
1351
- }, Nt = ({
1352
- children: t,
1353
- onSubmit: r = () => {
1354
- },
1355
- onError: e = () => {
1356
- },
1357
- style: s = {},
1358
- className: u = "",
1359
- formOptions: i,
1360
- showAsterisk: c,
1361
- ref: l,
1362
- onChange: V
1363
- }) => {
1364
- const v = Fr({
1365
- mode: "onSubmit",
1366
- reValidateMode: "onChange",
1367
- shouldFocusError: !0,
1368
- ...i
1369
- });
1370
- return bt(
1371
- l,
1372
- () => ({
1373
- setValue: v.setValue,
1374
- setError: v.setError,
1375
- clearErrors: v.clearErrors,
1376
- getValues: v.getValues,
1377
- reset: v.reset,
1378
- setFocus: v.setFocus,
1379
- resetField: v.resetField,
1380
- trigger: v.trigger,
1381
- unregister: v.unregister,
1382
- watch: v.watch,
1383
- handleSubmit: v.handleSubmit
1384
- }),
1385
- [v]
1386
- ), Kt(() => {
1387
- const x = v.watch((g) => {
1388
- V == null || V(g);
1389
- });
1390
- return () => x.unsubscribe();
1391
- }, [v.watch]), /* @__PURE__ */ ee(br, { showAsterisk: c, children: /* @__PURE__ */ ee(er, { ...v, children: /* @__PURE__ */ ee(
1392
- "form",
1393
- {
1394
- noValidate: !0,
1395
- onSubmit: v.handleSubmit(r, e),
1396
- style: s,
1397
- className: u,
1398
- children: t
1399
- }
1400
- ) }) });
1345
+ return Ae(t, { ...t.props, disabled: u });
1401
1346
  }, et = ({
1402
1347
  children: t,
1403
1348
  name: r,
@@ -1451,7 +1396,9 @@ const pr = ({
1451
1396
  )
1452
1397
  }
1453
1398
  ) }) });
1454
- }, Sr = ({
1399
+ };
1400
+ et.displayName = "SuprFormControl";
1401
+ const Sr = ({
1455
1402
  name: t,
1456
1403
  rules: r,
1457
1404
  ref: e,
@@ -1464,9 +1411,9 @@ const pr = ({
1464
1411
  rules: r
1465
1412
  });
1466
1413
  bt(e, () => c, [c]);
1467
- const l = (V, v) => Yt.map(V, (x) => {
1414
+ const l = (V, v) => Kt.map(V, (x) => {
1468
1415
  var L, w;
1469
- if (!Jt(x))
1416
+ if (!Yt(x))
1470
1417
  return x;
1471
1418
  const g = x.props, F = x.type;
1472
1419
  if (((F == null ? void 0 : F.displayName) === "SuprFormControl" || F === et || g.name !== void 0 && typeof F != "string") && g.name !== void 0) {
@@ -1508,8 +1455,57 @@ const pr = ({
1508
1455
  x
1509
1456
  );
1510
1457
  }) });
1458
+ }, Nt = ({
1459
+ children: t,
1460
+ onSubmit: r = () => {
1461
+ },
1462
+ onError: e = () => {
1463
+ },
1464
+ style: s = {},
1465
+ className: u = "",
1466
+ formOptions: i,
1467
+ showAsterisk: c,
1468
+ ref: l,
1469
+ onChange: V
1470
+ }) => {
1471
+ const v = Fr({
1472
+ mode: "onSubmit",
1473
+ reValidateMode: "onChange",
1474
+ shouldFocusError: !0,
1475
+ ...i
1476
+ });
1477
+ return bt(
1478
+ l,
1479
+ () => ({
1480
+ setValue: v.setValue,
1481
+ setError: v.setError,
1482
+ clearErrors: v.clearErrors,
1483
+ getValues: v.getValues,
1484
+ reset: v.reset,
1485
+ setFocus: v.setFocus,
1486
+ resetField: v.resetField,
1487
+ trigger: v.trigger,
1488
+ unregister: v.unregister,
1489
+ watch: v.watch,
1490
+ handleSubmit: v.handleSubmit
1491
+ }),
1492
+ [v]
1493
+ ), Jt(() => {
1494
+ const x = v.watch((g) => {
1495
+ V == null || V(g);
1496
+ });
1497
+ return () => x.unsubscribe();
1498
+ }, [v.watch]), /* @__PURE__ */ ee(br, { showAsterisk: c, children: /* @__PURE__ */ ee(er, { ...v, children: /* @__PURE__ */ ee(
1499
+ "form",
1500
+ {
1501
+ noValidate: !0,
1502
+ onSubmit: v.handleSubmit(r, e),
1503
+ style: s,
1504
+ className: u,
1505
+ children: t
1506
+ }
1507
+ ) }) });
1511
1508
  };
1512
- et.displayName = "SuprFormControl";
1513
1509
  Nt.Control = et;
1514
1510
  Nt.ControlArray = Sr;
1515
1511
  export {