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/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
+ import "./assets/styles/aark-modal.css";
1
2
  export { default as aark } from "./logic/aark";
2
- export type { ModalOptions, ModalPosition, ModalMode, ModalConfig, ModalState, ModalEvent, ModalEventType, } from "./types";
3
+ export type { ModalOptions, NotificationOptions, ModalPosition, NotificationPosition, ModalMode, ModalType, ModalProps, NotificationProps, ModalConfig, NotificationConfig, ComponentConfig, ModalState, ModalEvent, ModalEventType, } from "./types";
3
4
  export type { AarkModalTheme } from "./utils/theme";
4
5
  export { setAarkModalTheme, resetAarkModalTheme, getAarkModalTheme, } from "./utils/theme";
5
6
  export { useModal } from "./hooks/useModal";
6
- export { default as ModalRenderer } from "./components/ModalRenderer";
7
+ export { default as Modal } from "./components/Modal";
8
+ export { default as Notification } from "./components/Notification";
9
+ export { default as ModalProvider } from "./components/ModalProvider";
@@ -1,16 +1,20 @@
1
1
  import type { ReactNode } from "react";
2
- import type { ModalConfig, ModalOptions, ModalEvent } from "../types";
2
+ import type { ComponentConfig, ModalOptions, NotificationOptions, ModalEvent, ModalProps, NotificationProps } from "../types";
3
3
  type ModalListener = (event: ModalEvent) => void;
4
4
  declare function subscribe(listener: ModalListener): () => void;
5
- declare function fire(content: ReactNode, options?: ModalOptions): void;
5
+ declare function fireModal(contentOrProps: ReactNode | ModalProps, options?: ModalOptions): void;
6
+ declare function fireNotification(contentOrProps: ReactNode | NotificationProps, options?: NotificationOptions): void;
7
+ declare function fire(contentOrProps: ReactNode | ModalProps, options?: ModalOptions): void;
6
8
  declare function close(): void;
7
9
  declare function isOpen(): boolean;
8
- declare function getCurrentConfig(): ModalConfig | null;
10
+ declare function getCurrentConfig(): ComponentConfig | null;
9
11
  declare function closeAll(): void;
10
12
  declare function cleanup(): void;
