@tamagui/sheet 2.7.7 → 3.0.0-beta.643.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/dist/cjs/GestureDetectorWrapper.cjs +32 -41
- package/dist/cjs/GestureDetectorWrapper.native.cjs +48 -0
- package/dist/cjs/GestureDetectorWrapper.native.js +32 -40
- package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -1
- package/dist/cjs/GestureSheetContext.cjs +29 -37
- package/dist/cjs/GestureSheetContext.native.cjs +49 -0
- package/dist/cjs/GestureSheetContext.native.js +30 -37
- package/dist/cjs/GestureSheetContext.native.js.map +1 -1
- package/dist/cjs/Sheet.cjs +206 -99
- package/dist/cjs/Sheet.native.cjs +234 -0
- package/dist/cjs/Sheet.native.js +212 -98
- package/dist/cjs/Sheet.native.js.map +1 -1
- package/dist/cjs/SheetContext.cjs +44 -22
- package/dist/cjs/SheetContext.native.cjs +58 -0
- package/dist/cjs/SheetContext.native.js +45 -22
- package/dist/cjs/SheetContext.native.js.map +1 -1
- package/dist/cjs/SheetController.cjs +50 -56
- package/dist/cjs/SheetController.native.cjs +72 -0
- package/dist/cjs/SheetController.native.js +53 -58
- package/dist/cjs/SheetController.native.js.map +1 -1
- package/dist/cjs/SheetImplementationCustom.cjs +674 -605
- package/dist/cjs/SheetImplementationCustom.native.cjs +762 -0
- package/dist/cjs/SheetImplementationCustom.native.js +713 -644
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +291 -312
- package/dist/cjs/SheetScrollView.native.cjs +326 -0
- package/dist/cjs/SheetScrollView.native.js +299 -319
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/constants.cjs +22 -21
- package/dist/cjs/constants.native.cjs +37 -0
- package/dist/cjs/constants.native.js +22 -20
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/contexts.cjs +20 -28
- package/dist/cjs/contexts.native.cjs +38 -0
- package/dist/cjs/contexts.native.js +20 -27
- package/dist/cjs/contexts.native.js.map +1 -1
- package/dist/cjs/controller.cjs +17 -18
- package/dist/cjs/controller.native.cjs +32 -0
- package/dist/cjs/controller.native.js +17 -17
- package/dist/cjs/controller.native.js.map +1 -1
- package/dist/cjs/gestureState.cjs +29 -30
- package/dist/cjs/gestureState.native.cjs +54 -0
- package/dist/cjs/gestureState.native.js +30 -30
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/helpers.cjs +21 -24
- package/dist/cjs/helpers.native.cjs +35 -0
- package/dist/cjs/helpers.native.js +22 -24
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/index.cjs +15 -21
- package/dist/cjs/index.native.cjs +37 -0
- package/dist/cjs/index.native.js +16 -21
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/keyboardAvoidance.cjs +56 -79
- package/dist/cjs/keyboardAvoidance.native.cjs +75 -0
- package/dist/cjs/keyboardAvoidance.native.js +56 -78
- package/dist/cjs/keyboardAvoidance.native.js.map +1 -1
- package/dist/cjs/nativeSheet.cjs +64 -76
- package/dist/cjs/nativeSheet.native.cjs +94 -0
- package/dist/cjs/nativeSheet.native.js +70 -83
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/types.cjs +10 -11
- package/dist/cjs/types.native.cjs +19 -0
- package/dist/cjs/types.native.js +10 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useGestureHandlerPan.cjs +245 -257
- package/dist/cjs/useGestureHandlerPan.native.cjs +273 -0
- package/dist/cjs/useGestureHandlerPan.native.js +254 -265
- package/dist/cjs/useGestureHandlerPan.native.js.map +1 -1
- package/dist/cjs/useKeyboardControllerSheet.cjs +83 -88
- package/dist/cjs/useKeyboardControllerSheet.native.cjs +119 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js +100 -111
- package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/cjs/useSafeAreaInsets.cjs +20 -26
- package/dist/cjs/useSafeAreaInsets.native.cjs +51 -0
- package/dist/cjs/useSafeAreaInsets.native.js +30 -25
- package/dist/cjs/useSafeAreaInsets.native.js.map +1 -1
- package/dist/cjs/useSheetController.cjs +27 -39
- package/dist/cjs/useSheetController.native.cjs +42 -0
- package/dist/cjs/useSheetController.native.js +28 -39
- package/dist/cjs/useSheetController.native.js.map +1 -1
- package/dist/cjs/useSheetOffscreenSize.cjs +44 -53
- package/dist/cjs/useSheetOffscreenSize.native.cjs +60 -0
- package/dist/cjs/useSheetOffscreenSize.native.js +48 -56
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/cjs/useSheetOpenState.cjs +69 -40
- package/dist/cjs/useSheetOpenState.native.cjs +88 -0
- package/dist/cjs/useSheetOpenState.native.js +74 -42
- package/dist/cjs/useSheetOpenState.native.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.cjs +146 -164
- package/dist/cjs/useSheetProviderProps.native.cjs +176 -0
- package/dist/cjs/useSheetProviderProps.native.js +156 -174
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetScrollViewGestures.cjs +172 -180
- package/dist/cjs/useSheetScrollViewGestures.native.cjs +150 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js +136 -147
- package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/cjs/webViewport.cjs +47 -48
- package/dist/cjs/webViewport.native.cjs +79 -0
- package/dist/cjs/webViewport.native.js +50 -50
- package/dist/cjs/webViewport.native.js.map +1 -1
- package/dist/esm/GestureDetectorWrapper.mjs +19 -23
- package/dist/esm/GestureDetectorWrapper.mjs.map +1 -1
- package/dist/esm/GestureDetectorWrapper.native.js +20 -24
- package/dist/esm/GestureDetectorWrapper.native.js.map +1 -1
- package/dist/esm/GestureSheetContext.mjs +15 -20
- package/dist/esm/GestureSheetContext.mjs.map +1 -1
- package/dist/esm/GestureSheetContext.native.js +17 -22
- package/dist/esm/GestureSheetContext.native.js.map +1 -1
- package/dist/esm/Sheet.mjs +191 -83
- package/dist/esm/Sheet.mjs.map +1 -1
- package/dist/esm/Sheet.native.js +198 -83
- package/dist/esm/Sheet.native.js.map +1 -1
- package/dist/esm/SheetContext.mjs +21 -5
- package/dist/esm/SheetContext.mjs.map +1 -1
- package/dist/esm/SheetContext.native.js +21 -5
- package/dist/esm/SheetContext.native.js.map +1 -1
- package/dist/esm/SheetController.mjs +34 -30
- package/dist/esm/SheetController.mjs.map +1 -1
- package/dist/esm/SheetController.native.js +38 -34
- package/dist/esm/SheetController.native.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.mjs +655 -580
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +691 -612
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +277 -288
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +286 -297
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/constants.mjs +5 -3
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js +5 -3
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/contexts.mjs +3 -3
- package/dist/esm/contexts.mjs.map +1 -1
- package/dist/esm/contexts.native.js +3 -3
- package/dist/esm/contexts.native.js.map +1 -1
- package/dist/esm/controller.mjs +2 -2
- package/dist/esm/controller.native.js +2 -2
- package/dist/esm/gestureState.mjs +13 -11
- package/dist/esm/gestureState.mjs.map +1 -1
- package/dist/esm/gestureState.native.js +14 -12
- package/dist/esm/gestureState.native.js.map +1 -1
- package/dist/esm/helpers.mjs +7 -6
- package/dist/esm/helpers.mjs.map +1 -1
- package/dist/esm/helpers.native.js +8 -7
- package/dist/esm/helpers.native.js.map +1 -1
- package/dist/esm/index.js +21 -14
- package/dist/esm/index.mjs +21 -14
- package/dist/esm/index.native.js +21 -14
- package/dist/esm/keyboardAvoidance.mjs +40 -61
- package/dist/esm/keyboardAvoidance.mjs.map +1 -1
- package/dist/esm/keyboardAvoidance.native.js +40 -61
- package/dist/esm/keyboardAvoidance.native.js.map +1 -1
- package/dist/esm/nativeSheet.mjs +52 -61
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +58 -69
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.native.js +0 -2
- package/dist/esm/useGestureHandlerPan.mjs +232 -239
- package/dist/esm/useGestureHandlerPan.mjs.map +1 -1
- package/dist/esm/useGestureHandlerPan.native.js +241 -248
- package/dist/esm/useGestureHandlerPan.native.js.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.mjs +71 -71
- package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.native.js +92 -94
- package/dist/esm/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/esm/useSafeAreaInsets.mjs +3 -1
- package/dist/esm/useSafeAreaInsets.mjs.map +1 -1
- package/dist/esm/useSafeAreaInsets.native.js +15 -3
- package/dist/esm/useSafeAreaInsets.native.js.map +1 -1
- package/dist/esm/useSheetController.mjs +14 -12
- package/dist/esm/useSheetController.mjs.map +1 -1
- package/dist/esm/useSheetController.native.js +14 -12
- package/dist/esm/useSheetController.native.js.map +1 -1
- package/dist/esm/useSheetOffscreenSize.mjs +30 -35
- package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/esm/useSheetOffscreenSize.native.js +34 -39
- package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/esm/useSheetOpenState.mjs +50 -22
- package/dist/esm/useSheetOpenState.mjs.map +1 -1
- package/dist/esm/useSheetOpenState.native.js +55 -25
- package/dist/esm/useSheetOpenState.native.js.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs +130 -138
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js +140 -149
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.mjs +159 -162
- package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.native.js +123 -130
- package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/esm/webViewport.mjs +26 -25
- package/dist/esm/webViewport.mjs.map +1 -1
- package/dist/esm/webViewport.native.js +29 -28
- package/dist/esm/webViewport.native.js.map +1 -1
- package/dist/jsx/GestureDetectorWrapper.mjs +19 -23
- package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -1
- package/dist/jsx/GestureDetectorWrapper.native.cjs +48 -0
- package/dist/jsx/GestureDetectorWrapper.native.js +32 -40
- package/dist/jsx/GestureDetectorWrapper.native.js.map +1 -1
- package/dist/jsx/GestureSheetContext.mjs +15 -20
- package/dist/jsx/GestureSheetContext.mjs.map +1 -1
- package/dist/jsx/GestureSheetContext.native.cjs +49 -0
- package/dist/jsx/GestureSheetContext.native.js +30 -37
- package/dist/jsx/GestureSheetContext.native.js.map +1 -1
- package/dist/jsx/Sheet.mjs +191 -83
- package/dist/jsx/Sheet.mjs.map +1 -1
- package/dist/jsx/Sheet.native.cjs +234 -0
- package/dist/jsx/Sheet.native.js +212 -98
- package/dist/jsx/Sheet.native.js.map +1 -1
- package/dist/jsx/SheetContext.mjs +21 -5
- package/dist/jsx/SheetContext.mjs.map +1 -1
- package/dist/jsx/SheetContext.native.cjs +58 -0
- package/dist/jsx/SheetContext.native.js +45 -22
- package/dist/jsx/SheetContext.native.js.map +1 -1
- package/dist/jsx/SheetController.mjs +34 -30
- package/dist/jsx/SheetController.mjs.map +1 -1
- package/dist/jsx/SheetController.native.cjs +72 -0
- package/dist/jsx/SheetController.native.js +53 -58
- package/dist/jsx/SheetController.native.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.mjs +655 -580
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.cjs +762 -0
- package/dist/jsx/SheetImplementationCustom.native.js +713 -644
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +277 -288
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.cjs +326 -0
- package/dist/jsx/SheetScrollView.native.js +299 -319
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/constants.mjs +5 -3
- package/dist/jsx/constants.mjs.map +1 -1
- package/dist/jsx/constants.native.cjs +37 -0
- package/dist/jsx/constants.native.js +22 -20
- package/dist/jsx/constants.native.js.map +1 -1
- package/dist/jsx/contexts.mjs +3 -3
- package/dist/jsx/contexts.mjs.map +1 -1
- package/dist/jsx/contexts.native.cjs +38 -0
- package/dist/jsx/contexts.native.js +20 -27
- package/dist/jsx/contexts.native.js.map +1 -1
- package/dist/jsx/controller.mjs +2 -2
- package/dist/jsx/controller.native.cjs +32 -0
- package/dist/jsx/controller.native.js +17 -17
- package/dist/jsx/controller.native.js.map +1 -1
- package/dist/jsx/gestureState.mjs +13 -11
- package/dist/jsx/gestureState.mjs.map +1 -1
- package/dist/jsx/gestureState.native.cjs +54 -0
- package/dist/jsx/gestureState.native.js +30 -30
- package/dist/jsx/gestureState.native.js.map +1 -1
- package/dist/jsx/helpers.mjs +7 -6
- package/dist/jsx/helpers.mjs.map +1 -1
- package/dist/jsx/helpers.native.cjs +35 -0
- package/dist/jsx/helpers.native.js +22 -24
- package/dist/jsx/helpers.native.js.map +1 -1
- package/dist/jsx/index.js +21 -14
- package/dist/jsx/index.mjs +21 -14
- package/dist/jsx/index.native.cjs +37 -0
- package/dist/jsx/index.native.js +16 -21
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/keyboardAvoidance.mjs +40 -61
- package/dist/jsx/keyboardAvoidance.mjs.map +1 -1
- package/dist/jsx/keyboardAvoidance.native.cjs +75 -0
- package/dist/jsx/keyboardAvoidance.native.js +56 -78
- package/dist/jsx/keyboardAvoidance.native.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +52 -61
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.cjs +94 -0
- package/dist/jsx/nativeSheet.native.js +70 -83
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +19 -0
- package/dist/jsx/types.native.js +10 -10
- package/dist/jsx/types.native.js.map +1 -1
- package/dist/jsx/useGestureHandlerPan.mjs +232 -239
- package/dist/jsx/useGestureHandlerPan.mjs.map +1 -1
- package/dist/jsx/useGestureHandlerPan.native.cjs +273 -0
- package/dist/jsx/useGestureHandlerPan.native.js +254 -265
- package/dist/jsx/useGestureHandlerPan.native.js.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.mjs +71 -71
- package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.native.cjs +119 -0
- package/dist/jsx/useKeyboardControllerSheet.native.js +100 -111
- package/dist/jsx/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/jsx/useSafeAreaInsets.mjs +3 -1
- package/dist/jsx/useSafeAreaInsets.mjs.map +1 -1
- package/dist/jsx/useSafeAreaInsets.native.cjs +51 -0
- package/dist/jsx/useSafeAreaInsets.native.js +30 -25
- package/dist/jsx/useSafeAreaInsets.native.js.map +1 -1
- package/dist/jsx/useSheetController.mjs +14 -12
- package/dist/jsx/useSheetController.mjs.map +1 -1
- package/dist/jsx/useSheetController.native.cjs +42 -0
- package/dist/jsx/useSheetController.native.js +28 -39
- package/dist/jsx/useSheetController.native.js.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.mjs +30 -35
- package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.native.cjs +60 -0
- package/dist/jsx/useSheetOffscreenSize.native.js +48 -56
- package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/jsx/useSheetOpenState.mjs +50 -22
- package/dist/jsx/useSheetOpenState.mjs.map +1 -1
- package/dist/jsx/useSheetOpenState.native.cjs +88 -0
- package/dist/jsx/useSheetOpenState.native.js +74 -42
- package/dist/jsx/useSheetOpenState.native.js.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs +130 -138
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.cjs +176 -0
- package/dist/jsx/useSheetProviderProps.native.js +156 -174
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.mjs +159 -162
- package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.native.cjs +150 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js +136 -147
- package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/jsx/webViewport.mjs +26 -25
- package/dist/jsx/webViewport.mjs.map +1 -1
- package/dist/jsx/webViewport.native.cjs +79 -0
- package/dist/jsx/webViewport.native.js +50 -50
- package/dist/jsx/webViewport.native.js.map +1 -1
- package/package.json +33 -39
- package/src/Sheet.tsx +316 -77
- package/src/SheetContext.tsx +57 -7
- package/src/SheetController.tsx +7 -6
- package/src/SheetImplementationCustom.tsx +343 -140
- package/src/SheetScrollView.tsx +24 -13
- package/src/constants.tsx +3 -3
- package/src/helpers.tsx +0 -14
- package/src/index.ts +3 -6
- package/src/nativeSheet.tsx +5 -15
- package/src/types.tsx +104 -92
- package/src/useKeyboardControllerSheet.native.ts +7 -2
- package/src/useSafeAreaInsets.native.ts +20 -13
- package/src/useSheetController.tsx +15 -7
- package/src/useSheetOpenState.tsx +50 -4
- package/src/useSheetProviderProps.tsx +4 -27
- package/src/useSheetScrollViewGestures.ts +2 -2
- package/types/GestureDetectorWrapper.d.ts +1 -1
- package/types/GestureDetectorWrapper.d.ts.map +1 -1
- package/types/GestureSheetContext.d.ts +1 -1
- package/types/GestureSheetContext.d.ts.map +1 -1
- package/types/Sheet.d.ts +384 -135
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetContext.d.ts +28 -42
- package/types/SheetContext.d.ts.map +1 -1
- package/types/SheetController.d.ts +4 -2
- package/types/SheetController.d.ts.map +1 -1
- package/types/SheetImplementationCustom.d.ts +3 -35
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +57 -23
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/constants.d.ts +3 -2
- package/types/constants.d.ts.map +1 -1
- package/types/index.d.ts +1 -3
- package/types/index.d.ts.map +1 -1
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/types.d.ts +28 -17
- package/types/types.d.ts.map +1 -1
- package/types/useKeyboardControllerSheet.native.d.ts.map +1 -1
- package/types/useSafeAreaInsets.native.d.ts +4 -12
- package/types/useSafeAreaInsets.native.d.ts.map +1 -1
- package/types/useSheetController.d.ts +6 -6
- package/types/useSheetController.d.ts.map +1 -1
- package/types/useSheetOffscreenSize.d.ts.map +1 -1
- package/types/useSheetOpenState.d.ts +3 -2
- package/types/useSheetOpenState.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +5 -8
- package/types/useSheetProviderProps.d.ts.map +1 -1
- package/types/useSheetScrollViewGestures.d.ts +2 -2
- package/types/useSheetScrollViewGestures.d.ts.map +1 -1
- package/.turbo/turbo-build.log +0 -2
- package/controller/index.cjs +0 -2
- package/controller/index.d.ts +0 -5
- package/controller/index.js +0 -2
- package/controller/index.native.cjs +0 -2
- package/controller/index.native.js +0 -2
- package/dist/cjs/createSheet.cjs +0 -194
- package/dist/cjs/createSheet.native.js +0 -204
- package/dist/cjs/createSheet.native.js.map +0 -1
- package/dist/cjs/setupGestureHandler.cjs +0 -55
- package/dist/cjs/setupGestureHandler.native.js +0 -60
- package/dist/cjs/setupGestureHandler.native.js.map +0 -1
- package/dist/cjs/useSheet.cjs +0 -29
- package/dist/cjs/useSheet.native.js +0 -34
- package/dist/cjs/useSheet.native.js.map +0 -1
- package/dist/esm/controller.mjs.map +0 -1
- package/dist/esm/controller.native.js.map +0 -1
- package/dist/esm/createSheet.mjs +0 -168
- package/dist/esm/createSheet.mjs.map +0 -1
- package/dist/esm/createSheet.native.js +0 -176
- package/dist/esm/createSheet.native.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/esm/setupGestureHandler.mjs +0 -29
- package/dist/esm/setupGestureHandler.mjs.map +0 -1
- package/dist/esm/setupGestureHandler.native.js +0 -31
- package/dist/esm/setupGestureHandler.native.js.map +0 -1
- package/dist/esm/types.mjs.map +0 -1
- package/dist/esm/types.native.js.map +0 -1
- package/dist/esm/useSheet.mjs +0 -4
- package/dist/esm/useSheet.mjs.map +0 -1
- package/dist/esm/useSheet.native.js +0 -6
- package/dist/esm/useSheet.native.js.map +0 -1
- package/dist/jsx/controller.mjs.map +0 -1
- package/dist/jsx/createSheet.mjs +0 -168
- package/dist/jsx/createSheet.mjs.map +0 -1
- package/dist/jsx/createSheet.native.js +0 -204
- package/dist/jsx/createSheet.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
- package/dist/jsx/setupGestureHandler.mjs +0 -29
- package/dist/jsx/setupGestureHandler.mjs.map +0 -1
- package/dist/jsx/setupGestureHandler.native.js +0 -60
- package/dist/jsx/setupGestureHandler.native.js.map +0 -1
- package/dist/jsx/types.mjs.map +0 -1
- package/dist/jsx/useSheet.mjs +0 -4
- package/dist/jsx/useSheet.mjs.map +0 -1
- package/dist/jsx/useSheet.native.js +0 -34
- package/dist/jsx/useSheet.native.js.map +0 -1
- package/next.md +0 -78
- package/setup-gesture-handler/index.cjs +0 -2
- package/setup-gesture-handler/index.js +0 -2
- package/setup-gesture-handler/index.native.cjs +0 -2
- package/setup-gesture-handler/index.native.js +0 -2
- package/setup-gesture-handler.cjs +0 -1
- package/src/createSheet.tsx +0 -309
- package/src/setupGestureHandler.ts +0 -43
- package/src/useSheet.tsx +0 -3
- package/test/keyboardAvoidance.test.ts +0 -269
- package/tsconfig.json +0 -57
- package/types/createSheet.d.ts +0 -195
- package/types/createSheet.d.ts.map +0 -1
- package/types/setupGestureHandler.d.ts +0 -11
- package/types/setupGestureHandler.d.ts.map +0 -1
- package/types/useSheet.d.ts +0 -2
- package/types/useSheet.d.ts.map +0 -1
package/dist/esm/Sheet.mjs
CHANGED
|
@@ -1,89 +1,197 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from "@tamagui/adapt";
|
|
2
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
|
+
import { isWeb } from "@tamagui/constants";
|
|
4
|
+
import { View, createRefComponent, createStyledHOC, styled } from "@tamagui/core";
|
|
5
|
+
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
6
|
+
import { resolveViewZIndex } from "@tamagui/portal";
|
|
7
|
+
import { RemoveScroll } from "@tamagui/remove-scroll";
|
|
2
8
|
import { XStack, YStack } from "@tamagui/stacks";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
backgroundColor: "$background",
|
|
25
|
-
zIndex: 10,
|
|
26
|
-
marginHorizontal: "35%",
|
|
27
|
-
marginBottom: "$2",
|
|
28
|
-
opacity: 0.5,
|
|
29
|
-
hoverStyle: {
|
|
30
|
-
opacity: 0.7
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
defaultVariants: {
|
|
36
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
37
|
-
}
|
|
9
|
+
import { useDidFinishSSR } from "@tamagui/use-did-finish-ssr";
|
|
10
|
+
import { StackZIndexContext } from "@tamagui/z-index-stack";
|
|
11
|
+
import { useContext, useEffect, useMemo, useRef } from "react";
|
|
12
|
+
import { Platform } from "react-native-web";
|
|
13
|
+
import { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from "./constants.mjs";
|
|
14
|
+
import { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from "./SheetContext.mjs";
|
|
15
|
+
import { SheetImplementationCustom } from "./SheetImplementationCustom.mjs";
|
|
16
|
+
import { SheetScrollView } from "./SheetScrollView.mjs";
|
|
17
|
+
import { useSheetController } from "./useSheetController.mjs";
|
|
18
|
+
import { useSheetOffscreenSize } from "./useSheetOffscreenSize.mjs";
|
|
19
|
+
import { getMaxViewportHeight } from "./webViewport.mjs";
|
|
20
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
|
|
22
|
+
export * from "./types.mjs"
|
|
23
|
+
|
|
24
|
+
const SheetHandleFrame = styled(XStack, {
|
|
25
|
+
displayName: SHEET_HANDLE_NAME,
|
|
26
|
+
variants: { open: {
|
|
27
|
+
true: { pointerEvents: "auto" },
|
|
28
|
+
false: { pointerEvents: "none" }
|
|
29
|
+
} }
|
|
38
30
|
});
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
unstyled: {
|
|
51
|
-
false: {
|
|
52
|
-
fullscreen: true,
|
|
53
|
-
position: "absolute",
|
|
54
|
-
backgroundColor: "$background",
|
|
55
|
-
zIndex: 1e5 - 1,
|
|
56
|
-
pointerEvents: "auto"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
defaultVariants: {
|
|
61
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
62
|
-
}
|
|
31
|
+
const SheetOverlayFrame = styled(YStack, {
|
|
32
|
+
displayName: SHEET_OVERLAY_NAME,
|
|
33
|
+
inset: 0,
|
|
34
|
+
position: "absolute",
|
|
35
|
+
zIndex: 99999,
|
|
36
|
+
pointerEvents: "auto",
|
|
37
|
+
variants: { open: {
|
|
38
|
+
true: { pointerEvents: "auto" },
|
|
39
|
+
false: { pointerEvents: "none" }
|
|
40
|
+
} }
|
|
63
41
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
borderTopRightRadius: "$true",
|
|
73
|
-
width: "100%",
|
|
74
|
-
maxHeight: "100%",
|
|
75
|
-
overflow: "hidden"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
defaultVariants: {
|
|
80
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
81
|
-
}
|
|
42
|
+
Object.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });
|
|
43
|
+
const SheetContainerFrame = styled(YStack, {
|
|
44
|
+
displayName: SHEET_CONTAINER_NAME,
|
|
45
|
+
flex: 1,
|
|
46
|
+
position: "relative",
|
|
47
|
+
zIndex: 0,
|
|
48
|
+
width: "100%",
|
|
49
|
+
maxHeight: "100%"
|
|
82
50
|
});
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
51
|
+
const SheetBackgroundFrame = styled(YStack, {
|
|
52
|
+
displayName: SHEET_BACKGROUND_NAME,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
top: 0,
|
|
55
|
+
left: 0,
|
|
56
|
+
right: 0,
|
|
57
|
+
zIndex: -1,
|
|
58
|
+
pointerEvents: "none"
|
|
87
59
|
});
|
|
88
|
-
|
|
60
|
+
const SheetHandle = createStyledHOC(SheetHandleFrame, ({ scope, ...props }, forwardedRef) => {
|
|
61
|
+
const context = useSheetContext(scope);
|
|
62
|
+
const composedRef = useComposedRefs(context.handleRef, forwardedRef);
|
|
63
|
+
const wasDraggingRef = useRef(false);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!context.scrollBridge) return;
|
|
66
|
+
return context.scrollBridge.onParentDragging((isDragging) => {
|
|
67
|
+
if (isDragging) wasDraggingRef.current = true;
|
|
68
|
+
});
|
|
69
|
+
}, [context.scrollBridge]);
|
|
70
|
+
if (context.onlyShowContainer) return null;
|
|
71
|
+
return /* @__PURE__ */ jsx(SheetHandleFrame, {
|
|
72
|
+
ref: composedRef,
|
|
73
|
+
onPressIn: () => {
|
|
74
|
+
wasDraggingRef.current = false;
|
|
75
|
+
},
|
|
76
|
+
onPress: () => {
|
|
77
|
+
if (wasDraggingRef.current) {
|
|
78
|
+
wasDraggingRef.current = false;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);
|
|
82
|
+
const nextPos = (context.position + 1) % max;
|
|
83
|
+
context.setPosition(nextPos);
|
|
84
|
+
},
|
|
85
|
+
open: context.open,
|
|
86
|
+
...props
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
const SheetOverlay = createStyledHOC(SheetOverlayFrame, (propsIn, ref) => {
|
|
90
|
+
const { scope, ...props } = propsIn;
|
|
91
|
+
const context = useSheetContext(scope);
|
|
92
|
+
const isInOverlayLayer = useContext(SheetOverlayLayerContext);
|
|
93
|
+
const didWarn = useRef(false);
|
|
94
|
+
if (context.onlyShowContainer) return null;
|
|
95
|
+
if (!isInOverlayLayer) {
|
|
96
|
+
if (process.env.NODE_ENV === "development" && !didWarn.current) {
|
|
97
|
+
didWarn.current = true;
|
|
98
|
+
console.error("Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.");
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return /* @__PURE__ */ jsx(SheetOverlayFrame, {
|
|
103
|
+
...props,
|
|
104
|
+
ref,
|
|
105
|
+
onPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? () => {
|
|
106
|
+
context.setOpen(false);
|
|
107
|
+
} : void 0)
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
const SheetContainer = createStyledHOC(SheetContainerFrame, ({ scope, adjustPaddingForOffscreenContent, children, ...props }, forwardedRef) => {
|
|
111
|
+
const context = useSheetContext(scope);
|
|
112
|
+
const { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;
|
|
113
|
+
const composedContentRef = useComposedRefs(forwardedRef, contentRef);
|
|
114
|
+
const offscreenSize = useSheetOffscreenSize(context);
|
|
115
|
+
const stableFrameSize = useRef(frameSize);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (open && frameSize) stableFrameSize.current = frameSize;
|
|
118
|
+
}, [open, frameSize]);
|
|
119
|
+
const sheetContents = useMemo(() => {
|
|
120
|
+
const shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;
|
|
121
|
+
return /* @__PURE__ */ jsxs(SheetContainerFrame, {
|
|
122
|
+
ref: composedContentRef,
|
|
123
|
+
flex: hasFit && open ? 0 : 1,
|
|
124
|
+
flexBasis: hasFit ? "auto" : void 0,
|
|
125
|
+
height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
|
|
126
|
+
pointerEvents: open ? "auto" : "none",
|
|
127
|
+
"data-state": open ? "open" : "closed",
|
|
128
|
+
...props,
|
|
129
|
+
children: [/* @__PURE__ */ jsx(StackZIndexContext, {
|
|
130
|
+
zIndex: resolveViewZIndex(props.zIndex),
|
|
131
|
+
children
|
|
132
|
+
}), adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, {
|
|
133
|
+
"data-sheet-offscreen-pad": true,
|
|
134
|
+
height: offscreenSize,
|
|
135
|
+
width: "100%"
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
}, [
|
|
139
|
+
open,
|
|
140
|
+
props,
|
|
141
|
+
frameSize,
|
|
142
|
+
offscreenSize,
|
|
143
|
+
adjustPaddingForOffscreenContent,
|
|
144
|
+
hasFit
|
|
145
|
+
]);
|
|
146
|
+
return /* @__PURE__ */ jsx(RemoveScroll, {
|
|
147
|
+
enabled: !disableRemoveScroll && context.open,
|
|
148
|
+
children: sheetContents
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
const SheetBackground = createStyledHOC(SheetBackgroundFrame, ({ scope, disableHideBottomOverflow, ...props }, forwardedRef) => {
|
|
152
|
+
const context = useSheetContext(scope);
|
|
153
|
+
const bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;
|
|
154
|
+
return /* @__PURE__ */ jsx(SheetBackgroundFrame, {
|
|
155
|
+
ref: forwardedRef,
|
|
156
|
+
"data-sheet-background": "",
|
|
157
|
+
bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,
|
|
158
|
+
...props
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
const SheetRoot = createRefComponent(function SheetRoot2(props, ref) {
|
|
162
|
+
const hydrated = useDidFinishSSR();
|
|
163
|
+
const isAdapted = useAdaptIsActive();
|
|
164
|
+
const adaptContext = useAdaptContext();
|
|
165
|
+
const { isShowingNonSheet } = useSheetController(props.scope);
|
|
166
|
+
const isShowingAdaptNonSheet = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange) && !adaptContext.active && adaptContext.open;
|
|
167
|
+
let SheetImplementation = SheetImplementationCustom;
|
|
168
|
+
if (props.native && Platform.OS === "ios") {}
|
|
169
|
+
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) return null;
|
|
170
|
+
const implementation = /* @__PURE__ */ jsx(SheetImplementation, {
|
|
171
|
+
ref,
|
|
172
|
+
...props
|
|
173
|
+
});
|
|
174
|
+
return isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, {
|
|
175
|
+
scroll: true,
|
|
176
|
+
overlay: true,
|
|
177
|
+
dismiss: true,
|
|
178
|
+
children: implementation
|
|
179
|
+
}) : implementation;
|
|
180
|
+
});
|
|
181
|
+
const sheetParts = {
|
|
182
|
+
Container: SheetContainer,
|
|
183
|
+
Background: SheetBackground,
|
|
184
|
+
Overlay: SheetOverlay,
|
|
185
|
+
Handle: SheetHandle,
|
|
186
|
+
ScrollView: SheetScrollView
|
|
187
|
+
};
|
|
188
|
+
const SheetControlled = withStaticProperties(SheetRoot, sheetParts);
|
|
189
|
+
const Sheet = withStaticProperties(SheetRoot, {
|
|
190
|
+
Root: SheetRoot,
|
|
191
|
+
Controlled: SheetControlled,
|
|
192
|
+
useAnimatedPosition,
|
|
193
|
+
...sheetParts
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
export { Sheet, SheetBackground, SheetContainer, SheetControlled, SheetHandle, SheetOverlay, SheetRoot };
|
|
89
197
|
//# sourceMappingURL=Sheet.mjs.map
|
package/dist/esm/Sheet.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styled","XStack","YStack","SHEET_HANDLE_NAME","SHEET_NAME","SHEET_OVERLAY_NAME","createSheet","createSheetScope","Handle","name","variants","open","true","opacity","pointerEvents","false","unstyled","height","borderRadius","backgroundColor","zIndex","marginHorizontal","marginBottom","hoverStyle","defaultVariants","process","env","TAMAGUI_HEADLESS","Overlay","fullscreen","position","Frame","flex","borderTopLeftRadius","borderTopRightRadius","width","maxHeight","overflow","Sheet"],"sources":["../../src/Sheet.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAA,QAAc;AACvB,SAASC,MAAA,EAAQC,MAAA,QAAc;AAE/B,SAASC,iBAAA,EAAmBC,UAAA,EAAYC,kBAAA,QAA0B;AAClE,SAASC,WAAA,QAAmB;AAE5B,SAASC,gBAAA,QAAw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AAqB;QACrBC,oBAAA,EAAsB;QACtBC,KAAA,EAAO;QACPC,SAAA,EAAW;QACXC,QAAA,EAAU;MACZ;IACF;EACF;EAEAb,eAAA,EAAiB;IACfR,QAAA,EAAUS,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;EAC7C;AACF,CAAC;AAEM,MAAMW,KAAA,GAAQhC,WAAA,CAAY;EAC/ByB,KAAA;EACAvB,MAAA;EACAoB;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Sheet.js","names":[],"sources":["esm/Sheet.js"],"sourcesContent":["import { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledHOC, styled } from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { resolveViewZIndex } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { XStack, YStack } from \"@tamagui/stacks\";\nimport { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { StackZIndexContext } from \"@tamagui/z-index-stack\";\nimport { useContext, useEffect, useMemo, useRef } from \"react\";\nimport { Platform } from \"react-native-web\";\nimport { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from \"./constants\";\nimport { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\n\nexport * from \"./types\"\n\nconst SheetHandleFrame = styled(XStack, {\n\tdisplayName: SHEET_HANDLE_NAME,\n\tvariants: { open: {\n\t\ttrue: { pointerEvents: \"auto\" },\n\t\tfalse: { pointerEvents: \"none\" }\n\t} }\n});\nconst SheetOverlayFrame = styled(YStack, {\n\tdisplayName: SHEET_OVERLAY_NAME,\n\tinset: 0,\n\tposition: \"absolute\",\n\tzIndex: 99999,\n\tpointerEvents: \"auto\",\n\tvariants: { open: {\n\t\ttrue: { pointerEvents: \"auto\" },\n\t\tfalse: { pointerEvents: \"none\" }\n\t} }\n});\nObject.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });\nconst SheetContainerFrame = styled(YStack, {\n\tdisplayName: SHEET_CONTAINER_NAME,\n\tflex: 1,\n\tposition: \"relative\",\n\tzIndex: 0,\n\twidth: \"100%\",\n\tmaxHeight: \"100%\"\n});\nconst SheetBackgroundFrame = styled(YStack, {\n\tdisplayName: SHEET_BACKGROUND_NAME,\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tright: 0,\n\tzIndex: -1,\n\tpointerEvents: \"none\"\n});\nconst SheetHandle = createStyledHOC(SheetHandleFrame, ({ scope, ...props }, forwardedRef) => {\n\tconst context = useSheetContext(scope);\n\tconst composedRef = useComposedRefs(context.handleRef, forwardedRef);\n\tconst wasDraggingRef = useRef(false);\n\tuseEffect(() => {\n\t\tif (!context.scrollBridge) return;\n\t\treturn context.scrollBridge.onParentDragging((isDragging) => {\n\t\t\tif (isDragging) wasDraggingRef.current = true;\n\t\t});\n\t}, [context.scrollBridge]);\n\tif (context.onlyShowContainer) return null;\n\treturn /* @__PURE__ */ jsx(SheetHandleFrame, {\n\t\tref: composedRef,\n\t\tonPressIn: () => {\n\t\t\twasDraggingRef.current = false;\n\t\t},\n\t\tonPress: () => {\n\t\t\tif (wasDraggingRef.current) {\n\t\t\t\twasDraggingRef.current = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n\t\t\tconst nextPos = (context.position + 1) % max;\n\t\t\tcontext.setPosition(nextPos);\n\t\t},\n\t\topen: context.open,\n\t\t...props\n\t});\n});\nconst SheetOverlay = createStyledHOC(SheetOverlayFrame, (propsIn, ref) => {\n\tconst { scope, ...props } = propsIn;\n\tconst context = useSheetContext(scope);\n\tconst isInOverlayLayer = useContext(SheetOverlayLayerContext);\n\tconst didWarn = useRef(false);\n\tif (context.onlyShowContainer) return null;\n\tif (!isInOverlayLayer) {\n\t\tif (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n\t\t\tdidWarn.current = true;\n\t\t\tconsole.error(\"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\");\n\t\t}\n\t\treturn null;\n\t}\n\treturn /* @__PURE__ */ jsx(SheetOverlayFrame, {\n\t\t...props,\n\t\tref,\n\t\tonPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? () => {\n\t\t\tcontext.setOpen(false);\n\t\t} : void 0)\n\t});\n});\nconst SheetContainer = createStyledHOC(SheetContainerFrame, ({ scope, adjustPaddingForOffscreenContent, children, ...props }, forwardedRef) => {\n\tconst context = useSheetContext(scope);\n\tconst { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;\n\tconst composedContentRef = useComposedRefs(forwardedRef, contentRef);\n\tconst offscreenSize = useSheetOffscreenSize(context);\n\tconst stableFrameSize = useRef(frameSize);\n\tuseEffect(() => {\n\t\tif (open && frameSize) stableFrameSize.current = frameSize;\n\t}, [open, frameSize]);\n\tconst sheetContents = useMemo(() => {\n\t\tconst shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n\t\treturn /* @__PURE__ */ jsxs(SheetContainerFrame, {\n\t\t\tref: composedContentRef,\n\t\t\tflex: hasFit && open ? 0 : 1,\n\t\t\tflexBasis: hasFit ? \"auto\" : void 0,\n\t\t\theight: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n\t\t\tpointerEvents: open ? \"auto\" : \"none\",\n\t\t\t\"data-state\": open ? \"open\" : \"closed\",\n\t\t\t...props,\n\t\t\tchildren: [/* @__PURE__ */ jsx(StackZIndexContext, {\n\t\t\t\tzIndex: resolveViewZIndex(props.zIndex),\n\t\t\t\tchildren\n\t\t\t}), adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, {\n\t\t\t\t\"data-sheet-offscreen-pad\": true,\n\t\t\t\theight: offscreenSize,\n\t\t\t\twidth: \"100%\"\n\t\t\t})]\n\t\t});\n\t}, [\n\t\topen,\n\t\tprops,\n\t\tframeSize,\n\t\toffscreenSize,\n\t\tadjustPaddingForOffscreenContent,\n\t\thasFit\n\t]);\n\treturn /* @__PURE__ */ jsx(RemoveScroll, {\n\t\tenabled: !disableRemoveScroll && context.open,\n\t\tchildren: sheetContents\n\t});\n});\nconst SheetBackground = createStyledHOC(SheetBackgroundFrame, ({ scope, disableHideBottomOverflow, ...props }, forwardedRef) => {\n\tconst context = useSheetContext(scope);\n\tconst bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n\treturn /* @__PURE__ */ jsx(SheetBackgroundFrame, {\n\t\tref: forwardedRef,\n\t\t\"data-sheet-background\": \"\",\n\t\tbottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n\t\t...props\n\t});\n});\nconst SheetRoot = createRefComponent(function SheetRoot2(props, ref) {\n\tconst hydrated = useDidFinishSSR();\n\tconst isAdapted = useAdaptIsActive();\n\tconst adaptContext = useAdaptContext();\n\tconst { isShowingNonSheet } = useSheetController(props.scope);\n\tconst isShowingAdaptNonSheet = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange) && !adaptContext.active && adaptContext.open;\n\tlet SheetImplementation = SheetImplementationCustom;\n\tif (props.native && Platform.OS === \"ios\") {}\n\tif (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) return null;\n\tconst implementation = /* @__PURE__ */ jsx(SheetImplementation, {\n\t\tref,\n\t\t...props\n\t});\n\treturn isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, {\n\t\tscroll: true,\n\t\toverlay: true,\n\t\tdismiss: true,\n\t\tchildren: implementation\n\t}) : implementation;\n});\nconst sheetParts = {\n\tContainer: SheetContainer,\n\tBackground: SheetBackground,\n\tOverlay: SheetOverlay,\n\tHandle: SheetHandle,\n\tScrollView: SheetScrollView\n};\nconst SheetControlled = withStaticProperties(SheetRoot, sheetParts);\nconst Sheet = withStaticProperties(SheetRoot, {\n\tRoot: SheetRoot,\n\tControlled: SheetControlled,\n\tuseAnimatedPosition,\n\t...sheetParts\n});\n\nexport { Sheet, SheetBackground, SheetContainer, SheetControlled, SheetHandle, SheetOverlay, SheetRoot };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,mBAAmB,OAAO,QAAQ;CACvC,aAAa;CACb,UAAU,EAAE,MAAM;EACjB,MAAM,EAAE,eAAe,OAAO;EAC9B,OAAO,EAAE,eAAe,OAAO;CAChC,EAAE;AACH,CAAC;AACD,MAAM,oBAAoB,OAAO,QAAQ;CACxC,aAAa;CACb,OAAO;CACP,UAAU;CACV,QAAQ;CACR,eAAe;CACf,UAAU,EAAE,MAAM;EACjB,MAAM,EAAE,eAAe,OAAO;EAC9B,OAAO,EAAE,eAAe,OAAO;CAChC,EAAE;AACH,CAAC;AACD,OAAO,OAAO,kBAAkB,cAAc,GAAG,uBAAuB,KAAK,CAAC;AAC9E,MAAM,sBAAsB,OAAO,QAAQ;CAC1C,aAAa;CACb,MAAM;CACN,UAAU;CACV,QAAQ;CACR,OAAO;CACP,WAAW;AACZ,CAAC;AACD,MAAM,uBAAuB,OAAO,QAAQ;CAC3C,aAAa;CACb,UAAU;CACV,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ,CAAC;CACT,eAAe;AAChB,CAAC;AACD,MAAM,cAAc,gBAAgB,mBAAmB,EAAE,OAAO,GAAG,SAAS,iBAAiB;CAC5F,MAAM,UAAU,gBAAgB,KAAK;CACrC,MAAM,cAAc,gBAA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KAAK;CACpE,MAAM,WAAW,gBAAgB;CACjC,MAAM,YAAY,iBAAiB;CACnC,MAAM,eAAe,gBAAgB;CACrC,MAAM,EAAE,sBAAsB,mBAAmB,MAAM,KAAK;CAC5D,MAAM,yBAAyB,QAAQ,aAAa,SAAS,KAAK,KAAK,aAAa,YAAY,KAAK,CAAC,aAAa,UAAU,aAAa;CAC1I,IAAI,sBAAsB;CAC1B,IAAI,MAAM,UAAU,SAAS,OAAO,OAAO,CAAC;CAC5C,IAAI,0BAA0B,qBAAqB,CAAC,UAAU,OAAO;CACrE,MAAM,iBAAiC,oBAAI,qBAAqB;EAC/D;EACA,GAAG;CACJ,CAAC;CACD,OAAO,YAA4B,oBAAI,mBAAmB;EACzD,QAAQ;EACR,SAAS;EACT,SAAS;EACT,UAAU;CACX,CAAC,IAAI;AACN,CAAC;AACD,MAAM,aAAa;CAClB,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY;AACb;AACA,MAAM,kBAAkB,qBAAqB,WAAW,UAAU;AAClE,MAAM,QAAQ,qBAAqB,WAAW;CAC7C,MAAM;CACN,YAAY;CACZ;CACA,GAAG;AACJ,CAAC"}
|
package/dist/esm/Sheet.native.js
CHANGED
|
@@ -1,89 +1,204 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from "@tamagui/adapt";
|
|
3
|
+
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
4
|
+
import { isWeb } from "@tamagui/constants";
|
|
5
|
+
import { View, createRefComponent, createStyledHOC, styled } from "@tamagui/core";
|
|
6
|
+
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
7
|
+
import { resolveViewZIndex } from "@tamagui/portal";
|
|
8
|
+
import { RemoveScroll } from "@tamagui/remove-scroll";
|
|
2
9
|
import { XStack, YStack } from "@tamagui/stacks";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
backgroundColor: "$background",
|
|
25
|
-
zIndex: 10,
|
|
26
|
-
marginHorizontal: "35%",
|
|
27
|
-
marginBottom: "$2",
|
|
28
|
-
opacity: 0.5,
|
|
29
|
-
hoverStyle: {
|
|
30
|
-
opacity: 0.7
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
defaultVariants: {
|
|
36
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
37
|
-
}
|
|
10
|
+
import { useDidFinishSSR } from "@tamagui/use-did-finish-ssr";
|
|
11
|
+
import { StackZIndexContext } from "@tamagui/z-index-stack";
|
|
12
|
+
import { useContext, useEffect, useMemo, useRef } from "react";
|
|
13
|
+
import { Platform } from "react-native";
|
|
14
|
+
import { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from "./constants.native.js";
|
|
15
|
+
import { getNativeSheet } from "./nativeSheet.native.js";
|
|
16
|
+
import { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from "./SheetContext.native.js";
|
|
17
|
+
import { SheetImplementationCustom } from "./SheetImplementationCustom.native.js";
|
|
18
|
+
import { SheetScrollView } from "./SheetScrollView.native.js";
|
|
19
|
+
import { useSheetController } from "./useSheetController.native.js";
|
|
20
|
+
import { useSheetOffscreenSize } from "./useSheetOffscreenSize.native.js";
|
|
21
|
+
import { getMaxViewportHeight } from "./webViewport.native.js";
|
|
22
|
+
|
|
23
|
+
export * from "./types.native.js"
|
|
24
|
+
|
|
25
|
+
var SheetHandleFrame = styled(XStack, {
|
|
26
|
+
displayName: SHEET_HANDLE_NAME,
|
|
27
|
+
variants: { open: {
|
|
28
|
+
true: { pointerEvents: "auto" },
|
|
29
|
+
false: { pointerEvents: "none" }
|
|
30
|
+
} }
|
|
38
31
|
});
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
unstyled: {
|
|
51
|
-
false: {
|
|
52
|
-
fullscreen: true,
|
|
53
|
-
position: "absolute",
|
|
54
|
-
backgroundColor: "$background",
|
|
55
|
-
zIndex: 1e5 - 1,
|
|
56
|
-
pointerEvents: "auto"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
defaultVariants: {
|
|
61
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
62
|
-
}
|
|
32
|
+
var SheetOverlayFrame = styled(YStack, {
|
|
33
|
+
displayName: SHEET_OVERLAY_NAME,
|
|
34
|
+
inset: 0,
|
|
35
|
+
position: "absolute",
|
|
36
|
+
zIndex: 99999,
|
|
37
|
+
pointerEvents: "auto",
|
|
38
|
+
variants: { open: {
|
|
39
|
+
true: { pointerEvents: "auto" },
|
|
40
|
+
false: { pointerEvents: "none" }
|
|
41
|
+
} }
|
|
63
42
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
borderTopRightRadius: "$true",
|
|
73
|
-
width: "100%",
|
|
74
|
-
maxHeight: "100%",
|
|
75
|
-
overflow: "hidden"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
defaultVariants: {
|
|
80
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
81
|
-
}
|
|
43
|
+
Object.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });
|
|
44
|
+
var SheetContainerFrame = styled(YStack, {
|
|
45
|
+
displayName: SHEET_CONTAINER_NAME,
|
|
46
|
+
flex: 1,
|
|
47
|
+
position: "relative",
|
|
48
|
+
zIndex: 0,
|
|
49
|
+
width: "100%",
|
|
50
|
+
maxHeight: "100%"
|
|
82
51
|
});
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
52
|
+
var SheetBackgroundFrame = styled(YStack, {
|
|
53
|
+
displayName: SHEET_BACKGROUND_NAME,
|
|
54
|
+
position: "absolute",
|
|
55
|
+
top: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
right: 0,
|
|
58
|
+
zIndex: -1,
|
|
59
|
+
pointerEvents: "none"
|
|
87
60
|
});
|
|
88
|
-
|
|
61
|
+
var SheetHandle = createStyledHOC(SheetHandleFrame, function(param, forwardedRef) {
|
|
62
|
+
var { scope, ...props } = param;
|
|
63
|
+
var context = useSheetContext(scope);
|
|
64
|
+
var composedRef = useComposedRefs(context.handleRef, forwardedRef);
|
|
65
|
+
var wasDraggingRef = useRef(false);
|
|
66
|
+
useEffect(function() {
|
|
67
|
+
if (!context.scrollBridge) return;
|
|
68
|
+
return context.scrollBridge.onParentDragging(function(isDragging) {
|
|
69
|
+
if (isDragging) wasDraggingRef.current = true;
|
|
70
|
+
});
|
|
71
|
+
}, [context.scrollBridge]);
|
|
72
|
+
if (context.onlyShowContainer) return null;
|
|
73
|
+
return /* @__PURE__ */ jsx(SheetHandleFrame, {
|
|
74
|
+
ref: composedRef,
|
|
75
|
+
onPressIn: function() {
|
|
76
|
+
wasDraggingRef.current = false;
|
|
77
|
+
},
|
|
78
|
+
onPress: function() {
|
|
79
|
+
if (wasDraggingRef.current) {
|
|
80
|
+
wasDraggingRef.current = false;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
var max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);
|
|
84
|
+
var nextPos = (context.position + 1) % max;
|
|
85
|
+
context.setPosition(nextPos);
|
|
86
|
+
},
|
|
87
|
+
open: context.open,
|
|
88
|
+
...props
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
var SheetOverlay = createStyledHOC(SheetOverlayFrame, function(propsIn, ref) {
|
|
92
|
+
var { scope, ...props } = propsIn;
|
|
93
|
+
var context = useSheetContext(scope);
|
|
94
|
+
var isInOverlayLayer = useContext(SheetOverlayLayerContext);
|
|
95
|
+
var didWarn = useRef(false);
|
|
96
|
+
if (context.onlyShowContainer) return null;
|
|
97
|
+
if (!isInOverlayLayer) {
|
|
98
|
+
if (process.env.NODE_ENV === "development" && !didWarn.current) {
|
|
99
|
+
didWarn.current = true;
|
|
100
|
+
console.error("Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.");
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return /* @__PURE__ */ jsx(SheetOverlayFrame, {
|
|
105
|
+
...props,
|
|
106
|
+
ref,
|
|
107
|
+
onPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? function() {
|
|
108
|
+
context.setOpen(false);
|
|
109
|
+
} : void 0)
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
var SheetContainer = createStyledHOC(SheetContainerFrame, function(param, forwardedRef) {
|
|
113
|
+
var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;
|
|
114
|
+
var context = useSheetContext(scope);
|
|
115
|
+
var { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;
|
|
116
|
+
var composedContentRef = useComposedRefs(forwardedRef, contentRef);
|
|
117
|
+
var offscreenSize = useSheetOffscreenSize(context);
|
|
118
|
+
var stableFrameSize = useRef(frameSize);
|
|
119
|
+
useEffect(function() {
|
|
120
|
+
if (open && frameSize) stableFrameSize.current = frameSize;
|
|
121
|
+
}, [open, frameSize]);
|
|
122
|
+
var sheetContents = useMemo(function() {
|
|
123
|
+
var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;
|
|
124
|
+
return /* @__PURE__ */ jsxs(SheetContainerFrame, {
|
|
125
|
+
ref: composedContentRef,
|
|
126
|
+
flex: hasFit && open ? 0 : 1,
|
|
127
|
+
flexBasis: hasFit ? "auto" : void 0,
|
|
128
|
+
height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
|
|
129
|
+
pointerEvents: open ? "auto" : "none",
|
|
130
|
+
"data-state": open ? "open" : "closed",
|
|
131
|
+
...props,
|
|
132
|
+
children: [/* @__PURE__ */ jsx(StackZIndexContext, {
|
|
133
|
+
zIndex: resolveViewZIndex(props.zIndex),
|
|
134
|
+
children
|
|
135
|
+
}), adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, {
|
|
136
|
+
"data-sheet-offscreen-pad": true,
|
|
137
|
+
height: offscreenSize,
|
|
138
|
+
width: "100%"
|
|
139
|
+
})]
|
|
140
|
+
});
|
|
141
|
+
}, [
|
|
142
|
+
open,
|
|
143
|
+
props,
|
|
144
|
+
frameSize,
|
|
145
|
+
offscreenSize,
|
|
146
|
+
adjustPaddingForOffscreenContent,
|
|
147
|
+
hasFit
|
|
148
|
+
]);
|
|
149
|
+
return /* @__PURE__ */ jsx(RemoveScroll, {
|
|
150
|
+
enabled: !disableRemoveScroll && context.open,
|
|
151
|
+
children: sheetContents
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
var SheetBackground = createStyledHOC(SheetBackgroundFrame, function(param, forwardedRef) {
|
|
155
|
+
var { scope, disableHideBottomOverflow, ...props } = param;
|
|
156
|
+
var context = useSheetContext(scope);
|
|
157
|
+
var bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;
|
|
158
|
+
return /* @__PURE__ */ jsx(SheetBackgroundFrame, {
|
|
159
|
+
ref: forwardedRef,
|
|
160
|
+
"data-sheet-background": "",
|
|
161
|
+
bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,
|
|
162
|
+
...props
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
var SheetRoot = createRefComponent(function SheetRoot2(props, ref) {
|
|
166
|
+
var hydrated = useDidFinishSSR();
|
|
167
|
+
var isAdapted = useAdaptIsActive();
|
|
168
|
+
var adaptContext = useAdaptContext();
|
|
169
|
+
var { isShowingNonSheet } = useSheetController(props.scope);
|
|
170
|
+
var isShowingAdaptNonSheet = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange) && !adaptContext.active && adaptContext.open;
|
|
171
|
+
var SheetImplementation = SheetImplementationCustom;
|
|
172
|
+
if (props.native && Platform.OS === "ios") {
|
|
173
|
+
var impl = getNativeSheet("ios");
|
|
174
|
+
if (impl) SheetImplementation = impl;
|
|
175
|
+
}
|
|
176
|
+
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) return null;
|
|
177
|
+
var implementation = /* @__PURE__ */ jsx(SheetImplementation, {
|
|
178
|
+
ref,
|
|
179
|
+
...props
|
|
180
|
+
});
|
|
181
|
+
return isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, {
|
|
182
|
+
scroll: true,
|
|
183
|
+
overlay: true,
|
|
184
|
+
dismiss: true,
|
|
185
|
+
children: implementation
|
|
186
|
+
}) : implementation;
|
|
187
|
+
});
|
|
188
|
+
var sheetParts = {
|
|
189
|
+
Container: SheetContainer,
|
|
190
|
+
Background: SheetBackground,
|
|
191
|
+
Overlay: SheetOverlay,
|
|
192
|
+
Handle: SheetHandle,
|
|
193
|
+
ScrollView: SheetScrollView
|
|
194
|
+
};
|
|
195
|
+
var SheetControlled = withStaticProperties(SheetRoot, sheetParts);
|
|
196
|
+
var Sheet = withStaticProperties(SheetRoot, {
|
|
197
|
+
Root: SheetRoot,
|
|
198
|
+
Controlled: SheetControlled,
|
|
199
|
+
useAnimatedPosition,
|
|
200
|
+
...sheetParts
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export { Sheet, SheetBackground, SheetContainer, SheetControlled, SheetHandle, SheetOverlay, SheetRoot };
|
|
89
204
|
//# sourceMappingURL=Sheet.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styled","XStack","YStack","SHEET_HANDLE_NAME","SHEET_NAME","SHEET_OVERLAY_NAME","createSheet","createSheetScope","Handle","name","variants","open","true","opacity","pointerEvents","false","unstyled","height","borderRadius","backgroundColor","zIndex","marginHorizontal","marginBottom","hoverStyle","defaultVariants","process","env","TAMAGUI_HEADLESS","Overlay","fullscreen","position","Frame","flex","borderTopLeftRadius","borderTopRightRadius","width","maxHeight","overflow","Sheet"],"sources":["../../src/Sheet.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAA,QAAc;AACvB,SAASC,MAAA,EAAQC,MAAA,QAAc;AAE/B,SAASC,iBAAA,EAAmBC,UAAA,EAAYC,kBAAA,QAA0B;AAClE,SAASC,WAAA,QAAmB;AAE5B,SAASC,gBAAA,QAAwB;AACjC,cAAc;AAMP,IAAAC,MAAM,GAAAR,MAAS,CAAAC,MAAO;EAC3BQ,IAAA,EAAMN,iBAAA;EAENO,QAAA,EAAU;IACRC,IAAA,EAAM;MACJC,IAAA,EAAM;QACJC,OAAA,EAAS;QACTC,aAAA,EAAe;MACjB;MACAC,KAAA,EAAO;QACLF,OAAA,EAAS;QACTC,aAAA,EAAe;MACjB;IACF;IAEAE,QAAA,EAAU;MACRD,KAAA,EAAO;QACLE,MAAA,EAAQ;QACRC,YAAA,EAAc;QACdC,eAAA,EAAiB;QACjBC,MAAA,EAAQ;QACRC,gBAAA,EAAkB;QAClBC,YAAA,EAAc;QACdT,OAAA,EAAS;QAETU,UAAA,EAAY;UACVV,OAAA,EAAS;QACX;MACF;IACF;EACF;EAEAW,eAAA,EAAiB;IACfR,QAAA,EAAUS,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;EAC7C;AACF,CAAC;AAMM,IAAAC,OAAM,GAAA5B,MAAU,CAAAE,MAAO;EAC5BO,IAAA,EAAMJ,kBAAA;EAENK,QAAA,EAAU;IACRC,IAAA,EAAM;MACJC,IAAA,EAAM;QACJE,aAAA,EAAe;MACjB;MACAC,KAAA,EAAO;QACLD,aAAA,EAAe;MACjB;IACF;IAEAE,QAAA,EAAU;MACRD,KAAA,EAAO;QACLc,UAAA,EAAY;QACZC,QAAA,EAAU;QACVX,eAAA,EAAiB;QACjBC,MAAA,EAAQ,MAAU;QAClBN,aAAA,EAAe;MACjB;IACF;EACF;EAEAU,eAAA,EAAiB;IACfR,QAAA,EAAUS,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;EAC7C;AACF,CAAC;AAMM,IAAAI,KAAM,GAAA/B,MAAQ,CAAAE,MAAO;EAC1BO,IAAA,EAAML,UAAA;EAENM,QAAA,EAAU;IACRM,QAAA,EAAU;MACRD,KAAA,EAAO;QACLiB,IAAA,EAAM;QACNb,eAAA,EAAiB;QACjBc,mBAAA,EAAqB;QACrBC,oBAAA,EAAsB;QACtBC,KAAA,EAAO;QACPC,SAAA,EAAW;QACXC,QAAA,EAAU;MACZ;IACF;EACF;EAEAb,eAAA,EAAiB;IACfR,QAAA,EAAUS,OAAA,CAAQC,GAAA,CAAIC,gBAAA,KAAqB;EAC7C;AACF,CAAC;AAEM,IAAAW,KAAM,GAAAhC,WAAQ;EACnByB,KAAA;EACAvB,MAAA;EACAoB;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Sheet.native.js","names":[],"sources":["esm/Sheet.native.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nimport { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledHOC, styled } from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { resolveViewZIndex } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { XStack, YStack } from \"@tamagui/stacks\";\nimport { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { StackZIndexContext } from \"@tamagui/z-index-stack\";\nimport { useContext, useEffect, useMemo, useRef } from \"react\";\nimport { Platform } from \"react-native\";\nimport { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from \"./constants\";\nimport { getNativeSheet } from \"./nativeSheet\";\nimport { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\n\nexport * from \"./types\"\n\nvar SheetHandleFrame = styled(XStack, {\n\tdisplayName: SHEET_HANDLE_NAME,\n\tvariants: { open: {\n\t\ttrue: { pointerEvents: \"auto\" },\n\t\tfalse: { pointerEvents: \"none\" }\n\t} }\n});\nvar SheetOverlayFrame = styled(YStack, {\n\tdisplayName: SHEET_OVERLAY_NAME,\n\tinset: 0,\n\tposition: \"absolute\",\n\tzIndex: 99999,\n\tpointerEvents: \"auto\",\n\tvariants: { open: {\n\t\ttrue: { pointerEvents: \"auto\" },\n\t\tfalse: { pointerEvents: \"none\" }\n\t} }\n});\nObject.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });\nvar SheetContainerFrame = styled(YStack, {\n\tdisplayName: SHEET_CONTAINER_NAME,\n\tflex: 1,\n\tposition: \"relative\",\n\tzIndex: 0,\n\twidth: \"100%\",\n\tmaxHeight: \"100%\"\n});\nvar SheetBackgroundFrame = styled(YStack, {\n\tdisplayName: SHEET_BACKGROUND_NAME,\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tright: 0,\n\tzIndex: -1,\n\tpointerEvents: \"none\"\n});\nvar SheetHandle = createStyledHOC(SheetHandleFrame, function(param, forwardedRef) {\n\tvar { scope, ...props } = param;\n\tvar context = useSheetContext(scope);\n\tvar composedRef = useComposedRefs(context.handleRef, forwardedRef);\n\tvar wasDraggingRef = useRef(false);\n\tuseEffect(function() {\n\t\tif (!context.scrollBridge) return;\n\t\treturn context.scrollBridge.onParentDragging(function(isDragging) {\n\t\t\tif (isDragging) wasDraggingRef.current = true;\n\t\t});\n\t}, [context.scrollBridge]);\n\tif (context.onlyShowContainer) return null;\n\treturn /* @__PURE__ */ jsx(SheetHandleFrame, {\n\t\tref: composedRef,\n\t\tonPressIn: function() {\n\t\t\twasDraggingRef.current = false;\n\t\t},\n\t\tonPress: function() {\n\t\t\tif (wasDraggingRef.current) {\n\t\t\t\twasDraggingRef.current = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n\t\t\tvar nextPos = (context.position + 1) % max;\n\t\t\tcontext.setPosition(nextPos);\n\t\t},\n\t\topen: context.open,\n\t\t...props\n\t});\n});\nvar SheetOverlay = createStyledHOC(SheetOverlayFrame, function(propsIn, ref) {\n\tvar { scope, ...props } = propsIn;\n\tvar context = useSheetContext(scope);\n\tvar isInOverlayLayer = useContext(SheetOverlayLayerContext);\n\tvar didWarn = useRef(false);\n\tif (context.onlyShowContainer) return null;\n\tif (!isInOverlayLayer) {\n\t\tif (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n\t\t\tdidWarn.current = true;\n\t\t\tconsole.error(\"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\");\n\t\t}\n\t\treturn null;\n\t}\n\treturn /* @__PURE__ */ jsx(SheetOverlayFrame, {\n\t\t...props,\n\t\tref,\n\t\tonPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? function() {\n\t\t\tcontext.setOpen(false);\n\t\t} : void 0)\n\t});\n});\nvar SheetContainer = createStyledHOC(SheetContainerFrame, function(param, forwardedRef) {\n\tvar { scope, adjustPaddingForOffscreenContent, children, ...props } = param;\n\tvar context = useSheetContext(scope);\n\tvar { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;\n\tvar composedContentRef = useComposedRefs(forwardedRef, contentRef);\n\tvar offscreenSize = useSheetOffscreenSize(context);\n\tvar stableFrameSize = useRef(frameSize);\n\tuseEffect(function() {\n\t\tif (open && frameSize) stableFrameSize.current = frameSize;\n\t}, [open, frameSize]);\n\tvar sheetContents = useMemo(function() {\n\t\tvar shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n\t\treturn /* @__PURE__ */ jsxs(SheetContainerFrame, {\n\t\t\tref: composedContentRef,\n\t\t\tflex: hasFit && open ? 0 : 1,\n\t\t\tflexBasis: hasFit ? \"auto\" : void 0,\n\t\t\theight: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n\t\t\tpointerEvents: open ? \"auto\" : \"none\",\n\t\t\t\"data-state\": open ? \"open\" : \"closed\",\n\t\t\t...props,\n\t\t\tchildren: [/* @__PURE__ */ jsx(StackZIndexContext, {\n\t\t\t\tzIndex: resolveViewZIndex(props.zIndex),\n\t\t\t\tchildren\n\t\t\t}), adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, {\n\t\t\t\t\"data-sheet-offscreen-pad\": true,\n\t\t\t\theight: offscreenSize,\n\t\t\t\twidth: \"100%\"\n\t\t\t})]\n\t\t});\n\t}, [\n\t\topen,\n\t\tprops,\n\t\tframeSize,\n\t\toffscreenSize,\n\t\tadjustPaddingForOffscreenContent,\n\t\thasFit\n\t]);\n\treturn /* @__PURE__ */ jsx(RemoveScroll, {\n\t\tenabled: !disableRemoveScroll && context.open,\n\t\tchildren: sheetContents\n\t});\n});\nvar SheetBackground = createStyledHOC(SheetBackgroundFrame, function(param, forwardedRef) {\n\tvar { scope, disableHideBottomOverflow, ...props } = param;\n\tvar context = useSheetContext(scope);\n\tvar bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n\treturn /* @__PURE__ */ jsx(SheetBackgroundFrame, {\n\t\tref: forwardedRef,\n\t\t\"data-sheet-background\": \"\",\n\t\tbottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n\t\t...props\n\t});\n});\nvar SheetRoot = createRefComponent(function SheetRoot2(props, ref) {\n\tvar hydrated = useDidFinishSSR();\n\tvar isAdapted = useAdaptIsActive();\n\tvar adaptContext = useAdaptContext();\n\tvar { isShowingNonSheet } = useSheetController(props.scope);\n\tvar isShowingAdaptNonSheet = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange) && !adaptContext.active && adaptContext.open;\n\tvar SheetImplementation = SheetImplementationCustom;\n\tif (props.native && Platform.OS === \"ios\") {\n\t\tvar impl = getNativeSheet(\"ios\");\n\t\tif (impl) SheetImplementation = impl;\n\t}\n\tif (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) return null;\n\tvar implementation = /* @__PURE__ */ jsx(SheetImplementation, {\n\t\tref,\n\t\t...props\n\t});\n\treturn isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, {\n\t\tscroll: true,\n\t\toverlay: true,\n\t\tdismiss: true,\n\t\tchildren: implementation\n\t}) : implementation;\n});\nvar sheetParts = {\n\tContainer: SheetContainer,\n\tBackground: SheetBackground,\n\tOverlay: SheetOverlay,\n\tHandle: SheetHandle,\n\tScrollView: SheetScrollView\n};\nvar SheetControlled = withStaticProperties(SheetRoot, sheetParts);\nvar Sheet = withStaticProperties(SheetRoot, {\n\tRoot: SheetRoot,\n\tControlled: SheetControlled,\n\tuseAnimatedPosition,\n\t...sheetParts\n});\n\nexport { Sheet, SheetBackground, SheetContainer, SheetControlled, SheetHandle, SheetOverlay, SheetRoot };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,mBAAmB,OAAO,QAAQ;CACrC,aAAa;CACb,UAAU,EAAE,MAAM;EAC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,oBAAI,qBAAqB;EAC7D;EACA,GAAG;CACJ,CAAC;CACD,OAAO,YAA4B,oBAAI,mBAAmB;EACzD,QAAQ;EACR,SAAS;EACT,SAAS;EACT,UAAU;CACX,CAAC,IAAI;AACN,CAAC;AACD,IAAI,aAAa;CAChB,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY;AACb;AACA,IAAI,kBAAkB,qBAAqB,WAAW,UAAU;AAChE,IAAI,QAAQ,qBAAqB,WAAW;CAC3C,MAAM;CACN,YAAY;CACZ;CACA,GAAG;AACJ,CAAC"}
|
|
@@ -1,6 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
1
|
+
import { createStyledContext } from "@tamagui/core";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
const SheetContext = createStyledContext({}, "Sheet__");
|
|
5
|
+
const { Provider: SheetProvider, useStyledContext: useSheetContext } = SheetContext;
|
|
6
|
+
const SheetOverlayLayerContext = React.createContext(false);
|
|
7
|
+
const SheetNativeSystemContext = React.createContext(false);
|
|
8
|
+
const SheetAnimatedPositionContext = React.createContext(null);
|
|
9
|
+
function useAnimatedPosition() {
|
|
10
|
+
const context = React.useContext(SheetAnimatedPositionContext);
|
|
11
|
+
const isNativeSystemSheet = React.useContext(SheetNativeSystemContext);
|
|
12
|
+
if (!context) {
|
|
13
|
+
if (isNativeSystemSheet) {
|
|
14
|
+
throw new Error("Sheet.useAnimatedPosition() is unavailable when Sheet uses the native iOS system sheet because UIKit does not expose its continuous position. Remove the `native` prop to use Tamagui's custom Sheet and animated position hooks.");
|
|
15
|
+
}
|
|
16
|
+
throw new Error("Sheet.useAnimatedPosition() must be used inside a <Sheet>. Render the component that calls it as a child of Sheet.");
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { SheetAnimatedPositionContext, SheetContext, SheetNativeSystemContext, SheetOverlayLayerContext, SheetProvider, useAnimatedPosition, useSheetContext };
|
|
6
22
|
//# sourceMappingURL=SheetContext.mjs.map
|