@oxyhq/bloom 0.13.0 → 0.14.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.
Files changed (75) hide show
  1. package/lib/commonjs/index.js +15 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/index.web.js +21 -6
  4. package/lib/commonjs/index.web.js.map +1 -1
  5. package/lib/commonjs/responsive-sheet/ResponsiveSheet.js +300 -0
  6. package/lib/commonjs/responsive-sheet/ResponsiveSheet.js.map +1 -0
  7. package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js +226 -0
  8. package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js.map +1 -0
  9. package/lib/commonjs/responsive-sheet/const.js +60 -0
  10. package/lib/commonjs/responsive-sheet/const.js.map +1 -0
  11. package/lib/commonjs/responsive-sheet/index.js +19 -0
  12. package/lib/commonjs/responsive-sheet/index.js.map +1 -0
  13. package/lib/commonjs/responsive-sheet/index.web.js +19 -0
  14. package/lib/commonjs/responsive-sheet/index.web.js.map +1 -0
  15. package/lib/commonjs/responsive-sheet/types.js +6 -0
  16. package/lib/commonjs/responsive-sheet/types.js.map +1 -0
  17. package/lib/module/index.js +2 -0
  18. package/lib/module/index.js.map +1 -1
  19. package/lib/module/index.web.js +2 -0
  20. package/lib/module/index.web.js.map +1 -1
  21. package/lib/module/responsive-sheet/ResponsiveSheet.js +293 -0
  22. package/lib/module/responsive-sheet/ResponsiveSheet.js.map +1 -0
  23. package/lib/module/responsive-sheet/ResponsiveSheet.native.js +219 -0
  24. package/lib/module/responsive-sheet/ResponsiveSheet.native.js.map +1 -0
  25. package/lib/module/responsive-sheet/const.js +56 -0
  26. package/lib/module/responsive-sheet/const.js.map +1 -0
  27. package/lib/module/responsive-sheet/index.js +4 -0
  28. package/lib/module/responsive-sheet/index.js.map +1 -0
  29. package/lib/module/responsive-sheet/index.web.js +14 -0
  30. package/lib/module/responsive-sheet/index.web.js.map +1 -0
  31. package/lib/module/responsive-sheet/types.js +4 -0
  32. package/lib/module/responsive-sheet/types.js.map +1 -0
  33. package/lib/typescript/commonjs/index.d.ts +2 -0
  34. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/index.web.d.ts +2 -0
  36. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts +26 -0
  38. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts +20 -0
  40. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/responsive-sheet/const.d.ts +43 -0
  42. package/lib/typescript/commonjs/responsive-sheet/const.d.ts.map +1 -0
  43. package/lib/typescript/commonjs/responsive-sheet/index.d.ts +3 -0
  44. package/lib/typescript/commonjs/responsive-sheet/index.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts +3 -0
  46. package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts.map +1 -0
  47. package/lib/typescript/commonjs/responsive-sheet/types.d.ts +55 -0
  48. package/lib/typescript/commonjs/responsive-sheet/types.d.ts.map +1 -0
  49. package/lib/typescript/module/index.d.ts +2 -0
  50. package/lib/typescript/module/index.d.ts.map +1 -1
  51. package/lib/typescript/module/index.web.d.ts +2 -0
  52. package/lib/typescript/module/index.web.d.ts.map +1 -1
  53. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts +26 -0
  54. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts.map +1 -0
  55. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts +20 -0
  56. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts.map +1 -0
  57. package/lib/typescript/module/responsive-sheet/const.d.ts +43 -0
  58. package/lib/typescript/module/responsive-sheet/const.d.ts.map +1 -0
  59. package/lib/typescript/module/responsive-sheet/index.d.ts +3 -0
  60. package/lib/typescript/module/responsive-sheet/index.d.ts.map +1 -0
  61. package/lib/typescript/module/responsive-sheet/index.web.d.ts +3 -0
  62. package/lib/typescript/module/responsive-sheet/index.web.d.ts.map +1 -0
  63. package/lib/typescript/module/responsive-sheet/types.d.ts +55 -0
  64. package/lib/typescript/module/responsive-sheet/types.d.ts.map +1 -0
  65. package/package.json +18 -1
  66. package/src/__tests__/ResponsiveSheet.test.tsx +104 -0
  67. package/src/index.ts +8 -0
  68. package/src/index.web.ts +8 -0
  69. package/src/responsive-sheet/ResponsiveSheet.native.tsx +257 -0
  70. package/src/responsive-sheet/ResponsiveSheet.stories.tsx +54 -0
  71. package/src/responsive-sheet/ResponsiveSheet.tsx +327 -0
  72. package/src/responsive-sheet/const.ts +53 -0
  73. package/src/responsive-sheet/index.ts +6 -0
  74. package/src/responsive-sheet/index.web.ts +16 -0
  75. package/src/responsive-sheet/types.ts +57 -0
