@m4l/components 8.1.0 → 8.2.0-beta.devDaniel.MenuActionsBug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/export.d.ts +0 -3
- package/components/AccountPopover/classes/index.d.ts +1 -1
- package/components/CommonActions/classes/index.d.ts +1 -1
- package/components/ControlIncrement/slots/ControltrolIncrementSlots.d.ts +1 -1
- package/components/DataGrid/classes/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.js +3 -3
- package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.js +10 -10
- package/components/DynamicFilter/slots/dynamicFilterSlots.d.ts +1 -1
- package/components/DynamicSort/slots/DynamicSortSlots.d.ts +1 -1
- package/components/GridLayout/classes/index.d.ts +1 -1
- package/components/Label/slots/LabelSlots.d.ts +1 -1
- package/components/PaperForm/classes/index.d.ts +1 -1
- package/components/Period/classes/index.d.ts +1 -1
- package/components/SideBar/classes/index.d.ts +2 -2
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/styles.d.ts +1 -1
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/subcomponents/NavItemSubContent/styles.d.ts +1 -1
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/subcomponents/ChipActionsMobile/index.js +2 -2
- package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/helper.js +3 -3
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/MainActions/index.js +3 -3
- package/components/extended/react-resizable/Resizable/slots/ResizableSlots.d.ts +1 -1
- package/components/extended/react-resizable/ResizableBox/slots/ResizableBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/classes/index.d.ts +1 -1
- package/components/hook-form/RHFAutocomplete/subcomponents/ComponentTypeImage/index.js +1 -1
- package/components/hook-form/RHFCheckbox/classes/index.d.ts +1 -1
- package/components/hook-form/RHFCheckbox/styles.d.ts +1 -1
- package/components/hook-form/RHFColorPicker/classes/index.d.ts +1 -1
- package/components/hook-form/RHFDateTime/classes/index.d.ts +1 -1
- package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
- package/components/hook-form/RHFUpload/RHFUploadImage/classes/index.d.ts +1 -1
- package/components/maps/components/Map/classes/index.d.ts +1 -1
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useRowActionsGetter.js +2 -2
- package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useRowActionsGetter.js +5 -5
- package/components/modal/classes/index.d.ts +2 -2
- package/components/mui_extended/Accordion/classes/index.d.ts +1 -1
- package/components/mui_extended/Avatar/classes/index.d.ts +1 -1
- package/components/mui_extended/Badge/slots/BadgeSlots.d.ts +1 -1
- package/components/mui_extended/Button/classes/index.d.ts +1 -1
- package/components/mui_extended/Button/styles.d.ts +1 -1
- package/components/mui_extended/CheckBox/classes/index.d.ts +1 -1
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +2 -2
- package/components/mui_extended/LoadingButton/classes/index.d.ts +1 -1
- package/components/mui_extended/MenuActions/MenuActions.d.ts +8 -1
- package/components/mui_extended/MenuActions/MenuActions.js +55 -77
- package/components/mui_extended/MenuActions/MenuActions.styles.d.ts +4 -0
- package/components/mui_extended/MenuActions/MenuActions.styles.js +11 -38
- package/components/mui_extended/MenuActions/constants.d.ts +17 -0
- package/components/mui_extended/MenuActions/constants.js +6 -2
- package/components/mui_extended/MenuActions/dictionary.d.ts +15 -0
- package/components/mui_extended/MenuActions/slots/MenuActionsEnum.d.ts +8 -5
- package/components/mui_extended/MenuActions/slots/MenuActionsEnum.js +1 -4
- package/components/mui_extended/MenuActions/slots/MenuActionsSlots.d.ts +29 -16
- package/components/mui_extended/MenuActions/slots/MenuActionsSlots.js +16 -33
- package/components/mui_extended/MenuActions/stories/MenuActions.default.stories.d.ts +25 -0
- package/components/mui_extended/MenuActions/stories/MenuActions.othersProps.stories.d.ts +13 -0
- package/components/mui_extended/MenuActions/types.d.ts +80 -18
- package/components/mui_extended/MenuItem/MenuItem.js +66 -0
- package/components/mui_extended/MenuItem/MenuItem.styles.js +111 -0
- package/components/mui_extended/MenuItem/constants.js +4 -0
- package/components/mui_extended/MenuItem/index.js +1 -0
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +9 -0
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +24 -0
- package/components/mui_extended/MenuItem/types.js +1 -0
- package/components/mui_extended/Pager/classes/index.d.ts +2 -2
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +1 -1
- package/components/mui_extended/Skeleton/Slots/skeletonSlots.d.ts +1 -1
- package/components/mui_extended/Tab/classes/index.d.ts +1 -1
- package/components/mui_extended/Tabs/styles.d.ts +1 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +2 -2
- package/components/mui_extended/Typography/slots/typographySlots.d.ts +1 -1
- package/package.json +1 -1
- package/test/mocks.d.ts +7 -7
- package/utils/index.d.ts +1 -1
- package/components/mui_extended/MenuActions/MenuActions.stories.d.ts +0 -25
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
var MenuActionsSlots = /* @__PURE__ */ ((MenuActionsSlots2) => {
|
|
2
2
|
MenuActionsSlots2["root"] = "root";
|
|
3
|
-
MenuActionsSlots2["
|
|
3
|
+
MenuActionsSlots2["popover"] = "popover";
|
|
4
4
|
MenuActionsSlots2["iconButton"] = "iconButton";
|
|
5
5
|
MenuActionsSlots2["menuItem"] = "menuItem";
|
|
6
|
-
MenuActionsSlots2["menuItemIcon"] = "menuItemIcon";
|
|
7
|
-
MenuActionsSlots2["menuItemLabel"] = "menuItemLabel";
|
|
8
|
-
MenuActionsSlots2["labelEmpty"] = "labelEmpty";
|
|
9
6
|
return MenuActionsSlots2;
|
|
10
7
|
})(MenuActionsSlots || {});
|
|
11
8
|
export {
|
|
@@ -1,23 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Componente raíz estilizado para `MenuActions`, basado en el componente `Popover`.
|
|
3
|
+
*
|
|
4
|
+
* Utiliza el sistema de estilos de Material-UI para aplicar estilos personalizados al contenedor principal (`Popover`)
|
|
5
|
+
* de `MenuActions`. Si no se proporcionan estilos, se utiliza un objeto vacío como valor predeterminado.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
|
|
2
8
|
ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
|
|
3
|
-
},
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
10
|
+
/**
|
|
11
|
+
* Componente estilizado para `MenuActions`, basado en el componente `Popover`.
|
|
12
|
+
*
|
|
13
|
+
* Utiliza el sistema de estilos de Material-UI para aplicar estilos personalizados al contenedor principal (`Popover`)
|
|
14
|
+
* de `MenuActions`. Si no se proporcionan estilos, se utiliza un objeto vacío como valor predeterminado.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PopoverStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Popover/types').PopoverProps, keyof import('../../Popover/types').PopoverProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
|
|
8
17
|
ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
|
|
9
18
|
}, {}, {}>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Componente estilizado para el botón de icono dentro de `MenuActions`, basado en el componente `IconButton`.
|
|
21
|
+
*
|
|
22
|
+
* Utiliza el sistema de estilos de Material-UI para aplicar estilos personalizados al botón de icono.
|
|
23
|
+
* Si no se proporcionan estilos, se utiliza un objeto vacío como valor predeterminado.
|
|
24
|
+
*/
|
|
25
|
+
export declare const IconButtonStyled: import('@emotion/styled').StyledComponent<Pick<import('../../IconButton/types').IconButtonProps, keyof import('../../IconButton/types').IconButtonProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
|
|
13
26
|
ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
|
|
14
27
|
}, {}, {}>;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Componente estilizado para el ítem del menú dentro de `MenuActions`, basado en el componente `MenuItem`.
|
|
30
|
+
*
|
|
31
|
+
* Utiliza el sistema de estilos de Material-UI para aplicar estilos personalizados al ítem del menú.
|
|
32
|
+
* Si no se proporcionan estilos, se utiliza un objeto vacío como valor predeterminado.
|
|
33
|
+
*/
|
|
34
|
+
export declare const MenuItemStyled: import('@emotion/styled').StyledComponent<Pick<import('../../MenuItem').MenuItemProps, keyof import('../../MenuItem').MenuItemProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
|
|
19
35
|
ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
|
|
20
36
|
}, {}, {}>;
|
|
21
|
-
export declare const LabelEmptyStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
|
|
22
|
-
ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
|
|
23
|
-
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
@@ -1,46 +1,29 @@
|
|
|
1
1
|
import { styled } from "@mui/material/styles";
|
|
2
|
-
import {
|
|
3
|
-
import { M as MENU_ACTIONS_KEY_COMPONENT } from "../constants.js";
|
|
2
|
+
import { c as MENU_ACTIONS_KEY_COMPONENT } from "../constants.js";
|
|
4
3
|
import { m as menuActionsStyles } from "../MenuActions.styles.js";
|
|
5
4
|
import { M as MenuActionsSlots } from "./MenuActionsEnum.js";
|
|
6
|
-
import { I as IconButton } from "../../IconButton/IconButton.js";
|
|
7
5
|
import { P as Popover } from "../../Popover/Popover.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
12
|
-
slot: MenuActionsSlots.iconButton
|
|
13
|
-
})(menuActionsStyles?.iconButton || {});
|
|
14
|
-
const RootStyled = styled(Popover, {
|
|
6
|
+
import { I as IconButton } from "../../IconButton/IconButton.js";
|
|
7
|
+
import { M as MenuItem } from "../../MenuItem/MenuItem.js";
|
|
8
|
+
const RootStyled = styled("div", {
|
|
15
9
|
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
16
10
|
slot: MenuActionsSlots.root
|
|
17
|
-
})(menuActionsStyles?.root
|
|
18
|
-
const
|
|
11
|
+
})(menuActionsStyles?.root);
|
|
12
|
+
const PopoverStyled = styled(Popover, {
|
|
19
13
|
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
20
|
-
slot: MenuActionsSlots.
|
|
21
|
-
})(menuActionsStyles?.
|
|
14
|
+
slot: MenuActionsSlots.popover
|
|
15
|
+
})(menuActionsStyles?.popover);
|
|
16
|
+
const IconButtonStyled = styled(IconButton, {
|
|
17
|
+
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
18
|
+
slot: MenuActionsSlots.iconButton
|
|
19
|
+
})(menuActionsStyles?.iconButton);
|
|
22
20
|
const MenuItemStyled = styled(MenuItem, {
|
|
23
21
|
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
24
22
|
slot: MenuActionsSlots.menuItem
|
|
25
|
-
})(menuActionsStyles?.menuItem
|
|
26
|
-
const LabelMenuItemStyled = styled("div", {
|
|
27
|
-
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
28
|
-
slot: MenuActionsSlots.menuItemLabel
|
|
29
|
-
})(menuActionsStyles?.menuItemLabel || {});
|
|
30
|
-
const IconButtonUrlStyled = styled(Icon, {
|
|
31
|
-
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
32
|
-
slot: MenuActionsSlots.menuItemIcon
|
|
33
|
-
})(menuActionsStyles?.menuItemIcon || {});
|
|
34
|
-
const LabelEmptyStyled = styled("div", {
|
|
35
|
-
name: MENU_ACTIONS_KEY_COMPONENT,
|
|
36
|
-
slot: MenuActionsSlots.labelEmpty
|
|
37
|
-
})(menuActionsStyles?.labelEmpty || {});
|
|
23
|
+
})(menuActionsStyles?.menuItem);
|
|
38
24
|
export {
|
|
39
|
-
|
|
40
|
-
IconButtonUrlStyled as I,
|
|
41
|
-
LabelMenuItemStyled as L,
|
|
25
|
+
IconButtonStyled as I,
|
|
42
26
|
MenuItemStyled as M,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
IconButtonStyled as b
|
|
27
|
+
PopoverStyled as P,
|
|
28
|
+
RootStyled as R
|
|
46
29
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MenuActions } from '../index';
|
|
3
|
+
declare const meta: Meta<typeof MenuActions>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MenuActions>;
|
|
6
|
+
/**
|
|
7
|
+
* Componente base de `MenuActions`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Base: Story;
|
|
10
|
+
/**
|
|
11
|
+
* Componente `MenuActions` con sizes de small.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SmallSizes: Story;
|
|
14
|
+
/**
|
|
15
|
+
* Componente `MenuActions` con sizes de medium.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MediumSizes: Story;
|
|
18
|
+
/**
|
|
19
|
+
* Estado vacío del componente `MenuActions`.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Empty: Story;
|
|
22
|
+
/**
|
|
23
|
+
* `MenuActions` en modo esqueleto (skeleton).
|
|
24
|
+
*/
|
|
25
|
+
export declare const WithSkeleton: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MenuActions } from '../index';
|
|
3
|
+
declare const meta: Meta<typeof MenuActions>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof MenuActions>;
|
|
6
|
+
/**
|
|
7
|
+
* Componente base de `MenuActions`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Base: Story;
|
|
10
|
+
/**
|
|
11
|
+
* `MenuActions` con un elemento adicional al final de la lista (`endListElement`).
|
|
12
|
+
*/
|
|
13
|
+
export declare const WithEndListElement: Story;
|
|
@@ -1,49 +1,111 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { Sizes } from '@m4l/styles';
|
|
2
3
|
import { ComponentNameToClassKey, SxProps } from '@mui/material';
|
|
3
4
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
4
5
|
import { Theme } from '@mui/material/styles';
|
|
5
6
|
import { PopoverProps } from '../Popover/types';
|
|
7
|
+
import { MenuItemProps } from '../MenuItem';
|
|
6
8
|
import { MenuActionsSlots } from './slots';
|
|
7
9
|
import { MENU_ACTIONS_KEY_COMPONENT } from './constants';
|
|
10
|
+
/**
|
|
11
|
+
* Propiedades para describir una acción de un componente.
|
|
12
|
+
* [description] - Descripción opcional de la acción.
|
|
13
|
+
* onClick - Función a ejecutar al hacer clic en la acción.
|
|
14
|
+
*/
|
|
8
15
|
export interface ComponentActionProps {
|
|
9
16
|
description?: string;
|
|
10
17
|
onClick: (props?: any) => void;
|
|
11
18
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
19
|
+
/**
|
|
20
|
+
* Define una acción del menú, con propiedades heredadas de `MenuItemProps`.
|
|
21
|
+
* [onClick] - Función opcional a ejecutar al hacer clic en la acción del menú.
|
|
22
|
+
* [error] - Indicador de error en la acción del menú.
|
|
23
|
+
*/
|
|
24
|
+
export interface MenuAction extends Pick<MenuItemProps, 'icon' | 'label' | 'selected' | 'componentPaletteColor' | 'color' | 'disabled'> {
|
|
25
|
+
onClick?: (arg?: any) => void;
|
|
26
|
+
error?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Propiedades del componente `MenuActions`.
|
|
30
|
+
*/
|
|
25
31
|
export interface MenuActionsProps extends Omit<PopoverProps, 'open'> {
|
|
32
|
+
/**
|
|
33
|
+
* Tamaño opcional del menú (pequeño o mediano).
|
|
34
|
+
*/
|
|
35
|
+
sizes?: Extract<Sizes, 'small' | 'medium'>;
|
|
36
|
+
/**
|
|
37
|
+
* Clase personalizada para el botón del ícono.
|
|
38
|
+
*/
|
|
26
39
|
iconButtonClassName?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Objeto personalizado a pasar al componente.
|
|
42
|
+
*/
|
|
27
43
|
objItem?: any;
|
|
44
|
+
/**
|
|
45
|
+
* URL del ícono.
|
|
46
|
+
*/
|
|
28
47
|
urlIcon?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Acciones del menú, puede ser un array o una función que genere acciones.
|
|
50
|
+
*/
|
|
29
51
|
menuActions: MenuAction[] | ((row: any) => MenuAction[]);
|
|
52
|
+
/**
|
|
53
|
+
* Texto del tooltip opcional.
|
|
54
|
+
*/
|
|
30
55
|
toolTip?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Margen superior del menú.
|
|
58
|
+
*/
|
|
31
59
|
marginTop?: number | string;
|
|
60
|
+
/**
|
|
61
|
+
* Margen inferior del menú.
|
|
62
|
+
*/
|
|
32
63
|
marginBottom?: number | string;
|
|
64
|
+
/**
|
|
65
|
+
* Margen derecho del menú.
|
|
66
|
+
*/
|
|
33
67
|
marginRight?: number | string;
|
|
68
|
+
/**
|
|
69
|
+
* Margen izquierdo del menú.
|
|
70
|
+
*/
|
|
34
71
|
marginLeft?: number | string;
|
|
72
|
+
/**
|
|
73
|
+
* Ancho del menú.
|
|
74
|
+
*/
|
|
35
75
|
width?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Elemento opcional que se renderiza al final de la lista del menú.
|
|
78
|
+
*/
|
|
36
79
|
endListElement?: ReactElement;
|
|
80
|
+
/**
|
|
81
|
+
* Estilos personalizados para las acciones del menú.
|
|
82
|
+
*/
|
|
37
83
|
menuActionSx?: SxProps<Theme> | Partial<OverridesStyleRules<string, ComponentNameToClassKey, Theme>>;
|
|
38
|
-
|
|
84
|
+
/**
|
|
85
|
+
* Contenido del `Badge` si está presente.
|
|
86
|
+
*/
|
|
39
87
|
badgeContent?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Elemento externo para abrir el menú.
|
|
90
|
+
*/
|
|
40
91
|
externalOpen?: HTMLDivElement | null;
|
|
92
|
+
/**
|
|
93
|
+
* Función externa para cerrar el menú.
|
|
94
|
+
*/
|
|
41
95
|
externalClose?: (element: null | HTMLDivElement) => void;
|
|
42
96
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Estado del propietario para `MenuActions`.
|
|
99
|
+
* iconSize - Tamaño del ícono que se utilizará en el menú.
|
|
100
|
+
*/
|
|
101
|
+
export interface MenuActionsOwnerState {
|
|
102
|
+
iconSize: Sizes;
|
|
47
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Tipo de slots disponibles para `MenuActions`.
|
|
106
|
+
*/
|
|
48
107
|
export type MenuActionsSlotsType = keyof typeof MenuActionsSlots;
|
|
108
|
+
/**
|
|
109
|
+
* Estilos para `MenuActions`.
|
|
110
|
+
*/
|
|
49
111
|
export type MenuActionsStyles = Partial<OverridesStyleRules<MenuActionsSlots, typeof MENU_ACTIONS_KEY_COMPONENT, Theme> | undefined> | undefined;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { useTheme } from "@mui/material";
|
|
4
|
+
import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
|
|
5
|
+
import { S as SkeletonMenuItem, M as MenuItemRoot, a as MenuItemIcon } from "./slots/MenuItemSlots.js";
|
|
6
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
+
import { T as Typography } from "../Typography/Typography.js";
|
|
8
|
+
const MenuItem = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
key,
|
|
11
|
+
value,
|
|
12
|
+
icon,
|
|
13
|
+
label,
|
|
14
|
+
disabled,
|
|
15
|
+
selected,
|
|
16
|
+
size = "medium",
|
|
17
|
+
color = "primary",
|
|
18
|
+
...other
|
|
19
|
+
} = props;
|
|
20
|
+
const { currentSize } = useComponentSize(size);
|
|
21
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
22
|
+
const isSkeleton = useModuleSkeleton();
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
const paletteColor = getPropertyByString(
|
|
25
|
+
theme.vars.palette,
|
|
26
|
+
disabled ? "default" : color,
|
|
27
|
+
theme.vars.palette.default
|
|
28
|
+
);
|
|
29
|
+
const ownerState = {
|
|
30
|
+
size: adjustedSize,
|
|
31
|
+
disabled,
|
|
32
|
+
selected,
|
|
33
|
+
paletteColor,
|
|
34
|
+
componentPaletteColor: color
|
|
35
|
+
};
|
|
36
|
+
if (isSkeleton) {
|
|
37
|
+
return /* @__PURE__ */ jsx(SkeletonMenuItem, { ownerState: { ...ownerState } });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ createElement(
|
|
40
|
+
MenuItemRoot,
|
|
41
|
+
{
|
|
42
|
+
...other,
|
|
43
|
+
key,
|
|
44
|
+
value,
|
|
45
|
+
ownerState: { ...ownerState },
|
|
46
|
+
disabled,
|
|
47
|
+
className: "M4LMenuItemRoot"
|
|
48
|
+
},
|
|
49
|
+
!icon ? /* @__PURE__ */ jsx(Typography, { variant: "body", size: adjustedSize, children: label }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
MenuItemIcon,
|
|
52
|
+
{
|
|
53
|
+
ownerState: { ...ownerState },
|
|
54
|
+
src: icon,
|
|
55
|
+
size: adjustedSize,
|
|
56
|
+
disabled,
|
|
57
|
+
className: "M4LMenuItemIcon"
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: label })
|
|
61
|
+
] })
|
|
62
|
+
) });
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
MenuItem as M
|
|
66
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const menuItemStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilos para el contenedor de los items del menú
|
|
4
|
+
* @author Bruce Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-22 10:38:00 - automatic
|
|
6
|
+
* @updatedAt 2024-10-22 20:03:58 - automatic
|
|
7
|
+
* @updatedUser Bruce Escobar - automatic
|
|
8
|
+
*/
|
|
9
|
+
menuItemRoot: ({ theme, ownerState }) => ({
|
|
10
|
+
width: "100%",
|
|
11
|
+
paddingRight: theme.vars.size.baseSpacings.sp3,
|
|
12
|
+
paddingLeft: theme.vars.size.baseSpacings.sp1,
|
|
13
|
+
...ownerState.selected && {
|
|
14
|
+
borderLeft: theme.vars.size.borderStroke.container,
|
|
15
|
+
borderRadius: theme.vars.size.borderRadius.r0,
|
|
16
|
+
borderColor: ownerState.paletteColor?.main
|
|
17
|
+
},
|
|
18
|
+
// Estilos específicos para el tamaño small
|
|
19
|
+
...ownerState.size === "small" && {
|
|
20
|
+
...theme.generalSettings.isMobile ? {
|
|
21
|
+
height: theme.vars.size.mobile.small.action,
|
|
22
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
23
|
+
} : {
|
|
24
|
+
height: theme.vars.size.desktop.small.action,
|
|
25
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// Estilos específicos para el tamaño medium
|
|
29
|
+
...ownerState.size === "medium" && {
|
|
30
|
+
...theme.generalSettings.isMobile ? {
|
|
31
|
+
height: theme.vars.size.mobile.medium.action,
|
|
32
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
33
|
+
} : {
|
|
34
|
+
height: theme.vars.size.desktop.medium.action,
|
|
35
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
'& .M4LMenuItemIcon [class*="-M4LIcon-icon"]': {
|
|
39
|
+
...ownerState.selected && {
|
|
40
|
+
backgroundColor: ownerState.paletteColor?.main
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"&.M4LMenuItemRoot .M4LTypography-root .MuiTypography-body": {
|
|
44
|
+
paddingRight: theme.vars.size.baseSpacings.sp1,
|
|
45
|
+
paddingLeft: theme.vars.size.baseSpacings.sp2,
|
|
46
|
+
...ownerState.selected && {
|
|
47
|
+
color: ownerState.paletteColor?.main
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"&:hover.M4LMenuItemRoot": {
|
|
51
|
+
background: ownerState.selected ? ownerState.paletteColor?.opacity : theme.vars.palette.background.hover
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
menuItemIcon: {},
|
|
55
|
+
/**
|
|
56
|
+
* Estilos para el contenedor de los items del menú en skeleton
|
|
57
|
+
* @author Bruce Escobar - automatic
|
|
58
|
+
* @createdAt 2024-10-22 10:38:00 - automatic
|
|
59
|
+
* @updatedAt 2024-10-22 20:03:58 - automatic
|
|
60
|
+
* @updatedUser Bruce Escobar - automatic
|
|
61
|
+
*/
|
|
62
|
+
skeletonMenuItem: ({ theme, ownerState }) => ({
|
|
63
|
+
width: "100%",
|
|
64
|
+
padding: theme.vars.size.baseSpacings.sp2,
|
|
65
|
+
borderRadius: theme.vars.size.borderRadius.r0,
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
background: theme.vars.palette.skeleton.transition,
|
|
69
|
+
// Estilos específicos para el tamaño small
|
|
70
|
+
...ownerState.size === "small" && {
|
|
71
|
+
...theme.generalSettings.isMobile ? {
|
|
72
|
+
height: theme.vars.size.mobile.small.action,
|
|
73
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
74
|
+
} : {
|
|
75
|
+
height: theme.vars.size.desktop.small.action,
|
|
76
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
77
|
+
},
|
|
78
|
+
[theme.breakpoints.up("sm")]: {
|
|
79
|
+
...theme.generalSettings.isMobile ? {
|
|
80
|
+
height: theme.vars.size.mobile.small.action,
|
|
81
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
82
|
+
} : {
|
|
83
|
+
height: theme.vars.size.desktop.small.action,
|
|
84
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
// Estilos específicos para el tamaño medium
|
|
89
|
+
...ownerState.size === "medium" && {
|
|
90
|
+
...theme.generalSettings.isMobile ? {
|
|
91
|
+
height: theme.vars.size.mobile.medium.action,
|
|
92
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
93
|
+
} : {
|
|
94
|
+
height: theme.vars.size.desktop.medium.action,
|
|
95
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
96
|
+
},
|
|
97
|
+
[theme.breakpoints.up("md")]: {
|
|
98
|
+
...theme.generalSettings.isMobile ? {
|
|
99
|
+
height: theme.vars.size.mobile.small.action,
|
|
100
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
101
|
+
} : {
|
|
102
|
+
height: theme.vars.size.desktop.small.action,
|
|
103
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
menuItemStyles as m
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var MenuItemSlots = /* @__PURE__ */ ((MenuItemSlots2) => {
|
|
2
|
+
MenuItemSlots2["menuItemRoot"] = "menuItemRoot";
|
|
3
|
+
MenuItemSlots2["menuItemIcon"] = "menuItemIcon";
|
|
4
|
+
MenuItemSlots2["skeletonMenuItem"] = "skeletonMenuItem";
|
|
5
|
+
return MenuItemSlots2;
|
|
6
|
+
})(MenuItemSlots || {});
|
|
7
|
+
export {
|
|
8
|
+
MenuItemSlots as M
|
|
9
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const MenuItemRoot: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').MenuItemOwnProps & Omit<import('@mui/material').ButtonBaseOwnProps, "classes"> & import('@mui/material/OverridableComponent').CommonProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
2
2
|
ref?: ((instance: HTMLLIElement | 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<HTMLLIElement> | null | undefined;
|
|
3
|
-
}, "children" | "
|
|
3
|
+
}, "children" | "action" | "divider" | "style" | "dense" | "disabled" | "sx" | "classes" | "autoFocus" | "className" | "tabIndex" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "selected" | "disableGutters">, "children" | "value" | "ref" | "title" | "id" | "action" | "divider" | "hidden" | "color" | "content" | "style" | "dense" | "disabled" | "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" | "key" | "selected" | "disableGutters"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').MenuItemOwnerState> & Record<string, unknown> & {
|
|
4
4
|
ownerState: Partial<import('..').MenuItemOwnerState> & Record<string, unknown>;
|
|
5
5
|
}, {}, {}>;
|
|
6
6
|
export declare const MenuItemIcon: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('..').MenuItemOwnerState> & Record<string, unknown> & {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { MenuItem } from "@mui/material";
|
|
3
|
+
import { M as MENUITEM_KEY_COMPONENT } from "../constants.js";
|
|
4
|
+
import { m as menuItemStyles } from "../MenuItem.styles.js";
|
|
5
|
+
import { M as MenuItemSlots } from "./MenuItemEnum.js";
|
|
6
|
+
import { S as Skeleton } from "../../Skeleton/Skeleton.js";
|
|
7
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
8
|
+
const MenuItemRoot = styled(MenuItem, {
|
|
9
|
+
name: MENUITEM_KEY_COMPONENT,
|
|
10
|
+
slot: MenuItemSlots.menuItemRoot
|
|
11
|
+
})(menuItemStyles?.menuItemRoot);
|
|
12
|
+
const MenuItemIcon = styled(Icon, {
|
|
13
|
+
name: MENUITEM_KEY_COMPONENT,
|
|
14
|
+
slot: MenuItemSlots.menuItemIcon
|
|
15
|
+
})(menuItemStyles?.menuItemIcon);
|
|
16
|
+
const SkeletonMenuItem = styled(Skeleton, {
|
|
17
|
+
name: MENUITEM_KEY_COMPONENT,
|
|
18
|
+
slot: MenuItemSlots.skeletonMenuItem
|
|
19
|
+
})(menuItemStyles?.skeletonMenuItem);
|
|
20
|
+
export {
|
|
21
|
+
MenuItemRoot as M,
|
|
22
|
+
SkeletonMenuItem as S,
|
|
23
|
+
MenuItemIcon as a
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -5,8 +5,9 @@ export declare function getPagerUtilityClass(slot: string): string;
|
|
|
5
5
|
* TODO: Documentar
|
|
6
6
|
*/
|
|
7
7
|
export declare const pagerUtilityClasses: () => {
|
|
8
|
-
root: string;
|
|
9
8
|
select: string;
|
|
9
|
+
root: string;
|
|
10
|
+
skeletonRoot: string;
|
|
10
11
|
labelRowsPerPageContainer: string;
|
|
11
12
|
labelRowsPager: string;
|
|
12
13
|
selectMenuPopover: string;
|
|
@@ -18,7 +19,6 @@ export declare const pagerUtilityClasses: () => {
|
|
|
18
19
|
actionIconPrevious: string;
|
|
19
20
|
actionIconNextPage: string;
|
|
20
21
|
actionIconLastPage: string;
|
|
21
|
-
skeletonRoot: string;
|
|
22
22
|
skeletonRowsPerPage: string;
|
|
23
23
|
skeletonButtonContainer: string;
|
|
24
24
|
skeletonIconButton: string;
|