@tamagui/sheet 2.7.7 → 3.0.0-beta.1093.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/GestureSheetContext.cjs +28 -37
- package/dist/cjs/GestureSheetContext.native.cjs +48 -0
- package/dist/cjs/GestureSheetContext.native.js +29 -37
- package/dist/cjs/GestureSheetContext.native.js.map +1 -1
- package/dist/cjs/Sheet.cjs +220 -99
- package/dist/cjs/Sheet.native.cjs +245 -0
- package/dist/cjs/Sheet.native.js +223 -98
- package/dist/cjs/Sheet.native.js.map +1 -1
- package/dist/cjs/SheetContext.cjs +43 -22
- package/dist/cjs/SheetContext.native.cjs +57 -0
- package/dist/cjs/SheetContext.native.js +44 -22
- package/dist/cjs/SheetContext.native.js.map +1 -1
- package/dist/cjs/SheetController.cjs +49 -56
- package/dist/cjs/SheetController.native.cjs +71 -0
- package/dist/cjs/SheetController.native.js +52 -58
- package/dist/cjs/SheetController.native.js.map +1 -1
- package/dist/cjs/SheetDragSurface.cjs +50 -0
- package/dist/cjs/SheetDragSurface.native.cjs +61 -0
- package/dist/cjs/SheetDragSurface.native.js +63 -0
- package/dist/cjs/SheetDragSurface.native.js.map +1 -0
- package/dist/cjs/SheetImplementationCustom.cjs +664 -610
- package/dist/cjs/SheetImplementationCustom.native.cjs +748 -0
- package/dist/cjs/SheetImplementationCustom.native.js +704 -649
- 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 +21 -21
- package/dist/cjs/constants.native.cjs +36 -0
- package/dist/cjs/constants.native.js +21 -20
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/contexts.cjs +19 -28
- package/dist/cjs/contexts.native.cjs +37 -0
- package/dist/cjs/contexts.native.js +19 -27
- package/dist/cjs/contexts.native.js.map +1 -1
- package/dist/cjs/controller.cjs +16 -18
- package/dist/cjs/controller.native.cjs +31 -0
- package/dist/cjs/controller.native.js +16 -17
- package/dist/cjs/controller.native.js.map +1 -1
- package/dist/cjs/gestureState.cjs +28 -30
- package/dist/cjs/gestureState.native.cjs +53 -0
- package/dist/cjs/gestureState.native.js +29 -30
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/helpers.cjs +20 -24
- package/dist/cjs/helpers.native.cjs +34 -0
- package/dist/cjs/helpers.native.js +21 -24
- package/dist/cjs/helpers.native.js.map +1 -1
- package/dist/cjs/index.cjs +14 -21
- package/dist/cjs/index.native.cjs +36 -0
- package/dist/cjs/index.native.js +15 -21
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/keyboardAvoidance.cjs +55 -79
- package/dist/cjs/keyboardAvoidance.native.cjs +74 -0
- package/dist/cjs/keyboardAvoidance.native.js +55 -78
- package/dist/cjs/keyboardAvoidance.native.js.map +1 -1
- package/dist/cjs/nativeSheet.cjs +17 -86
- package/dist/cjs/nativeSheet.native.cjs +94 -0
- package/dist/cjs/nativeSheet.native.js +73 -86
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/stableViewportHeight.cjs +27 -0
- package/dist/cjs/stableViewportHeight.native.cjs +29 -0
- package/dist/cjs/stableViewportHeight.native.js +31 -0
- package/dist/cjs/stableViewportHeight.native.js.map +1 -0
- package/dist/cjs/types.cjs +9 -11
- package/dist/cjs/types.native.cjs +18 -0
- package/dist/cjs/types.native.js +9 -10
- package/dist/cjs/types.native.js.map +1 -1
- package/dist/cjs/useGestureHandlerPan.cjs +244 -257
- package/dist/cjs/useGestureHandlerPan.native.cjs +272 -0
- package/dist/cjs/useGestureHandlerPan.native.js +253 -265
- package/dist/cjs/useGestureHandlerPan.native.js.map +1 -1
- package/dist/cjs/useKeyboardControllerSheet.cjs +82 -88
- package/dist/cjs/useKeyboardControllerSheet.native.cjs +92 -0
- package/dist/cjs/useKeyboardControllerSheet.native.js +73 -111
- package/dist/cjs/useKeyboardControllerSheet.native.js.map +1 -1
- package/dist/cjs/useSafeAreaInsets.cjs +19 -26
- package/dist/cjs/useSafeAreaInsets.native.cjs +50 -0
- package/dist/cjs/useSafeAreaInsets.native.js +29 -25
- package/dist/cjs/useSafeAreaInsets.native.js.map +1 -1
- package/dist/cjs/useSheetController.cjs +26 -39
- package/dist/cjs/useSheetController.native.cjs +41 -0
- package/dist/cjs/useSheetController.native.js +27 -39
- package/dist/cjs/useSheetController.native.js.map +1 -1
- package/dist/cjs/useSheetOffscreenSize.cjs +43 -53
- package/dist/cjs/useSheetOffscreenSize.native.cjs +59 -0
- package/dist/cjs/useSheetOffscreenSize.native.js +47 -56
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/cjs/useSheetOpenState.cjs +68 -40
- package/dist/cjs/useSheetOpenState.native.cjs +87 -0
- package/dist/cjs/useSheetOpenState.native.js +73 -42
- package/dist/cjs/useSheetOpenState.native.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.cjs +145 -164
- package/dist/cjs/useSheetProviderProps.native.cjs +175 -0
- package/dist/cjs/useSheetProviderProps.native.js +155 -174
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetScrollViewGestures.cjs +171 -180
- package/dist/cjs/useSheetScrollViewGestures.native.cjs +149 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js +135 -147
- package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/cjs/webViewport.cjs +46 -48
- package/dist/cjs/webViewport.native.cjs +78 -0
- package/dist/cjs/webViewport.native.js +49 -50
- package/dist/cjs/webViewport.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 +207 -83
- package/dist/esm/Sheet.mjs.map +1 -1
- package/dist/esm/Sheet.native.js +210 -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/SheetDragSurface.mjs +25 -0
- package/dist/esm/SheetDragSurface.mjs.map +1 -0
- package/dist/esm/SheetDragSurface.native.js +34 -0
- package/dist/esm/SheetDragSurface.native.js.map +1 -0
- package/dist/esm/SheetImplementationCustom.mjs +647 -586
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +684 -618
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +278 -288
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +287 -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 +4 -70
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +60 -70
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/stableViewportHeight.mjs +8 -0
- package/dist/esm/stableViewportHeight.mjs.map +1 -0
- package/dist/esm/stableViewportHeight.native.js +8 -0
- package/dist/esm/stableViewportHeight.native.js.map +1 -0
- 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 +66 -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/GestureSheetContext.mjs +15 -20
- package/dist/jsx/GestureSheetContext.mjs.map +1 -1
- package/dist/jsx/GestureSheetContext.native.cjs +48 -0
- package/dist/jsx/GestureSheetContext.native.js +29 -37
- package/dist/jsx/GestureSheetContext.native.js.map +1 -1
- package/dist/jsx/Sheet.mjs +207 -83
- package/dist/jsx/Sheet.mjs.map +1 -1
- package/dist/jsx/Sheet.native.cjs +245 -0
- package/dist/jsx/Sheet.native.js +223 -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 +57 -0
- package/dist/jsx/SheetContext.native.js +44 -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 +71 -0
- package/dist/jsx/SheetController.native.js +52 -58
- package/dist/jsx/SheetController.native.js.map +1 -1
- package/dist/jsx/SheetDragSurface.mjs +25 -0
- package/dist/jsx/SheetDragSurface.mjs.map +1 -0
- package/dist/jsx/SheetDragSurface.native.cjs +61 -0
- package/dist/jsx/SheetDragSurface.native.js +63 -0
- package/dist/jsx/SheetDragSurface.native.js.map +1 -0
- package/dist/jsx/SheetImplementationCustom.mjs +647 -586
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.cjs +748 -0
- package/dist/jsx/SheetImplementationCustom.native.js +704 -649
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +278 -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 +36 -0
- package/dist/jsx/constants.native.js +21 -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 +37 -0
- package/dist/jsx/contexts.native.js +19 -27
- package/dist/jsx/contexts.native.js.map +1 -1
- package/dist/jsx/controller.mjs +2 -2
- package/dist/jsx/controller.native.cjs +31 -0
- package/dist/jsx/controller.native.js +16 -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 +53 -0
- package/dist/jsx/gestureState.native.js +29 -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 +34 -0
- package/dist/jsx/helpers.native.js +21 -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 +36 -0
- package/dist/jsx/index.native.js +15 -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 +74 -0
- package/dist/jsx/keyboardAvoidance.native.js +55 -78
- package/dist/jsx/keyboardAvoidance.native.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +4 -70
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.cjs +94 -0
- package/dist/jsx/nativeSheet.native.js +73 -86
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/stableViewportHeight.mjs +8 -0
- package/dist/jsx/stableViewportHeight.mjs.map +1 -0
- package/dist/jsx/stableViewportHeight.native.cjs +29 -0
- package/dist/jsx/stableViewportHeight.native.js +31 -0
- package/dist/jsx/stableViewportHeight.native.js.map +1 -0
- package/dist/jsx/types.mjs +0 -2
- package/dist/jsx/types.native.cjs +18 -0
- package/dist/jsx/types.native.js +9 -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 +272 -0
- package/dist/jsx/useGestureHandlerPan.native.js +253 -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 +92 -0
- package/dist/jsx/useKeyboardControllerSheet.native.js +73 -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 +50 -0
- package/dist/jsx/useSafeAreaInsets.native.js +29 -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 +41 -0
- package/dist/jsx/useSheetController.native.js +27 -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 +59 -0
- package/dist/jsx/useSheetOffscreenSize.native.js +47 -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 +87 -0
- package/dist/jsx/useSheetOpenState.native.js +73 -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 +175 -0
- package/dist/jsx/useSheetProviderProps.native.js +155 -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 +149 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js +135 -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 +78 -0
- package/dist/jsx/webViewport.native.js +49 -50
- package/dist/jsx/webViewport.native.js.map +1 -1
- package/package.json +38 -40
- package/src/Sheet.tsx +314 -77
- package/src/SheetContext.tsx +57 -7
- package/src/SheetController.tsx +7 -6
- package/src/SheetDragSurface.native.tsx +42 -0
- package/src/SheetDragSurface.tsx +40 -0
- package/src/SheetImplementationCustom.tsx +364 -181
- package/src/SheetScrollView.tsx +36 -20
- package/src/constants.tsx +3 -3
- package/src/helpers.tsx +0 -14
- package/src/index.ts +3 -6
- package/src/{nativeSheet.tsx → nativeSheet.native.tsx} +9 -20
- package/src/nativeSheet.ts +19 -0
- package/src/stableViewportHeight.native.ts +9 -0
- package/src/stableViewportHeight.ts +15 -0
- package/src/types.tsx +122 -92
- package/src/useKeyboardControllerSheet.native.ts +10 -39
- 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/GestureSheetContext.d.ts +1 -1
- package/types/GestureSheetContext.d.ts.map +1 -1
- package/types/Sheet.d.ts +247 -151
- 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/SheetDragSurface.d.ts +11 -0
- package/types/SheetDragSurface.d.ts.map +1 -0
- package/types/SheetDragSurface.native.d.ts +11 -0
- package/types/SheetDragSurface.native.d.ts.map +1 -0
- package/types/SheetImplementationCustom.d.ts +4 -36
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +21 -38
- 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 +8 -8
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/nativeSheet.native.d.ts +5 -0
- package/types/nativeSheet.native.d.ts.map +1 -0
- package/types/stableViewportHeight.d.ts +12 -0
- package/types/stableViewportHeight.d.ts.map +1 -0
- package/types/stableViewportHeight.native.d.ts +6 -0
- package/types/stableViewportHeight.native.d.ts.map +1 -0
- package/types/types.d.ts +43 -17
- package/types/types.d.ts.map +1 -1
- package/types/useKeyboardControllerSheet.native.d.ts +6 -6
- 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/GestureDetectorWrapper.cjs +0 -54
- package/dist/cjs/GestureDetectorWrapper.native.js +0 -58
- package/dist/cjs/GestureDetectorWrapper.native.js.map +0 -1
- 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/GestureDetectorWrapper.mjs +0 -29
- package/dist/esm/GestureDetectorWrapper.mjs.map +0 -1
- package/dist/esm/GestureDetectorWrapper.native.js +0 -30
- package/dist/esm/GestureDetectorWrapper.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/GestureDetectorWrapper.mjs +0 -29
- package/dist/jsx/GestureDetectorWrapper.mjs.map +0 -1
- package/dist/jsx/GestureDetectorWrapper.native.js +0 -58
- package/dist/jsx/GestureDetectorWrapper.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/GestureDetectorWrapper.tsx +0 -38
- 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/GestureDetectorWrapper.d.ts +0 -14
- package/types/GestureDetectorWrapper.d.ts.map +0 -1
- 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
|
@@ -5,77 +5,76 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
12
|
};
|
|
13
13
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
22
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
23
|
var webViewport_exports = {};
|
|
26
24
|
__export(webViewport_exports, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
MIN_KEYBOARD_HEIGHT: () => MIN_KEYBOARD_HEIGHT,
|
|
26
|
+
getMaxViewportHeight: () => getMaxViewportHeight,
|
|
27
|
+
getStableLayoutViewportHeight: () => getStableLayoutViewportHeight,
|
|
28
|
+
getWebKeyboardBottomInset: () => getWebKeyboardBottomInset,
|
|
29
|
+
getWebKeyboardHeight: () => getWebKeyboardHeight,
|
|
30
|
+
getWebKeyboardResizeHeight: () => getWebKeyboardResizeHeight,
|
|
31
|
+
getWebVisualViewportOffsetTop: () => getWebVisualViewportOffsetTop,
|
|
32
|
+
isEditableElement: () => isEditableElement
|
|
35
33
|
});
|
|
36
34
|
module.exports = __toCommonJS(webViewport_exports);
|
|
37
35
|
var MIN_KEYBOARD_HEIGHT = 80;
|
|
38
36
|
function isEditableElement(el) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
if (!el) return false;
|
|
38
|
+
var tag = el.tagName;
|
|
39
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
|
|
40
|
+
if (el.isContentEditable) return true;
|
|
41
|
+
return false;
|
|
44
42
|
}
|
|
45
43
|
function getStableLayoutViewportHeight() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
var _document_documentElement, _window_visualViewport;
|
|
45
|
+
if (typeof window === "undefined") return 0;
|
|
46
|
+
var ch = typeof document !== "undefined" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;
|
|
47
|
+
if (ch && ch > 0) return ch;
|
|
48
|
+
return Math.max(window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0);
|
|
51
49
|
}
|
|
52
50
|
var _maxViewportHeight = 0;
|
|
53
51
|
function getMaxViewportHeight() {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
var _document_documentElement, _window_visualViewport, _window_screen;
|
|
53
|
+
if (typeof window === "undefined") return 0;
|
|
54
|
+
var ch = typeof document !== "undefined" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;
|
|
55
|
+
_maxViewportHeight = Math.max(_maxViewportHeight, ch || 0, window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0, ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.height) || 0);
|
|
56
|
+
return _maxViewportHeight;
|
|
59
57
|
}
|
|
60
58
|
function getWebKeyboardResizeHeight() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
if (typeof window === "undefined") return 0;
|
|
60
|
+
var vv = window.visualViewport;
|
|
61
|
+
if (!vv) return 0;
|
|
62
|
+
return Math.max(0, Math.round(getStableLayoutViewportHeight() - vv.height));
|
|
65
63
|
}
|
|
66
64
|
function getWebVisualViewportOffsetTop() {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
var _window_visualViewport;
|
|
66
|
+
if (typeof window === "undefined") return 0;
|
|
67
|
+
return Math.max(0, Math.round(((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.offsetTop) || 0));
|
|
70
68
|
}
|
|
71
69
|
function getWebKeyboardBottomInset() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
if (typeof window === "undefined") return 0;
|
|
71
|
+
var vv = window.visualViewport;
|
|
72
|
+
if (!vv) return 0;
|
|
73
|
+
var visibleBottom = getWebVisualViewportOffsetTop() + vv.height;
|
|
74
|
+
return Math.max(0, Math.round(getStableLayoutViewportHeight() - visibleBottom));
|
|
77
75
|
}
|
|
78
76
|
function getWebKeyboardHeight() {
|
|
79
|
-
|
|
77
|
+
return getWebKeyboardResizeHeight();
|
|
80
78
|
}
|
|
79
|
+
|
|
81
80
|
//# sourceMappingURL=webViewport.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"webViewport.native.js","names":[],"sources":["cjs/webViewport.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar webViewport_exports = {};\n__export(webViewport_exports, {\n MIN_KEYBOARD_HEIGHT: () => MIN_KEYBOARD_HEIGHT,\n getMaxViewportHeight: () => getMaxViewportHeight,\n getStableLayoutViewportHeight: () => getStableLayoutViewportHeight,\n getWebKeyboardBottomInset: () => getWebKeyboardBottomInset,\n getWebKeyboardHeight: () => getWebKeyboardHeight,\n getWebKeyboardResizeHeight: () => getWebKeyboardResizeHeight,\n getWebVisualViewportOffsetTop: () => getWebVisualViewportOffsetTop,\n isEditableElement: () => isEditableElement\n});\nmodule.exports = __toCommonJS(webViewport_exports);\nvar MIN_KEYBOARD_HEIGHT = 80;\nfunction isEditableElement(el) {\n if (!el) return false;\n var tag = el.tagName;\n if (tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\") return true;\n if (el.isContentEditable) return true;\n return false;\n}\nfunction getStableLayoutViewportHeight() {\n var _document_documentElement, _window_visualViewport;\n if (typeof window === \"undefined\") return 0;\n var ch = typeof document !== \"undefined\" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;\n if (ch && ch > 0) return ch;\n return Math.max(window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0);\n}\nvar _maxViewportHeight = 0;\nfunction getMaxViewportHeight() {\n var _document_documentElement, _window_visualViewport, _window_screen;\n if (typeof window === \"undefined\") return 0;\n var ch = typeof document !== \"undefined\" ? (_document_documentElement = document.documentElement) === null || _document_documentElement === void 0 ? void 0 : _document_documentElement.clientHeight : 0;\n _maxViewportHeight = Math.max(_maxViewportHeight, ch || 0, window.innerHeight || 0, ((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.height) || 0, ((_window_screen = window.screen) === null || _window_screen === void 0 ? void 0 : _window_screen.height) || 0);\n return _maxViewportHeight;\n}\nfunction getWebKeyboardResizeHeight() {\n if (typeof window === \"undefined\") return 0;\n var vv = window.visualViewport;\n if (!vv) return 0;\n return Math.max(0, Math.round(getStableLayoutViewportHeight() - vv.height));\n}\nfunction getWebVisualViewportOffsetTop() {\n var _window_visualViewport;\n if (typeof window === \"undefined\") return 0;\n return Math.max(0, Math.round(((_window_visualViewport = window.visualViewport) === null || _window_visualViewport === void 0 ? void 0 : _window_visualViewport.offsetTop) || 0));\n}\nfunction getWebKeyboardBottomInset() {\n if (typeof window === \"undefined\") return 0;\n var vv = window.visualViewport;\n if (!vv) return 0;\n var visibleBottom = getWebVisualViewportOffsetTop() + vv.height;\n return Math.max(0, Math.round(getStableLayoutViewportHeight() - visibleBottom));\n}\nfunction getWebKeyboardHeight() {\n return getWebKeyboardResizeHeight();\n}\n//# sourceMappingURL=webViewport.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,sBAAsB,CAAC;AAC3B,SAAS,qBAAqB;CAC5B,2BAA2B;CAC3B,4BAA4B;CAC5B,qCAAqC;CACrC,iCAAiC;CACjC,4BAA4B;CAC5B,kCAAkC;CAClC,qCAAqC;CACrC,yBAAyB;AAC3B,CAAC;AACD,OAAO,UAAU,aAAa,mBAAmB;AACjD,IAAI,sBAAsB;AAC1B,SAAS,kBAAkB,IAAI;CAC7B,IAAI,CAAC,IAAI,OAAO;CAChB,IAAI,MAAM,GAAG;CACb,IAAI,QAAQ,WAAW,QAAQ,cAAc,QAAQ,UAAU,OAAO;CACtE,IAAI,GAAG,mBAAmB,OAAO;CACjC,OAAO;AACT;AACA,SAAS,gCAAgC;CACvC,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,WAAW,aAAa,OAAO;CAC1C,IAAI,KAAK,OAAO;CAChB,IAAI,CAAC,IAAI,OAAO;CAChB,IAAI,gBAAgB,8BAA8B,IAAI,GAAG;CACzD,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,8BAA8B,IAAI,aAAa,CAAC;AAChF;AACA,SAAS,uBAAuB;CAC9B,OAAO,2BAA2B;AACpC"}
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
3
4
|
const GestureSheetContext = createContext(null);
|
|
4
5
|
function useGestureSheetContext() {
|
|
5
|
-
|
|
6
|
+
return useContext(GestureSheetContext);
|
|
6
7
|
}
|
|
7
|
-
function GestureSheetProvider({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
blockPan,
|
|
20
|
-
setBlockPan
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */jsx(GestureSheetContext.Provider, {
|
|
23
|
-
value,
|
|
24
|
-
children
|
|
25
|
-
});
|
|
8
|
+
function GestureSheetProvider({ children, isDragging, blockPan, setBlockPan, panGesture, panGestureRef }) {
|
|
9
|
+
const value = {
|
|
10
|
+
panGesture,
|
|
11
|
+
panGestureRef,
|
|
12
|
+
isDragging,
|
|
13
|
+
blockPan,
|
|
14
|
+
setBlockPan
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ jsx(GestureSheetContext.Provider, {
|
|
17
|
+
value,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
26
20
|
}
|
|
21
|
+
|
|
27
22
|
export { GestureSheetProvider, useGestureSheetContext };
|
|
28
23
|
//# sourceMappingURL=GestureSheetContext.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"GestureSheetContext.js","names":[],"sources":["esm/GestureSheetContext.js"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst GestureSheetContext = createContext(null);\nfunction useGestureSheetContext() {\n return useContext(GestureSheetContext);\n}\nfunction GestureSheetProvider({\n children,\n isDragging,\n blockPan,\n setBlockPan,\n panGesture,\n panGestureRef\n}) {\n const value = {\n panGesture,\n panGestureRef,\n isDragging,\n blockPan,\n setBlockPan\n };\n return /* @__PURE__ */ jsx(GestureSheetContext.Provider, { value, children });\n}\nexport {\n GestureSheetProvider,\n useGestureSheetContext\n};\n//# sourceMappingURL=GestureSheetContext.js.map\n"],"mappings":";;;;AAEA,MAAM,sBAAsB,cAAc,IAAI;AAC9C,SAAS,yBAAyB;CAChC,OAAO,WAAW,mBAAmB;AACvC;AACA,SAAS,qBAAqB,EAC5B,UACA,YACA,UACA,aACA,YACA,iBACC;CACD,MAAM,QAAQ;EACZ;EACA;EACA;EACA;EACA;CACF;CACA,OAAuB,oBAAI,oBAAoB,UAAU;EAAE;EAAO;CAAS,CAAC;AAC9E"}
|
|
@@ -1,29 +1,24 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
var GestureSheetContext = /* @__PURE__ */ createContext(null);
|
|
4
5
|
function useGestureSheetContext() {
|
|
5
|
-
|
|
6
|
+
return useContext(GestureSheetContext);
|
|
6
7
|
}
|
|
7
8
|
function GestureSheetProvider(param) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
blockPan,
|
|
21
|
-
setBlockPan
|
|
22
|
-
};
|
|
23
|
-
return /* @__PURE__ */_jsx(GestureSheetContext.Provider, {
|
|
24
|
-
value,
|
|
25
|
-
children
|
|
26
|
-
});
|
|
9
|
+
var { children, isDragging, blockPan, setBlockPan, panGesture, panGestureRef } = param;
|
|
10
|
+
var value = {
|
|
11
|
+
panGesture,
|
|
12
|
+
panGestureRef,
|
|
13
|
+
isDragging,
|
|
14
|
+
blockPan,
|
|
15
|
+
setBlockPan
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsx(GestureSheetContext.Provider, {
|
|
18
|
+
value,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
27
21
|
}
|
|
22
|
+
|
|
28
23
|
export { GestureSheetProvider, useGestureSheetContext };
|
|
29
24
|
//# sourceMappingURL=GestureSheetContext.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"GestureSheetContext.native.js","names":[],"sources":["esm/GestureSheetContext.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { createContext, useContext } from \"react\";\nvar GestureSheetContext = /* @__PURE__ */ createContext(null);\nfunction useGestureSheetContext() {\n return useContext(GestureSheetContext);\n}\nfunction GestureSheetProvider(param) {\n var { children, isDragging, blockPan, setBlockPan, panGesture, panGestureRef } = param;\n var value = {\n panGesture,\n panGestureRef,\n isDragging,\n blockPan,\n setBlockPan\n };\n return /* @__PURE__ */ _jsx(GestureSheetContext.Provider, {\n value,\n children\n });\n}\nexport {\n GestureSheetProvider,\n useGestureSheetContext\n};\n//# sourceMappingURL=GestureSheetContext.js.map\n"],"mappings":";;;;AAEA,IAAI,sBAAsC,8BAAc,IAAI;AAC5D,SAAS,yBAAyB;CAChC,OAAO,WAAW,mBAAmB;AACvC;AACA,SAAS,qBAAqB,OAAO;CACnC,IAAI,EAAE,UAAU,YAAY,UAAU,aAAa,YAAY,kBAAkB;CACjF,IAAI,QAAQ;EACV;EACA;EACA;EACA;EACA;CACF;CACA,OAAuB,oBAAK,oBAAoB,UAAU;EACxD;EACA;CACF,CAAC;AACH"}
|
package/dist/esm/Sheet.mjs
CHANGED
|
@@ -1,89 +1,213 @@
|
|
|
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 { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from "./constants.mjs";
|
|
13
|
+
import { getNativeSheet } from "./nativeSheet.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: 1e5 - 1,
|
|
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) {
|
|
68
|
+
wasDraggingRef.current = true;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}, [context.scrollBridge]);
|
|
72
|
+
if (context.onlyShowContainer) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return /* @__PURE__ */ jsx(SheetHandleFrame, {
|
|
76
|
+
ref: composedRef,
|
|
77
|
+
onPressIn: () => {
|
|
78
|
+
wasDraggingRef.current = false;
|
|
79
|
+
},
|
|
80
|
+
onPress: () => {
|
|
81
|
+
if (wasDraggingRef.current) {
|
|
82
|
+
wasDraggingRef.current = false;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);
|
|
86
|
+
const nextPos = (context.position + 1) % max;
|
|
87
|
+
context.setPosition(nextPos);
|
|
88
|
+
},
|
|
89
|
+
open: context.open,
|
|
90
|
+
...props
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
const SheetOverlay = createStyledHOC(SheetOverlayFrame, (propsIn, ref) => {
|
|
94
|
+
const { scope, ...props } = propsIn;
|
|
95
|
+
const context = useSheetContext(scope);
|
|
96
|
+
const isInOverlayLayer = useContext(SheetOverlayLayerContext);
|
|
97
|
+
const didWarn = useRef(false);
|
|
98
|
+
if (context.onlyShowContainer) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
if (!isInOverlayLayer) {
|
|
102
|
+
if (process.env.NODE_ENV === "development" && !didWarn.current) {
|
|
103
|
+
didWarn.current = true;
|
|
104
|
+
console.error("Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.");
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
return /* @__PURE__ */ jsx(SheetOverlayFrame, {
|
|
109
|
+
...props,
|
|
110
|
+
ref,
|
|
111
|
+
onPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? () => {
|
|
112
|
+
context.setOpen(false);
|
|
113
|
+
} : void 0)
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
const SheetContainer = createStyledHOC(SheetContainerFrame, ({ scope, adjustPaddingForOffscreenContent, children, ...props }, forwardedRef) => {
|
|
117
|
+
const context = useSheetContext(scope);
|
|
118
|
+
const { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;
|
|
119
|
+
const composedContentRef = useComposedRefs(forwardedRef, contentRef);
|
|
120
|
+
const offscreenSize = useSheetOffscreenSize(context);
|
|
121
|
+
const stableFrameSize = useRef(frameSize);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (open && frameSize) {
|
|
124
|
+
stableFrameSize.current = frameSize;
|
|
125
|
+
}
|
|
126
|
+
}, [open, frameSize]);
|
|
127
|
+
const sheetContents = useMemo(() => {
|
|
128
|
+
const shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;
|
|
129
|
+
return /* @__PURE__ */ jsxs(SheetContainerFrame, {
|
|
130
|
+
ref: composedContentRef,
|
|
131
|
+
flex: hasFit && open ? 0 : 1,
|
|
132
|
+
flexBasis: hasFit ? "auto" : void 0,
|
|
133
|
+
height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
|
|
134
|
+
pointerEvents: open ? "auto" : "none",
|
|
135
|
+
"data-state": open ? "open" : "closed",
|
|
136
|
+
...props,
|
|
137
|
+
children: [/* @__PURE__ */ jsx(StackZIndexContext, {
|
|
138
|
+
zIndex: resolveViewZIndex(props.zIndex),
|
|
139
|
+
children
|
|
140
|
+
}), adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, {
|
|
141
|
+
"data-sheet-offscreen-pad": true,
|
|
142
|
+
height: offscreenSize,
|
|
143
|
+
width: "100%"
|
|
144
|
+
})]
|
|
145
|
+
});
|
|
146
|
+
}, [
|
|
147
|
+
open,
|
|
148
|
+
props,
|
|
149
|
+
frameSize,
|
|
150
|
+
offscreenSize,
|
|
151
|
+
adjustPaddingForOffscreenContent,
|
|
152
|
+
hasFit
|
|
153
|
+
]);
|
|
154
|
+
return /* @__PURE__ */ jsx(RemoveScroll, {
|
|
155
|
+
enabled: !disableRemoveScroll && context.open,
|
|
156
|
+
children: sheetContents
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
const SheetBackground = createStyledHOC(SheetBackgroundFrame, ({ scope, disableHideBottomOverflow, ...props }, forwardedRef) => {
|
|
160
|
+
const context = useSheetContext(scope);
|
|
161
|
+
const bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;
|
|
162
|
+
return /* @__PURE__ */ jsx(SheetBackgroundFrame, {
|
|
163
|
+
ref: forwardedRef,
|
|
164
|
+
"data-sheet-background": "",
|
|
165
|
+
bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,
|
|
166
|
+
...props
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
const SheetRoot = createRefComponent(function SheetRoot2(props, ref) {
|
|
170
|
+
const hydrated = useDidFinishSSR();
|
|
171
|
+
const isAdapted = useAdaptIsActive();
|
|
172
|
+
const adaptContext = useAdaptContext();
|
|
173
|
+
const { isShowingNonSheet } = useSheetController(props.scope);
|
|
174
|
+
const shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);
|
|
175
|
+
const isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;
|
|
176
|
+
let SheetImplementation = SheetImplementationCustom;
|
|
177
|
+
if (props.native) {
|
|
178
|
+
const impl = getNativeSheet("ios");
|
|
179
|
+
if (impl) {
|
|
180
|
+
SheetImplementation = impl;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const implementation = /* @__PURE__ */ jsx(SheetImplementation, {
|
|
187
|
+
ref,
|
|
188
|
+
...props
|
|
189
|
+
});
|
|
190
|
+
return isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, {
|
|
191
|
+
scroll: true,
|
|
192
|
+
overlay: true,
|
|
193
|
+
dismiss: true,
|
|
194
|
+
children: implementation
|
|
195
|
+
}) : implementation;
|
|
196
|
+
});
|
|
197
|
+
const sheetParts = {
|
|
198
|
+
Container: SheetContainer,
|
|
199
|
+
Background: SheetBackground,
|
|
200
|
+
Overlay: SheetOverlay,
|
|
201
|
+
Handle: SheetHandle,
|
|
202
|
+
ScrollView: SheetScrollView
|
|
203
|
+
};
|
|
204
|
+
const SheetControlled = withStaticProperties(SheetRoot, sheetParts);
|
|
205
|
+
const Sheet = withStaticProperties(SheetRoot, {
|
|
206
|
+
Root: SheetRoot,
|
|
207
|
+
Controlled: SheetControlled,
|
|
208
|
+
useAnimatedPosition,
|
|
209
|
+
...sheetParts
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
export { Sheet, SheetBackground, SheetContainer, SheetControlled, SheetHandle, SheetOverlay, SheetRoot };
|
|
89
213
|
//# 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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AA,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,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 {\n createRefComponent,\n createStyledHOC,\n styled,\n View\n} 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 {\n SHEET_BACKGROUND_NAME,\n SHEET_CONTAINER_NAME,\n SHEET_HANDLE_NAME,\n SHEET_OVERLAY_MARKER,\n SHEET_OVERLAY_NAME\n} from \"./constants\";\nimport { getNativeSheet } from \"./nativeSheet\";\nimport {\n SheetOverlayLayerContext,\n useAnimatedPosition,\n useSheetContext\n} from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\nexport * from \"./types\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst SheetHandleFrame = styled(XStack, {\n displayName: SHEET_HANDLE_NAME,\n // the behavior Handle ships no opacity rules; open/close aesthetics (fade in\n // when open, dim when idle) live in the copied skin. see the canonical skin.\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nconst SheetOverlayFrame = styled(YStack, {\n displayName: SHEET_OVERLAY_NAME,\n inset: 0,\n position: \"absolute\",\n zIndex: 1e5 - 1,\n pointerEvents: \"auto\",\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nObject.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });\nconst SheetContainerFrame = styled(YStack, {\n displayName: SHEET_CONTAINER_NAME,\n flex: 1,\n position: \"relative\",\n zIndex: 0,\n width: \"100%\",\n maxHeight: \"100%\"\n});\nconst SheetBackgroundFrame = styled(YStack, {\n displayName: SHEET_BACKGROUND_NAME,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n zIndex: -1,\n pointerEvents: \"none\"\n});\nconst SheetHandle = createStyledHOC(\n SheetHandleFrame,\n ({ scope, ...props }, forwardedRef) => {\n const context = useSheetContext(scope);\n const composedRef = useComposedRefs(context.handleRef, forwardedRef);\n const wasDraggingRef = useRef(false);\n useEffect(() => {\n if (!context.scrollBridge) return;\n return context.scrollBridge.onParentDragging((isDragging) => {\n if (isDragging) {\n wasDraggingRef.current = true;\n }\n });\n }, [context.scrollBridge]);\n if (context.onlyShowContainer) {\n return null;\n }\n return /* @__PURE__ */ jsx(\n SheetHandleFrame,\n {\n ref: composedRef,\n onPressIn: () => {\n wasDraggingRef.current = false;\n },\n onPress: () => {\n if (wasDraggingRef.current) {\n wasDraggingRef.current = false;\n return;\n }\n const max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n const nextPos = (context.position + 1) % max;\n context.setPosition(nextPos);\n },\n open: context.open,\n ...props\n }\n );\n }\n);\nconst SheetOverlay = createStyledHOC(\n SheetOverlayFrame,\n (propsIn, ref) => {\n const { scope, ...props } = propsIn;\n const context = useSheetContext(scope);\n const isInOverlayLayer = useContext(SheetOverlayLayerContext);\n const didWarn = useRef(false);\n if (context.onlyShowContainer) {\n return null;\n }\n if (!isInOverlayLayer) {\n if (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n didWarn.current = true;\n console.error(\n \"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\"\n );\n }\n return null;\n }\n return /* @__PURE__ */ jsx(\n SheetOverlayFrame,\n {\n ...props,\n ref,\n onPress: composeEventHandlers(\n props.onPress,\n context.dismissOnOverlayPress ? () => {\n context.setOpen(false);\n } : void 0\n )\n }\n );\n }\n);\nconst SheetContainer = createStyledHOC(\n SheetContainerFrame,\n ({\n scope,\n adjustPaddingForOffscreenContent,\n children,\n ...props\n }, forwardedRef) => {\n const context = useSheetContext(scope);\n const { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;\n const composedContentRef = useComposedRefs(forwardedRef, contentRef);\n const offscreenSize = useSheetOffscreenSize(context);\n const stableFrameSize = useRef(frameSize);\n useEffect(() => {\n if (open && frameSize) {\n stableFrameSize.current = frameSize;\n }\n }, [open, frameSize]);\n const sheetContents = useMemo(() => {\n const shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n return /* @__PURE__ */ jsxs(\n SheetContainerFrame,\n {\n ref: composedContentRef,\n flex: hasFit && open ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n children: [\n /* @__PURE__ */ jsx(StackZIndexContext, { zIndex: resolveViewZIndex(props.zIndex), children }),\n adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, { \"data-sheet-offscreen-pad\": true, height: offscreenSize, width: \"100%\" })\n ]\n }\n );\n }, [open, props, frameSize, offscreenSize, adjustPaddingForOffscreenContent, hasFit]);\n return /* @__PURE__ */ jsx(RemoveScroll, { enabled: !disableRemoveScroll && context.open, children: sheetContents });\n }\n);\nconst SheetBackground = createStyledHOC(\n SheetBackgroundFrame,\n ({ scope, disableHideBottomOverflow, ...props }, forwardedRef) => {\n const context = useSheetContext(scope);\n const bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n return /* @__PURE__ */ jsx(\n SheetBackgroundFrame,\n {\n ref: forwardedRef,\n \"data-sheet-background\": \"\",\n bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n ...props\n }\n );\n }\n);\nconst SheetRoot = createRefComponent(\n function SheetRoot2(props, ref) {\n const hydrated = useDidFinishSSR();\n const isAdapted = useAdaptIsActive();\n const adaptContext = useAdaptContext();\n const { isShowingNonSheet } = useSheetController(props.scope);\n const shouldUseAdapt = Boolean(\n adaptContext.open !== void 0 || adaptContext.onOpenChange\n );\n const isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;\n let SheetImplementation = SheetImplementationCustom;\n if (props.native) {\n const impl = getNativeSheet(\"ios\");\n if (impl) {\n SheetImplementation = impl;\n }\n }\n if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {\n return null;\n }\n const implementation = /* @__PURE__ */ jsx(SheetImplementation, { ref, ...props });\n return isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, { scroll: true, overlay: true, dismiss: true, children: implementation }) : implementation;\n }\n);\nconst sheetParts = {\n Container: SheetContainer,\n Background: SheetBackground,\n Overlay: SheetOverlay,\n Handle: SheetHandle,\n ScrollView: SheetScrollView\n};\nconst SheetControlled = withStaticProperties(\n SheetRoot,\n sheetParts\n);\nconst Sheet = withStaticProperties(SheetRoot, {\n Root: SheetRoot,\n Controlled: SheetControlled,\n useAnimatedPosition,\n ...sheetParts\n});\nexport {\n Sheet,\n SheetBackground,\n SheetContainer,\n SheetControlled,\n SheetHandle,\n SheetOverlay,\n SheetRoot\n};\n//# sourceMappingURL=Sheet.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,mBAAmB,OAAO,QAAQ;CACtC,aAAa;CAGb,UAAU,EACR,MAAM;EACJ,MAAM,EACJ,eAAe,OACjB;EACA,OAAO,EACL,eAAe,OACjB;CACF,EACF;AACF,CAAC;AACD,MAAM,oBAAoB,OAAO,QAAQ;CACvC,aAAa;CACb,OAAO;CACP,UAAU;CACV,QAAQ,MAAM;CACd,eAAe;CACf,UAAU,EACR,MAAM;EACJ,MAAM,EACJ,eAAe,OACjB;EACA,OAAO,EACL,eAAe,OACjB;CACF,EACF;AACF,CAAC;AACD,OAAO,OAAO,kBAAkB,cAAc,GAAG,uBAAuB,KAAK,CAAC;AAC9E,MAAM,sBAAsB,OAAO,QAAQ;CACzC,aAAa;CACb,MAAM;CACN,UAAU;CACV,QAAQ;CACR,OAAO;CACP,WAAW;AACb,CAAC;AACD,MAAM,uBAAuB,OAAO,QAAQ;CAC1C,aAAa;CACb,UAAU;CACV,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ,CAAC;CACT,eAAe;AACjB,CAAC;AACD,MAAM,cAAc,gBAClB,mBACC,EAAE,OAAO,GAAG,SAAS,iBAAiB;CACrC,MAAM,UAAU,gBAAgB,KAAK;CACrC,MAAM,cAAc,gBAAgB,QAAQ,WAAW,YAAY;CACnE,MAAM,iBAAiB,OAAO,KAAK;CACnC,gBAAgB;EACd,IAAI,CAAC,QAAQ,cAAc;EAC3B,OAAO,QAAQ,aAAa,kBAAkB,eAAe;GAC3D,IAAI,YAAY;IACd,eAAe,UAAU;GAC3B;EACF,CAAC;CACH,GAAG,CAAC,QAAQ,YAAY,CAAC;CACzB,IAAI,QAAQ,mBAAmB;EAC7B,OAAO;CACT;CACA,OAAuB,oBACrB,kBACA;EACE,KAAK;EACL,iBAA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