@oxyhq/bloom 0.14.0 → 0.15.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 (144) hide show
  1. package/lib/commonjs/dialog/CenteredDialog.js +2 -0
  2. package/lib/commonjs/dialog/CenteredDialog.js.map +1 -1
  3. package/lib/commonjs/dialog/CenteredDialog.web.js +2 -0
  4. package/lib/commonjs/dialog/CenteredDialog.web.js.map +1 -1
  5. package/lib/commonjs/dialog/Dialog.js +337 -43
  6. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  7. package/lib/commonjs/dialog/Dialog.web.js +414 -63
  8. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  9. package/lib/commonjs/dialog/index.js +6 -0
  10. package/lib/commonjs/dialog/index.js.map +1 -1
  11. package/lib/commonjs/dialog/index.web.js +6 -0
  12. package/lib/commonjs/dialog/index.web.js.map +1 -1
  13. package/lib/commonjs/dialog/placement.js +104 -0
  14. package/lib/commonjs/dialog/placement.js.map +1 -0
  15. package/lib/commonjs/index.js +7 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/index.web.js +7 -0
  18. package/lib/commonjs/index.web.js.map +1 -1
  19. package/lib/commonjs/responsive-sheet/ResponsiveSheet.js +63 -266
  20. package/lib/commonjs/responsive-sheet/ResponsiveSheet.js.map +1 -1
  21. package/lib/commonjs/responsive-sheet/ResponsiveSheet.web.js +84 -0
  22. package/lib/commonjs/responsive-sheet/ResponsiveSheet.web.js.map +1 -0
  23. package/lib/commonjs/responsive-sheet/index.web.js +3 -3
  24. package/lib/commonjs/responsive-sheet/index.web.js.map +1 -1
  25. package/lib/module/dialog/CenteredDialog.js +2 -0
  26. package/lib/module/dialog/CenteredDialog.js.map +1 -1
  27. package/lib/module/dialog/CenteredDialog.web.js +2 -0
  28. package/lib/module/dialog/CenteredDialog.web.js.map +1 -1
  29. package/lib/module/dialog/Dialog.js +336 -46
  30. package/lib/module/dialog/Dialog.js.map +1 -1
  31. package/lib/module/dialog/Dialog.web.js +412 -65
  32. package/lib/module/dialog/Dialog.web.js.map +1 -1
  33. package/lib/module/dialog/index.js +1 -1
  34. package/lib/module/dialog/index.js.map +1 -1
  35. package/lib/module/dialog/index.web.js +1 -1
  36. package/lib/module/dialog/index.web.js.map +1 -1
  37. package/lib/module/dialog/placement.js +100 -0
  38. package/lib/module/dialog/placement.js.map +1 -0
  39. package/lib/module/index.js +1 -1
  40. package/lib/module/index.js.map +1 -1
  41. package/lib/module/index.web.js +1 -1
  42. package/lib/module/index.web.js.map +1 -1
  43. package/lib/module/responsive-sheet/ResponsiveSheet.js +63 -266
  44. package/lib/module/responsive-sheet/ResponsiveSheet.js.map +1 -1
  45. package/lib/module/responsive-sheet/ResponsiveSheet.web.js +77 -0
  46. package/lib/module/responsive-sheet/ResponsiveSheet.web.js.map +1 -0
  47. package/lib/module/responsive-sheet/index.web.js +7 -9
  48. package/lib/module/responsive-sheet/index.web.js.map +1 -1
  49. package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts +2 -0
  50. package/lib/typescript/commonjs/dialog/CenteredDialog.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts +2 -0
  52. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/dialog/Dialog.d.ts +18 -15
  54. package/lib/typescript/commonjs/dialog/Dialog.d.ts.map +1 -1
  55. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts +18 -5
  56. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  57. package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts +4 -0
  58. package/lib/typescript/commonjs/dialog/centered-dialog-types.d.ts.map +1 -1
  59. package/lib/typescript/commonjs/dialog/index.d.ts +2 -2
  60. package/lib/typescript/commonjs/dialog/index.d.ts.map +1 -1
  61. package/lib/typescript/commonjs/dialog/index.web.d.ts +2 -2
  62. package/lib/typescript/commonjs/dialog/index.web.d.ts.map +1 -1
  63. package/lib/typescript/commonjs/dialog/placement.d.ts +71 -0
  64. package/lib/typescript/commonjs/dialog/placement.d.ts.map +1 -0
  65. package/lib/typescript/commonjs/dialog/types.d.ts +66 -3
  66. package/lib/typescript/commonjs/dialog/types.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/index.d.ts +2 -2
  68. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/index.web.d.ts +2 -2
  70. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts +15 -19
  72. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.web.d.ts +16 -0
  74. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.web.d.ts.map +1 -0
  75. package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts +1 -1
  76. package/lib/typescript/commonjs/responsive-sheet/index.web.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/responsive-sheet/types.d.ts +5 -2
  78. package/lib/typescript/commonjs/responsive-sheet/types.d.ts.map +1 -1
  79. package/lib/typescript/module/dialog/CenteredDialog.d.ts +2 -0
  80. package/lib/typescript/module/dialog/CenteredDialog.d.ts.map +1 -1
  81. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts +2 -0
  82. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts.map +1 -1
  83. package/lib/typescript/module/dialog/Dialog.d.ts +18 -15
  84. package/lib/typescript/module/dialog/Dialog.d.ts.map +1 -1
  85. package/lib/typescript/module/dialog/Dialog.web.d.ts +18 -5
  86. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  87. package/lib/typescript/module/dialog/centered-dialog-types.d.ts +4 -0
  88. package/lib/typescript/module/dialog/centered-dialog-types.d.ts.map +1 -1
  89. package/lib/typescript/module/dialog/index.d.ts +2 -2
  90. package/lib/typescript/module/dialog/index.d.ts.map +1 -1
  91. package/lib/typescript/module/dialog/index.web.d.ts +2 -2
  92. package/lib/typescript/module/dialog/index.web.d.ts.map +1 -1
  93. package/lib/typescript/module/dialog/placement.d.ts +71 -0
  94. package/lib/typescript/module/dialog/placement.d.ts.map +1 -0
  95. package/lib/typescript/module/dialog/types.d.ts +66 -3
  96. package/lib/typescript/module/dialog/types.d.ts.map +1 -1
  97. package/lib/typescript/module/index.d.ts +2 -2
  98. package/lib/typescript/module/index.d.ts.map +1 -1
  99. package/lib/typescript/module/index.web.d.ts +2 -2
  100. package/lib/typescript/module/index.web.d.ts.map +1 -1
  101. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts +15 -19
  102. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.d.ts.map +1 -1
  103. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.web.d.ts +16 -0
  104. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.web.d.ts.map +1 -0
  105. package/lib/typescript/module/responsive-sheet/index.web.d.ts +1 -1
  106. package/lib/typescript/module/responsive-sheet/index.web.d.ts.map +1 -1
  107. package/lib/typescript/module/responsive-sheet/types.d.ts +5 -2
  108. package/lib/typescript/module/responsive-sheet/types.d.ts.map +1 -1
  109. package/package.json +1 -1
  110. package/src/__tests__/DialogPlacement.test.tsx +144 -0
  111. package/src/__tests__/ResponsiveSheet.test.tsx +36 -52
  112. package/src/dialog/CenteredDialog.tsx +2 -0
  113. package/src/dialog/CenteredDialog.web.tsx +2 -0
  114. package/src/dialog/Dialog.tsx +407 -50
  115. package/src/dialog/Dialog.web.tsx +490 -75
  116. package/src/dialog/centered-dialog-types.ts +4 -0
  117. package/src/dialog/index.ts +4 -1
  118. package/src/dialog/index.web.ts +4 -1
  119. package/src/dialog/placement.ts +113 -0
  120. package/src/dialog/types.ts +69 -3
  121. package/src/index.ts +4 -0
  122. package/src/index.web.ts +4 -0
  123. package/src/responsive-sheet/ResponsiveSheet.tsx +58 -297
  124. package/src/responsive-sheet/ResponsiveSheet.web.tsx +76 -0
  125. package/src/responsive-sheet/index.web.ts +7 -9
  126. package/src/responsive-sheet/types.ts +5 -2
  127. package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js +0 -226
  128. package/lib/commonjs/responsive-sheet/ResponsiveSheet.native.js.map +0 -1
  129. package/lib/commonjs/responsive-sheet/const.js +0 -60
  130. package/lib/commonjs/responsive-sheet/const.js.map +0 -1
  131. package/lib/module/responsive-sheet/ResponsiveSheet.native.js +0 -219
  132. package/lib/module/responsive-sheet/ResponsiveSheet.native.js.map +0 -1
  133. package/lib/module/responsive-sheet/const.js +0 -56
  134. package/lib/module/responsive-sheet/const.js.map +0 -1
  135. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts +0 -20
  136. package/lib/typescript/commonjs/responsive-sheet/ResponsiveSheet.native.d.ts.map +0 -1
  137. package/lib/typescript/commonjs/responsive-sheet/const.d.ts +0 -43
  138. package/lib/typescript/commonjs/responsive-sheet/const.d.ts.map +0 -1
  139. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts +0 -20
  140. package/lib/typescript/module/responsive-sheet/ResponsiveSheet.native.d.ts.map +0 -1
  141. package/lib/typescript/module/responsive-sheet/const.d.ts +0 -43
  142. package/lib/typescript/module/responsive-sheet/const.d.ts.map +0 -1
  143. package/src/responsive-sheet/ResponsiveSheet.native.tsx +0 -257
  144. package/src/responsive-sheet/const.ts +0 -53
