@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.1.4 → 0.1.6

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.
Files changed (164) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/dist/index.d.ts +131 -131
  3. package/dist/index.esm.js +148 -148
  4. package/dist/index.js +148 -148
  5. package/dist/styles.css +1 -1
  6. package/package.json +1 -1
  7. package/src/components/ui/accessibility-demo.tsx +271 -0
  8. package/src/components/ui/advanced-component-architecture-demo.tsx +916 -0
  9. package/src/components/ui/advanced-transition-system-demo.tsx +670 -0
  10. package/src/components/ui/advanced-transition-system.tsx +395 -0
  11. package/src/components/ui/animation/animated-container.tsx +166 -0
  12. package/src/components/ui/animation/index.ts +19 -0
  13. package/src/components/ui/animation/staggered-container.tsx +68 -0
  14. package/src/components/ui/animation-demo.tsx +250 -0
  15. package/src/components/ui/badge.tsx +33 -0
  16. package/src/components/ui/battery-conscious-animation-demo.tsx +568 -0
  17. package/src/components/ui/border-radius-shadow-demo.tsx +187 -0
  18. package/src/components/ui/button.tsx +36 -0
  19. package/src/components/ui/card.tsx +207 -0
  20. package/src/components/ui/checkbox.tsx +30 -0
  21. package/src/components/ui/color-preview.tsx +411 -0
  22. package/src/components/ui/data-display/chart.tsx +653 -0
  23. package/src/components/ui/data-display/data-grid-simple.tsx +76 -0
  24. package/src/components/ui/data-display/data-grid.tsx +680 -0
  25. package/src/components/ui/data-display/list.tsx +456 -0
  26. package/src/components/ui/data-display/table.tsx +482 -0
  27. package/src/components/ui/data-display/timeline.tsx +441 -0
  28. package/src/components/ui/data-display/tree.tsx +602 -0
  29. package/src/components/ui/data-display/types.ts +536 -0
  30. package/src/components/ui/enterprise-mobile-experience-demo.tsx +749 -0
  31. package/src/components/ui/enterprise-mobile-experience.tsx +464 -0
  32. package/src/components/ui/feedback/alert.tsx +157 -0
  33. package/src/components/ui/feedback/progress.tsx +292 -0
  34. package/src/components/ui/feedback/skeleton.tsx +185 -0
  35. package/src/components/ui/feedback/toast.tsx +280 -0
  36. package/src/components/ui/feedback/types.ts +125 -0
  37. package/src/components/ui/font-preview.tsx +288 -0
  38. package/src/components/ui/form-demo.tsx +553 -0
  39. package/src/components/ui/hardware-acceleration-demo.tsx +547 -0
  40. package/src/components/ui/input.tsx +35 -0
  41. package/src/components/ui/label.tsx +16 -0
  42. package/src/components/ui/layout-demo.tsx +367 -0
  43. package/src/components/ui/layouts/adaptive-layout.tsx +139 -0
  44. package/src/components/ui/layouts/desktop-layout.tsx +224 -0
  45. package/src/components/ui/layouts/index.ts +10 -0
  46. package/src/components/ui/layouts/mobile-layout.tsx +162 -0
  47. package/src/components/ui/layouts/tablet-layout.tsx +197 -0
  48. package/src/components/ui/mobile-form-validation.tsx +451 -0
  49. package/src/components/ui/mobile-input-demo.tsx +201 -0
  50. package/src/components/ui/mobile-input.tsx +281 -0
  51. package/src/components/ui/mobile-skeleton-loading-demo.tsx +638 -0
  52. package/src/components/ui/navigation/breadcrumb.tsx +158 -0
  53. package/src/components/ui/navigation/index.ts +36 -0
  54. package/src/components/ui/navigation/menu.tsx +374 -0
  55. package/src/components/ui/navigation/navigation-demo.tsx +324 -0
  56. package/src/components/ui/navigation/pagination.tsx +272 -0
  57. package/src/components/ui/navigation/sidebar.tsx +383 -0
  58. package/src/components/ui/navigation/stepper.tsx +303 -0
  59. package/src/components/ui/navigation/tabs.tsx +205 -0
  60. package/src/components/ui/navigation/types.ts +299 -0
  61. package/src/components/ui/overlay/backdrop.tsx +81 -0
  62. package/src/components/ui/overlay/focus-manager.tsx +143 -0
  63. package/src/components/ui/overlay/index.ts +36 -0
  64. package/src/components/ui/overlay/modal.tsx +270 -0
  65. package/src/components/ui/overlay/overlay-manager.tsx +110 -0
  66. package/src/components/ui/overlay/popover.tsx +462 -0
  67. package/src/components/ui/overlay/portal.tsx +79 -0
  68. package/src/components/ui/overlay/tooltip.tsx +303 -0
  69. package/src/components/ui/overlay/types.ts +196 -0
  70. package/src/components/ui/performance-demo.tsx +596 -0
  71. package/src/components/ui/semantic-input-system-demo.tsx +502 -0
  72. package/src/components/ui/semantic-input-system-demo.tsx.disabled +873 -0
  73. package/src/components/ui/tablet-layout.tsx +192 -0
  74. package/src/components/ui/theme-customizer.tsx +386 -0
  75. package/src/components/ui/theme-preview.tsx +310 -0
  76. package/src/components/ui/theme-switcher.tsx +264 -0
  77. package/src/components/ui/theme-toggle.tsx +38 -0
  78. package/src/components/ui/token-demo.tsx +195 -0
  79. package/src/components/ui/touch-demo.tsx +462 -0
  80. package/src/components/ui/touch-friendly-interface-demo.tsx +519 -0
  81. package/src/components/ui/touch-friendly-interface.tsx +296 -0
  82. package/src/hooks/index.ts +190 -0
  83. package/src/hooks/use-accessibility-support.ts +518 -0
  84. package/src/hooks/use-adaptive-layout.ts +289 -0
  85. package/src/hooks/use-advanced-patterns.ts +294 -0
  86. package/src/hooks/use-advanced-transition-system.ts +393 -0
  87. package/src/hooks/use-animation-profile.ts +288 -0
  88. package/src/hooks/use-battery-animations.ts +384 -0
  89. package/src/hooks/use-battery-conscious-loading.ts +475 -0
  90. package/src/hooks/use-battery-optimization.ts +330 -0
  91. package/src/hooks/use-battery-status.ts +299 -0
  92. package/src/hooks/use-component-performance.ts +344 -0
  93. package/src/hooks/use-device-loading-states.ts +459 -0
  94. package/src/hooks/use-device.tsx +110 -0
  95. package/src/hooks/use-enterprise-mobile-experience.ts +488 -0
  96. package/src/hooks/use-form-feedback.ts +403 -0
  97. package/src/hooks/use-form-performance.ts +513 -0
  98. package/src/hooks/use-frame-rate.ts +251 -0
  99. package/src/hooks/use-gestures.ts +338 -0
  100. package/src/hooks/use-hardware-acceleration.ts +341 -0
  101. package/src/hooks/use-input-accessibility.ts +455 -0
  102. package/src/hooks/use-input-performance.ts +506 -0
  103. package/src/hooks/use-layout-performance.ts +319 -0
  104. package/src/hooks/use-loading-accessibility.ts +535 -0
  105. package/src/hooks/use-loading-performance.ts +473 -0
  106. package/src/hooks/use-memory-usage.ts +287 -0
  107. package/src/hooks/use-mobile-form-layout.ts +464 -0
  108. package/src/hooks/use-mobile-form-validation.ts +518 -0
  109. package/src/hooks/use-mobile-keyboard-optimization.ts +472 -0
  110. package/src/hooks/use-mobile-layout.ts +302 -0
  111. package/src/hooks/use-mobile-optimization.ts +406 -0
  112. package/src/hooks/use-mobile-skeleton.ts +402 -0
  113. package/src/hooks/use-mobile-touch.ts +414 -0
  114. package/src/hooks/use-performance-throttling.ts +348 -0
  115. package/src/hooks/use-performance.ts +316 -0
  116. package/src/hooks/use-reusable-architecture.ts +414 -0
  117. package/src/hooks/use-semantic-input-types.ts +357 -0
  118. package/src/hooks/use-semantic-input.ts +565 -0
  119. package/src/hooks/use-tablet-layout.ts +384 -0
  120. package/src/hooks/use-touch-friendly-input.ts +524 -0
  121. package/src/hooks/use-touch-friendly-interface.ts +331 -0
  122. package/src/hooks/use-touch-optimization.ts +375 -0
  123. package/src/index.ts +279 -279
  124. package/src/lib/utils.ts +6 -0
  125. package/src/themes/README.md +272 -0
  126. package/src/themes/ThemeContext.tsx +31 -0
  127. package/src/themes/ThemeProvider.tsx +232 -0
  128. package/src/themes/accessibility/index.ts +27 -0
  129. package/src/themes/accessibility.ts +259 -0
  130. package/src/themes/aria-patterns.ts +420 -0
  131. package/src/themes/base-themes.ts +55 -0
  132. package/src/themes/colorManager.ts +380 -0
  133. package/src/themes/examples/dark-theme.ts +154 -0
  134. package/src/themes/examples/minimal-theme.ts +108 -0
  135. package/src/themes/focus-management.ts +701 -0
  136. package/src/themes/fontLoader.ts +201 -0
  137. package/src/themes/high-contrast.ts +621 -0
  138. package/src/themes/index.ts +19 -0
  139. package/src/themes/inheritance.ts +227 -0
  140. package/src/themes/keyboard-navigation.ts +550 -0
  141. package/src/themes/motion-reduction.ts +662 -0
  142. package/src/themes/navigation.ts +238 -0
  143. package/src/themes/screen-reader.ts +645 -0
  144. package/src/themes/systemThemeDetector.ts +182 -0
  145. package/src/themes/themeCSSUpdater.ts +262 -0
  146. package/src/themes/themePersistence.ts +238 -0
  147. package/src/themes/themes/default.ts +586 -0
  148. package/src/themes/themes/harvey.ts +554 -0
  149. package/src/themes/themes/stan-design.ts +683 -0
  150. package/src/themes/types.ts +460 -0
  151. package/src/themes/useSystemTheme.ts +48 -0
  152. package/src/themes/useTheme.ts +87 -0
  153. package/src/themes/validation.ts +462 -0
  154. package/src/tokens/index.ts +34 -0
  155. package/src/tokens/tokenExporter.ts +397 -0
  156. package/src/tokens/tokenGenerator.ts +276 -0
  157. package/src/tokens/tokenManager.ts +248 -0
  158. package/src/tokens/tokenValidator.ts +543 -0
  159. package/src/tokens/types.ts +78 -0
  160. package/src/utils/bundle-analyzer.ts +260 -0
  161. package/src/utils/bundle-splitting.ts +483 -0
  162. package/src/utils/lazy-loading.ts +441 -0
  163. package/src/utils/performance-monitor.ts +513 -0
  164. package/src/utils/tree-shaking.ts +274 -0
