@shohojdhara/atomix 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atomix.css +430 -125
- package/dist/atomix.min.css +4 -4
- package/dist/index.d.ts +188 -42
- package/dist/index.esm.js +2049 -1516
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3571 -3055
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/themes/boomdevs.css +379 -74
- package/dist/themes/boomdevs.min.css +4 -4
- package/dist/themes/esrar.css +430 -125
- package/dist/themes/esrar.min.css +4 -4
- package/dist/themes/mashroom.css +429 -124
- package/dist/themes/mashroom.min.css +4 -4
- package/dist/themes/shaj-default.css +429 -124
- package/dist/themes/shaj-default.min.css +4 -4
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +684 -21
- package/src/components/Accordion/Accordion.tsx +5 -7
- package/src/components/AtomixGlass/AtomixGlass.stories.tsx +456 -2237
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +2 -2
- package/src/components/AtomixGlass/AtomixGlass.tsx +728 -666
- package/src/components/AtomixGlass/shader-utils.ts +589 -33
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +5800 -0
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1065 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1066 -0
- package/src/components/AtomixGlass/stories/ShaderVariants.stories.tsx +397 -0
- package/src/components/AtomixGlass/stories/shared-components.tsx +310 -0
- package/src/components/Badge/Badge.stories.tsx +3 -2
- package/src/components/Badge/Badge.tsx +9 -7
- package/src/components/Button/Button.stories.tsx +501 -20
- package/src/components/Button/Button.tsx +4 -5
- package/src/components/Callout/Callout.tsx +27 -9
- package/src/components/Card/Card.stories.tsx +560 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +697 -9
- package/src/components/EdgePanel/EdgePanel.stories.tsx +476 -3
- package/src/components/EdgePanel/EdgePanel.tsx +86 -13
- package/src/components/Messages/Messages.stories.tsx +113 -0
- package/src/components/Messages/Messages.tsx +51 -9
- package/src/components/Modal/Modal.stories.tsx +6 -4
- package/src/components/Modal/Modal.tsx +2 -3
- package/src/components/Navigation/Nav/Nav.stories.tsx +469 -0
- package/src/components/Navigation/Nav/Nav.tsx +17 -4
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +413 -0
- package/src/components/Navigation/Navbar/Navbar.tsx +66 -28
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +340 -0
- package/src/components/Navigation/SideMenu/SideMenu.tsx +28 -2
- package/src/components/Progress/Progress.tsx +17 -2
- package/src/components/Spinner/Spinner.tsx +17 -2
- package/src/lib/composables/useBarChart.ts +14 -4
- package/src/lib/composables/useChart.ts +223 -370
- package/src/lib/composables/useChartToolbar.ts +11 -20
- package/src/lib/composables/useEdgePanel.ts +81 -35
- package/src/lib/composables/useLineChart.ts +4 -2
- package/src/lib/composables/usePieChart.ts +4 -14
- package/src/lib/constants/components.ts +1 -0
- package/src/lib/types/components.ts +97 -15
- package/src/styles/01-settings/_settings.background.scss +2 -2
- package/src/styles/01-settings/_settings.edge-panel.scss +1 -1
- package/src/styles/02-tools/_tools.utility-api.scss +62 -27
- package/src/styles/06-components/_components.atomix-glass.scss +72 -0
- package/src/styles/06-components/_components.badge.scss +2 -15
- package/src/styles/06-components/_components.callout.scss +10 -5
- package/src/styles/06-components/_components.edge-panel.scss +101 -0
- package/src/styles/06-components/_components.messages.scss +176 -0
- package/src/styles/06-components/_components.modal.scss +13 -3
- package/src/styles/06-components/_components.navbar.scss +12 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -0
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +1 -0
- package/src/styles/99-utilities/_utilities.opacity.scss +1 -1
- package/src/components/AtomixGlass/AtomixGlassComprehensivePreview.stories.tsx +0 -1369
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ShaderVariants.stories.tsx
|
|
3
|
+
*
|
|
4
|
+
* Professional showcase of Apple-style shader variants with modern design.
|
|
5
|
+
* Features premium liquid glass effects with advanced visual rendering.
|
|
6
|
+
*
|
|
7
|
+
* @package Atomix
|
|
8
|
+
* @component AtomixGlass
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
13
|
+
import AtomixGlass from '../AtomixGlass';
|
|
14
|
+
import { BackgroundWrapper } from './shared-components';
|
|
15
|
+
|
|
16
|
+
const meta: Meta<typeof AtomixGlass> = {
|
|
17
|
+
title: 'Components/AtomixGlass/Shader Variants',
|
|
18
|
+
component: AtomixGlass,
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'fullscreen',
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component:
|
|
24
|
+
'Experience premium Apple-style shader variants with advanced GPU-accelerated effects. Each variant features unique characteristics including time-based animations, organic flow patterns, and sophisticated visual rendering.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
tags: ['autodocs'],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<typeof AtomixGlass>;
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Liquid Glass Variant
|
|
38
|
+
*
|
|
39
|
+
* Enhanced liquid glass with time-based animations and multi-layered organic distortion.
|
|
40
|
+
* Perfect for hero sections and premium content areas.
|
|
41
|
+
*/
|
|
42
|
+
export const LiquidGlass: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
children: (
|
|
45
|
+
<div style={{ padding: '44px 40px', textAlign: 'center', maxWidth: '480px' }}>
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
width: '80px',
|
|
49
|
+
height: '80px',
|
|
50
|
+
margin: '0 auto 28px',
|
|
51
|
+
borderRadius: '22px',
|
|
52
|
+
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
fontSize: '44px',
|
|
57
|
+
boxShadow: '0 20px 48px rgba(102, 126, 234, 0.6)',
|
|
58
|
+
position: 'relative',
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<div
|
|
62
|
+
style={{
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
inset: '-6px',
|
|
65
|
+
borderRadius: '28px',
|
|
66
|
+
background: 'linear-gradient(135deg, #667eea, #764ba2)',
|
|
67
|
+
opacity: 0.4,
|
|
68
|
+
filter: 'blur(20px)',
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
<span style={{ position: 'relative', zIndex: 1 }}>💧</span>
|
|
72
|
+
</div>
|
|
73
|
+
<h2
|
|
74
|
+
style={{
|
|
75
|
+
margin: '0 0 16px 0',
|
|
76
|
+
fontSize: '36px',
|
|
77
|
+
fontWeight: 700,
|
|
78
|
+
background: 'linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%)',
|
|
79
|
+
WebkitBackgroundClip: 'text',
|
|
80
|
+
WebkitTextFillColor: 'transparent',
|
|
81
|
+
backgroundClip: 'text',
|
|
82
|
+
letterSpacing: '-0.5px',
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
Liquid Glass
|
|
86
|
+
</h2>
|
|
87
|
+
<p
|
|
88
|
+
style={{
|
|
89
|
+
margin: '0 0 28px 0',
|
|
90
|
+
fontSize: '17px',
|
|
91
|
+
lineHeight: 1.7,
|
|
92
|
+
color: 'rgba(255, 255, 255, 0.85)',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
Experience fluid, time-based animations with multi-layered organic distortion and
|
|
96
|
+
chromatic aberration effects that create living glass.
|
|
97
|
+
</p>
|
|
98
|
+
<div
|
|
99
|
+
style={{
|
|
100
|
+
display: 'flex',
|
|
101
|
+
flexWrap: 'wrap',
|
|
102
|
+
gap: '12px',
|
|
103
|
+
justifyContent: 'center',
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
{['Time Animation', 'Multi-Layer', 'Chromatic FX', 'Organic Flow'].map(tag => (
|
|
107
|
+
<div
|
|
108
|
+
key={tag}
|
|
109
|
+
style={{
|
|
110
|
+
padding: '8px 16px',
|
|
111
|
+
borderRadius: '10px',
|
|
112
|
+
background: 'rgba(102, 126, 234, 0.2)',
|
|
113
|
+
border: '1px solid rgba(102, 126, 234, 0.3)',
|
|
114
|
+
fontSize: '13px',
|
|
115
|
+
fontWeight: 600,
|
|
116
|
+
color: '#fff',
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{tag}
|
|
120
|
+
</div>
|
|
121
|
+
))}
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
),
|
|
125
|
+
displacementScale: 25,
|
|
126
|
+
blurAmount: 1.5,
|
|
127
|
+
saturation: 150,
|
|
128
|
+
aberrationIntensity: 2,
|
|
129
|
+
elasticity: 0.2,
|
|
130
|
+
cornerRadius: 32,
|
|
131
|
+
mode: 'shader',
|
|
132
|
+
shaderVariant: 'liquidGlass',
|
|
133
|
+
},
|
|
134
|
+
decorators: [
|
|
135
|
+
Story => (
|
|
136
|
+
<BackgroundWrapper
|
|
137
|
+
backgroundImage="https://images.unsplash.com/photo-1557683316-973673baf926?q=80&w=3029&auto=format&fit=crop"
|
|
138
|
+
height="100vh"
|
|
139
|
+
width="100vw"
|
|
140
|
+
overlayOpacity={0.3}
|
|
141
|
+
borderRadius="0"
|
|
142
|
+
>
|
|
143
|
+
<Story />
|
|
144
|
+
</BackgroundWrapper>
|
|
145
|
+
),
|
|
146
|
+
],
|
|
147
|
+
parameters: {
|
|
148
|
+
docs: {
|
|
149
|
+
description: {
|
|
150
|
+
story:
|
|
151
|
+
'Liquid Glass features time-based animations with multi-layered distortion. Ideal for premium hero sections and feature highlights.',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Apple Fluid Variant
|
|
159
|
+
*
|
|
160
|
+
* Premium fluid glass inspired by Apple's design language.
|
|
161
|
+
* Features vortex effects and 5-octave noise for organic, flowing visuals.
|
|
162
|
+
*/
|
|
163
|
+
export const AppleFluid: Story = {
|
|
164
|
+
args: {
|
|
165
|
+
children: (
|
|
166
|
+
<div style={{ padding: '44px 40px', textAlign: 'center', maxWidth: '480px' }}>
|
|
167
|
+
<div
|
|
168
|
+
style={{
|
|
169
|
+
width: '80px',
|
|
170
|
+
height: '80px',
|
|
171
|
+
margin: '0 auto 28px',
|
|
172
|
+
borderRadius: '22px',
|
|
173
|
+
background: 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
|
|
174
|
+
display: 'flex',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
fontSize: '44px',
|
|
178
|
+
boxShadow: '0 20px 48px rgba(245, 87, 108, 0.6)',
|
|
179
|
+
position: 'relative',
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
<div
|
|
183
|
+
style={{
|
|
184
|
+
position: 'absolute',
|
|
185
|
+
inset: '-6px',
|
|
186
|
+
borderRadius: '28px',
|
|
187
|
+
background: 'linear-gradient(135deg, #f093fb, #f5576c)',
|
|
188
|
+
opacity: 0.4,
|
|
189
|
+
filter: 'blur(20px)',
|
|
190
|
+
}}
|
|
191
|
+
/>
|
|
192
|
+
<span style={{ position: 'relative', zIndex: 1 }}>🌊</span>
|
|
193
|
+
</div>
|
|
194
|
+
<h2
|
|
195
|
+
style={{
|
|
196
|
+
margin: '0 0 16px 0',
|
|
197
|
+
fontSize: '36px',
|
|
198
|
+
fontWeight: 700,
|
|
199
|
+
background: 'linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%)',
|
|
200
|
+
WebkitBackgroundClip: 'text',
|
|
201
|
+
WebkitTextFillColor: 'transparent',
|
|
202
|
+
backgroundClip: 'text',
|
|
203
|
+
letterSpacing: '-0.5px',
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
Apple Fluid
|
|
207
|
+
</h2>
|
|
208
|
+
<p
|
|
209
|
+
style={{
|
|
210
|
+
margin: '0 0 28px 0',
|
|
211
|
+
fontSize: '17px',
|
|
212
|
+
lineHeight: 1.7,
|
|
213
|
+
color: 'rgba(255, 255, 255, 0.85)',
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
Apple-inspired fluid dynamics with vortex effects and high-quality 5-octave noise. Mouse
|
|
217
|
+
interactions create mesmerizing flow patterns.
|
|
218
|
+
</p>
|
|
219
|
+
<div
|
|
220
|
+
style={{
|
|
221
|
+
display: 'flex',
|
|
222
|
+
flexWrap: 'wrap',
|
|
223
|
+
gap: '12px',
|
|
224
|
+
justifyContent: 'center',
|
|
225
|
+
}}
|
|
226
|
+
>
|
|
227
|
+
{['Vortex FX', '5-Octave', 'Apple Style', 'Interactive'].map(tag => (
|
|
228
|
+
<div
|
|
229
|
+
key={tag}
|
|
230
|
+
style={{
|
|
231
|
+
padding: '8px 16px',
|
|
232
|
+
borderRadius: '10px',
|
|
233
|
+
background: 'rgba(245, 87, 108, 0.2)',
|
|
234
|
+
border: '1px solid rgba(245, 87, 108, 0.3)',
|
|
235
|
+
fontSize: '13px',
|
|
236
|
+
fontWeight: 600,
|
|
237
|
+
color: '#fff',
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
{tag}
|
|
241
|
+
</div>
|
|
242
|
+
))}
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
),
|
|
246
|
+
displacementScale: 25,
|
|
247
|
+
blurAmount: 1.5,
|
|
248
|
+
saturation: 150,
|
|
249
|
+
aberrationIntensity: 2,
|
|
250
|
+
elasticity: 0.2,
|
|
251
|
+
cornerRadius: 32,
|
|
252
|
+
mode: 'shader',
|
|
253
|
+
shaderVariant: 'appleFluid',
|
|
254
|
+
},
|
|
255
|
+
decorators: [
|
|
256
|
+
Story => (
|
|
257
|
+
<BackgroundWrapper
|
|
258
|
+
backgroundImage="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?q=80&w=2940&auto=format&fit=crop"
|
|
259
|
+
height="100vh"
|
|
260
|
+
width="100vw"
|
|
261
|
+
overlayOpacity={0.3}
|
|
262
|
+
borderRadius="0"
|
|
263
|
+
>
|
|
264
|
+
<Story />
|
|
265
|
+
</BackgroundWrapper>
|
|
266
|
+
),
|
|
267
|
+
],
|
|
268
|
+
parameters: {
|
|
269
|
+
docs: {
|
|
270
|
+
description: {
|
|
271
|
+
story:
|
|
272
|
+
'Apple Fluid delivers premium vortex effects with 5-octave noise. Mouse interactions create dynamic, flowing patterns inspired by Apple design.',
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Premium Glass Variant
|
|
280
|
+
*
|
|
281
|
+
* High-end glass rendering with advanced refraction and multi-layer depth.
|
|
282
|
+
* Offers the best performance-to-quality ratio among shader variants.
|
|
283
|
+
*/
|
|
284
|
+
export const PremiumGlass: Story = {
|
|
285
|
+
args: {
|
|
286
|
+
children: (
|
|
287
|
+
<div style={{ padding: '44px 40px', textAlign: 'center', maxWidth: '480px' }}>
|
|
288
|
+
<div
|
|
289
|
+
style={{
|
|
290
|
+
width: '80px',
|
|
291
|
+
height: '80px',
|
|
292
|
+
margin: '0 auto 28px',
|
|
293
|
+
borderRadius: '22px',
|
|
294
|
+
background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
|
|
295
|
+
display: 'flex',
|
|
296
|
+
alignItems: 'center',
|
|
297
|
+
justifyContent: 'center',
|
|
298
|
+
fontSize: '44px',
|
|
299
|
+
boxShadow: '0 20px 48px rgba(79, 172, 254, 0.6)',
|
|
300
|
+
position: 'relative',
|
|
301
|
+
}}
|
|
302
|
+
>
|
|
303
|
+
<div
|
|
304
|
+
style={{
|
|
305
|
+
position: 'absolute',
|
|
306
|
+
inset: '-6px',
|
|
307
|
+
borderRadius: '28px',
|
|
308
|
+
background: 'linear-gradient(135deg, #4facfe, #00f2fe)',
|
|
309
|
+
opacity: 0.4,
|
|
310
|
+
filter: 'blur(20px)',
|
|
311
|
+
}}
|
|
312
|
+
/>
|
|
313
|
+
<span style={{ position: 'relative', zIndex: 1 }}>💎</span>
|
|
314
|
+
</div>
|
|
315
|
+
<h2
|
|
316
|
+
style={{
|
|
317
|
+
margin: '0 0 16px 0',
|
|
318
|
+
fontSize: '36px',
|
|
319
|
+
fontWeight: 700,
|
|
320
|
+
background: 'linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%)',
|
|
321
|
+
WebkitBackgroundClip: 'text',
|
|
322
|
+
WebkitTextFillColor: 'transparent',
|
|
323
|
+
backgroundClip: 'text',
|
|
324
|
+
letterSpacing: '-0.5px',
|
|
325
|
+
}}
|
|
326
|
+
>
|
|
327
|
+
Premium Glass
|
|
328
|
+
</h2>
|
|
329
|
+
<p
|
|
330
|
+
style={{
|
|
331
|
+
margin: '0 0 28px 0',
|
|
332
|
+
fontSize: '17px',
|
|
333
|
+
lineHeight: 1.7,
|
|
334
|
+
color: 'rgba(255, 255, 255, 0.85)',
|
|
335
|
+
}}
|
|
336
|
+
>
|
|
337
|
+
Advanced refraction with multi-layer depth effects and edge-aware rendering. The optimal
|
|
338
|
+
balance of quality and performance.
|
|
339
|
+
</p>
|
|
340
|
+
<div
|
|
341
|
+
style={{
|
|
342
|
+
display: 'flex',
|
|
343
|
+
flexWrap: 'wrap',
|
|
344
|
+
gap: '12px',
|
|
345
|
+
justifyContent: 'center',
|
|
346
|
+
}}
|
|
347
|
+
>
|
|
348
|
+
{['Advanced Refraction', 'Multi-Depth', 'Edge-Aware', 'Optimized'].map(tag => (
|
|
349
|
+
<div
|
|
350
|
+
key={tag}
|
|
351
|
+
style={{
|
|
352
|
+
padding: '8px 16px',
|
|
353
|
+
borderRadius: '10px',
|
|
354
|
+
background: 'rgba(79, 172, 254, 0.2)',
|
|
355
|
+
border: '1px solid rgba(79, 172, 254, 0.3)',
|
|
356
|
+
fontSize: '13px',
|
|
357
|
+
fontWeight: 600,
|
|
358
|
+
color: '#fff',
|
|
359
|
+
}}
|
|
360
|
+
>
|
|
361
|
+
{tag}
|
|
362
|
+
</div>
|
|
363
|
+
))}
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
),
|
|
367
|
+
displacementScale: 25,
|
|
368
|
+
blurAmount: 1.5,
|
|
369
|
+
saturation: 150,
|
|
370
|
+
aberrationIntensity: 2,
|
|
371
|
+
elasticity: 0.2,
|
|
372
|
+
cornerRadius: 32,
|
|
373
|
+
mode: 'shader',
|
|
374
|
+
shaderVariant: 'premiumGlass',
|
|
375
|
+
},
|
|
376
|
+
decorators: [
|
|
377
|
+
Story => (
|
|
378
|
+
<BackgroundWrapper
|
|
379
|
+
backgroundImage="https://images.unsplash.com/photo-1579546929518-9e396f3cc809?q=80&w=2940&auto=format&fit=crop"
|
|
380
|
+
height="100vh"
|
|
381
|
+
width="100vw"
|
|
382
|
+
overlayOpacity={0.3}
|
|
383
|
+
borderRadius="0"
|
|
384
|
+
>
|
|
385
|
+
<Story />
|
|
386
|
+
</BackgroundWrapper>
|
|
387
|
+
),
|
|
388
|
+
],
|
|
389
|
+
parameters: {
|
|
390
|
+
docs: {
|
|
391
|
+
description: {
|
|
392
|
+
story:
|
|
393
|
+
'Premium Glass offers advanced refraction with optimal performance. Best choice for production applications requiring high-quality shader effects.',
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
};
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* shared-components.tsx
|
|
3
|
+
*
|
|
4
|
+
* Shared utility components used across AtomixGlass stories.
|
|
5
|
+
* These components provide consistent styling and functionality for showcasing
|
|
6
|
+
* the AtomixGlass component in various scenarios.
|
|
7
|
+
*
|
|
8
|
+
* @package Atomix
|
|
9
|
+
* @component AtomixGlass
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
13
|
+
import type { RefObject } from 'react';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Enhanced BackgroundWrapper Component
|
|
17
|
+
*
|
|
18
|
+
* A utility component used throughout the stories to provide consistent background
|
|
19
|
+
* styling and overlay effects. This wrapper creates a visually appealing container
|
|
20
|
+
* for showcasing the AtomixGlass component in various scenarios.
|
|
21
|
+
*
|
|
22
|
+
* @component BackgroundWrapper
|
|
23
|
+
*/
|
|
24
|
+
export interface BackgroundWrapperProps {
|
|
25
|
+
/** Child elements to render inside the wrapper */
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
/** Background image URL or index from the backgroundImages array */
|
|
28
|
+
backgroundImage?: string;
|
|
29
|
+
/** Background index to use from the predefined array */
|
|
30
|
+
backgroundIndex?: number;
|
|
31
|
+
/** Optional overlay flag for quick overlay application */
|
|
32
|
+
overlay?: boolean;
|
|
33
|
+
/** Custom overlay color in CSS format */
|
|
34
|
+
overlayColor?: string;
|
|
35
|
+
/** Overlay opacity (0-1) */
|
|
36
|
+
overlayOpacity?: number;
|
|
37
|
+
/** Container height */
|
|
38
|
+
height?: string;
|
|
39
|
+
/** Container width */
|
|
40
|
+
width?: string;
|
|
41
|
+
/** Container border radius */
|
|
42
|
+
borderRadius?: string;
|
|
43
|
+
/** Container padding */
|
|
44
|
+
padding?: string;
|
|
45
|
+
/** Additional CSS class names */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** Additional inline styles */
|
|
48
|
+
style?: React.CSSProperties;
|
|
49
|
+
/** Enable interactive background movement */
|
|
50
|
+
interactive?: boolean;
|
|
51
|
+
/** ARIA hidden attribute */
|
|
52
|
+
'aria-hidden'?: 'true' | 'false' | boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Interactive Story Container
|
|
57
|
+
*
|
|
58
|
+
* A container that provides mouse tracking and interactive background effects
|
|
59
|
+
* for enhanced storytelling and demonstration purposes.
|
|
60
|
+
*/
|
|
61
|
+
export interface StoryContainerProps {
|
|
62
|
+
children: React.ReactNode;
|
|
63
|
+
style?: React.CSSProperties;
|
|
64
|
+
interactive?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Interactive Wrapper Component
|
|
69
|
+
*
|
|
70
|
+
* Provides mouse position tracking and offset calculations for interactive stories
|
|
71
|
+
*/
|
|
72
|
+
export interface InteractiveWrapperProps {
|
|
73
|
+
children: (
|
|
74
|
+
mousePos: { x: number; y: number },
|
|
75
|
+
mouseOffset: { x: number; y: number },
|
|
76
|
+
containerRef: RefObject<HTMLDivElement>
|
|
77
|
+
) => React.ReactNode;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Collection of high-quality background images for different moods and scenarios
|
|
82
|
+
*
|
|
83
|
+
* This array provides a variety of background options that work well with the
|
|
84
|
+
* AtomixGlass component, showcasing different visual styles and contexts.
|
|
85
|
+
*/
|
|
86
|
+
export const backgroundImages = [
|
|
87
|
+
// 0: Modern office interior with natural lighting
|
|
88
|
+
'https://images.pexels.com/photos/5653101/pexels-photo-5653101.jpeg',
|
|
89
|
+
// 1: Beautiful natural landscape - mountains and lake
|
|
90
|
+
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
91
|
+
// 2: Urban cityscape with modern buildings
|
|
92
|
+
'https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
93
|
+
// 3: Forest path with sunlight filtering through trees
|
|
94
|
+
'https://images.unsplash.com/photo-1441974231531-c6227db76b6e?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
95
|
+
// 4: Ocean waves and beach scene
|
|
96
|
+
'https://images.unsplash.com/photo-1505142468610-359e7d316be0?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
97
|
+
// 5: Modern architecture with glass facades
|
|
98
|
+
'https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
99
|
+
// 6: Cozy café interior with warm lighting
|
|
100
|
+
'https://images.unsplash.com/photo-1554118811-1e0d58224f24?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
101
|
+
// 7: Desert landscape with dramatic sky
|
|
102
|
+
'https://images.unsplash.com/photo-1509316785289-025f5b846b35?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
103
|
+
// 8: Tropical paradise with palm trees and ocean
|
|
104
|
+
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
105
|
+
// 9: Modern library or workspace with natural light
|
|
106
|
+
'https://images.unsplash.com/photo-1521587760476-6c12a4b040da?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Legacy backgrounds object for backward compatibility
|
|
111
|
+
* @deprecated Use backgroundImages array instead
|
|
112
|
+
*/
|
|
113
|
+
export const backgrounds = {
|
|
114
|
+
// Office and workspace environments
|
|
115
|
+
blueGradient: backgroundImages[0], // Modern office interior
|
|
116
|
+
purpleGradient: backgroundImages[1], // Mountain landscape
|
|
117
|
+
greenGradient: backgroundImages[3], // Forest path
|
|
118
|
+
|
|
119
|
+
// Apple-inspired natural scenes
|
|
120
|
+
macosWallpaper: backgroundImages[1], // Mountain landscape
|
|
121
|
+
iosWallpaper: backgroundImages[4], // Ocean waves
|
|
122
|
+
|
|
123
|
+
// Nature scenes
|
|
124
|
+
mountains: backgroundImages[1], // Mountain landscape
|
|
125
|
+
ocean: backgroundImages[4], // Ocean waves
|
|
126
|
+
|
|
127
|
+
// Urban environments
|
|
128
|
+
cityNight: backgroundImages[2], // Urban cityscape
|
|
129
|
+
cityDay: backgroundImages[5], // Modern architecture
|
|
130
|
+
|
|
131
|
+
// Interior spaces
|
|
132
|
+
abstract1: backgroundImages[6], // Cozy café interior
|
|
133
|
+
abstract2: backgroundImages[9], // Modern library
|
|
134
|
+
|
|
135
|
+
// Video backgrounds
|
|
136
|
+
videoBackground:
|
|
137
|
+
'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* BackgroundWrapper Component Implementation
|
|
142
|
+
*
|
|
143
|
+
* Renders a container with a background image and optional overlay,
|
|
144
|
+
* providing a consistent environment for showcasing the AtomixGlass component.
|
|
145
|
+
*
|
|
146
|
+
* @param props - BackgroundWrapperProps
|
|
147
|
+
* @returns JSX.Element
|
|
148
|
+
*/
|
|
149
|
+
export const BackgroundWrapper = ({
|
|
150
|
+
children,
|
|
151
|
+
backgroundImage,
|
|
152
|
+
backgroundIndex,
|
|
153
|
+
overlay = false,
|
|
154
|
+
overlayColor = 'rgba(0,0,0,0)',
|
|
155
|
+
overlayOpacity = 0,
|
|
156
|
+
height = '97vh',
|
|
157
|
+
width = '97vw',
|
|
158
|
+
borderRadius = '12px',
|
|
159
|
+
className = '',
|
|
160
|
+
style = {},
|
|
161
|
+
}: BackgroundWrapperProps) => {
|
|
162
|
+
// If backgroundIndex is provided, use it to select from the backgroundImages array
|
|
163
|
+
const bgImage =
|
|
164
|
+
backgroundIndex !== undefined ? backgroundImages[backgroundIndex] : backgroundImage;
|
|
165
|
+
|
|
166
|
+
// Apply default overlay settings if overlay flag is true using nullish coalescing
|
|
167
|
+
const finalOverlayColor = overlay ? 'rgba(0,0,0,0.5)' : (overlayColor ?? 'rgba(0,0,0,0)');
|
|
168
|
+
const finalOverlayOpacity = overlay ? 0.5 : (overlayOpacity ?? 0);
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<div
|
|
172
|
+
className={`atomix-glass-background ${className}`}
|
|
173
|
+
style={{
|
|
174
|
+
position: 'relative',
|
|
175
|
+
height: height,
|
|
176
|
+
width: width,
|
|
177
|
+
backgroundColor: !bgImage ? '#1a1a2e' : undefined, // Fallback color if no image
|
|
178
|
+
background: bgImage
|
|
179
|
+
? `url(${bgImage}) ${finalOverlayOpacity && ',' + finalOverlayColor}`
|
|
180
|
+
: undefined,
|
|
181
|
+
backgroundSize: 'cover',
|
|
182
|
+
backgroundPosition: 'center',
|
|
183
|
+
backgroundAttachment: 'fixed',
|
|
184
|
+
display: 'flex',
|
|
185
|
+
alignItems: 'center',
|
|
186
|
+
justifyContent: 'center',
|
|
187
|
+
borderRadius: borderRadius,
|
|
188
|
+
overflow: 'auto',
|
|
189
|
+
...style,
|
|
190
|
+
}}
|
|
191
|
+
>
|
|
192
|
+
{/* Overlay for better contrast and visual appeal */}
|
|
193
|
+
{finalOverlayOpacity > 0 && (
|
|
194
|
+
<div
|
|
195
|
+
style={{
|
|
196
|
+
position: 'absolute',
|
|
197
|
+
top: 0,
|
|
198
|
+
left: 0,
|
|
199
|
+
right: 0,
|
|
200
|
+
bottom: 0,
|
|
201
|
+
background: finalOverlayColor,
|
|
202
|
+
opacity: finalOverlayOpacity,
|
|
203
|
+
}}
|
|
204
|
+
/>
|
|
205
|
+
)}
|
|
206
|
+
|
|
207
|
+
{children}
|
|
208
|
+
</div>
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Interactive Story Container Component
|
|
214
|
+
*
|
|
215
|
+
* A container that provides mouse tracking and interactive background effects
|
|
216
|
+
* for enhanced storytelling and demonstration purposes.
|
|
217
|
+
*/
|
|
218
|
+
export const StoryContainer = ({ children, style = {}, interactive = false }: StoryContainerProps) => {
|
|
219
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
220
|
+
const [backgroundPosition, setBackgroundPosition] = useState({ x: 0, y: 0 });
|
|
221
|
+
|
|
222
|
+
const handleMouseMove = useCallback(
|
|
223
|
+
(e: MouseEvent) => {
|
|
224
|
+
if (containerRef.current && interactive) {
|
|
225
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
226
|
+
const centerX = rect.left + rect.width / 2;
|
|
227
|
+
const centerY = rect.top + rect.height / 2;
|
|
228
|
+
|
|
229
|
+
// Calculate offset as a percentage
|
|
230
|
+
const offsetX = ((e.clientX - centerX) / rect.width) * 100;
|
|
231
|
+
const offsetY = ((e.clientY - centerY) / rect.height) * 100;
|
|
232
|
+
|
|
233
|
+
setBackgroundPosition({ x: offsetX, y: offsetY });
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
[interactive]
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
const currentRef = containerRef.current;
|
|
241
|
+
if (currentRef && interactive) {
|
|
242
|
+
currentRef.addEventListener('mousemove', handleMouseMove);
|
|
243
|
+
return () => {
|
|
244
|
+
currentRef.removeEventListener('mousemove', handleMouseMove);
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
}, [handleMouseMove, interactive]);
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<div
|
|
251
|
+
ref={containerRef}
|
|
252
|
+
style={{
|
|
253
|
+
width: '100vw',
|
|
254
|
+
height: '100vh',
|
|
255
|
+
display: 'flex',
|
|
256
|
+
alignItems: 'center',
|
|
257
|
+
justifyContent: 'center',
|
|
258
|
+
backgroundImage: interactive
|
|
259
|
+
? 'url(https://images.unsplash.com/photo-1497366216548-37526070297c?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)'
|
|
260
|
+
: undefined,
|
|
261
|
+
backgroundSize: interactive ? '160%' : 'cover',
|
|
262
|
+
backgroundPosition: interactive
|
|
263
|
+
? `calc(50% + ${backgroundPosition.x}px) calc(50% + ${backgroundPosition.y}px)`
|
|
264
|
+
: 'center',
|
|
265
|
+
...style,
|
|
266
|
+
}}
|
|
267
|
+
>
|
|
268
|
+
{children}
|
|
269
|
+
</div>
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Interactive Wrapper Component
|
|
275
|
+
*
|
|
276
|
+
* Provides mouse position tracking and offset calculations for interactive stories
|
|
277
|
+
*/
|
|
278
|
+
export const InteractiveWrapper = ({ children }: InteractiveWrapperProps) => {
|
|
279
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
280
|
+
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
|
|
281
|
+
const [mouseOffset, setMouseOffset] = useState({ x: 0, y: 0 });
|
|
282
|
+
|
|
283
|
+
const handleMouseMove = useCallback((e: MouseEvent) => {
|
|
284
|
+
if (containerRef.current) {
|
|
285
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
286
|
+
const centerX = rect.left + rect.width / 2;
|
|
287
|
+
const centerY = rect.top + rect.height / 2;
|
|
288
|
+
|
|
289
|
+
setMouseOffset({
|
|
290
|
+
x: ((e.clientX - centerX) / rect.width) * 100,
|
|
291
|
+
y: ((e.clientY - centerY) / rect.height) * 100,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
setMousePos({ x: e.clientX, y: e.clientY });
|
|
295
|
+
}, []);
|
|
296
|
+
|
|
297
|
+
useEffect(() => {
|
|
298
|
+
const currentRef = containerRef.current;
|
|
299
|
+
currentRef?.addEventListener('mousemove', handleMouseMove);
|
|
300
|
+
return () => {
|
|
301
|
+
currentRef?.removeEventListener('mousemove', handleMouseMove);
|
|
302
|
+
};
|
|
303
|
+
}, [handleMouseMove]);
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<div ref={containerRef} style={{ width: '100%', height: '100%' }}>
|
|
307
|
+
{children(mousePos, mouseOffset, containerRef)}
|
|
308
|
+
</div>
|
|
309
|
+
);
|
|
310
|
+
};
|