@@ -1,226 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.RESPONSIVE_SHEET_BACKDROP_TESTID = void 0;
7
- exports.ResponsiveSheet = ResponsiveSheet;
8
- exports.default = void 0;
9
- var _react = _interopRequireWildcard(require("react"));
10
- var _reactNative = require("react-native");
11
- var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
12
- var _zIndex = require("../styles/z-index.js");
13
- var _useTheme = require("../theme/use-theme.js");
14
- var _const = require("./const.js");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
- /** Stable testID for the dimmed backdrop dismiss button. */
18
- const RESPONSIVE_SHEET_BACKDROP_TESTID = exports.RESPONSIVE_SHEET_BACKDROP_TESTID = 'bloom-responsive-sheet-backdrop';
19
-
20
- /**
21
- * Native variant of `<ResponsiveSheet>` (selected only by Metro).
22
- *
23
- * Uses `react-native-reanimated` to drive the same motion as the web/CSS
24
- * default fork: a shared `progress` value times 0 -> 1 on open and 1 -> 0 on
25
- * close, mapped to the panel translate/opacity and the backdrop opacity.
26
- * Native exit animations are safe here — the web-only `removeChild` crash does
27
- * not apply — so we keep the node mounted through the close timing and unmount
28
- * from the animation completion callback.
29
- *
30
- * The panel itself is measured (not percentage-translated): we offset by the
31
- * panel's own width/height so the hidden state sits fully off its side, which
32
- * is the reanimated-friendly equivalent of the web `translate(±100%)`.
33
- */
34
- function ResponsiveSheet({
35
- open,
36
- onClose,
37
- side = _const.DEFAULT_SIDE,
38
- breakpoint = _const.DEFAULT_BREAKPOINT,
39
- width = _const.DEFAULT_WIDTH,
40
- maxHeightRatio = _const.DEFAULT_MAX_HEIGHT_RATIO,
41
- inset,
42
- showHandle = true,
43
- dismissOnBackdrop = true,
44
- panelStyle,
45
- panelClassName,
46
- containerStyle,
47
- containerClassName,
48
- label = _const.DEFAULT_LABEL,
49
- children
50
- }) {
51
- const theme = (0, _useTheme.useTheme)();
52
- const {
53
- width: viewportWidth,
54
- height: viewportHeight
55
- } = (0, _reactNative.useWindowDimensions)();
56
-
57
- // Keep the tree mounted through the exit timing; unmount once it settles.
58
- const [mounted, setMounted] = (0, _react.useState)(open);
59
- // `progress`: 0 = fully hidden, 1 = fully shown. Drives both transform and
60
- // opacity so a single timing controls the whole transition.
61
- const progress = (0, _reactNativeReanimated.useSharedValue)(open ? 1 : 0);
62
- const isBottom = viewportWidth < breakpoint;
63
-
64
- // Measured panel extent along the travel axis. Falls back to the geometry
65
- // target so the very first frame is already off-screen before layout lands.
66
- const insetTop = inset?.top ?? 0;
67
- const insetBottom = inset?.bottom ?? 0;
68
- const insetLeft = inset?.left ?? 0;
69
- const insetRight = inset?.right ?? 0;
70
- const anchorInset = side === 'left' ? insetLeft : insetRight;
71
- const oppositeInset = side === 'left' ? insetRight : insetLeft;
72
- const sideWidth = (0, _react.useMemo)(() => {
73
- const available = viewportWidth - anchorInset - oppositeInset - _const.SIDE_SHEET_MIN_GUTTER;
74
- return Math.max(0, Math.min(width, available));
75
- }, [viewportWidth, anchorInset, oppositeInset, width]);
76
- const bottomMaxHeight = (0, _react.useMemo)(() => Math.round(viewportHeight * maxHeightRatio), [viewportHeight, maxHeightRatio]);
77
-
78
- // Travel distance for the hidden state: the panel's measured extent (height
79
- // for the bottom-sheet, width for the side-sheet), with the geometry target
80
- // as the pre-measurement fallback.
81
- const travel = (0, _reactNativeReanimated.useSharedValue)(isBottom ? bottomMaxHeight : sideWidth);
82
- (0, _react.useEffect)(() => {
83
- travel.value = isBottom ? bottomMaxHeight : sideWidth;
84
- }, [isBottom, bottomMaxHeight, sideWidth, travel]);
85
- const finishClose = (0, _react.useCallback)(() => {
86
- setMounted(false);
87
- }, []);
88
- (0, _react.useEffect)(() => {
89
- (0, _reactNativeReanimated.cancelAnimation)(progress);
90
- const timing = {
91
- duration: _const.ANIMATION_DURATION,
92
- easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.cubic)
93
- };
94
- if (open) {
95
- setMounted(true);
96
- progress.value = (0, _reactNativeReanimated.withTiming)(1, timing);
97
- return;
98
- }
99
- if (!mounted) return;
100
- progress.value = (0, _reactNativeReanimated.withTiming)(0, timing, finished => {
101
- if (finished) (0, _reactNativeReanimated.runOnJS)(finishClose)();
102
- });
103
- }, [open, mounted, progress, finishClose]);
104
- const handleBackdropPress = (0, _react.useCallback)(() => {
105
- if (dismissOnBackdrop) onClose();
106
- }, [dismissOnBackdrop, onClose]);
107
- const backdropAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
108
- opacity: progress.value * _const.BACKDROP_OPACITY
109
- }));
110
- const hiddenSign = side === 'left' ? -1 : 1;
111
- const panelAnimatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
112
- const hidden = 1 - progress.value;
113
- if (isBottom) {
114
- return {
115
- opacity: progress.value,
116
- transform: [{
117
- translateY: hidden * travel.value
118
- }]
119
- };
120
- }
121
- return {
122
- opacity: progress.value,
123
- transform: [{
124
- translateX: hidden * travel.value * hiddenSign
125
- }]
126
- };
127
- }, [isBottom, hiddenSign]);
128
- const measurePanel = (0, _react.useCallback)(e => {
129
- const measured = isBottom ? e.nativeEvent.layout.height : e.nativeEvent.layout.width;
130
- if (measured > 0) travel.value = measured;
131
- }, [isBottom, travel]);
132
- const panelGeometry = (0, _react.useMemo)(() => {
133
- if (isBottom) {
134
- return {
135
- left: 0,
136
- right: 0,
137
- bottom: 0,
138
- maxHeight: bottomMaxHeight,
139
- borderTopLeftRadius: _const.PANEL_RADIUS,
140
- borderTopRightRadius: _const.PANEL_RADIUS
141
- };
142
- }
143
- return {
144
- top: insetTop,
145
- bottom: insetBottom,
146
- [side]: anchorInset,
147
- width: sideWidth,
148
- borderRadius: _const.PANEL_RADIUS
149
- };
150
- }, [isBottom, bottomMaxHeight, insetTop, insetBottom, side, anchorInset, sideWidth]);
151
- if (!mounted) return null;
152
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
153
- style: [styles.root, containerStyle],
154
- ...(containerClassName ? {
155
- className: containerClassName
156
- } : {}),
157
- pointerEvents: "box-none",
158
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
159
- style: [styles.backdrop, backdropAnimatedStyle],
160
- pointerEvents: "auto",
161
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
162
- testID: RESPONSIVE_SHEET_BACKDROP_TESTID,
163
- accessibilityRole: "button",
164
- accessibilityLabel: `Dismiss ${label}`,
165
- onPress: handleBackdropPress,
166
- disabled: !dismissOnBackdrop,
167
- style: _reactNative.StyleSheet.absoluteFill
168
- })
169
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
170
- accessibilityViewIsModal: true,
171
- ...(panelClassName ? {
172
- className: panelClassName
173
- } : {}),
174
- onLayout: measurePanel,
175
- style: [styles.panel, {
176
- backgroundColor: theme.colors.background,
177
- shadowColor: theme.colors.shadow
178
- }, panelGeometry, panelAnimatedStyle, panelStyle],
179
- pointerEvents: "auto",
180
- children: [isBottom && showHandle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
181
- style: styles.handleRow,
182
- pointerEvents: "none",
183
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
184
- style: [styles.handle, {
185
- backgroundColor: theme.colors.border
186
- }]
187
- })
188
- }) : null, children]
189
- })]
190
- });
191
- }
192
- const styles = _reactNative.StyleSheet.create({
193
- root: {
194
- ..._reactNative.StyleSheet.absoluteFill,
195
- zIndex: _zIndex.Z_INDEX.fullscreen
196
- },
197
- backdrop: {
198
- ..._reactNative.StyleSheet.absoluteFill,
199
- backgroundColor: '#000'
200
- },
201
- panel: {
202
- position: 'absolute',
203
- overflow: 'hidden',
204
- shadowOpacity: 0.18,
205
- shadowRadius: 24,
206
- shadowOffset: {
207
- width: 0,
208
- height: 8
209
- },
210
- elevation: 12
211
- },
212
- handleRow: {
213
- width: '100%',
214
- alignItems: 'center',
215
- paddingTop: 8,
216
- paddingBottom: 4
217
- },
218
- handle: {
219
- width: _const.HANDLE_WIDTH,
220
- height: _const.HANDLE_HEIGHT,
221
- borderRadius: _const.HANDLE_RADIUS,
222
- opacity: 0.5
223
- }
224
- });
225
- var _default = exports.default = ResponsiveSheet;
226
- //# sourceMappingURL=ResponsiveSheet.native.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_zIndex","_useTheme","_const","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RESPONSIVE_SHEET_BACKDROP_TESTID","exports","ResponsiveSheet","open","onClose","side","DEFAULT_SIDE","breakpoint","DEFAULT_BREAKPOINT","width","DEFAULT_WIDTH","maxHeightRatio","DEFAULT_MAX_HEIGHT_RATIO","inset","showHandle","dismissOnBackdrop","panelStyle","panelClassName","containerStyle","containerClassName","label","DEFAULT_LABEL","children","theme","useTheme","viewportWidth","height","viewportHeight","useWindowDimensions","mounted","setMounted","useState","progress","useSharedValue","isBottom","insetTop","top","insetBottom","bottom","insetLeft","left","insetRight","right","anchorInset","oppositeInset","sideWidth","useMemo","available","SIDE_SHEET_MIN_GUTTER","Math","max","min","bottomMaxHeight","round","travel","useEffect","value","finishClose","useCallback","cancelAnimation","timing","duration","ANIMATION_DURATION","easing","Easing","out","cubic","withTiming","finished","runOnJS","handleBackdropPress","backdropAnimatedStyle","useAnimatedStyle","opacity","BACKDROP_OPACITY","hiddenSign","panelAnimatedStyle","hidden","transform","translateY","translateX","measurePanel","measured","nativeEvent","layout","panelGeometry","maxHeight","borderTopLeftRadius","PANEL_RADIUS","borderTopRightRadius","borderRadius","jsxs","View","style","styles","root","className","pointerEvents","jsx","backdrop","Pressable","testID","accessibilityRole","accessibilityLabel","onPress","disabled","StyleSheet","absoluteFill","accessibilityViewIsModal","onLayout","panel","backgroundColor","colors","background","shadowColor","shadow","handleRow","handle","border","create","zIndex","Z_INDEX","fullscreen","position","overflow","shadowOpacity","shadowRadius","shadowOffset","elevation","alignItems","paddingTop","paddingBottom","HANDLE_WIDTH","HANDLE_HEIGHT","HANDLE_RADIUS","_default"],"sourceRoot":"../../../src","sources":["responsive-sheet/ResponsiveSheet.native.tsx"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AASA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAaiB,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,w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"__esModule", {
4
- value: true
5
- });
6
- exports.SIDE_SHEET_MIN_GUTTER = exports.PANEL_RADIUS = exports.HANDLE_WIDTH = exports.HANDLE_RADIUS = exports.HANDLE_HEIGHT = exports.EASE_OUT = exports.DEFAULT_WIDTH = exports.DEFAULT_SIDE = exports.DEFAULT_MAX_HEIGHT_RATIO = exports.DEFAULT_LABEL = exports.DEFAULT_BREAKPOINT = exports.BACKDROP_OPACITY = exports.ANIMATION_DURATION = void 0;
7
- /**
8
- * Shared default constants for `ResponsiveSheet`.
9
- *
10
- * Platform-agnostic — imported by both the default/web CSS implementation
11
- * (`ResponsiveSheet.tsx`) and the native reanimated implementation
12
- * (`ResponsiveSheet.native.tsx`) so the two variants stay in lockstep.
13
- */
14
-
15
- /** Below this viewport width the sheet renders as a bottom-sheet. */
16
- const DEFAULT_BREAKPOINT = exports.DEFAULT_BREAKPOINT = 768;
17
-
18
- /** Side-sheet width (px) on wide screens. Capped to fit the viewport. */
19
- const DEFAULT_WIDTH = exports.DEFAULT_WIDTH = 460;
20
-
21
- /** Bottom-sheet maximum height as a fraction of the viewport height. */
22
- const DEFAULT_MAX_HEIGHT_RATIO = exports.DEFAULT_MAX_HEIGHT_RATIO = 0.9;
23
-
24
- /** Anchored edge of the side-sheet on wide screens. */
25
- const DEFAULT_SIDE = exports.DEFAULT_SIDE = 'left';
26
-
27
- /**
28
- * Open/close transition duration (ms). ~280–300ms ease-out reads as smooth
29
- * without feeling sluggish; shared by the CSS transition and the native
30
- * reanimated timing so both platforms match.
31
- */
32
- const ANIMATION_DURATION = exports.ANIMATION_DURATION = 280;
33
-
34
- /**
35
- * Standard CSS approximation of reanimated's `Easing.out(Easing.cubic)` so the
36
- * web transition curve matches the native one.
37
- */
38
- const EASE_OUT = exports.EASE_OUT = 'cubic-bezier(0.33, 1, 0.68, 1)';
39
-
40
- /** Corner radius for the side-sheet panel and the top of the bottom-sheet. */
41
- const PANEL_RADIUS = exports.PANEL_RADIUS = 20;
42
-
43
- /** Backdrop dim opacity once fully shown (matches `bg-black/40`). */
44
- const BACKDROP_OPACITY = exports.BACKDROP_OPACITY = 0.4;
45
-
46
- /** Drag-handle pill geometry for the bottom-sheet. */
47
- const HANDLE_WIDTH = exports.HANDLE_WIDTH = 36;
48
- const HANDLE_HEIGHT = exports.HANDLE_HEIGHT = 5;
49
- const HANDLE_RADIUS = exports.HANDLE_RADIUS = 3;
50
-
51
- /**
52
- * Minimum gutter kept between a wide side-sheet and the opposite viewport edge
53
- * when capping its width, so the panel never spans the full screen on a narrow
54
- * desktop window that is still above the breakpoint.
55
- */
56
- const SIDE_SHEET_MIN_GUTTER = exports.SIDE_SHEET_MIN_GUTTER = 24;
57
-
58
- /** A11y label fallback when the host does not provide one. */
59
- const DEFAULT_LABEL = exports.DEFAULT_LABEL = 'Sheet';
60
- //# sourceMappingURL=const.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["DEFAULT_BREAKPOINT","exports","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;AACO,MAAMA,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,GAAG;;AAErC;AACO,MAAME,aAAa,GAAAD,OAAA,CAAAC,aAAA,GAAG,GAAG;;AAEhC;AACO,MAAMC,wBAAwB,GAAAF,OAAA,CAAAE,wBAAA,GAAG,GAAG;;AAE3C;AACO,MAAMC,YAAY,GAAAH,OAAA,CAAAG,YAAA,GAAG,MAAe;;AAE3C;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAAJ,OAAA,CAAAI,kBAAA,GAAG,GAAG;;AAErC;AACA;AACA;AACA;AACO,MAAMC,QAAQ,GAAAL,OAAA,CAAAK,QAAA,GAAG,gCAAgC;;AAExD;AACO,MAAMC,YAAY,GAAAN,OAAA,CAAAM,YAAA,GAAG,EAAE;;AAE9B;AACO,MAAMC,gBAAgB,GAAAP,OAAA,CAAAO,gBAAA,GAAG,GAAG;;AAEnC;AACO,MAAMC,YAAY,GAAAR,OAAA,CAAAQ,YAAA,GAAG,EAAE;AACvB,MAAMC,aAAa,GAAAT,OAAA,CAAAS,aAAA,GAAG,CAAC;AACvB,MAAMC,aAAa,GAAAV,OAAA,CAAAU,aAAA,GAAG,CAAC;;AAE9B;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAAX,OAAA,CAAAW,qBAAA,GAAG,EAAE;;AAEvC;AACO,MAAMC,aAAa,GAAAZ,OAAA,CAAAY,aAAA,GAAG,OAAO","ignoreList":[]}
@@ -1,219 +0,0 @@
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
@@ -1 +0,0 @@
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,GAAG5B,aAAa;EAC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AAY;IACnB0B,MAAM,EAAE5B,aAAa;IACrB8E,YAAY,EAAE7E,aAAa;IAC3B6D,OAAO,EAAE;EACX;AACF,CAAC,CAAC;AAEF,eAAepD,eAAe","ignoreList":[]}
@@ -1,56 +0,0 @@
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
@@ -1 +0,0 @@
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":[]}
@@ -1,20 +0,0 @@
1
- import type { ResponsiveSheetProps } from './types';
2
- /** Stable testID for the dimmed backdrop dismiss button. */
3
- export declare const RESPONSIVE_SHEET_BACKDROP_TESTID = "bloom-responsive-sheet-backdrop";
4
- /**
5
- * Native variant of `<ResponsiveSheet>` (selected only by Metro).
6
- *
7
- * Uses `react-native-reanimated` to drive the same motion as the web/CSS
8
- * default fork: a shared `progress` value times 0 -> 1 on open and 1 -> 0 on
9
- * close, mapped to the panel translate/opacity and the backdrop opacity.
10
- * Native exit animations are safe here — the web-only `removeChild` crash does
11
- * not apply — so we keep the node mounted through the close timing and unmount
12
- * from the animation completion callback.
13
- *
14
- * The panel itself is measured (not percentage-translated): we offset by the
15
- * panel's own width/height so the hidden state sits fully off its side, which
16
- * is the reanimated-friendly equivalent of the web `translate(±100%)`.
17
- */
18
- export declare function ResponsiveSheet({ open, onClose, side, breakpoint, width, maxHeightRatio, inset, showHandle, dismissOnBackdrop, panelStyle, panelClassName, containerStyle, containerClassName, label, children, }: ResponsiveSheetProps): import("react/jsx-runtime").JSX.Element | null;
19
- export default ResponsiveSheet;
20
- //# sourceMappingURL=ResponsiveSheet.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResponsiveSheet.native.d.ts","sourceRoot":"","sources":["../../../../src/responsive-sheet/ResponsiveSheet.native.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,4DAA4D;AAC5D,eAAO,MAAM,gCAAgC,oCAAoC,CAAC;AAElF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,IAAmB,EACnB,UAA+B,EAC/B,KAAqB,EACrB,cAAyC,EACzC,KAAK,EACL,UAAiB,EACjB,iBAAwB,EACxB,UAAU,EACV,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,KAAqB,EACrB,QAAQ,GACT,EAAE,oBAAoB,kDAqJtB;AAiCD,eAAe,eAAe,CAAC"}