@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.
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,621 @@
1
+ import { ColorThemeConfig, MultiThemeConfig } from './types';
2
+
3
+ // High contrast theme configuration
4
+ export interface HighContrastThemeConfig extends MultiThemeConfig {
5
+ highContrast: {
6
+ enabled: boolean;
7
+ contrastRatio: number; // Target contrast ratio (WCAG AAA = 7.0)
8
+ enhancedColors: boolean; // Use enhanced color palette
9
+ borderEmphasis: boolean; // Add borders for better definition
10
+ textEmphasis: boolean; // Enhanced text styling
11
+ focusIndicators: boolean; // Enhanced focus indicators
12
+ };
13
+ }
14
+
15
+ // High contrast color utilities
16
+ export class HighContrastColors {
17
+ // WCAG contrast ratio calculation
18
+ static calculateContrastRatio(foreground: string, background: string): number {
19
+ const fgLuminance = this.getLuminance(foreground);
20
+ const bgLuminance = this.getLuminance(background);
21
+
22
+ const lighter = Math.max(fgLuminance, bgLuminance);
23
+ const darker = Math.min(fgLuminance, bgLuminance);
24
+
25
+ return (lighter + 0.05) / (darker + 0.05);
26
+ }
27
+
28
+ // Get relative luminance of a color
29
+ private static getLuminance(color: string): number {
30
+ const rgb = this.hexToRgb(color);
31
+ if (!rgb) return 0;
32
+
33
+ const { r, g, b } = rgb;
34
+
35
+ const rsRGB = r / 255;
36
+ const gsRGB = g / 255;
37
+ const bsRGB = b / 255;
38
+
39
+ const rL = rsRGB <= 0.03928 ? rsRGB / 12.92 : Math.pow((rsRGB + 0.055) / 1.055, 2.4);
40
+ const gL = gsRGB <= 0.03928 ? gsRGB / 12.92 : Math.pow((gsRGB + 0.055) / 1.055, 2.4);
41
+ const bL = bsRGB <= 0.03928 ? bsRGB / 12.92 : Math.pow((bsRGB + 0.055) / 1.055, 2.4);
42
+
43
+ return 0.2126 * rL + 0.7152 * gL + 0.0722 * bL;
44
+ }
45
+
46
+ // Convert hex color to RGB
47
+ private static hexToRgb(hex: string): { r: number; g: number; b: number } | null {
48
+ const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
49
+ if (!result) return null;
50
+
51
+ return {
52
+ r: parseInt(result[1], 16),
53
+ g: parseInt(result[2], 16),
54
+ b: parseInt(result[3], 16)
55
+ };
56
+ }
57
+
58
+ // Check if contrast ratio meets WCAG requirements
59
+ static meetsWCAGRequirements(foreground: string, background: string, level: 'AA' | 'AAA' = 'AA'): boolean {
60
+ const ratio = this.calculateContrastRatio(foreground, background);
61
+ const requiredRatio = level === 'AA' ? 4.5 : 7.0;
62
+
63
+ return ratio >= requiredRatio;
64
+ }
65
+
66
+ // Generate high contrast color variants
67
+ static generateHighContrastVariants(baseColor: string, backgroundColor: string, targetRatio: number = 7.0): string[] {
68
+ const variants: string[] = [];
69
+
70
+ // Generate lighter and darker variants
71
+ for (let i = 1; i <= 10; i++) {
72
+ const lighter = this.adjustColorBrightness(baseColor, i * 0.1);
73
+ const darker = this.adjustColorBrightness(baseColor, -i * 0.1);
74
+
75
+ if (this.calculateContrastRatio(lighter, backgroundColor) >= targetRatio) {
76
+ variants.push(lighter);
77
+ }
78
+
79
+ if (this.calculateContrastRatio(darker, backgroundColor) >= targetRatio) {
80
+ variants.push(darker);
81
+ }
82
+ }
83
+
84
+ return variants;
85
+ }
86
+
87
+ // Adjust color brightness
88
+ private static adjustColorBrightness(color: string, factor: number): string {
89
+ const rgb = this.hexToRgb(color);
90
+ if (!rgb) return color;
91
+
92
+ const { r, g, b } = rgb;
93
+
94
+ const newR = Math.max(0, Math.min(255, Math.round(r + (255 - r) * factor)));
95
+ const newG = Math.max(0, Math.min(255, Math.round(g + (255 - g) * factor)));
96
+ const newB = Math.max(0, Math.min(255, Math.round(b + (255 - b) * factor)));
97
+
98
+ return `#${newR.toString(16).padStart(2, '0')}${newG.toString(16).padStart(2, '0')}${newB.toString(16).padStart(2, '0')}`;
99
+ }
100
+
101
+ // Find best high contrast color
102
+ static findBestHighContrastColor(foreground: string, background: string, targetRatio: number = 7.0): string {
103
+ const ratio = this.calculateContrastRatio(foreground, background);
104
+
105
+ if (ratio >= targetRatio) {
106
+ return foreground;
107
+ }
108
+
109
+ // Try lighter variants first
110
+ for (let i = 1; i <= 20; i++) {
111
+ const lighter = this.adjustColorBrightness(foreground, i * 0.05);
112
+ if (this.calculateContrastRatio(lighter, background) >= targetRatio) {
113
+ return lighter;
114
+ }
115
+ }
116
+
117
+ // Try darker variants
118
+ for (let i = 1; i <= 20; i++) {
119
+ const darker = this.adjustColorBrightness(foreground, -i * 0.05);
120
+ if (this.calculateContrastRatio(darker, background) >= targetRatio) {
121
+ return darker;
122
+ }
123
+ }
124
+
125
+ // Fallback to black or white
126
+ const blackRatio = this.calculateContrastRatio('#000000', background);
127
+ const whiteRatio = this.calculateContrastRatio('#FFFFFF', background);
128
+
129
+ return blackRatio > whiteRatio ? '#000000' : '#FFFFFF';
130
+ }
131
+ }
132
+
133
+ // High contrast theme manager
134
+ export class HighContrastThemeManager {
135
+ private isEnabled: boolean = false;
136
+ private targetContrastRatio: number = 7.0; // WCAG AAA
137
+ private enhancedColors: boolean = true;
138
+ private borderEmphasis: boolean = true;
139
+ private textEmphasis: boolean = true;
140
+ private focusIndicators: boolean = true;
141
+ private originalTheme: MultiThemeConfig | null = null;
142
+ private highContrastTheme: HighContrastThemeConfig | null = null;
143
+
144
+ constructor() {
145
+ this.initializeSystemPreference();
146
+ }
147
+
148
+ // Initialize system preference detection
149
+ private initializeSystemPreference(): void {
150
+ if (typeof window !== 'undefined' && window.matchMedia) {
151
+ const highContrastQuery = window.matchMedia('(prefers-contrast: high)');
152
+ this.isEnabled = highContrastQuery.matches;
153
+
154
+ highContrastQuery.addEventListener('change', (e) => {
155
+ this.isEnabled = e.matches;
156
+ this.applyHighContrast();
157
+ });
158
+ }
159
+ }
160
+
161
+ // Enable high contrast mode
162
+ enable(): void {
163
+ this.isEnabled = true;
164
+ this.applyHighContrast();
165
+ }
166
+
167
+ // Disable high contrast mode
168
+ disable(): void {
169
+ this.isEnabled = false;
170
+ this.removeHighContrast();
171
+ }
172
+
173
+ // Toggle high contrast mode
174
+ toggle(): void {
175
+ if (this.isEnabled) {
176
+ this.disable();
177
+ } else {
178
+ this.enable();
179
+ }
180
+ }
181
+
182
+ // Check if high contrast is enabled
183
+ isHighContrastEnabled(): boolean {
184
+ return this.isEnabled;
185
+ }
186
+
187
+ // Set target contrast ratio
188
+ setTargetContrastRatio(ratio: number): void {
189
+ this.targetContrastRatio = Math.max(1.0, Math.min(21.0, ratio));
190
+ if (this.isEnabled) {
191
+ this.applyHighContrast();
192
+ }
193
+ }
194
+
195
+ // Get current target contrast ratio
196
+ getTargetContrastRatio(): number {
197
+ return this.targetContrastRatio;
198
+ }
199
+
200
+ // Enable/disable enhanced colors
201
+ setEnhancedColors(enabled: boolean): void {
202
+ this.enhancedColors = enabled;
203
+ if (this.isEnabled) {
204
+ this.applyHighContrast();
205
+ }
206
+ }
207
+
208
+ // Enable/disable border emphasis
209
+ setBorderEmphasis(enabled: boolean): void {
210
+ this.borderEmphasis = enabled;
211
+ if (this.isEnabled) {
212
+ this.applyHighContrast();
213
+ }
214
+ }
215
+
216
+ // Enable/disable text emphasis
217
+ setTextEmphasis(enabled: boolean): void {
218
+ this.textEmphasis = enabled;
219
+ if (this.isEnabled) {
220
+ this.applyHighContrast();
221
+ }
222
+ }
223
+
224
+ // Enable/disable focus indicators
225
+ setFocusIndicators(enabled: boolean): void {
226
+ this.focusIndicators = enabled;
227
+ if (this.isEnabled) {
228
+ this.applyHighContrast();
229
+ }
230
+ }
231
+
232
+ // Apply high contrast to current theme
233
+ applyHighContrast(): void {
234
+ if (!this.isEnabled) return;
235
+
236
+ // Store original theme if not already stored
237
+ if (!this.originalTheme) {
238
+ this.originalTheme = this.getCurrentTheme();
239
+ }
240
+
241
+ // Generate high contrast theme
242
+ this.highContrastTheme = this.generateHighContrastTheme(this.originalTheme);
243
+
244
+ // Apply the theme
245
+ this.applyTheme(this.highContrastTheme);
246
+
247
+ // Add high contrast CSS classes
248
+ document.documentElement.classList.add('high-contrast');
249
+
250
+ // Apply high contrast styles
251
+ this.applyHighContrastStyles();
252
+ }
253
+
254
+ // Remove high contrast mode
255
+ removeHighContrast(): void {
256
+ if (!this.isEnabled) return;
257
+
258
+ // Remove high contrast CSS classes
259
+ document.documentElement.classList.remove('high-contrast');
260
+
261
+ // Remove high contrast styles
262
+ this.removeHighContrastStyles();
263
+
264
+ // Restore original theme
265
+ if (this.originalTheme) {
266
+ this.applyTheme(this.originalTheme);
267
+ }
268
+ }
269
+
270
+ // Generate high contrast theme from base theme
271
+ private generateHighContrastTheme(baseTheme: MultiThemeConfig): HighContrastThemeConfig {
272
+ const highContrastTheme: HighContrastThemeConfig = {
273
+ ...baseTheme,
274
+ highContrast: {
275
+ enabled: true,
276
+ contrastRatio: this.targetContrastRatio,
277
+ enhancedColors: this.enhancedColors,
278
+ borderEmphasis: this.borderEmphasis,
279
+ textEmphasis: this.textEmphasis,
280
+ focusIndicators: this.focusIndicators
281
+ }
282
+ };
283
+
284
+ // Enhance colors for high contrast
285
+ if (this.enhancedColors) {
286
+ highContrastTheme.colors = this.enhanceColorsForHighContrast(baseTheme.colors);
287
+ }
288
+
289
+ // Enhance fonts for high contrast
290
+ if (this.textEmphasis) {
291
+ highContrastTheme.fonts = this.enhanceFontsForHighContrast(baseTheme.fonts);
292
+ }
293
+
294
+ // Enhance spacing for high contrast
295
+ highContrastTheme.spacing = this.enhanceSpacingForHighContrast(baseTheme.spacing);
296
+
297
+ // Enhance shadows for high contrast
298
+ highContrastTheme.shadows = this.enhanceShadowsForHighContrast(baseTheme.shadows);
299
+
300
+ return highContrastTheme;
301
+ }
302
+
303
+ // Enhance colors for high contrast
304
+ private enhanceColorsForHighContrast(colors: ColorThemeConfig): ColorThemeConfig {
305
+ const enhancedColors: ColorThemeConfig = { ...colors };
306
+
307
+ // Enhance primary colors
308
+ if (enhancedColors.primary) {
309
+ enhancedColors.primary = {
310
+ ...enhancedColors.primary,
311
+ 500: HighContrastColors.findBestHighContrastColor(
312
+ enhancedColors.primary[500],
313
+ enhancedColors.surface?.background || '#FFFFFF',
314
+ this.targetContrastRatio
315
+ ),
316
+ light: HighContrastColors.findBestHighContrastColor(
317
+ enhancedColors.primary.light || enhancedColors.primary[100],
318
+ enhancedColors.surface?.background || '#FFFFFF',
319
+ this.targetContrastRatio
320
+ ),
321
+ dark: HighContrastColors.findBestHighContrastColor(
322
+ enhancedColors.primary.dark || enhancedColors.primary[900],
323
+ enhancedColors.surface?.background || '#FFFFFF',
324
+ this.targetContrastRatio
325
+ )
326
+ };
327
+ }
328
+
329
+ // Enhance secondary colors
330
+ if (enhancedColors.secondary) {
331
+ enhancedColors.secondary = {
332
+ ...enhancedColors.secondary,
333
+ 500: HighContrastColors.findBestHighContrastColor(
334
+ enhancedColors.secondary[500],
335
+ enhancedColors.surface?.background || '#FFFFFF',
336
+ this.targetContrastRatio
337
+ ),
338
+ light: HighContrastColors.findBestHighContrastColor(
339
+ enhancedColors.secondary.light || enhancedColors.secondary[100],
340
+ enhancedColors.surface?.background || '#FFFFFF',
341
+ this.targetContrastRatio
342
+ ),
343
+ dark: HighContrastColors.findBestHighContrastColor(
344
+ enhancedColors.secondary.dark || enhancedColors.secondary[900],
345
+ enhancedColors.surface?.background || '#FFFFFF',
346
+ this.targetContrastRatio
347
+ )
348
+ };
349
+ }
350
+
351
+ // Enhance error colors
352
+ if (enhancedColors.semantic?.error) {
353
+ enhancedColors.semantic = {
354
+ ...enhancedColors.semantic,
355
+ error: HighContrastColors.findBestHighContrastColor(
356
+ enhancedColors.semantic.error,
357
+ enhancedColors.surface?.background || '#FFFFFF',
358
+ this.targetContrastRatio
359
+ )
360
+ };
361
+ }
362
+
363
+ // Enhance warning colors
364
+ if (enhancedColors.semantic?.warning) {
365
+ enhancedColors.semantic = {
366
+ ...enhancedColors.semantic,
367
+ warning: HighContrastColors.findBestHighContrastColor(
368
+ enhancedColors.semantic.warning,
369
+ enhancedColors.surface?.background || '#FFFFFF',
370
+ this.targetContrastRatio
371
+ )
372
+ };
373
+ }
374
+
375
+ // Enhance success colors
376
+ if (enhancedColors.semantic?.success) {
377
+ enhancedColors.semantic = {
378
+ ...enhancedColors.semantic,
379
+ success: HighContrastColors.findBestHighContrastColor(
380
+ enhancedColors.semantic.success,
381
+ enhancedColors.surface?.background || '#FFFFFF',
382
+ this.targetContrastRatio
383
+ )
384
+ };
385
+ }
386
+
387
+ // Enhance info colors
388
+ if (enhancedColors.semantic?.info) {
389
+ enhancedColors.semantic = {
390
+ ...enhancedColors.semantic,
391
+ info: HighContrastColors.findBestHighContrastColor(
392
+ enhancedColors.semantic.info,
393
+ enhancedColors.surface?.background || '#FFFFFF',
394
+ this.targetContrastRatio
395
+ )
396
+ };
397
+ }
398
+
399
+ // Enhance text colors
400
+ if (enhancedColors.text) {
401
+ enhancedColors.text = {
402
+ ...enhancedColors.text,
403
+ primary: HighContrastColors.findBestHighContrastColor(
404
+ enhancedColors.text.primary,
405
+ enhancedColors.surface?.background || '#FFFFFF',
406
+ this.targetContrastRatio
407
+ ),
408
+ secondary: HighContrastColors.findBestHighContrastColor(
409
+ enhancedColors.text.secondary,
410
+ enhancedColors.surface?.background || '#FFFFFF',
411
+ this.targetContrastRatio
412
+ )
413
+ };
414
+ }
415
+
416
+ return enhancedColors;
417
+ }
418
+
419
+ // Enhance fonts for high contrast
420
+ private enhanceFontsForHighContrast(fonts: any): any {
421
+ const enhancedFonts = { ...fonts };
422
+
423
+ // Increase font weights for better visibility
424
+ if (enhancedFonts.primary?.weights) {
425
+ enhancedFonts.primary.weights = enhancedFonts.primary.weights.map((weight: number) =>
426
+ Math.max(400, weight)
427
+ );
428
+ }
429
+
430
+ if (enhancedFonts.body?.weights) {
431
+ enhancedFonts.body.weights = enhancedFonts.body.weights.map((weight: number) =>
432
+ Math.max(400, weight)
433
+ );
434
+ }
435
+
436
+ // Increase letter spacing for better readability
437
+ if (enhancedFonts.primary?.letterSpacing) {
438
+ enhancedFonts.primary.letterSpacing = {
439
+ ...enhancedFonts.primary.letterSpacing,
440
+ tight: Math.max(0.025, enhancedFonts.primary.letterSpacing.tight || 0.025),
441
+ normal: Math.max(0, enhancedFonts.primary.letterSpacing.normal || 0),
442
+ wide: Math.max(0.025, enhancedFonts.primary.letterSpacing.wide || 0.025)
443
+ };
444
+ }
445
+
446
+ return enhancedFonts;
447
+ }
448
+
449
+ // Enhance spacing for high contrast
450
+ private enhanceSpacingForHighContrast(spacing: any): any {
451
+ const enhancedSpacing = { ...spacing };
452
+
453
+ // Increase focus ring spacing
454
+ if (enhancedSpacing.focusRing) {
455
+ enhancedSpacing.focusRing = Math.max(2, enhancedSpacing.focusRing || 2);
456
+ }
457
+
458
+ // Increase border widths
459
+ if (enhancedSpacing.borderWidth) {
460
+ enhancedSpacing.borderWidth = {
461
+ ...enhancedSpacing.borderWidth,
462
+ thin: Math.max(1, enhancedSpacing.borderWidth.thin || 1),
463
+ normal: Math.max(2, enhancedSpacing.borderWidth.normal || 2),
464
+ thick: Math.max(3, enhancedSpacing.borderWidth.thick || 3)
465
+ };
466
+ }
467
+
468
+ return enhancedSpacing;
469
+ }
470
+
471
+ // Enhance shadows for high contrast
472
+ private enhanceShadowsForHighContrast(shadows: any): any {
473
+ const enhancedShadows = { ...shadows };
474
+
475
+ // Increase shadow intensity
476
+ if (enhancedShadows.intensity) {
477
+ enhancedShadows.intensity = Math.min(1.0, enhancedShadows.intensity * 1.5);
478
+ }
479
+
480
+ // Increase shadow spread
481
+ if (enhancedShadows.spread) {
482
+ enhancedShadows.spread = Math.max(0, enhancedShadows.spread * 1.2);
483
+ }
484
+
485
+ return enhancedShadows;
486
+ }
487
+
488
+ // Apply high contrast styles
489
+ private applyHighContrastStyles(): void {
490
+ const style = document.createElement('style');
491
+ style.id = 'high-contrast-styles';
492
+
493
+ style.textContent = `
494
+ .high-contrast {
495
+ --focus-ring-width: 3px;
496
+ --focus-ring-color: #FFFFFF;
497
+ --focus-ring-offset: 1px;
498
+ --border-emphasis: 2px solid;
499
+ --text-emphasis: 700;
500
+ --shadow-emphasis: 0 4px 8px rgba(0, 0, 0, 0.8);
501
+ }
502
+
503
+ .high-contrast *:focus {
504
+ outline: var(--focus-ring-width) solid var(--focus-ring-color) !important;
505
+ outline-offset: var(--focus-ring-offset) !important;
506
+ }
507
+
508
+ .high-contrast button,
509
+ .high-contrast input,
510
+ .high-contrast select,
511
+ .high-contrast textarea,
512
+ .high-contrast a {
513
+ border: var(--border-emphasis) !important;
514
+ }
515
+
516
+ .high-contrast h1,
517
+ .high-contrast h2,
518
+ .high-contrast h3,
519
+ .high-contrast h4,
520
+ .high-contrast h5,
521
+ .high-contrast h6 {
522
+ font-weight: var(--text-emphasis) !important;
523
+ }
524
+
525
+ .high-contrast .card,
526
+ .high-contrast .modal,
527
+ .high-contrast .tooltip,
528
+ .high-contrast .popover {
529
+ box-shadow: var(--shadow-emphasis) !important;
530
+ border: var(--border-emphasis) !important;
531
+ }
532
+ `;
533
+
534
+ document.head.appendChild(style);
535
+ }
536
+
537
+ // Remove high contrast styles
538
+ private removeHighContrastStyles(): void {
539
+ const style = document.getElementById('high-contrast-styles');
540
+ if (style) {
541
+ style.remove();
542
+ }
543
+ }
544
+
545
+ // Get current theme (placeholder - would integrate with actual theme system)
546
+ private getCurrentTheme(): MultiThemeConfig {
547
+ // This would integrate with the actual theme system
548
+ return {} as MultiThemeConfig;
549
+ }
550
+
551
+ // Apply theme (placeholder - would integrate with actual theme system)
552
+ private applyTheme(theme: MultiThemeConfig): void {
553
+ // This would integrate with the actual theme system
554
+ console.log('Applying theme:', theme);
555
+ }
556
+
557
+ // Get high contrast configuration
558
+ getConfiguration(): {
559
+ enabled: boolean;
560
+ targetContrastRatio: number;
561
+ enhancedColors: boolean;
562
+ borderEmphasis: boolean;
563
+ textEmphasis: boolean;
564
+ focusIndicators: boolean;
565
+ } {
566
+ return {
567
+ enabled: this.isEnabled,
568
+ targetContrastRatio: this.targetContrastRatio,
569
+ enhancedColors: this.enhancedColors,
570
+ borderEmphasis: this.borderEmphasis,
571
+ textEmphasis: this.textEmphasis,
572
+ focusIndicators: this.focusIndicators
573
+ };
574
+ }
575
+
576
+ // Validate high contrast theme
577
+ validateHighContrastTheme(theme: HighContrastThemeConfig): boolean {
578
+ if (!theme.highContrast?.enabled) return false;
579
+
580
+ // Validate contrast ratios
581
+ if (theme.colors) {
582
+ const background = theme.colors.surface?.background || '#FFFFFF';
583
+
584
+ // Check primary color contrast
585
+ if (theme.colors.primary?.[500]) {
586
+ const ratio = HighContrastColors.calculateContrastRatio(
587
+ theme.colors.primary[500],
588
+ background
589
+ );
590
+ if (ratio < this.targetContrastRatio) {
591
+ console.warn(`Primary color contrast ratio ${ratio} is below target ${this.targetContrastRatio}`);
592
+ return false;
593
+ }
594
+ }
595
+
596
+ // Check text color contrast
597
+ if (theme.colors.text?.primary) {
598
+ const ratio = HighContrastColors.calculateContrastRatio(
599
+ theme.colors.text.primary,
600
+ background
601
+ );
602
+ if (ratio < this.targetContrastRatio) {
603
+ console.warn(`Text color contrast ratio ${ratio} is below target ${this.targetContrastRatio}`);
604
+ return false;
605
+ }
606
+ }
607
+ }
608
+
609
+ return true;
610
+ }
611
+ }
612
+
613
+ // Export default instances
614
+ export const highContrastThemeManager = new HighContrastThemeManager();
615
+
616
+ // Export default
617
+ export default {
618
+ HighContrastColors,
619
+ HighContrastThemeManager,
620
+ highContrastThemeManager
621
+ };
@@ -0,0 +1,19 @@
1
+ // Main theme exports
2
+ // This file provides a clean interface for importing themes
3
+
4
+ export * from './base-themes';
5
+ export * from './types';
6
+ export * from './inheritance';
7
+ export * from './useTheme';
8
+ export * from './ThemeProvider';
9
+
10
+ // Export default theme for reference
11
+ export { defaultTheme } from './themes/default';
12
+
13
+ // Direct theme imports for convenience (with inheritance applied)
14
+ export {
15
+ stanDesignTheme,
16
+
17
+ harveyTheme,
18
+ defaultTheme as baseDefaultTheme
19
+ } from './base-themes';