@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.
- package/lib/commonjs/avatar/Avatar.js +2 -1
- package/lib/commonjs/avatar/Avatar.js.map +1 -1
- package/lib/commonjs/badge/Badge.js +2 -1
- package/lib/commonjs/badge/Badge.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.js +3 -2
- package/lib/commonjs/bottom-sheet/index.js.map +1 -1
- package/lib/commonjs/context-menu/index.web.js +5 -2
- package/lib/commonjs/context-menu/index.web.js.map +1 -1
- package/lib/commonjs/dialog/CenteredDialog.web.js +4 -2
- package/lib/commonjs/dialog/CenteredDialog.web.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +4 -2
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/SheetShell.js +2 -1
- package/lib/commonjs/dialog/SheetShell.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +14 -0
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/menu/index.web.js +45 -21
- package/lib/commonjs/menu/index.web.js.map +1 -1
- package/lib/commonjs/popover/index.web.js +5 -2
- package/lib/commonjs/popover/index.web.js.map +1 -1
- package/lib/commonjs/portal/index.js +2 -1
- package/lib/commonjs/portal/index.js.map +1 -1
- package/lib/commonjs/portal/index.web.js +2 -1
- package/lib/commonjs/portal/index.web.js.map +1 -1
- package/lib/commonjs/prompt-input/PromptInput.js +4 -3
- package/lib/commonjs/prompt-input/PromptInput.js.map +1 -1
- package/lib/commonjs/select/index.web.js +5 -2
- package/lib/commonjs/select/index.web.js.map +1 -1
- package/lib/commonjs/styles/index.js +13 -0
- package/lib/commonjs/styles/index.js.map +1 -1
- package/lib/commonjs/styles/z-index.js +52 -0
- package/lib/commonjs/styles/z-index.js.map +1 -0
- package/lib/commonjs/tooltip/index.web.js +2 -1
- package/lib/commonjs/tooltip/index.web.js.map +1 -1
- package/lib/module/avatar/Avatar.js +2 -1
- package/lib/module/avatar/Avatar.js.map +1 -1
- package/lib/module/badge/Badge.js +2 -1
- package/lib/module/badge/Badge.js.map +1 -1
- package/lib/module/bottom-sheet/index.js +3 -2
- package/lib/module/bottom-sheet/index.js.map +1 -1
- package/lib/module/context-menu/index.web.js +6 -3
- package/lib/module/context-menu/index.web.js.map +1 -1
- package/lib/module/dialog/CenteredDialog.web.js +4 -2
- package/lib/module/dialog/CenteredDialog.web.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +4 -2
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/SheetShell.js +2 -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/module/menu/index.web.js +47 -23
- package/lib/module/menu/index.web.js.map +1 -1
- package/lib/module/popover/index.web.js +4 -2
- package/lib/module/popover/index.web.js.map +1 -1
- package/lib/module/portal/index.js +2 -1
- package/lib/module/portal/index.js.map +1 -1
- package/lib/module/portal/index.web.js +2 -1
- package/lib/module/portal/index.web.js.map +1 -1
- package/lib/module/prompt-input/PromptInput.js +4 -3
- package/lib/module/prompt-input/PromptInput.js.map +1 -1
- package/lib/module/select/index.web.js +4 -2
- package/lib/module/select/index.web.js.map +1 -1
- package/lib/module/styles/index.js +1 -0
- package/lib/module/styles/index.js.map +1 -1
- package/lib/module/styles/z-index.js +45 -0
- package/lib/module/styles/z-index.js.map +1 -0
- package/lib/module/tooltip/index.web.js +2 -1
- package/lib/module/tooltip/index.web.js.map +1 -1
- package/lib/typescript/commonjs/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/commonjs/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/CenteredDialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/SheetShell.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/types.d.ts +1 -0
- package/lib/typescript/commonjs/menu/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/portal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/portal/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/prompt-input/PromptInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/index.d.ts +1 -0
- package/lib/typescript/commonjs/styles/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/z-index.d.ts +49 -0
- package/lib/typescript/commonjs/styles/z-index.d.ts.map +1 -0
- package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
- package/lib/typescript/module/avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/module/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/CenteredDialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/SheetShell.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/index.web.d.ts +1 -1
- package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/types.d.ts +1 -0
- package/lib/typescript/module/menu/types.d.ts.map +1 -1
- package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/module/portal/index.d.ts.map +1 -1
- package/lib/typescript/module/portal/index.web.d.ts.map +1 -1
- package/lib/typescript/module/prompt-input/PromptInput.d.ts.map +1 -1
- package/lib/typescript/module/select/index.web.d.ts.map +1 -1
- package/lib/typescript/module/styles/index.d.ts +1 -0
- package/lib/typescript/module/styles/index.d.ts.map +1 -1
- package/lib/typescript/module/styles/z-index.d.ts +49 -0
- package/lib/typescript/module/styles/z-index.d.ts.map +1 -0
- package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/avatar/Avatar.tsx +2 -1
- package/src/badge/Badge.tsx +2 -1
- package/src/bottom-sheet/index.tsx +3 -2
- package/src/context-menu/index.web.tsx +5 -2
- package/src/dialog/CenteredDialog.web.tsx +4 -2
- package/src/dialog/Dialog.web.tsx +4 -2
- package/src/dialog/SheetShell.tsx +2 -1
- package/src/index.ts +1 -1
- package/src/index.web.ts +1 -1
- package/src/menu/index.web.tsx +51 -23
- package/src/menu/types.ts +1 -0
- package/src/popover/index.web.tsx +5 -2
- package/src/portal/index.tsx +2 -1
- package/src/portal/index.web.tsx +2 -1
- package/src/prompt-input/PromptInput.tsx +4 -3
- package/src/select/index.web.tsx +5 -2
- package/src/styles/index.ts +1 -0
- package/src/styles/z-index.ts +47 -0
- 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:
|
|
313
|
+
zIndex: popoverZIndex.backdrop,
|
|
311
314
|
pointerEvents: 'auto',
|
|
312
315
|
},
|
|
313
316
|
panel: {
|
|
314
317
|
position: 'fixed' as 'absolute',
|
|
315
|
-
zIndex:
|
|
318
|
+
zIndex: popoverZIndex.surface,
|
|
316
319
|
borderRadius: 12,
|
|
317
320
|
borderWidth: 1,
|
|
318
321
|
paddingVertical: 4,
|
package/src/portal/index.tsx
CHANGED
|
@@ -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:
|
|
124
|
+
zIndex: Z_INDEX.portalRoot,
|
|
124
125
|
},
|
|
125
126
|
});
|
package/src/portal/index.web.tsx
CHANGED
|
@@ -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 =
|
|
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:
|
|
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:
|
|
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:
|
|
251
|
+
zIndex: Z_INDEX.fullscreenControl,
|
|
251
252
|
padding: 8,
|
|
252
253
|
backgroundColor: theme.colors.background,
|
|
253
254
|
borderRadius: 9999,
|
package/src/select/index.web.tsx
CHANGED
|
@@ -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:
|
|
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:
|
|
349
|
+
zIndex: selectZIndex.surface,
|
|
347
350
|
borderRadius: 8,
|
|
348
351
|
borderWidth: 1,
|
|
349
352
|
overflow: 'hidden',
|
package/src/styles/index.ts
CHANGED
|
@@ -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:
|
|
158
|
+
zIndex: Z_INDEX.tooltip,
|
|
158
159
|
},
|
|
159
160
|
});
|