@m4l/components 8.2.0-beta.devDaniel.MenuActionsBug → 8.2.0-beta.devDaniel.RHFInputNumberSpinner

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 (52) hide show
  1. package/@types/export.d.ts +3 -0
  2. package/@types/types.d.ts +8 -0
  3. package/components/AccountPopover/classes/index.d.ts +1 -1
  4. package/components/DataGrid/subcomponents/Actions/subcomponents/Density/index.js +3 -3
  5. package/components/DataGrid/subcomponents/Actions/subcomponents/MobileMenuActions/index.js +10 -10
  6. package/components/SideBar/classes/index.d.ts +1 -1
  7. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/subcomponents/ChipActionsMobile/index.js +2 -2
  8. package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
  9. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/helper.js +3 -3
  10. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/MainActions/index.js +3 -3
  11. package/components/extended/react-resizable/Resizable/slots/ResizableSlots.d.ts +1 -1
  12. package/components/extended/react-resizable/ResizableBox/slots/ResizableBoxSlots.d.ts +1 -1
  13. package/components/hook-form/RHFAutocomplete/subcomponents/ComponentTypeImage/index.js +1 -1
  14. package/components/hook-form/RHFInputNumberSpinner/RHFInputNumberSpinner.d.ts +5 -0
  15. package/components/hook-form/RHFInputNumberSpinner/RHFInputNumberSpinner.styles.d.ts +8 -0
  16. package/components/hook-form/RHFInputNumberSpinner/constants.d.ts +4 -0
  17. package/components/hook-form/RHFInputNumberSpinner/slots/RHFInputNumberSpinnerEnum.d.ts +10 -0
  18. package/components/hook-form/RHFInputNumberSpinner/slots/RHFInputNumberSpinnerSlots.d.ts +28 -0
  19. package/components/hook-form/RHFInputNumberSpinner/stories/RHFInputNumberSpinner.defaultProps.stories.d.ts +26 -0
  20. package/components/hook-form/RHFInputNumberSpinner/stories/RHFInputNumberSpinner.error.stories.d.ts +13 -0
  21. package/components/hook-form/RHFInputNumberSpinner/stories/RHFInputNumberSpinner.variants.stories.d.ts +23 -0
  22. package/components/hook-form/RHFInputNumberSpinner/types.d.ts +71 -0
  23. package/components/hook-form/RHFTextField/slots/RHFTextFieldSlots.d.ts +1 -1
  24. package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useRowActionsGetter.js +2 -2
  25. package/components/maps/components/MapGpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useRowActionsGetter.js +5 -5
  26. package/components/modal/classes/index.d.ts +2 -2
  27. package/components/mui_extended/MenuActions/MenuActions.d.ts +1 -8
  28. package/components/mui_extended/MenuActions/MenuActions.js +77 -55
  29. package/components/mui_extended/MenuActions/MenuActions.stories.d.ts +25 -0
  30. package/components/mui_extended/MenuActions/MenuActions.styles.d.ts +0 -4
  31. package/components/mui_extended/MenuActions/MenuActions.styles.js +38 -11
  32. package/components/mui_extended/MenuActions/constants.d.ts +0 -17
  33. package/components/mui_extended/MenuActions/constants.js +2 -6
  34. package/components/mui_extended/MenuActions/dictionary.d.ts +0 -15
  35. package/components/mui_extended/MenuActions/slots/MenuActionsEnum.d.ts +5 -8
  36. package/components/mui_extended/MenuActions/slots/MenuActionsEnum.js +4 -1
  37. package/components/mui_extended/MenuActions/slots/MenuActionsSlots.d.ts +16 -29
  38. package/components/mui_extended/MenuActions/slots/MenuActionsSlots.js +33 -16
  39. package/components/mui_extended/MenuActions/types.d.ts +18 -80
  40. package/components/mui_extended/Pager/classes/index.d.ts +1 -1
  41. package/components/mui_extended/Select/slots/SelectSlots.d.ts +1 -1
  42. package/components/mui_extended/TextField/slots/TextFieldSlots.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/components/mui_extended/MenuActions/stories/MenuActions.default.stories.d.ts +0 -25
  45. package/components/mui_extended/MenuActions/stories/MenuActions.othersProps.stories.d.ts +0 -13
  46. package/components/mui_extended/MenuItem/MenuItem.js +0 -66
  47. package/components/mui_extended/MenuItem/MenuItem.styles.js +0 -111
  48. package/components/mui_extended/MenuItem/constants.js +0 -4
  49. package/components/mui_extended/MenuItem/index.js +0 -1
  50. package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +0 -9
  51. package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +0 -24
  52. package/components/mui_extended/MenuItem/types.js +0 -1
