@shohojdhara/atomix 0.4.1 → 0.4.2
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 +9341 -9249
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +12 -19
- package/dist/charts.js +555 -358
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +16 -23
- package/dist/core.js +418 -262
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +11 -18
- package/dist/forms.js +411 -257
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +14 -21
- package/dist/heavy.js +408 -254
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +33 -40
- package/dist/index.esm.js +663 -453
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +667 -460
- 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 +1 -1
- package/scripts/atomix-cli.js +34 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
- package/src/components/AtomixGlass/README.md +5 -5
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +90 -76
- package/src/components/Breadcrumb/index.ts +2 -2
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/README.md +2 -2
- package/src/components/Callout/Callout.test.tsx +3 -3
- package/src/components/Callout/Callout.tsx +2 -2
- package/src/components/Callout/README.md +2 -2
- package/src/components/Chart/Chart.stories.tsx +1 -1
- package/src/components/Chart/Chart.tsx +5 -5
- package/src/components/Chart/TreemapChart.tsx +37 -29
- package/src/components/DatePicker/readme.md +3 -3
- package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
- package/src/components/Form/Checkbox.stories.tsx +1 -1
- package/src/components/Form/Checkbox.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +1 -1
- package/src/components/Form/Input.tsx +1 -1
- package/src/components/Form/Radio.stories.tsx +1 -1
- package/src/components/Form/Radio.tsx +1 -1
- package/src/components/Form/Select.stories.tsx +1 -1
- package/src/components/Form/Select.tsx +1 -1
- package/src/components/Form/Textarea.stories.tsx +1 -1
- package/src/components/Form/Textarea.tsx +1 -1
- package/src/components/Hero/Hero.stories.tsx +2 -2
- package/src/components/Hero/Hero.tsx +2 -2
- package/src/components/Messages/Messages.stories.tsx +1 -1
- package/src/components/Messages/Messages.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +1 -1
- package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +1 -1
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
- package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/Rating/Rating.stories.tsx +1 -1
- package/src/components/Rating/Rating.test.tsx +73 -0
- package/src/components/Rating/Rating.tsx +25 -37
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.tsx +2 -2
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +1 -1
- package/src/components/Todo/Todo.tsx +0 -1
- package/src/components/Toggle/Toggle.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
- package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
- package/src/lib/composables/__tests__/useChart.test.ts +50 -0
- package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
- package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
- package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
- package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
- package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
- package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
- package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
- package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
- package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
- package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
- package/src/lib/composables/glass-styles.ts +302 -0
- package/src/lib/composables/index.ts +0 -4
- package/src/lib/composables/useAtomixGlass.ts +331 -522
- package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
- package/src/lib/composables/useBarChart.ts +1 -1
- package/src/lib/composables/useBreadcrumb.ts +6 -6
- package/src/lib/composables/useChart.ts +104 -21
- package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
- package/src/lib/composables/useSlider.ts +66 -34
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
- package/src/lib/types/components.ts +13 -21
- package/src/lib/utils/__tests__/dom.test.ts +100 -0
- package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
- package/src/styles/02-tools/_tools.breakpoints.scss +1 -1
- package/src/styles/02-tools/_tools.utility-api.scss +6 -6
- package/src/styles/06-components/_components.accordion.scss +0 -2
- package/src/styles/06-components/_components.chart.scss +0 -1
- package/src/styles/06-components/_components.dropdown.scss +0 -1
- package/src/styles/06-components/_components.edge-panel.scss +0 -2
- package/src/styles/06-components/_components.photoviewer.scss +0 -1
- package/src/styles/06-components/_components.river.scss +0 -1
- package/src/styles/06-components/_components.slider.scss +0 -3
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
- package/src/styles/99-utilities/_utilities.text.scss +1 -0
|
@@ -66,7 +66,7 @@ const meta: Meta<typeof AtomixGlass> = {
|
|
|
66
66
|
description: 'Elasticity factor for mouse interactions (default: 0.15)',
|
|
67
67
|
table: { defaultValue: { summary: '0.15' } },
|
|
68
68
|
},
|
|
69
|
-
|
|
69
|
+
borderRadius: {
|
|
70
70
|
control: { type: 'range', min: 0, max: 50, step: 1 },
|
|
71
71
|
description: 'Corner radius in pixels (default: 20)',
|
|
72
72
|
table: { defaultValue: { summary: '20' } },
|
|
@@ -137,12 +137,12 @@ const meta: Meta<typeof AtomixGlass> = {
|
|
|
137
137
|
description: 'Override for high contrast preference (default: false)',
|
|
138
138
|
table: { defaultValue: { summary: 'false' } },
|
|
139
139
|
},
|
|
140
|
-
|
|
140
|
+
withoutEffects: {
|
|
141
141
|
control: 'boolean',
|
|
142
142
|
description: 'Disable all visual effects (default: false)',
|
|
143
143
|
table: { defaultValue: { summary: 'false' } },
|
|
144
144
|
},
|
|
145
|
-
|
|
145
|
+
debugPerformance: {
|
|
146
146
|
control: 'boolean',
|
|
147
147
|
description: 'Enable performance monitoring (default: false)',
|
|
148
148
|
table: { defaultValue: { summary: 'false' } },
|
|
@@ -299,13 +299,13 @@ export const Playground: Story = {
|
|
|
299
299
|
saturation: 140,
|
|
300
300
|
aberrationIntensity: 2,
|
|
301
301
|
elasticity: 0.15,
|
|
302
|
-
|
|
302
|
+
borderRadius: 20,
|
|
303
303
|
overLight: false,
|
|
304
304
|
reducedMotion: false,
|
|
305
305
|
highContrast: false,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
306
|
+
withoutEffects: false,
|
|
307
|
+
withLiquidBlur: false,
|
|
308
|
+
withBorder: true,
|
|
309
309
|
});
|
|
310
310
|
|
|
311
311
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -333,13 +333,13 @@ export const Playground: Story = {
|
|
|
333
333
|
saturation: 110,
|
|
334
334
|
aberrationIntensity: 0.5,
|
|
335
335
|
elasticity: 0.05,
|
|
336
|
-
|
|
336
|
+
borderRadius: 12,
|
|
337
337
|
overLight: false,
|
|
338
338
|
reducedMotion: false,
|
|
339
339
|
highContrast: false,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
withoutEffects: false,
|
|
341
|
+
withLiquidBlur: false,
|
|
342
|
+
withBorder: true,
|
|
343
343
|
},
|
|
344
344
|
mode: 'standard' as const,
|
|
345
345
|
shader: 'liquidGlass' as const,
|
|
@@ -353,13 +353,13 @@ export const Playground: Story = {
|
|
|
353
353
|
saturation: 140,
|
|
354
354
|
aberrationIntensity: 2,
|
|
355
355
|
elasticity: 0.15,
|
|
356
|
-
|
|
356
|
+
borderRadius: 20,
|
|
357
357
|
overLight: false,
|
|
358
358
|
reducedMotion: false,
|
|
359
359
|
highContrast: false,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
360
|
+
withoutEffects: false,
|
|
361
|
+
withLiquidBlur: false,
|
|
362
|
+
withBorder: true,
|
|
363
363
|
},
|
|
364
364
|
mode: 'standard' as const,
|
|
365
365
|
shader: 'liquidGlass' as const,
|
|
@@ -373,13 +373,13 @@ export const Playground: Story = {
|
|
|
373
373
|
saturation: 170,
|
|
374
374
|
aberrationIntensity: 3.5,
|
|
375
375
|
elasticity: 0.25,
|
|
376
|
-
|
|
376
|
+
borderRadius: 28,
|
|
377
377
|
overLight: false,
|
|
378
378
|
reducedMotion: false,
|
|
379
379
|
highContrast: false,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
withoutEffects: false,
|
|
381
|
+
withLiquidBlur: true,
|
|
382
|
+
withBorder: true,
|
|
383
383
|
},
|
|
384
384
|
mode: 'prominent' as const,
|
|
385
385
|
shader: 'plasma' as const,
|
|
@@ -393,13 +393,13 @@ export const Playground: Story = {
|
|
|
393
393
|
saturation: 200,
|
|
394
394
|
aberrationIntensity: 5,
|
|
395
395
|
elasticity: 0.35,
|
|
396
|
-
|
|
396
|
+
borderRadius: 32,
|
|
397
397
|
overLight: false,
|
|
398
398
|
reducedMotion: false,
|
|
399
399
|
highContrast: false,
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
400
|
+
withoutEffects: false,
|
|
401
|
+
withLiquidBlur: true,
|
|
402
|
+
withBorder: true,
|
|
403
403
|
},
|
|
404
404
|
mode: 'shader' as const,
|
|
405
405
|
shader: 'waves' as const,
|
|
@@ -420,15 +420,15 @@ export const Playground: Story = {
|
|
|
420
420
|
saturation={${settings.saturation}}
|
|
421
421
|
aberrationIntensity={${settings.aberrationIntensity}}
|
|
422
422
|
elasticity={${settings.elasticity}}
|
|
423
|
-
|
|
423
|
+
borderRadius={${settings.borderRadius}}
|
|
424
424
|
overLight={${settings.overLight}}
|
|
425
425
|
mode="${selectedMode}"
|
|
426
426
|
shaderVariant="${selectedShader}"
|
|
427
427
|
reducedMotion={${settings.reducedMotion}}
|
|
428
428
|
highContrast={${settings.highContrast}}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
429
|
+
withoutEffects={${settings.withoutEffects}}
|
|
430
|
+
withLiquidBlur={${settings.withLiquidBlur}}
|
|
431
|
+
withBorder={${settings.withBorder}}
|
|
432
432
|
>
|
|
433
433
|
<div className="your-content">
|
|
434
434
|
{/* Your content here */}
|
|
@@ -729,7 +729,7 @@ export const Playground: Story = {
|
|
|
729
729
|
? 300
|
|
730
730
|
: key === 'aberrationIntensity'
|
|
731
731
|
? 10
|
|
732
|
-
: key === '
|
|
732
|
+
: key === 'borderRadius'
|
|
733
733
|
? 100
|
|
734
734
|
: key === 'blurAmount'
|
|
735
735
|
? 10
|
|
@@ -872,13 +872,13 @@ export const Playground: Story = {
|
|
|
872
872
|
saturation: 140,
|
|
873
873
|
aberrationIntensity: 2,
|
|
874
874
|
elasticity: 0.15,
|
|
875
|
-
|
|
875
|
+
borderRadius: 20,
|
|
876
876
|
overLight: false,
|
|
877
877
|
reducedMotion: false,
|
|
878
878
|
highContrast: false,
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
879
|
+
withoutEffects: false,
|
|
880
|
+
withLiquidBlur: false,
|
|
881
|
+
withBorder: true,
|
|
882
882
|
});
|
|
883
883
|
setSelectedMode('standard');
|
|
884
884
|
setSelectedShader('liquidGlass');
|
|
@@ -906,7 +906,7 @@ export const Playground: Story = {
|
|
|
906
906
|
<AtomixGlass
|
|
907
907
|
displacementScale={80}
|
|
908
908
|
aberrationIntensity={1}
|
|
909
|
-
|
|
909
|
+
borderRadius={16}
|
|
910
910
|
saturation={120}
|
|
911
911
|
>
|
|
912
912
|
<div style={{ padding: '2.5rem' }}>
|
|
@@ -980,15 +980,15 @@ export const Playground: Story = {
|
|
|
980
980
|
saturation={settings.saturation}
|
|
981
981
|
aberrationIntensity={settings.aberrationIntensity}
|
|
982
982
|
elasticity={settings.elasticity}
|
|
983
|
-
|
|
983
|
+
borderRadius={settings.borderRadius}
|
|
984
984
|
overLight={settings.overLight}
|
|
985
985
|
mode={selectedMode}
|
|
986
986
|
shaderVariant={selectedShader as any}
|
|
987
987
|
reducedMotion={settings.reducedMotion}
|
|
988
988
|
highContrast={settings.highContrast}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
989
|
+
withoutEffects={settings.withoutEffects}
|
|
990
|
+
withLiquidBlur={settings.withLiquidBlur}
|
|
991
|
+
withBorder={settings.withBorder}
|
|
992
992
|
style={{ width: '100%' }}
|
|
993
993
|
>
|
|
994
994
|
<div style={{ padding: '2.5rem', textAlign: 'center' }}>
|
|
@@ -1150,31 +1150,31 @@ export const Playground: Story = {
|
|
|
1150
1150
|
style={{
|
|
1151
1151
|
padding: '4px 12px',
|
|
1152
1152
|
borderRadius: '12px',
|
|
1153
|
-
background: settings.
|
|
1153
|
+
background: settings.withLiquidBlur
|
|
1154
1154
|
? 'rgba(122, 255, 215, 0.2)'
|
|
1155
1155
|
: 'rgba(255,255,255,0.1)',
|
|
1156
1156
|
fontSize: '0.75rem',
|
|
1157
|
-
border: settings.
|
|
1157
|
+
border: settings.withLiquidBlur
|
|
1158
1158
|
? '1px solid #7AFFD7'
|
|
1159
1159
|
: '1px solid transparent',
|
|
1160
1160
|
}}
|
|
1161
1161
|
>
|
|
1162
|
-
{settings.
|
|
1162
|
+
{settings.withLiquidBlur ? '✓' : '○'} Liquid Blur
|
|
1163
1163
|
</div>
|
|
1164
1164
|
<div
|
|
1165
1165
|
style={{
|
|
1166
1166
|
padding: '4px 12px',
|
|
1167
1167
|
borderRadius: '12px',
|
|
1168
|
-
background: settings.
|
|
1168
|
+
background: settings.withBorder
|
|
1169
1169
|
? 'rgba(122, 255, 215, 0.2)'
|
|
1170
1170
|
: 'rgba(255,255,255,0.1)',
|
|
1171
1171
|
fontSize: '0.75rem',
|
|
1172
|
-
border: settings.
|
|
1172
|
+
border: settings.withBorder
|
|
1173
1173
|
? '1px solid #7AFFD7'
|
|
1174
1174
|
: '1px solid transparent',
|
|
1175
1175
|
}}
|
|
1176
1176
|
>
|
|
1177
|
-
{settings.
|
|
1177
|
+
{settings.withBorder ? '✓' : '○'} Border Effect
|
|
1178
1178
|
</div>
|
|
1179
1179
|
<div
|
|
1180
1180
|
style={{
|
|
@@ -1238,7 +1238,7 @@ export const Playground: Story = {
|
|
|
1238
1238
|
<div>
|
|
1239
1239
|
<span className="u-opacity-70">Radius:</span>
|
|
1240
1240
|
<span className="u-font-semibold u-ml-2">
|
|
1241
|
-
{settings.
|
|
1241
|
+
{settings.borderRadius}px
|
|
1242
1242
|
</span>
|
|
1243
1243
|
</div>
|
|
1244
1244
|
<div>
|
|
@@ -1250,7 +1250,7 @@ export const Playground: Story = {
|
|
|
1250
1250
|
<div>
|
|
1251
1251
|
<span className="u-opacity-70">Effects:</span>
|
|
1252
1252
|
<span className="u-font-semibold u-ml-2">
|
|
1253
|
-
{settings.
|
|
1253
|
+
{settings.withoutEffects ? 'Disabled' : 'Enabled'}
|
|
1254
1254
|
</span>
|
|
1255
1255
|
</div>
|
|
1256
1256
|
</div>
|
|
@@ -125,7 +125,7 @@ export const LiquidGlass: Story = {
|
|
|
125
125
|
saturation: 150,
|
|
126
126
|
aberrationIntensity: 2,
|
|
127
127
|
elasticity: 0.2,
|
|
128
|
-
|
|
128
|
+
borderRadius: 32,
|
|
129
129
|
mode: 'shader',
|
|
130
130
|
shaderVariant: 'liquidGlass',
|
|
131
131
|
},
|
|
@@ -246,7 +246,7 @@ export const AppleFluid: Story = {
|
|
|
246
246
|
saturation: 150,
|
|
247
247
|
aberrationIntensity: 2,
|
|
248
248
|
elasticity: 0.2,
|
|
249
|
-
|
|
249
|
+
borderRadius: 32,
|
|
250
250
|
mode: 'shader',
|
|
251
251
|
shaderVariant: 'appleFluid',
|
|
252
252
|
},
|
|
@@ -367,7 +367,7 @@ export const PremiumGlass: Story = {
|
|
|
367
367
|
saturation: 150,
|
|
368
368
|
aberrationIntensity: 2,
|
|
369
369
|
elasticity: 0.2,
|
|
370
|
-
|
|
370
|
+
borderRadius: 32,
|
|
371
371
|
mode: 'shader',
|
|
372
372
|
shaderVariant: 'premiumGlass',
|
|
373
373
|
},
|
|
@@ -60,7 +60,7 @@ export const Badge: React.FC<BadgeProps> = memo(
|
|
|
60
60
|
// Default glass settings for badges
|
|
61
61
|
const defaultGlassProps = {
|
|
62
62
|
displacementScale: 20,
|
|
63
|
-
|
|
63
|
+
borderRadius: ref.current?.getBoundingClientRect().width
|
|
64
64
|
? ref.current?.getBoundingClientRect().width / 2
|
|
65
65
|
: 16,
|
|
66
66
|
className: 'c-badge--glass',
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {
|
|
2
|
+
ReactNode,
|
|
3
|
+
memo,
|
|
4
|
+
forwardRef,
|
|
5
|
+
Children,
|
|
6
|
+
cloneElement,
|
|
7
|
+
isValidElement,
|
|
8
|
+
ElementType,
|
|
9
|
+
} from 'react';
|
|
2
10
|
import { BREADCRUMB } from '../../lib/constants/components';
|
|
3
11
|
|
|
4
12
|
// Legacy Item Interface
|
|
@@ -39,8 +47,8 @@ export interface BreadcrumbItemData {
|
|
|
39
47
|
className?: string;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
|
-
//
|
|
43
|
-
export type
|
|
50
|
+
// Rename exported type to avoid conflict with the component constant
|
|
51
|
+
export type BreadcrumbItemType = BreadcrumbItemData;
|
|
44
52
|
|
|
45
53
|
// Compound Component Props
|
|
46
54
|
export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
@@ -62,12 +70,12 @@ export interface BreadcrumbItemProps extends React.HTMLAttributes<HTMLLIElement>
|
|
|
62
70
|
/**
|
|
63
71
|
* Optional click handler for the link
|
|
64
72
|
*/
|
|
65
|
-
onClick?: (event: React.MouseEvent<
|
|
73
|
+
onClick?: (event: React.MouseEvent<any>) => void;
|
|
66
74
|
|
|
67
75
|
/**
|
|
68
76
|
* Optional custom link component
|
|
69
77
|
*/
|
|
70
|
-
linkAs?: React.ElementType
|
|
78
|
+
linkAs?: React.ElementType<any>;
|
|
71
79
|
|
|
72
80
|
/**
|
|
73
81
|
* Link props to pass to the underlying anchor or LinkComponent
|
|
@@ -85,13 +93,17 @@ export const BreadcrumbItem = forwardRef<HTMLLIElement, BreadcrumbItemProps>(
|
|
|
85
93
|
onClick,
|
|
86
94
|
className = '',
|
|
87
95
|
style,
|
|
88
|
-
linkAs
|
|
96
|
+
linkAs,
|
|
89
97
|
linkProps = {},
|
|
90
98
|
...props
|
|
91
99
|
},
|
|
92
100
|
ref
|
|
93
101
|
) => {
|
|
94
|
-
const itemClasses = [
|
|
102
|
+
const itemClasses = [
|
|
103
|
+
BREADCRUMB.CLASSES.ITEM,
|
|
104
|
+
active ? BREADCRUMB.CLASSES.ACTIVE : '',
|
|
105
|
+
className,
|
|
106
|
+
]
|
|
95
107
|
.filter(Boolean)
|
|
96
108
|
.join(' ');
|
|
97
109
|
|
|
@@ -109,18 +121,16 @@ export const BreadcrumbItem = forwardRef<HTMLLIElement, BreadcrumbItemProps>(
|
|
|
109
121
|
...linkProps,
|
|
110
122
|
};
|
|
111
123
|
|
|
124
|
+
const LinkComponent = linkAs;
|
|
125
|
+
|
|
112
126
|
return (
|
|
113
127
|
<li ref={ref} className={itemClasses} style={style} {...props}>
|
|
114
128
|
{href && !active ? (
|
|
115
129
|
LinkComponent ? (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
{linkContent}
|
|
121
|
-
</Component>
|
|
122
|
-
);
|
|
123
|
-
})()
|
|
130
|
+
// @ts-ignore - Dynamic components are tricky in TS without stricter types
|
|
131
|
+
<LinkComponent href={href} {...commonLinkProps}>
|
|
132
|
+
{linkContent}
|
|
133
|
+
</LinkComponent>
|
|
124
134
|
) : (
|
|
125
135
|
<a href={href} {...(commonLinkProps as React.HTMLAttributes<HTMLAnchorElement>)}>
|
|
126
136
|
{linkContent}
|
|
@@ -173,72 +183,76 @@ export interface BreadcrumbProps {
|
|
|
173
183
|
children?: ReactNode;
|
|
174
184
|
}
|
|
175
185
|
|
|
176
|
-
|
|
186
|
+
const BreadcrumbComponent: React.FC<BreadcrumbProps> = memo(function BreadcrumbBase({
|
|
187
|
+
items,
|
|
188
|
+
divider,
|
|
189
|
+
className = '',
|
|
190
|
+
'aria-label': ariaLabel = 'Breadcrumb',
|
|
191
|
+
LinkComponent,
|
|
192
|
+
style,
|
|
193
|
+
children,
|
|
194
|
+
}: BreadcrumbProps) {
|
|
195
|
+
const breadcrumbClasses = [BREADCRUMB.CLASSES.BASE, className].filter(Boolean).join(' ');
|
|
196
|
+
|
|
197
|
+
let content: ReactNode;
|
|
198
|
+
|
|
199
|
+
if (items && items.length > 0) {
|
|
200
|
+
// Legacy rendering
|
|
201
|
+
content = items.map((item: BreadcrumbItemData, index: number) => {
|
|
202
|
+
const isLast = index === items.length - 1;
|
|
203
|
+
|
|
204
|
+
return (
|
|
205
|
+
<BreadcrumbItem
|
|
206
|
+
key={index}
|
|
207
|
+
href={item.href}
|
|
208
|
+
active={item.active || isLast}
|
|
209
|
+
icon={item.icon}
|
|
210
|
+
onClick={item.onClick as any}
|
|
211
|
+
className={item.className}
|
|
212
|
+
style={item.style}
|
|
213
|
+
linkAs={LinkComponent}
|
|
214
|
+
>
|
|
215
|
+
{item.label}
|
|
216
|
+
</BreadcrumbItem>
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
} else {
|
|
220
|
+
// Compound rendering
|
|
221
|
+
const childrenCount = Children.count(children);
|
|
222
|
+
content = Children.map(children, (child, index) => {
|
|
223
|
+
if (isValidElement(child)) {
|
|
224
|
+
const isLast = index === childrenCount - 1;
|
|
225
|
+
const childProps = child.props as any;
|
|
226
|
+
|
|
227
|
+
// Extract props from the child element
|
|
228
|
+
const { active, linkAs, ...otherProps } = childProps;
|
|
229
|
+
|
|
230
|
+
const newProps = {
|
|
231
|
+
active: active ?? (isLast ? true : undefined),
|
|
232
|
+
linkAs: linkAs ?? LinkComponent,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return cloneElement(child, newProps as any);
|
|
236
|
+
}
|
|
237
|
+
return child;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<nav aria-label={ariaLabel} style={style}>
|
|
243
|
+
<ol className={breadcrumbClasses}>{content}</ol>
|
|
244
|
+
</nav>
|
|
245
|
+
);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
export type BreadcrumbType = typeof BreadcrumbComponent & {
|
|
177
249
|
Item: typeof BreadcrumbItem;
|
|
178
250
|
};
|
|
179
251
|
|
|
180
|
-
export const Breadcrumb
|
|
181
|
-
({
|
|
182
|
-
items,
|
|
183
|
-
divider,
|
|
184
|
-
className = '',
|
|
185
|
-
'aria-label': ariaLabel = 'Breadcrumb',
|
|
186
|
-
LinkComponent,
|
|
187
|
-
style,
|
|
188
|
-
children,
|
|
189
|
-
}) => {
|
|
190
|
-
const breadcrumbClasses = [BREADCRUMB.CLASSES.BASE, className].filter(Boolean).join(' ');
|
|
191
|
-
|
|
192
|
-
let content: ReactNode;
|
|
193
|
-
|
|
194
|
-
if (items && items.length > 0) {
|
|
195
|
-
// Legacy rendering
|
|
196
|
-
content = items.map((item, index) => {
|
|
197
|
-
const isLast = index === items.length - 1;
|
|
198
|
-
|
|
199
|
-
return (
|
|
200
|
-
<BreadcrumbItem
|
|
201
|
-
key={index}
|
|
202
|
-
href={item.href}
|
|
203
|
-
active={item.active || isLast}
|
|
204
|
-
icon={item.icon}
|
|
205
|
-
onClick={item.onClick}
|
|
206
|
-
className={item.className}
|
|
207
|
-
style={item.style}
|
|
208
|
-
linkAs={LinkComponent}
|
|
209
|
-
>
|
|
210
|
-
{item.label}
|
|
211
|
-
</BreadcrumbItem>
|
|
212
|
-
);
|
|
213
|
-
});
|
|
214
|
-
} else {
|
|
215
|
-
// Compound rendering
|
|
216
|
-
const childrenCount = Children.count(children);
|
|
217
|
-
content = Children.map(children, (child, index) => {
|
|
218
|
-
if (isValidElement(child)) {
|
|
219
|
-
const isLast = index === childrenCount - 1;
|
|
220
|
-
const childProps = child.props as any;
|
|
221
|
-
|
|
222
|
-
return cloneElement(child, {
|
|
223
|
-
active: childProps.active ?? (isLast ? true : undefined),
|
|
224
|
-
linkAs: childProps.linkAs ?? LinkComponent,
|
|
225
|
-
} as any);
|
|
226
|
-
}
|
|
227
|
-
return child;
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return (
|
|
232
|
-
<nav aria-label={ariaLabel} style={style}>
|
|
233
|
-
<ol className={breadcrumbClasses}>
|
|
234
|
-
{content}
|
|
235
|
-
</ol>
|
|
236
|
-
</nav>
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
) as unknown as BreadcrumbComponent;
|
|
252
|
+
export const Breadcrumb = BreadcrumbComponent as BreadcrumbType;
|
|
240
253
|
|
|
241
254
|
Breadcrumb.displayName = 'Breadcrumb';
|
|
242
255
|
Breadcrumb.Item = BreadcrumbItem;
|
|
243
256
|
|
|
244
257
|
export default Breadcrumb;
|
|
258
|
+
export type { BreadcrumbItemData as BreadcrumbItemLegacy };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Breadcrumb } from './Breadcrumb';
|
|
2
1
|
export { default } from './Breadcrumb';
|
|
3
|
-
export type { BreadcrumbProps,
|
|
2
|
+
export type { BreadcrumbProps, BreadcrumbItemProps, BreadcrumbType } from './Breadcrumb';
|
|
3
|
+
export type { BreadcrumbItemLegacy as BreadcrumbItem } from './Breadcrumb';
|
|
@@ -59,7 +59,7 @@ const CustomGlassExample = () => (
|
|
|
59
59
|
blurAmount: 2,
|
|
60
60
|
saturation: 180,
|
|
61
61
|
aberrationIntensity: 2,
|
|
62
|
-
|
|
62
|
+
borderRadius: 16,
|
|
63
63
|
overLight: false,
|
|
64
64
|
mode: 'polar'
|
|
65
65
|
}}
|
|
@@ -113,7 +113,7 @@ When `glass` is an object, it accepts the same props as the `AtomixGlass` compon
|
|
|
113
113
|
| `blurAmount` | `number` | `0` | Blur amount for the backdrop |
|
|
114
114
|
| `saturation` | `number` | `160` | Saturation percentage for the backdrop |
|
|
115
115
|
| `aberrationIntensity` | `number` | `1` | Chromatic aberration intensity |
|
|
116
|
-
| `
|
|
116
|
+
| `borderRadius` | `number` | `8` | Corner radius in pixels |
|
|
117
117
|
| `overLight` | `boolean` | `false` | Whether the glass is over a light background |
|
|
118
118
|
| `mode` | `'standard' \| 'polar' \| 'prominent' \| 'shader'` | `'standard'` | Glass effect mode |
|
|
119
119
|
|
|
@@ -152,7 +152,7 @@ describe('Callout Component', () => {
|
|
|
152
152
|
|
|
153
153
|
expect(glassProps).toMatchObject({
|
|
154
154
|
displacementScale: 30,
|
|
155
|
-
|
|
155
|
+
borderRadius: 8,
|
|
156
156
|
elasticity: 0,
|
|
157
157
|
});
|
|
158
158
|
});
|
|
@@ -162,7 +162,7 @@ describe('Callout Component', () => {
|
|
|
162
162
|
displacementScale: 60,
|
|
163
163
|
blurAmount: 2,
|
|
164
164
|
saturation: 180,
|
|
165
|
-
|
|
165
|
+
borderRadius: 12,
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
render(
|
|
@@ -179,7 +179,7 @@ describe('Callout Component', () => {
|
|
|
179
179
|
displacementScale: 60,
|
|
180
180
|
blurAmount: 2,
|
|
181
181
|
saturation: 180,
|
|
182
|
-
|
|
182
|
+
borderRadius: 12,
|
|
183
183
|
// Default values from Callout
|
|
184
184
|
elasticity: 0,
|
|
185
185
|
});
|
|
@@ -177,7 +177,7 @@ export const Callout: CalloutComponent = memo(
|
|
|
177
177
|
// Default glass settings for callouts
|
|
178
178
|
const defaultGlassProps = {
|
|
179
179
|
displacementScale: 30,
|
|
180
|
-
|
|
180
|
+
borderRadius: 8,
|
|
181
181
|
elasticity: 0,
|
|
182
182
|
};
|
|
183
183
|
|
|
@@ -193,7 +193,7 @@ export const Callout: CalloutComponent = memo(
|
|
|
193
193
|
<AtomixGlass {...glassProps}>
|
|
194
194
|
<div
|
|
195
195
|
className="c-callout__glass-content"
|
|
196
|
-
style={{ borderRadius: glassProps.
|
|
196
|
+
style={{ borderRadius: glassProps.borderRadius }}
|
|
197
197
|
>
|
|
198
198
|
{calloutContent}
|
|
199
199
|
</div>
|
|
@@ -94,7 +94,7 @@ Glass morphism adds a modern, translucent appearance with backdrop blur effects:
|
|
|
94
94
|
blurAmount: 2,
|
|
95
95
|
saturation: 180,
|
|
96
96
|
aberrationIntensity: 1.5,
|
|
97
|
-
|
|
97
|
+
borderRadius: 12
|
|
98
98
|
}}
|
|
99
99
|
title="Custom Glass"
|
|
100
100
|
variant="success"
|
|
@@ -113,7 +113,7 @@ When `glass={true}`, these default settings are used:
|
|
|
113
113
|
blurAmount: 0,
|
|
114
114
|
saturation: 160,
|
|
115
115
|
aberrationIntensity: 1,
|
|
116
|
-
|
|
116
|
+
borderRadius: 8,
|
|
117
117
|
overLight: false,
|
|
118
118
|
mode: 'standard'
|
|
119
119
|
}
|
|
@@ -278,8 +278,8 @@ const Chart = memo(
|
|
|
278
278
|
saturation: 180,
|
|
279
279
|
aberrationIntensity: 1.5,
|
|
280
280
|
elasticity: 0, // No elastic effect for charts
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
withLiquidBlur: false, // Keep it simple
|
|
282
|
+
withBorder: true,
|
|
283
283
|
mode: 'standard' as const,
|
|
284
284
|
mouseContainer: chartContainerRef,
|
|
285
285
|
reducedMotion: false,
|
|
@@ -300,8 +300,8 @@ const Chart = memo(
|
|
|
300
300
|
const chartBorderRadius = useMemo(() => {
|
|
301
301
|
// Use chart border-radius design token (typically 12px from $border-radius-lg)
|
|
302
302
|
// AtomixGlass will extract from children if not provided
|
|
303
|
-
return glassProps?.
|
|
304
|
-
}, [glassProps?.
|
|
303
|
+
return glassProps?.borderRadius || undefined;
|
|
304
|
+
}, [glassProps?.borderRadius]);
|
|
305
305
|
|
|
306
306
|
// Create context value
|
|
307
307
|
const chartContextValue = useMemo<ChartContextValue>(
|
|
@@ -404,7 +404,7 @@ const Chart = memo(
|
|
|
404
404
|
const wrappedChart = glassProps ? (
|
|
405
405
|
<AtomixGlass
|
|
406
406
|
{...glassProps}
|
|
407
|
-
|
|
407
|
+
borderRadius={chartBorderRadius}
|
|
408
408
|
style={{
|
|
409
409
|
width: '100%',
|
|
410
410
|
height: '100%',
|