stone-kit 0.0.237 → 0.0.240
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/{SortSelect-nNKuj-EY.js → SortSelect-C_Ue6qxA.js} +3 -2
- package/dist/components/FormModal/ui/ModalForm.d.ts +7 -1
- package/dist/components/FormModal/ui/ModalForm.js +490 -459
- package/dist/components/LotCard/ui/LotCard.js +4 -3
- package/dist/components/SortSelect/index.js +1 -1
- package/dist/components/SortSelect/ui/SortSelect.js +3 -2
- package/dist/components/TabSwitcher/index.js +1 -1
- package/dist/components/TabSwitcher/ui/TabSwitcher.js +3 -2
- package/dist/components/TextArea/TextArea.js +20 -0
- package/dist/components/TextArea/TextArea.types.d.ts +11 -0
- package/dist/components/TextArea/TextArea.types.js +1 -0
- package/dist/main.js +1 -1
- package/dist/shared/const.d.ts +1 -0
- package/dist/shared/const.js +6 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,63 +1,64 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as O, jsxs as Se } from "react/jsx-runtime";
|
|
2
2
|
import { I as xt } from "../../../index-CbZmuQco.js";
|
|
3
3
|
import { M as Vt } from "../../../Modal-258KOiTO.js";
|
|
4
|
-
import { Flex as
|
|
5
|
-
import { Input as
|
|
6
|
-
import
|
|
4
|
+
import { Flex as At } from "../../Flex/ui/Flex.js";
|
|
5
|
+
import { Input as Ee } from "../../Input/ui/Input.js";
|
|
6
|
+
import W from "react";
|
|
7
7
|
import { Button as Ke } from "../../Button/ui/Button.js";
|
|
8
|
-
import { NewIcon as
|
|
9
|
-
import { phoneReg as wt, nameReg as pt } from "../utils/reg.js";
|
|
8
|
+
import { NewIcon as Ft } from "../../NewIcon/ui/NewIcon.js";
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
import { TextArea as kt } from "../../TextArea/TextArea.js";
|
|
12
|
+
const St = "_btn_q5rib_1", Et = "_modal_q5rib_9", Ct = "_modalBody_q5rib_16", Bt = "_root_q5rib_21", Tt = "_title_q5rib_31", Rt = "_description_q5rib_38", Lt = "_inputWrapper_q5rib_45", Z = {
|
|
13
|
+
btn: St,
|
|
14
|
+
modal: Et,
|
|
15
|
+
modalBody: Ct,
|
|
16
|
+
root: Bt,
|
|
17
|
+
title: Tt,
|
|
18
|
+
description: Rt,
|
|
19
|
+
inputWrapper: Lt
|
|
19
20
|
};
|
|
20
|
-
var
|
|
21
|
-
const
|
|
22
|
-
var S = (e) => !B(e) && !Array.isArray(e) &&
|
|
21
|
+
var he = (e) => e.type === "checkbox", ne = (e) => e instanceof Date, B = (e) => e == null;
|
|
22
|
+
const at = (e) => typeof e == "object";
|
|
23
|
+
var S = (e) => !B(e) && !Array.isArray(e) && at(e) && !ne(e), Mt = (e) => S(e) && e.target ? he(e.target) ? e.target.checked : e.target.value : e, Ot = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Nt = (e, s) => e.has(Ot(s)), Ut = (e) => {
|
|
23
24
|
const s = e.constructor && e.constructor.prototype;
|
|
24
25
|
return S(s) && s.hasOwnProperty("isPrototypeOf");
|
|
25
|
-
},
|
|
26
|
-
function
|
|
26
|
+
}, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
27
|
+
function P(e) {
|
|
27
28
|
let s;
|
|
28
29
|
const r = Array.isArray(e);
|
|
29
30
|
if (e instanceof Date)
|
|
30
31
|
s = new Date(e);
|
|
31
32
|
else if (e instanceof Set)
|
|
32
33
|
s = new Set(e);
|
|
33
|
-
else if (!(
|
|
34
|
-
if (s = r ? [] : {}, !r && !
|
|
34
|
+
else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (r || S(e)))
|
|
35
|
+
if (s = r ? [] : {}, !r && !Ut(e))
|
|
35
36
|
s = e;
|
|
36
37
|
else
|
|
37
|
-
for (const
|
|
38
|
-
e.hasOwnProperty(
|
|
38
|
+
for (const n in e)
|
|
39
|
+
e.hasOwnProperty(n) && (s[n] = P(e[n]));
|
|
39
40
|
else
|
|
40
41
|
return e;
|
|
41
42
|
return s;
|
|
42
43
|
}
|
|
43
|
-
var
|
|
44
|
+
var Fe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], w = (e) => e === void 0, d = (e, s, r) => {
|
|
44
45
|
if (!s || !S(e))
|
|
45
46
|
return r;
|
|
46
|
-
const
|
|
47
|
-
return
|
|
48
|
-
},
|
|
49
|
-
let
|
|
50
|
-
const u =
|
|
51
|
-
for (; ++
|
|
52
|
-
const g = u[
|
|
53
|
-
let
|
|
54
|
-
if (
|
|
55
|
-
const
|
|
56
|
-
|
|
47
|
+
const n = Fe(s.split(/[,[\].]+?/)).reduce((u, l) => B(u) ? u : u[l], e);
|
|
48
|
+
return w(n) || n === e ? w(e[s]) ? r : e[s] : n;
|
|
49
|
+
}, ee = (e) => typeof e == "boolean", Le = (e) => /^\w*$/.test(e), lt = (e) => Fe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, s, r) => {
|
|
50
|
+
let n = -1;
|
|
51
|
+
const u = Le(s) ? [s] : lt(s), l = u.length, y = l - 1;
|
|
52
|
+
for (; ++n < l; ) {
|
|
53
|
+
const g = u[n];
|
|
54
|
+
let L = r;
|
|
55
|
+
if (n !== y) {
|
|
56
|
+
const N = e[g];
|
|
57
|
+
L = S(N) || Array.isArray(N) ? N : isNaN(+u[n + 1]) ? {} : [];
|
|
57
58
|
}
|
|
58
59
|
if (g === "__proto__")
|
|
59
60
|
return;
|
|
60
|
-
e[g] =
|
|
61
|
+
e[g] = L, e = e[g];
|
|
61
62
|
}
|
|
62
63
|
return e;
|
|
63
64
|
};
|
|
@@ -65,13 +66,13 @@ const Je = {
|
|
|
65
66
|
BLUR: "blur",
|
|
66
67
|
FOCUS_OUT: "focusout",
|
|
67
68
|
CHANGE: "change"
|
|
68
|
-
},
|
|
69
|
+
}, K = {
|
|
69
70
|
onBlur: "onBlur",
|
|
70
71
|
onChange: "onChange",
|
|
71
72
|
onSubmit: "onSubmit",
|
|
72
73
|
onTouched: "onTouched",
|
|
73
74
|
all: "all"
|
|
74
|
-
},
|
|
75
|
+
}, X = {
|
|
75
76
|
max: "max",
|
|
76
77
|
min: "min",
|
|
77
78
|
maxLength: "maxLength",
|
|
@@ -80,27 +81,27 @@ const Je = {
|
|
|
80
81
|
required: "required",
|
|
81
82
|
validate: "validate"
|
|
82
83
|
};
|
|
83
|
-
|
|
84
|
-
var
|
|
84
|
+
W.createContext(null);
|
|
85
|
+
var qt = (e, s, r, n = !0) => {
|
|
85
86
|
const u = {
|
|
86
87
|
defaultValues: s._defaultValues
|
|
87
88
|
};
|
|
88
|
-
for (const
|
|
89
|
-
Object.defineProperty(u,
|
|
89
|
+
for (const l in e)
|
|
90
|
+
Object.defineProperty(u, l, {
|
|
90
91
|
get: () => {
|
|
91
|
-
const y =
|
|
92
|
-
return s._proxyFormState[y] !==
|
|
92
|
+
const y = l;
|
|
93
|
+
return s._proxyFormState[y] !== K.all && (s._proxyFormState[y] = !n || K.all), e[y];
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
96
|
return u;
|
|
96
|
-
},
|
|
97
|
+
}, R = (e) => S(e) && !Object.keys(e).length, It = (e, s, r, n) => {
|
|
97
98
|
r(e);
|
|
98
|
-
const { name: u, ...
|
|
99
|
-
return
|
|
99
|
+
const { name: u, ...l } = e;
|
|
100
|
+
return R(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((y) => s[y] === K.all);
|
|
100
101
|
}, _e = (e) => Array.isArray(e) ? e : [e];
|
|
101
|
-
function
|
|
102
|
-
const s =
|
|
103
|
-
s.current = e,
|
|
102
|
+
function Pt(e) {
|
|
103
|
+
const s = W.useRef(e);
|
|
104
|
+
s.current = e, W.useEffect(() => {
|
|
104
105
|
const r = !e.disabled && s.current.subject && s.current.subject.subscribe({
|
|
105
106
|
next: s.current.next
|
|
106
107
|
});
|
|
@@ -109,49 +110,49 @@ function It(e) {
|
|
|
109
110
|
};
|
|
110
111
|
}, [e.disabled]);
|
|
111
112
|
}
|
|
112
|
-
var
|
|
113
|
+
var J = (e) => typeof e == "string", Wt = (e, s, r, n, u) => J(e) ? (n && s.watch.add(e), d(r, e, u)) : Array.isArray(e) ? e.map((l) => (n && s.watch.add(l), d(r, l))) : (n && (s.watchAll = !0), r), Ht = (e, s, r, n, u) => s ? {
|
|
113
114
|
...r[e],
|
|
114
115
|
types: {
|
|
115
116
|
...r[e] && r[e].types ? r[e].types : {},
|
|
116
|
-
[
|
|
117
|
+
[n]: u || !0
|
|
117
118
|
}
|
|
118
119
|
} : {}, Qe = (e) => ({
|
|
119
|
-
isOnSubmit: !e || e ===
|
|
120
|
-
isOnBlur: e ===
|
|
121
|
-
isOnChange: e ===
|
|
122
|
-
isOnAll: e ===
|
|
123
|
-
isOnTouch: e ===
|
|
124
|
-
}), Xe = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((
|
|
125
|
-
const
|
|
120
|
+
isOnSubmit: !e || e === K.onSubmit,
|
|
121
|
+
isOnBlur: e === K.onBlur,
|
|
122
|
+
isOnChange: e === K.onChange,
|
|
123
|
+
isOnAll: e === K.all,
|
|
124
|
+
isOnTouch: e === K.onTouched
|
|
125
|
+
}), Xe = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
126
|
+
const ye = (e, s, r, n) => {
|
|
126
127
|
for (const u of r || Object.keys(e)) {
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
const { _f: y, ...g } =
|
|
128
|
+
const l = d(e, u);
|
|
129
|
+
if (l) {
|
|
130
|
+
const { _f: y, ...g } = l;
|
|
130
131
|
if (y) {
|
|
131
|
-
if (y.refs && y.refs[0] && s(y.refs[0], u) && !
|
|
132
|
+
if (y.refs && y.refs[0] && s(y.refs[0], u) && !n)
|
|
132
133
|
break;
|
|
133
|
-
if (y.ref && s(y.ref, y.name) && !
|
|
134
|
+
if (y.ref && s(y.ref, y.name) && !n)
|
|
134
135
|
break;
|
|
135
|
-
|
|
136
|
+
ye(g, s);
|
|
136
137
|
} else
|
|
137
|
-
S(g) &&
|
|
138
|
+
S(g) && ye(g, s);
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
|
-
var
|
|
142
|
-
const
|
|
143
|
-
return V(
|
|
144
|
-
},
|
|
145
|
-
if (!
|
|
142
|
+
var zt = (e, s, r) => {
|
|
143
|
+
const n = _e(d(e, r));
|
|
144
|
+
return V(n, "root", s[r]), V(e, r, n), e;
|
|
145
|
+
}, Me = (e) => e.type === "file", te = (e) => typeof e == "function", be = (e) => {
|
|
146
|
+
if (!Re)
|
|
146
147
|
return !1;
|
|
147
148
|
const s = e ? e.ownerDocument : 0;
|
|
148
149
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
149
|
-
}, me = (e) =>
|
|
150
|
+
}, me = (e) => J(e), Oe = (e) => e.type === "radio", xe = (e) => e instanceof RegExp;
|
|
150
151
|
const Ye = {
|
|
151
152
|
value: !1,
|
|
152
153
|
isValid: !1
|
|
153
154
|
}, Ze = { value: !0, isValid: !0 };
|
|
154
|
-
var
|
|
155
|
+
var nt = (e) => {
|
|
155
156
|
if (Array.isArray(e)) {
|
|
156
157
|
if (e.length > 1) {
|
|
157
158
|
const s = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
@@ -159,7 +160,7 @@ var lt = (e) => {
|
|
|
159
160
|
}
|
|
160
161
|
return e[0].checked && !e[0].disabled ? (
|
|
161
162
|
// @ts-expect-error expected to work in the browser
|
|
162
|
-
e[0].attributes && !
|
|
163
|
+
e[0].attributes && !w(e[0].attributes.value) ? w(e[0].value) || e[0].value === "" ? Ze : { value: e[0].value, isValid: !0 } : Ze
|
|
163
164
|
) : Ye;
|
|
164
165
|
}
|
|
165
166
|
return Ye;
|
|
@@ -173,208 +174,208 @@ var ut = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disab
|
|
|
173
174
|
value: r.value
|
|
174
175
|
} : s, et) : et;
|
|
175
176
|
function tt(e, s, r = "validate") {
|
|
176
|
-
if (me(e) || Array.isArray(e) && e.every(me) ||
|
|
177
|
+
if (me(e) || Array.isArray(e) && e.every(me) || ee(e) && !e)
|
|
177
178
|
return {
|
|
178
179
|
type: r,
|
|
179
180
|
message: me(e) ? e : "",
|
|
180
181
|
ref: s
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
|
-
var
|
|
184
|
+
var le = (e) => S(e) && !xe(e) ? e : {
|
|
184
185
|
value: e,
|
|
185
186
|
message: ""
|
|
186
|
-
}, rt = async (e, s, r,
|
|
187
|
-
const { ref:
|
|
188
|
-
if (
|
|
187
|
+
}, rt = async (e, s, r, n, u) => {
|
|
188
|
+
const { ref: l, refs: y, required: g, maxLength: L, minLength: N, min: A, max: v, pattern: U, validate: G, name: C, valueAsNumber: ue, mount: H, disabled: T } = e._f, m = d(s, C);
|
|
189
|
+
if (!H || T)
|
|
189
190
|
return {};
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
},
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
type: _ ? E :
|
|
196
|
-
message:
|
|
197
|
-
ref:
|
|
198
|
-
...
|
|
191
|
+
const z = y ? y[0] : l, $ = (_) => {
|
|
192
|
+
n && z.reportValidity && (z.setCustomValidity(ee(_) ? "" : _ || ""), z.reportValidity());
|
|
193
|
+
}, F = {}, Y = Oe(l), se = he(l), Q = Y || se, ie = (ue || Me(l)) && w(l.value) && w(m) || be(l) && l.value === "" || m === "" || Array.isArray(m) && !m.length, q = Ht.bind(null, C, r, F), ge = (_, b, D, E = X.maxLength, j = X.minLength) => {
|
|
194
|
+
const I = _ ? b : D;
|
|
195
|
+
F[C] = {
|
|
196
|
+
type: _ ? E : j,
|
|
197
|
+
message: I,
|
|
198
|
+
ref: l,
|
|
199
|
+
...q(_ ? E : j, I)
|
|
199
200
|
};
|
|
200
201
|
};
|
|
201
|
-
if (u ? !Array.isArray(m) || !m.length : g && (!
|
|
202
|
-
const { value: _, message: b } = me(g) ? { value: !!g, message: g } :
|
|
203
|
-
if (_ && (
|
|
204
|
-
type:
|
|
202
|
+
if (u ? !Array.isArray(m) || !m.length : g && (!Q && (ie || B(m)) || ee(m) && !m || se && !nt(y).isValid || Y && !ut(y).isValid)) {
|
|
203
|
+
const { value: _, message: b } = me(g) ? { value: !!g, message: g } : le(g);
|
|
204
|
+
if (_ && (F[C] = {
|
|
205
|
+
type: X.required,
|
|
205
206
|
message: b,
|
|
206
|
-
ref:
|
|
207
|
-
...
|
|
207
|
+
ref: z,
|
|
208
|
+
...q(X.required, b)
|
|
208
209
|
}, !r))
|
|
209
|
-
return
|
|
210
|
+
return $(b), F;
|
|
210
211
|
}
|
|
211
|
-
if (!
|
|
212
|
+
if (!ie && (!B(A) || !B(v))) {
|
|
212
213
|
let _, b;
|
|
213
|
-
const D =
|
|
214
|
+
const D = le(v), E = le(A);
|
|
214
215
|
if (!B(m) && !isNaN(m)) {
|
|
215
|
-
const
|
|
216
|
-
B(D.value) || (_ =
|
|
216
|
+
const j = l.valueAsNumber || m && +m;
|
|
217
|
+
B(D.value) || (_ = j > D.value), B(E.value) || (b = j < E.value);
|
|
217
218
|
} else {
|
|
218
|
-
const
|
|
219
|
-
|
|
219
|
+
const j = l.valueAsDate || new Date(m), I = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), oe = l.type == "time", ce = l.type == "week";
|
|
220
|
+
J(D.value) && m && (_ = oe ? I(m) > I(D.value) : ce ? m > D.value : j > new Date(D.value)), J(E.value) && m && (b = oe ? I(m) < I(E.value) : ce ? m < E.value : j < new Date(E.value));
|
|
220
221
|
}
|
|
221
|
-
if ((_ || b) && (ge(!!_, D.message, E.message,
|
|
222
|
-
return
|
|
222
|
+
if ((_ || b) && (ge(!!_, D.message, E.message, X.max, X.min), !r))
|
|
223
|
+
return $(F[C].message), F;
|
|
223
224
|
}
|
|
224
|
-
if ((
|
|
225
|
-
const _ =
|
|
225
|
+
if ((L || N) && !ie && (J(m) || u && Array.isArray(m))) {
|
|
226
|
+
const _ = le(L), b = le(N), D = !B(_.value) && m.length > +_.value, E = !B(b.value) && m.length < +b.value;
|
|
226
227
|
if ((D || E) && (ge(D, _.message, b.message), !r))
|
|
227
|
-
return
|
|
228
|
+
return $(F[C].message), F;
|
|
228
229
|
}
|
|
229
|
-
if (
|
|
230
|
-
const { value: _, message: b } =
|
|
231
|
-
if (xe(_) && !m.match(_) && (
|
|
232
|
-
type:
|
|
230
|
+
if (U && !ie && J(m)) {
|
|
231
|
+
const { value: _, message: b } = le(U);
|
|
232
|
+
if (xe(_) && !m.match(_) && (F[C] = {
|
|
233
|
+
type: X.pattern,
|
|
233
234
|
message: b,
|
|
234
|
-
ref:
|
|
235
|
-
...
|
|
235
|
+
ref: l,
|
|
236
|
+
...q(X.pattern, b)
|
|
236
237
|
}, !r))
|
|
237
|
-
return
|
|
238
|
+
return $(b), F;
|
|
238
239
|
}
|
|
239
|
-
if (
|
|
240
|
-
if (
|
|
241
|
-
const _ = await
|
|
242
|
-
if (b && (
|
|
240
|
+
if (G) {
|
|
241
|
+
if (te(G)) {
|
|
242
|
+
const _ = await G(m, s), b = tt(_, z);
|
|
243
|
+
if (b && (F[C] = {
|
|
243
244
|
...b,
|
|
244
|
-
...
|
|
245
|
+
...q(X.validate, b.message)
|
|
245
246
|
}, !r))
|
|
246
|
-
return
|
|
247
|
-
} else if (S(
|
|
247
|
+
return $(b.message), F;
|
|
248
|
+
} else if (S(G)) {
|
|
248
249
|
let _ = {};
|
|
249
|
-
for (const b in
|
|
250
|
-
if (!
|
|
250
|
+
for (const b in G) {
|
|
251
|
+
if (!R(_) && !r)
|
|
251
252
|
break;
|
|
252
|
-
const D = tt(await
|
|
253
|
+
const D = tt(await G[b](m, s), z, b);
|
|
253
254
|
D && (_ = {
|
|
254
255
|
...D,
|
|
255
|
-
...
|
|
256
|
-
},
|
|
256
|
+
...q(b, D.message)
|
|
257
|
+
}, $(D.message), r && (F[C] = _));
|
|
257
258
|
}
|
|
258
|
-
if (!
|
|
259
|
-
ref:
|
|
259
|
+
if (!R(_) && (F[C] = {
|
|
260
|
+
ref: z,
|
|
260
261
|
..._
|
|
261
262
|
}, !r))
|
|
262
|
-
return
|
|
263
|
+
return F;
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
|
-
return
|
|
266
|
+
return $(!0), F;
|
|
266
267
|
};
|
|
267
|
-
function
|
|
268
|
+
function $t(e, s) {
|
|
268
269
|
const r = s.slice(0, -1).length;
|
|
269
|
-
let
|
|
270
|
-
for (;
|
|
271
|
-
e =
|
|
270
|
+
let n = 0;
|
|
271
|
+
for (; n < r; )
|
|
272
|
+
e = w(e) ? n++ : e[s[n++]];
|
|
272
273
|
return e;
|
|
273
274
|
}
|
|
274
|
-
function
|
|
275
|
+
function jt(e) {
|
|
275
276
|
for (const s in e)
|
|
276
|
-
if (e.hasOwnProperty(s) && !
|
|
277
|
+
if (e.hasOwnProperty(s) && !w(e[s]))
|
|
277
278
|
return !1;
|
|
278
279
|
return !0;
|
|
279
280
|
}
|
|
280
281
|
function k(e, s) {
|
|
281
|
-
const r = Array.isArray(s) ? s :
|
|
282
|
-
return
|
|
282
|
+
const r = Array.isArray(s) ? s : Le(s) ? [s] : lt(s), n = r.length === 1 ? e : $t(e, r), u = r.length - 1, l = r[u];
|
|
283
|
+
return n && delete n[l], u !== 0 && (S(n) && R(n) || Array.isArray(n) && jt(n)) && k(e, r.slice(0, -1)), e;
|
|
283
284
|
}
|
|
284
|
-
var
|
|
285
|
+
var Ce = () => {
|
|
285
286
|
let e = [];
|
|
286
287
|
return {
|
|
287
288
|
get observers() {
|
|
288
289
|
return e;
|
|
289
290
|
},
|
|
290
291
|
next: (u) => {
|
|
291
|
-
for (const
|
|
292
|
-
|
|
292
|
+
for (const l of e)
|
|
293
|
+
l.next && l.next(u);
|
|
293
294
|
},
|
|
294
295
|
subscribe: (u) => (e.push(u), {
|
|
295
296
|
unsubscribe: () => {
|
|
296
|
-
e = e.filter((
|
|
297
|
+
e = e.filter((l) => l !== u);
|
|
297
298
|
}
|
|
298
299
|
}),
|
|
299
300
|
unsubscribe: () => {
|
|
300
301
|
e = [];
|
|
301
302
|
}
|
|
302
303
|
};
|
|
303
|
-
}, Ve = (e) => B(e) || !
|
|
304
|
-
function
|
|
304
|
+
}, Ve = (e) => B(e) || !at(e);
|
|
305
|
+
function re(e, s) {
|
|
305
306
|
if (Ve(e) || Ve(s))
|
|
306
307
|
return e === s;
|
|
307
|
-
if (
|
|
308
|
+
if (ne(e) && ne(s))
|
|
308
309
|
return e.getTime() === s.getTime();
|
|
309
|
-
const r = Object.keys(e),
|
|
310
|
-
if (r.length !==
|
|
310
|
+
const r = Object.keys(e), n = Object.keys(s);
|
|
311
|
+
if (r.length !== n.length)
|
|
311
312
|
return !1;
|
|
312
313
|
for (const u of r) {
|
|
313
|
-
const
|
|
314
|
-
if (!
|
|
314
|
+
const l = e[u];
|
|
315
|
+
if (!n.includes(u))
|
|
315
316
|
return !1;
|
|
316
317
|
if (u !== "ref") {
|
|
317
318
|
const y = s[u];
|
|
318
|
-
if (
|
|
319
|
+
if (ne(l) && ne(y) || S(l) && S(y) || Array.isArray(l) && Array.isArray(y) ? !re(l, y) : l !== y)
|
|
319
320
|
return !1;
|
|
320
321
|
}
|
|
321
322
|
}
|
|
322
323
|
return !0;
|
|
323
324
|
}
|
|
324
|
-
var ot = (e) => e.type === "select-multiple",
|
|
325
|
+
var ot = (e) => e.type === "select-multiple", Kt = (e) => Oe(e) || he(e), Be = (e) => be(e) && e.isConnected, ct = (e) => {
|
|
325
326
|
for (const s in e)
|
|
326
|
-
if (
|
|
327
|
+
if (te(e[s]))
|
|
327
328
|
return !0;
|
|
328
329
|
return !1;
|
|
329
330
|
};
|
|
330
|
-
function
|
|
331
|
+
function Ae(e, s = {}) {
|
|
331
332
|
const r = Array.isArray(e);
|
|
332
333
|
if (S(e) || r)
|
|
333
|
-
for (const
|
|
334
|
-
Array.isArray(e[
|
|
334
|
+
for (const n in e)
|
|
335
|
+
Array.isArray(e[n]) || S(e[n]) && !ct(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, Ae(e[n], s[n])) : B(e[n]) || (s[n] = !0);
|
|
335
336
|
return s;
|
|
336
337
|
}
|
|
337
338
|
function ft(e, s, r) {
|
|
338
|
-
const
|
|
339
|
-
if (S(e) ||
|
|
339
|
+
const n = Array.isArray(e);
|
|
340
|
+
if (S(e) || n)
|
|
340
341
|
for (const u in e)
|
|
341
|
-
Array.isArray(e[u]) || S(e[u]) && !ct(e[u]) ?
|
|
342
|
+
Array.isArray(e[u]) || S(e[u]) && !ct(e[u]) ? w(s) || Ve(r[u]) ? r[u] = Array.isArray(e[u]) ? Ae(e[u], []) : { ...Ae(e[u]) } : ft(e[u], B(s) ? {} : s[u], r[u]) : r[u] = !re(e[u], s[u]);
|
|
342
343
|
return r;
|
|
343
344
|
}
|
|
344
|
-
var ve = (e, s) => ft(e, s,
|
|
345
|
-
function
|
|
345
|
+
var ve = (e, s) => ft(e, s, Ae(s)), dt = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: n }) => w(e) ? e : s ? e === "" ? NaN : e && +e : r && J(e) ? new Date(e) : n ? n(e) : e;
|
|
346
|
+
function Te(e) {
|
|
346
347
|
const s = e.ref;
|
|
347
348
|
if (!(e.refs ? e.refs.every((r) => r.disabled) : s.disabled))
|
|
348
|
-
return
|
|
349
|
+
return Me(s) ? s.files : Oe(s) ? ut(e.refs).value : ot(s) ? [...s.selectedOptions].map(({ value: r }) => r) : he(s) ? nt(e.refs).value : dt(w(s.value) ? e.ref.value : s.value, e);
|
|
349
350
|
}
|
|
350
|
-
var
|
|
351
|
+
var Gt = (e, s, r, n) => {
|
|
351
352
|
const u = {};
|
|
352
|
-
for (const
|
|
353
|
-
const y = d(s,
|
|
354
|
-
y && V(u,
|
|
353
|
+
for (const l of e) {
|
|
354
|
+
const y = d(s, l);
|
|
355
|
+
y && V(u, l, y._f);
|
|
355
356
|
}
|
|
356
357
|
return {
|
|
357
358
|
criteriaMode: r,
|
|
358
359
|
names: [...e],
|
|
359
360
|
fields: u,
|
|
360
|
-
shouldUseNativeValidation:
|
|
361
|
+
shouldUseNativeValidation: n
|
|
361
362
|
};
|
|
362
|
-
},
|
|
363
|
+
}, de = (e) => w(e) ? e : xe(e) ? e.source : S(e) ? xe(e.value) ? e.value.source : e.value : e, Jt = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
363
364
|
function st(e, s, r) {
|
|
364
|
-
const
|
|
365
|
-
if (
|
|
365
|
+
const n = d(e, r);
|
|
366
|
+
if (n || Le(r))
|
|
366
367
|
return {
|
|
367
|
-
error:
|
|
368
|
+
error: n,
|
|
368
369
|
name: r
|
|
369
370
|
};
|
|
370
371
|
const u = r.split(".");
|
|
371
372
|
for (; u.length; ) {
|
|
372
|
-
const
|
|
373
|
-
if (y && !Array.isArray(y) && r !==
|
|
373
|
+
const l = u.join("."), y = d(s, l), g = d(e, l);
|
|
374
|
+
if (y && !Array.isArray(y) && r !== l)
|
|
374
375
|
return { name: r };
|
|
375
376
|
if (g && g.type)
|
|
376
377
|
return {
|
|
377
|
-
name:
|
|
378
|
+
name: l,
|
|
378
379
|
error: g
|
|
379
380
|
};
|
|
380
381
|
u.pop();
|
|
@@ -383,20 +384,20 @@ function st(e, s, r) {
|
|
|
383
384
|
name: r
|
|
384
385
|
};
|
|
385
386
|
}
|
|
386
|
-
var
|
|
387
|
-
const
|
|
388
|
-
mode:
|
|
389
|
-
reValidateMode:
|
|
387
|
+
var Qt = (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, Xt = (e, s) => !Fe(d(e, s)).length && k(e, s);
|
|
388
|
+
const Yt = {
|
|
389
|
+
mode: K.onSubmit,
|
|
390
|
+
reValidateMode: K.onChange,
|
|
390
391
|
shouldFocusError: !0
|
|
391
392
|
};
|
|
392
|
-
function
|
|
393
|
+
function Zt(e = {}) {
|
|
393
394
|
let s = {
|
|
394
|
-
...
|
|
395
|
+
...Yt,
|
|
395
396
|
...e
|
|
396
397
|
}, r = {
|
|
397
398
|
submitCount: 0,
|
|
398
399
|
isDirty: !1,
|
|
399
|
-
isLoading:
|
|
400
|
+
isLoading: te(s.defaultValues),
|
|
400
401
|
isValidating: !1,
|
|
401
402
|
isSubmitted: !1,
|
|
402
403
|
isSubmitting: !1,
|
|
@@ -407,7 +408,7 @@ function Xt(e = {}) {
|
|
|
407
408
|
validatingFields: {},
|
|
408
409
|
errors: s.errors || {},
|
|
409
410
|
disabled: s.disabled || !1
|
|
410
|
-
},
|
|
411
|
+
}, n = {}, u = S(s.defaultValues) || S(s.values) ? P(s.defaultValues || s.values) || {} : {}, l = s.shouldUnregister ? {} : P(u), y = {
|
|
411
412
|
action: !1,
|
|
412
413
|
mount: !1,
|
|
413
414
|
watch: !1
|
|
@@ -416,8 +417,8 @@ function Xt(e = {}) {
|
|
|
416
417
|
unMount: /* @__PURE__ */ new Set(),
|
|
417
418
|
array: /* @__PURE__ */ new Set(),
|
|
418
419
|
watch: /* @__PURE__ */ new Set()
|
|
419
|
-
},
|
|
420
|
-
const
|
|
420
|
+
}, L, N = 0;
|
|
421
|
+
const A = {
|
|
421
422
|
isDirty: !1,
|
|
422
423
|
dirtyFields: !1,
|
|
423
424
|
validatingFields: !1,
|
|
@@ -426,40 +427,40 @@ function Xt(e = {}) {
|
|
|
426
427
|
isValid: !1,
|
|
427
428
|
errors: !1
|
|
428
429
|
}, v = {
|
|
429
|
-
values:
|
|
430
|
-
array:
|
|
431
|
-
state:
|
|
432
|
-
},
|
|
433
|
-
clearTimeout(
|
|
434
|
-
},
|
|
435
|
-
if (
|
|
436
|
-
const i = s.resolver ?
|
|
430
|
+
values: Ce(),
|
|
431
|
+
array: Ce(),
|
|
432
|
+
state: Ce()
|
|
433
|
+
}, U = Qe(s.mode), G = Qe(s.reValidateMode), C = s.criteriaMode === K.all, ue = (t) => (i) => {
|
|
434
|
+
clearTimeout(N), N = setTimeout(t, i);
|
|
435
|
+
}, H = async (t) => {
|
|
436
|
+
if (A.isValid || t) {
|
|
437
|
+
const i = s.resolver ? R((await Q()).errors) : await q(n, !0);
|
|
437
438
|
i !== r.isValid && v.state.next({
|
|
438
439
|
isValid: i
|
|
439
440
|
});
|
|
440
441
|
}
|
|
441
|
-
},
|
|
442
|
-
(
|
|
443
|
-
|
|
442
|
+
}, T = (t, i) => {
|
|
443
|
+
(A.isValidating || A.validatingFields) && ((t || Array.from(g.mount)).forEach((a) => {
|
|
444
|
+
a && (i ? V(r.validatingFields, a, i) : k(r.validatingFields, a));
|
|
444
445
|
}), v.state.next({
|
|
445
446
|
validatingFields: r.validatingFields,
|
|
446
|
-
isValidating: !
|
|
447
|
+
isValidating: !R(r.validatingFields)
|
|
447
448
|
}));
|
|
448
|
-
}, m = (t, i = [],
|
|
449
|
-
if (f &&
|
|
450
|
-
if (y.action = !0, o && Array.isArray(d(
|
|
451
|
-
const h =
|
|
452
|
-
c && V(
|
|
449
|
+
}, m = (t, i = [], a, f, c = !0, o = !0) => {
|
|
450
|
+
if (f && a) {
|
|
451
|
+
if (y.action = !0, o && Array.isArray(d(n, t))) {
|
|
452
|
+
const h = a(d(n, t), f.argA, f.argB);
|
|
453
|
+
c && V(n, t, h);
|
|
453
454
|
}
|
|
454
455
|
if (o && Array.isArray(d(r.errors, t))) {
|
|
455
|
-
const h =
|
|
456
|
-
c && V(r.errors, t, h),
|
|
456
|
+
const h = a(d(r.errors, t), f.argA, f.argB);
|
|
457
|
+
c && V(r.errors, t, h), Xt(r.errors, t);
|
|
457
458
|
}
|
|
458
|
-
if (
|
|
459
|
-
const h =
|
|
459
|
+
if (A.touchedFields && o && Array.isArray(d(r.touchedFields, t))) {
|
|
460
|
+
const h = a(d(r.touchedFields, t), f.argA, f.argB);
|
|
460
461
|
c && V(r.touchedFields, t, h);
|
|
461
462
|
}
|
|
462
|
-
|
|
463
|
+
A.dirtyFields && (r.dirtyFields = ve(u, l)), v.state.next({
|
|
463
464
|
name: t,
|
|
464
465
|
isDirty: _(t, i),
|
|
465
466
|
dirtyFields: r.dirtyFields,
|
|
@@ -467,43 +468,43 @@ function Xt(e = {}) {
|
|
|
467
468
|
isValid: r.isValid
|
|
468
469
|
});
|
|
469
470
|
} else
|
|
470
|
-
V(
|
|
471
|
-
},
|
|
471
|
+
V(l, t, i);
|
|
472
|
+
}, z = (t, i) => {
|
|
472
473
|
V(r.errors, t, i), v.state.next({
|
|
473
474
|
errors: r.errors
|
|
474
475
|
});
|
|
475
|
-
},
|
|
476
|
+
}, $ = (t) => {
|
|
476
477
|
r.errors = t, v.state.next({
|
|
477
478
|
errors: r.errors,
|
|
478
479
|
isValid: !1
|
|
479
480
|
});
|
|
480
|
-
},
|
|
481
|
-
const c = d(
|
|
481
|
+
}, F = (t, i, a, f) => {
|
|
482
|
+
const c = d(n, t);
|
|
482
483
|
if (c) {
|
|
483
|
-
const o = d(
|
|
484
|
-
|
|
484
|
+
const o = d(l, t, w(a) ? d(u, t) : a);
|
|
485
|
+
w(o) || f && f.defaultChecked || i ? V(l, t, i ? o : Te(c._f)) : E(t, o), y.mount && H();
|
|
485
486
|
}
|
|
486
|
-
},
|
|
487
|
+
}, Y = (t, i, a, f, c) => {
|
|
487
488
|
let o = !1, h = !1;
|
|
488
489
|
const x = {
|
|
489
490
|
name: t
|
|
490
|
-
},
|
|
491
|
-
if (!
|
|
492
|
-
|
|
493
|
-
const
|
|
494
|
-
h = !!(!
|
|
491
|
+
}, p = !!(d(n, t) && d(n, t)._f && d(n, t)._f.disabled);
|
|
492
|
+
if (!a || f) {
|
|
493
|
+
A.isDirty && (h = r.isDirty, r.isDirty = x.isDirty = _(), o = h !== x.isDirty);
|
|
494
|
+
const M = p || re(d(u, t), i);
|
|
495
|
+
h = !!(!p && d(r.dirtyFields, t)), M || p ? k(r.dirtyFields, t) : V(r.dirtyFields, t, !0), x.dirtyFields = r.dirtyFields, o = o || A.dirtyFields && h !== !M;
|
|
495
496
|
}
|
|
496
|
-
if (
|
|
497
|
-
const
|
|
498
|
-
|
|
497
|
+
if (a) {
|
|
498
|
+
const M = d(r.touchedFields, t);
|
|
499
|
+
M || (V(r.touchedFields, t, a), x.touchedFields = r.touchedFields, o = o || A.touchedFields && M !== a);
|
|
499
500
|
}
|
|
500
501
|
return o && c && v.state.next(x), o ? x : {};
|
|
501
|
-
},
|
|
502
|
-
const c = d(r.errors, t), o =
|
|
503
|
-
if (e.delayError &&
|
|
502
|
+
}, se = (t, i, a, f) => {
|
|
503
|
+
const c = d(r.errors, t), o = A.isValid && ee(i) && r.isValid !== i;
|
|
504
|
+
if (e.delayError && a ? (L = ue(() => z(t, a)), L(e.delayError)) : (clearTimeout(N), L = null, a ? V(r.errors, t, a) : k(r.errors, t)), (a ? !re(c, a) : c) || !R(f) || o) {
|
|
504
505
|
const h = {
|
|
505
506
|
...f,
|
|
506
|
-
...o &&
|
|
507
|
+
...o && ee(i) ? { isValid: i } : {},
|
|
507
508
|
errors: r.errors,
|
|
508
509
|
name: t
|
|
509
510
|
};
|
|
@@ -512,21 +513,21 @@ function Xt(e = {}) {
|
|
|
512
513
|
...h
|
|
513
514
|
}, v.state.next(h);
|
|
514
515
|
}
|
|
515
|
-
},
|
|
516
|
-
|
|
517
|
-
const i = await s.resolver(
|
|
518
|
-
return
|
|
519
|
-
},
|
|
520
|
-
const { errors: i } = await
|
|
516
|
+
}, Q = async (t) => {
|
|
517
|
+
T(t, !0);
|
|
518
|
+
const i = await s.resolver(l, s.context, Gt(t || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
|
|
519
|
+
return T(t), i;
|
|
520
|
+
}, ie = async (t) => {
|
|
521
|
+
const { errors: i } = await Q(t);
|
|
521
522
|
if (t)
|
|
522
|
-
for (const
|
|
523
|
-
const f = d(i,
|
|
524
|
-
f ? V(r.errors,
|
|
523
|
+
for (const a of t) {
|
|
524
|
+
const f = d(i, a);
|
|
525
|
+
f ? V(r.errors, a, f) : k(r.errors, a);
|
|
525
526
|
}
|
|
526
527
|
else
|
|
527
528
|
r.errors = i;
|
|
528
529
|
return i;
|
|
529
|
-
},
|
|
530
|
+
}, q = async (t, i, a = {
|
|
530
531
|
valid: !0
|
|
531
532
|
}) => {
|
|
532
533
|
for (const f in t) {
|
|
@@ -535,106 +536,106 @@ function Xt(e = {}) {
|
|
|
535
536
|
const { _f: o, ...h } = c;
|
|
536
537
|
if (o) {
|
|
537
538
|
const x = g.array.has(o.name);
|
|
538
|
-
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
539
|
+
T([f], !0);
|
|
540
|
+
const p = await rt(c, l, C, s.shouldUseNativeValidation && !i, x);
|
|
541
|
+
if (T([f]), p[o.name] && (a.valid = !1, i))
|
|
541
542
|
break;
|
|
542
|
-
!i && (d(
|
|
543
|
+
!i && (d(p, o.name) ? x ? zt(r.errors, p, o.name) : V(r.errors, o.name, p[o.name]) : k(r.errors, o.name));
|
|
543
544
|
}
|
|
544
|
-
!
|
|
545
|
+
!R(h) && await q(h, i, a);
|
|
545
546
|
}
|
|
546
547
|
}
|
|
547
|
-
return
|
|
548
|
+
return a.valid;
|
|
548
549
|
}, ge = () => {
|
|
549
550
|
for (const t of g.unMount) {
|
|
550
|
-
const i = d(
|
|
551
|
-
i && (i._f.refs ? i._f.refs.every((
|
|
551
|
+
const i = d(n, t);
|
|
552
|
+
i && (i._f.refs ? i._f.refs.every((a) => !Be(a)) : !Be(i._f.ref)) && we(t);
|
|
552
553
|
}
|
|
553
554
|
g.unMount = /* @__PURE__ */ new Set();
|
|
554
|
-
}, _ = (t, i) => (t && i && V(
|
|
555
|
-
...y.mount ?
|
|
556
|
-
},
|
|
557
|
-
const f = d(
|
|
555
|
+
}, _ = (t, i) => (t && i && V(l, t, i), !re(Ne(), u)), b = (t, i, a) => Wt(t, g, {
|
|
556
|
+
...y.mount ? l : w(i) ? u : J(t) ? { [t]: i } : i
|
|
557
|
+
}, a, i), D = (t) => Fe(d(y.mount ? l : u, t, e.shouldUnregister ? d(u, t, []) : [])), E = (t, i, a = {}) => {
|
|
558
|
+
const f = d(n, t);
|
|
558
559
|
let c = i;
|
|
559
560
|
if (f) {
|
|
560
561
|
const o = f._f;
|
|
561
|
-
o && (!o.disabled && V(
|
|
562
|
+
o && (!o.disabled && V(l, t, dt(i, o)), c = be(o.ref) && B(i) ? "" : i, ot(o.ref) ? [...o.ref.options].forEach((h) => h.selected = c.includes(h.value)) : o.refs ? he(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 || v.values.next({
|
|
562
563
|
name: t,
|
|
563
|
-
values: { ...
|
|
564
|
+
values: { ...l }
|
|
564
565
|
})));
|
|
565
566
|
}
|
|
566
|
-
(
|
|
567
|
-
},
|
|
567
|
+
(a.shouldDirty || a.shouldTouch) && Y(t, c, a.shouldTouch, a.shouldDirty, !0), a.shouldValidate && fe(t);
|
|
568
|
+
}, j = (t, i, a) => {
|
|
568
569
|
for (const f in i) {
|
|
569
|
-
const c = i[f], o = `${t}.${f}`, h = d(
|
|
570
|
-
(g.array.has(t) || !Ve(c) || h && !h._f) && !
|
|
570
|
+
const c = i[f], o = `${t}.${f}`, h = d(n, o);
|
|
571
|
+
(g.array.has(t) || !Ve(c) || h && !h._f) && !ne(c) ? j(o, c, a) : E(o, c, a);
|
|
571
572
|
}
|
|
572
|
-
},
|
|
573
|
-
const f = d(
|
|
574
|
-
V(
|
|
573
|
+
}, I = (t, i, a = {}) => {
|
|
574
|
+
const f = d(n, t), c = g.array.has(t), o = P(i);
|
|
575
|
+
V(l, t, o), c ? (v.array.next({
|
|
575
576
|
name: t,
|
|
576
|
-
values: { ...
|
|
577
|
-
}), (
|
|
577
|
+
values: { ...l }
|
|
578
|
+
}), (A.isDirty || A.dirtyFields) && a.shouldDirty && v.state.next({
|
|
578
579
|
name: t,
|
|
579
|
-
dirtyFields: ve(u,
|
|
580
|
+
dirtyFields: ve(u, l),
|
|
580
581
|
isDirty: _(t, o)
|
|
581
|
-
})) : f && !f._f && !B(o) ?
|
|
582
|
+
})) : f && !f._f && !B(o) ? j(t, o, a) : E(t, o, a), Xe(t, g) && v.state.next({ ...r }), v.values.next({
|
|
582
583
|
name: y.mount ? t : void 0,
|
|
583
|
-
values: { ...
|
|
584
|
+
values: { ...l }
|
|
584
585
|
});
|
|
585
|
-
},
|
|
586
|
+
}, oe = async (t) => {
|
|
586
587
|
y.mount = !0;
|
|
587
588
|
const i = t.target;
|
|
588
|
-
let
|
|
589
|
-
const c = d(
|
|
590
|
-
f = Number.isNaN(x) || x === d(
|
|
589
|
+
let a = i.name, f = !0;
|
|
590
|
+
const c = d(n, a), o = () => i.type ? Te(c._f) : Mt(t), h = (x) => {
|
|
591
|
+
f = Number.isNaN(x) || x === d(l, a, x);
|
|
591
592
|
};
|
|
592
593
|
if (c) {
|
|
593
|
-
let x,
|
|
594
|
-
const
|
|
595
|
-
V(
|
|
596
|
-
const ke =
|
|
597
|
-
if (!
|
|
598
|
-
name:
|
|
594
|
+
let x, p;
|
|
595
|
+
const M = o(), ae = t.type === Je.BLUR || t.type === Je.FOCUS_OUT, _t = !Jt(c._f) && !s.resolver && !d(r.errors, a) && !c._f.deps || Qt(ae, d(r.touchedFields, a), r.isSubmitted, G, U), De = Xe(a, g, ae);
|
|
596
|
+
V(l, a, M), ae ? (c._f.onBlur && c._f.onBlur(t), L && L(0)) : c._f.onChange && c._f.onChange(t);
|
|
597
|
+
const ke = Y(a, M, ae, !1), mt = !R(ke) || De;
|
|
598
|
+
if (!ae && v.values.next({
|
|
599
|
+
name: a,
|
|
599
600
|
type: t.type,
|
|
600
|
-
values: { ...
|
|
601
|
+
values: { ...l }
|
|
601
602
|
}), _t)
|
|
602
|
-
return
|
|
603
|
-
if (!
|
|
604
|
-
const { errors:
|
|
605
|
-
if (h(
|
|
606
|
-
const bt = st(r.errors,
|
|
607
|
-
x =
|
|
603
|
+
return A.isValid && H(), mt && v.state.next({ name: a, ...De ? {} : ke });
|
|
604
|
+
if (!ae && De && v.state.next({ ...r }), s.resolver) {
|
|
605
|
+
const { errors: $e } = await Q([a]);
|
|
606
|
+
if (h(M), f) {
|
|
607
|
+
const bt = st(r.errors, n, a), je = st($e, n, bt.name || a);
|
|
608
|
+
x = je.error, a = je.name, p = R($e);
|
|
608
609
|
}
|
|
609
610
|
} else
|
|
610
|
-
|
|
611
|
-
f && (c._f.deps &&
|
|
611
|
+
T([a], !0), x = (await rt(c, l, C, s.shouldUseNativeValidation))[a], T([a]), h(M), f && (x ? p = !1 : A.isValid && (p = await q(n, !0)));
|
|
612
|
+
f && (c._f.deps && fe(c._f.deps), se(a, p, x, ke));
|
|
612
613
|
}
|
|
613
|
-
},
|
|
614
|
+
}, ce = (t, i) => {
|
|
614
615
|
if (d(r.errors, i) && t.focus)
|
|
615
616
|
return t.focus(), 1;
|
|
616
|
-
},
|
|
617
|
-
let
|
|
617
|
+
}, fe = async (t, i = {}) => {
|
|
618
|
+
let a, f;
|
|
618
619
|
const c = _e(t);
|
|
619
620
|
if (s.resolver) {
|
|
620
|
-
const o = await
|
|
621
|
-
|
|
621
|
+
const o = await ie(w(t) ? t : c);
|
|
622
|
+
a = R(o), f = t ? !c.some((h) => d(o, h)) : a;
|
|
622
623
|
} else
|
|
623
624
|
t ? (f = (await Promise.all(c.map(async (o) => {
|
|
624
|
-
const h = d(
|
|
625
|
-
return await
|
|
626
|
-
}))).every(Boolean), !(!f && !r.isValid) &&
|
|
625
|
+
const h = d(n, o);
|
|
626
|
+
return await q(h && h._f ? { [o]: h } : h);
|
|
627
|
+
}))).every(Boolean), !(!f && !r.isValid) && H()) : f = a = await q(n);
|
|
627
628
|
return v.state.next({
|
|
628
|
-
...!
|
|
629
|
-
...s.resolver || !t ? { isValid:
|
|
629
|
+
...!J(t) || A.isValid && a !== r.isValid ? {} : { name: t },
|
|
630
|
+
...s.resolver || !t ? { isValid: a } : {},
|
|
630
631
|
errors: r.errors
|
|
631
|
-
}), i.shouldFocus && !f &&
|
|
632
|
-
},
|
|
632
|
+
}), i.shouldFocus && !f && ye(n, ce, t ? c : g.mount), f;
|
|
633
|
+
}, Ne = (t) => {
|
|
633
634
|
const i = {
|
|
634
|
-
...y.mount ?
|
|
635
|
+
...y.mount ? l : u
|
|
635
636
|
};
|
|
636
|
-
return
|
|
637
|
-
},
|
|
637
|
+
return w(t) ? i : J(t) ? d(i, t) : t.map((a) => d(i, a));
|
|
638
|
+
}, Ue = (t, i) => ({
|
|
638
639
|
invalid: !!d((i || r).errors, t),
|
|
639
640
|
isDirty: !!d((i || r).dirtyFields, t),
|
|
640
641
|
error: d((i || r).errors, t),
|
|
@@ -644,148 +645,148 @@ function Xt(e = {}) {
|
|
|
644
645
|
t && _e(t).forEach((i) => k(r.errors, i)), v.state.next({
|
|
645
646
|
errors: t ? r.errors : {}
|
|
646
647
|
});
|
|
647
|
-
},
|
|
648
|
-
const f = (d(
|
|
648
|
+
}, qe = (t, i, a) => {
|
|
649
|
+
const f = (d(n, t, { _f: {} })._f || {}).ref, c = d(r.errors, t) || {}, { ref: o, message: h, type: x, ...p } = c;
|
|
649
650
|
V(r.errors, t, {
|
|
650
|
-
...
|
|
651
|
+
...p,
|
|
651
652
|
...i,
|
|
652
653
|
ref: f
|
|
653
654
|
}), v.state.next({
|
|
654
655
|
name: t,
|
|
655
656
|
errors: r.errors,
|
|
656
657
|
isValid: !1
|
|
657
|
-
}),
|
|
658
|
-
}, ht = (t, i) =>
|
|
659
|
-
next: (
|
|
658
|
+
}), a && a.shouldFocus && f && f.focus && f.focus();
|
|
659
|
+
}, ht = (t, i) => te(t) ? v.values.subscribe({
|
|
660
|
+
next: (a) => t(b(void 0, i), a)
|
|
660
661
|
}) : b(t, i, !0), we = (t, i = {}) => {
|
|
661
|
-
for (const
|
|
662
|
-
g.mount.delete(
|
|
662
|
+
for (const a of t ? _e(t) : g.mount)
|
|
663
|
+
g.mount.delete(a), g.array.delete(a), i.keepValue || (k(n, a), k(l, a)), !i.keepError && k(r.errors, a), !i.keepDirty && k(r.dirtyFields, a), !i.keepTouched && k(r.touchedFields, a), !i.keepIsValidating && k(r.validatingFields, a), !s.shouldUnregister && !i.keepDefaultValue && k(u, a);
|
|
663
664
|
v.values.next({
|
|
664
|
-
values: { ...
|
|
665
|
+
values: { ...l }
|
|
665
666
|
}), v.state.next({
|
|
666
667
|
...r,
|
|
667
668
|
...i.keepDirty ? { isDirty: _() } : {}
|
|
668
|
-
}), !i.keepIsValid &&
|
|
669
|
-
}, Ie = ({ disabled: t, name: i, field:
|
|
670
|
-
if (
|
|
671
|
-
const o = t ? void 0 :
|
|
672
|
-
V(
|
|
669
|
+
}), !i.keepIsValid && H();
|
|
670
|
+
}, Ie = ({ disabled: t, name: i, field: a, fields: f, value: c }) => {
|
|
671
|
+
if (ee(t) && y.mount || t) {
|
|
672
|
+
const o = t ? void 0 : w(c) ? Te(a ? a._f : d(f, i)._f) : c;
|
|
673
|
+
V(l, i, o), Y(i, o, !1, !1, !0);
|
|
673
674
|
}
|
|
674
675
|
}, pe = (t, i = {}) => {
|
|
675
|
-
let
|
|
676
|
-
const f =
|
|
677
|
-
return V(
|
|
678
|
-
...
|
|
676
|
+
let a = d(n, t);
|
|
677
|
+
const f = ee(i.disabled);
|
|
678
|
+
return V(n, t, {
|
|
679
|
+
...a || {},
|
|
679
680
|
_f: {
|
|
680
|
-
...
|
|
681
|
+
...a && a._f ? a._f : { ref: { name: t } },
|
|
681
682
|
name: t,
|
|
682
683
|
mount: !0,
|
|
683
684
|
...i
|
|
684
685
|
}
|
|
685
|
-
}), g.mount.add(t),
|
|
686
|
-
field:
|
|
686
|
+
}), g.mount.add(t), a ? Ie({
|
|
687
|
+
field: a,
|
|
687
688
|
disabled: i.disabled,
|
|
688
689
|
name: t,
|
|
689
690
|
value: i.value
|
|
690
|
-
}) :
|
|
691
|
+
}) : F(t, !0, i.value), {
|
|
691
692
|
...f ? { disabled: i.disabled } : {},
|
|
692
693
|
...s.progressive ? {
|
|
693
694
|
required: !!i.required,
|
|
694
|
-
min:
|
|
695
|
-
max:
|
|
696
|
-
minLength:
|
|
697
|
-
maxLength:
|
|
698
|
-
pattern:
|
|
695
|
+
min: de(i.min),
|
|
696
|
+
max: de(i.max),
|
|
697
|
+
minLength: de(i.minLength),
|
|
698
|
+
maxLength: de(i.maxLength),
|
|
699
|
+
pattern: de(i.pattern)
|
|
699
700
|
} : {},
|
|
700
701
|
name: t,
|
|
701
|
-
onChange:
|
|
702
|
-
onBlur:
|
|
702
|
+
onChange: oe,
|
|
703
|
+
onBlur: oe,
|
|
703
704
|
ref: (c) => {
|
|
704
705
|
if (c) {
|
|
705
|
-
pe(t, i),
|
|
706
|
-
const o =
|
|
707
|
-
if (h ? x.find((
|
|
706
|
+
pe(t, i), a = d(n, t);
|
|
707
|
+
const o = w(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h = Kt(o), x = a._f.refs || [];
|
|
708
|
+
if (h ? x.find((p) => p === o) : o === a._f.ref)
|
|
708
709
|
return;
|
|
709
|
-
V(
|
|
710
|
+
V(n, t, {
|
|
710
711
|
_f: {
|
|
711
|
-
...
|
|
712
|
+
...a._f,
|
|
712
713
|
...h ? {
|
|
713
714
|
refs: [
|
|
714
|
-
...x.filter(
|
|
715
|
+
...x.filter(Be),
|
|
715
716
|
o,
|
|
716
717
|
...Array.isArray(d(u, t)) ? [{}] : []
|
|
717
718
|
],
|
|
718
719
|
ref: { type: o.type, name: t }
|
|
719
720
|
} : { ref: o }
|
|
720
721
|
}
|
|
721
|
-
}),
|
|
722
|
+
}), F(t, !1, void 0, o);
|
|
722
723
|
} else
|
|
723
|
-
|
|
724
|
+
a = d(n, t, {}), a._f && (a._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(Nt(g.array, t) && y.action) && g.unMount.add(t);
|
|
724
725
|
}
|
|
725
726
|
};
|
|
726
|
-
}, Pe = () => s.shouldFocusError &&
|
|
727
|
-
|
|
728
|
-
const f = d(
|
|
727
|
+
}, Pe = () => s.shouldFocusError && ye(n, ce, g.mount), gt = (t) => {
|
|
728
|
+
ee(t) && (v.state.next({ disabled: t }), ye(n, (i, a) => {
|
|
729
|
+
const f = d(n, a);
|
|
729
730
|
f && (i.disabled = f._f.disabled || t, Array.isArray(f._f.refs) && f._f.refs.forEach((c) => {
|
|
730
731
|
c.disabled = f._f.disabled || t;
|
|
731
732
|
}));
|
|
732
733
|
}, 0, !1));
|
|
733
|
-
},
|
|
734
|
+
}, We = (t, i) => async (a) => {
|
|
734
735
|
let f;
|
|
735
|
-
|
|
736
|
-
let c =
|
|
736
|
+
a && (a.preventDefault && a.preventDefault(), a.persist && a.persist());
|
|
737
|
+
let c = P(l);
|
|
737
738
|
if (v.state.next({
|
|
738
739
|
isSubmitting: !0
|
|
739
740
|
}), s.resolver) {
|
|
740
|
-
const { errors: o, values: h } = await
|
|
741
|
+
const { errors: o, values: h } = await Q();
|
|
741
742
|
r.errors = o, c = h;
|
|
742
743
|
} else
|
|
743
|
-
await
|
|
744
|
-
if (k(r.errors, "root"),
|
|
744
|
+
await q(n);
|
|
745
|
+
if (k(r.errors, "root"), R(r.errors)) {
|
|
745
746
|
v.state.next({
|
|
746
747
|
errors: {}
|
|
747
748
|
});
|
|
748
749
|
try {
|
|
749
|
-
await t(c,
|
|
750
|
+
await t(c, a);
|
|
750
751
|
} catch (o) {
|
|
751
752
|
f = o;
|
|
752
753
|
}
|
|
753
754
|
} else
|
|
754
|
-
i && await i({ ...r.errors },
|
|
755
|
+
i && await i({ ...r.errors }, a), Pe(), setTimeout(Pe);
|
|
755
756
|
if (v.state.next({
|
|
756
757
|
isSubmitted: !0,
|
|
757
758
|
isSubmitting: !1,
|
|
758
|
-
isSubmitSuccessful:
|
|
759
|
+
isSubmitSuccessful: R(r.errors) && !f,
|
|
759
760
|
submitCount: r.submitCount + 1,
|
|
760
761
|
errors: r.errors
|
|
761
762
|
}), f)
|
|
762
763
|
throw f;
|
|
763
764
|
}, vt = (t, i = {}) => {
|
|
764
|
-
d(
|
|
765
|
-
},
|
|
766
|
-
const
|
|
767
|
-
if (i.keepDefaultValues || (u =
|
|
765
|
+
d(n, t) && (w(i.defaultValue) ? I(t, P(d(u, t))) : (I(t, i.defaultValue), V(u, t, P(i.defaultValue))), i.keepTouched || k(r.touchedFields, t), i.keepDirty || (k(r.dirtyFields, t), r.isDirty = i.defaultValue ? _(t, P(d(u, t))) : _()), i.keepError || (k(r.errors, t), A.isValid && H()), v.state.next({ ...r }));
|
|
766
|
+
}, He = (t, i = {}) => {
|
|
767
|
+
const a = t ? P(t) : u, f = P(a), c = R(t), o = c ? u : f;
|
|
768
|
+
if (i.keepDefaultValues || (u = a), !i.keepValues) {
|
|
768
769
|
if (i.keepDirtyValues)
|
|
769
770
|
for (const h of g.mount)
|
|
770
|
-
d(r.dirtyFields, h) ? V(o, h, d(
|
|
771
|
+
d(r.dirtyFields, h) ? V(o, h, d(l, h)) : I(h, d(o, h));
|
|
771
772
|
else {
|
|
772
|
-
if (
|
|
773
|
+
if (Re && w(t))
|
|
773
774
|
for (const h of g.mount) {
|
|
774
|
-
const x = d(
|
|
775
|
+
const x = d(n, h);
|
|
775
776
|
if (x && x._f) {
|
|
776
|
-
const
|
|
777
|
-
if (be(
|
|
778
|
-
const
|
|
779
|
-
if (
|
|
780
|
-
|
|
777
|
+
const p = Array.isArray(x._f.refs) ? x._f.refs[0] : x._f.ref;
|
|
778
|
+
if (be(p)) {
|
|
779
|
+
const M = p.closest("form");
|
|
780
|
+
if (M) {
|
|
781
|
+
M.reset();
|
|
781
782
|
break;
|
|
782
783
|
}
|
|
783
784
|
}
|
|
784
785
|
}
|
|
785
786
|
}
|
|
786
|
-
|
|
787
|
+
n = {};
|
|
787
788
|
}
|
|
788
|
-
|
|
789
|
+
l = e.shouldUnregister ? i.keepDefaultValues ? P(u) : {} : P(o), v.array.next({
|
|
789
790
|
values: { ...o }
|
|
790
791
|
}), v.values.next({
|
|
791
792
|
values: { ...o }
|
|
@@ -798,35 +799,35 @@ function Xt(e = {}) {
|
|
|
798
799
|
watch: /* @__PURE__ */ new Set(),
|
|
799
800
|
watchAll: !1,
|
|
800
801
|
focus: ""
|
|
801
|
-
}, y.mount = !
|
|
802
|
+
}, y.mount = !A.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, v.state.next({
|
|
802
803
|
submitCount: i.keepSubmitCount ? r.submitCount : 0,
|
|
803
|
-
isDirty: c ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !
|
|
804
|
+
isDirty: c ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !re(t, u)),
|
|
804
805
|
isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
|
|
805
|
-
dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues &&
|
|
806
|
+
dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues && l ? ve(u, l) : r.dirtyFields : i.keepDefaultValues && t ? ve(u, t) : i.keepDirty ? r.dirtyFields : {},
|
|
806
807
|
touchedFields: i.keepTouched ? r.touchedFields : {},
|
|
807
808
|
errors: i.keepErrors ? r.errors : {},
|
|
808
809
|
isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
809
810
|
isSubmitting: !1
|
|
810
811
|
});
|
|
811
|
-
},
|
|
812
|
+
}, ze = (t, i) => He(te(t) ? t(l) : t, i);
|
|
812
813
|
return {
|
|
813
814
|
control: {
|
|
814
815
|
register: pe,
|
|
815
816
|
unregister: we,
|
|
816
|
-
getFieldState:
|
|
817
|
-
handleSubmit:
|
|
818
|
-
setError:
|
|
819
|
-
_executeSchema:
|
|
817
|
+
getFieldState: Ue,
|
|
818
|
+
handleSubmit: We,
|
|
819
|
+
setError: qe,
|
|
820
|
+
_executeSchema: Q,
|
|
820
821
|
_getWatch: b,
|
|
821
822
|
_getDirty: _,
|
|
822
|
-
_updateValid:
|
|
823
|
+
_updateValid: H,
|
|
823
824
|
_removeUnmounted: ge,
|
|
824
825
|
_updateFieldArray: m,
|
|
825
826
|
_updateDisabledField: Ie,
|
|
826
827
|
_getFieldArray: D,
|
|
827
|
-
_reset:
|
|
828
|
-
_resetDefaultValues: () =>
|
|
829
|
-
|
|
828
|
+
_reset: He,
|
|
829
|
+
_resetDefaultValues: () => te(s.defaultValues) && s.defaultValues().then((t) => {
|
|
830
|
+
ze(t, s.resetOptions), v.state.next({
|
|
830
831
|
isLoading: !1
|
|
831
832
|
});
|
|
832
833
|
}),
|
|
@@ -838,13 +839,13 @@ function Xt(e = {}) {
|
|
|
838
839
|
},
|
|
839
840
|
_disableForm: gt,
|
|
840
841
|
_subjects: v,
|
|
841
|
-
_proxyFormState:
|
|
842
|
-
_setErrors:
|
|
842
|
+
_proxyFormState: A,
|
|
843
|
+
_setErrors: $,
|
|
843
844
|
get _fields() {
|
|
844
|
-
return
|
|
845
|
+
return n;
|
|
845
846
|
},
|
|
846
847
|
get _formValues() {
|
|
847
|
-
return
|
|
848
|
+
return l;
|
|
848
849
|
},
|
|
849
850
|
get _state() {
|
|
850
851
|
return y;
|
|
@@ -877,32 +878,32 @@ function Xt(e = {}) {
|
|
|
877
878
|
};
|
|
878
879
|
}
|
|
879
880
|
},
|
|
880
|
-
trigger:
|
|
881
|
+
trigger: fe,
|
|
881
882
|
register: pe,
|
|
882
|
-
handleSubmit:
|
|
883
|
+
handleSubmit: We,
|
|
883
884
|
watch: ht,
|
|
884
|
-
setValue:
|
|
885
|
-
getValues:
|
|
886
|
-
reset:
|
|
885
|
+
setValue: I,
|
|
886
|
+
getValues: Ne,
|
|
887
|
+
reset: ze,
|
|
887
888
|
resetField: vt,
|
|
888
889
|
clearErrors: yt,
|
|
889
890
|
unregister: we,
|
|
890
|
-
setError:
|
|
891
|
+
setError: qe,
|
|
891
892
|
setFocus: (t, i = {}) => {
|
|
892
|
-
const
|
|
893
|
+
const a = d(n, t), f = a && a._f;
|
|
893
894
|
if (f) {
|
|
894
895
|
const c = f.refs ? f.refs[0] : f.ref;
|
|
895
896
|
c.focus && (c.focus(), i.shouldSelect && c.select());
|
|
896
897
|
}
|
|
897
898
|
},
|
|
898
|
-
getFieldState:
|
|
899
|
+
getFieldState: Ue
|
|
899
900
|
};
|
|
900
901
|
}
|
|
901
|
-
function
|
|
902
|
-
const s =
|
|
902
|
+
function er(e = {}) {
|
|
903
|
+
const s = W.useRef(), r = W.useRef(), [n, u] = W.useState({
|
|
903
904
|
isDirty: !1,
|
|
904
905
|
isValidating: !1,
|
|
905
|
-
isLoading:
|
|
906
|
+
isLoading: te(e.defaultValues),
|
|
906
907
|
isSubmitted: !1,
|
|
907
908
|
isSubmitting: !1,
|
|
908
909
|
isSubmitSuccessful: !1,
|
|
@@ -913,139 +914,169 @@ function Yt(e = {}) {
|
|
|
913
914
|
validatingFields: {},
|
|
914
915
|
errors: e.errors || {},
|
|
915
916
|
disabled: e.disabled || !1,
|
|
916
|
-
defaultValues:
|
|
917
|
+
defaultValues: te(e.defaultValues) ? void 0 : e.defaultValues
|
|
917
918
|
});
|
|
918
919
|
s.current || (s.current = {
|
|
919
|
-
...
|
|
920
|
-
formState:
|
|
920
|
+
...Zt(e),
|
|
921
|
+
formState: n
|
|
921
922
|
});
|
|
922
|
-
const
|
|
923
|
-
return
|
|
924
|
-
subject:
|
|
923
|
+
const l = s.current.control;
|
|
924
|
+
return l._options = e, Pt({
|
|
925
|
+
subject: l._subjects.state,
|
|
925
926
|
next: (y) => {
|
|
926
|
-
|
|
927
|
+
It(y, l._proxyFormState, l._updateFormState) && u({ ...l._formState });
|
|
927
928
|
}
|
|
928
|
-
}),
|
|
929
|
-
if (
|
|
930
|
-
const y =
|
|
931
|
-
y !==
|
|
929
|
+
}), W.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), W.useEffect(() => {
|
|
930
|
+
if (l._proxyFormState.isDirty) {
|
|
931
|
+
const y = l._getDirty();
|
|
932
|
+
y !== n.isDirty && l._subjects.state.next({
|
|
932
933
|
isDirty: y
|
|
933
934
|
});
|
|
934
935
|
}
|
|
935
|
-
}, [
|
|
936
|
-
e.values && !
|
|
937
|
-
}, [e.values,
|
|
938
|
-
e.errors &&
|
|
939
|
-
}, [e.errors,
|
|
940
|
-
|
|
941
|
-
}),
|
|
942
|
-
e.shouldUnregister &&
|
|
943
|
-
values:
|
|
936
|
+
}, [l, n.isDirty]), W.useEffect(() => {
|
|
937
|
+
e.values && !re(e.values, r.current) ? (l._reset(e.values, l._options.resetOptions), r.current = e.values, u((y) => ({ ...y }))) : l._resetDefaultValues();
|
|
938
|
+
}, [e.values, l]), W.useEffect(() => {
|
|
939
|
+
e.errors && l._setErrors(e.errors);
|
|
940
|
+
}, [e.errors, l]), W.useEffect(() => {
|
|
941
|
+
l._state.mount || (l._updateValid(), l._state.mount = !0), l._state.watch && (l._state.watch = !1, l._subjects.state.next({ ...l._formState })), l._removeUnmounted();
|
|
942
|
+
}), W.useEffect(() => {
|
|
943
|
+
e.shouldUnregister && l._subjects.values.next({
|
|
944
|
+
values: l._getWatch()
|
|
944
945
|
});
|
|
945
|
-
}, [e.shouldUnregister,
|
|
946
|
+
}, [e.shouldUnregister, l]), s.current.formState = qt(n, l), s.current;
|
|
946
947
|
}
|
|
947
948
|
const it = `Я принимаю условия Политики обработки
|
|
948
949
|
и защиты персональных данных, даю согласия на обработку персональных
|
|
949
|
-
данных`,
|
|
950
|
+
данных`, gr = ({
|
|
950
951
|
isFormOpen: e,
|
|
951
952
|
setIsFormOpen: s,
|
|
952
953
|
title: r,
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
954
|
+
isEmail: n,
|
|
955
|
+
isTextArea: u,
|
|
956
|
+
textAreaPlaceholder: l,
|
|
957
|
+
subTitle: y,
|
|
958
|
+
submitHandler: g,
|
|
959
|
+
modalWidth: L = "442px",
|
|
960
|
+
rowsTextArea: N = 2,
|
|
961
|
+
personalCheckBox: A = { text: it, isRequired: !0 },
|
|
962
|
+
advCheckBox: v = { text: it, isRequired: !0 }
|
|
957
963
|
}) => {
|
|
958
964
|
const {
|
|
959
|
-
register:
|
|
960
|
-
handleSubmit:
|
|
961
|
-
trigger:
|
|
962
|
-
reset:
|
|
963
|
-
watch:
|
|
964
|
-
formState: { errors:
|
|
965
|
-
} =
|
|
965
|
+
register: U,
|
|
966
|
+
handleSubmit: G,
|
|
967
|
+
trigger: C,
|
|
968
|
+
reset: ue,
|
|
969
|
+
watch: H,
|
|
970
|
+
formState: { errors: T }
|
|
971
|
+
} = er(), { onChange: m, onBlur: z, ...$ } = U("phone", {
|
|
966
972
|
required: !0,
|
|
967
973
|
pattern: { value: wt, message: "" },
|
|
968
|
-
onBlur: () =>
|
|
969
|
-
}),
|
|
970
|
-
|
|
974
|
+
onBlur: () => C("phone")
|
|
975
|
+
}), F = H("personalCheckBox"), Y = H("advCheckBox"), se = (Q) => {
|
|
976
|
+
g(Q), ue();
|
|
971
977
|
};
|
|
972
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ O(
|
|
973
979
|
Vt,
|
|
974
980
|
{
|
|
975
981
|
isOpen: e,
|
|
976
982
|
emitIsOpen: () => s(!1),
|
|
977
|
-
additionalClass:
|
|
983
|
+
additionalClass: Z.modal,
|
|
978
984
|
opacity: 0.7,
|
|
979
985
|
isTransparentBack: !0,
|
|
980
|
-
additionalClassModalBody:
|
|
981
|
-
children: /* @__PURE__ */ Se("div", { className:
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
986
|
+
additionalClassModalBody: Z.modalBody,
|
|
987
|
+
children: /* @__PURE__ */ Se("div", { className: Z.root, style: { width: L }, children: [
|
|
988
|
+
/* @__PURE__ */ O("div", { className: Z.title, dangerouslySetInnerHTML: { __html: r ?? "Оставить обращение" } }),
|
|
989
|
+
/* @__PURE__ */ O(
|
|
984
990
|
"div",
|
|
985
991
|
{
|
|
986
|
-
className:
|
|
987
|
-
dangerouslySetInnerHTML: { __html:
|
|
992
|
+
className: Z.description,
|
|
993
|
+
dangerouslySetInnerHTML: { __html: y ?? "Оставьте номер телефона для получения консультации" }
|
|
988
994
|
}
|
|
989
995
|
),
|
|
990
|
-
/* @__PURE__ */ Se("form", { onSubmit:
|
|
991
|
-
/* @__PURE__ */ Se(
|
|
992
|
-
/* @__PURE__ */
|
|
993
|
-
|
|
996
|
+
/* @__PURE__ */ Se("form", { onSubmit: G(se), children: [
|
|
997
|
+
/* @__PURE__ */ Se(At, { className: Z.inputWrapper, children: [
|
|
998
|
+
/* @__PURE__ */ O(
|
|
999
|
+
Ee,
|
|
994
1000
|
{
|
|
995
1001
|
width: "full",
|
|
996
1002
|
size_s: "small",
|
|
997
1003
|
variant: "light",
|
|
998
1004
|
placeholder: "Введите имя",
|
|
999
1005
|
"data-testid": "modal_name",
|
|
1000
|
-
...
|
|
1001
|
-
error: !!
|
|
1006
|
+
...U("name", { required: !0, pattern: pt }),
|
|
1007
|
+
error: !!T.name
|
|
1002
1008
|
}
|
|
1003
1009
|
),
|
|
1004
|
-
/* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ O(
|
|
1005
1011
|
xt,
|
|
1006
1012
|
{
|
|
1007
1013
|
inputMode: "numeric",
|
|
1008
1014
|
name: "phone",
|
|
1009
1015
|
mask: "+7 (999) 999-99-99",
|
|
1010
|
-
onChange:
|
|
1016
|
+
onChange: m,
|
|
1011
1017
|
placeholder: "+7 (- - -) - - - - - - -",
|
|
1012
|
-
onBlur:
|
|
1013
|
-
children: /* @__PURE__ */
|
|
1014
|
-
|
|
1018
|
+
onBlur: z,
|
|
1019
|
+
children: /* @__PURE__ */ O(
|
|
1020
|
+
Ee,
|
|
1015
1021
|
{
|
|
1016
1022
|
width: "full",
|
|
1017
1023
|
"data-testid": "phone_modal",
|
|
1018
1024
|
type: "tel",
|
|
1019
1025
|
size_s: "small",
|
|
1020
1026
|
variant: "light",
|
|
1021
|
-
|
|
1022
|
-
...
|
|
1023
|
-
error: !!
|
|
1027
|
+
...$,
|
|
1028
|
+
...U("phone"),
|
|
1029
|
+
error: !!T.phone
|
|
1024
1030
|
}
|
|
1025
1031
|
)
|
|
1026
1032
|
}
|
|
1027
1033
|
),
|
|
1028
|
-
|
|
1034
|
+
n && /* @__PURE__ */ O(
|
|
1035
|
+
Ee,
|
|
1036
|
+
{
|
|
1037
|
+
width: "full",
|
|
1038
|
+
size_s: "small",
|
|
1039
|
+
variant: "light",
|
|
1040
|
+
placeholder: "Введите email",
|
|
1041
|
+
"data-testid": "modal_email",
|
|
1042
|
+
...U(
|
|
1043
|
+
"email",
|
|
1044
|
+
{ required: !1, pattern: Dt }
|
|
1045
|
+
),
|
|
1046
|
+
error: !!T.email
|
|
1047
|
+
}
|
|
1048
|
+
),
|
|
1049
|
+
u && /* @__PURE__ */ O(
|
|
1050
|
+
kt,
|
|
1051
|
+
{
|
|
1052
|
+
"data-testid": "modal_textarea",
|
|
1053
|
+
placeholder: l,
|
|
1054
|
+
rows: N,
|
|
1055
|
+
width: "full",
|
|
1056
|
+
...U("textarea")
|
|
1057
|
+
}
|
|
1058
|
+
),
|
|
1059
|
+
v && /* @__PURE__ */ O(
|
|
1029
1060
|
Ge,
|
|
1030
1061
|
{
|
|
1031
1062
|
"data-testid": "modal_advCheckBox",
|
|
1032
|
-
isChecked:
|
|
1033
|
-
error: !!
|
|
1034
|
-
text:
|
|
1035
|
-
...
|
|
1063
|
+
isChecked: Y,
|
|
1064
|
+
error: !!T.advCheckBox,
|
|
1065
|
+
text: v.text,
|
|
1066
|
+
...U("advCheckBox", { required: v == null ? void 0 : v.isRequired })
|
|
1036
1067
|
}
|
|
1037
1068
|
),
|
|
1038
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ O(
|
|
1039
1070
|
Ge,
|
|
1040
1071
|
{
|
|
1041
1072
|
"data-testid": "modal_personalCheckBox",
|
|
1042
|
-
isChecked:
|
|
1043
|
-
error: !!
|
|
1044
|
-
text:
|
|
1045
|
-
...
|
|
1073
|
+
isChecked: F,
|
|
1074
|
+
error: !!T.personalCheckBox,
|
|
1075
|
+
text: A.text,
|
|
1076
|
+
...U("personalCheckBox", { required: A.isRequired })
|
|
1046
1077
|
}
|
|
1047
1078
|
),
|
|
1048
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ O(
|
|
1049
1080
|
Ke,
|
|
1050
1081
|
{
|
|
1051
1082
|
"data-testid": "modal_submit",
|
|
@@ -1054,22 +1085,22 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1054
1085
|
type: "submit",
|
|
1055
1086
|
size: "large",
|
|
1056
1087
|
as: "button",
|
|
1057
|
-
additionalClass:
|
|
1088
|
+
additionalClass: Z.modalBtn,
|
|
1058
1089
|
children: "Отправить"
|
|
1059
1090
|
}
|
|
1060
1091
|
)
|
|
1061
1092
|
] }),
|
|
1062
|
-
/* @__PURE__ */
|
|
1093
|
+
/* @__PURE__ */ O(
|
|
1063
1094
|
Ke,
|
|
1064
1095
|
{
|
|
1065
|
-
additionalClass:
|
|
1096
|
+
additionalClass: Z.btn,
|
|
1066
1097
|
onClick: () => s(!1),
|
|
1067
1098
|
as: "button",
|
|
1068
1099
|
variant: "gray",
|
|
1069
1100
|
type: "button",
|
|
1070
1101
|
size: "small",
|
|
1071
|
-
children: /* @__PURE__ */
|
|
1072
|
-
|
|
1102
|
+
children: /* @__PURE__ */ O(
|
|
1103
|
+
Ft,
|
|
1073
1104
|
{
|
|
1074
1105
|
name: "close",
|
|
1075
1106
|
size: "16",
|
|
@@ -1084,5 +1115,5 @@ const it = `Я принимаю условия Политики обработк
|
|
|
1084
1115
|
);
|
|
1085
1116
|
};
|
|
1086
1117
|
export {
|
|
1087
|
-
|
|
1118
|
+
gr as ModalForm
|
|
1088
1119
|
};
|