@shohojdhara/atomix 0.4.9 → 0.5.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.
@@ -0,0 +1,402 @@
1
+ /**
2
+ * ModalExamples.stories.tsx
3
+ *
4
+ * Modal, dialog, and overlay examples for AtomixGlass.
5
+ * Perfect for notifications, confirmations, and interactive dialogs.
6
+ *
7
+ * @package Atomix
8
+ * @component AtomixGlass
9
+ */
10
+ import React from 'react';
11
+ import { useState } from 'react';
12
+ import { Meta, StoryObj } from '@storybook/react';
13
+ import AtomixGlass from '../AtomixGlass';
14
+ import { BackgroundWrapper, backgroundImages, StoryErrorBoundary } from './shared-components';
15
+ import { baseArgTypes } from './argTypes';
16
+
17
+ import { Button } from '../../Button';
18
+ import { Badge } from '../../Badge';
19
+ import { Icon } from '../../Icon/Icon';
20
+
21
+ const meta: Meta<typeof AtomixGlass> = {
22
+ title: 'Components/AtomixGlass/Examples/Modal Examples',
23
+ component: AtomixGlass,
24
+ parameters: {
25
+ layout: 'fullscreen',
26
+ docs: {
27
+ description: {
28
+ component:
29
+ 'Modal and dialog examples demonstrating AtomixGlass for overlays, notifications, and interactive dialogs.',
30
+ },
31
+ },
32
+ },
33
+ tags: ['!autodocs'],
34
+ argTypes: {
35
+ ...baseArgTypes,
36
+ children: { control: false },
37
+ },
38
+ };
39
+
40
+ export default meta;
41
+ type Story = StoryObj<typeof AtomixGlass>;
42
+
43
+ /**
44
+ * Confirmation Dialog
45
+ *
46
+ * Modal dialog for confirming important actions like deletions.
47
+ */
48
+ export const ConfirmationDialog: Story = {
49
+ render: () => {
50
+ const [isOpen, setIsOpen] = useState(true);
51
+
52
+ if (!isOpen) {
53
+ return (
54
+ <StoryErrorBoundary>
55
+ <BackgroundWrapper backgroundImage={backgroundImages[0]} overlay overlayOpacity={0.5}>
56
+ <div className="u-text-center u-text-white">
57
+ <Button variant="primary" size="lg" onClick={() => setIsOpen(true)}>
58
+ Open Confirmation Dialog
59
+ </Button>
60
+ </div>
61
+ </BackgroundWrapper>
62
+ </StoryErrorBoundary>
63
+ );
64
+ }
65
+
66
+ return (
67
+ <StoryErrorBoundary>
68
+ <BackgroundWrapper backgroundImage={backgroundImages[0]} overlay overlayOpacity={0.5}>
69
+ <div
70
+ style={{
71
+ display: 'flex',
72
+ alignItems: 'center',
73
+ justifyContent: 'center',
74
+ minHeight: '100vh',
75
+ padding: '20px',
76
+ }}
77
+ >
78
+ <AtomixGlass
79
+ displacementScale={70}
80
+ blurAmount={1}
81
+ saturation={140}
82
+ borderRadius={24}
83
+ mode="standard"
84
+ style={{ maxWidth: '440px', width: '100%' }}
85
+ padding="40px"
86
+ >
87
+ <div className="u-text-center u-text-white">
88
+ <div
89
+ style={{
90
+ width: '80px',
91
+ height: '80px',
92
+ borderRadius: '50%',
93
+ background: 'rgba(239, 68, 68, 0.2)',
94
+ display: 'flex',
95
+ alignItems: 'center',
96
+ justifyContent: 'center',
97
+ fontSize: '40px',
98
+ margin: '0 auto 24px',
99
+ }}
100
+ aria-hidden="true"
101
+ >
102
+ ⚠️
103
+ </div>
104
+
105
+ <h2 className="u-mt-0 u-text-2xl u-font-bold u-mb-2">
106
+ Delete Account?
107
+ </h2>
108
+ <p className="u-text-sm u-opacity-90 u-mb-5" style={{ lineHeight: 1.6 }}>
109
+ Are you sure you want to delete your account? This action cannot be undone
110
+ and all your data will be permanently removed.
111
+ </p>
112
+
113
+ <div className="u-flex u-gap-3 u-justify-center" style={{ gap: '12px' }}>
114
+ <Button
115
+ variant="outline-light"
116
+ glass={{ elasticity: 0 }}
117
+ onClick={() => setIsOpen(false)}
118
+ >
119
+ Cancel
120
+ </Button>
121
+ <Button
122
+ variant="danger"
123
+ glass={{ elasticity: 0 }}
124
+ onClick={() => {
125
+ setIsOpen(false);
126
+ alert('Account deleted');
127
+ }}
128
+ >
129
+ Delete Account
130
+ </Button>
131
+ </div>
132
+ </div>
133
+ </AtomixGlass>
134
+ </div>
135
+ </BackgroundWrapper>
136
+ </StoryErrorBoundary>
137
+ );
138
+ },
139
+ parameters: {
140
+ docs: {
141
+ description: {
142
+ story:
143
+ 'Confirmation dialog modal for critical actions with cancel and confirm buttons.',
144
+ },
145
+ },
146
+ },
147
+ };
148
+
149
+ /**
150
+ * Success Notification
151
+ *
152
+ * Toast-style notification for success messages.
153
+ */
154
+ export const SuccessNotification: Story = {
155
+ render: () => {
156
+ const [isVisible, setIsVisible] = useState(true);
157
+
158
+ if (!isVisible) {
159
+ return (
160
+ <StoryErrorBoundary>
161
+ <BackgroundWrapper backgroundImage={backgroundImages[2]}>
162
+ <div className="u-text-center">
163
+ <Button variant="primary" size="lg" onClick={() => setIsVisible(true)}>
164
+ Show Success Notification
165
+ </Button>
166
+ </div>
167
+ </BackgroundWrapper>
168
+ </StoryErrorBoundary>
169
+ );
170
+ }
171
+
172
+ return (
173
+ <StoryErrorBoundary>
174
+ <BackgroundWrapper backgroundImage={backgroundImages[2]}>
175
+ <div
176
+ style={{
177
+ position: 'fixed',
178
+ top: '24px',
179
+ right: '24px',
180
+ zIndex: 1000,
181
+ }}
182
+ >
183
+ <AtomixGlass
184
+ displacementScale={50}
185
+ blurAmount={0.5}
186
+ saturation={130}
187
+ borderRadius={16}
188
+ mode="standard"
189
+ style={{ minWidth: '320px' }}
190
+ padding="20px"
191
+ >
192
+ <div className="u-flex u-items-center u-gap-3 u-text-white">
193
+ <div
194
+ style={{
195
+ width: '40px',
196
+ height: '40px',
197
+ borderRadius: '50%',
198
+ background: 'rgba(34, 197, 94, 0.2)',
199
+ display: 'flex',
200
+ alignItems: 'center',
201
+ justifyContent: 'center',
202
+ fontSize: '20px',
203
+ flexShrink: 0,
204
+ }}
205
+ aria-hidden="true"
206
+ >
207
+
208
+ </div>
209
+
210
+ <div className="u-flex-1">
211
+ <p className="u-m-0 u-font-semibold u-text-sm">Payment Successful!</p>
212
+ <p className="u-m-0 u-text-xs u-opacity-80">
213
+ Your transaction has been completed.
214
+ </p>
215
+ </div>
216
+
217
+ <button
218
+ onClick={() => setIsVisible(false)}
219
+ style={{
220
+ background: 'transparent',
221
+ border: 'none',
222
+ color: 'rgba(255,255,255,0.6)',
223
+ cursor: 'pointer',
224
+ padding: '4px',
225
+ fontSize: '20px',
226
+ lineHeight: 1,
227
+ }}
228
+ aria-label="Close notification"
229
+ >
230
+ ×
231
+ </button>
232
+ </div>
233
+ </AtomixGlass>
234
+ </div>
235
+ </BackgroundWrapper>
236
+ </StoryErrorBoundary>
237
+ );
238
+ },
239
+ parameters: {
240
+ docs: {
241
+ description: {
242
+ story:
243
+ 'Success notification toast with auto-dismiss capability and close button.',
244
+ },
245
+ },
246
+ },
247
+ };
248
+
249
+ /**
250
+ * Settings Modal
251
+ *
252
+ * Modal dialog for displaying settings and preferences.
253
+ */
254
+ export const SettingsModal: Story = {
255
+ render: () => {
256
+ const [isOpen, setIsOpen] = useState(true);
257
+ const [notifications, setNotifications] = useState(true);
258
+ const [darkMode, setDarkMode] = useState(false);
259
+ const [autoSave, setAutoSave] = useState(true);
260
+
261
+ if (!isOpen) {
262
+ return (
263
+ <StoryErrorBoundary>
264
+ <BackgroundWrapper backgroundImage={backgroundImages[4]}>
265
+ <div className="u-text-center u-text-white">
266
+ <Button variant="primary" size="lg" onClick={() => setIsOpen(true)}>
267
+ Open Settings
268
+ </Button>
269
+ </div>
270
+ </BackgroundWrapper>
271
+ </StoryErrorBoundary>
272
+ );
273
+ }
274
+
275
+ return (
276
+ <StoryErrorBoundary>
277
+ <BackgroundWrapper backgroundImage={backgroundImages[4]} overlay overlayOpacity={0.5}>
278
+ <div
279
+ style={{
280
+ display: 'flex',
281
+ alignItems: 'center',
282
+ justifyContent: 'center',
283
+ minHeight: '100vh',
284
+ padding: '20px',
285
+ }}
286
+ >
287
+ <AtomixGlass
288
+ displacementScale={65}
289
+ blurAmount={0.75}
290
+ saturation={135}
291
+ borderRadius={24}
292
+ mode="standard"
293
+ style={{ maxWidth: '500px', width: '100%' }}
294
+ >
295
+ <div className="u-text-white" style={{ padding: '32px' }}>
296
+ <div className="u-flex u-items-center u-justify-between u-mb-4">
297
+ <h2 className="u-m-0 u-text-2xl u-font-bold">Settings</h2>
298
+ <button
299
+ onClick={() => setIsOpen(false)}
300
+ style={{
301
+ background: 'transparent',
302
+ border: 'none',
303
+ color: 'rgba(255,255,255,0.6)',
304
+ cursor: 'pointer',
305
+ padding: '8px',
306
+ fontSize: '24px',
307
+ lineHeight: 1,
308
+ }}
309
+ aria-label="Close settings"
310
+ >
311
+ ×
312
+ </button>
313
+ </div>
314
+
315
+ <div className="u-divide-y" style={{ borderColor: 'rgba(255,255,255,0.1)' }}>
316
+ {/* Notifications Setting */}
317
+ <div className="u-py-3 u-flex u-items-center u-justify-between">
318
+ <div>
319
+ <p className="u-m-0 u-font-medium u-text-base">Push Notifications</p>
320
+ <p className="u-m-0 u-text-xs u-opacity-70 u-mt-1">
321
+ Receive updates and alerts
322
+ </p>
323
+ </div>
324
+ <label style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }}>
325
+ <input
326
+ type="checkbox"
327
+ checked={notifications}
328
+ onChange={(e) => setNotifications(e.target.checked)}
329
+ style={{ accentColor: '#667eea', width: '20px', height: '20px' }}
330
+ />
331
+ </label>
332
+ </div>
333
+
334
+ {/* Dark Mode Setting */}
335
+ <div className="u-py-3 u-flex u-items-center u-justify-between">
336
+ <div>
337
+ <p className="u-m-0 u-font-medium u-text-base">Dark Mode</p>
338
+ <p className="u-m-0 u-text-xs u-opacity-70 u-mt-1">
339
+ Use dark theme across the app
340
+ </p>
341
+ </div>
342
+ <label style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }}>
343
+ <input
344
+ type="checkbox"
345
+ checked={darkMode}
346
+ onChange={(e) => setDarkMode(e.target.checked)}
347
+ style={{ accentColor: '#667eea', width: '20px', height: '20px' }}
348
+ />
349
+ </label>
350
+ </div>
351
+
352
+ {/* Auto Save Setting */}
353
+ <div className="u-py-3 u-flex u-items-center u-justify-between">
354
+ <div>
355
+ <p className="u-m-0 u-font-medium u-text-base">Auto-Save</p>
356
+ <p className="u-m-0 u-text-xs u-opacity-70 u-mt-1">
357
+ Automatically save your work
358
+ </p>
359
+ </div>
360
+ <label style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }}>
361
+ <input
362
+ type="checkbox"
363
+ checked={autoSave}
364
+ onChange={(e) => setAutoSave(e.target.checked)}
365
+ style={{ accentColor: '#667eea', width: '20px', height: '20px' }}
366
+ />
367
+ </label>
368
+ </div>
369
+ </div>
370
+
371
+ <div className="u-flex u-gap-3 u-justify-end u-mt-5" style={{ gap: '12px' }}>
372
+ <Button
373
+ variant="outline-light"
374
+ glass={{ elasticity: 0 }}
375
+ onClick={() => setIsOpen(false)}
376
+ >
377
+ Cancel
378
+ </Button>
379
+ <Button
380
+ variant="primary"
381
+ glass={{ elasticity: 0 }}
382
+ onClick={() => setIsOpen(false)}
383
+ >
384
+ Save Changes
385
+ </Button>
386
+ </div>
387
+ </div>
388
+ </AtomixGlass>
389
+ </div>
390
+ </BackgroundWrapper>
391
+ </StoryErrorBoundary>
392
+ );
393
+ },
394
+ parameters: {
395
+ docs: {
396
+ description: {
397
+ story:
398
+ 'Settings modal with toggle switches for user preferences and configuration options.',
399
+ },
400
+ },
401
+ },
402
+ };