@m4l/components 9.1.102 → 9.1.104

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 (24) hide show
  1. package/.storybook/network-mocks.d.ts +1 -0
  2. package/components/DynamicFilter/subcomponents/AppliedFilters/AppliedFilters.d.ts +4 -0
  3. package/components/DynamicSort/subcomponents/AppliedSorts/AppliedSorts.d.ts +4 -0
  4. package/components/MenuActions/types.d.ts +2 -2
  5. package/components/ObjectLogs/components/DetailDialog/index.d.ts +4 -0
  6. package/components/ScrollBar/ScrollBar.d.ts +4 -0
  7. package/components/ScrollBar/ScrollBar.styles.js +8 -0
  8. package/components/areas/contexts/AreasContext/tests/fnNetworkImplementation.d.ts +4 -0
  9. package/components/mui_extended/Autocomplete/Autocomplete.js +1 -1
  10. package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +4 -0
  11. package/components/mui_extended/Autocomplete/renderOptions/index.js +1 -1
  12. package/components/mui_extended/Autocomplete/types.d.ts +5 -1
  13. package/components/mui_extended/MenuItem/MenuItem.d.ts +4 -0
  14. package/components/mui_extended/MenuItem/MenuItem.js +2 -10
  15. package/components/mui_extended/MenuItem/MenuItem.styles.js +77 -94
  16. package/components/mui_extended/MenuItem/types.d.ts +4 -8
  17. package/mockServiceWorker.js +307 -0
  18. package/package.json +6 -1
  19. /package/components/mui_extended/Autocomplete/{slots → slots}/AutocompleteEnum.d.ts +0 -0
  20. /package/components/mui_extended/Autocomplete/{slots → slots}/AutocompleteEnum.js +0 -0
  21. /package/components/mui_extended/Autocomplete/{slots → slots}/AutocompleteSlots.d.ts +0 -0
  22. /package/components/mui_extended/Autocomplete/{slots → slots}/AutocompleteSlots.js +0 -0
  23. /package/components/mui_extended/Autocomplete/{slots → slots}/index.d.ts +0 -0
  24. /package/components/mui_extended/Autocomplete/{slots → slots}/index.js +0 -0
@@ -0,0 +1 @@
1
+ export declare const mswHandlers: import('msw').HttpHandler[];
@@ -1,5 +1,9 @@
1
1
  /**
2
2
  * TODO: Documentar
3
+ * @author Diego Betancur - automatic
4
+ * @createdAt 2025-02-10 11:27:50 - automatic
5
+ * @updatedAt 2025-02-10 11:27:50 - automatic
6
+ * @updatedUser Diego Betancur - automatic
3
7
  */
4
8
  declare function AppliedFilters(): import("react/jsx-runtime").JSX.Element;
5
9
  export default AppliedFilters;
@@ -1,5 +1,9 @@
1
1
  /**
2
2
  * TODO: Documentar
3
+ * @author Diego Betancur - automatic
4
+ * @createdAt 2025-02-10 11:27:50 - automatic
5
+ * @updatedAt 2025-02-10 11:27:50 - automatic
6
+ * @updatedUser Diego Betancur - automatic
3
7
  */
4
8
  declare function AppliedSorts(): import("react/jsx-runtime").JSX.Element;
5
9
  export default AppliedSorts;
@@ -20,7 +20,7 @@ export type MenuTypes = 'menuItem' | 'divider' | 'loader' | 'customNode';
20
20
  interface BaseMenuAction {
21
21
  type: MenuTypes;
22
22
  }
