@m4l/components 9.3.11 → 9.3.12-JT270825.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 (61) hide show
  1. package/@types/types.d.ts +207 -61
  2. package/components/Stepper/Stepper.d.ts +8 -0
  3. package/components/Stepper/Stepper.styles.d.ts +2 -0
  4. package/components/Stepper/constants.d.ts +2 -0
  5. package/components/Stepper/dictionary.d.ts +8 -0
  6. package/components/Stepper/helpers/evaluateVisibilityStepCondition/index.d.ts +9 -0
  7. package/components/Stepper/helpers/findNextVisibleValidStep/index.d.ts +10 -0
  8. package/components/Stepper/helpers/findPrevVisibleValidStep/index.d.ts +10 -0
  9. package/components/Stepper/helpers/index.d.ts +4 -0
  10. package/components/Stepper/helpers/isLastVisibleValidStep/index.d.ts +10 -0
  11. package/components/Stepper/hooks/useIsLastVisibleValidStep/index.d.ts +6 -0
  12. package/components/Stepper/hooks/useStepper/index.d.ts +5 -0
  13. package/components/Stepper/hooks/useStepperActions/index.d.ts +1 -0
  14. package/components/Stepper/hooks/useStepperActions/useStepperActions.d.ts +8 -0
  15. package/components/Stepper/icons.d.ts +9 -0
  16. package/components/Stepper/index.d.ts +9 -0
  17. package/components/Stepper/slots/StepperEnum.d.ts +26 -0
  18. package/components/Stepper/slots/StepperSlot.d.ts +57 -0
  19. package/components/Stepper/store/StepperContext/index.d.ts +12 -0
  20. package/components/Stepper/store/StepperStore/index.d.ts +16 -0
  21. package/components/Stepper/store/types.d.ts +78 -0
  22. package/components/Stepper/subcomponents/ContentArea/index.d.ts +6 -0
  23. package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperIcon/index.d.ts +4 -0
  24. package/components/Stepper/subcomponents/ContentArea/subcomponents/WrapperTitle/index.d.ts +4 -0
  25. package/components/Stepper/subcomponents/StepArea/index.d.ts +6 -0
  26. package/components/Stepper/subcomponents/StepArea/subcomponents/Inidicator/index.d.ts +5 -0
  27. package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +4 -0
  28. package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.d.ts +4 -0
  29. package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.d.ts +4 -0
  30. package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.d.ts +4 -0
  31. package/components/Stepper/subcomponents/StepperButtons/index.d.ts +4 -0
  32. package/components/Stepper/subcomponents/StepperContent/index.d.ts +7 -0
  33. package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.d.ts +6 -0
  34. package/components/Stepper/subcomponents/StepperFooter/index.d.ts +6 -0
  35. package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterLeftActions/index.d.ts +6 -0
  36. package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.d.ts +6 -0
  37. package/components/Stepper/types.d.ts +156 -0
  38. package/components/hook-form/RHFormContext/index.d.ts +1 -1
  39. package/components/hook-form/RHFormContext/index.js +5 -4
  40. package/components/hook-form/RHFormContext/types.d.ts +3 -1
  41. package/components/mui_extended/Select/Select.js +1 -0
  42. package/components/mui_extended/Select/Select.styles.js +11 -3
  43. package/helpers/getStepsAndValidationSchema/getStepsAndValidationSchema.d.ts +11 -0
  44. package/helpers/getStepsAndValidationSchema/index.d.ts +1 -0
  45. package/helpers/getStepsAndValidationSchema/types.d.ts +21 -0
  46. package/package.json +1 -1
  47. package/storybook/components/Stepper/Stepper.stories.d.ts +28 -0
  48. package/storybook/components/Stepper/api/userApi.d.ts +6 -0
  49. package/storybook/components/Stepper/components/AdminPermissionsStep.d.ts +4 -0
  50. package/storybook/components/Stepper/components/CompanySocialMediaStep.d.ts +4 -0
  51. package/storybook/components/Stepper/components/CompanyStep.d.ts +4 -0
  52. package/storybook/components/Stepper/components/ContactStep.d.ts +4 -0
  53. package/storybook/components/Stepper/components/ExtraInformationStep.d.ts +4 -0
  54. package/storybook/components/Stepper/components/ModulePermissionsStep.d.ts +4 -0
  55. package/storybook/components/Stepper/components/PrivilegesStep.d.ts +4 -0
  56. package/storybook/components/Stepper/helpers/useSteps.d.ts +43 -0
  57. package/storybook/components/Stepper/subcomponents/StepperDecorator.d.ts +9 -0
  58. package/storybook/components/Stepper/validations/CompanyData.d.ts +18 -0
  59. package/storybook/components/Stepper/validations/ContactData.d.ts +11 -0
  60. package/storybook/components/Stepper/validations/ExtraInformationData.d.ts +9 -0
  61. package/storybook/components/Stepper/validations/PrivilegesData.d.ts +14 -0
