@m4l/components 9.1.41 → 9.1.43

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 (38) hide show
  1. package/.storybook/constants.d.ts +11 -0
  2. package/.storybook/decorators/WithDictionaryContext/contants.d.ts +3 -0
  3. package/.storybook/decorators/WithDictionaryContext/index.d.ts +1 -0
  4. package/components/BaseModule/BaseModule.js +3 -1
  5. package/components/BaseModule/types.d.ts +2 -0
  6. package/components/CommonActions/components/ActionFormIntro/index.js +1 -1
  7. package/components/MFIsolationApp/MFIsolationApp.js +7 -4
  8. package/components/MFIsolationApp/types.d.ts +10 -0
  9. package/components/MenuActions/MenuActions.js +17 -14
  10. package/components/MenuActions/types.d.ts +1 -1
  11. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.js +1 -1
  12. package/components/mui_extended/Button/Button.js +6 -3
  13. package/components/mui_extended/Button/ButtonStyles.js +11 -11
  14. package/components/mui_extended/CircularProgress/CircularProgress.test.d.ts +1 -0
  15. package/components/mui_extended/LoadingButton/LoadingButton.d.ts +1 -1
  16. package/components/mui_extended/LoadingButton/LoadingButton.js +17 -55
  17. package/components/mui_extended/LoadingButton/LoadingButton.styles.js +10 -155
  18. package/components/mui_extended/LoadingButton/constants.d.ts +5 -0
  19. package/components/mui_extended/LoadingButton/slots/LoadingButtonEnum.d.ts +1 -3
  20. package/components/mui_extended/LoadingButton/slots/LoadingButtonEnum.js +1 -3
  21. package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.d.ts +4 -20
  22. package/components/mui_extended/LoadingButton/slots/LoadingButtonSlots.js +6 -18
  23. package/components/mui_extended/LoadingButton/types.d.ts +3 -5
  24. package/components/mui_extended/MenuItem/MenuItem.js +28 -29
  25. package/components/mui_extended/MenuItem/MenuItem.styles.js +0 -12
  26. package/components/mui_extended/Popover/Popover.d.ts +1 -1
  27. package/components/mui_extended/Popover/Popover.js +7 -0
  28. package/components/mui_extended/Select/Select.d.ts +7 -5
  29. package/components/mui_extended/Select/Select.test.d.ts +1 -0
  30. package/components/mui_extended/Select/dictionary.d.ts +3 -0
  31. package/components/mui_extended/Select/slots/SelectEnum.d.ts +7 -2
  32. package/components/mui_extended/Select/slots/SelectSlots.d.ts +16 -4
  33. package/components/mui_extended/Select/slots/index.d.ts +2 -2
  34. package/components/mui_extended/Select/types.d.ts +16 -14
  35. package/package.json +3 -3
  36. package/test/TestAppWrapper.d.ts +2 -0
  37. package/components/mui_extended/Select/stories/SelectOutlied.stories.d.ts +0 -75
  38. package/components/mui_extended/Select/stories/SelectStandar.stories.d.ts +0 -29
@@ -8,6 +8,15 @@ export declare const MODES_ITEMS: {
8
8
  value: string;
9
9
  title: string;
10
10
  }[];
11
+ export declare const DEVICE_TYPES: {
12
+ automatic: string;
13
+ mobile: string;
14
+ desktop: string;
15
+ };
16
+ export declare const DEVICE_TYPES_ITEMS: {
17
+ value: string;
18
+ title: string;
19
+ }[];
11
20
  export declare const COLORS_THEME: Record<ThemeUserColor, ThemeUserColor>;
12
21
  export declare const COLORS_THEME_ITEMS: Record<string, string>[];
13
22
  export declare const USER = "carloszapata@gmail.com";
@@ -17,3 +26,5 @@ export declare const ENVIRONMENT_ASSETS = "d1";
17
26
  export declare const HOST_API_LOCAL = "http://localhost:3000/domain";
18
27
  export declare const HOST_API_REMOTE = "https://lab1.stage.made4labs.com/api/v1/domain";
19
28
  export declare const HOST_STATIC_ASSETS = "https://s3.amazonaws.com/static.made4labs/environments";
