@multiplatform.one/components 9.1.0 → 9.2.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.
Files changed (203) hide show
  1. package/dist/cjs/SheetModal/SheetBodyRegion.cjs +44 -0
  2. package/dist/cjs/SheetModal/SheetBodyRegion.native.js +48 -0
  3. package/dist/cjs/SheetModal/SheetBodyRegion.native.js.map +1 -0
  4. package/dist/cjs/SheetModal/SheetHeader.cjs +11 -14
  5. package/dist/cjs/SheetModal/SheetHeader.native.js +11 -14
  6. package/dist/cjs/SheetModal/SheetHeader.native.js.map +1 -1
  7. package/dist/cjs/SheetModal/index.cjs +57 -18
  8. package/dist/cjs/SheetModal/index.native.js +87 -65
  9. package/dist/cjs/SheetModal/index.native.js.map +1 -1
  10. package/dist/cjs/actions/StandardAction.cjs +62 -1
  11. package/dist/cjs/actions/StandardAction.native.js +63 -1
  12. package/dist/cjs/actions/StandardAction.native.js.map +1 -1
  13. package/dist/cjs/appShell/TabHost.native.js +24 -3
  14. package/dist/cjs/appShell/TabHost.native.js.map +1 -1
  15. package/dist/cjs/appShell/bottomChrome.cjs +3 -0
  16. package/dist/cjs/appShell/bottomChrome.native.js +3 -0
  17. package/dist/cjs/appShell/bottomChrome.native.js.map +1 -1
  18. package/dist/cjs/appShell/index.cjs +2 -1
  19. package/dist/cjs/appShell/index.native.js +2 -1
  20. package/dist/cjs/appShell/index.native.js.map +1 -1
  21. package/dist/cjs/charts/ChartDataView.cjs +0 -1
  22. package/dist/cjs/charts/ChartDataView.native.js +0 -1
  23. package/dist/cjs/charts/ChartDataView.native.js.map +1 -1
  24. package/dist/cjs/icons/lucide.cjs +16 -8
  25. package/dist/cjs/icons/lucide.native.js +16 -8
  26. package/dist/cjs/icons/lucide.native.js.map +1 -1
  27. package/dist/cjs/icons/themed.cjs +4 -1
  28. package/dist/cjs/icons/themed.native.js +4 -1
  29. package/dist/cjs/icons/themed.native.js.map +1 -1
  30. package/dist/cjs/layouts/page.cjs +25 -2
  31. package/dist/cjs/layouts/page.native.js +27 -2
  32. package/dist/cjs/layouts/page.native.js.map +1 -1
  33. package/dist/cjs/layouts/timeline.cjs +4 -3
  34. package/dist/cjs/layouts/timeline.native.js +4 -3
  35. package/dist/cjs/layouts/timeline.native.js.map +1 -1
  36. package/dist/cjs/surfaces.cjs +1 -1
  37. package/dist/cjs/surfaces.native.js +1 -1
  38. package/dist/cjs/surfaces.native.js.map +1 -1
  39. package/dist/cjs/views/FilePreview.cjs +1 -1
  40. package/dist/cjs/views/FilePreview.native.js +1 -1
  41. package/dist/cjs/views/FilePreview.native.js.map +1 -1
  42. package/dist/esm/SheetModal/SheetBodyRegion.mjs +19 -0
  43. package/dist/esm/SheetModal/SheetBodyRegion.mjs.map +1 -0
  44. package/dist/esm/SheetModal/SheetBodyRegion.native.js +20 -0
  45. package/dist/esm/SheetModal/SheetBodyRegion.native.js.map +1 -0
  46. package/dist/esm/SheetModal/SheetHeader.mjs +11 -14
  47. package/dist/esm/SheetModal/SheetHeader.mjs.map +1 -1
  48. package/dist/esm/SheetModal/SheetHeader.native.js +11 -14
  49. package/dist/esm/SheetModal/SheetHeader.native.js.map +1 -1
  50. package/dist/esm/SheetModal/index.mjs +61 -22
  51. package/dist/esm/SheetModal/index.mjs.map +1 -1
  52. package/dist/esm/SheetModal/index.native.js +89 -67
  53. package/dist/esm/SheetModal/index.native.js.map +1 -1
  54. package/dist/esm/actions/StandardAction.mjs +63 -2
  55. package/dist/esm/actions/StandardAction.mjs.map +1 -1
  56. package/dist/esm/actions/StandardAction.native.js +64 -2
  57. package/dist/esm/actions/StandardAction.native.js.map +1 -1
  58. package/dist/esm/appShell/TabHost.native.js +26 -5
  59. package/dist/esm/appShell/TabHost.native.js.map +1 -1
  60. package/dist/esm/appShell/bottomChrome.mjs +2 -1
  61. package/dist/esm/appShell/bottomChrome.mjs.map +1 -1
  62. package/dist/esm/appShell/bottomChrome.native.js +2 -1
  63. package/dist/esm/appShell/bottomChrome.native.js.map +1 -1
  64. package/dist/esm/appShell/index.mjs +2 -2
  65. package/dist/esm/appShell/index.mjs.map +1 -1
  66. package/dist/esm/appShell/index.native.js +2 -2
  67. package/dist/esm/appShell/index.native.js.map +1 -1
  68. package/dist/esm/charts/ChartDataView.mjs +0 -1
  69. package/dist/esm/charts/ChartDataView.mjs.map +1 -1
  70. package/dist/esm/charts/ChartDataView.native.js +0 -1
  71. package/dist/esm/charts/ChartDataView.native.js.map +1 -1
  72. package/dist/esm/icons/lucide.mjs +11 -3
  73. package/dist/esm/icons/lucide.mjs.map +1 -1
  74. package/dist/esm/icons/lucide.native.js +11 -3
  75. package/dist/esm/icons/lucide.native.js.map +1 -1
  76. package/dist/esm/icons/themed.mjs +4 -1
  77. package/dist/esm/icons/themed.mjs.map +1 -1
  78. package/dist/esm/icons/themed.native.js +4 -1
  79. package/dist/esm/icons/themed.native.js.map +1 -1
  80. package/dist/esm/layouts/page.mjs +26 -3
  81. package/dist/esm/layouts/page.mjs.map +1 -1
  82. package/dist/esm/layouts/page.native.js +28 -3
  83. package/dist/esm/layouts/page.native.js.map +1 -1
  84. package/dist/esm/layouts/timeline.mjs +2 -1
  85. package/dist/esm/layouts/timeline.mjs.map +1 -1
  86. package/dist/esm/layouts/timeline.native.js +2 -1
  87. package/dist/esm/layouts/timeline.native.js.map +1 -1
  88. package/dist/esm/surfaces.mjs +1 -1
  89. package/dist/esm/surfaces.mjs.map +1 -1
  90. package/dist/esm/surfaces.native.js +1 -1
  91. package/dist/esm/surfaces.native.js.map +1 -1
  92. package/dist/esm/views/FilePreview.mjs +1 -1
  93. package/dist/esm/views/FilePreview.mjs.map +1 -1
  94. package/dist/esm/views/FilePreview.native.js +1 -1
  95. package/dist/esm/views/FilePreview.native.js.map +1 -1
  96. package/dist/jsx/SheetModal/SheetBodyRegion.mjs +19 -0
  97. package/dist/jsx/SheetModal/SheetBodyRegion.mjs.map +1 -0
  98. package/dist/jsx/SheetModal/SheetBodyRegion.native.js +48 -0
  99. package/dist/jsx/SheetModal/SheetBodyRegion.native.js.map +1 -0
  100. package/dist/jsx/SheetModal/SheetHeader.mjs +11 -14
  101. package/dist/jsx/SheetModal/SheetHeader.mjs.map +1 -1
  102. package/dist/jsx/SheetModal/SheetHeader.native.js +11 -14
  103. package/dist/jsx/SheetModal/SheetHeader.native.js.map +1 -1
  104. package/dist/jsx/SheetModal/index.mjs +61 -22
  105. package/dist/jsx/SheetModal/index.mjs.map +1 -1
  106. package/dist/jsx/SheetModal/index.native.js +87 -65
  107. package/dist/jsx/SheetModal/index.native.js.map +1 -1
  108. package/dist/jsx/actions/StandardAction.mjs +63 -2
  109. package/dist/jsx/actions/StandardAction.mjs.map +1 -1
  110. package/dist/jsx/actions/StandardAction.native.js +63 -1
  111. package/dist/jsx/actions/StandardAction.native.js.map +1 -1
  112. package/dist/jsx/appShell/TabHost.native.js +24 -3
  113. package/dist/jsx/appShell/TabHost.native.js.map +1 -1
  114. package/dist/jsx/appShell/bottomChrome.mjs +2 -1
  115. package/dist/jsx/appShell/bottomChrome.mjs.map +1 -1
  116. package/dist/jsx/appShell/bottomChrome.native.js +3 -0
  117. package/dist/jsx/appShell/bottomChrome.native.js.map +1 -1
  118. package/dist/jsx/appShell/index.mjs +2 -2
  119. package/dist/jsx/appShell/index.mjs.map +1 -1
  120. package/dist/jsx/appShell/index.native.js +2 -1
  121. package/dist/jsx/charts/ChartDataView.mjs +0 -1
  122. package/dist/jsx/charts/ChartDataView.mjs.map +1 -1
  123. package/dist/jsx/charts/ChartDataView.native.js +0 -1
  124. package/dist/jsx/charts/ChartDataView.native.js.map +1 -1
  125. package/dist/jsx/icons/lucide.mjs +11 -3
  126. package/dist/jsx/icons/lucide.mjs.map +1 -1
  127. package/dist/jsx/icons/lucide.native.js +16 -8
  128. package/dist/jsx/icons/lucide.native.js.map +1 -1
  129. package/dist/jsx/icons/themed.mjs +4 -1
  130. package/dist/jsx/icons/themed.mjs.map +1 -1
  131. package/dist/jsx/icons/themed.native.js +4 -1
  132. package/dist/jsx/icons/themed.native.js.map +1 -1
  133. package/dist/jsx/layouts/page.mjs +26 -3
  134. package/dist/jsx/layouts/page.mjs.map +1 -1
  135. package/dist/jsx/layouts/page.native.js +27 -2
  136. package/dist/jsx/layouts/page.native.js.map +1 -1
  137. package/dist/jsx/layouts/timeline.mjs +2 -1
  138. package/dist/jsx/layouts/timeline.mjs.map +1 -1
  139. package/dist/jsx/layouts/timeline.native.js +4 -3
  140. package/dist/jsx/layouts/timeline.native.js.map +1 -1
  141. package/dist/jsx/surfaces.mjs +1 -1
  142. package/dist/jsx/surfaces.mjs.map +1 -1
  143. package/dist/jsx/surfaces.native.js +1 -1
  144. package/dist/jsx/views/FilePreview.mjs +1 -1
  145. package/dist/jsx/views/FilePreview.mjs.map +1 -1
  146. package/dist/jsx/views/FilePreview.native.js +1 -1
  147. package/dist/jsx/views/FilePreview.native.js.map +1 -1
  148. package/package.json +7 -7
  149. package/src/SheetFrame.stories.tsx +2 -2
  150. package/src/SheetModal/SheetBodyRegion.tsx +19 -0
  151. package/src/SheetModal/SheetHeader.tsx +23 -27
  152. package/src/SheetModal/SheetModal.grabber.spec.tsx +52 -10
  153. package/src/SheetModal/SheetModal.native.spec.tsx +90 -6
  154. package/src/SheetModal/SheetModal.noHeaderBar.spec.tsx +103 -0
  155. package/src/SheetModal/SheetModal.onDismiss.spec.tsx +35 -0
  156. package/src/SheetModal/SheetModal.stories.spec.tsx +11 -13
  157. package/src/SheetModal/SheetModal.stories.tsx +2 -6
  158. package/src/SheetModal/SheetModal.titleRow.spec.tsx +203 -0
  159. package/src/SheetModal/index.native.tsx +83 -54
  160. package/src/SheetModal/index.tsx +99 -25
  161. package/src/SheetScrollView/SheetScrollView.stories.tsx +2 -2
  162. package/src/actions/StandardAction.tsx +72 -4
  163. package/src/appShell/TabHost.native.tsx +50 -5
  164. package/src/appShell/TabHost.nestedScroll.spec.tsx +177 -0
  165. package/src/appShell/bottomChrome.ts +2 -0
  166. package/src/appShell/index.ts +1 -1
  167. package/src/charts/ChartDataView.tsx +0 -1
  168. package/src/charts/Charts.stories.tsx +20 -0
  169. package/src/icons/lucide.glyphGrid.spec.tsx +41 -0
  170. package/src/icons/lucide.ts +21 -2
  171. package/src/icons/themed.tsx +6 -2
  172. package/src/layouts/page.tsx +35 -2
  173. package/src/layouts/severityShape.spec.tsx +31 -0
  174. package/src/layouts/timeline.tsx +1 -1
  175. package/src/surfaces.spec.tsx +6 -2
  176. package/src/surfaces.tsx +1 -1
  177. package/src/views/FilePreview.tsx +1 -8
  178. package/src/views/filePreview.spec.tsx +3 -4
  179. package/types/Chip/index.d.ts +1 -1
  180. package/types/Collapsible.d.ts +1 -1
  181. package/types/Dialog.d.ts +3 -3
  182. package/types/SheetModal/SheetBodyRegion.d.ts +9 -0
  183. package/types/SheetModal/SheetBodyRegion.d.ts.map +1 -0
  184. package/types/SheetModal/SheetHeader.d.ts +4 -4
  185. package/types/SheetModal/SheetHeader.d.ts.map +1 -1
  186. package/types/SheetModal/index.d.ts +12 -4
  187. package/types/SheetModal/index.d.ts.map +1 -1
  188. package/types/SheetModal/index.native.d.ts +1 -1
  189. package/types/SheetModal/index.native.d.ts.map +1 -1
  190. package/types/actions/StandardAction.d.ts +4 -3
  191. package/types/actions/StandardAction.d.ts.map +1 -1
  192. package/types/appShell/TabHost.native.d.ts.map +1 -1
  193. package/types/appShell/bottomChrome.d.ts +1 -0
  194. package/types/appShell/bottomChrome.d.ts.map +1 -1
  195. package/types/appShell/index.d.ts +1 -1
  196. package/types/appShell/index.d.ts.map +1 -1
  197. package/types/charts/ChartDataView.d.ts.map +1 -1
  198. package/types/icons/lucide.d.ts +7 -3
  199. package/types/icons/lucide.d.ts.map +1 -1
  200. package/types/icons/themed.d.ts.map +1 -1
  201. package/types/layouts/page.d.ts.map +1 -1
  202. package/types/layouts/timeline.d.ts.map +1 -1
  203. package/types/views/FilePreview.d.ts.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/components",
