@shohojdhara/atomix 0.5.1 → 0.5.4
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/atomix.config.ts +45 -33
- package/build-tools/webpack-loader.js +5 -4
- package/dist/atomix.css +138 -17
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/webpack-loader.js +5 -4
- package/dist/charts.d.ts +23 -23
- package/dist/charts.js +40 -37
- package/dist/charts.js.map +1 -1
- package/dist/config.d.ts +699 -0
- package/dist/config.js +17 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +2 -2
- package/dist/core.js +111 -50
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +3 -6
- package/dist/forms.js +2 -2
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +173 -111
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1881 -790
- package/dist/index.esm.js +2713 -816
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2693 -780
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.js +59 -60
- package/dist/layout.js.map +1 -1
- package/dist/theme.d.ts +1390 -276
- package/dist/theme.js +2133 -625
- package/dist/theme.js.map +1 -1
- package/package.json +14 -9
- package/scripts/atomix-cli.js +15 -1
- package/scripts/cli/__tests__/complexity-utils.test.js +24 -0
- package/scripts/cli/__tests__/detector.test.js +50 -0
- package/scripts/cli/__tests__/template-engine.test.js +23 -0
- package/scripts/cli/__tests__/test-setup.js +3 -0
- package/scripts/cli/commands/doctor.js +15 -3
- package/scripts/cli/commands/generate.js +113 -51
- package/scripts/cli/internal/ai-engine.js +30 -10
- package/scripts/cli/internal/complexity-utils.js +60 -0
- package/scripts/cli/internal/component-validator.js +49 -16
- package/scripts/cli/internal/config-loader.js +30 -20
- package/scripts/cli/internal/generator.js +89 -36
- package/scripts/cli/internal/hook-generator.js +5 -2
- package/scripts/cli/internal/itcss-generator.js +16 -12
- package/scripts/cli/templates/next-templates.js +81 -30
- package/scripts/cli/templates/storybook-templates.js +12 -2
- package/scripts/cli/utils/detector.js +45 -7
- package/scripts/cli/utils/diagnostics.js +78 -0
- package/scripts/cli/utils/telemetry.js +13 -0
- package/src/components/Accordion/Accordion.stories.tsx +4 -0
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +1 -1
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +219 -0
- package/src/components/AtomixGlass/glass-utils.ts +1 -1
- package/src/components/Button/Button.tsx +114 -57
- package/src/components/Callout/Callout.tsx +4 -4
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/DonutChart.tsx +11 -8
- package/src/components/EdgePanel/EdgePanel.tsx +119 -115
- package/src/components/Form/Select.tsx +4 -4
- package/src/components/List/List.tsx +4 -4
- package/src/components/Navigation/SideMenu/SideMenu.tsx +6 -6
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +1 -1
- package/src/components/ProductReview/ProductReview.tsx +4 -2
- package/src/components/Rating/Rating.tsx +4 -2
- package/src/components/SectionIntro/SectionIntro.tsx +4 -2
- package/src/components/Steps/Steps.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +5 -5
- package/src/components/Testimonial/Testimonial.tsx +4 -2
- package/src/components/VideoPlayer/VideoPlayer.tsx +4 -2
- package/src/layouts/CssGrid/CssGrid.stories.tsx +464 -0
- package/src/layouts/CssGrid/CssGrid.tsx +215 -0
- package/src/layouts/CssGrid/index.ts +8 -0
- package/src/layouts/CssGrid/scripts/CssGrid.js +284 -0
- package/src/layouts/CssGrid/scripts/index.js +43 -0
- package/src/layouts/Grid/scripts/Container.js +139 -0
- package/src/layouts/Grid/scripts/Grid.js +184 -0
- package/src/layouts/Grid/scripts/GridCol.js +273 -0
- package/src/layouts/Grid/scripts/Row.js +154 -0
- package/src/layouts/Grid/scripts/index.js +48 -0
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +71 -59
- package/src/lib/composables/atomix-glass/useGlassSize.ts +1 -1
- package/src/lib/composables/useAccordion.ts +5 -5
- package/src/lib/composables/useAtomixGlass.ts +3 -3
- package/src/lib/composables/useBarChart.ts +2 -2
- package/src/lib/composables/useChart.ts +3 -2
- package/src/lib/composables/useChartToolbar.ts +48 -66
- package/src/lib/composables/useDataTable.ts +1 -1
- package/src/lib/composables/useDatePicker.ts +2 -2
- package/src/lib/composables/useEdgePanel.ts +45 -54
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -5
- package/src/lib/composables/usePhotoViewer.ts +2 -3
- package/src/lib/composables/usePieChart.ts +1 -1
- package/src/lib/composables/usePopover.ts +151 -139
- package/src/lib/composables/useSideMenu.ts +28 -41
- package/src/lib/composables/useSlider.ts +2 -6
- package/src/lib/composables/useTooltip.ts +2 -2
- package/src/lib/config/index.ts +38 -323
- package/src/lib/config/loader.ts +419 -0
- package/src/lib/config/public-api.ts +43 -0
- package/src/lib/config/types.ts +389 -0
- package/src/lib/config/validator.ts +305 -0
- package/src/lib/theme/adapters/index.ts +1 -1
- package/src/lib/theme/adapters/themeAdapter.ts +358 -229
- package/src/lib/theme/components/ThemeToggle.tsx +276 -0
- package/src/lib/theme/config/configLoader.ts +351 -0
- package/src/lib/theme/config/loader.ts +221 -0
- package/src/lib/theme/core/createTheme.ts +126 -50
- package/src/lib/theme/core/createThemeObject.ts +7 -4
- package/src/lib/theme/devtools/Comparator.tsx +1 -1
- package/src/lib/theme/devtools/Inspector.tsx +1 -1
- package/src/lib/theme/devtools/LiveEditor.tsx +1 -1
- package/src/lib/theme/hooks/useThemeSwitcher.ts +164 -0
- package/src/lib/theme/index.ts +322 -38
- package/src/lib/theme/runtime/ThemeProvider.tsx +45 -11
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +44 -393
- package/src/lib/theme/runtime/useTheme.ts +1 -0
- package/src/lib/theme/tokens/tokens.ts +101 -1
- package/src/lib/theme/types.ts +91 -0
- package/src/lib/theme/utils/performanceMonitor.ts +315 -0
- package/src/lib/theme/utils/responsive.ts +280 -0
- package/src/lib/theme/utils/themeUtils.ts +531 -117
- package/src/styles/01-settings/_index.scss +1 -0
- package/src/styles/01-settings/_settings.atomix-glass.scss +174 -0
- package/src/styles/01-settings/_settings.masonry-grid.scss +42 -6
- package/src/styles/02-tools/_tools.glass.scss +6 -0
- package/src/styles/05-objects/_objects.masonry-grid.scss +162 -24
- package/src/styles/06-components/_components.atomix-glass.scss +4 -4
- package/src/lib/composables/useBreadcrumb.ts +0 -81
- package/src/lib/composables/useChartInteractions.ts +0 -123
- package/src/lib/composables/useChartPerformance.ts +0 -347
- package/src/lib/composables/useDropdown.ts +0 -338
- package/src/lib/composables/useModal.ts +0 -110
- package/src/lib/hooks/usePerformanceMonitor.ts +0 -148
- package/src/lib/utils/displacement-generator.ts +0 -92
- package/src/lib/utils/memoryMonitor.ts +0 -191
- package/src/styles/01-settings/_settings.testtypecheck.scss +0 -53
- package/src/styles/01-settings/_settings.typedbutton.scss +0 -53
- package/src/styles/06-components/_components.testbutton.scss +0 -212
- package/src/styles/06-components/_components.testtypecheck.scss +0 -212
- package/src/styles/06-components/_components.typedbutton.scss +0 -212
|
@@ -74,10 +74,12 @@ export const ProductReview: React.FC<ProductReviewProps> = ({
|
|
|
74
74
|
// Only run on client-side
|
|
75
75
|
if (typeof window === 'undefined' || !reviewRef.current) return undefined;
|
|
76
76
|
|
|
77
|
+
const currentInstance = reviewInstance.current;
|
|
78
|
+
|
|
77
79
|
// Cleanup on unmount
|
|
78
80
|
return () => {
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
+
if (currentInstance) {
|
|
82
|
+
currentInstance.destroy();
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
}, [productName, productImage, initialRating, maxRating, allowHalf, ratingColor, onSubmit]);
|
|
@@ -116,10 +116,12 @@ export const Rating = forwardRef<HTMLDivElement, RatingProps>(
|
|
|
116
116
|
useEffect(() => {
|
|
117
117
|
if (!useVanillaJS || typeof window === 'undefined' || !internalRef.current) return undefined;
|
|
118
118
|
|
|
119
|
+
const currentInstance = ratingInstance.current;
|
|
120
|
+
|
|
119
121
|
// Cleanup on unmount
|
|
120
122
|
return () => {
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
+
if (currentInstance) {
|
|
124
|
+
currentInstance.destroy();
|
|
123
125
|
}
|
|
124
126
|
};
|
|
125
127
|
}, [
|
|
@@ -99,10 +99,12 @@ export const SectionIntro: React.FC<SectionIntroProps> = ({
|
|
|
99
99
|
// Only run on client-side
|
|
100
100
|
if (typeof window === 'undefined' || !sectionIntroRef.current) return undefined;
|
|
101
101
|
|
|
102
|
+
const currentInstance = sectionIntroInstance.current;
|
|
103
|
+
|
|
102
104
|
// Cleanup on unmount
|
|
103
105
|
return () => {
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
+
if (currentInstance) {
|
|
107
|
+
currentInstance.destroy();
|
|
106
108
|
}
|
|
107
109
|
};
|
|
108
110
|
}, [alignment, backgroundImageSrc, showOverlay, size, skeleton]);
|
|
@@ -149,7 +149,7 @@ const StepsComp: React.FC<StepsProps> = ({
|
|
|
149
149
|
if (currentStep !== activeIndex) {
|
|
150
150
|
setCurrentStep(activeIndex);
|
|
151
151
|
}
|
|
152
|
-
}, [activeIndex]);
|
|
152
|
+
}, [activeIndex, currentStep]);
|
|
153
153
|
|
|
154
154
|
// Method to go to next step (Internal helper)
|
|
155
155
|
const goToNextStep = () => {
|
|
@@ -207,8 +207,7 @@ type TabsComponent = React.FC<TabsProps> & {
|
|
|
207
207
|
Panel: typeof TabsPanel;
|
|
208
208
|
};
|
|
209
209
|
|
|
210
|
-
|
|
211
|
-
({
|
|
210
|
+
const TabsComponentBase = ({
|
|
212
211
|
items,
|
|
213
212
|
activeIndex = TAB.DEFAULTS.ACTIVE_INDEX,
|
|
214
213
|
onTabChange,
|
|
@@ -317,7 +316,7 @@ export const Tabs: TabsComponent = memo(
|
|
|
317
316
|
(child): child is React.ReactElement =>
|
|
318
317
|
React.isValidElement(child) && (child.type as any).displayName === 'TabsList'
|
|
319
318
|
);
|
|
320
|
-
const totalTabsCount = tabsList ? React.Children.count(tabsList.props.children) : 0;
|
|
319
|
+
const totalTabsCount = tabsList ? React.Children.count((tabsList.props as any).children) : 0;
|
|
321
320
|
|
|
322
321
|
content = (
|
|
323
322
|
<TabsContext.Provider
|
|
@@ -356,8 +355,9 @@ export const Tabs: TabsComponent = memo(
|
|
|
356
355
|
}
|
|
357
356
|
|
|
358
357
|
return wrapper;
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
export const Tabs = memo(TabsComponentBase) as unknown as TabsComponent;
|
|
361
361
|
|
|
362
362
|
Tabs.displayName = 'Tabs';
|
|
363
363
|
Tabs.List = TabsList;
|
|
@@ -73,10 +73,12 @@ export const Testimonial: React.FC<TestimonialProps> = ({
|
|
|
73
73
|
// Only run on client-side
|
|
74
74
|
if (typeof window === 'undefined' || !testimonialRef.current) return undefined;
|
|
75
75
|
|
|
76
|
+
const currentInstance = testimonialInstance.current;
|
|
77
|
+
|
|
76
78
|
// Cleanup on unmount
|
|
77
79
|
return () => {
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
+
if (currentInstance) {
|
|
81
|
+
currentInstance.destroy();
|
|
80
82
|
}
|
|
81
83
|
};
|
|
82
84
|
}, [size, skeleton]);
|
|
@@ -339,10 +339,12 @@ export const VideoPlayer = forwardRef<HTMLVideoElement, VideoPlayerProps>(
|
|
|
339
339
|
// Also listen for window resize (in case styles change)
|
|
340
340
|
window.addEventListener('resize', detectBorderRadius);
|
|
341
341
|
|
|
342
|
+
const currentContainer = containerRef.current;
|
|
343
|
+
|
|
342
344
|
return () => {
|
|
343
345
|
window.removeEventListener('resize', detectBorderRadius);
|
|
344
|
-
if (resizeObserver &&
|
|
345
|
-
resizeObserver.unobserve(
|
|
346
|
+
if (resizeObserver && currentContainer) {
|
|
347
|
+
resizeObserver.unobserve(currentContainer);
|
|
346
348
|
resizeObserver.disconnect();
|
|
347
349
|
}
|
|
348
350
|
};
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import CssGrid from './CssGrid';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Layout/CSS Grid',
|
|
7
|
+
component: CssGrid,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: `
|
|
13
|
+
A modern CSS Grid component providing native CSS Grid layout capabilities with advanced features.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Grid Template Areas**: Define complex layouts using named grid areas
|
|
18
|
+
- **Auto-placement**: Automatic item placement with dense packing
|
|
19
|
+
- **Responsive Grids**: Dynamic column counts and min-width constraints
|
|
20
|
+
- **Advanced Alignment**: Full CSS Grid alignment control
|
|
21
|
+
- **Gap Utilities**: Independent row and column gap control
|
|
22
|
+
|
|
23
|
+
## Usage Examples
|
|
24
|
+
|
|
25
|
+
### Basic Grid
|
|
26
|
+
\`\`\`tsx
|
|
27
|
+
<CssGrid columns={3} gap="1rem">
|
|
28
|
+
<div>Item 1</div>
|
|
29
|
+
<div>Item 2</div>
|
|
30
|
+
<div>Item 3</div>
|
|
31
|
+
</CssGrid>
|
|
32
|
+
\`\`\`
|
|
33
|
+
|
|
34
|
+
### Template Areas
|
|
35
|
+
\`\`\`tsx
|
|
36
|
+
<CssGrid
|
|
37
|
+
templateAreas={\`
|
|
38
|
+
"header header header"
|
|
39
|
+
"sidebar content content"
|
|
40
|
+
"footer footer footer"
|
|
41
|
+
\`}
|
|
42
|
+
gap="1rem"
|
|
43
|
+
>
|
|
44
|
+
<div style={{ gridArea: "header" }}>Header</div>
|
|
45
|
+
<div style={{ gridArea: "sidebar" }}>Sidebar</div>
|
|
46
|
+
<div style={{ gridArea: "content" }}>Content</div>
|
|
47
|
+
<div style={{ gridArea: "footer" }}>Footer</div>
|
|
48
|
+
</CssGrid>
|
|
49
|
+
\`\`\`
|
|
50
|
+
|
|
51
|
+
### Auto-fit with Min Width
|
|
52
|
+
\`\`\`tsx
|
|
53
|
+
<CssGrid minColumnWidth="200px" gap="1rem">
|
|
54
|
+
{/* Items will automatically wrap and fill available space */}
|
|
55
|
+
<div>Responsive Item</div>
|
|
56
|
+
<div>Responsive Item</div>
|
|
57
|
+
<div>Responsive Item</div>
|
|
58
|
+
</CssGrid>
|
|
59
|
+
\`\`\`
|
|
60
|
+
`
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
argTypes: {
|
|
65
|
+
columns: {
|
|
66
|
+
control: { type: 'number', min: 1, max: 12 },
|
|
67
|
+
description: 'Number of grid columns'
|
|
68
|
+
},
|
|
69
|
+
gap: {
|
|
70
|
+
control: 'text',
|
|
71
|
+
description: 'Gap between grid items'
|
|
72
|
+
},
|
|
73
|
+
templateColumns: {
|
|
74
|
+
control: 'text',
|
|
75
|
+
description: 'CSS grid-template-columns value'
|
|
76
|
+
},
|
|
77
|
+
templateRows: {
|
|
78
|
+
control: 'text',
|
|
79
|
+
description: 'CSS grid-template-rows value'
|
|
80
|
+
},
|
|
81
|
+
templateAreas: {
|
|
82
|
+
control: 'text',
|
|
83
|
+
description: 'CSS grid-template-areas value'
|
|
84
|
+
},
|
|
85
|
+
minColumnWidth: {
|
|
86
|
+
control: 'text',
|
|
87
|
+
description: 'Minimum column width for auto-fit/auto-fill'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} satisfies Meta<typeof CssGrid>;
|
|
91
|
+
|
|
92
|
+
export default meta;
|
|
93
|
+
type Story = StoryObj<typeof meta>;
|
|
94
|
+
|
|
95
|
+
export const BasicGrid: Story = {
|
|
96
|
+
args: {
|
|
97
|
+
columns: 3,
|
|
98
|
+
gap: '1rem',
|
|
99
|
+
children: Array.from({ length: 6 }).map((_, i) => (
|
|
100
|
+
<div key={i} style={{
|
|
101
|
+
background: '#f0f0f0',
|
|
102
|
+
padding: '1rem',
|
|
103
|
+
borderRadius: '4px',
|
|
104
|
+
textAlign: 'center'
|
|
105
|
+
}}>
|
|
106
|
+
Item {i + 1}
|
|
107
|
+
</div>
|
|
108
|
+
))
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const TemplateAreas: Story = {
|
|
113
|
+
args: {
|
|
114
|
+
templateAreas: `
|
|
115
|
+
"header header header"
|
|
116
|
+
"sidebar content content"
|
|
117
|
+
"footer footer footer"
|
|
118
|
+
`,
|
|
119
|
+
templateColumns: '200px 1fr 1fr',
|
|
120
|
+
templateRows: 'auto 1fr auto',
|
|
121
|
+
gap: '1rem',
|
|
122
|
+
style: { height: '400px' },
|
|
123
|
+
children: [
|
|
124
|
+
<div key="header" style={{
|
|
125
|
+
gridArea: 'header',
|
|
126
|
+
background: '#3178c6',
|
|
127
|
+
color: 'white',
|
|
128
|
+
padding: '1rem',
|
|
129
|
+
textAlign: 'center'
|
|
130
|
+
}}>
|
|
131
|
+
Header
|
|
132
|
+
</div>,
|
|
133
|
+
<div key="sidebar" style={{
|
|
134
|
+
gridArea: 'sidebar',
|
|
135
|
+
background: '#e9ecef',
|
|
136
|
+
padding: '1rem'
|
|
137
|
+
}}>
|
|
138
|
+
Sidebar
|
|
139
|
+
</div>,
|
|
140
|
+
<div key="content" style={{
|
|
141
|
+
gridArea: 'content',
|
|
142
|
+
background: '#ffffff',
|
|
143
|
+
padding: '1rem',
|
|
144
|
+
border: '1px solid #ddd'
|
|
145
|
+
}}>
|
|
146
|
+
Main Content
|
|
147
|
+
</div>,
|
|
148
|
+
<div key="footer" style={{
|
|
149
|
+
gridArea: 'footer',
|
|
150
|
+
background: '#343a40',
|
|
151
|
+
color: 'white',
|
|
152
|
+
padding: '1rem',
|
|
153
|
+
textAlign: 'center'
|
|
154
|
+
}}>
|
|
155
|
+
Footer
|
|
156
|
+
</div>
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const AutoFitGrid: Story = {
|
|
162
|
+
args: {
|
|
163
|
+
minColumnWidth: '200px',
|
|
164
|
+
gap: '1rem',
|
|
165
|
+
children: Array.from({ length: 8 }).map((_, i) => (
|
|
166
|
+
<div key={i} style={{
|
|
167
|
+
background: '#28a745',
|
|
168
|
+
color: 'white',
|
|
169
|
+
padding: '1rem',
|
|
170
|
+
borderRadius: '4px',
|
|
171
|
+
textAlign: 'center'
|
|
172
|
+
}}>
|
|
173
|
+
Auto Item {i + 1}
|
|
174
|
+
</div>
|
|
175
|
+
))
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const GapVariations: Story = {
|
|
180
|
+
args: {
|
|
181
|
+
columns: 4,
|
|
182
|
+
columnGap: '2rem',
|
|
183
|
+
rowGap: '1rem',
|
|
184
|
+
children: Array.from({ length: 8 }).map((_, i) => (
|
|
185
|
+
<div key={i} style={{
|
|
186
|
+
background: '#6f42c1',
|
|
187
|
+
color: 'white',
|
|
188
|
+
padding: '1rem',
|
|
189
|
+
borderRadius: '4px',
|
|
190
|
+
textAlign: 'center'
|
|
191
|
+
}}>
|
|
192
|
+
Gap Item {i + 1}
|
|
193
|
+
</div>
|
|
194
|
+
))
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const AlignmentExamples: Story = {
|
|
199
|
+
args: {
|
|
200
|
+
columns: 3,
|
|
201
|
+
gap: '1rem',
|
|
202
|
+
justifyItems: 'center',
|
|
203
|
+
alignItems: 'center',
|
|
204
|
+
style: { height: '200px' },
|
|
205
|
+
children: Array.from({ length: 3 }).map((_, i) => (
|
|
206
|
+
<div key={i} style={{
|
|
207
|
+
background: '#fd7e14',
|
|
208
|
+
color: 'white',
|
|
209
|
+
padding: '1rem',
|
|
210
|
+
borderRadius: '4px',
|
|
211
|
+
width: '80px',
|
|
212
|
+
height: '60px',
|
|
213
|
+
display: 'flex',
|
|
214
|
+
alignItems: 'center',
|
|
215
|
+
justifyContent: 'center'
|
|
216
|
+
}}>
|
|
217
|
+
{i + 1}
|
|
218
|
+
</div>
|
|
219
|
+
))
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const AutoFlowDense: Story = {
|
|
224
|
+
args: {
|
|
225
|
+
columns: 3,
|
|
226
|
+
gap: '1rem',
|
|
227
|
+
autoFlow: 'dense',
|
|
228
|
+
children: [
|
|
229
|
+
<div key={1} style={{
|
|
230
|
+
gridColumn: 'span 2',
|
|
231
|
+
background: '#dc3545',
|
|
232
|
+
color: 'white',
|
|
233
|
+
padding: '1rem',
|
|
234
|
+
borderRadius: '4px'
|
|
235
|
+
}}>
|
|
236
|
+
Wide Item (span 2)
|
|
237
|
+
</div>,
|
|
238
|
+
<div key={2} style={{
|
|
239
|
+
background: '#17a2b8',
|
|
240
|
+
color: 'white',
|
|
241
|
+
padding: '1rem',
|
|
242
|
+
borderRadius: '4px'
|
|
243
|
+
}}>
|
|
244
|
+
Regular Item
|
|
245
|
+
</div>,
|
|
246
|
+
<div key={3} style={{
|
|
247
|
+
background: '#ffc107',
|
|
248
|
+
color: 'black',
|
|
249
|
+
padding: '1rem',
|
|
250
|
+
borderRadius: '4px'
|
|
251
|
+
}}>
|
|
252
|
+
Regular Item
|
|
253
|
+
</div>,
|
|
254
|
+
<div key={4} style={{
|
|
255
|
+
gridRow: 'span 2',
|
|
256
|
+
background: '#20c997',
|
|
257
|
+
color: 'white',
|
|
258
|
+
padding: '1rem',
|
|
259
|
+
borderRadius: '4px'
|
|
260
|
+
}}>
|
|
261
|
+
Tall Item (span 2)
|
|
262
|
+
</div>
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export const ComplexDashboardLayout: Story = {
|
|
268
|
+
args: {
|
|
269
|
+
templateAreas: `
|
|
270
|
+
"header header header"
|
|
271
|
+
"sidebar charts charts"
|
|
272
|
+
"sidebar stats alerts"
|
|
273
|
+
"footer footer footer"
|
|
274
|
+
`,
|
|
275
|
+
templateColumns: '250px 1fr 300px',
|
|
276
|
+
templateRows: '60px 1fr 1fr 50px',
|
|
277
|
+
gap: '1rem',
|
|
278
|
+
style: { height: '600px' },
|
|
279
|
+
children: [
|
|
280
|
+
<div key="header" style={{
|
|
281
|
+
gridArea: 'header',
|
|
282
|
+
background: '#3178c6',
|
|
283
|
+
color: 'white',
|
|
284
|
+
padding: '1rem',
|
|
285
|
+
display: 'flex',
|
|
286
|
+
alignItems: 'center',
|
|
287
|
+
borderRadius: '4px'
|
|
288
|
+
}}>
|
|
289
|
+
<h2 style={{ margin: 0 }}>Dashboard Header</h2>
|
|
290
|
+
</div>,
|
|
291
|
+
<div key="sidebar" style={{
|
|
292
|
+
gridArea: 'sidebar',
|
|
293
|
+
background: '#f8f9fa',
|
|
294
|
+
padding: '1rem',
|
|
295
|
+
borderRadius: '4px'
|
|
296
|
+
}}>
|
|
297
|
+
<h3>Sidebar</h3>
|
|
298
|
+
<ul style={{ listStyle: 'none', padding: 0 }}>
|
|
299
|
+
<li>Overview</li>
|
|
300
|
+
<li>Analytics</li>
|
|
301
|
+
<li>Reports</li>
|
|
302
|
+
<li>Settings</li>
|
|
303
|
+
</ul>
|
|
304
|
+
</div>,
|
|
305
|
+
<div key="charts" style={{
|
|
306
|
+
gridArea: 'charts',
|
|
307
|
+
background: 'white',
|
|
308
|
+
padding: '1rem',
|
|
309
|
+
border: '1px solid #ddd',
|
|
310
|
+
borderRadius: '4px'
|
|
311
|
+
}}>
|
|
312
|
+
<h3>Charts & Analytics</h3>
|
|
313
|
+
<p>Interactive charts area</p>
|
|
314
|
+
</div>,
|
|
315
|
+
<div key="stats" style={{
|
|
316
|
+
gridArea: 'stats',
|
|
317
|
+
background: '#e9ecef',
|
|
318
|
+
padding: '1rem',
|
|
319
|
+
borderRadius: '4px'
|
|
320
|
+
}}>
|
|
321
|
+
<h3>Quick Stats</h3>
|
|
322
|
+
<p>Performance metrics</p>
|
|
323
|
+
</div>,
|
|
324
|
+
<div key="alerts" style={{
|
|
325
|
+
gridArea: 'alerts',
|
|
326
|
+
background: '#fff3cd',
|
|
327
|
+
padding: '1rem',
|
|
328
|
+
borderRadius: '4px',
|
|
329
|
+
border: '1px solid #ffeaa7'
|
|
330
|
+
}}>
|
|
331
|
+
<h3>Alerts</h3>
|
|
332
|
+
<p>System notifications</p>
|
|
333
|
+
</div>,
|
|
334
|
+
<div key="footer" style={{
|
|
335
|
+
gridArea: 'footer',
|
|
336
|
+
background: '#343a40',
|
|
337
|
+
color: 'white',
|
|
338
|
+
padding: '1rem',
|
|
339
|
+
textAlign: 'center',
|
|
340
|
+
borderRadius: '4px'
|
|
341
|
+
}}>
|
|
342
|
+
Dashboard Footer
|
|
343
|
+
</div>
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
export const GridLinePositioning: Story = {
|
|
349
|
+
args: {
|
|
350
|
+
templateColumns: 'repeat(4, 1fr)',
|
|
351
|
+
templateRows: 'repeat(3, 100px)',
|
|
352
|
+
gap: '0.5rem',
|
|
353
|
+
style: { height: '320px' },
|
|
354
|
+
children: [
|
|
355
|
+
<div key="wide" style={{
|
|
356
|
+
gridColumn: '1 / 3',
|
|
357
|
+
gridRow: '1',
|
|
358
|
+
background: '#007bff',
|
|
359
|
+
color: 'white',
|
|
360
|
+
padding: '1rem',
|
|
361
|
+
borderRadius: '4px',
|
|
362
|
+
display: 'flex',
|
|
363
|
+
alignItems: 'center',
|
|
364
|
+
justifyContent: 'center'
|
|
365
|
+
}}>
|
|
366
|
+
Col 1-2, Row 1
|
|
367
|
+
</div>,
|
|
368
|
+
<div key="tall" style={{
|
|
369
|
+
gridColumn: '3',
|
|
370
|
+
gridRow: '1 / 3',
|
|
371
|
+
background: '#28a745',
|
|
372
|
+
color: 'white',
|
|
373
|
+
padding: '1rem',
|
|
374
|
+
borderRadius: '4px',
|
|
375
|
+
display: 'flex',
|
|
376
|
+
alignItems: 'center',
|
|
377
|
+
justifyContent: 'center'
|
|
378
|
+
}}>
|
|
379
|
+
Col 3, Row 1-2
|
|
380
|
+
</div>,
|
|
381
|
+
<div key="positioned" style={{
|
|
382
|
+
gridColumn: '2 / 4',
|
|
383
|
+
gridRow: '2 / 4',
|
|
384
|
+
background: '#dc3545',
|
|
385
|
+
color: 'white',
|
|
386
|
+
padding: '1rem',
|
|
387
|
+
borderRadius: '4px',
|
|
388
|
+
display: 'flex',
|
|
389
|
+
alignItems: 'center',
|
|
390
|
+
justifyContent: 'center'
|
|
391
|
+
}}>
|
|
392
|
+
Col 2-3, Row 2-3
|
|
393
|
+
</div>,
|
|
394
|
+
<div key="small" style={{
|
|
395
|
+
gridColumn: '4',
|
|
396
|
+
gridRow: '3',
|
|
397
|
+
background: '#ffc107',
|
|
398
|
+
color: 'black',
|
|
399
|
+
padding: '1rem',
|
|
400
|
+
borderRadius: '4px',
|
|
401
|
+
display: 'flex',
|
|
402
|
+
alignItems: 'center',
|
|
403
|
+
justifyContent: 'center'
|
|
404
|
+
}}>
|
|
405
|
+
Col 4, Row 3
|
|
406
|
+
</div>
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
export const ResponsiveTemplateAreas: Story = {
|
|
412
|
+
args: {
|
|
413
|
+
templateAreas: {
|
|
414
|
+
xs: `"header" "main" "footer"`,
|
|
415
|
+
md: `"header header" "sidebar main" "footer footer"`,
|
|
416
|
+
lg: `"header header header" "sidebar main main" "footer footer footer"`
|
|
417
|
+
} as any,
|
|
418
|
+
templateColumns: {
|
|
419
|
+
xs: '1fr',
|
|
420
|
+
md: '200px 1fr',
|
|
421
|
+
lg: '250px 1fr 1fr'
|
|
422
|
+
} as any,
|
|
423
|
+
gap: '1rem',
|
|
424
|
+
style: { minHeight: '400px' },
|
|
425
|
+
children: [
|
|
426
|
+
<div key="header" style={{
|
|
427
|
+
gridArea: 'header',
|
|
428
|
+
background: '#3178c6',
|
|
429
|
+
color: 'white',
|
|
430
|
+
padding: '1rem',
|
|
431
|
+
borderRadius: '4px'
|
|
432
|
+
}}>
|
|
433
|
+
Header
|
|
434
|
+
</div>,
|
|
435
|
+
<div key="sidebar" style={{
|
|
436
|
+
gridArea: 'sidebar',
|
|
437
|
+
background: '#f8f9fa',
|
|
438
|
+
padding: '1rem',
|
|
439
|
+
borderRadius: '4px'
|
|
440
|
+
}}>
|
|
441
|
+
Sidebar
|
|
442
|
+
</div>,
|
|
443
|
+
<div key="main" style={{
|
|
444
|
+
gridArea: 'main',
|
|
445
|
+
background: 'white',
|
|
446
|
+
padding: '1rem',
|
|
447
|
+
border: '1px solid #ddd',
|
|
448
|
+
borderRadius: '4px'
|
|
449
|
+
}}>
|
|
450
|
+
Main Content
|
|
451
|
+
</div>,
|
|
452
|
+
<div key="footer" style={{
|
|
453
|
+
gridArea: 'footer',
|
|
454
|
+
background: '#343a40',
|
|
455
|
+
color: 'white',
|
|
456
|
+
padding: '1rem',
|
|
457
|
+
textAlign: 'center',
|
|
458
|
+
borderRadius: '4px'
|
|
459
|
+
}}>
|
|
460
|
+
Footer
|
|
461
|
+
</div>
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
};
|