@m4l/components 9.3.29 → 9.3.30-JA.beta-1

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 (62) hide show
  1. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.d.ts +3 -2
  2. package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +3 -2
  3. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.d.ts +3 -2
  4. package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +3 -2
  5. package/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.d.ts +3 -4
  6. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.d.ts +3 -2
  7. package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +3 -2
  8. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.d.ts +3 -2
  9. package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +3 -2
  10. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.d.ts +3 -2
  11. package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +3 -2
  12. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.d.ts +3 -2
  13. package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +3 -2
  14. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +1 -1
  15. package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts +1 -7
  16. package/components/DynamicSort/subcomponents/FieldTypes/FieldTypeInterface.d.ts +2 -3
  17. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.d.ts +3 -2
  18. package/components/DynamicSort/subcomponents/FieldTypes/StringSort/helpers.js +3 -2
  19. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.js +1 -1
  20. package/components/DynamicSort/subcomponents/PopoverSort/usePopoverSort.d.ts +1 -7
  21. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/AreaChip.js +4 -3
  22. package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +4 -3
  23. package/components/areas/contexts/AreasContext/store.js +2 -2
  24. package/components/hook-form/RHFormProvider/RHFormProvider.d.ts +31 -0
  25. package/components/hook-form/RHFormProvider/RHFormProvider.js +93 -0
  26. package/components/hook-form/RHFormProvider/index.d.ts +4 -0
  27. package/components/hook-form/RHFormProvider/index.js +1 -0
  28. package/components/hook-form/RHFormProvider/schema.d.ts +17 -0
  29. package/components/hook-form/RHFormProvider/schema.js +29 -0
  30. package/components/hook-form/RHFormProvider/types.d.ts +129 -0
  31. package/components/hook-form/RHFormProvider/types.js +8 -0
  32. package/components/hook-form/index.d.ts +1 -0
  33. package/contexts/index.d.ts +3 -3
  34. package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +3 -3
  35. package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.js +3 -3
  36. package/helpers/getStepsAndValidationSchema/types.d.ts +5 -4
  37. package/hooks/index.d.ts +1 -0
  38. package/hooks/useFormAddEdit/index.d.ts +1 -1
  39. package/hooks/useWatchTyped/index.d.ts +1 -0
  40. package/hooks/useWatchTyped/index.js +1 -0
  41. package/hooks/useWatchTyped/types.d.ts +11 -0
  42. package/hooks/useWatchTyped/useTypedWatch.d.ts +9 -0
  43. package/hooks/useWatchTyped/useTypedWatch.js +30 -0
  44. package/index.js +46 -35
  45. package/package.json +1 -1
  46. package/components/hook-form/RHFormContext/index.d.ts +0 -120
  47. package/components/hook-form/RHFormContext/index.js +0 -91
  48. package/components/hook-form/RHFormContext/types.d.ts +0 -83
  49. package/hooks/useFormReadyForUpdate/types.d.ts +0 -8
  50. /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/constants.d.ts +0 -0
  51. /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/constants.js +0 -0
  52. /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/index.d.ts +0 -0
  53. /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/index.js +0 -0
  54. /package/components/hook-form/{RHFormContext → RHFormProvider}/classes/types.d.ts +0 -0
  55. /package/components/hook-form/{RHFormContext → RHFormProvider}/dictionary.d.ts +0 -0
  56. /package/components/hook-form/{RHFormContext → RHFormProvider}/dictionary.js +0 -0
  57. /package/components/hook-form/{RHFormContext → RHFormProvider}/styles.d.ts +0 -0
  58. /package/components/hook-form/{RHFormContext → RHFormProvider}/styles.js +0 -0
  59. /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/index.d.ts +0 -0
  60. /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/skeleton.d.ts +0 -0
  61. /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/styles.d.ts +0 -0
  62. /package/components/hook-form/{RHFormContext → RHFormProvider}/subcomponents/FormActions/types.d.ts +0 -0
