@m4l/components 9.3.13-JT02092025.beta.3 → 9.3.13-JT03092025.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.
- package/components/Stepper/Stepper.d.ts +1 -1
- package/components/Stepper/Stepper.js +3 -16
- package/components/Stepper/Stepper.styles.js +12 -10
- package/components/Stepper/slots/StepperEnum.d.ts +1 -0
- package/components/Stepper/slots/StepperEnum.js +3 -2
- package/components/Stepper/slots/StepperSlot.d.ts +3 -0
- package/components/Stepper/slots/StepperSlot.js +9 -4
- package/components/Stepper/subcomponents/StepArea/index.js +16 -6
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.d.ts +1 -1
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +8 -9
- package/components/Stepper/subcomponents/StepperFooter/index.js +3 -3
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterLeftActions/index.js +1 -1
- package/components/Stepper/subcomponents/StepperFooter/subcomponents/StepperFooterRightActions/index.js +1 -1
- package/components/Stepper/types.d.ts +1 -2
- package/package.json +1 -1
- package/components/Stepper/hooks/useStickyStepperFooter/index.d.ts +0 -7
- package/components/Stepper/hooks/useStickyStepperFooter/index.js +0 -20
|
@@ -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;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo, Children, isValidElement } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { useFlagsPresent, CommonFlags } from "@m4l/core";
|
|
5
4
|
import { S as StepperRootStyled, C as ContentSectionStyled } from "./slots/StepperSlot.js";
|
|
6
5
|
import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
|
|
7
6
|
import { S as STEPPER_PREFIX_NAME } from "./constants.js";
|
|
@@ -10,21 +9,13 @@ import { C as ContentArea } from "./subcomponents/ContentArea/index.js";
|
|
|
10
9
|
import { S as StepperProvider } from "./store/StepperContext/index.js";
|
|
11
10
|
import { S as StepperFooter } from "./subcomponents/StepperFooter/index.js";
|
|
12
11
|
import { S as StepperContent } from "./subcomponents/StepperContent/index.js";
|
|
13
|
-
import { u as useStickyStepperFooter } from "./hooks/useStickyStepperFooter/index.js";
|
|
14
12
|
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
15
13
|
function Stepper(props) {
|
|
16
14
|
const { orientation, size, children, className } = props;
|
|
17
15
|
const { currentSize } = useComponentSize(size);
|
|
18
|
-
const containerRef = useRef(null);
|
|
19
|
-
const contentSectionRef = useRef(null);
|
|
20
|
-
const stepperFooterSticky = useStickyStepperFooter(
|
|
21
|
-
containerRef,
|
|
22
|
-
contentSectionRef
|
|
23
|
-
);
|
|
24
16
|
const ownerState = {
|
|
25
17
|
size: currentSize,
|
|
26
|
-
orientation
|
|
27
|
-
stepperFooterSticky
|
|
18
|
+
orientation
|
|
28
19
|
};
|
|
29
20
|
const classRoot = getComponentSlotRoot(STEPPER_PREFIX_NAME);
|
|
30
21
|
const { stepperFooter, stepperContent } = useMemo(() => {
|
|
@@ -61,16 +52,12 @@ function Stepper(props) {
|
|
|
61
52
|
}
|
|
62
53
|
return { stepperFooter: footer, stepperContent: content };
|
|
63
54
|
}, [children]);
|
|
64
|
-
const hasPresentFlags = useFlagsPresent([CommonFlags.FLAG_DICTIONARY_LOADED]);
|
|
65
|
-
if (!hasPresentFlags) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
55
|
return /* @__PURE__ */ jsx(StepperProvider, { ...props, children: /* @__PURE__ */ jsxs(StepperRootStyled, { className: clsx(classRoot, className), children: [
|
|
69
56
|
/* @__PURE__ */ jsxs(ContentSectionStyled, { ownerState, children: [
|
|
70
57
|
/* @__PURE__ */ jsx(StepArea, {}),
|
|
71
58
|
/* @__PURE__ */ jsx(ContentArea, { children: stepperContent })
|
|
72
59
|
] }),
|
|
73
|
-
stepperFooter
|
|
60
|
+
stepperFooter
|
|
74
61
|
] }) });
|
|
75
62
|
}
|
|
76
63
|
export {
|
|
@@ -4,10 +4,10 @@ const stepperStyles = {
|
|
|
4
4
|
*
|
|
5
5
|
* Estilos para el contenedor principal del Stepper.
|
|
6
6
|
*/
|
|
7
|
-
stepperRoot: ({ theme
|
|
7
|
+
stepperRoot: ({ theme }) => ({
|
|
8
8
|
display: "flex",
|
|
9
9
|
flexDirection: "column",
|
|
10
|
-
justifyContent:
|
|
10
|
+
justifyContent: "flex-start",
|
|
11
11
|
background: theme.vars.palette.background.default,
|
|
12
12
|
width: "100%",
|
|
13
13
|
height: "100%",
|
|
@@ -24,6 +24,9 @@ const stepperStyles = {
|
|
|
24
24
|
flexDirection: ownerState?.orientation === "vertical" || theme.generalSettings.isMobile ? "column" : "row",
|
|
25
25
|
gap: theme.vars.size.baseSpacings.sp8
|
|
26
26
|
}),
|
|
27
|
+
stepContent: ({ ownerState }) => ({
|
|
28
|
+
display: ownerState?.isStepVisible ? "block" : "none"
|
|
29
|
+
}),
|
|
27
30
|
/**
|
|
28
31
|
* Estilos para la sección que contiene los botones de acción del Stepper.
|
|
29
32
|
*/
|
|
@@ -69,6 +72,7 @@ const stepperStyles = {
|
|
|
69
72
|
return {
|
|
70
73
|
cursor: "pointer",
|
|
71
74
|
display: "flex",
|
|
75
|
+
visibility: ownerState?.isStepVisible ? "visible" : "hidden",
|
|
72
76
|
flexDirection: ownerState?.orientation === "vertical" || theme.generalSettings.isMobile ? "column" : "row",
|
|
73
77
|
alignItems: ownerState?.orientation === "vertical" || theme.generalSettings.isMobile ? "center" : "start",
|
|
74
78
|
justifyContent: ownerState?.visibleTitle ? "space-between" : "center",
|
|
@@ -254,18 +258,16 @@ const stepperStyles = {
|
|
|
254
258
|
/**
|
|
255
259
|
* Estilos para la sección de botones de acción del Stepper.
|
|
256
260
|
*/
|
|
257
|
-
stepperFooterSection: ({ theme
|
|
261
|
+
stepperFooterSection: ({ theme }) => ({
|
|
258
262
|
display: "flex",
|
|
259
263
|
alignItems: "center",
|
|
260
264
|
justifyContent: "space-between",
|
|
261
265
|
paddingTop: theme.vars.size.baseSpacings.sp4,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
zIndex: 10
|
|
268
|
-
}
|
|
266
|
+
position: "sticky",
|
|
267
|
+
bottom: 0,
|
|
268
|
+
backgroundColor: theme.vars.palette.background.default,
|
|
269
|
+
marginTop: "auto",
|
|
270
|
+
zIndex: 10
|
|
269
271
|
}),
|
|
270
272
|
/**
|
|
271
273
|
* Estilos para las acciones del lado izquierdo del StepperFooter.
|
|
@@ -13,6 +13,7 @@ var ContentSlots = /* @__PURE__ */ ((ContentSlots2) => {
|
|
|
13
13
|
})(ContentSlots || {});
|
|
14
14
|
var ContentAreaSlots = /* @__PURE__ */ ((ContentAreaSlots2) => {
|
|
15
15
|
ContentAreaSlots2["contentArea"] = "contentArea";
|
|
16
|
+
ContentAreaSlots2["stepContent"] = "stepContent";
|
|
16
17
|
ContentAreaSlots2["contentAreaHeader"] = "contentAreaHeader";
|
|
17
18
|
ContentAreaSlots2["contentAreaBody"] = "contentAreaBody";
|
|
18
19
|
ContentAreaSlots2["wrapperIcon"] = "wrapperIcon";
|
|
@@ -32,6 +33,6 @@ var StepperFooterSlots = /* @__PURE__ */ ((StepperFooterSlots2) => {
|
|
|
32
33
|
export {
|
|
33
34
|
ContentSlots as C,
|
|
34
35
|
StepperSlots as S,
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
ContentAreaSlots as a,
|
|
37
|
+
StepperFooterSlots as b
|
|
37
38
|
};
|
|
@@ -13,6 +13,9 @@ export declare const StepAreaStyled: import('@emotion/styled').StyledComponent<i
|
|
|
13
13
|
export declare const ContentAreaStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
14
14
|
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
15
15
|
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
16
|
+
export declare const StepContentStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
17
|
+
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
18
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
16
19
|
export declare const StepStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
17
20
|
ownerState?: (Partial<import('../types').StepperOwnerState> & Record<string, unknown>) | undefined;
|
|
18
21
|
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styled } from "@mui/material/styles";
|
|
2
2
|
import { S as STEPPER_PREFIX_NAME } from "../constants.js";
|
|
3
|
-
import { S as StepperSlots, C as ContentSlots, a as
|
|
3
|
+
import { S as StepperSlots, C as ContentSlots, a as ContentAreaSlots, b as StepperFooterSlots } from "./StepperEnum.js";
|
|
4
4
|
import { s as stepperStyles } from "../Stepper.styles.js";
|
|
5
5
|
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
6
6
|
import { I as Icon } from "../../Icon/Icon.js";
|
|
@@ -20,6 +20,10 @@ const ContentAreaStyled = styled("div", {
|
|
|
20
20
|
name: STEPPER_PREFIX_NAME,
|
|
21
21
|
slot: ContentAreaSlots.contentArea
|
|
22
22
|
})(stepperStyles.contentArea);
|
|
23
|
+
const StepContentStyled = styled("div", {
|
|
24
|
+
name: STEPPER_PREFIX_NAME,
|
|
25
|
+
slot: ContentAreaSlots.stepContent
|
|
26
|
+
})(stepperStyles.stepContent);
|
|
23
27
|
const StepStyled = styled("div", {
|
|
24
28
|
name: STEPPER_PREFIX_NAME,
|
|
25
29
|
slot: ContentSlots.step
|
|
@@ -96,7 +100,8 @@ export {
|
|
|
96
100
|
StepNameStyled as g,
|
|
97
101
|
IndicatorStyled as h,
|
|
98
102
|
TextNumberStyled as i,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
StepContentStyled as j,
|
|
104
|
+
StepperFooterSectionStyled as k,
|
|
105
|
+
StepperFooterLeftActionsStyled as l,
|
|
106
|
+
StepperFooterRightActionsStyled as m
|
|
102
107
|
};
|
|
@@ -33,10 +33,8 @@ function StepArea() {
|
|
|
33
33
|
shallow
|
|
34
34
|
);
|
|
35
35
|
const validSteps = useMemo(() => {
|
|
36
|
-
return steps
|
|
37
|
-
|
|
38
|
-
);
|
|
39
|
-
}, [steps, formValues, visibilityData]);
|
|
36
|
+
return steps;
|
|
37
|
+
}, [steps]);
|
|
40
38
|
const ownerState = {
|
|
41
39
|
visibleTitle,
|
|
42
40
|
orientation,
|
|
@@ -104,12 +102,24 @@ function StepArea() {
|
|
|
104
102
|
};
|
|
105
103
|
return /* @__PURE__ */ jsx(StepAreaStyled, { ownerState, children: validSteps.map((step, validIndex) => {
|
|
106
104
|
const originalIndex = steps.findIndex((s) => s.key === step.key);
|
|
105
|
+
const totalVisibleSteps = validSteps.filter(
|
|
106
|
+
(s) => evaluateVisibilityStepCondition(s, formValues || {}, visibilityData)
|
|
107
|
+
).length;
|
|
107
108
|
return /* @__PURE__ */ jsxs(
|
|
108
109
|
StepStyled,
|
|
109
110
|
{
|
|
110
111
|
role: "button",
|
|
111
112
|
onClick: () => handleStepClick(validIndex),
|
|
112
|
-
ownerState: {
|
|
113
|
+
ownerState: {
|
|
114
|
+
...ownerState,
|
|
115
|
+
currentStep,
|
|
116
|
+
step: validIndex,
|
|
117
|
+
isStepVisible: evaluateVisibilityStepCondition(
|
|
118
|
+
step,
|
|
119
|
+
formValues || {},
|
|
120
|
+
visibilityData
|
|
121
|
+
)
|
|
122
|
+
},
|
|
113
123
|
children: [
|
|
114
124
|
visibleTitle && /* @__PURE__ */ jsx(
|
|
115
125
|
StepNameStyled,
|
|
@@ -124,7 +134,7 @@ function StepArea() {
|
|
|
124
134
|
{
|
|
125
135
|
currentStep,
|
|
126
136
|
step: validIndex,
|
|
127
|
-
totalSteps:
|
|
137
|
+
totalSteps: totalVisibleSteps,
|
|
128
138
|
originalStepIndex: originalIndex
|
|
129
139
|
}
|
|
130
140
|
)
|
|
@@ -3,4 +3,4 @@ import { StepProps } from '../../../../types';
|
|
|
3
3
|
* Componente Step - Representa un paso individual en el Stepper
|
|
4
4
|
* Solo se renderiza cuando el step actual coincide con stepKey Y la condition es true
|
|
5
5
|
*/
|
|
6
|
-
export declare function Step(props: StepProps): import("react/jsx-runtime").JSX.Element
|
|
6
|
+
export declare function Step(props: StepProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { u as useStepper } from "../../../../hooks/useStepper/index.js";
|
|
4
4
|
import { useWatch } from "react-hook-form";
|
|
5
|
+
import { j as StepContentStyled } from "../../../../slots/StepperSlot.js";
|
|
5
6
|
import { e as evaluateVisibilityStepCondition } from "../../../../helpers/evaluateVisibilityStepCondition/index.js";
|
|
6
7
|
function Step(props) {
|
|
7
8
|
const { stepKey, children } = props;
|
|
@@ -24,18 +25,16 @@ function Step(props) {
|
|
|
24
25
|
if (stepKey !== currentStepConfig.key) {
|
|
25
26
|
return false;
|
|
26
27
|
}
|
|
27
|
-
if (stepConfig && !evaluateVisibilityStepCondition(
|
|
28
|
+
if (stepConfig && !evaluateVisibilityStepCondition(
|
|
29
|
+
stepConfig,
|
|
30
|
+
formValues || {},
|
|
31
|
+
visibilityData
|
|
32
|
+
)) {
|
|
28
33
|
return false;
|
|
29
34
|
}
|
|
30
35
|
return true;
|
|
31
36
|
}, [currentStepConfig, stepKey, stepConfig, formValues, visibilityData]);
|
|
32
|
-
|
|
33
|
-
if (!isStepVisible) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
37
|
-
}, [isStepVisible, children]);
|
|
38
|
-
return renderedContent;
|
|
37
|
+
return /* @__PURE__ */ jsx(StepContentStyled, { ownerState: { isStepVisible }, children });
|
|
39
38
|
}
|
|
40
39
|
export {
|
|
41
40
|
Step as S
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, Children, isValidElement } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { k as StepperFooterSectionStyled } from "../../slots/StepperSlot.js";
|
|
4
4
|
import { S as StepperFooterLeftActions } from "./subcomponents/StepperFooterLeftActions/index.js";
|
|
5
5
|
import { S as StepperFooterRightActions } from "./subcomponents/StepperFooterRightActions/index.js";
|
|
6
6
|
function StepperFooter(props) {
|
|
7
|
-
const { children
|
|
7
|
+
const { children } = props;
|
|
8
8
|
const { stepperFooterLeftActions, stepperFooterRightActions } = useMemo(() => {
|
|
9
9
|
let parsedLeftActions = null;
|
|
10
10
|
let parsedRightActions = null;
|
|
@@ -38,7 +38,7 @@ function StepperFooter(props) {
|
|
|
38
38
|
stepperFooterRightActions: parsedRightActions
|
|
39
39
|
};
|
|
40
40
|
}, [children]);
|
|
41
|
-
return /* @__PURE__ */ jsxs(StepperFooterSectionStyled, {
|
|
41
|
+
return /* @__PURE__ */ jsxs(StepperFooterSectionStyled, { children: [
|
|
42
42
|
stepperFooterLeftActions,
|
|
43
43
|
stepperFooterRightActions
|
|
44
44
|
] });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { l as StepperFooterLeftActionsStyled } from "../../../../slots/StepperSlot.js";
|
|
3
3
|
function StepperFooterLeftActions(props) {
|
|
4
4
|
const { children } = props;
|
|
5
5
|
return /* @__PURE__ */ jsx(StepperFooterLeftActionsStyled, { children });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
3
|
import { u as useIsLastVisibleValidStep } from "../../../../hooks/useIsLastVisibleValidStep/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { m as StepperFooterRightActionsStyled } from "../../../../slots/StepperSlot.js";
|
|
5
5
|
import { S as StepperNextButton } from "../../../StepperButtons/StepperNextButton/index.js";
|
|
6
6
|
import { S as StepperSubmitButton } from "../../../StepperButtons/StepperSubmitButton/index.js";
|
|
7
7
|
function StepperFooterRightActions(props) {
|
|
@@ -138,7 +138,6 @@ export interface IndicatorProps {
|
|
|
138
138
|
*/
|
|
139
139
|
export interface StepperFooterProps {
|
|
140
140
|
children?: ReactNode;
|
|
141
|
-
ownerState?: StepperOwnerState;
|
|
142
141
|
}
|
|
143
142
|
/**
|
|
144
143
|
* Props del StepperFooterLeftActions
|
|
@@ -160,7 +159,7 @@ export interface StepperOwnerState extends Pick<StepperProps, 'visibleTitle'>, R
|
|
|
160
159
|
indicatorType?: IndicatorType;
|
|
161
160
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
162
161
|
stepValidationStatus?: Record<number, boolean>;
|
|
163
|
-
|
|
162
|
+
isStepVisible?: boolean;
|
|
164
163
|
}
|
|
165
164
|
export type StepperSlotsType = StepperSlots | ContentSlots | ContentAreaSlots | StepperFooterSlots;
|
|
166
165
|
export type StepperStyles = M4LOverridesStyleRules<StepperSlotsType, typeof STEPPER_PREFIX_NAME, Theme>;
|
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook para determinar cuando el footer del Stepper debe usar posición sticky.
|
|
3
|
-
* @param containerRef - Referencia al contenedor del Stepper
|
|
4
|
-
* @param contentRef - Referencia al área de contenido del Stepper
|
|
5
|
-
* @returns boolean - true si el footer debe ser sticky, false en caso contrario
|
|
6
|
-
*/
|
|
7
|
-
export declare function useStickyStepperFooter(containerRef: React.RefObject<HTMLDivElement>, contentRef: React.RefObject<HTMLElement>): boolean;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { u as useSizeContainer } from "../../../../hooks/useSizeContainer/index.js";
|
|
3
|
-
function useStickyStepperFooter(containerRef, contentRef) {
|
|
4
|
-
const containerSize = useSizeContainer(containerRef.current);
|
|
5
|
-
const shouldBeSticky = useMemo(() => {
|
|
6
|
-
if (!containerRef.current || !contentRef.current) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
const containerHeight = containerRef.current.clientHeight;
|
|
10
|
-
const contentHeight = contentRef.current.clientHeight;
|
|
11
|
-
const totalContentHeight = contentHeight + 80;
|
|
12
|
-
const exceedsContainer = totalContentHeight > containerHeight;
|
|
13
|
-
const hasMinimumSpace = containerHeight > 120;
|
|
14
|
-
return exceedsContainer && hasMinimumSpace;
|
|
15
|
-
}, [containerSize, containerRef, contentRef]);
|
|
16
|
-
return shouldBeSticky;
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
useStickyStepperFooter as u
|
|
20
|
-
};
|