@m4l/components 9.1.4 → 9.1.6
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/@types/types.d.ts +27 -3
- package/components/CommonActions/components/ActionCancel/ActionCancel.d.ts +11 -0
- package/components/CommonActions/components/ActionCancel/ActionCancel.js +52 -0
- package/components/CommonActions/components/ActionCancel/ActionCancel.test.d.ts +1 -0
- package/components/CommonActions/components/ActionCancel/ActionCancelStyles.d.ts +2 -0
- package/components/CommonActions/components/ActionCancel/ActionCancelStyles.js +6 -0
- package/components/CommonActions/components/ActionCancel/constants.d.ts +8 -0
- package/components/CommonActions/components/ActionCancel/constants.js +4 -0
- package/components/CommonActions/components/ActionCancel/index.d.ts +2 -5
- package/components/CommonActions/components/ActionCancel/index.js +1 -12
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelEnum.d.ts +3 -0
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelEnum.js +7 -0
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +4 -0
- package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.js +12 -0
- package/components/CommonActions/components/ActionCancel/slots/index.d.ts +2 -0
- package/components/CommonActions/components/ActionCancel/slots/index.js +1 -0
- package/components/CommonActions/components/ActionCancel/types.d.ts +33 -0
- package/components/CommonActions/components/ActionCancel/types.js +1 -0
- package/components/CommonActions/components/ActionFormCancel/index.d.ts +4 -0
- package/components/CommonActions/components/ActionFormCancel/index.js +2 -2
- package/components/CommonActions/components/ActionIntro/ActionIntro.d.ts +12 -0
- package/components/CommonActions/components/ActionIntro/ActionIntro.integration.test.d.ts +1 -0
- package/components/CommonActions/components/ActionIntro/ActionIntro.js +51 -0
- package/components/CommonActions/components/ActionIntro/ActionIntro.test.d.ts +1 -0
- package/components/CommonActions/components/ActionIntro/ActionIntroStyles.d.ts +2 -0
- package/components/CommonActions/components/ActionIntro/ActionIntroStyles.js +6 -0
- package/components/CommonActions/components/ActionIntro/constants.d.ts +8 -0
- package/components/CommonActions/components/ActionIntro/constants.js +4 -0
- package/components/CommonActions/components/ActionIntro/index.d.ts +2 -5
- package/components/CommonActions/components/ActionIntro/index.js +1 -25
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroEnum.d.ts +3 -0
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroEnum.js +7 -0
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +4 -0
- package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.js +12 -0
- package/components/CommonActions/components/ActionIntro/slots/index.d.ts +2 -0
- package/components/CommonActions/components/ActionIntro/slots/index.js +1 -0
- package/components/CommonActions/components/ActionIntro/types.d.ts +33 -0
- package/components/CommonActions/components/ActionIntro/types.js +1 -0
- package/components/CommonActions/components/ActionsContainer/index.d.ts +2 -0
- package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
- package/components/ControlIncrement/slots/ControltrolIncrementSlots.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.d.ts +2 -2
- package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.js +2 -2
- package/components/DragResizeWindow/DragResizeWindow.d.ts +9 -5
- package/components/DragResizeWindow/DragResizeWindow.js +6 -5
- package/components/DragResizeWindow/DragResizeWindow.styles.d.ts +4 -0
- package/components/DragResizeWindow/DragResizeWindow.styles.js +20 -3
- package/components/DragResizeWindow/classes/index.js +2 -2
- package/components/DragResizeWindow/constants.d.ts +1 -1
- package/components/DragResizeWindow/constants.js +2 -2
- package/components/DragResizeWindow/helpers/index.d.ts +14 -1
- package/components/DragResizeWindow/helpers/index.js +0 -2
- package/components/DragResizeWindow/hooks/useDimensionEffects.d.ts +4 -0
- package/components/DragResizeWindow/hooks/useDimensionEffects.js +128 -50
- package/components/DragResizeWindow/hooks/useDragOptions.d.ts +3 -3
- package/components/DragResizeWindow/hooks/useResizeOptions.d.ts +20 -1
- package/components/DragResizeWindow/hooks/useResizeOptions.js +1 -1
- package/components/DragResizeWindow/slots/DragResizeWindowSlots.js +3 -3
- package/components/DragResizeWindow/tests/DragResizeWindow.test.d.ts +1 -0
- package/components/DragResizeWindow/types.d.ts +84 -12
- package/components/DragResizeWindow/utils.d.ts +12 -1
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.d.ts +4 -0
- package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +2 -2
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
- package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.d.ts +4 -0
- package/components/Icon/types.d.ts +1 -1
- package/components/Label/slots/LabelSlots.d.ts +1 -1
- package/components/LoadingError/LoadingError.d.ts +5 -0
- package/components/LoadingError/LoadingError.js +7 -1
- package/components/PDFViewer/PDFViewer.d.ts +4 -0
- package/components/PDFViewer/PDFViewer.js +1 -1
- package/components/ToastContainer/ToastContainer.stories.d.ts +4 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.d.ts +43 -1
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.js +4 -5
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/index.d.ts +4 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/index.js +6 -8
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.d.ts +27 -3
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +4 -5
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.d.ts +4 -0
- package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +7 -6
- package/components/extended/React-Resizable/Resizable/Resizable.d.ts +4 -0
- package/components/extended/React-Resizable/Resizable/Resizable.js +13 -1
- package/components/extended/React-Resizable/Resizable/constants.d.ts +1 -0
- package/components/extended/React-Resizable/Resizable/constants.js +3 -1
- package/components/extended/React-Resizable/ResizableBox/ResizableBox.d.ts +6 -2
- package/components/extended/React-Resizable/ResizableBox/ResizableBox.js +14 -2
- package/components/extended/React-Resizable/ResizableBox/ResizeableBox.styles.d.ts +1 -1
- package/components/extended/React-Resizable/ResizableBox/ResizeableBox.styles.js +7 -3
- package/components/extended/React-Resizable/ResizableBox/tests/ResizableBox.integration.test.d.ts +1 -0
- package/components/extended/React-Resizable/ResizableBox/tests/ResizableBox.test.d.ts +1 -0
- package/components/extended/React-Resizable/ResizableBox/types.d.ts +35 -4
- package/components/extended/React-Resizable/helpers.d.ts +151 -34
- package/components/extended/React-Resizable/helpers.js +106 -85
- package/components/extended/React-Resizable/hooks/useResizable.d.ts +16 -0
- package/components/extended/React-Resizable/hooks/useResizable.js +24 -0
- package/components/hook-form/RHFColorPicker/RFHColorPicker.d.ts +4 -0
- package/components/hook-form/RHFColorPicker/RFHColorPicker.js +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/index.d.ts +2 -2
- package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/index.js +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MyActions/index.d.ts +2 -2
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MyActions/index.js +7 -1
- package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.d.ts +2 -2
- package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.js +1 -1
- package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/index.d.ts +2 -2
- package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/index.js +1 -1
- package/components/modal/ModalDialog/index.d.ts +4 -0
- package/components/modal/ModalDialog/index.js +2 -2
- package/components/modal/WindowConfirm/index.d.ts +3 -3
- package/components/modal/WindowConfirm/index.js +2 -2
- package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
- package/components/mui_extended/Button/Button.d.ts +8 -6
- package/components/mui_extended/Button/Button.integration.test.d.ts +1 -0
- package/components/mui_extended/Button/Button.js +70 -34
- package/components/mui_extended/Button/Button.test.d.ts +1 -0
- package/components/mui_extended/Button/ButtonStyles.d.ts +2 -0
- package/components/mui_extended/Button/ButtonStyles.js +223 -0
- package/components/mui_extended/Button/classes/index.d.ts +5 -2
- package/components/mui_extended/Button/classes/index.js +5 -29
- package/components/mui_extended/Button/classes/types.d.ts +10 -0
- package/components/mui_extended/Button/constans.d.ts +8 -0
- package/components/mui_extended/Button/constans.js +4 -0
- package/components/mui_extended/Button/slots/ButtonEnum.d.ts +6 -0
- package/components/mui_extended/Button/slots/ButtonEnum.js +10 -0
- package/components/mui_extended/Button/slots/ButtonSlots.d.ts +15 -0
- package/components/mui_extended/Button/slots/ButtonSlots.js +30 -0
- package/components/mui_extended/Button/slots/index.d.ts +3 -0
- package/components/mui_extended/Button/slots/index.js +1 -0
- package/components/mui_extended/Button/types.d.ts +45 -8
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +2 -2
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +1 -1
- package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
- package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +2 -2
- package/components/mui_extended/ToggleButton/ToggleButton.js +1 -1
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/components/mui_extended/Typography/types.d.ts +5 -1
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +63 -2
- package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.d.ts +1 -1
- package/contexts/ModalContext/index.d.ts +4 -0
- package/contexts/ModalContext/types.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +1 -1
- package/storybook/components/DragResizeWindow/stories/DragResizeWindow.stories.d.ts +7 -0
- package/storybook/components/DragResizeWindow/stories/subcomponents/ContentExample.d.ts +8 -0
- package/{components → storybook/components}/DragResizeWindow/stories/subcomponents/WithExtendedContainer.d.ts +4 -0
- package/{components → storybook/components}/DragResizeWindow/stories/types.d.ts +1 -1
- package/storybook/components/commonActions/components/ActionCancel/ActionCancel.stories.d.ts +22 -0
- package/storybook/components/commonActions/components/ActionIntro/ActionIntro.stories.d.ts +22 -0
- package/storybook/components/extended/mui/Button/Button.stories.d.ts +26 -0
- package/storybook/components/extended/react-resizable/ResizableBox/resizableBox.stories.d.ts +13 -0
- package/components/CommonActions/components/ActionIntro/test/contants.js +0 -4
- package/components/DragResizeWindow/stories/basic.stories.d.ts +0 -13
- package/components/DragResizeWindow/stories/dictionary.d.ts +0 -0
- package/components/DragResizeWindow/stories/subcomponents/ContentExample.d.ts +0 -4
- package/components/extended/React-Resizable/Resizable/stories/basic.stories.d.ts +0 -9
- package/components/extended/React-Resizable/ResizableBox/stories/basic.stories.d.ts +0 -9
- package/components/mui_extended/Button/styles.d.ts +0 -4
- package/components/mui_extended/Button/styles.js +0 -12
- /package/components/{mui_extended/Button/index.test.d.ts → CommonActions/components/ActionCancel/ActionCancel.integration.test.d.ts} +0 -0
- /package/{components → storybook/components}/DragResizeWindow/stories/constants.d.ts +0 -0
|
@@ -1,52 +1,88 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useModuleSkeleton } from "@m4l/core";
|
|
3
|
-
import {
|
|
4
|
-
import MuiButton from "@mui/material/Button";
|
|
5
|
-
import { B as ButtonRoot } from "./styles.js";
|
|
6
|
-
import { u as useUtilityClasses } from "./classes/index.js";
|
|
2
|
+
import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { useTheme } from "@mui/material";
|
|
7
4
|
import clsx from "clsx";
|
|
8
|
-
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
+
import { S as SkeletonButtonStyled, B as ButtonRootStyled, T as TextButtonStyled, a as ButtonIconStyled } from "./slots/ButtonSlots.js";
|
|
8
|
+
const Button = forwardRef((props, ref) => {
|
|
9
9
|
const {
|
|
10
|
+
className,
|
|
11
|
+
endIcon,
|
|
12
|
+
label,
|
|
13
|
+
startIcon,
|
|
14
|
+
color = "default",
|
|
15
|
+
disabled = false,
|
|
10
16
|
size = "small",
|
|
11
17
|
variant = "contained",
|
|
12
|
-
|
|
13
|
-
disabled,
|
|
14
|
-
skeletonWidth = "100px",
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
-
skeletonHeight = "28px",
|
|
17
|
-
colorState,
|
|
18
|
+
skeletonWidth = "100%",
|
|
18
19
|
...others
|
|
19
20
|
} = props;
|
|
21
|
+
const { currentSize } = useComponentSize(size);
|
|
20
22
|
const isSkeleton = useModuleSkeleton();
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
25
|
+
const paletteColor = getPropertyByString(
|
|
26
|
+
theme.vars.palette,
|
|
27
|
+
disabled ? "default" : color || "default",
|
|
28
|
+
theme.vars.palette.default
|
|
29
|
+
);
|
|
21
30
|
const ownerState = {
|
|
22
31
|
size,
|
|
23
32
|
variant,
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
disabled,
|
|
34
|
+
paletteColor,
|
|
35
|
+
color
|
|
36
|
+
};
|
|
37
|
+
if (isSkeleton) {
|
|
38
|
+
return /* @__PURE__ */ jsx(SkeletonButtonStyled, { "data-testid": "SkeletonButton", width: skeletonWidth, ownerState: { ...ownerState } });
|
|
39
|
+
}
|
|
40
|
+
const getAdjustedColor = (btnColor, btnVariant) => {
|
|
41
|
+
return btnVariant === "contained" ? `${btnColor}.contrastText` : `${btnColor}.main`;
|
|
26
42
|
};
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
la plataforma web. */
|
|
38
|
-
/* @__PURE__ */ jsx(
|
|
39
|
-
Skeleton,
|
|
43
|
+
const adjustedColor = getAdjustedColor(color, variant);
|
|
44
|
+
const renderIcon = (icon, instaceDataTestId) => {
|
|
45
|
+
if (!icon) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
if (typeof icon !== "string") {
|
|
49
|
+
return icon;
|
|
50
|
+
} else {
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
ButtonIconStyled,
|
|
40
53
|
{
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
54
|
+
color: adjustedColor,
|
|
55
|
+
ownerState: { ...ownerState },
|
|
56
|
+
src: icon,
|
|
57
|
+
alt: "icon",
|
|
58
|
+
size: adjustedSize,
|
|
59
|
+
disabled,
|
|
60
|
+
instaceDataTestId,
|
|
61
|
+
className: clsx(className)
|
|
45
62
|
}
|
|
46
|
-
)
|
|
47
|
-
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return /* @__PURE__ */ jsx(
|
|
67
|
+
ButtonRootStyled,
|
|
68
|
+
{
|
|
69
|
+
"aria-disabled": disabled,
|
|
70
|
+
role: "button",
|
|
71
|
+
startIcon: renderIcon(startIcon, "ButtonStartIcon"),
|
|
72
|
+
endIcon: renderIcon(endIcon, "ButtonEndIcon"),
|
|
73
|
+
className: clsx(className),
|
|
74
|
+
variant,
|
|
75
|
+
size,
|
|
76
|
+
disabled,
|
|
77
|
+
disableRipple: true,
|
|
78
|
+
ownerState: { ...ownerState },
|
|
79
|
+
ref,
|
|
80
|
+
...others,
|
|
81
|
+
children: /* @__PURE__ */ jsx(TextButtonStyled, { ownerState: { ...ownerState }, color: adjustedColor, children: label })
|
|
82
|
+
}
|
|
48
83
|
);
|
|
49
|
-
};
|
|
84
|
+
});
|
|
85
|
+
Button.displayName = "Button";
|
|
50
86
|
export {
|
|
51
87
|
Button as B
|
|
52
88
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
const buttonStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Styles for the root element of the button component.
|
|
4
|
+
* @author SebastianM - automatic
|
|
5
|
+
* @createdAt 2024-11-06 07:42:00 - automatic
|
|
6
|
+
* @updatedAt 2024-11-12 12:29:51 - automatic
|
|
7
|
+
* @updatedUser SebastianM - automatic
|
|
8
|
+
*/
|
|
9
|
+
buttonRoot: ({ theme, ownerState }) => ({
|
|
10
|
+
display: "flex",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
13
|
+
padding: `0px ${theme.vars.size.baseSpacings.sp1}`,
|
|
14
|
+
boxShadow: "none",
|
|
15
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
16
|
+
"&:disabled": {
|
|
17
|
+
color: theme.vars.palette.text.disabled,
|
|
18
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
19
|
+
},
|
|
20
|
+
...ownerState.variant === "contained" && {
|
|
21
|
+
backgroundColor: ownerState.paletteColor?.main,
|
|
22
|
+
"&:hover": {
|
|
23
|
+
backgroundColor: ownerState.paletteColor?.hover
|
|
24
|
+
},
|
|
25
|
+
"&:active": {
|
|
26
|
+
backgroundColor: ownerState.paletteColor?.active
|
|
27
|
+
},
|
|
28
|
+
"&:focus-visible": {
|
|
29
|
+
boxShadow: "none",
|
|
30
|
+
outline: theme.vars.size.borderStroke.container,
|
|
31
|
+
outlineColor: theme.vars.palette.border.main,
|
|
32
|
+
outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
|
|
33
|
+
backgroundColor: ownerState.paletteColor?.active
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
...ownerState.variant === "outlined" && {
|
|
37
|
+
color: ownerState.paletteColor?.main,
|
|
38
|
+
borderColor: ownerState.paletteColor?.main,
|
|
39
|
+
backgroundColor: "transparent",
|
|
40
|
+
...ownerState.color === "default" && {
|
|
41
|
+
'& [class*="M4LIcon-icon"]': {
|
|
42
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
...ownerState.color === "default" && {
|
|
46
|
+
borderColor: theme.vars.palette.border.default
|
|
47
|
+
},
|
|
48
|
+
...ownerState.color === "warning" && {
|
|
49
|
+
color: ownerState.paletteColor?.active,
|
|
50
|
+
'& [class*="M4LIcon-icon"]': {
|
|
51
|
+
backgroundColor: ownerState.paletteColor?.active
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"&:hover": {
|
|
55
|
+
borderColor: ownerState.paletteColor?.main,
|
|
56
|
+
backgroundColor: ownerState.paletteColor?.hoverOpacity
|
|
57
|
+
},
|
|
58
|
+
"&:active": {
|
|
59
|
+
'& [class*="M4LIcon-icon"]': {
|
|
60
|
+
backgroundColor: ownerState.paletteColor?.active
|
|
61
|
+
},
|
|
62
|
+
...ownerState.color === "default" && {
|
|
63
|
+
'& [class*="M4LIcon-icon"]': {
|
|
64
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
color: ownerState.paletteColor?.active,
|
|
68
|
+
borderColor: ownerState.paletteColor?.active,
|
|
69
|
+
backgroundColor: ownerState.paletteColor?.activeOpacity
|
|
70
|
+
},
|
|
71
|
+
"&:focus-visible": {
|
|
72
|
+
boxShadow: "none",
|
|
73
|
+
outline: theme.vars.size.borderStroke.container,
|
|
74
|
+
outlineColor: theme.vars.palette.border.main,
|
|
75
|
+
outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
|
|
76
|
+
backgroundColor: ownerState.paletteColor?.activeOpacity
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
...ownerState.variant === "text" && {
|
|
80
|
+
color: ownerState.paletteColor?.main,
|
|
81
|
+
borderColor: ownerState.paletteColor?.main,
|
|
82
|
+
backgroundColor: "transparent",
|
|
83
|
+
...ownerState.color === "default" && {
|
|
84
|
+
'& [class*="M4LIcon-icon"]': {
|
|
85
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
...ownerState.color === "warning" && {
|
|
89
|
+
color: ownerState.paletteColor?.active,
|
|
90
|
+
'& [class*="M4LIcon-icon"]': {
|
|
91
|
+
backgroundColor: ownerState.paletteColor?.active
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"&:hover": {
|
|
95
|
+
borderColor: ownerState.paletteColor?.main,
|
|
96
|
+
backgroundColor: ownerState.paletteColor?.hoverOpacity
|
|
97
|
+
},
|
|
98
|
+
"&:active": {
|
|
99
|
+
'& [class*="M4LIcon-icon"]': {
|
|
100
|
+
backgroundColor: ownerState.paletteColor?.active
|
|
101
|
+
},
|
|
102
|
+
...ownerState.color === "default" && {
|
|
103
|
+
'& [class*="M4LIcon-icon"]': {
|
|
104
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
color: ownerState.paletteColor?.active,
|
|
108
|
+
borderColor: ownerState.paletteColor?.active,
|
|
109
|
+
backgroundColor: ownerState.paletteColor?.activeOpacity
|
|
110
|
+
},
|
|
111
|
+
"&:focus-visible": {
|
|
112
|
+
boxShadow: "none",
|
|
113
|
+
outline: theme.vars.size.borderStroke.container,
|
|
114
|
+
outlineColor: theme.vars.palette.border.main,
|
|
115
|
+
outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
|
|
116
|
+
backgroundColor: ownerState.paletteColor?.activeOpacity
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"& span": {
|
|
120
|
+
margin: "0px"
|
|
121
|
+
},
|
|
122
|
+
// Estilos específicos para el tamaño small
|
|
123
|
+
...ownerState.size === "small" && {
|
|
124
|
+
...theme.generalSettings.isMobile ? {
|
|
125
|
+
height: theme.vars.size.mobile.small.action,
|
|
126
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
127
|
+
} : {
|
|
128
|
+
height: theme.vars.size.desktop.small.action,
|
|
129
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
// Estilos específicos para el tamaño medium
|
|
133
|
+
...ownerState.size === "medium" && {
|
|
134
|
+
...theme.generalSettings.isMobile ? {
|
|
135
|
+
height: theme.vars.size.mobile.medium.action,
|
|
136
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
137
|
+
} : {
|
|
138
|
+
height: theme.vars.size.desktop.medium.action,
|
|
139
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
/**
|
|
144
|
+
* Styles for the text of the button component.
|
|
145
|
+
* @author SebastianM - automatic
|
|
146
|
+
* @createdAt 2024-11-07 18:00:35 - automatic
|
|
147
|
+
* @updatedAt 2024-11-12 12:29:51 - automatic
|
|
148
|
+
* @updatedUser SebastianM - automatic
|
|
149
|
+
*/
|
|
150
|
+
textButton: ({ theme, ownerState }) => ({
|
|
151
|
+
...theme.typography.bodyDens,
|
|
152
|
+
...ownerState.variant === "contained" && {
|
|
153
|
+
...(ownerState.color === "default" || ownerState.color === "warning") && {
|
|
154
|
+
color: theme.vars.palette.text.primary
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
...ownerState.variant === "outlined" && {
|
|
158
|
+
...ownerState.color === "default" && {
|
|
159
|
+
color: theme.vars.palette.text.primary
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
...ownerState.variant === "text" && {
|
|
163
|
+
...ownerState.color === "default" && {
|
|
164
|
+
color: theme.vars.palette.text.primary
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
...ownerState.disabled === true && {
|
|
168
|
+
color: theme.vars.palette.text.disabled
|
|
169
|
+
}
|
|
170
|
+
}),
|
|
171
|
+
/**
|
|
172
|
+
* Styles for the skeleton button component.
|
|
173
|
+
* @author SebastianM - automatic
|
|
174
|
+
* @createdAt 2024-11-06 10:12:30 - automatic
|
|
175
|
+
* @updatedAt 2024-11-12 12:29:51 - automatic
|
|
176
|
+
* @updatedUser SebastianM - automatic
|
|
177
|
+
*/
|
|
178
|
+
skeletonButton: ({ theme, ownerState }) => ({
|
|
179
|
+
width: "100%",
|
|
180
|
+
background: theme.vars.palette.skeleton.transition,
|
|
181
|
+
// Estilos específicos para el tamaño small
|
|
182
|
+
...ownerState.size === "small" && {
|
|
183
|
+
...theme.generalSettings.isMobile ? {
|
|
184
|
+
height: theme.vars.size.mobile.small.action,
|
|
185
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
186
|
+
} : {
|
|
187
|
+
height: theme.vars.size.desktop.small.action,
|
|
188
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
189
|
+
},
|
|
190
|
+
[theme.breakpoints.up("sm")]: {
|
|
191
|
+
...theme.generalSettings.isMobile ? {
|
|
192
|
+
height: theme.vars.size.mobile.small.action,
|
|
193
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
194
|
+
} : {
|
|
195
|
+
height: theme.vars.size.desktop.small.action,
|
|
196
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
// Estilos específicos para el tamaño medium
|
|
201
|
+
...ownerState.size === "medium" && {
|
|
202
|
+
...theme.generalSettings.isMobile ? {
|
|
203
|
+
height: theme.vars.size.mobile.medium.action,
|
|
204
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
205
|
+
} : {
|
|
206
|
+
height: theme.vars.size.desktop.medium.action,
|
|
207
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
208
|
+
},
|
|
209
|
+
[theme.breakpoints.up("md")]: {
|
|
210
|
+
...theme.generalSettings.isMobile ? {
|
|
211
|
+
height: theme.vars.size.mobile.small.action,
|
|
212
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
213
|
+
} : {
|
|
214
|
+
height: theme.vars.size.desktop.small.action,
|
|
215
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
})
|
|
220
|
+
};
|
|
221
|
+
export {
|
|
222
|
+
buttonStyles as b
|
|
223
|
+
};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ButtonClassesType } from './types';
|
|
2
|
-
import { OwnerState } from '../types';
|
|
1
|
+
import { ButtonClassesType, OwnerState } from './types';
|
|
3
2
|
export declare const buttonClasses: ButtonClassesType;
|
|
4
3
|
export declare function getButtonUtilityClass(slot: string): string;
|
|
5
4
|
/**
|
|
6
5
|
* TODO: Documentar
|
|
6
|
+
* @author SebastianM - automatic
|
|
7
|
+
* @createdAt 2024-11-07 07:52:11 - automatic
|
|
8
|
+
* @updatedAt 2024-11-07 07:52:12 - automatic
|
|
9
|
+
* @updatedUser SebastianM - automatic
|
|
7
10
|
*/
|
|
8
11
|
export declare const useUtilityClasses: (onwerState: OwnerState) => {
|
|
9
12
|
skeleton: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { generateUtilityClasses
|
|
2
|
-
import
|
|
1
|
+
import { generateUtilityClasses } from "@mui/material";
|
|
2
|
+
import "@mui/base";
|
|
3
3
|
import { c as componentName } from "./constants.js";
|
|
4
4
|
const buttonClasses = generateUtilityClasses(componentName, [
|
|
5
5
|
/* elements */
|
|
@@ -15,35 +15,11 @@ const buttonClasses = generateUtilityClasses(componentName, [
|
|
|
15
15
|
"colorError",
|
|
16
16
|
"colorSuccess",
|
|
17
17
|
"colorWarning",
|
|
18
|
-
|
|
18
|
+
/* * @author SebastianM - automatic
|
|
19
|
+
*Toggle */
|
|
19
20
|
"togglePressed",
|
|
20
21
|
"toggleNotPressed"
|
|
21
22
|
]);
|
|
22
|
-
function getButtonUtilityClass(slot) {
|
|
23
|
-
return generateUtilityClass(componentName, slot);
|
|
24
|
-
}
|
|
25
|
-
const useUtilityClasses = (onwerState) => {
|
|
26
|
-
const slots = {
|
|
27
|
-
root: [
|
|
28
|
-
"root",
|
|
29
|
-
onwerState.size === "small" && "sizeSmall",
|
|
30
|
-
onwerState.size === "medium" && "sizeMedium",
|
|
31
|
-
onwerState.variant === "outlined" && "variantOutlined",
|
|
32
|
-
onwerState.variant === "contained" && "variantContained",
|
|
33
|
-
onwerState.variant === "text" && "variantText",
|
|
34
|
-
onwerState.isDisabled && "isDisabled",
|
|
35
|
-
onwerState.colorState === "error" && "colorError",
|
|
36
|
-
onwerState.colorState === "success" && "colorSuccess",
|
|
37
|
-
onwerState.colorState === "warning" && "colorWarning"
|
|
38
|
-
],
|
|
39
|
-
skeleton: ["skeleton"]
|
|
40
|
-
};
|
|
41
|
-
const composedClasses = unstable_composeClasses(slots, getButtonUtilityClass, {});
|
|
42
|
-
return {
|
|
43
|
-
...composedClasses
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
23
|
export {
|
|
47
|
-
buttonClasses as b
|
|
48
|
-
useUtilityClasses as u
|
|
24
|
+
buttonClasses as b
|
|
49
25
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ButtonProps as MUIButtonProps } from '@mui/material';
|
|
1
2
|
import { useUtilityClasses } from '.';
|
|
2
3
|
export interface ButtonClassesType {
|
|
3
4
|
root: string;
|
|
@@ -17,3 +18,12 @@ export interface ButtonClassesType {
|
|
|
17
18
|
}
|
|
18
19
|
export type ButtonClassesKey = keyof ButtonClassesType;
|
|
19
20
|
export type Classes = ReturnType<typeof useUtilityClasses>;
|
|
21
|
+
export interface ButtonProps extends Omit<MUIButtonProps, 'size'> {
|
|
22
|
+
size?: 'small' | 'medium';
|
|
23
|
+
skeletonWidth?: number | string;
|
|
24
|
+
skeletonHeight?: number | string;
|
|
25
|
+
colorState?: 'error' | 'success' | 'warning';
|
|
26
|
+
}
|
|
27
|
+
export interface OwnerState extends Pick<ButtonProps, 'size' | 'variant' | 'colorState'> {
|
|
28
|
+
isDisabled?: boolean;
|
|
29
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clave de identificación del componente Button dentro del sistema.
|
|
3
|
+
*
|
|
4
|
+
* Esta constante se utiliza como identificador único para asociar y personalizar estilos y configuraciones
|
|
5
|
+
* relacionadas con el componente `Button` dentro del sistema de temas y estilos.
|
|
6
|
+
* @default 'M4LButton'
|
|
7
|
+
*/
|
|
8
|
+
export declare const BUTTON_KEY_COMPONENT = "M4LButton";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var ButtonSlots = /* @__PURE__ */ ((ButtonSlots2) => {
|
|
2
|
+
ButtonSlots2["buttonRoot"] = "buttonRoot";
|
|
3
|
+
ButtonSlots2["skeletonButton"] = "skeletonButton";
|
|
4
|
+
ButtonSlots2["buttonIcon"] = "buttonIcon";
|
|
5
|
+
ButtonSlots2["textButton"] = "textButton";
|
|
6
|
+
return ButtonSlots2;
|
|
7
|
+
})(ButtonSlots || {});
|
|
8
|
+
export {
|
|
9
|
+
ButtonSlots as B
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const ButtonRootStyled: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').ButtonOwnProps & Omit<import('@mui/material').ButtonBaseOwnProps, "classes"> & import('@mui/material/OverridableComponent').CommonProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLButtonElement | null) => void | import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import('react').DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import('react').RefObject<HTMLButtonElement> | null | undefined;
|
|
3
|
+
}, "children" | "size" | "action" | "color" | "style" | "disabled" | "variant" | "sx" | "classes" | "className" | "tabIndex" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "href" | "endIcon" | "disableElevation" | "fullWidth" | "startIcon">, "children" | "value" | "ref" | "title" | "size" | "name" | "id" | "type" | "action" | "hidden" | "color" | "content" | "style" | "disabled" | "variant" | "translate" | "sx" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "slot" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "form" | "key" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "endIcon" | "disableElevation" | "fullWidth" | "startIcon"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').ButtonOwnerState> & Record<string, unknown> & {
|
|
4
|
+
ownerState: Partial<import('..').ButtonOwnerState> & Record<string, unknown>;
|
|
5
|
+
}, {}, {}>;
|
|
6
|
+
declare const SkeletonButtonStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Skeleton/types').SkeletonProps, keyof import('../../Skeleton/types').SkeletonProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').ButtonOwnerState> & Record<string, unknown> & {
|
|
7
|
+
ownerState: Partial<import('..').ButtonOwnerState> & Record<string, unknown>;
|
|
8
|
+
}, {}, {}>;
|
|
9
|
+
declare const ButtonIconStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').ButtonOwnerState> & Record<string, unknown> & {
|
|
10
|
+
ownerState: Partial<import('..').ButtonOwnerState> & Record<string, unknown>;
|
|
11
|
+
}, {}, {}>;
|
|
12
|
+
declare const TextButtonStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Typography/types').TypographyProps, keyof import('../../Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').ButtonOwnerState> & Record<string, unknown> & {
|
|
13
|
+
ownerState: Partial<import('..').ButtonOwnerState> & Record<string, unknown>;
|
|
14
|
+
}, {}, {}>;
|
|
15
|
+
export { ButtonRootStyled, SkeletonButtonStyled, ButtonIconStyled, TextButtonStyled };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Button } from "@mui/material";
|
|
2
|
+
import { styled } from "@mui/material/styles";
|
|
3
|
+
import { b as buttonStyles } from "../ButtonStyles.js";
|
|
4
|
+
import { B as BUTTON_KEY_COMPONENT } from "../constans.js";
|
|
5
|
+
import { B as ButtonSlots } from "./ButtonEnum.js";
|
|
6
|
+
import { S as Skeleton } from "../../Skeleton/Skeleton.js";
|
|
7
|
+
import { T as Typography } from "../../Typography/Typography.js";
|
|
8
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
9
|
+
const ButtonRootStyled = styled(Button, {
|
|
10
|
+
name: BUTTON_KEY_COMPONENT,
|
|
11
|
+
slot: ButtonSlots.buttonRoot
|
|
12
|
+
})(buttonStyles?.buttonRoot);
|
|
13
|
+
const SkeletonButtonStyled = styled(Skeleton, {
|
|
14
|
+
name: BUTTON_KEY_COMPONENT,
|
|
15
|
+
slot: ButtonSlots.skeletonButton
|
|
16
|
+
})(buttonStyles?.skeletonButton);
|
|
17
|
+
const ButtonIconStyled = styled(Icon, {
|
|
18
|
+
name: BUTTON_KEY_COMPONENT,
|
|
19
|
+
slot: ButtonSlots.buttonIcon
|
|
20
|
+
})(buttonStyles?.buttonIcon);
|
|
21
|
+
const TextButtonStyled = styled(Typography, {
|
|
22
|
+
name: BUTTON_KEY_COMPONENT,
|
|
23
|
+
slot: ButtonSlots.textButton
|
|
24
|
+
})(buttonStyles?.textButton);
|
|
25
|
+
export {
|
|
26
|
+
ButtonRootStyled as B,
|
|
27
|
+
SkeletonButtonStyled as S,
|
|
28
|
+
TextButtonStyled as T,
|
|
29
|
+
ButtonIconStyled as a
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1,10 +1,47 @@
|
|
|
1
|
-
import { ButtonProps as MUIButtonProps } from '@mui/material';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ButtonProps as MUIButtonProps, PaletteColor, Theme } from '@mui/material';
|
|
2
|
+
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
3
|
+
import { BUTTON_KEY_COMPONENT } from './constans';
|
|
4
|
+
import { ButtonSlots } from './slots/ButtonEnum';
|
|
5
|
+
import { ComponentPalletColor, Sizes } from '@m4l/styles';
|
|
6
|
+
import { ReactNode } from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* [ButtonVariants] - Defines the possible variants for the `Button` component.
|
|
9
|
+
*/
|
|
10
|
+
export type ButtonVariants = 'contained' | 'outlined' | 'text';
|
|
11
|
+
/**
|
|
12
|
+
* Props for the `Button` component, extending the original properties of Material UI.
|
|
13
|
+
* [startIcon] - Optional prop for the icon on the left in the `Button`.
|
|
14
|
+
* [endIcon] - Optional prop for the icon on the right in the `Button`.
|
|
15
|
+
* label - Text describing the `Button`.
|
|
16
|
+
* [componentPaletteColor] - Customization of the component's palette color.
|
|
17
|
+
* [disabled] - Indicates if the `Button` is disabled.
|
|
18
|
+
* [size] - Size of the `Button` (default 'medium').
|
|
19
|
+
* [error] - Indicates if the `Button` is in an error state.
|
|
20
|
+
* [variant] - Defines the variant of the `Button` (default 'contained').
|
|
21
|
+
* [color] - Defines the color of the `Button`.
|
|
22
|
+
*/
|
|
23
|
+
export interface ButtonProps extends Omit<MUIButtonProps, 'size' | 'variant' | 'color'> {
|
|
24
|
+
startIcon?: ReactNode;
|
|
25
|
+
endIcon?: ReactNode;
|
|
26
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
label: string;
|
|
29
|
+
variant?: ButtonVariants;
|
|
30
|
+
color?: ComponentPalletColor;
|
|
31
|
+
skeletonWidth?: string | number;
|
|
7
32
|
}
|
|
8
|
-
|
|
9
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Owner state of the `Button` used to define internal style and behavior properties.
|
|
35
|
+
*/
|
|
36
|
+
export interface ButtonOwnerState extends Pick<ButtonProps, 'size' | 'variant' | 'color' | 'disabled'> {
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
paletteColor: PaletteColor;
|
|
10
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Defines the types of Slots available for the `Button`.
|
|
42
|
+
*/
|
|
43
|
+
export type ButtonSlotsType = keyof typeof ButtonSlots;
|
|
44
|
+
/**
|
|
45
|
+
* Styles applicable to the `Button` using themes and custom slots.
|
|
46
|
+
*/
|
|
47
|
+
export type ButtonStyles = Partial<OverridesStyleRules<ButtonSlotsType, typeof BUTTON_KEY_COMPONENT, Theme> | undefined> | undefined;
|