@votodigital-onpeui/react 0.1.30 → 0.1.31
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/dist/{ModalConfirm-DLUyYmlH.d.mts → ModalConfirm-CZJCfya3.d.mts} +5 -1
- package/dist/{ModalConfirm-DLUyYmlH.d.ts → ModalConfirm-CZJCfya3.d.ts} +5 -1
- package/dist/{chunk-NTNMIAQV.mjs → chunk-4XHWFUHC.mjs} +11 -7
- package/dist/chunk-4XHWFUHC.mjs.map +1 -0
- package/dist/{chunk-CPGE57WI.mjs → chunk-6RNDTVIJ.mjs} +3 -3
- package/dist/{chunk-CPGE57WI.mjs.map → chunk-6RNDTVIJ.mjs.map} +1 -1
- package/dist/{chunk-73R3LRYP.mjs → chunk-MFNWIYOJ.mjs} +3 -3
- package/dist/{chunk-73R3LRYP.mjs.map → chunk-MFNWIYOJ.mjs.map} +1 -1
- package/dist/{chunk-2ZIUKK7V.mjs → chunk-UGIZ3K3S.mjs} +31 -20
- package/dist/chunk-UGIZ3K3S.mjs.map +1 -0
- package/dist/components.d.mts +11 -3
- package/dist/components.d.ts +11 -3
- package/dist/components.js +36 -21
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +3 -3
- package/dist/hooks.js +9 -5
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/modal.d.mts +8 -2
- package/dist/modal.d.ts +8 -2
- package/dist/modal.js +55 -26
- package/dist/modal.js.map +1 -1
- package/dist/modal.mjs +21 -7
- package/dist/modal.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2ZIUKK7V.mjs.map +0 -1
- package/dist/chunk-NTNMIAQV.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IconSpinnerDesktop, IconSpinnerMobile, IconCheck, IconQuestion, IconInfo, IconWarningNotRecommended } from './chunk-M2KQXQLY.mjs';
|
|
2
|
-
import { Modal } from './chunk-
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Modal } from './chunk-4XHWFUHC.mjs';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
|
|
6
6
|
var colorClasses = {
|
|
@@ -91,7 +91,9 @@ var ModalConfirm = ({
|
|
|
91
91
|
disableFocus = false,
|
|
92
92
|
closeButton = false,
|
|
93
93
|
alignJustify = false,
|
|
94
|
-
alignTop = false
|
|
94
|
+
alignTop = false,
|
|
95
|
+
animated = true,
|
|
96
|
+
preventBodyScroll = true
|
|
95
97
|
}) => {
|
|
96
98
|
const titleId = "modal-confirm-title";
|
|
97
99
|
const messageId = "modal-confirm-message";
|
|
@@ -127,6 +129,8 @@ var ModalConfirm = ({
|
|
|
127
129
|
"aria-describedby": messageId,
|
|
128
130
|
disableFocus,
|
|
129
131
|
alignTop,
|
|
132
|
+
animated,
|
|
133
|
+
preventBodyScroll,
|
|
130
134
|
children: [
|
|
131
135
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: renderIcon(type, effectiveColorClass) }),
|
|
132
136
|
/* @__PURE__ */ jsx(
|
|
@@ -200,7 +204,10 @@ var ModalLoading = ({
|
|
|
200
204
|
},
|
|
201
205
|
message = "Cargando...",
|
|
202
206
|
className = "",
|
|
203
|
-
zIndexLevel = 100
|
|
207
|
+
zIndexLevel = 100,
|
|
208
|
+
animated = true,
|
|
209
|
+
preventBodyScroll = true,
|
|
210
|
+
spinner
|
|
204
211
|
}) => {
|
|
205
212
|
const [announceMessage, setAnnounceMessage] = useState("");
|
|
206
213
|
useEffect(() => {
|
|
@@ -226,22 +233,26 @@ var ModalLoading = ({
|
|
|
226
233
|
className,
|
|
227
234
|
closeDisabled: true,
|
|
228
235
|
whitoutBackground: true,
|
|
236
|
+
animated,
|
|
237
|
+
preventBodyScroll,
|
|
229
238
|
children: [
|
|
230
239
|
/* @__PURE__ */ jsx("div", { className: "sr-only", "aria-live": "assertive", "aria-atomic": "true", children: announceMessage }),
|
|
231
|
-
/* @__PURE__ */
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
spinner ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
241
|
+
/* @__PURE__ */ jsx(
|
|
242
|
+
IconSpinnerDesktop,
|
|
243
|
+
{
|
|
244
|
+
className: "hidden md:block text-white animate-spin",
|
|
245
|
+
"aria-hidden": "true"
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
IconSpinnerMobile,
|
|
250
|
+
{
|
|
251
|
+
className: "block md:hidden text-white animate-spin",
|
|
252
|
+
"aria-hidden": "true"
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] }),
|
|
245
256
|
/* @__PURE__ */ jsx("p", { className: "text-white leading-normal text-2xl md:text-[64px] text-center mt-10 md:mt-20", children: message })
|
|
246
257
|
]
|
|
247
258
|
}
|
|
@@ -249,5 +260,5 @@ var ModalLoading = ({
|
|
|
249
260
|
};
|
|
250
261
|
|
|
251
262
|
export { Button, ModalConfirm, ModalLoading };
|
|
252
|
-
//# sourceMappingURL=chunk-
|
|
253
|
-
//# sourceMappingURL=chunk-
|
|
263
|
+
//# sourceMappingURL=chunk-UGIZ3K3S.mjs.map
|
|
264
|
+
//# sourceMappingURL=chunk-UGIZ3K3S.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/Button.tsx","../src/components/Feedback/ModalConfirm/ModalConfirm.tsx","../src/components/Feedback/ModalLoading/ModalLoading.ts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,CAAC,CAAA;AAAA,IAC3B,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,MAAA,EAAQ,OAAO,CAAC,CAAA;AAEpB,EAAA,uBACEC,IAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,YAAA,EAAY,IAAA;AAAA,MACZ,WAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,SAAA;AAAA,MACA,aAAA,EAAa,IAAA;AAAA,MACb,iBAAA,EAAmB,IAAA;AAAA,MACnB,QAAA;AAAA,MACA,iBAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAAD,GAAAA,CAAC,SAAI,SAAA,EAAU,SAAA,EAAU,aAAU,WAAA,EAAY,aAAA,EAAY,QACxD,QAAA,EAAA,eAAA,EACH,CAAA;AAAA,QACC,OAAA,oBACCC,IAAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAAD,GAAAA;AAAA,YAAC,kBAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAU,yCAAA;AAAA,cACV,aAAA,EAAY;AAAA;AAAA,WACd;AAAA,0BACAA,GAAAA;AAAA,YAAC,iBAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAU,yCAAA;AAAA,cACV,aAAA,EAAY;AAAA;AAAA;AACd,SAAA,EACF,CAAA;AAAA,wBAEFA,GAAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,gFACV,QAAA,EAAA,OAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-UGIZ3K3S.mjs","sourcesContent":["type ButtonColor =\n | \"blue\"\n | \"skyblue\"\n | \"skyblue-light\"\n | \"yellow\"\n | \"light-skyblue\"\n | \"gray\"\n | \"gray-light\"\n | \"gray-extra-light\"\n | \"red\"\n | \"dark-gray\"\n | \"green\"\n | \"yellow-light\"\n | \"primary\";\n\ntype ButtonSize = \"small\" | \"normal\" | \"large\";\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n color: ButtonColor;\n title: string;\n size?: ButtonSize;\n}\n\nconst colorClasses: Record<ButtonColor, string> = {\n blue: \"bg-onpe-blue\",\n skyblue: \"bg-onpe-skyblue\",\n \"skyblue-light\": \"bg-onpe-skyblue-light\",\n yellow: \"bg-onpe-yellow\",\n \"light-skyblue\": \"bg-onpe-light-skyblue\",\n gray: \"bg-onpe-gray\",\n \"gray-light\": \"bg-onpe-gray-light\",\n \"gray-extra-light\": \"bg-onpe-gray-extra-light\",\n red: \"bg-onpe-red\",\n \"dark-gray\": \"bg-onpe-dark-gray\",\n green: \"bg-onpe-green\",\n \"yellow-light\": \"bg-onpe-yellow-light\",\n primary: \"bg-onpe-blue\",\n};\n\nconst sizeClasses: Record<ButtonSize, string> = {\n small: \"h-10 text-sm\",\n normal: \"h-12 text-base\",\n large: \"h-14 text-lg\",\n};\n\nexport function Button({\n color,\n title,\n size = \"normal\",\n className = \"\",\n ...props\n}: ButtonProps) {\n return (\n <button\n className={[\n \"inline-flex items-center justify-center\",\n \"min-w-[200px] border-none\",\n \"text-white font-semibold cursor-pointer\",\n \"transition-all duration-300 ease-in-out\",\n \"disabled:cursor-default disabled:!bg-onpe-gray\",\n colorClasses[color],\n sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(\" \")}\n {...props}\n >\n {title}\n </button>\n );\n}\n\nexport default Button;\n","import { type ReactNode } from \"react\";\r\nimport { Modal } from \"../../Modal/Modal\";\r\nimport { Button } from \"../../Button/Button\";\r\nimport { IconCheck } from \"../../../icons/Actions/IconCheck\";\r\nimport { IconWarningNotRecommended } from \"../../../icons\";\r\nimport { IconQuestion } from \"../../../icons/Actions/IconQuestion\";\r\nimport { IconInfo } from \"../../../icons/Actions/IconInfo\";\r\n\r\nexport type ModalType = \"warning\" | \"success\" | \"question\" | \"info\" | \"none\";\r\n\r\n/** Mapa de override de color a clase CSS (icono + título) */\r\nconst colorOverrideMap: Record<string, string> = {\r\n red: \"text-onpe-red\",\r\n blue: \"text-onpe-blue\",\r\n skyblue: \"text-onpe-skyblue\",\r\n yellow: \"text-onpe-yellow\",\r\n};\r\n\r\nfunction renderIcon(type: ModalType, colorClass: string): ReactNode {\r\n if (type === \"none\") return null;\r\n if (type === \"success\") {\r\n return <IconCheck role=\"presentation\" className={`w-16 h-16 ${colorClass}`} />;\r\n }\r\n if (type === \"question\") {\r\n return <IconQuestion role=\"presentation\" className={`w-16 h-16 ${colorClass}`} />;\r\n }\r\n if (type === \"info\") {\r\n return <IconInfo role=\"presentation\" className={`w-16 h-16 ${colorClass}`} />;\r\n }\r\n // error | warning\r\n return <IconWarningNotRecommended role=\"presentation\" className={`w-16 h-16 ${colorClass}`} />;\r\n}\r\n\r\nexport interface ModalConfirmProps {\r\n isOpen: boolean;\r\n onClose: () => void;\r\n title: string;\r\n /** Contenido del modal (string o JSX) */\r\n message?: ReactNode;\r\n /** Alias de message */\r\n content?: ReactNode;\r\n /** Tipo semántico: determina icono, color de título y color de botón confirmar */\r\n type?: ModalType;\r\n /**\r\n * \"single\" → un botón \"Confirmar\".\r\n * \"double\" → \"Cancelar\" + \"Confirmar\".\r\n * \"confirm\" → \"No\" + \"Sí\" (diálogo de confirmación Sí/No).\r\n */\r\n buttonMode?: \"single\" | \"double\" | \"confirm\";\r\n /** Deshabilita el botón confirmar */\r\n disabledConfirmButton?: boolean;\r\n /** Deshabilita el cierre del modal */\r\n closeDisabled?: boolean;\r\n /**\r\n * Override del color del icono y título.\r\n * Si no se provee, se deriva automáticamente del `type`.\r\n */\r\n color?: \"red\" | \"blue\" | \"skyblue\" | \"yellow\";\r\n onConfirm?: () => void | Promise<void>;\r\n onCancel?: () => void | Promise<void>;\r\n textButtonConfirm?: string;\r\n textButtonCancel?: string;\r\n className?: string;\r\n zIndexLevel?: number;\r\n withoutAutoClose?: boolean;\r\n disableFocus?: boolean;\r\n /** Muestra el botón X para cerrar el modal */\r\n closeButton?: boolean;\r\n /** Alinea el texto del mensaje a la izquierda (justify) en vez de centrado */\r\n alignJustify?: boolean;\r\n /** Alinea el modal al tope de la pantalla en vez de al centro */\r\n alignTop?: boolean;\r\n /** Habilita animación de entrada/salida (default: true) */\r\n animated?: boolean;\r\n /** Bloquea el scroll del body mientras el modal está abierto (default: true) */\r\n preventBodyScroll?: boolean;\r\n}\r\n\r\nexport const ModalConfirm = ({\r\n isOpen = false,\r\n onClose = () => {},\r\n withoutAutoClose = false,\r\n title,\r\n message,\r\n content,\r\n type = \"warning\",\r\n buttonMode,\r\n disabledConfirmButton = false,\r\n closeDisabled = false,\r\n color,\r\n onConfirm = () => {},\r\n onCancel = () => {},\r\n textButtonConfirm,\r\n textButtonCancel,\r\n className = \"\",\r\n zIndexLevel = 100,\r\n disableFocus = false,\r\n closeButton = false,\r\n alignJustify = false,\r\n alignTop = false,\r\n animated = true,\r\n preventBodyScroll = true,\r\n}: ModalConfirmProps) => {\r\n const titleId = \"modal-confirm-title\";\r\n const messageId = \"modal-confirm-message\";\r\n\r\n const effectiveMessage = message ?? content;\r\n // Título e ícono siempre skyblue por defecto; `color` es el único override\r\n const effectiveColorClass = color\r\n ? (colorOverrideMap[color] ?? \"text-onpe-skyblue\")\r\n : \"text-onpe-skyblue\";\r\n const isConfirmMode = buttonMode === \"confirm\";\r\n const showTwoButtons = buttonMode === \"double\" || isConfirmMode;\r\n const confirmLabel = textButtonConfirm ?? (isConfirmMode ? \"Sí\" : \"Confirmar\");\r\n const cancelLabel = textButtonCancel ?? (isConfirmMode ? \"No\" : \"Cancelar\");\r\n\r\n const handleConfirm = async () => {\r\n try {\r\n await onConfirm();\r\n if (!withoutAutoClose) onClose();\r\n } catch (error) {\r\n console.error(\"Error en handleConfirm:\", error);\r\n if (!withoutAutoClose) onClose();\r\n }\r\n };\r\n\r\n const handleCancel = () => {\r\n onCancel();\r\n if (!withoutAutoClose) onClose();\r\n };\r\n\r\n return (\r\n <Modal\r\n isOpen={isOpen}\r\n onClose={onClose}\r\n className={`max-w-[719px]! pt-[30px]! pb-[30px]! px-[30px]! ${className}`}\r\n closeButton={closeButton}\r\n closeDisabled={closeDisabled}\r\n zIndexLevel={zIndexLevel}\r\n aria-labelledby={titleId}\r\n aria-describedby={messageId}\r\n disableFocus={disableFocus}\r\n alignTop={alignTop}\r\n animated={animated}\r\n preventBodyScroll={preventBodyScroll}\r\n >\r\n {/* Icono */}\r\n <div className=\"flex items-center justify-center\">\r\n {renderIcon(type, effectiveColorClass)}\r\n </div>\r\n\r\n {/* Título */}\r\n <p\r\n id={titleId}\r\n className={[\r\n \"text-lg md:text-2xl font-semibold text-center mt-0 md:mt-4\",\r\n effectiveColorClass,\r\n ].join(\" \")}\r\n >\r\n {title}\r\n </p>\r\n\r\n {/* Mensaje / Contenido */}\r\n {effectiveMessage && (\r\n <div\r\n id={messageId}\r\n className={`mt-7 text-sm md:text-lg max-w-full text-black ${alignJustify ? \"text-justify\" : \"text-center\"}`}\r\n >\r\n {effectiveMessage}\r\n </div>\r\n )}\r\n\r\n {/* Mobile: apilado */}\r\n <div className=\"flex flex-col items-center justify-center w-full gap-5 mt-11 md:hidden\">\r\n <Button\r\n className=\"w-full max-w-[200px]\"\r\n color=\"red\"\r\n title={confirmLabel}\r\n onClick={handleConfirm}\r\n disabled={disabledConfirmButton}\r\n />\r\n {showTwoButtons && (\r\n <Button\r\n className=\"w-full max-w-[200px]\"\r\n color=\"skyblue\"\r\n title={cancelLabel}\r\n onClick={handleCancel}\r\n />\r\n )}\r\n </div>\r\n\r\n {/* Desktop: fila */}\r\n <div className=\"hidden md:flex md:flex-row items-center justify-center w-full gap-5 mt-11\">\r\n {showTwoButtons && (\r\n <Button\r\n className=\"w-[200px]\"\r\n color=\"skyblue\"\r\n title={cancelLabel}\r\n onClick={handleCancel}\r\n />\r\n )}\r\n <Button\r\n className=\"w-[200px]\"\r\n color=\"red\"\r\n title={confirmLabel}\r\n onClick={handleConfirm}\r\n disabled={disabledConfirmButton}\r\n />\r\n </div>\r\n </Modal>\r\n );\r\n};\r\n\r\nexport default ModalConfirm;\r\n","import { type ReactNode, useEffect, useState } from \"react\";\r\nimport { Modal } from \"../../Modal/Modal\";\r\nimport { IconSpinnerDesktop } from \"../../../icons/Actions/IconSpinnerDesktop\";\r\nimport { IconSpinnerMobile } from \"../../../icons/Actions/IconSpinnerMobile\";\r\n\r\nexport interface ModalLoadingProps {\r\n isOpen: boolean;\r\n onClose?: () => void;\r\n message?: string;\r\n className?: string;\r\n zIndexLevel?: number;\r\n animated?: boolean;\r\n preventBodyScroll?: boolean;\r\n /** Spinner personalizado. Si no se provee, se usa el spinner por defecto de la librería. */\r\n spinner?: ReactNode;\r\n}\r\n\r\nexport const ModalLoading = ({\r\n isOpen = false,\r\n onClose = () => {},\r\n message = \"Cargando...\",\r\n className = \"\",\r\n zIndexLevel = 100,\r\n animated = true,\r\n preventBodyScroll = true,\r\n spinner,\r\n}: ModalLoadingProps) => {\r\n const [announceMessage, setAnnounceMessage] = useState(\"\");\r\n\r\n useEffect(() => {\r\n if (!isOpen) {\r\n setAnnounceMessage(\"\");\r\n return;\r\n }\r\n setAnnounceMessage(\"\");\r\n const t = globalThis.setTimeout(() => {\r\n setAnnounceMessage(message);\r\n }, 150);\r\n return () => {\r\n globalThis.clearTimeout(t);\r\n };\r\n }, [isOpen, message]);\r\n\r\n return (\r\n <Modal\r\n disableFocus\r\n zIndexLevel={zIndexLevel}\r\n isOpen={isOpen}\r\n onClose={onClose}\r\n className={className}\r\n closeDisabled\r\n whitoutBackground={true}\r\n animated={animated}\r\n preventBodyScroll={preventBodyScroll}\r\n >\r\n <div className=\"sr-only\" aria-live=\"assertive\" aria-atomic=\"true\">\r\n {announceMessage}\r\n </div>\r\n {spinner ?? (\r\n <>\r\n <IconSpinnerDesktop\r\n className=\"hidden md:block text-white animate-spin\"\r\n aria-hidden=\"true\"\r\n />\r\n <IconSpinnerMobile\r\n className=\"block md:hidden text-white animate-spin\"\r\n aria-hidden=\"true\"\r\n />\r\n </>\r\n )}\r\n <p className=\"text-white leading-normal text-2xl md:text-[64px] text-center mt-10 md:mt-20\">\r\n {message}\r\n </p>\r\n </Modal>\r\n );\r\n};\r\n\r\nexport default ModalLoading;\r\n"]}
|
package/dist/components.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
4
|
-
export { M as ModalConfirm, a as ModalConfirmProps } from './ModalConfirm-
|
|
4
|
+
export { M as ModalConfirm, a as ModalConfirmProps } from './ModalConfirm-CZJCfya3.mjs';
|
|
5
5
|
|
|
6
6
|
type ButtonColor = "blue" | "skyblue" | "skyblue-light" | "yellow" | "light-skyblue" | "gray" | "gray-light" | "gray-extra-light" | "red" | "dark-gray" | "green" | "yellow-light" | "primary";
|
|
7
7
|
type ButtonSize = "small" | "normal" | "large";
|
|
@@ -59,9 +59,13 @@ interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
59
59
|
onCloseComplete?: () => void;
|
|
60
60
|
/** Alinea el modal al tope de la pantalla en vez de al centro */
|
|
61
61
|
alignTop?: boolean;
|
|
62
|
+
/** Habilita animación de entrada/salida (default: true) */
|
|
63
|
+
animated?: boolean;
|
|
64
|
+
/** Bloquea el scroll del body mientras el modal está abierto (default: true) */
|
|
65
|
+
preventBodyScroll?: boolean;
|
|
62
66
|
overlayColor?: "blue" | "skyblue" | "skyblue-light" | "yellow" | "light-skyblue" | "gray" | "gray-light" | "gray-extra-light" | "red" | "dark-gray" | "green" | "yellow-light" | "primary";
|
|
63
67
|
}
|
|
64
|
-
declare const Modal: ({ isOpen, onClose, children, whitoutBackground, closeButton, closeDisabled, escapeToClose, disableFocus, disableFocusRestore, existTabIndex, zIndexLevel, onCloseComplete, alignTop, overlayColor: _overlayColor, ...props }: ModalProps) => react_jsx_runtime.JSX.Element | null;
|
|
68
|
+
declare const Modal: ({ isOpen, onClose, children, whitoutBackground, closeButton, closeDisabled, escapeToClose, disableFocus, disableFocusRestore, existTabIndex, zIndexLevel, onCloseComplete, alignTop, animated, preventBodyScroll, overlayColor: _overlayColor, ...props }: ModalProps) => react_jsx_runtime.JSX.Element | null;
|
|
65
69
|
|
|
66
70
|
interface ModalBrowserIncompatibleProps {
|
|
67
71
|
isOpen: boolean;
|
|
@@ -93,8 +97,12 @@ interface ModalLoadingProps {
|
|
|
93
97
|
message?: string;
|
|
94
98
|
className?: string;
|
|
95
99
|
zIndexLevel?: number;
|
|
100
|
+
animated?: boolean;
|
|
101
|
+
preventBodyScroll?: boolean;
|
|
102
|
+
/** Spinner personalizado. Si no se provee, se usa el spinner por defecto de la librería. */
|
|
103
|
+
spinner?: ReactNode;
|
|
96
104
|
}
|
|
97
|
-
declare const ModalLoading: ({ isOpen, onClose, message, className, zIndexLevel, }: ModalLoadingProps) => react_jsx_runtime.JSX.Element;
|
|
105
|
+
declare const ModalLoading: ({ isOpen, onClose, message, className, zIndexLevel, animated, preventBodyScroll, spinner, }: ModalLoadingProps) => react_jsx_runtime.JSX.Element;
|
|
98
106
|
|
|
99
107
|
interface ModalDnieVersionsProps {
|
|
100
108
|
isOpen: boolean;
|
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
4
|
-
export { M as ModalConfirm, a as ModalConfirmProps } from './ModalConfirm-
|
|
4
|
+
export { M as ModalConfirm, a as ModalConfirmProps } from './ModalConfirm-CZJCfya3.js';
|
|
5
5
|
|
|
6
6
|
type ButtonColor = "blue" | "skyblue" | "skyblue-light" | "yellow" | "light-skyblue" | "gray" | "gray-light" | "gray-extra-light" | "red" | "dark-gray" | "green" | "yellow-light" | "primary";
|
|
7
7
|
type ButtonSize = "small" | "normal" | "large";
|
|
@@ -59,9 +59,13 @@ interface ModalProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
59
59
|
onCloseComplete?: () => void;
|
|
60
60
|
/** Alinea el modal al tope de la pantalla en vez de al centro */
|
|
61
61
|
alignTop?: boolean;
|
|
62
|
+
/** Habilita animación de entrada/salida (default: true) */
|
|
63
|
+
animated?: boolean;
|
|
64
|
+
/** Bloquea el scroll del body mientras el modal está abierto (default: true) */
|
|
65
|
+
preventBodyScroll?: boolean;
|
|
62
66
|
overlayColor?: "blue" | "skyblue" | "skyblue-light" | "yellow" | "light-skyblue" | "gray" | "gray-light" | "gray-extra-light" | "red" | "dark-gray" | "green" | "yellow-light" | "primary";
|
|
63
67
|
}
|
|
64
|
-
declare const Modal: ({ isOpen, onClose, children, whitoutBackground, closeButton, closeDisabled, escapeToClose, disableFocus, disableFocusRestore, existTabIndex, zIndexLevel, onCloseComplete, alignTop, overlayColor: _overlayColor, ...props }: ModalProps) => react_jsx_runtime.JSX.Element | null;
|
|
68
|
+
declare const Modal: ({ isOpen, onClose, children, whitoutBackground, closeButton, closeDisabled, escapeToClose, disableFocus, disableFocusRestore, existTabIndex, zIndexLevel, onCloseComplete, alignTop, animated, preventBodyScroll, overlayColor: _overlayColor, ...props }: ModalProps) => react_jsx_runtime.JSX.Element | null;
|
|
65
69
|
|
|
66
70
|
interface ModalBrowserIncompatibleProps {
|
|
67
71
|
isOpen: boolean;
|
|
@@ -93,8 +97,12 @@ interface ModalLoadingProps {
|
|
|
93
97
|
message?: string;
|
|
94
98
|
className?: string;
|
|
95
99
|
zIndexLevel?: number;
|
|
100
|
+
animated?: boolean;
|
|
101
|
+
preventBodyScroll?: boolean;
|
|
102
|
+
/** Spinner personalizado. Si no se provee, se usa el spinner por defecto de la librería. */
|
|
103
|
+
spinner?: ReactNode;
|
|
96
104
|
}
|
|
97
|
-
declare const ModalLoading: ({ isOpen, onClose, message, className, zIndexLevel, }: ModalLoadingProps) => react_jsx_runtime.JSX.Element;
|
|
105
|
+
declare const ModalLoading: ({ isOpen, onClose, message, className, zIndexLevel, animated, preventBodyScroll, spinner, }: ModalLoadingProps) => react_jsx_runtime.JSX.Element;
|
|
98
106
|
|
|
99
107
|
interface ModalDnieVersionsProps {
|
|
100
108
|
isOpen: boolean;
|
package/dist/components.js
CHANGED
|
@@ -444,6 +444,8 @@ var Modal = ({
|
|
|
444
444
|
zIndexLevel = 100,
|
|
445
445
|
onCloseComplete,
|
|
446
446
|
alignTop = false,
|
|
447
|
+
animated = true,
|
|
448
|
+
preventBodyScroll = true,
|
|
447
449
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- overlayColor reservado para uso futuro
|
|
448
450
|
overlayColor: _overlayColor = "blue",
|
|
449
451
|
...props
|
|
@@ -477,6 +479,7 @@ var Modal = ({
|
|
|
477
479
|
}
|
|
478
480
|
}, [isOpen, onCloseComplete]);
|
|
479
481
|
react.useEffect(() => {
|
|
482
|
+
if (!preventBodyScroll) return;
|
|
480
483
|
if (isOpen) {
|
|
481
484
|
document.body.style.overflow = "hidden";
|
|
482
485
|
} else {
|
|
@@ -485,7 +488,7 @@ var Modal = ({
|
|
|
485
488
|
return () => {
|
|
486
489
|
document.body.style.overflow = "";
|
|
487
490
|
};
|
|
488
|
-
}, [isOpen]);
|
|
491
|
+
}, [isOpen, preventBodyScroll]);
|
|
489
492
|
react.useEffect(() => {
|
|
490
493
|
if (!isOpen) return;
|
|
491
494
|
const resetScroll = () => {
|
|
@@ -697,8 +700,9 @@ var Modal = ({
|
|
|
697
700
|
{
|
|
698
701
|
style: { zIndex: zIndexLevel },
|
|
699
702
|
className: [
|
|
700
|
-
"fixed inset-0 bg-onpe-blue
|
|
701
|
-
|
|
703
|
+
"fixed inset-0 bg-onpe-blue",
|
|
704
|
+
animated ? "transition-opacity duration-200" : "",
|
|
705
|
+
animated ? visible ? "opacity-80" : "opacity-0" : "opacity-80"
|
|
702
706
|
].join(" "),
|
|
703
707
|
onClick: onClose
|
|
704
708
|
}
|
|
@@ -710,8 +714,8 @@ var Modal = ({
|
|
|
710
714
|
className: [
|
|
711
715
|
"fixed top-0 w-full h-screen grid",
|
|
712
716
|
alignTop ? "place-items-start pt-8" : "place-items-center",
|
|
713
|
-
"transition-all duration-200",
|
|
714
|
-
visible ? "opacity-100 scale-100 translate-y-0" : "opacity-[0.2] scale-95 -translate-y-5"
|
|
717
|
+
animated ? "transition-all duration-200" : "",
|
|
718
|
+
animated ? visible ? "opacity-100 scale-100 translate-y-0" : "opacity-[0.2] scale-95 -translate-y-5" : "opacity-100 scale-100 translate-y-0"
|
|
715
719
|
].join(" "),
|
|
716
720
|
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative grid place-items-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
717
721
|
"div",
|
|
@@ -1192,7 +1196,9 @@ var ModalConfirm = ({
|
|
|
1192
1196
|
disableFocus = false,
|
|
1193
1197
|
closeButton = false,
|
|
1194
1198
|
alignJustify = false,
|
|
1195
|
-
alignTop = false
|
|
1199
|
+
alignTop = false,
|
|
1200
|
+
animated = true,
|
|
1201
|
+
preventBodyScroll = true
|
|
1196
1202
|
}) => {
|
|
1197
1203
|
const titleId = "modal-confirm-title";
|
|
1198
1204
|
const messageId = "modal-confirm-message";
|
|
@@ -1228,6 +1234,8 @@ var ModalConfirm = ({
|
|
|
1228
1234
|
"aria-describedby": messageId,
|
|
1229
1235
|
disableFocus,
|
|
1230
1236
|
alignTop,
|
|
1237
|
+
animated,
|
|
1238
|
+
preventBodyScroll,
|
|
1231
1239
|
children: [
|
|
1232
1240
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: renderIcon(type, effectiveColorClass) }),
|
|
1233
1241
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1301,7 +1309,10 @@ var ModalLoading = ({
|
|
|
1301
1309
|
},
|
|
1302
1310
|
message = "Cargando...",
|
|
1303
1311
|
className = "",
|
|
1304
|
-
zIndexLevel = 100
|
|
1312
|
+
zIndexLevel = 100,
|
|
1313
|
+
animated = true,
|
|
1314
|
+
preventBodyScroll = true,
|
|
1315
|
+
spinner
|
|
1305
1316
|
}) => {
|
|
1306
1317
|
const [announceMessage, setAnnounceMessage] = react.useState("");
|
|
1307
1318
|
react.useEffect(() => {
|
|
@@ -1327,22 +1338,26 @@ var ModalLoading = ({
|
|
|
1327
1338
|
className,
|
|
1328
1339
|
closeDisabled: true,
|
|
1329
1340
|
whitoutBackground: true,
|
|
1341
|
+
animated,
|
|
1342
|
+
preventBodyScroll,
|
|
1330
1343
|
children: [
|
|
1331
1344
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "sr-only", "aria-live": "assertive", "aria-atomic": "true", children: announceMessage }),
|
|
1332
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1345
|
+
spinner ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1346
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1347
|
+
IconSpinnerDesktop,
|
|
1348
|
+
{
|
|
1349
|
+
className: "hidden md:block text-white animate-spin",
|
|
1350
|
+
"aria-hidden": "true"
|
|
1351
|
+
}
|
|
1352
|
+
),
|
|
1353
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1354
|
+
IconSpinnerMobile,
|
|
1355
|
+
{
|
|
1356
|
+
className: "block md:hidden text-white animate-spin",
|
|
1357
|
+
"aria-hidden": "true"
|
|
1358
|
+
}
|
|
1359
|
+
)
|
|
1360
|
+
] }),
|
|
1346
1361
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-white leading-normal text-2xl md:text-[64px] text-center mt-10 md:mt-20", children: message })
|
|
1347
1362
|
]
|
|
1348
1363
|
}
|