@oxy.so/bloom 7.16.0 → 7.16.1
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/docs/adoption-matrix.mdx +1 -1
- package/docs/dialog.mdx +15 -0
- package/lib/commonjs/dialog/Dialog.js +12 -2
- package/lib/commonjs/dialog/Dialog.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +26 -4
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/dialog/DialogMorph.js +4 -4
- package/lib/commonjs/overlay/ModalKeyboard.js +7 -3
- package/lib/commonjs/overlay/ModalKeyboard.js.map +1 -1
- package/lib/commonjs/overlay/modal-keyboard.js +10 -0
- package/lib/commonjs/overlay/modal-keyboard.js.map +1 -1
- package/lib/module/dialog/Dialog.js +12 -2
- package/lib/module/dialog/Dialog.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +26 -4
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/dialog/DialogMorph.js +4 -4
- package/lib/module/overlay/ModalKeyboard.js +8 -4
- package/lib/module/overlay/ModalKeyboard.js.map +1 -1
- package/lib/module/overlay/modal-keyboard.js +9 -0
- package/lib/module/overlay/modal-keyboard.js.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/DialogMorph.d.ts +4 -4
- package/lib/typescript/commonjs/overlay/ModalKeyboard.d.ts +1 -1
- package/lib/typescript/commonjs/overlay/modal-keyboard.d.ts +2 -0
- package/lib/typescript/commonjs/overlay/modal-keyboard.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/DialogMorph.d.ts +4 -4
- package/lib/typescript/module/overlay/ModalKeyboard.d.ts +1 -1
- package/lib/typescript/module/overlay/modal-keyboard.d.ts +2 -0
- package/lib/typescript/module/overlay/modal-keyboard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/dialog/Dialog.tsx +8 -3
- package/src/dialog/Dialog.web.tsx +39 -23
- package/src/dialog/DialogMorph.tsx +4 -4
- package/src/overlay/ModalKeyboard.tsx +4 -4
- package/src/overlay/modal-keyboard.ts +9 -0
|
@@ -825,31 +825,47 @@ function SheetSurface({
|
|
|
825
825
|
onDismiss={onDismiss}
|
|
826
826
|
collapse={false}
|
|
827
827
|
/>
|
|
828
|
-
|
|
829
|
-
style={{
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
828
|
+
{scrollable === false ? (
|
|
829
|
+
<View style={{ flex: 1, minHeight: 0, paddingBottom: contentPadding }}>
|
|
830
|
+
<DialogNavBarSpacer controller={headerController} header={header} />
|
|
831
|
+
<DialogHeaderProvider controller={headerController}>
|
|
832
|
+
<DialogBody
|
|
833
|
+
titleId={titleId}
|
|
834
|
+
descriptionId={descriptionId}
|
|
835
|
+
title={title}
|
|
836
|
+
description={description}
|
|
837
|
+
actions={actions}
|
|
838
|
+
>
|
|
839
|
+
{surfaceChildren}
|
|
840
|
+
</DialogBody>
|
|
841
|
+
</DialogHeaderProvider>
|
|
842
|
+
</View>
|
|
843
|
+
) : (
|
|
844
|
+
<ScrollView
|
|
845
|
+
style={{ flexShrink: 1 }}
|
|
846
|
+
contentContainerStyle={{ paddingTop: DIALOG_NAV_BAR_HEIGHT, paddingBottom: contentPadding }}
|
|
847
|
+
showsVerticalScrollIndicator={false}
|
|
848
|
+
scrollEventThrottle={16}
|
|
849
|
+
onScroll={(e) => {
|
|
850
|
+
headerController.scrollY.value = e.nativeEvent.contentOffset.y;
|
|
851
|
+
}}
|
|
852
|
+
>
|
|
853
|
+
<DialogHeaderProvider controller={headerController}>
|
|
854
|
+
<DialogBody
|
|
855
|
+
titleId={titleId}
|
|
856
|
+
descriptionId={descriptionId}
|
|
857
|
+
title={title}
|
|
858
|
+
description={description}
|
|
859
|
+
actions={actions}
|
|
860
|
+
>
|
|
861
|
+
{surfaceChildren}
|
|
862
|
+
</DialogBody>
|
|
863
|
+
</DialogHeaderProvider>
|
|
864
|
+
</ScrollView>
|
|
865
|
+
)}
|
|
850
866
|
</View>
|
|
851
867
|
) : (
|
|
852
|
-
<View style={{ padding: contentPadding }}>
|
|
868
|
+
<View style={[{ padding: contentPadding }, scrollable === false && { flex: 1, minHeight: 0 }]}>
|
|
853
869
|
<DialogBody
|
|
854
870
|
titleId={titleId}
|
|
855
871
|
descriptionId={descriptionId}
|
|
@@ -552,10 +552,10 @@ export type DialogMorph = ReturnType<typeof useDialogMorph>;
|
|
|
552
552
|
* declare swaps via {@link useDialogFrame}), measures the content's natural
|
|
553
553
|
* height, and carries the incoming-frame fade.
|
|
554
554
|
*
|
|
555
|
-
*
|
|
556
|
-
* growing
|
|
557
|
-
*
|
|
558
|
-
*
|
|
555
|
+
* With natural-height measurement enabled, render inside the surface's scroll
|
|
556
|
+
* content without a growing style: the incoming frame must report its own
|
|
557
|
+
* height while the panel is pinned at the outgoing one. A surface whose child
|
|
558
|
+
* owns scrolling disables measurement and passes a bounded flex style instead.
|
|
559
559
|
*/
|
|
560
560
|
export function DialogMorphContent({
|
|
561
561
|
morph,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef } from 'react';
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { initialFocusWithin, listenForEscape, wrapTab } from './modal-keyboard';
|
|
5
5
|
import { useOverlayLayerContext } from './Overlay';
|
|
6
6
|
import { isTopmostOverlayLayer } from './stack';
|
|
7
7
|
|
|
@@ -22,7 +22,7 @@ export interface ModalKeyboardProps {
|
|
|
22
22
|
* and the web `BottomSheet`.
|
|
23
23
|
*
|
|
24
24
|
* - Focus moves INTO the panel when it opens — to whatever the content
|
|
25
|
-
* focused itself (an `autoFocus` field), else the first tabbable, else the
|
|
25
|
+
* focused itself (an `autoFocus` field), else the first visible tabbable, else the
|
|
26
26
|
* panel — and goes BACK to the element that had it once the surface starts
|
|
27
27
|
* closing (or unmounts), unless the host has already put it somewhere else.
|
|
28
28
|
* - Tab and Shift+Tab wrap at the panel's edges.
|
|
@@ -48,7 +48,7 @@ export function ModalKeyboard({ panelRef, closing = false, dismissible, dismiss
|
|
|
48
48
|
const active = document.activeElement;
|
|
49
49
|
// Only focus the surface still holds (or lost with its nodes): a host that
|
|
50
50
|
// moved focus on purpose while closing keeps its choice.
|
|
51
|
-
if (!active || active === document.body || panel?.contains(active)) target.focus();
|
|
51
|
+
if (!active || active === document.body || panel?.contains(active)) target.focus({ preventScroll: true });
|
|
52
52
|
}, [panelRef]);
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
@@ -60,7 +60,7 @@ export function ModalKeyboard({ panelRef, closing = false, dismissible, dismiss
|
|
|
60
60
|
const frame = requestAnimationFrame(() => {
|
|
61
61
|
const node = panel();
|
|
62
62
|
if (!node || node.contains(document.activeElement) || !isTopmostOverlayLayer(layer)) return;
|
|
63
|
-
(
|
|
63
|
+
initialFocusWithin(node).focus({ preventScroll: true });
|
|
64
64
|
});
|
|
65
65
|
const onTab = (event: KeyboardEvent) => {
|
|
66
66
|
if (event.defaultPrevented || !isTopmostOverlayLayer(layer)) return;
|
|
@@ -59,6 +59,15 @@ export function tabbablesWithin(node: HTMLElement | null): HTMLElement[] {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
/** Initial focus must not scroll long content to an offscreen action. Tab still reaches every control. */
|
|
63
|
+
export function initialFocusWithin(node: HTMLElement): HTMLElement {
|
|
64
|
+
const panel = node.getBoundingClientRect();
|
|
65
|
+
return tabbablesWithin(node).find(element => {
|
|
66
|
+
const rect = element.getBoundingClientRect();
|
|
67
|
+
return rect.top >= panel.top && rect.bottom <= panel.bottom && rect.left >= panel.left && rect.right <= panel.right;
|
|
68
|
+
}) ?? node;
|
|
69
|
+
}
|
|
70
|
+
|
|
62
71
|
/**
|
|
63
72
|
* Keep Tab inside `node`: from the last tabbable (or from outside) forward to
|
|
64
73
|
* the first, from the first (or from outside) backward to the last. Returns
|