stone-kit 0.0.337 → 0.0.338
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.
|
@@ -3,6 +3,7 @@ interface IModalFormProps {
|
|
|
3
3
|
setIsFormOpen: (isOpen: boolean) => void;
|
|
4
4
|
submitHandler: (data: IFormPageInputs) => void;
|
|
5
5
|
modalWidth?: string;
|
|
6
|
+
isPhone?: boolean;
|
|
6
7
|
title: string;
|
|
7
8
|
isEmail?: boolean;
|
|
8
9
|
isTextArea?: boolean;
|
|
@@ -29,5 +30,5 @@ type IFormPageInputs = {
|
|
|
29
30
|
advCheckBox?: boolean;
|
|
30
31
|
textarea?: string;
|
|
31
32
|
};
|
|
32
|
-
export declare const ModalForm: ({ isFormOpen, setIsFormOpen, title, isEmail, isTextArea, isRequiredPhone, isRequiredEmail, isRequiredPhoneOrEmail, textAreaPlaceholder, subTitle, submitHandler, modalWidth, rowsTextArea, personalCheckBox, advCheckBox, }: IModalFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
export declare const ModalForm: ({ isFormOpen, setIsFormOpen, title, isEmail, isPhone, isTextArea, isRequiredPhone, isRequiredEmail, isRequiredPhoneOrEmail, textAreaPlaceholder, subTitle, submitHandler, modalWidth, rowsTextArea, personalCheckBox, advCheckBox, }: IModalFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
33
34
|
export {};
|
|
@@ -21,9 +21,9 @@ const Et = "_btn_q5rib_1", Ct = "_modal_q5rib_9", Bt = "_modalBody_q5rib_16", Tt
|
|
|
21
21
|
};
|
|
22
22
|
var ge = (e) => e.type === "checkbox", oe = (e) => e instanceof Date, T = (e) => e == null;
|
|
23
23
|
const lt = (e) => typeof e == "object";
|
|
24
|
-
var
|
|
24
|
+
var S = (e) => !T(e) && !Array.isArray(e) && lt(e) && !oe(e), Ot = (e) => S(e) && e.target ? ge(e.target) ? e.target.checked : e.target.value : e, Nt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Ut = (e, s) => e.has(Nt(s)), qt = (e) => {
|
|
25
25
|
const s = e.constructor && e.constructor.prototype;
|
|
26
|
-
return
|
|
26
|
+
return S(s) && s.hasOwnProperty("isPrototypeOf");
|
|
27
27
|
}, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
28
28
|
function P(e) {
|
|
29
29
|
let s;
|
|
@@ -32,7 +32,7 @@ function P(e) {
|
|
|
32
32
|
s = new Date(e);
|
|
33
33
|
else if (e instanceof Set)
|
|
34
34
|
s = new Set(e);
|
|
35
|
-
else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (r ||
|
|
35
|
+
else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (r || S(e)))
|
|
36
36
|
if (s = r ? [] : {}, !r && !qt(e))
|
|
37
37
|
s = e;
|
|
38
38
|
else
|
|
@@ -43,23 +43,23 @@ function P(e) {
|
|
|
43
43
|
return s;
|
|
44
44
|
}
|
|
45
45
|
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], p = (e) => e === void 0, d = (e, s, r) => {
|
|
46
|
-
if (!s || !
|
|
46
|
+
if (!s || !S(e))
|
|
47
47
|
return r;
|
|
48
48
|
const n = Ae(s.split(/[,[\].]+?/)).reduce((u, a) => T(u) ? u : u[a], e);
|
|
49
49
|
return p(n) || n === e ? p(e[s]) ? r : e[s] : n;
|
|
50
|
-
}, te = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), at = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)),
|
|
50
|
+
}, te = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), at = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), F = (e, s, r) => {
|
|
51
51
|
let n = -1;
|
|
52
52
|
const u = Le(s) ? [s] : at(s), a = u.length, y = a - 1;
|
|
53
53
|
for (; ++n < a; ) {
|
|
54
54
|
const g = u[n];
|
|
55
|
-
let
|
|
55
|
+
let R = r;
|
|
56
56
|
if (n !== y) {
|
|
57
57
|
const q = e[g];
|
|
58
|
-
|
|
58
|
+
R = S(q) || Array.isArray(q) ? q : isNaN(+u[n + 1]) ? {} : [];
|
|
59
59
|
}
|
|
60
60
|
if (g === "__proto__")
|
|
61
61
|
return;
|
|
62
|
-
e[g] =
|
|
62
|
+
e[g] = R, e = e[g];
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
};
|
|
@@ -67,13 +67,13 @@ const Je = {
|
|
|
67
67
|
BLUR: "blur",
|
|
68
68
|
FOCUS_OUT: "focusout",
|
|
69
69
|
CHANGE: "change"
|
|
70
|
-
},
|
|
70
|
+
}, $ = {
|
|
71
71
|
onBlur: "onBlur",
|
|
72
72
|
onChange: "onChange",
|
|
73
73
|
onSubmit: "onSubmit",
|
|
74
74
|
onTouched: "onTouched",
|
|
75
75
|
all: "all"
|
|
76
|
-
},
|
|
76
|
+
}, Y = {
|
|
77
77
|
max: "max",
|
|
78
78
|
min: "min",
|
|
79
79
|
maxLength: "maxLength",
|
|
@@ -91,14 +91,14 @@ var It = (e, s, r, n = !0) => {
|
|
|
91
91
|
Object.defineProperty(u, a, {
|
|
92
92
|
get: () => {
|
|
93
93
|
const y = a;
|
|
94
|
-
return s._proxyFormState[y] !==
|
|
94
|
+
return s._proxyFormState[y] !== $.all && (s._proxyFormState[y] = !n || $.all), e[y];
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
return u;
|
|
98
|
-
},
|
|
98
|
+
}, M = (e) => S(e) && !Object.keys(e).length, Pt = (e, s, r, n) => {
|
|
99
99
|
r(e);
|
|
100
100
|
const { name: u, ...a } = e;
|
|
101
|
-
return
|
|
101
|
+
return M(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === $.all);
|
|
102
102
|
}, _e = (e) => Array.isArray(e) ? e : [e];
|
|
103
103
|
function Wt(e) {
|
|
104
104
|
const s = W.useRef(e);
|
|
@@ -111,18 +111,18 @@ function Wt(e) {
|
|
|
111
111
|
};
|
|
112
112
|
}, [e.disabled]);
|
|
113
113
|
}
|
|
114
|
-
var
|
|
114
|
+
var G = (e) => typeof e == "string", Ht = (e, s, r, n, u) => G(e) ? (n && s.watch.add(e), d(r, e, u)) : Array.isArray(e) ? e.map((a) => (n && s.watch.add(a), d(r, a))) : (n && (s.watchAll = !0), r), zt = (e, s, r, n, u) => s ? {
|
|
115
115
|
...r[e],
|
|
116
116
|
types: {
|
|
117
117
|
...r[e] && r[e].types ? r[e].types : {},
|
|
118
118
|
[n]: u || !0
|
|
119
119
|
}
|
|
120
120
|
} : {}, Qe = (e) => ({
|
|
121
|
-
isOnSubmit: !e || e ===
|
|
122
|
-
isOnBlur: e ===
|
|
123
|
-
isOnChange: e ===
|
|
124
|
-
isOnAll: e ===
|
|
125
|
-
isOnTouch: e ===
|
|
121
|
+
isOnSubmit: !e || e === $.onSubmit,
|
|
122
|
+
isOnBlur: e === $.onBlur,
|
|
123
|
+
isOnChange: e === $.onChange,
|
|
124
|
+
isOnAll: e === $.all,
|
|
125
|
+
isOnTouch: e === $.onTouched
|
|
126
126
|
}), Xe = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
127
127
|
const he = (e, s, r, n) => {
|
|
128
128
|
for (const u of r || Object.keys(e)) {
|
|
@@ -136,19 +136,19 @@ const he = (e, s, r, n) => {
|
|
|
136
136
|
break;
|
|
137
137
|
he(g, s);
|
|
138
138
|
} else
|
|
139
|
-
|
|
139
|
+
S(g) && he(g, s);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
var $t = (e, s, r) => {
|
|
144
144
|
const n = _e(d(e, r));
|
|
145
|
-
return
|
|
145
|
+
return F(n, "root", s[r]), F(e, r, n), e;
|
|
146
146
|
}, Me = (e) => e.type === "file", re = (e) => typeof e == "function", be = (e) => {
|
|
147
147
|
if (!Re)
|
|
148
148
|
return !1;
|
|
149
149
|
const s = e ? e.ownerDocument : 0;
|
|
150
150
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
151
|
-
}, me = (e) =>
|
|
151
|
+
}, me = (e) => G(e), Oe = (e) => e.type === "radio", xe = (e) => e instanceof RegExp;
|
|
152
152
|
const Ye = {
|
|
153
153
|
value: !1,
|
|
154
154
|
isValid: !1
|
|
@@ -182,89 +182,89 @@ function tt(e, s, r = "validate") {
|
|
|
182
182
|
ref: s
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
|
-
var ue = (e) =>
|
|
185
|
+
var ue = (e) => S(e) && !xe(e) ? e : {
|
|
186
186
|
value: e,
|
|
187
187
|
message: ""
|
|
188
188
|
}, rt = async (e, s, r, n, u) => {
|
|
189
|
-
const { ref: a, refs: y, required: g, maxLength:
|
|
190
|
-
if (!
|
|
189
|
+
const { ref: a, refs: y, required: g, maxLength: R, minLength: q, min: A, max: _, pattern: ie, validate: j, name: C, valueAsNumber: J, mount: B, disabled: K } = e._f, m = d(s, C);
|
|
190
|
+
if (!B || K)
|
|
191
191
|
return {};
|
|
192
|
-
const
|
|
193
|
-
n &&
|
|
194
|
-
},
|
|
192
|
+
const H = y ? y[0] : a, O = (v) => {
|
|
193
|
+
n && H.reportValidity && (H.setCustomValidity(te(v) ? "" : v || ""), H.reportValidity());
|
|
194
|
+
}, V = {}, Q = Oe(a), le = ge(a), X = Q || le, Z = (J || Me(a)) && p(a.value) && p(m) || be(a) && a.value === "" || m === "" || Array.isArray(m) && !m.length, L = zt.bind(null, C, r, V), ae = (v, b, w, E = Y.maxLength, z = Y.minLength) => {
|
|
195
195
|
const I = v ? b : w;
|
|
196
|
-
|
|
197
|
-
type: v ?
|
|
196
|
+
V[C] = {
|
|
197
|
+
type: v ? E : z,
|
|
198
198
|
message: I,
|
|
199
199
|
ref: a,
|
|
200
|
-
...
|
|
200
|
+
...L(v ? E : z, I)
|
|
201
201
|
};
|
|
202
202
|
};
|
|
203
|
-
if (u ? !Array.isArray(m) || !m.length : g && (!
|
|
203
|
+
if (u ? !Array.isArray(m) || !m.length : g && (!X && (Z || T(m)) || te(m) && !m || le && !nt(y).isValid || Q && !ut(y).isValid)) {
|
|
204
204
|
const { value: v, message: b } = me(g) ? { value: !!g, message: g } : ue(g);
|
|
205
|
-
if (v && (
|
|
206
|
-
type:
|
|
205
|
+
if (v && (V[C] = {
|
|
206
|
+
type: Y.required,
|
|
207
207
|
message: b,
|
|
208
|
-
ref:
|
|
209
|
-
...
|
|
208
|
+
ref: H,
|
|
209
|
+
...L(Y.required, b)
|
|
210
210
|
}, !r))
|
|
211
|
-
return
|
|
211
|
+
return O(b), V;
|
|
212
212
|
}
|
|
213
|
-
if (!Z && (!T(
|
|
213
|
+
if (!Z && (!T(A) || !T(_))) {
|
|
214
214
|
let v, b;
|
|
215
|
-
const w = ue(_),
|
|
215
|
+
const w = ue(_), E = ue(A);
|
|
216
216
|
if (!T(m) && !isNaN(m)) {
|
|
217
|
-
const
|
|
218
|
-
T(w.value) || (v =
|
|
217
|
+
const z = a.valueAsNumber || m && +m;
|
|
218
|
+
T(w.value) || (v = z > w.value), T(E.value) || (b = z < E.value);
|
|
219
219
|
} else {
|
|
220
|
-
const
|
|
221
|
-
|
|
220
|
+
const z = a.valueAsDate || new Date(m), I = (de) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + de), ce = a.type == "time", fe = a.type == "week";
|
|
221
|
+
G(w.value) && m && (v = ce ? I(m) > I(w.value) : fe ? m > w.value : z > new Date(w.value)), G(E.value) && m && (b = ce ? I(m) < I(E.value) : fe ? m < E.value : z < new Date(E.value));
|
|
222
222
|
}
|
|
223
|
-
if ((v || b) && (ae(!!v, w.message,
|
|
224
|
-
return
|
|
223
|
+
if ((v || b) && (ae(!!v, w.message, E.message, Y.max, Y.min), !r))
|
|
224
|
+
return O(V[C].message), V;
|
|
225
225
|
}
|
|
226
|
-
if ((
|
|
227
|
-
const v = ue(
|
|
228
|
-
if ((w ||
|
|
229
|
-
return
|
|
226
|
+
if ((R || q) && !Z && (G(m) || u && Array.isArray(m))) {
|
|
227
|
+
const v = ue(R), b = ue(q), w = !T(v.value) && m.length > +v.value, E = !T(b.value) && m.length < +b.value;
|
|
228
|
+
if ((w || E) && (ae(w, v.message, b.message), !r))
|
|
229
|
+
return O(V[C].message), V;
|
|
230
230
|
}
|
|
231
|
-
if (ie && !Z &&
|
|
231
|
+
if (ie && !Z && G(m)) {
|
|
232
232
|
const { value: v, message: b } = ue(ie);
|
|
233
|
-
if (xe(v) && !m.match(v) && (
|
|
234
|
-
type:
|
|
233
|
+
if (xe(v) && !m.match(v) && (V[C] = {
|
|
234
|
+
type: Y.pattern,
|
|
235
235
|
message: b,
|
|
236
236
|
ref: a,
|
|
237
|
-
...
|
|
237
|
+
...L(Y.pattern, b)
|
|
238
238
|
}, !r))
|
|
239
|
-
return
|
|
239
|
+
return O(b), V;
|
|
240
240
|
}
|
|
241
|
-
if (
|
|
242
|
-
if (re(
|
|
243
|
-
const v = await
|
|
244
|
-
if (b && (
|
|
241
|
+
if (j) {
|
|
242
|
+
if (re(j)) {
|
|
243
|
+
const v = await j(m, s), b = tt(v, H);
|
|
244
|
+
if (b && (V[C] = {
|
|
245
245
|
...b,
|
|
246
|
-
...
|
|
246
|
+
...L(Y.validate, b.message)
|
|
247
247
|
}, !r))
|
|
248
|
-
return
|
|
249
|
-
} else if (
|
|
248
|
+
return O(b.message), V;
|
|
249
|
+
} else if (S(j)) {
|
|
250
250
|
let v = {};
|
|
251
|
-
for (const b in
|
|
252
|
-
if (!
|
|
251
|
+
for (const b in j) {
|
|
252
|
+
if (!M(v) && !r)
|
|
253
253
|
break;
|
|
254
|
-
const w = tt(await
|
|
254
|
+
const w = tt(await j[b](m, s), H, b);
|
|
255
255
|
w && (v = {
|
|
256
256
|
...w,
|
|
257
|
-
...
|
|
258
|
-
},
|
|
257
|
+
...L(b, w.message)
|
|
258
|
+
}, O(w.message), r && (V[C] = v));
|
|
259
259
|
}
|
|
260
|
-
if (!
|
|
261
|
-
ref:
|
|
260
|
+
if (!M(v) && (V[C] = {
|
|
261
|
+
ref: H,
|
|
262
262
|
...v
|
|
263
263
|
}, !r))
|
|
264
|
-
return
|
|
264
|
+
return V;
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
|
-
return
|
|
267
|
+
return O(!0), V;
|
|
268
268
|
};
|
|
269
269
|
function jt(e, s) {
|
|
270
270
|
const r = s.slice(0, -1).length;
|
|
@@ -279,9 +279,9 @@ function Kt(e) {
|
|
|
279
279
|
return !1;
|
|
280
280
|
return !0;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
282
|
+
function k(e, s) {
|
|
283
283
|
const r = Array.isArray(s) ? s : Le(s) ? [s] : at(s), n = r.length === 1 ? e : jt(e, r), u = r.length - 1, a = r[u];
|
|
284
|
-
return n && delete n[a], u !== 0 && (
|
|
284
|
+
return n && delete n[a], u !== 0 && (S(n) && M(n) || Array.isArray(n) && Kt(n)) && k(e, r.slice(0, -1)), e;
|
|
285
285
|
}
|
|
286
286
|
var Ce = () => {
|
|
287
287
|
let e = [];
|
|
@@ -317,7 +317,7 @@ function se(e, s) {
|
|
|
317
317
|
return !1;
|
|
318
318
|
if (u !== "ref") {
|
|
319
319
|
const y = s[u];
|
|
320
|
-
if (oe(a) && oe(y) ||
|
|
320
|
+
if (oe(a) && oe(y) || S(a) && S(y) || Array.isArray(a) && Array.isArray(y) ? !se(a, y) : a !== y)
|
|
321
321
|
return !1;
|
|
322
322
|
}
|
|
323
323
|
}
|
|
@@ -331,19 +331,19 @@ var ot = (e) => e.type === "select-multiple", Gt = (e) => Oe(e) || ge(e), Be = (
|
|
|
331
331
|
};
|
|
332
332
|
function Fe(e, s = {}) {
|
|
333
333
|
const r = Array.isArray(e);
|
|
334
|
-
if (
|
|
334
|
+
if (S(e) || r)
|
|
335
335
|
for (const n in e)
|
|
336
|
-
Array.isArray(e[n]) ||
|
|
336
|
+
Array.isArray(e[n]) || S(e[n]) && !ct(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, Fe(e[n], s[n])) : T(e[n]) || (s[n] = !0);
|
|
337
337
|
return s;
|
|
338
338
|
}
|
|
339
339
|
function ft(e, s, r) {
|
|
340
340
|
const n = Array.isArray(e);
|
|
341
|
-
if (
|
|
341
|
+
if (S(e) || n)
|
|
342
342
|
for (const u in e)
|
|
343
|
-
Array.isArray(e[u]) ||
|
|
343
|
+
Array.isArray(e[u]) || S(e[u]) && !ct(e[u]) ? p(s) || Ve(r[u]) ? r[u] = Array.isArray(e[u]) ? Fe(e[u], []) : { ...Fe(e[u]) } : ft(e[u], T(s) ? {} : s[u], r[u]) : r[u] = !se(e[u], s[u]);
|
|
344
344
|
return r;
|
|
345
345
|
}
|
|
346
|
-
var ve = (e, s) => ft(e, s, Fe(s)), dt = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: n }) => p(e) ? e : s ? e === "" ? NaN : e && +e : r &&
|
|
346
|
+
var ve = (e, s) => ft(e, s, Fe(s)), dt = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: n }) => p(e) ? e : s ? e === "" ? NaN : e && +e : r && G(e) ? new Date(e) : n ? n(e) : e;
|
|
347
347
|
function Te(e) {
|
|
348
348
|
const s = e.ref;
|
|
349
349
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : s.disabled))
|
|
@@ -353,7 +353,7 @@ var Jt = (e, s, r, n) => {
|
|
|
353
353
|
const u = {};
|
|
354
354
|
for (const a of e) {
|
|
355
355
|
const y = d(s, a);
|
|
356
|
-
y &&
|
|
356
|
+
y && F(u, a, y._f);
|
|
357
357
|
}
|
|
358
358
|
return {
|
|
359
359
|
criteriaMode: r,
|
|
@@ -361,7 +361,7 @@ var Jt = (e, s, r, n) => {
|
|
|
361
361
|
fields: u,
|
|
362
362
|
shouldUseNativeValidation: n
|
|
363
363
|
};
|
|
364
|
-
}, ye = (e) => p(e) ? e : xe(e) ? e.source :
|
|
364
|
+
}, ye = (e) => p(e) ? e : xe(e) ? e.source : S(e) ? xe(e.value) ? e.value.source : e.value : e, Qt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
365
365
|
function st(e, s, r) {
|
|
366
366
|
const n = d(e, r);
|
|
367
367
|
if (n || Le(r))
|
|
@@ -385,10 +385,10 @@ function st(e, s, r) {
|
|
|
385
385
|
name: r
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
|
-
var Xt = (e, s, r, n, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? n.isOnBlur : u.isOnBlur) ? !e : (r ? n.isOnChange : u.isOnChange) ? e : !0, Yt = (e, s) => !Ae(d(e, s)).length &&
|
|
388
|
+
var Xt = (e, s, r, n, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(s || e) : (r ? n.isOnBlur : u.isOnBlur) ? !e : (r ? n.isOnChange : u.isOnChange) ? e : !0, Yt = (e, s) => !Ae(d(e, s)).length && k(e, s);
|
|
389
389
|
const Zt = {
|
|
390
|
-
mode:
|
|
391
|
-
reValidateMode:
|
|
390
|
+
mode: $.onSubmit,
|
|
391
|
+
reValidateMode: $.onChange,
|
|
392
392
|
shouldFocusError: !0
|
|
393
393
|
};
|
|
394
394
|
function er(e = {}) {
|
|
@@ -409,7 +409,7 @@ function er(e = {}) {
|
|
|
409
409
|
validatingFields: {},
|
|
410
410
|
errors: s.errors || {},
|
|
411
411
|
disabled: s.disabled || !1
|
|
412
|
-
}, n = {}, u =
|
|
412
|
+
}, n = {}, u = S(s.defaultValues) || S(s.values) ? P(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : P(u), y = {
|
|
413
413
|
action: !1,
|
|
414
414
|
mount: !1,
|
|
415
415
|
watch: !1
|
|
@@ -418,8 +418,8 @@ function er(e = {}) {
|
|
|
418
418
|
unMount: /* @__PURE__ */ new Set(),
|
|
419
419
|
array: /* @__PURE__ */ new Set(),
|
|
420
420
|
watch: /* @__PURE__ */ new Set()
|
|
421
|
-
},
|
|
422
|
-
const
|
|
421
|
+
}, R, q = 0;
|
|
422
|
+
const A = {
|
|
423
423
|
isDirty: !1,
|
|
424
424
|
dirtyFields: !1,
|
|
425
425
|
validatingFields: !1,
|
|
@@ -431,37 +431,37 @@ function er(e = {}) {
|
|
|
431
431
|
values: Ce(),
|
|
432
432
|
array: Ce(),
|
|
433
433
|
state: Ce()
|
|
434
|
-
}, ie = Qe(s.mode),
|
|
434
|
+
}, ie = Qe(s.mode), j = Qe(s.reValidateMode), C = s.criteriaMode === $.all, J = (t) => (i) => {
|
|
435
435
|
clearTimeout(q), q = setTimeout(t, i);
|
|
436
|
-
},
|
|
437
|
-
if (
|
|
438
|
-
const i = s.resolver ?
|
|
436
|
+
}, B = async (t) => {
|
|
437
|
+
if (A.isValid || t) {
|
|
438
|
+
const i = s.resolver ? M((await X()).errors) : await L(n, !0);
|
|
439
439
|
i !== r.isValid && _.state.next({
|
|
440
440
|
isValid: i
|
|
441
441
|
});
|
|
442
442
|
}
|
|
443
|
-
},
|
|
444
|
-
(
|
|
445
|
-
l && (i ?
|
|
443
|
+
}, K = (t, i) => {
|
|
444
|
+
(A.isValidating || A.validatingFields) && ((t || Array.from(g.mount)).forEach((l) => {
|
|
445
|
+
l && (i ? F(r.validatingFields, l, i) : k(r.validatingFields, l));
|
|
446
446
|
}), _.state.next({
|
|
447
447
|
validatingFields: r.validatingFields,
|
|
448
|
-
isValidating: !
|
|
448
|
+
isValidating: !M(r.validatingFields)
|
|
449
449
|
}));
|
|
450
450
|
}, m = (t, i = [], l, f, c = !0, o = !0) => {
|
|
451
451
|
if (f && l) {
|
|
452
452
|
if (y.action = !0, o && Array.isArray(d(n, t))) {
|
|
453
453
|
const h = l(d(n, t), f.argA, f.argB);
|
|
454
|
-
c &&
|
|
454
|
+
c && F(n, t, h);
|
|
455
455
|
}
|
|
456
456
|
if (o && Array.isArray(d(r.errors, t))) {
|
|
457
457
|
const h = l(d(r.errors, t), f.argA, f.argB);
|
|
458
|
-
c &&
|
|
458
|
+
c && F(r.errors, t, h), Yt(r.errors, t);
|
|
459
459
|
}
|
|
460
|
-
if (
|
|
460
|
+
if (A.touchedFields && o && Array.isArray(d(r.touchedFields, t))) {
|
|
461
461
|
const h = l(d(r.touchedFields, t), f.argA, f.argB);
|
|
462
|
-
c &&
|
|
462
|
+
c && F(r.touchedFields, t, h);
|
|
463
463
|
}
|
|
464
|
-
|
|
464
|
+
A.dirtyFields && (r.dirtyFields = ve(u, a)), _.state.next({
|
|
465
465
|
name: t,
|
|
466
466
|
isDirty: v(t, i),
|
|
467
467
|
dirtyFields: r.dirtyFields,
|
|
@@ -469,40 +469,40 @@ function er(e = {}) {
|
|
|
469
469
|
isValid: r.isValid
|
|
470
470
|
});
|
|
471
471
|
} else
|
|
472
|
-
|
|
473
|
-
},
|
|
474
|
-
|
|
472
|
+
F(a, t, i);
|
|
473
|
+
}, H = (t, i) => {
|
|
474
|
+
F(r.errors, t, i), _.state.next({
|
|
475
475
|
errors: r.errors
|
|
476
476
|
});
|
|
477
|
-
},
|
|
477
|
+
}, O = (t) => {
|
|
478
478
|
r.errors = t, _.state.next({
|
|
479
479
|
errors: r.errors,
|
|
480
480
|
isValid: !1
|
|
481
481
|
});
|
|
482
|
-
},
|
|
482
|
+
}, V = (t, i, l, f) => {
|
|
483
483
|
const c = d(n, t);
|
|
484
484
|
if (c) {
|
|
485
485
|
const o = d(a, t, p(l) ? d(u, t) : l);
|
|
486
|
-
p(o) || f && f.defaultChecked || i ?
|
|
486
|
+
p(o) || f && f.defaultChecked || i ? F(a, t, i ? o : Te(c._f)) : E(t, o), y.mount && B();
|
|
487
487
|
}
|
|
488
|
-
},
|
|
488
|
+
}, Q = (t, i, l, f, c) => {
|
|
489
489
|
let o = !1, h = !1;
|
|
490
490
|
const x = {
|
|
491
491
|
name: t
|
|
492
492
|
}, D = !!(d(n, t) && d(n, t)._f && d(n, t)._f.disabled);
|
|
493
493
|
if (!l || f) {
|
|
494
|
-
|
|
494
|
+
A.isDirty && (h = r.isDirty, r.isDirty = x.isDirty = v(), o = h !== x.isDirty);
|
|
495
495
|
const N = D || se(d(u, t), i);
|
|
496
|
-
h = !!(!D && d(r.dirtyFields, t)), N || D ?
|
|
496
|
+
h = !!(!D && d(r.dirtyFields, t)), N || D ? k(r.dirtyFields, t) : F(r.dirtyFields, t, !0), x.dirtyFields = r.dirtyFields, o = o || A.dirtyFields && h !== !N;
|
|
497
497
|
}
|
|
498
498
|
if (l) {
|
|
499
499
|
const N = d(r.touchedFields, t);
|
|
500
|
-
N || (
|
|
500
|
+
N || (F(r.touchedFields, t, l), x.touchedFields = r.touchedFields, o = o || A.touchedFields && N !== l);
|
|
501
501
|
}
|
|
502
502
|
return o && c && _.state.next(x), o ? x : {};
|
|
503
503
|
}, le = (t, i, l, f) => {
|
|
504
|
-
const c = d(r.errors, t), o =
|
|
505
|
-
if (e.delayError && l ? (
|
|
504
|
+
const c = d(r.errors, t), o = A.isValid && te(i) && r.isValid !== i;
|
|
505
|
+
if (e.delayError && l ? (R = J(() => H(t, l)), R(e.delayError)) : (clearTimeout(q), R = null, l ? F(r.errors, t, l) : k(r.errors, t)), (l ? !se(c, l) : c) || !M(f) || o) {
|
|
506
506
|
const h = {
|
|
507
507
|
...f,
|
|
508
508
|
...o && te(i) ? { isValid: i } : {},
|
|
@@ -514,21 +514,21 @@ function er(e = {}) {
|
|
|
514
514
|
...h
|
|
515
515
|
}, _.state.next(h);
|
|
516
516
|
}
|
|
517
|
-
},
|
|
518
|
-
|
|
517
|
+
}, X = async (t) => {
|
|
518
|
+
K(t, !0);
|
|
519
519
|
const i = await s.resolver(a, s.context, Jt(t || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
|
|
520
|
-
return
|
|
520
|
+
return K(t), i;
|
|
521
521
|
}, Z = async (t) => {
|
|
522
|
-
const { errors: i } = await
|
|
522
|
+
const { errors: i } = await X(t);
|
|
523
523
|
if (t)
|
|
524
524
|
for (const l of t) {
|
|
525
525
|
const f = d(i, l);
|
|
526
|
-
f ?
|
|
526
|
+
f ? F(r.errors, l, f) : k(r.errors, l);
|
|
527
527
|
}
|
|
528
528
|
else
|
|
529
529
|
r.errors = i;
|
|
530
530
|
return i;
|
|
531
|
-
},
|
|
531
|
+
}, L = async (t, i, l = {
|
|
532
532
|
valid: !0
|
|
533
533
|
}) => {
|
|
534
534
|
for (const f in t) {
|
|
@@ -537,13 +537,13 @@ function er(e = {}) {
|
|
|
537
537
|
const { _f: o, ...h } = c;
|
|
538
538
|
if (o) {
|
|
539
539
|
const x = g.array.has(o.name);
|
|
540
|
-
|
|
541
|
-
const D = await rt(c, a,
|
|
542
|
-
if (
|
|
540
|
+
K([f], !0);
|
|
541
|
+
const D = await rt(c, a, C, s.shouldUseNativeValidation && !i, x);
|
|
542
|
+
if (K([f]), D[o.name] && (l.valid = !1, i))
|
|
543
543
|
break;
|
|
544
|
-
!i && (d(D, o.name) ? x ? $t(r.errors, D, o.name) :
|
|
544
|
+
!i && (d(D, o.name) ? x ? $t(r.errors, D, o.name) : F(r.errors, o.name, D[o.name]) : k(r.errors, o.name));
|
|
545
545
|
}
|
|
546
|
-
!
|
|
546
|
+
!M(h) && await L(h, i, l);
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
549
|
return l.valid;
|
|
@@ -553,34 +553,34 @@ function er(e = {}) {
|
|
|
553
553
|
i && (i._f.refs ? i._f.refs.every((l) => !Be(l)) : !Be(i._f.ref)) && we(t);
|
|
554
554
|
}
|
|
555
555
|
g.unMount = /* @__PURE__ */ new Set();
|
|
556
|
-
}, v = (t, i) => (t && i &&
|
|
557
|
-
...y.mount ? a : p(i) ? u :
|
|
558
|
-
}, l, i), w = (t) => Ae(d(y.mount ? a : u, t, e.shouldUnregister ? d(u, t, []) : [])),
|
|
556
|
+
}, v = (t, i) => (t && i && F(a, t, i), !se(Ne(), u)), b = (t, i, l) => Ht(t, g, {
|
|
557
|
+
...y.mount ? a : p(i) ? u : G(t) ? { [t]: i } : i
|
|
558
|
+
}, l, i), w = (t) => Ae(d(y.mount ? a : u, t, e.shouldUnregister ? d(u, t, []) : [])), E = (t, i, l = {}) => {
|
|
559
559
|
const f = d(n, t);
|
|
560
560
|
let c = i;
|
|
561
561
|
if (f) {
|
|
562
562
|
const o = f._f;
|
|
563
|
-
o && (!o.disabled &&
|
|
563
|
+
o && (!o.disabled && F(a, t, dt(i, o)), c = be(o.ref) && T(i) ? "" : i, ot(o.ref) ? [...o.ref.options].forEach((h) => h.selected = c.includes(h.value)) : o.refs ? ge(o.ref) ? o.refs.length > 1 ? o.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(c) ? !!c.find((x) => x === h.value) : c === h.value)) : o.refs[0] && (o.refs[0].checked = !!c) : o.refs.forEach((h) => h.checked = h.value === c) : Me(o.ref) ? o.ref.value = "" : (o.ref.value = c, o.ref.type || _.values.next({
|
|
564
564
|
name: t,
|
|
565
565
|
values: { ...a }
|
|
566
566
|
})));
|
|
567
567
|
}
|
|
568
|
-
(l.shouldDirty || l.shouldTouch) &&
|
|
569
|
-
},
|
|
568
|
+
(l.shouldDirty || l.shouldTouch) && Q(t, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && de(t);
|
|
569
|
+
}, z = (t, i, l) => {
|
|
570
570
|
for (const f in i) {
|
|
571
571
|
const c = i[f], o = `${t}.${f}`, h = d(n, o);
|
|
572
|
-
(g.array.has(t) || !Ve(c) || h && !h._f) && !oe(c) ?
|
|
572
|
+
(g.array.has(t) || !Ve(c) || h && !h._f) && !oe(c) ? z(o, c, l) : E(o, c, l);
|
|
573
573
|
}
|
|
574
574
|
}, I = (t, i, l = {}) => {
|
|
575
575
|
const f = d(n, t), c = g.array.has(t), o = P(i);
|
|
576
|
-
|
|
576
|
+
F(a, t, o), c ? (_.array.next({
|
|
577
577
|
name: t,
|
|
578
578
|
values: { ...a }
|
|
579
|
-
}), (
|
|
579
|
+
}), (A.isDirty || A.dirtyFields) && l.shouldDirty && _.state.next({
|
|
580
580
|
name: t,
|
|
581
581
|
dirtyFields: ve(u, a),
|
|
582
582
|
isDirty: v(t, o)
|
|
583
|
-
})) : f && !f._f && !T(o) ?
|
|
583
|
+
})) : f && !f._f && !T(o) ? z(t, o, l) : E(t, o, l), Xe(t, g) && _.state.next({ ...r }), _.values.next({
|
|
584
584
|
name: y.mount ? t : void 0,
|
|
585
585
|
values: { ...a }
|
|
586
586
|
});
|
|
@@ -593,23 +593,23 @@ function er(e = {}) {
|
|
|
593
593
|
};
|
|
594
594
|
if (c) {
|
|
595
595
|
let x, D;
|
|
596
|
-
const N = o(), ne = t.type === Je.BLUR || t.type === Je.FOCUS_OUT, _t = !Qt(c._f) && !s.resolver && !d(r.errors, l) && !c._f.deps || Xt(ne, d(r.touchedFields, l), r.isSubmitted,
|
|
597
|
-
|
|
598
|
-
const ke =
|
|
596
|
+
const N = o(), ne = t.type === Je.BLUR || t.type === Je.FOCUS_OUT, _t = !Qt(c._f) && !s.resolver && !d(r.errors, l) && !c._f.deps || Xt(ne, d(r.touchedFields, l), r.isSubmitted, j, ie), De = Xe(l, g, ne);
|
|
597
|
+
F(a, l, N), ne ? (c._f.onBlur && c._f.onBlur(t), R && R(0)) : c._f.onChange && c._f.onChange(t);
|
|
598
|
+
const ke = Q(l, N, ne, !1), mt = !M(ke) || De;
|
|
599
599
|
if (!ne && _.values.next({
|
|
600
600
|
name: l,
|
|
601
601
|
type: t.type,
|
|
602
602
|
values: { ...a }
|
|
603
603
|
}), _t)
|
|
604
|
-
return
|
|
604
|
+
return A.isValid && B(), mt && _.state.next({ name: l, ...De ? {} : ke });
|
|
605
605
|
if (!ne && De && _.state.next({ ...r }), s.resolver) {
|
|
606
|
-
const { errors: $e } = await
|
|
606
|
+
const { errors: $e } = await X([l]);
|
|
607
607
|
if (h(N), f) {
|
|
608
608
|
const bt = st(r.errors, n, l), je = st($e, n, bt.name || l);
|
|
609
|
-
x = je.error, l = je.name, D =
|
|
609
|
+
x = je.error, l = je.name, D = M($e);
|
|
610
610
|
}
|
|
611
611
|
} else
|
|
612
|
-
|
|
612
|
+
K([l], !0), x = (await rt(c, a, C, s.shouldUseNativeValidation))[l], K([l]), h(N), f && (x ? D = !1 : A.isValid && (D = await L(n, !0)));
|
|
613
613
|
f && (c._f.deps && de(c._f.deps), le(l, D, x, ke));
|
|
614
614
|
}
|
|
615
615
|
}, fe = (t, i) => {
|
|
@@ -620,14 +620,14 @@ function er(e = {}) {
|
|
|
620
620
|
const c = _e(t);
|
|
621
621
|
if (s.resolver) {
|
|
622
622
|
const o = await Z(p(t) ? t : c);
|
|
623
|
-
l =
|
|
623
|
+
l = M(o), f = t ? !c.some((h) => d(o, h)) : l;
|
|
624
624
|
} else
|
|
625
625
|
t ? (f = (await Promise.all(c.map(async (o) => {
|
|
626
626
|
const h = d(n, o);
|
|
627
|
-
return await
|
|
628
|
-
}))).every(Boolean), !(!f && !r.isValid) &&
|
|
627
|
+
return await L(h && h._f ? { [o]: h } : h);
|
|
628
|
+
}))).every(Boolean), !(!f && !r.isValid) && B()) : f = l = await L(n);
|
|
629
629
|
return _.state.next({
|
|
630
|
-
...!
|
|
630
|
+
...!G(t) || A.isValid && l !== r.isValid ? {} : { name: t },
|
|
631
631
|
...s.resolver || !t ? { isValid: l } : {},
|
|
632
632
|
errors: r.errors
|
|
633
633
|
}), i.shouldFocus && !f && he(n, fe, t ? c : g.mount), f;
|
|
@@ -635,7 +635,7 @@ function er(e = {}) {
|
|
|
635
635
|
const i = {
|
|
636
636
|
...y.mount ? a : u
|
|
637
637
|
};
|
|
638
|
-
return p(t) ? i :
|
|
638
|
+
return p(t) ? i : G(t) ? d(i, t) : t.map((l) => d(i, l));
|
|
639
639
|
}, Ue = (t, i) => ({
|
|
640
640
|
invalid: !!d((i || r).errors, t),
|
|
641
641
|
isDirty: !!d((i || r).dirtyFields, t),
|
|
@@ -643,12 +643,12 @@ function er(e = {}) {
|
|
|
643
643
|
isValidating: !!d(r.validatingFields, t),
|
|
644
644
|
isTouched: !!d((i || r).touchedFields, t)
|
|
645
645
|
}), yt = (t) => {
|
|
646
|
-
t && _e(t).forEach((i) =>
|
|
646
|
+
t && _e(t).forEach((i) => k(r.errors, i)), _.state.next({
|
|
647
647
|
errors: t ? r.errors : {}
|
|
648
648
|
});
|
|
649
649
|
}, qe = (t, i, l) => {
|
|
650
650
|
const f = (d(n, t, { _f: {} })._f || {}).ref, c = d(r.errors, t) || {}, { ref: o, message: h, type: x, ...D } = c;
|
|
651
|
-
|
|
651
|
+
F(r.errors, t, {
|
|
652
652
|
...D,
|
|
653
653
|
...i,
|
|
654
654
|
ref: f
|
|
@@ -661,22 +661,22 @@ function er(e = {}) {
|
|
|
661
661
|
next: (l) => t(b(void 0, i), l)
|
|
662
662
|
}) : b(t, i, !0), we = (t, i = {}) => {
|
|
663
663
|
for (const l of t ? _e(t) : g.mount)
|
|
664
|
-
g.mount.delete(l), g.array.delete(l), i.keepValue || (
|
|
664
|
+
g.mount.delete(l), g.array.delete(l), i.keepValue || (k(n, l), k(a, l)), !i.keepError && k(r.errors, l), !i.keepDirty && k(r.dirtyFields, l), !i.keepTouched && k(r.touchedFields, l), !i.keepIsValidating && k(r.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && k(u, l);
|
|
665
665
|
_.values.next({
|
|
666
666
|
values: { ...a }
|
|
667
667
|
}), _.state.next({
|
|
668
668
|
...r,
|
|
669
669
|
...i.keepDirty ? { isDirty: v() } : {}
|
|
670
|
-
}), !i.keepIsValid &&
|
|
670
|
+
}), !i.keepIsValid && B();
|
|
671
671
|
}, Ie = ({ disabled: t, name: i, field: l, fields: f, value: c }) => {
|
|
672
672
|
if (te(t) && y.mount || t) {
|
|
673
673
|
const o = t ? void 0 : p(c) ? Te(l ? l._f : d(f, i)._f) : c;
|
|
674
|
-
|
|
674
|
+
F(a, i, o), Q(i, o, !1, !1, !0);
|
|
675
675
|
}
|
|
676
676
|
}, pe = (t, i = {}) => {
|
|
677
677
|
let l = d(n, t);
|
|
678
678
|
const f = te(i.disabled);
|
|
679
|
-
return
|
|
679
|
+
return F(n, t, {
|
|
680
680
|
...l || {},
|
|
681
681
|
_f: {
|
|
682
682
|
...l && l._f ? l._f : { ref: { name: t } },
|
|
@@ -689,7 +689,7 @@ function er(e = {}) {
|
|
|
689
689
|
disabled: i.disabled,
|
|
690
690
|
name: t,
|
|
691
691
|
value: i.value
|
|
692
|
-
}) :
|
|
692
|
+
}) : V(t, !0, i.value), {
|
|
693
693
|
...f ? { disabled: i.disabled } : {},
|
|
694
694
|
...s.progressive ? {
|
|
695
695
|
required: !!i.required,
|
|
@@ -708,7 +708,7 @@ function er(e = {}) {
|
|
|
708
708
|
const o = p(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h = Gt(o), x = l._f.refs || [];
|
|
709
709
|
if (h ? x.find((D) => D === o) : o === l._f.ref)
|
|
710
710
|
return;
|
|
711
|
-
|
|
711
|
+
F(n, t, {
|
|
712
712
|
_f: {
|
|
713
713
|
...l._f,
|
|
714
714
|
...h ? {
|
|
@@ -720,7 +720,7 @@ function er(e = {}) {
|
|
|
720
720
|
ref: { type: o.type, name: t }
|
|
721
721
|
} : { ref: o }
|
|
722
722
|
}
|
|
723
|
-
}),
|
|
723
|
+
}), V(t, !1, void 0, o);
|
|
724
724
|
} else
|
|
725
725
|
l = d(n, t, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(Ut(g.array, t) && y.action) && g.unMount.add(t);
|
|
726
726
|
}
|
|
@@ -739,11 +739,11 @@ function er(e = {}) {
|
|
|
739
739
|
if (_.state.next({
|
|
740
740
|
isSubmitting: !0
|
|
741
741
|
}), s.resolver) {
|
|
742
|
-
const { errors: o, values: h } = await
|
|
742
|
+
const { errors: o, values: h } = await X();
|
|
743
743
|
r.errors = o, c = h;
|
|
744
744
|
} else
|
|
745
|
-
await
|
|
746
|
-
if (
|
|
745
|
+
await L(n);
|
|
746
|
+
if (k(r.errors, "root"), M(r.errors)) {
|
|
747
747
|
_.state.next({
|
|
748
748
|
errors: {}
|
|
749
749
|
});
|
|
@@ -757,19 +757,19 @@ function er(e = {}) {
|
|
|
757
757
|
if (_.state.next({
|
|
758
758
|
isSubmitted: !0,
|
|
759
759
|
isSubmitting: !1,
|
|
760
|
-
isSubmitSuccessful:
|
|
760
|
+
isSubmitSuccessful: M(r.errors) && !f,
|
|
761
761
|
submitCount: r.submitCount + 1,
|
|
762
762
|
errors: r.errors
|
|
763
763
|
}), f)
|
|
764
764
|
throw f;
|
|
765
765
|
}, vt = (t, i = {}) => {
|
|
766
|
-
d(n, t) && (p(i.defaultValue) ? I(t, P(d(u, t))) : (I(t, i.defaultValue),
|
|
766
|
+
d(n, t) && (p(i.defaultValue) ? I(t, P(d(u, t))) : (I(t, i.defaultValue), F(u, t, P(i.defaultValue))), i.keepTouched || k(r.touchedFields, t), i.keepDirty || (k(r.dirtyFields, t), r.isDirty = i.defaultValue ? v(t, P(d(u, t))) : v()), i.keepError || (k(r.errors, t), A.isValid && B()), _.state.next({ ...r }));
|
|
767
767
|
}, He = (t, i = {}) => {
|
|
768
|
-
const l = t ? P(t) : u, f = P(l), c =
|
|
768
|
+
const l = t ? P(t) : u, f = P(l), c = M(t), o = c ? u : f;
|
|
769
769
|
if (i.keepDefaultValues || (u = l), !i.keepValues) {
|
|
770
770
|
if (i.keepDirtyValues)
|
|
771
771
|
for (const h of g.mount)
|
|
772
|
-
d(r.dirtyFields, h) ?
|
|
772
|
+
d(r.dirtyFields, h) ? F(o, h, d(a, h)) : I(h, d(o, h));
|
|
773
773
|
else {
|
|
774
774
|
if (Re && p(t))
|
|
775
775
|
for (const h of g.mount) {
|
|
@@ -800,7 +800,7 @@ function er(e = {}) {
|
|
|
800
800
|
watch: /* @__PURE__ */ new Set(),
|
|
801
801
|
watchAll: !1,
|
|
802
802
|
focus: ""
|
|
803
|
-
}, y.mount = !
|
|
803
|
+
}, y.mount = !A.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, _.state.next({
|
|
804
804
|
submitCount: i.keepSubmitCount ? r.submitCount : 0,
|
|
805
805
|
isDirty: c ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !se(t, u)),
|
|
806
806
|
isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
|
|
@@ -818,10 +818,10 @@ function er(e = {}) {
|
|
|
818
818
|
getFieldState: Ue,
|
|
819
819
|
handleSubmit: We,
|
|
820
820
|
setError: qe,
|
|
821
|
-
_executeSchema:
|
|
821
|
+
_executeSchema: X,
|
|
822
822
|
_getWatch: b,
|
|
823
823
|
_getDirty: v,
|
|
824
|
-
_updateValid:
|
|
824
|
+
_updateValid: B,
|
|
825
825
|
_removeUnmounted: ae,
|
|
826
826
|
_updateFieldArray: m,
|
|
827
827
|
_updateDisabledField: Ie,
|
|
@@ -840,8 +840,8 @@ function er(e = {}) {
|
|
|
840
840
|
},
|
|
841
841
|
_disableForm: gt,
|
|
842
842
|
_subjects: _,
|
|
843
|
-
_proxyFormState:
|
|
844
|
-
_setErrors:
|
|
843
|
+
_proxyFormState: A,
|
|
844
|
+
_setErrors: O,
|
|
845
845
|
get _fields() {
|
|
846
846
|
return n;
|
|
847
847
|
},
|
|
@@ -953,33 +953,34 @@ const it = `Я принимаю условия Политики обработк
|
|
|
953
953
|
setIsFormOpen: s,
|
|
954
954
|
title: r,
|
|
955
955
|
isEmail: n,
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
956
|
+
isPhone: u,
|
|
957
|
+
isTextArea: a,
|
|
958
|
+
isRequiredPhone: y = !0,
|
|
959
|
+
isRequiredEmail: g = !1,
|
|
960
|
+
isRequiredPhoneOrEmail: R,
|
|
961
|
+
textAreaPlaceholder: q,
|
|
962
|
+
subTitle: A,
|
|
963
|
+
submitHandler: _,
|
|
964
|
+
modalWidth: ie = "442px",
|
|
965
|
+
rowsTextArea: j = 2,
|
|
966
|
+
personalCheckBox: C = { text: it, isRequired: !0 },
|
|
967
|
+
advCheckBox: J = { text: it, isRequired: !0 }
|
|
967
968
|
}) => {
|
|
968
969
|
const {
|
|
969
|
-
register:
|
|
970
|
+
register: B,
|
|
970
971
|
handleSubmit: K,
|
|
971
|
-
trigger:
|
|
972
|
-
reset:
|
|
972
|
+
trigger: m,
|
|
973
|
+
reset: H,
|
|
973
974
|
watch: O,
|
|
974
|
-
formState: { errors:
|
|
975
|
-
} = tr(),
|
|
976
|
-
required:
|
|
975
|
+
formState: { errors: V }
|
|
976
|
+
} = tr(), Q = !!O("email"), { onChange: le, onBlur: X, ...Z } = B("phone", {
|
|
977
|
+
required: y || R ? !Q : !0,
|
|
977
978
|
pattern: { value: wt, message: "" },
|
|
978
|
-
onBlur: () =>
|
|
979
|
-
}), { isMobile:
|
|
980
|
-
|
|
979
|
+
onBlur: () => m("phone")
|
|
980
|
+
}), { isMobile: L, currentClientWidth: ae } = St(), v = O("personalCheckBox"), b = O("advCheckBox"), w = (E) => {
|
|
981
|
+
_(E), H();
|
|
981
982
|
};
|
|
982
|
-
return
|
|
983
|
+
return ae ? /* @__PURE__ */ U(
|
|
983
984
|
Vt,
|
|
984
985
|
{
|
|
985
986
|
isOpen: e,
|
|
@@ -988,136 +989,148 @@ const it = `Я принимаю условия Политики обработк
|
|
|
988
989
|
opacity: 0.7,
|
|
989
990
|
isTransparentBack: !0,
|
|
990
991
|
additionalClassModalBody: ee.modalBody,
|
|
991
|
-
children: /* @__PURE__ */ Se(
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
{
|
|
996
|
-
|
|
997
|
-
dangerouslySetInnerHTML: { __html: q ?? "Оставьте номер телефона для получения консультации" }
|
|
998
|
-
}
|
|
999
|
-
),
|
|
1000
|
-
/* @__PURE__ */ Se("form", { onSubmit: K(b), children: [
|
|
1001
|
-
/* @__PURE__ */ Se(Ft, { className: ee.inputWrapper, children: [
|
|
992
|
+
children: /* @__PURE__ */ Se(
|
|
993
|
+
"div",
|
|
994
|
+
{
|
|
995
|
+
className: ee.root,
|
|
996
|
+
style: { width: L ? "100%" : ie },
|
|
997
|
+
children: [
|
|
1002
998
|
/* @__PURE__ */ U(
|
|
1003
|
-
|
|
999
|
+
"div",
|
|
1004
1000
|
{
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
variant: "light",
|
|
1008
|
-
placeholder: "Введите имя",
|
|
1009
|
-
"data-testid": "modal_name",
|
|
1010
|
-
...z("name", { required: !0, pattern: pt }),
|
|
1011
|
-
error: !!B.name
|
|
1001
|
+
className: ee.title,
|
|
1002
|
+
dangerouslySetInnerHTML: { __html: r ?? "Оставить обращение" }
|
|
1012
1003
|
}
|
|
1013
1004
|
),
|
|
1014
1005
|
/* @__PURE__ */ U(
|
|
1015
|
-
|
|
1006
|
+
"div",
|
|
1016
1007
|
{
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1008
|
+
className: ee.description,
|
|
1009
|
+
dangerouslySetInnerHTML: {
|
|
1010
|
+
__html: A ?? "Оставьте номер телефона для получения консультации"
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
),
|
|
1014
|
+
/* @__PURE__ */ Se("form", { onSubmit: K(w), children: [
|
|
1015
|
+
/* @__PURE__ */ Se(Ft, { className: ee.inputWrapper, children: [
|
|
1016
|
+
/* @__PURE__ */ U(
|
|
1024
1017
|
Ee,
|
|
1025
1018
|
{
|
|
1026
1019
|
width: "full",
|
|
1027
|
-
"data-testid": "phone_modal",
|
|
1028
|
-
type: "tel",
|
|
1029
1020
|
size_s: "small",
|
|
1030
1021
|
variant: "light",
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1022
|
+
placeholder: "Введите имя",
|
|
1023
|
+
"data-testid": "modal_name",
|
|
1024
|
+
...B("name", { required: !0, pattern: pt }),
|
|
1025
|
+
error: !!V.name
|
|
1034
1026
|
}
|
|
1035
|
-
)
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
n && /* @__PURE__ */ U(
|
|
1039
|
-
Ee,
|
|
1040
|
-
{
|
|
1041
|
-
width: "full",
|
|
1042
|
-
size_s: "small",
|
|
1043
|
-
variant: "light",
|
|
1044
|
-
placeholder: "Введите email",
|
|
1045
|
-
"data-testid": "modal_email",
|
|
1046
|
-
...z(
|
|
1047
|
-
"email",
|
|
1027
|
+
),
|
|
1028
|
+
u && /* @__PURE__ */ U(
|
|
1029
|
+
xt,
|
|
1048
1030
|
{
|
|
1049
|
-
|
|
1050
|
-
|
|
1031
|
+
inputMode: "numeric",
|
|
1032
|
+
name: "phone",
|
|
1033
|
+
mask: "+7 (999) 999-99-99",
|
|
1034
|
+
onChange: le,
|
|
1035
|
+
placeholder: "+7 (- - -) - - - - - - -",
|
|
1036
|
+
onBlur: X,
|
|
1037
|
+
children: /* @__PURE__ */ U(
|
|
1038
|
+
Ee,
|
|
1039
|
+
{
|
|
1040
|
+
width: "full",
|
|
1041
|
+
"data-testid": "phone_modal",
|
|
1042
|
+
type: "tel",
|
|
1043
|
+
size_s: "small",
|
|
1044
|
+
variant: "light",
|
|
1045
|
+
...Z,
|
|
1046
|
+
...B("phone"),
|
|
1047
|
+
error: !!V.phone
|
|
1048
|
+
}
|
|
1049
|
+
)
|
|
1051
1050
|
}
|
|
1052
1051
|
),
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1052
|
+
n && /* @__PURE__ */ U(
|
|
1053
|
+
Ee,
|
|
1054
|
+
{
|
|
1055
|
+
width: "full",
|
|
1056
|
+
size_s: "small",
|
|
1057
|
+
variant: "light",
|
|
1058
|
+
placeholder: "Введите email",
|
|
1059
|
+
"data-testid": "modal_email",
|
|
1060
|
+
...B("email", {
|
|
1061
|
+
required: g || R ? Q : !1,
|
|
1062
|
+
pattern: Dt
|
|
1063
|
+
}),
|
|
1064
|
+
error: !!V.email
|
|
1065
|
+
}
|
|
1066
|
+
),
|
|
1067
|
+
a && /* @__PURE__ */ U(
|
|
1068
|
+
kt,
|
|
1069
|
+
{
|
|
1070
|
+
"data-testid": "modal_textarea",
|
|
1071
|
+
placeholder: q,
|
|
1072
|
+
rows: j,
|
|
1073
|
+
width: "full",
|
|
1074
|
+
...B("textarea")
|
|
1075
|
+
}
|
|
1076
|
+
),
|
|
1077
|
+
J && /* @__PURE__ */ U(
|
|
1078
|
+
Ge,
|
|
1079
|
+
{
|
|
1080
|
+
"data-testid": "modal_advCheckBox",
|
|
1081
|
+
isChecked: b,
|
|
1082
|
+
error: !!V.advCheckBox,
|
|
1083
|
+
text: J.text,
|
|
1084
|
+
...B("advCheckBox", { required: J == null ? void 0 : J.isRequired })
|
|
1085
|
+
}
|
|
1086
|
+
),
|
|
1087
|
+
/* @__PURE__ */ U(
|
|
1088
|
+
Ge,
|
|
1089
|
+
{
|
|
1090
|
+
"data-testid": "modal_personalCheckBox",
|
|
1091
|
+
isChecked: v,
|
|
1092
|
+
error: !!V.personalCheckBox,
|
|
1093
|
+
text: C.text,
|
|
1094
|
+
...B("personalCheckBox", { required: C.isRequired })
|
|
1095
|
+
}
|
|
1096
|
+
),
|
|
1097
|
+
/* @__PURE__ */ U(
|
|
1098
|
+
Ke,
|
|
1099
|
+
{
|
|
1100
|
+
"data-testid": "modal_submit",
|
|
1101
|
+
variant: "blue",
|
|
1102
|
+
width: "full",
|
|
1103
|
+
type: "submit",
|
|
1104
|
+
size: "large",
|
|
1105
|
+
as: "button",
|
|
1106
|
+
additionalClass: ee.modalBtn,
|
|
1107
|
+
children: "Отправить"
|
|
1108
|
+
}
|
|
1109
|
+
)
|
|
1110
|
+
] }),
|
|
1111
|
+
/* @__PURE__ */ U(
|
|
1112
|
+
Ke,
|
|
1111
1113
|
{
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1114
|
+
additionalClass: ee.btn,
|
|
1115
|
+
onClick: () => s(!1),
|
|
1116
|
+
as: "button",
|
|
1117
|
+
variant: "gray",
|
|
1118
|
+
type: "button",
|
|
1119
|
+
size: "small",
|
|
1120
|
+
children: /* @__PURE__ */ U(
|
|
1121
|
+
At,
|
|
1122
|
+
{
|
|
1123
|
+
name: "close",
|
|
1124
|
+
size: "16",
|
|
1125
|
+
color: "#141416"
|
|
1126
|
+
}
|
|
1127
|
+
)
|
|
1115
1128
|
}
|
|
1116
1129
|
)
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1130
|
+
] })
|
|
1131
|
+
]
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1121
1134
|
}
|
|
1122
1135
|
) : null;
|
|
1123
1136
|
};
|