@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,367 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from './card'
|
|
3
|
+
import { Badge } from './badge'
|
|
4
|
+
import { Button } from './button'
|
|
5
|
+
import {
|
|
6
|
+
MobileLayout,
|
|
7
|
+
TabletLayout,
|
|
8
|
+
DesktopLayout,
|
|
9
|
+
AdaptiveLayout
|
|
10
|
+
} from './layouts'
|
|
11
|
+
import { useAdaptiveLayout } from '../../hooks/use-adaptive-layout'
|
|
12
|
+
import { useLayoutPerformance } from '../../hooks/use-layout-performance'
|
|
13
|
+
import { useMobileLayout } from '../../hooks/use-mobile-layout'
|
|
14
|
+
import { useTabletLayout } from '../../hooks/use-tablet-layout'
|
|
15
|
+
|
|
16
|
+
export const LayoutDemo: React.FC = () => {
|
|
17
|
+
const [activeLayout, setActiveLayout] = useState<'mobile' | 'tablet' | 'desktop' | 'adaptive'>('adaptive')
|
|
18
|
+
const [showPerformanceMetrics, setShowPerformanceMetrics] = useState(true)
|
|
19
|
+
const [enableTouchOptimization, setEnableTouchOptimization] = useState(true)
|
|
20
|
+
const [enableAdvancedFeatures, setEnableAdvancedFeatures] = useState(true)
|
|
21
|
+
|
|
22
|
+
// Hooks
|
|
23
|
+
useAdaptiveLayout({
|
|
24
|
+
enablePerformanceOptimization: true,
|
|
25
|
+
enableTouchOptimization: true,
|
|
26
|
+
enableBatteryOptimization: true,
|
|
27
|
+
enableMemoryOptimization: true
|
|
28
|
+
}, {
|
|
29
|
+
onDeviceChange: (deviceType) => console.log('Device changed to:', deviceType),
|
|
30
|
+
onOrientationChange: (orientation) => console.log('Orientation changed to:', orientation),
|
|
31
|
+
onPerformanceChange: (score) => console.log('Performance score:', score)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const layoutPerformance = useLayoutPerformance({
|
|
35
|
+
enableLayoutCalculationOptimization: true,
|
|
36
|
+
enableMemoryManagement: true,
|
|
37
|
+
enableBatteryOptimization: true,
|
|
38
|
+
enablePerformanceMonitoring: true
|
|
39
|
+
}, {
|
|
40
|
+
onPerformanceWarning: (warning, metrics) => console.log('Performance warning:', warning, metrics),
|
|
41
|
+
onMemoryWarning: (usage, threshold) => console.log('Memory warning:', usage, threshold),
|
|
42
|
+
onBatteryWarning: (level, isLow) => console.log('Battery warning:', level, isLow)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const mobileLayout = useMobileLayout({
|
|
46
|
+
enableTouchTargetOptimization: true,
|
|
47
|
+
enableGestureSupport: true,
|
|
48
|
+
enableTouchFeedback: true,
|
|
49
|
+
enablePerformanceOptimization: true
|
|
50
|
+
}, {
|
|
51
|
+
onTouchTargetOptimized: (target) => console.log('Touch target optimized:', target),
|
|
52
|
+
onGestureDetected: (event) => console.log('Gesture detected:', event),
|
|
53
|
+
onTouchFeedback: (type, target) => console.log('Touch feedback:', type, target)
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
useTabletLayout({
|
|
57
|
+
enableOrientationOptimization: true,
|
|
58
|
+
enableSplitViewSupport: true,
|
|
59
|
+
enableKeyboardOptimization: true,
|
|
60
|
+
enableSafeAreaOptimization: true,
|
|
61
|
+
enablePerformanceOptimization: true,
|
|
62
|
+
enableTouchOptimization: true
|
|
63
|
+
}, {
|
|
64
|
+
onOrientationChange: (orientation) => console.log('Tablet orientation:', orientation),
|
|
65
|
+
onSplitViewChange: (isSplitView) => console.log('Split view:', isSplitView),
|
|
66
|
+
onKeyboardChange: (isVisible) => console.log('Keyboard visible:', isVisible)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
// Layout content
|
|
70
|
+
const renderLayoutContent = () => {
|
|
71
|
+
const commonContent = (
|
|
72
|
+
<div className="space-y-6">
|
|
73
|
+
{/* Feature Cards */}
|
|
74
|
+
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
75
|
+
<Card className="border-2 border-cs-primary">
|
|
76
|
+
<CardHeader className="pb-3">
|
|
77
|
+
<CardTitle className="text-lg flex items-center gap-2">
|
|
78
|
+
🎨 Design System
|
|
79
|
+
<Badge variant="default">Core</Badge>
|
|
80
|
+
</CardTitle>
|
|
81
|
+
</CardHeader>
|
|
82
|
+
<CardContent>
|
|
83
|
+
<p className="text-sm text-cs-text-secondary mb-3">
|
|
84
|
+
Complete design system with themes, components, and customization
|
|
85
|
+
</p>
|
|
86
|
+
<div className="flex items-center gap-2">
|
|
87
|
+
<Badge variant="outline">Components</Badge>
|
|
88
|
+
<Badge variant="outline">Themes</Badge>
|
|
89
|
+
<Badge variant="outline">Customization</Badge>
|
|
90
|
+
</div>
|
|
91
|
+
</CardContent>
|
|
92
|
+
</Card>
|
|
93
|
+
|
|
94
|
+
<Card className="border-2 border-cs-secondary">
|
|
95
|
+
<CardHeader className="pb-3">
|
|
96
|
+
<CardTitle className="text-lg flex items-center gap-2">
|
|
97
|
+
📱 Mobile Features
|
|
98
|
+
<Badge variant="secondary">Stories 3-6</Badge>
|
|
99
|
+
</CardTitle>
|
|
100
|
+
</CardHeader>
|
|
101
|
+
<CardContent>
|
|
102
|
+
<p className="text-sm text-cs-text-secondary mb-3">
|
|
103
|
+
Mobile-first animations, performance monitoring, touch optimization, and forms
|
|
104
|
+
</p>
|
|
105
|
+
<div className="flex items-center gap-2">
|
|
106
|
+
<Badge variant="outline">Animations</Badge>
|
|
107
|
+
<Badge variant="outline">Performance</Badge>
|
|
108
|
+
<Badge variant="outline">Touch</Badge>
|
|
109
|
+
<Badge variant="outline">Forms</Badge>
|
|
110
|
+
</div>
|
|
111
|
+
</CardContent>
|
|
112
|
+
</Card>
|
|
113
|
+
|
|
114
|
+
<Card className="border-2 border-cs-accent">
|
|
115
|
+
<CardHeader className="pb-3">
|
|
116
|
+
<CardTitle className="text-lg flex items-center gap-2">
|
|
117
|
+
🚀 Layout System
|
|
118
|
+
<Badge variant="outline">Story 7</Badge>
|
|
119
|
+
</CardTitle>
|
|
120
|
+
</CardHeader>
|
|
121
|
+
<CardContent>
|
|
122
|
+
<p className="text-sm text-cs-text-secondary mb-3">
|
|
123
|
+
Device-specific layouts with responsive excellence and performance optimization
|
|
124
|
+
</p>
|
|
125
|
+
<div className="flex items-center gap-2">
|
|
126
|
+
<Badge variant="outline">Responsive</Badge>
|
|
127
|
+
<Badge variant="outline">Performance</Badge>
|
|
128
|
+
<Badge variant="outline">Touch</Badge>
|
|
129
|
+
<Badge variant="outline">Adaptive</Badge>
|
|
130
|
+
</div>
|
|
131
|
+
</CardContent>
|
|
132
|
+
</Card>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
{/* Performance Overview */}
|
|
136
|
+
{showPerformanceMetrics && (
|
|
137
|
+
<Card className="border-2 border-cs-accent">
|
|
138
|
+
<CardHeader>
|
|
139
|
+
<CardTitle className="text-xl flex items-center gap-2">
|
|
140
|
+
📊 Performance Overview
|
|
141
|
+
<Badge variant="outline">Real-time</Badge>
|
|
142
|
+
</CardTitle>
|
|
143
|
+
<CardDescription>
|
|
144
|
+
Comprehensive performance metrics across all layout systems
|
|
145
|
+
</CardDescription>
|
|
146
|
+
</CardHeader>
|
|
147
|
+
<CardContent>
|
|
148
|
+
<div className="grid grid-cols-2 lg:grid-cols-4 gap-6 text-center">
|
|
149
|
+
<div>
|
|
150
|
+
<p className="text-2xl font-bold text-cs-primary">
|
|
151
|
+
{layoutPerformance.metrics.performanceScore}
|
|
152
|
+
</p>
|
|
153
|
+
<p className="text-sm text-cs-text-secondary">Performance Score</p>
|
|
154
|
+
</div>
|
|
155
|
+
<div>
|
|
156
|
+
<p className="text-2xl font-bold text-cs-secondary">
|
|
157
|
+
{layoutPerformance.metrics.fps}
|
|
158
|
+
</p>
|
|
159
|
+
<p className="text-sm text-cs-text-secondary">FPS</p>
|
|
160
|
+
</div>
|
|
161
|
+
<div>
|
|
162
|
+
<p className="text-2xl font-bold text-cs-accent">
|
|
163
|
+
{layoutPerformance.metrics.memoryUsage.toFixed(1)}%
|
|
164
|
+
</p>
|
|
165
|
+
<p className="text-sm text-cs-text-secondary">Memory</p>
|
|
166
|
+
</div>
|
|
167
|
+
<div>
|
|
168
|
+
<p className="text-2xl font-bold text-cs-primary">
|
|
169
|
+
{layoutPerformance.metrics.batteryLevel.toFixed(1)}
|
|
170
|
+
</p>
|
|
171
|
+
<p className="text-sm text-cs-text-secondary">Battery</p>
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
</CardContent>
|
|
175
|
+
</Card>
|
|
176
|
+
)}
|
|
177
|
+
|
|
178
|
+
{/* Layout Controls */}
|
|
179
|
+
<Card className="border border-cs-border">
|
|
180
|
+
<CardHeader>
|
|
181
|
+
<CardTitle className="text-lg">Layout Controls</CardTitle>
|
|
182
|
+
<CardDescription>
|
|
183
|
+
Configure and test different layout behaviors
|
|
184
|
+
</CardDescription>
|
|
185
|
+
</CardHeader>
|
|
186
|
+
<CardContent className="space-y-4">
|
|
187
|
+
<div className="flex flex-wrap gap-4">
|
|
188
|
+
<Button
|
|
189
|
+
variant={activeLayout === 'mobile' ? 'default' : 'outline'}
|
|
190
|
+
onClick={() => setActiveLayout('mobile')}
|
|
191
|
+
>
|
|
192
|
+
📱 Mobile
|
|
193
|
+
</Button>
|
|
194
|
+
<Button
|
|
195
|
+
variant={activeLayout === 'tablet' ? 'default' : 'outline'}
|
|
196
|
+
onClick={() => setActiveLayout('tablet')}
|
|
197
|
+
>
|
|
198
|
+
📱 Tablet
|
|
199
|
+
</Button>
|
|
200
|
+
<Button
|
|
201
|
+
variant={activeLayout === 'desktop' ? 'default' : 'outline'}
|
|
202
|
+
onClick={() => setActiveLayout('desktop')}
|
|
203
|
+
>
|
|
204
|
+
💻 Desktop
|
|
205
|
+
</Button>
|
|
206
|
+
<Button
|
|
207
|
+
variant={activeLayout === 'adaptive' ? 'default' : 'outline'}
|
|
208
|
+
onClick={() => setActiveLayout('adaptive')}
|
|
209
|
+
>
|
|
210
|
+
🔄 Adaptive
|
|
211
|
+
</Button>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<div className="flex flex-wrap gap-4">
|
|
215
|
+
<Button
|
|
216
|
+
variant={showPerformanceMetrics ? 'default' : 'outline'}
|
|
217
|
+
size="sm"
|
|
218
|
+
onClick={() => setShowPerformanceMetrics(!showPerformanceMetrics)}
|
|
219
|
+
>
|
|
220
|
+
{showPerformanceMetrics ? 'Hide' : 'Show'} Performance
|
|
221
|
+
</Button>
|
|
222
|
+
<Button
|
|
223
|
+
variant={enableTouchOptimization ? 'default' : 'outline'}
|
|
224
|
+
size="sm"
|
|
225
|
+
onClick={() => setEnableTouchOptimization(!enableTouchOptimization)}
|
|
226
|
+
>
|
|
227
|
+
{enableTouchOptimization ? 'Disable' : 'Enable'} Touch
|
|
228
|
+
</Button>
|
|
229
|
+
<Button
|
|
230
|
+
variant={enableAdvancedFeatures ? 'default' : 'outline'}
|
|
231
|
+
size="sm"
|
|
232
|
+
onClick={() => setEnableAdvancedFeatures(!enableAdvancedFeatures)}
|
|
233
|
+
>
|
|
234
|
+
{enableAdvancedFeatures ? 'Disable' : 'Enable'} Advanced
|
|
235
|
+
</Button>
|
|
236
|
+
</div>
|
|
237
|
+
</CardContent>
|
|
238
|
+
</Card>
|
|
239
|
+
|
|
240
|
+
{/* Optimization Status */}
|
|
241
|
+
<Card className="border border-cs-border">
|
|
242
|
+
<CardHeader>
|
|
243
|
+
<CardTitle className="text-lg">Optimization Status</CardTitle>
|
|
244
|
+
<CardDescription>
|
|
245
|
+
Current optimization status and recommendations
|
|
246
|
+
</CardDescription>
|
|
247
|
+
</CardHeader>
|
|
248
|
+
<CardContent>
|
|
249
|
+
<div className="space-y-3">
|
|
250
|
+
<div className="flex items-center justify-between">
|
|
251
|
+
<span className="text-sm">Layout Performance:</span>
|
|
252
|
+
<Badge variant={layoutPerformance.isPerformanceOptimal ? 'default' : 'secondary'}>
|
|
253
|
+
{layoutPerformance.isPerformanceOptimal ? 'Optimal' : 'Needs Optimization'}
|
|
254
|
+
</Badge>
|
|
255
|
+
</div>
|
|
256
|
+
<div className="flex items-center justify-between">
|
|
257
|
+
<span className="text-sm">Memory Usage:</span>
|
|
258
|
+
<Badge variant={layoutPerformance.isMemoryOptimal ? 'default' : 'secondary'}>
|
|
259
|
+
{layoutPerformance.isMemoryOptimal ? 'Optimal' : 'High Usage'}
|
|
260
|
+
</Badge>
|
|
261
|
+
</div>
|
|
262
|
+
<div className="flex items-center justify-between">
|
|
263
|
+
<span className="text-sm">Battery Status:</span>
|
|
264
|
+
<Badge variant={layoutPerformance.isBatteryOptimal ? 'default' : 'secondary'}>
|
|
265
|
+
{layoutPerformance.isBatteryOptimal ? 'Good' : 'Low Battery'}
|
|
266
|
+
</Badge>
|
|
267
|
+
</div>
|
|
268
|
+
<div className="flex items-center justify-between">
|
|
269
|
+
<span className="text-sm">Touch Optimization:</span>
|
|
270
|
+
<Badge variant={mobileLayout.isTouchOptimized ? 'default' : 'secondary'}>
|
|
271
|
+
{mobileLayout.isTouchOptimized ? 'Optimized' : 'Needs Optimization'}
|
|
272
|
+
</Badge>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
{layoutPerformance.layoutOptimizations.length > 0 && (
|
|
277
|
+
<div className="mt-4 p-3 bg-cs-accent/10 rounded-lg">
|
|
278
|
+
<h4 className="font-medium text-sm mb-2">Recommendations:</h4>
|
|
279
|
+
<ul className="text-xs text-cs-text-secondary space-y-1">
|
|
280
|
+
{layoutPerformance.layoutOptimizations.map((optimization, index) => (
|
|
281
|
+
<li key={index}>• {optimization}</li>
|
|
282
|
+
))}
|
|
283
|
+
</ul>
|
|
284
|
+
</div>
|
|
285
|
+
)}
|
|
286
|
+
</CardContent>
|
|
287
|
+
</Card>
|
|
288
|
+
</div>
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
switch (activeLayout) {
|
|
292
|
+
case 'mobile':
|
|
293
|
+
return (
|
|
294
|
+
<MobileLayout
|
|
295
|
+
title="Mobile Layout Demo"
|
|
296
|
+
description="Touch-optimized mobile layout with performance monitoring"
|
|
297
|
+
enableTouchOptimization={enableTouchOptimization}
|
|
298
|
+
enablePerformanceMonitoring={showPerformanceMetrics}
|
|
299
|
+
>
|
|
300
|
+
{commonContent}
|
|
301
|
+
</MobileLayout>
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
case 'tablet':
|
|
305
|
+
return (
|
|
306
|
+
<TabletLayout
|
|
307
|
+
title="Tablet Layout Demo"
|
|
308
|
+
description="Tablet-optimized layout with orientation and split view support"
|
|
309
|
+
enableTouchOptimization={enableTouchOptimization}
|
|
310
|
+
enablePerformanceMonitoring={showPerformanceMetrics}
|
|
311
|
+
>
|
|
312
|
+
{commonContent}
|
|
313
|
+
</TabletLayout>
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
case 'desktop':
|
|
317
|
+
return (
|
|
318
|
+
<DesktopLayout
|
|
319
|
+
title="Desktop Layout Demo"
|
|
320
|
+
description="Desktop-optimized layout with advanced features and performance monitoring"
|
|
321
|
+
enableAdvancedFeatures={enableAdvancedFeatures}
|
|
322
|
+
enablePerformanceMonitoring={showPerformanceMetrics}
|
|
323
|
+
>
|
|
324
|
+
{commonContent}
|
|
325
|
+
</DesktopLayout>
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
case 'adaptive':
|
|
329
|
+
default:
|
|
330
|
+
return (
|
|
331
|
+
<AdaptiveLayout
|
|
332
|
+
title="Adaptive Layout Demo"
|
|
333
|
+
description="Automatically adapts to different device types with optimal layouts"
|
|
334
|
+
enableTouchOptimization={enableTouchOptimization}
|
|
335
|
+
enablePerformanceMonitoring={showPerformanceMetrics}
|
|
336
|
+
enableAdvancedFeatures={enableAdvancedFeatures}
|
|
337
|
+
>
|
|
338
|
+
{commonContent}
|
|
339
|
+
</AdaptiveLayout>
|
|
340
|
+
)
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return (
|
|
345
|
+
<div className="space-y-6">
|
|
346
|
+
<div className="text-center">
|
|
347
|
+
<h1 className="text-3xl font-bold text-cs-text-primary mb-2">
|
|
348
|
+
🚀 Device-Specific Layout & Responsive Excellence
|
|
349
|
+
</h1>
|
|
350
|
+
<p className="text-lg text-cs-text-secondary mb-4">
|
|
351
|
+
Story 7 Implementation - Comprehensive layout system with device-specific optimizations
|
|
352
|
+
</p>
|
|
353
|
+
<div className="flex items-center justify-center gap-2">
|
|
354
|
+
<Badge variant="default">Story 7</Badge>
|
|
355
|
+
<Badge variant="outline">Responsive Design</Badge>
|
|
356
|
+
<Badge variant="secondary">Performance</Badge>
|
|
357
|
+
<Badge variant="outline">Touch Optimization</Badge>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
{/* Layout Demo */}
|
|
362
|
+
{renderLayoutContent()}
|
|
363
|
+
</div>
|
|
364
|
+
)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export default LayoutDemo
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React, { ReactNode, useState, useEffect } from 'react'
|
|
2
|
+
import { Card, CardContent } from '../card'
|
|
3
|
+
import { Badge } from '../badge'
|
|
4
|
+
import { MobileLayout } from './mobile-layout'
|
|
5
|
+
import { TabletLayout } from './tablet-layout'
|
|
6
|
+
import { DesktopLayout } from './desktop-layout'
|
|
7
|
+
|
|
8
|
+
export type DeviceType = 'mobile' | 'tablet' | 'desktop'
|
|
9
|
+
|
|
10
|
+
export interface AdaptiveLayoutProps {
|
|
11
|
+
children: ReactNode
|
|
12
|
+
title?: string
|
|
13
|
+
description?: string
|
|
14
|
+
showHeader?: boolean
|
|
15
|
+
showSidebar?: boolean
|
|
16
|
+
enableTouchOptimization?: boolean
|
|
17
|
+
enablePerformanceMonitoring?: boolean
|
|
18
|
+
enableAdvancedFeatures?: boolean
|
|
19
|
+
className?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AdaptiveLayout: React.FC<AdaptiveLayoutProps> = ({
|
|
23
|
+
children,
|
|
24
|
+
title = 'Adaptive Layout',
|
|
25
|
+
description = 'Automatically adapts to different device types with optimal layouts',
|
|
26
|
+
showHeader = true,
|
|
27
|
+
showSidebar = true,
|
|
28
|
+
enableTouchOptimization = true,
|
|
29
|
+
enablePerformanceMonitoring = true,
|
|
30
|
+
enableAdvancedFeatures = true,
|
|
31
|
+
className = ''
|
|
32
|
+
}) => {
|
|
33
|
+
const [deviceType, setDeviceType] = useState<DeviceType>('desktop')
|
|
34
|
+
const [screenSize, setScreenSize] = useState({ width: 0, height: 0 })
|
|
35
|
+
const [orientation, setOrientation] = useState<'portrait' | 'landscape'>('landscape')
|
|
36
|
+
|
|
37
|
+
// Device detection and adaptation
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
const detectDevice = () => {
|
|
40
|
+
const width = window.innerWidth
|
|
41
|
+
const height = window.innerHeight
|
|
42
|
+
|
|
43
|
+
setScreenSize({ width, height })
|
|
44
|
+
setOrientation(width > height ? 'landscape' : 'portrait')
|
|
45
|
+
|
|
46
|
+
// Device type detection based on screen size
|
|
47
|
+
if (width < 768) {
|
|
48
|
+
setDeviceType('mobile')
|
|
49
|
+
} else if (width < 1024) {
|
|
50
|
+
setDeviceType('tablet')
|
|
51
|
+
} else {
|
|
52
|
+
setDeviceType('desktop')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
detectDevice()
|
|
57
|
+
window.addEventListener('resize', detectDevice)
|
|
58
|
+
window.addEventListener('orientationchange', detectDevice)
|
|
59
|
+
|
|
60
|
+
return () => {
|
|
61
|
+
window.removeEventListener('resize', detectDevice)
|
|
62
|
+
window.removeEventListener('orientationchange', detectDevice)
|
|
63
|
+
}
|
|
64
|
+
}, [])
|
|
65
|
+
|
|
66
|
+
// Render appropriate layout based on device type
|
|
67
|
+
const renderLayout = () => {
|
|
68
|
+
const commonProps = {
|
|
69
|
+
title,
|
|
70
|
+
description,
|
|
71
|
+
showHeader,
|
|
72
|
+
enablePerformanceMonitoring,
|
|
73
|
+
className
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
switch (deviceType) {
|
|
77
|
+
case 'mobile':
|
|
78
|
+
return (
|
|
79
|
+
<MobileLayout
|
|
80
|
+
{...commonProps}
|
|
81
|
+
showFooter={true}
|
|
82
|
+
enableTouchOptimization={enableTouchOptimization}
|
|
83
|
+
>
|
|
84
|
+
{children}
|
|
85
|
+
</MobileLayout>
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
case 'tablet':
|
|
89
|
+
return (
|
|
90
|
+
<TabletLayout
|
|
91
|
+
{...commonProps}
|
|
92
|
+
showSidebar={showSidebar}
|
|
93
|
+
enableTouchOptimization={enableTouchOptimization}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</TabletLayout>
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
case 'desktop':
|
|
100
|
+
return (
|
|
101
|
+
<DesktopLayout
|
|
102
|
+
{...commonProps}
|
|
103
|
+
showSidebar={showSidebar}
|
|
104
|
+
showTopBar={true}
|
|
105
|
+
enableAdvancedFeatures={enableAdvancedFeatures}
|
|
106
|
+
>
|
|
107
|
+
{children}
|
|
108
|
+
</DesktopLayout>
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
default:
|
|
112
|
+
return <div>{children}</div>
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<div className={className}>
|
|
118
|
+
{/* Device Info Overlay (for development/testing) */}
|
|
119
|
+
<div className="fixed top-4 right-4 z-50">
|
|
120
|
+
<Card className="bg-cs-surface/90 backdrop-blur-sm border-2 border-cs-accent">
|
|
121
|
+
<CardContent className="p-3">
|
|
122
|
+
<div className="flex items-center gap-2 text-xs">
|
|
123
|
+
<Badge variant="outline">{deviceType}</Badge>
|
|
124
|
+
<Badge variant="secondary">{orientation}</Badge>
|
|
125
|
+
<span className="text-cs-text-secondary">
|
|
126
|
+
{screenSize.width}×{screenSize.height}
|
|
127
|
+
</span>
|
|
128
|
+
</div>
|
|
129
|
+
</CardContent>
|
|
130
|
+
</Card>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
{/* Render appropriate layout */}
|
|
134
|
+
{renderLayout()}
|
|
135
|
+
</div>
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export default AdaptiveLayout
|