@@ -0,0 +1,17 @@
1
+ import { RHFormValues, ValidationFullObject, ValidationSchema, ValidationShape, ValidationPartialObject } from './types';
2
+ /**
3
+ * Crea un esquema de Yup a partir de un shape tipado y mantiene la asociación con el tipo del formulario.
4
+ */
5
+ export declare const createValidationSchema: <T extends RHFormValues>(valitionFullObject: ValidationFullObject<T>) => ValidationSchema<T>;
6
+ /**
7
+ * Crea un esquema de Yup a partir de un shape tipado y mantiene la asociación con el tipo del formulario.
8
+ */
9
+ export declare const createValidationPartialObject: <T extends RHFormValues>(partialObjectShape: ValidationShape<T>) => ValidationPartialObject<T>;
10
+ /**
11
+ * Marca un ObjectShape para garantizar que fue construido mediante createValidationObject.
12
+ */
13
+ export declare const createValidationFullObject: <T extends RHFormValues>(...partialObjectShape: Array<ValidationPartialObject<T>>) => ValidationFullObject<T>;
14
+ /**
15
+ * crea un squema de validación vacío, para los testing
16
+ */
17
+ export declare const createEmptyValidationSchema: <T extends RHFormValues>() => ValidationSchema<T>;
@@ -0,0 +1,29 @@
1
+ import * as Yup from "yup";
2
+ import { V as VALIDATION_OBJECT_BRAND } from "./types.js";
3
+ const createValidationSchema = (valitionFullObject) => {
4
+ const schema = Yup.object().shape(valitionFullObject);
5
+ return schema;
6
+ };
7
+ const createValidationPartialObject = (partialObjectShape) => {
8
+ const validationPartialObject = { ...partialObjectShape };
9
+ return validationPartialObject;
10
+ };
11
+ const createValidationFullObject = (...partialObjectShape) => {
12
+ const mergedShape = Object.assign({}, ...partialObjectShape);
13
+ Object.defineProperty(mergedShape, VALIDATION_OBJECT_BRAND, {
14
+ configurable: false,
15
+ enumerable: false,
16
+ writable: false,
17
+ value: true
18
+ });
19
+ return mergedShape;
20
+ };
21
+ const createEmptyValidationSchema = () => {
22
+ return createValidationSchema(createValidationFullObject(createValidationPartialObject({})));
23
+ };
24
+ export {
25
+ createValidationFullObject as a,
26
+ createValidationPartialObject as b,
27
+ createValidationSchema as c,
28
+ createEmptyValidationSchema as d
29
+ };
@@ -0,0 +1,129 @@
1
+ import { ReactNode } from 'react';
2
+ import { Mode, UseFormReturn } from 'react-hook-form';
3
+ import { ObjectSchema } from 'yup';
4
+ import { ObjectShape } from 'yup/lib/object';
5
+ /**
6
+ * Estados de carga del formulario que determinan cuándo y cómo actualizar los valores.
7
+ *
8
+ * - `initial`: Estado inicial del formulario
9
+ * - `new`: Formulario para crear un nuevo elemento
10
+ * - `edit`: Formulario para editar un elemento existente
11
+ * - `reload_values_provider`: Estado que indica que se deben recargar los valores del proveedor
12
+ * - `ready`: Formulario listo para ser usado
13
+ * - `error`: Estado de error en el formulario
14
+ */
15
+ export type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
16
+ export type RHFormValues = {};
17
+ /**
18
+ * Tipo que define los valores iniciales del formulario.
19
+ * Extiende FieldValues de React Hook Form para mayor flexibilidad.
20
+ */
21
+ export type RHFormInitialValues<T extends RHFormValues> = Partial<T>;
22
+ /**
23
+ * LiteralKeys es un tipo que define las claves literales del formulario. excepto statusLoad, que no es necesario que el usuario la aporte.
24
+ */
25
+ export type LiteralKeys<T> = Exclude<Extract<keyof T, string>, 'statusLoad'>;
26
+ /**
27
+ * StrictFormValues es un tipo que define los valores del formulario explicitamente.
28
+ */
29
+ export type StrictFormValues<T extends RHFormValues> = Pick<RHFormInitialValues<T>, LiteralKeys<RHFormInitialValues<T>>>;
30
+ /**
31
+ * Garantiza que el shape sólo contenga claves declaradas en el tipo del formulario.
32
+ * Si usa un key que no está en el tipo del formulario, se devuelve never. Protegiendo el ingreso de claves diferentes.
33
+ */
34
+ export type EnsureAllowedKeys<Shape, Allowed extends string> = Exclude<keyof Shape, Allowed> extends never ? Shape : never;
35
+ /**
36
+ * YupShapeEntry es un tipo que define la entrada de un shape de Yup.
37
+ */
38
+ type YupShapeEntry = ObjectShape[string];
39
+ /**
40
+ * ValidationShape veririca que solo YupShapeEntry puedan ser usados en algunos campos de RHFormValues.
41
+ */
42
+ export type ValidationShape<T extends RHFormValues> = Partial<Record<LiteralKeys<T>, YupShapeEntry>>;
43
+ /**
44
+ * Symbol que contiene el ValidationSchema que lo hace diferente a ObjectSchema normal de Yup.
45
+ */
46
+ export declare const VALIDATION_SCHEMA_BRAND: unique symbol;
47
+ /**
48
+ * Symbol que identifica que un ValidationShape fue construido mediante createValidationObject.
49
+ */
50
+ export declare const VALIDATION_OBJECT_BRAND: unique symbol;
51
+ /**
52
+ * Symbol que identifica que un ValidationShape parcial fue construido mediante createValidationPartialObject.
53
+ */
54
+ export declare const VALIDATION_PARTIAL_OBJECT_BRAND: unique symbol;
55
+ /**
56
+ * ValidationSchema es un tipo que define el schema de validación del formulario. Aporta el brand VALIDATION_SCHEMA_BRAND para hacer diferentes a ObjectSchema normal de Yup.
57
+ * y asi poder garantizar que se use la función createValidationSchema para crear la schema.
58
+ */
59
+ export type ValidationSchema<T extends RHFormValues> = ObjectSchema<any> & {
60
+ /**
61
+ * Aunque no se use en el codigo a nivel de javascript, es necesario para que el tipo de la schema para hacerlos diferente a ObjectSchema. y obliga
62
+ * a que se use la función createValidationSchema para crear la schema.
63
+ */
64
+ readonly [VALIDATION_SCHEMA_BRAND]: ValidationShape<T>;
65
+ };
66
+ /**
67
+ * ValidationFullObject garantiza que el shape sea construido mediante createValidationObject.
68
+ * con base en los partialObjectShape que se le pasan a createValidationObject.
69
+ */
70
+ export type ValidationFullObject<T extends RHFormValues> = ValidationShape<T> & {
71
+ readonly [VALIDATION_OBJECT_BRAND]: true;
72
+ };
73
+ /**
74
+ * ValidationPartialObject garantiza que el shape parcial sea construido mediante createValidationPartialObject.
75
+ */
76
+ export type ValidationPartialObject<T extends RHFormValues> = ValidationShape<T> & {
77
+ readonly [VALIDATION_PARTIAL_OBJECT_BRAND]: true;
78
+ };
79
+ /**
80
+ * Propiedades del componente principal RHFormProvider.
81
+ * Define la interfaz para crear formularios con React Hook Form y validación Yup.
82
+ */
83
+ export interface RHFormProviderProps<T extends RHFormValues> {
84
+ /** Elementos hijos del formulario */
85
+ children: ReactNode;
86
+ /** Función que se ejecuta al enviar el formulario con los datos validados */
87
+ onSubmit: (data: T) => void;
88
+ /** Valores iniciales del formulario si es un new o cargados del backend si son edit */
89
+ values: RHFormInitialValues<T>;
90
+ /** Esquema de validación de Yup */
91
+ validationSchema: ValidationSchema<T>;
92
+ /** Estado de carga del formulario (opcional, por defecto 'ready') */
93
+ statusLoad?: FormStatusLoad;
94
+ /** Clases CSS adicionales (opcional) */
95
+ className?: string;
96
+ /** Modo de validación del formulario (opcional) */
97
+ mode?: Mode;
98
+ }
99
+ /**
100
+ * Propiedades del componente FormProviderCustom.
101
+ * Combina las propiedades de React Hook Form con las propiedades personalizadas del formulario.
102
+ */
103
+ export interface FormProviderCustomProps<T extends RHFormValues> extends RHFormProviderProps<T> {
104
+ formMethods: UseFormReturn<T, any, undefined>;
105
+ }
106
+ /**
107
+ * Argumentos para el hook useCustomForm.
108
+ * Define los parámetros necesarios para configurar un formulario personalizado.
109
+ */
110
+ export interface CustomFormArguments<T extends RHFormValues> {
111
+ /** Valores iniciales del formulario */
112
+ values: RHFormInitialValues<T>;
113
+ /** Esquema de validación de Yup */
114
+ validationSchema: ValidationSchema<T>;
115
+ /** Estado de carga del formulario (opcional) */
116
+ statusLoad?: FormStatusLoad;
117
+ /** Modo de validación del formulario (opcional) */
118
+ mode?: Mode;
119
+ }
120
+ /**
121
+ * Interfaz que define los métodos expuestos a través de la ref del RHFormProvider.
122
+ * Permite acceso programático a los métodos de React Hook Form desde componentes padre.
123
+ */
124
+ export interface RHFormProviderRef<T extends RHFormValues> {
125
+ /** Objeto completo con todos los métodos de React Hook Form */
126
+ formMethods: UseFormReturn<T, any, undefined>;
127
+ onSubmit: (data: T) => void;
128
+ }
129
+ export {};
@@ -0,0 +1,8 @@
1
+ const VALIDATION_SCHEMA_BRAND = Symbol("VALIDATION_SCHEMA_BRAND");
2
+ const VALIDATION_OBJECT_BRAND = Symbol("VALIDATION_OBJECT_BRAND");
3
+ const VALIDATION_PARTIAL_OBJECT_BRAND = Symbol("VALIDATION_PARTIAL_OBJECT_BRAND");
4
+ export {
5
+ VALIDATION_OBJECT_BRAND as V,
6
+ VALIDATION_SCHEMA_BRAND as a,
7
+ VALIDATION_PARTIAL_OBJECT_BRAND as b
8
+ };
@@ -15,3 +15,4 @@ export { RHFRadioGroup } from './RHFRadioGroup';
15
15
  export * from './RHFNumberInput';
