@hanzogui/sheet 7.3.0 → 8.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/.turbo/turbo-build.log +2 -0
- package/controller/index.cjs +2 -0
- package/controller/index.d.ts +5 -0
- package/controller/index.js +2 -0
- package/controller/index.native.cjs +2 -0
- package/controller/index.native.js +2 -0
- package/dist/cjs/GestureDetectorWrapper.native.js.map +1 -1
- package/dist/cjs/SheetImplementationCustom.cjs +137 -74
- package/dist/cjs/SheetImplementationCustom.native.js +162 -83
- package/dist/cjs/SheetImplementationCustom.native.js.map +1 -1
- package/dist/cjs/SheetScrollView.cjs +155 -34
- package/dist/cjs/SheetScrollView.native.js +160 -35
- package/dist/cjs/SheetScrollView.native.js.map +1 -1
- package/dist/cjs/createSheet.cjs +7 -3
- package/dist/cjs/createSheet.native.js +7 -3
- package/dist/cjs/createSheet.native.js.map +1 -1
- package/dist/cjs/gestureState.cjs +13 -2
- package/dist/cjs/gestureState.native.js +14 -2
- package/dist/cjs/gestureState.native.js.map +1 -1
- package/dist/cjs/index.cjs +12 -1
- package/dist/cjs/index.native.js +11 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/keyboardAvoidance.cjs +93 -0
- package/dist/cjs/keyboardAvoidance.native.js +99 -0
- package/dist/cjs/keyboardAvoidance.native.js.map +1 -0
- package/dist/cjs/nativeSheet.cjs +3 -0
- package/dist/cjs/nativeSheet.native.js +3 -0
- package/dist/cjs/nativeSheet.native.js.map +1 -1
- package/dist/cjs/setupGestureHandler.cjs +9 -6
- package/dist/cjs/setupGestureHandler.native.js +11 -6
- package/dist/cjs/setupGestureHandler.native.js.map +1 -1
- package/dist/cjs/useGestureHandlerPan.cjs +86 -18
- package/dist/cjs/useGestureHandlerPan.native.js +91 -18
- package/dist/cjs/useGestureHandlerPan.native.js.map +1 -1
- package/dist/cjs/useKeyboardControllerSheet.cjs +68 -6
- package/dist/cjs/useSafeAreaInsets.cjs +44 -0
- package/dist/cjs/useSafeAreaInsets.native.js +48 -0
- package/dist/cjs/useSafeAreaInsets.native.js.map +1 -0
- package/dist/cjs/useSheetProviderProps.cjs +1 -1
- package/dist/cjs/useSheetProviderProps.native.js +1 -1
- package/dist/cjs/useSheetProviderProps.native.js.map +1 -1
- package/dist/cjs/useSheetScrollViewGestures.cjs +30 -5
- package/dist/cjs/useSheetScrollViewGestures.native.js +4 -0
- package/dist/cjs/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/cjs/webViewport.cjs +75 -0
- package/dist/cjs/webViewport.native.js +81 -0
- package/dist/cjs/webViewport.native.js.map +1 -0
- package/dist/esm/GestureDetectorWrapper.mjs.map +1 -1
- package/dist/esm/GestureDetectorWrapper.native.js.map +1 -1
- package/dist/esm/SheetImplementationCustom.mjs +143 -84
- package/dist/esm/SheetImplementationCustom.mjs.map +1 -1
- package/dist/esm/SheetImplementationCustom.native.js +173 -102
- package/dist/esm/SheetImplementationCustom.native.js.map +1 -1
- package/dist/esm/SheetScrollView.mjs +157 -36
- package/dist/esm/SheetScrollView.mjs.map +1 -1
- package/dist/esm/SheetScrollView.native.js +162 -37
- package/dist/esm/SheetScrollView.native.js.map +1 -1
- package/dist/esm/createSheet.mjs +9 -6
- package/dist/esm/createSheet.mjs.map +1 -1
- package/dist/esm/createSheet.native.js +19 -15
- package/dist/esm/createSheet.native.js.map +1 -1
- package/dist/esm/gestureState.mjs +13 -2
- package/dist/esm/gestureState.mjs.map +1 -1
- package/dist/esm/gestureState.native.js +14 -2
- package/dist/esm/gestureState.native.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/keyboardAvoidance.mjs +66 -0
- package/dist/esm/keyboardAvoidance.mjs.map +1 -0
- package/dist/esm/keyboardAvoidance.native.js +69 -0
- package/dist/esm/keyboardAvoidance.native.js.map +1 -0
- package/dist/esm/nativeSheet.mjs +3 -0
- package/dist/esm/nativeSheet.mjs.map +1 -1
- package/dist/esm/nativeSheet.native.js +3 -0
- package/dist/esm/nativeSheet.native.js.map +1 -1
- package/dist/esm/setupGestureHandler.mjs +9 -6
- package/dist/esm/setupGestureHandler.mjs.map +1 -1
- package/dist/esm/setupGestureHandler.native.js +11 -6
- package/dist/esm/setupGestureHandler.native.js.map +1 -1
- package/dist/esm/useGestureHandlerPan.mjs +87 -19
- package/dist/esm/useGestureHandlerPan.mjs.map +1 -1
- package/dist/esm/useGestureHandlerPan.native.js +92 -19
- package/dist/esm/useGestureHandlerPan.native.js.map +1 -1
- package/dist/esm/useKeyboardControllerSheet.mjs +69 -7
- package/dist/esm/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/esm/useSafeAreaInsets.mjs +7 -0
- package/dist/esm/useSafeAreaInsets.mjs.map +1 -0
- package/dist/esm/useSafeAreaInsets.native.js +8 -0
- package/dist/esm/useSafeAreaInsets.native.js.map +1 -0
- package/dist/esm/useSheetProviderProps.mjs +1 -1
- package/dist/esm/useSheetProviderProps.mjs.map +1 -1
- package/dist/esm/useSheetProviderProps.native.js +1 -1
- package/dist/esm/useSheetProviderProps.native.js.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.mjs +30 -5
- package/dist/esm/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/esm/useSheetScrollViewGestures.native.js +4 -0
- package/dist/esm/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/esm/webViewport.mjs +43 -0
- package/dist/esm/webViewport.mjs.map +1 -0
- package/dist/esm/webViewport.native.js +46 -0
- package/dist/esm/webViewport.native.js.map +1 -0
- package/dist/jsx/GestureDetectorWrapper.mjs.map +1 -1
- package/dist/jsx/GestureDetectorWrapper.native.js.map +1 -1
- package/dist/jsx/SheetImplementationCustom.mjs +143 -84
- package/dist/jsx/SheetImplementationCustom.mjs.map +1 -1
- package/dist/jsx/SheetImplementationCustom.native.js +162 -83
- package/dist/jsx/SheetImplementationCustom.native.js.map +1 -1
- package/dist/jsx/SheetScrollView.mjs +157 -36
- package/dist/jsx/SheetScrollView.mjs.map +1 -1
- package/dist/jsx/SheetScrollView.native.js +160 -35
- package/dist/jsx/SheetScrollView.native.js.map +1 -1
- package/dist/jsx/createSheet.mjs +9 -6
- package/dist/jsx/createSheet.mjs.map +1 -1
- package/dist/jsx/createSheet.native.js +7 -3
- package/dist/jsx/createSheet.native.js.map +1 -1
- package/dist/jsx/gestureState.mjs +13 -2
- package/dist/jsx/gestureState.mjs.map +1 -1
- package/dist/jsx/gestureState.native.js +14 -2
- package/dist/jsx/gestureState.native.js.map +1 -1
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +11 -0
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/keyboardAvoidance.mjs +66 -0
- package/dist/jsx/keyboardAvoidance.mjs.map +1 -0
- package/dist/jsx/keyboardAvoidance.native.js +99 -0
- package/dist/jsx/keyboardAvoidance.native.js.map +1 -0
- package/dist/jsx/nativeSheet.mjs +3 -0
- package/dist/jsx/nativeSheet.mjs.map +1 -1
- package/dist/jsx/nativeSheet.native.js +3 -0
- package/dist/jsx/nativeSheet.native.js.map +1 -1
- package/dist/jsx/setupGestureHandler.mjs +9 -6
- package/dist/jsx/setupGestureHandler.mjs.map +1 -1
- package/dist/jsx/setupGestureHandler.native.js +11 -6
- package/dist/jsx/setupGestureHandler.native.js.map +1 -1
- package/dist/jsx/useGestureHandlerPan.mjs +87 -19
- package/dist/jsx/useGestureHandlerPan.mjs.map +1 -1
- package/dist/jsx/useGestureHandlerPan.native.js +91 -18
- package/dist/jsx/useGestureHandlerPan.native.js.map +1 -1
- package/dist/jsx/useKeyboardControllerSheet.mjs +69 -7
- package/dist/jsx/useKeyboardControllerSheet.mjs.map +1 -1
- package/dist/jsx/useSafeAreaInsets.mjs +7 -0
- package/dist/jsx/useSafeAreaInsets.mjs.map +1 -0
- package/dist/jsx/useSafeAreaInsets.native.js +48 -0
- package/dist/jsx/useSafeAreaInsets.native.js.map +1 -0
- package/dist/jsx/useSheetProviderProps.mjs +1 -1
- package/dist/jsx/useSheetProviderProps.mjs.map +1 -1
- package/dist/jsx/useSheetProviderProps.native.js +1 -1
- package/dist/jsx/useSheetProviderProps.native.js.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.mjs +30 -5
- package/dist/jsx/useSheetScrollViewGestures.mjs.map +1 -1
- package/dist/jsx/useSheetScrollViewGestures.native.js +4 -0
- package/dist/jsx/useSheetScrollViewGestures.native.js.map +1 -1
- package/dist/jsx/webViewport.mjs +43 -0
- package/dist/jsx/webViewport.mjs.map +1 -0
- package/dist/jsx/webViewport.native.js +81 -0
- package/dist/jsx/webViewport.native.js.map +1 -0
- package/next.md +78 -0
- package/package.json +30 -48
- package/setup-gesture-handler/index.cjs +2 -0
- package/setup-gesture-handler/index.js +2 -0
- package/setup-gesture-handler/index.native.cjs +2 -0
- package/setup-gesture-handler/index.native.js +2 -0
- package/src/GestureDetectorWrapper.tsx +0 -3
- package/src/SheetImplementationCustom.tsx +387 -127
- package/src/SheetScrollView.tsx +195 -22
- package/src/createSheet.tsx +20 -7
- package/src/gestureState.ts +22 -2
- package/src/index.ts +4 -0
- package/src/keyboardAvoidance.ts +121 -0
- package/src/nativeSheet.tsx +8 -1
- package/src/setupGestureHandler.ts +14 -5
- package/src/types.tsx +20 -1
- package/src/useGestureHandlerPan.tsx +94 -35
- package/src/useKeyboardControllerSheet.ts +127 -10
- package/src/useSafeAreaInsets.native.ts +29 -0
- package/src/useSafeAreaInsets.ts +19 -0
- package/src/useSheetProviderProps.tsx +12 -1
- package/src/useSheetScrollViewGestures.native.ts +4 -0
- package/src/useSheetScrollViewGestures.ts +52 -5
- package/src/webViewport.ts +100 -0
- package/test/keyboardAvoidance.test.ts +269 -0
- package/tsconfig.json +57 -0
- package/types/GestureDetectorWrapper.d.ts +1 -1
- package/types/GestureDetectorWrapper.d.ts.map +1 -1
- package/types/GestureSheetContext.d.ts +1 -1
- package/types/GestureSheetContext.d.ts.map +1 -1
- package/types/Sheet.d.ts +6 -5
- package/types/Sheet.d.ts.map +1 -1
- package/types/SheetContext.d.ts +5 -2
- package/types/SheetContext.d.ts.map +1 -1
- package/types/SheetController.d.ts +1 -2
- package/types/SheetController.d.ts.map +1 -1
- package/types/SheetImplementationCustom.d.ts +1 -0
- package/types/SheetImplementationCustom.d.ts.map +1 -1
- package/types/SheetScrollView.d.ts.map +1 -1
- package/types/createSheet.d.ts +13 -12
- package/types/createSheet.d.ts.map +1 -1
- package/types/gestureState.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/keyboardAvoidance.d.ts +26 -0
- package/types/keyboardAvoidance.d.ts.map +1 -0
- package/types/nativeSheet.d.ts.map +1 -1
- package/types/setupGestureHandler.d.ts.map +1 -1
- package/types/types.d.ts +10 -1
- package/types/types.d.ts.map +1 -1
- package/types/useGestureHandlerPan.d.ts +4 -1
- package/types/useGestureHandlerPan.d.ts.map +1 -1
- package/types/useKeyboardControllerSheet.d.ts +14 -3
- package/types/useKeyboardControllerSheet.d.ts.map +1 -1
- package/types/useSafeAreaInsets.d.ts +10 -0
- package/types/useSafeAreaInsets.d.ts.map +1 -0
- package/types/useSafeAreaInsets.native.d.ts +20 -0
- package/types/useSafeAreaInsets.native.d.ts.map +1 -0
- package/types/useSheetProviderProps.d.ts +3 -0
- package/types/useSheetProviderProps.d.ts.map +1 -1
- package/types/useSheetScrollViewGestures.d.ts +2 -1
- package/types/useSheetScrollViewGestures.d.ts.map +1 -1
- package/types/useSheetScrollViewGestures.native.d.ts.map +1 -1
- package/types/webViewport.d.ts +36 -0
- package/types/webViewport.d.ts.map +1 -0
- package/LICENSE +0 -42
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web (mobile-browser) viewport helpers for the Sheet's keyboard handling.
|
|
3
|
+
*
|
|
4
|
+
* On real iOS Safari (verified on-device, iOS 26) the soft keyboard shrinks
|
|
5
|
+
* BOTH `window.visualViewport.height` AND `window.innerHeight` — neither is the
|
|
6
|
+
* stable layout viewport. Measured during a keyboard open: visualViewport
|
|
7
|
+
* 714 -> 404, innerHeight 714 -> 561 (it wobbles), but
|
|
8
|
+
* `document.documentElement.clientHeight` holds rock-steady at 714 the whole
|
|
9
|
+
* time (open, mid-keyboard, and close). So clientHeight IS the stable layout
|
|
10
|
+
* viewport, and we derive everything from it:
|
|
11
|
+
* - keyboard resize height = clientHeight - visualViewport.height (stays
|
|
12
|
+
* correct even as innerHeight drifts), so keyboard detection is stable.
|
|
13
|
+
* - keyboard bottom inset = clientHeight - (visualViewport.offsetTop +
|
|
14
|
+
* visualViewport.height), so Safari's focus pan doesn't over-lift the sheet.
|
|
15
|
+
* - the sheet's fit-mode position math reads clientHeight, so it never
|
|
16
|
+
* re-measures against a shrunk value; the frame can translate with the
|
|
17
|
+
* keyboard while keeping its natural fit height.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// ignore small viewport changes (URL bar collapse, accessory bars) so they
|
|
21
|
+
// don't read as a full keyboard. a real soft keyboard is well above this.
|
|
22
|
+
export const MIN_KEYBOARD_HEIGHT = 80
|
|
23
|
+
|
|
24
|
+
export function isEditableElement(el: Element | null): boolean {
|
|
25
|
+
if (!el) return false
|
|
26
|
+
const tag = el.tagName
|
|
27
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return true
|
|
28
|
+
if ((el as HTMLElement).isContentEditable) return true
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The stable layout-viewport height. document.documentElement.clientHeight is
|
|
34
|
+
* unaffected by the soft keyboard on iOS Safari (unlike innerHeight /
|
|
35
|
+
* visualViewport), so it stays constant while the keyboard animates in/out.
|
|
36
|
+
*/
|
|
37
|
+
export function getStableLayoutViewportHeight(): number {
|
|
38
|
+
if (typeof window === 'undefined') return 0
|
|
39
|
+
const ch = typeof document !== 'undefined' ? document.documentElement?.clientHeight : 0
|
|
40
|
+
if (ch && ch > 0) return ch
|
|
41
|
+
// fallback when clientHeight is unavailable (SSR / detached): best effort
|
|
42
|
+
return Math.max(window.innerHeight || 0, window.visualViewport?.height || 0)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* the largest the visible viewport can ever become on this device.
|
|
47
|
+
*
|
|
48
|
+
* iOS Safari grows the visible area as its top/bottom chrome (URL bar, toolbar,
|
|
49
|
+
* the dynamic bottom safe area) retracts on scroll, so the current layout
|
|
50
|
+
* viewport — document.documentElement.clientHeight — is not an upper bound: the
|
|
51
|
+
* chrome can collapse and reveal area BELOW it. A sheet whose hidden/below-fold
|
|
52
|
+
* region is sized against the current viewport then peeks back into view as the
|
|
53
|
+
* page scrolls and Safari reveals more.
|
|
54
|
+
*
|
|
55
|
+
* So we track a session high-water mark across every measured viewport signal,
|
|
56
|
+
* floored at the device screen height, so we never under-shoot even before any
|
|
57
|
+
* chrome collapse has been observed. Used to push hidden/minimized sheet content
|
|
58
|
+
* fully past the maximum the viewport could ever expose.
|
|
59
|
+
*/
|
|
60
|
+
let _maxViewportHeight = 0
|
|
61
|
+
export function getMaxViewportHeight(): number {
|
|
62
|
+
if (typeof window === 'undefined') return 0
|
|
63
|
+
const ch = typeof document !== 'undefined' ? document.documentElement?.clientHeight : 0
|
|
64
|
+
_maxViewportHeight = Math.max(
|
|
65
|
+
_maxViewportHeight,
|
|
66
|
+
ch || 0,
|
|
67
|
+
window.innerHeight || 0,
|
|
68
|
+
window.visualViewport?.height || 0,
|
|
69
|
+
window.screen?.height || 0
|
|
70
|
+
)
|
|
71
|
+
return _maxViewportHeight
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getWebKeyboardResizeHeight(): number {
|
|
75
|
+
if (typeof window === 'undefined') return 0
|
|
76
|
+
const vv = window.visualViewport
|
|
77
|
+
if (!vv) return 0
|
|
78
|
+
return Math.max(0, Math.round(getStableLayoutViewportHeight() - vv.height))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function getWebVisualViewportOffsetTop(): number {
|
|
82
|
+
if (typeof window === 'undefined') return 0
|
|
83
|
+
return Math.max(0, Math.round(window.visualViewport?.offsetTop || 0))
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* bottom layout inset hidden below the visual viewport. When Safari pans the
|
|
88
|
+
* visual viewport during focus, offsetTop reduces the bottom-hidden area.
|
|
89
|
+
*/
|
|
90
|
+
export function getWebKeyboardBottomInset(): number {
|
|
91
|
+
if (typeof window === 'undefined') return 0
|
|
92
|
+
const vv = window.visualViewport
|
|
93
|
+
if (!vv) return 0
|
|
94
|
+
const visibleBottom = getWebVisualViewportOffsetTop() + vv.height
|
|
95
|
+
return Math.max(0, Math.round(getStableLayoutViewportHeight() - visibleBottom))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function getWebKeyboardHeight(): number {
|
|
99
|
+
return getWebKeyboardResizeHeight()
|
|
100
|
+
}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { afterEach, describe, expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getKeyboardAdjustedSheetY,
|
|
5
|
+
getKeyboardOccludedHeight,
|
|
6
|
+
getSheetReleasePosition,
|
|
7
|
+
} from '../src/keyboardAvoidance'
|
|
8
|
+
import {
|
|
9
|
+
getWebKeyboardBottomInset,
|
|
10
|
+
getWebKeyboardResizeHeight,
|
|
11
|
+
getWebVisualViewportOffsetTop,
|
|
12
|
+
} from '../src/webViewport'
|
|
13
|
+
|
|
14
|
+
const originalWindow = globalThis.window
|
|
15
|
+
const originalDocument = globalThis.document
|
|
16
|
+
|
|
17
|
+
function setWebViewport({
|
|
18
|
+
clientHeight,
|
|
19
|
+
visualViewportHeight,
|
|
20
|
+
offsetTop = 0,
|
|
21
|
+
}: {
|
|
22
|
+
clientHeight: number
|
|
23
|
+
visualViewportHeight: number
|
|
24
|
+
offsetTop?: number
|
|
25
|
+
}) {
|
|
26
|
+
Object.defineProperty(globalThis, 'document', {
|
|
27
|
+
configurable: true,
|
|
28
|
+
value: {
|
|
29
|
+
documentElement: {
|
|
30
|
+
clientHeight,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
Object.defineProperty(globalThis, 'window', {
|
|
35
|
+
configurable: true,
|
|
36
|
+
value: {
|
|
37
|
+
innerHeight: clientHeight,
|
|
38
|
+
visualViewport: {
|
|
39
|
+
height: visualViewportHeight,
|
|
40
|
+
offsetTop,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
Object.defineProperty(globalThis, 'window', {
|
|
48
|
+
configurable: true,
|
|
49
|
+
value: originalWindow,
|
|
50
|
+
})
|
|
51
|
+
Object.defineProperty(globalThis, 'document', {
|
|
52
|
+
configurable: true,
|
|
53
|
+
value: originalDocument,
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
describe('getKeyboardAdjustedSheetY', () => {
|
|
58
|
+
const base = {
|
|
59
|
+
sheetY: 320,
|
|
60
|
+
screenSize: 844,
|
|
61
|
+
isKeyboardVisible: true,
|
|
62
|
+
keyboardHeight: 300,
|
|
63
|
+
safeAreaTop: 44,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
test('keeps the original position when translation is disabled', () => {
|
|
67
|
+
expect(
|
|
68
|
+
getKeyboardAdjustedSheetY({
|
|
69
|
+
...base,
|
|
70
|
+
shouldTranslate: false,
|
|
71
|
+
})
|
|
72
|
+
).toBe(base.sheetY)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test('shifts sheets up by keyboard height and caps at safe area', () => {
|
|
76
|
+
expect(
|
|
77
|
+
getKeyboardAdjustedSheetY({
|
|
78
|
+
...base,
|
|
79
|
+
shouldTranslate: true,
|
|
80
|
+
})
|
|
81
|
+
).toBe(44)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('keeps a smaller fit sheet at its natural height and moves it with the keyboard', () => {
|
|
85
|
+
expect(
|
|
86
|
+
getKeyboardAdjustedSheetY({
|
|
87
|
+
...base,
|
|
88
|
+
sheetY: 500,
|
|
89
|
+
shouldTranslate: true,
|
|
90
|
+
})
|
|
91
|
+
).toBe(200)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
test('does not shift hidden keyboard or offscreen close positions', () => {
|
|
95
|
+
expect(
|
|
96
|
+
getKeyboardAdjustedSheetY({
|
|
97
|
+
...base,
|
|
98
|
+
isKeyboardVisible: false,
|
|
99
|
+
shouldTranslate: true,
|
|
100
|
+
})
|
|
101
|
+
).toBe(base.sheetY)
|
|
102
|
+
expect(
|
|
103
|
+
getKeyboardAdjustedSheetY({
|
|
104
|
+
...base,
|
|
105
|
+
sheetY: base.screenSize,
|
|
106
|
+
shouldTranslate: true,
|
|
107
|
+
})
|
|
108
|
+
).toBe(base.screenSize)
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
describe('getKeyboardOccludedHeight', () => {
|
|
113
|
+
const base = {
|
|
114
|
+
frameSize: 700,
|
|
115
|
+
isKeyboardVisible: true,
|
|
116
|
+
keyboardHeight: 300,
|
|
117
|
+
screenSize: 844,
|
|
118
|
+
sheetY: 59,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
test('returns overflow below the keyboard top after the sheet is clamped', () => {
|
|
122
|
+
expect(getKeyboardOccludedHeight(base)).toBe(215)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('returns zero when the keyboard-adjusted sheet clears the keyboard', () => {
|
|
126
|
+
expect(
|
|
127
|
+
getKeyboardOccludedHeight({
|
|
128
|
+
...base,
|
|
129
|
+
frameSize: 400,
|
|
130
|
+
sheetY: 144,
|
|
131
|
+
})
|
|
132
|
+
).toBe(0)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
test('ignores hidden keyboard and offscreen sheet positions', () => {
|
|
136
|
+
expect(
|
|
137
|
+
getKeyboardOccludedHeight({
|
|
138
|
+
...base,
|
|
139
|
+
isKeyboardVisible: false,
|
|
140
|
+
})
|
|
141
|
+
).toBe(0)
|
|
142
|
+
expect(
|
|
143
|
+
getKeyboardOccludedHeight({
|
|
144
|
+
...base,
|
|
145
|
+
sheetY: base.screenSize,
|
|
146
|
+
})
|
|
147
|
+
).toBe(0)
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
test('clamps occlusion to the frame height', () => {
|
|
151
|
+
expect(
|
|
152
|
+
getKeyboardOccludedHeight({
|
|
153
|
+
...base,
|
|
154
|
+
frameSize: 120,
|
|
155
|
+
keyboardHeight: 1000,
|
|
156
|
+
sheetY: 0,
|
|
157
|
+
})
|
|
158
|
+
).toBe(120)
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
describe('getSheetReleasePosition', () => {
|
|
163
|
+
// WEB keyboard-fit-dismiss threshold (the 75de9c9694 web keyboard-handoff fix):
|
|
164
|
+
// when the keyboard is up, a fit+dismiss sheet only dismisses after enough
|
|
165
|
+
// ACTUAL travel, ignoring a velocity-projected short drag.
|
|
166
|
+
test('web: keeps a keyboard-fit sheet open when velocity projects a short drag to dismiss', () => {
|
|
167
|
+
expect(
|
|
168
|
+
getSheetReleasePosition({
|
|
169
|
+
positions: [0, 844],
|
|
170
|
+
projectedEnd: 480,
|
|
171
|
+
currentPosition: 150,
|
|
172
|
+
frameSize: 591,
|
|
173
|
+
dismissOnSnapToBottom: true,
|
|
174
|
+
snapPointsMode: 'fit',
|
|
175
|
+
isKeyboardVisible: true,
|
|
176
|
+
isWeb: true,
|
|
177
|
+
})
|
|
178
|
+
).toBe(0)
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
test('web: allows a keyboard-fit sheet to dismiss after enough actual travel', () => {
|
|
182
|
+
expect(
|
|
183
|
+
getSheetReleasePosition({
|
|
184
|
+
positions: [0, 844],
|
|
185
|
+
projectedEnd: 560,
|
|
186
|
+
currentPosition: 225,
|
|
187
|
+
frameSize: 591,
|
|
188
|
+
dismissOnSnapToBottom: true,
|
|
189
|
+
snapPointsMode: 'fit',
|
|
190
|
+
isKeyboardVisible: true,
|
|
191
|
+
isWeb: true,
|
|
192
|
+
})
|
|
193
|
+
).toBe(1)
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
// NATIVE must NOT apply the web threshold — it snaps purely by projected
|
|
197
|
+
// position (the pre-rework v2.1.0 behavior). regression guard: with the
|
|
198
|
+
// threshold leaking into native, this short-projected drag wrongly stayed open
|
|
199
|
+
// (0); native should snap to the nearest point (here: dismiss, index 1).
|
|
200
|
+
test('native: snaps a keyboard-fit sheet by projected position, ignoring the web threshold', () => {
|
|
201
|
+
expect(
|
|
202
|
+
getSheetReleasePosition({
|
|
203
|
+
positions: [0, 844],
|
|
204
|
+
projectedEnd: 480,
|
|
205
|
+
currentPosition: 150,
|
|
206
|
+
frameSize: 591,
|
|
207
|
+
dismissOnSnapToBottom: true,
|
|
208
|
+
snapPointsMode: 'fit',
|
|
209
|
+
isKeyboardVisible: true,
|
|
210
|
+
isWeb: false,
|
|
211
|
+
})
|
|
212
|
+
).toBe(1)
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
test('native: a projected-open drag snaps back open', () => {
|
|
216
|
+
expect(
|
|
217
|
+
getSheetReleasePosition({
|
|
218
|
+
positions: [0, 844],
|
|
219
|
+
projectedEnd: 200,
|
|
220
|
+
currentPosition: 300,
|
|
221
|
+
frameSize: 591,
|
|
222
|
+
dismissOnSnapToBottom: true,
|
|
223
|
+
snapPointsMode: 'fit',
|
|
224
|
+
isKeyboardVisible: true,
|
|
225
|
+
isWeb: false,
|
|
226
|
+
})
|
|
227
|
+
).toBe(0)
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
test('keeps normal multi-snap release behavior outside keyboard-fit dismiss', () => {
|
|
231
|
+
expect(
|
|
232
|
+
getSheetReleasePosition({
|
|
233
|
+
positions: [0, 360, 844],
|
|
234
|
+
projectedEnd: 310,
|
|
235
|
+
currentPosition: 90,
|
|
236
|
+
frameSize: 591,
|
|
237
|
+
dismissOnSnapToBottom: true,
|
|
238
|
+
snapPointsMode: 'percent',
|
|
239
|
+
isKeyboardVisible: true,
|
|
240
|
+
isWeb: true,
|
|
241
|
+
})
|
|
242
|
+
).toBe(1)
|
|
243
|
+
})
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
describe('web viewport keyboard metrics', () => {
|
|
247
|
+
test('separates keyboard resize height from bottom inset when Safari pans the visual viewport', () => {
|
|
248
|
+
setWebViewport({
|
|
249
|
+
clientHeight: 678,
|
|
250
|
+
visualViewportHeight: 452,
|
|
251
|
+
offsetTop: 158,
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
expect(getWebKeyboardResizeHeight()).toBe(226)
|
|
255
|
+
expect(getWebVisualViewportOffsetTop()).toBe(158)
|
|
256
|
+
expect(getWebKeyboardBottomInset()).toBe(68)
|
|
257
|
+
})
|
|
258
|
+
|
|
259
|
+
test('matches resize height and bottom inset when the visual viewport is not panned', () => {
|
|
260
|
+
setWebViewport({
|
|
261
|
+
clientHeight: 678,
|
|
262
|
+
visualViewportHeight: 452,
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
expect(getWebKeyboardResizeHeight()).toBe(226)
|
|
266
|
+
expect(getWebVisualViewportOffsetTop()).toBe(0)
|
|
267
|
+
expect(getWebKeyboardBottomInset()).toBe(226)
|
|
268
|
+
})
|
|
269
|
+
})
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"composite": true,
|
|
5
|
+
"strict": true
|
|
6
|
+
},
|
|
7
|
+
"references": [
|
|
8
|
+
{
|
|
9
|
+
"path": "../../core/animations-react-native"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"path": "../../core/compose-refs"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"path": "../../core/constants"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "../../core/core"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"path": "../../core/create-context"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../core/helpers"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../core/use-constant"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../core/use-controllable-state"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../core/use-keyboard-visible"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../animate-presence"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../portal"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../remove-scroll"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../scroll-view"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../stacks"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"exclude": [
|
|
52
|
+
"types",
|
|
53
|
+
"dist",
|
|
54
|
+
"test",
|
|
55
|
+
"**/__tests__"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
@@ -9,6 +9,6 @@ interface GestureDetectorWrapperProps {
|
|
|
9
9
|
* Conditionally wraps children with GestureDetector when RNGH is available.
|
|
10
10
|
* Uses a plain View wrapper that GestureDetector can attach gesture handlers to.
|
|
11
11
|
*/
|
|
12
|
-
export declare function GestureDetectorWrapper({ gesture, children, style, }: GestureDetectorWrapperProps):
|
|
12
|
+
export declare function GestureDetectorWrapper({ gesture, children, style, }: GestureDetectorWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=GestureDetectorWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureDetectorWrapper.d.ts","sourceRoot":"","sources":["../src/GestureDetectorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAGnD,UAAU,2BAA2B;IACnC,OAAO,EAAE,GAAG,CAAA;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,QAAQ,EACR,KAAK,GACN,EAAE,2BAA2B,
|
|
1
|
+
{"version":3,"file":"GestureDetectorWrapper.d.ts","sourceRoot":"","sources":["../src/GestureDetectorWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAGnD,UAAU,2BAA2B;IACnC,OAAO,EAAE,GAAG,CAAA;IACZ,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,QAAQ,EACR,KAAK,GACN,EAAE,2BAA2B,2CAmB7B"}
|
|
@@ -32,5 +32,5 @@ export interface GestureSheetProviderProps {
|
|
|
32
32
|
panGesture: any | null;
|
|
33
33
|
panGestureRef: RefObject<any> | null;
|
|
34
34
|
}
|
|
35
|
-
export declare function GestureSheetProvider({ children, isDragging, blockPan, setBlockPan, panGesture, panGestureRef, }: GestureSheetProviderProps):
|
|
35
|
+
export declare function GestureSheetProvider({ children, isDragging, blockPan, setBlockPan, panGesture, panGestureRef, }: GestureSheetProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
36
36
|
//# sourceMappingURL=GestureSheetContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureSheetContext.d.ts","sourceRoot":"","sources":["../src/GestureSheetContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjE,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,UAAU,EAAE,GAAG,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IACpC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACvC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB;AAID,wBAAgB,sBAAsB,IAAI,wBAAwB,GAAG,IAAI,CAExE;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACvC,UAAU,EAAE,GAAG,GAAG,IAAI,CAAA;IACtB,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACrC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,GACd,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"GestureSheetContext.d.ts","sourceRoot":"","sources":["../src/GestureSheetContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjE,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,UAAU,EAAE,GAAG,GAAG,IAAI,CAAA;IACtB;;OAEG;IACH,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IACpC;;OAEG;IACH,UAAU,EAAE,OAAO,CAAA;IACnB;;OAEG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACvC;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB;AAID,wBAAgB,sBAAsB,IAAI,wBAAwB,GAAG,IAAI,CAExE;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IACvC,UAAU,EAAE,GAAG,GAAG,IAAI,CAAA;IACtB,aAAa,EAAE,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;CACrC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,WAAW,EACX,UAAU,EACV,aAAa,GACd,EAAE,yBAAyB,2CAY3B"}
|
package/types/Sheet.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export { createSheetScope } from './SheetContext';
|
|
2
2
|
export * from './types';
|
|
3
|
-
export declare const Handle: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiElement, import("@hanzogui/core").
|
|
3
|
+
export declare const Handle: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
4
4
|
open?: boolean | undefined;
|
|
5
5
|
unstyled?: boolean | undefined;
|
|
6
6
|
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
7
7
|
fullscreen?: boolean | undefined;
|
|
8
8
|
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
9
|
-
export declare const Overlay: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiElement, import("@hanzogui/core").
|
|
9
|
+
export declare const Overlay: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
10
10
|
open?: boolean | undefined;
|
|
11
11
|
unstyled?: boolean | undefined;
|
|
12
12
|
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
13
13
|
fullscreen?: boolean | undefined;
|
|
14
14
|
}, import("@hanzogui/core").StaticConfigPublic>;
|
|
15
|
-
export declare const Frame: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiElement, import("@hanzogui/core").
|
|
15
|
+
export declare const Frame: import("@hanzogui/core").GuiComponent<import("@hanzogui/core").TamaDefer, import("@hanzogui/core").GuiElement, import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
16
16
|
unstyled?: boolean | undefined;
|
|
17
17
|
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
18
18
|
fullscreen?: boolean | undefined;
|
|
@@ -34,6 +34,7 @@ export declare const Sheet: import("react").ForwardRefExoticComponent<{
|
|
|
34
34
|
transitionConfig?: import("@hanzogui/core").AnimatedNumberStrategy;
|
|
35
35
|
preferAdaptParentOpenState?: boolean;
|
|
36
36
|
unmountChildrenWhenHidden?: boolean;
|
|
37
|
+
disableTransparencyHide?: boolean;
|
|
37
38
|
native?: "ios"[] | boolean;
|
|
38
39
|
transition?: import("@hanzogui/core").TransitionProp;
|
|
39
40
|
handleDisableScroll?: boolean;
|
|
@@ -50,7 +51,7 @@ export declare const Sheet: import("react").ForwardRefExoticComponent<{
|
|
|
50
51
|
__scopeSheet?: import("@hanzogui/create-context").Scope<any>;
|
|
51
52
|
} & import("react").RefAttributes<import("react-native").View>> & {
|
|
52
53
|
Controlled: import("react").FunctionComponent<Omit<import("./types").SheetProps, "open" | "onOpenChange"> & import("react").RefAttributes<import("react-native").View>> & {
|
|
53
|
-
Frame: import("react").ForwardRefExoticComponent<import("./types").SheetScopedProps<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").
|
|
54
|
+
Frame: import("react").ForwardRefExoticComponent<import("./types").SheetScopedProps<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
54
55
|
unstyled?: boolean | undefined;
|
|
55
56
|
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
56
57
|
fullscreen?: boolean | undefined;
|
|
@@ -115,7 +116,7 @@ export declare const Sheet: import("react").ForwardRefExoticComponent<{
|
|
|
115
116
|
fullscreen?: boolean | undefined;
|
|
116
117
|
}>> & import("react").RefAttributes<import("react-native").ScrollView>>;
|
|
117
118
|
};
|
|
118
|
-
Frame: import("react").ForwardRefExoticComponent<import("./types").SheetScopedProps<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").
|
|
119
|
+
Frame: import("react").ForwardRefExoticComponent<import("./types").SheetScopedProps<Omit<import("@hanzogui/core").GetFinalProps<import("@hanzogui/core").RNGuiViewNonStyleProps, import("@hanzogui/core").StackStyleBase, {
|
|
119
120
|
unstyled?: boolean | undefined;
|
|
120
121
|
elevation?: number | import("@hanzogui/core").SizeTokens | undefined;
|
|
121
122
|
fullscreen?: boolean | undefined;
|
package/types/Sheet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../src/Sheet.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,cAAc,SAAS,CAAA;AAMvB,eAAO,MAAM,MAAM;;;;;+CAmCjB,CAAA;AAMF,eAAO,MAAM,OAAO;;;;;+CA2BlB,CAAA;AAMF,eAAO,MAAM,KAAK;;;;+CAoBhB,CAAA;AAEF,eAAO,MAAM,KAAK
|
|
1
|
+
{"version":3,"file":"Sheet.d.ts","sourceRoot":"","sources":["../src/Sheet.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,cAAc,SAAS,CAAA;AAMvB,eAAO,MAAM,MAAM;;;;;+CAmCjB,CAAA;AAMF,eAAO,MAAM,OAAO;;;;;+CA2BlB,CAAA;AAMF,eAAO,MAAM,KAAK;;;;+CAoBhB,CAAA;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIhB,CAAA"}
|
package/types/SheetContext.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { SheetContextValue } from './useSheetProviderProps';
|
|
|
2
2
|
export declare const createSheetContext: <ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType) => readonly [(props: ContextValueType & {
|
|
3
3
|
scope: import("@hanzogui/create-context").Scope<ContextValueType>;
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
}) => import("react").JSX.Element, (consumerName: string, scope: import("@hanzogui/create-context").Scope<ContextValueType | undefined>, options?: {
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element, (consumerName: string, scope: import("@hanzogui/create-context").Scope<ContextValueType | undefined>, options?: {
|
|
6
6
|
warn?: boolean;
|
|
7
7
|
fallback?: Partial<ContextValueType>;
|
|
8
8
|
}) => ContextValueType], createSheetScope: import("@hanzogui/create-context").CreateScope;
|
|
@@ -32,11 +32,14 @@ export declare const SheetProvider: (props: {
|
|
|
32
32
|
setPositionImmediate: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
33
33
|
onlyShowFrame: boolean;
|
|
34
34
|
} & {
|
|
35
|
+
keyboardOccludedHeight: number;
|
|
36
|
+
isKeyboardVisible: boolean;
|
|
37
|
+
keyboardStableFrameHeight: number;
|
|
35
38
|
setHasScrollView: (val: boolean) => void;
|
|
36
39
|
} & {
|
|
37
40
|
scope: import("@hanzogui/create-context").Scope<SheetContextValue>;
|
|
38
41
|
children: React.ReactNode;
|
|
39
|
-
}) => import("react").JSX.Element, useSheetContext: (consumerName: string, scope: import("@hanzogui/create-context").Scope<SheetContextValue | undefined>, options?: {
|
|
42
|
+
}) => import("react/jsx-runtime").JSX.Element, useSheetContext: (consumerName: string, scope: import("@hanzogui/create-context").Scope<SheetContextValue | undefined>, options?: {
|
|
40
43
|
warn?: boolean;
|
|
41
44
|
fallback?: Partial<SheetContextValue> | undefined;
|
|
42
45
|
} | undefined) => SheetContextValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetContext.d.ts","sourceRoot":"","sources":["../src/SheetContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAO,kBAAkB;;;
|
|
1
|
+
{"version":3,"file":"SheetContext.d.ts","sourceRoot":"","sources":["../src/SheetContext.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,eAAO,MAAO,kBAAkB;;;4JAM2rB,CAAC;QAAS,CAAC;YAAoB,CAAC;yBANztB,gBAAgB,gDAAkC,CAAA;AAEpF,eAAO,MAAO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAAE,eAAe;;;mCAG3C,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { ReactNode } from 'react';
|
|
3
2
|
import type { SheetControllerContextValue } from './useSheetController';
|
|
4
3
|
export declare const SheetController: ({ children, onOpenChange: onOpenChangeProp, onAnimationComplete: onAnimationCompleteProp, open, hidden, disableDrag, }: Partial<SheetControllerContextValue> & {
|
|
5
4
|
children?: ReactNode;
|
|
6
|
-
}) =>
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
//# sourceMappingURL=SheetController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetController.d.ts","sourceRoot":"","sources":["../src/SheetController.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SheetController.d.ts","sourceRoot":"","sources":["../src/SheetController.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAGvE,eAAO,MAAM,eAAe,GAAI,wHAO7B,OAAO,CAAC,2BAA2B,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,4CAgCjE,CAAA"}
|
|
@@ -18,6 +18,7 @@ export declare const SheetImplementationCustom: React.ForwardRefExoticComponent<
|
|
|
18
18
|
transitionConfig?: import("@hanzogui/core").AnimatedNumberStrategy;
|
|
19
19
|
preferAdaptParentOpenState?: boolean;
|
|
20
20
|
unmountChildrenWhenHidden?: boolean;
|
|
21
|
+
disableTransparencyHide?: boolean;
|
|
21
22
|
native?: "ios"[] | boolean;
|
|
22
23
|
transition?: import("@hanzogui/core").TransitionProp;
|
|
23
24
|
handleDisableScroll?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetImplementationCustom.d.ts","sourceRoot":"","sources":["../src/SheetImplementationCustom.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SheetImplementationCustom.d.ts","sourceRoot":"","sources":["../src/SheetImplementationCustom.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAOvC,OAAO,EAA4B,IAAI,EAAE,MAAM,cAAc,CAAA;AAmB7D,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,SAAS,CAAA;AAmCzD,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAy/BrC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SheetScrollView.d.ts","sourceRoot":"","sources":["../src/SheetScrollView.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"SheetScrollView.d.ts","sourceRoot":"","sources":["../src/SheetScrollView.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,cAAc,CAAA;AAgB9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAyV3B,CAAA"}
|
package/types/createSheet.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare function createSheet<H extends GuiComponent | SheetStyledComponen
|
|
|
28
28
|
transitionConfig?: import("@hanzogui/core").AnimatedNumberStrategy;
|
|
29
29
|
preferAdaptParentOpenState?: boolean;
|
|
30
30
|
unmountChildrenWhenHidden?: boolean;
|
|
31
|
+
disableTransparencyHide?: boolean;
|
|
31
32
|
native?: "ios"[] | boolean;
|
|
32
33
|
transition?: import("@hanzogui/core").TransitionProp;
|
|
33
34
|
handleDisableScroll?: boolean;
|
|
@@ -46,9 +47,9 @@ export declare function createSheet<H extends GuiComponent | SheetStyledComponen
|
|
|
46
47
|
Controlled: FunctionComponent<Omit<SheetProps, "open" | "onOpenChange"> & RefAttributes<RNView>> & {
|
|
47
48
|
Frame: ForwardRefExoticComponent<SheetScopedProps<Omit<GetProps<F>, keyof {
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* by default the sheet adds a view below its bottom that extends past the
|
|
51
|
+
* largest visible viewport height. this covers spring overshoot when opening
|
|
52
|
+
* so page content never shows through below the sheet.
|
|
52
53
|
*/
|
|
53
54
|
disableHideBottomOverflow?: boolean;
|
|
54
55
|
/**
|
|
@@ -59,9 +60,9 @@ export declare function createSheet<H extends GuiComponent | SheetStyledComponen
|
|
|
59
60
|
adjustPaddingForOffscreenContent?: boolean;
|
|
60
61
|
}> & {
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* by default the sheet adds a view below its bottom that extends past the
|
|
64
|
+
* largest visible viewport height. this covers spring overshoot when opening
|
|
65
|
+
* so page content never shows through below the sheet.
|
|
65
66
|
*/
|
|
66
67
|
disableHideBottomOverflow?: boolean;
|
|
67
68
|
/**
|
|
@@ -119,9 +120,9 @@ export declare function createSheet<H extends GuiComponent | SheetStyledComponen
|
|
|
119
120
|
};
|
|
120
121
|
Frame: ForwardRefExoticComponent<SheetScopedProps<Omit<GetProps<F>, keyof {
|
|
121
122
|
/**
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
123
|
+
* by default the sheet adds a view below its bottom that extends past the
|
|
124
|
+
* largest visible viewport height. this covers spring overshoot when opening
|
|
125
|
+
* so page content never shows through below the sheet.
|
|
125
126
|
*/
|
|
126
127
|
disableHideBottomOverflow?: boolean;
|
|
127
128
|
/**
|
|
@@ -132,9 +133,9 @@ export declare function createSheet<H extends GuiComponent | SheetStyledComponen
|
|
|
132
133
|
adjustPaddingForOffscreenContent?: boolean;
|
|
133
134
|
}> & {
|
|
134
135
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
136
|
+
* by default the sheet adds a view below its bottom that extends past the
|
|
137
|
+
* largest visible viewport height. this covers spring overshoot when opening
|
|
138
|
+
* so page content never shows through below the sheet.
|
|
138
139
|
*/
|
|
139
140
|
disableHideBottomOverflow?: boolean;
|
|
140
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSheet.d.ts","sourceRoot":"","sources":["../src/createSheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,6BAA6B,EAE9B,MAAM,gBAAgB,CAAA;AAOvB,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAExF,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAOlD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"createSheet.d.ts","sourceRoot":"","sources":["../src/createSheet.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,6BAA6B,EAE9B,MAAM,gBAAgB,CAAA;AAOvB,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAExF,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,cAAc,CAAA;AAOlD,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAK3D,KAAK,gBAAgB,GAAG;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,SAAS,GAAG,SAAS,GAAG,gBAAgB,CAAA;AAE7C,KAAK,oBAAoB,GAAG,6BAA6B,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;AAEtF,wBAAgB,WAAW,CACzB,CAAC,SAAS,YAAY,GAAG,oBAAoB,EAC7C,CAAC,SAAS,YAAY,GAAG,oBAAoB,EAC7C,CAAC,SAAS,YAAY,GAAG,oBAAoB,EAC7C,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAkG7D;;;;eAIG;wCACyB,OAAO;YAEnC;;;;eAIG;+CACgC,OAAO;;YAZ1C;;;;eAIG;wCACyB,OAAO;YAEnC;;;;eAIG;+CACgC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAZ1C;;;;WAIG;oCACyB,OAAO;QAEnC;;;;WAIG;2CACgC,OAAO;;QAZ1C;;;;WAIG;oCACyB,OAAO;QAEnC;;;;WAIG;2CACgC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2J7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestureState.d.ts","sourceRoot":"","sources":["../src/gestureState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEvE,YAAY,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"gestureState.d.ts","sourceRoot":"","sources":["../src/gestureState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEvE,YAAY,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAa3E,wBAAgB,uBAAuB,IAAI,OAAO,CAEjD;AAED,wBAAgB,sBAAsB,IAAI,YAAY,CAErD;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAY3E;AAGD,eAAO,MAAM,eAAe,+BAAyB,CAAA"}
|