@shohojdhara/atomix 0.3.14 → 0.4.0
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/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +44 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +50 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +21044 -2618
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +77 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +44 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +50 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +152 -78
- package/dist/index.esm.js +346 -340
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +359 -353
- 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 +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +358 -850
- package/src/components/Accordion/Accordion.test.tsx +70 -50
- package/src/components/Accordion/Accordion.tsx +99 -94
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +6 -5
- package/src/components/AtomixGlass/shader-utils.ts +133 -52
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -36
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +195 -0
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +122 -352
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +30 -11
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +142 -23
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
- package/src/components/Button/Button.stories.tsx +454 -1126
- package/src/components/Button/Button.test.tsx +123 -0
- package/src/components/Button/Button.tsx +88 -60
- package/src/components/Button/ButtonGroup.stories.tsx +376 -215
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +316 -568
- package/src/components/Card/Card.stories.tsx +292 -81
- 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 +153 -16
- 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 +152 -66
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +114 -7
- package/src/components/DataTable/DataTable.stories.tsx +349 -144
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +310 -1066
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -36
- package/src/components/Dropdown/Dropdown.tsx +313 -299
- package/src/components/EdgePanel/EdgePanel.stories.tsx +221 -25
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Footer/Footer.stories.tsx +396 -327
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +122 -78
- package/src/components/Form/Form.stories.tsx +110 -19
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- 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 +146 -17
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Select.tsx +184 -182
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +372 -38
- package/src/components/Hero/Hero.tsx +201 -55
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/List/List.tsx +19 -23
- package/src/components/Modal/Modal.stories.tsx +183 -43
- package/src/components/Modal/Modal.tsx +130 -127
- 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 +354 -97
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +160 -7
- package/src/components/River/River.stories.tsx +3 -2
- package/src/components/SectionIntro/SectionIntro.stories.tsx +239 -47
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +104 -8
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +173 -42
- package/src/components/Tabs/Tabs.stories.tsx +141 -12
- package/src/components/Tabs/Tabs.tsx +74 -72
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +137 -36
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -100
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +241 -150
- 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/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +219 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +126 -97
- package/src/lib/composables/useChartExport.ts +3 -8
- package/src/lib/composables/useDataTable.ts +72 -43
- 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/components.ts +9 -32
- 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 +107 -105
- 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 +172 -71
- package/src/lib/types/partProps.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +19 -0
- package/src/lib/utils/dataTableExport.ts +2 -15
- 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 +2 -2
- package/src/styles/01-settings/_index.scss +1 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- 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 +4 -4
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +38 -12
- package/src/styles/03-generic/_generic.root.scss +4 -3
- package/src/styles/06-components/_components.accordion.scss +56 -14
- 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 +25 -17
- 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/_index.scss +2 -0
- 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 +2 -0
- 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 +45 -0
- package/src/styles/99-utilities/_utilities.text.scss +67 -46
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -16,7 +16,11 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
16
16
|
fullViewportHeight = false,
|
|
17
17
|
actions,
|
|
18
18
|
imageColSize = 7,
|
|
19
|
+
imageColClassName,
|
|
20
|
+
imageColStyle,
|
|
19
21
|
contentColSize = 5,
|
|
22
|
+
contentColClassName,
|
|
23
|
+
contentColStyle,
|
|
20
24
|
contentWidth,
|
|
21
25
|
className = '',
|
|
22
26
|
style,
|
|
@@ -31,7 +35,13 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
31
35
|
muted: true,
|
|
32
36
|
},
|
|
33
37
|
backgroundSlider,
|
|
34
|
-
|
|
38
|
+
headingLevel = 'h1',
|
|
39
|
+
reverseOnMobile = false,
|
|
40
|
+
parts,
|
|
41
|
+
...rest
|
|
42
|
+
}: HeroProps) => {
|
|
43
|
+
// Define dynamic heading tag
|
|
44
|
+
const HeadingTag = headingLevel;
|
|
35
45
|
const {
|
|
36
46
|
generateHeroClassNames,
|
|
37
47
|
generateImageColClass,
|
|
@@ -44,6 +54,7 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
44
54
|
backgroundSlider: sliderHook,
|
|
45
55
|
hasBackgroundSlider,
|
|
46
56
|
} = useHero({
|
|
57
|
+
title,
|
|
47
58
|
alignment,
|
|
48
59
|
imageColSize,
|
|
49
60
|
contentColSize,
|
|
@@ -56,6 +67,7 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
56
67
|
parallaxIntensity,
|
|
57
68
|
videoBackground,
|
|
58
69
|
backgroundSlider,
|
|
70
|
+
reverseOnMobile,
|
|
59
71
|
});
|
|
60
72
|
|
|
61
73
|
// Create custom style for hero element with content width if provided
|
|
@@ -95,16 +107,16 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
95
107
|
let transitionClass = HERO.CLASSES.SLIDER_FADE;
|
|
96
108
|
if (transition === 'slide') {
|
|
97
109
|
transitionClass = HERO.CLASSES.SLIDER_SLIDE;
|
|
98
|
-
} else if (transition === 'custom') {
|
|
99
|
-
transitionClass = HERO.CLASSES.SLIDER_CUSTOM;
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
return (
|
|
103
113
|
<div
|
|
104
114
|
className={`${HERO.SELECTORS.SLIDER.replace('.', '')} ${transitionClass}`}
|
|
105
|
-
style={
|
|
106
|
-
|
|
107
|
-
|
|
115
|
+
style={
|
|
116
|
+
{
|
|
117
|
+
'--slider-transition-duration': `${transitionDuration}ms`,
|
|
118
|
+
} as React.CSSProperties
|
|
119
|
+
}
|
|
108
120
|
onMouseEnter={() => {
|
|
109
121
|
if (backgroundSlider.autoplay?.pauseOnHover) {
|
|
110
122
|
sliderHook.pauseAutoplay();
|
|
@@ -116,7 +128,7 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
116
128
|
}
|
|
117
129
|
}}
|
|
118
130
|
>
|
|
119
|
-
{slides.map((slide, index) => {
|
|
131
|
+
{slides.map((slide, index: number) => {
|
|
120
132
|
const isActive = index === currentIndex;
|
|
121
133
|
const slideRef = slideRefs[index];
|
|
122
134
|
const videoRef = videoRefs[index];
|
|
@@ -125,37 +137,40 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
125
137
|
<div
|
|
126
138
|
key={index}
|
|
127
139
|
ref={slideRef}
|
|
128
|
-
className={`${HERO.SELECTORS.SLIDER_ITEM.replace('.', '')} ${
|
|
129
|
-
|
|
130
|
-
}`}
|
|
140
|
+
className={`${HERO.SELECTORS.SLIDER_ITEM.replace('.', '')} ${isActive ? HERO.CLASSES.SLIDER_ITEM_ACTIVE : ''}`}
|
|
141
|
+
aria-hidden={!isActive}
|
|
131
142
|
>
|
|
132
|
-
{slide.type === '
|
|
133
|
-
<img
|
|
134
|
-
src={slide.src}
|
|
135
|
-
alt={slide.alt || 'Background slide'}
|
|
136
|
-
className={HERO.SELECTORS.BG_IMAGE.replace('.', '')}
|
|
137
|
-
/>
|
|
138
|
-
) : (
|
|
143
|
+
{slide.type === 'video' ? (
|
|
139
144
|
<video
|
|
140
145
|
ref={videoRef as React.LegacyRef<HTMLVideoElement>}
|
|
141
|
-
className=
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
muted={slide.videoOptions?.muted
|
|
146
|
+
className={'c-hero__bg-video'}
|
|
147
|
+
src={slide.src}
|
|
148
|
+
poster={slide.videoOptions?.posterUrl || slide.alt}
|
|
149
|
+
muted={slide.videoOptions?.muted ?? true}
|
|
150
|
+
loop={slide.videoOptions?.loop ?? true}
|
|
145
151
|
playsInline
|
|
146
|
-
|
|
152
|
+
aria-hidden="true"
|
|
153
|
+
autoPlay={slide.videoOptions?.autoplay !== false}
|
|
147
154
|
>
|
|
148
|
-
<source
|
|
149
|
-
src={slide.src}
|
|
150
|
-
type={`video/${slide.src.split('.').pop() || 'mp4'}`}
|
|
151
|
-
/>
|
|
155
|
+
<source src={slide.src} type={`video/${slide.src.split('.').pop() || 'mp4'}`} />
|
|
152
156
|
Your browser does not support the video tag.
|
|
153
157
|
</video>
|
|
158
|
+
) : (
|
|
159
|
+
<img
|
|
160
|
+
src={slide.src}
|
|
161
|
+
alt={slide.alt || 'Background slide'}
|
|
162
|
+
className={HERO.SELECTORS.BG_IMAGE.replace('.', '')}
|
|
163
|
+
/>
|
|
154
164
|
)}
|
|
155
165
|
</div>
|
|
156
166
|
);
|
|
157
167
|
})}
|
|
158
|
-
{showOverlay &&
|
|
168
|
+
{showOverlay && (
|
|
169
|
+
<div
|
|
170
|
+
className={`${HERO.SELECTORS.OVERLAY.replace('.', '')} ${parts?.overlay?.className || ''}`.trim()}
|
|
171
|
+
style={parts?.overlay?.style}
|
|
172
|
+
></div>
|
|
173
|
+
)}
|
|
159
174
|
</div>
|
|
160
175
|
);
|
|
161
176
|
}
|
|
@@ -164,7 +179,10 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
164
179
|
if (!hasBackgroundImage && !videoBackground) return null;
|
|
165
180
|
|
|
166
181
|
return (
|
|
167
|
-
<div
|
|
182
|
+
<div
|
|
183
|
+
className={`${HERO.SELECTORS.BG.replace('.', '')} ${parts?.background?.className || ''}`.trim()}
|
|
184
|
+
style={parts?.background?.style}
|
|
185
|
+
>
|
|
168
186
|
{backgroundImageSrc && (
|
|
169
187
|
<img
|
|
170
188
|
src={backgroundImageSrc}
|
|
@@ -173,18 +191,52 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
173
191
|
/>
|
|
174
192
|
)}
|
|
175
193
|
{renderVideoBackground()}
|
|
176
|
-
{showOverlay &&
|
|
194
|
+
{showOverlay && (
|
|
195
|
+
<div
|
|
196
|
+
className={`${HERO.SELECTORS.OVERLAY.replace('.', '')} ${parts?.overlay?.className || ''}`.trim()}
|
|
197
|
+
style={parts?.overlay?.style}
|
|
198
|
+
></div>
|
|
199
|
+
)}
|
|
177
200
|
</div>
|
|
178
201
|
);
|
|
179
202
|
};
|
|
180
203
|
|
|
181
204
|
const renderContent = () => {
|
|
182
205
|
const content = (
|
|
183
|
-
<div
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
{
|
|
206
|
+
<div
|
|
207
|
+
className={`${HERO.SELECTORS.CONTENT.replace('.', '')} ${parts?.content?.className || ''}`.trim()}
|
|
208
|
+
style={parts?.content?.style}
|
|
209
|
+
>
|
|
210
|
+
{subtitle && (
|
|
211
|
+
<p
|
|
212
|
+
className={`${HERO.SELECTORS.SUBTITLE.replace('.', '')} ${parts?.subtitle?.className || ''}`.trim()}
|
|
213
|
+
style={parts?.subtitle?.style}
|
|
214
|
+
>
|
|
215
|
+
{subtitle}
|
|
216
|
+
</p>
|
|
217
|
+
)}
|
|
218
|
+
<HeadingTag
|
|
219
|
+
className={`${HERO.SELECTORS.TITLE.replace('.', '')} ${parts?.title?.className || ''}`.trim()}
|
|
220
|
+
style={parts?.title?.style}
|
|
221
|
+
>
|
|
222
|
+
{title}
|
|
223
|
+
</HeadingTag>
|
|
224
|
+
{text && (
|
|
225
|
+
<p
|
|
226
|
+
className={`${HERO.SELECTORS.TEXT.replace('.', '')} ${parts?.text?.className || ''}`.trim()}
|
|
227
|
+
style={parts?.text?.style}
|
|
228
|
+
>
|
|
229
|
+
{text}
|
|
230
|
+
</p>
|
|
231
|
+
)}
|
|
232
|
+
{actions && (
|
|
233
|
+
<div
|
|
234
|
+
className={`${HERO.SELECTORS.ACTIONS.replace('.', '')} ${parts?.actions?.className || ''}`.trim()}
|
|
235
|
+
style={parts?.actions?.style}
|
|
236
|
+
>
|
|
237
|
+
{actions}
|
|
238
|
+
</div>
|
|
239
|
+
)}
|
|
188
240
|
</div>
|
|
189
241
|
);
|
|
190
242
|
|
|
@@ -198,7 +250,10 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
198
250
|
// If glass is true, use default glass props
|
|
199
251
|
if (glass === true) {
|
|
200
252
|
return (
|
|
201
|
-
<div
|
|
253
|
+
<div
|
|
254
|
+
className={`${HERO.SELECTORS.CONTENT.replace('.', '')} ${parts?.content?.className || ''}`.trim()}
|
|
255
|
+
style={parts?.content?.style}
|
|
256
|
+
>
|
|
202
257
|
<AtomixGlass
|
|
203
258
|
displacementScale={60}
|
|
204
259
|
blurAmount={3}
|
|
@@ -209,11 +264,35 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
209
264
|
mode="standard"
|
|
210
265
|
>
|
|
211
266
|
<div className="u-p-4">
|
|
212
|
-
{subtitle &&
|
|
213
|
-
|
|
214
|
-
|
|
267
|
+
{subtitle && (
|
|
268
|
+
<p
|
|
269
|
+
className={`${HERO.SELECTORS.SUBTITLE.replace('.', '')} ${parts?.subtitle?.className || ''}`.trim()}
|
|
270
|
+
style={parts?.subtitle?.style}
|
|
271
|
+
>
|
|
272
|
+
{subtitle}
|
|
273
|
+
</p>
|
|
274
|
+
)}
|
|
275
|
+
<HeadingTag
|
|
276
|
+
className={`${HERO.SELECTORS.TITLE.replace('.', '')} ${parts?.title?.className || ''}`.trim()}
|
|
277
|
+
style={parts?.title?.style}
|
|
278
|
+
>
|
|
279
|
+
{title}
|
|
280
|
+
</HeadingTag>
|
|
281
|
+
{text && (
|
|
282
|
+
<p
|
|
283
|
+
className={`${HERO.SELECTORS.TEXT.replace('.', '')} ${parts?.text?.className || ''}`.trim()}
|
|
284
|
+
style={parts?.text?.style}
|
|
285
|
+
>
|
|
286
|
+
{text}
|
|
287
|
+
</p>
|
|
288
|
+
)}
|
|
215
289
|
{actions && (
|
|
216
|
-
<div
|
|
290
|
+
<div
|
|
291
|
+
className={`${HERO.SELECTORS.ACTIONS.replace('.', '')} ${parts?.actions?.className || ''}`.trim()}
|
|
292
|
+
style={parts?.actions?.style}
|
|
293
|
+
>
|
|
294
|
+
{actions}
|
|
295
|
+
</div>
|
|
217
296
|
)}
|
|
218
297
|
</div>
|
|
219
298
|
</AtomixGlass>
|
|
@@ -223,13 +302,42 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
223
302
|
|
|
224
303
|
// If glass is an object, use provided glass props
|
|
225
304
|
return (
|
|
226
|
-
<div
|
|
305
|
+
<div
|
|
306
|
+
className={`${HERO.SELECTORS.CONTENT.replace('.', '')} ${parts?.content?.className || ''}`.trim()}
|
|
307
|
+
style={parts?.content?.style}
|
|
308
|
+
>
|
|
227
309
|
<AtomixGlass {...glass}>
|
|
228
310
|
<div className="u-p-4">
|
|
229
|
-
{subtitle &&
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
311
|
+
{subtitle && (
|
|
312
|
+
<p
|
|
313
|
+
className={`${HERO.SELECTORS.SUBTITLE.replace('.', '')} ${parts?.subtitle?.className || ''}`.trim()}
|
|
314
|
+
style={parts?.subtitle?.style}
|
|
315
|
+
>
|
|
316
|
+
{subtitle}
|
|
317
|
+
</p>
|
|
318
|
+
)}
|
|
319
|
+
<HeadingTag
|
|
320
|
+
className={`${HERO.SELECTORS.TITLE.replace('.', '')} ${parts?.title?.className || ''}`.trim()}
|
|
321
|
+
style={parts?.title?.style}
|
|
322
|
+
>
|
|
323
|
+
{title}
|
|
324
|
+
</HeadingTag>
|
|
325
|
+
{text && (
|
|
326
|
+
<p
|
|
327
|
+
className={`${HERO.SELECTORS.TEXT.replace('.', '')} ${parts?.text?.className || ''}`.trim()}
|
|
328
|
+
style={parts?.text?.style}
|
|
329
|
+
>
|
|
330
|
+
{text}
|
|
331
|
+
</p>
|
|
332
|
+
)}
|
|
333
|
+
{actions && (
|
|
334
|
+
<div
|
|
335
|
+
className={`${HERO.SELECTORS.ACTIONS.replace('.', '')} ${parts?.actions?.className || ''}`.trim()}
|
|
336
|
+
style={parts?.actions?.style}
|
|
337
|
+
>
|
|
338
|
+
{actions}
|
|
339
|
+
</div>
|
|
340
|
+
)}
|
|
233
341
|
</div>
|
|
234
342
|
</AtomixGlass>
|
|
235
343
|
</div>
|
|
@@ -245,15 +353,31 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
245
353
|
|
|
246
354
|
if (alignment === 'center') {
|
|
247
355
|
return (
|
|
248
|
-
<div
|
|
249
|
-
|
|
356
|
+
<div
|
|
357
|
+
className={`${HERO.SELECTORS.IMAGE_WRAPPER.replace('.', '')} ${imageColClassName || ''} ${parts?.imageWrapper?.className || ''}`.trim()}
|
|
358
|
+
style={{ ...imageColStyle, ...parts?.imageWrapper?.style }}
|
|
359
|
+
>
|
|
360
|
+
<img
|
|
361
|
+
src={imageSrc}
|
|
362
|
+
alt={imageAlt}
|
|
363
|
+
className={`${HERO.SELECTORS.IMAGE.replace('.', '')} ${parts?.image?.className || ''}`.trim()}
|
|
364
|
+
style={parts?.image?.style}
|
|
365
|
+
/>
|
|
250
366
|
</div>
|
|
251
367
|
);
|
|
252
368
|
}
|
|
253
369
|
|
|
254
370
|
return (
|
|
255
|
-
<div
|
|
256
|
-
|
|
371
|
+
<div
|
|
372
|
+
className={`${generateImageColClass(imageColSize, imageColClassName)} ${parts?.imageWrapper?.className || ''}`.trim()}
|
|
373
|
+
style={{ ...imageColStyle, ...parts?.imageWrapper?.style }}
|
|
374
|
+
>
|
|
375
|
+
<img
|
|
376
|
+
src={imageSrc}
|
|
377
|
+
alt={imageAlt}
|
|
378
|
+
className={`${HERO.SELECTORS.IMAGE.replace('.', '')} ${parts?.image?.className || ''}`.trim()}
|
|
379
|
+
style={parts?.image?.style}
|
|
380
|
+
/>
|
|
257
381
|
</div>
|
|
258
382
|
);
|
|
259
383
|
};
|
|
@@ -263,7 +387,12 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
263
387
|
if (alignment === 'left') {
|
|
264
388
|
return (
|
|
265
389
|
<>
|
|
266
|
-
<div
|
|
390
|
+
<div
|
|
391
|
+
className={generateContentColClass(contentColSize, contentColClassName)}
|
|
392
|
+
style={contentColStyle}
|
|
393
|
+
>
|
|
394
|
+
{renderContent()}
|
|
395
|
+
</div>
|
|
267
396
|
{renderForegroundImage()}
|
|
268
397
|
</>
|
|
269
398
|
);
|
|
@@ -273,7 +402,12 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
273
402
|
return (
|
|
274
403
|
<>
|
|
275
404
|
{renderForegroundImage()}
|
|
276
|
-
<div
|
|
405
|
+
<div
|
|
406
|
+
className={generateContentColClass(contentColSize, contentColClassName)}
|
|
407
|
+
style={contentColStyle}
|
|
408
|
+
>
|
|
409
|
+
{renderContent()}
|
|
410
|
+
</div>
|
|
277
411
|
</>
|
|
278
412
|
);
|
|
279
413
|
};
|
|
@@ -281,17 +415,29 @@ export const Hero: React.FC<HeroProps> = ({
|
|
|
281
415
|
return (
|
|
282
416
|
<div
|
|
283
417
|
ref={heroRef as React.LegacyRef<HTMLDivElement>}
|
|
284
|
-
className={generateHeroClassNames(className)}
|
|
285
|
-
style={heroStyle}
|
|
418
|
+
className={`${generateHeroClassNames(className)} ${parts?.root?.className || ''}`.trim()}
|
|
419
|
+
style={{ ...heroStyle, ...parts?.root?.style }}
|
|
286
420
|
data-parallax={parallax ? 'true' : undefined}
|
|
287
421
|
data-parallax-intensity={parallax ? parallaxIntensity : undefined}
|
|
422
|
+
{...rest}
|
|
288
423
|
>
|
|
289
424
|
{renderBackground()}
|
|
290
|
-
<div
|
|
425
|
+
<div
|
|
426
|
+
className={`${HERO.SELECTORS.CONTAINER.replace('.', '')} o-container ${parts?.container?.className || ''}`.trim()}
|
|
427
|
+
style={parts?.container?.style}
|
|
428
|
+
>
|
|
291
429
|
{children ? (
|
|
292
|
-
<div
|
|
430
|
+
<div
|
|
431
|
+
className={`${HERO.SELECTORS.GRID.replace('.', '')} ${parts?.grid?.className || ''}`.trim()}
|
|
432
|
+
style={parts?.grid?.style}
|
|
433
|
+
>
|
|
434
|
+
{children}
|
|
435
|
+
</div>
|
|
293
436
|
) : useGridLayout ? (
|
|
294
|
-
<div
|
|
437
|
+
<div
|
|
438
|
+
className={`${HERO.SELECTORS.GRID.replace('.', '')} o-grid ${parts?.grid?.className || ''}`.trim()}
|
|
439
|
+
style={parts?.grid?.style}
|
|
440
|
+
>
|
|
295
441
|
{renderGridContent()}
|
|
296
442
|
</div>
|
|
297
443
|
) : (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { List } from './List';
|
|
4
5
|
import { ListGroup } from './ListGroup';
|
|
@@ -10,8 +11,61 @@ const meta = {
|
|
|
10
11
|
layout: 'centered',
|
|
11
12
|
docs: {
|
|
12
13
|
description: {
|
|
13
|
-
component:
|
|
14
|
-
|
|
14
|
+
component: `
|
|
15
|
+
# List
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
List provides a flexible way to display ordered or unordered lists of items. It supports multiple style variants including default, dashed, numbered, and text styles. Lists can be used for navigation, content organization, or any scenario requiring structured item display.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Multiple style variants (default, dash, number, text)
|
|
24
|
+
- Grouped lists with ListGroup component
|
|
25
|
+
- Compact and divided options
|
|
26
|
+
- Accessible design
|
|
27
|
+
- Responsive behavior
|
|
28
|
+
- Customizable styling
|
|
29
|
+
|
|
30
|
+
## Accessibility
|
|
31
|
+
|
|
32
|
+
- Screen reader: List structure and items announced properly
|
|
33
|
+
- ARIA support: Proper roles and properties for list components
|
|
34
|
+
- Keyboard support: Accessible via keyboard navigation
|
|
35
|
+
- Focus management: Maintains focus within list items
|
|
36
|
+
|
|
37
|
+
## Usage Examples
|
|
38
|
+
|
|
39
|
+
### Basic Usage
|
|
40
|
+
|
|
41
|
+
\`\`\`tsx
|
|
42
|
+
<List>
|
|
43
|
+
<li>Item 1</li>
|
|
44
|
+
<li>Item 2</li>
|
|
45
|
+
<li>Item 3</li>
|
|
46
|
+
</List>
|
|
47
|
+
\`\`\`
|
|
48
|
+
|
|
49
|
+
### With Variant
|
|
50
|
+
|
|
51
|
+
\`\`\`tsx
|
|
52
|
+
<List variant="number">
|
|
53
|
+
<li>Item 1</li>
|
|
54
|
+
<li>Item 2</li>
|
|
55
|
+
<li>Item 3</li>
|
|
56
|
+
</List>
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
## API Reference
|
|
60
|
+
|
|
61
|
+
### Props
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Default | Description |
|
|
64
|
+
| ---- | ---- | ------- | ----------- |
|
|
65
|
+
| variant | 'default' \\| 'dash' \\| 'number' \\| 'text' | 'default' | List style variant |
|
|
66
|
+
| children | ReactNode | - | List items content |
|
|
67
|
+
| className | string | - | Additional CSS class names |
|
|
68
|
+
`,
|
|
15
69
|
},
|
|
16
70
|
},
|
|
17
71
|
},
|
|
@@ -21,14 +75,26 @@ const meta = {
|
|
|
21
75
|
control: { type: 'select' },
|
|
22
76
|
options: ['default', 'dash', 'number', 'text'],
|
|
23
77
|
description: 'List style variant',
|
|
78
|
+
table: {
|
|
79
|
+
type: { summary: '"default" | "dash" | "number" | "text"' },
|
|
80
|
+
defaultValue: { summary: 'default' },
|
|
81
|
+
},
|
|
24
82
|
},
|
|
25
83
|
children: {
|
|
26
|
-
control: { type: '
|
|
84
|
+
control: { type: 'object' },
|
|
27
85
|
description: 'List items content',
|
|
86
|
+
table: {
|
|
87
|
+
type: { summary: 'ReactNode' },
|
|
88
|
+
defaultValue: { summary: '-' },
|
|
89
|
+
},
|
|
28
90
|
},
|
|
29
91
|
className: {
|
|
30
92
|
control: 'text',
|
|
31
93
|
description: 'Additional CSS class names',
|
|
94
|
+
table: {
|
|
95
|
+
type: { summary: 'string' },
|
|
96
|
+
defaultValue: { summary: '-' },
|
|
97
|
+
},
|
|
32
98
|
},
|
|
33
99
|
},
|
|
34
100
|
} satisfies Meta<typeof List>;
|
|
@@ -60,6 +126,78 @@ const createListSection = (title: string, variant: string, key?: string) => (
|
|
|
60
126
|
</div>
|
|
61
127
|
);
|
|
62
128
|
|
|
129
|
+
export const BasicUsage: Story = {
|
|
130
|
+
args: {
|
|
131
|
+
children: (
|
|
132
|
+
<>
|
|
133
|
+
<li>First item</li>
|
|
134
|
+
<li>Second item</li>
|
|
135
|
+
<li>Third item</li>
|
|
136
|
+
</>
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
parameters: {
|
|
140
|
+
docs: {
|
|
141
|
+
description: {
|
|
142
|
+
story: 'Basic list with default styling.',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const AllVariants: Story = {
|
|
149
|
+
render: () => {
|
|
150
|
+
return (
|
|
151
|
+
<div className="u-flex u-flex-column u-gap-8">
|
|
152
|
+
{['Default', 'Dash', 'Number', 'Text'].map((title, index) => {
|
|
153
|
+
const variant = index === 0 ? 'default' : title.toLowerCase();
|
|
154
|
+
return createListSection(`${title} List`, variant, variant);
|
|
155
|
+
})}
|
|
156
|
+
</div>
|
|
157
|
+
);
|
|
158
|
+
},
|
|
159
|
+
parameters: {
|
|
160
|
+
docs: {
|
|
161
|
+
description: {
|
|
162
|
+
story: 'List with all available style variants.',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const WithListGroup: Story = {
|
|
169
|
+
render: () => {
|
|
170
|
+
const listGroupConfig = [
|
|
171
|
+
{ title: 'Standard', compact: false, divided: false },
|
|
172
|
+
{ title: 'Compact', compact: true, divided: false },
|
|
173
|
+
{ title: 'Divided', compact: false, divided: true },
|
|
174
|
+
];
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<div className="u-flex u-flex-column u-gap-8">
|
|
178
|
+
<div>
|
|
179
|
+
<h3 style={titleStyle}>Mixed Variants ListGroup</h3>
|
|
180
|
+
<ListGroup>
|
|
181
|
+
<List variant="dash">
|
|
182
|
+
<ListItems variant="dash" />
|
|
183
|
+
</List>
|
|
184
|
+
<List variant="number">
|
|
185
|
+
<ListItems variant="number" />
|
|
186
|
+
</List>
|
|
187
|
+
</ListGroup>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
parameters: {
|
|
193
|
+
docs: {
|
|
194
|
+
description: {
|
|
195
|
+
story: 'Lists grouped together using the ListGroup component.',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
|
|
63
201
|
// Basic List example
|
|
64
202
|
export const Basic: Story = {
|
|
65
203
|
args: {
|
|
@@ -2,32 +2,28 @@ import React, { memo } from 'react';
|
|
|
2
2
|
import { ListProps } from '../../lib/types/components';
|
|
3
3
|
import { LIST } from '../../lib/constants/components';
|
|
4
4
|
|
|
5
|
-
export const List: React.FC<ListProps> = memo(
|
|
6
|
-
children,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}) => {
|
|
12
|
-
// Generate CSS classes
|
|
13
|
-
const listClasses = [LIST.BASE_CLASS, variant !== 'default' && `c-list--${variant}`, className]
|
|
14
|
-
.filter(Boolean)
|
|
15
|
-
.join(' ');
|
|
5
|
+
export const List: React.FC<ListProps> = memo(
|
|
6
|
+
({ children, variant = 'default', className = '', style, ...props }) => {
|
|
7
|
+
// Generate CSS classes
|
|
8
|
+
const listClasses = [LIST.BASE_CLASS, variant !== 'default' && `c-list--${variant}`, className]
|
|
9
|
+
.filter(Boolean)
|
|
10
|
+
.join(' ');
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
// Determine the HTML element based on variant
|
|
13
|
+
const ListElement = ['number', 'text'].includes(variant) ? 'ol' : 'ul';
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
return (
|
|
16
|
+
<ListElement className={listClasses} style={style} {...props}>
|
|
17
|
+
{React.Children.map(children, child => {
|
|
18
|
+
if (React.isValidElement(child)) {
|
|
19
|
+
return <li className="c-list__item">{child}</li>;
|
|
20
|
+
}
|
|
24
21
|
return <li className="c-list__item">{child}</li>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
22
|
+
})}
|
|
23
|
+
</ListElement>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
31
27
|
|
|
32
28
|
export type { ListProps };
|
|
33
29
|
|