@@ -0,0 +1,547 @@
1
+ import React, { useState, useCallback, useEffect } from 'react'
2
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from './card'
3
+ import { Badge } from './badge'
4
+ import { Button } from './button'
5
+ import { useHardwareAcceleration } from '../../hooks/use-hardware-acceleration'
6
+ import { useBatteryOptimization } from '../../hooks/use-battery-optimization'
7
+
8
+ export const HardwareAccelerationDemo: React.FC = () => {
9
+ const [showGPUInfo, setShowGPUInfo] = useState(true)
10
+ const [showPerformanceMetrics, setShowPerformanceMetrics] = useState(true)
11
+ const [showBatteryInfo, setShowBatteryInfo] = useState(true)
12
+ const [enableHardwareAcceleration, setEnableHardwareAcceleration] = useState(true)
13
+ const [enableBatteryOptimization, setEnableBatteryOptimization] = useState(true)
14
+ const [error, setError] = useState<string | null>(null)
15
+
16
+ // Hooks with error handling
17
+ const hardwareAcceleration = useHardwareAcceleration({
18
+ enableGPUMonitoring: true,
19
+ enablePerformanceTracking: true,
20
+ enableBatteryOptimization: true,
21
+ enableAutomaticOptimization: true
22
+ }, {
23
+ onGPUDetected: (gpuInfo) => console.log('GPU detected:', gpuInfo),
24
+ onPerformanceWarning: (warning, metrics) => console.log('Performance warning:', warning, metrics),
25
+ onBatteryWarning: (level, isLow) => console.log('Battery warning:', level, isLow),
26
+ onOptimizationApplied: (optimization) => console.log('Optimization applied:', optimization)
27
+ })
28
+
29
+ const batteryOptimization = useBatteryOptimization({
30
+ enableBatteryMonitoring: true,
31
+ enablePerformanceThrottling: true,
32
+ enableUserPreferences: true,
33
+ enableAdaptiveOptimization: true
34
+ }, {
35
+ onBatteryStatusChange: (status) => console.log('Battery status changed:', status),
36
+ onLowBatteryWarning: (status) => console.log('Low battery warning:', status),
37
+ onCriticalBatteryWarning: (status) => console.log('Critical battery warning:', status),
38
+ onPerformanceThrottled: (level, reason) => console.log('Performance throttled:', level, reason),
39
+ onOptimizationApplied: (optimization) => console.log('Battery optimization applied:', optimization)
40
+ })
41
+
42
+ // Error boundary effect
43
+ useEffect(() => {
44
+ const handleError = (error: ErrorEvent) => {
45
+ console.error('Hardware acceleration demo error:', error)
46
+ setError(error.message)
47
+ }
48
+
49
+ window.addEventListener('error', handleError)
50
+ return () => window.removeEventListener('error', handleError)
51
+ }, [])
52
+
53
+ // Demo animations with hardware acceleration
54
+ const [animationState, setAnimationState] = useState<'idle' | 'running' | 'paused'>('idle')
55
+ const [animationType, setAnimationType] = useState<'basic' | 'gpu' | 'transform3d' | 'performance'>('basic')
56
+
57
+ const startAnimation = useCallback(() => {
58
+ setAnimationState('running')
59
+ setTimeout(() => setAnimationState('idle'), 3000)
60
+ }, [])
61
+
62
+ const pauseAnimation = useCallback(() => {
63
+ setAnimationState('paused')
64
+ }, [])
65
+
66
+ const resumeAnimation = useCallback(() => {
67
+ setAnimationState('running')
68
+ }, [])
69
+
70
+ // Get animation classes based on type
71
+ const getAnimationClasses = useCallback((type: string) => {
72
+ const baseClasses = 'w-32 h-32 rounded-lg transition-all duration-1000 ease-in-out'
73
+
74
+ switch (type) {
75
+ case 'basic':
76
+ return `${baseClasses} bg-cs-primary hover:bg-cs-secondary`
77
+ case 'gpu':
78
+ return `${baseClasses} bg-cs-secondary gpu-optimized hover:bg-cs-accent`
79
+ case 'transform3d':
80
+ return `${baseClasses} bg-cs-accent transform3d-optimized hover:bg-cs-primary`
81
+ case 'performance':
82
+ return `${baseClasses} bg-cs-primary performance-accelerated hover:bg-cs-secondary`
83
+ default:
84
+ return baseClasses
85
+ }
86
+ }, [])
87
+
88
+ // Get animation styles based on state
89
+ const getAnimationStyles = useCallback((state: string) => {
90
+ switch (state) {
91
+ case 'running':
92
+ return {
93
+ transform: 'translate3d(100px, 0, 0) rotate(360deg) scale(1.2)',
94
+ opacity: 0.8
95
+ }
96
+ case 'paused':
97
+ return {
98
+ transform: 'translate3d(50px, 0, 0) rotate(180deg) scale(1.1)',
99
+ opacity: 0.9
100
+ }
101
+ default:
102
+ return {
103
+ transform: 'translate3d(0, 0, 0) rotate(0deg) scale(1)',
104
+ opacity: 1
105
+ }
106
+ }
107
+ }, [])
108
+
109
+ // Show error if any
110
+ if (error) {
111
+ return (
112
+ <div className="p-6 bg-red-50 border border-red-200 rounded-lg">
113
+ <h2 className="text-lg font-semibold text-red-800 mb-2">Error Loading Hardware Acceleration Demo</h2>
114
+ <p className="text-red-600 mb-4">{error}</p>
115
+ <Button onClick={() => setError(null)} variant="outline">
116
+ Try Again
117
+ </Button>
118
+ </div>
119
+ )
120
+ }
121
+
122
+ return (
123
+ <div className="space-y-6">
124
+ <div className="text-center">
125
+ <h1 className="text-3xl font-bold text-cs-text-primary mb-2">
126
+ 🚀 Hardware Acceleration & GPU Optimization
127
+ </h1>
128
+ <p className="text-lg text-cs-text-secondary mb-4">
129
+ Story 8 Implementation - Advanced hardware acceleration with GPU optimization and battery awareness
130
+ </p>
131
+ <div className="flex items-center justify-center gap-2">
132
+ <Badge variant="default">Story 8</Badge>
133
+ <Badge variant="outline">Hardware Acceleration</Badge>
134
+ <Badge variant="secondary">GPU Optimization</Badge>
135
+ <Badge variant="outline">Battery Optimization</Badge>
136
+ </div>
137
+ </div>
138
+
139
+ {/* GPU Information */}
140
+ {showGPUInfo && hardwareAcceleration.gpuInfo && (
141
+ <Card className="border-2 border-cs-primary">
142
+ <CardHeader>
143
+ <CardTitle className="text-xl flex items-center gap-2">
144
+ 🎮 GPU Information
145
+ <Badge variant={hardwareAcceleration.isGPUSupported ? 'default' : 'secondary'}>
146
+ {hardwareAcceleration.isGPUSupported ? 'Supported' : 'Not Supported'}
147
+ </Badge>
148
+ </CardTitle>
149
+ <CardDescription>
150
+ Real-time GPU capability detection and WebGL support information
151
+ </CardDescription>
152
+ </CardHeader>
153
+ <CardContent>
154
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
155
+ <div className="space-y-2">
156
+ <div className="flex justify-between">
157
+ <span className="text-sm font-medium">Vendor:</span>
158
+ <span className="text-sm text-cs-text-secondary">{hardwareAcceleration.gpuInfo.vendor}</span>
159
+ </div>
160
+ <div className="flex justify-between">
161
+ <span className="text-sm font-medium">Renderer:</span>
162
+ <span className="text-sm text-cs-text-secondary">{hardwareAcceleration.gpuInfo.renderer}</span>
163
+ </div>
164
+ <div className="flex justify-between">
165
+ <span className="text-sm font-medium">Version:</span>
166
+ <span className="text-sm text-cs-text-secondary">{hardwareAcceleration.gpuInfo.version}</span>
167
+ </div>
168
+ </div>
169
+ <div className="space-y-2">
170
+ <div className="flex justify-between">
171
+ <span className="text-sm font-medium">WebGL Support:</span>
172
+ <Badge variant={hardwareAcceleration.gpuInfo.isWebGLSupported ? 'default' : 'secondary'}>
173
+ {hardwareAcceleration.gpuInfo.isWebGLSupported ? 'Yes' : 'No'}
174
+ </Badge>
175
+ </div>
176
+ <div className="flex justify-between">
177
+ <span className="text-sm font-medium">WebGL2 Support:</span>
178
+ <Badge variant={hardwareAcceleration.gpuInfo.isWebGL2Supported ? 'default' : 'secondary'}>
179
+ {hardwareAcceleration.gpuInfo.isWebGL2Supported ? 'Yes' : 'No'}
180
+ </Badge>
181
+ </div>
182
+ <div className="flex justify-between">
183
+ <span className="text-sm font-medium">Max Texture Size:</span>
184
+ <span className="text-sm text-cs-text-secondary">{hardwareAcceleration.gpuInfo.maxTextureSize}</span>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ </CardContent>
189
+ </Card>
190
+ )}
191
+
192
+ {/* Performance Metrics */}
193
+ {showPerformanceMetrics && (
194
+ <Card className="border-2 border-cs-secondary">
195
+ <CardHeader>
196
+ <CardTitle className="text-xl flex items-center gap-2">
197
+ 📊 Performance Metrics
198
+ <Badge variant="outline">Real-time</Badge>
199
+ </CardTitle>
200
+ <CardDescription>
201
+ Hardware acceleration performance monitoring and optimization status
202
+ </CardDescription>
203
+ </CardHeader>
204
+ <CardContent>
205
+ <div className="grid grid-cols-2 lg:grid-cols-4 gap-4 text-center">
206
+ <div>
207
+ <p className="text-2xl font-bold text-cs-primary">
208
+ {hardwareAcceleration.metrics.fps}
209
+ </p>
210
+ <p className="text-sm text-cs-text-secondary">FPS</p>
211
+ </div>
212
+ <div>
213
+ <p className="text-2xl font-bold text-cs-secondary">
214
+ {hardwareAcceleration.metrics.frameTime.toFixed(1)}ms
215
+ </p>
216
+ <p className="text-sm text-cs-text-secondary">Frame Time</p>
217
+ </div>
218
+ <div>
219
+ <p className="text-2xl font-bold text-cs-accent">
220
+ {hardwareAcceleration.metrics.gpuUtilization.toFixed(1)}%
221
+ </p>
222
+ <p className="text-sm text-cs-text-secondary">GPU Usage</p>
223
+ </div>
224
+ <div>
225
+ <p className="text-2xl font-bold text-cs-primary">
226
+ {hardwareAcceleration.metrics.performanceScore}
227
+ </p>
228
+ <p className="text-sm text-cs-text-secondary">Performance Score</p>
229
+ </div>
230
+ </div>
231
+
232
+ <div className="mt-4 p-3 bg-cs-accent/10 rounded-lg">
233
+ <div className="flex items-center justify-between mb-2">
234
+ <span className="font-medium text-sm">Performance Level:</span>
235
+ <Badge variant={
236
+ hardwareAcceleration.performanceLevel === 'excellent' ? 'default' :
237
+ hardwareAcceleration.performanceLevel === 'good' ? 'default' :
238
+ hardwareAcceleration.performanceLevel === 'fair' ? 'secondary' : 'secondary'
239
+ }>
240
+ {hardwareAcceleration.performanceLevel.toUpperCase()}
241
+ </Badge>
242
+ </div>
243
+ <div className="flex items-center justify-between">
244
+ <span className="font-medium text-sm">Hardware Acceleration:</span>
245
+ <Badge variant={hardwareAcceleration.isHardwareAccelerated ? 'default' : 'secondary'}>
246
+ {hardwareAcceleration.isHardwareAccelerated ? 'Enabled' : 'Disabled'}
247
+ </Badge>
248
+ </div>
249
+ </div>
250
+ </CardContent>
251
+ </Card>
252
+ )}
253
+
254
+ {/* Battery Information */}
255
+ {showBatteryInfo && (
256
+ <Card className="border-2 border-cs-accent">
257
+ <CardHeader>
258
+ <CardTitle className="text-xl flex items-center gap-2">
259
+ 🔋 Battery Optimization
260
+ <Badge variant={batteryOptimization.isLowBattery ? 'secondary' : 'default'}>
261
+ {batteryOptimization.batteryPercentage}%
262
+ </Badge>
263
+ </CardTitle>
264
+ <CardDescription>
265
+ Battery-aware performance optimization and user preference management
266
+ </CardDescription>
267
+ </CardHeader>
268
+ <CardContent>
269
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
270
+ <div className="space-y-3">
271
+ <h4 className="font-medium">Battery Status</h4>
272
+ <div className="space-y-2">
273
+ <div className="flex justify-between">
274
+ <span className="text-sm">Level:</span>
275
+ <span className="text-sm text-cs-text-secondary">{batteryOptimization.batteryPercentage}%</span>
276
+ </div>
277
+ <div className="flex justify-between">
278
+ <span className="text-sm">Status:</span>
279
+ <Badge variant={batteryOptimization.isCharging ? 'default' : 'secondary'}>
280
+ {batteryOptimization.isCharging ? 'Charging' : 'Discharging'}
281
+ </Badge>
282
+ </div>
283
+ <div className="flex justify-between">
284
+ <span className="text-sm">Health:</span>
285
+ <Badge variant="outline">{batteryOptimization.getBatteryHealth()}</Badge>
286
+ </div>
287
+ </div>
288
+ </div>
289
+
290
+ <div className="space-y-3">
291
+ <h4 className="font-medium">Performance Settings</h4>
292
+ <div className="space-y-2">
293
+ <div className="flex justify-between">
294
+ <span className="text-sm">Throttle Level:</span>
295
+ <Badge variant="outline">{batteryOptimization.currentThrottleLevel}</Badge>
296
+ </div>
297
+ <div className="flex justify-between">
298
+ <span className="text-sm">User Preference:</span>
299
+ <Badge variant="outline">{batteryOptimization.userPreferences}</Badge>
300
+ </div>
301
+ <div className="flex justify-between">
302
+ <span className="text-sm">Optimization:</span>
303
+ <Badge variant={batteryOptimization.isOptimizing ? 'secondary' : 'default'}>
304
+ {batteryOptimization.isOptimizing ? 'Active' : 'Idle'}
305
+ </Badge>
306
+ </div>
307
+ </div>
308
+ </div>
309
+ </div>
310
+
311
+ {/* User Preference Controls */}
312
+ <div className="mt-4 p-3 bg-cs-accent/10 rounded-lg">
313
+ <h4 className="font-medium text-sm mb-2">User Preference:</h4>
314
+ <div className="flex gap-2">
315
+ <Button
316
+ variant={batteryOptimization.userPreferences === 'performance' ? 'default' : 'outline'}
317
+ size="sm"
318
+ onClick={() => batteryOptimization.updateUserPreferences('performance')}
319
+ >
320
+ Performance
321
+ </Button>
322
+ <Button
323
+ variant={batteryOptimization.userPreferences === 'balanced' ? 'default' : 'outline'}
324
+ size="sm"
325
+ onClick={() => batteryOptimization.updateUserPreferences('balanced')}
326
+ >
327
+ Balanced
328
+ </Button>
329
+ <Button
330
+ variant={batteryOptimization.userPreferences === 'battery' ? 'default' : 'outline'}
331
+ size="sm"
332
+ onClick={() => batteryOptimization.updateUserPreferences('battery')}
333
+ >
334
+ Battery
335
+ </Button>
336
+ </div>
337
+ </div>
338
+ </CardContent>
339
+ </Card>
340
+ )}
341
+
342
+ {/* Hardware Acceleration Demo */}
343
+ <Card className="border border-cs-border">
344
+ <CardHeader>
345
+ <CardTitle className="text-lg">Hardware Acceleration Demo</CardTitle>
346
+ <CardDescription>
347
+ Test different types of hardware acceleration with real-time animations
348
+ </CardDescription>
349
+ </CardHeader>
350
+ <CardContent className="space-y-4">
351
+ {/* Animation Type Selection */}
352
+ <div className="flex flex-wrap gap-2">
353
+ <Button
354
+ variant={animationType === 'basic' ? 'default' : 'outline'}
355
+ size="sm"
356
+ onClick={() => setAnimationType('basic')}
357
+ >
358
+ Basic
359
+ </Button>
360
+ <Button
361
+ variant={animationType === 'gpu' ? 'default' : 'outline'}
362
+ size="sm"
363
+ onClick={() => setAnimationType('gpu')}
364
+ >
365
+ GPU Optimized
366
+ </Button>
367
+ <Button
368
+ variant={animationType === 'transform3d' ? 'default' : 'outline'}
369
+ size="sm"
370
+ onClick={() => setAnimationType('transform3d')}
371
+ >
372
+ Transform3D
373
+ </Button>
374
+ <Button
375
+ variant={animationType === 'performance' ? 'default' : 'outline'}
376
+ size="sm"
377
+ onClick={() => setAnimationType('performance')}
378
+ >
379
+ Performance
380
+ </Button>
381
+ </div>
382
+
383
+ {/* Animation Controls */}
384
+ <div className="flex gap-2">
385
+ <Button
386
+ variant="default"
387
+ onClick={startAnimation}
388
+ disabled={animationState === 'running'}
389
+ >
390
+ Start Animation
391
+ </Button>
392
+ <Button
393
+ variant="outline"
394
+ onClick={pauseAnimation}
395
+ disabled={animationState !== 'running'}
396
+ >
397
+ Pause
398
+ </Button>
399
+ <Button
400
+ variant="outline"
401
+ onClick={resumeAnimation}
402
+ disabled={animationState !== 'paused'}
403
+ >
404
+ Resume
405
+ </Button>
406
+ </div>
407
+
408
+ {/* Animation Display */}
409
+ <div className="flex justify-center">
410
+ <div
411
+ className={getAnimationClasses(animationType)}
412
+ style={getAnimationStyles(animationState)}
413
+ />
414
+ </div>
415
+
416
+ {/* Animation Info */}
417
+ <div className="text-center text-sm text-cs-text-secondary">
418
+ <p>Animation Type: <span className="font-medium">{animationType}</span></p>
419
+ <p>State: <span className="font-medium">{animationState}</span></p>
420
+ <p>Hardware Acceleration: <span className="font-medium">
421
+ {hardwareAcceleration.isHardwareAccelerated ? 'Enabled' : 'Disabled'}
422
+ </span></p>
423
+ </div>
424
+ </CardContent>
425
+ </Card>
426
+
427
+ {/* Controls */}
428
+ <Card className="border border-cs-border">
429
+ <CardHeader>
430
+ <CardTitle className="text-lg">Demo Controls</CardTitle>
431
+ <CardDescription>
432
+ Configure and test different hardware acceleration features
433
+ </CardDescription>
434
+ </CardHeader>
435
+ <CardContent className="space-y-4">
436
+ <div className="flex flex-wrap gap-4">
437
+ <Button
438
+ variant={showGPUInfo ? 'default' : 'outline'}
439
+ size="sm"
440
+ onClick={() => setShowGPUInfo(!showGPUInfo)}
441
+ >
442
+ {showGPUInfo ? 'Hide' : 'Show'} GPU Info
443
+ </Button>
444
+ <Button
445
+ variant={showPerformanceMetrics ? 'default' : 'outline'}
446
+ size="sm"
447
+ onClick={() => setShowPerformanceMetrics(!showPerformanceMetrics)}
448
+ >
449
+ {showPerformanceMetrics ? 'Hide' : 'Show'} Performance
450
+ </Button>
451
+ <Button
452
+ variant={showBatteryInfo ? 'default' : 'outline'}
453
+ size="sm"
454
+ onClick={() => setShowBatteryInfo(!showBatteryInfo)}
455
+ >
456
+ {showBatteryInfo ? 'Hide' : 'Show'} Battery Info
457
+ </Button>
458
+ </div>
459
+
460
+ <div className="flex flex-wrap gap-4">
461
+ <Button
462
+ variant={enableHardwareAcceleration ? 'default' : 'outline'}
463
+ size="sm"
464
+ onClick={() => setEnableHardwareAcceleration(!enableHardwareAcceleration)}
465
+ >
466
+ {enableHardwareAcceleration ? 'Disable' : 'Enable'} Hardware Acceleration
467
+ </Button>
468
+ <Button
469
+ variant={enableBatteryOptimization ? 'default' : 'outline'}
470
+ size="sm"
471
+ onClick={() => setEnableBatteryOptimization(!enableBatteryOptimization)}
472
+ >
473
+ {enableBatteryOptimization ? 'Disable' : 'Enable'} Battery Optimization
474
+ </Button>
475
+ </div>
476
+ </CardContent>
477
+ </Card>
478
+
479
+ {/* Optimization Status */}
480
+ <Card className="border border-cs-border">
481
+ <CardHeader>
482
+ <CardTitle className="text-lg">Optimization Status</CardTitle>
483
+ <CardDescription>
484
+ Current optimization status and recommendations
485
+ </CardDescription>
486
+ </CardHeader>
487
+ <CardContent>
488
+ <div className="space-y-3">
489
+ <div className="flex items-center justify-between">
490
+ <span className="text-sm">Hardware Acceleration:</span>
491
+ <Badge variant={hardwareAcceleration.isHardwareAccelerated ? 'default' : 'secondary'}>
492
+ {hardwareAcceleration.isHardwareAccelerated ? 'Optimal' : 'Needs Optimization'}
493
+ </Badge>
494
+ </div>
495
+ <div className="flex items-center justify-between">
496
+ <span className="text-sm">Performance Level:</span>
497
+ <Badge variant={
498
+ hardwareAcceleration.performanceLevel === 'excellent' || hardwareAcceleration.performanceLevel === 'good'
499
+ ? 'default' : 'secondary'
500
+ }>
501
+ {hardwareAcceleration.performanceLevel.toUpperCase()}
502
+ </Badge>
503
+ </div>
504
+ <div className="flex items-center justify-between">
505
+ <span className="text-sm">Battery Optimization:</span>
506
+ <Badge variant={batteryOptimization.isLowBattery ? 'secondary' : 'default'}>
507
+ {batteryOptimization.isLowBattery ? 'Needs Optimization' : 'Optimized'}
508
+ </Badge>
509
+ </div>
510
+ <div className="flex items-center justify-between">
511
+ <span className="text-sm">GPU Utilization:</span>
512
+ <Badge variant={hardwareAcceleration.metrics.gpuUtilization < 80 ? 'default' : 'secondary'}>
513
+ {hardwareAcceleration.metrics.gpuUtilization < 80 ? 'Optimal' : 'High Usage'}
514
+ </Badge>
515
+ </div>
516
+ </div>
517
+
518
+ {/* Recent Optimizations */}
519
+ {hardwareAcceleration.optimizations.length > 0 && (
520
+ <div className="mt-4 p-3 bg-cs-accent/10 rounded-lg">
521
+ <h4 className="font-medium text-sm mb-2">Recent Optimizations:</h4>
522
+ <ul className="text-xs text-cs-text-secondary space-y-1">
523
+ {hardwareAcceleration.optimizations.slice(-3).map((optimization, index) => (
524
+ <li key={index}>• {optimization}</li>
525
+ ))}
526
+ </ul>
527
+ </div>
528
+ )}
529
+
530
+ {/* Battery Recommendations */}
531
+ {batteryOptimization.optimizationRecommendations.length > 0 && (
532
+ <div className="mt-4 p-3 bg-cs-secondary/10 rounded-lg">
533
+ <h4 className="font-medium text-sm mb-2">Battery Recommendations:</h4>
534
+ <ul className="text-xs text-cs-text-secondary space-y-1">
535
+ {batteryOptimization.optimizationRecommendations.slice(0, 3).map((recommendation, index) => (
536
+ <li key={index}>• {recommendation}</li>
537
+ ))}
538
+ </ul>
539
+ </div>
540
+ )}
541
+ </CardContent>
542
+ </Card>
543
+ </div>
544
+ )
545
+ }
546
+
547
+ export default HardwareAccelerationDemo
@@ -0,0 +1,35 @@
1
+ import * as React from "react"
2
+
3
+ export interface InputProps
4
+ extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
5
+ variant?: 'default' | 'error' | 'success' | 'warning' | 'loading'
6
+ size?: 'sm' | 'md' | 'lg' | 'xl'
7
+ state?: 'normal' | 'focused' | 'disabled' | 'readonly'
8
+ }
9
+
10
+ const Input = React.forwardRef<HTMLInputElement, InputProps>(
11
+ ({ className, type = 'text', variant = 'default', size = 'md', state = 'normal', ...props }, ref) => {
12
+ // Build semantic CSS classes using BEM methodology
13
+ const baseClass = 'input'
14
+ const variantClass = `input--variant-${variant}`
15
+ const sizeClass = `input--size-${size}`
16
+ const stateClass = `input--state-${state}`
17
+
18
+ // Combine classes
19
+ const inputClasses = [baseClass, variantClass, sizeClass, stateClass, className]
20
+ .filter(Boolean)
21
+ .join(' ')
22
+
23
+ return (
24
+ <input
25
+ type={type}
26
+ className={inputClasses}
27
+ ref={ref}
28
+ {...props}
29
+ />
30
+ )
31
+ }
32
+ )
33
+ Input.displayName = "Input"
34
+
35
+ export { Input }
@@ -0,0 +1,16 @@
1
+ import * as React from "react"
2
+ import * as LabelPrimitive from "@radix-ui/react-label"
3
+
4
+ const Label = React.forwardRef<
5
+ React.ElementRef<typeof LabelPrimitive.Root>,
6
+ React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
7
+ >(({ className, ...props }, ref) => (
8
+ <LabelPrimitive.Root
9
+ ref={ref}
10
+ className={`label ${className || ''}`}
11
+ {...props}
12
+ />
13
+ ))
14
+ Label.displayName = LabelPrimitive.Root.displayName
15
+
16
+ export { Label }