@lodev09/react-native-true-sheet 3.11.0-beta.1 → 3.11.0-beta.11
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/TrueSheetViewController.kt +19 -2
- 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 +222 -50
- 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/navigation/TrueSheetRouter.js +1 -1
- package/lib/module/navigation/TrueSheetRouter.js.map +1 -1
- package/lib/module/navigation/createTrueSheetNavigator.js +1 -1
- package/lib/module/navigation/createTrueSheetNavigator.js.map +1 -1
- package/lib/module/navigation/useTrueSheetNavigation.js +1 -1
- package/lib/module/navigation/useTrueSheetNavigation.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/vaul/browser.js +1 -1
- package/lib/module/web/vaul/browser.js.map +1 -1
- package/lib/module/web/vaul/index.js +88 -133
- package/lib/module/web/vaul/index.js.map +1 -1
- package/lib/module/web/vaul/style.css +1 -1
- package/lib/module/web/vaul/style.css.d.js +2 -0
- package/lib/module/web/vaul/style.css.d.js.map +1 -0
- 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/TrueSheetRouter.d.ts +1 -1
- package/lib/typescript/src/navigation/TrueSheetRouter.d.ts.map +1 -1
- package/lib/typescript/src/navigation/TrueSheetView.d.ts +1 -1
- package/lib/typescript/src/navigation/TrueSheetView.d.ts.map +1 -1
- package/lib/typescript/src/navigation/createTrueSheetNavigator.d.ts +1 -1
- package/lib/typescript/src/navigation/createTrueSheetNavigator.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/types.d.ts +1 -1
- package/lib/typescript/src/navigation/screen/types.d.ts.map +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts +1 -1
- package/lib/typescript/src/navigation/screen/useSheetScreenState.d.ts.map +1 -1
- package/lib/typescript/src/navigation/types.d.ts +2 -2
- package/lib/typescript/src/navigation/types.d.ts.map +1 -1
- package/lib/typescript/src/navigation/useTrueSheetNavigation.d.ts +1 -1
- package/lib/typescript/src/navigation/useTrueSheetNavigation.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 +7 -1
- package/lib/typescript/src/web/vaul/index.d.ts.map +1 -1
- package/package.json +26 -19
- package/src/TrueSheet.tsx +2 -2
- package/src/TrueSheet.types.ts +6 -4
- package/src/TrueSheet.web.tsx +220 -52
- package/src/TrueSheetProvider.web.tsx +11 -2
- package/src/fabric/TrueSheetViewNativeComponent.ts +1 -1
- package/src/navigation/TrueSheetRouter.ts +1 -1
- package/src/navigation/TrueSheetView.tsx +1 -1
- package/src/navigation/createTrueSheetNavigator.tsx +1 -1
- package/src/navigation/screen/types.ts +1 -1
- package/src/navigation/screen/useSheetScreenState.ts +1 -1
- package/src/navigation/types.ts +2 -2
- package/src/navigation/useTrueSheetNavigation.ts +1 -1
- package/src/web/constants.ts +1 -1
- package/src/web/vaul/index.tsx +118 -146
- package/src/web/vaul/style.css +1 -1
- package/src/web/vaul/style.css.d.ts +1 -0
|
@@ -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>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nanoid } from 'nanoid/non-secure';
|
|
4
|
-
import { StackRouter, StackActions } from '@react-navigation/
|
|
4
|
+
import { StackRouter, StackActions } from '@react-navigation/core';
|
|
5
5
|
export const TrueSheetActions = {
|
|
6
6
|
...StackActions,
|
|
7
7
|
resize: index => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["nanoid","StackRouter","StackActions","TrueSheetActions","resize","index","type","dismiss","remove","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","length","TrueSheetRouter","routerOptions","baseRouter","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","Math","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/TrueSheetRouter.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAIEC,WAAW,EAEXC,YAAY,QAEP,
|
|
1
|
+
{"version":3,"names":["nanoid","StackRouter","StackActions","TrueSheetActions","resize","index","type","dismiss","remove","ensureBaseRoute","state","baseRouteName","routeParamList","hasBaseRoute","routes","some","r","name","baseRoute","key","params","length","TrueSheetRouter","routerOptions","baseRouter","getInitialState","options","initialRouteName","routeNames","stateWithBaseRoute","stale","getStateForAction","action","routeIndex","target","source","findIndex","map","route","i","resizeIndex","resizeKey","pop","count","payload","maxPopCount","actualCount","Math","min","targetIndex","closingIndex","closing","popCount","targetName","routeKey","filter","_","getRehydratedState","partialState","routeGetIdList","actionCreators"],"sourceRoot":"../../../src","sources":["navigation/TrueSheetRouter.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAIEC,WAAW,EAEXC,YAAY,QAEP,wBAAwB;AA0B/B,OAAO,MAAMC,gBAAgB,GAAG;EAC9B,GAAGD,YAAY;EACfE,MAAM,EAAGC,KAAa,KAA2B;IAAEC,IAAI,EAAE,QAAQ;IAAED;EAAM,CAAC,CAAC;EAC3EE,OAAO,EAAEA,CAAA,MAA4B;IAAED,IAAI,EAAE;EAAU,CAAC,CAAC;EACzDE,MAAM,EAAEA,CAAA,MAA4B;IAAEF,IAAI,EAAE;EAAS,CAAC;AACxD,CAAC;AAED,MAAMG,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,IAAIX,MAAM,CAAC,CAAC,EAAE;MACnCiB,IAAI,EAAEN,aAAa;MACnBS,MAAM,EAAER,cAAc,GAAGD,aAAa;IACxC,CAAC;IAED,OAAO;MACL,GAAGD,KAAK;MACRL,KAAK,EAAEK,KAAK,CAACI,MAAM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MAAMI,MAAM,GAAGJ,KAAK,CAACI,MAAM,CAACyC,MAAM,CAAC,CAACC,CAAC,EAAEjB,CAAC,KAAKA,CAAC,GAAGN,UAAU,CAAC;YAE5D,OAAO;cACL,GAAGvB,KAAK;cACRL,KAAK,EAAE0C,IAAI,CAACC,GAAG,CAACtC,KAAK,CAACL,KAAK,EAAES,MAAM,CAACO,MAAM,GAAG,CAAC,CAAC;cAC/CP;YACF,CAAC;UACH;QAEA;UACE,OAAOU,UAAU,CAACO,iBAAiB,CAACrB,KAAK,EAAEsB,MAAM,EAAEN,OAAO,CAAC;MAC/D;IACF,CAAC;IAED+B,kBAAkBA,CAACC,YAAY,EAAE;MAAE9B,UAAU;MAAEhB,cAAc;MAAE+C;IAAe,CAAC,EAAE;MAC/E,IAAID,YAAY,CAAC5B,KAAK,KAAK,KAAK,EAAE;QAChC,OAAO4B,YAAY;MACrB;MAEA,MAAMhD,KAAK,GAAGc,UAAU,CAACiC,kBAAkB,CAACC,YAAY,EAAE;QACxD9B,UAAU;QACVhB,cAAc;QACd+C;MACF,CAAC,CAAC;MAEF,MAAMhD,aAAa,GAAGY,aAAa,CAACI,gBAAgB,IAAIC,UAAU,CAAC,CAAC,CAAC;MACrE,MAAMC,kBAAkB,GAAGpB,eAAe,CAACC,KAAK,EAAEC,aAAa,EAAEC,cAAc,CAAC;MAEhF,OAAO;QACL,GAAGiB,kBAAkB;QACrBvB,IAAI,EAAE,YAAY;QAClBa,GAAG,EAAE,cAAcnB,MAAM,CAAC,CAAC;MAC7B,CAAC;IACH,CAAC;IAED4D,cAAc,EAAEzD;EAClB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { createNavigatorFactory, useNavigationBuilder } from '@react-navigation/
|
|
3
|
+
import { createNavigatorFactory, useNavigationBuilder } from '@react-navigation/core';
|
|
4
4
|
import { TrueSheetRouter } from "./TrueSheetRouter.js";
|
|
5
5
|
import { TrueSheetView } from "./TrueSheetView.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createNavigatorFactory","useNavigationBuilder","TrueSheetRouter","TrueSheetView","jsx","_jsx","TrueSheetNavigator","id","initialRouteName","children","layout","screenListeners","screenOptions","screenLayout","state","descriptors","navigation","NavigationContent","createTrueSheetNavigator","config"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAKtBC,oBAAoB,QACf,
|
|
1
|
+
{"version":3,"names":["createNavigatorFactory","useNavigationBuilder","TrueSheetRouter","TrueSheetView","jsx","_jsx","TrueSheetNavigator","id","initialRouteName","children","layout","screenListeners","screenOptions","screenLayout","state","descriptors","navigation","NavigationContent","createTrueSheetNavigator","config"],"sourceRoot":"../../../src","sources":["navigation/createTrueSheetNavigator.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EAKtBC,oBAAoB,QACf,wBAAwB;AAE/B,SAASC,eAAe,QAAqC,sBAAmB;AAChF,SAASC,aAAa,QAAQ,oBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUhD,MAAMC,kBAAkB,GAAGA,CAAC;EAC1BC,EAAE;EACFC,gBAAgB;EAChBC,QAAQ;EACRC,MAAM;EACNC,eAAe;EACfC,aAAa;EACbC;AACuB,CAAC,KAAK;EAC7B,MAAM;IAAEC,KAAK;IAAEC,WAAW;IAAEC,UAAU;IAAEC;EAAkB,CAAC,GAAGhB,oBAAoB,CAMhFC,eAAe,EAAE;IACjBK,EAAE;IACFC,gBAAgB;IAChBC,QAAQ;IACRC,MAAM;IACNC,eAAe;IACfC,aAAa;IACbC;EACF,CAAC,CAAC;EAEF,oBACER,IAAA,CAACY,iBAAiB;IAAAR,QAAA,eAChBJ,IAAA,CAACF,aAAa;MAACW,KAAK,EAAEA,KAAM;MAACE,UAAU,EAAEA,UAAW;MAACD,WAAW,EAAEA;IAAY,CAAE;EAAC,CAChE,CAAC;AAExB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,wBAAwB,GAgBnCC,MAAe,IACqB;EACpC,OAAOnB,sBAAsB,CAACM,kBAAkB,CAAC,CAACa,MAAM,CAAC;AAC3D,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useNavigation","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/useTrueSheetNavigation.ts"],"mappings":";;AAAA,SAASA,aAAa,QAA4B,
|
|
1
|
+
{"version":3,"names":["useNavigation","useTrueSheetNavigation"],"sourceRoot":"../../../src","sources":["navigation/useTrueSheetNavigation.ts"],"mappings":";;AAAA,SAASA,aAAa,QAA4B,wBAAwB;AAI1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAEHD,aAAa,CAA6B,CAAC","ignoreList":[]}
|
|
@@ -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":[]}
|
|
@@ -5,7 +5,7 @@ export function isMobileFirefox() {
|
|
|
5
5
|
return typeof window !== 'undefined' && (/Firefox/.test(userAgent) && /Mobile/.test(userAgent) ||
|
|
6
6
|
// Android Firefox
|
|
7
7
|
/FxiOS/.test(userAgent)) // iOS Firefox
|
|
8
|
-
|
|
8
|
+
;
|
|
9
9
|
}
|
|
10
10
|
export function isMac() {
|
|
11
11
|
return testPlatform(/^Mac/);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isMobileFirefox","userAgent","navigator","window","test","isMac","testPlatform","isIPhone","isSafari","isIPad","maxTouchPoints","isIOS","re","platform","undefined"],"sourceRoot":"../../../../src","sources":["web/vaul/browser.ts"],"mappings":";;AAAA,OAAO,SAASA,eAAeA,CAAA,EAAwB;EACrD,MAAMC,SAAS,GAAGC,SAAS,CAACD,SAAS;EACrC,OACE,OAAOE,MAAM,KAAK,WAAW,KAC3B,SAAS,CAACC,IAAI,CAACH,SAAS,CAAC,IAAI,QAAQ,CAACG,IAAI,CAACH,SAAS,CAAC;EAAK;EAC1D,OAAO,CAACG,IAAI,CAACH,SAAS,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"names":["isMobileFirefox","userAgent","navigator","window","test","isMac","testPlatform","isIPhone","isSafari","isIPad","maxTouchPoints","isIOS","re","platform","undefined"],"sourceRoot":"../../../../src","sources":["web/vaul/browser.ts"],"mappings":";;AAAA,OAAO,SAASA,eAAeA,CAAA,EAAwB;EACrD,MAAMC,SAAS,GAAGC,SAAS,CAACD,SAAS;EACrC,OACE,OAAOE,MAAM,KAAK,WAAW,KAC3B,SAAS,CAACC,IAAI,CAACH,SAAS,CAAC,IAAI,QAAQ,CAACG,IAAI,CAACH,SAAS,CAAC;EAAK;EAC1D,OAAO,CAACG,IAAI,CAACH,SAAS,CAAC,CAAC,CAAC;AAAA;AAE/B;AAEA,OAAO,SAASI,KAAKA,CAAA,EAAwB;EAC3C,OAAOC,YAAY,CAAC,MAAM,CAAC;AAC7B;AAEA,OAAO,SAASC,QAAQA,CAAA,EAAwB;EAC9C,OAAOD,YAAY,CAAC,SAAS,CAAC;AAChC;AAEA,OAAO,SAASE,QAAQA,CAAA,EAAwB;EAC9C,OAAO,gCAAgC,CAACJ,IAAI,CAACF,SAAS,CAACD,SAAS,CAAC;AACnE;AAEA,OAAO,SAASQ,MAAMA,CAAA,EAAwB;EAC5C,OACEH,YAAY,CAAC,OAAO,CAAC;EACrB;EACCD,KAAK,CAAC,CAAC,IAAIH,SAAS,CAACQ,cAAc,GAAG,CAAE;AAE7C;AAEA,OAAO,SAASC,KAAKA,CAAA,EAAwB;EAC3C,OAAOJ,QAAQ,CAAC,CAAC,IAAIE,MAAM,CAAC,CAAC;AAC/B;AAEA,OAAO,SAASH,YAAYA,CAACM,EAAU,EAAuB;EAC5D,OAAO,OAAOT,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACD,SAAS,IAAI,IAAI,GAC5DU,EAAE,CAACR,IAAI,CAACD,MAAM,CAACD,SAAS,CAACW,QAAQ,CAAC,GAClCC,SAAS;AACf","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import React from 'react';
|
|
5
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
9
|
import { isIOS, isMobileFirefox } from "./browser.js";
|
|
@@ -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,83 +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
|
-
|
|
392
|
-
// Radix DismissableLayer's body-restore on unmount is broken: its two
|
|
393
|
-
// useEffects (see @radix-ui/react-dismissable-layer dist/index.mjs:68-92)
|
|
394
|
-
// run cleanups in reverse declaration order, so the layers-set decrement
|
|
395
|
-
// (effect B) runs BEFORE the size-1 body-restore check (effect A). When
|
|
396
|
-
// the last layer unmounts, A sees size=0 and skips the restore — body
|
|
397
|
-
// stays 'none'. Take ownership of the restore here on Drawer.Root unmount.
|
|
398
|
-
// Skipped when nested or non-modal so an inner drawer's unmount doesn't
|
|
399
|
-
// unlock an outer drawer's modal trap. Also bail if any other Radix
|
|
400
|
-
// dismissable layer is still open (sibling Dialog/AlertDialog/Popover) —
|
|
401
|
-
// that one wants the lock kept.
|
|
402
|
-
React.useEffect(() => {
|
|
403
|
-
if (nested || !modal) return;
|
|
404
|
-
return () => {
|
|
405
|
-
if (typeof document === 'undefined') return;
|
|
406
|
-
if (document.body.style.pointerEvents !== 'none') return;
|
|
407
|
-
if (document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')) return;
|
|
408
|
-
document.body.style.pointerEvents = 'auto';
|
|
409
|
-
};
|
|
410
|
-
}, [nested, modal]);
|
|
411
332
|
React.useEffect(() => {
|
|
412
333
|
function onVisualViewportChange() {
|
|
413
334
|
if (!drawerRef.current || !repositionInputs) return;
|
|
@@ -612,14 +533,6 @@ export function Root({
|
|
|
612
533
|
});
|
|
613
534
|
}
|
|
614
535
|
}
|
|
615
|
-
React.useEffect(() => {
|
|
616
|
-
if (!modal) {
|
|
617
|
-
// Need to do this manually unfortunately
|
|
618
|
-
window.requestAnimationFrame(() => {
|
|
619
|
-
document.body.style.pointerEvents = 'auto';
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
}, [modal]);
|
|
623
536
|
return /*#__PURE__*/_jsx(DialogPrimitive.Root, {
|
|
624
537
|
defaultOpen: defaultOpen,
|
|
625
538
|
onOpenChange: open => {
|
|
@@ -631,8 +544,16 @@ export function Root({
|
|
|
631
544
|
}
|
|
632
545
|
setIsOpen(open);
|
|
633
546
|
},
|
|
634
|
-
open: isOpen
|
|
635
|
-
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,
|
|
636
557
|
children: /*#__PURE__*/_jsx(DrawerContext.Provider, {
|
|
637
558
|
value: {
|
|
638
559
|
activeSnapPoint,
|
|
@@ -715,28 +636,36 @@ export const Overlay = /*#__PURE__*/React.forwardRef(({
|
|
|
715
636
|
// `snapToPoint` runs (Presence defers the drawer/overlay mount, leaving
|
|
716
637
|
// refs null on the first open effect pass).
|
|
717
638
|
const isBelowFade = hasSnapPoints && fadeFromIndex !== undefined && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex < fadeFromIndex;
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
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
|
+
})
|
|
728
659
|
});
|
|
729
660
|
});
|
|
730
661
|
Overlay.displayName = 'Drawer.Overlay';
|
|
731
|
-
const
|
|
732
|
-
pointerEvents: 'none'
|
|
733
|
-
};
|
|
734
|
-
const overlayBelowFadeStyle = style => style ? {
|
|
662
|
+
const overlayStyle = (style, isBelowFade) => ({
|
|
735
663
|
...style,
|
|
736
|
-
|
|
737
|
-
}
|
|
664
|
+
pointerEvents: isBelowFade ? 'none' : 'auto'
|
|
665
|
+
});
|
|
738
666
|
export const Content = /*#__PURE__*/React.forwardRef(({
|
|
739
667
|
onPointerDownOutside,
|
|
668
|
+
onEscapeKeyDown,
|
|
740
669
|
style,
|
|
741
670
|
onOpenAutoFocus,
|
|
742
671
|
children,
|
|
@@ -757,6 +686,8 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
757
686
|
isDragging,
|
|
758
687
|
direction,
|
|
759
688
|
snapPoints,
|
|
689
|
+
setActiveSnapPoint,
|
|
690
|
+
dismissible,
|
|
760
691
|
container,
|
|
761
692
|
handleOnly,
|
|
762
693
|
shouldAnimate,
|
|
@@ -768,16 +699,16 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
768
699
|
detachedRadius,
|
|
769
700
|
detachedWrapperStyle: detachedWrapperStyleProp
|
|
770
701
|
} = useDrawerContext();
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
//
|
|
774
|
-
//
|
|
775
|
-
//
|
|
776
|
-
//
|
|
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.
|
|
777
708
|
const autoRoRef = React.useRef(null);
|
|
778
709
|
const setAutoSizeNode = React.useCallback(node => {
|
|
779
710
|
autoRoRef.current?.disconnect();
|
|
780
|
-
if (!node
|
|
711
|
+
if (!node) {
|
|
781
712
|
autoRoRef.current = null;
|
|
782
713
|
return;
|
|
783
714
|
}
|
|
@@ -786,7 +717,7 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
786
717
|
const ro = new ResizeObserver(measure);
|
|
787
718
|
ro.observe(node);
|
|
788
719
|
autoRoRef.current = ro;
|
|
789
|
-
}, [
|
|
720
|
+
}, [setContentHeight]);
|
|
790
721
|
const isBelowFade = snapPoints !== undefined && snapPoints !== null && fadeFromIndex !== undefined && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex < fadeFromIndex;
|
|
791
722
|
// Needed to use transition instead of animations
|
|
792
723
|
const [delayedSnapPoints, setDelayedSnapPoints] = React.useState(false);
|
|
@@ -941,7 +872,10 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
941
872
|
// Translate the wrapper off-screen on dismiss so the whole card slides out
|
|
942
873
|
// as one. The reset-then-target pattern on open forces the browser to
|
|
943
874
|
// record a starting value so the transition actually animates.
|
|
944
|
-
|
|
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);
|
|
945
879
|
React.useEffect(() => {
|
|
946
880
|
if (!drawerRef.current) {
|
|
947
881
|
wasOpenRef.current = isOpen;
|
|
@@ -961,10 +895,6 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
961
895
|
void wrapper.offsetHeight;
|
|
962
896
|
wrapper.style.transition = transition;
|
|
963
897
|
wrapper.style.transform = 'translate3d(0, 0, 0)';
|
|
964
|
-
} else if (isOpen && !wrapper.style.transform) {
|
|
965
|
-
// Fresh mount with open=true — ensure the wrapper starts at rest.
|
|
966
|
-
wrapper.style.transition = transition;
|
|
967
|
-
wrapper.style.transform = 'translate3d(0, 0, 0)';
|
|
968
898
|
}
|
|
969
899
|
}
|
|
970
900
|
wasOpenRef.current = isOpen;
|
|
@@ -1008,16 +938,41 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
1008
938
|
e.preventDefault();
|
|
1009
939
|
return;
|
|
1010
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
|
+
}
|
|
1011
950
|
if (keyboardIsOpen.current) {
|
|
1012
951
|
keyboardIsOpen.current = false;
|
|
1013
952
|
}
|
|
1014
953
|
},
|
|
1015
|
-
|
|
1016
|
-
|
|
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) {
|
|
1017
962
|
e.preventDefault();
|
|
1018
|
-
|
|
963
|
+
if (hasSnapPoints && typeof activeSnapPointIndex === 'number' && activeSnapPointIndex > 0) {
|
|
964
|
+
setActiveSnapPoint(snapPoints[0]);
|
|
965
|
+
}
|
|
1019
966
|
}
|
|
1020
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
|
+
},
|
|
1021
976
|
onPointerMove: event => {
|
|
1022
977
|
lastKnownPointerEventRef.current = event;
|
|
1023
978
|
if (handleOnly) return;
|
|
@@ -1051,12 +1006,12 @@ export const Content = /*#__PURE__*/React.forwardRef(({
|
|
|
1051
1006
|
handleOnPointerUp(lastKnownPointerEventRef.current);
|
|
1052
1007
|
}
|
|
1053
1008
|
},
|
|
1054
|
-
children:
|
|
1009
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
1055
1010
|
ref: setAutoSizeNode,
|
|
1056
1011
|
"data-vaul-auto-size-wrapper": "",
|
|
1057
1012
|
style: autoSizeWrapperStyle,
|
|
1058
1013
|
children: children
|
|
1059
|
-
})
|
|
1014
|
+
})
|
|
1060
1015
|
});
|
|
1061
1016
|
return /*#__PURE__*/_jsxs("div", {
|
|
1062
1017
|
"data-vaul-detached-wrapper": "",
|