@scbt-ecom/ui 0.71.1 → 0.71.3

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.
Files changed (25) hide show
  1. package/dist/hooks.js +2 -2
  2. package/dist/{index-Cgp0l1lv.js → index-cFFEEZ33.js} +8261 -8252
  3. package/dist/index-cFFEEZ33.js.map +1 -0
  4. package/dist/shared/ui/formElements/controlled/index.d.ts +1 -1
  5. package/dist/shared/ui/formElements/controlled/slider/SliderControl.d.ts +3 -4
  6. package/dist/shared/ui/formElements/uncontrolled/index.d.ts +1 -3
  7. package/dist/shared/ui/formElements/uncontrolled/slider/SliderBase.d.ts +2 -4
  8. package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/currency/getFormattedCurrency.d.ts +1 -0
  9. package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/currency/index.d.ts +1 -0
  10. package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/getInputSliderSuffix.d.ts +1 -1
  11. package/dist/shared/ui/formElements/uncontrolled/slider/model/helpers/index.d.ts +1 -0
  12. package/dist/shared/ui/formElements/uncontrolled/slider/model/types.d.ts +3 -11
  13. package/dist/shared/ui/formElements/uncontrolled/slider/ui/sliderAlgorithmic/SliderAlgorithmic.d.ts +1 -1
  14. package/dist/ui.js +3 -3
  15. package/dist/{useDebounce-MaKPBuaC.js → useDebounce-B__kmLt7.js} +86 -81
  16. package/dist/useDebounce-B__kmLt7.js.map +1 -0
  17. package/dist/{useFieldsProgress-CeEaFp3Q.js → useFieldsProgress-BtrWDMY2.js} +2 -2
  18. package/dist/{useFieldsProgress-CeEaFp3Q.js.map → useFieldsProgress-BtrWDMY2.js.map} +1 -1
  19. package/dist/widget.js +1047 -1048
  20. package/dist/widget.js.map +1 -1
  21. package/dist/widgets/calculator/model/utils.d.ts +2 -2
  22. package/dist/widgets/calculator/ui/calculatorInfo/ui/CalculatorInfoFooter.d.ts +3 -8
  23. package/package.json +1 -1
  24. package/dist/index-Cgp0l1lv.js.map +0 -1
  25. package/dist/useDebounce-MaKPBuaC.js.map +0 -1
