@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,395 @@
|
|
|
1
|
+
import React, { forwardRef, useState, useEffect } from 'react'
|
|
2
|
+
import { cn } from '../../lib/utils'
|
|
3
|
+
import { useAdvancedTransitionSystem } from '../../hooks/use-advanced-transition-system'
|
|
4
|
+
|
|
5
|
+
// Advanced Transition Container Component
|
|
6
|
+
export interface AdvancedTransitionContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
duration?: number
|
|
8
|
+
easing?: 'ease-out' | 'ease-in' | 'ease-in-out' | 'ease-out-quint' | 'ease-in-quint' | 'ease-in-out-quint' | 'ease-out-expo' | 'ease-in-expo' | 'ease-in-out-expo' | 'ease-out-circ' | 'ease-in-circ' | 'ease-in-out-circ'
|
|
9
|
+
delay?: number
|
|
10
|
+
performance?: boolean
|
|
11
|
+
deviceOptimization?: boolean
|
|
12
|
+
accessibility?: boolean
|
|
13
|
+
batteryAware?: boolean
|
|
14
|
+
children: React.ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const AdvancedTransitionContainer = forwardRef<HTMLDivElement, AdvancedTransitionContainerProps>(
|
|
18
|
+
({ className, duration = 300, easing = 'ease-out', delay = 0, performance = true, deviceOptimization = true, accessibility = true, batteryAware = true, children, ...props }, ref) => {
|
|
19
|
+
const { startTransition, transitionState, isTransitionActive } = useAdvancedTransitionSystem({
|
|
20
|
+
duration,
|
|
21
|
+
easing,
|
|
22
|
+
delay,
|
|
23
|
+
performance,
|
|
24
|
+
deviceOptimization,
|
|
25
|
+
accessibility,
|
|
26
|
+
batteryAware
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const [isVisible, setIsVisible] = useState(false)
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const timer = setTimeout(() => {
|
|
33
|
+
setIsVisible(true)
|
|
34
|
+
startTransition()
|
|
35
|
+
}, delay)
|
|
36
|
+
|
|
37
|
+
return () => clearTimeout(timer)
|
|
38
|
+
}, [startTransition, delay])
|
|
39
|
+
|
|
40
|
+
const baseClasses = 'advanced-transition transition-performance'
|
|
41
|
+
const easingClasses = {
|
|
42
|
+
'ease-out': 'transition-ease-out',
|
|
43
|
+
'ease-in': 'transition-ease-in',
|
|
44
|
+
'ease-in-out': 'transition-ease-in-out',
|
|
45
|
+
'ease-out-quint': 'transition-ease-out-quint',
|
|
46
|
+
'ease-in-quint': 'transition-ease-in-quint',
|
|
47
|
+
'ease-in-out-quint': 'transition-ease-in-out-quint',
|
|
48
|
+
'ease-out-expo': 'transition-ease-out-expo',
|
|
49
|
+
'ease-in-expo': 'transition-ease-in-expo',
|
|
50
|
+
'ease-in-out-expo': 'transition-ease-in-out-expo',
|
|
51
|
+
'ease-out-circ': 'transition-ease-out-circ',
|
|
52
|
+
'ease-in-circ': 'transition-ease-in-circ',
|
|
53
|
+
'ease-in-out-circ': 'transition-ease-in-out-circ'
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const durationClasses = {
|
|
57
|
+
75: 'transition-duration-75',
|
|
58
|
+
100: 'transition-duration-100',
|
|
59
|
+
150: 'transition-duration-150',
|
|
60
|
+
200: 'transition-duration-200',
|
|
61
|
+
300: 'transition-duration-300',
|
|
62
|
+
500: 'transition-duration-500',
|
|
63
|
+
700: 'transition-duration-700',
|
|
64
|
+
1000: 'transition-duration-1000'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const delayClasses = {
|
|
68
|
+
75: 'transition-delay-75',
|
|
69
|
+
100: 'transition-delay-100',
|
|
70
|
+
150: 'transition-delay-150',
|
|
71
|
+
200: 'transition-delay-200',
|
|
72
|
+
300: 'transition-delay-300',
|
|
73
|
+
500: 'transition-delay-500',
|
|
74
|
+
700: 'transition-delay-700',
|
|
75
|
+
1000: 'transition-delay-1000'
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<div
|
|
80
|
+
ref={ref}
|
|
81
|
+
className={cn(
|
|
82
|
+
baseClasses,
|
|
83
|
+
easingClasses[easing],
|
|
84
|
+
durationClasses[duration as keyof typeof durationClasses] || 'transition-duration-300',
|
|
85
|
+
delayClasses[delay as keyof typeof delayClasses] || '',
|
|
86
|
+
isVisible ? 'opacity-100' : 'opacity-0',
|
|
87
|
+
isTransitionActive() ? 'transitioning' : '',
|
|
88
|
+
className
|
|
89
|
+
)}
|
|
90
|
+
style={{
|
|
91
|
+
transitionDuration: `${transitionState.currentDuration}ms`,
|
|
92
|
+
transitionDelay: `${transitionState.currentDelay}ms`
|
|
93
|
+
}}
|
|
94
|
+
{...props}
|
|
95
|
+
>
|
|
96
|
+
{children}
|
|
97
|
+
{isTransitionActive() && (
|
|
98
|
+
<div className="absolute inset-0 bg-green-500 bg-opacity-20 pointer-events-none z-10" />
|
|
99
|
+
)}
|
|
100
|
+
</div>
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
AdvancedTransitionContainer.displayName = 'AdvancedTransitionContainer'
|
|
106
|
+
|
|
107
|
+
// Advanced Transition Button Component
|
|
108
|
+
export interface AdvancedTransitionButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
109
|
+
duration?: number
|
|
110
|
+
easing?: 'ease-out' | 'ease-in' | 'ease-in-out' | 'ease-out-quint' | 'ease-in-quint' | 'ease-in-out-quint' | 'ease-out-expo' | 'ease-in-expo' | 'ease-in-out-expo' | 'ease-out-circ' | 'ease-in-circ' | 'ease-in-out-circ'
|
|
111
|
+
delay?: number
|
|
112
|
+
variant?: 'default' | 'secondary' | 'outline' | 'ghost'
|
|
113
|
+
size?: 'sm' | 'default' | 'lg'
|
|
114
|
+
children: React.ReactNode
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const AdvancedTransitionButton = forwardRef<HTMLButtonElement, AdvancedTransitionButtonProps>(
|
|
118
|
+
({ className, duration = 200, easing = 'ease-out', delay = 0, variant = 'default', size = 'default', children, ...props }, ref) => {
|
|
119
|
+
const { startTransition, transitionState, isTransitionActive } = useAdvancedTransitionSystem({
|
|
120
|
+
duration,
|
|
121
|
+
easing,
|
|
122
|
+
delay,
|
|
123
|
+
performance: true,
|
|
124
|
+
deviceOptimization: true,
|
|
125
|
+
accessibility: true,
|
|
126
|
+
batteryAware: true
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const handleClick = () => {
|
|
130
|
+
startTransition()
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const baseClasses = 'advanced-transition transition-performance transition-transform'
|
|
134
|
+
const easingClasses = {
|
|
135
|
+
'ease-out': 'transition-ease-out',
|
|
136
|
+
'ease-in': 'transition-ease-in',
|
|
137
|
+
'ease-in-out': 'transition-ease-in-out',
|
|
138
|
+
'ease-out-quint': 'transition-ease-out-quint',
|
|
139
|
+
'ease-in-quint': 'transition-ease-in-quint',
|
|
140
|
+
'ease-in-out-quint': 'transition-ease-in-out-quint',
|
|
141
|
+
'ease-out-expo': 'transition-ease-out-expo',
|
|
142
|
+
'ease-in-expo': 'transition-ease-in-expo',
|
|
143
|
+
'ease-in-out-expo': 'transition-ease-in-out-expo',
|
|
144
|
+
'ease-out-circ': 'transition-ease-out-circ',
|
|
145
|
+
'ease-in-circ': 'transition-ease-in-circ',
|
|
146
|
+
'ease-in-out-circ': 'transition-ease-in-out-circ'
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const variantClasses = {
|
|
150
|
+
default: 'bg-cs-primary text-white hover:bg-cs-primary-hover active:bg-cs-primary-active',
|
|
151
|
+
secondary: 'bg-cs-secondary text-cs-text-primary hover:bg-cs-secondary-hover active:bg-cs-secondary-active',
|
|
152
|
+
outline: 'bg-transparent border border-cs-border text-cs-text-primary hover:bg-cs-hover-bg',
|
|
153
|
+
ghost: 'bg-transparent text-cs-text-primary hover:bg-cs-hover-bg'
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const sizeClasses = {
|
|
157
|
+
sm: 'px-3 py-2 text-sm min-h-[44px] min-w-[44px]',
|
|
158
|
+
default: 'px-4 py-3 text-base min-h-[48px] min-w-[48px]',
|
|
159
|
+
lg: 'px-6 py-4 text-lg min-h-[56px] min-w-[56px]'
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<button
|
|
164
|
+
ref={ref}
|
|
165
|
+
className={cn(
|
|
166
|
+
baseClasses,
|
|
167
|
+
easingClasses[easing],
|
|
168
|
+
variantClasses[variant],
|
|
169
|
+
sizeClasses[size],
|
|
170
|
+
'rounded-lg font-medium focus:outline-none focus:ring-2 focus:ring-cs-primary focus:ring-offset-2',
|
|
171
|
+
isTransitionActive() ? 'scale-95' : 'scale-100',
|
|
172
|
+
className
|
|
173
|
+
)}
|
|
174
|
+
style={{
|
|
175
|
+
transitionDuration: `${transitionState.currentDuration}ms`,
|
|
176
|
+
transitionDelay: `${transitionState.currentDelay}ms`
|
|
177
|
+
}}
|
|
178
|
+
onClick={handleClick}
|
|
179
|
+
{...props}
|
|
180
|
+
>
|
|
181
|
+
{children}
|
|
182
|
+
{isTransitionActive() && (
|
|
183
|
+
<div className="absolute inset-0 bg-blue-500 bg-opacity-20 pointer-events-none rounded-lg" />
|
|
184
|
+
)}
|
|
185
|
+
</button>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
AdvancedTransitionButton.displayName = 'AdvancedTransitionButton'
|
|
191
|
+
|
|
192
|
+
// Advanced Transition Card Component
|
|
193
|
+
export interface AdvancedTransitionCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
194
|
+
duration?: number
|
|
195
|
+
easing?: 'ease-out' | 'ease-in' | 'ease-in-out' | 'ease-out-quint' | 'ease-in-quint' | 'ease-in-out-quint' | 'ease-out-expo' | 'ease-in-expo' | 'ease-in-out-expo' | 'ease-out-circ' | 'ease-in-circ' | 'ease-in-out-circ'
|
|
196
|
+
delay?: number
|
|
197
|
+
interactive?: boolean
|
|
198
|
+
children: React.ReactNode
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export const AdvancedTransitionCard = forwardRef<HTMLDivElement, AdvancedTransitionCardProps>(
|
|
202
|
+
({ className, duration = 300, easing = 'ease-out', delay = 0, interactive = false, children, ...props }, ref) => {
|
|
203
|
+
const { startTransition, transitionState, isTransitionActive } = useAdvancedTransitionSystem({
|
|
204
|
+
duration,
|
|
205
|
+
easing,
|
|
206
|
+
delay,
|
|
207
|
+
performance: true,
|
|
208
|
+
deviceOptimization: true,
|
|
209
|
+
accessibility: true,
|
|
210
|
+
batteryAware: true
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
const handleClick = () => {
|
|
214
|
+
if (interactive) {
|
|
215
|
+
startTransition()
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const baseClasses = 'advanced-transition transition-performance transition-shadow'
|
|
220
|
+
const easingClasses = {
|
|
221
|
+
'ease-out': 'transition-ease-out',
|
|
222
|
+
'ease-in': 'transition-ease-in',
|
|
223
|
+
'ease-in-out': 'transition-ease-in-out',
|
|
224
|
+
'ease-out-quint': 'transition-ease-out-quint',
|
|
225
|
+
'ease-in-quint': 'transition-ease-in-quint',
|
|
226
|
+
'ease-in-out-quint': 'transition-ease-in-out-quint',
|
|
227
|
+
'ease-out-expo': 'transition-ease-out-expo',
|
|
228
|
+
'ease-in-expo': 'transition-ease-in-expo',
|
|
229
|
+
'ease-in-out-expo': 'transition-ease-in-out-expo',
|
|
230
|
+
'ease-out-circ': 'transition-ease-out-circ',
|
|
231
|
+
'ease-in-circ': 'transition-ease-in-circ',
|
|
232
|
+
'ease-in-out-circ': 'transition-ease-in-out-circ'
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const interactiveClasses = interactive ? 'cursor-pointer hover:shadow-lg active:shadow-xl' : ''
|
|
236
|
+
|
|
237
|
+
return (
|
|
238
|
+
<div
|
|
239
|
+
ref={ref}
|
|
240
|
+
className={cn(
|
|
241
|
+
baseClasses,
|
|
242
|
+
easingClasses[easing],
|
|
243
|
+
'bg-cs-surface-bg border border-cs-border rounded-lg shadow-sm p-4',
|
|
244
|
+
interactiveClasses,
|
|
245
|
+
isTransitionActive() ? 'shadow-2xl' : 'shadow-sm',
|
|
246
|
+
className
|
|
247
|
+
)}
|
|
248
|
+
style={{
|
|
249
|
+
transitionDuration: `${transitionState.currentDuration}ms`,
|
|
250
|
+
transitionDelay: `${transitionState.currentDelay}ms`
|
|
251
|
+
}}
|
|
252
|
+
onClick={handleClick}
|
|
253
|
+
{...props}
|
|
254
|
+
>
|
|
255
|
+
{children}
|
|
256
|
+
{isTransitionActive() && (
|
|
257
|
+
<div className="absolute inset-0 bg-purple-500 bg-opacity-20 pointer-events-none rounded-lg" />
|
|
258
|
+
)}
|
|
259
|
+
</div>
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
AdvancedTransitionCard.displayName = 'AdvancedTransitionCard'
|
|
265
|
+
|
|
266
|
+
// Advanced Transition Input Component
|
|
267
|
+
export interface AdvancedTransitionInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
268
|
+
duration?: number
|
|
269
|
+
easing?: 'ease-out' | 'ease-in' | 'ease-in-out' | 'ease-out-quint' | 'ease-in-quint' | 'ease-in-out-quint' | 'ease-out-expo' | 'ease-in-expo' | 'ease-in-out-expo' | 'ease-out-circ' | 'ease-in-circ' | 'ease-in-out-circ'
|
|
270
|
+
delay?: number
|
|
271
|
+
children?: React.ReactNode
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export const AdvancedTransitionInput = forwardRef<HTMLInputElement, AdvancedTransitionInputProps>(
|
|
275
|
+
({ className, duration = 200, easing = 'ease-out', delay = 0, children, ...props }, ref) => {
|
|
276
|
+
const { startTransition, transitionState, isTransitionActive } = useAdvancedTransitionSystem({
|
|
277
|
+
duration,
|
|
278
|
+
easing,
|
|
279
|
+
delay,
|
|
280
|
+
performance: true,
|
|
281
|
+
deviceOptimization: true,
|
|
282
|
+
accessibility: true,
|
|
283
|
+
batteryAware: true
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
const handleFocus = () => {
|
|
287
|
+
startTransition()
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const baseClasses = 'advanced-transition transition-performance transition-colors'
|
|
291
|
+
const easingClasses = {
|
|
292
|
+
'ease-out': 'transition-ease-out',
|
|
293
|
+
'ease-in': 'transition-ease-in',
|
|
294
|
+
'ease-in-out': 'transition-ease-in-out',
|
|
295
|
+
'ease-out-quint': 'transition-ease-out-quint',
|
|
296
|
+
'ease-in-quint': 'transition-ease-in-quint',
|
|
297
|
+
'ease-in-out-quint': 'transition-ease-in-out-quint',
|
|
298
|
+
'ease-out-expo': 'transition-ease-out-expo',
|
|
299
|
+
'ease-in-expo': 'transition-ease-in-expo',
|
|
300
|
+
'ease-in-out-expo': 'transition-ease-in-out-expo',
|
|
301
|
+
'ease-out-circ': 'transition-ease-out-circ',
|
|
302
|
+
'ease-in-circ': 'transition-ease-in-circ',
|
|
303
|
+
'ease-in-out-circ': 'transition-ease-in-out-circ'
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return (
|
|
307
|
+
<div className="relative">
|
|
308
|
+
<input
|
|
309
|
+
ref={ref}
|
|
310
|
+
className={cn(
|
|
311
|
+
baseClasses,
|
|
312
|
+
easingClasses[easing],
|
|
313
|
+
'w-full bg-cs-surface-bg border border-cs-border rounded-lg px-4 py-3 text-cs-text-primary',
|
|
314
|
+
'focus:outline-none focus:ring-2 focus:ring-cs-primary focus:border-cs-primary',
|
|
315
|
+
'placeholder:text-cs-text-secondary',
|
|
316
|
+
isTransitionActive() ? 'border-cs-primary ring-2 ring-cs-primary' : '',
|
|
317
|
+
className
|
|
318
|
+
)}
|
|
319
|
+
style={{
|
|
320
|
+
transitionDuration: `${transitionState.currentDuration}ms`,
|
|
321
|
+
transitionDelay: `${transitionState.currentDelay}ms`
|
|
322
|
+
}}
|
|
323
|
+
onFocus={handleFocus}
|
|
324
|
+
{...props}
|
|
325
|
+
/>
|
|
326
|
+
{children}
|
|
327
|
+
{isTransitionActive() && (
|
|
328
|
+
<div className="absolute inset-0 bg-yellow-500 bg-opacity-20 pointer-events-none rounded-lg" />
|
|
329
|
+
)}
|
|
330
|
+
</div>
|
|
331
|
+
)
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
AdvancedTransitionInput.displayName = 'AdvancedTransitionInput'
|
|
336
|
+
|
|
337
|
+
// Advanced Transition List Component
|
|
338
|
+
export interface AdvancedTransitionListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
339
|
+
duration?: number
|
|
340
|
+
easing?: 'ease-out' | 'ease-in' | 'ease-in-out' | 'ease-out-quint' | 'ease-in-quint' | 'ease-in-out-quint' | 'ease-out-expo' | 'ease-in-expo' | 'ease-in-out-expo' | 'ease-out-circ' | 'ease-in-circ' | 'ease-in-out-circ'
|
|
341
|
+
delay?: number
|
|
342
|
+
staggerDelay?: number
|
|
343
|
+
children: React.ReactNode
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export const AdvancedTransitionList = forwardRef<HTMLUListElement, AdvancedTransitionListProps>(
|
|
347
|
+
({ className, duration = 300, easing = 'ease-out', delay = 0, staggerDelay = 100, children, ...props }, ref) => {
|
|
348
|
+
const baseClasses = 'advanced-transition transition-performance'
|
|
349
|
+
const easingClasses = {
|
|
350
|
+
'ease-out': 'transition-ease-out',
|
|
351
|
+
'ease-in': 'transition-ease-in',
|
|
352
|
+
'ease-in-out': 'transition-ease-in-out',
|
|
353
|
+
'ease-out-quint': 'transition-ease-out-quint',
|
|
354
|
+
'ease-in-quint': 'transition-ease-in-quint',
|
|
355
|
+
'ease-in-out-quint': 'transition-ease-in-out-quint',
|
|
356
|
+
'ease-out-expo': 'transition-ease-out-expo',
|
|
357
|
+
'ease-in-expo': 'transition-ease-in-expo',
|
|
358
|
+
'ease-in-out-expo': 'transition-ease-in-out-expo',
|
|
359
|
+
'ease-out-circ': 'transition-ease-out-circ',
|
|
360
|
+
'ease-in-circ': 'transition-ease-in-circ',
|
|
361
|
+
'ease-in-out-circ': 'transition-ease-in-out-circ'
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return (
|
|
365
|
+
<ul
|
|
366
|
+
ref={ref}
|
|
367
|
+
className={cn(
|
|
368
|
+
baseClasses,
|
|
369
|
+
easingClasses[easing],
|
|
370
|
+
'space-y-2',
|
|
371
|
+
className
|
|
372
|
+
)}
|
|
373
|
+
style={{
|
|
374
|
+
transitionDuration: `${duration}ms`,
|
|
375
|
+
transitionDelay: `${delay}ms`
|
|
376
|
+
}}
|
|
377
|
+
{...props}
|
|
378
|
+
>
|
|
379
|
+
{React.Children.map(children, (child, index) => {
|
|
380
|
+
if (React.isValidElement(child)) {
|
|
381
|
+
return React.cloneElement(child, {
|
|
382
|
+
style: {
|
|
383
|
+
...child.props.style,
|
|
384
|
+
transitionDelay: `${delay + (index * staggerDelay)}ms`
|
|
385
|
+
}
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
return child
|
|
389
|
+
})}
|
|
390
|
+
</ul>
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
AdvancedTransitionList.displayName = 'AdvancedTransitionList'
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { cn } from '../../../lib/utils'
|
|
3
|
+
import { useAnimationProfile } from '../../../hooks/use-animation-profile'
|
|
4
|
+
|
|
5
|
+
export interface AnimatedContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
animation?: 'fadeIn' | 'slideIn' | 'scaleIn' | 'bounce' | 'none'
|
|
7
|
+
duration?: 'fast' | 'normal' | 'slow'
|
|
8
|
+
easing?: 'ease' | 'easeIn' | 'easeOut' | 'easeInOut' | 'bounce'
|
|
9
|
+
delay?: number
|
|
10
|
+
stagger?: number
|
|
11
|
+
onAnimationStart?: () => void
|
|
12
|
+
onAnimationEnd?: () => void
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const AnimatedContainer = forwardRef<HTMLDivElement, AnimatedContainerProps>(
|
|
17
|
+
(
|
|
18
|
+
{
|
|
19
|
+
animation = 'fadeIn',
|
|
20
|
+
duration = 'normal',
|
|
21
|
+
easing = 'ease',
|
|
22
|
+
delay = 0,
|
|
23
|
+
stagger = 0,
|
|
24
|
+
onAnimationStart,
|
|
25
|
+
onAnimationEnd,
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
},
|
|
30
|
+
ref
|
|
31
|
+
) => {
|
|
32
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
33
|
+
// Use the forwarded ref if provided, otherwise use local ref
|
|
34
|
+
const finalRef = ref || containerRef
|
|
35
|
+
const [isAnimating, setIsAnimating] = useState(false)
|
|
36
|
+
const [hasAnimated, setHasAnimated] = useState(false)
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
getOptimizedDuration,
|
|
40
|
+
getOptimizedEasing,
|
|
41
|
+
getAnimationClasses,
|
|
42
|
+
shouldDisableAnimations
|
|
43
|
+
} = useAnimationProfile()
|
|
44
|
+
|
|
45
|
+
const optimizedDuration = getOptimizedDuration(duration)
|
|
46
|
+
const optimizedEasing = getOptimizedEasing(easing)
|
|
47
|
+
const animationClasses = getAnimationClasses()
|
|
48
|
+
const shouldDisable = shouldDisableAnimations()
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (shouldDisable || animation === 'none') {
|
|
52
|
+
setHasAnimated(true)
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const element = containerRef.current
|
|
57
|
+
if (!element) return
|
|
58
|
+
|
|
59
|
+
const startAnimation = () => {
|
|
60
|
+
setIsAnimating(true)
|
|
61
|
+
onAnimationStart?.()
|
|
62
|
+
|
|
63
|
+
// Apply initial state
|
|
64
|
+
element.style.opacity = '0'
|
|
65
|
+
element.style.transform = getInitialTransform(animation)
|
|
66
|
+
|
|
67
|
+
// Apply animation
|
|
68
|
+
const animationOptions: KeyframeAnimationOptions = {
|
|
69
|
+
duration: parseFloat(optimizedDuration) * 1000,
|
|
70
|
+
easing: optimizedEasing,
|
|
71
|
+
delay: (delay + stagger) * 1000,
|
|
72
|
+
fill: 'forwards'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const keyframes = getKeyframes(animation)
|
|
76
|
+
const anim = element.animate(keyframes, animationOptions)
|
|
77
|
+
|
|
78
|
+
anim.onfinish = () => {
|
|
79
|
+
setIsAnimating(false)
|
|
80
|
+
setHasAnimated(true)
|
|
81
|
+
onAnimationEnd?.()
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Small delay to ensure DOM is ready
|
|
86
|
+
const timer = setTimeout(startAnimation, 50)
|
|
87
|
+
|
|
88
|
+
return () => {
|
|
89
|
+
clearTimeout(timer)
|
|
90
|
+
if (element.getAnimations) {
|
|
91
|
+
element.getAnimations().forEach(anim => anim.cancel())
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, [animation, optimizedDuration, optimizedEasing, delay, stagger, shouldDisable, onAnimationStart, onAnimationEnd])
|
|
95
|
+
|
|
96
|
+
const getInitialTransform = (anim: string): string => {
|
|
97
|
+
switch (anim) {
|
|
98
|
+
case 'slideIn':
|
|
99
|
+
return 'translateX(-100%)'
|
|
100
|
+
case 'scaleIn':
|
|
101
|
+
return 'scale(0.8)'
|
|
102
|
+
case 'bounce':
|
|
103
|
+
return 'translateY(-20px)'
|
|
104
|
+
default:
|
|
105
|
+
return 'none'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const getKeyframes = (anim: string): Keyframe[] => {
|
|
110
|
+
switch (anim) {
|
|
111
|
+
case 'fadeIn':
|
|
112
|
+
return [
|
|
113
|
+
{ opacity: 0, transform: 'none' },
|
|
114
|
+
{ opacity: 1, transform: 'none' }
|
|
115
|
+
]
|
|
116
|
+
case 'slideIn':
|
|
117
|
+
return [
|
|
118
|
+
{ opacity: 0, transform: 'translateX(-100%)' },
|
|
119
|
+
{ opacity: 1, transform: 'translateX(0)' }
|
|
120
|
+
]
|
|
121
|
+
case 'scaleIn':
|
|
122
|
+
return [
|
|
123
|
+
{ opacity: 0, transform: 'scale(0.8)' },
|
|
124
|
+
{ opacity: 1, transform: 'scale(1)' }
|
|
125
|
+
]
|
|
126
|
+
case 'bounce':
|
|
127
|
+
return [
|
|
128
|
+
{ opacity: 0, transform: 'translateY(-20px)' },
|
|
129
|
+
{ opacity: 1, transform: 'translateY(0)' }
|
|
130
|
+
]
|
|
131
|
+
default:
|
|
132
|
+
return [
|
|
133
|
+
{ opacity: 0 },
|
|
134
|
+
{ opacity: 1 }
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const containerClassName = cn(
|
|
140
|
+
'coach-stan-animation-base',
|
|
141
|
+
animationClasses,
|
|
142
|
+
{
|
|
143
|
+
'opacity-0': !hasAnimated && !shouldDisable,
|
|
144
|
+
'pointer-events-none': isAnimating
|
|
145
|
+
},
|
|
146
|
+
className
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<div
|
|
151
|
+
ref={finalRef}
|
|
152
|
+
className={containerClassName}
|
|
153
|
+
style={{
|
|
154
|
+
'--animation-duration': optimizedDuration,
|
|
155
|
+
'--animation-easing': optimizedEasing,
|
|
156
|
+
'--animation-delay': `${delay + stagger}s`
|
|
157
|
+
} as React.CSSProperties}
|
|
158
|
+
{...props}
|
|
159
|
+
>
|
|
160
|
+
{children}
|
|
161
|
+
</div>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
AnimatedContainer.displayName = 'AnimatedContainer'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export { AnimatedContainer } from './animated-container'
|
|
2
|
+
export type { AnimatedContainerProps } from './animated-container'
|
|
3
|
+
|
|
4
|
+
export { StaggeredContainer } from './staggered-container'
|
|
5
|
+
export type { StaggeredContainerProps } from './staggered-container'
|
|
6
|
+
|
|
7
|
+
// Re-export animation profile hook for convenience
|
|
8
|
+
export {
|
|
9
|
+
useAnimationProfile,
|
|
10
|
+
useAnimationDuration,
|
|
11
|
+
useAnimationEasing,
|
|
12
|
+
useAnimationClasses,
|
|
13
|
+
usePerformanceMode
|
|
14
|
+
} from '../../../hooks/use-animation-profile'
|
|
15
|
+
|
|
16
|
+
export type {
|
|
17
|
+
AnimationProfile,
|
|
18
|
+
PerformanceMetrics
|
|
19
|
+
} from '../../../hooks/use-animation-profile'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { Children, cloneElement, isValidElement, ReactElement } from 'react'
|
|
2
|
+
import { cn } from '../../../lib/utils'
|
|
3
|
+
import { AnimatedContainer, AnimatedContainerProps } from './animated-container'
|
|
4
|
+
|
|
5
|
+
export interface StaggeredContainerProps extends Omit<AnimatedContainerProps, 'children'> {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
staggerDelay?: number
|
|
8
|
+
staggerDirection?: 'forward' | 'reverse' | 'center'
|
|
9
|
+
staggerEasing?: 'linear' | 'ease' | 'easeIn' | 'easeOut' | 'easeInOut'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const StaggeredContainer: React.FC<StaggeredContainerProps> = ({
|
|
13
|
+
children,
|
|
14
|
+
staggerDelay = 0.1,
|
|
15
|
+
staggerDirection = 'forward',
|
|
16
|
+
staggerEasing = 'ease',
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const childrenArray = Children.toArray(children)
|
|
21
|
+
const totalChildren = childrenArray.length
|
|
22
|
+
|
|
23
|
+
const getStaggerDelay = (index: number): number => {
|
|
24
|
+
switch (staggerDirection) {
|
|
25
|
+
case 'reverse':
|
|
26
|
+
return (totalChildren - 1 - index) * staggerDelay
|
|
27
|
+
case 'center':
|
|
28
|
+
const centerIndex = Math.floor(totalChildren / 2)
|
|
29
|
+
const distanceFromCenter = Math.abs(index - centerIndex)
|
|
30
|
+
return distanceFromCenter * staggerDelay
|
|
31
|
+
case 'forward':
|
|
32
|
+
default:
|
|
33
|
+
return index * staggerDelay
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const renderChild = (child: React.ReactNode, index: number): ReactElement | null => {
|
|
38
|
+
if (!isValidElement(child)) {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// If the child is already an AnimatedContainer, just add stagger
|
|
43
|
+
if (child.type === AnimatedContainer) {
|
|
44
|
+
return cloneElement(child, {
|
|
45
|
+
...child.props,
|
|
46
|
+
stagger: getStaggerDelay(index),
|
|
47
|
+
key: `staggered-${index}`
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Wrap non-animated children in AnimatedContainer
|
|
52
|
+
return (
|
|
53
|
+
<AnimatedContainer
|
|
54
|
+
key={`staggered-${index}`}
|
|
55
|
+
stagger={getStaggerDelay(index)}
|
|
56
|
+
{...props}
|
|
57
|
+
>
|
|
58
|
+
{child}
|
|
59
|
+
</AnimatedContainer>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<div className={cn('coach-stan-staggered-container', className)}>
|
|
65
|
+
{childrenArray.map((child, index) => renderChild(child, index))}
|
|
66
|
+
</div>
|
|
67
|
+
)
|
|
68
|
+
}
|