3
- "version": "9.1.0",
3
+ "version": "9.2.0",
4
4
  "description": "multiplatform.one ui components",
5
5
  "keywords": [
6
6
  "components",
@@ -70,9 +70,9 @@
70
70
  },
71
71
  "dependencies": {
72
72
  "@floating-ui/react": "^0.27.20",
73
- "@multiplatform.one/forms": "^9.1.0",
74
- "@multiplatform.one/platform": "^9.1.0",
75
- "@multiplatform.one/theme": "^9.1.0",
73
+ "@multiplatform.one/forms": "^9.2.0",
74
+ "@multiplatform.one/platform": "^9.2.0",
75
+ "@multiplatform.one/theme": "^9.2.0",
76
76
  "@phosphor-icons/react": "^2.1.10",
77
77
  "@shopify/flash-list": "^2.3.1",
78
78
  "@tamagui/colors": "2.7.6",
@@ -99,9 +99,9 @@
99
99
  "tamagui": "2.7.6"
100
100
  },
101
101
  "devDependencies": {
102
- "@multiplatform.one/config": "9.1.0",
103
- "@multiplatform.one/storybook": "9.1.0",
104
- "@multiplatform.one/test-utils": "9.1.0",
102
+ "@multiplatform.one/config": "9.2.0",
103
+ "@multiplatform.one/storybook": "9.2.0",
104
+ "@multiplatform.one/test-utils": "9.2.0",
105
105
  "@tamagui/build": "2.7.6",
106
106
  "@testing-library/jest-dom": "^7.0.1",
107
107
  "@testing-library/react": "^16.3.3",
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
2
2
  import { useEffect, useState } from "react";
3
3
  // Catalog Button (G-15 story honesty / LC-18, UX-P06).
4
4
  import { Button } from "@multiplatform.one/forms";
5
- import { sheetGrabber } from "@multiplatform.one/theme";
5
+ import { sheetHandle } from "@multiplatform.one/theme";
6
6
  import { isWeb, Sheet, YStack } from "tamagui";
7
7
  import { ScrollView } from "./ScrollView";
8
8
  import { SheetModal } from "./SheetModal";
@@ -84,7 +84,7 @@ function TabsInSheetHarness() {
84
84
  onPositionChange={setPosition}
85
85
  dismissOnSnapToBottom={false}
86
86
  >
87
- <Sheet.Handle {...sheetGrabber} aria-label="Resize" />
87
+ <Sheet.Handle {...sheetHandle} aria-label="Resize" />
88
88
  <SheetFrame borderBottomLeftRadius={0} borderBottomRightRadius={0}>
89
89
  <SizableText fontWeight="600">Stack</SizableText>
90
90
  <Tabs
@@ -0,0 +1,19 @@
1
+ import { SheetBodyProvider } from "@multiplatform.one/theme";
2
+ import type { ReactNode } from "react";
3
+ import { DialogRegionContext } from "../surfaces";
4
+
5
+ const IN_DIALOG_REGION = { inDialogRegion: true } as const;
6
+
7
+ /**
8
+ * A sheet's body: a dialog region (DG-OVL-04) and a sheet body (FZ-11418), so
9
+ * an `OverlayHeader` inside draws its title as content with no ✕.
10
+ */
11
+ export function SheetBodyRegion({ children }: { children?: ReactNode }) {
12
+ return (
13
+ <SheetBodyProvider value>
14
+ <DialogRegionContext.Provider value={IN_DIALOG_REGION}>
15
+ {children}
16
+ </DialogRegionContext.Provider>
17
+ </SheetBodyProvider>
18
+ );
19
+ }
@@ -31,10 +31,10 @@ export function isOverlayHeader(node: ReactNode): node is ReactElement<OverlayHe
31
31
  * icon buttons in the trailing area (LC-262 DIRECT-ACTIONS), never hidden in a
32
32
  * menu. The actions are a bar (LC-153), so they take the bar tint (LC-176).
33
33
  *
34
- * An `OverlayHeader` is the sheet's bar (FZ-8439, the iOS 26 sheet): ✕ leading,
35
- * the accent ✓ trailing, and `actions` between the title and the ✓, so the
36
- * confirm keeps the trailing edge. A lone action is not a group: on iOS its
37
- * glass is the same circle as the ✕, not a capsule.
34
+ * An `OverlayHeader` is the sheet's title row, content rather than a bar
35
+ * (FZ-11418): no ✕, the accent ✓ trailing, and `actions` between the title
36
+ * and the ✓, so the confirm keeps the trailing edge. A lone action is not a
37
+ * group: on iOS its glass is a circle, not a capsule.
38
38
  */
39
39
  export function SheetHeader({
40
40
  header,
@@ -48,29 +48,25 @@ export function SheetHeader({
48
48
  }) {
49
49
  if (isOverlayHeader(header)) {
50
50
  const own = header.props.actions;
51
- return (
52
- <Surface bar>
53
- {actions
54
- ? cloneElement(header, {
55
- actions: (
56
- <XStack testID="sheet-modal-header-actions" flexShrink={0} alignItems="center">
57
- {countItems(own) + countItems(actions) > 1 ? (
58
- <IconButtonGroup>
59
- {own}
60
- {actions}
61
- </IconButtonGroup>
62
- ) : (
63
- <>
64
- {own}
65
- {actions}
66
- </>
67
- )}
68
- </XStack>
69
- ),
70
- })
71
- : header}
72
- </Surface>
73
- );
51
+ return actions
52
+ ? cloneElement(header, {
53
+ actions: (
54
+ <XStack testID="sheet-modal-header-actions" flexShrink={0} alignItems="center">
55
+ {countItems(own) + countItems(actions) > 1 ? (
56
+ <IconButtonGroup>
57
+ {own}
58
+ {actions}
59
+ </IconButtonGroup>
60
+ ) : (
61
+ <>
62
+ {own}
63
+ {actions}
64
+ </>
65
+ )}
66
+ </XStack>
67
+ ),
68
+ })
69
+ : header;
74
70
  }
75
71
  if (!actions) return <>{header}</>;
76
72
  return (
@@ -1,10 +1,11 @@
1
1
  /**
2
- * FZ-8648: one grabber. SheetModal draws the theme's `sheetGrabber` on the web
3
- * and on native, with no local transform or margin, the recipe the
4
- * FloatingPanel sheet draws too (`public/forms/.../sheetGrabber.spec.tsx`).
2
+ * FZ-11418: SheetModal draws tamagui's Sheet.Handle, the theme's
3
+ * `sheetHandle`, as a pill detached ABOVE the frame on the scrim, on the web
4
+ * and on native, and rounds the frame's top at the sheet radius on both.
5
+ * FloatingPanel's sheet keeps `sheetGrabber` (`public/forms/.../sheetGrabber.spec.tsx`).
5
6
  */
6
7
  import { renderWithProviders } from "@multiplatform.one/test-utils";
7
- import { sheetGrabber } from "@multiplatform.one/theme";
8
+ import { sheetHandle, useResolvedKnobs } from "@multiplatform.one/theme";
8
9
  import { describe, expect, it, vi } from "vitest";
9
10
  import { Text, View } from "tamagui";
10
11
  import { SheetModal as NativeSheetModal } from "./index.native";
@@ -19,25 +20,63 @@ vi.mock("react-native-web", async (importOriginal) => ({
19
20
  const atoms = (node: Element) => String(node.className).split(/\s+/).filter(Boolean);
20
21
 
21
22
  function recipeAtoms() {
22
- const view = renderWithProviders(<View testID="recipe" {...sheetGrabber} />);
23
+ const view = renderWithProviders(<View testID="recipe" {...sheetHandle} />);
23
24
  const list = atoms(view.getByTestId("recipe"));
24
25
  view.unmount();
25
26
  return list;
26
27
  }
27
28
 
28
- describe("SheetModal grabber (FZ-8648)", () => {
29
- it("draws the recipe on native", () => {
29
+ function TopCorners() {
30
+ const { knobProps } = useResolvedKnobs();
31
+ return (
32
+ <View
33
+ testID="corners"
34
+ borderTopLeftRadius={knobProps.sheetRadius.borderRadius}
35
+ borderTopRightRadius={knobProps.sheetRadius.borderRadius}
36
+ />
37
+ );
38
+ }
39
+
40
+ function cornerAtoms() {
41
+ const view = renderWithProviders(<TopCorners />);
42
+ const list = atoms(view.getByTestId("corners"));
43
+ view.unmount();
44
+ return list;
45
+ }
46
+
47
+ const precedes = (a: Element, b: Element) =>
48
+ (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
49
+
50
+ describe("SheetModal handle (FZ-11418, tamagui's Sheet.Handle)", () => {
51
+ it("draws the handle recipe above the native frame, outside it", () => {
30
52
  const recipe = recipeAtoms();
31
53
  const result = renderWithProviders(
32
54
  <NativeSheetModal open onOpenChange={() => {}}>
33
55
  <Text>Body</Text>
34
56
  </NativeSheetModal>,
35
57
  );
36
- const capsule = result.getByTestId("sheet-modal-grabber").firstElementChild as Element;
37
- expect(atoms(capsule)).toEqual(expect.arrayContaining(recipe));
58
+ const zone = result.getByTestId("sheet-modal-grabber");
59
+ const surface = result.getByTestId("sheet-modal-surface");
60
+ const pill = zone.firstElementChild as Element;
61
+ expect(atoms(pill)).toEqual(expect.arrayContaining(recipe));
62
+ expect(surface.contains(zone)).toBe(false);
63
+ expect(precedes(zone, surface)).toBe(true);
64
+ });
65
+
66
+ it("rounds the native frame's top at the sheet radius", () => {
67
+ const corners = cornerAtoms();
68
+ const result = renderWithProviders(
69
+ <NativeSheetModal open onOpenChange={() => {}}>
70
+ <Text>Body</Text>
71
+ </NativeSheetModal>,
72
+ );
73
+ expect(atoms(result.getByTestId("sheet-modal-surface"))).toEqual(
74
+ expect.arrayContaining(corners),
75
+ );
76
+ expect(atoms(result.getByTestId("sheet-modal-clip"))).toEqual(expect.arrayContaining(corners));
38
77
  });
39
78
 
40
- it("draws the recipe on the web, with no transform", async () => {
79
+ it("draws the handle recipe above the web frame, outside it, with no transform", async () => {
41
80
  const recipe = recipeAtoms();
42
81
  const result = renderWithProviders(
43
82
  <SheetModal open onOpenChange={() => {}}>
@@ -45,7 +84,10 @@ describe("SheetModal grabber (FZ-8648)", () => {
45
84
  </SheetModal>,
46
85
  );
47
86
  const handle = await result.findByLabelText("Resize");
87
+ const frame = document.querySelector("[role='dialog']") as Element;
48
88
  expect(atoms(handle)).toEqual(expect.arrayContaining(recipe));
49
89
  expect(handle.getAttribute("style") ?? "").not.toMatch(/transform/);
90
+ expect(frame.contains(handle)).toBe(false);
91
+ expect(precedes(handle, frame)).toBe(true);
50
92
  });
51
93
  });
@@ -2,22 +2,44 @@ import { Preset } from "@multiplatform.one/theme";
2
2
  import { renderWithProviders } from "@multiplatform.one/test-utils";
3
3
  import { act } from "@testing-library/react";
4
4
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
5
- import { Animated, PanResponder } from "react-native";
5
+ import { Animated, PanResponder, Platform } from "react-native";
6
6
  import { Text } from "tamagui";
7
7
  import { useSheetNavigation } from "@multiplatform.one/forms";
8
8
  import { fireEvent } from "@testing-library/react";
9
9
  import { SheetModal } from "./index.native";
10
10
 
11
- const modal = vi.hoisted(() => ({ onShow: undefined as undefined | (() => void) }));
11
+ const modal = vi.hoisted(() => ({
12
+ onShow: undefined as undefined | (() => void),
13
+ onDismiss: undefined as undefined | (() => void),
14
+ animationType: undefined as undefined | string,
15
+ }));
12
16
  vi.mock("react-native-web", async (importOriginal) => ({
13
17
  ...(await importOriginal<typeof import("react-native")>()),
14
18
  ActionSheetIOS: undefined,
15
- Modal: ({ children, onShow }: { children: import("react").ReactNode; onShow?: () => void }) => {
19
+ Modal: ({
20
+ children,
21
+ onShow,
22
+ onDismiss,
23
+ animationType,
24
+ }: {
25
+ children: import("react").ReactNode;
26
+ onShow?: () => void;
27
+ onDismiss?: () => void;
28
+ animationType?: string;
29
+ }) => {
16
30
  modal.onShow = onShow;
31
+ modal.onDismiss = onDismiss;
32
+ modal.animationType = animationType;
17
33
  return children;
18
34
  },
19
35
  }));
20
36
 
37
+ function slideCalls() {
38
+ return vi
39
+ .mocked(Animated.timing)
40
+ .mock.calls.filter(([, config]) => (config as { toValue: number }).toValue === 0);
41
+ }
42
+
21
43
  const onOpenChange = vi.fn();
22
44
  let dismissCompletion: (result: { finished: boolean }) => void;
23
45
  let release: () => void;
@@ -26,6 +48,8 @@ beforeEach(() => {
26
48
  vi.useFakeTimers();
27
49
  completions = [];
28
50
  modal.onShow = undefined;
51
+ modal.onDismiss = undefined;
52
+ modal.animationType = undefined;
29
53
  onOpenChange.mockReset();
30
54
  vi.spyOn(PanResponder, "create").mockImplementation((config) => {
31
55
  release = () => config.onPanResponderRelease?.({} as never, { dy: 1000, vy: 2 } as never);
@@ -76,10 +100,10 @@ describe("SheetModal native presentation lifecycle", () => {
76
100
  });
77
101
  it("enters without onShow and ignores onShow for the same presentation", () => {
78
102
  renderWithProviders(panel(true));
79
- expect(Animated.timing).toHaveBeenCalledTimes(1);
103
+ expect(slideCalls()).toHaveLength(1);
80
104
  expect(modal.onShow).toBeTypeOf("function");
81
105
  act(() => modal.onShow?.());
82
- expect(Animated.timing).toHaveBeenCalledTimes(1);
106
+ expect(slideCalls()).toHaveLength(1);
83
107
  });
84
108
  it("keeps an open presentation in place when animation changes and uses it on the next open", () => {
85
109
  const { rerender } = renderWithProviders(
@@ -87,7 +111,7 @@ describe("SheetModal native presentation lifecycle", () => {
87
111
  );
88
112
  const writes = vi.spyOn(Animated.Value.prototype, "setValue");
89
113
  rerender(<Preset overrides={{ animation: "slow" }}>{panel(true)}</Preset>);
90
- expect(Animated.timing).toHaveBeenCalledTimes(1);
114
+ expect(slideCalls()).toHaveLength(1);
91
115
  expect(writes).not.toHaveBeenCalled();
92
116
  rerender(<Preset overrides={{ animation: "slow" }}>{panel(false)}</Preset>);
93
117
  rerender(<Preset overrides={{ animation: "slow" }}>{panel(true)}</Preset>);
@@ -169,6 +193,66 @@ describe("SheetModal native presentation lifecycle", () => {
169
193
  });
170
194
  });
171
195
 
196
+ describe("SheetModal native latency (FZ-11084)", () => {
197
+ function sheet(open: boolean, onDismiss?: () => void) {
198
+ return (
199
+ <SheetModal open={open} onOpenChange={onOpenChange} onDismiss={onDismiss}>
200
+ <Text>row</Text>
201
+ </SheetModal>
202
+ );
203
+ }
204
+
205
+ it("presents without a cross-dissolve, so the slide is the only transition", () => {
206
+ renderWithProviders(sheet(true));
207
+ expect(modal.animationType).toBe("none");
208
+ });
209
+
210
+ it("dims the scrim in place on the JS driver over the scrim duration", () => {
211
+ renderWithProviders(sheet(true));
212
+ expect(Animated.timing).toHaveBeenCalledWith(
213
+ expect.anything(),
214
+ expect.objectContaining({ toValue: 1, useNativeDriver: false }),
215
+ );
216
+ });
217
+
218
+ it("closes on an outside press in the first frame, with no arming delay", () => {
219
+ const view = renderWithProviders(sheet(true));
220
+ act(() => {
221
+ fireEvent.click(view.getByRole("button", { name: "Close" }));
222
+ });
223
+ expect(onOpenChange).toHaveBeenCalledExactlyOnceWith(false);
224
+ expect(vi.getTimerCount()).toBe(0);
225
+ });
226
+
227
+ it("forwards the iOS modal dismissal to onDismiss, once, only after a close", () => {
228
+ const os = Platform.OS;
229
+ Object.defineProperty(Platform, "OS", { value: "ios", configurable: true });
230
+ try {
231
+ const onDismiss = vi.fn();
232
+ const { rerender } = renderWithProviders(sheet(true, onDismiss));
233
+ act(() => modal.onDismiss?.());
234
+ expect(onDismiss).not.toHaveBeenCalled();
235
+ rerender(sheet(false, onDismiss));
236
+ expect(onDismiss).not.toHaveBeenCalled();
237
+ act(() => modal.onDismiss?.());
238
+ act(() => modal.onDismiss?.());
239
+ expect(onDismiss).toHaveBeenCalledTimes(1);
240
+ } finally {
241
+ Object.defineProperty(Platform, "OS", { value: os, configurable: true });
242
+ }
243
+ });
244
+
245
+ it("fires onDismiss once the close commits where the modal has no dismissal event", () => {
246
+ const onDismiss = vi.fn();
247
+ const { rerender } = renderWithProviders(sheet(false, onDismiss));
248
+ expect(onDismiss).not.toHaveBeenCalled();
249
+ rerender(sheet(true, onDismiss));
250
+ expect(onDismiss).not.toHaveBeenCalled();
251
+ rerender(sheet(false, onDismiss));
252
+ expect(onDismiss).toHaveBeenCalledTimes(1);
253
+ });
254
+ });
255
+
172
256
  describe("SheetModal native navigation stack (FZ-7830 round 3)", () => {
173
257
  function Pusher() {
174
258
  const store = useSheetNavigation();
@@ -0,0 +1,103 @@
1
+ /**
2
+ * FZ-11418: a sheet has no header bar and no ✕, as tamagui's Sheet has none.
3
+ * An `OverlayHeader` passed to SheetModal draws its title as the body's first
4
+ * line; the sheet still closes by Escape on the web and by the scrim, which
5
+ * is the screen reader's "Close" on native, beside its accessibility escape.
6
+ * A centred dialog opened from a sheet keeps its own ✕.
7
+ */
8
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
9
+ import { DialogContent, SheetBodyProvider } from "@multiplatform.one/theme";
10
+ import { cleanup, fireEvent, screen } from "@testing-library/react";
11
+ import { readFileSync } from "node:fs";
12
+ import { dirname, join } from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+ import { afterEach, describe, expect, it, vi } from "vitest";
15
+ import { Dialog, Text } from "tamagui";
16
+ import { OverlayHeader } from "../actions/StandardAction";
17
+ import { SheetModal as NativeSheetModal } from "./index.native";
18
+ import { SheetModal } from "./index";
19
+
20
+ vi.mock("react-native-web", async (importOriginal) => ({
21
+ ...(await importOriginal<typeof import("react-native")>()),
22
+ ActionSheetIOS: undefined,
23
+ Modal: ({ children }: { children: import("react").ReactNode }) => children,
24
+ }));
25
+
26
+ afterEach(cleanup);
27
+
28
+ const header = <OverlayHeader title="Move to project" onClose={() => {}} />;
29
+
30
+ describe("SheetModal draws no header bar and no ✕ (FZ-11418)", () => {
31
+ it("web: the title is content and no close button is drawn", async () => {
32
+ renderWithProviders(
33
+ <SheetModal open onOpenChange={() => {}} header={header}>
34
+ <Text>Body</Text>
35
+ </SheetModal>,
36
+ );
37
+ const frame = (await screen.findAllByRole("dialog"))[0]!;
38
+ const row = frame.querySelector("[data-mp-overlay-header]")!;
39
+ expect(row.getAttribute("data-mp-overlay-face")).toBe("sheet");
40
+ expect(row.textContent).toBe("Move to project");
41
+ expect(frame.querySelectorAll("[role='button']")).toHaveLength(0);
42
+ });
43
+
44
+ it("native: the only Close is the scrim, outside the sheet's surface", () => {
45
+ renderWithProviders(
46
+ <NativeSheetModal open onOpenChange={() => {}} header={header}>
47
+ <Text>Body</Text>
48
+ </NativeSheetModal>,
49
+ );
50
+ const surface = screen.getByTestId("sheet-modal-surface");
51
+ expect(surface.textContent).toContain("Move to project");
52
+ const closes = screen.getAllByRole("button", { name: "Close" });
53
+ expect(closes).toHaveLength(1);
54
+ expect(surface.contains(closes[0]!)).toBe(false);
55
+ });
56
+
57
+ it("web: Escape still dismisses", async () => {
58
+ const onOpenChange = vi.fn();
59
+ renderWithProviders(
60
+ <SheetModal open onOpenChange={onOpenChange} header={header}>
61
+ <Text>Body</Text>
62
+ </SheetModal>,
63
+ );
64
+ await screen.findAllByRole("dialog");
65
+ fireEvent.keyDown(window, { key: "Escape" });
66
+ expect(onOpenChange).toHaveBeenCalledWith(false);
67
+ });
68
+
69
+ it("native: the surface keeps VoiceOver's escape and modal scope", () => {
70
+ const src = readFileSync(
71
+ join(dirname(fileURLToPath(import.meta.url)), "index.native.tsx"),
72
+ "utf8",
73
+ );
74
+ expect(src).toContain("onAccessibilityEscape={close}");
75
+ expect(src).toContain("accessibilityViewIsModal");
76
+ });
77
+
78
+ it("an OverlayHeader with nothing to show draws nothing in a sheet", () => {
79
+ const { container } = renderWithProviders(
80
+ <SheetBodyProvider value>
81
+ <OverlayHeader onClose={() => {}} />
82
+ </SheetBodyProvider>,
83
+ );
84
+ expect(container.querySelector("[data-mp-overlay-header]")).toBeNull();
85
+ });
86
+
87
+ it("a centred dialog opened from a sheet keeps its ✕", async () => {
88
+ renderWithProviders(
89
+ <SheetBodyProvider value>
90
+ <Dialog modal open>
91
+ <Dialog.Portal>
92
+ <DialogContent>
93
+ <OverlayHeader title="About" onClose={() => {}} />
94
+ </DialogContent>
95
+ </Dialog.Portal>
96
+ </Dialog>
97
+ </SheetBodyProvider>,
98
+ );
99
+ const close = await screen.findByRole("button", { name: "Close" });
100
+ const row = close.closest("[data-mp-overlay-header]")!;
101
+ expect(row.getAttribute("data-mp-overlay-face")).toBeNull();
102
+ });
103
+ });
@@ -0,0 +1,35 @@
1
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
2
+ import { waitFor } from "@testing-library/react";
3
+ import { describe, expect, it, vi } from "vitest";
4
+ import { Text } from "tamagui";
5
+ import { SheetModal } from "./index";
6
+
7
+ /*
8
+ * FZ-11084: a consumer that presents something after a sheet closes needs to
9
+ * know when the sheet is gone, not guess at a delay. The web twin reports it
10
+ * when the exit slide completes, once per close, never for a sheet that was
11
+ * never open.
12
+ */
13
+ function sheet(open: boolean, onDismiss: () => void) {
14
+ return (
15
+ <SheetModal open={open} onOpenChange={() => {}} onDismiss={onDismiss}>
16
+ <Text>row</Text>
17
+ </SheetModal>
18
+ );
19
+ }
20
+
21
+ describe("SheetModal web onDismiss (FZ-11084)", () => {
22
+ it("fires once after a close and not for a sheet that never opened", async () => {
23
+ const onDismiss = vi.fn();
24
+ const { rerender } = renderWithProviders(sheet(false, onDismiss));
25
+ await new Promise((resolve) => setTimeout(resolve, 50));
26
+ expect(onDismiss).not.toHaveBeenCalled();
27
+ rerender(sheet(true, onDismiss));
28
+ await new Promise((resolve) => setTimeout(resolve, 50));
29
+ expect(onDismiss).not.toHaveBeenCalled();
30
+ rerender(sheet(false, onDismiss));
31
+ await waitFor(() => expect(onDismiss).toHaveBeenCalledTimes(1));
32
+ await new Promise((resolve) => setTimeout(resolve, 200));
33
+ expect(onDismiss).toHaveBeenCalledTimes(1);
34
+ });
35
+ });
@@ -48,22 +48,23 @@ describe("SheetModal stories", () => {
48
48
  for (const frame of frames) expect(frame.getAttribute("aria-modal")).toBe("true");
49
49
  });
50
50
 
51
- it("the sheet header carries cancel and the confirm as symbols (LC-260)", () => {
51
+ it("FZ-11418: the title row carries the confirm as a symbol and draws no ✕ or Cancel", () => {
52
52
  renderWithProviders(<>{OpenOnMount.render?.({} as never, {} as never)}</>);
53
- const cancel = screen.getAllByRole("button", { name: "Cancel" });
54
53
  const move = screen.getAllByRole("button", { name: "Move" });
55
- expect(cancel.length).toBeGreaterThan(0);
56
54
  expect(move.length).toBeGreaterThan(0);
57
- for (const button of [...cancel, ...move]) expect(button.textContent).toBe("");
55
+ for (const button of move) expect(button.textContent).toBe("");
58
56
  expect(move[0]!.getAttribute("data-mp-icon-button")).toBe("primary");
57
+ expect(screen.queryAllByRole("button", { name: "Cancel" })).toHaveLength(0);
58
+ expect(screen.queryAllByRole("button", { name: "Close" })).toHaveLength(0);
59
59
  });
60
60
 
61
- it("FZ-8439: ✕ leads, the accent ✓ trails, and the body has no Cancel/confirm row", () => {
61
+ it("FZ-11418: the title leads as content, the accent ✓ trails, and the body has no Cancel/confirm row", () => {
62
62
  renderWithProviders(<>{OpenOnMount.render?.({} as never, {} as never)}</>);
63
- const header = document.querySelector('[data-mp-overlay-header="confirm"]')!;
64
- const buttons = Array.from(header.querySelectorAll('[role="button"]'));
65
- expect(buttons[0]!.getAttribute("aria-label")).toBe("Cancel");
66
- expect(buttons.at(-1)!.getAttribute("aria-label")).toBe("Move");
63
+ const row = document.querySelector('[data-mp-overlay-header="confirm"]')!;
64
+ expect(row.getAttribute("data-mp-overlay-face")).toBe("sheet");
65
+ const buttons = Array.from(row.querySelectorAll('[role="button"]'));
66
+ expect(buttons.map((button) => button.getAttribute("aria-label"))).toEqual(["Move"]);
67
+ expect(row.firstElementChild?.textContent).toBe("Move to project");
67
68
  expect(screen.queryAllByText(/^(Cancel|Move)$/)).toHaveLength(0);
68
69
  });
69
70
 
@@ -73,10 +74,7 @@ describe("SheetModal stories", () => {
73
74
  const names = Array.from(header.querySelectorAll('[role="button"]')).map((button) =>
74
75
  button.getAttribute("aria-label"),
75
76
  );
76
- expect(names[0]).toBe("Cancel");
77
- expect(names.at(-1)).toBe("Save");
78
- expect(names.indexOf("Share")).toBeGreaterThan(0);
79
- expect(names.indexOf("Share")).toBeLessThan(names.length - 1);
77
+ expect(names).toEqual(["Share", "Save"]);
80
78
  expect(screen.getAllByRole("dialog", { name: "Edit document" }).length).toBeGreaterThan(0);
81
79
  });
82
80
 
@@ -67,8 +67,6 @@ function Harness({
67
67
  header={
68
68
  <OverlayHeader
69
69
  title="Move to project"
70
- closeKind="cancel"
71
- onClose={() => setOpen(false)}
72
70
  onConfirm={() => setOpen(false)}
73
71
  confirmLabel="Move"
74
72
  />
@@ -102,7 +100,7 @@ const meta: Meta<typeof SheetModal> = {
102
100
  docs: {
103
101
  description: {
104
102
  component:
105
- "Modal bottom sheet. Anatomy follows the Apple HIG sheet (grabber, percent detent, swipe to dismiss) with Radix Dialog semantics: `role=dialog`, `aria-modal`, focus moved in, trapped, and returned on close, and Escape dismissal wired here because tamagui's Sheet has no key handling of its own. A sheet that confirms carries its Cancel and confirm in the header as `OverlayHeader`: ✕ leading, the accent ✓ trailing, never a Cancel/confirm row in the body (FZ-8439). Web renders tamagui's Sheet; the native twin is an RN Modal, because a raw Sheet cannot re-present from a trigger tap on device.",
103
+ "Modal bottom sheet. Anatomy follows tamagui's Sheet (FZ-11418): a handle detached above the frame, a rounded top, no header bar and no ✕, closed by drag, scrim tap or Escape. Radix Dialog semantics: `role=dialog`, `aria-modal`, focus moved in, trapped, and returned on close, and Escape dismissal wired here because tamagui's Sheet has no key handling of its own. A sheet that confirms passes `OverlayHeader`, which draws the title as the body's first line with the accent ✓ trailing, never a Cancel/confirm row in the body (FZ-8439). Web renders tamagui's Sheet; the native twin is an RN Modal, because a raw Sheet cannot re-present from a trigger tap on device.",
106
104
  },
107
105
  },
108
106
  },
@@ -157,7 +155,7 @@ export const OpenOnMount: Story = {
157
155
  };
158
156
 
159
157
  /**
160
- * FZ-8439: a confirming sheet with frequent actions. ✕ Cancel leads, Share
158
+ * FZ-8439: a confirming sheet with frequent actions. The title leads, Share
161
159
  * sits between the title and the ✓, and Save keeps the trailing edge.
162
160
  */
163
161
  function ConfirmWithActionsHarness() {
@@ -172,8 +170,6 @@ function ConfirmWithActionsHarness() {
172
170
  header={
173
171
  <OverlayHeader
174
172
  title="Edit document"
175
- closeKind="cancel"
176
- onClose={() => setOpen(false)}
177
173
  onConfirm={() => setOpen(false)}
178
174
  confirmKind="save"
179
175
  />