@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,411 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from './card';
|
|
3
|
+
import { Badge } from './badge';
|
|
4
|
+
import { useTheme } from '../../themes';
|
|
5
|
+
import { ColorScale, SemanticColors } from '../../themes/types';
|
|
6
|
+
import { ColorManager } from '../../themes/colorManager';
|
|
7
|
+
|
|
8
|
+
export interface ColorPreviewProps {
|
|
9
|
+
colorScale?: ColorScale;
|
|
10
|
+
semanticColors?: SemanticColors;
|
|
11
|
+
scaleName?: string;
|
|
12
|
+
showAccessibility?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ColorPreview: React.FC<ColorPreviewProps> = ({
|
|
17
|
+
colorScale,
|
|
18
|
+
semanticColors,
|
|
19
|
+
scaleName = 'Color Scale',
|
|
20
|
+
showAccessibility = true,
|
|
21
|
+
className = ''
|
|
22
|
+
}) => {
|
|
23
|
+
const { currentThemeConfig } = useTheme();
|
|
24
|
+
|
|
25
|
+
// Use provided colors or get from current theme
|
|
26
|
+
const colors = colorScale || currentThemeConfig?.colors.primary;
|
|
27
|
+
const semantic = semanticColors || currentThemeConfig?.colors.semantic;
|
|
28
|
+
|
|
29
|
+
// Type guard to ensure semantic colors are strings
|
|
30
|
+
const isStringColor = (color: unknown): color is string =>
|
|
31
|
+
typeof color === 'string' && color.length > 0;
|
|
32
|
+
|
|
33
|
+
if (!colors) {
|
|
34
|
+
return (
|
|
35
|
+
<Card className={className}>
|
|
36
|
+
<CardContent className="p-4">
|
|
37
|
+
<p className="text-sm text-muted-foreground">Color configuration not available</p>
|
|
38
|
+
</CardContent>
|
|
39
|
+
</Card>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Color scale shades
|
|
44
|
+
const scaleShades = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Card className={className}>
|
|
50
|
+
<CardHeader>
|
|
51
|
+
<CardTitle className="flex items-center justify-between">
|
|
52
|
+
<span>{scaleName}</span>
|
|
53
|
+
<div className="flex gap-2">
|
|
54
|
+
<Badge variant="outline" className="text-xs">
|
|
55
|
+
{scaleShades.length} shades
|
|
56
|
+
</Badge>
|
|
57
|
+
{showAccessibility && (
|
|
58
|
+
<Badge variant="secondary" className="text-xs">
|
|
59
|
+
WCAG AA/AAA
|
|
60
|
+
</Badge>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
</CardTitle>
|
|
64
|
+
<CardDescription>
|
|
65
|
+
Color scale with accessibility information and contrast ratios
|
|
66
|
+
</CardDescription>
|
|
67
|
+
</CardHeader>
|
|
68
|
+
|
|
69
|
+
<CardContent className="space-y-6">
|
|
70
|
+
{/* Color Scale Preview */}
|
|
71
|
+
<div>
|
|
72
|
+
<h4 className="text-sm font-medium mb-3">Color Scale</h4>
|
|
73
|
+
<div className="grid grid-cols-2 md:grid-cols-5 gap-3">
|
|
74
|
+
{scaleShades.map(shade => {
|
|
75
|
+
const color = colors[shade as keyof ColorScale];
|
|
76
|
+
if (!color) return null;
|
|
77
|
+
|
|
78
|
+
const accessibility = showAccessibility
|
|
79
|
+
? ColorManager.checkColorContrast(color, '#ffffff')
|
|
80
|
+
: null;
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<div key={shade} className="space-y-2">
|
|
84
|
+
<div
|
|
85
|
+
className="w-full h-16 rounded-lg border border-gray-200 dark:border-gray-700"
|
|
86
|
+
style={{ backgroundColor: color }}
|
|
87
|
+
/>
|
|
88
|
+
<div className="text-center">
|
|
89
|
+
<div className="text-xs font-mono font-medium">{shade}</div>
|
|
90
|
+
<div className="text-xs text-muted-foreground font-mono">{color}</div>
|
|
91
|
+
{showAccessibility && accessibility && (
|
|
92
|
+
<div className="mt-1">
|
|
93
|
+
<Badge
|
|
94
|
+
variant={accessibility.aa ? 'default' : 'destructive'}
|
|
95
|
+
className="text-xs"
|
|
96
|
+
>
|
|
97
|
+
{accessibility.contrastRatio.toFixed(1)}:1
|
|
98
|
+
</Badge>
|
|
99
|
+
<div className="text-xs mt-1">
|
|
100
|
+
{accessibility.aa ? 'AA' : 'Fail'}
|
|
101
|
+
{accessibility.aaa && ' AAA'}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
})}
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
{/* Additional color variations */}
|
|
112
|
+
{(colors.light || colors.dark || colors.contrast) && (
|
|
113
|
+
<div className="mt-4">
|
|
114
|
+
<h5 className="text-sm font-medium mb-2">Additional Variations</h5>
|
|
115
|
+
<div className="grid grid-cols-1 md:grid-cols-3 gap-3">
|
|
116
|
+
{colors.light && (
|
|
117
|
+
<div className="space-y-2">
|
|
118
|
+
<div
|
|
119
|
+
className="w-full h-12 rounded-lg border border-gray-200 dark:border-gray-700"
|
|
120
|
+
style={{ backgroundColor: colors.light }}
|
|
121
|
+
/>
|
|
122
|
+
<div className="text-center">
|
|
123
|
+
<div className="text-xs font-medium">Light</div>
|
|
124
|
+
<div className="text-xs text-muted-foreground font-mono">{colors.light}</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
)}
|
|
128
|
+
|
|
129
|
+
{colors.dark && (
|
|
130
|
+
<div className="space-y-2">
|
|
131
|
+
<div
|
|
132
|
+
className="w-full h-12 rounded-lg border border-gray-200 dark:border-gray-700"
|
|
133
|
+
style={{ backgroundColor: colors.dark }}
|
|
134
|
+
/>
|
|
135
|
+
<div className="text-center">
|
|
136
|
+
<div className="text-xs font-medium">Dark</div>
|
|
137
|
+
<div className="text-xs text-muted-foreground font-mono">{colors.dark}</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
)}
|
|
141
|
+
|
|
142
|
+
{colors.contrast && (
|
|
143
|
+
<div className="space-y-2">
|
|
144
|
+
<div
|
|
145
|
+
className="w-full h-12 rounded-lg border border-gray-200 dark:border-gray-700"
|
|
146
|
+
style={{ backgroundColor: colors.contrast }}
|
|
147
|
+
/>
|
|
148
|
+
<div className="text-center">
|
|
149
|
+
<div className="text-xs font-medium">Contrast</div>
|
|
150
|
+
<div className="text-xs text-muted-foreground font-mono">{colors.contrast}</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
)}
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
{/* Semantic Colors */}
|
|
160
|
+
{semantic && (
|
|
161
|
+
<div>
|
|
162
|
+
<h4 className="text-sm font-medium mb-3">Semantic Colors</h4>
|
|
163
|
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
|
|
164
|
+
{Object.entries(semantic).map(([name, color]) => {
|
|
165
|
+
if (!isStringColor(color) || name.includes('Light') || name.includes('Dark')) return null;
|
|
166
|
+
|
|
167
|
+
const accessibility = showAccessibility
|
|
168
|
+
? ColorManager.checkColorContrast(color, '#ffffff')
|
|
169
|
+
: null;
|
|
170
|
+
|
|
171
|
+
return (
|
|
172
|
+
<div key={name} className="space-y-2">
|
|
173
|
+
<div
|
|
174
|
+
className="w-full h-16 rounded-lg border border-gray-200 dark:border-gray-700"
|
|
175
|
+
style={{ backgroundColor: color }}
|
|
176
|
+
/>
|
|
177
|
+
<div className="text-center">
|
|
178
|
+
<div className="text-xs font-medium capitalize">
|
|
179
|
+
{name.replace(/([A-Z])/g, ' $1').trim()}
|
|
180
|
+
</div>
|
|
181
|
+
<div className="text-xs text-muted-foreground font-mono">{color}</div>
|
|
182
|
+
{showAccessibility && accessibility && (
|
|
183
|
+
<div className="mt-1">
|
|
184
|
+
<Badge
|
|
185
|
+
variant={accessibility.aa ? 'default' : 'destructive'}
|
|
186
|
+
className="text-xs"
|
|
187
|
+
>
|
|
188
|
+
{accessibility.contrastRatio.toFixed(1)}:1
|
|
189
|
+
</Badge>
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
})}
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
{/* Light and Dark variants */}
|
|
199
|
+
<div className="mt-4">
|
|
200
|
+
<h5 className="text-sm font-medium mb-2">Semantic Variants</h5>
|
|
201
|
+
<div className="grid grid-cols-2 md:grid-cols-4 gap-3">
|
|
202
|
+
{Object.entries(semantic).map(([name, color]) => {
|
|
203
|
+
if (!isStringColor(color) || !name.includes('Light') && !name.includes('Dark')) return null;
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<div key={name} className="space-y-2">
|
|
207
|
+
<div
|
|
208
|
+
className="w-full h-12 rounded-lg border border-gray-200 dark:border-gray-700"
|
|
209
|
+
style={{ backgroundColor: color }}
|
|
210
|
+
/>
|
|
211
|
+
<div className="text-center">
|
|
212
|
+
<div className="text-xs font-medium capitalize">
|
|
213
|
+
{name.replace(/([A-Z])/g, ' $1').trim()}
|
|
214
|
+
</div>
|
|
215
|
+
<div className="text-xs text-muted-foreground font-mono">{color}</div>
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
})}
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
)}
|
|
224
|
+
|
|
225
|
+
{/* Accessibility Information */}
|
|
226
|
+
{showAccessibility && (
|
|
227
|
+
<div className="pt-4 border-t">
|
|
228
|
+
<h4 className="text-sm font-medium mb-2">Accessibility Information</h4>
|
|
229
|
+
<div className="space-y-2 text-xs text-muted-foreground">
|
|
230
|
+
<div className="flex items-center gap-2">
|
|
231
|
+
<Badge variant="default" className="text-xs">AA</Badge>
|
|
232
|
+
<span>WCAG AA standard: 4.5:1 contrast ratio</span>
|
|
233
|
+
</div>
|
|
234
|
+
<div className="flex items-center gap-2">
|
|
235
|
+
<Badge variant="secondary" className="text-xs">AAA</Badge>
|
|
236
|
+
<span>WCAG AAA standard: 7:1 contrast ratio</span>
|
|
237
|
+
</div>
|
|
238
|
+
<div className="text-xs">
|
|
239
|
+
<strong>Note:</strong> Colors are tested against white background.
|
|
240
|
+
For dark themes, test against appropriate dark backgrounds.
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
)}
|
|
245
|
+
|
|
246
|
+
{/* Color Usage Examples */}
|
|
247
|
+
<div className="pt-4 border-t">
|
|
248
|
+
<h4 className="text-sm font-medium mb-2">Usage Examples</h4>
|
|
249
|
+
<div className="space-y-3">
|
|
250
|
+
{/* Primary color usage */}
|
|
251
|
+
<div className="p-3 rounded-lg border" style={{ backgroundColor: colors[100] }}>
|
|
252
|
+
<div className="space-y-2">
|
|
253
|
+
<h5 className="font-medium" style={{ color: colors[900] }}>
|
|
254
|
+
Primary Color Usage
|
|
255
|
+
</h5>
|
|
256
|
+
<p className="text-sm" style={{ color: colors[700] }}>
|
|
257
|
+
This is an example of how the primary color scale can be used for text and backgrounds.
|
|
258
|
+
</p>
|
|
259
|
+
<div className="flex gap-2">
|
|
260
|
+
<Badge style={{ backgroundColor: colors[500], color: '#ffffff' }}>
|
|
261
|
+
Primary Button
|
|
262
|
+
</Badge>
|
|
263
|
+
<Badge variant="outline" style={{ borderColor: colors[500], color: colors[700] }}>
|
|
264
|
+
Secondary Button
|
|
265
|
+
</Badge>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
</div>
|
|
269
|
+
|
|
270
|
+
{/* Semantic color usage */}
|
|
271
|
+
{semantic && (
|
|
272
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
|
273
|
+
<div className="p-3 rounded-lg border" style={{ backgroundColor: semantic.successLight }}>
|
|
274
|
+
<div className="space-y-2">
|
|
275
|
+
<h5 className="font-medium" style={{ color: semantic.successDark }}>
|
|
276
|
+
Success State
|
|
277
|
+
</h5>
|
|
278
|
+
<p className="text-sm" style={{ color: semantic.success }}>
|
|
279
|
+
This shows how semantic colors can be used for different states.
|
|
280
|
+
</p>
|
|
281
|
+
</div>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div className="p-3 rounded-lg border" style={{ backgroundColor: semantic.errorLight }}>
|
|
285
|
+
<div className="space-y-2">
|
|
286
|
+
<h5 className="font-medium" style={{ color: semantic.errorDark }}>
|
|
287
|
+
Error State
|
|
288
|
+
</h5>
|
|
289
|
+
<p className="text-sm" style={{ color: semantic.error }}>
|
|
290
|
+
Error messages and validation feedback use semantic colors.
|
|
291
|
+
</p>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
)}
|
|
296
|
+
</div>
|
|
297
|
+
</div>
|
|
298
|
+
</CardContent>
|
|
299
|
+
</Card>
|
|
300
|
+
);
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
// Multi-color preview component
|
|
304
|
+
export interface ColorShowcaseProps {
|
|
305
|
+
showAccessibility?: boolean;
|
|
306
|
+
className?: string;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
export const ColorShowcase: React.FC<ColorShowcaseProps> = ({
|
|
310
|
+
showAccessibility = true,
|
|
311
|
+
className = ''
|
|
312
|
+
}) => {
|
|
313
|
+
const { currentThemeConfig } = useTheme();
|
|
314
|
+
|
|
315
|
+
if (!currentThemeConfig?.colors) {
|
|
316
|
+
return (
|
|
317
|
+
<div className={className}>
|
|
318
|
+
<p className="text-sm text-muted-foreground">No color configuration available</p>
|
|
319
|
+
</div>
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const { primary, secondary, semantic, neutral, surface, text } = currentThemeConfig.colors;
|
|
324
|
+
|
|
325
|
+
// Type guard to ensure colors are strings
|
|
326
|
+
const isStringColor = (color: unknown): color is string =>
|
|
327
|
+
typeof color === 'string' && color.length > 0;
|
|
328
|
+
|
|
329
|
+
return (
|
|
330
|
+
<div className={`space-y-6 ${className}`}>
|
|
331
|
+
<ColorPreview
|
|
332
|
+
colorScale={primary}
|
|
333
|
+
scaleName="Primary Colors"
|
|
334
|
+
showAccessibility={showAccessibility}
|
|
335
|
+
/>
|
|
336
|
+
|
|
337
|
+
<ColorPreview
|
|
338
|
+
colorScale={secondary}
|
|
339
|
+
scaleName="Secondary Colors"
|
|
340
|
+
showAccessibility={showAccessibility}
|
|
341
|
+
/>
|
|
342
|
+
|
|
343
|
+
<ColorPreview
|
|
344
|
+
colorScale={neutral}
|
|
345
|
+
scaleName="Neutral Colors"
|
|
346
|
+
showAccessibility={showAccessibility}
|
|
347
|
+
/>
|
|
348
|
+
|
|
349
|
+
<ColorPreview
|
|
350
|
+
semanticColors={semantic}
|
|
351
|
+
scaleName="Semantic Colors"
|
|
352
|
+
showAccessibility={showAccessibility}
|
|
353
|
+
/>
|
|
354
|
+
|
|
355
|
+
{/* Surface and Text Colors */}
|
|
356
|
+
<Card>
|
|
357
|
+
<CardHeader>
|
|
358
|
+
<CardTitle>Surface & Text Colors</CardTitle>
|
|
359
|
+
<CardDescription>
|
|
360
|
+
Background, surface, and text color combinations
|
|
361
|
+
</CardDescription>
|
|
362
|
+
</CardHeader>
|
|
363
|
+
<CardContent>
|
|
364
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
365
|
+
<div className="space-y-3">
|
|
366
|
+
<h4 className="text-sm font-medium">Surface Colors</h4>
|
|
367
|
+
<div className="space-y-2">
|
|
368
|
+
{Object.entries(surface).map(([name, color]) => {
|
|
369
|
+
if (!isStringColor(color)) return null;
|
|
370
|
+
return (
|
|
371
|
+
<div key={name} className="flex items-center gap-3">
|
|
372
|
+
<div
|
|
373
|
+
className="w-8 h-8 rounded border"
|
|
374
|
+
style={{ backgroundColor: color }}
|
|
375
|
+
/>
|
|
376
|
+
<div>
|
|
377
|
+
<div className="text-sm font-medium capitalize">{name}</div>
|
|
378
|
+
<div className="text-xs text-muted-foreground font-mono">{color}</div>
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
);
|
|
382
|
+
})}
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
|
|
386
|
+
<div className="space-y-3">
|
|
387
|
+
<h4 className="text-sm font-medium">Text Colors</h4>
|
|
388
|
+
<div className="space-y-2">
|
|
389
|
+
{Object.entries(text).map(([name, color]) => {
|
|
390
|
+
if (!isStringColor(color)) return null;
|
|
391
|
+
return (
|
|
392
|
+
<div key={name} className="flex items-center gap-3">
|
|
393
|
+
<div
|
|
394
|
+
className="w-8 h-8 rounded border"
|
|
395
|
+
style={{ backgroundColor: color }}
|
|
396
|
+
/>
|
|
397
|
+
<div>
|
|
398
|
+
<div className="text-sm font-medium capitalize">{name}</div>
|
|
399
|
+
<div className="text-xs text-muted-foreground font-mono">{color}</div>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
);
|
|
403
|
+
})}
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
</div>
|
|
407
|
+
</CardContent>
|
|
408
|
+
</Card>
|
|
409
|
+
</div>
|
|
410
|
+
);
|
|
411
|
+
};
|