@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
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
2
4
|
import { Button } from './Button';
|
|
3
|
-
import { SIZES } from '../../lib/constants/components';
|
|
5
|
+
import { SIZES, THEME_COLORS } from '../../lib/constants/components';
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// TYPE DEFINITIONS
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Type helper for story props without children requirement
|
|
13
|
+
*/
|
|
14
|
+
type ButtonStoryProps = Omit<React.ComponentProps<typeof Button>, 'children'> & {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// SHARED UTILITIES & CONSTANTS
|
|
20
|
+
// ============================================================================
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Reusable decorators for common story patterns
|
|
24
|
+
*/
|
|
25
|
+
const withBackground = (bgUrl: string) => (Story: any) => (
|
|
26
|
+
<div
|
|
27
|
+
className="u-bg-cover u-bg-center u-p-10 u-rounded-xl"
|
|
28
|
+
style={{
|
|
29
|
+
backgroundImage: `url(${bgUrl})`,
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Story />
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Sample data for stories
|
|
38
|
+
*/
|
|
39
|
+
const sampleData = {
|
|
40
|
+
basic: 'Example text',
|
|
41
|
+
longText: 'Lorem ipsum dolor sit amet...'.repeat(20),
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// ============================================================================
|
|
45
|
+
// META CONFIGURATION
|
|
46
|
+
// ============================================================================
|
|
4
47
|
|
|
5
48
|
const meta = {
|
|
6
49
|
title: 'Components/Button',
|
|
@@ -9,8 +52,73 @@ const meta = {
|
|
|
9
52
|
layout: 'centered',
|
|
10
53
|
docs: {
|
|
11
54
|
description: {
|
|
12
|
-
component:
|
|
13
|
-
|
|
55
|
+
component: `# Button Component
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
The Button component is a versatile interactive element used to trigger actions throughout the application. It supports multiple variants, sizes, states, and can include icons. Buttons are essential for user interactions and provide clear visual feedback for clickable actions.
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
- Multiple color variants (primary, secondary, success, etc.)
|
|
62
|
+
- Different sizes (sm, md, lg)
|
|
63
|
+
- Support for icons and icon-only buttons
|
|
64
|
+
- Loading states with optional loading text
|
|
65
|
+
- Disabled, active, and selected states
|
|
66
|
+
- Full-width and block-level options
|
|
67
|
+
- Glass morphism effect support
|
|
68
|
+
- Rounded (pill-shaped) style option
|
|
69
|
+
|
|
70
|
+
## Accessibility
|
|
71
|
+
- Keyboard support: Space and Enter keys activate the button
|
|
72
|
+
- Screen reader: Proper labeling and role attributes
|
|
73
|
+
- ARIA support: Correct roles and states for interactive elements
|
|
74
|
+
- Focus management: Visual focus indicator for keyboard navigation
|
|
75
|
+
|
|
76
|
+
## Usage Examples
|
|
77
|
+
### Basic Usage
|
|
78
|
+
\`\`\`tsx
|
|
79
|
+
<Button label="Click Me" variant="primary" />
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
### With Icon
|
|
83
|
+
\`\`\`tsx
|
|
84
|
+
<Button label="Add Item" variant="primary" icon={<PlusIcon />} />
|
|
85
|
+
\`\`\`
|
|
86
|
+
|
|
87
|
+
### Loading State
|
|
88
|
+
\`\`\`tsx
|
|
89
|
+
<Button label="Saving..." variant="primary" loading />
|
|
90
|
+
\`\`\`
|
|
91
|
+
|
|
92
|
+
## API Reference
|
|
93
|
+
| Prop | Type | Default | Description |
|
|
94
|
+
|------|------|---------|-------------|
|
|
95
|
+
| variant | string | 'primary' | Visual style variant |
|
|
96
|
+
| size | string | 'md' | Size of the button (sm, md, lg) |
|
|
97
|
+
| disabled | boolean | false | Disables button interaction |
|
|
98
|
+
| icon | ReactNode | - | Icon element to display in the button |
|
|
99
|
+
| iconOnly | boolean | false | Renders only the icon without text |
|
|
100
|
+
| rounded | boolean | false | Makes the button fully rounded (pill-shaped) |
|
|
101
|
+
| glass | boolean or GlassConfig | false | Enables glass morphism effect |
|
|
102
|
+
| loading | boolean | false | Shows loading spinner and disables interaction |
|
|
103
|
+
| loadingText | string | - | Custom text to display during loading |
|
|
104
|
+
| fullWidth | boolean | false | Makes button take full container width |
|
|
105
|
+
| block | boolean | false | Makes button a block-level element |
|
|
106
|
+
| active | boolean | false | Applies active state styling |
|
|
107
|
+
| selected | boolean | false | Applies selected state styling |
|
|
108
|
+
| iconPosition | 'start' or 'end' | 'start' | Position of the icon relative to text |
|
|
109
|
+
|
|
110
|
+
## Design Tokens
|
|
111
|
+
- \`--atomix-btn-padding\`: Padding around button content
|
|
112
|
+
- \`--atomix-btn-font-size\`: Font size of button text
|
|
113
|
+
- \`--atomix-btn-border-radius\`: Border radius of button
|
|
114
|
+
- \`--atomix-btn-transition\`: Transition effect for button states
|
|
115
|
+
- \`--atomix-btn-bg\`: Background color of button
|
|
116
|
+
- \`--atomix-btn-color\`: Text color of button
|
|
117
|
+
- \`--atomix-btn-shadow\`: Shadow of button
|
|
118
|
+
|
|
119
|
+
## Notes
|
|
120
|
+
Buttons are essential for user interactions and should be used consistently throughout the application to maintain a cohesive experience. Consider the context and purpose when choosing the appropriate variant and size.
|
|
121
|
+
`,
|
|
14
122
|
},
|
|
15
123
|
},
|
|
16
124
|
},
|
|
@@ -38,62 +146,121 @@ const meta = {
|
|
|
38
146
|
'link',
|
|
39
147
|
],
|
|
40
148
|
description: 'The visual style of the button',
|
|
41
|
-
|
|
149
|
+
table: {
|
|
150
|
+
type: { summary: 'string' },
|
|
151
|
+
defaultValue: { summary: 'primary' },
|
|
152
|
+
},
|
|
42
153
|
},
|
|
43
154
|
size: {
|
|
44
155
|
control: { type: 'select' },
|
|
45
156
|
options: SIZES,
|
|
46
157
|
description: 'The size of the button',
|
|
47
|
-
|
|
158
|
+
table: {
|
|
159
|
+
type: { summary: 'string' },
|
|
160
|
+
defaultValue: { summary: 'md' },
|
|
161
|
+
},
|
|
48
162
|
},
|
|
49
163
|
disabled: {
|
|
50
164
|
control: 'boolean',
|
|
51
165
|
description: 'Whether the button is disabled',
|
|
166
|
+
table: {
|
|
167
|
+
type: { summary: 'boolean' },
|
|
168
|
+
defaultValue: { summary: 'false' },
|
|
169
|
+
},
|
|
52
170
|
},
|
|
53
171
|
icon: {
|
|
54
|
-
control: '
|
|
172
|
+
control: 'object',
|
|
55
173
|
description: 'Optional icon element to display in the button',
|
|
174
|
+
table: {
|
|
175
|
+
type: { summary: 'ReactNode' },
|
|
176
|
+
},
|
|
56
177
|
},
|
|
57
178
|
iconOnly: {
|
|
58
179
|
control: 'boolean',
|
|
59
180
|
description: 'Whether the button should only display an icon',
|
|
181
|
+
table: {
|
|
182
|
+
type: { summary: 'boolean' },
|
|
183
|
+
defaultValue: { summary: 'false' },
|
|
184
|
+
},
|
|
60
185
|
},
|
|
61
186
|
rounded: {
|
|
62
187
|
control: 'boolean',
|
|
63
188
|
description: 'Whether the button should have a fully rounded (pill) shape',
|
|
189
|
+
table: {
|
|
190
|
+
type: { summary: 'boolean' },
|
|
191
|
+
defaultValue: { summary: 'false' },
|
|
192
|
+
},
|
|
64
193
|
},
|
|
65
194
|
glass: {
|
|
66
|
-
control:
|
|
195
|
+
control: 'object',
|
|
67
196
|
description: 'Apply glass morphism effect to the button',
|
|
197
|
+
table: {
|
|
198
|
+
type: { summary: 'boolean | GlassConfig' },
|
|
199
|
+
defaultValue: { summary: 'false' },
|
|
200
|
+
},
|
|
68
201
|
},
|
|
69
202
|
loading: {
|
|
70
203
|
control: 'boolean',
|
|
71
204
|
description: 'Whether the button is in a loading state',
|
|
205
|
+
table: {
|
|
206
|
+
type: { summary: 'boolean' },
|
|
207
|
+
defaultValue: { summary: 'false' },
|
|
208
|
+
},
|
|
72
209
|
},
|
|
73
210
|
loadingText: {
|
|
74
211
|
control: 'text',
|
|
75
212
|
description: 'Custom text to display during loading',
|
|
213
|
+
table: {
|
|
214
|
+
type: { summary: 'string' },
|
|
215
|
+
},
|
|
76
216
|
},
|
|
77
217
|
fullWidth: {
|
|
78
218
|
control: 'boolean',
|
|
79
219
|
description: 'Whether the button should take full width',
|
|
220
|
+
table: {
|
|
221
|
+
type: { summary: 'boolean' },
|
|
222
|
+
defaultValue: { summary: 'false' },
|
|
223
|
+
},
|
|
80
224
|
},
|
|
81
225
|
block: {
|
|
82
226
|
control: 'boolean',
|
|
83
227
|
description: 'Whether the button should be block-level',
|
|
228
|
+
table: {
|
|
229
|
+
type: { summary: 'boolean' },
|
|
230
|
+
defaultValue: { summary: 'false' },
|
|
231
|
+
},
|
|
84
232
|
},
|
|
85
233
|
active: {
|
|
86
234
|
control: 'boolean',
|
|
87
235
|
description: 'Whether the button is in active state',
|
|
236
|
+
table: {
|
|
237
|
+
type: { summary: 'boolean' },
|
|
238
|
+
defaultValue: { summary: 'false' },
|
|
239
|
+
},
|
|
88
240
|
},
|
|
89
241
|
selected: {
|
|
90
242
|
control: 'boolean',
|
|
91
243
|
description: 'Whether the button is selected',
|
|
244
|
+
table: {
|
|
245
|
+
type: { summary: 'boolean' },
|
|
246
|
+
defaultValue: { summary: 'false' },
|
|
247
|
+
},
|
|
92
248
|
},
|
|
93
249
|
iconPosition: {
|
|
94
250
|
control: { type: 'select' },
|
|
95
251
|
options: ['start', 'end'],
|
|
96
252
|
description: 'Position of the icon',
|
|
253
|
+
table: {
|
|
254
|
+
type: { summary: '"start" | "end"' },
|
|
255
|
+
defaultValue: { summary: 'start' },
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
onClick: {
|
|
259
|
+
action: 'clicked',
|
|
260
|
+
description: 'Click event handler',
|
|
261
|
+
table: {
|
|
262
|
+
type: { summary: '(event: React.MouseEvent) => void' },
|
|
263
|
+
},
|
|
97
264
|
},
|
|
98
265
|
},
|
|
99
266
|
} satisfies Meta<typeof Button>;
|
|
@@ -118,152 +285,157 @@ const Icon = () => (
|
|
|
118
285
|
</svg>
|
|
119
286
|
);
|
|
120
287
|
|
|
288
|
+
// ============================================================================
|
|
289
|
+
// BASIC USAGE STORIES
|
|
290
|
+
// ============================================================================
|
|
291
|
+
|
|
121
292
|
/**
|
|
122
|
-
*
|
|
293
|
+
* Basic button usage with minimal props
|
|
123
294
|
*/
|
|
124
|
-
export const
|
|
295
|
+
export const BasicUsage: Story = {
|
|
125
296
|
args: {
|
|
126
|
-
label: '
|
|
297
|
+
label: 'Basic Button',
|
|
127
298
|
variant: 'primary',
|
|
128
299
|
size: 'md',
|
|
129
300
|
},
|
|
130
301
|
};
|
|
131
302
|
|
|
132
303
|
/**
|
|
133
|
-
*
|
|
304
|
+
* Button with all available props configured
|
|
134
305
|
*/
|
|
135
|
-
export const
|
|
306
|
+
export const WithAllProps: Story = {
|
|
136
307
|
args: {
|
|
137
|
-
label: '
|
|
138
|
-
variant: '
|
|
308
|
+
label: 'Complete Button',
|
|
309
|
+
variant: 'primary',
|
|
139
310
|
size: 'md',
|
|
311
|
+
icon: <Icon />,
|
|
312
|
+
iconPosition: 'start',
|
|
313
|
+
rounded: true,
|
|
314
|
+
loading: false,
|
|
315
|
+
disabled: false,
|
|
140
316
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
args: {
|
|
148
|
-
label: 'Success Button',
|
|
149
|
-
variant: 'success',
|
|
150
|
-
size: 'md',
|
|
317
|
+
parameters: {
|
|
318
|
+
docs: {
|
|
319
|
+
description: {
|
|
320
|
+
story: 'Demonstrates Button with all props configured.',
|
|
321
|
+
},
|
|
322
|
+
},
|
|
151
323
|
},
|
|
152
324
|
};
|
|
153
325
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export const Info: Story = {
|
|
158
|
-
args: {
|
|
159
|
-
label: 'Info Button',
|
|
160
|
-
variant: 'info',
|
|
161
|
-
size: 'md',
|
|
162
|
-
},
|
|
163
|
-
};
|
|
326
|
+
// ============================================================================
|
|
327
|
+
// VARIANTS & STATES STORIES
|
|
328
|
+
// ============================================================================
|
|
164
329
|
|
|
165
330
|
/**
|
|
166
|
-
*
|
|
331
|
+
* Shows all available button color variants
|
|
167
332
|
*/
|
|
168
|
-
export const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Error button variant - indicates destructive or error actions.
|
|
178
|
-
*/
|
|
179
|
-
export const Error: Story = {
|
|
180
|
-
args: {
|
|
181
|
-
label: 'Error Button',
|
|
182
|
-
variant: 'error',
|
|
183
|
-
size: 'md',
|
|
184
|
-
},
|
|
333
|
+
export const AllVariants: Story = {
|
|
334
|
+
render: () => (
|
|
335
|
+
<div className="u-flex u-flex-wrap u-gap-2">
|
|
336
|
+
{THEME_COLORS.map(color => (
|
|
337
|
+
<Button key={color} label={color} variant={color as any} />
|
|
338
|
+
))}
|
|
339
|
+
</div>
|
|
340
|
+
),
|
|
185
341
|
};
|
|
186
342
|
|
|
187
343
|
/**
|
|
188
|
-
*
|
|
344
|
+
* Shows all available outline button variants
|
|
189
345
|
*/
|
|
190
|
-
export const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
346
|
+
export const AllOutlineVariants: Story = {
|
|
347
|
+
render: () => (
|
|
348
|
+
<div className="u-flex u-flex-wrap u-gap-2">
|
|
349
|
+
<Button label="Outline Primary" variant="outline-primary" />
|
|
350
|
+
<Button label="Outline Secondary" variant="outline-secondary" />
|
|
351
|
+
<Button label="Outline Success" variant="outline-success" />
|
|
352
|
+
<Button label="Outline Info" variant="outline-info" />
|
|
353
|
+
<Button label="Outline Warning" variant="outline-warning" />
|
|
354
|
+
<Button label="Outline Danger" variant="outline-danger" />
|
|
355
|
+
<Button label="Outline Light" variant="outline-light" />
|
|
356
|
+
<Button label="Outline Dark" variant="outline-dark" />
|
|
357
|
+
</div>
|
|
358
|
+
),
|
|
196
359
|
};
|
|
197
360
|
|
|
198
361
|
/**
|
|
199
|
-
*
|
|
362
|
+
* Shows all available button sizes
|
|
200
363
|
*/
|
|
201
|
-
export const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
364
|
+
export const AllSizes: Story = {
|
|
365
|
+
render: () => (
|
|
366
|
+
<div className="u-flex u-items-center u-gap-2">
|
|
367
|
+
<Button label="Small" variant="primary" size="sm" />
|
|
368
|
+
<Button label="Medium" variant="primary" size="md" />
|
|
369
|
+
<Button label="Large" variant="primary" size="lg" />
|
|
370
|
+
</div>
|
|
371
|
+
),
|
|
207
372
|
};
|
|
208
373
|
|
|
209
374
|
/**
|
|
210
|
-
*
|
|
375
|
+
* Shows default state of the button (normal, interactive state)
|
|
211
376
|
*/
|
|
212
|
-
export const
|
|
377
|
+
export const DefaultState: Story = {
|
|
213
378
|
args: {
|
|
214
|
-
label: '
|
|
215
|
-
variant: '
|
|
379
|
+
label: 'Default Button',
|
|
380
|
+
variant: 'primary',
|
|
216
381
|
size: 'md',
|
|
217
382
|
},
|
|
218
383
|
};
|
|
219
384
|
|
|
220
385
|
/**
|
|
221
|
-
*
|
|
386
|
+
* Shows button in loading state with spinner
|
|
222
387
|
*/
|
|
223
|
-
export const
|
|
388
|
+
export const LoadingState: Story = {
|
|
224
389
|
args: {
|
|
225
|
-
label: '
|
|
390
|
+
label: 'Loading...',
|
|
226
391
|
variant: 'primary',
|
|
227
|
-
size: '
|
|
392
|
+
size: 'md',
|
|
393
|
+
loading: true,
|
|
228
394
|
},
|
|
229
395
|
};
|
|
230
396
|
|
|
231
397
|
/**
|
|
232
|
-
*
|
|
398
|
+
* Shows button in disabled state (non-interactive)
|
|
233
399
|
*/
|
|
234
|
-
export const
|
|
400
|
+
export const DisabledState: Story = {
|
|
235
401
|
args: {
|
|
236
|
-
label: '
|
|
402
|
+
label: 'Disabled Button',
|
|
237
403
|
variant: 'primary',
|
|
238
404
|
size: 'md',
|
|
405
|
+
disabled: true,
|
|
239
406
|
},
|
|
240
407
|
};
|
|
241
408
|
|
|
242
409
|
/**
|
|
243
|
-
*
|
|
410
|
+
* Shows button in active state
|
|
244
411
|
*/
|
|
245
|
-
export const
|
|
412
|
+
export const ActiveState: Story = {
|
|
246
413
|
args: {
|
|
247
|
-
label: '
|
|
414
|
+
label: 'Active Button',
|
|
248
415
|
variant: 'primary',
|
|
249
|
-
size: '
|
|
416
|
+
size: 'md',
|
|
417
|
+
active: true,
|
|
250
418
|
},
|
|
251
419
|
};
|
|
252
420
|
|
|
253
421
|
/**
|
|
254
|
-
*
|
|
422
|
+
* Shows button in selected state
|
|
255
423
|
*/
|
|
256
|
-
export const
|
|
424
|
+
export const SelectedState: Story = {
|
|
257
425
|
args: {
|
|
258
|
-
label: '
|
|
426
|
+
label: 'Selected Button',
|
|
259
427
|
variant: 'primary',
|
|
260
428
|
size: 'md',
|
|
261
|
-
|
|
429
|
+
selected: true,
|
|
262
430
|
},
|
|
263
431
|
};
|
|
264
432
|
|
|
433
|
+
// ============================================================================
|
|
434
|
+
// WITH FEATURES STORIES
|
|
435
|
+
// ============================================================================
|
|
436
|
+
|
|
265
437
|
/**
|
|
266
|
-
*
|
|
438
|
+
* Shows button with icon support
|
|
267
439
|
*/
|
|
268
440
|
export const WithIcon: Story = {
|
|
269
441
|
args: {
|
|
@@ -275,11 +447,23 @@ export const WithIcon: Story = {
|
|
|
275
447
|
};
|
|
276
448
|
|
|
277
449
|
/**
|
|
278
|
-
*
|
|
450
|
+
* Shows icon positioned at start and end of button
|
|
451
|
+
*/
|
|
452
|
+
export const WithIconPosition: Story = {
|
|
453
|
+
render: () => (
|
|
454
|
+
<div className="u-flex u-gap-2">
|
|
455
|
+
<Button label="Icon Start" variant="primary" icon={<Icon />} iconPosition="start" />
|
|
456
|
+
<Button label="Icon End" variant="secondary" icon={<Icon />} iconPosition="end" />
|
|
457
|
+
</div>
|
|
458
|
+
),
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Shows button with icon only (no text)
|
|
279
463
|
*/
|
|
280
|
-
export const
|
|
464
|
+
export const WithIconOnly: Story = {
|
|
281
465
|
args: {
|
|
282
|
-
label: '
|
|
466
|
+
label: 'Icon Only Button',
|
|
283
467
|
variant: 'primary',
|
|
284
468
|
size: 'md',
|
|
285
469
|
icon: <Icon />,
|
|
@@ -288,1169 +472,313 @@ export const IconOnly: Story = {
|
|
|
288
472
|
};
|
|
289
473
|
|
|
290
474
|
/**
|
|
291
|
-
*
|
|
475
|
+
* Shows complex nested content in button
|
|
292
476
|
*/
|
|
293
|
-
export const
|
|
294
|
-
args: {
|
|
295
|
-
label: 'Button',
|
|
296
|
-
variant: 'success',
|
|
297
|
-
},
|
|
298
|
-
parameters: {
|
|
299
|
-
docs: {
|
|
300
|
-
description: {
|
|
301
|
-
story: 'Displays all available button color variants side by side for easy comparison.',
|
|
302
|
-
},
|
|
303
|
-
},
|
|
304
|
-
},
|
|
477
|
+
export const WithChildren: Story = {
|
|
305
478
|
render: () => (
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
<Button label="Success" variant="success" />
|
|
310
|
-
<Button label="Info" variant="info" />
|
|
311
|
-
<Button label="Warning" variant="warning" />
|
|
312
|
-
<Button label="Error" variant="error" />
|
|
313
|
-
<Button label="Light" variant="light" />
|
|
314
|
-
<Button label="Dark" variant="dark" />
|
|
315
|
-
</div>
|
|
479
|
+
<Button variant="primary">
|
|
480
|
+
Button with <strong>Complex Content</strong>
|
|
481
|
+
</Button>
|
|
316
482
|
),
|
|
317
483
|
};
|
|
318
484
|
|
|
319
485
|
/**
|
|
320
|
-
*
|
|
486
|
+
* Shows button with helper text or description
|
|
321
487
|
*/
|
|
322
|
-
export const
|
|
323
|
-
args: {
|
|
324
|
-
label: 'Button',
|
|
325
|
-
variant: 'outline-primary',
|
|
326
|
-
},
|
|
327
|
-
parameters: {
|
|
328
|
-
docs: {
|
|
329
|
-
description: {
|
|
330
|
-
story: 'Displays all available outline button variants with transparent backgrounds and colored borders.',
|
|
331
|
-
},
|
|
332
|
-
},
|
|
333
|
-
},
|
|
488
|
+
export const WithHelperText: Story = {
|
|
334
489
|
render: () => (
|
|
335
|
-
<div className="u-flex u-flex-
|
|
336
|
-
<Button label="
|
|
337
|
-
<
|
|
338
|
-
<Button label="Outline Success" variant="outline-success" />
|
|
339
|
-
<Button label="Outline Info" variant="outline-info" />
|
|
340
|
-
<Button label="Outline Warning" variant="outline-warning" />
|
|
341
|
-
<Button label="Outline Error" variant="outline-error" />
|
|
342
|
-
<Button label="Outline Light" variant="outline-light" />
|
|
343
|
-
<Button label="Outline Dark" variant="outline-dark" />
|
|
490
|
+
<div className="u-flex u-flex-column u-gap-2">
|
|
491
|
+
<Button label="Button with Helper" variant="primary" />
|
|
492
|
+
<p className="u-m-0 u-text-sm">This is a helper text for the button</p>
|
|
344
493
|
</div>
|
|
345
494
|
),
|
|
346
495
|
};
|
|
347
496
|
|
|
497
|
+
// ============================================================================
|
|
498
|
+
// ADVANCED CONFIGURATION STORIES
|
|
499
|
+
// ============================================================================
|
|
500
|
+
|
|
348
501
|
/**
|
|
349
|
-
*
|
|
502
|
+
* Shows button with custom inline styles
|
|
350
503
|
*/
|
|
351
|
-
export const
|
|
504
|
+
export const CustomStyling: Story = {
|
|
352
505
|
args: {
|
|
353
|
-
label: 'Button',
|
|
506
|
+
label: 'Custom Styled Button',
|
|
354
507
|
variant: 'primary',
|
|
508
|
+
size: 'md',
|
|
355
509
|
},
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
<Button label="Small" variant="primary" size="sm" />
|
|
366
|
-
<Button label="Medium" variant="primary" size="md" />
|
|
367
|
-
<Button label="Large" variant="primary" size="lg" />
|
|
368
|
-
</div>
|
|
510
|
+
render: args => (
|
|
511
|
+
<Button
|
|
512
|
+
{...args}
|
|
513
|
+
style={{
|
|
514
|
+
background: 'linear-gradient(45deg, #667eea, #764ba2)',
|
|
515
|
+
border: 'none',
|
|
516
|
+
boxShadow: '0 4px 15px rgba(0, 0, 0, 0.2)',
|
|
517
|
+
}}
|
|
518
|
+
/>
|
|
369
519
|
),
|
|
370
520
|
};
|
|
371
521
|
|
|
372
522
|
/**
|
|
373
|
-
*
|
|
523
|
+
* Shows button with custom CSS class
|
|
374
524
|
*/
|
|
375
|
-
export const
|
|
525
|
+
export const WithClassName: Story = {
|
|
376
526
|
args: {
|
|
377
|
-
label: '
|
|
527
|
+
label: 'Styled with Class',
|
|
378
528
|
variant: 'primary',
|
|
379
|
-
|
|
380
|
-
|
|
529
|
+
size: 'md',
|
|
530
|
+
className: 'custom-button-style',
|
|
381
531
|
},
|
|
382
|
-
render: () => (
|
|
383
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
384
|
-
<Button label="Add" variant="primary" icon={<Icon />} />
|
|
385
|
-
<Button label="Add" variant="secondary" icon={<Icon />} />
|
|
386
|
-
<Button label="Add" variant="success" icon={<Icon />} />
|
|
387
|
-
<Button label="Add" variant="primary" icon={<Icon />} iconOnly />
|
|
388
|
-
<Button label="Add" variant="secondary" icon={<Icon />} iconOnly />
|
|
389
|
-
<Button label="Add" variant="success" icon={<Icon />} iconOnly />
|
|
390
|
-
</div>
|
|
391
|
-
),
|
|
392
532
|
};
|
|
393
533
|
|
|
394
534
|
/**
|
|
395
|
-
*
|
|
535
|
+
* Shows button with additional HTML attributes
|
|
396
536
|
*/
|
|
397
|
-
export const
|
|
537
|
+
export const WithAttributes: Story = {
|
|
398
538
|
args: {
|
|
399
|
-
label: '
|
|
539
|
+
label: 'Button with Attributes',
|
|
400
540
|
variant: 'primary',
|
|
401
541
|
size: 'md',
|
|
402
|
-
|
|
542
|
+
id: 'my-button',
|
|
543
|
+
'aria-label': 'My custom button',
|
|
544
|
+
'data-testid': 'test-button',
|
|
403
545
|
},
|
|
404
546
|
};
|
|
405
547
|
|
|
548
|
+
// ============================================================================
|
|
549
|
+
// EDGE CASES STORIES
|
|
550
|
+
// ============================================================================
|
|
551
|
+
|
|
406
552
|
/**
|
|
407
|
-
*
|
|
553
|
+
* Shows how button handles very long text
|
|
408
554
|
*/
|
|
409
|
-
export const
|
|
555
|
+
export const LongText: Story = {
|
|
410
556
|
args: {
|
|
411
|
-
label: '
|
|
557
|
+
label: 'Very long text that might overflow or wrap to multiple lines in the button component',
|
|
412
558
|
variant: 'primary',
|
|
413
|
-
|
|
559
|
+
size: 'md',
|
|
414
560
|
},
|
|
415
|
-
render: () => (
|
|
416
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
417
|
-
<Button label="Primary" variant="primary" rounded />
|
|
418
|
-
<Button label="Secondary" variant="secondary" rounded />
|
|
419
|
-
<Button label="Success" variant="success" rounded />
|
|
420
|
-
<Button label="Info" variant="info" rounded />
|
|
421
|
-
<Button label="Warning" variant="warning" rounded />
|
|
422
|
-
<Button label="Error" variant="error" rounded />
|
|
423
|
-
<Button label="Light" variant="light" rounded />
|
|
424
|
-
<Button label="Dark" variant="dark" rounded />
|
|
425
|
-
</div>
|
|
426
|
-
),
|
|
427
561
|
};
|
|
428
562
|
|
|
429
563
|
/**
|
|
430
|
-
*
|
|
564
|
+
* Shows button behavior when icon is missing
|
|
431
565
|
*/
|
|
432
|
-
export const
|
|
566
|
+
export const NoIconFallback: Story = {
|
|
433
567
|
args: {
|
|
434
|
-
label: 'Button
|
|
568
|
+
label: 'Button without Icon',
|
|
435
569
|
variant: 'primary',
|
|
570
|
+
size: 'md',
|
|
571
|
+
// Intentionally not providing icon prop to show fallback
|
|
436
572
|
},
|
|
437
573
|
};
|
|
438
574
|
|
|
439
575
|
/**
|
|
440
|
-
*
|
|
576
|
+
* Shows button with async callback handling
|
|
441
577
|
*/
|
|
442
|
-
export const
|
|
443
|
-
render: () =>
|
|
444
|
-
|
|
445
|
-
Button with Children
|
|
446
|
-
</Button>
|
|
447
|
-
),
|
|
448
|
-
};
|
|
578
|
+
export const WithAsyncAction: Story = {
|
|
579
|
+
render: () => {
|
|
580
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
449
581
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
<Icon />
|
|
457
|
-
Add Item
|
|
458
|
-
</Button>
|
|
459
|
-
),
|
|
460
|
-
};
|
|
582
|
+
const handleClick = useCallback(async () => {
|
|
583
|
+
setIsLoading(true);
|
|
584
|
+
// Simulate async operation
|
|
585
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
586
|
+
setIsLoading(false);
|
|
587
|
+
}, []);
|
|
461
588
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
export const GlassEffect: Story = {
|
|
466
|
-
args: {
|
|
467
|
-
label: 'Glass Button',
|
|
468
|
-
variant: 'primary',
|
|
469
|
-
glass: true,
|
|
589
|
+
return (
|
|
590
|
+
<Button label="Async Action" variant="primary" loading={isLoading} onClick={handleClick} />
|
|
591
|
+
);
|
|
470
592
|
},
|
|
471
|
-
decorators: [
|
|
472
|
-
Story => (
|
|
473
|
-
<div
|
|
474
|
-
style={{
|
|
475
|
-
background:
|
|
476
|
-
'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
|
|
477
|
-
backgroundSize: 'cover',
|
|
478
|
-
backgroundPosition: 'center',
|
|
479
|
-
padding: '10rem 25rem',
|
|
480
|
-
borderRadius: '12px',
|
|
481
|
-
}}
|
|
482
|
-
>
|
|
483
|
-
<Story />
|
|
484
|
-
</div>
|
|
485
|
-
),
|
|
486
|
-
],
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
export const GlassEffectCustomized: Story = {
|
|
490
|
-
args: {
|
|
491
|
-
label: 'Customized Glass',
|
|
492
|
-
variant: 'secondary',
|
|
493
|
-
glass: {
|
|
494
|
-
displacementScale: 60,
|
|
495
|
-
blurAmount: 2,
|
|
496
|
-
saturation: 180,
|
|
497
|
-
aberrationIntensity: 2,
|
|
498
|
-
cornerRadius: 12,
|
|
499
|
-
overLight: false,
|
|
500
|
-
mode: 'polar' as const,
|
|
501
|
-
},
|
|
502
|
-
},
|
|
503
|
-
decorators: [
|
|
504
|
-
Story => (
|
|
505
|
-
<div
|
|
506
|
-
style={{
|
|
507
|
-
background:
|
|
508
|
-
'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
|
|
509
|
-
backgroundSize: 'cover',
|
|
510
|
-
backgroundPosition: 'center',
|
|
511
|
-
padding: '25rem',
|
|
512
|
-
borderRadius: '12px',
|
|
513
|
-
}}
|
|
514
|
-
>
|
|
515
|
-
<Story />
|
|
516
|
-
</div>
|
|
517
|
-
),
|
|
518
|
-
],
|
|
519
593
|
};
|
|
520
594
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
variant: 'primary',
|
|
525
|
-
glass: true,
|
|
526
|
-
},
|
|
527
|
-
render: () => (
|
|
528
|
-
<div
|
|
529
|
-
style={{
|
|
530
|
-
background:
|
|
531
|
-
'url(https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg)',
|
|
532
|
-
backgroundSize: 'cover',
|
|
533
|
-
backgroundPosition: 'center',
|
|
534
|
-
padding: '25rem',
|
|
535
|
-
borderRadius: '12px',
|
|
536
|
-
}}
|
|
537
|
-
>
|
|
538
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
539
|
-
<Button label="Primary" variant="primary" glass />
|
|
540
|
-
<Button label="Secondary" variant="secondary" glass />
|
|
541
|
-
<Button label="Success" variant="success" glass />
|
|
542
|
-
<Button label="Info" variant="info" glass />
|
|
543
|
-
<Button label="Warning" variant="warning" glass />
|
|
544
|
-
<Button label="Error" variant="error" glass />
|
|
545
|
-
<Button label="Light" variant="light" glass />
|
|
546
|
-
<Button label="Dark" variant="dark" glass />
|
|
547
|
-
</div>
|
|
548
|
-
</div>
|
|
549
|
-
),
|
|
550
|
-
};
|
|
595
|
+
// ============================================================================
|
|
596
|
+
// INTEGRATION EXAMPLES STORIES
|
|
597
|
+
// ============================================================================
|
|
551
598
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
glass: true,
|
|
557
|
-
},
|
|
558
|
-
render: () => (
|
|
559
|
-
<div
|
|
560
|
-
style={{
|
|
561
|
-
background:
|
|
562
|
-
'url(https://cdn.pixabay.com/photo/2018/08/15/13/10/new-year-background-3608029_1280.jpg)',
|
|
563
|
-
backgroundSize: 'cover',
|
|
564
|
-
backgroundPosition: 'center',
|
|
565
|
-
padding: '20rem 10rem',
|
|
566
|
-
borderRadius: '12px',
|
|
567
|
-
}}
|
|
568
|
-
>
|
|
569
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
570
|
-
<Button label="Outline Primary" variant="outline-primary" glass />
|
|
571
|
-
<Button label="Outline Secondary" variant="outline-secondary" glass />
|
|
572
|
-
<Button label="Outline Success" variant="outline-success" glass />
|
|
573
|
-
<Button label="Outline Info" variant="outline-info" glass />
|
|
574
|
-
<Button label="Outline Warning" variant="outline-warning" glass />
|
|
575
|
-
<Button label="Outline Error" variant="outline-error" glass />
|
|
576
|
-
<Button label="Outline Light" variant="outline-light" glass />
|
|
577
|
-
<Button label="Outline Dark" variant="outline-dark" glass />
|
|
578
|
-
</div>
|
|
579
|
-
</div>
|
|
580
|
-
),
|
|
581
|
-
};
|
|
582
|
-
|
|
583
|
-
export const GlassSizes: Story = {
|
|
584
|
-
args: {
|
|
585
|
-
label: 'Glass Button',
|
|
586
|
-
variant: 'primary',
|
|
587
|
-
glass: true,
|
|
588
|
-
},
|
|
599
|
+
/**
|
|
600
|
+
* Button used in a form context
|
|
601
|
+
*/
|
|
602
|
+
export const InForm: Story = {
|
|
589
603
|
render: () => (
|
|
590
|
-
<
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
backgroundPosition: 'center',
|
|
595
|
-
padding: '10rem 20rem',
|
|
596
|
-
borderRadius: '12px',
|
|
597
|
-
}}
|
|
598
|
-
>
|
|
599
|
-
<div className="u-flex u-items-center u-gap-2">
|
|
600
|
-
<Button label="Small Glass" variant="primary" size="sm" glass={{ cornerRadius: 8 }} />
|
|
601
|
-
<Button label="Medium Glass" variant="primary" size="md" glass />
|
|
602
|
-
<Button label="Large Glass" variant="primary" size="lg" glass />
|
|
603
|
-
</div>
|
|
604
|
-
</div>
|
|
604
|
+
<form className="u-flex u-flex-column u-gap-2">
|
|
605
|
+
<input type="text" placeholder="Enter name" className="u-p-2 u-mb-2 u-border u-rounded" />
|
|
606
|
+
<Button label="Submit Form" variant="primary" />
|
|
607
|
+
</form>
|
|
605
608
|
),
|
|
606
609
|
};
|
|
607
610
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
glass: true,
|
|
613
|
-
icon: <Icon />,
|
|
614
|
-
},
|
|
611
|
+
/**
|
|
612
|
+
* Button used in a card component
|
|
613
|
+
*/
|
|
614
|
+
export const InCard: Story = {
|
|
615
615
|
render: () => (
|
|
616
|
-
<div
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
padding: '25rem',
|
|
622
|
-
borderRadius: '12px',
|
|
623
|
-
}}
|
|
624
|
-
>
|
|
625
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
626
|
-
<Button label="With Icon" variant="primary" icon={<Icon />} glass={{ cornerRadius: 12 }} />
|
|
627
|
-
<Button
|
|
628
|
-
label="Icon Only"
|
|
629
|
-
variant="error"
|
|
630
|
-
icon={<Icon />}
|
|
631
|
-
iconOnly
|
|
632
|
-
glass={{ cornerRadius: 12 }}
|
|
633
|
-
/>
|
|
634
|
-
<Button
|
|
635
|
-
label="Rounded Glass"
|
|
636
|
-
variant="success"
|
|
637
|
-
icon={<Icon />}
|
|
638
|
-
rounded
|
|
639
|
-
glass={{ cornerRadius: 24 }}
|
|
640
|
-
/>
|
|
641
|
-
<Button
|
|
642
|
-
label="Rounded Icon"
|
|
643
|
-
variant="info"
|
|
644
|
-
icon={<Icon />}
|
|
645
|
-
iconOnly
|
|
646
|
-
rounded
|
|
647
|
-
glass={{ cornerRadius: 50 }}
|
|
648
|
-
/>
|
|
616
|
+
<div className="u-p-4 u-bg-white u-rounded-lg u-shadow u-w-64">
|
|
617
|
+
<h3 className="u-mt-0 u-mb-2">Sample Card</h3>
|
|
618
|
+
<p className="u-mb-2">Card content goes here...</p>
|
|
619
|
+
<div className="u-mt-2">
|
|
620
|
+
<Button label="Learn More" variant="primary" size="sm" />
|
|
649
621
|
</div>
|
|
650
622
|
</div>
|
|
651
623
|
),
|
|
652
624
|
};
|
|
653
625
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
glass: {
|
|
659
|
-
cornerRadius: 22,
|
|
660
|
-
},
|
|
661
|
-
rounded: true,
|
|
662
|
-
},
|
|
663
|
-
decorators: [
|
|
664
|
-
Story => (
|
|
665
|
-
<div
|
|
666
|
-
style={{
|
|
667
|
-
background: 'url(https://cdn.pixabay.com/photo/2020/12/15/01/43/street-5832394_1280.jpg)',
|
|
668
|
-
backgroundSize: 'cover',
|
|
669
|
-
backgroundPosition: 'center',
|
|
670
|
-
padding: '25rem',
|
|
671
|
-
borderRadius: '12px',
|
|
672
|
-
}}
|
|
673
|
-
>
|
|
674
|
-
<Story />
|
|
675
|
-
</div>
|
|
676
|
-
),
|
|
677
|
-
],
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
// Comprehensive Glass Showcase
|
|
681
|
-
export const GlassShowcase: Story = {
|
|
682
|
-
args: {
|
|
683
|
-
label: 'Glass Button',
|
|
684
|
-
variant: 'primary',
|
|
685
|
-
glass: true,
|
|
686
|
-
},
|
|
626
|
+
/**
|
|
627
|
+
* Button used in a modal context
|
|
628
|
+
*/
|
|
629
|
+
export const InModal: Story = {
|
|
687
630
|
render: () => (
|
|
688
|
-
<div
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
padding: '2rem',
|
|
696
|
-
borderRadius: '12px',
|
|
697
|
-
}}
|
|
698
|
-
>
|
|
699
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
700
|
-
Primary Glass Variants
|
|
701
|
-
</h3>
|
|
702
|
-
<div className="u-flex u-flex-wrap u-gap-2 u-items-center">
|
|
703
|
-
<Button label="Small Glass" variant="primary" size="sm" glass={{ cornerRadius: 8 }} />
|
|
704
|
-
<Button label="Medium Glass" variant="primary" size="md" glass />
|
|
705
|
-
<Button label="Large Glass" variant="primary" size="lg" glass />
|
|
706
|
-
<Button label="With Icon" variant="primary" icon={<Icon />} glass />
|
|
707
|
-
<Button label="Icon Only" variant="primary" icon={<Icon />} iconOnly glass />
|
|
708
|
-
<Button label="Rounded" variant="primary" rounded glass={{ cornerRadius: 24 }} />
|
|
709
|
-
</div>
|
|
710
|
-
</div>
|
|
711
|
-
|
|
712
|
-
{/* Outline Glass Variants */}
|
|
713
|
-
<div
|
|
714
|
-
style={{
|
|
715
|
-
background:
|
|
716
|
-
'url(https://cdn.pixabay.com/photo/2025/09/18/23/32/pattern-9842070_1280.png)',
|
|
717
|
-
backgroundSize: 'cover',
|
|
718
|
-
backgroundPosition: 'center',
|
|
719
|
-
padding: '2rem',
|
|
720
|
-
borderRadius: '12px',
|
|
721
|
-
}}
|
|
722
|
-
>
|
|
723
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
724
|
-
Outline Glass Variants
|
|
725
|
-
</h3>
|
|
726
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
727
|
-
<Button label="Outline Primary" variant="outline-primary" glass />
|
|
728
|
-
<Button label="Outline Success" variant="outline-success" glass />
|
|
729
|
-
<Button label="Outline Warning" variant="outline-warning" glass />
|
|
730
|
-
<Button label="Outline Error" variant="outline-error" glass />
|
|
731
|
-
</div>
|
|
732
|
-
</div>
|
|
733
|
-
|
|
734
|
-
{/* Custom Glass Configuration */}
|
|
735
|
-
<div
|
|
736
|
-
style={{
|
|
737
|
-
background: 'url(https://cdn.pixabay.com/photo/2019/09/29/17/21/greece-4513857_1280.jpg)',
|
|
738
|
-
backgroundSize: 'cover',
|
|
739
|
-
backgroundPosition: 'center',
|
|
740
|
-
padding: '2rem',
|
|
741
|
-
borderRadius: '12px',
|
|
742
|
-
}}
|
|
743
|
-
>
|
|
744
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
745
|
-
Custom Glass Effects
|
|
746
|
-
</h3>
|
|
747
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
748
|
-
<Button
|
|
749
|
-
label="Polar Mode"
|
|
750
|
-
variant="secondary"
|
|
751
|
-
glass={{
|
|
752
|
-
displacementScale: 60,
|
|
753
|
-
blurAmount: 2,
|
|
754
|
-
saturation: 180,
|
|
755
|
-
aberrationIntensity: 2,
|
|
756
|
-
cornerRadius: 12,
|
|
757
|
-
mode: 'polar' as const,
|
|
758
|
-
}}
|
|
759
|
-
/>
|
|
760
|
-
<Button
|
|
761
|
-
label="Prominent Mode"
|
|
762
|
-
variant="info"
|
|
763
|
-
glass={{
|
|
764
|
-
displacementScale: 80,
|
|
765
|
-
blurAmount: 1,
|
|
766
|
-
saturation: 200,
|
|
767
|
-
aberrationIntensity: 3,
|
|
768
|
-
cornerRadius: 12,
|
|
769
|
-
mode: 'prominent' as const,
|
|
770
|
-
}}
|
|
771
|
-
/>
|
|
772
|
-
<Button
|
|
773
|
-
label="Shader Mode"
|
|
774
|
-
variant="success"
|
|
775
|
-
glass={{
|
|
776
|
-
displacementScale: 50,
|
|
777
|
-
blurAmount: 0,
|
|
778
|
-
saturation: 140,
|
|
779
|
-
aberrationIntensity: 1,
|
|
780
|
-
cornerRadius: 12,
|
|
781
|
-
mode: 'shader' as const,
|
|
782
|
-
}}
|
|
783
|
-
/>
|
|
784
|
-
</div>
|
|
785
|
-
</div>
|
|
786
|
-
|
|
787
|
-
{/* Light Background */}
|
|
788
|
-
<div
|
|
789
|
-
style={{
|
|
790
|
-
background: 'url(https://cdn.pixabay.com/photo/2019/09/29/17/21/greece-4513852_1280.jpg)',
|
|
791
|
-
backgroundSize: 'cover',
|
|
792
|
-
backgroundPosition: 'center',
|
|
793
|
-
padding: '2rem',
|
|
794
|
-
borderRadius: '12px',
|
|
795
|
-
}}
|
|
796
|
-
>
|
|
797
|
-
<h3 style={{ color: '#333', marginBottom: '1rem', fontSize: '1.2rem' }}>
|
|
798
|
-
Light Background
|
|
799
|
-
</h3>
|
|
800
|
-
<div className="u-flex u-flex-wrap u-gap-2">
|
|
801
|
-
<Button label="Light Variant" variant="light" glass />
|
|
802
|
-
<Button label="Outline Light" variant="outline-light" glass />
|
|
803
|
-
<Button label="Dark on Light" variant="dark" glass />
|
|
804
|
-
<Button
|
|
805
|
-
label="Over Light"
|
|
806
|
-
variant="primary"
|
|
807
|
-
glass={{
|
|
808
|
-
overLight: true,
|
|
809
|
-
displacementScale: 45,
|
|
810
|
-
saturation: 120,
|
|
811
|
-
}}
|
|
812
|
-
/>
|
|
631
|
+
<div className="u-relative">
|
|
632
|
+
<div className="u-p-6 u-bg-white u-rounded-lg u-shadow-lg u-w-96">
|
|
633
|
+
<h3 className="u-mt-0 u-mb-2">Confirmation</h3>
|
|
634
|
+
<p className="u-mb-4">Are you sure you want to proceed?</p>
|
|
635
|
+
<div className="u-flex u-justify-end u-gap-2 u-mt-4">
|
|
636
|
+
<Button label="Cancel" variant="secondary" />
|
|
637
|
+
<Button label="Confirm" variant="primary" />
|
|
813
638
|
</div>
|
|
814
639
|
</div>
|
|
815
640
|
</div>
|
|
816
641
|
),
|
|
817
642
|
};
|
|
818
643
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
saturation: 160,
|
|
829
|
-
aberrationIntensity: 2,
|
|
830
|
-
cornerRadius: 12,
|
|
831
|
-
},
|
|
832
|
-
},
|
|
833
|
-
render: args => (
|
|
834
|
-
<div
|
|
835
|
-
style={{
|
|
836
|
-
background: 'url(https://images.unsplash.com/photo-1518837695005-2083093ee35b?w=1920)',
|
|
837
|
-
backgroundSize: 'cover',
|
|
838
|
-
backgroundPosition: 'center',
|
|
839
|
-
display: 'flex',
|
|
840
|
-
gap: '2rem',
|
|
841
|
-
flexDirection: 'column',
|
|
842
|
-
alignItems: 'center',
|
|
843
|
-
justifyContent: 'center',
|
|
844
|
-
minWidth: '95vw',
|
|
845
|
-
minHeight: '95vh',
|
|
846
|
-
}}
|
|
847
|
-
>
|
|
848
|
-
<div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
|
|
849
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Standard Glass Mode</h3>
|
|
850
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
|
|
851
|
-
Classic glass morphism with blur and displacement
|
|
852
|
-
</p>
|
|
853
|
-
</div>
|
|
854
|
-
<Button {...args} />
|
|
855
|
-
</div>
|
|
856
|
-
),
|
|
857
|
-
};
|
|
858
|
-
|
|
859
|
-
// Glass Mode Variants - Polar
|
|
860
|
-
export const GlassModePolar: Story = {
|
|
861
|
-
args: {
|
|
862
|
-
label: 'Polar Glass Mode',
|
|
863
|
-
variant: 'secondary',
|
|
864
|
-
glass: {
|
|
865
|
-
mode: 'polar',
|
|
866
|
-
displacementScale: 80,
|
|
867
|
-
blurAmount: 1.5,
|
|
868
|
-
saturation: 180,
|
|
869
|
-
aberrationIntensity: 3,
|
|
870
|
-
cornerRadius: 12,
|
|
871
|
-
},
|
|
872
|
-
},
|
|
873
|
-
render: args => (
|
|
874
|
-
<div
|
|
875
|
-
style={{
|
|
876
|
-
background: 'url(https://images.unsplash.com/photo-1557683316-973673baf926?w=1920)',
|
|
877
|
-
backgroundSize: 'cover',
|
|
878
|
-
backgroundPosition: 'center',
|
|
879
|
-
borderRadius: '12px',
|
|
880
|
-
display: 'flex',
|
|
881
|
-
gap: '2rem',
|
|
882
|
-
flexDirection: 'column',
|
|
883
|
-
alignItems: 'center',
|
|
884
|
-
justifyContent: 'center',
|
|
885
|
-
minWidth: '95vw',
|
|
886
|
-
minHeight: '95vh',
|
|
887
|
-
}}
|
|
888
|
-
>
|
|
889
|
-
<div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
|
|
890
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Polar Glass Mode</h3>
|
|
891
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>Radial distortion effect from center</p>
|
|
892
|
-
</div>
|
|
893
|
-
<Button {...args} />
|
|
644
|
+
/**
|
|
645
|
+
* Button composed with other components
|
|
646
|
+
*/
|
|
647
|
+
export const WithOtherComponents: Story = {
|
|
648
|
+
render: () => (
|
|
649
|
+
<div className="u-flex u-items-center u-gap-2">
|
|
650
|
+
<Button label="Previous" variant="secondary" />
|
|
651
|
+
<span className="u-text-sm">Page 1 of 10</span>
|
|
652
|
+
<Button label="Next" variant="primary" />
|
|
894
653
|
</div>
|
|
895
654
|
),
|
|
896
655
|
};
|
|
897
656
|
|
|
898
|
-
//
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
label: 'Prominent Glass Mode',
|
|
902
|
-
variant: 'success',
|
|
903
|
-
glass: {
|
|
904
|
-
mode: 'prominent',
|
|
905
|
-
displacementScale: 100,
|
|
906
|
-
blurAmount: 2.5,
|
|
907
|
-
saturation: 200,
|
|
908
|
-
aberrationIntensity: 4,
|
|
909
|
-
cornerRadius: 12,
|
|
910
|
-
},
|
|
911
|
-
},
|
|
912
|
-
render: args => (
|
|
913
|
-
<div
|
|
914
|
-
style={{
|
|
915
|
-
background: 'url(https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=1920)',
|
|
916
|
-
backgroundSize: 'cover',
|
|
917
|
-
backgroundPosition: 'center',
|
|
918
|
-
borderRadius: '12px',
|
|
919
|
-
display: 'flex',
|
|
920
|
-
gap: '2rem',
|
|
921
|
-
flexDirection: 'column',
|
|
922
|
-
alignItems: 'center',
|
|
923
|
-
justifyContent: 'center',
|
|
924
|
-
minWidth: '95vw',
|
|
925
|
-
minHeight: '95vh',
|
|
926
|
-
}}
|
|
927
|
-
>
|
|
928
|
-
<div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
|
|
929
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Prominent Glass Mode</h3>
|
|
930
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>Enhanced distortion with maximum depth</p>
|
|
931
|
-
</div>
|
|
932
|
-
<Button {...args} />
|
|
933
|
-
</div>
|
|
934
|
-
),
|
|
935
|
-
};
|
|
657
|
+
// ============================================================================
|
|
658
|
+
// ACCESSIBILITY STORIES
|
|
659
|
+
// ============================================================================
|
|
936
660
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
variant: 'info',
|
|
942
|
-
glass: {
|
|
943
|
-
mode: 'shader',
|
|
944
|
-
shaderVariant: 'liquidGlass',
|
|
945
|
-
displacementScale: 70,
|
|
946
|
-
blurAmount: 1.8,
|
|
947
|
-
saturation: 170,
|
|
948
|
-
cornerRadius: 12,
|
|
949
|
-
},
|
|
950
|
-
},
|
|
951
|
-
render: args => (
|
|
952
|
-
<div
|
|
953
|
-
style={{
|
|
954
|
-
background: 'url(https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=1920)',
|
|
955
|
-
backgroundSize: 'cover',
|
|
956
|
-
backgroundPosition: 'center',
|
|
957
|
-
borderRadius: '12px',
|
|
958
|
-
display: 'flex',
|
|
959
|
-
gap: '2rem',
|
|
960
|
-
flexDirection: 'column',
|
|
961
|
-
alignItems: 'center',
|
|
962
|
-
justifyContent: 'center',
|
|
963
|
-
minWidth: '95vw',
|
|
964
|
-
minHeight: '95vh',
|
|
965
|
-
}}
|
|
966
|
-
>
|
|
967
|
-
<div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
|
|
968
|
-
<h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Shader Glass Mode</h3>
|
|
969
|
-
<p style={{ fontSize: '0.875rem', opacity: 0.9 }}>GPU-accelerated liquid glass effect</p>
|
|
970
|
-
</div>
|
|
971
|
-
<Button {...args} />
|
|
972
|
-
</div>
|
|
973
|
-
),
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
// All Glass Modes Comparison
|
|
977
|
-
export const AllGlassModes: Story = {
|
|
661
|
+
/**
|
|
662
|
+
* Shows proper ARIA labels for accessibility
|
|
663
|
+
*/
|
|
664
|
+
export const WithAriaLabels: Story = {
|
|
978
665
|
render: () => (
|
|
979
|
-
<div
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
backgroundSize: 'cover',
|
|
983
|
-
backgroundPosition: 'center',
|
|
984
|
-
padding: '3rem',
|
|
985
|
-
borderRadius: '12px',
|
|
986
|
-
minHeight: '90vh',
|
|
987
|
-
minWidth: '90vw',
|
|
988
|
-
}}
|
|
989
|
-
>
|
|
990
|
-
<div style={{ width: '90vw', margin: '0 auto' }}>
|
|
991
|
-
<h2
|
|
992
|
-
style={{
|
|
993
|
-
textAlign: 'center',
|
|
994
|
-
color: 'white',
|
|
995
|
-
marginBottom: '3rem',
|
|
996
|
-
fontSize: '2rem',
|
|
997
|
-
textShadow: '0 2px 8px rgba(0,0,0,0.5)',
|
|
998
|
-
}}
|
|
999
|
-
>
|
|
1000
|
-
Glass Mode Variants Comparison
|
|
1001
|
-
</h2>
|
|
1002
|
-
|
|
1003
|
-
<div
|
|
1004
|
-
style={{
|
|
1005
|
-
display: 'grid',
|
|
1006
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
|
|
1007
|
-
gap: '2rem',
|
|
1008
|
-
}}
|
|
1009
|
-
>
|
|
1010
|
-
{/* Standard Mode */}
|
|
1011
|
-
<div
|
|
1012
|
-
style={{
|
|
1013
|
-
background: 'rgba(255,255,255,0.1)',
|
|
1014
|
-
padding: '2rem',
|
|
1015
|
-
borderRadius: '12px',
|
|
1016
|
-
textAlign: 'center',
|
|
1017
|
-
display: 'flex',
|
|
1018
|
-
flexDirection: 'column',
|
|
1019
|
-
alignItems: 'center',
|
|
1020
|
-
}}
|
|
1021
|
-
>
|
|
1022
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>Standard</h3>
|
|
1023
|
-
<p
|
|
1024
|
-
style={{
|
|
1025
|
-
color: 'rgba(255,255,255,0.8)',
|
|
1026
|
-
fontSize: '0.875rem',
|
|
1027
|
-
marginBottom: '1.5rem',
|
|
1028
|
-
}}
|
|
1029
|
-
>
|
|
1030
|
-
Classic blur and displacement
|
|
1031
|
-
</p>
|
|
1032
|
-
<Button
|
|
1033
|
-
label="Standard Glass"
|
|
1034
|
-
variant="primary"
|
|
1035
|
-
glass={{
|
|
1036
|
-
mode: 'standard',
|
|
1037
|
-
displacementScale: 60,
|
|
1038
|
-
blurAmount: 2,
|
|
1039
|
-
saturation: 160,
|
|
1040
|
-
aberrationIntensity: 2,
|
|
1041
|
-
}}
|
|
1042
|
-
/>
|
|
1043
|
-
</div>
|
|
1044
|
-
|
|
1045
|
-
{/* Polar Mode */}
|
|
1046
|
-
<div
|
|
1047
|
-
style={{
|
|
1048
|
-
background: 'rgba(255,255,255,0.1)',
|
|
1049
|
-
padding: '2rem',
|
|
1050
|
-
borderRadius: '12px',
|
|
1051
|
-
textAlign: 'center',
|
|
1052
|
-
display: 'flex',
|
|
1053
|
-
flexDirection: 'column',
|
|
1054
|
-
alignItems: 'center',
|
|
1055
|
-
}}
|
|
1056
|
-
>
|
|
1057
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>Polar</h3>
|
|
1058
|
-
<p
|
|
1059
|
-
style={{
|
|
1060
|
-
color: 'rgba(255,255,255,0.8)',
|
|
1061
|
-
fontSize: '0.875rem',
|
|
1062
|
-
marginBottom: '1.5rem',
|
|
1063
|
-
}}
|
|
1064
|
-
>
|
|
1065
|
-
Radial distortion effect
|
|
1066
|
-
</p>
|
|
1067
|
-
<Button
|
|
1068
|
-
label="Polar Glass"
|
|
1069
|
-
variant="secondary"
|
|
1070
|
-
glass={{
|
|
1071
|
-
mode: 'polar',
|
|
1072
|
-
displacementScale: 80,
|
|
1073
|
-
blurAmount: 1.5,
|
|
1074
|
-
saturation: 180,
|
|
1075
|
-
aberrationIntensity: 3,
|
|
1076
|
-
}}
|
|
1077
|
-
/>
|
|
1078
|
-
</div>
|
|
1079
|
-
|
|
1080
|
-
{/* Prominent Mode */}
|
|
1081
|
-
<div
|
|
1082
|
-
style={{
|
|
1083
|
-
background: 'rgba(255,255,255,0.1)',
|
|
1084
|
-
padding: '2rem',
|
|
1085
|
-
borderRadius: '12px',
|
|
1086
|
-
textAlign: 'center',
|
|
1087
|
-
display: 'flex',
|
|
1088
|
-
flexDirection: 'column',
|
|
1089
|
-
alignItems: 'center',
|
|
1090
|
-
}}
|
|
1091
|
-
>
|
|
1092
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>Prominent</h3>
|
|
1093
|
-
<p
|
|
1094
|
-
style={{
|
|
1095
|
-
color: 'rgba(255,255,255,0.8)',
|
|
1096
|
-
fontSize: '0.875rem',
|
|
1097
|
-
marginBottom: '1.5rem',
|
|
1098
|
-
}}
|
|
1099
|
-
>
|
|
1100
|
-
Maximum depth and distortion
|
|
1101
|
-
</p>
|
|
1102
|
-
<Button
|
|
1103
|
-
label="Prominent Glass"
|
|
1104
|
-
variant="success"
|
|
1105
|
-
glass={{
|
|
1106
|
-
mode: 'prominent',
|
|
1107
|
-
displacementScale: 100,
|
|
1108
|
-
blurAmount: 2.5,
|
|
1109
|
-
saturation: 200,
|
|
1110
|
-
aberrationIntensity: 4,
|
|
1111
|
-
}}
|
|
1112
|
-
/>
|
|
1113
|
-
</div>
|
|
1114
|
-
|
|
1115
|
-
{/* Shader Mode */}
|
|
1116
|
-
<div
|
|
1117
|
-
style={{
|
|
1118
|
-
background: 'rgba(255,255,255,0.1)',
|
|
1119
|
-
padding: '2rem',
|
|
1120
|
-
borderRadius: '12px',
|
|
1121
|
-
textAlign: 'center',
|
|
1122
|
-
display: 'flex',
|
|
1123
|
-
flexDirection: 'column',
|
|
1124
|
-
alignItems: 'center',
|
|
1125
|
-
}}
|
|
1126
|
-
>
|
|
1127
|
-
<h3 style={{ color: 'white', marginBottom: '1rem', fontSize: '1.25rem' }}>Shader</h3>
|
|
1128
|
-
<p
|
|
1129
|
-
style={{
|
|
1130
|
-
color: 'rgba(255,255,255,0.8)',
|
|
1131
|
-
fontSize: '0.875rem',
|
|
1132
|
-
marginBottom: '1.5rem',
|
|
1133
|
-
}}
|
|
1134
|
-
>
|
|
1135
|
-
GPU-accelerated liquid glass
|
|
1136
|
-
</p>
|
|
1137
|
-
<Button
|
|
1138
|
-
label="Shader Glass"
|
|
1139
|
-
variant="info"
|
|
1140
|
-
glass={{
|
|
1141
|
-
mode: 'shader',
|
|
1142
|
-
shaderVariant: 'liquidGlass',
|
|
1143
|
-
displacementScale: 70,
|
|
1144
|
-
blurAmount: 1.8,
|
|
1145
|
-
saturation: 170,
|
|
1146
|
-
}}
|
|
1147
|
-
/>
|
|
1148
|
-
</div>
|
|
1149
|
-
</div>
|
|
1150
|
-
|
|
1151
|
-
{/* All Variants with Different Colors */}
|
|
1152
|
-
<div style={{ marginTop: '3rem' }}>
|
|
1153
|
-
<h3
|
|
1154
|
-
style={{
|
|
1155
|
-
textAlign: 'center',
|
|
1156
|
-
color: 'white',
|
|
1157
|
-
marginBottom: '2rem',
|
|
1158
|
-
fontSize: '1.5rem',
|
|
1159
|
-
textShadow: '0 2px 8px rgba(0,0,0,0.5)',
|
|
1160
|
-
}}
|
|
1161
|
-
>
|
|
1162
|
-
All Color Variants with Glass
|
|
1163
|
-
</h3>
|
|
1164
|
-
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '1rem', justifyContent: 'center' }}>
|
|
1165
|
-
<Button label="Primary" variant="primary" glass />
|
|
1166
|
-
<Button label="Secondary" variant="secondary" glass />
|
|
1167
|
-
<Button label="Success" variant="success" glass />
|
|
1168
|
-
<Button label="Info" variant="info" glass />
|
|
1169
|
-
<Button label="Warning" variant="warning" glass />
|
|
1170
|
-
<Button label="Error" variant="error" glass />
|
|
1171
|
-
<Button label="Light" variant="light" glass />
|
|
1172
|
-
<Button label="Dark" variant="dark" glass />
|
|
1173
|
-
</div>
|
|
1174
|
-
</div>
|
|
1175
|
-
</div>
|
|
666
|
+
<div className="u-flex u-flex-column u-gap-2">
|
|
667
|
+
<Button label="Save" variant="primary" aria-label="Save document" />
|
|
668
|
+
<Button label="Delete" variant="error" aria-label="Delete item permanently" />
|
|
1176
669
|
</div>
|
|
1177
670
|
),
|
|
1178
671
|
};
|
|
1179
672
|
|
|
1180
|
-
|
|
1181
|
-
|
|
673
|
+
/**
|
|
674
|
+
* Shows button with keyboard navigation support
|
|
675
|
+
*/
|
|
676
|
+
export const WithKeyboardNavigation: Story = {
|
|
1182
677
|
render: () => (
|
|
1183
|
-
<div
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
backgroundPosition: 'center',
|
|
1188
|
-
padding: '3rem',
|
|
1189
|
-
borderRadius: '12px',
|
|
1190
|
-
minHeight: '90vh',
|
|
1191
|
-
}}
|
|
1192
|
-
>
|
|
1193
|
-
<div style={{ maxWidth: '1200px', margin: '0 auto' }}>
|
|
1194
|
-
<h2
|
|
1195
|
-
style={{
|
|
1196
|
-
textAlign: 'center',
|
|
1197
|
-
color: 'white',
|
|
1198
|
-
marginBottom: '3rem',
|
|
1199
|
-
fontSize: '2rem',
|
|
1200
|
-
textShadow: '0 2px 8px rgba(0,0,0,0.5)',
|
|
1201
|
-
}}
|
|
1202
|
-
>
|
|
1203
|
-
Glass Button States & Interactions
|
|
1204
|
-
</h2>
|
|
1205
|
-
|
|
1206
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '3rem' }}>
|
|
1207
|
-
{/* Sizes */}
|
|
1208
|
-
<div
|
|
1209
|
-
style={{
|
|
1210
|
-
background: 'rgba(255,255,255,0.08)',
|
|
1211
|
-
padding: '2rem',
|
|
1212
|
-
borderRadius: '12px',
|
|
1213
|
-
backdropFilter: 'blur(10px)',
|
|
1214
|
-
}}
|
|
1215
|
-
>
|
|
1216
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>Sizes</h3>
|
|
1217
|
-
<div style={{ display: 'flex', alignItems: 'center', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1218
|
-
<Button label="Small" variant="primary" size="sm" glass={{ cornerRadius: 8 }} />
|
|
1219
|
-
<Button label="Medium" variant="primary" size="md" glass={{ cornerRadius: 12 }} />
|
|
1220
|
-
<Button label="Large" variant="primary" size="lg" glass={{ cornerRadius: 16 }} />
|
|
1221
|
-
</div>
|
|
1222
|
-
</div>
|
|
1223
|
-
|
|
1224
|
-
{/* With Icons */}
|
|
1225
|
-
<div
|
|
1226
|
-
style={{
|
|
1227
|
-
background: 'rgba(255,255,255,0.08)',
|
|
1228
|
-
padding: '2rem',
|
|
1229
|
-
borderRadius: '12px',
|
|
1230
|
-
backdropFilter: 'blur(10px)',
|
|
1231
|
-
}}
|
|
1232
|
-
>
|
|
1233
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>With Icons</h3>
|
|
1234
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1235
|
-
<Button label="With Icon" variant="primary" icon={<Icon />} glass />
|
|
1236
|
-
<Button label="Icon Only" variant="secondary" icon={<Icon />} iconOnly glass />
|
|
1237
|
-
<Button
|
|
1238
|
-
label="Rounded"
|
|
1239
|
-
variant="success"
|
|
1240
|
-
icon={<Icon />}
|
|
1241
|
-
rounded
|
|
1242
|
-
glass={{ cornerRadius: 24 }}
|
|
1243
|
-
/>
|
|
1244
|
-
</div>
|
|
1245
|
-
</div>
|
|
1246
|
-
|
|
1247
|
-
{/* Outline Variants */}
|
|
1248
|
-
<div
|
|
1249
|
-
style={{
|
|
1250
|
-
background: 'rgba(255,255,255,0.08)',
|
|
1251
|
-
padding: '2rem',
|
|
1252
|
-
borderRadius: '12px',
|
|
1253
|
-
backdropFilter: 'blur(10px)',
|
|
1254
|
-
}}
|
|
1255
|
-
>
|
|
1256
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>Outline Variants</h3>
|
|
1257
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1258
|
-
<Button label="Outline Primary" variant="outline-primary" glass />
|
|
1259
|
-
<Button label="Outline Secondary" variant="outline-secondary" glass />
|
|
1260
|
-
<Button label="Outline Success" variant="outline-success" glass />
|
|
1261
|
-
<Button label="Outline Error" variant="outline-error" glass />
|
|
1262
|
-
</div>
|
|
1263
|
-
</div>
|
|
1264
|
-
|
|
1265
|
-
{/* Disabled State */}
|
|
1266
|
-
<div
|
|
1267
|
-
style={{
|
|
1268
|
-
background: 'rgba(255,255,255,0.08)',
|
|
1269
|
-
padding: '2rem',
|
|
1270
|
-
borderRadius: '12px',
|
|
1271
|
-
backdropFilter: 'blur(10px)',
|
|
1272
|
-
}}
|
|
1273
|
-
>
|
|
1274
|
-
<h3 style={{ color: 'white', marginBottom: '1.5rem' }}>Disabled State</h3>
|
|
1275
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1276
|
-
<Button label="Disabled Glass" variant="primary" disabled glass />
|
|
1277
|
-
<Button label="Disabled Outline" variant="outline-primary" disabled glass />
|
|
1278
|
-
</div>
|
|
1279
|
-
</div>
|
|
1280
|
-
</div>
|
|
1281
|
-
</div>
|
|
678
|
+
<div className="u-flex u-gap-2">
|
|
679
|
+
<Button label="Button 1" variant="primary" tabIndex={0} />
|
|
680
|
+
<Button label="Button 2" variant="secondary" tabIndex={0} />
|
|
681
|
+
<Button label="Button 3" variant="success" tabIndex={0} />
|
|
1282
682
|
</div>
|
|
1283
683
|
),
|
|
1284
684
|
};
|
|
1285
685
|
|
|
1286
686
|
/**
|
|
1287
|
-
*
|
|
687
|
+
* Shows button with screen reader announcements
|
|
1288
688
|
*/
|
|
1289
|
-
export const
|
|
1290
|
-
args: {
|
|
1291
|
-
label: 'Save',
|
|
1292
|
-
variant: 'primary',
|
|
1293
|
-
loading: true,
|
|
1294
|
-
},
|
|
1295
|
-
};
|
|
1296
|
-
|
|
1297
|
-
/**
|
|
1298
|
-
* Button in loading state with custom loading text.
|
|
1299
|
-
*/
|
|
1300
|
-
export const LoadingWithText: Story = {
|
|
1301
|
-
args: {
|
|
1302
|
-
label: 'Save',
|
|
1303
|
-
variant: 'primary',
|
|
1304
|
-
loading: true,
|
|
1305
|
-
loadingText: 'Saving...',
|
|
1306
|
-
},
|
|
1307
|
-
};
|
|
1308
|
-
|
|
1309
|
-
export const LoadingStates: Story = {
|
|
689
|
+
export const WithScreenReader: Story = {
|
|
1310
690
|
render: () => (
|
|
1311
|
-
<div
|
|
1312
|
-
<Button label="
|
|
1313
|
-
<
|
|
1314
|
-
|
|
1315
|
-
|
|
691
|
+
<div className="u-flex u-gap-2">
|
|
692
|
+
<Button label="Announcement" variant="primary" aria-describedby="announcement-description" />
|
|
693
|
+
<div id="announcement-description" className="u-sr-only">
|
|
694
|
+
This button triggers an announcement
|
|
695
|
+
</div>
|
|
1316
696
|
</div>
|
|
1317
697
|
),
|
|
1318
698
|
};
|
|
1319
699
|
|
|
1320
700
|
/**
|
|
1321
|
-
*
|
|
701
|
+
* Shows button in high contrast theme
|
|
1322
702
|
*/
|
|
1323
|
-
export const
|
|
1324
|
-
args: {
|
|
1325
|
-
label: 'Full Width Button',
|
|
1326
|
-
variant: 'primary',
|
|
1327
|
-
fullWidth: true,
|
|
1328
|
-
},
|
|
1329
|
-
};
|
|
1330
|
-
|
|
1331
|
-
export const FullWidthButtons: Story = {
|
|
703
|
+
export const HighContrastMode: Story = {
|
|
1332
704
|
render: () => (
|
|
1333
|
-
<div style={{
|
|
1334
|
-
<Button label="
|
|
1335
|
-
<Button label="Full Width Secondary" variant="secondary" fullWidth />
|
|
1336
|
-
<Button label="Full Width Loading" variant="success" fullWidth loading />
|
|
705
|
+
<div style={{ backgroundColor: '#000', padding: '1rem' }}>
|
|
706
|
+
<Button label="High Contrast Button" variant="light" />
|
|
1337
707
|
</div>
|
|
1338
708
|
),
|
|
1339
709
|
};
|
|
1340
710
|
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
export const Block: Story = {
|
|
1345
|
-
args: {
|
|
1346
|
-
label: 'Block Button',
|
|
1347
|
-
variant: 'primary',
|
|
1348
|
-
block: true,
|
|
1349
|
-
},
|
|
1350
|
-
};
|
|
711
|
+
// ============================================================================
|
|
712
|
+
// PERFORMANCE STORIES
|
|
713
|
+
// ============================================================================
|
|
1351
714
|
|
|
1352
715
|
/**
|
|
1353
|
-
*
|
|
716
|
+
* Shows mobile-optimized button configuration
|
|
1354
717
|
*/
|
|
1355
|
-
export const
|
|
718
|
+
export const OptimizedForMobile: Story = {
|
|
1356
719
|
args: {
|
|
1357
|
-
label: '
|
|
720
|
+
label: 'Touch-Friendly',
|
|
1358
721
|
variant: 'primary',
|
|
1359
|
-
|
|
1360
|
-
iconPosition: 'start',
|
|
722
|
+
size: 'lg',
|
|
1361
723
|
},
|
|
1362
724
|
};
|
|
1363
725
|
|
|
1364
726
|
/**
|
|
1365
|
-
*
|
|
727
|
+
* Shows multiple button instances together
|
|
1366
728
|
*/
|
|
1367
|
-
export const
|
|
1368
|
-
args: {
|
|
1369
|
-
label: 'Icon End',
|
|
1370
|
-
variant: 'primary',
|
|
1371
|
-
icon: <Icon />,
|
|
1372
|
-
iconPosition: 'end',
|
|
1373
|
-
},
|
|
1374
|
-
};
|
|
1375
|
-
|
|
1376
|
-
export const IconPositions: Story = {
|
|
729
|
+
export const WithManyInstances: Story = {
|
|
1377
730
|
render: () => (
|
|
1378
|
-
<div
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
731
|
+
<div className="u-flex u-flex-wrap u-gap-2">
|
|
732
|
+
{Array.from({ length: 15 }).map((_, i) => (
|
|
733
|
+
<Button key={i} label={`Button ${i + 1}`} variant="primary" size="sm" />
|
|
734
|
+
))}
|
|
1382
735
|
</div>
|
|
1383
736
|
),
|
|
1384
737
|
};
|
|
1385
738
|
|
|
739
|
+
// ============================================================================
|
|
740
|
+
// GLASS EFFECT STORIES
|
|
741
|
+
// ============================================================================
|
|
742
|
+
|
|
1386
743
|
/**
|
|
1387
|
-
*
|
|
744
|
+
* Shows button with glass effect enabled
|
|
1388
745
|
*/
|
|
1389
|
-
export const
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
746
|
+
export const WithGlassEffect: Story = {
|
|
747
|
+
render: () => (
|
|
748
|
+
<div
|
|
749
|
+
className="u-bg-cover u-bg-center u-p-10 u-rounded-xl"
|
|
750
|
+
style={{
|
|
751
|
+
backgroundImage:
|
|
752
|
+
'url(https://cdn.pixabay.com/photo/2022/10/02/17/23/mushroom-7494046_1280.jpg)',
|
|
753
|
+
}}
|
|
754
|
+
>
|
|
755
|
+
<div className="u-flex u-flex-wrap u-gap-2">
|
|
756
|
+
{THEME_COLORS.map(color => (
|
|
757
|
+
<Button key={color} label={color} variant={color as any} glass={true} />
|
|
758
|
+
))}
|
|
759
|
+
</div>
|
|
760
|
+
</div>
|
|
761
|
+
),
|
|
1395
762
|
};
|
|
1396
763
|
|
|
1397
764
|
/**
|
|
1398
|
-
*
|
|
765
|
+
* Shows button with custom glass settings
|
|
1399
766
|
*/
|
|
1400
|
-
export const
|
|
767
|
+
export const WithCustomGlassSettings: Story = {
|
|
1401
768
|
args: {
|
|
1402
|
-
label: '
|
|
769
|
+
label: 'Custom Glass',
|
|
1403
770
|
variant: 'primary',
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
parameters: {
|
|
1413
|
-
docs: {
|
|
1414
|
-
description: {
|
|
1415
|
-
story: 'A comprehensive example demonstrating various button features including loading states, layout variants, icon positioning, and different states all in one view.',
|
|
1416
|
-
},
|
|
771
|
+
size: 'md',
|
|
772
|
+
glass: {
|
|
773
|
+
displacementScale: 80,
|
|
774
|
+
blurAmount: 2,
|
|
775
|
+
saturation: 200,
|
|
776
|
+
aberrationIntensity: 1,
|
|
777
|
+
cornerRadius: 16,
|
|
778
|
+
mode: 'polar',
|
|
1417
779
|
},
|
|
1418
780
|
},
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
<h3 style={{ marginBottom: '1rem' }}>Loading States</h3>
|
|
1423
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1424
|
-
<Button label="Save" variant="primary" loading />
|
|
1425
|
-
<Button label="Delete" variant="error" loading loadingText="Deleting..." />
|
|
1426
|
-
</div>
|
|
1427
|
-
</div>
|
|
1428
|
-
|
|
1429
|
-
<div>
|
|
1430
|
-
<h3 style={{ marginBottom: '1rem' }}>Layout Variants</h3>
|
|
1431
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
1432
|
-
<Button label="Full Width Button" variant="primary" fullWidth />
|
|
1433
|
-
<Button label="Block Button" variant="secondary" block />
|
|
1434
|
-
</div>
|
|
1435
|
-
</div>
|
|
1436
|
-
|
|
1437
|
-
<div>
|
|
1438
|
-
<h3 style={{ marginBottom: '1rem' }}>Icon Positioning</h3>
|
|
1439
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1440
|
-
<Button label="Icon Start" variant="primary" icon={<Icon />} iconPosition="start" />
|
|
1441
|
-
<Button label="Icon End" variant="secondary" icon={<Icon />} iconPosition="end" />
|
|
1442
|
-
</div>
|
|
1443
|
-
</div>
|
|
1444
|
-
|
|
1445
|
-
<div>
|
|
1446
|
-
<h3 style={{ marginBottom: '1rem' }}>States</h3>
|
|
1447
|
-
<div style={{ display: 'flex', gap: '1rem', flexWrap: 'wrap' }}>
|
|
1448
|
-
<Button label="Active" variant="primary" active />
|
|
1449
|
-
<Button label="Selected" variant="success" selected />
|
|
1450
|
-
<Button label="Loading" variant="info" loading />
|
|
1451
|
-
<Button label="Disabled" variant="warning" disabled />
|
|
1452
|
-
</div>
|
|
1453
|
-
</div>
|
|
1454
|
-
</div>
|
|
1455
|
-
),
|
|
781
|
+
decorators: [
|
|
782
|
+
withBackground('https://cdn.pixabay.com/photo/2021/06/14/22/46/milky-way-6337038_1280.jpg'),
|
|
783
|
+
],
|
|
1456
784
|
};
|