@m4l/components 9.1.131 → 9.1.132
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/Chip/Chip.js +21 -21
- package/components/Chip/ChipStyles.js +22 -50
- package/components/Chip/slots/ChipSlots.js +2 -2
- package/components/Chip/types.d.ts +1 -1
- package/components/DynamicSort/DynamicSort.styles.js +13 -16
- package/components/Icon/Icon.js +13 -7
- package/components/Icon/Icon.styles.js +23 -20
- package/components/Icon/types.d.ts +9 -6
- package/components/Label/Label.styles.js +1 -1
- package/components/NumberInput/NumberInput.styles.js +1 -1
- package/components/PaperForm/styles.js +1 -1
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +1 -1
- package/components/areas/components/AreasAdmin/AreasAdmin.styles.js +1 -1
- package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.styles.js +1 -1
- package/components/hook-form/RHFTextFieldPassword/RHFTextFieldPassword.styles.js +1 -1
- package/components/mui_extended/Autocomplete/Autocomplete.styles.js +1 -1
- package/components/mui_extended/CheckBox/CheckBox.styles.js +1 -1
- package/components/mui_extended/DateTimePicker/DateTimePicker.styles.js +1 -1
- package/components/mui_extended/IconButton/IconButton.d.ts +2 -1
- package/components/mui_extended/IconButton/IconButton.js +18 -20
- package/components/mui_extended/IconButton/IconButton.styles.js +118 -162
- package/components/mui_extended/IconButton/types.d.ts +3 -4
- package/components/mui_extended/MenuDivider/MenuDivider.styles.js +1 -1
- package/components/mui_extended/MenuItem/MenuItem.js +27 -20
- package/components/mui_extended/MenuItem/MenuItem.styles.js +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +6 -6
- package/components/mui_extended/NavLink/NavLink.styles.js +1 -1
- package/components/mui_extended/Select/Select.styles.js +1 -3
- package/components/mui_extended/TextField/TextField.styles.js +1 -1
- package/components/mui_extended/Typography/typography.styles.js +1 -2
- package/index.js +7 -7
- package/package.json +1 -1
- package/utils/getSizeStyles/getSizeStyles.d.ts +1 -2
- package/utils/getSizeStyles/getSizeStyles.js +4 -4
package/components/Chip/Chip.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { forwardRef } from "react";
|
|
4
|
+
import { forwardRef, useMemo } from "react";
|
|
5
5
|
import { C as CHIP_CLASSES } from "./constants.js";
|
|
6
6
|
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
-
import { S as SkeletonChipStyled, C as ChipRootStyled, T as TextChipStyled,
|
|
7
|
+
import { I as IconStyled, S as SkeletonChipStyled, C as ChipRootStyled, T as TextChipStyled, a as IconButtonStyled } from "./slots/ChipSlots.js";
|
|
8
8
|
const Chip = forwardRef((props, ref) => {
|
|
9
9
|
const {
|
|
10
10
|
endIcon,
|
|
@@ -26,30 +26,16 @@ const Chip = forwardRef((props, ref) => {
|
|
|
26
26
|
const isSkeleton = useModuleSkeleton();
|
|
27
27
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
28
28
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
29
|
-
const ownerState = {
|
|
29
|
+
const ownerState = useMemo(() => ({
|
|
30
30
|
interactive: !!onClick,
|
|
31
31
|
size: adjustedSize,
|
|
32
|
+
chipSize: adjustedSize,
|
|
32
33
|
variant,
|
|
33
34
|
color,
|
|
34
35
|
opacity,
|
|
35
36
|
externalColor
|
|
36
|
-
};
|
|
37
|
-
const
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
onDeleted?.(e);
|
|
40
|
-
};
|
|
41
|
-
if (isSkeleton) {
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
SkeletonChipStyled,
|
|
44
|
-
{
|
|
45
|
-
"data-testid": "SkeletonButton",
|
|
46
|
-
width: skeletonWidth,
|
|
47
|
-
ownerState: { ...ownerState }
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
const iconClose = `${host_static_assets}/${environment_assets}/frontend/components/chip/assets/icons/closeSmall.svg`;
|
|
52
|
-
const renderIcon = (icon, instaceDataTestId) => {
|
|
37
|
+
}), [adjustedSize, variant, color, opacity, externalColor, onClick]);
|
|
38
|
+
const renderIcon = useMemo(() => (icon, instaceDataTestId) => {
|
|
53
39
|
if (!icon) {
|
|
54
40
|
return null;
|
|
55
41
|
}
|
|
@@ -59,7 +45,6 @@ const Chip = forwardRef((props, ref) => {
|
|
|
59
45
|
return /* @__PURE__ */ jsx(
|
|
60
46
|
IconStyled,
|
|
61
47
|
{
|
|
62
|
-
color,
|
|
63
48
|
ownerState: { ...ownerState },
|
|
64
49
|
src: icon,
|
|
65
50
|
size: adjustedSize,
|
|
@@ -67,6 +52,21 @@ const Chip = forwardRef((props, ref) => {
|
|
|
67
52
|
}
|
|
68
53
|
);
|
|
69
54
|
}
|
|
55
|
+
}, [ownerState, adjustedSize]);
|
|
56
|
+
if (isSkeleton) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
SkeletonChipStyled,
|
|
59
|
+
{
|
|
60
|
+
"data-testid": "SkeletonButton",
|
|
61
|
+
width: skeletonWidth,
|
|
62
|
+
ownerState: { ...ownerState }
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const iconClose = `${host_static_assets}/${environment_assets}/frontend/components/chip/assets/icons/closeSmall.svg`;
|
|
67
|
+
const handleDelete = (e) => {
|
|
68
|
+
e.stopPropagation();
|
|
69
|
+
onDeleted?.(e);
|
|
70
70
|
};
|
|
71
71
|
return /* @__PURE__ */ jsxs(
|
|
72
72
|
ChipRootStyled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as
|
|
1
|
+
import { g as getSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
const getColors = (theme, ownerState) => {
|
|
3
3
|
const keyColor = ownerState.variant === "contained" ? ownerState.color + "Contained" : ownerState.color + "Outlined";
|
|
4
4
|
const finalPalette = ownerState.externalColor ? ownerState.externalColor : theme.vars.palette.chips[keyColor ?? "default"];
|
|
@@ -24,11 +24,8 @@ const chipStyles = {
|
|
|
24
24
|
cursor: "pointer",
|
|
25
25
|
color,
|
|
26
26
|
backgroundColor: !(ownerState.variant === "outlined") ? bgColor : "transparent",
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// },
|
|
30
|
-
...getHeightSizeStyles(
|
|
31
|
-
theme.generalSettings.isMobile,
|
|
27
|
+
...getSizeStyles(
|
|
28
|
+
theme,
|
|
32
29
|
ownerState.size || "medium",
|
|
33
30
|
"base"
|
|
34
31
|
),
|
|
@@ -81,30 +78,16 @@ const chipStyles = {
|
|
|
81
78
|
"& .M4LIcon-icon": {
|
|
82
79
|
backgroundColor: `${color} !important`
|
|
83
80
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
// Estilos específicos para el tamaño medium
|
|
97
|
-
...ownerState.size === "medium" && {
|
|
98
|
-
...theme.generalSettings.isMobile ? {
|
|
99
|
-
height: theme.vars.size.mobile.medium.base,
|
|
100
|
-
width: theme.vars.size.mobile.medium.base,
|
|
101
|
-
minHeight: theme.vars.size.mobile.medium.base
|
|
102
|
-
} : {
|
|
103
|
-
height: theme.vars.size.desktop.medium.base,
|
|
104
|
-
width: theme.vars.size.desktop.medium.base,
|
|
105
|
-
minHeight: theme.vars.size.desktop.medium.base
|
|
106
|
-
}
|
|
107
|
-
}
|
|
81
|
+
...getSizeStyles(
|
|
82
|
+
theme,
|
|
83
|
+
ownerState.size || "medium",
|
|
84
|
+
"base",
|
|
85
|
+
(size) => ({
|
|
86
|
+
height: size,
|
|
87
|
+
width: size,
|
|
88
|
+
minHeight: size
|
|
89
|
+
})
|
|
90
|
+
)
|
|
108
91
|
};
|
|
109
92
|
},
|
|
110
93
|
/**
|
|
@@ -113,26 +96,15 @@ const chipStyles = {
|
|
|
113
96
|
skeletonChip: ({ theme, ownerState }) => ({
|
|
114
97
|
width: "100%",
|
|
115
98
|
background: theme.vars.palette.skeleton.transition,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
// Estilos específicos para el tamaño medium
|
|
127
|
-
...ownerState.size === "medium" && {
|
|
128
|
-
...theme.generalSettings.isMobile ? {
|
|
129
|
-
height: theme.vars.size.mobile.medium.base,
|
|
130
|
-
minHeight: theme.vars.size.mobile.medium.base
|
|
131
|
-
} : {
|
|
132
|
-
height: theme.vars.size.desktop.medium.base,
|
|
133
|
-
minHeight: theme.vars.size.desktop.medium.base
|
|
134
|
-
}
|
|
135
|
-
}
|
|
99
|
+
...getSizeStyles(
|
|
100
|
+
theme,
|
|
101
|
+
ownerState.size || "medium",
|
|
102
|
+
"base",
|
|
103
|
+
(size) => ({
|
|
104
|
+
height: size,
|
|
105
|
+
minHeight: size
|
|
106
|
+
})
|
|
107
|
+
)
|
|
136
108
|
})
|
|
137
109
|
};
|
|
138
110
|
export {
|
|
@@ -28,8 +28,8 @@ const IconButtonStyled = styled(IconButton, {
|
|
|
28
28
|
})(chipStyles?.iconButton);
|
|
29
29
|
export {
|
|
30
30
|
ChipRootStyled as C,
|
|
31
|
-
|
|
31
|
+
IconStyled as I,
|
|
32
32
|
SkeletonChipStyled as S,
|
|
33
33
|
TextChipStyled as T,
|
|
34
|
-
|
|
34
|
+
IconButtonStyled as a
|
|
35
35
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c as containerQuery } from "../../utils/containerQuery.js";
|
|
2
2
|
import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
|
|
3
|
-
import {
|
|
3
|
+
import { g as getSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
4
4
|
const CONTAINER_QUERY_NAME = "dynamic";
|
|
5
5
|
const dynamicSortStyles = {
|
|
6
6
|
/**
|
|
@@ -55,13 +55,12 @@ const dynamicSortStyles = {
|
|
|
55
55
|
overflow: "hidden",
|
|
56
56
|
...getSizeStyles(
|
|
57
57
|
theme,
|
|
58
|
-
theme.generalSettings.isMobile,
|
|
59
58
|
ownerState.size || "medium",
|
|
60
59
|
"container",
|
|
61
|
-
(
|
|
62
|
-
height,
|
|
63
|
-
minHeight:
|
|
64
|
-
maxHeight:
|
|
60
|
+
(size) => ({
|
|
61
|
+
height: size,
|
|
62
|
+
minHeight: size,
|
|
63
|
+
maxHeight: size
|
|
65
64
|
})
|
|
66
65
|
),
|
|
67
66
|
maxWidth: "135px",
|
|
@@ -81,13 +80,12 @@ const dynamicSortStyles = {
|
|
|
81
80
|
inputSortInput: ({ theme, ownerState }) => ({
|
|
82
81
|
...getSizeStyles(
|
|
83
82
|
theme,
|
|
84
|
-
theme.generalSettings.isMobile,
|
|
85
83
|
ownerState.size || "medium",
|
|
86
84
|
"action",
|
|
87
|
-
(
|
|
88
|
-
height,
|
|
89
|
-
minHeight:
|
|
90
|
-
maxHeight:
|
|
85
|
+
(size) => ({
|
|
86
|
+
height: size,
|
|
87
|
+
minHeight: size,
|
|
88
|
+
maxHeight: size
|
|
91
89
|
})
|
|
92
90
|
),
|
|
93
91
|
...getTypographyStyles(
|
|
@@ -314,13 +312,12 @@ const dynamicSortStyles = {
|
|
|
314
312
|
marginRight: theme.vars.size.baseSpacings.sp2,
|
|
315
313
|
...getSizeStyles(
|
|
316
314
|
theme,
|
|
317
|
-
theme.generalSettings.isMobile,
|
|
318
315
|
ownerState.size || "medium",
|
|
319
316
|
"base",
|
|
320
|
-
(
|
|
321
|
-
height,
|
|
322
|
-
minHeight:
|
|
323
|
-
maxHeight:
|
|
317
|
+
(size) => ({
|
|
318
|
+
height: size,
|
|
319
|
+
minHeight: size,
|
|
320
|
+
maxHeight: size
|
|
324
321
|
})
|
|
325
322
|
)
|
|
326
323
|
})
|
package/components/Icon/Icon.js
CHANGED
|
@@ -17,16 +17,21 @@ const Icon = (props) => {
|
|
|
17
17
|
className,
|
|
18
18
|
placement = "bottom",
|
|
19
19
|
instaceDataTestId,
|
|
20
|
-
disabled
|
|
20
|
+
disabled,
|
|
21
|
+
selected,
|
|
22
|
+
enabledSelected
|
|
21
23
|
} = props;
|
|
22
24
|
const { currentSize } = useComponentSize(size);
|
|
25
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
23
26
|
const isSkeleton = useModuleSkeleton();
|
|
24
27
|
const ownerState = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
size: adjustedSize,
|
|
29
|
+
color,
|
|
30
|
+
src,
|
|
31
|
+
disabled,
|
|
32
|
+
rotationAngle,
|
|
33
|
+
selected,
|
|
34
|
+
enabledSelected,
|
|
30
35
|
isSkeleton
|
|
31
36
|
};
|
|
32
37
|
const classKey = getComponentClasses(ICON_KEY_COMPONENT, IconSlots);
|
|
@@ -38,6 +43,7 @@ const Icon = (props) => {
|
|
|
38
43
|
title: tooltipContent,
|
|
39
44
|
ownerState: { ...ownerState },
|
|
40
45
|
placement,
|
|
46
|
+
size: adjustedSize,
|
|
41
47
|
...getPropDataTestId(ICON_PREFIX, IconSlots.tooltip, instaceDataTestId),
|
|
42
48
|
children: /* @__PURE__ */ jsx(
|
|
43
49
|
RootStyled,
|
|
@@ -74,7 +80,7 @@ const Icon = (props) => {
|
|
|
74
80
|
)
|
|
75
81
|
}
|
|
76
82
|
),
|
|
77
|
-
isSkeleton && /* @__PURE__ */ jsx(IconSkeletonStyled, { className: classKey.iconSkeleton, role: "icon-skeleton", variant: "rectangular", ownerState: { ...ownerState } })
|
|
83
|
+
isSkeleton && /* @__PURE__ */ jsx(IconSkeletonStyled, { className: classKey.iconSkeleton, role: "icon-skeleton", size: adjustedSize, variant: "rectangular", ownerState: { ...ownerState } })
|
|
78
84
|
] });
|
|
79
85
|
};
|
|
80
86
|
export {
|
|
@@ -14,7 +14,7 @@ const iconStyles = {
|
|
|
14
14
|
alignItems: "center",
|
|
15
15
|
width: "fit-content",
|
|
16
16
|
transition: "transform 0.5s ease-in-out",
|
|
17
|
-
...ownerState.
|
|
17
|
+
...ownerState.size === "medium" && {
|
|
18
18
|
...theme.generalSettings.isMobile ? {
|
|
19
19
|
width: theme.vars.size.mobile.medium.base,
|
|
20
20
|
height: theme.vars.size.mobile.medium.base
|
|
@@ -23,7 +23,7 @@ const iconStyles = {
|
|
|
23
23
|
height: theme.vars.size.desktop.medium.base
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
...ownerState.
|
|
26
|
+
...ownerState.size === "small" && {
|
|
27
27
|
...theme.generalSettings.isMobile ? {
|
|
28
28
|
width: theme.vars.size.mobile.small.base,
|
|
29
29
|
height: theme.vars.size.mobile.small.base
|
|
@@ -40,22 +40,25 @@ const iconStyles = {
|
|
|
40
40
|
* del ícono basada en el ángulo de rotación proporcionado, y el color de fondo que
|
|
41
41
|
* se ajusta de acuerdo con el estado de deshabilitación o no del ícono.
|
|
42
42
|
*/
|
|
43
|
-
icon: ({ theme, ownerState }) =>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
43
|
+
icon: ({ theme, ownerState }) => {
|
|
44
|
+
const backgroundColor = ownerState.disabled ? theme.vars.palette.text.disabled : ownerState.selected && ownerState.enabledSelected ? `${theme.vars.palette.primary.selected} !important` : getPropertyByString(theme.vars.palette, String(ownerState.color), "text.primary");
|
|
45
|
+
return {
|
|
46
|
+
maskPosition: "center",
|
|
47
|
+
maskRepeat: "no-repeat",
|
|
48
|
+
maskSize: "cover",
|
|
49
|
+
WebkitMaskRepeat: "no-repeat",
|
|
50
|
+
mask: `url(${ownerState.src})`,
|
|
51
|
+
WebkitMask: `url(${ownerState.src})`,
|
|
52
|
+
WebkitMaskSize: "cover",
|
|
53
|
+
...ownerState.rotationAngle && {
|
|
54
|
+
transform: `rotate(${ownerState.rotationAngle}deg)`
|
|
55
|
+
},
|
|
56
|
+
backgroundColor,
|
|
57
|
+
width: "inherit",
|
|
58
|
+
height: "inherit",
|
|
59
|
+
variants: []
|
|
60
|
+
};
|
|
61
|
+
},
|
|
59
62
|
/**
|
|
60
63
|
* Slot iconSkeleton: Define los estilos para el esqueleto del ícono.
|
|
61
64
|
* Se utiliza cuando el ícono aún no está completamente cargado, proporcionando
|
|
@@ -65,7 +68,7 @@ const iconStyles = {
|
|
|
65
68
|
iconSkeleton: ({ theme, ownerState }) => ({
|
|
66
69
|
"&.M4lclassCssSpecificity": {
|
|
67
70
|
borderRadius: theme.size.borderRadius.r1,
|
|
68
|
-
...ownerState.
|
|
71
|
+
...ownerState.size === "medium" && {
|
|
69
72
|
...theme.generalSettings.isMobile ? {
|
|
70
73
|
width: theme.vars.size.mobile.medium.base,
|
|
71
74
|
height: theme.vars.size.mobile.medium.base
|
|
@@ -74,7 +77,7 @@ const iconStyles = {
|
|
|
74
77
|
height: theme.vars.size.desktop.medium.base
|
|
75
78
|
}
|
|
76
79
|
},
|
|
77
|
-
...ownerState.
|
|
80
|
+
...ownerState.size === "small" && {
|
|
78
81
|
...theme.generalSettings.isMobile ? {
|
|
79
82
|
width: theme.vars.size.mobile.small.base,
|
|
80
83
|
height: theme.vars.size.mobile.small.base
|
|
@@ -43,16 +43,19 @@ export interface IconProps extends Pick<TooltipProps, 'placement'> {
|
|
|
43
43
|
* Valor que en caso de ser verdadero debe de pintar el svg con color text disabled.
|
|
44
44
|
*/
|
|
45
45
|
disabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Valor que define si el icono debe de estar seleccionado pero depende de la propiedad enableSelected.
|
|
48
|
+
*/
|
|
49
|
+
selected?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Valor que define si el icono debe de estar seleccionado pero depende de la propiedad selected.
|
|
52
|
+
*/
|
|
53
|
+
enabledSelected?: boolean;
|
|
46
54
|
}
|
|
47
55
|
/**
|
|
48
56
|
* Define las las propiedades usadas para estilizar el componente desde el css.
|
|
49
57
|
*/
|
|
50
|
-
export interface IconOwnerState {
|
|
51
|
-
iconSize: Sizes;
|
|
52
|
-
iconRotationAngle?: number;
|
|
53
|
-
iconColor: IconColors;
|
|
54
|
-
iconDisabled?: boolean;
|
|
55
|
-
iconSrc: string;
|
|
58
|
+
export interface IconOwnerState extends Pick<IconProps, 'selected' | 'enabledSelected' | 'size' | 'rotationAngle' | 'color' | 'disabled' | 'src'> {
|
|
56
59
|
isSkeleton: boolean;
|
|
57
60
|
}
|
|
58
61
|
export type IconSlotsType = keyof typeof IconSlots;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
const labelStyles = {
|
|
4
4
|
/**
|
|
5
5
|
* Estilos para el contenedor raíz del Label 🏷️
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getTypographyStyles } from "../../utils/getTypographyStyles.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
const numberInputStyles = {
|
|
4
4
|
/**
|
|
5
5
|
* Estilos aplicados al contenedor principal (root).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
const paperFormStyles = {
|
|
3
3
|
/**
|
|
4
4
|
*************************************************************
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getHeightSizeStyles } from "../../../../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
import { a as ITEM_IN_TREE_ACTIVE, I as ITEM_ACTIVE } from "../../../../constants.js";
|
|
3
3
|
const containerMenuItemsMainStyles = {
|
|
4
4
|
/**
|
package/components/extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.styles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getHeightSizeStyles } from "../../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
const propagateLoaderSpinnerStyles = {
|
|
3
3
|
/**
|
|
4
4
|
* Estilos del componente raíz del contenedor de la ventana.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getTypographyStyles } from "../../../utils/getTypographyStyles.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
const dateTimePickerStyles = {
|
|
4
4
|
/**
|
|
5
5
|
* Estilos para el root cuando esta en Desktop 💻
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
1
2
|
import { IconButtonProps } from './types';
|
|
2
3
|
/**
|
|
3
4
|
*Los Icon button son habitualmente ubicados en barras de aplicaciones y barras de herramientas. Además, resulta adecuado emplear iconos en botones de alternancia que posibilitan la selección o deselección de una única opción, como añadir o eliminar una estrella a un elemento.
|
|
4
5
|
* @param props
|
|
5
6
|
* @returns
|
|
6
7
|
*/
|
|
7
|
-
export declare const IconButton:
|
|
8
|
+
export declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useMemo } from "react";
|
|
3
|
-
import { useModuleSkeleton
|
|
4
|
-
import { useTheme } from "@mui/material";
|
|
2
|
+
import React, { forwardRef, useMemo, cloneElement } from "react";
|
|
3
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
5
4
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
6
5
|
import { e as evalIconColor } from "./helpers/evalIconColor.js";
|
|
7
6
|
import { I as ICON_BUTTON_KEY_COMPONENT } from "./constants.js";
|
|
@@ -31,33 +30,24 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
31
30
|
const classRoot = getComponentSlotRoot(ICON_BUTTON_KEY_COMPONENT);
|
|
32
31
|
const { currentSize } = useComponentSize(size);
|
|
33
32
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
34
|
-
const theme = useTheme();
|
|
35
33
|
const isSkeleton = useModuleSkeleton();
|
|
36
|
-
const
|
|
37
|
-
theme.vars.palette,
|
|
38
|
-
disabled ? "default" : componentPaletteColor,
|
|
39
|
-
theme.vars.palette.default
|
|
40
|
-
);
|
|
41
|
-
const OwnerState = {
|
|
34
|
+
const OwnerState = useMemo(() => ({
|
|
42
35
|
variant,
|
|
43
36
|
size: adjustedSize,
|
|
44
37
|
disabled,
|
|
45
|
-
paletteColor,
|
|
46
38
|
componentPaletteColor,
|
|
47
39
|
selected,
|
|
48
40
|
isSkeleton
|
|
49
|
-
};
|
|
41
|
+
}), [variant, adjustedSize, disabled, componentPaletteColor, selected, isSkeleton]);
|
|
50
42
|
const iconColor = useMemo(
|
|
51
43
|
() => evalIconColor(componentPaletteColor, variant),
|
|
52
44
|
[componentPaletteColor, variant]
|
|
53
45
|
);
|
|
54
|
-
const renderIcon = (arg) => {
|
|
55
|
-
if (!arg) {
|
|
56
|
-
return
|
|
46
|
+
const renderIcon = useMemo(() => (arg) => {
|
|
47
|
+
if (!arg || typeof arg === "boolean" || typeof arg === "number") {
|
|
48
|
+
return null;
|
|
57
49
|
}
|
|
58
|
-
if (typeof arg
|
|
59
|
-
return arg;
|
|
60
|
-
} else {
|
|
50
|
+
if (typeof arg === "string") {
|
|
61
51
|
return /* @__PURE__ */ jsx(
|
|
62
52
|
Icon,
|
|
63
53
|
{
|
|
@@ -65,11 +55,19 @@ const IconButton = forwardRef((props, ref) => {
|
|
|
65
55
|
size: adjustedSize,
|
|
66
56
|
color: iconColor,
|
|
67
57
|
disabled,
|
|
68
|
-
rotationAngle
|
|
58
|
+
rotationAngle,
|
|
59
|
+
selected,
|
|
60
|
+
enabledSelected: true
|
|
69
61
|
}
|
|
70
62
|
);
|
|
71
63
|
}
|
|
72
|
-
|
|
64
|
+
if (React.isValidElement(arg)) {
|
|
65
|
+
return cloneElement(arg, {
|
|
66
|
+
selected: variant !== "contained" ? selected : false
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}, [adjustedSize, disabled, iconColor, rotationAngle, selected, variant]);
|
|
73
71
|
if (isSkeleton) {
|
|
74
72
|
return /* @__PURE__ */ jsx(SkeletonStyled, { ownerState: { ...OwnerState } });
|
|
75
73
|
}
|
|
@@ -1,194 +1,150 @@
|
|
|
1
|
+
import { g as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
1
2
|
const iconButtonStyles = {
|
|
2
3
|
/**
|
|
3
4
|
* TODO: Documentar
|
|
4
5
|
*/
|
|
5
|
-
styledMUIIconButton: ({ ownerState, theme }) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
width: theme.vars.size.mobile.medium.action,
|
|
30
|
-
height: theme.vars.size.mobile.medium.action
|
|
31
|
-
} : {
|
|
32
|
-
width: theme.vars.size.desktop.medium.action,
|
|
33
|
-
height: theme.vars.size.desktop.medium.action
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
// Variante text en Finalizado
|
|
37
|
-
...ownerState.variant === "text" && {
|
|
38
|
-
...ownerState.selected === true ? {
|
|
39
|
-
backgroundColor: ownerState.paletteColor?.activeOpacity,
|
|
40
|
-
'& [class*="M4LIcon-icon"]': {
|
|
41
|
-
backgroundColor: ownerState.componentPaletteColor === "default" ? ownerState.paletteColor?.contrastText : ownerState.paletteColor?.active
|
|
6
|
+
styledMUIIconButton: ({ ownerState, theme }) => {
|
|
7
|
+
const paletteColor = ownerState.disabled ? theme.vars.palette["default"] : ownerState.selected ? theme.vars.palette["primary"] : theme.vars.palette[ownerState.componentPaletteColor || "default"];
|
|
8
|
+
return {
|
|
9
|
+
overflow: "hidden",
|
|
10
|
+
cursor: ownerState.disabled ? "not-allowed" : "pointer",
|
|
11
|
+
color: theme.vars.palette.text.primary,
|
|
12
|
+
borderRadius: theme.size.borderRadius.r1,
|
|
13
|
+
pointerEvents: ownerState.disabled ? "none" : "auto",
|
|
14
|
+
display: ownerState.isSkeleton ? "none" : "flex",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
// Override de estilos de Material UI
|
|
17
|
+
padding: 0,
|
|
18
|
+
// condiciones de tamaño
|
|
19
|
+
// condiciones de tamaño Small
|
|
20
|
+
// Tamaño del componente
|
|
21
|
+
...getSizeStyles(
|
|
22
|
+
theme,
|
|
23
|
+
ownerState.size || "medium",
|
|
24
|
+
"action",
|
|
25
|
+
(size) => {
|
|
26
|
+
return {
|
|
27
|
+
width: size,
|
|
28
|
+
height: size
|
|
29
|
+
};
|
|
42
30
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
),
|
|
32
|
+
// Variante text en Finalizado
|
|
33
|
+
...ownerState.variant === "text" && {
|
|
34
|
+
...ownerState.selected === true ? {
|
|
35
|
+
backgroundColor: paletteColor.activeOpacity,
|
|
36
|
+
'& [class*="M4LIcon-icon"]': {
|
|
37
|
+
backgroundColor: ownerState.componentPaletteColor === "default" ? paletteColor.contrastText : paletteColor.semanticText
|
|
38
|
+
}
|
|
39
|
+
} : {
|
|
40
|
+
"&:hover": {
|
|
41
|
+
backgroundColor: paletteColor.hoverOpacity
|
|
42
|
+
},
|
|
43
|
+
//FocusActive
|
|
44
|
+
"&:active": {
|
|
45
|
+
backgroundColor: paletteColor.activeOpacity,
|
|
46
|
+
'& [class*="M4LIcon-icon"]': {
|
|
47
|
+
backgroundColor: ownerState.componentPaletteColor === "default" ? paletteColor.contrastText : paletteColor.active
|
|
48
|
+
}
|
|
49
|
+
}
|
|
46
50
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
"&:focus-visible": {
|
|
52
|
+
background: paletteColor.activeOpacity,
|
|
53
|
+
outline: `1px solid ${theme.vars.palette.border.main}`,
|
|
50
54
|
'& [class*="M4LIcon-icon"]': {
|
|
51
|
-
backgroundColor: ownerState.componentPaletteColor === "default" ?
|
|
55
|
+
backgroundColor: ownerState.componentPaletteColor === "default" ? paletteColor.contrastText : paletteColor.active
|
|
52
56
|
}
|
|
57
|
+
},
|
|
58
|
+
// Variantes text en disabled
|
|
59
|
+
...ownerState.disabled === true && {
|
|
60
|
+
color: theme.vars.palette.action.disabled
|
|
53
61
|
}
|
|
54
62
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// Variantes text en disabled
|
|
63
|
-
...ownerState.disabled === true && {
|
|
64
|
-
color: theme.vars.palette.action.disabled
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
// Variante outline en Finalizada
|
|
68
|
-
...ownerState.variant === "outline" && {
|
|
69
|
-
...ownerState.componentPaletteColor !== "default" && {
|
|
70
|
-
border: `1px solid ${ownerState.paletteColor?.main}`
|
|
71
|
-
},
|
|
72
|
-
...ownerState.componentPaletteColor === "default" && {
|
|
73
|
-
border: `1px solid ${theme.vars.palette.border.default}`
|
|
74
|
-
},
|
|
75
|
-
...ownerState.selected === true ? {
|
|
76
|
-
background: ownerState.paletteColor?.activeOpacity,
|
|
77
|
-
border: `1px solid ${ownerState.paletteColor?.active}`,
|
|
78
|
-
'& [class*="M4LIcon-icon"]': {
|
|
79
|
-
backgroundColor: ownerState.componentPaletteColor === "default" ? theme.vars.palette.text.primary : ownerState.paletteColor?.active
|
|
80
|
-
}
|
|
81
|
-
} : {
|
|
82
|
-
"&:hover": {
|
|
83
|
-
background: ownerState.paletteColor?.hoverOpacity
|
|
63
|
+
// Variante outline en Finalizada
|
|
64
|
+
...ownerState.variant === "outline" && {
|
|
65
|
+
...ownerState.componentPaletteColor !== "default" && {
|
|
66
|
+
border: `1px solid ${paletteColor.main}`
|
|
67
|
+
},
|
|
68
|
+
...ownerState.componentPaletteColor === "default" && {
|
|
69
|
+
border: `1px solid ${theme.vars.palette.border.default}`
|
|
84
70
|
},
|
|
85
|
-
|
|
86
|
-
background:
|
|
87
|
-
border: `1px solid ${
|
|
71
|
+
...ownerState.selected === true ? {
|
|
72
|
+
background: paletteColor.activeOpacity,
|
|
73
|
+
border: `1px solid ${paletteColor.active}`,
|
|
88
74
|
'& [class*="M4LIcon-icon"]': {
|
|
89
|
-
backgroundColor: ownerState.componentPaletteColor === "default" ? theme.vars.palette.text.primary :
|
|
75
|
+
backgroundColor: ownerState.componentPaletteColor === "default" ? theme.vars.palette.text.primary : paletteColor.active
|
|
76
|
+
}
|
|
77
|
+
} : {
|
|
78
|
+
"&:hover": {
|
|
79
|
+
background: paletteColor.hoverOpacity
|
|
80
|
+
},
|
|
81
|
+
"&:active": {
|
|
82
|
+
background: paletteColor.activeOpacity,
|
|
83
|
+
border: `1px solid ${paletteColor.active}`,
|
|
84
|
+
'& [class*="M4LIcon-icon"]': {
|
|
85
|
+
backgroundColor: ownerState.componentPaletteColor === "default" ? theme.vars.palette.text.primary : paletteColor.active
|
|
86
|
+
}
|
|
90
87
|
}
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
...ownerState.disabled === true && {
|
|
94
|
-
border: `1px solid ${theme.vars.palette.border.default}`
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
// Variantes contained Finalizada
|
|
98
|
-
...ownerState.variant === "contained" && {
|
|
99
|
-
backgroundColor: ownerState.paletteColor?.enabled,
|
|
100
|
-
//Color del icono que cambia
|
|
101
|
-
'& [class*="M4LIcon-icon"]': {
|
|
102
|
-
backgroundColor: ownerState.paletteColor?.contrastText
|
|
103
|
-
},
|
|
104
|
-
// Cuando recibe en la prop `selected` un true se visualiza el modo :active
|
|
105
|
-
...ownerState.selected === true ? {
|
|
106
|
-
background: ownerState.paletteColor?.active
|
|
107
|
-
} : {
|
|
108
|
-
//Estado Hover
|
|
109
|
-
"&:hover": {
|
|
110
|
-
background: ownerState.paletteColor?.hover
|
|
111
88
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
background: ownerState.paletteColor?.active
|
|
89
|
+
...ownerState.disabled === true && {
|
|
90
|
+
border: `1px solid ${theme.vars.palette.border.default}`
|
|
115
91
|
}
|
|
116
92
|
},
|
|
117
|
-
// Variantes contained
|
|
118
|
-
...ownerState.
|
|
119
|
-
|
|
93
|
+
// Variantes contained Finalizada
|
|
94
|
+
...ownerState.variant === "contained" && {
|
|
95
|
+
backgroundColor: paletteColor.enabled,
|
|
96
|
+
//Color del icono que cambia
|
|
120
97
|
'& [class*="M4LIcon-icon"]': {
|
|
121
|
-
|
|
98
|
+
backgroundColor: paletteColor.contrastText
|
|
99
|
+
},
|
|
100
|
+
// Cuando recibe en la prop `selected` un true se visualiza el modo :active
|
|
101
|
+
...ownerState.selected === true ? {
|
|
102
|
+
background: paletteColor.active
|
|
103
|
+
} : {
|
|
104
|
+
//Estado Hover
|
|
105
|
+
"&:hover": {
|
|
106
|
+
background: paletteColor.hover
|
|
107
|
+
},
|
|
108
|
+
//Estado Active
|
|
109
|
+
"&:active": {
|
|
110
|
+
background: paletteColor.active
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
// Variantes contained en disabled
|
|
114
|
+
...ownerState.disabled === true && {
|
|
115
|
+
background: `${paletteColor.main} !important`,
|
|
116
|
+
'& [class*="M4LIcon-icon"]': {
|
|
117
|
+
color: theme.vars.palette.action.disabled
|
|
118
|
+
}
|
|
122
119
|
}
|
|
120
|
+
},
|
|
121
|
+
...ownerState.selected === true && {
|
|
122
|
+
outline: `1px solid ${paletteColor.selected}`,
|
|
123
|
+
outlineOffset: 2
|
|
123
124
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
outline: `1px solid ${ownerState.paletteColor?.selected}`,
|
|
127
|
-
outlineOffset: 2
|
|
128
|
-
}
|
|
129
|
-
}),
|
|
125
|
+
};
|
|
126
|
+
},
|
|
130
127
|
/**
|
|
131
128
|
* Comentado por el momento, falta de documentación en Figma de Badge
|
|
132
129
|
*/
|
|
133
|
-
badgeIconButton:
|
|
134
|
-
// '& [class*="MuiBadge-badge"]': {
|
|
135
|
-
// display: 'flex',
|
|
136
|
-
// justifyContent: 'center',
|
|
137
|
-
// alignItems: 'center',
|
|
138
|
-
// fontSize: '11px',
|
|
139
|
-
// backgroundColor: ownerState.paletteColor?.active,
|
|
140
|
-
// color: ownerState.paletteColor?.contrastText,
|
|
141
|
-
// // condiciones de tamaño Small
|
|
142
|
-
// ...(ownerState.size === 'small' && {
|
|
143
|
-
// ...(theme.generalSettings.isMobile
|
|
144
|
-
// ? {
|
|
145
|
-
// width: theme.size.desktop.base.small,
|
|
146
|
-
// height: theme.size.desktop.base.small,
|
|
147
|
-
// }
|
|
148
|
-
// : {
|
|
149
|
-
// width: theme.size.desktop.base.small,
|
|
150
|
-
// height: theme.size.desktop.base.small,
|
|
151
|
-
// }),
|
|
152
|
-
// }),
|
|
153
|
-
// // condiciones de tamaño Medium
|
|
154
|
-
// ...(ownerState.size === 'medium' && {
|
|
155
|
-
// ...(theme.generalSettings.isMobile
|
|
156
|
-
// ? {
|
|
157
|
-
// width: theme.size.mobile.base.medium,
|
|
158
|
-
// height: theme.size.mobile.base.medium,
|
|
159
|
-
// }
|
|
160
|
-
// : {
|
|
161
|
-
// width: theme.size.desktop.base.medium,
|
|
162
|
-
// height: theme.size.desktop.base.medium,
|
|
163
|
-
// }),
|
|
164
|
-
// }),
|
|
165
|
-
// },
|
|
166
|
-
}),
|
|
130
|
+
badgeIconButton: {},
|
|
167
131
|
/**
|
|
168
132
|
* Slot skeleton con sus estilos de tamaño
|
|
169
133
|
*/
|
|
170
134
|
skeleton: ({ theme, ownerState }) => ({
|
|
171
135
|
"&.M4lclassCssSpecificity": {
|
|
172
136
|
// condiciones de tamaño Small
|
|
173
|
-
...
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
137
|
+
...getSizeStyles(
|
|
138
|
+
theme,
|
|
139
|
+
ownerState.size || "medium",
|
|
140
|
+
"action",
|
|
141
|
+
(size) => {
|
|
142
|
+
return {
|
|
143
|
+
width: size,
|
|
144
|
+
height: size
|
|
145
|
+
};
|
|
180
146
|
}
|
|
181
|
-
|
|
182
|
-
// condiciones de tamaño Medium
|
|
183
|
-
...ownerState.size === "medium" && {
|
|
184
|
-
...theme.generalSettings.isMobile ? {
|
|
185
|
-
width: theme.vars.size.mobile.medium.action,
|
|
186
|
-
height: theme.vars.size.mobile.medium.action
|
|
187
|
-
} : {
|
|
188
|
-
width: theme.vars.size.desktop.medium.action,
|
|
189
|
-
height: theme.vars.size.desktop.medium.action
|
|
190
|
-
}
|
|
191
|
-
}
|
|
147
|
+
)
|
|
192
148
|
}
|
|
193
149
|
})
|
|
194
150
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
2
|
-
import {
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
3
|
import { IconProps } from '../../Icon/types';
|
|
4
4
|
import { IconButtonProps as MUIIconButtonProps } from '@mui/material';
|
|
5
5
|
import { ComponentPalletColor, Sizes } from '@m4l/styles';
|
|
@@ -32,7 +32,7 @@ export type IconButtonSize = 'small' | 'medium';
|
|
|
32
32
|
* [disabled] - Whether the IconButton is disabled.
|
|
33
33
|
* [instaceDataTestId] - A unique identifier for the HTML element, useful for unit and integration testing.
|
|
34
34
|
*/
|
|
35
|
-
export interface IconButtonProps extends Omit<IconProps, 'size' | 'color' | 'src'>, Omit<MUIIconButtonProps, 'size' | 'color' | 'disabled' | 'src'>, Pick<BadgeProps, 'badgeContent'>, Pick<TooltipProps, 'placement'> {
|
|
35
|
+
export interface IconButtonProps extends Omit<IconProps, 'size' | 'color' | 'src' | 'selected' | 'enabledSelected'>, Omit<MUIIconButtonProps, 'size' | 'color' | 'disabled' | 'src'>, Pick<BadgeProps, 'badgeContent'>, Pick<TooltipProps, 'placement'> {
|
|
36
36
|
/**
|
|
37
37
|
* Define el uso de tooltip en IconButton
|
|
38
38
|
*/
|
|
@@ -48,7 +48,7 @@ export interface IconButtonProps extends Omit<IconProps, 'size' | 'color' | 'src
|
|
|
48
48
|
/**
|
|
49
49
|
* Define el tamaño del componente
|
|
50
50
|
*/
|
|
51
|
-
size?: Sizes
|
|
51
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
52
52
|
/**
|
|
53
53
|
* Define el mensaje interno del tooltip
|
|
54
54
|
*/
|
|
@@ -85,7 +85,6 @@ export interface IconButtonProps extends Omit<IconProps, 'size' | 'color' | 'src
|
|
|
85
85
|
*/
|
|
86
86
|
export type IconButtonOwnerState = Pick<IconButtonProps, 'size' | 'variant' | 'componentPaletteColor' | 'selected'> & {
|
|
87
87
|
disabled?: boolean;
|
|
88
|
-
paletteColor: PaletteColor;
|
|
89
88
|
isSkeleton: boolean;
|
|
90
89
|
};
|
|
91
90
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useModuleSkeleton, useEnvironment } from "@m4l/core";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
+
import React, { useMemo, cloneElement } from "react";
|
|
4
5
|
import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
|
|
5
6
|
import { M as MENUITEM_CLASSES } from "./constants.js";
|
|
6
|
-
import { M as
|
|
7
|
+
import { M as MenuItemIconStyled, a as MenuItemSkeletonStyled, b as MenuItemRootStyled, c as MenuItemIconCheckedStyled, d as MenuItemContainerStyled, e as MenuItemTypographyStyled } from "./slots/MenuItemSlots.js";
|
|
7
8
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
8
9
|
const MenuItem = (props) => {
|
|
9
10
|
const {
|
|
@@ -25,36 +26,25 @@ const MenuItem = (props) => {
|
|
|
25
26
|
const isSkeleton = useModuleSkeleton();
|
|
26
27
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
27
28
|
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
28
|
-
const ownerState = {
|
|
29
|
+
const ownerState = useMemo(() => ({
|
|
29
30
|
size: adjustedSize,
|
|
30
31
|
disabled,
|
|
31
32
|
selected,
|
|
32
33
|
color,
|
|
33
34
|
checkable,
|
|
34
35
|
checked
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
MenuItemSkeletonStyled,
|
|
39
|
-
{
|
|
40
|
-
"data-testid": "SkeletonMenuItem",
|
|
41
|
-
width: skeletonWidth,
|
|
42
|
-
ownerState: { ...ownerState },
|
|
43
|
-
className: MENUITEM_CLASSES.skeleton
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
const renderIcon = (icon, instaceDataTestId, classNameIcon) => {
|
|
48
|
-
if (!icon) {
|
|
36
|
+
}), [adjustedSize, disabled, selected, color, checkable, checked]);
|
|
37
|
+
const renderIcon = useMemo(() => (icon, instaceDataTestId, classNameIcon) => {
|
|
38
|
+
if (!icon || typeof icon === "boolean" || typeof icon === "number") {
|
|
49
39
|
return null;
|
|
50
40
|
}
|
|
51
|
-
if (typeof icon
|
|
52
|
-
return icon;
|
|
53
|
-
} else {
|
|
41
|
+
if (typeof icon === "string") {
|
|
54
42
|
return /* @__PURE__ */ jsx(
|
|
55
43
|
MenuItemIconStyled,
|
|
56
44
|
{
|
|
57
45
|
ownerState: { ...ownerState },
|
|
46
|
+
selected,
|
|
47
|
+
enabledSelected: true,
|
|
58
48
|
src: icon,
|
|
59
49
|
alt: "icon",
|
|
60
50
|
size: adjustedSize,
|
|
@@ -64,7 +54,24 @@ const MenuItem = (props) => {
|
|
|
64
54
|
}
|
|
65
55
|
);
|
|
66
56
|
}
|
|
67
|
-
|
|
57
|
+
if (React.isValidElement(icon)) {
|
|
58
|
+
return cloneElement(icon, {
|
|
59
|
+
selected
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}, [ownerState, adjustedSize, disabled, selected]);
|
|
64
|
+
if (isSkeleton) {
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
MenuItemSkeletonStyled,
|
|
67
|
+
{
|
|
68
|
+
"data-testid": "SkeletonMenuItem",
|
|
69
|
+
width: skeletonWidth,
|
|
70
|
+
ownerState: { ...ownerState },
|
|
71
|
+
className: MENUITEM_CLASSES.skeleton
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
68
75
|
const checkedIcon = `${host_static_assets}/${environment_assets}/frontend/components/menu_item/checked.svg`;
|
|
69
76
|
return /* @__PURE__ */ jsxs(
|
|
70
77
|
MenuItemRootStyled,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
const menuItemStyles = {
|
|
3
3
|
/**
|
|
4
4
|
* Estilos para el contenedor de los items del menú contenedor
|
|
@@ -31,10 +31,10 @@ const MenuItemSkeletonStyled = styled(Skeleton, {
|
|
|
31
31
|
slot: MenuItemSlots.skeletonMenuItem
|
|
32
32
|
})(menuItemStyles?.skeletonMenuItem);
|
|
33
33
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
MenuItemIconStyled as M,
|
|
35
|
+
MenuItemSkeletonStyled as a,
|
|
36
|
+
MenuItemRootStyled as b,
|
|
37
|
+
MenuItemIconCheckedStyled as c,
|
|
38
|
+
MenuItemContainerStyled as d,
|
|
39
|
+
MenuItemTypographyStyled as e
|
|
40
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
import { g as getTypographyStyles } from "../../../utils/getTypographyStyles.js";
|
|
3
3
|
const navLinkStyles = {
|
|
4
4
|
/* *
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SELECT_CLASSES } from "./constants.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getHeightSizeStyles, g as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
const selectStyles = {
|
|
4
4
|
/**
|
|
5
5
|
* Estilos para el componente Select
|
|
@@ -64,7 +64,6 @@ const selectStyles = {
|
|
|
64
64
|
// Tamaño del componente
|
|
65
65
|
...getSizeStyles(
|
|
66
66
|
theme,
|
|
67
|
-
theme.generalSettings.isMobile,
|
|
68
67
|
ownerState.size || "medium",
|
|
69
68
|
"action",
|
|
70
69
|
(height) => {
|
|
@@ -136,7 +135,6 @@ const selectStyles = {
|
|
|
136
135
|
// Estilos específicos para el tamaño small
|
|
137
136
|
...getSizeStyles(
|
|
138
137
|
theme,
|
|
139
|
-
theme.generalSettings.isMobile,
|
|
140
138
|
ownerState.size || "medium",
|
|
141
139
|
"action",
|
|
142
140
|
(height) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getTypographyStyles } from "../../../utils/getTypographyStyles.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getHeightSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
3
3
|
import { T as TEXT_FIELD_CLASSES } from "./constants.js";
|
|
4
4
|
const textFieldStyles = {
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
2
|
import { g as getTypographyStyles } from "../../../utils/getTypographyStyles.js";
|
|
3
3
|
const typographyStyles = {
|
|
4
4
|
/**
|
|
@@ -42,7 +42,6 @@ const typographyStyles = {
|
|
|
42
42
|
skeleton: ({ theme, ownerState }) => ({
|
|
43
43
|
...getSizeStyles(
|
|
44
44
|
theme,
|
|
45
|
-
theme.generalSettings.isMobile,
|
|
46
45
|
ownerState.size || "medium",
|
|
47
46
|
"base"
|
|
48
47
|
)
|
package/index.js
CHANGED
|
@@ -205,11 +205,11 @@ import { i as i2 } from "./utils/isValidDate.js";
|
|
|
205
205
|
import { g as g26 } from "./utils/getComponentUtilityClass.js";
|
|
206
206
|
import { g as g27 } from "./utils/getPaletteColor.js";
|
|
207
207
|
import { g as g28 } from "./utils/getTypographyStyles.js";
|
|
208
|
-
import {
|
|
208
|
+
import { a as a15 } from "./utils/getSizeStyles/getSizeStyles.js";
|
|
209
209
|
import { O as O2 } from "./utils/ObjectQueue.js";
|
|
210
|
-
import { g as
|
|
210
|
+
import { g as g29, a as a16 } from "./utils/getComponentSlotRoot.js";
|
|
211
211
|
import { f } from "./utils/formatDistanceToNow/formatDistanteToNow.js";
|
|
212
|
-
import { W as W7, c as c6, b as b4, a as
|
|
212
|
+
import { W as W7, c as c6, b as b4, a as a17, e as e3, d as d7, f as f2 } from "./vendor.js";
|
|
213
213
|
export {
|
|
214
214
|
A5 as AREAS_DICCTIONARY,
|
|
215
215
|
a4 as AREAS_DICTIONARY_ID,
|
|
@@ -386,7 +386,7 @@ export {
|
|
|
386
386
|
W7 as WithContexts,
|
|
387
387
|
c6 as WithFormAutoValidation,
|
|
388
388
|
b4 as WithForms,
|
|
389
|
-
|
|
389
|
+
a17 as WithPopupsProvider,
|
|
390
390
|
e3 as WithScaleIcons,
|
|
391
391
|
d7 as WithWindowsContainer,
|
|
392
392
|
f2 as WithWrapper,
|
|
@@ -406,8 +406,8 @@ export {
|
|
|
406
406
|
b2 as getAreasComponentsDictionary,
|
|
407
407
|
g3 as getAreasDictionary,
|
|
408
408
|
g14 as getCommonActionsDictionary,
|
|
409
|
-
|
|
410
|
-
|
|
409
|
+
g29 as getComponentClasses,
|
|
410
|
+
a16 as getComponentSlotRoot,
|
|
411
411
|
g26 as getComponentUtilityClass,
|
|
412
412
|
g as getDataGridComponentsDictionary,
|
|
413
413
|
g2 as getDataGridRowsFromSet,
|
|
@@ -420,7 +420,7 @@ export {
|
|
|
420
420
|
g9 as getFormatPoints,
|
|
421
421
|
g11 as getFormatPrice,
|
|
422
422
|
g13 as getFormattersComponentsDictionary,
|
|
423
|
-
|
|
423
|
+
a15 as getHeightSizeStyles,
|
|
424
424
|
g17 as getLoadingErrorComponentsDictionary,
|
|
425
425
|
g18 as getMFLoaderComponentsDictionary,
|
|
426
426
|
a8 as getMenuActionsComponentsDictionary,
|
package/package.json
CHANGED
|
@@ -16,7 +16,6 @@ export declare const getHeightSizeStyles: (isMobile: boolean, size: Extract<Size
|
|
|
16
16
|
/**
|
|
17
17
|
* Utilidad que se encarga de obtener los estilos de tamaño para ser usados en el css de los componentes.
|
|
18
18
|
* @param theme - Objeto de tema de MUI.
|
|
19
|
-
* @param isMobile - Modalidad de dispositivo en el que se encuentra la aplicación (Escritorio y móvil). Se espera que se obtenga del objeto
|
|
20
19
|
* theme.generalSettings.isMobile.
|
|
21
20
|
* @param size - Formato de tamaño definido por el componente o el contexto de AppearanceComponentProvider, puede ser small,
|
|
22
21
|
* medium o large.
|
|
@@ -25,4 +24,4 @@ export declare const getHeightSizeStyles: (isMobile: boolean, size: Extract<Size
|
|
|
25
24
|
* @param property - Propiedad CSS que se desea aplicar (por defecto es 'height').
|
|
26
25
|
* @returns Objeto con los estilos calculados.
|
|
27
26
|
*/
|
|
28
|
-
export declare const getSizeStyles: (theme: Theme,
|
|
27
|
+
export declare const getSizeStyles: (theme: Theme, size: Extract<Sizes, "small" | "medium">, variantSize: SizesComponentsTypes, css?: Record<string, any> | ((sizeValue: string | number) => Record<string, any>), property?: "height" | "width") => any;
|
|
@@ -8,8 +8,8 @@ const getHeightSizeStyles = (isMobile, size, variantSize, css) => {
|
|
|
8
8
|
...resolvedCss
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
const getSizeStyles = (theme,
|
|
12
|
-
const sizeValue = theme.vars.size[isMobile ? "mobile" : "desktop"][size][variantSize];
|
|
11
|
+
const getSizeStyles = (theme, size, variantSize, css, property = "height") => {
|
|
12
|
+
const sizeValue = theme.vars.size[theme.generalSettings.isMobile ? "mobile" : "desktop"][size][variantSize];
|
|
13
13
|
const resolvedCss = typeof css === "function" ? css(sizeValue) : css;
|
|
14
14
|
return {
|
|
15
15
|
[property]: sizeValue,
|
|
@@ -17,6 +17,6 @@ const getSizeStyles = (theme, isMobile, size, variantSize, css, property = "heig
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
getHeightSizeStyles as a,
|
|
21
|
+
getSizeStyles as g
|
|
22
22
|
};
|