@shohojdhara/atomix 0.6.4 → 0.6.5

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.
Files changed (77) hide show
  1. package/dist/atomix.css +117 -38
  2. package/dist/atomix.css.map +1 -1
  3. package/dist/atomix.min.css +1 -1
  4. package/dist/atomix.min.css.map +1 -1
  5. package/dist/atomix.umd.js +1 -1
  6. package/dist/atomix.umd.js.map +1 -1
  7. package/dist/atomix.umd.min.js +1 -1
  8. package/dist/charts.d.ts +30 -1
  9. package/dist/charts.js +566 -597
  10. package/dist/charts.js.map +1 -1
  11. package/dist/core.d.ts +30 -1
  12. package/dist/core.js +600 -624
  13. package/dist/core.js.map +1 -1
  14. package/dist/forms.d.ts +30 -1
  15. package/dist/forms.js +1122 -1163
  16. package/dist/forms.js.map +1 -1
  17. package/dist/heavy.d.ts +31 -89
  18. package/dist/heavy.js +1015 -1045
  19. package/dist/heavy.js.map +1 -1
  20. package/dist/index.d.ts +378 -104
  21. package/dist/index.esm.js +10959 -10837
  22. package/dist/index.esm.js.map +1 -1
  23. package/dist/index.js +10935 -10812
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.min.js +1 -1
  26. package/dist/index.min.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/components/Accordion/Accordion.tsx +2 -5
  29. package/src/components/AtomixGlass/AtomixGlass.test.tsx +14 -16
  30. package/src/components/AtomixGlass/AtomixGlass.tsx +137 -355
  31. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +32 -249
  32. package/src/components/AtomixGlass/GlassFilter.tsx +62 -68
  33. package/src/components/AtomixGlass/README.md +2 -1
  34. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +19 -18
  35. package/src/components/AtomixGlass/glass-border-styles.test.ts +58 -0
  36. package/src/components/AtomixGlass/glass-border-styles.ts +136 -0
  37. package/src/components/AtomixGlass/glass-utils.ts +411 -6
  38. package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +158 -537
  39. package/src/components/AtomixGlass/stories/Border.stories.tsx +149 -0
  40. package/src/components/AtomixGlass/stories/Examples.stories.tsx +229 -89
  41. package/src/components/AtomixGlass/stories/Playground.stories.tsx +29 -340
  42. package/src/components/AtomixGlass/stories/argTypes.ts +30 -13
  43. package/src/components/AtomixGlass/stories/premium-presets.ts +206 -0
  44. package/src/components/AtomixGlass/stories/shared-components.tsx +52 -8
  45. package/src/components/Badge/Badge.tsx +4 -4
  46. package/src/components/Button/Button.tsx +2 -6
  47. package/src/components/Callout/Callout.test.tsx +4 -3
  48. package/src/components/Callout/Callout.tsx +2 -5
  49. package/src/components/Dropdown/Dropdown.tsx +3 -7
  50. package/src/components/Form/Checkbox.tsx +2 -8
  51. package/src/components/Form/Input.tsx +2 -9
  52. package/src/components/Form/Radio.tsx +2 -9
  53. package/src/components/Form/Select.tsx +2 -7
  54. package/src/components/Form/Textarea.tsx +2 -9
  55. package/src/components/Messages/Messages.tsx +2 -8
  56. package/src/components/Modal/Modal.tsx +4 -5
  57. package/src/components/Navigation/Nav/Nav.tsx +2 -6
  58. package/src/components/Navigation/Navbar/Navbar.tsx +2 -9
  59. package/src/components/Navigation/SideMenu/SideMenu.tsx +2 -6
  60. package/src/components/Pagination/Pagination.tsx +2 -10
  61. package/src/components/Popover/Popover.tsx +2 -9
  62. package/src/components/Progress/Progress.tsx +2 -7
  63. package/src/components/Rating/Rating.tsx +2 -10
  64. package/src/components/Spinner/Spinner.tsx +2 -7
  65. package/src/components/Steps/Steps.tsx +2 -10
  66. package/src/components/Tabs/Tabs.tsx +2 -9
  67. package/src/components/Toggle/Toggle.tsx +2 -10
  68. package/src/components/Tooltip/Tooltip.tsx +2 -5
  69. package/src/lib/composables/useAtomixGlass.ts +41 -10
  70. package/src/lib/composables/useAtomixGlassStyles.ts +59 -75
  71. package/src/lib/composables/usePerformanceMonitor.ts +5 -0
  72. package/src/lib/constants/components.ts +358 -46
  73. package/src/lib/types/components.ts +33 -1
  74. package/src/styles/01-settings/_settings.atomix-glass.scss +66 -28
  75. package/src/styles/02-tools/_tools.glass.scss +45 -3
  76. package/src/styles/06-components/_components.atomix-glass.scss +114 -77
  77. package/src/components/AtomixGlass/deprecated/AtomixGlass.deprecated.tsx +0 -390
