@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
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { Meta,
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { Upload } from './Upload';
|
|
4
|
+
import { SIZES } from '../../lib/constants/components';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const meta = {
|
|
6
7
|
title: 'Components/Upload',
|
|
7
8
|
component: Upload,
|
|
8
9
|
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
9
11
|
docs: {
|
|
10
12
|
description: {
|
|
11
13
|
component:
|
|
12
|
-
'
|
|
14
|
+
'The Upload component provides a modern file upload interface with drag & drop functionality, progress tracking, file preview, and validation. It supports single and multiple file uploads, custom file size limits, and provides visual feedback throughout the upload process. Ideal for forms requiring file attachments or media uploads.',
|
|
13
15
|
},
|
|
14
16
|
},
|
|
15
17
|
},
|
|
18
|
+
tags: ['autodocs'],
|
|
16
19
|
argTypes: {
|
|
17
20
|
size: {
|
|
18
21
|
control: { type: 'select' },
|
|
19
|
-
options:
|
|
22
|
+
options: SIZES,
|
|
20
23
|
defaultValue: 'md',
|
|
21
24
|
description: 'Size variant of the upload component',
|
|
22
25
|
},
|
|
@@ -56,33 +59,37 @@ export default {
|
|
|
56
59
|
description: 'Helper text displayed below the button',
|
|
57
60
|
},
|
|
58
61
|
},
|
|
59
|
-
}
|
|
62
|
+
} satisfies Meta<typeof Upload>;
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<Upload {...args} />
|
|
64
|
-
</div>
|
|
65
|
-
);
|
|
64
|
+
export default meta;
|
|
65
|
+
type Story = StoryObj<typeof meta>;
|
|
66
66
|
|
|
67
67
|
// Default upload component
|
|
68
|
-
export const Default =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
export const Default: Story = {
|
|
69
|
+
render: args => (
|
|
70
|
+
<div style={{ padding: '30px', maxWidth: '600px' }}>
|
|
71
|
+
<Upload {...args} />
|
|
72
|
+
</div>
|
|
73
|
+
),
|
|
74
|
+
args: {
|
|
75
|
+
size: 'md',
|
|
76
|
+
title: 'Drag and Drop files here',
|
|
77
|
+
supportedFilesText: 'Files supported: PDF, XSLS, JPEG, PNG, Scanner',
|
|
78
|
+
buttonText: 'Choose File',
|
|
79
|
+
helperText: 'Maximum size: 5MB',
|
|
80
|
+
},
|
|
81
|
+
parameters: {
|
|
82
|
+
docs: {
|
|
83
|
+
description: {
|
|
84
|
+
story: 'The default upload component with medium size and standard styling.',
|
|
85
|
+
},
|
|
80
86
|
},
|
|
81
87
|
},
|
|
82
88
|
};
|
|
83
89
|
|
|
84
90
|
// Size Variants
|
|
85
|
-
export const SizeVariants:
|
|
91
|
+
export const SizeVariants: Story = {
|
|
92
|
+
render: () => (
|
|
86
93
|
<div style={{ padding: '30px' }}>
|
|
87
94
|
<div style={{ marginBottom: '40px' }}>
|
|
88
95
|
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>Small Size</h3>
|
|
@@ -125,25 +132,36 @@ export const SizeVariants: StoryFn<typeof Upload> = () => (
|
|
|
125
132
|
</div>
|
|
126
133
|
</div>
|
|
127
134
|
</div>
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
),
|
|
136
|
+
parameters: {
|
|
137
|
+
docs: {
|
|
138
|
+
description: {
|
|
139
|
+
story: 'Upload component in different sizes: small (sm), medium (md), and large (lg).',
|
|
140
|
+
},
|
|
133
141
|
},
|
|
134
142
|
},
|
|
135
143
|
};
|
|
136
144
|
|
|
137
145
|
// Disabled state
|
|
138
|
-
export const Disabled =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
export const Disabled: Story = {
|
|
147
|
+
render: args => (
|
|
148
|
+
<div style={{ padding: '30px', maxWidth: '600px' }}>
|
|
149
|
+
<Upload {...args} />
|
|
150
|
+
</div>
|
|
151
|
+
),
|
|
152
|
+
args: {
|
|
153
|
+
size: 'md',
|
|
154
|
+
title: 'Drag and Drop files here',
|
|
155
|
+
supportedFilesText: 'Files supported: PDF, XSLS, JPEG, PNG, Scanner',
|
|
156
|
+
buttonText: 'Choose File',
|
|
157
|
+
helperText: 'Maximum size: 5MB',
|
|
158
|
+
disabled: true,
|
|
159
|
+
},
|
|
160
|
+
parameters: {
|
|
161
|
+
docs: {
|
|
162
|
+
description: {
|
|
163
|
+
story: 'Upload component in disabled state with reduced opacity and no interactions.',
|
|
164
|
+
},
|
|
147
165
|
},
|
|
148
166
|
},
|
|
149
167
|
};
|
|
@@ -299,54 +317,71 @@ const WithStateControls: React.FC = () => {
|
|
|
299
317
|
);
|
|
300
318
|
};
|
|
301
319
|
|
|
302
|
-
export const WithControls:
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
320
|
+
export const WithControls: Story = {
|
|
321
|
+
render: () => <WithStateControls />,
|
|
322
|
+
parameters: {
|
|
323
|
+
docs: {
|
|
324
|
+
description: {
|
|
325
|
+
story:
|
|
326
|
+
'Interactive example showing different upload states: default, uploading with progress, success, and error states.',
|
|
327
|
+
},
|
|
308
328
|
},
|
|
309
329
|
},
|
|
310
330
|
};
|
|
311
331
|
|
|
312
332
|
// Custom Icon
|
|
313
|
-
export const CustomIcon =
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
333
|
+
export const CustomIcon: Story = {
|
|
334
|
+
render: args => (
|
|
335
|
+
<div style={{ padding: '30px', maxWidth: '600px' }}>
|
|
336
|
+
<Upload {...args} />
|
|
337
|
+
</div>
|
|
338
|
+
),
|
|
339
|
+
args: {
|
|
340
|
+
size: 'md',
|
|
341
|
+
title: 'Upload your documents',
|
|
342
|
+
supportedFilesText: 'Drag files here or click to browse',
|
|
343
|
+
buttonText: 'Choose File',
|
|
344
|
+
helperText: 'Maximum size: 5MB',
|
|
345
|
+
icon: <i className="icon-lux-upload-cloud"></i>,
|
|
346
|
+
},
|
|
347
|
+
parameters: {
|
|
348
|
+
docs: {
|
|
349
|
+
description: {
|
|
350
|
+
story: 'Upload component with a custom icon and personalized text content.',
|
|
351
|
+
},
|
|
324
352
|
},
|
|
325
353
|
},
|
|
326
354
|
};
|
|
327
355
|
|
|
328
356
|
// Multiple file upload
|
|
329
|
-
export const MultipleFiles =
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
357
|
+
export const MultipleFiles: Story = {
|
|
358
|
+
render: args => (
|
|
359
|
+
<div style={{ padding: '30px', maxWidth: '600px' }}>
|
|
360
|
+
<Upload {...args} />
|
|
361
|
+
</div>
|
|
362
|
+
),
|
|
363
|
+
args: {
|
|
364
|
+
size: 'md',
|
|
365
|
+
multiple: true,
|
|
366
|
+
buttonText: 'Choose Files',
|
|
367
|
+
title: 'Upload multiple files',
|
|
368
|
+
supportedFilesText: 'Select multiple files at once',
|
|
369
|
+
helperText: 'Maximum size: 5MB per file',
|
|
370
|
+
},
|
|
371
|
+
parameters: {
|
|
372
|
+
docs: {
|
|
373
|
+
description: {
|
|
374
|
+
story: 'Upload component configured to accept multiple files at once.',
|
|
375
|
+
},
|
|
342
376
|
},
|
|
343
377
|
},
|
|
344
378
|
};
|
|
345
379
|
|
|
346
380
|
// Drag and Drop Demo
|
|
347
|
-
export const DragDropDemo:
|
|
348
|
-
|
|
349
|
-
|
|
381
|
+
export const DragDropDemo: Story = {
|
|
382
|
+
render: () => {
|
|
383
|
+
const [dragState, setDragState] = useState<'idle' | 'dragging'>('idle');
|
|
384
|
+
const [uploadedFiles, setUploadedFiles] = useState<string[]>([]);
|
|
350
385
|
|
|
351
386
|
const handleFileSelect = (files: File[]) => {
|
|
352
387
|
const fileNames = files.map(file => file.name);
|
|
@@ -415,20 +450,22 @@ export const DragDropDemo: StoryFn<typeof Upload> = () => {
|
|
|
415
450
|
</div>
|
|
416
451
|
)}
|
|
417
452
|
</div>
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
453
|
+
);
|
|
454
|
+
},
|
|
455
|
+
parameters: {
|
|
456
|
+
docs: {
|
|
457
|
+
description: {
|
|
458
|
+
story:
|
|
459
|
+
'Interactive demonstration of drag & drop functionality with visual feedback and file tracking.',
|
|
460
|
+
},
|
|
425
461
|
},
|
|
426
462
|
},
|
|
427
463
|
};
|
|
428
464
|
|
|
429
465
|
// Different File Types
|
|
430
|
-
export const FileTypeRestrictions:
|
|
431
|
-
|
|
466
|
+
export const FileTypeRestrictions: Story = {
|
|
467
|
+
render: () => (
|
|
468
|
+
<div style={{ padding: '30px' }}>
|
|
432
469
|
<div style={{ marginBottom: '40px' }}>
|
|
433
470
|
<h3 style={{ marginBottom: '20px', fontSize: '18px', fontWeight: '600' }}>Images Only</h3>
|
|
434
471
|
<div style={{ maxWidth: '500px' }}>
|
|
@@ -462,11 +499,12 @@ export const FileTypeRestrictions: StoryFn<typeof Upload> = () => (
|
|
|
462
499
|
</div>
|
|
463
500
|
</div>
|
|
464
501
|
</div>
|
|
465
|
-
)
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
502
|
+
),
|
|
503
|
+
parameters: {
|
|
504
|
+
docs: {
|
|
505
|
+
description: {
|
|
506
|
+
story: 'Upload components configured for specific file types with appropriate messaging.',
|
|
507
|
+
},
|
|
470
508
|
},
|
|
471
509
|
},
|
|
472
510
|
};
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* @component VideoPlayer
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { Meta, StoryObj } from '@storybook/react';
|
|
12
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
13
|
+
import { fn } from '@storybook/test';
|
|
13
14
|
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
14
15
|
import React from 'react';
|
|
15
|
-
import { fn } from '@storybook/test';
|
|
16
16
|
import { VideoPlayerProps } from '../../lib/types/components';
|
|
17
17
|
import { VideoPlayer } from './VideoPlayer';
|
|
18
18
|
import type { RefObject } from 'react';
|
|
@@ -23,31 +23,15 @@ import type { RefObject } from 'react';
|
|
|
23
23
|
* This defines the component's metadata, documentation, and controls
|
|
24
24
|
* for the Storybook interface.
|
|
25
25
|
*/
|
|
26
|
-
const meta
|
|
26
|
+
const meta = {
|
|
27
27
|
title: 'Components/VideoPlayer',
|
|
28
28
|
component: VideoPlayer,
|
|
29
29
|
parameters: {
|
|
30
30
|
layout: 'centered',
|
|
31
31
|
docs: {
|
|
32
32
|
description: {
|
|
33
|
-
component: `
|
|
34
|
-
# VideoPlayer Component
|
|
35
|
-
|
|
36
|
-
An advanced, modern video player with comprehensive features, accessibility support, and optional glass morphism effects. Supports both regular video files and YouTube embeds with seamless integration.
|
|
37
|
-
|
|
38
|
-
## Key Features
|
|
33
|
+
component: `The VideoPlayer component provides an advanced, modern video player with comprehensive features including custom controls, YouTube integration, glass morphism effects, and full accessibility support. It supports both regular video files and YouTube embeds with seamless auto-detection and provides a rich, interactive viewing experience.
|
|
39
34
|
|
|
40
|
-
### 🎥 **Dual Video Support**
|
|
41
|
-
- **Regular Videos**: Native HTML5 video with custom controls
|
|
42
|
-
- **YouTube Integration**: Seamless YouTube embedding with auto-detection
|
|
43
|
-
|
|
44
|
-
### ✨ **Glass Morphism Effects**
|
|
45
|
-
- **Configurable Glass Overlay**: Optional frosted glass effects with AtomixGlass integration
|
|
46
|
-
- **Custom Content Support**: Interactive overlays and call-to-action elements
|
|
47
|
-
- **Multiple Glass Modes**: Standard, polar, prominent, and shader effects
|
|
48
|
-
|
|
49
|
-
### 🎛️ **Advanced Controls**
|
|
50
|
-
- **Custom UI**: Modern, responsive control interface
|
|
51
35
|
- **Quality Selection**: Multiple video resolution options
|
|
52
36
|
- **Playback Speed**: Adjustable speed controls (0.25x to 4x)
|
|
53
37
|
- **Subtitle Support**: Multi-language subtitle tracks with WebVTT
|
|
@@ -69,8 +53,7 @@ An advanced, modern video player with comprehensive features, accessibility supp
|
|
|
69
53
|
### 📱 **Multi-Platform**
|
|
70
54
|
- **Cross-Browser**: Works on all modern browsers
|
|
71
55
|
- **Mobile Optimized**: Touch-friendly controls and responsive layout
|
|
72
|
-
- **Performance**: Optimized for smooth playback and effects
|
|
73
|
-
`,
|
|
56
|
+
- **Performance**: Optimized for smooth playback and effects`,
|
|
74
57
|
},
|
|
75
58
|
},
|
|
76
59
|
},
|
|
@@ -164,10 +147,10 @@ An advanced, modern video player with comprehensive features, accessibility supp
|
|
|
164
147
|
description: 'Additional CSS class names',
|
|
165
148
|
},
|
|
166
149
|
},
|
|
167
|
-
}
|
|
150
|
+
} satisfies Meta<typeof VideoPlayer>;
|
|
168
151
|
|
|
169
152
|
export default meta;
|
|
170
|
-
type Story = StoryObj<
|
|
153
|
+
type Story = StoryObj<typeof meta>;
|
|
171
154
|
|
|
172
155
|
/**
|
|
173
156
|
* Background Wrapper Component
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { SliderProps, VideoPlayerProps } from '../lib/types/components';
|
|
2
|
-
export { default as Accordion
|
|
2
|
+
export { default as Accordion } from './Accordion/Accordion';
|
|
3
|
+
export type { AccordionProps } from '../lib/types/components';
|
|
3
4
|
export { default as AtomixLogo, type AtomixLogoProps } from './AtomixLogo/AtomixLogo';
|
|
4
5
|
export { default as AtomixGlass, type AtomixGlassProps } from './AtomixGlass';
|
|
5
6
|
export { default as Avatar, type AvatarProps } from './Avatar/Avatar';
|
|
@@ -8,6 +9,7 @@ export { default as Badge, type BadgeProps } from './Badge/Badge';
|
|
|
8
9
|
export { default as Block, type BlockProps } from './Block';
|
|
9
10
|
export { default as Breadcrumb, type BreadcrumbProps } from './Breadcrumb/Breadcrumb';
|
|
10
11
|
export { default as Button, type ButtonProps } from './Button/Button';
|
|
12
|
+
export { default as ButtonGroup, type ButtonGroupProps } from './Button/ButtonGroup';
|
|
11
13
|
export { default as Callout, type CalloutProps } from './Callout/Callout';
|
|
12
14
|
export { default as Card, type CardProps } from './Card/Card';
|
|
13
15
|
// Card sub-components
|
|
@@ -37,7 +39,7 @@ export {
|
|
|
37
39
|
type BubbleDataPoint,
|
|
38
40
|
type CandlestickChartProps,
|
|
39
41
|
type CandlestickDataPoint,
|
|
40
|
-
|
|
42
|
+
// ChartProps exported separately from lib/types/components to avoid conflict
|
|
41
43
|
type DonutChartProps,
|
|
42
44
|
type FunnelChartProps,
|
|
43
45
|
type FunnelDataPoint,
|
|
@@ -56,6 +58,8 @@ export {
|
|
|
56
58
|
type WaterfallChartProps,
|
|
57
59
|
type WaterfallDataPoint,
|
|
58
60
|
} from './Chart';
|
|
61
|
+
// Export ChartProps from lib/types/components to avoid duplicate export conflict
|
|
62
|
+
export type { ChartProps } from '../lib/types/components';
|
|
59
63
|
export {
|
|
60
64
|
default as ColorModeToggle,
|
|
61
65
|
type ColorModeToggleProps,
|
|
@@ -374,7 +374,7 @@ export const MasonryGrid = forwardRef<HTMLDivElement, MasonryGridProps>(
|
|
|
374
374
|
const position = positions[index];
|
|
375
375
|
if (!position) {
|
|
376
376
|
return (
|
|
377
|
-
<div key={item.id} ref={item.ref} style={{ opacity: 0, position: 'absolute' }}>
|
|
377
|
+
<div key={item.id} ref={item.ref as React.LegacyRef<HTMLDivElement>} style={{ opacity: 0, position: 'absolute' }}>
|
|
378
378
|
{item.element}
|
|
379
379
|
</div>
|
|
380
380
|
);
|
|
@@ -382,7 +382,7 @@ export const MasonryGrid = forwardRef<HTMLDivElement, MasonryGridProps>(
|
|
|
382
382
|
return (
|
|
383
383
|
<div
|
|
384
384
|
key={item.id}
|
|
385
|
-
ref={item.ref}
|
|
385
|
+
ref={item.ref as React.LegacyRef<HTMLDivElement>}
|
|
386
386
|
className="o-masonry-grid__item"
|
|
387
387
|
style={{
|
|
388
388
|
position: 'absolute',
|
|
@@ -1037,10 +1037,9 @@ export function useAtomixGlass({
|
|
|
1037
1037
|
[onClick]
|
|
1038
1038
|
);
|
|
1039
1039
|
|
|
1040
|
-
//
|
|
1040
|
+
// Mouse tracking is now handled by shared global tracker
|
|
1041
1041
|
const handleMouseMove = useCallback((_e: MouseEvent) => {
|
|
1042
|
-
// Mouse tracking
|
|
1043
|
-
// This handler is kept for backward compatibility with existing code
|
|
1042
|
+
// Mouse tracking handled by shared global tracker
|
|
1044
1043
|
}, []);
|
|
1045
1044
|
|
|
1046
1045
|
return {
|
|
@@ -70,35 +70,33 @@ export function useChartPerformance() {
|
|
|
70
70
|
height: number,
|
|
71
71
|
padding: { top: number; right: number; bottom: number; left: number }
|
|
72
72
|
) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
101
|
-
}, [datasets, width, height, padding.top, padding.right, padding.bottom, padding.left]);
|
|
73
|
+
if (!datasets.length) return null;
|
|
74
|
+
|
|
75
|
+
const innerWidth = width - padding.left - padding.right;
|
|
76
|
+
const innerHeight = height - padding.top - padding.bottom;
|
|
77
|
+
|
|
78
|
+
// Calculate bounds efficiently
|
|
79
|
+
const allValues = datasets.flatMap(dataset => dataset.data.map(d => d.value));
|
|
80
|
+
const minValue = Math.min(...allValues);
|
|
81
|
+
const maxValue = Math.max(...allValues);
|
|
82
|
+
const valueRange = maxValue - minValue;
|
|
83
|
+
|
|
84
|
+
// Pre-calculate scale functions for better performance
|
|
85
|
+
const xScale = (i: number, dataLength: number) =>
|
|
86
|
+
padding.left + (i / (dataLength - 1)) * innerWidth;
|
|
87
|
+
|
|
88
|
+
const yScale = (value: number) =>
|
|
89
|
+
padding.top + innerHeight - ((value - minValue) / valueRange) * innerHeight;
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
xScale,
|
|
93
|
+
yScale,
|
|
94
|
+
minValue,
|
|
95
|
+
maxValue,
|
|
96
|
+
valueRange,
|
|
97
|
+
innerWidth,
|
|
98
|
+
innerHeight,
|
|
99
|
+
};
|
|
102
100
|
},
|
|
103
101
|
[]
|
|
104
102
|
);
|
|
@@ -113,47 +111,65 @@ export function useChartPerformance() {
|
|
|
113
111
|
viewportEnd: number,
|
|
114
112
|
bufferSize: number = 50
|
|
115
113
|
) => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
// No virtualization needed for small datasets
|
|
119
|
-
return {
|
|
120
|
-
visibleData: data,
|
|
121
|
-
startIndex: 0,
|
|
122
|
-
endIndex: data.length - 1,
|
|
123
|
-
isVirtualized: false,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const start = Math.max(0, viewportStart - bufferSize);
|
|
128
|
-
const end = Math.min(data.length - 1, viewportEnd + bufferSize);
|
|
129
|
-
|
|
114
|
+
if (data.length <= 1000) {
|
|
115
|
+
// No virtualization needed for small datasets
|
|
130
116
|
return {
|
|
131
|
-
visibleData: data
|
|
132
|
-
startIndex:
|
|
133
|
-
endIndex:
|
|
134
|
-
isVirtualized:
|
|
135
|
-
totalLength: data.length,
|
|
117
|
+
visibleData: data,
|
|
118
|
+
startIndex: 0,
|
|
119
|
+
endIndex: data.length - 1,
|
|
120
|
+
isVirtualized: false,
|
|
136
121
|
};
|
|
137
|
-
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const start = Math.max(0, viewportStart - bufferSize);
|
|
125
|
+
const end = Math.min(data.length - 1, viewportEnd + bufferSize);
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
visibleData: data.slice(start, end + 1),
|
|
129
|
+
startIndex: start,
|
|
130
|
+
endIndex: end,
|
|
131
|
+
isVirtualized: true,
|
|
132
|
+
totalLength: data.length,
|
|
133
|
+
};
|
|
138
134
|
},
|
|
139
135
|
[]
|
|
140
136
|
);
|
|
141
137
|
|
|
142
138
|
/**
|
|
143
139
|
* Debounced data updates for real-time charts
|
|
140
|
+
* Returns a debounced function that maintains timeout state across calls
|
|
141
|
+
* Uses a closure to maintain state - each call to useDebouncedUpdates creates
|
|
142
|
+
* a new debounced function with its own persistent timeout state
|
|
144
143
|
*/
|
|
145
144
|
const useDebouncedUpdates = useCallback((updateFunction: () => void, delay: number = 100) => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
// Use a closure variable to maintain timeout state across multiple calls to the returned function
|
|
146
|
+
// This variable is created once when useDebouncedUpdates is called and persists
|
|
147
|
+
// across all invocations of the returned debounced function
|
|
148
|
+
let timeoutId: NodeJS.Timeout | null = null;
|
|
149
|
+
|
|
150
|
+
const debouncedFn: (() => void) & { cancel: () => void } = () => {
|
|
151
|
+
// Clear any existing timeout before setting a new one
|
|
152
|
+
if (timeoutId !== null) {
|
|
153
|
+
clearTimeout(timeoutId);
|
|
154
|
+
timeoutId = null;
|
|
151
155
|
}
|
|
152
156
|
|
|
153
|
-
|
|
157
|
+
// Set new timeout and store the ID
|
|
158
|
+
timeoutId = setTimeout(() => {
|
|
154
159
|
updateFunction();
|
|
160
|
+
timeoutId = null;
|
|
155
161
|
}, delay);
|
|
156
|
-
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// Add cleanup method to cancel pending debounced calls
|
|
165
|
+
debouncedFn.cancel = () => {
|
|
166
|
+
if (timeoutId !== null) {
|
|
167
|
+
clearTimeout(timeoutId);
|
|
168
|
+
timeoutId = null;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return debouncedFn;
|
|
157
173
|
}, []);
|
|
158
174
|
|
|
159
175
|
/**
|
|
@@ -192,32 +208,40 @@ export function useChartPerformance() {
|
|
|
192
208
|
|
|
193
209
|
/**
|
|
194
210
|
* Optimized animation frame handling
|
|
211
|
+
* Returns animation control functions that maintain state across calls
|
|
212
|
+
* Uses closures to maintain state - each call to useAnimationFrame creates
|
|
213
|
+
* a new animation controller with its own persistent state
|
|
195
214
|
*/
|
|
196
215
|
const useAnimationFrame = useCallback((callback: () => void) => {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const startAnimation =
|
|
213
|
-
|
|
214
|
-
|
|
216
|
+
// Use closure variables to maintain animation state across multiple calls
|
|
217
|
+
// These variables are created once when useAnimationFrame is called and persist
|
|
218
|
+
// across all invocations of the returned animation control functions
|
|
219
|
+
let requestId: number | null = null;
|
|
220
|
+
let previousTime: number | null = null;
|
|
221
|
+
|
|
222
|
+
const animate = (time: number) => {
|
|
223
|
+
if (previousTime !== null && previousTime !== undefined) {
|
|
224
|
+
const deltaTime = time - previousTime;
|
|
225
|
+
callback();
|
|
226
|
+
}
|
|
227
|
+
previousTime = time;
|
|
228
|
+
requestId = requestAnimationFrame(animate);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
const startAnimation = () => {
|
|
232
|
+
// Only start if not already running
|
|
233
|
+
if (requestId === null) {
|
|
234
|
+
requestId = requestAnimationFrame(animate);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
215
237
|
|
|
216
|
-
const stopAnimation =
|
|
217
|
-
if (
|
|
218
|
-
cancelAnimationFrame(
|
|
238
|
+
const stopAnimation = () => {
|
|
239
|
+
if (requestId !== null) {
|
|
240
|
+
cancelAnimationFrame(requestId);
|
|
241
|
+
requestId = null;
|
|
219
242
|
}
|
|
220
|
-
|
|
243
|
+
previousTime = null;
|
|
244
|
+
};
|
|
221
245
|
|
|
222
246
|
return { startAnimation, stopAnimation };
|
|
223
247
|
}, []);
|