@oxyhq/bloom 0.8.1 → 0.8.3

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 (142) hide show
  1. package/lib/commonjs/avatar/Avatar.js +2 -1
  2. package/lib/commonjs/avatar/Avatar.js.map +1 -1
  3. package/lib/commonjs/badge/Badge.js +2 -1
  4. package/lib/commonjs/badge/Badge.js.map +1 -1
  5. package/lib/commonjs/bottom-sheet/index.js +3 -2
  6. package/lib/commonjs/bottom-sheet/index.js.map +1 -1
  7. package/lib/commonjs/context-menu/index.web.js +5 -2
  8. package/lib/commonjs/context-menu/index.web.js.map +1 -1
  9. package/lib/commonjs/dialog/CenteredDialog.web.js +4 -2
  10. package/lib/commonjs/dialog/CenteredDialog.web.js.map +1 -1
  11. package/lib/commonjs/dialog/Dialog.web.js +4 -2
  12. package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
  13. package/lib/commonjs/dialog/SheetShell.js +2 -1
  14. package/lib/commonjs/dialog/SheetShell.js.map +1 -1
  15. package/lib/commonjs/index.js +14 -0
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/index.web.js +14 -0
  18. package/lib/commonjs/index.web.js.map +1 -1
  19. package/lib/commonjs/menu/index.web.js +45 -21
  20. package/lib/commonjs/menu/index.web.js.map +1 -1
  21. package/lib/commonjs/popover/index.web.js +5 -2
  22. package/lib/commonjs/popover/index.web.js.map +1 -1
  23. package/lib/commonjs/portal/index.js +2 -1
  24. package/lib/commonjs/portal/index.js.map +1 -1
  25. package/lib/commonjs/portal/index.web.js +2 -1
  26. package/lib/commonjs/portal/index.web.js.map +1 -1
  27. package/lib/commonjs/prompt-input/PromptInput.js +4 -3
  28. package/lib/commonjs/prompt-input/PromptInput.js.map +1 -1
  29. package/lib/commonjs/select/index.web.js +5 -2
  30. package/lib/commonjs/select/index.web.js.map +1 -1
  31. package/lib/commonjs/styles/index.js +13 -0
  32. package/lib/commonjs/styles/index.js.map +1 -1
  33. package/lib/commonjs/styles/z-index.js +52 -0
  34. package/lib/commonjs/styles/z-index.js.map +1 -0
  35. package/lib/commonjs/tooltip/index.web.js +2 -1
  36. package/lib/commonjs/tooltip/index.web.js.map +1 -1
  37. package/lib/module/avatar/Avatar.js +2 -1
  38. package/lib/module/avatar/Avatar.js.map +1 -1
  39. package/lib/module/badge/Badge.js +2 -1
  40. package/lib/module/badge/Badge.js.map +1 -1
  41. package/lib/module/bottom-sheet/index.js +3 -2
  42. package/lib/module/bottom-sheet/index.js.map +1 -1
  43. package/lib/module/context-menu/index.web.js +6 -3
  44. package/lib/module/context-menu/index.web.js.map +1 -1
  45. package/lib/module/dialog/CenteredDialog.web.js +4 -2
  46. package/lib/module/dialog/CenteredDialog.web.js.map +1 -1
  47. package/lib/module/dialog/Dialog.web.js +4 -2
  48. package/lib/module/dialog/Dialog.web.js.map +1 -1
  49. package/lib/module/dialog/SheetShell.js +2 -1
  50. package/lib/module/dialog/SheetShell.js.map +1 -1
  51. package/lib/module/index.js +1 -1
  52. package/lib/module/index.js.map +1 -1
  53. package/lib/module/index.web.js +1 -1
  54. package/lib/module/index.web.js.map +1 -1
  55. package/lib/module/menu/index.web.js +47 -23
  56. package/lib/module/menu/index.web.js.map +1 -1
  57. package/lib/module/popover/index.web.js +4 -2
  58. package/lib/module/popover/index.web.js.map +1 -1
  59. package/lib/module/portal/index.js +2 -1
  60. package/lib/module/portal/index.js.map +1 -1
  61. package/lib/module/portal/index.web.js +2 -1
  62. package/lib/module/portal/index.web.js.map +1 -1
  63. package/lib/module/prompt-input/PromptInput.js +4 -3
  64. package/lib/module/prompt-input/PromptInput.js.map +1 -1
  65. package/lib/module/select/index.web.js +4 -2
  66. package/lib/module/select/index.web.js.map +1 -1
  67. package/lib/module/styles/index.js +1 -0
  68. package/lib/module/styles/index.js.map +1 -1
  69. package/lib/module/styles/z-index.js +45 -0
  70. package/lib/module/styles/z-index.js.map +1 -0
  71. package/lib/module/tooltip/index.web.js +2 -1
  72. package/lib/module/tooltip/index.web.js.map +1 -1
  73. package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
  74. package/lib/typescript/commonjs/badge/Badge.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
  76. package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts.map +1 -1
  78. package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/index.d.ts +1 -1
  81. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/index.web.d.ts +1 -1
  83. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/menu/index.web.d.ts +1 -1
  85. package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/menu/types.d.ts +1 -0
  87. package/lib/typescript/commonjs/menu/types.d.ts.map +1 -1
  88. package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
  89. package/lib/typescript/commonjs/portal/index.d.ts.map +1 -1
  90. package/lib/typescript/commonjs/portal/index.web.d.ts.map +1 -1
  91. package/lib/typescript/commonjs/prompt-input/PromptInput.d.ts.map +1 -1
  92. package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
  93. package/lib/typescript/commonjs/styles/index.d.ts +1 -0
  94. package/lib/typescript/commonjs/styles/index.d.ts.map +1 -1
  95. package/lib/typescript/commonjs/styles/z-index.d.ts +49 -0
  96. package/lib/typescript/commonjs/styles/z-index.d.ts.map +1 -0
  97. package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
  98. package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
  99. package/lib/typescript/module/badge/Badge.d.ts.map +1 -1
  100. package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
  101. package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
  102. package/lib/typescript/module/dialog/CenteredDialog.web.d.ts.map +1 -1
  103. package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
  104. package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -1
  105. package/lib/typescript/module/index.d.ts +1 -1
  106. package/lib/typescript/module/index.d.ts.map +1 -1
  107. package/lib/typescript/module/index.web.d.ts +1 -1
  108. package/lib/typescript/module/index.web.d.ts.map +1 -1
  109. package/lib/typescript/module/menu/index.web.d.ts +1 -1
  110. package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
  111. package/lib/typescript/module/menu/types.d.ts +1 -0
  112. package/lib/typescript/module/menu/types.d.ts.map +1 -1
  113. package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
  114. package/lib/typescript/module/portal/index.d.ts.map +1 -1
  115. package/lib/typescript/module/portal/index.web.d.ts.map +1 -1
  116. package/lib/typescript/module/prompt-input/PromptInput.d.ts.map +1 -1
  117. package/lib/typescript/module/select/index.web.d.ts.map +1 -1
  118. package/lib/typescript/module/styles/index.d.ts +1 -0
  119. package/lib/typescript/module/styles/index.d.ts.map +1 -1
  120. package/lib/typescript/module/styles/z-index.d.ts +49 -0
  121. package/lib/typescript/module/styles/z-index.d.ts.map +1 -0
  122. package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
  123. package/package.json +1 -1
  124. package/src/avatar/Avatar.tsx +2 -1
  125. package/src/badge/Badge.tsx +2 -1
  126. package/src/bottom-sheet/index.tsx +3 -2
  127. package/src/context-menu/index.web.tsx +5 -2
  128. package/src/dialog/CenteredDialog.web.tsx +4 -2
  129. package/src/dialog/Dialog.web.tsx +4 -2
  130. package/src/dialog/SheetShell.tsx +2 -1
  131. package/src/index.ts +1 -1
  132. package/src/index.web.ts +1 -1
  133. package/src/menu/index.web.tsx +51 -23
  134. package/src/menu/types.ts +1 -0
  135. package/src/popover/index.web.tsx +5 -2
  136. package/src/portal/index.tsx +2 -1
  137. package/src/portal/index.web.tsx +2 -1
  138. package/src/prompt-input/PromptInput.tsx +4 -3
  139. package/src/select/index.web.tsx +5 -2
  140. package/src/styles/index.ts +1 -0
  141. package/src/styles/z-index.ts +47 -0
  142. package/src/tooltip/index.web.tsx +2 -1