29
+ export declare const DOMAIN_TOKEN = "lab1";
30
+ export declare const STORYBOOK_MODULE_ID = "login";
@@ -0,0 +1,3 @@
1
+ import { EnvironmentType, HostToolsType } from '@m4l/core';
2
+ export declare const environmentDictionaryContext: EnvironmentType;
3
+ export declare const hostToolsDictionaryContext: HostToolsType;
@@ -0,0 +1 @@
1
+ export * from './WithDictionaryContext';
@@ -10,7 +10,8 @@ function BaseModule(props) {
10
10
  moduleNameField,
11
11
  skeletonFlags,
12
12
  privileges,
13
- componentsDictionary
13
+ componentsDictionary,
14
+ moduleDictionaryLoaded
14
15
  } = props;
15
16
  const localeString = useLocales().currentLocale?.localeString;
16
17
  return /* @__PURE__ */ jsx(FlagsProvider, { children: /* @__PURE__ */ jsx(
@@ -21,6 +22,7 @@ function BaseModule(props) {
21
22
  moduleNameField,
22
23
  componentsDictionary,
23
24
  currentLang: localeString,
25
+ moduleDictionaryLoaded,
24
26
  children: /* @__PURE__ */ jsx(ModuleSkeletonProvider, { flags: skeletonFlags, children: isAuth ? /* @__PURE__ */ jsx(ModulePrivilegesProvider, { queryPrivileges: privileges, children: /* @__PURE__ */ jsx(ModalProvider, { children }) }) : /* @__PURE__ */ jsx(ModalProvider, { children }) })
25
27
  }
26
28
  ) });
@@ -1,3 +1,4 @@
1
+ import { ModuleDictionary } from '@m4l/core';
1
2
  import { ReactNode } from 'react';
2
3
  export type BaseModuleProps = {
3
4
  moduleId: string;
@@ -7,4 +8,5 @@ export type BaseModuleProps = {
7
8
  componentsDictionary: string[];
8
9
  isAuth?: boolean;
9
10
  children: ReactNode;
11
+ moduleDictionaryLoaded?: ModuleDictionary;
10
12
  };
@@ -25,7 +25,7 @@ function ActionFormIntro(props) {
25
25
  loading: isSubmitting,
26
26
  className: classes.actionFormIntro,
27
27
  ...props,
28
- children: getLabel("common_actions.intro")
28
+ label: getLabel("common_actions.intro")
29
29
  }
30
30
  );
31
31
  }
@@ -4,7 +4,7 @@ import { unstable_HistoryRouter } from "react-router-dom";
4
4
  import { createBrowserHistory } from "history";
5
5
  import EventEmitter from "eventemitter3";
6
6
  import NProgress from "nprogress";
7
- import { LocalesProvider, getLocaleFromNetwork, ResponsiveContainerProvider } from "@m4l/graphics";
7
+ import { LocalesProvider, getLocaleFromNetwork, DeviceTypeProvider, ResponsiveContainerProvider } from "@m4l/graphics";
8
8
  import { EnvironmentProvider, HostToolsProvider, NetworkProvider, axiosOperation, AuthProvider } from "@m4l/core";
9
9
  import { T as TOAST_CONTAINER_ID } from "./constants.js";
10
10
  import { A as AppearanceComponentProvider } from "../../contexts/AppearanceComponentContext/AppearanceComponentContext.js";
@@ -35,7 +35,9 @@ function MFIsolationApp(props) {
35
35
  onLoad,
36
36
  activeAreasNetwork = false,
37
37
  activeCookiesFromNetwork = false,
38
- observedDivRef
38
+ observedDivRef,
39
+ moduleDictionaryLoaded,
40
+ forcedDeviceType
39
41
  } = props;
40
42
  const eventEmitter = useMemo(() => new EventEmitter(), []);
