@shohojdhara/atomix 0.3.15 → 0.4.1
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/build-tools/index.d.ts +31 -30
- package/build-tools/package.json +4 -21
- package/dist/atomix.css +20234 -2027
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +76 -2
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/index.d.ts +31 -30
- package/dist/build-tools/package.json +4 -21
- package/dist/charts.js +4 -5
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +87 -10
- package/dist/core.js +673 -480
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +15 -3
- package/dist/forms.js +530 -97
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +5 -6
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +644 -277
- package/dist/index.esm.js +1948 -1347
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3333 -2728
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/theme.d.ts +9 -9
- package/dist/theme.js.map +1 -1
- package/package.json +2 -2
- package/scripts/atomix-cli.js +10 -1
- package/scripts/cli/__tests__/utils.test.js +6 -2
- package/scripts/cli/migration-tools.js +2 -2
- package/scripts/cli/theme-bridge.js +7 -9
- package/scripts/cli/utils.js +2 -1
- package/src/components/Accordion/Accordion.stories.tsx +72 -23
- package/src/components/Accordion/Accordion.test.tsx +70 -50
- package/src/components/Accordion/Accordion.tsx +219 -96
- package/src/components/Accordion/AccordionCompound.test.tsx +70 -0
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
- package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/glass-utils.ts +4 -3
- package/src/components/AtomixGlass/shader-utils.ts +128 -52
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -62
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +20 -9
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +14 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +9 -8
- package/src/components/Breadcrumb/Breadcrumb.tsx +173 -65
- package/src/components/Breadcrumb/BreadcrumbCompound.test.tsx +84 -0
- package/src/components/Button/Button.stories.tsx +13 -22
- package/src/components/Button/Button.test.tsx +97 -81
- package/src/components/Button/Button.tsx +46 -14
- package/src/components/Button/ButtonGroup.stories.tsx +37 -32
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +166 -918
- package/src/components/Callout/Callout.tsx +196 -84
- package/src/components/Callout/CalloutCompound.test.tsx +72 -0
- package/src/components/Card/Card.stories.tsx +67 -36
- package/src/components/Card/Card.tsx +30 -14
- package/src/components/Chart/AreaChart.tsx +1 -1
- package/src/components/Chart/CandlestickChart.tsx +23 -16
- package/src/components/Chart/Chart.stories.tsx +4 -9
- package/src/components/Chart/Chart.tsx +40 -44
- package/src/components/Chart/ChartRenderer.tsx +39 -12
- package/src/components/Chart/ChartToolbar.tsx +21 -5
- package/src/components/Chart/DonutChart.tsx +1 -1
- package/src/components/Chart/FunnelChart.tsx +4 -1
- package/src/components/Chart/GaugeChart.tsx +3 -1
- package/src/components/Chart/HeatmapChart.tsx +50 -37
- package/src/components/Chart/LineChart.tsx +3 -2
- package/src/components/Chart/MultiAxisChart.tsx +24 -16
- package/src/components/Chart/RadarChart.tsx +19 -17
- package/src/components/Chart/ScatterChart.tsx +29 -21
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +6 -2
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +7 -7
- package/src/components/DataTable/DataTable.stories.tsx +43 -38
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +32 -47
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +2 -5
- package/src/components/Dropdown/Dropdown.tsx +425 -298
- package/src/components/Dropdown/DropdownCompound.test.tsx +64 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +6 -19
- package/src/components/EdgePanel/EdgePanel.tsx +163 -113
- package/src/components/EdgePanel/EdgePanelCompound.test.tsx +53 -0
- package/src/components/Footer/Footer.stories.tsx +21 -16
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.test.tsx +49 -49
- package/src/components/Form/Checkbox.tsx +108 -100
- package/src/components/Form/Form.stories.tsx +2 -10
- package/src/components/Form/Input.stories.tsx +22 -39
- package/src/components/Form/Input.test.tsx +38 -44
- package/src/components/Form/Radio.stories.tsx +6 -12
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.stories.tsx +23 -0
- package/src/components/Form/Select.test.tsx +99 -0
- package/src/components/Form/Select.tsx +239 -186
- package/src/components/Form/SelectOption.tsx +88 -0
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +93 -23
- package/src/components/Hero/Hero.test.tsx +142 -0
- package/src/components/Hero/Hero.tsx +343 -58
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.test.tsx +62 -0
- package/src/components/List/List.tsx +32 -25
- package/src/components/List/ListItem.tsx +20 -0
- package/src/components/Modal/Modal.stories.tsx +67 -2
- package/src/components/Modal/Modal.tsx +208 -125
- package/src/components/Modal/ModalCompound.test.tsx +94 -0
- package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
- package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
- package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
- package/src/components/Pagination/Pagination.stories.tsx +7 -4
- package/src/components/Pagination/Pagination.tsx +199 -202
- package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
- package/src/components/Popover/Popover.stories.tsx +99 -192
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +35 -44
- package/src/components/River/River.stories.tsx +2 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +71 -71
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +3 -1
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +8 -6
- package/src/components/Steps/Steps.tsx +124 -21
- package/src/components/Steps/StepsCompound.test.tsx +81 -0
- package/src/components/Tabs/Tabs.stories.tsx +12 -9
- package/src/components/Tabs/Tabs.tsx +230 -75
- package/src/components/Tabs/TabsCompound.test.tsx +64 -0
- package/src/components/Toggle/Toggle.stories.tsx +27 -13
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +24 -20
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +129 -127
- package/src/components/Upload/Upload.tsx +287 -283
- package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
- package/src/components/index.ts +13 -2
- package/src/layouts/Grid/Grid.stories.tsx +9 -3
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
- package/src/lib/__tests__/theme-tools.test.ts +32 -6
- package/src/lib/composables/index.ts +0 -4
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +102 -60
- package/src/lib/composables/useChartExport.ts +1 -1
- package/src/lib/composables/useDataTable.ts +29 -17
- package/src/lib/composables/useHero.ts +58 -14
- package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
- package/src/lib/composables/useInput.ts +10 -8
- package/src/lib/composables/useSideMenu.ts +6 -5
- package/src/lib/composables/useTooltip.ts +1 -2
- package/src/lib/composables/useVideoPlayer.ts +44 -35
- package/src/lib/config/index.ts +154 -154
- package/src/lib/constants/cssVariables.ts +29 -29
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
- package/src/lib/hooks/index.ts +1 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -17
- package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
- package/src/lib/patterns/__tests__/slots.test.ts +1 -1
- package/src/lib/patterns/index.ts +1 -1
- package/src/lib/patterns/slots.tsx +8 -13
- package/src/lib/storybook/InteractiveDemo.tsx +13 -18
- package/src/lib/storybook/PreviewContainer.tsx +1 -1
- package/src/lib/storybook/VariantsGrid.tsx +3 -7
- package/src/lib/storybook/index.ts +1 -1
- package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
- package/src/lib/theme/adapters/index.ts +3 -9
- package/src/lib/theme/adapters/themeAdapter.ts +41 -26
- package/src/lib/theme/config/index.ts +1 -1
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +10 -5
- package/src/lib/theme/constants/constants.ts +2 -2
- package/src/lib/theme/constants/index.ts +1 -2
- package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
- package/src/lib/theme/core/composeTheme.ts +32 -26
- package/src/lib/theme/core/createTheme.ts +1 -1
- package/src/lib/theme/core/createThemeObject.ts +308 -301
- package/src/lib/theme/core/index.ts +3 -3
- package/src/lib/theme/devtools/CLI.ts +105 -111
- package/src/lib/theme/devtools/Comparator.tsx +50 -32
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
- package/src/lib/theme/devtools/Inspector.tsx +75 -60
- package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
- package/src/lib/theme/devtools/Preview.tsx +150 -106
- package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
- package/src/lib/theme/devtools/index.ts +3 -9
- package/src/lib/theme/devtools/useHistory.ts +23 -21
- package/src/lib/theme/errors/errors.ts +12 -11
- package/src/lib/theme/errors/index.ts +2 -7
- package/src/lib/theme/generators/generateCSS.ts +9 -13
- package/src/lib/theme/generators/generateCSSNested.ts +1 -6
- package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
- package/src/lib/theme/generators/index.ts +1 -4
- package/src/lib/theme/i18n/index.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +13 -13
- package/src/lib/theme/index.ts +7 -16
- package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
- package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
- package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
- package/src/lib/theme/runtime/index.ts +2 -5
- package/src/lib/theme/runtime/useTheme.ts +18 -18
- package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
- package/src/lib/theme/test/testTheme.ts +15 -16
- package/src/lib/theme/tokens/index.ts +2 -7
- package/src/lib/theme/tokens/tokens.ts +25 -24
- package/src/lib/theme/types.ts +428 -411
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
- package/src/lib/theme/utils/componentTheming.ts +18 -18
- package/src/lib/theme/utils/domUtils.ts +277 -289
- package/src/lib/theme/utils/index.ts +1 -2
- package/src/lib/theme/utils/injectCSS.ts +10 -14
- package/src/lib/theme/utils/naming.ts +20 -16
- package/src/lib/theme/utils/themeHelpers.ts +10 -12
- package/src/lib/theme/utils/themeUtils.ts +85 -86
- package/src/lib/theme/utils/themeValidation.ts +82 -33
- package/src/lib/theme-tools.ts +8 -6
- package/src/lib/types/components.ts +180 -73
- package/src/lib/types/partProps.ts +1 -1
- package/src/lib/utils/__tests__/componentUtils.test.ts +57 -2
- package/src/lib/utils/__tests__/csv.test.ts +1 -1
- package/src/lib/utils/__tests__/themeNaming.test.ts +117 -0
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +3 -1
- package/src/lib/utils/dataTableExport.ts +1 -5
- package/src/lib/utils/fontPreloader.ts +10 -19
- package/src/lib/utils/icons.ts +4 -1
- package/src/lib/utils/index.ts +2 -6
- package/src/lib/utils/memoryMonitor.ts +10 -8
- package/src/lib/utils/themeNaming.ts +3 -3
- package/src/styles/01-settings/_index.scss +0 -1
- package/src/styles/01-settings/_settings.colors.scss +8 -8
- package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/01-settings/_settings.spacing.scss +3 -4
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/01-settings/_settings.typography.scss +1 -1
- package/src/styles/02-tools/_tools.breakpoints.scss +1 -1
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +36 -24
- package/src/styles/03-generic/_generic.root.scss +4 -3
- package/src/styles/06-components/_components.atomix-glass.scss +13 -9
- package/src/styles/06-components/_components.button.scss +16 -4
- package/src/styles/06-components/_components.callout.scss +27 -21
- package/src/styles/06-components/_components.card.scss +5 -14
- package/src/styles/06-components/_components.chart.scss +22 -19
- package/src/styles/06-components/_components.checkbox.scss +3 -1
- package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
- package/src/styles/06-components/_components.edge-panel.scss +9 -2
- package/src/styles/06-components/_components.footer.scss +1 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -5
- package/src/styles/06-components/_components.toggle.scss +18 -0
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/06-components/old.chart.styles.scss +0 -2
- package/src/styles/99-utilities/_utilities.border.scss +69 -27
- package/src/styles/99-utilities/_utilities.display.scss +1 -1
- package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
- package/src/styles/99-utilities/_utilities.position.scss +16 -9
- package/src/styles/99-utilities/_utilities.scss +1 -1
- package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
- package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
- package/src/styles/99-utilities/_utilities.text-gradient.scss +30 -30
- package/src/styles/99-utilities/_utilities.text.scss +67 -47
|
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
2
2
|
import { fn } from '@storybook/test';
|
|
3
3
|
import { HERO } from '../../lib/constants/components';
|
|
4
4
|
import { Button } from '../Button/Button';
|
|
5
|
-
import { Hero } from './Hero';
|
|
5
|
+
import { Hero, HeroProps } from './Hero';
|
|
6
6
|
|
|
7
7
|
// Extract class names without the leading dots
|
|
8
8
|
const HERO_CLASS = HERO.SELECTORS.HERO.replace('.', '');
|
|
@@ -24,9 +24,11 @@ const LEFT_CLASS = HERO.CLASSES.LEFT;
|
|
|
24
24
|
const FULL_VH_CLASS = HERO.CLASSES.FULL_VH;
|
|
25
25
|
|
|
26
26
|
// Define missing variables
|
|
27
|
-
const demoText =
|
|
27
|
+
const demoText =
|
|
28
|
+
'Our design system helps you build beautiful, consistent, and accessible user interfaces faster than ever before. With a carefully crafted collection of components and guidelines, you can easily create stunning UIs that stand out.';
|
|
28
29
|
|
|
29
|
-
const showcaseText =
|
|
30
|
+
const showcaseText =
|
|
31
|
+
'This is an example of showcase text demonstrating the capabilities of the Atomix design system. Create beautiful interfaces with ease and consistency.';
|
|
30
32
|
|
|
31
33
|
const primaryActionButtons = (
|
|
32
34
|
<>
|
|
@@ -50,7 +52,7 @@ const showcaseActionButtons = (
|
|
|
50
52
|
</>
|
|
51
53
|
);
|
|
52
54
|
|
|
53
|
-
const meta = {
|
|
55
|
+
const meta: Meta<HeroProps> = {
|
|
54
56
|
title: 'Components/Hero',
|
|
55
57
|
component: Hero,
|
|
56
58
|
parameters: {
|
|
@@ -195,7 +197,7 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
195
197
|
description: 'Show background overlay',
|
|
196
198
|
table: {
|
|
197
199
|
type: { summary: 'boolean' },
|
|
198
|
-
defaultValue: { summary: false },
|
|
200
|
+
defaultValue: { summary: 'false' },
|
|
199
201
|
},
|
|
200
202
|
},
|
|
201
203
|
fullViewportHeight: {
|
|
@@ -203,7 +205,7 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
203
205
|
description: 'Make hero full viewport height',
|
|
204
206
|
table: {
|
|
205
207
|
type: { summary: 'boolean' },
|
|
206
|
-
defaultValue: { summary: false },
|
|
208
|
+
defaultValue: { summary: 'false' },
|
|
207
209
|
},
|
|
208
210
|
},
|
|
209
211
|
imageColSize: {
|
|
@@ -211,7 +213,7 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
211
213
|
description: 'Image column size (1-12)',
|
|
212
214
|
table: {
|
|
213
215
|
type: { summary: 'number' },
|
|
214
|
-
defaultValue: { summary: 6 },
|
|
216
|
+
defaultValue: { summary: '6' },
|
|
215
217
|
},
|
|
216
218
|
},
|
|
217
219
|
contentColSize: {
|
|
@@ -219,7 +221,7 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
219
221
|
description: 'Content column size (1-12)',
|
|
220
222
|
table: {
|
|
221
223
|
type: { summary: 'number' },
|
|
222
|
-
defaultValue: { summary: 6 },
|
|
224
|
+
defaultValue: { summary: '6' },
|
|
223
225
|
},
|
|
224
226
|
},
|
|
225
227
|
contentWidth: {
|
|
@@ -235,7 +237,7 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
235
237
|
description: 'Enable parallax effect on background image',
|
|
236
238
|
table: {
|
|
237
239
|
type: { summary: 'boolean' },
|
|
238
|
-
defaultValue: { summary: false },
|
|
240
|
+
defaultValue: { summary: 'false' },
|
|
239
241
|
},
|
|
240
242
|
},
|
|
241
243
|
parallaxIntensity: {
|
|
@@ -243,7 +245,7 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
243
245
|
description: 'Parallax effect intensity (0-1)',
|
|
244
246
|
table: {
|
|
245
247
|
type: { summary: 'number' },
|
|
246
|
-
defaultValue: { summary: 0.5 },
|
|
248
|
+
defaultValue: { summary: '0.5' },
|
|
247
249
|
},
|
|
248
250
|
},
|
|
249
251
|
videoBackground: {
|
|
@@ -255,10 +257,10 @@ Hero creates prominent banner sections typically used at the top of pages. It pr
|
|
|
255
257
|
},
|
|
256
258
|
},
|
|
257
259
|
},
|
|
258
|
-
} satisfies Meta<
|
|
260
|
+
} satisfies Meta<HeroProps>;
|
|
259
261
|
|
|
260
262
|
export default meta;
|
|
261
|
-
type Story = StoryObj<
|
|
263
|
+
type Story = StoryObj<HeroProps>;
|
|
262
264
|
|
|
263
265
|
export const BasicUsage: Story = {
|
|
264
266
|
args: {
|
|
@@ -277,12 +279,50 @@ export const BasicUsage: Story = {
|
|
|
277
279
|
},
|
|
278
280
|
};
|
|
279
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Hero using Compound Component Pattern
|
|
284
|
+
*/
|
|
285
|
+
export const CompoundUsage: Story = {
|
|
286
|
+
render: (args) => (
|
|
287
|
+
<Hero {...args}>
|
|
288
|
+
<Hero.Content>
|
|
289
|
+
<Hero.Title level="h1">Compound Component Pattern</Hero.Title>
|
|
290
|
+
<Hero.Subtitle>Fully Customizable Structure</Hero.Subtitle>
|
|
291
|
+
<Hero.Text>
|
|
292
|
+
This example demonstrates the new Compound Component pattern, allowing full control over the internal structure of the Hero component.
|
|
293
|
+
</Hero.Text>
|
|
294
|
+
<Hero.Actions>
|
|
295
|
+
<Button variant="primary" className="u-mr-3">
|
|
296
|
+
Get Started
|
|
297
|
+
</Button>
|
|
298
|
+
<Button variant="outline">Learn More</Button>
|
|
299
|
+
</Hero.Actions>
|
|
300
|
+
</Hero.Content>
|
|
301
|
+
</Hero>
|
|
302
|
+
),
|
|
303
|
+
args: {
|
|
304
|
+
fullViewportHeight: true,
|
|
305
|
+
alignment: 'center',
|
|
306
|
+
backgroundImageSrc: 'https://picsum.photos/id/1015/1920/1080',
|
|
307
|
+
title: '', // Ignored but kept for types
|
|
308
|
+
showOverlay: true,
|
|
309
|
+
},
|
|
310
|
+
parameters: {
|
|
311
|
+
docs: {
|
|
312
|
+
description: {
|
|
313
|
+
story: 'Using the Compound Component pattern for maximum flexibility.',
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
|
|
280
319
|
export const WithImage: Story = {
|
|
281
320
|
args: {
|
|
282
321
|
title: 'Beautiful Interfaces',
|
|
283
322
|
subtitle: 'Crafted with Atomix',
|
|
284
323
|
text: 'Create stunning user experiences with our carefully designed components and guidelines.',
|
|
285
|
-
imageSrc:
|
|
324
|
+
imageSrc:
|
|
325
|
+
'https://images.unsplash.com/photo-1517245386807-bb43f82c33c4?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80',
|
|
286
326
|
imageAlt: 'Laptop with design interface',
|
|
287
327
|
alignment: 'left',
|
|
288
328
|
fullViewportHeight: false,
|
|
@@ -301,7 +341,8 @@ export const WithBackgroundImage: Story = {
|
|
|
301
341
|
title: 'Adventure Awaits',
|
|
302
342
|
subtitle: 'Begin Your Journey',
|
|
303
343
|
text: 'Explore new possibilities and create amazing products with our design system.',
|
|
304
|
-
backgroundImageSrc:
|
|
344
|
+
backgroundImageSrc:
|
|
345
|
+
'https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80',
|
|
305
346
|
showOverlay: true,
|
|
306
347
|
alignment: 'center',
|
|
307
348
|
fullViewportHeight: true,
|
|
@@ -316,11 +357,15 @@ export const WithBackgroundImage: Story = {
|
|
|
316
357
|
};
|
|
317
358
|
|
|
318
359
|
export const WithActions: Story = {
|
|
319
|
-
render:
|
|
360
|
+
render: args => (
|
|
320
361
|
<Hero {...args}>
|
|
321
362
|
<div className={ACTIONS_CLASS}>
|
|
322
|
-
<Button variant="primary" size="lg" className="u-mr-3">
|
|
323
|
-
|
|
363
|
+
<Button variant="primary" size="lg" className="u-mr-3">
|
|
364
|
+
Get Started
|
|
365
|
+
</Button>
|
|
366
|
+
<Button variant="secondary" size="lg">
|
|
367
|
+
Learn More
|
|
368
|
+
</Button>
|
|
324
369
|
</div>
|
|
325
370
|
</Hero>
|
|
326
371
|
),
|
|
@@ -391,8 +436,6 @@ export const WithCustomGlassEffect: Story = {
|
|
|
391
436
|
cornerRadius: 45,
|
|
392
437
|
mode: 'standard',
|
|
393
438
|
elasticity: 0.2,
|
|
394
|
-
showBorderEffects: true,
|
|
395
|
-
showHoverEffects: true,
|
|
396
439
|
onClick: () => {
|
|
397
440
|
console.log('Clicked!');
|
|
398
441
|
},
|
|
@@ -870,7 +913,7 @@ export const PremiumShowcase: Story = {
|
|
|
870
913
|
aberrationIntensity: 0.5,
|
|
871
914
|
cornerRadius: 20,
|
|
872
915
|
overLight: true,
|
|
873
|
-
mode: '
|
|
916
|
+
mode: 'standard',
|
|
874
917
|
},
|
|
875
918
|
actions: (
|
|
876
919
|
<>
|
|
@@ -923,7 +966,8 @@ export const PremiumShowcase: Story = {
|
|
|
923
966
|
parameters: {
|
|
924
967
|
docs: {
|
|
925
968
|
description: {
|
|
926
|
-
story:
|
|
969
|
+
story:
|
|
970
|
+
'Premium showcase combining multiple advanced features: glass effect, background slider with videos, full viewport height, and interactive elements.',
|
|
927
971
|
},
|
|
928
972
|
},
|
|
929
973
|
},
|
|
@@ -945,8 +989,34 @@ export const MinimalistDesign: Story = {
|
|
|
945
989
|
parameters: {
|
|
946
990
|
docs: {
|
|
947
991
|
description: {
|
|
948
|
-
story:
|
|
992
|
+
story:
|
|
993
|
+
'Minimalist design focusing on typography and content, with subtle animations and refined aesthetics.',
|
|
949
994
|
},
|
|
950
995
|
},
|
|
951
996
|
},
|
|
952
|
-
};
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* Hero with custom column styles
|
|
1001
|
+
*/
|
|
1002
|
+
export const WithCustomColumnStyles: Story = {
|
|
1003
|
+
args: {
|
|
1004
|
+
...Default.args,
|
|
1005
|
+
title: 'Customized Columns',
|
|
1006
|
+
text: 'This hero uses custom classes and inline styles on its layout columns. The content column has a custom background and padding, while the image column has a custom rotation effect.',
|
|
1007
|
+
imageSrc: 'https://picsum.photos/id/20/712/500',
|
|
1008
|
+
contentColClassName: 'u-bg-primary-50 u-p-6 u-rounded-lg',
|
|
1009
|
+
contentColStyle: { border: '2px solid var(--atomix-color-primary-500)' },
|
|
1010
|
+
imageColClassName: 'u-shadow-lg',
|
|
1011
|
+
imageColStyle: { transform: 'rotate(-2deg)', transition: 'transform 0.3s ease' },
|
|
1012
|
+
alignment: 'left',
|
|
1013
|
+
},
|
|
1014
|
+
parameters: {
|
|
1015
|
+
docs: {
|
|
1016
|
+
description: {
|
|
1017
|
+
story:
|
|
1018
|
+
'Demonstrates the use of imageColClassName, imageColStyle, contentColClassName, and contentColStyle to individually style the layout columns.',
|
|
1019
|
+
},
|
|
1020
|
+
},
|
|
1021
|
+
},
|
|
1022
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
4
|
+
import Hero from './Hero';
|
|
5
|
+
|
|
6
|
+
// Mock AtomixGlass component
|
|
7
|
+
vi.mock('../AtomixGlass/AtomixGlass', () => ({
|
|
8
|
+
AtomixGlass: ({ children, className }: any) => (
|
|
9
|
+
<div data-testid="atomix-glass" className={className}>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
describe('Hero Component', () => {
|
|
16
|
+
describe('Monolithic Usage', () => {
|
|
17
|
+
it('renders title and subtitle correctly', () => {
|
|
18
|
+
render(<Hero title="Test Title" subtitle="Test Subtitle" />);
|
|
19
|
+
|
|
20
|
+
expect(screen.getByText('Test Title')).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText('Test Subtitle')).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('renders text content correctly', () => {
|
|
25
|
+
render(<Hero title="Title" text="Test Description" />);
|
|
26
|
+
|
|
27
|
+
expect(screen.getByText('Test Description')).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('renders background image correctly', () => {
|
|
31
|
+
const bgSrc = 'test-bg.jpg';
|
|
32
|
+
render(<Hero title="Title" backgroundImageSrc={bgSrc} />);
|
|
33
|
+
|
|
34
|
+
const bgImage = screen.getByAltText('Background');
|
|
35
|
+
expect(bgImage).toBeInTheDocument();
|
|
36
|
+
expect(bgImage).toHaveAttribute('src', bgSrc);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('renders foreground image correctly', () => {
|
|
40
|
+
const imgSrc = 'test-img.jpg';
|
|
41
|
+
render(<Hero title="Title" imageSrc={imgSrc} imageAlt="Foreground Image" />);
|
|
42
|
+
|
|
43
|
+
const image = screen.getByAltText('Foreground Image');
|
|
44
|
+
expect(image).toBeInTheDocument();
|
|
45
|
+
expect(image).toHaveAttribute('src', imgSrc);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('renders actions correctly', () => {
|
|
49
|
+
render(
|
|
50
|
+
<Hero
|
|
51
|
+
title="Title"
|
|
52
|
+
actions={<button>Click Me</button>}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
expect(screen.getByText('Click Me')).toBeInTheDocument();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('renders children correctly', () => {
|
|
60
|
+
render(
|
|
61
|
+
<Hero title="Title">
|
|
62
|
+
<div data-testid="child-content">Child Content</div>
|
|
63
|
+
</Hero>
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
expect(screen.getByTestId('child-content')).toBeInTheDocument();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('Compound Component Usage', () => {
|
|
71
|
+
it('renders Hero.Title, Hero.Subtitle, Hero.Text correctly', () => {
|
|
72
|
+
render(
|
|
73
|
+
<Hero title="">
|
|
74
|
+
<Hero.Content>
|
|
75
|
+
<Hero.Title>Compound Title</Hero.Title>
|
|
76
|
+
<Hero.Subtitle>Compound Subtitle</Hero.Subtitle>
|
|
77
|
+
<Hero.Text>Compound Text</Hero.Text>
|
|
78
|
+
</Hero.Content>
|
|
79
|
+
</Hero>
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
expect(screen.getByText('Compound Title')).toBeInTheDocument();
|
|
83
|
+
expect(screen.getByText('Compound Title').tagName).toBe('H1');
|
|
84
|
+
expect(screen.getByText('Compound Subtitle')).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByText('Compound Text')).toBeInTheDocument();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('renders Hero.Actions correctly', () => {
|
|
89
|
+
render(
|
|
90
|
+
<Hero title="">
|
|
91
|
+
<Hero.Content>
|
|
92
|
+
<Hero.Actions>
|
|
93
|
+
<button>Action</button>
|
|
94
|
+
</Hero.Actions>
|
|
95
|
+
</Hero.Content>
|
|
96
|
+
</Hero>
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
expect(screen.getByText('Action')).toBeInTheDocument();
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('renders Hero.Image correctly', () => {
|
|
103
|
+
render(
|
|
104
|
+
<Hero title="">
|
|
105
|
+
<Hero.Image src="compound-img.jpg" alt="Compound Image" />
|
|
106
|
+
</Hero>
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const img = screen.getByAltText('Compound Image');
|
|
110
|
+
expect(img).toBeInTheDocument();
|
|
111
|
+
expect(img).toHaveAttribute('src', 'compound-img.jpg');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('renders Hero.Background via backgroundElement prop', () => {
|
|
115
|
+
render(
|
|
116
|
+
<Hero
|
|
117
|
+
title="Title"
|
|
118
|
+
backgroundElement={<Hero.Background src="bg.jpg" data-testid="custom-bg" />}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const bg = screen.getByTestId('custom-bg');
|
|
123
|
+
expect(bg).toBeInTheDocument();
|
|
124
|
+
// Verify it renders the image inside
|
|
125
|
+
const img = screen.getByAltText('Background');
|
|
126
|
+
expect(img).toHaveAttribute('src', 'bg.jpg');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('Hero.Content supports glass prop', () => {
|
|
130
|
+
render(
|
|
131
|
+
<Hero title="">
|
|
132
|
+
<Hero.Content glass>
|
|
133
|
+
Glass Content
|
|
134
|
+
</Hero.Content>
|
|
135
|
+
</Hero>
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
expect(screen.getByTestId('atomix-glass')).toBeInTheDocument();
|
|
139
|
+
expect(screen.getByText('Glass Content')).toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
});
|