stone-kit 0.0.1028 → 0.0.1029
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/App.js +4 -4
- package/dist/{Option-rFBMQAPk.js → Option-CtwUzW8a.js} +1 -1
- package/dist/Router.js +1 -1
- package/dist/chunk-4WY6JWTD-BeveLKf_.js +1582 -0
- package/dist/components/Button/ui/Button.js +1 -1
- package/dist/components/CheckBoxNew/CheckBoxNew.js +1 -1
- package/dist/components/CheckboxSelect/ui/CheckboxSelect.js +1 -1
- package/dist/components/CommercialLotCard/CommercialLotCard.js +1 -1
- package/dist/components/CommercialLotCard/components/Price/Price.js +1 -1
- package/dist/components/CommercialLotCard/components/Snippets/Snippets.js +1 -1
- package/dist/components/DestinationTab/ui/DestinationTab.js +1 -1
- package/dist/components/FilterWithSave/hooks/useFilterWithSave.d.ts +1 -1
- package/dist/components/FilterWithSave/ui/FilterWithSave.js +9 -14
- package/dist/components/Flex/ui/Flex.js +1 -1
- package/dist/components/FormModal/ui/ModalForm.js +656 -641
- package/dist/components/GroupedInput/ui/GroupedInputs.js +1 -1
- package/dist/components/Input/ui/Input.js +1 -22
- package/dist/components/Logo/ui/Logo.js +1 -1
- package/dist/components/LotCard/hooks/useLotCard.js +2 -2
- package/dist/components/LotCard/ui/LotCard.js +2 -2
- package/dist/components/LotCardSkeleton/ui/LotCardSkeleton.js +1 -1
- package/dist/components/MetroLabel/ui/MetroLabel.js +1 -1
- package/dist/components/MetroTag/ui/MetroTag.js +1 -1
- package/dist/components/NewIcon/ui/NewIcon.js +3 -3
- package/dist/components/RoundButton/ui/RoundButton.js +1 -1
- package/dist/components/Select/ui/Category.js +2 -2
- package/dist/components/Select/ui/Option.js +2 -2
- package/dist/components/Select/ui/Select.js +2 -2
- package/dist/components/SliderNavigation/ui/SliderNavigation.js +1 -1
- package/dist/components/SortSelect/hooks/useSortSelect.d.ts +1 -1
- package/dist/components/SortSelect/hooks/useSortSelect.js +2 -2
- package/dist/components/SortSelect/ui/SortSelect.js +12 -12
- package/dist/components/Switcher/ui/Switcher.js +1 -1
- package/dist/components/TabSelect/ui/TabSelect.d.ts +12 -7
- package/dist/components/TabSelect/ui/TabSelect.js +43 -38
- package/dist/components/TabSwitcher/ui/TabSwitcher.d.ts +4 -3
- package/dist/components/TabSwitcher/ui/TabSwitcher.js +75 -73
- package/dist/components/TabSwitcher/ui/TabSwitcher.types.d.ts +1 -1
- package/dist/components/Tag/ui/Tag.js +1 -1
- package/dist/components/Text/ui/Text.js +1 -1
- package/dist/components/TextArea/TextArea.d.ts +8 -0
- package/dist/components/TextArea/TextArea.js +18 -12
- package/dist/components/mobileButton/ui/MobileButton.js +1 -1
- package/dist/{index-3E04UaC2.js → index-BJwl9stn.js} +785 -784
- package/dist/{index-B2JRaoNz.js → index-YnD2EP-S.js} +0 -5
- package/dist/layout/components/Header/Header.js +1 -1
- package/dist/layout/components/Menu.js +107 -4
- package/dist/pages/ButtonsPage/Buttons.js +49 -60
- package/dist/stone-kit.css +1 -1
- package/dist/stories/entities/CommercialLotCard/CommercialLotCard.stories.js +1 -1
- package/dist/stories/shared/ui/Button/Button.stories.js +1 -1
- package/dist/stories/shared/ui/CheckBox/CheckBox.stories.js +1 -1
- package/dist/stories/shared/ui/CheckBox/CheckBoxNew.stories.js +1 -1
- package/dist/stories/shared/ui/CheckboxSelect/CheckboxSelect.stories.js +1 -1
- package/dist/stories/shared/ui/DestinationTab/DestinationTab.stories.js +1 -1
- package/dist/stories/shared/ui/FieldInput/FieldInput.stories.js +1 -1
- package/dist/stories/shared/ui/FilterWithSave/FilterWithSave.stories.js +1 -1
- package/dist/stories/shared/ui/FormModal/FormModal.stories.js +1 -1
- package/dist/stories/shared/ui/GroupedInput/GroupedInput.stories.js +1 -1
- package/dist/stories/shared/ui/Logo/Logo.stories.js +1 -1
- package/dist/stories/shared/ui/MobileButton/MobileButton.stories.js +1 -1
- package/dist/stories/shared/ui/Modal/Modal.stories.js +1 -1
- package/dist/stories/shared/ui/ModalSuccess/ModalSuccess.stories.js +1 -1
- package/dist/stories/shared/ui/RoundButton/RoundButton.stories.js +1 -1
- package/dist/stories/shared/ui/Select/Select.stories.js +1 -1
- package/dist/stories/shared/ui/SliderNavigation/SliderNavigation.stories.js +1 -1
- package/dist/stories/shared/ui/SortSelect/SortSelect.stories.js +1 -1
- package/dist/stories/shared/ui/SummarySelect/SummarySelect.stories.js +1 -1
- package/dist/stories/shared/ui/Switcher/Switcher.stories.js +1 -1
- package/dist/stories/shared/ui/TabSelect/TabSelect.stories.js +1 -1
- package/dist/stories/shared/ui/TabSwitcher/TabSwitcher.stories.js +1 -1
- package/dist/stories/shared/ui/ZoomControls/ZoomControls.stories.js +1 -1
- package/dist/{useLotCard-DG9doKCX.js → useLotCard-CYcRSogE.js} +1 -1
- package/dist/{useSortSelect-C72ddcYI.js → useSortSelect-Cy3od4ig.js} +6 -6
- package/package.json +22 -31
- package/dist/ButtonState.module-DtW3aevR.js +0 -8
- package/dist/Menu-CdJTzN7T.js +0 -494
- package/dist/components/TextArea/TextArea.types.d.ts +0 -10
- package/dist/components/TextArea/TextArea.types.js +0 -1
- package/dist/index-CBdtKu-u.js +0 -891
- package/dist/pages/ButtonsPage/ButtonState/ButtonState.d.ts +0 -6
- package/dist/pages/ButtonsPage/ButtonState/ButtonState.js +0 -121
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { nameReg as
|
|
1
|
+
import { jsx as O, jsxs as de } from "react/jsx-runtime";
|
|
2
|
+
import v, { useEffect as et } from "react";
|
|
3
|
+
import { nameReg as Rt, phoneReg as Lt, emailReg as Mt } from "../utils/reg.js";
|
|
4
4
|
import { TextArea as Ot } from "../../TextArea/TextArea.js";
|
|
5
|
-
import { c as Nt } from "../../../index-
|
|
5
|
+
import { c as Nt } from "../../../index-YnD2EP-S.js";
|
|
6
6
|
import { useClientWidth as Ut } from "../../../shared/useClientWidth.js";
|
|
7
7
|
import { Modal as Pt } from "../../Modal/ui/Modal.js";
|
|
8
|
-
import { NewIcon as
|
|
8
|
+
import { NewIcon as tt } from "../../NewIcon/ui/NewIcon.js";
|
|
9
9
|
import { Flex as It } from "../../Flex/ui/Flex.js";
|
|
10
|
-
import { Input as
|
|
11
|
-
import { CheckBox as
|
|
12
|
-
import { Button as
|
|
10
|
+
import { Input as Me } from "../../Input/ui/Input.js";
|
|
11
|
+
import { CheckBox as rt } from "../../CheckBox/CheckBox.js";
|
|
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", Kt = "_description_ky28a_41", jt = "_inputWrapper_ky28a_48", Gt = "_linkPolicy_ky28a_55", Yt = "_telegramLink_ky28a_60", Jt = "_telegramWrapper_ky28a_65", Qt = "_telegram_ky28a_60", Xt = "_orText_ky28a_88", Zt = "_checkboxText_ky28a_116", I = {
|
|
14
14
|
btn: Wt,
|
|
15
15
|
modal: qt,
|
|
@@ -25,18 +25,18 @@ const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt
|
|
|
25
25
|
orText: Xt,
|
|
26
26
|
checkboxText: Zt
|
|
27
27
|
};
|
|
28
|
-
var
|
|
29
|
-
const
|
|
30
|
-
var
|
|
28
|
+
var xe = (e) => e.type === "checkbox", fe = (e) => e instanceof Date, j = (e) => e == null;
|
|
29
|
+
const mt = (e) => typeof e == "object";
|
|
30
|
+
var U = (e) => !j(e) && !Array.isArray(e) && mt(e) && !fe(e), _t = (e) => U(e) && e.target ? xe(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
|
-
return
|
|
33
|
-
},
|
|
32
|
+
return U(s) && s.hasOwnProperty("isPrototypeOf");
|
|
33
|
+
}, Ie = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
34
34
|
function P(e) {
|
|
35
35
|
let s;
|
|
36
|
-
const t = Array.isArray(e),
|
|
36
|
+
const t = Array.isArray(e), i = typeof FileList < "u" ? e instanceof FileList : !1;
|
|
37
37
|
if (e instanceof Date)
|
|
38
38
|
s = new Date(e);
|
|
39
|
-
else if (!(
|
|
39
|
+
else if (!(Ie && (e instanceof Blob || i)) && (t || U(e)))
|
|
40
40
|
if (s = t ? [] : Object.create(Object.getPrototypeOf(e)), !t && !tr(e))
|
|
41
41
|
s = e;
|
|
42
42
|
else
|
|
@@ -46,37 +46,37 @@ function P(e) {
|
|
|
46
46
|
return e;
|
|
47
47
|
return s;
|
|
48
48
|
}
|
|
49
|
-
var De = (e) => /^\w*$/.test(e), L = (e) => e === void 0,
|
|
50
|
-
if (!s || !
|
|
49
|
+
var De = (e) => /^\w*$/.test(e), L = (e) => e === void 0, We = (e) => Array.isArray(e) ? e.filter(Boolean) : [], qe = (e) => We(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
|
|
50
|
+
if (!s || !U(e))
|
|
51
51
|
return t;
|
|
52
|
-
const
|
|
53
|
-
return L(
|
|
54
|
-
}, J = (e) => typeof e == "boolean",
|
|
55
|
-
let
|
|
56
|
-
const o = De(s) ? [s] :
|
|
57
|
-
for (; ++
|
|
58
|
-
const
|
|
59
|
-
let
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
|
|
52
|
+
const i = (De(s) ? [s] : qe(s)).reduce((o, l) => j(o) ? o : o[l], e);
|
|
53
|
+
return L(i) || i === e ? L(e[s]) ? t : e[s] : i;
|
|
54
|
+
}, J = (e) => typeof e == "boolean", R = (e, s, t) => {
|
|
55
|
+
let i = -1;
|
|
56
|
+
const o = De(s) ? [s] : qe(s), l = o.length, c = l - 1;
|
|
57
|
+
for (; ++i < l; ) {
|
|
58
|
+
const d = o[i];
|
|
59
|
+
let D = t;
|
|
60
|
+
if (i !== c) {
|
|
61
|
+
const C = e[d];
|
|
62
|
+
D = U(C) || Array.isArray(C) ? C : isNaN(+o[i + 1]) ? {} : [];
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (d === "__proto__" || d === "constructor" || d === "prototype")
|
|
65
65
|
return;
|
|
66
|
-
e[
|
|
66
|
+
e[d] = D, e = e[d];
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
const we = {
|
|
70
70
|
BLUR: "blur",
|
|
71
71
|
FOCUS_OUT: "focusout",
|
|
72
72
|
CHANGE: "change"
|
|
73
|
-
},
|
|
73
|
+
}, ie = {
|
|
74
74
|
onBlur: "onBlur",
|
|
75
75
|
onChange: "onChange",
|
|
76
76
|
onSubmit: "onSubmit",
|
|
77
77
|
onTouched: "onTouched",
|
|
78
78
|
all: "all"
|
|
79
|
-
},
|
|
79
|
+
}, ne = {
|
|
80
80
|
max: "max",
|
|
81
81
|
min: "min",
|
|
82
82
|
maxLength: "maxLength",
|
|
@@ -84,25 +84,25 @@ const we = {
|
|
|
84
84
|
pattern: "pattern",
|
|
85
85
|
required: "required",
|
|
86
86
|
validate: "validate"
|
|
87
|
-
},
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
var
|
|
87
|
+
}, vt = v.createContext(null);
|
|
88
|
+
vt.displayName = "HookFormContext";
|
|
89
|
+
const He = () => v.useContext(vt);
|
|
90
|
+
var bt = (e, s, t, i = !0) => {
|
|
91
91
|
const o = {
|
|
92
92
|
defaultValues: s._defaultValues
|
|
93
93
|
};
|
|
94
94
|
for (const l in e)
|
|
95
95
|
Object.defineProperty(o, l, {
|
|
96
96
|
get: () => {
|
|
97
|
-
const
|
|
98
|
-
return s._proxyFormState[
|
|
97
|
+
const c = l;
|
|
98
|
+
return s._proxyFormState[c] !== ie.all && (s._proxyFormState[c] = !i || ie.all), t && (t[c] = !0), e[c];
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
101
|
return o;
|
|
102
102
|
};
|
|
103
|
-
const
|
|
103
|
+
const ze = typeof window < "u" ? v.useLayoutEffect : v.useEffect;
|
|
104
104
|
function rr(e) {
|
|
105
|
-
const s =
|
|
105
|
+
const s = He(), { control: t = s.control, disabled: i, name: o, exact: l } = e || {}, [c, d] = v.useState(t._formState), D = v.useRef({
|
|
106
106
|
isDirty: !1,
|
|
107
107
|
isLoading: !1,
|
|
108
108
|
dirtyFields: !1,
|
|
@@ -112,167 +112,182 @@ function rr(e) {
|
|
|
112
112
|
isValid: !1,
|
|
113
113
|
errors: !1
|
|
114
114
|
});
|
|
115
|
-
return
|
|
115
|
+
return ze(() => t._subscribe({
|
|
116
116
|
name: o,
|
|
117
|
-
formState:
|
|
117
|
+
formState: D.current,
|
|
118
118
|
exact: l,
|
|
119
|
-
callback: (
|
|
120
|
-
!
|
|
119
|
+
callback: (C) => {
|
|
120
|
+
!i && d({
|
|
121
121
|
...t._formState,
|
|
122
|
-
...
|
|
122
|
+
...C
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
}), [o,
|
|
126
|
-
|
|
127
|
-
}, [t]),
|
|
125
|
+
}), [o, i, l]), v.useEffect(() => {
|
|
126
|
+
D.current.isValid && t._setValid(!0);
|
|
127
|
+
}, [t]), v.useMemo(() => bt(c, t, D.current, !1), [c, t]);
|
|
128
128
|
}
|
|
129
|
-
var Q = (e) => typeof e == "string",
|
|
130
|
-
function
|
|
131
|
-
if (
|
|
129
|
+
var Q = (e) => typeof e == "string", Ne = (e, s, t, i, o) => Q(e) ? (i && s.watch.add(e), y(t, e, o)) : Array.isArray(e) ? e.map((l) => (i && s.watch.add(l), y(t, l))) : (i && (s.watchAll = !0), t), Ue = (e) => j(e) || !mt(e);
|
|
130
|
+
function ae(e, s, t = /* @__PURE__ */ new WeakSet()) {
|
|
131
|
+
if (Ue(e) || Ue(s))
|
|
132
132
|
return e === s;
|
|
133
133
|
if (fe(e) && fe(s))
|
|
134
134
|
return e.getTime() === s.getTime();
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
135
|
+
const i = Object.keys(e), o = Object.keys(s);
|
|
136
|
+
if (i.length !== o.length)
|
|
137
137
|
return !1;
|
|
138
138
|
if (t.has(e) || t.has(s))
|
|
139
139
|
return !0;
|
|
140
140
|
t.add(e), t.add(s);
|
|
141
|
-
for (const l of
|
|
142
|
-
const
|
|
141
|
+
for (const l of i) {
|
|
142
|
+
const c = e[l];
|
|
143
143
|
if (!o.includes(l))
|
|
144
144
|
return !1;
|
|
145
145
|
if (l !== "ref") {
|
|
146
|
-
const
|
|
147
|
-
if (fe(
|
|
146
|
+
const d = s[l];
|
|
147
|
+
if (fe(c) && fe(d) || U(c) && U(d) || Array.isArray(c) && Array.isArray(d) ? !ae(c, d, t) : c !== d)
|
|
148
148
|
return !1;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
return !0;
|
|
152
152
|
}
|
|
153
153
|
function sr(e) {
|
|
154
|
-
const s =
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
const s = He(), { control: t = s.control, name: i, defaultValue: o, disabled: l, exact: c, compute: d } = e || {}, D = v.useRef(o), C = v.useRef(d), g = v.useRef(void 0), x = v.useRef(t), _ = v.useRef(i);
|
|
155
|
+
C.current = d;
|
|
156
|
+
const [X, q] = v.useState(() => {
|
|
157
|
+
const F = t._getWatch(i, D.current);
|
|
158
|
+
return C.current ? C.current(F) : F;
|
|
159
|
+
}), E = v.useCallback((F) => {
|
|
160
|
+
const V = Ne(i, t._names, F || t._formValues, !1, D.current);
|
|
161
|
+
return C.current ? C.current(V) : V;
|
|
162
|
+
}, [t._formValues, t._names, i]), M = v.useCallback((F) => {
|
|
163
|
+
if (!l) {
|
|
164
|
+
const V = Ne(i, t._names, F || t._formValues, !1, D.current);
|
|
165
|
+
if (C.current) {
|
|
166
|
+
const H = C.current(V);
|
|
167
|
+
ae(H, g.current) || (q(H), g.current = H);
|
|
168
|
+
} else
|
|
169
|
+
q(V);
|
|
170
|
+
}
|
|
171
|
+
}, [t._formValues, t._names, l, i]);
|
|
172
|
+
ze(() => ((x.current !== t || !ae(_.current, i)) && (x.current = t, _.current = i, M()), t._subscribe({
|
|
173
|
+
name: i,
|
|
159
174
|
formState: {
|
|
160
175
|
values: !0
|
|
161
176
|
},
|
|
162
|
-
exact:
|
|
163
|
-
callback: (
|
|
164
|
-
|
|
165
|
-
const p = bt(a, t._names, q.values || t._formValues, !1, S.current);
|
|
166
|
-
if (D.current) {
|
|
167
|
-
const M = D.current(p);
|
|
168
|
-
le(M, _.current) || (j(M), _.current = M);
|
|
169
|
-
} else
|
|
170
|
-
j(p);
|
|
171
|
-
}
|
|
177
|
+
exact: c,
|
|
178
|
+
callback: (F) => {
|
|
179
|
+
M(F.values);
|
|
172
180
|
}
|
|
173
|
-
}), [t,
|
|
181
|
+
})), [t, c, i, M]), v.useEffect(() => t._removeUnmounted());
|
|
182
|
+
const Z = x.current !== t, b = _.current, S = v.useMemo(() => {
|
|
183
|
+
if (l)
|
|
184
|
+
return null;
|
|
185
|
+
const F = !Z && !ae(b, i);
|
|
186
|
+
return Z || F ? E() : null;
|
|
187
|
+
}, [l, Z, i, b, E]);
|
|
188
|
+
return S !== null ? S : X;
|
|
174
189
|
}
|
|
175
190
|
function ir(e) {
|
|
176
|
-
const s =
|
|
191
|
+
const s = He(), { name: t, disabled: i, control: o = s.control, shouldUnregister: l, defaultValue: c } = e, d = gt(o._names.array, t), D = v.useMemo(() => y(o._formValues, t, y(o._defaultValues, t, c)), [o, t, c]), C = sr({
|
|
177
192
|
control: o,
|
|
178
193
|
name: t,
|
|
179
|
-
defaultValue:
|
|
194
|
+
defaultValue: D,
|
|
180
195
|
exact: !0
|
|
181
|
-
}),
|
|
196
|
+
}), g = rr({
|
|
182
197
|
control: o,
|
|
183
198
|
name: t,
|
|
184
199
|
exact: !0
|
|
185
|
-
}), x =
|
|
200
|
+
}), x = v.useRef(e), _ = v.useRef(void 0), X = v.useRef(o.register(t, {
|
|
186
201
|
...e.rules,
|
|
187
|
-
value:
|
|
202
|
+
value: C,
|
|
188
203
|
...J(e.disabled) ? { disabled: e.disabled } : {}
|
|
189
204
|
}));
|
|
190
205
|
x.current = e;
|
|
191
|
-
const q =
|
|
206
|
+
const q = v.useMemo(() => Object.defineProperties({}, {
|
|
192
207
|
invalid: {
|
|
193
208
|
enumerable: !0,
|
|
194
|
-
get: () => !!y(
|
|
209
|
+
get: () => !!y(g.errors, t)
|
|
195
210
|
},
|
|
196
211
|
isDirty: {
|
|
197
212
|
enumerable: !0,
|
|
198
|
-
get: () => !!y(
|
|
213
|
+
get: () => !!y(g.dirtyFields, t)
|
|
199
214
|
},
|
|
200
215
|
isTouched: {
|
|
201
216
|
enumerable: !0,
|
|
202
|
-
get: () => !!y(
|
|
217
|
+
get: () => !!y(g.touchedFields, t)
|
|
203
218
|
},
|
|
204
219
|
isValidating: {
|
|
205
220
|
enumerable: !0,
|
|
206
|
-
get: () => !!y(
|
|
221
|
+
get: () => !!y(g.validatingFields, t)
|
|
207
222
|
},
|
|
208
223
|
error: {
|
|
209
224
|
enumerable: !0,
|
|
210
|
-
get: () => y(
|
|
225
|
+
get: () => y(g.errors, t)
|
|
211
226
|
}
|
|
212
|
-
}), [
|
|
227
|
+
}), [g, t]), E = v.useCallback((S) => X.current.onChange({
|
|
213
228
|
target: {
|
|
214
|
-
value:
|
|
229
|
+
value: _t(S),
|
|
215
230
|
name: t
|
|
216
231
|
},
|
|
217
232
|
type: we.CHANGE
|
|
218
|
-
}), [t]), M =
|
|
233
|
+
}), [t]), M = v.useCallback(() => X.current.onBlur({
|
|
219
234
|
target: {
|
|
220
235
|
value: y(o._formValues, t),
|
|
221
236
|
name: t
|
|
222
237
|
},
|
|
223
238
|
type: we.BLUR
|
|
224
|
-
}), [t, o._formValues]),
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
focus: () =>
|
|
228
|
-
select: () =>
|
|
229
|
-
setCustomValidity: (
|
|
230
|
-
reportValidity: () =>
|
|
239
|
+
}), [t, o._formValues]), Z = v.useCallback((S) => {
|
|
240
|
+
const F = y(o._fields, t);
|
|
241
|
+
F && S && (F._f.ref = {
|
|
242
|
+
focus: () => S.focus && S.focus(),
|
|
243
|
+
select: () => S.select && S.select(),
|
|
244
|
+
setCustomValidity: (V) => S.setCustomValidity(V),
|
|
245
|
+
reportValidity: () => S.reportValidity()
|
|
231
246
|
});
|
|
232
|
-
}, [o._fields, t]),
|
|
247
|
+
}, [o._fields, t]), b = v.useMemo(() => ({
|
|
233
248
|
name: t,
|
|
234
|
-
value:
|
|
235
|
-
...J(
|
|
236
|
-
onChange:
|
|
249
|
+
value: C,
|
|
250
|
+
...J(i) || g.disabled ? { disabled: g.disabled || i } : {},
|
|
251
|
+
onChange: E,
|
|
237
252
|
onBlur: M,
|
|
238
|
-
ref:
|
|
239
|
-
}), [t,
|
|
240
|
-
return
|
|
241
|
-
const
|
|
242
|
-
|
|
253
|
+
ref: Z
|
|
254
|
+
}), [t, i, g.disabled, E, M, Z, C]);
|
|
255
|
+
return v.useEffect(() => {
|
|
256
|
+
const S = o._options.shouldUnregister || l, F = _.current;
|
|
257
|
+
F && F !== t && !d && o.unregister(F), o.register(t, {
|
|
243
258
|
...x.current.rules,
|
|
244
259
|
...J(x.current.disabled) ? { disabled: x.current.disabled } : {}
|
|
245
260
|
});
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
|
|
261
|
+
const V = (H, z) => {
|
|
262
|
+
const se = y(o._fields, H);
|
|
263
|
+
se && se._f && (se._f.mount = z);
|
|
249
264
|
};
|
|
250
|
-
if (
|
|
251
|
-
const
|
|
252
|
-
|
|
265
|
+
if (V(t, !0), S) {
|
|
266
|
+
const H = P(y(o._options.defaultValues, t, x.current.defaultValue));
|
|
267
|
+
R(o._defaultValues, t, H), L(y(o._formValues, t)) && R(o._formValues, t, H);
|
|
253
268
|
}
|
|
254
|
-
return !
|
|
255
|
-
(
|
|
269
|
+
return !d && o.register(t), _.current = t, () => {
|
|
270
|
+
(d ? S && !o._state.action : S) ? o.unregister(t) : V(t, !1);
|
|
256
271
|
};
|
|
257
|
-
}, [t, o,
|
|
272
|
+
}, [t, o, d, l]), v.useEffect(() => {
|
|
258
273
|
o._setDisabledField({
|
|
259
|
-
disabled:
|
|
274
|
+
disabled: i,
|
|
260
275
|
name: t
|
|
261
276
|
});
|
|
262
|
-
}, [
|
|
263
|
-
field:
|
|
264
|
-
formState:
|
|
277
|
+
}, [i, t, o]), v.useMemo(() => ({
|
|
278
|
+
field: b,
|
|
279
|
+
formState: g,
|
|
265
280
|
fieldState: q
|
|
266
|
-
}), [
|
|
281
|
+
}), [b, g, q]);
|
|
267
282
|
}
|
|
268
283
|
const ar = (e) => e.render(ir(e));
|
|
269
|
-
var lr = (e, s, t,
|
|
284
|
+
var lr = (e, s, t, i, o) => s ? {
|
|
270
285
|
...t[e],
|
|
271
286
|
types: {
|
|
272
287
|
...t[e] && t[e].types ? t[e].types : {},
|
|
273
|
-
[
|
|
288
|
+
[i]: o || !0
|
|
274
289
|
}
|
|
275
|
-
} : {}, Ve = (e) => Array.isArray(e) ? e : [e],
|
|
290
|
+
} : {}, Ve = (e) => Array.isArray(e) ? e : [e], it = () => {
|
|
276
291
|
let e = [];
|
|
277
292
|
return {
|
|
278
293
|
get observers() {
|
|
@@ -294,27 +309,27 @@ var lr = (e, s, t, a, o) => s ? {
|
|
|
294
309
|
};
|
|
295
310
|
function Vt(e, s) {
|
|
296
311
|
const t = {};
|
|
297
|
-
for (const
|
|
298
|
-
if (e.hasOwnProperty(
|
|
299
|
-
const o = e[
|
|
300
|
-
if (o &&
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
} else e[
|
|
312
|
+
for (const i in e)
|
|
313
|
+
if (e.hasOwnProperty(i)) {
|
|
314
|
+
const o = e[i], l = s[i];
|
|
315
|
+
if (o && U(o) && l) {
|
|
316
|
+
const c = Vt(o, l);
|
|
317
|
+
U(c) && (t[i] = c);
|
|
318
|
+
} else e[i] && (t[i] = l);
|
|
304
319
|
}
|
|
305
320
|
return t;
|
|
306
321
|
}
|
|
307
|
-
var
|
|
308
|
-
if (!
|
|
322
|
+
var K = (e) => U(e) && !Object.keys(e).length, $e = (e) => e.type === "file", le = (e) => typeof e == "function", Ce = (e) => {
|
|
323
|
+
if (!Ie)
|
|
309
324
|
return !1;
|
|
310
325
|
const s = e ? e.ownerDocument : 0;
|
|
311
326
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
312
|
-
},
|
|
327
|
+
}, kt = (e) => e.type === "select-multiple", Ke = (e) => e.type === "radio", nr = (e) => Ke(e) || xe(e), Oe = (e) => Ce(e) && e.isConnected;
|
|
313
328
|
function or(e, s) {
|
|
314
329
|
const t = s.slice(0, -1).length;
|
|
315
|
-
let
|
|
316
|
-
for (;
|
|
317
|
-
e = L(e) ?
|
|
330
|
+
let i = 0;
|
|
331
|
+
for (; i < t; )
|
|
332
|
+
e = L(e) ? i++ : e[s[i++]];
|
|
318
333
|
return e;
|
|
319
334
|
}
|
|
320
335
|
function ur(e) {
|
|
@@ -323,34 +338,34 @@ function ur(e) {
|
|
|
323
338
|
return !1;
|
|
324
339
|
return !0;
|
|
325
340
|
}
|
|
326
|
-
function
|
|
327
|
-
const t = Array.isArray(s) ? s : De(s) ? [s] :
|
|
328
|
-
return
|
|
341
|
+
function N(e, s) {
|
|
342
|
+
const t = Array.isArray(s) ? s : De(s) ? [s] : qe(s), i = t.length === 1 ? e : or(e, t), o = t.length - 1, l = t[o];
|
|
343
|
+
return i && delete i[l], o !== 0 && (U(i) && K(i) || Array.isArray(i) && ur(i)) && N(e, t.slice(0, -1)), e;
|
|
329
344
|
}
|
|
330
|
-
var
|
|
345
|
+
var cr = (e) => {
|
|
331
346
|
for (const s in e)
|
|
332
|
-
if (
|
|
347
|
+
if (le(e[s]))
|
|
333
348
|
return !0;
|
|
334
349
|
return !1;
|
|
335
350
|
};
|
|
336
|
-
function
|
|
337
|
-
return Array.isArray(e) ||
|
|
351
|
+
function xt(e) {
|
|
352
|
+
return Array.isArray(e) || U(e) && !cr(e);
|
|
338
353
|
}
|
|
339
|
-
function
|
|
354
|
+
function Pe(e, s = {}) {
|
|
340
355
|
for (const t in e)
|
|
341
|
-
|
|
356
|
+
xt(e[t]) ? (s[t] = Array.isArray(e[t]) ? [] : {}, Pe(e[t], s[t])) : L(e[t]) || (s[t] = !0);
|
|
342
357
|
return s;
|
|
343
358
|
}
|
|
344
359
|
function me(e, s, t) {
|
|
345
|
-
t || (t =
|
|
346
|
-
for (const
|
|
347
|
-
|
|
360
|
+
t || (t = Pe(s));
|
|
361
|
+
for (const i in e)
|
|
362
|
+
xt(e[i]) ? L(s) || Ue(t[i]) ? t[i] = Pe(e[i], Array.isArray(e[i]) ? [] : {}) : me(e[i], j(s) ? {} : s[i], t[i]) : t[i] = !ae(e[i], s[i]);
|
|
348
363
|
return t;
|
|
349
364
|
}
|
|
350
|
-
const
|
|
365
|
+
const at = {
|
|
351
366
|
value: !1,
|
|
352
367
|
isValid: !1
|
|
353
|
-
},
|
|
368
|
+
}, lt = { value: !0, isValid: !0 };
|
|
354
369
|
var Ft = (e) => {
|
|
355
370
|
if (Array.isArray(e)) {
|
|
356
371
|
if (e.length > 1) {
|
|
@@ -359,82 +374,82 @@ var Ft = (e) => {
|
|
|
359
374
|
}
|
|
360
375
|
return e[0].checked && !e[0].disabled ? (
|
|
361
376
|
// @ts-expect-error expected to work in the browser
|
|
362
|
-
e[0].attributes && !L(e[0].attributes.value) ? L(e[0].value) || e[0].value === "" ?
|
|
363
|
-
) :
|
|
377
|
+
e[0].attributes && !L(e[0].attributes.value) ? L(e[0].value) || e[0].value === "" ? lt : { value: e[0].value, isValid: !0 } : lt
|
|
378
|
+
) : at;
|
|
364
379
|
}
|
|
365
|
-
return
|
|
366
|
-
},
|
|
367
|
-
const
|
|
380
|
+
return at;
|
|
381
|
+
}, pt = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: i }) => L(e) ? e : s ? e === "" ? NaN : e && +e : t && Q(e) ? new Date(e) : i ? i(e) : e;
|
|
382
|
+
const nt = {
|
|
368
383
|
isValid: !1,
|
|
369
384
|
value: null
|
|
370
385
|
};
|
|
371
|
-
var
|
|
386
|
+
var At = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
|
|
372
387
|
isValid: !0,
|
|
373
388
|
value: t.value
|
|
374
|
-
} : s,
|
|
375
|
-
function
|
|
389
|
+
} : s, nt) : nt;
|
|
390
|
+
function ot(e) {
|
|
376
391
|
const s = e.ref;
|
|
377
|
-
return
|
|
392
|
+
return $e(s) ? s.files : Ke(s) ? At(e.refs).value : kt(s) ? [...s.selectedOptions].map(({ value: t }) => t) : xe(s) ? Ft(e.refs).value : pt(L(s.value) ? e.ref.value : s.value, e);
|
|
378
393
|
}
|
|
379
|
-
var
|
|
394
|
+
var dr = (e, s, t, i) => {
|
|
380
395
|
const o = {};
|
|
381
396
|
for (const l of e) {
|
|
382
|
-
const
|
|
383
|
-
|
|
397
|
+
const c = y(s, l);
|
|
398
|
+
c && R(o, l, c._f);
|
|
384
399
|
}
|
|
385
400
|
return {
|
|
386
401
|
criteriaMode: t,
|
|
387
402
|
names: [...e],
|
|
388
403
|
fields: o,
|
|
389
|
-
shouldUseNativeValidation:
|
|
404
|
+
shouldUseNativeValidation: i
|
|
390
405
|
};
|
|
391
|
-
}, Se = (e) => e instanceof RegExp, be = (e) => L(e) ? e : Se(e) ? e.source :
|
|
392
|
-
isOnSubmit: !e || e ===
|
|
393
|
-
isOnBlur: e ===
|
|
394
|
-
isOnChange: e ===
|
|
395
|
-
isOnAll: e ===
|
|
396
|
-
isOnTouch: e ===
|
|
406
|
+
}, Se = (e) => e instanceof RegExp, be = (e) => L(e) ? e : Se(e) ? e.source : U(e) ? Se(e.value) ? e.value.source : e.value : e, ut = (e) => ({
|
|
407
|
+
isOnSubmit: !e || e === ie.onSubmit,
|
|
408
|
+
isOnBlur: e === ie.onBlur,
|
|
409
|
+
isOnChange: e === ie.onChange,
|
|
410
|
+
isOnAll: e === ie.all,
|
|
411
|
+
isOnTouch: e === ie.onTouched
|
|
397
412
|
});
|
|
398
|
-
const
|
|
399
|
-
var fr = (e) => !!e && !!e.validate && !!(
|
|
400
|
-
const
|
|
413
|
+
const ct = "AsyncFunction";
|
|
414
|
+
var fr = (e) => !!e && !!e.validate && !!(le(e.validate) && e.validate.constructor.name === ct || U(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
|
+
const ke = (e, s, t, i) => {
|
|
401
416
|
for (const o of t || Object.keys(e)) {
|
|
402
417
|
const l = y(e, o);
|
|
403
418
|
if (l) {
|
|
404
|
-
const { _f:
|
|
405
|
-
if (
|
|
406
|
-
if (
|
|
419
|
+
const { _f: c, ...d } = l;
|
|
420
|
+
if (c) {
|
|
421
|
+
if (c.refs && c.refs[0] && s(c.refs[0], o) && !i)
|
|
407
422
|
return !0;
|
|
408
|
-
if (
|
|
423
|
+
if (c.ref && s(c.ref, c.name) && !i)
|
|
409
424
|
return !0;
|
|
410
|
-
if (
|
|
425
|
+
if (ke(d, s))
|
|
411
426
|
break;
|
|
412
|
-
} else if (
|
|
427
|
+
} else if (U(d) && ke(d, s))
|
|
413
428
|
break;
|
|
414
429
|
}
|
|
415
430
|
}
|
|
416
431
|
};
|
|
417
|
-
function
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
432
|
+
function ft(e, s, t) {
|
|
433
|
+
const i = y(e, t);
|
|
434
|
+
if (i || De(t))
|
|
420
435
|
return {
|
|
421
|
-
error:
|
|
436
|
+
error: i,
|
|
422
437
|
name: t
|
|
423
438
|
};
|
|
424
439
|
const o = t.split(".");
|
|
425
440
|
for (; o.length; ) {
|
|
426
|
-
const l = o.join("."),
|
|
427
|
-
if (
|
|
441
|
+
const l = o.join("."), c = y(s, l), d = y(e, l);
|
|
442
|
+
if (c && !Array.isArray(c) && t !== l)
|
|
428
443
|
return { name: t };
|
|
429
|
-
if (
|
|
444
|
+
if (d && d.type)
|
|
430
445
|
return {
|
|
431
446
|
name: l,
|
|
432
|
-
error:
|
|
447
|
+
error: d
|
|
433
448
|
};
|
|
434
|
-
if (
|
|
449
|
+
if (d && d.root && d.root.type)
|
|
435
450
|
return {
|
|
436
451
|
name: `${l}.root`,
|
|
437
|
-
error:
|
|
452
|
+
error: d.root
|
|
438
453
|
};
|
|
439
454
|
o.pop();
|
|
440
455
|
}
|
|
@@ -442,15 +457,15 @@ function ct(e, s, t) {
|
|
|
442
457
|
name: t
|
|
443
458
|
};
|
|
444
459
|
}
|
|
445
|
-
var hr = (e, s, t,
|
|
460
|
+
var hr = (e, s, t, i) => {
|
|
446
461
|
t(e);
|
|
447
462
|
const { name: o, ...l } = e;
|
|
448
|
-
return
|
|
449
|
-
}, mr = (e, s, t) => !e || !s || e === s || Ve(e).some((
|
|
450
|
-
const
|
|
451
|
-
return
|
|
463
|
+
return K(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((c) => s[c] === (!i || ie.all));
|
|
464
|
+
}, mr = (e, s, t) => !e || !s || e === s || Ve(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) => !We(y(e, s)).length && N(e, s), vr = (e, s, t) => {
|
|
465
|
+
const i = Ve(y(e, t));
|
|
466
|
+
return R(i, "root", s[t]), R(e, t, i), e;
|
|
452
467
|
};
|
|
453
|
-
function
|
|
468
|
+
function yt(e, s, t = "validate") {
|
|
454
469
|
if (Q(e) || Array.isArray(e) && e.every(Q) || J(e) && !e)
|
|
455
470
|
return {
|
|
456
471
|
type: t,
|
|
@@ -458,93 +473,93 @@ function ft(e, s, t = "validate") {
|
|
|
458
473
|
ref: s
|
|
459
474
|
};
|
|
460
475
|
}
|
|
461
|
-
var he = (e) =>
|
|
476
|
+
var he = (e) => U(e) && !Se(e) ? e : {
|
|
462
477
|
value: e,
|
|
463
478
|
message: ""
|
|
464
|
-
},
|
|
465
|
-
const { ref:
|
|
466
|
-
if (!
|
|
479
|
+
}, ht = async (e, s, t, i, o, l) => {
|
|
480
|
+
const { ref: c, refs: d, required: D, maxLength: C, minLength: g, min: x, max: _, pattern: X, validate: q, name: E, valueAsNumber: M, mount: Z } = e._f, b = y(t, E);
|
|
481
|
+
if (!Z || s.has(E))
|
|
467
482
|
return {};
|
|
468
|
-
const
|
|
469
|
-
o &&
|
|
470
|
-
},
|
|
471
|
-
const Y =
|
|
472
|
-
|
|
473
|
-
type:
|
|
483
|
+
const S = d ? d[0] : c, F = (k) => {
|
|
484
|
+
o && S.reportValidity && (S.setCustomValidity(J(k) ? "" : k || ""), S.reportValidity());
|
|
485
|
+
}, V = {}, H = Ke(c), z = xe(c), se = H || z, $ = (M || $e(c)) && L(c.value) && L(b) || Ce(c) && c.value === "" || b === "" || Array.isArray(b) && !b.length, G = lr.bind(null, E, i, V), ee = (k, p, B, A = ne.maxLength, W = ne.minLength) => {
|
|
486
|
+
const Y = k ? p : B;
|
|
487
|
+
V[E] = {
|
|
488
|
+
type: k ? A : W,
|
|
474
489
|
message: Y,
|
|
475
|
-
ref:
|
|
476
|
-
...G(
|
|
490
|
+
ref: c,
|
|
491
|
+
...G(k ? A : W, Y)
|
|
477
492
|
};
|
|
478
493
|
};
|
|
479
|
-
if (l ? !Array.isArray(
|
|
480
|
-
const { value:
|
|
481
|
-
if (
|
|
482
|
-
type:
|
|
483
|
-
message:
|
|
484
|
-
ref:
|
|
485
|
-
...G(
|
|
486
|
-
}, !
|
|
487
|
-
return
|
|
494
|
+
if (l ? !Array.isArray(b) || !b.length : D && (!se && ($ || j(b)) || J(b) && !b || z && !Ft(d).isValid || H && !At(d).isValid)) {
|
|
495
|
+
const { value: k, message: p } = Q(D) ? { value: !!D, message: D } : he(D);
|
|
496
|
+
if (k && (V[E] = {
|
|
497
|
+
type: ne.required,
|
|
498
|
+
message: p,
|
|
499
|
+
ref: S,
|
|
500
|
+
...G(ne.required, p)
|
|
501
|
+
}, !i))
|
|
502
|
+
return F(p), V;
|
|
488
503
|
}
|
|
489
|
-
if (
|
|
490
|
-
let
|
|
491
|
-
const
|
|
492
|
-
if (!
|
|
493
|
-
const W =
|
|
494
|
-
|
|
504
|
+
if (!$ && (!j(x) || !j(_))) {
|
|
505
|
+
let k, p;
|
|
506
|
+
const B = he(_), A = he(x);
|
|
507
|
+
if (!j(b) && !isNaN(b)) {
|
|
508
|
+
const W = c.valueAsNumber || b && +b;
|
|
509
|
+
j(B.value) || (k = W > B.value), j(A.value) || (p = W < A.value);
|
|
495
510
|
} else {
|
|
496
|
-
const W =
|
|
497
|
-
Q(
|
|
511
|
+
const W = c.valueAsDate || new Date(b), Y = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), oe = c.type == "time", ue = c.type == "week";
|
|
512
|
+
Q(B.value) && b && (k = oe ? Y(b) > Y(B.value) : ue ? b > B.value : W > new Date(B.value)), Q(A.value) && b && (p = oe ? Y(b) < Y(A.value) : ue ? b < A.value : W < new Date(A.value));
|
|
498
513
|
}
|
|
499
|
-
if ((
|
|
500
|
-
return
|
|
514
|
+
if ((k || p) && (ee(!!k, B.message, A.message, ne.max, ne.min), !i))
|
|
515
|
+
return F(V[E].message), V;
|
|
501
516
|
}
|
|
502
|
-
if ((
|
|
503
|
-
const
|
|
504
|
-
if ((
|
|
505
|
-
return
|
|
517
|
+
if ((C || g) && !$ && (Q(b) || l && Array.isArray(b))) {
|
|
518
|
+
const k = he(C), p = he(g), B = !j(k.value) && b.length > +k.value, A = !j(p.value) && b.length < +p.value;
|
|
519
|
+
if ((B || A) && (ee(B, k.message, p.message), !i))
|
|
520
|
+
return F(V[E].message), V;
|
|
506
521
|
}
|
|
507
|
-
if (
|
|
508
|
-
const { value:
|
|
509
|
-
if (Se(
|
|
510
|
-
type:
|
|
511
|
-
message:
|
|
512
|
-
ref:
|
|
513
|
-
...G(
|
|
514
|
-
}, !
|
|
515
|
-
return
|
|
522
|
+
if (X && !$ && Q(b)) {
|
|
523
|
+
const { value: k, message: p } = he(X);
|
|
524
|
+
if (Se(k) && !b.match(k) && (V[E] = {
|
|
525
|
+
type: ne.pattern,
|
|
526
|
+
message: p,
|
|
527
|
+
ref: c,
|
|
528
|
+
...G(ne.pattern, p)
|
|
529
|
+
}, !i))
|
|
530
|
+
return F(p), V;
|
|
516
531
|
}
|
|
517
532
|
if (q) {
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
if (
|
|
521
|
-
...
|
|
522
|
-
...G(
|
|
523
|
-
}, !
|
|
524
|
-
return
|
|
525
|
-
} else if (
|
|
526
|
-
let
|
|
527
|
-
for (const
|
|
528
|
-
if (
|
|
533
|
+
if (le(q)) {
|
|
534
|
+
const k = await q(b, t), p = yt(k, S);
|
|
535
|
+
if (p && (V[E] = {
|
|
536
|
+
...p,
|
|
537
|
+
...G(ne.validate, p.message)
|
|
538
|
+
}, !i))
|
|
539
|
+
return F(p.message), V;
|
|
540
|
+
} else if (U(q)) {
|
|
541
|
+
let k = {};
|
|
542
|
+
for (const p in q) {
|
|
543
|
+
if (!K(k) && !i)
|
|
529
544
|
break;
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
...
|
|
533
|
-
...G(
|
|
534
|
-
},
|
|
545
|
+
const B = yt(await q[p](b, t), S, p);
|
|
546
|
+
B && (k = {
|
|
547
|
+
...B,
|
|
548
|
+
...G(p, B.message)
|
|
549
|
+
}, F(B.message), i && (V[E] = k));
|
|
535
550
|
}
|
|
536
|
-
if (
|
|
537
|
-
ref:
|
|
538
|
-
...
|
|
539
|
-
}, !
|
|
540
|
-
return
|
|
551
|
+
if (!K(k) && (V[E] = {
|
|
552
|
+
ref: S,
|
|
553
|
+
...k
|
|
554
|
+
}, !i))
|
|
555
|
+
return V;
|
|
541
556
|
}
|
|
542
557
|
}
|
|
543
|
-
return
|
|
558
|
+
return F(!0), V;
|
|
544
559
|
};
|
|
545
560
|
const br = {
|
|
546
|
-
mode:
|
|
547
|
-
reValidateMode:
|
|
561
|
+
mode: ie.onSubmit,
|
|
562
|
+
reValidateMode: ie.onChange,
|
|
548
563
|
shouldFocusError: !0
|
|
549
564
|
};
|
|
550
565
|
function Vr(e = {}) {
|
|
@@ -555,7 +570,7 @@ function Vr(e = {}) {
|
|
|
555
570
|
submitCount: 0,
|
|
556
571
|
isDirty: !1,
|
|
557
572
|
isReady: !1,
|
|
558
|
-
isLoading:
|
|
573
|
+
isLoading: le(s.defaultValues),
|
|
559
574
|
isValidating: !1,
|
|
560
575
|
isSubmitted: !1,
|
|
561
576
|
isSubmitting: !1,
|
|
@@ -566,18 +581,18 @@ function Vr(e = {}) {
|
|
|
566
581
|
validatingFields: {},
|
|
567
582
|
errors: s.errors || {},
|
|
568
583
|
disabled: s.disabled || !1
|
|
569
|
-
},
|
|
584
|
+
}, i = {}, o = U(s.defaultValues) || U(s.values) ? P(s.defaultValues || s.values) || {} : {}, l = s.shouldUnregister ? {} : P(o), c = {
|
|
570
585
|
action: !1,
|
|
571
586
|
mount: !1,
|
|
572
587
|
watch: !1
|
|
573
|
-
},
|
|
588
|
+
}, d = {
|
|
574
589
|
mount: /* @__PURE__ */ new Set(),
|
|
575
590
|
disabled: /* @__PURE__ */ new Set(),
|
|
576
591
|
unMount: /* @__PURE__ */ new Set(),
|
|
577
592
|
array: /* @__PURE__ */ new Set(),
|
|
578
593
|
watch: /* @__PURE__ */ new Set()
|
|
579
|
-
},
|
|
580
|
-
const
|
|
594
|
+
}, D, C = 0;
|
|
595
|
+
const g = {
|
|
581
596
|
isDirty: !1,
|
|
582
597
|
dirtyFields: !1,
|
|
583
598
|
validatingFields: !1,
|
|
@@ -587,112 +602,112 @@ function Vr(e = {}) {
|
|
|
587
602
|
errors: !1
|
|
588
603
|
};
|
|
589
604
|
let x = {
|
|
590
|
-
...
|
|
605
|
+
...g
|
|
591
606
|
};
|
|
592
|
-
const
|
|
593
|
-
array:
|
|
594
|
-
state:
|
|
595
|
-
},
|
|
596
|
-
clearTimeout(
|
|
597
|
-
},
|
|
598
|
-
if (!s.disabled && (
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
isValid:
|
|
607
|
+
const _ = {
|
|
608
|
+
array: it(),
|
|
609
|
+
state: it()
|
|
610
|
+
}, X = s.criteriaMode === ie.all, q = (r) => (a) => {
|
|
611
|
+
clearTimeout(C), C = setTimeout(r, a);
|
|
612
|
+
}, E = async (r) => {
|
|
613
|
+
if (!s.disabled && (g.isValid || x.isValid || r)) {
|
|
614
|
+
const a = s.resolver ? K((await z()).errors) : await $(i, !0);
|
|
615
|
+
a !== t.isValid && _.state.next({
|
|
616
|
+
isValid: a
|
|
602
617
|
});
|
|
603
618
|
}
|
|
604
|
-
}, M = (r,
|
|
605
|
-
!s.disabled && (
|
|
606
|
-
n && (
|
|
607
|
-
}),
|
|
619
|
+
}, M = (r, a) => {
|
|
620
|
+
!s.disabled && (g.isValidating || g.validatingFields || x.isValidating || x.validatingFields) && ((r || Array.from(d.mount)).forEach((n) => {
|
|
621
|
+
n && (a ? R(t.validatingFields, n, a) : N(t.validatingFields, n));
|
|
622
|
+
}), _.state.next({
|
|
608
623
|
validatingFields: t.validatingFields,
|
|
609
|
-
isValidating:
|
|
624
|
+
isValidating: !K(t.validatingFields)
|
|
610
625
|
}));
|
|
611
|
-
},
|
|
626
|
+
}, Z = (r, a = [], n, h, f = !0, u = !0) => {
|
|
612
627
|
if (h && n && !s.disabled) {
|
|
613
|
-
if (
|
|
614
|
-
const m = n(y(
|
|
615
|
-
f &&
|
|
628
|
+
if (c.action = !0, u && Array.isArray(y(i, r))) {
|
|
629
|
+
const m = n(y(i, r), h.argA, h.argB);
|
|
630
|
+
f && R(i, r, m);
|
|
616
631
|
}
|
|
617
632
|
if (u && Array.isArray(y(t.errors, r))) {
|
|
618
633
|
const m = n(y(t.errors, r), h.argA, h.argB);
|
|
619
|
-
f &&
|
|
634
|
+
f && R(t.errors, r, m), gr(t.errors, r);
|
|
620
635
|
}
|
|
621
|
-
if ((
|
|
636
|
+
if ((g.touchedFields || x.touchedFields) && u && Array.isArray(y(t.touchedFields, r))) {
|
|
622
637
|
const m = n(y(t.touchedFields, r), h.argA, h.argB);
|
|
623
|
-
f &&
|
|
638
|
+
f && R(t.touchedFields, r, m);
|
|
624
639
|
}
|
|
625
|
-
(
|
|
640
|
+
(g.dirtyFields || x.dirtyFields) && (t.dirtyFields = me(o, l)), _.state.next({
|
|
626
641
|
name: r,
|
|
627
|
-
isDirty:
|
|
642
|
+
isDirty: ee(r, a),
|
|
628
643
|
dirtyFields: t.dirtyFields,
|
|
629
644
|
errors: t.errors,
|
|
630
645
|
isValid: t.isValid
|
|
631
646
|
});
|
|
632
647
|
} else
|
|
633
|
-
|
|
634
|
-
},
|
|
635
|
-
|
|
648
|
+
R(l, r, a);
|
|
649
|
+
}, b = (r, a) => {
|
|
650
|
+
R(t.errors, r, a), _.state.next({
|
|
636
651
|
errors: t.errors
|
|
637
652
|
});
|
|
638
|
-
},
|
|
639
|
-
t.errors = r,
|
|
653
|
+
}, S = (r) => {
|
|
654
|
+
t.errors = r, _.state.next({
|
|
640
655
|
errors: t.errors,
|
|
641
656
|
isValid: !1
|
|
642
657
|
});
|
|
643
|
-
},
|
|
644
|
-
const f = y(
|
|
658
|
+
}, F = (r, a, n, h) => {
|
|
659
|
+
const f = y(i, r);
|
|
645
660
|
if (f) {
|
|
646
661
|
const u = y(l, r, L(n) ? y(o, r) : n);
|
|
647
|
-
L(u) || h && h.defaultChecked ||
|
|
662
|
+
L(u) || h && h.defaultChecked || a ? R(l, r, a ? u : ot(f._f)) : B(r, u), c.mount && E();
|
|
648
663
|
}
|
|
649
|
-
},
|
|
664
|
+
}, V = (r, a, n, h, f) => {
|
|
650
665
|
let u = !1, m = !1;
|
|
651
|
-
const
|
|
666
|
+
const w = {
|
|
652
667
|
name: r
|
|
653
668
|
};
|
|
654
669
|
if (!s.disabled) {
|
|
655
670
|
if (!n || h) {
|
|
656
|
-
(
|
|
657
|
-
const
|
|
658
|
-
m = !!y(t.dirtyFields, r),
|
|
671
|
+
(g.isDirty || x.isDirty) && (m = t.isDirty, t.isDirty = w.isDirty = ee(), u = m !== w.isDirty);
|
|
672
|
+
const T = ae(y(o, r), a);
|
|
673
|
+
m = !!y(t.dirtyFields, r), T ? N(t.dirtyFields, r) : R(t.dirtyFields, r, !0), w.dirtyFields = t.dirtyFields, u = u || (g.dirtyFields || x.dirtyFields) && m !== !T;
|
|
659
674
|
}
|
|
660
675
|
if (n) {
|
|
661
|
-
const
|
|
662
|
-
|
|
676
|
+
const T = y(t.touchedFields, r);
|
|
677
|
+
T || (R(t.touchedFields, r, n), w.touchedFields = t.touchedFields, u = u || (g.touchedFields || x.touchedFields) && T !== n);
|
|
663
678
|
}
|
|
664
|
-
u && f &&
|
|
679
|
+
u && f && _.state.next(w);
|
|
665
680
|
}
|
|
666
|
-
return u ?
|
|
667
|
-
},
|
|
668
|
-
const f = y(t.errors, r), u = (
|
|
669
|
-
if (s.delayError && n ? (
|
|
681
|
+
return u ? w : {};
|
|
682
|
+
}, H = (r, a, n, h) => {
|
|
683
|
+
const f = y(t.errors, r), u = (g.isValid || x.isValid) && J(a) && t.isValid !== a;
|
|
684
|
+
if (s.delayError && n ? (D = q(() => b(r, n)), D(s.delayError)) : (clearTimeout(C), D = null, n ? R(t.errors, r, n) : N(t.errors, r)), (n ? !ae(f, n) : f) || !K(h) || u) {
|
|
670
685
|
const m = {
|
|
671
686
|
...h,
|
|
672
|
-
...u && J(
|
|
687
|
+
...u && J(a) ? { isValid: a } : {},
|
|
673
688
|
errors: t.errors,
|
|
674
689
|
name: r
|
|
675
690
|
};
|
|
676
691
|
t = {
|
|
677
692
|
...t,
|
|
678
693
|
...m
|
|
679
|
-
},
|
|
694
|
+
}, _.state.next(m);
|
|
680
695
|
}
|
|
681
|
-
},
|
|
696
|
+
}, z = async (r) => {
|
|
682
697
|
M(r, !0);
|
|
683
|
-
const
|
|
684
|
-
return M(r),
|
|
685
|
-
},
|
|
686
|
-
const { errors:
|
|
698
|
+
const a = await s.resolver(l, s.context, dr(r || d.mount, i, s.criteriaMode, s.shouldUseNativeValidation));
|
|
699
|
+
return M(r), a;
|
|
700
|
+
}, se = async (r) => {
|
|
701
|
+
const { errors: a } = await z(r);
|
|
687
702
|
if (r)
|
|
688
703
|
for (const n of r) {
|
|
689
|
-
const h = y(
|
|
690
|
-
h ?
|
|
704
|
+
const h = y(a, n);
|
|
705
|
+
h ? R(t.errors, n, h) : N(t.errors, n);
|
|
691
706
|
}
|
|
692
707
|
else
|
|
693
|
-
t.errors =
|
|
694
|
-
return
|
|
695
|
-
},
|
|
708
|
+
t.errors = a;
|
|
709
|
+
return a;
|
|
710
|
+
}, $ = async (r, a, n = {
|
|
696
711
|
valid: !0
|
|
697
712
|
}) => {
|
|
698
713
|
for (const h in r) {
|
|
@@ -700,231 +715,231 @@ function Vr(e = {}) {
|
|
|
700
715
|
if (f) {
|
|
701
716
|
const { _f: u, ...m } = f;
|
|
702
717
|
if (u) {
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
-
const
|
|
706
|
-
if (
|
|
718
|
+
const w = d.array.has(u.name), T = f._f && fr(f._f);
|
|
719
|
+
T && g.validatingFields && M([u.name], !0);
|
|
720
|
+
const re = await ht(f, d.disabled, l, X, s.shouldUseNativeValidation && !a, w);
|
|
721
|
+
if (T && g.validatingFields && M([u.name]), re[u.name] && (n.valid = !1, a))
|
|
707
722
|
break;
|
|
708
|
-
!
|
|
723
|
+
!a && (y(re, u.name) ? w ? vr(t.errors, re, u.name) : R(t.errors, u.name, re[u.name]) : N(t.errors, u.name));
|
|
709
724
|
}
|
|
710
|
-
|
|
725
|
+
!K(m) && await $(m, a, n);
|
|
711
726
|
}
|
|
712
727
|
}
|
|
713
728
|
return n.valid;
|
|
714
729
|
}, G = () => {
|
|
715
|
-
for (const r of
|
|
716
|
-
const
|
|
717
|
-
|
|
730
|
+
for (const r of d.unMount) {
|
|
731
|
+
const a = y(i, r);
|
|
732
|
+
a && (a._f.refs ? a._f.refs.every((n) => !Oe(n)) : !Oe(a._f.ref)) && ve(r);
|
|
718
733
|
}
|
|
719
|
-
|
|
720
|
-
},
|
|
721
|
-
...
|
|
722
|
-
}, n,
|
|
723
|
-
const h = y(
|
|
724
|
-
let f =
|
|
734
|
+
d.unMount = /* @__PURE__ */ new Set();
|
|
735
|
+
}, ee = (r, a) => !s.disabled && (r && a && R(l, r, a), !ae(ye(), o)), k = (r, a, n) => Ne(r, d, {
|
|
736
|
+
...c.mount ? l : L(a) ? o : Q(r) ? { [r]: a } : a
|
|
737
|
+
}, n, a), p = (r) => We(y(c.mount ? l : o, r, s.shouldUnregister ? y(o, r, []) : [])), B = (r, a, n = {}) => {
|
|
738
|
+
const h = y(i, r);
|
|
739
|
+
let f = a;
|
|
725
740
|
if (h) {
|
|
726
741
|
const u = h._f;
|
|
727
|
-
u && (!u.disabled &&
|
|
728
|
-
(!m.defaultChecked || !m.disabled) && (Array.isArray(f) ? m.checked = !!f.find((
|
|
729
|
-
}) : u.refs.forEach((m) => m.checked = m.value === f) :
|
|
742
|
+
u && (!u.disabled && R(l, r, pt(a, u)), f = Ce(u.ref) && j(a) ? "" : a, kt(u.ref) ? [...u.ref.options].forEach((m) => m.selected = f.includes(m.value)) : u.refs ? xe(u.ref) ? u.refs.forEach((m) => {
|
|
743
|
+
(!m.defaultChecked || !m.disabled) && (Array.isArray(f) ? m.checked = !!f.find((w) => w === m.value) : m.checked = f === m.value || !!f);
|
|
744
|
+
}) : u.refs.forEach((m) => m.checked = m.value === f) : $e(u.ref) ? u.ref.value = "" : (u.ref.value = f, u.ref.type || _.state.next({
|
|
730
745
|
name: r,
|
|
731
746
|
values: P(l)
|
|
732
747
|
})));
|
|
733
748
|
}
|
|
734
|
-
(n.shouldDirty || n.shouldTouch) &&
|
|
735
|
-
},
|
|
736
|
-
for (const h in
|
|
737
|
-
if (!
|
|
749
|
+
(n.shouldDirty || n.shouldTouch) && V(r, f, n.shouldTouch, n.shouldDirty, !0), n.shouldValidate && ue(r);
|
|
750
|
+
}, A = (r, a, n) => {
|
|
751
|
+
for (const h in a) {
|
|
752
|
+
if (!a.hasOwnProperty(h))
|
|
738
753
|
return;
|
|
739
|
-
const f =
|
|
740
|
-
(
|
|
754
|
+
const f = a[h], u = r + "." + h, m = y(i, u);
|
|
755
|
+
(d.array.has(r) || U(f) || m && !m._f) && !fe(f) ? A(u, f, n) : B(u, f, n);
|
|
741
756
|
}
|
|
742
|
-
}, W = (r,
|
|
743
|
-
const h = y(
|
|
744
|
-
|
|
757
|
+
}, W = (r, a, n = {}) => {
|
|
758
|
+
const h = y(i, r), f = d.array.has(r), u = P(a);
|
|
759
|
+
R(l, r, u), f ? (_.array.next({
|
|
745
760
|
name: r,
|
|
746
761
|
values: P(l)
|
|
747
|
-
}), (
|
|
762
|
+
}), (g.isDirty || g.dirtyFields || x.isDirty || x.dirtyFields) && n.shouldDirty && _.state.next({
|
|
748
763
|
name: r,
|
|
749
764
|
dirtyFields: me(o, l),
|
|
750
|
-
isDirty:
|
|
751
|
-
})) : h && !h._f && !
|
|
752
|
-
name:
|
|
765
|
+
isDirty: ee(r, u)
|
|
766
|
+
})) : h && !h._f && !j(u) ? A(r, u, n) : B(r, u, n), dt(r, d) && _.state.next({ ...t, name: r }), _.state.next({
|
|
767
|
+
name: c.mount ? r : void 0,
|
|
753
768
|
values: P(l)
|
|
754
769
|
});
|
|
755
770
|
}, Y = async (r) => {
|
|
756
|
-
|
|
757
|
-
const
|
|
758
|
-
let n =
|
|
759
|
-
const f = y(
|
|
760
|
-
h = Number.isNaN(
|
|
761
|
-
}, m =
|
|
771
|
+
c.mount = !0;
|
|
772
|
+
const a = r.target;
|
|
773
|
+
let n = a.name, h = !0;
|
|
774
|
+
const f = y(i, n), u = (T) => {
|
|
775
|
+
h = Number.isNaN(T) || fe(T) && isNaN(T.getTime()) || ae(T, y(l, n, T));
|
|
776
|
+
}, m = ut(s.mode), w = ut(s.reValidateMode);
|
|
762
777
|
if (f) {
|
|
763
|
-
let
|
|
764
|
-
const
|
|
765
|
-
|
|
766
|
-
const
|
|
767
|
-
if (!
|
|
778
|
+
let T, re;
|
|
779
|
+
const Ae = a.type ? ot(f._f) : _t(r), ce = r.type === we.BLUR || r.type === we.FOCUS_OUT, Et = !yr(f._f) && !s.resolver && !y(t.errors, n) && !f._f.deps || _r(ce, y(t.touchedFields, n), t.isSubmitted, w, m), Re = dt(n, d, ce);
|
|
780
|
+
R(l, n, Ae), ce ? (!a || !a.readOnly) && (f._f.onBlur && f._f.onBlur(r), D && D(0)) : f._f.onChange && f._f.onChange(r);
|
|
781
|
+
const Le = V(n, Ae, ce), Bt = !K(Le) || Re;
|
|
782
|
+
if (!ce && _.state.next({
|
|
768
783
|
name: n,
|
|
769
784
|
type: r.type,
|
|
770
785
|
values: P(l)
|
|
771
786
|
}), Et)
|
|
772
|
-
return (
|
|
773
|
-
if (!
|
|
774
|
-
const { errors:
|
|
775
|
-
if (u(
|
|
776
|
-
const Tt =
|
|
777
|
-
|
|
787
|
+
return (g.isValid || x.isValid) && (s.mode === "onBlur" ? ce && E() : ce || E()), Bt && _.state.next({ name: n, ...Re ? {} : Le });
|
|
788
|
+
if (!ce && Re && _.state.next({ ...t }), s.resolver) {
|
|
789
|
+
const { errors: Xe } = await z([n]);
|
|
790
|
+
if (u(Ae), h) {
|
|
791
|
+
const Tt = ft(t.errors, i, n), Ze = ft(Xe, i, Tt.name || n);
|
|
792
|
+
T = Ze.error, n = Ze.name, re = K(Xe);
|
|
778
793
|
}
|
|
779
794
|
} else
|
|
780
|
-
M([n], !0),
|
|
781
|
-
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ue(f._f.deps),
|
|
795
|
+
M([n], !0), T = (await ht(f, d.disabled, l, X, s.shouldUseNativeValidation))[n], M([n]), u(Ae), h && (T ? re = !1 : (g.isValid || x.isValid) && (re = await $(i, !0)));
|
|
796
|
+
h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ue(f._f.deps), H(n, re, T, Le));
|
|
782
797
|
}
|
|
783
|
-
}, oe = (r,
|
|
784
|
-
if (y(t.errors,
|
|
798
|
+
}, oe = (r, a) => {
|
|
799
|
+
if (y(t.errors, a) && r.focus)
|
|
785
800
|
return r.focus(), 1;
|
|
786
|
-
}, ue = async (r,
|
|
801
|
+
}, ue = async (r, a = {}) => {
|
|
787
802
|
let n, h;
|
|
788
803
|
const f = Ve(r);
|
|
789
804
|
if (s.resolver) {
|
|
790
|
-
const u = await
|
|
791
|
-
n =
|
|
805
|
+
const u = await se(L(r) ? r : f);
|
|
806
|
+
n = K(u), h = r ? !f.some((m) => y(u, m)) : n;
|
|
792
807
|
} else r ? (h = (await Promise.all(f.map(async (u) => {
|
|
793
|
-
const m = y(
|
|
794
|
-
return await
|
|
795
|
-
}))).every(Boolean), !(!h && !t.isValid) &&
|
|
796
|
-
return
|
|
797
|
-
...!Q(r) || (
|
|
808
|
+
const m = y(i, u);
|
|
809
|
+
return await $(m && m._f ? { [u]: m } : m);
|
|
810
|
+
}))).every(Boolean), !(!h && !t.isValid) && E()) : h = n = await $(i);
|
|
811
|
+
return _.state.next({
|
|
812
|
+
...!Q(r) || (g.isValid || x.isValid) && n !== t.isValid ? {} : { name: r },
|
|
798
813
|
...s.resolver || !r ? { isValid: n } : {},
|
|
799
814
|
errors: t.errors
|
|
800
|
-
}),
|
|
801
|
-
}, ye = (r,
|
|
815
|
+
}), a.shouldFocus && !h && ke(i, oe, r ? f : d.mount), h;
|
|
816
|
+
}, ye = (r, a) => {
|
|
802
817
|
let n = {
|
|
803
|
-
...
|
|
818
|
+
...c.mount ? l : o
|
|
804
819
|
};
|
|
805
|
-
return
|
|
806
|
-
}, Fe = (r,
|
|
807
|
-
invalid: !!y((
|
|
808
|
-
isDirty: !!y((
|
|
809
|
-
error: y((
|
|
820
|
+
return a && (n = Vt(a.dirtyFields ? t.dirtyFields : t.touchedFields, n)), L(r) ? n : Q(r) ? y(n, r) : r.map((h) => y(n, h));
|
|
821
|
+
}, Fe = (r, a) => ({
|
|
822
|
+
invalid: !!y((a || t).errors, r),
|
|
823
|
+
isDirty: !!y((a || t).dirtyFields, r),
|
|
824
|
+
error: y((a || t).errors, r),
|
|
810
825
|
isValidating: !!y(t.validatingFields, r),
|
|
811
|
-
isTouched: !!y((
|
|
826
|
+
isTouched: !!y((a || t).touchedFields, r)
|
|
812
827
|
}), Ee = (r) => {
|
|
813
|
-
r && Ve(r).forEach((
|
|
828
|
+
r && Ve(r).forEach((a) => N(t.errors, a)), _.state.next({
|
|
814
829
|
errors: r ? t.errors : {}
|
|
815
830
|
});
|
|
816
|
-
},
|
|
817
|
-
const h = (y(
|
|
818
|
-
|
|
819
|
-
...
|
|
820
|
-
...
|
|
831
|
+
}, pe = (r, a, n) => {
|
|
832
|
+
const h = (y(i, r, { _f: {} })._f || {}).ref, f = y(t.errors, r) || {}, { ref: u, message: m, type: w, ...T } = f;
|
|
833
|
+
R(t.errors, r, {
|
|
834
|
+
...T,
|
|
835
|
+
...a,
|
|
821
836
|
ref: h
|
|
822
|
-
}),
|
|
837
|
+
}), _.state.next({
|
|
823
838
|
name: r,
|
|
824
839
|
errors: t.errors,
|
|
825
840
|
isValid: !1
|
|
826
841
|
}), n && n.shouldFocus && h && h.focus && h.focus();
|
|
827
|
-
}, _e = (r,
|
|
828
|
-
next: (n) => "values" in n && r(
|
|
829
|
-
}) :
|
|
830
|
-
next: (
|
|
831
|
-
mr(r.name,
|
|
842
|
+
}, _e = (r, a) => le(r) ? _.state.subscribe({
|
|
843
|
+
next: (n) => "values" in n && r(k(void 0, a), n)
|
|
844
|
+
}) : k(r, a, !0), te = (r) => _.state.subscribe({
|
|
845
|
+
next: (a) => {
|
|
846
|
+
mr(r.name, a.name, r.exact) && hr(a, r.formState || g, Dt, r.reRenderRoot) && r.callback({
|
|
832
847
|
values: { ...l },
|
|
833
848
|
...t,
|
|
834
|
-
...
|
|
849
|
+
...a,
|
|
835
850
|
defaultValues: o
|
|
836
851
|
});
|
|
837
852
|
}
|
|
838
|
-
}).unsubscribe, ge = (r) => (
|
|
853
|
+
}).unsubscribe, ge = (r) => (c.mount = !0, x = {
|
|
839
854
|
...x,
|
|
840
855
|
...r.formState
|
|
841
|
-
},
|
|
856
|
+
}, te({
|
|
842
857
|
...r,
|
|
843
858
|
formState: x
|
|
844
|
-
})), ve = (r,
|
|
845
|
-
for (const n of r ? Ve(r) :
|
|
846
|
-
|
|
847
|
-
|
|
859
|
+
})), ve = (r, a = {}) => {
|
|
860
|
+
for (const n of r ? Ve(r) : d.mount)
|
|
861
|
+
d.mount.delete(n), d.array.delete(n), a.keepValue || (N(i, n), N(l, n)), !a.keepError && N(t.errors, n), !a.keepDirty && N(t.dirtyFields, n), !a.keepTouched && N(t.touchedFields, n), !a.keepIsValidating && N(t.validatingFields, n), !s.shouldUnregister && !a.keepDefaultValue && N(o, n);
|
|
862
|
+
_.state.next({
|
|
848
863
|
values: P(l)
|
|
849
|
-
}),
|
|
864
|
+
}), _.state.next({
|
|
850
865
|
...t,
|
|
851
|
-
...
|
|
852
|
-
}), !
|
|
853
|
-
},
|
|
854
|
-
(J(r) &&
|
|
855
|
-
}, Be = (r,
|
|
856
|
-
let n = y(
|
|
857
|
-
const h = J(
|
|
858
|
-
return
|
|
866
|
+
...a.keepDirty ? { isDirty: ee() } : {}
|
|
867
|
+
}), !a.keepIsValid && E();
|
|
868
|
+
}, je = ({ disabled: r, name: a }) => {
|
|
869
|
+
(J(r) && c.mount || r || d.disabled.has(a)) && (r ? d.disabled.add(a) : d.disabled.delete(a));
|
|
870
|
+
}, Be = (r, a = {}) => {
|
|
871
|
+
let n = y(i, r);
|
|
872
|
+
const h = J(a.disabled) || J(s.disabled);
|
|
873
|
+
return R(i, r, {
|
|
859
874
|
...n || {},
|
|
860
875
|
_f: {
|
|
861
876
|
...n && n._f ? n._f : { ref: { name: r } },
|
|
862
877
|
name: r,
|
|
863
878
|
mount: !0,
|
|
864
|
-
...
|
|
879
|
+
...a
|
|
865
880
|
}
|
|
866
|
-
}),
|
|
867
|
-
disabled: J(
|
|
881
|
+
}), d.mount.add(r), n ? je({
|
|
882
|
+
disabled: J(a.disabled) ? a.disabled : s.disabled,
|
|
868
883
|
name: r
|
|
869
|
-
}) :
|
|
870
|
-
...h ? { disabled:
|
|
884
|
+
}) : F(r, !0, a.value), {
|
|
885
|
+
...h ? { disabled: a.disabled || s.disabled } : {},
|
|
871
886
|
...s.progressive ? {
|
|
872
|
-
required: !!
|
|
873
|
-
min: be(
|
|
874
|
-
max: be(
|
|
875
|
-
minLength: be(
|
|
876
|
-
maxLength: be(
|
|
877
|
-
pattern: be(
|
|
887
|
+
required: !!a.required,
|
|
888
|
+
min: be(a.min),
|
|
889
|
+
max: be(a.max),
|
|
890
|
+
minLength: be(a.minLength),
|
|
891
|
+
maxLength: be(a.maxLength),
|
|
892
|
+
pattern: be(a.pattern)
|
|
878
893
|
} : {},
|
|
879
894
|
name: r,
|
|
880
895
|
onChange: Y,
|
|
881
896
|
onBlur: Y,
|
|
882
897
|
ref: (f) => {
|
|
883
898
|
if (f) {
|
|
884
|
-
Be(r,
|
|
885
|
-
const u = L(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = nr(u),
|
|
886
|
-
if (m ?
|
|
899
|
+
Be(r, a), n = y(i, r);
|
|
900
|
+
const u = L(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = nr(u), w = n._f.refs || [];
|
|
901
|
+
if (m ? w.find((T) => T === u) : u === n._f.ref)
|
|
887
902
|
return;
|
|
888
|
-
|
|
903
|
+
R(i, r, {
|
|
889
904
|
_f: {
|
|
890
905
|
...n._f,
|
|
891
906
|
...m ? {
|
|
892
907
|
refs: [
|
|
893
|
-
...
|
|
908
|
+
...w.filter(Oe),
|
|
894
909
|
u,
|
|
895
910
|
...Array.isArray(y(o, r)) ? [{}] : []
|
|
896
911
|
],
|
|
897
912
|
ref: { type: u.type, name: r }
|
|
898
913
|
} : { ref: u }
|
|
899
914
|
}
|
|
900
|
-
}),
|
|
915
|
+
}), F(r, !1, void 0, u);
|
|
901
916
|
} else
|
|
902
|
-
n = y(
|
|
917
|
+
n = y(i, r, {}), n._f && (n._f.mount = !1), (s.shouldUnregister || a.shouldUnregister) && !(gt(d.array, r) && c.action) && d.unMount.add(r);
|
|
903
918
|
}
|
|
904
919
|
};
|
|
905
|
-
}, Te = () => s.shouldFocusError &&
|
|
906
|
-
J(r) && (
|
|
907
|
-
const h = y(
|
|
908
|
-
h && (
|
|
920
|
+
}, Te = () => s.shouldFocusError && ke(i, oe, d.mount), wt = (r) => {
|
|
921
|
+
J(r) && (_.state.next({ disabled: r }), ke(i, (a, n) => {
|
|
922
|
+
const h = y(i, n);
|
|
923
|
+
h && (a.disabled = h._f.disabled || r, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
|
|
909
924
|
f.disabled = h._f.disabled || r;
|
|
910
925
|
}));
|
|
911
926
|
}, 0, !1));
|
|
912
|
-
},
|
|
927
|
+
}, Ge = (r, a) => async (n) => {
|
|
913
928
|
let h;
|
|
914
929
|
n && (n.preventDefault && n.preventDefault(), n.persist && n.persist());
|
|
915
930
|
let f = P(l);
|
|
916
|
-
if (
|
|
931
|
+
if (_.state.next({
|
|
917
932
|
isSubmitting: !0
|
|
918
933
|
}), s.resolver) {
|
|
919
|
-
const { errors: u, values: m } = await
|
|
934
|
+
const { errors: u, values: m } = await z();
|
|
920
935
|
t.errors = u, f = P(m);
|
|
921
936
|
} else
|
|
922
|
-
await
|
|
923
|
-
if (
|
|
924
|
-
for (const u of
|
|
925
|
-
|
|
926
|
-
if (
|
|
927
|
-
|
|
937
|
+
await $(i);
|
|
938
|
+
if (d.disabled.size)
|
|
939
|
+
for (const u of d.disabled)
|
|
940
|
+
N(f, u);
|
|
941
|
+
if (N(t.errors, "root"), K(t.errors)) {
|
|
942
|
+
_.state.next({
|
|
928
943
|
errors: {}
|
|
929
944
|
});
|
|
930
945
|
try {
|
|
@@ -933,131 +948,131 @@ function Vr(e = {}) {
|
|
|
933
948
|
h = u;
|
|
934
949
|
}
|
|
935
950
|
} else
|
|
936
|
-
|
|
937
|
-
if (
|
|
951
|
+
a && await a({ ...t.errors }, n), Te(), setTimeout(Te);
|
|
952
|
+
if (_.state.next({
|
|
938
953
|
isSubmitted: !0,
|
|
939
954
|
isSubmitting: !1,
|
|
940
|
-
isSubmitSuccessful:
|
|
955
|
+
isSubmitSuccessful: K(t.errors) && !h,
|
|
941
956
|
submitCount: t.submitCount + 1,
|
|
942
957
|
errors: t.errors
|
|
943
958
|
}), h)
|
|
944
959
|
throw h;
|
|
945
|
-
}, Ct = (r,
|
|
946
|
-
y(
|
|
947
|
-
},
|
|
948
|
-
const n = r ? P(r) : o, h = P(n), f =
|
|
949
|
-
if (
|
|
950
|
-
if (
|
|
960
|
+
}, Ct = (r, a = {}) => {
|
|
961
|
+
y(i, r) && (L(a.defaultValue) ? W(r, P(y(o, r))) : (W(r, a.defaultValue), R(o, r, P(a.defaultValue))), a.keepTouched || N(t.touchedFields, r), a.keepDirty || (N(t.dirtyFields, r), t.isDirty = a.defaultValue ? ee(r, P(y(o, r))) : ee()), a.keepError || (N(t.errors, r), g.isValid && E()), _.state.next({ ...t }));
|
|
962
|
+
}, Ye = (r, a = {}) => {
|
|
963
|
+
const n = r ? P(r) : o, h = P(n), f = K(r), u = f ? o : h;
|
|
964
|
+
if (a.keepDefaultValues || (o = n), !a.keepValues) {
|
|
965
|
+
if (a.keepDirtyValues) {
|
|
951
966
|
const m = /* @__PURE__ */ new Set([
|
|
952
|
-
...
|
|
967
|
+
...d.mount,
|
|
953
968
|
...Object.keys(me(o, l))
|
|
954
969
|
]);
|
|
955
|
-
for (const
|
|
956
|
-
y(t.dirtyFields,
|
|
970
|
+
for (const w of Array.from(m))
|
|
971
|
+
y(t.dirtyFields, w) ? R(u, w, y(l, w)) : W(w, y(u, w));
|
|
957
972
|
} else {
|
|
958
|
-
if (
|
|
959
|
-
for (const m of
|
|
960
|
-
const
|
|
961
|
-
if (
|
|
962
|
-
const
|
|
963
|
-
if (Ce(
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
|
|
973
|
+
if (Ie && L(r))
|
|
974
|
+
for (const m of d.mount) {
|
|
975
|
+
const w = y(i, m);
|
|
976
|
+
if (w && w._f) {
|
|
977
|
+
const T = Array.isArray(w._f.refs) ? w._f.refs[0] : w._f.ref;
|
|
978
|
+
if (Ce(T)) {
|
|
979
|
+
const re = T.closest("form");
|
|
980
|
+
if (re) {
|
|
981
|
+
re.reset();
|
|
967
982
|
break;
|
|
968
983
|
}
|
|
969
984
|
}
|
|
970
985
|
}
|
|
971
986
|
}
|
|
972
|
-
if (
|
|
973
|
-
for (const m of
|
|
987
|
+
if (a.keepFieldsRef)
|
|
988
|
+
for (const m of d.mount)
|
|
974
989
|
W(m, y(u, m));
|
|
975
990
|
else
|
|
976
|
-
|
|
991
|
+
i = {};
|
|
977
992
|
}
|
|
978
|
-
l = s.shouldUnregister ?
|
|
993
|
+
l = s.shouldUnregister ? a.keepDefaultValues ? P(o) : {} : P(u), _.array.next({
|
|
979
994
|
values: { ...u }
|
|
980
|
-
}),
|
|
995
|
+
}), _.state.next({
|
|
981
996
|
values: { ...u }
|
|
982
997
|
});
|
|
983
998
|
}
|
|
984
|
-
|
|
985
|
-
mount:
|
|
999
|
+
d = {
|
|
1000
|
+
mount: a.keepDirtyValues ? d.mount : /* @__PURE__ */ new Set(),
|
|
986
1001
|
unMount: /* @__PURE__ */ new Set(),
|
|
987
1002
|
array: /* @__PURE__ */ new Set(),
|
|
988
1003
|
disabled: /* @__PURE__ */ new Set(),
|
|
989
1004
|
watch: /* @__PURE__ */ new Set(),
|
|
990
1005
|
watchAll: !1,
|
|
991
1006
|
focus: ""
|
|
992
|
-
},
|
|
993
|
-
submitCount:
|
|
994
|
-
isDirty: f ? !1 :
|
|
995
|
-
isSubmitted:
|
|
996
|
-
dirtyFields: f ? {} :
|
|
997
|
-
touchedFields:
|
|
998
|
-
errors:
|
|
999
|
-
isSubmitSuccessful:
|
|
1007
|
+
}, c.mount = !g.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !s.shouldUnregister && !K(u), c.watch = !!s.shouldUnregister, _.state.next({
|
|
1008
|
+
submitCount: a.keepSubmitCount ? t.submitCount : 0,
|
|
1009
|
+
isDirty: f ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ae(r, o)),
|
|
1010
|
+
isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
|
|
1011
|
+
dirtyFields: f ? {} : a.keepDirtyValues ? a.keepDefaultValues && l ? me(o, l) : t.dirtyFields : a.keepDefaultValues && r ? me(o, r) : a.keepDirty ? t.dirtyFields : {},
|
|
1012
|
+
touchedFields: a.keepTouched ? t.touchedFields : {},
|
|
1013
|
+
errors: a.keepErrors ? t.errors : {},
|
|
1014
|
+
isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
|
|
1000
1015
|
isSubmitting: !1,
|
|
1001
1016
|
defaultValues: o
|
|
1002
1017
|
});
|
|
1003
|
-
},
|
|
1004
|
-
const n = y(
|
|
1018
|
+
}, Je = (r, a) => Ye(le(r) ? r(l) : r, a), St = (r, a = {}) => {
|
|
1019
|
+
const n = y(i, r), h = n && n._f;
|
|
1005
1020
|
if (h) {
|
|
1006
1021
|
const f = h.refs ? h.refs[0] : h.ref;
|
|
1007
|
-
f.focus && (f.focus(),
|
|
1022
|
+
f.focus && (f.focus(), a.shouldSelect && le(f.select) && f.select());
|
|
1008
1023
|
}
|
|
1009
1024
|
}, Dt = (r) => {
|
|
1010
1025
|
t = {
|
|
1011
1026
|
...t,
|
|
1012
1027
|
...r
|
|
1013
1028
|
};
|
|
1014
|
-
},
|
|
1029
|
+
}, Qe = {
|
|
1015
1030
|
control: {
|
|
1016
1031
|
register: Be,
|
|
1017
1032
|
unregister: ve,
|
|
1018
1033
|
getFieldState: Fe,
|
|
1019
|
-
handleSubmit:
|
|
1020
|
-
setError:
|
|
1021
|
-
_subscribe:
|
|
1022
|
-
_runSchema:
|
|
1034
|
+
handleSubmit: Ge,
|
|
1035
|
+
setError: pe,
|
|
1036
|
+
_subscribe: te,
|
|
1037
|
+
_runSchema: z,
|
|
1023
1038
|
_focusError: Te,
|
|
1024
|
-
_getWatch:
|
|
1025
|
-
_getDirty:
|
|
1026
|
-
_setValid:
|
|
1027
|
-
_setFieldArray:
|
|
1028
|
-
_setDisabledField:
|
|
1029
|
-
_setErrors:
|
|
1030
|
-
_getFieldArray:
|
|
1031
|
-
_reset:
|
|
1032
|
-
_resetDefaultValues: () =>
|
|
1033
|
-
|
|
1039
|
+
_getWatch: k,
|
|
1040
|
+
_getDirty: ee,
|
|
1041
|
+
_setValid: E,
|
|
1042
|
+
_setFieldArray: Z,
|
|
1043
|
+
_setDisabledField: je,
|
|
1044
|
+
_setErrors: S,
|
|
1045
|
+
_getFieldArray: p,
|
|
1046
|
+
_reset: Ye,
|
|
1047
|
+
_resetDefaultValues: () => le(s.defaultValues) && s.defaultValues().then((r) => {
|
|
1048
|
+
Je(r, s.resetOptions), _.state.next({
|
|
1034
1049
|
isLoading: !1
|
|
1035
1050
|
});
|
|
1036
1051
|
}),
|
|
1037
1052
|
_removeUnmounted: G,
|
|
1038
1053
|
_disableForm: wt,
|
|
1039
|
-
_subjects:
|
|
1040
|
-
_proxyFormState:
|
|
1054
|
+
_subjects: _,
|
|
1055
|
+
_proxyFormState: g,
|
|
1041
1056
|
get _fields() {
|
|
1042
|
-
return
|
|
1057
|
+
return i;
|
|
1043
1058
|
},
|
|
1044
1059
|
get _formValues() {
|
|
1045
1060
|
return l;
|
|
1046
1061
|
},
|
|
1047
1062
|
get _state() {
|
|
1048
|
-
return
|
|
1063
|
+
return c;
|
|
1049
1064
|
},
|
|
1050
1065
|
set _state(r) {
|
|
1051
|
-
|
|
1066
|
+
c = r;
|
|
1052
1067
|
},
|
|
1053
1068
|
get _defaultValues() {
|
|
1054
1069
|
return o;
|
|
1055
1070
|
},
|
|
1056
1071
|
get _names() {
|
|
1057
|
-
return
|
|
1072
|
+
return d;
|
|
1058
1073
|
},
|
|
1059
1074
|
set _names(r) {
|
|
1060
|
-
|
|
1075
|
+
d = r;
|
|
1061
1076
|
},
|
|
1062
1077
|
get _formState() {
|
|
1063
1078
|
return t;
|
|
@@ -1075,28 +1090,28 @@ function Vr(e = {}) {
|
|
|
1075
1090
|
subscribe: ge,
|
|
1076
1091
|
trigger: ue,
|
|
1077
1092
|
register: Be,
|
|
1078
|
-
handleSubmit:
|
|
1093
|
+
handleSubmit: Ge,
|
|
1079
1094
|
watch: _e,
|
|
1080
1095
|
setValue: W,
|
|
1081
1096
|
getValues: ye,
|
|
1082
|
-
reset:
|
|
1097
|
+
reset: Je,
|
|
1083
1098
|
resetField: Ct,
|
|
1084
1099
|
clearErrors: Ee,
|
|
1085
1100
|
unregister: ve,
|
|
1086
|
-
setError:
|
|
1101
|
+
setError: pe,
|
|
1087
1102
|
setFocus: St,
|
|
1088
1103
|
getFieldState: Fe
|
|
1089
1104
|
};
|
|
1090
1105
|
return {
|
|
1091
|
-
...
|
|
1092
|
-
formControl:
|
|
1106
|
+
...Qe,
|
|
1107
|
+
formControl: Qe
|
|
1093
1108
|
};
|
|
1094
1109
|
}
|
|
1095
|
-
function
|
|
1096
|
-
const s =
|
|
1110
|
+
function kr(e = {}) {
|
|
1111
|
+
const s = v.useRef(void 0), t = v.useRef(void 0), [i, o] = v.useState({
|
|
1097
1112
|
isDirty: !1,
|
|
1098
1113
|
isValidating: !1,
|
|
1099
|
-
isLoading:
|
|
1114
|
+
isLoading: le(e.defaultValues),
|
|
1100
1115
|
isSubmitted: !1,
|
|
1101
1116
|
isSubmitting: !1,
|
|
1102
1117
|
isSubmitSuccessful: !1,
|
|
@@ -1108,211 +1123,211 @@ function xr(e = {}) {
|
|
|
1108
1123
|
errors: e.errors || {},
|
|
1109
1124
|
disabled: e.disabled || !1,
|
|
1110
1125
|
isReady: !1,
|
|
1111
|
-
defaultValues:
|
|
1126
|
+
defaultValues: le(e.defaultValues) ? void 0 : e.defaultValues
|
|
1112
1127
|
});
|
|
1113
1128
|
if (!s.current)
|
|
1114
1129
|
if (e.formControl)
|
|
1115
1130
|
s.current = {
|
|
1116
1131
|
...e.formControl,
|
|
1117
|
-
formState:
|
|
1118
|
-
}, e.defaultValues && !
|
|
1132
|
+
formState: i
|
|
1133
|
+
}, e.defaultValues && !le(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
|
|
1119
1134
|
else {
|
|
1120
|
-
const { formControl:
|
|
1135
|
+
const { formControl: c, ...d } = Vr(e);
|
|
1121
1136
|
s.current = {
|
|
1122
|
-
...
|
|
1123
|
-
formState:
|
|
1137
|
+
...d,
|
|
1138
|
+
formState: i
|
|
1124
1139
|
};
|
|
1125
1140
|
}
|
|
1126
1141
|
const l = s.current.control;
|
|
1127
|
-
return l._options = e,
|
|
1128
|
-
const
|
|
1142
|
+
return l._options = e, ze(() => {
|
|
1143
|
+
const c = l._subscribe({
|
|
1129
1144
|
formState: l._proxyFormState,
|
|
1130
1145
|
callback: () => o({ ...l._formState }),
|
|
1131
1146
|
reRenderRoot: !0
|
|
1132
1147
|
});
|
|
1133
|
-
return o((
|
|
1134
|
-
...
|
|
1148
|
+
return o((d) => ({
|
|
1149
|
+
...d,
|
|
1135
1150
|
isReady: !0
|
|
1136
|
-
})), l._formState.isReady = !0,
|
|
1137
|
-
}, [l]),
|
|
1151
|
+
})), l._formState.isReady = !0, c;
|
|
1152
|
+
}, [l]), v.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), v.useEffect(() => {
|
|
1138
1153
|
e.mode && (l._options.mode = e.mode), e.reValidateMode && (l._options.reValidateMode = e.reValidateMode);
|
|
1139
|
-
}, [l, e.mode, e.reValidateMode]),
|
|
1154
|
+
}, [l, e.mode, e.reValidateMode]), v.useEffect(() => {
|
|
1140
1155
|
e.errors && (l._setErrors(e.errors), l._focusError());
|
|
1141
|
-
}, [l, e.errors]),
|
|
1156
|
+
}, [l, e.errors]), v.useEffect(() => {
|
|
1142
1157
|
e.shouldUnregister && l._subjects.state.next({
|
|
1143
1158
|
values: l._getWatch()
|
|
1144
1159
|
});
|
|
1145
|
-
}, [l, e.shouldUnregister]),
|
|
1160
|
+
}, [l, e.shouldUnregister]), v.useEffect(() => {
|
|
1146
1161
|
if (l._proxyFormState.isDirty) {
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
isDirty:
|
|
1162
|
+
const c = l._getDirty();
|
|
1163
|
+
c !== i.isDirty && l._subjects.state.next({
|
|
1164
|
+
isDirty: c
|
|
1150
1165
|
});
|
|
1151
1166
|
}
|
|
1152
|
-
}, [l,
|
|
1153
|
-
e.values && !
|
|
1167
|
+
}, [l, i.isDirty]), v.useEffect(() => {
|
|
1168
|
+
e.values && !ae(e.values, t.current) ? (l._reset(e.values, {
|
|
1154
1169
|
keepFieldsRef: !0,
|
|
1155
1170
|
...l._options.resetOptions
|
|
1156
|
-
}), t.current = e.values, o((
|
|
1157
|
-
}, [l, e.values]),
|
|
1171
|
+
}), t.current = e.values, o((c) => ({ ...c }))) : l._resetDefaultValues();
|
|
1172
|
+
}, [l, e.values]), v.useEffect(() => {
|
|
1158
1173
|
l._state.mount || (l._setValid(), l._state.mount = !0), l._state.watch && (l._state.watch = !1, l._subjects.state.next({ ...l._formState })), l._removeUnmounted();
|
|
1159
|
-
}), s.current.formState =
|
|
1174
|
+
}), s.current.formState = bt(i, l), s.current;
|
|
1160
1175
|
}
|
|
1161
|
-
const
|
|
1176
|
+
const xr = Nt.bind(I), Fr = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Nr = ({
|
|
1162
1177
|
isFormOpen: e,
|
|
1163
1178
|
setIsFormOpen: s,
|
|
1164
1179
|
isNews: t,
|
|
1165
|
-
title:
|
|
1180
|
+
title: i,
|
|
1166
1181
|
isEmail: o,
|
|
1167
1182
|
isPhone: l,
|
|
1168
|
-
isTextArea:
|
|
1169
|
-
telegramLink:
|
|
1170
|
-
isRequiredPhone:
|
|
1171
|
-
isRequiredEmail:
|
|
1172
|
-
isRequiredPhoneOrEmail:
|
|
1183
|
+
isTextArea: c,
|
|
1184
|
+
telegramLink: d = "https://t.me/stone_developer",
|
|
1185
|
+
isRequiredPhone: D = !0,
|
|
1186
|
+
isRequiredEmail: C = !1,
|
|
1187
|
+
isRequiredPhoneOrEmail: g,
|
|
1173
1188
|
textAreaPlaceholder: x,
|
|
1174
|
-
subTitle:
|
|
1175
|
-
submitHandler:
|
|
1189
|
+
subTitle: _,
|
|
1190
|
+
submitHandler: X,
|
|
1176
1191
|
modalWidth: q = "442px",
|
|
1177
|
-
rowsTextArea:
|
|
1192
|
+
rowsTextArea: E = 2,
|
|
1178
1193
|
advCheckBox: M = { text: Fr, isRequired: !0 },
|
|
1179
|
-
isAdvCheckBox:
|
|
1180
|
-
addTitleClassName:
|
|
1181
|
-
createPortalObj:
|
|
1182
|
-
telegramClickHandler:
|
|
1183
|
-
blurHandler:
|
|
1184
|
-
handlerButton:
|
|
1185
|
-
block_name:
|
|
1186
|
-
emitCheckBox:
|
|
1187
|
-
emitAdvCheckBox:
|
|
1194
|
+
isAdvCheckBox: Z,
|
|
1195
|
+
addTitleClassName: b,
|
|
1196
|
+
createPortalObj: S,
|
|
1197
|
+
telegramClickHandler: F = () => null,
|
|
1198
|
+
blurHandler: V,
|
|
1199
|
+
handlerButton: H,
|
|
1200
|
+
block_name: z,
|
|
1201
|
+
emitCheckBox: se,
|
|
1202
|
+
emitAdvCheckBox: $
|
|
1188
1203
|
}) => {
|
|
1189
1204
|
const {
|
|
1190
1205
|
register: G,
|
|
1191
|
-
handleSubmit:
|
|
1192
|
-
reset:
|
|
1193
|
-
control:
|
|
1194
|
-
watch:
|
|
1195
|
-
formState: { errors:
|
|
1196
|
-
} =
|
|
1197
|
-
|
|
1198
|
-
typeof Y < "u" &&
|
|
1199
|
-
}, [
|
|
1200
|
-
typeof oe < "u" &&
|
|
1201
|
-
}, [
|
|
1202
|
-
const { isMobile: ue, currentClientWidth: ye } = Ut(), Fe =
|
|
1203
|
-
|
|
1204
|
-
}, _e = (
|
|
1205
|
-
|
|
1206
|
-
e:
|
|
1207
|
-
analyticParams: { action_element: ve, action_element_status: ge, block_name:
|
|
1206
|
+
handleSubmit: ee,
|
|
1207
|
+
reset: k,
|
|
1208
|
+
control: p,
|
|
1209
|
+
watch: B,
|
|
1210
|
+
formState: { errors: A }
|
|
1211
|
+
} = kr(), W = !!B("email"), Y = B("personalCheckBox"), oe = B("advCheckBox");
|
|
1212
|
+
et(() => {
|
|
1213
|
+
typeof Y < "u" && se && se();
|
|
1214
|
+
}, [se, Y]), et(() => {
|
|
1215
|
+
typeof oe < "u" && $ && $();
|
|
1216
|
+
}, [$, oe]);
|
|
1217
|
+
const { isMobile: ue, currentClientWidth: ye } = Ut(), Fe = B("personalCheckBox"), Ee = B("advCheckBox"), pe = (te) => {
|
|
1218
|
+
X(te), k();
|
|
1219
|
+
}, _e = (te, { action_element_status: ge, action_element: ve }) => {
|
|
1220
|
+
V && V({
|
|
1221
|
+
e: te,
|
|
1222
|
+
analyticParams: { action_element: ve, action_element_status: ge, block_name: z }
|
|
1208
1223
|
});
|
|
1209
1224
|
};
|
|
1210
|
-
return ye ? /* @__PURE__ */
|
|
1225
|
+
return ye ? /* @__PURE__ */ O(
|
|
1211
1226
|
Pt,
|
|
1212
1227
|
{
|
|
1213
1228
|
additionalClass: I.modal,
|
|
1214
1229
|
additionalClassModalBody: I.modalBody,
|
|
1215
|
-
createPortalObj:
|
|
1230
|
+
createPortalObj: S,
|
|
1216
1231
|
isOpen: e,
|
|
1217
1232
|
isTransparentBack: !0,
|
|
1218
1233
|
emitIsOpen: () => s(!1),
|
|
1219
1234
|
opacity: 0.7,
|
|
1220
|
-
children: /* @__PURE__ */
|
|
1235
|
+
children: /* @__PURE__ */ de(
|
|
1221
1236
|
"div",
|
|
1222
1237
|
{
|
|
1223
1238
|
className: I.root,
|
|
1224
1239
|
style: { width: ue ? "100%" : q },
|
|
1225
1240
|
"data-testid": "modal_window",
|
|
1226
1241
|
children: [
|
|
1227
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ O(
|
|
1228
1243
|
"div",
|
|
1229
1244
|
{
|
|
1230
|
-
className:
|
|
1231
|
-
dangerouslySetInnerHTML: { __html:
|
|
1245
|
+
className: xr(I.title, b),
|
|
1246
|
+
dangerouslySetInnerHTML: { __html: i ?? "Оставить обращение" }
|
|
1232
1247
|
}
|
|
1233
1248
|
),
|
|
1234
|
-
t && /* @__PURE__ */
|
|
1235
|
-
/* @__PURE__ */
|
|
1249
|
+
t && /* @__PURE__ */ de("div", { className: I.telegramWrapper, children: [
|
|
1250
|
+
/* @__PURE__ */ O(
|
|
1236
1251
|
"a",
|
|
1237
1252
|
{
|
|
1238
1253
|
className: I.telegramLink,
|
|
1239
|
-
href:
|
|
1254
|
+
href: d,
|
|
1240
1255
|
target: "_blank",
|
|
1241
1256
|
"data-testid": "modal_telegram_link",
|
|
1242
|
-
children: /* @__PURE__ */
|
|
1257
|
+
children: /* @__PURE__ */ de(
|
|
1243
1258
|
"div",
|
|
1244
1259
|
{
|
|
1245
1260
|
className: I.telegram,
|
|
1246
|
-
onClick:
|
|
1261
|
+
onClick: F,
|
|
1247
1262
|
children: [
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1263
|
+
/* @__PURE__ */ O("div", { children: "Подписаться в Telegram" }),
|
|
1264
|
+
/* @__PURE__ */ O(tt, { name: "telegram" })
|
|
1250
1265
|
]
|
|
1251
1266
|
}
|
|
1252
1267
|
)
|
|
1253
1268
|
}
|
|
1254
1269
|
),
|
|
1255
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ O("div", { className: I.orText, children: "или" })
|
|
1256
1271
|
] }),
|
|
1257
|
-
!t && /* @__PURE__ */
|
|
1272
|
+
!t && /* @__PURE__ */ O(
|
|
1258
1273
|
"div",
|
|
1259
1274
|
{
|
|
1260
1275
|
className: I.description,
|
|
1261
1276
|
dangerouslySetInnerHTML: {
|
|
1262
|
-
__html:
|
|
1277
|
+
__html: _ && !t ? "Оставьте номер телефона для получения консультации" : `${/* @__PURE__ */ O("div", { children: "привет" })}`
|
|
1263
1278
|
}
|
|
1264
1279
|
}
|
|
1265
1280
|
),
|
|
1266
|
-
/* @__PURE__ */
|
|
1267
|
-
/* @__PURE__ */
|
|
1268
|
-
/* @__PURE__ */
|
|
1269
|
-
|
|
1281
|
+
/* @__PURE__ */ de("form", { onSubmit: ee(pe), children: [
|
|
1282
|
+
/* @__PURE__ */ de(It, { className: I.inputWrapper, children: [
|
|
1283
|
+
/* @__PURE__ */ O(
|
|
1284
|
+
Me,
|
|
1270
1285
|
{
|
|
1271
1286
|
width: "full",
|
|
1272
1287
|
size_s: "large",
|
|
1273
1288
|
variant: "light",
|
|
1274
1289
|
placeholder: "Введите имя",
|
|
1275
1290
|
"data-testid": "modal_name",
|
|
1276
|
-
...G("name", { required: !0, pattern:
|
|
1277
|
-
onBlur: (
|
|
1278
|
-
action_element_status:
|
|
1279
|
-
action_element: `input_${
|
|
1291
|
+
...G("name", { required: !0, pattern: Rt }),
|
|
1292
|
+
onBlur: (te) => _e(te, {
|
|
1293
|
+
action_element_status: A.name ? "error" : "success",
|
|
1294
|
+
action_element: `input_${z}_name`
|
|
1280
1295
|
}),
|
|
1281
|
-
error: !!
|
|
1296
|
+
error: !!A.name
|
|
1282
1297
|
}
|
|
1283
1298
|
),
|
|
1284
|
-
l && /* @__PURE__ */
|
|
1299
|
+
l && /* @__PURE__ */ O(
|
|
1285
1300
|
ar,
|
|
1286
1301
|
{
|
|
1287
1302
|
name: "phone",
|
|
1288
|
-
control:
|
|
1303
|
+
control: p,
|
|
1289
1304
|
rules: {
|
|
1290
|
-
required:
|
|
1291
|
-
pattern: { value:
|
|
1305
|
+
required: C || D || g && !W,
|
|
1306
|
+
pattern: { value: Lt, message: "" }
|
|
1292
1307
|
},
|
|
1293
1308
|
defaultValue: "",
|
|
1294
|
-
render: ({ field:
|
|
1295
|
-
|
|
1309
|
+
render: ({ field: te }) => /* @__PURE__ */ O(
|
|
1310
|
+
Me,
|
|
1296
1311
|
{
|
|
1297
1312
|
inputMode: "numeric",
|
|
1298
1313
|
isPhoneIMask: !0,
|
|
1299
|
-
...
|
|
1314
|
+
...te,
|
|
1300
1315
|
width: "full",
|
|
1301
1316
|
"data-testid": "phone_modal",
|
|
1302
1317
|
type: "tel",
|
|
1303
|
-
error: !!
|
|
1318
|
+
error: !!A.phone,
|
|
1304
1319
|
size_s: "large",
|
|
1305
1320
|
variant: "light",
|
|
1306
1321
|
onBlur: (ge) => _e(ge, {
|
|
1307
|
-
action_element_status:
|
|
1308
|
-
action_element: `input_${
|
|
1322
|
+
action_element_status: A.phone ? "error" : "success",
|
|
1323
|
+
action_element: `input_${z}_phone`
|
|
1309
1324
|
})
|
|
1310
1325
|
}
|
|
1311
1326
|
)
|
|
1312
1327
|
}
|
|
1313
1328
|
),
|
|
1314
|
-
o && /* @__PURE__ */
|
|
1315
|
-
|
|
1329
|
+
o && /* @__PURE__ */ O(
|
|
1330
|
+
Me,
|
|
1316
1331
|
{
|
|
1317
1332
|
width: "full",
|
|
1318
1333
|
size_s: "large",
|
|
@@ -1320,48 +1335,48 @@ const kr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1320
1335
|
placeholder: "Введите email",
|
|
1321
1336
|
"data-testid": "modal_email",
|
|
1322
1337
|
...G("email", {
|
|
1323
|
-
required:
|
|
1324
|
-
pattern:
|
|
1338
|
+
required: C || g && !W,
|
|
1339
|
+
pattern: Mt
|
|
1325
1340
|
}),
|
|
1326
|
-
error: !!
|
|
1327
|
-
onBlur: (
|
|
1328
|
-
action_element_status:
|
|
1329
|
-
action_element: `input_${
|
|
1341
|
+
error: !!A.email,
|
|
1342
|
+
onBlur: (te) => _e(te, {
|
|
1343
|
+
action_element_status: A.email ? "error" : "success",
|
|
1344
|
+
action_element: `input_${z}_email`
|
|
1330
1345
|
})
|
|
1331
1346
|
}
|
|
1332
1347
|
),
|
|
1333
|
-
|
|
1348
|
+
c && /* @__PURE__ */ O(
|
|
1334
1349
|
Ot,
|
|
1335
1350
|
{
|
|
1336
1351
|
"data-testid": "modal_textarea",
|
|
1337
1352
|
placeholder: x,
|
|
1338
|
-
rows:
|
|
1353
|
+
rows: E,
|
|
1339
1354
|
width: "full",
|
|
1340
1355
|
...G("textarea")
|
|
1341
1356
|
}
|
|
1342
1357
|
),
|
|
1343
|
-
M && !t &&
|
|
1344
|
-
|
|
1358
|
+
M && !t && Z && /* @__PURE__ */ O(
|
|
1359
|
+
rt,
|
|
1345
1360
|
{
|
|
1346
1361
|
"data-testid": "modal_advCheckBox",
|
|
1347
1362
|
isChecked: Ee,
|
|
1348
|
-
error: !!
|
|
1363
|
+
error: !!A.advCheckBox,
|
|
1349
1364
|
text: M.text,
|
|
1350
1365
|
...G("advCheckBox", { required: M?.isRequired })
|
|
1351
1366
|
}
|
|
1352
1367
|
),
|
|
1353
|
-
/* @__PURE__ */
|
|
1354
|
-
|
|
1368
|
+
/* @__PURE__ */ de(
|
|
1369
|
+
rt,
|
|
1355
1370
|
{
|
|
1356
1371
|
"data-testid": "modal_personalCheckBox",
|
|
1357
1372
|
isChecked: Fe,
|
|
1358
|
-
error: !!
|
|
1373
|
+
error: !!A.personalCheckBox,
|
|
1359
1374
|
...G("personalCheckBox", { required: !t }),
|
|
1360
1375
|
children: [
|
|
1361
|
-
t && /* @__PURE__ */
|
|
1376
|
+
t && /* @__PURE__ */ de("div", { className: I.checkboxText, children: [
|
|
1362
1377
|
"Согласен(-на)",
|
|
1363
1378
|
" ",
|
|
1364
|
-
/* @__PURE__ */
|
|
1379
|
+
/* @__PURE__ */ O(
|
|
1365
1380
|
"a",
|
|
1366
1381
|
{
|
|
1367
1382
|
className: I.linkPolicy,
|
|
@@ -1372,19 +1387,19 @@ const kr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1372
1387
|
" ",
|
|
1373
1388
|
"от Stone"
|
|
1374
1389
|
] }),
|
|
1375
|
-
!t && /* @__PURE__ */
|
|
1390
|
+
!t && /* @__PURE__ */ de("div", { className: I.checkboxText, children: [
|
|
1376
1391
|
"Я принимаю условия",
|
|
1377
1392
|
" ",
|
|
1378
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ O("a", { className: I.linkPolicy, href: "/documents/politika-konfidenczialnosti", children: "Политики обработки и защиты персональных данных" }),
|
|
1379
1394
|
", даю",
|
|
1380
1395
|
" ",
|
|
1381
|
-
/* @__PURE__ */
|
|
1396
|
+
/* @__PURE__ */ O("a", { className: I.linkPolicy, href: "/documents/docs", children: "согласие на обработку персональных данных" })
|
|
1382
1397
|
] })
|
|
1383
1398
|
]
|
|
1384
1399
|
}
|
|
1385
1400
|
),
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
|
|
1401
|
+
/* @__PURE__ */ O(
|
|
1402
|
+
st,
|
|
1388
1403
|
{
|
|
1389
1404
|
"data-testid": "modal_submit",
|
|
1390
1405
|
variant: "blue",
|
|
@@ -1394,15 +1409,15 @@ const kr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1394
1409
|
as: "button",
|
|
1395
1410
|
additionalClass: I.modalBtn,
|
|
1396
1411
|
onClick: () => {
|
|
1397
|
-
|
|
1412
|
+
H && H();
|
|
1398
1413
|
},
|
|
1399
|
-
disabled: !!
|
|
1414
|
+
disabled: !!A.name || !!A.phone && D || !!A.email && C || !!A.advCheckBox && M?.isRequired || !!A.personalCheckBox && !t,
|
|
1400
1415
|
children: "Отправить запрос"
|
|
1401
1416
|
}
|
|
1402
1417
|
)
|
|
1403
1418
|
] }),
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
|
|
1419
|
+
/* @__PURE__ */ O(
|
|
1420
|
+
st,
|
|
1406
1421
|
{
|
|
1407
1422
|
additionalClass: I.btn,
|
|
1408
1423
|
onClick: () => s(!1),
|
|
@@ -1410,8 +1425,8 @@ const kr = Nt.bind(I), Fr = "Я принимаю условия Политики
|
|
|
1410
1425
|
variant: "gray",
|
|
1411
1426
|
type: "button",
|
|
1412
1427
|
size: "small",
|
|
1413
|
-
children: /* @__PURE__ */
|
|
1414
|
-
|
|
1428
|
+
children: /* @__PURE__ */ O(
|
|
1429
|
+
tt,
|
|
1415
1430
|
{
|
|
1416
1431
|
name: "close",
|
|
1417
1432
|
size: "16",
|