@scbt-ecom/ui 0.46.3 → 0.46.5
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 +58 -38
- package/dist/hooks.js.map +1 -1
- package/dist/{index-PVEZwXww.js → index-CmLWueZd.js} +2412 -2418
- package/dist/{index-PVEZwXww.js.map → index-CmLWueZd.js.map} +1 -1
- package/dist/shared/utils/typeGuards.d.ts +1 -0
- package/dist/{typeGuards-yOWv7RXH.js → typeGuards-CSJS99k6.js} +29 -26
- package/dist/{typeGuards-yOWv7RXH.js.map → typeGuards-CSJS99k6.js.map} +1 -1
- package/dist/ui.js +4 -4
- package/dist/{useFloating-9_G5403U.js → useDebounce-QgEEiWs9.js} +321 -342
- package/dist/useDebounce-QgEEiWs9.js.map +1 -0
- package/dist/{utils-SIizw_5C.js → utils-BAQ59khV.js} +2 -2
- package/dist/{utils-SIizw_5C.js.map → utils-BAQ59khV.js.map} +1 -1
- package/dist/utils.js +1 -1
- package/dist/validation.js +2 -2
- package/dist/widget.js +347 -329
- package/dist/widget.js.map +1 -1
- package/dist/widgets/banner/Banner.d.ts +6 -4
- package/dist/widgets/banner/model/constants.d.ts +15 -0
- package/dist/widgets/banner/model/types.d.ts +4 -0
- package/dist/widgets/banner/ui/banners/BannerImageFull.d.ts +1 -1
- package/dist/widgets/banner/ui/banners/BannerWithSeparateImg.d.ts +1 -1
- package/package.json +1 -1
- package/dist/useFloating-9_G5403U.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { i as
|
|
4
|
-
const Ge = () => !1,
|
|
5
|
-
const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t =
|
|
1
|
+
import * as fe from "react";
|
|
2
|
+
import D, { useCallback as $e, useSyncExternalStore as ze } from "react";
|
|
3
|
+
import { i as pt } from "./isClient-C9aZtt2Q.js";
|
|
4
|
+
const Ge = () => !1, ir = () => {
|
|
5
|
+
const e = "(max-width: 1187px)", r = "(min-width: 1188px)", t = $e(
|
|
6
6
|
(l) => {
|
|
7
7
|
const d = globalThis.matchMedia(e);
|
|
8
8
|
return d.addEventListener("change", l), () => {
|
|
@@ -10,7 +10,7 @@ const Ge = () => !1, ar = () => {
|
|
|
10
10
|
};
|
|
11
11
|
},
|
|
12
12
|
[e]
|
|
13
|
-
), i =
|
|
13
|
+
), i = $e(
|
|
14
14
|
(l) => {
|
|
15
15
|
const d = globalThis.matchMedia(r);
|
|
16
16
|
return d.addEventListener("change", l), () => {
|
|
@@ -20,58 +20,58 @@ const Ge = () => !1, ar = () => {
|
|
|
20
20
|
[r]
|
|
21
21
|
), a = () => globalThis.matchMedia(e).matches, u = () => globalThis.matchMedia(r).matches;
|
|
22
22
|
return {
|
|
23
|
-
isMobile:
|
|
24
|
-
isDesktop:
|
|
23
|
+
isMobile: ze(t, a, Ge),
|
|
24
|
+
isDesktop: ze(i, u, Ge)
|
|
25
25
|
};
|
|
26
|
-
},
|
|
26
|
+
}, nr = (e, r) => {
|
|
27
27
|
const t = (i) => {
|
|
28
28
|
e.current && !e.current.contains(i.target) && r();
|
|
29
29
|
};
|
|
30
|
-
|
|
30
|
+
fe.useEffect(() => {
|
|
31
31
|
var i;
|
|
32
|
-
if (
|
|
32
|
+
if (pt)
|
|
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
|
};
|
|
36
36
|
}, [e, r]);
|
|
37
37
|
};
|
|
38
|
-
var he = (e) => e.type === "checkbox", re = (e) => e instanceof Date,
|
|
38
|
+
var he = (e) => e.type === "checkbox", re = (e) => e instanceof Date, N = (e) => e == null;
|
|
39
39
|
const at = (e) => typeof e == "object";
|
|
40
|
-
var
|
|
40
|
+
var S = (e) => !N(e) && !Array.isArray(e) && at(e) && !re(e), ut = (e) => S(e) && e.target ? he(e.target) ? e.target.checked : e.target.value : e, Ct = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ot = (e, r) => e.has(Ct(r)), Tt = (e) => {
|
|
41
41
|
const r = e.constructor && e.constructor.prototype;
|
|
42
|
-
return
|
|
43
|
-
},
|
|
44
|
-
function
|
|
42
|
+
return S(r) && r.hasOwnProperty("isPrototypeOf");
|
|
43
|
+
}, Te = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
44
|
+
function B(e) {
|
|
45
45
|
let r;
|
|
46
46
|
const t = Array.isArray(e), i = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
47
47
|
if (e instanceof Date)
|
|
48
48
|
r = new Date(e);
|
|
49
49
|
else if (e instanceof Set)
|
|
50
50
|
r = new Set(e);
|
|
51
|
-
else if (!(
|
|
52
|
-
if (r = t ? [] : {}, !t && !
|
|
51
|
+
else if (!(Te && (e instanceof Blob || i)) && (t || S(e)))
|
|
52
|
+
if (r = t ? [] : {}, !t && !Tt(e))
|
|
53
53
|
r = e;
|
|
54
54
|
else
|
|
55
55
|
for (const a in e)
|
|
56
|
-
e.hasOwnProperty(a) && (r[a] =
|
|
56
|
+
e.hasOwnProperty(a) && (r[a] = B(e[a]));
|
|
57
57
|
else
|
|
58
58
|
return e;
|
|
59
59
|
return r;
|
|
60
60
|
}
|
|
61
|
-
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [],
|
|
62
|
-
if (!r || !
|
|
61
|
+
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], E = (e) => e === void 0, f = (e, r, t) => {
|
|
62
|
+
if (!r || !S(e))
|
|
63
63
|
return t;
|
|
64
|
-
const i = Ae(r.split(/[,[\].]+?/)).reduce((a, u) =>
|
|
65
|
-
return
|
|
66
|
-
}, q = (e) => typeof e == "boolean",
|
|
64
|
+
const i = Ae(r.split(/[,[\].]+?/)).reduce((a, u) => N(a) ? a : a[u], e);
|
|
65
|
+
return E(i) || i === e ? E(e[r]) ? t : e[r] : i;
|
|
66
|
+
}, q = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), lt = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, r, t) => {
|
|
67
67
|
let i = -1;
|
|
68
|
-
const a =
|
|
68
|
+
const a = Le(r) ? [r] : lt(r), u = a.length, l = u - 1;
|
|
69
69
|
for (; ++i < u; ) {
|
|
70
70
|
const d = a[i];
|
|
71
71
|
let b = t;
|
|
72
72
|
if (i !== l) {
|
|
73
|
-
const
|
|
74
|
-
b =
|
|
73
|
+
const w = e[d];
|
|
74
|
+
b = S(w) || Array.isArray(w) ? w : isNaN(+a[i + 1]) ? {} : [];
|
|
75
75
|
}
|
|
76
76
|
if (d === "__proto__" || d === "constructor" || d === "prototype")
|
|
77
77
|
return;
|
|
@@ -83,7 +83,7 @@ const _e = {
|
|
|
83
83
|
BLUR: "blur",
|
|
84
84
|
FOCUS_OUT: "focusout",
|
|
85
85
|
CHANGE: "change"
|
|
86
|
-
},
|
|
86
|
+
}, K = {
|
|
87
87
|
onBlur: "onBlur",
|
|
88
88
|
onChange: "onChange",
|
|
89
89
|
onSubmit: "onSubmit",
|
|
@@ -97,7 +97,7 @@ const _e = {
|
|
|
97
97
|
pattern: "pattern",
|
|
98
98
|
required: "required",
|
|
99
99
|
validate: "validate"
|
|
100
|
-
},
|
|
100
|
+
}, Lt = D.createContext(null), Me = () => D.useContext(Lt);
|
|
101
101
|
var ct = (e, r, t, i = !0) => {
|
|
102
102
|
const a = {
|
|
103
103
|
defaultValues: r._defaultValues
|
|
@@ -106,18 +106,18 @@ var ct = (e, r, t, i = !0) => {
|
|
|
106
106
|
Object.defineProperty(a, u, {
|
|
107
107
|
get: () => {
|
|
108
108
|
const l = u;
|
|
109
|
-
return r._proxyFormState[l] !==
|
|
109
|
+
return r._proxyFormState[l] !== K.all && (r._proxyFormState[l] = !i || K.all), t && (t[l] = !0), e[l];
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
112
|
return a;
|
|
113
|
-
}, P = (e) =>
|
|
113
|
+
}, P = (e) => S(e) && !Object.keys(e).length, ft = (e, r, t, i) => {
|
|
114
114
|
t(e);
|
|
115
115
|
const { name: a, ...u } = e;
|
|
116
|
-
return P(u) || Object.keys(u).length >= Object.keys(r).length || Object.keys(u).find((l) => r[l] === (!i ||
|
|
117
|
-
},
|
|
116
|
+
return P(u) || Object.keys(u).length >= Object.keys(r).length || Object.keys(u).find((l) => r[l] === (!i || K.all));
|
|
117
|
+
}, de = (e) => Array.isArray(e) ? e : [e], dt = (e, r, t) => !e || !r || e === r || de(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i)));
|
|
118
118
|
function Oe(e) {
|
|
119
|
-
const r =
|
|
120
|
-
r.current = e,
|
|
119
|
+
const r = D.useRef(e);
|
|
120
|
+
r.current = e, D.useEffect(() => {
|
|
121
121
|
const t = !e.disabled && r.current.subject && r.current.subject.subscribe({
|
|
122
122
|
next: r.current.next
|
|
123
123
|
});
|
|
@@ -126,8 +126,8 @@ function Oe(e) {
|
|
|
126
126
|
};
|
|
127
127
|
}, [e.disabled]);
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
const r = Me(), { control: t = r.control, disabled: i, name: a, exact: u } = e || {}, [l, d] =
|
|
129
|
+
function Mt(e) {
|
|
130
|
+
const r = Me(), { control: t = r.control, disabled: i, name: a, exact: u } = e || {}, [l, d] = D.useState(t._formState), b = D.useRef(!0), w = D.useRef({
|
|
131
131
|
isDirty: !1,
|
|
132
132
|
isLoading: !1,
|
|
133
133
|
dirtyFields: !1,
|
|
@@ -136,46 +136,46 @@ function Rt(e) {
|
|
|
136
136
|
isValidating: !1,
|
|
137
137
|
isValid: !1,
|
|
138
138
|
errors: !1
|
|
139
|
-
}),
|
|
140
|
-
return
|
|
139
|
+
}), V = D.useRef(a);
|
|
140
|
+
return V.current = a, Oe({
|
|
141
141
|
disabled: i,
|
|
142
|
-
next: (v) => b.current &&
|
|
142
|
+
next: (v) => b.current && dt(V.current, v.name, u) && ft(v, w.current, t._updateFormState) && d({
|
|
143
143
|
...t._formState,
|
|
144
144
|
...v
|
|
145
145
|
}),
|
|
146
146
|
subject: t._subjects.state
|
|
147
|
-
}),
|
|
147
|
+
}), D.useEffect(() => (b.current = !0, w.current.isValid && t._updateValid(!0), () => {
|
|
148
148
|
b.current = !1;
|
|
149
|
-
}), [t]),
|
|
149
|
+
}), [t]), D.useMemo(() => ct(l, t, w.current, !1), [l, t]);
|
|
150
150
|
}
|
|
151
|
-
var
|
|
152
|
-
function
|
|
153
|
-
const r = Me(), { control: t = r.control, name: i, defaultValue: a, disabled: u, exact: l } = e || {}, d =
|
|
151
|
+
var z = (e) => typeof e == "string", yt = (e, r, t, i, a) => z(e) ? (i && r.watch.add(e), f(t, e, a)) : Array.isArray(e) ? e.map((u) => (i && r.watch.add(u), f(t, u))) : (i && (r.watchAll = !0), t);
|
|
152
|
+
function Ot(e) {
|
|
153
|
+
const r = Me(), { control: t = r.control, name: i, defaultValue: a, disabled: u, exact: l } = e || {}, d = D.useRef(i);
|
|
154
154
|
d.current = i, Oe({
|
|
155
155
|
disabled: u,
|
|
156
156
|
subject: t._subjects.values,
|
|
157
|
-
next: (
|
|
158
|
-
|
|
157
|
+
next: (V) => {
|
|
158
|
+
dt(d.current, V.name, l) && w(B(yt(d.current, t._names, V.values || t._formValues, !1, a)));
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
const [b,
|
|
162
|
-
return
|
|
161
|
+
const [b, w] = D.useState(t._getWatch(i, a));
|
|
162
|
+
return D.useEffect(() => t._removeUnmounted()), b;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
const r = Me(), { name: t, disabled: i, control: a = r.control, shouldUnregister: u } = e, l = ot(a._names.array, t), d =
|
|
164
|
+
function ar(e) {
|
|
165
|
+
const r = Me(), { name: t, disabled: i, control: a = r.control, shouldUnregister: u } = e, l = ot(a._names.array, t), d = Ot({
|
|
166
166
|
control: a,
|
|
167
167
|
name: t,
|
|
168
168
|
defaultValue: f(a._formValues, t, f(a._defaultValues, t, e.defaultValue)),
|
|
169
169
|
exact: !0
|
|
170
|
-
}), b =
|
|
170
|
+
}), b = Mt({
|
|
171
171
|
control: a,
|
|
172
172
|
name: t,
|
|
173
173
|
exact: !0
|
|
174
|
-
}),
|
|
174
|
+
}), w = D.useRef(a.register(t, {
|
|
175
175
|
...e.rules,
|
|
176
176
|
value: d,
|
|
177
177
|
...q(e.disabled) ? { disabled: e.disabled } : {}
|
|
178
|
-
})),
|
|
178
|
+
})), V = D.useMemo(() => Object.defineProperties({}, {
|
|
179
179
|
invalid: {
|
|
180
180
|
enumerable: !0,
|
|
181
181
|
get: () => !!f(b.errors, t)
|
|
@@ -196,18 +196,18 @@ function or(e) {
|
|
|
196
196
|
enumerable: !0,
|
|
197
197
|
get: () => f(b.errors, t)
|
|
198
198
|
}
|
|
199
|
-
}), [b, t]), v =
|
|
199
|
+
}), [b, t]), v = D.useMemo(() => ({
|
|
200
200
|
name: t,
|
|
201
201
|
value: d,
|
|
202
202
|
...q(i) || b.disabled ? { disabled: b.disabled || i } : {},
|
|
203
|
-
onChange: (M) =>
|
|
203
|
+
onChange: (M) => w.current.onChange({
|
|
204
204
|
target: {
|
|
205
205
|
value: ut(M),
|
|
206
206
|
name: t
|
|
207
207
|
},
|
|
208
208
|
type: _e.CHANGE
|
|
209
209
|
}),
|
|
210
|
-
onBlur: () =>
|
|
210
|
+
onBlur: () => w.current.onBlur({
|
|
211
211
|
target: {
|
|
212
212
|
value: f(a._formValues, t),
|
|
213
213
|
name: t
|
|
@@ -215,8 +215,8 @@ function or(e) {
|
|
|
215
215
|
type: _e.BLUR
|
|
216
216
|
}),
|
|
217
217
|
ref: (M) => {
|
|
218
|
-
const
|
|
219
|
-
|
|
218
|
+
const Q = f(a._fields, t);
|
|
219
|
+
Q && M && (Q._f.ref = {
|
|
220
220
|
focus: () => M.focus(),
|
|
221
221
|
select: () => M.select(),
|
|
222
222
|
setCustomValidity: (O) => M.setCustomValidity(O),
|
|
@@ -231,29 +231,29 @@ function or(e) {
|
|
|
231
231
|
d,
|
|
232
232
|
a._fields
|
|
233
233
|
]);
|
|
234
|
-
return
|
|
235
|
-
const M = a._options.shouldUnregister || u,
|
|
234
|
+
return D.useEffect(() => {
|
|
235
|
+
const M = a._options.shouldUnregister || u, Q = (O, R) => {
|
|
236
236
|
const I = f(a._fields, O);
|
|
237
|
-
I && I._f && (I._f.mount =
|
|
237
|
+
I && I._f && (I._f.mount = R);
|
|
238
238
|
};
|
|
239
|
-
if (
|
|
240
|
-
const O =
|
|
241
|
-
x(a._defaultValues, t, O),
|
|
239
|
+
if (Q(t, !0), M) {
|
|
240
|
+
const O = B(f(a._options.defaultValues, t));
|
|
241
|
+
x(a._defaultValues, t, O), E(f(a._formValues, t)) && x(a._formValues, t, O);
|
|
242
242
|
}
|
|
243
243
|
return !l && a.register(t), () => {
|
|
244
|
-
(l ? M && !a._state.action : M) ? a.unregister(t) :
|
|
244
|
+
(l ? M && !a._state.action : M) ? a.unregister(t) : Q(t, !1);
|
|
245
245
|
};
|
|
246
|
-
}, [t, a, l, u]),
|
|
246
|
+
}, [t, a, l, u]), D.useEffect(() => {
|
|
247
247
|
a._updateDisabledField({
|
|
248
248
|
disabled: i,
|
|
249
249
|
fields: a._fields,
|
|
250
250
|
name: t
|
|
251
251
|
});
|
|
252
|
-
}, [i, t, a]),
|
|
252
|
+
}, [i, t, a]), D.useMemo(() => ({
|
|
253
253
|
field: v,
|
|
254
254
|
formState: b,
|
|
255
|
-
fieldState:
|
|
256
|
-
}), [v, b,
|
|
255
|
+
fieldState: V
|
|
256
|
+
}), [v, b, V]);
|
|
257
257
|
}
|
|
258
258
|
var ht = (e, r, t, i, a) => r ? {
|
|
259
259
|
...t[e],
|
|
@@ -262,11 +262,11 @@ var ht = (e, r, t, i, a) => r ? {
|
|
|
262
262
|
[i]: a || !0
|
|
263
263
|
}
|
|
264
264
|
} : {}, Ye = (e) => ({
|
|
265
|
-
isOnSubmit: !e || e ===
|
|
266
|
-
isOnBlur: e ===
|
|
267
|
-
isOnChange: e ===
|
|
268
|
-
isOnAll: e ===
|
|
269
|
-
isOnTouch: e ===
|
|
265
|
+
isOnSubmit: !e || e === K.onSubmit,
|
|
266
|
+
isOnBlur: e === K.onBlur,
|
|
267
|
+
isOnChange: e === K.onChange,
|
|
268
|
+
isOnAll: e === K.all,
|
|
269
|
+
isOnTouch: e === K.onTouched
|
|
270
270
|
}), Je = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
|
|
271
271
|
const ye = (e, r, t, i) => {
|
|
272
272
|
for (const a of t || Object.keys(e)) {
|
|
@@ -280,20 +280,20 @@ const ye = (e, r, t, i) => {
|
|
|
280
280
|
return !0;
|
|
281
281
|
if (ye(d, r))
|
|
282
282
|
break;
|
|
283
|
-
} else if (
|
|
283
|
+
} else if (S(d) && ye(d, r))
|
|
284
284
|
break;
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
};
|
|
288
|
-
var
|
|
289
|
-
const i =
|
|
288
|
+
var Ut = (e, r, t) => {
|
|
289
|
+
const i = de(f(e, t));
|
|
290
290
|
return x(i, "root", r[t]), x(e, t, i), e;
|
|
291
|
-
},
|
|
292
|
-
if (!
|
|
291
|
+
}, Ue = (e) => e.type === "file", $ = (e) => typeof e == "function", me = (e) => {
|
|
292
|
+
if (!Te)
|
|
293
293
|
return !1;
|
|
294
294
|
const r = e ? e.ownerDocument : 0;
|
|
295
295
|
return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
|
|
296
|
-
}, be = (e) =>
|
|
296
|
+
}, be = (e) => z(e), Re = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
|
|
297
297
|
const Xe = {
|
|
298
298
|
value: !1,
|
|
299
299
|
isValid: !1
|
|
@@ -306,7 +306,7 @@ var gt = (e) => {
|
|
|
306
306
|
}
|
|
307
307
|
return e[0].checked && !e[0].disabled ? (
|
|
308
308
|
// @ts-expect-error expected to work in the browser
|
|
309
|
-
e[0].attributes && !
|
|
309
|
+
e[0].attributes && !E(e[0].attributes.value) ? E(e[0].value) || e[0].value === "" ? Ze : { value: e[0].value, isValid: !0 } : Ze
|
|
310
310
|
) : Xe;
|
|
311
311
|
}
|
|
312
312
|
return Xe;
|
|
@@ -327,108 +327,108 @@ function tt(e, r, t = "validate") {
|
|
|
327
327
|
ref: r
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
var ne = (e) =>
|
|
330
|
+
var ne = (e) => S(e) && !Ve(e) ? e : {
|
|
331
331
|
value: e,
|
|
332
332
|
message: ""
|
|
333
333
|
}, rt = async (e, r, t, i, a, u) => {
|
|
334
|
-
const { ref: l, refs: d, required: b, maxLength:
|
|
335
|
-
if (!X || r.has(
|
|
334
|
+
const { ref: l, refs: d, required: b, maxLength: w, minLength: V, min: v, max: M, pattern: Q, validate: O, name: R, valueAsNumber: I, mount: X } = e._f, F = f(t, R);
|
|
335
|
+
if (!X || r.has(R))
|
|
336
336
|
return {};
|
|
337
|
-
const G = d ? d[0] : l, Y = (
|
|
338
|
-
a && G.reportValidity && (G.setCustomValidity(q(
|
|
339
|
-
},
|
|
340
|
-
const W =
|
|
341
|
-
|
|
342
|
-
type:
|
|
337
|
+
const G = d ? d[0] : l, Y = (m) => {
|
|
338
|
+
a && G.reportValidity && (G.setCustomValidity(q(m) ? "" : m || ""), G.reportValidity());
|
|
339
|
+
}, k = {}, se = Re(l), ge = he(l), te = se || ge, ie = (I || Ue(l)) && E(l.value) && E(F) || me(l) && l.value === "" || F === "" || Array.isArray(F) && !F.length, j = ht.bind(null, R, i, k), ve = (m, A, p, U = J.maxLength, H = J.minLength) => {
|
|
340
|
+
const W = m ? A : p;
|
|
341
|
+
k[R] = {
|
|
342
|
+
type: m ? U : H,
|
|
343
343
|
message: W,
|
|
344
344
|
ref: l,
|
|
345
|
-
...j(
|
|
345
|
+
...j(m ? U : H, W)
|
|
346
346
|
};
|
|
347
347
|
};
|
|
348
|
-
if (u ? !Array.isArray(
|
|
349
|
-
const { value:
|
|
350
|
-
if (
|
|
348
|
+
if (u ? !Array.isArray(F) || !F.length : b && (!te && (ie || N(F)) || q(F) && !F || ge && !gt(d).isValid || se && !vt(d).isValid)) {
|
|
349
|
+
const { value: m, message: A } = be(b) ? { value: !!b, message: b } : ne(b);
|
|
350
|
+
if (m && (k[R] = {
|
|
351
351
|
type: J.required,
|
|
352
|
-
message:
|
|
352
|
+
message: A,
|
|
353
353
|
ref: G,
|
|
354
|
-
...j(J.required,
|
|
354
|
+
...j(J.required, A)
|
|
355
355
|
}, !i))
|
|
356
|
-
return Y(
|
|
356
|
+
return Y(A), k;
|
|
357
357
|
}
|
|
358
|
-
if (!ie && (!
|
|
359
|
-
let
|
|
360
|
-
const
|
|
361
|
-
if (!
|
|
362
|
-
const
|
|
363
|
-
|
|
358
|
+
if (!ie && (!N(v) || !N(M))) {
|
|
359
|
+
let m, A;
|
|
360
|
+
const p = ne(M), U = ne(v);
|
|
361
|
+
if (!N(F) && !isNaN(F)) {
|
|
362
|
+
const H = l.valueAsNumber || F && +F;
|
|
363
|
+
N(p.value) || (m = H > p.value), N(U.value) || (A = H < U.value);
|
|
364
364
|
} else {
|
|
365
|
-
const
|
|
366
|
-
|
|
365
|
+
const H = l.valueAsDate || new Date(F), W = (oe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + oe), ae = l.type == "time", ue = l.type == "week";
|
|
366
|
+
z(p.value) && F && (m = ae ? W(F) > W(p.value) : ue ? F > p.value : H > new Date(p.value)), z(U.value) && F && (A = ae ? W(F) < W(U.value) : ue ? F < U.value : H < new Date(U.value));
|
|
367
367
|
}
|
|
368
|
-
if ((
|
|
369
|
-
return Y(
|
|
368
|
+
if ((m || A) && (ve(!!m, p.message, U.message, J.max, J.min), !i))
|
|
369
|
+
return Y(k[R].message), k;
|
|
370
370
|
}
|
|
371
|
-
if ((
|
|
372
|
-
const
|
|
373
|
-
if ((
|
|
374
|
-
return Y(
|
|
371
|
+
if ((w || V) && !ie && (z(F) || u && Array.isArray(F))) {
|
|
372
|
+
const m = ne(w), A = ne(V), p = !N(m.value) && F.length > +m.value, U = !N(A.value) && F.length < +A.value;
|
|
373
|
+
if ((p || U) && (ve(p, m.message, A.message), !i))
|
|
374
|
+
return Y(k[R].message), k;
|
|
375
375
|
}
|
|
376
|
-
if (
|
|
377
|
-
const { value:
|
|
378
|
-
if (Ve(
|
|
376
|
+
if (Q && !ie && z(F)) {
|
|
377
|
+
const { value: m, message: A } = ne(Q);
|
|
378
|
+
if (Ve(m) && !F.match(m) && (k[R] = {
|
|
379
379
|
type: J.pattern,
|
|
380
|
-
message:
|
|
380
|
+
message: A,
|
|
381
381
|
ref: l,
|
|
382
|
-
...j(J.pattern,
|
|
382
|
+
...j(J.pattern, A)
|
|
383
383
|
}, !i))
|
|
384
|
-
return Y(
|
|
384
|
+
return Y(A), k;
|
|
385
385
|
}
|
|
386
386
|
if (O) {
|
|
387
|
-
if (
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
...
|
|
391
|
-
...j(J.validate,
|
|
387
|
+
if ($(O)) {
|
|
388
|
+
const m = await O(F, t), A = tt(m, G);
|
|
389
|
+
if (A && (k[R] = {
|
|
390
|
+
...A,
|
|
391
|
+
...j(J.validate, A.message)
|
|
392
392
|
}, !i))
|
|
393
|
-
return Y(
|
|
394
|
-
} else if (
|
|
395
|
-
let
|
|
396
|
-
for (const
|
|
397
|
-
if (!P(
|
|
393
|
+
return Y(A.message), k;
|
|
394
|
+
} else if (S(O)) {
|
|
395
|
+
let m = {};
|
|
396
|
+
for (const A in O) {
|
|
397
|
+
if (!P(m) && !i)
|
|
398
398
|
break;
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
...
|
|
402
|
-
...j(
|
|
403
|
-
}, Y(
|
|
399
|
+
const p = tt(await O[A](F, t), G, A);
|
|
400
|
+
p && (m = {
|
|
401
|
+
...p,
|
|
402
|
+
...j(A, p.message)
|
|
403
|
+
}, Y(p.message), i && (k[R] = m));
|
|
404
404
|
}
|
|
405
|
-
if (!P(
|
|
405
|
+
if (!P(m) && (k[R] = {
|
|
406
406
|
ref: G,
|
|
407
|
-
...
|
|
407
|
+
...m
|
|
408
408
|
}, !i))
|
|
409
|
-
return
|
|
409
|
+
return k;
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
return Y(!0),
|
|
412
|
+
return Y(!0), k;
|
|
413
413
|
};
|
|
414
|
-
function
|
|
414
|
+
function Rt(e, r) {
|
|
415
415
|
const t = r.slice(0, -1).length;
|
|
416
416
|
let i = 0;
|
|
417
417
|
for (; i < t; )
|
|
418
|
-
e =
|
|
418
|
+
e = E(e) ? i++ : e[r[i++]];
|
|
419
419
|
return e;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function Nt(e) {
|
|
422
422
|
for (const r in e)
|
|
423
|
-
if (e.hasOwnProperty(r) && !
|
|
423
|
+
if (e.hasOwnProperty(r) && !E(e[r]))
|
|
424
424
|
return !1;
|
|
425
425
|
return !0;
|
|
426
426
|
}
|
|
427
427
|
function C(e, r) {
|
|
428
|
-
const t = Array.isArray(r) ? r :
|
|
429
|
-
return i && delete i[u], a !== 0 && (
|
|
428
|
+
const t = Array.isArray(r) ? r : Le(r) ? [r] : lt(r), i = t.length === 1 ? e : Rt(e, t), a = t.length - 1, u = t[a];
|
|
429
|
+
return i && delete i[u], a !== 0 && (S(i) && P(i) || Array.isArray(i) && Nt(i)) && C(e, t.slice(0, -1)), e;
|
|
430
430
|
}
|
|
431
|
-
var
|
|
431
|
+
var Se = () => {
|
|
432
432
|
let e = [];
|
|
433
433
|
return {
|
|
434
434
|
get observers() {
|
|
@@ -447,7 +447,7 @@ var pe = () => {
|
|
|
447
447
|
e = [];
|
|
448
448
|
}
|
|
449
449
|
};
|
|
450
|
-
}, Ce = (e) =>
|
|
450
|
+
}, Ce = (e) => N(e) || !at(e);
|
|
451
451
|
function ee(e, r) {
|
|
452
452
|
if (Ce(e) || Ce(r))
|
|
453
453
|
return e === r;
|
|
@@ -462,38 +462,38 @@ function ee(e, r) {
|
|
|
462
462
|
return !1;
|
|
463
463
|
if (a !== "ref") {
|
|
464
464
|
const l = r[a];
|
|
465
|
-
if (re(u) && re(l) ||
|
|
465
|
+
if (re(u) && re(l) || S(u) && S(l) || Array.isArray(u) && Array.isArray(l) ? !ee(u, l) : u !== l)
|
|
466
466
|
return !1;
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
return !0;
|
|
470
470
|
}
|
|
471
|
-
var bt = (e) => e.type === "select-multiple",
|
|
471
|
+
var bt = (e) => e.type === "select-multiple", Bt = (e) => Re(e) || he(e), ke = (e) => me(e) && e.isConnected, _t = (e) => {
|
|
472
472
|
for (const r in e)
|
|
473
|
-
if (
|
|
473
|
+
if ($(e[r]))
|
|
474
474
|
return !0;
|
|
475
475
|
return !1;
|
|
476
476
|
};
|
|
477
477
|
function Fe(e, r = {}) {
|
|
478
478
|
const t = Array.isArray(e);
|
|
479
|
-
if (
|
|
479
|
+
if (S(e) || t)
|
|
480
480
|
for (const i in e)
|
|
481
|
-
Array.isArray(e[i]) ||
|
|
481
|
+
Array.isArray(e[i]) || S(e[i]) && !_t(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, Fe(e[i], r[i])) : N(e[i]) || (r[i] = !0);
|
|
482
482
|
return r;
|
|
483
483
|
}
|
|
484
484
|
function mt(e, r, t) {
|
|
485
485
|
const i = Array.isArray(e);
|
|
486
|
-
if (
|
|
486
|
+
if (S(e) || i)
|
|
487
487
|
for (const a in e)
|
|
488
|
-
Array.isArray(e[a]) ||
|
|
488
|
+
Array.isArray(e[a]) || S(e[a]) && !_t(e[a]) ? E(r) || Ce(t[a]) ? t[a] = Array.isArray(e[a]) ? Fe(e[a], []) : { ...Fe(e[a]) } : mt(e[a], N(r) ? {} : r[a], t[a]) : t[a] = !ee(e[a], r[a]);
|
|
489
489
|
return t;
|
|
490
490
|
}
|
|
491
|
-
var le = (e, r) => mt(e, r, Fe(r)), Vt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: i }) =>
|
|
492
|
-
function
|
|
491
|
+
var le = (e, r) => mt(e, r, Fe(r)), Vt = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: i }) => E(e) ? e : r ? e === "" ? NaN : e && +e : t && z(e) ? new Date(e) : i ? i(e) : e;
|
|
492
|
+
function pe(e) {
|
|
493
493
|
const r = e.ref;
|
|
494
|
-
return
|
|
494
|
+
return Ue(r) ? r.files : Re(r) ? vt(e.refs).value : bt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : he(r) ? gt(e.refs).value : Vt(E(r.value) ? e.ref.value : r.value, e);
|
|
495
495
|
}
|
|
496
|
-
var
|
|
496
|
+
var Pt = (e, r, t, i) => {
|
|
497
497
|
const a = {};
|
|
498
498
|
for (const u of e) {
|
|
499
499
|
const l = f(r, u);
|
|
@@ -505,12 +505,12 @@ var jt = (e, r, t, i) => {
|
|
|
505
505
|
fields: a,
|
|
506
506
|
shouldUseNativeValidation: i
|
|
507
507
|
};
|
|
508
|
-
}, ce = (e) =>
|
|
508
|
+
}, ce = (e) => E(e) ? e : Ve(e) ? e.source : S(e) ? Ve(e.value) ? e.value.source : e.value : e;
|
|
509
509
|
const st = "AsyncFunction";
|
|
510
|
-
var
|
|
510
|
+
var It = (e) => !!e && !!e.validate && !!($(e.validate) && e.validate.constructor.name === st || S(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === st)), jt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
511
511
|
function it(e, r, t) {
|
|
512
512
|
const i = f(e, t);
|
|
513
|
-
if (i ||
|
|
513
|
+
if (i || Le(t))
|
|
514
514
|
return {
|
|
515
515
|
error: i,
|
|
516
516
|
name: t
|
|
@@ -531,20 +531,20 @@ function it(e, r, t) {
|
|
|
531
531
|
name: t
|
|
532
532
|
};
|
|
533
533
|
}
|
|
534
|
-
var
|
|
535
|
-
const
|
|
536
|
-
mode:
|
|
537
|
-
reValidateMode:
|
|
534
|
+
var Wt = (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, qt = (e, r) => !Ae(f(e, r)).length && C(e, r);
|
|
535
|
+
const Ht = {
|
|
536
|
+
mode: K.onSubmit,
|
|
537
|
+
reValidateMode: K.onChange,
|
|
538
538
|
shouldFocusError: !0
|
|
539
539
|
};
|
|
540
540
|
function Kt(e = {}) {
|
|
541
541
|
let r = {
|
|
542
|
-
|
|
542
|
+
...Ht,
|
|
543
543
|
...e
|
|
544
544
|
}, t = {
|
|
545
545
|
submitCount: 0,
|
|
546
546
|
isDirty: !1,
|
|
547
|
-
isLoading:
|
|
547
|
+
isLoading: $(r.defaultValues),
|
|
548
548
|
isValidating: !1,
|
|
549
549
|
isSubmitted: !1,
|
|
550
550
|
isSubmitting: !1,
|
|
@@ -555,7 +555,7 @@ function Kt(e = {}) {
|
|
|
555
555
|
validatingFields: {},
|
|
556
556
|
errors: r.errors || {},
|
|
557
557
|
disabled: r.disabled || !1
|
|
558
|
-
}, i = {}, a =
|
|
558
|
+
}, i = {}, a = S(r.defaultValues) || S(r.values) ? B(r.defaultValues || r.values) || {} : {}, u = r.shouldUnregister ? {} : B(a), l = {
|
|
559
559
|
action: !1,
|
|
560
560
|
mount: !1,
|
|
561
561
|
watch: !1
|
|
@@ -565,8 +565,8 @@ function Kt(e = {}) {
|
|
|
565
565
|
unMount: /* @__PURE__ */ new Set(),
|
|
566
566
|
array: /* @__PURE__ */ new Set(),
|
|
567
567
|
watch: /* @__PURE__ */ new Set()
|
|
568
|
-
}, b,
|
|
569
|
-
const
|
|
568
|
+
}, b, w = 0;
|
|
569
|
+
const V = {
|
|
570
570
|
isDirty: !1,
|
|
571
571
|
dirtyFields: !1,
|
|
572
572
|
validatingFields: !1,
|
|
@@ -575,26 +575,26 @@ function Kt(e = {}) {
|
|
|
575
575
|
isValid: !1,
|
|
576
576
|
errors: !1
|
|
577
577
|
}, v = {
|
|
578
|
-
values:
|
|
579
|
-
array:
|
|
580
|
-
state:
|
|
581
|
-
}, M = Ye(r.mode),
|
|
582
|
-
clearTimeout(
|
|
578
|
+
values: Se(),
|
|
579
|
+
array: Se(),
|
|
580
|
+
state: Se()
|
|
581
|
+
}, M = Ye(r.mode), Q = Ye(r.reValidateMode), O = r.criteriaMode === K.all, R = (s) => (n) => {
|
|
582
|
+
clearTimeout(w), w = setTimeout(s, n);
|
|
583
583
|
}, I = async (s) => {
|
|
584
|
-
if (!r.disabled && (
|
|
584
|
+
if (!r.disabled && (V.isValid || s)) {
|
|
585
585
|
const n = r.resolver ? P((await te()).errors) : await j(i, !0);
|
|
586
586
|
n !== t.isValid && v.state.next({
|
|
587
587
|
isValid: n
|
|
588
588
|
});
|
|
589
589
|
}
|
|
590
590
|
}, X = (s, n) => {
|
|
591
|
-
!r.disabled && (
|
|
591
|
+
!r.disabled && (V.isValidating || V.validatingFields) && ((s || Array.from(d.mount)).forEach((o) => {
|
|
592
592
|
o && (n ? x(t.validatingFields, o, n) : C(t.validatingFields, o));
|
|
593
593
|
}), v.state.next({
|
|
594
594
|
validatingFields: t.validatingFields,
|
|
595
595
|
isValidating: !P(t.validatingFields)
|
|
596
596
|
}));
|
|
597
|
-
},
|
|
597
|
+
}, F = (s, n = [], o, h, y = !0, c = !0) => {
|
|
598
598
|
if (h && o && !r.disabled) {
|
|
599
599
|
if (l.action = !0, c && Array.isArray(f(i, s))) {
|
|
600
600
|
const g = o(f(i, s), h.argA, h.argB);
|
|
@@ -602,15 +602,15 @@ function Kt(e = {}) {
|
|
|
602
602
|
}
|
|
603
603
|
if (c && Array.isArray(f(t.errors, s))) {
|
|
604
604
|
const g = o(f(t.errors, s), h.argA, h.argB);
|
|
605
|
-
y && x(t.errors, s, g),
|
|
605
|
+
y && x(t.errors, s, g), qt(t.errors, s);
|
|
606
606
|
}
|
|
607
|
-
if (
|
|
607
|
+
if (V.touchedFields && c && Array.isArray(f(t.touchedFields, s))) {
|
|
608
608
|
const g = o(f(t.touchedFields, s), h.argA, h.argB);
|
|
609
609
|
y && x(t.touchedFields, s, g);
|
|
610
610
|
}
|
|
611
|
-
|
|
611
|
+
V.dirtyFields && (t.dirtyFields = le(a, u)), v.state.next({
|
|
612
612
|
name: s,
|
|
613
|
-
isDirty:
|
|
613
|
+
isDirty: m(s, n),
|
|
614
614
|
dirtyFields: t.dirtyFields,
|
|
615
615
|
errors: t.errors,
|
|
616
616
|
isValid: t.isValid
|
|
@@ -626,34 +626,34 @@ function Kt(e = {}) {
|
|
|
626
626
|
errors: t.errors,
|
|
627
627
|
isValid: !1
|
|
628
628
|
});
|
|
629
|
-
},
|
|
629
|
+
}, k = (s, n, o, h) => {
|
|
630
630
|
const y = f(i, s);
|
|
631
631
|
if (y) {
|
|
632
|
-
const c = f(u, s,
|
|
633
|
-
|
|
632
|
+
const c = f(u, s, E(o) ? f(a, s) : o);
|
|
633
|
+
E(c) || h && h.defaultChecked || n ? x(u, s, n ? c : pe(y._f)) : U(s, c), l.mount && I();
|
|
634
634
|
}
|
|
635
635
|
}, se = (s, n, o, h, y) => {
|
|
636
636
|
let c = !1, g = !1;
|
|
637
|
-
const
|
|
637
|
+
const _ = {
|
|
638
638
|
name: s
|
|
639
639
|
};
|
|
640
640
|
if (!r.disabled) {
|
|
641
|
-
const
|
|
641
|
+
const T = !!(f(i, s) && f(i, s)._f && f(i, s)._f.disabled);
|
|
642
642
|
if (!o || h) {
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
g = !!(!
|
|
643
|
+
V.isDirty && (g = t.isDirty, t.isDirty = _.isDirty = m(), c = g !== _.isDirty);
|
|
644
|
+
const L = T || ee(f(a, s), n);
|
|
645
|
+
g = !!(!T && f(t.dirtyFields, s)), L || T ? C(t.dirtyFields, s) : x(t.dirtyFields, s, !0), _.dirtyFields = t.dirtyFields, c = c || V.dirtyFields && g !== !L;
|
|
646
646
|
}
|
|
647
647
|
if (o) {
|
|
648
|
-
const
|
|
649
|
-
|
|
648
|
+
const L = f(t.touchedFields, s);
|
|
649
|
+
L || (x(t.touchedFields, s, o), _.touchedFields = t.touchedFields, c = c || V.touchedFields && L !== o);
|
|
650
650
|
}
|
|
651
|
-
c && y && v.state.next(
|
|
651
|
+
c && y && v.state.next(_);
|
|
652
652
|
}
|
|
653
|
-
return c ?
|
|
653
|
+
return c ? _ : {};
|
|
654
654
|
}, ge = (s, n, o, h) => {
|
|
655
|
-
const y = f(t.errors, s), c =
|
|
656
|
-
if (r.delayError && o ? (b =
|
|
655
|
+
const y = f(t.errors, s), c = V.isValid && q(n) && t.isValid !== n;
|
|
656
|
+
if (r.delayError && o ? (b = R(() => G(s, o)), b(r.delayError)) : (clearTimeout(w), b = null, o ? x(t.errors, s, o) : C(t.errors, s)), (o ? !ee(y, o) : y) || !P(h) || c) {
|
|
657
657
|
const g = {
|
|
658
658
|
...h,
|
|
659
659
|
...c && q(n) ? { isValid: n } : {},
|
|
@@ -667,7 +667,7 @@ function Kt(e = {}) {
|
|
|
667
667
|
}
|
|
668
668
|
}, te = async (s) => {
|
|
669
669
|
X(s, !0);
|
|
670
|
-
const n = await r.resolver(u, r.context,
|
|
670
|
+
const n = await r.resolver(u, r.context, Pt(s || d.mount, i, r.criteriaMode, r.shouldUseNativeValidation));
|
|
671
671
|
return X(s), n;
|
|
672
672
|
}, ie = async (s) => {
|
|
673
673
|
const { errors: n } = await te(s);
|
|
@@ -687,12 +687,12 @@ function Kt(e = {}) {
|
|
|
687
687
|
if (y) {
|
|
688
688
|
const { _f: c, ...g } = y;
|
|
689
689
|
if (c) {
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
const
|
|
693
|
-
if (
|
|
690
|
+
const _ = d.array.has(c.name), T = y._f && It(y._f);
|
|
691
|
+
T && V.validatingFields && X([h], !0);
|
|
692
|
+
const L = await rt(y, d.disabled, u, O, r.shouldUseNativeValidation && !n, _);
|
|
693
|
+
if (T && V.validatingFields && X([h]), L[c.name] && (o.valid = !1, n))
|
|
694
694
|
break;
|
|
695
|
-
!n && (f(
|
|
695
|
+
!n && (f(L, c.name) ? _ ? Ut(t.errors, L, c.name) : x(t.errors, c.name, L[c.name]) : C(t.errors, c.name));
|
|
696
696
|
}
|
|
697
697
|
!P(g) && await j(g, n, o);
|
|
698
698
|
}
|
|
@@ -701,37 +701,37 @@ function Kt(e = {}) {
|
|
|
701
701
|
}, ve = () => {
|
|
702
702
|
for (const s of d.unMount) {
|
|
703
703
|
const n = f(i, s);
|
|
704
|
-
n && (n._f.refs ? n._f.refs.every((o) => !
|
|
704
|
+
n && (n._f.refs ? n._f.refs.every((o) => !ke(o)) : !ke(n._f.ref)) && xe(s);
|
|
705
705
|
}
|
|
706
706
|
d.unMount = /* @__PURE__ */ new Set();
|
|
707
|
-
},
|
|
708
|
-
...l.mount ? u :
|
|
709
|
-
}, o, n),
|
|
707
|
+
}, m = (s, n) => !r.disabled && (s && n && x(u, s, n), !ee(Ne(), a)), A = (s, n, o) => yt(s, d, {
|
|
708
|
+
...l.mount ? u : E(n) ? a : z(s) ? { [s]: n } : n
|
|
709
|
+
}, o, n), p = (s) => Ae(f(l.mount ? u : a, s, r.shouldUnregister ? f(a, s, []) : [])), U = (s, n, o = {}) => {
|
|
710
710
|
const h = f(i, s);
|
|
711
711
|
let y = n;
|
|
712
712
|
if (h) {
|
|
713
713
|
const c = h._f;
|
|
714
|
-
c && (!c.disabled && x(u, s, Vt(n, c)), y = me(c.ref) &&
|
|
714
|
+
c && (!c.disabled && x(u, s, Vt(n, c)), y = me(c.ref) && N(n) ? "" : n, bt(c.ref) ? [...c.ref.options].forEach((g) => g.selected = y.includes(g.value)) : c.refs ? he(c.ref) ? c.refs.length > 1 ? c.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(y) ? !!y.find((_) => _ === g.value) : y === g.value)) : c.refs[0] && (c.refs[0].checked = !!y) : c.refs.forEach((g) => g.checked = g.value === y) : Ue(c.ref) ? c.ref.value = "" : (c.ref.value = y, c.ref.type || v.values.next({
|
|
715
715
|
name: s,
|
|
716
716
|
values: { ...u }
|
|
717
717
|
})));
|
|
718
718
|
}
|
|
719
719
|
(o.shouldDirty || o.shouldTouch) && se(s, y, o.shouldTouch, o.shouldDirty, !0), o.shouldValidate && oe(s);
|
|
720
|
-
},
|
|
720
|
+
}, H = (s, n, o) => {
|
|
721
721
|
for (const h in n) {
|
|
722
722
|
const y = n[h], c = `${s}.${h}`, g = f(i, c);
|
|
723
|
-
(d.array.has(s) ||
|
|
723
|
+
(d.array.has(s) || S(y) || g && !g._f) && !re(y) ? H(c, y, o) : U(c, y, o);
|
|
724
724
|
}
|
|
725
725
|
}, W = (s, n, o = {}) => {
|
|
726
|
-
const h = f(i, s), y = d.array.has(s), c =
|
|
726
|
+
const h = f(i, s), y = d.array.has(s), c = B(n);
|
|
727
727
|
x(u, s, c), y ? (v.array.next({
|
|
728
728
|
name: s,
|
|
729
729
|
values: { ...u }
|
|
730
|
-
}), (
|
|
730
|
+
}), (V.isDirty || V.dirtyFields) && o.shouldDirty && v.state.next({
|
|
731
731
|
name: s,
|
|
732
732
|
dirtyFields: le(a, u),
|
|
733
|
-
isDirty:
|
|
734
|
-
})) : h && !h._f && !
|
|
733
|
+
isDirty: m(s, c)
|
|
734
|
+
})) : h && !h._f && !N(c) ? H(s, c, o) : U(s, c, o), Je(s, d) && v.state.next({ ...t }), v.values.next({
|
|
735
735
|
name: l.mount ? s : void 0,
|
|
736
736
|
values: { ...u }
|
|
737
737
|
});
|
|
@@ -739,67 +739,67 @@ function Kt(e = {}) {
|
|
|
739
739
|
l.mount = !0;
|
|
740
740
|
const n = s.target;
|
|
741
741
|
let o = n.name, h = !0;
|
|
742
|
-
const y = f(i, o), c = () => n.type ?
|
|
743
|
-
h = Number.isNaN(
|
|
742
|
+
const y = f(i, o), c = () => n.type ? pe(y._f) : ut(s), g = (_) => {
|
|
743
|
+
h = Number.isNaN(_) || re(_) && isNaN(_.getTime()) || ee(_, f(u, o, _));
|
|
744
744
|
};
|
|
745
745
|
if (y) {
|
|
746
|
-
let
|
|
747
|
-
const
|
|
748
|
-
x(u, o,
|
|
749
|
-
const
|
|
746
|
+
let _, T;
|
|
747
|
+
const L = c(), Z = s.type === _e.BLUR || s.type === _e.FOCUS_OUT, Et = !jt(y._f) && !r.resolver && !f(t.errors, o) && !y._f.deps || Wt(Z, f(t.touchedFields, o), t.isSubmitted, Q, M), we = Je(o, d, Z);
|
|
748
|
+
x(u, o, L), Z ? (y._f.onBlur && y._f.onBlur(s), b && b(0)) : y._f.onChange && y._f.onChange(s);
|
|
749
|
+
const Ee = se(o, L, Z, !1), St = !P(Ee) || we;
|
|
750
750
|
if (!Z && v.values.next({
|
|
751
751
|
name: o,
|
|
752
752
|
type: s.type,
|
|
753
753
|
values: { ...u }
|
|
754
|
-
}),
|
|
755
|
-
return
|
|
756
|
-
if (!Z &&
|
|
757
|
-
const { errors:
|
|
758
|
-
if (g(
|
|
759
|
-
const
|
|
760
|
-
|
|
754
|
+
}), Et)
|
|
755
|
+
return V.isValid && (r.mode === "onBlur" && Z ? I() : Z || I()), St && v.state.next({ name: o, ...we ? {} : Ee });
|
|
756
|
+
if (!Z && we && v.state.next({ ...t }), r.resolver) {
|
|
757
|
+
const { errors: Ke } = await te([o]);
|
|
758
|
+
if (g(L), h) {
|
|
759
|
+
const kt = it(t.errors, i, o), Qe = it(Ke, i, kt.name || o);
|
|
760
|
+
_ = Qe.error, o = Qe.name, T = P(Ke);
|
|
761
761
|
}
|
|
762
762
|
} else
|
|
763
|
-
X([o], !0),
|
|
764
|
-
h && (y._f.deps && oe(y._f.deps), ge(o,
|
|
763
|
+
X([o], !0), _ = (await rt(y, d.disabled, u, O, r.shouldUseNativeValidation))[o], X([o]), g(L), h && (_ ? T = !1 : V.isValid && (T = await j(i, !0)));
|
|
764
|
+
h && (y._f.deps && oe(y._f.deps), ge(o, T, _, Ee));
|
|
765
765
|
}
|
|
766
766
|
}, ue = (s, n) => {
|
|
767
767
|
if (f(t.errors, n) && s.focus)
|
|
768
768
|
return s.focus(), 1;
|
|
769
769
|
}, oe = async (s, n = {}) => {
|
|
770
770
|
let o, h;
|
|
771
|
-
const y =
|
|
771
|
+
const y = de(s);
|
|
772
772
|
if (r.resolver) {
|
|
773
|
-
const c = await ie(
|
|
773
|
+
const c = await ie(E(s) ? s : y);
|
|
774
774
|
o = P(c), h = s ? !y.some((g) => f(c, g)) : o;
|
|
775
775
|
} else s ? (h = (await Promise.all(y.map(async (c) => {
|
|
776
776
|
const g = f(i, c);
|
|
777
777
|
return await j(g && g._f ? { [c]: g } : g);
|
|
778
778
|
}))).every(Boolean), !(!h && !t.isValid) && I()) : h = o = await j(i);
|
|
779
779
|
return v.state.next({
|
|
780
|
-
...!
|
|
780
|
+
...!z(s) || V.isValid && o !== t.isValid ? {} : { name: s },
|
|
781
781
|
...r.resolver || !s ? { isValid: o } : {},
|
|
782
782
|
errors: t.errors
|
|
783
783
|
}), n.shouldFocus && !h && ye(i, ue, s ? y : d.mount), h;
|
|
784
|
-
},
|
|
784
|
+
}, Ne = (s) => {
|
|
785
785
|
const n = {
|
|
786
786
|
...l.mount ? u : a
|
|
787
787
|
};
|
|
788
|
-
return
|
|
789
|
-
},
|
|
788
|
+
return E(s) ? n : z(s) ? f(n, s) : s.map((o) => f(n, o));
|
|
789
|
+
}, Be = (s, n) => ({
|
|
790
790
|
invalid: !!f((n || t).errors, s),
|
|
791
791
|
isDirty: !!f((n || t).dirtyFields, s),
|
|
792
792
|
error: f((n || t).errors, s),
|
|
793
793
|
isValidating: !!f(t.validatingFields, s),
|
|
794
794
|
isTouched: !!f((n || t).touchedFields, s)
|
|
795
795
|
}), At = (s) => {
|
|
796
|
-
s &&
|
|
796
|
+
s && de(s).forEach((n) => C(t.errors, n)), v.state.next({
|
|
797
797
|
errors: s ? t.errors : {}
|
|
798
798
|
});
|
|
799
799
|
}, Pe = (s, n, o) => {
|
|
800
|
-
const h = (f(i, s, { _f: {} })._f || {}).ref, y = f(t.errors, s) || {}, { ref: c, message: g, type:
|
|
800
|
+
const h = (f(i, s, { _f: {} })._f || {}).ref, y = f(t.errors, s) || {}, { ref: c, message: g, type: _, ...T } = y;
|
|
801
801
|
x(t.errors, s, {
|
|
802
|
-
...
|
|
802
|
+
...T,
|
|
803
803
|
...n,
|
|
804
804
|
ref: h
|
|
805
805
|
}), v.state.next({
|
|
@@ -807,20 +807,20 @@ function Kt(e = {}) {
|
|
|
807
807
|
errors: t.errors,
|
|
808
808
|
isValid: !1
|
|
809
809
|
}), o && o.shouldFocus && h && h.focus && h.focus();
|
|
810
|
-
},
|
|
811
|
-
next: (o) => s(
|
|
812
|
-
}) :
|
|
813
|
-
for (const o of s ?
|
|
810
|
+
}, xt = (s, n) => $(s) ? v.values.subscribe({
|
|
811
|
+
next: (o) => s(A(void 0, n), o)
|
|
812
|
+
}) : A(s, n, !0), xe = (s, n = {}) => {
|
|
813
|
+
for (const o of s ? de(s) : d.mount)
|
|
814
814
|
d.mount.delete(o), d.array.delete(o), n.keepValue || (C(i, o), C(u, o)), !n.keepError && C(t.errors, o), !n.keepDirty && C(t.dirtyFields, o), !n.keepTouched && C(t.touchedFields, o), !n.keepIsValidating && C(t.validatingFields, o), !r.shouldUnregister && !n.keepDefaultValue && C(a, o);
|
|
815
815
|
v.values.next({
|
|
816
816
|
values: { ...u }
|
|
817
817
|
}), v.state.next({
|
|
818
818
|
...t,
|
|
819
|
-
...n.keepDirty ? { isDirty:
|
|
819
|
+
...n.keepDirty ? { isDirty: m() } : {}
|
|
820
820
|
}), !n.keepIsValid && I();
|
|
821
821
|
}, Ie = ({ disabled: s, name: n, field: o, fields: h }) => {
|
|
822
|
-
(q(s) && l.mount || s || d.disabled.has(n)) && (s ? d.disabled.add(n) : d.disabled.delete(n), se(n,
|
|
823
|
-
},
|
|
822
|
+
(q(s) && l.mount || s || d.disabled.has(n)) && (s ? d.disabled.add(n) : d.disabled.delete(n), se(n, pe(o ? o._f : f(h, n)._f), !1, !1, !0));
|
|
823
|
+
}, De = (s, n = {}) => {
|
|
824
824
|
let o = f(i, s);
|
|
825
825
|
const h = q(n.disabled) || q(r.disabled);
|
|
826
826
|
return x(i, s, {
|
|
@@ -835,7 +835,7 @@ function Kt(e = {}) {
|
|
|
835
835
|
field: o,
|
|
836
836
|
disabled: q(n.disabled) ? n.disabled : r.disabled,
|
|
837
837
|
name: s
|
|
838
|
-
}) :
|
|
838
|
+
}) : k(s, !0, n.value), {
|
|
839
839
|
...h ? { disabled: n.disabled || r.disabled } : {},
|
|
840
840
|
...r.progressive ? {
|
|
841
841
|
required: !!n.required,
|
|
@@ -850,28 +850,28 @@ function Kt(e = {}) {
|
|
|
850
850
|
onBlur: ae,
|
|
851
851
|
ref: (y) => {
|
|
852
852
|
if (y) {
|
|
853
|
-
|
|
854
|
-
const c =
|
|
855
|
-
if (g ?
|
|
853
|
+
De(s, n), o = f(i, s);
|
|
854
|
+
const c = E(y.value) && y.querySelectorAll && y.querySelectorAll("input,select,textarea")[0] || y, g = Bt(c), _ = o._f.refs || [];
|
|
855
|
+
if (g ? _.find((T) => T === c) : c === o._f.ref)
|
|
856
856
|
return;
|
|
857
857
|
x(i, s, {
|
|
858
858
|
_f: {
|
|
859
859
|
...o._f,
|
|
860
860
|
...g ? {
|
|
861
861
|
refs: [
|
|
862
|
-
...
|
|
862
|
+
..._.filter(ke),
|
|
863
863
|
c,
|
|
864
864
|
...Array.isArray(f(a, s)) ? [{}] : []
|
|
865
865
|
],
|
|
866
866
|
ref: { type: c.type, name: s }
|
|
867
867
|
} : { ref: c }
|
|
868
868
|
}
|
|
869
|
-
}),
|
|
869
|
+
}), k(s, !1, void 0, c);
|
|
870
870
|
} else
|
|
871
871
|
o = f(i, s, {}), o._f && (o._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(ot(d.array, s) && l.action) && d.unMount.add(s);
|
|
872
872
|
}
|
|
873
873
|
};
|
|
874
|
-
}, je = () => r.shouldFocusError && ye(i, ue, d.mount),
|
|
874
|
+
}, je = () => r.shouldFocusError && ye(i, ue, d.mount), Dt = (s) => {
|
|
875
875
|
q(s) && (v.state.next({ disabled: s }), ye(i, (n, o) => {
|
|
876
876
|
const h = f(i, o);
|
|
877
877
|
h && (n.disabled = h._f.disabled || s, Array.isArray(h._f.refs) && h._f.refs.forEach((y) => {
|
|
@@ -881,7 +881,7 @@ function Kt(e = {}) {
|
|
|
881
881
|
}, We = (s, n) => async (o) => {
|
|
882
882
|
let h;
|
|
883
883
|
o && (o.preventDefault && o.preventDefault(), o.persist && o.persist());
|
|
884
|
-
let y =
|
|
884
|
+
let y = B(u);
|
|
885
885
|
if (d.disabled.size)
|
|
886
886
|
for (const c of d.disabled)
|
|
887
887
|
x(y, c, void 0);
|
|
@@ -911,28 +911,28 @@ function Kt(e = {}) {
|
|
|
911
911
|
errors: t.errors
|
|
912
912
|
}), h)
|
|
913
913
|
throw h;
|
|
914
|
-
},
|
|
915
|
-
f(i, s) && (
|
|
914
|
+
}, wt = (s, n = {}) => {
|
|
915
|
+
f(i, s) && (E(n.defaultValue) ? W(s, B(f(a, s))) : (W(s, n.defaultValue), x(a, s, B(n.defaultValue))), n.keepTouched || C(t.touchedFields, s), n.keepDirty || (C(t.dirtyFields, s), t.isDirty = n.defaultValue ? m(s, B(f(a, s))) : m()), n.keepError || (C(t.errors, s), V.isValid && I()), v.state.next({ ...t }));
|
|
916
916
|
}, qe = (s, n = {}) => {
|
|
917
|
-
const o = s ?
|
|
917
|
+
const o = s ? B(s) : a, h = B(o), y = P(s), c = y ? a : h;
|
|
918
918
|
if (n.keepDefaultValues || (a = o), !n.keepValues) {
|
|
919
919
|
if (n.keepDirtyValues) {
|
|
920
920
|
const g = /* @__PURE__ */ new Set([
|
|
921
921
|
...d.mount,
|
|
922
922
|
...Object.keys(le(a, u))
|
|
923
923
|
]);
|
|
924
|
-
for (const
|
|
925
|
-
f(t.dirtyFields,
|
|
924
|
+
for (const _ of Array.from(g))
|
|
925
|
+
f(t.dirtyFields, _) ? x(c, _, f(u, _)) : W(_, f(c, _));
|
|
926
926
|
} else {
|
|
927
|
-
if (
|
|
927
|
+
if (Te && E(s))
|
|
928
928
|
for (const g of d.mount) {
|
|
929
|
-
const
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
932
|
-
if (me(
|
|
933
|
-
const
|
|
934
|
-
if (
|
|
935
|
-
|
|
929
|
+
const _ = f(i, g);
|
|
930
|
+
if (_ && _._f) {
|
|
931
|
+
const T = Array.isArray(_._f.refs) ? _._f.refs[0] : _._f.ref;
|
|
932
|
+
if (me(T)) {
|
|
933
|
+
const L = T.closest("form");
|
|
934
|
+
if (L) {
|
|
935
|
+
L.reset();
|
|
936
936
|
break;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
@@ -940,7 +940,7 @@ function Kt(e = {}) {
|
|
|
940
940
|
}
|
|
941
941
|
i = {};
|
|
942
942
|
}
|
|
943
|
-
u = r.shouldUnregister ? n.keepDefaultValues ?
|
|
943
|
+
u = r.shouldUnregister ? n.keepDefaultValues ? B(a) : {} : B(c), v.array.next({
|
|
944
944
|
values: { ...c }
|
|
945
945
|
}), v.values.next({
|
|
946
946
|
values: { ...c }
|
|
@@ -954,7 +954,7 @@ function Kt(e = {}) {
|
|
|
954
954
|
watch: /* @__PURE__ */ new Set(),
|
|
955
955
|
watchAll: !1,
|
|
956
956
|
focus: ""
|
|
957
|
-
}, l.mount = !
|
|
957
|
+
}, l.mount = !V.isValid || !!n.keepIsValid || !!n.keepDirtyValues, l.watch = !!r.shouldUnregister, v.state.next({
|
|
958
958
|
submitCount: n.keepSubmitCount ? t.submitCount : 0,
|
|
959
959
|
isDirty: y ? !1 : n.keepDirty ? t.isDirty : !!(n.keepDefaultValues && !ee(s, a)),
|
|
960
960
|
isSubmitted: n.keepIsSubmitted ? t.isSubmitted : !1,
|
|
@@ -964,24 +964,24 @@ function Kt(e = {}) {
|
|
|
964
964
|
isSubmitSuccessful: n.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
965
965
|
isSubmitting: !1
|
|
966
966
|
});
|
|
967
|
-
}, He = (s, n) => qe(
|
|
967
|
+
}, He = (s, n) => qe($(s) ? s(u) : s, n);
|
|
968
968
|
return {
|
|
969
969
|
control: {
|
|
970
|
-
register:
|
|
971
|
-
unregister:
|
|
972
|
-
getFieldState:
|
|
970
|
+
register: De,
|
|
971
|
+
unregister: xe,
|
|
972
|
+
getFieldState: Be,
|
|
973
973
|
handleSubmit: We,
|
|
974
974
|
setError: Pe,
|
|
975
975
|
_executeSchema: te,
|
|
976
|
-
_getWatch:
|
|
977
|
-
_getDirty:
|
|
976
|
+
_getWatch: A,
|
|
977
|
+
_getDirty: m,
|
|
978
978
|
_updateValid: I,
|
|
979
979
|
_removeUnmounted: ve,
|
|
980
|
-
_updateFieldArray:
|
|
980
|
+
_updateFieldArray: F,
|
|
981
981
|
_updateDisabledField: Ie,
|
|
982
|
-
_getFieldArray:
|
|
982
|
+
_getFieldArray: p,
|
|
983
983
|
_reset: qe,
|
|
984
|
-
_resetDefaultValues: () =>
|
|
984
|
+
_resetDefaultValues: () => $(r.defaultValues) && r.defaultValues().then((s) => {
|
|
985
985
|
He(s, r.resetOptions), v.state.next({
|
|
986
986
|
isLoading: !1
|
|
987
987
|
});
|
|
@@ -992,9 +992,9 @@ function Kt(e = {}) {
|
|
|
992
992
|
...s
|
|
993
993
|
};
|
|
994
994
|
},
|
|
995
|
-
_disableForm:
|
|
995
|
+
_disableForm: Dt,
|
|
996
996
|
_subjects: v,
|
|
997
|
-
_proxyFormState:
|
|
997
|
+
_proxyFormState: V,
|
|
998
998
|
_setErrors: Y,
|
|
999
999
|
get _fields() {
|
|
1000
1000
|
return i;
|
|
@@ -1034,31 +1034,31 @@ function Kt(e = {}) {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
},
|
|
1036
1036
|
trigger: oe,
|
|
1037
|
-
register:
|
|
1037
|
+
register: De,
|
|
1038
1038
|
handleSubmit: We,
|
|
1039
|
-
watch:
|
|
1039
|
+
watch: xt,
|
|
1040
1040
|
setValue: W,
|
|
1041
|
-
getValues:
|
|
1041
|
+
getValues: Ne,
|
|
1042
1042
|
reset: He,
|
|
1043
|
-
resetField:
|
|
1043
|
+
resetField: wt,
|
|
1044
1044
|
clearErrors: At,
|
|
1045
|
-
unregister:
|
|
1045
|
+
unregister: xe,
|
|
1046
1046
|
setError: Pe,
|
|
1047
1047
|
setFocus: (s, n = {}) => {
|
|
1048
1048
|
const o = f(i, s), h = o && o._f;
|
|
1049
1049
|
if (h) {
|
|
1050
1050
|
const y = h.refs ? h.refs[0] : h.ref;
|
|
1051
|
-
y.focus && (y.focus(), n.shouldSelect &&
|
|
1051
|
+
y.focus && (y.focus(), n.shouldSelect && $(y.select) && y.select());
|
|
1052
1052
|
}
|
|
1053
1053
|
},
|
|
1054
|
-
getFieldState:
|
|
1054
|
+
getFieldState: Be
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
1057
|
function Qt(e = {}) {
|
|
1058
|
-
const r =
|
|
1058
|
+
const r = D.useRef(void 0), t = D.useRef(void 0), [i, a] = D.useState({
|
|
1059
1059
|
isDirty: !1,
|
|
1060
1060
|
isValidating: !1,
|
|
1061
|
-
isLoading:
|
|
1061
|
+
isLoading: $(e.defaultValues),
|
|
1062
1062
|
isSubmitted: !1,
|
|
1063
1063
|
isSubmitting: !1,
|
|
1064
1064
|
isSubmitSuccessful: !1,
|
|
@@ -1069,7 +1069,7 @@ function Qt(e = {}) {
|
|
|
1069
1069
|
validatingFields: {},
|
|
1070
1070
|
errors: e.errors || {},
|
|
1071
1071
|
disabled: e.disabled || !1,
|
|
1072
|
-
defaultValues:
|
|
1072
|
+
defaultValues: $(e.defaultValues) ? void 0 : e.defaultValues
|
|
1073
1073
|
});
|
|
1074
1074
|
r.current || (r.current = {
|
|
1075
1075
|
...Kt(e),
|
|
@@ -1079,22 +1079,22 @@ function Qt(e = {}) {
|
|
|
1079
1079
|
return u._options = e, Oe({
|
|
1080
1080
|
subject: u._subjects.state,
|
|
1081
1081
|
next: (l) => {
|
|
1082
|
-
|
|
1082
|
+
ft(l, u._proxyFormState, u._updateFormState, !0) && a({ ...u._formState });
|
|
1083
1083
|
}
|
|
1084
|
-
}),
|
|
1084
|
+
}), D.useEffect(() => u._disableForm(e.disabled), [u, e.disabled]), D.useEffect(() => {
|
|
1085
1085
|
if (u._proxyFormState.isDirty) {
|
|
1086
1086
|
const l = u._getDirty();
|
|
1087
1087
|
l !== i.isDirty && u._subjects.state.next({
|
|
1088
1088
|
isDirty: l
|
|
1089
1089
|
});
|
|
1090
1090
|
}
|
|
1091
|
-
}, [u, i.isDirty]),
|
|
1091
|
+
}, [u, i.isDirty]), D.useEffect(() => {
|
|
1092
1092
|
e.values && !ee(e.values, t.current) ? (u._reset(e.values, u._options.resetOptions), t.current = e.values, a((l) => ({ ...l }))) : u._resetDefaultValues();
|
|
1093
|
-
}, [e.values, u]),
|
|
1093
|
+
}, [e.values, u]), D.useEffect(() => {
|
|
1094
1094
|
e.errors && u._setErrors(e.errors);
|
|
1095
|
-
}, [e.errors, u]),
|
|
1095
|
+
}, [e.errors, u]), D.useEffect(() => {
|
|
1096
1096
|
u._state.mount || (u._updateValid(), u._state.mount = !0), u._state.watch && (u._state.watch = !1, u._subjects.state.next({ ...u._formState })), u._removeUnmounted();
|
|
1097
|
-
}),
|
|
1097
|
+
}), D.useEffect(() => {
|
|
1098
1098
|
e.shouldUnregister && u._subjects.values.next({
|
|
1099
1099
|
values: u._getWatch()
|
|
1100
1100
|
});
|
|
@@ -1110,52 +1110,52 @@ const nt = (e, r, t) => {
|
|
|
1110
1110
|
const i = r.fields[t];
|
|
1111
1111
|
i && i.ref && "reportValidity" in i.ref ? nt(i.ref, t, e) : i.refs && i.refs.forEach((a) => nt(a, t, e));
|
|
1112
1112
|
}
|
|
1113
|
-
},
|
|
1113
|
+
}, $t = (e, r) => {
|
|
1114
1114
|
r.shouldUseNativeValidation && Ft(e, r);
|
|
1115
1115
|
const t = {};
|
|
1116
1116
|
for (const i in e) {
|
|
1117
1117
|
const a = f(r.fields, i), u = Object.assign(e[i] || {}, { ref: a && a.ref });
|
|
1118
|
-
if (
|
|
1118
|
+
if (zt(r.names || Object.keys(e), i)) {
|
|
1119
1119
|
const l = Object.assign({}, f(t, i));
|
|
1120
1120
|
x(l, "root", u), x(t, i, l);
|
|
1121
1121
|
} else x(t, i, u);
|
|
1122
1122
|
}
|
|
1123
1123
|
return t;
|
|
1124
|
-
},
|
|
1125
|
-
var
|
|
1124
|
+
}, zt = (e, r) => e.some((t) => t.startsWith(r + "."));
|
|
1125
|
+
var Gt = function(e, r) {
|
|
1126
1126
|
for (var t = {}; e.length; ) {
|
|
1127
1127
|
var i = e[0], a = i.code, u = i.message, l = i.path.join(".");
|
|
1128
1128
|
if (!t[l]) if ("unionErrors" in i) {
|
|
1129
1129
|
var d = i.unionErrors[0].errors[0];
|
|
1130
1130
|
t[l] = { message: d.message, type: d.code };
|
|
1131
1131
|
} else t[l] = { message: u, type: a };
|
|
1132
|
-
if ("unionErrors" in i && i.unionErrors.forEach(function(
|
|
1133
|
-
return
|
|
1132
|
+
if ("unionErrors" in i && i.unionErrors.forEach(function(V) {
|
|
1133
|
+
return V.errors.forEach(function(v) {
|
|
1134
1134
|
return e.push(v);
|
|
1135
1135
|
});
|
|
1136
1136
|
}), r) {
|
|
1137
|
-
var b = t[l].types,
|
|
1138
|
-
t[l] = ht(l, r, t, a,
|
|
1137
|
+
var b = t[l].types, w = b && b[i.code];
|
|
1138
|
+
t[l] = ht(l, r, t, a, w ? [].concat(w, i.message) : i.message);
|
|
1139
1139
|
}
|
|
1140
1140
|
e.shift();
|
|
1141
1141
|
}
|
|
1142
1142
|
return t;
|
|
1143
|
-
},
|
|
1143
|
+
}, Yt = function(e, r, t) {
|
|
1144
1144
|
return t === void 0 && (t = {}), function(i, a, u) {
|
|
1145
1145
|
try {
|
|
1146
1146
|
return Promise.resolve(function(l, d) {
|
|
1147
1147
|
try {
|
|
1148
|
-
var b = Promise.resolve(e[t.mode === "sync" ? "parse" : "parseAsync"](i, r)).then(function(
|
|
1149
|
-
return u.shouldUseNativeValidation && Ft({}, u), { errors: {}, values: t.raw ? i :
|
|
1148
|
+
var b = Promise.resolve(e[t.mode === "sync" ? "parse" : "parseAsync"](i, r)).then(function(w) {
|
|
1149
|
+
return u.shouldUseNativeValidation && Ft({}, u), { errors: {}, values: t.raw ? i : w };
|
|
1150
1150
|
});
|
|
1151
|
-
} catch (
|
|
1152
|
-
return d(
|
|
1151
|
+
} catch (w) {
|
|
1152
|
+
return d(w);
|
|
1153
1153
|
}
|
|
1154
1154
|
return b && b.then ? b.then(void 0, d) : b;
|
|
1155
1155
|
}(0, function(l) {
|
|
1156
1156
|
if (function(d) {
|
|
1157
1157
|
return Array.isArray(d == null ? void 0 : d.errors);
|
|
1158
|
-
}(l)) return { values: {}, errors: Gt(
|
|
1158
|
+
}(l)) return { values: {}, errors: $t(Gt(l.errors, !u.shouldUseNativeValidation && u.criteriaMode === "all"), u) };
|
|
1159
1159
|
throw l;
|
|
1160
1160
|
}));
|
|
1161
1161
|
} catch (l) {
|
|
@@ -1163,49 +1163,28 @@ var Jt = function(e, r) {
|
|
|
1163
1163
|
}
|
|
1164
1164
|
};
|
|
1165
1165
|
};
|
|
1166
|
-
const
|
|
1166
|
+
const ur = ({ schema: e, ...r }) => Qt({
|
|
1167
1167
|
...r,
|
|
1168
|
-
resolver:
|
|
1169
|
-
}),
|
|
1168
|
+
resolver: Yt(e)
|
|
1169
|
+
}), Jt = (e, r) => {
|
|
1170
1170
|
let t;
|
|
1171
1171
|
return function(...i) {
|
|
1172
1172
|
clearTimeout(t), t = setTimeout(() => e(...i), r);
|
|
1173
1173
|
};
|
|
1174
|
-
},
|
|
1175
|
-
const t =
|
|
1176
|
-
return
|
|
1174
|
+
}, Xt = (e, r) => fe.useMemo(() => Jt(e, r), [r]), or = (e, r) => {
|
|
1175
|
+
const t = fe.useRef(e), [i, a] = fe.useState(e), u = Xt(a, r);
|
|
1176
|
+
return fe.useEffect(() => {
|
|
1177
1177
|
t.current !== e && (u(e), t.current = e);
|
|
1178
1178
|
}, [e]), i;
|
|
1179
|
-
}, dr = (e, r, t) => {
|
|
1180
|
-
const [i, a] = kt(null);
|
|
1181
|
-
return Ct(() => {
|
|
1182
|
-
const u = () => {
|
|
1183
|
-
if (e.current && r.current) {
|
|
1184
|
-
const l = e.current.getBoundingClientRect(), d = r.current.getBoundingClientRect(), b = window.innerHeight;
|
|
1185
|
-
let F, _;
|
|
1186
|
-
const v = b - l.bottom;
|
|
1187
|
-
v >= d.height + t ? (F = l.bottom + t, _ = "top") : l.top >= d.height + t ? (F = l.top - d.height - t * 2, _ = "bottom") : (F = l.bottom + t, _ = "top", r.current.style.maxHeight = `${v - t}px`), a({
|
|
1188
|
-
top: F,
|
|
1189
|
-
width: l.width,
|
|
1190
|
-
left: l.left,
|
|
1191
|
-
transformOrigin: _
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
};
|
|
1195
|
-
return u(), window.addEventListener("resize", u), window.addEventListener("orientationchange", u), () => {
|
|
1196
|
-
window.removeEventListener("resize", u), window.removeEventListener("orientationchange", u);
|
|
1197
|
-
};
|
|
1198
|
-
}, [e.current, r.current, t]), i;
|
|
1199
1179
|
};
|
|
1200
1180
|
export {
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
Ut as u
|
|
1181
|
+
ir as a,
|
|
1182
|
+
nr as b,
|
|
1183
|
+
ur as c,
|
|
1184
|
+
Jt as d,
|
|
1185
|
+
Xt as e,
|
|
1186
|
+
or as f,
|
|
1187
|
+
ar as g,
|
|
1188
|
+
Ot as u
|
|
1210
1189
|
};
|
|
1211
|
-
//# sourceMappingURL=
|
|
1190
|
+
//# sourceMappingURL=useDebounce-QgEEiWs9.js.map
|