@lodev09/react-native-true-sheet 3.11.0-beta.0 → 3.11.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewManager.kt +3 -3
- package/ios/TrueSheetFooterView.mm +10 -1
- package/ios/TrueSheetView.mm +1 -1
- package/ios/TrueSheetViewController.h +1 -1
- package/ios/TrueSheetViewController.mm +10 -4
- package/lib/module/TrueSheet.js +2 -2
- package/lib/module/TrueSheet.js.map +1 -1
- package/lib/module/TrueSheet.web.js +226 -51
- package/lib/module/TrueSheet.web.js.map +1 -1
- package/lib/module/TrueSheetProvider.web.js +5 -2
- package/lib/module/TrueSheetProvider.web.js.map +1 -1
- package/lib/module/fabric/TrueSheetViewNativeComponent.ts +1 -1
- package/lib/module/web/constants.js +1 -1
- package/lib/module/web/constants.js.map +1 -1
- package/lib/module/web/vaul/index.js +102 -127
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/style.css +1 -1
- package/lib/typescript/src/TrueSheet.types.d.ts +6 -4
- 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/TrueSheetProvider.web.d.ts +2 -1
- package/lib/typescript/src/TrueSheetProvider.web.d.ts.map +1 -1
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/fabric/TrueSheetViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +1 -1
- 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/vaul/index.d.ts +8 -2
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts +2 -2
- package/lib/typescript/src/web/vaul/use-prevent-scroll.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/TrueSheet.tsx +2 -2
- package/src/TrueSheet.types.ts +6 -4
- package/src/TrueSheet.web.tsx +225 -55
- package/src/TrueSheetProvider.web.tsx +11 -2
- package/src/fabric/TrueSheetViewNativeComponent.ts +1 -1
- package/src/navigation/types.ts +1 -1
- package/src/web/constants.ts +1 -1
- package/src/web/vaul/index.tsx +550 -552
- package/src/web/vaul/style.css +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useCallback","useContext","useEffect","useLayoutEffect","useMemo","useRef","useSyncExternalStore","jsx","_jsx","jsxs","_jsxs","SheetContext","NO_PROVIDER_ERROR","EMPTY_STACK","Object","freeze","TrueSheetProvider","children","namedSheetsRef","Map","stackRef","listenersRef","Set","portalContainer","document","createElement","anchorRef","anchor","current","appendChild","parentNode","removeChild","value","notify","forEach","listener","registerByName","name","ref","set","get","delete","resolveByName","methods","Error","pushOpen","entry","some","e","popOpen","idx","findIndex","slice","subscribeStack","add","getStackSnapshot","Provider","usePortalContainer","ctx","useTrueSheet","reject","present","resize","dismiss","dismissStack","dismissAll","index","animated","stack","Promise","all","reverse","map","useRegisterSheet","useSheetStack","nodeRef","isOpen","subscribe","getSnapshot","stackIndex","isNested","descendants","dismissAbove","snapshot","above"],"sourceRoot":"../../src","sources":["TrueSheetProvider.web.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,oBAAoB,QAGf,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;
|
|
1
|
+
{"version":3,"names":["createContext","useCallback","useContext","useEffect","useLayoutEffect","useMemo","useRef","useSyncExternalStore","jsx","_jsx","jsxs","_jsxs","SheetContext","NO_PROVIDER_ERROR","EMPTY_STACK","Object","freeze","TrueSheetProvider","children","namedSheetsRef","Map","stackRef","listenersRef","Set","portalContainer","document","createElement","anchorRef","anchor","current","appendChild","parentNode","removeChild","value","notify","forEach","listener","registerByName","name","ref","set","get","delete","resolveByName","methods","Error","pushOpen","entry","some","e","popOpen","idx","findIndex","slice","subscribeStack","add","getStackSnapshot","Provider","usePortalContainer","ctx","useTrueSheet","reject","present","resize","dismiss","dismissStack","dismissAll","index","animated","stack","Promise","all","reverse","map","useRegisterSheet","useSheetStack","nodeRef","isOpen","isFormSheet","isFormSheetRef","subscribe","getSnapshot","stackIndex","isNested","descendants","dismissAbove","snapshot","above"],"sourceRoot":"../../src","sources":["TrueSheetProvider.web.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,oBAAoB,QAGf,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAuBf,MAAMC,YAAY,gBAAGZ,aAAa,CAA2B,IAAI,CAAC;AAElE,MAAMa,iBAAiB,GACrB,2EAA2E;AAE7E,MAAMC,WAAkC,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AAM5D,OAAO,SAASC,iBAAiBA,CAAC;EAAEC;AAAiC,CAAC,EAAE;EACtE,MAAMC,cAAc,GAAGb,MAAM,CAAwB,IAAIc,GAAG,CAAC,CAAC,CAAC;EAC/D,MAAMC,QAAQ,GAAGf,MAAM,CAAwBQ,WAAW,CAAC;EAC3D,MAAMQ,YAAY,GAAGhB,MAAM,CAAkB,IAAIiB,GAAG,CAAC,CAAC,CAAC;;EAEvD;EACA;EACA;EACA,MAAMC,eAAe,GAAGnB,OAAO,CAC7B,MAAO,OAAOoB,QAAQ,KAAK,WAAW,GAAGA,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC,GAAG,IAAK,EAC9E,EACF,CAAC;EACD,MAAMC,SAAS,GAAGrB,MAAM,CAAwB,IAAI,CAAC;EAEr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C,WAAW;IAAED,QAAQ;IAAEE;EAAa,CAAC;AAChD","ignoreList":[]}
|
|
@@ -101,7 +101,7 @@ export interface NativeProps extends ViewProps {
|
|
|
101
101
|
initialDetentAnimated?: WithDefault<boolean, true>;
|
|
102
102
|
scrollable?: WithDefault<boolean, false>;
|
|
103
103
|
scrollableOptions?: ScrollableOptionsType;
|
|
104
|
-
|
|
104
|
+
presentation?: WithDefault<'page' | 'form', 'page'>;
|
|
105
105
|
|
|
106
106
|
// Event handlers
|
|
107
107
|
onMount?: DirectEventHandler<null>;
|
|
@@ -12,5 +12,5 @@ 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)';
|
|
13
13
|
export const DEFAULT_GRABBER_WIDTH = 32;
|
|
14
14
|
export const DEFAULT_GRABBER_HEIGHT = 4;
|
|
15
|
-
export const DEFAULT_GRABBER_TOP_MARGIN =
|
|
15
|
+
export const DEFAULT_GRABBER_TOP_MARGIN = 8;
|
|
16
16
|
//# sourceMappingURL=constants.js.map
|
|
@@ -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","DEFAULT_ANCHOR_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,qBAAqB,GAAG,EAAE;AACvC,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,
|
|
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_ANCHOR_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,qBAAqB,GAAG,EAAE;AACvC,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":[]}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
5
4
|
import React from 'react';
|
|
5
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
6
|
+
import { Presence } from '@radix-ui/react-presence';
|
|
6
7
|
import { DrawerContext, useDrawerContext } from "./context.js";
|
|
7
8
|
import './style.css';
|
|
8
|
-
import {
|
|
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";
|
|
9
12
|
import { useComposedRefs } from "./use-composed-refs.js";
|
|
10
|
-
import { useSnapPoints } from "./use-snap-points.js";
|
|
11
|
-
import { set, getTranslate, dampenValue, isVertical, reset } from "./helpers.js";
|
|
12
|
-
import { TRANSITIONS, VELOCITY_THRESHOLD, CLOSE_THRESHOLD, SCROLL_LOCK_TIMEOUT, BORDER_RADIUS, NESTED_DISPLACEMENT, WINDOW_TOP_OFFSET, DRAG_CLASS } from "./constants.js";
|
|
13
13
|
import { useControllableState } from "./use-controllable-state.js";
|
|
14
|
-
import { useScaleBackground } from "./use-scale-background.js";
|
|
15
14
|
import { usePositionFixed } from "./use-position-fixed.js";
|
|
16
|
-
import {
|
|
15
|
+
import { isInput, usePreventScroll } from "./use-prevent-scroll.js";
|
|
16
|
+
import { useScaleBackground } from "./use-scale-background.js";
|
|
17
|
+
import { useSnapPoints } from "./use-snap-points.js";
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
export function Root({
|
|
19
20
|
open: openProp,
|
|
@@ -52,7 +53,8 @@ export function Root({
|
|
|
52
53
|
detachedRadius = 0,
|
|
53
54
|
detachedWrapperStyle,
|
|
54
55
|
maxContentHeight,
|
|
55
|
-
initialAnimated = true
|
|
56
|
+
initialAnimated = true,
|
|
57
|
+
onContentHeightChange
|
|
56
58
|
}) {
|
|
57
59
|
const [isOpen = false, setIsOpen] = useControllableState({
|
|
58
60
|
defaultProp: defaultOpen,
|
|
@@ -65,17 +67,6 @@ export function Root({
|
|
|
65
67
|
setTimeout(() => {
|
|
66
68
|
onAnimationEnd?.(o);
|
|
67
69
|
}, TRANSITIONS.DURATION * 1000);
|
|
68
|
-
if (o && !modal) {
|
|
69
|
-
if (typeof window !== 'undefined') {
|
|
70
|
-
window.requestAnimationFrame(() => {
|
|
71
|
-
document.body.style.pointerEvents = 'auto';
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (!o) {
|
|
76
|
-
// This will be removed when the exit animation ends (`500ms`)
|
|
77
|
-
document.body.style.pointerEvents = 'auto';
|
|
78
|
-
}
|
|
79
70
|
}
|
|
80
71
|
});
|
|
81
72
|
const [hasBeenOpened, setHasBeenOpened] = React.useState(false);
|
|
@@ -97,6 +88,13 @@ export function Root({
|
|
|
97
88
|
const drawerWidthRef = React.useRef(drawerRef.current?.getBoundingClientRect().width || 0);
|
|
98
89
|
const initialDrawerHeight = React.useRef(0);
|
|
99
90
|
const [contentHeight, setContentHeight] = React.useState(0);
|
|
91
|
+
const onContentHeightChangeRef = React.useRef(onContentHeightChange);
|
|
92
|
+
React.useEffect(() => {
|
|
93
|
+
onContentHeightChangeRef.current = onContentHeightChange;
|
|
94
|
+
});
|
|
95
|
+
React.useEffect(() => {
|
|
96
|
+
onContentHeightChangeRef.current?.(contentHeight);
|
|
97
|
+
}, [contentHeight]);
|
|
100
98
|
const onSnapPointChange = React.useCallback(activeSnapPointIndex => {
|
|
101
99
|
// Change openTime ref when we reach the last snap point to prevent dragging for 500ms incase it's scrollable.
|
|
102
100
|
if (snapPoints && activeSnapPointIndex === snapPointsOffset.length - 1) openTime.current = new Date();
|
|
@@ -331,63 +329,6 @@ export function Root({
|
|
|
331
329
|
React.useEffect(() => {
|
|
332
330
|
onPositionChangeRef.current = onPositionChange;
|
|
333
331
|
});
|
|
334
|
-
|
|
335
|
-
// Radix's DismissableLayer (modal) sets body pointer-events to "none" so the
|
|
336
|
-
// overlay traps clicks. When the active snap is below fadeFromIndex the
|
|
337
|
-
// overlay is fully transparent, and we want clicks to reach the content
|
|
338
|
-
// behind the drawer — so we restore body interactivity. DismissableLayer
|
|
339
|
-
// captures its DOM node via a ref-callback `setNode`, so its body write
|
|
340
|
-
// runs one render later than ours on initial open — re-assert on rAF so
|
|
341
|
-
// the final write is ours.
|
|
342
|
-
React.useEffect(() => {
|
|
343
|
-
if (!modal || !snapPoints || fadeFromIndex === undefined) return;
|
|
344
|
-
// On close, restore body interactivity. `useControllableState.onChange`
|
|
345
|
-
// only fires for internal `setIsOpen` calls — when the parent flips the
|
|
346
|
-
// `open` prop imperatively, the reset at line ~201 never runs.
|
|
347
|
-
if (!isOpen) {
|
|
348
|
-
document.body.style.pointerEvents = 'auto';
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (typeof activeSnapPointIndex !== 'number') return;
|
|
352
|
-
const isBelowFade = activeSnapPointIndex < fadeFromIndex;
|
|
353
|
-
const value = isBelowFade ? 'auto' : 'none';
|
|
354
|
-
document.body.style.pointerEvents = value;
|
|
355
|
-
const id = window.requestAnimationFrame(() => {
|
|
356
|
-
document.body.style.pointerEvents = value;
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
// React Navigation keeps unfocused screens mounted with `display: none` on
|
|
360
|
-
// web, so the drawer never unmounts and neither `isOpen` nor this effect's
|
|
361
|
-
// deps change — a lingering `none` body style would then leak to whichever
|
|
362
|
-
// screen becomes visible. Observe the drawer: when an ancestor hides it,
|
|
363
|
-
// restore `auto`; when it returns, re-apply the desired value.
|
|
364
|
-
let observer = null;
|
|
365
|
-
let rafId = 0;
|
|
366
|
-
const startObserving = () => {
|
|
367
|
-
const node = drawerRef.current;
|
|
368
|
-
if (!node) {
|
|
369
|
-
rafId = window.requestAnimationFrame(startObserving);
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
observer = new IntersectionObserver(entries => {
|
|
373
|
-
const entry = entries[entries.length - 1];
|
|
374
|
-
if (!entry) return;
|
|
375
|
-
document.body.style.pointerEvents = entry.isIntersecting ? value : 'auto';
|
|
376
|
-
});
|
|
377
|
-
observer.observe(node);
|
|
378
|
-
};
|
|
379
|
-
rafId = window.requestAnimationFrame(startObserving);
|
|
380
|
-
|
|
381
|
-
// Always restore on cleanup so an unmount while the sheet is still open
|
|
382
|
-
// doesn't leave the page uninteractive. If the effect re-runs for a
|
|
383
|
-
// normal state change, it re-applies the correct value.
|
|
384
|
-
return () => {
|
|
385
|
-
window.cancelAnimationFrame(id);
|
|
386
|
-
window.cancelAnimationFrame(rafId);
|
|
387
|
-
observer?.disconnect();
|
|
388
|
-
document.body.style.pointerEvents = 'auto';
|
|
389
|
-
};
|
|
390
|
-
}, [isOpen, modal, snapPoints, fadeFromIndex, activeSnapPointIndex]);
|
|
391
332
|
React.useEffect(() => {
|
|
392
333
|
function onVisualViewportChange() {
|
|
393
334
|
if (!drawerRef.current || !repositionInputs) return;
|
|
@@ -431,7 +372,7 @@ export function Root({
|
|
|
431
372
|
drawerRef.current.style.height = `${initialDrawerHeight.current}px`;
|
|
432
373
|
}
|
|
433
374
|
if (snapPoints && snapPoints.length > 0 && !keyboardIsOpen.current) {
|
|
434
|
-
drawerRef.current.style.bottom =
|
|
375
|
+
drawerRef.current.style.bottom = '0px';
|
|
435
376
|
} else {
|
|
436
377
|
// Negative bottom value would never make sense
|
|
437
378
|
drawerRef.current.style.bottom = `${Math.max(diffFromInitial, 0)}px`;
|
|
@@ -592,14 +533,6 @@ export function Root({
|
|
|
592
533
|
});
|
|
593
534
|
}
|
|
594
535
|
}
|
|
595
|
-
React.useEffect(() => {
|
|
596
|
-
if (!modal) {
|
|
597
|
-
// Need to do this manually unfortunately
|
|
598
|
-
window.requestAnimationFrame(() => {
|
|
599
|
-
document.body.style.pointerEvents = 'auto';
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
}, [modal]);
|
|
603
536
|
return /*#__PURE__*/_jsx(DialogPrimitive.Root, {
|
|
604
537
|
defaultOpen: defaultOpen,
|
|
605
538
|
onOpenChange: open => {
|
|
@@ -611,8 +544,16 @@ export function Root({
|
|
|
611
544
|
}
|
|
612
545
|
setIsOpen(open);
|
|
613
546
|
},
|
|
614
|
-
open: isOpen
|
|
615
|
-
modal
|
|
547
|
+
open: isOpen
|
|
548
|
+
// Always non-modal at the Radix level — Radix's modal mode locks
|
|
549
|
+
// body.style.pointerEvents and its restore on layer unmount is buggy
|
|
550
|
+
// (see git history). Vaul's own overlay handles click-trapping; the
|
|
551
|
+
// overlay sets pointer-events: none below fadeFromIndex so clicks
|
|
552
|
+
// pass through to the page (matches native dimmedDetentIndex). Vaul's
|
|
553
|
+
// own `modal` prop still drives overlay rendering and click-outside
|
|
554
|
+
// behavior below.
|
|
555
|
+
,
|
|
556
|
+
modal: false,
|
|
616
557
|
children: /*#__PURE__*/_jsx(DrawerContext.Provider, {
|
|
617
558
|
value: {
|
|
618
559
|
activeSnapPoint,
|
|
@@ -656,10 +597,10 @@ export function Root({
|
|
|
656
597
|
})
|
|
657
598
|
});
|
|
658
599
|
}
|
|
659
|
-
export const Overlay = /*#__PURE__*/React.forwardRef(
|
|
600
|
+
export const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
660
601
|
style,
|
|
661
602
|
...rest
|
|
662
|
-
}, ref) {
|
|
603
|
+
}, ref) => {
|
|
663
604
|
const {
|
|
664
605
|
overlayRef,
|
|
665
606
|
snapPoints,
|
|
@@ -695,34 +636,42 @@ export const Overlay = /*#__PURE__*/React.forwardRef(function ({
|
|
|
695
636
|
// `snapToPoint` runs (Presence defers the drawer/overlay mount, leaving
|
|
696
637
|
// refs null on the first open effect pass).
|
|
697
638
|
const isBelowFade = hasSnapPoints && fadeFromIndex !== undefined && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex < fadeFromIndex;
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
639
|
+
|
|
640
|
+
// Render our own overlay element instead of `DialogPrimitive.Overlay`:
|
|
641
|
+
// Radix's Overlay returns null when the Dialog is non-modal, and we run
|
|
642
|
+
// Radix as `modal={false}` to keep it from locking body pointer-events.
|
|
643
|
+
// `Presence` keeps the node mounted through the closing animation
|
|
644
|
+
// (`fadeOut`) before unmounting.
|
|
645
|
+
return /*#__PURE__*/_jsx(Presence, {
|
|
646
|
+
present: isOpen,
|
|
647
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
648
|
+
onMouseUp: onMouseUp,
|
|
649
|
+
ref: composedRef,
|
|
650
|
+
"data-state": isOpen ? 'open' : 'closed',
|
|
651
|
+
"data-vaul-overlay": "",
|
|
652
|
+
"data-vaul-snap-points": isOpen && hasSnapPoints ? 'true' : 'false',
|
|
653
|
+
"data-vaul-delayed-snap-points": delayedSnapPoints ? 'true' : 'false',
|
|
654
|
+
"data-vaul-snap-points-overlay": isOpen && shouldFade ? 'true' : 'false',
|
|
655
|
+
"data-vaul-animate": shouldAnimate?.current ? 'true' : 'false',
|
|
656
|
+
...rest,
|
|
657
|
+
style: overlayStyle(style, !!isBelowFade)
|
|
658
|
+
})
|
|
708
659
|
});
|
|
709
660
|
});
|
|
710
661
|
Overlay.displayName = 'Drawer.Overlay';
|
|
711
|
-
const
|
|
712
|
-
pointerEvents: 'none'
|
|
713
|
-
};
|
|
714
|
-
const overlayBelowFadeStyle = style => style ? {
|
|
662
|
+
const overlayStyle = (style, isBelowFade) => ({
|
|
715
663
|
...style,
|
|
716
|
-
|
|
717
|
-
}
|
|
718
|
-
export const Content = /*#__PURE__*/React.forwardRef(
|
|
664
|
+
pointerEvents: isBelowFade ? 'none' : 'auto'
|
|
665
|
+
});
|
|
666
|
+
export const Content = /*#__PURE__*/React.forwardRef(({
|
|
719
667
|
onPointerDownOutside,
|
|
668
|
+
onEscapeKeyDown,
|
|
720
669
|
style,
|
|
721
670
|
onOpenAutoFocus,
|
|
722
671
|
children,
|
|
723
672
|
detachedSiblings,
|
|
724
673
|
...rest
|
|
725
|
-
}, ref) {
|
|
674
|
+
}, ref) => {
|
|
726
675
|
const {
|
|
727
676
|
drawerRef,
|
|
728
677
|
onPress,
|
|
@@ -737,6 +686,8 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
737
686
|
isDragging,
|
|
738
687
|
direction,
|
|
739
688
|
snapPoints,
|
|
689
|
+
setActiveSnapPoint,
|
|
690
|
+
dismissible,
|
|
740
691
|
container,
|
|
741
692
|
handleOnly,
|
|
742
693
|
shouldAnimate,
|
|
@@ -748,16 +699,16 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
748
699
|
detachedRadius,
|
|
749
700
|
detachedWrapperStyle: detachedWrapperStyleProp
|
|
750
701
|
} = useDrawerContext();
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
//
|
|
754
|
-
//
|
|
755
|
-
//
|
|
756
|
-
//
|
|
702
|
+
// Always measure the inner wrapper's natural height. The drawer itself may
|
|
703
|
+
// be styled to a fixed viewport height, so we measure an inner wrapper
|
|
704
|
+
// instead. Ref callback starts the observer as soon as the node mounts
|
|
705
|
+
// (Radix Presence defers the portal mount past useEffect). The measurement
|
|
706
|
+
// drives the 'auto' snap point and is also exposed via
|
|
707
|
+
// `onContentHeightChange` for callers that size the surrounding card.
|
|
757
708
|
const autoRoRef = React.useRef(null);
|
|
758
709
|
const setAutoSizeNode = React.useCallback(node => {
|
|
759
710
|
autoRoRef.current?.disconnect();
|
|
760
|
-
if (!node
|
|
711
|
+
if (!node) {
|
|
761
712
|
autoRoRef.current = null;
|
|
762
713
|
return;
|
|
763
714
|
}
|
|
@@ -766,7 +717,7 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
766
717
|
const ro = new ResizeObserver(measure);
|
|
767
718
|
ro.observe(node);
|
|
768
719
|
autoRoRef.current = ro;
|
|
769
|
-
}, [
|
|
720
|
+
}, [setContentHeight]);
|
|
770
721
|
const isBelowFade = snapPoints !== undefined && snapPoints !== null && fadeFromIndex !== undefined && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex < fadeFromIndex;
|
|
771
722
|
// Needed to use transition instead of animations
|
|
772
723
|
const [delayedSnapPoints, setDelayedSnapPoints] = React.useState(false);
|
|
@@ -921,7 +872,10 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
921
872
|
// Translate the wrapper off-screen on dismiss so the whole card slides out
|
|
922
873
|
// as one. The reset-then-target pattern on open forces the browser to
|
|
923
874
|
// record a starting value so the transition actually animates.
|
|
924
|
-
|
|
875
|
+
// Start at `false` so a mount with `isOpen=true` (autopresent via
|
|
876
|
+
// `initialDetentIndex`) is detected as a false→true transition and runs
|
|
877
|
+
// the slide-up animation instead of snapping straight to rest.
|
|
878
|
+
const wasOpenRef = React.useRef(false);
|
|
925
879
|
React.useEffect(() => {
|
|
926
880
|
if (!drawerRef.current) {
|
|
927
881
|
wasOpenRef.current = isOpen;
|
|
@@ -941,10 +895,6 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
941
895
|
void wrapper.offsetHeight;
|
|
942
896
|
wrapper.style.transition = transition;
|
|
943
897
|
wrapper.style.transform = 'translate3d(0, 0, 0)';
|
|
944
|
-
} else if (isOpen && !wrapper.style.transform) {
|
|
945
|
-
// Fresh mount with open=true — ensure the wrapper starts at rest.
|
|
946
|
-
wrapper.style.transition = transition;
|
|
947
|
-
wrapper.style.transform = 'translate3d(0, 0, 0)';
|
|
948
898
|
}
|
|
949
899
|
}
|
|
950
900
|
wasOpenRef.current = isOpen;
|
|
@@ -988,16 +938,41 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
988
938
|
e.preventDefault();
|
|
989
939
|
return;
|
|
990
940
|
}
|
|
941
|
+
|
|
942
|
+
// Non-dismissible + dimmed: collapse to the highest non-dimmed
|
|
943
|
+
// snap point instead of silently swallowing the dismiss attempt.
|
|
944
|
+
// Mirrors the native Android dim-tap behavior.
|
|
945
|
+
if (!dismissible && hasSnapPoints && fadeFromIndex !== undefined && fadeFromIndex > 0 && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex >= fadeFromIndex) {
|
|
946
|
+
e.preventDefault();
|
|
947
|
+
setActiveSnapPoint(snapPoints[fadeFromIndex - 1]);
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
991
950
|
if (keyboardIsOpen.current) {
|
|
992
951
|
keyboardIsOpen.current = false;
|
|
993
952
|
}
|
|
994
953
|
},
|
|
995
|
-
|
|
996
|
-
|
|
954
|
+
onEscapeKeyDown: e => {
|
|
955
|
+
onEscapeKeyDown?.(e);
|
|
956
|
+
if (e.defaultPrevented) return;
|
|
957
|
+
|
|
958
|
+
// Non-dismissible: collapse to the first snap point (if above it)
|
|
959
|
+
// instead of silently swallowing the dismiss attempt. Mirrors the
|
|
960
|
+
// native Android back-press behavior.
|
|
961
|
+
if (!dismissible) {
|
|
997
962
|
e.preventDefault();
|
|
998
|
-
|
|
963
|
+
if (hasSnapPoints && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex > 0) {
|
|
964
|
+
setActiveSnapPoint(snapPoints[0]);
|
|
965
|
+
}
|
|
999
966
|
}
|
|
1000
967
|
},
|
|
968
|
+
onFocusOutside: e => {
|
|
969
|
+
// Never auto-dismiss the sheet on focus shifts. Without Radix's
|
|
970
|
+
// FocusScope trap (we run modal={false}), this fires whenever
|
|
971
|
+
// focus naturally leaves the drawer — e.g. React Navigation's
|
|
972
|
+
// web driver hides the previous screen via display:none, which
|
|
973
|
+
// moves focus off the trigger and dismisses the sheet.
|
|
974
|
+
e.preventDefault();
|
|
975
|
+
},
|
|
1001
976
|
onPointerMove: event => {
|
|
1002
977
|
lastKnownPointerEventRef.current = event;
|
|
1003
978
|
if (handleOnly) return;
|
|
@@ -1031,12 +1006,12 @@ export const Content = /*#__PURE__*/React.forwardRef(function ({
|
|
|
1031
1006
|
handleOnPointerUp(lastKnownPointerEventRef.current);
|
|
1032
1007
|
}
|
|
1033
1008
|
},
|
|
1034
|
-
children:
|
|
1009
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
1035
1010
|
ref: setAutoSizeNode,
|
|
1036
1011
|
"data-vaul-auto-size-wrapper": "",
|
|
1037
1012
|
style: autoSizeWrapperStyle,
|
|
1038
1013
|
children: children
|
|
1039
|
-
})
|
|
1014
|
+
})
|
|
1040
1015
|
});
|
|
1041
1016
|
return /*#__PURE__*/_jsxs("div", {
|
|
1042
1017
|
"data-vaul-detached-wrapper": "",
|
|
@@ -1055,11 +1030,11 @@ const autoSizeWrapperStyle = {
|
|
|
1055
1030
|
};
|
|
1056
1031
|
const LONG_HANDLE_PRESS_TIMEOUT = 250;
|
|
1057
1032
|
const DOUBLE_TAP_TIMEOUT = 120;
|
|
1058
|
-
export const Handle = /*#__PURE__*/React.forwardRef(
|
|
1033
|
+
export const Handle = /*#__PURE__*/React.forwardRef(({
|
|
1059
1034
|
preventCycle = false,
|
|
1060
1035
|
children,
|
|
1061
1036
|
...rest
|
|
1062
|
-
}, ref) {
|
|
1037
|
+
}, ref) => {
|
|
1063
1038
|
const {
|
|
1064
1039
|
closeDrawer,
|
|
1065
1040
|
isDragging,
|