@shohojdhara/atomix 0.3.5 → 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 +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 +61 -66
- package/dist/charts.js.map +1 -1
- package/dist/core.js +47 -31
- package/dist/core.js.map +1 -1
- package/dist/forms.js +47 -31
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +47 -31
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1841 -1633
- package/dist/index.esm.js +4975 -4113
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5151 -4290
- 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 +1572 -1442
- package/dist/theme.js +4816 -4080
- 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 +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/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/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 +2 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +2 -1
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- 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 +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/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} +3 -13
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +52 -111
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +1 -1
- 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 +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +1 -1
- 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
- /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
|
@@ -9,6 +9,7 @@ export { default as Badge, type BadgeProps } from './Badge/Badge';
|
|
|
9
9
|
export { default as Block, type BlockProps } from './Block';
|
|
10
10
|
export { default as Breadcrumb, type BreadcrumbProps } from './Breadcrumb/Breadcrumb';
|
|
11
11
|
export { default as Button, type ButtonProps } from './Button/Button';
|
|
12
|
+
export { default as ButtonGroup, type ButtonGroupProps } from './Button/ButtonGroup';
|
|
12
13
|
export { default as Callout, type CalloutProps } from './Callout/Callout';
|
|
13
14
|
export { default as Card, type CardProps } from './Card/Card';
|
|
14
15
|
// Card sub-components
|
|
@@ -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 {
|
|
@@ -269,20 +269,10 @@ export function useNavDropdown(initialProps?: Partial<NavDropdownProps>) {
|
|
|
269
269
|
return isFixedBottom ? 'CaretUp' : 'CaretDown';
|
|
270
270
|
};
|
|
271
271
|
|
|
272
|
-
// Keeping this for backward compatibility
|
|
273
|
-
const getIconClass = (isMegaMenu: boolean = false): string => {
|
|
274
|
-
console.warn(
|
|
275
|
-
'getIconClass is deprecated. Please use the Icon component directly with the getIconName function.'
|
|
276
|
-
);
|
|
277
|
-
const isFixedBottom = isInFixedBottomNavbar();
|
|
278
|
-
return `c-nav__icon ${isFixedBottom ? 'icon-lux-caret-up' : 'icon-lux-caret-down'}`;
|
|
279
|
-
};
|
|
280
|
-
|
|
281
272
|
return {
|
|
282
273
|
defaultProps,
|
|
283
274
|
generateDropdownMenuClass,
|
|
284
275
|
isInFixedBottomNavbar,
|
|
285
|
-
getIconClass,
|
|
286
276
|
getIconName,
|
|
287
277
|
};
|
|
288
278
|
}
|
package/src/lib/config/loader.ts
CHANGED
|
@@ -19,9 +19,10 @@ import type { AtomixConfig } from './index';
|
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
21
21
|
* import { loadAtomixConfig } from '@shohojdhara/atomix/config';
|
|
22
|
+
* import { createTheme } from '@shohojdhara/atomix/theme';
|
|
22
23
|
*
|
|
23
24
|
* const config = loadAtomixConfig();
|
|
24
|
-
* const theme =
|
|
25
|
+
* const theme = createTheme(config.theme?.tokens || {});
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export function loadAtomixConfig(
|
|
@@ -48,6 +48,16 @@ export const BUTTON = {
|
|
|
48
48
|
},
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
* ButtonGroup-specific constants
|
|
53
|
+
*/
|
|
54
|
+
export const BUTTON_GROUP = {
|
|
55
|
+
BASE_CLASS: 'c-btn-group',
|
|
56
|
+
CLASSES: {
|
|
57
|
+
BASE: 'c-btn-group',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
51
61
|
/**
|
|
52
62
|
* Callout-specific constants
|
|
53
63
|
*/
|
|
@@ -9,7 +9,7 @@ import { useMemo } from 'react';
|
|
|
9
9
|
import { useTheme } from '../theme/runtime/useTheme';
|
|
10
10
|
import type { ComponentPartsMap } from '../types/partProps';
|
|
11
11
|
import type { ComponentCSSVariables } from '../constants/cssVariables';
|
|
12
|
-
import { mergeCSSVars } from '../theme/cssVariableMapper';
|
|
12
|
+
import { mergeCSSVars } from '../theme/adapters/cssVariableMapper';
|
|
13
13
|
import { mergePartStyles } from '../types/partProps';
|
|
14
14
|
import { mergeClassNames } from '../utils/componentUtils';
|
|
15
15
|
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Theme System File Organization
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
|
|
5
|
+
The theme system is organized following senior developer best practices with clear separation of concerns and logical grouping:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
theme/
|
|
9
|
+
├── index.ts # Main public API exports
|
|
10
|
+
├── README.md # This file
|
|
11
|
+
│
|
|
12
|
+
├── core/ # Core theme engine
|
|
13
|
+
│ ├── index.ts
|
|
14
|
+
│ ├── createTheme.ts # Main createTheme function (unified)
|
|
15
|
+
│ ├── createThemeObject.ts # Theme object creation
|
|
16
|
+
│ ├── composeTheme.ts # Theme composition and merging
|
|
17
|
+
│ └── ThemeRegistry.ts # Theme registration and discovery
|
|
18
|
+
│
|
|
19
|
+
├── adapters/ # Adapters and converters
|
|
20
|
+
│ ├── index.ts
|
|
21
|
+
│ ├── themeAdapter.ts # Theme ↔ DesignTokens conversion
|
|
22
|
+
│ └── cssVariableMapper.ts # CSS variable mapping utilities
|
|
23
|
+
│
|
|
24
|
+
├── generators/ # Code generation
|
|
25
|
+
│ ├── index.ts
|
|
26
|
+
│ ├── generateCSS.ts # CSS variable generation (simple)
|
|
27
|
+
│ ├── generateCSSVariables.ts # CSS variable generation (advanced)
|
|
28
|
+
│ └── cssFile.ts # File operations (save CSS to disk)
|
|
29
|
+
│
|
|
30
|
+
├── runtime/ # React runtime components
|
|
31
|
+
│ ├── index.ts
|
|
32
|
+
│ ├── ThemeProvider.tsx # Main theme provider component
|
|
33
|
+
│ ├── ThemeApplicator.ts # Theme application logic
|
|
34
|
+
│ ├── ThemeErrorBoundary.tsx # Error boundary for themes
|
|
35
|
+
│ ├── ThemeContext.tsx # React context for theme management
|
|
36
|
+
│ └── useTheme.ts # React hook for theme access
|
|
37
|
+
│
|
|
38
|
+
├── config/ # Configuration
|
|
39
|
+
│ ├── index.ts
|
|
40
|
+
│ ├── loader.ts # Config file loader
|
|
41
|
+
│ ├── configLoader.ts # Config loading from atomix.config.ts
|
|
42
|
+
│ ├── types.ts # Config type definitions
|
|
43
|
+
│ └── validator.ts # Config validation
|
|
44
|
+
│
|
|
45
|
+
├── utils/ # Utilities
|
|
46
|
+
│ ├── index.ts
|
|
47
|
+
│ ├── themeHelpers.ts # Type guards and DesignTokens utilities
|
|
48
|
+
│ ├── themeUtils.ts # Theme value manipulation (colors, spacing)
|
|
49
|
+
│ ├── domUtils.ts # DOM/browser utilities
|
|
50
|
+
│ └── injectCSS.ts # CSS injection utilities
|
|
51
|
+
│
|
|
52
|
+
├── tokens/ # Design tokens
|
|
53
|
+
│ ├── index.ts
|
|
54
|
+
│ └── tokens.ts # Design tokens definitions
|
|
55
|
+
│
|
|
56
|
+
├── constants/ # Constants
|
|
57
|
+
│ ├── index.ts
|
|
58
|
+
│ └── constants.ts # System constants and default values
|
|
59
|
+
│
|
|
60
|
+
├── errors/ # Error handling
|
|
61
|
+
│ ├── index.ts
|
|
62
|
+
│ └── errors.ts # Error classes and error handling
|
|
63
|
+
│
|
|
64
|
+
├── devtools/ # Development tools
|
|
65
|
+
│ ├── index.ts
|
|
66
|
+
│ ├── CLI.ts # Command-line interface
|
|
67
|
+
│ ├── Comparator.tsx # Theme comparison
|
|
68
|
+
│ ├── Inspector.tsx # Theme inspector
|
|
69
|
+
│ ├── LiveEditor.tsx # Live theme editor
|
|
70
|
+
│ ├── Preview.tsx # Theme preview
|
|
71
|
+
│ ├── ThemeValidator.tsx # Theme validation component
|
|
72
|
+
│ └── README.md # DevTools documentation
|
|
73
|
+
│
|
|
74
|
+
├── i18n/ # Internationalization
|
|
75
|
+
│ ├── index.ts
|
|
76
|
+
│ └── rtl.ts # Right-to-left language support
|
|
77
|
+
│
|
|
78
|
+
└── types.ts # TypeScript type definitions (root level)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Naming Conventions
|
|
82
|
+
|
|
83
|
+
### Files and Directories
|
|
84
|
+
|
|
85
|
+
1. **React Components**: Always use PascalCase (e.g., `ThemeProvider.tsx`)
|
|
86
|
+
2. **Feature Modules**: Use camelCase with descriptive names (e.g., `themeAdapter.ts`)
|
|
87
|
+
3. **Base Utilities**: Use lowercase for foundational utilities (e.g., `domUtils.ts`, `types.ts`)
|
|
88
|
+
4. **Directories**: Use lowercase, plural for collections (e.g., `utils/`, `adapters/`)
|
|
89
|
+
5. **Index Files**: Each subdirectory has an `index.ts` for clean exports
|
|
90
|
+
|
|
91
|
+
### Import Patterns
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
// ✅ CORRECT - Import from organized directories
|
|
95
|
+
import { createTheme } from './core';
|
|
96
|
+
import { themeToDesignTokens } from './adapters';
|
|
97
|
+
import { generateCSSVariables } from './generators';
|
|
98
|
+
import { isDesignTokens } from './utils/themeHelpers';
|
|
99
|
+
|
|
100
|
+
// ❌ INCORRECT - Direct imports from root (old structure)
|
|
101
|
+
import { createTheme } from './core';
|
|
102
|
+
import { themeToDesignTokens } from './themeAdapter';
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## File Organization Principles
|
|
106
|
+
|
|
107
|
+
1. **Separation of Concerns**: Each directory has a single, well-defined responsibility
|
|
108
|
+
2. **Logical Grouping**: Related functionality is grouped together
|
|
109
|
+
3. **Clear Entry Points**: Each directory has an `index.ts` for clean exports
|
|
110
|
+
4. **Consistent Naming**: Follow established naming conventions throughout
|
|
111
|
+
5. **Maintainability**: Structure makes it easy to find and modify code
|
|
112
|
+
|
|
113
|
+
## Directory Responsibilities
|
|
114
|
+
|
|
115
|
+
### `/core` - Core Theme Engine
|
|
116
|
+
- Theme creation and composition
|
|
117
|
+
- Theme registry and discovery
|
|
118
|
+
- Core theme logic
|
|
119
|
+
|
|
120
|
+
### `/adapters` - Adapters and Converters
|
|
121
|
+
- Convert between Theme objects and DesignTokens
|
|
122
|
+
- CSS variable mapping utilities
|
|
123
|
+
- Format transformations
|
|
124
|
+
|
|
125
|
+
### `/generators` - Code Generation
|
|
126
|
+
- CSS variable generation
|
|
127
|
+
- File operations (save CSS to disk)
|
|
128
|
+
- Code generation utilities
|
|
129
|
+
|
|
130
|
+
### `/runtime` - React Runtime
|
|
131
|
+
- React components (ThemeProvider, ThemeErrorBoundary)
|
|
132
|
+
- React hooks (useTheme)
|
|
133
|
+
- Theme application logic
|
|
134
|
+
- React context
|
|
135
|
+
|
|
136
|
+
### `/config` - Configuration
|
|
137
|
+
- Config file loading
|
|
138
|
+
- Config validation
|
|
139
|
+
- Configuration types
|
|
140
|
+
|
|
141
|
+
### `/utils` - Utilities
|
|
142
|
+
- Theme helpers and type guards
|
|
143
|
+
- Theme value manipulation
|
|
144
|
+
- DOM/browser utilities
|
|
145
|
+
- CSS injection
|
|
146
|
+
|
|
147
|
+
### `/tokens` - Design Tokens
|
|
148
|
+
- Design token definitions
|
|
149
|
+
- Token creation utilities
|
|
150
|
+
|
|
151
|
+
### `/constants` - Constants
|
|
152
|
+
- System constants
|
|
153
|
+
- Default values
|
|
154
|
+
|
|
155
|
+
### `/errors` - Error Handling
|
|
156
|
+
- Error classes
|
|
157
|
+
- Error handling utilities
|
|
158
|
+
|
|
159
|
+
### `/devtools` - Development Tools
|
|
160
|
+
- Development and debugging tools
|
|
161
|
+
- Theme inspection and validation
|
|
162
|
+
- Live editing capabilities
|
|
163
|
+
|
|
164
|
+
### `/i18n` - Internationalization
|
|
165
|
+
- RTL (Right-to-Left) support
|
|
166
|
+
- Internationalization utilities
|
|
167
|
+
|
|
168
|
+
## Best Practices
|
|
169
|
+
|
|
170
|
+
1. **Always use index files**: Import from directory index files when possible
|
|
171
|
+
2. **Group related functionality**: Keep related code together
|
|
172
|
+
3. **Maintain clear boundaries**: Don't mix concerns between directories
|
|
173
|
+
4. **Follow naming conventions**: Consistency is key
|
|
174
|
+
5. **Document changes**: Update this README when structure changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Adapters
|
|
3
|
+
*
|
|
4
|
+
* Adapters for converting between Theme objects and DesignTokens
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
themeToDesignTokens,
|
|
9
|
+
designTokensToCSSVars,
|
|
10
|
+
createDesignTokensFromTheme,
|
|
11
|
+
designTokensToTheme,
|
|
12
|
+
} from './themeAdapter';
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
generateCSSVariableName,
|
|
16
|
+
generateComponentCSSVars,
|
|
17
|
+
mapSCSSTokensToCSSVars,
|
|
18
|
+
applyCSSVariables,
|
|
19
|
+
removeCSSVariables,
|
|
20
|
+
getCSSVariable,
|
|
21
|
+
cssVarsToStyle,
|
|
22
|
+
mergeCSSVars,
|
|
23
|
+
isValidCSSVariableName,
|
|
24
|
+
extractComponentName,
|
|
25
|
+
} from './cssVariableMapper';
|
|
26
|
+
|
|
27
|
+
export type {
|
|
28
|
+
CSSVariableConfig,
|
|
29
|
+
CSSVariableNamingOptions,
|
|
30
|
+
} from './cssVariableMapper';
|
|
31
|
+
|