stone-kit 0.0.1034 → 0.0.1036
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/Option-DI87iJMM.js +98 -0
- package/dist/components/CommercialLotCard/CommercialLotCard.js +25 -25
- package/dist/components/CommercialLotCard/components/Price/Price.js +21 -21
- package/dist/components/CommercialLotCard/utils/formatPrice.js +1 -1
- package/dist/components/FilterWithSave/ui/FilterWithSave.js +1 -1
- package/dist/components/FormModal/ui/ModalForm.d.ts +1 -1
- package/dist/components/FormModal/ui/ModalForm.js +278 -276
- package/dist/components/LotCard/hooks/useLotCard.js +1 -1
- package/dist/components/LotCard/ui/LotCard.d.ts +1 -1
- package/dist/components/LotCard/ui/LotCard.js +33 -33
- package/dist/components/LotCard/utils/formatPrice.js +1 -1
- package/dist/components/NewIcon/ui/NewIcon.js +48 -43
- package/dist/components/Select/ui/Category.js +27 -27
- package/dist/components/Select/ui/Option.js +1 -1
- package/dist/components/Select/ui/Select.d.ts +1 -1
- package/dist/components/Select/ui/Select.js +128 -114
- package/dist/components/Select/ui/Select.types.d.ts +2 -0
- package/dist/components/SummarySelect/ui/SummarySelect.d.ts +3 -0
- package/dist/components/SummarySelect/ui/SummarySelect.js +141 -101
- package/dist/stone-kit.css +1 -1
- package/dist/useLotCard-DPqIlj09.js +187 -0
- package/package.json +1 -1
- package/dist/Option-D-8xnCui.js +0 -94
- package/dist/useLotCard-I7_rgnqj.js +0 -187
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as L, jsxs as de } from "react/jsx-runtime";
|
|
2
|
-
import v, { useEffect as
|
|
2
|
+
import v, { useEffect as Ne } from "react";
|
|
3
3
|
import { nameReg as Rt, phoneReg as Lt, emailReg as Ot } from "../utils/reg.js";
|
|
4
|
-
import { TextArea as
|
|
5
|
-
import { c as
|
|
4
|
+
import { TextArea as Nt } from "../../TextArea/TextArea.js";
|
|
5
|
+
import { c as Mt } from "../../../index-YnD2EP-S.js";
|
|
6
6
|
import { useClientWidth as Ut } from "../../../shared/useClientWidth.js";
|
|
7
7
|
import { Modal as It } from "../../Modal/ui/Modal.js";
|
|
8
8
|
import { NewIcon as tt } from "../../NewIcon/ui/NewIcon.js";
|
|
9
9
|
import { Flex as Pt } from "../../Flex/ui/Flex.js";
|
|
10
|
-
import { Input as
|
|
10
|
+
import { Input as Me } from "../../Input/ui/Input.js";
|
|
11
11
|
import { CheckBox as rt } from "../../CheckBox/CheckBox.js";
|
|
12
12
|
import { Button as st } from "../../Button/ui/Button.js";
|
|
13
13
|
const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt = "_root_ky28a_21", $t = "_title_ky28a_34", jt = "_description_ky28a_41", Gt = "_inputWrapper_ky28a_48", Kt = "_linkPolicy_ky28a_55", Jt = "_telegramLink_ky28a_60", Qt = "_telegramWrapper_ky28a_65", Xt = "_telegram_ky28a_60", Zt = "_orText_ky28a_88", Yt = "_checkboxText_ky28a_116", U = {
|
|
@@ -25,9 +25,9 @@ const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt
|
|
|
25
25
|
orText: Zt,
|
|
26
26
|
checkboxText: Yt
|
|
27
27
|
};
|
|
28
|
-
var Fe = (e) => e.type === "checkbox", ye = (e) => e instanceof Date,
|
|
28
|
+
var Fe = (e) => e.type === "checkbox", ye = (e) => e instanceof Date, X = (e) => e == null;
|
|
29
29
|
const mt = (e) => typeof e == "object";
|
|
30
|
-
var P = (e) => !
|
|
30
|
+
var P = (e) => !X(e) && !Array.isArray(e) && mt(e) && !ye(e), _t = (e) => P(e) && e.target ? Fe(e.target) ? e.target.checked : e.target.value : e, er = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, gt = (e, s) => e.has(er(s)), tr = (e) => {
|
|
31
31
|
const s = e.constructor && e.constructor.prototype;
|
|
32
32
|
return P(s) && s.hasOwnProperty("isPrototypeOf");
|
|
33
33
|
}, qe = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
@@ -49,12 +49,12 @@ function W(e) {
|
|
|
49
49
|
var Ee = (e) => /^\w*$/.test(e), O = (e) => e === void 0, He = (e) => Array.isArray(e) ? e.filter(Boolean) : [], ze = (e) => He(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
|
|
50
50
|
if (!s || !P(e))
|
|
51
51
|
return t;
|
|
52
|
-
const i = (Ee(s) ? [s] : ze(s)).reduce((o,
|
|
52
|
+
const i = (Ee(s) ? [s] : ze(s)).reduce((o, n) => X(o) ? o : o[n], e);
|
|
53
53
|
return O(i) || i === e ? O(e[s]) ? t : e[s] : i;
|
|
54
54
|
}, Z = (e) => typeof e == "boolean", B = (e, s, t) => {
|
|
55
55
|
let i = -1;
|
|
56
|
-
const o = Ee(s) ? [s] : ze(s),
|
|
57
|
-
for (; ++i <
|
|
56
|
+
const o = Ee(s) ? [s] : ze(s), n = o.length, c = n - 1;
|
|
57
|
+
for (; ++i < n; ) {
|
|
58
58
|
const d = o[i];
|
|
59
59
|
let D = t;
|
|
60
60
|
if (i !== c) {
|
|
@@ -91,10 +91,10 @@ var bt = (e, s, t, i = !0) => {
|
|
|
91
91
|
const o = {
|
|
92
92
|
defaultValues: s._defaultValues
|
|
93
93
|
};
|
|
94
|
-
for (const
|
|
95
|
-
Object.defineProperty(o,
|
|
94
|
+
for (const n in e)
|
|
95
|
+
Object.defineProperty(o, n, {
|
|
96
96
|
get: () => {
|
|
97
|
-
const c =
|
|
97
|
+
const c = n;
|
|
98
98
|
return s._proxyFormState[c] !== ie.all && (s._proxyFormState[c] = !i || ie.all), t && (t[c] = !0), e[c];
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -102,7 +102,7 @@ var bt = (e, s, t, i = !0) => {
|
|
|
102
102
|
};
|
|
103
103
|
const je = typeof window < "u" ? v.useLayoutEffect : v.useEffect;
|
|
104
104
|
function rr(e) {
|
|
105
|
-
const s = $e(), { control: t = s.control, disabled: i, name: o, exact:
|
|
105
|
+
const s = $e(), { control: t = s.control, disabled: i, name: o, exact: n } = e || {}, [c, d] = v.useState(t._formState), D = v.useRef({
|
|
106
106
|
isDirty: !1,
|
|
107
107
|
isLoading: !1,
|
|
108
108
|
dirtyFields: !1,
|
|
@@ -115,18 +115,18 @@ function rr(e) {
|
|
|
115
115
|
return je(() => t._subscribe({
|
|
116
116
|
name: o,
|
|
117
117
|
formState: D.current,
|
|
118
|
-
exact:
|
|
118
|
+
exact: n,
|
|
119
119
|
callback: (w) => {
|
|
120
120
|
!i && d({
|
|
121
121
|
...t._formState,
|
|
122
122
|
...w
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
}), [o, i,
|
|
125
|
+
}), [o, i, n]), v.useEffect(() => {
|
|
126
126
|
D.current.isValid && t._setValid(!0);
|
|
127
127
|
}, [t]), v.useMemo(() => bt(c, t, D.current, !1), [c, t]);
|
|
128
128
|
}
|
|
129
|
-
var Y = (e) => typeof e == "string", Ie = (e, s, t, i, o) => Y(e) ? (i && s.watch.add(e), y(t, e, o)) : Array.isArray(e) ? e.map((
|
|
129
|
+
var Y = (e) => typeof e == "string", Ie = (e, s, t, i, o) => Y(e) ? (i && s.watch.add(e), y(t, e, o)) : Array.isArray(e) ? e.map((n) => (i && s.watch.add(n), y(t, n))) : (i && (s.watchAll = !0), t), Pe = (e) => X(e) || !mt(e);
|
|
130
130
|
function ae(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
131
131
|
if (Pe(e) || Pe(s))
|
|
132
132
|
return e === s;
|
|
@@ -138,12 +138,12 @@ function ae(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
138
138
|
if (t.has(e) || t.has(s))
|
|
139
139
|
return !0;
|
|
140
140
|
t.add(e), t.add(s);
|
|
141
|
-
for (const
|
|
142
|
-
const c = e[
|
|
143
|
-
if (!o.includes(
|
|
141
|
+
for (const n of i) {
|
|
142
|
+
const c = e[n];
|
|
143
|
+
if (!o.includes(n))
|
|
144
144
|
return !1;
|
|
145
|
-
if (
|
|
146
|
-
const d = s[
|
|
145
|
+
if (n !== "ref") {
|
|
146
|
+
const d = s[n];
|
|
147
147
|
if (ye(c) && ye(d) || P(c) && P(d) || Array.isArray(c) && Array.isArray(d) ? !ae(c, d, t) : c !== d)
|
|
148
148
|
return !1;
|
|
149
149
|
}
|
|
@@ -151,7 +151,7 @@ function ae(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
|
151
151
|
return !0;
|
|
152
152
|
}
|
|
153
153
|
function sr(e) {
|
|
154
|
-
const s = $e(), { control: t = s.control, name: i, defaultValue: o, disabled:
|
|
154
|
+
const s = $e(), { control: t = s.control, name: i, defaultValue: o, disabled: n, exact: c, compute: d } = e || {}, D = v.useRef(o), w = v.useRef(d), g = v.useRef(void 0), x = v.useRef(t), _ = v.useRef(i);
|
|
155
155
|
w.current = d;
|
|
156
156
|
const [ee, H] = v.useState(() => {
|
|
157
157
|
const F = t._getWatch(i, D.current);
|
|
@@ -159,8 +159,8 @@ function sr(e) {
|
|
|
159
159
|
}), S = v.useCallback((F) => {
|
|
160
160
|
const V = Ie(i, t._names, F || t._formValues, !1, D.current);
|
|
161
161
|
return w.current ? w.current(V) : V;
|
|
162
|
-
}, [t._formValues, t._names, i]),
|
|
163
|
-
if (!
|
|
162
|
+
}, [t._formValues, t._names, i]), M = v.useCallback((F) => {
|
|
163
|
+
if (!n) {
|
|
164
164
|
const V = Ie(i, t._names, F || t._formValues, !1, D.current);
|
|
165
165
|
if (w.current) {
|
|
166
166
|
const z = w.current(V);
|
|
@@ -168,27 +168,27 @@ function sr(e) {
|
|
|
168
168
|
} else
|
|
169
169
|
H(V);
|
|
170
170
|
}
|
|
171
|
-
}, [t._formValues, t._names,
|
|
172
|
-
je(() => ((x.current !== t || !ae(_.current, i)) && (x.current = t, _.current = i,
|
|
171
|
+
}, [t._formValues, t._names, n, i]);
|
|
172
|
+
je(() => ((x.current !== t || !ae(_.current, i)) && (x.current = t, _.current = i, M()), t._subscribe({
|
|
173
173
|
name: i,
|
|
174
174
|
formState: {
|
|
175
175
|
values: !0
|
|
176
176
|
},
|
|
177
177
|
exact: c,
|
|
178
178
|
callback: (F) => {
|
|
179
|
-
|
|
179
|
+
M(F.values);
|
|
180
180
|
}
|
|
181
|
-
})), [t, c, i,
|
|
181
|
+
})), [t, c, i, M]), v.useEffect(() => t._removeUnmounted());
|
|
182
182
|
const te = x.current !== t, b = _.current, C = v.useMemo(() => {
|
|
183
|
-
if (
|
|
183
|
+
if (n)
|
|
184
184
|
return null;
|
|
185
185
|
const F = !te && !ae(b, i);
|
|
186
186
|
return te || F ? S() : null;
|
|
187
|
-
}, [
|
|
187
|
+
}, [n, te, i, b, S]);
|
|
188
188
|
return C !== null ? C : ee;
|
|
189
189
|
}
|
|
190
190
|
function ir(e) {
|
|
191
|
-
const s = $e(), { name: t, disabled: i, control: o = s.control, shouldUnregister:
|
|
191
|
+
const s = $e(), { name: t, disabled: i, control: o = s.control, shouldUnregister: n, defaultValue: c } = e, d = gt(o._names.array, t), D = v.useMemo(() => y(o._formValues, t, y(o._defaultValues, t, c)), [o, t, c]), w = sr({
|
|
192
192
|
control: o,
|
|
193
193
|
name: t,
|
|
194
194
|
defaultValue: D,
|
|
@@ -230,7 +230,7 @@ function ir(e) {
|
|
|
230
230
|
name: t
|
|
231
231
|
},
|
|
232
232
|
type: Ce.CHANGE
|
|
233
|
-
}), [t]),
|
|
233
|
+
}), [t]), M = v.useCallback(() => ee.current.onBlur({
|
|
234
234
|
target: {
|
|
235
235
|
value: y(o._formValues, t),
|
|
236
236
|
name: t
|
|
@@ -249,18 +249,18 @@ function ir(e) {
|
|
|
249
249
|
value: w,
|
|
250
250
|
...Z(i) || g.disabled ? { disabled: g.disabled || i } : {},
|
|
251
251
|
onChange: S,
|
|
252
|
-
onBlur:
|
|
252
|
+
onBlur: M,
|
|
253
253
|
ref: te
|
|
254
|
-
}), [t, i, g.disabled, S,
|
|
254
|
+
}), [t, i, g.disabled, S, M, te, w]);
|
|
255
255
|
return v.useEffect(() => {
|
|
256
|
-
const C = o._options.shouldUnregister ||
|
|
256
|
+
const C = o._options.shouldUnregister || n, F = _.current;
|
|
257
257
|
F && F !== t && !d && o.unregister(F), o.register(t, {
|
|
258
258
|
...x.current.rules,
|
|
259
259
|
...Z(x.current.disabled) ? { disabled: x.current.disabled } : {}
|
|
260
260
|
});
|
|
261
261
|
const V = (z, j) => {
|
|
262
|
-
const
|
|
263
|
-
|
|
262
|
+
const G = y(o._fields, z);
|
|
263
|
+
G && G._f && (G._f.mount = j);
|
|
264
264
|
};
|
|
265
265
|
if (V(t, !0), C) {
|
|
266
266
|
const z = W(y(o._options.defaultValues, t, x.current.defaultValue));
|
|
@@ -269,7 +269,7 @@ function ir(e) {
|
|
|
269
269
|
return !d && o.register(t), _.current = t, () => {
|
|
270
270
|
(d ? C && !o._state.action : C) ? o.unregister(t) : V(t, !1);
|
|
271
271
|
};
|
|
272
|
-
}, [t, o, d,
|
|
272
|
+
}, [t, o, d, n]), v.useEffect(() => {
|
|
273
273
|
o._setDisabledField({
|
|
274
274
|
disabled: i,
|
|
275
275
|
name: t
|
|
@@ -281,7 +281,7 @@ function ir(e) {
|
|
|
281
281
|
}), [b, g, H]);
|
|
282
282
|
}
|
|
283
283
|
const ar = (e) => e.render(ir(e));
|
|
284
|
-
var
|
|
284
|
+
var nr = (e, s, t, i, o) => s ? {
|
|
285
285
|
...t[e],
|
|
286
286
|
types: {
|
|
287
287
|
...t[e] && t[e].types ? t[e].types : {},
|
|
@@ -294,12 +294,12 @@ var lr = (e, s, t, i, o) => s ? {
|
|
|
294
294
|
return e;
|
|
295
295
|
},
|
|
296
296
|
next: (o) => {
|
|
297
|
-
for (const
|
|
298
|
-
|
|
297
|
+
for (const n of e)
|
|
298
|
+
n.next && n.next(o);
|
|
299
299
|
},
|
|
300
300
|
subscribe: (o) => (e.push(o), {
|
|
301
301
|
unsubscribe: () => {
|
|
302
|
-
e = e.filter((
|
|
302
|
+
e = e.filter((n) => n !== o);
|
|
303
303
|
}
|
|
304
304
|
}),
|
|
305
305
|
unsubscribe: () => {
|
|
@@ -311,20 +311,20 @@ function Vt(e, s) {
|
|
|
311
311
|
const t = {};
|
|
312
312
|
for (const i in e)
|
|
313
313
|
if (e.hasOwnProperty(i)) {
|
|
314
|
-
const o = e[i],
|
|
315
|
-
if (o && P(o) &&
|
|
316
|
-
const c = Vt(o,
|
|
314
|
+
const o = e[i], n = s[i];
|
|
315
|
+
if (o && P(o) && n) {
|
|
316
|
+
const c = Vt(o, n);
|
|
317
317
|
P(c) && (t[i] = c);
|
|
318
|
-
} else e[i] && (t[i] =
|
|
318
|
+
} else e[i] && (t[i] = n);
|
|
319
319
|
}
|
|
320
320
|
return t;
|
|
321
321
|
}
|
|
322
|
-
var
|
|
322
|
+
var Q = (e) => P(e) && !Object.keys(e).length, Ge = (e) => e.type === "file", ne = (e) => typeof e == "function", De = (e) => {
|
|
323
323
|
if (!qe)
|
|
324
324
|
return !1;
|
|
325
325
|
const s = e ? e.ownerDocument : 0;
|
|
326
326
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
327
|
-
}, kt = (e) => e.type === "select-multiple", Ke = (e) => e.type === "radio",
|
|
327
|
+
}, kt = (e) => e.type === "select-multiple", Ke = (e) => e.type === "radio", lr = (e) => Ke(e) || Fe(e), Ue = (e) => De(e) && e.isConnected;
|
|
328
328
|
function or(e, s) {
|
|
329
329
|
const t = s.slice(0, -1).length;
|
|
330
330
|
let i = 0;
|
|
@@ -339,12 +339,12 @@ function ur(e) {
|
|
|
339
339
|
return !0;
|
|
340
340
|
}
|
|
341
341
|
function I(e, s) {
|
|
342
|
-
const t = Array.isArray(s) ? s : Ee(s) ? [s] : ze(s), i = t.length === 1 ? e : or(e, t), o = t.length - 1,
|
|
343
|
-
return i && delete i[
|
|
342
|
+
const t = Array.isArray(s) ? s : Ee(s) ? [s] : ze(s), i = t.length === 1 ? e : or(e, t), o = t.length - 1, n = t[o];
|
|
343
|
+
return i && delete i[n], o !== 0 && (P(i) && Q(i) || Array.isArray(i) && ur(i)) && I(e, t.slice(0, -1)), e;
|
|
344
344
|
}
|
|
345
345
|
var cr = (e) => {
|
|
346
346
|
for (const s in e)
|
|
347
|
-
if (
|
|
347
|
+
if (ne(e[s]))
|
|
348
348
|
return !0;
|
|
349
349
|
return !1;
|
|
350
350
|
};
|
|
@@ -359,13 +359,13 @@ function We(e, s = {}) {
|
|
|
359
359
|
function ge(e, s, t) {
|
|
360
360
|
t || (t = We(s));
|
|
361
361
|
for (const i in e)
|
|
362
|
-
xt(e[i]) ? O(s) || Pe(t[i]) ? t[i] = We(e[i], Array.isArray(e[i]) ? [] : {}) : ge(e[i],
|
|
362
|
+
xt(e[i]) ? O(s) || Pe(t[i]) ? t[i] = We(e[i], Array.isArray(e[i]) ? [] : {}) : ge(e[i], X(s) ? {} : s[i], t[i]) : t[i] = !ae(e[i], s[i]);
|
|
363
363
|
return t;
|
|
364
364
|
}
|
|
365
365
|
const at = {
|
|
366
366
|
value: !1,
|
|
367
367
|
isValid: !1
|
|
368
|
-
},
|
|
368
|
+
}, nt = { value: !0, isValid: !0 };
|
|
369
369
|
var Ft = (e) => {
|
|
370
370
|
if (Array.isArray(e)) {
|
|
371
371
|
if (e.length > 1) {
|
|
@@ -374,28 +374,28 @@ var Ft = (e) => {
|
|
|
374
374
|
}
|
|
375
375
|
return e[0].checked && !e[0].disabled ? (
|
|
376
376
|
// @ts-expect-error expected to work in the browser
|
|
377
|
-
e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ?
|
|
377
|
+
e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ? nt : { value: e[0].value, isValid: !0 } : nt
|
|
378
378
|
) : at;
|
|
379
379
|
}
|
|
380
380
|
return at;
|
|
381
381
|
}, pt = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: i }) => O(e) ? e : s ? e === "" ? NaN : e && +e : t && Y(e) ? new Date(e) : i ? i(e) : e;
|
|
382
|
-
const
|
|
382
|
+
const lt = {
|
|
383
383
|
isValid: !1,
|
|
384
384
|
value: null
|
|
385
385
|
};
|
|
386
386
|
var At = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
|
|
387
387
|
isValid: !0,
|
|
388
388
|
value: t.value
|
|
389
|
-
} : s,
|
|
389
|
+
} : s, lt) : lt;
|
|
390
390
|
function ot(e) {
|
|
391
391
|
const s = e.ref;
|
|
392
392
|
return Ge(s) ? s.files : Ke(s) ? At(e.refs).value : kt(s) ? [...s.selectedOptions].map(({ value: t }) => t) : Fe(s) ? Ft(e.refs).value : pt(O(s.value) ? e.ref.value : s.value, e);
|
|
393
393
|
}
|
|
394
394
|
var dr = (e, s, t, i) => {
|
|
395
395
|
const o = {};
|
|
396
|
-
for (const
|
|
397
|
-
const c = y(s,
|
|
398
|
-
c && B(o,
|
|
396
|
+
for (const n of e) {
|
|
397
|
+
const c = y(s, n);
|
|
398
|
+
c && B(o, n, c._f);
|
|
399
399
|
}
|
|
400
400
|
return {
|
|
401
401
|
criteriaMode: t,
|
|
@@ -411,12 +411,12 @@ var dr = (e, s, t, i) => {
|
|
|
411
411
|
isOnTouch: e === ie.onTouched
|
|
412
412
|
});
|
|
413
413
|
const ct = "AsyncFunction";
|
|
414
|
-
var fr = (e) => !!e && !!e.validate && !!(
|
|
414
|
+
var fr = (e) => !!e && !!e.validate && !!(ne(e.validate) && e.validate.constructor.name === ct || P(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === ct)), yr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), dt = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
|
|
415
415
|
const xe = (e, s, t, i) => {
|
|
416
416
|
for (const o of t || Object.keys(e)) {
|
|
417
|
-
const
|
|
418
|
-
if (
|
|
419
|
-
const { _f: c, ...d } =
|
|
417
|
+
const n = y(e, o);
|
|
418
|
+
if (n) {
|
|
419
|
+
const { _f: c, ...d } = n;
|
|
420
420
|
if (c) {
|
|
421
421
|
if (c.refs && c.refs[0] && s(c.refs[0], o) && !i)
|
|
422
422
|
return !0;
|
|
@@ -438,17 +438,17 @@ function ft(e, s, t) {
|
|
|
438
438
|
};
|
|
439
439
|
const o = t.split(".");
|
|
440
440
|
for (; o.length; ) {
|
|
441
|
-
const
|
|
442
|
-
if (c && !Array.isArray(c) && t !==
|
|
441
|
+
const n = o.join("."), c = y(s, n), d = y(e, n);
|
|
442
|
+
if (c && !Array.isArray(c) && t !== n)
|
|
443
443
|
return { name: t };
|
|
444
444
|
if (d && d.type)
|
|
445
445
|
return {
|
|
446
|
-
name:
|
|
446
|
+
name: n,
|
|
447
447
|
error: d
|
|
448
448
|
};
|
|
449
449
|
if (d && d.root && d.root.type)
|
|
450
450
|
return {
|
|
451
|
-
name: `${
|
|
451
|
+
name: `${n}.root`,
|
|
452
452
|
error: d.root
|
|
453
453
|
};
|
|
454
454
|
o.pop();
|
|
@@ -459,8 +459,8 @@ function ft(e, s, t) {
|
|
|
459
459
|
}
|
|
460
460
|
var hr = (e, s, t, i) => {
|
|
461
461
|
t(e);
|
|
462
|
-
const { name: o, ...
|
|
463
|
-
return
|
|
462
|
+
const { name: o, ...n } = e;
|
|
463
|
+
return Q(n) || Object.keys(n).length >= Object.keys(s).length || Object.keys(n).find((c) => s[c] === (!i || ie.all));
|
|
464
464
|
}, mr = (e, s, t) => !e || !s || e === s || ke(e).some((i) => i && (t ? i === s : i.startsWith(s) || s.startsWith(i))), _r = (e, s, t, i, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(s || e) : (t ? i.isOnBlur : o.isOnBlur) ? !e : (t ? i.isOnChange : o.isOnChange) ? e : !0, gr = (e, s) => !He(y(e, s)).length && I(e, s), vr = (e, s, t) => {
|
|
465
465
|
const i = ke(y(e, t));
|
|
466
466
|
return B(i, "root", s[t]), B(e, t, i), e;
|
|
@@ -476,22 +476,22 @@ function yt(e, s, t = "validate") {
|
|
|
476
476
|
var _e = (e) => P(e) && !Se(e) ? e : {
|
|
477
477
|
value: e,
|
|
478
478
|
message: ""
|
|
479
|
-
}, ht = async (e, s, t, i, o,
|
|
480
|
-
const { ref: c, refs: d, required: D, maxLength: w, minLength: g, min: x, max: _, pattern: ee, validate: H, name: S, valueAsNumber:
|
|
479
|
+
}, ht = async (e, s, t, i, o, n) => {
|
|
480
|
+
const { ref: c, refs: d, required: D, maxLength: w, minLength: g, min: x, max: _, pattern: ee, validate: H, name: S, valueAsNumber: M, mount: te } = e._f, b = y(t, S);
|
|
481
481
|
if (!te || s.has(S))
|
|
482
482
|
return {};
|
|
483
483
|
const C = d ? d[0] : c, F = (k) => {
|
|
484
484
|
o && C.reportValidity && (C.setCustomValidity(Z(k) ? "" : k || ""), C.reportValidity());
|
|
485
|
-
}, V = {}, z = Ke(c), j = Fe(c),
|
|
485
|
+
}, V = {}, z = Ke(c), j = Fe(c), G = z || j, K = (M || Ge(c)) && O(c.value) && O(b) || De(c) && c.value === "" || b === "" || Array.isArray(b) && !b.length, se = nr.bind(null, S, i, V), $ = (k, p, R, N = oe.maxLength, q = oe.minLength) => {
|
|
486
486
|
const T = k ? p : R;
|
|
487
487
|
V[S] = {
|
|
488
|
-
type: k ?
|
|
488
|
+
type: k ? N : q,
|
|
489
489
|
message: T,
|
|
490
490
|
ref: c,
|
|
491
|
-
...se(k ?
|
|
491
|
+
...se(k ? N : q, T)
|
|
492
492
|
};
|
|
493
493
|
};
|
|
494
|
-
if (
|
|
494
|
+
if (n ? !Array.isArray(b) || !b.length : D && (!G && (K || X(b)) || Z(b) && !b || j && !Ft(d).isValid || z && !At(d).isValid)) {
|
|
495
495
|
const { value: k, message: p } = Y(D) ? { value: !!D, message: D } : _e(D);
|
|
496
496
|
if (k && (V[S] = {
|
|
497
497
|
type: oe.required,
|
|
@@ -501,25 +501,25 @@ var _e = (e) => P(e) && !Se(e) ? e : {
|
|
|
501
501
|
}, !i))
|
|
502
502
|
return F(p), V;
|
|
503
503
|
}
|
|
504
|
-
if (!
|
|
504
|
+
if (!K && (!X(x) || !X(_))) {
|
|
505
505
|
let k, p;
|
|
506
|
-
const R = _e(_),
|
|
507
|
-
if (!
|
|
506
|
+
const R = _e(_), N = _e(x);
|
|
507
|
+
if (!X(b) && !isNaN(b)) {
|
|
508
508
|
const q = c.valueAsNumber || b && +b;
|
|
509
|
-
|
|
509
|
+
X(R.value) || (k = q > R.value), X(N.value) || (p = q < N.value);
|
|
510
510
|
} else {
|
|
511
|
-
const q = c.valueAsDate || new Date(b), T = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), ue = c.type == "time",
|
|
512
|
-
Y(R.value) && b && (k = ue ? T(b) > T(R.value) :
|
|
511
|
+
const q = c.valueAsDate || new Date(b), T = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), ue = c.type == "time", le = c.type == "week";
|
|
512
|
+
Y(R.value) && b && (k = ue ? T(b) > T(R.value) : le ? b > R.value : q > new Date(R.value)), Y(N.value) && b && (p = ue ? T(b) < T(N.value) : le ? b < N.value : q < new Date(N.value));
|
|
513
513
|
}
|
|
514
|
-
if ((k || p) && ($(!!k, R.message,
|
|
514
|
+
if ((k || p) && ($(!!k, R.message, N.message, oe.max, oe.min), !i))
|
|
515
515
|
return F(V[S].message), V;
|
|
516
516
|
}
|
|
517
|
-
if ((w || g) && !
|
|
518
|
-
const k = _e(w), p = _e(g), R = !
|
|
519
|
-
if ((R ||
|
|
517
|
+
if ((w || g) && !K && (Y(b) || n && Array.isArray(b))) {
|
|
518
|
+
const k = _e(w), p = _e(g), R = !X(k.value) && b.length > +k.value, N = !X(p.value) && b.length < +p.value;
|
|
519
|
+
if ((R || N) && ($(R, k.message, p.message), !i))
|
|
520
520
|
return F(V[S].message), V;
|
|
521
521
|
}
|
|
522
|
-
if (ee && !
|
|
522
|
+
if (ee && !K && Y(b)) {
|
|
523
523
|
const { value: k, message: p } = _e(ee);
|
|
524
524
|
if (Se(k) && !b.match(k) && (V[S] = {
|
|
525
525
|
type: oe.pattern,
|
|
@@ -530,7 +530,7 @@ var _e = (e) => P(e) && !Se(e) ? e : {
|
|
|
530
530
|
return F(p), V;
|
|
531
531
|
}
|
|
532
532
|
if (H) {
|
|
533
|
-
if (
|
|
533
|
+
if (ne(H)) {
|
|
534
534
|
const k = await H(b, t), p = yt(k, C);
|
|
535
535
|
if (p && (V[S] = {
|
|
536
536
|
...p,
|
|
@@ -540,7 +540,7 @@ var _e = (e) => P(e) && !Se(e) ? e : {
|
|
|
540
540
|
} else if (P(H)) {
|
|
541
541
|
let k = {};
|
|
542
542
|
for (const p in H) {
|
|
543
|
-
if (!
|
|
543
|
+
if (!Q(k) && !i)
|
|
544
544
|
break;
|
|
545
545
|
const R = yt(await H[p](b, t), C, p);
|
|
546
546
|
R && (k = {
|
|
@@ -548,7 +548,7 @@ var _e = (e) => P(e) && !Se(e) ? e : {
|
|
|
548
548
|
...se(p, R.message)
|
|
549
549
|
}, F(R.message), i && (V[S] = k));
|
|
550
550
|
}
|
|
551
|
-
if (!
|
|
551
|
+
if (!Q(k) && (V[S] = {
|
|
552
552
|
ref: C,
|
|
553
553
|
...k
|
|
554
554
|
}, !i))
|
|
@@ -570,7 +570,7 @@ function Vr(e = {}) {
|
|
|
570
570
|
submitCount: 0,
|
|
571
571
|
isDirty: !1,
|
|
572
572
|
isReady: !1,
|
|
573
|
-
isLoading:
|
|
573
|
+
isLoading: ne(s.defaultValues),
|
|
574
574
|
isValidating: !1,
|
|
575
575
|
isSubmitted: !1,
|
|
576
576
|
isSubmitting: !1,
|
|
@@ -581,7 +581,7 @@ function Vr(e = {}) {
|
|
|
581
581
|
validatingFields: {},
|
|
582
582
|
errors: s.errors || {},
|
|
583
583
|
disabled: s.disabled || !1
|
|
584
|
-
}, i = {}, o = P(s.defaultValues) || P(s.values) ? W(s.defaultValues || s.values) || {} : {},
|
|
584
|
+
}, i = {}, o = P(s.defaultValues) || P(s.values) ? W(s.defaultValues || s.values) || {} : {}, n = s.shouldUnregister ? {} : W(o), c = {
|
|
585
585
|
action: !1,
|
|
586
586
|
mount: !1,
|
|
587
587
|
watch: !1
|
|
@@ -611,33 +611,33 @@ function Vr(e = {}) {
|
|
|
611
611
|
clearTimeout(w), w = setTimeout(r, a);
|
|
612
612
|
}, S = async (r) => {
|
|
613
613
|
if (!s.disabled && (g.isValid || x.isValid || r)) {
|
|
614
|
-
const a = s.resolver ?
|
|
614
|
+
const a = s.resolver ? Q((await j()).errors) : await K(i, !0);
|
|
615
615
|
a !== t.isValid && _.state.next({
|
|
616
616
|
isValid: a
|
|
617
617
|
});
|
|
618
618
|
}
|
|
619
|
-
},
|
|
620
|
-
!s.disabled && (g.isValidating || g.validatingFields || x.isValidating || x.validatingFields) && ((r || Array.from(d.mount)).forEach((
|
|
621
|
-
|
|
619
|
+
}, M = (r, a) => {
|
|
620
|
+
!s.disabled && (g.isValidating || g.validatingFields || x.isValidating || x.validatingFields) && ((r || Array.from(d.mount)).forEach((l) => {
|
|
621
|
+
l && (a ? B(t.validatingFields, l, a) : I(t.validatingFields, l));
|
|
622
622
|
}), _.state.next({
|
|
623
623
|
validatingFields: t.validatingFields,
|
|
624
|
-
isValidating: !
|
|
624
|
+
isValidating: !Q(t.validatingFields)
|
|
625
625
|
}));
|
|
626
|
-
}, te = (r, a = [],
|
|
627
|
-
if (h &&
|
|
626
|
+
}, te = (r, a = [], l, h, f = !0, u = !0) => {
|
|
627
|
+
if (h && l && !s.disabled) {
|
|
628
628
|
if (c.action = !0, u && Array.isArray(y(i, r))) {
|
|
629
|
-
const m =
|
|
629
|
+
const m = l(y(i, r), h.argA, h.argB);
|
|
630
630
|
f && B(i, r, m);
|
|
631
631
|
}
|
|
632
632
|
if (u && Array.isArray(y(t.errors, r))) {
|
|
633
|
-
const m =
|
|
633
|
+
const m = l(y(t.errors, r), h.argA, h.argB);
|
|
634
634
|
f && B(t.errors, r, m), gr(t.errors, r);
|
|
635
635
|
}
|
|
636
636
|
if ((g.touchedFields || x.touchedFields) && u && Array.isArray(y(t.touchedFields, r))) {
|
|
637
|
-
const m =
|
|
637
|
+
const m = l(y(t.touchedFields, r), h.argA, h.argB);
|
|
638
638
|
f && B(t.touchedFields, r, m);
|
|
639
639
|
}
|
|
640
|
-
(g.dirtyFields || x.dirtyFields) && (t.dirtyFields = ge(o,
|
|
640
|
+
(g.dirtyFields || x.dirtyFields) && (t.dirtyFields = ge(o, n)), _.state.next({
|
|
641
641
|
name: r,
|
|
642
642
|
isDirty: $(r, a),
|
|
643
643
|
dirtyFields: t.dirtyFields,
|
|
@@ -645,7 +645,7 @@ function Vr(e = {}) {
|
|
|
645
645
|
isValid: t.isValid
|
|
646
646
|
});
|
|
647
647
|
} else
|
|
648
|
-
B(
|
|
648
|
+
B(n, r, a);
|
|
649
649
|
}, b = (r, a) => {
|
|
650
650
|
B(t.errors, r, a), _.state.next({
|
|
651
651
|
errors: t.errors
|
|
@@ -655,33 +655,33 @@ function Vr(e = {}) {
|
|
|
655
655
|
errors: t.errors,
|
|
656
656
|
isValid: !1
|
|
657
657
|
});
|
|
658
|
-
}, F = (r, a,
|
|
658
|
+
}, F = (r, a, l, h) => {
|
|
659
659
|
const f = y(i, r);
|
|
660
660
|
if (f) {
|
|
661
|
-
const u = y(
|
|
662
|
-
O(u) || h && h.defaultChecked || a ? B(
|
|
661
|
+
const u = y(n, r, O(l) ? y(o, r) : l);
|
|
662
|
+
O(u) || h && h.defaultChecked || a ? B(n, r, a ? u : ot(f._f)) : R(r, u), c.mount && S();
|
|
663
663
|
}
|
|
664
|
-
}, V = (r, a,
|
|
664
|
+
}, V = (r, a, l, h, f) => {
|
|
665
665
|
let u = !1, m = !1;
|
|
666
666
|
const A = {
|
|
667
667
|
name: r
|
|
668
668
|
};
|
|
669
669
|
if (!s.disabled) {
|
|
670
|
-
if (!
|
|
670
|
+
if (!l || h) {
|
|
671
671
|
(g.isDirty || x.isDirty) && (m = t.isDirty, t.isDirty = A.isDirty = $(), u = m !== A.isDirty);
|
|
672
672
|
const E = ae(y(o, r), a);
|
|
673
673
|
m = !!y(t.dirtyFields, r), E ? I(t.dirtyFields, r) : B(t.dirtyFields, r, !0), A.dirtyFields = t.dirtyFields, u = u || (g.dirtyFields || x.dirtyFields) && m !== !E;
|
|
674
674
|
}
|
|
675
|
-
if (
|
|
675
|
+
if (l) {
|
|
676
676
|
const E = y(t.touchedFields, r);
|
|
677
|
-
E || (B(t.touchedFields, r,
|
|
677
|
+
E || (B(t.touchedFields, r, l), A.touchedFields = t.touchedFields, u = u || (g.touchedFields || x.touchedFields) && E !== l);
|
|
678
678
|
}
|
|
679
679
|
u && f && _.state.next(A);
|
|
680
680
|
}
|
|
681
681
|
return u ? A : {};
|
|
682
|
-
}, z = (r, a,
|
|
682
|
+
}, z = (r, a, l, h) => {
|
|
683
683
|
const f = y(t.errors, r), u = (g.isValid || x.isValid) && Z(a) && t.isValid !== a;
|
|
684
|
-
if (s.delayError &&
|
|
684
|
+
if (s.delayError && l ? (D = H(() => b(r, l)), D(s.delayError)) : (clearTimeout(w), D = null, l ? B(t.errors, r, l) : I(t.errors, r)), (l ? !ae(f, l) : f) || !Q(h) || u) {
|
|
685
685
|
const m = {
|
|
686
686
|
...h,
|
|
687
687
|
...u && Z(a) ? { isValid: a } : {},
|
|
@@ -694,20 +694,20 @@ function Vr(e = {}) {
|
|
|
694
694
|
}, _.state.next(m);
|
|
695
695
|
}
|
|
696
696
|
}, j = async (r) => {
|
|
697
|
-
|
|
698
|
-
const a = await s.resolver(
|
|
699
|
-
return
|
|
700
|
-
},
|
|
697
|
+
M(r, !0);
|
|
698
|
+
const a = await s.resolver(n, s.context, dr(r || d.mount, i, s.criteriaMode, s.shouldUseNativeValidation));
|
|
699
|
+
return M(r), a;
|
|
700
|
+
}, G = async (r) => {
|
|
701
701
|
const { errors: a } = await j(r);
|
|
702
702
|
if (r)
|
|
703
|
-
for (const
|
|
704
|
-
const h = y(a,
|
|
705
|
-
h ? B(t.errors,
|
|
703
|
+
for (const l of r) {
|
|
704
|
+
const h = y(a, l);
|
|
705
|
+
h ? B(t.errors, l, h) : I(t.errors, l);
|
|
706
706
|
}
|
|
707
707
|
else
|
|
708
708
|
t.errors = a;
|
|
709
709
|
return a;
|
|
710
|
-
},
|
|
710
|
+
}, K = async (r, a, l = {
|
|
711
711
|
valid: !0
|
|
712
712
|
}) => {
|
|
713
713
|
for (const h in r) {
|
|
@@ -716,108 +716,108 @@ function Vr(e = {}) {
|
|
|
716
716
|
const { _f: u, ...m } = f;
|
|
717
717
|
if (u) {
|
|
718
718
|
const A = d.array.has(u.name), E = f._f && fr(f._f);
|
|
719
|
-
E && g.validatingFields &&
|
|
720
|
-
const re = await ht(f, d.disabled,
|
|
721
|
-
if (E && g.validatingFields &&
|
|
719
|
+
E && g.validatingFields && M([u.name], !0);
|
|
720
|
+
const re = await ht(f, d.disabled, n, ee, s.shouldUseNativeValidation && !a, A);
|
|
721
|
+
if (E && g.validatingFields && M([u.name]), re[u.name] && (l.valid = !1, a))
|
|
722
722
|
break;
|
|
723
723
|
!a && (y(re, u.name) ? A ? vr(t.errors, re, u.name) : B(t.errors, u.name, re[u.name]) : I(t.errors, u.name));
|
|
724
724
|
}
|
|
725
|
-
!
|
|
725
|
+
!Q(m) && await K(m, a, l);
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
return
|
|
728
|
+
return l.valid;
|
|
729
729
|
}, se = () => {
|
|
730
730
|
for (const r of d.unMount) {
|
|
731
731
|
const a = y(i, r);
|
|
732
|
-
a && (a._f.refs ? a._f.refs.every((
|
|
732
|
+
a && (a._f.refs ? a._f.refs.every((l) => !Ue(l)) : !Ue(a._f.ref)) && J(r);
|
|
733
733
|
}
|
|
734
734
|
d.unMount = /* @__PURE__ */ new Set();
|
|
735
|
-
}, $ = (r, a) => !s.disabled && (r && a && B(
|
|
736
|
-
...c.mount ?
|
|
737
|
-
},
|
|
735
|
+
}, $ = (r, a) => !s.disabled && (r && a && B(n, r, a), !ae(fe(), o)), k = (r, a, l) => Ie(r, d, {
|
|
736
|
+
...c.mount ? n : O(a) ? o : Y(r) ? { [r]: a } : a
|
|
737
|
+
}, l, a), p = (r) => He(y(c.mount ? n : o, r, s.shouldUnregister ? y(o, r, []) : [])), R = (r, a, l = {}) => {
|
|
738
738
|
const h = y(i, r);
|
|
739
739
|
let f = a;
|
|
740
740
|
if (h) {
|
|
741
741
|
const u = h._f;
|
|
742
|
-
u && (!u.disabled && B(
|
|
742
|
+
u && (!u.disabled && B(n, r, pt(a, u)), f = De(u.ref) && X(a) ? "" : a, kt(u.ref) ? [...u.ref.options].forEach((m) => m.selected = f.includes(m.value)) : u.refs ? Fe(u.ref) ? u.refs.forEach((m) => {
|
|
743
743
|
(!m.defaultChecked || !m.disabled) && (Array.isArray(f) ? m.checked = !!f.find((A) => A === m.value) : m.checked = f === m.value || !!f);
|
|
744
744
|
}) : u.refs.forEach((m) => m.checked = m.value === f) : Ge(u.ref) ? u.ref.value = "" : (u.ref.value = f, u.ref.type || _.state.next({
|
|
745
745
|
name: r,
|
|
746
|
-
values: W(
|
|
746
|
+
values: W(n)
|
|
747
747
|
})));
|
|
748
748
|
}
|
|
749
|
-
(
|
|
750
|
-
},
|
|
749
|
+
(l.shouldDirty || l.shouldTouch) && V(r, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && le(r);
|
|
750
|
+
}, N = (r, a, l) => {
|
|
751
751
|
for (const h in a) {
|
|
752
752
|
if (!a.hasOwnProperty(h))
|
|
753
753
|
return;
|
|
754
754
|
const f = a[h], u = r + "." + h, m = y(i, u);
|
|
755
|
-
(d.array.has(r) || P(f) || m && !m._f) && !ye(f) ?
|
|
755
|
+
(d.array.has(r) || P(f) || m && !m._f) && !ye(f) ? N(u, f, l) : R(u, f, l);
|
|
756
756
|
}
|
|
757
|
-
}, q = (r, a,
|
|
757
|
+
}, q = (r, a, l = {}) => {
|
|
758
758
|
const h = y(i, r), f = d.array.has(r), u = W(a);
|
|
759
|
-
B(
|
|
759
|
+
B(n, r, u), f ? (_.array.next({
|
|
760
760
|
name: r,
|
|
761
|
-
values: W(
|
|
762
|
-
}), (g.isDirty || g.dirtyFields || x.isDirty || x.dirtyFields) &&
|
|
761
|
+
values: W(n)
|
|
762
|
+
}), (g.isDirty || g.dirtyFields || x.isDirty || x.dirtyFields) && l.shouldDirty && _.state.next({
|
|
763
763
|
name: r,
|
|
764
|
-
dirtyFields: ge(o,
|
|
764
|
+
dirtyFields: ge(o, n),
|
|
765
765
|
isDirty: $(r, u)
|
|
766
|
-
})) : h && !h._f && !
|
|
766
|
+
})) : h && !h._f && !X(u) ? N(r, u, l) : R(r, u, l), dt(r, d) && _.state.next({ ...t, name: r }), _.state.next({
|
|
767
767
|
name: c.mount ? r : void 0,
|
|
768
|
-
values: W(
|
|
768
|
+
values: W(n)
|
|
769
769
|
});
|
|
770
770
|
}, T = async (r) => {
|
|
771
771
|
c.mount = !0;
|
|
772
772
|
const a = r.target;
|
|
773
|
-
let
|
|
774
|
-
const f = y(i,
|
|
775
|
-
h = Number.isNaN(E) || ye(E) && isNaN(E.getTime()) || ae(E, y(
|
|
773
|
+
let l = a.name, h = !0;
|
|
774
|
+
const f = y(i, l), u = (E) => {
|
|
775
|
+
h = Number.isNaN(E) || ye(E) && isNaN(E.getTime()) || ae(E, y(n, l, E));
|
|
776
776
|
}, m = ut(s.mode), A = ut(s.reValidateMode);
|
|
777
777
|
if (f) {
|
|
778
778
|
let E, re;
|
|
779
|
-
const we = a.type ? ot(f._f) : _t(r), ce = r.type === Ce.BLUR || r.type === Ce.FOCUS_OUT, Et = !yr(f._f) && !s.resolver && !y(t.errors,
|
|
780
|
-
B(
|
|
781
|
-
const Oe = V(
|
|
779
|
+
const we = a.type ? ot(f._f) : _t(r), ce = r.type === Ce.BLUR || r.type === Ce.FOCUS_OUT, Et = !yr(f._f) && !s.resolver && !y(t.errors, l) && !f._f.deps || _r(ce, y(t.touchedFields, l), t.isSubmitted, A, m), Le = dt(l, d, ce);
|
|
780
|
+
B(n, l, we), ce ? (!a || !a.readOnly) && (f._f.onBlur && f._f.onBlur(r), D && D(0)) : f._f.onChange && f._f.onChange(r);
|
|
781
|
+
const Oe = V(l, we, ce), Bt = !Q(Oe) || Le;
|
|
782
782
|
if (!ce && _.state.next({
|
|
783
|
-
name:
|
|
783
|
+
name: l,
|
|
784
784
|
type: r.type,
|
|
785
|
-
values: W(
|
|
785
|
+
values: W(n)
|
|
786
786
|
}), Et)
|
|
787
|
-
return (g.isValid || x.isValid) && (s.mode === "onBlur" ? ce && S() : ce || S()), Bt && _.state.next({ name:
|
|
787
|
+
return (g.isValid || x.isValid) && (s.mode === "onBlur" ? ce && S() : ce || S()), Bt && _.state.next({ name: l, ...Le ? {} : Oe });
|
|
788
788
|
if (!ce && Le && _.state.next({ ...t }), s.resolver) {
|
|
789
|
-
const { errors: Ye } = await j([
|
|
789
|
+
const { errors: Ye } = await j([l]);
|
|
790
790
|
if (u(we), h) {
|
|
791
|
-
const Tt = ft(t.errors, i,
|
|
792
|
-
E = et.error,
|
|
791
|
+
const Tt = ft(t.errors, i, l), et = ft(Ye, i, Tt.name || l);
|
|
792
|
+
E = et.error, l = et.name, re = Q(Ye);
|
|
793
793
|
}
|
|
794
794
|
} else
|
|
795
|
-
|
|
796
|
-
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) &&
|
|
795
|
+
M([l], !0), E = (await ht(f, d.disabled, n, ee, s.shouldUseNativeValidation))[l], M([l]), u(we), h && (E ? re = !1 : (g.isValid || x.isValid) && (re = await K(i, !0)));
|
|
796
|
+
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && le(f._f.deps), z(l, re, E, Oe));
|
|
797
797
|
}
|
|
798
798
|
}, ue = (r, a) => {
|
|
799
799
|
if (y(t.errors, a) && r.focus)
|
|
800
800
|
return r.focus(), 1;
|
|
801
|
-
},
|
|
802
|
-
let
|
|
801
|
+
}, le = async (r, a = {}) => {
|
|
802
|
+
let l, h;
|
|
803
803
|
const f = ke(r);
|
|
804
804
|
if (s.resolver) {
|
|
805
|
-
const u = await
|
|
806
|
-
|
|
805
|
+
const u = await G(O(r) ? r : f);
|
|
806
|
+
l = Q(u), h = r ? !f.some((m) => y(u, m)) : l;
|
|
807
807
|
} else r ? (h = (await Promise.all(f.map(async (u) => {
|
|
808
808
|
const m = y(i, u);
|
|
809
|
-
return await
|
|
810
|
-
}))).every(Boolean), !(!h && !t.isValid) && S()) : h =
|
|
809
|
+
return await K(m && m._f ? { [u]: m } : m);
|
|
810
|
+
}))).every(Boolean), !(!h && !t.isValid) && S()) : h = l = await K(i);
|
|
811
811
|
return _.state.next({
|
|
812
|
-
...!Y(r) || (g.isValid || x.isValid) &&
|
|
813
|
-
...s.resolver || !r ? { isValid:
|
|
812
|
+
...!Y(r) || (g.isValid || x.isValid) && l !== t.isValid ? {} : { name: r },
|
|
813
|
+
...s.resolver || !r ? { isValid: l } : {},
|
|
814
814
|
errors: t.errors
|
|
815
815
|
}), a.shouldFocus && !h && xe(i, ue, r ? f : d.mount), h;
|
|
816
816
|
}, fe = (r, a) => {
|
|
817
|
-
let
|
|
818
|
-
...c.mount ?
|
|
817
|
+
let l = {
|
|
818
|
+
...c.mount ? n : o
|
|
819
819
|
};
|
|
820
|
-
return a && (
|
|
820
|
+
return a && (l = Vt(a.dirtyFields ? t.dirtyFields : t.touchedFields, l)), O(r) ? l : Y(r) ? y(l, r) : r.map((h) => y(l, h));
|
|
821
821
|
}, pe = (r, a) => ({
|
|
822
822
|
invalid: !!y((a || t).errors, r),
|
|
823
823
|
isDirty: !!y((a || t).dirtyFields, r),
|
|
@@ -828,7 +828,7 @@ function Vr(e = {}) {
|
|
|
828
828
|
r && ke(r).forEach((a) => I(t.errors, a)), _.state.next({
|
|
829
829
|
errors: r ? t.errors : {}
|
|
830
830
|
});
|
|
831
|
-
}, he = (r, a,
|
|
831
|
+
}, he = (r, a, l) => {
|
|
832
832
|
const h = (y(i, r, { _f: {} })._f || {}).ref, f = y(t.errors, r) || {}, { ref: u, message: m, type: A, ...E } = f;
|
|
833
833
|
B(t.errors, r, {
|
|
834
834
|
...E,
|
|
@@ -838,13 +838,13 @@ function Vr(e = {}) {
|
|
|
838
838
|
name: r,
|
|
839
839
|
errors: t.errors,
|
|
840
840
|
isValid: !1
|
|
841
|
-
}),
|
|
842
|
-
}, Te = (r, a) =>
|
|
843
|
-
next: (
|
|
841
|
+
}), l && l.shouldFocus && h && h.focus && h.focus();
|
|
842
|
+
}, Te = (r, a) => ne(r) ? _.state.subscribe({
|
|
843
|
+
next: (l) => "values" in l && r(k(void 0, a), l)
|
|
844
844
|
}) : k(r, a, !0), Ae = (r) => _.state.subscribe({
|
|
845
845
|
next: (a) => {
|
|
846
846
|
mr(r.name, a.name, r.exact) && hr(a, r.formState || g, St, r.reRenderRoot) && r.callback({
|
|
847
|
-
values: { ...
|
|
847
|
+
values: { ...n },
|
|
848
848
|
...t,
|
|
849
849
|
...a,
|
|
850
850
|
defaultValues: o
|
|
@@ -856,11 +856,11 @@ function Vr(e = {}) {
|
|
|
856
856
|
}, Ae({
|
|
857
857
|
...r,
|
|
858
858
|
formState: x
|
|
859
|
-
})),
|
|
860
|
-
for (const
|
|
861
|
-
d.mount.delete(
|
|
859
|
+
})), J = (r, a = {}) => {
|
|
860
|
+
for (const l of r ? ke(r) : d.mount)
|
|
861
|
+
d.mount.delete(l), d.array.delete(l), a.keepValue || (I(i, l), I(n, l)), !a.keepError && I(t.errors, l), !a.keepDirty && I(t.dirtyFields, l), !a.keepTouched && I(t.touchedFields, l), !a.keepIsValidating && I(t.validatingFields, l), !s.shouldUnregister && !a.keepDefaultValue && I(o, l);
|
|
862
862
|
_.state.next({
|
|
863
|
-
values: W(
|
|
863
|
+
values: W(n)
|
|
864
864
|
}), _.state.next({
|
|
865
865
|
...t,
|
|
866
866
|
...a.keepDirty ? { isDirty: $() } : {}
|
|
@@ -868,17 +868,17 @@ function Vr(e = {}) {
|
|
|
868
868
|
}, me = ({ disabled: r, name: a }) => {
|
|
869
869
|
(Z(r) && c.mount || r || d.disabled.has(a)) && (r ? d.disabled.add(a) : d.disabled.delete(a));
|
|
870
870
|
}, be = (r, a = {}) => {
|
|
871
|
-
let
|
|
871
|
+
let l = y(i, r);
|
|
872
872
|
const h = Z(a.disabled) || Z(s.disabled);
|
|
873
873
|
return B(i, r, {
|
|
874
|
-
...
|
|
874
|
+
...l || {},
|
|
875
875
|
_f: {
|
|
876
|
-
...
|
|
876
|
+
...l && l._f ? l._f : { ref: { name: r } },
|
|
877
877
|
name: r,
|
|
878
878
|
mount: !0,
|
|
879
879
|
...a
|
|
880
880
|
}
|
|
881
|
-
}), d.mount.add(r),
|
|
881
|
+
}), d.mount.add(r), l ? me({
|
|
882
882
|
disabled: Z(a.disabled) ? a.disabled : s.disabled,
|
|
883
883
|
name: r
|
|
884
884
|
}) : F(r, !0, a.value), {
|
|
@@ -896,13 +896,13 @@ function Vr(e = {}) {
|
|
|
896
896
|
onBlur: T,
|
|
897
897
|
ref: (f) => {
|
|
898
898
|
if (f) {
|
|
899
|
-
be(r, a),
|
|
900
|
-
const u = O(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m =
|
|
901
|
-
if (m ? A.find((E) => E === u) : u ===
|
|
899
|
+
be(r, a), l = y(i, r);
|
|
900
|
+
const u = O(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = lr(u), A = l._f.refs || [];
|
|
901
|
+
if (m ? A.find((E) => E === u) : u === l._f.ref)
|
|
902
902
|
return;
|
|
903
903
|
B(i, r, {
|
|
904
904
|
_f: {
|
|
905
|
-
...
|
|
905
|
+
...l._f,
|
|
906
906
|
...m ? {
|
|
907
907
|
refs: [
|
|
908
908
|
...A.filter(Ue),
|
|
@@ -914,45 +914,45 @@ function Vr(e = {}) {
|
|
|
914
914
|
}
|
|
915
915
|
}), F(r, !1, void 0, u);
|
|
916
916
|
} else
|
|
917
|
-
|
|
917
|
+
l = y(i, r, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || a.shouldUnregister) && !(gt(d.array, r) && c.action) && d.unMount.add(r);
|
|
918
918
|
}
|
|
919
919
|
};
|
|
920
920
|
}, Re = () => s.shouldFocusError && xe(i, ue, d.mount), wt = (r) => {
|
|
921
|
-
Z(r) && (_.state.next({ disabled: r }), xe(i, (a,
|
|
922
|
-
const h = y(i,
|
|
921
|
+
Z(r) && (_.state.next({ disabled: r }), xe(i, (a, l) => {
|
|
922
|
+
const h = y(i, l);
|
|
923
923
|
h && (a.disabled = h._f.disabled || r, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
|
|
924
924
|
f.disabled = h._f.disabled || r;
|
|
925
925
|
}));
|
|
926
926
|
}, 0, !1));
|
|
927
|
-
}, Je = (r, a) => async (
|
|
927
|
+
}, Je = (r, a) => async (l) => {
|
|
928
928
|
let h;
|
|
929
|
-
|
|
930
|
-
let f = W(
|
|
929
|
+
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
930
|
+
let f = W(n);
|
|
931
931
|
if (_.state.next({
|
|
932
932
|
isSubmitting: !0
|
|
933
933
|
}), s.resolver) {
|
|
934
934
|
const { errors: u, values: m } = await j();
|
|
935
935
|
t.errors = u, f = W(m);
|
|
936
936
|
} else
|
|
937
|
-
await
|
|
937
|
+
await K(i);
|
|
938
938
|
if (d.disabled.size)
|
|
939
939
|
for (const u of d.disabled)
|
|
940
940
|
I(f, u);
|
|
941
|
-
if (I(t.errors, "root"),
|
|
941
|
+
if (I(t.errors, "root"), Q(t.errors)) {
|
|
942
942
|
_.state.next({
|
|
943
943
|
errors: {}
|
|
944
944
|
});
|
|
945
945
|
try {
|
|
946
|
-
await r(f,
|
|
946
|
+
await r(f, l);
|
|
947
947
|
} catch (u) {
|
|
948
948
|
h = u;
|
|
949
949
|
}
|
|
950
950
|
} else
|
|
951
|
-
a && await a({ ...t.errors },
|
|
951
|
+
a && await a({ ...t.errors }, l), Re(), setTimeout(Re);
|
|
952
952
|
if (_.state.next({
|
|
953
953
|
isSubmitted: !0,
|
|
954
954
|
isSubmitting: !1,
|
|
955
|
-
isSubmitSuccessful:
|
|
955
|
+
isSubmitSuccessful: Q(t.errors) && !h,
|
|
956
956
|
submitCount: t.submitCount + 1,
|
|
957
957
|
errors: t.errors
|
|
958
958
|
}), h)
|
|
@@ -960,15 +960,15 @@ function Vr(e = {}) {
|
|
|
960
960
|
}, Ct = (r, a = {}) => {
|
|
961
961
|
y(i, r) && (O(a.defaultValue) ? q(r, W(y(o, r))) : (q(r, a.defaultValue), B(o, r, W(a.defaultValue))), a.keepTouched || I(t.touchedFields, r), a.keepDirty || (I(t.dirtyFields, r), t.isDirty = a.defaultValue ? $(r, W(y(o, r))) : $()), a.keepError || (I(t.errors, r), g.isValid && S()), _.state.next({ ...t }));
|
|
962
962
|
}, Qe = (r, a = {}) => {
|
|
963
|
-
const
|
|
964
|
-
if (a.keepDefaultValues || (o =
|
|
963
|
+
const l = r ? W(r) : o, h = W(l), f = Q(r), u = f ? o : h;
|
|
964
|
+
if (a.keepDefaultValues || (o = l), !a.keepValues) {
|
|
965
965
|
if (a.keepDirtyValues) {
|
|
966
966
|
const m = /* @__PURE__ */ new Set([
|
|
967
967
|
...d.mount,
|
|
968
|
-
...Object.keys(ge(o,
|
|
968
|
+
...Object.keys(ge(o, n))
|
|
969
969
|
]);
|
|
970
970
|
for (const A of Array.from(m))
|
|
971
|
-
y(t.dirtyFields, A) ? B(u, A, y(
|
|
971
|
+
y(t.dirtyFields, A) ? B(u, A, y(n, A)) : q(A, y(u, A));
|
|
972
972
|
} else {
|
|
973
973
|
if (qe && O(r))
|
|
974
974
|
for (const m of d.mount) {
|
|
@@ -990,7 +990,7 @@ function Vr(e = {}) {
|
|
|
990
990
|
else
|
|
991
991
|
i = {};
|
|
992
992
|
}
|
|
993
|
-
|
|
993
|
+
n = s.shouldUnregister ? a.keepDefaultValues ? W(o) : {} : W(u), _.array.next({
|
|
994
994
|
values: { ...u }
|
|
995
995
|
}), _.state.next({
|
|
996
996
|
values: { ...u }
|
|
@@ -1004,22 +1004,22 @@ function Vr(e = {}) {
|
|
|
1004
1004
|
watch: /* @__PURE__ */ new Set(),
|
|
1005
1005
|
watchAll: !1,
|
|
1006
1006
|
focus: ""
|
|
1007
|
-
}, c.mount = !g.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !s.shouldUnregister && !
|
|
1007
|
+
}, c.mount = !g.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !s.shouldUnregister && !Q(u), c.watch = !!s.shouldUnregister, _.state.next({
|
|
1008
1008
|
submitCount: a.keepSubmitCount ? t.submitCount : 0,
|
|
1009
1009
|
isDirty: f ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ae(r, o)),
|
|
1010
1010
|
isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
|
|
1011
|
-
dirtyFields: f ? {} : a.keepDirtyValues ? a.keepDefaultValues &&
|
|
1011
|
+
dirtyFields: f ? {} : a.keepDirtyValues ? a.keepDefaultValues && n ? ge(o, n) : t.dirtyFields : a.keepDefaultValues && r ? ge(o, r) : a.keepDirty ? t.dirtyFields : {},
|
|
1012
1012
|
touchedFields: a.keepTouched ? t.touchedFields : {},
|
|
1013
1013
|
errors: a.keepErrors ? t.errors : {},
|
|
1014
1014
|
isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
1015
1015
|
isSubmitting: !1,
|
|
1016
1016
|
defaultValues: o
|
|
1017
1017
|
});
|
|
1018
|
-
}, Xe = (r, a) => Qe(
|
|
1019
|
-
const
|
|
1018
|
+
}, Xe = (r, a) => Qe(ne(r) ? r(n) : r, a), Dt = (r, a = {}) => {
|
|
1019
|
+
const l = y(i, r), h = l && l._f;
|
|
1020
1020
|
if (h) {
|
|
1021
1021
|
const f = h.refs ? h.refs[0] : h.ref;
|
|
1022
|
-
f.focus && (f.focus(), a.shouldSelect &&
|
|
1022
|
+
f.focus && (f.focus(), a.shouldSelect && ne(f.select) && f.select());
|
|
1023
1023
|
}
|
|
1024
1024
|
}, St = (r) => {
|
|
1025
1025
|
t = {
|
|
@@ -1029,7 +1029,7 @@ function Vr(e = {}) {
|
|
|
1029
1029
|
}, Ze = {
|
|
1030
1030
|
control: {
|
|
1031
1031
|
register: be,
|
|
1032
|
-
unregister:
|
|
1032
|
+
unregister: J,
|
|
1033
1033
|
getFieldState: pe,
|
|
1034
1034
|
handleSubmit: Je,
|
|
1035
1035
|
setError: he,
|
|
@@ -1044,7 +1044,7 @@ function Vr(e = {}) {
|
|
|
1044
1044
|
_setErrors: C,
|
|
1045
1045
|
_getFieldArray: p,
|
|
1046
1046
|
_reset: Qe,
|
|
1047
|
-
_resetDefaultValues: () =>
|
|
1047
|
+
_resetDefaultValues: () => ne(s.defaultValues) && s.defaultValues().then((r) => {
|
|
1048
1048
|
Xe(r, s.resetOptions), _.state.next({
|
|
1049
1049
|
isLoading: !1
|
|
1050
1050
|
});
|
|
@@ -1057,7 +1057,7 @@ function Vr(e = {}) {
|
|
|
1057
1057
|
return i;
|
|
1058
1058
|
},
|
|
1059
1059
|
get _formValues() {
|
|
1060
|
-
return
|
|
1060
|
+
return n;
|
|
1061
1061
|
},
|
|
1062
1062
|
get _state() {
|
|
1063
1063
|
return c;
|
|
@@ -1088,7 +1088,7 @@ function Vr(e = {}) {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
},
|
|
1090
1090
|
subscribe: ve,
|
|
1091
|
-
trigger:
|
|
1091
|
+
trigger: le,
|
|
1092
1092
|
register: be,
|
|
1093
1093
|
handleSubmit: Je,
|
|
1094
1094
|
watch: Te,
|
|
@@ -1097,7 +1097,7 @@ function Vr(e = {}) {
|
|
|
1097
1097
|
reset: Xe,
|
|
1098
1098
|
resetField: Ct,
|
|
1099
1099
|
clearErrors: Be,
|
|
1100
|
-
unregister:
|
|
1100
|
+
unregister: J,
|
|
1101
1101
|
setError: he,
|
|
1102
1102
|
setFocus: Dt,
|
|
1103
1103
|
getFieldState: pe
|
|
@@ -1111,7 +1111,7 @@ function kr(e = {}) {
|
|
|
1111
1111
|
const s = v.useRef(void 0), t = v.useRef(void 0), [i, o] = v.useState({
|
|
1112
1112
|
isDirty: !1,
|
|
1113
1113
|
isValidating: !1,
|
|
1114
|
-
isLoading:
|
|
1114
|
+
isLoading: ne(e.defaultValues),
|
|
1115
1115
|
isSubmitted: !1,
|
|
1116
1116
|
isSubmitting: !1,
|
|
1117
1117
|
isSubmitSuccessful: !1,
|
|
@@ -1123,14 +1123,14 @@ function kr(e = {}) {
|
|
|
1123
1123
|
errors: e.errors || {},
|
|
1124
1124
|
disabled: e.disabled || !1,
|
|
1125
1125
|
isReady: !1,
|
|
1126
|
-
defaultValues:
|
|
1126
|
+
defaultValues: ne(e.defaultValues) ? void 0 : e.defaultValues
|
|
1127
1127
|
});
|
|
1128
1128
|
if (!s.current)
|
|
1129
1129
|
if (e.formControl)
|
|
1130
1130
|
s.current = {
|
|
1131
1131
|
...e.formControl,
|
|
1132
1132
|
formState: i
|
|
1133
|
-
}, e.defaultValues && !
|
|
1133
|
+
}, e.defaultValues && !ne(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
1134
1134
|
else {
|
|
1135
1135
|
const { formControl: c, ...d } = Vr(e);
|
|
1136
1136
|
s.current = {
|
|
@@ -1138,49 +1138,49 @@ function kr(e = {}) {
|
|
|
1138
1138
|
formState: i
|
|
1139
1139
|
};
|
|
1140
1140
|
}
|
|
1141
|
-
const
|
|
1142
|
-
return
|
|
1143
|
-
const c =
|
|
1144
|
-
formState:
|
|
1145
|
-
callback: () => o({ ...
|
|
1141
|
+
const n = s.current.control;
|
|
1142
|
+
return n._options = e, je(() => {
|
|
1143
|
+
const c = n._subscribe({
|
|
1144
|
+
formState: n._proxyFormState,
|
|
1145
|
+
callback: () => o({ ...n._formState }),
|
|
1146
1146
|
reRenderRoot: !0
|
|
1147
1147
|
});
|
|
1148
1148
|
return o((d) => ({
|
|
1149
1149
|
...d,
|
|
1150
1150
|
isReady: !0
|
|
1151
|
-
})),
|
|
1152
|
-
}, [
|
|
1153
|
-
e.mode && (
|
|
1154
|
-
}, [
|
|
1155
|
-
e.errors && (
|
|
1156
|
-
}, [
|
|
1157
|
-
e.shouldUnregister &&
|
|
1158
|
-
values:
|
|
1151
|
+
})), n._formState.isReady = !0, c;
|
|
1152
|
+
}, [n]), v.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), v.useEffect(() => {
|
|
1153
|
+
e.mode && (n._options.mode = e.mode), e.reValidateMode && (n._options.reValidateMode = e.reValidateMode);
|
|
1154
|
+
}, [n, e.mode, e.reValidateMode]), v.useEffect(() => {
|
|
1155
|
+
e.errors && (n._setErrors(e.errors), n._focusError());
|
|
1156
|
+
}, [n, e.errors]), v.useEffect(() => {
|
|
1157
|
+
e.shouldUnregister && n._subjects.state.next({
|
|
1158
|
+
values: n._getWatch()
|
|
1159
1159
|
});
|
|
1160
|
-
}, [
|
|
1161
|
-
if (
|
|
1162
|
-
const c =
|
|
1163
|
-
c !== i.isDirty &&
|
|
1160
|
+
}, [n, e.shouldUnregister]), v.useEffect(() => {
|
|
1161
|
+
if (n._proxyFormState.isDirty) {
|
|
1162
|
+
const c = n._getDirty();
|
|
1163
|
+
c !== i.isDirty && n._subjects.state.next({
|
|
1164
1164
|
isDirty: c
|
|
1165
1165
|
});
|
|
1166
1166
|
}
|
|
1167
|
-
}, [
|
|
1168
|
-
e.values && !ae(e.values, t.current) ? (
|
|
1167
|
+
}, [n, i.isDirty]), v.useEffect(() => {
|
|
1168
|
+
e.values && !ae(e.values, t.current) ? (n._reset(e.values, {
|
|
1169
1169
|
keepFieldsRef: !0,
|
|
1170
|
-
...
|
|
1171
|
-
}), t.current = e.values, o((c) => ({ ...c }))) :
|
|
1172
|
-
}, [
|
|
1173
|
-
|
|
1174
|
-
}), s.current.formState = bt(i,
|
|
1170
|
+
...n._options.resetOptions
|
|
1171
|
+
}), t.current = e.values, o((c) => ({ ...c }))) : n._resetDefaultValues();
|
|
1172
|
+
}, [n, e.values]), v.useEffect(() => {
|
|
1173
|
+
n._state.mount || (n._setValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
|
|
1174
|
+
}), s.current.formState = bt(i, n), s.current;
|
|
1175
1175
|
}
|
|
1176
1176
|
var xr = /* @__PURE__ */ ((e) => (e.PRIVACY_POLICY = "privacy-policy", e.PERSONAL_DATA = "personal-data", e.MAILING = "mailing", e.STONE_VALUE = "stone-value", e))(xr || {});
|
|
1177
|
-
const Fr =
|
|
1177
|
+
const Fr = Mt.bind(U), pr = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Ur = ({
|
|
1178
1178
|
isFormOpen: e,
|
|
1179
1179
|
setIsFormOpen: s,
|
|
1180
1180
|
isNews: t,
|
|
1181
1181
|
title: i,
|
|
1182
1182
|
isEmail: o,
|
|
1183
|
-
isPhone:
|
|
1183
|
+
isPhone: n,
|
|
1184
1184
|
isTextArea: c,
|
|
1185
1185
|
telegramLink: d = "https://t.me/stone_developer",
|
|
1186
1186
|
isRequiredPhone: D = !0,
|
|
@@ -1191,7 +1191,7 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1191
1191
|
submitHandler: ee,
|
|
1192
1192
|
modalWidth: H = "442px",
|
|
1193
1193
|
rowsTextArea: S = 2,
|
|
1194
|
-
advCheckBox:
|
|
1194
|
+
advCheckBox: M = { text: pr, isRequired: !0 },
|
|
1195
1195
|
isAdvCheckBox: te,
|
|
1196
1196
|
addTitleClassName: b,
|
|
1197
1197
|
createPortalObj: C,
|
|
@@ -1199,8 +1199,8 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1199
1199
|
blurHandler: V,
|
|
1200
1200
|
handlerButton: z,
|
|
1201
1201
|
block_name: j,
|
|
1202
|
-
policiesMap:
|
|
1203
|
-
emitCheckBox:
|
|
1202
|
+
policiesMap: G,
|
|
1203
|
+
emitCheckBox: K,
|
|
1204
1204
|
emitAdvCheckBox: se
|
|
1205
1205
|
}) => {
|
|
1206
1206
|
const {
|
|
@@ -1208,34 +1208,36 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1208
1208
|
handleSubmit: k,
|
|
1209
1209
|
reset: p,
|
|
1210
1210
|
control: R,
|
|
1211
|
-
watch:
|
|
1211
|
+
watch: N,
|
|
1212
1212
|
setValue: q,
|
|
1213
1213
|
formState: { errors: T }
|
|
1214
|
-
} = kr(), ue = !!
|
|
1215
|
-
|
|
1216
|
-
typeof
|
|
1217
|
-
}, [
|
|
1214
|
+
} = kr(), ue = !!N("email"), le = N("personalCheckBox"), fe = N("advCheckBox");
|
|
1215
|
+
Ne(() => {
|
|
1216
|
+
typeof le < "u" && K && K();
|
|
1217
|
+
}, [K, le]), Ne(() => {
|
|
1218
1218
|
typeof fe < "u" && se && se();
|
|
1219
1219
|
}, [se, fe]);
|
|
1220
|
-
const { isMobile: pe, currentClientWidth: Be } = Ut(), he =
|
|
1221
|
-
ee(
|
|
1222
|
-
}, ve = (
|
|
1220
|
+
const { isMobile: pe, currentClientWidth: Be } = Ut(), he = N("personalCheckBox"), Te = N("advCheckBox"), Ae = (J) => {
|
|
1221
|
+
ee(J), p();
|
|
1222
|
+
}, ve = (J, { action_element_status: me, action_element: be }) => {
|
|
1223
1223
|
V && V({
|
|
1224
|
-
e:
|
|
1224
|
+
e: J,
|
|
1225
1225
|
analyticParams: { action_element: be, action_element_status: me, block_name: j }
|
|
1226
1226
|
});
|
|
1227
1227
|
};
|
|
1228
|
-
return
|
|
1229
|
-
|
|
1228
|
+
return Ne(() => {
|
|
1229
|
+
if (!G)
|
|
1230
|
+
return;
|
|
1231
|
+
const J = ["personal-data", "privacy-policy", ...t ? [
|
|
1230
1232
|
"mailing"
|
|
1231
1233
|
/* MAILING */
|
|
1232
1234
|
] : []];
|
|
1233
1235
|
he ? q(
|
|
1234
1236
|
"policy-slug",
|
|
1235
|
-
|
|
1237
|
+
J.join(", "),
|
|
1236
1238
|
{ shouldDirty: !0 }
|
|
1237
1239
|
) : q("policy-slug", "", { shouldDirty: !0 });
|
|
1238
|
-
}, [he]), Be ? /* @__PURE__ */ L(
|
|
1240
|
+
}, [G, he]), Be ? /* @__PURE__ */ L(
|
|
1239
1241
|
It,
|
|
1240
1242
|
{
|
|
1241
1243
|
additionalClass: U.modal,
|
|
@@ -1294,7 +1296,7 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1294
1296
|
/* @__PURE__ */ de("form", { onSubmit: k(Ae), children: [
|
|
1295
1297
|
/* @__PURE__ */ de(Pt, { className: U.inputWrapper, children: [
|
|
1296
1298
|
/* @__PURE__ */ L(
|
|
1297
|
-
|
|
1299
|
+
Me,
|
|
1298
1300
|
{
|
|
1299
1301
|
width: "full",
|
|
1300
1302
|
size_s: "large",
|
|
@@ -1302,14 +1304,14 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1302
1304
|
placeholder: "Введите имя",
|
|
1303
1305
|
"data-testid": "modal_name",
|
|
1304
1306
|
...$("name", { required: !0, pattern: Rt }),
|
|
1305
|
-
onBlur: (
|
|
1307
|
+
onBlur: (J) => ve(J, {
|
|
1306
1308
|
action_element_status: T.name ? "error" : "success",
|
|
1307
1309
|
action_element: `input_${j}_name`
|
|
1308
1310
|
}),
|
|
1309
1311
|
error: !!T.name
|
|
1310
1312
|
}
|
|
1311
1313
|
),
|
|
1312
|
-
|
|
1314
|
+
n && /* @__PURE__ */ L(
|
|
1313
1315
|
ar,
|
|
1314
1316
|
{
|
|
1315
1317
|
name: "phone",
|
|
@@ -1319,12 +1321,12 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1319
1321
|
pattern: { value: Lt, message: "" }
|
|
1320
1322
|
},
|
|
1321
1323
|
defaultValue: "",
|
|
1322
|
-
render: ({ field:
|
|
1323
|
-
|
|
1324
|
+
render: ({ field: J }) => /* @__PURE__ */ L(
|
|
1325
|
+
Me,
|
|
1324
1326
|
{
|
|
1325
1327
|
inputMode: "numeric",
|
|
1326
1328
|
isPhoneIMask: !0,
|
|
1327
|
-
...
|
|
1329
|
+
...J,
|
|
1328
1330
|
width: "full",
|
|
1329
1331
|
"data-testid": "phone_modal",
|
|
1330
1332
|
type: "tel",
|
|
@@ -1340,7 +1342,7 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1340
1342
|
}
|
|
1341
1343
|
),
|
|
1342
1344
|
o && /* @__PURE__ */ L(
|
|
1343
|
-
|
|
1345
|
+
Me,
|
|
1344
1346
|
{
|
|
1345
1347
|
width: "full",
|
|
1346
1348
|
size_s: "large",
|
|
@@ -1352,14 +1354,14 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1352
1354
|
pattern: Ot
|
|
1353
1355
|
}),
|
|
1354
1356
|
error: !!T.email,
|
|
1355
|
-
onBlur: (
|
|
1357
|
+
onBlur: (J) => ve(J, {
|
|
1356
1358
|
action_element_status: T.email ? "error" : "success",
|
|
1357
1359
|
action_element: `input_${j}_email`
|
|
1358
1360
|
})
|
|
1359
1361
|
}
|
|
1360
1362
|
),
|
|
1361
1363
|
c && /* @__PURE__ */ L(
|
|
1362
|
-
|
|
1364
|
+
Nt,
|
|
1363
1365
|
{
|
|
1364
1366
|
"data-testid": "modal_textarea",
|
|
1365
1367
|
placeholder: x,
|
|
@@ -1368,14 +1370,14 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1368
1370
|
...$("textarea")
|
|
1369
1371
|
}
|
|
1370
1372
|
),
|
|
1371
|
-
|
|
1373
|
+
M && !t && te && /* @__PURE__ */ L(
|
|
1372
1374
|
rt,
|
|
1373
1375
|
{
|
|
1374
1376
|
"data-testid": "modal_advCheckBox",
|
|
1375
1377
|
isChecked: Te,
|
|
1376
1378
|
error: !!T.advCheckBox,
|
|
1377
|
-
text:
|
|
1378
|
-
...$("advCheckBox", { required:
|
|
1379
|
+
text: M.text,
|
|
1380
|
+
...$("advCheckBox", { required: M?.isRequired })
|
|
1379
1381
|
}
|
|
1380
1382
|
),
|
|
1381
1383
|
/* @__PURE__ */ de(
|
|
@@ -1393,10 +1395,10 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1393
1395
|
"a",
|
|
1394
1396
|
{
|
|
1395
1397
|
className: U.linkPolicy,
|
|
1396
|
-
href:
|
|
1398
|
+
href: G?.[
|
|
1397
1399
|
"personal-data"
|
|
1398
1400
|
/* PERSONAL_DATA */
|
|
1399
|
-
],
|
|
1401
|
+
] || "/documents/docs",
|
|
1400
1402
|
target: "_blank",
|
|
1401
1403
|
rel: "noopener noreferrer",
|
|
1402
1404
|
children: "Политики обработки"
|
|
@@ -1409,10 +1411,10 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1409
1411
|
"a",
|
|
1410
1412
|
{
|
|
1411
1413
|
className: U.linkPolicy,
|
|
1412
|
-
href:
|
|
1414
|
+
href: G?.[
|
|
1413
1415
|
"privacy-policy"
|
|
1414
1416
|
/* PRIVACY_POLICY */
|
|
1415
|
-
],
|
|
1417
|
+
] || "/documents/politika-konfidenczialnosti",
|
|
1416
1418
|
target: "_blank",
|
|
1417
1419
|
rel: "noopener noreferrer",
|
|
1418
1420
|
children: "защиты персональных данных"
|
|
@@ -1424,7 +1426,7 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1424
1426
|
"a",
|
|
1425
1427
|
{
|
|
1426
1428
|
className: U.linkPolicy,
|
|
1427
|
-
href:
|
|
1429
|
+
href: G?.mailing || "/documents/soglasie-na-rassylki",
|
|
1428
1430
|
target: "_blank",
|
|
1429
1431
|
rel: "noopener noreferrer",
|
|
1430
1432
|
children: "согласие на получение новостных и рекламных сообщений"
|
|
@@ -1438,10 +1440,10 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1438
1440
|
"a",
|
|
1439
1441
|
{
|
|
1440
1442
|
className: U.linkPolicy,
|
|
1441
|
-
href:
|
|
1443
|
+
href: G?.[
|
|
1442
1444
|
"privacy-policy"
|
|
1443
1445
|
/* PRIVACY_POLICY */
|
|
1444
|
-
],
|
|
1446
|
+
] || "/documents/politika-konfidenczialnosti",
|
|
1445
1447
|
target: "_blank",
|
|
1446
1448
|
rel: "noopener noreferrer",
|
|
1447
1449
|
children: "Политики обработки и защиты персональных данных"
|
|
@@ -1453,10 +1455,10 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1453
1455
|
"a",
|
|
1454
1456
|
{
|
|
1455
1457
|
className: U.linkPolicy,
|
|
1456
|
-
href:
|
|
1458
|
+
href: G?.[
|
|
1457
1459
|
"personal-data"
|
|
1458
1460
|
/* PERSONAL_DATA */
|
|
1459
|
-
],
|
|
1461
|
+
] || "/documents/docs",
|
|
1460
1462
|
target: "_blank",
|
|
1461
1463
|
rel: "noopener noreferrer",
|
|
1462
1464
|
children: "согласие на обработку персональных данных"
|
|
@@ -1479,7 +1481,7 @@ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики
|
|
|
1479
1481
|
onClick: () => {
|
|
1480
1482
|
z && z();
|
|
1481
1483
|
},
|
|
1482
|
-
disabled: !!T.name || !!T.phone && D || !!T.email && w || !!T.advCheckBox &&
|
|
1484
|
+
disabled: !!T.name || !!T.phone && D || !!T.email && w || !!T.advCheckBox && M?.isRequired || !!T.personalCheckBox && !t,
|
|
1483
1485
|
children: "Отправить запрос"
|
|
1484
1486
|
}
|
|
1485
1487
|
)
|