@@ -0,0 +1,293 @@
1
+ "use strict";
2
+
3
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
+ import { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
5
+ import { Z_INDEX } from "../styles/z-index.js";
6
+ import { useTheme } from "../theme/use-theme.js";
7
+ import { ANIMATION_DURATION, BACKDROP_OPACITY, DEFAULT_BREAKPOINT, DEFAULT_LABEL, DEFAULT_MAX_HEIGHT_RATIO, DEFAULT_SIDE, DEFAULT_WIDTH, EASE_OUT, HANDLE_HEIGHT, HANDLE_RADIUS, HANDLE_WIDTH, PANEL_RADIUS, SIDE_SHEET_MIN_GUTTER } from "./const.js";
8
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ /** Stable testID for the dimmed backdrop dismiss button. */
10
+ export const RESPONSIVE_SHEET_BACKDROP_TESTID = 'bloom-responsive-sheet-backdrop';
11
+
12
+ /**
13
+ * Default / web variant of `<ResponsiveSheet>`.
14
+ *
15
+ * This file is BOTH the package's default entry (`react-native` export
16
+ * condition resolves it for downstream `tsc`, and non-Metro web bundlers pick
17
+ * it via the `browser` condition through `index.web`) AND the canonical web
18
+ * implementation. It MUST NOT import `react-native-reanimated` — reanimated has
19
+ * no web build and its worklets Babel plugin is native-only, so a static import
20
+ * here would break every web bundler and downstream type-check. The native
21
+ * fork (`ResponsiveSheet.native.tsx`, selected only by Metro) drives the same
22
+ * motion with reanimated.
23
+ *
24
+ * Motion is pure CSS transitions: react-native-web emits `transition-*` style
25
+ * props to the DOM, and the panel/backdrop toggle their transform/opacity by a
26
+ * `shown` flag. Presence is handled with a `mounted` + `shown` pair so both the
27
+ * open AND close directions animate while the node stays mounted through the
28
+ * exit. We deliberately do NOT use reanimated `exiting` on web — concurrent
29
+ * React unmounts there throw `Failed to execute 'removeChild' on 'Node'`, the
30
+ * exact bug this component exists to avoid.
31
+ */
32
+ export function ResponsiveSheet({
33
+ open,
34
+ onClose,
35
+ side = DEFAULT_SIDE,
36
+ breakpoint = DEFAULT_BREAKPOINT,
37
+ width = DEFAULT_WIDTH,
38
+ maxHeightRatio = DEFAULT_MAX_HEIGHT_RATIO,
39
+ inset,
40
+ showHandle = true,
41
+ dismissOnBackdrop = true,
42
+ panelStyle,
43
+ panelClassName,
44
+ containerStyle,
45
+ containerClassName,
46
+ label = DEFAULT_LABEL,
47
+ children
48
+ }) {
49
+ const theme = useTheme();
50
+ const {
51
+ width: viewportWidth,
52
+ height: viewportHeight
53
+ } = useWindowDimensions();
54
+
55
+ // Presence: `mounted` keeps the node in the tree through the exit transition;
56
+ // `shown` drives the enter/exit transform & opacity. On open we mount first,
57
+ // then flip `shown` on the next frame so the browser registers the start
58
+ // state and animates to the end. On close we flip `shown` off, then unmount
59
+ // after the transition duration.
60
+ const [mounted, setMounted] = useState(open);
61
+ const [shown, setShown] = useState(false);
62
+ const closeTimerRef = useRef(null);
63
+ const frameRef = useRef(null);
64
+ useEffect(() => {
65
+ if (open) {
66
+ if (closeTimerRef.current) {
67
+ clearTimeout(closeTimerRef.current);
68
+ closeTimerRef.current = null;
69
+ }
70
+ setMounted(true);
71
+ // Defer to the next frame so the entry start state paints before we
72
+ // transition to the shown state. Two frames guarantees the start
73
+ // transform has committed before the toggle (a single frame can be
74
+ // coalesced with the mount paint in some browsers).
75
+ frameRef.current = scheduleFrame(() => {
76
+ frameRef.current = scheduleFrame(() => setShown(true));
77
+ });
78
+ return () => {
79
+ if (frameRef.current !== null) {
80
+ cancelFrame(frameRef.current);
81
+ frameRef.current = null;
82
+ }
83
+ };
84
+ }
85
+
86
+ // Closing: only run the exit if something is currently mounted.
87
+ setShown(false);
88
+ if (!mounted) return;
89
+ closeTimerRef.current = setTimeout(() => {
90
+ setMounted(false);
91
+ closeTimerRef.current = null;
92
+ }, ANIMATION_DURATION);
93
+ return () => {
94
+ if (closeTimerRef.current) {
95
+ clearTimeout(closeTimerRef.current);
96
+ closeTimerRef.current = null;
97
+ }
98
+ };
99
+ }, [open, mounted]);
100
+
101
+ // Escape-to-close while open (web only; document is undefined elsewhere).
102
+ useEffect(() => {
103
+ if (!open || typeof document === 'undefined') return;
104
+ const handler = e => {
105
+ if (e.key === 'Escape') {
106
+ e.stopPropagation();
107
+ onClose();
108
+ }
109
+ };
110
+ document.addEventListener('keydown', handler);
111
+ return () => document.removeEventListener('keydown', handler);
112
+ }, [open, onClose]);
113
+ const handleBackdropPress = useCallback(() => {
114
+ if (dismissOnBackdrop) onClose();
115
+ }, [dismissOnBackdrop, onClose]);
116
+ const isBottom = viewportWidth < breakpoint;
117
+ const panelBackground = theme.colors.background;
118
+ const panelTransition = useMemo(() => ({
119
+ transitionProperty: 'transform, opacity',
120
+ transitionDuration: `${ANIMATION_DURATION}ms`,
121
+ transitionTimingFunction: EASE_OUT
122
+ }), []);
123
+ const backdropTransition = useMemo(() => ({
124
+ transitionProperty: 'opacity',
125
+ transitionDuration: `${ANIMATION_DURATION}ms`,
126
+ transitionTimingFunction: EASE_OUT
127
+ }), []);
128
+ const panelGeometry = useMemo(() => {
129
+ if (isBottom) {
130
+ return {
131
+ left: 0,
132
+ right: 0,
133
+ bottom: 0,
134
+ maxHeight: Math.round(viewportHeight * maxHeightRatio),
135
+ borderTopLeftRadius: PANEL_RADIUS,
136
+ borderTopRightRadius: PANEL_RADIUS,
137
+ transform: [{
138
+ translateY: shown ? 0 : '100%'
139
+ }],
140
+ opacity: shown ? 1 : 0
141
+ };
142
+ }
143
+
144
+ // Side-sheet: full height minus top/bottom inset, anchored to `side`,
145
+ // offset by the matching horizontal inset. Width is capped so the panel
146
+ // always leaves a gutter on the opposite edge.
147
+ const insetTop = inset?.top ?? 0;
148
+ const insetBottom = inset?.bottom ?? 0;
149
+ const insetLeft = inset?.left ?? 0;
150
+ const insetRight = inset?.right ?? 0;
151
+ const anchorInset = side === 'left' ? insetLeft : insetRight;
152
+ const oppositeInset = side === 'left' ? insetRight : insetLeft;
153
+ const available = viewportWidth - anchorInset - oppositeInset - SIDE_SHEET_MIN_GUTTER;
154
+ const cappedWidth = Math.max(0, Math.min(width, available));
155
+ const hiddenSign = side === 'left' ? '-100%' : '100%';
156
+ return {
157
+ top: insetTop,
158
+ bottom: insetBottom,
159
+ [side]: anchorInset,
160
+ width: cappedWidth,
161
+ borderRadius: PANEL_RADIUS,
162
+ transform: [{
163
+ translateX: shown ? 0 : hiddenSign
164
+ }],
165
+ opacity: shown ? 1 : 0
166
+ };
167
+ }, [isBottom, shown, side, width, inset, viewportWidth, viewportHeight, maxHeightRatio]);
168
+ if (!mounted) return null;
169
+ return /*#__PURE__*/_jsxs(View, {
170
+ style: [styles.root, containerStyle]
171
+ // NativeWind reads `className` at runtime; RN core does not type it on
172
+ // View, so spread it conditionally (matching the Button/Fab pattern).
173
+ ,
174
+ ...(containerClassName ? {
175
+ className: containerClassName
176
+ } : {}),
177
+ pointerEvents: "box-none",
178
+ children: [/*#__PURE__*/_jsx(Pressable, {
179
+ testID: RESPONSIVE_SHEET_BACKDROP_TESTID,
180
+ accessibilityRole: "button",
181
+ accessibilityLabel: `Dismiss ${label}`,
182
+ onPress: handleBackdropPress,
183
+ disabled: !dismissOnBackdrop,
184
+ style: [styles.backdrop, backdropTransition, {
185
+ opacity: shown ? BACKDROP_OPACITY : 0
186
+ }, isWeb ? webBackdropBlur : null]
187
+ }), /*#__PURE__*/_jsxs(View, {
188
+ accessibilityViewIsModal: true,
189
+ "aria-label": label,
190
+ ...(panelClassName ? {
191
+ className: panelClassName
192
+ } : {}),
193
+ style: [styles.panel, {
194
+ backgroundColor: panelBackground,
195
+ shadowColor: theme.colors.shadow
196
+ }, panelGeometry, panelTransition, panelStyle],
197
+ pointerEvents: "auto",
198
+ children: [isBottom && showHandle ? /*#__PURE__*/_jsx(View, {
199
+ style: styles.handleRow,
200
+ pointerEvents: "none",
201
+ children: /*#__PURE__*/_jsx(View, {
202
+ style: [styles.handle, {
203
+ backgroundColor: theme.colors.border
204
+ }]
205
+ })
206
+ }) : null, children]
207
+ })]
208
+ });
209
+ }
210
+
211
+ // This module is the web/default impl, but it is also the fallback resolved by
212
+ // a downstream consumer's `tsc` for the native target, so guard the web-only
213
+ // `backdrop-blur` style behind a runtime check rather than assuming web.
214
+ const isWeb = typeof document !== 'undefined';
215
+
216
+ /**
217
+ * Opaque token returned by `scheduleFrame`. `requestAnimationFrame` returns a
218
+ * number; the `setTimeout` fallback returns a timer handle — both are kept so
219
+ * `cancelFrame` can route to the matching canceller.
220
+ */
221
+
222
+ /**
223
+ * Schedule a callback for the next paint. Uses `requestAnimationFrame` in the
224
+ * browser; degrades to a 0ms timeout when rAF is unavailable (SSR/hydration,
225
+ * non-DOM test envs) so the enter transition's `shown` flip still fires.
226
+ */
227
+ function scheduleFrame(cb) {
228
+ if (typeof requestAnimationFrame === 'function') {
229
+ return {
230
+ raf: requestAnimationFrame(cb)
231
+ };
232
+ }
233
+ return {
234
+ timer: setTimeout(cb, 0)
235
+ };
236
+ }
237
+ function cancelFrame(token) {
238
+ if ('raf' in token) {
239
+ if (typeof cancelAnimationFrame === 'function') cancelAnimationFrame(token.raf);
240
+ return;
241
+ }
242
+ clearTimeout(token.timer);
243
+ }
244
+
245
+ // `backdrop-filter` is web-only; react-native-web passes it through to the DOM.
246
+ const webBackdropBlur = {
247
+ backdropFilter: 'blur(2px)'
248
+ };
249
+ const styles = StyleSheet.create({
250
+ root: {
251
+ // `position: fixed` pins the overlay to the viewport on web; react-native
252
+ // does not type `'fixed'`, so cast to the RN-accepted `'absolute'`. On
253
+ // native the `.native` fork uses `StyleSheet.absoluteFill` instead.
254
+ position: 'fixed',
255
+ top: 0,
256
+ left: 0,
257
+ right: 0,
258
+ bottom: 0,
259
+ zIndex: Z_INDEX.fullscreen
260
+ },
261
+ backdrop: {
262
+ position: 'absolute',
263
+ top: 0,
264
+ left: 0,
265
+ right: 0,
266
+ bottom: 0,
267
+ backgroundColor: '#000'
268
+ },
269
+ panel: {
270
+ position: 'absolute',
271
+ overflow: 'hidden',
272
+ shadowOpacity: 0.18,
273
+ shadowRadius: 24,
274
+ shadowOffset: {
275
+ width: 0,
276
+ height: 8
277
+ }
278
+ },
279
+ handleRow: {
280
+ width: '100%',
281
+ alignItems: 'center',
282
+ paddingTop: 8,
283
+ paddingBottom: 4
284
+ },
285
+ handle: {
286
+ width: HANDLE_WIDTH,
287
+ height: HANDLE_HEIGHT,
288
+ borderRadius: HANDLE_RADIUS,
289
+ opacity: 0.5
290
+ }
291
+ });
292
+ export default ResponsiveSheet;
293
+ //# sourceMappingURL=ResponsiveSheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","Pressable","StyleSheet","useWindowDimensions","View","Z_INDEX","useTheme","ANIMATION_DURATION","BACKDROP_OPACITY","DEFAULT_BREAKPOINT","DEFAULT_LABEL","DEFAULT_MAX_HEIGHT_RATIO","DEFAULT_SIDE","DEFAULT_WIDTH","EASE_OUT","HANDLE_HEIGHT","HANDLE_RADIUS","HANDLE_WIDTH","PANEL_RADIUS","SIDE_SHEET_MIN_GUTTER","jsx","_jsx","jsxs","_jsxs","RESPONSIVE_SHEET_BACKDROP_TESTID","ResponsiveSheet","open","onClose","side","breakpoint","width","maxHeightRatio","inset","showHandle","dismissOnBackdrop","panelStyle","panelClassName","containerStyle","containerClassName","label","children","theme","viewportWidth","height","viewportHeight","mounted","setMounted","shown","setShown","closeTimerRef","frameRef","current","clearTimeout","scheduleFrame","cancelFrame","setTimeout","document","handler","e","key","stopPropagation","addEventListener","removeEventListener","handleBackdropPress","isBottom","panelBackground","colors","background","panelTransition","transitionProperty","transitionDuration","transitionTimingFunction","backdropTransition","panelGeometry","left","right","bottom","maxHeight","Math","round","borderTopLeftRadius","borderTopRightRadius","transform","translateY","opacity","insetTop","top","insetBottom","insetLeft","insetRight","anchorInset","oppositeInset","available","cappedWidth","max","min","hiddenSign","borderRadius","translateX","style","styles","root","className","pointerEvents","testID","accessibilityRole","accessibilityLabel","onPress","disabled","backdrop","isWeb","webBackdropBlur","accessibilityViewIsModal","panel","backgroundColor","shadowColor","shadow","handleRow","handle","border","cb","requestAnimationFrame","raf","timer","token","cancelAnimationFrame","backdropFilter","create","position","zIndex","fullscreen","overflow","shadowOpacity","shadowRadius","shadowOffset","alignItems","paddingTop","paddingBottom"],"sourceRoot":"../../../src","sources":["responsive-sheet/ResponsiveSheet.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SACEC,SAAS,EACTC,UAAU,EACVC,mBAAmB,EACnBC,IAAI,QAEC,cAAc;AAErB,SAASC,OAAO,QAAQ,sBAAmB;AAC3C,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,wBAAwB,EACxBC,YAAY,EACZC,aAAa,EACbC,QAAQ,EACRC,aAAa,EACbC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,qBAAqB,Q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SAAS,EAAE;IACTvF,KAAK,EAAE,MAAM;IACbyG,UAAU,EAAE,QAAQ;IACpBC,UAAU,EAAE,CAAC;IACbC,aAAa,EAAE;EACjB,CAAC;EACDnB,MAAM,EAAE;IACNxF,KAAK,EAAEb,YAAY;IACnB0B,MAAM,EAAE5B,aAAa;IACrBkF,YAAY,EAAEjF,aAAa;IAC3BoE,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF,eAAe3D,eAAe","ignoreList":[]}
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+
3
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
4
+ import { Pressable, StyleSheet, useWindowDimensions, View } from 'react-native';
5
+ import Animated, { cancelAnimation, Easing, runOnJS, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
6
+ import { Z_INDEX } from "../styles/z-index.js";
7
+ import { useTheme } from "../theme/use-theme.js";
8
+ import { ANIMATION_DURATION, BACKDROP_OPACITY, DEFAULT_BREAKPOINT, DEFAULT_LABEL, DEFAULT_MAX_HEIGHT_RATIO, DEFAULT_SIDE, DEFAULT_WIDTH, HANDLE_HEIGHT, HANDLE_RADIUS, HANDLE_WIDTH, PANEL_RADIUS, SIDE_SHEET_MIN_GUTTER } from "./const.js";
9
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
+ /** Stable testID for the dimmed backdrop dismiss button. */
11
+ export const RESPONSIVE_SHEET_BACKDROP_TESTID = 'bloom-responsive-sheet-backdrop';
12
+
13
+ /**
14
+ * Native variant of `<ResponsiveSheet>` (selected only by Metro).
15
+ *
16
+ * Uses `react-native-reanimated` to drive the same motion as the web/CSS
17
+ * default fork: a shared `progress` value times 0 -> 1 on open and 1 -> 0 on
18
+ * close, mapped to the panel translate/opacity and the backdrop opacity.
19
+ * Native exit animations are safe here — the web-only `removeChild` crash does
20
+ * not apply — so we keep the node mounted through the close timing and unmount
21
+ * from the animation completion callback.
22
+ *
23
+ * The panel itself is measured (not percentage-translated): we offset by the
24
+ * panel's own width/height so the hidden state sits fully off its side, which
25
+ * is the reanimated-friendly equivalent of the web `translate(±100%)`.
26
+ */
27
+ export function ResponsiveSheet({
28
+ open,
29
+ onClose,
30
+ side = DEFAULT_SIDE,
31
+ breakpoint = DEFAULT_BREAKPOINT,
32
+ width = DEFAULT_WIDTH,
33
+ maxHeightRatio = DEFAULT_MAX_HEIGHT_RATIO,
34
+ inset,
35
+ showHandle = true,
36
+ dismissOnBackdrop = true,
37
+ panelStyle,
38
+ panelClassName,
39
+ containerStyle,
40
+ containerClassName,
41
+ label = DEFAULT_LABEL,
42
+ children
43
+ }) {
44
+ const theme = useTheme();
45
+ const {
46
+ width: viewportWidth,
47
+ height: viewportHeight
48
+ } = useWindowDimensions();
49
+
50
+ // Keep the tree mounted through the exit timing; unmount once it settles.
51
+ const [mounted, setMounted] = useState(open);
52
+ // `progress`: 0 = fully hidden, 1 = fully shown. Drives both transform and
53
+ // opacity so a single timing controls the whole transition.
54
+ const progress = useSharedValue(open ? 1 : 0);
55
+ const isBottom = viewportWidth < breakpoint;
56
+
57
+ // Measured panel extent along the travel axis. Falls back to the geometry
58
+ // target so the very first frame is already off-screen before layout lands.
59
+ const insetTop = inset?.top ?? 0;
60
+ const insetBottom = inset?.bottom ?? 0;
61
+ const insetLeft = inset?.left ?? 0;
62
+ const insetRight = inset?.right ?? 0;
63
+ const anchorInset = side === 'left' ? insetLeft : insetRight;
64
+ const oppositeInset = side === 'left' ? insetRight : insetLeft;
65
+ const sideWidth = useMemo(() => {
66
+ const available = viewportWidth - anchorInset - oppositeInset - SIDE_SHEET_MIN_GUTTER;
67
+ return Math.max(0, Math.min(width, available));
68
+ }, [viewportWidth, anchorInset, oppositeInset, width]);
69
+ const bottomMaxHeight = useMemo(() => Math.round(viewportHeight * maxHeightRatio), [viewportHeight, maxHeightRatio]);
70
+
71
+ // Travel distance for the hidden state: the panel's measured extent (height
72
+ // for the bottom-sheet, width for the side-sheet), with the geometry target
73
+ // as the pre-measurement fallback.
74
+ const travel = useSharedValue(isBottom ? bottomMaxHeight : sideWidth);
75
+ useEffect(() => {
76
+ travel.value = isBottom ? bottomMaxHeight : sideWidth;
77
+ }, [isBottom, bottomMaxHeight, sideWidth, travel]);
78
+ const finishClose = useCallback(() => {
79
+ setMounted(false);
80
+ }, []);
81
+ useEffect(() => {
82
+ cancelAnimation(progress);
83
+ const timing = {
84
+ duration: ANIMATION_DURATION,
85
+ easing: Easing.out(Easing.cubic)
86
+ };
87
+ if (open) {
88
+ setMounted(true);
89
+ progress.value = withTiming(1, timing);
90
+ return;
91
+ }
92
+ if (!mounted) return;
93
+ progress.value = withTiming(0, timing, finished => {
94
+ if (finished) runOnJS(finishClose)();
95
+ });
96
+ }, [open, mounted, progress, finishClose]);
97
+ const handleBackdropPress = useCallback(() => {
98
+ if (dismissOnBackdrop) onClose();
99
+ }, [dismissOnBackdrop, onClose]);
100
+ const backdropAnimatedStyle = useAnimatedStyle(() => ({
101
+ opacity: progress.value * BACKDROP_OPACITY
102
+ }));
103
+ const hiddenSign = side === 'left' ? -1 : 1;
104
+ const panelAnimatedStyle = useAnimatedStyle(() => {
105
+ const hidden = 1 - progress.value;
106
+ if (isBottom) {
107
+ return {
108
+ opacity: progress.value,
109
+ transform: [{
110
+ translateY: hidden * travel.value
111
+ }]
112
+ };
113
+ }
114
+ return {
115
+ opacity: progress.value,
116
+ transform: [{
117
+ translateX: hidden * travel.value * hiddenSign
118
+ }]
119
+ };
120
+ }, [isBottom, hiddenSign]);
121
+ const measurePanel = useCallback(e => {
122
+ const measured = isBottom ? e.nativeEvent.layout.height : e.nativeEvent.layout.width;
123
+ if (measured > 0) travel.value = measured;
124
+ }, [isBottom, travel]);
125
+ const panelGeometry = useMemo(() => {
126
+ if (isBottom) {
127
+ return {
128
+ left: 0,
129
+ right: 0,
130
+ bottom: 0,
131
+ maxHeight: bottomMaxHeight,
132
+ borderTopLeftRadius: PANEL_RADIUS,
133
+ borderTopRightRadius: PANEL_RADIUS
134
+ };
135
+ }
136
+ return {
137
+ top: insetTop,
138
+ bottom: insetBottom,
139
+ [side]: anchorInset,
140
+ width: sideWidth,
141
+ borderRadius: PANEL_RADIUS
142
+ };
143
+ }, [isBottom, bottomMaxHeight, insetTop, insetBottom, side, anchorInset, sideWidth]);
144
+ if (!mounted) return null;
145
+ return /*#__PURE__*/_jsxs(View, {
146
+ style: [styles.root, containerStyle],
147
+ ...(containerClassName ? {
148
+ className: containerClassName
149
+ } : {}),
150
+ pointerEvents: "box-none",
151
+ children: [/*#__PURE__*/_jsx(Animated.View, {
152
+ style: [styles.backdrop, backdropAnimatedStyle],
153
+ pointerEvents: "auto",
154
+ children: /*#__PURE__*/_jsx(Pressable, {
155
+ testID: RESPONSIVE_SHEET_BACKDROP_TESTID,
156
+ accessibilityRole: "button",
157
+ accessibilityLabel: `Dismiss ${label}`,
158
+ onPress: handleBackdropPress,
159
+ disabled: !dismissOnBackdrop,
160
+ style: StyleSheet.absoluteFill
161
+ })
162
+ }), /*#__PURE__*/_jsxs(Animated.View, {
163
+ accessibilityViewIsModal: true,
164
+ ...(panelClassName ? {
165
+ className: panelClassName
166
+ } : {}),
167
+ onLayout: measurePanel,
168
+ style: [styles.panel, {
169
+ backgroundColor: theme.colors.background,
170
+ shadowColor: theme.colors.shadow
171
+ }, panelGeometry, panelAnimatedStyle, panelStyle],
172
+ pointerEvents: "auto",
173
+ children: [isBottom && showHandle ? /*#__PURE__*/_jsx(View, {
174
+ style: styles.handleRow,
175
+ pointerEvents: "none",
176
+ children: /*#__PURE__*/_jsx(View, {
177
+ style: [styles.handle, {
178
+ backgroundColor: theme.colors.border
179
+ }]
180
+ })
181
+ }) : null, children]
182
+ })]
183
+ });
184
+ }
185
+ const styles = StyleSheet.create({
186
+ root: {
187
+ ...StyleSheet.absoluteFill,
188
+ zIndex: Z_INDEX.fullscreen
189
+ },
190
+ backdrop: {
191
+ ...StyleSheet.absoluteFill,
192
+ backgroundColor: '#000'
193
+ },
194
+ panel: {
195
+ position: 'absolute',
196
+ overflow: 'hidden',
197
+ shadowOpacity: 0.18,
198
+ shadowRadius: 24,
199
+ shadowOffset: {
200
+ width: 0,
201
+ height: 8
202
+ },
203
+ elevation: 12
204
+ },
205
+ handleRow: {
206
+ width: '100%',
207
+ alignItems: 'center',
208
+ paddingTop: 8,
209
+ paddingBottom: 4
210
+ },
211
+ handle: {
212
+ width: HANDLE_WIDTH,
213
+ height: HANDLE_HEIGHT,
214
+ borderRadius: HANDLE_RADIUS,
215
+ opacity: 0.5
216
+ }
217
+ });
218
+ export default ResponsiveSheet;
219
+ //# sourceMappingURL=ResponsiveSheet.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useEffect","useMemo","useState","Pressable","StyleSheet","useWindowDimensions","View","Animated","cancelAnimation","Easing","runOnJS","useAnimatedStyle","useSharedValue","withTiming","Z_INDEX","useTheme","ANIMATION_DURATION","BACKDROP_OPACITY","DEFAULT_BREAKPOINT","DEFAULT_LABEL","DEFAULT_MAX_HEIGHT_RATIO","DEFAULT_SIDE","DEFAULT_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","HANDLE_WIDTH","PANEL_RADIUS","SIDE_SHEET_MIN_GUTTER","jsx","_jsx","jsxs","_jsxs","RESPONSIVE_SHEET_BACKDROP_TESTID","ResponsiveSheet","open","onClose","side","breakpoint","width","maxHeightRatio","inset","showHandle","dismissOnBackdrop","panelStyle","panelClassName","containerStyle","containerClassName","label","children","theme","viewportWidth","height","viewportHeight","mounted","setMounted","progress","isBottom","insetTop","top","insetBottom","bottom","insetLeft","left","insetRight","right","anchorInset","oppositeInset","sideWidth","available","Math","max","min","bottomMaxHeight","round","travel","value","finishClose","timing","duration","easing","out","cubic","finished","handleBackdropPress","backdropAnimatedStyle","opacity","hiddenSign","panelAnimatedStyle","hidden","transform","translateY","translateX","measurePanel","e","measured","nativeEvent","layout","panelGeometry","maxHeight","borderTopLeftRadius","borderTopRightRadius","borderRadius","style","styles","root","className","pointerEvents","backdrop","testID","accessibilityRole","accessibilityLabel","onPress","disabled","absoluteFill","accessibilityViewIsModal","onLayout","panel","backgroundColor","colors","background","shadowColor","shadow","handleRow","handle","border","create","zIndex","fullscreen","position","overflow","shadowOpacity","shadowRadius","shadowOffset","elevation","alignItems","paddingTop","paddingBottom"],"sourceRoot":"../../../src","sources":["responsive-sheet/ResponsiveSheet.native.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IACVC,WAAW,EACXC,SAAS,EACTC,OAAO,EAEPC,QAAQ,QACH,OAAO;AACd,SACEC,SAAS,EACTC,UAAU,EACVC,mBAAmB,EACnBC,IAAI,QAEC,cAAc;AACrB,OAAOC,QAAQ,IACbC,eAAe,EACfC,MAAM,EACNC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAEhC,SAASC,OAAO,QAAQ,sBAAmB;AAC3C,SAASC,QAAQ,QAAQ,uBAAoB;AAC7C,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,kBAAkB,EAClBC,aAAa,EACbC,wBAAwB,EACxBC,YAAY,EACZC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,qBAAqB,QAChB,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGjB;AACA,OAAO,MAAMC,gCAAgC,GAAG,iCAAiC;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAAC;EAC9BC,IAAI;EACJC,OAAO;EACPC,IAAI,GAAGf,YAAY;EACnBgB,UAAU,GAAGnB,kBAAkB;EAC/BoB,KAAK,GAAGhB,aAAa;EACrBiB,cAAc,GAAGnB,wBAAwB;EACzCoB,KAAK;EACLC,UAAU,GAAG,IAAI;EACjBC,iBAAiB,GAAG,IAAI;EACxBC,UAAU;EACVC,cAAc;EACdC,cAAc;EACdC,kBAAkB;EAClBC,KAAK,GA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KAAK,EAAEb,YAAY;IACnB0B,MAAM,EAAE5B,aAAa;IACrB8E,YAAY,EAAE7E,aAAa;IAC3B6D,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF,eAAepD,eAAe","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Shared default constants for `ResponsiveSheet`.
5
+ *
6
+ * Platform-agnostic — imported by both the default/web CSS implementation
7
+ * (`ResponsiveSheet.tsx`) and the native reanimated implementation
8
+ * (`ResponsiveSheet.native.tsx`) so the two variants stay in lockstep.
9
+ */
10
+
11
+ /** Below this viewport width the sheet renders as a bottom-sheet. */
12
+ export const DEFAULT_BREAKPOINT = 768;
13
+
14
+ /** Side-sheet width (px) on wide screens. Capped to fit the viewport. */
15
+ export const DEFAULT_WIDTH = 460;
16
+
17
+ /** Bottom-sheet maximum height as a fraction of the viewport height. */
18
+ export const DEFAULT_MAX_HEIGHT_RATIO = 0.9;
19
+
20
+ /** Anchored edge of the side-sheet on wide screens. */
21
+ export const DEFAULT_SIDE = 'left';
22
+
23
+ /**
24
+ * Open/close transition duration (ms). ~280–300ms ease-out reads as smooth
25
+ * without feeling sluggish; shared by the CSS transition and the native
26
+ * reanimated timing so both platforms match.
27
+ */
28
+ export const ANIMATION_DURATION = 280;
29
+
30
+ /**
31
+ * Standard CSS approximation of reanimated's `Easing.out(Easing.cubic)` so the
32
+ * web transition curve matches the native one.
33
+ */
34
+ export const EASE_OUT = 'cubic-bezier(0.33, 1, 0.68, 1)';
35
+
36
+ /** Corner radius for the side-sheet panel and the top of the bottom-sheet. */
37
+ export const PANEL_RADIUS = 20;
38
+
39
+ /** Backdrop dim opacity once fully shown (matches `bg-black/40`). */
40
+ export const BACKDROP_OPACITY = 0.4;
41
+
42
+ /** Drag-handle pill geometry for the bottom-sheet. */
43
+ export const HANDLE_WIDTH = 36;
44
+ export const HANDLE_HEIGHT = 5;
45
+ export const HANDLE_RADIUS = 3;
46
+
47
+ /**
48
+ * Minimum gutter kept between a wide side-sheet and the opposite viewport edge
49
+ * when capping its width, so the panel never spans the full screen on a narrow
50
+ * desktop window that is still above the breakpoint.
51
+ */
52
+ export const SIDE_SHEET_MIN_GUTTER = 24;
53
+
54
+ /** A11y label fallback when the host does not provide one. */
55
+ export const DEFAULT_LABEL = 'Sheet';
56
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DEFAULT_BREAKPOINT","DEFAULT_WIDTH","DEFAULT_MAX_HEIGHT_RATIO","DEFAULT_SIDE","ANIMATION_DURATION","EASE_OUT","PANEL_RADIUS","BACKDROP_OPACITY","HANDLE_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","SIDE_SHEET_MIN_GUTTER","DEFAULT_LABEL"],"sourceRoot":"../../../src","sources":["responsive-sheet/const.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,OAAO,MAAMA,kBAAkB,GAAG,GAAG;;AAErC;AACA,OAAO,MAAMC,aAAa,GAAG,GAAG;;AAEhC;AACA,OAAO,MAAMC,wBAAwB,GAAG,GAAG;;AAE3C;AACA,OAAO,MAAMC,YAAY,GAAG,MAAe;;AAE3C;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,GAAG;;AAErC;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAG,gCAAgC;;AAExD;AACA,OAAO,MAAMC,YAAY,GAAG,EAAE;;AAE9B;AACA,OAAO,MAAMC,gBAAgB,GAAG,GAAG;;AAEnC;AACA,OAAO,MAAMC,YAAY,GAAG,EAAE;AAC9B,OAAO,MAAMC,aAAa,GAAG,CAAC;AAC9B,OAAO,MAAMC,aAAa,GAAG,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAqB,GAAG,EAAE;;AAEvC;AACA,OAAO,MAAMC,aAAa,GAAG,OAAO","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './ResponsiveSheet';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ResponsiveSheet","RESPONSIVE_SHEET_BACKDROP_TESTID"],"sourceRoot":"../../../src","sources":["responsive-sheet/index.ts"],"mappings":";;AAAA,SAASA,eAAe,EAAEC,gCAAgC,QAAQ,mBAAmB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ // Web variant of the `./responsive-sheet` barrel.
4
+ //
5
+ // The default barrel (`./index.ts`) re-exports from `./ResponsiveSheet`, which
6
+ // is itself the reanimated-free web/CSS implementation — Metro additionally
7
+ // resolves `./ResponsiveSheet.native` for native targets. Web bundlers select
8
+ // THIS file via the `"browser"` export condition in `package.json`'s
9
+ // `exports['./responsive-sheet']`, pointing them explicitly at the CSS
10
+ // implementation so a non-Metro bundler never follows the `.native` sibling
11
+ // (which statically imports `react-native-reanimated`, a native-only module).
12
+ // Types are platform-agnostic, so they come straight from `./types`.
13
+ export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './ResponsiveSheet';
14
+ //# sourceMappingURL=index.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ResponsiveSheet","RESPONSIVE_SHEET_BACKDROP_TESTID"],"sourceRoot":"../../../src","sources":["responsive-sheet/index.web.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,gCAAgC,QAAQ,mBAAmB","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["responsive-sheet/types.ts"],"mappings":"","ignoreList":[]}
@@ -49,6 +49,8 @@ export { Combobox } from './combobox';
49
49
  export type { ComboboxProps, ComboboxOption } from './combobox';
50
50
  export { BottomSheet } from './bottom-sheet';
51
51
  export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet';
52
+ export { ResponsiveSheet, RESPONSIVE_SHEET_BACKDROP_TESTID } from './responsive-sheet';
53
+ export type { ResponsiveSheetProps, ResponsiveSheetSide, ResponsiveSheetInset, } from './responsive-sheet';
52
54
  export * from './card';
53
55
  export * from './badge';
54
56
  export * from './chip';