@m4l/components 9.4.17 → 9.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/types.d.ts +9 -2
- package/components/DaysOfWeekPicker/DaysOfWeekPicker.d.ts +33 -0
- package/components/DaysOfWeekPicker/DaysOfWeekPicker.js +81 -0
- package/components/DaysOfWeekPicker/DaysOfWeekPicker.styles.d.ts +2 -0
- package/components/DaysOfWeekPicker/DaysOfWeekPicker.styles.js +99 -0
- package/components/DaysOfWeekPicker/DaysOfWeekPicker.test.d.ts +1 -0
- package/components/DaysOfWeekPicker/constants.d.ts +12 -0
- package/components/DaysOfWeekPicker/constants.js +11 -0
- package/components/DaysOfWeekPicker/dictionary.d.ts +1 -0
- package/components/DaysOfWeekPicker/dictionary.js +6 -0
- package/components/DaysOfWeekPicker/helpers/getDaysOfWeekFromDictionary.d.ts +29 -0
- package/components/DaysOfWeekPicker/helpers/getDaysOfWeekFromDictionary.js +12 -0
- package/components/DaysOfWeekPicker/helpers/getDaysOfWeekFromDictionary.test.d.ts +1 -0
- package/components/DaysOfWeekPicker/helpers/index.d.ts +1 -0
- package/components/DaysOfWeekPicker/helpers/index.js +1 -0
- package/components/DaysOfWeekPicker/hooks/index.d.ts +2 -0
- package/components/DaysOfWeekPicker/hooks/types.d.ts +29 -0
- package/components/DaysOfWeekPicker/hooks/useDaysOfWeekPicker.d.ts +9 -0
- package/components/DaysOfWeekPicker/hooks/useDaysOfWeekPicker.js +71 -0
- package/components/DaysOfWeekPicker/hooks/useDaysOfWeekPicker.test.d.ts +1 -0
- package/components/DaysOfWeekPicker/index.d.ts +3 -0
- package/components/DaysOfWeekPicker/index.js +1 -0
- package/components/DaysOfWeekPicker/slots/DaysOfWeekPickerEnum.d.ts +5 -0
- package/components/DaysOfWeekPicker/slots/DaysOfWeekPickerEnum.js +9 -0
- package/components/DaysOfWeekPicker/slots/DaysOfWeekPickerSlots.d.ts +9 -0
- package/components/DaysOfWeekPicker/slots/DaysOfWeekPickerSlots.js +23 -0
- package/components/DaysOfWeekPicker/slots/index.d.ts +3 -0
- package/components/DaysOfWeekPicker/slots/index.js +1 -0
- package/components/DaysOfWeekPicker/types.d.ts +70 -0
- package/components/extended/React-resizable-panels/slots/SplitLayoutSlots.d.ts +2 -2
- package/components/hook-form/RHFDaysOfWeekPicker/RHFDaysOfWeekPicker.d.ts +26 -0
- package/components/hook-form/RHFDaysOfWeekPicker/RHFDaysOfWeekPicker.js +6 -0
- package/components/hook-form/RHFDaysOfWeekPicker/index.d.ts +1 -0
- package/components/hook-form/RHFDaysOfWeekPicker/index.js +1 -0
- package/components/hook-form/index.d.ts +1 -0
- package/components/index.d.ts +1 -0
- package/components/mui_extended/Autocomplete/Autocomplete.js +7 -3
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +76 -45
- package/components/mui_extended/Autocomplete/constants.d.ts +23 -0
- package/components/mui_extended/Autocomplete/constants.js +9 -1
- package/components/mui_extended/Autocomplete/hooks/useAutocomplete/useAutocomplete.js +9 -4
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.d.ts +5 -1
- package/components/mui_extended/Autocomplete/hooks/useEndAdornments.js +42 -10
- package/components/mui_extended/Autocomplete/hooks/useMultipleChips.js +25 -6
- package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.d.ts +6 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteEnum.js +8 -1
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.d.ts +3 -0
- package/components/mui_extended/Autocomplete/slots/AutocompleteSlots.js +9 -4
- package/components/mui_extended/Autocomplete/subcomponents/renderOptions/index.js +4 -3
- package/components/mui_extended/Autocomplete/types.d.ts +9 -2
- package/hocs/index.d.ts +2 -0
- package/hocs/withRHFController/constants.d.ts +8 -0
- package/hocs/withRHFController/constants.js +8 -0
- package/hocs/withRHFController/index.d.ts +37 -0
- package/hocs/withRHFController/index.js +95 -0
- package/hocs/withRHFController/slots/WithRHFControllerEnum.d.ts +3 -0
- package/hocs/withRHFController/slots/WithRHFControllerEnum.js +7 -0
- package/hocs/withRHFController/slots/WithRHFControllerSlots.d.ts +5 -0
- package/hocs/withRHFController/slots/WithRHFControllerSlots.js +11 -0
- package/hocs/withRHFController/slots/index.d.ts +2 -0
- package/hocs/withRHFController/slots/index.js +1 -0
- package/hocs/withRHFController/types.d.ts +70 -0
- package/hocs/withRHFController/withRHFController.styles.d.ts +5 -0
- package/hocs/withRHFController/withRHFController.styles.js +14 -0
- package/hocs/withRHFController/withRHFController.test.d.ts +1 -0
- package/index.js +111 -105
- package/package.json +1 -1
|
@@ -3,8 +3,8 @@ import { styled } from "@mui/material/styles";
|
|
|
3
3
|
import { C as Chip } from "../../../Chip/Chip.js";
|
|
4
4
|
import { I as Image } from "../../../Image/Image.js";
|
|
5
5
|
import { a as autocompleteSyles } from "../Autocomplete.styles.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { a as AUTOCOMPLETE_KEY_COMPONENT } from "../constants.js";
|
|
7
|
+
import { a as AutocompleteSlots } from "./AutocompleteEnum.js";
|
|
8
8
|
import { S as Skeleton } from "../../Skeleton/Skeleton.js";
|
|
9
9
|
import { T as TextField } from "../../TextField/TextField.js";
|
|
10
10
|
import { P as Popper } from "../../Popper/Popper.js";
|
|
@@ -76,6 +76,10 @@ const ContainerWrapperStyled = styled("div", {
|
|
|
76
76
|
name: AUTOCOMPLETE_KEY_COMPONENT,
|
|
77
77
|
slot: AutocompleteSlots.containerWrapper
|
|
78
78
|
})(autocompleteSyles?.containerWrapper);
|
|
79
|
+
const WrapperEndAdornmentStyled = styled("div", {
|
|
80
|
+
name: AUTOCOMPLETE_KEY_COMPONENT,
|
|
81
|
+
slot: AutocompleteSlots.wrapperEndAdornment
|
|
82
|
+
})(autocompleteSyles?.wrapperEndAdornment);
|
|
79
83
|
export {
|
|
80
84
|
AutocompleteRootStyled as A,
|
|
81
85
|
CircularProgressStyled as C,
|
|
@@ -83,9 +87,10 @@ export {
|
|
|
83
87
|
PopperComponentStyled as P,
|
|
84
88
|
RenderInputStyled as R,
|
|
85
89
|
SkeletonAutocompleteStyled as S,
|
|
86
|
-
|
|
90
|
+
WrapperEndAdornmentStyled as W,
|
|
87
91
|
AdormentsStyled as a,
|
|
88
92
|
ContainerMultipleValuesStyled as b,
|
|
89
93
|
ContainerWrapperStyled as c,
|
|
90
|
-
ChipStyled as d
|
|
94
|
+
ChipStyled as d,
|
|
95
|
+
WrapperStartAdornmentStyled as e
|
|
91
96
|
};
|
|
@@ -40,12 +40,12 @@ const RenderOptionComponent = ({
|
|
|
40
40
|
disabled: option.disabled,
|
|
41
41
|
startIcon: processedStartAdornment,
|
|
42
42
|
endIcon: processedEndAdornment
|
|
43
|
-
}
|
|
44
|
-
option.label
|
|
43
|
+
}
|
|
45
44
|
);
|
|
46
45
|
};
|
|
47
46
|
const MemoizedRenderOptionComponent = memo(RenderOptionComponent);
|
|
48
47
|
const renderOption = (optionProps, option, getOptionStartAdornment, getOptionEndAdornment) => {
|
|
48
|
+
const uniqueKey = optionProps.key || option?.id?.toString() || option.label;
|
|
49
49
|
return /* @__PURE__ */ jsx(
|
|
50
50
|
MemoizedRenderOptionComponent,
|
|
51
51
|
{
|
|
@@ -53,7 +53,8 @@ const renderOption = (optionProps, option, getOptionStartAdornment, getOptionEnd
|
|
|
53
53
|
option,
|
|
54
54
|
getOptionStartAdornment,
|
|
55
55
|
getOptionEndAdornment
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
|
+
uniqueKey
|
|
57
58
|
);
|
|
58
59
|
};
|
|
59
60
|
export {
|
|
@@ -90,6 +90,10 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined> exte
|
|
|
90
90
|
* Icono o adorno que se muestra al inicio del autocomplete.
|
|
91
91
|
*/
|
|
92
92
|
startAdornment?: ReactElement;
|
|
93
|
+
/**
|
|
94
|
+
* Clase de css para el autocomplete.
|
|
95
|
+
*/
|
|
96
|
+
className?: string;
|
|
93
97
|
}
|
|
94
98
|
export type ResourceType = {
|
|
95
99
|
resource: ReactNode;
|
|
@@ -98,13 +102,16 @@ export type ResourceType = {
|
|
|
98
102
|
/**
|
|
99
103
|
* Represents the owner state of the Autocomplete component for styling purposes.
|
|
100
104
|
*/
|
|
101
|
-
export
|
|
105
|
+
export type AutocompleteOwnerState = {
|
|
102
106
|
error?: boolean;
|
|
103
107
|
disabled?: boolean;
|
|
104
108
|
multiple?: boolean;
|
|
105
109
|
readOnly?: boolean;
|
|
106
110
|
startAdornment?: boolean;
|
|
107
|
-
|
|
111
|
+
hasChips?: boolean;
|
|
112
|
+
size: BaseAutocompleteProps['size'];
|
|
113
|
+
variant: BaseAutocompleteProps['variant'];
|
|
114
|
+
};
|
|
108
115
|
/**
|
|
109
116
|
* Defines the types of Slots available for the Autocomplete.
|
|
110
117
|
*/
|
package/hocs/index.d.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { W as WithRHFControllerSlots } from "./slots/WithRHFControllerEnum.js";
|
|
3
|
+
const WITH_RHF_CONTROLLER_KEY = "withRHFController";
|
|
4
|
+
const WITH_RHF_CONTROLLER_CLASSES = getComponentClasses(WITH_RHF_CONTROLLER_KEY, WithRHFControllerSlots);
|
|
5
|
+
export {
|
|
6
|
+
WITH_RHF_CONTROLLER_CLASSES as W,
|
|
7
|
+
WITH_RHF_CONTROLLER_KEY as a
|
|
8
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { BaseRHFProps, ComponentWithRHFControllerProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* HOC que envuelve un componente con la funcionalidad de Controller de react-hook-form.
|
|
6
|
+
*
|
|
7
|
+
* Este HOC automatiza la integración con react-hook-form proporcionando:
|
|
8
|
+
* - Acceso automático al control del formulario mediante useFormContext
|
|
9
|
+
* - Wrapper con Controller que maneja el estado del campo
|
|
10
|
+
* - Props del field, fieldState y formState pasadas automáticamente al componente envuelto
|
|
11
|
+
* - Props estándar de RHF (value, onChange, onBlur, name, error) extraídas del field y fieldState para compatibilidad
|
|
12
|
+
* @template TComponentProps - Props del componente que será envuelto
|
|
13
|
+
* @template TFieldValues - Tipo de los valores del formulario
|
|
14
|
+
* @param Component - Componente a envolver
|
|
15
|
+
* @returns Componente envuelto con funcionalidad RHF
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Componente base sin RHF - puede usar field completo o props individuales
|
|
19
|
+
* const MyInput = ({ field, fieldState, value, onChange, ...props }) => (
|
|
20
|
+
* <input {...field} {...props} />
|
|
21
|
+
* );
|
|
22
|
+
*
|
|
23
|
+
* // O usar props estándar de RHF directamente
|
|
24
|
+
* const MyTextField = ({ value, onChange, onBlur, error, ...props }) => (
|
|
25
|
+
* <TextField value={value} onChange={onChange} onBlur={onBlur} error={error} {...props} />
|
|
26
|
+
* );
|
|
27
|
+
*
|
|
28
|
+
* // Componente envuelto con HOC
|
|
29
|
+
* const RHFMyInput = withRHFController(MyInput);
|
|
30
|
+
* const RHFMyTextField = withRHFController(MyTextField);
|
|
31
|
+
*
|
|
32
|
+
* // Uso en formulario
|
|
33
|
+
* <RHFMyInput name="email" label="Email" />
|
|
34
|
+
* <RHFMyTextField name="email" label="Email" />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function withRHFController<TComponentProps extends Record<string, any> = {}, TFieldValues extends FieldValues = FieldValues>(Component: React.ComponentType<ComponentWithRHFControllerProps<TComponentProps, TFieldValues>>): React.ForwardRefExoticComponent<React.PropsWithoutRef<TComponentProps & BaseRHFProps<TFieldValues>> & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useId } from "react";
|
|
3
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
4
|
+
import { W as WITH_RHF_CONTROLLER_CLASSES } from "./constants.js";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import { R as RootStyled } from "./slots/WithRHFControllerSlots.js";
|
|
7
|
+
import { L as Label } from "../../components/Label/Label.js";
|
|
8
|
+
import { H as HelperError } from "../../components/HelperError/HelperError.js";
|
|
9
|
+
function withRHFController(Component) {
|
|
10
|
+
const WrappedComponent = forwardRef((props, ref) => {
|
|
11
|
+
const {
|
|
12
|
+
name,
|
|
13
|
+
control: controlProp,
|
|
14
|
+
// Puede permitir que el componente se use fuera de un FormProvider
|
|
15
|
+
label,
|
|
16
|
+
mandatory,
|
|
17
|
+
mandatoryMessage,
|
|
18
|
+
helperMessage,
|
|
19
|
+
size = "medium",
|
|
20
|
+
disabled,
|
|
21
|
+
id,
|
|
22
|
+
htmlFor,
|
|
23
|
+
...componentProps
|
|
24
|
+
} = props;
|
|
25
|
+
const hookId = useId();
|
|
26
|
+
const htmlForId = id || htmlFor || hookId;
|
|
27
|
+
const contextControl = useFormContext()?.control;
|
|
28
|
+
const control = controlProp || contextControl;
|
|
29
|
+
if (!control) {
|
|
30
|
+
console.warn(
|
|
31
|
+
`withRHFController: No se encontró un control de formulario para el campo "${name}". Asegúrate de que el componente esté dentro de un FormProvider o proporciona el control como prop.`
|
|
32
|
+
);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
Controller,
|
|
37
|
+
{
|
|
38
|
+
name,
|
|
39
|
+
control,
|
|
40
|
+
render: ({ field, fieldState, formState }) => {
|
|
41
|
+
const { value, onChange, onBlur, name: fieldName } = field;
|
|
42
|
+
const isDisabled = disabled || formState.isSubmitting;
|
|
43
|
+
const controllerProps = {
|
|
44
|
+
...componentProps,
|
|
45
|
+
// Props estándar de RHF (value, onChange, onBlur, name, error)
|
|
46
|
+
// Útiles para componentes que prefieren props individuales explícitas
|
|
47
|
+
value,
|
|
48
|
+
onChange,
|
|
49
|
+
onBlur,
|
|
50
|
+
name: fieldName,
|
|
51
|
+
error: !!fieldState.error,
|
|
52
|
+
// Props del HOC que también deben pasarse al componente (size, disabled, id)
|
|
53
|
+
size,
|
|
54
|
+
disabled: isDisabled,
|
|
55
|
+
id: htmlForId,
|
|
56
|
+
// Props del Controller (field completo, fieldState, formState)
|
|
57
|
+
field,
|
|
58
|
+
fieldState,
|
|
59
|
+
formState
|
|
60
|
+
};
|
|
61
|
+
return /* @__PURE__ */ jsxs(RootStyled, { ref, className: clsx(WITH_RHF_CONTROLLER_CLASSES.root), children: [
|
|
62
|
+
label && /* @__PURE__ */ jsx(
|
|
63
|
+
Label,
|
|
64
|
+
{
|
|
65
|
+
size,
|
|
66
|
+
label,
|
|
67
|
+
htmlFor: htmlForId,
|
|
68
|
+
mandatory,
|
|
69
|
+
mandatoryMessage,
|
|
70
|
+
helperMessage,
|
|
71
|
+
disabled: isDisabled,
|
|
72
|
+
error: !!fieldState.error
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(Component, { ...controllerProps, ref: field.ref, size, disabled: isDisabled }),
|
|
76
|
+
fieldState.error?.message && /* @__PURE__ */ jsx(
|
|
77
|
+
HelperError,
|
|
78
|
+
{
|
|
79
|
+
message: fieldState.error.message,
|
|
80
|
+
size,
|
|
81
|
+
htmlFor: htmlForId
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
const componentName = Component.displayName || Component.name || "Component";
|
|
90
|
+
WrappedComponent.displayName = `withRHFController(${componentName})`;
|
|
91
|
+
return WrappedComponent;
|
|
92
|
+
}
|
|
93
|
+
export {
|
|
94
|
+
withRHFController as w
|
|
95
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elemento div de react construido a través de styled,
|
|
3
|
+
* sirve para agrupar el contenido del HOC `withRHFController`
|
|
4
|
+
*/
|
|
5
|
+
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { a as WITH_RHF_CONTROLLER_KEY } from "../constants.js";
|
|
3
|
+
import { W as WithRHFControllerSlots } from "./WithRHFControllerEnum.js";
|
|
4
|
+
import { w as withRHFControllerStyles } from "../withRHFController.styles.js";
|
|
5
|
+
const RootStyled = styled("div", {
|
|
6
|
+
name: WITH_RHF_CONTROLLER_KEY,
|
|
7
|
+
slot: WithRHFControllerSlots.root
|
|
8
|
+
})(withRHFControllerStyles?.root);
|
|
9
|
+
export {
|
|
10
|
+
RootStyled as R
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Control, FieldPath, FieldValues, ControllerRenderProps, ControllerFieldState, FormState } from 'react-hook-form';
|
|
2
|
+
import { Theme } from '@mui/material';
|
|
3
|
+
import { M4LOverridesStyleRules } from '../../@types/augmentations';
|
|
4
|
+
import { WithRHFControllerSlots } from './slots/WithRHFControllerEnum';
|
|
5
|
+
import { WITH_RHF_CONTROLLER_KEY } from './constants';
|
|
6
|
+
import { LabelPropsBase } from '../../components/Label/types';
|
|
7
|
+
import { Sizes } from '@m4l/styles';
|
|
8
|
+
/**
|
|
9
|
+
* Props que el componente envuelto recibirá del Controller de react-hook-form
|
|
10
|
+
*/
|
|
11
|
+
export interface RHFControllerRenderProps<TFieldValues extends FieldValues = FieldValues> {
|
|
12
|
+
/** Props del field del Controller */
|
|
13
|
+
field: ControllerRenderProps<TFieldValues, FieldPath<TFieldValues>>;
|
|
14
|
+
/** Estado del field (error, invalid, etc.) */
|
|
15
|
+
fieldState: ControllerFieldState;
|
|
16
|
+
/** Estado del formulario completo */
|
|
17
|
+
formState: FormState<TFieldValues>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Props base que todos los componentes RHF deben tener
|
|
21
|
+
*/
|
|
22
|
+
export interface BaseRHFProps<TFieldValues extends FieldValues = FieldValues> extends LabelPropsBase {
|
|
23
|
+
/** Nombre del campo en el formulario */
|
|
24
|
+
name: FieldPath<TFieldValues>;
|
|
25
|
+
/** Control del formulario (opcional, se obtiene automáticamente de useFormContext si no se proporciona) */
|
|
26
|
+
control?: Control<TFieldValues>;
|
|
27
|
+
/** Tamaño del componente */
|
|
28
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
29
|
+
/** Indica si el componente está deshabilitado */
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/** Identificador único para el campo */
|
|
32
|
+
id?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Props que el HOC añade al componente envuelto
|
|
36
|
+
*/
|
|
37
|
+
export interface WithRHFControllerProps<TFieldValues extends FieldValues = FieldValues> extends BaseRHFProps<TFieldValues> {
|
|
38
|
+
/** Props del render del Controller */
|
|
39
|
+
renderProps?: RHFControllerRenderProps<TFieldValues>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Props adicionales que el HOC pasa al componente envuelto
|
|
43
|
+
*/
|
|
44
|
+
export interface WithRHFControllerAdditionalProps {
|
|
45
|
+
/** Valor del campo */
|
|
46
|
+
value?: any;
|
|
47
|
+
/** Función de cambio de valor */
|
|
48
|
+
onChange?: (...event: any[]) => void;
|
|
49
|
+
/** Función de blur (puede ser de diferentes tipos según el componente) */
|
|
50
|
+
onBlur?: (...args: any[]) => void;
|
|
51
|
+
/** Nombre del campo */
|
|
52
|
+
name?: string;
|
|
53
|
+
/** Indica si hay error */
|
|
54
|
+
error?: boolean;
|
|
55
|
+
/** Tamaño del componente */
|
|
56
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
57
|
+
/** Indica si el componente está deshabilitado */
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
/** Identificador único para el campo */
|
|
60
|
+
id?: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Tipo para el componente que será envuelto por el HOC
|
|
64
|
+
*/
|
|
65
|
+
export type ComponentWithRHFControllerProps<TComponentProps extends Record<string, any> = {}, TFieldValues extends FieldValues = FieldValues> = TComponentProps & RHFControllerRenderProps<TFieldValues> & Partial<WithRHFControllerAdditionalProps>;
|
|
66
|
+
/**
|
|
67
|
+
* Define los estilos del HOC `withRHFController`. Permite la personalización parcial
|
|
68
|
+
* de las reglas de estilo mediante `M4LOverridesStyleRules`.
|
|
69
|
+
*/
|
|
70
|
+
export type WithRHFControllerStyles = M4LOverridesStyleRules<WithRHFControllerSlots, typeof WITH_RHF_CONTROLLER_KEY, Theme>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const withRHFControllerStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilos para el contenedor principal del componente.
|
|
4
|
+
*/
|
|
5
|
+
root: ({ theme }) => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexDirection: "column",
|
|
8
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
9
|
+
width: "100%"
|
|
10
|
+
})
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
withRHFControllerStyles as w
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|