@tamagui/sheet 1.106.0 → 1.108.0-1722728147390
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/SheetController.js +12 -4
- package/dist/cjs/SheetController.js.map +2 -2
- package/dist/cjs/SheetController.native.js +12 -4
- package/dist/cjs/SheetController.native.js.map +2 -2
- package/dist/cjs/SheetImplementationCustom.js +248 -238
- package/dist/cjs/SheetImplementationCustom.js.map +2 -2
- package/dist/cjs/SheetImplementationCustom.native.js +27 -19
- package/dist/cjs/SheetImplementationCustom.native.js.map +2 -2
- package/dist/cjs/SheetScrollView.js +14 -6
- package/dist/cjs/SheetScrollView.js.map +2 -2
- package/dist/cjs/SheetScrollView.native.js +14 -6
- package/dist/cjs/SheetScrollView.native.js.map +2 -2
- package/dist/cjs/contexts.js +13 -5
- package/dist/cjs/contexts.js.map +2 -2
- package/dist/cjs/contexts.native.js +12 -4
- package/dist/cjs/contexts.native.js.map +2 -2
- package/dist/cjs/useSheetController.js +13 -7
- package/dist/cjs/useSheetController.js.map +2 -2
- package/dist/cjs/useSheetController.native.js +13 -5
- package/dist/cjs/useSheetController.native.js.map +2 -2
- package/dist/cjs/useSheetProviderProps.js +4 -4
- package/dist/cjs/useSheetProviderProps.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.native.js +5 -5
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/SheetController.js +2 -2
- package/dist/esm/SheetController.js.map +1 -1
- package/dist/esm/SheetController.mjs +2 -2
- package/dist/esm/SheetController.mjs.map +1 -1
- package/dist/esm/SheetController.native.js +2 -2
- package/dist/esm/SheetController.native.js.map +2 -2
- package/dist/esm/SheetImplementationCustom.js +238 -245
- package/dist/esm/SheetImplementationCustom.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.mjs +22 -22
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +17 -17
- package/dist/esm/SheetImplementationCustom.native.js.map +2 -2
- package/dist/esm/SheetScrollView.js +4 -4
- package/dist/esm/SheetScrollView.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +5 -5
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +4 -4
- package/dist/esm/SheetScrollView.native.js.map +2 -2
- package/dist/esm/contexts.js +3 -3
- package/dist/esm/contexts.js.map +1 -1
- package/dist/esm/contexts.mjs +3 -3
- package/dist/esm/contexts.mjs.map +1 -1
- package/dist/esm/contexts.native.js +3 -3
- package/dist/esm/contexts.native.js.map +2 -2
- package/dist/esm/useSheetController.js +3 -5
- package/dist/esm/useSheetController.js.map +1 -1
- package/dist/esm/useSheetController.mjs +3 -3
- package/dist/esm/useSheetController.mjs.map +1 -1
- package/dist/esm/useSheetController.native.js +3 -3
- package/dist/esm/useSheetController.native.js.map +2 -2
- package/dist/esm/useSheetProviderProps.js +4 -4
- package/dist/esm/useSheetProviderProps.js.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs +6 -6
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js +5 -5
- package/dist/esm/useSheetProviderProps.native.js.map +2 -2
- package/dist/jsx/SheetController.js +2 -2
- package/dist/jsx/SheetController.js.map +1 -1
- package/dist/jsx/SheetController.mjs +2 -2
- package/dist/jsx/SheetController.mjs.map +1 -1
- package/dist/jsx/SheetController.native.js +2 -2
- package/dist/jsx/SheetController.native.js.map +2 -2
- package/dist/jsx/SheetImplementationCustom.js +238 -245
- package/dist/jsx/SheetImplementationCustom.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.mjs +22 -22
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.js +17 -17
- package/dist/jsx/SheetImplementationCustom.native.js.map +2 -2
- package/dist/jsx/SheetScrollView.js +4 -4
- package/dist/jsx/SheetScrollView.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +5 -5
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.js +4 -4
- package/dist/jsx/SheetScrollView.native.js.map +2 -2
- package/dist/jsx/contexts.js +3 -3
- package/dist/jsx/contexts.js.map +1 -1
- package/dist/jsx/contexts.mjs +3 -3
- package/dist/jsx/contexts.mjs.map +1 -1
- package/dist/jsx/contexts.native.js +3 -3
- package/dist/jsx/contexts.native.js.map +2 -2
- package/dist/jsx/useSheetController.js +3 -5
- package/dist/jsx/useSheetController.js.map +1 -1
- package/dist/jsx/useSheetController.mjs +3 -3
- package/dist/jsx/useSheetController.mjs.map +1 -1
- package/dist/jsx/useSheetController.native.js +3 -3
- package/dist/jsx/useSheetController.native.js.map +2 -2
- package/dist/jsx/useSheetProviderProps.js +4 -4
- package/dist/jsx/useSheetProviderProps.js.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs +6 -6
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.js +5 -5
- package/dist/jsx/useSheetProviderProps.native.js.map +2 -2
- package/package.json +16 -16
- package/src/SheetController.tsx +3 -2
- package/src/SheetImplementationCustom.tsx +426 -432
- package/src/SheetScrollView.tsx +9 -5
- package/src/contexts.ts +3 -3
- package/src/useSheetController.tsx +4 -5
- package/src/useSheetProviderProps.tsx +6 -6
- package/types/SheetController.d.ts +1 -1
- package/types/SheetController.d.ts.map +1 -1
- package/types/SheetImplementationCustom.d.ts +5 -4
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +3 -2
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/contexts.d.ts +3 -2
- package/types/contexts.d.ts.map +1 -1
- package/types/useSheetController.d.ts +2 -1
- package/types/useSheetController.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +1 -1
- package/types/useSheetProviderProps.d.ts.map +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -11,19 +12,26 @@ var __export = (target, all) => {
|
|
|
11
12
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
13
|
return to;
|
|
13
14
|
};
|
|
14
|
-
var
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
23
|
var SheetController_exports = {};
|
|
16
24
|
__export(SheetController_exports, {
|
|
17
25
|
SheetController: () => SheetController
|
|
18
26
|
});
|
|
19
27
|
module.exports = __toCommonJS(SheetController_exports);
|
|
20
|
-
var
|
|
28
|
+
var import_react = __toESM(require("react")), import_core = require("@tamagui/core"), import_useSheetController = require("./useSheetController"), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
29
|
const SheetController = ({
|
|
22
30
|
children,
|
|
23
31
|
onOpenChange: onOpenChangeProp,
|
|
24
32
|
...value
|
|
25
33
|
}) => {
|
|
26
|
-
const onOpenChange = (0, import_core.useEvent)(onOpenChangeProp), memoValue =
|
|
34
|
+
const onOpenChange = (0, import_core.useEvent)(onOpenChangeProp), memoValue = import_react.default.useMemo(
|
|
27
35
|
() => ({
|
|
28
36
|
open: value.open,
|
|
29
37
|
hidden: value.hidden,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SheetController.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": []
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAClB,cAAyB,0BAIzB,4BAAuC,iCAoBnC;AAlBG,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,cAAc;AAAA,EACd,GAAG;AACL,MAAuE;AACrE,QAAM,mBAAe,sBAAS,gBAAgB,GAExC,YAAY,aAAAA,QAAM;AAAA,IACtB,OAAO;AAAA,MACL,MAAM,MAAM;AAAA,MACZ,QAAQ,MAAM;AAAA,MACd,aAAa,MAAM;AAAA,MACnB;AAAA,IACF;AAAA,IACA,CAAC,cAAc,MAAM,MAAM,MAAM,QAAQ,MAAM,WAAW;AAAA,EAC5D;AAEA,SACE,4CAAC,iDAAuB,UAAvB,EAAgC,OAAO,WACrC,UACH;AAEJ;",
|
|
5
|
+
"names": ["React"]
|
|
6
6
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
8
|
for (var name in all)
|
|
8
9
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -12,13 +13,20 @@ var __export = (target, all) => {
|
|
|
12
13
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
14
|
return to;
|
|
14
15
|
};
|
|
15
|
-
var
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
22
|
+
mod
|
|
23
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
16
24
|
var SheetController_exports = {};
|
|
17
25
|
__export(SheetController_exports, {
|
|
18
26
|
SheetController: () => SheetController
|
|
19
27
|
});
|
|
20
28
|
module.exports = __toCommonJS(SheetController_exports);
|
|
21
|
-
var import_jsx_runtime = require("react/jsx-runtime"),
|
|
29
|
+
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_core = require("@tamagui/core"), import_useSheetController = require("./useSheetController");
|
|
22
30
|
function _object_without_properties(source, excluded) {
|
|
23
31
|
if (source == null) return {};
|
|
24
32
|
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
@@ -40,7 +48,7 @@ var SheetController = function(_param) {
|
|
|
40
48
|
var children = _param.children, onOpenChangeProp = _param.onOpenChange, value = _object_without_properties(_param, [
|
|
41
49
|
"children",
|
|
42
50
|
"onOpenChange"
|
|
43
|
-
]), onOpenChange = (0, import_core.useEvent)(onOpenChangeProp), memoValue =
|
|
51
|
+
]), onOpenChange = (0, import_core.useEvent)(onOpenChangeProp), memoValue = import_react.default.useMemo(function() {
|
|
44
52
|
return {
|
|
45
53
|
open: value.open,
|
|
46
54
|
hidden: value.hidden,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/code/ui/sheet/src/SheetController.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["SheetController", "children", "onOpenChangeProp", "onOpenChange", "value", "useEvent", "memoValue", "useMemo", "open", "hidden", "disableDrag", "_jsx", "SheetControllerContext", "Provider"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAClB,cAAyB,0BAIzB,4BAAuC;;;;;;;;;;;;;;;;;;AAEhC,IAAMA,kBAAkB,SAAA,QAAA;MAC7BC,WAAAA,OAAAA,UACcC,mBAAAA,OAAdC,cACGC,QAAAA,2BAAAA,QAAAA;IAFHH;IACAE;MAGMA,mBAAeE,sBAASH,gBAAAA,GAExBI,YAAYC,aAAAA,QAAMC,QACtB,WAAA;WAAO;MACLC,MAAML,MAAMK;MACZC,QAAQN,MAAMM;MACdC,aAAaP,MAAMO;MACnBR;IACF;KACA;IAACA;IAAcC,MAAMK;IAAML,MAAMM;IAAQN,MAAMO;GAAY;AAG7D,SACE,uCAAAC,KAACC,iDAAuBC,UAAQ;IAACV,OAAOE;;;AAI5C;",
|
|
5
|
+
"names": ["SheetController", "children", "onOpenChangeProp", "onOpenChange", "value", "useEvent", "memoValue", "React", "useMemo", "open", "hidden", "disableDrag", "_jsx", "SheetControllerContext", "Provider"]
|
|
6
6
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
6
|
var __export = (target, all) => {
|
|
6
7
|
for (var name in all)
|
|
7
8
|
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
@@ -11,262 +12,271 @@ var __export = (target, all) => {
|
|
|
11
12
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
13
|
return to;
|
|
13
14
|
};
|
|
14
|
-
var
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
23
|
var SheetImplementationCustom_exports = {};
|
|
16
24
|
__export(SheetImplementationCustom_exports, {
|
|
17
25
|
SheetImplementationCustom: () => SheetImplementationCustom
|
|
18
26
|
});
|
|
19
27
|
module.exports = __toCommonJS(SheetImplementationCustom_exports);
|
|
20
|
-
var import_adapt = require("@tamagui/adapt"), import_animate_presence = require("@tamagui/animate-presence"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_portal = require("@tamagui/portal"), import_use_keyboard_visible = require("@tamagui/use-keyboard-visible"),
|
|
28
|
+
var import_react = __toESM(require("react")), import_adapt = require("@tamagui/adapt"), import_animate_presence = require("@tamagui/animate-presence"), import_compose_refs = require("@tamagui/compose-refs"), import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_portal = require("@tamagui/portal"), import_use_keyboard_visible = require("@tamagui/use-keyboard-visible"), import_react_native = require("react-native-web"), import_constants2 = require("./constants"), import_contexts = require("./contexts"), import_helpers = require("./helpers"), import_SheetContext = require("./SheetContext"), import_useSheetOpenState = require("./useSheetOpenState"), import_useSheetProviderProps = require("./useSheetProviderProps"), import_jsx_runtime = require("react/jsx-runtime");
|
|
21
29
|
let hiddenSize = 10000.1;
|
|
22
30
|
const SheetImplementationCustom = (0, import_core.themeable)(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
setIsShowingInnerSheet(hasChild)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
parentSheetContext(!
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
(0, import_react.useCallback)(
|
|
79
|
-
(value) => {
|
|
80
|
-
at.current = value, scrollBridge.paneY = value;
|
|
31
|
+
import_react.default.forwardRef(
|
|
32
|
+
function(props, forwardedRef) {
|
|
33
|
+
const parentSheet = import_react.default.useContext(import_contexts.ParentSheetContext), {
|
|
34
|
+
animation,
|
|
35
|
+
animationConfig: animationConfigProp,
|
|
36
|
+
modal = !1,
|
|
37
|
+
zIndex = parentSheet.zIndex + 1,
|
|
38
|
+
moveOnKeyboardChange = !1,
|
|
39
|
+
unmountChildrenWhenHidden = !1,
|
|
40
|
+
portalProps,
|
|
41
|
+
containerComponent: ContainerComponent = import_react.default.Fragment
|
|
42
|
+
} = props, keyboardIsVisible = (0, import_use_keyboard_visible.useKeyboardVisible)(), state = (0, import_useSheetOpenState.useSheetOpenState)(props), [overlayComponent, setOverlayComponent] = import_react.default.useState(null), providerProps = (0, import_useSheetProviderProps.useSheetProviderProps)(props, state, {
|
|
43
|
+
onOverlayComponent: setOverlayComponent
|
|
44
|
+
}), {
|
|
45
|
+
frameSize,
|
|
46
|
+
setFrameSize,
|
|
47
|
+
snapPoints,
|
|
48
|
+
snapPointsMode,
|
|
49
|
+
hasFit,
|
|
50
|
+
position,
|
|
51
|
+
setPosition,
|
|
52
|
+
scrollBridge,
|
|
53
|
+
screenSize,
|
|
54
|
+
setMaxContentSize,
|
|
55
|
+
maxSnapPoint
|
|
56
|
+
} = providerProps, { open, controller, isHidden } = state, sheetRef = import_react.default.useRef(null), ref = (0, import_compose_refs.useComposedRefs)(forwardedRef, sheetRef), animationConfig = (() => {
|
|
57
|
+
const [animationProp, animationPropConfig] = animation ? Array.isArray(animation) ? animation : [animation] : [];
|
|
58
|
+
return animationConfigProp ?? (animationProp ? {
|
|
59
|
+
...(0, import_core.getConfig)().animations.animations[animationProp],
|
|
60
|
+
...animationPropConfig
|
|
61
|
+
} : null);
|
|
62
|
+
})(), [isShowingInnerSheet, setIsShowingInnerSheet] = import_react.default.useState(!1), shouldHideParentSheet = !import_constants.isWeb && modal && isShowingInnerSheet, parentSheetContext = import_react.default.useContext(import_contexts.SheetInsideSheetContext), onInnerSheet = import_react.default.useCallback((hasChild) => {
|
|
63
|
+
setIsShowingInnerSheet(hasChild);
|
|
64
|
+
}, []), positions = import_react.default.useMemo(
|
|
65
|
+
() => snapPoints.map(
|
|
66
|
+
(point) => getYPositions(snapPointsMode, point, screenSize, frameSize)
|
|
67
|
+
),
|
|
68
|
+
[screenSize, frameSize, snapPoints, snapPointsMode]
|
|
69
|
+
), { animationDriver } = (0, import_core.useConfiguration)(), { useAnimatedNumber, useAnimatedNumberStyle, useAnimatedNumberReaction } = animationDriver, AnimatedView = animationDriver.View ?? import_core.Stack;
|
|
70
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
71
|
+
if (parentSheetContext && open)
|
|
72
|
+
return parentSheetContext(!0), () => {
|
|
73
|
+
parentSheetContext(!1);
|
|
74
|
+
};
|
|
75
|
+
}, [parentSheetContext, open]);
|
|
76
|
+
const nextParentContext = import_react.default.useMemo(
|
|
77
|
+
() => ({
|
|
78
|
+
zIndex
|
|
79
|
+
}),
|
|
80
|
+
[zIndex]
|
|
81
|
+
), animatedNumber = useAnimatedNumber(hiddenSize), at = import_react.default.useRef(hiddenSize);
|
|
82
|
+
useAnimatedNumberReaction(
|
|
83
|
+
{
|
|
84
|
+
value: animatedNumber,
|
|
85
|
+
hostRef: sheetRef
|
|
81
86
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (at.current !== toValue) {
|
|
92
|
-
if (at.current = toValue, stopSpring(), hasntMeasured || isHidden) {
|
|
93
|
-
animatedNumber.setValue(
|
|
94
|
-
screenSize,
|
|
95
|
-
{
|
|
96
|
-
type: "timing",
|
|
97
|
-
duration: 0
|
|
98
|
-
},
|
|
99
|
-
() => {
|
|
100
|
-
isHidden || (toValue = positions[position2], at.current = toValue, animatedNumber.setValue(toValue, {
|
|
101
|
-
type: "spring",
|
|
102
|
-
...animationConfig
|
|
103
|
-
}));
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
animatedNumber.setValue(toValue, {
|
|
109
|
-
type: "spring",
|
|
110
|
-
...animationConfig
|
|
111
|
-
});
|
|
87
|
+
import_react.default.useCallback(
|
|
88
|
+
(value) => {
|
|
89
|
+
at.current = value, scrollBridge.paneY = value;
|
|
90
|
+
},
|
|
91
|
+
[animationDriver]
|
|
92
|
+
)
|
|
93
|
+
);
|
|
94
|
+
function stopSpring() {
|
|
95
|
+
animatedNumber.stop(), scrollBridge.onFinishAnimate && (scrollBridge.onFinishAnimate(), scrollBridge.onFinishAnimate = void 0);
|
|
112
96
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
97
|
+
const hasntMeasured = at.current === hiddenSize, animateTo = (0, import_core.useEvent)((position2) => {
|
|
98
|
+
if (frameSize === 0) return;
|
|
99
|
+
let toValue = isHidden || position2 === -1 ? screenSize : positions[position2];
|
|
100
|
+
if (at.current !== toValue) {
|
|
101
|
+
if (at.current = toValue, stopSpring(), hasntMeasured || isHidden) {
|
|
102
|
+
animatedNumber.setValue(
|
|
103
|
+
screenSize,
|
|
104
|
+
{
|
|
105
|
+
type: "timing",
|
|
106
|
+
duration: 0
|
|
107
|
+
},
|
|
108
|
+
() => {
|
|
109
|
+
isHidden || (toValue = positions[position2], at.current = toValue, animatedNumber.setValue(toValue, {
|
|
110
|
+
type: "spring",
|
|
111
|
+
...animationConfig
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
animatedNumber.setValue(toValue, {
|
|
118
|
+
type: "spring",
|
|
119
|
+
...animationConfig
|
|
120
|
+
});
|
|
121
|
+
}
|
|
118
122
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
for (let i = 0; i < positions.length; i++) {
|
|
135
|
-
const position2 = positions[i], curDist = end > position2 ? end - position2 : position2 - end;
|
|
136
|
-
curDist < dist && (dist = curDist, closestPoint = i);
|
|
123
|
+
(0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
124
|
+
screenSize && hasntMeasured && animatedNumber.setValue(screenSize, {
|
|
125
|
+
type: "timing",
|
|
126
|
+
duration: 0
|
|
127
|
+
});
|
|
128
|
+
}, [hasntMeasured, screenSize]), (0, import_constants.useIsomorphicLayoutEffect)(() => {
|
|
129
|
+
!frameSize || !screenSize || isHidden || hasntMeasured && !open || animateTo(position);
|
|
130
|
+
}, [isHidden, frameSize, screenSize, open, position]);
|
|
131
|
+
const disableDrag = props.disableDrag ?? controller?.disableDrag, themeName = (0, import_core.useThemeName)(), [isDragging, setIsDragging] = import_react.default.useState(!1), panResponder = import_react.default.useMemo(() => {
|
|
132
|
+
if (disableDrag || !frameSize || isShowingInnerSheet) return;
|
|
133
|
+
const minY = positions[0];
|
|
134
|
+
scrollBridge.paneMinY = minY;
|
|
135
|
+
let startY = at.current;
|
|
136
|
+
function setPanning(val) {
|
|
137
|
+
setIsDragging(val), import_constants2.SHEET_HIDDEN_STYLESHEET && (val ? import_constants2.SHEET_HIDDEN_STYLESHEET.innerText = ":root * { user-select: none !important; -webkit-user-select: none !important; }" : import_constants2.SHEET_HIDDEN_STYLESHEET.innerText = "");
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
const release = ({ vy, dragAt }) => {
|
|
140
|
+
isExternalDrag = !1, previouslyScrolling = !1, setPanning(!1);
|
|
141
|
+
const end = dragAt + startY + frameSize * vy * 0.2;
|
|
142
|
+
let closestPoint = 0, dist = Number.POSITIVE_INFINITY;
|
|
143
|
+
for (let i = 0; i < positions.length; i++) {
|
|
144
|
+
const position2 = positions[i], curDist = end > position2 ? end - position2 : position2 - end;
|
|
145
|
+
curDist < dist && (dist = curDist, closestPoint = i);
|
|
146
|
+
}
|
|
147
|
+
setPosition(closestPoint), animateTo(closestPoint);
|
|
148
|
+
}, finish = (_e, state2) => {
|
|
149
|
+
release({
|
|
150
|
+
vy: state2.vy,
|
|
151
|
+
dragAt: state2.dy
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
let previouslyScrolling = !1;
|
|
155
|
+
const onMoveShouldSet = (e, { dy }) => {
|
|
156
|
+
if (e.target === providerProps.handleRef.current)
|
|
157
|
+
return !0;
|
|
158
|
+
const isScrolled = scrollBridge.y !== 0, isDraggingUp = dy < 0, isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
|
|
159
|
+
return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && !isScrolled && isDraggingUp && !import_constants.isWeb ? !1 : Math.abs(dy) > 5;
|
|
160
|
+
}, grant = () => {
|
|
161
|
+
setPanning(!0), stopSpring(), startY = at.current;
|
|
162
|
+
};
|
|
163
|
+
let isExternalDrag = !1;
|
|
164
|
+
return scrollBridge.drag = (dy) => {
|
|
165
|
+
isExternalDrag || (isExternalDrag = !0, grant());
|
|
166
|
+
const to = dy + startY;
|
|
167
|
+
animatedNumber.setValue((0, import_helpers.resisted)(to, minY), { type: "direct" });
|
|
168
|
+
}, scrollBridge.release = release, import_react_native.PanResponder.create({
|
|
169
|
+
onMoveShouldSetPanResponder: onMoveShouldSet,
|
|
170
|
+
onPanResponderGrant: grant,
|
|
171
|
+
onPanResponderMove: (_e, { dy }) => {
|
|
172
|
+
const toFull = dy + startY, to = (0, import_helpers.resisted)(toFull, minY);
|
|
173
|
+
animatedNumber.setValue(to, { type: "direct" });
|
|
174
|
+
},
|
|
175
|
+
onPanResponderEnd: finish,
|
|
176
|
+
onPanResponderTerminate: finish,
|
|
177
|
+
onPanResponderRelease: finish
|
|
143
178
|
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}, grant = () => {
|
|
152
|
-
setPanning(!0), stopSpring(), startY = at.current;
|
|
153
|
-
};
|
|
154
|
-
let isExternalDrag = !1;
|
|
155
|
-
return scrollBridge.drag = (dy) => {
|
|
156
|
-
isExternalDrag || (isExternalDrag = !0, grant());
|
|
157
|
-
const to = dy + startY;
|
|
158
|
-
animatedNumber.setValue((0, import_helpers.resisted)(to, minY), { type: "direct" });
|
|
159
|
-
}, scrollBridge.release = release, import_react_native.PanResponder.create({
|
|
160
|
-
onMoveShouldSetPanResponder: onMoveShouldSet,
|
|
161
|
-
onPanResponderGrant: grant,
|
|
162
|
-
onPanResponderMove: (_e, { dy }) => {
|
|
163
|
-
const toFull = dy + startY, to = (0, import_helpers.resisted)(toFull, minY);
|
|
164
|
-
animatedNumber.setValue(to, { type: "direct" });
|
|
179
|
+
}, [disableDrag, isShowingInnerSheet, animateTo, frameSize, positions, setPosition]), handleAnimationViewLayout = import_react.default.useCallback(
|
|
180
|
+
(e) => {
|
|
181
|
+
const next = Math.min(
|
|
182
|
+
e.nativeEvent?.layout.height,
|
|
183
|
+
import_react_native.Dimensions.get("window").height
|
|
184
|
+
);
|
|
185
|
+
next && setFrameSize(next);
|
|
165
186
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
transform: [{ translateY: frameSize === 0 ? hiddenSize : val }]
|
|
192
|
-
};
|
|
193
|
-
}), sizeBeforeKeyboard = (0, import_react.useRef)(null);
|
|
194
|
-
(0, import_react.useEffect)(() => {
|
|
195
|
-
if (import_constants.isWeb || !moveOnKeyboardChange) return;
|
|
196
|
-
const keyboardDidShowListener = import_react_native.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
197
|
-
sizeBeforeKeyboard.current === null && (sizeBeforeKeyboard.current = animatedNumber.getValue(), animatedNumber.setValue(
|
|
198
|
-
Math.max(animatedNumber.getValue() - e.endCoordinates.height, 0)
|
|
199
|
-
));
|
|
200
|
-
}), keyboardDidHideListener = import_react_native.Keyboard.addListener("keyboardDidHide", () => {
|
|
201
|
-
sizeBeforeKeyboard.current !== null && (animatedNumber.setValue(sizeBeforeKeyboard.current), sizeBeforeKeyboard.current = null);
|
|
202
|
-
});
|
|
203
|
-
return () => {
|
|
204
|
-
keyboardDidHideListener.remove(), keyboardDidShowListener.remove();
|
|
205
|
-
};
|
|
206
|
-
}, [moveOnKeyboardChange]);
|
|
207
|
-
const [opacity, setOpacity] = (0, import_react.useState)(open ? 1 : 0);
|
|
208
|
-
open && opacity === 0 && setOpacity(1), (0, import_react.useEffect)(() => {
|
|
209
|
-
if (!open) {
|
|
210
|
-
const tm = setTimeout(() => {
|
|
211
|
-
setOpacity(0);
|
|
212
|
-
}, 400);
|
|
187
|
+
[keyboardIsVisible]
|
|
188
|
+
), handleMaxContentViewLayout = import_react.default.useCallback(
|
|
189
|
+
(e) => {
|
|
190
|
+
const next = Math.min(
|
|
191
|
+
e.nativeEvent?.layout.height,
|
|
192
|
+
import_react_native.Dimensions.get("window").height
|
|
193
|
+
);
|
|
194
|
+
next && setMaxContentSize(next);
|
|
195
|
+
},
|
|
196
|
+
[keyboardIsVisible]
|
|
197
|
+
), animatedStyle = useAnimatedNumberStyle(animatedNumber, (val) => {
|
|
198
|
+
"worklet";
|
|
199
|
+
return {
|
|
200
|
+
transform: [{ translateY: frameSize === 0 ? hiddenSize : val }]
|
|
201
|
+
};
|
|
202
|
+
}), sizeBeforeKeyboard = import_react.default.useRef(null);
|
|
203
|
+
import_react.default.useEffect(() => {
|
|
204
|
+
if (import_constants.isWeb || !moveOnKeyboardChange) return;
|
|
205
|
+
const keyboardDidShowListener = import_react_native.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
206
|
+
sizeBeforeKeyboard.current === null && (sizeBeforeKeyboard.current = animatedNumber.getValue(), animatedNumber.setValue(
|
|
207
|
+
Math.max(animatedNumber.getValue() - e.endCoordinates.height, 0)
|
|
208
|
+
));
|
|
209
|
+
}), keyboardDidHideListener = import_react_native.Keyboard.addListener("keyboardDidHide", () => {
|
|
210
|
+
sizeBeforeKeyboard.current !== null && (animatedNumber.setValue(sizeBeforeKeyboard.current), sizeBeforeKeyboard.current = null);
|
|
211
|
+
});
|
|
213
212
|
return () => {
|
|
214
|
-
|
|
213
|
+
keyboardDidHideListener.remove(), keyboardDidShowListener.remove();
|
|
215
214
|
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
top: 0,
|
|
227
|
-
left: 0,
|
|
228
|
-
right: 0,
|
|
229
|
-
bottom: 0,
|
|
230
|
-
pointerEvents: "none"
|
|
231
|
-
},
|
|
232
|
-
onLayout: handleMaxContentViewLayout
|
|
215
|
+
}, [moveOnKeyboardChange]);
|
|
216
|
+
const [opacity, setOpacity] = import_react.default.useState(open ? 1 : 0);
|
|
217
|
+
open && opacity === 0 && setOpacity(1), import_react.default.useEffect(() => {
|
|
218
|
+
if (!open) {
|
|
219
|
+
const tm = setTimeout(() => {
|
|
220
|
+
setOpacity(0);
|
|
221
|
+
}, 400);
|
|
222
|
+
return () => {
|
|
223
|
+
clearTimeout(tm);
|
|
224
|
+
};
|
|
233
225
|
}
|
|
234
|
-
)
|
|
235
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
// @ts-ignore for CSS driver this is necessary to attach the transition
|
|
243
|
-
animation
|
|
244
|
-
},
|
|
245
|
-
disableClassName: !0,
|
|
246
|
-
style: [
|
|
247
|
-
{
|
|
226
|
+
}, [open]);
|
|
227
|
+
const forcedContentHeight = hasFit ? void 0 : snapPointsMode === "percent" ? `${maxSnapPoint}${import_constants.isWeb ? "dvh" : "%"}` : maxSnapPoint, contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_contexts.ParentSheetContext.Provider, { value: nextParentContext, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_SheetContext.SheetProvider, { ...providerProps, children: [
|
|
228
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_animate_presence.AnimatePresence, { custom: { open }, children: shouldHideParentSheet || !open ? null : overlayComponent }),
|
|
229
|
+
snapPointsMode !== "percent" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
230
|
+
import_react_native.View,
|
|
231
|
+
{
|
|
232
|
+
style: {
|
|
233
|
+
opacity: 0,
|
|
248
234
|
position: "absolute",
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
...(shouldHideParentSheet || !open) && {
|
|
255
|
-
pointerEvents: "none"
|
|
256
|
-
}
|
|
235
|
+
top: 0,
|
|
236
|
+
left: 0,
|
|
237
|
+
right: 0,
|
|
238
|
+
bottom: 0,
|
|
239
|
+
pointerEvents: "none"
|
|
257
240
|
},
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
241
|
+
onLayout: handleMaxContentViewLayout
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
245
|
+
AnimatedView,
|
|
246
|
+
{
|
|
247
|
+
ref,
|
|
248
|
+
...panResponder?.panHandlers,
|
|
249
|
+
onLayout: handleAnimationViewLayout,
|
|
250
|
+
...!isDragging && {
|
|
251
|
+
// @ts-ignore for CSS driver this is necessary to attach the transition
|
|
252
|
+
animation
|
|
253
|
+
},
|
|
254
|
+
disableClassName: !0,
|
|
255
|
+
style: [
|
|
256
|
+
{
|
|
257
|
+
position: "absolute",
|
|
258
|
+
zIndex,
|
|
259
|
+
width: "100%",
|
|
260
|
+
height: forcedContentHeight,
|
|
261
|
+
minHeight: forcedContentHeight,
|
|
262
|
+
opacity,
|
|
263
|
+
...(shouldHideParentSheet || !open) && {
|
|
264
|
+
pointerEvents: "none"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
animatedStyle
|
|
268
|
+
],
|
|
269
|
+
children: props.children
|
|
270
|
+
}
|
|
271
|
+
)
|
|
272
|
+
] }) }), adaptContext = import_react.default.useContext(import_adapt.AdaptParentContext), shouldMountChildren = !!(opacity || !unmountChildrenWhenHidden);
|
|
273
|
+
if (modal) {
|
|
274
|
+
const modalContents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, { zIndex, ...portalProps, children: shouldMountChildren && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ContainerComponent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.Theme, { forceClassName: !0, name: themeName, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_adapt.AdaptParentContext.Provider, { value: adaptContext, children: contents }) }) }) });
|
|
275
|
+
return import_constants.isWeb ? modalContents : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_contexts.SheetInsideSheetContext.Provider, { value: onInnerSheet, children: modalContents });
|
|
276
|
+
}
|
|
277
|
+
return contents;
|
|
267
278
|
}
|
|
268
|
-
|
|
269
|
-
})
|
|
279
|
+
)
|
|
270
280
|
);
|
|
271
281
|
function getYPositions(mode, point, screenSize, frameSize) {
|
|
272
282
|
if (!screenSize || !frameSize) return 0;
|