@shohojdhara/atomix 0.2.4 → 0.2.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.
- package/README.md +19 -0
- package/dist/atomix.css +1266 -1412
- package/dist/atomix.min.css +3 -3
- package/dist/index.d.ts +1232 -876
- package/dist/index.esm.js +16212 -26364
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15652 -22298
- 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/applemix.css +15008 -0
- package/dist/themes/applemix.min.css +72 -0
- package/dist/themes/boomdevs.css +1266 -1413
- package/dist/themes/boomdevs.min.css +3 -3
- package/dist/themes/esrar.css +1267 -1413
- package/dist/themes/esrar.min.css +3 -3
- package/dist/themes/flashtrade.css +15159 -0
- package/dist/themes/flashtrade.min.css +86 -0
- package/dist/themes/mashroom.css +1264 -1410
- package/dist/themes/mashroom.min.css +5 -5
- package/dist/themes/shaj-default.css +1266 -1412
- package/dist/themes/shaj-default.min.css +3 -3
- package/package.json +6 -17
- package/src/components/Accordion/Accordion.stories.tsx +4 -26
- package/src/components/Accordion/Accordion.tsx +21 -12
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +106 -72
- package/src/components/AtomixGlass/AtomixGlass.tsx +487 -1215
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +400 -0
- package/src/components/AtomixGlass/GlassFilter.tsx +156 -0
- package/src/components/AtomixGlass/README.md +124 -2
- package/src/components/AtomixGlass/atomixGLass.old.tsx +1266 -0
- package/src/components/AtomixGlass/glass-utils.ts +263 -0
- package/src/components/AtomixGlass/shader-utils.ts +404 -236
- package/src/components/AtomixGlass/{AtomixGlass.stories.tsx → stories/AtomixGlass.stories.tsx} +55 -35
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +57 -89
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +149 -149
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +95 -32
- package/src/components/AtomixGlass/stories/ShaderVariants.stories.tsx +0 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +9 -18
- package/src/components/AtomixGlass/utils.ts +3 -3
- package/src/components/Avatar/Avatar.tsx +3 -0
- package/src/components/Avatar/AvatarGroup.tsx +2 -1
- package/src/components/Badge/Badge.stories.tsx +74 -54
- package/src/components/Badge/Badge.tsx +8 -12
- package/src/components/Breadcrumb/Breadcrumb.tsx +23 -4
- package/src/components/Button/Button.tsx +3 -5
- package/src/components/Callout/Callout.stories.tsx +86 -35
- package/src/components/Callout/Callout.tsx +4 -0
- package/src/components/Card/Card.stories.tsx +89 -85
- package/src/components/Card/Card.tsx +15 -4
- package/src/components/Card/ElevationCard.tsx +2 -0
- package/src/components/Chart/AnimatedChart.tsx +179 -156
- package/src/components/Chart/AreaChart.tsx +123 -12
- package/src/components/Chart/BarChart.tsx +91 -100
- package/src/components/Chart/BaseChart.tsx +80 -0
- package/src/components/Chart/BubbleChart.tsx +114 -290
- package/src/components/Chart/CandlestickChart.tsx +282 -622
- package/src/components/Chart/Chart.stories.tsx +576 -179
- package/src/components/Chart/Chart.tsx +374 -75
- package/src/components/Chart/ChartRenderer.tsx +371 -220
- package/src/components/Chart/ChartToolbar.tsx +372 -61
- package/src/components/Chart/ChartTooltip.tsx +33 -18
- package/src/components/Chart/DonutChart.tsx +172 -254
- package/src/components/Chart/FunnelChart.tsx +169 -240
- package/src/components/Chart/GaugeChart.tsx +224 -392
- package/src/components/Chart/HeatmapChart.tsx +302 -440
- package/src/components/Chart/LineChart.tsx +148 -103
- package/src/components/Chart/MultiAxisChart.tsx +267 -395
- package/src/components/Chart/PieChart.tsx +114 -64
- package/src/components/Chart/RadarChart.tsx +202 -218
- package/src/components/Chart/ScatterChart.tsx +111 -97
- package/src/components/Chart/TreemapChart.tsx +147 -222
- package/src/components/Chart/WaterfallChart.tsx +253 -291
- package/src/components/Chart/index.ts +11 -9
- package/src/components/Chart/types.ts +85 -9
- package/src/components/Chart/utils.ts +66 -0
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +6 -3
- package/src/components/Countdown/Countdown.tsx +4 -0
- package/src/components/DataTable/DataTable.tsx +2 -1
- package/src/components/DatePicker/DatePicker.stories.tsx +0 -11
- package/src/components/DatePicker/DatePicker.tsx +3 -9
- package/src/components/DatePicker/types.ts +5 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +32 -25
- package/src/components/Dropdown/Dropdown.tsx +26 -28
- package/src/components/EdgePanel/EdgePanel.stories.tsx +13 -15
- package/src/components/EdgePanel/EdgePanel.tsx +20 -5
- package/src/components/Footer/Footer.stories.tsx +187 -60
- package/src/components/Footer/Footer.test.tsx +134 -0
- package/src/components/Footer/Footer.tsx +133 -34
- package/src/components/Footer/FooterLink.tsx +1 -1
- package/src/components/Footer/FooterSection.tsx +53 -36
- package/src/components/Footer/FooterSocialLink.tsx +32 -29
- package/src/components/Footer/README.md +82 -3
- package/src/components/Footer/index.ts +1 -1
- package/src/components/Form/Checkbox.stories.tsx +13 -5
- package/src/components/Form/Checkbox.tsx +3 -6
- package/src/components/Form/Form.stories.tsx +10 -3
- package/src/components/Form/Form.tsx +2 -0
- package/src/components/Form/FormGroup.tsx +2 -1
- package/src/components/Form/Input.stories.tsx +12 -11
- package/src/components/Form/Input.tsx +97 -95
- package/src/components/Form/Radio.stories.tsx +22 -7
- package/src/components/Form/Radio.tsx +3 -6
- package/src/components/Form/Select.stories.tsx +21 -6
- package/src/components/Form/Select.tsx +3 -5
- package/src/components/Form/Textarea.stories.tsx +13 -11
- package/src/components/Form/Textarea.tsx +88 -86
- package/src/components/Hero/Hero.stories.tsx +2 -3
- package/src/components/Hero/Hero.tsx +5 -6
- package/src/components/Icon/Icon.tsx +12 -1
- package/src/components/List/List.tsx +2 -1
- package/src/components/List/ListGroup.tsx +2 -1
- package/src/components/Messages/Messages.tsx +3 -2
- package/src/components/Modal/Modal.stories.tsx +48 -34
- package/src/components/Modal/Modal.tsx +19 -23
- package/src/components/Navigation/Menu/MegaMenu.tsx +2 -2
- package/src/components/Navigation/Menu/Menu.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +6 -1
- package/src/components/Navigation/Nav/NavDropdown.tsx +10 -1
- package/src/components/Navigation/Navbar/Navbar.tsx +4 -1
- package/src/components/Navigation/SideMenu/SideMenu.tsx +3 -2
- package/src/components/Pagination/Pagination.stories.tsx +13 -6
- package/src/components/Pagination/Pagination.tsx +7 -6
- package/src/components/PhotoViewer/PhotoViewer.tsx +2 -1
- package/src/components/Popover/Popover.stories.tsx +32 -24
- package/src/components/Popover/Popover.tsx +4 -1
- package/src/components/ProductReview/ProductReview.tsx +8 -2
- package/src/components/Progress/Progress.tsx +2 -1
- package/src/components/Rating/Rating.stories.tsx +11 -6
- package/src/components/Rating/Rating.tsx +3 -5
- package/src/components/River/River.tsx +5 -5
- package/src/components/SectionIntro/SectionIntro.tsx +8 -2
- package/src/components/Slider/Slider.stories.tsx +4 -4
- package/src/components/Slider/Slider.tsx +4 -3
- package/src/components/Spinner/Spinner.tsx +2 -1
- package/src/components/Steps/Steps.stories.tsx +5 -4
- package/src/components/Steps/Steps.tsx +8 -5
- package/src/components/Tab/Tab.stories.tsx +4 -3
- package/src/components/Tab/Tab.tsx +8 -6
- package/src/components/Testimonial/Testimonial.tsx +8 -2
- package/src/components/Todo/Todo.tsx +2 -1
- package/src/components/Toggle/Toggle.stories.tsx +5 -4
- package/src/components/Toggle/Toggle.tsx +8 -5
- package/src/components/Tooltip/Tooltip.stories.tsx +40 -30
- package/src/components/Tooltip/Tooltip.tsx +9 -2
- package/src/components/Upload/Upload.stories.tsx +252 -0
- package/src/components/Upload/Upload.tsx +92 -53
- package/src/components/VideoPlayer/VideoPlayer.tsx +3 -1
- package/src/components/index.ts +0 -4
- package/src/layouts/Grid/Grid.stories.tsx +10 -23
- package/src/layouts/Grid/Grid.tsx +20 -1
- package/src/layouts/Grid/GridCol.tsx +76 -48
- package/src/lib/composables/useAtomixGlass.ts +861 -44
- package/src/lib/composables/useBarChart.ts +13 -6
- package/src/lib/composables/useChart.ts +17 -13
- package/src/lib/composables/useChartExport.ts +19 -78
- package/src/lib/composables/useChartToolbar.ts +0 -1
- package/src/lib/composables/useEdgePanel.ts +111 -103
- package/src/lib/composables/useFooter.ts +3 -3
- package/src/lib/composables/useGlassContainer.ts +16 -7
- package/src/lib/composables/useLineChart.ts +8 -1
- package/src/lib/composables/useRiver.ts +5 -0
- package/src/lib/composables/useSlider.ts +62 -24
- package/src/lib/composables/useVideoPlayer.ts +60 -63
- package/src/lib/constants/components.ts +146 -32
- package/src/lib/types/components.ts +258 -10
- package/src/lib/utils/displacement-generator.ts +55 -49
- package/src/lib/utils/icons.ts +1 -1
- package/src/lib/utils/index.ts +16 -10
- package/src/styles/01-settings/_settings.accordion.scss +19 -19
- package/src/styles/01-settings/_settings.animations.scss +5 -5
- package/src/styles/01-settings/_settings.avatar-group.scss +1 -1
- package/src/styles/01-settings/_settings.avatar.scss +17 -17
- package/src/styles/01-settings/_settings.background.scss +1 -4
- package/src/styles/01-settings/_settings.badge.scss +1 -1
- package/src/styles/01-settings/_settings.breadcrumb.scss +1 -1
- package/src/styles/01-settings/_settings.card.scss +1 -1
- package/src/styles/01-settings/_settings.chart.scss +65 -2
- package/src/styles/01-settings/_settings.dropdown.scss +1 -1
- package/src/styles/01-settings/_settings.footer.scss +35 -42
- package/src/styles/01-settings/_settings.input.scss +1 -1
- package/src/styles/01-settings/_settings.list.scss +1 -1
- package/src/styles/01-settings/_settings.rating.scss +1 -1
- package/src/styles/01-settings/_settings.tabs.scss +1 -1
- package/src/styles/01-settings/_settings.upload.scss +6 -5
- package/src/styles/02-tools/_tools.animations.scss +4 -5
- package/src/styles/02-tools/_tools.background.scss +1 -13
- package/src/styles/02-tools/_tools.glass.scss +0 -1
- package/src/styles/02-tools/_tools.utility-api.scss +42 -34
- package/src/styles/03-generic/_generic.root.scss +1 -4
- package/src/styles/04-elements/_elements.body.scss +0 -1
- package/src/styles/06-components/_components.atomix-glass.scss +216 -39
- package/src/styles/06-components/_components.badge.scss +6 -8
- package/src/styles/06-components/_components.button.scss +8 -3
- package/src/styles/06-components/_components.card.scss +2 -14
- package/src/styles/06-components/_components.chart.scss +969 -1449
- package/src/styles/06-components/_components.dropdown.scss +19 -7
- package/src/styles/06-components/_components.edge-panel.scss +4 -2
- package/src/styles/06-components/_components.footer.scss +166 -85
- package/src/styles/06-components/_components.input.scss +8 -9
- package/src/styles/06-components/_components.list.scss +1 -0
- package/src/styles/06-components/_components.modal.scss +5 -3
- package/src/styles/06-components/_components.skeleton.scss +8 -6
- package/src/styles/06-components/_components.upload.scss +219 -4
- package/src/styles/06-components/old.chart.styles.scss +1 -30
- package/src/styles/99-utilities/_utilities.opacity.scss +1 -1
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/components/Chart/AdvancedChart.tsx +0 -624
- package/src/components/Chart/LineChartNew.tsx +0 -167
- package/src/components/Chart/RealTimeChart.tsx +0 -436
- package/src/components/DatePicker/DatePicker copy.tsx +0 -551
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shohojdhara/atomix",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Atomix Design System - A modern component library for web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -73,14 +73,9 @@
|
|
|
73
73
|
"default": "./src/styles/99-utilities/_index.scss"
|
|
74
74
|
},
|
|
75
75
|
"./themes/*": {
|
|
76
|
-
"import": "./dist/themes
|
|
77
|
-
"require": "./dist/themes
|
|
78
|
-
"default": "./dist/themes
|
|
79
|
-
},
|
|
80
|
-
"./themes/*.min": {
|
|
81
|
-
"import": "./dist/themes/*.min.css",
|
|
82
|
-
"require": "./dist/themes/*.min.css",
|
|
83
|
-
"default": "./dist/themes/*.min.css"
|
|
76
|
+
"import": "./dist/themes/*",
|
|
77
|
+
"require": "./dist/themes/*",
|
|
78
|
+
"default": "./dist/themes/*"
|
|
84
79
|
},
|
|
85
80
|
"./package.json": "./package.json"
|
|
86
81
|
},
|
|
@@ -119,12 +114,11 @@
|
|
|
119
114
|
"@storybook/test": "^8.6.14",
|
|
120
115
|
"@storybook/theming": "^8.6.14",
|
|
121
116
|
"@storybook/types": "^8.6.14",
|
|
117
|
+
"@testing-library/dom": "^8.0.0",
|
|
122
118
|
"@testing-library/jest-dom": "^5.16.0",
|
|
123
119
|
"@testing-library/react": "^14.0.0",
|
|
124
120
|
"@testing-library/user-event": "^14.0.0",
|
|
125
|
-
"@testing-library/dom": "^8.0.0",
|
|
126
121
|
"@types/classnames": "^2.3.0",
|
|
127
|
-
"@types/jest": "^29.5.14",
|
|
128
122
|
"@types/node": "^20.0.0",
|
|
129
123
|
"@types/react": "^18.0.0",
|
|
130
124
|
"@types/react-dom": "^18.0.0",
|
|
@@ -132,7 +126,6 @@
|
|
|
132
126
|
"@typescript-eslint/parser": "^6.0.0",
|
|
133
127
|
"@vitejs/plugin-react": "^4.0.0",
|
|
134
128
|
"autoprefixer": "^10.4.21",
|
|
135
|
-
"babel-jest": "^29.0.0",
|
|
136
129
|
"concurrently": "^8.0.0",
|
|
137
130
|
"cssnano": "^6.0.0",
|
|
138
131
|
"eslint": "^8.0.0",
|
|
@@ -141,8 +134,6 @@
|
|
|
141
134
|
"eslint-plugin-react": "^7.33.0",
|
|
142
135
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
143
136
|
"identity-obj-proxy": "^3.0.0",
|
|
144
|
-
"jest": "^29.0.0",
|
|
145
|
-
"jest-environment-jsdom": "^29.0.0",
|
|
146
137
|
"jsdom": "^22.0.0",
|
|
147
138
|
"postcss": "^8.4.31",
|
|
148
139
|
"postcss-flexbugs-fixes": "^5.0.0",
|
|
@@ -159,8 +150,6 @@
|
|
|
159
150
|
"sass": "^1.69.0",
|
|
160
151
|
"storybook": "^8.6.14",
|
|
161
152
|
"storybook-theme-switch-addon": "^1.0.2",
|
|
162
|
-
"terser": "^5.0.0",
|
|
163
|
-
"ts-jest": "^29.0.0",
|
|
164
153
|
"ts-node": "^10.9.0",
|
|
165
154
|
"tslib": "^2.6.0",
|
|
166
155
|
"typescript": "^5.0.0",
|
|
@@ -231,7 +220,7 @@
|
|
|
231
220
|
"react-dom": "^18.0.0"
|
|
232
221
|
},
|
|
233
222
|
"engines": {
|
|
234
|
-
"node": ">=
|
|
223
|
+
"node": ">=18.0.0",
|
|
235
224
|
"npm": ">=8.0.0"
|
|
236
225
|
},
|
|
237
226
|
"publishConfig": {
|
|
@@ -321,7 +321,6 @@ export const GlassCustom: Story = {
|
|
|
321
321
|
displacementScale: 180,
|
|
322
322
|
blurAmount: 3,
|
|
323
323
|
saturation: 60,
|
|
324
|
-
cornerRadius: 4,
|
|
325
324
|
mode: 'polar',
|
|
326
325
|
} as AtomixGlassProps as any,
|
|
327
326
|
},
|
|
@@ -377,7 +376,6 @@ export const GlassGroup: Story = {
|
|
|
377
376
|
displacementScale: 180,
|
|
378
377
|
blurAmount: 1,
|
|
379
378
|
saturation: 60,
|
|
380
|
-
cornerRadius: 4,
|
|
381
379
|
mode: 'shader',
|
|
382
380
|
ShaderVariant: 'premiumGlass',
|
|
383
381
|
} as any,
|
|
@@ -459,19 +457,13 @@ export const GlassModeStandard: Story = {
|
|
|
459
457
|
<p>The standard mode provides a refined glass appearance perfect for elegant interfaces.</p>
|
|
460
458
|
</div>
|
|
461
459
|
),
|
|
462
|
-
glass:
|
|
463
|
-
mode: 'standard',
|
|
464
|
-
displacementScale: 60,
|
|
465
|
-
blurAmount: 2,
|
|
466
|
-
saturation: 160,
|
|
467
|
-
aberrationIntensity: 2,
|
|
468
|
-
cornerRadius: 4,
|
|
469
|
-
} as any,
|
|
460
|
+
glass: true,
|
|
470
461
|
},
|
|
471
462
|
render: args => (
|
|
472
463
|
<div
|
|
473
464
|
style={{
|
|
474
|
-
background:
|
|
465
|
+
background:
|
|
466
|
+
'url(https://images.unsplash.com/photo-1689960159745-fbc6434d4434?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80&w=1335)',
|
|
475
467
|
backgroundSize: 'cover',
|
|
476
468
|
backgroundPosition: 'center',
|
|
477
469
|
padding: '3rem',
|
|
@@ -513,7 +505,6 @@ export const GlassModePolar: Story = {
|
|
|
513
505
|
blurAmount: 1.5,
|
|
514
506
|
saturation: 180,
|
|
515
507
|
aberrationIntensity: 3,
|
|
516
|
-
cornerRadius: 4,
|
|
517
508
|
} as any,
|
|
518
509
|
},
|
|
519
510
|
render: args => (
|
|
@@ -559,7 +550,6 @@ export const GlassModeProminent: Story = {
|
|
|
559
550
|
blurAmount: 2.5,
|
|
560
551
|
saturation: 200,
|
|
561
552
|
aberrationIntensity: 4,
|
|
562
|
-
cornerRadius: 4,
|
|
563
553
|
} as any,
|
|
564
554
|
},
|
|
565
555
|
render: args => (
|
|
@@ -605,7 +595,6 @@ export const GlassModeShader: Story = {
|
|
|
605
595
|
displacementScale: 70,
|
|
606
596
|
blurAmount: 1.8,
|
|
607
597
|
saturation: 170,
|
|
608
|
-
cornerRadius: 4,
|
|
609
598
|
} as any,
|
|
610
599
|
},
|
|
611
600
|
render: args => (
|
|
@@ -685,18 +674,7 @@ export const AllGlassModesComparison: Story = {
|
|
|
685
674
|
>
|
|
686
675
|
Standard Mode
|
|
687
676
|
</h3>
|
|
688
|
-
<Accordion
|
|
689
|
-
title="Standard Glass"
|
|
690
|
-
glass={
|
|
691
|
-
{
|
|
692
|
-
mode: 'standard',
|
|
693
|
-
displacementScale: 60,
|
|
694
|
-
blurAmount: 2,
|
|
695
|
-
saturation: 160,
|
|
696
|
-
aberrationIntensity: 2,
|
|
697
|
-
} as any
|
|
698
|
-
}
|
|
699
|
-
>
|
|
677
|
+
<Accordion title="Standard Glass" glass={true}>
|
|
700
678
|
<p>Classic blur and displacement effects for a refined glass appearance.</p>
|
|
701
679
|
</Accordion>
|
|
702
680
|
</div>
|
|
@@ -48,6 +48,11 @@ export interface AccordionProps extends BaseComponentProps {
|
|
|
48
48
|
* Can be a boolean to enable with default settings, or an object with AtomixGlassProps to customize the effect
|
|
49
49
|
*/
|
|
50
50
|
glass?: AtomixGlassProps | boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Custom style for the accordion
|
|
54
|
+
*/
|
|
55
|
+
style?: React.CSSProperties;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
58
|
export const Accordion: React.FC<AccordionProps> = ({
|
|
@@ -60,6 +65,7 @@ export const Accordion: React.FC<AccordionProps> = ({
|
|
|
60
65
|
iconPosition = 'right',
|
|
61
66
|
icon,
|
|
62
67
|
className = '',
|
|
68
|
+
style,
|
|
63
69
|
glass,
|
|
64
70
|
}) => {
|
|
65
71
|
// Generate unique IDs for accessibility
|
|
@@ -86,7 +92,7 @@ export const Accordion: React.FC<AccordionProps> = ({
|
|
|
86
92
|
|
|
87
93
|
// Default icon
|
|
88
94
|
const defaultIcon = (
|
|
89
|
-
<i className="c-accordion__icon">
|
|
95
|
+
<i className="c-accordion__icon" aria-hidden="true">
|
|
90
96
|
<svg
|
|
91
97
|
xmlns="http://www.w3.org/2000/svg"
|
|
92
98
|
width="24"
|
|
@@ -97,6 +103,8 @@ export const Accordion: React.FC<AccordionProps> = ({
|
|
|
97
103
|
strokeWidth="2"
|
|
98
104
|
strokeLinecap="round"
|
|
99
105
|
strokeLinejoin="round"
|
|
106
|
+
aria-hidden="true"
|
|
107
|
+
focusable="false"
|
|
100
108
|
>
|
|
101
109
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
102
110
|
</svg>
|
|
@@ -104,13 +112,17 @@ export const Accordion: React.FC<AccordionProps> = ({
|
|
|
104
112
|
);
|
|
105
113
|
|
|
106
114
|
const accordionContent = (
|
|
107
|
-
<div
|
|
115
|
+
<div
|
|
116
|
+
className={generateClassNames(className) + (glass ? ' c-accordion--glass' : '')}
|
|
117
|
+
style={style}
|
|
118
|
+
>
|
|
108
119
|
<button
|
|
109
120
|
id={buttonId}
|
|
110
121
|
className={generateHeaderClassNames()}
|
|
111
122
|
onClick={toggle}
|
|
112
123
|
aria-expanded={state.isOpen}
|
|
113
124
|
aria-controls={panelId}
|
|
125
|
+
aria-disabled={disabled}
|
|
114
126
|
disabled={disabled}
|
|
115
127
|
type="button"
|
|
116
128
|
>
|
|
@@ -124,7 +136,10 @@ export const Accordion: React.FC<AccordionProps> = ({
|
|
|
124
136
|
role="region"
|
|
125
137
|
aria-labelledby={buttonId}
|
|
126
138
|
>
|
|
127
|
-
<div
|
|
139
|
+
<div
|
|
140
|
+
className={ACCORDION.SELECTORS.BODY.replace('.', '')}
|
|
141
|
+
ref={contentRef as React.RefObject<HTMLDivElement>}
|
|
142
|
+
>
|
|
128
143
|
{children}
|
|
129
144
|
</div>
|
|
130
145
|
</div>
|
|
@@ -134,19 +149,13 @@ export const Accordion: React.FC<AccordionProps> = ({
|
|
|
134
149
|
if (glass) {
|
|
135
150
|
// Default glass settings for accordions
|
|
136
151
|
const defaultGlassProps = {
|
|
137
|
-
displacementScale:
|
|
138
|
-
|
|
139
|
-
cornerRadius: 4,
|
|
140
|
-
mode: 'shader' as const,
|
|
152
|
+
displacementScale: 20,
|
|
153
|
+
elasticity: 0,
|
|
141
154
|
};
|
|
142
155
|
|
|
143
156
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
144
157
|
|
|
145
|
-
return
|
|
146
|
-
<AtomixGlass {...glassProps}>
|
|
147
|
-
{accordionContent}
|
|
148
|
-
</AtomixGlass>
|
|
149
|
-
);
|
|
158
|
+
return <AtomixGlass {...glassProps}>{accordionContent}</AtomixGlass>;
|
|
150
159
|
}
|
|
151
160
|
|
|
152
161
|
return accordionContent;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { vi } from 'vitest';
|
|
4
5
|
import AtomixGlass from './AtomixGlass';
|
|
5
6
|
|
|
6
7
|
// Mock the ShaderDisplacementGenerator since it uses browser APIs
|
|
7
|
-
|
|
8
|
+
vi.mock('./shader-utils', () => ({
|
|
8
9
|
ShaderDisplacementGenerator: class MockShaderDisplacementGenerator {
|
|
9
10
|
updateShader() {
|
|
10
11
|
return 'data:image/png;base64,mockBase64String';
|
|
@@ -12,7 +13,7 @@ jest.mock('./shader-utils', () => ({
|
|
|
12
13
|
destroy() {}
|
|
13
14
|
},
|
|
14
15
|
fragmentShaders: {
|
|
15
|
-
liquidGlass:
|
|
16
|
+
liquidGlass: vi.fn(),
|
|
16
17
|
},
|
|
17
18
|
}));
|
|
18
19
|
|
|
@@ -23,7 +24,7 @@ describe('AtomixGlass Component', () => {
|
|
|
23
24
|
<div data-testid="test-content">Test Content</div>
|
|
24
25
|
</AtomixGlass>
|
|
25
26
|
);
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
expect(screen.getByTestId('test-content')).toBeInTheDocument();
|
|
28
29
|
expect(screen.getByText('Test Content')).toBeInTheDocument();
|
|
29
30
|
});
|
|
@@ -34,40 +35,42 @@ describe('AtomixGlass Component', () => {
|
|
|
34
35
|
<div>Content</div>
|
|
35
36
|
</AtomixGlass>
|
|
36
37
|
);
|
|
37
|
-
|
|
38
|
-
expect(container.querySelector('.c-
|
|
38
|
+
|
|
39
|
+
expect(container.querySelector('.c-atomix-glass__container')).toHaveClass('custom-class');
|
|
39
40
|
});
|
|
40
41
|
|
|
41
42
|
test('renders with showHoverEffects enabled', () => {
|
|
42
43
|
render(
|
|
43
|
-
<AtomixGlass
|
|
44
|
+
<AtomixGlass>
|
|
44
45
|
<div>Test Content</div>
|
|
45
46
|
</AtomixGlass>
|
|
46
47
|
);
|
|
47
|
-
|
|
48
|
+
|
|
48
49
|
// Check that hover effects are enabled
|
|
49
50
|
expect(screen.getByTestId('atomix-glass')).toHaveAttribute('data-hover-effects', 'true');
|
|
50
51
|
});
|
|
51
52
|
|
|
52
53
|
test('applies clickable class when onClick is provided', () => {
|
|
53
|
-
const handleClick =
|
|
54
|
+
const handleClick = vi.fn();
|
|
54
55
|
const { container } = render(
|
|
55
56
|
<AtomixGlass onClick={handleClick}>
|
|
56
57
|
<div>Content</div>
|
|
57
58
|
</AtomixGlass>
|
|
58
59
|
);
|
|
59
|
-
|
|
60
|
-
expect(container.querySelector('.c-
|
|
60
|
+
|
|
61
|
+
expect(container.querySelector('.c-atomix-glass__container')).toHaveClass(
|
|
62
|
+
'c-atomix-glass__container--clickable'
|
|
63
|
+
);
|
|
61
64
|
});
|
|
62
65
|
|
|
63
66
|
test('calls onClick when clicked', async () => {
|
|
64
|
-
const handleClick =
|
|
67
|
+
const handleClick = vi.fn();
|
|
65
68
|
render(
|
|
66
69
|
<AtomixGlass onClick={handleClick}>
|
|
67
70
|
<div>Content</div>
|
|
68
71
|
</AtomixGlass>
|
|
69
72
|
);
|
|
70
|
-
|
|
73
|
+
|
|
71
74
|
await userEvent.click(screen.getByText('Content'));
|
|
72
75
|
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
73
76
|
});
|
|
@@ -78,8 +81,82 @@ describe('AtomixGlass Component', () => {
|
|
|
78
81
|
<div>Content</div>
|
|
79
82
|
</AtomixGlass>
|
|
80
83
|
);
|
|
81
|
-
|
|
82
|
-
expect(container.querySelector('.c-
|
|
84
|
+
|
|
85
|
+
expect(container.querySelector('.c-atomix-glass__container')).toHaveClass(
|
|
86
|
+
'c-atomix-glass__container--over-light'
|
|
87
|
+
);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('does not apply overLight class when overLight prop is false', () => {
|
|
91
|
+
const { container } = render(
|
|
92
|
+
<AtomixGlass overLight={false}>
|
|
93
|
+
<div>Content</div>
|
|
94
|
+
</AtomixGlass>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
expect(container.querySelector('.c-atomix-glass__container')).not.toHaveClass(
|
|
98
|
+
'c-atomix-glass__container--over-light'
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test('handles overLight="auto" mode', () => {
|
|
103
|
+
// Mock window.getComputedStyle to simulate a light background
|
|
104
|
+
const originalGetComputedStyle = window.getComputedStyle;
|
|
105
|
+
window.getComputedStyle = vi.fn(() => ({
|
|
106
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
107
|
+
backgroundImage: 'none',
|
|
108
|
+
})) as any;
|
|
109
|
+
|
|
110
|
+
const { container } = render(
|
|
111
|
+
<AtomixGlass overLight="auto">
|
|
112
|
+
<div>Content</div>
|
|
113
|
+
</AtomixGlass>
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
// Note: Auto-detection happens asynchronously, so we can't immediately test
|
|
117
|
+
// but we can verify the component renders without errors
|
|
118
|
+
expect(container.querySelector('.c-atomix-glass__container')).toBeInTheDocument();
|
|
119
|
+
|
|
120
|
+
// Restore original
|
|
121
|
+
window.getComputedStyle = originalGetComputedStyle;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('handles overLight object config', () => {
|
|
125
|
+
const { container } = render(
|
|
126
|
+
<AtomixGlass
|
|
127
|
+
overLight={{
|
|
128
|
+
threshold: 0.8,
|
|
129
|
+
opacity: 0.5,
|
|
130
|
+
contrast: 1.5,
|
|
131
|
+
brightness: 1.1,
|
|
132
|
+
saturationBoost: 1.8,
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
<div>Content</div>
|
|
136
|
+
</AtomixGlass>
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
// Verify component renders with object config
|
|
140
|
+
expect(container.querySelector('.c-atomix-glass__container')).toBeInTheDocument();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
test('handles invalid overLight object config values gracefully', () => {
|
|
144
|
+
const { container } = render(
|
|
145
|
+
<AtomixGlass
|
|
146
|
+
overLight={{
|
|
147
|
+
threshold: NaN,
|
|
148
|
+
opacity: -1,
|
|
149
|
+
contrast: Infinity,
|
|
150
|
+
brightness: -100,
|
|
151
|
+
saturationBoost: 'invalid' as any,
|
|
152
|
+
}}
|
|
153
|
+
>
|
|
154
|
+
<div>Content</div>
|
|
155
|
+
</AtomixGlass>
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// Should render without errors, using default/validated values
|
|
159
|
+
expect(container.querySelector('.c-atomix-glass__container')).toBeInTheDocument();
|
|
83
160
|
});
|
|
84
161
|
|
|
85
162
|
test('applies custom style', () => {
|
|
@@ -89,8 +166,8 @@ describe('AtomixGlass Component', () => {
|
|
|
89
166
|
<div>Content</div>
|
|
90
167
|
</AtomixGlass>
|
|
91
168
|
);
|
|
92
|
-
|
|
93
|
-
const glassContainer = container.querySelector('.c-
|
|
169
|
+
|
|
170
|
+
const glassContainer = container.querySelector('.c-atomix-glass__container');
|
|
94
171
|
expect(glassContainer).toHaveStyle('background-color: red');
|
|
95
172
|
});
|
|
96
173
|
|
|
@@ -100,17 +177,17 @@ describe('AtomixGlass Component', () => {
|
|
|
100
177
|
<div>Content</div>
|
|
101
178
|
</AtomixGlass>
|
|
102
179
|
);
|
|
103
|
-
|
|
180
|
+
|
|
104
181
|
// Check if the filter element exists
|
|
105
182
|
expect(container.querySelector('svg')).toBeInTheDocument();
|
|
106
183
|
});
|
|
107
184
|
|
|
108
185
|
test('handles mouse events correctly', async () => {
|
|
109
|
-
const handleMouseEnter =
|
|
110
|
-
const handleMouseLeave =
|
|
111
|
-
const handleMouseDown =
|
|
112
|
-
const handleMouseUp =
|
|
113
|
-
|
|
186
|
+
const handleMouseEnter = vi.fn();
|
|
187
|
+
const handleMouseLeave = vi.fn();
|
|
188
|
+
const handleMouseDown = vi.fn();
|
|
189
|
+
const handleMouseUp = vi.fn();
|
|
190
|
+
|
|
114
191
|
render(
|
|
115
192
|
<AtomixGlass
|
|
116
193
|
onClick={() => {
|
|
@@ -123,25 +200,26 @@ describe('AtomixGlass Component', () => {
|
|
|
123
200
|
<div>Content</div>
|
|
124
201
|
</AtomixGlass>
|
|
125
202
|
);
|
|
126
|
-
|
|
203
|
+
|
|
127
204
|
const glassContent = screen.getByText('Content').parentElement;
|
|
128
205
|
if (!glassContent) throw new Error('Glass content not found');
|
|
129
|
-
|
|
206
|
+
|
|
130
207
|
await userEvent.hover(glassContent);
|
|
131
208
|
expect(handleMouseEnter).toHaveBeenCalledTimes(1);
|
|
132
|
-
|
|
209
|
+
|
|
133
210
|
await userEvent.unhover(glassContent);
|
|
134
211
|
expect(handleMouseLeave).toHaveBeenCalledTimes(1);
|
|
135
|
-
|
|
212
|
+
|
|
136
213
|
await userEvent.pointer([{ keys: '[MouseLeft>]', target: glassContent }]);
|
|
137
214
|
expect(handleMouseDown).toHaveBeenCalledTimes(1);
|
|
138
|
-
|
|
215
|
+
|
|
139
216
|
await userEvent.pointer([{ keys: '[/MouseLeft]', target: glassContent }]);
|
|
140
217
|
expect(handleMouseUp).toHaveBeenCalledTimes(1);
|
|
141
218
|
});
|
|
142
219
|
});
|
|
143
220
|
|
|
144
221
|
// Visual regression tests
|
|
222
|
+
// Keep only a single smoke snapshot to detect catastrophic DOM changes.
|
|
145
223
|
describe('AtomixGlass Visual Regression', () => {
|
|
146
224
|
test('matches snapshot with default props', () => {
|
|
147
225
|
const { container } = render(
|
|
@@ -149,51 +227,7 @@ describe('AtomixGlass Visual Regression', () => {
|
|
|
149
227
|
<div>Default Glass</div>
|
|
150
228
|
</AtomixGlass>
|
|
151
229
|
);
|
|
152
|
-
|
|
153
|
-
expect(container).toMatchSnapshot();
|
|
154
|
-
});
|
|
155
230
|
|
|
156
|
-
test('matches snapshot with custom props', () => {
|
|
157
|
-
const { container } = render(
|
|
158
|
-
<AtomixGlass
|
|
159
|
-
displacementScale={30}
|
|
160
|
-
blurAmount={15}
|
|
161
|
-
saturation={200}
|
|
162
|
-
aberrationIntensity={3}
|
|
163
|
-
cornerRadius={15}
|
|
164
|
-
overLight={true}
|
|
165
|
-
mode="polar"
|
|
166
|
-
>
|
|
167
|
-
<div>Custom Glass</div>
|
|
168
|
-
</AtomixGlass>
|
|
169
|
-
);
|
|
170
|
-
|
|
171
231
|
expect(container).toMatchSnapshot();
|
|
172
232
|
});
|
|
173
|
-
|
|
174
|
-
test('matches snapshot with shader mode', () => {
|
|
175
|
-
const { container } = render(
|
|
176
|
-
<AtomixGlass
|
|
177
|
-
mode="shader"
|
|
178
|
-
displacementScale={25}
|
|
179
|
-
blurAmount={12}
|
|
180
|
-
saturation={180}
|
|
181
|
-
aberrationIntensity={2}
|
|
182
|
-
>
|
|
183
|
-
<div>Shader Glass</div>
|
|
184
|
-
</AtomixGlass>
|
|
185
|
-
);
|
|
186
|
-
|
|
187
|
-
expect(container).toMatchSnapshot();
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
test('matches snapshot with showHoverEffects', () => {
|
|
191
|
-
const { container } = render(
|
|
192
|
-
<AtomixGlass>
|
|
193
|
-
<div>Glass with Hover Effects</div>
|
|
194
|
-
</AtomixGlass>
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
expect(container).toMatchSnapshot();
|
|
198
|
-
});
|
|
199
|
-
});
|
|
233
|
+
});
|