16
16
  export { RHFUploadSingleFile } from './RHFUpload/RHFUploadSingleFile/RHFUploadSingleFile';
17
17
  export * from './RHFUpload';
18
+ export * from './RHFormProvider';
@@ -1,7 +1,7 @@
1
1
  export { DynamicMFParmsProvider, DynamicMFParmsContext, MemonizedDynamicMFParmsProvider, } from '../components/WindowBase/contexts/DynamicMFParmsContext';
2
2
  export * from './ModalContext/index';
3
3
  export * from './ModalContext/types';
4
- export type { FormInitialValues, FormStatusLoad, } from '../components/hook-form/RHFormContext/types';
5
- export { RHFormProvider, FormProviderCustom, useCustomForm, } from '../components/hook-form/RHFormContext';
6
- export { getFormComponentsDictionary } from '../components/hook-form/RHFormContext/dictionary';
4
+ export type { RHFormInitialValues as FormInitialValues, FormStatusLoad, } from '../components/hook-form/RHFormProvider/types';
5
+ export { RHFormProvider, FormProviderCustom, useCustomForm, } from '../components/hook-form/RHFormProvider/RHFormProvider';
6
+ export { getFormComponentsDictionary } from '../components/hook-form/RHFormProvider/dictionary';
7
7
  export { useAppearanceComponentStore, AppearanceComponentProvider, } from './AppearanceComponentContext';
