@shohojdhara/atomix 0.3.14 → 0.3.15
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/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -52,7 +52,7 @@ const meta = {
|
|
|
52
52
|
control: 'boolean',
|
|
53
53
|
description: 'Display the callout in compact mode',
|
|
54
54
|
table: {
|
|
55
|
-
defaultValue: { summary:
|
|
55
|
+
defaultValue: { summary: false },
|
|
56
56
|
type: { summary: 'boolean' },
|
|
57
57
|
},
|
|
58
58
|
},
|
|
@@ -60,7 +60,7 @@ const meta = {
|
|
|
60
60
|
control: 'boolean',
|
|
61
61
|
description: 'Display the callout as a toast notification',
|
|
62
62
|
table: {
|
|
63
|
-
defaultValue: { summary:
|
|
63
|
+
defaultValue: { summary: false },
|
|
64
64
|
type: { summary: 'boolean' },
|
|
65
65
|
},
|
|
66
66
|
},
|
|
@@ -68,11 +68,10 @@ const meta = {
|
|
|
68
68
|
control: 'boolean',
|
|
69
69
|
description: 'Enable glass morphism effect',
|
|
70
70
|
table: {
|
|
71
|
-
defaultValue: { summary:
|
|
71
|
+
defaultValue: { summary: false },
|
|
72
72
|
type: { summary: 'AtomixGlassProps | boolean' },
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
|
-
|
|
76
75
|
actions: {
|
|
77
76
|
control: false,
|
|
78
77
|
description: 'Optional action buttons to display in the callout',
|
|
@@ -87,6 +86,13 @@ const meta = {
|
|
|
87
86
|
type: { summary: 'string' },
|
|
88
87
|
},
|
|
89
88
|
},
|
|
89
|
+
onClose: {
|
|
90
|
+
action: 'closed',
|
|
91
|
+
description: 'Callback when callout is dismissed',
|
|
92
|
+
table: {
|
|
93
|
+
type: { summary: '() => void' },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
90
96
|
},
|
|
91
97
|
} satisfies Meta<typeof Callout>;
|
|
92
98
|
|
|
@@ -321,355 +327,39 @@ export const Light: Story = {
|
|
|
321
327
|
},
|
|
322
328
|
};
|
|
323
329
|
|
|
324
|
-
//
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
return <SuccessIcon />;
|
|
346
|
-
case 'warning':
|
|
347
|
-
return <WarningIcon />;
|
|
348
|
-
case 'error':
|
|
349
|
-
return <ErrorIcon />;
|
|
350
|
-
default:
|
|
351
|
-
return <InfoIcon />;
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
const getTitle = (variant: string) => {
|
|
356
|
-
switch (variant) {
|
|
357
|
-
case 'success':
|
|
358
|
-
return 'Success';
|
|
359
|
-
case 'warning':
|
|
360
|
-
return 'Warning';
|
|
361
|
-
case 'error':
|
|
362
|
-
return 'Error';
|
|
363
|
-
default:
|
|
364
|
-
return 'Information';
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
const getMessage = (variant: string) => {
|
|
369
|
-
switch (variant) {
|
|
370
|
-
case 'success':
|
|
371
|
-
return 'Operation completed successfully!';
|
|
372
|
-
case 'warning':
|
|
373
|
-
return 'Please review before continuing.';
|
|
374
|
-
case 'error':
|
|
375
|
-
return 'An error occurred. Please try again.';
|
|
376
|
-
default:
|
|
377
|
-
return 'This is an informational message.';
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
return (
|
|
382
|
-
<div
|
|
383
|
-
style={{
|
|
384
|
-
background: `linear-gradient(135deg,
|
|
385
|
-
rgba(255, 107, 107, 0.15) 0%,
|
|
386
|
-
rgba(255, 142, 83, 0.15) 25%,
|
|
387
|
-
rgba(255, 193, 7, 0.15) 50%,
|
|
388
|
-
rgba(76, 175, 80, 0.15) 75%,
|
|
389
|
-
rgba(33, 150, 243, 0.15) 100%),
|
|
390
|
-
url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")`,
|
|
391
|
-
backgroundSize: 'cover, cover',
|
|
392
|
-
backgroundPosition: 'center, center',
|
|
393
|
-
backgroundBlendMode: 'overlay, normal',
|
|
394
|
-
padding: '2rem',
|
|
395
|
-
minHeight: '90vh',
|
|
396
|
-
position: 'relative',
|
|
397
|
-
}}
|
|
398
|
-
>
|
|
399
|
-
{/* Additional background layer for depth */}
|
|
400
|
-
<div
|
|
401
|
-
style={{
|
|
402
|
-
position: 'absolute',
|
|
403
|
-
top: 0,
|
|
404
|
-
left: 0,
|
|
405
|
-
right: 0,
|
|
406
|
-
bottom: 0,
|
|
407
|
-
backgroundImage:
|
|
408
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
409
|
-
backgroundSize: 'cover',
|
|
410
|
-
backgroundPosition: 'center',
|
|
411
|
-
opacity: 0.2,
|
|
412
|
-
zIndex: -1,
|
|
413
|
-
}}
|
|
414
|
-
/>
|
|
415
|
-
|
|
416
|
-
<div
|
|
417
|
-
style={{
|
|
418
|
-
display: 'flex',
|
|
419
|
-
flexDirection: 'column',
|
|
420
|
-
gap: '16px',
|
|
421
|
-
position: 'relative',
|
|
422
|
-
zIndex: 1,
|
|
423
|
-
}}
|
|
424
|
-
>
|
|
425
|
-
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
|
426
|
-
<Button
|
|
427
|
-
label="Add Info Toast"
|
|
428
|
-
variant="primary"
|
|
429
|
-
size="sm"
|
|
430
|
-
onClick={() => addToast('info')}
|
|
431
|
-
/>
|
|
432
|
-
<Button
|
|
433
|
-
label="Add Success Toast"
|
|
434
|
-
variant="success"
|
|
435
|
-
size="sm"
|
|
436
|
-
onClick={() => addToast('success')}
|
|
437
|
-
/>
|
|
438
|
-
<Button
|
|
439
|
-
label="Add Warning Toast"
|
|
440
|
-
variant="warning"
|
|
441
|
-
size="sm"
|
|
442
|
-
onClick={() => addToast('warning')}
|
|
443
|
-
/>
|
|
444
|
-
<Button
|
|
445
|
-
label="Add Error Toast"
|
|
446
|
-
variant="error"
|
|
447
|
-
size="sm"
|
|
448
|
-
onClick={() => addToast('error')}
|
|
449
|
-
/>
|
|
450
|
-
</div>
|
|
451
|
-
|
|
452
|
-
<div
|
|
453
|
-
style={{
|
|
454
|
-
position: 'relative',
|
|
455
|
-
height: '400px',
|
|
456
|
-
border: '2px solid rgba(255, 255, 255, 0.2)',
|
|
457
|
-
borderRadius: '16px',
|
|
458
|
-
padding: '20px',
|
|
459
|
-
overflow: 'hidden',
|
|
460
|
-
background: `linear-gradient(45deg,
|
|
461
|
-
rgba(255, 107, 107, 0.1) 0%,
|
|
462
|
-
rgba(255, 142, 83, 0.1) 25%,
|
|
463
|
-
rgba(255, 193, 7, 0.1) 50%,
|
|
464
|
-
rgba(76, 175, 80, 0.1) 75%,
|
|
465
|
-
rgba(33, 150, 243, 0.1) 100%),
|
|
466
|
-
url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")`,
|
|
467
|
-
backgroundSize: 'cover, cover',
|
|
468
|
-
backgroundPosition: 'center, center',
|
|
469
|
-
backgroundBlendMode: 'overlay, normal',
|
|
470
|
-
backdropFilter: 'blur(1px)',
|
|
471
|
-
}}
|
|
472
|
-
>
|
|
473
|
-
<div
|
|
474
|
-
style={{
|
|
475
|
-
position: 'absolute',
|
|
476
|
-
top: '20px',
|
|
477
|
-
right: '20px',
|
|
478
|
-
display: 'flex',
|
|
479
|
-
flexDirection: 'column',
|
|
480
|
-
gap: '12px',
|
|
481
|
-
maxWidth: '350px',
|
|
482
|
-
}}
|
|
483
|
-
>
|
|
484
|
-
{toasts.map(toast => (
|
|
485
|
-
<Callout
|
|
486
|
-
key={toast.id}
|
|
487
|
-
title={getTitle(toast.variant)}
|
|
488
|
-
variant={toast.variant as any}
|
|
489
|
-
icon={getIcon(toast.variant)}
|
|
490
|
-
isToast={true}
|
|
491
|
-
onClose={() => removeToast(toast.id)}
|
|
492
|
-
>
|
|
493
|
-
{getMessage(toast.variant)}
|
|
494
|
-
</Callout>
|
|
495
|
-
))}
|
|
496
|
-
</div>
|
|
497
|
-
{toasts.length === 0 && (
|
|
498
|
-
<div
|
|
499
|
-
style={{
|
|
500
|
-
display: 'flex',
|
|
501
|
-
height: '100%',
|
|
502
|
-
alignItems: 'center',
|
|
503
|
-
justifyContent: 'center',
|
|
504
|
-
color: 'white',
|
|
505
|
-
textAlign: 'center',
|
|
506
|
-
textShadow: '0 2px 4px rgba(0, 0, 0, 0.5)',
|
|
507
|
-
fontSize: '18px',
|
|
508
|
-
fontWeight: '500',
|
|
509
|
-
}}
|
|
510
|
-
>
|
|
511
|
-
<div>
|
|
512
|
-
<div style={{ marginBottom: '8px' }}>
|
|
513
|
-
🎨 Click a button above to show toast notifications here 🎨
|
|
514
|
-
</div>
|
|
515
|
-
<small style={{ opacity: 0.8 }}>
|
|
516
|
-
Beautiful colorful backgrounds enhance the visual experience
|
|
517
|
-
</small>
|
|
518
|
-
</div>
|
|
519
|
-
</div>
|
|
520
|
-
)}
|
|
521
|
-
</div>
|
|
522
|
-
</div>
|
|
523
|
-
</div>
|
|
524
|
-
);
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
export const ToastDemo: Story = {
|
|
528
|
-
render: () => <ToastDemoTemplate />,
|
|
529
|
-
parameters: {
|
|
530
|
-
docs: {
|
|
531
|
-
description: {
|
|
532
|
-
story:
|
|
533
|
-
'Interactive demo showing how toast notifications can be triggered and displayed in different variants.',
|
|
534
|
-
},
|
|
535
|
-
},
|
|
536
|
-
},
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
const AutoDismissTemplate = () => {
|
|
540
|
-
const [visible, setVisible] = useState(true);
|
|
541
|
-
const [countdown, setCountdown] = useState(5);
|
|
542
|
-
|
|
543
|
-
useEffect(() => {
|
|
544
|
-
if (!visible) return;
|
|
545
|
-
|
|
546
|
-
const timer = setInterval(() => {
|
|
547
|
-
setCountdown(prev => {
|
|
548
|
-
if (prev <= 1) {
|
|
549
|
-
clearInterval(timer);
|
|
550
|
-
setVisible(false);
|
|
551
|
-
return 0;
|
|
552
|
-
}
|
|
553
|
-
return prev - 1;
|
|
554
|
-
});
|
|
555
|
-
}, 1000);
|
|
556
|
-
|
|
557
|
-
return () => clearInterval(timer);
|
|
558
|
-
}, [visible]);
|
|
559
|
-
|
|
560
|
-
const resetCallout = () => {
|
|
561
|
-
setVisible(true);
|
|
562
|
-
setCountdown(5);
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
return (
|
|
566
|
-
<div
|
|
567
|
-
style={{
|
|
568
|
-
background: `linear-gradient(135deg,
|
|
569
|
-
rgba(255, 107, 107, 0.2) 0%,
|
|
570
|
-
rgba(255, 142, 83, 0.2) 25%,
|
|
571
|
-
rgba(255, 193, 7, 0.2) 50%,
|
|
572
|
-
rgba(76, 175, 80, 0.2) 75%,
|
|
573
|
-
rgba(33, 150, 243, 0.2) 100%),
|
|
574
|
-
url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")`,
|
|
575
|
-
backgroundSize: 'cover, cover',
|
|
576
|
-
backgroundPosition: 'center, center',
|
|
577
|
-
backgroundBlendMode: 'overlay, normal',
|
|
578
|
-
padding: '4rem',
|
|
579
|
-
minHeight: '400px',
|
|
580
|
-
position: 'relative',
|
|
581
|
-
}}
|
|
582
|
-
>
|
|
583
|
-
{/* Additional background layer for depth */}
|
|
584
|
-
<div
|
|
585
|
-
style={{
|
|
586
|
-
position: 'absolute',
|
|
587
|
-
top: 0,
|
|
588
|
-
left: 0,
|
|
589
|
-
right: 0,
|
|
590
|
-
bottom: 0,
|
|
591
|
-
backgroundImage:
|
|
592
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
593
|
-
backgroundSize: 'cover',
|
|
594
|
-
backgroundPosition: 'center',
|
|
595
|
-
opacity: 0.3,
|
|
596
|
-
zIndex: -1,
|
|
597
|
-
}}
|
|
598
|
-
/>
|
|
599
|
-
|
|
600
|
-
<div
|
|
601
|
-
style={{
|
|
602
|
-
display: 'flex',
|
|
603
|
-
flexDirection: 'column',
|
|
604
|
-
gap: '16px',
|
|
605
|
-
position: 'relative',
|
|
606
|
-
zIndex: 1,
|
|
607
|
-
}}
|
|
608
|
-
>
|
|
609
|
-
{visible ? (
|
|
330
|
+
// All Variants
|
|
331
|
+
export const AllVariants: Story = {
|
|
332
|
+
render: () => {
|
|
333
|
+
const variants = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'light', 'dark'];
|
|
334
|
+
|
|
335
|
+
const getIcon = (variant: string) => {
|
|
336
|
+
switch (variant) {
|
|
337
|
+
case 'success':
|
|
338
|
+
return <SuccessIcon />;
|
|
339
|
+
case 'warning':
|
|
340
|
+
return <WarningIcon />;
|
|
341
|
+
case 'error':
|
|
342
|
+
return <ErrorIcon />;
|
|
343
|
+
default:
|
|
344
|
+
return <InfoIcon />;
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
return (
|
|
349
|
+
<div className="u-flex u-flex-col u-gap-4">
|
|
350
|
+
{variants.map(variant => (
|
|
610
351
|
<Callout
|
|
611
|
-
|
|
612
|
-
variant
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
onClose={() => setVisible(false)}
|
|
352
|
+
key={variant}
|
|
353
|
+
title={`${variant.charAt(0).toUpperCase() + variant.slice(1)} Variant`}
|
|
354
|
+
variant={variant as any}
|
|
355
|
+
icon={getIcon(variant)}
|
|
616
356
|
>
|
|
617
|
-
This
|
|
618
|
-
manually. The glass effect looks beautiful against this colorful background!
|
|
357
|
+
This is an example of the {variant} callout variant.
|
|
619
358
|
</Callout>
|
|
620
|
-
)
|
|
621
|
-
<Button label="Show Auto-dismiss Callout" variant="primary" onClick={resetCallout} />
|
|
622
|
-
)}
|
|
359
|
+
))}
|
|
623
360
|
</div>
|
|
624
|
-
|
|
625
|
-
);
|
|
626
|
-
};
|
|
627
|
-
|
|
628
|
-
export const AutoDismiss: Story = {
|
|
629
|
-
render: () => <AutoDismissTemplate />,
|
|
630
|
-
parameters: {
|
|
631
|
-
docs: {
|
|
632
|
-
description: {
|
|
633
|
-
story: 'Example of a callout that automatically dismisses after a countdown.',
|
|
634
|
-
},
|
|
635
|
-
},
|
|
361
|
+
);
|
|
636
362
|
},
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
const AllVariantsTemplate = () => {
|
|
640
|
-
const variants = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'light', 'dark'];
|
|
641
|
-
|
|
642
|
-
const getIcon = (variant: string) => {
|
|
643
|
-
switch (variant) {
|
|
644
|
-
case 'success':
|
|
645
|
-
return <SuccessIcon />;
|
|
646
|
-
case 'warning':
|
|
647
|
-
return <WarningIcon />;
|
|
648
|
-
case 'error':
|
|
649
|
-
return <ErrorIcon />;
|
|
650
|
-
default:
|
|
651
|
-
return <InfoIcon />;
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
return (
|
|
656
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px' }}>
|
|
657
|
-
{variants.map(variant => (
|
|
658
|
-
<Callout
|
|
659
|
-
key={variant}
|
|
660
|
-
title={`${variant.charAt(0).toUpperCase() + variant.slice(1)} Variant`}
|
|
661
|
-
variant={variant as any}
|
|
662
|
-
icon={getIcon(variant)}
|
|
663
|
-
>
|
|
664
|
-
This is an example of the {variant} callout variant.
|
|
665
|
-
</Callout>
|
|
666
|
-
))}
|
|
667
|
-
</div>
|
|
668
|
-
);
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
export const AllVariants: Story = {
|
|
672
|
-
render: () => <AllVariantsTemplate />,
|
|
673
363
|
parameters: {
|
|
674
364
|
docs: {
|
|
675
365
|
description: {
|
|
@@ -679,33 +369,6 @@ export const AllVariants: Story = {
|
|
|
679
369
|
},
|
|
680
370
|
};
|
|
681
371
|
|
|
682
|
-
const CalloutWithCustomContentTemplate = () => (
|
|
683
|
-
<Callout title="Custom Content Example" variant="primary" icon={<InfoIcon />}>
|
|
684
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
685
|
-
<p>Callouts can contain rich content including:</p>
|
|
686
|
-
<ul style={{ margin: 0, paddingLeft: '20px' }}>
|
|
687
|
-
<li>Lists of items</li>
|
|
688
|
-
<li>Formatted text</li>
|
|
689
|
-
<li>Custom components</li>
|
|
690
|
-
</ul>
|
|
691
|
-
<div style={{ backgroundColor: 'rgba(0,0,0,0.05)', padding: '8px', borderRadius: '4px' }}>
|
|
692
|
-
<code>This is a code example</code>
|
|
693
|
-
</div>
|
|
694
|
-
</div>
|
|
695
|
-
</Callout>
|
|
696
|
-
);
|
|
697
|
-
|
|
698
|
-
export const CustomContent: Story = {
|
|
699
|
-
render: () => <CalloutWithCustomContentTemplate />,
|
|
700
|
-
parameters: {
|
|
701
|
-
docs: {
|
|
702
|
-
description: {
|
|
703
|
-
story: 'Callouts can contain rich, custom content beyond simple text.',
|
|
704
|
-
},
|
|
705
|
-
},
|
|
706
|
-
},
|
|
707
|
-
};
|
|
708
|
-
|
|
709
372
|
// Glass morphism variants
|
|
710
373
|
export const Glass: Story = {
|
|
711
374
|
args: {
|
|
@@ -725,16 +388,7 @@ export const Glass: Story = {
|
|
|
725
388
|
},
|
|
726
389
|
decorators: [
|
|
727
390
|
Story => (
|
|
728
|
-
<div
|
|
729
|
-
style={{
|
|
730
|
-
backgroundImage:
|
|
731
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
732
|
-
backgroundSize: 'cover',
|
|
733
|
-
backgroundPosition: 'center',
|
|
734
|
-
padding: '4rem',
|
|
735
|
-
minHeight: '300px',
|
|
736
|
-
}}
|
|
737
|
-
>
|
|
391
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")'}}>
|
|
738
392
|
<Story />
|
|
739
393
|
</div>
|
|
740
394
|
),
|
|
@@ -758,16 +412,7 @@ export const GlassSuccess: Story = {
|
|
|
758
412
|
},
|
|
759
413
|
decorators: [
|
|
760
414
|
Story => (
|
|
761
|
-
<div
|
|
762
|
-
style={{
|
|
763
|
-
backgroundImage:
|
|
764
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
765
|
-
backgroundSize: 'cover',
|
|
766
|
-
backgroundPosition: 'center',
|
|
767
|
-
padding: '4rem',
|
|
768
|
-
minHeight: '300px',
|
|
769
|
-
}}
|
|
770
|
-
>
|
|
415
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")'}}>
|
|
771
416
|
<Story />
|
|
772
417
|
</div>
|
|
773
418
|
),
|
|
@@ -792,16 +437,7 @@ export const GlassWarning: Story = {
|
|
|
792
437
|
},
|
|
793
438
|
decorators: [
|
|
794
439
|
Story => (
|
|
795
|
-
<div
|
|
796
|
-
style={{
|
|
797
|
-
backgroundImage:
|
|
798
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
799
|
-
backgroundSize: 'cover',
|
|
800
|
-
backgroundPosition: 'center',
|
|
801
|
-
padding: '4rem',
|
|
802
|
-
minHeight: '300px',
|
|
803
|
-
}}
|
|
804
|
-
>
|
|
440
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
805
441
|
<Story />
|
|
806
442
|
</div>
|
|
807
443
|
),
|
|
@@ -826,16 +462,7 @@ export const GlassError: Story = {
|
|
|
826
462
|
},
|
|
827
463
|
decorators: [
|
|
828
464
|
Story => (
|
|
829
|
-
<div
|
|
830
|
-
style={{
|
|
831
|
-
backgroundImage:
|
|
832
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
833
|
-
backgroundSize: 'cover',
|
|
834
|
-
backgroundPosition: 'center',
|
|
835
|
-
padding: '4rem',
|
|
836
|
-
minHeight: '300px',
|
|
837
|
-
}}
|
|
838
|
-
>
|
|
465
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
839
466
|
<Story />
|
|
840
467
|
</div>
|
|
841
468
|
),
|
|
@@ -859,16 +486,7 @@ export const GlassDark: Story = {
|
|
|
859
486
|
},
|
|
860
487
|
decorators: [
|
|
861
488
|
Story => (
|
|
862
|
-
<div
|
|
863
|
-
style={{
|
|
864
|
-
backgroundImage:
|
|
865
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
866
|
-
backgroundSize: 'cover',
|
|
867
|
-
backgroundPosition: 'center',
|
|
868
|
-
padding: '4rem',
|
|
869
|
-
minHeight: '300px',
|
|
870
|
-
}}
|
|
871
|
-
>
|
|
489
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
872
490
|
<Story />
|
|
873
491
|
</div>
|
|
874
492
|
),
|
|
@@ -899,16 +517,7 @@ export const GlassWithActions: Story = {
|
|
|
899
517
|
},
|
|
900
518
|
decorators: [
|
|
901
519
|
Story => (
|
|
902
|
-
<div
|
|
903
|
-
style={{
|
|
904
|
-
backgroundImage:
|
|
905
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
906
|
-
backgroundSize: 'cover',
|
|
907
|
-
backgroundPosition: 'center',
|
|
908
|
-
padding: '4rem',
|
|
909
|
-
minHeight: '300px',
|
|
910
|
-
}}
|
|
911
|
-
>
|
|
520
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
912
521
|
<Story />
|
|
913
522
|
</div>
|
|
914
523
|
),
|
|
@@ -935,16 +544,7 @@ export const GlassDismissible: Story = {
|
|
|
935
544
|
},
|
|
936
545
|
decorators: [
|
|
937
546
|
Story => (
|
|
938
|
-
<div
|
|
939
|
-
style={{
|
|
940
|
-
backgroundImage:
|
|
941
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
942
|
-
backgroundSize: 'cover',
|
|
943
|
-
backgroundPosition: 'center',
|
|
944
|
-
padding: '4rem',
|
|
945
|
-
minHeight: '300px',
|
|
946
|
-
}}
|
|
947
|
-
>
|
|
547
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
948
548
|
<Story />
|
|
949
549
|
</div>
|
|
950
550
|
),
|
|
@@ -972,16 +572,7 @@ export const GlassToast: Story = {
|
|
|
972
572
|
},
|
|
973
573
|
decorators: [
|
|
974
574
|
Story => (
|
|
975
|
-
<div
|
|
976
|
-
style={{
|
|
977
|
-
backgroundImage:
|
|
978
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
979
|
-
backgroundSize: 'cover',
|
|
980
|
-
backgroundPosition: 'center',
|
|
981
|
-
padding: '4rem',
|
|
982
|
-
minHeight: '300px',
|
|
983
|
-
}}
|
|
984
|
-
>
|
|
575
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
985
576
|
<Story />
|
|
986
577
|
</div>
|
|
987
578
|
),
|
|
@@ -1005,22 +596,237 @@ export const GlassOneLine: Story = {
|
|
|
1005
596
|
},
|
|
1006
597
|
decorators: [
|
|
1007
598
|
Story => (
|
|
1008
|
-
<div
|
|
1009
|
-
style={{
|
|
1010
|
-
backgroundImage:
|
|
1011
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
1012
|
-
backgroundSize: 'cover',
|
|
1013
|
-
backgroundPosition: 'center',
|
|
1014
|
-
padding: '4rem',
|
|
1015
|
-
minHeight: '300px',
|
|
1016
|
-
}}
|
|
1017
|
-
>
|
|
599
|
+
<div className="u-bg-cover u-bg-center u-p-16" style={{backgroundImage: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80'}}>
|
|
1018
600
|
<Story />
|
|
1019
601
|
</div>
|
|
1020
602
|
),
|
|
1021
603
|
],
|
|
1022
604
|
};
|
|
1023
605
|
|
|
606
|
+
// Interactive examples
|
|
607
|
+
const ToastDemoTemplate = () => {
|
|
608
|
+
const [toasts, setToasts] = useState<{ id: string; variant: string }[]>([]);
|
|
609
|
+
|
|
610
|
+
const addToast = (variant: string) => {
|
|
611
|
+
const id = Math.random().toString(36).substring(2, 9);
|
|
612
|
+
setToasts([...toasts, { id, variant }]);
|
|
613
|
+
|
|
614
|
+
// Auto-remove after 5 seconds
|
|
615
|
+
setTimeout(() => {
|
|
616
|
+
setToasts(current => current.filter(toast => toast.id !== id));
|
|
617
|
+
}, 5000);
|
|
618
|
+
};
|
|
619
|
+
|
|
620
|
+
const removeToast = (id: string) => {
|
|
621
|
+
setToasts(current => current.filter(toast => toast.id !== id));
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const getIcon = (variant: string) => {
|
|
625
|
+
switch (variant) {
|
|
626
|
+
case 'success':
|
|
627
|
+
return <SuccessIcon />;
|
|
628
|
+
case 'warning':
|
|
629
|
+
return <WarningIcon />;
|
|
630
|
+
case 'error':
|
|
631
|
+
return <ErrorIcon />;
|
|
632
|
+
default:
|
|
633
|
+
return <InfoIcon />;
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
const getTitle = (variant: string) => {
|
|
638
|
+
switch (variant) {
|
|
639
|
+
case 'success':
|
|
640
|
+
return 'Success';
|
|
641
|
+
case 'warning':
|
|
642
|
+
return 'Warning';
|
|
643
|
+
case 'error':
|
|
644
|
+
return 'Error';
|
|
645
|
+
default:
|
|
646
|
+
return 'Information';
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
const getMessage = (variant: string) => {
|
|
651
|
+
switch (variant) {
|
|
652
|
+
case 'success':
|
|
653
|
+
return 'Operation completed successfully!';
|
|
654
|
+
case 'warning':
|
|
655
|
+
return 'Please review before continuing.';
|
|
656
|
+
case 'error':
|
|
657
|
+
return 'An error occurred. Please try again.';
|
|
658
|
+
default:
|
|
659
|
+
return 'This is an informational message.';
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
return (
|
|
664
|
+
<div className="u-relative u-min-h-90vh u-p-8 u-bg-gradient-to-br u-from-red-500/[0.15] u-via-orange-500/[0.15] u-to-blue-500/[0.15] u-overflow-hidden">
|
|
665
|
+
{/* Additional background layer for depth */}
|
|
666
|
+
<div className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-20" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")'}} />
|
|
667
|
+
|
|
668
|
+
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-4">
|
|
669
|
+
<div className="u-flex u-gap-2 u-flex-wrap">
|
|
670
|
+
<Button
|
|
671
|
+
label="Add Info Toast"
|
|
672
|
+
variant="primary"
|
|
673
|
+
size="sm"
|
|
674
|
+
onClick={() => addToast('info')}
|
|
675
|
+
/>
|
|
676
|
+
<Button
|
|
677
|
+
label="Add Success Toast"
|
|
678
|
+
variant="success"
|
|
679
|
+
size="sm"
|
|
680
|
+
onClick={() => addToast('success')}
|
|
681
|
+
/>
|
|
682
|
+
<Button
|
|
683
|
+
label="Add Warning Toast"
|
|
684
|
+
variant="warning"
|
|
685
|
+
size="sm"
|
|
686
|
+
onClick={() => addToast('warning')}
|
|
687
|
+
/>
|
|
688
|
+
<Button
|
|
689
|
+
label="Add Error Toast"
|
|
690
|
+
variant="error"
|
|
691
|
+
size="sm"
|
|
692
|
+
onClick={() => addToast('error')}
|
|
693
|
+
/>
|
|
694
|
+
</div>
|
|
695
|
+
|
|
696
|
+
<div className="u-relative u-h-96 u-border-2 u-border-white/[0.2] u-rounded-xl u-p-5 u-overflow-hidden u-bg-gradient-to-tr u-from-red-500/[0.1] u-via-yellow-500/[0.1] u-to-blue-500/[0.1] u-backdrop-blur-sm">
|
|
697
|
+
<div className="u-absolute u-top-5 u-right-5 u-flex u-flex-col u-gap-3 u-max-w-xs">
|
|
698
|
+
{toasts.map(toast => (
|
|
699
|
+
<Callout
|
|
700
|
+
key={toast.id}
|
|
701
|
+
title={getTitle(toast.variant)}
|
|
702
|
+
variant={toast.variant as any}
|
|
703
|
+
icon={getIcon(toast.variant)}
|
|
704
|
+
isToast={true}
|
|
705
|
+
onClose={() => removeToast(toast.id)}
|
|
706
|
+
>
|
|
707
|
+
{getMessage(toast.variant)}
|
|
708
|
+
</Callout>
|
|
709
|
+
))}
|
|
710
|
+
</div>
|
|
711
|
+
{toasts.length === 0 && (
|
|
712
|
+
<div className="u-flex u-h-full u-items-center u-justify-center u-text-white u-text-center u-leading-tight u-font-medium">
|
|
713
|
+
<div>
|
|
714
|
+
<div className="u-mb-2">
|
|
715
|
+
🎨 Click a button above to show toast notifications here 🎨
|
|
716
|
+
</div>
|
|
717
|
+
<small className="u-opacity-80">
|
|
718
|
+
Beautiful colorful backgrounds enhance the visual experience
|
|
719
|
+
</small>
|
|
720
|
+
</div>
|
|
721
|
+
</div>
|
|
722
|
+
)}
|
|
723
|
+
</div>
|
|
724
|
+
</div>
|
|
725
|
+
</div>
|
|
726
|
+
);
|
|
727
|
+
};
|
|
728
|
+
|
|
729
|
+
export const ToastDemo: Story = {
|
|
730
|
+
render: () => <ToastDemoTemplate />,
|
|
731
|
+
parameters: {
|
|
732
|
+
docs: {
|
|
733
|
+
description: {
|
|
734
|
+
story:
|
|
735
|
+
'Interactive demo showing how toast notifications can be triggered and displayed in different variants.',
|
|
736
|
+
},
|
|
737
|
+
},
|
|
738
|
+
},
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
const AutoDismissTemplate = () => {
|
|
742
|
+
const [visible, setVisible] = useState(true);
|
|
743
|
+
const [countdown, setCountdown] = useState(5);
|
|
744
|
+
|
|
745
|
+
useEffect(() => {
|
|
746
|
+
if (!visible) return;
|
|
747
|
+
|
|
748
|
+
const timer = setInterval(() => {
|
|
749
|
+
setCountdown(prev => {
|
|
750
|
+
if (prev <= 1) {
|
|
751
|
+
clearInterval(timer);
|
|
752
|
+
setVisible(false);
|
|
753
|
+
return 0;
|
|
754
|
+
}
|
|
755
|
+
return prev - 1;
|
|
756
|
+
});
|
|
757
|
+
}, 1000);
|
|
758
|
+
|
|
759
|
+
return () => clearInterval(timer);
|
|
760
|
+
}, [visible]);
|
|
761
|
+
|
|
762
|
+
const resetCallout = () => {
|
|
763
|
+
setVisible(true);
|
|
764
|
+
setCountdown(5);
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
return (
|
|
768
|
+
<div className="u-relative u-min-h-90 u-p-16 u-bg-gradient-to-br u-from-red-500/[0.2] u-via-orange-500/[0.2] u-to-blue-500/[0.2]">
|
|
769
|
+
{/* Additional background layer for depth */}
|
|
770
|
+
<div className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-30" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")'}} />
|
|
771
|
+
|
|
772
|
+
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-4">
|
|
773
|
+
{visible ? (
|
|
774
|
+
<Callout
|
|
775
|
+
title={`Auto-dismissing in ${countdown} seconds`}
|
|
776
|
+
variant="warning"
|
|
777
|
+
icon={<WarningIcon />}
|
|
778
|
+
glass
|
|
779
|
+
onClose={() => setVisible(false)}
|
|
780
|
+
>
|
|
781
|
+
This callout will automatically dismiss after the countdown. You can also dismiss it
|
|
782
|
+
manually. The glass effect looks beautiful against this colorful background!
|
|
783
|
+
</Callout>
|
|
784
|
+
) : (
|
|
785
|
+
<Button label="Show Auto-dismiss Callout" variant="primary" onClick={resetCallout} />
|
|
786
|
+
)}
|
|
787
|
+
</div>
|
|
788
|
+
</div>
|
|
789
|
+
);
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
export const AutoDismiss: Story = {
|
|
793
|
+
render: () => <AutoDismissTemplate />,
|
|
794
|
+
parameters: {
|
|
795
|
+
docs: {
|
|
796
|
+
description: {
|
|
797
|
+
story: 'Example of a callout that automatically dismisses after a countdown.',
|
|
798
|
+
},
|
|
799
|
+
},
|
|
800
|
+
},
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
const CalloutWithCustomContentTemplate = () => (
|
|
804
|
+
<Callout title="Custom Content Example" variant="primary" icon={<InfoIcon />}>
|
|
805
|
+
<div className="u-flex u-flex-col u-gap-3">
|
|
806
|
+
<p>Callouts can contain rich content including:</p>
|
|
807
|
+
<ul className="u-m-0 u-pl-5">
|
|
808
|
+
<li>Lists of items</li>
|
|
809
|
+
<li>Formatted text</li>
|
|
810
|
+
<li>Custom components</li>
|
|
811
|
+
</ul>
|
|
812
|
+
<div className="u-bg-black/[0.05] u-p-2 u-rounded u-text-sm">
|
|
813
|
+
<code>This is a code example</code>
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
</Callout>
|
|
817
|
+
);
|
|
818
|
+
|
|
819
|
+
export const CustomContent: Story = {
|
|
820
|
+
render: () => <CalloutWithCustomContentTemplate />,
|
|
821
|
+
parameters: {
|
|
822
|
+
docs: {
|
|
823
|
+
description: {
|
|
824
|
+
story: 'Callouts can contain rich, custom content beyond simple text.',
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
};
|
|
829
|
+
|
|
1024
830
|
const GlassVariantsTemplate = () => {
|
|
1025
831
|
const variants = ['primary', 'secondary', 'success', 'info', 'warning', 'error', 'light', 'dark'];
|
|
1026
832
|
|
|
@@ -1049,88 +855,19 @@ const GlassVariantsTemplate = () => {
|
|
|
1049
855
|
];
|
|
1050
856
|
|
|
1051
857
|
return (
|
|
1052
|
-
<div
|
|
1053
|
-
style={{
|
|
1054
|
-
background: `linear-gradient(135deg,
|
|
1055
|
-
rgba(255, 107, 107, 0.1) 0%,
|
|
1056
|
-
rgba(255, 142, 83, 0.1) 25%,
|
|
1057
|
-
rgba(255, 193, 7, 0.1) 50%,
|
|
1058
|
-
rgba(76, 175, 80, 0.1) 75%,
|
|
1059
|
-
rgba(33, 150, 243, 0.1) 100%)`,
|
|
1060
|
-
backgroundSize: 'cover',
|
|
1061
|
-
backgroundPosition: 'center',
|
|
1062
|
-
padding: '4rem',
|
|
1063
|
-
minHeight: '100vh',
|
|
1064
|
-
position: 'relative',
|
|
1065
|
-
}}
|
|
1066
|
-
>
|
|
858
|
+
<div className="u-relative u-min-h-screen u-p-16 u-bg-gradient-to-br u-from-red-500/[0.1] u-via-orange-500/[0.1] u-to-blue-500/[0.1]">
|
|
1067
859
|
{/* Multiple background layers for depth */}
|
|
1068
|
-
<div
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
left: 0,
|
|
1073
|
-
right: 0,
|
|
1074
|
-
bottom: 0,
|
|
1075
|
-
backgroundImage:
|
|
1076
|
-
'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")',
|
|
1077
|
-
backgroundSize: 'cover',
|
|
1078
|
-
backgroundPosition: 'center',
|
|
1079
|
-
opacity: 0.3,
|
|
1080
|
-
zIndex: -1,
|
|
1081
|
-
}}
|
|
1082
|
-
/>
|
|
1083
|
-
<div
|
|
1084
|
-
style={{
|
|
1085
|
-
position: 'absolute',
|
|
1086
|
-
top: 0,
|
|
1087
|
-
left: 0,
|
|
1088
|
-
right: 0,
|
|
1089
|
-
bottom: 0,
|
|
1090
|
-
backgroundImage:
|
|
1091
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
1092
|
-
backgroundSize: 'cover',
|
|
1093
|
-
backgroundPosition: 'center',
|
|
1094
|
-
backgroundAttachment: 'fixed',
|
|
1095
|
-
opacity: 0.2,
|
|
1096
|
-
zIndex: -2,
|
|
1097
|
-
}}
|
|
1098
|
-
/>
|
|
1099
|
-
|
|
1100
|
-
<div
|
|
1101
|
-
style={{
|
|
1102
|
-
display: 'flex',
|
|
1103
|
-
flexDirection: 'column',
|
|
1104
|
-
gap: '32px',
|
|
1105
|
-
position: 'relative',
|
|
1106
|
-
zIndex: 1,
|
|
1107
|
-
}}
|
|
1108
|
-
>
|
|
860
|
+
<div className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-30" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")'}} />
|
|
861
|
+
<div className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-20" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")'}} />
|
|
862
|
+
|
|
863
|
+
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-8">
|
|
1109
864
|
{variants.map((variant, index) => (
|
|
1110
865
|
<div
|
|
1111
866
|
key={variant}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
backgroundSize: 'cover',
|
|
1115
|
-
backgroundPosition: 'center',
|
|
1116
|
-
padding: '2rem',
|
|
1117
|
-
borderRadius: '16px',
|
|
1118
|
-
position: 'relative',
|
|
1119
|
-
overflow: 'hidden',
|
|
1120
|
-
backgroundAttachment: 'fixed',
|
|
1121
|
-
}}
|
|
867
|
+
className="u-bg-cover u-bg-center u-p-8 u-rounded-xl u-relative u-overflow-hidden"
|
|
868
|
+
style={{backgroundImage: `url("${backgrounds[index % backgrounds.length]}")`}}
|
|
1122
869
|
>
|
|
1123
|
-
<div
|
|
1124
|
-
style={{
|
|
1125
|
-
position: 'absolute',
|
|
1126
|
-
top: 0,
|
|
1127
|
-
left: 0,
|
|
1128
|
-
right: 0,
|
|
1129
|
-
bottom: 0,
|
|
1130
|
-
background: 'rgba(0, 0, 0, 0.1)',
|
|
1131
|
-
zIndex: -1,
|
|
1132
|
-
}}
|
|
1133
|
-
/>
|
|
870
|
+
<div className="u-absolute u-inset-0 u-bg-black/[0.1] u-z-n1" />
|
|
1134
871
|
<Callout
|
|
1135
872
|
title={`${variant.charAt(0).toUpperCase() + variant.slice(1)} Glass Variant`}
|
|
1136
873
|
variant={variant as any}
|
|
@@ -1215,51 +952,12 @@ const GlassToastDemoTemplate = () => {
|
|
|
1215
952
|
};
|
|
1216
953
|
|
|
1217
954
|
return (
|
|
1218
|
-
<div
|
|
1219
|
-
style={{
|
|
1220
|
-
background: `linear-gradient(135deg,
|
|
1221
|
-
rgba(255, 107, 107, 0.2) 0%,
|
|
1222
|
-
rgba(255, 142, 83, 0.2) 25%,
|
|
1223
|
-
rgba(255, 193, 7, 0.2) 50%,
|
|
1224
|
-
rgba(76, 175, 80, 0.2) 75%,
|
|
1225
|
-
rgba(33, 150, 243, 0.2) 100%),
|
|
1226
|
-
url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")`,
|
|
1227
|
-
backgroundSize: 'cover, cover',
|
|
1228
|
-
backgroundPosition: 'center, center',
|
|
1229
|
-
backgroundBlendMode: 'overlay, normal',
|
|
1230
|
-
padding: '2rem',
|
|
1231
|
-
minHeight: '100vh',
|
|
1232
|
-
position: 'relative',
|
|
1233
|
-
}}
|
|
1234
|
-
>
|
|
955
|
+
<div className="u-relative u-min-h-screen u-p-8 u-bg-gradient-to-br u-from-red-500/[0.2] u-via-orange-500/[0.2] u-to-blue-500/[0.2]">
|
|
1235
956
|
{/* Additional background layers for depth */}
|
|
1236
|
-
<div
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
left: 0,
|
|
1241
|
-
right: 0,
|
|
1242
|
-
bottom: 0,
|
|
1243
|
-
backgroundImage:
|
|
1244
|
-
'url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")',
|
|
1245
|
-
backgroundSize: 'cover',
|
|
1246
|
-
backgroundPosition: 'center',
|
|
1247
|
-
opacity: 0.3,
|
|
1248
|
-
zIndex: -1,
|
|
1249
|
-
backgroundAttachment: 'fixed',
|
|
1250
|
-
}}
|
|
1251
|
-
/>
|
|
1252
|
-
|
|
1253
|
-
<div
|
|
1254
|
-
style={{
|
|
1255
|
-
display: 'flex',
|
|
1256
|
-
flexDirection: 'column',
|
|
1257
|
-
gap: '16px',
|
|
1258
|
-
position: 'relative',
|
|
1259
|
-
zIndex: 1,
|
|
1260
|
-
}}
|
|
1261
|
-
>
|
|
1262
|
-
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
|
957
|
+
<div className="u-absolute u-inset-0 u-bg-cover u-bg-center u-opacity-30" style={{backgroundImage: 'url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80")'}} />
|
|
958
|
+
|
|
959
|
+
<div className="u-relative u-z-10 u-flex u-flex-col u-gap-4">
|
|
960
|
+
<div className="u-flex u-gap-2 u-flex-wrap">
|
|
1263
961
|
<Button
|
|
1264
962
|
label="Add Glass Info Toast"
|
|
1265
963
|
variant="primary"
|
|
@@ -1286,39 +984,8 @@ const GlassToastDemoTemplate = () => {
|
|
|
1286
984
|
/>
|
|
1287
985
|
</div>
|
|
1288
986
|
|
|
1289
|
-
<div
|
|
1290
|
-
|
|
1291
|
-
position: 'relative',
|
|
1292
|
-
height: '400px',
|
|
1293
|
-
border: '2px solid rgba(255, 255, 255, 0.2)',
|
|
1294
|
-
borderRadius: '16px',
|
|
1295
|
-
padding: '20px',
|
|
1296
|
-
overflow: 'hidden',
|
|
1297
|
-
background: `linear-gradient(45deg,
|
|
1298
|
-
rgba(255, 107, 107, 0.1) 0%,
|
|
1299
|
-
rgba(255, 142, 83, 0.1) 25%,
|
|
1300
|
-
rgba(255, 193, 7, 0.1) 50%,
|
|
1301
|
-
rgba(76, 175, 80, 0.1) 75%,
|
|
1302
|
-
rgba(33, 150, 243, 0.1) 100%),
|
|
1303
|
-
url("https://images.unsplash.com/photo-1441974231531-c6227db76b6e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2071&q=80")`,
|
|
1304
|
-
backgroundSize: 'cover, cover',
|
|
1305
|
-
backgroundPosition: 'center, center',
|
|
1306
|
-
backgroundBlendMode: 'overlay, normal',
|
|
1307
|
-
backdropFilter: 'blur(2px)',
|
|
1308
|
-
backgroundAttachment: 'fixed',
|
|
1309
|
-
}}
|
|
1310
|
-
>
|
|
1311
|
-
<div
|
|
1312
|
-
style={{
|
|
1313
|
-
position: 'absolute',
|
|
1314
|
-
top: '20px',
|
|
1315
|
-
right: '20px',
|
|
1316
|
-
display: 'flex',
|
|
1317
|
-
flexDirection: 'column',
|
|
1318
|
-
gap: '12px',
|
|
1319
|
-
maxWidth: '350px',
|
|
1320
|
-
}}
|
|
1321
|
-
>
|
|
987
|
+
<div className="u-relative u-h-96 u-border-2 u-border-white/[0.2] u-rounded-xl u-p-5 u-overflow-hidden u-bg-gradient-to-tr u-from-red-500/[0.1] u-via-yellow-500/[0.1] u-to-blue-500/[0.1] u-backdrop-blur-sm">
|
|
988
|
+
<div className="u-absolute u-top-5 u-right-5 u-flex u-flex-col u-gap-3 u-max-w-xs">
|
|
1322
989
|
{toasts.map(toast => (
|
|
1323
990
|
<Callout
|
|
1324
991
|
key={toast.id}
|
|
@@ -1334,24 +1001,12 @@ const GlassToastDemoTemplate = () => {
|
|
|
1334
1001
|
))}
|
|
1335
1002
|
</div>
|
|
1336
1003
|
{toasts.length === 0 && (
|
|
1337
|
-
<div
|
|
1338
|
-
style={{
|
|
1339
|
-
display: 'flex',
|
|
1340
|
-
height: '100%',
|
|
1341
|
-
alignItems: 'center',
|
|
1342
|
-
justifyContent: 'center',
|
|
1343
|
-
color: 'white',
|
|
1344
|
-
textAlign: 'center',
|
|
1345
|
-
textShadow: '0 2px 4px rgba(0, 0, 0, 0.5)',
|
|
1346
|
-
fontSize: '18px',
|
|
1347
|
-
fontWeight: '500',
|
|
1348
|
-
}}
|
|
1349
|
-
>
|
|
1004
|
+
<div className="u-flex u-h-full u-items-center u-justify-center u-text-white u-text-center u-leading-tight u-font-medium">
|
|
1350
1005
|
<div>
|
|
1351
|
-
<div
|
|
1006
|
+
<div className="u-mb-2">
|
|
1352
1007
|
✨ Click a button above to show glass toast notifications here ✨
|
|
1353
1008
|
</div>
|
|
1354
|
-
<small
|
|
1009
|
+
<small className="u-opacity-80">
|
|
1355
1010
|
Beautiful colorful backgrounds help visualize the glass morphism effect
|
|
1356
1011
|
</small>
|
|
1357
1012
|
</div>
|