@m4l/components 9.1.126 → 9.1.127
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/.storybook/constants.d.ts +1 -0
- package/.storybook/utils/getStylesColorsByMode.d.ts +4 -4
- package/@types/export.d.ts +0 -3
- package/components/LanguagePopover/LanguagePopover.d.ts +14 -7
- package/components/LanguagePopover/LanguagePopover.js +67 -134
- package/components/LanguagePopover/LanguagePopover.styles.d.ts +2 -0
- package/components/LanguagePopover/LanguagePopover.styles.js +19 -0
- package/components/LanguagePopover/constants.d.ts +1 -0
- package/components/LanguagePopover/constants.js +4 -0
- package/components/LanguagePopover/slots/LanguagePopoverEnum.d.ts +5 -0
- package/components/LanguagePopover/slots/LanguagePopoverEnum.js +9 -0
- package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +5 -0
- package/components/LanguagePopover/slots/LanguagePopoverSlots.js +24 -0
- package/components/LanguagePopover/tests/LanguagePopover.test.d.ts +1 -0
- package/components/LanguagePopover/types.d.ts +17 -7
- package/components/MFIsolationApp/MFIsolationApp.js +4 -4
- package/components/MenuActions/MenuActions.js +23 -6
- package/components/MenuActions/MenuActions.styles.js +1 -1
- package/components/MenuActions/types.d.ts +6 -1
- package/package.json +1 -1
- package/vendor.js +2 -1
- package/components/LanguagePopover/classes/constants.d.ts +0 -1
- package/components/LanguagePopover/classes/constants.js +0 -4
- package/components/LanguagePopover/classes/index.d.ts +0 -12
- package/components/LanguagePopover/classes/index.js +0 -33
- package/components/LanguagePopover/classes/types.d.ts +0 -8
- package/components/LanguagePopover/styles.d.ts +0 -5
- package/components/LanguagePopover/styles.js +0 -30
- package/components/LanguagePopover/tests/constants.d.ts +0 -1
- package/components/LanguagePopover/tests/constants.js +0 -4
|
@@ -28,3 +28,4 @@ export declare const HOST_API_REMOTE = "https://lab1.stage.made4labs.com/api/v1/
|
|
|
28
28
|
export declare const HOST_STATIC_ASSETS = "https://s3.amazonaws.com/static.made4labs/environments";
|
|
29
29
|
export declare const DOMAIN_TOKEN = "lab1";
|
|
30
30
|
export declare const STORYBOOK_MODULE_ID = "login";
|
|
31
|
+
export declare const STORYBOOK_ISOLATION_MODULE_ID = "users_list";
|
|
@@ -25,11 +25,11 @@ export declare const colorsLight: {
|
|
|
25
25
|
readonly selected: string;
|
|
26
26
|
readonly selectedOpacity: string;
|
|
27
27
|
readonly focusVisible: string;
|
|
28
|
+
readonly contrastText: string;
|
|
28
29
|
readonly focus: string;
|
|
29
30
|
readonly light: string;
|
|
30
31
|
readonly dark: string;
|
|
31
32
|
readonly main: string;
|
|
32
|
-
readonly contrastText: string;
|
|
33
33
|
readonly enabled: string;
|
|
34
34
|
readonly enabledOpacity: string;
|
|
35
35
|
readonly hover: string;
|
|
@@ -180,11 +180,11 @@ export declare const colorsLight: {
|
|
|
180
180
|
readonly selected: string;
|
|
181
181
|
readonly selectedOpacity: string;
|
|
182
182
|
readonly focusVisible: string;
|
|
183
|
+
readonly contrastText: string;
|
|
183
184
|
readonly focus: string;
|
|
184
185
|
readonly light: string;
|
|
185
186
|
readonly dark: string;
|
|
186
187
|
readonly main: string;
|
|
187
|
-
readonly contrastText: string;
|
|
188
188
|
readonly enabled: string;
|
|
189
189
|
readonly enabledOpacity: string;
|
|
190
190
|
readonly hover: string;
|
|
@@ -336,11 +336,11 @@ export declare const colorsDark: {
|
|
|
336
336
|
readonly selected: string;
|
|
337
337
|
readonly selectedOpacity: string;
|
|
338
338
|
readonly focusVisible: string;
|
|
339
|
+
readonly contrastText: string;
|
|
339
340
|
readonly focus: string;
|
|
340
341
|
readonly light: string;
|
|
341
342
|
readonly dark: string;
|
|
342
343
|
readonly main: string;
|
|
343
|
-
readonly contrastText: string;
|
|
344
344
|
readonly enabled: string;
|
|
345
345
|
readonly enabledOpacity: string;
|
|
346
346
|
readonly hover: string;
|
|
@@ -491,11 +491,11 @@ export declare const colorsDark: {
|
|
|
491
491
|
readonly selected: string;
|
|
492
492
|
readonly selectedOpacity: string;
|
|
493
493
|
readonly focusVisible: string;
|
|
494
|
+
readonly contrastText: string;
|
|
494
495
|
readonly focus: string;
|
|
495
496
|
readonly light: string;
|
|
496
497
|
readonly dark: string;
|
|
497
498
|
readonly main: string;
|
|
498
|
-
readonly contrastText: string;
|
|
499
499
|
readonly enabled: string;
|
|
500
500
|
readonly enabledOpacity: string;
|
|
501
501
|
readonly hover: string;
|
package/@types/export.d.ts
CHANGED
|
@@ -40,9 +40,6 @@ declare module '@mui/material/styles' {
|
|
|
40
40
|
M4LIconButton?: {
|
|
41
41
|
styleOverrides?: ComponentsOverrides<Theme>['M4LIconButton'];
|
|
42
42
|
};
|
|
43
|
-
M4LanguagePopover?: {
|
|
44
|
-
styleOverrides?: ComponentsOverrides<Theme>['M4LanguagePopover'];
|
|
45
|
-
};
|
|
46
43
|
M4LImageButton?: {
|
|
47
44
|
styleOverrides?: ComponentsOverrides<Theme>['M4LImageButton'];
|
|
48
45
|
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { LanguagePopoverProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
3
|
+
* El LanguagePopover es un componente que le permite al usuario cambiar la configuración del idioma en la plataforma,
|
|
4
|
+
* mostrando un menú con las opciones de idioma disponibles, cada una con su respectiva bandera.
|
|
5
|
+
*
|
|
6
|
+
* ### Dependencias:
|
|
7
|
+
* - **`useFirstRender`**: Hook que permite obtener si es la primera renderización del componente.
|
|
8
|
+
* - **`useLocales`**: Hook que permite obtener el idioma actual y cambiarlo.
|
|
9
|
+
* - **`useEnvironment`**: Hook que permite acceder a los valores del entorno de la aplicación.
|
|
10
|
+
* - **`useNetwork`**: Hook que permite realizar solicitudes de red en la aplicación.
|
|
11
|
+
* @author DanielEscobar - automatic
|
|
12
|
+
* @createdAt 2025-01-30 18:57:15 - automatic
|
|
13
|
+
* @updatedAt 2025-02-04 15:54:50 - automatic
|
|
14
|
+
* @updatedUser DanielEscobar - automatic
|
|
15
|
+
* @example
|
|
16
|
+
* <LanguagePopover disabled={disabled} size={size} />
|
|
10
17
|
*/
|
|
11
18
|
export declare function LanguagePopover(props: LanguagePopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,151 +1,84 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { I as Image } from "../Image/Image.js";
|
|
5
|
-
import { useLocales } from "@m4l/graphics";
|
|
6
|
-
import { L as LanguagePopoverRoot, C as ContainerMenuItems, a as ContainerProgress, b as ContainerImage, c as LabelItem } from "./styles.js";
|
|
7
|
-
import { I as ImageButton } from "../mui_extended/ImageButton/ImageButton.js";
|
|
3
|
+
import { useFirstRender, useLocales } from "@m4l/graphics";
|
|
8
4
|
import { useEnvironment, useNetwork } from "@m4l/core";
|
|
9
|
-
import { g as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
import { g as getPropDataTestId } from "../../test/getNameDataTestId.js";
|
|
6
|
+
import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
|
|
7
|
+
import { I as Image } from "../Image/Image.js";
|
|
8
|
+
import { L as LanguagePopoverRootStyled, I as ImageStyled, P as PaperStyled } from "./slots/LanguagePopoverSlots.js";
|
|
9
|
+
import { L as LANGUAGE_POPOVER_KEY_COMPONENT } from "./constants.js";
|
|
10
|
+
import { L as LanguagePopoverSlots } from "./slots/LanguagePopoverEnum.js";
|
|
11
|
+
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
15
12
|
function LanguagePopover(props) {
|
|
16
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
disabled,
|
|
15
|
+
size = "medium"
|
|
16
|
+
} = props;
|
|
17
|
+
const { currentSize } = useComponentSize(size);
|
|
18
|
+
const adjustedSize = currentSize === "small" || currentSize === "medium" ? currentSize : "medium";
|
|
19
|
+
const isFirstRender = useFirstRender();
|
|
17
20
|
const { currentLocale, onChangeLocale } = useLocales();
|
|
18
21
|
const { domain_token } = useEnvironment();
|
|
19
22
|
const { networkOperation } = useNetwork();
|
|
20
|
-
const [
|
|
21
|
-
const [
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setOpen(event.currentTarget);
|
|
27
|
-
};
|
|
28
|
-
const handleClose = () => {
|
|
29
|
-
setOpen(null);
|
|
23
|
+
const [allLocales, setAllLocales] = useState([]);
|
|
24
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
25
|
+
const handleMenuOpenChange = (open) => {
|
|
26
|
+
if (open) {
|
|
27
|
+
setIsMenuOpen(true);
|
|
28
|
+
}
|
|
30
29
|
};
|
|
31
30
|
useEffect(() => {
|
|
32
31
|
let mounted = true;
|
|
33
|
-
if (
|
|
34
|
-
|
|
32
|
+
if (isMenuOpen) {
|
|
33
|
+
networkOperation({
|
|
34
|
+
method: "GET",
|
|
35
|
+
endPoint: `na/locales`,
|
|
36
|
+
parms: { domain_token },
|
|
37
|
+
responseToCamelCase: true
|
|
38
|
+
}).then((response) => {
|
|
39
|
+
if (mounted) {
|
|
40
|
+
try {
|
|
41
|
+
setAllLocales(response.data);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
35
47
|
}
|
|
36
|
-
setLoading(true);
|
|
37
|
-
networkOperation({
|
|
38
|
-
method: "GET",
|
|
39
|
-
endPoint: `na/locales`,
|
|
40
|
-
parms: { domain_token }
|
|
41
|
-
}).then((response) => {
|
|
42
|
-
if (mounted) {
|
|
43
|
-
!testingProps && setAllLocales(response.data);
|
|
44
|
-
}
|
|
45
|
-
}).finally(() => {
|
|
46
|
-
setLoading(false);
|
|
47
|
-
});
|
|
48
48
|
return function cleanUp() {
|
|
49
49
|
mounted = false;
|
|
50
50
|
};
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{
|
|
81
|
-
arrowType: "top-right",
|
|
82
|
-
open: Boolean(open),
|
|
83
|
-
anchorEl: open,
|
|
84
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
85
|
-
onClose: handleClose,
|
|
86
|
-
sx: {
|
|
87
|
-
mt: 1.5,
|
|
88
|
-
ml: 0.75,
|
|
89
|
-
width: 180,
|
|
90
|
-
rowGap: "100px",
|
|
91
|
-
"& .MuiMenuItem-root": { px: 1, typography: "body2", borderRadius: 0.75 }
|
|
92
|
-
},
|
|
93
|
-
children: /* @__PURE__ */ jsxs(
|
|
94
|
-
ContainerMenuItems,
|
|
95
|
-
{
|
|
96
|
-
className: classes.containerItems,
|
|
97
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId(LANGUAGEPOPOVER_KEY_COMPONENT, "containerItems", dataTestId) } : {},
|
|
98
|
-
children: [
|
|
99
|
-
allLocales.length === 0 && /* CircularProgress: Componente extendido que proporciona una animación de carga circular, el cual
|
|
100
|
-
será visible hasta que se complete la operación de red asociada a la lista de idiomas disponibles. */
|
|
101
|
-
/* @__PURE__ */ jsx(
|
|
102
|
-
ContainerProgress,
|
|
103
|
-
{
|
|
104
|
-
className: classes.containerProgress,
|
|
105
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId(LANGUAGEPOPOVER_KEY_COMPONENT, "containerProgress", dataTestId) } : {},
|
|
106
|
-
children: /* @__PURE__ */ jsx(CircularProgress, { size: "small" })
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
allLocales.length > 0 && /* Stack, MenuItem, Image, LabelItem: El grupo de componentes conforma las opciones del menú de idioma,
|
|
110
|
-
se replica dependiendo de la cantidad de elementos que existan en la lista allLocales */
|
|
111
|
-
/* @__PURE__ */ jsx(Stack, { spacing: 0.75, children: allLocales.map((option) => /* @__PURE__ */ jsxs(
|
|
112
|
-
MenuItem,
|
|
113
|
-
{
|
|
114
|
-
selected: option.lang === currentLocale?.lang && option?.script === currentLocale?.script && option?.region === currentLocale?.region,
|
|
115
|
-
onClick: () => {
|
|
116
|
-
onChangeLocale(option);
|
|
117
|
-
handleClose();
|
|
118
|
-
},
|
|
119
|
-
children: [
|
|
120
|
-
/* @__PURE__ */ jsx(ContainerImage, { children: /* @__PURE__ */ jsx(
|
|
121
|
-
Image,
|
|
122
|
-
{
|
|
123
|
-
alt: option.name,
|
|
124
|
-
src: option.urlIcon
|
|
125
|
-
}
|
|
126
|
-
) }),
|
|
127
|
-
/* @__PURE__ */ jsx(
|
|
128
|
-
LabelItem,
|
|
129
|
-
{
|
|
130
|
-
className: classes.labelItem,
|
|
131
|
-
...process.env.NODE_ENV !== "production" ? {
|
|
132
|
-
[TEST_PROP_ID]: getNameDataTestId(LANGUAGEPOPOVER_KEY_COMPONENT, "labelItem", dataTestId)
|
|
133
|
-
} : {},
|
|
134
|
-
children: option.name
|
|
135
|
-
}
|
|
136
|
-
)
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
option.lang || option.script || option.region
|
|
140
|
-
)) })
|
|
141
|
-
]
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
]
|
|
51
|
+
}, [isMenuOpen, isFirstRender]);
|
|
52
|
+
const getMenuActionsOptions = () => {
|
|
53
|
+
if (allLocales?.length === 0) {
|
|
54
|
+
return [{
|
|
55
|
+
type: "loader"
|
|
56
|
+
}];
|
|
57
|
+
}
|
|
58
|
+
return allLocales?.map((option) => {
|
|
59
|
+
return {
|
|
60
|
+
type: "menuItem",
|
|
61
|
+
label: option?.name,
|
|
62
|
+
startIcon: /* @__PURE__ */ jsx(Image, { src: option?.urlIcon, enableIntersectionObserver: false }),
|
|
63
|
+
onClick: () => onChangeLocale(option)
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
const classRoot = getComponentSlotRoot(LANGUAGE_POPOVER_KEY_COMPONENT);
|
|
68
|
+
return /* @__PURE__ */ jsx(
|
|
69
|
+
LanguagePopoverRootStyled,
|
|
70
|
+
{
|
|
71
|
+
size: adjustedSize,
|
|
72
|
+
className: classRoot,
|
|
73
|
+
...getPropDataTestId(LANGUAGE_POPOVER_KEY_COMPONENT, LanguagePopoverSlots.root),
|
|
74
|
+
disabled,
|
|
75
|
+
icon: /* @__PURE__ */ jsx(ImageStyled, { src: currentLocale?.urlIcon, enableIntersectionObserver: false }),
|
|
76
|
+
menuActions: getMenuActionsOptions(),
|
|
77
|
+
onOpen: handleMenuOpenChange,
|
|
78
|
+
slots: {
|
|
79
|
+
paper: PaperStyled
|
|
147
80
|
}
|
|
148
|
-
|
|
81
|
+
}
|
|
149
82
|
);
|
|
150
83
|
}
|
|
151
84
|
export {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const languagePopoverStyles = {
|
|
2
|
+
root: {},
|
|
3
|
+
image: {
|
|
4
|
+
height: "100%"
|
|
5
|
+
},
|
|
6
|
+
/**
|
|
7
|
+
* Estilos del paper
|
|
8
|
+
*/
|
|
9
|
+
paper: ({ theme }) => ({
|
|
10
|
+
position: "absolute",
|
|
11
|
+
marginTop: theme.vars.size.baseSpacings.sp1,
|
|
12
|
+
"& .MuiTypography-root": {
|
|
13
|
+
cursor: "pointer"
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
languagePopoverStyles as l
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LANGUAGE_POPOVER_KEY_COMPONENT = "M4LLanguagePopover";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var LanguagePopoverSlots = /* @__PURE__ */ ((LanguagePopoverSlots2) => {
|
|
2
|
+
LanguagePopoverSlots2["root"] = "root";
|
|
3
|
+
LanguagePopoverSlots2["image"] = "image";
|
|
4
|
+
LanguagePopoverSlots2["paper"] = "paper";
|
|
5
|
+
return LanguagePopoverSlots2;
|
|
6
|
+
})(LanguagePopoverSlots || {});
|
|
7
|
+
export {
|
|
8
|
+
LanguagePopoverSlots as L
|
|
9
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const LanguagePopoverRootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../MenuActions/types').MenuActionsProps, keyof import('../../MenuActions/types').MenuActionsProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|
|
2
|
+
export declare const ImageStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Image').ImageProps, keyof import('../../Image').ImageProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|
|
3
|
+
export declare const PaperStyled: import('@emotion/styled').StyledComponent<Pick<import('@mui/material').PaperOwnProps & import('@mui/material/OverridableComponent').CommonProps & Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
4
|
+
ref?: ((instance: HTMLDivElement | 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<HTMLDivElement> | null | undefined;
|
|
5
|
+
}, "children" | "style" | "square" | "variant" | "sx" | "classes" | "className" | "elevation">, "children" | "ref" | "title" | "id" | "hidden" | "color" | "content" | "style" | "square" | "variant" | "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" | "key" | "elevation"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { I as Image } from "../../Image/Image.js";
|
|
3
|
+
import { M as MenuActions } from "../../MenuActions/MenuActions.js";
|
|
4
|
+
import { L as LANGUAGE_POPOVER_KEY_COMPONENT } from "../constants.js";
|
|
5
|
+
import { l as languagePopoverStyles } from "../LanguagePopover.styles.js";
|
|
6
|
+
import { L as LanguagePopoverSlots } from "./LanguagePopoverEnum.js";
|
|
7
|
+
import { Paper } from "@mui/material";
|
|
8
|
+
const LanguagePopoverRootStyled = styled(MenuActions, {
|
|
9
|
+
name: LANGUAGE_POPOVER_KEY_COMPONENT,
|
|
10
|
+
slot: LanguagePopoverSlots.root
|
|
11
|
+
})(languagePopoverStyles.root);
|
|
12
|
+
const ImageStyled = styled(Image, {
|
|
13
|
+
name: LANGUAGE_POPOVER_KEY_COMPONENT,
|
|
14
|
+
slot: LanguagePopoverSlots.image
|
|
15
|
+
})(languagePopoverStyles.image);
|
|
16
|
+
const PaperStyled = styled(Paper, {
|
|
17
|
+
name: LANGUAGE_POPOVER_KEY_COMPONENT,
|
|
18
|
+
slot: LanguagePopoverSlots.paper
|
|
19
|
+
})(languagePopoverStyles.paper);
|
|
20
|
+
export {
|
|
21
|
+
ImageStyled as I,
|
|
22
|
+
LanguagePopoverRootStyled as L,
|
|
23
|
+
PaperStyled as P
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { Sizes } from '@m4l/styles';
|
|
3
|
+
import { M4LOverridesStyleRules } from '../../@types/augmentations';
|
|
4
|
+
import { LanguagePopoverSlots as Slots } from './slots/LanguagePopoverEnum';
|
|
5
|
+
import { LANGUAGE_POPOVER_KEY_COMPONENT } from './constants';
|
|
7
6
|
export interface LanguagePopoverProps {
|
|
7
|
+
/**
|
|
8
|
+
* Identificador para pruebas unitarias
|
|
9
|
+
*/
|
|
8
10
|
dataTestId?: string;
|
|
9
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Deshabilita el componente
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Propiedad para las variantes de tamaño
|
|
17
|
+
*/
|
|
18
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
10
19
|
}
|
|
20
|
+
export type LanguagePopoverStyles = M4LOverridesStyleRules<keyof typeof Slots, typeof LANGUAGE_POPOVER_KEY_COMPONENT, Theme>;
|
|
@@ -100,7 +100,7 @@ function MFIsolationApp(props) {
|
|
|
100
100
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
101
|
[]
|
|
102
102
|
);
|
|
103
|
-
return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history, children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: false, getLocaleFromNetwork, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { forcedDeviceType, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(MFAuthApp, { user, pwd, children: /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history, children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: false, getLocaleFromNetwork, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { forcedDeviceType, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(MFAuthApp, { user, pwd, children: /* @__PURE__ */ jsx(
|
|
104
104
|
BaseModule,
|
|
105
105
|
{
|
|
106
106
|
moduleId,
|
|
@@ -109,7 +109,7 @@ function MFIsolationApp(props) {
|
|
|
109
109
|
componentsDictionary,
|
|
110
110
|
moduleNameField,
|
|
111
111
|
moduleDictionaryLoaded,
|
|
112
|
-
children: [
|
|
112
|
+
children: /* @__PURE__ */ jsxs(AppearanceComponentProvider, { children: [
|
|
113
113
|
/* @__PURE__ */ jsx(ToastContainer, { containerId: TOAST_CONTAINER_ID }),
|
|
114
114
|
" ",
|
|
115
115
|
/* @__PURE__ */ jsx(
|
|
@@ -121,10 +121,10 @@ function MFIsolationApp(props) {
|
|
|
121
121
|
onSelectLayout: (modId) => {
|
|
122
122
|
console.log("onSelectLayout", modId);
|
|
123
123
|
},
|
|
124
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, { observedDivRef, children
|
|
124
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, { observedDivRef, children })
|
|
125
125
|
}
|
|
126
126
|
)
|
|
127
|
-
]
|
|
127
|
+
] })
|
|
128
128
|
}
|
|
129
129
|
) }) }) }) }) }) }) }) });
|
|
130
130
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState, useMemo, useCallback } from "react";
|
|
2
|
+
import React, { useState, useMemo, useEffect, useCallback } from "react";
|
|
3
3
|
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
4
|
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
5
5
|
import { P as Popover } from "../mui_extended/Popover/Popover.js";
|
|
@@ -31,6 +31,8 @@ function MenuActions(props) {
|
|
|
31
31
|
header,
|
|
32
32
|
footer,
|
|
33
33
|
className,
|
|
34
|
+
onOpen,
|
|
35
|
+
slots = {},
|
|
34
36
|
...other
|
|
35
37
|
} = props;
|
|
36
38
|
const { currentSize } = useComponentSize(size);
|
|
@@ -43,8 +45,16 @@ function MenuActions(props) {
|
|
|
43
45
|
selected: open,
|
|
44
46
|
paletteColor: color
|
|
45
47
|
}), [currentSize, open, color]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (onOpen) {
|
|
50
|
+
onOpen(open);
|
|
51
|
+
}
|
|
52
|
+
}, [open, onOpen]);
|
|
46
53
|
const handleOpenClose = () => {
|
|
47
54
|
setAnchorEl(null);
|
|
55
|
+
if (onOpen) {
|
|
56
|
+
onOpen(false);
|
|
57
|
+
}
|
|
48
58
|
};
|
|
49
59
|
const finalIcon = useMemo(() => {
|
|
50
60
|
return icon || urlIcon || `${host_static_assets}/${environment_assets}/${ICON_PATH}/${ICONS.MENU}`;
|
|
@@ -52,12 +62,18 @@ function MenuActions(props) {
|
|
|
52
62
|
const handleClick = useCallback((e, menuAction) => {
|
|
53
63
|
e.stopPropagation();
|
|
54
64
|
setAnchorEl(null);
|
|
65
|
+
if (onOpen) {
|
|
66
|
+
onOpen(false);
|
|
67
|
+
}
|
|
55
68
|
menuAction.onClick && menuAction.onClick(e);
|
|
56
|
-
}, []);
|
|
69
|
+
}, [onOpen]);
|
|
57
70
|
const handleButtonClick = useCallback((e) => {
|
|
58
71
|
e.stopPropagation();
|
|
59
72
|
setAnchorEl(e.currentTarget);
|
|
60
|
-
|
|
73
|
+
if (onOpen) {
|
|
74
|
+
onOpen(true);
|
|
75
|
+
}
|
|
76
|
+
}, [onOpen]);
|
|
61
77
|
const finalActions = useMemo(() => {
|
|
62
78
|
if (!menuActions) {
|
|
63
79
|
return [];
|
|
@@ -128,16 +144,17 @@ function MenuActions(props) {
|
|
|
128
144
|
"aria-label": "menu-actions"
|
|
129
145
|
}
|
|
130
146
|
),
|
|
131
|
-
/* @__PURE__ */ jsx(
|
|
147
|
+
open && /* @__PURE__ */ jsx(
|
|
132
148
|
Popover,
|
|
133
149
|
{
|
|
134
150
|
id: "Popover",
|
|
135
151
|
open,
|
|
136
|
-
anchorEl
|
|
152
|
+
anchorEl,
|
|
137
153
|
onClose: handleOpenClose,
|
|
138
154
|
arrowType,
|
|
139
|
-
slotProps: { paper: { ...paperProps } },
|
|
140
155
|
...other,
|
|
156
|
+
slots: { ...slots },
|
|
157
|
+
slotProps: { paper: { ...paperProps } },
|
|
141
158
|
children: open && renderMenuContent()
|
|
142
159
|
}
|
|
143
160
|
)
|
|
@@ -31,7 +31,7 @@ const menuActionsStyles = {
|
|
|
31
31
|
*/
|
|
32
32
|
iconButton: ({ theme, ownerState }) => ({
|
|
33
33
|
backgroundColor: ownerState.selected ? theme.vars.palette[ownerState.paletteColor ?? "default"].selectedOpacity : "transparent",
|
|
34
|
-
outline:
|
|
34
|
+
// outline: 'none',
|
|
35
35
|
"& hover": {
|
|
36
36
|
backgroundColor: theme.vars.palette[ownerState.paletteColor ?? "default"].selected
|
|
37
37
|
},
|
|
@@ -5,6 +5,7 @@ import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
|
5
5
|
import { Theme } from '@mui/material/styles';
|
|
6
6
|
import { PopoverProps } from '../mui_extended/Popover/types';
|
|
7
7
|
import { MenuItemProps } from '../mui_extended/MenuItem/types';
|
|
8
|
+
import { IconButtonProps } from '../mui_extended/IconButton/types';
|
|
8
9
|
import { MenuActionsSlots } from './slots';
|
|
9
10
|
import { MENU_ACTIONS_KEY_COMPONENT } from './constants';
|
|
10
11
|
/**
|
|
@@ -59,7 +60,7 @@ export type MenuAction = (MenuItemAction & Pick<MenuItemProps, 'startIcon' | 'en
|
|
|
59
60
|
/**
|
|
60
61
|
* Propiedades del componente `MenuActions`.
|
|
61
62
|
*/
|
|
62
|
-
export interface MenuActionsProps extends Omit<PopoverProps, 'open' | 'anchorEl'> {
|
|
63
|
+
export interface MenuActionsProps extends Omit<PopoverProps, 'open' | 'anchorEl'>, Pick<IconButtonProps, 'variant'> {
|
|
63
64
|
/**
|
|
64
65
|
* Tamaño opcional del menú (pequeño o mediano).
|
|
65
66
|
*/
|
|
@@ -170,6 +171,10 @@ export interface MenuActionsProps extends Omit<PopoverProps, 'open' | 'anchorEl'
|
|
|
170
171
|
* agrega un footer al menú
|
|
171
172
|
*/
|
|
172
173
|
footer?: ReactNode;
|
|
174
|
+
/**
|
|
175
|
+
* Define el tipo de flecha del menú.
|
|
176
|
+
*/
|
|
177
|
+
onOpen?: (param: boolean) => void;
|
|
173
178
|
}
|
|
174
179
|
/**
|
|
175
180
|
* Estado del propietario para `MenuActions`.
|
package/package.json
CHANGED
package/vendor.js
CHANGED
|
@@ -52,6 +52,7 @@ const ENVIRONMENT_ASSETS = "d1";
|
|
|
52
52
|
const HOST_API_LOCAL = "http://localhost:3000/domain";
|
|
53
53
|
const HOST_API_REMOTE = "https://lab1.stage.made4labs.com/api/v1/domain";
|
|
54
54
|
const HOST_STATIC_ASSETS = "https://s3.amazonaws.com/static.made4labs/environments";
|
|
55
|
+
const STORYBOOK_ISOLATION_MODULE_ID = "users_list";
|
|
55
56
|
const WithContexts = (Story, storyContext) => {
|
|
56
57
|
const { globals, parameters } = storyContext;
|
|
57
58
|
const { themeMode, themeColor, deviceType } = globals ?? {};
|
|
@@ -59,7 +60,7 @@ const WithContexts = (Story, storyContext) => {
|
|
|
59
60
|
return /* @__PURE__ */ jsx(
|
|
60
61
|
MFIsolationApp,
|
|
61
62
|
{
|
|
62
|
-
moduleId:
|
|
63
|
+
moduleId: STORYBOOK_ISOLATION_MODULE_ID,
|
|
63
64
|
user: USER,
|
|
64
65
|
pwd: PWD,
|
|
65
66
|
database: DATABASE,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const componentName = "M4LanguagePopover";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LanguagePopoverClassesType } from './types';
|
|
2
|
-
export declare const languagePopoverClasses: LanguagePopoverClassesType;
|
|
3
|
-
export declare function getM4LanguagePopoverClassesUtilityClass(slot: string): string;
|
|
4
|
-
/**
|
|
5
|
-
* TODO: Documentar
|
|
6
|
-
*/
|
|
7
|
-
export declare const getUtilityClasses: () => {
|
|
8
|
-
root: string;
|
|
9
|
-
containerItems: string;
|
|
10
|
-
containerProgress: string;
|
|
11
|
-
labelItem: string;
|
|
12
|
-
};
|
|
@@ -1,33 +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
|
-
"containerItems",
|
|
10
|
-
"containerProgress",
|
|
11
|
-
"labelItem",
|
|
12
|
-
"imageButton"
|
|
13
|
-
/* states or variants of elements */
|
|
14
|
-
]
|
|
15
|
-
);
|
|
16
|
-
function getM4LanguagePopoverClassesUtilityClass(slot) {
|
|
17
|
-
return generateUtilityClass(componentName, slot);
|
|
18
|
-
}
|
|
19
|
-
const getUtilityClasses = () => {
|
|
20
|
-
const slots = {
|
|
21
|
-
root: ["root"],
|
|
22
|
-
containerItems: ["containerItems"],
|
|
23
|
-
containerProgress: ["containerProgress"],
|
|
24
|
-
labelItem: ["labelItem"]
|
|
25
|
-
};
|
|
26
|
-
const composedClasses = unstable_composeClasses(slots, getM4LanguagePopoverClassesUtilityClass, {});
|
|
27
|
-
return {
|
|
28
|
-
...composedClasses
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
getUtilityClasses as g
|
|
33
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const LanguagePopoverRoot: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
2
|
-
export declare const LabelItem: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
3
|
-
export declare const ContainerProgress: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
4
|
-
export declare const ContainerMenuItems: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
5
|
-
export declare const ContainerImage: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { styled } from "@mui/material/styles";
|
|
2
|
-
const LanguagePopoverRoot = styled("div")(({ theme }) => ({
|
|
3
|
-
...theme.components?.M4LanguagePopover?.styleOverrides || {}
|
|
4
|
-
}));
|
|
5
|
-
const LabelItem = styled("div")(({ theme }) => ({
|
|
6
|
-
marginLeft: theme.spacing(1)
|
|
7
|
-
}));
|
|
8
|
-
const ContainerProgress = styled("div")(({ theme }) => ({
|
|
9
|
-
padding: theme.spacing(0.75, 0),
|
|
10
|
-
margin: theme.spacing(0, 1.25)
|
|
11
|
-
}));
|
|
12
|
-
const ContainerMenuItems = styled("div")(() => ({
|
|
13
|
-
display: "flex",
|
|
14
|
-
flexDirection: "column"
|
|
15
|
-
// marginBottom: theme.spacing(1),
|
|
16
|
-
// paddingBottom: theme.spacing(1),
|
|
17
|
-
}));
|
|
18
|
-
const ContainerImage = styled("div")(() => ({
|
|
19
|
-
display: "flex",
|
|
20
|
-
gap: "4px",
|
|
21
|
-
width: "16px",
|
|
22
|
-
height: "16px"
|
|
23
|
-
}));
|
|
24
|
-
export {
|
|
25
|
-
ContainerMenuItems as C,
|
|
26
|
-
LanguagePopoverRoot as L,
|
|
27
|
-
ContainerProgress as a,
|
|
28
|
-
ContainerImage as b,
|
|
29
|
-
LabelItem as c
|
|
30
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LANGUAGEPOPOVER_KEY_COMPONENT = "M4LanguagePopover";
|