@@ -1,11 +1,11 @@
1
1
  import { Step } from '../../components/Stepper/types';
2
2
  import { GetStepsAndValidationSchemaProps } from './types';
3
- import * as Yup from 'yup';
3
+ import { RHFormValues } from '../../components/hook-form/RHFormProvider/types';
4
4
  /**
5
5
  * Hook personalizado que recibe un array de steps con validaciones y regresa todo listo para el Stepper
6
6
  * Una sola configuración genera: validationSchema + steps + validationFields automáticamente
7
7
  */
8
- export declare function getStepsAndValidationSchema({ steps, visibilityData, }: GetStepsAndValidationSchemaProps): {
9
- validationSchema: Yup.ObjectSchema<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, Record<string, any>>, import('yup/lib/object').AnyObject, import('yup/lib/object').TypeOfShape<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, Record<string, any>>>, import('yup/lib/object').AssertsShape<import('yup/lib/object').Assign<import('yup/lib/object').ObjectShape, Record<string, any>>>>;
8
+ export declare function getStepsAndValidationSchema<T extends RHFormValues>({ steps, visibilityData, }: GetStepsAndValidationSchemaProps<T>): {
9
+ validationSchema: import('../../components/hook-form/RHFormProvider/types').ValidationSchema<T>;
10
10
  steps: Step[];
11
11
  };
@@ -1,11 +1,11 @@
1
- import * as Yup from "yup";
1
+ import { b as createValidationPartialObject, c as createValidationSchema, a as createValidationFullObject } from "../../components/hook-form/RHFormProvider/schema.js";
2
2
  import { e as evaluateVisibilityStepCondition } from "../../components/Stepper/helpers/evaluateVisibilityStepCondition/index.js";
3
3
  function getStepsAndValidationSchema({
4
4
  steps,
5
5
  visibilityData
6
6
  }) {
7
7
  const validationSchema = (() => {
8
- const combinedValidations = {};
8
+ const combinedValidations = createValidationPartialObject({});
9
9
  const visibleSteps = steps.filter((step) => {
10
10
  if (!step.visibilityCondition) {
11
11
  return true;
@@ -18,7 +18,7 @@ function getStepsAndValidationSchema({
18
18
  Object.assign(combinedValidations, validationResult);
19
19
  }
20
20
  });
21
- return Yup.object().shape(combinedValidations);
21
+ return createValidationSchema(createValidationFullObject(combinedValidations));
22
22
  })();
23
23
  const processedSteps = steps.map((step) => {
24
24
  let validationFields = [];
@@ -1,19 +1,20 @@
1
+ import { RHFormValues, ValidationPartialObject } from '../../components/hook-form/RHFormProvider/types';
1
2
  import { Step } from '../../components/Stepper/types';
2
3
  /**
3
4
  * Configuración completa de un step con validaciones incluidas
4
5
  */
5
- export interface StepWithValidation extends Omit<Step, 'validationFields'> {
6
+ export interface StepWithValidation<T extends RHFormValues> extends Omit<Step, 'validationFields'> {
6
7
  /**
7
8
  * Función de validación que retorna un objeto con esquemas Yup
8
9
  * Ejemplo: ContactDataValidation
9
10
  */
10
- validationFunction?: () => Record<string, any>;
11
+ validationFunction?: () => ValidationPartialObject<T>;
11
12
  }
12
- export interface GetStepsAndValidationSchemaProps {
13
+ export interface GetStepsAndValidationSchemaProps<T extends RHFormValues> {
13
14
  /**
14
15
  * Array de steps con sus validaciones incluidas
15
16
  */
16
- steps: StepWithValidation[];
17
+ steps: StepWithValidation<T>[];
17
18
  /**
18
19
  * Datos adicionales para visibilityCondition (ej: objectId)
19
20
  */
package/hooks/index.d.ts CHANGED
@@ -13,3 +13,4 @@ export * from './useDataGridPersistence';
13
13
  export * from './usePopoverContainer';
14
14
  export * from './useIsVisible';
15
15
  export * from './useSizeContainer';
16
+ export * from './useWatchTyped';
@@ -1,4 +1,4 @@
1
- import { FormStatusLoad } from '../../components/hook-form/RHFormContext/types';
1
+ import { FormStatusLoad } from '../../components/hook-form/RHFormProvider/types';
2
2
  import { UseFormAddEditProps } from './types';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  /**
@@ -0,0 +1 @@
1
+ export * from './useTypedWatch';
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,11 @@
1
+ import { Control, DeepPartialSkipArrayKey, FieldPath, FieldPathValue, FieldPathValues, FieldValues } from 'react-hook-form';
2
+ export type BaseProps<TFieldValues extends FieldValues> = {
3
+ control: Control<TFieldValues>;
4
+ disabled?: boolean;
5
+ exact?: boolean;
6
+ };
7
+ export type NameArray<TFieldValues extends FieldValues> = readonly FieldPath<TFieldValues>[];
8
+ export type ExtractFieldPath<TFieldValues extends FieldValues, TName> = Extract<TName, FieldPath<TFieldValues>>;
9
+ export type ExtractNameArray<TFieldValues extends FieldValues, TName> = Extract<TName, NameArray<TFieldValues>>;
10
+ export type DefaultValueFor<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> | NameArray<TFieldValues>> = TName extends NameArray<TFieldValues> ? DeepPartialSkipArrayKey<TFieldValues> : FieldPathValue<TFieldValues, ExtractFieldPath<TFieldValues, TName>>;
11
+ export type ReturnValueFor<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> | NameArray<TFieldValues>> = TName extends NameArray<TFieldValues> ? FieldPathValues<TFieldValues, ExtractNameArray<TFieldValues, TName>> : FieldPathValue<TFieldValues, ExtractFieldPath<TFieldValues, TName>>;
@@ -0,0 +1,9 @@
1
+ import { FieldPath, FieldValues } from 'react-hook-form';
2
+ import { BaseProps, DefaultValueFor, NameArray, ReturnValueFor } from './types';
3
+ /**
4
+ * Observa campos específicos (uno o varios) y devuelve su valor tipado.
5
+ */
6
+ export declare function useWatchTyped<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> | NameArray<TFieldValues>>({ control, name, defaultValue, disabled, exact, }: BaseProps<TFieldValues> & {
7
+ name: TName;
8
+ defaultValue?: DefaultValueFor<TFieldValues, TName>;
9
+ }): ReturnValueFor<TFieldValues, TName>;
@@ -0,0 +1,30 @@
1
+ import { useWatch } from "react-hook-form";
2
+ function useWatchTyped({
3
+ control,
4
+ name,
5
+ defaultValue,
6
+ disabled,
7
+ exact
8
+ }) {
9
+ if (Array.isArray(name)) {
10
+ const namesArray = name;
11
+ return useWatch({
12
+ control,
13
+ name: namesArray,
14
+ defaultValue,
15
+ disabled,
16
+ exact
17
+ });
18
+ }
19
+ const fieldName = name;
20
+ return useWatch({
21
+ control,
22
+ name: fieldName,
23
+ defaultValue,
24
+ disabled,
25
+ exact
26
+ });
27
+ }
28
+ export {
29
+ useWatchTyped as u
30
+ };
package/index.js CHANGED
@@ -161,6 +161,9 @@ import { R as R19 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodEnum.j
161
161
  import { N as N3, P as P6, R as R20, S as S7 } from "./components/hook-form/RHFPeriod/slots/RHFPeriodSlots.js";
162
162
  import { R as R21 } from "./components/hook-form/RHFNumberInput/RHFNumberInput.js";
163
163
  import { R as R22 } from "./components/hook-form/RHFUpload/RHFUploadImage/RHFUploadImage.js";
164
+ import { V as V2, b as b4, a as a9 } from "./components/hook-form/RHFormProvider/types.js";
165
+ import { F as F3, R as R23, u as u17 } from "./components/hook-form/RHFormProvider/RHFormProvider.js";
166
+ import { d as d4, a as a10, b as b5, c as c3 } from "./components/hook-form/RHFormProvider/schema.js";
164
167
  import { I as I4 } from "./components/Icon/Icon.js";
165
168
  import { I as I5 } from "./components/Image/Image.js";
166
169
  import { L as L6 } from "./components/Label/Label.js";
@@ -170,7 +173,7 @@ import { L as L9 } from "./components/Loadable/index.js";
170
173
  import { L as L10 } from "./components/LoadingError/LoadingError.js";
171
174
  import { g as g22 } from "./components/LoadingError/dictionary.js";
172
175
  import { g as g23 } from "./components/MenuActions/dictionary.js";
173
- import { a as a9, M as M3 } from "./components/MenuActions/MenuActions.js";
176
+ import { a as a11, M as M3 } from "./components/MenuActions/MenuActions.js";
174
177
  import { M as M4 } from "./components/MFIsolationApp/MFIsolationApp.js";
175
178
  import { M as M5 } from "./components/MFIsolationAppStorybook/MFIsolationAppStorybook.js";
176
179
  import { M as M6 } from "./components/MFLoader/MFLoader.js";
@@ -184,8 +187,8 @@ import { g as g27 } from "./components/ObjectLogs/dictionary.js";
184
187
  import { O } from "./components/ObjectLogs/ObjectLogs.js";
185
188
  import { P as P7 } from "./components/PaperForm/PaperForm.js";
186
189
  import { P as P8 } from "./components/PDFViewer/PDFViewer.js";
187
- import { u as u17 } from "./components/popups/components/PopupsProvider/hooks/usePopupsStore.js";
188
- import { a as a10, P as P9 } from "./components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.js";
190
+ import { u as u18 } from "./components/popups/components/PopupsProvider/hooks/usePopupsStore.js";
191
+ import { a as a12, P as P9 } from "./components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.js";
189
192
  import { P as P10 } from "./components/popups/components/PopupsViewer/PopupsViewer.js";
190
193
  import { P as P11 } from "./components/PrintingSystem/PrintingSystem.js";
191
194
  import { P as P12 } from "./components/PropertyValue/PropertyValue.js";
@@ -194,17 +197,17 @@ import { S as S9 } from "./components/SideBar/SideBar.js";
194
197
  import { T as T18 } from "./components/ToastContainer/ToastContainer.js";
195
198
  import { T as T19 } from "./components/ToastContainer/subcomponents/ToastMessage/ToastMessage.js";
196
199
  import { W as W2 } from "./components/WindowBase/WindowBase.js";
197
- import { u as u18 } from "./components/WindowBase/hooks/useWindowToolsMF/index.js";
198
- import { u as u19, a as a11 } from "./components/WindowBase/hooks/useDynamicMFParameters/index.js";
199
- import { M as M7, W as W3, a as a12 } from "./components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js";
200
- import { c as c3 } from "./components/WindowBase/contexts/DynamicMFParmsContext/store.js";
201
- import { D as D10, a as a13, M as M8 } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
200
+ import { u as u19 } from "./components/WindowBase/hooks/useWindowToolsMF/index.js";
201
+ import { u as u20, a as a13 } from "./components/WindowBase/hooks/useDynamicMFParameters/index.js";
202
+ import { M as M7, W as W3, a as a14 } from "./components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js";
203
+ import { c as c4 } from "./components/WindowBase/contexts/DynamicMFParmsContext/store.js";
204
+ import { D as D10, a as a15, M as M8 } from "./components/WindowBase/contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
202
205
  import { W as W4 } from "./components/WindowConfirm/WindowConfirm.js";
203
- import { a as a14, g as g28 } from "./components/ModalDialog/dictionary.js";
206
+ import { a as a16, g as g28 } from "./components/ModalDialog/dictionary.js";
204
207
  import { M as M9 } from "./components/ModalDialog/ModalDialog.js";
205
208
  import { S as S10 } from "./components/SettingsLayout/SettingsLayout.js";
206
209
  import { P as P13 } from "./components/Pager/Pager.js";
207
- import { u as u20 } from "./components/Stepper/hooks/useStepper/index.js";
210
+ import { u as u21 } from "./components/Stepper/hooks/useStepper/index.js";
208
211
  import { S as S11 } from "./components/Stepper/Stepper.js";
209
212
  import { S as S12 } from "./components/Stepper/subcomponents/StepperContent/index.js";
210
213
  import { S as S13 } from "./components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js";
@@ -217,11 +220,10 @@ import { S as S19 } from "./components/Stepper/subcomponents/StepperButtons/Step
217
220
  import { S as S20 } from "./components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js";
218
221
  import { e as e2 } from "./components/Stepper/helpers/evaluateVisibilityStepCondition/index.js";
219
222
  import { g as g29 } from "./components/Stepper/dictionary.js";
220
- import { F as F3, R as R23, u as u21 } from "./components/hook-form/RHFormContext/index.js";
221
- import { g as g30 } from "./components/hook-form/RHFormContext/dictionary.js";
223
+ import { g as g30 } from "./components/hook-form/RHFormProvider/dictionary.js";
222
224
  import { u as u22 } from "./contexts/AppearanceComponentContext/useAppearanceComponentStore.js";
223
225
  import { A as A16 } from "./contexts/AppearanceComponentContext/AppearanceComponentContext.js";
224
- import { a as a15, M as M10 } from "./contexts/ModalContext/index.js";
226
+ import { a as a17, M as M10 } from "./contexts/ModalContext/index.js";
225
227
  import { u as u23 } from "./hooks/useFormAddEdit/index.js";
226
228
  import { u as u24 } from "./hooks/useModal/index.js";
227
229
  import { u as u25 } from "./hooks/useTab/index.js";
@@ -238,19 +240,20 @@ import { u as u33 } from "./hooks/useDataGridPersistence/useDataGridPersistence.
238
240
  import { u as u34 } from "./hooks/usePopoverContainer/usePopoverContainer.js";
239
241
  import { u as u35 } from "./hooks/useIsVisible/useIsVisible.js";
240
242
  import { u as u36 } from "./hooks/useSizeContainer/index.js";
241
- import { c as c4 } from "./utils/capitalizeFirstLetter.js";
243
+ import { u as u37 } from "./hooks/useWatchTyped/useTypedWatch.js";
244
+ import { c as c5 } from "./utils/capitalizeFirstLetter.js";
242
245
  import { i as i2 } from "./utils/isValidDate.js";
243
246
  import { g as g32 } from "./utils/getComponentUtilityClass.js";
244
247
  import { g as g33 } from "./utils/getPaletteColor.js";
245
248
  import { g as g34 } from "./utils/getTypographyStyles.js";
246
249
  import { g as g35 } from "./utils/getIconColor.js";
247
- import { a as a16, g as g36 } from "./utils/getSizeStyles/getSizeStyles.js";
250
+ import { a as a18, g as g36 } from "./utils/getSizeStyles/getSizeStyles.js";
248
251
  import { O as O2 } from "./utils/ObjectQueue.js";
249
- import { g as g37, a as a17 } from "./utils/getComponentSlotRoot.js";
252
+ import { g as g37, a as a19 } from "./utils/getComponentSlotRoot.js";
250
253
  import { f as f2 } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
251
254
  import { g as g38 } from "./utils/getValidDate.js";
252
255
  import { g as g39 } from "./utils/getNullGuard.js";
253
- import { c as c5, d as d4 } from "./utils/deepShallow.js";
256
+ import { c as c6, d as d5 } from "./utils/deepShallow.js";
254
257
  import { g as g40 } from "./helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.js";
255
258
  export {
256
259
  A7 as AREAS_DICCTIONARY,
@@ -310,7 +313,7 @@ export {
310
313
  D3 as DragResizeWindowRND,
311
314
  D4 as DynamicFilter,
312
315
  D10 as DynamicMFParmsContext,
313
- a13 as DynamicMFParmsProvider,
316
+ a15 as DynamicMFParmsProvider,
314
317
  D5 as DynamicSort,
315
318
  F as FixedSizeList,
316
319
  F2 as FormContainer,
@@ -339,10 +342,10 @@ export {
339
342
  M5 as MFIsolationAppStorybook,
340
343
  M6 as MFLoader,
341
344
  M8 as MemonizedDynamicMFParmsProvider,
342
- a9 as MemonizedMenuActions,
345
+ a11 as MemonizedMenuActions,
343
346
  M7 as MemonizedWindowToolsMFContext,
344
347
  M3 as MenuActions,
345
- a15 as ModalContext,
348
+ a17 as ModalContext,
346
349
  M9 as ModalDialog,
347
350
  M10 as ModalProvider,
348
351
  M as MotionContainer,
@@ -361,7 +364,7 @@ export {
361
364
  P6 as PeriodRootStyled,
362
365
  P3 as PointsFormatter,
363
366
  P2 as Popover,
364
- a10 as PopupsContext,
367
+ a12 as PopupsContext,
365
368
  P9 as PopupsProvider,
366
369
  P10 as PopupsViewer,
367
370
  P5 as PriceFormatter,
@@ -434,20 +437,27 @@ export {
434
437
  T as TopBar,
435
438
  T8 as Typography,
436
439
  U as UncertaintyFormatter,
440
+ V2 as VALIDATION_OBJECT_BRAND,
441
+ b4 as VALIDATION_PARTIAL_OBJECT_BRAND,
442
+ a9 as VALIDATION_SCHEMA_BRAND,
437
443
  V as VariableSizeList,
438
444
  W as WINDOW_SIZES,
439
445
  W2 as WindowBase,
440
446
  W4 as WindowConfirm,
441
447
  W3 as WindowToolsMFContext,
442
- a12 as WindowToolsMFProvider,
448
+ a14 as WindowToolsMFProvider,
443
449
  c2 as addLayoutItemToBreakPointIfNoExists,
444
450
  e as addLayoutItemToBreakPoints,
445
- c4 as capitalizeFirstLetter,
451
+ c5 as capitalizeFirstLetter,
446
452
  d3 as cloneLayouts,
447
- c5 as createCustomDeepShallow,
448
- c3 as createDynamicMFStore,
453
+ c6 as createCustomDeepShallow,
454
+ c4 as createDynamicMFStore,
455
+ d4 as createEmptyValidationSchema,
449
456
  c as createToaster,
450
- d4 as deepShallow,
457
+ a10 as createValidationFullObject,
458
+ b5 as createValidationPartialObject,
459
+ c3 as createValidationSchema,
460
+ d5 as deepShallow,
451
461
  d as defaultCommonActionsDictionary,
452
462
  d2 as dragResizeWindowRNDClasses,
453
463
  e2 as evaluateVisibilityStepCondition,
@@ -458,7 +468,7 @@ export {
458
468
  g3 as getAreasDictionary,
459
469
  g4 as getCommonActionsDictionary,
460
470
  g37 as getComponentClasses,
461
- a17 as getComponentSlotRoot,
471
+ a19 as getComponentSlotRoot,
462
472
  g32 as getComponentUtilityClass,
463
473
  g5 as getDataGridComponentsDictionary,
464
474
  g6 as getDataGridRowsFromSet,
@@ -472,13 +482,13 @@ export {
472
482
  g14 as getFormatPoints,
473
483
  g16 as getFormatPrice,
474
484
  g18 as getFormattersComponentsDictionary,
475
- a16 as getHeightSizeStyles,
485
+ a18 as getHeightSizeStyles,
476
486
  g35 as getIconColor,
477
487
  g8 as getIsIfInDynamicFilter,
478
488
  g22 as getLoadingErrorComponentsDictionary,
479
489
  g24 as getMFLoaderComponentsDictionary,
480
490
  g23 as getMenuActionsComponentsDictionary,
481
- a14 as getModalDialogComponentsDictionary,
491
+ a16 as getModalDialogComponentsDictionary,
482
492
  g28 as getModalDictionary,
483
493
  g26 as getNoItemPrivilegesComponentsDictionary,
484
494
  g25 as getNoItemSelectedComponentsDictionary,
@@ -520,12 +530,12 @@ export {
520
530
  u13 as useColumnTags,
521
531
  u11 as useColumnUncertanity,
522
532
  u28 as useComponentSize,
523
- u21 as useCustomForm,
533
+ u17 as useCustomForm,
524
534
  u33 as useDataGridPersistence,
525
535
  u16 as useDistanceToNowFormatter,
526
536
  u32 as useDynamicFilterAndSort,
527
- u19 as useDynamicMFParameters,
528
- a11 as useDynamicMFParametersStore,
537
+ u20 as useDynamicMFParameters,
538
+ a13 as useDynamicMFParametersStore,
529
539
  u23 as useFormAddEdit,
530
540
  u26 as useFormFocus,
531
541
  u29 as useFormReadyForUpdate,
@@ -534,13 +544,14 @@ export {
534
544
  u35 as useIsVisible,
535
545
  u24 as useModal,
536
546
  u34 as usePopoverContainer,
537
- u17 as usePopupsStore,
547
+ u18 as usePopupsStore,
538
548
  u36 as useSizeContainer,
539
549
  u30 as useStateRef,
540
- u20 as useStepper,
550
+ u21 as useStepper,
541
551
  u31 as useSvgColor,
542
552
  u25 as useTab,
543
- u18 as useWindowToolsMF,
553
+ u37 as useWatchTyped,
554
+ u19 as useWindowToolsMF,
544
555
  v2 as varBounce,
545
556
  v3 as varContainer,
546
557
  v as varFade,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.29",
3
+ "version": "9.3.30-JA.beta-1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {