aark-react-modalify 1.2.2 → 1.3.1

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.cjs.js CHANGED
@@ -1,51 +1,13 @@
1
- "use strict"
2
- function o(){const[o,a]=c.useState(!1),[e,n]=c.useState(null),t=c.useCallback(()=>{I.close()},[])
3
- return c.useEffect(()=>{const o=I.subscribe(o=>{switch(o.type){case"open":a(!0),n(o.config||null)
4
- break
5
- case"close":a(!1),n(null)}})
6
- return a(I.isOpen()),n(I.getCurrentConfig()),o},[]),{isOpen:o,config:e,close:t}}function a(){if(z)return
7
- const o=b()
8
- z=s.createRoot(o),z.render(c.createElement(N))}function e(o,a){const e={type:o,config:a}
9
- B.forEach(o=>o(e))}function n(o,n){let t,r
10
- a(),!o||"object"!=typeof o||"$$typeof"in o||Array.isArray(o)?(t=o,r=void 0):(r=o,t=void 0)
11
- const l={content:t,props:r,mode:"modal",options:Object.assign({position:"center",showCloseIcon:!0,preventEscClose:!1,preventOverlayClose:!1},n)}
12
- T=l,e("open",l)}function t(){T&&(e("beforeClose",T),T=null,e("close"))}function r(o){const a=document.documentElement
13
- o.overlayBackground&&a.style.setProperty("--aark-modal-overlay-bg",o.overlayBackground),o.overlayBlur&&a.style.setProperty("--aark-modal-overlay-blur",o.overlayBlur),o.modalBackground&&a.style.setProperty("--aark-modal-bg",o.modalBackground),o.modalBorderRadius&&a.style.setProperty("--aark-modal-border-radius",o.modalBorderRadius),o.modalShadow&&a.style.setProperty("--aark-modal-shadow",o.modalShadow),o.modalPadding&&a.style.setProperty("--aark-modal-padding",o.modalPadding),o.modalZIndex&&a.style.setProperty("--aark-modal-z-index",o.modalZIndex.toString()),o.modalContentZIndex&&a.style.setProperty("--aark-modal-content-z-index",o.modalContentZIndex.toString()),o.closeButtonColor&&a.style.setProperty("--aark-modal-close-color",o.closeButtonColor),o.closeButtonHoverBackground&&a.style.setProperty("--aark-modal-close-hover-bg",o.closeButtonHoverBackground),o.closeButtonHoverColor&&a.style.setProperty("--aark-modal-close-hover-color",o.closeButtonHoverColor),o.closeButtonFocusOutline&&a.style.setProperty("--aark-modal-close-focus-outline",o.closeButtonFocusOutline),o.animationDuration&&a.style.setProperty("--aark-modal-animation-duration",o.animationDuration),o.fadeDuration&&a.style.setProperty("--aark-modal-fade-duration",o.fadeDuration),o.customOverlayBackground&&a.style.setProperty("--aark-custom-overlay-bg",o.customOverlayBackground),o.customOverlayBlur&&a.style.setProperty("--aark-custom-overlay-blur",o.customOverlayBlur),o.customModalGradientStart&&a.style.setProperty("--aark-custom-modal-gradient-start",o.customModalGradientStart),o.customModalGradientEnd&&a.style.setProperty("--aark-custom-modal-gradient-end",o.customModalGradientEnd),o.customModalTextColor&&a.style.setProperty("--aark-custom-modal-text-color",o.customModalTextColor),o.customModalShadow&&a.style.setProperty("--aark-custom-modal-shadow",o.customModalShadow),o.customModalCloseColor&&a.style.setProperty("--aark-custom-modal-close-color",o.customModalCloseColor),o.customModalCloseHoverBackground&&a.style.setProperty("--aark-custom-modal-close-hover-bg",o.customModalCloseHoverBackground),o.customModalCloseHoverColor&&a.style.setProperty("--aark-custom-modal-close-hover-color",o.customModalCloseHoverColor)}function l(){const o=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(a=>{o.style.removeProperty(a)})}function i(){const o=document.documentElement,a=getComputedStyle(o)
14
- return{overlayBackground:a.getPropertyValue("--aark-modal-overlay-bg").trim(),overlayBlur:a.getPropertyValue("--aark-modal-overlay-blur").trim(),modalBackground:a.getPropertyValue("--aark-modal-bg").trim(),modalBorderRadius:a.getPropertyValue("--aark-modal-border-radius").trim(),modalShadow:a.getPropertyValue("--aark-modal-shadow").trim(),modalPadding:a.getPropertyValue("--aark-modal-padding").trim(),modalZIndex:parseInt(a.getPropertyValue("--aark-modal-z-index").trim())||void 0,modalContentZIndex:parseInt(a.getPropertyValue("--aark-modal-content-z-index").trim())||void 0,closeButtonColor:a.getPropertyValue("--aark-modal-close-color").trim(),closeButtonHoverBackground:a.getPropertyValue("--aark-modal-close-hover-bg").trim(),closeButtonHoverColor:a.getPropertyValue("--aark-modal-close-hover-color").trim(),closeButtonFocusOutline:a.getPropertyValue("--aark-modal-close-focus-outline").trim(),animationDuration:a.getPropertyValue("--aark-modal-animation-duration").trim(),fadeDuration:a.getPropertyValue("--aark-modal-fade-duration").trim(),customOverlayBackground:a.getPropertyValue("--aark-custom-overlay-bg").trim(),customOverlayBlur:a.getPropertyValue("--aark-custom-overlay-blur").trim(),customModalGradientStart:a.getPropertyValue("--aark-custom-modal-gradient-start").trim(),customModalGradientEnd:a.getPropertyValue("--aark-custom-modal-gradient-end").trim(),customModalTextColor:a.getPropertyValue("--aark-custom-modal-text-color").trim(),customModalShadow:a.getPropertyValue("--aark-custom-modal-shadow").trim(),customModalCloseColor:a.getPropertyValue("--aark-custom-modal-close-color").trim(),customModalCloseHoverBackground:a.getPropertyValue("--aark-custom-modal-close-hover-bg").trim(),customModalCloseHoverColor:a.getPropertyValue("--aark-custom-modal-close-hover-color").trim()}}Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})
15
- const c=require("react"),s=require("react-dom/client"),d=require("react/jsx-runtime"),m=require("react-dom"),u={white:"#FFFFFF",black:"#0B071A"},f=c.memo(({name:o,color:a="black",style:e,className:n="",noHoverEffect:t=!1,onClick:r,size:l=24,"aria-label":i,title:s})=>{const m=c.useMemo(()=>l+"",[l]),f=c.useMemo(()=>u[a]?u[a]:(a.startsWith("#"),a),[a]),k=c.useMemo(()=>{const a=f
16
- return"close"===o?d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:m,height:m,viewBox:"0 0 16 16",fill:"none",children:d.jsx("path",{d:"M15.281 14.2198C15.3507 14.2895 15.406 14.3722 15.4437 14.4632C15.4814 14.5543 15.5008 14.6519 15.5008 14.7504C15.5008 14.849 15.4814 14.9465 15.4437 15.0376C15.406 15.1286 15.3507 15.2114 15.281 15.281C15.2114 15.3507 15.1286 15.406 15.0376 15.4437C14.9465 15.4814 14.849 15.5008 14.7504 15.5008C14.6519 15.5008 14.5543 15.4814 14.4632 15.4437C14.3722 15.406 14.2895 15.3507 14.2198 15.281L8.00042 9.06073L1.78104 15.281C1.64031 15.4218 1.44944 15.5008 1.25042 15.5008C1.05139 15.5008 0.860523 15.4218 0.719792 15.281C0.579062 15.1403 0.5 14.9494 0.5 14.7504C0.5 14.5514 0.579062 14.3605 0.719792 14.2198L6.9401 8.00042L0.719792 1.78104C0.579062 1.64031 0.5 1.44944 0.5 1.25042C0.5 1.05139 0.579062 0.860523 0.719792 0.719792C0.860523 0.579062 1.05139 0.5 1.25042 0.5C1.44944 0.5 1.64031 0.579062 1.78104 0.719792L8.00042 6.9401L14.2198 0.719792C14.3605 0.579062 14.5514 0.5 14.7504 0.5C14.9494 0.5 15.1403 0.579062 15.281 0.719792C15.4218 0.860523 15.5008 1.05139 15.5008 1.25042C15.5008 1.44944 15.4218 1.64031 15.281 1.78104L9.06073 8.00042L15.281 14.2198Z",fill:a})}):null},[o,f,m]),p=c.useMemo(()=>{const a={}
17
- return a["aria-label"]=i||o+" icon",s&&(a.title=s),a.role=r?"button":"img",a},[i,s,o,r]),h=c.useMemo(()=>{if(r)return o=>{"Enter"!==o.key&&" "!==o.key||(o.preventDefault(),r())}},[r])
18
- return d.jsx("i",{className:`\n inline-flex items-center justify-center bg-transparent outline-none border-none\n ${!t&&r&&"hover:opacity-80 cursor-pointer transition-opacity duration-200"}\n ${r&&"focus:outline-2 focus:outline-blue-500 focus:outline-offset-2"}\n ${n}\n `.trim(),style:e,onClick:r,onKeyDown:h,tabIndex:r?0:void 0,...p,children:k})})
19
- f.displayName="Icon"
20
- const k={success:"✓",error:"✕",warning:"⚠",info:"ⓘ",question:"?"},p={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},h=({props:o,onClose:a})=>{const{title:e,text:n,type:t="info",cancelText:r="Cancel",confirmText:l="OK",onCancel:i,onConfirm:s,icon:m,html:u,showCancelButton:f=!1,showConfirmButton:h=!0,reverseButtons:g=!1,width:b="auto",fullWidth:v=!1,customClass:C={}}=o,y=()=>{i?.(),a()},x=()=>{s?.(),a()},w=c.useMemo(()=>m?"string"==typeof m?d.jsx("span",{children:m}):m:d.jsx("span",{style:{color:p[t]},children:k[t]}),[m,t]),N=g?["confirm","cancel"]:["cancel","confirm"],B=c.useMemo(()=>{const o={}
21
- return v?(o.width="calc(100vw - 20px)",o.maxWidth="calc(100vw - 20px)"):o.width="number"==typeof b?b+"px":b,o},[b,v])
22
- return d.jsxs("div",{className:"aark-standard-modal "+(C.popup||""),style:B,children:[d.jsxs("div",{className:"aark-modal-content "+(C.content||""),children:[w&&d.jsx("div",{className:"aark-modal-icon "+(C.icon||""),children:w}),e&&d.jsx("div",{className:"aark-modal-header "+(C.header||""),children:d.jsx("h2",{className:"aark-modal-title "+(C.title||""),children:e})}),u?d.jsx("div",{dangerouslySetInnerHTML:{o:"string"==typeof u?u:""}}):n?d.jsx("p",{children:n}):null]}),(f||h)&&d.jsx("div",{className:"aark-modal-footer "+(C.actions||""),children:N.map(o=>"cancel"===o&&f?d.jsx("button",{onClick:y,className:"aark-modal-cancel-button "+(C.cancelButton||""),children:r},"cancel"):"confirm"===o&&h?d.jsx("button",{onClick:x,className:"aark-modal-confirm-button "+(C.confirmButton||""),style:{background:p[t]},children:l},"confirm"):null)})]})}
23
- let g=null
24
- const b=()=>(g||(g=document.getElementById("aark-react-modalify-root"),g||(g=document.createElement("div"),g.id="aark-react-modalify-root",g.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n z-index: 9998;\n ",document.body.appendChild(g))),g),v=({config:o,onClose:a})=>{const{content:e,props:n,options:t={}}=o,{position:r="center",showCloseIcon:l=!0,className:i="",overlayClassName:s="",preventEscClose:u=!1,preventOverlayClose:k=!1}=t
25
- c.useEffect(()=>{const o=o=>{"Escape"!==o.key||u||a()}
26
- if(!u)return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,u])
27
- const p=c.useCallback(o=>{o.target!==o.currentTarget||k||a()},[a,k]),g=c.useCallback(o=>{o.stopPropagation(),a()},[a]),v=`aark-modal-container ${r} ${i}`.trim(),C=b()
28
- return m.createPortal(d.jsx("div",{className:("aark-modal-overlay "+s).trim(),onClick:p,"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:9999,background:"var(--aark-modal-overlay-bg)",backdropFilter:"blur(2px)",animation:"fade-in var(--aark-anim)",display:"flex",alignItems:r.includes("center")?"center":r.includes("top")?"flex-start":"flex-end",justifyContent:r.includes("center")?"center":r.includes("right")?"flex-end":"flex-start",padding:"1rem"},children:n?d.jsxs("div",{className:v,role:"dialog","aria-modal":"true",onClick:o=>o.stopPropagation(),children:[l&&d.jsx("button",{onClick:g,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:d.jsx(f,{name:"close",size:12})}),d.jsx("div",{className:"aark-modal-wrapper",children:d.jsx(h,{props:n,onClose:a})})]}):e?d.jsxs("div",{className:v,role:"dialog","aria-modal":"true",onClick:o=>o.stopPropagation(),children:[l&&d.jsx("button",{onClick:g,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:d.jsx(f,{name:"close",size:12})}),d.jsx("div",{className:"aark-modal-body",children:e})]}):null}),C)},C={success:"✓",error:"✕",warning:"⚠",info:"ⓘ",question:"?"},y={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},x=({props:o,onClose:a})=>{const{title:e,text:n,type:t="info",icon:r,html:l,timer:i=5e3,showCloseButton:s=!0,clickToClose:m=!0,width:u="300px",fullWidth:f=!1,padding:k="1rem",background:p="#ffffff",customClass:h={}}=o
29
- c.useEffect(()=>{if(i&&i>0){const o=setTimeout(a,i)
30
- return()=>clearTimeout(o)}},[i,a])
31
- const g=c.useMemo(()=>r?"string"==typeof r?d.jsx("span",{children:r}):r:d.jsx("span",{style:{color:y[t]},children:C[t]}),[r,t]),b=c.useMemo(()=>{const o={padding:k,background:p,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",border:"1px solid "+y[t],cursor:m?"pointer":"default",position:"relative",overflow:"hidden"}
32
- return f?(o.width="calc(100vw - 40px)",o.maxWidth="calc(100vw - 40px)"):o.width="number"==typeof u?u+"px":u,o},[u,f,k,p,t,m])
33
- return d.jsxs("div",{className:"aark-standard-notification "+(h.popup||""),style:b,onClick:()=>{m&&a()},children:[i&&i>0&&d.jsx("div",{style:{position:"absolute",bottom:0,left:0,height:"3px",background:y[t],animation:`aark-notification-progress ${i}ms linear forwards`,transformOrigin:"left"}}),d.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[g&&d.jsx("div",{className:"aark-notification-icon "+(h.icon||""),style:{fontSize:"1.25rem",flexShrink:0,marginTop:"0.125rem"},children:g}),d.jsxs("div",{style:{flex:1,minWidth:0},children:[e&&d.jsx("div",{className:"aark-notification-header "+(h.header||""),children:d.jsx("h4",{className:"aark-notification-title "+(h.title||""),style:{margin:0,fontSize:"0.875rem",fontWeight:"600",color:"#1f2937"},children:e})}),d.jsx("div",{className:"aark-notification-content "+(h.content||""),style:{marginTop:e?"0.25rem":0},children:l?d.jsx("div",{dangerouslySetInnerHTML:{o:"string"==typeof l?l:""}}):n?d.jsx("p",{style:{margin:0,fontSize:"0.75rem",color:"#6b7280",lineHeight:"1.4"},children:n}):null})]}),s&&d.jsx("button",{onClick:o=>{o.stopPropagation(),a()},className:"aark-notification-close "+(h.closeButton||""),style:{background:"none",border:"none",fontSize:"1rem",color:"#9ca3af",cursor:"pointer",padding:0,lineHeight:1,flexShrink:0},"aria-label":"Close notification",children:"×"})]}),d.jsx("style",{children:"\n @keyframes aark-notification-progress {\n from {\n transform: scaleX(1);\n }\n to {\n transform: scaleX(0);\n }\n }\n "})]})},w=({config:o,onClose:a})=>{const{content:e,props:n,options:t={}}=o,{position:r="top-right",showCloseIcon:l=!0,autoCloseTime:i=5e3,className:s="",preventEscClose:u=!1}=t
34
- c.useEffect(()=>{if(i&&!n){const o=setTimeout(a,i)
35
- return()=>clearTimeout(o)}},[i,a,n]),c.useEffect(()=>{const o=o=>{"Escape"!==o.key||u||a()}
36
- if(!u)return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,u])
37
- const f=c.useCallback(o=>{o.stopPropagation(),a()},[a]),k=`aark-notification-container ${r} ${s}`.trim(),p=b()
38
- return m.createPortal(d.jsx("div",{style:(()=>{const o={position:"fixed",zIndex:1e4,margin:"1rem"}
39
- switch(r){case"top-left":return{...o,top:0,left:0}
40
- case"top-center":return{...o,top:0,left:"50%",transform:"translateX(-50%)"}
41
- case"top-right":default:return{...o,top:0,right:0}
42
- case"bottom-left":return{...o,bottom:0,left:0}
43
- case"bottom-center":return{...o,bottom:0,left:"50%",transform:"translateX(-50%)"}
44
- case"bottom-right":return{...o,bottom:0,right:0}}})(),children:n?d.jsx("div",{className:"aark-notification-wrapper",children:d.jsx(x,{props:n,onClose:a})}):e?d.jsxs("div",{className:k,role:"alert","aria-live":"polite","aria-labelledby":"aark-notification-content",children:[l&&d.jsx("button",{onClick:f,className:"aark-notification-close","aria-label":"Close notification",type:"button",children:"×"}),d.jsx("div",{id:"aark-notification-body",className:"aark-notification-body",children:e})]}):null}),p)},N=()=>{const{isOpen:a,config:e,close:n}=o()
45
- return a&&e?"modal"===e.mode?d.jsx(v,{config:e,onClose:n}):"notification"===e.mode?d.jsx(w,{config:e,onClose:n}):null:null},B=new Set
46
- let T=null,z=null
47
- const I={subscribe:function(o){return B.add(o),()=>B.delete(o)},fire:function(o,a){n(o,a)},fireModal:n,fireNotification:function(o,n){let t,r
48
- a(),!o||"object"!=typeof o||"$$typeof"in o||Array.isArray(o)?(t=o,r=void 0):(r=o,t=void 0)
49
- const l={content:t,props:r,mode:"notification",options:Object.assign({position:"top-right",showCloseIcon:!0,autoCloseTime:5e3,preventEscClose:!1},n)}
50
- T=l,e("open",l)},close:t,isOpen:function(){return null!==T},getCurrentConfig:function(){return T},closeAll:function(){t()},cleanup:function(){z&&(z.unmount(),z=null),g&&0===g.children.length&&(g.remove(),g=null)}},S={fire:(o,a)=>I.fire(o,a),modal:(o,a)=>I.fireModal(o,a),notification:(o,a)=>I.fireNotification(o,a),close:()=>I.close(),isOpen:()=>I.isOpen(),closeAll:()=>I.closeAll(),setTheme:o=>r(o),resetTheme:()=>l(),getTheme:()=>i()}
51
- exports.Modal=v,exports.ModalProvider=N,exports.Notification=w,exports.aark=S,exports.getAarkModalTheme=i,exports.resetAarkModalTheme=l,exports.setAarkModalTheme=r,exports.useModal=o
1
+ "use strict";var V=Object.defineProperty;var uo=Object.getOwnPropertyDescriptor;var go=Object.getOwnPropertyNames;var yo=Object.prototype.hasOwnProperty;var vo=(t,o)=>{for(var e in o)V(t,e,{get:o[e],enumerable:!0})},ko=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of go(o))!yo.call(t,n)&&n!==e&&V(t,n,{get:()=>o[n],enumerable:!(a=uo(o,n))||a.enumerable});return t};var Co=t=>ko(V({},"__esModule",{value:!0}),t);var Oo={};vo(Oo,{Modal:()=>W,ModalProvider:()=>H,Notification:()=>L,aark:()=>po,getAarkModalTheme:()=>_,resetAarkModalTheme:()=>Z,setAarkModalTheme:()=>D,useModal:()=>O});module.exports=Co(Oo);var ro=require("react"),lo=require("react-dom/client");var E=require("react");function O(){let[t,o]=(0,E.useState)(!1),[e,a]=(0,E.useState)(null),n=(0,E.useCallback)(()=>{h.close()},[]);return(0,E.useEffect)(()=>{let i=s=>{switch(s.type){case"open":o(!0),a(s.config||null);break;case"close":o(!1),a(null);break;case"beforeClose":break}},u=h.subscribe(i);return o(h.isOpen()),a(h.getCurrentConfig()),u},[]),{isOpen:t,config:e,close:n}}var R=require("react"),eo=require("react-dom");var w=require("react"),z=require("react/jsx-runtime"),G={white:"#FFFFFF",black:"#0B071A"},J=(0,w.memo)(({name:t,color:o="black",style:e,className:a="",noHoverEffect:n=!1,onClick:i,size:u=24,"aria-label":s,title:x})=>{let m=(0,w.useMemo)(()=>String(u),[u]),f=(0,w.useMemo)(()=>G[o]?G[o]:(o.startsWith("#"),o),[o]),y=(0,w.useMemo)(()=>{let d=f;return t==="close"?(0,z.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:m,height:m,viewBox:"0 0 16 16",fill:"none",children:(0,z.jsx)("path",{d:"M15.281 14.2198C15.3507 14.2895 15.406 14.3722 15.4437 14.4632C15.4814 14.5543 15.5008 14.6519 15.5008 14.7504C15.5008 14.849 15.4814 14.9465 15.4437 15.0376C15.406 15.1286 15.3507 15.2114 15.281 15.281C15.2114 15.3507 15.1286 15.406 15.0376 15.4437C14.9465 15.4814 14.849 15.5008 14.7504 15.5008C14.6519 15.5008 14.5543 15.4814 14.4632 15.4437C14.3722 15.406 14.2895 15.3507 14.2198 15.281L8.00042 9.06073L1.78104 15.281C1.64031 15.4218 1.44944 15.5008 1.25042 15.5008C1.05139 15.5008 0.860523 15.4218 0.719792 15.281C0.579062 15.1403 0.5 14.9494 0.5 14.7504C0.5 14.5514 0.579062 14.3605 0.719792 14.2198L6.9401 8.00042L0.719792 1.78104C0.579062 1.64031 0.5 1.44944 0.5 1.25042C0.5 1.05139 0.579062 0.860523 0.719792 0.719792C0.860523 0.579062 1.05139 0.5 1.25042 0.5C1.44944 0.5 1.64031 0.579062 1.78104 0.719792L8.00042 6.9401L14.2198 0.719792C14.3605 0.579062 14.5514 0.5 14.7504 0.5C14.9494 0.5 15.1403 0.579062 15.281 0.719792C15.4218 0.860523 15.5008 1.05139 15.5008 1.25042C15.5008 1.44944 15.4218 1.64031 15.281 1.78104L9.06073 8.00042L15.281 14.2198Z",fill:d})}):null},[t,f,m]),c=(0,w.useMemo)(()=>{let d={};return s?d["aria-label"]=s:d["aria-label"]=`${t} icon`,x&&(d.title=x),d.role=i?"button":"img",d},[s,x,t,i]),p=(0,w.useMemo)(()=>{if(i)return d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i())}},[i]);return(0,z.jsx)("i",{className:`
2
+ inline-flex items-center justify-center bg-transparent outline-none border-none
3
+ ${!n&&i&&"hover:opacity-80 cursor-pointer transition-opacity duration-200"}
4
+ ${i&&"focus:outline-2 focus:outline-blue-500 focus:outline-offset-2"}
5
+ ${a}
6
+ `.trim(),style:e,onClick:i,onKeyDown:p,tabIndex:i?0:void 0,...c,children:y})});J.displayName="Icon";var j=J;var U=require("react"),k=require("react/jsx-runtime"),ho={success:"\u2713",error:"\u2715",warning:"\u26A0",info:"\u24D8",question:"?"},Q={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},Mo=({props:t,onClose:o})=>{let{title:e,text:a,type:n="info",cancelText:i="Cancel",confirmText:u="OK",onCancel:s,onConfirm:x,icon:m,html:f,showCancelButton:y=!1,showConfirmButton:c=!0,reverseButtons:p=!1,width:d="auto",fullWidth:r=!1,customClass:v={}}=t,C=()=>{s?.(),o()},q=()=>{x?.(),o()},F=(0,U.useMemo)(()=>m?typeof m=="string"?(0,k.jsx)("span",{children:m}):m:(0,k.jsx)("span",{style:{color:Q[n]},children:ho[n]}),[m,n]),l=p?["confirm","cancel"]:["cancel","confirm"],S=(0,U.useMemo)(()=>{let N={};return r?(N.width="calc(100vw - 20px)",N.maxWidth="calc(100vw - 20px)"):typeof d=="number"?N.width=`${d}px`:N.width=d,N},[d,r]);return(0,k.jsxs)("div",{className:`aark-standard-modal ${v.popup||""}`,style:S,children:[(0,k.jsxs)("div",{className:`aark-modal-content ${v.content||""}`,children:[F&&(0,k.jsx)("div",{className:`aark-modal-icon ${v.icon||""}`,children:F}),e&&(0,k.jsx)("div",{className:`aark-modal-header ${v.header||""}`,children:(0,k.jsx)("h2",{className:`aark-modal-title ${v.title||""}`,children:e})}),f?typeof f=="string"?(0,k.jsx)("div",{dangerouslySetInnerHTML:{__html:f}}):(0,k.jsx)("div",{children:f}):a?(0,k.jsx)("p",{children:a}):null]}),(y||c)&&(0,k.jsx)("div",{className:`aark-modal-footer ${v.actions||""}`,children:l.map(N=>N==="cancel"&&y?(0,k.jsx)("button",{onClick:C,className:`aark-modal-cancel-button ${v.cancelButton||""}`,children:i},"cancel"):N==="confirm"&&c?(0,k.jsx)("button",{onClick:q,className:`aark-modal-confirm-button ${v.confirmButton||""}`,style:{background:Q[n]},children:u},"confirm"):null)})]})},oo=Mo;var M=null,B=()=>(M||(M=document.getElementById("aark-react-modalify-root"),M||(M=document.createElement("div"),M.id="aark-react-modalify-root",M.style.cssText=`
7
+ position: fixed;
8
+ top: 0;
9
+ left: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ pointer-events: none;
13
+ `,document.body.appendChild(M))),M),to=()=>{M&&M.children.length===0&&(M.remove(),M=null)};var b=require("react/jsx-runtime"),bo={sm:"400px",md:"550px",lg:"700px",xl:"900px",full:"calc(100vw - 32px)"},xo=({config:t,onClose:o})=>{let{content:e,props:a,options:n={}}=t,{position:i="center",showCloseIcon:u=!0,className:s="",overlayClassName:x="",preventEscClose:m=!1,preventOverlayClose:f=!1,width:y,maxWidth:c,size:p}=n;(0,R.useEffect)(()=>{if(m)return;let l=S=>{S.key==="Escape"&&o()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o,m]);let d=(0,R.useCallback)(l=>{l.target===l.currentTarget&&!f&&o()},[o,f]),r=(0,R.useCallback)(l=>{l.stopPropagation(),o()},[o]),v=(0,R.useMemo)(()=>{let l={};if(y!==void 0&&(l.width=typeof y=="number"?`${y}px`:y,c===void 0&&(l.maxWidth=l.width)),c!==void 0)l.maxWidth=typeof c=="number"?`${c}px`:c;else if(p){let S=bo[p];p==="full"&&(l.width=l.width??S),l.maxWidth=S}return l},[y,c,p]),C=`aark-modal-container ${i} ${s}`.trim(),q=B(),F=()=>a?(0,b.jsxs)("div",{className:C,style:v,role:"dialog","aria-modal":"true",onClick:l=>l.stopPropagation(),children:[u&&(0,b.jsx)("button",{onClick:r,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:(0,b.jsx)(j,{name:"close",size:12})}),(0,b.jsx)("div",{className:"aark-modal-wrapper",children:(0,b.jsx)(oo,{props:a,onClose:o})})]}):e?(0,b.jsx)("div",{className:C,style:v,role:"dialog","aria-modal":"true",onClick:l=>l.stopPropagation(),children:(0,b.jsxs)("div",{className:"aark-modal-body",children:[u&&(0,b.jsx)("button",{onClick:r,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:(0,b.jsx)(j,{name:"close",size:12})}),e]})}):null;return(0,eo.createPortal)((0,b.jsx)("div",{className:`aark-modal-overlay ${x}`.trim(),onClick:d,style:{position:"fixed",inset:0,zIndex:"var(--aark-modal-z, 9999)",background:"var(--aark-modal-overlay-bg)",backdropFilter:"blur(var(--aark-modal-overlay-blur, 0px))",WebkitBackdropFilter:"blur(var(--aark-modal-overlay-blur, 0px))",animation:"fade-in var(--aark-anim)",display:"flex",alignItems:i==="center"?"center":i.startsWith("top")?"flex-start":"flex-end",justifyContent:i.endsWith("center")?"center":i.endsWith("right")?"flex-end":"flex-start",padding:"1rem",overflowY:"auto",boxSizing:"border-box"},children:F()}),q)},W=xo;var A=require("react"),io=require("react-dom");var $=require("react"),g=require("react/jsx-runtime"),ao={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},No={success:"\u2713",error:"\u2715",warning:"\u26A0",info:"\u24D8",question:"?"},wo=({props:t,onClose:o})=>{let{title:e,text:a,type:n="info",icon:i,html:u,timer:s=5e3,showCloseButton:x=!0,clickToClose:m=!0,width:f,fullWidth:y=!1,padding:c,customClass:p={}}=t;(0,$.useEffect)(()=>{if(s&&s>0){let C=setTimeout(o,s);return()=>clearTimeout(C)}},[s,o]);let d=()=>{m&&o()},r=(0,$.useMemo)(()=>i?typeof i=="string"?(0,g.jsx)("span",{children:i}):i:(0,g.jsx)("span",{style:{color:ao[n]},children:No[n]}),[i,n]),v=(0,$.useMemo)(()=>{let C={};return c!==void 0&&(C.padding=typeof c=="number"?`${c}px`:c),y?(C.width="calc(100vw - 40px)",C.maxWidth="calc(100vw - 40px)"):f!==void 0&&(C.width=typeof f=="number"?`${f}px`:f),C},[f,y,c]);return(0,g.jsxs)("div",{className:`aark-standard-notification aark-notification-${n} ${p.popup||""}`,style:v,onClick:d,children:[s&&s>0&&(0,g.jsx)("div",{className:"aark-notification-progress",style:{background:ao[n],animation:`aark-notification-progress ${s}ms linear forwards`}}),(0,g.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[r&&(0,g.jsx)("div",{className:`aark-notification-icon ${p.icon||""}`,children:r}),(0,g.jsxs)("div",{style:{flex:1,minWidth:0},children:[e&&(0,g.jsx)("div",{className:`aark-notification-header ${p.header||""}`,children:(0,g.jsx)("h4",{className:`aark-notification-title ${p.title||""}`,children:e})}),(0,g.jsx)("div",{className:`aark-notification-content ${p.content||""}`,style:{marginTop:e?"0.25rem":0},children:u?typeof u=="string"?(0,g.jsx)("div",{dangerouslySetInnerHTML:{__html:u}}):(0,g.jsx)("div",{children:u}):a?(0,g.jsx)("p",{children:a}):null})]}),x&&(0,g.jsx)("button",{onClick:C=>{C.stopPropagation(),o()},className:`aark-notification-close ${p.closeButton||""}`,"aria-label":"Close notification",type:"button",children:"\xD7"})]})]})},no=wo;var P=require("react/jsx-runtime"),Po=({config:t,onClose:o})=>{let{content:e,props:a,options:n={}}=t,{position:i="top-right",showCloseIcon:u=!0,autoCloseTime:s=5e3,className:x="",preventEscClose:m=!1}=n;(0,A.useEffect)(()=>{if(s&&!a){let r=setTimeout(o,s);return()=>clearTimeout(r)}},[s,o,a]),(0,A.useEffect)(()=>{if(m)return;let r=v=>{v.key==="Escape"&&o()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,m]);let f=(0,A.useCallback)(r=>{r.stopPropagation(),o()},[o]),y=`aark-notification-container ${i} ${x}`.trim(),c=B(),p=()=>{let r={position:"fixed",zIndex:1e4,margin:"1rem"};switch(i){case"top-left":return{...r,top:0,left:0};case"top-center":return{...r,top:0,left:"50%",transform:"translateX(-50%)"};case"top-right":return{...r,top:0,right:0};case"bottom-left":return{...r,bottom:0,left:0};case"bottom-center":return{...r,bottom:0,left:"50%",transform:"translateX(-50%)"};case"bottom-right":return{...r,bottom:0,right:0};default:return{...r,top:0,right:0}}},d=()=>a?(0,P.jsx)("div",{className:"aark-notification-wrapper",children:(0,P.jsx)(no,{props:a,onClose:o})}):e?(0,P.jsxs)("div",{className:y,role:"alert","aria-live":"polite",children:[u&&(0,P.jsx)("button",{onClick:f,className:"aark-notification-close","aria-label":"Close notification",type:"button",children:"\xD7"}),(0,P.jsx)("div",{className:"aark-notification-body",children:e})]}):null;return(0,io.createPortal)((0,P.jsx)("div",{style:p(),children:d()}),c)},L=Po;var X=require("react/jsx-runtime"),So=()=>{let{isOpen:t,config:o,close:e}=O();return!t||!o?null:o.mode==="modal"?(0,X.jsx)(W,{config:o,onClose:e}):o.mode==="notification"?(0,X.jsx)(L,{config:o,onClose:e}):null},H=So;var Y=new Set,T=null,I=null;function so(){if(I)return;let t=B();I=(0,lo.createRoot)(t),I.render((0,ro.createElement)(H))}function Eo(t){return Y.add(t),()=>Y.delete(t)}function K(t,o){let e={type:t,config:o};Y.forEach(a=>a(e))}function co(t,o){so();let e,a;t&&typeof t=="object"&&!("$$typeof"in t)&&!Array.isArray(t)?(a=t,e=void 0):(e=t,a=void 0);let n={content:e,props:a,mode:"modal",options:Object.assign({position:"center",showCloseIcon:!0,preventEscClose:!1,preventOverlayClose:!1},o)};T=n,K("open",n)}function Ro(t,o){so();let e,a;t&&typeof t=="object"&&!("$$typeof"in t)&&!Array.isArray(t)?(a=t,e=void 0):(e=t,a=void 0);let n={content:e,props:a,mode:"notification",options:Object.assign({position:"top-right",showCloseIcon:!0,autoCloseTime:5e3,preventEscClose:!1},o)};T=n,K("open",n)}function To(t,o){co(t,o)}function fo(){T&&(K("beforeClose",T),T=null,K("close"))}function Bo(){return T!==null}function Io(){return T}function $o(){fo()}function Ao(){I&&(I.unmount(),I=null),to()}var h={subscribe:Eo,fire:To,fireModal:co,fireNotification:Ro,close:fo,isOpen:Bo,getCurrentConfig:Io,closeAll:$o,cleanup:Ao};var mo={overlayBackground:"--aark-modal-overlay-bg",overlayBlur:"--aark-modal-overlay-blur",modalBackground:"--aark-modal-bg",modalBorderRadius:"--aark-modal-radius",modalShadow:"--aark-modal-shadow",modalPadding:"--aark-modal-pad",modalMaxWidth:"--aark-modal-max-width",modalZIndex:"--aark-modal-z",closeButtonColor:"--aark-close-color",closeButtonHoverBackground:"--aark-close-hover",closeButtonHoverColor:"--aark-close-hover-color",closeButtonFocusOutline:"--aark-close-focus-outline",animationDuration:"--aark-anim",notificationBackground:"--aark-notification-bg",notificationBorderRadius:"--aark-notification-radius",notificationShadow:"--aark-notification-shadow",notificationPadding:"--aark-notification-pad",notificationZIndex:"--aark-notification-z"};function D(t){let o=document.documentElement;Object.keys(t).forEach(e=>{let a=t[e],n=mo[e];a!==void 0&&n&&o.style.setProperty(n,String(a))})}function Z(){let t=document.documentElement;Object.values(mo).forEach(o=>{t.style.removeProperty(o)})}function _(){let t=document.documentElement,o=getComputedStyle(t),e=a=>o.getPropertyValue(a).trim()||void 0;return{overlayBackground:e("--aark-modal-overlay-bg"),overlayBlur:e("--aark-modal-overlay-blur"),modalBackground:e("--aark-modal-bg"),modalBorderRadius:e("--aark-modal-radius"),modalShadow:e("--aark-modal-shadow"),modalPadding:e("--aark-modal-pad"),modalMaxWidth:e("--aark-modal-max-width"),modalZIndex:parseInt(e("--aark-modal-z")??"0")||void 0,closeButtonColor:e("--aark-close-color"),closeButtonHoverBackground:e("--aark-close-hover"),closeButtonHoverColor:e("--aark-close-hover-color"),closeButtonFocusOutline:e("--aark-close-focus-outline"),animationDuration:e("--aark-anim"),notificationBackground:e("--aark-notification-bg"),notificationBorderRadius:e("--aark-notification-radius"),notificationShadow:e("--aark-notification-shadow"),notificationPadding:e("--aark-notification-pad"),notificationZIndex:parseInt(e("--aark-notification-z")??"0")||void 0}}var Fo={fire:(t,o)=>h.fire(t,o),modal:(t,o)=>h.fireModal(t,o),notification:(t,o)=>h.fireNotification(t,o),close:()=>h.close(),isOpen:()=>h.isOpen(),closeAll:()=>h.closeAll(),setTheme:t=>D(t),resetTheme:()=>Z(),getTheme:()=>_()},po=Fo;0&&(module.exports={Modal,ModalProvider,Notification,aark,getAarkModalTheme,resetAarkModalTheme,setAarkModalTheme,useModal});
@@ -0,0 +1,189 @@
1
+ import { ReactNode, FC } from 'react';
2
+
3
+ type ModalPosition = "center" | "top-center" | "top-right" | "bottom-right" | "bottom-center";
4
+ type NotificationPosition = "top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left";
5
+ type ModalMode = "modal" | "notification";
6
+ type ModalType = "success" | "error" | "warning" | "info" | "question";
7
+ /** Convenience size presets — maps to max-width values */
8
+ type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
9
+ interface ModalProps$1 {
10
+ title?: string;
11
+ text?: string;
12
+ type?: ModalType;
13
+ cancelText?: string;
14
+ confirmText?: string;
15
+ onCancel?: () => void;
16
+ onConfirm?: () => void;
17
+ icon?: string | ReactNode;
18
+ html?: string | ReactNode;
19
+ showCancelButton?: boolean;
20
+ showConfirmButton?: boolean;
21
+ allowOutsideClick?: boolean;
22
+ allowEscapeKey?: boolean;
23
+ reverseButtons?: boolean;
24
+ focusConfirm?: boolean;
25
+ focusCancel?: boolean;
26
+ width?: string | number;
27
+ fullWidth?: boolean;
28
+ padding?: string | number;
29
+ background?: string;
30
+ customClass?: {
31
+ container?: string;
32
+ popup?: string;
33
+ header?: string;
34
+ title?: string;
35
+ closeButton?: string;
36
+ icon?: string;
37
+ image?: string;
38
+ content?: string;
39
+ input?: string;
40
+ actions?: string;
41
+ confirmButton?: string;
42
+ cancelButton?: string;
43
+ footer?: string;
44
+ };
45
+ }
46
+ interface NotificationProps$1 {
47
+ title?: string;
48
+ text?: string;
49
+ type?: ModalType;
50
+ icon?: string | ReactNode;
51
+ html?: string | ReactNode;
52
+ timer?: number;
53
+ showCloseButton?: boolean;
54
+ clickToClose?: boolean;
55
+ width?: string | number;
56
+ fullWidth?: boolean;
57
+ padding?: string | number;
58
+ background?: string;
59
+ customClass?: {
60
+ container?: string;
61
+ popup?: string;
62
+ header?: string;
63
+ title?: string;
64
+ closeButton?: string;
65
+ icon?: string;
66
+ content?: string;
67
+ footer?: string;
68
+ };
69
+ }
70
+ interface BaseOptions {
71
+ showCloseIcon?: boolean;
72
+ className?: string;
73
+ preventEscClose?: boolean;
74
+ }
75
+ interface ModalOptions extends BaseOptions {
76
+ position?: ModalPosition;
77
+ overlayClassName?: string;
78
+ preventOverlayClose?: boolean;
79
+ /** Convenience size preset. Overridden by explicit width/maxWidth. */
80
+ size?: ModalSize;
81
+ /** Explicit width (e.g. '500px', '80%', 600). Overrides size preset. */
82
+ width?: string | number;
83
+ /** Explicit max-width (e.g. '600px', '90vw'). Overrides size preset. */
84
+ maxWidth?: string | number;
85
+ }
86
+ interface NotificationOptions extends BaseOptions {
87
+ position?: NotificationPosition;
88
+ autoCloseTime?: number;
89
+ }
90
+ interface ModalConfig {
91
+ content?: ReactNode;
92
+ props?: ModalProps$1;
93
+ options?: ModalOptions;
94
+ mode: "modal";
95
+ }
96
+ interface NotificationConfig {
97
+ content?: ReactNode;
98
+ props?: NotificationProps$1;
99
+ options?: NotificationOptions;
100
+ mode: "notification";
101
+ }
102
+ type ComponentConfig = ModalConfig | NotificationConfig;
103
+ interface ModalState {
104
+ isOpen: boolean;
105
+ config: ComponentConfig | null;
106
+ }
107
+ type ModalEventType = "open" | "close" | "beforeClose";
108
+ interface ModalEvent {
109
+ type: ModalEventType;
110
+ config?: ComponentConfig;
111
+ }
112
+
113
+ /**
114
+ * CSS Theme customization utilities for AARK React Modalify
115
+ */
116
+ interface AarkModalTheme {
117
+ overlayBackground?: string;
118
+ overlayBlur?: string;
119
+ modalBackground?: string;
120
+ modalBorderRadius?: string;
121
+ modalShadow?: string;
122
+ modalPadding?: string;
123
+ modalMaxWidth?: string;
124
+ modalZIndex?: number;
125
+ closeButtonColor?: string;
126
+ closeButtonHoverBackground?: string;
127
+ closeButtonHoverColor?: string;
128
+ closeButtonFocusOutline?: string;
129
+ animationDuration?: string;
130
+ notificationBackground?: string;
131
+ notificationBorderRadius?: string;
132
+ notificationShadow?: string;
133
+ notificationPadding?: string;
134
+ notificationZIndex?: number;
135
+ }
136
+ /**
137
+ * Apply custom theme to AARK Modal CSS variables
138
+ */
139
+ declare function setAarkModalTheme(theme: AarkModalTheme): void;
140
+ /**
141
+ * Reset AARK Modal theme to default values
142
+ */
143
+ declare function resetAarkModalTheme(): void;
144
+ /**
145
+ * Get current AARK Modal theme values
146
+ */
147
+ declare function getAarkModalTheme(): AarkModalTheme;
148
+
149
+ declare const aark: {
150
+ fire: (contentOrProps: ReactNode | ModalProps$1, options?: ModalOptions) => void;
151
+ modal: (contentOrProps: ReactNode | ModalProps$1, options?: ModalOptions) => void;
152
+ notification: (contentOrProps: ReactNode | NotificationProps$1, options?: NotificationOptions) => void;
153
+ close: () => void;
154
+ isOpen: () => boolean;
155
+ closeAll: () => void;
156
+ setTheme: (theme: AarkModalTheme) => void;
157
+ resetTheme: () => void;
158
+ getTheme: () => AarkModalTheme;
159
+ };
160
+
161
+ interface UseModalReturn {
162
+ isOpen: boolean;
163
+ config: ComponentConfig | null;
164
+ close: () => void;
165
+ }
166
+ /**
167
+ * Hook to manage modal state and listen to modal events
168
+ */
169
+ declare function useModal(): UseModalReturn;
170
+
171
+ interface ModalProps {
172
+ config: ModalConfig;
173
+ onClose: () => void;
174
+ }
175
+ declare const Modal: FC<ModalProps>;
176
+
177
+ interface NotificationProps {
178
+ config: NotificationConfig;
179
+ onClose: () => void;
180
+ }
181
+ declare const Notification: FC<NotificationProps>;
182
+
183
+ /**
184
+ * ModalProvider component that renders modals globally
185
+ * This component should be rendered once in your app's root
186
+ */
187
+ declare const ModalProvider: FC;
188
+
189
+ export { type AarkModalTheme, type ComponentConfig, Modal, type ModalConfig, type ModalEvent, type ModalEventType, type ModalMode, type ModalOptions, type ModalPosition, type ModalProps$1 as ModalProps, ModalProvider, type ModalSize, type ModalState, type ModalType, Notification, type NotificationConfig, type NotificationOptions, type NotificationPosition, type NotificationProps$1 as NotificationProps, aark, getAarkModalTheme, resetAarkModalTheme, setAarkModalTheme, useModal };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,189 @@
1
- import "./assets/styles/aark-modal.css";
2
- export { default as aark } from "./logic/aark";
3
- export type { ModalOptions, NotificationOptions, ModalPosition, NotificationPosition, ModalMode, ModalType, ModalProps, NotificationProps, ModalConfig, NotificationConfig, ComponentConfig, ModalState, ModalEvent, ModalEventType, } from "./types";
4
- export type { AarkModalTheme } from "./utils/theme";
5
- export { setAarkModalTheme, resetAarkModalTheme, getAarkModalTheme, } from "./utils/theme";
6
- export { useModal } from "./hooks/useModal";
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
+ import { ReactNode, FC } from 'react';
2
+
3
+ type ModalPosition = "center" | "top-center" | "top-right" | "bottom-right" | "bottom-center";
4
+ type NotificationPosition = "top-right" | "top-center" | "top-left" | "bottom-right" | "bottom-center" | "bottom-left";
5
+ type ModalMode = "modal" | "notification";
6
+ type ModalType = "success" | "error" | "warning" | "info" | "question";
7
+ /** Convenience size presets maps to max-width values */
8
+ type ModalSize = "sm" | "md" | "lg" | "xl" | "full";
9
+ interface ModalProps$1 {
10
+ title?: string;
11
+ text?: string;
12
+ type?: ModalType;
13
+ cancelText?: string;
14
+ confirmText?: string;
15
+ onCancel?: () => void;
16
+ onConfirm?: () => void;
17
+ icon?: string | ReactNode;
18
+ html?: string | ReactNode;
19
+ showCancelButton?: boolean;
20
+ showConfirmButton?: boolean;
21
+ allowOutsideClick?: boolean;
22
+ allowEscapeKey?: boolean;
23
+ reverseButtons?: boolean;
24
+ focusConfirm?: boolean;
25
+ focusCancel?: boolean;
26
+ width?: string | number;
27
+ fullWidth?: boolean;
28
+ padding?: string | number;
29
+ background?: string;
30
+ customClass?: {
31
+ container?: string;
32
+ popup?: string;
33
+ header?: string;
34
+ title?: string;
35
+ closeButton?: string;
36
+ icon?: string;
37
+ image?: string;
38
+ content?: string;
39
+ input?: string;
40
+ actions?: string;
41
+ confirmButton?: string;
42
+ cancelButton?: string;
43
+ footer?: string;
44
+ };
45
+ }
46
+ interface NotificationProps$1 {
47
+ title?: string;
48
+ text?: string;
49
+ type?: ModalType;
50
+ icon?: string | ReactNode;
51
+ html?: string | ReactNode;
52
+ timer?: number;
53
+ showCloseButton?: boolean;
54
+ clickToClose?: boolean;
55
+ width?: string | number;
56
+ fullWidth?: boolean;
57
+ padding?: string | number;
58
+ background?: string;
59
+ customClass?: {
60
+ container?: string;
61
+ popup?: string;
62
+ header?: string;
63
+ title?: string;
64
+ closeButton?: string;
65
+ icon?: string;
66
+ content?: string;
67
+ footer?: string;
68
+ };
69
+ }
70
+ interface BaseOptions {
71
+ showCloseIcon?: boolean;
72
+ className?: string;
73
+ preventEscClose?: boolean;
74
+ }
75
+ interface ModalOptions extends BaseOptions {
76
+ position?: ModalPosition;
77
+ overlayClassName?: string;
78
+ preventOverlayClose?: boolean;
79
+ /** Convenience size preset. Overridden by explicit width/maxWidth. */
80
+ size?: ModalSize;
81
+ /** Explicit width (e.g. '500px', '80%', 600). Overrides size preset. */
82
+ width?: string | number;
83
+ /** Explicit max-width (e.g. '600px', '90vw'). Overrides size preset. */
84
+ maxWidth?: string | number;
85
+ }
86
+ interface NotificationOptions extends BaseOptions {
87
+ position?: NotificationPosition;
88
+ autoCloseTime?: number;
89
+ }
90
+ interface ModalConfig {
91
+ content?: ReactNode;
92
+ props?: ModalProps$1;
93
+ options?: ModalOptions;
94
+ mode: "modal";
95
+ }
96
+ interface NotificationConfig {
97
+ content?: ReactNode;
98
+ props?: NotificationProps$1;
99
+ options?: NotificationOptions;
100
+ mode: "notification";
101
+ }
102
+ type ComponentConfig = ModalConfig | NotificationConfig;
103
+ interface ModalState {
104
+ isOpen: boolean;
105
+ config: ComponentConfig | null;
106
+ }
107
+ type ModalEventType = "open" | "close" | "beforeClose";
108
+ interface ModalEvent {
109
+ type: ModalEventType;
110
+ config?: ComponentConfig;
111
+ }
112
+
113
+ /**
114
+ * CSS Theme customization utilities for AARK React Modalify
115
+ */
116
+ interface AarkModalTheme {
117
+ overlayBackground?: string;
118
+ overlayBlur?: string;
119
+ modalBackground?: string;
120
+ modalBorderRadius?: string;
121
+ modalShadow?: string;
122
+ modalPadding?: string;
123
+ modalMaxWidth?: string;
124
+ modalZIndex?: number;
125
+ closeButtonColor?: string;
126
+ closeButtonHoverBackground?: string;
127
+ closeButtonHoverColor?: string;
128
+ closeButtonFocusOutline?: string;
129
+ animationDuration?: string;
130
+ notificationBackground?: string;
131
+ notificationBorderRadius?: string;
132
+ notificationShadow?: string;
133
+ notificationPadding?: string;
134
+ notificationZIndex?: number;
135
+ }
136
+ /**
137
+ * Apply custom theme to AARK Modal CSS variables
138
+ */
139
+ declare function setAarkModalTheme(theme: AarkModalTheme): void;
140
+ /**
141
+ * Reset AARK Modal theme to default values
142
+ */
143
+ declare function resetAarkModalTheme(): void;
144
+ /**
145
+ * Get current AARK Modal theme values
146
+ */
147
+ declare function getAarkModalTheme(): AarkModalTheme;
148
+
149
+ declare const aark: {
150
+ fire: (contentOrProps: ReactNode | ModalProps$1, options?: ModalOptions) => void;
151
+ modal: (contentOrProps: ReactNode | ModalProps$1, options?: ModalOptions) => void;
152
+ notification: (contentOrProps: ReactNode | NotificationProps$1, options?: NotificationOptions) => void;
153
+ close: () => void;
154
+ isOpen: () => boolean;
155
+ closeAll: () => void;
156
+ setTheme: (theme: AarkModalTheme) => void;
157
+ resetTheme: () => void;
158
+ getTheme: () => AarkModalTheme;
159
+ };
160
+
161
+ interface UseModalReturn {
162
+ isOpen: boolean;
163
+ config: ComponentConfig | null;
164
+ close: () => void;
165
+ }
166
+ /**
167
+ * Hook to manage modal state and listen to modal events
168
+ */
169
+ declare function useModal(): UseModalReturn;
170
+
171
+ interface ModalProps {
172
+ config: ModalConfig;
173
+ onClose: () => void;
174
+ }
175
+ declare const Modal: FC<ModalProps>;
176
+
177
+ interface NotificationProps {
178
+ config: NotificationConfig;
179
+ onClose: () => void;
180
+ }
181
+ declare const Notification: FC<NotificationProps>;
182
+
183
+ /**
184
+ * ModalProvider component that renders modals globally
185
+ * This component should be rendered once in your app's root
186
+ */
187
+ declare const ModalProvider: FC;
188
+
189
+ export { type AarkModalTheme, type ComponentConfig, Modal, type ModalConfig, type ModalEvent, type ModalEventType, type ModalMode, type ModalOptions, type ModalPosition, type ModalProps$1 as ModalProps, ModalProvider, type ModalSize, type ModalState, type ModalType, Notification, type NotificationConfig, type NotificationOptions, type NotificationPosition, type NotificationProps$1 as NotificationProps, aark, getAarkModalTheme, resetAarkModalTheme, setAarkModalTheme, useModal };