@shohojdhara/atomix 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +260 -179
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +250 -179
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.js +69 -166
- package/dist/charts.js.map +1 -1
- package/dist/core.js +184 -263
- package/dist/core.js.map +1 -1
- package/dist/forms.js +55 -131
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +184 -263
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +1831 -1657
- package/dist/index.esm.js +4497 -4318
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +4510 -4328
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/theme.d.ts +1431 -1472
- package/dist/theme.js +4175 -4138
- package/dist/theme.js.map +1 -1
- package/package.json +6 -20
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/AtomixGlass/AtomixGlass.tsx +128 -322
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +12 -5
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/Button.tsx +85 -167
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Chart/AnimatedChart.tsx +0 -1
- package/src/components/Chart/AreaChart.tsx +0 -1
- package/src/components/Chart/BarChart.tsx +0 -1
- package/src/components/Chart/BubbleChart.tsx +0 -1
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +0 -1
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +0 -1
- package/src/components/Chart/ScatterChart.tsx +0 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -1
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +7 -0
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +83 -3
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +1 -0
- package/src/lib/composables/useAtomixGlass.ts +9 -10
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/config/loader.ts +4 -4
- package/src/lib/constants/components.ts +17 -0
- package/src/lib/hooks/useComponentCustomization.ts +1 -1
- package/src/lib/hooks/usePerformanceMonitor.ts +1 -1
- package/src/lib/hooks/useThemeTokens.ts +105 -0
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +95 -0
- package/src/lib/theme/config/loader.ts +37 -54
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +1 -19
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +75 -266
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +105 -0
- package/src/lib/theme/core/createTheme.ts +108 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +12 -8
- package/src/lib/theme/core/index.ts +19 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/{errors.ts → errors/errors.ts} +1 -1
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/generators/generateCSSNested.ts +130 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
- package/src/lib/theme/generators/index.ts +25 -0
- package/src/lib/theme/i18n/rtl.ts +5 -6
- package/src/lib/theme/index.ts +149 -19
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -112
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +5 -5
- package/src/lib/theme/runtime/ThemeProvider.tsx +266 -282
- package/src/lib/theme/runtime/index.ts +2 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/runtime/useThemeTokens.ts +131 -0
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/utils/componentTheming.ts +132 -0
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/naming.ts +100 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +7 -7
- package/src/lib/theme-tools.ts +7 -8
- package/src/lib/types/components.ts +40 -130
- package/src/lib/utils/componentUtils.ts +2 -2
- package/src/lib/utils/memoryMonitor.ts +3 -3
- package/src/lib/utils/themeNaming.ts +135 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/sync-theme-config.js +0 -309
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -665
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -446
- package/src/styles/03-generic/_generated-root.css +0 -26
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -68
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
|
@@ -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
|
|
@@ -309,14 +309,14 @@ export function useAtomixGlass({
|
|
|
309
309
|
// timestamp: new Date().toISOString(),
|
|
310
310
|
// });
|
|
311
311
|
// }
|
|
312
|
-
} else if (process.env
|
|
312
|
+
} else if ((typeof process === 'undefined' || process.env?.NODE_ENV !== 'production') && debugCornerRadius) {
|
|
313
313
|
// console.log(
|
|
314
314
|
// '[AtomixGlass] No corner radius found, using default:',
|
|
315
315
|
// CONSTANTS.DEFAULT_CORNER_RADIUS
|
|
316
316
|
// );
|
|
317
317
|
}
|
|
318
318
|
} catch (error) {
|
|
319
|
-
if (process.env
|
|
319
|
+
if ((typeof process === 'undefined' || process.env?.NODE_ENV !== 'production') && debugCornerRadius) {
|
|
320
320
|
console.error('[AtomixGlass] Error extracting corner radius:', error);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
@@ -412,7 +412,7 @@ export function useAtomixGlass({
|
|
|
412
412
|
}
|
|
413
413
|
} catch (styleError) {
|
|
414
414
|
// Silently continue if getting computed style fails for this element
|
|
415
|
-
if (process.env
|
|
415
|
+
if (typeof process === 'undefined' || process.env?.NODE_ENV === 'development') {
|
|
416
416
|
console.debug('AtomixGlass: Error getting computed style for element:', styleError);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
@@ -484,7 +484,7 @@ export function useAtomixGlass({
|
|
|
484
484
|
}
|
|
485
485
|
} catch (error) {
|
|
486
486
|
// Enhanced error logging with context
|
|
487
|
-
if (process.env
|
|
487
|
+
if (typeof process === 'undefined' || process.env?.NODE_ENV === 'development') {
|
|
488
488
|
console.warn('AtomixGlass: Error detecting background brightness:', error);
|
|
489
489
|
}
|
|
490
490
|
const result = false;
|
|
@@ -607,7 +607,7 @@ export function useAtomixGlass({
|
|
|
607
607
|
setInternalMouseOffset(newOffset);
|
|
608
608
|
setInternalGlobalMousePosition(globalPos);
|
|
609
609
|
|
|
610
|
-
if (process.env
|
|
610
|
+
if ((typeof process === 'undefined' || process.env?.NODE_ENV !== 'production') && enablePerformanceMonitoring) {
|
|
611
611
|
const endTime = performance.now();
|
|
612
612
|
const duration = endTime - startTime;
|
|
613
613
|
// if (duration > 5) {
|
|
@@ -964,7 +964,7 @@ export function useAtomixGlass({
|
|
|
964
964
|
};
|
|
965
965
|
|
|
966
966
|
// Debug logging
|
|
967
|
-
if (process.env
|
|
967
|
+
if ((typeof process === 'undefined' || process.env?.NODE_ENV !== 'production') && debugOverLight) {
|
|
968
968
|
console.log('[AtomixGlass] OverLight Config:', {
|
|
969
969
|
isOverLight,
|
|
970
970
|
config: {
|
|
@@ -996,7 +996,7 @@ export function useAtomixGlass({
|
|
|
996
996
|
}
|
|
997
997
|
|
|
998
998
|
// Debug logging for non-object configs
|
|
999
|
-
if (process.env
|
|
999
|
+
if ((typeof process === 'undefined' || process.env?.NODE_ENV !== 'production') && debugOverLight) {
|
|
1000
1000
|
console.log('[AtomixGlass] OverLight Config:', {
|
|
1001
1001
|
isOverLight,
|
|
1002
1002
|
configType: typeof overLight === 'boolean' ? (overLight ? 'true' : 'false') : overLight,
|
|
@@ -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(
|
|
@@ -45,7 +46,7 @@ export function loadAtomixConfig(
|
|
|
45
46
|
// In browser environments, config loading is not supported
|
|
46
47
|
if (typeof window !== 'undefined') {
|
|
47
48
|
if (required) {
|
|
48
|
-
throw new Error('
|
|
49
|
+
throw new Error('loadAtomixConfig: Not available in browser environment. Config loading requires Node.js/SSR environment.');
|
|
49
50
|
}
|
|
50
51
|
return defaultConfig;
|
|
51
52
|
}
|
|
@@ -143,5 +144,4 @@ export function resolveConfigPath(): string | null {
|
|
|
143
144
|
return null;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
export default loadAtomixConfig;
|
|
147
|
-
|
|
147
|
+
export default loadAtomixConfig;
|
|
@@ -32,6 +32,13 @@ export const CLASS_PREFIX = {
|
|
|
32
32
|
/**
|
|
33
33
|
* Button-specific constants
|
|
34
34
|
*/
|
|
35
|
+
export const THEME_NAMING = {
|
|
36
|
+
BUTTON_PREFIX: 'btn',
|
|
37
|
+
ICON_ELEMENT: 'icon',
|
|
38
|
+
LABEL_ELEMENT: 'label',
|
|
39
|
+
SPINNER_ELEMENT: 'spinner',
|
|
40
|
+
};
|
|
41
|
+
|
|
35
42
|
export const BUTTON = {
|
|
36
43
|
BASE_CLASS: 'c-btn',
|
|
37
44
|
ICON_CLASS: 'c-btn__icon',
|
|
@@ -48,6 +55,16 @@ export const BUTTON = {
|
|
|
48
55
|
},
|
|
49
56
|
};
|
|
50
57
|
|
|
58
|
+
/**
|
|
59
|
+
* ButtonGroup-specific constants
|
|
60
|
+
*/
|
|
61
|
+
export const BUTTON_GROUP = {
|
|
62
|
+
BASE_CLASS: 'c-btn-group',
|
|
63
|
+
CLASSES: {
|
|
64
|
+
BASE: 'c-btn-group',
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
51
68
|
/**
|
|
52
69
|
* Callout-specific constants
|
|
53
70
|
*/
|
|
@@ -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
|
|
|
@@ -77,7 +77,7 @@ export interface UsePerformanceMonitorOptions {
|
|
|
77
77
|
export function usePerformanceMonitor(options: UsePerformanceMonitorOptions) {
|
|
78
78
|
const {
|
|
79
79
|
componentName,
|
|
80
|
-
logToConsole = process.env
|
|
80
|
+
logToConsole = (typeof process === 'undefined' || process.env?.NODE_ENV === 'development'),
|
|
81
81
|
warnThreshold = 16,
|
|
82
82
|
onMetrics,
|
|
83
83
|
} = options;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ThemeContext } from '../theme/runtime/ThemeContext';
|
|
3
|
+
import { useTheme } from '../theme/runtime/useTheme';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Standardized hook for accessing theme tokens in components
|
|
7
|
+
*
|
|
8
|
+
* Provides consistent access to theme values across all components
|
|
9
|
+
* using either CSS custom properties or theme object values.
|
|
10
|
+
*/
|
|
11
|
+
export function useThemeTokens() {
|
|
12
|
+
const { theme, activeTheme } = useTheme();
|
|
13
|
+
|
|
14
|
+
// Helper function to get CSS variable value
|
|
15
|
+
const getToken = useCallback((tokenName: string, fallback?: string) => {
|
|
16
|
+
if (typeof window === 'undefined') return fallback || '';
|
|
17
|
+
|
|
18
|
+
const cssVarName = `--atomix-${tokenName}`;
|
|
19
|
+
const computedStyle = getComputedStyle(document.documentElement);
|
|
20
|
+
return computedStyle.getPropertyValue(cssVarName).trim() || fallback || '';
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
// Helper function to get theme object value
|
|
24
|
+
const getThemeValue = useCallback((path: string, fallback?: any) => {
|
|
25
|
+
if (!activeTheme) return fallback;
|
|
26
|
+
|
|
27
|
+
// Navigate through nested theme object using dot notation
|
|
28
|
+
return path.split('.').reduce((obj, key) => obj?.[key], activeTheme) || fallback;
|
|
29
|
+
}, [activeTheme]);
|
|
30
|
+
|
|
31
|
+
// Return unified API for accessing theme values
|
|
32
|
+
return {
|
|
33
|
+
theme,
|
|
34
|
+
activeTheme,
|
|
35
|
+
getToken,
|
|
36
|
+
getThemeValue,
|
|
37
|
+
// Commonly used tokens with fallbacks
|
|
38
|
+
colors: {
|
|
39
|
+
primary: getToken('primary', '#3b82f6'),
|
|
40
|
+
secondary: getToken('secondary', '#10b981'),
|
|
41
|
+
error: getToken('error', '#ef4444'),
|
|
42
|
+
success: getToken('success', '#22c55e'),
|
|
43
|
+
warning: getToken('warning', '#eab308'),
|
|
44
|
+
info: getToken('info', '#3b82f6'),
|
|
45
|
+
light: getToken('light', '#f9fafb'),
|
|
46
|
+
dark: getToken('dark', '#111827'),
|
|
47
|
+
},
|
|
48
|
+
spacing: {
|
|
49
|
+
1: getToken('spacing-1', '0.25rem'),
|
|
50
|
+
2: getToken('spacing-2', '0.5rem'),
|
|
51
|
+
3: getToken('spacing-3', '0.75rem'),
|
|
52
|
+
4: getToken('spacing-4', '1rem'),
|
|
53
|
+
5: getToken('spacing-5', '1.25rem'),
|
|
54
|
+
6: getToken('spacing-6', '1.5rem'),
|
|
55
|
+
8: getToken('spacing-8', '2rem'),
|
|
56
|
+
10: getToken('spacing-10', '2.5rem'),
|
|
57
|
+
12: getToken('spacing-12', '3rem'),
|
|
58
|
+
16: getToken('spacing-16', '4rem'),
|
|
59
|
+
20: getToken('spacing-20', '5rem'),
|
|
60
|
+
},
|
|
61
|
+
borderRadius: {
|
|
62
|
+
sm: getToken('border-radius-sm', '0.25rem'),
|
|
63
|
+
md: getToken('border-radius-md', '0.5rem'),
|
|
64
|
+
lg: getToken('border-radius-lg', '0.75rem'),
|
|
65
|
+
xl: getToken('border-radius-xl', '1rem'),
|
|
66
|
+
full: getToken('border-radius-full', '9999px'),
|
|
67
|
+
},
|
|
68
|
+
typography: {
|
|
69
|
+
fontFamily: {
|
|
70
|
+
sans: getToken('font-sans-serif', 'Inter, system-ui, sans-serif'),
|
|
71
|
+
serif: getToken('font-serif', 'Georgia, serif'),
|
|
72
|
+
mono: getToken('font-monospace', 'Fira Code, monospace'),
|
|
73
|
+
},
|
|
74
|
+
fontSize: {
|
|
75
|
+
xs: getToken('font-size-xs', '0.75rem'),
|
|
76
|
+
sm: getToken('font-size-sm', '0.875rem'),
|
|
77
|
+
md: getToken('font-size-md', '1rem'),
|
|
78
|
+
lg: getToken('font-size-lg', '1.125rem'),
|
|
79
|
+
xl: getToken('font-size-xl', '1.25rem'),
|
|
80
|
+
'2xl': getToken('font-size-2xl', '1.5rem'),
|
|
81
|
+
'3xl': getToken('font-size-3xl', '1.875rem'),
|
|
82
|
+
'4xl': getToken('font-size-4xl', '2.25rem'),
|
|
83
|
+
},
|
|
84
|
+
fontWeight: {
|
|
85
|
+
light: getToken('font-weight-light', '300'),
|
|
86
|
+
normal: getToken('font-weight-normal', '400'),
|
|
87
|
+
medium: getToken('font-weight-medium', '500'),
|
|
88
|
+
semibold: getToken('font-weight-semibold', '600'),
|
|
89
|
+
bold: getToken('font-weight-bold', '700'),
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
shadows: {
|
|
93
|
+
sm: getToken('box-shadow-sm', '0 1px 2px 0 rgba(0, 0, 0, 0.05)'),
|
|
94
|
+
md: getToken('box-shadow-md', '0 4px 6px -1px rgba(0, 0, 0, 0.1)'),
|
|
95
|
+
lg: getToken('box-shadow-lg', '0 10px 15px -3px rgba(0, 0, 0, 0.1)'),
|
|
96
|
+
xl: getToken('box-shadow-xl', '0 20px 25px -5px rgba(0, 0, 0, 0.1)'),
|
|
97
|
+
inset: getToken('box-shadow-inset', 'inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)'),
|
|
98
|
+
},
|
|
99
|
+
transitions: {
|
|
100
|
+
fast: getToken('transition-fast', '150ms'),
|
|
101
|
+
base: getToken('transition-base', '200ms'),
|
|
102
|
+
slow: getToken('transition-slow', '300ms'),
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|