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