11
13
  export declare const modalManager: {
12
14
  subscribe: typeof subscribe;
13
15
  fire: typeof fire;
16
+ fireModal: typeof fireModal;
17
+ fireNotification: typeof fireNotification;
14
18
  close: typeof close;
15
19
  isOpen: typeof isOpen;
16
20
  getCurrentConfig: typeof getCurrentConfig;
File without changes
@@ -1,8 +1,10 @@
1
1
  import type { ReactNode } from "react";
2
- import type { ModalOptions } from "../types";
2
+ import type { ModalOptions, NotificationOptions, ModalProps, NotificationProps } from "../types";
3
3
  import type { AarkModalTheme } from "../utils/theme";
4
4
  declare const aark: {
5
- fire: (content: ReactNode, options?: ModalOptions) => void;
5
+ fire: (contentOrProps: ReactNode | ModalProps, options?: ModalOptions) => void;
6
+ modal: (contentOrProps: ReactNode | ModalProps, options?: ModalOptions) => void;
7
+ notification: (contentOrProps: ReactNode | NotificationProps, options?: NotificationOptions) => void;
6
8
  close: () => void;
7
9
  isOpen: () => boolean;
8
10
  closeAll: () => void;
@@ -1,26 +1,102 @@
1
1
  import type { ReactNode } from "react";
2
2
  export type ModalPosition = "center" | "top-center" | "top-right" | "bottom-right" | "bottom-center";
3
+ export type NotificationPosition = "top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left";
3
4
  export type ModalMode = "modal" | "notification";
4
- export interface ModalOptions {
5
- position?: ModalPosition;
6
- mode?: ModalMode;
5
+ export type ModalType = "success" | "error" | "warning" | "info" | "question";
6
+ export interface ModalProps {
7
+ title?: string;
8
+ text?: string;
9
+ type?: ModalType;
10
+ cancelText?: string;
11
+ confirmText?: string;
12
+ onCancel?: () => void;
13
+ onConfirm?: () => void;
14
+ icon?: string | ReactNode;
15
+ html?: string | ReactNode;
16
+ showCancelButton?: boolean;
17
+ showConfirmButton?: boolean;
18
+ allowOutsideClick?: boolean;
19
+ allowEscapeKey?: boolean;
20
+ reverseButtons?: boolean;
21
+ focusConfirm?: boolean;
22
+ focusCancel?: boolean;
23
+ width?: string | number;
24
+ fullWidth?: boolean;
25
+ padding?: string | number;
26
+ background?: string;
27
+ customClass?: {
28
+ container?: string;
29
+ popup?: string;
30
+ header?: string;
31
+ title?: string;
32
+ closeButton?: string;
33
+ icon?: string;
34
+ image?: string;
35
+ content?: string;
36
+ input?: string;
37
+ actions?: string;
38
+ confirmButton?: string;
39
+ cancelButton?: string;
40
+ footer?: string;
41
+ };
42
+ }
43
+ export interface NotificationProps {
44
+ title?: string;
45
+ text?: string;
46
+ type?: ModalType;
47
+ icon?: string | ReactNode;
48
+ html?: string | ReactNode;
49
+ timer?: number;
50
+ showCloseButton?: boolean;
51
+ clickToClose?: boolean;
52
+ width?: string | number;
53
+ fullWidth?: boolean;
54
+ padding?: string | number;
55
+ background?: string;
56
+ customClass?: {
57
+ container?: string;
58
+ popup?: string;
59
+ header?: string;
60
+ title?: string;
61
+ closeButton?: string;
62
+ icon?: string;
63
+ content?: string;
64
+ footer?: string;
65
+ };
66
+ }
67
+ export interface BaseOptions {
7
68
  showCloseIcon?: boolean;
8
- autoCloseTime?: number;
9
69
  className?: string;
10
- overlayClassName?: string;
11
70
  preventEscClose?: boolean;
71
+ }
72
+ export interface ModalOptions extends BaseOptions {
73
+ position?: ModalPosition;
74
+ overlayClassName?: string;
12
75
  preventOverlayClose?: boolean;
13
76
  }
77
+ export interface NotificationOptions extends BaseOptions {
78
+ position?: NotificationPosition;
79
+ autoCloseTime?: number;
80
+ }
14
81
  export interface ModalConfig {
15
- content: ReactNode;
82
+ content?: ReactNode;
83
+ props?: ModalProps;
16
84
  options?: ModalOptions;
85
+ mode: "modal";
86
+ }
87
+ export interface NotificationConfig {
88
+ content?: ReactNode;
89
+ props?: NotificationProps;
90
+ options?: NotificationOptions;
91
+ mode: "notification";
17
92
  }
93
+ export type ComponentConfig = ModalConfig | NotificationConfig;
18
94
  export interface ModalState {
19
95
  isOpen: boolean;
20
- config: ModalConfig | null;
96
+ config: ComponentConfig | null;
21
97
  }
22
98
  export type ModalEventType = "open" | "close" | "beforeClose";
23
99
  export interface ModalEvent {
24
100
  type: ModalEventType;
25
- config?: ModalConfig;
101
+ config?: ComponentConfig;
26
102
  }
@@ -1 +1,4 @@
1
1
  export declare const injectStyles: (css: string, id: string) => void;
2
+ export declare const injectModalStyles: () => void;
3
+ export declare const injectNotificationStyles: () => void;
4
+ export declare const removeStyles: (id: string) => void;
@@ -1 +1 @@
1
- export declare 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}}";
1
+ export declare 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-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;min-width:280px;max-height:90vh;overflow:auto}.aark-modal-content.notification{pointer-events:auto;background:var(--aark-modal-bg);box-shadow:var(--aark-modal-shadow);padding:var(--aark-modal-pad);width:auto;max-width:400px;min-width:280px;border-radius:var(--aark-modal-radius)}.aark-modal-content.center{top:50%;left:50%;transform:translate(-50%,-50%);animation:scale-in var(--aark-anim)}.aark-modal-content.top-center{top:20px;left:50%;transform:translateX(-50%);animation:slide-down var(--aark-anim)}.aark-modal-content.top-right{top:20px;right:20px;animation:slide-left var(--aark-anim)}.aark-modal-content.top-left{top:20px;left:20px;animation:slide-right var(--aark-anim)}.aark-modal-content.bottom-right{bottom:20px;right:20px;animation:slide-left var(--aark-anim)}.aark-modal-content.bottom-left{bottom:20px;left:20px;animation:slide-right var(--aark-anim)}.aark-modal-content.bottom-center{bottom:20px;left:50%;transform:translateX(-50%);animation:slide-up var(--aark-anim)}.aark-modal-close{position:absolute;top:8px;right:8px;width:30px;height:30px;padding:.5rem;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}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes scale-in{0%{opacity:0;transform:translate(-50%,-50%) scale(.9)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes slide-down{0%{opacity:0;transform:translateX(-50%) translateY(-20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}@keyframes slide-up{0%{opacity:0;transform:translateX(-50%) translateY(20px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}@keyframes slide-left{0%{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}@keyframes slide-right{0%{opacity:0;transform:translateX(-20px)}to{opacity:1;transform:translateX(0)}}@media (max-width:768px){.aark-modal-content{margin:10px;max-width:calc(100vw - 20px);min-width:auto}.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.top-left{left:10px;right:auto;transform:none}.aark-modal-content.bottom-right{right:10px;bottom:10px;left:auto;transform:none}.aark-modal-content.bottom-left{left:10px;bottom:10px;right:auto;transform:none}.aark-modal-content.notification{width:auto;max-width:calc(100vw - 20px);min-width:auto}}@media (max-width:480px){.aark-modal-content{max-width:calc(100vw - 10px);margin:5px}.aark-modal-content.center{top:10px;left:50%;transform:translateX(-50%);max-height:calc(100vh - 20px)}}";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Utility to manage the single modal root container
3
+ * Ensures only one instance of aark-react-modalify-root exists
4
+ */
5
+ /**
6
+ * Gets or creates the modal root container
7
+ * Returns the same instance for both modals and notifications
8
+ */
9
+ export declare const getModalRoot: () => HTMLElement;
10
+ /**
11
+ * Cleanup function to remove the modal root when no longer needed
12
+ * Should be called when the last modal/notification is closed
13
+ */
14
+ export declare const cleanupModalRoot: () => void;
15
+ /**
16
+ * Check if modal root exists and has content
17
+ */
18
+ export declare const hasActiveModals: () => boolean;
package/package.json CHANGED
@@ -1,18 +1,24 @@
1
1
  {
2
2
  "name": "aark-react-modalify",
3
- "version": "1.0.5",
3
+ "version": "1.2.0",
4
4
  "description": "A lightweight, flexible React modal and notification library with TypeScript support. Features automatic DOM mounting, customizable styling, and a simple imperative API for displaying modals, alerts, confirmations, and toast notifications.",
5
5
  "private": false,
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.esm.js",
8
8
  "types": "dist/index.d.ts",
9
- "type": "module",
10
9
  "exports": {
11
10
  ".": {
12
11
  "types": "./dist/index.d.ts",
13
12
  "import": "./dist/index.esm.js",
14
13
  "require": "./dist/index.cjs.js"
15
- }
14
+ },
15
+ "./no-styles": {
16
+ "types": "./dist/index-no-styles.d.ts",
17
+ "import": "./dist/index-no-styles.esm.js",
18
+ "require": "./dist/index-no-styles.cjs.js"
19
+ },
20
+ "./dist/aark-react-modalify.css": "./dist/aark-react-modalify.css",
21
+ "./css": "./dist/aark-react-modalify.css"
16
22
  },
17
23
  "files": [
18
24
  "dist",
@@ -20,8 +26,9 @@
20
26
  "LICENSE"
21
27
  ],
22
28
  "scripts": {
23
- "build": "npm run clean && npm run build:lib && npm run build:types",
29
+ "build": "npm run clean && npm run build:lib && npm run build:no-styles && npm run build:types",
24
30
  "build:lib": "vite build --config vite.lib.config.ts",
31
+ "build:no-styles": "vite build --config vite.lib-no-styles.config.ts",
25
32
  "build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly",
26
33
  "clean": "rimraf dist",
27
34
  "dev": "vite",
@@ -1,12 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useModal, ModalRenderer } from "./index.esm.js";
3
- const ModalProvider = () => {
4
- const { isOpen, config, close } = useModal();
5
- if (!isOpen || !config) {
6
- return null;
7
- }
8
- return /* @__PURE__ */ jsx(ModalRenderer, { config, onClose: close });
9
- };
10
- export {
11
- ModalProvider as default
12
- };
@@ -1,5 +0,0 @@
1
- "use strict"
2
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
3
- const e=require("react/jsx-runtime"),s=require("./index.cjs.js")
4
- exports.default=()=>{const{isOpen:o,config:r,close:n}=s.useModal()
5
- return o&&r?e.jsx(s.ModalRenderer,{config:r,onClose:n}):null}
package/dist/index.cjs.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict"
2
- function a(a,o){const r={type:a,config:o}
3
- m.forEach(a=>a(r))}function o(){s&&(a("beforeClose",s),s=null,a("close"))}function r(a){const o=document.documentElement
4
- a.overlayBackground&&o.style.setProperty("--aark-modal-overlay-bg",a.overlayBackground),a.overlayBlur&&o.style.setProperty("--aark-modal-overlay-blur",a.overlayBlur),a.modalBackground&&o.style.setProperty("--aark-modal-bg",a.modalBackground),a.modalBorderRadius&&o.style.setProperty("--aark-modal-border-radius",a.modalBorderRadius),a.modalShadow&&o.style.setProperty("--aark-modal-shadow",a.modalShadow),a.modalPadding&&o.style.setProperty("--aark-modal-padding",a.modalPadding),a.modalZIndex&&o.style.setProperty("--aark-modal-z-index",a.modalZIndex.toString()),a.modalContentZIndex&&o.style.setProperty("--aark-modal-content-z-index",a.modalContentZIndex.toString()),a.closeButtonColor&&o.style.setProperty("--aark-modal-close-color",a.closeButtonColor),a.closeButtonHoverBackground&&o.style.setProperty("--aark-modal-close-hover-bg",a.closeButtonHoverBackground),a.closeButtonHoverColor&&o.style.setProperty("--aark-modal-close-hover-color",a.closeButtonHoverColor),a.closeButtonFocusOutline&&o.style.setProperty("--aark-modal-close-focus-outline",a.closeButtonFocusOutline),a.animationDuration&&o.style.setProperty("--aark-modal-animation-duration",a.animationDuration),a.fadeDuration&&o.style.setProperty("--aark-modal-fade-duration",a.fadeDuration),a.customOverlayBackground&&o.style.setProperty("--aark-custom-overlay-bg",a.customOverlayBackground),a.customOverlayBlur&&o.style.setProperty("--aark-custom-overlay-blur",a.customOverlayBlur),a.customModalGradientStart&&o.style.setProperty("--aark-custom-modal-gradient-start",a.customModalGradientStart),a.customModalGradientEnd&&o.style.setProperty("--aark-custom-modal-gradient-end",a.customModalGradientEnd),a.customModalTextColor&&o.style.setProperty("--aark-custom-modal-text-color",a.customModalTextColor),a.customModalShadow&&o.style.setProperty("--aark-custom-modal-shadow",a.customModalShadow),a.customModalCloseColor&&o.style.setProperty("--aark-custom-modal-close-color",a.customModalCloseColor),a.customModalCloseHoverBackground&&o.style.setProperty("--aark-custom-modal-close-hover-bg",a.customModalCloseHoverBackground),a.customModalCloseHoverColor&&o.style.setProperty("--aark-custom-modal-close-hover-color",a.customModalCloseHoverColor)}function t(){const a=document.documentElement;["--aark-modal-overlay-bg","--aark-modal-overlay-blur","--aark-modal-bg","--aark-modal-border-radius","--aark-modal-shadow","--aark-modal-padding","--aark-modal-z-index","--aark-modal-content-z-index","--aark-modal-close-color","--aark-modal-close-hover-bg","--aark-modal-close-hover-color","--aark-modal-close-focus-outline","--aark-modal-animation-duration","--aark-modal-fade-duration","--aark-custom-overlay-bg","--aark-custom-overlay-blur","--aark-custom-modal-gradient-start","--aark-custom-modal-gradient-end","--aark-custom-modal-text-color","--aark-custom-modal-shadow","--aark-custom-modal-close-color","--aark-custom-modal-close-hover-bg","--aark-custom-modal-close-hover-color"].forEach(o=>{a.style.removeProperty(o)})}function e(){const a=document.documentElement,o=getComputedStyle(a)
5
- return{overlayBackground:o.getPropertyValue("--aark-modal-overlay-bg").trim(),overlayBlur:o.getPropertyValue("--aark-modal-overlay-blur").trim(),modalBackground:o.getPropertyValue("--aark-modal-bg").trim(),modalBorderRadius:o.getPropertyValue("--aark-modal-border-radius").trim(),modalShadow:o.getPropertyValue("--aark-modal-shadow").trim(),modalPadding:o.getPropertyValue("--aark-modal-padding").trim(),modalZIndex:parseInt(o.getPropertyValue("--aark-modal-z-index").trim())||void 0,modalContentZIndex:parseInt(o.getPropertyValue("--aark-modal-content-z-index").trim())||void 0,closeButtonColor:o.getPropertyValue("--aark-modal-close-color").trim(),closeButtonHoverBackground:o.getPropertyValue("--aark-modal-close-hover-bg").trim(),closeButtonHoverColor:o.getPropertyValue("--aark-modal-close-hover-color").trim(),closeButtonFocusOutline:o.getPropertyValue("--aark-modal-close-focus-outline").trim(),animationDuration:o.getPropertyValue("--aark-modal-animation-duration").trim(),fadeDuration:o.getPropertyValue("--aark-modal-fade-duration").trim(),customOverlayBackground:o.getPropertyValue("--aark-custom-overlay-bg").trim(),customOverlayBlur:o.getPropertyValue("--aark-custom-overlay-blur").trim(),customModalGradientStart:o.getPropertyValue("--aark-custom-modal-gradient-start").trim(),customModalGradientEnd:o.getPropertyValue("--aark-custom-modal-gradient-end").trim(),customModalTextColor:o.getPropertyValue("--aark-custom-modal-text-color").trim(),customModalShadow:o.getPropertyValue("--aark-custom-modal-shadow").trim(),customModalCloseColor:o.getPropertyValue("--aark-custom-modal-close-color").trim(),customModalCloseHoverBackground:o.getPropertyValue("--aark-custom-modal-close-hover-bg").trim(),customModalCloseHoverColor:o.getPropertyValue("--aark-custom-modal-close-hover-color").trim()}}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
6
- const l=require("react"),n=require("react-dom/client"),d=require("react/jsx-runtime"),c=require("react-dom"),m=new Set
7
- let s=null,i=null,u=null
8
- const k={subscribe:function(a){return m.add(a),()=>m.delete(a)},fire:function(o,r){i||(i=document.createElement("div"),i.id="aark-react-modalify-root",i.style.position="relative",i.style.zIndex="9999",document.body.appendChild(i),Promise.resolve().then(()=>require("./ModalProvider-DA6KcJdZ.cjs")).then(({default:a})=>{i&&(u=n.createRoot(i),u.render(l.createElement(a)))}))
9
- const t={content:o,options:Object.assign({position:"center",mode:"modal",showCloseIcon:!0,preventEscClose:!1,preventOverlayClose:!1},r)}
10
- s=t,a("open",t)},close:o,isOpen:function(){return null!==s},getCurrentConfig:function(){return s},closeAll:function(){o()},cleanup:function(){i&&i.parentNode&&(i.parentNode.removeChild(i),i=null,u=null)}},p={fire:(a,o)=>k.fire(a,o),close:()=>k.close(),isOpen:()=>k.isOpen(),closeAll:()=>k.closeAll(),setTheme:a=>r(a),resetTheme:()=>t(),getTheme:()=>e()}
11
- exports.ModalRenderer=({config:a,onClose:o})=>{const{content:r,options:t={}}=a,{position:e="center",mode:n="modal",showCloseIcon:m=!0,autoCloseTime:s,className:i="",overlayClassName:u="",preventEscClose:k=!1,preventOverlayClose:p=!1}=t
12
- l.useEffect(()=>{((a,o)=>{if("undefined"==typeof document)return
13
- if(document.getElementById(o))return
14
- const r=document.createElement("style")
15
- r.id=o,r.innerHTML=":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}}",document.head.appendChild(r)})(0,"aark-modal-styles")},[]),l.useEffect(()=>{if(s&&"notification"===n){const a=setTimeout(o,s)
16
- return()=>clearTimeout(a)}},[s,n,o]),l.useEffect(()=>{const a=a=>{"Escape"!==a.key||k||o()}
17
- if(!k)return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[o,k])
18
- const f=l.useCallback(a=>{a.target!==a.currentTarget||p||o()},[o,p]),v=l.useCallback(a=>{a.stopPropagation(),o()},[o]),b="aark-modal-container "+("notification"===n?"notification":""),g=`aark-modal-content ${e} ${"notification"===n?"notification":""} ${i}`.trim(),h=("aark-modal-overlay "+u).trim(),x=document.getElementById("aark-react-modalify-root")||document.body
19
- return c.createPortal(d.jsxs("div",{className:b,children:["modal"===n&&d.jsx("div",{className:h,onClick:f,"aria-hidden":"true"}),d.jsxs("div",{className:g,role:"dialog","aria-modal":"true","aria-labelledby":"aark-modal-content",children:[m&&d.jsx("button",{onClick:v,className:"aark-modal-close","aria-label":"Close modal",type:"button",children:"×"}),d.jsx("div",{id:"aark-modal-content",className:"aark-modal-body",children:r})]})]}),x)},exports.aark=p,exports.getAarkModalTheme=e,exports.resetAarkModalTheme=t,exports.setAarkModalTheme=r,exports.useModal=function(){const[a,o]=l.useState(!1),[r,t]=l.useState(null),e=l.useCallback(()=>{k.close()},[])
20
- return l.useEffect(()=>{const a=k.subscribe(a=>{switch(a.type){case"open":o(!0),t(a.config||null)
21
- break
22
- case"close":o(!1),t(null)}})
23
- return o(k.isOpen()),t(k.getCurrentConfig()),a},[]),{isOpen:a,config:r,close:e}}