@m4l/components 9.3.13 → 9.3.15-BE100925-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 (97) hide show
  1. package/@types/types.d.ts +207 -61
  2. package/components/MenuActions/MenuActions.js +3 -2
  3. package/components/MenuActions/MenuActions.styles.js +1 -1
  4. package/components/MenuActions/constants.d.ts +1 -0
  5. package/components/MenuActions/constants.js +12 -1
  6. package/components/MenuActions/slots/MenuActionsSlots.js +1 -1
  7. package/components/Stepper/Stepper.d.ts +8 -0
  8. package/components/Stepper/Stepper.js +70 -0
  9. package/components/Stepper/Stepper.styles.d.ts +2 -0
  10. package/components/Stepper/Stepper.styles.js +298 -0
  11. package/components/Stepper/constants.d.ts +2 -0
  12. package/components/Stepper/constants.js +6 -0
  13. package/components/Stepper/dictionary.d.ts +8 -0
  14. package/components/Stepper/dictionary.js +14 -0
  15. package/components/Stepper/helpers/evaluateVisibilityStepCondition/index.d.ts +9 -0
  16. package/components/Stepper/helpers/evaluateVisibilityStepCondition/index.js +17 -0
  17. package/components/Stepper/helpers/findNextVisibleValidStep/index.d.ts +10 -0
  18. package/components/Stepper/helpers/findNextVisibleValidStep/index.js +13 -0
  19. package/components/Stepper/helpers/findPrevVisibleValidStep/index.d.ts +10 -0
  20. package/components/Stepper/helpers/findPrevVisibleValidStep/index.js +13 -0
  21. package/components/Stepper/helpers/index.d.ts +4 -0
  22. package/components/Stepper/helpers/index.js +1 -0
  23. package/components/Stepper/helpers/isLastVisibleValidStep/index.d.ts +10 -0
  24. package/components/Stepper/helpers/isLastVisibleValidStep/index.js +16 -0
  25. package/components/Stepper/hooks/useIsLastVisibleValidStep/index.d.ts +6 -0
  26. package/components/Stepper/hooks/useIsLastVisibleValidStep/index.js +25 -0
  27. package/components/Stepper/hooks/useStepper/index.d.ts +5 -0
  28. package/components/Stepper/hooks/useStepper/index.js +14 -0
  29. package/components/Stepper/hooks/useStepperActions/index.d.ts +8 -0
  30. package/components/Stepper/hooks/useStepperActions/index.js +76 -0
  31. package/components/Stepper/icons.d.ts +9 -0
  32. package/components/Stepper/icons.js +12 -0
  33. package/components/Stepper/index.d.ts +14 -0
  34. package/components/Stepper/index.js +1 -0
  35. package/components/Stepper/slots/StepperEnum.d.ts +28 -0
  36. package/components/Stepper/slots/StepperEnum.js +38 -0
  37. package/components/Stepper/slots/StepperSlot.d.ts +63 -0
  38. package/components/Stepper/slots/StepperSlot.js +107 -0
  39. package/components/Stepper/store/StepperContext/index.d.ts +17 -0
  40. package/components/Stepper/store/StepperContext/index.js +91 -0
  41. package/components/Stepper/store/StepperStore/index.d.ts +16 -0
  42. package/components/Stepper/store/StepperStore/index.js +133 -0
  43. package/components/Stepper/store/types.d.ts +63 -0
  44. package/components/Stepper/subcomponents/ContentArea/index.d.ts +6 -0
  45. package/components/Stepper/subcomponents/ContentArea/index.js +24 -0
  46. package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperIcon/index.d.ts +4 -0
  47. package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperIcon/index.js +26 -0
  48. package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperTitle/index.d.ts +4 -0
  49. package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperTitle/index.js +23 -0
  50. package/components/Stepper/subcomponents/StepArea/index.d.ts +6 -0
  51. package/components/Stepper/subcomponents/StepArea/index.js +149 -0
  52. package/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.d.ts +5 -0
  53. package/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.js +82 -0
  54. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +4 -0
  55. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +25 -0
  56. package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.d.ts +4 -0
  57. package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +42 -0
  58. package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.d.ts +4 -0
  59. package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +49 -0
  60. package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.d.ts +4 -0
  61. package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +20 -0
  62. package/components/Stepper/subcomponents/StepperButtons/index.d.ts +4 -0
  63. package/components/Stepper/subcomponents/StepperButtons/index.js +1 -0
  64. package/components/Stepper/subcomponents/StepperContent/index.d.ts +7 -0
  65. package/components/Stepper/subcomponents/StepperContent/index.js +23 -0
  66. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.d.ts +6 -0
  67. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +41 -0
  68. package/components/Stepper/subcomponents/StepperFooter/index.d.ts +6 -0
  69. package/components/Stepper/subcomponents/StepperFooter/index.js +48 -0
  70. package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterLeftActions/index.d.ts +6 -0
  71. package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterLeftActions/index.js +9 -0
  72. package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.d.ts +6 -0
  73. package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.js +33 -0
  74. package/components/Stepper/types.d.ts +165 -0
  75. package/components/WindowBase/WindowBase.styles.js +1 -1
  76. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +3 -35
  77. package/components/hook-form/RHFAutocomplete/types.d.ts +1 -6
  78. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  79. package/components/hook-form/RHFormContext/index.js +5 -4
  80. package/components/hook-form/RHFormContext/types.d.ts +3 -1
  81. package/components/index.d.ts +1 -0
  82. package/components/mui_extended/Autocomplete/types.d.ts +45 -2
  83. package/components/mui_extended/Badge/Badge.styles.js +4 -2
  84. package/components/mui_extended/IconButton/IconButton.js +12 -2
  85. package/components/mui_extended/IconButton/IconButton.styles.js +7 -7
  86. package/components/mui_extended/IconButton/constants.js +8 -1
  87. package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +11 -0
  88. package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.js +44 -0
  89. package/helpers/getStepsAndValidationSchema/index.d.ts +2 -0
  90. package/helpers/getStepsAndValidationSchema/index.js +1 -0
  91. package/helpers/getStepsAndValidationSchema/types.d.ts +21 -0
  92. package/helpers/getStepsAndValidationSchema/types.js +1 -0
  93. package/helpers/index.d.ts +1 -0
  94. package/helpers/index.js +1 -0
  95. package/index.d.ts +1 -0
  96. package/index.js +80 -52
  97. package/package.json +1 -1
