@oxyhq/bloom 0.30.4 → 0.30.6
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/lib/commonjs/avatar/Avatar.js +4 -2
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js +744 -0
- package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -0
- package/lib/commonjs/bottom-sheet/index.js +24 -694
- package/lib/commonjs/bottom-sheet/index.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.web.js +64 -0
- package/lib/commonjs/bottom-sheet/index.web.js.map +1 -0
- package/lib/commonjs/dialog/Dialog.js +2 -2
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/DialogBottomSheet.js +2 -2
- package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/commonjs/dialog/SheetShell.js +2 -2
- package/lib/commonjs/dialog/SheetShell.js.map +1 -1
- package/lib/commonjs/index.js +44 -44
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +66 -66
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/module/avatar/Avatar.js +4 -2
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/bottom-sheet/BottomSheetBase.js +741 -0
- package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -0
- package/lib/module/bottom-sheet/index.js +27 -696
- package/lib/module/bottom-sheet/index.js.map +1 -1
- package/lib/module/bottom-sheet/index.web.js +63 -0
- package/lib/module/bottom-sheet/index.web.js.map +1 -0
- package/lib/module/dialog/Dialog.js +1 -1
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/DialogBottomSheet.js +1 -1
- package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
- package/lib/module/dialog/SheetShell.js +1 -1
- package/lib/module/dialog/SheetShell.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/avatar/types.d.ts +4 -3
- package/lib/typescript/commonjs/avatar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts +127 -0
- package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -0
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts +2 -90
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts +7 -0
- package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.web.d.ts +2 -2
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/module/avatar/types.d.ts +4 -3
- package/lib/typescript/module/avatar/types.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts +127 -0
- package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -0
- package/lib/typescript/module/bottom-sheet/index.d.ts +2 -90
- package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.web.d.ts +7 -0
- package/lib/typescript/module/bottom-sheet/index.web.d.ts.map +1 -0
- package/lib/typescript/module/index.web.d.ts +2 -2
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/__tests__/BottomSheetWebFork.test.ts +66 -0
- package/src/avatar/Avatar.tsx +4 -2
- package/src/avatar/types.ts +4 -3
- package/src/bottom-sheet/BottomSheetBase.tsx +866 -0
- package/src/bottom-sheet/index.tsx +26 -821
- package/src/bottom-sheet/index.web.tsx +66 -0
- package/src/index.web.ts +2 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { StyleSheet, type ViewStyle } from 'react-native';
|
|
4
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
5
|
+
import { Portal } from '../portal/index.web';
|
|
6
|
+
import { Z_INDEX } from '../styles/z-index';
|
|
7
|
+
import {
|
|
8
|
+
BottomSheetBase,
|
|
9
|
+
type BottomSheetProps,
|
|
10
|
+
type BottomSheetRef,
|
|
11
|
+
type BottomSheetShellProps,
|
|
12
|
+
} from './BottomSheetBase';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Web shell: bloom's stable DOM `<Portal>` (a single, reused
|
|
16
|
+
* `#bloom-portal-root` in `document.body`, created in a layout effect and never
|
|
17
|
+
* torn down) + a fixed, full-viewport `<GestureHandlerRootView>`.
|
|
18
|
+
*
|
|
19
|
+
* Why NOT RN-Web's `<Modal>` (which native uses): RN-Web's `Modal` mounts
|
|
20
|
+
* through `ModalPortal`, which appends its host `<div>` DURING RENDER and
|
|
21
|
+
* removes it in an unmount effect that also nulls its ref. Under React 19
|
|
22
|
+
* concurrent rendering / StrictMode, that host node is orphaned — the sheet
|
|
23
|
+
* mounts but its DOM lands in a detached node and never paints. Bloom's Portal
|
|
24
|
+
* has no render-phase side effect and a stable host, so the sheet paints
|
|
25
|
+
* reliably. This is the SAME portal the `Dialog` `center`/side paths already
|
|
26
|
+
* use on web.
|
|
27
|
+
*
|
|
28
|
+
* `keyboardHeight` / `onRequestClose` are native-shell concerns (the browser
|
|
29
|
+
* owns keyboard layout and back-button semantics) and are intentionally unused
|
|
30
|
+
* here.
|
|
31
|
+
*/
|
|
32
|
+
function WebShell({ children }: BottomSheetShellProps) {
|
|
33
|
+
return (
|
|
34
|
+
<Portal>
|
|
35
|
+
<GestureHandlerRootView style={webStyles.rootView} pointerEvents="box-none">
|
|
36
|
+
{children}
|
|
37
|
+
</GestureHandlerRootView>
|
|
38
|
+
</Portal>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const BottomSheet = forwardRef((props: BottomSheetProps, ref: React.ForwardedRef<BottomSheetRef>) => (
|
|
43
|
+
<BottomSheetBase {...props} ref={ref} Shell={WebShell} />
|
|
44
|
+
));
|
|
45
|
+
|
|
46
|
+
BottomSheet.displayName = 'BottomSheet';
|
|
47
|
+
|
|
48
|
+
const webStyles = StyleSheet.create({
|
|
49
|
+
rootView: {
|
|
50
|
+
// The bloom Portal root is `position: fixed; inset: 0; pointer-events:
|
|
51
|
+
// none`; this fixed, full-viewport root re-enables pointer events for
|
|
52
|
+
// the sheet's own interactive descendants (backdrop, sheet) while empty
|
|
53
|
+
// gaps stay click-through (`box-none`). `StyleSheet.absoluteFill` from
|
|
54
|
+
// the sheet body then anchors to this box.
|
|
55
|
+
position: 'fixed' as ViewStyle['position'],
|
|
56
|
+
top: 0,
|
|
57
|
+
left: 0,
|
|
58
|
+
right: 0,
|
|
59
|
+
bottom: 0,
|
|
60
|
+
zIndex: Z_INDEX.portalRoot,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export type { BottomSheetProps, BottomSheetRef };
|
|
65
|
+
export default BottomSheet;
|
|
66
|
+
export { BottomSheet };
|
package/src/index.web.ts
CHANGED
|
@@ -144,8 +144,8 @@ export { Combobox } from './combobox/index.web';
|
|
|
144
144
|
export type { ComboboxProps, ComboboxOption } from './combobox/index.web';
|
|
145
145
|
|
|
146
146
|
// Bottom sheet
|
|
147
|
-
export { BottomSheet } from './bottom-sheet';
|
|
148
|
-
export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet';
|
|
147
|
+
export { BottomSheet } from './bottom-sheet/index.web';
|
|
148
|
+
export type { BottomSheetRef, BottomSheetProps } from './bottom-sheet/index.web';
|
|
149
149
|
|
|
150
150
|
// Data display
|
|
151
151
|
export * from './card';
|