@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.1.4 → 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,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Font Loader
|
|
3
|
+
* Dynamically loads fonts for different themes
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { FontThemeConfig, FontFiles } from './types';
|
|
7
|
+
|
|
8
|
+
export class FontLoader {
|
|
9
|
+
private loadedFonts: Set<string> = new Set();
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Load fonts for a theme
|
|
13
|
+
*/
|
|
14
|
+
async loadThemeFonts(fonts: FontThemeConfig): Promise<void> {
|
|
15
|
+
const fontPromises: Promise<void>[] = [];
|
|
16
|
+
|
|
17
|
+
// Load primary font
|
|
18
|
+
fontPromises.push(this.loadFont(fonts.primary));
|
|
19
|
+
|
|
20
|
+
// Load secondary font
|
|
21
|
+
fontPromises.push(this.loadFont(fonts.secondary));
|
|
22
|
+
|
|
23
|
+
// Load display font
|
|
24
|
+
fontPromises.push(this.loadFont(fonts.display));
|
|
25
|
+
|
|
26
|
+
// Load body font
|
|
27
|
+
fontPromises.push(this.loadFont(fonts.body));
|
|
28
|
+
|
|
29
|
+
// Wait for all fonts to load
|
|
30
|
+
await Promise.all(fontPromises);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Load a single font family
|
|
35
|
+
*/
|
|
36
|
+
private async loadFont(fontConfig: FontThemeConfig['primary']): Promise<void> {
|
|
37
|
+
const { family, weights, display = 'swap', source } = fontConfig;
|
|
38
|
+
|
|
39
|
+
// Skip if already loaded
|
|
40
|
+
if (this.loadedFonts.has(family)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
// Load based on source type
|
|
46
|
+
if (source?.type === 'google') {
|
|
47
|
+
await this.loadGoogleFont(family, weights, display);
|
|
48
|
+
this.loadedFonts.add(family);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (source?.type === 'custom' && source.files) {
|
|
53
|
+
await this.loadCustomFontFiles(family, source.files, weights, display);
|
|
54
|
+
this.loadedFonts.add(family);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (source?.type === 'system' || !source) {
|
|
59
|
+
// Check if font is available in the system
|
|
60
|
+
if (await this.isFontAvailable(family)) {
|
|
61
|
+
this.loadedFonts.add(family);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Fallback: try Google Fonts if it's a known web font
|
|
67
|
+
if (this.isGoogleFont(family)) {
|
|
68
|
+
await this.loadGoogleFont(family, weights, display);
|
|
69
|
+
this.loadedFonts.add(family);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
console.warn(`Font ${family} could not be loaded, falling back to system fonts`);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(`Error loading font ${family}:`, error);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Check if a font is available in the system
|
|
81
|
+
*/
|
|
82
|
+
private async isFontAvailable(fontFamily: string): Promise<boolean> {
|
|
83
|
+
if (typeof document === 'undefined') return false;
|
|
84
|
+
|
|
85
|
+
// Remove quotes and get the first font family
|
|
86
|
+
const cleanFamily = fontFamily.split(',')[0].replace(/['"]/g, '').trim();
|
|
87
|
+
|
|
88
|
+
return new Promise((resolve) => {
|
|
89
|
+
// Use FontFace API if available
|
|
90
|
+
if ('fonts' in document) {
|
|
91
|
+
const font = new FontFace(cleanFamily, 'normal');
|
|
92
|
+
font.load().then(() => {
|
|
93
|
+
resolve(true);
|
|
94
|
+
}).catch(() => {
|
|
95
|
+
resolve(false);
|
|
96
|
+
});
|
|
97
|
+
} else {
|
|
98
|
+
// For now, assume font is available if FontFace API is not supported
|
|
99
|
+
resolve(true);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check if a font is a Google Font
|
|
106
|
+
*/
|
|
107
|
+
private isGoogleFont(fontFamily: string): boolean {
|
|
108
|
+
const googleFonts = [
|
|
109
|
+
'Poppins', 'Inter', 'Roboto', 'Open Sans', 'Lato', 'Montserrat', 'Source Sans Pro',
|
|
110
|
+
'Raleway', 'PT Sans', 'Ubuntu', 'Noto Sans', 'Oswald', 'Playfair Display'
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
const cleanFamily = fontFamily.split(',')[0].replace(/['"]/g, '').trim();
|
|
114
|
+
return googleFonts.includes(cleanFamily);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Load a Google Font
|
|
119
|
+
*/
|
|
120
|
+
private async loadGoogleFont(family: string, weights: number[], display: string): Promise<void> {
|
|
121
|
+
const cleanFamily = family.split(',')[0].replace(/['"]/g, '').trim();
|
|
122
|
+
const weightsParam = weights.join(',');
|
|
123
|
+
|
|
124
|
+
const link = document.createElement('link');
|
|
125
|
+
link.rel = 'stylesheet';
|
|
126
|
+
link.href = `https://fonts.googleapis.com/css2?family=${cleanFamily.replace(/\s+/g, '+')}:wght@${weightsParam}&display=${display}`;
|
|
127
|
+
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
link.onload = () => resolve();
|
|
130
|
+
link.onerror = () => reject(new Error(`Failed to load Google Font: ${family}`));
|
|
131
|
+
document.head.appendChild(link);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Load custom font files using @font-face
|
|
137
|
+
*/
|
|
138
|
+
private async loadCustomFontFiles(family: string, files: FontFiles, weights: number[], display: string): Promise<void> {
|
|
139
|
+
const promises: Promise<void>[] = [];
|
|
140
|
+
|
|
141
|
+
weights.forEach(weight => {
|
|
142
|
+
if (files.woff2) {
|
|
143
|
+
promises.push(this.loadFontFace(family, weight, files.woff2, 'woff2', display));
|
|
144
|
+
} else if (files.woff) {
|
|
145
|
+
promises.push(this.loadFontFace(family, weight, files.woff, 'woff', display));
|
|
146
|
+
} else if (files.ttf) {
|
|
147
|
+
promises.push(this.loadFontFace(family, weight, files.ttf, 'truetype', display));
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
await Promise.all(promises);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Load a single font face using @font-face
|
|
156
|
+
*/
|
|
157
|
+
private async loadFontFace(family: string, weight: number, url: string, format: string, display: string): Promise<void> {
|
|
158
|
+
if (typeof document === 'undefined') return;
|
|
159
|
+
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
const style = document.createElement('style');
|
|
162
|
+
style.textContent = `
|
|
163
|
+
@font-face {
|
|
164
|
+
font-family: '${family}';
|
|
165
|
+
font-weight: ${weight};
|
|
166
|
+
font-display: ${display};
|
|
167
|
+
src: url('${url}') format('${format}');
|
|
168
|
+
}
|
|
169
|
+
`;
|
|
170
|
+
|
|
171
|
+
style.onload = () => resolve();
|
|
172
|
+
style.onerror = () => reject(new Error(`Failed to load font: ${family} ${weight}`));
|
|
173
|
+
|
|
174
|
+
document.head.appendChild(style);
|
|
175
|
+
|
|
176
|
+
// Resolve immediately since CSS loading doesn't have a reliable onload event
|
|
177
|
+
resolve();
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Clear loaded fonts
|
|
185
|
+
*/
|
|
186
|
+
clearLoadedFonts(): void {
|
|
187
|
+
this.loadedFonts.clear();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Get list of loaded fonts
|
|
192
|
+
*/
|
|
193
|
+
getLoadedFonts(): string[] {
|
|
194
|
+
return Array.from(this.loadedFonts);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Default font loader instance
|
|
200
|
+
*/
|
|
201
|
+
export const fontLoader = new FontLoader();
|