@@ -0,0 +1,165 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { Theme } from '@mui/material/styles';
3
+ import { Sizes } from '@m4l/styles';
4
+ import { ContentAreaSlots, ContentSlots, StepperFooterSlots, StepperSlots } from './slots/StepperEnum';
5
+ import { STEPPER_PREFIX_NAME } from './constants';
6
+ import { M4LOverridesStyleRules } from '../../@types/augmentations';
7
+ import { Step as StepComponent } from './subcomponents/StepperContent/subcomponents/Step';
8
+ export type Orientation = 'horizontal' | 'vertical';
9
+ export type IndicatorType = 'number' | 'dot';
10
+ export type FormData = Record<string, string | number | boolean | null | undefined>;
11
+ export type VisibilityData = Record<string, string | number | boolean | null | undefined>;
12
+ export type Step = {
13
+ /**
14
+ * Clave única que identifica el step.
15
+ */
16
+ key: string;
17
+ /**
18
+ * Título del step.
19
+ */
20
+ title: string;
21
+ /**
22
+ * Descripción del step.
23
+ */
24
+ description?: string;
25
+ /**
26
+ * Icono del step.
27
+ */
28
+ icon?: string;
29
+ /**
30
+ * Array con los campos que se deben validar en el step.
31
+ */
32
+ validationFields?: string[];
33
+ /**
34
+ * Función que determina si el step se debe mostrar.
35
+ * @param formData - Datos del formulario.
36
+ * @param visibilityData - Datos adicionales para evaluar visibilidad (ej: objectId).
37
+ * @returns true si el step se debe mostrar, false en caso contrario.
38
+ * Si no se proporciona, el step siempre se muestra.
39
+ */
40
+ visibilityCondition?: (formData?: FormData, visibilityData?: VisibilityData) => boolean;
41
+ };
42
+ export interface StepperProps {
43
+ /**
44
+ * Children opcional para inyectar componentes adicionales
45
+ */
46
+ children?: React.ReactNode;
47
+ /**
48
+ * "storeId" identificador del store
49
+ */
50
+ storeId?: string;
51
+ /**
52
+ * "storeDevtoolsEnabled" determina si se debe usar devtools para el store
53
+ */
54
+ storeDevtoolsEnabled?: boolean;
55
+ /**
56
+ * "visibleTitle": Propiedad que ejecuta condición para visualizar los titulos en el SteppArea
57
+ */
58
+ visibleTitle?: boolean;
59
+ /**
60
+ * Array con la configuración de cada step.
61
+ */
62
+ steps: Step[];
63
+ /**
64
+ * Datos adicionales para evaluar visibilityCondition de los steps.
65
+ * Por ejemplo, objectId para determinar si mostrar steps después del submit inicial.
66
+ */
67
+ visibilityData?: VisibilityData;
68
+ /**
69
+ * Indica que tipo de indicador se usará en el Stepper.
70
+ * Puede ser 'number' para números o 'dot' para puntos.
71
+ */
72
+ indicatorType?: IndicatorType;
73
+ /**
74
+ * "orientation" define la orientación del Stepper.
75
+ */
76
+ orientation?: Orientation;
77
+ /**
78
+ * Tamaño del componente, puede ser uno de los valores definidos en 'small' , 'medium'
79
+ */
80
+ size?: Extract<Sizes, 'small' | 'medium'>;
81
+ /**
82
+ * Clase personalizada para el Stepper.
83
+ */
84
+ className?: string;
85
+ }
86
+ /**
87
+ * Props del StepperContent
88
+ */
89
+ export interface StepperContentProps {
90
+ /**
91
+ * Array de componentes Step
92
+ */
93
+ children: ReactElement<typeof StepComponent>[];
94
+ }
95
+ /**
96
+ * Props del Step
97
+ */
98
+ export interface StepProps {
99
+ /**
100
+ * Clave única del step que determina cuándo se renderiza
101
+ */
102
+ stepKey: string;
103
+ /**
104
+ * Contenido del step
105
+ */
106
+ children: ReactNode;
107
+ }
108
+ /**
109
+ * Props del ContentArea
110
+ */
111
+ export interface ContentAreaProps {
112
+ children: ReactNode;
113
+ }
114
+ /**
115
+ * Props del Indicator
116
+ */
117
+ export interface IndicatorProps {
118
+ /**
119
+ * El número del paso actual.
120
+ */
121
+ step: number;
122
+ /**
123
+ * Indica si el paso es el actual.
124
+ */
125
+ currentStep: number;
126
+ /**
127
+ * El número total de pasos.
128
+ */
129
+ totalSteps: number;
130
+ /**
131
+ * El índice original del paso en el array completo de pasos.
132
+ * Se usa para buscar el estado de validación en stepValidationStatus.
133
+ */
134
+ originalStepIndex: number;
135
+ }
136
+ /**
137
+ * Props del StepperFooter
138
+ */
139
+ export interface StepperFooterProps {
140
+ children?: ReactNode;
141
+ }
142
+ /**
143
+ * Props del StepperFooterLeftActions
144
+ */
145
+ export interface StepperFooterLeftActionsProps {
146
+ children?: ReactNode;
147
+ }
148
+ /**
149
+ * Props del StepperFooterRightActions
150
+ */
151
+ export interface StepperFooterRightActionsProps {
152
+ children?: ReactNode;
153
+ }
154
+ export interface StepperOwnerState extends Pick<StepperProps, 'visibleTitle'>, Record<string, unknown> {
155
+ step?: number;
156
+ currentStep?: number;
157
+ totalSteps?: number;
158
+ orientation?: Orientation;
159
+ indicatorType?: IndicatorType;
160
+ size?: Extract<Sizes, 'small' | 'medium'>;
161
+ stepValidationStatus?: Record<number, boolean>;
162
+ isStepVisible?: boolean;
163
+ }
164
+ export type StepperSlotsType = StepperSlots | ContentSlots | ContentAreaSlots | StepperFooterSlots;
165
+ export type StepperStyles = M4LOverridesStyleRules<StepperSlotsType, typeof STEPPER_PREFIX_NAME, Theme>;
@@ -291,7 +291,7 @@ const windowBaseStyles = {
291
291
  }