41
43
  const events_add_listener = useCallback(
@@ -98,7 +100,7 @@ function MFIsolationApp(props) {
98
100
  // eslint-disable-next-line react-hooks/exhaustive-deps
99
101
  []
100
102
  );
101
- return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history, children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: false, getLocaleFromNetwork, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(MFAuthApp, { user, pwd, children: /* @__PURE__ */ jsxs(
103
+ return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history, children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: false, getLocaleFromNetwork, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { forcedDeviceType, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(MFAuthApp, { user, pwd, children: /* @__PURE__ */ jsxs(
102
104
  BaseModule,
103
105
  {
104
106
  moduleId,
@@ -106,6 +108,7 @@ function MFIsolationApp(props) {
106
108
  skeletonFlags,
107
109
  componentsDictionary,
108
110
  moduleNameField,
111
+ moduleDictionaryLoaded,
109
112
  children: [
110
113
  /* @__PURE__ */ jsx(ToastContainer, { containerId: TOAST_CONTAINER_ID }),
111
114
  " ",
@@ -123,7 +126,7 @@ function MFIsolationApp(props) {
123
126
  )
124
127
  ]
125
128
  }
126
- ) }) }) }) }) }) }) });
129
+ ) }) }) }) }) }) }) }) });
127
130
  }
128
131
  export {
129
132
  MFIsolationApp as M
@@ -1,4 +1,6 @@
1
+ import { ModuleDictionary } from '@m4l/core';
1
2
  import { BaseModuleProps } from '../BaseModule';
3
+ import { DeviceType } from '@m4l/graphics';
2
4
  export type MFIsolationAppProps = BaseModuleProps & {
3
5
  user: string;
4
6
  pwd: string;
@@ -12,4 +14,12 @@ export type MFIsolationAppProps = BaseModuleProps & {
12
14
  activeAreasNetwork?: boolean;
13
15
  activeCookiesFromNetwork?: boolean;
14
16
  observedDivRef: Element | Text | null;
17
+ /**
18
+ * Diccionario de componentes, se puede proporcionar ya el diccionario cargado, para evitar que se llame al endpoint nuevamente.
19
+ */
20
+ moduleDictionaryLoaded?: ModuleDictionary;
21
+ /**
22
+ * Tipo de dispositivo forzado, si no se proporciona se determina automáticamente. Normalmente se usa esta propieadad para pruebas en storybook.
23
+ */
24
+ forcedDeviceType?: DeviceType;
15
25
  };
@@ -73,6 +73,7 @@ function MenuActions(props) {
73
73
  }
74
74
  return ret;
75
75
  }, [menuActions, objItem]);
