aark-react-modalify 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ # AARK React Modalify 🚀
2
+
3
+ A lightweight, customizable, and easy-to-use modal library for React applications with TypeScript support and full CSS customization.
4
+
5
+ ## ✨ Features
6
+
7
+ - **Zero Dependencies**: Pure React implementation
8
+ - **TypeScript Support**: Full type safety out of the box
9
+ - **Class-based Architecture**: Clean, singleton-based API
10
+ - **Fully Customizable**: CSS variables for complete theme control
11
+ - **Portal Rendering**: Modals render outside your component tree
12
+ - **Accessibility**: Built-in keyboard navigation and focus management
13
+ - **Multiple Positions**: Center, top, bottom, left, right positioning
14
+ - **Animation Support**: Smooth fade and slide animations
15
+ - **Hook Integration**: useModal hook for advanced use cases
16
+ - **No Provider Required**: Just import and use anywhere
17
+
18
+ ## 📦 Installation
19
+
20
+ ```bash
21
+ npm install aark-react-modalify
22
+ ```
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ ```jsx
27
+ import { aark } from "aark-react-modalify";
28
+
29
+ function App() {
30
+ const openModal = () => {
31
+ aark.fire(
32
+ <div>
33
+ <h2>Hello World!</h2>
34
+ <p>This is a simple modal.</p>
35
+ <button onClick={() => aark.close()}>Close</button>
36
+ </div>,
37
+ {
38
+ mode: "modal",
39
+ position: "center",
40
+ showCloseIcon: true,
41
+ }
42
+ );
43
+ };
44
+
45
+ return (
46
+ <div>
47
+ <button onClick={openModal}>Open Modal</button>
48
+ </div>
49
+ );
50
+ }
51
+ ```
52
+
53
+ ## 🎨 Theme Customization
54
+
55
+ AARK React Modalify supports full theme customization through CSS variables:
56
+
57
+ ```jsx
58
+ import { aark } from "aark-react-modalify";
59
+
60
+ // Set custom theme
61
+ aark.setTheme({
62
+ modalBackground: "#1a1a1a",
63
+ overlayBackground: "rgba(0, 0, 0, 0.8)",
64
+ closeButtonColor: "#ffffff",
65
+ closeButtonHoverBackground: "rgba(255, 255, 255, 0.1)",
66
+ modalBorderRadius: "12px",
67
+ animationDuration: "0.3s",
68
+ });
69
+
70
+ // Fire modal with custom theme
71
+ aark.fire(<div>Themed Modal</div>);
72
+
73
+ // Reset to default theme
74
+ aark.resetTheme();
75
+
76
+ // Get current theme
77
+ const currentTheme = aark.getTheme();
78
+ ```
79
+
80
+ ## 📚 API Reference
81
+
82
+ ### `aark.fire(component, options)`
83
+
84
+ Display a modal with the given component and options.
85
+
86
+ **Parameters:**
87
+
88
+ - `component` (ReactNode): The React component or element to render
89
+ - `options` (ModalOptions): Configuration options
90
+
91
+ **Returns:** `void`
92
+
93
+ ### `aark.close()`
94
+
95
+ Close the currently open modal.
96
+
97
+ ### `aark.isOpen()`
98
+
99
+ Check if a modal is currently open.
100
+
101
+ **Returns:** `boolean`
102
+
103
+ ### `aark.closeAll()`
104
+
105
+ Close all open modals.
106
+
107
+ ### `aark.setTheme(theme)`
108
+
109
+ Set custom theme for AARK modals.
110
+
111
+ **Parameters:**
112
+
113
+ - `theme` (AarkModalTheme): Theme configuration object
114
+
115
+ ### `aark.resetTheme()`
116
+
117
+ Reset theme to default values.
118
+
119
+ ### `aark.getTheme()`
120
+
121
+ Get current theme values.
122
+
123
+ **Returns:** `AarkModalTheme`
124
+
125
+ ## ⚙️ Modal Options
126
+
127
+ ```typescript
128
+ interface ModalOptions {
129
+ mode?: "modal" | "drawer" | "popup";
130
+ position?: "center" | "top" | "bottom" | "left" | "right";
131
+ showCloseIcon?: boolean;
132
+ closeOnOverlayClick?: boolean;
133
+ closeOnEscapeKey?: boolean;
134
+ customClass?: string;
135
+ }
136
+ ```
137
+
138
+ ## 🎨 Theme Properties
139
+
140
+ ```typescript
141
+ interface AarkModalTheme {
142
+ // Overlay
143
+ overlayBackground?: string;
144
+ overlayBlur?: string;
145
+
146
+ // Modal
147
+ modalBackground?: string;
148
+ modalBorderRadius?: string;
149
+ modalShadow?: string;
150
+ modalPadding?: string;
151
+ modalZIndex?: number;
152
+ modalContentZIndex?: number;
153
+
154
+ // Close button
155
+ closeButtonColor?: string;
156
+ closeButtonHoverBackground?: string;
157
+ closeButtonHoverColor?: string;
158
+ closeButtonFocusOutline?: string;
159
+
160
+ // Animation
161
+ animationDuration?: string;
162
+ fadeDuration?: string;
163
+
164
+ // Custom styles
165
+ customOverlayBackground?: string;
166
+ customOverlayBlur?: string;
167
+ customModalGradientStart?: string;
168
+ customModalGradientEnd?: string;
169
+ customModalTextColor?: string;
170
+ customModalShadow?: string;
171
+ customModalCloseColor?: string;
172
+ customModalCloseHoverBackground?: string;
173
+ customModalCloseHoverColor?: string;
174
+ }
175
+ ```
176
+
177
+ ## 🔗 React Hook Integration
178
+
179
+ For advanced use cases, you can use the `useModal` hook:
180
+
181
+ ```jsx
182
+ import { useModal } from "aark-react-modalify";
183
+
184
+ function MyComponent() {
185
+ const { modals, close } = useModal();
186
+
187
+ return (
188
+ <div>
189
+ {modals.length > 0 && <p>Currently {modals.length} modal(s) open</p>}
190
+ </div>
191
+ );
192
+ }
193
+ ```
194
+
195
+ ## 🛠️ Development
196
+
197
+ ```bash
198
+ # Install dependencies
199
+ npm install
200
+
201
+ # Start development server
202
+ npm run dev
203
+
204
+ # Build for production
205
+ npm run build
206
+
207
+ # Type checking
208
+ npm run type-check
209
+
210
+ # Linting
211
+ npm run lint
212
+ ```
213
+
214
+ ## 📄 License
215
+
216
+ MIT License - see the [LICENSE](LICENSE) file for details.
217
+
218
+ ## 🤝 Contributing
219
+
220
+ Contributions are welcome! Please feel free to submit a Pull Request.
221
+
222
+ ## 📞 Support
223
+
224
+ If you have any questions or need help, please open an issue on GitHub.
@@ -0,0 +1,9 @@
1
+ import { u as s, j as n, M as t } from "./index-DIT0k89J.js";
2
+ import "react";
3
+ const i = () => {
4
+ const { isOpen: e, config: o, close: r } = s();
5
+ return !e || !o ? null : /* @__PURE__ */ n.jsx(t, { config: o, onClose: r });
6
+ };
7
+ export {
8
+ i as default
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CvIFkjib.cjs");require("react");const t=()=>{const{isOpen:o,config:r,close:n}=e.useModal();return!o||!r?null:e.jsxRuntimeExports.jsx(e.ModalRenderer,{config:r,onClose:n})};exports.default=t;
@@ -0,0 +1 @@
1
+ :root{--aark-modal-overlay-bg: rgba(0, 0, 0, .5);--aark-modal-overlay-blur: 2px;--aark-modal-bg: #ffffff;--aark-modal-border-radius: 8px;--aark-modal-shadow: 0 10px 25px rgba(0, 0, 0, .15);--aark-modal-padding: 16px;--aark-modal-z-index: 9999;--aark-modal-content-z-index: 10000;--aark-modal-close-color: #666666;--aark-modal-close-hover-bg: #f5f5f5;--aark-modal-close-hover-color: #333333;--aark-modal-close-focus-outline: #007bff;--aark-modal-animation-duration: .2s;--aark-modal-fade-duration: .15s;--aark-custom-overlay-bg: rgba(0, 0, 0, .8);--aark-custom-overlay-blur: 5px;--aark-custom-modal-gradient-start: #667eea;--aark-custom-modal-gradient-end: #764ba2;--aark-custom-modal-text-color: #ffffff;--aark-custom-modal-shadow: 0 20px 40px rgba(0, 0, 0, .3);--aark-custom-modal-close-color: rgba(255, 255, 255, .8);--aark-custom-modal-close-hover-bg: rgba(255, 255, 255, .2);--aark-custom-modal-close-hover-color: #ffffff}.aark-modal-container{position:fixed;inset:0;z-index:var(--aark-modal-z-index)}.aark-modal-container.notification{pointer-events:none}.aark-modal-overlay{position:absolute;inset:0;background-color:var(--aark-modal-overlay-bg);-webkit-backdrop-filter:blur(var(--aark-modal-overlay-blur));backdrop-filter:blur(var(--aark-modal-overlay-blur))}.custom-overlay{background-color:var(--aark-custom-overlay-bg)!important;-webkit-backdrop-filter:blur(var(--aark-custom-overlay-blur))!important;backdrop-filter:blur(var(--aark-custom-overlay-blur))!important}.aark-modal-content{position:fixed;background-color:var(--aark-modal-bg);border-radius:var(--aark-modal-border-radius);box-shadow:var(--aark-modal-shadow);padding:var(--aark-modal-padding);z-index:var(--aark-modal-content-z-index);max-width:90vw;max-height:90vh;overflow:auto}.aark-modal-content.notification{pointer-events:auto}.aark-modal-content.custom-modal{background:linear-gradient(135deg,var(--aark-custom-modal-gradient-start) 0%,var(--aark-custom-modal-gradient-end) 100%)!important;color:var(--aark-custom-modal-text-color)!important;border:none!important;box-shadow:var(--aark-custom-modal-shadow)!important}.aark-modal-content.center{top:50%;left:50%;transform:translate(-50%,-50%)}.aark-modal-content.top-center{top:20px;left:50%;transform:translate(-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:translate(-50%)}.aark-modal-close{position:absolute;top:8px;right:8px;width:24px;height:24px;display:flex;align-items:center;justify-content:center;background:none;border:none;color:var(--aark-modal-close-color);cursor:pointer;border-radius:50%;font-size:14px;line-height:1;transition:all var(--aark-modal-animation-duration) ease}.aark-modal-close:hover{background-color:var(--aark-modal-close-hover-bg);color:var(--aark-modal-close-hover-color)}.aark-modal-close:focus{outline:2px solid var(--aark-modal-close-focus-outline);outline-offset:2px}.aark-modal-content.custom-modal .aark-modal-close{color:var(--aark-custom-modal-close-color)}.aark-modal-content.custom-modal .aark-modal-close:hover{background-color:var(--aark-custom-modal-close-hover-bg);color:var(--aark-custom-modal-close-hover-color)}.aark-modal-body{padding-top:8px}.aark-modal-container{animation:aark-modal-fade-in var(--aark-modal-fade-duration) ease-out}.aark-modal-content{animation:aark-modal-slide-in var(--aark-modal-animation-duration) ease-out}@keyframes aark-modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes aark-modal-slide-in{0%{opacity:0;transform:translate(-50%,-50%) scale(.95)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}.aark-modal-content.top-center{animation:aark-modal-slide-down var(--aark-modal-animation-duration) ease-out}.aark-modal-content.top-right,.aark-modal-content.bottom-right{animation:aark-modal-slide-left var(--aark-modal-animation-duration) ease-out}.aark-modal-content.bottom-center{animation:aark-modal-slide-up var(--aark-modal-animation-duration) ease-out}@keyframes aark-modal-slide-down{0%{opacity:0;transform:translate(-50%) translateY(-10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}@keyframes aark-modal-slide-left{0%{opacity:0;transform:translate(10px)}to{opacity:1;transform:translate(0)}}@keyframes aark-modal-slide-up{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-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:translate(-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}}