@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
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from './types';
|
|
12
12
|
|
|
13
13
|
// SVG Icons
|
|
14
|
-
const XMarkIcon}> = ({ className = 'w-5 h-5' }) => (
|
|
14
|
+
const XMarkIcon: React.FC<{ className?: string }> = ({ className = 'w-5 h-5' }) => (
|
|
15
15
|
<svg className={className} fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor">
|
|
16
16
|
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
|
|
17
17
|
</svg>
|
|
@@ -19,19 +19,19 @@ const XMarkIcon}> = ({ className = 'w-5 h-5' }) => (
|
|
|
19
19
|
|
|
20
20
|
// Default color fallbacks
|
|
21
21
|
const getDefaultColors = () => ({
|
|
22
|
-
surface, surface, border, divider},
|
|
23
|
-
text, secondary, muted, inverse},
|
|
24
|
-
interactive, active, focus, disabled},
|
|
25
|
-
primary, 600},
|
|
26
|
-
semantic, warning, error, info}
|
|
22
|
+
surface: { background: '#ffffff', surface: '#f9fafb', border: '#e5e7eb', divider: '#e5e7eb' },
|
|
23
|
+
text: { primary: '#111827', secondary: '#6b7280', muted: '#9ca3af', inverse: '#ffffff' },
|
|
24
|
+
interactive: { hover: '#f3f4f6', active: '#e5e7eb', focus: '#3b82f6', disabled: '#d1d5db' },
|
|
25
|
+
primary: { 500: '#3b82f6', 600: '#2563eb' },
|
|
26
|
+
semantic: { success: '#10b981', warning: '#f59e0b', error: '#ef4444', info: '#3b82f6' }
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
// Position calculations utility (similar to tooltip but adjusted for larger content)
|
|
30
30
|
const calculatePosition = (
|
|
31
|
-
triggerRect,
|
|
32
|
-
popoverRect,
|
|
33
|
-
position] = 'bottom',
|
|
34
|
-
offset= 8
|
|
31
|
+
triggerRect: DOMRect,
|
|
32
|
+
popoverRect: DOMRect,
|
|
33
|
+
position: PopoverProps['position'] = 'bottom',
|
|
34
|
+
offset: number = 8
|
|
35
35
|
) => {
|
|
36
36
|
const scrollX = window.scrollX || document.documentElement.scrollLeft;
|
|
37
37
|
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
@@ -44,40 +44,52 @@ const calculatePosition = (
|
|
|
44
44
|
const triggerCenterY = triggerRect.top + triggerRect.height / 2;
|
|
45
45
|
|
|
46
46
|
switch (position) {
|
|
47
|
-
case 'top'
|
|
47
|
+
case 'top':
|
|
48
|
+
top = triggerRect.top - popoverRect.height - offset;
|
|
48
49
|
left = triggerCenterX - popoverRect.width / 2;
|
|
49
50
|
break;
|
|
50
|
-
case 'top-start'
|
|
51
|
+
case 'top-start':
|
|
52
|
+
top = triggerRect.top - popoverRect.height - offset;
|
|
51
53
|
left = triggerRect.left;
|
|
52
54
|
break;
|
|
53
|
-
case 'top-end'
|
|
55
|
+
case 'top-end':
|
|
56
|
+
top = triggerRect.top - popoverRect.height - offset;
|
|
54
57
|
left = triggerRect.right - popoverRect.width;
|
|
55
58
|
break;
|
|
56
|
-
case 'bottom'
|
|
59
|
+
case 'bottom':
|
|
60
|
+
top = triggerRect.bottom + offset;
|
|
57
61
|
left = triggerCenterX - popoverRect.width / 2;
|
|
58
62
|
break;
|
|
59
|
-
case 'bottom-start'
|
|
63
|
+
case 'bottom-start':
|
|
64
|
+
top = triggerRect.bottom + offset;
|
|
60
65
|
left = triggerRect.left;
|
|
61
66
|
break;
|
|
62
|
-
case 'bottom-end'
|
|
67
|
+
case 'bottom-end':
|
|
68
|
+
top = triggerRect.bottom + offset;
|
|
63
69
|
left = triggerRect.right - popoverRect.width;
|
|
64
70
|
break;
|
|
65
|
-
case 'left'
|
|
71
|
+
case 'left':
|
|
72
|
+
top = triggerCenterY - popoverRect.height / 2;
|
|
66
73
|
left = triggerRect.left - popoverRect.width - offset;
|
|
67
74
|
break;
|
|
68
|
-
case 'left-start'
|
|
75
|
+
case 'left-start':
|
|
76
|
+
top = triggerRect.top;
|
|
69
77
|
left = triggerRect.left - popoverRect.width - offset;
|
|
70
78
|
break;
|
|
71
|
-
case 'left-end'
|
|
79
|
+
case 'left-end':
|
|
80
|
+
top = triggerRect.bottom - popoverRect.height;
|
|
72
81
|
left = triggerRect.left - popoverRect.width - offset;
|
|
73
82
|
break;
|
|
74
|
-
case 'right'
|
|
83
|
+
case 'right':
|
|
84
|
+
top = triggerCenterY - popoverRect.height / 2;
|
|
75
85
|
left = triggerRect.right + offset;
|
|
76
86
|
break;
|
|
77
|
-
case 'right-start'
|
|
87
|
+
case 'right-start':
|
|
88
|
+
top = triggerRect.top;
|
|
78
89
|
left = triggerRect.right + offset;
|
|
79
90
|
break;
|
|
80
|
-
case 'right-end'
|
|
91
|
+
case 'right-end':
|
|
92
|
+
top = triggerRect.bottom - popoverRect.height;
|
|
81
93
|
left = triggerRect.right + offset;
|
|
82
94
|
break;
|
|
83
95
|
}
|
|
@@ -101,14 +113,16 @@ const calculatePosition = (
|
|
|
101
113
|
}
|
|
102
114
|
|
|
103
115
|
return {
|
|
104
|
-
top,
|
|
105
|
-
left
|
|
116
|
+
top: top + scrollY,
|
|
117
|
+
left: left + scrollX
|
|
118
|
+
};
|
|
106
119
|
};
|
|
107
120
|
|
|
108
121
|
// Arrow component for popovers
|
|
109
|
-
const PopoverArrow
|
|
110
|
-
|
|
111
|
-
|
|
122
|
+
const PopoverArrow: React.FC<{
|
|
123
|
+
position: PopoverProps['position'];
|
|
124
|
+
colors: any;
|
|
125
|
+
className?: string;
|
|
112
126
|
}> = ({ className = '' }) => {
|
|
113
127
|
return (
|
|
114
128
|
<div className={`popover__arrow ${className}`} />
|
|
@@ -116,7 +130,7 @@ const PopoverArrow];
|
|
|
116
130
|
};
|
|
117
131
|
|
|
118
132
|
// Popover Content Component
|
|
119
|
-
export const PopoverContent= ({
|
|
133
|
+
export const PopoverContent: React.FC<PopoverContentProps> = ({
|
|
120
134
|
children,
|
|
121
135
|
className = '',
|
|
122
136
|
style = {}
|
|
@@ -129,7 +143,7 @@ export const PopoverContent= ({
|
|
|
129
143
|
};
|
|
130
144
|
|
|
131
145
|
// Popover Header Component
|
|
132
|
-
export const PopoverHeader= ({
|
|
146
|
+
export const PopoverHeader: React.FC<PopoverHeaderProps> = ({
|
|
133
147
|
title,
|
|
134
148
|
subtitle,
|
|
135
149
|
onClose,
|
|
@@ -142,8 +156,8 @@ export const PopoverHeader= ({
|
|
|
142
156
|
}) => {
|
|
143
157
|
const headerClasses = [
|
|
144
158
|
'popover__header',
|
|
145
|
-
borderless ? 'popover__header--borderless' ,
|
|
146
|
-
noPadding ? 'popover__header--no-padding' ,
|
|
159
|
+
borderless ? 'popover__header--borderless' : '',
|
|
160
|
+
noPadding ? 'popover__header--no-padding' : '',
|
|
147
161
|
className
|
|
148
162
|
].filter(Boolean).join(' ');
|
|
149
163
|
|
|
@@ -178,7 +192,7 @@ export const PopoverHeader= ({
|
|
|
178
192
|
};
|
|
179
193
|
|
|
180
194
|
// Popover Body Component
|
|
181
|
-
export const PopoverBody= ({
|
|
195
|
+
export const PopoverBody: React.FC<PopoverBodyProps> = ({
|
|
182
196
|
children,
|
|
183
197
|
className = '',
|
|
184
198
|
padding = 'md',
|
|
@@ -187,17 +201,17 @@ export const PopoverBody= ({
|
|
|
187
201
|
}) => {
|
|
188
202
|
const bodyClasses = [
|
|
189
203
|
'popover__body',
|
|
190
|
-
padding === 'none' ? 'popover__body--no-padding' ,
|
|
191
|
-
padding === 'sm' ? 'popover__body--compact' ,
|
|
192
|
-
padding === 'lg' ? 'popover__body--spacious' ,
|
|
193
|
-
scrollable ? 'popover__body--scrollable' ,
|
|
204
|
+
padding === 'none' ? 'popover__body--no-padding' : '',
|
|
205
|
+
padding === 'sm' ? 'popover__body--compact' : '',
|
|
206
|
+
padding === 'lg' ? 'popover__body--spacious' : '',
|
|
207
|
+
scrollable ? 'popover__body--scrollable' : '',
|
|
194
208
|
className
|
|
195
209
|
].filter(Boolean).join(' ');
|
|
196
210
|
|
|
197
211
|
return (
|
|
198
212
|
<div
|
|
199
213
|
className={bodyClasses}
|
|
200
|
-
style={{ maxHeight}}
|
|
214
|
+
style={{ maxHeight: scrollable ? maxHeight : undefined }}
|
|
201
215
|
>
|
|
202
216
|
{children}
|
|
203
217
|
</div>
|
|
@@ -205,7 +219,7 @@ export const PopoverBody= ({
|
|
|
205
219
|
};
|
|
206
220
|
|
|
207
221
|
// Popover Footer Component
|
|
208
|
-
export const PopoverFooter= ({
|
|
222
|
+
export const PopoverFooter: React.FC<PopoverFooterProps> = ({
|
|
209
223
|
children,
|
|
210
224
|
className = '',
|
|
211
225
|
justify = 'end',
|
|
@@ -214,11 +228,11 @@ export const PopoverFooter= ({
|
|
|
214
228
|
}) => {
|
|
215
229
|
const footerClasses = [
|
|
216
230
|
'popover__footer',
|
|
217
|
-
!borderTop ? 'popover__footer--borderless' ,
|
|
218
|
-
padding === 'none' ? 'popover__footer--no-padding' ,
|
|
219
|
-
justify === 'start' ? 'popover__footer--start' ,
|
|
220
|
-
justify === 'center' ? 'popover__footer--center' ,
|
|
221
|
-
justify === 'between' ? 'popover__footer--space-between' ,
|
|
231
|
+
!borderTop ? 'popover__footer--borderless' : '',
|
|
232
|
+
padding === 'none' ? 'popover__footer--no-padding' : '',
|
|
233
|
+
justify === 'start' ? 'popover__footer--start' : '',
|
|
234
|
+
justify === 'center' ? 'popover__footer--center' : '',
|
|
235
|
+
justify === 'between' ? 'popover__footer--space-between' : '',
|
|
222
236
|
className
|
|
223
237
|
].filter(Boolean).join(' ');
|
|
224
238
|
|
|
@@ -230,10 +244,10 @@ export const PopoverFooter= ({
|
|
|
230
244
|
};
|
|
231
245
|
|
|
232
246
|
// Main Popover Component
|
|
233
|
-
export const Popover= ({
|
|
247
|
+
export const Popover: React.FC<PopoverProps> = ({
|
|
234
248
|
trigger,
|
|
235
249
|
children,
|
|
236
|
-
isOpen,
|
|
250
|
+
isOpen: controlledIsOpen,
|
|
237
251
|
onOpenChange,
|
|
238
252
|
position = 'bottom',
|
|
239
253
|
triggerType = 'click',
|
|
@@ -255,7 +269,7 @@ export const Popover= ({
|
|
|
255
269
|
const colors = themeConfig?.colors || getDefaultColors();
|
|
256
270
|
|
|
257
271
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
258
|
-
const [popoverPosition, setPopoverPosition] = useState({ top, left});
|
|
272
|
+
const [popoverPosition, setPopoverPosition] = useState({ top: 0, left: 0 });
|
|
259
273
|
|
|
260
274
|
const triggerRef = useRef<HTMLElement>(null);
|
|
261
275
|
const popoverRef = useRef<HTMLDivElement>(null);
|
|
@@ -264,7 +278,7 @@ export const Popover= ({
|
|
|
264
278
|
const isOpen = controlledIsOpen ?? internalIsOpen;
|
|
265
279
|
|
|
266
280
|
// Handle open/close state changes
|
|
267
|
-
const handleOpenChange = useCallback((open) => {
|
|
281
|
+
const handleOpenChange = useCallback((open: boolean) => {
|
|
268
282
|
if (controlledIsOpen === undefined) {
|
|
269
283
|
setInternalIsOpen(open);
|
|
270
284
|
}
|
|
@@ -309,7 +323,7 @@ export const Popover= ({
|
|
|
309
323
|
useEffect(() => {
|
|
310
324
|
if (!isOpen || !closeOnEscape) return;
|
|
311
325
|
|
|
312
|
-
const handleEscape = (event) => {
|
|
326
|
+
const handleEscape = (event: KeyboardEvent) => {
|
|
313
327
|
if (event.key === 'Escape') {
|
|
314
328
|
hidePopover();
|
|
315
329
|
}
|
|
@@ -323,7 +337,7 @@ export const Popover= ({
|
|
|
323
337
|
useEffect(() => {
|
|
324
338
|
if (!isOpen || !closeOnBlur) return;
|
|
325
339
|
|
|
326
|
-
const handleClickOutside = (event) => {
|
|
340
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
327
341
|
const target = event.target as Node;
|
|
328
342
|
|
|
329
343
|
if (
|
|
@@ -370,9 +384,9 @@ export const Popover= ({
|
|
|
370
384
|
const getContentClasses = () => {
|
|
371
385
|
const classes = [
|
|
372
386
|
'popover__content',
|
|
373
|
-
size ? `popover__content--size-${size}` ,
|
|
374
|
-
variant ? `popover__content--variant-${variant}` ,
|
|
375
|
-
position ? `popover__content--position-${position}` ,
|
|
387
|
+
size ? `popover__content--size-${size}` : '',
|
|
388
|
+
variant ? `popover__content--variant-${variant}` : '',
|
|
389
|
+
position ? `popover__content--position-${position}` : '',
|
|
376
390
|
className
|
|
377
391
|
];
|
|
378
392
|
|
|
@@ -386,7 +400,7 @@ export const Popover= ({
|
|
|
386
400
|
|
|
387
401
|
// Create trigger event handlers
|
|
388
402
|
const getTriggerProps = () => {
|
|
389
|
-
const props= {};
|
|
403
|
+
const props: any = {};
|
|
390
404
|
|
|
391
405
|
if (triggerType === 'hover') {
|
|
392
406
|
props.onMouseEnter = showPopover;
|
|
@@ -404,7 +418,8 @@ export const Popover= ({
|
|
|
404
418
|
// Clone trigger element with event handlers
|
|
405
419
|
const triggerElement = cloneElement(trigger, {
|
|
406
420
|
...getTriggerProps(),
|
|
407
|
-
ref
|
|
421
|
+
ref: triggerRef
|
|
422
|
+
});
|
|
408
423
|
|
|
409
424
|
return (
|
|
410
425
|
<>
|
|
@@ -424,11 +439,12 @@ export const Popover= ({
|
|
|
424
439
|
className={getContentClasses()}
|
|
425
440
|
style={{
|
|
426
441
|
...popoverPosition,
|
|
427
|
-
maxWidth=== 'number' ? `${maxWidth}px` ,
|
|
442
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,
|
|
428
443
|
zIndex,
|
|
429
|
-
backgroundColor,
|
|
430
|
-
borderColor,
|
|
431
|
-
color
|
|
444
|
+
backgroundColor: colors.surface.background,
|
|
445
|
+
borderColor: colors.surface.border,
|
|
446
|
+
color: colors.text.primary
|
|
447
|
+
}}
|
|
432
448
|
>
|
|
433
449
|
{children}
|
|
434
450
|
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { PortalProps } from './types';
|
|
4
4
|
|
|
5
|
-
export const Portal= ({
|
|
5
|
+
export const Portal: React.FC<PortalProps> = ({
|
|
6
6
|
children,
|
|
7
7
|
container,
|
|
8
8
|
className = '',
|
|
@@ -35,7 +35,7 @@ export const Portal= ({
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// Determine the container to render into
|
|
38
|
-
let targetContainer= null;
|
|
38
|
+
let targetContainer: Element | null = null;
|
|
39
39
|
|
|
40
40
|
if (container) {
|
|
41
41
|
if (typeof container === 'function') {
|
|
@@ -52,17 +52,17 @@ export const Portal= ({
|
|
|
52
52
|
|
|
53
53
|
// Ensure the container exists
|
|
54
54
|
if (!targetContainer) {
|
|
55
|
-
console.warn('Portal);
|
|
55
|
+
console.warn('Portal: Target container not found');
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// Build container classes
|
|
60
60
|
const containerClasses = [
|
|
61
61
|
'portal__container',
|
|
62
|
-
variant !== 'default' ? `portal__container--${variant}` ,
|
|
63
|
-
position ? `portal__container--${position}` ,
|
|
64
|
-
zIndex ? `portal__container--${zIndex}` ,
|
|
65
|
-
debug ? 'portal__container--debug' ,
|
|
62
|
+
variant !== 'default' ? `portal__container--${variant}` : '',
|
|
63
|
+
position ? `portal__container--${position}` : '',
|
|
64
|
+
zIndex ? `portal__container--${zIndex}` : '',
|
|
65
|
+
debug ? 'portal__container--debug' : '',
|
|
66
66
|
className
|
|
67
67
|
].filter(Boolean).join(' ');
|
|
68
68
|
|
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { PortalProps } from './types';
|
|
4
4
|
|
|
5
|
-
export const Portal= ({
|
|
5
|
+
export const Portal: React.FC<PortalProps> = ({
|
|
6
6
|
children,
|
|
7
7
|
container,
|
|
8
8
|
className = '',
|
|
@@ -35,7 +35,7 @@ export const Portal= ({
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// Determine the container to render into
|
|
38
|
-
let targetContainer= null;
|
|
38
|
+
let targetContainer: Element | null = null;
|
|
39
39
|
|
|
40
40
|
if (container) {
|
|
41
41
|
if (typeof container === 'function') {
|
|
@@ -52,17 +52,17 @@ export const Portal= ({
|
|
|
52
52
|
|
|
53
53
|
// Ensure the container exists
|
|
54
54
|
if (!targetContainer) {
|
|
55
|
-
console.warn('Portal);
|
|
55
|
+
console.warn('Portal: Target container not found');
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
// Build container classes
|
|
60
60
|
const containerClasses = [
|
|
61
61
|
'portal__container',
|
|
62
|
-
variant !== 'default' ? `portal__container--${variant}` ,
|
|
63
|
-
position ? `portal__container--${position}` ,
|
|
64
|
-
zIndex ? `portal__container--${zIndex}` ,
|
|
65
|
-
debug ? 'portal__container--debug' ,
|
|
62
|
+
variant !== 'default' ? `portal__container--${variant}` : '',
|
|
63
|
+
position ? `portal__container--${position}` : '',
|
|
64
|
+
zIndex ? `portal__container--${zIndex}` : '',
|
|
65
|
+
debug ? 'portal__container--debug' : '',
|
|
66
66
|
className
|
|
67
67
|
].filter(Boolean).join(' ');
|
|
68
68
|
|
|
@@ -5,18 +5,18 @@ import { TooltipProps, TooltipContentProps } from './types';
|
|
|
5
5
|
|
|
6
6
|
// Default color fallbacks
|
|
7
7
|
const getDefaultColors = () => ({
|
|
8
|
-
surface, surface, border},
|
|
9
|
-
text, secondary, inverse},
|
|
10
|
-
interactive, focus},
|
|
11
|
-
primary}
|
|
8
|
+
surface: { background: '#1f2937', surface: '#374151', border: '#4b5563' },
|
|
9
|
+
text: { primary: '#ffffff', secondary: '#d1d5db', inverse: '#111827' },
|
|
10
|
+
interactive: { hover: '#4b5563', focus: '#3b82f6' },
|
|
11
|
+
primary: { 500: '#3b82f6' }
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
// Position calculations utility
|
|
15
15
|
const calculatePosition = (
|
|
16
|
-
triggerRect,
|
|
17
|
-
tooltipRect,
|
|
18
|
-
position] = 'top',
|
|
19
|
-
offset= 8
|
|
16
|
+
triggerRect: DOMRect,
|
|
17
|
+
tooltipRect: DOMRect,
|
|
18
|
+
position: TooltipProps['position'] = 'top',
|
|
19
|
+
offset: number = 8
|
|
20
20
|
) => {
|
|
21
21
|
const scrollX = window.scrollX || document.documentElement.scrollLeft;
|
|
22
22
|
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
@@ -29,40 +29,52 @@ const calculatePosition = (
|
|
|
29
29
|
const triggerCenterY = triggerRect.top + triggerRect.height / 2;
|
|
30
30
|
|
|
31
31
|
switch (position) {
|
|
32
|
-
case 'top'
|
|
32
|
+
case 'top':
|
|
33
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
33
34
|
left = triggerCenterX - tooltipRect.width / 2;
|
|
34
35
|
break;
|
|
35
|
-
case 'top-start'
|
|
36
|
+
case 'top-start':
|
|
37
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
36
38
|
left = triggerRect.left;
|
|
37
39
|
break;
|
|
38
|
-
case 'top-end'
|
|
40
|
+
case 'top-end':
|
|
41
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
39
42
|
left = triggerRect.right - tooltipRect.width;
|
|
40
43
|
break;
|
|
41
|
-
case 'bottom'
|
|
44
|
+
case 'bottom':
|
|
45
|
+
top = triggerRect.bottom + offset;
|
|
42
46
|
left = triggerCenterX - tooltipRect.width / 2;
|
|
43
47
|
break;
|
|
44
|
-
case 'bottom-start'
|
|
48
|
+
case 'bottom-start':
|
|
49
|
+
top = triggerRect.bottom + offset;
|
|
45
50
|
left = triggerRect.left;
|
|
46
51
|
break;
|
|
47
|
-
case 'bottom-end'
|
|
52
|
+
case 'bottom-end':
|
|
53
|
+
top = triggerRect.bottom + offset;
|
|
48
54
|
left = triggerRect.right - tooltipRect.width;
|
|
49
55
|
break;
|
|
50
|
-
case 'left'
|
|
56
|
+
case 'left':
|
|
57
|
+
top = triggerCenterY - tooltipRect.height / 2;
|
|
51
58
|
left = triggerRect.left - tooltipRect.width - offset;
|
|
52
59
|
break;
|
|
53
|
-
case 'left-start'
|
|
60
|
+
case 'left-start':
|
|
61
|
+
top = triggerRect.top;
|
|
54
62
|
left = triggerRect.left - tooltipRect.width - offset;
|
|
55
63
|
break;
|
|
56
|
-
case 'left-end'
|
|
64
|
+
case 'left-end':
|
|
65
|
+
top = triggerRect.bottom - tooltipRect.height;
|
|
57
66
|
left = triggerRect.left - tooltipRect.width - offset;
|
|
58
67
|
break;
|
|
59
|
-
case 'right'
|
|
68
|
+
case 'right':
|
|
69
|
+
top = triggerCenterY - tooltipRect.height / 2;
|
|
60
70
|
left = triggerRect.right + offset;
|
|
61
71
|
break;
|
|
62
|
-
case 'right-start'
|
|
72
|
+
case 'right-start':
|
|
73
|
+
top = triggerRect.top;
|
|
63
74
|
left = triggerRect.right + offset;
|
|
64
75
|
break;
|
|
65
|
-
case 'right-end'
|
|
76
|
+
case 'right-end':
|
|
77
|
+
top = triggerRect.bottom - tooltipRect.height;
|
|
66
78
|
left = triggerRect.right + offset;
|
|
67
79
|
break;
|
|
68
80
|
}
|
|
@@ -86,13 +98,15 @@ const calculatePosition = (
|
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
return {
|
|
89
|
-
top,
|
|
90
|
-
left
|
|
101
|
+
top: top + scrollY,
|
|
102
|
+
left: left + scrollX
|
|
103
|
+
};
|
|
91
104
|
};
|
|
92
105
|
|
|
93
106
|
// Arrow component for tooltips
|
|
94
|
-
const TooltipArrow
|
|
95
|
-
|
|
107
|
+
const TooltipArrow: React.FC<{
|
|
108
|
+
position: TooltipProps['position'];
|
|
109
|
+
className?: string;
|
|
96
110
|
}> = ({ className = '' }) => {
|
|
97
111
|
return (
|
|
98
112
|
<div className={`tooltip__arrow ${className}`} />
|
|
@@ -100,7 +114,7 @@ const TooltipArrow];
|
|
|
100
114
|
};
|
|
101
115
|
|
|
102
116
|
// Tooltip Content Component
|
|
103
|
-
export const TooltipContent= ({
|
|
117
|
+
export const TooltipContent: React.FC<TooltipContentProps> = ({
|
|
104
118
|
children,
|
|
105
119
|
className = '',
|
|
106
120
|
style = {}
|
|
@@ -113,12 +127,12 @@ export const TooltipContent= ({
|
|
|
113
127
|
};
|
|
114
128
|
|
|
115
129
|
// Main Tooltip Component
|
|
116
|
-
export const Tooltip= ({
|
|
130
|
+
export const Tooltip: React.FC<TooltipProps> = ({
|
|
117
131
|
content,
|
|
118
132
|
children,
|
|
119
133
|
position = 'top',
|
|
120
134
|
trigger = 'hover',
|
|
121
|
-
isOpen,
|
|
135
|
+
isOpen: controlledIsOpen,
|
|
122
136
|
onOpenChange,
|
|
123
137
|
delay = 200,
|
|
124
138
|
offset = 8,
|
|
@@ -136,7 +150,7 @@ export const Tooltip= ({
|
|
|
136
150
|
const colors = themeConfig?.colors || getDefaultColors();
|
|
137
151
|
|
|
138
152
|
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
139
|
-
const [tooltipPosition, setTooltipPosition] = useState({ top, left});
|
|
153
|
+
const [tooltipPosition, setTooltipPosition] = useState({ top: 0, left: 0 });
|
|
140
154
|
|
|
141
155
|
const triggerRef = useRef<HTMLElement>(null);
|
|
142
156
|
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
@@ -145,7 +159,7 @@ export const Tooltip= ({
|
|
|
145
159
|
const isOpen = controlledIsOpen ?? internalIsOpen;
|
|
146
160
|
|
|
147
161
|
// Handle open/close state changes
|
|
148
|
-
const handleOpenChange = useCallback((open) => {
|
|
162
|
+
const handleOpenChange = useCallback((open: boolean) => {
|
|
149
163
|
if (controlledIsOpen === undefined) {
|
|
150
164
|
setInternalIsOpen(open);
|
|
151
165
|
}
|
|
@@ -217,9 +231,9 @@ export const Tooltip= ({
|
|
|
217
231
|
const getContentClasses = () => {
|
|
218
232
|
const classes = [
|
|
219
233
|
'tooltip__content',
|
|
220
|
-
size ? `tooltip__content--size-${size}` ,
|
|
221
|
-
variant ? `tooltip__content--variant-${variant}` ,
|
|
222
|
-
position ? `tooltip__content--position-${position}` ,
|
|
234
|
+
size ? `tooltip__content--size-${size}` : '',
|
|
235
|
+
variant ? `tooltip__content--variant-${variant}` : '',
|
|
236
|
+
position ? `tooltip__content--position-${position}` : '',
|
|
223
237
|
className
|
|
224
238
|
];
|
|
225
239
|
|
|
@@ -233,7 +247,7 @@ export const Tooltip= ({
|
|
|
233
247
|
|
|
234
248
|
// Create trigger event handlers
|
|
235
249
|
const getTriggerProps = () => {
|
|
236
|
-
const props= {};
|
|
250
|
+
const props: any = {};
|
|
237
251
|
|
|
238
252
|
if (trigger === 'hover') {
|
|
239
253
|
props.onMouseEnter = showTooltip;
|
|
@@ -251,8 +265,8 @@ export const Tooltip= ({
|
|
|
251
265
|
// Clone trigger element with event handlers
|
|
252
266
|
const triggerElement = cloneElement(children, {
|
|
253
267
|
...getTriggerProps(),
|
|
254
|
-
ref,
|
|
255
|
-
className}`
|
|
268
|
+
ref: triggerRef,
|
|
269
|
+
className: `tooltip__trigger ${children.props.className || ''}`
|
|
256
270
|
});
|
|
257
271
|
|
|
258
272
|
return (
|
|
@@ -267,11 +281,12 @@ export const Tooltip= ({
|
|
|
267
281
|
className={getContentClasses()}
|
|
268
282
|
style={{
|
|
269
283
|
...tooltipPosition,
|
|
270
|
-
maxWidth=== 'number' ? `${maxWidth}px` ,
|
|
284
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,
|
|
271
285
|
zIndex,
|
|
272
|
-
backgroundColor,
|
|
273
|
-
color,
|
|
274
|
-
borderColor
|
|
286
|
+
backgroundColor: colors.surface.background,
|
|
287
|
+
color: colors.text.primary,
|
|
288
|
+
borderColor: colors.surface.border
|
|
289
|
+
}}
|
|
275
290
|
>
|
|
276
291
|
{content}
|
|
277
292
|
|