76
+ const open = Boolean(externalOpen ?? anchorEl);
76
77
  return /* @__PURE__ */ jsxs(RootStyled, { ownerState: { ownerState }, children: [
77
78
  /* @__PURE__ */ jsx(
78
79
  IconButton,
@@ -83,17 +84,17 @@ function MenuActions(props) {
83
84
  onClick: handleButtonClick,
84
85
  tooltip: toolTip,
85
86
  className: iconButtonClassName,
86
- selected: Boolean(externalOpen ?? anchorEl),
87
+ selected: open,
87
88
  disabled,
88
89
  componentPaletteColor: "default",
89
90
  badgeContent
90
91
  }
91
92
  ),
92
- /* @__PURE__ */ jsxs(
93
+ open && /* @__PURE__ */ jsxs(
93
94
  Popover,
94
95
  {
95
96
  id: "Popover",
96
- open: Boolean(externalOpen ?? anchorEl),
97
+ open,
97
98
  anchorEl: externalOpen ?? anchorEl,
98
99
  onClose: () => handleOpenClose(),
99
100
  arrowType,
@@ -102,17 +103,19 @@ function MenuActions(props) {
102
103
  },
103
104
  ...other,
104
105
  children: [
105
- finalActions.length > 0 ? /* @__PURE__ */ jsx(MenuListStyled, { ownerState: { ownerState }, children: finalActions.map((menuAction, index) => /* @__PURE__ */ createElement(
106
- MenuItem,
107
- {
108
- size,
109
- ...menuAction,
110
- onClick: (e) => {
111
- handleClick(e, menuAction);
112
- },
113
- key: `${MENU_ACTIONS_}${index}`
114
- }
115
- )) }) : /* @__PURE__ */ jsx(
106
+ finalActions.length > 0 ? /* @__PURE__ */ jsx(MenuListStyled, { ownerState: { ownerState }, children: finalActions.map((menuAction, index) => {
107
+ return /* @__PURE__ */ createElement(
108
+ MenuItem,
109
+ {
110
+ size,
111
+ ...menuAction,
112
+ onClick: (e) => {
113
+ handleClick(e, menuAction);
114
+ },
115
+ key: `${MENU_ACTIONS_}${menuAction.label ?? index}`
116
+ }
117
+ );
118
+ }) }) : /* @__PURE__ */ jsx(
116
119
  MenuItem,
117
120
  {
118
121
  size,
@@ -37,7 +37,7 @@ export interface MenuAction extends Pick<MenuItemProps, 'startIcon' | 'endIcon'
37
37
  * Propiedades del componente `MenuActions`.
38
38
  * @createdAt 2024-12-27 08:27:30 - automatic
39
39
  */
40
- export interface MenuActionsProps extends Omit<PopoverProps, 'open'> {
40
+ export interface MenuActionsProps extends Omit<PopoverProps, 'open' | 'anchorEl'> {
41
41
  /**
42
42
  * Tamaño opcional del menú (pequeño o mediano).
43
43
  * @createdAt 2024-12-27 08:27:30 - automatic
@@ -53,7 +53,7 @@ function MyActions(props) {
53
53
  return /* @__PURE__ */ jsxs(ActionsContainer, { children: [
54
54
  /* @__PURE__ */ jsx(RHFHelperError, { name: "geometry" }),
55
55
  /* @__PURE__ */ jsx(Button, { onClick: onClickCancelLocal, disabled: inEdition, label: getLabel(MAP_GPSTOOLS_DICCTIONARY.ACTION_CANCEL) }),
56
- /* @__PURE__ */ jsx(ActionFormIntro, { disabled: inEdition })
56
+ /* @__PURE__ */ jsx(ActionFormIntro, { label: "", disabled: inEdition })
57
57
  ] });
58
58
  }
59
59
  export {
@@ -1,4 +1,4 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
3
3
  import { useTheme } from "@mui/material";
4
4
  import clsx from "clsx";
@@ -62,7 +62,7 @@ const Button = forwardRef((props, ref) => {
62
62
  );
63
63
  }
64
64
  };
65
- return /* @__PURE__ */ jsx(
65
+ return /* @__PURE__ */ jsxs(
66
66
  ButtonRootStyled,
67
67
  {
68
68
  "aria-disabled": disabled,
@@ -77,7 +77,10 @@ const Button = forwardRef((props, ref) => {
77
77
  ownerState: { ...ownerState },
78
78
  ref,
79
79
  ...others,
80
- children: /* @__PURE__ */ jsx(TextButtonStyled, { ownerState: { ...ownerState }, color: adjustedColor, children: label })
80
+ children: [
81
+ /* @__PURE__ */ jsx(TextButtonStyled, { ownerState: { ...ownerState }, color: adjustedColor, children: label }),
82
+ props.children
83
+ ]
81
84
  }
82
85
  );
83
86
  });
@@ -3,7 +3,7 @@ const buttonStyles = {
3
3
  * Styles for the root element of the button component.
4
4
  * @author SebastianM - automatic
5
5
  * @createdAt 2024-11-06 07:42:00 - automatic
6
- * @updatedAt 2024-11-12 12:29:51 - automatic
6
+ * @updatedAt 2024-12-18 17:33:44 - automatic
7
7
  * @updatedUser SebastianM - automatic
8
8
  */
9
9
  buttonRoot: ({ theme, ownerState }) => ({
@@ -38,7 +38,7 @@ const buttonStyles = {
38
38
  borderColor: ownerState.paletteColor?.main,
39
39
  backgroundColor: "transparent",
40
40
  ...ownerState.color === "default" && {
41
- '& [class*="M4LIcon-icon"]': {
41
+ "& .M4LIconClass": {
42
42
  backgroundColor: theme.vars.palette.text.primary
43
43
  }
44
44
  },
@@ -47,7 +47,7 @@ const buttonStyles = {
47
47
  },
48
48
  ...ownerState.color === "warning" && {
49
49
  color: ownerState.paletteColor?.active,
50
- '& [class*="M4LIcon-icon"]': {
50
+ "& .M4LIconClass": {
51
51
  backgroundColor: ownerState.paletteColor?.active
52
52
  }
53
53
  },
@@ -56,11 +56,11 @@ const buttonStyles = {
56
56
  backgroundColor: ownerState.paletteColor?.hoverOpacity
57
57
  },
58
58
  "&:active": {
59
- '& [class*="M4LIcon-icon"]': {
59
+ "& .M4LIconClass": {
60
60
  backgroundColor: ownerState.paletteColor?.active
61
61
  },
62
62
  ...ownerState.color === "default" && {
63
- '& [class*="M4LIcon-icon"]': {
63
+ "& .M4LIconClass": {
64
64
  backgroundColor: theme.vars.palette.text.primary
65
65
  }
66
66
  },
@@ -81,13 +81,13 @@ const buttonStyles = {
81
81
  borderColor: ownerState.paletteColor?.main,
82
82
  backgroundColor: "transparent",
83
83
  ...ownerState.color === "default" && {
84
- '& [class*="M4LIcon-icon"]': {
84
+ "& .M4LIconClass": {
85
85
  backgroundColor: theme.vars.palette.text.primary
86
86
  }
87
87
  },
88
88
  ...ownerState.color === "warning" && {
89
89
  color: ownerState.paletteColor?.active,
90
- '& [class*="M4LIcon-icon"]': {
90
+ "& .M4LIconClass": {
91
91
  backgroundColor: ownerState.paletteColor?.active
92
92
  }
93
93
  },
@@ -96,11 +96,11 @@ const buttonStyles = {
96
96
  backgroundColor: ownerState.paletteColor?.hoverOpacity
97
97
  },
98
98
  "&:active": {
99
- '& [class*="M4LIcon-icon"]': {
99
+ "& .M4LIconClass": {
100
100
  backgroundColor: ownerState.paletteColor?.active
101
101
  },
102
102
  ...ownerState.color === "default" && {
103
- '& [class*="M4LIcon-icon"]': {
103
+ "& .M4LIconClass": {
104
104
  backgroundColor: theme.vars.palette.text.primary
105
105
  }
106
106
  },
@@ -145,7 +145,7 @@ const buttonStyles = {
145
145
  * Styles for the text of the button component.
146
146
  * @author SebastianM - automatic
147
147
  * @createdAt 2024-11-07 18:00:35 - automatic
148
- * @updatedAt 2024-11-12 12:29:51 - automatic
148
+ * @updatedAt 2024-12-18 17:33:44 - automatic
149
149
  * @updatedUser SebastianM - automatic
150
150
  */
151
151
  textButton: ({ theme, ownerState }) => ({
@@ -173,7 +173,7 @@ const buttonStyles = {
173
173
  * Styles for the skeleton button component.
174
174
  * @author SebastianM - automatic
175
175
  * @createdAt 2024-11-06 10:12:30 - automatic
176
- * @updatedAt 2024-11-12 12:29:51 - automatic
176
+ * @updatedAt 2024-12-18 17:33:44 - automatic
177
177
  * @updatedUser SebastianM - automatic
178
178
  */
179
179
  skeletonButton: ({ theme, ownerState }) => ({
@@ -2,4 +2,4 @@ import { LoadingButtonProps } from './types';
2
2
  /**
3
3
  * Componente LoadingButton que extiende las props de Button
4
4
  */
5
- export declare const LoadingButton: import('react').ForwardRefExoticComponent<Omit<LoadingButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
5
+ export declare const LoadingButton: (props: LoadingButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,17 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx } from "react/jsx-runtime";
2
2
  import clsx from "clsx";
3
- import { forwardRef } from "react";
4
- import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
5
- import { useTheme } from "@mui/material";
6
- import { S as SkeletonLoadingButtonStyled, L as LoadingButtonRootStyled, T as TextLoadingButtonStyled, C as CircularProgressStyled, a as LoadingButtonIconStyled } from "./slots/LoadingButtonSlots.js";
3
+ import { useModuleSkeleton } from "@m4l/core";
4
+ import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
5
+ import { S as SkeletonLoadingButtonStyled, R as RootStyled, C as CircularProgressStyled } from "./slots/LoadingButtonSlots.js";
6
+ import { L as LOADING_BUTTON_KEY_COMPONENT } from "./constants.js";
7
7
  import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
8
- const LoadingButton = forwardRef((props, ref) => {
8
+ const LoadingButton = (props) => {
9
9
  const {
10
10
  className,
11
11
  endIcon,
12
12
  label,
13
13
  startIcon,
14
- color = "default",
14
+ color = "primary",
15
15
  disabled = false,
16
16
  size = "small",
17
17
  variant = "contained",
@@ -21,73 +21,35 @@ const LoadingButton = forwardRef((props, ref) => {
21
21
  } = props;
22
22
  const { currentSize } = useComponentSize(size);
23
23
  const isSkeleton = useModuleSkeleton();
24
- const theme = useTheme();
25
24
  const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
26
- const paletteColor = getPropertyByString(
27
- theme.vars.palette,
28
- disabled ? "default" : color || "default",
29
- theme.vars.palette.default
30
- );
31
25
  const ownerState = {
32
26
  size,
33
27
  variant,
34
28
  disabled,
35
- paletteColor,
36
29
  color,
37
30
  loading
38
31
  };
39
32
  if (isSkeleton) {
40
33
  return /* @__PURE__ */ jsx(SkeletonLoadingButtonStyled, { "data-testid": "SkeletonButton", width: skeletonWidth, ownerState: { ...ownerState } });
41
34
  }
42
- const getAdjustedColor = (btnColor, btnVariant) => {
43
- return btnVariant === "contained" ? `${btnColor}.contrastText` : `${btnColor}.main`;
44
- };
45
- const adjustedColor = getAdjustedColor(color, variant);
46
- const renderIcon = (icon, instaceDataTestId) => {
47
- if (!icon) {
48
- return null;
49
- }
50
- if (typeof icon !== "string") {
51
- return icon;
52
- } else {
53
- return /* @__PURE__ */ jsx(
54
- LoadingButtonIconStyled,
55
- {
56
- color: adjustedColor,
57
- ownerState: { ...ownerState },
58
- src: icon,
59
- alt: "icon",
60
- size: adjustedSize,
61
- disabled: loading || disabled,
62
- instaceDataTestId,
63
- className: clsx(className)
64
- }
65
- );
66
- }
67
- };
68
- return /* @__PURE__ */ jsxs(
69
- LoadingButtonRootStyled,
35
+ const classRoot = getComponentSlotRoot(LOADING_BUTTON_KEY_COMPONENT);
36
+ return /* @__PURE__ */ jsx(
37
+ RootStyled,
70
38
  {
71
- "aria-disabled": disabled,
72
- role: "button",
73
- startIcon: renderIcon(startIcon, "LoadingButtonStartIcon"),
74
- endIcon: renderIcon(endIcon, "LoadingButtonEndIcon"),
75
- className: clsx(className),
39
+ color,
76
40
  variant,
77
41
  size,
42
+ label,
78
43
  disabled: loading || disabled,
79
- disableRipple: true,
80
44
  ownerState: { ...ownerState },
81
- ref,
45
+ className: clsx(className, classRoot),
46
+ startIcon,
47
+ endIcon,
82
48
  ...others,
83
- children: [
84
- /* @__PURE__ */ jsx(TextLoadingButtonStyled, { ownerState: { ...ownerState }, color: adjustedColor, children: label }),
85
- loading === true && /* @__PURE__ */ jsx(CircularProgressStyled, { ownerState: { ...ownerState }, size: adjustedSize })
86
- ]
49
+ children: loading === true && /* @__PURE__ */ jsx(CircularProgressStyled, { color: "primary", ownerState: { ...ownerState }, size: adjustedSize })
87
50
  }
88
51
  );
89
- });
90
- LoadingButton.displayName = "LoadingButton";
52
+ };
91
53
  export {
92
54
  LoadingButton as L
93
55
  };
@@ -1,161 +1,16 @@
1
1
  const loadingButtonStyles = {
2
2
  /**
3
- * Estilos para el elemento raíz del componente LoadingButton.
4
- * Incluye el diseño, los espaciados y los estados para los diferentes variantes de botón: 'text', 'outlined', y 'contained'.
5
- * Maneja los estados de enfoque, hover, activo y deshabilitado, incluyendo colores específicos y comportamientos de fondo.
3
+ * Estilos para el componente Button de M4L.
4
+ * Componente boton con variantes y paletas de colores.
6
5
  */
7
- loadingButtonRoot: ({ theme, ownerState }) => ({
8
- display: "flex",
9
- alignItems: "center",
10
- gap: theme.vars.size.baseSpacings.sp1,
11
- padding: `0px ${theme.vars.size.baseSpacings.sp2}`,
12
- boxShadow: "none",
13
- borderRadius: theme.vars.size.borderRadius.r1,
14
- // Estilos para la variante 'text'
15
- ...ownerState.variant === "text" && {
16
- color: ownerState.paletteColor?.semanticText,
17
- '& [class*="M4LIcon-icon"]': {
18
- backgroundColor: ownerState.paletteColor?.semanticText
6
+ root: ({ ownerState }) => ({
7
+ ...ownerState.loading && {
8
+ "&>.MuiTypography-root": {
9
+ visibility: "hidden"
19
10
  },
20
- "&:disabled": {
21
- color: theme.vars.palette.text.disabled
22
- },
23
- backgroundColor: "transparent",
24
- ...ownerState.color === "default" && {
25
- color: theme.vars.palette.text.primary,
26
- '& [class*="M4LIcon-icon"]': {
27
- backgroundColor: theme.vars.palette.text.primary
28
- }
29
- },
30
- ...ownerState.color === "primary" && {
31
- color: ownerState.paletteColor?.enabled,
32
- '& [class*="M4LIcon-icon"]': {
33
- backgroundColor: ownerState.paletteColor?.enabled
34
- }
35
- },
36
- "&:hover": {
37
- backgroundColor: ownerState.paletteColor?.hoverOpacity
38
- },
39
- "&:active": {
40
- backgroundColor: ownerState.paletteColor?.activeOpacity
41
- },
42
- "&:focus-visible": {
43
- boxShadow: "none",
44
- outline: theme.vars.size.borderStroke.container,
45
- outlineColor: ownerState.paletteColor?.focusVisible,
46
- outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
47
- backgroundColor: ownerState.paletteColor?.activeOpacity
48
- }
49
- },
50
- // Estilos para la variante 'outlined'
51
- ...ownerState.variant === "outlined" && {
52
- borderColor: ownerState.paletteColor?.enabled,
53
- color: ownerState.paletteColor?.semanticText,
54
- '& [class*="M4LIcon-icon"]': {
55
- backgroundColor: ownerState.paletteColor?.semanticText
56
- },
57
- backgroundColor: "transparent",
58
- ...ownerState.color === "default" && {
59
- color: theme.vars.palette.text.primary,
60
- borderColor: ownerState.paletteColor?.enabled,
61
- '& [class*="M4LIcon-icon"]': {
62
- backgroundColor: theme.vars.palette.text.primary
63
- }
64
- },
65
- ...ownerState.color === "primary" && {
66
- color: ownerState.paletteColor?.enabled,
67
- '& [class*="M4LIcon-icon"]': {
68
- backgroundColor: ownerState.paletteColor?.enabled
69
- }
70
- },
71
- "&:hover": {
72
- borderColor: ownerState.paletteColor?.hover,
73
- backgroundColor: ownerState.paletteColor?.hoverOpacity
74
- },
75
- "&:active": {
76
- backgroundColor: ownerState.paletteColor?.activeOpacity,
77
- borderColor: ownerState.paletteColor?.active
78
- },
79
- "&:focus-visible": {
80
- boxShadow: "none",
81
- outline: theme.vars.size.borderStroke.container,
82
- outlineColor: ownerState.paletteColor?.focusVisible,
83
- outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
84
- backgroundColor: ownerState.paletteColor?.activeOpacity,
85
- borderColor: ownerState.paletteColor?.active
11
+ "&>.MuiButton-icon": {
12
+ visibility: "hidden"
86
13
  }
87
- },
88
- // Estilos para la variante 'contained'
89
- ...ownerState.variant === "contained" && {
90
- backgroundColor: ownerState.paletteColor?.enabled,
91
- color: ownerState.paletteColor?.contrastText,
92
- ...ownerState.color === "default" && {
93
- color: theme.vars.palette.text.primary
94
- },
95
- "&:hover": {
96
- backgroundColor: ownerState.paletteColor?.hover
97
- },
98
- "&:active": {
99
- backgroundColor: ownerState.paletteColor?.active
100
- },
101
- "&:focus-visible": {
102
- boxShadow: "none",
103
- outline: theme.vars.size.borderStroke.container,
104
- outlineColor: theme.vars.palette.border.main,
105
- outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
106
- backgroundColor: ownerState.paletteColor?.active
107
- }
108
- },
109
- // Estilo para el texto dentro del botón
110
- "& span": {
111
- margin: "0px"
112
- },
113
- // Styles for small button size
114
- ...ownerState.size === "small" && {
115
- ...theme.generalSettings.isMobile ? {
116
- height: theme.vars.size.mobile.small.action,
117
- minHeight: theme.vars.size.mobile.small.action
118
- } : {
119
- height: theme.vars.size.desktop.small.action,
120
- minHeight: theme.vars.size.desktop.small.action
121
- }
122
- },
123
- // Styles for medium button size
124
- ...ownerState.size === "medium" && {
125
- ...theme.generalSettings.isMobile ? {
126
- height: theme.vars.size.mobile.medium.action,
127
- minHeight: theme.vars.size.mobile.medium.action
128
- } : {
129
- height: theme.vars.size.desktop.medium.action,
130
- minHeight: theme.vars.size.desktop.medium.action
131
- }
132
- }
133
- }),
134
- /**
135
- * Estilos para el ícono dentro del botón.
136
- * Ajusta la visibilidad para los estados de carga y deshabilitado.
137
- */
138
- loadingButtonIcon: ({ theme, ownerState }) => ({
139
- ...ownerState.loading === true && {
140
- visibility: "hidden"
141
- },
142
- ...ownerState.disabled === true && {
143
- '& [class*="M4LIcon-icon"]': {
144
- backgroundColor: theme.vars.palette.text.disabled
145
- }
146
- }
147
- }),
148
- /**
149
- * Estilos para el texto del botón.
150
- * Incluye ajustes para los estados de carga y deshabilitado.
151
- */
152
- textLoadingButton: ({ theme, ownerState }) => ({
153
- ...theme.typography.bodyDens,
154
- ...ownerState.loading === true && {
155
- visibility: "hidden"
156
- },
157
- ...ownerState.disabled === true && {
158
- color: theme.vars.palette.text.disabled
159
14
  }
160
15
  }),
161
16
  /**
@@ -190,9 +45,9 @@ const loadingButtonStyles = {
190
45
  * Estilos para el componente CircularProgress.
191
46
  * Posiciona el cargador dentro del botón y aplica un color consistente.
192
47
  */
193
- circularProgress: ({ theme }) => ({
48
+ circularProgress: ({ theme, ownerState }) => ({
194
49
  position: "absolute",
195
- color: theme.vars.palette.text.disabled
50
+ color: ownerState.color === "default" ? theme.vars.palette.text.disabled : theme.vars.palette[ownerState.color || "default"].main
196
51
  })
197
52
  };
198
53
  export {
@@ -6,3 +6,8 @@
6
6
  * @default 'M4LLoadingButton'
7
7
  */
8
8
  export declare const LOADING_BUTTON_KEY_COMPONENT = "M4LLoadingButton";
9
+ /**
10
+ * Nombre de clase creado para aportar especificidad a los estilos del componente. Es usado para sobreescribir los estilos de MUI sin
11
+ * tener la necesidad de agregar valores en !important.
12
+ */
13
+ export declare const LOADING_BUTTON_CLASS_NAME_SPECIFY = "M4lclassCssSpecificityLoadingButton";
@@ -1,7 +1,5 @@
1
1
  export declare enum LoadingButtonSlots {
2
- loadingButtonRoot = "loadingButtonRoot",
2
+ root = "root",
3
3
  skeletonLoadingButton = "skeletonLoadingButton",
4
- loadingButtonIcon = "loadingButtonIcon",
5
- textLoadingButton = "textLoadingButton",
6
4
  circularProgress = "circularProgress"
7
5
  }