@multiplatform.one/components 7.47.4 → 7.49.0
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/dist/cjs/Dialog.cjs +5 -2
- package/dist/cjs/Dialog.native.js +5 -2
- package/dist/cjs/Dialog.native.js.map +1 -1
- package/dist/cjs/Popover.cjs +6 -3
- package/dist/cjs/Popover.native.js +7 -3
- package/dist/cjs/Popover.native.js.map +1 -1
- package/dist/cjs/Sheet.cjs +59 -0
- package/dist/cjs/Sheet.native.js +63 -0
- package/dist/cjs/Sheet.native.js.map +1 -0
- package/dist/cjs/SheetModal/index.cjs +28 -21
- package/dist/cjs/SheetModal/index.native.js +126 -121
- package/dist/cjs/SheetModal/index.native.js.map +1 -1
- package/dist/cjs/Tabs/index.cjs +113 -11
- package/dist/cjs/Tabs/index.native.js +117 -12
- package/dist/cjs/Tabs/index.native.js.map +1 -1
- package/dist/cjs/Tooltip/index.cjs +2 -1
- package/dist/cjs/Tooltip/index.native.js +3 -2
- package/dist/cjs/Tooltip/index.native.js.map +1 -1
- package/dist/cjs/TreeSelect/index.cjs +2 -1
- package/dist/cjs/TreeSelect/index.native.js +2 -1
- package/dist/cjs/TreeSelect/index.native.js.map +1 -1
- package/dist/cjs/charts/ChartDataView.cjs +7 -6
- package/dist/cjs/charts/ChartDataView.native.js +7 -6
- package/dist/cjs/charts/ChartDataView.native.js.map +1 -1
- package/dist/cjs/feedback/ConfirmDialog.cjs +5 -4
- package/dist/cjs/feedback/ConfirmDialog.native.js +5 -4
- package/dist/cjs/feedback/ConfirmDialog.native.js.map +1 -1
- package/dist/cjs/knobImmuneExports.cjs +0 -1
- package/dist/cjs/knobImmuneExports.native.js +0 -1
- package/dist/cjs/knobImmuneExports.native.js.map +1 -1
- package/dist/cjs/layouts/attachments.cjs +4 -3
- package/dist/cjs/layouts/attachments.native.js +4 -3
- package/dist/cjs/layouts/attachments.native.js.map +1 -1
- package/dist/cjs/surfaces.cjs +4 -2
- package/dist/cjs/surfaces.native.js +4 -2
- package/dist/cjs/surfaces.native.js.map +1 -1
- package/dist/cjs/tamagui.cjs +2 -1
- package/dist/cjs/tamagui.native.js +2 -1
- package/dist/cjs/tamagui.native.js.map +1 -1
- package/dist/esm/Dialog.mjs +5 -2
- package/dist/esm/Dialog.mjs.map +1 -1
- package/dist/esm/Dialog.native.js +5 -2
- package/dist/esm/Dialog.native.js.map +1 -1
- package/dist/esm/Popover.mjs +7 -4
- package/dist/esm/Popover.mjs.map +1 -1
- package/dist/esm/Popover.native.js +8 -4
- package/dist/esm/Popover.native.js.map +1 -1
- package/dist/esm/Sheet.mjs +34 -0
- package/dist/esm/Sheet.mjs.map +1 -0
- package/dist/esm/Sheet.native.js +35 -0
- package/dist/esm/Sheet.native.js.map +1 -0
- package/dist/esm/SheetModal/index.mjs +29 -22
- package/dist/esm/SheetModal/index.mjs.map +1 -1
- package/dist/esm/SheetModal/index.native.js +126 -121
- package/dist/esm/SheetModal/index.native.js.map +1 -1
- package/dist/esm/Tabs/index.mjs +113 -14
- package/dist/esm/Tabs/index.mjs.map +1 -1
- package/dist/esm/Tabs/index.native.js +117 -15
- package/dist/esm/Tabs/index.native.js.map +1 -1
- package/dist/esm/Tooltip/index.mjs +3 -2
- package/dist/esm/Tooltip/index.mjs.map +1 -1
- package/dist/esm/Tooltip/index.native.js +4 -3
- package/dist/esm/Tooltip/index.native.js.map +1 -1
- package/dist/esm/TreeSelect/index.mjs +3 -2
- package/dist/esm/TreeSelect/index.mjs.map +1 -1
- package/dist/esm/TreeSelect/index.native.js +3 -2
- package/dist/esm/TreeSelect/index.native.js.map +1 -1
- package/dist/esm/charts/ChartDataView.mjs +2 -1
- package/dist/esm/charts/ChartDataView.mjs.map +1 -1
- package/dist/esm/charts/ChartDataView.native.js +2 -1
- package/dist/esm/charts/ChartDataView.native.js.map +1 -1
- package/dist/esm/feedback/ConfirmDialog.mjs +2 -1
- package/dist/esm/feedback/ConfirmDialog.mjs.map +1 -1
- package/dist/esm/feedback/ConfirmDialog.native.js +2 -1
- package/dist/esm/feedback/ConfirmDialog.native.js.map +1 -1
- package/dist/esm/knobImmuneExports.mjs +0 -1
- package/dist/esm/knobImmuneExports.mjs.map +1 -1
- package/dist/esm/knobImmuneExports.native.js +0 -1
- package/dist/esm/knobImmuneExports.native.js.map +1 -1
- package/dist/esm/layouts/attachments.mjs +2 -1
- package/dist/esm/layouts/attachments.mjs.map +1 -1
- package/dist/esm/layouts/attachments.native.js +2 -1
- package/dist/esm/layouts/attachments.native.js.map +1 -1
- package/dist/esm/surfaces.mjs +5 -3
- package/dist/esm/surfaces.mjs.map +1 -1
- package/dist/esm/surfaces.native.js +5 -3
- package/dist/esm/surfaces.native.js.map +1 -1
- package/dist/esm/tamagui.mjs +2 -1
- package/dist/esm/tamagui.mjs.map +1 -1
- package/dist/esm/tamagui.native.js +2 -1
- package/dist/esm/tamagui.native.js.map +1 -1
- package/dist/jsx/Dialog.mjs +5 -2
- package/dist/jsx/Dialog.mjs.map +1 -1
- package/dist/jsx/Dialog.native.js +5 -2
- package/dist/jsx/Dialog.native.js.map +1 -1
- package/dist/jsx/Popover.mjs +7 -4
- package/dist/jsx/Popover.mjs.map +1 -1
- package/dist/jsx/Popover.native.js +7 -3
- package/dist/jsx/Popover.native.js.map +1 -1
- package/dist/jsx/Sheet.mjs +34 -0
- package/dist/jsx/Sheet.mjs.map +1 -0
- package/dist/jsx/Sheet.native.js +63 -0
- package/dist/jsx/Sheet.native.js.map +1 -0
- package/dist/jsx/SheetModal/index.mjs +29 -22
- package/dist/jsx/SheetModal/index.mjs.map +1 -1
- package/dist/jsx/SheetModal/index.native.js +126 -121
- package/dist/jsx/SheetModal/index.native.js.map +1 -1
- package/dist/jsx/Tabs/index.mjs +113 -14
- package/dist/jsx/Tabs/index.mjs.map +1 -1
- package/dist/jsx/Tabs/index.native.js +117 -12
- package/dist/jsx/Tabs/index.native.js.map +1 -1
- package/dist/jsx/Tooltip/index.mjs +3 -2
- package/dist/jsx/Tooltip/index.mjs.map +1 -1
- package/dist/jsx/Tooltip/index.native.js +3 -2
- package/dist/jsx/Tooltip/index.native.js.map +1 -1
- package/dist/jsx/TreeSelect/index.mjs +3 -2
- package/dist/jsx/TreeSelect/index.mjs.map +1 -1
- package/dist/jsx/TreeSelect/index.native.js +2 -1
- package/dist/jsx/TreeSelect/index.native.js.map +1 -1
- package/dist/jsx/charts/ChartDataView.mjs +2 -1
- package/dist/jsx/charts/ChartDataView.mjs.map +1 -1
- package/dist/jsx/charts/ChartDataView.native.js +7 -6
- package/dist/jsx/charts/ChartDataView.native.js.map +1 -1
- package/dist/jsx/feedback/ConfirmDialog.mjs +2 -1
- package/dist/jsx/feedback/ConfirmDialog.mjs.map +1 -1
- package/dist/jsx/feedback/ConfirmDialog.native.js +5 -4
- package/dist/jsx/feedback/ConfirmDialog.native.js.map +1 -1
- package/dist/jsx/knobImmuneExports.mjs +0 -1
- package/dist/jsx/knobImmuneExports.mjs.map +1 -1
- package/dist/jsx/knobImmuneExports.native.js +0 -1
- package/dist/jsx/knobImmuneExports.native.js.map +1 -1
- package/dist/jsx/layouts/attachments.mjs +2 -1
- package/dist/jsx/layouts/attachments.mjs.map +1 -1
- package/dist/jsx/layouts/attachments.native.js +4 -3
- package/dist/jsx/layouts/attachments.native.js.map +1 -1
- package/dist/jsx/surfaces.mjs +5 -3
- package/dist/jsx/surfaces.mjs.map +1 -1
- package/dist/jsx/surfaces.native.js +4 -2
- package/dist/jsx/surfaces.native.js.map +1 -1
- package/dist/jsx/tamagui.mjs +2 -1
- package/dist/jsx/tamagui.mjs.map +1 -1
- package/dist/jsx/tamagui.native.js +2 -1
- package/dist/jsx/tamagui.native.js.map +1 -1
- package/package.json +9 -9
- package/src/Button.native-press.spec.tsx +86 -0
- package/src/Dialog.spec.tsx +6 -5
- package/src/Dialog.tsx +9 -1
- package/src/Popover.coverTrigger.spec.tsx +1 -1
- package/src/Popover.tsx +17 -4
- package/src/Sheet.tsx +35 -0
- package/src/SheetModal/index.native.tsx +117 -113
- package/src/SheetModal/index.tsx +30 -26
- package/src/Tabs/Tabs.fades.native.spec.tsx +201 -0
- package/src/Tabs/Tabs.gutter.spec.tsx +95 -0
- package/src/Tabs/Tabs.stories.tsx +37 -0
- package/src/Tabs/index.tsx +149 -12
- package/src/Tooltip/index.native.tsx +4 -3
- package/src/Tooltip/index.tsx +3 -2
- package/src/TreeSelect/index.tsx +3 -2
- package/src/charts/ChartDataView.tsx +2 -1
- package/src/feedback/ConfirmDialog.stories.tsx +48 -0
- package/src/feedback/ConfirmDialog.tsx +2 -1
- package/src/knobImmuneExports.ts +0 -1
- package/src/layouts/attachments.tsx +1 -1
- package/src/layouts/layouts.spec.tsx +4 -2
- package/src/overlayStack.native-press.spec.tsx +214 -0
- package/src/surfaces.spec.tsx +2 -1
- package/src/surfaces.tsx +5 -2
- package/src/tamagui.spec.ts +4 -4
- package/src/tamagui.ts +3 -1
- package/types/Dialog.d.ts.map +1 -1
- package/types/Popover.d.ts.map +1 -1
- package/types/Sheet.d.ts +3 -0
- package/types/Sheet.d.ts.map +1 -0
- package/types/SheetModal/index.d.ts.map +1 -1
- package/types/SheetModal/index.native.d.ts.map +1 -1
- package/types/Tabs/index.d.ts +15 -0
- package/types/Tabs/index.d.ts.map +1 -1
- package/types/Tooltip/index.d.ts.map +1 -1
- package/types/Tooltip/index.native.d.ts.map +1 -1
- package/types/TreeSelect/index.d.ts.map +1 -1
- package/types/charts/ChartDataView.d.ts.map +1 -1
- package/types/feedback/ConfirmDialog.d.ts.map +1 -1
- package/types/knobImmuneExports.d.ts.map +1 -1
- package/types/layouts/attachments.d.ts.map +1 -1
- package/types/surfaces.d.ts +6 -1
- package/types/surfaces.d.ts.map +1 -1
- package/types/tamagui.d.ts +2 -1
- package/types/tamagui.d.ts.map +1 -1
package/src/Dialog.spec.tsx
CHANGED
|
@@ -121,9 +121,10 @@ describe("house Dialog.Close is named by what it shows (MPO-476)", () => {
|
|
|
121
121
|
await waitFor(() => expect(screen.queryByText("Edit profile")).toBeNull());
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
-
it("changes only Close; every other part is tamagui's", () => {
|
|
124
|
+
it("changes only Close and the overlay-stacked Portal; every other part is tamagui's", () => {
|
|
125
125
|
expect(Dialog.Close).not.toBe(TamaguiDialog.Close);
|
|
126
|
-
|
|
126
|
+
expect(Dialog.Portal).not.toBe(TamaguiDialog.Portal);
|
|
127
|
+
for (const part of ["Trigger", "Overlay", "Content", "Title", "Description"]) {
|
|
127
128
|
expect(Dialog[part as keyof typeof Dialog]).toBe(
|
|
128
129
|
TamaguiDialog[part as keyof typeof TamaguiDialog],
|
|
129
130
|
);
|
|
@@ -152,11 +153,11 @@ describe("house AlertDialog Cancel and Action are named by what they show (MPO-4
|
|
|
152
153
|
noDialogClose();
|
|
153
154
|
});
|
|
154
155
|
|
|
155
|
-
it("changes only the close parts; every other part is tamagui's", () => {
|
|
156
|
-
for (const part of ["Cancel", "Action", "Destructive"] as const) {
|
|
156
|
+
it("changes only the close parts and the overlay-stacked Portal; every other part is tamagui's", () => {
|
|
157
|
+
for (const part of ["Cancel", "Action", "Destructive", "Portal"] as const) {
|
|
157
158
|
expect(AlertDialog[part]).not.toBe(TamaguiAlertDialog[part]);
|
|
158
159
|
}
|
|
159
|
-
for (const part of ["Trigger", "
|
|
160
|
+
for (const part of ["Trigger", "Overlay", "Content", "Title", "Description"]) {
|
|
160
161
|
expect(AlertDialog[part as keyof typeof AlertDialog]).toBe(
|
|
161
162
|
TamaguiAlertDialog[part as keyof typeof TamaguiAlertDialog],
|
|
162
163
|
);
|
package/src/Dialog.tsx
CHANGED
|
@@ -11,8 +11,14 @@
|
|
|
11
11
|
* Here a close part with text (its own, or its asChild child's) is named by
|
|
12
12
|
* that text. One with no text and no label of its own, an icon-only X, gets
|
|
13
13
|
* the catalog's localized "Close". An explicit label on the part or on its
|
|
14
|
-
* child still wins.
|
|
14
|
+
* child still wins.
|
|
15
|
+
*
|
|
16
|
+
* Their Portal binds the overlay stack (FZ-7869): a dialog opened from a sheet
|
|
17
|
+
* or another dialog sits one `$zIndex` step above it, and on native it would
|
|
18
|
+
* otherwise reach the root host with no zIndex and mount under the sheet.
|
|
19
|
+
* Every other part is the tamagui one.
|
|
15
20
|
*/
|
|
21
|
+
import { withOverlayStack } from "@multiplatform.one/forms";
|
|
16
22
|
import { isValidElement, type ComponentType, type ReactNode } from "react";
|
|
17
23
|
import {
|
|
18
24
|
AlertDialog as TamaguiAlertDialog,
|
|
@@ -71,10 +77,12 @@ function namedByContent<C extends ComponentType<any>>(Part: C, displayName: stri
|
|
|
71
77
|
|
|
72
78
|
export const Dialog: typeof TamaguiDialog = withStaticProperties(TamaguiDialog, {
|
|
73
79
|
Close: namedByContent(TamaguiDialog.Close, "DialogClose"),
|
|
80
|
+
Portal: withOverlayStack(TamaguiDialog.Portal, "dropdown", "DialogPortal"),
|
|
74
81
|
});
|
|
75
82
|
|
|
76
83
|
export const AlertDialog: typeof TamaguiAlertDialog = withStaticProperties(TamaguiAlertDialog, {
|
|
77
84
|
Cancel: namedByContent(TamaguiAlertDialog.Cancel, "AlertDialogCancel"),
|
|
78
85
|
Action: namedByContent(TamaguiAlertDialog.Action, "AlertDialogAction"),
|
|
79
86
|
Destructive: namedByContent(TamaguiAlertDialog.Destructive, "AlertDialogDestructive"),
|
|
87
|
+
Portal: withOverlayStack(TamaguiAlertDialog.Portal, "dropdown", "AlertDialogPortal"),
|
|
80
88
|
});
|
|
@@ -10,9 +10,9 @@ afterEach(() => vi.restoreAllMocks());
|
|
|
10
10
|
|
|
11
11
|
describe("Popover cover-trigger adapter", () => {
|
|
12
12
|
it("preserves all published composition helpers", () => {
|
|
13
|
+
expect(Popover.Content).not.toBe(TamaguiPopover.Content);
|
|
13
14
|
for (const key of [
|
|
14
15
|
"Trigger",
|
|
15
|
-
"Content",
|
|
16
16
|
"Anchor",
|
|
17
17
|
"Arrow",
|
|
18
18
|
"ScrollView",
|
package/src/Popover.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
type ReactElement,
|
|
15
15
|
type ReactNode,
|
|
16
16
|
} from "react";
|
|
17
|
-
import { FloatingPanel } from "@multiplatform.one/forms";
|
|
17
|
+
import { FloatingPanel, useOverlayZIndex, withOverlayStack } from "@multiplatform.one/forms";
|
|
18
18
|
import {
|
|
19
19
|
Popover as TamaguiPopover,
|
|
20
20
|
View,
|
|
@@ -37,6 +37,12 @@ export type Popover = {
|
|
|
37
37
|
setOpen: (open: boolean) => void;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
const StackedPopoverContent = withOverlayStack(
|
|
41
|
+
TamaguiPopover.Content,
|
|
42
|
+
"dropdown",
|
|
43
|
+
"PopoverContent",
|
|
44
|
+
);
|
|
45
|
+
|
|
40
46
|
const CoverPopoverContext = createContext<(() => void) | null>(null);
|
|
41
47
|
|
|
42
48
|
const PopoverClose = forwardRef<
|
|
@@ -96,7 +102,10 @@ const CoverPopover = forwardRef<Popover, PopoverProps>(function CoverPopover(
|
|
|
96
102
|
const childrenParts = parts(children);
|
|
97
103
|
const triggerPart = childrenParts.find((child) => child.type === TamaguiPopover.Trigger);
|
|
98
104
|
const content = childrenParts.filter(
|
|
99
|
-
(child) =>
|
|
105
|
+
(child) =>
|
|
106
|
+
child.type === TamaguiPopover.Content ||
|
|
107
|
+
child.type === StackedPopoverContent ||
|
|
108
|
+
child.type === PopoverContent,
|
|
100
109
|
);
|
|
101
110
|
const unsupported = [
|
|
102
111
|
"onOpenAutoFocus",
|
|
@@ -159,18 +168,22 @@ const PopoverRoot = forwardRef<Popover, PopoverProps>(function PopoverRoot(
|
|
|
159
168
|
{ anchorMode, triggerRow, ...props },
|
|
160
169
|
ref,
|
|
161
170
|
) {
|
|
171
|
+
const stacked = useOverlayZIndex("dropdown");
|
|
162
172
|
if (anchorMode === "cover-trigger")
|
|
163
173
|
return <CoverPopover ref={ref} {...props} anchorMode={anchorMode} triggerRow={triggerRow} />;
|
|
174
|
+
// FZ-7869: tamagui hands the root's zIndex to the content's portal, so a
|
|
175
|
+
// popover opened in a sheet or a dialog sits above it on native too. The
|
|
176
|
+
// content parts carry the stack to what opens inside them.
|
|
164
177
|
return (
|
|
165
178
|
<CoverPopoverContext.Provider value={null}>
|
|
166
|
-
<TamaguiPopover ref={ref} {...props} />
|
|
179
|
+
<TamaguiPopover ref={ref} {...props} zIndex={props.zIndex ?? stacked} />
|
|
167
180
|
</CoverPopoverContext.Provider>
|
|
168
181
|
);
|
|
169
182
|
});
|
|
170
183
|
|
|
171
184
|
export const Popover = withStaticProperties(PopoverRoot, {
|
|
172
185
|
Trigger: TamaguiPopover.Trigger,
|
|
173
|
-
Content:
|
|
186
|
+
Content: StackedPopoverContent,
|
|
174
187
|
Close: PopoverClose,
|
|
175
188
|
Anchor: TamaguiPopover.Anchor,
|
|
176
189
|
Adapt: TamaguiPopover.Adapt,
|
package/src/Sheet.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* House Sheet: the tamagui root, with a modal sheet bound to the overlay
|
|
3
|
+
* stack (FZ-7869, Axiom 14). It binds its tier, or one `$zIndex` step above
|
|
4
|
+
* the overlay it was opened from, and what it contains (a ConfirmDialog, a
|
|
5
|
+
* Popover, another sheet) opens above it. The parts are the tamagui ones.
|
|
6
|
+
*/
|
|
7
|
+
import { OverlayStackProvider, useOverlayZIndex } from "@multiplatform.one/forms";
|
|
8
|
+
import { forwardRef, type ComponentRef } from "react";
|
|
9
|
+
import { Sheet as TamaguiSheet, withStaticProperties, type SheetProps } from "tamagui";
|
|
10
|
+
|
|
11
|
+
const SheetRoot = forwardRef<ComponentRef<typeof TamaguiSheet>, SheetProps>(
|
|
12
|
+
function Sheet(props, ref) {
|
|
13
|
+
const stacked = useOverlayZIndex("sheet");
|
|
14
|
+
if (!props.modal) return <TamaguiSheet ref={ref} {...props} />;
|
|
15
|
+
const zIndex = props.zIndex ?? stacked;
|
|
16
|
+
return (
|
|
17
|
+
<TamaguiSheet
|
|
18
|
+
ref={ref}
|
|
19
|
+
{...props}
|
|
20
|
+
zIndex={zIndex}
|
|
21
|
+
portalProps={{ zIndex, ...props.portalProps }}
|
|
22
|
+
>
|
|
23
|
+
<OverlayStackProvider zIndex={zIndex}>{props.children}</OverlayStackProvider>
|
|
24
|
+
</TamaguiSheet>
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const Sheet: typeof TamaguiSheet = withStaticProperties(SheetRoot, {
|
|
30
|
+
Frame: TamaguiSheet.Frame,
|
|
31
|
+
Overlay: TamaguiSheet.Overlay,
|
|
32
|
+
Handle: TamaguiSheet.Handle,
|
|
33
|
+
ScrollView: TamaguiSheet.ScrollView,
|
|
34
|
+
Controlled: TamaguiSheet.Controlled,
|
|
35
|
+
}) as unknown as typeof TamaguiSheet;
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* height with a large-detent cap. LC-71: the frame is not a control.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { OverlayWindow, useOverlayZIndex } from "@multiplatform.one/forms";
|
|
13
14
|
import {
|
|
14
15
|
motionDurationMs,
|
|
15
16
|
useResolvedKnobs,
|
|
@@ -83,6 +84,7 @@ export function SheetModal({
|
|
|
83
84
|
}: SheetModalProps) {
|
|
84
85
|
const { t } = useTranslation();
|
|
85
86
|
const { knobProps } = useResolvedKnobs();
|
|
87
|
+
const windowZIndex = useOverlayZIndex("sheet");
|
|
86
88
|
const slideTransition = knobProps.motion.slide.transition;
|
|
87
89
|
const slideDuration = motionDurationMs(slideTransition);
|
|
88
90
|
const scrimDuration = motionDurationMs(knobProps.motion.scrim.transition);
|
|
@@ -384,107 +386,124 @@ export function SheetModal({
|
|
|
384
386
|
onRequestClose={close}
|
|
385
387
|
onShow={enter}
|
|
386
388
|
>
|
|
387
|
-
<
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<Pressable
|
|
395
|
-
style={StyleSheet.absoluteFill}
|
|
396
|
-
onPress={handleBackdropPress}
|
|
397
|
-
accessibilityRole="button"
|
|
398
|
-
accessibilityLabel={t("Close")}
|
|
389
|
+
<OverlayWindow zIndex={windowZIndex}>
|
|
390
|
+
<RNView
|
|
391
|
+
style={{ flex: 1, justifyContent: "flex-end", paddingBottom: keyboardInset }}
|
|
392
|
+
onTouchStart={stopAtModal}
|
|
393
|
+
onTouchMove={stopAtModal}
|
|
394
|
+
onTouchEnd={stopAtModal}
|
|
395
|
+
onTouchCancel={stopAtModal}
|
|
399
396
|
>
|
|
400
|
-
<
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
borderBottomRightRadius={0}
|
|
430
|
-
elevation={knobProps.elevation}
|
|
431
|
-
maxHeight={maxHeight}
|
|
432
|
-
flexShrink={1}
|
|
433
|
-
minHeight={0}
|
|
434
|
-
{...(fill ? fillSlot : null)}
|
|
435
|
-
paddingTop="$2"
|
|
436
|
-
paddingBottom={keyboardInset > 0 ? 8 : bottomInset}
|
|
437
|
-
overflow="hidden"
|
|
438
|
-
// No focus or press pseudo on this surface: on native tamagui
|
|
439
|
-
// turns one into a touch-responder claim, and a responder here
|
|
440
|
-
// takes every drag from the ScrollView inside (MPO-299).
|
|
441
|
-
accessibilityViewIsModal
|
|
442
|
-
onAccessibilityEscape={close}
|
|
397
|
+
<Pressable
|
|
398
|
+
style={StyleSheet.absoluteFill}
|
|
399
|
+
onPress={handleBackdropPress}
|
|
400
|
+
accessibilityRole="button"
|
|
401
|
+
accessibilityLabel={t("Close")}
|
|
402
|
+
>
|
|
403
|
+
<View flex={1} backgroundColor="$shadow6" />
|
|
404
|
+
</Pressable>
|
|
405
|
+
<Animated.View
|
|
406
|
+
onLayout={(e) => {
|
|
407
|
+
if (restHeightRef.current !== null) return;
|
|
408
|
+
const h = Math.round(e.nativeEvent.layout.height);
|
|
409
|
+
if (h <= 0) return;
|
|
410
|
+
naturalRef.current = h;
|
|
411
|
+
filledRef.current = h >= maxHeightRef.current - 1;
|
|
412
|
+
if (h !== measuredHeight) setMeasuredHeight(h);
|
|
413
|
+
}}
|
|
414
|
+
testID="sheet-modal-frame"
|
|
415
|
+
style={{
|
|
416
|
+
// MPO-64: flex children default to flexShrink 0, so without this
|
|
417
|
+
// the sheet cannot give way to the keyboard.
|
|
418
|
+
flexShrink: 1,
|
|
419
|
+
minHeight: 0,
|
|
420
|
+
maxHeight: frameCap,
|
|
421
|
+
// The cap is already keyboard- and window-aware; fill only asks
|
|
422
|
+
// for it as a definite height rather than an upper bound.
|
|
423
|
+
...(fill ? { height: frameCap } : null),
|
|
424
|
+
transform: [{ translateY }],
|
|
425
|
+
}}
|
|
443
426
|
>
|
|
444
|
-
|
|
427
|
+
<YStack
|
|
428
|
+
testID="sheet-modal-surface"
|
|
429
|
+
{...knobProps.surface}
|
|
430
|
+
{...knobProps.borderRadius}
|
|
431
|
+
borderBottomLeftRadius={0}
|
|
432
|
+
borderBottomRightRadius={0}
|
|
433
|
+
elevation={knobProps.elevation}
|
|
434
|
+
maxHeight={maxHeight}
|
|
435
|
+
flexShrink={1}
|
|
436
|
+
minHeight={0}
|
|
437
|
+
{...(fill ? fillSlot : null)}
|
|
438
|
+
paddingTop="$2"
|
|
439
|
+
paddingBottom={keyboardInset > 0 ? 8 : bottomInset}
|
|
440
|
+
overflow="hidden"
|
|
441
|
+
// No focus or press pseudo on this surface: on native tamagui
|
|
442
|
+
// turns one into a touch-responder claim, and a responder here
|
|
443
|
+
// takes every drag from the ScrollView inside (MPO-299).
|
|
444
|
+
accessibilityViewIsModal
|
|
445
|
+
onAccessibilityEscape={close}
|
|
446
|
+
>
|
|
447
|
+
{/*
|
|
445
448
|
The grabber is the grab ZONE, not the 5pt pill inside it. LC-71
|
|
446
449
|
says the frame is not a control; the grabber is the one part of
|
|
447
450
|
it that is, so it is the only thing that takes the gesture, and
|
|
448
451
|
it never fights the ScrollView below.
|
|
449
452
|
*/}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
>
|
|
463
|
-
<View
|
|
464
|
-
width={36}
|
|
465
|
-
height={5}
|
|
466
|
-
borderRadius={100}
|
|
467
|
-
backgroundColor="$color8"
|
|
468
|
-
opacity={0.45}
|
|
469
|
-
accessible={false}
|
|
470
|
-
/>
|
|
471
|
-
</RNView>
|
|
472
|
-
<DialogRegionContext.Provider value={IN_DIALOG_REGION}>
|
|
473
|
-
<YStack
|
|
474
|
-
testID="sheet-modal-content"
|
|
475
|
-
padding={knobProps.panelPadding.padding}
|
|
476
|
-
gap={knobProps.gap.gap}
|
|
477
|
-
flexShrink={1}
|
|
478
|
-
{...(fill ? fillSlot : null)}
|
|
453
|
+
<RNView
|
|
454
|
+
{...panResponder.panHandlers}
|
|
455
|
+
accessibilityRole="adjustable"
|
|
456
|
+
accessibilityLabel={t("Drag to resize")}
|
|
457
|
+
testID="sheet-modal-grabber"
|
|
458
|
+
style={{
|
|
459
|
+
alignSelf: "stretch",
|
|
460
|
+
alignItems: "center",
|
|
461
|
+
paddingTop: 3,
|
|
462
|
+
paddingBottom: 11,
|
|
463
|
+
...(fill ? nonShrinking : null),
|
|
464
|
+
}}
|
|
479
465
|
>
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
466
|
+
<View
|
|
467
|
+
width={36}
|
|
468
|
+
height={5}
|
|
469
|
+
borderRadius={100}
|
|
470
|
+
backgroundColor="$color8"
|
|
471
|
+
opacity={0.45}
|
|
472
|
+
accessible={false}
|
|
473
|
+
/>
|
|
474
|
+
</RNView>
|
|
475
|
+
<DialogRegionContext.Provider value={IN_DIALOG_REGION}>
|
|
476
|
+
<YStack
|
|
477
|
+
testID="sheet-modal-content"
|
|
478
|
+
padding={knobProps.panelPadding.padding}
|
|
479
|
+
gap={knobProps.gap.gap}
|
|
480
|
+
flexShrink={1}
|
|
481
|
+
{...(fill ? fillSlot : null)}
|
|
482
|
+
>
|
|
483
|
+
{fill ? (
|
|
484
|
+
<>
|
|
485
|
+
{header ? <RNView style={nonShrinking}>{header}</RNView> : null}
|
|
486
|
+
<RNView testID="sheet-modal-body" style={fillSlot}>
|
|
487
|
+
{scrollable ? (
|
|
488
|
+
<RNScrollView
|
|
489
|
+
testID="sheet-modal-scroll"
|
|
490
|
+
style={fillSlot}
|
|
491
|
+
keyboardShouldPersistTaps="handled"
|
|
492
|
+
>
|
|
493
|
+
{children}
|
|
494
|
+
</RNScrollView>
|
|
495
|
+
) : (
|
|
496
|
+
children
|
|
497
|
+
)}
|
|
498
|
+
</RNView>
|
|
499
|
+
</>
|
|
500
|
+
) : (
|
|
501
|
+
<>
|
|
502
|
+
{header}
|
|
484
503
|
{scrollable ? (
|
|
485
504
|
<RNScrollView
|
|
486
505
|
testID="sheet-modal-scroll"
|
|
487
|
-
style={
|
|
506
|
+
style={{ flexGrow: 0 }}
|
|
488
507
|
keyboardShouldPersistTaps="handled"
|
|
489
508
|
>
|
|
490
509
|
{children}
|
|
@@ -492,29 +511,14 @@ export function SheetModal({
|
|
|
492
511
|
) : (
|
|
493
512
|
children
|
|
494
513
|
)}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
style={{ flexGrow: 0 }}
|
|
504
|
-
keyboardShouldPersistTaps="handled"
|
|
505
|
-
>
|
|
506
|
-
{children}
|
|
507
|
-
</RNScrollView>
|
|
508
|
-
) : (
|
|
509
|
-
children
|
|
510
|
-
)}
|
|
511
|
-
</>
|
|
512
|
-
)}
|
|
513
|
-
</YStack>
|
|
514
|
-
</DialogRegionContext.Provider>
|
|
515
|
-
</YStack>
|
|
516
|
-
</Animated.View>
|
|
517
|
-
</RNView>
|
|
514
|
+
</>
|
|
515
|
+
)}
|
|
516
|
+
</YStack>
|
|
517
|
+
</DialogRegionContext.Provider>
|
|
518
|
+
</YStack>
|
|
519
|
+
</Animated.View>
|
|
520
|
+
</RNView>
|
|
521
|
+
</OverlayWindow>
|
|
518
522
|
</Modal>
|
|
519
523
|
);
|
|
520
524
|
}
|
package/src/SheetModal/index.tsx
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { transitionProps, useResolvedKnobs, wasKeyboardFocus } from "@multiplatform.one/theme";
|
|
13
|
-
import {
|
|
13
|
+
import { OverlayStackProvider, useOverlayZIndex } from "@multiplatform.one/forms";
|
|
14
14
|
import { useEffect, useId, useRef, type ReactNode, type RefObject } from "react";
|
|
15
15
|
import { isWeb, Sheet, View } from "tamagui";
|
|
16
16
|
import { DialogRegionContext, SheetFrame } from "../surfaces";
|
|
@@ -158,6 +158,7 @@ export function SheetModal({
|
|
|
158
158
|
fill = false,
|
|
159
159
|
}: SheetModalProps) {
|
|
160
160
|
const { knobProps } = useResolvedKnobs();
|
|
161
|
+
const sheetZIndex = useOverlayZIndex("sheet");
|
|
161
162
|
const transition = knobProps.motion.slide.transition;
|
|
162
163
|
const titleId = useId();
|
|
163
164
|
const frameRef = useRef<HTMLElement | null>(null);
|
|
@@ -174,7 +175,8 @@ export function SheetModal({
|
|
|
174
175
|
snapPointsMode="percent"
|
|
175
176
|
snapPoints={[snapPoint]}
|
|
176
177
|
transition={transition}
|
|
177
|
-
zIndex={
|
|
178
|
+
zIndex={sheetZIndex}
|
|
179
|
+
portalProps={{ zIndex: sheetZIndex }}
|
|
178
180
|
>
|
|
179
181
|
<Sheet.Overlay
|
|
180
182
|
backgroundColor="$shadow6"
|
|
@@ -206,30 +208,32 @@ export function SheetModal({
|
|
|
206
208
|
{...frameRingReset}
|
|
207
209
|
>
|
|
208
210
|
<DialogRegionContext.Provider value={IN_DIALOG_REGION}>
|
|
209
|
-
{
|
|
210
|
-
|
|
211
|
-
{
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
{
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
211
|
+
<OverlayStackProvider zIndex={sheetZIndex}>
|
|
212
|
+
{header ? (
|
|
213
|
+
<View id={titleId} {...(fill ? nonShrinking : null)}>
|
|
214
|
+
{header}
|
|
215
|
+
</View>
|
|
216
|
+
) : null}
|
|
217
|
+
{fill ? (
|
|
218
|
+
<View testID="sheet-modal-body" {...fillSlot}>
|
|
219
|
+
{scrollable ? (
|
|
220
|
+
<Sheet.ScrollView testID="sheet-modal-scroll" {...fillSlot}>
|
|
221
|
+
{children}
|
|
222
|
+
</Sheet.ScrollView>
|
|
223
|
+
) : (
|
|
224
|
+
children
|
|
225
|
+
)}
|
|
226
|
+
</View>
|
|
227
|
+
) : scrollable ? (
|
|
228
|
+
<Sheet.ScrollView testID="sheet-modal-scroll">{children}</Sheet.ScrollView>
|
|
229
|
+
) : (
|
|
230
|
+
children
|
|
231
|
+
)}
|
|
232
|
+
<View
|
|
233
|
+
style={{ height: "env(safe-area-inset-bottom)" }}
|
|
234
|
+
{...(fill ? nonShrinking : null)}
|
|
235
|
+
/>
|
|
236
|
+
</OverlayStackProvider>
|
|
233
237
|
</DialogRegionContext.Provider>
|
|
234
238
|
</SheetFrame>
|
|
235
239
|
</Sheet>
|