@lodev09/react-native-true-sheet 4.0.0-beta.2 → 4.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -4
- package/android/build.gradle +22 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContainerView.kt +50 -16
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentView.kt +302 -184
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetContentViewManager.kt +5 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetFooterView.kt +21 -110
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayView.kt +116 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetOverlayViewManager.kt +45 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetPackage.kt +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetStateUpdater.kt +18 -0
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +119 -50
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +360 -163
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +54 -12
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetBottomSheetView.kt +22 -9
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +84 -5
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDetentCalculator.kt +104 -39
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetDimView.kt +3 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetOverlayRootView.kt +137 -0
- package/android/src/main/java/com/lodev09/truesheet/events/TrueSheetLifecycleEvents.kt +15 -0
- package/android/src/main/java/com/lodev09/truesheet/utils/KeyboardUtils.kt +15 -2
- package/android/src/main/java/com/lodev09/truesheet/utils/ScreenUtils.kt +0 -12
- package/android/src/main/java/com/lodev09/truesheet/utils/ViewUtils.kt +19 -7
- package/android/src/main/jni/TrueSheetSpec.h +1 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewComponentDescriptor.h +1 -9
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.cpp +110 -30
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewShadowNode.h +30 -7
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.cpp +2 -2
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetContentViewState.h +9 -8
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewComponentDescriptor.h +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.cpp +9 -3
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewShadowNode.h +3 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetFooterViewState.h +4 -6
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.cpp +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetInsets.h +1 -1
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetLayoutUtils.h +43 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewComponentDescriptor.h +21 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.cpp +17 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetOverlayViewShadowNode.h +33 -0
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewComponentDescriptor.h +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.cpp +7 -40
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewShadowNode.h +3 -7
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.cpp +3 -5
- package/common/cpp/react/renderer/components/TrueSheetSpec/TrueSheetViewState.h +4 -5
- package/ios/TrueSheetContainerView.h +27 -7
- package/ios/TrueSheetContainerView.mm +31 -11
- package/ios/TrueSheetContentView.h +43 -15
- package/ios/TrueSheetContentView.mm +211 -189
- package/ios/TrueSheetFooterView.h +6 -0
- package/ios/TrueSheetFooterView.mm +93 -17
- package/ios/TrueSheetModule.h +2 -7
- package/ios/TrueSheetModule.mm +7 -16
- package/ios/TrueSheetOverlayView.h +32 -0
- package/ios/TrueSheetOverlayView.mm +161 -0
- package/ios/TrueSheetView.mm +212 -55
- package/ios/TrueSheetViewController.h +31 -3
- package/ios/TrueSheetViewController.mm +393 -94
- package/ios/core/TrueSheetBlurView.h +0 -2
- package/ios/core/TrueSheetBlurView.mm +3 -36
- package/ios/core/TrueSheetDetentCalculator.h +7 -1
- package/ios/core/TrueSheetDetentCalculator.mm +27 -4
- package/ios/core/TrueSheetGrabberView.mm +13 -3
- package/ios/core/TrueSheetKeyboardObserver.mm +2 -0
- package/ios/core/TrueSheetOverlayContainerView.h +31 -0
- package/ios/core/TrueSheetOverlayContainerView.mm +35 -0
- package/ios/events/TrueSheetLifecycleEvents.h +2 -0
- package/ios/events/TrueSheetLifecycleEvents.mm +8 -0
- package/ios/tvos/TrueSheetStubs.mm +12 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.h +1 -0
- package/ios/utils/UIView+ScrollEdgeInteraction.mm +24 -2
- package/lib/module/TrueSheet.js +173 -39
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +218 -243
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetBackground.js +15 -0
- package/lib/module/TrueSheetBackground.js.map +1 -0
- package/lib/module/TrueSheetOverlay.js +30 -0
- package/lib/module/TrueSheetOverlay.js.map +1 -0
- package/lib/module/TrueSheetOverlay.web.js +35 -0
- package/lib/module/TrueSheetOverlay.web.js.map +1 -0
- package/lib/module/TrueSheetPeek.web.js +20 -15
- package/lib/module/TrueSheetPeek.web.js.map +1 -1
- package/lib/module/detentBackgrounds.js +21 -0
- package/lib/module/detentBackgrounds.js.map +1 -0
- package/lib/module/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/lib/module/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +14 -10
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/mocks/index.js +18 -2
- package/lib/module/mocks/index.js.map +1 -1
- package/lib/module/mocks/navigationExpoRouter.js.map +1 -1
- package/lib/module/navigation/base-types.js +2 -0
- package/lib/module/navigation/base-types.js.map +1 -0
- package/lib/module/navigation/createTrueSheetRouter.js +0 -9
- package/lib/module/navigation/createTrueSheetRouter.js.map +1 -1
- package/lib/module/navigation/expo-router/base-types.js +2 -0
- package/lib/module/navigation/expo-router/base-types.js.map +1 -0
- package/lib/module/navigation/expo-router/index.js +10 -7
- package/lib/module/navigation/expo-router/index.js.map +1 -1
- package/lib/module/navigation/expo-router/types.js +4 -0
- package/lib/module/navigation/expo-router/types.js.map +1 -0
- package/lib/module/navigation/index.js.map +1 -1
- package/lib/module/navigation/screen/useSheetScreenState.js +1 -0
- package/lib/module/navigation/screen/useSheetScreenState.js.map +1 -1
- package/lib/module/web/constants.js +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/layout.js +168 -0
- package/lib/module/web/layout.js.map +1 -0
- package/lib/module/web/vaul/constants.js +4 -0
- package/lib/module/web/vaul/constants.js.map +1 -1
- package/lib/module/web/vaul/context.js.map +1 -1
- package/lib/module/web/vaul/helpers.js +1 -0
- package/lib/module/web/vaul/helpers.js.map +1 -1
- package/lib/module/web/vaul/index.js +44 -6
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/use-snap-points.js +6 -8
- package/lib/module/web/vaul/use-snap-points.js.map +1 -1
- package/lib/typescript/src/TrueSheet.d.ts +6 -0
- package/lib/typescript/src/TrueSheet.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +135 -34
- package/lib/typescript/src/TrueSheet.types.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheet.web.d.ts.map +1 -1
- package/lib/typescript/src/TrueSheetBackground.d.ts +3 -0
- package/lib/typescript/src/TrueSheetBackground.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts +8 -0
- package/lib/typescript/src/TrueSheetOverlay.web.d.ts.map +1 -0
- package/lib/typescript/src/TrueSheetPeek.web.d.ts +8 -4
- package/lib/typescript/src/TrueSheetPeek.web.d.ts.map +1 -1
- package/lib/typescript/src/detentBackgrounds.d.ts +10 -0
- package/lib/typescript/src/detentBackgrounds.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts +6 -0
- package/lib/typescript/src/fabric/TrueSheetOverlayViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +11 -7
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/index.d.ts +4 -0
- package/lib/typescript/src/mocks/index.d.ts.map +1 -1
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts +3 -3
- package/lib/typescript/src/mocks/navigationExpoRouter.d.ts.map +1 -1
- package/lib/typescript/src/navigation/base-types.d.ts +9 -0
- package/lib/typescript/src/navigation/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts +2 -13
- package/lib/typescript/src/navigation/createTrueSheetRouter.d.ts.map +1 -1
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts +8 -0
- package/lib/typescript/src/navigation/expo-router/base-types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/expo-router/index.d.ts +8 -6
- package/lib/typescript/src/navigation/expo-router/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/expo-router/types.d.ts +44 -0
- package/lib/typescript/src/navigation/expo-router/types.d.ts.map +1 -0
- package/lib/typescript/src/navigation/index.d.ts +3 -4
- package/lib/typescript/src/navigation/index.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +2 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +41 -5
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/lib/typescript/src/web/constants.d.ts +1 -1
- package/lib/typescript/src/web/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/layout.d.ts +19 -0
- package/lib/typescript/src/web/layout.d.ts.map +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts +1 -0
- package/lib/typescript/src/web/vaul/constants.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/context.d.ts +1 -0
- package/lib/typescript/src/web/vaul/context.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/helpers.d.ts +1 -0
- package/lib/typescript/src/web/vaul/helpers.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/index.d.ts +7 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/use-snap-points.d.ts.map +1 -1
- package/package.json +17 -8
- package/react-native.config.js +1 -0
- package/src/TrueSheet.tsx +206 -48
- package/src/TrueSheet.types.ts +142 -35
- package/src/TrueSheet.web.tsx +270 -290
- package/src/TrueSheetBackground.tsx +17 -0
- package/src/TrueSheetOverlay.tsx +24 -0
- package/src/TrueSheetOverlay.web.tsx +33 -0
- package/src/TrueSheetPeek.web.tsx +25 -23
- package/src/detentBackgrounds.ts +24 -0
- package/src/fabric/TrueSheetContentViewNativeComponent.ts +1 -1
- package/src/fabric/TrueSheetOverlayViewNativeComponent.ts +12 -0
- package/src/fabric/TrueSheetViewNativeComponent.ts +14 -10
- package/src/index.ts +1 -0
- package/src/mocks/index.ts +17 -2
- package/src/mocks/navigationExpoRouter.ts +6 -5
- package/src/navigation/base-types.ts +20 -0
- package/src/navigation/createTrueSheetRouter.ts +5 -33
- package/src/navigation/expo-router/base-types.ts +18 -0
- package/src/navigation/expo-router/index.ts +28 -30
- package/src/navigation/expo-router/types.ts +116 -0
- package/src/navigation/index.ts +6 -7
- package/src/navigation/screen/useSheetScreenState.ts +2 -0
- package/src/navigation/types.ts +75 -22
- package/src/web/constants.ts +1 -1
- package/src/web/layout.ts +196 -0
- package/src/web/vaul/constants.ts +4 -0
- package/src/web/vaul/context.ts +1 -0
- package/src/web/vaul/helpers.ts +5 -0
- package/src/web/vaul/index.tsx +67 -5
- package/src/web/vaul/use-snap-points.ts +6 -14
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { TrueSheetActions } from "./actions.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The base `StackRouter` factory to wrap, typed generically over the state and
|
|
7
|
-
* action types the wrapper threads through — `StackRouter` is structural and
|
|
8
|
-
* never touches the sheet-specific fields.
|
|
9
|
-
* Injected by each entry point so the shared router never imports
|
|
10
|
-
* `@react-navigation/*` at runtime (Expo Router apps don't install it).
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
4
|
const uid = () => Math.random().toString(36).slice(2, 10);
|
|
14
5
|
const ensureBaseRoute = (state, baseRouteName, routeParamList) => {
|
|
15
6
|
if (!baseRouteName) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TrueSheetActions","uid","Math","random","toString","slice","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","index","length","createTrueSheetRouter","stackRouter","routerOptions","baseRouter","type","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetRouter.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["TrueSheetActions","uid","Math","random","toString","slice","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","index","length","createTrueSheetRouter","stackRouter","routerOptions","baseRouter","type","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetRouter.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,cAAW;AAG5C,MAAMC,GAAG,GAAGA,CAAA,KAAMC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;AAEzD,MAAMC,eAAe,GAAGA,CACtBC,KAAQ,EACRC,aAAiC,EACjCC,cAA8D,KACf;EAC/C,IAAI,CAACD,aAAa,EAAE;IAClB,OAAOD,KAAK;EACd;EAEA,MAAMG,YAAY,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,KAAKN,aAAa,CAAC;EAEvE,IAAI,CAACE,YAAY,EAAE;IACjB,MAAMK,SAAS,GAAG;MAChBC,GAAG,EAAE,GAAGR,aAAa,IAAIP,GAAG,CAAC,CAAC,EAAE;MAChCa,IAAI,EAAEN,aAAa;MACnBS,MAAM,EAAER,cAAc,GAAGD,aAAa;IACxC,CAAC;IAED,OAAO;MACL,GAAGD,KAAK;MACRW,KAAK,EAAEX,KAAK,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CAAC,CAAC,EAAE;cACrB,OAAO1B,KAAK;YACd;;YAEA;YACA,MAAMI,MAAM,GAAGJ,KAAK,CAACI,MAAM,CAAC2C,MAAM,CAAC,CAACC,CAAC,EAAEhB,CAAC,KAAKA,CAAC,GAAGN,UAAU,CAAC;YAE5D,OAAO;cACL,GAAG1B,KAAK;cACRW,KAAK,EAAEhB,IAAI,CAAC6C,GAAG,CAACxC,KAAK,CAACW,KAAK,EAAEP,MAAM,CAACQ,MAAM,GAAG,CAAC,CAAC;cAC/CR;YACF,CAAC;UACH;QAEA;UACE,OAAOY,UAAU,CAACQ,iBAAiB,CAACxB,KAAK,EAAEyB,MAAM,EAAEN,OAAO,CAAC;MAC/D;IACF,CAAC;IAED8B,kBAAkBA,CAACC,YAAY,EAAE;MAAE7B,UAAU;MAAEnB,cAAc;MAAEiD;IAAe,CAAC,EAAE;MAC/E,IAAID,YAAY,CAAC3B,KAAK,KAAK,KAAK,EAAE;QAChC,OAAO2B,YAAY;MACrB;MAEA,MAAMlD,KAAK,GAAGgB,UAAU,CAACiC,kBAAkB,CAACC,YAAY,EAAE;QACxD7B,UAAU;QACVnB,cAAc;QACdiD;MACF,CAAC,CAAC;MAEF,MAAMlD,aAAa,GAAGc,aAAa,CAACK,gBAAgB,IAAIC,UAAU,CAAC,CAAC,CAAC;MACrE,MAAMC,kBAAkB,GAAGvB,eAAe,CAACC,KAAK,EAAEC,aAAa,EAAEC,cAAc,CAAC;MAEhF,OAAO;QACL,GAAGoB,kBAAkB;QACrBL,IAAI,EAAE,YAAY;QAClBR,GAAG,EAAE,cAAcf,GAAG,CAAC,CAAC;MAC1B,CAAC;IACH,CAAC;IAED0D,cAAc,EAAE3D;EAClB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/expo-router/base-types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
import { StackRouter, unstable_integrateWithRouter, useNavigation } from 'expo-router';
|
|
4
4
|
import { createTrueSheetRouter } from "../createTrueSheetRouter.js";
|
|
5
5
|
import { trueSheetNavigator } from "../navigator.js";
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
6
|
+
// expo-router's vendored StackRouter is structurally identical to @react-navigation's.
|
|
7
|
+
// Pinned to this entry's own router types: `createTrueSheetRouter` is shared and typed
|
|
8
|
+
// against React Navigation, which resolves to `any` in apps that only install expo-router.
|
|
9
|
+
const sheetRouter = createTrueSheetRouter(StackRouter);
|
|
10
|
+
|
|
11
|
+
// `routes`/`dispatch` are injected by `createProps`, so they are declared as
|
|
12
|
+
// CreateProps (last generic) and excluded from the public navigator props
|
|
13
|
+
const SheetNavigator = unstable_integrateWithRouter(trueSheetNavigator, sheetRouter, {
|
|
9
14
|
createProps: ({
|
|
10
15
|
state,
|
|
11
16
|
dispatch
|
|
@@ -15,10 +20,8 @@ createTrueSheetRouter(StackRouter), {
|
|
|
15
20
|
})
|
|
16
21
|
});
|
|
17
22
|
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// map with an index signature which breaks precisely typed `screenListeners`
|
|
21
|
-
// callbacks - replace it with the exact map
|
|
23
|
+
// expo-router intersects the event map with an index signature which breaks
|
|
24
|
+
// precisely typed `screenListeners` callbacks - replace it with the exact map
|
|
22
25
|
|
|
23
26
|
/**
|
|
24
27
|
* TrueSheet navigator layout for Expo Router.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StackRouter","unstable_integrateWithRouter","useNavigation","createTrueSheetRouter","trueSheetNavigator","SheetNavigator","createProps","state","dispatch","routes","Sheet","useTrueSheetNavigation","TrueSheetActions"],"sourceRoot":"../../../../src","sources":["navigation/expo-router/index.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["StackRouter","unstable_integrateWithRouter","useNavigation","createTrueSheetRouter","trueSheetNavigator","sheetRouter","SheetNavigator","createProps","state","dispatch","routes","Sheet","useTrueSheetNavigation","TrueSheetActions"],"sourceRoot":"../../../../src","sources":["navigation/expo-router/index.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,4BAA4B,EAAEC,aAAa,QAAQ,aAAa;AAEtF,SAASC,qBAAqB,QAAQ,6BAA0B;AAChE,SAASC,kBAAkB,QAAQ,iBAAc;AAcjD;AACA;AACA;AACA,MAAMC,WAAmC,GAAGF,qBAAqB,CAC/DH,WACF,CAAC;;AAED;AACA;AACA,MAAMM,cAAc,GAAGL,4BAA4B,CAOjDG,kBAAkB,EAAEC,WAAW,EAAE;EACjCE,WAAW,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAS,CAAC,MAAM;IACrCC,MAAM,EAAEF,KAAK,CAACE,MAAM;IACpBD;EACF,CAAC;AACH,CAAC,CAAC;;AAEF;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,KAAK,GAAGL,cAGpB;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMM,sBAAsB,GAAGA,CAAA,KAEHV,aAAa,CAA6B,CAAC;AAE9E,SAASW,gBAAgB,QAAkC,eAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["navigation/expo-router/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createStandardNavigationFactories","StackRouter","createTrueSheetRouter","trueSheetNavigator","createNavigator","createScreen","state","navigation","routes","dispatch","createTrueSheetNavigator","createTrueSheetScreen","TrueSheetActions","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/index.ts"],"mappings":";;AAAA,SACEA,iCAAiC,EACjCC,WAAW,QAEN,0BAA0B;AAEjC,SAASC,qBAAqB,
|
|
1
|
+
{"version":3,"names":["createStandardNavigationFactories","StackRouter","createTrueSheetRouter","trueSheetNavigator","createNavigator","createScreen","state","navigation","routes","dispatch","createTrueSheetNavigator","createTrueSheetScreen","TrueSheetActions","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/index.ts"],"mappings":";;AAAA,SACEA,iCAAiC,EACjCC,WAAW,QAEN,0BAA0B;AAEjC,SAASC,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASC,kBAAkB,QAAQ,gBAAa;AAmBhD,MAAM;EAAEC,eAAe;EAAEC;AAAa,CAAC,GAAGL,iCAAiC,CAKzEG,kBAAkB,EAClBD,qBAAqB,CAACD,WAAiC,CAAC,EACxD,CAAC;EAAEK,KAAK;EAAEC;AAAW,CAAC,MAAM;EAAEC,MAAM,EAAEF,KAAK,CAACE,MAAM;EAAEC,QAAQ,EAAEF,UAAU,CAACE;AAAS,CAAC,CACrF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAGN,eAAe;;AAEvD;AACA;AACA;AACA,OAAO,MAAMO,qBAAqB,GAAGN,YAAY;AAEjD,SAASO,gBAAgB,QAAkC,cAAW;AACtE,SAASV,qBAAqB,QAAQ,4BAAyB;AAC/D,SAASW,sBAAsB,QAAQ,6BAA0B","ignoreList":[]}
|
|
@@ -48,6 +48,7 @@ export const useSheetScreenState = props => {
|
|
|
48
48
|
onDidPresent: e => emitEvent('sheetDidPresent', e.nativeEvent),
|
|
49
49
|
onWillDismiss: _e => emitEvent('sheetWillDismiss', undefined),
|
|
50
50
|
onDidDismiss,
|
|
51
|
+
onDismissAttempt: _e => emitEvent('sheetDismissAttempt', undefined),
|
|
51
52
|
onDetentChange: e => emitEvent('sheetDetentChange', e.nativeEvent),
|
|
52
53
|
onDragBegin: e => emitEvent('sheetDragBegin', e.nativeEvent),
|
|
53
54
|
onDragChange: e => emitEvent('sheetDragChange', e.nativeEvent),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","TrueSheetActions","useSheetScreenState","props","detentIndex","resizeKey","closing","dispatch","routeKey","emit","ref","isDismissedRef","isFirstRenderRef","initialDetentIndexRef","current","dismiss","resize","emitEvent","type","data","target","onDidDismiss","undefined","remove","source","eventHandlers","onWillPresent","e","nativeEvent","onDidPresent","onWillDismiss","_e","onDetentChange","onDragBegin","onDragChange","onDragEnd","onPositionChange","onWillFocus","onDidFocus","onWillBlur","onDidBlur","initialDetentIndex"],"sourceRoot":"../../../../src","sources":["navigation/screen/useSheetScreenState.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","TrueSheetActions","useSheetScreenState","props","detentIndex","resizeKey","closing","dispatch","routeKey","emit","ref","isDismissedRef","isFirstRenderRef","initialDetentIndexRef","current","dismiss","resize","emitEvent","type","data","target","onDidDismiss","undefined","remove","source","eventHandlers","onWillPresent","e","nativeEvent","onDidPresent","onWillDismiss","_e","onDismissAttempt","onDetentChange","onDragBegin","onDragChange","onDragEnd","onPositionChange","onWillFocus","onDidFocus","onWillBlur","onDidBlur","initialDetentIndex"],"sourceRoot":"../../../../src","sources":["navigation/screen/useSheetScreenState.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAqB/D,SAASC,gBAAgB,QAAQ,eAAY;AAW7C,OAAO,MAAMC,mBAAmB,GAAIC,KAA+B,IAAK;EACtE,MAAM;IAAEC,WAAW;IAAEC,SAAS;IAAEC,OAAO;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAGN,KAAK;EAE3E,MAAMO,GAAG,GAAGV,MAAM,CAAY,IAAI,CAAC;EACnC,MAAMW,cAAc,GAAGX,MAAM,CAAC,KAAK,CAAC;EACpC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EIGHT_RATIO = 0.5;
|
|
7
7
|
export const COLOR_SURFACE_CONTAINER_LOW_LIGHT = '#F7F2FA';
|
|
8
8
|
export const COLOR_SURFACE_CONTAINER_LOW_DARK = '#1D1B20';
|
|
9
|
-
export const
|
|
9
|
+
export const DEFAULT_PLACEMENT_OFFSET = 16;
|
|
10
10
|
export const DEFAULT_DETACHED_OFFSET = 16;
|
|
11
11
|
export const DEFAULT_GRABBER_COLOR_LIGHT = 'rgba(0, 0, 0, 0.3)';
|
|
12
12
|
export const DEFAULT_GRABBER_COLOR_DARK = 'rgba(255, 255, 255, 0.3)';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_CORNER_RADIUS","DEFAULT_MAX_WIDTH","DEFAULT_FORM_SHEET_WIDTH","DEFAULT_FORM_SHEET_HEIGHT_RATIO","COLOR_SURFACE_CONTAINER_LOW_LIGHT","COLOR_SURFACE_CONTAINER_LOW_DARK","
|
|
1
|
+
{"version":3,"names":["DEFAULT_CORNER_RADIUS","DEFAULT_MAX_WIDTH","DEFAULT_FORM_SHEET_WIDTH","DEFAULT_FORM_SHEET_HEIGHT_RATIO","COLOR_SURFACE_CONTAINER_LOW_LIGHT","COLOR_SURFACE_CONTAINER_LOW_DARK","DEFAULT_PLACEMENT_OFFSET","DEFAULT_DETACHED_OFFSET","DEFAULT_GRABBER_COLOR_LIGHT","DEFAULT_GRABBER_COLOR_DARK","DEFAULT_GRABBER_WIDTH","DEFAULT_GRABBER_HEIGHT","DEFAULT_GRABBER_TOP_MARGIN"],"sourceRoot":"../../../src","sources":["web/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,iBAAiB,GAAG,GAAG;AACpC,OAAO,MAAMC,wBAAwB,GAAG,GAAG;AAC3C,OAAO,MAAMC,+BAA+B,GAAG,GAAG;AAClD,OAAO,MAAMC,iCAAiC,GAAG,SAAS;AAC1D,OAAO,MAAMC,gCAAgC,GAAG,SAAS;AACzD,OAAO,MAAMC,wBAAwB,GAAG,EAAE;AAC1C,OAAO,MAAMC,uBAAuB,GAAG,EAAE;AACzC,OAAO,MAAMC,2BAA2B,GAAG,oBAAoB;AAC/D,OAAO,MAAMC,0BAA0B,GAAG,0BAA0B;AACpE,OAAO,MAAMC,qBAAqB,GAAG,EAAE;AACvC,OAAO,MAAMC,sBAAsB,GAAG,CAAC;AACvC,OAAO,MAAMC,0BAA0B,GAAG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/// <reference lib="dom" />
|
|
4
|
+
|
|
5
|
+
const FOOTER_INSET = '--truesheet-footer-inset';
|
|
6
|
+
export function observeSheetLayout({
|
|
7
|
+
drawer,
|
|
8
|
+
layout,
|
|
9
|
+
getContent,
|
|
10
|
+
getHeader,
|
|
11
|
+
getFooter,
|
|
12
|
+
getScrollable,
|
|
13
|
+
absoluteHeader,
|
|
14
|
+
absoluteFooter,
|
|
15
|
+
footerInsetAdjustment,
|
|
16
|
+
measureContent,
|
|
17
|
+
onHeightChange
|
|
18
|
+
}) {
|
|
19
|
+
let frame = 0;
|
|
20
|
+
let disposed = false;
|
|
21
|
+
let width = -1;
|
|
22
|
+
let height = -1;
|
|
23
|
+
let scroller = null;
|
|
24
|
+
let originalPadding = '';
|
|
25
|
+
let insetPadding = '';
|
|
26
|
+
let appliedInset = 0;
|
|
27
|
+
const observed = new Set();
|
|
28
|
+
|
|
29
|
+
// This tree has no viewport constraint or injected footer inset. Its resize
|
|
30
|
+
// observer catches intrinsic changes without observing the live flex layout.
|
|
31
|
+
const measurement = measureContent ? document.createElement('div') : null;
|
|
32
|
+
if (measurement) {
|
|
33
|
+
Object.assign(measurement.style, {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
top: '0',
|
|
36
|
+
left: '0',
|
|
37
|
+
display: 'flex',
|
|
38
|
+
flexDirection: 'column',
|
|
39
|
+
visibility: 'hidden',
|
|
40
|
+
pointerEvents: 'none'
|
|
41
|
+
});
|
|
42
|
+
measurement.style.setProperty(FOOTER_INSET, '0px');
|
|
43
|
+
measurement.inert = true;
|
|
44
|
+
measurement.setAttribute('aria-hidden', 'true');
|
|
45
|
+
measurement.setAttribute('data-truesheet-measure', '');
|
|
46
|
+
drawer.appendChild(measurement);
|
|
47
|
+
}
|
|
48
|
+
const measure = () => {
|
|
49
|
+
if (!measurement?.isConnected) return;
|
|
50
|
+
const headerHeight = absoluteHeader ? 0 : getHeader()?.offsetHeight ?? 0;
|
|
51
|
+
const footerHeight = !absoluteFooter || footerInsetAdjustment && scroller ? getFooter()?.offsetHeight ?? 0 : 0;
|
|
52
|
+
const next = measurement.offsetHeight + headerHeight + footerHeight;
|
|
53
|
+
if (height === next) return;
|
|
54
|
+
height = next;
|
|
55
|
+
onHeightChange(next);
|
|
56
|
+
};
|
|
57
|
+
const updateInset = () => {
|
|
58
|
+
let inset = 0;
|
|
59
|
+
const footer = getFooter();
|
|
60
|
+
if (footerInsetAdjustment && scroller && footer) {
|
|
61
|
+
let bottom = scroller.offsetTop + scroller.offsetHeight;
|
|
62
|
+
let parent = scroller.offsetParent;
|
|
63
|
+
while (parent instanceof HTMLElement && parent !== layout) {
|
|
64
|
+
bottom += parent.offsetTop;
|
|
65
|
+
parent = parent.offsetParent;
|
|
66
|
+
}
|
|
67
|
+
if (parent === layout) {
|
|
68
|
+
inset = Math.min(footer.offsetHeight, Math.max(0, bottom - (layout.clientHeight - footer.offsetHeight)));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (inset === appliedInset) return;
|
|
72
|
+
appliedInset = inset;
|
|
73
|
+
layout.style.setProperty(FOOTER_INSET, `${inset}px`);
|
|
74
|
+
};
|
|
75
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
76
|
+
if (measurement && width !== layout.clientWidth) {
|
|
77
|
+
width = layout.clientWidth;
|
|
78
|
+
measurement.style.width = `${width}px`;
|
|
79
|
+
}
|
|
80
|
+
updateInset();
|
|
81
|
+
measure();
|
|
82
|
+
});
|
|
83
|
+
const measurementObserver = new ResizeObserver(measure);
|
|
84
|
+
if (measurement) measurementObserver.observe(measurement);
|
|
85
|
+
const restorePadding = () => {
|
|
86
|
+
if (scroller && scroller.style.paddingBottom === insetPadding) {
|
|
87
|
+
scroller.style.paddingBottom = originalPadding;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const sync = () => {
|
|
91
|
+
if (disposed) return;
|
|
92
|
+
const content = getContent();
|
|
93
|
+
const nextScroller = getScrollable();
|
|
94
|
+
if (nextScroller !== scroller) {
|
|
95
|
+
restorePadding();
|
|
96
|
+
scroller = nextScroller;
|
|
97
|
+
insetPadding = '';
|
|
98
|
+
}
|
|
99
|
+
if (footerInsetAdjustment && scroller && (!insetPadding || scroller.style.paddingBottom !== insetPadding)) {
|
|
100
|
+
originalPadding = scroller.style.paddingBottom;
|
|
101
|
+
const base = getComputedStyle(scroller).paddingBottom;
|
|
102
|
+
insetPadding = `calc(${base} + var(${FOOTER_INSET}, 0px))`;
|
|
103
|
+
scroller.style.paddingBottom = insetPadding;
|
|
104
|
+
insetPadding = scroller.style.paddingBottom;
|
|
105
|
+
}
|
|
106
|
+
const nodes = new Set([layout]);
|
|
107
|
+
for (const node of [getHeader(), getFooter(), scroller]) {
|
|
108
|
+
if (node) nodes.add(node);
|
|
109
|
+
}
|
|
110
|
+
for (const node of observed) {
|
|
111
|
+
if (!nodes.has(node)) {
|
|
112
|
+
resizeObserver.unobserve(node);
|
|
113
|
+
observed.delete(node);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const node of nodes) {
|
|
117
|
+
if (!observed.has(node)) {
|
|
118
|
+
resizeObserver.observe(node);
|
|
119
|
+
observed.add(node);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (measurement && content) {
|
|
123
|
+
width = layout.clientWidth;
|
|
124
|
+
measurement.style.width = `${width}px`;
|
|
125
|
+
measurement.replaceChildren(content.cloneNode(true));
|
|
126
|
+
}
|
|
127
|
+
updateInset();
|
|
128
|
+
measure();
|
|
129
|
+
};
|
|
130
|
+
const mutationObserver = new MutationObserver(mutations => {
|
|
131
|
+
const changed = mutations.some(mutation => mutation.target !== layout || mutation.type === 'childList');
|
|
132
|
+
if (!changed || frame) return;
|
|
133
|
+
frame = requestAnimationFrame(() => {
|
|
134
|
+
frame = 0;
|
|
135
|
+
sync();
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
sync();
|
|
139
|
+
mutationObserver.observe(layout, {
|
|
140
|
+
childList: true,
|
|
141
|
+
characterData: true,
|
|
142
|
+
attributes: true,
|
|
143
|
+
attributeFilter: ['style', 'class'],
|
|
144
|
+
subtree: true
|
|
145
|
+
});
|
|
146
|
+
const footer = getFooter();
|
|
147
|
+
if (absoluteFooter && footer) {
|
|
148
|
+
mutationObserver.observe(footer, {
|
|
149
|
+
childList: true,
|
|
150
|
+
characterData: true,
|
|
151
|
+
subtree: true
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
measure,
|
|
156
|
+
disconnect: () => {
|
|
157
|
+
disposed = true;
|
|
158
|
+
cancelAnimationFrame(frame);
|
|
159
|
+
mutationObserver.disconnect();
|
|
160
|
+
resizeObserver.disconnect();
|
|
161
|
+
measurementObserver.disconnect();
|
|
162
|
+
restorePadding();
|
|
163
|
+
layout.style.removeProperty(FOOTER_INSET);
|
|
164
|
+
measurement?.remove();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=layout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FOOTER_INSET","observeSheetLayout","drawer","layout","getContent","getHeader","getFooter","getScrollable","absoluteHeader","absoluteFooter","footerInsetAdjustment","measureContent","onHeightChange","frame","disposed","width","height","scroller","originalPadding","insetPadding","appliedInset","observed","Set","measurement","document","createElement","Object","assign","style","position","top","left","display","flexDirection","visibility","pointerEvents","setProperty","inert","setAttribute","appendChild","measure","isConnected","headerHeight","offsetHeight","footerHeight","next","updateInset","inset","footer","bottom","offsetTop","parent","offsetParent","HTMLElement","Math","min","max","clientHeight","resizeObserver","ResizeObserver","clientWidth","measurementObserver","observe","restorePadding","paddingBottom","sync","content","nextScroller","base","getComputedStyle","nodes","node","add","has","unobserve","delete","replaceChildren","cloneNode","mutationObserver","MutationObserver","mutations","changed","some","mutation","target","type","requestAnimationFrame","childList","characterData","attributes","attributeFilter","subtree","disconnect","cancelAnimationFrame","removeProperty","remove"],"sourceRoot":"../../../src","sources":["web/layout.ts"],"mappings":";;AAAA;;AAEA,MAAMA,YAAY,GAAG,0BAA0B;AAgB/C,OAAO,SAASC,kBAAkBA,CAAC;EACjCC,MAAM;EACNC,MAAM;EACNC,UAAU;EACVC,SAAS;EACTC,SAAS;EACTC,aAAa;EACbC,cAAc;EACdC,cAAc;EACdC,qBAAqB;EACrBC,cAAc;EACdC;AACkB,CAAC,EAAE;EACrB,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,QAAQ,GAAG,KAAK;EACpB,IAAIC,KAAK,GAAG,CAAC,CAAC;EACd,IAAIC,MAAM,GAAG,CAAC,CAAC;EACf,IAAIC,QAA4B,GAAG,IAAI;EACvC,IAAIC,eAAe,GAAG,EAAE;EACxB,IAAIC,YAAY,GAAG,EAAE;EACrB,IAAIC,YAAY,GAAG,CAAC;EACpB,MAAMC,QAAQ,GAAG,IAAIC,GAAG,CAAU,CAAC;;EAEnC;EACA;EACA,MAAMC,WAAW,GAAGZ,cAAc,GAAGa,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI;EACzE,IAAIF,WAAW,EAAE;IACfG,MAAM,CAACC,MAAM,CAACJ,WAAW,CAACK,KAAK,EAAE;MAC/BC,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,GAAG;MACRC,IAAI,EAAE,GAAG;MACTC,OAAO,EAAE,MAAM;MACfC,aAAa,EAAE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f+E,oBAAoB,CAAChF,KAAK,CAAC;MAC3BiE,gBAAgB,CAACc,UAAU,CAAC,CAAC;MAC7BlC,cAAc,CAACkC,UAAU,CAAC,CAAC;MAC3B/B,mBAAmB,CAAC+B,UAAU,CAAC,CAAC;MAChC7B,cAAc,CAAC,CAAC;MAChB5D,MAAM,CAACyB,KAAK,CAACkE,cAAc,CAAC9F,YAAY,CAAC;MACzCuB,WAAW,EAAEwE,MAAM,CAAC,CAAC;IACvB;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -7,6 +7,10 @@ export const TRANSITIONS = {
|
|
|
7
7
|
export const VELOCITY_THRESHOLD = 0.4;
|
|
8
8
|
export const DEFAULT_PEEK_HEIGHT = 150;
|
|
9
9
|
export const CLOSE_THRESHOLD = 0.25;
|
|
10
|
+
|
|
11
|
+
// Minimum downward pull (px) on a non-dismissible drawer at its first snap
|
|
12
|
+
// point before the release counts as a dismiss attempt.
|
|
13
|
+
export const DISMISS_ATTEMPT_THRESHOLD = 24;
|
|
10
14
|
export const SCROLL_LOCK_TIMEOUT = 100;
|
|
11
15
|
export const BORDER_RADIUS = 8;
|
|
12
16
|
export const NESTED_DISPLACEMENT = 16;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TRANSITIONS","DURATION","EASE","VELOCITY_THRESHOLD","DEFAULT_PEEK_HEIGHT","CLOSE_THRESHOLD","SCROLL_LOCK_TIMEOUT","BORDER_RADIUS","NESTED_DISPLACEMENT","WINDOW_TOP_OFFSET","DRAG_CLASS"],"sourceRoot":"../../../../src","sources":["web/vaul/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,WAAW,GAAG;EACzBC,QAAQ,EAAE,GAAG;EACbC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACzB,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,GAAG;AAErC,OAAO,MAAMC,mBAAmB,GAAG,GAAG;AAEtC,OAAO,MAAMC,eAAe,GAAG,IAAI;
|
|
1
|
+
{"version":3,"names":["TRANSITIONS","DURATION","EASE","VELOCITY_THRESHOLD","DEFAULT_PEEK_HEIGHT","CLOSE_THRESHOLD","DISMISS_ATTEMPT_THRESHOLD","SCROLL_LOCK_TIMEOUT","BORDER_RADIUS","NESTED_DISPLACEMENT","WINDOW_TOP_OFFSET","DRAG_CLASS"],"sourceRoot":"../../../../src","sources":["web/vaul/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,WAAW,GAAG;EACzBC,QAAQ,EAAE,GAAG;EACbC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACzB,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,GAAG;AAErC,OAAO,MAAMC,mBAAmB,GAAG,GAAG;AAEtC,OAAO,MAAMC,eAAe,GAAG,IAAI;;AAEnC;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAG,EAAE;AAE3C,OAAO,MAAMC,mBAAmB,GAAG,GAAG;AAEtC,OAAO,MAAMC,aAAa,GAAG,CAAC;AAE9B,OAAO,MAAMC,mBAAmB,GAAG,EAAE;AAErC,OAAO,MAAMC,iBAAiB,GAAG,EAAE;AAEnC,OAAO,MAAMC,UAAU,GAAG,eAAe","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","DrawerContext","createContext","drawerRef","current","overlayRef","onPress","onRelease","onDrag","onTouchDrag","onTouchRelease","onNestedDrag","onNestedOpenChange","onNestedRelease","openProp","undefined","dismissible","isOpen","isDragging","keyboardIsOpen","snapPointsOffset","snapPoints","handleOnly","modal","shouldFade","activeSnapPoint","onOpenChange","setActiveSnapPoint","closeDrawer","direction","shouldAnimate","shouldScaleBackground","setBackgroundColorOnScale","noBodyStyles","container","autoFocus","onPositionChangeRef","setContentHeight","detached","detachedOffset","detachedRadius","useDrawerContext","context","useContext","Error"],"sourceRoot":"../../../../src","sources":["web/vaul/context.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;
|
|
1
|
+
{"version":3,"names":["React","DrawerContext","createContext","drawerRef","current","overlayRef","onPress","onRelease","onDrag","onTouchDrag","onTouchRelease","onNestedDrag","onNestedOpenChange","onNestedRelease","openProp","undefined","dismissible","isOpen","isDragging","keyboardIsOpen","snapPointsOffset","snapPoints","handleOnly","modal","shouldFade","activeSnapPoint","onOpenChange","setActiveSnapPoint","closeDrawer","direction","shouldAnimate","shouldScaleBackground","setBackgroundColorOnScale","noBodyStyles","container","autoFocus","onPositionChangeRef","setContentHeight","detached","detachedOffset","detachedRadius","useDrawerContext","context","useContext","Error"],"sourceRoot":"../../../../src","sources":["web/vaul/context.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAwDzB,OAAO,MAAMC,aAAa,gBAAGD,KAAK,CAACE,aAAa,CAAqB;EACnEC,SAAS,EAAE;IAAEC,OAAO,EAAE;EAAK,CAAC;EAC5BC,UAAU,EAAE;IAAED,OAAO,EAAE;EAAK,CAAC;EAC7BE,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjBC,SAAS,EAAEA,CAAA,KAAM,CAAC,CAAC;EACnBC,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBC,WAAW,EAAEA,CAAA,KAAM,CAAC,CAAC;EACrBC,cAAc,EAAEA,CAAA,KAAM,CAAC,CAAC;EACxBC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,eAAe,EAAEA,CAAA,KAAM,CAAC,CAAC;EACzBC,QAAQ,EAAEC,SAAS;EACnBC,WAAW,EAAE,KAAK;EAClBC,MAAM,EAAE,KAAK;EACbC,UAAU,EAAE,KAAK;EACjBC,cAAc,EAAE;IAAEf,OAAO,EAAE;EAAM,CAAC;EAClCgB,gBAAgB,EAAE,IAAI;EACtBC,UAAU,EAAE,IAAI;EAChBC,UAAU,EAAE,KAAK;EACjBC,KAAK,EAAE,KAAK;EACZC,UAAU,EAAE,KAAK;EACjBC,eAAe,EAAE,IAAI;EACrBC,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBC,kBAAkB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC5BC,WAAW,EAAEA,CAAA,KAAM,CAAC,CAAC;EACrBC,SAAS,EAAE,QAAQ;EACnBC,aAAa,EAAE;IAAE1B,OAAO,EAAE;EAAK,CAAC;EAChC2B,qBAAqB,EAAE,KAAK;EAC5BC,yBAAyB,EAAE,IAAI;EAC/BC,YAAY,EAAE,KAAK;EACnBC,SAAS,EAAE,IAAI;EACfC,SAAS,EAAE,KAAK;EAChBC,mBAAmB,EAAE;IAAEhC,OAAO,EAAEW;EAAU,CAAC;EAC3CsB,gBAAgB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC1BC,QAAQ,EAAE,KAAK;EACfC,cAAc,EAAE,CAAC;EACjBC,cAAc,EAAE;AAClB,CAAC,CAAC;AAEF,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpC,MAAMC,OAAO,GAAG1C,KAAK,CAAC2C,UAAU,CAAC1C,aAAa,CAAC;EAC/C,IAAI,CAACyC,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CAAC,oDAAoD,CAAC;EACvE;EACA,OAAOF,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -54,6 +54,7 @@ export const isVertical = direction => {
|
|
|
54
54
|
return direction;
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
+
export const getSnapPointTransform = direction => isVertical(direction) ? 'translate3d(0, var(--snap-point-height), 0)' : 'translate3d(var(--snap-point-height), 0, 0)';
|
|
57
58
|
export function getTranslate(element, direction) {
|
|
58
59
|
if (!element) {
|
|
59
60
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cache","WeakMap","isInView","el","rect","getBoundingClientRect","window","visualViewport","top","left","bottom","height","right","width","set","styles","ignoreCache","HTMLElement","originalStyles","style","Object","entries","forEach","key","value","startsWith","setProperty","reset","prop","get","isVertical","direction","getTranslate","element","getComputedStyle","transform","webkitTransform","mozTransform","mat","match","parseFloat","split","dampenValue","v","Math","log","assignStyle","prevStyle","cssText","assign","chain","fns","args","fn"],"sourceRoot":"../../../../src","sources":["web/vaul/helpers.ts"],"mappings":";;AAMA;AACA;AACA;;AAGA,MAAMA,KAAK,GAAG,IAAIC,OAAO,CAAkD,CAAC;AAE5E,OAAO,SAASC,QAAQA,CAACC,EAAe,EAAW;EACjD,MAAMC,IAAI,GAAGD,EAAE,CAACE,qBAAqB,CAAC,CAAC;EAEvC,IAAI,CAACC,MAAM,CAACC,cAAc,EAAE,OAAO,KAAK;EAExC,OACEH,IAAI,CAACI,GAAG,IAAI,CAAC,IACbJ,IAAI,CAACK,IAAI,IAAI,CAAC;EACd;EACAL,IAAI,CAACM,MAAM,IAAIJ,MAAM,CAACC,cAAc,CAACI,MAAM,GAAG,EAAE,IAChDP,IAAI,CAACQ,KAAK,IAAIN,MAAM,CAACC,cAAc,CAACM,KAAK;AAE7C;AAEA,OAAO,SAASC,GAAGA,CACjBX,EAA4C,EAC5CY,MAAa,EACbC,WAAW,GAAG,KAAK,EACnB;EACA,IAAI,CAACb,EAAE,IAAI,EAAEA,EAAE,YAAYc,WAAW,CAAC,EAAE;EACzC,IAAIC,cAAkD,GAAG,CAAC,CAAC;EAC3D,MAAMC,KAAK,GAAGhB,EAAE,CAACgB,KAAuB;EAExCC,MAAM,CAACC,OAAO,CAACN,MAAM,CAAC,CAACO,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAmB,KAAK;IACjE,IAAID,GAAG,CAACE,UAAU,CAAC,IAAI,CAAC,EAAE;MACxBtB,EAAE,CAACgB,KAAK,CAACO,WAAW,CAACH,GAAG,EAAEC,KAAK,CAAC;MAChC;IACF;IAEAN,cAAc,CAACK,GAAG,CAAC,GAAGJ,KAAK,CAACI,GAAG,CAAC;IAChCJ,KAAK,CAACI,GAAG,CAAC,GAAGC,KAAK;EACpB,CAAC,CAAC;EAEF,IAAIR,WAAW,EAAE;EAEjBhB,KAAK,CAACc,GAAG,CAACX,EAAE,EAAEe,cAAc,CAAC;AAC/B;AAEA,OAAO,SAASS,KAAKA,CAACxB,EAAgC,EAAEyB,IAAa,EAAE;EACrE,IAAI,CAACzB,EAAE,IAAI,EAAEA,EAAE,YAAYc,WAAW,CAAC,EAAE;EACzC,IAAIC,cAAc,GAAGlB,KAAK,CAAC6B,GAAG,CAAC1B,EAAE,CAAC;EAElC,IAAI,CAACe,cAAc,EAAE;IACnB;EACF;EAEA,MAAMC,KAAK,GAAGhB,EAAE,CAACgB,KAAuB;EACxC,IAAIS,IAAI,EAAE;IACRT,KAAK,CAACS,IAAI,CAAC,GAAGV,cAAc,CAACU,IAAI,CAAC;EACpC,CAAC,MAAM;IACLR,MAAM,CAACC,OAAO,CAACH,cAAc,CAAC,CAACI,OAAO,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;MACvDL,KAAK,CAACI,GAAG,CAAC,GAAGC,KAAK;IACpB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAMM,UAAU,GAAIC,SAA0B,IAAK;EACxD,QAAQA,SAAS;IACf,KAAK,KAAK;IACV,KAAK,QAAQ;MACX,OAAO,IAAI;IACb,KAAK,MAAM;IACX,KAAK,OAAO;MACV,OAAO,KAAK;IACd;MACE,OAAOA,SAAS;EACpB;AACF,CAAC;AAED,OAAO,
|
|
1
|
+
{"version":3,"names":["cache","WeakMap","isInView","el","rect","getBoundingClientRect","window","visualViewport","top","left","bottom","height","right","width","set","styles","ignoreCache","HTMLElement","originalStyles","style","Object","entries","forEach","key","value","startsWith","setProperty","reset","prop","get","isVertical","direction","getSnapPointTransform","getTranslate","element","getComputedStyle","transform","webkitTransform","mozTransform","mat","match","parseFloat","split","dampenValue","v","Math","log","assignStyle","prevStyle","cssText","assign","chain","fns","args","fn"],"sourceRoot":"../../../../src","sources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CAACF,GAAG,CAAC,CAAC,CAAC,CAACG,KAAK,CAAC,IAAI,CAAC,CAACZ,UAAU,CAACC,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;EACxE;EACA;EACAQ,GAAG,GAAGH,SAAS,CAACI,KAAK,CAAC,kBAAkB,CAAC;EACzC,OAAOD,GAAG,GAAGE,UAAU,CAACF,GAAG,CAAC,CAAC,CAAC,CAACG,KAAK,CAAC,IAAI,CAAC,CAACZ,UAAU,CAACC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI;AACnF;AAEA,OAAO,SAASY,WAAWA,CAACC,CAAS,EAAE;EACrC,OAAO,CAAC,IAAIC,IAAI,CAACC,GAAG,CAACF,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;AAClC;AAEA,OAAO,SAASG,WAAWA,CACzBb,OAAuC,EACvCf,KAAmC,EACnC;EACA,IAAI,CAACe,OAAO,EAAE,OAAO,MAAM,CAAC,CAAC;EAE7B,MAAMc,SAAS,GAAGd,OAAO,CAACf,KAAK,CAAC8B,OAAO;EACvC7B,MAAM,CAAC8B,MAAM,CAAChB,OAAO,CAACf,KAAK,EAAEA,KAAK,CAAC;EAEnC,OAAO,MAAM;IACXe,OAAO,CAACf,KAAK,CAAC8B,OAAO,GAAGD,SAAS;EACnC,CAAC;AACH;;AAEA;AACA;AACA;AACA,OAAO,SAASG,KAAKA,CAAI,GAAGC,GAAQ,EAAE;EACpC,OAAO,CAAC,GAAGC,IAAmD,KAAK;IACjE,KAAK,MAAMC,EAAE,IAAIF,GAAG,EAAE;MACpB,IAAI,OAAOE,EAAE,KAAK,UAAU,EAAE;QAC5B;QACAA,EAAE,CAAC,GAAGD,IAAI,CAAC;MACb;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -7,8 +7,8 @@ import { Presence } from '@radix-ui/react-presence';
|
|
|
7
7
|
import { DrawerContext, useDrawerContext } from "./context.js";
|
|
8
8
|
import './style.css';
|
|
9
9
|
import { isIOS, isMobileFirefox } from "./browser.js";
|
|
10
|
-
import { BORDER_RADIUS, CLOSE_THRESHOLD, DRAG_CLASS, NESTED_DISPLACEMENT, SCROLL_LOCK_TIMEOUT, TRANSITIONS, VELOCITY_THRESHOLD, WINDOW_TOP_OFFSET } from "./constants.js";
|
|
11
|
-
import { dampenValue, getTranslate, isVertical, reset, set } from "./helpers.js";
|
|
10
|
+
import { BORDER_RADIUS, CLOSE_THRESHOLD, DISMISS_ATTEMPT_THRESHOLD, DRAG_CLASS, NESTED_DISPLACEMENT, SCROLL_LOCK_TIMEOUT, TRANSITIONS, VELOCITY_THRESHOLD, WINDOW_TOP_OFFSET } from "./constants.js";
|
|
11
|
+
import { dampenValue, getSnapPointTransform, getTranslate, isVertical, reset, set } from "./helpers.js";
|
|
12
12
|
import { useComposedRefs } from "./use-composed-refs.js";
|
|
13
13
|
import { useControllableState } from "./use-controllable-state.js";
|
|
14
14
|
import { usePositionFixed } from "./use-position-fixed.js";
|
|
@@ -28,6 +28,7 @@ export function Root({
|
|
|
28
28
|
closeThreshold = CLOSE_THRESHOLD,
|
|
29
29
|
scrollLockTimeout = SCROLL_LOCK_TIMEOUT,
|
|
30
30
|
dismissible = true,
|
|
31
|
+
onDismissAttempt,
|
|
31
32
|
draggable = true,
|
|
32
33
|
handleOnly = false,
|
|
33
34
|
fadeFromIndex = snapPoints && snapPoints.length - 1,
|
|
@@ -82,6 +83,7 @@ export function Root({
|
|
|
82
83
|
const isAllowedToDrag = React.useRef(false);
|
|
83
84
|
const nestedOpenChangeTimer = React.useRef(null);
|
|
84
85
|
const pointerStart = React.useRef(0);
|
|
86
|
+
const dismissAttempted = React.useRef(false);
|
|
85
87
|
const keyboardIsOpen = React.useRef(false);
|
|
86
88
|
const shouldAnimate = React.useRef(!defaultOpen);
|
|
87
89
|
const previousDiffFromInitial = React.useRef(0);
|
|
@@ -299,7 +301,14 @@ export function Root({
|
|
|
299
301
|
const noCloseSnapPointsPreCondition = snapPoints && !dismissible && !isDraggingInDirection;
|
|
300
302
|
|
|
301
303
|
// Disallow dragging down to close when first snap point is the active one and dismissible prop is set to false.
|
|
302
|
-
if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0)
|
|
304
|
+
if (noCloseSnapPointsPreCondition && activeSnapPointIndex === 0) {
|
|
305
|
+
// The drawer stays put. Remember a deliberate pull that would otherwise
|
|
306
|
+
// have dragged it (content at its top) so release() can report it.
|
|
307
|
+
if (-draggedDistance > DISMISS_ATTEMPT_THRESHOLD && (isAllowedToDrag.current || shouldDrag(event.target, isDraggingInDirection))) {
|
|
308
|
+
dismissAttempted.current = true;
|
|
309
|
+
}
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
303
312
|
|
|
304
313
|
// We need to capture last time when drag with scroll was triggered and have a timeout between
|
|
305
314
|
const absDraggedDistance = Math.abs(draggedDistance);
|
|
@@ -504,6 +513,19 @@ export function Root({
|
|
|
504
513
|
unfreezeScrollables();
|
|
505
514
|
setIsDragging(false);
|
|
506
515
|
dragEndTime.current = new Date();
|
|
516
|
+
if (dismissAttempted.current) {
|
|
517
|
+
dismissAttempted.current = false;
|
|
518
|
+
if (isOpen) onDismissAttempt?.();
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// The press that started this "drag" may have dismissed the drawer (e.g. a
|
|
522
|
+
// back button acting on pointerdown). Snapping now would overwrite the
|
|
523
|
+
// dismiss transform that closeDrawer just wrote and freeze the sheet in
|
|
524
|
+
// place until it unmounts.
|
|
525
|
+
if (!isOpen) {
|
|
526
|
+
if (pointerEvent) onReleaseProp?.(pointerEvent, false);
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
507
529
|
const swipeAmount = getTranslate(drawerRef.current, direction);
|
|
508
530
|
|
|
509
531
|
// Drag overshoot below the lowest snap point translates the detached
|
|
@@ -648,6 +670,7 @@ export function Root({
|
|
|
648
670
|
onTouchDrag: (event, pointerEvent) => drag(event, pointerEvent),
|
|
649
671
|
onTouchRelease: (event, pointerEvent) => release(event, pointerEvent),
|
|
650
672
|
dismissible,
|
|
673
|
+
onDismissAttempt,
|
|
651
674
|
shouldAnimate,
|
|
652
675
|
handleOnly,
|
|
653
676
|
isOpen,
|
|
@@ -772,6 +795,7 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
772
795
|
snapPoints,
|
|
773
796
|
setActiveSnapPoint,
|
|
774
797
|
dismissible,
|
|
798
|
+
onDismissAttempt,
|
|
775
799
|
container,
|
|
776
800
|
handleOnly,
|
|
777
801
|
shouldAnimate,
|
|
@@ -885,10 +909,10 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
885
909
|
// same detent). Without this, position goes stale mid-animation because
|
|
886
910
|
// the drawer's `transitionrun` never fires.
|
|
887
911
|
const onTransitionRun = e => {
|
|
888
|
-
if ((e.target === drawer || e.target === wrapper) && e.propertyName === 'transform') state.start();
|
|
912
|
+
if ((e.target === drawer || e.target === wrapper) && (e.propertyName === 'transform' || e.propertyName === '--snap-point-height')) state.start();
|
|
889
913
|
};
|
|
890
914
|
const onTransitionDone = e => {
|
|
891
|
-
if ((e.target === drawer || e.target === wrapper) && e.propertyName === 'transform') state.stop();
|
|
915
|
+
if ((e.target === drawer || e.target === wrapper) && (e.propertyName === 'transform' || e.propertyName === '--snap-point-height')) state.stop();
|
|
892
916
|
};
|
|
893
917
|
const onAnimationStart = e => {
|
|
894
918
|
if (e.target === drawer || e.target === wrapper) state.start();
|
|
@@ -984,6 +1008,10 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
984
1008
|
}
|
|
985
1009
|
wasOpenRef.current = isOpen;
|
|
986
1010
|
}, [isOpen, detached, drawerRef]);
|
|
1011
|
+
|
|
1012
|
+
// Subsequent snap writes belong to useSnapPoints. A React style update on
|
|
1013
|
+
// release would overwrite the live drag value before its transition starts.
|
|
1014
|
+
const initialSnapPointOffset = React.useRef(snapPointsOffset?.[activeSnapPointIndex ?? 0] ?? 0);
|
|
987
1015
|
const contentNode = /*#__PURE__*/_jsx(DialogPrimitive.Content, {
|
|
988
1016
|
"data-vaul-drawer-direction": direction,
|
|
989
1017
|
"data-vaul-drawer": "",
|
|
@@ -995,7 +1023,8 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
995
1023
|
...rest,
|
|
996
1024
|
ref: composedRef,
|
|
997
1025
|
style: snapPointsOffset && snapPointsOffset.length > 0 ? {
|
|
998
|
-
'--snap-point-height': `${
|
|
1026
|
+
'--snap-point-height': `${initialSnapPointOffset.current}px`,
|
|
1027
|
+
'transform': getSnapPointTransform(direction),
|
|
999
1028
|
...style,
|
|
1000
1029
|
'pointerEvents': 'auto'
|
|
1001
1030
|
} : {
|
|
@@ -1048,6 +1077,8 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
1048
1077
|
e.preventDefault();
|
|
1049
1078
|
if (hasSnapPoints && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex > 0) {
|
|
1050
1079
|
setActiveSnapPoint(snapPoints[0]);
|
|
1080
|
+
} else {
|
|
1081
|
+
onDismissAttempt?.();
|
|
1051
1082
|
}
|
|
1052
1083
|
}
|
|
1053
1084
|
},
|
|
@@ -1170,6 +1201,7 @@ export const Handle = /*#__PURE__*/React.forwardRef(({
|
|
|
1170
1201
|
activeSnapPoint,
|
|
1171
1202
|
setActiveSnapPoint,
|
|
1172
1203
|
dismissible,
|
|
1204
|
+
onDismissAttempt,
|
|
1173
1205
|
handleOnly,
|
|
1174
1206
|
isOpen,
|
|
1175
1207
|
onPress,
|
|
@@ -1206,6 +1238,12 @@ export const Handle = /*#__PURE__*/React.forwardRef(({
|
|
|
1206
1238
|
closeDrawer();
|
|
1207
1239
|
return;
|
|
1208
1240
|
}
|
|
1241
|
+
|
|
1242
|
+
// Mirrors native: a single-detent sheet's handle tap is a dismiss.
|
|
1243
|
+
if (isLastSnapPoint && snapPoints.length === 1) {
|
|
1244
|
+
onDismissAttempt?.();
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1209
1247
|
const currentSnapIndex = snapPoints.findIndex(point => point === activeSnapPoint);
|
|
1210
1248
|
if (currentSnapIndex === -1) return; // activeSnapPoint not found in snapPoints
|
|
1211
1249
|
const nextSnapPoint = snapPoints[currentSnapIndex + 1];
|