@shohojdhara/atomix 0.4.8 → 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.
- package/atomix.config.ts +58 -1
- package/dist/atomix.css +148 -120
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +33 -0
- package/dist/charts.js +1227 -122
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +33 -10
- package/dist/core.js +1052 -41
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +33 -0
- package/dist/forms.js +2086 -1035
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +42 -1
- package/dist/heavy.js +1620 -600
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +441 -270
- package/dist/index.esm.js +1900 -638
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1935 -670
- 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 +6 -3
- package/scripts/atomix-cli.js +148 -4
- package/scripts/cli/__tests__/basic.test.js +3 -2
- package/scripts/cli/__tests__/clean.test.js +278 -0
- package/scripts/cli/__tests__/component-validator.test.js +433 -0
- package/scripts/cli/__tests__/generator.test.js +613 -0
- package/scripts/cli/__tests__/glass-motion.test.js +256 -0
- package/scripts/cli/__tests__/integration.test.js +719 -108
- package/scripts/cli/__tests__/migrate.test.js +74 -0
- package/scripts/cli/__tests__/security.test.js +206 -0
- package/scripts/cli/__tests__/test-setup.js +3 -1
- package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
- package/scripts/cli/__tests__/token-provider.test.js +361 -0
- package/scripts/cli/__tests__/utils.test.js +5 -5
- package/scripts/cli/commands/benchmark.js +105 -0
- package/scripts/cli/commands/build-theme.js +4 -1
- package/scripts/cli/commands/clean.js +109 -0
- package/scripts/cli/commands/doctor.js +88 -0
- package/scripts/cli/commands/generate.js +135 -14
- package/scripts/cli/commands/init.js +45 -18
- package/scripts/cli/commands/migrate.js +106 -0
- package/scripts/cli/commands/sync-tokens.js +206 -0
- package/scripts/cli/commands/theme-bridge.js +248 -0
- package/scripts/cli/commands/tokens.js +157 -0
- package/scripts/cli/commands/validate.js +194 -0
- package/scripts/cli/internal/ai-engine.js +156 -0
- package/scripts/cli/internal/component-validator.js +443 -0
- package/scripts/cli/internal/config-loader.js +162 -0
- package/scripts/cli/internal/filesystem.js +102 -2
- package/scripts/cli/internal/generator.js +359 -39
- package/scripts/cli/internal/glass-generator.js +398 -0
- package/scripts/cli/internal/hook-generator.js +369 -0
- package/scripts/cli/internal/hooks.js +61 -0
- package/scripts/cli/internal/itcss-generator.js +565 -0
- package/scripts/cli/internal/motion-generator.js +679 -0
- package/scripts/cli/internal/template-engine.js +301 -0
- package/scripts/cli/internal/theme-bridge.js +664 -0
- package/scripts/cli/internal/tokens/engine.js +122 -0
- package/scripts/cli/internal/tokens/provider.js +34 -0
- package/scripts/cli/internal/tokens/providers/figma.js +50 -0
- package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
- package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
- package/scripts/cli/internal/tokens/token-provider.js +443 -0
- package/scripts/cli/internal/tokens/token-validator.js +513 -0
- package/scripts/cli/internal/validator.js +276 -0
- package/scripts/cli/internal/wizard.js +60 -6
- package/scripts/cli/mappings.js +23 -0
- package/scripts/cli/migration-tools.js +164 -94
- package/scripts/cli/plugins/style-dictionary.js +46 -0
- package/scripts/cli/templates/README.md +525 -95
- package/scripts/cli/templates/common-templates.js +40 -14
- package/scripts/cli/templates/components/react-component.ts +282 -0
- package/scripts/cli/templates/config/project-config.ts +112 -0
- package/scripts/cli/templates/hooks/use-component.ts +477 -0
- package/scripts/cli/templates/index.js +19 -4
- package/scripts/cli/templates/index.ts +171 -0
- package/scripts/cli/templates/next-templates.js +72 -0
- package/scripts/cli/templates/react-templates.js +70 -126
- package/scripts/cli/templates/scss-templates.js +35 -35
- package/scripts/cli/templates/stories/storybook-story.ts +241 -0
- package/scripts/cli/templates/styles/scss-component.ts +255 -0
- package/scripts/cli/templates/tests/vitest-test.ts +229 -0
- package/scripts/cli/templates/token-templates.js +337 -1
- package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
- package/scripts/cli/templates/types/component-types.ts +145 -0
- package/scripts/cli/templates/utils/testing-utils.ts +144 -0
- package/scripts/cli/templates/vanilla-templates.js +39 -0
- package/scripts/cli/token-manager.js +8 -2
- package/scripts/cli/utils/cache-manager.js +240 -0
- package/scripts/cli/utils/detector.js +46 -0
- package/scripts/cli/utils/diagnostics.js +289 -0
- package/scripts/cli/utils/error.js +45 -3
- package/scripts/cli/utils/helpers.js +24 -0
- package/scripts/cli/utils/logger.js +1 -1
- package/scripts/cli/utils/security.js +302 -0
- package/scripts/cli/utils/telemetry.js +115 -0
- package/scripts/cli/utils/validation.js +4 -38
- package/scripts/cli/utils.js +46 -0
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.test.tsx +0 -17
- package/src/components/Accordion/Accordion.tsx +0 -4
- package/src/components/AtomixGlass/AtomixGlass.tsx +102 -2
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +125 -12
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
- package/src/components/AtomixGlass/README.md +25 -10
- package/src/components/AtomixGlass/animation-system.ts +578 -0
- package/src/components/AtomixGlass/shader-utils.ts +3 -0
- package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +653 -0
- package/src/components/AtomixGlass/stories/AnimationTests.stories.tsx +95 -0
- package/src/components/AtomixGlass/stories/CardExamples.stories.tsx +212 -0
- package/src/components/AtomixGlass/stories/DashboardExamples.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/EcommerceExamples.stories.tsx +410 -0
- package/src/components/AtomixGlass/stories/FormExamples.stories.tsx +436 -0
- package/src/components/AtomixGlass/stories/HeroExamples.stories.tsx +264 -0
- package/src/components/AtomixGlass/stories/InteractivePlayground.stories.tsx +247 -0
- package/src/components/AtomixGlass/stories/MobileUIExamples.stories.tsx +418 -0
- package/src/components/AtomixGlass/stories/ModalExamples.stories.tsx +402 -0
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +658 -93
- package/src/components/AtomixGlass/stories/PresetGallery.stories.tsx +335 -0
- package/src/components/AtomixGlass/stories/WidgetExamples.stories.tsx +441 -0
- package/src/components/AtomixGlass/stories/argTypes.ts +384 -0
- package/src/components/AtomixGlass/stories/shared-components.tsx +91 -1
- package/src/components/AtomixGlass/stories/types.ts +127 -0
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
- package/src/components/Button/Button.stories.tsx +10 -0
- package/src/components/Button/Button.test.tsx +16 -11
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +12 -12
- package/src/components/Form/Select.tsx +62 -3
- package/src/components/Modal/Modal.tsx +14 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +38 -0
- package/src/components/Steps/Steps.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +77 -8
- package/src/components/Testimonial/Testimonial.tsx +1 -1
- package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
- package/src/components/TypedButton/TypedButton.tsx +39 -0
- package/src/components/TypedButton/index.ts +2 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
- package/src/lib/composables/index.ts +4 -7
- package/src/lib/composables/types.ts +45 -0
- package/src/lib/composables/useAccordion.ts +0 -7
- package/src/lib/composables/useAtomixGlass.ts +144 -5
- package/src/lib/composables/useChartExport.ts +3 -13
- package/src/lib/composables/useDropdown.ts +66 -0
- package/src/lib/composables/useFocusTrap.ts +80 -0
- package/src/lib/composables/usePerformanceMonitor.ts +448 -0
- package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
- package/src/lib/composables/useResponsiveGlass.ts +441 -0
- package/src/lib/composables/useTooltip.ts +16 -0
- package/src/lib/composables/useTypedButton.ts +66 -0
- package/src/lib/config/index.ts +62 -5
- package/src/lib/constants/components.ts +55 -0
- package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
- package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
- package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
- package/src/lib/types/components.ts +37 -11
- package/src/lib/types/glass.ts +35 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/utils/displacement-generator.ts +1 -1
- package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
- package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
- package/src/styles/06-components/_components.testbutton.scss +212 -0
- package/src/styles/06-components/_components.testtypecheck.scss +212 -0
- package/src/styles/06-components/_components.typedbutton.scss +212 -0
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.text.scss +1 -1
- package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
- package/src/styles/06-components/old.chart.styles.scss +0 -2788
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WidgetExamples.stories.tsx
|
|
3
|
+
*
|
|
4
|
+
* Interactive widget examples for AtomixGlass including music players,
|
|
5
|
+
* chat interfaces, notifications, and utility widgets.
|
|
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 { Input } from '../../../Form/Input';
|
|
20
|
+
|
|
21
|
+
const meta: Meta<typeof AtomixGlass> = {
|
|
22
|
+
title: 'Components/AtomixGlass/Examples/Widget Examples',
|
|
23
|
+
component: AtomixGlass,
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'centered',
|
|
26
|
+
docs: {
|
|
27
|
+
description: {
|
|
28
|
+
component:
|
|
29
|
+
'Interactive widget examples demonstrating AtomixGlass for media players, chat interfaces, and utility components.',
|
|
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
|
+
* Music Player Widget
|
|
45
|
+
*
|
|
46
|
+
* Premium music player interface with playback controls, progress tracking, and volume control.
|
|
47
|
+
*/
|
|
48
|
+
export const MusicPlayer: Story = {
|
|
49
|
+
render: () => {
|
|
50
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
51
|
+
const [currentTime, setCurrentTime] = useState(125);
|
|
52
|
+
const [volume, setVolume] = useState(70);
|
|
53
|
+
|
|
54
|
+
const totalDuration = 248;
|
|
55
|
+
|
|
56
|
+
const formatTime = (seconds: number) => {
|
|
57
|
+
const mins = Math.floor(seconds / 60);
|
|
58
|
+
const secs = seconds % 60;
|
|
59
|
+
return `${mins}:${secs.toString().padStart(2, '0')}`;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<StoryErrorBoundary>
|
|
64
|
+
<BackgroundWrapper backgroundImage={backgroundImages[3]} overlay overlayOpacity={0.3}>
|
|
65
|
+
<div style={{ maxWidth: '380px' }} className="u-mx-auto">
|
|
66
|
+
<AtomixGlass
|
|
67
|
+
displacementScale={55}
|
|
68
|
+
blurAmount={3}
|
|
69
|
+
borderRadius={28}
|
|
70
|
+
mode="standard"
|
|
71
|
+
padding="24px"
|
|
72
|
+
>
|
|
73
|
+
<div className="u-text-white">
|
|
74
|
+
{/* Album Art */}
|
|
75
|
+
<div
|
|
76
|
+
style={{
|
|
77
|
+
aspectRatio: '1:1',
|
|
78
|
+
borderRadius: '20px',
|
|
79
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
80
|
+
marginBottom: '24px',
|
|
81
|
+
display: 'flex',
|
|
82
|
+
alignItems: 'center',
|
|
83
|
+
justifyContent: 'center',
|
|
84
|
+
fontSize: '80px',
|
|
85
|
+
boxShadow: '0 20px 40px rgba(102, 126, 234, 0.4)',
|
|
86
|
+
}}
|
|
87
|
+
aria-label="Album art"
|
|
88
|
+
>
|
|
89
|
+
🎵
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
{/* Track Info */}
|
|
93
|
+
<div className="u-text-center u-mb-4">
|
|
94
|
+
<h2 className="u-m-0 u-mb-2 u-text-2xl u-font-bold">Summer Vibes</h2>
|
|
95
|
+
<p className="u-m-0 u-opacity-80 u-text-sm">The Atomix Band</p>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{/* Progress Bar */}
|
|
99
|
+
<div className="u-mb-4">
|
|
100
|
+
<div
|
|
101
|
+
style={{
|
|
102
|
+
height: '6px',
|
|
103
|
+
background: 'rgba(255,255,255,0.1)',
|
|
104
|
+
borderRadius: '3px',
|
|
105
|
+
overflow: 'hidden',
|
|
106
|
+
cursor: 'pointer',
|
|
107
|
+
}}
|
|
108
|
+
onClick={(e) => {
|
|
109
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
110
|
+
const x = e.clientX - rect.left;
|
|
111
|
+
const percentage = x / rect.width;
|
|
112
|
+
setCurrentTime(Math.floor(totalDuration * percentage));
|
|
113
|
+
}}
|
|
114
|
+
role="slider"
|
|
115
|
+
aria-valuenow={currentTime}
|
|
116
|
+
aria-valuemin={0}
|
|
117
|
+
aria-valuemax={totalDuration}
|
|
118
|
+
tabIndex={0}
|
|
119
|
+
>
|
|
120
|
+
<div
|
|
121
|
+
style={{
|
|
122
|
+
height: '100%',
|
|
123
|
+
width: `${(currentTime / totalDuration) * 100}%`,
|
|
124
|
+
background: 'linear-gradient(90deg, #667eea 0%, #764ba2 100%)',
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
<div
|
|
129
|
+
style={{
|
|
130
|
+
display: 'flex',
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
marginTop: '8px',
|
|
133
|
+
fontSize: '13px',
|
|
134
|
+
opacity: 0.7,
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
<span>{formatTime(currentTime)}</span>
|
|
138
|
+
<span>{formatTime(totalDuration)}</span>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
{/* Playback Controls */}
|
|
143
|
+
<div
|
|
144
|
+
style={{
|
|
145
|
+
display: 'flex',
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
gap: '16px',
|
|
149
|
+
marginBottom: '20px',
|
|
150
|
+
}}
|
|
151
|
+
>
|
|
152
|
+
<button
|
|
153
|
+
onClick={() => setIsPlaying(!isPlaying)}
|
|
154
|
+
style={{
|
|
155
|
+
width: '64px',
|
|
156
|
+
height: '64px',
|
|
157
|
+
borderRadius: '50%',
|
|
158
|
+
border: 'none',
|
|
159
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
160
|
+
color: 'white',
|
|
161
|
+
cursor: 'pointer',
|
|
162
|
+
fontSize: '28px',
|
|
163
|
+
display: 'flex',
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
justifyContent: 'center',
|
|
166
|
+
boxShadow: '0 8px 20px rgba(102, 126, 234, 0.4)',
|
|
167
|
+
}}
|
|
168
|
+
aria-label={isPlaying ? 'Pause' : 'Play'}
|
|
169
|
+
>
|
|
170
|
+
{isPlaying ? '⏸️' : '▶️'}
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
{/* Volume Control */}
|
|
175
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
176
|
+
<span style={{ fontSize: '18px', opacity: 0.7 }} aria-hidden="true">
|
|
177
|
+
🔊
|
|
178
|
+
</span>
|
|
179
|
+
<input
|
|
180
|
+
type="range"
|
|
181
|
+
min="0"
|
|
182
|
+
max="100"
|
|
183
|
+
value={volume}
|
|
184
|
+
onChange={(e) => setVolume(Number(e.target.value))}
|
|
185
|
+
style={{
|
|
186
|
+
flex: 1,
|
|
187
|
+
accentColor: '#667eea',
|
|
188
|
+
cursor: 'pointer',
|
|
189
|
+
}}
|
|
190
|
+
aria-label="Volume"
|
|
191
|
+
/>
|
|
192
|
+
<span style={{ fontSize: '14px', opacity: 0.7, minWidth: '35px' }}>
|
|
193
|
+
{volume}%
|
|
194
|
+
</span>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
</AtomixGlass>
|
|
198
|
+
</div>
|
|
199
|
+
</BackgroundWrapper>
|
|
200
|
+
</StoryErrorBoundary>
|
|
201
|
+
);
|
|
202
|
+
},
|
|
203
|
+
parameters: {
|
|
204
|
+
docs: {
|
|
205
|
+
description: {
|
|
206
|
+
story:
|
|
207
|
+
'Music player widget with play/pause controls, progress bar, and volume slider in a premium glass interface.',
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Chat Interface Widget
|
|
215
|
+
*
|
|
216
|
+
* Real-time chat interface with message history and input field.
|
|
217
|
+
*/
|
|
218
|
+
export const ChatInterface: Story = {
|
|
219
|
+
render: () => {
|
|
220
|
+
const [message, setMessage] = useState('');
|
|
221
|
+
const [messages, setMessages] = useState([
|
|
222
|
+
{ id: 1, text: 'Hey! How are you?', sender: 'them', time: '10:30 AM' },
|
|
223
|
+
{ id: 2, text: "I'm doing great! Working on something cool.", sender: 'me', time: '10:32 AM' },
|
|
224
|
+
{ id: 3, text: 'Oh really? What is it?', sender: 'them', time: '10:33 AM' },
|
|
225
|
+
]);
|
|
226
|
+
|
|
227
|
+
const handleSend = () => {
|
|
228
|
+
if (!message.trim()) return;
|
|
229
|
+
setMessages([
|
|
230
|
+
...messages,
|
|
231
|
+
{ id: messages.length + 1, text: message, sender: 'me', time: new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) },
|
|
232
|
+
]);
|
|
233
|
+
setMessage('');
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<StoryErrorBoundary>
|
|
238
|
+
<BackgroundWrapper backgroundImage={backgroundImages[5]} overlay overlayOpacity={0.4}>
|
|
239
|
+
<div style={{ maxWidth: '400px', height: '500px' }}>
|
|
240
|
+
<AtomixGlass
|
|
241
|
+
displacementScale={60}
|
|
242
|
+
blurAmount={0.75}
|
|
243
|
+
saturation={140}
|
|
244
|
+
borderRadius={24}
|
|
245
|
+
mode="standard"
|
|
246
|
+
>
|
|
247
|
+
<div className="u-text-white" style={{ height: '100%', display: 'flex', flexDirection: 'column' }}>
|
|
248
|
+
{/* Header */}
|
|
249
|
+
<div
|
|
250
|
+
style={{
|
|
251
|
+
padding: '20px',
|
|
252
|
+
borderBottom: '1px solid rgba(255,255,255,0.1)',
|
|
253
|
+
display: 'flex',
|
|
254
|
+
alignItems: 'center',
|
|
255
|
+
gap: '12px',
|
|
256
|
+
}}
|
|
257
|
+
>
|
|
258
|
+
<div
|
|
259
|
+
style={{
|
|
260
|
+
width: '40px',
|
|
261
|
+
height: '40px',
|
|
262
|
+
borderRadius: '50%',
|
|
263
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
264
|
+
display: 'flex',
|
|
265
|
+
alignItems: 'center',
|
|
266
|
+
justifyContent: 'center',
|
|
267
|
+
fontSize: '20px',
|
|
268
|
+
}}
|
|
269
|
+
aria-hidden="true"
|
|
270
|
+
>
|
|
271
|
+
💬
|
|
272
|
+
</div>
|
|
273
|
+
<div>
|
|
274
|
+
<h3 className="u-m-0 u-font-semibold">Chat</h3>
|
|
275
|
+
<p className="u-m-0 u-text-xs u-opacity-70">3 messages</p>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
{/* Messages */}
|
|
280
|
+
<div style={{ flex: 1, padding: '20px', overflowY: 'auto' }}>
|
|
281
|
+
{messages.map((msg) => (
|
|
282
|
+
<div
|
|
283
|
+
key={msg.id}
|
|
284
|
+
style={{
|
|
285
|
+
marginBottom: '16px',
|
|
286
|
+
display: 'flex',
|
|
287
|
+
justifyContent: msg.sender === 'me' ? 'flex-end' : 'flex-start',
|
|
288
|
+
}}
|
|
289
|
+
>
|
|
290
|
+
<div
|
|
291
|
+
style={{
|
|
292
|
+
maxWidth: '75%',
|
|
293
|
+
padding: '12px 16px',
|
|
294
|
+
borderRadius: '16px',
|
|
295
|
+
background: msg.sender === 'me'
|
|
296
|
+
? 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)'
|
|
297
|
+
: 'rgba(255,255,255,0.1)',
|
|
298
|
+
boxShadow: msg.sender === 'me' ? '0 4px 12px rgba(102, 126, 234, 0.3)' : 'none',
|
|
299
|
+
}}
|
|
300
|
+
>
|
|
301
|
+
<p className="u-m-0 u-text-sm" style={{ lineHeight: 1.5 }}>{msg.text}</p>
|
|
302
|
+
<p className="u-m-0 u-text-xs u-opacity-60 u-mt-1" style={{ textAlign: 'right' }}>
|
|
303
|
+
{msg.time}
|
|
304
|
+
</p>
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
))}
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
{/* Input */}
|
|
311
|
+
<div
|
|
312
|
+
style={{
|
|
313
|
+
padding: '16px',
|
|
314
|
+
borderTop: '1px solid rgba(255,255,255,0.1)',
|
|
315
|
+
display: 'flex',
|
|
316
|
+
gap: '12px',
|
|
317
|
+
}}
|
|
318
|
+
>
|
|
319
|
+
<Input
|
|
320
|
+
type="text"
|
|
321
|
+
value={message}
|
|
322
|
+
onChange={(e) => setMessage(e.target.value)}
|
|
323
|
+
placeholder="Type a message..."
|
|
324
|
+
onKeyDown={(e) => e.key === 'Enter' && handleSend()}
|
|
325
|
+
glass={{ elasticity: 0 }}
|
|
326
|
+
className="u-flex-1"
|
|
327
|
+
/>
|
|
328
|
+
<Button
|
|
329
|
+
variant="primary"
|
|
330
|
+
glass={{ elasticity: 0 }}
|
|
331
|
+
onClick={handleSend}
|
|
332
|
+
disabled={!message.trim()}
|
|
333
|
+
>
|
|
334
|
+
Send
|
|
335
|
+
</Button>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
</AtomixGlass>
|
|
339
|
+
</div>
|
|
340
|
+
</BackgroundWrapper>
|
|
341
|
+
</StoryErrorBoundary>
|
|
342
|
+
);
|
|
343
|
+
},
|
|
344
|
+
parameters: {
|
|
345
|
+
docs: {
|
|
346
|
+
description: {
|
|
347
|
+
story:
|
|
348
|
+
'Real-time chat interface with message history, timestamps, and live input for modern messaging applications.',
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Notification Center Widget
|
|
356
|
+
*
|
|
357
|
+
* Centralized notification panel with multiple notification types.
|
|
358
|
+
*/
|
|
359
|
+
export const NotificationCenter: Story = {
|
|
360
|
+
render: () => {
|
|
361
|
+
const [notifications, setNotifications] = useState([
|
|
362
|
+
{ id: 1, type: 'success', title: 'Payment Received', message: '$250.00 from John Doe', time: '2m ago' },
|
|
363
|
+
{ id: 2, type: 'warning', title: 'Storage Almost Full', message: '85% of your storage is used', time: '1h ago' },
|
|
364
|
+
{ id: 3, type: 'info', title: 'New Feature Available', message: 'Check out the latest updates', time: '3h ago' },
|
|
365
|
+
]);
|
|
366
|
+
|
|
367
|
+
const getTypeIcon = (type: string) => {
|
|
368
|
+
switch (type) {
|
|
369
|
+
case 'success': return '✅';
|
|
370
|
+
case 'warning': return '⚠️';
|
|
371
|
+
case 'info': return 'ℹ️';
|
|
372
|
+
default: return '📢';
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
return (
|
|
377
|
+
<StoryErrorBoundary>
|
|
378
|
+
<BackgroundWrapper backgroundImage={backgroundImages[0]} overlay overlayOpacity={0.4}>
|
|
379
|
+
<div style={{ maxWidth: '420px' }}>
|
|
380
|
+
<AtomixGlass
|
|
381
|
+
displacementScale={65}
|
|
382
|
+
blurAmount={0.75}
|
|
383
|
+
saturation={140}
|
|
384
|
+
borderRadius={24}
|
|
385
|
+
mode="standard"
|
|
386
|
+
>
|
|
387
|
+
<div className="u-text-white" style={{ padding: '24px' }}>
|
|
388
|
+
<div className="u-flex u-items-center u-justify-between u-mb-4">
|
|
389
|
+
<h2 className="u-m-0 u-text-xl u-font-bold">Notifications</h2>
|
|
390
|
+
<Badge variant="primary">{notifications.length}</Badge>
|
|
391
|
+
</div>
|
|
392
|
+
|
|
393
|
+
<div className="u-divide-y" style={{ borderColor: 'rgba(255,255,255,0.1)' }}>
|
|
394
|
+
{notifications.map((notification) => (
|
|
395
|
+
<div
|
|
396
|
+
key={notification.id}
|
|
397
|
+
className="u-py-3 u-flex u-gap-3"
|
|
398
|
+
style={{ cursor: 'pointer' }}
|
|
399
|
+
>
|
|
400
|
+
<div
|
|
401
|
+
style={{
|
|
402
|
+
fontSize: '24px',
|
|
403
|
+
flexShrink: 0,
|
|
404
|
+
}}
|
|
405
|
+
aria-hidden="true"
|
|
406
|
+
>
|
|
407
|
+
{getTypeIcon(notification.type)}
|
|
408
|
+
</div>
|
|
409
|
+
<div className="u-flex-1">
|
|
410
|
+
<p className="u-m-0 u-font-semibold u-text-sm">{notification.title}</p>
|
|
411
|
+
<p className="u-m-0 u-text-xs u-opacity-80 u-mt-1">{notification.message}</p>
|
|
412
|
+
</div>
|
|
413
|
+
<span className="u-text-xs u-opacity-60">{notification.time}</span>
|
|
414
|
+
</div>
|
|
415
|
+
))}
|
|
416
|
+
</div>
|
|
417
|
+
|
|
418
|
+
<Button
|
|
419
|
+
variant="outline-light"
|
|
420
|
+
glass={{ elasticity: 0 }}
|
|
421
|
+
size="sm"
|
|
422
|
+
className="u-block u-w-full u-mt-4"
|
|
423
|
+
>
|
|
424
|
+
Mark All as Read
|
|
425
|
+
</Button>
|
|
426
|
+
</div>
|
|
427
|
+
</AtomixGlass>
|
|
428
|
+
</div>
|
|
429
|
+
</BackgroundWrapper>
|
|
430
|
+
</StoryErrorBoundary>
|
|
431
|
+
);
|
|
432
|
+
},
|
|
433
|
+
parameters: {
|
|
434
|
+
docs: {
|
|
435
|
+
description: {
|
|
436
|
+
story:
|
|
437
|
+
'Notification center panel displaying success, warning, and info notifications with timestamps.',
|
|
438
|
+
},
|
|
439
|
+
},
|
|
440
|
+
},
|
|
441
|
+
};
|