@m4l/components 9.1.28 → 9.1.30
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/components/AccountPopover/AccountPopover.d.ts +4 -3
- package/components/AccountPopover/AccountPopover.js +49 -26
- package/components/AccountPopover/constants.d.ts +5 -0
- package/components/AccountPopover/constants.js +10 -0
- package/components/AccountPopover/slots/AccountPopoverEnum.d.ts +18 -0
- package/components/AccountPopover/slots/AccountPopoverEnum.js +22 -0
- package/components/AccountPopover/slots/AccountPopoverSlots.d.ts +16 -0
- package/components/AccountPopover/slots/AccountPopoverSlots.js +93 -0
- package/components/AccountPopover/style.d.ts +2 -1
- package/components/AccountPopover/style.js +241 -5
- package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.d.ts +11 -0
- package/components/AccountPopover/subcomponents/MenuPopover/MenuPopover.js +70 -0
- package/components/AccountPopover/subcomponents/MenuPopover/types.d.ts +11 -0
- package/components/AccountPopover/subcomponents/MyAvatar/{index.d.ts → MyAvatar.d.ts} +4 -0
- package/components/AccountPopover/subcomponents/MyAvatar/MyAvatar.js +19 -0
- package/components/AccountPopover/subcomponents/MyAvatar/types.d.ts +2 -2
- package/components/AccountPopover/tests/AccountPopover.test.d.ts +0 -0
- package/components/AccountPopover/tests/constants.js +4 -0
- package/components/AccountPopover/tests/utils.d.ts +1 -2
- package/components/AccountPopover/tests/utils.js +7 -0
- package/components/AccountPopover/types.d.ts +16 -12
- package/components/ModalDialog/ModalDialog.d.ts +5 -0
- package/components/mui_extended/LoadingButton/types.d.ts +1 -1
- package/components/mui_extended/MenuItem/MenuItem.d.ts +2 -2
- package/components/mui_extended/MenuItem/MenuItem.js +28 -14
- package/components/mui_extended/MenuItem/MenuItem.styles.js +92 -29
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.d.ts +4 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +3 -0
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.d.ts +10 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +17 -1
- package/components/mui_extended/MenuItem/types.d.ts +4 -2
- package/hooks/useStateRef/index.d.ts +4 -0
- package/hooks/useStateRef/index.js +1 -1
- package/package.json +2 -2
- package/components/AccountPopover/classes/constants.d.ts +0 -1
- package/components/AccountPopover/classes/constants.js +0 -4
- package/components/AccountPopover/classes/index.d.ts +0 -31
- package/components/AccountPopover/classes/index.js +0 -59
- package/components/AccountPopover/classes/types.d.ts +0 -32
- package/components/AccountPopover/subcomponents/MyAvatar/index.js +0 -21
- package/components/AccountPopover/subcomponents/PopOver/index.d.ts +0 -7
- package/components/AccountPopover/subcomponents/PopOver/index.js +0 -207
- package/components/AccountPopover/subcomponents/PopOver/tests/constants.d.ts +0 -1
- package/components/AccountPopover/subcomponents/PopOver/tests/utils.d.ts +0 -2
- package/components/AccountPopover/subcomponents/PopOver/types.d.ts +0 -24
- package/components/CommonActions/tests/constants.d.ts +0 -1
- package/components/CommonActions/tests/utils.d.ts +0 -2
- package/components/mui_extended/CircularProgress/CircularProgress.test.d.ts +0 -1
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
|
|
2
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
3
|
-
import { c as componentName } from "./constants.js";
|
|
4
|
-
generateUtilityClasses(
|
|
5
|
-
componentName,
|
|
6
|
-
[
|
|
7
|
-
/* elements */
|
|
8
|
-
"root",
|
|
9
|
-
"containerUserName",
|
|
10
|
-
"containerUserEmail",
|
|
11
|
-
"containerlogOut",
|
|
12
|
-
"containerUserInfo",
|
|
13
|
-
"containerSetting",
|
|
14
|
-
"labelUserName",
|
|
15
|
-
"labelUserEmail",
|
|
16
|
-
"labelVersion",
|
|
17
|
-
"containerAvatarPopover",
|
|
18
|
-
"myAvatar",
|
|
19
|
-
"popover",
|
|
20
|
-
"containerAppVersion",
|
|
21
|
-
"containerMenuItems",
|
|
22
|
-
"containerProgress",
|
|
23
|
-
"logOut",
|
|
24
|
-
"menuItem"
|
|
25
|
-
/* states or variants of elements */
|
|
26
|
-
]
|
|
27
|
-
);
|
|
28
|
-
function getAccountPopoverClassesUtilityClass(slot) {
|
|
29
|
-
return generateUtilityClass(componentName, slot);
|
|
30
|
-
}
|
|
31
|
-
const useAccountPopoverUtilityClasses = () => {
|
|
32
|
-
const slots = {
|
|
33
|
-
root: ["root"],
|
|
34
|
-
containerUserName: ["containerUserName"],
|
|
35
|
-
containerUserEmail: ["containerUserEmail"],
|
|
36
|
-
containerUserInfo: ["containerUserInfo"],
|
|
37
|
-
containerlogOut: ["containerlogOut"],
|
|
38
|
-
containerSetting: ["containerSetting"],
|
|
39
|
-
labelUserName: ["labelUserName"],
|
|
40
|
-
labelUserEmail: ["labelUserEmail"],
|
|
41
|
-
labelVersion: ["labelVersion"],
|
|
42
|
-
myAvatar: ["myAvatar"],
|
|
43
|
-
containerAvatarPopover: ["containerAvatarPopover"],
|
|
44
|
-
popover: ["popover"],
|
|
45
|
-
containerAppVersion: ["containerAppVersion"],
|
|
46
|
-
containerMenuItems: ["containerMenuItems"],
|
|
47
|
-
containerProgress: ["containerProgress"],
|
|
48
|
-
logOut: ["logOut"],
|
|
49
|
-
menuItem: ["menuItem"]
|
|
50
|
-
};
|
|
51
|
-
const composedClasses = unstable_composeClasses(slots, getAccountPopoverClassesUtilityClass, {});
|
|
52
|
-
return {
|
|
53
|
-
...composedClasses
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export {
|
|
57
|
-
getAccountPopoverClassesUtilityClass as g,
|
|
58
|
-
useAccountPopoverUtilityClasses as u
|
|
59
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useAccountPopoverUtilityClasses } from '.';
|
|
2
|
-
/**
|
|
3
|
-
* Tipos de datos para las clases del componente AccountPopover.
|
|
4
|
-
*/
|
|
5
|
-
export interface AccountPopoverClassesType {
|
|
6
|
-
root: string;
|
|
7
|
-
containerUserName: string;
|
|
8
|
-
containerUserEmail: string;
|
|
9
|
-
containerlogOut: string;
|
|
10
|
-
containerUserInfo: string;
|
|
11
|
-
containerSetting: string;
|
|
12
|
-
labelUserName: string;
|
|
13
|
-
labelUserEmail: string;
|
|
14
|
-
labelVersion: string;
|
|
15
|
-
containerAvatarPopover: string;
|
|
16
|
-
myAvatar: string;
|
|
17
|
-
popover: string;
|
|
18
|
-
containerAppVersion: string;
|
|
19
|
-
containerMenuItems: string;
|
|
20
|
-
containerProgress: string;
|
|
21
|
-
logOut: string;
|
|
22
|
-
menuItem: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Tipo de dato para las claves de las clases del componente AccountPopover.
|
|
26
|
-
* Utilizado para construir overrides en el objeto del tema.
|
|
27
|
-
*/
|
|
28
|
-
export type AccountPopoverClassesKey = keyof AccountPopoverClassesType;
|
|
29
|
-
/**
|
|
30
|
-
* Tipo para las clases del componente AccountPopover.
|
|
31
|
-
*/
|
|
32
|
-
export type AccountPopoverClasses = ReturnType<typeof useAccountPopoverUtilityClasses>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEnvironment } from "@m4l/core";
|
|
3
|
-
import { A as Avatar } from "../../../mui_extended/Avatar/Avatar.js";
|
|
4
|
-
function MyAvatar(props) {
|
|
5
|
-
const { avatarUrl, firstName = "", lastName = "arreee", ...other } = props;
|
|
6
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
7
|
-
return /* @__PURE__ */ jsx(
|
|
8
|
-
Avatar,
|
|
9
|
-
{
|
|
10
|
-
alt: "full_name",
|
|
11
|
-
color: "default",
|
|
12
|
-
...avatarUrl ? {
|
|
13
|
-
src: `${host_static_assets}/${environment_assets}/frontend/domain/${avatarUrl}`
|
|
14
|
-
} : { children: `${firstName[0]}${lastName[0]}` },
|
|
15
|
-
...other
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
MyAvatar as M
|
|
21
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PopOverProps } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* MenuPopOver: Es el subcomponente de AccountPopover encargado de crear el menú popover y su contenido.
|
|
4
|
-
* Se debe refactorizar el componente PopOver para recibir la propr de size.
|
|
5
|
-
* @param props
|
|
6
|
-
*/
|
|
7
|
-
export declare const MenuPopOver: (props: PopOverProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
3
|
-
import { useTheme, ButtonBase } from "@mui/material";
|
|
4
|
-
import { g as getAccountPopoverClassesUtilityClass } from "../../classes/index.js";
|
|
5
|
-
import { T as TEST_PROP_ID } from "../../../../test/constants_no_mock.js";
|
|
6
|
-
import { M as MyAvatar } from "../MyAvatar/index.js";
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import { P as Popover } from "../../../mui_extended/Popover/Popover.js";
|
|
9
|
-
import { I as Icon } from "../../../Icon/Icon.js";
|
|
10
|
-
import { C as CircularProgress } from "../../../mui_extended/CircularProgress/CircularProgress.js";
|
|
11
|
-
const MenuPopOver = (props) => {
|
|
12
|
-
const {
|
|
13
|
-
data,
|
|
14
|
-
itemHandleClick,
|
|
15
|
-
version,
|
|
16
|
-
handleLogOut,
|
|
17
|
-
classes,
|
|
18
|
-
userData,
|
|
19
|
-
settingsHandleOpen: settingHandleOpen,
|
|
20
|
-
asyncState
|
|
21
|
-
} = props;
|
|
22
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
23
|
-
const { avatarUrl, firstName, lastName, email } = userData || {};
|
|
24
|
-
const { getLabel } = useModuleDictionary();
|
|
25
|
-
const [open, setOpen] = useState(null);
|
|
26
|
-
const theme = useTheme();
|
|
27
|
-
const handleClick = (item) => {
|
|
28
|
-
itemHandleClick(item);
|
|
29
|
-
handleClose();
|
|
30
|
-
};
|
|
31
|
-
const handleClose = () => {
|
|
32
|
-
setOpen(null);
|
|
33
|
-
};
|
|
34
|
-
const handleOpen = (event) => {
|
|
35
|
-
setOpen(event.currentTarget);
|
|
36
|
-
};
|
|
37
|
-
return /* @__PURE__ */ jsxs(
|
|
38
|
-
"div",
|
|
39
|
-
{
|
|
40
|
-
role: "presentation",
|
|
41
|
-
className: classes.containerAvatarPopover,
|
|
42
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("containerAvatarPopover") } : {},
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ jsx(ButtonBase, { children: /* @__PURE__ */ jsx(
|
|
45
|
-
MyAvatar,
|
|
46
|
-
{
|
|
47
|
-
className: classes.myAvatar,
|
|
48
|
-
avatarUrl,
|
|
49
|
-
firstName: firstName || "",
|
|
50
|
-
lastName: lastName || "",
|
|
51
|
-
onClick: handleOpen
|
|
52
|
-
}
|
|
53
|
-
) }),
|
|
54
|
-
/* @__PURE__ */ jsxs(
|
|
55
|
-
Popover,
|
|
56
|
-
{
|
|
57
|
-
open: Boolean(open),
|
|
58
|
-
anchorEl: open,
|
|
59
|
-
onClose: handleClose,
|
|
60
|
-
className: classes.popover,
|
|
61
|
-
arrowType: "no-arrow",
|
|
62
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
63
|
-
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
64
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("popover") } : {},
|
|
65
|
-
sx: {
|
|
66
|
-
mt: "5px",
|
|
67
|
-
...theme.components?.M4LAccountPopoverPopover?.styleOverrides || {}
|
|
68
|
-
},
|
|
69
|
-
children: [
|
|
70
|
-
/* @__PURE__ */ jsxs(
|
|
71
|
-
"div",
|
|
72
|
-
{
|
|
73
|
-
className: classes.containerUserInfo,
|
|
74
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
75
|
-
[TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("containerUserInfo")
|
|
76
|
-
} : {},
|
|
77
|
-
children: [
|
|
78
|
-
" ",
|
|
79
|
-
/* @__PURE__ */ jsxs("div", { className: classes.containerUserName, children: [
|
|
80
|
-
/* @__PURE__ */ jsx(
|
|
81
|
-
Icon,
|
|
82
|
-
{
|
|
83
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/account_popover/assets/icons/users.svg`
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
/* @__PURE__ */ jsx("span", { className: classes.labelUserName, children: `${firstName} ${lastName}` })
|
|
87
|
-
] }),
|
|
88
|
-
/* @__PURE__ */ jsxs("div", { className: classes.containerUserEmail, children: [
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
Icon,
|
|
91
|
-
{
|
|
92
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/account_popover/assets/icons/email.svg`
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ jsx("span", { className: classes.labelUserEmail, children: email })
|
|
96
|
-
] })
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
),
|
|
100
|
-
/* @__PURE__ */ jsxs(
|
|
101
|
-
"div",
|
|
102
|
-
{
|
|
103
|
-
className: classes.containerAppVersion,
|
|
104
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
105
|
-
[TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("containerAppVersion")
|
|
106
|
-
} : {},
|
|
107
|
-
children: [
|
|
108
|
-
/* @__PURE__ */ jsx(
|
|
109
|
-
Icon,
|
|
110
|
-
{
|
|
111
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/account_popover/assets/icons/version.svg`
|
|
112
|
-
}
|
|
113
|
-
),
|
|
114
|
-
/* @__PURE__ */ jsx("span", { className: classes.labelVersion, children: `${getLabel("account_popover.label_version")} ${version}` })
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
),
|
|
118
|
-
/* @__PURE__ */ jsxs(
|
|
119
|
-
"div",
|
|
120
|
-
{
|
|
121
|
-
className: classes.containerMenuItems,
|
|
122
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
123
|
-
[TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("containerMenuItems")
|
|
124
|
-
} : {},
|
|
125
|
-
children: [
|
|
126
|
-
/* @__PURE__ */ jsxs(
|
|
127
|
-
"div",
|
|
128
|
-
{
|
|
129
|
-
role: "button",
|
|
130
|
-
tabIndex: 0,
|
|
131
|
-
className: classes.containerSetting,
|
|
132
|
-
onClick: () => {
|
|
133
|
-
settingHandleOpen();
|
|
134
|
-
handleClose();
|
|
135
|
-
},
|
|
136
|
-
onKeyDown: (event) => {
|
|
137
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
138
|
-
settingHandleOpen();
|
|
139
|
-
handleClose();
|
|
140
|
-
event.preventDefault();
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ jsx(
|
|
145
|
-
Icon,
|
|
146
|
-
{
|
|
147
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/account_popover/assets/icons/configuration.svg`
|
|
148
|
-
}
|
|
149
|
-
),
|
|
150
|
-
/* @__PURE__ */ jsx("div", { className: classes.menuItem, children: getLabel("account_popover.label_settings") })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
asyncState === "loaded" ? data.map((option) => /* @__PURE__ */ jsx(
|
|
155
|
-
"div",
|
|
156
|
-
{
|
|
157
|
-
role: "presentation",
|
|
158
|
-
onClick: () => handleClick(option),
|
|
159
|
-
className: classes.menuItem,
|
|
160
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
161
|
-
[TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("menuItem")
|
|
162
|
-
} : {},
|
|
163
|
-
children: option.title
|
|
164
|
-
},
|
|
165
|
-
option.title
|
|
166
|
-
)) : /* @__PURE__ */ jsx(
|
|
167
|
-
"div",
|
|
168
|
-
{
|
|
169
|
-
className: classes.containerProgress,
|
|
170
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
171
|
-
[TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("containerProgress")
|
|
172
|
-
} : {},
|
|
173
|
-
children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" })
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
),
|
|
179
|
-
/* @__PURE__ */ jsxs("div", { role: "button", tabIndex: 0, className: classes.containerlogOut, onClick: handleLogOut, children: [
|
|
180
|
-
/* @__PURE__ */ jsx(
|
|
181
|
-
Icon,
|
|
182
|
-
{
|
|
183
|
-
src: `${host_static_assets}/${environment_assets}/frontend/components/account_popover/assets/icons/sign_off.svg`
|
|
184
|
-
}
|
|
185
|
-
),
|
|
186
|
-
/* @__PURE__ */ jsx(
|
|
187
|
-
"div",
|
|
188
|
-
{
|
|
189
|
-
role: "presentation",
|
|
190
|
-
className: classes.logOut,
|
|
191
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
192
|
-
[TEST_PROP_ID]: getAccountPopoverClassesUtilityClass("logOut")
|
|
193
|
-
} : {},
|
|
194
|
-
children: getLabel("account_popover.label_logout")
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
] })
|
|
198
|
-
]
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
export {
|
|
206
|
-
MenuPopOver as M
|
|
207
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ACCOUNTPOPOVER_PREFIX = "M4LAccountPopover";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AccountPopoverClasses } from '../../classes/types';
|
|
2
|
-
import { AccountPopoverProps, AsyncTypes, RightMenuData } from '../../types';
|
|
3
|
-
import { UserAuth } from '@m4l/core';
|
|
4
|
-
/**
|
|
5
|
-
* Propiedades extendidas para el componente PopOver.
|
|
6
|
-
*/
|
|
7
|
-
export interface PopOverProps extends Omit<AccountPopoverProps, 'userData'> {
|
|
8
|
-
/**
|
|
9
|
-
* Datos para renderizar los elementos del popover.
|
|
10
|
-
*/
|
|
11
|
-
data: Array<RightMenuData> | [];
|
|
12
|
-
/**
|
|
13
|
-
* Clases personalizadas para el componente.
|
|
14
|
-
*/
|
|
15
|
-
classes: AccountPopoverClasses;
|
|
16
|
-
/**
|
|
17
|
-
* Datos del usuario para el popover.
|
|
18
|
-
*/
|
|
19
|
-
userData: UserAuth | null | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Estado de carga asíncrona.
|
|
22
|
-
*/
|
|
23
|
-
asyncState: AsyncTypes;
|
|
24
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const COMMONACTIONS_PREFIX = "M4LCommonActions";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|