@shohojdhara/atomix 0.3.5 → 0.3.7
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 +260 -179
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +250 -179
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +69 -166
- package/dist/charts.js.map +1 -1
- package/dist/core.js +184 -263
- package/dist/core.js.map +1 -1
- package/dist/forms.js +55 -131
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +184 -263
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1831 -1657
- package/dist/index.esm.js +4497 -4318
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4510 -4328
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +1431 -1472
- package/dist/theme.js +4175 -4138
- package/dist/theme.js.map +1 -1
- package/package.json +6 -20
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/AtomixGlass/AtomixGlass.tsx +128 -322
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +12 -5
- 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/Badge/Badge.stories.tsx +91 -13
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/Button.tsx +85 -167
- 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/Chart/AnimatedChart.tsx +0 -1
- package/src/components/Chart/AreaChart.tsx +0 -1
- package/src/components/Chart/BarChart.tsx +0 -1
- package/src/components/Chart/BubbleChart.tsx +0 -1
- 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/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +0 -1
- 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 +0 -1
- package/src/components/Chart/ScatterChart.tsx +0 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- 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/Form/Checkbox.stories.tsx +7 -0
- 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/Radio.stories.tsx +9 -1
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +7 -0
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- 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 +83 -3
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Rating/Rating.stories.tsx +109 -84
- 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/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- 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/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +1 -0
- package/src/lib/composables/useAtomixGlass.ts +9 -10
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +4 -4
- package/src/lib/constants/components.ts +17 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- package/src/lib/hooks/usePerformanceMonitor.ts +1 -1
- package/src/lib/hooks/useThemeTokens.ts +105 -0
- 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 +95 -0
- package/src/lib/theme/config/loader.ts +37 -54
- 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} +1 -19
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +75 -266
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +105 -0
- package/src/lib/theme/core/createTheme.ts +108 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +12 -8
- package/src/lib/theme/core/index.ts +19 -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 +478 -107
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/{errors.ts → errors/errors.ts} +1 -1
- 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/generators/generateCSSNested.ts +130 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
- package/src/lib/theme/generators/index.ts +25 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +149 -19
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -112
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +5 -5
- package/src/lib/theme/runtime/ThemeProvider.tsx +266 -282
- package/src/lib/theme/runtime/index.ts +2 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/runtime/useThemeTokens.ts +131 -0
- 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/componentTheming.ts +132 -0
- 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/naming.ts +100 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +7 -7
- package/src/lib/theme-tools.ts +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +2 -2
- package/src/lib/utils/memoryMonitor.ts +3 -3
- package/src/lib/utils/themeNaming.ts +135 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- 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.pagination.scss +88 -0
- package/scripts/sync-theme-config.js +0 -309
- 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 -665
- 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 -446
- package/src/styles/03-generic/_generated-root.css +0 -26
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -68
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
|
@@ -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>
|
|
@@ -71,7 +71,6 @@ const AnimatedChart = memo(
|
|
|
71
71
|
toolbarState,
|
|
72
72
|
config: renderConfig,
|
|
73
73
|
}: ChartRenderContentParams) => {
|
|
74
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
75
74
|
const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? true;
|
|
76
75
|
|
|
77
76
|
if (!chartDatasets.length) return null;
|
|
@@ -33,7 +33,6 @@ const AreaChart = memo(
|
|
|
33
33
|
}: ChartRenderContentParams) => {
|
|
34
34
|
if (!renderedDatasets.length) return null;
|
|
35
35
|
|
|
36
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
37
36
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
38
37
|
|
|
39
38
|
return (
|
|
@@ -43,7 +43,6 @@ const BarChart = memo(
|
|
|
43
43
|
}: ChartRenderContentParams) => {
|
|
44
44
|
if (!renderedDatasets.length) return null;
|
|
45
45
|
|
|
46
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
47
46
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
48
47
|
|
|
49
48
|
const barDimensions = calculateBarDimensions(
|
|
@@ -112,7 +112,6 @@ const BubbleChart = memo(
|
|
|
112
112
|
}: any) => {
|
|
113
113
|
if (!bubbleData.length) return null;
|
|
114
114
|
|
|
115
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
116
115
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
117
116
|
|
|
118
117
|
// Calculate bubble sizes based on data
|
|
@@ -189,7 +189,6 @@ const CandlestickChart = memo(
|
|
|
189
189
|
}: ChartRenderContentParams) => {
|
|
190
190
|
if (!candlestickData.length) return null;
|
|
191
191
|
|
|
192
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
193
192
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? candlestickOptions.showTooltips ?? true;
|
|
194
193
|
|
|
195
194
|
const padding = 40;
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
WaterfallChart,
|
|
31
31
|
} from './index';
|
|
32
32
|
|
|
33
|
-
const meta
|
|
33
|
+
const meta = {
|
|
34
34
|
title: 'Components/Chart',
|
|
35
35
|
component: Chart,
|
|
36
36
|
parameters: {
|
|
@@ -38,17 +38,15 @@ const meta: Meta<typeof Chart> = {
|
|
|
38
38
|
docs: {
|
|
39
39
|
description: {
|
|
40
40
|
component:
|
|
41
|
-
'
|
|
42
|
-
},
|
|
43
|
-
source: {
|
|
44
|
-
code: `<Icon name="Rocket" /> Modern chart library with 20+ chart types, real-time updates, animations, and advanced interactions.`,
|
|
41
|
+
'The Chart component provides a comprehensive charting library with 20+ chart types including line, bar, pie, area, and more. Charts support real-time data updates, animations, interactive tooltips, and advanced customization options. Ideal for dashboards, analytics, data visualization, and any application requiring graphical data representation.',
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
44
|
},
|
|
48
|
-
|
|
45
|
+
tags: ['autodocs'],
|
|
46
|
+
} satisfies Meta<typeof Chart>;
|
|
49
47
|
|
|
50
48
|
export default meta;
|
|
51
|
-
type Story = StoryObj<typeof
|
|
49
|
+
type Story = StoryObj<typeof meta>;
|
|
52
50
|
|
|
53
51
|
// Glass Variant Story
|
|
54
52
|
export const GlassVariant: Story = {
|
|
@@ -205,22 +205,6 @@ const Chart = memo(
|
|
|
205
205
|
panEnabled,
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
// Legacy handlers for backward compatibility
|
|
209
|
-
const handleFullscreen = useCallback(() => {
|
|
210
|
-
toolbarHandlers.onFullscreen(!toolbarState.isFullscreen);
|
|
211
|
-
}, [toolbarHandlers, toolbarState.isFullscreen]);
|
|
212
|
-
|
|
213
|
-
const handleExport = useCallback(
|
|
214
|
-
async (format: string) => {
|
|
215
|
-
await toolbarHandlers.onExport(format);
|
|
216
|
-
},
|
|
217
|
-
[toolbarHandlers]
|
|
218
|
-
);
|
|
219
|
-
|
|
220
|
-
const handleRefresh = useCallback(() => {
|
|
221
|
-
toolbarHandlers.onRefresh();
|
|
222
|
-
}, [toolbarHandlers]);
|
|
223
|
-
|
|
224
208
|
// Sync all toolbar state with component state
|
|
225
209
|
useEffect(() => {
|
|
226
210
|
setIsFullscreen(toolbarState.isFullscreen);
|
|
@@ -238,7 +238,7 @@ const ChartRenderer = memo(
|
|
|
238
238
|
onMouseUp: handleMouseUp,
|
|
239
239
|
onWheel: () => {
|
|
240
240
|
// Wheel handling is done via native event listener (non-passive)
|
|
241
|
-
//
|
|
241
|
+
// Wheel handling is done via native event listener (non-passive)
|
|
242
242
|
},
|
|
243
243
|
}),
|
|
244
244
|
[
|
|
@@ -138,7 +138,6 @@ const FunnelChart = memo(
|
|
|
138
138
|
}: ChartRenderContentParams) => {
|
|
139
139
|
if (!funnelData.length) return null;
|
|
140
140
|
|
|
141
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
142
141
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
143
142
|
const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? animate;
|
|
144
143
|
|
|
@@ -140,7 +140,6 @@ const GaugeChart = memo(
|
|
|
140
140
|
}: ChartRenderContentParams) => {
|
|
141
141
|
const width = scales.width;
|
|
142
142
|
|
|
143
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
144
143
|
const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? animate;
|
|
145
144
|
const height = scales.height;
|
|
146
145
|
const centerX = width / 2;
|
|
@@ -267,7 +267,6 @@ const HeatmapChart = memo(
|
|
|
267
267
|
}: ChartRenderContentParams) => {
|
|
268
268
|
const { matrix, xLabels, yLabels } = processedData;
|
|
269
269
|
|
|
270
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
271
270
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
272
271
|
if (!matrix.length) {
|
|
273
272
|
return null;
|
|
@@ -80,7 +80,6 @@ const LineChart = memo(
|
|
|
80
80
|
}: ChartRenderContentParams) => {
|
|
81
81
|
if (!renderedDatasets.length) return null;
|
|
82
82
|
|
|
83
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
84
83
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
85
84
|
const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? mergedLineOptions.smooth;
|
|
86
85
|
|
|
@@ -164,7 +164,6 @@ const MultiAxisChart = memo(
|
|
|
164
164
|
}: ChartRenderContentParams) => {
|
|
165
165
|
if (!datasets.length) return null;
|
|
166
166
|
|
|
167
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
168
167
|
const effectiveShowTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? showTooltips ?? true;
|
|
169
168
|
const effectiveShowGrid = toolbarState?.showGrid ?? true; // Grid visibility from toolbar
|
|
170
169
|
|
|
@@ -89,7 +89,6 @@ const RadarChart = memo(
|
|
|
89
89
|
}: ChartRenderContentParams) => {
|
|
90
90
|
if (!renderedDatasets.length) return null;
|
|
91
91
|
|
|
92
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
93
92
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
94
93
|
|
|
95
94
|
const centerX = scales.width / 2;
|
|
@@ -52,7 +52,6 @@ const ScatterChart = memo(
|
|
|
52
52
|
}: ChartRenderContentParams) => {
|
|
53
53
|
if (!renderedDatasets.length) return null;
|
|
54
54
|
|
|
55
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
56
55
|
const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
|
|
57
56
|
|
|
58
57
|
const points: React.ReactNode[] = [];
|
|
@@ -129,7 +129,6 @@ const WaterfallChart = memo(
|
|
|
129
129
|
}: ChartRenderContentParams) => {
|
|
130
130
|
if (!waterfallData.length) return null;
|
|
131
131
|
|
|
132
|
-
// Use toolbar state if available, fallback to config for backward compatibility
|
|
133
132
|
const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? animate;
|
|
134
133
|
|
|
135
134
|
const padding = 60;
|
|
@@ -8,7 +8,14 @@ const meta = {
|
|
|
8
8
|
component: ColorModeToggle,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'centered',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'The ColorModeToggle component provides a user-friendly switch for toggling between light and dark color modes. It automatically detects system preferences, persists user choices, and provides visual feedback. Essential for applications supporting theme customization and accessibility preferences.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
11
17
|
},
|
|
18
|
+
tags: ['autodocs'],
|
|
12
19
|
argTypes: {
|
|
13
20
|
size: {
|
|
14
21
|
control: 'select',
|
|
@@ -1,31 +1,38 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { DataTableColumn } from '../../lib/types/components';
|
|
4
4
|
import { DataTable } from './DataTable';
|
|
5
5
|
|
|
6
|
-
const meta
|
|
6
|
+
const meta = {
|
|
7
7
|
title: 'Components/DataTable',
|
|
8
8
|
component: DataTable,
|
|
9
9
|
parameters: {
|
|
10
10
|
layout: 'padded',
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component:
|
|
14
|
+
'The DataTable component provides a powerful and flexible way to display structured data in rows and columns. It supports sorting, filtering, pagination, selection, and various display options. DataTables are ideal for displaying large datasets, user lists, product catalogs, or any tabular information requiring advanced data manipulation.',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
11
17
|
},
|
|
18
|
+
tags: ['autodocs'],
|
|
12
19
|
argTypes: {
|
|
13
|
-
data: { control: 'object' },
|
|
14
|
-
columns: { control: 'object' },
|
|
15
|
-
sortable: { control: 'boolean' },
|
|
16
|
-
filterable: { control: 'boolean' },
|
|
17
|
-
paginated: { control: 'boolean' },
|
|
18
|
-
pageSize: { control: 'number' },
|
|
19
|
-
striped: { control: 'boolean' },
|
|
20
|
-
bordered: { control: 'boolean' },
|
|
21
|
-
dense: { control: 'boolean' },
|
|
22
|
-
loading: { control: 'boolean' },
|
|
23
|
-
emptyMessage: { control: 'text' },
|
|
24
|
-
},
|
|
25
|
-
}
|
|
20
|
+
data: { control: 'object', description: 'Array of data objects to display' },
|
|
21
|
+
columns: { control: 'object', description: 'Column definitions for the table' },
|
|
22
|
+
sortable: { control: 'boolean', description: 'Whether columns are sortable' },
|
|
23
|
+
filterable: { control: 'boolean', description: 'Whether the table is filterable' },
|
|
24
|
+
paginated: { control: 'boolean', description: 'Whether to enable pagination' },
|
|
25
|
+
pageSize: { control: 'number', description: 'Number of rows per page' },
|
|
26
|
+
striped: { control: 'boolean', description: 'Whether to apply striped row styling' },
|
|
27
|
+
bordered: { control: 'boolean', description: 'Whether to show table borders' },
|
|
28
|
+
dense: { control: 'boolean', description: 'Whether to use dense row spacing' },
|
|
29
|
+
loading: { control: 'boolean', description: 'Whether the table is in loading state' },
|
|
30
|
+
emptyMessage: { control: 'text', description: 'Message to display when table is empty' },
|
|
31
|
+
},
|
|
32
|
+
} satisfies Meta<typeof DataTable>;
|
|
26
33
|
|
|
27
34
|
export default meta;
|
|
28
|
-
type Story = StoryObj<typeof
|
|
35
|
+
type Story = StoryObj<typeof meta>;
|
|
29
36
|
|
|
30
37
|
// Generate more sample data for better pagination testing
|
|
31
38
|
const generateUsers = (count: number) => {
|