@@ -11,6 +11,7 @@ import { Pressable, StyleSheet, View } from 'react-native';
11
11
 
12
12
  import { useTheme } from '../theme/use-theme';
13
13
  import { Portal } from '../portal/index.web';
14
+ import { createOverlayZIndex } from '../styles/z-index';
14
15
  import { PopoverContext, usePopoverContext } from './context';
15
16
  import type {
16
17
  PopoverContentProps,
@@ -32,6 +33,8 @@ export type {
32
33
 
33
34
  export { usePopoverContext };
34
35
 
36
+ const popoverZIndex = createOverlayZIndex();
37
+
35
38
  /**
36
39
  * Web self-contained control. Unlike native (which proxies a `BottomSheet`
37
40
  * via `useDialogControl`), the web popover owns its own open state and
@@ -307,12 +310,12 @@ const styles = StyleSheet.create({
307
310
  left: 0,
308
311
  right: 0,
309
312
  bottom: 0,
310
- zIndex: 50,
313
+ zIndex: popoverZIndex.backdrop,
311
314
  pointerEvents: 'auto',
312
315
  },
313
316
  panel: {
314
317
  position: 'fixed' as 'absolute',
315
- zIndex: 60,
318
+ zIndex: popoverZIndex.surface,
316
319
  borderRadius: 12,
317
320
  borderWidth: 1,
318
321
  paddingVertical: 4,
@@ -11,6 +11,7 @@ import React, {
11
11
  useState,
12
12
  } from 'react';
13
13
  import { View, StyleSheet, Platform } from 'react-native';
14
+ import { Z_INDEX } from '../styles/z-index';
14
15
 
15
16
  type Component = React.ReactElement;
16
17
 
@@ -120,6 +121,6 @@ const styles = StyleSheet.create({
120
121
  right: 0,
121
122
  bottom: 0,
122
123
  pointerEvents: 'box-none',
123
- zIndex: 999999,
124
+ zIndex: Z_INDEX.portalRoot,
124
125
  },
125
126
  });
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import React, { Fragment, memo, useLayoutEffect, useState } from 'react';
17
17
  import { createPortal } from 'react-dom';
18
+ import { Z_INDEX } from '../styles/z-index';
18
19
 
19
20
  /**
20
21
  * Render children into a stable container appended to `document.body`.
@@ -52,7 +53,7 @@ function getPortalRoot(): HTMLElement | null {
52
53
  root.style.pointerEvents = 'none';
53
54
  // Above the document flow; individual portaled components can use
54
55
  // their own z-index for stacking among themselves.
55
- root.style.zIndex = '999999';
56
+ root.style.zIndex = String(Z_INDEX.portalRoot);
56
57
  document.body.appendChild(root);
57
58
  }
58
59
  return root;
@@ -11,6 +11,7 @@ import {
11
11
 
12
12
  import { useTheme } from '../theme/use-theme';
13
13
  import { Portal } from '../portal';
14
+ import { Z_INDEX } from '../styles/z-index';
14
15
  import { PromptInputContext, type Attachment } from './context';
15
16
  import { PromptInputTextarea } from './Textarea';
16
17
  import { PromptInputActions } from './Actions';
@@ -198,7 +199,7 @@ export function PromptInput({
198
199
  position: 'absolute',
199
200
  top: 8,
200
201
  right: 8,
201
- zIndex: 10,
202
+ zIndex: Z_INDEX.floating,
202
203
  backgroundColor: theme.colors.background,
203
204
  borderRadius: 9999,
204
205
  padding: 6,
@@ -233,7 +234,7 @@ export function PromptInput({
233
234
  style={[
234
235
  StyleSheet.absoluteFill,
235
236
  {
236
- zIndex: 9998,
237
+ zIndex: Z_INDEX.fullscreen,
237
238
  backgroundColor: theme.colors.background,
238
239
  // Opt back in from the Portal root's `pointer-events: none`
239
240
  // (web only — harmless on native).
@@ -247,7 +248,7 @@ export function PromptInput({
247
248
  position: 'absolute',
248
249
  top: 16,
249
250
  right: 16,
250
- zIndex: 50,
251
+ zIndex: Z_INDEX.fullscreenControl,
251
252
  padding: 8,
252
253
  backgroundColor: theme.colors.background,
253
254
  borderRadius: 9999,
@@ -4,6 +4,7 @@ import { Pressable, StyleSheet, View } from 'react-native';
4
4
  import { useTheme } from '../theme/use-theme';
5
5
  import { Text } from '../typography';
6
6
  import { Portal } from '../portal/index.web';
7
+ import { createOverlayZIndex } from '../styles/z-index';
7
8
  import { RadioIndicator } from '../radio-indicator';
8
9
  import { useInteractionState } from '../hooks/useInteractionState';
9
10
  import {
@@ -25,6 +26,8 @@ import type {
25
26
 
26
27
  export { useItemContext };
27
28
 
29
+ const selectZIndex = createOverlayZIndex();
30
+
28
31
  // ---------------------------------------------------------------------------
29
32
  // Context
30
33
  // ---------------------------------------------------------------------------
@@ -337,13 +340,13 @@ const styles = StyleSheet.create({
337
340
  left: 0,
338
341
  right: 0,
339
342
  bottom: 0,
340
- zIndex: 50,
343
+ zIndex: selectZIndex.backdrop,
341
344
  // Opt back in from the Portal root's `pointer-events: none`.
342
345
  pointerEvents: 'auto',
343
346
  },
344
347
  dropdown: {
345
348
  position: 'absolute',
346
- zIndex: 60,
349
+ zIndex: selectZIndex.surface,
347
350
  borderRadius: 8,
348
351
  borderWidth: 1,
349
352
  overflow: 'hidden',
@@ -1,5 +1,6 @@
1
1
  export { atoms, flatten } from './atoms';
2
2
  export type { ViewStyleProp, TextStyleProp } from './atoms';
3
3
  export * as tokens from './tokens';
4
+ export { Z_INDEX, zIndex } from './z-index';
4
5
  export { web, native, ios, android, platform, select } from './platform';
5
6
  export { SUPPORTS_NATIVE_DRIVER } from './native-driver';
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Shared stacking scale for Bloom primitives.
3
+ *
4
+ * Keep component layers on this scale instead of introducing local magic
5
+ * numbers. App-specific surfaces can still sit above Bloom's inline layers,
6
+ * while portaled overlays use `portalRoot` as the document-level host.
7
+ */
8
+ export const Z_INDEX = {
9
+ base: 0,
10
+ raised: 1,
11
+ floating: 10,
12
+ sticky: 20,
13
+ dropdown: 40,
14
+ dropdownSurface: 41,
15
+ overlayBackdrop: 50,
16
+ overlaySurface: 60,
17
+ tooltip: 70,
18
+ toast: 80,
19
+ fullscreen: 90,
20
+ fullscreenControl: 91,
21
+ sheetHandle: 100,
22
+ portalRoot: 999999,
23
+ } as const;
24
+
25
+ export const Z_INDEX_LAYER_STEP = 10;
26
+
27
+ function layerOffset(layer = 0) {
28
+ return Math.max(0, Math.floor(layer)) * Z_INDEX_LAYER_STEP;
29
+ }
30
+
31
+ export function createDropdownZIndex(layer = 0) {
32
+ const offset = layerOffset(layer);
33
+ return {
34
+ root: Z_INDEX.dropdown + offset,
35
+ surface: Z_INDEX.dropdownSurface + offset,
36
+ } as const;
37
+ }
38
+
39
+ export function createOverlayZIndex(layer = 0) {
40
+ const offset = layerOffset(layer);
41
+ return {
42
+ backdrop: Z_INDEX.overlayBackdrop + offset,
43
+ surface: Z_INDEX.overlaySurface + offset,
44
+ } as const;
45
+ }
46
+
47
+ export const zIndex = Z_INDEX;
@@ -3,6 +3,7 @@ import { Pressable, StyleSheet, View } from 'react-native';
3
3
 
4
4
  import { useTheme } from '../theme/use-theme';
5
5
  import { atoms as a, flatten } from '../styles';
6
+ import { Z_INDEX } from '../styles/z-index';
6
7
  import {
7
8
  ARROW_SIZE,
8
9
  BUBBLE_MAX_WIDTH,
@@ -154,6 +155,6 @@ const webStyles = StyleSheet.create({
154
155
  left: 0,
155
156
  right: 0,
156
157
  bottom: 0,
157
- zIndex: 40,
158
+ zIndex: Z_INDEX.tooltip,
158
159
  },
159
160
  });