@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.6 → 0.2.8
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/components/ui/accessibility-demo.d.ts +259 -0
- package/dist/components/ui/accessibility-demo.esm.js +265 -0
- package/dist/components/ui/accessibility-demo.js +265 -0
- package/dist/components/ui/advanced-component-architecture-demo.d.ts +718 -0
- package/dist/components/ui/advanced-component-architecture-demo.esm.js +860 -0
- package/dist/components/ui/advanced-component-architecture-demo.js +860 -0
- package/dist/components/ui/advanced-transition-system-demo.d.ts +660 -0
- package/dist/components/ui/advanced-transition-system-demo.esm.js +624 -0
- package/dist/components/ui/advanced-transition-system-demo.js +624 -0
- package/dist/components/ui/advanced-transition-system.d.ts +391 -0
- package/dist/components/ui/advanced-transition-system.esm.js +351 -0
- package/dist/components/ui/advanced-transition-system.js +351 -0
- package/dist/components/ui/animation/animated-container.d.ts +162 -0
- package/dist/components/ui/animation/animated-container.esm.js +143 -0
- package/dist/components/ui/animation/animated-container.js +143 -0
- package/dist/components/ui/animation/index.d.ts +9 -0
- package/dist/components/ui/animation/index.esm.js +19 -0
- package/dist/components/ui/animation/index.js +19 -0
- package/dist/components/ui/animation/staggered-container.d.ts +64 -0
- package/dist/components/ui/animation/staggered-container.esm.js +59 -0
- package/dist/components/ui/animation/staggered-container.js +59 -0
- package/dist/components/ui/animation-demo.d.ts +238 -0
- package/dist/components/ui/animation-demo.esm.js +218 -0
- package/dist/components/ui/animation-demo.js +218 -0
- package/dist/components/ui/badge.d.ts +28 -0
- package/dist/components/ui/badge.esm.js +30 -0
- package/dist/components/ui/badge.js +30 -0
- package/dist/components/ui/battery-conscious-animation-demo.d.ts +561 -0
- package/dist/components/ui/battery-conscious-animation-demo.esm.js +533 -0
- package/dist/components/ui/battery-conscious-animation-demo.js +533 -0
- package/dist/components/ui/border-radius-shadow-demo.d.ts +183 -0
- package/dist/components/ui/border-radius-shadow-demo.esm.js +176 -0
- package/dist/components/ui/border-radius-shadow-demo.js +176 -0
- package/dist/components/ui/button.d.ts +33 -0
- package/dist/components/ui/button.esm.js +30 -0
- package/dist/components/ui/button.js +30 -0
- package/dist/components/ui/card.d.ts +205 -0
- package/dist/components/ui/card.esm.js +182 -0
- package/dist/components/ui/card.js +182 -0
- package/dist/components/ui/checkbox.d.ts +26 -0
- package/dist/components/ui/checkbox.esm.js +30 -0
- package/dist/components/ui/checkbox.js +30 -0
- package/dist/components/ui/color-preview.d.ts +402 -0
- package/dist/components/ui/color-preview.esm.js +388 -0
- package/dist/components/ui/color-preview.js +388 -0
- package/dist/components/ui/data-display/chart.d.ts +646 -0
- package/dist/components/ui/data-display/chart.esm.js +625 -0
- package/dist/components/ui/data-display/chart.js +625 -0
- package/dist/components/ui/data-display/data-grid-simple.d.ts +73 -0
- package/dist/components/ui/data-display/data-grid-simple.esm.js +76 -0
- package/dist/components/ui/data-display/data-grid-simple.js +76 -0
- package/dist/components/ui/data-display/data-grid.d.ts +670 -0
- package/dist/components/ui/data-display/data-grid.esm.js +667 -0
- package/dist/components/ui/data-display/data-grid.js +667 -0
- package/dist/components/ui/data-display/list.d.ts +448 -0
- package/dist/components/ui/data-display/list.esm.js +448 -0
- package/dist/components/ui/data-display/list.js +448 -0
- package/dist/components/ui/data-display/table.d.ts +472 -0
- package/dist/components/ui/data-display/table.esm.js +474 -0
- package/dist/components/ui/data-display/table.js +474 -0
- package/dist/components/ui/data-display/timeline.d.ts +433 -0
- package/dist/components/ui/data-display/timeline.esm.js +436 -0
- package/dist/components/ui/data-display/timeline.js +436 -0
- package/dist/components/ui/data-display/tree.d.ts +594 -0
- package/dist/components/ui/data-display/tree.esm.js +570 -0
- package/dist/components/ui/data-display/tree.js +570 -0
- package/dist/components/ui/data-display/types.d.ts +534 -0
- package/dist/components/ui/data-display/types.esm.js +511 -0
- package/dist/components/ui/data-display/types.js +511 -0
- package/dist/components/ui/enterprise-mobile-experience-demo.d.ts +735 -0
- package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +699 -0
- package/dist/components/ui/enterprise-mobile-experience-demo.js +699 -0
- package/dist/components/ui/enterprise-mobile-experience.d.ts +461 -0
- package/dist/components/ui/enterprise-mobile-experience.esm.js +413 -0
- package/dist/components/ui/enterprise-mobile-experience.js +413 -0
- package/dist/components/ui/feedback/alert.d.ts +154 -0
- package/dist/components/ui/feedback/alert.esm.js +150 -0
- package/dist/components/ui/feedback/alert.js +150 -0
- package/dist/components/ui/feedback/progress.d.ts +288 -0
- package/dist/components/ui/feedback/progress.esm.js +269 -0
- package/dist/components/ui/feedback/progress.js +269 -0
- package/dist/components/ui/feedback/skeleton.d.ts +182 -0
- package/dist/components/ui/feedback/skeleton.esm.js +175 -0
- package/dist/components/ui/feedback/skeleton.js +175 -0
- package/dist/components/ui/feedback/toast.d.ts +277 -0
- package/dist/components/ui/feedback/toast.esm.js +256 -0
- package/dist/components/ui/feedback/toast.js +256 -0
- package/dist/components/ui/feedback/types.d.ts +123 -0
- package/dist/components/ui/feedback/types.esm.js +125 -0
- package/dist/components/ui/feedback/types.js +125 -0
- package/dist/components/ui/font-preview.d.ts +282 -0
- package/dist/components/ui/font-preview.esm.js +286 -0
- package/dist/components/ui/font-preview.js +286 -0
- package/dist/components/ui/form-demo.d.ts +544 -0
- package/dist/components/ui/form-demo.esm.js +516 -0
- package/dist/components/ui/form-demo.js +516 -0
- package/dist/components/ui/hardware-acceleration-demo.d.ts +540 -0
- package/dist/components/ui/hardware-acceleration-demo.esm.js +497 -0
- package/dist/components/ui/hardware-acceleration-demo.js +497 -0
- package/dist/components/ui/input.d.ts +33 -0
- package/dist/components/ui/input.esm.js +32 -0
- package/dist/components/ui/input.js +32 -0
- package/dist/components/ui/label.d.ts +13 -0
- package/dist/components/ui/label.esm.js +16 -0
- package/dist/components/ui/label.js +16 -0
- package/dist/components/ui/layout-demo.d.ts +352 -0
- package/dist/components/ui/layout-demo.esm.js +342 -0
- package/dist/components/ui/layout-demo.js +342 -0
- package/dist/components/ui/layouts/adaptive-layout.d.ts +132 -0
- package/dist/components/ui/layouts/adaptive-layout.esm.js +120 -0
- package/dist/components/ui/layouts/adaptive-layout.js +120 -0
- package/dist/components/ui/layouts/desktop-layout.d.ts +219 -0
- package/dist/components/ui/layouts/desktop-layout.esm.js +204 -0
- package/dist/components/ui/layouts/desktop-layout.js +204 -0
- package/dist/components/ui/layouts/index.d.ts +5 -0
- package/dist/components/ui/layouts/index.esm.js +10 -0
- package/dist/components/ui/layouts/index.js +10 -0
- package/dist/components/ui/layouts/mobile-layout.d.ts +158 -0
- package/dist/components/ui/layouts/mobile-layout.esm.js +152 -0
- package/dist/components/ui/layouts/mobile-layout.js +152 -0
- package/dist/components/ui/layouts/tablet-layout.d.ts +192 -0
- package/dist/components/ui/layouts/tablet-layout.esm.js +183 -0
- package/dist/components/ui/layouts/tablet-layout.js +183 -0
- package/dist/components/ui/mobile-form-validation.d.ts +439 -0
- package/dist/components/ui/mobile-form-validation.esm.js +418 -0
- package/dist/components/ui/mobile-form-validation.js +418 -0
- package/dist/components/ui/mobile-input-demo.d.ts +197 -0
- package/dist/components/ui/mobile-input-demo.esm.js +195 -0
- package/dist/components/ui/mobile-input-demo.js +195 -0
- package/dist/components/ui/mobile-input.d.ts +273 -0
- package/dist/components/ui/mobile-input.esm.js +216 -0
- package/dist/components/ui/mobile-input.js +216 -0
- package/dist/components/ui/mobile-skeleton-loading-demo.d.ts +628 -0
- package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +621 -0
- package/dist/components/ui/mobile-skeleton-loading-demo.js +621 -0
- package/dist/components/ui/navigation/breadcrumb.d.ts +149 -0
- package/dist/components/ui/navigation/breadcrumb.esm.js +155 -0
- package/dist/components/ui/navigation/breadcrumb.js +155 -0
- package/dist/components/ui/navigation/index.d.ts +25 -0
- package/dist/components/ui/navigation/index.esm.js +14 -0
- package/dist/components/ui/navigation/index.js +14 -0
- package/dist/components/ui/navigation/menu.d.ts +366 -0
- package/dist/components/ui/navigation/menu.esm.js +360 -0
- package/dist/components/ui/navigation/menu.js +360 -0
- package/dist/components/ui/navigation/navigation-demo.d.ts +169 -0
- package/dist/components/ui/navigation/navigation-demo.esm.js +317 -0
- package/dist/components/ui/navigation/navigation-demo.js +317 -0
- package/dist/components/ui/navigation/pagination.d.ts +261 -0
- package/dist/components/ui/navigation/pagination.esm.js +260 -0
- package/dist/components/ui/navigation/pagination.js +260 -0
- package/dist/components/ui/navigation/sidebar.d.ts +375 -0
- package/dist/components/ui/navigation/sidebar.esm.js +369 -0
- package/dist/components/ui/navigation/sidebar.js +369 -0
- package/dist/components/ui/navigation/stepper.d.ts +294 -0
- package/dist/components/ui/navigation/stepper.esm.js +292 -0
- package/dist/components/ui/navigation/stepper.js +292 -0
- package/dist/components/ui/navigation/tabs.d.ts +196 -0
- package/dist/components/ui/navigation/tabs.esm.js +194 -0
- package/dist/components/ui/navigation/tabs.js +194 -0
- package/dist/components/ui/navigation/types.d.ts +293 -0
- package/dist/components/ui/navigation/types.esm.js +298 -0
- package/dist/components/ui/navigation/types.js +298 -0
- package/dist/components/ui/overlay/backdrop.d.ts +79 -0
- package/dist/components/ui/overlay/backdrop.esm.js +80 -0
- package/dist/components/ui/overlay/backdrop.js +80 -0
- package/dist/components/ui/overlay/focus-manager.d.ts +141 -0
- package/dist/components/ui/overlay/focus-manager.esm.js +141 -0
- package/dist/components/ui/overlay/focus-manager.js +141 -0
- package/dist/components/ui/overlay/index.d.ts +27 -0
- package/dist/components/ui/overlay/index.esm.js +16 -0
- package/dist/components/ui/overlay/index.js +16 -0
- package/dist/components/ui/overlay/modal.d.ts +262 -0
- package/dist/components/ui/overlay/modal.esm.js +266 -0
- package/dist/components/ui/overlay/modal.js +266 -0
- package/dist/components/ui/overlay/overlay-manager.d.ts +107 -0
- package/dist/components/ui/overlay/overlay-manager.esm.js +105 -0
- package/dist/components/ui/overlay/overlay-manager.js +105 -0
- package/dist/components/ui/overlay/popover.d.ts +450 -0
- package/dist/components/ui/overlay/popover.esm.js +446 -0
- package/dist/components/ui/overlay/popover.js +446 -0
- package/dist/components/ui/overlay/portal.d.ts +75 -0
- package/dist/components/ui/overlay/portal.esm.js +79 -0
- package/dist/components/ui/overlay/portal.js +79 -0
- package/dist/components/ui/overlay/tooltip.d.ts +298 -0
- package/dist/components/ui/overlay/tooltip.esm.js +288 -0
- package/dist/components/ui/overlay/tooltip.js +288 -0
- package/dist/components/ui/overlay/types.d.ts +194 -0
- package/dist/components/ui/overlay/types.esm.js +195 -0
- package/dist/components/ui/overlay/types.js +195 -0
- package/dist/components/ui/performance-demo.d.ts +583 -0
- package/dist/components/ui/performance-demo.esm.js +549 -0
- package/dist/components/ui/performance-demo.js +549 -0
- package/dist/components/ui/semantic-input-system-demo.d.ts +490 -0
- package/dist/components/ui/semantic-input-system-demo.esm.js +465 -0
- package/dist/components/ui/semantic-input-system-demo.js +465 -0
- package/dist/components/ui/theme-customizer.d.ts +378 -0
- package/dist/components/ui/theme-customizer.esm.js +354 -0
- package/dist/components/ui/theme-customizer.js +354 -0
- package/dist/components/ui/theme-preview.d.ts +305 -0
- package/dist/components/ui/theme-preview.esm.js +258 -0
- package/dist/components/ui/theme-preview.js +258 -0
- package/dist/components/ui/theme-switcher.d.ts +259 -0
- package/dist/components/ui/theme-switcher.esm.js +238 -0
- package/dist/components/ui/theme-switcher.js +238 -0
- package/dist/components/ui/theme-toggle.d.ts +34 -0
- package/dist/components/ui/theme-toggle.esm.js +38 -0
- package/dist/components/ui/theme-toggle.js +38 -0
- package/dist/components/ui/token-demo.d.ts +188 -0
- package/dist/components/ui/token-demo.esm.js +183 -0
- package/dist/components/ui/token-demo.js +183 -0
- package/dist/components/ui/touch-demo.d.ts +455 -0
- package/dist/components/ui/touch-demo.esm.js +433 -0
- package/dist/components/ui/touch-demo.js +433 -0
- package/dist/components/ui/touch-friendly-interface-demo.d.ts +512 -0
- package/dist/components/ui/touch-friendly-interface-demo.esm.js +481 -0
- package/dist/components/ui/touch-friendly-interface-demo.js +481 -0
- package/dist/components/ui/touch-friendly-interface.d.ts +292 -0
- package/dist/components/ui/touch-friendly-interface.esm.js +272 -0
- package/dist/components/ui/touch-friendly-interface.js +272 -0
- package/dist/hooks/index.d.ts +161 -0
- package/dist/hooks/index.esm.js +190 -0
- package/dist/hooks/index.js +190 -0
- package/dist/hooks/use-accessibility-support.d.ts +516 -0
- package/dist/hooks/use-accessibility-support.esm.js +488 -0
- package/dist/hooks/use-accessibility-support.js +488 -0
- package/dist/hooks/use-adaptive-layout.d.ts +287 -0
- package/dist/hooks/use-adaptive-layout.esm.js +266 -0
- package/dist/hooks/use-adaptive-layout.js +266 -0
- package/dist/hooks/use-advanced-patterns.d.ts +292 -0
- package/dist/hooks/use-advanced-patterns.esm.js +279 -0
- package/dist/hooks/use-advanced-patterns.js +279 -0
- package/dist/hooks/use-advanced-transition-system.d.ts +390 -0
- package/dist/hooks/use-advanced-transition-system.esm.js +352 -0
- package/dist/hooks/use-advanced-transition-system.js +352 -0
- package/dist/hooks/use-animation-profile.d.ts +285 -0
- package/dist/hooks/use-animation-profile.esm.js +259 -0
- package/dist/hooks/use-animation-profile.js +259 -0
- package/dist/hooks/use-battery-animations.d.ts +382 -0
- package/dist/hooks/use-battery-animations.esm.js +359 -0
- package/dist/hooks/use-battery-animations.js +359 -0
- package/dist/hooks/use-battery-conscious-loading.d.ts +473 -0
- package/dist/hooks/use-battery-conscious-loading.esm.js +432 -0
- package/dist/hooks/use-battery-conscious-loading.js +432 -0
- package/dist/hooks/use-battery-optimization.d.ts +328 -0
- package/dist/hooks/use-battery-optimization.esm.js +307 -0
- package/dist/hooks/use-battery-optimization.js +307 -0
- package/dist/hooks/use-battery-status.d.ts +297 -0
- package/dist/hooks/use-battery-status.esm.js +277 -0
- package/dist/hooks/use-battery-status.js +277 -0
- package/dist/hooks/use-component-performance.d.ts +342 -0
- package/dist/hooks/use-component-performance.esm.js +329 -0
- package/dist/hooks/use-component-performance.js +329 -0
- package/dist/hooks/use-device-loading-states.d.ts +456 -0
- package/dist/hooks/use-device-loading-states.esm.js +416 -0
- package/dist/hooks/use-device-loading-states.js +416 -0
- package/dist/hooks/use-device.d.ts +104 -0
- package/dist/hooks/use-device.esm.js +99 -0
- package/dist/hooks/use-device.js +99 -0
- package/dist/hooks/use-enterprise-mobile-experience.d.ts +486 -0
- package/dist/hooks/use-enterprise-mobile-experience.esm.js +439 -0
- package/dist/hooks/use-enterprise-mobile-experience.js +439 -0
- package/dist/hooks/use-form-feedback.d.ts +401 -0
- package/dist/hooks/use-form-feedback.esm.js +360 -0
- package/dist/hooks/use-form-feedback.js +360 -0
- package/dist/hooks/use-form-performance.d.ts +511 -0
- package/dist/hooks/use-form-performance.esm.js +478 -0
- package/dist/hooks/use-form-performance.js +478 -0
- package/dist/hooks/use-frame-rate.d.ts +249 -0
- package/dist/hooks/use-frame-rate.esm.js +232 -0
- package/dist/hooks/use-frame-rate.js +232 -0
- package/dist/hooks/use-gestures.d.ts +336 -0
- package/dist/hooks/use-gestures.esm.js +314 -0
- package/dist/hooks/use-gestures.js +314 -0
- package/dist/hooks/use-hardware-acceleration.d.ts +339 -0
- package/dist/hooks/use-hardware-acceleration.esm.js +313 -0
- package/dist/hooks/use-hardware-acceleration.js +313 -0
- package/dist/hooks/use-input-accessibility.d.ts +451 -0
- package/dist/hooks/use-input-accessibility.esm.js +417 -0
- package/dist/hooks/use-input-accessibility.js +417 -0
- package/dist/hooks/use-input-performance.d.ts +503 -0
- package/dist/hooks/use-input-performance.esm.js +471 -0
- package/dist/hooks/use-input-performance.js +471 -0
- package/dist/hooks/use-layout-performance.d.ts +317 -0
- package/dist/hooks/use-layout-performance.esm.js +298 -0
- package/dist/hooks/use-layout-performance.js +298 -0
- package/dist/hooks/use-loading-accessibility.d.ts +532 -0
- package/dist/hooks/use-loading-accessibility.esm.js +495 -0
- package/dist/hooks/use-loading-accessibility.js +495 -0
- package/dist/hooks/use-loading-performance.d.ts +471 -0
- package/dist/hooks/use-loading-performance.esm.js +449 -0
- package/dist/hooks/use-loading-performance.js +449 -0
- package/dist/hooks/use-memory-usage.d.ts +285 -0
- package/dist/hooks/use-memory-usage.esm.js +268 -0
- package/dist/hooks/use-memory-usage.js +268 -0
- package/dist/hooks/use-mobile-form-layout.d.ts +462 -0
- package/dist/hooks/use-mobile-form-layout.esm.js +427 -0
- package/dist/hooks/use-mobile-form-layout.js +427 -0
- package/dist/hooks/use-mobile-form-validation.d.ts +516 -0
- package/dist/hooks/use-mobile-form-validation.esm.js +451 -0
- package/dist/hooks/use-mobile-form-validation.js +451 -0
- package/dist/hooks/use-mobile-keyboard-optimization.d.ts +469 -0
- package/dist/hooks/use-mobile-keyboard-optimization.esm.js +431 -0
- package/dist/hooks/use-mobile-keyboard-optimization.js +431 -0
- package/dist/hooks/use-mobile-layout.d.ts +300 -0
- package/dist/hooks/use-mobile-layout.esm.js +280 -0
- package/dist/hooks/use-mobile-layout.js +280 -0
- package/dist/hooks/use-mobile-optimization.d.ts +404 -0
- package/dist/hooks/use-mobile-optimization.esm.js +378 -0
- package/dist/hooks/use-mobile-optimization.js +378 -0
- package/dist/hooks/use-mobile-skeleton.d.ts +399 -0
- package/dist/hooks/use-mobile-skeleton.esm.js +369 -0
- package/dist/hooks/use-mobile-skeleton.js +369 -0
- package/dist/hooks/use-mobile-touch.d.ts +412 -0
- package/dist/hooks/use-mobile-touch.esm.js +379 -0
- package/dist/hooks/use-mobile-touch.js +379 -0
- package/dist/hooks/use-performance-throttling.d.ts +346 -0
- package/dist/hooks/use-performance-throttling.esm.js +324 -0
- package/dist/hooks/use-performance-throttling.js +324 -0
- package/dist/hooks/use-performance.d.ts +314 -0
- package/dist/hooks/use-performance.esm.js +278 -0
- package/dist/hooks/use-performance.js +278 -0
- package/dist/hooks/use-reusable-architecture.d.ts +412 -0
- package/dist/hooks/use-reusable-architecture.esm.js +385 -0
- package/dist/hooks/use-reusable-architecture.js +385 -0
- package/dist/hooks/use-semantic-input-types.d.ts +354 -0
- package/dist/hooks/use-semantic-input-types.esm.js +315 -0
- package/dist/hooks/use-semantic-input-types.js +315 -0
- package/dist/hooks/use-semantic-input.d.ts +563 -0
- package/dist/hooks/use-semantic-input.esm.js +513 -0
- package/dist/hooks/use-semantic-input.js +513 -0
- package/dist/hooks/use-tablet-layout.d.ts +382 -0
- package/dist/hooks/use-tablet-layout.esm.js +355 -0
- package/dist/hooks/use-tablet-layout.js +355 -0
- package/dist/hooks/use-touch-friendly-input.d.ts +520 -0
- package/dist/hooks/use-touch-friendly-input.esm.js +480 -0
- package/dist/hooks/use-touch-friendly-input.js +480 -0
- package/dist/hooks/use-touch-friendly-interface.d.ts +329 -0
- package/dist/hooks/use-touch-friendly-interface.esm.js +299 -0
- package/dist/hooks/use-touch-friendly-interface.js +299 -0
- package/dist/hooks/use-touch-optimization.d.ts +373 -0
- package/dist/hooks/use-touch-optimization.esm.js +348 -0
- package/dist/hooks/use-touch-optimization.js +348 -0
- package/dist/index.esm.js +2 -2
- package/dist/index.js +2 -2
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.esm.js +6 -0
- package/dist/lib/utils.js +6 -0
- package/dist/plugins/theme-css-generator.d.ts +345 -0
- package/dist/plugins/theme-css-generator.esm.js +305 -0
- package/dist/plugins/theme-css-generator.js +305 -0
- package/dist/styles.css +1 -1
- package/dist/themes/ThemeContext.d.ts +27 -0
- package/dist/themes/ThemeContext.esm.js +31 -0
- package/dist/themes/ThemeContext.js +31 -0
- package/dist/themes/ThemeProvider.d.ts +222 -0
- package/dist/themes/ThemeProvider.esm.js +229 -0
- package/dist/themes/ThemeProvider.js +229 -0
- package/dist/themes/accessibility/index.d.ts +7 -0
- package/dist/themes/accessibility/index.esm.js +27 -0
- package/dist/themes/accessibility/index.js +27 -0
- package/dist/themes/accessibility.d.ts +259 -0
- package/dist/themes/accessibility.esm.js +220 -0
- package/dist/themes/accessibility.js +220 -0
- package/dist/themes/aria-patterns.d.ts +418 -0
- package/dist/themes/aria-patterns.esm.js +384 -0
- package/dist/themes/aria-patterns.js +384 -0
- package/dist/themes/base-themes.d.ts +34 -0
- package/dist/themes/base-themes.esm.js +52 -0
- package/dist/themes/base-themes.js +52 -0
- package/dist/themes/colorManager.d.ts +327 -0
- package/dist/themes/colorManager.esm.js +362 -0
- package/dist/themes/colorManager.js +362 -0
- package/dist/themes/examples/dark-theme.d.ts +139 -0
- package/dist/themes/examples/dark-theme.esm.js +124 -0
- package/dist/themes/examples/dark-theme.js +124 -0
- package/dist/themes/examples/minimal-theme.d.ts +93 -0
- package/dist/themes/examples/minimal-theme.esm.js +86 -0
- package/dist/themes/examples/minimal-theme.js +86 -0
- package/dist/themes/focus-management.d.ts +699 -0
- package/dist/themes/focus-management.esm.js +642 -0
- package/dist/themes/focus-management.js +642 -0
- package/dist/themes/fontLoader.d.ts +163 -0
- package/dist/themes/fontLoader.esm.js +192 -0
- package/dist/themes/fontLoader.js +192 -0
- package/dist/themes/high-contrast.d.ts +619 -0
- package/dist/themes/high-contrast.esm.js +573 -0
- package/dist/themes/high-contrast.js +573 -0
- package/dist/themes/index.d.ts +11 -0
- package/dist/themes/index.esm.js +19 -0
- package/dist/themes/index.js +19 -0
- package/dist/themes/inheritance.d.ts +160 -0
- package/dist/themes/inheritance.esm.js +219 -0
- package/dist/themes/inheritance.js +219 -0
- package/dist/themes/keyboard-navigation.d.ts +550 -0
- package/dist/themes/keyboard-navigation.esm.js +521 -0
- package/dist/themes/keyboard-navigation.js +521 -0
- package/dist/themes/motion-reduction.d.ts +660 -0
- package/dist/themes/motion-reduction.esm.js +602 -0
- package/dist/themes/motion-reduction.js +602 -0
- package/dist/themes/navigation.d.ts +232 -0
- package/dist/themes/navigation.esm.js +238 -0
- package/dist/themes/navigation.js +238 -0
- package/dist/themes/screen-reader.d.ts +645 -0
- package/dist/themes/screen-reader.esm.js +580 -0
- package/dist/themes/screen-reader.js +580 -0
- package/dist/themes/systemThemeDetector.d.ts +148 -0
- package/dist/themes/systemThemeDetector.esm.js +174 -0
- package/dist/themes/systemThemeDetector.js +174 -0
- package/dist/themes/themeCSSUpdater.d.ts +229 -0
- package/dist/themes/themeCSSUpdater.esm.js +250 -0
- package/dist/themes/themeCSSUpdater.js +250 -0
- package/dist/themes/themePersistence.d.ts +192 -0
- package/dist/themes/themePersistence.esm.js +217 -0
- package/dist/themes/themePersistence.js +217 -0
- package/dist/themes/themes/stan-design.d.ts +678 -0
- package/dist/themes/themes/stan-design.esm.js +518 -0
- package/dist/themes/themes/stan-design.js +518 -0
- package/dist/themes/types.d.ts +454 -0
- package/dist/themes/types.esm.js +446 -0
- package/dist/themes/types.js +446 -0
- package/dist/themes/useSystemTheme.d.ts +43 -0
- package/dist/themes/useSystemTheme.esm.js +48 -0
- package/dist/themes/useSystemTheme.js +48 -0
- package/dist/themes/useTheme.d.ts +20 -0
- package/dist/themes/useTheme.esm.js +87 -0
- package/dist/themes/useTheme.js +87 -0
- package/dist/themes/validation.d.ts +406 -0
- package/dist/themes/validation.esm.js +411 -0
- package/dist/themes/validation.js +411 -0
- package/dist/tokens/index.d.ts +25 -0
- package/dist/tokens/index.esm.js +23 -0
- package/dist/tokens/index.js +23 -0
- package/dist/tokens/tokenExporter.d.ts +336 -0
- package/dist/tokens/tokenExporter.esm.js +371 -0
- package/dist/tokens/tokenExporter.js +371 -0
- package/dist/tokens/tokenGenerator.d.ts +250 -0
- package/dist/tokens/tokenGenerator.esm.js +267 -0
- package/dist/tokens/tokenGenerator.js +267 -0
- package/dist/tokens/tokenManager.d.ts +194 -0
- package/dist/tokens/tokenManager.esm.js +235 -0
- package/dist/tokens/tokenManager.js +235 -0
- package/dist/tokens/tokenValidator.d.ts +488 -0
- package/dist/tokens/tokenValidator.esm.js +497 -0
- package/dist/tokens/tokenValidator.js +497 -0
- package/dist/tokens/types.d.ts +78 -0
- package/dist/tokens/types.esm.js +64 -0
- package/dist/tokens/types.js +64 -0
- package/dist/utils/bundle-analyzer.d.ts +260 -0
- package/dist/utils/bundle-analyzer.esm.js +242 -0
- package/dist/utils/bundle-analyzer.js +242 -0
- package/dist/utils/bundle-splitting.d.ts +483 -0
- package/dist/utils/bundle-splitting.esm.js +458 -0
- package/dist/utils/bundle-splitting.js +458 -0
- package/dist/utils/lazy-loading.d.ts +437 -0
- package/dist/utils/lazy-loading.esm.js +415 -0
- package/dist/utils/lazy-loading.js +415 -0
- package/dist/utils/performance-monitor.d.ts +513 -0
- package/dist/utils/performance-monitor.esm.js +472 -0
- package/dist/utils/performance-monitor.js +472 -0
- package/dist/utils/tree-shaking.d.ts +274 -0
- package/dist/utils/tree-shaking.esm.js +266 -0
- package/dist/utils/tree-shaking.js +266 -0
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/themes/accessibility/index.ts +1 -1
- package/src/themes/focus-management.ts +3 -3
- package/src/themes/keyboard-navigation.ts +3 -3
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
// Focus management utilities
|
|
2
|
+
export class AccessibilityFocusManager {
|
|
3
|
+
private focusableSelectors: string[];
|
|
4
|
+
private focusableElements: HTMLElement[];
|
|
5
|
+
private lastFocusedElement: HTMLElement | null;
|
|
6
|
+
private focusTraps: Map<string, FocusTrap>;
|
|
7
|
+
private focusHistory: HTMLElement[];
|
|
8
|
+
private maxHistorySize: number;
|
|
9
|
+
|
|
10
|
+
constructor() {
|
|
11
|
+
this.focusableSelectors = [
|
|
12
|
+
'a[href]',
|
|
13
|
+
'button:not([disabled])',
|
|
14
|
+
'input:not([disabled])',
|
|
15
|
+
'select:not([disabled])',
|
|
16
|
+
'textarea:not([disabled])',
|
|
17
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
18
|
+
'[contenteditable="true"]',
|
|
19
|
+
'audio[controls]',
|
|
20
|
+
'video[controls]',
|
|
21
|
+
'iframe'
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
this.focusableElements = [];
|
|
25
|
+
this.lastFocusedElement = null;
|
|
26
|
+
this.focusTraps = new Map();
|
|
27
|
+
this.focusHistory = [];
|
|
28
|
+
this.maxHistorySize = 10;
|
|
29
|
+
|
|
30
|
+
this.initialize();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Initialize focus management
|
|
34
|
+
private initialize(): void {
|
|
35
|
+
this.updateFocusableElements();
|
|
36
|
+
this.setupEventListeners();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Update list of focusable elements
|
|
40
|
+
private updateFocusableElements(): void {
|
|
41
|
+
this.focusableElements = Array.from(
|
|
42
|
+
document.querySelectorAll(this.focusableSelectors.join(','))
|
|
43
|
+
) as HTMLElement[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Setup event listeners
|
|
47
|
+
private setupEventListeners(): void {
|
|
48
|
+
// Track focus changes
|
|
49
|
+
document.addEventListener('focusin', this.handleFocusIn.bind(this));
|
|
50
|
+
document.addEventListener('focusout', this.handleFocusOut.bind(this));
|
|
51
|
+
|
|
52
|
+
// Handle tab key navigation
|
|
53
|
+
document.addEventListener('keydown', this.handleKeyDown.bind(this));
|
|
54
|
+
|
|
55
|
+
// Update focusable elements when DOM changes
|
|
56
|
+
const observer = new MutationObserver(() => {
|
|
57
|
+
this.updateFocusableElements();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
observer.observe(document.body, {
|
|
61
|
+
childList: true,
|
|
62
|
+
subtree: true
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Handle focus in events
|
|
67
|
+
private handleFocusIn(event: FocusEvent): void {
|
|
68
|
+
const target = event.target as HTMLElement;
|
|
69
|
+
|
|
70
|
+
if (target && target !== this.lastFocusedElement) {
|
|
71
|
+
// Add to focus history
|
|
72
|
+
this.addToFocusHistory(target);
|
|
73
|
+
|
|
74
|
+
// Update last focused element
|
|
75
|
+
this.lastFocusedElement = target;
|
|
76
|
+
|
|
77
|
+
// Announce focus change for screen readers
|
|
78
|
+
if (screenReaderOptimizer) {
|
|
79
|
+
screenReaderOptimizer.announceFocusChange(
|
|
80
|
+
this.getElementDescription(target),
|
|
81
|
+
this.getElementContext(target)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Handle focus out events
|
|
88
|
+
private handleFocusOut(_event: FocusEvent): void {
|
|
89
|
+
// Focus out handling if needed
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Handle key down events
|
|
93
|
+
private handleKeyDown(event: KeyboardEvent): void {
|
|
94
|
+
if (event.key === 'Tab') {
|
|
95
|
+
this.handleTabNavigation(event);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Handle tab navigation
|
|
100
|
+
private handleTabNavigation(event: KeyboardEvent): void {
|
|
101
|
+
const isShiftTab = event.shiftKey;
|
|
102
|
+
const currentElement = event.target as HTMLElement;
|
|
103
|
+
|
|
104
|
+
// Check if we're in a focus trap
|
|
105
|
+
const activeTrap = this.getActiveFocusTrap(currentElement);
|
|
106
|
+
if (activeTrap) {
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
this.navigateInFocusTrap(activeTrap, isShiftTab);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Normal tab navigation
|
|
113
|
+
this.navigateFocusableElements(isShiftTab);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Get active focus trap for element
|
|
117
|
+
private getActiveFocusTrap(element: HTMLElement): FocusTrap | null {
|
|
118
|
+
for (const trap of this.focusTraps.values()) {
|
|
119
|
+
if (trap.isActive && trap.container.contains(element)) {
|
|
120
|
+
return trap;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Navigate within a focus trap
|
|
127
|
+
private navigateInFocusTrap(trap: FocusTrap, isShiftTab: boolean): void {
|
|
128
|
+
const focusableElements = trap.getFocusableElements();
|
|
129
|
+
if (focusableElements.length === 0) return;
|
|
130
|
+
|
|
131
|
+
const currentIndex = focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
132
|
+
let nextIndex: number;
|
|
133
|
+
|
|
134
|
+
if (isShiftTab) {
|
|
135
|
+
nextIndex = currentIndex > 0 ? currentIndex - 1 : focusableElements.length - 1;
|
|
136
|
+
} else {
|
|
137
|
+
nextIndex = currentIndex < focusableElements.length - 1 ? currentIndex + 1 : 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
focusableElements[nextIndex]?.focus();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Navigate focusable elements
|
|
144
|
+
private navigateFocusableElements(isShiftTab: boolean): void {
|
|
145
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
146
|
+
let nextIndex: number;
|
|
147
|
+
|
|
148
|
+
if (isShiftTab) {
|
|
149
|
+
nextIndex = currentIndex > 0 ? currentIndex - 1 : this.focusableElements.length - 1;
|
|
150
|
+
} else {
|
|
151
|
+
nextIndex = currentIndex < this.focusableElements.length - 1 ? currentIndex + 1 : 0;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
this.focusableElements[nextIndex]?.focus();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Add element to focus history
|
|
158
|
+
private addToFocusHistory(element: HTMLElement): void {
|
|
159
|
+
// Remove if already exists
|
|
160
|
+
this.focusHistory = this.focusHistory.filter(el => el !== element);
|
|
161
|
+
|
|
162
|
+
// Add to beginning
|
|
163
|
+
this.focusHistory.unshift(element);
|
|
164
|
+
|
|
165
|
+
// Maintain history size
|
|
166
|
+
if (this.focusHistory.length > this.maxHistorySize) {
|
|
167
|
+
this.focusHistory.pop();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Get element description for screen readers
|
|
172
|
+
private getElementDescription(element: HTMLElement): string {
|
|
173
|
+
const ariaLabel = element.getAttribute('aria-label');
|
|
174
|
+
if (ariaLabel) return ariaLabel;
|
|
175
|
+
|
|
176
|
+
const ariaLabelledBy = element.getAttribute('aria-labelledby');
|
|
177
|
+
if (ariaLabelledBy) {
|
|
178
|
+
const labelElement = document.getElementById(ariaLabelledBy);
|
|
179
|
+
if (labelElement) return labelElement.textContent || '';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const placeholder = element.getAttribute('placeholder');
|
|
183
|
+
if (placeholder) return placeholder;
|
|
184
|
+
|
|
185
|
+
const title = element.getAttribute('title');
|
|
186
|
+
if (title) return title;
|
|
187
|
+
|
|
188
|
+
return element.textContent || element.tagName.toLowerCase();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Get element context for screen readers
|
|
192
|
+
private getElementContext(element: HTMLElement): string | undefined {
|
|
193
|
+
// Find nearest landmark or section
|
|
194
|
+
const landmark = element.closest('[role], section, article, aside, nav, header, footer, main');
|
|
195
|
+
if (landmark) {
|
|
196
|
+
const role = landmark.getAttribute('role');
|
|
197
|
+
const ariaLabel = landmark.getAttribute('aria-label');
|
|
198
|
+
return ariaLabel || role || landmark.tagName.toLowerCase();
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Create focus trap
|
|
204
|
+
createFocusTrap(container: HTMLElement, options: FocusTrapOptions = {}): FocusTrap {
|
|
205
|
+
const trap = new FocusTrap(container, options);
|
|
206
|
+
this.focusTraps.set(trap.id, trap);
|
|
207
|
+
return trap;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// Remove focus trap
|
|
211
|
+
removeFocusTrap(trapId: string): void {
|
|
212
|
+
const trap = this.focusTraps.get(trapId);
|
|
213
|
+
if (trap) {
|
|
214
|
+
trap.deactivate();
|
|
215
|
+
this.focusTraps.delete(trapId);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Focus first focusable element
|
|
220
|
+
focusFirst(): void {
|
|
221
|
+
const firstElement = this.focusableElements[0];
|
|
222
|
+
if (firstElement) {
|
|
223
|
+
firstElement.focus();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Focus last focusable element
|
|
228
|
+
focusLast(): void {
|
|
229
|
+
const lastElement = this.focusableElements[this.focusableElements.length - 1];
|
|
230
|
+
if (lastElement) {
|
|
231
|
+
lastElement.focus();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Focus next element
|
|
236
|
+
focusNext(): void {
|
|
237
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
238
|
+
const nextIndex = currentIndex < this.focusableElements.length - 1 ? currentIndex + 1 : 0;
|
|
239
|
+
this.focusableElements[nextIndex]?.focus();
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Focus previous element
|
|
243
|
+
focusPrevious(): void {
|
|
244
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
245
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : this.focusableElements.length - 1;
|
|
246
|
+
this.focusableElements[prevIndex]?.focus();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Focus element by index
|
|
250
|
+
focusByIndex(index: number): void {
|
|
251
|
+
if (index >= 0 && index < this.focusableElements.length) {
|
|
252
|
+
this.focusableElements[index].focus();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Focus element by ID
|
|
257
|
+
focusById(id: string): void {
|
|
258
|
+
const element = document.getElementById(id);
|
|
259
|
+
if (element && this.focusableElements.includes(element)) {
|
|
260
|
+
element.focus();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Focus element by data attribute
|
|
265
|
+
focusByDataAttribute(attribute: string, value: string): void {
|
|
266
|
+
const element = document.querySelector(`[data-${attribute}="${value}"]`) as HTMLElement;
|
|
267
|
+
if (element && this.focusableElements.includes(element)) {
|
|
268
|
+
element.focus();
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Restore previous focus
|
|
273
|
+
restoreFocus(): void {
|
|
274
|
+
if (this.lastFocusedElement && this.lastFocusedElement.offsetParent !== null) {
|
|
275
|
+
this.lastFocusedElement.focus();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Get focus history
|
|
280
|
+
getFocusHistory(): HTMLElement[] {
|
|
281
|
+
return [...this.focusHistory];
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Clear focus history
|
|
285
|
+
clearFocusHistory(): void {
|
|
286
|
+
this.focusHistory = [];
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Get current focus information
|
|
290
|
+
getCurrentFocusInfo(): {
|
|
291
|
+
element: HTMLElement | null;
|
|
292
|
+
index: number;
|
|
293
|
+
total: number;
|
|
294
|
+
context: string | undefined;
|
|
295
|
+
} {
|
|
296
|
+
const currentElement = document.activeElement as HTMLElement;
|
|
297
|
+
const index = this.focusableElements.indexOf(currentElement);
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
element: currentElement,
|
|
301
|
+
index: index >= 0 ? index : -1,
|
|
302
|
+
total: this.focusableElements.length,
|
|
303
|
+
context: currentElement ? this.getElementContext(currentElement) : undefined
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Check if element is focusable
|
|
308
|
+
isFocusable(element: HTMLElement): boolean {
|
|
309
|
+
return this.focusableElements.includes(element);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Get all focusable elements
|
|
313
|
+
getAllFocusableElements(): HTMLElement[] {
|
|
314
|
+
return [...this.focusableElements];
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// Get focusable elements within container
|
|
318
|
+
getFocusableElementsInContainer(container: HTMLElement): HTMLElement[] {
|
|
319
|
+
return this.focusableElements.filter(element =>
|
|
320
|
+
container.contains(element)
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Update focusable elements manually
|
|
325
|
+
refreshFocusableElements(): void {
|
|
326
|
+
this.updateFocusableElements();
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Destroy focus manager
|
|
330
|
+
destroy(): void {
|
|
331
|
+
// Remove all focus traps
|
|
332
|
+
this.focusTraps.forEach(trap => trap.deactivate());
|
|
333
|
+
this.focusTraps.clear();
|
|
334
|
+
|
|
335
|
+
// Clear focus history
|
|
336
|
+
this.focusHistory = [];
|
|
337
|
+
|
|
338
|
+
// Remove event listeners
|
|
339
|
+
document.removeEventListener('focusin', this.handleFocusIn.bind(this));
|
|
340
|
+
document.removeEventListener('focusout', this.handleFocusOut.bind(this));
|
|
341
|
+
document.removeEventListener('keydown', this.handleKeyDown.bind(this));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// Focus trap options
|
|
346
|
+
export interface FocusTrapOptions {
|
|
347
|
+
autoFocus?: boolean;
|
|
348
|
+
returnFocus?: boolean;
|
|
349
|
+
escapeDeactivates?: boolean;
|
|
350
|
+
clickOutsideDeactivates?: boolean;
|
|
351
|
+
allowOutsideClick?: boolean;
|
|
352
|
+
fallbackFocus?: HTMLElement;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Focus trap class
|
|
356
|
+
export class FocusTrap {
|
|
357
|
+
public readonly id: string;
|
|
358
|
+
public readonly container: HTMLElement;
|
|
359
|
+
public readonly options: FocusTrapOptions;
|
|
360
|
+
public isActive: boolean = false;
|
|
361
|
+
|
|
362
|
+
private returnFocusElement: HTMLElement | null = null;
|
|
363
|
+
private focusableElements: HTMLElement[] = [];
|
|
364
|
+
private eventListeners: Array<{ event: string; handler: (event: any) => void }> = [];
|
|
365
|
+
|
|
366
|
+
constructor(container: HTMLElement, options: FocusTrapOptions = {}) {
|
|
367
|
+
this.id = `focus-trap-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
368
|
+
this.container = container;
|
|
369
|
+
this.options = {
|
|
370
|
+
autoFocus: true,
|
|
371
|
+
returnFocus: true,
|
|
372
|
+
escapeDeactivates: true,
|
|
373
|
+
clickOutsideDeactivates: false,
|
|
374
|
+
allowOutsideClick: false,
|
|
375
|
+
fallbackFocus: container,
|
|
376
|
+
...options
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Activate focus trap
|
|
381
|
+
activate(): void {
|
|
382
|
+
if (this.isActive) return;
|
|
383
|
+
|
|
384
|
+
// Store current focus for return
|
|
385
|
+
if (this.options.returnFocus) {
|
|
386
|
+
this.returnFocusElement = document.activeElement as HTMLElement;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Get focusable elements within container
|
|
390
|
+
this.focusableElements = this.getFocusableElements();
|
|
391
|
+
|
|
392
|
+
// Auto-focus first element or fallback
|
|
393
|
+
if (this.options.autoFocus && this.focusableElements.length > 0) {
|
|
394
|
+
this.focusableElements[0].focus();
|
|
395
|
+
} else if (this.options.fallbackFocus) {
|
|
396
|
+
this.options.fallbackFocus.focus();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Setup event listeners
|
|
400
|
+
this.setupEventListeners();
|
|
401
|
+
|
|
402
|
+
this.isActive = true;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Deactivate focus trap
|
|
406
|
+
deactivate(): void {
|
|
407
|
+
if (!this.isActive) return;
|
|
408
|
+
|
|
409
|
+
// Remove event listeners
|
|
410
|
+
this.removeEventListeners();
|
|
411
|
+
|
|
412
|
+
// Return focus if requested
|
|
413
|
+
if (this.options.returnFocus && this.returnFocusElement) {
|
|
414
|
+
this.returnFocusElement.focus();
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
this.isActive = false;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// Get focusable elements within container
|
|
421
|
+
getFocusableElements(): HTMLElement[] {
|
|
422
|
+
const focusableSelectors = [
|
|
423
|
+
'a[href]',
|
|
424
|
+
'button:not([disabled])',
|
|
425
|
+
'input:not([disabled])',
|
|
426
|
+
'select:not([disabled])',
|
|
427
|
+
'textarea:not([disabled])',
|
|
428
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
429
|
+
'[contenteditable="true"]'
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
return Array.from(
|
|
433
|
+
this.container.querySelectorAll(focusableSelectors.join(','))
|
|
434
|
+
) as HTMLElement[];
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Setup event listeners
|
|
438
|
+
private setupEventListeners(): void {
|
|
439
|
+
// Handle escape key
|
|
440
|
+
if (this.options.escapeDeactivates) {
|
|
441
|
+
const escapeHandler = (event: KeyboardEvent) => {
|
|
442
|
+
if (event.key === 'Escape') {
|
|
443
|
+
this.deactivate();
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
document.addEventListener('keydown', escapeHandler);
|
|
448
|
+
this.eventListeners.push({ event: 'keydown', handler: escapeHandler });
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Handle click outside
|
|
452
|
+
if (this.options.clickOutsideDeactivates) {
|
|
453
|
+
const clickHandler = (event: MouseEvent) => {
|
|
454
|
+
if (!this.container.contains(event.target as Node)) {
|
|
455
|
+
this.deactivate();
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
document.addEventListener('click', clickHandler);
|
|
460
|
+
this.eventListeners.push({ event: 'click', handler: clickHandler });
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Handle tab key within trap
|
|
464
|
+
const tabHandler = (event: KeyboardEvent) => {
|
|
465
|
+
if (event.key === 'Tab') {
|
|
466
|
+
event.preventDefault();
|
|
467
|
+
this.handleTabNavigation(event.shiftKey);
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
this.container.addEventListener('keydown', tabHandler);
|
|
472
|
+
this.eventListeners.push({ event: 'keydown', handler: tabHandler });
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// Remove event listeners
|
|
476
|
+
private removeEventListeners(): void {
|
|
477
|
+
this.eventListeners.forEach(({ event, handler }) => {
|
|
478
|
+
if (event === 'keydown' && handler.toString().includes('tabHandler')) {
|
|
479
|
+
this.container.removeEventListener(event, handler);
|
|
480
|
+
} else {
|
|
481
|
+
document.removeEventListener(event, handler);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
this.eventListeners = [];
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Handle tab navigation within trap
|
|
489
|
+
private handleTabNavigation(isShiftTab: boolean): void {
|
|
490
|
+
if (this.focusableElements.length === 0) return;
|
|
491
|
+
|
|
492
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
493
|
+
let nextIndex: number;
|
|
494
|
+
|
|
495
|
+
if (isShiftTab) {
|
|
496
|
+
nextIndex = currentIndex > 0 ? currentIndex - 1 : this.focusableElements.length - 1;
|
|
497
|
+
} else {
|
|
498
|
+
nextIndex = currentIndex < this.focusableElements.length - 1 ? currentIndex + 1 : 0;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
this.focusableElements[nextIndex]?.focus();
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Focus first element in trap
|
|
505
|
+
focusFirst(): void {
|
|
506
|
+
if (this.focusableElements.length > 0) {
|
|
507
|
+
this.focusableElements[0].focus();
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Focus last element in trap
|
|
512
|
+
focusLast(): void {
|
|
513
|
+
if (this.focusableElements.length > 0) {
|
|
514
|
+
this.focusableElements[this.focusableElements.length - 1].focus();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// Focus next element in trap
|
|
519
|
+
focusNext(): void {
|
|
520
|
+
if (this.focusableElements.length === 0) return;
|
|
521
|
+
|
|
522
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
523
|
+
const nextIndex = currentIndex < this.focusableElements.length - 1 ? currentIndex + 1 : 0;
|
|
524
|
+
this.focusableElements[nextIndex]?.focus();
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Focus previous element in trap
|
|
528
|
+
focusPrevious(): void {
|
|
529
|
+
if (this.focusableElements.length === 0) return;
|
|
530
|
+
|
|
531
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
532
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : this.focusableElements.length - 1;
|
|
533
|
+
this.focusableElements[prevIndex]?.focus();
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// Get trap information
|
|
537
|
+
getInfo(): {
|
|
538
|
+
id: string;
|
|
539
|
+
isActive: boolean;
|
|
540
|
+
focusableElementsCount: number;
|
|
541
|
+
currentFocusIndex: number;
|
|
542
|
+
container: HTMLElement;
|
|
543
|
+
} {
|
|
544
|
+
const currentIndex = this.focusableElements.indexOf(document.activeElement as HTMLElement);
|
|
545
|
+
|
|
546
|
+
return {
|
|
547
|
+
id: this.id,
|
|
548
|
+
isActive: this.isActive,
|
|
549
|
+
focusableElementsCount: this.focusableElements.length,
|
|
550
|
+
currentFocusIndex: currentIndex >= 0 ? currentIndex : -1,
|
|
551
|
+
container: this.container
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
// Focus restoration utilities
|
|
557
|
+
export class FocusRestoration {
|
|
558
|
+
private focusStack: HTMLElement[] = [];
|
|
559
|
+
private maxStackSize: number = 20;
|
|
560
|
+
|
|
561
|
+
// Push current focus to stack
|
|
562
|
+
pushFocus(): void {
|
|
563
|
+
const currentElement = document.activeElement as HTMLElement;
|
|
564
|
+
if (currentElement && currentElement !== document.body) {
|
|
565
|
+
this.focusStack.push(currentElement);
|
|
566
|
+
|
|
567
|
+
// Maintain stack size
|
|
568
|
+
if (this.focusStack.length > this.maxStackSize) {
|
|
569
|
+
this.focusStack.shift();
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// Pop and restore focus from stack
|
|
575
|
+
popFocus(): boolean {
|
|
576
|
+
const element = this.focusStack.pop();
|
|
577
|
+
if (element && element.offsetParent !== null) {
|
|
578
|
+
element.focus();
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Peek at top of focus stack
|
|
585
|
+
peekFocus(): HTMLElement | undefined {
|
|
586
|
+
return this.focusStack[this.focusStack.length - 1];
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Clear focus stack
|
|
590
|
+
clear(): void {
|
|
591
|
+
this.focusStack = [];
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// Get stack size
|
|
595
|
+
getSize(): number {
|
|
596
|
+
return this.focusStack.length;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
// Check if stack is empty
|
|
600
|
+
isEmpty(): boolean {
|
|
601
|
+
return this.focusStack.length === 0;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// Focus navigation utilities
|
|
606
|
+
export class FocusNavigation {
|
|
607
|
+
// Navigate to next heading
|
|
608
|
+
static focusNextHeading(): void {
|
|
609
|
+
const headings = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, h6'));
|
|
610
|
+
const currentIndex = headings.indexOf(document.activeElement as HTMLElement);
|
|
611
|
+
const nextIndex = currentIndex < headings.length - 1 ? currentIndex + 1 : 0;
|
|
612
|
+
|
|
613
|
+
if (headings[nextIndex]) {
|
|
614
|
+
(headings[nextIndex] as HTMLElement).focus();
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// Navigate to previous heading
|
|
619
|
+
static focusPreviousHeading(): void {
|
|
620
|
+
const headings = Array.from(document.querySelectorAll('h1, h2, h3, h4, h5, h6'));
|
|
621
|
+
const currentIndex = headings.indexOf(document.activeElement as HTMLElement);
|
|
622
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : headings.length - 1;
|
|
623
|
+
|
|
624
|
+
if (headings[prevIndex]) {
|
|
625
|
+
(headings[prevIndex] as HTMLElement).focus();
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
// Navigate to next landmark
|
|
630
|
+
static focusNextLandmark(): void {
|
|
631
|
+
const landmarks = Array.from(document.querySelectorAll('[role="banner"], [role="main"], [role="navigation"], [role="complementary"], [role="contentinfo"]'));
|
|
632
|
+
const currentIndex = landmarks.indexOf(document.activeElement as HTMLElement);
|
|
633
|
+
const nextIndex = currentIndex < landmarks.length - 1 ? currentIndex + 1 : 0;
|
|
634
|
+
|
|
635
|
+
if (landmarks[nextIndex]) {
|
|
636
|
+
(landmarks[nextIndex] as HTMLElement).focus();
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
// Navigate to previous landmark
|
|
641
|
+
static focusPreviousLandmark(): void {
|
|
642
|
+
const landmarks = Array.from(document.querySelectorAll('[role="banner"], [role="main"], [role="navigation"], [role="complementary"], [role="contentinfo"]'));
|
|
643
|
+
const currentIndex = landmarks.indexOf(document.activeElement as HTMLElement);
|
|
644
|
+
const prevIndex = currentIndex > 0 ? currentIndex - 1 : landmarks.length - 1;
|
|
645
|
+
|
|
646
|
+
if (landmarks[prevIndex]) {
|
|
647
|
+
(landmarks[prevIndex] as HTMLElement).focus();
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// Focus first focusable element in container
|
|
652
|
+
static focusFirstInContainer(container: HTMLElement): void {
|
|
653
|
+
const focusableSelectors = [
|
|
654
|
+
'a[href]',
|
|
655
|
+
'button:not([disabled])',
|
|
656
|
+
'input:not([disabled])',
|
|
657
|
+
'select:not([disabled])',
|
|
658
|
+
'textarea:not([disabled])',
|
|
659
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
660
|
+
];
|
|
661
|
+
|
|
662
|
+
const firstElement = container.querySelector(focusableSelectors.join(','));
|
|
663
|
+
if (firstElement) {
|
|
664
|
+
(firstElement as HTMLElement).focus();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// Focus last focusable element in container
|
|
669
|
+
static focusLastInContainer(container: HTMLElement): void {
|
|
670
|
+
const focusableSelectors = [
|
|
671
|
+
'a[href]',
|
|
672
|
+
'button:not([disabled])',
|
|
673
|
+
'input:not([disabled])',
|
|
674
|
+
'select:not([disabled])',
|
|
675
|
+
'textarea:not([disabled])',
|
|
676
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
677
|
+
];
|
|
678
|
+
|
|
679
|
+
const elements = Array.from(container.querySelectorAll(focusableSelectors.join(',')));
|
|
680
|
+
const lastElement = elements[elements.length - 1];
|
|
681
|
+
if (lastElement) {
|
|
682
|
+
(lastElement as HTMLElement).focus();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// Export default instances
|
|
688
|
+
export declare const focusManager: new AccessibilityFocusManager();
|
|
689
|
+
export declare const focusRestoration: new FocusRestoration();
|
|
690
|
+
|
|
691
|
+
// Export default
|
|
692
|
+
export default {
|
|
693
|
+
AccessibilityFocusManager,
|
|
694
|
+
FocusTrap,
|
|
695
|
+
FocusRestoration,
|
|
696
|
+
FocusNavigation,
|
|
697
|
+
focusManager,
|
|
698
|
+
focusRestoration
|
|
699
|
+
};
|