@m4l/components 9.3.13-JT03092025.beta.1 → 9.3.13-JT03092025.beta.2
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.
|
@@ -5,4 +5,4 @@ import { StepperProps } from './types';
|
|
|
5
5
|
* ### Dependecias:
|
|
6
6
|
*- **`useFlagsPresent:`** Hook que permite verificar si una lista de flags se encuentran presentes.
|
|
7
7
|
*/
|
|
8
|
-
export declare function Stepper(props: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function Stepper(props: StepperProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, Children, isValidElement } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
+
import { useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
4
5
|
import { S as StepperRootStyled, C as ContentSectionStyled } from "./slots/StepperSlot.js";
|
|
5
6
|
import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
|
|
6
7
|
import { S as STEPPER_PREFIX_NAME } from "./constants.js";
|
|
@@ -52,6 +53,10 @@ function Stepper(props) {
|
|
|
52
53
|
}
|
|
53
54
|
return { stepperFooter: footer, stepperContent: content };
|
|
54
55
|
}, [children]);
|
|
56
|
+
const hasPresentFlags = useFlagsPresent([CommonFlags.FLAG_DICTIONARY_LOADED]);
|
|
57
|
+
if (!hasPresentFlags) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
55
60
|
return /* @__PURE__ */ jsx(StepperProvider, { ...props, children: /* @__PURE__ */ jsxs(StepperRootStyled, { className: clsx(classRoot, className), children: [
|
|
56
61
|
/* @__PURE__ */ jsxs(ContentSectionStyled, { ownerState, children: [
|
|
57
62
|
/* @__PURE__ */ jsx(StepArea, {}),
|
|
@@ -64,7 +64,7 @@ const StepperProvider = (props) => {
|
|
|
64
64
|
if (stepperStoreRef.current && steps) {
|
|
65
65
|
const store = stepperStoreRef.current;
|
|
66
66
|
const currentState = store.getState();
|
|
67
|
-
store.getState().actions.init(steps);
|
|
67
|
+
store.getState().actions.init(steps, true);
|
|
68
68
|
if (visibilityData) {
|
|
69
69
|
const hasVisibilityDataChanged = JSON.stringify(prevVisibilityDataRef.current) !== JSON.stringify(visibilityData);
|
|
70
70
|
if (hasVisibilityDataChanged) {
|
|
@@ -29,10 +29,12 @@ const createStepperStore = (initProps, storeDevtoolsEnabled = false) => {
|
|
|
29
29
|
/**
|
|
30
30
|
* init es la acción que se ejecuta al inicializar el store
|
|
31
31
|
*/
|
|
32
|
-
init: (steps) => {
|
|
32
|
+
init: (steps, preserveStepValidationStatus = false) => {
|
|
33
33
|
set((state) => {
|
|
34
34
|
state.steps = steps;
|
|
35
|
-
|
|
35
|
+
if (!preserveStepValidationStatus) {
|
|
36
|
+
state.stepValidationStatus = {};
|
|
37
|
+
}
|
|
36
38
|
});
|
|
37
39
|
},
|
|
38
40
|
/**
|
|
@@ -22,9 +22,11 @@ export interface StepperState extends Pick<StepperProps, 'storeId' | 'visibleTit
|
|
|
22
22
|
export interface StepperStateWithActions extends StepperState {
|
|
23
23
|
actions: {
|
|
24
24
|
/**
|
|
25
|
-
* inicializa el estado del componente con los steps que provienen desde afuera
|
|
25
|
+
* inicializa el estado del componente con los steps que provienen desde afuera,
|
|
26
|
+
* @param steps - Array de steps
|
|
27
|
+
* @param preserveStepValidationStatus - Indica si se debe preservar el estado de validación de los pasos, por defecto es false
|
|
26
28
|
*/
|
|
27
|
-
init: (steps: Array<Step
|
|
29
|
+
init: (steps: Array<Step>, preserveStepValidationStatus?: boolean) => void;
|
|
28
30
|
/**
|
|
29
31
|
* Establece el paso actual
|
|
30
32
|
* @param currentStep - Índice del paso actual
|