@@ -0,0 +1,78 @@
1
+ import { ReactNode } from 'react';
2
+ import { Step, StepperOwnerState, StepperProps } from '../types';
3
+ export interface StepperState extends Pick<StepperProps, 'storeId' | 'visibleTitle' | 'steps' | 'indicatorType' | 'orientation' | 'size' | 'visibilityData'> {
4
+ /**
5
+ * "ownerState" estado a nivel de clases del componente
6
+ */
7
+ ownerState: StepperOwnerState;
8
+ /**
9
+ * "currentStep" step actual
10
+ */
11
+ currentStep: number;
12
+ /**
13
+ * "host_static_assets" ruta base de los assets estáticos
14
+ */
15
+ host_static_assets: string;
16
+ /**
17
+ * "environment_assets" ruta del entorno de assets
18
+ */
19
+ environment_assets: string;
20
+ /**
21
+ * "completedSteps" pasos completados
22
+ */
23
+ completedSteps: number[];
24
+ /**
25
+ * "stepValidationStatus" estado de validación por cada step
26
+ * - true: el paso es válido
27
+ */
28
+ stepValidationStatus: Record<number, boolean>;
29
+ /**
30
+ * "isValidating" indica si el stepper está en proceso de validación
31
+ */
32
+ isValidating: boolean;
33
+ }
34
+ export interface StepperStateWithActions extends StepperState {
35
+ actions: {
36
+ /**
37
+ * inicializa el estado del componente con los steps que provienen desde afuera
38
+ */
39
+ init: (steps: Array<Step>) => void;
40
+ /**
41
+ * Establece el paso actual
42
+ * @param currentStep - Índice del paso actual
43
+ */
44
+ setCurrentStep: (currentStep: number) => void;
45
+ /**
46
+ * Marca un paso como completado
47
+ * @param stepIndex - Índice del paso
48
+ */
49
+ setCompletedStep: (stepIndex: number) => void;
50
+ /**
51
+ * Establece el estado de validación de un paso
52
+ * @param stepIndex - Índice del paso
53
+ * @param isValid - Estado de validación del paso
54
+ */
55
+ setStepValidationStatus: (stepIndex: number, isValid: boolean) => void;
56
+ /**
57
+ * Retrocede al paso anterior válido
58
+ * @param formData - Datos del formulario para evaluar conditions
59
+ * @param visibilityData - Datos adicionales para evaluar conditions
60
+ */
61
+ prevStep: (formData?: Record<string, any>, visibilityData?: any) => void;
62
+ /**
63
+ * Valida el paso actual y avanza al siguiente si es válido
64
+ * @param validateFn - Función de validación
65
+ * @param formData - Datos del formulario para evaluar conditions
66
+ * @param visibilityData - Datos adicionales para evaluar conditions
67
+ */
68
+ nextStep: (validateFn: () => Promise<boolean>, formData?: Record<string, any>, visibilityData?: any) => Promise<boolean>;
69
+ /**
70
+ * resetStepper - Resetea el Stepper a su estado inicial
71
+ */
72
+ resetStepper: () => void;
73
+ };
74
+ }
75
+ export interface StepperContextProps extends StepperProps {
76
+ children: ReactNode;
77
+ }
78
+ export type InitialStoreProps = Pick<StepperState, 'ownerState' | 'storeId' | 'steps' | 'visibleTitle' | 'host_static_assets' | 'environment_assets' | 'indicatorType' | 'orientation' | 'visibilityData'>;
@@ -0,0 +1,6 @@
1
+ import { ContentAreaProps } from '../../types';
2
+ /**
3
+ * El componente ContentArea renderiza el área de contenido del Stepper.
4
+ * Contiene el encabezado con un icono, titulo y descripción, y el contenido del step actual.
5
+ */
6
+ export declare function ContentArea(props: ContentAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Componente WrapperIcon renderiza el icono del título del Stepper.
3
+ */
4
+ export declare function WrapperIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * El componente WrapperTitle renderiza el título y la descripción del step en el Stepper.
3
+ */
4
+ export declare function WrapperTitle(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * El componente StepArea renderiza el área de pasos del Stepper.
3
+ * Muestra solo los pasos que cumplen su condition según los datos del formulario.
4
+ * Utiliza el hook useStepper para obtener el estado actual y los pasos definidos.
5
+ */
6
+ export declare function StepArea(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { IndicatorProps } from '../../../../types';
2
+ /**
3
+ * El componente Indicator renderiza el indicador del paso actual
4
+ */
5
+ export declare function Indicator(props: IndicatorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Botón modular para cancelar el proceso del Stepper
3
+ */
4
+ export declare function StepperCancelButton(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Botón modular para avanzar al siguiente step del Stepper
3
+ */
4
+ export declare function StepperNextButton(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Botón modular para ir al step anterior del Stepper
3
+ */
4
+ export declare function StepperPrevButton(): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Botón modular para finalizar el Stepper y ejecutar onFinalSubmit
3
+ */
4
+ export declare function StepperSubmitButton(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { StepperNextButton } from './StepperNextButton';
2
+ export { StepperPrevButton } from './StepperPrevButton';
3
+ export { StepperCancelButton } from './StepperCancelButton';
4
+ export { StepperSubmitButton } from './StepperSubmitButton';
@@ -0,0 +1,7 @@
1
+ import { StepperContentProps } from '../../types';
2
+ /**
3
+ * Componente StepperContent - Contenedor que renderiza todos los Steps
4
+ * Cada Step maneja su propia lógica de renderizado condicional
5
+ * SOLO acepta componentes Step como hijos.
6
+ */
7
+ export declare function StepperContent(props: StepperContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { StepProps } from '../../../../types';
2
+ /**
3
+ * Componente Step - Representa un paso individual en el Stepper
4
+ * Solo se renderiza cuando el step actual coincide con stepKey Y la condition es true
5
+ */
6
+ export declare function Step(props: StepProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import { StepperFooterProps } from '../../types';
2
+ /**
3
+ * StepperFooter es el componente footer del Stepper que contiene las acciones de navegación.
4
+ * Puede incluir LeftActions y RightActions como children.
5
+ */
6
+ export declare function StepperFooter(props: StepperFooterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { StepperFooterLeftActionsProps } from '../../../../types';
2
+ /**
3
+ * StepperFooterLeftActions es un componente de guía de estilos para acciones del lado izquierdo del footer del Stepper.
4
+ * Puede recibir children para renderizar contenido personalizado.
5
+ */
6
+ export declare function StepperFooterLeftActions(props: StepperFooterLeftActionsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { StepperFooterRightActionsProps } from '../../../../types';
2
+ /**
3
+ * StepperFooterRightActions es un componente de guía de estilos para acciones del lado derecho del footer del Stepper.
4
+ * Puede recibir children para renderizar contenido personalizado.
5
+ */
6
+ export declare function StepperFooterRightActions(props: StepperFooterRightActionsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,156 @@
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
+ * Array con los campos que se deben validar en el step.
27
+ */
28
+ validationFields?: string[];
29
+ /**
30
+ * Función que determina si el step se debe mostrar.
31
+ * @param formData - Datos del formulario.
32
+ * @param visibilityData - Datos adicionales para evaluar visibilidad (ej: objectId).
33
+ * @returns true si el step se debe mostrar, false en caso contrario.
34
+ * Si no se proporciona, el step siempre se muestra.
35
+ */
36
+ visibilityCondition?: (formData?: FormData, visibilityData?: VisibilityData) => boolean;
37
+ };
38
+ export interface StepperProps {
39
+ /**
40
+ * Children opcional para inyectar componentes adicionales
41
+ */
42
+ children?: React.ReactNode;
43
+ /**
44
+ * "storeId" identificador del store
45
+ */
46
+ storeId?: string;
47
+ /**
48
+ * "storeDevtoolsEnabled" determina si se debe usar devtools para el store
49
+ */
50
+ storeDevtoolsEnabled?: boolean;
51
+ /**
52
+ * "visibleTitle": Propiedad que ejecuta condición para visualizar los titulos en el SteppArea
53
+ */
54
+ visibleTitle?: boolean;
55
+ /**
56
+ * Array con la configuración de cada step.
57
+ */
58
+ steps: Step[];
59
+ /**
60
+ * Datos adicionales para evaluar visibilityCondition de los steps.
61
+ * Por ejemplo, objectId para determinar si mostrar steps después del submit inicial.
62
+ */
63
+ visibilityData?: VisibilityData;
64
+ /**
65
+ * Indica que tipo de indicador se usará en el Stepper.
66
+ * Puede ser 'number' para números o 'dot' para puntos.
67
+ */
68
+ indicatorType?: IndicatorType;
69
+ /**
70
+ * "orientation" define la orientación del Stepper.
71
+ */
72
+ orientation?: Orientation;
73
+ /**
74
+ * Tamaño del componente, puede ser uno de los valores definidos en 'small' , 'medium'
75
+ */
76
+ size?: Extract<Sizes, 'small' | 'medium'>;
77
+ }
78
+ /**
79
+ * Props del StepperContent
80
+ */
81
+ export interface StepperContentProps {
82
+ /**
83
+ * Array de componentes Step
84
+ */
85
+ children: ReactElement<typeof StepComponent>[];
86
+ }
87
+ /**
88
+ * Props del Step
89
+ */
90
+ export interface StepProps {
91
+ /**
92
+ * Clave única del step que determina cuándo se renderiza
93
+ */
94
+ stepKey: string;
95
+ /**
96
+ * Contenido del step
97
+ */
98
+ children: ReactNode;
99
+ }
100
+ /**
101
+ * Props del ContentArea
102
+ */
103
+ export interface ContentAreaProps {
104
+ children: ReactNode;
105
+ }
106
+ /**
107
+ * Props del Indicator
108
+ */
109
+ export interface IndicatorProps {
110
+ /**
111
+ * El número del paso actual.
112
+ */
113
+ step: number;
114
+ /**
115
+ * Indica si el paso es el actual.
116
+ */
117
+ currentStep: number;
118
+ /**
119
+ * El número total de pasos.
120
+ */
121
+ totalSteps: number;
122
+ /**
123
+ * El índice original del paso en el array completo de pasos.
124
+ * Se usa para buscar el estado de validación en stepValidationStatus.
125
+ */
126
+ originalStepIndex: number;
127
+ }
128
+ /**
129
+ * Props del StepperFooter
130
+ */
131
+ export interface StepperFooterProps {
132
+ children?: ReactNode;
133
+ }
134
+ /**
135
+ * Props del StepperFooterLeftActions
136
+ */
137
+ export interface StepperFooterLeftActionsProps {
138
+ children?: ReactNode;
139
+ }
140
+ /**
141
+ * Props del StepperFooterRightActions
142
+ */
143
+ export interface StepperFooterRightActionsProps {
144
+ children?: ReactNode;
145
+ }
146
+ export interface StepperOwnerState extends Pick<StepperProps, 'visibleTitle'> {
147
+ step?: number;
148
+ currentStep?: number;
149
+ totalSteps?: number;
150
+ orientation?: Orientation;
151
+ indicatorType?: IndicatorType;
152
+ size?: Extract<Sizes, 'small' | 'medium'>;
153
+ stepValidationStatus?: Record<number, boolean>;
154
+ }
155
+ export type StepperSlotsType = StepperSlots | ContentSlots | ContentAreaSlots | StepperFooterSlots;
156
+ export type StepperStyles = M4LOverridesStyleRules<StepperSlotsType, typeof STEPPER_PREFIX_NAME, Theme>;
@@ -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
  }
@@ -176,6 +176,7 @@ const Select = forwardRef(
176
176
  paddingBottom: theme.vars.size.baseSpacings.sp3,
177
177
  paddingLeft: 0,
178
178
  paddingRight: 0,
179
+ maxHeight: "200px",
179
180
  "& .MuiList-root": {
180
181
  padding: 0,
181
182
  display: "flex",
@@ -35,7 +35,12 @@ const selectStyles = {
35
35
  },
36
36
  "& .MuiSelect-select": {
37
37
  padding: `${theme.vars.size.baseSpacings.sp1}!important`,
38
- minHeight: "unset"
38
+ minHeight: "unset",
39
+ maxHeight: "80px",
40
+ overflow: "auto",
41
+ boxSizing: "border-box",
42
+ display: "flex",
43
+ flexDirection: "column"
39
44
  },
40
45
  // Estilos para la variante text
41
46
  [`&.${SELECT_CLASSES.text}`]: {
@@ -69,7 +74,8 @@ const selectStyles = {
69
74
  (height) => {
70
75
  return {
71
76
  minHeight: height,
72
- maxHeight: height
77
+ height: "fit-content",
78
+ maxHeight: "80px"
73
79
  };
74
80
  }
75
81
  )
@@ -88,7 +94,9 @@ const selectStyles = {
88
94
  display: "flex",
89
95
  alignItems: "center",
90
96
  gap: theme.vars.size.baseSpacings.sp1,
91
- flexWrap: "wrap"
97
+ flexWrap: "wrap",
98
+ overflow: "auto",
99
+ flexShrink: 1
92
100
  }),
93
101
  arrowDown: {},
94
102
  renderValueTypography: () => ({
@@ -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 @@
1
+ export { getStepsAndValidationSchema } from './getStepsAndValidationSchema';
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.11",
3
+ "version": "9.3.12-JT270825.beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {
@@ -0,0 +1,28 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { StepperDecorator } from './subcomponents/StepperDecorator';
3
+ declare const meta: Meta<typeof StepperDecorator>;
4
+ type Story = StoryObj<typeof StepperDecorator>;
5
+ /**
6
+ * Historia por default - Stepper básico sin visibilityConditions
7
+ */
8
+ export declare const Default: Story;
9
+ /**
10
+ * Historia con visibilityConditions - Stepper completo con submit intermedio y visibilityCondition
11
+ */
12
+ export declare const WithVisibilityConditions: Story;
13
+ /**
14
+ * Story que demuestra automáticamente errores de validación
15
+ * Play para mostrar errores cuando se hace submit sin llenar campos
16
+ */
17
+ export declare const PVStepperValidationErrors: Story;
18
+ /**
19
+ * Story que demuestra automáticamente el flujo de submit intermedio
20
+ * Play para llenar cada formulario, hacer submit y mostrar cómo aparecen los siguientes pasos
21
+ */
22
+ export declare const PVStepperIntermediateSubmitFlow: Story;
23
+ /**
24
+ * Story que demuestra automáticamente la navegación entre steps
25
+ * Play para mostrar el flujo de navegación con botones Siguiente y Anterior
26
+ */
27
+ export declare const PVStepperNavigationFlow: Story;
28
+ export default meta;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Simula la creación de un nuevo usuario
3
+ * @param formData - Datos del formulario de usuario
4
+ * @returns Promise con el usuario creado incluyendo el ID generado
5
+ */
6
+ export declare const createUser: (formData: any) => Promise<any>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Componente para permisos de administración.
3
+ */
4
+ export declare function AdminPermissionsStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Componente para redes sociales de la empresa.
3
+ */
4
+ export declare function CompanySocialMediaStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Paso de datos de empresa para el Stepper que contiene campos de formulario para información empresarial.
3
+ */
4
+ export declare function CompanyStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Paso de contacto para el Stepper que contiene campos de formulario para datos de contacto.
3
+ */
4
+ export declare function ContactStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Paso de información adicional para el Stepper que contiene campos de formulario para exta información del usuario
3
+ */
4
+ export declare function ExtraInformationStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Componente para permisos de módulos.
3
+ */
4
+ export declare function ModulePermissionsStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Paso de privilegios para el Stepper que contiene campos de formulario para los privilegios del usuario.
3
+ */
4
+ export declare function PrivilegesStep(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Hook personalizado para manejar la configuración de steps del Stepper en Storybook
3
+ */
4
+ export declare function useSteps(withVisibilityConditions?: boolean): {
5
+ validationSchema: import('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>>>>;
6
+ steps: import('../../../../src/components/Stepper/types').Step[];
7
+ visibilityData: {
8
+ objectId: any;
9
+ };
10
+ onSubmit: (data: any) => Promise<void>;
11
+ formValues: {
12
+ first_name: string;
13
+ last_name: string;
14
+ email: string;
15
+ first_phone: string;
16
+ second_phone: string;
17
+ requires_permissions: boolean;
18
+ user_type: string;
19
+ role: string;
20
+ can_manage_users: boolean;
21
+ can_manage_roles: boolean;
22
+ can_access_system_config: boolean;
23
+ can_view_reports: boolean;
24
+ can_edit_content: boolean;
25
+ can_delete_records: boolean;
26
+ address: string;
27
+ country: string;
28
+ city: string;
29
+ postal_code: string;
30
+ company_name: string;
31
+ company_position: string;
32
+ company_department: string;
33
+ company_phone: string;
34
+ company_email: string;
35
+ company_website: string;
36
+ company_facebook: string;
37
+ company_twitter: string;
38
+ company_linkedin: string;
39
+ company_instagram: string;
40
+ company_youtube: string;
41
+ company_tiktok: string;
42
+ };
43
+ };
@@ -0,0 +1,9 @@
1
+ import { StepperProps } from '../../../../src/components/Stepper/types';
2
+ interface StepperDecoratorProps extends Omit<StepperProps, 'steps'> {
3
+ withVisibilityConditions?: boolean;
4
+ }
5
+ /**
6
+ * Decorator para Storybook
7
+ */
8
+ export declare function StepperDecorator({ withVisibilityConditions, }: StepperDecoratorProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,18 @@
1
+ import * as Yup from 'yup';
2
+ /**
3
+ * Validaciones para el formulario de datos de empresa
4
+ */
5
+ export declare function CompanyDataValidation(): {
6
+ company_name: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
7
+ company_position: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
8
+ company_department: Yup.StringSchema<string | null | undefined, import('yup/lib/types').AnyObject, string | null | undefined>;
9
+ company_phone: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
10
+ company_email: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
11
+ company_website: Yup.StringSchema<string | null | undefined, import('yup/lib/types').AnyObject, string | null | undefined>;
12
+ company_facebook: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
13
+ company_twitter: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
14
+ company_linkedin: import('yup/lib/string').RequiredStringSchema<string | undefined, import('yup/lib/types').AnyObject>;
15
+ company_instagram: Yup.StringSchema<string | null | undefined, import('yup/lib/types').AnyObject, string | null | undefined>;
16
+ company_youtube: Yup.StringSchema<string | null | undefined, import('yup/lib/types').AnyObject, string | null | undefined>;
17
+ company_tiktok: Yup.StringSchema<string | null | undefined, import('yup/lib/types').AnyObject, string | null | undefined>;
18
+ };