@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.1.3 → 0.1.5
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/index.d.ts +131 -131
- package/dist/index.esm.js +148 -148
- package/dist/index.js +148 -148
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/src/components/ui/accessibility-demo.tsx +271 -0
- package/src/components/ui/advanced-component-architecture-demo.tsx +916 -0
- package/src/components/ui/advanced-transition-system-demo.tsx +670 -0
- package/src/components/ui/advanced-transition-system.tsx +395 -0
- package/src/components/ui/animation/animated-container.tsx +166 -0
- package/src/components/ui/animation/index.ts +19 -0
- package/src/components/ui/animation/staggered-container.tsx +68 -0
- package/src/components/ui/animation-demo.tsx +250 -0
- package/src/components/ui/badge.tsx +33 -0
- package/src/components/ui/battery-conscious-animation-demo.tsx +568 -0
- package/src/components/ui/border-radius-shadow-demo.tsx +187 -0
- package/src/components/ui/button.tsx +36 -0
- package/src/components/ui/card.tsx +207 -0
- package/src/components/ui/checkbox.tsx +30 -0
- package/src/components/ui/color-preview.tsx +411 -0
- package/src/components/ui/data-display/chart.tsx +653 -0
- package/src/components/ui/data-display/data-grid-simple.tsx +76 -0
- package/src/components/ui/data-display/data-grid.tsx +680 -0
- package/src/components/ui/data-display/list.tsx +456 -0
- package/src/components/ui/data-display/table.tsx +482 -0
- package/src/components/ui/data-display/timeline.tsx +441 -0
- package/src/components/ui/data-display/tree.tsx +602 -0
- package/src/components/ui/data-display/types.ts +536 -0
- package/src/components/ui/enterprise-mobile-experience-demo.tsx +749 -0
- package/src/components/ui/enterprise-mobile-experience.tsx +464 -0
- package/src/components/ui/feedback/alert.tsx +157 -0
- package/src/components/ui/feedback/progress.tsx +292 -0
- package/src/components/ui/feedback/skeleton.tsx +185 -0
- package/src/components/ui/feedback/toast.tsx +280 -0
- package/src/components/ui/feedback/types.ts +125 -0
- package/src/components/ui/font-preview.tsx +288 -0
- package/src/components/ui/form-demo.tsx +553 -0
- package/src/components/ui/hardware-acceleration-demo.tsx +547 -0
- package/src/components/ui/input.tsx +35 -0
- package/src/components/ui/label.tsx +16 -0
- package/src/components/ui/layout-demo.tsx +367 -0
- package/src/components/ui/layouts/adaptive-layout.tsx +139 -0
- package/src/components/ui/layouts/desktop-layout.tsx +224 -0
- package/src/components/ui/layouts/index.ts +10 -0
- package/src/components/ui/layouts/mobile-layout.tsx +162 -0
- package/src/components/ui/layouts/tablet-layout.tsx +197 -0
- package/src/components/ui/mobile-form-validation.tsx +451 -0
- package/src/components/ui/mobile-input-demo.tsx +201 -0
- package/src/components/ui/mobile-input.tsx +281 -0
- package/src/components/ui/mobile-skeleton-loading-demo.tsx +638 -0
- package/src/components/ui/navigation/breadcrumb.tsx +158 -0
- package/src/components/ui/navigation/index.ts +36 -0
- package/src/components/ui/navigation/menu.tsx +374 -0
- package/src/components/ui/navigation/navigation-demo.tsx +324 -0
- package/src/components/ui/navigation/pagination.tsx +272 -0
- package/src/components/ui/navigation/sidebar.tsx +383 -0
- package/src/components/ui/navigation/stepper.tsx +303 -0
- package/src/components/ui/navigation/tabs.tsx +205 -0
- package/src/components/ui/navigation/types.ts +299 -0
- package/src/components/ui/overlay/backdrop.tsx +81 -0
- package/src/components/ui/overlay/focus-manager.tsx +143 -0
- package/src/components/ui/overlay/index.ts +36 -0
- package/src/components/ui/overlay/modal.tsx +270 -0
- package/src/components/ui/overlay/overlay-manager.tsx +110 -0
- package/src/components/ui/overlay/popover.tsx +462 -0
- package/src/components/ui/overlay/portal.tsx +79 -0
- package/src/components/ui/overlay/tooltip.tsx +303 -0
- package/src/components/ui/overlay/types.ts +196 -0
- package/src/components/ui/performance-demo.tsx +596 -0
- package/src/components/ui/semantic-input-system-demo.tsx +502 -0
- package/src/components/ui/semantic-input-system-demo.tsx.disabled +873 -0
- package/src/components/ui/tablet-layout.tsx +192 -0
- package/src/components/ui/theme-customizer.tsx +386 -0
- package/src/components/ui/theme-preview.tsx +310 -0
- package/src/components/ui/theme-switcher.tsx +264 -0
- package/src/components/ui/theme-toggle.tsx +38 -0
- package/src/components/ui/token-demo.tsx +195 -0
- package/src/components/ui/touch-demo.tsx +462 -0
- package/src/components/ui/touch-friendly-interface-demo.tsx +519 -0
- package/src/components/ui/touch-friendly-interface.tsx +296 -0
- package/src/hooks/index.ts +190 -0
- package/src/hooks/use-accessibility-support.ts +518 -0
- package/src/hooks/use-adaptive-layout.ts +289 -0
- package/src/hooks/use-advanced-patterns.ts +294 -0
- package/src/hooks/use-advanced-transition-system.ts +393 -0
- package/src/hooks/use-animation-profile.ts +288 -0
- package/src/hooks/use-battery-animations.ts +384 -0
- package/src/hooks/use-battery-conscious-loading.ts +475 -0
- package/src/hooks/use-battery-optimization.ts +330 -0
- package/src/hooks/use-battery-status.ts +299 -0
- package/src/hooks/use-component-performance.ts +344 -0
- package/src/hooks/use-device-loading-states.ts +459 -0
- package/src/hooks/use-device.tsx +110 -0
- package/src/hooks/use-enterprise-mobile-experience.ts +488 -0
- package/src/hooks/use-form-feedback.ts +403 -0
- package/src/hooks/use-form-performance.ts +513 -0
- package/src/hooks/use-frame-rate.ts +251 -0
- package/src/hooks/use-gestures.ts +338 -0
- package/src/hooks/use-hardware-acceleration.ts +341 -0
- package/src/hooks/use-input-accessibility.ts +455 -0
- package/src/hooks/use-input-performance.ts +506 -0
- package/src/hooks/use-layout-performance.ts +319 -0
- package/src/hooks/use-loading-accessibility.ts +535 -0
- package/src/hooks/use-loading-performance.ts +473 -0
- package/src/hooks/use-memory-usage.ts +287 -0
- package/src/hooks/use-mobile-form-layout.ts +464 -0
- package/src/hooks/use-mobile-form-validation.ts +518 -0
- package/src/hooks/use-mobile-keyboard-optimization.ts +472 -0
- package/src/hooks/use-mobile-layout.ts +302 -0
- package/src/hooks/use-mobile-optimization.ts +406 -0
- package/src/hooks/use-mobile-skeleton.ts +402 -0
- package/src/hooks/use-mobile-touch.ts +414 -0
- package/src/hooks/use-performance-throttling.ts +348 -0
- package/src/hooks/use-performance.ts +316 -0
- package/src/hooks/use-reusable-architecture.ts +414 -0
- package/src/hooks/use-semantic-input-types.ts +357 -0
- package/src/hooks/use-semantic-input.ts +565 -0
- package/src/hooks/use-tablet-layout.ts +384 -0
- package/src/hooks/use-touch-friendly-input.ts +524 -0
- package/src/hooks/use-touch-friendly-interface.ts +331 -0
- package/src/hooks/use-touch-optimization.ts +375 -0
- package/src/index.ts +279 -279
- package/src/lib/utils.ts +6 -0
- package/src/themes/README.md +272 -0
- package/src/themes/ThemeContext.tsx +31 -0
- package/src/themes/ThemeProvider.tsx +232 -0
- package/src/themes/accessibility/index.ts +27 -0
- package/src/themes/accessibility.ts +259 -0
- package/src/themes/aria-patterns.ts +420 -0
- package/src/themes/base-themes.ts +55 -0
- package/src/themes/colorManager.ts +380 -0
- package/src/themes/examples/dark-theme.ts +154 -0
- package/src/themes/examples/minimal-theme.ts +108 -0
- package/src/themes/focus-management.ts +701 -0
- package/src/themes/fontLoader.ts +201 -0
- package/src/themes/high-contrast.ts +621 -0
- package/src/themes/index.ts +19 -0
- package/src/themes/inheritance.ts +227 -0
- package/src/themes/keyboard-navigation.ts +550 -0
- package/src/themes/motion-reduction.ts +662 -0
- package/src/themes/navigation.ts +238 -0
- package/src/themes/screen-reader.ts +645 -0
- package/src/themes/systemThemeDetector.ts +182 -0
- package/src/themes/themeCSSUpdater.ts +262 -0
- package/src/themes/themePersistence.ts +238 -0
- package/src/themes/themes/default.ts +586 -0
- package/src/themes/themes/harvey.ts +554 -0
- package/src/themes/themes/stan-design.ts +683 -0
- package/src/themes/types.ts +460 -0
- package/src/themes/useSystemTheme.ts +48 -0
- package/src/themes/useTheme.ts +87 -0
- package/src/themes/validation.ts +462 -0
- package/src/tokens/index.ts +34 -0
- package/src/tokens/tokenExporter.ts +397 -0
- package/src/tokens/tokenGenerator.ts +276 -0
- package/src/tokens/tokenManager.ts +248 -0
- package/src/tokens/tokenValidator.ts +543 -0
- package/src/tokens/types.ts +78 -0
- package/src/utils/bundle-analyzer.ts +260 -0
- package/src/utils/bundle-splitting.ts +483 -0
- package/src/utils/lazy-loading.ts +441 -0
- package/src/utils/performance-monitor.ts +513 -0
- package/src/utils/tree-shaking.ts +274 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useCallback, cloneElement } from 'react';
|
|
2
|
+
import { useTheme } from '../../../themes/useTheme';
|
|
3
|
+
import { Portal } from './portal';
|
|
4
|
+
import { TooltipProps, TooltipContentProps } from './types';
|
|
5
|
+
|
|
6
|
+
// Default color fallbacks
|
|
7
|
+
const getDefaultColors = () => ({
|
|
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
|
+
});
|
|
13
|
+
|
|
14
|
+
// Position calculations utility
|
|
15
|
+
const calculatePosition = (
|
|
16
|
+
triggerRect: DOMRect,
|
|
17
|
+
tooltipRect: DOMRect,
|
|
18
|
+
position: TooltipProps['position'] = 'top',
|
|
19
|
+
offset: number = 8
|
|
20
|
+
) => {
|
|
21
|
+
const scrollX = window.scrollX || document.documentElement.scrollLeft;
|
|
22
|
+
const scrollY = window.scrollY || document.documentElement.scrollTop;
|
|
23
|
+
|
|
24
|
+
let top = 0;
|
|
25
|
+
let left = 0;
|
|
26
|
+
|
|
27
|
+
// Base calculations
|
|
28
|
+
const triggerCenterX = triggerRect.left + triggerRect.width / 2;
|
|
29
|
+
const triggerCenterY = triggerRect.top + triggerRect.height / 2;
|
|
30
|
+
|
|
31
|
+
switch (position) {
|
|
32
|
+
case 'top':
|
|
33
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
34
|
+
left = triggerCenterX - tooltipRect.width / 2;
|
|
35
|
+
break;
|
|
36
|
+
case 'top-start':
|
|
37
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
38
|
+
left = triggerRect.left;
|
|
39
|
+
break;
|
|
40
|
+
case 'top-end':
|
|
41
|
+
top = triggerRect.top - tooltipRect.height - offset;
|
|
42
|
+
left = triggerRect.right - tooltipRect.width;
|
|
43
|
+
break;
|
|
44
|
+
case 'bottom':
|
|
45
|
+
top = triggerRect.bottom + offset;
|
|
46
|
+
left = triggerCenterX - tooltipRect.width / 2;
|
|
47
|
+
break;
|
|
48
|
+
case 'bottom-start':
|
|
49
|
+
top = triggerRect.bottom + offset;
|
|
50
|
+
left = triggerRect.left;
|
|
51
|
+
break;
|
|
52
|
+
case 'bottom-end':
|
|
53
|
+
top = triggerRect.bottom + offset;
|
|
54
|
+
left = triggerRect.right - tooltipRect.width;
|
|
55
|
+
break;
|
|
56
|
+
case 'left':
|
|
57
|
+
top = triggerCenterY - tooltipRect.height / 2;
|
|
58
|
+
left = triggerRect.left - tooltipRect.width - offset;
|
|
59
|
+
break;
|
|
60
|
+
case 'left-start':
|
|
61
|
+
top = triggerRect.top;
|
|
62
|
+
left = triggerRect.left - tooltipRect.width - offset;
|
|
63
|
+
break;
|
|
64
|
+
case 'left-end':
|
|
65
|
+
top = triggerRect.bottom - tooltipRect.height;
|
|
66
|
+
left = triggerRect.left - tooltipRect.width - offset;
|
|
67
|
+
break;
|
|
68
|
+
case 'right':
|
|
69
|
+
top = triggerCenterY - tooltipRect.height / 2;
|
|
70
|
+
left = triggerRect.right + offset;
|
|
71
|
+
break;
|
|
72
|
+
case 'right-start':
|
|
73
|
+
top = triggerRect.top;
|
|
74
|
+
left = triggerRect.right + offset;
|
|
75
|
+
break;
|
|
76
|
+
case 'right-end':
|
|
77
|
+
top = triggerRect.bottom - tooltipRect.height;
|
|
78
|
+
left = triggerRect.right + offset;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Adjust for viewport boundaries
|
|
83
|
+
const viewportWidth = window.innerWidth;
|
|
84
|
+
const viewportHeight = window.innerHeight;
|
|
85
|
+
|
|
86
|
+
// Horizontal boundary checks
|
|
87
|
+
if (left < 0) {
|
|
88
|
+
left = offset;
|
|
89
|
+
} else if (left + tooltipRect.width > viewportWidth) {
|
|
90
|
+
left = viewportWidth - tooltipRect.width - offset;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Vertical boundary checks
|
|
94
|
+
if (top < 0) {
|
|
95
|
+
top = offset;
|
|
96
|
+
} else if (top + tooltipRect.height > viewportHeight) {
|
|
97
|
+
top = viewportHeight - tooltipRect.height - offset;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
top: top + scrollY,
|
|
102
|
+
left: left + scrollX
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Arrow component for tooltips
|
|
107
|
+
const TooltipArrow: React.FC<{
|
|
108
|
+
position: TooltipProps['position'];
|
|
109
|
+
className?: string;
|
|
110
|
+
}> = ({ className = '' }) => {
|
|
111
|
+
return (
|
|
112
|
+
<div className={`tooltip__arrow ${className}`} />
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Tooltip Content Component
|
|
117
|
+
export const TooltipContent: React.FC<TooltipContentProps> = ({
|
|
118
|
+
children,
|
|
119
|
+
className = '',
|
|
120
|
+
style = {}
|
|
121
|
+
}) => {
|
|
122
|
+
return (
|
|
123
|
+
<div className={`tooltip__content ${className}`} style={style}>
|
|
124
|
+
{children}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// Main Tooltip Component
|
|
130
|
+
export const Tooltip: React.FC<TooltipProps> = ({
|
|
131
|
+
content,
|
|
132
|
+
children,
|
|
133
|
+
position = 'top',
|
|
134
|
+
trigger = 'hover',
|
|
135
|
+
isOpen: controlledIsOpen,
|
|
136
|
+
onOpenChange,
|
|
137
|
+
delay = 200,
|
|
138
|
+
offset = 8,
|
|
139
|
+
size = 'md',
|
|
140
|
+
variant = 'default',
|
|
141
|
+
showArrow = true,
|
|
142
|
+
maxWidth = 320,
|
|
143
|
+
zIndex = 1000,
|
|
144
|
+
animation = 'fade',
|
|
145
|
+
className = '',
|
|
146
|
+
theme = 'stan-design'
|
|
147
|
+
}) => {
|
|
148
|
+
const { getTheme } = useTheme();
|
|
149
|
+
const themeConfig = getTheme(theme);
|
|
150
|
+
const colors = themeConfig?.colors || getDefaultColors();
|
|
151
|
+
|
|
152
|
+
const [internalIsOpen, setInternalIsOpen] = useState(false);
|
|
153
|
+
const [tooltipPosition, setTooltipPosition] = useState({ top: 0, left: 0 });
|
|
154
|
+
|
|
155
|
+
const triggerRef = useRef<HTMLElement>(null);
|
|
156
|
+
const tooltipRef = useRef<HTMLDivElement>(null);
|
|
157
|
+
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
|
158
|
+
|
|
159
|
+
const isOpen = controlledIsOpen ?? internalIsOpen;
|
|
160
|
+
|
|
161
|
+
// Handle open/close state changes
|
|
162
|
+
const handleOpenChange = useCallback((open: boolean) => {
|
|
163
|
+
if (controlledIsOpen === undefined) {
|
|
164
|
+
setInternalIsOpen(open);
|
|
165
|
+
}
|
|
166
|
+
onOpenChange?.(open);
|
|
167
|
+
}, [controlledIsOpen, onOpenChange]);
|
|
168
|
+
|
|
169
|
+
// Show tooltip with delay
|
|
170
|
+
const showTooltip = useCallback(() => {
|
|
171
|
+
if (timeoutRef.current) {
|
|
172
|
+
clearTimeout(timeoutRef.current);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (delay > 0) {
|
|
176
|
+
timeoutRef.current = setTimeout(() => {
|
|
177
|
+
handleOpenChange(true);
|
|
178
|
+
}, delay);
|
|
179
|
+
} else {
|
|
180
|
+
handleOpenChange(true);
|
|
181
|
+
}
|
|
182
|
+
}, [delay, handleOpenChange]);
|
|
183
|
+
|
|
184
|
+
// Hide tooltip
|
|
185
|
+
const hideTooltip = useCallback(() => {
|
|
186
|
+
if (timeoutRef.current) {
|
|
187
|
+
clearTimeout(timeoutRef.current);
|
|
188
|
+
}
|
|
189
|
+
handleOpenChange(false);
|
|
190
|
+
}, [handleOpenChange]);
|
|
191
|
+
|
|
192
|
+
// Position calculation
|
|
193
|
+
const updatePosition = useCallback(() => {
|
|
194
|
+
if (!triggerRef.current || !tooltipRef.current || !isOpen) return;
|
|
195
|
+
|
|
196
|
+
const triggerRect = triggerRef.current.getBoundingClientRect();
|
|
197
|
+
const tooltipRect = tooltipRef.current.getBoundingClientRect();
|
|
198
|
+
|
|
199
|
+
const newPosition = calculatePosition(triggerRect, tooltipRect, position, offset);
|
|
200
|
+
setTooltipPosition(newPosition);
|
|
201
|
+
}, [isOpen, position, offset]);
|
|
202
|
+
|
|
203
|
+
// Update position when tooltip opens or on scroll/resize
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
if (isOpen) {
|
|
206
|
+
updatePosition();
|
|
207
|
+
|
|
208
|
+
const handleResize = () => updatePosition();
|
|
209
|
+
const handleScroll = () => updatePosition();
|
|
210
|
+
|
|
211
|
+
window.addEventListener('resize', handleResize);
|
|
212
|
+
window.addEventListener('scroll', handleScroll, true);
|
|
213
|
+
|
|
214
|
+
return () => {
|
|
215
|
+
window.removeEventListener('resize', handleResize);
|
|
216
|
+
window.removeEventListener('scroll', handleScroll, true);
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
}, [isOpen, updatePosition]);
|
|
220
|
+
|
|
221
|
+
// Cleanup timeout on unmount
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
return () => {
|
|
224
|
+
if (timeoutRef.current) {
|
|
225
|
+
clearTimeout(timeoutRef.current);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}, []);
|
|
229
|
+
|
|
230
|
+
// Get tooltip content classes
|
|
231
|
+
const getContentClasses = () => {
|
|
232
|
+
const classes = [
|
|
233
|
+
'tooltip__content',
|
|
234
|
+
size ? `tooltip__content--size-${size}` : '',
|
|
235
|
+
variant ? `tooltip__content--variant-${variant}` : '',
|
|
236
|
+
position ? `tooltip__content--position-${position}` : '',
|
|
237
|
+
className
|
|
238
|
+
];
|
|
239
|
+
|
|
240
|
+
// Add animation class
|
|
241
|
+
if (animation !== 'none' && isOpen) {
|
|
242
|
+
classes.push(`tooltip__content--${animation}-enter`);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return classes.filter(Boolean).join(' ');
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
// Create trigger event handlers
|
|
249
|
+
const getTriggerProps = () => {
|
|
250
|
+
const props: any = {};
|
|
251
|
+
|
|
252
|
+
if (trigger === 'hover') {
|
|
253
|
+
props.onMouseEnter = showTooltip;
|
|
254
|
+
props.onMouseLeave = hideTooltip;
|
|
255
|
+
} else if (trigger === 'click') {
|
|
256
|
+
props.onClick = () => handleOpenChange(!isOpen);
|
|
257
|
+
} else if (trigger === 'focus') {
|
|
258
|
+
props.onFocus = showTooltip;
|
|
259
|
+
props.onBlur = hideTooltip;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return props;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// Clone trigger element with event handlers
|
|
266
|
+
const triggerElement = cloneElement(children, {
|
|
267
|
+
...getTriggerProps(),
|
|
268
|
+
ref: triggerRef,
|
|
269
|
+
className: `tooltip__trigger ${children.props.className || ''}`
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<>
|
|
274
|
+
{triggerElement}
|
|
275
|
+
|
|
276
|
+
{isOpen && (
|
|
277
|
+
<Portal>
|
|
278
|
+
<div
|
|
279
|
+
ref={tooltipRef}
|
|
280
|
+
role="tooltip"
|
|
281
|
+
className={getContentClasses()}
|
|
282
|
+
style={{
|
|
283
|
+
...tooltipPosition,
|
|
284
|
+
maxWidth: typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth,
|
|
285
|
+
zIndex,
|
|
286
|
+
backgroundColor: colors.surface.background,
|
|
287
|
+
color: colors.text.primary,
|
|
288
|
+
borderColor: colors.surface.border
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
{content}
|
|
292
|
+
|
|
293
|
+
{showArrow && (
|
|
294
|
+
<TooltipArrow position={position} />
|
|
295
|
+
)}
|
|
296
|
+
</div>
|
|
297
|
+
</Portal>
|
|
298
|
+
)}
|
|
299
|
+
</>
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export default Tooltip;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// Base overlay properties
|
|
4
|
+
export interface OverlayBaseProps {
|
|
5
|
+
className?: string;
|
|
6
|
+
theme?: 'stan-design' | 'harvey';
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Portal Component Types
|
|
11
|
+
export interface PortalProps {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
container?: Element | (() => Element | null);
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: React.CSSProperties;
|
|
16
|
+
variant?: 'default' | 'modal' | 'popover' | 'tooltip' | 'toast' | 'dropdown';
|
|
17
|
+
position?: 'fixed' | 'absolute' | 'relative';
|
|
18
|
+
zIndex?: 'modal' | 'popover' | 'tooltip' | 'toast' | 'dropdown';
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
onMount?: () => void;
|
|
21
|
+
onUnmount?: () => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Overlay Manager Types
|
|
25
|
+
export interface OverlayState {
|
|
26
|
+
id: string;
|
|
27
|
+
zIndex: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface OverlayAction {
|
|
31
|
+
type: 'ADD_OVERLAY' | 'REMOVE_OVERLAY' | 'UPDATE_Z_INDEX';
|
|
32
|
+
payload: {
|
|
33
|
+
id: string;
|
|
34
|
+
zIndex?: number;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface OverlayManagerProps {
|
|
39
|
+
children: React.ReactNode;
|
|
40
|
+
baseZIndex?: number;
|
|
41
|
+
maxOverlays?: number;
|
|
42
|
+
onOverlayChange?: (overlays: OverlayState[]) => void;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Focus Manager Types
|
|
46
|
+
export interface FocusManagerProps {
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
isActive: boolean;
|
|
49
|
+
onFocusChange?: (focused: boolean) => void;
|
|
50
|
+
trapFocus?: boolean;
|
|
51
|
+
restoreFocus?: boolean;
|
|
52
|
+
initialFocus?: React.RefObject<HTMLElement>;
|
|
53
|
+
className?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Backdrop Types
|
|
57
|
+
export interface BackdropProps {
|
|
58
|
+
isVisible: boolean;
|
|
59
|
+
onClick?: () => void;
|
|
60
|
+
className?: string;
|
|
61
|
+
theme?: 'stan-design' | 'harvey';
|
|
62
|
+
blur?: boolean;
|
|
63
|
+
opacity?: number;
|
|
64
|
+
zIndex?: number;
|
|
65
|
+
children?: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Modal Component Types
|
|
69
|
+
export interface ModalProps extends OverlayBaseProps {
|
|
70
|
+
isOpen: boolean;
|
|
71
|
+
onClose: () => void;
|
|
72
|
+
title?: string;
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
75
|
+
variant?: 'default' | 'borderless' | 'elevated' | 'centered';
|
|
76
|
+
closeOnOverlayClick?: boolean;
|
|
77
|
+
closeOnEscape?: boolean;
|
|
78
|
+
showBackdrop?: boolean;
|
|
79
|
+
backdropBlur?: boolean;
|
|
80
|
+
backdropOpacity?: number;
|
|
81
|
+
trapFocus?: boolean;
|
|
82
|
+
restoreFocus?: boolean;
|
|
83
|
+
initialFocus?: React.RefObject<HTMLElement>;
|
|
84
|
+
zIndex?: number;
|
|
85
|
+
animation?: 'fade' | 'slide' | 'scale' | 'none';
|
|
86
|
+
duration?: number;
|
|
87
|
+
loading?: boolean;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface ModalHeaderProps {
|
|
91
|
+
title?: string;
|
|
92
|
+
subtitle?: string;
|
|
93
|
+
onClose?: () => void;
|
|
94
|
+
showCloseButton?: boolean;
|
|
95
|
+
closeButtonLabel?: string;
|
|
96
|
+
className?: string;
|
|
97
|
+
borderless?: boolean;
|
|
98
|
+
noPadding?: boolean;
|
|
99
|
+
children?: React.ReactNode;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ModalBodyProps {
|
|
103
|
+
children: React.ReactNode;
|
|
104
|
+
className?: string;
|
|
105
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
106
|
+
scrollable?: boolean;
|
|
107
|
+
maxHeight?: string | number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface ModalFooterProps {
|
|
111
|
+
children: React.ReactNode;
|
|
112
|
+
className?: string;
|
|
113
|
+
justify?: 'start' | 'center' | 'end' | 'between';
|
|
114
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
115
|
+
borderTop?: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Tooltip Component Types
|
|
119
|
+
export interface TooltipProps extends OverlayBaseProps {
|
|
120
|
+
content: React.ReactNode;
|
|
121
|
+
children: React.ReactElement;
|
|
122
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
|
|
123
|
+
trigger?: 'hover' | 'click' | 'focus' | 'manual';
|
|
124
|
+
isOpen?: boolean;
|
|
125
|
+
onOpenChange?: (open: boolean) => void;
|
|
126
|
+
delay?: number;
|
|
127
|
+
offset?: number;
|
|
128
|
+
size?: 'sm' | 'md' | 'lg';
|
|
129
|
+
variant?: 'default' | 'filled' | 'outlined';
|
|
130
|
+
showArrow?: boolean;
|
|
131
|
+
maxWidth?: string | number;
|
|
132
|
+
zIndex?: number;
|
|
133
|
+
animation?: 'fade' | 'slide' | 'scale' | 'none';
|
|
134
|
+
duration?: number;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface TooltipContentProps {
|
|
138
|
+
children: React.ReactNode;
|
|
139
|
+
className?: string;
|
|
140
|
+
style?: React.CSSProperties;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Popover Component Types
|
|
144
|
+
export interface PopoverProps extends OverlayBaseProps {
|
|
145
|
+
trigger: React.ReactElement;
|
|
146
|
+
children: React.ReactNode;
|
|
147
|
+
isOpen?: boolean;
|
|
148
|
+
onOpenChange?: (open: boolean) => void;
|
|
149
|
+
position?: 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end';
|
|
150
|
+
triggerType?: 'hover' | 'click' | 'focus' | 'manual';
|
|
151
|
+
delay?: number;
|
|
152
|
+
offset?: number;
|
|
153
|
+
size?: 'sm' | 'md' | 'lg';
|
|
154
|
+
variant?: 'default' | 'filled' | 'outlined';
|
|
155
|
+
showArrow?: boolean;
|
|
156
|
+
maxWidth?: string | number;
|
|
157
|
+
zIndex?: number;
|
|
158
|
+
animation?: 'fade' | 'slide' | 'scale' | 'none';
|
|
159
|
+
duration?: number;
|
|
160
|
+
closeOnBlur?: boolean;
|
|
161
|
+
closeOnEscape?: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface PopoverContentProps {
|
|
165
|
+
children: React.ReactNode;
|
|
166
|
+
className?: string;
|
|
167
|
+
style?: React.CSSProperties;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface PopoverHeaderProps {
|
|
171
|
+
title?: string;
|
|
172
|
+
subtitle?: string;
|
|
173
|
+
onClose?: () => void;
|
|
174
|
+
showCloseButton?: boolean;
|
|
175
|
+
closeButtonLabel?: string;
|
|
176
|
+
className?: string;
|
|
177
|
+
borderless?: boolean;
|
|
178
|
+
noPadding?: boolean;
|
|
179
|
+
children?: React.ReactNode;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface PopoverBodyProps {
|
|
183
|
+
children: React.ReactNode;
|
|
184
|
+
className?: string;
|
|
185
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
186
|
+
scrollable?: boolean;
|
|
187
|
+
maxHeight?: string | number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export interface PopoverFooterProps {
|
|
191
|
+
children: React.ReactNode;
|
|
192
|
+
className?: string;
|
|
193
|
+
justify?: 'start' | 'center' | 'end' | 'between';
|
|
194
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
195
|
+
borderTop?: boolean;
|
|
196
|
+
}
|