@tamagui/sheet 3.0.0-beta.922.1 → 3.0.0
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/Sheet.cjs +48 -16
- package/dist/cjs/Sheet.native.cjs +46 -17
- package/dist/cjs/Sheet.native.js +46 -17
- package/dist/cjs/Sheet.native.js.map +1 -1
- package/dist/cjs/SheetDragSurface.cjs +50 -0
- package/dist/{jsx/GestureDetectorWrapper.native.js → cjs/SheetDragSurface.native.cjs} +24 -12
- package/dist/cjs/{GestureDetectorWrapper.native.js → SheetDragSurface.native.js} +25 -11
- package/dist/cjs/SheetDragSurface.native.js.map +1 -0
- package/dist/cjs/SheetImplementationCustom.cjs +41 -58
- package/dist/cjs/SheetImplementationCustom.native.cjs +43 -59
- package/dist/cjs/SheetImplementationCustom.native.js +43 -59
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +15 -3
- package/dist/cjs/SheetScrollView.native.cjs +17 -4
- package/dist/cjs/SheetScrollView.native.js +17 -4
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/nativeSheet.cjs +3 -59
- package/dist/cjs/nativeSheet.native.cjs +70 -58
- package/dist/cjs/nativeSheet.native.js +70 -58
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/stableViewportHeight.cjs +27 -0
- package/dist/cjs/stableViewportHeight.native.cjs +29 -0
- package/dist/cjs/stableViewportHeight.native.js +31 -0
- package/dist/cjs/stableViewportHeight.native.js.map +1 -0
- package/dist/cjs/useSheetOffscreenSize.cjs +3 -1
- package/dist/cjs/useSheetOffscreenSize.native.cjs +3 -2
- package/dist/cjs/useSheetOffscreenSize.native.js +3 -2
- package/dist/cjs/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/cjs/useSheetOpenState.cjs +13 -6
- package/dist/cjs/useSheetOpenState.native.cjs +15 -5
- package/dist/cjs/useSheetOpenState.native.js +15 -5
- package/dist/cjs/useSheetOpenState.native.js.map +1 -1
- package/dist/cjs/useSheetProviderProps.cjs +5 -94
- package/dist/cjs/useSheetProviderProps.native.cjs +5 -103
- package/dist/cjs/useSheetProviderProps.native.js +5 -103
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetState.cjs +120 -0
- package/dist/cjs/useSheetState.native.cjs +131 -0
- package/dist/cjs/useSheetState.native.js +133 -0
- package/dist/cjs/useSheetState.native.js.map +1 -0
- package/dist/esm/Sheet.mjs +48 -15
- package/dist/esm/Sheet.mjs.map +1 -1
- package/dist/esm/Sheet.native.js +46 -17
- package/dist/esm/Sheet.native.js.map +1 -1
- package/dist/esm/SheetDragSurface.mjs +25 -0
- package/dist/esm/SheetDragSurface.mjs.map +1 -0
- package/dist/esm/SheetDragSurface.native.js +34 -0
- package/dist/esm/SheetDragSurface.native.js.map +1 -0
- package/dist/esm/SheetImplementationCustom.mjs +39 -56
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +41 -57
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +16 -4
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +18 -5
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/nativeSheet.mjs +3 -60
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +70 -58
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/stableViewportHeight.mjs +8 -0
- package/dist/esm/stableViewportHeight.mjs.map +1 -0
- package/dist/esm/stableViewportHeight.native.js +8 -0
- package/dist/esm/stableViewportHeight.native.js.map +1 -0
- package/dist/esm/useKeyboardControllerSheet.native.js +0 -5
- package/dist/esm/useSheetOffscreenSize.mjs +3 -1
- package/dist/esm/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/esm/useSheetOffscreenSize.native.js +3 -2
- package/dist/esm/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/esm/useSheetOpenState.mjs +14 -7
- package/dist/esm/useSheetOpenState.mjs.map +1 -1
- package/dist/esm/useSheetOpenState.native.js +16 -6
- package/dist/esm/useSheetOpenState.native.js.map +1 -1
- package/dist/esm/useSheetProviderProps.mjs +5 -88
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js +5 -97
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/useSheetState.mjs +95 -0
- package/dist/esm/useSheetState.mjs.map +1 -0
- package/dist/esm/useSheetState.native.js +104 -0
- package/dist/esm/useSheetState.native.js.map +1 -0
- package/dist/jsx/Sheet.mjs +48 -15
- package/dist/jsx/Sheet.mjs.map +1 -1
- package/dist/jsx/Sheet.native.cjs +46 -17
- package/dist/jsx/Sheet.native.js +46 -17
- package/dist/jsx/Sheet.native.js.map +1 -1
- package/dist/jsx/SheetDragSurface.mjs +25 -0
- package/dist/jsx/SheetDragSurface.mjs.map +1 -0
- package/dist/{cjs/GestureDetectorWrapper.native.cjs → jsx/SheetDragSurface.native.cjs} +24 -10
- package/dist/jsx/{GestureDetectorWrapper.native.cjs → SheetDragSurface.native.js} +26 -10
- package/dist/jsx/SheetDragSurface.native.js.map +1 -0
- package/dist/jsx/SheetImplementationCustom.mjs +39 -56
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.cjs +43 -59
- package/dist/jsx/SheetImplementationCustom.native.js +43 -59
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +16 -4
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.cjs +17 -4
- package/dist/jsx/SheetScrollView.native.js +17 -4
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/nativeSheet.mjs +3 -60
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.cjs +70 -58
- package/dist/jsx/nativeSheet.native.js +70 -58
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/stableViewportHeight.mjs +8 -0
- package/dist/jsx/stableViewportHeight.mjs.map +1 -0
- package/dist/jsx/stableViewportHeight.native.cjs +29 -0
- package/dist/jsx/stableViewportHeight.native.js +31 -0
- package/dist/jsx/stableViewportHeight.native.js.map +1 -0
- package/dist/jsx/useSheetOffscreenSize.mjs +3 -1
- package/dist/jsx/useSheetOffscreenSize.mjs.map +1 -1
- package/dist/jsx/useSheetOffscreenSize.native.cjs +3 -2
- package/dist/jsx/useSheetOffscreenSize.native.js +3 -2
- package/dist/jsx/useSheetOffscreenSize.native.js.map +1 -1
- package/dist/jsx/useSheetOpenState.mjs +14 -7
- package/dist/jsx/useSheetOpenState.mjs.map +1 -1
- package/dist/jsx/useSheetOpenState.native.cjs +15 -5
- package/dist/jsx/useSheetOpenState.native.js +15 -5
- package/dist/jsx/useSheetOpenState.native.js.map +1 -1
- package/dist/jsx/useSheetProviderProps.mjs +5 -88
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.cjs +5 -103
- package/dist/jsx/useSheetProviderProps.native.js +5 -103
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/useSheetState.mjs +95 -0
- package/dist/jsx/useSheetState.mjs.map +1 -0
- package/dist/jsx/useSheetState.native.cjs +131 -0
- package/dist/jsx/useSheetState.native.js +133 -0
- package/dist/jsx/useSheetState.native.js.map +1 -0
- package/package.json +27 -22
- package/src/Sheet.tsx +45 -18
- package/src/SheetDragSurface.native.tsx +42 -0
- package/src/SheetDragSurface.tsx +40 -0
- package/src/SheetImplementationCustom.tsx +67 -92
- package/src/SheetScrollView.tsx +26 -4
- package/src/nativeSheet.native.tsx +110 -0
- package/src/nativeSheet.ts +16 -0
- package/src/stableViewportHeight.native.ts +9 -0
- package/src/stableViewportHeight.ts +15 -0
- package/src/types.tsx +44 -1
- package/src/useSheetOffscreenSize.tsx +3 -7
- package/src/useSheetOpenState.tsx +18 -8
- package/src/useSheetProviderProps.tsx +18 -149
- package/src/useSheetScrollViewGestures.native.ts +4 -1
- package/src/useSheetState.tsx +139 -0
- package/types/Sheet.d.ts +71 -167
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetDragSurface.d.ts +11 -0
- package/types/SheetDragSurface.d.ts.map +1 -0
- package/types/SheetDragSurface.native.d.ts +11 -0
- package/types/SheetDragSurface.native.d.ts.map +1 -0
- package/types/SheetImplementationCustom.d.ts +1 -2
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts +3 -3
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/nativeSheet.d.ts +8 -9
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/nativeSheet.native.d.ts +4 -0
- package/types/nativeSheet.native.d.ts.map +1 -0
- package/types/stableViewportHeight.d.ts +12 -0
- package/types/stableViewportHeight.d.ts.map +1 -0
- package/types/stableViewportHeight.native.d.ts +6 -0
- package/types/stableViewportHeight.native.d.ts.map +1 -0
- package/types/types.d.ts +34 -1
- package/types/types.d.ts.map +1 -1
- package/types/useSheetOffscreenSize.d.ts +1 -1
- package/types/useSheetOffscreenSize.d.ts.map +1 -1
- package/types/useSheetOpenState.d.ts +3 -1
- package/types/useSheetOpenState.d.ts.map +1 -1
- package/types/useSheetProviderProps.d.ts +15 -13
- package/types/useSheetProviderProps.d.ts.map +1 -1
- package/types/useSheetScrollViewGestures.native.d.ts +1 -1
- package/types/useSheetScrollViewGestures.native.d.ts.map +1 -1
- package/types/useSheetState.d.ts +26 -0
- package/types/useSheetState.d.ts.map +1 -0
- package/dist/cjs/GestureDetectorWrapper.cjs +0 -44
- package/dist/cjs/GestureDetectorWrapper.native.js.map +0 -1
- package/dist/esm/GestureDetectorWrapper.mjs +0 -25
- package/dist/esm/GestureDetectorWrapper.mjs.map +0 -1
- package/dist/esm/GestureDetectorWrapper.native.js +0 -26
- package/dist/esm/GestureDetectorWrapper.native.js.map +0 -1
- package/dist/jsx/GestureDetectorWrapper.mjs +0 -25
- package/dist/jsx/GestureDetectorWrapper.mjs.map +0 -1
- package/dist/jsx/GestureDetectorWrapper.native.js.map +0 -1
- package/src/GestureDetectorWrapper.tsx +0 -38
- package/src/nativeSheet.tsx +0 -86
- package/types/GestureDetectorWrapper.d.ts +0 -14
- package/types/GestureDetectorWrapper.d.ts.map +0 -1
package/dist/esm/Sheet.native.js
CHANGED
|
@@ -10,7 +10,6 @@ import { XStack, YStack } from "@tamagui/stacks";
|
|
|
10
10
|
import { useDidFinishSSR } from "@tamagui/use-did-finish-ssr";
|
|
11
11
|
import { StackZIndexContext } from "@tamagui/z-index-stack";
|
|
12
12
|
import { useContext, useEffect, useMemo, useRef } from "react";
|
|
13
|
-
import { Platform } from "react-native";
|
|
14
13
|
import { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from "./constants.native.js";
|
|
15
14
|
import { getNativeSheet } from "./nativeSheet.native.js";
|
|
16
15
|
import { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from "./SheetContext.native.js";
|
|
@@ -33,7 +32,7 @@ var SheetOverlayFrame = styled(YStack, {
|
|
|
33
32
|
displayName: SHEET_OVERLAY_NAME,
|
|
34
33
|
inset: 0,
|
|
35
34
|
position: "absolute",
|
|
36
|
-
zIndex:
|
|
35
|
+
zIndex: 1e5 - 1,
|
|
37
36
|
pointerEvents: "auto",
|
|
38
37
|
variants: { open: {
|
|
39
38
|
true: { pointerEvents: "auto" },
|
|
@@ -46,8 +45,7 @@ var SheetContainerFrame = styled(YStack, {
|
|
|
46
45
|
flex: 1,
|
|
47
46
|
position: "relative",
|
|
48
47
|
zIndex: 0,
|
|
49
|
-
width: "100%"
|
|
50
|
-
maxHeight: "100%"
|
|
48
|
+
width: "100%"
|
|
51
49
|
});
|
|
52
50
|
var SheetBackgroundFrame = styled(YStack, {
|
|
53
51
|
displayName: SHEET_BACKGROUND_NAME,
|
|
@@ -66,10 +64,14 @@ var SheetHandle = createStyledHOC(SheetHandleFrame, function(param, forwardedRef
|
|
|
66
64
|
useEffect(function() {
|
|
67
65
|
if (!context.scrollBridge) return;
|
|
68
66
|
return context.scrollBridge.onParentDragging(function(isDragging) {
|
|
69
|
-
if (isDragging)
|
|
67
|
+
if (isDragging) {
|
|
68
|
+
wasDraggingRef.current = true;
|
|
69
|
+
}
|
|
70
70
|
});
|
|
71
71
|
}, [context.scrollBridge]);
|
|
72
|
-
if (context.onlyShowContainer)
|
|
72
|
+
if (context.onlyShowContainer) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
73
75
|
return /* @__PURE__ */ jsx(SheetHandleFrame, {
|
|
74
76
|
ref: composedRef,
|
|
75
77
|
onPressIn: function() {
|
|
@@ -93,7 +95,9 @@ var SheetOverlay = createStyledHOC(SheetOverlayFrame, function(propsIn, ref) {
|
|
|
93
95
|
var context = useSheetContext(scope);
|
|
94
96
|
var isInOverlayLayer = useContext(SheetOverlayLayerContext);
|
|
95
97
|
var didWarn = useRef(false);
|
|
96
|
-
if (context.onlyShowContainer)
|
|
98
|
+
if (context.onlyShowContainer) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
97
101
|
if (!isInOverlayLayer) {
|
|
98
102
|
if (process.env.NODE_ENV === "development" && !didWarn.current) {
|
|
99
103
|
didWarn.current = true;
|
|
@@ -112,19 +116,40 @@ var SheetOverlay = createStyledHOC(SheetOverlayFrame, function(propsIn, ref) {
|
|
|
112
116
|
var SheetContainer = createStyledHOC(SheetContainerFrame, function(param, forwardedRef) {
|
|
113
117
|
var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;
|
|
114
118
|
var context = useSheetContext(scope);
|
|
115
|
-
var { hasFit,
|
|
119
|
+
var { hasFit, frameSize, contentRef, open } = context;
|
|
116
120
|
var composedContentRef = useComposedRefs(forwardedRef, contentRef);
|
|
117
121
|
var offscreenSize = useSheetOffscreenSize(context);
|
|
118
122
|
var stableFrameSize = useRef(frameSize);
|
|
119
123
|
useEffect(function() {
|
|
120
|
-
if (open && frameSize)
|
|
124
|
+
if (open && frameSize) {
|
|
125
|
+
stableFrameSize.current = frameSize;
|
|
126
|
+
}
|
|
121
127
|
}, [open, frameSize]);
|
|
122
128
|
var sheetContents = useMemo(function() {
|
|
129
|
+
if (context.onlyShowContainer) {
|
|
130
|
+
return /* @__PURE__ */ jsx(SheetContainerFrame, {
|
|
131
|
+
ref: composedContentRef,
|
|
132
|
+
flex: hasFit ? 0 : 1,
|
|
133
|
+
flexBasis: hasFit ? "auto" : void 0,
|
|
134
|
+
maxHeight: hasFit ? void 0 : "100%",
|
|
135
|
+
pointerEvents: open ? "auto" : "none",
|
|
136
|
+
"data-state": open ? "open" : "closed",
|
|
137
|
+
...props,
|
|
138
|
+
onLayout: composeEventHandlers(props.onLayout, function(event) {
|
|
139
|
+
context.setFrameSize(event.nativeEvent.layout.height);
|
|
140
|
+
}),
|
|
141
|
+
children: /* @__PURE__ */ jsx(StackZIndexContext, {
|
|
142
|
+
zIndex: resolveViewZIndex(props.zIndex),
|
|
143
|
+
children
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
123
147
|
var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;
|
|
124
148
|
return /* @__PURE__ */ jsxs(SheetContainerFrame, {
|
|
125
149
|
ref: composedContentRef,
|
|
126
150
|
flex: hasFit && open ? 0 : 1,
|
|
127
151
|
flexBasis: hasFit ? "auto" : void 0,
|
|
152
|
+
maxHeight: "100%",
|
|
128
153
|
height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,
|
|
129
154
|
pointerEvents: open ? "auto" : "none",
|
|
130
155
|
"data-state": open ? "open" : "closed",
|
|
@@ -144,16 +169,20 @@ var SheetContainer = createStyledHOC(SheetContainerFrame, function(param, forwar
|
|
|
144
169
|
frameSize,
|
|
145
170
|
offscreenSize,
|
|
146
171
|
adjustPaddingForOffscreenContent,
|
|
147
|
-
hasFit
|
|
172
|
+
hasFit,
|
|
173
|
+
context.onlyShowContainer,
|
|
174
|
+
context.setFrameSize
|
|
148
175
|
]);
|
|
176
|
+
if (context.onlyShowContainer) return sheetContents;
|
|
149
177
|
return /* @__PURE__ */ jsx(RemoveScroll, {
|
|
150
|
-
enabled: !disableRemoveScroll && context.open,
|
|
178
|
+
enabled: !context.disableRemoveScroll && context.open,
|
|
151
179
|
children: sheetContents
|
|
152
180
|
});
|
|
153
181
|
});
|
|
154
182
|
var SheetBackground = createStyledHOC(SheetBackgroundFrame, function(param, forwardedRef) {
|
|
155
183
|
var { scope, disableHideBottomOverflow, ...props } = param;
|
|
156
184
|
var context = useSheetContext(scope);
|
|
185
|
+
if (context.onlyShowContainer) return null;
|
|
157
186
|
var bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;
|
|
158
187
|
return /* @__PURE__ */ jsx(SheetBackgroundFrame, {
|
|
159
188
|
ref: forwardedRef,
|
|
@@ -167,13 +196,13 @@ var SheetRoot = createRefComponent(function SheetRoot2(props, ref) {
|
|
|
167
196
|
var isAdapted = useAdaptIsActive();
|
|
168
197
|
var adaptContext = useAdaptContext();
|
|
169
198
|
var { isShowingNonSheet } = useSheetController(props.scope);
|
|
170
|
-
var
|
|
171
|
-
var
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
199
|
+
var shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);
|
|
200
|
+
var isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;
|
|
201
|
+
var nativeImplementation = props.native === true || Array.isArray(props.native) && props.native.includes("ios") ? getNativeSheet("ios") : null;
|
|
202
|
+
var SheetImplementation = nativeImplementation !== null && nativeImplementation !== void 0 ? nativeImplementation : SheetImplementationCustom;
|
|
203
|
+
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {
|
|
204
|
+
return null;
|
|
175
205
|
}
|
|
176
|
-
if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) return null;
|
|
177
206
|
var implementation = /* @__PURE__ */ jsx(SheetImplementation, {
|
|
178
207
|
ref,
|
|
179
208
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.native.js","names":[],"sources":["esm/Sheet.native.js"],"sourcesContent":["import { jsx, jsxs } from \"react/jsx-runtime\";\nimport { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledHOC, styled } from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { resolveViewZIndex } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { XStack, YStack } from \"@tamagui/stacks\";\nimport { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { StackZIndexContext } from \"@tamagui/z-index-stack\";\nimport { useContext, useEffect, useMemo, useRef } from \"react\";\nimport { Platform } from \"react-native\";\nimport { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from \"./constants\";\nimport { getNativeSheet } from \"./nativeSheet\";\nimport { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\n\nexport * from \"./types\"\n\nvar SheetHandleFrame = styled(XStack, {\n\tdisplayName: SHEET_HANDLE_NAME,\n\tvariants: { open: {\n\t\ttrue: { pointerEvents: \"auto\" },\n\t\tfalse: { pointerEvents: \"none\" }\n\t} }\n});\nvar SheetOverlayFrame = styled(YStack, {\n\tdisplayName: SHEET_OVERLAY_NAME,\n\tinset: 0,\n\tposition: \"absolute\",\n\tzIndex: 99999,\n\tpointerEvents: \"auto\",\n\tvariants: { open: {\n\t\ttrue: { pointerEvents: \"auto\" },\n\t\tfalse: { pointerEvents: \"none\" }\n\t} }\n});\nObject.assign(SheetOverlayFrame.staticConfig, { [SHEET_OVERLAY_MARKER]: true });\nvar SheetContainerFrame = styled(YStack, {\n\tdisplayName: SHEET_CONTAINER_NAME,\n\tflex: 1,\n\tposition: \"relative\",\n\tzIndex: 0,\n\twidth: \"100%\",\n\tmaxHeight: \"100%\"\n});\nvar SheetBackgroundFrame = styled(YStack, {\n\tdisplayName: SHEET_BACKGROUND_NAME,\n\tposition: \"absolute\",\n\ttop: 0,\n\tleft: 0,\n\tright: 0,\n\tzIndex: -1,\n\tpointerEvents: \"none\"\n});\nvar SheetHandle = createStyledHOC(SheetHandleFrame, function(param, forwardedRef) {\n\tvar { scope, ...props } = param;\n\tvar context = useSheetContext(scope);\n\tvar composedRef = useComposedRefs(context.handleRef, forwardedRef);\n\tvar wasDraggingRef = useRef(false);\n\tuseEffect(function() {\n\t\tif (!context.scrollBridge) return;\n\t\treturn context.scrollBridge.onParentDragging(function(isDragging) {\n\t\t\tif (isDragging) wasDraggingRef.current = true;\n\t\t});\n\t}, [context.scrollBridge]);\n\tif (context.onlyShowContainer) return null;\n\treturn /* @__PURE__ */ jsx(SheetHandleFrame, {\n\t\tref: composedRef,\n\t\tonPressIn: function() {\n\t\t\twasDraggingRef.current = false;\n\t\t},\n\t\tonPress: function() {\n\t\t\tif (wasDraggingRef.current) {\n\t\t\t\twasDraggingRef.current = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n\t\t\tvar nextPos = (context.position + 1) % max;\n\t\t\tcontext.setPosition(nextPos);\n\t\t},\n\t\topen: context.open,\n\t\t...props\n\t});\n});\nvar SheetOverlay = createStyledHOC(SheetOverlayFrame, function(propsIn, ref) {\n\tvar { scope, ...props } = propsIn;\n\tvar context = useSheetContext(scope);\n\tvar isInOverlayLayer = useContext(SheetOverlayLayerContext);\n\tvar didWarn = useRef(false);\n\tif (context.onlyShowContainer) return null;\n\tif (!isInOverlayLayer) {\n\t\tif (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n\t\t\tdidWarn.current = true;\n\t\t\tconsole.error(\"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\");\n\t\t}\n\t\treturn null;\n\t}\n\treturn /* @__PURE__ */ jsx(SheetOverlayFrame, {\n\t\t...props,\n\t\tref,\n\t\tonPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? function() {\n\t\t\tcontext.setOpen(false);\n\t\t} : void 0)\n\t});\n});\nvar SheetContainer = createStyledHOC(SheetContainerFrame, function(param, forwardedRef) {\n\tvar { scope, adjustPaddingForOffscreenContent, children, ...props } = param;\n\tvar context = useSheetContext(scope);\n\tvar { hasFit, disableRemoveScroll, frameSize, contentRef, open } = context;\n\tvar composedContentRef = useComposedRefs(forwardedRef, contentRef);\n\tvar offscreenSize = useSheetOffscreenSize(context);\n\tvar stableFrameSize = useRef(frameSize);\n\tuseEffect(function() {\n\t\tif (open && frameSize) stableFrameSize.current = frameSize;\n\t}, [open, frameSize]);\n\tvar sheetContents = useMemo(function() {\n\t\tvar shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n\t\treturn /* @__PURE__ */ jsxs(SheetContainerFrame, {\n\t\t\tref: composedContentRef,\n\t\t\tflex: hasFit && open ? 0 : 1,\n\t\t\tflexBasis: hasFit ? \"auto\" : void 0,\n\t\t\theight: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n\t\t\tpointerEvents: open ? \"auto\" : \"none\",\n\t\t\t\"data-state\": open ? \"open\" : \"closed\",\n\t\t\t...props,\n\t\t\tchildren: [/* @__PURE__ */ jsx(StackZIndexContext, {\n\t\t\t\tzIndex: resolveViewZIndex(props.zIndex),\n\t\t\t\tchildren\n\t\t\t}), adjustPaddingForOffscreenContent && /* @__PURE__ */ jsx(View, {\n\t\t\t\t\"data-sheet-offscreen-pad\": true,\n\t\t\t\theight: offscreenSize,\n\t\t\t\twidth: \"100%\"\n\t\t\t})]\n\t\t});\n\t}, [\n\t\topen,\n\t\tprops,\n\t\tframeSize,\n\t\toffscreenSize,\n\t\tadjustPaddingForOffscreenContent,\n\t\thasFit\n\t]);\n\treturn /* @__PURE__ */ jsx(RemoveScroll, {\n\t\tenabled: !disableRemoveScroll && context.open,\n\t\tchildren: sheetContents\n\t});\n});\nvar SheetBackground = createStyledHOC(SheetBackgroundFrame, function(param, forwardedRef) {\n\tvar { scope, disableHideBottomOverflow, ...props } = param;\n\tvar context = useSheetContext(scope);\n\tvar bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n\treturn /* @__PURE__ */ jsx(SheetBackgroundFrame, {\n\t\tref: forwardedRef,\n\t\t\"data-sheet-background\": \"\",\n\t\tbottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n\t\t...props\n\t});\n});\nvar SheetRoot = createRefComponent(function SheetRoot2(props, ref) {\n\tvar hydrated = useDidFinishSSR();\n\tvar isAdapted = useAdaptIsActive();\n\tvar adaptContext = useAdaptContext();\n\tvar { isShowingNonSheet } = useSheetController(props.scope);\n\tvar isShowingAdaptNonSheet = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange) && !adaptContext.active && adaptContext.open;\n\tvar SheetImplementation = SheetImplementationCustom;\n\tif (props.native && Platform.OS === \"ios\") {\n\t\tvar impl = getNativeSheet(\"ios\");\n\t\tif (impl) SheetImplementation = impl;\n\t}\n\tif (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) return null;\n\tvar implementation = /* @__PURE__ */ jsx(SheetImplementation, {\n\t\tref,\n\t\t...props\n\t});\n\treturn isAdapted ? /* @__PURE__ */ jsx(AdaptCapabilities, {\n\t\tscroll: true,\n\t\toverlay: true,\n\t\tdismiss: true,\n\t\tchildren: implementation\n\t}) : implementation;\n});\nvar sheetParts = {\n\tContainer: SheetContainer,\n\tBackground: SheetBackground,\n\tOverlay: SheetOverlay,\n\tHandle: SheetHandle,\n\tScrollView: SheetScrollView\n};\nvar SheetControlled = withStaticProperties(SheetRoot, sheetParts);\nvar Sheet = withStaticProperties(SheetRoot, {\n\tRoot: SheetRoot,\n\tControlled: SheetControlled,\n\tuseAnimatedPosition,\n\t...sheetParts\n});\n\nexport { Sheet, SheetBackground, SheetContainer, SheetControlled, SheetHandle, SheetOverlay, SheetRoot };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,mBAAmB,OAAO,QAAQ;CACrC,aAAa;CACb,UAAU,EAAE,MAAM;EACjB,MAAM,EAAE,eAAe,OAAO;EAC9B,OAAO,EAAE,eAAe,OAAO;CAChC,EAAE;AACH,CAAC;AACD,IAAI,oBAAoB,OAAO,QAAQ;CACtC,aAAa;CACb,OAAO;CACP,UAAU;CACV,QAAQ;CACR,eAAe;CACf,UAAU,EAAE,MAAM;EACjB,MAAM,EAAE,eAAe,OAAO;EAC9B,OAAO,EAAE,eAAe,OAAO;CAChC,EAAE;AACH,CAAC;AACD,OAAO,OAAO,kBAAkB,cAAc,GAAG,uBAAuB,KAAK,CAAC;AAC9E,IAAI,sBAAsB,OAAO,QAAQ;CACxC,aAAa;CACb,MAAM;CACN,UAAU;CACV,QAAQ;CACR,OAAO;CACP,WAAW;AACZ,CAAC;AACD,IAAI,uBAAuB,OAAO,QAAQ;CACzC,aAAa;CACb,UAAU;CACV,KAAK;CACL,MAAM;CACN,OAAO;CACP,QAAQ,CAAC;CACT,eAAe;AAChB,CAAC;AACD,IAAI,cAAc,gBAAgB,kBAAkB,SAAS,OAAO,cAAc;CACj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,QAAQ;CAC3F,OAAuB,oBAAI,sBAAsB;EAChD,KAAK;EACL,yBAAyB;EACzB,QAAQ,4BAA4B,IAAI,CAAC;EACzC,GAAG;CACJ,CAAC;AACF,CAAC;AACD,IAAI,YAAY,mBAAmB,SAAS,WAAW,OAAO,KAAK;CAClE,IAAI,WAAW,gBAAgB;CAC/B,IAAI,YAAY,iBAAiB;CACjC,IAAI,eAAe,gBAAgB;CACnC,IAAI,EAAE,sBAAsB,mBAAmB,MAAM,KAAK;CAC1D,IAAI,yBAAyB,QAAQ,aAAa,SAAS,KAAK,KAAK,aAAa,YAAY,KAAK,CAAC,aAAa,UAAU,aAAa;CACxI,IAAI,sBAAsB;CAC1B,IAAI,MAAM,UAAU,SAAS,OAAO,OAAO;EAC1C,IAAI,OAAO,eAAe,KAAK;EAC/B,IAAI,MAAM,sBAAsB;CACjC;CACA,IAAI,0BAA0B,qBAAqB,CAAC,UAAU,OAAO;CACrE,IAAI,iBAAiC,oBAAI,qBAAqB;EAC7D;EACA,GAAG;CACJ,CAAC;CACD,OAAO,YAA4B,oBAAI,mBAAmB;EACzD,QAAQ;EACR,SAAS;EACT,SAAS;EACT,UAAU;CACX,CAAC,IAAI;AACN,CAAC;AACD,IAAI,aAAa;CAChB,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY;AACb;AACA,IAAI,kBAAkB,qBAAqB,WAAW,UAAU;AAChE,IAAI,QAAQ,qBAAqB,WAAW;CAC3C,MAAM;CACN,YAAY;CACZ;CACA,GAAG;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"Sheet.native.js","names":[],"sources":["esm/Sheet.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { AdaptCapabilities, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb } from \"@tamagui/constants\";\nimport { createRefComponent, createStyledHOC, styled, View } from \"@tamagui/core\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { resolveViewZIndex } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { XStack, YStack } from \"@tamagui/stacks\";\nimport { useDidFinishSSR } from \"@tamagui/use-did-finish-ssr\";\nimport { StackZIndexContext } from \"@tamagui/z-index-stack\";\nimport { useContext, useEffect, useMemo, useRef } from \"react\";\nimport { SHEET_BACKGROUND_NAME, SHEET_CONTAINER_NAME, SHEET_HANDLE_NAME, SHEET_OVERLAY_MARKER, SHEET_OVERLAY_NAME } from \"./constants\";\nimport { getNativeSheet } from \"./nativeSheet\";\nimport { SheetOverlayLayerContext, useAnimatedPosition, useSheetContext } from \"./SheetContext\";\nimport { SheetImplementationCustom } from \"./SheetImplementationCustom\";\nimport { SheetScrollView } from \"./SheetScrollView\";\nimport { useSheetController } from \"./useSheetController\";\nimport { useSheetOffscreenSize } from \"./useSheetOffscreenSize\";\nimport { getMaxViewportHeight } from \"./webViewport\";\nexport * from \"./types\";\nvar SheetHandleFrame = styled(XStack, {\n displayName: SHEET_HANDLE_NAME,\n // the behavior Handle ships no opacity rules; open/close aesthetics (fade in\n // when open, dim when idle) live in the copied skin. see the canonical skin.\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nvar SheetOverlayFrame = styled(YStack, {\n displayName: SHEET_OVERLAY_NAME,\n inset: 0,\n position: \"absolute\",\n zIndex: 1e5 - 1,\n pointerEvents: \"auto\",\n variants: {\n open: {\n true: {\n pointerEvents: \"auto\"\n },\n false: {\n pointerEvents: \"none\"\n }\n }\n }\n});\nObject.assign(SheetOverlayFrame.staticConfig, {\n [SHEET_OVERLAY_MARKER]: true\n});\nvar SheetContainerFrame = styled(YStack, {\n displayName: SHEET_CONTAINER_NAME,\n flex: 1,\n position: \"relative\",\n zIndex: 0,\n width: \"100%\"\n});\nvar SheetBackgroundFrame = styled(YStack, {\n displayName: SHEET_BACKGROUND_NAME,\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n zIndex: -1,\n pointerEvents: \"none\"\n});\nvar SheetHandle = createStyledHOC(SheetHandleFrame, function(param, forwardedRef) {\n var { scope, ...props } = param;\n var context = useSheetContext(scope);\n var composedRef = useComposedRefs(context.handleRef, forwardedRef);\n var wasDraggingRef = useRef(false);\n useEffect(function() {\n if (!context.scrollBridge) return;\n return context.scrollBridge.onParentDragging(function(isDragging) {\n if (isDragging) {\n wasDraggingRef.current = true;\n }\n });\n }, [\n context.scrollBridge\n ]);\n if (context.onlyShowContainer) {\n return null;\n }\n return /* @__PURE__ */ _jsx(SheetHandleFrame, {\n ref: composedRef,\n onPressIn: function() {\n wasDraggingRef.current = false;\n },\n onPress: function() {\n if (wasDraggingRef.current) {\n wasDraggingRef.current = false;\n return;\n }\n var max = context.snapPoints.length + (context.dismissOnSnapToBottom ? -1 : 0);\n var nextPos = (context.position + 1) % max;\n context.setPosition(nextPos);\n },\n open: context.open,\n ...props\n });\n});\nvar SheetOverlay = createStyledHOC(SheetOverlayFrame, function(propsIn, ref) {\n var { scope, ...props } = propsIn;\n var context = useSheetContext(scope);\n var isInOverlayLayer = useContext(SheetOverlayLayerContext);\n var didWarn = useRef(false);\n if (context.onlyShowContainer) {\n return null;\n }\n if (!isInOverlayLayer) {\n if (process.env.NODE_ENV === \"development\" && !didWarn.current) {\n didWarn.current = true;\n console.error(\"Sheet.Overlay must be a direct child of Sheet. Move it next to Sheet.Handle and Sheet.Container.\");\n }\n return null;\n }\n return /* @__PURE__ */ _jsx(SheetOverlayFrame, {\n ...props,\n ref,\n onPress: composeEventHandlers(props.onPress, context.dismissOnOverlayPress ? function() {\n context.setOpen(false);\n } : void 0)\n });\n});\nvar SheetContainer = createStyledHOC(SheetContainerFrame, function(param, forwardedRef) {\n var { scope, adjustPaddingForOffscreenContent, children, ...props } = param;\n var context = useSheetContext(scope);\n var { hasFit, frameSize, contentRef, open } = context;\n var composedContentRef = useComposedRefs(forwardedRef, contentRef);\n var offscreenSize = useSheetOffscreenSize(context);\n var stableFrameSize = useRef(frameSize);\n useEffect(function() {\n if (open && frameSize) {\n stableFrameSize.current = frameSize;\n }\n }, [\n open,\n frameSize\n ]);\n var sheetContents = useMemo(function() {\n if (context.onlyShowContainer) {\n return /* @__PURE__ */ _jsx(SheetContainerFrame, {\n ref: composedContentRef,\n flex: hasFit ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n maxHeight: hasFit ? void 0 : \"100%\",\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n onLayout: composeEventHandlers(props.onLayout, function(event) {\n context.setFrameSize(event.nativeEvent.layout.height);\n }),\n children: /* @__PURE__ */ _jsx(StackZIndexContext, {\n zIndex: resolveViewZIndex(props.zIndex),\n children\n })\n });\n }\n var shouldUseFixedHeight = hasFit && !open && stableFrameSize.current;\n return /* @__PURE__ */ _jsxs(SheetContainerFrame, {\n ref: composedContentRef,\n flex: hasFit && open ? 0 : 1,\n flexBasis: hasFit ? \"auto\" : void 0,\n maxHeight: \"100%\",\n height: shouldUseFixedHeight ? stableFrameSize.current : hasFit ? void 0 : frameSize,\n pointerEvents: open ? \"auto\" : \"none\",\n \"data-state\": open ? \"open\" : \"closed\",\n ...props,\n children: [\n /* @__PURE__ */ _jsx(StackZIndexContext, {\n zIndex: resolveViewZIndex(props.zIndex),\n children\n }),\n adjustPaddingForOffscreenContent && /* @__PURE__ */ _jsx(View, {\n \"data-sheet-offscreen-pad\": true,\n height: offscreenSize,\n width: \"100%\"\n })\n ]\n });\n }, [\n open,\n props,\n frameSize,\n offscreenSize,\n adjustPaddingForOffscreenContent,\n hasFit,\n context.onlyShowContainer,\n context.setFrameSize\n ]);\n if (context.onlyShowContainer) return sheetContents;\n return /* @__PURE__ */ _jsx(RemoveScroll, {\n enabled: !context.disableRemoveScroll && context.open,\n children: sheetContents\n });\n});\nvar SheetBackground = createStyledHOC(SheetBackgroundFrame, function(param, forwardedRef) {\n var { scope, disableHideBottomOverflow, ...props } = param;\n var context = useSheetContext(scope);\n if (context.onlyShowContainer) return null;\n var bottomOverflow = isWeb ? Math.max(context.frameSize, getMaxViewportHeight()) : context.frameSize;\n return /* @__PURE__ */ _jsx(SheetBackgroundFrame, {\n ref: forwardedRef,\n \"data-sheet-background\": \"\",\n bottom: disableHideBottomOverflow ? 0 : -bottomOverflow,\n ...props\n });\n});\nvar SheetRoot = createRefComponent(function SheetRoot2(props, ref) {\n var hydrated = useDidFinishSSR();\n var isAdapted = useAdaptIsActive();\n var adaptContext = useAdaptContext();\n var { isShowingNonSheet } = useSheetController(props.scope);\n var shouldUseAdapt = Boolean(adaptContext.open !== void 0 || adaptContext.onOpenChange);\n var isShowingAdaptNonSheet = shouldUseAdapt && !adaptContext.active && adaptContext.open;\n var nativeImplementation = props.native === true || Array.isArray(props.native) && props.native.includes(\"ios\") ? getNativeSheet(\"ios\") : null;\n var SheetImplementation = nativeImplementation !== null && nativeImplementation !== void 0 ? nativeImplementation : SheetImplementationCustom;\n if (isShowingAdaptNonSheet || isShowingNonSheet || !hydrated) {\n return null;\n }\n var implementation = /* @__PURE__ */ _jsx(SheetImplementation, {\n ref,\n ...props\n });\n return isAdapted ? /* @__PURE__ */ _jsx(AdaptCapabilities, {\n scroll: true,\n overlay: true,\n dismiss: true,\n children: implementation\n }) : implementation;\n});\nvar sheetParts = {\n Container: SheetContainer,\n Background: SheetBackground,\n Overlay: SheetOverlay,\n Handle: SheetHandle,\n ScrollView: SheetScrollView\n};\nvar SheetControlled = withStaticProperties(SheetRoot, sheetParts);\nvar Sheet = withStaticProperties(SheetRoot, {\n Root: SheetRoot,\n Controlled: SheetControlled,\n useAnimatedPosition,\n ...sheetParts\n});\nexport {\n Sheet,\n SheetBackground,\n SheetContainer,\n SheetControlled,\n SheetHandle,\n SheetOverlay,\n SheetRoot\n};\n//# sourceMappingURL=Sheet.js.map\n"],"mappings":";;;;;;;;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,qBAAqB,CAAC,IAAI,QAAQ;CAC3F,OAAuB,oBAAK,sBAAsB;EAChD,KAAK;EACL,yBAAyB;EACzB,QAAQ,4BAA4B,IAAI,CAAC;EACzC,GAAG;CACL,CAAC;AACH,CAAC;AACD,IAAI,YAAY,mBAAmB,SAAS,WAAW,OAAO,KAAK;CACjE,IAAI,WAAW,gBAAgB;CAC/B,IAAI,YAAY,iBAAiB;CACjC,IAAI,eAAe,gBAAgB;CACnC,IAAI,EAAE,sBAAsB,mBAAmB,MAAM,KAAK;CAC1D,IAAI,iBAAiB,QAAQ,aAAa,SAAS,KAAK,KAAK,aAAa,YAAY;CACtF,IAAI,yBAAyB,kBAAkB,CAAC,aAAa,UAAU,aAAa;CACpF,IAAI,uBAAuB,MAAM,WAAW,QAAQ,MAAM,QAAQ,MAAM,MAAM,KAAK,MAAM,OAAO,SAAS,KAAK,IAAI,eAAe,KAAK,IAAI;CAC1I,IAAI,sBAAsB,yBAAyB,QAAQ,yBAAyB,KAAK,IAAI,uBAAuB;CACpH,IAAI,0BAA0B,qBAAqB,CAAC,UAAU;EAC5D,OAAO;CACT;CACA,IAAI,iBAAiC,oBAAK,qBAAqB;EAC7D;EACA,GAAG;CACL,CAAC;CACD,OAAO,YAA4B,oBAAK,mBAAmB;EACzD,QAAQ;EACR,SAAS;EACT,SAAS;EACT,UAAU;CACZ,CAAC,IAAI;AACP,CAAC;AACD,IAAI,aAAa;CACf,WAAW;CACX,YAAY;CACZ,SAAS;CACT,QAAQ;CACR,YAAY;AACd;AACA,IAAI,kBAAkB,qBAAqB,WAAW,UAAU;AAChE,IAAI,QAAQ,qBAAqB,WAAW;CAC1C,MAAM;CACN,YAAY;CACZ;CACA,GAAG;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { View } from "@tamagui/core";
|
|
2
|
+
import { PanResponder } from "@tamagui/react-native-pan-responder";
|
|
3
|
+
import { useResponderEvents } from "@tamagui/react-native-use-responder-events";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
function SheetDragSurface({ panConfig, children }) {
|
|
8
|
+
const ref = React.useRef(null);
|
|
9
|
+
const panHandlers = React.useMemo(() => panConfig ? PanResponder.create(panConfig).panHandlers : void 0, [panConfig]);
|
|
10
|
+
const { onClickCapture, ...responderHandlers } = panHandlers ?? {};
|
|
11
|
+
useResponderEvents(ref, responderHandlers);
|
|
12
|
+
const domProps = { onClickCapture };
|
|
13
|
+
return /* @__PURE__ */ jsx(View, {
|
|
14
|
+
ref,
|
|
15
|
+
...domProps,
|
|
16
|
+
flex: 1,
|
|
17
|
+
flexBasis: "auto",
|
|
18
|
+
width: "100%",
|
|
19
|
+
height: "100%",
|
|
20
|
+
children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { SheetDragSurface };
|
|
25
|
+
//# sourceMappingURL=SheetDragSurface.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetDragSurface.js","names":[],"sources":["esm/SheetDragSurface.js"],"sourcesContent":["import { View } from \"@tamagui/core\";\nimport { PanResponder } from \"@tamagui/react-native-pan-responder\";\nimport { useResponderEvents } from \"@tamagui/react-native-use-responder-events\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction SheetDragSurface({ panConfig, children }) {\n const ref = React.useRef(null);\n const panHandlers = React.useMemo(\n () => panConfig ? PanResponder.create(panConfig).panHandlers : void 0,\n [panConfig]\n );\n const { onClickCapture, ...responderHandlers } = panHandlers ?? {};\n useResponderEvents(ref, responderHandlers);\n const domProps = { onClickCapture };\n return (\n // flexBasis auto, like the container frame: under the web style compat\n // `flex={1}` means a basis of 0, which collapses this surface inside the\n // animated wrapper (that wrapper has no height of its own in fit mode), and\n // a collapsed surface leaves the frame unmeasured and parked off-screen\n /* @__PURE__ */ jsx(View, { ref, ...domProps, flex: 1, flexBasis: \"auto\", width: \"100%\", height: \"100%\", children })\n );\n}\nexport {\n SheetDragSurface\n};\n//# sourceMappingURL=SheetDragSurface.js.map\n"],"mappings":";;;;;;;AAKA,SAAS,iBAAiB,EAAE,WAAW,YAAY;CACjD,MAAM,MAAM,MAAM,OAAO,IAAI;CAC7B,MAAM,cAAc,MAAM,cAClB,YAAY,aAAa,OAAO,SAAS,CAAC,CAAC,cAAc,KAAK,GACpE,CAAC,SAAS,CACZ;CACA,MAAM,EAAE,gBAAgB,GAAG,sBAAsB,eAAe,CAAC;CACjE,mBAAmB,KAAK,iBAAiB;CACzC,MAAM,WAAW,EAAE,eAAe;CAClC,OAKkB,oBAAI,MAAM;EAAE;EAAK,GAAG;EAAU,MAAM;EAAG,WAAW;EAAQ,OAAO;EAAQ,QAAQ;EAAQ;CAAS,CAAC;AAEvH"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { PanResponder, View } from "react-native";
|
|
4
|
+
import { getGestureHandlerState } from "./gestureState.native.js";
|
|
5
|
+
|
|
6
|
+
function SheetDragSurface(param) {
|
|
7
|
+
var { gestureHandlerEnabled, panGesture, panConfig, children } = param;
|
|
8
|
+
var { GestureDetector } = getGestureHandlerState();
|
|
9
|
+
var panHandlers = React.useMemo(function() {
|
|
10
|
+
return panConfig ? PanResponder.create(panConfig).panHandlers : void 0;
|
|
11
|
+
}, [panConfig]);
|
|
12
|
+
if (gestureHandlerEnabled && panGesture && GestureDetector) {
|
|
13
|
+
return /* @__PURE__ */ jsx(GestureDetector, {
|
|
14
|
+
gesture: panGesture,
|
|
15
|
+
children: /* @__PURE__ */ jsx(View, {
|
|
16
|
+
style: { flex: 1 },
|
|
17
|
+
collapsable: false,
|
|
18
|
+
children
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsx(View, {
|
|
23
|
+
...panHandlers,
|
|
24
|
+
style: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
width: "100%",
|
|
27
|
+
height: "100%"
|
|
28
|
+
},
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { SheetDragSurface };
|
|
34
|
+
//# sourceMappingURL=SheetDragSurface.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SheetDragSurface.native.js","names":[],"sources":["esm/SheetDragSurface.native.js"],"sourcesContent":["import { jsx as _jsx } from \"react/jsx-runtime\";\nimport * as React from \"react\";\nimport { PanResponder, View } from \"react-native\";\nimport { getGestureHandlerState } from \"./gestureState\";\nfunction SheetDragSurface(param) {\n var { gestureHandlerEnabled, panGesture, panConfig, children } = param;\n var { GestureDetector } = getGestureHandlerState();\n var panHandlers = React.useMemo(function() {\n return panConfig ? PanResponder.create(panConfig).panHandlers : void 0;\n }, [\n panConfig\n ]);\n if (gestureHandlerEnabled && panGesture && GestureDetector) {\n return /* @__PURE__ */ _jsx(GestureDetector, {\n gesture: panGesture,\n children: /* @__PURE__ */ _jsx(View, {\n style: {\n flex: 1\n },\n collapsable: false,\n children\n })\n });\n }\n return /* @__PURE__ */ _jsx(View, {\n ...panHandlers,\n style: {\n flex: 1,\n width: \"100%\",\n height: \"100%\"\n },\n children\n });\n}\nexport {\n SheetDragSurface\n};\n//# sourceMappingURL=SheetDragSurface.native.js.map\n"],"mappings":";;;;;;AAIA,SAAS,iBAAiB,OAAO;CAC/B,IAAI,EAAE,uBAAuB,YAAY,WAAW,aAAa;CACjE,IAAI,EAAE,oBAAoB,uBAAuB;CACjD,IAAI,cAAc,MAAM,QAAQ,WAAW;EACzC,OAAO,YAAY,aAAa,OAAO,SAAS,CAAC,CAAC,cAAc,KAAK;CACvE,GAAG,CACD,SACF,CAAC;CACD,IAAI,yBAAyB,cAAc,iBAAiB;EAC1D,OAAuB,oBAAK,iBAAiB;GAC3C,SAAS;GACT,UAA0B,oBAAK,MAAM;IACnC,OAAO,EACL,MAAM,EACR;IACA,aAAa;IACb;GACF,CAAC;EACH,CAAC;CACH;CACA,OAAuB,oBAAK,MAAM;EAChC,GAAG;EACH,OAAO;GACL,MAAM;GACN,OAAO;GACP,QAAQ;EACV;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { AnimatePresence } from "@tamagui/animate-presence";
|
|
2
|
+
import { getTransitionResolver } from "@tamagui/animation-helpers/transitionResolver";
|
|
2
3
|
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
3
4
|
import { isWeb, useIsomorphicLayoutEffect } from "@tamagui/constants";
|
|
4
5
|
import { LayoutMeasurementController, View, createRefComponent, formatDiagnostic, useAnimatedNumber, useAnimatedNumberStyle, useAnimationDriver, useDidFinishSSR, useEvent, useThemeName } from "@tamagui/core";
|
|
5
6
|
import { Portal, needsPortalRepropagation } from "@tamagui/portal";
|
|
6
7
|
import React, { useState } from "react";
|
|
7
|
-
import { Dimensions, PanResponder, View as View$1 } from "react-native-web";
|
|
8
8
|
import { ParentSheetContext, SheetInsideSheetContext } from "./contexts.mjs";
|
|
9
9
|
import { SHEET_OVERLAY_MARKER } from "./constants.mjs";
|
|
10
|
-
import { GestureDetectorWrapper } from "./GestureDetectorWrapper.mjs";
|
|
11
10
|
import { getGestureHandlerState } from "./gestureState.mjs";
|
|
11
|
+
import { SheetDragSurface } from "./SheetDragSurface.mjs";
|
|
12
|
+
import { getStableViewportHeight } from "./stableViewportHeight.mjs";
|
|
12
13
|
import { GestureSheetProvider } from "./GestureSheetContext.mjs";
|
|
13
14
|
import { resisted } from "./helpers.mjs";
|
|
14
15
|
import { getKeyboardAdjustedSheetY, getKeyboardOccludedHeight, getSheetReleasePosition } from "./keyboardAvoidance.mjs";
|
|
15
|
-
import { MIN_KEYBOARD_HEIGHT, getMaxViewportHeight,
|
|
16
|
+
import { MIN_KEYBOARD_HEIGHT, getMaxViewportHeight, getWebKeyboardResizeHeight, getWebVisualViewportOffsetTop } from "./webViewport.mjs";
|
|
16
17
|
import { SheetAnimatedPositionContext, SheetOverlayLayerContext, SheetProvider } from "./SheetContext.mjs";
|
|
17
18
|
import { useGestureHandlerPan } from "./useGestureHandlerPan.mjs";
|
|
18
19
|
import { useKeyboardControllerSheet } from "./useKeyboardControllerSheet.mjs";
|
|
@@ -32,11 +33,6 @@ const rnghRootStyleClosed = {
|
|
|
32
33
|
};
|
|
33
34
|
let sheetHiddenStyleSheet = null;
|
|
34
35
|
const sheetEscapeLayers = [];
|
|
35
|
-
const relativeDimensionTo = isWeb ? "window" : "screen";
|
|
36
|
-
function getStableViewportHeight() {
|
|
37
|
-
if (isWeb && typeof window !== "undefined") return getStableLayoutViewportHeight();
|
|
38
|
-
return Dimensions.get(relativeDimensionTo).height;
|
|
39
|
-
}
|
|
40
36
|
const SheetImplementationCustom = createRefComponent(function SheetImplementationCustom2(props, forwardedRef) {
|
|
41
37
|
const parentSheet = React.useContext(ParentSheetContext);
|
|
42
38
|
const safeAreaTopInset = useSafeAreaInsets()?.top ?? 0;
|
|
@@ -51,16 +47,18 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
51
47
|
const animationDriver = useAnimationDriver();
|
|
52
48
|
const transitionConfig = (() => {
|
|
53
49
|
if (transitionConfigProp) return transitionConfigProp;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
const timing = (transition ? getTransitionResolver()?.resolve(transition, { animations: animationDriver.animations }) : null)?.all?.timing;
|
|
51
|
+
if (!timing) return null;
|
|
52
|
+
if (timing.kind === "timing") return {
|
|
53
|
+
type: "timing",
|
|
54
|
+
duration: timing.durationMs
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
type: "spring",
|
|
58
|
+
stiffness: timing.stiffness,
|
|
59
|
+
damping: timing.damping,
|
|
60
|
+
mass: timing.mass
|
|
61
|
+
};
|
|
64
62
|
})();
|
|
65
63
|
const [isShowingInnerSheet, setIsShowingInnerSheet] = React.useState(false);
|
|
66
64
|
const shouldHideParentSheet = !isWeb && modal && isShowingInnerSheet && needsPortalRepropagation();
|
|
@@ -274,15 +272,11 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
274
272
|
useIsomorphicLayoutEffect(() => {
|
|
275
273
|
if (hasntMeasured && screenSize && frameSize) {
|
|
276
274
|
at.current = screenSize;
|
|
277
|
-
animatedNumber.setValue(screenSize, {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
setTimeout(() => {
|
|
283
|
-
setDisableAnimation(false);
|
|
284
|
-
}, 10);
|
|
285
|
-
});
|
|
275
|
+
animatedNumber.setValue(screenSize, { type: "direct" });
|
|
276
|
+
syncAnimatedPosition(screenSize);
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
setDisableAnimation(false);
|
|
279
|
+
}, 10);
|
|
286
280
|
return;
|
|
287
281
|
}
|
|
288
282
|
if (disableAnimation) return;
|
|
@@ -316,10 +310,10 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
316
310
|
const disableDrag = props.disableDrag ?? controller?.disableDrag;
|
|
317
311
|
useThemeName();
|
|
318
312
|
const [blockPan, setBlockPan] = React.useState(false);
|
|
319
|
-
const
|
|
320
|
-
if (disableDrag) return;
|
|
321
|
-
if (!frameSize) return;
|
|
322
|
-
if (isShowingInnerSheet) return;
|
|
313
|
+
const panConfig = React.useMemo(() => {
|
|
314
|
+
if (disableDrag) return null;
|
|
315
|
+
if (!frameSize) return null;
|
|
316
|
+
if (isShowingInnerSheet) return null;
|
|
323
317
|
const minY = activePositions[0];
|
|
324
318
|
scrollBridge.paneMinY = minY;
|
|
325
319
|
let startY = at.current;
|
|
@@ -403,7 +397,7 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
403
397
|
setPosition(positionIndex);
|
|
404
398
|
animateTo(positionIndex);
|
|
405
399
|
};
|
|
406
|
-
return
|
|
400
|
+
return {
|
|
407
401
|
onMoveShouldSetPanResponder: onMoveShouldSet,
|
|
408
402
|
onPanResponderTerminationRequest: () => false,
|
|
409
403
|
onPanResponderGrant: grant,
|
|
@@ -416,7 +410,7 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
416
410
|
onPanResponderEnd: finish,
|
|
417
411
|
onPanResponderTerminate: finish,
|
|
418
412
|
onPanResponderRelease: finish
|
|
419
|
-
}
|
|
413
|
+
};
|
|
420
414
|
}, [
|
|
421
415
|
disableDrag,
|
|
422
416
|
isShowingInnerSheet,
|
|
@@ -560,16 +554,11 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
560
554
|
children: shouldHideParentSheet || !open ? null : overlayChildren
|
|
561
555
|
})
|
|
562
556
|
}),
|
|
563
|
-
snapPointsMode !== "percent" && /* @__PURE__ */ jsx(View
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
left: 0,
|
|
569
|
-
right: 0,
|
|
570
|
-
bottom: 0,
|
|
571
|
-
pointerEvents: "none"
|
|
572
|
-
},
|
|
557
|
+
snapPointsMode !== "percent" && /* @__PURE__ */ jsx(View, {
|
|
558
|
+
opacity: 0,
|
|
559
|
+
position: "absolute",
|
|
560
|
+
inset: 0,
|
|
561
|
+
pointerEvents: "none",
|
|
573
562
|
onLayout: handleMaxContentViewLayout
|
|
574
563
|
}),
|
|
575
564
|
/* @__PURE__ */ jsx(AnimatedView, {
|
|
@@ -586,17 +575,10 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
586
575
|
...applyHidden && { display: "none" },
|
|
587
576
|
...(shouldHideParentSheet || !open) && { pointerEvents: "none" }
|
|
588
577
|
}, animatedStyle],
|
|
589
|
-
children:
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}) : /* @__PURE__ */ jsx(View$1, {
|
|
594
|
-
...panResponder?.panHandlers,
|
|
595
|
-
style: {
|
|
596
|
-
flex: 1,
|
|
597
|
-
width: "100%",
|
|
598
|
-
height: "100%"
|
|
599
|
-
},
|
|
578
|
+
children: /* @__PURE__ */ jsx(SheetDragSurface, {
|
|
579
|
+
gestureHandlerEnabled,
|
|
580
|
+
panGesture,
|
|
581
|
+
panConfig,
|
|
600
582
|
children: animatedChildren
|
|
601
583
|
})
|
|
602
584
|
})
|
|
@@ -608,13 +590,14 @@ const SheetImplementationCustom = createRefComponent(function SheetImplementatio
|
|
|
608
590
|
});
|
|
609
591
|
const shouldMountChildren = unmountChildrenWhenHidden ? !isFullyClosed : true;
|
|
610
592
|
if (modal) {
|
|
593
|
+
if (!shouldMountChildren) return null;
|
|
611
594
|
const RNGHRoot = getGestureHandlerState().RootView;
|
|
612
|
-
const mountedContents =
|
|
595
|
+
const mountedContents = /* @__PURE__ */ jsx(ContainerComponent, { children: contents });
|
|
613
596
|
const modalContents = /* @__PURE__ */ jsx(Portal, {
|
|
614
597
|
stackZIndex: zIndex,
|
|
615
598
|
hidden: !isVisuallyActive,
|
|
616
599
|
...portalProps,
|
|
617
|
-
children:
|
|
600
|
+
children: RNGHRoot ? /* @__PURE__ */ jsx(RNGHRoot, {
|
|
618
601
|
style: open ? rnghRootStyleOpen : rnghRootStyleClosed,
|
|
619
602
|
children: mountedContents
|
|
620
603
|
}) : mountedContents
|