stone-kit 0.0.372 → 0.0.373

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