@m4l/components 9.1.124 → 9.1.125
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/LoadingError/LoadingError.d.ts +37 -12
- package/components/LoadingError/LoadingError.js +82 -44
- package/components/LoadingError/LoadingError.styles.d.ts +2 -0
- package/components/LoadingError/LoadingError.styles.js +121 -0
- package/components/LoadingError/constants.d.ts +1 -0
- package/components/LoadingError/constants.js +4 -0
- package/components/LoadingError/dictionary.d.ts +7 -0
- package/components/LoadingError/dictionary.js +9 -1
- package/components/LoadingError/slots/LoadingErrorEnum.d.ts +13 -0
- package/components/LoadingError/slots/LoadingErrorEnum.js +17 -0
- package/components/LoadingError/slots/LoadingErrorSlots.d.ts +14 -0
- package/components/LoadingError/slots/LoadingErrorSlots.js +64 -0
- package/components/LoadingError/slots/index.d.ts +2 -0
- package/components/LoadingError/slots/index.js +1 -0
- package/components/LoadingError/tests/LoadingError.test.d.ts +1 -0
- package/components/LoadingError/types.d.ts +16 -0
- package/components/mui_extended/Typography/typography.styles.js +1 -0
- package/package.json +1 -1
- package/components/LoadingError/classes/constants.d.ts +0 -1
- package/components/LoadingError/classes/constants.js +0 -4
- package/components/LoadingError/classes/index.d.ts +0 -26
- package/components/LoadingError/classes/index.js +0 -39
- package/components/LoadingError/classes/types.d.ts +0 -14
- package/components/LoadingError/styles.d.ts +0 -1
- package/components/LoadingError/styles.js +0 -7
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
import { AreasLoadingErrorProps } from './types';
|
|
2
2
|
/**
|
|
3
|
+
* LoadingError Component
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
5
|
+
* Este componente se utiliza para mostrar un mensaje de error de carga en una aplicación web.
|
|
6
|
+
* Dependiendo del valor de la propiedad `status`, el componente muestra:
|
|
7
|
+
*
|
|
8
|
+
* - Un indicador de progreso (spinner) cuando el status es distinto de "error".
|
|
9
|
+
* - Un mensaje de error personalizado con título, descripción, recomendación y un botón de acción
|
|
10
|
+
* cuando el status es "error". Además, se muestra un ícono de error que puede personalizarse.
|
|
11
|
+
*
|
|
12
|
+
* El componente también se adapta al tamaño del contenedor, ajustando el contenido visualmente
|
|
13
|
+
* mediante el hook `useComponentSize`. Se utiliza un `ResizeObserver` para determinar si el contenedor
|
|
14
|
+
* es lo suficientemente grande y, en caso contrario, ocultar ciertos elementos (por ejemplo, el ícono).
|
|
15
|
+
* @param {AreasLoadingErrorProps} props - Propiedades del componente.
|
|
16
|
+
* @param {string} props.status - Estado de la carga. Si es "error", se muestra el mensaje de error; de lo contrario, se muestra un indicador de progreso.
|
|
17
|
+
* @param {() => void} props.action - Función a ejecutar al hacer clic en el botón, generalmente para reintentar la acción.
|
|
18
|
+
* @param {string} [props.title] - Título del mensaje de error. Si no se proporciona, se usa un valor por defecto obtenido del diccionario.
|
|
19
|
+
* @param {string} [props.description] - Descripción del error. Si no se proporciona, se usa un valor por defecto obtenido del diccionario.
|
|
20
|
+
* @param {string} [props.recommendation] - Texto de recomendación para el usuario. Si no se proporciona, se usa un valor por defecto obtenido del diccionario.
|
|
21
|
+
* @param {string} [props.introMessage] - Mensaje que se muestra en el botón de acción. Si no se proporciona, se usa un valor por defecto obtenido del diccionario.
|
|
22
|
+
* @param {string} [props.errorIcon] - URL del ícono que se mostrará junto al mensaje de error. Si no se especifica, se utiliza un ícono predeterminado.
|
|
23
|
+
* @param {string} [props.className] - Clases CSS adicionales para aplicar al contenedor del componente.
|
|
24
|
+
* @param {string} [props.dataTestId] - Identificador para pruebas.
|
|
25
|
+
* @param {'small' | 'medium' | 'large'} [props.size] - Tamaño del componente, que influye en la visualización de textos y elementos.
|
|
26
|
+
* @example
|
|
27
|
+
* <LoadingError
|
|
28
|
+
* status="error"
|
|
29
|
+
* action={() => console.log("Reintentando...")}
|
|
30
|
+
* title="Error de carga"
|
|
31
|
+
* description="No se pudo cargar la información requerida."
|
|
32
|
+
* recommendation="Intente refrescar la página o contacte al soporte."
|
|
33
|
+
* introMessage="Reintentar"
|
|
34
|
+
* errorIcon="/path/to/custom/error-icon.svg"
|
|
35
|
+
* className="custom-loading-error"
|
|
36
|
+
* dataTestId="loading-error-component"
|
|
37
|
+
* size="medium"
|
|
38
|
+
* />
|
|
39
|
+
* @returns {JSX.Element} Un componente de React que muestra un indicador de progreso o un mensaje de error
|
|
40
|
+
* dependiendo del valor de `status`.
|
|
16
41
|
*/
|
|
17
42
|
export declare const LoadingError: (props: AreasLoadingErrorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,55 +1,93 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { L as
|
|
3
|
+
import { L as LoadingErrorRootStyled, a as LoadingErrorStyled, b as LinearProgressIndeterminateStyled, c as LoadingErrorContainerStyled, d as LoadingErrorContentStyled, e as LoadingErrorImageStyled, f as LoadingErrorTextContainerStyled, g as LoadingErrorTitleDescriptionStyled, h as LoadingErrorDividerStyled, i as LoadingErrorButtonContainerStyled, j as LoadingErrorRecommendationTextStyled } from "./slots/LoadingErrorSlots.js";
|
|
4
|
+
import { a as getComponentSlotRoot } from "../../utils/getComponentSlotRoot.js";
|
|
5
|
+
import { g as getPropDataTestId } from "../../test/getNameDataTestId.js";
|
|
6
|
+
import { L as LOADING_ERROR_KEY_COMPONENT } from "./constants.js";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
import { d as dictionary } from "./dictionary.js";
|
|
9
|
+
import { useRef, useState, useEffect } from "react";
|
|
10
|
+
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
11
|
+
import { L as LoadingErrorSlots } from "./slots/LoadingErrorEnum.js";
|
|
7
12
|
import { T as Typography } from "../mui_extended/Typography/Typography.js";
|
|
8
|
-
import { I as Icon } from "../Icon/Icon.js";
|
|
9
13
|
import { B as Button } from "../mui_extended/Button/Button.js";
|
|
10
14
|
const LoadingError = (props) => {
|
|
11
|
-
const { status, action, title, description, recommendation, introMessage, errorIcon } = props;
|
|
15
|
+
const { status, action, title, description, recommendation, introMessage, errorIcon, className, dataTestId, size = "medium" } = props;
|
|
12
16
|
const { host_static_assets, environment_assets } = useEnvironment();
|
|
13
17
|
const { getLabel } = useModuleDictionary();
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const { currentSize } = useComponentSize(size);
|
|
19
|
+
const normalizedSize = currentSize === "large" ? "medium" : currentSize;
|
|
20
|
+
const ownerState = {
|
|
21
|
+
size: normalizedSize
|
|
22
|
+
};
|
|
23
|
+
const containerRef = useRef(null);
|
|
24
|
+
const [isVisible, setIsVisible] = useState(true);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const observer = new ResizeObserver((entries) => {
|
|
27
|
+
for (const entry of entries) {
|
|
28
|
+
setIsVisible(entry.contentRect.height >= 200);
|
|
21
29
|
}
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
});
|
|
31
|
+
if (containerRef.current) {
|
|
32
|
+
observer.observe(containerRef.current);
|
|
33
|
+
}
|
|
34
|
+
return () => observer.disconnect();
|
|
35
|
+
}, []);
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
LoadingErrorRootStyled,
|
|
38
|
+
{
|
|
39
|
+
ref: containerRef,
|
|
40
|
+
ownerState,
|
|
41
|
+
className: clsx(getComponentSlotRoot(LOADING_ERROR_KEY_COMPONENT), className),
|
|
42
|
+
...getPropDataTestId(LOADING_ERROR_KEY_COMPONENT, LoadingErrorSlots.root, dataTestId),
|
|
43
|
+
children: status !== "error" ? /* @__PURE__ */ jsx(LoadingErrorStyled, { children: /* @__PURE__ */ jsx(LinearProgressIndeterminateStyled, {}) }) : /* @__PURE__ */ jsx(LoadingErrorContainerStyled, { children: /* @__PURE__ */ jsxs(LoadingErrorContentStyled, { children: [
|
|
44
|
+
isVisible && /* @__PURE__ */ jsx(
|
|
45
|
+
LoadingErrorImageStyled,
|
|
46
|
+
{
|
|
47
|
+
size,
|
|
48
|
+
src: errorIcon ? errorIcon : `${host_static_assets}/${environment_assets}/frontend/components/loading_error/assets/icons/LoadingError.svg`
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsxs(LoadingErrorTextContainerStyled, { children: [
|
|
52
|
+
/* @__PURE__ */ jsxs(LoadingErrorTitleDescriptionStyled, { children: [
|
|
53
|
+
/* @__PURE__ */ jsx(Typography, { size, variant: "h5", skeletonWidth: "100px", children: title ? title : getLabel(dictionary.LABEL_ERROR_TITLE) }),
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
Typography,
|
|
56
|
+
{
|
|
57
|
+
size,
|
|
58
|
+
variant: "paragraph",
|
|
59
|
+
skeletonWidth: "100px",
|
|
60
|
+
children: description ? description : getLabel(dictionary.LABEL_ERROR_DESCRIPTION)
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] }),
|
|
64
|
+
/* @__PURE__ */ jsx(LoadingErrorDividerStyled, {}),
|
|
65
|
+
/* @__PURE__ */ jsxs(LoadingErrorButtonContainerStyled, { children: [
|
|
66
|
+
/* @__PURE__ */ jsx(
|
|
67
|
+
LoadingErrorRecommendationTextStyled,
|
|
68
|
+
{
|
|
69
|
+
size,
|
|
70
|
+
variant: "paragraph",
|
|
71
|
+
skeletonWidth: "100px",
|
|
72
|
+
children: recommendation ? recommendation : getLabel(dictionary.LABEL_ERROR_RECOMMENDATION)
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ jsx(
|
|
76
|
+
Button,
|
|
77
|
+
{
|
|
78
|
+
size,
|
|
79
|
+
variant: "contained",
|
|
80
|
+
color: "primary",
|
|
81
|
+
startIcon: `${host_static_assets}/${environment_assets}/frontend/components/loading_error/assets/icons/refresh.svg`,
|
|
82
|
+
onClick: action,
|
|
83
|
+
label: introMessage ? introMessage : getLabel(dictionary.LABEL_ERROR_INTRO)
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] })
|
|
87
|
+
] })
|
|
88
|
+
] }) })
|
|
89
|
+
}
|
|
90
|
+
);
|
|
53
91
|
};
|
|
54
92
|
export {
|
|
55
93
|
LoadingError as L
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const loadingErrorStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Styles for Root.
|
|
4
|
+
*/
|
|
5
|
+
root: () => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexDirection: "column",
|
|
8
|
+
justifyContent: "center",
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
position: "relative",
|
|
11
|
+
inset: "0",
|
|
12
|
+
overflow: "hidden",
|
|
13
|
+
width: "100%",
|
|
14
|
+
height: "100%"
|
|
15
|
+
}),
|
|
16
|
+
/**
|
|
17
|
+
* Styles for LoadingError.
|
|
18
|
+
*/
|
|
19
|
+
loadingError: ({ theme }) => ({
|
|
20
|
+
width: "100%",
|
|
21
|
+
height: "100%",
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexDirection: "column",
|
|
24
|
+
justifyContent: "center",
|
|
25
|
+
alignItems: "center",
|
|
26
|
+
minHeight: theme.vars.size.baseSpacings.sp1
|
|
27
|
+
}),
|
|
28
|
+
/**
|
|
29
|
+
* Styles for LoadingErrorContent.
|
|
30
|
+
*/
|
|
31
|
+
loadingErrorContent: ({ theme }) => ({
|
|
32
|
+
display: "flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
width: "268px",
|
|
35
|
+
gap: theme.vars.size.baseSpacings.sp5,
|
|
36
|
+
padding: theme.vars.size.baseSpacings.sp3,
|
|
37
|
+
alignContent: "center",
|
|
38
|
+
justifyContent: "center",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
height: "100%"
|
|
42
|
+
}),
|
|
43
|
+
/**
|
|
44
|
+
* Styles for LoadingErrorTitleDescription.
|
|
45
|
+
*/
|
|
46
|
+
loadingErrorTitleDescription: ({ theme }) => ({
|
|
47
|
+
textAlign: "center",
|
|
48
|
+
flexDirection: "column",
|
|
49
|
+
display: "flex",
|
|
50
|
+
gap: theme.vars.size.baseSpacings["sp0-5"]
|
|
51
|
+
}),
|
|
52
|
+
/**
|
|
53
|
+
* Styles for loadingErrorImage.
|
|
54
|
+
*/
|
|
55
|
+
loadingErrorImage: () => ({
|
|
56
|
+
width: "auto",
|
|
57
|
+
height: "114px",
|
|
58
|
+
maxHeight: "114px",
|
|
59
|
+
minHeight: "60px"
|
|
60
|
+
}),
|
|
61
|
+
/**
|
|
62
|
+
* Styles for LoadingErrorDivider.
|
|
63
|
+
*/
|
|
64
|
+
loadingErrorDivider: ({ theme }) => ({
|
|
65
|
+
width: "100%",
|
|
66
|
+
height: "1px",
|
|
67
|
+
display: "flex",
|
|
68
|
+
flexDirection: "column",
|
|
69
|
+
justifyContent: "center",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
gap: theme.vars.size.baseSpacings.sp3,
|
|
72
|
+
alignSelf: "stretch",
|
|
73
|
+
backgroundColor: theme.vars.palette.border.secondary
|
|
74
|
+
}),
|
|
75
|
+
/**
|
|
76
|
+
* Styles for LoadingErrorContainer.
|
|
77
|
+
*/
|
|
78
|
+
loadingErrorContainer: () => ({
|
|
79
|
+
display: "flex",
|
|
80
|
+
flexDirection: "column",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
height: "100%"
|
|
84
|
+
}),
|
|
85
|
+
/**
|
|
86
|
+
* Styles for LoadingErrorTextContainerStyled.
|
|
87
|
+
*/
|
|
88
|
+
loadingErrorTextContainer: ({ theme }) => ({
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexDirection: "column",
|
|
91
|
+
justifyContent: "center",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
gap: theme.vars.size.baseSpacings.sp3
|
|
94
|
+
}),
|
|
95
|
+
/**
|
|
96
|
+
* Styles for LoadingErrorButtonContainerStyled.
|
|
97
|
+
*/
|
|
98
|
+
loadingErrorButtonContainer: ({ theme }) => ({
|
|
99
|
+
display: "flex",
|
|
100
|
+
flexDirection: "column",
|
|
101
|
+
justifyContent: "center",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
gap: theme.vars.size.baseSpacings.sp2,
|
|
104
|
+
alignSelf: "stretch"
|
|
105
|
+
}),
|
|
106
|
+
/**
|
|
107
|
+
* Styles for LoadingErrorRecommendationTextStyled.
|
|
108
|
+
*/
|
|
109
|
+
loadingErrorRecommendationText: ({ theme }) => ({
|
|
110
|
+
color: `${theme.vars.palette.text.secondary} !important`
|
|
111
|
+
}),
|
|
112
|
+
/**
|
|
113
|
+
* Styles for LinearProgressIndeterminateStyled.
|
|
114
|
+
*/
|
|
115
|
+
linearProgressIndeterminate: () => ({
|
|
116
|
+
top: "unset"
|
|
117
|
+
})
|
|
118
|
+
};
|
|
119
|
+
export {
|
|
120
|
+
loadingErrorStyles as l
|
|
121
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOADING_ERROR_KEY_COMPONENT = "M4LLoadingError";
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
export declare const LOADING_ERROR_DICTIONARY_KEY = "loading_error";
|
|
2
|
+
export declare const dictionary: {
|
|
3
|
+
LABEL_ERROR_DESCRIPTION: string;
|
|
4
|
+
LABEL_ERROR_INTRO: string;
|
|
5
|
+
LABEL_ERROR_RECOMMENDATION: string;
|
|
6
|
+
LABEL_ERROR_TITLE: string;
|
|
7
|
+
};
|
|
1
8
|
export declare const getLoadingErrorComponentsDictionary: () => string[];
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
const LOADING_ERROR_DICTIONARY_KEY = `loading_error`;
|
|
2
|
+
const dictionary = {
|
|
3
|
+
LABEL_ERROR_DESCRIPTION: `${LOADING_ERROR_DICTIONARY_KEY}.label_error_description`,
|
|
4
|
+
LABEL_ERROR_INTRO: `${LOADING_ERROR_DICTIONARY_KEY}.label_error_intro`,
|
|
5
|
+
LABEL_ERROR_RECOMMENDATION: `${LOADING_ERROR_DICTIONARY_KEY}.label_error_recommendation`,
|
|
6
|
+
LABEL_ERROR_TITLE: `${LOADING_ERROR_DICTIONARY_KEY}.label_error_title`
|
|
7
|
+
};
|
|
1
8
|
const getLoadingErrorComponentsDictionary = () => {
|
|
2
|
-
return [
|
|
9
|
+
return [LOADING_ERROR_DICTIONARY_KEY];
|
|
3
10
|
};
|
|
4
11
|
export {
|
|
12
|
+
dictionary as d,
|
|
5
13
|
getLoadingErrorComponentsDictionary as g
|
|
6
14
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare enum LoadingErrorSlots {
|
|
2
|
+
root = "root",
|
|
3
|
+
loadingError = "loadingError",
|
|
4
|
+
loadingErrorContent = "loadingErrorContent",
|
|
5
|
+
loadingErrorTitleDescription = "loadingErrorTitleDescription",
|
|
6
|
+
loadingErrorImage = "loadingErrorImage",
|
|
7
|
+
loadingErrorDivider = "loadingErrorDivider",
|
|
8
|
+
loadingErrorContainer = "loadingErrorContainer",
|
|
9
|
+
loadingErrorTextContainer = "loadingErrorTextContainer",
|
|
10
|
+
loadingErrorButtonContainer = "loadingErrorButtonContainer",
|
|
11
|
+
loadingErrorRecommendationText = "loadingErrorRecommendationText",
|
|
12
|
+
linearProgressIndeterminate = "linearProgressIndeterminate"
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var LoadingErrorSlots = /* @__PURE__ */ ((LoadingErrorSlots2) => {
|
|
2
|
+
LoadingErrorSlots2["root"] = "root";
|
|
3
|
+
LoadingErrorSlots2["loadingError"] = "loadingError";
|
|
4
|
+
LoadingErrorSlots2["loadingErrorContent"] = "loadingErrorContent";
|
|
5
|
+
LoadingErrorSlots2["loadingErrorTitleDescription"] = "loadingErrorTitleDescription";
|
|
6
|
+
LoadingErrorSlots2["loadingErrorImage"] = "loadingErrorImage";
|
|
7
|
+
LoadingErrorSlots2["loadingErrorDivider"] = "loadingErrorDivider";
|
|
8
|
+
LoadingErrorSlots2["loadingErrorContainer"] = "loadingErrorContainer";
|
|
9
|
+
LoadingErrorSlots2["loadingErrorTextContainer"] = "loadingErrorTextContainer";
|
|
10
|
+
LoadingErrorSlots2["loadingErrorButtonContainer"] = "loadingErrorButtonContainer";
|
|
11
|
+
LoadingErrorSlots2["loadingErrorRecommendationText"] = "loadingErrorRecommendationText";
|
|
12
|
+
LoadingErrorSlots2["linearProgressIndeterminate"] = "linearProgressIndeterminate";
|
|
13
|
+
return LoadingErrorSlots2;
|
|
14
|
+
})(LoadingErrorSlots || {});
|
|
15
|
+
export {
|
|
16
|
+
LoadingErrorSlots as L
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root component
|
|
3
|
+
*/
|
|
4
|
+
export declare const LoadingErrorRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
5
|
+
export declare const LoadingErrorStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
6
|
+
export declare const LoadingErrorContentStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
7
|
+
export declare const LoadingErrorTitleDescriptionStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
8
|
+
export declare const LoadingErrorImageStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Image').ImageProps, keyof import('../../Image').ImageProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
9
|
+
export declare const LoadingErrorDividerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
10
|
+
export declare const LoadingErrorContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
11
|
+
export declare const LoadingErrorTextContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
12
|
+
export declare const LoadingErrorButtonContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
13
|
+
export declare const LoadingErrorRecommendationTextStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, {}, {}>;
|
|
14
|
+
export declare const LinearProgressIndeterminateStyled: import('@emotion/styled').StyledComponent<Pick<import('../../LinearProgressIndeterminate/types').LinearProgressIndeterminateProps, keyof import('../../LinearProgressIndeterminate/types').LinearProgressIndeterminateProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, {}, {}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { L as LOADING_ERROR_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { L as LoadingErrorSlots } from "./LoadingErrorEnum.js";
|
|
4
|
+
import { l as loadingErrorStyles } from "../LoadingError.styles.js";
|
|
5
|
+
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
6
|
+
import { L as LinearProgressIndeterminate } from "../../LinearProgressIndeterminate/LinearProgressIndeterminate.js";
|
|
7
|
+
import { I as Image } from "../../Image/Image.js";
|
|
8
|
+
const LoadingErrorRootStyled = styled("div", {
|
|
9
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
10
|
+
slot: LoadingErrorSlots.root
|
|
11
|
+
})(loadingErrorStyles.root);
|
|
12
|
+
const LoadingErrorStyled = styled("div", {
|
|
13
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
14
|
+
slot: LoadingErrorSlots.loadingError
|
|
15
|
+
})(loadingErrorStyles.loadingError);
|
|
16
|
+
const LoadingErrorContentStyled = styled("div", {
|
|
17
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
18
|
+
slot: LoadingErrorSlots.loadingErrorContent
|
|
19
|
+
})(loadingErrorStyles.loadingErrorContent);
|
|
20
|
+
const LoadingErrorTitleDescriptionStyled = styled("div", {
|
|
21
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
22
|
+
slot: LoadingErrorSlots.loadingErrorTitleDescription
|
|
23
|
+
})(loadingErrorStyles.loadingErrorTitleDescription);
|
|
24
|
+
const LoadingErrorImageStyled = styled(Image, {
|
|
25
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
26
|
+
slot: LoadingErrorSlots.loadingErrorImage
|
|
27
|
+
})(loadingErrorStyles.loadingErrorImage);
|
|
28
|
+
const LoadingErrorDividerStyled = styled("div", {
|
|
29
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
30
|
+
slot: LoadingErrorSlots.loadingErrorDivider
|
|
31
|
+
})(loadingErrorStyles.loadingErrorDivider);
|
|
32
|
+
const LoadingErrorContainerStyled = styled("div", {
|
|
33
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
34
|
+
slot: LoadingErrorSlots.loadingErrorContainer
|
|
35
|
+
})(loadingErrorStyles.loadingErrorContainer);
|
|
36
|
+
const LoadingErrorTextContainerStyled = styled("div", {
|
|
37
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
38
|
+
slot: LoadingErrorSlots.loadingErrorTextContainer
|
|
39
|
+
})(loadingErrorStyles.loadingErrorTextContainer);
|
|
40
|
+
const LoadingErrorButtonContainerStyled = styled("div", {
|
|
41
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
42
|
+
slot: LoadingErrorSlots.loadingErrorButtonContainer
|
|
43
|
+
})(loadingErrorStyles.loadingErrorButtonContainer);
|
|
44
|
+
const LoadingErrorRecommendationTextStyled = styled(Typography, {
|
|
45
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
46
|
+
slot: LoadingErrorSlots.loadingErrorRecommendationText
|
|
47
|
+
})(loadingErrorStyles.loadingErrorRecommendationText);
|
|
48
|
+
const LinearProgressIndeterminateStyled = styled(LinearProgressIndeterminate, {
|
|
49
|
+
name: LOADING_ERROR_KEY_COMPONENT,
|
|
50
|
+
slot: LoadingErrorSlots.linearProgressIndeterminate
|
|
51
|
+
})(loadingErrorStyles.linearProgressIndeterminate);
|
|
52
|
+
export {
|
|
53
|
+
LoadingErrorRootStyled as L,
|
|
54
|
+
LoadingErrorStyled as a,
|
|
55
|
+
LinearProgressIndeterminateStyled as b,
|
|
56
|
+
LoadingErrorContainerStyled as c,
|
|
57
|
+
LoadingErrorContentStyled as d,
|
|
58
|
+
LoadingErrorImageStyled as e,
|
|
59
|
+
LoadingErrorTextContainerStyled as f,
|
|
60
|
+
LoadingErrorTitleDescriptionStyled as g,
|
|
61
|
+
LoadingErrorDividerStyled as h,
|
|
62
|
+
LoadingErrorButtonContainerStyled as i,
|
|
63
|
+
LoadingErrorRecommendationTextStyled as j
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
1
2
|
import { AreaStatus, AreasStatus } from '../areas/contexts/AreasContext/types';
|
|
3
|
+
import { LOADING_ERROR_KEY_COMPONENT } from './constants';
|
|
4
|
+
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
5
|
+
import { LoadingErrorSlots } from './slots/LoadingErrorEnum';
|
|
6
|
+
import { Sizes } from '@m4l/styles';
|
|
2
7
|
export interface AreasLoadingErrorProps {
|
|
3
8
|
/**Indica el estado actual del componente. Puede tener valores como 'error', 'cargando' u otros estados definidos por la aplicación. */
|
|
4
9
|
status: AreasStatus | AreaStatus;
|
|
@@ -14,4 +19,15 @@ export interface AreasLoadingErrorProps {
|
|
|
14
19
|
introMessage?: string;
|
|
15
20
|
/**Es una cadena de texto que representa la ruta o el identificador del ícono que se mostrará junto al mensaje de error. */
|
|
16
21
|
errorIcon?: string;
|
|
22
|
+
/**Clase CSS que se aplicará al componente. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/**Identificador de datos de prueba que se aplicará al componente. */
|
|
25
|
+
dataTestId?: string;
|
|
26
|
+
/**Tamaño del componente. */
|
|
27
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
17
28
|
}
|
|
29
|
+
export type LoadingErrorOwnerState = {
|
|
30
|
+
size?: AreasLoadingErrorProps['size'];
|
|
31
|
+
};
|
|
32
|
+
export type LoadingErrorType = keyof typeof LoadingErrorSlots;
|
|
33
|
+
export type LoadingErrorStyles = OverridesStyleRules<LoadingErrorType, typeof LOADING_ERROR_KEY_COMPONENT, Theme>;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const componentName = "M4LoadingError";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { LoadingErrorClassesType } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Clases de utilidad para el componente de carga de error.
|
|
4
|
-
*/
|
|
5
|
-
export declare const loadingErrorClasses: LoadingErrorClassesType;
|
|
6
|
-
/**
|
|
7
|
-
* Obtiene la clase de utilidad para un slot específico del componente de carga de error.
|
|
8
|
-
* @param slot El slot para el que se desea obtener la clase de utilidad.
|
|
9
|
-
* @returns La clase de utilidad correspondiente al slot especificado.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getLoadingErrorUtilityClass(slot: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Función para generar todas las clases de utilidad del componente de carga de error.
|
|
14
|
-
* @returns Un objeto que contiene todas las clases de utilidad generadas.
|
|
15
|
-
*/
|
|
16
|
-
export declare const loadingErrorUtilityClasses: () => {
|
|
17
|
-
root: string;
|
|
18
|
-
loadingErrorLoading: string;
|
|
19
|
-
loadingError: string;
|
|
20
|
-
loadingErrorIcon: string;
|
|
21
|
-
loadingErrorTitle: string;
|
|
22
|
-
loadingErrorDescription: string;
|
|
23
|
-
loadingErrorDivider: string;
|
|
24
|
-
loadingErrorTextAction: string;
|
|
25
|
-
titleDescription: string;
|
|
26
|
-
};
|
|
@@ -1,39 +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(componentName, [
|
|
5
|
-
/* elements */
|
|
6
|
-
"root",
|
|
7
|
-
"loadingErrorLoading",
|
|
8
|
-
"loadingError",
|
|
9
|
-
"loadingErrorIcon",
|
|
10
|
-
"loadingErrorTitle",
|
|
11
|
-
"loadingErrorDescription",
|
|
12
|
-
"loadingErrorDivider",
|
|
13
|
-
"loadingErrorTextAction",
|
|
14
|
-
"titleDescription"
|
|
15
|
-
/* states or variants of elements */
|
|
16
|
-
]);
|
|
17
|
-
function getLoadingErrorUtilityClass(slot) {
|
|
18
|
-
return generateUtilityClass(componentName, slot);
|
|
19
|
-
}
|
|
20
|
-
const loadingErrorUtilityClasses = () => {
|
|
21
|
-
const slots = {
|
|
22
|
-
root: ["root"],
|
|
23
|
-
loadingErrorLoading: ["loadingErrorLoading"],
|
|
24
|
-
loadingError: ["loadingError"],
|
|
25
|
-
loadingErrorIcon: ["loadingErrorIcon"],
|
|
26
|
-
loadingErrorTitle: ["loadingErrorTitle"],
|
|
27
|
-
loadingErrorDescription: ["loadingErrorDescription"],
|
|
28
|
-
loadingErrorDivider: ["loadingErrorDivider"],
|
|
29
|
-
loadingErrorTextAction: ["loadingErrorTextAction"],
|
|
30
|
-
titleDescription: ["titleDescription"]
|
|
31
|
-
};
|
|
32
|
-
const composedClasses = unstable_composeClasses(slots, getLoadingErrorUtilityClass, {});
|
|
33
|
-
return {
|
|
34
|
-
...composedClasses
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
loadingErrorUtilityClasses as l
|
|
39
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { loadingErrorUtilityClasses } from '.';
|
|
2
|
-
export interface LoadingErrorClassesType {
|
|
3
|
-
root: string;
|
|
4
|
-
loadingErrorLoading: string;
|
|
5
|
-
loadingError: string;
|
|
6
|
-
loadingErrorIcon: string;
|
|
7
|
-
loadingErrorTitle: string;
|
|
8
|
-
loadingErrorDescription: string;
|
|
9
|
-
loadingErrorDivider: string;
|
|
10
|
-
loadingErrorTextAction: string;
|
|
11
|
-
titleDescription: string;
|
|
12
|
-
}
|
|
13
|
-
export type MFLoaderClassesKey = keyof LoadingErrorClassesType;
|
|
14
|
-
export type Classes = ReturnType<typeof loadingErrorUtilityClasses>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LoadingErrorRoot: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme>, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|