stone-kit 0.0.444 → 0.0.447
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.
|
@@ -19,6 +19,7 @@ interface IModalFormProps {
|
|
|
19
19
|
isNews?: boolean;
|
|
20
20
|
isRequiredEmail?: boolean;
|
|
21
21
|
isRequiredPhoneOrEmail?: boolean;
|
|
22
|
+
isAdvCheckBox?: boolean;
|
|
22
23
|
}
|
|
23
24
|
type IFormPageInputs = {
|
|
24
25
|
phone: string;
|
|
@@ -28,5 +29,5 @@ type IFormPageInputs = {
|
|
|
28
29
|
advCheckBox?: boolean;
|
|
29
30
|
textarea?: string;
|
|
30
31
|
};
|
|
31
|
-
export declare const ModalForm: ({ isFormOpen, setIsFormOpen, isNews, title, isEmail, isPhone, isTextArea, telegramLink, isRequiredPhone, isRequiredEmail, isRequiredPhoneOrEmail, textAreaPlaceholder, subTitle, submitHandler, modalWidth, rowsTextArea, advCheckBox, }: IModalFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
32
|
+
export declare const ModalForm: ({ isFormOpen, setIsFormOpen, isNews, title, isEmail, isPhone, isTextArea, telegramLink, isRequiredPhone, isRequiredEmail, isRequiredPhoneOrEmail, textAreaPlaceholder, subTitle, submitHandler, modalWidth, rowsTextArea, advCheckBox, isAdvCheckBox, }: IModalFormProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
32
33
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as D, jsxs as
|
|
1
|
+
import { jsx as D, jsxs as re } from "react/jsx-runtime";
|
|
2
2
|
import { I as xr } from "../../../index-BaVdWc7x.js";
|
|
3
3
|
import { M as Vr } from "../../../Modal-DbD1tgiF.js";
|
|
4
4
|
import { Flex as Fr } from "../../Flex/ui/Flex.js";
|
|
5
5
|
import { Input as Ee } from "../../Input/ui/Input.js";
|
|
6
|
-
import
|
|
6
|
+
import z from "react";
|
|
7
7
|
import { Button as Ke } from "../../Button/ui/Button.js";
|
|
8
8
|
import { NewIcon as Ge } from "../../NewIcon/ui/NewIcon.js";
|
|
9
9
|
import { phoneReg as pr, nameReg as Ar, emailReg as kr } from "../utils/reg.js";
|
|
@@ -24,13 +24,13 @@ const Sr = "_btn_7n08v_1", Er = "_modal_7n08v_9", Tr = "_modalBody_7n08v_16", Br
|
|
|
24
24
|
telegram: Ur,
|
|
25
25
|
orText: Ir
|
|
26
26
|
};
|
|
27
|
-
var ve = (e) => e.type === "checkbox", ue = (e) => e instanceof Date,
|
|
27
|
+
var ve = (e) => e.type === "checkbox", ue = (e) => e instanceof Date, R = (e) => e == null;
|
|
28
28
|
const lr = (e) => typeof e == "object";
|
|
29
|
-
var E = (e) => !
|
|
29
|
+
var E = (e) => !R(e) && !Array.isArray(e) && lr(e) && !ue(e), Pr = (e) => E(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, Wr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, qr = (e, s) => e.has(Wr(s)), Hr = (e) => {
|
|
30
30
|
const s = e.constructor && e.constructor.prototype;
|
|
31
31
|
return E(s) && s.hasOwnProperty("isPrototypeOf");
|
|
32
32
|
}, Le = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
33
|
-
function
|
|
33
|
+
function H(e) {
|
|
34
34
|
let s;
|
|
35
35
|
const t = Array.isArray(e);
|
|
36
36
|
if (e instanceof Date)
|
|
@@ -42,7 +42,7 @@ function z(e) {
|
|
|
42
42
|
s = e;
|
|
43
43
|
else
|
|
44
44
|
for (const n in e)
|
|
45
|
-
e.hasOwnProperty(n) && (s[n] =
|
|
45
|
+
e.hasOwnProperty(n) && (s[n] = H(e[n]));
|
|
46
46
|
else
|
|
47
47
|
return e;
|
|
48
48
|
return s;
|
|
@@ -50,17 +50,17 @@ function z(e) {
|
|
|
50
50
|
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], k = (e) => e === void 0, f = (e, s, t) => {
|
|
51
51
|
if (!s || !E(e))
|
|
52
52
|
return t;
|
|
53
|
-
const n = Ae(s.split(/[,[\].]+?/)).reduce((o, a) =>
|
|
53
|
+
const n = Ae(s.split(/[,[\].]+?/)).reduce((o, a) => R(o) ? o : o[a], e);
|
|
54
54
|
return k(n) || n === e ? k(e[s]) ? t : e[s] : n;
|
|
55
|
-
},
|
|
55
|
+
}, te = (e) => typeof e == "boolean", Re = (e) => /^\w*$/.test(e), ar = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, s, t) => {
|
|
56
56
|
let n = -1;
|
|
57
57
|
const o = Re(s) ? [s] : ar(s), a = o.length, y = a - 1;
|
|
58
58
|
for (; ++n < a; ) {
|
|
59
59
|
const g = o[n];
|
|
60
60
|
let P = t;
|
|
61
61
|
if (n !== y) {
|
|
62
|
-
const
|
|
63
|
-
P = E(
|
|
62
|
+
const M = e[g];
|
|
63
|
+
P = E(M) || Array.isArray(M) ? M : isNaN(+o[n + 1]) ? {} : [];
|
|
64
64
|
}
|
|
65
65
|
if (g === "__proto__")
|
|
66
66
|
return;
|
|
@@ -72,13 +72,13 @@ const Qe = {
|
|
|
72
72
|
BLUR: "blur",
|
|
73
73
|
FOCUS_OUT: "focusout",
|
|
74
74
|
CHANGE: "change"
|
|
75
|
-
},
|
|
75
|
+
}, K = {
|
|
76
76
|
onBlur: "onBlur",
|
|
77
77
|
onChange: "onChange",
|
|
78
78
|
onSubmit: "onSubmit",
|
|
79
79
|
onTouched: "onTouched",
|
|
80
80
|
all: "all"
|
|
81
|
-
},
|
|
81
|
+
}, Z = {
|
|
82
82
|
max: "max",
|
|
83
83
|
min: "min",
|
|
84
84
|
maxLength: "maxLength",
|
|
@@ -87,7 +87,7 @@ const Qe = {
|
|
|
87
87
|
required: "required",
|
|
88
88
|
validate: "validate"
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
z.createContext(null);
|
|
91
91
|
var zr = (e, s, t, n = !0) => {
|
|
92
92
|
const o = {
|
|
93
93
|
defaultValues: s._defaultValues
|
|
@@ -96,18 +96,18 @@ var zr = (e, s, t, n = !0) => {
|
|
|
96
96
|
Object.defineProperty(o, a, {
|
|
97
97
|
get: () => {
|
|
98
98
|
const y = a;
|
|
99
|
-
return s._proxyFormState[y] !==
|
|
99
|
+
return s._proxyFormState[y] !== K.all && (s._proxyFormState[y] = !n || K.all), e[y];
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
return o;
|
|
103
103
|
}, I = (e) => E(e) && !Object.keys(e).length, $r = (e, s, t, n) => {
|
|
104
104
|
t(e);
|
|
105
105
|
const { name: o, ...a } = e;
|
|
106
|
-
return I(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] ===
|
|
106
|
+
return I(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === K.all);
|
|
107
107
|
}, me = (e) => Array.isArray(e) ? e : [e];
|
|
108
108
|
function jr(e) {
|
|
109
|
-
const s =
|
|
110
|
-
s.current = e,
|
|
109
|
+
const s = z.useRef(e);
|
|
110
|
+
s.current = e, z.useEffect(() => {
|
|
111
111
|
const t = !e.disabled && s.current.subject && s.current.subject.subscribe({
|
|
112
112
|
next: s.current.next
|
|
113
113
|
});
|
|
@@ -116,18 +116,18 @@ function jr(e) {
|
|
|
116
116
|
};
|
|
117
117
|
}, [e.disabled]);
|
|
118
118
|
}
|
|
119
|
-
var
|
|
119
|
+
var Y = (e) => typeof e == "string", Kr = (e, s, t, n, o) => Y(e) ? (n && s.watch.add(e), f(t, e, o)) : Array.isArray(e) ? e.map((a) => (n && s.watch.add(a), f(t, a))) : (n && (s.watchAll = !0), t), Gr = (e, s, t, n, o) => s ? {
|
|
120
120
|
...t[e],
|
|
121
121
|
types: {
|
|
122
122
|
...t[e] && t[e].types ? t[e].types : {},
|
|
123
123
|
[n]: o || !0
|
|
124
124
|
}
|
|
125
125
|
} : {}, Xe = (e) => ({
|
|
126
|
-
isOnSubmit: !e || e ===
|
|
127
|
-
isOnBlur: e ===
|
|
128
|
-
isOnChange: e ===
|
|
129
|
-
isOnAll: e ===
|
|
130
|
-
isOnTouch: e ===
|
|
126
|
+
isOnSubmit: !e || e === K.onSubmit,
|
|
127
|
+
isOnBlur: e === K.onBlur,
|
|
128
|
+
isOnChange: e === K.onChange,
|
|
129
|
+
isOnAll: e === K.all,
|
|
130
|
+
isOnTouch: e === K.onTouched
|
|
131
131
|
}), Ye = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
132
132
|
const ge = (e, s, t, n) => {
|
|
133
133
|
for (const o of t || Object.keys(e)) {
|
|
@@ -148,12 +148,12 @@ const ge = (e, s, t, n) => {
|
|
|
148
148
|
var Jr = (e, s, t) => {
|
|
149
149
|
const n = me(f(e, t));
|
|
150
150
|
return V(n, "root", s[t]), V(e, t, n), e;
|
|
151
|
-
}, Me = (e) => e.type === "file",
|
|
151
|
+
}, Me = (e) => e.type === "file", se = (e) => typeof e == "function", xe = (e) => {
|
|
152
152
|
if (!Le)
|
|
153
153
|
return !1;
|
|
154
154
|
const s = e ? e.ownerDocument : 0;
|
|
155
155
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
156
|
-
}, be = (e) =>
|
|
156
|
+
}, be = (e) => Y(e), Oe = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
|
|
157
157
|
const Ze = {
|
|
158
158
|
value: !1,
|
|
159
159
|
isValid: !1
|
|
@@ -180,7 +180,7 @@ var or = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disab
|
|
|
180
180
|
value: t.value
|
|
181
181
|
} : s, rr) : rr;
|
|
182
182
|
function tr(e, s, t = "validate") {
|
|
183
|
-
if (be(e) || Array.isArray(e) && e.every(be) ||
|
|
183
|
+
if (be(e) || Array.isArray(e) && e.every(be) || te(e) && !e)
|
|
184
184
|
return {
|
|
185
185
|
type: t,
|
|
186
186
|
message: be(e) ? e : "",
|
|
@@ -191,85 +191,85 @@ var oe = (e) => E(e) && !Ve(e) ? e : {
|
|
|
191
191
|
value: e,
|
|
192
192
|
message: ""
|
|
193
193
|
}, sr = async (e, s, t, n, o) => {
|
|
194
|
-
const { ref: a, refs: y, required: g, maxLength: P, minLength:
|
|
195
|
-
if (!B ||
|
|
194
|
+
const { ref: a, refs: y, required: g, maxLength: P, minLength: M, min: F, max: m, pattern: le, validate: G, name: C, valueAsNumber: ce, mount: B, disabled: J } = e._f, v = f(s, C);
|
|
195
|
+
if (!B || J)
|
|
196
196
|
return {};
|
|
197
|
-
const
|
|
198
|
-
n &&
|
|
199
|
-
}, p = {},
|
|
200
|
-
const
|
|
201
|
-
p[
|
|
202
|
-
type:
|
|
203
|
-
message:
|
|
197
|
+
const $ = y ? y[0] : a, j = (_) => {
|
|
198
|
+
n && $.reportValidity && ($.setCustomValidity(te(_) ? "" : _ || ""), $.reportValidity());
|
|
199
|
+
}, p = {}, Q = Oe(a), L = ve(a), X = Q || L, ee = (ce || Me(a)) && k(a.value) && k(v) || xe(a) && a.value === "" || v === "" || Array.isArray(v) && !v.length, O = Gr.bind(null, C, t, p), ae = (_, b, A, T = Z.maxLength, W = Z.minLength) => {
|
|
200
|
+
const N = _ ? b : A;
|
|
201
|
+
p[C] = {
|
|
202
|
+
type: _ ? T : W,
|
|
203
|
+
message: N,
|
|
204
204
|
ref: a,
|
|
205
|
-
...
|
|
205
|
+
...O(_ ? T : W, N)
|
|
206
206
|
};
|
|
207
207
|
};
|
|
208
|
-
if (o ? !Array.isArray(
|
|
209
|
-
const { value:
|
|
210
|
-
if (
|
|
211
|
-
type:
|
|
208
|
+
if (o ? !Array.isArray(v) || !v.length : g && (!X && (ee || R(v)) || te(v) && !v || L && !nr(y).isValid || Q && !or(y).isValid)) {
|
|
209
|
+
const { value: _, message: b } = be(g) ? { value: !!g, message: g } : oe(g);
|
|
210
|
+
if (_ && (p[C] = {
|
|
211
|
+
type: Z.required,
|
|
212
212
|
message: b,
|
|
213
|
-
ref:
|
|
214
|
-
...
|
|
213
|
+
ref: $,
|
|
214
|
+
...O(Z.required, b)
|
|
215
215
|
}, !t))
|
|
216
|
-
return
|
|
216
|
+
return j(b), p;
|
|
217
217
|
}
|
|
218
|
-
if (!
|
|
219
|
-
let
|
|
220
|
-
const A = oe(
|
|
221
|
-
if (!
|
|
222
|
-
const W = a.valueAsNumber ||
|
|
223
|
-
|
|
218
|
+
if (!ee && (!R(F) || !R(m))) {
|
|
219
|
+
let _, b;
|
|
220
|
+
const A = oe(m), T = oe(F);
|
|
221
|
+
if (!R(v) && !isNaN(v)) {
|
|
222
|
+
const W = a.valueAsNumber || v && +v;
|
|
223
|
+
R(A.value) || (_ = W > A.value), R(T.value) || (b = W < T.value);
|
|
224
224
|
} else {
|
|
225
|
-
const W = a.valueAsDate || new Date(
|
|
226
|
-
|
|
225
|
+
const W = a.valueAsDate || new Date(v), N = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), de = a.type == "time", fe = a.type == "week";
|
|
226
|
+
Y(A.value) && v && (_ = de ? N(v) > N(A.value) : fe ? v > A.value : W > new Date(A.value)), Y(T.value) && v && (b = de ? N(v) < N(T.value) : fe ? v < T.value : W < new Date(T.value));
|
|
227
227
|
}
|
|
228
|
-
if ((
|
|
229
|
-
return
|
|
228
|
+
if ((_ || b) && (ae(!!_, A.message, T.message, Z.max, Z.min), !t))
|
|
229
|
+
return j(p[C].message), p;
|
|
230
230
|
}
|
|
231
|
-
if ((P ||
|
|
232
|
-
const
|
|
233
|
-
if ((A || T) && (ae(A,
|
|
234
|
-
return
|
|
231
|
+
if ((P || M) && !ee && (Y(v) || o && Array.isArray(v))) {
|
|
232
|
+
const _ = oe(P), b = oe(M), A = !R(_.value) && v.length > +_.value, T = !R(b.value) && v.length < +b.value;
|
|
233
|
+
if ((A || T) && (ae(A, _.message, b.message), !t))
|
|
234
|
+
return j(p[C].message), p;
|
|
235
235
|
}
|
|
236
|
-
if (le && !
|
|
237
|
-
const { value:
|
|
238
|
-
if (Ve(
|
|
239
|
-
type:
|
|
236
|
+
if (le && !ee && Y(v)) {
|
|
237
|
+
const { value: _, message: b } = oe(le);
|
|
238
|
+
if (Ve(_) && !v.match(_) && (p[C] = {
|
|
239
|
+
type: Z.pattern,
|
|
240
240
|
message: b,
|
|
241
241
|
ref: a,
|
|
242
|
-
...
|
|
242
|
+
...O(Z.pattern, b)
|
|
243
243
|
}, !t))
|
|
244
|
-
return
|
|
244
|
+
return j(b), p;
|
|
245
245
|
}
|
|
246
|
-
if (
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
if (b && (p[
|
|
246
|
+
if (G) {
|
|
247
|
+
if (se(G)) {
|
|
248
|
+
const _ = await G(v, s), b = tr(_, $);
|
|
249
|
+
if (b && (p[C] = {
|
|
250
250
|
...b,
|
|
251
|
-
...
|
|
251
|
+
...O(Z.validate, b.message)
|
|
252
252
|
}, !t))
|
|
253
|
-
return
|
|
254
|
-
} else if (E(
|
|
255
|
-
let
|
|
256
|
-
for (const b in
|
|
257
|
-
if (!I(
|
|
253
|
+
return j(b.message), p;
|
|
254
|
+
} else if (E(G)) {
|
|
255
|
+
let _ = {};
|
|
256
|
+
for (const b in G) {
|
|
257
|
+
if (!I(_) && !t)
|
|
258
258
|
break;
|
|
259
|
-
const A = tr(await
|
|
260
|
-
A && (
|
|
259
|
+
const A = tr(await G[b](v, s), $, b);
|
|
260
|
+
A && (_ = {
|
|
261
261
|
...A,
|
|
262
|
-
...
|
|
263
|
-
},
|
|
262
|
+
...O(b, A.message)
|
|
263
|
+
}, j(A.message), t && (p[C] = _));
|
|
264
264
|
}
|
|
265
|
-
if (!I(
|
|
266
|
-
ref:
|
|
267
|
-
...
|
|
265
|
+
if (!I(_) && (p[C] = {
|
|
266
|
+
ref: $,
|
|
267
|
+
..._
|
|
268
268
|
}, !t))
|
|
269
269
|
return p;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
return
|
|
272
|
+
return j(!0), p;
|
|
273
273
|
};
|
|
274
274
|
function Qr(e, s) {
|
|
275
275
|
const t = s.slice(0, -1).length;
|
|
@@ -307,7 +307,7 @@ var Te = () => {
|
|
|
307
307
|
e = [];
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
|
-
}, Fe = (e) =>
|
|
310
|
+
}, Fe = (e) => R(e) || !lr(e);
|
|
311
311
|
function ie(e, s) {
|
|
312
312
|
if (Fe(e) || Fe(s))
|
|
313
313
|
return e === s;
|
|
@@ -330,7 +330,7 @@ function ie(e, s) {
|
|
|
330
330
|
}
|
|
331
331
|
var ur = (e) => e.type === "select-multiple", Yr = (e) => Oe(e) || ve(e), Be = (e) => xe(e) && e.isConnected, cr = (e) => {
|
|
332
332
|
for (const s in e)
|
|
333
|
-
if (
|
|
333
|
+
if (se(e[s]))
|
|
334
334
|
return !0;
|
|
335
335
|
return !1;
|
|
336
336
|
};
|
|
@@ -338,17 +338,17 @@ function pe(e, s = {}) {
|
|
|
338
338
|
const t = Array.isArray(e);
|
|
339
339
|
if (E(e) || t)
|
|
340
340
|
for (const n in e)
|
|
341
|
-
Array.isArray(e[n]) || E(e[n]) && !cr(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, pe(e[n], s[n])) :
|
|
341
|
+
Array.isArray(e[n]) || E(e[n]) && !cr(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, pe(e[n], s[n])) : R(e[n]) || (s[n] = !0);
|
|
342
342
|
return s;
|
|
343
343
|
}
|
|
344
344
|
function dr(e, s, t) {
|
|
345
345
|
const n = Array.isArray(e);
|
|
346
346
|
if (E(e) || n)
|
|
347
347
|
for (const o in e)
|
|
348
|
-
Array.isArray(e[o]) || E(e[o]) && !cr(e[o]) ? k(s) || Fe(t[o]) ? t[o] = Array.isArray(e[o]) ? pe(e[o], []) : { ...pe(e[o]) } : dr(e[o],
|
|
348
|
+
Array.isArray(e[o]) || E(e[o]) && !cr(e[o]) ? k(s) || Fe(t[o]) ? t[o] = Array.isArray(e[o]) ? pe(e[o], []) : { ...pe(e[o]) } : dr(e[o], R(s) ? {} : s[o], t[o]) : t[o] = !ie(e[o], s[o]);
|
|
349
349
|
return t;
|
|
350
350
|
}
|
|
351
|
-
var _e = (e, s) => dr(e, s, pe(s)), fr = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: n }) => k(e) ? e : s ? e === "" ? NaN : e && +e : t &&
|
|
351
|
+
var _e = (e, s) => dr(e, s, pe(s)), fr = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: n }) => k(e) ? e : s ? e === "" ? NaN : e && +e : t && Y(e) ? new Date(e) : n ? n(e) : e;
|
|
352
352
|
function Ce(e) {
|
|
353
353
|
const s = e.ref;
|
|
354
354
|
if (!(e.refs ? e.refs.every((t) => t.disabled) : s.disabled))
|
|
@@ -392,8 +392,8 @@ function ir(e, s, t) {
|
|
|
392
392
|
}
|
|
393
393
|
var rt = (e, s, t, n, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(s || e) : (t ? n.isOnBlur : o.isOnBlur) ? !e : (t ? n.isOnChange : o.isOnChange) ? e : !0, tt = (e, s) => !Ae(f(e, s)).length && S(e, s);
|
|
394
394
|
const st = {
|
|
395
|
-
mode:
|
|
396
|
-
reValidateMode:
|
|
395
|
+
mode: K.onSubmit,
|
|
396
|
+
reValidateMode: K.onChange,
|
|
397
397
|
shouldFocusError: !0
|
|
398
398
|
};
|
|
399
399
|
function it(e = {}) {
|
|
@@ -403,7 +403,7 @@ function it(e = {}) {
|
|
|
403
403
|
}, t = {
|
|
404
404
|
submitCount: 0,
|
|
405
405
|
isDirty: !1,
|
|
406
|
-
isLoading:
|
|
406
|
+
isLoading: se(s.defaultValues),
|
|
407
407
|
isValidating: !1,
|
|
408
408
|
isSubmitted: !1,
|
|
409
409
|
isSubmitting: !1,
|
|
@@ -414,7 +414,7 @@ function it(e = {}) {
|
|
|
414
414
|
validatingFields: {},
|
|
415
415
|
errors: s.errors || {},
|
|
416
416
|
disabled: s.disabled || !1
|
|
417
|
-
}, n = {}, o = E(s.defaultValues) || E(s.values) ?
|
|
417
|
+
}, n = {}, o = E(s.defaultValues) || E(s.values) ? H(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : H(o), y = {
|
|
418
418
|
action: !1,
|
|
419
419
|
mount: !1,
|
|
420
420
|
watch: !1
|
|
@@ -423,7 +423,7 @@ function it(e = {}) {
|
|
|
423
423
|
unMount: /* @__PURE__ */ new Set(),
|
|
424
424
|
array: /* @__PURE__ */ new Set(),
|
|
425
425
|
watch: /* @__PURE__ */ new Set()
|
|
426
|
-
}, P,
|
|
426
|
+
}, P, M = 0;
|
|
427
427
|
const F = {
|
|
428
428
|
isDirty: !1,
|
|
429
429
|
dirtyFields: !1,
|
|
@@ -432,27 +432,27 @@ function it(e = {}) {
|
|
|
432
432
|
isValidating: !1,
|
|
433
433
|
isValid: !1,
|
|
434
434
|
errors: !1
|
|
435
|
-
},
|
|
435
|
+
}, m = {
|
|
436
436
|
values: Te(),
|
|
437
437
|
array: Te(),
|
|
438
438
|
state: Te()
|
|
439
|
-
}, le = Xe(s.mode),
|
|
440
|
-
clearTimeout(
|
|
439
|
+
}, le = Xe(s.mode), G = Xe(s.reValidateMode), C = s.criteriaMode === K.all, ce = (r) => (i) => {
|
|
440
|
+
clearTimeout(M), M = setTimeout(r, i);
|
|
441
441
|
}, B = async (r) => {
|
|
442
442
|
if (F.isValid || r) {
|
|
443
|
-
const i = s.resolver ? I((await X()).errors) : await
|
|
444
|
-
i !== t.isValid &&
|
|
443
|
+
const i = s.resolver ? I((await X()).errors) : await O(n, !0);
|
|
444
|
+
i !== t.isValid && m.state.next({
|
|
445
445
|
isValid: i
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, J = (r, i) => {
|
|
449
449
|
(F.isValidating || F.validatingFields) && ((r || Array.from(g.mount)).forEach((l) => {
|
|
450
450
|
l && (i ? V(t.validatingFields, l, i) : S(t.validatingFields, l));
|
|
451
|
-
}),
|
|
451
|
+
}), m.state.next({
|
|
452
452
|
validatingFields: t.validatingFields,
|
|
453
453
|
isValidating: !I(t.validatingFields)
|
|
454
454
|
}));
|
|
455
|
-
},
|
|
455
|
+
}, v = (r, i = [], l, d, c = !0, u = !0) => {
|
|
456
456
|
if (d && l) {
|
|
457
457
|
if (y.action = !0, u && Array.isArray(f(n, r))) {
|
|
458
458
|
const h = l(f(n, r), d.argA, d.argB);
|
|
@@ -466,21 +466,21 @@ function it(e = {}) {
|
|
|
466
466
|
const h = l(f(t.touchedFields, r), d.argA, d.argB);
|
|
467
467
|
c && V(t.touchedFields, r, h);
|
|
468
468
|
}
|
|
469
|
-
F.dirtyFields && (t.dirtyFields = _e(o, a)),
|
|
469
|
+
F.dirtyFields && (t.dirtyFields = _e(o, a)), m.state.next({
|
|
470
470
|
name: r,
|
|
471
|
-
isDirty:
|
|
471
|
+
isDirty: _(r, i),
|
|
472
472
|
dirtyFields: t.dirtyFields,
|
|
473
473
|
errors: t.errors,
|
|
474
474
|
isValid: t.isValid
|
|
475
475
|
});
|
|
476
476
|
} else
|
|
477
477
|
V(a, r, i);
|
|
478
|
-
},
|
|
479
|
-
V(t.errors, r, i),
|
|
478
|
+
}, $ = (r, i) => {
|
|
479
|
+
V(t.errors, r, i), m.state.next({
|
|
480
480
|
errors: t.errors
|
|
481
481
|
});
|
|
482
|
-
},
|
|
483
|
-
t.errors = r,
|
|
482
|
+
}, j = (r) => {
|
|
483
|
+
t.errors = r, m.state.next({
|
|
484
484
|
errors: t.errors,
|
|
485
485
|
isValid: !1
|
|
486
486
|
});
|
|
@@ -490,13 +490,13 @@ function it(e = {}) {
|
|
|
490
490
|
const u = f(a, r, k(l) ? f(o, r) : l);
|
|
491
491
|
k(u) || d && d.defaultChecked || i ? V(a, r, i ? u : Ce(c._f)) : T(r, u), y.mount && B();
|
|
492
492
|
}
|
|
493
|
-
},
|
|
493
|
+
}, Q = (r, i, l, d, c) => {
|
|
494
494
|
let u = !1, h = !1;
|
|
495
495
|
const x = {
|
|
496
496
|
name: r
|
|
497
497
|
}, w = !!(f(n, r) && f(n, r)._f && f(n, r)._f.disabled);
|
|
498
498
|
if (!l || d) {
|
|
499
|
-
F.isDirty && (h = t.isDirty, t.isDirty = x.isDirty =
|
|
499
|
+
F.isDirty && (h = t.isDirty, t.isDirty = x.isDirty = _(), u = h !== x.isDirty);
|
|
500
500
|
const q = w || ie(f(o, r), i);
|
|
501
501
|
h = !!(!w && f(t.dirtyFields, r)), q || w ? S(t.dirtyFields, r) : V(t.dirtyFields, r, !0), x.dirtyFields = t.dirtyFields, u = u || F.dirtyFields && h !== !q;
|
|
502
502
|
}
|
|
@@ -504,26 +504,26 @@ function it(e = {}) {
|
|
|
504
504
|
const q = f(t.touchedFields, r);
|
|
505
505
|
q || (V(t.touchedFields, r, l), x.touchedFields = t.touchedFields, u = u || F.touchedFields && q !== l);
|
|
506
506
|
}
|
|
507
|
-
return u && c &&
|
|
508
|
-
},
|
|
509
|
-
const c = f(t.errors, r), u = F.isValid &&
|
|
510
|
-
if (e.delayError && l ? (P = ce(() =>
|
|
507
|
+
return u && c && m.state.next(x), u ? x : {};
|
|
508
|
+
}, L = (r, i, l, d) => {
|
|
509
|
+
const c = f(t.errors, r), u = F.isValid && te(i) && t.isValid !== i;
|
|
510
|
+
if (e.delayError && l ? (P = ce(() => $(r, l)), P(e.delayError)) : (clearTimeout(M), P = null, l ? V(t.errors, r, l) : S(t.errors, r)), (l ? !ie(c, l) : c) || !I(d) || u) {
|
|
511
511
|
const h = {
|
|
512
512
|
...d,
|
|
513
|
-
...u &&
|
|
513
|
+
...u && te(i) ? { isValid: i } : {},
|
|
514
514
|
errors: t.errors,
|
|
515
515
|
name: r
|
|
516
516
|
};
|
|
517
517
|
t = {
|
|
518
518
|
...t,
|
|
519
519
|
...h
|
|
520
|
-
},
|
|
520
|
+
}, m.state.next(h);
|
|
521
521
|
}
|
|
522
522
|
}, X = async (r) => {
|
|
523
|
-
|
|
523
|
+
J(r, !0);
|
|
524
524
|
const i = await s.resolver(a, s.context, Zr(r || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
|
|
525
|
-
return
|
|
526
|
-
},
|
|
525
|
+
return J(r), i;
|
|
526
|
+
}, ee = async (r) => {
|
|
527
527
|
const { errors: i } = await X(r);
|
|
528
528
|
if (r)
|
|
529
529
|
for (const l of r) {
|
|
@@ -533,7 +533,7 @@ function it(e = {}) {
|
|
|
533
533
|
else
|
|
534
534
|
t.errors = i;
|
|
535
535
|
return i;
|
|
536
|
-
},
|
|
536
|
+
}, O = async (r, i, l = {
|
|
537
537
|
valid: !0
|
|
538
538
|
}) => {
|
|
539
539
|
for (const d in r) {
|
|
@@ -542,13 +542,13 @@ function it(e = {}) {
|
|
|
542
542
|
const { _f: u, ...h } = c;
|
|
543
543
|
if (u) {
|
|
544
544
|
const x = g.array.has(u.name);
|
|
545
|
-
|
|
546
|
-
const w = await sr(c, a,
|
|
547
|
-
if (
|
|
545
|
+
J([d], !0);
|
|
546
|
+
const w = await sr(c, a, C, s.shouldUseNativeValidation && !i, x);
|
|
547
|
+
if (J([d]), w[u.name] && (l.valid = !1, i))
|
|
548
548
|
break;
|
|
549
549
|
!i && (f(w, u.name) ? x ? Jr(t.errors, w, u.name) : V(t.errors, u.name, w[u.name]) : S(t.errors, u.name));
|
|
550
550
|
}
|
|
551
|
-
!I(h) && await
|
|
551
|
+
!I(h) && await O(h, i, l);
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
return l.valid;
|
|
@@ -558,34 +558,34 @@ function it(e = {}) {
|
|
|
558
558
|
i && (i._f.refs ? i._f.refs.every((l) => !Be(l)) : !Be(i._f.ref)) && ke(r);
|
|
559
559
|
}
|
|
560
560
|
g.unMount = /* @__PURE__ */ new Set();
|
|
561
|
-
},
|
|
562
|
-
...y.mount ? a : k(i) ? o :
|
|
561
|
+
}, _ = (r, i) => (r && i && V(a, r, i), !ie(Ne(), o)), b = (r, i, l) => Kr(r, g, {
|
|
562
|
+
...y.mount ? a : k(i) ? o : Y(r) ? { [r]: i } : i
|
|
563
563
|
}, l, i), A = (r) => Ae(f(y.mount ? a : o, r, e.shouldUnregister ? f(o, r, []) : [])), T = (r, i, l = {}) => {
|
|
564
564
|
const d = f(n, r);
|
|
565
565
|
let c = i;
|
|
566
566
|
if (d) {
|
|
567
567
|
const u = d._f;
|
|
568
|
-
u && (!u.disabled && V(a, r, fr(i, u)), c = xe(u.ref) &&
|
|
568
|
+
u && (!u.disabled && V(a, r, fr(i, u)), c = xe(u.ref) && R(i) ? "" : i, ur(u.ref) ? [...u.ref.options].forEach((h) => h.selected = c.includes(h.value)) : u.refs ? ve(u.ref) ? u.refs.length > 1 ? u.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(c) ? !!c.find((x) => x === h.value) : c === h.value)) : u.refs[0] && (u.refs[0].checked = !!c) : u.refs.forEach((h) => h.checked = h.value === c) : Me(u.ref) ? u.ref.value = "" : (u.ref.value = c, u.ref.type || m.values.next({
|
|
569
569
|
name: r,
|
|
570
570
|
values: { ...a }
|
|
571
571
|
})));
|
|
572
572
|
}
|
|
573
|
-
(l.shouldDirty || l.shouldTouch) &&
|
|
573
|
+
(l.shouldDirty || l.shouldTouch) && Q(r, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(r);
|
|
574
574
|
}, W = (r, i, l) => {
|
|
575
575
|
for (const d in i) {
|
|
576
576
|
const c = i[d], u = `${r}.${d}`, h = f(n, u);
|
|
577
577
|
(g.array.has(r) || !Fe(c) || h && !h._f) && !ue(c) ? W(u, c, l) : T(u, c, l);
|
|
578
578
|
}
|
|
579
|
-
},
|
|
580
|
-
const d = f(n, r), c = g.array.has(r), u =
|
|
581
|
-
V(a, r, u), c ? (
|
|
579
|
+
}, N = (r, i, l = {}) => {
|
|
580
|
+
const d = f(n, r), c = g.array.has(r), u = H(i);
|
|
581
|
+
V(a, r, u), c ? (m.array.next({
|
|
582
582
|
name: r,
|
|
583
583
|
values: { ...a }
|
|
584
|
-
}), (F.isDirty || F.dirtyFields) && l.shouldDirty &&
|
|
584
|
+
}), (F.isDirty || F.dirtyFields) && l.shouldDirty && m.state.next({
|
|
585
585
|
name: r,
|
|
586
586
|
dirtyFields: _e(o, a),
|
|
587
|
-
isDirty:
|
|
588
|
-
})) : d && !d._f && !
|
|
587
|
+
isDirty: _(r, u)
|
|
588
|
+
})) : d && !d._f && !R(u) ? W(r, u, l) : T(r, u, l), Ye(r, g) && m.state.next({ ...t }), m.values.next({
|
|
589
589
|
name: y.mount ? r : void 0,
|
|
590
590
|
values: { ...a }
|
|
591
591
|
});
|
|
@@ -598,24 +598,24 @@ function it(e = {}) {
|
|
|
598
598
|
};
|
|
599
599
|
if (c) {
|
|
600
600
|
let x, w;
|
|
601
|
-
const q = u(), ne = r.type === Qe.BLUR || r.type === Qe.FOCUS_OUT, _r = !et(c._f) && !s.resolver && !f(t.errors, l) && !c._f.deps || rt(ne, f(t.touchedFields, l), t.isSubmitted,
|
|
601
|
+
const q = u(), ne = r.type === Qe.BLUR || r.type === Qe.FOCUS_OUT, _r = !et(c._f) && !s.resolver && !f(t.errors, l) && !c._f.deps || rt(ne, f(t.touchedFields, l), t.isSubmitted, G, le), De = Ye(l, g, ne);
|
|
602
602
|
V(a, l, q), ne ? (c._f.onBlur && c._f.onBlur(r), P && P(0)) : c._f.onChange && c._f.onChange(r);
|
|
603
|
-
const Se =
|
|
604
|
-
if (!ne &&
|
|
603
|
+
const Se = Q(l, q, ne, !1), mr = !I(Se) || De;
|
|
604
|
+
if (!ne && m.values.next({
|
|
605
605
|
name: l,
|
|
606
606
|
type: r.type,
|
|
607
607
|
values: { ...a }
|
|
608
608
|
}), _r)
|
|
609
|
-
return F.isValid && B(), mr &&
|
|
610
|
-
if (!ne && De &&
|
|
609
|
+
return F.isValid && B(), mr && m.state.next({ name: l, ...De ? {} : Se });
|
|
610
|
+
if (!ne && De && m.state.next({ ...t }), s.resolver) {
|
|
611
611
|
const { errors: $e } = await X([l]);
|
|
612
612
|
if (h(q), d) {
|
|
613
613
|
const br = ir(t.errors, n, l), je = ir($e, n, br.name || l);
|
|
614
614
|
x = je.error, l = je.name, w = I($e);
|
|
615
615
|
}
|
|
616
616
|
} else
|
|
617
|
-
|
|
618
|
-
d && (c._f.deps && ye(c._f.deps),
|
|
617
|
+
J([l], !0), x = (await sr(c, a, C, s.shouldUseNativeValidation))[l], J([l]), h(q), d && (x ? w = !1 : F.isValid && (w = await O(n, !0)));
|
|
618
|
+
d && (c._f.deps && ye(c._f.deps), L(l, w, x, Se));
|
|
619
619
|
}
|
|
620
620
|
}, fe = (r, i) => {
|
|
621
621
|
if (f(t.errors, i) && r.focus)
|
|
@@ -624,15 +624,15 @@ function it(e = {}) {
|
|
|
624
624
|
let l, d;
|
|
625
625
|
const c = me(r);
|
|
626
626
|
if (s.resolver) {
|
|
627
|
-
const u = await
|
|
627
|
+
const u = await ee(k(r) ? r : c);
|
|
628
628
|
l = I(u), d = r ? !c.some((h) => f(u, h)) : l;
|
|
629
629
|
} else
|
|
630
630
|
r ? (d = (await Promise.all(c.map(async (u) => {
|
|
631
631
|
const h = f(n, u);
|
|
632
|
-
return await
|
|
633
|
-
}))).every(Boolean), !(!d && !t.isValid) && B()) : d = l = await
|
|
634
|
-
return
|
|
635
|
-
...!
|
|
632
|
+
return await O(h && h._f ? { [u]: h } : h);
|
|
633
|
+
}))).every(Boolean), !(!d && !t.isValid) && B()) : d = l = await O(n);
|
|
634
|
+
return m.state.next({
|
|
635
|
+
...!Y(r) || F.isValid && l !== t.isValid ? {} : { name: r },
|
|
636
636
|
...s.resolver || !r ? { isValid: l } : {},
|
|
637
637
|
errors: t.errors
|
|
638
638
|
}), i.shouldFocus && !d && ge(n, fe, r ? c : g.mount), d;
|
|
@@ -640,7 +640,7 @@ function it(e = {}) {
|
|
|
640
640
|
const i = {
|
|
641
641
|
...y.mount ? a : o
|
|
642
642
|
};
|
|
643
|
-
return k(r) ? i :
|
|
643
|
+
return k(r) ? i : Y(r) ? f(i, r) : r.map((l) => f(i, l));
|
|
644
644
|
}, Ue = (r, i) => ({
|
|
645
645
|
invalid: !!f((i || t).errors, r),
|
|
646
646
|
isDirty: !!f((i || t).dirtyFields, r),
|
|
@@ -648,7 +648,7 @@ function it(e = {}) {
|
|
|
648
648
|
isValidating: !!f(t.validatingFields, r),
|
|
649
649
|
isTouched: !!f((i || t).touchedFields, r)
|
|
650
650
|
}), yr = (r) => {
|
|
651
|
-
r && me(r).forEach((i) => S(t.errors, i)),
|
|
651
|
+
r && me(r).forEach((i) => S(t.errors, i)), m.state.next({
|
|
652
652
|
errors: r ? t.errors : {}
|
|
653
653
|
});
|
|
654
654
|
}, Ie = (r, i, l) => {
|
|
@@ -657,30 +657,30 @@ function it(e = {}) {
|
|
|
657
657
|
...w,
|
|
658
658
|
...i,
|
|
659
659
|
ref: d
|
|
660
|
-
}),
|
|
660
|
+
}), m.state.next({
|
|
661
661
|
name: r,
|
|
662
662
|
errors: t.errors,
|
|
663
663
|
isValid: !1
|
|
664
664
|
}), l && l.shouldFocus && d && d.focus && d.focus();
|
|
665
|
-
}, hr = (r, i) =>
|
|
665
|
+
}, hr = (r, i) => se(r) ? m.values.subscribe({
|
|
666
666
|
next: (l) => r(b(void 0, i), l)
|
|
667
667
|
}) : b(r, i, !0), ke = (r, i = {}) => {
|
|
668
668
|
for (const l of r ? me(r) : g.mount)
|
|
669
669
|
g.mount.delete(l), g.array.delete(l), i.keepValue || (S(n, l), S(a, l)), !i.keepError && S(t.errors, l), !i.keepDirty && S(t.dirtyFields, l), !i.keepTouched && S(t.touchedFields, l), !i.keepIsValidating && S(t.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && S(o, l);
|
|
670
|
-
|
|
670
|
+
m.values.next({
|
|
671
671
|
values: { ...a }
|
|
672
|
-
}),
|
|
672
|
+
}), m.state.next({
|
|
673
673
|
...t,
|
|
674
|
-
...i.keepDirty ? { isDirty:
|
|
674
|
+
...i.keepDirty ? { isDirty: _() } : {}
|
|
675
675
|
}), !i.keepIsValid && B();
|
|
676
676
|
}, Pe = ({ disabled: r, name: i, field: l, fields: d, value: c }) => {
|
|
677
|
-
if (
|
|
677
|
+
if (te(r) && y.mount || r) {
|
|
678
678
|
const u = r ? void 0 : k(c) ? Ce(l ? l._f : f(d, i)._f) : c;
|
|
679
|
-
V(a, i, u),
|
|
679
|
+
V(a, i, u), Q(i, u, !1, !1, !0);
|
|
680
680
|
}
|
|
681
681
|
}, we = (r, i = {}) => {
|
|
682
682
|
let l = f(n, r);
|
|
683
|
-
const d =
|
|
683
|
+
const d = te(i.disabled);
|
|
684
684
|
return V(n, r, {
|
|
685
685
|
...l || {},
|
|
686
686
|
_f: {
|
|
@@ -731,7 +731,7 @@ function it(e = {}) {
|
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
733
|
}, We = () => s.shouldFocusError && ge(n, fe, g.mount), gr = (r) => {
|
|
734
|
-
|
|
734
|
+
te(r) && (m.state.next({ disabled: r }), ge(n, (i, l) => {
|
|
735
735
|
const d = f(n, l);
|
|
736
736
|
d && (i.disabled = d._f.disabled || r, Array.isArray(d._f.refs) && d._f.refs.forEach((c) => {
|
|
737
737
|
c.disabled = d._f.disabled || r;
|
|
@@ -740,16 +740,16 @@ function it(e = {}) {
|
|
|
740
740
|
}, qe = (r, i) => async (l) => {
|
|
741
741
|
let d;
|
|
742
742
|
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
743
|
-
let c =
|
|
744
|
-
if (
|
|
743
|
+
let c = H(a);
|
|
744
|
+
if (m.state.next({
|
|
745
745
|
isSubmitting: !0
|
|
746
746
|
}), s.resolver) {
|
|
747
747
|
const { errors: u, values: h } = await X();
|
|
748
748
|
t.errors = u, c = h;
|
|
749
749
|
} else
|
|
750
|
-
await
|
|
750
|
+
await O(n);
|
|
751
751
|
if (S(t.errors, "root"), I(t.errors)) {
|
|
752
|
-
|
|
752
|
+
m.state.next({
|
|
753
753
|
errors: {}
|
|
754
754
|
});
|
|
755
755
|
try {
|
|
@@ -759,7 +759,7 @@ function it(e = {}) {
|
|
|
759
759
|
}
|
|
760
760
|
} else
|
|
761
761
|
i && await i({ ...t.errors }, l), We(), setTimeout(We);
|
|
762
|
-
if (
|
|
762
|
+
if (m.state.next({
|
|
763
763
|
isSubmitted: !0,
|
|
764
764
|
isSubmitting: !1,
|
|
765
765
|
isSubmitSuccessful: I(t.errors) && !d,
|
|
@@ -768,13 +768,13 @@ function it(e = {}) {
|
|
|
768
768
|
}), d)
|
|
769
769
|
throw d;
|
|
770
770
|
}, vr = (r, i = {}) => {
|
|
771
|
-
f(n, r) && (k(i.defaultValue) ?
|
|
771
|
+
f(n, r) && (k(i.defaultValue) ? N(r, H(f(o, r))) : (N(r, i.defaultValue), V(o, r, H(i.defaultValue))), i.keepTouched || S(t.touchedFields, r), i.keepDirty || (S(t.dirtyFields, r), t.isDirty = i.defaultValue ? _(r, H(f(o, r))) : _()), i.keepError || (S(t.errors, r), F.isValid && B()), m.state.next({ ...t }));
|
|
772
772
|
}, He = (r, i = {}) => {
|
|
773
|
-
const l = r ?
|
|
773
|
+
const l = r ? H(r) : o, d = H(l), c = I(r), u = c ? o : d;
|
|
774
774
|
if (i.keepDefaultValues || (o = l), !i.keepValues) {
|
|
775
775
|
if (i.keepDirtyValues)
|
|
776
776
|
for (const h of g.mount)
|
|
777
|
-
f(t.dirtyFields, h) ? V(u, h, f(a, h)) :
|
|
777
|
+
f(t.dirtyFields, h) ? V(u, h, f(a, h)) : N(h, f(u, h));
|
|
778
778
|
else {
|
|
779
779
|
if (Le && k(r))
|
|
780
780
|
for (const h of g.mount) {
|
|
@@ -792,9 +792,9 @@ function it(e = {}) {
|
|
|
792
792
|
}
|
|
793
793
|
n = {};
|
|
794
794
|
}
|
|
795
|
-
a = e.shouldUnregister ? i.keepDefaultValues ?
|
|
795
|
+
a = e.shouldUnregister ? i.keepDefaultValues ? H(o) : {} : H(u), m.array.next({
|
|
796
796
|
values: { ...u }
|
|
797
|
-
}),
|
|
797
|
+
}), m.values.next({
|
|
798
798
|
values: { ...u }
|
|
799
799
|
});
|
|
800
800
|
}
|
|
@@ -805,7 +805,7 @@ function it(e = {}) {
|
|
|
805
805
|
watch: /* @__PURE__ */ new Set(),
|
|
806
806
|
watchAll: !1,
|
|
807
807
|
focus: ""
|
|
808
|
-
}, y.mount = !F.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister,
|
|
808
|
+
}, y.mount = !F.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, m.state.next({
|
|
809
809
|
submitCount: i.keepSubmitCount ? t.submitCount : 0,
|
|
810
810
|
isDirty: c ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !ie(r, o)),
|
|
811
811
|
isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
|
|
@@ -815,7 +815,7 @@ function it(e = {}) {
|
|
|
815
815
|
isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
816
816
|
isSubmitting: !1
|
|
817
817
|
});
|
|
818
|
-
}, ze = (r, i) => He(
|
|
818
|
+
}, ze = (r, i) => He(se(r) ? r(a) : r, i);
|
|
819
819
|
return {
|
|
820
820
|
control: {
|
|
821
821
|
register: we,
|
|
@@ -825,15 +825,15 @@ function it(e = {}) {
|
|
|
825
825
|
setError: Ie,
|
|
826
826
|
_executeSchema: X,
|
|
827
827
|
_getWatch: b,
|
|
828
|
-
_getDirty:
|
|
828
|
+
_getDirty: _,
|
|
829
829
|
_updateValid: B,
|
|
830
830
|
_removeUnmounted: ae,
|
|
831
|
-
_updateFieldArray:
|
|
831
|
+
_updateFieldArray: v,
|
|
832
832
|
_updateDisabledField: Pe,
|
|
833
833
|
_getFieldArray: A,
|
|
834
834
|
_reset: He,
|
|
835
|
-
_resetDefaultValues: () =>
|
|
836
|
-
ze(r, s.resetOptions),
|
|
835
|
+
_resetDefaultValues: () => se(s.defaultValues) && s.defaultValues().then((r) => {
|
|
836
|
+
ze(r, s.resetOptions), m.state.next({
|
|
837
837
|
isLoading: !1
|
|
838
838
|
});
|
|
839
839
|
}),
|
|
@@ -844,9 +844,9 @@ function it(e = {}) {
|
|
|
844
844
|
};
|
|
845
845
|
},
|
|
846
846
|
_disableForm: gr,
|
|
847
|
-
_subjects:
|
|
847
|
+
_subjects: m,
|
|
848
848
|
_proxyFormState: F,
|
|
849
|
-
_setErrors:
|
|
849
|
+
_setErrors: j,
|
|
850
850
|
get _fields() {
|
|
851
851
|
return n;
|
|
852
852
|
},
|
|
@@ -888,7 +888,7 @@ function it(e = {}) {
|
|
|
888
888
|
register: we,
|
|
889
889
|
handleSubmit: qe,
|
|
890
890
|
watch: hr,
|
|
891
|
-
setValue:
|
|
891
|
+
setValue: N,
|
|
892
892
|
getValues: Ne,
|
|
893
893
|
reset: ze,
|
|
894
894
|
resetField: vr,
|
|
@@ -906,10 +906,10 @@ function it(e = {}) {
|
|
|
906
906
|
};
|
|
907
907
|
}
|
|
908
908
|
function lt(e = {}) {
|
|
909
|
-
const s =
|
|
909
|
+
const s = z.useRef(), t = z.useRef(), [n, o] = z.useState({
|
|
910
910
|
isDirty: !1,
|
|
911
911
|
isValidating: !1,
|
|
912
|
-
isLoading:
|
|
912
|
+
isLoading: se(e.defaultValues),
|
|
913
913
|
isSubmitted: !1,
|
|
914
914
|
isSubmitting: !1,
|
|
915
915
|
isSubmitSuccessful: !1,
|
|
@@ -920,7 +920,7 @@ function lt(e = {}) {
|
|
|
920
920
|
validatingFields: {},
|
|
921
921
|
errors: e.errors || {},
|
|
922
922
|
disabled: e.disabled || !1,
|
|
923
|
-
defaultValues:
|
|
923
|
+
defaultValues: se(e.defaultValues) ? void 0 : e.defaultValues
|
|
924
924
|
});
|
|
925
925
|
s.current || (s.current = {
|
|
926
926
|
...it(e),
|
|
@@ -932,20 +932,20 @@ function lt(e = {}) {
|
|
|
932
932
|
next: (y) => {
|
|
933
933
|
$r(y, a._proxyFormState, a._updateFormState) && o({ ...a._formState });
|
|
934
934
|
}
|
|
935
|
-
}),
|
|
935
|
+
}), z.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), z.useEffect(() => {
|
|
936
936
|
if (a._proxyFormState.isDirty) {
|
|
937
937
|
const y = a._getDirty();
|
|
938
938
|
y !== n.isDirty && a._subjects.state.next({
|
|
939
939
|
isDirty: y
|
|
940
940
|
});
|
|
941
941
|
}
|
|
942
|
-
}, [a, n.isDirty]),
|
|
942
|
+
}, [a, n.isDirty]), z.useEffect(() => {
|
|
943
943
|
e.values && !ie(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, o((y) => ({ ...y }))) : a._resetDefaultValues();
|
|
944
|
-
}, [e.values, a]),
|
|
944
|
+
}, [e.values, a]), z.useEffect(() => {
|
|
945
945
|
e.errors && a._setErrors(e.errors);
|
|
946
|
-
}, [e.errors, a]),
|
|
946
|
+
}, [e.errors, a]), z.useEffect(() => {
|
|
947
947
|
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
948
|
-
}),
|
|
948
|
+
}), z.useEffect(() => {
|
|
949
949
|
e.shouldUnregister && a._subjects.values.next({
|
|
950
950
|
values: a._getWatch()
|
|
951
951
|
});
|
|
@@ -961,30 +961,31 @@ const at = "Я принимаю условия Политики обработк
|
|
|
961
961
|
isTextArea: y,
|
|
962
962
|
telegramLink: g = "https://t.me/stone_developer",
|
|
963
963
|
isRequiredPhone: P = !0,
|
|
964
|
-
isRequiredEmail:
|
|
964
|
+
isRequiredEmail: M = !1,
|
|
965
965
|
isRequiredPhoneOrEmail: F,
|
|
966
|
-
textAreaPlaceholder:
|
|
966
|
+
textAreaPlaceholder: m,
|
|
967
967
|
subTitle: le,
|
|
968
|
-
submitHandler:
|
|
969
|
-
modalWidth:
|
|
968
|
+
submitHandler: G,
|
|
969
|
+
modalWidth: C = "442px",
|
|
970
970
|
rowsTextArea: ce = 2,
|
|
971
|
-
advCheckBox: B = { text: at, isRequired: !0 }
|
|
971
|
+
advCheckBox: B = { text: at, isRequired: !0 },
|
|
972
|
+
isAdvCheckBox: J
|
|
972
973
|
}) => {
|
|
973
974
|
const {
|
|
974
|
-
register:
|
|
975
|
-
handleSubmit:
|
|
975
|
+
register: v,
|
|
976
|
+
handleSubmit: $,
|
|
976
977
|
trigger: j,
|
|
977
|
-
reset:
|
|
978
|
-
watch:
|
|
979
|
-
formState: { errors:
|
|
980
|
-
} = lt(),
|
|
981
|
-
required:
|
|
978
|
+
reset: p,
|
|
979
|
+
watch: Q,
|
|
980
|
+
formState: { errors: L }
|
|
981
|
+
} = lt(), X = !!Q("email"), { onChange: ee, onBlur: O, ...ae } = v("phone", {
|
|
982
|
+
required: M || F && !X,
|
|
982
983
|
pattern: { value: pr, message: "" },
|
|
983
984
|
onBlur: () => j("phone")
|
|
984
|
-
}), { isMobile:
|
|
985
|
-
|
|
985
|
+
}), { isMobile: _, currentClientWidth: b } = Dr(), A = Q("personalCheckBox"), T = Q("advCheckBox"), W = (N) => {
|
|
986
|
+
G(N), p();
|
|
986
987
|
};
|
|
987
|
-
return
|
|
988
|
+
return b ? /* @__PURE__ */ D(
|
|
988
989
|
Vr,
|
|
989
990
|
{
|
|
990
991
|
isOpen: e,
|
|
@@ -993,11 +994,11 @@ const at = "Я принимаю условия Политики обработк
|
|
|
993
994
|
opacity: 0.7,
|
|
994
995
|
isTransparentBack: !0,
|
|
995
996
|
additionalClassModalBody: U.modalBody,
|
|
996
|
-
children: /* @__PURE__ */
|
|
997
|
+
children: /* @__PURE__ */ re(
|
|
997
998
|
"div",
|
|
998
999
|
{
|
|
999
1000
|
className: U.root,
|
|
1000
|
-
style: { width:
|
|
1001
|
+
style: { width: _ ? "100%" : C },
|
|
1001
1002
|
children: [
|
|
1002
1003
|
/* @__PURE__ */ D(
|
|
1003
1004
|
"div",
|
|
@@ -1006,14 +1007,14 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1006
1007
|
dangerouslySetInnerHTML: { __html: n ?? "Оставить обращение" }
|
|
1007
1008
|
}
|
|
1008
1009
|
),
|
|
1009
|
-
t && /* @__PURE__ */
|
|
1010
|
+
t && /* @__PURE__ */ re("div", { className: U.telegramWrapper, children: [
|
|
1010
1011
|
/* @__PURE__ */ D(
|
|
1011
1012
|
"a",
|
|
1012
1013
|
{
|
|
1013
1014
|
className: U.telegramLink,
|
|
1014
1015
|
href: g,
|
|
1015
1016
|
target: "_blank",
|
|
1016
|
-
children: /* @__PURE__ */
|
|
1017
|
+
children: /* @__PURE__ */ re("div", { className: U.telegram, children: [
|
|
1017
1018
|
/* @__PURE__ */ D("div", { children: "Подписаться в Telegram" }),
|
|
1018
1019
|
/* @__PURE__ */ D(Ge, { name: "telegram" })
|
|
1019
1020
|
] })
|
|
@@ -1030,8 +1031,8 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1030
1031
|
}
|
|
1031
1032
|
}
|
|
1032
1033
|
),
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ re("form", { onSubmit: $(W), children: [
|
|
1035
|
+
/* @__PURE__ */ re(Fr, { className: U.inputWrapper, children: [
|
|
1035
1036
|
/* @__PURE__ */ D(
|
|
1036
1037
|
Ee,
|
|
1037
1038
|
{
|
|
@@ -1040,8 +1041,8 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1040
1041
|
variant: "light",
|
|
1041
1042
|
placeholder: "Введите имя",
|
|
1042
1043
|
"data-testid": "modal_name",
|
|
1043
|
-
...
|
|
1044
|
-
error: !!
|
|
1044
|
+
...v("name", { required: !0, pattern: Ar }),
|
|
1045
|
+
error: !!L.name
|
|
1045
1046
|
}
|
|
1046
1047
|
),
|
|
1047
1048
|
a && /* @__PURE__ */ D(
|
|
@@ -1050,9 +1051,9 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1050
1051
|
inputMode: "numeric",
|
|
1051
1052
|
name: "phone",
|
|
1052
1053
|
mask: "+7 (999) 999-99-99",
|
|
1053
|
-
onChange:
|
|
1054
|
+
onChange: ee,
|
|
1054
1055
|
placeholder: "+7 (- - -) - - - - - - -",
|
|
1055
|
-
onBlur:
|
|
1056
|
+
onBlur: O,
|
|
1056
1057
|
children: /* @__PURE__ */ D(
|
|
1057
1058
|
Ee,
|
|
1058
1059
|
{
|
|
@@ -1061,9 +1062,9 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1061
1062
|
type: "tel",
|
|
1062
1063
|
size_s: "small",
|
|
1063
1064
|
variant: "light",
|
|
1064
|
-
...
|
|
1065
|
-
...
|
|
1066
|
-
error: !!
|
|
1065
|
+
...ae,
|
|
1066
|
+
...v("phone"),
|
|
1067
|
+
error: !!L.phone
|
|
1067
1068
|
}
|
|
1068
1069
|
)
|
|
1069
1070
|
}
|
|
@@ -1076,42 +1077,42 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1076
1077
|
variant: "light",
|
|
1077
1078
|
placeholder: "Введите email",
|
|
1078
1079
|
"data-testid": "modal_email",
|
|
1079
|
-
...
|
|
1080
|
-
required:
|
|
1080
|
+
...v("email", {
|
|
1081
|
+
required: M || F && !X,
|
|
1081
1082
|
pattern: kr
|
|
1082
1083
|
}),
|
|
1083
|
-
error: !!
|
|
1084
|
+
error: !!L.email
|
|
1084
1085
|
}
|
|
1085
1086
|
),
|
|
1086
1087
|
y && /* @__PURE__ */ D(
|
|
1087
1088
|
wr,
|
|
1088
1089
|
{
|
|
1089
1090
|
"data-testid": "modal_textarea",
|
|
1090
|
-
placeholder:
|
|
1091
|
+
placeholder: m,
|
|
1091
1092
|
rows: ce,
|
|
1092
1093
|
width: "full",
|
|
1093
|
-
...
|
|
1094
|
+
...v("textarea")
|
|
1094
1095
|
}
|
|
1095
1096
|
),
|
|
1096
|
-
B && !t && /* @__PURE__ */ D(
|
|
1097
|
+
B && !t && J && /* @__PURE__ */ D(
|
|
1097
1098
|
Je,
|
|
1098
1099
|
{
|
|
1099
1100
|
"data-testid": "modal_advCheckBox",
|
|
1100
|
-
isChecked:
|
|
1101
|
-
error: !!
|
|
1101
|
+
isChecked: T,
|
|
1102
|
+
error: !!L.advCheckBox,
|
|
1102
1103
|
text: B.text,
|
|
1103
|
-
...
|
|
1104
|
+
...v("advCheckBox", { required: B == null ? void 0 : B.isRequired })
|
|
1104
1105
|
}
|
|
1105
1106
|
),
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ re(
|
|
1107
1108
|
Je,
|
|
1108
1109
|
{
|
|
1109
1110
|
"data-testid": "modal_personalCheckBox",
|
|
1110
|
-
isChecked:
|
|
1111
|
-
error: !!
|
|
1112
|
-
...
|
|
1111
|
+
isChecked: A,
|
|
1112
|
+
error: !!L.personalCheckBox,
|
|
1113
|
+
...v("personalCheckBox", { required: !t }),
|
|
1113
1114
|
children: [
|
|
1114
|
-
t && /* @__PURE__ */
|
|
1115
|
+
t && /* @__PURE__ */ re("div", { children: [
|
|
1115
1116
|
"Согласен(-на)",
|
|
1116
1117
|
" ",
|
|
1117
1118
|
/* @__PURE__ */ D(
|
|
@@ -1125,7 +1126,7 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1125
1126
|
" ",
|
|
1126
1127
|
"от Stone"
|
|
1127
1128
|
] }),
|
|
1128
|
-
!t && /* @__PURE__ */
|
|
1129
|
+
!t && /* @__PURE__ */ re("div", { children: [
|
|
1129
1130
|
"Я принимаю условия",
|
|
1130
1131
|
" ",
|
|
1131
1132
|
/* @__PURE__ */ D(
|
|
@@ -1151,7 +1152,7 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1151
1152
|
size: "large",
|
|
1152
1153
|
as: "button",
|
|
1153
1154
|
additionalClass: U.modalBtn,
|
|
1154
|
-
disabled: !!
|
|
1155
|
+
disabled: !!L.name || !!L.phone && P || !!L.email && M || !!L.advCheckBox && (B == null ? void 0 : B.isRequired) || !!L.personalCheckBox && !t,
|
|
1155
1156
|
children: "Отправить запрос"
|
|
1156
1157
|
}
|
|
1157
1158
|
)
|