@@ -28,7 +28,7 @@ export declare const Controlled: {
28
28
  DadataCountry: <TFieldValues extends import('react-hook-form').FieldValues>({ formatter, dadataBaseUrl, ...props }: import('./dadata').DadataCountryProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
29
29
  DadataAuto: <TFieldValues extends import('react-hook-form').FieldValues>({ formatter, dadataBaseUrl, ...props }: import('./dadata').DadataAutoProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
30
30
  DadataOrganization: <TFieldValues extends import('react-hook-form').FieldValues>({ formatter, dadataBaseUrl, ...props }: import('./dadata').DadataOrganizationProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
31
- SliderControl: <TFieldValues extends import('react-hook-form').FieldValues, TName extends import('react-hook-form').Path<TFieldValues>, Type extends import('../uncontrolled/slider/model/types').ComponentType>(props: import('./slider').SliderControlProps<TFieldValues, TName, Type>) => import("react/jsx-runtime").JSX.Element;
31
+ SliderControl: <TFieldValues extends import('react-hook-form').FieldValues, TName extends import('react-hook-form').Path<TFieldValues>>(props: import('./slider').SliderControlProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
32
32
  TextareaControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ classes, control, name, rules, disabled, defaultValue, shouldUnregister, helperText, ...props }: import('./textarea').TextareaControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
33
33
  UploaderControl: <TFieldValues extends import('react-hook-form').FieldValues>({ control, name, defaultValue, rules, shouldUnregister, classes, helperText, disabled, ...props }: import('./uploader').UploaderControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
34
34
  InputOtpControl: <TFieldValues extends import('react-hook-form').FieldValues = import('react-hook-form').FieldValues>({ control, name, defaultValue, disabled, rules, shouldUnregister, classes, helperText, ...props }: import('./inputOtp').InputOtpControlProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,11 @@
1
1
  import { Control, FieldValues, Path, UseControllerProps } from 'react-hook-form';
2
- import { ComponentType, SliderBaseClasses, SliderGatewayProps } from '../../uncontrolled/slider/model/types';
2
+ import { SliderBaseClasses, SliderGatewayProps } from '../../uncontrolled/slider/model/types';
3
3
  type SliderControlClasses = SliderBaseClasses & {
4
4
  container?: string;
5
5
  };
6
- export type SliderControlProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>, Type extends ComponentType> = UseControllerProps<TFieldValues, TName> & {
6
+ export type SliderControlProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = UseControllerProps<TFieldValues, TName> & SliderGatewayProps & {
7
7
  control: Control<TFieldValues>;
8
8
  classes?: SliderControlClasses;
9
- sliderProps: SliderGatewayProps<Type>;
10
9
  };
11
- export declare const SliderControl: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>, Type extends ComponentType>(props: SliderControlProps<TFieldValues, TName, Type>) => import("react/jsx-runtime").JSX.Element;
10
+ export declare const SliderControl: <TFieldValues extends FieldValues, TName extends Path<TFieldValues>>(props: SliderControlProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
12
11
  export {};
@@ -23,9 +23,7 @@ export declare const Uncontrolled: {
23
23
  onBlur?: (event: React.FocusEvent<HTMLDivElement>) => void;
24
24
  };
25
25
  } & import('react').RefAttributes<HTMLInputElement>>;
26
- SliderBase: <Type extends import('./slider/model/types').ComponentType>(props: import('./slider/model/types').SliderGatewayProps<Type> & {
27
- ref?: React.Ref<HTMLInputElement>;
28
- }) => React.ReactElement;
26
+ SliderBase: import('react').ForwardRefExoticComponent<import('./slider/model/types').SliderGatewayProps & import('react').RefAttributes<HTMLInputElement>>;
29
27
  AutocompleteBase: <TData>(props: import('./autocomplete').AutocompleteBaseProps<TData> & {
30
28
  ref: React.Ref<HTMLInputElement>;
31
29
  }) => React.JSX.Element;
@@ -1,4 +1,2 @@
1
- import { ComponentType, SliderGatewayProps } from './model/types';
2
- export declare const SliderBase: <Type extends ComponentType>(props: SliderGatewayProps<Type> & {
3
- ref?: React.Ref<HTMLInputElement>;
4
- }) => React.ReactElement;
1
+ import { SliderGatewayProps } from './model/types';
2
+ export declare const SliderBase: import('react').ForwardRefExoticComponent<SliderGatewayProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -0,0 +1 @@
1
+ export declare const getFormattedCurrency: (value: number) => string;
@@ -0,0 +1 @@
1
+ export { getFormattedCurrency } from './getFormattedCurrency';
@@ -1,2 +1,2 @@
1
1
  import { TSuffixVariants } from '../types';
2
- export declare const getInputSliderSuffix: (suffix: TSuffixVariants, value?: number) => string;
2
+ export declare const getInputSliderSuffix: (suffix: TSuffixVariants, value?: number, input?: boolean) => string;
@@ -1,2 +1,3 @@
1
1
  export { formatNumber } from './formatNumber';
2
2
  export { getInputSliderSuffix } from './getInputSliderSuffix';
3
+ export { getFormattedCurrency } from './currency';
@@ -19,20 +19,12 @@ export type SliderBaseClasses = {
19
19
  slider?: SliderClasses;
20
20
  inputRoot?: InputBaseClasses;
21
21
  };
22
- export type ComponentType = 'marks' | 'step' | 'algoritmic';
22
+ export type ComponentType = 'marks' | 'step' | 'algorithmic';
23
23
  export interface SliderCommonProps extends Omit<InputBaseProps, 'externalHandlers' | 'onChange' | 'value' | 'defaultValue' | 'type'> {
24
24
  /**
25
25
  * Объект classes с помощью которого можно поменять стили у компонента
26
26
  */
27
27
  classes?: SliderBaseClasses;
28
- /**
29
- * Левый текст под слайдером
30
- */
31
- leftText: string | React.ReactElement;
32
- /**
33
- * Правый текст под слайдером
34
- */
35
- rightText: string | React.ReactElement;
36
28
  /**
37
29
  * Значение
38
30
  */
@@ -90,7 +82,7 @@ export type SliderStepProps = SliderCommonProps & {
90
82
  max: number;
91
83
  };
92
84
  export type SliderAlgorithmicProps = SliderCommonProps & {
93
- componentType: 'algoritmic';
85
+ componentType: 'algorithmic';
94
86
  /**
95
87
  * Минимальное значение инпута
96
88
  */
@@ -100,4 +92,4 @@ export type SliderAlgorithmicProps = SliderCommonProps & {
100
92
  */
101
93
  max: number;
102
94
  };
103
- export type SliderGatewayProps<Type extends ComponentType> = Type extends 'marks' ? SliderMarksProps : Type extends 'algoritmic' ? SliderAlgorithmicProps : SliderStepProps;
95
+ export type SliderGatewayProps = SliderAlgorithmicProps | SliderStepProps | SliderMarksProps;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export declare const SliderAlgorithmic: React.ForwardRefExoticComponent<import('../../model/types').SliderCommonProps & {
3
- componentType: "algoritmic";
3
+ componentType: "algorithmic";
4
4
  min: number;
5
5
  max: number;
6
6
  } & React.RefAttributes<HTMLInputElement>>;
package/dist/ui.js CHANGED
@@ -1,10 +1,10 @@
1
- import { j as w, c as On, R as An, B as de, u as Nn, a as Tn, b as jn, d as Hn, P as Be, e as Wt, f as Gn, I as zn, g as Ze, h as Bn, A as kn, i as be, H as qn, D as Un, V as Kn, O as Xn } from "./index-Cgp0l1lv.js";
2
- import { o as xi, C as yi, v as Fi, t as _i, p as Ii, K as Mi, L as Vi, M as bi, N as Pi, n as $i, q as Ei, r as Di, U as Li, s as Oi, k as Ai, m as Ni, l as Ti, w as ji } from "./index-Cgp0l1lv.js";
1
+ import { j as w, c as On, R as An, B as de, u as Nn, a as Tn, b as jn, d as Hn, P as Be, e as Wt, f as Gn, I as zn, g as Ze, h as Bn, A as kn, i as be, H as qn, D as Un, V as Kn, O as Xn } from "./index-cFFEEZ33.js";
2
+ import { o as xi, C as yi, v as Fi, t as _i, p as Ii, K as Mi, L as Vi, M as bi, N as Pi, n as $i, q as Ei, r as Di, U as Li, s as Oi, k as Ai, m as Ni, l as Ti, w as ji } from "./index-cFFEEZ33.js";
3
3
  import * as ae from "react";
4
4
  import { forwardRef as Q, useState as Se, useCallback as he, useEffect as ve, useRef as At, isValidElement as je, cloneElement as Qt, Children as Ie } from "react";
5
5
  import { c as F, T as Nt } from "./typeGuards-CSiImkUY.js";
6
6
  import { D as Gi, d as zi, f as Bi, b as ki, a as qi } from "./utils-k3uzuyeN.js";
7
- import { u as ke } from "./useDebounce-MaKPBuaC.js";
7
+ import { u as ke } from "./useDebounce-B__kmLt7.js";
8
8
  import { m as Wn } from "./mergeRefs-qDToYXtM.js";
9
9
  const Qn = On(
10
10
  "group flex items-center justify-center cursor-pointer rounded-full outline-offset-[3px] outline-transparent outline-2 transition duration-12 active:scale-[0.97] disabled:pointer-events-none",
@@ -35,9 +35,9 @@ const Ge = () => !1, or = () => {
35
35
  };
36
36
  }, [e, r]);
37
37
  };
38
- var ye = (e) => e.type === "checkbox", se = (e) => e instanceof Date, B = (e) => e == null;
38
+ var ye = (e) => e.type === "checkbox", se = (e) => e instanceof Date, p = (e) => e == null;
39
39
  const lt = (e) => typeof e == "object";
40
- var C = (e) => !B(e) && !Array.isArray(e) && lt(e) && !se(e), ut = (e) => C(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ct = (e, r) => e.has(Rt(r)), Ut = (e) => {
40
+ var C = (e) => !p(e) && !Array.isArray(e) && lt(e) && !se(e), ut = (e) => C(e) && e.target ? ye(e.target) ? e.target.checked : e.target.value : e, Rt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, ct = (e, r) => e.has(Rt(r)), Ut = (e) => {
41
41
  const r = e.constructor && e.constructor.prototype;
42
42
  return C(r) && r.hasOwnProperty("isPrototypeOf");
43
43
  }, Ce = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
@@ -61,9 +61,9 @@ function R(e) {
61
61
  var Ve = (e) => Array.isArray(e) ? e.filter(Boolean) : [], k = (e) => e === void 0, y = (e, r, t) => {
62
62
  if (!r || !C(e))
63
63
  return t;
64
- const i = Ve(r.split(/[,[\].]+?/)).reduce((a, o) => B(a) ? a : a[o], e);
64
+ const i = Ve(r.split(/[,[\].]+?/)).reduce((a, o) => p(a) ? a : a[o], e);
65
65
  return k(i) || i === e ? k(e[r]) ? t : e[r] : i;
66
- }, W = (e) => typeof e == "boolean", Te = (e) => /^\w*$/.test(e), dt = (e) => Ve(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, r, t) => {
66
+ }, q = (e) => typeof e == "boolean", Te = (e) => /^\w*$/.test(e), dt = (e) => Ve(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, r, t) => {
67
67
  let i = -1;
68
68
  const a = Te(r) ? [r] : dt(r), o = a.length, u = o - 1;
69
69
  for (; ++i < o; ) {
@@ -164,7 +164,7 @@ function cr(e) {
164
164
  }), D = w.useRef(e), F = w.useRef(a.register(t, {
165
165
  ...e.rules,
166
166
  value: d,
167
- ...W(e.disabled) ? { disabled: e.disabled } : {}
167
+ ...q(e.disabled) ? { disabled: e.disabled } : {}
168
168
  })), E = w.useMemo(() => Object.defineProperties({}, {
169
169
  invalid: {
170
170
  enumerable: !0,
@@ -186,9 +186,9 @@ function cr(e) {
186
186
  enumerable: !0,
187
187
  get: () => y(b.errors, t)
188
188
  }
189
- }), [b, t]), m = w.useCallback((q) => F.current.onChange({
189
+ }), [b, t]), m = w.useCallback((N) => F.current.onChange({
190
190
  target: {
191
- value: ut(q),
191
+ value: ut(N),
192
192
  name: t
193
193
  },
194
194
  type: ve.CHANGE
@@ -198,33 +198,38 @@ function cr(e) {
198
198
  name: t
199
199
  },
200
200
  type: ve.BLUR
201
- }), [t, a._formValues]), j = w.useCallback((q) => {
202
- const N = y(a._fields, t);
203
- N && q && (N._f.ref = q);
201
+ }), [t, a._formValues]), j = w.useCallback((N) => {
202
+ const P = y(a._fields, t);
203
+ P && N && (P._f.ref = {
204
+ focus: () => N.focus(),
205
+ select: () => N.select(),
206
+ setCustomValidity: (v) => N.setCustomValidity(v),
207
+ reportValidity: () => N.reportValidity()
208
+ });
204
209
  }, [a._fields, t]), O = w.useMemo(() => ({
205
210
  name: t,
206
211
  value: d,
207
- ...W(i) || b.disabled ? { disabled: b.disabled || i } : {},
212
+ ...q(i) || b.disabled ? { disabled: b.disabled || i } : {},
208
213
  onChange: m,
209
214
  onBlur: te,
210
215
  ref: j
211
216
  }), [t, i, b.disabled, m, te, j, d]);
212
217
  return w.useEffect(() => {
213
- const q = a._options.shouldUnregister || o;
218
+ const N = a._options.shouldUnregister || o;
214
219
  a.register(t, {
215
220
  ...D.current.rules,
216
- ...W(D.current.disabled) ? { disabled: D.current.disabled } : {}
221
+ ...q(D.current.disabled) ? { disabled: D.current.disabled } : {}
217
222
  });
218
- const N = (v, K) => {
219
- const p = y(a._fields, v);
220
- p && p._f && (p._f.mount = K);
223
+ const P = (v, K) => {
224
+ const W = y(a._fields, v);
225
+ W && W._f && (W._f.mount = K);
221
226
  };
222
- if (N(t, !0), q) {
227
+ if (P(t, !0), N) {
223
228
  const v = R(y(a._options.defaultValues, t));
224
229
  x(a._defaultValues, t, v), k(y(a._formValues, t)) && x(a._formValues, t, v);
225
230
  }
226
231
  return !u && a.register(t), () => {
227
- (u ? q && !a._state.action : q) ? a.unregister(t) : N(t, !1);
232
+ (u ? N && !a._state.action : N) ? a.unregister(t) : P(t, !1);
228
233
  };
229
234
  }, [t, a, u, o]), w.useEffect(() => {
230
235
  a._setDisabledField({
@@ -262,7 +267,7 @@ var gt = (e, r, t, i, a) => r ? {
262
267
  e = [];
263
268
  }
264
269
  };
265
- }, ke = (e) => B(e) || !lt(e);
270
+ }, ke = (e) => p(e) || !lt(e);
266
271
  function ee(e, r) {
267
272
  if (ke(e) || ke(r))
268
273
  return e === r;
@@ -283,28 +288,28 @@ function ee(e, r) {
283
288
  }
284
289
  return !0;
285
290
  }
286
- var P = (e) => C(e) && !Object.keys(e).length, Oe = (e) => e.type === "file", $ = (e) => typeof e == "function", be = (e) => {
291
+ var B = (e) => C(e) && !Object.keys(e).length, Oe = (e) => e.type === "file", $ = (e) => typeof e == "function", be = (e) => {
287
292
  if (!Ce)
288
293
  return !1;
289
294
  const r = e ? e.ownerDocument : 0;
290
295
  return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
291
296
  }, vt = (e) => e.type === "select-multiple", Re = (e) => e.type === "radio", Bt = (e) => Re(e) || ye(e), Se = (e) => be(e) && e.isConnected;
292
- function It(e, r) {
297
+ function pt(e, r) {
293
298
  const t = r.slice(0, -1).length;
294
299
  let i = 0;
295
300
  for (; i < t; )
296
301
  e = k(e) ? i++ : e[r[i++]];
297
302
  return e;
298
303
  }
299
- function pt(e) {
304
+ function It(e) {
300
305
  for (const r in e)
301
306
  if (e.hasOwnProperty(r) && !k(e[r]))
302
307
  return !1;
303
308
  return !0;
304
309
  }
305
310
  function M(e, r) {
306
- const t = Array.isArray(r) ? r : Te(r) ? [r] : dt(r), i = t.length === 1 ? e : It(e, t), a = t.length - 1, o = t[a];
307
- return i && delete i[o], a !== 0 && (C(i) && P(i) || Array.isArray(i) && pt(i)) && M(e, t.slice(0, -1)), e;
311
+ const t = Array.isArray(r) ? r : Te(r) ? [r] : dt(r), i = t.length === 1 ? e : pt(e, t), a = t.length - 1, o = t[a];
312
+ return i && delete i[o], a !== 0 && (C(i) && B(i) || Array.isArray(i) && It(i)) && M(e, t.slice(0, -1)), e;
308
313
  }
309
314
  var bt = (e) => {
310
315
  for (const r in e)
@@ -316,14 +321,14 @@ function me(e, r = {}) {
316
321
  const t = Array.isArray(e);
317
322
  if (C(e) || t)
318
323
  for (const i in e)
319
- Array.isArray(e[i]) || C(e[i]) && !bt(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, me(e[i], r[i])) : B(e[i]) || (r[i] = !0);
324
+ Array.isArray(e[i]) || C(e[i]) && !bt(e[i]) ? (r[i] = Array.isArray(e[i]) ? [] : {}, me(e[i], r[i])) : p(e[i]) || (r[i] = !0);
320
325
  return r;
321
326
  }
322
327
  function mt(e, r, t) {
323
328
  const i = Array.isArray(e);
324
329
  if (C(e) || i)
325
330
  for (const a in e)
326
- Array.isArray(e[a]) || C(e[a]) && !bt(e[a]) ? k(r) || ke(t[a]) ? t[a] = Array.isArray(e[a]) ? me(e[a], []) : { ...me(e[a]) } : mt(e[a], B(r) ? {} : r[a], t[a]) : t[a] = !ee(e[a], r[a]);
331
+ Array.isArray(e[a]) || C(e[a]) && !bt(e[a]) ? k(r) || ke(t[a]) ? t[a] = Array.isArray(e[a]) ? me(e[a], []) : { ...me(e[a]) } : mt(e[a], p(r) ? {} : r[a], t[a]) : t[a] = !ee(e[a], r[a]);
327
332
  return t;
328
333
  }
329
334
  var ue = (e, r) => mt(e, r, me(r));
@@ -420,13 +425,13 @@ function it(e, r, t) {
420
425
  var jt = (e, r, t, i) => {
421
426
  t(e);
422
427
  const { name: a, ...o } = e;
423
- return P(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((u) => r[u] === (!i || Q.all));
428
+ return B(o) || Object.keys(o).length >= Object.keys(r).length || Object.keys(o).find((u) => r[u] === (!i || Q.all));
424
429
  }, Kt = (e, r, t) => !e || !r || e === r || de(e).some((i) => i && (t ? i === r : i.startsWith(r) || r.startsWith(i))), Qt = (e, r, t, i, a) => a.isOnAll ? !1 : !t && a.isOnTouch ? !(r || e) : (t ? i.isOnBlur : a.isOnBlur) ? !e : (t ? i.isOnChange : a.isOnChange) ? e : !0, $t = (e, r) => !Ve(y(e, r)).length && M(e, r), zt = (e, r, t) => {
425
430
  const i = de(y(e, t));
426
431
  return x(i, "root", r[t]), x(e, t, i), e;
427
432
  }, ge = (e) => Y(e);
428
433
  function nt(e, r, t = "validate") {
429
- if (ge(e) || Array.isArray(e) && e.every(ge) || W(e) && !e)
434
+ if (ge(e) || Array.isArray(e) && e.every(ge) || q(e) && !e)
430
435
  return {
431
436
  type: t,
432
437
  message: ge(e) ? e : "",
@@ -437,12 +442,12 @@ var ne = (e) => C(e) && !_e(e) ? e : {
437
442
  value: e,
438
443
  message: ""
439
444
  }, at = async (e, r, t, i, a, o) => {
440
- const { ref: u, refs: d, required: b, maxLength: D, minLength: F, min: E, max: m, pattern: te, validate: j, name: O, valueAsNumber: q, mount: N } = e._f, v = y(t, O);
441
- if (!N || r.has(O))
445
+ const { ref: u, refs: d, required: b, maxLength: D, minLength: F, min: E, max: m, pattern: te, validate: j, name: O, valueAsNumber: N, mount: P } = e._f, v = y(t, O);
446
+ if (!P || r.has(O))
442
447
  return {};
443
- const K = d ? d[0] : u, p = (A) => {
444
- a && K.reportValidity && (K.setCustomValidity(W(A) ? "" : A || ""), K.reportValidity());
445
- }, L = {}, ae = Re(u), oe = ye(u), Fe = ae || oe, z = (q || Oe(u)) && k(u.value) && k(v) || be(u) && u.value === "" || v === "" || Array.isArray(v) && !v.length, re = gt.bind(null, O, i, L), J = (A, _, S, I = X.maxLength, H = X.minLength) => {
448
+ const K = d ? d[0] : u, W = (A) => {
449
+ a && K.reportValidity && (K.setCustomValidity(q(A) ? "" : A || ""), K.reportValidity());
450
+ }, L = {}, ae = Re(u), oe = ye(u), Fe = ae || oe, z = (N || Oe(u)) && k(u.value) && k(v) || be(u) && u.value === "" || v === "" || Array.isArray(v) && !v.length, re = gt.bind(null, O, i, L), J = (A, _, S, I = X.maxLength, H = X.minLength) => {
446
451
  const G = A ? _ : S;
447
452
  L[O] = {
448
453
  type: A ? I : H,
@@ -451,7 +456,7 @@ var ne = (e) => C(e) && !_e(e) ? e : {
451
456
  ...re(A ? I : H, G)
452
457
  };
453
458
  };
454
- if (o ? !Array.isArray(v) || !v.length : b && (!Fe && (z || B(v)) || W(v) && !v || oe && !_t(d).isValid || ae && !Ft(d).isValid)) {
459
+ if (o ? !Array.isArray(v) || !v.length : b && (!Fe && (z || p(v)) || q(v) && !v || oe && !_t(d).isValid || ae && !Ft(d).isValid)) {
455
460
  const { value: A, message: _ } = ge(b) ? { value: !!b, message: b } : ne(b);
456
461
  if (A && (L[O] = {
457
462
  type: X.required,
@@ -459,25 +464,25 @@ var ne = (e) => C(e) && !_e(e) ? e : {
459
464
  ref: K,
460
465
  ...re(X.required, _)
461
466
  }, !i))
462
- return p(_), L;
467
+ return W(_), L;
463
468
  }
464
- if (!z && (!B(E) || !B(m))) {
469
+ if (!z && (!p(E) || !p(m))) {
465
470
  let A, _;
466
471
  const S = ne(m), I = ne(E);
467
- if (!B(v) && !isNaN(v)) {
472
+ if (!p(v) && !isNaN(v)) {
468
473
  const H = u.valueAsNumber || v && +v;
469
- B(S.value) || (A = H > S.value), B(I.value) || (_ = H < I.value);
474
+ p(S.value) || (A = H > S.value), p(I.value) || (_ = H < I.value);
470
475
  } else {
471
476
  const H = u.valueAsDate || new Date(v), G = (he) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + he), Z = u.type == "time", le = u.type == "week";
472
477
  Y(S.value) && v && (A = Z ? G(v) > G(S.value) : le ? v > S.value : H > new Date(S.value)), Y(I.value) && v && (_ = Z ? G(v) < G(I.value) : le ? v < I.value : H < new Date(I.value));
473
478
  }
474
479
  if ((A || _) && (J(!!A, S.message, I.message, X.max, X.min), !i))
475
- return p(L[O].message), L;
480
+ return W(L[O].message), L;
476
481
  }
477
482
  if ((D || F) && !z && (Y(v) || o && Array.isArray(v))) {
478
- const A = ne(D), _ = ne(F), S = !B(A.value) && v.length > +A.value, I = !B(_.value) && v.length < +_.value;
483
+ const A = ne(D), _ = ne(F), S = !p(A.value) && v.length > +A.value, I = !p(_.value) && v.length < +_.value;
479
484
  if ((S || I) && (J(S, A.message, _.message), !i))
480
- return p(L[O].message), L;
485
+ return W(L[O].message), L;
481
486
  }
482
487
  if (te && !z && Y(v)) {
483
488
  const { value: A, message: _ } = ne(te);
@@ -487,7 +492,7 @@ var ne = (e) => C(e) && !_e(e) ? e : {
487
492
  ref: u,
488
493
  ...re(X.pattern, _)
489
494
  }, !i))
490
- return p(_), L;
495
+ return W(_), L;
491
496
  }
492
497
  if (j) {
493
498
  if ($(j)) {
@@ -496,26 +501,26 @@ var ne = (e) => C(e) && !_e(e) ? e : {
496
501
  ..._,
497
502
  ...re(X.validate, _.message)
498
503
  }, !i))
499
- return p(_.message), L;
504
+ return W(_.message), L;
500
505
  } else if (C(j)) {
501
506
  let A = {};
502
507
  for (const _ in j) {
503
- if (!P(A) && !i)
508
+ if (!B(A) && !i)
504
509
  break;
505
510
  const S = nt(await j[_](v, t), K, _);
506
511
  S && (A = {
507
512
  ...S,
508
513
  ...re(_, S.message)
509
- }, p(S.message), i && (L[O] = A));
514
+ }, W(S.message), i && (L[O] = A));
510
515
  }
511
- if (!P(A) && (L[O] = {
516
+ if (!B(A) && (L[O] = {
512
517
  ref: K,
513
518
  ...A
514
519
  }, !i))
515
520
  return L;
516
521
  }
517
522
  }
518
- return p(!0), L;
523
+ return W(!0), L;
519
524
  };
520
525
  const Gt = {
521
526
  mode: Q.onSubmit,
@@ -569,11 +574,11 @@ function Yt(e = {}) {
569
574
  const m = {
570
575
  array: Ye(),
571
576
  state: Ye()
572
- }, te = tt(r.mode), j = tt(r.reValidateMode), O = r.criteriaMode === Q.all, q = (s) => (n) => {
577
+ }, te = tt(r.mode), j = tt(r.reValidateMode), O = r.criteriaMode === Q.all, N = (s) => (n) => {
573
578
  clearTimeout(D), D = setTimeout(s, n);
574
- }, N = async (s) => {
579
+ }, P = async (s) => {
575
580
  if (!r.disabled && (F.isValid || E.isValid || s)) {
576
- const n = r.resolver ? P((await z()).errors) : await J(i, !0);
581
+ const n = r.resolver ? B((await z()).errors) : await J(i, !0);
577
582
  n !== t.isValid && m.state.next({
578
583
  isValid: n
579
584
  });
@@ -583,7 +588,7 @@ function Yt(e = {}) {
583
588
  l && (n ? x(t.validatingFields, l, n) : M(t.validatingFields, l));
584
589
  }), m.state.next({
585
590
  validatingFields: t.validatingFields,
586
- isValidating: !P(t.validatingFields)
591
+ isValidating: !B(t.validatingFields)
587
592
  }));
588
593
  }, K = (s, n = [], l, h, f = !0, c = !0) => {
589
594
  if (h && l && !r.disabled) {
@@ -608,7 +613,7 @@ function Yt(e = {}) {
608
613
  });
609
614
  } else
610
615
  x(o, s, n);
611
- }, p = (s, n) => {
616
+ }, W = (s, n) => {
612
617
  x(t.errors, s, n), m.state.next({
613
618
  errors: t.errors
614
619
  });
@@ -621,7 +626,7 @@ function Yt(e = {}) {
621
626
  const f = y(i, s);
622
627
  if (f) {
623
628
  const c = y(o, s, k(l) ? y(a, s) : l);
624
- k(c) || h && h.defaultChecked || n ? x(o, s, n ? c : et(f._f)) : H(s, c), u.mount && N();
629
+ k(c) || h && h.defaultChecked || n ? x(o, s, n ? c : et(f._f)) : H(s, c), u.mount && P();
625
630
  }
626
631
  }, oe = (s, n, l, h, f) => {
627
632
  let c = !1, g = !1;
@@ -642,11 +647,11 @@ function Yt(e = {}) {
642
647
  }
643
648
  return c ? V : {};
644
649
  }, Fe = (s, n, l, h) => {
645
- const f = y(t.errors, s), c = (F.isValid || E.isValid) && W(n) && t.isValid !== n;
646
- if (r.delayError && l ? (b = q(() => p(s, l)), b(r.delayError)) : (clearTimeout(D), b = null, l ? x(t.errors, s, l) : M(t.errors, s)), (l ? !ee(f, l) : f) || !P(h) || c) {
650
+ const f = y(t.errors, s), c = (F.isValid || E.isValid) && q(n) && t.isValid !== n;
651
+ if (r.delayError && l ? (b = N(() => W(s, l)), b(r.delayError)) : (clearTimeout(D), b = null, l ? x(t.errors, s, l) : M(t.errors, s)), (l ? !ee(f, l) : f) || !B(h) || c) {
647
652
  const g = {
648
653
  ...h,
649
- ...c && W(n) ? { isValid: n } : {},
654
+ ...c && q(n) ? { isValid: n } : {},
650
655
  errors: t.errors,
651
656
  name: s
652
657
  };
@@ -684,7 +689,7 @@ function Yt(e = {}) {
684
689
  break;
685
690
  !n && (y(U, c.name) ? V ? zt(t.errors, U, c.name) : x(t.errors, c.name, U[c.name]) : M(t.errors, c.name));
686
691
  }
687
- !P(g) && await J(g, n, l);
692
+ !B(g) && await J(g, n, l);
688
693
  }
689
694
  }
690
695
  return l.valid;
@@ -701,7 +706,7 @@ function Yt(e = {}) {
701
706
  let f = n;
702
707
  if (h) {
703
708
  const c = h._f;
704
- c && (!c.disabled && x(o, s, Vt(n, c)), f = be(c.ref) && B(n) ? "" : n, vt(c.ref) ? [...c.ref.options].forEach((g) => g.selected = f.includes(g.value)) : c.refs ? ye(c.ref) ? c.refs.length > 1 ? c.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(f) ? !!f.find((V) => V === g.value) : f === g.value)) : c.refs[0] && (c.refs[0].checked = !!f) : c.refs.forEach((g) => g.checked = g.value === f) : Oe(c.ref) ? c.ref.value = "" : (c.ref.value = f, c.ref.type || m.state.next({
709
+ c && (!c.disabled && x(o, s, Vt(n, c)), f = be(c.ref) && p(n) ? "" : n, vt(c.ref) ? [...c.ref.options].forEach((g) => g.selected = f.includes(g.value)) : c.refs ? ye(c.ref) ? c.refs.length > 1 ? c.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(f) ? !!f.find((V) => V === g.value) : f === g.value)) : c.refs[0] && (c.refs[0].checked = !!f) : c.refs.forEach((g) => g.checked = g.value === f) : Oe(c.ref) ? c.ref.value = "" : (c.ref.value = f, c.ref.type || m.state.next({
705
710
  name: s,
706
711
  values: R(o)
707
712
  })));
@@ -721,7 +726,7 @@ function Yt(e = {}) {
721
726
  name: s,
722
727
  dirtyFields: ue(a, o),
723
728
  isDirty: _(s, c)
724
- })) : h && !h._f && !B(c) ? G(s, c, l) : H(s, c, l), st(s, d) && m.state.next({ ...t }), m.state.next({
729
+ })) : h && !h._f && !p(c) ? G(s, c, l) : H(s, c, l), st(s, d) && m.state.next({ ...t }), m.state.next({
725
730
  name: u.mount ? s : void 0,
726
731
  values: R(o)
727
732
  });
@@ -736,18 +741,18 @@ function Yt(e = {}) {
736
741
  let g, V;
737
742
  const T = n.type ? et(f._f) : ut(s), U = s.type === ve.BLUR || s.type === ve.FOCUS_OUT, Tt = !Ht(f._f) && !r.resolver && !y(t.errors, l) && !f._f.deps || Qt(U, y(t.touchedFields, l), t.isSubmitted, j, te), De = st(l, d, U);
738
743
  x(o, l, T), U ? (f._f.onBlur && f._f.onBlur(s), b && b(0)) : f._f.onChange && f._f.onChange(s);
739
- const Ee = oe(l, T, U), Mt = !P(Ee) || De;
744
+ const Ee = oe(l, T, U), Mt = !B(Ee) || De;
740
745
  if (!U && m.state.next({
741
746
  name: l,
742
747
  type: s.type,
743
748
  values: R(o)
744
749
  }), Tt)
745
- return (F.isValid || E.isValid) && (r.mode === "onBlur" ? U && N() : U || N()), Mt && m.state.next({ name: l, ...De ? {} : Ee });
750
+ return (F.isValid || E.isValid) && (r.mode === "onBlur" ? U && P() : U || P()), Mt && m.state.next({ name: l, ...De ? {} : Ee });
746
751
  if (!U && De && m.state.next({ ...t }), r.resolver) {
747
752
  const { errors: Ke } = await z([l]);
748
753
  if (c(T), h) {
749
754
  const Lt = it(t.errors, i, l), Qe = it(Ke, i, Lt.name || l);
750
- g = Qe.error, l = Qe.name, V = P(Ke);
755
+ g = Qe.error, l = Qe.name, V = B(Ke);
751
756
  }
752
757
  } else
753
758
  v([l], !0), g = (await at(f, d.disabled, o, O, r.shouldUseNativeValidation))[l], v([l]), c(T), h && (g ? V = !1 : (F.isValid || E.isValid) && (V = await J(i, !0)));
@@ -761,11 +766,11 @@ function Yt(e = {}) {
761
766
  const f = de(s);
762
767
  if (r.resolver) {
763
768
  const c = await re(k(s) ? s : f);
764
- l = P(c), h = s ? !f.some((g) => y(c, g)) : l;
769
+ l = B(c), h = s ? !f.some((g) => y(c, g)) : l;
765
770
  } else s ? (h = (await Promise.all(f.map(async (c) => {
766
771
  const g = y(i, c);
767
772
  return await J(g && g._f ? { [c]: g } : g);
768
- }))).every(Boolean), !(!h && !t.isValid) && N()) : h = l = await J(i);
773
+ }))).every(Boolean), !(!h && !t.isValid) && P()) : h = l = await J(i);
769
774
  return m.state.next({
770
775
  ...!Y(s) || (F.isValid || E.isValid) && l !== t.isValid ? {} : { name: s },
771
776
  ...r.resolver || !s ? { isValid: l } : {},
@@ -821,12 +826,12 @@ function Yt(e = {}) {
821
826
  }), m.state.next({
822
827
  ...t,
823
828
  ...n.keepDirty ? { isDirty: _() } : {}
824
- }), !n.keepIsValid && N();
825
- }, Ie = ({ disabled: s, name: n }) => {
826
- (W(s) && u.mount || s || d.disabled.has(n)) && (s ? d.disabled.add(n) : d.disabled.delete(n));
829
+ }), !n.keepIsValid && P();
830
+ }, pe = ({ disabled: s, name: n }) => {
831
+ (q(s) && u.mount || s || d.disabled.has(n)) && (s ? d.disabled.add(n) : d.disabled.delete(n));
827
832
  }, we = (s, n = {}) => {
828
833
  let l = y(i, s);
829
- const h = W(n.disabled) || W(r.disabled);
834
+ const h = q(n.disabled) || q(r.disabled);
830
835
  return x(i, s, {
831
836
  ...l || {},
832
837
  _f: {
@@ -835,8 +840,8 @@ function Yt(e = {}) {
835
840
  mount: !0,
836
841
  ...n
837
842
  }
838
- }), d.mount.add(s), l ? Ie({
839
- disabled: W(n.disabled) ? n.disabled : r.disabled,
843
+ }), d.mount.add(s), l ? pe({
844
+ disabled: q(n.disabled) ? n.disabled : r.disabled,
840
845
  name: s
841
846
  }) : ae(s, !0, n.value), {
842
847
  ...h ? { disabled: n.disabled || r.disabled } : {},
@@ -874,8 +879,8 @@ function Yt(e = {}) {
874
879
  l = y(i, s, {}), l._f && (l._f.mount = !1), (r.shouldUnregister || n.shouldUnregister) && !(ct(d.array, s) && u.action) && d.unMount.add(s);
875
880
  }
876
881
  };
877
- }, pe = () => r.shouldFocusError && fe(i, he, d.mount), Et = (s) => {
878
- W(s) && (m.state.next({ disabled: s }), fe(i, (n, l) => {
882
+ }, Ie = () => r.shouldFocusError && fe(i, he, d.mount), Et = (s) => {
883
+ q(s) && (m.state.next({ disabled: s }), fe(i, (n, l) => {
879
884
  const h = y(i, l);
880
885
  h && (n.disabled = h._f.disabled || s, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
881
886
  f.disabled = h._f.disabled || s;
@@ -895,7 +900,7 @@ function Yt(e = {}) {
895
900
  if (d.disabled.size)
896
901
  for (const c of d.disabled)
897
902
  x(f, c, void 0);
898
- if (M(t.errors, "root"), P(t.errors)) {
903
+ if (M(t.errors, "root"), B(t.errors)) {
899
904
  m.state.next({
900
905
  errors: {}
901
906
  });
@@ -905,19 +910,19 @@ function Yt(e = {}) {
905
910
  h = c;
906
911
  }
907
912
  } else
908
- n && await n({ ...t.errors }, l), pe(), setTimeout(pe);
913
+ n && await n({ ...t.errors }, l), Ie(), setTimeout(Ie);
909
914
  if (m.state.next({
910
915
  isSubmitted: !0,
911
916
  isSubmitting: !1,
912
- isSubmitSuccessful: P(t.errors) && !h,
917
+ isSubmitSuccessful: B(t.errors) && !h,
913
918
  submitCount: t.submitCount + 1,
914
919
  errors: t.errors
915
920
  }), h)
916
921
  throw h;
917
922
  }, St = (s, n = {}) => {
918
- y(i, s) && (k(n.defaultValue) ? Z(s, R(y(a, s))) : (Z(s, n.defaultValue), x(a, s, R(n.defaultValue))), n.keepTouched || M(t.touchedFields, s), n.keepDirty || (M(t.dirtyFields, s), t.isDirty = n.defaultValue ? _(s, R(y(a, s))) : _()), n.keepError || (M(t.errors, s), F.isValid && N()), m.state.next({ ...t }));
923
+ y(i, s) && (k(n.defaultValue) ? Z(s, R(y(a, s))) : (Z(s, n.defaultValue), x(a, s, R(n.defaultValue))), n.keepTouched || M(t.touchedFields, s), n.keepDirty || (M(t.dirtyFields, s), t.isDirty = n.defaultValue ? _(s, R(y(a, s))) : _()), n.keepError || (M(t.errors, s), F.isValid && P()), m.state.next({ ...t }));
919
924
  }, qe = (s, n = {}) => {
920
- const l = s ? R(s) : a, h = R(l), f = P(s), c = f ? a : h;
925
+ const l = s ? R(s) : a, h = R(l), f = B(s), c = f ? a : h;
921
926
  if (n.keepDefaultValues || (a = l), !n.keepValues) {
922
927
  if (n.keepDirtyValues) {
923
928
  const g = /* @__PURE__ */ new Set([
@@ -990,9 +995,9 @@ function Yt(e = {}) {
990
995
  _runSchema: z,
991
996
  _getWatch: S,
992
997
  _getDirty: _,
993
- _setValid: N,
998
+ _setValid: P,
994
999
  _setFieldArray: K,
995
- _setDisabledField: Ie,
1000
+ _setDisabledField: pe,
996
1001
  _setErrors: L,
997
1002
  _getFieldArray: I,
998
1003
  _reset: qe,
@@ -1093,7 +1098,7 @@ function Jt(e = {}) {
1093
1098
  isReady: !0
1094
1099
  })), o._formState.isReady = !0, u;
1095
1100
  }, [o]), w.useEffect(() => o._disableForm(e.disabled), [o, e.disabled]), w.useEffect(() => {
1096
- e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode), e.errors && !P(e.errors) && o._setErrors(e.errors);
1101
+ e.mode && (o._options.mode = e.mode), e.reValidateMode && (o._options.reValidateMode = e.reValidateMode), e.errors && !B(e.errors) && o._setErrors(e.errors);
1097
1102
  }, [o, e.errors, e.mode, e.reValidateMode]), w.useEffect(() => {
1098
1103
  e.shouldUnregister && o._subjects.state.next({
1099
1104
  values: o._getWatch()
@@ -1200,4 +1205,4 @@ export {
1200
1205
  cr as h,
1201
1206
  or as u
1202
1207
  };
1203
- //# sourceMappingURL=useDebounce-MaKPBuaC.js.map
1208
+ //# sourceMappingURL=useDebounce-B__kmLt7.js.map