@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.9 → 0.2.10
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/CHANGELOG.md +1 -1
- package/dist/components/ui/accessibility-demo.esm.js +30 -24
- package/dist/components/ui/accessibility-demo.js +30 -24
- package/dist/components/ui/advanced-component-architecture-demo.esm.js +235 -179
- package/dist/components/ui/advanced-component-architecture-demo.js +235 -179
- package/dist/components/ui/advanced-transition-system-demo.esm.js +110 -64
- package/dist/components/ui/advanced-transition-system-demo.js +110 -64
- package/dist/components/ui/advanced-transition-system.esm.js +166 -122
- package/dist/components/ui/advanced-transition-system.js +166 -122
- package/dist/components/ui/animation/animated-container.esm.js +52 -29
- package/dist/components/ui/animation/animated-container.js +52 -29
- package/dist/components/ui/animation/staggered-container.esm.js +18 -9
- package/dist/components/ui/animation/staggered-container.js +18 -9
- package/dist/components/ui/animation-demo.esm.js +67 -35
- package/dist/components/ui/animation-demo.js +67 -35
- package/dist/components/ui/badge.esm.js +9 -6
- package/dist/components/ui/badge.js +9 -6
- package/dist/components/ui/battery-conscious-animation-demo.esm.js +122 -87
- package/dist/components/ui/battery-conscious-animation-demo.js +122 -87
- package/dist/components/ui/border-radius-shadow-demo.esm.js +23 -12
- package/dist/components/ui/border-radius-shadow-demo.js +23 -12
- package/dist/components/ui/button.esm.js +8 -2
- package/dist/components/ui/button.js +8 -2
- package/dist/components/ui/card.esm.js +33 -8
- package/dist/components/ui/card.js +33 -8
- package/dist/components/ui/checkbox.esm.js +3 -3
- package/dist/components/ui/checkbox.js +3 -3
- package/dist/components/ui/color-preview.esm.js +68 -45
- package/dist/components/ui/color-preview.js +68 -45
- package/dist/components/ui/data-display/chart.esm.js +112 -84
- package/dist/components/ui/data-display/chart.js +112 -84
- package/dist/components/ui/data-display/data-grid-simple.esm.js +1 -1
- package/dist/components/ui/data-display/data-grid-simple.js +1 -1
- package/dist/components/ui/data-display/data-grid.esm.js +80 -67
- package/dist/components/ui/data-display/data-grid.js +80 -67
- package/dist/components/ui/data-display/list.esm.js +53 -45
- package/dist/components/ui/data-display/list.js +53 -45
- package/dist/components/ui/data-display/table.esm.js +62 -54
- package/dist/components/ui/data-display/table.js +62 -54
- package/dist/components/ui/data-display/timeline.esm.js +39 -34
- package/dist/components/ui/data-display/timeline.js +39 -34
- package/dist/components/ui/data-display/tree.esm.js +116 -84
- package/dist/components/ui/data-display/tree.js +116 -84
- package/dist/components/ui/data-display/types.esm.js +389 -364
- package/dist/components/ui/data-display/types.js +389 -364
- package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +120 -70
- package/dist/components/ui/enterprise-mobile-experience-demo.js +120 -70
- package/dist/components/ui/enterprise-mobile-experience.esm.js +124 -73
- package/dist/components/ui/enterprise-mobile-experience.js +124 -73
- package/dist/components/ui/feedback/alert.esm.js +22 -15
- package/dist/components/ui/feedback/alert.js +22 -15
- package/dist/components/ui/feedback/progress.esm.js +47 -24
- package/dist/components/ui/feedback/progress.js +47 -24
- package/dist/components/ui/feedback/skeleton.esm.js +39 -29
- package/dist/components/ui/feedback/skeleton.js +39 -29
- package/dist/components/ui/feedback/toast.esm.js +62 -38
- package/dist/components/ui/feedback/toast.js +62 -38
- package/dist/components/ui/feedback/types.esm.js +83 -83
- package/dist/components/ui/feedback/types.js +83 -83
- package/dist/components/ui/font-preview.esm.js +41 -39
- package/dist/components/ui/font-preview.js +41 -39
- package/dist/components/ui/form-demo.esm.js +150 -113
- package/dist/components/ui/form-demo.js +150 -113
- package/dist/components/ui/hardware-acceleration-demo.esm.js +137 -87
- package/dist/components/ui/hardware-acceleration-demo.js +137 -87
- package/dist/components/ui/input.esm.js +4 -1
- package/dist/components/ui/input.js +4 -1
- package/dist/components/ui/layout-demo.esm.js +81 -56
- package/dist/components/ui/layout-demo.js +81 -56
- package/dist/components/ui/layouts/adaptive-layout.esm.js +27 -8
- package/dist/components/ui/layouts/adaptive-layout.js +27 -8
- package/dist/components/ui/layouts/desktop-layout.esm.js +39 -19
- package/dist/components/ui/layouts/desktop-layout.js +39 -19
- package/dist/components/ui/layouts/mobile-layout.esm.js +19 -9
- package/dist/components/ui/layouts/mobile-layout.js +19 -9
- package/dist/components/ui/layouts/tablet-layout.esm.js +28 -14
- package/dist/components/ui/layouts/tablet-layout.js +28 -14
- package/dist/components/ui/mobile-form-validation.esm.js +120 -87
- package/dist/components/ui/mobile-form-validation.js +120 -87
- package/dist/components/ui/mobile-input-demo.esm.js +19 -13
- package/dist/components/ui/mobile-input-demo.js +19 -13
- package/dist/components/ui/mobile-input.esm.js +185 -120
- package/dist/components/ui/mobile-input.js +185 -120
- package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +128 -111
- package/dist/components/ui/mobile-skeleton-loading-demo.js +128 -111
- package/dist/components/ui/navigation/breadcrumb.esm.js +17 -14
- package/dist/components/ui/navigation/breadcrumb.js +17 -14
- package/dist/components/ui/navigation/index.esm.js +23 -1
- package/dist/components/ui/navigation/index.js +23 -1
- package/dist/components/ui/navigation/menu.esm.js +49 -35
- package/dist/components/ui/navigation/menu.js +49 -35
- package/dist/components/ui/navigation/navigation-demo.esm.js +81 -74
- package/dist/components/ui/navigation/navigation-demo.js +81 -74
- package/dist/components/ui/navigation/pagination.esm.js +62 -50
- package/dist/components/ui/navigation/pagination.js +62 -50
- package/dist/components/ui/navigation/sidebar.esm.js +56 -42
- package/dist/components/ui/navigation/sidebar.js +56 -42
- package/dist/components/ui/navigation/stepper.esm.js +34 -23
- package/dist/components/ui/navigation/stepper.js +34 -23
- package/dist/components/ui/navigation/tabs.esm.js +32 -21
- package/dist/components/ui/navigation/tabs.js +32 -21
- package/dist/components/ui/navigation/types.esm.js +196 -195
- package/dist/components/ui/navigation/types.js +196 -195
- package/dist/components/ui/overlay/backdrop.esm.js +17 -16
- package/dist/components/ui/overlay/backdrop.js +17 -16
- package/dist/components/ui/overlay/focus-manager.esm.js +21 -19
- package/dist/components/ui/overlay/focus-manager.js +21 -19
- package/dist/components/ui/overlay/index.esm.js +22 -2
- package/dist/components/ui/overlay/index.js +22 -2
- package/dist/components/ui/overlay/modal.esm.js +38 -34
- package/dist/components/ui/overlay/modal.js +38 -34
- package/dist/components/ui/overlay/overlay-manager.esm.js +25 -20
- package/dist/components/ui/overlay/overlay-manager.js +25 -20
- package/dist/components/ui/overlay/popover.esm.js +74 -58
- package/dist/components/ui/overlay/popover.js +74 -58
- package/dist/components/ui/overlay/portal.esm.js +7 -7
- package/dist/components/ui/overlay/portal.js +7 -7
- package/dist/components/ui/overlay/tooltip.esm.js +54 -39
- package/dist/components/ui/overlay/tooltip.js +54 -39
- package/dist/components/ui/overlay/types.esm.js +132 -131
- package/dist/components/ui/overlay/types.js +132 -131
- package/dist/components/ui/performance-demo.esm.js +135 -88
- package/dist/components/ui/performance-demo.js +135 -88
- package/dist/components/ui/semantic-input-system-demo.esm.js +117 -80
- package/dist/components/ui/semantic-input-system-demo.js +117 -80
- package/dist/components/ui/theme-customizer.esm.js +84 -52
- package/dist/components/ui/theme-customizer.js +84 -52
- package/dist/components/ui/theme-preview.esm.js +95 -43
- package/dist/components/ui/theme-preview.js +95 -43
- package/dist/components/ui/theme-switcher.esm.js +70 -44
- package/dist/components/ui/theme-switcher.js +70 -44
- package/dist/components/ui/theme-toggle.esm.js +3 -3
- package/dist/components/ui/theme-toggle.js +3 -3
- package/dist/components/ui/token-demo.esm.js +33 -21
- package/dist/components/ui/token-demo.js +33 -21
- package/dist/components/ui/touch-demo.esm.js +102 -73
- package/dist/components/ui/touch-demo.js +102 -73
- package/dist/components/ui/touch-friendly-interface-demo.esm.js +102 -64
- package/dist/components/ui/touch-friendly-interface-demo.js +102 -64
- package/dist/components/ui/touch-friendly-interface.esm.js +85 -61
- package/dist/components/ui/touch-friendly-interface.js +85 -61
- package/dist/hooks/use-accessibility-support.esm.js +115 -85
- package/dist/hooks/use-accessibility-support.js +115 -85
- package/dist/hooks/use-adaptive-layout.esm.js +56 -33
- package/dist/hooks/use-adaptive-layout.js +56 -33
- package/dist/hooks/use-advanced-patterns.esm.js +57 -42
- package/dist/hooks/use-advanced-patterns.js +57 -42
- package/dist/hooks/use-advanced-transition-system.esm.js +112 -71
- package/dist/hooks/use-advanced-transition-system.js +112 -71
- package/dist/hooks/use-animation-profile.esm.js +63 -34
- package/dist/hooks/use-animation-profile.js +63 -34
- package/dist/hooks/use-battery-animations.esm.js +80 -55
- package/dist/hooks/use-battery-animations.js +80 -55
- package/dist/hooks/use-battery-conscious-loading.esm.js +166 -123
- package/dist/hooks/use-battery-conscious-loading.js +166 -123
- package/dist/hooks/use-battery-optimization.esm.js +78 -55
- package/dist/hooks/use-battery-optimization.js +78 -55
- package/dist/hooks/use-battery-status.esm.js +73 -51
- package/dist/hooks/use-battery-status.js +73 -51
- package/dist/hooks/use-component-performance.esm.js +62 -47
- package/dist/hooks/use-component-performance.js +62 -47
- package/dist/hooks/use-device-loading-states.esm.js +152 -109
- package/dist/hooks/use-device-loading-states.js +152 -109
- package/dist/hooks/use-device.esm.js +25 -14
- package/dist/hooks/use-device.js +25 -14
- package/dist/hooks/use-enterprise-mobile-experience.esm.js +137 -88
- package/dist/hooks/use-enterprise-mobile-experience.js +137 -88
- package/dist/hooks/use-form-feedback.esm.js +124 -81
- package/dist/hooks/use-form-feedback.js +124 -81
- package/dist/hooks/use-form-performance.esm.js +127 -92
- package/dist/hooks/use-form-performance.js +127 -92
- package/dist/hooks/use-frame-rate.esm.js +56 -37
- package/dist/hooks/use-frame-rate.js +56 -37
- package/dist/hooks/use-gestures.esm.js +96 -72
- package/dist/hooks/use-gestures.js +96 -72
- package/dist/hooks/use-hardware-acceleration.esm.js +65 -37
- package/dist/hooks/use-hardware-acceleration.js +65 -37
- package/dist/hooks/use-input-accessibility.esm.js +157 -119
- package/dist/hooks/use-input-accessibility.js +157 -119
- package/dist/hooks/use-input-performance.esm.js +139 -104
- package/dist/hooks/use-input-performance.js +139 -104
- package/dist/hooks/use-layout-performance.esm.js +50 -29
- package/dist/hooks/use-layout-performance.js +50 -29
- package/dist/hooks/use-loading-accessibility.esm.js +209 -169
- package/dist/hooks/use-loading-accessibility.js +209 -169
- package/dist/hooks/use-loading-performance.esm.js +117 -93
- package/dist/hooks/use-loading-performance.js +117 -93
- package/dist/hooks/use-memory-usage.esm.js +57 -38
- package/dist/hooks/use-memory-usage.js +57 -38
- package/dist/hooks/use-mobile-form-layout.esm.js +111 -74
- package/dist/hooks/use-mobile-form-layout.js +111 -74
- package/dist/hooks/use-mobile-form-validation.esm.js +211 -144
- package/dist/hooks/use-mobile-form-validation.js +211 -144
- package/dist/hooks/use-mobile-keyboard-optimization.esm.js +154 -113
- package/dist/hooks/use-mobile-keyboard-optimization.js +154 -113
- package/dist/hooks/use-mobile-layout.esm.js +73 -51
- package/dist/hooks/use-mobile-layout.js +73 -51
- package/dist/hooks/use-mobile-optimization.esm.js +72 -44
- package/dist/hooks/use-mobile-optimization.js +72 -44
- package/dist/hooks/use-mobile-skeleton.esm.js +97 -64
- package/dist/hooks/use-mobile-skeleton.js +97 -64
- package/dist/hooks/use-mobile-touch.esm.js +128 -93
- package/dist/hooks/use-mobile-touch.js +128 -93
- package/dist/hooks/use-performance-throttling.esm.js +72 -48
- package/dist/hooks/use-performance-throttling.js +72 -48
- package/dist/hooks/use-performance.esm.js +90 -52
- package/dist/hooks/use-performance.js +90 -52
- package/dist/hooks/use-reusable-architecture.esm.js +94 -65
- package/dist/hooks/use-reusable-architecture.js +94 -65
- package/dist/hooks/use-semantic-input-types.esm.js +166 -124
- package/dist/hooks/use-semantic-input-types.js +166 -124
- package/dist/hooks/use-semantic-input.esm.js +178 -126
- package/dist/hooks/use-semantic-input.js +178 -126
- package/dist/hooks/use-tablet-layout.esm.js +67 -38
- package/dist/hooks/use-tablet-layout.js +67 -38
- package/dist/hooks/use-touch-friendly-input.esm.js +193 -149
- package/dist/hooks/use-touch-friendly-input.js +193 -149
- package/dist/hooks/use-touch-friendly-interface.esm.js +99 -67
- package/dist/hooks/use-touch-friendly-interface.js +99 -67
- package/dist/hooks/use-touch-optimization.esm.js +99 -72
- package/dist/hooks/use-touch-optimization.js +99 -72
- package/dist/index.esm.js +289 -280
- package/dist/index.js +289 -280
- package/dist/lib/utils.esm.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/plugins/theme-css-generator.esm.js +104 -55
- package/dist/plugins/theme-css-generator.js +104 -55
- package/dist/provider.esm.js +4 -4
- package/dist/provider.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/theme.esm.js +633 -468
- package/dist/theme.js +633 -468
- package/dist/themes/ThemeContext.esm.js +15 -15
- package/dist/themes/ThemeContext.js +15 -15
- package/dist/themes/ThemeProvider.esm.js +25 -22
- package/dist/themes/ThemeProvider.js +25 -22
- package/dist/themes/accessibility.esm.js +147 -108
- package/dist/themes/accessibility.js +147 -108
- package/dist/themes/aria-patterns.esm.js +198 -162
- package/dist/themes/aria-patterns.js +198 -162
- package/dist/themes/base-themes.esm.js +14 -11
- package/dist/themes/base-themes.js +14 -11
- package/dist/themes/colorManager.esm.js +101 -83
- package/dist/themes/colorManager.js +101 -83
- package/dist/themes/examples/dark-theme.esm.js +133 -103
- package/dist/themes/examples/dark-theme.js +133 -103
- package/dist/themes/examples/minimal-theme.esm.js +83 -61
- package/dist/themes/examples/minimal-theme.js +83 -61
- package/dist/themes/focus-management.esm.js +202 -143
- package/dist/themes/focus-management.js +202 -143
- package/dist/themes/fontLoader.esm.js +28 -19
- package/dist/themes/fontLoader.js +28 -19
- package/dist/themes/high-contrast.esm.js +152 -104
- package/dist/themes/high-contrast.js +152 -104
- package/dist/themes/inheritance.esm.js +35 -27
- package/dist/themes/inheritance.js +35 -27
- package/dist/themes/keyboard-navigation.esm.js +152 -123
- package/dist/themes/keyboard-navigation.js +152 -123
- package/dist/themes/motion-reduction.esm.js +193 -133
- package/dist/themes/motion-reduction.js +193 -133
- package/dist/themes/navigation.esm.js +146 -146
- package/dist/themes/navigation.js +146 -146
- package/dist/themes/screen-reader.esm.js +159 -94
- package/dist/themes/screen-reader.js +159 -94
- package/dist/themes/systemThemeDetector.esm.js +42 -34
- package/dist/themes/systemThemeDetector.js +42 -34
- package/dist/themes/themeCSSUpdater.esm.js +21 -9
- package/dist/themes/themeCSSUpdater.js +21 -9
- package/dist/themes/themePersistence.esm.js +68 -47
- package/dist/themes/themePersistence.js +68 -47
- package/dist/themes/themes/stan-design.esm.js +633 -468
- package/dist/themes/themes/stan-design.js +633 -468
- package/dist/themes/types.esm.js +301 -287
- package/dist/themes/types.js +301 -287
- package/dist/themes/useSystemTheme.esm.js +4 -4
- package/dist/themes/useSystemTheme.js +4 -4
- package/dist/themes/useTheme.esm.js +4 -4
- package/dist/themes/useTheme.js +4 -4
- package/dist/themes/validation.esm.js +128 -77
- package/dist/themes/validation.js +128 -77
- package/dist/tokens/index.esm.js +15 -4
- package/dist/tokens/index.js +15 -4
- package/dist/tokens/tokenExporter.esm.js +87 -61
- package/dist/tokens/tokenExporter.js +87 -61
- package/dist/tokens/tokenGenerator.esm.js +86 -77
- package/dist/tokens/tokenGenerator.js +86 -77
- package/dist/tokens/tokenManager.esm.js +64 -51
- package/dist/tokens/tokenManager.js +64 -51
- package/dist/tokens/tokenValidator.esm.js +193 -147
- package/dist/tokens/tokenValidator.js +193 -147
- package/dist/tokens/types.esm.js +49 -35
- package/dist/tokens/types.js +49 -35
- package/dist/utils/bundle-analyzer.esm.js +83 -65
- package/dist/utils/bundle-analyzer.js +83 -65
- package/dist/utils/bundle-splitting.esm.js +142 -117
- package/dist/utils/bundle-splitting.js +142 -117
- package/dist/utils/lazy-loading.esm.js +132 -106
- package/dist/utils/lazy-loading.js +132 -106
- package/dist/utils/performance-monitor.esm.js +170 -129
- package/dist/utils/performance-monitor.js +170 -129
- package/dist/utils/tree-shaking.esm.js +69 -61
- package/dist/utils/tree-shaking.js +69 -61
- package/package.json +1 -1
- package/src/index.ts +146 -146
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from './types';
|
|
7
7
|
|
|
8
8
|
// Simple icon components (inline SVG)
|
|
9
|
-
const BarChartIcon}> = ({ className = 'w-4 h-4' }) => (
|
|
9
|
+
const BarChartIcon: React.FC<{ className?: string }> = ({ className = 'w-4 h-4' }) => (
|
|
10
10
|
<svg
|
|
11
11
|
className={className}
|
|
12
12
|
fill="none"
|
|
@@ -17,7 +17,7 @@ const BarChartIcon}> = ({ className = 'w-4 h-4' }) => (
|
|
|
17
17
|
</svg>
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
const LineChartIcon}> = ({ className = 'w-4 h-4' }) => (
|
|
20
|
+
const LineChartIcon: React.FC<{ className?: string }> = ({ className = 'w-4 h-4' }) => (
|
|
21
21
|
<svg
|
|
22
22
|
className={className}
|
|
23
23
|
fill="none"
|
|
@@ -29,7 +29,7 @@ const LineChartIcon}> = ({ className = 'w-4 h-4' }) => (
|
|
|
29
29
|
</svg>
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
const PieChartIcon}> = ({ className = 'w-4 h-4' }) => (
|
|
32
|
+
const PieChartIcon: React.FC<{ className?: string }> = ({ className = 'w-4 h-4' }) => (
|
|
33
33
|
<svg
|
|
34
34
|
className={className}
|
|
35
35
|
fill="none"
|
|
@@ -43,30 +43,38 @@ const PieChartIcon}> = ({ className = 'w-4 h-4' }) => (
|
|
|
43
43
|
|
|
44
44
|
// Default color fallbacks for when theme is not available
|
|
45
45
|
const getDefaultColors = () => ({
|
|
46
|
-
surface
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
surface: {
|
|
47
|
+
background: '#ffffff',
|
|
48
|
+
surface: '#f3f4f6',
|
|
49
|
+
border: '#d1d5db',
|
|
50
|
+
divider: '#e5e7eb'
|
|
51
|
+
},
|
|
52
|
+
text: {
|
|
53
|
+
primary: '#111827',
|
|
54
|
+
secondary: '#6b7280',
|
|
55
|
+
muted: '#9ca3af',
|
|
56
|
+
inverse: '#ffffff',
|
|
57
|
+
onPrimary: '#ffffff',
|
|
58
|
+
onSecondary: '#ffffff',
|
|
59
|
+
onSurface: '#111827'
|
|
60
|
+
},
|
|
61
|
+
interactive: {
|
|
62
|
+
hover: '#f3f4f6',
|
|
63
|
+
active: '#e5e7eb',
|
|
64
|
+
focus: '#3b82f6',
|
|
65
|
+
disabled: '#d1d5db'
|
|
66
|
+
},
|
|
67
|
+
primary: { 500: '#3b82f6' },
|
|
68
|
+
semantic: {
|
|
69
|
+
success: '#10b981',
|
|
70
|
+
warning: '#f59e0b',
|
|
71
|
+
error: '#ef4444',
|
|
72
|
+
info: '#3b82f6'
|
|
73
|
+
}
|
|
66
74
|
});
|
|
67
75
|
|
|
68
76
|
// Chart color palette
|
|
69
|
-
const getChartColors = (colors) => [
|
|
77
|
+
const getChartColors = (colors: any) => [
|
|
70
78
|
colors.primary[500],
|
|
71
79
|
colors.semantic.success,
|
|
72
80
|
colors.semantic.warning,
|
|
@@ -80,21 +88,24 @@ const getChartColors = (colors) => [
|
|
|
80
88
|
];
|
|
81
89
|
|
|
82
90
|
// Chart Legend Component
|
|
83
|
-
const ChartLegend
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
const ChartLegend: React.FC<{
|
|
92
|
+
datasets: ChartData['datasets'];
|
|
93
|
+
colors: any;
|
|
94
|
+
size: 'sm' | 'md' | 'lg';
|
|
86
95
|
}> = ({ datasets, colors, size }) => {
|
|
87
96
|
const chartColors = getChartColors(colors);
|
|
88
97
|
|
|
89
98
|
const sizeClasses = {
|
|
90
|
-
sm,
|
|
91
|
-
md,
|
|
92
|
-
lg
|
|
99
|
+
sm: 'chart__legend--sm',
|
|
100
|
+
md: 'chart__legend--md',
|
|
101
|
+
lg: 'chart__legend--lg'
|
|
102
|
+
};
|
|
93
103
|
|
|
94
104
|
const dotSizes = {
|
|
95
|
-
sm,
|
|
96
|
-
md,
|
|
97
|
-
lg
|
|
105
|
+
sm: 'chart__legend-color--sm',
|
|
106
|
+
md: 'chart__legend-color--md',
|
|
107
|
+
lg: 'chart__legend-color--lg'
|
|
108
|
+
};
|
|
98
109
|
|
|
99
110
|
return (
|
|
100
111
|
<div className={`chart__legend ${sizeClasses[size]}`}>
|
|
@@ -103,7 +114,7 @@ const ChartLegend];
|
|
|
103
114
|
<div
|
|
104
115
|
className={`chart__legend-color ${dotSizes[size]}`}
|
|
105
116
|
style={{
|
|
106
|
-
backgroundColor]
|
|
117
|
+
backgroundColor: dataset.color || chartColors[index % chartColors.length]
|
|
107
118
|
}}
|
|
108
119
|
/>
|
|
109
120
|
<span className="chart__legend-label">
|
|
@@ -116,12 +127,13 @@ const ChartLegend];
|
|
|
116
127
|
};
|
|
117
128
|
|
|
118
129
|
// Simple Bar Chart Component
|
|
119
|
-
const BarChart
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
const BarChart: React.FC<{
|
|
131
|
+
data: ChartData;
|
|
132
|
+
width: number;
|
|
133
|
+
height: number;
|
|
134
|
+
colors: any;
|
|
135
|
+
showValues?: boolean;
|
|
136
|
+
animate?: boolean;
|
|
125
137
|
}> = ({ data, width, height, colors, showValues = false, animate = false }) => {
|
|
126
138
|
const chartColors = getChartColors(colors);
|
|
127
139
|
const padding = 60;
|
|
@@ -131,7 +143,7 @@ const BarChart;
|
|
|
131
143
|
// Calculate max value for scaling
|
|
132
144
|
const maxValue = useMemo(() => {
|
|
133
145
|
const allValues = data.datasets.flatMap(dataset =>
|
|
134
|
-
dataset.data.map(point => typeof point === 'number' ? point )
|
|
146
|
+
dataset.data.map(point => typeof point === 'number' ? point : point.y)
|
|
135
147
|
);
|
|
136
148
|
return Math.max(...allValues, 0);
|
|
137
149
|
}, [data]);
|
|
@@ -140,7 +152,7 @@ const BarChart;
|
|
|
140
152
|
const groupWidth = chartWidth / data.labels.length;
|
|
141
153
|
|
|
142
154
|
return (
|
|
143
|
-
<svg width={width} height={height} style={{ background}}>
|
|
155
|
+
<svg width={width} height={height} style={{ background: colors.surface.background }}>
|
|
144
156
|
{/* Grid lines */}
|
|
145
157
|
{[0, 0.25, 0.5, 0.75, 1].map((percent, index) => {
|
|
146
158
|
const y = padding + chartHeight * (1 - percent);
|
|
@@ -153,7 +165,7 @@ const BarChart;
|
|
|
153
165
|
y2={y}
|
|
154
166
|
stroke={colors.surface.border}
|
|
155
167
|
strokeWidth={1}
|
|
156
|
-
strokeDasharray={percent === 0 ? '0' ,2'}
|
|
168
|
+
strokeDasharray={percent === 0 ? '0' : '2,2'}
|
|
157
169
|
/>
|
|
158
170
|
<text
|
|
159
171
|
x={padding - 10}
|
|
@@ -172,7 +184,7 @@ const BarChart;
|
|
|
172
184
|
{data.datasets.map((dataset, datasetIndex) => (
|
|
173
185
|
<g key={datasetIndex}>
|
|
174
186
|
{dataset.data.map((value, pointIndex) => {
|
|
175
|
-
const numericValue = typeof value === 'number' ? value ;
|
|
187
|
+
const numericValue = typeof value === 'number' ? value : value.y;
|
|
176
188
|
const barHeight = (numericValue / maxValue) * chartHeight;
|
|
177
189
|
const x = padding + pointIndex * groupWidth + datasetIndex * barWidth;
|
|
178
190
|
const y = padding + chartHeight - barHeight;
|
|
@@ -182,9 +194,9 @@ const BarChart;
|
|
|
182
194
|
<g key={pointIndex}>
|
|
183
195
|
<rect
|
|
184
196
|
x={x}
|
|
185
|
-
y={animate ? padding + chartHeight }
|
|
197
|
+
y={animate ? padding + chartHeight : y}
|
|
186
198
|
width={barWidth * 0.8}
|
|
187
|
-
height={animate ? 0 }
|
|
199
|
+
height={animate ? 0 : barHeight}
|
|
188
200
|
fill={color}
|
|
189
201
|
rx={2}
|
|
190
202
|
>
|
|
@@ -246,12 +258,13 @@ const BarChart;
|
|
|
246
258
|
};
|
|
247
259
|
|
|
248
260
|
// Simple Line Chart Component
|
|
249
|
-
const LineChart
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
261
|
+
const LineChart: React.FC<{
|
|
262
|
+
data: ChartData;
|
|
263
|
+
width: number;
|
|
264
|
+
height: number;
|
|
265
|
+
colors: any;
|
|
266
|
+
showPoints?: boolean;
|
|
267
|
+
animate?: boolean;
|
|
255
268
|
}> = ({ data, width, height, colors, showPoints = true, animate = false }) => {
|
|
256
269
|
const chartColors = getChartColors(colors);
|
|
257
270
|
const padding = 60;
|
|
@@ -261,13 +274,13 @@ const LineChart;
|
|
|
261
274
|
// Calculate max value for scaling
|
|
262
275
|
const maxValue = useMemo(() => {
|
|
263
276
|
const allValues = data.datasets.flatMap(dataset =>
|
|
264
|
-
dataset.data.map(point => typeof point === 'number' ? point )
|
|
277
|
+
dataset.data.map(point => typeof point === 'number' ? point : point.y)
|
|
265
278
|
);
|
|
266
279
|
return Math.max(...allValues, 0);
|
|
267
280
|
}, [data]);
|
|
268
281
|
|
|
269
282
|
return (
|
|
270
|
-
<svg width={width} height={height} style={{ background}}>
|
|
283
|
+
<svg width={width} height={height} style={{ background: colors.surface.background }}>
|
|
271
284
|
{/* Grid lines */}
|
|
272
285
|
{[0, 0.25, 0.5, 0.75, 1].map((percent, index) => {
|
|
273
286
|
const y = padding + chartHeight * (1 - percent);
|
|
@@ -280,7 +293,7 @@ const LineChart;
|
|
|
280
293
|
y2={y}
|
|
281
294
|
stroke={colors.surface.border}
|
|
282
295
|
strokeWidth={1}
|
|
283
|
-
strokeDasharray={percent === 0 ? '0' ,2'}
|
|
296
|
+
strokeDasharray={percent === 0 ? '0' : '2,2'}
|
|
284
297
|
/>
|
|
285
298
|
<text
|
|
286
299
|
x={padding - 10}
|
|
@@ -299,15 +312,15 @@ const LineChart;
|
|
|
299
312
|
{data.datasets.map((dataset, datasetIndex) => {
|
|
300
313
|
const color = dataset.color || chartColors[datasetIndex % chartColors.length];
|
|
301
314
|
const points = dataset.data.map((value, index) => {
|
|
302
|
-
const numericValue = typeof value === 'number' ? value ;
|
|
315
|
+
const numericValue = typeof value === 'number' ? value : value.y;
|
|
303
316
|
const x = padding + (index / (data.labels.length - 1)) * chartWidth;
|
|
304
317
|
const y = padding + chartHeight - (numericValue / maxValue) * chartHeight;
|
|
305
|
-
return { x, y, value};
|
|
318
|
+
return { x, y, value: numericValue };
|
|
306
319
|
});
|
|
307
320
|
|
|
308
321
|
// Create path for line
|
|
309
322
|
const pathData = points.reduce((path, point, index) => {
|
|
310
|
-
const command = index === 0 ? 'M' ;
|
|
323
|
+
const command = index === 0 ? 'M' : 'L';
|
|
311
324
|
return `${path} ${command} ${point.x} ${point.y}`;
|
|
312
325
|
}, '');
|
|
313
326
|
|
|
@@ -378,12 +391,13 @@ const LineChart;
|
|
|
378
391
|
};
|
|
379
392
|
|
|
380
393
|
// Simple Pie Chart Component
|
|
381
|
-
const PieChart
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
394
|
+
const PieChart: React.FC<{
|
|
395
|
+
data: ChartData;
|
|
396
|
+
width: number;
|
|
397
|
+
height: number;
|
|
398
|
+
colors: any;
|
|
399
|
+
showLabels?: boolean;
|
|
400
|
+
animate?: boolean;
|
|
387
401
|
}> = ({ data, width, height, colors, showLabels = true, animate = false }) => {
|
|
388
402
|
const chartColors = getChartColors(colors);
|
|
389
403
|
const centerX = width / 2;
|
|
@@ -392,7 +406,7 @@ const PieChart;
|
|
|
392
406
|
|
|
393
407
|
// Calculate total value and angles
|
|
394
408
|
const dataset = data.datasets[0];
|
|
395
|
-
const values = dataset?.data.map(point => typeof point === 'number' ? point ) || [];
|
|
409
|
+
const values = dataset?.data.map(point => typeof point === 'number' ? point : point.y) || [];
|
|
396
410
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
397
411
|
|
|
398
412
|
let currentAngle = -Math.PI / 2; // Start at top
|
|
@@ -409,7 +423,7 @@ const PieChart;
|
|
|
409
423
|
const x2 = centerX + radius * Math.cos(endAngle);
|
|
410
424
|
const y2 = centerY + radius * Math.sin(endAngle);
|
|
411
425
|
|
|
412
|
-
const largeArc = angle > Math.PI ? 1 ;
|
|
426
|
+
const largeArc = angle > Math.PI ? 1 : 0;
|
|
413
427
|
const pathData = `M ${centerX} ${centerY} L ${x1} ${y1} A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2} Z`;
|
|
414
428
|
|
|
415
429
|
// Label position
|
|
@@ -419,17 +433,17 @@ const PieChart;
|
|
|
419
433
|
|
|
420
434
|
return {
|
|
421
435
|
pathData,
|
|
422
|
-
color],
|
|
423
|
-
label],
|
|
436
|
+
color: chartColors[index % chartColors.length],
|
|
437
|
+
label: data.labels[index],
|
|
424
438
|
value,
|
|
425
|
-
percentage),
|
|
439
|
+
percentage: Math.round(percentage * 100),
|
|
426
440
|
labelX,
|
|
427
441
|
labelY
|
|
428
442
|
};
|
|
429
443
|
});
|
|
430
444
|
|
|
431
445
|
return (
|
|
432
|
-
<svg width={width} height={height} style={{ background}}>
|
|
446
|
+
<svg width={width} height={height} style={{ background: colors.surface.background }}>
|
|
433
447
|
{segments.map((segment, index) => (
|
|
434
448
|
<g key={index}>
|
|
435
449
|
{/* Pie segment */}
|
|
@@ -481,7 +495,7 @@ const PieChart;
|
|
|
481
495
|
};
|
|
482
496
|
|
|
483
497
|
// Main Chart Component
|
|
484
|
-
export const Chart= ({
|
|
498
|
+
export const Chart: React.FC<ChartProps> = ({
|
|
485
499
|
type = 'bar',
|
|
486
500
|
data,
|
|
487
501
|
options = {},
|
|
@@ -508,21 +522,28 @@ export const Chart= ({
|
|
|
508
522
|
// Calculate responsive dimensions
|
|
509
523
|
const dimensions = useMemo(() => {
|
|
510
524
|
if (typeof width === 'number') {
|
|
511
|
-
return { width, height=== 'number' ? height };
|
|
525
|
+
return { width, height: typeof height === 'number' ? height : 400 };
|
|
512
526
|
}
|
|
513
527
|
|
|
514
528
|
// For responsive width, we'll use a default and let CSS handle it
|
|
515
529
|
return {
|
|
516
|
-
width,
|
|
517
|
-
height=== 'number' ? height
|
|
530
|
+
width: 600,
|
|
531
|
+
height: typeof height === 'number' ? height : 400
|
|
532
|
+
};
|
|
518
533
|
}, [width, height]);
|
|
519
534
|
|
|
520
535
|
// Chart type icon
|
|
521
536
|
const getChartIcon = () => {
|
|
522
537
|
switch (type) {
|
|
523
|
-
case 'line'
|
|
524
|
-
case '
|
|
525
|
-
|
|
538
|
+
case 'line':
|
|
539
|
+
case 'area':
|
|
540
|
+
return <LineChartIcon className="chart__icon" />;
|
|
541
|
+
case 'pie':
|
|
542
|
+
case 'doughnut':
|
|
543
|
+
return <PieChartIcon className="chart__icon" />;
|
|
544
|
+
case 'bar':
|
|
545
|
+
default:
|
|
546
|
+
return <BarChartIcon className="chart__icon" />;
|
|
526
547
|
}
|
|
527
548
|
};
|
|
528
549
|
|
|
@@ -530,17 +551,23 @@ export const Chart= ({
|
|
|
530
551
|
const renderChart = () => {
|
|
531
552
|
const chartProps = {
|
|
532
553
|
data,
|
|
533
|
-
width,
|
|
534
|
-
height,
|
|
554
|
+
width: dimensions.width,
|
|
555
|
+
height: dimensions.height,
|
|
535
556
|
colors,
|
|
536
557
|
animate,
|
|
537
558
|
...options
|
|
538
559
|
};
|
|
539
560
|
|
|
540
561
|
switch (type) {
|
|
541
|
-
case 'line'
|
|
542
|
-
case '
|
|
543
|
-
|
|
562
|
+
case 'line':
|
|
563
|
+
case 'area':
|
|
564
|
+
return <LineChart {...chartProps} showPoints={options.showPoints} />;
|
|
565
|
+
case 'pie':
|
|
566
|
+
case 'doughnut':
|
|
567
|
+
return <PieChart {...chartProps} showLabels={options.showLabels} />;
|
|
568
|
+
case 'bar':
|
|
569
|
+
default:
|
|
570
|
+
return <BarChart {...chartProps} showValues={showValues} />;
|
|
544
571
|
}
|
|
545
572
|
};
|
|
546
573
|
|
|
@@ -604,8 +631,9 @@ export const Chart= ({
|
|
|
604
631
|
<div
|
|
605
632
|
className="chart__canvas"
|
|
606
633
|
style={{
|
|
607
|
-
width=== 'string' ? width }px`,
|
|
608
|
-
maxWidth
|
|
634
|
+
width: typeof width === 'string' ? width : `${width}px`,
|
|
635
|
+
maxWidth: '100%'
|
|
636
|
+
}}
|
|
609
637
|
>
|
|
610
638
|
{renderChart()}
|
|
611
639
|
</div>
|