@@ -1,390 +0,0 @@
1
- import React, { useId, useMemo, useRef } from 'react';
2
- import type { AtomixGlassProps } from '../../../lib/types/components';
3
- import { ATOMIX_GLASS } from '../../../lib/constants/components';
4
- import { AtomixGlassContainer } from '../AtomixGlassContainer';
5
- import { useAtomixGlass } from '../../../lib/composables/useAtomixGlass';
6
-
7
- /**
8
- * AtomixGlass - A high-performance glass morphism component with liquid distortion effects
9
- *
10
- * Features:
11
- * - Hardware-accelerated glass effects with SVG filters
12
- * - Mouse-responsive liquid distortion
13
- * - Dynamic border-radius extraction from children CSS properties
14
- * - Automatic light/dark theme detection
15
- * - Accessibility and performance optimizations
16
- * - Multiple displacement modes (standard, polar, prominent, shader)
17
- *
18
- * @example
19
- * // Dynamic border-radius extraction
20
- * <AtomixGlass>
21
- * <div style={{ borderRadius: '12px' }}>Content with 12px radius</div>
22
- * </AtomixGlass>
23
- *
24
- * @example
25
- * // Manual border-radius override
26
- * <AtomixGlass cornerRadius={20}>
27
- * <div>Content with 20px glass radius</div>
28
- * </AtomixGlass>
29
- */
30
- export function AtomixGlass({
31
- children,
32
- displacementScale = ATOMIX_GLASS.DEFAULTS.DISPLACEMENT_SCALE,
33
- blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT,
34
- saturation = ATOMIX_GLASS.DEFAULTS.SATURATION,
35
- aberrationIntensity = ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY,
36
- elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY,
37
- borderRadius,
38
- globalMousePosition: externalGlobalMousePosition,
39
- mouseOffset: externalMouseOffset,
40
- mouseContainer = null,
41
- className = '',
42
- padding = ATOMIX_GLASS.DEFAULTS.PADDING,
43
- overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT,
44
- style = {},
45
- mode = ATOMIX_GLASS.DEFAULTS.MODE,
46
- onClick,
47
- shaderVariant = 'liquidGlass',
48
- 'aria-label': ariaLabel,
49
- 'aria-describedby': ariaDescribedBy,
50
- role,
51
- tabIndex,
52
- reducedMotion = false,
53
- highContrast = false,
54
- withoutEffects = false,
55
- withLiquidBlur = false,
56
- withBorder = true,
57
- withOverLightLayers = false,
58
- debugBorderRadius = false,
59
- }: AtomixGlassProps) {
60
- const glassRef = useRef<HTMLDivElement>(null);
61
- const contentRef = useRef<HTMLDivElement>(null);
62
-
63
- // Use composable hook for all state and logic
64
- const {
65
- isHovered,
66
- isActive,
67
- glassSize,
68
- effectiveBorderRadius,
69
- effectiveReducedMotion,
70
- effectiveHighContrast,
71
- effectiveWithoutEffects,
72
- overLightConfig,
73
- globalMousePosition,
74
- mouseOffset,
75
- transformStyle,
76
- handleMouseEnter,
77
- handleMouseLeave,
78
- handleMouseDown,
79
- handleMouseUp,
80
- handleKeyDown,
81
- } = useAtomixGlass({
82
- glassRef,
83
- contentRef,
84
- borderRadius,
85
- globalMousePosition: externalGlobalMousePosition,
86
- mouseOffset: externalMouseOffset,
87
- mouseContainer,
88
- overLight,
89
- reducedMotion,
90
- highContrast,
91
- withoutEffects,
92
- elasticity,
93
- onClick,
94
- debugBorderRadius,
95
- children,
96
- });
97
-
98
- // Calculate base style with transforms
99
- const baseStyle = useMemo(
100
- () => ({
101
- ...style,
102
- ...(elasticity !== 0 && {
103
- transform: transformStyle,
104
- transition: effectiveReducedMotion ? 'none' : 'all ease-out 0.2s',
105
- willChange: effectiveWithoutEffects ? 'auto' : 'transform',
106
- }),
107
- ...(effectiveHighContrast && {
108
- border: '2px solid currentColor',
109
- outline: '2px solid transparent',
110
- outlineOffset: '2px',
111
- }),
112
- }),
113
- [
114
- style,
115
- transformStyle,
116
- effectiveReducedMotion,
117
- effectiveWithoutEffects,
118
- effectiveHighContrast,
119
- elasticity,
120
- ]
121
- );
122
-
123
- // Calculate position and size styles
124
- const positionStyles = useMemo(
125
- () => ({
126
- position: (baseStyle.position || 'absolute') as React.CSSProperties['position'],
127
- top: baseStyle.top || 0,
128
- left: baseStyle.left || 0,
129
- }),
130
- [baseStyle]
131
- );
132
-
133
- const adjustedSize = useMemo(
134
- () => ({
135
- width:
136
- baseStyle.position !== 'fixed'
137
- ? '100%'
138
- : baseStyle.width
139
- ? baseStyle.width
140
- : Math.max(glassSize.width, 0),
141
- height:
142
- baseStyle.position !== 'fixed'
143
- ? '100%'
144
- : baseStyle.height
145
- ? baseStyle.height
146
- : Math.max(glassSize.height, 0),
147
- }),
148
- [baseStyle, glassSize]
149
- );
150
-
151
- // Generate CSS variables for layers
152
- const glassId = useId();
153
- const glassVars = useMemo(() => {
154
- const isOverLight = overLightConfig?.isOverLight ?? false;
155
- const mx = mouseOffset.x;
156
- const my = mouseOffset.y;
157
- const scopedId = `ag-${glassId.replace(/:/g, '')}`;
158
-
159
- return {
160
- [`--${scopedId}-pos`]: positionStyles.position,
161
- [`--${scopedId}-top`]: positionStyles.top !== 'fixed' ? `${positionStyles.top}px` : '0',
162
- [`--${scopedId}-left`]: positionStyles.left !== 'fixed' ? `${positionStyles.left}px` : '0',
163
- [`--${scopedId}-w`]:
164
- baseStyle.position !== 'fixed' ? adjustedSize.width : `${adjustedSize.width}px`,
165
- [`--${scopedId}-h`]:
166
- baseStyle.position !== 'fixed' ? adjustedSize.height : `${adjustedSize.height}px`,
167
- [`--${scopedId}-r`]: `${effectiveBorderRadius}px`,
168
- [`--${scopedId}-t`]: baseStyle.transform,
169
- [`--${scopedId}-tr`]: effectiveReducedMotion ? 'none' : baseStyle.transition,
170
- [`--${scopedId}-blend`]: isOverLight ? 'multiply' : 'overlay',
171
- [`--${scopedId}-b1`]: `linear-gradient(${135 + mx * 1.2}deg, rgba(255,255,255,0) 0%, rgba(255,255,255,${0.12 + Math.abs(mx) * 0.008}) ${Math.max(10, 33 + my * 0.3)}%, rgba(255,255,255,${0.4 + Math.abs(mx) * 0.012}) ${Math.min(90, 66 + my * 0.4)}%, rgba(255,255,255,0) 100%)`,
172
- [`--${scopedId}-b2`]: `linear-gradient(${135 + mx * 1.2}deg, rgba(255,255,255,0) 0%, rgba(255,255,255,${0.32 + Math.abs(mx) * 0.008}) ${Math.max(10, 33 + my * 0.3)}%, rgba(255,255,255,${0.6 + Math.abs(mx) * 0.012}) ${Math.min(90, 66 + my * 0.4)}%, rgba(255,255,255,0) 100%)`,
173
- [`--${scopedId}-h1-o`]: isHovered || isActive ? (isOverLight ? 0.3 : 0.5) : 0,
174
- [`--${scopedId}-h1`]: isOverLight
175
- ? `radial-gradient(circle at ${50 + mx / 2}% ${50 + my / 2}%, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.05) 30%, rgba(0,0,0,0) 60%)`
176
- : `radial-gradient(circle at ${50 + mx / 2}% ${50 + my / 2}%, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 50%)`,
177
- [`--${scopedId}-h2-o`]: isActive ? (isOverLight ? 0.4 : 0.5) : 0,
178
- [`--${scopedId}-h2`]: isOverLight
179
- ? `radial-gradient(circle at ${50 + mx / 1.5}% ${50 + my / 1.5}%, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0) 80%)`
180
- : `radial-gradient(circle at ${50 + mx / 1.5}% ${50 + my / 1.5}%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 80%)`,
181
- [`--${scopedId}-h3-o`]: isHovered
182
- ? isOverLight
183
- ? 0.25
184
- : 0.4
185
- : isActive
186
- ? isOverLight
187
- ? 0.5
188
- : 0.8
189
- : 0,
190
- [`--${scopedId}-h3`]: isOverLight
191
- ? `radial-gradient(circle at ${50 + mx}% ${50 + my}%, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0) 100%)`
192
- : `radial-gradient(circle at ${50 + mx}% ${50 + my}%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%)`,
193
- [`--${scopedId}-base-o`]: isOverLight ? overLightConfig.opacity : 0,
194
- [`--${scopedId}-base`]: isOverLight
195
- ? `linear-gradient(135deg, rgba(0,0,0,${0.12 + mx * 0.002}) 0%, rgba(0,0,0,${0.08 + my * 0.001}) 50%, rgba(0,0,0,${0.15 + Math.abs(mx) * 0.003}) 100%)`
196
- : 'rgba(255,255,255,0.1)',
197
- [`--${scopedId}-over-o`]: isOverLight ? overLightConfig.opacity * 0.9 : 0,
198
- [`--${scopedId}-over`]: isOverLight
199
- ? `radial-gradient(circle at ${50 + mx * 0.5}% ${50 + my * 0.5}%, rgba(0,0,0,${0.08 + Math.abs(mx) * 0.002}) 0%, rgba(0,0,0,0.04) 40%, rgba(0,0,0,${0.12 + Math.abs(my) * 0.002}) 100%)`
200
- : 'rgba(255,255,255,0.05)',
201
- '--ag-scoped-id': scopedId,
202
- } as React.CSSProperties;
203
- }, [
204
- glassId,
205
- positionStyles,
206
- adjustedSize,
207
- effectiveBorderRadius,
208
- baseStyle,
209
- effectiveReducedMotion,
210
- mouseOffset,
211
- isHovered,
212
- isActive,
213
- overLightConfig,
214
- ]);
215
-
216
- const scopedId = `ag-${glassId.replace(/:/g, '')}`;
217
-
218
- return (
219
- <div
220
- className={`${ATOMIX_GLASS.BASE_CLASS} ${className}`}
221
- style={{ ...positionStyles, position: 'relative', ...glassVars }}
222
- role={role || (onClick ? 'button' : undefined)}
223
- tabIndex={onClick ? (tabIndex ?? 0) : tabIndex}
224
- aria-label={ariaLabel}
225
- aria-describedby={ariaDescribedBy}
226
- aria-disabled={onClick ? false : undefined}
227
- onKeyDown={onClick ? handleKeyDown : undefined}
228
- >
229
- <AtomixGlassContainer
230
- ref={glassRef}
231
- contentRef={contentRef}
232
- className={className}
233
- style={baseStyle}
234
- borderRadius={effectiveBorderRadius}
235
- displacementScale={
236
- effectiveWithoutEffects
237
- ? 0
238
- : mode === 'shader'
239
- ? displacementScale * 0.8
240
- : overLightConfig.isOverLight
241
- ? displacementScale * 0.6
242
- : displacementScale
243
- }
244
- blurAmount={effectiveWithoutEffects ? 0 : blurAmount}
245
- saturation={
246
- effectiveHighContrast
247
- ? 200
248
- : overLightConfig.isOverLight
249
- ? saturation * overLightConfig.saturationBoost
250
- : saturation
251
- }
252
- aberrationIntensity={
253
- effectiveWithoutEffects
254
- ? 0
255
- : mode === 'shader'
256
- ? aberrationIntensity * 0.7
257
- : aberrationIntensity
258
- }
259
- glassSize={glassSize}
260
- padding={padding}
261
- mouseOffset={effectiveWithoutEffects ? { x: 0, y: 0 } : mouseOffset}
262
- globalMousePosition={effectiveWithoutEffects ? { x: 0, y: 0 } : globalMousePosition}
263
- onMouseEnter={handleMouseEnter}
264
- onMouseLeave={handleMouseLeave}
265
- onMouseDown={handleMouseDown}
266
- onMouseUp={handleMouseUp}
267
- isHovered={isHovered}
268
- isActive={isActive}
269
- overLight={overLightConfig?.isOverLight || false}
270
- onClick={onClick}
271
- mode={mode}
272
- transform={baseStyle.transform}
273
- effectiveWithoutEffects={effectiveWithoutEffects}
274
- effectiveReducedMotion={effectiveReducedMotion}
275
- shaderVariant={shaderVariant}
276
- elasticity={elasticity}
277
- withLiquidBlur={withLiquidBlur}
278
- >
279
- {children}
280
- </AtomixGlassContainer>
281
- {withBorder && (
282
- <>
283
- <span
284
- className={ATOMIX_GLASS.BORDER_1_CLASS}
285
- style={{
286
- position: `var(--${scopedId}-pos)` as any,
287
- top: `var(--${scopedId}-top)`,
288
- left: `var(--${scopedId}-left)`,
289
- width: `var(--${scopedId}-w)`,
290
- height: `var(--${scopedId}-h)`,
291
- borderRadius: `var(--${scopedId}-r)`,
292
- transform: `var(--${scopedId}-t)`,
293
- transition: `var(--${scopedId}-tr)`,
294
- background: `var(--${scopedId}-b1)`,
295
- }}
296
- />
297
- <span
298
- className={ATOMIX_GLASS.BORDER_2_CLASS}
299
- style={{
300
- position: `var(--${scopedId}-pos)` as any,
301
- top: `var(--${scopedId}-top)`,
302
- left: `var(--${scopedId}-left)`,
303
- width: `var(--${scopedId}-w)`,
304
- height: `var(--${scopedId}-h)`,
305
- borderRadius: `var(--${scopedId}-r)`,
306
- transform: `var(--${scopedId}-t)`,
307
- transition: `var(--${scopedId}-tr)`,
308
- mixBlendMode: `var(--${scopedId}-blend)` as any,
309
- background: `var(--${scopedId}-b2)`,
310
- }}
311
- />
312
- </>
313
- )}
314
- {Boolean(onClick) && (
315
- <>
316
- <div
317
- className={ATOMIX_GLASS.HOVER_1_CLASS}
318
- style={{
319
- position: 'absolute',
320
- inset: 0,
321
- borderRadius: `var(--${scopedId}-r)`,
322
- transform: `var(--${scopedId}-t)`,
323
- transition: `var(--${scopedId}-tr)`,
324
- mixBlendMode: `var(--${scopedId}-blend)` as any,
325
- opacity: `var(--${scopedId}-h1-o)`,
326
- background: `var(--${scopedId}-h1)`,
327
- }}
328
- />
329
- <div
330
- className={ATOMIX_GLASS.HOVER_2_CLASS}
331
- style={{
332
- position: 'absolute',
333
- inset: 0,
334
- borderRadius: `var(--${scopedId}-r)`,
335
- transform: `var(--${scopedId}-t)`,
336
- transition: `var(--${scopedId}-tr)`,
337
- mixBlendMode: `var(--${scopedId}-blend)` as any,
338
- opacity: `var(--${scopedId}-h2-o)`,
339
- background: `var(--${scopedId}-h2)`,
340
- }}
341
- />
342
- <div
343
- className={ATOMIX_GLASS.HOVER_3_CLASS}
344
- style={{
345
- position: 'absolute',
346
- inset: 0,
347
- borderRadius: `var(--${scopedId}-r)`,
348
- transform: `var(--${scopedId}-t)`,
349
- transition: `var(--${scopedId}-tr)`,
350
- mixBlendMode: `var(--${scopedId}-blend)` as any,
351
- opacity: `var(--${scopedId}-h3-o)`,
352
- background: `var(--${scopedId}-h3)`,
353
- }}
354
- />
355
- </>
356
- )}
357
- {withOverLightLayers && (
358
- <>
359
- <div
360
- className={ATOMIX_GLASS.BASE_LAYER_CLASS}
361
- style={{
362
- position: 'absolute',
363
- inset: 0,
364
- borderRadius: `var(--${scopedId}-r)`,
365
- transform: `var(--${scopedId}-t)`,
366
- transition: `var(--${scopedId}-tr)`,
367
- opacity: `var(--${scopedId}-base-o)`,
368
- background: `var(--${scopedId}-base)`,
369
- }}
370
- />
371
- <div
372
- className={ATOMIX_GLASS.OVERLAY_LAYER_CLASS}
373
- style={{
374
- position: 'absolute',
375
- inset: 0,
376
- borderRadius: `var(--${scopedId}-r)`,
377
- transform: `var(--${scopedId}-t)`,
378
- transition: `var(--${scopedId}-tr)`,
379
- opacity: `var(--${scopedId}-over-o)`,
380
- background: `var(--${scopedId}-over)`,
381
- }}
382
- />
383
- </>
384
- )}
385
- </div>
386
- );
387
- }
388
-
389
- export default AtomixGlass;
390
-