react-native-external-keyboard 0.9.1 → 0.11.1
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/README.md +95 -600
- package/android/build.gradle +0 -18
- package/android/src/main/java/com/externalkeyboard/events/EventHelper.java +10 -13
- package/android/src/main/java/com/externalkeyboard/helper/FocusHelper.java +1 -2
- package/android/src/main/java/com/externalkeyboard/services/FocusMemoryService.java +64 -0
- package/android/src/main/java/com/externalkeyboard/services/KeyboardFocusService.java +41 -0
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardView.java +2 -8
- package/android/src/main/java/com/externalkeyboard/views/ExternalKeyboardView/ExternalKeyboardViewManager.java +20 -13
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapper.java +99 -21
- package/android/src/main/java/com/externalkeyboard/views/TextInputFocusWrapper/TextInputFocusWrapperManager.java +11 -0
- package/android/src/main/java/com/externalkeyboard/views/base/FocusHighlightBase.java +11 -5
- package/android/src/main/java/com/externalkeyboard/views/base/FocusableBase.java +54 -0
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusChangeBase.java +2 -3
- package/android/src/main/java/com/externalkeyboard/views/base/keyboard/ViewFocusRequestBase.java +10 -61
- package/android/src/newarch/ExternalKeyboardLockViewManagerInterface.java +11 -0
- package/android/src/newarch/ExternalKeyboardLockViewManagerSpec.java +0 -1
- package/android/src/newarch/ExternalKeyboardViewManagerInterface.java +42 -0
- package/android/src/newarch/ExternalKeyboardViewManagerSpec.java +0 -1
- package/android/src/newarch/KeyboardFocusGroupManagerInterface.java +12 -0
- package/android/src/newarch/KeyboardFocusGroupManagerSpec.java +0 -1
- package/android/src/newarch/TextInputFocusWrapperManagerInterface.java +34 -0
- package/android/src/newarch/TextInputFocusWrapperManagerSpec.java +0 -7
- package/android/src/newarch/helper/ReactNativeEventDispatcher.java +28 -0
- package/android/src/oldarch/ExternalKeyboardViewManagerSpec.java +6 -4
- package/android/src/oldarch/TextInputFocusWrapperManagerSpec.java +4 -0
- package/android/src/oldarch/helper/ReactNativeEventDispatcher.java +15 -0
- package/ios/Delegates/RNCEKVFocusDelegate/RNCEKVFocusDelegate.mm +1 -1
- package/ios/Delegates/RNCEKVFocusDelegate/RNCEKVFocusProtocol.h +1 -1
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.h +2 -1
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloDelegate.mm +41 -5
- package/ios/Delegates/RNCEKVHaloDelegate/RNCEKVHaloProtocol.h +1 -0
- package/ios/Extensions/RCTCustomScrollView+RNCEKVExternalKeyboard.mm +5 -6
- package/ios/Extensions/RCTEnhancedScrollView+RNCEKVExternalKeyboard.mm +8 -9
- package/ios/Extensions/RCTTextInputComponentView+RNCEKVExternalKeyboard.mm +1 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.h +0 -1
- package/ios/Extensions/RCTViewComponentView+RNCEKVExternalKeyboard.mm +16 -4
- package/ios/Extensions/UIViewController+RNCEKVExternalKeyboard.mm +7 -10
- package/ios/Helpers/RNCEKVNativeProps/RNCEKVNativeProps.h +4 -4
- package/ios/Helpers/RNCEKVSwizzleInstanceMethod/RNCEKVSwizzleInstanceMethod.h +19 -0
- package/ios/Protocols/RNCEKVCustomFocusEffectProtocol.h +1 -1
- package/ios/Services/RNCEKVFocusMemoryService.h +39 -0
- package/ios/Services/RNCEKVFocusMemoryService.mm +42 -0
- package/ios/Services/RNCEKVKeyboardFocusService.h +28 -0
- package/ios/Services/RNCEKVKeyboardFocusService.mm +54 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.h +2 -0
- package/ios/Views/Base/FocusChange/RNCEKVViewFocusChangeBase.mm +12 -10
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.h +1 -1
- package/ios/Views/Base/FocusRequest/RNCEKVViewFocusRequestBase.mm +6 -17
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.h +1 -0
- package/ios/Views/Base/KeyboardHallo/RNCEKVExternalKeyboardHalloBase.mm +146 -6
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.h +2 -0
- package/ios/Views/Base/ViewGroup/RNCEKVViewGroupBase.mm +4 -0
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.h +1 -1
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardView.mm +8 -4
- package/ios/Views/RNCEKVExternalKeyboardView/RNCEKVExternalKeyboardViewManager.mm +22 -11
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapper.mm +17 -0
- package/ios/Views/RNCEKVTextInputFocusWrapper/RNCEKVTextInputFocusWrapperManager.mm +12 -0
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js +67 -65
- package/lib/commonjs/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js +49 -97
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/commonjs/components/{KeyboardExtendedInput/KeyboardExtendedInput.types.js → KeyboardFocusGroup/KeyboardFocusGroup.types.js} +1 -1
- package/lib/commonjs/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js.map +1 -0
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +2 -1
- package/lib/commonjs/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js +14 -51
- package/lib/commonjs/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/commonjs/components/index.js +47 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/index.js +37 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeSpec/ExternalKeyboardViewNativeComponent.ts +6 -4
- package/lib/commonjs/nativeSpec/TextInputFocusWrapperNativeComponent.ts +2 -0
- package/lib/commonjs/types/KeyboardFocusLock.types.js +13 -0
- package/lib/commonjs/types/KeyboardFocusLock.types.js.map +1 -1
- package/lib/commonjs/types/baseKeyboardView.types.js +6 -0
- package/lib/commonjs/types/baseKeyboardView.types.js.map +1 -0
- package/lib/commonjs/types/{FocusStyle.js → focus.types.js} +1 -1
- package/lib/commonjs/types/{FocusStyle.js.map → focus.types.js.map} +1 -1
- package/lib/commonjs/types/focusOrder.types.js +33 -0
- package/lib/commonjs/types/focusOrder.types.js.map +1 -0
- package/lib/commonjs/types/{WithKeyboardFocus.js → focusStyle.types.js} +1 -1
- package/lib/commonjs/types/{WithKeyboardFocus.js.map → focusStyle.types.js.map} +1 -1
- package/lib/commonjs/types/index.js +18 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/types/keyPress.types.js +6 -0
- package/lib/{module/types/WithKeyboardFocus.js.map → commonjs/types/keyPress.types.js.map} +1 -1
- package/lib/commonjs/types/keyboardInput.types.js +6 -0
- package/lib/commonjs/types/keyboardInput.types.js.map +1 -0
- package/lib/commonjs/types/withKeyboardFocus.types.js +6 -0
- package/lib/commonjs/types/withKeyboardFocus.types.js.map +1 -0
- package/lib/commonjs/utils/mapLockFocus.js +37 -0
- package/lib/commonjs/utils/mapLockFocus.js.map +1 -0
- package/lib/commonjs/utils/useFocusStyle.js +4 -21
- package/lib/commonjs/utils/useFocusStyle.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardFocusContainer.js +79 -0
- package/lib/commonjs/utils/useKeyboardFocusContainer.js.map +1 -0
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.android.js +4 -7
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.android.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.ios.js +3 -6
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.ios.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.js +9 -7
- package/lib/commonjs/utils/useKeyboardPress/useKeyboardPress.js.map +1 -1
- package/lib/commonjs/utils/useKeyboardPressState.js +65 -0
- package/lib/commonjs/utils/useKeyboardPressState.js.map +1 -0
- package/lib/commonjs/utils/useOnFocusChange.js +1 -1
- package/lib/commonjs/utils/useOnFocusChange.js.map +1 -1
- package/lib/commonjs/utils/useOrderValidation.js +35 -0
- package/lib/commonjs/utils/useOrderValidation.js.map +1 -0
- package/lib/commonjs/utils/useRenderedChildren.js +34 -0
- package/lib/commonjs/utils/useRenderedChildren.js.map +1 -0
- package/lib/commonjs/utils/useWrappedOrderProps.js +35 -0
- package/lib/commonjs/utils/useWrappedOrderProps.js.map +1 -0
- package/lib/commonjs/utils/withKeyboardFocus.js +81 -96
- package/lib/commonjs/utils/withKeyboardFocus.js.map +1 -1
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js +57 -55
- package/lib/module/components/BaseKeyboardView/BaseKeyboardView.js.map +1 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js +51 -99
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.js.map +1 -1
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js +4 -0
- package/lib/module/components/KeyboardFocusGroup/KeyboardFocusGroup.types.js.map +1 -0
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js +2 -1
- package/lib/module/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js +2 -1
- package/lib/module/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.js.map +1 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js +2 -1
- package/lib/module/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.js.map +1 -1
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js +16 -53
- package/lib/module/components/KeyboardFocusView/KeyboardFocusView.js.map +1 -1
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/index.js +20 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeSpec/ExternalKeyboardViewNativeComponent.ts +6 -4
- package/lib/module/nativeSpec/TextInputFocusWrapperNativeComponent.ts +2 -0
- package/lib/module/types/KeyboardFocusLock.types.js +12 -1
- package/lib/module/types/KeyboardFocusLock.types.js.map +1 -1
- package/lib/module/types/baseKeyboardView.types.js +4 -0
- package/lib/module/types/baseKeyboardView.types.js.map +1 -0
- package/lib/module/types/focus.types.js +4 -0
- package/lib/module/types/{FocusStyle.js.map → focus.types.js.map} +1 -1
- package/lib/module/types/focusOrder.types.js +31 -0
- package/lib/module/types/focusOrder.types.js.map +1 -0
- package/lib/module/types/focusStyle.types.js +4 -0
- package/lib/module/types/focusStyle.types.js.map +1 -0
- package/lib/module/types/index.js +3 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/types/keyPress.types.js +4 -0
- package/lib/module/types/keyPress.types.js.map +1 -0
- package/lib/module/types/keyboardInput.types.js +4 -0
- package/lib/module/types/keyboardInput.types.js.map +1 -0
- package/lib/module/types/withKeyboardFocus.types.js +4 -0
- package/lib/module/types/withKeyboardFocus.types.js.map +1 -0
- package/lib/module/utils/mapLockFocus.js +32 -0
- package/lib/module/utils/mapLockFocus.js.map +1 -0
- package/lib/module/utils/useFocusStyle.js +4 -21
- package/lib/module/utils/useFocusStyle.js.map +1 -1
- package/lib/module/utils/useKeyboardFocusContainer.js +74 -0
- package/lib/module/utils/useKeyboardFocusContainer.js.map +1 -0
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.android.js +4 -7
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.android.js.map +1 -1
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.ios.js +3 -6
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.ios.js.map +1 -1
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.js +9 -7
- package/lib/module/utils/useKeyboardPress/useKeyboardPress.js.map +1 -1
- package/lib/module/utils/useKeyboardPressState.js +60 -0
- package/lib/module/utils/useKeyboardPressState.js.map +1 -0
- package/lib/module/utils/useOnFocusChange.js +1 -1
- package/lib/module/utils/useOnFocusChange.js.map +1 -1
- package/lib/module/utils/useOrderValidation.js +30 -0
- package/lib/module/utils/useOrderValidation.js.map +1 -0
- package/lib/module/utils/useRenderedChildren.js +29 -0
- package/lib/module/utils/useRenderedChildren.js.map +1 -0
- package/lib/module/utils/useWrappedOrderProps.js +30 -0
- package/lib/module/utils/useWrappedOrderProps.js.map +1 -0
- package/lib/module/utils/withKeyboardFocus.js +84 -99
- package/lib/module/utils/withKeyboardFocus.js.map +1 -1
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts +19 -125
- package/lib/typescript/src/components/BaseKeyboardView/BaseKeyboardView.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts +13 -204
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts +4 -146
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts +2 -12
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts +4 -146
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.d.ts +13 -0
- package/lib/typescript/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.d.ts.map +1 -0
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts +2 -2
- package/lib/typescript/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts +1 -1
- package/lib/typescript/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.d.ts.map +1 -1
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts +20 -133
- package/lib/typescript/src/components/KeyboardFocusView/KeyboardFocusView.d.ts.map +1 -1
- package/lib/typescript/src/components/Touchable/Pressable.d.ts +3 -160
- package/lib/typescript/src/components/Touchable/Pressable.d.ts.map +1 -1
- package/lib/typescript/src/components/index.d.ts +5 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -1
- package/lib/typescript/src/context/OrderFocusContext.d.ts +1 -1
- package/lib/typescript/src/context/OrderFocusContext.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +48 -10
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts +1 -3
- package/lib/typescript/src/nativeSpec/ExternalKeyboardLockViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts +5 -6
- package/lib/typescript/src/nativeSpec/ExternalKeyboardViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts +1 -3
- package/lib/typescript/src/nativeSpec/KeyboardFocusGroupNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpec/NativeExternalKeyboardModule.d.ts +1 -1
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts +3 -3
- package/lib/typescript/src/nativeSpec/TextInputFocusWrapperNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts +15 -1
- package/lib/typescript/src/types/KeyboardFocusLock.types.d.ts.map +1 -1
- package/lib/typescript/src/types/KeyboardFocusView.types.d.ts +16 -14
- package/lib/typescript/src/types/KeyboardFocusView.types.d.ts.map +1 -1
- package/lib/typescript/src/types/baseKeyboardView.types.d.ts +119 -0
- package/lib/typescript/src/types/baseKeyboardView.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focus.types.d.ts +44 -0
- package/lib/typescript/src/types/focus.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focusOrder.types.d.ts +57 -0
- package/lib/typescript/src/types/focusOrder.types.d.ts.map +1 -0
- package/lib/typescript/src/types/focusStyle.types.d.ts +11 -0
- package/lib/typescript/src/types/focusStyle.types.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +11 -2
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/types/keyPress.types.d.ts +7 -0
- package/lib/typescript/src/types/keyPress.types.d.ts.map +1 -0
- package/lib/typescript/src/types/keyboardInput.types.d.ts +53 -0
- package/lib/typescript/src/types/keyboardInput.types.d.ts.map +1 -0
- package/lib/typescript/src/types/withKeyboardFocus.types.d.ts +109 -0
- package/lib/typescript/src/types/withKeyboardFocus.types.d.ts.map +1 -0
- package/lib/typescript/src/utils/mapLockFocus.d.ts +3 -0
- package/lib/typescript/src/utils/mapLockFocus.d.ts.map +1 -0
- package/lib/typescript/src/utils/useFocusStyle.d.ts +7 -1017
- package/lib/typescript/src/utils/useFocusStyle.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts +34 -0
- package/lib/typescript/src/utils/useKeyboardFocusContainer.d.ts.map +1 -0
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.android.d.ts +2 -2
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.android.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.d.ts +4 -3
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.ios.d.ts +3 -3
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.ios.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.types.d.ts +1 -2
- package/lib/typescript/src/utils/useKeyboardPress/useKeyboardPress.types.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardPressState.d.ts +29 -0
- package/lib/typescript/src/utils/useKeyboardPressState.d.ts.map +1 -0
- package/lib/typescript/src/utils/useOnFocusChange.d.ts +3 -3
- package/lib/typescript/src/utils/useOnFocusChange.d.ts.map +1 -1
- package/lib/typescript/src/utils/useOrderValidation.d.ts +8 -0
- package/lib/typescript/src/utils/useOrderValidation.d.ts.map +1 -0
- package/lib/typescript/src/utils/useRenderedChildren.d.ts +18 -0
- package/lib/typescript/src/utils/useRenderedChildren.d.ts.map +1 -0
- package/lib/typescript/src/utils/useWrappedOrderProps.d.ts +13 -0
- package/lib/typescript/src/utils/useWrappedOrderProps.d.ts.map +1 -0
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts +3 -8
- package/lib/typescript/src/utils/withKeyboardFocus.d.ts.map +1 -1
- package/package.json +10 -5
- package/src/components/BaseKeyboardView/BaseKeyboardView.tsx +74 -94
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.tsx +49 -149
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.android.tsx +23 -32
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.ios.tsx +32 -41
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.tsx +3 -14
- package/src/components/KeyboardFocusGroup/KeyboardFocusGroup.types.ts +15 -0
- package/src/components/KeyboardFocusLock/FocusFrame/FocusFrame.android.tsx +2 -2
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.android.tsx +2 -2
- package/src/components/KeyboardFocusLock/FocusTrap/FocusTrap.tsx +1 -1
- package/src/components/KeyboardFocusLock/KeyboardFocusLockBase/KeyboardFocusLockBase.tsx +2 -2
- package/src/components/KeyboardFocusView/KeyboardFocusView.tsx +29 -68
- package/src/components/Touchable/Pressable.tsx +2 -2
- package/src/components/index.ts +12 -0
- package/src/index.tsx +44 -32
- package/src/nativeSpec/ExternalKeyboardViewNativeComponent.ts +6 -4
- package/src/nativeSpec/TextInputFocusWrapperNativeComponent.ts +2 -0
- package/src/types/KeyboardFocusLock.types.ts +16 -1
- package/src/types/KeyboardFocusView.types.ts +17 -18
- package/src/types/baseKeyboardView.types.ts +122 -0
- package/src/types/focus.types.ts +49 -0
- package/src/types/focusOrder.types.ts +59 -0
- package/src/types/{FocusStyle.ts → focusStyle.types.ts} +5 -0
- package/src/types/index.ts +32 -2
- package/src/types/keyPress.types.ts +8 -0
- package/src/types/keyboardInput.types.ts +81 -0
- package/src/types/withKeyboardFocus.types.ts +178 -0
- package/src/utils/mapLockFocus.ts +31 -0
- package/src/utils/useFocusStyle.tsx +13 -41
- package/src/utils/useKeyboardFocusContainer.ts +102 -0
- package/src/utils/useKeyboardPress/useKeyboardPress.android.ts +4 -7
- package/src/utils/useKeyboardPress/useKeyboardPress.ios.ts +3 -6
- package/src/utils/useKeyboardPress/useKeyboardPress.ts +9 -7
- package/src/utils/useKeyboardPress/useKeyboardPress.types.ts +1 -2
- package/src/utils/useKeyboardPressState.ts +81 -0
- package/src/utils/useOnFocusChange.ts +4 -7
- package/src/utils/useOrderValidation.ts +74 -0
- package/src/utils/useRenderedChildren.ts +42 -0
- package/src/utils/useWrappedOrderProps.ts +48 -0
- package/src/utils/withKeyboardFocus.tsx +105 -125
- package/lib/commonjs/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js +0 -13
- package/lib/commonjs/components/KeyboardFocusView/hooks/index.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js +0 -13
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +0 -33
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +0 -1
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js +0 -39
- package/lib/commonjs/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js.map +0 -1
- package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js +0 -23
- package/lib/commonjs/components/RenderPropComponent/RenderPropComponent.js.map +0 -1
- package/lib/commonjs/types/BaseKeyboardView.js +0 -18
- package/lib/commonjs/types/BaseKeyboardView.js.map +0 -1
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js +0 -4
- package/lib/module/components/KeyboardExtendedInput/KeyboardExtendedInput.types.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/index.js +0 -4
- package/lib/module/components/KeyboardFocusView/hooks/index.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js +0 -4
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/index.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js +0 -28
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.js.map +0 -1
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js +0 -34
- package/lib/module/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.js.map +0 -1
- package/lib/module/components/RenderPropComponent/RenderPropComponent.js +0 -17
- package/lib/module/components/RenderPropComponent/RenderPropComponent.js.map +0 -1
- package/lib/module/types/BaseKeyboardView.js +0 -14
- package/lib/module/types/BaseKeyboardView.js.map +0 -1
- package/lib/module/types/FocusStyle.js +0 -4
- package/lib/module/types/WithKeyboardFocus.js +0 -4
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts +0 -45
- package/lib/typescript/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/index.d.ts +0 -2
- package/lib/typescript/src/components/KeyboardFocusView/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts +0 -2
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/index.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts +0 -175
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.d.ts.map +0 -1
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.d.ts +0 -181
- package/lib/typescript/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.d.ts.map +0 -1
- package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts +0 -6
- package/lib/typescript/src/components/RenderPropComponent/RenderPropComponent.d.ts.map +0 -1
- package/lib/typescript/src/types/BaseKeyboardView.d.ts +0 -70
- package/lib/typescript/src/types/BaseKeyboardView.d.ts.map +0 -1
- package/lib/typescript/src/types/FocusStyle.d.ts +0 -6
- package/lib/typescript/src/types/FocusStyle.d.ts.map +0 -1
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts +0 -47
- package/lib/typescript/src/types/WithKeyboardFocus.d.ts.map +0 -1
- package/src/components/KeyboardExtendedInput/KeyboardExtendedInput.types.ts +0 -73
- package/src/components/KeyboardFocusView/hooks/index.ts +0 -1
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/index.ts +0 -1
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useFocusStyle.ts +0 -34
- package/src/components/KeyboardFocusView/hooks/useFocusStyle/useTintStyle.ts +0 -41
- package/src/components/RenderPropComponent/RenderPropComponent.tsx +0 -18
- package/src/types/BaseKeyboardView.ts +0 -74
- package/src/types/WithKeyboardFocus.ts +0 -115
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useRenderedChildren = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the `children` override for the wrapped component.
|
|
10
|
+
* - `renderContent` stays a function so the component can call it with its own state + `focused`
|
|
11
|
+
* (keyboard activation forces `pressed` when `keyboardPressed` is set)
|
|
12
|
+
* - `renderFocusable` is evaluated immediately and returned as a static node
|
|
13
|
+
* Returns `undefined` when neither prop is provided.
|
|
14
|
+
*/
|
|
15
|
+
const useRenderedChildren = ({
|
|
16
|
+
focused,
|
|
17
|
+
keyboardPressed = false,
|
|
18
|
+
renderContent,
|
|
19
|
+
renderFocusable
|
|
20
|
+
}) => {
|
|
21
|
+
const contentChildren = (0, _react.useMemo)(() => renderContent ? state => renderContent({
|
|
22
|
+
...state,
|
|
23
|
+
...(keyboardPressed ? {
|
|
24
|
+
pressed: true
|
|
25
|
+
} : null),
|
|
26
|
+
focused
|
|
27
|
+
}) : undefined, [renderContent, focused, keyboardPressed]);
|
|
28
|
+
const focusableChildren = (0, _react.useMemo)(() => renderFocusable?.({
|
|
29
|
+
focused
|
|
30
|
+
}), [renderFocusable, focused]);
|
|
31
|
+
return contentChildren ?? focusableChildren;
|
|
32
|
+
};
|
|
33
|
+
exports.useRenderedChildren = useRenderedChildren;
|
|
34
|
+
//# sourceMappingURL=useRenderedChildren.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","useRenderedChildren","focused","keyboardPressed","renderContent","renderFocusable","contentChildren","useMemo","state","pressed","undefined","focusableChildren","exports"],"sourceRoot":"../../../src","sources":["utils/useRenderedChildren.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,mBAAmB,GAAGA,CAAC;EAClCC,OAAO;EACPC,eAAe,GAAG,KAAK;EACvBC,aAAa;EACbC;AACwB,CAAC,KAAK;EAC9B,MAAMC,eAAe,GAAG,IAAAC,cAAO,EAC7B,MACEH,aAAa,GACRI,KAA8B,IAC7BJ,aAAa,CAAC;IACZ,GAAGI,KAAK;IACR,IAAIL,eAAe,GAAG;MAAEM,OAAO,EAAE;IAAK,CAAC,GAAG,IAAI,CAAC;IAC/CP;EACF,CAAC,CAAC,GACJQ,SAAS,EACf,CAACN,aAAa,EAAEF,OAAO,EAAEC,eAAe,CAC1C,CAAC;EAED,MAAMQ,iBAAiB,GAAG,IAAAJ,cAAO,EAC/B,MAAMF,eAAe,GAAG;IAAEH;EAAQ,CAAC,CAAC,EACpC,CAACG,eAAe,EAAEH,OAAO,CAC3B,CAAC;EAED,OAAOI,eAAe,IAAIK,iBAAiB;AAC7C,CAAC;AAACC,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useWrappedOrderProps = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _wrapOrderPrefix = require("./wrapOrderPrefix");
|
|
9
|
+
const useWrappedOrderProps = ({
|
|
10
|
+
orderPrefix = '',
|
|
11
|
+
orderId,
|
|
12
|
+
orderForward,
|
|
13
|
+
orderBackward,
|
|
14
|
+
orderFirst,
|
|
15
|
+
orderLast,
|
|
16
|
+
orderLeft,
|
|
17
|
+
orderRight,
|
|
18
|
+
orderUp,
|
|
19
|
+
orderDown
|
|
20
|
+
}) => {
|
|
21
|
+
const wrapPrefix = (0, _react.useMemo)(() => (0, _wrapOrderPrefix.wrapOrderPrefix)(orderPrefix), [orderPrefix]);
|
|
22
|
+
return (0, _react.useMemo)(() => ({
|
|
23
|
+
orderId: wrapPrefix(orderId),
|
|
24
|
+
orderForward: wrapPrefix(orderForward),
|
|
25
|
+
orderBackward: wrapPrefix(orderBackward),
|
|
26
|
+
orderLeft: wrapPrefix(orderLeft),
|
|
27
|
+
orderRight: wrapPrefix(orderRight),
|
|
28
|
+
orderUp: wrapPrefix(orderUp),
|
|
29
|
+
orderDown: wrapPrefix(orderDown),
|
|
30
|
+
orderFirst: wrapPrefix(orderFirst === null ? undefined : orderFirst ?? orderForward),
|
|
31
|
+
orderLast: wrapPrefix(orderLast === null ? undefined : orderLast ?? orderBackward)
|
|
32
|
+
}), [wrapPrefix, orderId, orderForward, orderBackward, orderFirst, orderLast, orderLeft, orderRight, orderUp, orderDown]);
|
|
33
|
+
};
|
|
34
|
+
exports.useWrappedOrderProps = useWrappedOrderProps;
|
|
35
|
+
//# sourceMappingURL=useWrappedOrderProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_wrapOrderPrefix","useWrappedOrderProps","orderPrefix","orderId","orderForward","orderBackward","orderFirst","orderLast","orderLeft","orderRight","orderUp","orderDown","wrapPrefix","useMemo","wrapOrderPrefix","undefined","exports"],"sourceRoot":"../../../src","sources":["utils/useWrappedOrderProps.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AAEO,MAAME,oBAAoB,GAAGA,CAAC;EACnCC,WAAW,GAAG,EAAE;EAChBC,OAAO;EACPC,YAAY;EACZC,aAAa;EACbC,UAAU;EACVC,SAAS;EACTC,SAAS;EACTC,UAAU;EACVC,OAAO;EACPC;AACe,CAAC,KAAK;EACrB,MAAMC,UAAU,GAAG,IAAAC,cAAO,EAAC,MAAM,IAAAC,gCAAe,EAACZ,WAAW,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAE7E,OAAO,IAAAW,cAAO,EACZ,OAAO;IACLV,OAAO,EAAES,UAAU,CAACT,OAAO,CAAC;IAC5BC,YAAY,EAAEQ,UAAU,CAACR,YAAY,CAAC;IACtCC,aAAa,EAAEO,UAAU,CAACP,aAAa,CAAC;IACxCG,SAAS,EAAEI,UAAU,CAACJ,SAAS,CAAC;IAChCC,UAAU,EAAEG,UAAU,CAACH,UAAU,CAAC;IAClCC,OAAO,EAAEE,UAAU,CAACF,OAAO,CAAC;IAC5BC,SAAS,EAAEC,UAAU,CAACD,SAAS,CAAC;IAChCL,UAAU,EAAEM,UAAU,CACpBN,UAAU,KAAK,IAAI,GAAGS,SAAS,GAAGT,UAAU,IAAIF,YAClD,CAAC;IACDG,SAAS,EAAEK,UAAU,CACnBL,SAAS,KAAK,IAAI,GAAGQ,SAAS,GAAGR,SAAS,IAAIF,aAChD;EACF,CAAC,CAAC,EACF,CACEO,UAAU,EACVT,OAAO,EACPC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,SAAS,EACTC,UAAU,EACVC,OAAO,EACPC,SAAS,CAEb,CAAC;AACH,CAAC;AAACK,OAAA,CAAAf,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -7,49 +7,47 @@ exports.withKeyboardFocus = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _components = require("../components");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var _useKeyboardPress = require("./useKeyboardPress/useKeyboardPress");
|
|
10
|
+
var _useKeyboardFocusContainer = require("./useKeyboardFocusContainer");
|
|
11
|
+
var _useRenderedChildren = require("./useRenderedChildren");
|
|
13
12
|
var _IsViewFocusedContext = require("../context/IsViewFocusedContext");
|
|
14
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
15
|
const withKeyboardFocus = Component => {
|
|
17
16
|
const WithKeyboardFocus = /*#__PURE__*/_react.default.memo(/*#__PURE__*/_react.default.forwardRef((allProps, ref) => {
|
|
18
17
|
const {
|
|
19
|
-
|
|
20
|
-
autoFocus,
|
|
18
|
+
// Style
|
|
21
19
|
focusStyle,
|
|
22
20
|
style,
|
|
23
21
|
containerStyle,
|
|
24
|
-
|
|
22
|
+
containerFocusStyle,
|
|
23
|
+
withPressedStyle = false,
|
|
24
|
+
// Press handlers
|
|
25
25
|
onPress,
|
|
26
26
|
onLongPress,
|
|
27
27
|
onKeyUpPress,
|
|
28
28
|
onKeyDownPress,
|
|
29
29
|
onPressIn,
|
|
30
30
|
onPressOut,
|
|
31
|
-
|
|
31
|
+
triggerCodes,
|
|
32
|
+
// Focus config
|
|
33
|
+
autoFocus,
|
|
34
|
+
focusableWrapper = true,
|
|
32
35
|
haloEffect = true,
|
|
33
|
-
canBeFocused = true,
|
|
34
36
|
focusable = true,
|
|
35
37
|
tintColor,
|
|
36
38
|
onFocus,
|
|
37
39
|
onBlur,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
viewRef,
|
|
41
|
-
componentRef,
|
|
40
|
+
onFocusChange,
|
|
41
|
+
groupIdentifier,
|
|
42
42
|
haloCornerRadius,
|
|
43
43
|
haloExpendX,
|
|
44
44
|
haloExpendY,
|
|
45
|
-
groupIdentifier,
|
|
46
|
-
withPressedStyle = false,
|
|
47
|
-
triggerCodes,
|
|
48
|
-
exposeMethods,
|
|
49
|
-
enableA11yFocus,
|
|
50
45
|
screenAutoA11yFocus,
|
|
51
|
-
screenAutoA11yFocusDelay
|
|
52
|
-
|
|
46
|
+
screenAutoA11yFocusDelay,
|
|
47
|
+
lockFocus,
|
|
48
|
+
defaultFocusHighlightEnabled,
|
|
49
|
+
androidKeyboardPressState,
|
|
50
|
+
// Order
|
|
53
51
|
orderIndex,
|
|
54
52
|
orderGroup,
|
|
55
53
|
orderId,
|
|
@@ -61,36 +59,37 @@ const withKeyboardFocus = Component => {
|
|
|
61
59
|
orderBackward,
|
|
62
60
|
orderFirst,
|
|
63
61
|
orderLast,
|
|
64
|
-
|
|
62
|
+
// Refs & render
|
|
63
|
+
componentRef,
|
|
65
64
|
onComponentFocus,
|
|
66
65
|
onComponentBlur,
|
|
67
66
|
renderContent,
|
|
68
67
|
renderFocusable,
|
|
69
|
-
|
|
68
|
+
roundedHaloFix,
|
|
69
|
+
tintType,
|
|
70
|
+
// Deprecated no-ops: discard so they never reach the wrapped component.
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72
|
+
enableA11yFocus: _enableA11yFocus,
|
|
73
|
+
children: userChildren,
|
|
70
74
|
...props
|
|
71
75
|
} = allProps;
|
|
72
76
|
const {
|
|
73
77
|
focused,
|
|
78
|
+
keyboardPressed,
|
|
74
79
|
containerFocusedStyle,
|
|
75
80
|
componentStyleViewStyle,
|
|
76
81
|
onFocusChangeHandler,
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
onKeyUpPressHandler,
|
|
83
|
+
onKeyDownPressHandler,
|
|
84
|
+
onPressHandler,
|
|
85
|
+
onContextMenuHandler,
|
|
86
|
+
enableContextMenu
|
|
87
|
+
} = (0, _useKeyboardFocusContainer.useKeyboardFocusContainer)({
|
|
79
88
|
onFocusChange,
|
|
80
|
-
tintColor,
|
|
81
89
|
focusStyle,
|
|
82
90
|
containerFocusStyle,
|
|
83
|
-
tintType,
|
|
84
91
|
style,
|
|
85
|
-
withPressedStyle,
|
|
86
|
-
Component
|
|
87
|
-
});
|
|
88
|
-
const withHaloEffect = tintType === 'default' && haloEffect;
|
|
89
|
-
const {
|
|
90
|
-
onKeyUpPressHandler,
|
|
91
|
-
onKeyDownPressHandler,
|
|
92
|
-
onPressHandler
|
|
93
|
-
} = (0, _useKeyboardPress.useKeyboardPress)({
|
|
92
|
+
pressedStyleSignature: withPressedStyle || Component === _reactNative.Pressable,
|
|
94
93
|
onKeyUpPress,
|
|
95
94
|
onKeyDownPress,
|
|
96
95
|
onPress: onPress,
|
|
@@ -98,71 +97,68 @@ const withKeyboardFocus = Component => {
|
|
|
98
97
|
onPressIn: onPressIn,
|
|
99
98
|
onPressOut: onPressOut,
|
|
100
99
|
triggerCodes,
|
|
101
|
-
|
|
100
|
+
androidKeyboardPressState
|
|
102
101
|
});
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
const renderedChildren = (0, _useRenderedChildren.useRenderedChildren)({
|
|
103
|
+
focused,
|
|
104
|
+
keyboardPressed,
|
|
105
|
+
renderContent: renderContent,
|
|
106
|
+
renderFocusable
|
|
107
|
+
});
|
|
108
|
+
// `renderContent`/`renderFocusable` are handled above; for a plain
|
|
109
|
+
// children render prop, fold the keyboard press into its `pressed` too so
|
|
110
|
+
// it stays consistent. A no-op unless `keyboardPressed` is active.
|
|
111
|
+
const childContent = (0, _react.useMemo)(() => {
|
|
112
|
+
if (renderedChildren !== undefined) return renderedChildren;
|
|
113
|
+
if (keyboardPressed && typeof userChildren === 'function') {
|
|
114
|
+
const childrenFn = userChildren;
|
|
115
|
+
return state => childrenFn({
|
|
116
|
+
...state,
|
|
117
|
+
pressed: true
|
|
115
118
|
});
|
|
116
119
|
}
|
|
117
|
-
return
|
|
118
|
-
}, [
|
|
119
|
-
const
|
|
120
|
-
orderIndex,
|
|
121
|
-
orderGroup,
|
|
122
|
-
orderId,
|
|
123
|
-
orderLeft,
|
|
124
|
-
orderRight,
|
|
125
|
-
orderUp,
|
|
126
|
-
orderDown,
|
|
127
|
-
orderForward,
|
|
128
|
-
orderBackward,
|
|
129
|
-
orderFirst,
|
|
130
|
-
orderLast
|
|
131
|
-
};
|
|
132
|
-
const onContextMenuHandler = (0, _react.useCallback)(() => {
|
|
133
|
-
onLongPress?.();
|
|
134
|
-
}, [onLongPress]);
|
|
120
|
+
return userChildren;
|
|
121
|
+
}, [renderedChildren, userChildren, keyboardPressed]);
|
|
122
|
+
const containerStyleArr = (0, _react.useMemo)(() => [containerStyle, containerFocusedStyle], [containerStyle, containerFocusedStyle]);
|
|
135
123
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IsViewFocusedContext.IsViewFocusedContext.Provider, {
|
|
136
124
|
value: focused,
|
|
137
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
138
|
-
style:
|
|
125
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.BaseKeyboardView, {
|
|
126
|
+
style: containerStyleArr,
|
|
139
127
|
defaultFocusHighlightEnabled: defaultFocusHighlightEnabled,
|
|
140
128
|
ref: ref,
|
|
141
|
-
viewRef: viewRef,
|
|
142
129
|
onKeyUpPress: onKeyUpPressHandler,
|
|
143
130
|
onKeyDownPress: onKeyDownPressHandler,
|
|
144
|
-
onFocus: onFocus,
|
|
145
|
-
onBlur: onBlur,
|
|
131
|
+
onFocus: onFocus ?? undefined,
|
|
132
|
+
onBlur: onBlur ?? undefined,
|
|
146
133
|
onFocusChange: onFocusChangeHandler,
|
|
147
134
|
onContextMenuPress: onContextMenuHandler,
|
|
148
|
-
enableContextMenu:
|
|
149
|
-
haloEffect:
|
|
135
|
+
enableContextMenu: enableContextMenu,
|
|
136
|
+
haloEffect: haloEffect,
|
|
137
|
+
tintType: tintType,
|
|
150
138
|
haloCornerRadius: haloCornerRadius,
|
|
151
139
|
haloExpendX: haloExpendX,
|
|
152
140
|
haloExpendY: haloExpendY,
|
|
153
141
|
autoFocus: autoFocus,
|
|
154
|
-
canBeFocused: canBeFocused,
|
|
155
142
|
focusable: focusable,
|
|
156
143
|
tintColor: tintColor,
|
|
157
|
-
|
|
144
|
+
focusableWrapper: focusableWrapper,
|
|
158
145
|
groupIdentifier: groupIdentifier,
|
|
159
|
-
exposeMethods: exposeMethods,
|
|
160
|
-
enableA11yFocus: enableA11yFocus,
|
|
161
146
|
screenAutoA11yFocus: screenAutoA11yFocus,
|
|
162
147
|
screenAutoA11yFocusDelay: screenAutoA11yFocusDelay,
|
|
163
148
|
lockFocus: lockFocus,
|
|
164
|
-
|
|
165
|
-
|
|
149
|
+
roundedHaloFix: roundedHaloFix,
|
|
150
|
+
orderIndex: orderIndex,
|
|
151
|
+
orderGroup: orderGroup,
|
|
152
|
+
orderId: orderId,
|
|
153
|
+
orderLeft: orderLeft,
|
|
154
|
+
orderRight: orderRight,
|
|
155
|
+
orderUp: orderUp,
|
|
156
|
+
orderDown: orderDown,
|
|
157
|
+
orderForward: orderForward,
|
|
158
|
+
orderBackward: orderBackward,
|
|
159
|
+
orderFirst: orderFirst,
|
|
160
|
+
orderLast: orderLast,
|
|
161
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
166
162
|
ref: componentRef,
|
|
167
163
|
style: componentStyleViewStyle,
|
|
168
164
|
onPress: onPressHandler,
|
|
@@ -170,14 +166,15 @@ const withKeyboardFocus = Component => {
|
|
|
170
166
|
onPressIn: onPressIn,
|
|
171
167
|
onPressOut: onPressOut,
|
|
172
168
|
onFocus: onComponentFocus,
|
|
173
|
-
onBlur: onComponentBlur
|
|
169
|
+
onBlur: onComponentBlur
|
|
170
|
+
// forwarded to the child so Pressable-like components disable press handling when false
|
|
171
|
+
,
|
|
172
|
+
focusable: focusable,
|
|
174
173
|
...props,
|
|
175
|
-
...(
|
|
176
|
-
children:
|
|
174
|
+
...(childContent !== undefined && {
|
|
175
|
+
children: childContent
|
|
177
176
|
})
|
|
178
|
-
})
|
|
179
|
-
render: hoverContent
|
|
180
|
-
})]
|
|
177
|
+
})
|
|
181
178
|
})
|
|
182
179
|
});
|
|
183
180
|
}));
|
|
@@ -186,16 +183,4 @@ const withKeyboardFocus = Component => {
|
|
|
186
183
|
return WithKeyboardFocus;
|
|
187
184
|
};
|
|
188
185
|
exports.withKeyboardFocus = withKeyboardFocus;
|
|
189
|
-
const styles = _reactNative.StyleSheet.create({
|
|
190
|
-
absolute: {
|
|
191
|
-
position: 'absolute',
|
|
192
|
-
top: 0,
|
|
193
|
-
left: 0,
|
|
194
|
-
right: 0,
|
|
195
|
-
bottom: 0
|
|
196
|
-
},
|
|
197
|
-
opacity: {
|
|
198
|
-
opacity: 0.3
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
186
|
//# sourceMappingURL=withKeyboardFocus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_components","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_components","_useKeyboardFocusContainer","_useRenderedChildren","_IsViewFocusedContext","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","withKeyboardFocus","Component","WithKeyboardFocus","React","memo","forwardRef","allProps","ref","focusStyle","style","containerStyle","containerFocusStyle","withPressedStyle","onPress","onLongPress","onKeyUpPress","onKeyDownPress","onPressIn","onPressOut","triggerCodes","autoFocus","focusableWrapper","haloEffect","focusable","tintColor","onFocus","onBlur","onFocusChange","groupIdentifier","haloCornerRadius","haloExpendX","haloExpendY","screenAutoA11yFocus","screenAutoA11yFocusDelay","lockFocus","defaultFocusHighlightEnabled","androidKeyboardPressState","orderIndex","orderGroup","orderId","orderLeft","orderRight","orderUp","orderDown","orderForward","orderBackward","orderFirst","orderLast","componentRef","onComponentFocus","onComponentBlur","renderContent","renderFocusable","roundedHaloFix","tintType","enableA11yFocus","_enableA11yFocus","children","userChildren","props","focused","keyboardPressed","containerFocusedStyle","componentStyleViewStyle","onFocusChangeHandler","onKeyUpPressHandler","onKeyDownPressHandler","onPressHandler","onContextMenuHandler","enableContextMenu","useKeyboardFocusContainer","pressedStyleSignature","RNPressable","renderedChildren","useRenderedChildren","childContent","useMemo","undefined","childrenFn","state","pressed","containerStyleArr","jsx","IsViewFocusedContext","Provider","value","BaseKeyboardView","onContextMenuPress","wrappedComponentName","displayName","name","exports"],"sourceRoot":"../../../src","sources":["utils/withKeyboardFocus.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,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AC,CACc;IAAC,CACU,CAAC;EAEpC,CAAC,CACH,CAAC;EAED,MAAMa,oBAAoB,GACvBvF,SAAS,EAAUwF,WAAW,IAAKxF,SAAS,CAASyF,IAAI,IAAI,WAAW;EAC3ExF,iBAAiB,CAACuF,WAAW,GAAG,qBAAqBD,oBAAoB,GAAG;EAE5E,OAAOtF,iBAAiB;AAC1B,CAAC;AAACyF,OAAA,CAAA3F,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -4,18 +4,17 @@ import React, { useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
import { ExternalKeyboardViewNative } from '../../nativeSpec';
|
|
6
6
|
import { Commands } from '../../nativeSpec/ExternalKeyboardViewNativeComponent';
|
|
7
|
-
import { LockFocusEnum } from '../../types
|
|
7
|
+
import { LockFocusEnum } from '../../types';
|
|
8
8
|
import { KeyPressContext } from '../../context/BubbledKeyPressContext';
|
|
9
9
|
import { useBubbledInfo } from './BaseKeyboardView.hooks';
|
|
10
10
|
import { useGroupIdentifierContext } from '../../context/GroupIdentifierContext';
|
|
11
11
|
import { useOnFocusChange } from '../../utils/useOnFocusChange';
|
|
12
12
|
import { useOrderFocusGroup } from '../../context/OrderFocusContext';
|
|
13
|
-
import {
|
|
13
|
+
import { useWrappedOrderProps } from '../../utils/useWrappedOrderProps';
|
|
14
14
|
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
const isIOS = Platform.OS === 'ios';
|
|
18
|
-
const DEFAULT_EXPOSE_METHODS = ['blur', 'measure', 'measureInWindow', 'measureLayout', 'setNativeProps'];
|
|
19
18
|
var BITS = /*#__PURE__*/function (BITS) {
|
|
20
19
|
BITS[BITS["BIT_01"] = 1] = "BIT_01";
|
|
21
20
|
BITS[BITS["BIT_02"] = 2] = "BIT_02";
|
|
@@ -23,8 +22,6 @@ var BITS = /*#__PURE__*/function (BITS) {
|
|
|
23
22
|
BITS[BITS["BIT_04"] = 8] = "BIT_04";
|
|
24
23
|
BITS[BITS["BIT_05"] = 16] = "BIT_05";
|
|
25
24
|
BITS[BITS["BIT_06"] = 32] = "BIT_06";
|
|
26
|
-
BITS[BITS["BIT_07"] = 64] = "BIT_07";
|
|
27
|
-
BITS[BITS["BIT_08"] = 128] = "BIT_08";
|
|
28
25
|
BITS[BITS["BIT_09"] = 256] = "BIT_09";
|
|
29
26
|
BITS[BITS["BIT_10"] = 512] = "BIT_10";
|
|
30
27
|
return BITS;
|
|
@@ -52,18 +49,14 @@ export const BaseKeyboardView = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwa
|
|
|
52
49
|
onBubbledContextMenuPress,
|
|
53
50
|
haloEffect,
|
|
54
51
|
autoFocus,
|
|
55
|
-
canBeFocused = true,
|
|
56
52
|
focusable = true,
|
|
57
|
-
|
|
53
|
+
focusableWrapper = false,
|
|
58
54
|
onFocus,
|
|
59
55
|
onBlur,
|
|
60
|
-
viewRef,
|
|
61
56
|
groupIdentifier,
|
|
62
57
|
tintColor,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
enableA11yFocus = false,
|
|
66
|
-
screenAutoA11yFocusDelay = 500,
|
|
58
|
+
// TODO: revisit screenAutoA11yFocusDelay default (currently 300ms)
|
|
59
|
+
screenAutoA11yFocusDelay = 300,
|
|
67
60
|
lockFocus,
|
|
68
61
|
orderIndex,
|
|
69
62
|
orderForward,
|
|
@@ -78,11 +71,14 @@ export const BaseKeyboardView = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwa
|
|
|
78
71
|
orderId,
|
|
79
72
|
enableContextMenu,
|
|
80
73
|
orderPrefix: _orderPrefix,
|
|
74
|
+
tintType,
|
|
75
|
+
// Deprecated no-ops: destructured out so they never reach the native view.
|
|
76
|
+
enableA11yFocus: _enableA11yFocus,
|
|
81
77
|
defaultFocusHighlightEnabled = true,
|
|
78
|
+
roundedHaloFix = false,
|
|
82
79
|
...props
|
|
83
80
|
}, ref) => {
|
|
84
|
-
const
|
|
85
|
-
const targetRef = viewRef ?? localRef;
|
|
81
|
+
const targetRef = useRef(null);
|
|
86
82
|
const lockFocusValue = useMemo(() => mapFocusValues(lockFocus), [lockFocus]);
|
|
87
83
|
const contextIdentifier = useGroupIdentifierContext();
|
|
88
84
|
const contextGroupId = useOrderFocusGroup();
|
|
@@ -100,44 +96,53 @@ export const BaseKeyboardView = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwa
|
|
|
100
96
|
}
|
|
101
97
|
}, [orderId, orderForward, orderBackward, orderFirst, orderLast, orderLeft, orderRight, orderUp, orderDown, orderPrefix]);
|
|
102
98
|
useImperativeHandle(ref, () => {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
99
|
+
const nativeCommands = {
|
|
100
|
+
keyboardFocus: () => {
|
|
101
|
+
if (targetRef?.current) {
|
|
102
|
+
Commands.rnekKeyboardFocus(targetRef.current);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
screenReaderFocus: () => {
|
|
106
|
+
if (targetRef?.current) {
|
|
107
|
+
Commands.rnekScreenReaderFocus(targetRef.current);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
focus: () => {
|
|
111
|
+
if (targetRef?.current) {
|
|
112
|
+
Commands.rnekKeyboardFocus(targetRef.current);
|
|
113
|
+
Commands.rnekScreenReaderFocus(targetRef.current);
|
|
114
|
+
}
|
|
113
115
|
}
|
|
114
116
|
};
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
+
return new Proxy({}, {
|
|
118
|
+
get(_target, prop) {
|
|
119
|
+
if (prop in nativeCommands) {
|
|
120
|
+
return nativeCommands[prop];
|
|
121
|
+
}
|
|
122
|
+
return targetRef?.current?.[prop];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}, [targetRef]);
|
|
117
126
|
const bubbled = useBubbledInfo(onBubbledContextMenuPress);
|
|
118
127
|
const onFocusChangeHandler = useOnFocusChange({
|
|
119
128
|
onFocusChange,
|
|
120
129
|
onFocus,
|
|
121
130
|
onBlur
|
|
122
131
|
});
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const platformSpecificHalo = useMemo(() => Platform.select({
|
|
138
|
-
ios: haloEffect,
|
|
139
|
-
android: defaultFocusHighlightEnabled
|
|
140
|
-
}) ?? true, [defaultFocusHighlightEnabled, haloEffect]);
|
|
132
|
+
const hasFocusListener = onFocusChange || onFocus || onBlur;
|
|
133
|
+
const wrappedOrderProps = useWrappedOrderProps({
|
|
134
|
+
orderPrefix,
|
|
135
|
+
orderId,
|
|
136
|
+
orderForward,
|
|
137
|
+
orderBackward,
|
|
138
|
+
orderFirst,
|
|
139
|
+
orderLast,
|
|
140
|
+
orderLeft,
|
|
141
|
+
orderRight,
|
|
142
|
+
orderUp,
|
|
143
|
+
orderDown
|
|
144
|
+
});
|
|
145
|
+
const platformSpecificHalo = tintType !== 'none' && (isIOS ? haloEffect ?? true : defaultFocusHighlightEnabled);
|
|
141
146
|
return /*#__PURE__*/_jsx(KeyPressContext.Provider, {
|
|
142
147
|
value: bubbled.context,
|
|
143
148
|
children: /*#__PURE__*/_jsx(ExternalKeyboardViewNative, {
|
|
@@ -145,27 +150,24 @@ export const BaseKeyboardView = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwa
|
|
|
145
150
|
haloEffect: platformSpecificHalo,
|
|
146
151
|
ref: targetRef,
|
|
147
152
|
enableContextMenu: enableContextMenu,
|
|
148
|
-
canBeFocused:
|
|
153
|
+
canBeFocused: focusable,
|
|
149
154
|
autoFocus: autoFocus,
|
|
150
|
-
onKeyDownPress: onKeyDownPress
|
|
151
|
-
,
|
|
152
|
-
onKeyUpPress: onKeyUpPress //ToDo update types
|
|
153
|
-
,
|
|
155
|
+
onKeyDownPress: onKeyDownPress,
|
|
156
|
+
onKeyUpPress: onKeyUpPress,
|
|
154
157
|
onBubbledContextMenuPress: bubbled.contextMenu,
|
|
155
158
|
groupIdentifier: groupIdentifier ?? contextIdentifier,
|
|
156
159
|
tintColor: isIOS ? tintColor : undefined,
|
|
157
|
-
onFocusChange:
|
|
158
|
-
,
|
|
160
|
+
onFocusChange: hasFocusListener ? onFocusChangeHandler : undefined,
|
|
159
161
|
hasKeyDownPress: Boolean(onKeyDownPress),
|
|
160
162
|
hasKeyUpPress: Boolean(onKeyUpPress),
|
|
161
|
-
hasOnFocusChanged: Boolean(
|
|
162
|
-
|
|
163
|
+
hasOnFocusChanged: Boolean(hasFocusListener),
|
|
164
|
+
focusableWrapper: focusableWrapper,
|
|
163
165
|
orderIndex: orderIndex ?? -1,
|
|
164
|
-
enableA11yFocus: enableA11yFocus,
|
|
165
166
|
screenAutoA11yFocusDelay: screenAutoA11yFocusDelay,
|
|
166
167
|
lockFocus: lockFocusValue,
|
|
167
168
|
...wrappedOrderProps,
|
|
168
|
-
orderGroup: groupId
|
|
169
|
+
orderGroup: groupId,
|
|
170
|
+
roundedHaloFix: roundedHaloFix
|
|
169
171
|
})
|
|
170
172
|
});
|
|
171
173
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useImperativeHandle","useMemo","useRef","Platform","ExternalKeyboardViewNative","Commands","LockFocusEnum","KeyPressContext","useBubbledInfo","useGroupIdentifierContext","useOnFocusChange","useOrderFocusGroup","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useImperativeHandle","useMemo","useRef","Platform","ExternalKeyboardViewNative","Commands","LockFocusEnum","KeyPressContext","useBubbledInfo","useGroupIdentifierContext","useOnFocusChange","useOrderFocusGroup","useWrappedOrderProps","jsx","_jsx","isIOS","OS","BITS","focusBinaryValue","Up","BIT_01","Down","BIT_02","Left","BIT_03","Right","BIT_04","Forward","BIT_05","Backward","BIT_06","First","BIT_09","Last","BIT_10","mapFocusValues","values","length","reduce","acc","item","BaseKeyboardView","memo","forwardRef","onFocusChange","onKeyUpPress","onKeyDownPress","onBubbledContextMenuPress","haloEffect","autoFocus","focusable","focusableWrapper","onFocus","onBlur","groupIdentifier","tintColor","screenAutoA11yFocusDelay","lockFocus","orderIndex","orderForward","orderBackward","orderFirst","orderLast","orderGroup","orderLeft","orderRight","orderUp","orderDown","orderId","enableContextMenu","orderPrefix","_orderPrefix","tintType","enableA11yFocus","_enableA11yFocus","defaultFocusHighlightEnabled","roundedHaloFix","props","ref","targetRef","lockFocusValue","contextIdentifier","contextGroupId","groupId","__DEV__","undefined","console","warn","hasOrderLinkProp","nativeCommands","keyboardFocus","current","rnekKeyboardFocus","screenReaderFocus","rnekScreenReaderFocus","focus","Proxy","get","_target","prop","bubbled","onFocusChangeHandler","hasFocusListener","wrappedOrderProps","platformSpecificHalo","Provider","value","context","children","canBeFocused","contextMenu","hasKeyDownPress","Boolean","hasKeyUpPress","hasOnFocusChanged"],"sourceRoot":"../../../../src","sources":["components/BaseKeyboardView/BaseKeyboardView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAEVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,QACD,OAAO;AACd,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,0BAA0B,QAAQ,kBAAkB;AAC7D,SAASC,QAAQ,QAAQ,sDAAsD;AAC/E,SACEC,aAAa,QAIR,aAAa;AAEpB,SAASC,eAAe,QAAQ,sCAAsC;AACtE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,gBAAgB,QAAQ,8BAA8B;AAC/D,SAASC,kBAAkB,QAAQ,iCAAiC;AACpE,SAASC,oBAAoB,QAAQ,kCAAkC;;AAEvE;AAAA,SAAAC,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