aark-react-modalify 1.2.2 → 1.3.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/aark-react-modalify.css +1 -1
- package/dist/index-no-styles.cjs.js +14 -1
- package/dist/index-no-styles.d.mts +189 -0
- package/dist/index-no-styles.d.ts +189 -0
- package/dist/index-no-styles.esm.js +14 -14
- package/dist/index.cjs.js +14 -51
- package/dist/index.d.mts +189 -0
- package/dist/index.d.ts +189 -9
- package/dist/index.esm.js +14 -62
- package/package.json +86 -92
- package/dist/components/Icon.d.ts +0 -18
- package/dist/components/Modal.d.ts +0 -9
- package/dist/components/ModalProvider.d.ts +0 -7
- package/dist/components/Notification.d.ts +0 -9
- package/dist/components/modals/StandardModal.d.ts +0 -8
- package/dist/components/modals/index.d.ts +0 -1
- package/dist/components/notifications/StandardNotification.d.ts +0 -8
- package/dist/components/notifications/index.d.ts +0 -1
- package/dist/hooks/useModal.d.ts +0 -10
- package/dist/logic/ModalManager.d.ts +0 -24
- package/dist/logic/ModalManagerNew.d.ts +0 -0
- package/dist/logic/aark.d.ts +0 -15
- package/dist/types/index.d.ts +0 -102
- package/dist/utils/inject-styles.d.ts +0 -4
- package/dist/utils/modal-css.d.ts +0 -1
- package/dist/utils/modal-root.d.ts +0 -18
- package/dist/utils/theme.d.ts +0 -40
- package/dist/vite.svg +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,189 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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.esm.js
CHANGED
|
@@ -1,62 +1,14 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import{
|
|
15
|
-
import{jsx as p,jsxs as h}from"react/jsx-runtime"
|
|
16
|
-
import{createPortal as g}from"react-dom"
|
|
17
|
-
const b={white:"#FFFFFF",black:"#0B071A"},v=m(({name:o,color:a="black",style:e,className:n="",noHoverEffect:t=!1,onClick:r,size:l=24,"aria-label":i,title:c})=>{const s=u(()=>l+"",[l]),d=u(()=>b[a]?b[a]:(a.startsWith("#"),a),[a]),m=u(()=>"close"===o?/* @__PURE__ */p("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:s,viewBox:"0 0 16 16",fill:"none",children:/* @__PURE__ */p("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,[o,d,s]),f=u(()=>{const a={}
|
|
18
|
-
return a["aria-label"]=i||o+" icon",c&&(a.title=c),a.role=r?"button":"img",a},[i,c,o,r]),k=u(()=>{if(r)return o=>{"Enter"!==o.key&&" "!==o.key||(o.preventDefault(),r())}},[r]);/* @__PURE__ */
|
|
19
|
-
return p("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:k,tabIndex:r?0:void 0,...f,children:m})})
|
|
20
|
-
v.displayName="Icon"
|
|
21
|
-
const 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",cancelText:r="Cancel",confirmText:l="OK",onCancel:i,onConfirm:c,icon:s,html:d,showCancelButton:m=!1,showConfirmButton:f=!0,reverseButtons:k=!1,width:g="auto",fullWidth:b=!1,customClass:v={}}=o,x=()=>{i?.(),a()},w=()=>{c?.(),a()},N=u(()=>s?"string"==typeof s?/* @__PURE__ */p("span",{children:s}):s:/* @__PURE__ */p("span",{style:{color:y[t]},children:C[t]}),[s,t]),B=k?["confirm","cancel"]:["cancel","confirm"],T=u(()=>{const o={}
|
|
22
|
-
return b?(o.width="calc(100vw - 20px)",o.maxWidth="calc(100vw - 20px)"):o.width="number"==typeof g?g+"px":g,o},[g,b]);/* @__PURE__ */
|
|
23
|
-
return h("div",{className:"aark-standard-modal "+(v.popup||""),style:T,children:[
|
|
24
|
-
/* @__PURE__ */h("div",{className:"aark-modal-content "+(v.content||""),children:[N&&/* @__PURE__ */p("div",{className:"aark-modal-icon "+(v.icon||""),children:N}),e&&/* @__PURE__ */p("div",{className:"aark-modal-header "+(v.header||""),children:/* @__PURE__ */p("h2",{className:"aark-modal-title "+(v.title||""),children:e})}),d?/* @__PURE__ */p("div",{dangerouslySetInnerHTML:{o:"string"==typeof d?d:""}}):n?/* @__PURE__ */p("p",{children:n}):null]}),(m||f)&&/* @__PURE__ */p("div",{className:"aark-modal-footer "+(v.actions||""),children:B.map(o=>"cancel"===o&&m?/* @__PURE__ */p("button",{onClick:x,className:"aark-modal-cancel-button "+(v.cancelButton||""),children:r},"cancel"):"confirm"===o&&f?/* @__PURE__ */p("button",{onClick:w,className:"aark-modal-confirm-button "+(v.confirmButton||""),style:{background:y[t]},children:l},"confirm"):null)})]})}
|
|
25
|
-
let w=null
|
|
26
|
-
const N=()=>(w||(w=document.getElementById("aark-react-modalify-root"),w||(w=document.createElement("div"),w.id="aark-react-modalify-root",w.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(w))),w),B=({config:o,onClose:a})=>{const{content:e,props:n,options:t={}}=o,{position:r="center",showCloseIcon:l=!0,className:i="",overlayClassName:c="",preventEscClose:m=!1,preventOverlayClose:u=!1}=t
|
|
27
|
-
d(()=>{const o=o=>{"Escape"!==o.key||m||a()}
|
|
28
|
-
if(!m)return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,m])
|
|
29
|
-
const f=s(o=>{o.target!==o.currentTarget||u||a()},[a,u]),k=s(o=>{o.stopPropagation(),a()},[a]),b=`aark-modal-container ${r} ${i}`.trim(),C=N()
|
|
30
|
-
return g(
|
|
31
|
-
/* @__PURE__ */p("div",{className:("aark-modal-overlay "+c).trim(),onClick:f,"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?/* @__PURE__ */h("div",{className:b,role:"dialog","aria-modal":"true",onClick:o=>o.stopPropagation(),children:[l&&/* @__PURE__ */p("button",{onClick:k,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:/* @__PURE__ */p(v,{name:"close",size:12})}),
|
|
32
|
-
/* @__PURE__ */p("div",{className:"aark-modal-wrapper",children:/* @__PURE__ */p(x,{props:n,onClose:a})})]}):e?/* @__PURE__ */h("div",{className:b,role:"dialog","aria-modal":"true",onClick:o=>o.stopPropagation(),children:[l&&/* @__PURE__ */p("button",{onClick:k,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:/* @__PURE__ */p(v,{name:"close",size:12})}),
|
|
33
|
-
/* @__PURE__ */p("div",{className:"aark-modal-body",children:e})]}):null}),C)},T={success:"✓",error:"✕",warning:"⚠",info:"ⓘ",question:"?"},z={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},I=({props:o,onClose:a})=>{const{title:e,text:n,type:t="info",icon:r,html:l,timer:i=5e3,showCloseButton:c=!0,clickToClose:s=!0,width:m="300px",fullWidth:f=!1,padding:k="1rem",background:g="#ffffff",customClass:b={}}=o
|
|
34
|
-
d(()=>{if(i&&i>0){const o=setTimeout(a,i)
|
|
35
|
-
return()=>clearTimeout(o)}},[i,a])
|
|
36
|
-
const v=u(()=>r?"string"==typeof r?/* @__PURE__ */p("span",{children:r}):r:/* @__PURE__ */p("span",{style:{color:z[t]},children:T[t]}),[r,t]),C=u(()=>{const o={padding:k,background:g,borderRadius:"8px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",border:"1px solid "+z[t],cursor:s?"pointer":"default",position:"relative",overflow:"hidden"}
|
|
37
|
-
return f?(o.width="calc(100vw - 40px)",o.maxWidth="calc(100vw - 40px)"):o.width="number"==typeof m?m+"px":m,o},[m,f,k,g,t,s]);/* @__PURE__ */
|
|
38
|
-
return h("div",{className:"aark-standard-notification "+(b.popup||""),style:C,onClick:()=>{s&&a()},children:[i&&i>0&&/* @__PURE__ */p("div",{style:{position:"absolute",bottom:0,left:0,height:"3px",background:z[t],animation:`aark-notification-progress ${i}ms linear forwards`,transformOrigin:"left"}}),
|
|
39
|
-
/* @__PURE__ */h("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[v&&/* @__PURE__ */p("div",{className:"aark-notification-icon "+(b.icon||""),style:{fontSize:"1.25rem",flexShrink:0,marginTop:"0.125rem"},children:v}),
|
|
40
|
-
/* @__PURE__ */h("div",{style:{flex:1,minWidth:0},children:[e&&/* @__PURE__ */p("div",{className:"aark-notification-header "+(b.header||""),children:/* @__PURE__ */p("h4",{className:"aark-notification-title "+(b.title||""),style:{margin:0,fontSize:"0.875rem",fontWeight:"600",color:"#1f2937"},children:e})}),
|
|
41
|
-
/* @__PURE__ */p("div",{className:"aark-notification-content "+(b.content||""),style:{marginTop:e?"0.25rem":0},children:l?/* @__PURE__ */p("div",{dangerouslySetInnerHTML:{o:"string"==typeof l?l:""}}):n?/* @__PURE__ */p("p",{style:{margin:0,fontSize:"0.75rem",color:"#6b7280",lineHeight:"1.4"},children:n}):null})]}),c&&/* @__PURE__ */p("button",{onClick:o=>{o.stopPropagation(),a()},className:"aark-notification-close "+(b.closeButton||""),style:{background:"none",border:"none",fontSize:"1rem",color:"#9ca3af",cursor:"pointer",padding:0,lineHeight:1,flexShrink:0},"aria-label":"Close notification",children:"×"})]}),
|
|
42
|
-
/* @__PURE__ */p("style",{children:"\n @keyframes aark-notification-progress {\n from {\n transform: scaleX(1);\n }\n to {\n transform: scaleX(0);\n }\n }\n "})]})},S=({config:o,onClose:a})=>{const{content:e,props:n,options:t={}}=o,{position:r="top-right",showCloseIcon:l=!0,autoCloseTime:i=5e3,className:c="",preventEscClose:m=!1}=t
|
|
43
|
-
d(()=>{if(i&&!n){const o=setTimeout(a,i)
|
|
44
|
-
return()=>clearTimeout(o)}},[i,a,n]),d(()=>{const o=o=>{"Escape"!==o.key||m||a()}
|
|
45
|
-
if(!m)return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,m])
|
|
46
|
-
const u=s(o=>{o.stopPropagation(),a()},[a]),f=`aark-notification-container ${r} ${c}`.trim(),k=N()
|
|
47
|
-
return g(
|
|
48
|
-
/* @__PURE__ */p("div",{style:(()=>{const o={position:"fixed",zIndex:1e4,margin:"1rem"}
|
|
49
|
-
switch(r){case"top-left":return{...o,top:0,left:0}
|
|
50
|
-
case"top-center":return{...o,top:0,left:"50%",transform:"translateX(-50%)"}
|
|
51
|
-
case"top-right":default:return{...o,top:0,right:0}
|
|
52
|
-
case"bottom-left":return{...o,bottom:0,left:0}
|
|
53
|
-
case"bottom-center":return{...o,bottom:0,left:"50%",transform:"translateX(-50%)"}
|
|
54
|
-
case"bottom-right":return{...o,bottom:0,right:0}}})(),children:n?/* @__PURE__ */p("div",{className:"aark-notification-wrapper",children:/* @__PURE__ */p(I,{props:n,onClose:a})}):e?/* @__PURE__ */h("div",{className:f,role:"alert","aria-live":"polite","aria-labelledby":"aark-notification-content",children:[l&&/* @__PURE__ */p("button",{onClick:u,className:"aark-notification-close","aria-label":"Close notification",type:"button",children:"×"}),
|
|
55
|
-
/* @__PURE__ */p("div",{id:"aark-notification-body",className:"aark-notification-body",children:e})]}):null}),k)},M=()=>{const{isOpen:a,config:e,close:n}=o()
|
|
56
|
-
return a&&e?"modal"===e.mode?/* @__PURE__ */p(B,{config:e,onClose:n}):"notification"===e.mode?/* @__PURE__ */p(S,{config:e,onClose:n}):null:null},O=/* @__PURE__ */new Set
|
|
57
|
-
let $=null,L=null
|
|
58
|
-
const E={subscribe:function(o){return O.add(o),()=>O.delete(o)},fire:function(o,a){n(o,a)},fireModal:n,fireNotification:function(o,n){let t,r
|
|
59
|
-
a(),!o||"object"!=typeof o||"$$typeof"in o||Array.isArray(o)?(t=o,r=void 0):(r=o,t=void 0)
|
|
60
|
-
const l={content:t,props:r,mode:"notification",options:Object.assign({position:"top-right",showCloseIcon:!0,autoCloseTime:5e3,preventEscClose:!1},n)}
|
|
61
|
-
$=l,e("open",l)},close:t,isOpen:function(){return null!==$},getCurrentConfig:function(){return $},closeAll:function(){t()},cleanup:function(){L&&(L.unmount(),L=null),w&&0===w.children.length&&(w.remove(),w=null)}},H={fire:(o,a)=>E.fire(o,a),modal:(o,a)=>E.fireModal(o,a),notification:(o,a)=>E.fireNotification(o,a),close:()=>E.close(),isOpen:()=>E.isOpen(),closeAll:()=>E.closeAll(),setTheme:o=>r(o),resetTheme:()=>l(),getTheme:()=>i()}
|
|
62
|
-
export{B as Modal,M as ModalProvider,S as Notification,H as aark,i as getAarkModalTheme,l as resetAarkModalTheme,r as setAarkModalTheme,o as useModal}
|
|
1
|
+
import{createElement as Ro}from"react";import{createRoot as To}from"react-dom/client";import{useEffect as fo,useState as q,useCallback as mo}from"react";function A(){let[e,o]=q(!1),[t,a]=q(null),i=mo(()=>{k.close()},[]);return fo(()=>{let n=s=>{switch(s.type){case"open":o(!0),a(s.config||null);break;case"close":o(!1),a(null);break;case"beforeClose":break}},u=k.subscribe(n);return o(k.isOpen()),a(k.getCurrentConfig()),u},[]),{isOpen:e,config:t,close:i}}import{useEffect as yo,useCallback as Q,useMemo as vo}from"react";import{createPortal as ko}from"react-dom";import{memo as po,useMemo as R}from"react";import{jsx as F}from"react/jsx-runtime";var V={white:"#FFFFFF",black:"#0B071A"},j=po(({name:e,color:o="black",style:t,className:a="",noHoverEffect:i=!1,onClick:n,size:u=24,"aria-label":s,title:h})=>{let f=R(()=>String(u),[u]),m=R(()=>V[o]?V[o]:(o.startsWith("#"),o),[o]),g=R(()=>{let d=m;return e==="close"?F("svg",{xmlns:"http://www.w3.org/2000/svg",width:f,height:f,viewBox:"0 0 16 16",fill:"none",children:F("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},[e,m,f]),c=R(()=>{let d={};return s?d["aria-label"]=s:d["aria-label"]=`${e} icon`,h&&(d.title=h),d.role=n?"button":"img",d},[s,h,e,n]),p=R(()=>{if(n)return d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),n())}},[n]);return F("i",{className:`
|
|
2
|
+
inline-flex items-center justify-center bg-transparent outline-none border-none
|
|
3
|
+
${!i&&n&&"hover:opacity-80 cursor-pointer transition-opacity duration-200"}
|
|
4
|
+
${n&&"focus:outline-2 focus:outline-blue-500 focus:outline-offset-2"}
|
|
5
|
+
${a}
|
|
6
|
+
`.trim(),style:t,onClick:n,onKeyDown:p,tabIndex:n?0:void 0,...c,children:g})});j.displayName="Icon";var O=j;import{useMemo as U}from"react";import{jsx as M,jsxs as Y}from"react/jsx-runtime";var uo={success:"\u2713",error:"\u2715",warning:"\u26A0",info:"\u24D8",question:"?"},X={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},go=({props:e,onClose:o})=>{let{title:t,text:a,type:i="info",cancelText:n="Cancel",confirmText:u="OK",onCancel:s,onConfirm:h,icon:f,html:m,showCancelButton:g=!1,showConfirmButton:c=!0,reverseButtons:p=!1,width:d="auto",fullWidth:r=!1,customClass:y={}}=e,v=()=>{s?.(),o()},$=()=>{h?.(),o()},B=U(()=>f?typeof f=="string"?M("span",{children:f}):f:M("span",{style:{color:X[i]},children:uo[i]}),[f,i]),l=p?["confirm","cancel"]:["cancel","confirm"],w=U(()=>{let x={};return r?(x.width="calc(100vw - 20px)",x.maxWidth="calc(100vw - 20px)"):typeof d=="number"?x.width=`${d}px`:x.width=d,x},[d,r]);return Y("div",{className:`aark-standard-modal ${y.popup||""}`,style:w,children:[Y("div",{className:`aark-modal-content ${y.content||""}`,children:[B&&M("div",{className:`aark-modal-icon ${y.icon||""}`,children:B}),t&&M("div",{className:`aark-modal-header ${y.header||""}`,children:M("h2",{className:`aark-modal-title ${y.title||""}`,children:t})}),m?M("div",{dangerouslySetInnerHTML:{__html:typeof m=="string"?m:""}}):a?M("p",{children:a}):null]}),(g||c)&&M("div",{className:`aark-modal-footer ${y.actions||""}`,children:l.map(x=>x==="cancel"&&g?M("button",{onClick:v,className:`aark-modal-cancel-button ${y.cancelButton||""}`,children:n},"cancel"):x==="confirm"&&c?M("button",{onClick:$,className:`aark-modal-confirm-button ${y.confirmButton||""}`,style:{background:X[i]},children:u},"confirm"):null)})]})},G=go;var C=null,S=()=>(C||(C=document.getElementById("aark-react-modalify-root"),C||(C=document.createElement("div"),C.id="aark-react-modalify-root",C.style.cssText=`
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
z-index: 9998;
|
|
14
|
+
`,document.body.appendChild(C))),C),J=()=>{C&&C.children.length===0&&(C.remove(),C=null)};import{jsx as N,jsxs as oo}from"react/jsx-runtime";var Co={sm:"400px",md:"550px",lg:"700px",xl:"900px",full:"calc(100vw - 32px)"},ho=({config:e,onClose:o})=>{let{content:t,props:a,options:i={}}=e,{position:n="center",showCloseIcon:u=!0,className:s="",overlayClassName:h="",preventEscClose:f=!1,preventOverlayClose:m=!1,width:g,maxWidth:c,size:p}=i;yo(()=>{if(f)return;let l=w=>{w.key==="Escape"&&o()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[o,f]);let d=Q(l=>{l.target===l.currentTarget&&!m&&o()},[o,m]),r=Q(l=>{l.stopPropagation(),o()},[o]),y=vo(()=>{let l={};if(g!==void 0&&(l.width=typeof g=="number"?`${g}px`:g,c===void 0&&(l.maxWidth=l.width)),c!==void 0)l.maxWidth=typeof c=="number"?`${c}px`:c;else if(p){let w=Co[p];p==="full"&&(l.width=l.width??w),l.maxWidth=w}return l},[g,c,p]),v=`aark-modal-container ${n} ${s}`.trim(),$=S(),B=()=>a?oo("div",{className:v,style:y,role:"dialog","aria-modal":"true",onClick:l=>l.stopPropagation(),children:[u&&N("button",{onClick:r,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:N(O,{name:"close",size:12})}),N("div",{className:"aark-modal-wrapper",children:N(G,{props:a,onClose:o})})]}):t?N("div",{className:v,style:y,role:"dialog","aria-modal":"true",onClick:l=>l.stopPropagation(),children:oo("div",{className:"aark-modal-body",children:[u&&N("button",{onClick:r,className:"aark-modal-close","aria-label":"Close Modal",type:"button",children:N(O,{name:"close",size:12})}),t]})}):null;return ko(N("div",{className:`aark-modal-overlay ${h}`.trim(),onClick:d,"aria-hidden":"true",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:n.includes("center")?"center":n.includes("top")?"flex-start":"flex-end",justifyContent:n.includes("center")?"center":n.includes("right")?"flex-end":"flex-start",padding:"1rem",overflowY:"auto",boxSizing:"border-box"},children:B()}),$)},z=ho;import{useEffect as no,useCallback as No}from"react";import{createPortal as wo}from"react-dom";import{useMemo as eo,useEffect as Mo}from"react";import{jsx as b,jsxs as L}from"react/jsx-runtime";var to={success:"#4ade80",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6",question:"#8b5cf6"},bo={success:"\u2713",error:"\u2715",warning:"\u26A0",info:"\u24D8",question:"?"},xo=({props:e,onClose:o})=>{let{title:t,text:a,type:i="info",icon:n,html:u,timer:s=5e3,showCloseButton:h=!0,clickToClose:f=!0,width:m,fullWidth:g=!1,padding:c,customClass:p={}}=e;Mo(()=>{if(s&&s>0){let v=setTimeout(o,s);return()=>clearTimeout(v)}},[s,o]);let d=()=>{f&&o()},r=eo(()=>n?typeof n=="string"?b("span",{children:n}):n:b("span",{style:{color:to[i]},children:bo[i]}),[n,i]),y=eo(()=>{let v={};return c!==void 0&&(v.padding=typeof c=="number"?`${c}px`:c),g?(v.width="calc(100vw - 40px)",v.maxWidth="calc(100vw - 40px)"):m!==void 0&&(v.width=typeof m=="number"?`${m}px`:m),v},[m,g,c]);return L("div",{className:`aark-standard-notification aark-notification-${i} ${p.popup||""}`,style:y,onClick:d,children:[s&&s>0&&b("div",{className:"aark-notification-progress",style:{background:to[i],animation:`aark-notification-progress ${s}ms linear forwards`}}),L("div",{style:{display:"flex",alignItems:"flex-start",gap:"0.75rem"},children:[r&&b("div",{className:`aark-notification-icon ${p.icon||""}`,children:r}),L("div",{style:{flex:1,minWidth:0},children:[t&&b("div",{className:`aark-notification-header ${p.header||""}`,children:b("h4",{className:`aark-notification-title ${p.title||""}`,children:t})}),b("div",{className:`aark-notification-content ${p.content||""}`,style:{marginTop:t?"0.25rem":0},children:u?b("div",{dangerouslySetInnerHTML:{__html:typeof u=="string"?u:""}}):a?b("p",{children:a}):null})]}),h&&b("button",{onClick:v=>{v.stopPropagation(),o()},className:`aark-notification-close ${p.closeButton||""}`,"aria-label":"Close notification",type:"button",children:"\xD7"})]})]})},ao=xo;import{jsx as T,jsxs as So}from"react/jsx-runtime";var Po=({config:e,onClose:o})=>{let{content:t,props:a,options:i={}}=e,{position:n="top-right",showCloseIcon:u=!0,autoCloseTime:s=5e3,className:h="",preventEscClose:f=!1}=i;no(()=>{if(s&&!a){let r=setTimeout(o,s);return()=>clearTimeout(r)}},[s,o,a]),no(()=>{if(f)return;let r=y=>{y.key==="Escape"&&o()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,f]);let m=No(r=>{r.stopPropagation(),o()},[o]),g=`aark-notification-container ${n} ${h}`.trim(),c=S(),p=()=>{let r={position:"fixed",zIndex:1e4,margin:"1rem"};switch(n){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?T("div",{className:"aark-notification-wrapper",children:T(ao,{props:a,onClose:o})}):t?So("div",{className:g,role:"alert","aria-live":"polite",children:[u&&T("button",{onClick:m,className:"aark-notification-close","aria-label":"Close notification",type:"button",children:"\xD7"}),T("div",{className:"aark-notification-body",children:t})]}):null;return wo(T("div",{style:p(),children:d()}),c)},W=Po;import{jsx as io}from"react/jsx-runtime";var Eo=()=>{let{isOpen:e,config:o,close:t}=A();return!e||!o?null:o.mode==="modal"?io(z,{config:o,onClose:t}):o.mode==="notification"?io(W,{config:o,onClose:t}):null},H=Eo;var K=new Set,P=null,E=null;function ro(){if(E)return;let e=S();E=To(e),E.render(Ro(H))}function Bo(e){return K.add(e),()=>K.delete(e)}function I(e,o){let t={type:e,config:o};K.forEach(a=>a(t))}function lo(e,o){ro();let t,a;e&&typeof e=="object"&&!("$$typeof"in e)&&!Array.isArray(e)?(a=e,t=void 0):(t=e,a=void 0);let i={content:t,props:a,mode:"modal",options:Object.assign({position:"center",showCloseIcon:!0,preventEscClose:!1,preventOverlayClose:!1},o)};P=i,I("open",i)}function Io(e,o){ro();let t,a;e&&typeof e=="object"&&!("$$typeof"in e)&&!Array.isArray(e)?(a=e,t=void 0):(t=e,a=void 0);let i={content:t,props:a,mode:"notification",options:Object.assign({position:"top-right",showCloseIcon:!0,autoCloseTime:5e3,preventEscClose:!1},o)};P=i,I("open",i)}function $o(e,o){lo(e,o)}function so(){P&&(I("beforeClose",P),P=null,I("close"))}function Ao(){return P!==null}function Fo(){return P}function Oo(){so()}function zo(){E&&(E.unmount(),E=null),J()}var k={subscribe:Bo,fire:$o,fireModal:lo,fireNotification:Io,close:so,isOpen:Ao,getCurrentConfig:Fo,closeAll:Oo,cleanup:zo};var co={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(e){let o=document.documentElement;Object.keys(e).forEach(t=>{let a=e[t],i=co[t];a!==void 0&&i&&o.style.setProperty(i,String(a))})}function Z(){let e=document.documentElement;Object.values(co).forEach(o=>{e.style.removeProperty(o)})}function _(){let e=document.documentElement,o=getComputedStyle(e),t=a=>o.getPropertyValue(a).trim()||void 0;return{overlayBackground:t("--aark-modal-overlay-bg"),overlayBlur:t("--aark-modal-overlay-blur"),modalBackground:t("--aark-modal-bg"),modalBorderRadius:t("--aark-modal-radius"),modalShadow:t("--aark-modal-shadow"),modalPadding:t("--aark-modal-pad"),modalMaxWidth:t("--aark-modal-max-width"),modalZIndex:parseInt(t("--aark-modal-z")??"0")||void 0,closeButtonColor:t("--aark-close-color"),closeButtonHoverBackground:t("--aark-close-hover"),closeButtonHoverColor:t("--aark-close-hover-color"),closeButtonFocusOutline:t("--aark-close-focus-outline"),animationDuration:t("--aark-anim"),notificationBackground:t("--aark-notification-bg"),notificationBorderRadius:t("--aark-notification-radius"),notificationShadow:t("--aark-notification-shadow"),notificationPadding:t("--aark-notification-pad"),notificationZIndex:parseInt(t("--aark-notification-z")??"0")||void 0}}var Lo={fire:(e,o)=>k.fire(e,o),modal:(e,o)=>k.fireModal(e,o),notification:(e,o)=>k.fireNotification(e,o),close:()=>k.close(),isOpen:()=>k.isOpen(),closeAll:()=>k.closeAll(),setTheme:e=>D(e),resetTheme:()=>Z(),getTheme:()=>_()},Wo=Lo;export{z as Modal,H as ModalProvider,W as Notification,Wo as aark,_ as getAarkModalTheme,Z as resetAarkModalTheme,D as setAarkModalTheme,A as useModal};
|
package/package.json
CHANGED
|
@@ -1,93 +1,87 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
"homepage": "https://github.com/sumonsbgc/aark-react-modalify#readme",
|
|
90
|
-
"bugs": {
|
|
91
|
-
"url": "https://github.com/sumonsbgc/aark-react-modalify/issues"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
2
|
+
"name": "aark-react-modalify",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "A lightweight, flexible React modal and notification library with TypeScript support. Features automatic DOM mounting, customizable styling via CSS variables, responsive size presets, and a simple imperative API.",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.esm.js",
|
|
13
|
+
"require": "./dist/index.cjs.js"
|
|
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"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"react",
|
|
30
|
+
"modal",
|
|
31
|
+
"notification",
|
|
32
|
+
"toast",
|
|
33
|
+
"popup",
|
|
34
|
+
"dialog",
|
|
35
|
+
"alert",
|
|
36
|
+
"confirm",
|
|
37
|
+
"typescript",
|
|
38
|
+
"imperative",
|
|
39
|
+
"lightweight",
|
|
40
|
+
"flexible",
|
|
41
|
+
"customizable",
|
|
42
|
+
"aark-react-modalify",
|
|
43
|
+
"aark-modal",
|
|
44
|
+
"aark-toast",
|
|
45
|
+
"aark-notification"
|
|
46
|
+
],
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": ">=16.8.0",
|
|
49
|
+
"react-dom": ">=16.8.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.39.1",
|
|
53
|
+
"@types/node": "^24.10.1",
|
|
54
|
+
"@types/react": "^19.2.6",
|
|
55
|
+
"@types/react-dom": "^19.2.3",
|
|
56
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
57
|
+
"eslint": "^9.39.1",
|
|
58
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
59
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
60
|
+
"globals": "^16.5.0",
|
|
61
|
+
"react": "^19.2.0",
|
|
62
|
+
"react-dom": "^19.2.0",
|
|
63
|
+
"rimraf": "^6.1.0",
|
|
64
|
+
"tsup": "^8.5.0",
|
|
65
|
+
"typescript": "~5.9.3",
|
|
66
|
+
"typescript-eslint": "^8.47.0",
|
|
67
|
+
"vite": "^7.2.2"
|
|
68
|
+
},
|
|
69
|
+
"license": "MIT",
|
|
70
|
+
"author": "Mohammad Sumon",
|
|
71
|
+
"repository": {
|
|
72
|
+
"type": "git",
|
|
73
|
+
"url": "git+https://github.com/sumonsbgc/aark-react-modalify.git"
|
|
74
|
+
},
|
|
75
|
+
"homepage": "https://github.com/sumonsbgc/aark-react-modalify#readme",
|
|
76
|
+
"bugs": {
|
|
77
|
+
"url": "https://github.com/sumonsbgc/aark-react-modalify/issues"
|
|
78
|
+
},
|
|
79
|
+
"scripts": {
|
|
80
|
+
"build": "tsup",
|
|
81
|
+
"dev": "bunx vite",
|
|
82
|
+
"typecheck": "tsc --noEmit",
|
|
83
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
84
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
85
|
+
"clean": "rimraf dist"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { FC, CSSProperties } from "react";
|
|
2
|
-
declare const colors: Record<string, string>;
|
|
3
|
-
export type IconName = "close";
|
|
4
|
-
export type IconSize = string | number;
|
|
5
|
-
export type IconColor = keyof typeof colors | string;
|
|
6
|
-
export interface IconProps {
|
|
7
|
-
name: IconName;
|
|
8
|
-
size?: IconSize;
|
|
9
|
-
color?: IconColor;
|
|
10
|
-
style?: CSSProperties;
|
|
11
|
-
className?: string;
|
|
12
|
-
noHoverEffect?: boolean;
|
|
13
|
-
onClick?: () => void;
|
|
14
|
-
"aria-label"?: string;
|
|
15
|
-
title?: string;
|
|
16
|
-
}
|
|
17
|
-
declare const Icon: FC<IconProps>;
|
|
18
|
-
export default Icon;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { NotificationConfig } from '../types';
|
|
3
|
-
import '../assets/styles/aark-modal.css';
|
|
4
|
-
interface NotificationProps {
|
|
5
|
-
config: NotificationConfig;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
}
|
|
8
|
-
declare const Notification: FC<NotificationProps>;
|
|
9
|
-
export default Notification;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as StandardModal } from "./StandardModal";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { NotificationProps } from '../../types';
|
|
3
|
-
interface StandardNotificationProps {
|
|
4
|
-
props: NotificationProps;
|
|
5
|
-
onClose: () => void;
|
|
6
|
-
}
|
|
7
|
-
declare const StandardNotification: FC<StandardNotificationProps>;
|
|
8
|
-
export default StandardNotification;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as StandardNotification } from "./StandardNotification";
|
package/dist/hooks/useModal.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig } from "../types";
|
|
2
|
-
export interface UseModalReturn {
|
|
3
|
-
isOpen: boolean;
|
|
4
|
-
config: ComponentConfig | null;
|
|
5
|
-
close: () => void;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Hook to manage modal state and listen to modal events
|
|
9
|
-
*/
|
|
10
|
-
export declare function useModal(): UseModalReturn;
|