@procivis/one-react-native-components 0.1.63
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/LICENSE +201 -0
- package/README.md +66 -0
- package/lib/commonjs/accessibility/accessibility.js +193 -0
- package/lib/commonjs/accessibility/accessibility.js.map +1 -0
- package/lib/commonjs/accessibility/accessibilityHistory.js +81 -0
- package/lib/commonjs/accessibility/accessibilityHistory.js.map +1 -0
- package/lib/commonjs/accessibility/accessibilityHistoryWrappers.js +49 -0
- package/lib/commonjs/accessibility/accessibilityHistoryWrappers.js.map +1 -0
- package/lib/commonjs/accessibility/accessibilityLanguage.js +63 -0
- package/lib/commonjs/accessibility/accessibilityLanguage.js.map +1 -0
- package/lib/commonjs/accessibility/index.js +129 -0
- package/lib/commonjs/accessibility/index.js.map +1 -0
- package/lib/commonjs/accessibility/locale/de.json +21 -0
- package/lib/commonjs/accessibility/locale/en.json +21 -0
- package/lib/commonjs/accessibility/locale/fr.json +21 -0
- package/lib/commonjs/accessibility/locale/index.js +21 -0
- package/lib/commonjs/accessibility/locale/index.js.map +1 -0
- package/lib/commonjs/accessibility/locale/it.json +21 -0
- package/lib/commonjs/accessibility/locale.test.js +15 -0
- package/lib/commonjs/accessibility/locale.test.js.map +1 -0
- package/lib/commonjs/action-modal/ActionModal.js +52 -0
- package/lib/commonjs/action-modal/ActionModal.js.map +1 -0
- package/lib/commonjs/action-modal/index.js +14 -0
- package/lib/commonjs/action-modal/index.js.map +1 -0
- package/lib/commonjs/activity-indicator/activity-indicator.js +34 -0
- package/lib/commonjs/activity-indicator/activity-indicator.js.map +1 -0
- package/lib/commonjs/activity-indicator/index.js +14 -0
- package/lib/commonjs/activity-indicator/index.js.map +1 -0
- package/lib/commonjs/blur/blur-view.js +76 -0
- package/lib/commonjs/blur/blur-view.js.map +1 -0
- package/lib/commonjs/blur/index.js +21 -0
- package/lib/commonjs/blur/index.js.map +1 -0
- package/lib/commonjs/buttons/back-button.js +37 -0
- package/lib/commonjs/buttons/back-button.js.map +1 -0
- package/lib/commonjs/buttons/button.js +153 -0
- package/lib/commonjs/buttons/button.js.map +1 -0
- package/lib/commonjs/buttons/connectivity-button.js +82 -0
- package/lib/commonjs/buttons/connectivity-button.js.map +1 -0
- package/lib/commonjs/buttons/filter-button.js +51 -0
- package/lib/commonjs/buttons/filter-button.js.map +1 -0
- package/lib/commonjs/buttons/ghost-button.js +62 -0
- package/lib/commonjs/buttons/ghost-button.js.map +1 -0
- package/lib/commonjs/buttons/index.js +104 -0
- package/lib/commonjs/buttons/index.js.map +1 -0
- package/lib/commonjs/buttons/scan-button.js +83 -0
- package/lib/commonjs/buttons/scan-button.js.map +1 -0
- package/lib/commonjs/camera/camera-overlay.js +61 -0
- package/lib/commonjs/camera/camera-overlay.js.map +1 -0
- package/lib/commonjs/camera/index.js +21 -0
- package/lib/commonjs/camera/index.js.map +1 -0
- package/lib/commonjs/camera/qr-code-scanner.js +50 -0
- package/lib/commonjs/camera/qr-code-scanner.js.map +1 -0
- package/lib/commonjs/control/checkbox.js +79 -0
- package/lib/commonjs/control/checkbox.js.map +1 -0
- package/lib/commonjs/control/index.js +32 -0
- package/lib/commonjs/control/index.js.map +1 -0
- package/lib/commonjs/control/switch.js +65 -0
- package/lib/commonjs/control/switch.js.map +1 -0
- package/lib/commonjs/credential/card/credential-card.js +189 -0
- package/lib/commonjs/credential/card/credential-card.js.map +1 -0
- package/lib/commonjs/credential/card/credential-details-card.js +201 -0
- package/lib/commonjs/credential/card/credential-details-card.js.map +1 -0
- package/lib/commonjs/credential/card/credential-details-list-item.js +84 -0
- package/lib/commonjs/credential/card/credential-details-list-item.js.map +1 -0
- package/lib/commonjs/credential/card/credential-header.js +172 -0
- package/lib/commonjs/credential/card/credential-header.js.map +1 -0
- package/lib/commonjs/credential/card/credential-image-carousel.js +124 -0
- package/lib/commonjs/credential/card/credential-image-carousel.js.map +1 -0
- package/lib/commonjs/credential/card/index.js +85 -0
- package/lib/commonjs/credential/card/index.js.map +1 -0
- package/lib/commonjs/credential/credential-attribute-item.js +289 -0
- package/lib/commonjs/credential/credential-attribute-item.js.map +1 -0
- package/lib/commonjs/credential/credential-carousel-images.js +98 -0
- package/lib/commonjs/credential/credential-carousel-images.js.map +1 -0
- package/lib/commonjs/credential/index.js +90 -0
- package/lib/commonjs/credential/index.js.map +1 -0
- package/lib/commonjs/credential/selector-status.js +17 -0
- package/lib/commonjs/credential/selector-status.js.map +1 -0
- package/lib/commonjs/credential/selector.js +79 -0
- package/lib/commonjs/credential/selector.js.map +1 -0
- package/lib/commonjs/detail/detail.js +84 -0
- package/lib/commonjs/detail/detail.js.map +1 -0
- package/lib/commonjs/detail/index.js +14 -0
- package/lib/commonjs/detail/index.js.map +1 -0
- package/lib/commonjs/entity/avatar.js +96 -0
- package/lib/commonjs/entity/avatar.js.map +1 -0
- package/lib/commonjs/entity/entity-cluster.js +66 -0
- package/lib/commonjs/entity/entity-cluster.js.map +1 -0
- package/lib/commonjs/entity/index.js +34 -0
- package/lib/commonjs/entity/index.js.map +1 -0
- package/lib/commonjs/header/focus-aware-status-bar.js +20 -0
- package/lib/commonjs/header/focus-aware-status-bar.js.map +1 -0
- package/lib/commonjs/header/foldable-header.js +89 -0
- package/lib/commonjs/header/foldable-header.js.map +1 -0
- package/lib/commonjs/header/header.js +105 -0
- package/lib/commonjs/header/header.js.map +1 -0
- package/lib/commonjs/header/index.js +55 -0
- package/lib/commonjs/header/index.js.map +1 -0
- package/lib/commonjs/header/navigation-header.js +148 -0
- package/lib/commonjs/header/navigation-header.js.map +1 -0
- package/lib/commonjs/history/data-item.js +70 -0
- package/lib/commonjs/history/data-item.js.map +1 -0
- package/lib/commonjs/history/history-list-item.js +90 -0
- package/lib/commonjs/history/history-list-item.js.map +1 -0
- package/lib/commonjs/history/history-section-header.js +49 -0
- package/lib/commonjs/history/history-section-header.js.map +1 -0
- package/lib/commonjs/history/history-section-list-item.js +47 -0
- package/lib/commonjs/history/history-section-list-item.js.map +1 -0
- package/lib/commonjs/history/index.js +55 -0
- package/lib/commonjs/history/index.js.map +1 -0
- package/lib/commonjs/icons/connectivity.js +139 -0
- package/lib/commonjs/icons/connectivity.js.map +1 -0
- package/lib/commonjs/icons/credential.js +162 -0
- package/lib/commonjs/icons/credential.js.map +1 -0
- package/lib/commonjs/icons/entity.js +34 -0
- package/lib/commonjs/icons/entity.js.map +1 -0
- package/lib/commonjs/icons/history.js +408 -0
- package/lib/commonjs/icons/history.js.map +1 -0
- package/lib/commonjs/icons/icons.js +250 -0
- package/lib/commonjs/icons/icons.js.map +1 -0
- package/lib/commonjs/icons/index.js +127 -0
- package/lib/commonjs/icons/index.js.map +1 -0
- package/lib/commonjs/icons/input.js +44 -0
- package/lib/commonjs/icons/input.js.map +1 -0
- package/lib/commonjs/icons/keypad.js +94 -0
- package/lib/commonjs/icons/keypad.js.map +1 -0
- package/lib/commonjs/icons/loader.js +180 -0
- package/lib/commonjs/icons/loader.js.map +1 -0
- package/lib/commonjs/icons/nerd-view.js +123 -0
- package/lib/commonjs/icons/nerd-view.js.map +1 -0
- package/lib/commonjs/icons/selector.js +56 -0
- package/lib/commonjs/icons/selector.js.map +1 -0
- package/lib/commonjs/icons/wallet.js +121 -0
- package/lib/commonjs/icons/wallet.js.map +1 -0
- package/lib/commonjs/image/image-or-component.js +80 -0
- package/lib/commonjs/image/image-or-component.js.map +1 -0
- package/lib/commonjs/image/index.js +21 -0
- package/lib/commonjs/image/index.js.map +1 -0
- package/lib/commonjs/index.js +292 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/input/index.js +65 -0
- package/lib/commonjs/input/index.js.map +1 -0
- package/lib/commonjs/input/radio-group.js +95 -0
- package/lib/commonjs/input/radio-group.js.map +1 -0
- package/lib/commonjs/input/selection-input.js +102 -0
- package/lib/commonjs/input/selection-input.js.map +1 -0
- package/lib/commonjs/input/text-input.js +195 -0
- package/lib/commonjs/input/text-input.js.map +1 -0
- package/lib/commonjs/list/index.js +34 -0
- package/lib/commonjs/list/index.js.map +1 -0
- package/lib/commonjs/list/list-section-header.js +36 -0
- package/lib/commonjs/list/list-section-header.js.map +1 -0
- package/lib/commonjs/list/list-title-header.js +35 -0
- package/lib/commonjs/list/list-title-header.js.map +1 -0
- package/lib/commonjs/loader/index.js +40 -0
- package/lib/commonjs/loader/index.js.map +1 -0
- package/lib/commonjs/loader/loader.js +140 -0
- package/lib/commonjs/loader/loader.js.map +1 -0
- package/lib/commonjs/loader/loading-result.js +92 -0
- package/lib/commonjs/loader/loading-result.js.map +1 -0
- package/lib/commonjs/nerd-view/index.js +27 -0
- package/lib/commonjs/nerd-view/index.js.map +1 -0
- package/lib/commonjs/nerd-view/nerd-mode-item.js +235 -0
- package/lib/commonjs/nerd-view/nerd-mode-item.js.map +1 -0
- package/lib/commonjs/normalize-color.d.js +2 -0
- package/lib/commonjs/normalize-color.d.js.map +1 -0
- package/lib/commonjs/pin/index.js +32 -0
- package/lib/commonjs/pin/index.js.map +1 -0
- package/lib/commonjs/pin/keypad.js +201 -0
- package/lib/commonjs/pin/keypad.js.map +1 -0
- package/lib/commonjs/pin/pin-code-screen.js +162 -0
- package/lib/commonjs/pin/pin-code-screen.js.map +1 -0
- package/lib/commonjs/pin/pins.js +54 -0
- package/lib/commonjs/pin/pins.js.map +1 -0
- package/lib/commonjs/screens/backup-screen.js +87 -0
- package/lib/commonjs/screens/backup-screen.js.map +1 -0
- package/lib/commonjs/screens/image-preview-screen.js +92 -0
- package/lib/commonjs/screens/image-preview-screen.js.map +1 -0
- package/lib/commonjs/screens/index.js +98 -0
- package/lib/commonjs/screens/index.js.map +1 -0
- package/lib/commonjs/screens/nerd-mode-screen.js +142 -0
- package/lib/commonjs/screens/nerd-mode-screen.js.map +1 -0
- package/lib/commonjs/screens/qr-code-scanner-screen.js +120 -0
- package/lib/commonjs/screens/qr-code-scanner-screen.js.map +1 -0
- package/lib/commonjs/screens/scroll-view-screen.js +94 -0
- package/lib/commonjs/screens/scroll-view-screen.js.map +1 -0
- package/lib/commonjs/screens/section-list-screen.js +67 -0
- package/lib/commonjs/screens/section-list-screen.js.map +1 -0
- package/lib/commonjs/searchbar/animated-search-bar.js +88 -0
- package/lib/commonjs/searchbar/animated-search-bar.js.map +1 -0
- package/lib/commonjs/searchbar/index.js +34 -0
- package/lib/commonjs/searchbar/index.js.map +1 -0
- package/lib/commonjs/searchbar/search-bar.js +99 -0
- package/lib/commonjs/searchbar/search-bar.js.map +1 -0
- package/lib/commonjs/settings/button-setting.js +67 -0
- package/lib/commonjs/settings/button-setting.js.map +1 -0
- package/lib/commonjs/settings/index.js +73 -0
- package/lib/commonjs/settings/index.js.map +1 -0
- package/lib/commonjs/settings/setting-item-separator.js +40 -0
- package/lib/commonjs/settings/setting-item-separator.js.map +1 -0
- package/lib/commonjs/settings/setting-item.js +79 -0
- package/lib/commonjs/settings/setting-item.js.map +1 -0
- package/lib/commonjs/settings/settings-button.js +35 -0
- package/lib/commonjs/settings/settings-button.js.map +1 -0
- package/lib/commonjs/settings/switch-setting.js +35 -0
- package/lib/commonjs/settings/switch-setting.js.map +1 -0
- package/lib/commonjs/state/error-screen.js +71 -0
- package/lib/commonjs/state/error-screen.js.map +1 -0
- package/lib/commonjs/state/index.js +27 -0
- package/lib/commonjs/state/index.js.map +1 -0
- package/lib/commonjs/text/base.js +40 -0
- package/lib/commonjs/text/base.js.map +1 -0
- package/lib/commonjs/text/font.js +64 -0
- package/lib/commonjs/text/font.js.map +1 -0
- package/lib/commonjs/text/index.js +21 -0
- package/lib/commonjs/text/index.js.map +1 -0
- package/lib/commonjs/text/typography.js +119 -0
- package/lib/commonjs/text/typography.js.map +1 -0
- package/lib/commonjs/theme/color-scheme-context.js +52 -0
- package/lib/commonjs/theme/color-scheme-context.js.map +1 -0
- package/lib/commonjs/theme/color-scheme.js +2 -0
- package/lib/commonjs/theme/color-scheme.js.map +1 -0
- package/lib/commonjs/theme/index.js +19 -0
- package/lib/commonjs/theme/index.js.map +1 -0
- package/lib/commonjs/utils/color.js +34 -0
- package/lib/commonjs/utils/color.js.map +1 -0
- package/lib/commonjs/utils/contrasting-status-bar.js +30 -0
- package/lib/commonjs/utils/contrasting-status-bar.js.map +1 -0
- package/lib/commonjs/utils/date.js +57 -0
- package/lib/commonjs/utils/date.js.map +1 -0
- package/lib/commonjs/utils/hooks/header/on-scroll-header-state.js +21 -0
- package/lib/commonjs/utils/hooks/header/on-scroll-header-state.js.map +1 -0
- package/lib/commonjs/utils/hooks/index.js +20 -0
- package/lib/commonjs/utils/hooks/index.js.map +1 -0
- package/lib/commonjs/utils/hooks/list/list-content-inset.js +31 -0
- package/lib/commonjs/utils/hooks/list/list-content-inset.js.map +1 -0
- package/lib/commonjs/utils/index.js +83 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/commonjs/utils/navigation.js +51 -0
- package/lib/commonjs/utils/navigation.js.map +1 -0
- package/lib/commonjs/utils/ref.js +42 -0
- package/lib/commonjs/utils/ref.js.map +1 -0
- package/lib/commonjs/utils/testID.js +18 -0
- package/lib/commonjs/utils/testID.js.map +1 -0
- package/lib/commonjs/utils/testID.test.js +21 -0
- package/lib/commonjs/utils/testID.test.js.map +1 -0
- package/lib/commonjs/utils/useMemoAsync.js +26 -0
- package/lib/commonjs/utils/useMemoAsync.js.map +1 -0
- package/lib/module/accessibility/accessibility.js +185 -0
- package/lib/module/accessibility/accessibility.js.map +1 -0
- package/lib/module/accessibility/accessibilityHistory.js +71 -0
- package/lib/module/accessibility/accessibilityHistory.js.map +1 -0
- package/lib/module/accessibility/accessibilityHistoryWrappers.js +38 -0
- package/lib/module/accessibility/accessibilityHistoryWrappers.js.map +1 -0
- package/lib/module/accessibility/accessibilityLanguage.js +53 -0
- package/lib/module/accessibility/accessibilityLanguage.js.map +1 -0
- package/lib/module/accessibility/index.js +8 -0
- package/lib/module/accessibility/index.js.map +1 -0
- package/lib/module/accessibility/locale/de.json +21 -0
- package/lib/module/accessibility/locale/en.json +21 -0
- package/lib/module/accessibility/locale/fr.json +21 -0
- package/lib/module/accessibility/locale/index.js +12 -0
- package/lib/module/accessibility/locale/index.js.map +1 -0
- package/lib/module/accessibility/locale/it.json +21 -0
- package/lib/module/accessibility/locale.test.js +13 -0
- package/lib/module/accessibility/locale.test.js.map +1 -0
- package/lib/module/action-modal/ActionModal.js +44 -0
- package/lib/module/action-modal/ActionModal.js.map +1 -0
- package/lib/module/action-modal/index.js +3 -0
- package/lib/module/action-modal/index.js.map +1 -0
- package/lib/module/activity-indicator/activity-indicator.js +24 -0
- package/lib/module/activity-indicator/activity-indicator.js.map +1 -0
- package/lib/module/activity-indicator/index.js +3 -0
- package/lib/module/activity-indicator/index.js.map +1 -0
- package/lib/module/blur/blur-view.js +67 -0
- package/lib/module/blur/blur-view.js.map +1 -0
- package/lib/module/blur/index.js +3 -0
- package/lib/module/blur/index.js.map +1 -0
- package/lib/module/buttons/back-button.js +28 -0
- package/lib/module/buttons/back-button.js.map +1 -0
- package/lib/module/buttons/button.js +143 -0
- package/lib/module/buttons/button.js.map +1 -0
- package/lib/module/buttons/connectivity-button.js +73 -0
- package/lib/module/buttons/connectivity-button.js.map +1 -0
- package/lib/module/buttons/filter-button.js +43 -0
- package/lib/module/buttons/filter-button.js.map +1 -0
- package/lib/module/buttons/ghost-button.js +53 -0
- package/lib/module/buttons/ghost-button.js.map +1 -0
- package/lib/module/buttons/index.js +8 -0
- package/lib/module/buttons/index.js.map +1 -0
- package/lib/module/buttons/scan-button.js +75 -0
- package/lib/module/buttons/scan-button.js.map +1 -0
- package/lib/module/camera/camera-overlay.js +51 -0
- package/lib/module/camera/camera-overlay.js.map +1 -0
- package/lib/module/camera/index.js +3 -0
- package/lib/module/camera/index.js.map +1 -0
- package/lib/module/camera/qr-code-scanner.js +40 -0
- package/lib/module/camera/qr-code-scanner.js.map +1 -0
- package/lib/module/control/checkbox.js +70 -0
- package/lib/module/control/checkbox.js.map +1 -0
- package/lib/module/control/index.js +4 -0
- package/lib/module/control/index.js.map +1 -0
- package/lib/module/control/switch.js +56 -0
- package/lib/module/control/switch.js.map +1 -0
- package/lib/module/credential/card/credential-card.js +177 -0
- package/lib/module/credential/card/credential-card.js.map +1 -0
- package/lib/module/credential/card/credential-details-card.js +191 -0
- package/lib/module/credential/card/credential-details-card.js.map +1 -0
- package/lib/module/credential/card/credential-details-list-item.js +74 -0
- package/lib/module/credential/card/credential-details-list-item.js.map +1 -0
- package/lib/module/credential/card/credential-header.js +162 -0
- package/lib/module/credential/card/credential-header.js.map +1 -0
- package/lib/module/credential/card/credential-image-carousel.js +113 -0
- package/lib/module/credential/card/credential-image-carousel.js.map +1 -0
- package/lib/module/credential/card/index.js +11 -0
- package/lib/module/credential/card/index.js.map +1 -0
- package/lib/module/credential/credential-attribute-item.js +279 -0
- package/lib/module/credential/credential-attribute-item.js.map +1 -0
- package/lib/module/credential/credential-carousel-images.js +86 -0
- package/lib/module/credential/credential-carousel-images.js.map +1 -0
- package/lib/module/credential/index.js +9 -0
- package/lib/module/credential/index.js.map +1 -0
- package/lib/module/credential/selector-status.js +10 -0
- package/lib/module/credential/selector-status.js.map +1 -0
- package/lib/module/credential/selector.js +70 -0
- package/lib/module/credential/selector.js.map +1 -0
- package/lib/module/detail/detail.js +75 -0
- package/lib/module/detail/detail.js.map +1 -0
- package/lib/module/detail/index.js +3 -0
- package/lib/module/detail/index.js.map +1 -0
- package/lib/module/entity/avatar.js +86 -0
- package/lib/module/entity/avatar.js.map +1 -0
- package/lib/module/entity/entity-cluster.js +56 -0
- package/lib/module/entity/entity-cluster.js.map +1 -0
- package/lib/module/entity/index.js +5 -0
- package/lib/module/entity/index.js.map +1 -0
- package/lib/module/header/focus-aware-status-bar.js +12 -0
- package/lib/module/header/focus-aware-status-bar.js.map +1 -0
- package/lib/module/header/foldable-header.js +79 -0
- package/lib/module/header/foldable-header.js.map +1 -0
- package/lib/module/header/header.js +97 -0
- package/lib/module/header/header.js.map +1 -0
- package/lib/module/header/index.js +9 -0
- package/lib/module/header/index.js.map +1 -0
- package/lib/module/header/navigation-header.js +138 -0
- package/lib/module/header/navigation-header.js.map +1 -0
- package/lib/module/history/data-item.js +60 -0
- package/lib/module/history/data-item.js.map +1 -0
- package/lib/module/history/history-list-item.js +80 -0
- package/lib/module/history/history-list-item.js.map +1 -0
- package/lib/module/history/history-section-header.js +42 -0
- package/lib/module/history/history-section-header.js.map +1 -0
- package/lib/module/history/history-section-list-item.js +43 -0
- package/lib/module/history/history-section-list-item.js.map +1 -0
- package/lib/module/history/index.js +9 -0
- package/lib/module/history/index.js.map +1 -0
- package/lib/module/icons/connectivity.js +125 -0
- package/lib/module/icons/connectivity.js.map +1 -0
- package/lib/module/icons/credential.js +147 -0
- package/lib/module/icons/credential.js.map +1 -0
- package/lib/module/icons/entity.js +25 -0
- package/lib/module/icons/entity.js.map +1 -0
- package/lib/module/icons/history.js +391 -0
- package/lib/module/icons/history.js.map +1 -0
- package/lib/module/icons/icons.js +231 -0
- package/lib/module/icons/icons.js.map +1 -0
- package/lib/module/icons/index.js +12 -0
- package/lib/module/icons/index.js.map +1 -0
- package/lib/module/icons/input.js +33 -0
- package/lib/module/icons/input.js.map +1 -0
- package/lib/module/icons/keypad.js +81 -0
- package/lib/module/icons/keypad.js.map +1 -0
- package/lib/module/icons/loader.js +168 -0
- package/lib/module/icons/loader.js.map +1 -0
- package/lib/module/icons/nerd-view.js +110 -0
- package/lib/module/icons/nerd-view.js.map +1 -0
- package/lib/module/icons/selector.js +45 -0
- package/lib/module/icons/selector.js.map +1 -0
- package/lib/module/icons/wallet.js +111 -0
- package/lib/module/icons/wallet.js.map +1 -0
- package/lib/module/image/image-or-component.js +71 -0
- package/lib/module/image/image-or-component.js.map +1 -0
- package/lib/module/image/index.js +3 -0
- package/lib/module/image/index.js.map +1 -0
- package/lib/module/index.js +27 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/input/index.js +7 -0
- package/lib/module/input/index.js.map +1 -0
- package/lib/module/input/radio-group.js +87 -0
- package/lib/module/input/radio-group.js.map +1 -0
- package/lib/module/input/selection-input.js +92 -0
- package/lib/module/input/selection-input.js.map +1 -0
- package/lib/module/input/text-input.js +185 -0
- package/lib/module/input/text-input.js.map +1 -0
- package/lib/module/list/index.js +5 -0
- package/lib/module/list/index.js.map +1 -0
- package/lib/module/list/list-section-header.js +28 -0
- package/lib/module/list/list-section-header.js.map +1 -0
- package/lib/module/list/list-title-header.js +27 -0
- package/lib/module/list/list-title-header.js.map +1 -0
- package/lib/module/loader/index.js +5 -0
- package/lib/module/loader/index.js.map +1 -0
- package/lib/module/loader/loader.js +130 -0
- package/lib/module/loader/loader.js.map +1 -0
- package/lib/module/loader/loading-result.js +84 -0
- package/lib/module/loader/loading-result.js.map +1 -0
- package/lib/module/nerd-view/index.js +3 -0
- package/lib/module/nerd-view/index.js.map +1 -0
- package/lib/module/nerd-view/nerd-mode-item.js +224 -0
- package/lib/module/nerd-view/nerd-mode-item.js.map +1 -0
- package/lib/module/normalize-color.d.js +2 -0
- package/lib/module/normalize-color.d.js.map +1 -0
- package/lib/module/pin/index.js +4 -0
- package/lib/module/pin/index.js.map +1 -0
- package/lib/module/pin/keypad.js +191 -0
- package/lib/module/pin/keypad.js.map +1 -0
- package/lib/module/pin/pin-code-screen.js +152 -0
- package/lib/module/pin/pin-code-screen.js.map +1 -0
- package/lib/module/pin/pins.js +46 -0
- package/lib/module/pin/pins.js.map +1 -0
- package/lib/module/screens/backup-screen.js +78 -0
- package/lib/module/screens/backup-screen.js.map +1 -0
- package/lib/module/screens/image-preview-screen.js +83 -0
- package/lib/module/screens/image-preview-screen.js.map +1 -0
- package/lib/module/screens/index.js +13 -0
- package/lib/module/screens/index.js.map +1 -0
- package/lib/module/screens/nerd-mode-screen.js +132 -0
- package/lib/module/screens/nerd-mode-screen.js.map +1 -0
- package/lib/module/screens/qr-code-scanner-screen.js +110 -0
- package/lib/module/screens/qr-code-scanner-screen.js.map +1 -0
- package/lib/module/screens/scroll-view-screen.js +86 -0
- package/lib/module/screens/scroll-view-screen.js.map +1 -0
- package/lib/module/screens/section-list-screen.js +59 -0
- package/lib/module/screens/section-list-screen.js.map +1 -0
- package/lib/module/searchbar/animated-search-bar.js +78 -0
- package/lib/module/searchbar/animated-search-bar.js.map +1 -0
- package/lib/module/searchbar/index.js +5 -0
- package/lib/module/searchbar/index.js.map +1 -0
- package/lib/module/searchbar/search-bar.js +89 -0
- package/lib/module/searchbar/search-bar.js.map +1 -0
- package/lib/module/settings/button-setting.js +57 -0
- package/lib/module/settings/button-setting.js.map +1 -0
- package/lib/module/settings/index.js +11 -0
- package/lib/module/settings/index.js.map +1 -0
- package/lib/module/settings/setting-item-separator.js +32 -0
- package/lib/module/settings/setting-item-separator.js.map +1 -0
- package/lib/module/settings/setting-item.js +69 -0
- package/lib/module/settings/setting-item.js.map +1 -0
- package/lib/module/settings/settings-button.js +27 -0
- package/lib/module/settings/settings-button.js.map +1 -0
- package/lib/module/settings/switch-setting.js +27 -0
- package/lib/module/settings/switch-setting.js.map +1 -0
- package/lib/module/state/error-screen.js +63 -0
- package/lib/module/state/error-screen.js.map +1 -0
- package/lib/module/state/index.js +3 -0
- package/lib/module/state/index.js.map +1 -0
- package/lib/module/text/base.js +31 -0
- package/lib/module/text/base.js.map +1 -0
- package/lib/module/text/font.js +56 -0
- package/lib/module/text/font.js.map +1 -0
- package/lib/module/text/index.js +3 -0
- package/lib/module/text/index.js.map +1 -0
- package/lib/module/text/typography.js +111 -0
- package/lib/module/text/typography.js.map +1 -0
- package/lib/module/theme/color-scheme-context.js +44 -0
- package/lib/module/theme/color-scheme-context.js.map +1 -0
- package/lib/module/theme/color-scheme.js +2 -0
- package/lib/module/theme/color-scheme.js.map +1 -0
- package/lib/module/theme/index.js +3 -0
- package/lib/module/theme/index.js.map +1 -0
- package/lib/module/utils/color.js +23 -0
- package/lib/module/utils/color.js.map +1 -0
- package/lib/module/utils/contrasting-status-bar.js +21 -0
- package/lib/module/utils/contrasting-status-bar.js.map +1 -0
- package/lib/module/utils/date.js +51 -0
- package/lib/module/utils/date.js.map +1 -0
- package/lib/module/utils/hooks/header/on-scroll-header-state.js +14 -0
- package/lib/module/utils/hooks/header/on-scroll-header-state.js.map +1 -0
- package/lib/module/utils/hooks/index.js +5 -0
- package/lib/module/utils/hooks/index.js.map +1 -0
- package/lib/module/utils/hooks/list/list-content-inset.js +24 -0
- package/lib/module/utils/hooks/list/list-content-inset.js.map +1 -0
- package/lib/module/utils/index.js +9 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/navigation.js +45 -0
- package/lib/module/utils/navigation.js.map +1 -0
- package/lib/module/utils/ref.js +35 -0
- package/lib/module/utils/ref.js.map +1 -0
- package/lib/module/utils/testID.js +12 -0
- package/lib/module/utils/testID.js.map +1 -0
- package/lib/module/utils/testID.test.js +19 -0
- package/lib/module/utils/testID.test.js.map +1 -0
- package/lib/module/utils/useMemoAsync.js +20 -0
- package/lib/module/utils/useMemoAsync.js.map +1 -0
- package/lib/typescript/accessibility/accessibility.d.ts +55 -0
- package/lib/typescript/accessibility/accessibilityHistory.d.ts +13 -0
- package/lib/typescript/accessibility/accessibilityHistoryWrappers.d.ts +18 -0
- package/lib/typescript/accessibility/accessibilityLanguage.d.ts +20 -0
- package/lib/typescript/accessibility/index.d.ts +6 -0
- package/lib/typescript/accessibility/locale/index.d.ts +90 -0
- package/lib/typescript/accessibility/locale.test.d.ts +1 -0
- package/lib/typescript/action-modal/ActionModal.d.ts +10 -0
- package/lib/typescript/action-modal/index.d.ts +2 -0
- package/lib/typescript/activity-indicator/activity-indicator.d.ts +7 -0
- package/lib/typescript/activity-indicator/index.d.ts +2 -0
- package/lib/typescript/blur/blur-view.d.ts +10 -0
- package/lib/typescript/blur/index.d.ts +2 -0
- package/lib/typescript/buttons/back-button.d.ts +9 -0
- package/lib/typescript/buttons/button.d.ts +22 -0
- package/lib/typescript/buttons/connectivity-button.d.ts +17 -0
- package/lib/typescript/buttons/filter-button.d.ts +7 -0
- package/lib/typescript/buttons/ghost-button.d.ts +11 -0
- package/lib/typescript/buttons/index.d.ts +7 -0
- package/lib/typescript/buttons/scan-button.d.ts +5 -0
- package/lib/typescript/camera/camera-overlay.d.ts +7 -0
- package/lib/typescript/camera/index.d.ts +2 -0
- package/lib/typescript/camera/qr-code-scanner.d.ts +11 -0
- package/lib/typescript/control/checkbox.d.ts +9 -0
- package/lib/typescript/control/index.d.ts +3 -0
- package/lib/typescript/control/switch.d.ts +7 -0
- package/lib/typescript/credential/card/credential-card.d.ts +22 -0
- package/lib/typescript/credential/card/credential-details-card.d.ts +16 -0
- package/lib/typescript/credential/card/credential-details-list-item.d.ts +9 -0
- package/lib/typescript/credential/card/credential-header.d.ts +20 -0
- package/lib/typescript/credential/card/credential-image-carousel.d.ts +23 -0
- package/lib/typescript/credential/card/index.d.ts +10 -0
- package/lib/typescript/credential/credential-attribute-item.d.ts +48 -0
- package/lib/typescript/credential/credential-carousel-images.d.ts +19 -0
- package/lib/typescript/credential/index.d.ts +8 -0
- package/lib/typescript/credential/selector-status.d.ts +8 -0
- package/lib/typescript/credential/selector.d.ts +15 -0
- package/lib/typescript/detail/detail.d.ts +18 -0
- package/lib/typescript/detail/index.d.ts +2 -0
- package/lib/typescript/entity/avatar.d.ts +10 -0
- package/lib/typescript/entity/entity-cluster.d.ts +12 -0
- package/lib/typescript/entity/index.d.ts +4 -0
- package/lib/typescript/header/focus-aware-status-bar.d.ts +4 -0
- package/lib/typescript/header/foldable-header.d.ts +11 -0
- package/lib/typescript/header/header.d.ts +17 -0
- package/lib/typescript/header/index.d.ts +8 -0
- package/lib/typescript/header/navigation-header.d.ts +15 -0
- package/lib/typescript/history/data-item.d.ts +12 -0
- package/lib/typescript/history/history-list-item.d.ts +14 -0
- package/lib/typescript/history/history-section-header.d.ts +7 -0
- package/lib/typescript/history/history-section-list-item.d.ts +7 -0
- package/lib/typescript/history/index.d.ts +8 -0
- package/lib/typescript/icons/connectivity.d.ts +12 -0
- package/lib/typescript/icons/credential.d.ts +9 -0
- package/lib/typescript/icons/entity.d.ts +3 -0
- package/lib/typescript/icons/history.d.ts +42 -0
- package/lib/typescript/icons/icons.d.ts +13 -0
- package/lib/typescript/icons/index.d.ts +11 -0
- package/lib/typescript/icons/input.d.ts +3 -0
- package/lib/typescript/icons/keypad.d.ts +6 -0
- package/lib/typescript/icons/loader.d.ts +6 -0
- package/lib/typescript/icons/nerd-view.d.ts +7 -0
- package/lib/typescript/icons/selector.d.ts +10 -0
- package/lib/typescript/icons/wallet.d.ts +4 -0
- package/lib/typescript/image/image-or-component.d.ts +16 -0
- package/lib/typescript/image/index.d.ts +2 -0
- package/lib/typescript/index.d.ts +26 -0
- package/lib/typescript/input/index.d.ts +6 -0
- package/lib/typescript/input/radio-group.d.ts +23 -0
- package/lib/typescript/input/selection-input.d.ts +32 -0
- package/lib/typescript/input/text-input.d.ts +31 -0
- package/lib/typescript/list/index.d.ts +4 -0
- package/lib/typescript/list/list-section-header.d.ts +7 -0
- package/lib/typescript/list/list-title-header.d.ts +7 -0
- package/lib/typescript/loader/index.d.ts +4 -0
- package/lib/typescript/loader/loader.d.ts +14 -0
- package/lib/typescript/loader/loading-result.d.ts +16 -0
- package/lib/typescript/nerd-view/index.d.ts +2 -0
- package/lib/typescript/nerd-view/nerd-mode-item.d.ts +31 -0
- package/lib/typescript/pin/index.d.ts +3 -0
- package/lib/typescript/pin/keypad.d.ts +16 -0
- package/lib/typescript/pin/pin-code-screen.d.ts +32 -0
- package/lib/typescript/pin/pins.d.ts +7 -0
- package/lib/typescript/screens/backup-screen.d.ts +16 -0
- package/lib/typescript/screens/image-preview-screen.d.ts +9 -0
- package/lib/typescript/screens/index.d.ts +12 -0
- package/lib/typescript/screens/nerd-mode-screen.d.ts +22 -0
- package/lib/typescript/screens/qr-code-scanner-screen.d.ts +14 -0
- package/lib/typescript/screens/scroll-view-screen.d.ts +13 -0
- package/lib/typescript/screens/section-list-screen.d.ts +12 -0
- package/lib/typescript/searchbar/animated-search-bar.d.ts +10 -0
- package/lib/typescript/searchbar/index.d.ts +4 -0
- package/lib/typescript/searchbar/search-bar.d.ts +10 -0
- package/lib/typescript/settings/button-setting.d.ts +13 -0
- package/lib/typescript/settings/index.d.ts +10 -0
- package/lib/typescript/settings/setting-item-separator.d.ts +8 -0
- package/lib/typescript/settings/setting-item.d.ts +9 -0
- package/lib/typescript/settings/settings-button.d.ts +5 -0
- package/lib/typescript/settings/switch-setting.d.ts +13 -0
- package/lib/typescript/state/error-screen.d.ts +15 -0
- package/lib/typescript/state/index.d.ts +2 -0
- package/lib/typescript/text/base.d.ts +20 -0
- package/lib/typescript/text/font.d.ts +26 -0
- package/lib/typescript/text/index.d.ts +2 -0
- package/lib/typescript/text/typography.d.ts +112 -0
- package/lib/typescript/theme/color-scheme-context.d.ts +10 -0
- package/lib/typescript/theme/color-scheme.d.ts +31 -0
- package/lib/typescript/theme/index.d.ts +3 -0
- package/lib/typescript/utils/color.d.ts +4 -0
- package/lib/typescript/utils/contrasting-status-bar.d.ts +10 -0
- package/lib/typescript/utils/date.d.ts +12 -0
- package/lib/typescript/utils/hooks/header/on-scroll-header-state.d.ts +5 -0
- package/lib/typescript/utils/hooks/index.d.ts +4 -0
- package/lib/typescript/utils/hooks/list/list-content-inset.d.ts +8 -0
- package/lib/typescript/utils/index.d.ts +8 -0
- package/lib/typescript/utils/navigation.d.ts +9 -0
- package/lib/typescript/utils/ref.d.ts +11 -0
- package/lib/typescript/utils/testID.d.ts +6 -0
- package/lib/typescript/utils/testID.test.d.ts +1 -0
- package/lib/typescript/utils/useMemoAsync.d.ts +21 -0
- package/package.json +240 -0
- package/src/accessibility/accessibility.ts +215 -0
- package/src/accessibility/accessibilityHistory.tsx +77 -0
- package/src/accessibility/accessibilityHistoryWrappers.tsx +80 -0
- package/src/accessibility/accessibilityLanguage.tsx +66 -0
- package/src/accessibility/index.ts +35 -0
- package/src/accessibility/locale/de.json +21 -0
- package/src/accessibility/locale/en.json +21 -0
- package/src/accessibility/locale/fr.json +21 -0
- package/src/accessibility/locale/index.ts +19 -0
- package/src/accessibility/locale/it.json +21 -0
- package/src/accessibility/locale.test.ts +16 -0
- package/src/action-modal/ActionModal.stories.tsx +35 -0
- package/src/action-modal/ActionModal.tsx +45 -0
- package/src/action-modal/index.ts +3 -0
- package/src/activity-indicator/activity-indicator.stories.tsx +21 -0
- package/src/activity-indicator/activity-indicator.tsx +25 -0
- package/src/activity-indicator/index.ts +3 -0
- package/src/blur/blur-view.tsx +82 -0
- package/src/blur/index.ts +3 -0
- package/src/buttons/back-button.stories.tsx +31 -0
- package/src/buttons/back-button.tsx +31 -0
- package/src/buttons/button.stories.tsx +29 -0
- package/src/buttons/button.tsx +169 -0
- package/src/buttons/connectivity-button.stories.tsx +34 -0
- package/src/buttons/connectivity-button.tsx +95 -0
- package/src/buttons/filter-button.tsx +38 -0
- package/src/buttons/ghost-button.stories.tsx +28 -0
- package/src/buttons/ghost-button.tsx +56 -0
- package/src/buttons/index.ts +24 -0
- package/src/buttons/scan-button.stories.tsx +26 -0
- package/src/buttons/scan-button.tsx +66 -0
- package/src/camera/camera-overlay.tsx +48 -0
- package/src/camera/index.tsx +3 -0
- package/src/camera/qr-code-scanner.tsx +52 -0
- package/src/control/checkbox.stories.tsx +27 -0
- package/src/control/checkbox.tsx +81 -0
- package/src/control/index.ts +4 -0
- package/src/control/switch.stories.tsx +29 -0
- package/src/control/switch.tsx +47 -0
- package/src/credential/card/credential-card.stories.tsx +52 -0
- package/src/credential/card/credential-card.tsx +195 -0
- package/src/credential/card/credential-details-card.stories.tsx +268 -0
- package/src/credential/card/credential-details-card.tsx +242 -0
- package/src/credential/card/credential-details-list-item.tsx +87 -0
- package/src/credential/card/credential-header.stories.tsx +50 -0
- package/src/credential/card/credential-header.tsx +195 -0
- package/src/credential/card/credential-image-carousel.tsx +113 -0
- package/src/credential/card/index.ts +11 -0
- package/src/credential/credential-attribute-item.tsx +372 -0
- package/src/credential/credential-carousel-images.tsx +90 -0
- package/src/credential/index.ts +13 -0
- package/src/credential/selector-status.ts +8 -0
- package/src/credential/selector.stories.tsx +37 -0
- package/src/credential/selector.tsx +64 -0
- package/src/detail/detail.stories.tsx +65 -0
- package/src/detail/detail.tsx +98 -0
- package/src/detail/index.tsx +3 -0
- package/src/entity/avatar.stories.tsx +39 -0
- package/src/entity/avatar.tsx +87 -0
- package/src/entity/entity-cluster.stories.tsx +42 -0
- package/src/entity/entity-cluster.tsx +72 -0
- package/src/entity/index.ts +5 -0
- package/src/header/focus-aware-status-bar.tsx +10 -0
- package/src/header/foldable-header.tsx +107 -0
- package/src/header/header.stories.tsx +59 -0
- package/src/header/header.tsx +105 -0
- package/src/header/index.ts +9 -0
- package/src/header/navigation-header.stories.tsx +56 -0
- package/src/header/navigation-header.tsx +147 -0
- package/src/history/data-item.tsx +79 -0
- package/src/history/history-list-item.tsx +102 -0
- package/src/history/history-section-header.tsx +44 -0
- package/src/history/history-section-list-item.tsx +41 -0
- package/src/history/index.ts +9 -0
- package/src/icons/connectivity.tsx +114 -0
- package/src/icons/credential.tsx +118 -0
- package/src/icons/entity.tsx +21 -0
- package/src/icons/history.tsx +378 -0
- package/src/icons/icons.tsx +134 -0
- package/src/icons/index.ts +11 -0
- package/src/icons/input.tsx +29 -0
- package/src/icons/keypad.tsx +40 -0
- package/src/icons/loader.tsx +117 -0
- package/src/icons/nerd-view.tsx +105 -0
- package/src/icons/selector.tsx +43 -0
- package/src/icons/wallet.tsx +73 -0
- package/src/image/image-or-component.tsx +92 -0
- package/src/image/index.tsx +3 -0
- package/src/index.ts +26 -0
- package/src/input/index.ts +7 -0
- package/src/input/radio-group.tsx +110 -0
- package/src/input/selection-input.stories.tsx +46 -0
- package/src/input/selection-input.tsx +112 -0
- package/src/input/text-input.tsx +253 -0
- package/src/list/index.ts +5 -0
- package/src/list/list-section-header.tsx +37 -0
- package/src/list/list-title-header.tsx +30 -0
- package/src/loader/index.ts +5 -0
- package/src/loader/loader.stories.tsx +31 -0
- package/src/loader/loader.tsx +169 -0
- package/src/loader/loading-result.stories.tsx +67 -0
- package/src/loader/loading-result.tsx +93 -0
- package/src/nerd-view/index.ts +3 -0
- package/src/nerd-view/nerd-mode-item.tsx +296 -0
- package/src/normalize-color.d.ts +1 -0
- package/src/pin/index.ts +4 -0
- package/src/pin/keypad.tsx +166 -0
- package/src/pin/pin-code-screen.stories.tsx +80 -0
- package/src/pin/pin-code-screen.tsx +195 -0
- package/src/pin/pins.tsx +48 -0
- package/src/screens/backup-screen.tsx +92 -0
- package/src/screens/image-preview-screen.stories.tsx +28 -0
- package/src/screens/image-preview-screen.tsx +82 -0
- package/src/screens/index.ts +13 -0
- package/src/screens/nerd-mode-screen.tsx +150 -0
- package/src/screens/qr-code-scanner-screen.stories.tsx +37 -0
- package/src/screens/qr-code-scanner-screen.tsx +124 -0
- package/src/screens/scroll-view-screen.tsx +91 -0
- package/src/screens/section-list-screen.tsx +61 -0
- package/src/searchbar/animated-search-bar.tsx +96 -0
- package/src/searchbar/index.ts +5 -0
- package/src/searchbar/search-bar.stories.tsx +31 -0
- package/src/searchbar/search-bar.tsx +94 -0
- package/src/settings/button-setting.tsx +72 -0
- package/src/settings/index.ts +11 -0
- package/src/settings/setting-item-separator.tsx +32 -0
- package/src/settings/setting-item.tsx +68 -0
- package/src/settings/settings-button.tsx +23 -0
- package/src/settings/switch-setting.tsx +33 -0
- package/src/state/error-screen.stories.tsx +22 -0
- package/src/state/error-screen.tsx +71 -0
- package/src/state/index.ts +3 -0
- package/src/text/base.tsx +53 -0
- package/src/text/font.ts +52 -0
- package/src/text/index.ts +3 -0
- package/src/text/typography.stories.tsx +70 -0
- package/src/text/typography.tsx +117 -0
- package/src/theme/color-scheme-context.tsx +48 -0
- package/src/theme/color-scheme.ts +31 -0
- package/src/theme/index.ts +4 -0
- package/src/utils/color.ts +34 -0
- package/src/utils/contrasting-status-bar.tsx +21 -0
- package/src/utils/date.ts +49 -0
- package/src/utils/hooks/header/on-scroll-header-state.tsx +16 -0
- package/src/utils/hooks/index.ts +5 -0
- package/src/utils/hooks/list/list-content-inset.ts +24 -0
- package/src/utils/index.ts +19 -0
- package/src/utils/navigation.ts +37 -0
- package/src/utils/ref.ts +39 -0
- package/src/utils/testID.test.ts +20 -0
- package/src/utils/testID.ts +9 -0
- package/src/utils/useMemoAsync.ts +50 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { useIsFocused, useNavigation } from '@react-navigation/native';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { AccessibilityInfo, findNodeHandle, Platform } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Global transformer of text for Voice-Over
|
|
7
|
+
* @param {string} text (Visible) text to be announced
|
|
8
|
+
* @returns {string} Text to be read-out by Voice-Over
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
let textTransformer = null;
|
|
12
|
+
export function setAccessibilityTextTransformer(transformer) {
|
|
13
|
+
textTransformer = transformer;
|
|
14
|
+
}
|
|
15
|
+
export function transformAccessibilityText(text) {
|
|
16
|
+
return textTransformer && text ? textTransformer(text) : text;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Make element accessible after navigation transition is done
|
|
21
|
+
* @returns {boolean} flag to be used as `accessible` prop on the target component(s)
|
|
22
|
+
*/
|
|
23
|
+
export function useAccessibleAfterTransition() {
|
|
24
|
+
const navigation = useNavigation();
|
|
25
|
+
const [accessible, setAccessible] = useState(false);
|
|
26
|
+
const isFocused = useIsFocused();
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!isFocused) {
|
|
29
|
+
setAccessible(false);
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const unsubscribe = navigation.addListener('transitionEnd', () => setAccessible(true));
|
|
33
|
+
// fallback for cases when transition doesn't happen (e.g. forceful screen re-render)
|
|
34
|
+
const timeout = setTimeout(() => setAccessible(true), 500);
|
|
35
|
+
return () => {
|
|
36
|
+
unsubscribe();
|
|
37
|
+
clearTimeout(timeout);
|
|
38
|
+
};
|
|
39
|
+
}, [navigation, isFocused]);
|
|
40
|
+
return isFocused && accessible;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Query whether the current screen is NOT transitioning
|
|
45
|
+
* @returns {boolean} flag signifying whether the current screen is NOT in a transition (either entering or leaving)
|
|
46
|
+
*/
|
|
47
|
+
export function useIsOutsideTransition() {
|
|
48
|
+
const navigation = useNavigation();
|
|
49
|
+
const [inTransition, setInTransition] = useState(true);
|
|
50
|
+
const isFocused = useIsFocused();
|
|
51
|
+
const focused = useRef(isFocused);
|
|
52
|
+
focused.current = isFocused;
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const unsubscribeStart = navigation.addListener('transitionStart', () => setInTransition(true));
|
|
55
|
+
const unsubscribeEnd = navigation.addListener('transitionEnd', () => {
|
|
56
|
+
if (focused.current) {
|
|
57
|
+
setInTransition(false);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
return () => {
|
|
61
|
+
unsubscribeStart();
|
|
62
|
+
unsubscribeEnd();
|
|
63
|
+
};
|
|
64
|
+
}, [navigation]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!isFocused) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
setInTransition(true);
|
|
70
|
+
// fallback for cases when transition callback doesn't happen (e.g. forceful screen re-render)
|
|
71
|
+
const timeout = setTimeout(() => setInTransition(false), 500);
|
|
72
|
+
return () => {
|
|
73
|
+
clearTimeout(timeout);
|
|
74
|
+
};
|
|
75
|
+
}, [isFocused]);
|
|
76
|
+
return isFocused && !inTransition;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Focuses an element for accessibility
|
|
81
|
+
* @param component component ref
|
|
82
|
+
* @note Disabled on android as it is not reliable
|
|
83
|
+
*/
|
|
84
|
+
export const focusAccessibility = component => {
|
|
85
|
+
if (Platform.OS === 'ios' && component) {
|
|
86
|
+
const nodeHandle = findNodeHandle(component);
|
|
87
|
+
if (nodeHandle) {
|
|
88
|
+
AccessibilityInfo.setAccessibilityFocus(nodeHandle);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Focuses an element for accessibility
|
|
95
|
+
* @param {boolean} focused Focusing happens when this changes to `true`
|
|
96
|
+
* @returns reference to be used with the target element
|
|
97
|
+
*/
|
|
98
|
+
export const useAccessibilityFocus = function () {
|
|
99
|
+
let focused = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
100
|
+
const ref = useRef(null);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
if (focused) {
|
|
103
|
+
focusAccessibility(ref.current);
|
|
104
|
+
}
|
|
105
|
+
}, [focused]);
|
|
106
|
+
return ref;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Posts a screen-reader/voice-over announcement
|
|
111
|
+
* @param {string} message Announcement message
|
|
112
|
+
* * if `null` passed, it resets the cached announcement and the same message can be re-announced again
|
|
113
|
+
* @returns {boolean} When the announcement is successfully finished (only supported on iOS), false otherwise
|
|
114
|
+
* @note Use {@link setAccessibilityTextTransformer} to apply text transformation for the read-out text
|
|
115
|
+
*/
|
|
116
|
+
export const useAccessibilityAnnouncement = message => {
|
|
117
|
+
const announcement = message ? transformAccessibilityText(message) : message;
|
|
118
|
+
const [announcementFinished, setAnnouncementFinished] = useState();
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (announcement === null) {
|
|
121
|
+
// explicitly clearing cached state
|
|
122
|
+
setAnnouncementFinished(undefined);
|
|
123
|
+
}
|
|
124
|
+
if (!announcement) {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
let subscription;
|
|
128
|
+
const unsubscribe = () => {
|
|
129
|
+
var _subscription;
|
|
130
|
+
return (_subscription = subscription) === null || _subscription === void 0 ? void 0 : _subscription.remove();
|
|
131
|
+
};
|
|
132
|
+
if (Platform.OS === 'ios') {
|
|
133
|
+
let retries = 0;
|
|
134
|
+
subscription = AccessibilityInfo.addEventListener('announcementFinished', _ref => {
|
|
135
|
+
let {
|
|
136
|
+
announcement: finished,
|
|
137
|
+
success
|
|
138
|
+
} = _ref;
|
|
139
|
+
if (finished === announcement) {
|
|
140
|
+
if (success) {
|
|
141
|
+
setAnnouncementFinished(announcement);
|
|
142
|
+
unsubscribe();
|
|
143
|
+
} else if (retries++ < 2) {
|
|
144
|
+
// when the automatic voice-over cancels the first try (e.g. after screen transition), let's attempt again one more time
|
|
145
|
+
AccessibilityInfo.announceForAccessibility(announcement);
|
|
146
|
+
} else {
|
|
147
|
+
unsubscribe();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
AccessibilityInfo.announceForAccessibility(announcement);
|
|
153
|
+
return unsubscribe;
|
|
154
|
+
}, [announcement]);
|
|
155
|
+
return Boolean(announcement && announcementFinished === announcement);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Posts a screen-reader/voice-over announcement
|
|
160
|
+
* @param {string} message Announcement message
|
|
161
|
+
* @param {boolean} waitForPreviousAnnouncement When a new message appears before the previous announcement if finished:
|
|
162
|
+
* - `true`: postpone the new message to be announced after the previous message(s)
|
|
163
|
+
* - `false` (default): cancel the previous announcement and start the new message
|
|
164
|
+
* @returns {boolean} When all announcements are finished (only supported on iOS), false otherwise
|
|
165
|
+
* @see {@link useAccessibilityAnnouncement} for further info
|
|
166
|
+
*/
|
|
167
|
+
export const useAccessibilityAnnouncementCumulative = (message, waitForPreviousAnnouncement) => {
|
|
168
|
+
// waiting only possible on iOS
|
|
169
|
+
const wait = Platform.OS === 'ios' && waitForPreviousAnnouncement;
|
|
170
|
+
const [announcements, setAnnouncements] = useState([]);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (message) {
|
|
173
|
+
setAnnouncements(prev => [...prev, message]);
|
|
174
|
+
}
|
|
175
|
+
}, [message]);
|
|
176
|
+
const nextAnnouncement = wait ? announcements[0] : message;
|
|
177
|
+
const finished = useAccessibilityAnnouncement(nextAnnouncement);
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
if (finished) {
|
|
180
|
+
setAnnouncements(prev => prev.filter(m => m !== nextAnnouncement));
|
|
181
|
+
}
|
|
182
|
+
}, [nextAnnouncement, finished]);
|
|
183
|
+
return wait ? !announcements.length : finished;
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=accessibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useIsFocused","useNavigation","useEffect","useRef","useState","AccessibilityInfo","findNodeHandle","Platform","textTransformer","setAccessibilityTextTransformer","transformer","transformAccessibilityText","text","useAccessibleAfterTransition","navigation","accessible","setAccessible","isFocused","undefined","unsubscribe","addListener","timeout","setTimeout","clearTimeout","useIsOutsideTransition","inTransition","setInTransition","focused","current","unsubscribeStart","unsubscribeEnd","focusAccessibility","component","OS","nodeHandle","setAccessibilityFocus","useAccessibilityFocus","arguments","length","ref","useAccessibilityAnnouncement","message","announcement","announcementFinished","setAnnouncementFinished","subscription","_subscription","remove","retries","addEventListener","_ref","finished","success","announceForAccessibility","Boolean","useAccessibilityAnnouncementCumulative","waitForPreviousAnnouncement","wait","announcements","setAnnouncements","prev","nextAnnouncement","filter","m"],"sources":["accessibility.ts"],"sourcesContent":["import { NavigationProp, NavigationState, useIsFocused, useNavigation } from '@react-navigation/native';\nimport { useEffect, useRef, useState } from 'react';\nimport { AccessibilityInfo, EmitterSubscription, findNodeHandle, Platform } from 'react-native';\n\n/**\n * Global transformer of text for Voice-Over\n * @param {string} text (Visible) text to be announced\n * @returns {string} Text to be read-out by Voice-Over\n */\nexport type AccessibilityTextTransformer = (text: string) => string;\nlet textTransformer: AccessibilityTextTransformer | null = null;\nexport function setAccessibilityTextTransformer(transformer: AccessibilityTextTransformer | null) {\n textTransformer = transformer;\n}\nexport function transformAccessibilityText(text: string) {\n return textTransformer && text ? textTransformer(text) : text;\n}\n\n/**\n * Make element accessible after navigation transition is done\n * @returns {boolean} flag to be used as `accessible` prop on the target component(s)\n */\nexport function useAccessibleAfterTransition<\n TNavigationProp extends NavigationProp<\n Record<string, any>,\n string,\n NavigationState<Record<string, any>>,\n {},\n { transitionEnd: {} }\n >,\n>() {\n const navigation = useNavigation<TNavigationProp>();\n const [accessible, setAccessible] = useState(false);\n\n const isFocused = useIsFocused();\n useEffect(() => {\n if (!isFocused) {\n setAccessible(false);\n return undefined;\n }\n const unsubscribe = navigation.addListener('transitionEnd', () => setAccessible(true));\n // fallback for cases when transition doesn't happen (e.g. forceful screen re-render)\n const timeout = setTimeout(() => setAccessible(true), 500);\n return () => {\n unsubscribe();\n clearTimeout(timeout);\n };\n }, [navigation, isFocused]);\n\n return isFocused && accessible;\n}\n\n/**\n * Query whether the current screen is NOT transitioning\n * @returns {boolean} flag signifying whether the current screen is NOT in a transition (either entering or leaving)\n */\nexport function useIsOutsideTransition<\n TNavigationProp extends NavigationProp<\n Record<string, any>,\n string,\n NavigationState<Record<string, any>>,\n {},\n { transitionStart: {}; transitionEnd: {} }\n >,\n>() {\n const navigation = useNavigation<TNavigationProp>();\n const [inTransition, setInTransition] = useState<boolean>(true);\n\n const isFocused = useIsFocused();\n const focused = useRef(isFocused);\n focused.current = isFocused;\n\n useEffect(() => {\n const unsubscribeStart = navigation.addListener('transitionStart', () => setInTransition(true));\n const unsubscribeEnd = navigation.addListener('transitionEnd', () => {\n if (focused.current) {\n setInTransition(false);\n }\n });\n return () => {\n unsubscribeStart();\n unsubscribeEnd();\n };\n }, [navigation]);\n\n useEffect(() => {\n if (!isFocused) {\n return undefined;\n }\n\n setInTransition(true);\n // fallback for cases when transition callback doesn't happen (e.g. forceful screen re-render)\n const timeout = setTimeout(() => setInTransition(false), 500);\n return () => {\n clearTimeout(timeout);\n };\n }, [isFocused]);\n\n return isFocused && !inTransition;\n}\n\n/**\n * Focuses an element for accessibility\n * @param component component ref\n * @note Disabled on android as it is not reliable\n */\nexport const focusAccessibility = (component?: React.Component | React.ComponentClass | null) => {\n if (Platform.OS === 'ios' && component) {\n const nodeHandle = findNodeHandle(component);\n if (nodeHandle) {\n AccessibilityInfo.setAccessibilityFocus(nodeHandle);\n }\n }\n};\n\n/**\n * Focuses an element for accessibility\n * @param {boolean} focused Focusing happens when this changes to `true`\n * @returns reference to be used with the target element\n */\nexport const useAccessibilityFocus = <T extends React.Component | React.ComponentClass>(focused: boolean = true) => {\n const ref = useRef<T>(null);\n\n useEffect(() => {\n if (focused) {\n focusAccessibility(ref.current);\n }\n }, [focused]);\n\n return ref;\n};\n\n/**\n * Posts a screen-reader/voice-over announcement\n * @param {string} message Announcement message\n * * if `null` passed, it resets the cached announcement and the same message can be re-announced again\n * @returns {boolean} When the announcement is successfully finished (only supported on iOS), false otherwise\n * @note Use {@link setAccessibilityTextTransformer} to apply text transformation for the read-out text\n */\nexport const useAccessibilityAnnouncement = (message?: string | null): boolean => {\n const announcement = message ? transformAccessibilityText(message) : message;\n const [announcementFinished, setAnnouncementFinished] = useState<string>();\n useEffect(() => {\n if (announcement === null) {\n // explicitly clearing cached state\n setAnnouncementFinished(undefined);\n }\n\n if (!announcement) {\n return undefined;\n }\n\n let subscription: EmitterSubscription;\n const unsubscribe = () => subscription?.remove();\n if (Platform.OS === 'ios') {\n let retries = 0;\n subscription = AccessibilityInfo.addEventListener(\n 'announcementFinished',\n ({ announcement: finished, success }) => {\n if (finished === announcement) {\n if (success) {\n setAnnouncementFinished(announcement);\n unsubscribe();\n } else if (retries++ < 2) {\n // when the automatic voice-over cancels the first try (e.g. after screen transition), let's attempt again one more time\n AccessibilityInfo.announceForAccessibility(announcement);\n } else {\n unsubscribe();\n }\n }\n },\n );\n }\n\n AccessibilityInfo.announceForAccessibility(announcement);\n return unsubscribe;\n }, [announcement]);\n\n return Boolean(announcement && announcementFinished === announcement);\n};\n\n/**\n * Posts a screen-reader/voice-over announcement\n * @param {string} message Announcement message\n * @param {boolean} waitForPreviousAnnouncement When a new message appears before the previous announcement if finished:\n * - `true`: postpone the new message to be announced after the previous message(s)\n * - `false` (default): cancel the previous announcement and start the new message\n * @returns {boolean} When all announcements are finished (only supported on iOS), false otherwise\n * @see {@link useAccessibilityAnnouncement} for further info\n */\nexport const useAccessibilityAnnouncementCumulative = (\n message?: string,\n waitForPreviousAnnouncement?: boolean,\n): boolean => {\n // waiting only possible on iOS\n const wait = Platform.OS === 'ios' && waitForPreviousAnnouncement;\n\n const [announcements, setAnnouncements] = useState<string[]>([]);\n useEffect(() => {\n if (message) {\n setAnnouncements((prev) => [...prev, message]);\n }\n }, [message]);\n\n const nextAnnouncement = wait ? announcements[0] : message;\n const finished = useAccessibilityAnnouncement(nextAnnouncement);\n\n useEffect(() => {\n if (finished) {\n setAnnouncements((prev) => prev.filter((m) => m !== nextAnnouncement));\n }\n }, [nextAnnouncement, finished]);\n\n return wait ? !announcements.length : finished;\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useRoute } from '@react-navigation/native';
|
|
2
|
+
import React, { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { useForwardedRef } from '../utils/ref';
|
|
4
|
+
import { focusAccessibility, useAccessibleAfterTransition } from './accessibility';
|
|
5
|
+
const accessibilityFocusHistoryContext = /*#__PURE__*/React.createContext({
|
|
6
|
+
setRef: () => {},
|
|
7
|
+
getRef: () => null
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Adds app support for accessibility focus history
|
|
12
|
+
*/
|
|
13
|
+
export const AccessibilityFocusHistoryProvider = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
const Provider = accessibilityFocusHistoryContext.Provider;
|
|
18
|
+
const refs = useRef({});
|
|
19
|
+
const setRef = useCallback((route, ref) => {
|
|
20
|
+
refs.current[route] = ref;
|
|
21
|
+
}, []);
|
|
22
|
+
const getRef = useCallback(route => {
|
|
23
|
+
var _refs$current$route;
|
|
24
|
+
return (_refs$current$route = refs.current[route]) !== null && _refs$current$route !== void 0 ? _refs$current$route : null;
|
|
25
|
+
}, []);
|
|
26
|
+
const value = useMemo(() => ({
|
|
27
|
+
setRef,
|
|
28
|
+
getRef
|
|
29
|
+
}), [getRef, setRef]);
|
|
30
|
+
return /*#__PURE__*/React.createElement(Provider, {
|
|
31
|
+
value: value
|
|
32
|
+
}, children);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Wraps `onPress` handler and `ref` to support automatic accessibility focus on back navigation
|
|
37
|
+
* @note This needs to be used inside {@link AccessibilityFocusHistoryProvider} and navigation context
|
|
38
|
+
*/
|
|
39
|
+
export const useAccessibilityFocusHistory = (pressHandler, passedRef) => {
|
|
40
|
+
const [forwardedRef, refObject] = useForwardedRef(passedRef);
|
|
41
|
+
const historyContext = useContext(accessibilityFocusHistoryContext);
|
|
42
|
+
const routeKey = useRoute().key;
|
|
43
|
+
const previouslyPressed = useRef(false);
|
|
44
|
+
const outsideTransition = useAccessibleAfterTransition();
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const isStoredInHistory = historyContext.getRef(routeKey) === refObject.current;
|
|
47
|
+
if (outsideTransition && isStoredInHistory && previouslyPressed.current) {
|
|
48
|
+
focusAccessibility(refObject.current);
|
|
49
|
+
}
|
|
50
|
+
}, [historyContext, outsideTransition, refObject, routeKey]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (outsideTransition) {
|
|
53
|
+
previouslyPressed.current = false;
|
|
54
|
+
}
|
|
55
|
+
}, [outsideTransition]);
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
const onPress = useCallback(function () {
|
|
59
|
+
previouslyPressed.current = true;
|
|
60
|
+
historyContext.setRef(routeKey, refObject.current);
|
|
61
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
62
|
+
args[_key] = arguments[_key];
|
|
63
|
+
}
|
|
64
|
+
return pressHandler === null || pressHandler === void 0 ? void 0 : pressHandler(...args);
|
|
65
|
+
}, [historyContext, routeKey, refObject, pressHandler]);
|
|
66
|
+
return {
|
|
67
|
+
onPress,
|
|
68
|
+
ref: forwardedRef
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=accessibilityHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useRoute","React","useCallback","useContext","useEffect","useMemo","useRef","useForwardedRef","focusAccessibility","useAccessibleAfterTransition","accessibilityFocusHistoryContext","createContext","setRef","getRef","AccessibilityFocusHistoryProvider","_ref","children","Provider","refs","route","ref","current","_refs$current$route","value","createElement","useAccessibilityFocusHistory","pressHandler","passedRef","forwardedRef","refObject","historyContext","routeKey","key","previouslyPressed","outsideTransition","isStoredInHistory","onPress","_len","arguments","length","args","Array","_key"],"sources":["accessibilityHistory.tsx"],"sourcesContent":["import { useRoute } from '@react-navigation/native';\nimport React, { FC, PropsWithChildren, useCallback, useContext, useEffect, useMemo, useRef } from 'react';\n\nimport { useForwardedRef } from '../utils/ref';\nimport { focusAccessibility, useAccessibleAfterTransition } from './accessibility';\n\ntype AccessibilityRefComponent = React.Component | React.ComponentClass | null;\ninterface AccessibilityRefContextValue {\n setRef: (route: string, ref: AccessibilityRefComponent) => void;\n getRef: (route: string) => AccessibilityRefComponent;\n}\n\nconst accessibilityFocusHistoryContext = React.createContext<AccessibilityRefContextValue>({\n setRef: () => {},\n getRef: () => null,\n});\n\n/**\n * Adds app support for accessibility focus history\n */\nexport const AccessibilityFocusHistoryProvider: FC<PropsWithChildren<{}>> = ({ children }) => {\n const Provider = accessibilityFocusHistoryContext.Provider;\n const refs = useRef<Record<string, AccessibilityRefComponent>>({});\n const setRef = useCallback((route: string, ref: AccessibilityRefComponent) => {\n refs.current[route] = ref;\n }, []);\n const getRef = useCallback((route: string) => {\n return refs.current[route] ?? null;\n }, []);\n const value = useMemo(() => ({ setRef, getRef }), [getRef, setRef]);\n return <Provider value={value}>{children}</Provider>;\n};\n\n/**\n * Wraps `onPress` handler and `ref` to support automatic accessibility focus on back navigation\n * @note This needs to be used inside {@link AccessibilityFocusHistoryProvider} and navigation context\n */\nexport const useAccessibilityFocusHistory = <\n Component extends React.Component<any> | React.ComponentClass<any>,\n OnPress extends (...args: never[]) => void = () => void,\n>(\n pressHandler: OnPress | undefined,\n passedRef?: React.Ref<Component>,\n) => {\n const [forwardedRef, refObject] = useForwardedRef<Component>(passedRef);\n\n const historyContext = useContext(accessibilityFocusHistoryContext);\n const routeKey = useRoute().key;\n\n const previouslyPressed = useRef(false);\n const outsideTransition = useAccessibleAfterTransition();\n\n useEffect(() => {\n const isStoredInHistory = historyContext.getRef(routeKey) === refObject.current;\n if (outsideTransition && isStoredInHistory && previouslyPressed.current) {\n focusAccessibility(refObject.current);\n }\n }, [historyContext, outsideTransition, refObject, routeKey]);\n\n useEffect(() => {\n if (outsideTransition) {\n previouslyPressed.current = false;\n }\n }, [outsideTransition]);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const onPress = useCallback(\n ((...args) => {\n previouslyPressed.current = true;\n historyContext.setRef(routeKey, refObject.current);\n return pressHandler?.(...args);\n }) as OnPress,\n [historyContext, routeKey, refObject, pressHandler],\n );\n\n return { onPress, ref: forwardedRef };\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/* eslint-disable no-restricted-imports */
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { Pressable as RNPressable, TouchableHighlight as RNTouchableHighlight, TouchableOpacity as RNTouchableOpacity, TouchableWithoutFeedback as RNTouchableWithoutFeedback } from 'react-native';
|
|
5
|
+
import { useAccessibilityFocusHistory } from './accessibilityHistory';
|
|
6
|
+
const WithAccessibilityFocusHistory = (C, displayName) => {
|
|
7
|
+
const ComponentWithAccessibilityFocusHistory = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
forwardedRef,
|
|
10
|
+
onPress: originalOnPress,
|
|
11
|
+
...props
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
ref,
|
|
15
|
+
onPress
|
|
16
|
+
} = useAccessibilityFocusHistory(originalOnPress !== null && originalOnPress !== void 0 ? originalOnPress : undefined, forwardedRef);
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
return /*#__PURE__*/React.createElement(C, _extends({
|
|
19
|
+
ref: ref,
|
|
20
|
+
onPress: onPress
|
|
21
|
+
}, props));
|
|
22
|
+
};
|
|
23
|
+
const Forwarded = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React.createElement(ComponentWithAccessibilityFocusHistory, _extends({}, props, {
|
|
24
|
+
forwardedRef: ref
|
|
25
|
+
})));
|
|
26
|
+
Forwarded.displayName = displayName;
|
|
27
|
+
return Forwarded;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Wrappers of RN touchable components with accessibilty focus history support
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export const TouchableOpacity = WithAccessibilityFocusHistory(RNTouchableOpacity, 'TouchableOpacity');
|
|
35
|
+
export const TouchableWithoutFeedback = WithAccessibilityFocusHistory(RNTouchableWithoutFeedback, 'TouchableWithoutFeedback');
|
|
36
|
+
export const TouchableHighlight = WithAccessibilityFocusHistory(RNTouchableHighlight, 'TouchableHighlight');
|
|
37
|
+
export const Pressable = WithAccessibilityFocusHistory(RNPressable, 'Pressable');
|
|
38
|
+
//# sourceMappingURL=accessibilityHistoryWrappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","Pressable","RNPressable","TouchableHighlight","RNTouchableHighlight","TouchableOpacity","RNTouchableOpacity","TouchableWithoutFeedback","RNTouchableWithoutFeedback","useAccessibilityFocusHistory","WithAccessibilityFocusHistory","C","displayName","ComponentWithAccessibilityFocusHistory","_ref","forwardedRef","onPress","originalOnPress","props","ref","undefined","createElement","_extends","Forwarded"],"sources":["accessibilityHistoryWrappers.tsx"],"sourcesContent":["/* eslint-disable no-restricted-imports */\nimport React, { FC, ForwardedRef, forwardRef } from 'react';\nimport {\n GestureResponderEvent,\n Pressable as RNPressable,\n PressableProps,\n TouchableHighlight as RNTouchableHighlight,\n TouchableHighlightProps,\n TouchableOpacity as RNTouchableOpacity,\n TouchableOpacityProps,\n TouchableWithoutFeedback as RNTouchableWithoutFeedback,\n TouchableWithoutFeedbackProps,\n View,\n} from 'react-native';\n\nimport { useAccessibilityFocusHistory } from './accessibilityHistory';\n\ntype RNOnPress = (event: GestureResponderEvent) => void;\ninterface OnPressProps {\n onPress?: RNOnPress | null;\n}\n\nconst WithAccessibilityFocusHistory = <ComponentProps extends OnPressProps, RefType extends React.Component>(\n C: React.ComponentType<ComponentProps>,\n displayName: string,\n) => {\n type ForwardedProps = ComponentProps & {\n forwardedRef: ForwardedRef<RefType>;\n };\n\n const ComponentWithAccessibilityFocusHistory: FC<ForwardedProps> = ({\n forwardedRef,\n onPress: originalOnPress,\n ...props\n }) => {\n const { ref, onPress } = useAccessibilityFocusHistory<RefType, RNOnPress>(\n originalOnPress ?? undefined,\n forwardedRef,\n );\n // @ts-ignore\n return <C ref={ref} onPress={onPress} {...props} />;\n };\n\n const Forwarded = forwardRef<RefType, ComponentProps>((props, ref) => (\n <ComponentWithAccessibilityFocusHistory {...props} forwardedRef={ref} />\n ));\n Forwarded.displayName = displayName;\n\n return Forwarded;\n};\n\n/**\n * Wrappers of RN touchable components with accessibilty focus history support\n */\n\nexport const TouchableOpacity = WithAccessibilityFocusHistory<TouchableOpacityProps, RNTouchableOpacity>(\n RNTouchableOpacity,\n 'TouchableOpacity',\n);\nexport const TouchableWithoutFeedback = WithAccessibilityFocusHistory<\n TouchableWithoutFeedbackProps,\n RNTouchableWithoutFeedback\n>(RNTouchableWithoutFeedback, 'TouchableWithoutFeedback');\nexport const TouchableHighlight = WithAccessibilityFocusHistory<TouchableHighlightProps, RNTouchableHighlight>(\n RNTouchableHighlight,\n 'TouchableHighlight',\n);\nexport const Pressable = WithAccessibilityFocusHistory<PressableProps, View>(RNPressable, 'Pressable');\n\ntype WrapperRefType<C extends React.ForwardRefExoticComponent<React.RefAttributes<any>>> =\n C extends React.ForwardRefExoticComponent<React.RefAttributes<infer Ref>> ? Ref : never;\n\n/**\n * Ref types to be used in forwardRef for the wrappers\n */\n\nexport type TouchableOpacityRef = WrapperRefType<typeof TouchableOpacity>;\nexport type TouchableWithoutFeedbackRef = WrapperRefType<typeof TouchableWithoutFeedback>;\nexport type TouchableHighlightRef = WrapperRefType<typeof TouchableHighlight>;\nexport type PressableRef = WrapperRefType<typeof Pressable>;\n"],"mappings":";AAAA;AACA,OAAOA,KAAK,IAAsBC,UAAU,QAAQ,OAAO;AAC3D,SAEEC,SAAS,IAAIC,WAAW,EAExBC,kBAAkB,IAAIC,oBAAoB,EAE1CC,gBAAgB,IAAIC,kBAAkB,EAEtCC,wBAAwB,IAAIC,0BAA0B,QAGjD,cAAc;AAErB,SAASC,4BAA4B,QAAQ,wBAAwB;AAOrE,MAAMC,6BAA6B,GAAGA,CACpCC,CAAsC,EACtCC,WAAmB,KAChB;EAKH,MAAMC,sCAA0D,GAAGC,IAAA,IAI7D;IAAA,IAJ8D;MAClEC,YAAY;MACZC,OAAO,EAAEC,eAAe;MACxB,GAAGC;IACL,CAAC,GAAAJ,IAAA;IACC,MAAM;MAAEK,GAAG;MAAEH;IAAQ,CAAC,GAAGP,4BAA4B,CACnDQ,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAIG,SAAS,EAC5BL,YAAY,CACb;IACD;IACA,oBAAOhB,KAAA,CAAAsB,aAAA,CAACV,CAAC,EAAAW,QAAA;MAACH,GAAG,EAAEA,GAAI;MAACH,OAAO,EAAEA;IAAQ,GAAKE,KAAK,EAAI;EACrD,CAAC;EAED,MAAMK,SAAS,gBAAGvB,UAAU,CAA0B,CAACkB,KAAK,EAAEC,GAAG,kBAC/DpB,KAAA,CAAAsB,aAAA,CAACR,sCAAsC,EAAAS,QAAA,KAAKJ,KAAK;IAAEH,YAAY,EAAEI;EAAI,GACtE,CAAC;EACFI,SAAS,CAACX,WAAW,GAAGA,WAAW;EAEnC,OAAOW,SAAS;AAClB,CAAC;;AAED;AACA;AACA;;AAEA,OAAO,MAAMlB,gBAAgB,GAAGK,6BAA6B,CAC3DJ,kBAAkB,EAClB,kBAAkB,CACnB;AACD,OAAO,MAAMC,wBAAwB,GAAGG,6BAA6B,CAGnEF,0BAA0B,EAAE,0BAA0B,CAAC;AACzD,OAAO,MAAML,kBAAkB,GAAGO,6BAA6B,CAC7DN,oBAAoB,EACpB,oBAAoB,CACrB;AACD,OAAO,MAAMH,SAAS,GAAGS,6BAA6B,CAAuBR,WAAW,EAAE,WAAW,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { useContext, useMemo } from 'react';
|
|
2
|
+
import { getAccessibilityLanguageFile } from './locale';
|
|
3
|
+
const AccessibilityLanguageContext = /*#__PURE__*/React.createContext(undefined);
|
|
4
|
+
const Provider = AccessibilityLanguageContext.Provider;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Adds app support for accessibility language
|
|
8
|
+
* @param {SupportedAccessibilityLanguage} language Currenty selected language of the app
|
|
9
|
+
* @param {Object} overrides _(optional)_ Custom overrides for specific entries
|
|
10
|
+
*/
|
|
11
|
+
export const AccessibilityLanguageProvider = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
language,
|
|
14
|
+
overrides,
|
|
15
|
+
children
|
|
16
|
+
} = _ref;
|
|
17
|
+
const translate = useMemo(() => {
|
|
18
|
+
if (typeof overrides === 'function') {
|
|
19
|
+
return overrides;
|
|
20
|
+
}
|
|
21
|
+
const accessibilityFile = getAccessibilityLanguageFile(language, overrides);
|
|
22
|
+
return (entryKey, params) => {
|
|
23
|
+
let translation = accessibilityFile[entryKey];
|
|
24
|
+
|
|
25
|
+
// replace params
|
|
26
|
+
if (translation && params) {
|
|
27
|
+
Object.entries(params).forEach(_ref2 => {
|
|
28
|
+
let [key, value] = _ref2;
|
|
29
|
+
translation = translation.replace(new RegExp(`{${key}}`, 'g'), String(value));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return translation;
|
|
33
|
+
};
|
|
34
|
+
}, [language, overrides]);
|
|
35
|
+
return /*#__PURE__*/React.createElement(Provider, {
|
|
36
|
+
value: translate
|
|
37
|
+
}, children);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Access accessibility language translations
|
|
42
|
+
* @note This needs to be used inside {@link AccessibilityLanguageProvider} context
|
|
43
|
+
*/
|
|
44
|
+
export const useAccessibilityTranslation = () => {
|
|
45
|
+
const translate = useContext(AccessibilityLanguageContext);
|
|
46
|
+
|
|
47
|
+
// check context provided
|
|
48
|
+
if (!translate) {
|
|
49
|
+
throw new Error('Accessibility Language not provided!, wrap your components in the AccessibilityLanguageProvider');
|
|
50
|
+
}
|
|
51
|
+
return translate;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=accessibilityLanguage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useContext","useMemo","getAccessibilityLanguageFile","AccessibilityLanguageContext","createContext","undefined","Provider","AccessibilityLanguageProvider","_ref","language","overrides","children","translate","accessibilityFile","entryKey","params","translation","Object","entries","forEach","_ref2","key","value","replace","RegExp","String","createElement","useAccessibilityTranslation","Error"],"sources":["accessibilityLanguage.tsx"],"sourcesContent":["import React, { FC, PropsWithChildren, useContext, useMemo } from 'react';\n\nimport { AccessibilityLanguageFile, getAccessibilityLanguageFile, SupportedAccessibilityLanguage } from './locale';\n\nexport type AccessibilityLanguageFileEntryKey = keyof AccessibilityLanguageFile;\ntype AccessibilityLanguageTranslate = (\n entryKey: AccessibilityLanguageFileEntryKey,\n params?: Record<string, string | number>,\n) => string;\n\nconst AccessibilityLanguageContext = React.createContext<AccessibilityLanguageTranslate | undefined>(undefined);\n\nexport interface AccessibilityLanguageProviderProps {\n language: SupportedAccessibilityLanguage;\n overrides?: Partial<AccessibilityLanguageFile> | AccessibilityLanguageTranslate;\n}\n\nconst Provider = AccessibilityLanguageContext.Provider;\n\n/**\n * Adds app support for accessibility language\n * @param {SupportedAccessibilityLanguage} language Currenty selected language of the app\n * @param {Object} overrides _(optional)_ Custom overrides for specific entries\n */\nexport const AccessibilityLanguageProvider: FC<PropsWithChildren<AccessibilityLanguageProviderProps>> = ({\n language,\n overrides,\n children,\n}) => {\n const translate = useMemo<AccessibilityLanguageTranslate>(() => {\n if (typeof overrides === 'function') {\n return overrides;\n }\n\n const accessibilityFile = getAccessibilityLanguageFile(language, overrides);\n return (entryKey, params) => {\n let translation = accessibilityFile[entryKey];\n\n // replace params\n if (translation && params) {\n Object.entries(params).forEach(([key, value]) => {\n translation = translation.replace(new RegExp(`{${key}}`, 'g'), String(value));\n });\n }\n\n return translation;\n };\n }, [language, overrides]);\n\n return <Provider value={translate}>{children}</Provider>;\n};\n\n/**\n * Access accessibility language translations\n * @note This needs to be used inside {@link AccessibilityLanguageProvider} context\n */\nexport const useAccessibilityTranslation = () => {\n const translate = useContext(AccessibilityLanguageContext);\n\n // check context provided\n if (!translate) {\n throw new Error('Accessibility Language not provided!, wrap your components in the AccessibilityLanguageProvider');\n }\n\n return translate;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAA2BC,UAAU,EAAEC,OAAO,QAAQ,OAAO;AAEzE,SAAoCC,4BAA4B,QAAwC,UAAU;AAQlH,MAAMC,4BAA4B,gBAAGJ,KAAK,CAACK,aAAa,CAA6CC,SAAS,CAAC;AAO/G,MAAMC,QAAQ,GAAGH,4BAA4B,CAACG,QAAQ;;AAEtD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAAwF,GAAGC,IAAA,IAIlG;EAAA,IAJmG;IACvGC,QAAQ;IACRC,SAAS;IACTC;EACF,CAAC,GAAAH,IAAA;EACC,MAAMI,SAAS,GAAGX,OAAO,CAAiC,MAAM;IAC9D,IAAI,OAAOS,SAAS,KAAK,UAAU,EAAE;MACnC,OAAOA,SAAS;IAClB;IAEA,MAAMG,iBAAiB,GAAGX,4BAA4B,CAACO,QAAQ,EAAEC,SAAS,CAAC;IAC3E,OAAO,CAACI,QAAQ,EAAEC,MAAM,KAAK;MAC3B,IAAIC,WAAW,GAAGH,iBAAiB,CAACC,QAAQ,CAAC;;MAE7C;MACA,IAAIE,WAAW,IAAID,MAAM,EAAE;QACzBE,MAAM,CAACC,OAAO,CAACH,MAAM,CAAC,CAACI,OAAO,CAACC,KAAA,IAAkB;UAAA,IAAjB,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,KAAA;UAC1CJ,WAAW,GAAGA,WAAW,CAACO,OAAO,CAAC,IAAIC,MAAM,CAAE,IAAGH,GAAI,GAAE,EAAE,GAAG,CAAC,EAAEI,MAAM,CAACH,KAAK,CAAC,CAAC;QAC/E,CAAC,CAAC;MACJ;MAEA,OAAON,WAAW;IACpB,CAAC;EACH,CAAC,EAAE,CAACP,QAAQ,EAAEC,SAAS,CAAC,CAAC;EAEzB,oBAAOX,KAAA,CAAA2B,aAAA,CAACpB,QAAQ;IAACgB,KAAK,EAAEV;EAAU,GAAED,QAAQ,CAAY;AAC1D,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMgB,2BAA2B,GAAGA,CAAA,KAAM;EAC/C,MAAMf,SAAS,GAAGZ,UAAU,CAACG,4BAA4B,CAAC;;EAE1D;EACA,IAAI,CAACS,SAAS,EAAE;IACd,MAAM,IAAIgB,KAAK,CAAC,iGAAiG,CAAC;EACpH;EAEA,OAAOhB,SAAS;AAClB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AccessibilityTextTransformer, focusAccessibility, setAccessibilityTextTransformer, transformAccessibilityText, useAccessibilityAnnouncement, useAccessibilityAnnouncementCumulative, useAccessibilityFocus, useAccessibleAfterTransition, useIsOutsideTransition } from './accessibility';
|
|
2
|
+
import { AccessibilityFocusHistoryProvider, useAccessibilityFocusHistory } from './accessibilityHistory';
|
|
3
|
+
import { AccessibilityLanguageProvider, AccessibilityLanguageProviderProps } from './accessibilityLanguage';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import { AccessibilityLanguageFile, SupportedAccessibilityLanguage } from './locale';
|
|
6
|
+
export * from './accessibilityHistoryWrappers';
|
|
7
|
+
export { AccessibilityFocusHistoryProvider, AccessibilityLanguageFile, AccessibilityLanguageProvider, AccessibilityLanguageProviderProps, AccessibilityTextTransformer, focusAccessibility, setAccessibilityTextTransformer, SupportedAccessibilityLanguage, transformAccessibilityText, useAccessibilityAnnouncement, useAccessibilityAnnouncementCumulative, useAccessibilityFocus, useAccessibilityFocusHistory, useAccessibleAfterTransition, useIsOutsideTransition };
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["AccessibilityTextTransformer","focusAccessibility","setAccessibilityTextTransformer","transformAccessibilityText","useAccessibilityAnnouncement","useAccessibilityAnnouncementCumulative","useAccessibilityFocus","useAccessibleAfterTransition","useIsOutsideTransition","AccessibilityFocusHistoryProvider","useAccessibilityFocusHistory","AccessibilityLanguageProvider","AccessibilityLanguageProviderProps","AccessibilityLanguageFile","SupportedAccessibilityLanguage"],"sources":["index.ts"],"sourcesContent":["import {\n AccessibilityTextTransformer,\n focusAccessibility,\n setAccessibilityTextTransformer,\n transformAccessibilityText,\n useAccessibilityAnnouncement,\n useAccessibilityAnnouncementCumulative,\n useAccessibilityFocus,\n useAccessibleAfterTransition,\n useIsOutsideTransition,\n} from './accessibility';\nimport { AccessibilityFocusHistoryProvider, useAccessibilityFocusHistory } from './accessibilityHistory';\nimport { AccessibilityLanguageProvider, AccessibilityLanguageProviderProps } from './accessibilityLanguage';\n// @ts-ignore\nimport { AccessibilityLanguageFile, SupportedAccessibilityLanguage } from './locale';\n\nexport * from './accessibilityHistoryWrappers';\n\nexport {\n AccessibilityFocusHistoryProvider,\n AccessibilityLanguageFile,\n AccessibilityLanguageProvider,\n AccessibilityLanguageProviderProps,\n AccessibilityTextTransformer,\n focusAccessibility,\n setAccessibilityTextTransformer,\n SupportedAccessibilityLanguage,\n transformAccessibilityText,\n useAccessibilityAnnouncement,\n useAccessibilityAnnouncementCumulative,\n useAccessibilityFocus,\n useAccessibilityFocusHistory,\n useAccessibleAfterTransition,\n useIsOutsideTransition,\n};\n"],"mappings":"AAAA,SACEA,4BAA4B,EAC5BC,kBAAkB,EAClBC,+BAA+B,EAC/BC,0BAA0B,EAC1BC,4BAA4B,EAC5BC,sCAAsC,EACtCC,qBAAqB,EACrBC,4BAA4B,EAC5BC,sBAAsB,QACjB,iBAAiB;AACxB,SAASC,iCAAiC,EAAEC,4BAA4B,QAAQ,wBAAwB;AACxG,SAASC,6BAA6B,EAAEC,kCAAkC,QAAQ,yBAAyB;AAC3G;AACA,SAASC,yBAAyB,EAAEC,8BAA8B,QAAQ,UAAU;AAEpF,cAAc,gCAAgC;AAE9C,SACEL,iCAAiC,EACjCI,yBAAyB,EACzBF,6BAA6B,EAC7BC,kCAAkC,EAClCZ,4BAA4B,EAC5BC,kBAAkB,EAClBC,+BAA+B,EAC/BY,8BAA8B,EAC9BX,0BAA0B,EAC1BC,4BAA4B,EAC5BC,sCAAsC,EACtCC,qBAAqB,EACrBI,4BAA4B,EAC5BH,4BAA4B,EAC5BC,sBAAsB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"accessibility.control.combobox.expanded": "erweitert",
|
|
3
|
+
"accessibility.control.combobox.tapToSelect": "Zum Auswählen doppeltippen",
|
|
4
|
+
"accessibility.control.order": "{current} von {length}",
|
|
5
|
+
"accessibility.control.progress": "{current} von {length}",
|
|
6
|
+
"accessibility.control.checked": "ausgewählt",
|
|
7
|
+
"accessibility.control.unchecked": "nicht ausgewählt",
|
|
8
|
+
"accessibility.control.clear": "löschen",
|
|
9
|
+
"accessibility.control.delete": "löschen",
|
|
10
|
+
"accessibility.control.list.moveDown": "Nach unten bewegen",
|
|
11
|
+
"accessibility.control.list.moveUp": "Nach oben bewegen",
|
|
12
|
+
"accessibility.nav.back": "zurück",
|
|
13
|
+
"accessibility.nav.close": "schliessen",
|
|
14
|
+
"accessibility.nav.next": "weiter",
|
|
15
|
+
"accessibility.icon.edit": "bearbeiten",
|
|
16
|
+
"accessibility.icon.add": "hinzufügen",
|
|
17
|
+
"accessibility.icon.filter": "filter",
|
|
18
|
+
"accessibility.icon.scan": "scannen",
|
|
19
|
+
"accessibility.key.faceId": "faceId",
|
|
20
|
+
"accessibility.key.fingerprint": "Fingerabdruck"
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"accessibility.control.combobox.expanded": "Expanded",
|
|
3
|
+
"accessibility.control.combobox.tapToSelect": "Double-tap to select",
|
|
4
|
+
"accessibility.control.order": "{current} of {length}",
|
|
5
|
+
"accessibility.control.progress": "{current} out of {length}",
|
|
6
|
+
"accessibility.control.checked": "checked",
|
|
7
|
+
"accessibility.control.unchecked": "not checked",
|
|
8
|
+
"accessibility.control.clear": "clear",
|
|
9
|
+
"accessibility.control.delete": "delete",
|
|
10
|
+
"accessibility.control.list.moveDown": "Move down",
|
|
11
|
+
"accessibility.control.list.moveUp": "Move up",
|
|
12
|
+
"accessibility.nav.back": "back",
|
|
13
|
+
"accessibility.nav.close": "close",
|
|
14
|
+
"accessibility.nav.next": "next",
|
|
15
|
+
"accessibility.icon.edit": "edit",
|
|
16
|
+
"accessibility.icon.add": "add",
|
|
17
|
+
"accessibility.icon.filter": "filter",
|
|
18
|
+
"accessibility.icon.scan": "scan",
|
|
19
|
+
"accessibility.key.faceId": "faceId",
|
|
20
|
+
"accessibility.key.fingerprint": "fingerprint"
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"accessibility.control.combobox.expanded": "Élargi",
|
|
3
|
+
"accessibility.control.combobox.tapToSelect": "Touchez deux fois pour sélectionner",
|
|
4
|
+
"accessibility.control.order": "{current} de {length}",
|
|
5
|
+
"accessibility.control.progress": "{current} sur {length}",
|
|
6
|
+
"accessibility.control.checked": "cochée",
|
|
7
|
+
"accessibility.control.unchecked": "décochée",
|
|
8
|
+
"accessibility.control.clear": "effacer",
|
|
9
|
+
"accessibility.control.delete": "supprimer",
|
|
10
|
+
"accessibility.control.list.moveDown": "Descendre",
|
|
11
|
+
"accessibility.control.list.moveUp": "Avancez",
|
|
12
|
+
"accessibility.nav.back": "retour",
|
|
13
|
+
"accessibility.nav.close": "fermer",
|
|
14
|
+
"accessibility.nav.next": "suivant",
|
|
15
|
+
"accessibility.icon.edit": "modifier",
|
|
16
|
+
"accessibility.icon.add": "ajouter",
|
|
17
|
+
"accessibility.icon.filter": "filtre",
|
|
18
|
+
"accessibility.icon.scan": "scanner",
|
|
19
|
+
"accessibility.key.faceId": "faceId",
|
|
20
|
+
"accessibility.key.fingerprint": "Empreinte digitale"
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import de from './de.json';
|
|
2
|
+
import en from './en.json';
|
|
3
|
+
import fr from './fr.json';
|
|
4
|
+
import it from './it.json';
|
|
5
|
+
export const defaultLanguageFiles = {
|
|
6
|
+
en,
|
|
7
|
+
de,
|
|
8
|
+
fr,
|
|
9
|
+
it
|
|
10
|
+
};
|
|
11
|
+
export const getAccessibilityLanguageFile = (language, overrides) => Object.assign({}, defaultLanguageFiles[language], overrides);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["de","en","fr","it","defaultLanguageFiles","getAccessibilityLanguageFile","language","overrides","Object","assign"],"sources":["index.ts"],"sourcesContent":["import de from './de.json';\nimport en from './en.json';\nimport fr from './fr.json';\nimport it from './it.json';\n\nexport const defaultLanguageFiles = { en, de, fr, it };\n\nexport type SupportedAccessibilityLanguage = keyof typeof defaultLanguageFiles;\nexport type AccessibilityLanguageFile = typeof en;\n\nexport const getAccessibilityLanguageFile = (\n language: SupportedAccessibilityLanguage,\n overrides?: Partial<AccessibilityLanguageFile>,\n): AccessibilityLanguageFile =>\n Object.assign<{}, AccessibilityLanguageFile, Partial<AccessibilityLanguageFile> | undefined>(\n {},\n defaultLanguageFiles[language],\n overrides,\n );\n"],"mappings":"AAAA,OAAOA,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAC1B,OAAOC,EAAE,MAAM,WAAW;AAE1B,OAAO,MAAMC,oBAAoB,GAAG;EAAEH,EAAE;EAAED,EAAE;EAAEE,EAAE;EAAEC;AAAG,CAAC;AAKtD,OAAO,MAAME,4BAA4B,GAAGA,CAC1CC,QAAwC,EACxCC,SAA8C,KAE9CC,MAAM,CAACC,MAAM,CACX,CAAC,CAAC,EACFL,oBAAoB,CAACE,QAAQ,CAAC,EAC9BC,SAAS,CACV"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"accessibility.control.combobox.expanded": "Espanso",
|
|
3
|
+
"accessibility.control.combobox.tapToSelect": "Tocca due volte per selezionare",
|
|
4
|
+
"accessibility.control.order": "{current} di {length}",
|
|
5
|
+
"accessibility.control.progress": "{current} su {length}",
|
|
6
|
+
"accessibility.control.checked": "selezionato",
|
|
7
|
+
"accessibility.control.unchecked": "deselezionato",
|
|
8
|
+
"accessibility.control.clear": "cancellare",
|
|
9
|
+
"accessibility.control.delete": "cancellare",
|
|
10
|
+
"accessibility.control.list.moveDown": "Scendere",
|
|
11
|
+
"accessibility.control.list.moveUp": "Salire",
|
|
12
|
+
"accessibility.nav.back": "indietro",
|
|
13
|
+
"accessibility.nav.close": "chiudere",
|
|
14
|
+
"accessibility.nav.next": "prossimo",
|
|
15
|
+
"accessibility.icon.edit": "modificare",
|
|
16
|
+
"accessibility.icon.add": "addizionare",
|
|
17
|
+
"accessibility.icon.scan": "scannerizzare",
|
|
18
|
+
"accessibility.icon.filter": "filtro",
|
|
19
|
+
"accessibility.key.faceId": "faceId",
|
|
20
|
+
"accessibility.key.fingerprint": "Impronta digitale"
|
|
21
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defaultLanguageFiles } from './locale';
|
|
2
|
+
it('language files consistency', () => {
|
|
3
|
+
const mainFile = defaultLanguageFiles.en;
|
|
4
|
+
const getNumberOfEntries = file => Object.keys(file).length;
|
|
5
|
+
Object.keys(defaultLanguageFiles).forEach(lang => {
|
|
6
|
+
const checkedFile = defaultLanguageFiles[lang];
|
|
7
|
+
expect(getNumberOfEntries(checkedFile)).toBe(getNumberOfEntries(mainFile));
|
|
8
|
+
Object.keys(checkedFile).forEach(entryKey => {
|
|
9
|
+
expect(Object.keys(mainFile)).toContain(entryKey);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=locale.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["defaultLanguageFiles","it","mainFile","en","getNumberOfEntries","file","Object","keys","length","forEach","lang","checkedFile","expect","toBe","entryKey","toContain"],"sources":["locale.test.ts"],"sourcesContent":["import { AccessibilityLanguageFile, defaultLanguageFiles, SupportedAccessibilityLanguage } from './locale';\n\nit('language files consistency', () => {\n const mainFile: AccessibilityLanguageFile = defaultLanguageFiles.en;\n const getNumberOfEntries = (file: AccessibilityLanguageFile) => Object.keys(file).length;\n\n Object.keys(defaultLanguageFiles).forEach((lang) => {\n const checkedFile: AccessibilityLanguageFile = defaultLanguageFiles[lang as SupportedAccessibilityLanguage];\n\n expect(getNumberOfEntries(checkedFile)).toBe(getNumberOfEntries(mainFile));\n\n Object.keys(checkedFile).forEach((entryKey) => {\n expect(Object.keys(mainFile)).toContain(entryKey);\n });\n });\n});\n"],"mappings":"AAAA,SAAoCA,oBAAoB,QAAwC,UAAU;AAE1GC,EAAE,CAAC,4BAA4B,EAAE,MAAM;EACrC,MAAMC,QAAmC,GAAGF,oBAAoB,CAACG,EAAE;EACnE,MAAMC,kBAAkB,GAAIC,IAA+B,IAAKC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACG,MAAM;EAExFF,MAAM,CAACC,IAAI,CAACP,oBAAoB,CAAC,CAACS,OAAO,CAAEC,IAAI,IAAK;IAClD,MAAMC,WAAsC,GAAGX,oBAAoB,CAACU,IAAI,CAAmC;IAE3GE,MAAM,CAACR,kBAAkB,CAACO,WAAW,CAAC,CAAC,CAACE,IAAI,CAACT,kBAAkB,CAACF,QAAQ,CAAC,CAAC;IAE1EI,MAAM,CAACC,IAAI,CAACI,WAAW,CAAC,CAACF,OAAO,CAAEK,QAAQ,IAAK;MAC7CF,MAAM,CAACN,MAAM,CAACC,IAAI,CAACL,QAAQ,CAAC,CAAC,CAACa,SAAS,CAACD,QAAQ,CAAC;IACnD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, StyleSheet, View } from 'react-native';
|
|
3
|
+
import { useAppColorScheme } from '../theme';
|
|
4
|
+
const styles = StyleSheet.create({
|
|
5
|
+
background: {
|
|
6
|
+
height: '100%',
|
|
7
|
+
width: '100%'
|
|
8
|
+
},
|
|
9
|
+
contentContainer: {
|
|
10
|
+
borderTopLeftRadius: 20,
|
|
11
|
+
borderTopRightRadius: 20,
|
|
12
|
+
marginTop: 'auto',
|
|
13
|
+
width: '100%'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const ActionModal = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
contentStyle,
|
|
20
|
+
style,
|
|
21
|
+
visible,
|
|
22
|
+
testID
|
|
23
|
+
} = _ref;
|
|
24
|
+
const colorScheme = useAppColorScheme();
|
|
25
|
+
const overlay = 'rgba(0, 0, 0, 0.5)';
|
|
26
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
27
|
+
animationType: "fade",
|
|
28
|
+
statusBarTranslucent: true,
|
|
29
|
+
style: style,
|
|
30
|
+
transparent: true,
|
|
31
|
+
visible: visible
|
|
32
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
33
|
+
testID: testID,
|
|
34
|
+
style: [styles.background, {
|
|
35
|
+
backgroundColor: overlay
|
|
36
|
+
}]
|
|
37
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
38
|
+
style: [styles.contentContainer, {
|
|
39
|
+
backgroundColor: colorScheme.white
|
|
40
|
+
}, contentStyle]
|
|
41
|
+
}, children)));
|
|
42
|
+
};
|
|
43
|
+
export default ActionModal;
|
|
44
|
+
//# sourceMappingURL=ActionModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Modal","StyleSheet","View","useAppColorScheme","styles","create","background","height","width","contentContainer","borderTopLeftRadius","borderTopRightRadius","marginTop","ActionModal","_ref","children","contentStyle","style","visible","testID","colorScheme","overlay","createElement","animationType","statusBarTranslucent","transparent","backgroundColor","white"],"sources":["ActionModal.tsx"],"sourcesContent":["import React, { FunctionComponent, PropsWithChildren } from 'react';\nimport { Modal, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';\n\nimport { useAppColorScheme } from '../theme';\n\ninterface Props {\n contentStyle?: StyleProp<ViewStyle>;\n style?: StyleProp<ViewStyle>;\n visible: boolean;\n testID?: string;\n}\n\nconst styles = StyleSheet.create({\n background: {\n height: '100%',\n width: '100%',\n },\n contentContainer: {\n borderTopLeftRadius: 20,\n borderTopRightRadius: 20,\n marginTop: 'auto',\n width: '100%',\n },\n});\n\nconst ActionModal: FunctionComponent<PropsWithChildren<Props>> = ({\n children,\n contentStyle,\n style,\n visible,\n testID,\n}) => {\n const colorScheme = useAppColorScheme();\n const overlay = 'rgba(0, 0, 0, 0.5)';\n\n return (\n <Modal animationType=\"fade\" statusBarTranslucent style={style} transparent visible={visible}>\n <View testID={testID} style={[styles.background, { backgroundColor: overlay }]}>\n <View style={[styles.contentContainer, { backgroundColor: colorScheme.white }, contentStyle]}>{children}</View>\n </View>\n </Modal>\n );\n};\n\nexport default ActionModal;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAgD,OAAO;AACnE,SAASC,KAAK,EAAaC,UAAU,EAAEC,IAAI,QAAmB,cAAc;AAE5E,SAASC,iBAAiB,QAAQ,UAAU;AAS5C,MAAMC,MAAM,GAAGH,UAAU,CAACI,MAAM,CAAC;EAC/BC,UAAU,EAAE;IACVC,MAAM,EAAE,MAAM;IACdC,KAAK,EAAE;EACT,CAAC;EACDC,gBAAgB,EAAE;IAChBC,mBAAmB,EAAE,EAAE;IACvBC,oBAAoB,EAAE,EAAE;IACxBC,SAAS,EAAE,MAAM;IACjBJ,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,MAAMK,WAAwD,GAAGC,IAAA,IAM3D;EAAA,IAN4D;IAChEC,QAAQ;IACRC,YAAY;IACZC,KAAK;IACLC,OAAO;IACPC;EACF,CAAC,GAAAL,IAAA;EACC,MAAMM,WAAW,GAAGjB,iBAAiB,EAAE;EACvC,MAAMkB,OAAO,GAAG,oBAAoB;EAEpC,oBACEtB,KAAA,CAAAuB,aAAA,CAACtB,KAAK;IAACuB,aAAa,EAAC,MAAM;IAACC,oBAAoB;IAACP,KAAK,EAAEA,KAAM;IAACQ,WAAW;IAACP,OAAO,EAAEA;EAAQ,gBAC1FnB,KAAA,CAAAuB,aAAA,CAACpB,IAAI;IAACiB,MAAM,EAAEA,MAAO;IAACF,KAAK,EAAE,CAACb,MAAM,CAACE,UAAU,EAAE;MAAEoB,eAAe,EAAEL;IAAQ,CAAC;EAAE,gBAC7EtB,KAAA,CAAAuB,aAAA,CAACpB,IAAI;IAACe,KAAK,EAAE,CAACb,MAAM,CAACK,gBAAgB,EAAE;MAAEiB,eAAe,EAAEN,WAAW,CAACO;IAAM,CAAC,EAAEX,YAAY;EAAE,GAAED,QAAQ,CAAQ,CAC1G,CACD;AAEZ,CAAC;AAED,eAAeF,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ActionModal"],"sources":["index.ts"],"sourcesContent":["import ActionModal from './ActionModal';\n\nexport { ActionModal };\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,SAASA,WAAW"}
|