@shohojdhara/atomix 0.3.14 → 0.3.15
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 +43 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +67 -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 +203 -90
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +3 -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 +43 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +67 -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 +9 -61
- package/dist/index.esm.js +237 -286
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +250 -299
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +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 +369 -870
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +2 -2
- package/src/components/AtomixGlass/shader-utils.ts +5 -0
- 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 +50 -35
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +213 -1
- package/src/components/Badge/Badge.stories.tsx +121 -362
- package/src/components/Block/Block.stories.tsx +21 -12
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
- package/src/components/Button/Button.stories.tsx +463 -1126
- package/src/components/Button/Button.test.tsx +107 -0
- package/src/components/Button/Button.tsx +46 -50
- package/src/components/Button/ButtonGroup.stories.tsx +373 -217
- package/src/components/Callout/Callout.stories.tsx +289 -634
- package/src/components/Card/Card.stories.tsx +248 -68
- package/src/components/Chart/Chart.stories.tsx +150 -8
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
- package/src/components/Countdown/Countdown.stories.tsx +115 -8
- package/src/components/DataTable/DataTable.stories.tsx +346 -146
- package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -33
- package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
- package/src/components/Footer/Footer.stories.tsx +392 -328
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +87 -51
- package/src/components/Form/Form.stories.tsx +119 -20
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Radio.stories.tsx +140 -5
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Hero/Hero.stories.tsx +333 -32
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/Modal/Modal.stories.tsx +181 -42
- package/src/components/Popover/Popover.stories.tsx +448 -98
- package/src/components/Progress/Progress.stories.tsx +167 -5
- package/src/components/River/River.stories.tsx +1 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
- package/src/components/Spinner/Spinner.stories.tsx +102 -8
- package/src/components/Steps/Steps.stories.tsx +172 -43
- package/src/components/Tabs/Tabs.stories.tsx +136 -10
- 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 +126 -39
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
- package/src/components/Upload/Upload.stories.tsx +113 -24
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +193 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/useAtomixGlass.ts +28 -56
- package/src/lib/composables/useChartExport.ts +2 -7
- package/src/lib/composables/useDataTable.ts +46 -29
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/theme/devtools/CLI.ts +1 -1
- package/src/lib/types/components.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/csv.ts +17 -0
- package/src/lib/utils/dataTableExport.ts +1 -10
- package/src/styles/01-settings/_index.scss +2 -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.typography.scss +5 -5
- package/src/styles/02-tools/_tools.utility-api.scss +14 -0
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.checkbox.scss +23 -17
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.scss +3 -1
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- 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,17 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ButtonGroup.stories.tsx
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive Storybook stories for ButtonGroup
|
|
5
|
+
*
|
|
6
|
+
* @package Atomix
|
|
7
|
+
* @component ButtonGroup
|
|
8
|
+
*/
|
|
9
|
+
|
|
1
10
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
11
|
+
import { useState } from 'react';
|
|
2
12
|
import { ButtonGroup } from './ButtonGroup';
|
|
3
13
|
import { Button } from './Button';
|
|
4
14
|
import { SIZES } from '../../lib/constants/components';
|
|
5
15
|
|
|
6
|
-
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// TYPE DEFINITIONS
|
|
18
|
+
// ============================================================================
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Type helper for story props without children requirement
|
|
22
|
+
*/
|
|
23
|
+
type ButtonGroupStoryProps = Omit<React.ComponentProps<typeof ButtonGroup>, 'children'> & {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// ============================================================================
|
|
28
|
+
// SHARED UTILITIES & CONSTANTS
|
|
29
|
+
// ============================================================================
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Sample data for stories
|
|
33
|
+
*/
|
|
34
|
+
const sampleButtonTitles = {
|
|
35
|
+
basic: ['Left', 'Middle', 'Right'],
|
|
36
|
+
actions: ['Cancel', 'Save Draft', 'Publish'],
|
|
37
|
+
navigation: ['First', 'Previous', 'Next', 'Last'],
|
|
38
|
+
filters: ['All', 'Active', 'Completed'],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// META CONFIGURATION
|
|
44
|
+
// ============================================================================
|
|
45
|
+
|
|
46
|
+
const meta: Meta<typeof ButtonGroup> = {
|
|
7
47
|
title: 'Components/ButtonGroup',
|
|
8
48
|
component: ButtonGroup,
|
|
9
49
|
parameters: {
|
|
10
50
|
layout: 'centered',
|
|
11
51
|
docs: {
|
|
12
52
|
description: {
|
|
13
|
-
component:
|
|
14
|
-
|
|
53
|
+
component: `
|
|
54
|
+
# ButtonGroup
|
|
55
|
+
|
|
56
|
+
The ButtonGroup component groups multiple buttons together, creating a visually connected set of buttons with proper border radius handling. Buttons in a group share borders and have rounded corners only on the outer edges.
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
- Connects multiple buttons with shared borders
|
|
61
|
+
- Proper border-radius handling for first and last buttons
|
|
62
|
+
- Supports all Button component variants and sizes
|
|
63
|
+
- Maintains accessibility features
|
|
64
|
+
- Responsive design
|
|
65
|
+
|
|
66
|
+
## Accessibility
|
|
67
|
+
|
|
68
|
+
- Keyboard support: Tab to focus, Enter/Space to activate buttons
|
|
69
|
+
- Screen reader: Announces button labels and group context
|
|
70
|
+
- ARIA support: Role and labeling options
|
|
71
|
+
- Focus management: Visual focus indicators
|
|
72
|
+
|
|
73
|
+
## Usage Examples
|
|
74
|
+
|
|
75
|
+
### Basic Usage
|
|
76
|
+
|
|
77
|
+
\`\`\`tsx
|
|
78
|
+
<ButtonGroup>
|
|
79
|
+
<Button label="Left" />
|
|
80
|
+
<Button label="Middle" />
|
|
81
|
+
<Button label="Right" />
|
|
82
|
+
</ButtonGroup>
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
### With Variants
|
|
86
|
+
|
|
87
|
+
\`\`\`tsx
|
|
88
|
+
<ButtonGroup>
|
|
89
|
+
<Button label="Cancel" variant="secondary" />
|
|
90
|
+
<Button label="Save" variant="primary" />
|
|
91
|
+
</ButtonGroup>
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
## API Reference
|
|
95
|
+
|
|
96
|
+
### Props
|
|
97
|
+
|
|
98
|
+
| Prop | Type | Default | Description |
|
|
99
|
+
| ---- | ---- | ------- | ----------- |
|
|
100
|
+
| vertical | boolean | false | Whether to stack buttons vertically |
|
|
101
|
+
| className | string | - | Additional CSS classes |
|
|
102
|
+
| children | ReactNode | - | Button elements to group |
|
|
103
|
+
|
|
104
|
+
## Design Tokens
|
|
105
|
+
|
|
106
|
+
Used design tokens:
|
|
107
|
+
|
|
108
|
+
- \`--atomix-btn-group-gap\`: Gap between buttons in group
|
|
109
|
+
- \`--atomix-btn-group-border-radius\`: Border radius for button groups
|
|
110
|
+
|
|
111
|
+
## Notes
|
|
112
|
+
|
|
113
|
+
When using ButtonGroup, ensure that all child buttons are of the same size for consistent appearance.
|
|
114
|
+
`,
|
|
15
115
|
},
|
|
16
116
|
},
|
|
17
117
|
},
|
|
@@ -19,15 +119,10 @@ const meta = {
|
|
|
19
119
|
argTypes: {
|
|
20
120
|
className: {
|
|
21
121
|
control: 'text',
|
|
22
|
-
description: 'Additional CSS
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
description: 'ARIA label for accessibility',
|
|
27
|
-
},
|
|
28
|
-
role: {
|
|
29
|
-
control: 'text',
|
|
30
|
-
description: 'ARIA role for the button group',
|
|
122
|
+
description: 'Additional CSS classes for the button group',
|
|
123
|
+
table: {
|
|
124
|
+
type: { summary: 'string' },
|
|
125
|
+
},
|
|
31
126
|
},
|
|
32
127
|
},
|
|
33
128
|
} satisfies Meta<typeof ButtonGroup>;
|
|
@@ -35,281 +130,342 @@ const meta = {
|
|
|
35
130
|
export default meta;
|
|
36
131
|
type Story = StoryObj<typeof meta>;
|
|
37
132
|
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<ButtonGroup>
|
|
42
|
-
<Button label="Left" />
|
|
43
|
-
<Button label="Middle" />
|
|
44
|
-
<Button label="Right" />
|
|
45
|
-
</ButtonGroup>
|
|
46
|
-
),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const TwoButtons: Story = {
|
|
50
|
-
render: () => (
|
|
51
|
-
<ButtonGroup>
|
|
52
|
-
<Button label="Cancel" variant="secondary" />
|
|
53
|
-
<Button label="Save" variant="primary" />
|
|
54
|
-
</ButtonGroup>
|
|
55
|
-
),
|
|
56
|
-
};
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// BASIC USAGE STORIES
|
|
135
|
+
// ============================================================================
|
|
57
136
|
|
|
58
|
-
export const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// Variant Combinations
|
|
69
|
-
export const PrimaryGroup: Story = {
|
|
70
|
-
render: () => (
|
|
71
|
-
<ButtonGroup>
|
|
72
|
-
<Button label="One" variant="primary" />
|
|
73
|
-
<Button label="Two" variant="primary" />
|
|
74
|
-
<Button label="Three" variant="primary" />
|
|
75
|
-
</ButtonGroup>
|
|
76
|
-
),
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const SecondaryGroup: Story = {
|
|
80
|
-
render: () => (
|
|
81
|
-
<ButtonGroup>
|
|
82
|
-
<Button label="One" variant="secondary" />
|
|
83
|
-
<Button label="Two" variant="secondary" />
|
|
84
|
-
<Button label="Three" variant="secondary" />
|
|
85
|
-
</ButtonGroup>
|
|
86
|
-
),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const OutlineGroup: Story = {
|
|
90
|
-
render: () => (
|
|
91
|
-
<ButtonGroup>
|
|
92
|
-
<Button label="One" variant="outline-primary" />
|
|
93
|
-
<Button label="Two" variant="outline-primary" />
|
|
94
|
-
<Button label="Three" variant="outline-primary" />
|
|
95
|
-
</ButtonGroup>
|
|
96
|
-
),
|
|
137
|
+
export const BasicUsage: Story = {
|
|
138
|
+
args: {
|
|
139
|
+
children: (
|
|
140
|
+
<>
|
|
141
|
+
<Button label="Left" variant="primary" />
|
|
142
|
+
<Button label="Middle" variant="primary" />
|
|
143
|
+
<Button label="Right" variant="primary" />
|
|
144
|
+
</>
|
|
145
|
+
),
|
|
146
|
+
},
|
|
97
147
|
};
|
|
98
148
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
<Button label="Cancel" variant="secondary" />
|
|
103
|
-
<Button label="Save Draft" variant="outline-primary" />
|
|
104
|
-
<Button label="Publish" variant="primary" />
|
|
105
|
-
</ButtonGroup>
|
|
106
|
-
),
|
|
107
|
-
};
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// VARIANTS & STATES STORIES
|
|
151
|
+
// ============================================================================
|
|
108
152
|
|
|
109
|
-
|
|
110
|
-
export const SmallSize: Story = {
|
|
153
|
+
export const HorizontalGroup: Story = {
|
|
111
154
|
render: () => (
|
|
112
155
|
<ButtonGroup>
|
|
113
|
-
<Button label="
|
|
114
|
-
<Button label="
|
|
115
|
-
<Button label="
|
|
156
|
+
<Button label="Left" variant="primary" />
|
|
157
|
+
<Button label="Middle" variant="secondary" />
|
|
158
|
+
<Button label="Right" variant="success" />
|
|
116
159
|
</ButtonGroup>
|
|
117
160
|
),
|
|
118
161
|
};
|
|
119
162
|
|
|
120
|
-
export const
|
|
163
|
+
export const VerticalGroup: Story = {
|
|
121
164
|
render: () => (
|
|
122
|
-
<ButtonGroup>
|
|
123
|
-
<Button label="
|
|
124
|
-
<Button label="
|
|
125
|
-
<Button label="
|
|
165
|
+
<ButtonGroup vertical={true}>
|
|
166
|
+
<Button label="Top" variant="primary" />
|
|
167
|
+
<Button label="Middle" variant="secondary" />
|
|
168
|
+
<Button label="Bottom" variant="success" />
|
|
126
169
|
</ButtonGroup>
|
|
127
170
|
),
|
|
128
171
|
};
|
|
129
172
|
|
|
130
|
-
export const
|
|
173
|
+
export const GroupWithSizes: Story = {
|
|
131
174
|
render: () => (
|
|
132
175
|
<ButtonGroup>
|
|
133
|
-
<Button label="
|
|
134
|
-
<Button label="
|
|
135
|
-
<Button label="
|
|
176
|
+
<Button label="Small" variant="primary" size="sm" />
|
|
177
|
+
<Button label="Medium" variant="primary" size="md" />
|
|
178
|
+
<Button label="Large" variant="primary" size="lg" />
|
|
136
179
|
</ButtonGroup>
|
|
137
180
|
),
|
|
138
181
|
};
|
|
139
182
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
183
|
+
export const GroupWithIcons: Story = {
|
|
184
|
+
render: () => {
|
|
185
|
+
const Icon = () => (
|
|
186
|
+
<svg
|
|
187
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
188
|
+
width="16"
|
|
189
|
+
height="16"
|
|
190
|
+
viewBox="0 0 24 24"
|
|
191
|
+
fill="none"
|
|
192
|
+
stroke="currentColor"
|
|
193
|
+
strokeWidth="2"
|
|
194
|
+
strokeLinecap="round"
|
|
195
|
+
strokeLinejoin="round"
|
|
196
|
+
>
|
|
197
|
+
<circle cx="12" cy="12" r="10" />
|
|
198
|
+
<path d="M12 8v4M12 16h.01" />
|
|
199
|
+
</svg>
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
<ButtonGroup>
|
|
204
|
+
<Button label="First" icon={<Icon />} variant="primary" />
|
|
205
|
+
<Button label="Second" icon={<Icon />} variant="secondary" />
|
|
206
|
+
<Button label="Third" icon={<Icon />} variant="success" />
|
|
207
|
+
</ButtonGroup>
|
|
208
|
+
);
|
|
209
|
+
},
|
|
157
210
|
};
|
|
158
211
|
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
<ButtonGroup>
|
|
163
|
-
<Button label="Enabled" />
|
|
164
|
-
<Button label="Disabled" disabled />
|
|
165
|
-
<Button label="Enabled" />
|
|
166
|
-
</ButtonGroup>
|
|
167
|
-
),
|
|
168
|
-
};
|
|
212
|
+
// ============================================================================
|
|
213
|
+
// INTEGRATION EXAMPLES
|
|
214
|
+
// ============================================================================
|
|
169
215
|
|
|
170
|
-
export const
|
|
216
|
+
export const InFormIntegration: Story = {
|
|
171
217
|
render: () => (
|
|
172
|
-
<
|
|
173
|
-
<
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
218
|
+
<form className="u-flex u-flex-col u-gap-4">
|
|
219
|
+
<input
|
|
220
|
+
type="text"
|
|
221
|
+
placeholder="Username"
|
|
222
|
+
className="u-p-2 u-mb-2 u-border u-border-gray-300 u-rounded u-w-full"
|
|
223
|
+
/>
|
|
224
|
+
<input
|
|
225
|
+
type="password"
|
|
226
|
+
placeholder="Password"
|
|
227
|
+
className="u-p-2 u-mb-2 u-border u-border-gray-300 u-rounded u-w-full"
|
|
228
|
+
/>
|
|
229
|
+
<ButtonGroup className="u-justify-end">
|
|
230
|
+
<Button label="Cancel" variant="secondary" />
|
|
231
|
+
<Button label="Submit" variant="primary" />
|
|
232
|
+
</ButtonGroup>
|
|
233
|
+
</form>
|
|
177
234
|
),
|
|
178
235
|
};
|
|
179
236
|
|
|
180
|
-
export const
|
|
237
|
+
export const InCardIntegration: Story = {
|
|
181
238
|
render: () => (
|
|
182
|
-
<
|
|
183
|
-
<
|
|
184
|
-
<
|
|
185
|
-
<
|
|
186
|
-
|
|
239
|
+
<div className="u-p-6 u-bg-white u-rounded-lg u-shadow-lg u-w-80">
|
|
240
|
+
<h3 className="u-mt-0 u-mb-3">Confirm Action</h3>
|
|
241
|
+
<p className="u-mb-4">Are you sure you want to perform this action?</p>
|
|
242
|
+
<ButtonGroup>
|
|
243
|
+
<Button label="No" variant="secondary" size="sm" />
|
|
244
|
+
<Button label="Yes" variant="danger" size="sm" />
|
|
245
|
+
</ButtonGroup>
|
|
246
|
+
</div>
|
|
187
247
|
),
|
|
188
248
|
};
|
|
189
249
|
|
|
190
|
-
export const
|
|
250
|
+
export const WithOtherComponents: Story = {
|
|
191
251
|
render: () => (
|
|
192
|
-
<
|
|
193
|
-
<
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
252
|
+
<div className="u-flex u-flex-col u-gap-4 u-w-full">
|
|
253
|
+
<div className="u-flex u-items-center u-gap-2 u-mb-4">
|
|
254
|
+
<h4 className="u-m-0">Filters:</h4>
|
|
255
|
+
<ButtonGroup>
|
|
256
|
+
<Button label="All" variant="outline-primary" />
|
|
257
|
+
<Button label="Active" variant="outline-primary" />
|
|
258
|
+
<Button label="Inactive" variant="outline-primary" />
|
|
259
|
+
</ButtonGroup>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div className="u-flex u-justify-between u-items-center">
|
|
263
|
+
<div className="u-text-sm u-text-gray-600">Showing 1-10 of 42 results</div>
|
|
264
|
+
<ButtonGroup>
|
|
265
|
+
<Button label="Prev" variant="outline-secondary" />
|
|
266
|
+
<Button label="Next" variant="outline-secondary" />
|
|
267
|
+
</ButtonGroup>
|
|
268
|
+
</div>
|
|
269
|
+
</div>
|
|
197
270
|
),
|
|
198
271
|
};
|
|
199
272
|
|
|
200
|
-
//
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
<ButtonGroup>
|
|
204
|
-
<Button label="Delete" variant="danger" />
|
|
205
|
-
<Button label="Edit" variant="warning" />
|
|
206
|
-
<Button label="View" variant="info" />
|
|
207
|
-
</ButtonGroup>
|
|
208
|
-
),
|
|
209
|
-
};
|
|
273
|
+
// ============================================================================
|
|
274
|
+
// RESPONSIVE EXAMPLES
|
|
275
|
+
// ============================================================================
|
|
210
276
|
|
|
211
|
-
export const
|
|
277
|
+
export const ResponsiveButtonGroup: Story = {
|
|
212
278
|
render: () => (
|
|
213
|
-
<
|
|
214
|
-
<
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
279
|
+
<div className="u-w-full">
|
|
280
|
+
<ButtonGroup className="u-flex-col md:u-flex-row u-gap-0">
|
|
281
|
+
<Button
|
|
282
|
+
label="Home"
|
|
283
|
+
variant="outline-primary"
|
|
284
|
+
className="u-w-full md:u-w-auto u-rounded-none md:u-rounded-l md:u-rounded-r-none"
|
|
285
|
+
/>
|
|
286
|
+
<Button
|
|
287
|
+
label="About"
|
|
288
|
+
variant="outline-primary"
|
|
289
|
+
className="u-w-full md:u-w-auto u-rounded-none"
|
|
290
|
+
/>
|
|
291
|
+
<Button
|
|
292
|
+
label="Services"
|
|
293
|
+
variant="outline-primary"
|
|
294
|
+
className="u-w-full md:u-w-auto u-rounded-none"
|
|
295
|
+
/>
|
|
296
|
+
<Button
|
|
297
|
+
label="Contact"
|
|
298
|
+
variant="outline-primary"
|
|
299
|
+
className="u-w-full md:u-w-auto u-rounded-none md:u-rounded-r md:u-rounded-l-none"
|
|
300
|
+
/>
|
|
301
|
+
</ButtonGroup>
|
|
302
|
+
</div>
|
|
219
303
|
),
|
|
220
304
|
};
|
|
221
305
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<Button label="All" selected />
|
|
226
|
-
<Button label="Active" />
|
|
227
|
-
<Button label="Completed" />
|
|
228
|
-
</ButtonGroup>
|
|
229
|
-
),
|
|
230
|
-
};
|
|
306
|
+
// ============================================================================
|
|
307
|
+
// EDGE CASES
|
|
308
|
+
// ============================================================================
|
|
231
309
|
|
|
232
|
-
|
|
233
|
-
export const MultipleGroups: Story = {
|
|
310
|
+
export const LongText: Story = {
|
|
234
311
|
render: () => (
|
|
235
|
-
<div style={{
|
|
312
|
+
<div style={{ maxWidth: '400px' }}>
|
|
236
313
|
<ButtonGroup>
|
|
237
|
-
<Button label="
|
|
238
|
-
<Button label="
|
|
239
|
-
<Button label="
|
|
240
|
-
</ButtonGroup>
|
|
241
|
-
<ButtonGroup>
|
|
242
|
-
<Button label="Group 2 - Button 1" variant="secondary" />
|
|
243
|
-
<Button label="Group 2 - Button 2" variant="secondary" />
|
|
314
|
+
<Button label="Very Long Text Button" />
|
|
315
|
+
<Button label="Another Long Button Label" />
|
|
316
|
+
<Button label="Third Extra Long Label" />
|
|
244
317
|
</ButtonGroup>
|
|
245
318
|
</div>
|
|
246
319
|
),
|
|
320
|
+
parameters: {
|
|
321
|
+
docs: {
|
|
322
|
+
description: {
|
|
323
|
+
story: 'ButtonGroup with long text buttons.',
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
},
|
|
247
327
|
};
|
|
248
328
|
|
|
249
|
-
// Accessibility
|
|
250
|
-
export const WithAriaLabel: Story = {
|
|
251
|
-
render: () => (
|
|
252
|
-
<ButtonGroup aria-label="Navigation controls">
|
|
253
|
-
<Button label="Previous" />
|
|
254
|
-
<Button label="Next" />
|
|
255
|
-
</ButtonGroup>
|
|
256
|
-
),
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
// Custom Styling
|
|
260
|
-
export const CustomClassName: Story = {
|
|
261
|
-
render: () => (
|
|
262
|
-
<ButtonGroup className="custom-button-group">
|
|
263
|
-
<Button label="Custom" />
|
|
264
|
-
<Button label="Styled" />
|
|
265
|
-
<Button label="Group" />
|
|
266
|
-
</ButtonGroup>
|
|
267
|
-
),
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
// Edge Cases
|
|
271
329
|
export const SingleButton: Story = {
|
|
272
330
|
render: () => (
|
|
273
331
|
<ButtonGroup>
|
|
274
332
|
<Button label="Single Button" />
|
|
275
333
|
</ButtonGroup>
|
|
276
334
|
),
|
|
335
|
+
parameters: {
|
|
336
|
+
docs: {
|
|
337
|
+
description: {
|
|
338
|
+
story: 'ButtonGroup with a single button.',
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
},
|
|
277
342
|
};
|
|
278
343
|
|
|
279
|
-
export const
|
|
344
|
+
export const WithManyButtons: Story = {
|
|
280
345
|
render: () => (
|
|
281
346
|
<ButtonGroup>
|
|
282
|
-
<Button label="1" />
|
|
283
|
-
<Button label="2" />
|
|
284
|
-
<Button label="3" />
|
|
285
|
-
<Button label="4" />
|
|
286
|
-
<Button label="5" />
|
|
287
|
-
<Button label="6" />
|
|
347
|
+
<Button label="1" size="sm" />
|
|
348
|
+
<Button label="2" size="sm" />
|
|
349
|
+
<Button label="3" size="sm" />
|
|
350
|
+
<Button label="4" size="sm" />
|
|
351
|
+
<Button label="5" size="sm" />
|
|
352
|
+
<Button label="6" size="sm" />
|
|
353
|
+
<Button label="7" size="sm" />
|
|
354
|
+
<Button label="8" size="sm" />
|
|
355
|
+
<Button label="9" size="sm" />
|
|
356
|
+
<Button label="10" size="sm" />
|
|
288
357
|
</ButtonGroup>
|
|
289
358
|
),
|
|
359
|
+
parameters: {
|
|
360
|
+
docs: {
|
|
361
|
+
description: {
|
|
362
|
+
story: 'ButtonGroup with many buttons (using smaller size).',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
290
366
|
};
|
|
291
367
|
|
|
292
|
-
//
|
|
293
|
-
|
|
368
|
+
// ============================================================================
|
|
369
|
+
// ACCESSIBILITY
|
|
370
|
+
// ============================================================================
|
|
371
|
+
|
|
372
|
+
export const WithAriaLabels: Story = {
|
|
294
373
|
render: () => (
|
|
295
|
-
<ButtonGroup>
|
|
296
|
-
<Button label="
|
|
297
|
-
<Button label="
|
|
298
|
-
<Button label="
|
|
374
|
+
<ButtonGroup aria-label="Pagination controls">
|
|
375
|
+
<Button label="Previous" aria-label="Go to previous page" />
|
|
376
|
+
<Button label="1" aria-label="Go to page 1" />
|
|
377
|
+
<Button label="2" aria-label="Go to page 2" />
|
|
378
|
+
<Button label="3" aria-label="Go to page 3" />
|
|
379
|
+
<Button label="Next" aria-label="Go to next page" />
|
|
299
380
|
</ButtonGroup>
|
|
300
381
|
),
|
|
382
|
+
parameters: {
|
|
383
|
+
docs: {
|
|
384
|
+
description: {
|
|
385
|
+
story: 'ButtonGroup with proper ARIA labels for accessibility.',
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
},
|
|
301
389
|
};
|
|
302
390
|
|
|
303
|
-
|
|
304
|
-
export const FullWidth: Story = {
|
|
391
|
+
export const VerticalLayout: Story = {
|
|
305
392
|
render: () => (
|
|
306
|
-
<div
|
|
307
|
-
<
|
|
308
|
-
<Button label="
|
|
309
|
-
<Button label="
|
|
310
|
-
<Button label="
|
|
311
|
-
</
|
|
393
|
+
<div className="u-flex u-flex-col u-gap-3">
|
|
394
|
+
<div className="u-flex u-flex-col u-gap-0 u-items-start">
|
|
395
|
+
<Button label="Button 1" variant="primary" className="u-w-full u-rounded-b-none" />
|
|
396
|
+
<Button label="Button 2" variant="secondary" className="u-w-full u-rounded-none" />
|
|
397
|
+
<Button label="Button 3" variant="outline-primary" className="u-w-full u-rounded-t-none" />
|
|
398
|
+
</div>
|
|
312
399
|
</div>
|
|
313
400
|
),
|
|
401
|
+
parameters: {
|
|
402
|
+
docs: {
|
|
403
|
+
description: {
|
|
404
|
+
story: 'Vertical layout using flex-direction column.',
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
},
|
|
314
408
|
};
|
|
315
409
|
|
|
410
|
+
export const WithKeyboardNavigation: Story = {
|
|
411
|
+
render: () => {
|
|
412
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
413
|
+
|
|
414
|
+
const buttons = [
|
|
415
|
+
{ label: "Button 1", variant: "primary" },
|
|
416
|
+
{ label: "Button 2", variant: "secondary" },
|
|
417
|
+
{ label: "Button 3", variant: "outline-primary" },
|
|
418
|
+
{ label: "Button 4", variant: "success" },
|
|
419
|
+
];
|
|
420
|
+
|
|
421
|
+
const handleKeyDown = (index: number, e: React.KeyboardEvent) => {
|
|
422
|
+
let newIndex = index;
|
|
423
|
+
|
|
424
|
+
switch (e.key) {
|
|
425
|
+
case 'ArrowRight':
|
|
426
|
+
case 'ArrowDown':
|
|
427
|
+
newIndex = (index + 1) % buttons.length;
|
|
428
|
+
break;
|
|
429
|
+
case 'ArrowLeft':
|
|
430
|
+
case 'ArrowUp':
|
|
431
|
+
newIndex = (index - 1 + buttons.length) % buttons.length;
|
|
432
|
+
break;
|
|
433
|
+
case 'Home':
|
|
434
|
+
newIndex = 0;
|
|
435
|
+
break;
|
|
436
|
+
case 'End':
|
|
437
|
+
newIndex = buttons.length - 1;
|
|
438
|
+
break;
|
|
439
|
+
default:
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
e.preventDefault();
|
|
444
|
+
setActiveIndex(newIndex);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
return (
|
|
448
|
+
<div className="u-flex u-flex-col u-gap-3">
|
|
449
|
+
<div className="u-flex u-gap-0">
|
|
450
|
+
{buttons.map((btn, idx) => (
|
|
451
|
+
<Button
|
|
452
|
+
key={idx}
|
|
453
|
+
label={btn.label}
|
|
454
|
+
variant={btn.variant}
|
|
455
|
+
active={activeIndex === idx}
|
|
456
|
+
onKeyDown={(e: React.KeyboardEvent) => handleKeyDown(idx, e)}
|
|
457
|
+
className={idx === 0 ? 'u-rounded-r-none' : idx === buttons.length - 1 ? 'u-rounded-l-none' : 'u-rounded-none'}
|
|
458
|
+
/>
|
|
459
|
+
))}
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
);
|
|
463
|
+
},
|
|
464
|
+
parameters: {
|
|
465
|
+
docs: {
|
|
466
|
+
description: {
|
|
467
|
+
story: 'Button group with keyboard navigation support using arrow keys.',
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
};
|