@oxyhq/bloom 0.30.4 → 0.30.5

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 (54) hide show
  1. package/lib/commonjs/bottom-sheet/BottomSheetBase.js +731 -0
  2. package/lib/commonjs/bottom-sheet/BottomSheetBase.js.map +1 -0
  3. package/lib/commonjs/bottom-sheet/index.js +24 -694
  4. package/lib/commonjs/bottom-sheet/index.js.map +1 -1
  5. package/lib/commonjs/bottom-sheet/index.web.js +64 -0
  6. package/lib/commonjs/bottom-sheet/index.web.js.map +1 -0
  7. package/lib/commonjs/dialog/Dialog.js +2 -2
  8. package/lib/commonjs/dialog/Dialog.js.map +1 -1
  9. package/lib/commonjs/dialog/DialogBottomSheet.js +2 -2
  10. package/lib/commonjs/dialog/DialogBottomSheet.js.map +1 -1
  11. package/lib/commonjs/dialog/SheetShell.js +2 -2
  12. package/lib/commonjs/dialog/SheetShell.js.map +1 -1
  13. package/lib/commonjs/index.js +44 -44
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/index.web.js +66 -66
  16. package/lib/commonjs/index.web.js.map +1 -1
  17. package/lib/module/bottom-sheet/BottomSheetBase.js +728 -0
  18. package/lib/module/bottom-sheet/BottomSheetBase.js.map +1 -0
  19. package/lib/module/bottom-sheet/index.js +27 -696
  20. package/lib/module/bottom-sheet/index.js.map +1 -1
  21. package/lib/module/bottom-sheet/index.web.js +63 -0
  22. package/lib/module/bottom-sheet/index.web.js.map +1 -0
  23. package/lib/module/dialog/Dialog.js +1 -1
  24. package/lib/module/dialog/Dialog.js.map +1 -1
  25. package/lib/module/dialog/DialogBottomSheet.js +1 -1
  26. package/lib/module/dialog/DialogBottomSheet.js.map +1 -1
  27. package/lib/module/dialog/SheetShell.js +1 -1
  28. package/lib/module/dialog/SheetShell.js.map +1 -1
  29. package/lib/module/index.js +1 -1
  30. package/lib/module/index.js.map +1 -1
  31. package/lib/module/index.web.js +1 -1
  32. package/lib/module/index.web.js.map +1 -1
  33. package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts +127 -0
  34. package/lib/typescript/commonjs/bottom-sheet/BottomSheetBase.d.ts.map +1 -0
  35. package/lib/typescript/commonjs/bottom-sheet/index.d.ts +2 -90
  36. package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts +7 -0
  38. package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/index.web.d.ts +2 -2
  40. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  41. package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts +127 -0
  42. package/lib/typescript/module/bottom-sheet/BottomSheetBase.d.ts.map +1 -0
  43. package/lib/typescript/module/bottom-sheet/index.d.ts +2 -90
  44. package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
  45. package/lib/typescript/module/bottom-sheet/index.web.d.ts +7 -0
  46. package/lib/typescript/module/bottom-sheet/index.web.d.ts.map +1 -0
  47. package/lib/typescript/module/index.web.d.ts +2 -2
  48. package/lib/typescript/module/index.web.d.ts.map +1 -1
  49. package/package.json +6 -1
  50. package/src/__tests__/BottomSheetWebFork.test.ts +66 -0
  51. package/src/bottom-sheet/BottomSheetBase.tsx +853 -0
  52. package/src/bottom-sheet/index.tsx +26 -821
  53. package/src/bottom-sheet/index.web.tsx +66 -0
  54. 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';