@@ -1,11 +1,10 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import React, { useRef, useState, useMemo } from "react";
3
- import { useEnvironment, useModuleDictionary } from "@m4l/core";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useMemo } from "react";
4
3
  import { useTheme } from "@mui/material/styles";
5
- import { I as ICON_PATH, a as ICONS, M as MENU_ACTIONS_, b as MENU_ACTIONS_EMPTY } from "./constants.js";
4
+ import { useEnvironment, useModuleDictionary } from "@m4l/core";
5
+ import { I as ICON_PATH, a as ICONS } from "./constants.js";
6
6
  import { g as getMenuActionsDictionary, D as DICTIONARY } from "./dictionary.js";
7
- import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
8
- import { R as RootStyled, I as IconButtonStyled, P as PopoverStyled, M as MenuItemStyled } from "./slots/MenuActionsSlots.js";
7
+ import { R as RootStyled, M as MenuItemStyled, I as IconButtonUrlStyled, L as LabelMenuItemStyled, a as LabelEmptyStyled, B as BadgeStyled, b as IconButtonStyled } from "./slots/MenuActionsSlots.js";
9
8
  function MenuActions(props) {
10
9
  const {
11
10
  menuActions,
@@ -15,40 +14,48 @@ function MenuActions(props) {
15
14
  objItem = {},
16
15
  urlIcon,
17
16
  toolTip = "",
18
- marginTop,
17
+ marginTop = -1,
19
18
  marginBottom,
20
19
  marginLeft,
21
20
  marginRight,
22
21
  width = 200,
22
+ withBadge = false,
23
23
  badgeContent,
24
24
  arrowType = "right-top",
25
25
  externalOpen = null,
26
26
  externalClose,
27
- sizes = "medium",
28
27
  ...other
29
28
  } = props;
30
- const { currentSize } = useComponentSize(sizes);
31
- const rootRef = useRef(null);
32
- const OwnerState = {
33
- iconSize: currentSize
34
- };
35
29
  const { host_static_assets, environment_assets } = useEnvironment();
36
30
  const { getLabel } = useModuleDictionary();
37
- const [open, setOpen] = useState(false);
38
- const handleOpenClose = () => {
39
- setOpen(() => !open);
31
+ const [open, setOpen] = useState(null);
32
+ const handleOpen = (event) => {
33
+ setOpen(event.currentTarget);
40
34
  };
41
35
  const theme = useTheme();
36
+ useEffect(() => {
37
+ let mounted = true;
38
+ if (mounted) {
39
+ setOpen(externalOpen);
40
+ }
41
+ return function cleanUp() {
42
+ mounted = false;
43
+ };
44
+ }, [externalOpen]);
42
45
  const urlFinalIcon = useMemo(() => {
43
46
  if (urlIcon) {
44
47
  return urlIcon;
45
48
  }
46
49
  return `${host_static_assets}/${environment_assets}/${ICON_PATH}/${ICONS.MENU}`;
47
50
  }, [urlIcon, host_static_assets, environment_assets]);
48
- const handleClick = (e, menuAction) => {
51
+ const handleClose = (e) => {
52
+ e.stopPropagation();
53
+ setOpen(null);
54
+ externalClose && externalClose(null);
55
+ };
56
+ const handleClick = (e, _menuAction) => {
49
57
  e.stopPropagation();
50
- menuAction.onClick && menuAction.onClick(e);
51
- setOpen(false);
58
+ setOpen(null);
52
59
  };
53
60
  const finalActions = useMemo(() => {
54
61
  let ret;
@@ -59,26 +66,35 @@ function MenuActions(props) {
59
66
  }
60
67
  return ret;
61
68
  }, [menuActions, objItem]);
62
- return /* @__PURE__ */ jsxs(RootStyled, { ownerState: { OwnerState }, ref: rootRef, children: [
63
- /* @__PURE__ */ jsx(
64
- IconButtonStyled,
65
- {
66
- ownerState: { OwnerState },
67
- size: sizes,
68
- src: urlFinalIcon,
69
- onClick: () => handleOpenClose(),
70
- tooltip: toolTip,
71
- className: iconButtonClassName
72
- }
73
- ),
69
+ const IconButtonElement = /* @__PURE__ */ jsx(Fragment, { children: withBadge ? /* @__PURE__ */ jsx(BadgeStyled, { ownerState: {}, badgeContent, children: /* @__PURE__ */ jsx(
70
+ IconButtonStyled,
71
+ {
72
+ ownerState: {},
73
+ src: urlFinalIcon,
74
+ onClick: handleOpen,
75
+ tooltip: toolTip,
76
+ className: iconButtonClassName
77
+ }
78
+ ) }) : /* @__PURE__ */ jsx(
79
+ IconButtonStyled,
80
+ {
81
+ ownerState: {},
82
+ src: urlFinalIcon,
83
+ onClick: handleOpen,
84
+ tooltip: toolTip,
85
+ className: iconButtonClassName
86
+ }
87
+ ) });
88
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
89
+ IconButtonElement,
74
90
  /* @__PURE__ */ jsxs(
75
- PopoverStyled,
91
+ RootStyled,
76
92
  {
77
- ownerState: { OwnerState },
93
+ ownerState: {},
78
94
  id: "Popover",
79
- open,
80
- anchorEl: externalOpen ?? rootRef.current,
81
- onClose: () => handleOpenClose(),
95
+ open: Boolean(open),
96
+ anchorEl: open,
97
+ onClose: handleClose,
82
98
  arrowType,
83
99
  sx: {
84
100
  marginTop,
@@ -86,31 +102,37 @@ function MenuActions(props) {
86
102
  marginLeft,
87
103
  marginRight,
88
104
  width,
105
+ maxWidth: 300,
106
+ "& .MuiMenuItem-root": { px: 1, typography: "body2", borderRadius: 0.75 },
89
107
  ...theme.components?.M4LMenuActions?.styleOverrides || {},
90
108
  ...menuActionSx
91
109
  },
92
110
  ...other,
93
111
  children: [
94
- finalActions.length > 0 ? finalActions.map((menuAction, index) => /* @__PURE__ */ jsx(
95
- MenuItemStyled,
96
- {
97
- ownerState: { OwnerState },
98
- size: sizes,
99
- onClick: (e) => {
100
- handleClick(e, menuAction);
112
+ finalActions.map(
113
+ (menuAction, index) => menuAction.label || menuAction.dictionaryId ? /* @__PURE__ */ jsxs(
114
+ MenuItemStyled,
115
+ {
116
+ dense: true,
117
+ onClick: (e) => {
118
+ handleClick(e);
119
+ },
120
+ sx: { color: menuAction.color ?? "text.main" },
121
+ disabled: menuAction.disabled,
122
+ ownerState: { variant: menuAction.variant, color: menuAction.color },
123
+ children: [
124
+ menuAction.urlIcon ? /* @__PURE__ */ jsx(
125
+ IconButtonUrlStyled,
126
+ {
127
+ ownerState: { variant: menuAction.variant },
128
+ src: menuAction.urlIcon
129
+ }
130
+ ) : null,
131
+ /* @__PURE__ */ jsx(LabelMenuItemStyled, { ownerState: {}, children: menuAction.label || menuAction.dictionaryId && getLabel(menuAction.dictionaryId) })
132
+ ]
101
133
  },
102
- ...menuAction
103
- },
104
- `${MENU_ACTIONS_}${index}`
105
- )) : /* @__PURE__ */ jsx(
106
- MenuItemStyled,
107
- {
108
- ownerState: { OwnerState },
109
- size: sizes,
110
- disabled: true,
111
- label: getLabel(getMenuActionsDictionary(DICTIONARY.no_actions_label))
112
- },
113
- MENU_ACTIONS_EMPTY
134
+ `menu_action_${index}`
135
+ ) : /* @__PURE__ */ jsx(LabelEmptyStyled, { ownerState: {}, children: getLabel(getMenuActionsDictionary(DICTIONARY.no_actions_label)) }, `menu_action_${index}`)
114
136
  ),
115
137
  endListElement ? endListElement : null
116
138
  ]
@@ -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
+ * Base MenuActions component
8
+ */
9
+ export declare const Base: Story;
10
+ /**
11
+ * MenuActions in skeleton mode
12
+ */
13
+ export declare const WithSkeleton: Story;
14
+ /**
15
+ * MenuActions with Badge content
16
+ */
17
+ export declare const WithBadge: Story;
18
+ /**
19
+ * MenuActions with end ListElement
20
+ */
21
+ export declare const WithEndListElement: Story;
22
+ /**
23
+ * MenuActions empty state
24
+ */
25
+ export declare const Empty: Story;
@@ -1,6 +1,2 @@
1
1
  import { MenuActionsStyles } from '../MenuActions/types';
2
- /**
3
- * `menuActionsStyles`:
4
- * Objeto que define los estilos personalizados para los diferentes componentes dentro de `MenuActions`.
5
- */
6
2
  export declare const menuActionsStyles: MenuActionsStyles;
@@ -1,22 +1,49 @@
1
+ const CONTAINER_QUERY_NAME = "menuActions";
1
2
  const menuActionsStyles = {
2
3
  /**
3
- * Estilos para el contenedor raíz del menú.
4
+ * TODO: Documentar
4
5
  */
5
- root: () => ({
6
- width: "fit-content"
6
+ root: ({ theme }) => ({
7
+ containerName: CONTAINER_QUERY_NAME,
8
+ "& .MuiPaper-root": {
9
+ display: "flex",
10
+ flexDirection: "column",
11
+ background: theme.palette.background.default,
12
+ gap: "8px",
13
+ maxWidth: 300
14
+ }
7
15
  }),
8
- /***
9
- * Estilos para el Popover
10
- */
11
- popover: {},
16
+ badge: {},
12
17
  /**
13
- * Estilos para el `IconButton` utilizado para abrir el menú.
18
+ * TODO: Documentar
14
19
  */
15
- iconButton: {},
20
+ menuItem: ({ theme, ownerState }) => ({
21
+ display: "flex",
22
+ justifyContent: "center",
23
+ minHeight: "24px",
24
+ minWidth: "24px",
25
+ padding: "0",
26
+ gap: "0px",
27
+ ...ownerState.variant === "delete" ? {
28
+ color: theme.palette.error.main
29
+ } : {}
30
+ }),
31
+ menuItemLabel: {},
16
32
  /**
17
- * Estilos para los `menuItems` del menú.
33
+ * TODO: Documentar
18
34
  */
19
- menuItem: {}
35
+ menuItemIcon: ({ theme, ownerState }) => ({
36
+ "&.M4LIcon-root": {
37
+ minHeight: "24px",
38
+ minWidth: "24px",
39
+ "& > .M4LIcon-icon": {
40
+ backgroundColor: ownerState.variant === "delete" ? theme.palette.error.main : ""
41
+ }
42
+ }
43
+ }),
44
+ labelEmpty: () => ({
45
+ zIndex: 1
46
+ })
20
47
  };
21
48
  export {
22
49
  menuActionsStyles as m
@@ -1,22 +1,5 @@
1
- /**
2
- * Ruta donde se encuentran los íconos en los assets.
3
- */
4
1
  export declare const ICON_PATH = "frontend/components/menu_actions/assets/icons";
5
- /**
6
- * Íconos utilizados en el menú por defecto.
7
- */
8
2
  export declare const ICONS: {
9
3
  MENU: string;
10
4
  };
11
- /**
12
- * Nombre clave del componente `MenuActions` dentro de la aplicación.
13
- */
14
5
  export declare const MENU_ACTIONS_KEY_COMPONENT = "M4LMenuActions";
15
- /**
16
- * Constante que define la clave cuando un ítem del menú está vacío.
17
- */
18
- export declare const MENU_ACTIONS_EMPTY = "menu_action_empty";
19
- /**
20
- * Prefijo de la clave que se utiliza cuando un ítem del menú está cargando en React.
21
- */
22
- export declare const MENU_ACTIONS_ = "menu_action_";
@@ -3,12 +3,8 @@ const ICONS = {
3
3
  MENU: "menu.svg"
4
4
  };
5
5
  const MENU_ACTIONS_KEY_COMPONENT = "M4LMenuActions";
6
- const MENU_ACTIONS_EMPTY = "menu_action_empty";
7
- const MENU_ACTIONS_ = "menu_action_";
8
6
  export {
9
7
  ICON_PATH as I,
10
- MENU_ACTIONS_ as M,
11
- ICONS as a,
12
- MENU_ACTIONS_EMPTY as b,
13
- MENU_ACTIONS_KEY_COMPONENT as c
8
+ MENU_ACTIONS_KEY_COMPONENT as M,
9
+ ICONS as a
14
10
  };
@@ -1,22 +1,7 @@
1
- /**
2
- * Identificador clave utilizado para el diccionario de `MenuActions`.
3
- */
4
1
  export declare const MENU_ACTIONS_DICTIONARY_ID = "menu_actions";
5
- /**
6
- * Devuelve un array que contiene el identificador del diccionario de `MenuActions`.
7
- */
8
2
  export declare function getMenuActionsComponentsDictionary(): string[];
9
- /**
10
- * Diccionario de claves para las etiquetas y textos utilizados en el componente `MenuActions`.
11
- */
12
3
  export declare const DICTIONARY: {
13
4
  readonly no_actions_label: "no_actions_label";
14
5
  };
15
- /**
16
- * Tipo que representa las claves del diccionario de `MenuActions`.
17
- */
18
6
  export type TypeDictionary = typeof DICTIONARY;
19
- /**
20
- * Función que obtiene el valor completo de una clave del diccionario de `MenuActions` utilizando su identificador.
21
- */
22
7
  export declare const getMenuActionsDictionary: (key: keyof TypeDictionary) => string;
@@ -1,12 +1,9 @@
1
- /**
2
- * Enum `MenuActionsSlots`
3
- *
4
- * Define los nombres de los slots de estilo para el componente `MenuActions`. Estos slots se utilizan para
5
- * aplicar estilos específicos y crear clases CSS únicas para los distintos elementos del componente.
6
- */
7
1
  export declare enum MenuActionsSlots {
8
2
  root = "root",
9
- popover = "popover",
3
+ badge = "badge",
10
4
  iconButton = "iconButton",
11
- menuItem = "menuItem"
5
+ menuItem = "menuItem",
6
+ menuItemIcon = "menuItemIcon",
7
+ menuItemLabel = "menuItemLabel",
8
+ labelEmpty = "labelEmpty"
12
9
  }
@@ -1,8 +1,11 @@
1
1
  var MenuActionsSlots = /* @__PURE__ */ ((MenuActionsSlots2) => {
2
2
  MenuActionsSlots2["root"] = "root";
3
- MenuActionsSlots2["popover"] = "popover";
3
+ MenuActionsSlots2["badge"] = "badge";
4
4
  MenuActionsSlots2["iconButton"] = "iconButton";
5
5
  MenuActionsSlots2["menuItem"] = "menuItem";
6
+ MenuActionsSlots2["menuItemIcon"] = "menuItemIcon";
7
+ MenuActionsSlots2["menuItemLabel"] = "menuItemLabel";
8
+ MenuActionsSlots2["labelEmpty"] = "labelEmpty";
6
9
  return MenuActionsSlots2;
7
10
  })(MenuActionsSlots || {});
8
11
  export {
@@ -1,36 +1,23 @@
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> & {
1
+ 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').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
8
2
  ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
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> & {
3
+ }, {}, {}>;
4
+ export declare const RootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Popover/types').PopoverProps, keyof import('../../Popover/types').PopoverProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
5
+ ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
6
+ }, {}, {}>;
7
+ export declare const BadgeStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Badge').BadgeProps, keyof import('../../Badge').BadgeProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
17
8
  ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
18
9
  }, {}, {}>;
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> & {
10
+ export declare const MenuItemStyled: 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"> & {
11
+ 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;
12
+ }, "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('../types').MenuActionsOwnerState> & Record<string, unknown> & {
26
13
  ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
27
14
  }, {}, {}>;
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> & {
15
+ export declare const LabelMenuItemStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
16
+ ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
17
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
18
+ export declare const IconButtonUrlStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown> & {
35
19
  ownerState: Partial<import('../types').MenuActionsOwnerState> & Record<string, unknown>;
36
20
  }, {}, {}>;
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,29 +1,46 @@
1
1
  import { styled } from "@mui/material/styles";
2
- import { c as MENU_ACTIONS_KEY_COMPONENT } from "../constants.js";
2
+ import { MenuItem } from "@mui/material";
3
+ import { M as MENU_ACTIONS_KEY_COMPONENT } from "../constants.js";
3
4
  import { m as menuActionsStyles } from "../MenuActions.styles.js";
4
5
  import { M as MenuActionsSlots } from "./MenuActionsEnum.js";
5
- import { P as Popover } from "../../Popover/Popover.js";
6
6
  import { I as IconButton } from "../../IconButton/IconButton.js";
7
- import { M as MenuItem } from "../../MenuItem/MenuItem.js";
8
- const RootStyled = styled("div", {
9
- name: MENU_ACTIONS_KEY_COMPONENT,
10
- slot: MenuActionsSlots.root
11
- })(menuActionsStyles?.root);
12
- const PopoverStyled = styled(Popover, {
13
- name: MENU_ACTIONS_KEY_COMPONENT,
14
- slot: MenuActionsSlots.popover
15
- })(menuActionsStyles?.popover);
7
+ import { P as Popover } from "../../Popover/Popover.js";
8
+ import { B as Badge } from "../../Badge/Badge.js";
9
+ import { I as Icon } from "../../../Icon/Icon.js";
16
10
  const IconButtonStyled = styled(IconButton, {
17
11
  name: MENU_ACTIONS_KEY_COMPONENT,
18
12
  slot: MenuActionsSlots.iconButton
19
- })(menuActionsStyles?.iconButton);
13
+ })(menuActionsStyles?.iconButton || {});
14
+ const RootStyled = styled(Popover, {
15
+ name: MENU_ACTIONS_KEY_COMPONENT,
16
+ slot: MenuActionsSlots.root
17
+ })(menuActionsStyles?.root || {});
18
+ const BadgeStyled = styled(Badge, {
19
+ name: MENU_ACTIONS_KEY_COMPONENT,
20
+ slot: MenuActionsSlots.badge
21
+ })(menuActionsStyles?.badge || {});
20
22
  const MenuItemStyled = styled(MenuItem, {
21
23
  name: MENU_ACTIONS_KEY_COMPONENT,
22
24
  slot: MenuActionsSlots.menuItem
23
- })(menuActionsStyles?.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 || {});
24
38
  export {
25
- IconButtonStyled as I,
39
+ BadgeStyled as B,
40
+ IconButtonUrlStyled as I,
41
+ LabelMenuItemStyled as L,
26
42
  MenuItemStyled as M,
27
- PopoverStyled as P,
28
- RootStyled as R
43
+ RootStyled as R,
44
+ LabelEmptyStyled as a,
45
+ IconButtonStyled as b
29
46
  };
@@ -1,111 +1,49 @@
1
1
  import { ReactElement } from 'react';
2
- import { Sizes } from '@m4l/styles';
3
2
  import { ComponentNameToClassKey, SxProps } from '@mui/material';
4
3
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
5
4
  import { Theme } from '@mui/material/styles';
6
5
  import { PopoverProps } from '../Popover/types';
7
- import { MenuItemProps } from '../MenuItem';
8
6
  import { MenuActionsSlots } from './slots';
9
7
  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
- */
15
8
  export interface ComponentActionProps {
16
9
  description?: string;
17
10
  onClick: (props?: any) => void;
18
11
  }
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
- */
12
+ export type ItemVariant = 'normal' | 'delete';
13
+ export type MenuAction = {
14
+ urlIcon?: string;
15
+ iconWidth?: number;
16
+ iconHeight?: number;
17
+ onClick: (props?: any) => void;
18
+ disabled?: boolean;
19
+ color?: string;
20
+ label?: string;
21
+ dictionaryId?: string;
22
+ className?: string;
23
+ variant?: ItemVariant;
24
+ };
31
25
  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
- */
39
26
  iconButtonClassName?: string;
40
- /**
41
- * Objeto personalizado a pasar al componente.
42
- */
43
27
  objItem?: any;
44
- /**
45
- * URL del ícono.
46
- */
47
28
  urlIcon?: string;
48
- /**
49
- * Acciones del menú, puede ser un array o una función que genere acciones.
50
- */
51
29
  menuActions: MenuAction[] | ((row: any) => MenuAction[]);
52
- /**
53
- * Texto del tooltip opcional.
54
- */
55
30
  toolTip?: string;
56
- /**
57
- * Margen superior del menú.
58
- */
59
31
  marginTop?: number | string;
60
- /**
61
- * Margen inferior del menú.
62
- */
63
32
  marginBottom?: number | string;
64
- /**
65
- * Margen derecho del menú.
66
- */
67
33
  marginRight?: number | string;
68
- /**
69
- * Margen izquierdo del menú.
70
- */
71
34
  marginLeft?: number | string;
72
- /**
73
- * Ancho del menú.
74
- */
75
35
  width?: number;
76
- /**
77
- * Elemento opcional que se renderiza al final de la lista del menú.
78
- */
79
36
  endListElement?: ReactElement;
80
- /**
81
- * Estilos personalizados para las acciones del menú.
82
- */
83
37
  menuActionSx?: SxProps<Theme> | Partial<OverridesStyleRules<string, ComponentNameToClassKey, Theme>>;
84
- /**
85
- * Contenido del `Badge` si está presente.
86
- */
38
+ withBadge?: boolean;
87
39
  badgeContent?: string;
88
- /**
89
- * Elemento externo para abrir el menú.
90
- */
91
40
  externalOpen?: HTMLDivElement | null;
92
- /**
93
- * Función externa para cerrar el menú.
94
- */
95
41
  externalClose?: (element: null | HTMLDivElement) => void;
96
42
  }
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;
43
+ export interface OwnerState {
44
+ variant: string;
45
+ }
46
+ export interface MenuActionsOwnerState extends MenuActionsProps, OwnerState {
103
47
  }
104
- /**
105
- * Tipo de slots disponibles para `MenuActions`.
106
- */
107
48
  export type MenuActionsSlotsType = keyof typeof MenuActionsSlots;
108
- /**
109
- * Estilos para `MenuActions`.
110
- */
111
49
  export type MenuActionsStyles = Partial<OverridesStyleRules<MenuActionsSlots, typeof MENU_ACTIONS_KEY_COMPONENT, Theme> | undefined> | undefined;