292
292
  }
293
293
  },
294
- "&.MuiButtonBase-root:not(:hover, :active, :focus) .M4LIcon-root .M4LIcon-icon": {
294
+ "&.MuiButtonBase-root:not(:hover, :active, :focus, .M4LIconButton-selected) .M4LIcon-root .M4LIcon-icon": {
295
295
  backgroundColor: `${theme.vars.palette.text.disabled} !important`
296
296
  }
297
297
  },
@@ -1,7 +1,4 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { getPropertyByString } from "@m4l/core";
3
- import { useIsMobile } from "@m4l/graphics";
4
- import { useTheme } from "@mui/material";
5
2
  import { useId, useState, useCallback, useEffect } from "react";
6
3
  import { useFormContext, Controller } from "react-hook-form";
7
4
  import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
@@ -13,28 +10,22 @@ function RHFAutocomplete(props) {
13
10
  getOptionLabel,
14
11
  isOptionEqualToValue,
15
12
  label,
16
- color,
17
13
  options,
18
14
  disabled,
19
15
  onOpen,
20
16
  onClose,
21
17
  loading,
22
- variant,
23
18
  helperMessage,
24
19
  size,
25
20
  onChangeFilterParmsLocal,
26
21
  mandatory,
27
22
  mandatoryMessage,
28
23
  multiple,
29
- imageScale = true,
30
- imageRepeat,
31
24
  refresh
32
25
  // onChange: onChangeRHF,
33
26
  } = props;
