stone-kit 0.0.373 → 0.0.374
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/components/Button/ui/Button.js +53 -54
- package/dist/components/FormModal/ui/ModalForm.d.ts +1 -5
- package/dist/components/FormModal/ui/ModalForm.js +323 -325
- package/dist/components/MetroTag/ui/MetroTag.js +28 -35
- package/dist/components/MetroTag/ui/MetroTag.types.d.ts +0 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as U, jsxs as Se } from "react/jsx-runtime";
|
|
2
2
|
import { I as xt } from "../../../index-BaVdWc7x.js";
|
|
3
3
|
import { M as Vt } from "../../../Modal-DbD1tgiF.js";
|
|
4
4
|
import { Flex as Ft } from "../../Flex/ui/Flex.js";
|
|
5
5
|
import { Input as Ee } from "../../Input/ui/Input.js";
|
|
6
|
-
import
|
|
6
|
+
import W from "react";
|
|
7
7
|
import { Button as Ke } from "../../Button/ui/Button.js";
|
|
8
8
|
import { NewIcon as At } from "../../NewIcon/ui/NewIcon.js";
|
|
9
9
|
import { phoneReg as wt, nameReg as pt, emailReg as Dt } from "../utils/reg.js";
|
|
10
10
|
import { CheckBox as Ge } from "../../CheckBox/CheckBox.js";
|
|
11
11
|
import { TextArea as kt } from "../../TextArea/TextArea.js";
|
|
12
12
|
import { useClientWidth as St } from "../../../shared/useClientWidth.js";
|
|
13
|
-
const Et = "_btn_1uiov_1", Ct = "_modal_1uiov_9", Bt = "_modalBody_1uiov_16", Tt = "_root_1uiov_21", Rt = "_title_1uiov_31", Lt = "_description_1uiov_38", Mt = "_inputWrapper_1uiov_45",
|
|
13
|
+
const Et = "_btn_1uiov_1", Ct = "_modal_1uiov_9", Bt = "_modalBody_1uiov_16", Tt = "_root_1uiov_21", Rt = "_title_1uiov_31", Lt = "_description_1uiov_38", Mt = "_inputWrapper_1uiov_45", ee = {
|
|
14
14
|
btn: Et,
|
|
15
15
|
modal: Ct,
|
|
16
16
|
modalBody: Bt,
|
|
@@ -21,11 +21,11 @@ const Et = "_btn_1uiov_1", Ct = "_modal_1uiov_9", Bt = "_modalBody_1uiov_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 S = (e) => !T(e) && !Array.isArray(e) && lt(e) && !oe(e),
|
|
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)), It = (e) => {
|
|
25
25
|
const s = e.constructor && e.constructor.prototype;
|
|
26
26
|
return S(s) && s.hasOwnProperty("isPrototypeOf");
|
|
27
27
|
}, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
28
|
-
function
|
|
28
|
+
function P(e) {
|
|
29
29
|
let s;
|
|
30
30
|
const r = Array.isArray(e);
|
|
31
31
|
if (e instanceof Date)
|
|
@@ -37,29 +37,29 @@ function H(e) {
|
|
|
37
37
|
s = e;
|
|
38
38
|
else
|
|
39
39
|
for (const n in e)
|
|
40
|
-
e.hasOwnProperty(n) && (s[n] =
|
|
40
|
+
e.hasOwnProperty(n) && (s[n] = P(e[n]));
|
|
41
41
|
else
|
|
42
42
|
return e;
|
|
43
43
|
return s;
|
|
44
44
|
}
|
|
45
|
-
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], p = (e) => e === void 0,
|
|
45
|
+
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], p = (e) => e === void 0, d = (e, s, r) => {
|
|
46
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
|
-
},
|
|
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
|
-
const
|
|
58
|
-
|
|
57
|
+
const I = e[g];
|
|
58
|
+
R = S(I) || Array.isArray(I) ? I : 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",
|
|
@@ -82,7 +82,7 @@ const Je = {
|
|
|
82
82
|
required: "required",
|
|
83
83
|
validate: "validate"
|
|
84
84
|
};
|
|
85
|
-
|
|
85
|
+
W.createContext(null);
|
|
86
86
|
var qt = (e, s, r, n = !0) => {
|
|
87
87
|
const u = {
|
|
88
88
|
defaultValues: s._defaultValues
|
|
@@ -91,18 +91,18 @@ var qt = (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 M(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] ===
|
|
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
|
-
const s =
|
|
105
|
-
s.current = e,
|
|
104
|
+
const s = W.useRef(e);
|
|
105
|
+
s.current = e, W.useEffect(() => {
|
|
106
106
|
const r = !e.disabled && s.current.subject && s.current.subject.subscribe({
|
|
107
107
|
next: s.current.next
|
|
108
108
|
});
|
|
@@ -111,22 +111,22 @@ 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)) {
|
|
129
|
-
const a =
|
|
129
|
+
const a = d(e, u);
|
|
130
130
|
if (a) {
|
|
131
131
|
const { _f: y, ...g } = a;
|
|
132
132
|
if (y) {
|
|
@@ -141,14 +141,14 @@ const he = (e, s, r, n) => {
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
var $t = (e, s, r) => {
|
|
144
|
-
const n = _e(
|
|
145
|
-
return
|
|
146
|
-
}, Me = (e) => e.type === "file",
|
|
144
|
+
const n = _e(d(e, r));
|
|
145
|
+
return F(n, "root", s[r]), F(e, r, n), e;
|
|
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
|
|
@@ -175,7 +175,7 @@ var ut = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disab
|
|
|
175
175
|
value: r.value
|
|
176
176
|
} : s, et) : et;
|
|
177
177
|
function tt(e, s, r = "validate") {
|
|
178
|
-
if (me(e) || Array.isArray(e) && e.every(me) ||
|
|
178
|
+
if (me(e) || Array.isArray(e) && e.every(me) || te(e) && !e)
|
|
179
179
|
return {
|
|
180
180
|
type: r,
|
|
181
181
|
message: me(e) ? e : "",
|
|
@@ -186,85 +186,85 @@ 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: I, 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
|
-
},
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
type: v ? E :
|
|
198
|
-
message:
|
|
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
|
+
const q = v ? b : w;
|
|
196
|
+
V[C] = {
|
|
197
|
+
type: v ? E : z,
|
|
198
|
+
message: q,
|
|
199
199
|
ref: a,
|
|
200
|
-
...L(v ? E :
|
|
200
|
+
...L(v ? E : z, q)
|
|
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
|
-
...L(
|
|
208
|
+
ref: H,
|
|
209
|
+
...L(Y.required, b)
|
|
210
210
|
}, !r))
|
|
211
|
-
return
|
|
211
|
+
return O(b), V;
|
|
212
212
|
}
|
|
213
|
-
if (!
|
|
213
|
+
if (!Z && (!T(A) || !T(_))) {
|
|
214
214
|
let v, b;
|
|
215
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), q = (de) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + de), ce = a.type == "time", fe = a.type == "week";
|
|
221
|
+
G(w.value) && m && (v = ce ? q(m) > q(w.value) : fe ? m > w.value : z > new Date(w.value)), G(E.value) && m && (b = ce ? q(m) < q(E.value) : fe ? m < E.value : z < new Date(E.value));
|
|
222
222
|
}
|
|
223
|
-
if ((v || b) && (ae(!!v, w.message, E.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(
|
|
226
|
+
if ((R || I) && !Z && (G(m) || u && Array.isArray(m))) {
|
|
227
|
+
const v = ue(R), b = ue(I), w = !T(v.value) && m.length > +v.value, E = !T(b.value) && m.length < +b.value;
|
|
228
228
|
if ((w || E) && (ae(w, v.message, b.message), !r))
|
|
229
|
-
return
|
|
229
|
+
return O(V[C].message), V;
|
|
230
230
|
}
|
|
231
|
-
if (ie && !
|
|
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
|
-
...L(
|
|
237
|
+
...L(Y.pattern, b)
|
|
238
238
|
}, !r))
|
|
239
|
-
return
|
|
239
|
+
return O(b), V;
|
|
240
240
|
}
|
|
241
|
-
if (
|
|
242
|
-
if (
|
|
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
|
-
...L(
|
|
246
|
+
...L(Y.validate, b.message)
|
|
247
247
|
}, !r))
|
|
248
|
-
return
|
|
249
|
-
} else if (S(
|
|
248
|
+
return O(b.message), V;
|
|
249
|
+
} else if (S(j)) {
|
|
250
250
|
let v = {};
|
|
251
|
-
for (const b in
|
|
251
|
+
for (const b in j) {
|
|
252
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
257
|
...L(b, w.message)
|
|
258
|
-
},
|
|
258
|
+
}, O(w.message), r && (V[C] = v));
|
|
259
259
|
}
|
|
260
|
-
if (!M(v) && (
|
|
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;
|
|
@@ -323,9 +323,9 @@ function se(e, s) {
|
|
|
323
323
|
}
|
|
324
324
|
return !0;
|
|
325
325
|
}
|
|
326
|
-
var ot = (e) => e.type === "select-multiple", Gt = (e) =>
|
|
326
|
+
var ot = (e) => e.type === "select-multiple", Gt = (e) => Oe(e) || ge(e), Be = (e) => be(e) && e.isConnected, ct = (e) => {
|
|
327
327
|
for (const s in e)
|
|
328
|
-
if (
|
|
328
|
+
if (re(e[s]))
|
|
329
329
|
return !0;
|
|
330
330
|
return !1;
|
|
331
331
|
};
|
|
@@ -336,24 +336,24 @@ function Fe(e, s = {}) {
|
|
|
336
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
|
-
function
|
|
339
|
+
function ft(e, s, r) {
|
|
340
340
|
const n = Array.isArray(e);
|
|
341
341
|
if (S(e) || n)
|
|
342
342
|
for (const u in e)
|
|
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]) } :
|
|
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) =>
|
|
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))
|
|
350
|
-
return Me(s) ? s.files :
|
|
350
|
+
return Me(s) ? s.files : Oe(s) ? ut(e.refs).value : ot(s) ? [...s.selectedOptions].map(({ value: r }) => r) : ge(s) ? nt(e.refs).value : dt(p(s.value) ? e.ref.value : s.value, e);
|
|
351
351
|
}
|
|
352
352
|
var Jt = (e, s, r, n) => {
|
|
353
353
|
const u = {};
|
|
354
354
|
for (const a of e) {
|
|
355
|
-
const y =
|
|
356
|
-
y &&
|
|
355
|
+
const y = d(s, a);
|
|
356
|
+
y && F(u, a, y._f);
|
|
357
357
|
}
|
|
358
358
|
return {
|
|
359
359
|
criteriaMode: r,
|
|
@@ -363,7 +363,7 @@ var Jt = (e, s, r, n) => {
|
|
|
363
363
|
};
|
|
364
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
|
-
const n =
|
|
366
|
+
const n = d(e, r);
|
|
367
367
|
if (n || Le(r))
|
|
368
368
|
return {
|
|
369
369
|
error: n,
|
|
@@ -371,7 +371,7 @@ function st(e, s, r) {
|
|
|
371
371
|
};
|
|
372
372
|
const u = r.split(".");
|
|
373
373
|
for (; u.length; ) {
|
|
374
|
-
const a = u.join("."), y =
|
|
374
|
+
const a = u.join("."), y = d(s, a), g = d(e, a);
|
|
375
375
|
if (y && !Array.isArray(y) && r !== a)
|
|
376
376
|
return { name: r };
|
|
377
377
|
if (g && g.type)
|
|
@@ -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(
|
|
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 = {}) {
|
|
@@ -398,7 +398,7 @@ function er(e = {}) {
|
|
|
398
398
|
}, r = {
|
|
399
399
|
submitCount: 0,
|
|
400
400
|
isDirty: !1,
|
|
401
|
-
isLoading:
|
|
401
|
+
isLoading: re(s.defaultValues),
|
|
402
402
|
isValidating: !1,
|
|
403
403
|
isSubmitted: !1,
|
|
404
404
|
isSubmitting: !1,
|
|
@@ -409,7 +409,7 @@ function er(e = {}) {
|
|
|
409
409
|
validatingFields: {},
|
|
410
410
|
errors: s.errors || {},
|
|
411
411
|
disabled: s.disabled || !1
|
|
412
|
-
}, n = {}, u = S(s.defaultValues) || S(s.values) ?
|
|
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,7 +418,7 @@ function er(e = {}) {
|
|
|
418
418
|
unMount: /* @__PURE__ */ new Set(),
|
|
419
419
|
array: /* @__PURE__ */ new Set(),
|
|
420
420
|
watch: /* @__PURE__ */ new Set()
|
|
421
|
-
},
|
|
421
|
+
}, R, I = 0;
|
|
422
422
|
const A = {
|
|
423
423
|
isDirty: !1,
|
|
424
424
|
dirtyFields: !1,
|
|
@@ -431,35 +431,35 @@ function er(e = {}) {
|
|
|
431
431
|
values: Ce(),
|
|
432
432
|
array: Ce(),
|
|
433
433
|
state: Ce()
|
|
434
|
-
}, ie = Qe(s.mode),
|
|
435
|
-
clearTimeout(
|
|
436
|
-
},
|
|
434
|
+
}, ie = Qe(s.mode), j = Qe(s.reValidateMode), C = s.criteriaMode === $.all, J = (t) => (i) => {
|
|
435
|
+
clearTimeout(I), I = setTimeout(t, i);
|
|
436
|
+
}, B = async (t) => {
|
|
437
437
|
if (A.isValid || t) {
|
|
438
|
-
const i = s.resolver ? M((await
|
|
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
|
-
},
|
|
443
|
+
}, K = (t, i) => {
|
|
444
444
|
(A.isValidating || A.validatingFields) && ((t || Array.from(g.mount)).forEach((l) => {
|
|
445
|
-
l && (i ?
|
|
445
|
+
l && (i ? F(r.validatingFields, l, i) : k(r.validatingFields, l));
|
|
446
446
|
}), _.state.next({
|
|
447
447
|
validatingFields: r.validatingFields,
|
|
448
448
|
isValidating: !M(r.validatingFields)
|
|
449
449
|
}));
|
|
450
|
-
}, m = (t, i = [], l,
|
|
451
|
-
if (
|
|
452
|
-
if (y.action = !0, o && Array.isArray(
|
|
453
|
-
const h = l(
|
|
454
|
-
c &&
|
|
450
|
+
}, m = (t, i = [], l, f, c = !0, o = !0) => {
|
|
451
|
+
if (f && l) {
|
|
452
|
+
if (y.action = !0, o && Array.isArray(d(n, t))) {
|
|
453
|
+
const h = l(d(n, t), f.argA, f.argB);
|
|
454
|
+
c && F(n, t, h);
|
|
455
455
|
}
|
|
456
|
-
if (o && Array.isArray(
|
|
457
|
-
const h = l(
|
|
458
|
-
c &&
|
|
456
|
+
if (o && Array.isArray(d(r.errors, t))) {
|
|
457
|
+
const h = l(d(r.errors, t), f.argA, f.argB);
|
|
458
|
+
c && F(r.errors, t, h), Yt(r.errors, t);
|
|
459
459
|
}
|
|
460
|
-
if (A.touchedFields && o && Array.isArray(
|
|
461
|
-
const h = l(
|
|
462
|
-
c &&
|
|
460
|
+
if (A.touchedFields && o && Array.isArray(d(r.touchedFields, t))) {
|
|
461
|
+
const h = l(d(r.touchedFields, t), f.argA, f.argB);
|
|
462
|
+
c && F(r.touchedFields, t, h);
|
|
463
463
|
}
|
|
464
464
|
A.dirtyFields && (r.dirtyFields = ve(u, a)), _.state.next({
|
|
465
465
|
name: t,
|
|
@@ -469,43 +469,43 @@ 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
|
-
},
|
|
483
|
-
const c =
|
|
482
|
+
}, V = (t, i, l, f) => {
|
|
483
|
+
const c = d(n, t);
|
|
484
484
|
if (c) {
|
|
485
|
-
const o =
|
|
486
|
-
p(o) ||
|
|
485
|
+
const o = d(a, t, p(l) ? d(u, t) : l);
|
|
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
|
-
}, D = !!(
|
|
493
|
-
if (!l ||
|
|
492
|
+
}, D = !!(d(n, t) && d(n, t)._f && d(n, t)._f.disabled);
|
|
493
|
+
if (!l || f) {
|
|
494
494
|
A.isDirty && (h = r.isDirty, r.isDirty = x.isDirty = v(), o = h !== x.isDirty);
|
|
495
|
-
const
|
|
496
|
-
h = !!(!D &&
|
|
495
|
+
const N = D || se(d(u, t), i);
|
|
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
|
-
const
|
|
500
|
-
|
|
499
|
+
const N = d(r.touchedFields, t);
|
|
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
|
-
},
|
|
504
|
-
const c =
|
|
505
|
-
if (e.delayError && l ? (
|
|
503
|
+
}, le = (t, i, l, f) => {
|
|
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(I), 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
|
-
...
|
|
508
|
-
...o &&
|
|
507
|
+
...f,
|
|
508
|
+
...o && te(i) ? { isValid: i } : {},
|
|
509
509
|
errors: r.errors,
|
|
510
510
|
name: t
|
|
511
511
|
};
|
|
@@ -514,16 +514,16 @@ 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
|
|
521
|
-
},
|
|
522
|
-
const { errors: i } = await
|
|
520
|
+
return K(t), i;
|
|
521
|
+
}, Z = async (t) => {
|
|
522
|
+
const { errors: i } = await X(t);
|
|
523
523
|
if (t)
|
|
524
524
|
for (const l of t) {
|
|
525
|
-
const
|
|
526
|
-
|
|
525
|
+
const f = d(i, l);
|
|
526
|
+
f ? F(r.errors, l, f) : k(r.errors, l);
|
|
527
527
|
}
|
|
528
528
|
else
|
|
529
529
|
r.errors = i;
|
|
@@ -531,17 +531,17 @@ function er(e = {}) {
|
|
|
531
531
|
}, L = async (t, i, l = {
|
|
532
532
|
valid: !0
|
|
533
533
|
}) => {
|
|
534
|
-
for (const
|
|
535
|
-
const c = t[
|
|
534
|
+
for (const f in t) {
|
|
535
|
+
const c = t[f];
|
|
536
536
|
if (c) {
|
|
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 && (
|
|
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
|
}
|
|
@@ -549,115 +549,115 @@ function er(e = {}) {
|
|
|
549
549
|
return l.valid;
|
|
550
550
|
}, ae = () => {
|
|
551
551
|
for (const t of g.unMount) {
|
|
552
|
-
const i =
|
|
552
|
+
const i = d(n, t);
|
|
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(
|
|
559
|
-
const
|
|
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
|
+
const f = d(n, t);
|
|
560
560
|
let c = i;
|
|
561
|
-
if (
|
|
562
|
-
const o =
|
|
563
|
-
o && (!o.disabled &&
|
|
561
|
+
if (f) {
|
|
562
|
+
const o = f._f;
|
|
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
|
-
},
|
|
570
|
-
for (const
|
|
571
|
-
const c = i[
|
|
572
|
-
(g.array.has(t) || !Ve(c) || h && !h._f) && !oe(c) ?
|
|
568
|
+
(l.shouldDirty || l.shouldTouch) && Q(t, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && de(t);
|
|
569
|
+
}, z = (t, i, l) => {
|
|
570
|
+
for (const f in i) {
|
|
571
|
+
const c = i[f], o = `${t}.${f}`, h = d(n, o);
|
|
572
|
+
(g.array.has(t) || !Ve(c) || h && !h._f) && !oe(c) ? z(o, c, l) : E(o, c, l);
|
|
573
573
|
}
|
|
574
|
-
},
|
|
575
|
-
const
|
|
576
|
-
|
|
574
|
+
}, q = (t, i, l = {}) => {
|
|
575
|
+
const f = d(n, t), c = g.array.has(t), o = P(i);
|
|
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
|
-
})) :
|
|
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
|
});
|
|
587
587
|
}, ce = async (t) => {
|
|
588
588
|
y.mount = !0;
|
|
589
589
|
const i = t.target;
|
|
590
|
-
let l = i.name,
|
|
591
|
-
const c =
|
|
592
|
-
|
|
590
|
+
let l = i.name, f = !0;
|
|
591
|
+
const c = d(n, l), o = () => i.type ? Te(c._f) : Ot(t), h = (x) => {
|
|
592
|
+
f = Number.isNaN(x) || x === d(a, l, x);
|
|
593
593
|
};
|
|
594
594
|
if (c) {
|
|
595
595
|
let x, D;
|
|
596
|
-
const
|
|
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 A.isValid &&
|
|
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
|
|
607
|
-
if (h(
|
|
606
|
+
const { errors: $e } = await X([l]);
|
|
607
|
+
if (h(N), f) {
|
|
608
608
|
const bt = st(r.errors, n, l), je = st($e, n, bt.name || l);
|
|
609
609
|
x = je.error, l = je.name, D = M($e);
|
|
610
610
|
}
|
|
611
611
|
} else
|
|
612
|
-
|
|
613
|
-
|
|
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
|
+
f && (c._f.deps && de(c._f.deps), le(l, D, x, ke));
|
|
614
614
|
}
|
|
615
|
-
},
|
|
616
|
-
if (
|
|
615
|
+
}, fe = (t, i) => {
|
|
616
|
+
if (d(r.errors, i) && t.focus)
|
|
617
617
|
return t.focus(), 1;
|
|
618
|
-
},
|
|
619
|
-
let l,
|
|
618
|
+
}, de = async (t, i = {}) => {
|
|
619
|
+
let l, f;
|
|
620
620
|
const c = _e(t);
|
|
621
621
|
if (s.resolver) {
|
|
622
|
-
const o = await
|
|
623
|
-
l = M(o),
|
|
622
|
+
const o = await Z(p(t) ? t : c);
|
|
623
|
+
l = M(o), f = t ? !c.some((h) => d(o, h)) : l;
|
|
624
624
|
} else
|
|
625
|
-
t ? (
|
|
626
|
-
const h =
|
|
625
|
+
t ? (f = (await Promise.all(c.map(async (o) => {
|
|
626
|
+
const h = d(n, o);
|
|
627
627
|
return await L(h && h._f ? { [o]: h } : h);
|
|
628
|
-
}))).every(Boolean), !(!
|
|
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
|
-
}), i.shouldFocus && !
|
|
634
|
-
},
|
|
633
|
+
}), i.shouldFocus && !f && he(n, fe, t ? c : g.mount), f;
|
|
634
|
+
}, Ne = (t) => {
|
|
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
|
-
invalid: !!
|
|
641
|
-
isDirty: !!
|
|
642
|
-
error:
|
|
643
|
-
isValidating: !!
|
|
644
|
-
isTouched: !!
|
|
640
|
+
invalid: !!d((i || r).errors, t),
|
|
641
|
+
isDirty: !!d((i || r).dirtyFields, t),
|
|
642
|
+
error: d((i || r).errors, t),
|
|
643
|
+
isValidating: !!d(r.validatingFields, t),
|
|
644
|
+
isTouched: !!d((i || r).touchedFields, t)
|
|
645
645
|
}), yt = (t) => {
|
|
646
646
|
t && _e(t).forEach((i) => k(r.errors, i)), _.state.next({
|
|
647
647
|
errors: t ? r.errors : {}
|
|
648
648
|
});
|
|
649
649
|
}, Ie = (t, i, l) => {
|
|
650
|
-
const
|
|
651
|
-
|
|
650
|
+
const f = (d(n, t, { _f: {} })._f || {}).ref, c = d(r.errors, t) || {}, { ref: o, message: h, type: x, ...D } = c;
|
|
651
|
+
F(r.errors, t, {
|
|
652
652
|
...D,
|
|
653
653
|
...i,
|
|
654
|
-
ref:
|
|
654
|
+
ref: f
|
|
655
655
|
}), _.state.next({
|
|
656
656
|
name: t,
|
|
657
657
|
errors: r.errors,
|
|
658
658
|
isValid: !1
|
|
659
|
-
}), l && l.shouldFocus &&
|
|
660
|
-
}, ht = (t, i) =>
|
|
659
|
+
}), l && l.shouldFocus && f && f.focus && f.focus();
|
|
660
|
+
}, ht = (t, i) => re(t) ? _.values.subscribe({
|
|
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)
|
|
@@ -667,16 +667,16 @@ function er(e = {}) {
|
|
|
667
667
|
}), _.state.next({
|
|
668
668
|
...r,
|
|
669
669
|
...i.keepDirty ? { isDirty: v() } : {}
|
|
670
|
-
}), !i.keepIsValid &&
|
|
671
|
-
}, qe = ({ disabled: t, name: i, field: l, fields:
|
|
672
|
-
if (
|
|
673
|
-
const o = t ? void 0 : p(c) ? Te(l ? l._f : f
|
|
674
|
-
|
|
670
|
+
}), !i.keepIsValid && B();
|
|
671
|
+
}, qe = ({ disabled: t, name: i, field: l, fields: f, value: c }) => {
|
|
672
|
+
if (te(t) && y.mount || t) {
|
|
673
|
+
const o = t ? void 0 : p(c) ? Te(l ? l._f : d(f, i)._f) : c;
|
|
674
|
+
F(a, i, o), Q(i, o, !1, !1, !0);
|
|
675
675
|
}
|
|
676
676
|
}, pe = (t, i = {}) => {
|
|
677
|
-
let l =
|
|
678
|
-
const
|
|
679
|
-
return
|
|
677
|
+
let l = d(n, t);
|
|
678
|
+
const f = te(i.disabled);
|
|
679
|
+
return F(n, t, {
|
|
680
680
|
...l || {},
|
|
681
681
|
_f: {
|
|
682
682
|
...l && l._f ? l._f : { ref: { name: t } },
|
|
@@ -689,8 +689,8 @@ function er(e = {}) {
|
|
|
689
689
|
disabled: i.disabled,
|
|
690
690
|
name: t,
|
|
691
691
|
value: i.value
|
|
692
|
-
}) :
|
|
693
|
-
...
|
|
692
|
+
}) : V(t, !0, i.value), {
|
|
693
|
+
...f ? { disabled: i.disabled } : {},
|
|
694
694
|
...s.progressive ? {
|
|
695
695
|
required: !!i.required,
|
|
696
696
|
min: ye(i.min),
|
|
@@ -704,42 +704,42 @@ function er(e = {}) {
|
|
|
704
704
|
onBlur: ce,
|
|
705
705
|
ref: (c) => {
|
|
706
706
|
if (c) {
|
|
707
|
-
pe(t, i), l =
|
|
707
|
+
pe(t, i), l = d(n, t);
|
|
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 ? {
|
|
715
715
|
refs: [
|
|
716
716
|
...x.filter(Be),
|
|
717
717
|
o,
|
|
718
|
-
...Array.isArray(
|
|
718
|
+
...Array.isArray(d(u, t)) ? [{}] : []
|
|
719
719
|
],
|
|
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
|
-
l =
|
|
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
|
}
|
|
727
727
|
};
|
|
728
|
-
}, Pe = () => s.shouldFocusError && he(n,
|
|
729
|
-
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
c.disabled =
|
|
728
|
+
}, Pe = () => s.shouldFocusError && he(n, fe, g.mount), gt = (t) => {
|
|
729
|
+
te(t) && (_.state.next({ disabled: t }), he(n, (i, l) => {
|
|
730
|
+
const f = d(n, l);
|
|
731
|
+
f && (i.disabled = f._f.disabled || t, Array.isArray(f._f.refs) && f._f.refs.forEach((c) => {
|
|
732
|
+
c.disabled = f._f.disabled || t;
|
|
733
733
|
}));
|
|
734
734
|
}, 0, !1));
|
|
735
735
|
}, We = (t, i) => async (l) => {
|
|
736
|
-
let
|
|
736
|
+
let f;
|
|
737
737
|
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
738
|
-
let c =
|
|
738
|
+
let c = P(a);
|
|
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
745
|
await L(n);
|
|
@@ -750,36 +750,36 @@ function er(e = {}) {
|
|
|
750
750
|
try {
|
|
751
751
|
await t(c, l);
|
|
752
752
|
} catch (o) {
|
|
753
|
-
|
|
753
|
+
f = o;
|
|
754
754
|
}
|
|
755
755
|
} else
|
|
756
756
|
i && await i({ ...r.errors }, l), Pe(), setTimeout(Pe);
|
|
757
757
|
if (_.state.next({
|
|
758
758
|
isSubmitted: !0,
|
|
759
759
|
isSubmitting: !1,
|
|
760
|
-
isSubmitSuccessful: M(r.errors) && !
|
|
760
|
+
isSubmitSuccessful: M(r.errors) && !f,
|
|
761
761
|
submitCount: r.submitCount + 1,
|
|
762
762
|
errors: r.errors
|
|
763
|
-
}),
|
|
764
|
-
throw
|
|
763
|
+
}), f)
|
|
764
|
+
throw f;
|
|
765
765
|
}, vt = (t, i = {}) => {
|
|
766
|
-
|
|
766
|
+
d(n, t) && (p(i.defaultValue) ? q(t, P(d(u, t))) : (q(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 ?
|
|
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
|
-
|
|
772
|
+
d(r.dirtyFields, h) ? F(o, h, d(a, h)) : q(h, d(o, h));
|
|
773
773
|
else {
|
|
774
774
|
if (Re && p(t))
|
|
775
775
|
for (const h of g.mount) {
|
|
776
|
-
const x =
|
|
776
|
+
const x = d(n, h);
|
|
777
777
|
if (x && x._f) {
|
|
778
778
|
const D = Array.isArray(x._f.refs) ? x._f.refs[0] : x._f.ref;
|
|
779
779
|
if (be(D)) {
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
782
|
-
|
|
780
|
+
const N = D.closest("form");
|
|
781
|
+
if (N) {
|
|
782
|
+
N.reset();
|
|
783
783
|
break;
|
|
784
784
|
}
|
|
785
785
|
}
|
|
@@ -787,7 +787,7 @@ function er(e = {}) {
|
|
|
787
787
|
}
|
|
788
788
|
n = {};
|
|
789
789
|
}
|
|
790
|
-
a = e.shouldUnregister ? i.keepDefaultValues ?
|
|
790
|
+
a = e.shouldUnregister ? i.keepDefaultValues ? P(u) : {} : P(o), _.array.next({
|
|
791
791
|
values: { ...o }
|
|
792
792
|
}), _.values.next({
|
|
793
793
|
values: { ...o }
|
|
@@ -810,7 +810,7 @@ function er(e = {}) {
|
|
|
810
810
|
isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
811
811
|
isSubmitting: !1
|
|
812
812
|
});
|
|
813
|
-
}, ze = (t, i) => He(
|
|
813
|
+
}, ze = (t, i) => He(re(t) ? t(a) : t, i);
|
|
814
814
|
return {
|
|
815
815
|
control: {
|
|
816
816
|
register: pe,
|
|
@@ -818,16 +818,16 @@ function er(e = {}) {
|
|
|
818
818
|
getFieldState: Ue,
|
|
819
819
|
handleSubmit: We,
|
|
820
820
|
setError: Ie,
|
|
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: qe,
|
|
828
828
|
_getFieldArray: w,
|
|
829
829
|
_reset: He,
|
|
830
|
-
_resetDefaultValues: () =>
|
|
830
|
+
_resetDefaultValues: () => re(s.defaultValues) && s.defaultValues().then((t) => {
|
|
831
831
|
ze(t, s.resetOptions), _.state.next({
|
|
832
832
|
isLoading: !1
|
|
833
833
|
});
|
|
@@ -841,7 +841,7 @@ function er(e = {}) {
|
|
|
841
841
|
_disableForm: gt,
|
|
842
842
|
_subjects: _,
|
|
843
843
|
_proxyFormState: A,
|
|
844
|
-
_setErrors:
|
|
844
|
+
_setErrors: O,
|
|
845
845
|
get _fields() {
|
|
846
846
|
return n;
|
|
847
847
|
},
|
|
@@ -879,21 +879,21 @@ function er(e = {}) {
|
|
|
879
879
|
};
|
|
880
880
|
}
|
|
881
881
|
},
|
|
882
|
-
trigger:
|
|
882
|
+
trigger: de,
|
|
883
883
|
register: pe,
|
|
884
884
|
handleSubmit: We,
|
|
885
885
|
watch: ht,
|
|
886
|
-
setValue:
|
|
887
|
-
getValues:
|
|
886
|
+
setValue: q,
|
|
887
|
+
getValues: Ne,
|
|
888
888
|
reset: ze,
|
|
889
889
|
resetField: vt,
|
|
890
890
|
clearErrors: yt,
|
|
891
891
|
unregister: we,
|
|
892
892
|
setError: Ie,
|
|
893
893
|
setFocus: (t, i = {}) => {
|
|
894
|
-
const l =
|
|
895
|
-
if (
|
|
896
|
-
const c =
|
|
894
|
+
const l = d(n, t), f = l && l._f;
|
|
895
|
+
if (f) {
|
|
896
|
+
const c = f.refs ? f.refs[0] : f.ref;
|
|
897
897
|
c.focus && (c.focus(), i.shouldSelect && c.select());
|
|
898
898
|
}
|
|
899
899
|
},
|
|
@@ -901,10 +901,10 @@ function er(e = {}) {
|
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
903
|
function tr(e = {}) {
|
|
904
|
-
const s =
|
|
904
|
+
const s = W.useRef(), r = W.useRef(), [n, u] = W.useState({
|
|
905
905
|
isDirty: !1,
|
|
906
906
|
isValidating: !1,
|
|
907
|
-
isLoading:
|
|
907
|
+
isLoading: re(e.defaultValues),
|
|
908
908
|
isSubmitted: !1,
|
|
909
909
|
isSubmitting: !1,
|
|
910
910
|
isSubmitSuccessful: !1,
|
|
@@ -915,7 +915,7 @@ function tr(e = {}) {
|
|
|
915
915
|
validatingFields: {},
|
|
916
916
|
errors: e.errors || {},
|
|
917
917
|
disabled: e.disabled || !1,
|
|
918
|
-
defaultValues:
|
|
918
|
+
defaultValues: re(e.defaultValues) ? void 0 : e.defaultValues
|
|
919
919
|
});
|
|
920
920
|
s.current || (s.current = {
|
|
921
921
|
...er(e),
|
|
@@ -927,20 +927,20 @@ function tr(e = {}) {
|
|
|
927
927
|
next: (y) => {
|
|
928
928
|
Pt(y, a._proxyFormState, a._updateFormState) && u({ ...a._formState });
|
|
929
929
|
}
|
|
930
|
-
}),
|
|
930
|
+
}), W.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), W.useEffect(() => {
|
|
931
931
|
if (a._proxyFormState.isDirty) {
|
|
932
932
|
const y = a._getDirty();
|
|
933
933
|
y !== n.isDirty && a._subjects.state.next({
|
|
934
934
|
isDirty: y
|
|
935
935
|
});
|
|
936
936
|
}
|
|
937
|
-
}, [a, n.isDirty]),
|
|
937
|
+
}, [a, n.isDirty]), W.useEffect(() => {
|
|
938
938
|
e.values && !se(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values, u((y) => ({ ...y }))) : a._resetDefaultValues();
|
|
939
|
-
}, [e.values, a]),
|
|
939
|
+
}, [e.values, a]), W.useEffect(() => {
|
|
940
940
|
e.errors && a._setErrors(e.errors);
|
|
941
|
-
}, [e.errors, a]),
|
|
941
|
+
}, [e.errors, a]), W.useEffect(() => {
|
|
942
942
|
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
943
|
-
}),
|
|
943
|
+
}), W.useEffect(() => {
|
|
944
944
|
e.shouldUnregister && a._subjects.values.next({
|
|
945
945
|
values: a._getWatch()
|
|
946
946
|
});
|
|
@@ -949,73 +949,71 @@ function tr(e = {}) {
|
|
|
949
949
|
const it = `Я принимаю условия Политики обработки
|
|
950
950
|
и защиты персональных данных, даю согласия на обработку персональных
|
|
951
951
|
данных`, _r = ({
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
advCheckBox: R = { text: it, isRequired: !0 }
|
|
952
|
+
isFormOpen: e,
|
|
953
|
+
setIsFormOpen: s,
|
|
954
|
+
title: r,
|
|
955
|
+
isEmail: n,
|
|
956
|
+
isPhone: u,
|
|
957
|
+
isTextArea: a,
|
|
958
|
+
isRequiredPhone: y = !0,
|
|
959
|
+
isRequiredEmail: g = !1,
|
|
960
|
+
isRequiredPhoneOrEmail: R,
|
|
961
|
+
textAreaPlaceholder: I,
|
|
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 }
|
|
969
968
|
}) => {
|
|
970
969
|
const {
|
|
971
|
-
register:
|
|
972
|
-
handleSubmit:
|
|
973
|
-
trigger:
|
|
974
|
-
reset:
|
|
975
|
-
watch:
|
|
976
|
-
formState: { errors:
|
|
977
|
-
} = tr(),
|
|
978
|
-
required:
|
|
970
|
+
register: B,
|
|
971
|
+
handleSubmit: K,
|
|
972
|
+
trigger: m,
|
|
973
|
+
reset: H,
|
|
974
|
+
watch: O,
|
|
975
|
+
formState: { errors: V }
|
|
976
|
+
} = tr(), Q = !!O("email"), { onChange: le, onBlur: X, ...Z } = B("phone", {
|
|
977
|
+
required: y || R ? !Q : !0,
|
|
979
978
|
pattern: { value: wt, message: "" },
|
|
980
|
-
onBlur: () =>
|
|
981
|
-
}), { isMobile:
|
|
982
|
-
|
|
979
|
+
onBlur: () => m("phone")
|
|
980
|
+
}), { isMobile: L, currentClientWidth: ae } = St(), v = O("personalCheckBox"), b = O("advCheckBox"), w = (E) => {
|
|
981
|
+
_(E), H();
|
|
983
982
|
};
|
|
984
|
-
return
|
|
983
|
+
return ae ? /* @__PURE__ */ U(
|
|
985
984
|
Vt,
|
|
986
985
|
{
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
additionalClass: Z.modal,
|
|
986
|
+
isOpen: e,
|
|
987
|
+
emitIsOpen: () => s(!1),
|
|
988
|
+
additionalClass: ee.modal,
|
|
991
989
|
opacity: 0.7,
|
|
992
990
|
isTransparentBack: !0,
|
|
993
|
-
additionalClassModalBody:
|
|
991
|
+
additionalClassModalBody: ee.modalBody,
|
|
994
992
|
children: /* @__PURE__ */ Se(
|
|
995
993
|
"div",
|
|
996
994
|
{
|
|
997
|
-
className:
|
|
998
|
-
style: { width:
|
|
995
|
+
className: ee.root,
|
|
996
|
+
style: { width: L ? "100%" : ie },
|
|
999
997
|
children: [
|
|
1000
|
-
/* @__PURE__ */
|
|
998
|
+
/* @__PURE__ */ U(
|
|
1001
999
|
"div",
|
|
1002
1000
|
{
|
|
1003
|
-
className:
|
|
1004
|
-
dangerouslySetInnerHTML: { __html:
|
|
1001
|
+
className: ee.title,
|
|
1002
|
+
dangerouslySetInnerHTML: { __html: r ?? "Оставить обращение" }
|
|
1005
1003
|
}
|
|
1006
1004
|
),
|
|
1007
|
-
/* @__PURE__ */
|
|
1005
|
+
/* @__PURE__ */ U(
|
|
1008
1006
|
"div",
|
|
1009
1007
|
{
|
|
1010
|
-
className:
|
|
1008
|
+
className: ee.description,
|
|
1011
1009
|
dangerouslySetInnerHTML: {
|
|
1012
|
-
__html:
|
|
1010
|
+
__html: A ?? "Оставьте номер телефона для получения консультации"
|
|
1013
1011
|
}
|
|
1014
1012
|
}
|
|
1015
1013
|
),
|
|
1016
|
-
/* @__PURE__ */ Se("form", { onSubmit:
|
|
1017
|
-
/* @__PURE__ */ Se(Ft, { className:
|
|
1018
|
-
/* @__PURE__ */
|
|
1014
|
+
/* @__PURE__ */ Se("form", { onSubmit: K(w), children: [
|
|
1015
|
+
/* @__PURE__ */ Se(Ft, { className: ee.inputWrapper, children: [
|
|
1016
|
+
/* @__PURE__ */ U(
|
|
1019
1017
|
Ee,
|
|
1020
1018
|
{
|
|
1021
1019
|
width: "full",
|
|
@@ -1023,20 +1021,20 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1023
1021
|
variant: "light",
|
|
1024
1022
|
placeholder: "Введите имя",
|
|
1025
1023
|
"data-testid": "modal_name",
|
|
1026
|
-
...
|
|
1027
|
-
error: !!
|
|
1024
|
+
...B("name", { required: !0, pattern: pt }),
|
|
1025
|
+
error: !!V.name
|
|
1028
1026
|
}
|
|
1029
1027
|
),
|
|
1030
|
-
|
|
1028
|
+
u && /* @__PURE__ */ U(
|
|
1031
1029
|
xt,
|
|
1032
1030
|
{
|
|
1033
1031
|
inputMode: "numeric",
|
|
1034
1032
|
name: "phone",
|
|
1035
1033
|
mask: "+7 (999) 999-99-99",
|
|
1036
|
-
onChange:
|
|
1034
|
+
onChange: le,
|
|
1037
1035
|
placeholder: "+7 (- - -) - - - - - - -",
|
|
1038
|
-
onBlur:
|
|
1039
|
-
children: /* @__PURE__ */
|
|
1036
|
+
onBlur: X,
|
|
1037
|
+
children: /* @__PURE__ */ U(
|
|
1040
1038
|
Ee,
|
|
1041
1039
|
{
|
|
1042
1040
|
width: "full",
|
|
@@ -1044,14 +1042,14 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1044
1042
|
type: "tel",
|
|
1045
1043
|
size_s: "small",
|
|
1046
1044
|
variant: "light",
|
|
1047
|
-
...
|
|
1048
|
-
...
|
|
1049
|
-
error: !!
|
|
1045
|
+
...Z,
|
|
1046
|
+
...B("phone"),
|
|
1047
|
+
error: !!V.phone
|
|
1050
1048
|
}
|
|
1051
1049
|
)
|
|
1052
1050
|
}
|
|
1053
1051
|
),
|
|
1054
|
-
|
|
1052
|
+
n && /* @__PURE__ */ U(
|
|
1055
1053
|
Ee,
|
|
1056
1054
|
{
|
|
1057
1055
|
width: "full",
|
|
@@ -1059,44 +1057,44 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1059
1057
|
variant: "light",
|
|
1060
1058
|
placeholder: "Введите email",
|
|
1061
1059
|
"data-testid": "modal_email",
|
|
1062
|
-
...
|
|
1063
|
-
required:
|
|
1060
|
+
...B("email", {
|
|
1061
|
+
required: g || R ? Q : !1,
|
|
1064
1062
|
pattern: Dt
|
|
1065
1063
|
}),
|
|
1066
|
-
error: !!
|
|
1064
|
+
error: !!V.email
|
|
1067
1065
|
}
|
|
1068
1066
|
),
|
|
1069
|
-
|
|
1067
|
+
a && /* @__PURE__ */ U(
|
|
1070
1068
|
kt,
|
|
1071
1069
|
{
|
|
1072
1070
|
"data-testid": "modal_textarea",
|
|
1073
|
-
placeholder:
|
|
1074
|
-
rows:
|
|
1071
|
+
placeholder: I,
|
|
1072
|
+
rows: j,
|
|
1075
1073
|
width: "full",
|
|
1076
|
-
...
|
|
1074
|
+
...B("textarea")
|
|
1077
1075
|
}
|
|
1078
1076
|
),
|
|
1079
|
-
|
|
1077
|
+
J && /* @__PURE__ */ U(
|
|
1080
1078
|
Ge,
|
|
1081
1079
|
{
|
|
1082
1080
|
"data-testid": "modal_advCheckBox",
|
|
1083
|
-
isChecked:
|
|
1084
|
-
error: !!
|
|
1085
|
-
text:
|
|
1086
|
-
...
|
|
1081
|
+
isChecked: b,
|
|
1082
|
+
error: !!V.advCheckBox,
|
|
1083
|
+
text: J.text,
|
|
1084
|
+
...B("advCheckBox", { required: J == null ? void 0 : J.isRequired })
|
|
1087
1085
|
}
|
|
1088
1086
|
),
|
|
1089
|
-
/* @__PURE__ */
|
|
1087
|
+
/* @__PURE__ */ U(
|
|
1090
1088
|
Ge,
|
|
1091
1089
|
{
|
|
1092
1090
|
"data-testid": "modal_personalCheckBox",
|
|
1093
|
-
isChecked:
|
|
1094
|
-
error: !!
|
|
1095
|
-
text:
|
|
1096
|
-
...
|
|
1091
|
+
isChecked: v,
|
|
1092
|
+
error: !!V.personalCheckBox,
|
|
1093
|
+
text: C.text,
|
|
1094
|
+
...B("personalCheckBox", { required: C.isRequired })
|
|
1097
1095
|
}
|
|
1098
1096
|
),
|
|
1099
|
-
/* @__PURE__ */
|
|
1097
|
+
/* @__PURE__ */ U(
|
|
1100
1098
|
Ke,
|
|
1101
1099
|
{
|
|
1102
1100
|
"data-testid": "modal_submit",
|
|
@@ -1105,21 +1103,21 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1105
1103
|
type: "submit",
|
|
1106
1104
|
size: "large",
|
|
1107
1105
|
as: "button",
|
|
1108
|
-
additionalClass:
|
|
1106
|
+
additionalClass: ee.modalBtn,
|
|
1109
1107
|
children: "Отправить"
|
|
1110
1108
|
}
|
|
1111
1109
|
)
|
|
1112
1110
|
] }),
|
|
1113
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ U(
|
|
1114
1112
|
Ke,
|
|
1115
1113
|
{
|
|
1116
|
-
additionalClass:
|
|
1117
|
-
onClick: () =>
|
|
1114
|
+
additionalClass: ee.btn,
|
|
1115
|
+
onClick: () => s(!1),
|
|
1118
1116
|
as: "button",
|
|
1119
1117
|
variant: "gray",
|
|
1120
1118
|
type: "button",
|
|
1121
1119
|
size: "small",
|
|
1122
|
-
children: /* @__PURE__ */
|
|
1120
|
+
children: /* @__PURE__ */ U(
|
|
1123
1121
|
At,
|
|
1124
1122
|
{
|
|
1125
1123
|
name: "close",
|