@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.
Files changed (163) hide show
  1. package/@types/types.d.ts +27 -3
  2. package/components/CommonActions/components/ActionCancel/ActionCancel.d.ts +11 -0
  3. package/components/CommonActions/components/ActionCancel/ActionCancel.js +52 -0
  4. package/components/CommonActions/components/ActionCancel/ActionCancel.test.d.ts +1 -0
  5. package/components/CommonActions/components/ActionCancel/ActionCancelStyles.d.ts +2 -0
  6. package/components/CommonActions/components/ActionCancel/ActionCancelStyles.js +6 -0
  7. package/components/CommonActions/components/ActionCancel/constants.d.ts +8 -0
  8. package/components/CommonActions/components/ActionCancel/constants.js +4 -0
  9. package/components/CommonActions/components/ActionCancel/index.d.ts +2 -5
  10. package/components/CommonActions/components/ActionCancel/index.js +1 -12
  11. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelEnum.d.ts +3 -0
  12. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelEnum.js +7 -0
  13. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.d.ts +4 -0
  14. package/components/CommonActions/components/ActionCancel/slots/ActionsCancelSlots.js +12 -0
  15. package/components/CommonActions/components/ActionCancel/slots/index.d.ts +2 -0
  16. package/components/CommonActions/components/ActionCancel/slots/index.js +1 -0
  17. package/components/CommonActions/components/ActionCancel/types.d.ts +33 -0
  18. package/components/CommonActions/components/ActionCancel/types.js +1 -0
  19. package/components/CommonActions/components/ActionFormCancel/index.d.ts +4 -0
  20. package/components/CommonActions/components/ActionFormCancel/index.js +2 -2
  21. package/components/CommonActions/components/ActionIntro/ActionIntro.d.ts +12 -0
  22. package/components/CommonActions/components/ActionIntro/ActionIntro.integration.test.d.ts +1 -0
  23. package/components/CommonActions/components/ActionIntro/ActionIntro.js +51 -0
  24. package/components/CommonActions/components/ActionIntro/ActionIntro.test.d.ts +1 -0
  25. package/components/CommonActions/components/ActionIntro/ActionIntroStyles.d.ts +2 -0
  26. package/components/CommonActions/components/ActionIntro/ActionIntroStyles.js +6 -0
  27. package/components/CommonActions/components/ActionIntro/constants.d.ts +8 -0
  28. package/components/CommonActions/components/ActionIntro/constants.js +4 -0
  29. package/components/CommonActions/components/ActionIntro/index.d.ts +2 -5
  30. package/components/CommonActions/components/ActionIntro/index.js +1 -25
  31. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroEnum.d.ts +3 -0
  32. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroEnum.js +7 -0
  33. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.d.ts +4 -0
  34. package/components/CommonActions/components/ActionIntro/slots/ActionsIntroSlots.js +12 -0
  35. package/components/CommonActions/components/ActionIntro/slots/index.d.ts +2 -0
  36. package/components/CommonActions/components/ActionIntro/slots/index.js +1 -0
  37. package/components/CommonActions/components/ActionIntro/types.d.ts +33 -0
  38. package/components/CommonActions/components/ActionIntro/types.js +1 -0
  39. package/components/CommonActions/components/ActionsContainer/index.d.ts +2 -0
  40. package/components/CommonActions/components/ActionsContainer/slots/ActionsContainerSlots.d.ts +1 -1
  41. package/components/ControlIncrement/slots/ControltrolIncrementSlots.d.ts +1 -1
  42. package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.d.ts +2 -2
  43. package/components/DataGrid/subcomponents/Actions/subcomponents/hooks/useModalSettings/index.js +2 -2
  44. package/components/DragResizeWindow/DragResizeWindow.d.ts +9 -5
  45. package/components/DragResizeWindow/DragResizeWindow.js +6 -5
  46. package/components/DragResizeWindow/DragResizeWindow.styles.d.ts +4 -0
  47. package/components/DragResizeWindow/DragResizeWindow.styles.js +20 -3
  48. package/components/DragResizeWindow/classes/index.js +2 -2
  49. package/components/DragResizeWindow/constants.d.ts +1 -1
  50. package/components/DragResizeWindow/constants.js +2 -2
  51. package/components/DragResizeWindow/helpers/index.d.ts +14 -1
  52. package/components/DragResizeWindow/helpers/index.js +0 -2
  53. package/components/DragResizeWindow/hooks/useDimensionEffects.d.ts +4 -0
  54. package/components/DragResizeWindow/hooks/useDimensionEffects.js +128 -50
  55. package/components/DragResizeWindow/hooks/useDragOptions.d.ts +3 -3
  56. package/components/DragResizeWindow/hooks/useResizeOptions.d.ts +20 -1
  57. package/components/DragResizeWindow/hooks/useResizeOptions.js +1 -1
  58. package/components/DragResizeWindow/slots/DragResizeWindowSlots.js +3 -3
  59. package/components/DragResizeWindow/tests/DragResizeWindow.test.d.ts +1 -0
  60. package/components/DragResizeWindow/types.d.ts +84 -12
  61. package/components/DragResizeWindow/utils.d.ts +12 -1
  62. package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +2 -2
  63. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.d.ts +4 -0
  64. package/components/DynamicFilter/subcomponents/PopoverFilter/PopoverFilter.js +2 -2
  65. package/components/DynamicSort/slots/DynamicSortSlots.d.ts +2 -2
  66. package/components/DynamicSort/subcomponents/PopoverSort/PopoverSort.d.ts +4 -0
  67. package/components/Icon/types.d.ts +1 -1
  68. package/components/Label/slots/LabelSlots.d.ts +1 -1
  69. package/components/LoadingError/LoadingError.d.ts +5 -0
  70. package/components/LoadingError/LoadingError.js +7 -1
  71. package/components/PDFViewer/PDFViewer.d.ts +4 -0
  72. package/components/PDFViewer/PDFViewer.js +1 -1
  73. package/components/ToastContainer/ToastContainer.stories.d.ts +4 -0
  74. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.d.ts +43 -1
  75. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/index.js +4 -5
  76. package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/index.d.ts +4 -0
  77. package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/index.js +6 -8
  78. package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.d.ts +27 -3
  79. package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.js +4 -5
  80. package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.d.ts +4 -0
  81. package/components/commercial/TopBar/component/ConteinItem/subcomponets/NavItem/index.js +7 -6
  82. package/components/extended/React-Resizable/Resizable/Resizable.d.ts +4 -0
  83. package/components/extended/React-Resizable/Resizable/Resizable.js +13 -1
  84. package/components/extended/React-Resizable/Resizable/constants.d.ts +1 -0
  85. package/components/extended/React-Resizable/Resizable/constants.js +3 -1
  86. package/components/extended/React-Resizable/ResizableBox/ResizableBox.d.ts +6 -2
  87. package/components/extended/React-Resizable/ResizableBox/ResizableBox.js +14 -2
  88. package/components/extended/React-Resizable/ResizableBox/ResizeableBox.styles.d.ts +1 -1
  89. package/components/extended/React-Resizable/ResizableBox/ResizeableBox.styles.js +7 -3
  90. package/components/extended/React-Resizable/ResizableBox/tests/ResizableBox.integration.test.d.ts +1 -0
  91. package/components/extended/React-Resizable/ResizableBox/tests/ResizableBox.test.d.ts +1 -0
  92. package/components/extended/React-Resizable/ResizableBox/types.d.ts +35 -4
  93. package/components/extended/React-Resizable/helpers.d.ts +151 -34
  94. package/components/extended/React-Resizable/helpers.js +106 -85
  95. package/components/extended/React-Resizable/hooks/useResizable.d.ts +16 -0
  96. package/components/extended/React-Resizable/hooks/useResizable.js +24 -0
  97. package/components/hook-form/RHFColorPicker/RFHColorPicker.d.ts +4 -0
  98. package/components/hook-form/RHFColorPicker/RFHColorPicker.js +1 -1
  99. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
  100. package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/index.d.ts +2 -2
  101. package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/index.js +1 -1
  102. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MyActions/index.d.ts +2 -2
  103. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MyActions/index.js +7 -1
  104. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.d.ts +2 -2
  105. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.js +1 -1
  106. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/index.d.ts +2 -2
  107. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/index.js +1 -1
  108. package/components/modal/ModalDialog/index.d.ts +4 -0
  109. package/components/modal/ModalDialog/index.js +2 -2
  110. package/components/modal/WindowConfirm/index.d.ts +3 -3
  111. package/components/modal/WindowConfirm/index.js +2 -2
  112. package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
  113. package/components/mui_extended/Button/Button.d.ts +8 -6
  114. package/components/mui_extended/Button/Button.integration.test.d.ts +1 -0
  115. package/components/mui_extended/Button/Button.js +70 -34
  116. package/components/mui_extended/Button/Button.test.d.ts +1 -0
  117. package/components/mui_extended/Button/ButtonStyles.d.ts +2 -0
  118. package/components/mui_extended/Button/ButtonStyles.js +223 -0
  119. package/components/mui_extended/Button/classes/index.d.ts +5 -2
  120. package/components/mui_extended/Button/classes/index.js +5 -29
  121. package/components/mui_extended/Button/classes/types.d.ts +10 -0
  122. package/components/mui_extended/Button/constans.d.ts +8 -0
  123. package/components/mui_extended/Button/constans.js +4 -0
  124. package/components/mui_extended/Button/slots/ButtonEnum.d.ts +6 -0
  125. package/components/mui_extended/Button/slots/ButtonEnum.js +10 -0
  126. package/components/mui_extended/Button/slots/ButtonSlots.d.ts +15 -0
  127. package/components/mui_extended/Button/slots/ButtonSlots.js +30 -0
  128. package/components/mui_extended/Button/slots/index.d.ts +3 -0
  129. package/components/mui_extended/Button/slots/index.js +1 -0
  130. package/components/mui_extended/Button/types.d.ts +45 -8
  131. package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +2 -2
  132. package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
  133. package/components/mui_extended/Select/slots/SelectSlots.d.ts +1 -1
  134. package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
  135. package/components/mui_extended/Tab/Slots/TabSlots.d.ts +1 -1
  136. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +2 -2
  137. package/components/mui_extended/ToggleButton/ToggleButton.js +1 -1
  138. package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
  139. package/components/mui_extended/Typography/types.d.ts +5 -1
  140. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +63 -2
  141. package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.d.ts +1 -1
  142. package/contexts/ModalContext/index.d.ts +4 -0
  143. package/contexts/ModalContext/types.d.ts +1 -1
  144. package/index.js +2 -2
  145. package/package.json +1 -1
  146. package/storybook/components/DragResizeWindow/stories/DragResizeWindow.stories.d.ts +7 -0
  147. package/storybook/components/DragResizeWindow/stories/subcomponents/ContentExample.d.ts +8 -0
  148. package/{components → storybook/components}/DragResizeWindow/stories/subcomponents/WithExtendedContainer.d.ts +4 -0
  149. package/{components → storybook/components}/DragResizeWindow/stories/types.d.ts +1 -1
  150. package/storybook/components/commonActions/components/ActionCancel/ActionCancel.stories.d.ts +22 -0
  151. package/storybook/components/commonActions/components/ActionIntro/ActionIntro.stories.d.ts +22 -0
  152. package/storybook/components/extended/mui/Button/Button.stories.d.ts +26 -0
  153. package/storybook/components/extended/react-resizable/ResizableBox/resizableBox.stories.d.ts +13 -0
  154. package/components/CommonActions/components/ActionIntro/test/contants.js +0 -4
  155. package/components/DragResizeWindow/stories/basic.stories.d.ts +0 -13
  156. package/components/DragResizeWindow/stories/dictionary.d.ts +0 -0
  157. package/components/DragResizeWindow/stories/subcomponents/ContentExample.d.ts +0 -4
  158. package/components/extended/React-Resizable/Resizable/stories/basic.stories.d.ts +0 -9
  159. package/components/extended/React-Resizable/ResizableBox/stories/basic.stories.d.ts +0 -9
  160. package/components/mui_extended/Button/styles.d.ts +0 -4
  161. package/components/mui_extended/Button/styles.js +0 -12
  162. /package/components/{mui_extended/Button/index.test.d.ts → CommonActions/components/ActionCancel/ActionCancel.integration.test.d.ts} +0 -0
  163. /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 { Skeleton } from "@mui/material";
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
- const Button = (props) => {
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
- className,
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
- isDisabled: disabled,
25
- colorState
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 classes = useUtilityClasses(ownerState);
28
- return (
29
- /* ButtonRoot: Contenedor principal del componente, es usado para aplicar los estilos css de los overrides que
30
- provienen del objeto del tema. Se usa para garantizar de que estos estilos no se propaguen a
31
- otros componentes de la plataforna web. */
32
- /* @__PURE__ */ jsx(ButtonRoot, { className: clsx(classes.root, className), "data-testid": "ButtonRoot", children: !isSkeleton ? (
33
- /* MuiButton: Componente botón proporcionado por la librería externa material ui. */
34
- /* @__PURE__ */ jsx(MuiButton, { ...others, variant, size, disableRipple: true, disabled })
35
- ) : (
36
- /* MuiSkeleton: Componente extendido de mui que se usa para mostrar la versión provisional de elementos en
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
- className: classes.skeleton,
42
- "data-testid": "MuiSkeleton",
43
- variant: "rectangular",
44
- width: skeletonWidth
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,2 @@
1
+ import { ButtonStyles } from './types';
2
+ export declare const buttonStyles: ButtonStyles;
@@ -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, generateUtilityClass } from "@mui/material";
2
- import { unstable_composeClasses } from "@mui/base";
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
- /**Toggle */
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,4 @@
1
+ const BUTTON_KEY_COMPONENT = "M4LButton";
2
+ export {
3
+ BUTTON_KEY_COMPONENT as B
4
+ };
@@ -0,0 +1,6 @@
1
+ export declare enum ButtonSlots {
2
+ buttonRoot = "buttonRoot",
3
+ skeletonButton = "skeletonButton",
4
+ buttonIcon = "buttonIcon",
5
+ textButton = "textButton"
6
+ }
@@ -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,3 @@
1
+ export * from './ButtonSlots';
2
+ export * from './ButtonEnum';
3
+ export { ButtonSlots } from './ButtonEnum';
@@ -1,10 +1,47 @@
1
- import { ButtonProps as MUIButtonProps } from '@mui/material';
2
- export interface ButtonProps extends Omit<MUIButtonProps, 'size'> {
3
- size?: 'small' | 'medium';
4
- skeletonWidth?: number | string;
5
- skeletonHeight?: number | string;
6
- colorState?: 'error' | 'success' | 'warning';
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
- export interface OwnerState extends Pick<ButtonProps, 'size' | 'variant' | 'colorState'> {
9
- isDisabled?: boolean;
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;