34
27
  const htmlForId = useId();
35
- const theme = useTheme();
36
28
  const [open, setOpen] = useState(false);
37
- const isDesktop = !useIsMobile();
38
29
  const onCloseLocal = useCallback((event, reason) => {
39
30
  setOpen(false);
40
31
  if (onClose) {
@@ -59,34 +50,11 @@ function RHFAutocomplete(props) {
59
50
  },
60
51
  [getOptionLabel]
61
52
  );
62
- const paletteColor = getPropertyByString(
63
- theme.vars.palette,
64
- disabled ? "default" : color || "default",
65
- theme.vars.palette.default
66
- );
67
53
  const {
68
- control,
69
- formState: { errors }
54
+ control
70
55
  } = useFormContext();
71
- const [currentVariant, setCurrentVariant] = useState(null);
72
- useEffect(() => {
73
- const hasError = errors[nameRHF];
74
- if (hasError) {
75
- setCurrentVariant("error");
76
- } else if (variant) {
77
- setCurrentVariant(variant);
78
- } else {
79
- setCurrentVariant(null);
80
- }
81
- }, [errors, nameRHF, variant, control]);
82
56
  const ownerState = {
83
- size: !isDesktop ? "medium" : size,
84
- semantics: currentVariant,
85
- disabled,
86
- multiple: Boolean(multiple),
87
- imageScale: Boolean(imageScale),
88
- imageRepeat: Boolean(imageRepeat),
89
- paletteColor
57
+ disabled
90
58
  };
91
59
  return /* @__PURE__ */ jsx(
92
60
  AutocompleteRootStyled,
@@ -147,7 +115,7 @@ function RHFAutocomplete(props) {
147
115
  htmlFor: htmlForId
148
116
  }
149
117
  ),
150
- currentVariant === "error" ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
118
+ error?.message ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
151
119
  ] });
152
120
  }
153
121
  }
@@ -1,4 +1,4 @@
1
- import { AutocompleteCloseReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason, AutocompleteProps as MUIAutocompleteProps, Theme, PaletteColor, PopperProps } from '@mui/material';
1
+ import { AutocompleteCloseReason, AutocompleteFreeSoloValueMapping, AutocompleteInputChangeReason, AutocompleteProps as MUIAutocompleteProps, Theme, PopperProps } from '@mui/material';
2
2
  import { ComponentPalletColor, Sizes } from '@m4l/styles';
3
3
  import { TextFieldProps } from '../../mui_extended/TextField/types';
4
4
  import { RFHAUTOCOMPLETE_KEY_COMPONENT } from './constants';
@@ -52,11 +52,6 @@ export interface RHFAutocompleteProps<T = any, Multiple extends boolean | undefi
52
52
  */
53
53
  export interface RHFAutocompleteOwnerState extends Pick<RHFAutocompleteProps<any>, 'size' | 'disabled' | 'variant'> {
54
54
  disabled?: boolean;
55
- semantics: RHFAutocompleteVariants | 'error' | null;
56
- multiple: boolean;
57
- imageScale?: boolean;
58
- imageRepeat?: boolean;
59
- paletteColor: PaletteColor;
60
55
  }
61
56
  /**
62
57
  * Defines the types of Slots available for the Autocomplete.
@@ -3,7 +3,7 @@ import { CustomFormArguments, FormProviderCustomProps, FormProviderProps } from
3
3
  /**
4
4
  * TODO: Documentar
5
5
  */