23
- interface MenuItemAction extends BaseMenuAction, Pick<MenuItemProps, 'startIcon' | 'endIcon' | 'label' | 'selected' | 'componentPaletteColor' | 'color' | 'disabled' | 'checkable' | 'checked'> {
23
+ interface MenuItemAction extends BaseMenuAction, Pick<MenuItemProps, 'startIcon' | 'endIcon' | 'label' | 'selected' | 'color' | 'disabled' | 'checkable' | 'checked'> {
24
24
  type: 'menuItem';
25
25
  onClick?: (arg?: any) => void;
26
26
  customNode?: never;
@@ -52,7 +52,7 @@ interface CustomNodeAction extends BaseMenuAction {
52
52
  * [onClick] - Función opcional a ejecutar al hacer clic en la acción del menú.
53
53
  * [error] - Indicador de error en la acción del menú.
54
54
  */
55
- export type MenuAction = (MenuItemAction & Pick<MenuItemProps, 'startIcon' | 'endIcon' | 'label' | 'selected' | 'componentPaletteColor' | 'color' | 'disabled' | 'checkable' | 'checked'> & {
55
+ export type MenuAction = (MenuItemAction & Pick<MenuItemProps, 'startIcon' | 'endIcon' | 'label' | 'selected' | 'color' | 'disabled' | 'checkable' | 'checked'> & {
56
56
  onClick?: (arg?: any) => void;
57
57
  error?: boolean;
58
58
  }) | DividerAction | LoaderAction | CustomNodeAction;
@@ -1,5 +1,9 @@
1
1
  import { DetailDialogProps } from './types';
2
2
  /**
3
3
  * TODO: Documentar
4
+ * @author Diego Betancur - automatic
5
+ * @createdAt 2025-02-10 11:27:50 - automatic
6
+ * @updatedAt 2025-02-10 11:27:50 - automatic
7
+ * @updatedUser Diego Betancur - automatic
4
8
  */
5
9
  export declare function DetailDialog(props: DetailDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,10 @@
1
1
  import { ScrollBarProps } from './types';
2
2
  /**
3
3
  * TODO: Documentar
4
+ * @author Diego Betancur - automatic
5
+ * @createdAt 2025-02-10 11:27:50 - automatic
6
+ * @updatedAt 2025-02-10 11:27:50 - automatic
7
+ * @updatedUser Diego Betancur - automatic
4
8
  */
5
9
  export declare function ScrollBar(props: ScrollBarProps): import("react/jsx-runtime").JSX.Element;
6
10
  export default ScrollBar;
@@ -2,6 +2,14 @@ import "simplebar-react/dist/simplebar.min.css";
2
2
  const scrollBarStyles = {
3
3
  /**
4
4
  * 👾 Estilos para el Componente ScrollBar 👾
5
+ * @updatedUser Diego Betancur - automatic
6
+ * @updatedAt 2025-02-10 11:27:50 - automatic
7
+ * @createdAt 2025-02-10 11:27:50 - automatic
8
+ * @author Diego Betancur - automatic
9
+ * @author Diego Betancur - automatic
10
+ * @createdAt 2025-02-10 11:27:50 - automatic
11
+ * @updatedAt 2025-02-10 11:27:50 - automatic
12
+ * @updatedUser Diego Betancur - automatic
5
13
  */
6
14
  root: ({ theme }) => ({
7
15
  flexGrow: "1",
@@ -16,6 +16,10 @@ export declare const windowSelected = "windowSelected";
16
16
  * Función para ser usada como una implementación de mock
17
17
  * de la función networkOperation del hook useNetwork.
18
18
  * @param pars Parámetros de la llamada a la api
19
+ * @author Diego Betancur - automatic
20
+ * @createdAt 2025-02-10 11:59:56 - automatic
21
+ * @updatedAt 2025-02-10 11:59:56 - automatic
22
+ * @updatedUser Diego Betancur - automatic
19
23
  */
20
24
  export declare const fnNetworkImplementation: (pars: any) => Promise<{
21
25
  data: {};
@@ -3,7 +3,7 @@ import { useModuleDictionary, useModuleSkeleton, useEnvironment } from "@m4l/cor
3
3
  import { forwardRef, useState, useEffect, useCallback, useMemo } from "react";
4
4
  import { r as renderOption } from "./renderOptions/index.js";
5
5
  import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
6
- import { C as ChipStyled, I as ImageStyled, A as AdormentsStyled, a as CircularProgressStyled, b as IconButtonStyled, S as SkeletonAutocompleteStyled, c as AutocompleteRootStyled, P as PopperComponentStyled, R as RenderInputStyled } from "./slots /AutocompleteSlots.js";
6
+ import { C as ChipStyled, I as ImageStyled, A as AdormentsStyled, a as CircularProgressStyled, b as IconButtonStyled, S as SkeletonAutocompleteStyled, c as AutocompleteRootStyled, P as PopperComponentStyled, R as RenderInputStyled } from "./slots/AutocompleteSlots.js";
7
7
  import { T as Typography } from "../Typography/Typography.js";
8
8
  const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
9
9
  const {
@@ -4,6 +4,10 @@ import { Sizes } from '@m4l/styles';
4
4
  * Higher-order function to generate a render option function for Autocomplete.
5
5
  * It supports rendering options with `startAd` and `endIcon`.
6
6
  * @param color - The color for the MenuItem.
7
+ * @author SebastianM - automatic
8
+ * @createdAt 2024-11-28 18:58:00 - automatic
9
+ * @updatedAt 2025-02-10 10:25:46 - automatic
10
+ * @updatedUser cesar - automatic
7
11
  */
8
12
  export declare function renderOption<T>(optionProps: HTMLAttributes<HTMLLIElement>, option: T & {
9
13
  label: string;
@@ -7,7 +7,7 @@ function renderOption(optionProps, option) {
7
7
  {
8
8
  ...otherOptionProps,
9
9
  selected: option.selected,
10
- color: "primary",
10
+ color: "default",
11
11
  key: option.id || option.label,
12
12
  label: option.label,
13
13
  disabled: option.disabled,
@@ -3,7 +3,7 @@ import { Sizes } from '@m4l/styles';
3
3
  import { ChangeEvent } from 'react';
4
4
  import { TextFieldProps } from '../TextField/types';
5
5
  import { AUTOCOMPLETE_KEY_COMPONENT } from './constants';
6
- import { AutocompleteSlots } from './slots ';
6
+ import { AutocompleteSlots } from './slots';
7
7
  import { M4LOverridesStyleRules } from '../../../@types/augmentations';
8
8
  export type GetOptionString<T> = (option: T | null) => string;
9
9
  export type AutocompleteVariants = 'outlined' | 'text';
@@ -27,6 +27,10 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined> exte
27
27
  isOptionEqualToValue: (option: T, value: T) => boolean;
28
28
  /**
29
29
  * Function to refresh the options.
30
+ * @author Diego Betancur - automatic
31
+ * @createdAt 2025-01-26 11:45:36 - automatic
32
+ * @updatedAt 2025-01-26 11:45:37 - automatic
33
+ * @updatedUser Diego Betancur - automatic
30
34
  */
31
35
  refresh?: () => void;
32
36
  onChangeFilterParmsLocal?: (newValue: string, reason: AutocompleteInputChangeReason) => void;
@@ -5,5 +5,9 @@ import { MenuItemProps } from './types';
5
5
  * If the module is in skeleton mode, it renders a skeleton menu item instead.
6
6
  * @param props
7
7
  * @returns
8
+ * @author Bruce Escobar - automatic
9
+ * @createdAt 2024-10-22 19:53:39 - automatic
10
+ * @updatedAt 2025-02-10 10:22:38 - automatic
11
+ * @updatedUser cesar - automatic
8
12
  */
9
13
  export declare const MenuItem: (props: MenuItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useModuleSkeleton, useEnvironment, getPropertyByString } from "@m4l/core";
3
- import { useTheme } from "@mui/material";
2
+ import { useModuleSkeleton, useEnvironment } from "@m4l/core";
4
3
  import clsx from "clsx";
5
4
  import { a as getComponentSlotRoot } from "../../../utils/getComponentSlotRoot.js";
6
5
  import { M as MENUITEM_CLASSES } from "./constants.js";
@@ -14,7 +13,7 @@ const MenuItem = (props) => {
14
13
  value,
15
14
  skeletonWidth = "100%",
16
15
  selected = false,
17
- color = "primary",
16
+ color = "default",
18
17
  disabled = false,
19
18
  size = "medium",
20
19
  checked = false,
@@ -24,19 +23,12 @@ const MenuItem = (props) => {
24
23
  } = props;
25
24
  const { currentSize } = useComponentSize(size);
26
25
  const isSkeleton = useModuleSkeleton();
27
- const theme = useTheme();
28
26
  const { host_static_assets, environment_assets } = useEnvironment();
29
27
  const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
30
- const paletteColor = getPropertyByString(
31
- theme.vars.palette,
32
- disabled ? "default" : color,
33
- theme.vars.palette.default
34
- );
35
28
  const ownerState = {
36
29
  size: adjustedSize,
37
30
  disabled,
38
31
  selected,
39
- paletteColor,
40
32
  color,
41
33
  checkable,
42
34
  checked
@@ -1,115 +1,91 @@
1
1
  import { g as getHeightSizeStyles } from "../../../utils/getHeightSizeStyles.js";
2
2
  const menuItemStyles = {
3
3
  /**
4
- * Estilos para el contenedor de los items del menú
5
- * <<<<<<< HEAD
6
- * =======
7
- * >>>>>>> main
4
+ * Estilos para el contenedor de los items del menú contenedor
5
+ * @author cesar - automatic
6
+ * @createdAt 2025-02-10 10:22:37 - automatic
7
+ * @updatedAt 2025-02-10 16:37:32 - automatic
8
+ * @updatedUser cesar - automatic
8
9
  */
9
- root: ({ theme, ownerState }) => ({
10
- width: "100%",
11
- gap: theme.vars.size.baseSpacings.sp3,
12
- paddingTop: theme.vars.size.baseSpacings.sp2,
13
- paddingBottom: theme.vars.size.baseSpacings.sp2,
14
- paddingLeft: theme.vars.size.baseSpacings.sp4,
15
- paddingRight: theme.vars.size.baseSpacings.sp4,
16
- borderRadius: theme.vars.size.borderRadius.r0,
17
- "& .M4LTypography-root": {
18
- paddingLeft: theme.vars.size.baseSpacings.sp1
19
- },
20
- ...ownerState.selected && {
21
- borderLeft: theme.vars.size.borderStroke.container,
22
- borderColor: ownerState.paletteColor?.main,
10
+ root: ({ theme, ownerState }) => {
11
+ const mainColor = ownerState.selected ? ownerState.color === "error" ? ownerState.color : "primary" : ownerState.color;
12
+ const paletteColor = theme.vars.palette[mainColor ?? "default"];
13
+ const color = (token) => {
14
+ return ownerState.color === "default" && !ownerState.selected ? theme.vars.palette.text.primary : paletteColor[token];
15
+ };
16
+ return {
17
+ width: "100%",
18
+ gap: theme.vars.size.baseSpacings.sp4,
19
+ paddingTop: theme.vars.size.baseSpacings.sp1,
20
+ paddingBottom: theme.vars.size.baseSpacings.sp1,
21
+ paddingLeft: theme.vars.size.baseSpacings.sp4,
22
+ paddingRight: theme.vars.size.baseSpacings.sp4,
23
+ borderRadius: theme.vars.size.borderRadius.r0,
24
+ // Estilos base para el texto y el ícono
23
25
  "& .M4LTypography-root": {
24
- color: ownerState.paletteColor?.enabled
26
+ paddingLeft: theme.vars.size.baseSpacings.sp1,
27
+ color: color("enabled")
25
28
  },
26
29
  "& .M4LIcon-icon": {
27
- backgroundColor: ownerState.paletteColor?.enabled
30
+ backgroundColor: `${color("enabled")} !important`
28
31
  },
29
- "&:hover": {
30
- backgroundColor: ownerState.paletteColor?.hoverOpacity,
32
+ "&:active": {
33
+ backgroundColor: `${paletteColor.activeOpacity} !important`,
31
34
  "& .M4LIcon-icon": {
32
- backgroundColor: ownerState.paletteColor?.hover
33
- },
34
- "& .M4LTypography-root": {
35
- color: ownerState.paletteColor?.hover
35
+ backgroundColor: color("active")
36
36
  }
37
37
  },
38
- "&:active": {
39
- backgroundColor: ownerState.paletteColor?.activeOpacity,
40
- "& .M4LIcon-icon": {
41
- backgroundColor: ownerState.paletteColor?.active
42
- },
38
+ "&:hover": {
39
+ backgroundColor: paletteColor.hoverOpacity,
43
40
  "& .M4LTypography-root": {
44
- color: ownerState.paletteColor?.active
41
+ paddingLeft: theme.vars.size.baseSpacings.sp1,
42
+ color: color("hover")
43
+ },
44
+ "& .M4LIcon-icon": {
45
+ backgroundColor: color("hover")
45
46
  }
46
47
  },
47
48
  "&:focus-visible": {
48
- backgroundColor: ownerState.paletteColor?.activeOpacity,
49
49
  outline: theme.vars.size.borderStroke.container,
50
50
  outlineColor: theme.vars.palette.border.main,
51
- outlineOffset: theme.vars.size.baseSpacings["sp0-5"],
52
- "& .M4LIcon-icon": {
53
- color: ownerState.paletteColor?.active
54
- }
55
- }
56
- },
57
- ...ownerState.color === "default" && {
58
- "& .M4LTypography-root": {
59
- color: theme.vars.palette.text.primary
51
+ outlineOffset: theme.vars.size.baseSpacings["sp0-5"]
60
52
  },
61
- "& .M4LIcon-icon": {
62
- backgroundColor: theme.vars.palette.text.primary
63
- },
64
- "&:hover": {
65
- backgroundColor: ownerState.paletteColor?.hoverOpacity
53
+ ...ownerState.selected && {
54
+ borderLeft: theme.vars.size.borderStroke.container,
55
+ borderLeftColor: paletteColor.enabled
66
56
  },
67
- "&:active": {
68
- backgroundColor: ownerState.paletteColor?.activeOpacity,
69
- "& .M4LIcon-icon": {
70
- backgroundColor: theme.vars.palette.text.primary
71
- }
72
- }
73
- },
74
- ...ownerState.disabled && {
75
- pointerEvents: "none",
76
- "& .M4LTypography-root": {
77
- color: theme.vars.palette.text.disabled
57
+ "& .M4LImage-root": {
58
+ ...getHeightSizeStyles(
59
+ theme.generalSettings.isMobile,
60
+ ownerState.size || "medium",
61
+ "base",
62
+ (val) => {
63
+ return {
64
+ height: val,
65
+ width: val
66
+ };
67
+ }
68
+ )
78
69
  },
79
- "& .M4LIcon-icon": {
80
- backgroundColor: theme.vars.palette.text.disabled
81
- }
82
- },
83
- "& .M4LImage-root": {
84
70
  ...getHeightSizeStyles(
85
71
  theme.generalSettings.isMobile,
86
72
  ownerState.size || "medium",
87
- "base",
88
- (val) => {
73
+ "action",
74
+ (height) => {
89
75
  return {
90
- height: val,
91
- width: val
76
+ //height: 'auto !important',
77
+ minHeight: `${height}!important`
92
78
  };
93
79
  }
94
80
  )
95
- },
96
- ...getHeightSizeStyles(
97
- theme.generalSettings.isMobile,
98
- ownerState.size || "medium",
99
- "action",
100
- (height) => {
101
- return {
102
- //height: 'auto !important',
103
- minHeight: `${height}!important`
104
- };
105
- }
106
- )
107
- }),
81
+ };
82
+ },
108
83
  /**
109
84
  * Estilos para el icono de los items del menú
110
- * <<<<<<< HEAD
111
- * =======
112
- * >>>>>>> main
85
+ * @author SebastianM - automatic
86
+ * @createdAt 2024-12-02 19:12:14 - automatic
87
+ * @updatedAt 2025-02-10 16:37:32 - automatic
88
+ * @updatedUser cesar - automatic
113
89
  */
114
90
  menuItemIcon: () => ({
115
91
  "&.MenuItemEndIcon-root": {
@@ -118,24 +94,26 @@ const menuItemStyles = {
118
94
  }),
119
95
  /**
120
96
  * Estilos para el icono de los items del menú cuando están seleccionados
121
- * <<<<<<< HEAD
122
- * =======
123
- * >>>>>>> main
97
+ * @author SebastianM - automatic
98
+ * @createdAt 2024-12-13 12:45:48 - automatic
99
+ * @updatedAt 2025-02-10 16:37:32 - automatic
100
+ * @updatedUser cesar - automatic
124
101
  */
125
- menuItemIconChecked: ({ ownerState }) => ({
102
+ menuItemIconChecked: ({ theme, ownerState }) => ({
126
103
  visibility: ownerState.checkable ? ownerState.checked ? "visible" : "hidden" : "hidden",
127
104
  ...ownerState.selected && {
128
105
  "& .M4LIcon-icon": {
129
- backgroundColor: ownerState.paletteColor?.main
106
+ backgroundColor: theme.vars.palette[ownerState.color ?? "default"].main
130
107
  }
131
108
  },
132
109
  variants: []
133
110
  }),
134
111
  /**
135
112
  * Estilos para la tipografía del menú item
136
- * <<<<<<< HEAD
137
- * =======
138
- * >>>>>>> main
113
+ * @author SebastianM - automatic
114
+ * @createdAt 2024-12-13 12:45:48 - automatic
115
+ * @updatedAt 2025-02-10 16:37:32 - automatic
116
+ * @updatedUser cesar - automatic
139
117
  */
140
118
  menuItemTypography: () => ({
141
119
  overflow: "hidden",
@@ -143,6 +121,10 @@ const menuItemStyles = {
143
121
  }),
144
122
  /**
145
123
  * Estilos para el contenedor de los items del menú contenedor
124
+ * @author cesar - automatic
125
+ * @createdAt 2025-01-20 15:51:18 - automatic
126
+ * @updatedAt 2025-02-10 16:37:32 - automatic
127
+ * @updatedUser cesar - automatic
146
128
  */
147
129
  menuItemContainer: ({ theme }) => ({
148
130
  display: "flex",
@@ -153,9 +135,10 @@ const menuItemStyles = {
153
135
  }),
154
136
  /**
155
137
  * Estilos para el contenedor de los items del menú en skeleton
156
- * <<<<<<< HEAD
157
- * =======
158
- * >>>>>>> main
138
+ * @author Bruce Escobar - automatic
139
+ * @createdAt 2024-10-22 10:38:00 - automatic
140
+ * @updatedAt 2025-02-10 16:37:32 - automatic
141
+ * @updatedUser cesar - automatic
159
142
  */
160
143
  skeletonMenuItem: ({ theme, ownerState }) => ({
161
144
  width: "100%",
@@ -1,4 +1,4 @@
1
- import { MenuItemProps as MUIMenuItemProps, Theme, PaletteColor } from '@mui/material';
1
+ import { MenuItemProps as MUIMenuItemProps, Theme } from '@mui/material';
2
2
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
3
3
  import { Sizes, ComponentPalletColor } from '@m4l/styles';
4
4
  import { MenuItemSlots } from './slots';
@@ -27,11 +27,7 @@ export interface MenuItemProps extends Omit<MUIMenuItemProps, 'size' | 'color'>
27
27
  /**
28
28
  * Define el color del `MenuItem`
29
29
  */
30
- color?: Extract<ComponentPalletColor, 'primary' | 'default' | 'error'>;
31
- /**
32
- * Personalización del color de la paleta del componente
33
- */
34
- componentPaletteColor?: ComponentPalletColor;
30
+ color?: Extract<ComponentPalletColor, 'default' | 'error'>;
35
31
  /**
36
32
  * Indica si el `MenuItem` está deshabilitado
37
33
  */
@@ -58,8 +54,8 @@ export interface MenuItemProps extends Omit<MUIMenuItemProps, 'size' | 'color'>
58
54
  * Pick<MenuItemProps, 'size' | 'componentPaletteColor' | 'disabled' | 'selected'>
59
55
  * paletteColor - Define el color de la paleta aplicada al `MenuItem`.
60
56
  */
61
- export interface MenuItemOwnerState extends Pick<MenuItemProps, 'checked' | 'checkable' | 'size' | 'componentPaletteColor' | 'disabled' | 'selected' | 'color'> {
62
- paletteColor: PaletteColor;
57
+ export interface MenuItemOwnerState extends Pick<MenuItemProps, 'checked' | 'checkable' | 'size' | 'disabled' | 'selected'> {
58
+ color: Extract<ComponentPalletColor, 'default' | 'error' | 'primary'>;
63
59
  }
64
60
  /**
65
61
  * Define los tipos de Slots disponibles para el `MenuItem`.
@@ -0,0 +1,307 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+
4
+ /**
5
+ * Mock Service Worker.
6
+ * @see https://github.com/mswjs/msw
7
+ * - Please do NOT modify this file.
8
+ * - Please do NOT serve this file on production.
9
+ */
10
+
11
+ const PACKAGE_VERSION = '2.7.0'
12
+ const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
13
+ const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
14
+ const activeClientIds = new Set()
15
+
16
+ self.addEventListener('install', function () {
17
+ self.skipWaiting()
18
+ })
19
+
20
+ self.addEventListener('activate', function (event) {
21
+ event.waitUntil(self.clients.claim())
22
+ })
23
+
24
+ self.addEventListener('message', async function (event) {
25
+ const clientId = event.source.id
26
+
27
+ if (!clientId || !self.clients) {
28
+ return
29
+ }
30
+
31
+ const client = await self.clients.get(clientId)
32
+
33
+ if (!client) {
34
+ return
35
+ }
36
+
37
+ const allClients = await self.clients.matchAll({
38
+ type: 'window',
39
+ })
40
+
41
+ switch (event.data) {
42
+ case 'KEEPALIVE_REQUEST': {
43
+ sendToClient(client, {
44
+ type: 'KEEPALIVE_RESPONSE',
45
+ })
46
+ break
47
+ }
48
+
49
+ case 'INTEGRITY_CHECK_REQUEST': {
50
+ sendToClient(client, {
51
+ type: 'INTEGRITY_CHECK_RESPONSE',
52
+ payload: {
53
+ packageVersion: PACKAGE_VERSION,
54
+ checksum: INTEGRITY_CHECKSUM,
55
+ },
56
+ })
57
+ break
58
+ }
59
+
60
+ case 'MOCK_ACTIVATE': {
61
+ activeClientIds.add(clientId)
62
+
63
+ sendToClient(client, {
64
+ type: 'MOCKING_ENABLED',
65
+ payload: {
66
+ client: {
67
+ id: client.id,
68
+ frameType: client.frameType,
69
+ },
70
+ },
71
+ })
72
+ break
73
+ }
74
+
75
+ case 'MOCK_DEACTIVATE': {
76
+ activeClientIds.delete(clientId)
77
+ break
78
+ }
79
+
80
+ case 'CLIENT_CLOSED': {
81
+ activeClientIds.delete(clientId)
82
+
83
+ const remainingClients = allClients.filter((client) => {
84
+ return client.id !== clientId
85
+ })
86
+
87
+ // Unregister itself when there are no more clients
88
+ if (remainingClients.length === 0) {
89
+ self.registration.unregister()
90
+ }
91
+
92
+ break
93
+ }
94
+ }
95
+ })
96
+
97
+ self.addEventListener('fetch', function (event) {
98
+ const { request } = event
99
+
100
+ // Bypass navigation requests.
101
+ if (request.mode === 'navigate') {
102
+ return
103
+ }
104
+
105
+ // Opening the DevTools triggers the "only-if-cached" request
106
+ // that cannot be handled by the worker. Bypass such requests.
107
+ if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') {
108
+ return
109
+ }
110
+
111
+ // Bypass all requests when there are no active clients.
112
+ // Prevents the self-unregistered worked from handling requests
113
+ // after it's been deleted (still remains active until the next reload).
114
+ if (activeClientIds.size === 0) {
115
+ return
116
+ }
117
+
118
+ // Generate unique request ID.
119
+ const requestId = crypto.randomUUID()
120
+ event.respondWith(handleRequest(event, requestId))
121
+ })
122
+
123
+ async function handleRequest(event, requestId) {
124
+ const client = await resolveMainClient(event)
125
+ const response = await getResponse(event, client, requestId)
126
+
127
+ // Send back the response clone for the "response:*" life-cycle events.
128
+ // Ensure MSW is active and ready to handle the message, otherwise
129
+ // this message will pend indefinitely.
130
+ if (client && activeClientIds.has(client.id)) {
131
+ ;(async function () {
132
+ const responseClone = response.clone()
133
+
134
+ sendToClient(
135
+ client,
136
+ {
137
+ type: 'RESPONSE',
138
+ payload: {
139
+ requestId,
140
+ isMockedResponse: IS_MOCKED_RESPONSE in response,
141
+ type: responseClone.type,
142
+ status: responseClone.status,
143
+ statusText: responseClone.statusText,
144
+ body: responseClone.body,
145
+ headers: Object.fromEntries(responseClone.headers.entries()),
146
+ },
147
+ },
148
+ [responseClone.body],
149
+ )
150
+ })()
151
+ }
152
+
153
+ return response
154
+ }
155
+
156
+ // Resolve the main client for the given event.
157
+ // Client that issues a request doesn't necessarily equal the client
158
+ // that registered the worker. It's with the latter the worker should
159
+ // communicate with during the response resolving phase.
160
+ async function resolveMainClient(event) {
161
+ const client = await self.clients.get(event.clientId)
162
+
163
+ if (activeClientIds.has(event.clientId)) {
164
+ return client
165
+ }
166
+
167
+ if (client?.frameType === 'top-level') {
168
+ return client
169
+ }
170
+
171
+ const allClients = await self.clients.matchAll({
172
+ type: 'window',
173
+ })
174
+
175
+ return allClients
176
+ .filter((client) => {
177
+ // Get only those clients that are currently visible.
178
+ return client.visibilityState === 'visible'
179
+ })
180
+ .find((client) => {
181
+ // Find the client ID that's recorded in the
182
+ // set of clients that have registered the worker.
183
+ return activeClientIds.has(client.id)
184
+ })
185
+ }
186
+
187
+ async function getResponse(event, client, requestId) {
188
+ const { request } = event
189
+
190
+ // Clone the request because it might've been already used
191
+ // (i.e. its body has been read and sent to the client).
192
+ const requestClone = request.clone()
193
+
194
+ function passthrough() {
195
+ // Cast the request headers to a new Headers instance
196
+ // so the headers can be manipulated with.
197
+ const headers = new Headers(requestClone.headers)
198
+
199
+ // Remove the "accept" header value that marked this request as passthrough.
200
+ // This prevents request alteration and also keeps it compliant with the
201
+ // user-defined CORS policies.
202
+ const acceptHeader = headers.get('accept')
203
+ if (acceptHeader) {
204
+ const values = acceptHeader.split(',').map((value) => value.trim())
205
+ const filteredValues = values.filter(
206
+ (value) => value !== 'msw/passthrough',
207
+ )
208
+
209
+ if (filteredValues.length > 0) {
210
+ headers.set('accept', filteredValues.join(', '))
211
+ } else {
212
+ headers.delete('accept')
213
+ }
214
+ }
215
+
216
+ return fetch(requestClone, { headers })
217
+ }
218
+
219
+ // Bypass mocking when the client is not active.
220
+ if (!client) {
221
+ return passthrough()
222
+ }
223
+
224
+ // Bypass initial page load requests (i.e. static assets).
225
+ // The absence of the immediate/parent client in the map of the active clients
226
+ // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
227
+ // and is not ready to handle requests.
228
+ if (!activeClientIds.has(client.id)) {
229
+ return passthrough()
230
+ }
231
+
232
+ // Notify the client that a request has been intercepted.
233
+ const requestBuffer = await request.arrayBuffer()
234
+ const clientMessage = await sendToClient(
235
+ client,
236
+ {
237
+ type: 'REQUEST',
238
+ payload: {
239
+ id: requestId,
240
+ url: request.url,
241
+ mode: request.mode,
242
+ method: request.method,
243
+ headers: Object.fromEntries(request.headers.entries()),
244
+ cache: request.cache,
245
+ credentials: request.credentials,
246
+ destination: request.destination,
247
+ integrity: request.integrity,
248
+ redirect: request.redirect,
249
+ referrer: request.referrer,
250
+ referrerPolicy: request.referrerPolicy,
251
+ body: requestBuffer,
252
+ keepalive: request.keepalive,
253
+ },
254
+ },
255
+ [requestBuffer],
256
+ )
257
+
258
+ switch (clientMessage.type) {
259
+ case 'MOCK_RESPONSE': {
260
+ return respondWithMock(clientMessage.data)
261
+ }
262
+
263
+ case 'PASSTHROUGH': {
264
+ return passthrough()
265
+ }
266
+ }
267
+
268
+ return passthrough()
269
+ }
270
+
271
+ function sendToClient(client, message, transferrables = []) {
272
+ return new Promise((resolve, reject) => {
273
+ const channel = new MessageChannel()
274
+
275
+ channel.port1.onmessage = (event) => {
276
+ if (event.data && event.data.error) {
277
+ return reject(event.data.error)
278
+ }
279
+
280
+ resolve(event.data)
281
+ }
282
+
283
+ client.postMessage(
284
+ message,
285
+ [channel.port2].concat(transferrables.filter(Boolean)),
286
+ )
287
+ })
288
+ }
289
+
290
+ async function respondWithMock(response) {
291
+ // Setting response status code to 0 is a no-op.
292
+ // However, when responding with a "Response.error()", the produced Response
293
+ // instance will have status code set to 0. Since it's not possible to create
294
+ // a Response instance with status code 0, handle that use-case separately.
295
+ if (response.status === 0) {
296
+ return Response.error()
297
+ }
298
+
299
+ const mockedResponse = new Response(response.body, response)
300
+
301
+ Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
302
+ value: true,
303
+ enumerable: true,
304
+ })
305
+
306
+ return mockedResponse
307
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.1.102",
3
+ "version": "9.1.104",
4
4
  "license": "UNLICENSED",
5
5
  "lint-staged": {
6
6
  "*.{js,ts,tsx}": "eslint --fix --max-warnings 0"
@@ -94,6 +94,11 @@
94
94
  "node": ">=12.0.0"
95
95
  },
96
96
  "packageManager": "yarn@4.5.0",
97
+ "msw": {
98
+ "workerDirectory": [
99
+ "public"
100
+ ]
101
+ },
97
102
  "private": false,
98
103
  "exports": {
99
104
  ".": {