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