@scbt-ecom/ui 0.67.0 → 0.67.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.
- package/dist/hooks.js +2 -2
- package/dist/{index-CVI7dOhZ.js → index-Cw6f0svP.js} +3365 -3350
- package/dist/index-Cw6f0svP.js.map +1 -0
- package/dist/ui.js +3 -3
- package/dist/{useDebounce-B-41PFpS.js → useDebounce-BZSs8EPD.js} +92 -92
- package/dist/useDebounce-BZSs8EPD.js.map +1 -0
- package/dist/{useFieldsProgress-BQ99Vijl.js → useFieldsProgress-B_tgt_Hg.js} +2 -2
- package/dist/{useFieldsProgress-BQ99Vijl.js.map → useFieldsProgress-B_tgt_Hg.js.map} +1 -1
- package/dist/widget.js +662 -668
- package/dist/widget.js.map +1 -1
- package/dist/widgets/calculator/ui/rootCalculator/RootCalculator.d.ts +3 -2
- package/dist/widgets/calculator/ui/rootCalculator/ui/FieldsGroup.d.ts +25 -0
- package/dist/widgets/calculator/ui/rootCalculator/ui/index.d.ts +1 -4
- package/package.json +1 -1
- package/dist/index-CVI7dOhZ.js.map +0 -1
- package/dist/useDebounce-B-41PFpS.js.map +0 -1
- package/dist/widgets/calculator/ui/rootCalculator/ui/CheckboxGroup.d.ts +0 -9
- package/dist/widgets/calculator/ui/rootCalculator/ui/RadioGroup.d.ts +0 -11
- package/dist/widgets/calculator/ui/rootCalculator/ui/SlidersGroup.d.ts +0 -9
- package/dist/widgets/calculator/ui/rootCalculator/ui/SwitchGroup.d.ts +0 -9
package/dist/ui.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { j as w, c as On, R as An, B as de, u as Nn, a as Tn, b as jn, d as Hn, P as Be, e as Wt, f as Gn, I as zn, g as Ze, h as Bn, A as kn, i as be, H as qn, D as Un, V as Kn, O as Xn } from "./index-
|
|
2
|
-
import { o as xi, C as yi, v as Fi, t as _i, p as Ii, K as Mi, L as Vi, M as bi, N as Pi, n as $i, q as Ei, r as Di, U as Li, s as Oi, k as Ai, m as Ni, l as Ti, w as ji } from "./index-
|
|
1
|
+
import { j as w, c as On, R as An, B as de, u as Nn, a as Tn, b as jn, d as Hn, P as Be, e as Wt, f as Gn, I as zn, g as Ze, h as Bn, A as kn, i as be, H as qn, D as Un, V as Kn, O as Xn } from "./index-Cw6f0svP.js";
|
|
2
|
+
import { o as xi, C as yi, v as Fi, t as _i, p as Ii, K as Mi, L as Vi, M as bi, N as Pi, n as $i, q as Ei, r as Di, U as Li, s as Oi, k as Ai, m as Ni, l as Ti, w as ji } from "./index-Cw6f0svP.js";
|
|
3
3
|
import * as ae from "react";
|
|
4
4
|
import { forwardRef as Q, useState as Se, useCallback as he, useEffect as ve, useRef as At, isValidElement as je, cloneElement as Qt, Children as Ie } from "react";
|
|
5
5
|
import { c as F, T as Nt } from "./typeGuards-Bhdr9KYW.js";
|
|
6
6
|
import { D as Gi, d as zi, f as Bi, b as ki, a as qi } from "./utils-DaXd4sci.js";
|
|
7
|
-
import { u as ke } from "./useDebounce-
|
|
7
|
+
import { u as ke } from "./useDebounce-BZSs8EPD.js";
|
|
8
8
|
import { m as Wn } from "./mergeRefs-qDToYXtM.js";
|
|
9
9
|
const Qn = On(
|
|
10
10
|
"group flex items-center justify-center cursor-pointer rounded-full outline-offset-[3px] outline-transparent outline-2 transition duration-12 active:scale-[0.97] disabled:pointer-events-none",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import x, { useCallback as Qe, useSyncExternalStore as $e
|
|
3
|
-
import { i as
|
|
4
|
-
const ze = () => !1,
|
|
1
|
+
import * as ie from "react";
|
|
2
|
+
import x, { useCallback as Qe, useSyncExternalStore as $e } from "react";
|
|
3
|
+
import { i as Ot } from "./isClient-C9aZtt2Q.js";
|
|
4
|
+
const ze = () => !1, lr = () => {
|
|
5
5
|
const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t = Qe(
|
|
6
6
|
(u) => {
|
|
7
7
|
const d = globalThis.matchMedia(e);
|
|
@@ -23,13 +23,13 @@ const ze = () => !1, cr = () => {
|
|
|
23
23
|
isMobile: $e(t, a, ze),
|
|
24
24
|
isDesktop: $e(i, o, ze)
|
|
25
25
|
};
|
|
26
|
-
},
|
|
26
|
+
}, ur = (e, r) => {
|
|
27
27
|
const t = (i) => {
|
|
28
28
|
e.current && !e.current.contains(i.target) && r();
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
ie.useEffect(() => {
|
|
31
31
|
var i;
|
|
32
|
-
if (
|
|
32
|
+
if (Ot)
|
|
33
33
|
return (i = globalThis == null ? void 0 : globalThis.document) == null || i.addEventListener("mousedown", t), () => {
|
|
34
34
|
globalThis == null || globalThis.document.removeEventListener("mousedown", t);
|
|
35
35
|
};
|
|
@@ -37,7 +37,7 @@ const ze = () => !1, cr = () => {
|
|
|
37
37
|
};
|
|
38
38
|
var ye = (e) => e.type === "checkbox", se = (e) => e instanceof Date, p = (e) => e == null;
|
|
39
39
|
const ot = (e) => typeof e == "object";
|
|
40
|
-
var C = (e) => !p(e) && !Array.isArray(e) && ot(e) && !se(e), lt = (e) => C(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e,
|
|
40
|
+
var C = (e) => !p(e) && !Array.isArray(e) && ot(e) && !se(e), lt = (e) => C(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ut = (e, r) => e.has(Rt(r)), Ut = (e) => {
|
|
41
41
|
const r = e.constructor && e.constructor.prototype;
|
|
42
42
|
return C(r) && r.hasOwnProperty("isPrototypeOf");
|
|
43
43
|
}, Ce = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -49,7 +49,7 @@ function R(e) {
|
|
|
49
49
|
else if (e instanceof Set)
|
|
50
50
|
r = new Set(e);
|
|
51
51
|
else if (!(Ce && (e instanceof Blob || i)) && (t || C(e)))
|
|
52
|
-
if (r = t ? [] : {}, !t && !
|
|
52
|
+
if (r = t ? [] : {}, !t && !Ut(e))
|
|
53
53
|
r = e;
|
|
54
54
|
else
|
|
55
55
|
for (const a in e)
|
|
@@ -96,7 +96,7 @@ const ve = {
|
|
|
96
96
|
pattern: "pattern",
|
|
97
97
|
required: "required",
|
|
98
98
|
validate: "validate"
|
|
99
|
-
}, dt = x.createContext(null), Me = () => x.useContext(dt),
|
|
99
|
+
}, dt = x.createContext(null), Me = () => x.useContext(dt), cr = (e) => {
|
|
100
100
|
const { children: r, ...t } = e;
|
|
101
101
|
return x.createElement(dt.Provider, { value: t }, r);
|
|
102
102
|
};
|
|
@@ -134,10 +134,10 @@ function Z(e, r) {
|
|
|
134
134
|
return !0;
|
|
135
135
|
}
|
|
136
136
|
const yt = (e, r) => {
|
|
137
|
-
const t =
|
|
138
|
-
Z(r, t.current) || (t.current = r),
|
|
137
|
+
const t = ie.useRef(r);
|
|
138
|
+
Z(r, t.current) || (t.current = r), ie.useEffect(e, t.current);
|
|
139
139
|
};
|
|
140
|
-
function
|
|
140
|
+
function Nt(e) {
|
|
141
141
|
const r = Me(), { control: t = r.control, disabled: i, name: a, exact: o } = e || {}, [u, d] = x.useState(t._formState), b = x.useRef({
|
|
142
142
|
isDirty: !1,
|
|
143
143
|
isLoading: !1,
|
|
@@ -163,7 +163,7 @@ function Bt(e) {
|
|
|
163
163
|
}, [t]), x.useMemo(() => ft(u, t, b.current, !1), [u, t]);
|
|
164
164
|
}
|
|
165
165
|
var Y = (e) => typeof e == "string", ht = (e, r, t, i, a) => Y(e) ? (i && r.watch.add(e), y(t, e, a)) : Array.isArray(e) ? e.map((o) => (i && r.watch.add(o), y(t, o))) : (i && (r.watchAll = !0), t);
|
|
166
|
-
function
|
|
166
|
+
function Pt(e) {
|
|
167
167
|
const r = Me(), { control: t = r.control, name: i, defaultValue: a, disabled: o, exact: u } = e || {}, [d, b] = x.useState(t._getWatch(i, a));
|
|
168
168
|
return yt(() => t._subscribe({
|
|
169
169
|
name: i,
|
|
@@ -174,13 +174,13 @@ function pt(e) {
|
|
|
174
174
|
callback: (D) => !o && b(ht(i, t._names, D.values || t._formValues, !1, a))
|
|
175
175
|
}), [i, a, o, u]), x.useEffect(() => t._removeUnmounted()), d;
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
const r = Me(), { name: t, disabled: i, control: a = r.control, shouldUnregister: o } = e, u = ut(a._names.array, t), d =
|
|
177
|
+
function dr(e) {
|
|
178
|
+
const r = Me(), { name: t, disabled: i, control: a = r.control, shouldUnregister: o } = e, u = ut(a._names.array, t), d = Pt({
|
|
179
179
|
control: a,
|
|
180
180
|
name: t,
|
|
181
181
|
defaultValue: y(a._formValues, t, y(a._defaultValues, t, e.defaultValue)),
|
|
182
182
|
exact: !0
|
|
183
|
-
}), b =
|
|
183
|
+
}), b = Nt({
|
|
184
184
|
control: a,
|
|
185
185
|
name: t,
|
|
186
186
|
exact: !0
|
|
@@ -295,23 +295,23 @@ var gt = (e, r, t, i, a) => r ? {
|
|
|
295
295
|
return !1;
|
|
296
296
|
const r = e ? e.ownerDocument : 0;
|
|
297
297
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
298
|
-
}, vt = (e) => e.type === "select-multiple", Oe = (e) => e.type === "radio",
|
|
299
|
-
function
|
|
298
|
+
}, vt = (e) => e.type === "select-multiple", Oe = (e) => e.type === "radio", Bt = (e) => Oe(e) || ye(e), Se = (e) => be(e) && e.isConnected;
|
|
299
|
+
function pt(e, r) {
|
|
300
300
|
const t = r.slice(0, -1).length;
|
|
301
301
|
let i = 0;
|
|
302
302
|
for (; i < t; )
|
|
303
303
|
e = k(e) ? i++ : e[r[i++]];
|
|
304
304
|
return e;
|
|
305
305
|
}
|
|
306
|
-
function
|
|
306
|
+
function It(e) {
|
|
307
307
|
for (const r in e)
|
|
308
308
|
if (e.hasOwnProperty(r) && !k(e[r]))
|
|
309
309
|
return !1;
|
|
310
310
|
return !0;
|
|
311
311
|
}
|
|
312
312
|
function M(e, r) {
|
|
313
|
-
const t = Array.isArray(r) ? r : Te(r) ? [r] : ct(r), i = t.length === 1 ? e :
|
|
314
|
-
return i && delete i[o], a !== 0 && (C(i) && B(i) || Array.isArray(i) &&
|
|
313
|
+
const t = Array.isArray(r) ? r : Te(r) ? [r] : ct(r), i = t.length === 1 ? e : pt(e, t), a = t.length - 1, o = t[a];
|
|
314
|
+
return i && delete i[o], a !== 0 && (C(i) && B(i) || Array.isArray(i) && It(i)) && M(e, t.slice(0, -1)), e;
|
|
315
315
|
}
|
|
316
316
|
var bt = (e) => {
|
|
317
317
|
for (const r in e)
|
|
@@ -333,7 +333,7 @@ function mt(e, r, t) {
|
|
|
333
333
|
Array.isArray(e[a]) || C(e[a]) && !bt(e[a]) ? k(r) || ke(t[a]) ? t[a] = Array.isArray(e[a]) ? me(e[a], []) : { ...me(e[a]) } : mt(e[a], p(r) ? {} : r[a], t[a]) : t[a] = !Z(e[a], r[a]);
|
|
334
334
|
return t;
|
|
335
335
|
}
|
|
336
|
-
var
|
|
336
|
+
var ue = (e, r) => mt(e, r, me(r));
|
|
337
337
|
const Ye = {
|
|
338
338
|
value: !1,
|
|
339
339
|
isValid: !1
|
|
@@ -363,7 +363,7 @@ function Ze(e) {
|
|
|
363
363
|
const r = e.ref;
|
|
364
364
|
return Le(r) ? r.files : Oe(r) ? Ft(e.refs).value : vt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : ye(r) ? _t(e.refs).value : Vt(k(r.value) ? e.ref.value : r.value, e);
|
|
365
365
|
}
|
|
366
|
-
var
|
|
366
|
+
var qt = (e, r, t, i) => {
|
|
367
367
|
const a = {};
|
|
368
368
|
for (const o of e) {
|
|
369
369
|
const u = y(r, o);
|
|
@@ -375,7 +375,7 @@ var Ht = (e, r, t, i) => {
|
|
|
375
375
|
fields: a,
|
|
376
376
|
shouldUseNativeValidation: i
|
|
377
377
|
};
|
|
378
|
-
}, _e = (e) => e instanceof RegExp,
|
|
378
|
+
}, _e = (e) => e instanceof RegExp, ce = (e) => k(e) ? e : _e(e) ? e.source : C(e) ? _e(e.value) ? e.value.source : e.value : e, et = (e) => ({
|
|
379
379
|
isOnSubmit: !e || e === Q.onSubmit,
|
|
380
380
|
isOnBlur: e === Q.onBlur,
|
|
381
381
|
isOnChange: e === Q.onChange,
|
|
@@ -383,7 +383,7 @@ var Ht = (e, r, t, i) => {
|
|
|
383
383
|
isOnTouch: e === Q.onTouched
|
|
384
384
|
});
|
|
385
385
|
const tt = "AsyncFunction";
|
|
386
|
-
var
|
|
386
|
+
var Wt = (e) => !!e && !!e.validate && !!($(e.validate) && e.validate.constructor.name === tt || C(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === tt)), Ht = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), rt = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
|
|
387
387
|
const fe = (e, r, t, i) => {
|
|
388
388
|
for (const a of t || Object.keys(e)) {
|
|
389
389
|
const o = y(e, a);
|
|
@@ -424,11 +424,11 @@ function st(e, r, t) {
|
|
|
424
424
|
name: t
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
var
|
|
427
|
+
var jt = (e, r, t, i) => {
|
|
428
428
|
t(e);
|
|
429
429
|
const { name: a, ...o } = e;
|
|
430
430
|
return B(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((u) => r[u] === (!i || Q.all));
|
|
431
|
-
},
|
|
431
|
+
}, Kt = (e, r, t) => !e || !r || e === r || de(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i))), Qt = (e, r, t, i, a) => a.isOnAll ? !1 : !t && a.isOnTouch ? !(r || e) : (t ? i.isOnBlur : a.isOnBlur) ? !e : (t ? i.isOnChange : a.isOnChange) ? e : !0, $t = (e, r) => !Ve(y(e, r)).length && M(e, r), zt = (e, r, t) => {
|
|
432
432
|
const i = de(y(e, t));
|
|
433
433
|
return A(i, "root", r[t]), A(e, t, i), e;
|
|
434
434
|
}, ge = (e) => Y(e);
|
|
@@ -440,7 +440,7 @@ function it(e, r, t = "validate") {
|
|
|
440
440
|
ref: r
|
|
441
441
|
};
|
|
442
442
|
}
|
|
443
|
-
var
|
|
443
|
+
var ne = (e) => C(e) && !_e(e) ? e : {
|
|
444
444
|
value: e,
|
|
445
445
|
message: ""
|
|
446
446
|
}, nt = async (e, r, t, i, a, o) => {
|
|
@@ -449,7 +449,7 @@ var ie = (e) => C(e) && !_e(e) ? e : {
|
|
|
449
449
|
return {};
|
|
450
450
|
const K = d ? d[0] : u, q = (F) => {
|
|
451
451
|
a && K.reportValidity && (K.setCustomValidity(W(F) ? "" : F || ""), K.reportValidity());
|
|
452
|
-
}, L = {},
|
|
452
|
+
}, L = {}, ae = Oe(u), oe = ye(u), Fe = ae || oe, z = (N || Le(u)) && k(u.value) && k(v) || be(u) && u.value === "" || v === "" || Array.isArray(v) && !v.length, re = gt.bind(null, O, i, L), J = (F, _, S, I = X.maxLength, H = X.minLength) => {
|
|
453
453
|
const G = F ? _ : S;
|
|
454
454
|
L[O] = {
|
|
455
455
|
type: F ? I : H,
|
|
@@ -458,8 +458,8 @@ var ie = (e) => C(e) && !_e(e) ? e : {
|
|
|
458
458
|
...re(F ? I : H, G)
|
|
459
459
|
};
|
|
460
460
|
};
|
|
461
|
-
if (o ? !Array.isArray(v) || !v.length : b && (!Fe && (z || p(v)) || W(v) && !v ||
|
|
462
|
-
const { value: F, message: _ } = ge(b) ? { value: !!b, message: b } :
|
|
461
|
+
if (o ? !Array.isArray(v) || !v.length : b && (!Fe && (z || p(v)) || W(v) && !v || oe && !_t(d).isValid || ae && !Ft(d).isValid)) {
|
|
462
|
+
const { value: F, message: _ } = ge(b) ? { value: !!b, message: b } : ne(b);
|
|
463
463
|
if (F && (L[O] = {
|
|
464
464
|
type: X.required,
|
|
465
465
|
message: _,
|
|
@@ -470,24 +470,24 @@ var ie = (e) => C(e) && !_e(e) ? e : {
|
|
|
470
470
|
}
|
|
471
471
|
if (!z && (!p(w) || !p(m))) {
|
|
472
472
|
let F, _;
|
|
473
|
-
const S =
|
|
473
|
+
const S = ne(m), I = ne(w);
|
|
474
474
|
if (!p(v) && !isNaN(v)) {
|
|
475
475
|
const H = u.valueAsNumber || v && +v;
|
|
476
476
|
p(S.value) || (F = H > S.value), p(I.value) || (_ = H < I.value);
|
|
477
477
|
} else {
|
|
478
|
-
const H = u.valueAsDate || new Date(v), G = (he) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + he), ee = u.type == "time",
|
|
479
|
-
Y(S.value) && v && (F = ee ? G(v) > G(S.value) :
|
|
478
|
+
const H = u.valueAsDate || new Date(v), G = (he) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + he), ee = u.type == "time", le = u.type == "week";
|
|
479
|
+
Y(S.value) && v && (F = ee ? G(v) > G(S.value) : le ? v > S.value : H > new Date(S.value)), Y(I.value) && v && (_ = ee ? G(v) < G(I.value) : le ? v < I.value : H < new Date(I.value));
|
|
480
480
|
}
|
|
481
481
|
if ((F || _) && (J(!!F, S.message, I.message, X.max, X.min), !i))
|
|
482
482
|
return q(L[O].message), L;
|
|
483
483
|
}
|
|
484
484
|
if ((D || E) && !z && (Y(v) || o && Array.isArray(v))) {
|
|
485
|
-
const F =
|
|
485
|
+
const F = ne(D), _ = ne(E), S = !p(F.value) && v.length > +F.value, I = !p(_.value) && v.length < +_.value;
|
|
486
486
|
if ((S || I) && (J(S, F.message, _.message), !i))
|
|
487
487
|
return q(L[O].message), L;
|
|
488
488
|
}
|
|
489
489
|
if (te && !z && Y(v)) {
|
|
490
|
-
const { value: F, message: _ } =
|
|
490
|
+
const { value: F, message: _ } = ne(te);
|
|
491
491
|
if (_e(F) && !v.match(F) && (L[O] = {
|
|
492
492
|
type: X.pattern,
|
|
493
493
|
message: _,
|
|
@@ -524,14 +524,14 @@ var ie = (e) => C(e) && !_e(e) ? e : {
|
|
|
524
524
|
}
|
|
525
525
|
return q(!0), L;
|
|
526
526
|
};
|
|
527
|
-
const
|
|
527
|
+
const Gt = {
|
|
528
528
|
mode: Q.onSubmit,
|
|
529
529
|
reValidateMode: Q.onChange,
|
|
530
530
|
shouldFocusError: !0
|
|
531
531
|
};
|
|
532
|
-
function
|
|
532
|
+
function Yt(e = {}) {
|
|
533
533
|
let r = {
|
|
534
|
-
...
|
|
534
|
+
...Gt,
|
|
535
535
|
...e
|
|
536
536
|
}, t = {
|
|
537
537
|
submitCount: 0,
|
|
@@ -600,13 +600,13 @@ function Xt(e = {}) {
|
|
|
600
600
|
}
|
|
601
601
|
if (c && Array.isArray(y(t.errors, s))) {
|
|
602
602
|
const g = l(y(t.errors, s), h.argA, h.argB);
|
|
603
|
-
f && A(t.errors, s, g),
|
|
603
|
+
f && A(t.errors, s, g), $t(t.errors, s);
|
|
604
604
|
}
|
|
605
605
|
if ((E.touchedFields || w.touchedFields) && c && Array.isArray(y(t.touchedFields, s))) {
|
|
606
606
|
const g = l(y(t.touchedFields, s), h.argA, h.argB);
|
|
607
607
|
f && A(t.touchedFields, s, g);
|
|
608
608
|
}
|
|
609
|
-
(E.dirtyFields || w.dirtyFields) && (t.dirtyFields =
|
|
609
|
+
(E.dirtyFields || w.dirtyFields) && (t.dirtyFields = ue(a, o)), m.state.next({
|
|
610
610
|
name: s,
|
|
611
611
|
isDirty: _(s, n),
|
|
612
612
|
dirtyFields: t.dirtyFields,
|
|
@@ -624,13 +624,13 @@ function Xt(e = {}) {
|
|
|
624
624
|
errors: t.errors,
|
|
625
625
|
isValid: !1
|
|
626
626
|
});
|
|
627
|
-
},
|
|
627
|
+
}, ae = (s, n, l, h) => {
|
|
628
628
|
const f = y(i, s);
|
|
629
629
|
if (f) {
|
|
630
630
|
const c = y(o, s, k(l) ? y(a, s) : l);
|
|
631
631
|
k(c) || h && h.defaultChecked || n ? A(o, s, n ? c : Ze(f._f)) : H(s, c), u.mount && P();
|
|
632
632
|
}
|
|
633
|
-
},
|
|
633
|
+
}, oe = (s, n, l, h, f) => {
|
|
634
634
|
let c = !1, g = !1;
|
|
635
635
|
const V = {
|
|
636
636
|
name: s
|
|
@@ -664,7 +664,7 @@ function Xt(e = {}) {
|
|
|
664
664
|
}
|
|
665
665
|
}, z = async (s) => {
|
|
666
666
|
v(s, !0);
|
|
667
|
-
const n = await r.resolver(o, r.context,
|
|
667
|
+
const n = await r.resolver(o, r.context, qt(s || d.mount, i, r.criteriaMode, r.shouldUseNativeValidation));
|
|
668
668
|
return v(s), n;
|
|
669
669
|
}, re = async (s) => {
|
|
670
670
|
const { errors: n } = await z(s);
|
|
@@ -684,12 +684,12 @@ function Xt(e = {}) {
|
|
|
684
684
|
if (f) {
|
|
685
685
|
const { _f: c, ...g } = f;
|
|
686
686
|
if (c) {
|
|
687
|
-
const V = d.array.has(c.name), T = f._f &&
|
|
687
|
+
const V = d.array.has(c.name), T = f._f && Wt(f._f);
|
|
688
688
|
T && E.validatingFields && v([h], !0);
|
|
689
689
|
const U = await nt(f, d.disabled, o, O, r.shouldUseNativeValidation && !n, V);
|
|
690
690
|
if (T && E.validatingFields && v([h]), U[c.name] && (l.valid = !1, n))
|
|
691
691
|
break;
|
|
692
|
-
!n && (y(U, c.name) ? V ?
|
|
692
|
+
!n && (y(U, c.name) ? V ? zt(t.errors, U, c.name) : A(t.errors, c.name, U[c.name]) : M(t.errors, c.name));
|
|
693
693
|
}
|
|
694
694
|
!B(g) && await J(g, n, l);
|
|
695
695
|
}
|
|
@@ -713,7 +713,7 @@ function Xt(e = {}) {
|
|
|
713
713
|
values: R(o)
|
|
714
714
|
})));
|
|
715
715
|
}
|
|
716
|
-
(l.shouldDirty || l.shouldTouch) &&
|
|
716
|
+
(l.shouldDirty || l.shouldTouch) && oe(s, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && Ae(s);
|
|
717
717
|
}, G = (s, n, l) => {
|
|
718
718
|
for (const h in n) {
|
|
719
719
|
const f = n[h], c = `${s}.${h}`, g = y(i, c);
|
|
@@ -726,13 +726,13 @@ function Xt(e = {}) {
|
|
|
726
726
|
values: R(o)
|
|
727
727
|
}), (E.isDirty || E.dirtyFields || w.isDirty || w.dirtyFields) && l.shouldDirty && m.state.next({
|
|
728
728
|
name: s,
|
|
729
|
-
dirtyFields:
|
|
729
|
+
dirtyFields: ue(a, o),
|
|
730
730
|
isDirty: _(s, c)
|
|
731
731
|
})) : h && !h._f && !p(c) ? G(s, c, l) : H(s, c, l), rt(s, d) && m.state.next({ ...t }), m.state.next({
|
|
732
732
|
name: u.mount ? s : void 0,
|
|
733
733
|
values: R(o)
|
|
734
734
|
});
|
|
735
|
-
},
|
|
735
|
+
}, le = async (s) => {
|
|
736
736
|
u.mount = !0;
|
|
737
737
|
const n = s.target;
|
|
738
738
|
let l = n.name, h = !0;
|
|
@@ -741,9 +741,9 @@ function Xt(e = {}) {
|
|
|
741
741
|
};
|
|
742
742
|
if (f) {
|
|
743
743
|
let g, V;
|
|
744
|
-
const T = n.type ? Ze(f._f) : lt(s), U = s.type === ve.BLUR || s.type === ve.FOCUS_OUT, Tt = !
|
|
744
|
+
const T = n.type ? Ze(f._f) : lt(s), U = s.type === ve.BLUR || s.type === ve.FOCUS_OUT, Tt = !Ht(f._f) && !r.resolver && !y(t.errors, l) && !f._f.deps || Qt(U, y(t.touchedFields, l), t.isSubmitted, j, te), De = rt(l, d, U);
|
|
745
745
|
A(o, l, T), U ? (f._f.onBlur && f._f.onBlur(s), b && b(0)) : f._f.onChange && f._f.onChange(s);
|
|
746
|
-
const we =
|
|
746
|
+
const we = oe(l, T, U), Mt = !B(we) || De;
|
|
747
747
|
if (!U && m.state.next({
|
|
748
748
|
name: l,
|
|
749
749
|
type: s.type,
|
|
@@ -808,7 +808,7 @@ function Xt(e = {}) {
|
|
|
808
808
|
next: (l) => s(S(void 0, n), l)
|
|
809
809
|
}) : S(s, n, !0), Pe = (s) => m.state.subscribe({
|
|
810
810
|
next: (n) => {
|
|
811
|
-
|
|
811
|
+
Kt(s.name, n.name, s.exact) && jt(n, s.formState || E, Ct, s.reRenderRoot) && s.callback({
|
|
812
812
|
values: { ...o },
|
|
813
813
|
...t,
|
|
814
814
|
...n
|
|
@@ -845,23 +845,23 @@ function Xt(e = {}) {
|
|
|
845
845
|
}), d.mount.add(s), l ? Be({
|
|
846
846
|
disabled: W(n.disabled) ? n.disabled : r.disabled,
|
|
847
847
|
name: s
|
|
848
|
-
}) :
|
|
848
|
+
}) : ae(s, !0, n.value), {
|
|
849
849
|
...h ? { disabled: n.disabled || r.disabled } : {},
|
|
850
850
|
...r.progressive ? {
|
|
851
851
|
required: !!n.required,
|
|
852
|
-
min:
|
|
853
|
-
max:
|
|
854
|
-
minLength:
|
|
855
|
-
maxLength:
|
|
856
|
-
pattern:
|
|
852
|
+
min: ce(n.min),
|
|
853
|
+
max: ce(n.max),
|
|
854
|
+
minLength: ce(n.minLength),
|
|
855
|
+
maxLength: ce(n.maxLength),
|
|
856
|
+
pattern: ce(n.pattern)
|
|
857
857
|
} : {},
|
|
858
858
|
name: s,
|
|
859
|
-
onChange:
|
|
860
|
-
onBlur:
|
|
859
|
+
onChange: le,
|
|
860
|
+
onBlur: le,
|
|
861
861
|
ref: (f) => {
|
|
862
862
|
if (f) {
|
|
863
863
|
Ee(s, n), l = y(i, s);
|
|
864
|
-
const c = k(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g =
|
|
864
|
+
const c = k(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = Bt(c), V = l._f.refs || [];
|
|
865
865
|
if (g ? V.find((T) => T === c) : c === l._f.ref)
|
|
866
866
|
return;
|
|
867
867
|
A(i, s, {
|
|
@@ -876,7 +876,7 @@ function Xt(e = {}) {
|
|
|
876
876
|
ref: { type: c.type, name: s }
|
|
877
877
|
} : { ref: c }
|
|
878
878
|
}
|
|
879
|
-
}),
|
|
879
|
+
}), ae(s, !1, void 0, c);
|
|
880
880
|
} else
|
|
881
881
|
l = y(i, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(ut(d.array, s) && u.action) && d.unMount.add(s);
|
|
882
882
|
}
|
|
@@ -929,7 +929,7 @@ function Xt(e = {}) {
|
|
|
929
929
|
if (n.keepDirtyValues) {
|
|
930
930
|
const g = /* @__PURE__ */ new Set([
|
|
931
931
|
...d.mount,
|
|
932
|
-
...Object.keys(
|
|
932
|
+
...Object.keys(ue(a, o))
|
|
933
933
|
]);
|
|
934
934
|
for (const V of Array.from(g))
|
|
935
935
|
y(t.dirtyFields, V) ? A(c, V, y(o, V)) : ee(V, y(c, V));
|
|
@@ -969,7 +969,7 @@ function Xt(e = {}) {
|
|
|
969
969
|
submitCount: n.keepSubmitCount ? t.submitCount : 0,
|
|
970
970
|
isDirty: f ? !1 : n.keepDirty ? t.isDirty : !!(n.keepDefaultValues && !Z(s, a)),
|
|
971
971
|
isSubmitted: n.keepIsSubmitted ? t.isSubmitted : !1,
|
|
972
|
-
dirtyFields: f ? {} : n.keepDirtyValues ? n.keepDefaultValues && o ?
|
|
972
|
+
dirtyFields: f ? {} : n.keepDirtyValues ? n.keepDefaultValues && o ? ue(a, o) : t.dirtyFields : n.keepDefaultValues && s ? ue(a, s) : n.keepDirty ? t.dirtyFields : {},
|
|
973
973
|
touchedFields: n.keepTouched ? t.touchedFields : {},
|
|
974
974
|
errors: n.keepErrors ? t.errors : {},
|
|
975
975
|
isSubmitSuccessful: n.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
@@ -1066,8 +1066,8 @@ function Xt(e = {}) {
|
|
|
1066
1066
|
formControl: He
|
|
1067
1067
|
};
|
|
1068
1068
|
}
|
|
1069
|
-
const
|
|
1070
|
-
function
|
|
1069
|
+
const Jt = typeof window < "u" ? x.useLayoutEffect : x.useEffect;
|
|
1070
|
+
function Xt(e = {}) {
|
|
1071
1071
|
const r = x.useRef(void 0), t = x.useRef(void 0), [i, a] = x.useState({
|
|
1072
1072
|
isDirty: !1,
|
|
1073
1073
|
isValidating: !1,
|
|
@@ -1086,11 +1086,11 @@ function er(e = {}) {
|
|
|
1086
1086
|
defaultValues: $(e.defaultValues) ? void 0 : e.defaultValues
|
|
1087
1087
|
});
|
|
1088
1088
|
r.current || (r.current = {
|
|
1089
|
-
...e.formControl ? e.formControl :
|
|
1089
|
+
...e.formControl ? e.formControl : Yt(e),
|
|
1090
1090
|
formState: i
|
|
1091
1091
|
}, e.formControl && e.defaultValues && !$(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
|
|
1092
1092
|
const o = r.current.control;
|
|
1093
|
-
return o._options = e,
|
|
1093
|
+
return o._options = e, Jt(() => {
|
|
1094
1094
|
const u = o._subscribe({
|
|
1095
1095
|
formState: o._proxyFormState,
|
|
1096
1096
|
callback: () => a({ ...o._formState }),
|
|
@@ -1099,7 +1099,7 @@ function er(e = {}) {
|
|
|
1099
1099
|
return a((d) => ({
|
|
1100
1100
|
...d,
|
|
1101
1101
|
isReady: !0
|
|
1102
|
-
})), u;
|
|
1102
|
+
})), o._formState.isReady = !0, u;
|
|
1103
1103
|
}, [o]), x.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), x.useEffect(() => {
|
|
1104
1104
|
e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode), e.errors && !B(e.errors) && o._setErrors(e.errors);
|
|
1105
1105
|
}, [o, e.errors, e.mode, e.reValidateMode]), x.useEffect(() => {
|
|
@@ -1129,19 +1129,19 @@ const at = (e, r, t) => {
|
|
|
1129
1129
|
const i = r.fields[t];
|
|
1130
1130
|
i && i.ref && "reportValidity" in i.ref ? at(i.ref, t, e) : i.refs && i.refs.forEach((a) => at(a, t, e));
|
|
1131
1131
|
}
|
|
1132
|
-
},
|
|
1132
|
+
}, Zt = (e, r) => {
|
|
1133
1133
|
r.shouldUseNativeValidation && At(e, r);
|
|
1134
1134
|
const t = {};
|
|
1135
1135
|
for (const i in e) {
|
|
1136
1136
|
const a = y(r.fields, i), o = Object.assign(e[i] || {}, { ref: a && a.ref });
|
|
1137
|
-
if (
|
|
1137
|
+
if (er(r.names || Object.keys(e), i)) {
|
|
1138
1138
|
const u = Object.assign({}, y(t, i));
|
|
1139
1139
|
A(u, "root", o), A(t, i, u);
|
|
1140
1140
|
} else A(t, i, o);
|
|
1141
1141
|
}
|
|
1142
1142
|
return t;
|
|
1143
|
-
},
|
|
1144
|
-
var
|
|
1143
|
+
}, er = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
1144
|
+
var tr = function(e, r) {
|
|
1145
1145
|
for (var t = {}; e.length; ) {
|
|
1146
1146
|
var i = e[0], a = i.code, o = i.message, u = i.path.join(".");
|
|
1147
1147
|
if (!t[u]) if ("unionErrors" in i) {
|
|
@@ -1159,7 +1159,7 @@ var sr = function(e, r) {
|
|
|
1159
1159
|
e.shift();
|
|
1160
1160
|
}
|
|
1161
1161
|
return t;
|
|
1162
|
-
},
|
|
1162
|
+
}, rr = function(e, r, t) {
|
|
1163
1163
|
return t === void 0 && (t = {}), function(i, a, o) {
|
|
1164
1164
|
try {
|
|
1165
1165
|
return Promise.resolve(function(u, d) {
|
|
@@ -1174,7 +1174,7 @@ var sr = function(e, r) {
|
|
|
1174
1174
|
}(0, function(u) {
|
|
1175
1175
|
if (function(d) {
|
|
1176
1176
|
return Array.isArray(d == null ? void 0 : d.errors);
|
|
1177
|
-
}(u)) return { values: {}, errors: tr(
|
|
1177
|
+
}(u)) return { values: {}, errors: Zt(tr(u.errors, !o.shouldUseNativeValidation && o.criteriaMode === "all"), o) };
|
|
1178
1178
|
throw u;
|
|
1179
1179
|
}));
|
|
1180
1180
|
} catch (u) {
|
|
@@ -1182,30 +1182,30 @@ var sr = function(e, r) {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
};
|
|
1184
1184
|
};
|
|
1185
|
-
const
|
|
1185
|
+
const fr = ({ schema: e, ...r }) => Xt({
|
|
1186
1186
|
...r,
|
|
1187
|
-
resolver:
|
|
1188
|
-
}),
|
|
1187
|
+
resolver: rr(e)
|
|
1188
|
+
}), sr = (e, r) => {
|
|
1189
1189
|
let t;
|
|
1190
1190
|
return function(...i) {
|
|
1191
1191
|
clearTimeout(t), t = setTimeout(() => e(...i), r);
|
|
1192
1192
|
};
|
|
1193
|
-
},
|
|
1194
|
-
const t =
|
|
1195
|
-
return
|
|
1193
|
+
}, ir = (e, r) => ie.useMemo(() => sr(e, r), [r]), yr = (e, r) => {
|
|
1194
|
+
const t = ie.useRef(e), [i, a] = ie.useState(e), o = ir(a, r);
|
|
1195
|
+
return ie.useEffect(() => {
|
|
1196
1196
|
t.current !== e && (o(e), t.current = e);
|
|
1197
1197
|
}, [e]), i;
|
|
1198
1198
|
};
|
|
1199
1199
|
export {
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1200
|
+
cr as F,
|
|
1201
|
+
ur as a,
|
|
1202
|
+
fr as b,
|
|
1203
|
+
ir as c,
|
|
1204
|
+
sr as d,
|
|
1205
|
+
yr as e,
|
|
1206
|
+
Pt as f,
|
|
1207
1207
|
Me as g,
|
|
1208
|
-
|
|
1209
|
-
|
|
1208
|
+
dr as h,
|
|
1209
|
+
lr as u
|
|
1210
1210
|
};
|
|
1211
|
-
//# sourceMappingURL=useDebounce-
|
|
1211
|
+
//# sourceMappingURL=useDebounce-BZSs8EPD.js.map
|