6
- export declare function useCustomForm({ validationSchema, values, statusLoad }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues>;
6
+ export declare function useCustomForm({ validationSchema, values, statusLoad, mode }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues>;
7
7
  /**
8
8
  * TODO: Documentar
9
9
  */
@@ -6,10 +6,11 @@ import { yupResolver } from "@hookform/resolvers/yup";
6
6
  import { F as FormProviderRoot } from "./styles.js";
7
7
  import { R as RHFormProviderUtilityClasses } from "./classes/index.js";
8
8
  const classes = RHFormProviderUtilityClasses();
9
- function useCustomForm({ validationSchema, values, statusLoad }) {
9
+ function useCustomForm({ validationSchema, values, statusLoad, mode }) {
10
10
  const formMethods = useForm({
11
11
  resolver: yupResolver(validationSchema),
12
- defaultValues: values
12
+ defaultValues: values,
13
+ ...mode && { mode }
13
14
  });
14
15
  useEffect(() => {
15
16
  if (statusLoad === "reload_values_provider") {
@@ -41,8 +42,8 @@ function FormProviderCustom(props) {
41
42
  return /* @__PURE__ */ jsx(FormProvider, { ...props, children: /* @__PURE__ */ jsx(FormProviderRoot, { className: clsx(classes.root, className), onSubmit: handleSubmit(onSubmit), children }) });
42
43
  }
43
44
  function RHFormProvider(props) {
44
- const { children, onSubmit, values, validationSchema, statusLoad = "ready", className } = props;
45
- const formMethods = useCustomForm({ validationSchema, statusLoad, values });
45
+ const { children, onSubmit, values, validationSchema, statusLoad = "ready", className, mode } = props;
46
+ const formMethods = useCustomForm({ validationSchema, statusLoad, values, mode });
46
47
  return /* @__PURE__ */ jsx(
47
48
  FormProviderCustom,
48
49
  {
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { FieldValues, FormProviderProps as RHFormProviderProps } from 'react-hook-form';
2
+ import { FieldValues, FormProviderProps as RHFormProviderProps, Mode } from 'react-hook-form';
3
3
  export type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
4
4
  export type FormInitialValues = FieldValues;
5
5
  export interface FormProviderProps {
@@ -9,10 +9,12 @@ export interface FormProviderProps {
9
9
  validationSchema: any;
10
10
  statusLoad?: FormStatusLoad;
11
11
  className?: string;
12
+ mode?: Mode;
12
13
  }
13
14
  export type FormProviderCustomProps = RHFormProviderProps & FormProviderProps;
14
15
  export interface CustomFormArguments {
15
16
  values: FormInitialValues;
16
17
  validationSchema: any;
17
18
  statusLoad?: FormStatusLoad;
19
+ mode?: Mode;
18
20
  }
@@ -51,3 +51,4 @@ export * from './ModalDialog';
51
51
  export * from './SettingsLayout';
52
52
  export * from './Pager';
53
53
  export * from './ScrollBar';
54
+ export * from './Stepper';
@@ -8,30 +8,72 @@ import { M4LOverridesStyleRules } from '../../../@types/augmentations';
8
8
  export type GetOptionString<T> = (option: T | null) => string;
9
9
  export type AutocompleteVariants = 'outlined' | 'text';
10
10
  export interface BaseAutocompleteProps {
11
+ /**
12
+ * The size of the autocomplete input field.
13
+ */
11
14
  size?: Extract<Sizes, 'small' | 'medium'>;
15
+ /**
16
+ * The variant of the autocomplete (e.g., outlined, contained, text).
17
+ */
12
18
  variant?: AutocompleteVariants;
19
+ /**
20
+ * Custom data-testid for testing purposes.
21
+ */
13
22
  dataTestid?: string;
14
23
  }
15
24
  /**
16
25
  * Props for the unified Autocomplete component.
17
26
  * Supports both single and multiple selection, and two types: `text` and `image`.
18
27
  */
19
- export interface AutocompleteProps<T, Multiple extends boolean | undefined> extends Pick<MUIAutocompleteProps<T, Multiple, undefined, false>, 'options' | 'onOpen' | 'onClose' | 'loading' | 'disabled'>, Pick<TextFieldProps, 'error'>, BaseAutocompleteProps {
28
+ export interface AutocompleteProps<T, Multiple extends boolean | undefined> extends Pick<MUIAutocompleteProps<T, Multiple, undefined, false>, 'options' | 'onOpen' | 'onClose' | 'loading' | 'disabled' | 'open'>, Pick<TextFieldProps, 'error' | 'focused'>, BaseAutocompleteProps {
29
+ /**
30
+ * Indica si el campo de texto está en modo de solo lectura.
31
+ * readOnly={true}
32
+ */
33
+ readOnly?: boolean;
34
+ /**
35
+ * The placeholder of the autocomplete.
36
+ * placeholder={}
37
+ */
38
+ placeholder?: string;
39
+ /**
40
+ * Whether multiple selections are allowed.
41
+ * multiple={true}
42
+ */
20
43
  multiple?: boolean;
21
44
  /**
22
45
  * The value of the autocomplete, supports single or multiple selection.
23
46
  * Extended to include `null` for controlled components.
24
47
  */
25
- value: T | T[] | null | null | undefined;
48
+ value: T | T[] | null | undefined;
49
+ /**
50
+ * Function to get the label for a given option.
51
+ */
26
52
  getOptionLabel: (option: T | AutocompleteFreeSoloValueMapping<false>) => string;
53
+ /**
54
+ * Function to compare if an option matches the selected value.
55
+ */
27
56
  isOptionEqualToValue: (option: T, value: T) => boolean;
28
57
  /**
29
58
  * Function to refresh the options.
30
59
  */
31
60
  refresh?: () => void;
61
+ /**
62
+ * Callback for filtering options based on user input.
63
+ */
32
64
  onChangeFilterParmsLocal?: (newValue: string, reason: AutocompleteInputChangeReason) => void;
65
+ /**
66
+ * Function to get the image URL for a given option (only for `type: 'image'`).
67
+ */
33
68
  getOptionUrlImage?: (option: T) => string;
69
+ /**
70
+ * se cambia el nativo de Autocomplete por este, debido a que el value esta disponible para procesar
71
+ * Handler for when the selected value changes.
72
+ */
34
73
  onChange: (event: ChangeEvent<{}> | undefined, value: T | T[] | null, reason: AutocompleteChangeReason) => void;
74
+ /**
75
+ * "htmlFor" attribute for the autocomplete field.
76
+ */
35
77
  htmlFor?: string;
36
78
  }
37
79
  /**
@@ -41,6 +83,7 @@ export interface AutocompleteOwnerState extends Pick<BaseAutocompleteProps, 'siz
41
83
  error?: boolean;
42
84
  disabled?: boolean;
43
85
  multiple?: boolean;
86
+ readOnly?: boolean;
44
87
  }
45
88
  /**
46
89
  * Defines the types of Slots available for the Autocomplete.
@@ -24,11 +24,13 @@ const badgeStyles = {
24
24
  ...theme.generalSettings.isMobile ? {
25
25
  height: theme.vars.size.baseSpacings.sp5,
26
26
  width: ownerState?.displayBadgeContent ? "26px" : theme.vars.size.baseSpacings.sp5,
27
- right: ownerState?.displayBadgeContent ? 4 : 0
27
+ right: ownerState?.displayBadgeContent ? 0 : 2,
28
+ top: ownerState?.displayBadgeContent ? 0 : 2
28
29
  } : {
29
30
  height: theme.vars.size.baseSpacings["sp3-5"],
30
31
  width: ownerState?.displayBadgeContent ? "23px" : theme.vars.size.baseSpacings["sp3-5"],
31
- right: ownerState?.displayBadgeContent ? 4 : 0
32
+ right: ownerState?.displayBadgeContent ? 0 : 2,
33
+ top: ownerState?.displayBadgeContent ? 0 : 2
32
34
  },
33
35
  // Estilos para variantes
34
36
  ...ownerState?.BadgeVariant === "dot" && {
@@ -88,7 +88,12 @@ const IconButton = forwardRef((props, ref) => {
88
88
  color,
89
89
  role: "button",
90
90
  ...other,
91
- className: clsx(ICON_BUTTON_CLASSES[variant], ICON_BUTTON_CLASSES.styledMUIIconButton, className),
91
+ className: clsx(
92
+ ICON_BUTTON_CLASSES[variant],
93
+ ICON_BUTTON_CLASSES.styledMUIIconButton,
94
+ selected && ICON_BUTTON_CLASSES.selected,
95
+ className
96
+ ),
92
97
  children: renderIcon(icon || src)
93
98
  }
94
99
  )
@@ -104,7 +109,12 @@ const IconButton = forwardRef((props, ref) => {
104
109
  "data-testid": "IconButtonRoot",
105
110
  color,
106
111
  ...other,
107
- className: clsx(ICON_BUTTON_CLASSES[variant], ICON_BUTTON_CLASSES.styledMUIIconButton, className),
112
+ className: clsx(
113
+ ICON_BUTTON_CLASSES[variant],
114
+ ICON_BUTTON_CLASSES.styledMUIIconButton,
115
+ selected && ICON_BUTTON_CLASSES.selected,
116
+ className
117
+ ),
108
118
  children: renderIcon(icon || src)
109
119
  }
110
120
  );
@@ -13,7 +13,7 @@ const iconButtonStyles = {
13
13
  overflow: "hidden",
14
14
  cursor: ownerState?.disabled ? "not-allowed" : "pointer",
15
15
  color: theme.vars.palette.text.primary,
16
- borderRadius: theme.size.borderRadius.r1,
16
+ borderRadius: theme.size.borderRadius["r1-5"],
17
17
  pointerEvents: ownerState?.disabled ? "none" : "auto",
18
18
  display: ownerState?.isSkeleton ? "none" : "flex",
19
19
  justifyContent: "center",
@@ -47,24 +47,24 @@ const iconButtonStyles = {
47
47
  // Estilos para la variante contained
48
48
  ...ownerState?.variant === "contained" && {
49
49
  // 🎯 Color de fondo según variante y color del componente
50
- backgroundColor: ownerState?.variant === "contained" ? ownerState?.color === "error" ? paletteColor.active : ownerState?.color === "default" ? theme.vars.palette.primary.selected : paletteColor.selected : ownerState?.color === "error" ? paletteColor.activeOpacity : paletteColor.selectedOpacity,
50
+ backgroundColor: ownerState?.variant === "contained" ? ownerState?.color === "error" ? paletteColor.active : ownerState?.color === "default" ? theme.vars.palette.primary.selected : ownerState?.color === "success" ? theme.vars.palette.success.selected : paletteColor.selected : ownerState?.color === "error" ? paletteColor.activeOpacity : paletteColor.selectedOpacity,
51
51
  "&&& .M4LIcon-icon": {
52
52
  backgroundColor: ownerState?.variant === "contained" ? theme.vars.palette.primary.contrastText : paletteColor.semanticText
53
53
  }
54
54
  },
55
55
  // Estilos para la variante text
56
56
  ...ownerState.variant === "outline" && {
57
- backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.activeOpacity : paletteColor.activeOpacity,
57
+ backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.selectedOpacity : paletteColor.selectedOpacity,
58
58
  border: theme.vars.size.borderStroke.actionInput,
59
59
  borderColor: ownerState.color === "default" ? theme.vars.palette.primary.active : paletteColor.active,
60
60
  "&&& .M4LIcon-icon": {
61
- backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.semanticText : paletteColor.selected
61
+ backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.semanticText : ownerState.color === "warning" ? paletteColor.active : paletteColor.selected
62
62
  }
63
63
  },
64
64
  ...ownerState.variant === "text" && {
65
- backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.activeOpacity : paletteColor.activeOpacity,
65
+ backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.selectedOpacity : paletteColor.selectedOpacity,
66
66
  "&&& .M4LIcon-icon": {
67
- backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.semanticText : paletteColor.selected
67
+ backgroundColor: ownerState.color === "default" ? theme.vars.palette.primary.semanticText : ownerState.color === "warning" ? paletteColor.active : paletteColor.selected
68
68
  }
69
69
  }
70
70
  } : {
@@ -128,7 +128,7 @@ const iconButtonStyles = {
128
128
  backgroundColor: paletteColor.enabled,
129
129
  // 🖼️ Color del icono
130
130
  "&&& .M4LIcon-icon": {
131
- backgroundColor: paletteColor.semanticText
131
+ backgroundColor: ownerState?.color === "default" ? paletteColor.semanticText : paletteColor.contrastText
132
132
  },
133
133
  // 🖱️ Estado Hover
134
134
  "&:hover": {
@@ -1,7 +1,14 @@
1
1
  import { g as getComponentClasses } from "../../../utils/getComponentSlotRoot.js";
2
2
  import { I as IconButtonSlots } from "./slots/IconButtonEnum.js";
3
3
  const ICON_BUTTON_KEY_COMPONENT = "M4LIconButton";
4
- const ICON_BUTTON_CLASSES = getComponentClasses(ICON_BUTTON_KEY_COMPONENT, IconButtonSlots);
4
+ const IconButtonComplementaryClasses = {
5
+ selected: "selected"
6
+ };
7
+ const IconButtonCombineClasses = {
8
+ ...IconButtonSlots,
9
+ ...IconButtonComplementaryClasses
10
+ };
11
+ const ICON_BUTTON_CLASSES = getComponentClasses(ICON_BUTTON_KEY_COMPONENT, IconButtonCombineClasses);
5
12
  export {
6
13
  ICON_BUTTON_CLASSES as I,
7
14
  ICON_BUTTON_KEY_COMPONENT as a
@@ -0,0 +1,11 @@
1
+ import { Step } from '../../components/Stepper/types';
2
+ import { GetStepsAndValidationSchemaProps } from './types';
3
+ import * as Yup from 'yup';
4
+ /**
5
+ * Hook personalizado que recibe un array de steps con validaciones y regresa todo listo para el Stepper
6
+ * Una sola configuración genera: validationSchema + steps + validationFields automáticamente
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>>>>;
10
+ steps: Step[];
11
+ };
@@ -0,0 +1,44 @@
1
+ import * as Yup from "yup";
2
+ import { e as evaluateVisibilityStepCondition } from "../../components/Stepper/helpers/evaluateVisibilityStepCondition/index.js";
3
+ function getStepsAndValidationSchema({
4
+ steps,
5
+ visibilityData
6
+ }) {
7
+ const validationSchema = (() => {
8
+ const combinedValidations = {};
9
+ const visibleSteps = steps.filter((step) => {
10
+ if (!step.visibilityCondition) {
11
+ return true;
12
+ }
13
+ return evaluateVisibilityStepCondition(step, void 0, visibilityData);
14
+ });
15
+ visibleSteps.forEach((step) => {
16
+ if (step.validationFunction) {
17
+ const validationResult = step.validationFunction();
18
+ Object.assign(combinedValidations, validationResult);
19
+ }
20
+ });
21
+ return Yup.object().shape(combinedValidations);
22
+ })();
23
+ const processedSteps = steps.map((step) => {
24
+ let validationFields = [];
25
+ if (step.validationFunction) {
26
+ const validationResult = step.validationFunction();
27
+ validationFields = Object.keys(validationResult);
28
+ }
29
+ const processedStep = {
30
+ ...step,
31
+ // Incluir todas las propiedades del step original
32
+ validationFields
33
+ // Agregar validationFields calculados
34
+ };
35
+ return processedStep;
36
+ });
37
+ return {
38
+ validationSchema,
39
+ steps: processedSteps
40
+ };
41
+ }
42
+ export {
43
+ getStepsAndValidationSchema as g
44
+ };
@@ -0,0 +1,2 @@
1
+ export { getStepsAndValidationSchema } from './getStepsAndValidationSchema';
2
+ export * from './types';
@@ -0,0 +1,21 @@
1
+ import { Step } from '../../components/Stepper/types';
2
+ /**
3
+ * Configuración completa de un step con validaciones incluidas
4
+ */
5
+ export interface StepWithValidation extends Omit<Step, 'validationFields'> {
6
+ /**
7
+ * Función de validación que retorna un objeto con esquemas Yup
8
+ * Ejemplo: ContactDataValidation
9
+ */
10
+ validationFunction?: () => Record<string, any>;
11
+ }
12
+ export interface GetStepsAndValidationSchemaProps {
13
+ /**
14
+ * Array de steps con sus validaciones incluidas
15
+ */
16
+ steps: StepWithValidation[];
17
+ /**
18
+ * Datos adicionales para visibilityCondition (ej: objectId)
19
+ */
20
+ visibilityData?: any;
21
+ }
@@ -0,0 +1 @@
1
+ export * from './getStepsAndValidationSchema';
@@ -0,0 +1 @@
1
+
package/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './hooks';
8
8
  export * from './@types/export.d';
9
9
  export * from './@types/types.d';
10
10
  export * from './utils';
11
+ export * from './helpers';
11
12
  export type { M4LOverridesStyleRules } from './@types/augmentations';