@votodigital-onpeui/react 0.1.14 → 0.1.15
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/{chunk-UEKVXFZK.mjs → chunk-2KVNK7AG.mjs} +3 -10
- package/dist/chunk-2KVNK7AG.mjs.map +1 -0
- package/dist/chunk-EZQGW6QF.mjs +427 -0
- package/dist/chunk-EZQGW6QF.mjs.map +1 -0
- package/dist/{chunk-7CLKQHKZ.mjs → chunk-IPUE4N5Z.mjs} +7 -333
- package/dist/chunk-IPUE4N5Z.mjs.map +1 -0
- package/dist/chunk-LTBKWXBG.mjs +14 -0
- package/dist/chunk-LTBKWXBG.mjs.map +1 -0
- package/dist/chunk-RU4LXI3J.mjs +336 -0
- package/dist/chunk-RU4LXI3J.mjs.map +1 -0
- package/dist/components.mjs +4 -2
- package/dist/hooks.d.mts +114 -0
- package/dist/hooks.d.ts +114 -0
- package/dist/hooks.js +774 -0
- package/dist/hooks.js.map +1 -0
- package/dist/hooks.mjs +5 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/icons.mjs +2 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +430 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -2
- package/package.json +9 -2
- package/dist/chunk-7CLKQHKZ.mjs.map +0 -1
- package/dist/chunk-UEKVXFZK.mjs.map +0 -1
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { IconCloseRadius } from './chunk-LTBKWXBG.mjs';
|
|
2
|
+
import { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var Portal = ({ children, container }) => {
|
|
7
|
+
const [mounted, setMounted] = useState(false);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
setMounted(true);
|
|
10
|
+
return () => setMounted(false);
|
|
11
|
+
}, []);
|
|
12
|
+
if (!mounted) return null;
|
|
13
|
+
let portalElement = container || document.querySelector("#portal");
|
|
14
|
+
if (!portalElement) {
|
|
15
|
+
portalElement = document.body;
|
|
16
|
+
}
|
|
17
|
+
return createPortal(children, portalElement);
|
|
18
|
+
};
|
|
19
|
+
var Modal = ({
|
|
20
|
+
isOpen,
|
|
21
|
+
onClose,
|
|
22
|
+
children,
|
|
23
|
+
whitoutBackground = false,
|
|
24
|
+
closeButton = false,
|
|
25
|
+
closeDisabled = false,
|
|
26
|
+
escapeToClose = true,
|
|
27
|
+
disableFocus = false,
|
|
28
|
+
disableFocusRestore = false,
|
|
29
|
+
existTabIndex = true,
|
|
30
|
+
zIndexLevel = 100,
|
|
31
|
+
onCloseComplete,
|
|
32
|
+
overlayColor: _overlayColor = "blue",
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
const modalRef = useRef(null);
|
|
36
|
+
const contentRef = useRef(null);
|
|
37
|
+
const previousActiveElement = useRef(null);
|
|
38
|
+
const [mounted, setMounted] = useState(false);
|
|
39
|
+
const [visible, setVisible] = useState(false);
|
|
40
|
+
const [cachedChildren, setCachedChildren] = useState(children);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (isOpen) {
|
|
43
|
+
setCachedChildren(children);
|
|
44
|
+
}
|
|
45
|
+
}, [isOpen, children]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (isOpen) {
|
|
48
|
+
setMounted(true);
|
|
49
|
+
const raf = requestAnimationFrame(() => {
|
|
50
|
+
requestAnimationFrame(() => setVisible(true));
|
|
51
|
+
});
|
|
52
|
+
return () => cancelAnimationFrame(raf);
|
|
53
|
+
} else {
|
|
54
|
+
setVisible(false);
|
|
55
|
+
const timer = setTimeout(() => {
|
|
56
|
+
setMounted(false);
|
|
57
|
+
onCloseComplete?.();
|
|
58
|
+
}, 200);
|
|
59
|
+
return () => clearTimeout(timer);
|
|
60
|
+
}
|
|
61
|
+
}, [isOpen, onCloseComplete]);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (isOpen) {
|
|
64
|
+
document.body.style.overflow = "hidden";
|
|
65
|
+
} else {
|
|
66
|
+
document.body.style.overflow = "";
|
|
67
|
+
}
|
|
68
|
+
return () => {
|
|
69
|
+
document.body.style.overflow = "";
|
|
70
|
+
};
|
|
71
|
+
}, [isOpen]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (!isOpen) return;
|
|
74
|
+
const resetScroll = () => {
|
|
75
|
+
const el = contentRef.current;
|
|
76
|
+
if (!el) return;
|
|
77
|
+
el.style.scrollBehavior = "auto";
|
|
78
|
+
el.scrollTop = 0;
|
|
79
|
+
requestAnimationFrame(() => {
|
|
80
|
+
el.scrollTop = 0;
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
el.style.scrollBehavior = "smooth";
|
|
83
|
+
}, 10);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
resetScroll();
|
|
87
|
+
[10, 50, 100, 200].forEach((d) => setTimeout(resetScroll, d));
|
|
88
|
+
}, [isOpen]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
let focusOutWrapper = null;
|
|
91
|
+
const pendingTasks = [];
|
|
92
|
+
const isElementVisible = (element) => {
|
|
93
|
+
const style = window.getComputedStyle(element);
|
|
94
|
+
return style.visibility !== "hidden" && style.display !== "none" && element.offsetParent !== null;
|
|
95
|
+
};
|
|
96
|
+
const getFocusableElements = (wrapper) => {
|
|
97
|
+
const selector = [
|
|
98
|
+
"a[href]",
|
|
99
|
+
"area[href]",
|
|
100
|
+
"button:not([disabled])",
|
|
101
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
102
|
+
"select:not([disabled])",
|
|
103
|
+
"textarea:not([disabled])",
|
|
104
|
+
"iframe",
|
|
105
|
+
"object",
|
|
106
|
+
"embed",
|
|
107
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
108
|
+
'[contenteditable="true"]'
|
|
109
|
+
].join(",");
|
|
110
|
+
let focusable = Array.from(
|
|
111
|
+
wrapper.querySelectorAll(selector)
|
|
112
|
+
).filter((el) => isElementVisible(el) && el.tabIndex !== -1);
|
|
113
|
+
if (wrapper.tabIndex >= 0) {
|
|
114
|
+
focusable = [wrapper, ...focusable];
|
|
115
|
+
}
|
|
116
|
+
return focusable;
|
|
117
|
+
};
|
|
118
|
+
const handleFocusOut = (e) => {
|
|
119
|
+
if (!isOpen || disableFocus) return;
|
|
120
|
+
const wrapper = modalRef.current;
|
|
121
|
+
if (!wrapper) return;
|
|
122
|
+
const relatedTarget = e.relatedTarget;
|
|
123
|
+
if (relatedTarget && !wrapper.contains(relatedTarget)) {
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
const currentActive = document.activeElement;
|
|
126
|
+
if (!currentActive || !wrapper.contains(currentActive)) {
|
|
127
|
+
const focusable = getFocusableElements(wrapper);
|
|
128
|
+
if (focusable.length > 0) {
|
|
129
|
+
focusable[focusable.length - 1].focus();
|
|
130
|
+
} else {
|
|
131
|
+
wrapper.focus();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}, 0);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const handleKeyDown = (e) => {
|
|
138
|
+
if (e.key === "Escape" && escapeToClose && !closeDisabled) {
|
|
139
|
+
onClose();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (!isOpen || disableFocus) return;
|
|
143
|
+
const wrapper = modalRef.current;
|
|
144
|
+
if (!wrapper) return;
|
|
145
|
+
const focusable = getFocusableElements(wrapper);
|
|
146
|
+
const active = document.activeElement || null;
|
|
147
|
+
const arrowKeys = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
148
|
+
if (arrowKeys.includes(e.key)) {
|
|
149
|
+
if (active && wrapper.contains(active)) {
|
|
150
|
+
const activeIndex2 = focusable.indexOf(active);
|
|
151
|
+
if ((e.key === "ArrowUp" || e.key === "ArrowLeft") && activeIndex2 === 0) {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
e.stopPropagation();
|
|
154
|
+
if (focusable.length > 1) focusable[focusable.length - 1].focus();
|
|
155
|
+
else active.focus();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if ((e.key === "ArrowDown" || e.key === "ArrowRight") && activeIndex2 === focusable.length - 1) {
|
|
159
|
+
e.preventDefault();
|
|
160
|
+
e.stopPropagation();
|
|
161
|
+
if (focusable.length > 1) focusable[0].focus();
|
|
162
|
+
else active.focus();
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
requestAnimationFrame(() => {
|
|
166
|
+
const currentActive = document.activeElement;
|
|
167
|
+
if (!currentActive || !wrapper.contains(currentActive)) {
|
|
168
|
+
if (activeIndex2 !== -1 && focusable[activeIndex2])
|
|
169
|
+
focusable[activeIndex2].focus();
|
|
170
|
+
else if (focusable.length > 0) focusable[0].focus();
|
|
171
|
+
else wrapper.focus();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
if (focusable.length > 0) {
|
|
177
|
+
if (e.key === "ArrowUp" || e.key === "ArrowLeft")
|
|
178
|
+
focusable[focusable.length - 1].focus();
|
|
179
|
+
else focusable[0].focus();
|
|
180
|
+
} else {
|
|
181
|
+
wrapper.focus();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (e.key !== "Tab") return;
|
|
187
|
+
if (focusable.length === 0) {
|
|
188
|
+
e.preventDefault();
|
|
189
|
+
wrapper.focus();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const first = focusable[0];
|
|
193
|
+
const last = focusable[focusable.length - 1];
|
|
194
|
+
const isShift = e.shiftKey;
|
|
195
|
+
if (!active || !wrapper.contains(active)) {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
(isShift ? last : first).focus();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const activeIndex = focusable.indexOf(active);
|
|
201
|
+
if (!isShift && (active === last || activeIndex === focusable.length - 1)) {
|
|
202
|
+
e.preventDefault();
|
|
203
|
+
first.focus();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (isShift) {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
if (active === first || active === wrapper || activeIndex === 0)
|
|
209
|
+
last.focus();
|
|
210
|
+
else if (activeIndex > 0) focusable[activeIndex - 1].focus();
|
|
211
|
+
else last.focus();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
if (isOpen && !disableFocus) {
|
|
215
|
+
previousActiveElement.current = document.activeElement;
|
|
216
|
+
const labelledById = props["aria-labelledby"];
|
|
217
|
+
const focusInitial = (wrapper) => {
|
|
218
|
+
if (labelledById) {
|
|
219
|
+
const labelEl = document.getElementById(labelledById);
|
|
220
|
+
if (labelEl instanceof HTMLElement) {
|
|
221
|
+
if (!labelEl.hasAttribute("tabindex")) labelEl.setAttribute("tabindex", "-1");
|
|
222
|
+
labelEl.focus({ preventScroll: true });
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const focusable = getFocusableElements(wrapper);
|
|
227
|
+
const first = focusable[0];
|
|
228
|
+
if (first) first.focus({ preventScroll: true });
|
|
229
|
+
else wrapper.focus();
|
|
230
|
+
};
|
|
231
|
+
const bindFocusManagement = (attempt = 0) => {
|
|
232
|
+
const wrapper = modalRef.current;
|
|
233
|
+
if (!wrapper) {
|
|
234
|
+
if (attempt < 10) {
|
|
235
|
+
pendingTasks.push(
|
|
236
|
+
globalThis.setTimeout(() => bindFocusManagement(attempt + 1), 25)
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (focusOutWrapper !== wrapper) {
|
|
242
|
+
focusOutWrapper?.removeEventListener("focusout", handleFocusOut);
|
|
243
|
+
wrapper.addEventListener("focusout", handleFocusOut);
|
|
244
|
+
focusOutWrapper = wrapper;
|
|
245
|
+
}
|
|
246
|
+
focusInitial(wrapper);
|
|
247
|
+
};
|
|
248
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
249
|
+
pendingTasks.push(globalThis.setTimeout(() => bindFocusManagement(), 0));
|
|
250
|
+
} else if (isOpen && disableFocus) {
|
|
251
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
252
|
+
}
|
|
253
|
+
return () => {
|
|
254
|
+
pendingTasks.forEach((task) => globalThis.clearTimeout(task));
|
|
255
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
256
|
+
focusOutWrapper?.removeEventListener("focusout", handleFocusOut);
|
|
257
|
+
if (!disableFocus && !disableFocusRestore && previousActiveElement.current) {
|
|
258
|
+
previousActiveElement.current.focus();
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}, [
|
|
262
|
+
isOpen,
|
|
263
|
+
onClose,
|
|
264
|
+
closeDisabled,
|
|
265
|
+
escapeToClose,
|
|
266
|
+
disableFocus,
|
|
267
|
+
disableFocusRestore,
|
|
268
|
+
props["aria-labelledby"]
|
|
269
|
+
]);
|
|
270
|
+
if (!mounted) return null;
|
|
271
|
+
const contentClass = [
|
|
272
|
+
"relative flex flex-col items-center justify-start",
|
|
273
|
+
whitoutBackground ? "bg-transparent" : [
|
|
274
|
+
"bg-white",
|
|
275
|
+
"pt-[25px] px-4 pb-[50px]",
|
|
276
|
+
"min-w-[320px] w-[95vw] max-w-[95vw] max-h-[90vh]",
|
|
277
|
+
"overflow-y-auto scroll-smooth",
|
|
278
|
+
"md:pt-[35px] md:px-8 md:pb-[54px] md:max-w-[1000px]"
|
|
279
|
+
].join(" "),
|
|
280
|
+
props.className || ""
|
|
281
|
+
].filter(Boolean).join(" ");
|
|
282
|
+
return /* @__PURE__ */ jsxs(Portal, { children: [
|
|
283
|
+
/* @__PURE__ */ jsx(
|
|
284
|
+
"div",
|
|
285
|
+
{
|
|
286
|
+
style: { zIndex: zIndexLevel },
|
|
287
|
+
className: [
|
|
288
|
+
"fixed inset-0 bg-onpe-blue transition-opacity duration-200",
|
|
289
|
+
visible ? "opacity-80" : "opacity-0"
|
|
290
|
+
].join(" "),
|
|
291
|
+
onClick: onClose
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ jsx(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
style: { zIndex: zIndexLevel + 10 },
|
|
298
|
+
className: [
|
|
299
|
+
"fixed top-0 w-full h-screen grid place-items-center",
|
|
300
|
+
"transition-all duration-200",
|
|
301
|
+
visible ? "opacity-100 scale-100 translate-y-0" : "opacity-[0.2] scale-95 -translate-y-5"
|
|
302
|
+
].join(" "),
|
|
303
|
+
children: /* @__PURE__ */ jsx("div", { className: "relative grid place-items-center", children: /* @__PURE__ */ jsxs(
|
|
304
|
+
"div",
|
|
305
|
+
{
|
|
306
|
+
ref: modalRef,
|
|
307
|
+
onClick: (e) => e.stopPropagation(),
|
|
308
|
+
...existTabIndex && { tabIndex: disableFocus ? -1 : 0 },
|
|
309
|
+
role: "dialog",
|
|
310
|
+
"aria-modal": "true",
|
|
311
|
+
"aria-labelledby": props["aria-labelledby"],
|
|
312
|
+
"aria-describedby": props["aria-describedby"],
|
|
313
|
+
"aria-label": props["aria-label"],
|
|
314
|
+
children: [
|
|
315
|
+
/* @__PURE__ */ jsx("div", { ref: contentRef, className: contentClass, children: cachedChildren }),
|
|
316
|
+
closeButton && /* @__PURE__ */ jsx(
|
|
317
|
+
"button",
|
|
318
|
+
{
|
|
319
|
+
onClick: onClose,
|
|
320
|
+
className: "absolute top-2.5 right-2.5 text-onpe-red cursor-pointer w-4 h-4 border-none bg-transparent p-0 md:w-6 md:h-6",
|
|
321
|
+
"aria-label": "Cerrar",
|
|
322
|
+
type: "button",
|
|
323
|
+
children: /* @__PURE__ */ jsx(IconCloseRadius, { "aria-hidden": "true", className: "w-full h-full" })
|
|
324
|
+
}
|
|
325
|
+
)
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
) })
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
] });
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export { Modal, Portal };
|
|
335
|
+
//# sourceMappingURL=chunk-RU4LXI3J.mjs.map
|
|
336
|
+
//# sourceMappingURL=chunk-RU4LXI3J.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Portal/Portal.tsx","../src/components/Modal/Modal.tsx"],"names":["useState","useEffect","activeIndex"],"mappings":";;;;;AAQO,IAAM,MAAA,GAAS,CAAC,EAAE,QAAA,EAAU,WAAU,KAAmB;AAC9D,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAS,KAAK,CAAA;AAE5C,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,UAAA,CAAW,IAAI,CAAA;AACf,IAAA,OAAO,MAAM,WAAW,KAAK,CAAA;AAAA,EAC/B,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,IAAI,CAAC,SAAS,OAAO,IAAA;AAErB,EAAA,IAAI,aAAA,GAAgB,SAAA,IAAa,QAAA,CAAS,aAAA,CAAc,SAAS,CAAA;AACjE,EAAA,IAAI,CAAC,aAAA,EAAe;AAClB,IAAA,aAAA,GAAgB,QAAA,CAAS,IAAA;AAAA,EAC3B;AAEA,EAAA,OAAO,YAAA,CAAa,UAAU,aAAa,CAAA;AAC7C;ACSO,IAAM,QAAQ,CAAC;AAAA,EACpB,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,iBAAA,GAAoB,KAAA;AAAA,EACpB,WAAA,GAAc,KAAA;AAAA,EACd,aAAA,GAAgB,KAAA;AAAA,EAChB,aAAA,GAAgB,IAAA;AAAA,EAChB,YAAA,GAAe,KAAA;AAAA,EACf,mBAAA,GAAsB,KAAA;AAAA,EACtB,aAAA,GAAgB,IAAA;AAAA,EAChB,WAAA,GAAc,GAAA;AAAA,EACd,eAAA;AAAA,EACA,cAAc,aAAA,GAAgB,M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A,cACC,WAAA,oBACC,GAAA;AAAA,gBAAC,QAAA;AAAA,gBAAA;AAAA,kBACC,OAAA,EAAS,OAAA;AAAA,kBACT,SAAA,EAAU,8GAAA;AAAA,kBACV,YAAA,EAAW,QAAA;AAAA,kBACX,IAAA,EAAK,QAAA;AAAA,kBAEL,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,aAAA,EAAY,MAAA,EAAO,WAAU,eAAA,EAAgB;AAAA;AAAA;AAChE;AAAA;AAAA,SAEJ,EACF;AAAA;AAAA;AACF,GAAA,EACF,CAAA;AAEJ","file":"chunk-RU4LXI3J.mjs","sourcesContent":["import { ReactNode, useEffect, useState } from \"react\";\r\nimport { createPortal } from \"react-dom\";\r\n\r\nexport interface PortalProps {\r\n children?: ReactNode;\r\n container?: Element | DocumentFragment | null;\r\n}\r\n\r\nexport const Portal = ({ children, container }: PortalProps) => {\r\n const [mounted, setMounted] = useState(false);\r\n\r\n useEffect(() => {\r\n setMounted(true);\r\n return () => setMounted(false);\r\n }, []);\r\n\r\n if (!mounted) return null;\r\n\r\n let portalElement = container || document.querySelector(\"#portal\");\r\n if (!portalElement) {\r\n portalElement = document.body;\r\n }\r\n\r\n return createPortal(children, portalElement);\r\n};\r\n\r\nexport default Portal;\r\n","import { HTMLAttributes, ReactNode, useEffect, useRef, useState } from \"react\";\r\nimport { Portal } from \"../Portal/Portal\";\r\nimport { IconCloseRadius } from \"../../icons/Actions/IconCloseRadius\";\r\n\r\nexport interface ModalProps extends HTMLAttributes<HTMLDivElement> {\r\n isOpen: boolean;\r\n onClose: () => void;\r\n children: ReactNode;\r\n whitoutBackground?: boolean;\r\n closeButton?: boolean;\r\n closeDisabled?: boolean;\r\n escapeToClose?: boolean;\r\n disableFocus?: boolean;\r\n disableFocusRestore?: boolean;\r\n existTabIndex?: boolean;\r\n zIndexLevel?: number;\r\n onCloseComplete?: () => void;\r\n overlayColor?:\r\n | \"blue\"\r\n | \"skyblue\"\r\n | \"skyblue-light\"\r\n | \"yellow\"\r\n | \"light-skyblue\"\r\n | \"gray\"\r\n | \"gray-light\"\r\n | \"gray-extra-light\"\r\n | \"red\"\r\n | \"dark-gray\"\r\n | \"green\"\r\n | \"yellow-light\"\r\n | \"primary\";\r\n}\r\n\r\nexport const Modal = ({\r\n isOpen,\r\n onClose,\r\n children,\r\n whitoutBackground = false,\r\n closeButton = false,\r\n closeDisabled = false,\r\n escapeToClose = true,\r\n disableFocus = false,\r\n disableFocusRestore = false,\r\n existTabIndex = true,\r\n zIndexLevel = 100,\r\n onCloseComplete,\r\n overlayColor: _overlayColor = \"blue\",\r\n ...props\r\n}: ModalProps) => {\r\n const modalRef = useRef<HTMLDivElement>(null);\r\n const contentRef = useRef<HTMLDivElement>(null);\r\n const previousActiveElement = useRef<HTMLElement | null>(null);\r\n\r\n // CSS animation state (replaces framer-motion AnimatePresence)\r\n const [mounted, setMounted] = useState(false);\r\n const [visible, setVisible] = useState(false);\r\n\r\n // Cache children during exit animation (replicates AnimatePresence behavior):\r\n // when global state clears data before the modal finishes closing, the cached\r\n // children keep the content visible throughout the exit animation.\r\n const [cachedChildren, setCachedChildren] = useState<ReactNode>(children);\r\n useEffect(() => {\r\n if (isOpen) {\r\n setCachedChildren(children);\r\n }\r\n }, [isOpen, children]);\r\n\r\n useEffect(() => {\r\n if (isOpen) {\r\n setMounted(true);\r\n const raf = requestAnimationFrame(() => {\r\n requestAnimationFrame(() => setVisible(true));\r\n });\r\n return () => cancelAnimationFrame(raf);\r\n } else {\r\n setVisible(false);\r\n const timer = setTimeout(() => {\r\n setMounted(false);\r\n onCloseComplete?.();\r\n }, 200);\r\n return () => clearTimeout(timer);\r\n }\r\n }, [isOpen, onCloseComplete]);\r\n\r\n // Body scroll lock\r\n useEffect(() => {\r\n if (isOpen) {\r\n document.body.style.overflow = \"hidden\";\r\n } else {\r\n document.body.style.overflow = \"\";\r\n }\r\n return () => {\r\n document.body.style.overflow = \"\";\r\n };\r\n }, [isOpen]);\r\n\r\n // Scroll reset when opening\r\n useEffect(() => {\r\n if (!isOpen) return;\r\n const resetScroll = () => {\r\n const el = contentRef.current;\r\n if (!el) return;\r\n el.style.scrollBehavior = \"auto\";\r\n el.scrollTop = 0;\r\n requestAnimationFrame(() => {\r\n el.scrollTop = 0;\r\n setTimeout(() => {\r\n el.style.scrollBehavior = \"smooth\";\r\n }, 10);\r\n });\r\n };\r\n resetScroll();\r\n [10, 50, 100, 200].forEach((d) => setTimeout(resetScroll, d));\r\n }, [isOpen]);\r\n\r\n // Keyboard handling and focus trap\r\n useEffect(() => {\r\n let focusOutWrapper: HTMLDivElement | null = null;\r\n const pendingTasks: Array<ReturnType<typeof globalThis.setTimeout>> = [];\r\n\r\n const isElementVisible = (element: HTMLElement) => {\r\n const style = window.getComputedStyle(element);\r\n return (\r\n style.visibility !== \"hidden\" &&\r\n style.display !== \"none\" &&\r\n element.offsetParent !== null\r\n );\r\n };\r\n\r\n const getFocusableElements = (wrapper: HTMLElement) => {\r\n const selector = [\r\n \"a[href]\",\r\n \"area[href]\",\r\n \"button:not([disabled])\",\r\n 'input:not([disabled]):not([type=\"hidden\"])',\r\n \"select:not([disabled])\",\r\n \"textarea:not([disabled])\",\r\n \"iframe\",\r\n \"object\",\r\n \"embed\",\r\n '[tabindex]:not([tabindex=\"-1\"])',\r\n '[contenteditable=\"true\"]',\r\n ].join(\",\");\r\n\r\n let focusable = Array.from(\r\n wrapper.querySelectorAll<HTMLElement>(selector)\r\n ).filter((el) => isElementVisible(el) && el.tabIndex !== -1);\r\n\r\n if (wrapper.tabIndex >= 0) {\r\n focusable = [wrapper, ...focusable];\r\n }\r\n return focusable;\r\n };\r\n\r\n const handleFocusOut = (e: FocusEvent) => {\r\n if (!isOpen || disableFocus) return;\r\n const wrapper = modalRef.current;\r\n if (!wrapper) return;\r\n const relatedTarget = e.relatedTarget as HTMLElement;\r\n if (relatedTarget && !wrapper.contains(relatedTarget)) {\r\n setTimeout(() => {\r\n const currentActive = document.activeElement as HTMLElement;\r\n if (!currentActive || !wrapper.contains(currentActive)) {\r\n const focusable = getFocusableElements(wrapper);\r\n if (focusable.length > 0) {\r\n focusable[focusable.length - 1].focus();\r\n } else {\r\n wrapper.focus();\r\n }\r\n }\r\n }, 0);\r\n }\r\n };\r\n\r\n const handleKeyDown = (e: KeyboardEvent) => {\r\n if (e.key === \"Escape\" && escapeToClose && !closeDisabled) {\r\n onClose();\r\n return;\r\n }\r\n\r\n if (!isOpen || disableFocus) return;\r\n const wrapper = modalRef.current;\r\n if (!wrapper) return;\r\n\r\n const focusable = getFocusableElements(wrapper);\r\n const active = (document.activeElement as HTMLElement) || null;\r\n\r\n const arrowKeys = [\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"];\r\n if (arrowKeys.includes(e.key)) {\r\n if (active && wrapper.contains(active)) {\r\n const activeIndex = focusable.indexOf(active);\r\n if (\r\n (e.key === \"ArrowUp\" || e.key === \"ArrowLeft\") &&\r\n activeIndex === 0\r\n ) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (focusable.length > 1) focusable[focusable.length - 1].focus();\r\n else active.focus();\r\n return;\r\n }\r\n if (\r\n (e.key === \"ArrowDown\" || e.key === \"ArrowRight\") &&\r\n activeIndex === focusable.length - 1\r\n ) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (focusable.length > 1) focusable[0].focus();\r\n else active.focus();\r\n return;\r\n }\r\n requestAnimationFrame(() => {\r\n const currentActive = document.activeElement as HTMLElement;\r\n if (!currentActive || !wrapper.contains(currentActive)) {\r\n if (activeIndex !== -1 && focusable[activeIndex])\r\n focusable[activeIndex].focus();\r\n else if (focusable.length > 0) focusable[0].focus();\r\n else wrapper.focus();\r\n }\r\n });\r\n } else {\r\n e.preventDefault();\r\n if (focusable.length > 0) {\r\n if (e.key === \"ArrowUp\" || e.key === \"ArrowLeft\")\r\n focusable[focusable.length - 1].focus();\r\n else focusable[0].focus();\r\n } else {\r\n wrapper.focus();\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (e.key !== \"Tab\") return;\r\n if (focusable.length === 0) {\r\n e.preventDefault();\r\n wrapper.focus();\r\n return;\r\n }\r\n\r\n const first = focusable[0];\r\n const last = focusable[focusable.length - 1];\r\n const isShift = e.shiftKey;\r\n\r\n if (!active || !wrapper.contains(active)) {\r\n e.preventDefault();\r\n (isShift ? last : first).focus();\r\n return;\r\n }\r\n\r\n const activeIndex = focusable.indexOf(active);\r\n if (!isShift && (active === last || activeIndex === focusable.length - 1)) {\r\n e.preventDefault();\r\n first.focus();\r\n return;\r\n }\r\n\r\n if (isShift) {\r\n e.preventDefault();\r\n if (active === first || active === wrapper || activeIndex === 0)\r\n last.focus();\r\n else if (activeIndex > 0) focusable[activeIndex - 1].focus();\r\n else last.focus();\r\n }\r\n };\r\n\r\n if (isOpen && !disableFocus) {\r\n previousActiveElement.current = document.activeElement as HTMLElement;\r\n const labelledById = props[\"aria-labelledby\"];\r\n\r\n const focusInitial = (wrapper: HTMLElement) => {\r\n if (labelledById) {\r\n const labelEl = document.getElementById(labelledById);\r\n if (labelEl instanceof HTMLElement) {\r\n if (!labelEl.hasAttribute(\"tabindex\")) labelEl.setAttribute(\"tabindex\", \"-1\");\r\n labelEl.focus({ preventScroll: true });\r\n return;\r\n }\r\n }\r\n const focusable = getFocusableElements(wrapper);\r\n const first = focusable[0];\r\n if (first) first.focus({ preventScroll: true });\r\n else wrapper.focus();\r\n };\r\n\r\n const bindFocusManagement = (attempt = 0) => {\r\n const wrapper = modalRef.current;\r\n if (!wrapper) {\r\n if (attempt < 10) {\r\n pendingTasks.push(\r\n globalThis.setTimeout(() => bindFocusManagement(attempt + 1), 25)\r\n );\r\n }\r\n return;\r\n }\r\n\r\n if (focusOutWrapper !== wrapper) {\r\n focusOutWrapper?.removeEventListener(\"focusout\", handleFocusOut);\r\n wrapper.addEventListener(\"focusout\", handleFocusOut);\r\n focusOutWrapper = wrapper;\r\n }\r\n\r\n focusInitial(wrapper);\r\n };\r\n\r\n document.addEventListener(\"keydown\", handleKeyDown);\r\n pendingTasks.push(globalThis.setTimeout(() => bindFocusManagement(), 0));\r\n } else if (isOpen && disableFocus) {\r\n document.addEventListener(\"keydown\", handleKeyDown);\r\n }\r\n\r\n return () => {\r\n pendingTasks.forEach((task) => globalThis.clearTimeout(task));\r\n document.removeEventListener(\"keydown\", handleKeyDown);\r\n focusOutWrapper?.removeEventListener(\"focusout\", handleFocusOut);\r\n if (!disableFocus && !disableFocusRestore && previousActiveElement.current) {\r\n previousActiveElement.current.focus();\r\n }\r\n };\r\n }, [\r\n isOpen,\r\n onClose,\r\n closeDisabled,\r\n escapeToClose,\r\n disableFocus,\r\n disableFocusRestore,\r\n props[\"aria-labelledby\"],\r\n ]);\r\n\r\n if (!mounted) return null;\r\n\r\n const contentClass = [\r\n \"relative flex flex-col items-center justify-start\",\r\n whitoutBackground\r\n ? \"bg-transparent\"\r\n : [\r\n \"bg-white\",\r\n \"pt-[25px] px-4 pb-[50px]\",\r\n \"min-w-[320px] w-[95vw] max-w-[95vw] max-h-[90vh]\",\r\n \"overflow-y-auto scroll-smooth\",\r\n \"md:pt-[35px] md:px-8 md:pb-[54px] md:max-w-[1000px]\",\r\n ].join(\" \"),\r\n props.className || \"\",\r\n ]\r\n .filter(Boolean)\r\n .join(\" \");\r\n\r\n return (\r\n <Portal>\r\n {/* Backdrop */}\r\n <div\r\n style={{ zIndex: zIndexLevel }}\r\n className={[\r\n \"fixed inset-0 bg-onpe-blue transition-opacity duration-200\",\r\n visible ? \"opacity-80\" : \"opacity-0\",\r\n ].join(\" \")}\r\n onClick={onClose}\r\n />\r\n\r\n {/* Container */}\r\n <div\r\n style={{ zIndex: zIndexLevel + 10 }}\r\n className={[\r\n \"fixed top-0 w-full h-screen grid place-items-center\",\r\n \"transition-all duration-200\",\r\n visible\r\n ? \"opacity-100 scale-100 translate-y-0\"\r\n : \"opacity-[0.2] scale-95 -translate-y-5\",\r\n ].join(\" \")}\r\n >\r\n <div className=\"relative grid place-items-center\">\r\n <div\r\n ref={modalRef}\r\n onClick={(e) => e.stopPropagation()}\r\n {...(existTabIndex && { tabIndex: disableFocus ? -1 : 0 })}\r\n role=\"dialog\"\r\n aria-modal=\"true\"\r\n aria-labelledby={props[\"aria-labelledby\"]}\r\n aria-describedby={props[\"aria-describedby\"]}\r\n aria-label={props[\"aria-label\"]}\r\n >\r\n <div ref={contentRef} className={contentClass}>\r\n {cachedChildren}\r\n </div>\r\n {closeButton && (\r\n <button\r\n onClick={onClose}\r\n className=\"absolute top-2.5 right-2.5 text-onpe-red cursor-pointer w-4 h-4 border-none bg-transparent p-0 md:w-6 md:h-6\"\r\n aria-label=\"Cerrar\"\r\n type=\"button\"\r\n >\r\n <IconCloseRadius aria-hidden=\"true\" className=\"w-full h-full\" />\r\n </button>\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </Portal>\r\n );\r\n};\r\n\r\nexport default Modal;\r\n"]}
|
package/dist/components.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { BrowserRecommended, Button, Footer,
|
|
2
|
-
import './chunk-
|
|
1
|
+
export { BrowserRecommended, Button, Footer, ModalBrowserIncompatible, ModalConfirm, ModalDnieVersions, ModalLoading, ModalNfc, ModalSystemIncompatible, NotRecommended, Overlay, Show } from './chunk-IPUE4N5Z.mjs';
|
|
2
|
+
import './chunk-2KVNK7AG.mjs';
|
|
3
|
+
export { Modal, Portal } from './chunk-RU4LXI3J.mjs';
|
|
4
|
+
import './chunk-LTBKWXBG.mjs';
|
|
3
5
|
//# sourceMappingURL=components.mjs.map
|
|
4
6
|
//# sourceMappingURL=components.mjs.map
|
package/dist/hooks.d.mts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as zustand from 'zustand';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
interface ModalIframePreloadStore {
|
|
6
|
+
modalUrl: string;
|
|
7
|
+
isOpenModal: boolean;
|
|
8
|
+
isIframeReady: boolean;
|
|
9
|
+
setModalUrl: (url: string) => void;
|
|
10
|
+
openModal: () => void;
|
|
11
|
+
closeModal: () => void;
|
|
12
|
+
setIsIframeReady: (ready: boolean) => void;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare const useModalIframePreload: zustand.UseBoundStore<zustand.StoreApi<ModalIframePreloadStore>>;
|
|
16
|
+
|
|
17
|
+
type MessageStatus = "EXPIRED_APP" | "OPEN_APP" | "LAUNCH_APP";
|
|
18
|
+
interface IframeMessage {
|
|
19
|
+
status: MessageStatus;
|
|
20
|
+
url?: string;
|
|
21
|
+
data?: unknown;
|
|
22
|
+
token?: string;
|
|
23
|
+
}
|
|
24
|
+
interface UseIframeCommunicationParams {
|
|
25
|
+
onExpiredApp?: (data: IframeMessage) => void;
|
|
26
|
+
onOpenApp?: (data: IframeMessage) => void;
|
|
27
|
+
onLaunchApp?: (data: IframeMessage) => void;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
allowedOrigin?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const useIframeCommunication: ({ onExpiredApp, onOpenApp, onLaunchApp, enabled, allowedOrigin, }?: UseIframeCommunicationParams) => void;
|
|
32
|
+
interface UseSendMessageToIframeParams {
|
|
33
|
+
iframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
34
|
+
modalUrl: string;
|
|
35
|
+
}
|
|
36
|
+
declare const useSendMessageToIframe: ({ iframeRef, modalUrl, }: UseSendMessageToIframeParams) => {
|
|
37
|
+
sendMessageToIframe: (message: Record<string, unknown>) => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
declare const useIframePreload: () => {
|
|
41
|
+
modalUrl: string;
|
|
42
|
+
setModalUrl: (url: string) => void;
|
|
43
|
+
isOpenModal: boolean;
|
|
44
|
+
closeModal: () => void;
|
|
45
|
+
isPreloading: boolean;
|
|
46
|
+
preloadIframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
47
|
+
iframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
48
|
+
handlePreloadIframeReady: () => void;
|
|
49
|
+
handleModalIframeReady: () => void;
|
|
50
|
+
reset: () => void;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
interface SocketEventData {
|
|
54
|
+
success: boolean;
|
|
55
|
+
token: string;
|
|
56
|
+
}
|
|
57
|
+
interface UseSocketConnectionParams {
|
|
58
|
+
socketUrl: string;
|
|
59
|
+
secure?: boolean;
|
|
60
|
+
isOpenLaunchApp: boolean;
|
|
61
|
+
dataOpenLaunchApp: Record<string, unknown>;
|
|
62
|
+
closeLaunchApp: () => void;
|
|
63
|
+
closeModal: () => void;
|
|
64
|
+
onComplete?: (data: SocketEventData) => void;
|
|
65
|
+
onDisconnectClient?: () => void;
|
|
66
|
+
onDisconnect?: () => void;
|
|
67
|
+
onMaxReconnects?: () => void;
|
|
68
|
+
onConnectionChange?: (connected: boolean) => void;
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
declare const useSocketConnection: ({ socketUrl, secure, isOpenLaunchApp, dataOpenLaunchApp, closeLaunchApp, closeModal, onComplete, onDisconnectClient, onDisconnect, onMaxReconnects, onConnectionChange, enabled, }: UseSocketConnectionParams) => {
|
|
72
|
+
attempts: number;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
interface UseOnpeIdAuthParams {
|
|
76
|
+
socketUrl: string;
|
|
77
|
+
secure?: boolean;
|
|
78
|
+
navigate: (url: string) => void;
|
|
79
|
+
onConnectionChange?: (connected: boolean) => void;
|
|
80
|
+
onComplete?: (data: SocketEventData) => void;
|
|
81
|
+
onDisconnectClient?: () => void;
|
|
82
|
+
onExpiredApp?: () => void;
|
|
83
|
+
onDisconnect?: () => void;
|
|
84
|
+
onMaxReconnects?: () => void;
|
|
85
|
+
}
|
|
86
|
+
declare const useOnpeIdAuth: ({ socketUrl, secure, navigate, onConnectionChange, onComplete, onDisconnectClient, onExpiredApp, onDisconnect, onMaxReconnects, }: UseOnpeIdAuthParams) => {
|
|
87
|
+
modalUrl: string;
|
|
88
|
+
setModalUrl: (url: string) => void;
|
|
89
|
+
isOpenModal: boolean;
|
|
90
|
+
isPreloading: boolean;
|
|
91
|
+
isOpenLaunchApp: boolean;
|
|
92
|
+
handleClose: () => void;
|
|
93
|
+
iframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
94
|
+
preloadIframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
95
|
+
handlePreloadIframeReady: () => void;
|
|
96
|
+
handleModalIframeReady: () => void;
|
|
97
|
+
attempts: number;
|
|
98
|
+
reset: () => void;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
interface OnpeIdModalProps {
|
|
102
|
+
modalUrl: string;
|
|
103
|
+
isOpenModal: boolean;
|
|
104
|
+
isOpenLaunchApp: boolean;
|
|
105
|
+
isOnline: boolean;
|
|
106
|
+
onClose: () => void;
|
|
107
|
+
iframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
108
|
+
preloadIframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
109
|
+
handlePreloadIframeReady: () => void;
|
|
110
|
+
handleModalIframeReady: () => void;
|
|
111
|
+
}
|
|
112
|
+
declare const OnpeIdModal: ({ modalUrl, isOpenModal, isOpenLaunchApp, isOnline, onClose, iframeRef, preloadIframeRef, handlePreloadIframeReady, handleModalIframeReady, }: OnpeIdModalProps) => react_jsx_runtime.JSX.Element;
|
|
113
|
+
|
|
114
|
+
export { type IframeMessage, type MessageStatus, OnpeIdModal, type SocketEventData, useIframeCommunication, useIframePreload, useModalIframePreload, useOnpeIdAuth, useSendMessageToIframe, useSocketConnection };
|
package/dist/hooks.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as zustand from 'zustand';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
interface ModalIframePreloadStore {
|
|
6
|
+
modalUrl: string;
|
|
7
|
+
isOpenModal: boolean;
|
|
8
|
+
isIframeReady: boolean;
|
|
9
|
+
setModalUrl: (url: string) => void;
|
|
10
|
+
openModal: () => void;
|
|
11
|
+
closeModal: () => void;
|
|
12
|
+
setIsIframeReady: (ready: boolean) => void;
|
|
13
|
+
reset: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare const useModalIframePreload: zustand.UseBoundStore<zustand.StoreApi<ModalIframePreloadStore>>;
|
|
16
|
+
|
|
17
|
+
type MessageStatus = "EXPIRED_APP" | "OPEN_APP" | "LAUNCH_APP";
|
|
18
|
+
interface IframeMessage {
|
|
19
|
+
status: MessageStatus;
|
|
20
|
+
url?: string;
|
|
21
|
+
data?: unknown;
|
|
22
|
+
token?: string;
|
|
23
|
+
}
|
|
24
|
+
interface UseIframeCommunicationParams {
|
|
25
|
+
onExpiredApp?: (data: IframeMessage) => void;
|
|
26
|
+
onOpenApp?: (data: IframeMessage) => void;
|
|
27
|
+
onLaunchApp?: (data: IframeMessage) => void;
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
allowedOrigin?: string;
|
|
30
|
+
}
|
|
31
|
+
declare const useIframeCommunication: ({ onExpiredApp, onOpenApp, onLaunchApp, enabled, allowedOrigin, }?: UseIframeCommunicationParams) => void;
|
|
32
|
+
interface UseSendMessageToIframeParams {
|
|
33
|
+
iframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
34
|
+
modalUrl: string;
|
|
35
|
+
}
|
|
36
|
+
declare const useSendMessageToIframe: ({ iframeRef, modalUrl, }: UseSendMessageToIframeParams) => {
|
|
37
|
+
sendMessageToIframe: (message: Record<string, unknown>) => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
declare const useIframePreload: () => {
|
|
41
|
+
modalUrl: string;
|
|
42
|
+
setModalUrl: (url: string) => void;
|
|
43
|
+
isOpenModal: boolean;
|
|
44
|
+
closeModal: () => void;
|
|
45
|
+
isPreloading: boolean;
|
|
46
|
+
preloadIframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
47
|
+
iframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
48
|
+
handlePreloadIframeReady: () => void;
|
|
49
|
+
handleModalIframeReady: () => void;
|
|
50
|
+
reset: () => void;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
interface SocketEventData {
|
|
54
|
+
success: boolean;
|
|
55
|
+
token: string;
|
|
56
|
+
}
|
|
57
|
+
interface UseSocketConnectionParams {
|
|
58
|
+
socketUrl: string;
|
|
59
|
+
secure?: boolean;
|
|
60
|
+
isOpenLaunchApp: boolean;
|
|
61
|
+
dataOpenLaunchApp: Record<string, unknown>;
|
|
62
|
+
closeLaunchApp: () => void;
|
|
63
|
+
closeModal: () => void;
|
|
64
|
+
onComplete?: (data: SocketEventData) => void;
|
|
65
|
+
onDisconnectClient?: () => void;
|
|
66
|
+
onDisconnect?: () => void;
|
|
67
|
+
onMaxReconnects?: () => void;
|
|
68
|
+
onConnectionChange?: (connected: boolean) => void;
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
}
|
|
71
|
+
declare const useSocketConnection: ({ socketUrl, secure, isOpenLaunchApp, dataOpenLaunchApp, closeLaunchApp, closeModal, onComplete, onDisconnectClient, onDisconnect, onMaxReconnects, onConnectionChange, enabled, }: UseSocketConnectionParams) => {
|
|
72
|
+
attempts: number;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
interface UseOnpeIdAuthParams {
|
|
76
|
+
socketUrl: string;
|
|
77
|
+
secure?: boolean;
|
|
78
|
+
navigate: (url: string) => void;
|
|
79
|
+
onConnectionChange?: (connected: boolean) => void;
|
|
80
|
+
onComplete?: (data: SocketEventData) => void;
|
|
81
|
+
onDisconnectClient?: () => void;
|
|
82
|
+
onExpiredApp?: () => void;
|
|
83
|
+
onDisconnect?: () => void;
|
|
84
|
+
onMaxReconnects?: () => void;
|
|
85
|
+
}
|
|
86
|
+
declare const useOnpeIdAuth: ({ socketUrl, secure, navigate, onConnectionChange, onComplete, onDisconnectClient, onExpiredApp, onDisconnect, onMaxReconnects, }: UseOnpeIdAuthParams) => {
|
|
87
|
+
modalUrl: string;
|
|
88
|
+
setModalUrl: (url: string) => void;
|
|
89
|
+
isOpenModal: boolean;
|
|
90
|
+
isPreloading: boolean;
|
|
91
|
+
isOpenLaunchApp: boolean;
|
|
92
|
+
handleClose: () => void;
|
|
93
|
+
iframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
94
|
+
preloadIframeRef: react.RefObject<HTMLIFrameElement | null>;
|
|
95
|
+
handlePreloadIframeReady: () => void;
|
|
96
|
+
handleModalIframeReady: () => void;
|
|
97
|
+
attempts: number;
|
|
98
|
+
reset: () => void;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
interface OnpeIdModalProps {
|
|
102
|
+
modalUrl: string;
|
|
103
|
+
isOpenModal: boolean;
|
|
104
|
+
isOpenLaunchApp: boolean;
|
|
105
|
+
isOnline: boolean;
|
|
106
|
+
onClose: () => void;
|
|
107
|
+
iframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
108
|
+
preloadIframeRef: React.RefObject<HTMLIFrameElement | null>;
|
|
109
|
+
handlePreloadIframeReady: () => void;
|
|
110
|
+
handleModalIframeReady: () => void;
|
|
111
|
+
}
|
|
112
|
+
declare const OnpeIdModal: ({ modalUrl, isOpenModal, isOpenLaunchApp, isOnline, onClose, iframeRef, preloadIframeRef, handlePreloadIframeReady, handleModalIframeReady, }: OnpeIdModalProps) => react_jsx_runtime.JSX.Element;
|
|
113
|
+
|
|
114
|
+
export { type IframeMessage, type MessageStatus, OnpeIdModal, type SocketEventData, useIframeCommunication, useIframePreload, useModalIframePreload, useOnpeIdAuth, useSendMessageToIframe, useSocketConnection };
|