aark-react-modalify 1.0.5 → 1.2.0
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 +683 -46
- package/dist/aark-react-modalify.css +1 -0
- package/dist/components/Icon.d.ts +18 -0
- package/dist/components/{ModalRenderer.d.ts → Modal.d.ts} +4 -3
- package/dist/components/Notification.d.ts +9 -0
- package/dist/components/modals/StandardModal.d.ts +8 -0
- package/dist/components/modals/index.d.ts +1 -0
- package/dist/components/notifications/StandardNotification.d.ts +8 -0
- package/dist/components/notifications/index.d.ts +1 -0
- package/dist/hooks/useModal.d.ts +2 -2
- package/dist/index-no-styles.cjs.js +1 -0
- package/dist/index-no-styles.esm.js +898 -0
- package/dist/index.d.ts +5 -2
- package/dist/logic/ModalManager.d.ts +7 -3
- package/dist/logic/ModalManagerNew.d.ts +0 -0
- package/dist/logic/aark.d.ts +4 -2
- package/dist/types/index.d.ts +84 -8
- package/dist/utils/inject-styles.d.ts +3 -0
- package/dist/utils/modal-css.d.ts +1 -1
- package/dist/utils/modal-root.d.ts +18 -0
- package/package.json +11 -4
- package/dist/ModalProvider-BAlPeDjm.js +0 -12
- package/dist/ModalProvider-DA6KcJdZ.cjs +0 -5
- package/dist/index.cjs.js +0 -23
- package/dist/index.esm.js +0 -405
package/dist/index.esm.js
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
import { createElement, useState, useCallback, useEffect } from "react";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
-
let currentConfig = null;
|
|
7
|
-
let container = null;
|
|
8
|
-
let root = null;
|
|
9
|
-
function init() {
|
|
10
|
-
if (container) return;
|
|
11
|
-
container = document.createElement("div");
|
|
12
|
-
container.id = "aark-react-modalify-root";
|
|
13
|
-
container.style.position = "relative";
|
|
14
|
-
container.style.zIndex = "9999";
|
|
15
|
-
document.body.appendChild(container);
|
|
16
|
-
import("./ModalProvider-BAlPeDjm.js").then(({ default: ModalProvider }) => {
|
|
17
|
-
if (container) {
|
|
18
|
-
root = createRoot(container);
|
|
19
|
-
root.render(createElement(ModalProvider));
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function subscribe(listener) {
|
|
24
|
-
listeners.add(listener);
|
|
25
|
-
return () => listeners.delete(listener);
|
|
26
|
-
}
|
|
27
|
-
function emit(type, config) {
|
|
28
|
-
const event = { type, config };
|
|
29
|
-
listeners.forEach((listener) => listener(event));
|
|
30
|
-
}
|
|
31
|
-
function fire(content, options) {
|
|
32
|
-
init();
|
|
33
|
-
const config = {
|
|
34
|
-
content,
|
|
35
|
-
options: Object.assign(
|
|
36
|
-
{
|
|
37
|
-
position: "center",
|
|
38
|
-
mode: "modal",
|
|
39
|
-
showCloseIcon: true,
|
|
40
|
-
preventEscClose: false,
|
|
41
|
-
preventOverlayClose: false
|
|
42
|
-
},
|
|
43
|
-
options
|
|
44
|
-
)
|
|
45
|
-
};
|
|
46
|
-
currentConfig = config;
|
|
47
|
-
emit("open", config);
|
|
48
|
-
}
|
|
49
|
-
function close() {
|
|
50
|
-
if (currentConfig) {
|
|
51
|
-
emit("beforeClose", currentConfig);
|
|
52
|
-
currentConfig = null;
|
|
53
|
-
emit("close");
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function isOpen() {
|
|
57
|
-
return currentConfig !== null;
|
|
58
|
-
}
|
|
59
|
-
function getCurrentConfig() {
|
|
60
|
-
return currentConfig;
|
|
61
|
-
}
|
|
62
|
-
function closeAll() {
|
|
63
|
-
close();
|
|
64
|
-
}
|
|
65
|
-
function cleanup() {
|
|
66
|
-
if (container && container.parentNode) {
|
|
67
|
-
container.parentNode.removeChild(container);
|
|
68
|
-
container = null;
|
|
69
|
-
root = null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
const modalManager = {
|
|
73
|
-
subscribe,
|
|
74
|
-
fire,
|
|
75
|
-
close,
|
|
76
|
-
isOpen,
|
|
77
|
-
getCurrentConfig,
|
|
78
|
-
closeAll,
|
|
79
|
-
cleanup
|
|
80
|
-
};
|
|
81
|
-
function setAarkModalTheme(theme) {
|
|
82
|
-
const root2 = document.documentElement;
|
|
83
|
-
if (theme.overlayBackground) {
|
|
84
|
-
root2.style.setProperty("--aark-modal-overlay-bg", theme.overlayBackground);
|
|
85
|
-
}
|
|
86
|
-
if (theme.overlayBlur) {
|
|
87
|
-
root2.style.setProperty("--aark-modal-overlay-blur", theme.overlayBlur);
|
|
88
|
-
}
|
|
89
|
-
if (theme.modalBackground) {
|
|
90
|
-
root2.style.setProperty("--aark-modal-bg", theme.modalBackground);
|
|
91
|
-
}
|
|
92
|
-
if (theme.modalBorderRadius) {
|
|
93
|
-
root2.style.setProperty(
|
|
94
|
-
"--aark-modal-border-radius",
|
|
95
|
-
theme.modalBorderRadius
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
if (theme.modalShadow) {
|
|
99
|
-
root2.style.setProperty("--aark-modal-shadow", theme.modalShadow);
|
|
100
|
-
}
|
|
101
|
-
if (theme.modalPadding) {
|
|
102
|
-
root2.style.setProperty("--aark-modal-padding", theme.modalPadding);
|
|
103
|
-
}
|
|
104
|
-
if (theme.modalZIndex) {
|
|
105
|
-
root2.style.setProperty(
|
|
106
|
-
"--aark-modal-z-index",
|
|
107
|
-
theme.modalZIndex.toString()
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
if (theme.modalContentZIndex) {
|
|
111
|
-
root2.style.setProperty(
|
|
112
|
-
"--aark-modal-content-z-index",
|
|
113
|
-
theme.modalContentZIndex.toString()
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
if (theme.closeButtonColor) {
|
|
117
|
-
root2.style.setProperty("--aark-modal-close-color", theme.closeButtonColor);
|
|
118
|
-
}
|
|
119
|
-
if (theme.closeButtonHoverBackground) {
|
|
120
|
-
root2.style.setProperty(
|
|
121
|
-
"--aark-modal-close-hover-bg",
|
|
122
|
-
theme.closeButtonHoverBackground
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
if (theme.closeButtonHoverColor) {
|
|
126
|
-
root2.style.setProperty(
|
|
127
|
-
"--aark-modal-close-hover-color",
|
|
128
|
-
theme.closeButtonHoverColor
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
if (theme.closeButtonFocusOutline) {
|
|
132
|
-
root2.style.setProperty(
|
|
133
|
-
"--aark-modal-close-focus-outline",
|
|
134
|
-
theme.closeButtonFocusOutline
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
if (theme.animationDuration) {
|
|
138
|
-
root2.style.setProperty(
|
|
139
|
-
"--aark-modal-animation-duration",
|
|
140
|
-
theme.animationDuration
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
if (theme.fadeDuration) {
|
|
144
|
-
root2.style.setProperty("--aark-modal-fade-duration", theme.fadeDuration);
|
|
145
|
-
}
|
|
146
|
-
if (theme.customOverlayBackground) {
|
|
147
|
-
root2.style.setProperty(
|
|
148
|
-
"--aark-custom-overlay-bg",
|
|
149
|
-
theme.customOverlayBackground
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
if (theme.customOverlayBlur) {
|
|
153
|
-
root2.style.setProperty(
|
|
154
|
-
"--aark-custom-overlay-blur",
|
|
155
|
-
theme.customOverlayBlur
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
if (theme.customModalGradientStart) {
|
|
159
|
-
root2.style.setProperty(
|
|
160
|
-
"--aark-custom-modal-gradient-start",
|
|
161
|
-
theme.customModalGradientStart
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
if (theme.customModalGradientEnd) {
|
|
165
|
-
root2.style.setProperty(
|
|
166
|
-
"--aark-custom-modal-gradient-end",
|
|
167
|
-
theme.customModalGradientEnd
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
if (theme.customModalTextColor) {
|
|
171
|
-
root2.style.setProperty(
|
|
172
|
-
"--aark-custom-modal-text-color",
|
|
173
|
-
theme.customModalTextColor
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
if (theme.customModalShadow) {
|
|
177
|
-
root2.style.setProperty(
|
|
178
|
-
"--aark-custom-modal-shadow",
|
|
179
|
-
theme.customModalShadow
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
if (theme.customModalCloseColor) {
|
|
183
|
-
root2.style.setProperty(
|
|
184
|
-
"--aark-custom-modal-close-color",
|
|
185
|
-
theme.customModalCloseColor
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
if (theme.customModalCloseHoverBackground) {
|
|
189
|
-
root2.style.setProperty(
|
|
190
|
-
"--aark-custom-modal-close-hover-bg",
|
|
191
|
-
theme.customModalCloseHoverBackground
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
if (theme.customModalCloseHoverColor) {
|
|
195
|
-
root2.style.setProperty(
|
|
196
|
-
"--aark-custom-modal-close-hover-color",
|
|
197
|
-
theme.customModalCloseHoverColor
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function resetAarkModalTheme() {
|
|
202
|
-
const root2 = document.documentElement;
|
|
203
|
-
const properties = [
|
|
204
|
-
"--aark-modal-overlay-bg",
|
|
205
|
-
"--aark-modal-overlay-blur",
|
|
206
|
-
"--aark-modal-bg",
|
|
207
|
-
"--aark-modal-border-radius",
|
|
208
|
-
"--aark-modal-shadow",
|
|
209
|
-
"--aark-modal-padding",
|
|
210
|
-
"--aark-modal-z-index",
|
|
211
|
-
"--aark-modal-content-z-index",
|
|
212
|
-
"--aark-modal-close-color",
|
|
213
|
-
"--aark-modal-close-hover-bg",
|
|
214
|
-
"--aark-modal-close-hover-color",
|
|
215
|
-
"--aark-modal-close-focus-outline",
|
|
216
|
-
"--aark-modal-animation-duration",
|
|
217
|
-
"--aark-modal-fade-duration",
|
|
218
|
-
"--aark-custom-overlay-bg",
|
|
219
|
-
"--aark-custom-overlay-blur",
|
|
220
|
-
"--aark-custom-modal-gradient-start",
|
|
221
|
-
"--aark-custom-modal-gradient-end",
|
|
222
|
-
"--aark-custom-modal-text-color",
|
|
223
|
-
"--aark-custom-modal-shadow",
|
|
224
|
-
"--aark-custom-modal-close-color",
|
|
225
|
-
"--aark-custom-modal-close-hover-bg",
|
|
226
|
-
"--aark-custom-modal-close-hover-color"
|
|
227
|
-
];
|
|
228
|
-
properties.forEach((property) => {
|
|
229
|
-
root2.style.removeProperty(property);
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
function getAarkModalTheme() {
|
|
233
|
-
const root2 = document.documentElement;
|
|
234
|
-
const computedStyle = getComputedStyle(root2);
|
|
235
|
-
return {
|
|
236
|
-
overlayBackground: computedStyle.getPropertyValue("--aark-modal-overlay-bg").trim(),
|
|
237
|
-
overlayBlur: computedStyle.getPropertyValue("--aark-modal-overlay-blur").trim(),
|
|
238
|
-
modalBackground: computedStyle.getPropertyValue("--aark-modal-bg").trim(),
|
|
239
|
-
modalBorderRadius: computedStyle.getPropertyValue("--aark-modal-border-radius").trim(),
|
|
240
|
-
modalShadow: computedStyle.getPropertyValue("--aark-modal-shadow").trim(),
|
|
241
|
-
modalPadding: computedStyle.getPropertyValue("--aark-modal-padding").trim(),
|
|
242
|
-
modalZIndex: parseInt(computedStyle.getPropertyValue("--aark-modal-z-index").trim()) || void 0,
|
|
243
|
-
modalContentZIndex: parseInt(
|
|
244
|
-
computedStyle.getPropertyValue("--aark-modal-content-z-index").trim()
|
|
245
|
-
) || void 0,
|
|
246
|
-
closeButtonColor: computedStyle.getPropertyValue("--aark-modal-close-color").trim(),
|
|
247
|
-
closeButtonHoverBackground: computedStyle.getPropertyValue("--aark-modal-close-hover-bg").trim(),
|
|
248
|
-
closeButtonHoverColor: computedStyle.getPropertyValue("--aark-modal-close-hover-color").trim(),
|
|
249
|
-
closeButtonFocusOutline: computedStyle.getPropertyValue("--aark-modal-close-focus-outline").trim(),
|
|
250
|
-
animationDuration: computedStyle.getPropertyValue("--aark-modal-animation-duration").trim(),
|
|
251
|
-
fadeDuration: computedStyle.getPropertyValue("--aark-modal-fade-duration").trim(),
|
|
252
|
-
customOverlayBackground: computedStyle.getPropertyValue("--aark-custom-overlay-bg").trim(),
|
|
253
|
-
customOverlayBlur: computedStyle.getPropertyValue("--aark-custom-overlay-blur").trim(),
|
|
254
|
-
customModalGradientStart: computedStyle.getPropertyValue("--aark-custom-modal-gradient-start").trim(),
|
|
255
|
-
customModalGradientEnd: computedStyle.getPropertyValue("--aark-custom-modal-gradient-end").trim(),
|
|
256
|
-
customModalTextColor: computedStyle.getPropertyValue("--aark-custom-modal-text-color").trim(),
|
|
257
|
-
customModalShadow: computedStyle.getPropertyValue("--aark-custom-modal-shadow").trim(),
|
|
258
|
-
customModalCloseColor: computedStyle.getPropertyValue("--aark-custom-modal-close-color").trim(),
|
|
259
|
-
customModalCloseHoverBackground: computedStyle.getPropertyValue("--aark-custom-modal-close-hover-bg").trim(),
|
|
260
|
-
customModalCloseHoverColor: computedStyle.getPropertyValue("--aark-custom-modal-close-hover-color").trim()
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
const aark = {
|
|
264
|
-
fire: (content, options) => modalManager.fire(content, options),
|
|
265
|
-
close: () => modalManager.close(),
|
|
266
|
-
isOpen: () => modalManager.isOpen(),
|
|
267
|
-
closeAll: () => modalManager.closeAll(),
|
|
268
|
-
setTheme: (theme) => setAarkModalTheme(theme),
|
|
269
|
-
resetTheme: () => resetAarkModalTheme(),
|
|
270
|
-
getTheme: () => getAarkModalTheme()
|
|
271
|
-
};
|
|
272
|
-
function useModal() {
|
|
273
|
-
const [isOpen2, setIsOpen] = useState(false);
|
|
274
|
-
const [config, setConfig] = useState(null);
|
|
275
|
-
const close2 = useCallback(() => {
|
|
276
|
-
modalManager.close();
|
|
277
|
-
}, []);
|
|
278
|
-
useEffect(() => {
|
|
279
|
-
const handleModalEvent = (event) => {
|
|
280
|
-
switch (event.type) {
|
|
281
|
-
case "open":
|
|
282
|
-
setIsOpen(true);
|
|
283
|
-
setConfig(event.config || null);
|
|
284
|
-
break;
|
|
285
|
-
case "close":
|
|
286
|
-
setIsOpen(false);
|
|
287
|
-
setConfig(null);
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
const unsubscribe = modalManager.subscribe(handleModalEvent);
|
|
292
|
-
setIsOpen(modalManager.isOpen());
|
|
293
|
-
setConfig(modalManager.getCurrentConfig());
|
|
294
|
-
return unsubscribe;
|
|
295
|
-
}, []);
|
|
296
|
-
return {
|
|
297
|
-
isOpen: isOpen2,
|
|
298
|
-
config,
|
|
299
|
-
close: close2
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
const injectStyles = (css, id) => {
|
|
303
|
-
if (typeof document === "undefined") return;
|
|
304
|
-
if (document.getElementById(id)) return;
|
|
305
|
-
const style = document.createElement("style");
|
|
306
|
-
style.id = id;
|
|
307
|
-
style.innerHTML = css;
|
|
308
|
-
document.head.appendChild(style);
|
|
309
|
-
};
|
|
310
|
-
const MODAL_CSS = `:root{--aark-modal-overlay-bg:rgba(0,0,0,.5);--aark-modal-bg:#fff;--aark-modal-radius:8px;--aark-modal-shadow:0 10px 25px rgba(0,0,0,.15);--aark-modal-pad:16px;--aark-modal-z:9999;--aark-close-color:#666;--aark-close-hover:#f5f5f5;--aark-anim:.2s}.aark-modal-container{position:fixed;inset:0;z-index:var(--aark-modal-z)}.aark-modal-container.notification{pointer-events:none}.aark-modal-overlay{position:absolute;inset:0;background:var(--aark-modal-overlay-bg);backdrop-filter:blur(2px)}.aark-modal-content{position:fixed;background:var(--aark-modal-bg);border-radius:var(--aark-modal-radius);box-shadow:var(--aark-modal-shadow);padding:var(--aark-modal-pad);z-index:calc(var(--aark-modal-z) + 1);max-width:90vw;max-height:90vh;overflow:auto}.aark-modal-content.notification{pointer-events:auto}.aark-modal-content.center{top:50%;left:50%;transform:translate(-50%,-50%)}.aark-modal-content.top-center{top:20px;left:50%;transform:translateX(-50%)}.aark-modal-content.top-right{top:20px;right:20px}.aark-modal-content.bottom-right{bottom:20px;right:20px}.aark-modal-content.bottom-center{bottom:20px;left:50%;transform:translateX(-50%)}.aark-modal-close{position:absolute;top:8px;right:8px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;background:0;border:0;color:var(--aark-close-color);cursor:pointer;border-radius:50%;font-size:14px;line-height:1;transition:all var(--aark-anim)}.aark-modal-close:hover{background:var(--aark-close-hover);color:#333}.aark-modal-close:focus{outline:2px solid #007bff;outline-offset:2px}.aark-modal-body{padding-top:8px}.aark-modal-container{animation:f var(--aark-anim)}.aark-modal-content{animation:s var(--aark-anim)}@keyframes f{0%{opacity:0}to{opacity:1}}@keyframes s{0%{opacity:0;transform:translate(-50%,-50%) scale(.95)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}.aark-modal-content.top-center{animation:d var(--aark-anim)}.aark-modal-content.top-right,.aark-modal-content.bottom-right{animation:l var(--aark-anim)}.aark-modal-content.bottom-center{animation:u var(--aark-anim)}@keyframes d{0%{opacity:0;transform:translateX(-50%) translateY(-10px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}@keyframes l{0%{opacity:0;transform:translateX(10px)}to{opacity:1;transform:translateX(0)}}@keyframes u{0%{opacity:0;transform:translateX(-50%) translateY(10px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}@media (max-width:768px){.aark-modal-content{margin:10px;max-width:calc(100vw - 20px)}.aark-modal-content.center{top:50%;left:50%;transform:translate(-50%,-50%)}.aark-modal-content.top-center,.aark-modal-content.bottom-center{left:50%;transform:translateX(-50%)}.aark-modal-content.top-right{right:10px;left:auto;transform:none}.aark-modal-content.bottom-right{right:10px;bottom:10px;left:auto;transform:none}}`;
|
|
311
|
-
const ModalRenderer = ({ config, onClose }) => {
|
|
312
|
-
const { content, options = {} } = config;
|
|
313
|
-
const {
|
|
314
|
-
position = "center",
|
|
315
|
-
mode = "modal",
|
|
316
|
-
showCloseIcon = true,
|
|
317
|
-
autoCloseTime,
|
|
318
|
-
className = "",
|
|
319
|
-
overlayClassName = "",
|
|
320
|
-
preventEscClose = false,
|
|
321
|
-
preventOverlayClose = false
|
|
322
|
-
} = options;
|
|
323
|
-
useEffect(() => {
|
|
324
|
-
injectStyles(MODAL_CSS, "aark-modal-styles");
|
|
325
|
-
}, []);
|
|
326
|
-
useEffect(() => {
|
|
327
|
-
if (autoCloseTime && mode === "notification") {
|
|
328
|
-
const timer = setTimeout(onClose, autoCloseTime);
|
|
329
|
-
return () => clearTimeout(timer);
|
|
330
|
-
}
|
|
331
|
-
}, [autoCloseTime, mode, onClose]);
|
|
332
|
-
useEffect(() => {
|
|
333
|
-
const handleKeyDown = (event) => {
|
|
334
|
-
if (event.key === "Escape" && !preventEscClose) {
|
|
335
|
-
onClose();
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
if (!preventEscClose) {
|
|
339
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
340
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
341
|
-
}
|
|
342
|
-
}, [onClose, preventEscClose]);
|
|
343
|
-
const handleOverlayClick = useCallback(
|
|
344
|
-
(event) => {
|
|
345
|
-
if (event.target === event.currentTarget && !preventOverlayClose) {
|
|
346
|
-
onClose();
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
[onClose, preventOverlayClose]
|
|
350
|
-
);
|
|
351
|
-
const handleCloseClick = useCallback(
|
|
352
|
-
(event) => {
|
|
353
|
-
event.stopPropagation();
|
|
354
|
-
onClose();
|
|
355
|
-
},
|
|
356
|
-
[onClose]
|
|
357
|
-
);
|
|
358
|
-
const containerClasses = `aark-modal-container ${mode === "notification" ? "notification" : ""}`;
|
|
359
|
-
const contentClasses = `aark-modal-content ${position} ${mode === "notification" ? "notification" : ""} ${className}`.trim();
|
|
360
|
-
const overlayClasses = `aark-modal-overlay ${overlayClassName}`.trim();
|
|
361
|
-
const modalContainer = document.getElementById("aark-react-modalify-root") || document.body;
|
|
362
|
-
return createPortal(
|
|
363
|
-
/* @__PURE__ */ jsxs("div", { className: containerClasses, children: [
|
|
364
|
-
mode === "modal" && /* @__PURE__ */ jsx(
|
|
365
|
-
"div",
|
|
366
|
-
{
|
|
367
|
-
className: overlayClasses,
|
|
368
|
-
onClick: handleOverlayClick,
|
|
369
|
-
"aria-hidden": "true"
|
|
370
|
-
}
|
|
371
|
-
),
|
|
372
|
-
/* @__PURE__ */ jsxs(
|
|
373
|
-
"div",
|
|
374
|
-
{
|
|
375
|
-
className: contentClasses,
|
|
376
|
-
role: "dialog",
|
|
377
|
-
"aria-modal": "true",
|
|
378
|
-
"aria-labelledby": "aark-modal-content",
|
|
379
|
-
children: [
|
|
380
|
-
showCloseIcon && /* @__PURE__ */ jsx(
|
|
381
|
-
"button",
|
|
382
|
-
{
|
|
383
|
-
onClick: handleCloseClick,
|
|
384
|
-
className: "aark-modal-close",
|
|
385
|
-
"aria-label": "Close modal",
|
|
386
|
-
type: "button",
|
|
387
|
-
children: "×"
|
|
388
|
-
}
|
|
389
|
-
),
|
|
390
|
-
/* @__PURE__ */ jsx("div", { id: "aark-modal-content", className: "aark-modal-body", children: content })
|
|
391
|
-
]
|
|
392
|
-
}
|
|
393
|
-
)
|
|
394
|
-
] }),
|
|
395
|
-
modalContainer
|
|
396
|
-
);
|
|
397
|
-
};
|
|
398
|
-
export {
|
|
399
|
-
ModalRenderer,
|
|
400
|
-
aark,
|
|
401
|
-
getAarkModalTheme,
|
|
402
|
-
resetAarkModalTheme,
|
|
403
|
-
setAarkModalTheme,
|
|
404
|
-
useModal
|
|
405
|
-
};
|