@shohojdhara/atomix 0.3.4 → 0.3.6
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/README.md +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +269 -189
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15179 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6477 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3373 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2466 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4566 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5171 -4792
- package/dist/index.esm.js +6098 -4563
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6291 -4747
- 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.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +2122 -0
- package/dist/theme.js +6084 -0
- package/dist/theme.js.map +1 -0
- package/package.json +59 -27
- package/scripts/atomix-cli.js +544 -16
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +1 -1
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -18
- package/src/components/Chart/AreaChart.tsx +5 -2
- package/src/components/Chart/BarChart.tsx +1 -1
- package/src/components/Chart/BubbleChart.tsx +6 -6
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +1 -2
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +19 -13
- package/src/components/Chart/ScatterChart.tsx +3 -4
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -2
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +10 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +88 -7
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +6 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useAtomixGlass.ts +2 -3
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +57 -14
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -15
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +254 -0
- package/src/lib/theme/config/loader.ts +37 -48
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +19 -6
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +155 -0
- package/src/lib/theme/core/createTheme.ts +94 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
- package/src/lib/theme/core/index.ts +5 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +489 -112
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +6 -3
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +4 -14
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +7 -7
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -95
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +4 -4
- package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
- package/src/lib/theme/runtime/index.ts +1 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
- package/src/lib/theme-tools.ts +8 -9
- package/src/lib/types/components.ts +93 -34
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/build-themes.js +0 -208
- package/scripts/sync-theme-config.js +0 -309
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -657
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -442
- package/src/styles/03-generic/_generated-root.css +0 -5
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -35
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
- /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { ButtonGroup } from './ButtonGroup';
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
import { SIZES } from '../../lib/constants/components';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Components/ButtonGroup',
|
|
8
|
+
component: ButtonGroup,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'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.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
tags: ['autodocs'],
|
|
19
|
+
argTypes: {
|
|
20
|
+
className: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Additional CSS class names',
|
|
23
|
+
},
|
|
24
|
+
'aria-label': {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'ARIA label for accessibility',
|
|
27
|
+
},
|
|
28
|
+
role: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'ARIA role for the button group',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
} satisfies Meta<typeof ButtonGroup>;
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
// Basic Button Groups
|
|
39
|
+
export const Basic: Story = {
|
|
40
|
+
render: () => (
|
|
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
|
+
};
|
|
57
|
+
|
|
58
|
+
export const ThreeButtons: Story = {
|
|
59
|
+
render: () => (
|
|
60
|
+
<ButtonGroup>
|
|
61
|
+
<Button label="Previous" variant="secondary" />
|
|
62
|
+
<Button label="Next" variant="primary" />
|
|
63
|
+
<Button label="Finish" variant="success" />
|
|
64
|
+
</ButtonGroup>
|
|
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
|
+
),
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const MixedVariants: Story = {
|
|
100
|
+
render: () => (
|
|
101
|
+
<ButtonGroup>
|
|
102
|
+
<Button label="Cancel" variant="secondary" />
|
|
103
|
+
<Button label="Save Draft" variant="outline-primary" />
|
|
104
|
+
<Button label="Publish" variant="primary" />
|
|
105
|
+
</ButtonGroup>
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Size Variants
|
|
110
|
+
export const SmallSize: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<ButtonGroup>
|
|
113
|
+
<Button label="Small" size="sm" />
|
|
114
|
+
<Button label="Buttons" size="sm" />
|
|
115
|
+
<Button label="Group" size="sm" />
|
|
116
|
+
</ButtonGroup>
|
|
117
|
+
),
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const MediumSize: Story = {
|
|
121
|
+
render: () => (
|
|
122
|
+
<ButtonGroup>
|
|
123
|
+
<Button label="Medium" size="md" />
|
|
124
|
+
<Button label="Buttons" size="md" />
|
|
125
|
+
<Button label="Group" size="md" />
|
|
126
|
+
</ButtonGroup>
|
|
127
|
+
),
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export const LargeSize: Story = {
|
|
131
|
+
render: () => (
|
|
132
|
+
<ButtonGroup>
|
|
133
|
+
<Button label="Large" size="lg" />
|
|
134
|
+
<Button label="Buttons" size="lg" />
|
|
135
|
+
<Button label="Group" size="lg" />
|
|
136
|
+
</ButtonGroup>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
// With Icons
|
|
141
|
+
export const WithIcons: Story = {
|
|
142
|
+
render: () => (
|
|
143
|
+
<ButtonGroup>
|
|
144
|
+
<Button label="Previous" iconName="ArrowLeft" iconPosition="start" />
|
|
145
|
+
<Button label="Next" iconName="ArrowRight" iconPosition="end" />
|
|
146
|
+
</ButtonGroup>
|
|
147
|
+
),
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const IconOnly: Story = {
|
|
151
|
+
render: () => (
|
|
152
|
+
<ButtonGroup>
|
|
153
|
+
<Button iconName="CaretLeft" iconOnly ariaLabel="Previous" />
|
|
154
|
+
<Button iconName="CaretRight" iconOnly ariaLabel="Next" />
|
|
155
|
+
</ButtonGroup>
|
|
156
|
+
),
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// States
|
|
160
|
+
export const WithDisabled: Story = {
|
|
161
|
+
render: () => (
|
|
162
|
+
<ButtonGroup>
|
|
163
|
+
<Button label="Enabled" />
|
|
164
|
+
<Button label="Disabled" disabled />
|
|
165
|
+
<Button label="Enabled" />
|
|
166
|
+
</ButtonGroup>
|
|
167
|
+
),
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const WithLoading: Story = {
|
|
171
|
+
render: () => (
|
|
172
|
+
<ButtonGroup>
|
|
173
|
+
<Button label="Normal" />
|
|
174
|
+
<Button label="Loading" loading />
|
|
175
|
+
<Button label="Normal" />
|
|
176
|
+
</ButtonGroup>
|
|
177
|
+
),
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const WithActive: Story = {
|
|
181
|
+
render: () => (
|
|
182
|
+
<ButtonGroup>
|
|
183
|
+
<Button label="Inactive" />
|
|
184
|
+
<Button label="Active" active />
|
|
185
|
+
<Button label="Inactive" />
|
|
186
|
+
</ButtonGroup>
|
|
187
|
+
),
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export const WithSelected: Story = {
|
|
191
|
+
render: () => (
|
|
192
|
+
<ButtonGroup>
|
|
193
|
+
<Button label="Option 1" selected />
|
|
194
|
+
<Button label="Option 2" />
|
|
195
|
+
<Button label="Option 3" />
|
|
196
|
+
</ButtonGroup>
|
|
197
|
+
),
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// Action Examples
|
|
201
|
+
export const ActionButtons: Story = {
|
|
202
|
+
render: () => (
|
|
203
|
+
<ButtonGroup>
|
|
204
|
+
<Button label="Delete" variant="danger" />
|
|
205
|
+
<Button label="Edit" variant="warning" />
|
|
206
|
+
<Button label="View" variant="info" />
|
|
207
|
+
</ButtonGroup>
|
|
208
|
+
),
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const NavigationButtons: Story = {
|
|
212
|
+
render: () => (
|
|
213
|
+
<ButtonGroup>
|
|
214
|
+
<Button label="First" variant="outline-secondary" />
|
|
215
|
+
<Button label="Previous" variant="outline-secondary" />
|
|
216
|
+
<Button label="Next" variant="outline-secondary" />
|
|
217
|
+
<Button label="Last" variant="outline-secondary" />
|
|
218
|
+
</ButtonGroup>
|
|
219
|
+
),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
export const FilterButtons: Story = {
|
|
223
|
+
render: () => (
|
|
224
|
+
<ButtonGroup>
|
|
225
|
+
<Button label="All" selected />
|
|
226
|
+
<Button label="Active" />
|
|
227
|
+
<Button label="Completed" />
|
|
228
|
+
</ButtonGroup>
|
|
229
|
+
),
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Multiple Groups
|
|
233
|
+
export const MultipleGroups: Story = {
|
|
234
|
+
render: () => (
|
|
235
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1rem' }}>
|
|
236
|
+
<ButtonGroup>
|
|
237
|
+
<Button label="Group 1 - Button 1" />
|
|
238
|
+
<Button label="Group 1 - Button 2" />
|
|
239
|
+
<Button label="Group 1 - Button 3" />
|
|
240
|
+
</ButtonGroup>
|
|
241
|
+
<ButtonGroup>
|
|
242
|
+
<Button label="Group 2 - Button 1" variant="secondary" />
|
|
243
|
+
<Button label="Group 2 - Button 2" variant="secondary" />
|
|
244
|
+
</ButtonGroup>
|
|
245
|
+
</div>
|
|
246
|
+
),
|
|
247
|
+
};
|
|
248
|
+
|
|
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
|
+
export const SingleButton: Story = {
|
|
272
|
+
render: () => (
|
|
273
|
+
<ButtonGroup>
|
|
274
|
+
<Button label="Single Button" />
|
|
275
|
+
</ButtonGroup>
|
|
276
|
+
),
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export const ManyButtons: Story = {
|
|
280
|
+
render: () => (
|
|
281
|
+
<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" />
|
|
288
|
+
</ButtonGroup>
|
|
289
|
+
),
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// Rounded Buttons
|
|
293
|
+
export const RoundedButtons: Story = {
|
|
294
|
+
render: () => (
|
|
295
|
+
<ButtonGroup>
|
|
296
|
+
<Button label="Rounded" rounded />
|
|
297
|
+
<Button label="Buttons" rounded />
|
|
298
|
+
<Button label="Group" rounded />
|
|
299
|
+
</ButtonGroup>
|
|
300
|
+
),
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// Full Width
|
|
304
|
+
export const FullWidth: Story = {
|
|
305
|
+
render: () => (
|
|
306
|
+
<div style={{ width: '100%', maxWidth: '600px' }}>
|
|
307
|
+
<ButtonGroup>
|
|
308
|
+
<Button label="Full" fullWidth />
|
|
309
|
+
<Button label="Width" fullWidth />
|
|
310
|
+
<Button label="Group" fullWidth />
|
|
311
|
+
</ButtonGroup>
|
|
312
|
+
</div>
|
|
313
|
+
),
|
|
314
|
+
};
|
|
315
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { Children, cloneElement, isValidElement } from 'react';
|
|
2
|
+
import { ButtonGroupProps, ButtonProps } from '../../lib/types/components';
|
|
3
|
+
import { BUTTON_GROUP } from '../../lib/constants/components';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* ButtonGroup - A component for grouping buttons together
|
|
8
|
+
*
|
|
9
|
+
* Groups buttons together with proper border radius handling and spacing.
|
|
10
|
+
* The buttons will be visually connected with shared borders.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ButtonGroup>
|
|
15
|
+
* <Button label="Left" />
|
|
16
|
+
* <Button label="Middle" />
|
|
17
|
+
* <Button label="Right" />
|
|
18
|
+
* </ButtonGroup>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export const ButtonGroup: React.FC<ButtonGroupProps> = ({
|
|
22
|
+
children,
|
|
23
|
+
className = '',
|
|
24
|
+
style,
|
|
25
|
+
'aria-label': ariaLabel,
|
|
26
|
+
role = 'group',
|
|
27
|
+
}) => {
|
|
28
|
+
// Generate CSS classes
|
|
29
|
+
const buttonGroupClasses = [
|
|
30
|
+
BUTTON_GROUP.CLASSES.BASE,
|
|
31
|
+
className,
|
|
32
|
+
]
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.join(' ');
|
|
35
|
+
|
|
36
|
+
// Get valid Button children
|
|
37
|
+
const buttonChildren = Children.toArray(children).filter(
|
|
38
|
+
child => isValidElement(child) && child.type === Button
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
className={buttonGroupClasses}
|
|
44
|
+
style={style}
|
|
45
|
+
role={role}
|
|
46
|
+
aria-label={ariaLabel}
|
|
47
|
+
>
|
|
48
|
+
{buttonChildren.map((child, index) => {
|
|
49
|
+
if (isValidElement<ButtonProps>(child)) {
|
|
50
|
+
// Clone the Button element to ensure proper styling
|
|
51
|
+
return cloneElement(child, {
|
|
52
|
+
key: index,
|
|
53
|
+
...child.props,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
})}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type { ButtonGroupProps };
|
|
63
|
+
|
|
64
|
+
ButtonGroup.displayName = 'ButtonGroup';
|
|
65
|
+
|
|
66
|
+
export default ButtonGroup;
|
|
67
|
+
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { Button } from '../Button/Button';
|
|
4
4
|
import { Callout } from './Callout';
|
|
5
|
+
import { THEME_COLORS } from '../../lib/constants/components';
|
|
5
6
|
|
|
6
|
-
const meta
|
|
7
|
+
const meta = {
|
|
7
8
|
title: 'Components/Callout',
|
|
8
9
|
component: Callout,
|
|
9
10
|
parameters: {
|
|
@@ -11,14 +12,15 @@ const meta: Meta<typeof Callout> = {
|
|
|
11
12
|
docs: {
|
|
12
13
|
description: {
|
|
13
14
|
component:
|
|
14
|
-
'Callout components are used to display important messages, notifications, or alerts to users. They can be used to provide feedback, warnings, errors, or general information.',
|
|
15
|
+
'Callout components are used to display important messages, notifications, or alerts to users. They can be used to provide feedback, warnings, errors, or general information. Callouts support multiple variants, can include icons, and can be dismissible.',
|
|
15
16
|
},
|
|
16
17
|
},
|
|
17
18
|
},
|
|
19
|
+
tags: ['autodocs'],
|
|
18
20
|
argTypes: {
|
|
19
21
|
variant: {
|
|
20
22
|
control: 'select',
|
|
21
|
-
options:
|
|
23
|
+
options: THEME_COLORS,
|
|
22
24
|
description: 'The color variant of the callout',
|
|
23
25
|
table: {
|
|
24
26
|
defaultValue: { summary: 'primary' },
|
|
@@ -86,10 +88,10 @@ const meta: Meta<typeof Callout> = {
|
|
|
86
88
|
},
|
|
87
89
|
},
|
|
88
90
|
},
|
|
89
|
-
}
|
|
91
|
+
} satisfies Meta<typeof Callout>;
|
|
90
92
|
|
|
91
93
|
export default meta;
|
|
92
|
-
type Story = StoryObj<typeof
|
|
94
|
+
type Story = StoryObj<typeof meta>;
|
|
93
95
|
|
|
94
96
|
// Icon components for different callout types
|
|
95
97
|
const InfoIcon = () => (
|
|
@@ -1,39 +1,52 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Card, ElevationCard } from './index';
|
|
4
4
|
import { Grid, GridCol } from '../../layouts';
|
|
5
5
|
import { Container } from '../../layouts/';
|
|
6
|
-
|
|
7
6
|
import Icon from '../Icon';
|
|
7
|
+
import { SIZES, THEME_COLORS } from '../../lib/constants/components';
|
|
8
8
|
|
|
9
|
-
const meta
|
|
9
|
+
const meta = {
|
|
10
10
|
title: 'Components/Card',
|
|
11
11
|
component: Card,
|
|
12
12
|
parameters: {
|
|
13
13
|
layout: 'centered',
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component:
|
|
17
|
+
'The Card component provides a flexible container for displaying content with optional headers, images, and footers. Cards are ideal for grouping related information, showcasing products, or presenting content in a structured format. They support multiple variants, sizes, and can be interactive.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
14
20
|
},
|
|
21
|
+
tags: ['autodocs'],
|
|
15
22
|
argTypes: {
|
|
16
|
-
header: { control: 'text' },
|
|
17
|
-
title: { control: 'text' },
|
|
18
|
-
text: { control: 'text' },
|
|
19
|
-
image: { control: 'text' },
|
|
20
|
-
imageAlt: { control: 'text' },
|
|
21
|
-
footer: { control: 'text' },
|
|
23
|
+
header: { control: 'text', description: 'Header content for the card' },
|
|
24
|
+
title: { control: 'text', description: 'Title of the card' },
|
|
25
|
+
text: { control: 'text', description: 'Main text content of the card' },
|
|
26
|
+
image: { control: 'text', description: 'Image URL for the card' },
|
|
27
|
+
imageAlt: { control: 'text', description: 'Alt text for the card image' },
|
|
28
|
+
footer: { control: 'text', description: 'Footer content for the card' },
|
|
22
29
|
size: {
|
|
23
|
-
control: 'select',
|
|
24
|
-
options:
|
|
30
|
+
control: { type: 'select' },
|
|
31
|
+
options: SIZES,
|
|
32
|
+
description: 'Size of the card',
|
|
33
|
+
defaultValue: 'md',
|
|
25
34
|
},
|
|
26
35
|
variant: {
|
|
27
|
-
control: 'select',
|
|
28
|
-
options:
|
|
36
|
+
control: { type: 'select' },
|
|
37
|
+
options: THEME_COLORS,
|
|
38
|
+
description: 'Color variant of the card',
|
|
39
|
+
defaultValue: 'secondary',
|
|
29
40
|
},
|
|
30
41
|
appearance: {
|
|
31
|
-
control: 'select',
|
|
42
|
+
control: { type: 'select' },
|
|
32
43
|
options: ['filled', 'outlined', 'ghost', 'elevated'],
|
|
44
|
+
defaultValue: 'filled',
|
|
33
45
|
},
|
|
34
46
|
elevation: {
|
|
35
|
-
control: 'select',
|
|
47
|
+
control: { type: 'select' },
|
|
36
48
|
options: ['none', 'sm', 'md', 'lg', 'xl'],
|
|
49
|
+
defaultValue: 'none',
|
|
37
50
|
},
|
|
38
51
|
row: { control: 'boolean' },
|
|
39
52
|
flat: { control: 'boolean' },
|
|
@@ -42,14 +55,16 @@ const meta: Meta<typeof Card> = {
|
|
|
42
55
|
loading: { control: 'boolean' },
|
|
43
56
|
selected: { control: 'boolean' },
|
|
44
57
|
interactive: { control: 'boolean' },
|
|
45
|
-
className: { control: 'text' },
|
|
58
|
+
className: { control: 'text', description: 'Additional CSS class names' },
|
|
46
59
|
},
|
|
47
|
-
}
|
|
60
|
+
} satisfies Meta<typeof Card>;
|
|
48
61
|
|
|
49
62
|
export default meta;
|
|
50
|
-
type Story = StoryObj<typeof
|
|
63
|
+
type Story = StoryObj<typeof meta>;
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Basic card with title and text content.
|
|
67
|
+
*/
|
|
53
68
|
export const Basic: Story = {
|
|
54
69
|
args: {
|
|
55
70
|
title: 'Card Title',
|
|
@@ -58,7 +73,9 @@ export const Basic: Story = {
|
|
|
58
73
|
},
|
|
59
74
|
};
|
|
60
75
|
|
|
61
|
-
|
|
76
|
+
/**
|
|
77
|
+
* Card with an image displayed above the content.
|
|
78
|
+
*/
|
|
62
79
|
export const WithImage: Story = {
|
|
63
80
|
args: {
|
|
64
81
|
title: 'Card with Image',
|
|
@@ -68,7 +85,9 @@ export const WithImage: Story = {
|
|
|
68
85
|
},
|
|
69
86
|
};
|
|
70
87
|
|
|
71
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Card with action buttons in the footer.
|
|
90
|
+
*/
|
|
72
91
|
export const WithActions: Story = {
|
|
73
92
|
args: {
|
|
74
93
|
title: 'Card with Actions',
|
|
@@ -82,7 +101,9 @@ export const WithActions: Story = {
|
|
|
82
101
|
},
|
|
83
102
|
};
|
|
84
103
|
|
|
85
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Card with horizontal (row) layout - image on the left, content on the right.
|
|
106
|
+
*/
|
|
86
107
|
export const Row: Story = {
|
|
87
108
|
args: {
|
|
88
109
|
title: 'Row Layout Card',
|
|
@@ -93,7 +114,9 @@ export const Row: Story = {
|
|
|
93
114
|
},
|
|
94
115
|
};
|
|
95
116
|
|
|
96
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Flat style card with image extending to the edges.
|
|
119
|
+
*/
|
|
97
120
|
export const Flat: Story = {
|
|
98
121
|
args: {
|
|
99
122
|
title: 'Flat Style Card',
|
|
@@ -104,7 +127,9 @@ export const Flat: Story = {
|
|
|
104
127
|
},
|
|
105
128
|
};
|
|
106
129
|
|
|
107
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Clickable card with onClick handler.
|
|
132
|
+
*/
|
|
108
133
|
export const Clickable: Story = {
|
|
109
134
|
args: {
|
|
110
135
|
title: 'Clickable Card',
|
|
@@ -113,7 +138,9 @@ export const Clickable: Story = {
|
|
|
113
138
|
},
|
|
114
139
|
};
|
|
115
140
|
|
|
116
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Card with elevation effect that responds to hover.
|
|
143
|
+
*/
|
|
117
144
|
export const WithElevation: Story = {
|
|
118
145
|
render: args => (
|
|
119
146
|
<div style={{ padding: '20px', width: '300px' }}>
|
|
@@ -128,8 +155,17 @@ export const WithElevation: Story = {
|
|
|
128
155
|
},
|
|
129
156
|
};
|
|
130
157
|
|
|
131
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Card with glass morphism effect enabled.
|
|
160
|
+
*/
|
|
132
161
|
export const WithGlassEffect: Story = {
|
|
162
|
+
parameters: {
|
|
163
|
+
docs: {
|
|
164
|
+
description: {
|
|
165
|
+
story: 'Demonstrates a card with glass morphism effect applied, creating a translucent, frosted appearance that works well over colorful backgrounds.',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
133
169
|
render: args => (
|
|
134
170
|
<div
|
|
135
171
|
style={{
|
|
@@ -464,8 +500,17 @@ export const GlassModeShader: Story = {
|
|
|
464
500
|
),
|
|
465
501
|
};
|
|
466
502
|
|
|
467
|
-
|
|
503
|
+
/**
|
|
504
|
+
* Comparison of all glass morphism modes side by side.
|
|
505
|
+
*/
|
|
468
506
|
export const AllGlassModesComparison: Story = {
|
|
507
|
+
parameters: {
|
|
508
|
+
docs: {
|
|
509
|
+
description: {
|
|
510
|
+
story: 'Side-by-side comparison of all available glass morphism modes (standard, polar, prominent, shader) to help you choose the right effect for your design.',
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
469
514
|
render: () => (
|
|
470
515
|
<div
|
|
471
516
|
style={{
|
|
@@ -956,8 +1001,17 @@ export const LinkCard: Story = {
|
|
|
956
1001
|
},
|
|
957
1002
|
};
|
|
958
1003
|
|
|
959
|
-
|
|
1004
|
+
/**
|
|
1005
|
+
* Comprehensive example showcasing multiple card features and variants.
|
|
1006
|
+
*/
|
|
960
1007
|
export const Comprehensive: Story = {
|
|
1008
|
+
parameters: {
|
|
1009
|
+
docs: {
|
|
1010
|
+
description: {
|
|
1011
|
+
story: 'A comprehensive example demonstrating various card features including sizes, variants, appearances, elevations, and states in a grid layout.',
|
|
1012
|
+
},
|
|
1013
|
+
},
|
|
1014
|
+
},
|
|
961
1015
|
render: () => (
|
|
962
1016
|
<Container>
|
|
963
1017
|
<Grid>
|
|
@@ -24,7 +24,7 @@ export const ElevationCard: React.FC<ElevationCardProps> = ({
|
|
|
24
24
|
return (
|
|
25
25
|
<div
|
|
26
26
|
className={`${className} ${cardProps.className}`}
|
|
27
|
-
ref={cardProps.ref}
|
|
27
|
+
ref={cardProps.ref as React.LegacyRef<HTMLDivElement>}
|
|
28
28
|
style={style}
|
|
29
29
|
tabIndex={cardProps.tabIndex}
|
|
30
30
|
role={cardProps.role}
|