@votodigital-onpeui/react 0.1.25 → 0.1.26
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/README.md +1 -0
- package/dist/ModalConfirm-C4BK0cGl.d.mts +37 -0
- package/dist/ModalConfirm-C4BK0cGl.d.ts +37 -0
- package/dist/chunk-426NZGHO.mjs +243 -0
- package/dist/chunk-426NZGHO.mjs.map +1 -0
- package/dist/{chunk-JVG534KO.mjs → chunk-CPJUTDYS.mjs} +48 -4
- package/dist/chunk-CPJUTDYS.mjs.map +1 -0
- package/dist/{chunk-UXPABYEO.mjs → chunk-GQ2JGOWC.mjs} +4 -136
- package/dist/chunk-GQ2JGOWC.mjs.map +1 -0
- package/dist/components.d.mts +2 -20
- package/dist/components.d.ts +2 -20
- package/dist/components.js +38 -31
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +3 -4
- package/dist/icons.mjs +1 -2
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +37 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -4
- package/dist/modal.d.mts +37 -39
- package/dist/modal.d.ts +37 -39
- package/dist/modal.js +95 -97
- package/dist/modal.js.map +1 -1
- package/dist/modal.mjs +24 -161
- package/dist/modal.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-65JI3EPO.mjs +0 -51
- package/dist/chunk-65JI3EPO.mjs.map +0 -1
- package/dist/chunk-7T7V5NBO.mjs +0 -107
- package/dist/chunk-7T7V5NBO.mjs.map +0 -1
- package/dist/chunk-JVG534KO.mjs.map +0 -1
- package/dist/chunk-UXPABYEO.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { BrowserRecommended, Footer, ModalBrowserIncompatible,
|
|
2
|
-
export { FaceBookIcon, IconAndroid, IconApple, IconChrome, IconChromeColor, IconClose, IconEdge, IconEdgeColor, IconElectionsGeneral, IconElectionsRegionalesYMunicipales, IconHome, IconHuawei, IconLogoONPE, IconMozilla, IconMozillaColor, IconPhone, IconSafari, IconSafariColor, IconVotoDigital, IconWarning, IconWindow, InstagramIcon, TikTokIcon, WhatsappIcon, XIcon, YoutubeIcon } from './chunk-JVG534KO.mjs';
|
|
1
|
+
export { BrowserRecommended, Footer, ModalBrowserIncompatible, ModalDnieVersions, ModalNfc, ModalSystemIncompatible, NotRecommended, Overlay, Show } from './chunk-GQ2JGOWC.mjs';
|
|
3
2
|
export { OnpeIdModal, useIframeCommunication, useIframePreload, useModalIframePreload, useOnpeIdAuth, useSendMessageToIframe, useSocketConnection } from './chunk-QHN5HB7P.mjs';
|
|
4
3
|
import './chunk-KWOWOGBU.mjs';
|
|
5
|
-
export { Button, ModalLoading } from './chunk-
|
|
6
|
-
export { IconCheck, IconInfo, IconSpinnerDesktop, IconSpinnerMobile, IconWarningNotRecommended } from './chunk-
|
|
4
|
+
export { Button, ModalConfirm, ModalLoading } from './chunk-426NZGHO.mjs';
|
|
5
|
+
export { FaceBookIcon, IconAndroid, IconApple, IconCheck, IconChrome, IconChromeColor, IconClose, IconEdge, IconEdgeColor, IconElectionsGeneral, IconElectionsRegionalesYMunicipales, IconHome, IconHuawei, IconInfo, IconLogoONPE, IconMozilla, IconMozillaColor, IconPhone, IconSafari, IconSafariColor, IconSpinnerDesktop, IconSpinnerMobile, IconVotoDigital, IconWarning, IconWarningNotRecommended, IconWindow, InstagramIcon, TikTokIcon, WhatsappIcon, XIcon, YoutubeIcon } from './chunk-CPJUTDYS.mjs';
|
|
7
6
|
export { Modal, Portal } from './chunk-EZQGWVW2.mjs';
|
|
8
7
|
export { IconCloseRadius } from './chunk-5FNWA3QC.mjs';
|
|
9
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/modal.d.mts
CHANGED
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
|
+
import { b as ModalType } from './ModalConfirm-C4BK0cGl.mjs';
|
|
4
5
|
|
|
5
6
|
interface ModalGlobalProviderProps {
|
|
6
7
|
children: ReactNode;
|
|
7
|
-
/** z-index
|
|
8
|
+
/** z-index del modal principal (default: 200) */
|
|
8
9
|
zIndexLevel?: number;
|
|
9
|
-
/** z-index
|
|
10
|
+
/** z-index del modal de loading (default: 300) */
|
|
10
11
|
zIndexLoading?: number;
|
|
11
|
-
/** z-index
|
|
12
|
+
/** z-index del modal de loading con porcentaje (default: 300) */
|
|
12
13
|
zIndexLoadingPercentage?: number;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* Envuelve tu app (o layout) con este provider.
|
|
17
|
+
* Renderiza ModalConfirm, ModalLoading y ModalLoadingPercentage vía portals.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* // _app.tsx or layout.tsx
|
|
19
|
+
* @example
|
|
20
|
+
* // layout.tsx
|
|
21
21
|
* <ModalGlobalProvider>
|
|
22
22
|
* {children}
|
|
23
23
|
* </ModalGlobalProvider>
|
|
24
|
-
* ```
|
|
25
24
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* } from "@votodigital-onpeui/react";
|
|
33
|
-
* ```
|
|
25
|
+
* // Desde cualquier parte del código:
|
|
26
|
+
* import { showGlobalModal, showGlobalLoading, closeGlobalLoading } from "@votodigital-onpeui/react/modal";
|
|
27
|
+
*
|
|
28
|
+
* await showGlobalModal({ title: "¿Continuar?", twoButtons: true });
|
|
29
|
+
* showGlobalLoading("Procesando...");
|
|
30
|
+
* closeGlobalLoading();
|
|
34
31
|
*/
|
|
35
32
|
declare const ModalGlobalProvider: ({ children, zIndexLevel, zIndexLoading, zIndexLoadingPercentage, }: ModalGlobalProviderProps) => react_jsx_runtime.JSX.Element;
|
|
36
33
|
|
|
37
|
-
type ModalType = "error" | "success" | "warning" | "question";
|
|
38
34
|
type ModalResult = "confirm" | "cancel" | "close";
|
|
39
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Payload del modal global.
|
|
37
|
+
* Combina los props de ModalGlobalComponent (type, buttonMode, content)
|
|
38
|
+
* con los de ModalConfirm (icon, color, twoButtons).
|
|
39
|
+
* Los props del global component predominan; color e icon son overrides manuales.
|
|
40
|
+
*/
|
|
40
41
|
interface ModalPayload {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
message
|
|
45
|
-
/** Custom JSX content — replaces message when provided */
|
|
42
|
+
title: string;
|
|
43
|
+
/** Contenido del modal (string o JSX). Alias: content */
|
|
44
|
+
message?: ReactNode;
|
|
45
|
+
/** Alias de message para compatibilidad */
|
|
46
46
|
content?: ReactNode;
|
|
47
|
+
/** Tipo semántico: determina color de icono, título y botón */
|
|
48
|
+
type?: ModalType;
|
|
49
|
+
/** "double" muestra el botón cancelar */
|
|
50
|
+
buttonMode?: "single" | "double";
|
|
51
|
+
/** Deshabilita el botón confirmar */
|
|
52
|
+
disabledConfirmButton?: boolean;
|
|
53
|
+
/** Deshabilita el cierre del modal */
|
|
54
|
+
closeDisabled?: boolean;
|
|
55
|
+
/** Override manual del color del icono y título */
|
|
56
|
+
color?: "red" | "blue" | "skyblue" | "yellow";
|
|
47
57
|
onConfirm?: () => void | Promise<void>;
|
|
48
58
|
onCancel?: () => void | Promise<void>;
|
|
49
|
-
buttonMode?: ButtonMode;
|
|
50
59
|
textButtonConfirm?: string;
|
|
51
60
|
textButtonCancel?: string;
|
|
52
|
-
disabledConfirmButton?: boolean;
|
|
53
|
-
closeDisabled?: boolean;
|
|
54
61
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
62
|
+
* Marca este modal como controlado por axios interceptor.
|
|
63
|
+
* Cuando es true, los handlers de cambio de ruta NO deben cerrarlo.
|
|
57
64
|
*/
|
|
58
65
|
alreadyHandled?: boolean;
|
|
59
66
|
}
|
|
@@ -70,15 +77,6 @@ interface ModalGlobalState {
|
|
|
70
77
|
}
|
|
71
78
|
declare const useModalGlobalStore: zustand.UseBoundStore<zustand.StoreApi<ModalGlobalState>>;
|
|
72
79
|
|
|
73
|
-
interface ModalGlobalComponentProps extends ModalPayload {
|
|
74
|
-
isOpen: boolean;
|
|
75
|
-
onConfirmAction: () => void;
|
|
76
|
-
onCancelAction: () => void;
|
|
77
|
-
onCloseAction: () => void;
|
|
78
|
-
zIndexLevel?: number;
|
|
79
|
-
}
|
|
80
|
-
declare const ModalGlobalComponent: ({ isOpen, type, title, message, content, onConfirm, onCancel, buttonMode, textButtonConfirm, textButtonCancel, disabledConfirmButton, closeDisabled, onConfirmAction, onCancelAction, onCloseAction, zIndexLevel, }: ModalGlobalComponentProps) => react_jsx_runtime.JSX.Element;
|
|
81
|
-
|
|
82
80
|
interface ModalLoadingState {
|
|
83
81
|
isOpen: boolean;
|
|
84
82
|
message: string;
|
|
@@ -186,4 +184,4 @@ declare const closeGlobalLoadingPercentage: () => void;
|
|
|
186
184
|
/** Returns true if the global loading percentage modal is currently visible. */
|
|
187
185
|
declare const isGlobalLoadingPercentageOpen: () => boolean;
|
|
188
186
|
|
|
189
|
-
export {
|
|
187
|
+
export { ModalGlobalProvider, type ModalPayload, type ModalResult, ModalType, closeGlobalLoading, closeGlobalLoadingPercentage, closeGlobalModal, isAlreadyHandled, isGlobalLoadingOpen, isGlobalLoadingPercentageOpen, isGlobalModalOpen, showGlobalLoading, showGlobalLoadingPercentage, showGlobalModal, showGlobalModalWithClose, updateGlobalLoadingPercentage, useModalGlobalStore, useModalLoadingPercentageStore, useModalLoadingStore };
|
package/dist/modal.d.ts
CHANGED
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as zustand from 'zustand';
|
|
4
|
+
import { b as ModalType } from './ModalConfirm-C4BK0cGl.js';
|
|
4
5
|
|
|
5
6
|
interface ModalGlobalProviderProps {
|
|
6
7
|
children: ReactNode;
|
|
7
|
-
/** z-index
|
|
8
|
+
/** z-index del modal principal (default: 200) */
|
|
8
9
|
zIndexLevel?: number;
|
|
9
|
-
/** z-index
|
|
10
|
+
/** z-index del modal de loading (default: 300) */
|
|
10
11
|
zIndexLoading?: number;
|
|
11
|
-
/** z-index
|
|
12
|
+
/** z-index del modal de loading con porcentaje (default: 300) */
|
|
12
13
|
zIndexLoadingPercentage?: number;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* Envuelve tu app (o layout) con este provider.
|
|
17
|
+
* Renderiza ModalConfirm, ModalLoading y ModalLoadingPercentage vía portals.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* // _app.tsx or layout.tsx
|
|
19
|
+
* @example
|
|
20
|
+
* // layout.tsx
|
|
21
21
|
* <ModalGlobalProvider>
|
|
22
22
|
* {children}
|
|
23
23
|
* </ModalGlobalProvider>
|
|
24
|
-
* ```
|
|
25
24
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* } from "@votodigital-onpeui/react";
|
|
33
|
-
* ```
|
|
25
|
+
* // Desde cualquier parte del código:
|
|
26
|
+
* import { showGlobalModal, showGlobalLoading, closeGlobalLoading } from "@votodigital-onpeui/react/modal";
|
|
27
|
+
*
|
|
28
|
+
* await showGlobalModal({ title: "¿Continuar?", twoButtons: true });
|
|
29
|
+
* showGlobalLoading("Procesando...");
|
|
30
|
+
* closeGlobalLoading();
|
|
34
31
|
*/
|
|
35
32
|
declare const ModalGlobalProvider: ({ children, zIndexLevel, zIndexLoading, zIndexLoadingPercentage, }: ModalGlobalProviderProps) => react_jsx_runtime.JSX.Element;
|
|
36
33
|
|
|
37
|
-
type ModalType = "error" | "success" | "warning" | "question";
|
|
38
34
|
type ModalResult = "confirm" | "cancel" | "close";
|
|
39
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Payload del modal global.
|
|
37
|
+
* Combina los props de ModalGlobalComponent (type, buttonMode, content)
|
|
38
|
+
* con los de ModalConfirm (icon, color, twoButtons).
|
|
39
|
+
* Los props del global component predominan; color e icon son overrides manuales.
|
|
40
|
+
*/
|
|
40
41
|
interface ModalPayload {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
message
|
|
45
|
-
/** Custom JSX content — replaces message when provided */
|
|
42
|
+
title: string;
|
|
43
|
+
/** Contenido del modal (string o JSX). Alias: content */
|
|
44
|
+
message?: ReactNode;
|
|
45
|
+
/** Alias de message para compatibilidad */
|
|
46
46
|
content?: ReactNode;
|
|
47
|
+
/** Tipo semántico: determina color de icono, título y botón */
|
|
48
|
+
type?: ModalType;
|
|
49
|
+
/** "double" muestra el botón cancelar */
|
|
50
|
+
buttonMode?: "single" | "double";
|
|
51
|
+
/** Deshabilita el botón confirmar */
|
|
52
|
+
disabledConfirmButton?: boolean;
|
|
53
|
+
/** Deshabilita el cierre del modal */
|
|
54
|
+
closeDisabled?: boolean;
|
|
55
|
+
/** Override manual del color del icono y título */
|
|
56
|
+
color?: "red" | "blue" | "skyblue" | "yellow";
|
|
47
57
|
onConfirm?: () => void | Promise<void>;
|
|
48
58
|
onCancel?: () => void | Promise<void>;
|
|
49
|
-
buttonMode?: ButtonMode;
|
|
50
59
|
textButtonConfirm?: string;
|
|
51
60
|
textButtonCancel?: string;
|
|
52
|
-
disabledConfirmButton?: boolean;
|
|
53
|
-
closeDisabled?: boolean;
|
|
54
61
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
62
|
+
* Marca este modal como controlado por axios interceptor.
|
|
63
|
+
* Cuando es true, los handlers de cambio de ruta NO deben cerrarlo.
|
|
57
64
|
*/
|
|
58
65
|
alreadyHandled?: boolean;
|
|
59
66
|
}
|
|
@@ -70,15 +77,6 @@ interface ModalGlobalState {
|
|
|
70
77
|
}
|
|
71
78
|
declare const useModalGlobalStore: zustand.UseBoundStore<zustand.StoreApi<ModalGlobalState>>;
|
|
72
79
|
|
|
73
|
-
interface ModalGlobalComponentProps extends ModalPayload {
|
|
74
|
-
isOpen: boolean;
|
|
75
|
-
onConfirmAction: () => void;
|
|
76
|
-
onCancelAction: () => void;
|
|
77
|
-
onCloseAction: () => void;
|
|
78
|
-
zIndexLevel?: number;
|
|
79
|
-
}
|
|
80
|
-
declare const ModalGlobalComponent: ({ isOpen, type, title, message, content, onConfirm, onCancel, buttonMode, textButtonConfirm, textButtonCancel, disabledConfirmButton, closeDisabled, onConfirmAction, onCancelAction, onCloseAction, zIndexLevel, }: ModalGlobalComponentProps) => react_jsx_runtime.JSX.Element;
|
|
81
|
-
|
|
82
80
|
interface ModalLoadingState {
|
|
83
81
|
isOpen: boolean;
|
|
84
82
|
message: string;
|
|
@@ -186,4 +184,4 @@ declare const closeGlobalLoadingPercentage: () => void;
|
|
|
186
184
|
/** Returns true if the global loading percentage modal is currently visible. */
|
|
187
185
|
declare const isGlobalLoadingPercentageOpen: () => boolean;
|
|
188
186
|
|
|
189
|
-
export {
|
|
187
|
+
export { ModalGlobalProvider, type ModalPayload, type ModalResult, ModalType, closeGlobalLoading, closeGlobalLoadingPercentage, closeGlobalModal, isAlreadyHandled, isGlobalLoadingOpen, isGlobalLoadingPercentageOpen, isGlobalModalOpen, showGlobalLoading, showGlobalLoadingPercentage, showGlobalModal, showGlobalModalWithClose, updateGlobalLoadingPercentage, useModalGlobalStore, useModalLoadingPercentageStore, useModalLoadingStore };
|
package/dist/modal.js
CHANGED
|
@@ -437,6 +437,32 @@ function Button({
|
|
|
437
437
|
}
|
|
438
438
|
);
|
|
439
439
|
}
|
|
440
|
+
var IconCheck = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 64, height: 64, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
441
|
+
"path",
|
|
442
|
+
{
|
|
443
|
+
d: "M28.2673 44.2663L47.0673 25.4663L43.334 21.733L28.2673 36.7997L20.6673 29.1997L16.934 32.933L28.2673 44.2663ZM32.0007 58.6663C28.3118 58.6663 24.8451 57.9659 21.6007 56.565C18.3562 55.1641 15.534 53.2646 13.134 50.8663C10.734 48.4663 8.83443 45.6441 7.43532 42.3997C6.03621 39.1552 5.33576 35.6886 5.33398 31.9997C5.33398 28.3108 6.03443 24.8441 7.43532 21.5997C8.83621 18.3552 10.7358 15.533 13.134 13.133C15.534 10.733 18.3562 8.83345 21.6007 7.43434C24.8451 6.03523 28.3118 5.33479 32.0007 5.33301C35.6895 5.33301 39.1562 6.03345 42.4007 7.43434C45.6451 8.83523 48.4673 10.7348 50.8673 13.133C53.2673 15.533 55.1678 18.3552 56.5686 21.5997C57.9695 24.8441 58.6691 28.3108 58.6673 31.9997C58.6673 35.6886 57.9669 39.1552 56.566 42.3997C55.1651 45.6441 53.2655 48.4663 50.8673 50.8663C48.4673 53.2663 45.6451 55.1668 42.4007 56.5677C39.1562 57.9686 35.6895 58.6681 32.0007 58.6663ZM32.0007 53.333C37.9562 53.333 43.0006 51.2663 47.134 47.133C51.2673 42.9997 53.334 37.9552 53.334 31.9997C53.334 26.0441 51.2673 20.9997 47.134 16.8663C43.0006 12.733 37.9562 10.6663 32.0007 10.6663C26.0451 10.6663 21.0007 12.733 16.8673 16.8663C12.734 20.9997 10.6673 26.0441 10.6673 31.9997C10.6673 37.9552 12.734 42.9997 16.8673 47.133C21.0007 51.2663 26.0451 53.333 32.0007 53.333Z",
|
|
444
|
+
fill: "currentColor"
|
|
445
|
+
}
|
|
446
|
+
) });
|
|
447
|
+
var IconInfo = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z", fill: "currentColor" }) });
|
|
448
|
+
var IconSpinnerDesktop = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 102, height: 102, viewBox: "0 0 102 102", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
449
|
+
"path",
|
|
450
|
+
{
|
|
451
|
+
d: "M50.9999 3.08313C23.9241 3.08208 3.08296 24.6456 3.08325 51C3.08354 75.4375 22.453 98.9167 50.9999 98.9167C77.5573 98.9167 98.9166 77.3542 98.9166 51",
|
|
452
|
+
stroke: "currentColor",
|
|
453
|
+
strokeWidth: 6,
|
|
454
|
+
strokeLinecap: "round"
|
|
455
|
+
}
|
|
456
|
+
) });
|
|
457
|
+
var IconSpinnerMobile = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 33, height: 33, viewBox: "0 0 33 33", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
458
|
+
"path",
|
|
459
|
+
{
|
|
460
|
+
d: "M16.5 3C8.87169 2.9997 2.99992 9.07499 3 16.5C3.00008 23.385 8.45721 30 16.5 30C23.9822 30 30 23.925 30 16.5",
|
|
461
|
+
stroke: "currentColor",
|
|
462
|
+
strokeWidth: 6,
|
|
463
|
+
strokeLinecap: "round"
|
|
464
|
+
}
|
|
465
|
+
) });
|
|
440
466
|
var IconWarningNotRecommended = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
441
467
|
"svg",
|
|
442
468
|
{
|
|
@@ -455,31 +481,11 @@ var IconWarningNotRecommended = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
455
481
|
)
|
|
456
482
|
}
|
|
457
483
|
);
|
|
458
|
-
var
|
|
459
|
-
"
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
) });
|
|
465
|
-
var IconInfo = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z", fill: "currentColor" }) });
|
|
466
|
-
var iconColorMap = {
|
|
467
|
-
error: "text-onpe-red",
|
|
468
|
-
warning: "text-onpe-yellow",
|
|
469
|
-
success: "text-onpe-skyblue",
|
|
470
|
-
question: "text-onpe-blue"
|
|
471
|
-
};
|
|
472
|
-
var titleColorMap = {
|
|
473
|
-
error: "text-onpe-red",
|
|
474
|
-
warning: "text-onpe-yellow",
|
|
475
|
-
success: "text-onpe-skyblue",
|
|
476
|
-
question: "text-onpe-blue"
|
|
477
|
-
};
|
|
478
|
-
var confirmButtonColorMap = {
|
|
479
|
-
error: "red",
|
|
480
|
-
warning: "red",
|
|
481
|
-
success: "skyblue",
|
|
482
|
-
question: "red"
|
|
484
|
+
var colorOverrideMap = {
|
|
485
|
+
red: "text-onpe-red",
|
|
486
|
+
blue: "text-onpe-blue",
|
|
487
|
+
skyblue: "text-onpe-skyblue",
|
|
488
|
+
yellow: "text-onpe-yellow"
|
|
483
489
|
};
|
|
484
490
|
function renderIcon(type, colorClass) {
|
|
485
491
|
if (type === "success") {
|
|
@@ -490,74 +496,79 @@ function renderIcon(type, colorClass) {
|
|
|
490
496
|
}
|
|
491
497
|
return /* @__PURE__ */ jsxRuntime.jsx(IconWarningNotRecommended, { role: "presentation", className: `w-16 h-16 ${colorClass}` });
|
|
492
498
|
}
|
|
493
|
-
var
|
|
494
|
-
isOpen,
|
|
495
|
-
|
|
499
|
+
var ModalConfirm = ({
|
|
500
|
+
isOpen = false,
|
|
501
|
+
onClose = () => {
|
|
502
|
+
},
|
|
503
|
+
withoutAutoClose = false,
|
|
496
504
|
title,
|
|
497
505
|
message,
|
|
498
506
|
content,
|
|
499
|
-
|
|
500
|
-
onCancel,
|
|
507
|
+
type = "error",
|
|
501
508
|
buttonMode,
|
|
502
|
-
textButtonConfirm = "Aceptar",
|
|
503
|
-
textButtonCancel = "Cancelar",
|
|
504
509
|
disabledConfirmButton = false,
|
|
505
510
|
closeDisabled = false,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
511
|
+
color,
|
|
512
|
+
onConfirm = () => {
|
|
513
|
+
},
|
|
514
|
+
onCancel = () => {
|
|
515
|
+
},
|
|
516
|
+
textButtonConfirm = "Confirmar",
|
|
517
|
+
textButtonCancel = "Cancelar",
|
|
518
|
+
className = "",
|
|
519
|
+
zIndexLevel = 100,
|
|
520
|
+
disableFocus = false
|
|
510
521
|
}) => {
|
|
511
|
-
const titleId = "modal-
|
|
512
|
-
const messageId = "modal-
|
|
513
|
-
const
|
|
514
|
-
const
|
|
515
|
-
const
|
|
516
|
-
const showTwoButtons = buttonMode === "double" || typeof onCancel === "function";
|
|
522
|
+
const titleId = "modal-confirm-title";
|
|
523
|
+
const messageId = "modal-confirm-message";
|
|
524
|
+
const effectiveMessage = message ?? content;
|
|
525
|
+
const effectiveColorClass = color ? colorOverrideMap[color] ?? "text-onpe-skyblue" : "text-onpe-skyblue";
|
|
526
|
+
const showTwoButtons = buttonMode === "double";
|
|
517
527
|
const handleConfirm = async () => {
|
|
518
528
|
try {
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
529
|
+
await onConfirm();
|
|
530
|
+
if (!withoutAutoClose) onClose();
|
|
531
|
+
} catch (error) {
|
|
532
|
+
console.error("Error en handleConfirm:", error);
|
|
533
|
+
if (!withoutAutoClose) onClose();
|
|
522
534
|
}
|
|
523
535
|
};
|
|
524
|
-
const handleCancel =
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
} finally {
|
|
528
|
-
onCancelAction();
|
|
529
|
-
}
|
|
536
|
+
const handleCancel = () => {
|
|
537
|
+
onCancel();
|
|
538
|
+
if (!withoutAutoClose) onClose();
|
|
530
539
|
};
|
|
531
540
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
532
541
|
Modal,
|
|
533
542
|
{
|
|
534
543
|
isOpen,
|
|
535
|
-
onClose
|
|
544
|
+
onClose,
|
|
545
|
+
className: `max-w-[719px]! pt-[30px]! pb-[30px]! px-[30px]! ${className}`,
|
|
546
|
+
closeButton: false,
|
|
536
547
|
closeDisabled,
|
|
537
|
-
escapeToClose: !closeDisabled,
|
|
538
548
|
zIndexLevel,
|
|
539
|
-
|
|
540
|
-
"aria-
|
|
541
|
-
|
|
549
|
+
"aria-labelledby": titleId,
|
|
550
|
+
"aria-describedby": messageId,
|
|
551
|
+
disableFocus,
|
|
542
552
|
children: [
|
|
543
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: renderIcon(type,
|
|
544
|
-
|
|
553
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: renderIcon(type, effectiveColorClass) }),
|
|
554
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
545
555
|
"p",
|
|
546
556
|
{
|
|
547
557
|
id: titleId,
|
|
548
558
|
className: [
|
|
549
|
-
"mt-
|
|
550
|
-
|
|
559
|
+
effectiveMessage ? "mt-0 md:mt-4" : "mt-0",
|
|
560
|
+
"text-lg md:text-2xl font-semibold text-center",
|
|
561
|
+
effectiveColorClass
|
|
551
562
|
].join(" "),
|
|
552
563
|
children: title
|
|
553
564
|
}
|
|
554
565
|
),
|
|
555
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
566
|
+
effectiveMessage && /* @__PURE__ */ jsxRuntime.jsx(
|
|
556
567
|
"div",
|
|
557
568
|
{
|
|
558
569
|
id: messageId,
|
|
559
570
|
className: "mt-7 text-sm md:text-lg text-center max-w-full text-onpe-dark-gray",
|
|
560
|
-
children:
|
|
571
|
+
children: effectiveMessage
|
|
561
572
|
}
|
|
562
573
|
),
|
|
563
574
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center w-full gap-5 mt-11 md:hidden", children: [
|
|
@@ -565,7 +576,7 @@ var ModalGlobalComponent = ({
|
|
|
565
576
|
Button,
|
|
566
577
|
{
|
|
567
578
|
className: "w-full max-w-[200px]",
|
|
568
|
-
color:
|
|
579
|
+
color: "red",
|
|
569
580
|
title: textButtonConfirm,
|
|
570
581
|
onClick: handleConfirm,
|
|
571
582
|
disabled: disabledConfirmButton
|
|
@@ -595,7 +606,7 @@ var ModalGlobalComponent = ({
|
|
|
595
606
|
Button,
|
|
596
607
|
{
|
|
597
608
|
className: "w-[200px]",
|
|
598
|
-
color:
|
|
609
|
+
color: "red",
|
|
599
610
|
title: textButtonConfirm,
|
|
600
611
|
onClick: handleConfirm,
|
|
601
612
|
disabled: disabledConfirmButton
|
|
@@ -606,24 +617,6 @@ var ModalGlobalComponent = ({
|
|
|
606
617
|
}
|
|
607
618
|
);
|
|
608
619
|
};
|
|
609
|
-
var IconSpinnerDesktop = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 102, height: 102, viewBox: "0 0 102 102", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
610
|
-
"path",
|
|
611
|
-
{
|
|
612
|
-
d: "M50.9999 3.08313C23.9241 3.08208 3.08296 24.6456 3.08325 51C3.08354 75.4375 22.453 98.9167 50.9999 98.9167C77.5573 98.9167 98.9166 77.3542 98.9166 51",
|
|
613
|
-
stroke: "currentColor",
|
|
614
|
-
strokeWidth: 6,
|
|
615
|
-
strokeLinecap: "round"
|
|
616
|
-
}
|
|
617
|
-
) });
|
|
618
|
-
var IconSpinnerMobile = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: 33, height: 33, viewBox: "0 0 33 33", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
619
|
-
"path",
|
|
620
|
-
{
|
|
621
|
-
d: "M16.5 3C8.87169 2.9997 2.99992 9.07499 3 16.5C3.00008 23.385 8.45721 30 16.5 30C23.9822 30 30 23.925 30 16.5",
|
|
622
|
-
stroke: "currentColor",
|
|
623
|
-
strokeWidth: 6,
|
|
624
|
-
strokeLinecap: "round"
|
|
625
|
-
}
|
|
626
|
-
) });
|
|
627
620
|
var ModalLoading = ({
|
|
628
621
|
isOpen = false,
|
|
629
622
|
onClose = () => {
|
|
@@ -725,30 +718,36 @@ var ModalGlobalProvider = ({
|
|
|
725
718
|
const { isOpen, payload, closeModal, closeModalWithResult } = useModalGlobalStore();
|
|
726
719
|
const { isOpen: isLoadingOpen, message: loadingMessage } = useModalLoadingStore();
|
|
727
720
|
const {
|
|
728
|
-
isOpen:
|
|
729
|
-
message:
|
|
721
|
+
isOpen: isPercentageOpen,
|
|
722
|
+
message: percentageMessage,
|
|
730
723
|
percentage
|
|
731
724
|
} = useModalLoadingPercentageStore();
|
|
732
725
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
733
726
|
children,
|
|
734
727
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
735
|
-
|
|
728
|
+
ModalConfirm,
|
|
736
729
|
{
|
|
737
730
|
isOpen,
|
|
738
|
-
|
|
739
|
-
title: payload?.title,
|
|
731
|
+
onClose: () => closeModalWithResult("close"),
|
|
732
|
+
title: payload?.title ?? "",
|
|
740
733
|
message: payload?.message,
|
|
741
734
|
content: payload?.content,
|
|
742
|
-
|
|
743
|
-
onCancel: payload?.onCancel,
|
|
735
|
+
type: payload?.type,
|
|
744
736
|
buttonMode: payload?.buttonMode,
|
|
745
|
-
textButtonConfirm: payload?.textButtonConfirm,
|
|
746
|
-
textButtonCancel: payload?.textButtonCancel,
|
|
747
737
|
disabledConfirmButton: payload?.disabledConfirmButton,
|
|
748
738
|
closeDisabled: payload?.closeDisabled,
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
739
|
+
color: payload?.color,
|
|
740
|
+
onConfirm: async () => {
|
|
741
|
+
await payload?.onConfirm?.();
|
|
742
|
+
closeModal(true);
|
|
743
|
+
},
|
|
744
|
+
onCancel: () => {
|
|
745
|
+
payload?.onCancel?.();
|
|
746
|
+
closeModal(false);
|
|
747
|
+
},
|
|
748
|
+
withoutAutoClose: true,
|
|
749
|
+
textButtonConfirm: payload?.textButtonConfirm,
|
|
750
|
+
textButtonCancel: payload?.textButtonCancel,
|
|
752
751
|
zIndexLevel
|
|
753
752
|
}
|
|
754
753
|
),
|
|
@@ -763,8 +762,8 @@ var ModalGlobalProvider = ({
|
|
|
763
762
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
764
763
|
ModalLoadingPercentage,
|
|
765
764
|
{
|
|
766
|
-
isOpen:
|
|
767
|
-
message:
|
|
765
|
+
isOpen: isPercentageOpen,
|
|
766
|
+
message: percentageMessage,
|
|
768
767
|
percentage,
|
|
769
768
|
zIndexLevel: zIndexLoadingPercentage
|
|
770
769
|
}
|
|
@@ -786,7 +785,6 @@ var updateGlobalLoadingPercentage = (percentage) => useModalLoadingPercentageSto
|
|
|
786
785
|
var closeGlobalLoadingPercentage = () => useModalLoadingPercentageStore.getState().closeLoadingPercentage();
|
|
787
786
|
var isGlobalLoadingPercentageOpen = () => useModalLoadingPercentageStore.getState().isOpen;
|
|
788
787
|
|
|
789
|
-
exports.ModalGlobalComponent = ModalGlobalComponent;
|
|
790
788
|
exports.ModalGlobalProvider = ModalGlobalProvider;
|
|
791
789
|
exports.closeGlobalLoading = closeGlobalLoading;
|
|
792
790
|
exports.closeGlobalLoadingPercentage = closeGlobalLoadingPercentage;
|