@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
@@ -11,7 +11,9 @@
11
11
 
12
12
  import {
13
13
  overlayScrim,
14
- sheetGrabber,
14
+ sheetHandle,
15
+ sheetHandleTone,
16
+ sheetHandleWidthRatio,
15
17
  transitionProps,
16
18
  useResolvedKnobs,
17
19
  } from "@multiplatform.one/theme";
@@ -21,11 +23,12 @@ import {
21
23
  sheetPanelWidth,
22
24
  useOverlayZIndex,
23
25
  } from "@multiplatform.one/forms";
24
- import { useEffect, useId, useRef, type ReactNode } from "react";
25
- import { isWeb, Sheet, View, useWindowDimensions } from "tamagui";
26
+ import { useCallback, useEffect, useId, useRef, type ReactNode } from "react";
27
+ import { isWeb, Sheet, View, useWindowDimensions, YStack } from "tamagui";
26
28
  import { OverlayTitleIdContext } from "../actions/StandardAction";
27
- import { DialogRegionContext, SheetFrame } from "../surfaces";
29
+ import { SheetFrame } from "../surfaces";
28
30
  import { largeDetentRatio, resolveWebSnap } from "./detents";
31
+ import { SheetBodyRegion } from "./SheetBodyRegion";
29
32
  import { isOverlayHeader, SheetHeader } from "./SheetHeader";
30
33
  import { SheetNavigation } from "./SheetNavigation";
31
34
  import { useSheetFrameFocus } from "./useSheetFrameFocus";
@@ -35,9 +38,10 @@ export interface SheetModalProps {
35
38
  onOpenChange: (open: boolean) => void;
36
39
  children?: ReactNode;
37
40
  /**
38
- * Fixed content above the (scrollable) body. A sheet that confirms or
39
- * dismisses passes `OverlayHeader`: ✕ leading, the accent ✓ trailing, the
40
- * title between (FZ-8439). Its body holds no Cancel/confirm row.
41
+ * Content above the body. A sheet that confirms passes `OverlayHeader`:
42
+ * the title leading, the accent ✓ trailing, and no ✕ (FZ-8439, FZ-11418).
43
+ * That title row scrolls with a `scrollable` body. Its body holds no
44
+ * Cancel/confirm row.
41
45
  */
42
46
  header?: ReactNode;
43
47
  /**
@@ -80,10 +84,15 @@ export interface SheetModalProps {
80
84
  * does (Quick Look, Files); the header keeps the panel inset.
81
85
  */
82
86
  flush?: boolean;
87
+ /**
88
+ * Fires once the sheet is gone after a close, so a consumer can present
89
+ * what comes next without guessing at a delay: on iOS when UIKit finishes
90
+ * dismissing the modal, on Android once the close commits, on web when the
91
+ * exit slide completes.
92
+ */
93
+ onDismiss?: () => void;
83
94
  }
84
95
 
85
- const IN_DIALOG_REGION = { inDialogRegion: true } as const;
86
-
87
96
  /*
88
97
  * MPO-299 fill: the web frame already has a definite height from the Sheet's
89
98
  * percent snap point, so fill only opens the body chain inside it. A flex
@@ -194,6 +203,42 @@ function useSheetEscapeDismiss(open: boolean, onDismiss: () => void) {
194
203
  }, [open]);
195
204
  }
196
205
 
206
+ /**
207
+ * FZ-11084: `onDismiss` fires once per close, when the exit slide completes.
208
+ * Tamagui hides a sheet whose exit callback never arrives after a second
209
+ * without reporting it, so the same second backs this up rather than leaving
210
+ * the consumer waiting forever.
211
+ */
212
+ const dismissFallbackMs = 1000;
213
+
214
+ function useSheetDismissed(open: boolean, onDismiss: (() => void) | undefined) {
215
+ const onDismissRef = useRef(onDismiss);
216
+ onDismissRef.current = onDismiss;
217
+ const openRef = useRef(open);
218
+ openRef.current = open;
219
+ const shownRef = useRef(false);
220
+ const fire = useCallback(() => {
221
+ if (openRef.current || !shownRef.current) return;
222
+ shownRef.current = false;
223
+ onDismissRef.current?.();
224
+ }, []);
225
+ useEffect(() => {
226
+ if (open) {
227
+ shownRef.current = true;
228
+ return;
229
+ }
230
+ if (!shownRef.current) return;
231
+ const timer = setTimeout(fire, dismissFallbackMs);
232
+ return () => clearTimeout(timer);
233
+ }, [open, fire]);
234
+ return useCallback(
235
+ ({ open: opened }: { open: boolean }) => {
236
+ if (!opened) fire();
237
+ },
238
+ [fire],
239
+ );
240
+ }
241
+
197
242
  export function SheetModal({
198
243
  open,
199
244
  onOpenChange,
@@ -205,6 +250,7 @@ export function SheetModal({
205
250
  scrollable,
206
251
  fill = false,
207
252
  flush = false,
253
+ onDismiss,
208
254
  }: SheetModalProps) {
209
255
  const titleId = useId();
210
256
  const overlayHeader = isOverlayHeader(headerContent);
@@ -223,11 +269,24 @@ export function SheetModal({
223
269
  const sheetZIndex = useOverlayZIndex("sheet");
224
270
  const transition = knobProps.motion.slide.transition;
225
271
  const frameRef = useRef<HTMLElement | null>(null);
272
+ const handleAnimationComplete = useSheetDismissed(open, onDismiss);
226
273
 
227
274
  useSheetFrameFocus(open, frameRef);
228
275
  useSheetEscapeDismiss(open, () => onOpenChange(false));
229
276
  useOutsidePressDismiss(open, frameRef, () => onOpenChange(false));
230
277
  const flushHeader = flush ? { paddingHorizontal: knobProps.panelPadding.padding } : null;
278
+ const titleScrolls = overlayHeader && scrollable === true;
279
+ const headerSlot = header ? (
280
+ <View
281
+ id={overlayHeader || headerActions ? undefined : titleId}
282
+ {...(fill && !titleScrolls ? nonShrinking : null)}
283
+ {...flushHeader}
284
+ >
285
+ <OverlayTitleIdContext.Provider value={overlayHeader ? titleId : undefined}>
286
+ {header}
287
+ </OverlayTitleIdContext.Provider>
288
+ </View>
289
+ ) : null;
231
290
 
232
291
  return (
233
292
  <Sheet
@@ -235,6 +294,7 @@ export function SheetModal({
235
294
  open={open}
236
295
  onOpenChange={onOpenChange}
237
296
  dismissOnSnapToBottom
297
+ onAnimationComplete={handleAnimationComplete}
238
298
  {...snap}
239
299
  transition={transition}
240
300
  zIndex={sheetZIndex}
@@ -248,7 +308,15 @@ export function SheetModal({
248
308
  exitStyle={{ opacity: 0 }}
249
309
  />
250
310
  {/* VoiceOver resize affordance. */}
251
- <Sheet.Handle {...sheetGrabber} aria-label="Resize" data-sheet-grabber="" />
311
+ <Sheet.Handle
312
+ {...sheetHandle}
313
+ {...sheetHandleTone(knobProps.scheme)}
314
+ {...(regular
315
+ ? { width: Math.round(sheetPanelWidth(windowWidth) * sheetHandleWidthRatio) }
316
+ : null)}
317
+ aria-label="Resize"
318
+ data-sheet-grabber=""
319
+ />
252
320
  <SheetFrame
253
321
  ref={frameRef as never}
254
322
  {...({
@@ -269,7 +337,7 @@ export function SheetModal({
269
337
  overflow="hidden"
270
338
  {...frameRingReset}
271
339
  >
272
- <DialogRegionContext.Provider value={IN_DIALOG_REGION}>
340
+ <SheetBodyRegion>
273
341
  <OverlayStackProvider zIndex={sheetZIndex}>
274
342
  <SheetNavigation
275
343
  open={open}
@@ -277,29 +345,35 @@ export function SheetModal({
277
345
  fill={fill}
278
346
  root={
279
347
  <>
280
- {header ? (
281
- <View
282
- id={overlayHeader || headerActions ? undefined : titleId}
283
- {...(fill ? nonShrinking : null)}
284
- {...flushHeader}
285
- >
286
- <OverlayTitleIdContext.Provider value={overlayHeader ? titleId : undefined}>
287
- {header}
288
- </OverlayTitleIdContext.Provider>
289
- </View>
290
- ) : null}
348
+ {titleScrolls ? null : headerSlot}
291
349
  {fill ? (
292
350
  <View testID="sheet-modal-body" {...fillSlot}>
293
351
  {scrollable ? (
294
352
  <Sheet.ScrollView testID="sheet-modal-scroll" {...fillSlot}>
295
- {children}
353
+ {titleScrolls ? (
354
+ <YStack gap={knobProps.gap.gap}>
355
+ {headerSlot}
356
+ {children}
357
+ </YStack>
358
+ ) : (
359
+ children
360
+ )}
296
361
  </Sheet.ScrollView>
297
362
  ) : (
298
363
  children
299
364
  )}
300
365
  </View>
301
366
  ) : scrollable ? (
302
- <Sheet.ScrollView testID="sheet-modal-scroll">{children}</Sheet.ScrollView>
367
+ <Sheet.ScrollView testID="sheet-modal-scroll">
368
+ {titleScrolls ? (
369
+ <YStack gap={knobProps.gap.gap}>
370
+ {headerSlot}
371
+ {children}
372
+ </YStack>
373
+ ) : (
374
+ children
375
+ )}
376
+ </Sheet.ScrollView>
303
377
  ) : (
304
378
  children
305
379
  )}
@@ -311,7 +385,7 @@ export function SheetModal({
311
385
  {...(fill ? nonShrinking : null)}
312
386
  />
313
387
  </OverlayStackProvider>
314
- </DialogRegionContext.Provider>
388
+ </SheetBodyRegion>
315
389
  </SheetFrame>
316
390
  </Sheet>
317
391
  );
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
2
2
  import { useState } from "react";
3
- import { sheetGrabber } from "@multiplatform.one/theme";
3
+ import { sheetHandle } from "@multiplatform.one/theme";
4
4
  import { Sheet, YStack } from "tamagui";
5
5
  import { SheetFrame } from "../surfaces";
6
6
  import { Tabs } from "../Tabs";
@@ -36,7 +36,7 @@ function DraggableSheet({ tabs = false }: { tabs?: boolean }) {
36
36
  onPositionChange={setPosition}
37
37
  dismissOnSnapToBottom={false}
38
38
  >
39
- <Sheet.Handle {...sheetGrabber} aria-label="Resize" />
39
+ <Sheet.Handle {...sheetHandle} aria-label="Resize" />
40
40
  <SheetFrame borderBottomLeftRadius={0} borderBottomRightRadius={0}>
41
41
  <SizableText fontWeight="600">Stack</SizableText>
42
42
  {tabs ? (
@@ -14,7 +14,7 @@ import {
14
14
  type IconButtonProps,
15
15
  type StandardActionKind,
16
16
  } from "@multiplatform.one/forms";
17
- import { useResolvedKnobs } from "@multiplatform.one/theme";
17
+ import { useIsInSheetBody, useResolvedKnobs } from "@multiplatform.one/theme";
18
18
  import { createContext, useContext, useState, type ReactNode } from "react";
19
19
  import { XStack, isWeb } from "tamagui";
20
20
  import { useTranslation } from "../shared/i18n";
@@ -105,11 +105,79 @@ export interface OverlayHeaderProps {
105
105
  }
106
106
 
107
107
  /**
108
- * The house sheet and dialog header (LC-260, the iOS 26 sheet bar): ✕ leading
108
+ * The house dialog header (LC-260): ✕ leading
109
109
  * and an accent ✓ trailing around a centred title when the overlay confirms;
110
- * the title leading and ✕ trailing when it only dismisses.
110
+ * the title leading and ✕ trailing when it only dismisses. Inside a sheet it
111
+ * is content, not a bar (FZ-11418): no ✕, the title leading and the ✓ trailing.
111
112
  */
112
- export function OverlayHeader({
113
+ export function OverlayHeader(props: OverlayHeaderProps) {
114
+ if (useIsInSheetBody()) return <SheetTitleRow {...props} />;
115
+ return <DialogHeaderBar {...props} />;
116
+ }
117
+
118
+ /**
119
+ * An `OverlayHeader` in a sheet (FZ-11418, tamagui's Sheet): the sheet closes
120
+ * by drag, backdrop, Escape and the screen reader's escape, so it draws no ✕.
121
+ * The title is the body's first line, with the actions and the one confirm
122
+ * trailing it. With none of those it draws nothing.
123
+ */
124
+ function SheetTitleRow({
125
+ title,
126
+ onConfirm,
127
+ confirmKind = "done",
128
+ confirmLabel,
129
+ confirmDisabled,
130
+ confirmDisabledReason,
131
+ confirmLoading,
132
+ actions,
133
+ testID,
134
+ }: OverlayHeaderProps) {
135
+ const { knobProps } = useResolvedKnobs();
136
+ const titleId = useContext(OverlayTitleIdContext);
137
+ const confirms = onConfirm != null;
138
+ if (title == null && actions == null && !confirms) return null;
139
+ const heading =
140
+ typeof title === "string" ? (
141
+ <SizableText role="heading" numberOfLines={1} flexShrink={1} {...knobProps.heading}>
142
+ {title}
143
+ </SizableText>
144
+ ) : (
145
+ title
146
+ );
147
+ return (
148
+ <XStack
149
+ alignItems="center"
150
+ width="100%"
151
+ {...knobProps.gapSm}
152
+ data-mp-overlay-header={confirms ? "confirm" : "dismiss"}
153
+ data-mp-overlay-face="sheet"
154
+ testID={testID}
155
+ >
156
+ <XStack id={titleId} flex={1} minWidth={0} alignItems="center">
157
+ {heading}
158
+ </XStack>
159
+ {actions != null || confirms ? (
160
+ <XStack alignItems="center" {...knobProps.gap}>
161
+ {actions}
162
+ {confirms ? (
163
+ <ActionButton
164
+ kind={confirmKind}
165
+ onPress={onConfirm}
166
+ label={confirmLabel}
167
+ loading={confirmLoading}
168
+ disabled={confirmDisabled}
169
+ disabledReason={confirmDisabledReason}
170
+ disabledReasonPlacement="inline"
171
+ testID={testID ? `${testID}-confirm` : undefined}
172
+ />
173
+ ) : null}
174
+ </XStack>
175
+ ) : null}
176
+ </XStack>
177
+ );
178
+ }
179
+
180
+ function DialogHeaderBar({
113
181
  title,
114
182
  onClose,
115
183
  closeKind = "close",
@@ -26,12 +26,31 @@
26
26
  * leaves its scroll view's inset adjustment off: react-native-screens would
27
27
  * otherwise flip the first scroll view to `automatic`, and UIKit would add
28
28
  * the bar's height a second time (FZ-8640).
29
+ *
30
+ * A tab screen is its own native frame, so a scroll view outside the host
31
+ * cannot carry what is in it. Under another Screen (a Kitchen Sink story
32
+ * page), the tab's Screen still merges into that page's gutter and cap but
33
+ * owns its scroll view; without that, rows past the tab's frame were clipped
34
+ * and could not be reached (FZ-8640). The bar's clearance then travels to
35
+ * that Screen through the nesting record, not the app-wide inset, so the
36
+ * outer page doesn't clear a bar that sits inside its own content.
29
37
  */
30
- import { useAccentTintedSurface, useActiveTabInk, useGlyphColor } from "@multiplatform.one/theme";
38
+ import {
39
+ ScreenNesting,
40
+ useAccentTintedSurface,
41
+ useActiveTabInk,
42
+ useGlyphColor,
43
+ useParentScreen,
44
+ } from "@multiplatform.one/theme";
31
45
  import { type ComponentType, type ReactNode, useEffect, useRef, useState } from "react";
32
46
  import { type ImageSourcePropType, Platform, UIManager } from "react-native";
33
47
  import { XStack, YStack } from "tamagui";
34
- import { setBottomChromeInset, setFloatingBarMounted, useBottomAccessory } from "./bottomChrome";
48
+ import {
49
+ setBottomChromeInset,
50
+ setBottomEdgeOwnedByTabHost,
51
+ setFloatingBarMounted,
52
+ useBottomAccessory,
53
+ } from "./bottomChrome";
35
54
  import { useBottomInset } from "./bottomInset";
36
55
  import { type TabBarItem, tabBarInactiveInk } from "./TabBar";
37
56
  import { MpoTabHost, type TabHostProps } from "./MpoTabHost";
@@ -215,13 +234,28 @@ export function NativeTabHost({
215
234
  const holdingKey = activeKey ?? hostKey;
216
235
  if (holdingKey) lastKey.current = holdingKey;
217
236
  const focusedKey = lastKey.current;
237
+ const parent = useParentScreen();
218
238
  const hosting = hostsAccessory && Boolean(activeKey);
219
239
  const pageAccessory = useBottomAccessory();
220
240
  const accessory = hosting ? pageAccessory : null;
221
241
 
242
+ const bottomInset = nativeTabsBottomInset(activeKey, deviceInset, Boolean(accessory));
243
+ const clearance = bottomInset ?? 0;
244
+ const nested = parent !== null;
245
+ useEffect(() => {
246
+ setBottomChromeInset(id, nested ? null : bottomInset);
247
+ }, [bottomInset, nested, id]);
248
+ const holdBottomEdge = parent?.holdBottomEdge;
249
+ const ownsEdge = nested && bottomInset !== null;
222
250
  useEffect(() => {
223
- setBottomChromeInset(id, nativeTabsBottomInset(activeKey, deviceInset, Boolean(accessory)));
224
- }, [activeKey, accessory, deviceInset, id]);
251
+ if (!ownsEdge) return undefined;
252
+ holdBottomEdge?.(id, true);
253
+ setBottomEdgeOwnedByTabHost(id, true);
254
+ return () => {
255
+ holdBottomEdge?.(id, false);
256
+ setBottomEdgeOwnedByTabHost(id, false);
257
+ };
258
+ }, [ownsEdge, holdBottomEdge, id]);
225
259
  useEffect(() => {
226
260
  setFloatingBarMounted(id, hosting);
227
261
  }, [hosting, id]);
@@ -268,7 +302,18 @@ export function NativeTabHost({
268
302
  >
269
303
  {item.key === focusedKey ? (
270
304
  <YStack flex={1} backgroundColor="$background" data-testid="native-tab-screen">
271
- {children}
305
+ {parent ? (
306
+ <ScreenNesting
307
+ scrolls={false}
308
+ inset={parent.inset}
309
+ capped={parent.capped}
310
+ underChrome={clearance}
311
+ >
312
+ {children}
313
+ </ScreenNesting>
314
+ ) : (
315
+ children
316
+ )}
272
317
  </YStack>
273
318
  ) : null}
274
319
  </Screen>
@@ -0,0 +1,177 @@
1
+ /**
2
+ * FZ-8640: a native tab screen is its own native frame, so a scroll view
3
+ * outside the TabHost cannot carry what is in it. In Kitchen Sink the TabHost
4
+ * story sits inside the story page's scrolling Screen; its own Screen merged
5
+ * into that page (LC-159) and drew no scroll view, so rows past the tab's
6
+ * frame were clipped and could not be reached. Under a native tab the Screen
7
+ * keeps the page's one gutter but owns its scroll view, and that scroll view
8
+ * ends with the tab bar's clearance once.
9
+ */
10
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
11
+ import { cleanup, screen } from "@testing-library/react";
12
+ import { afterEach, describe, expect, it, vi } from "vitest";
13
+ import { Screen } from "../layouts/page";
14
+ import { useBottomEdgeOwnedByTabHost } from "@multiplatform.one/theme";
15
+ import type { TabBarItem } from "./TabBar";
16
+ import { type NativeTabs, NativeTabHost } from "./TabHost.native";
17
+
18
+ afterEach(() => {
19
+ vi.restoreAllMocks();
20
+ cleanup();
21
+ });
22
+
23
+ const Glyph = () => null;
24
+
25
+ const items: TabBarItem[] = [
26
+ { key: "/", label: "Home", icon: Glyph, nativeIcon: { sfSymbol: "house" } },
27
+ { key: "/pokemon", label: "Pokemon", icon: Glyph, nativeIcon: { sfSymbol: "sparkles" } },
28
+ ];
29
+
30
+ const fakeTabs: NativeTabs = {
31
+ Host: ({ children }) => <div data-testid="native-host">{children}</div>,
32
+ Screen: ({ children, tabKey }) => <section data-testid={`tab-${tabKey}`}>{children}</section>,
33
+ };
34
+
35
+ const rows = Array.from({ length: 30 }, (_, i) => `Row ${i + 1}`);
36
+
37
+ function TabPage() {
38
+ return (
39
+ <NativeTabHost tabs={fakeTabs} items={items} activeKey="/pokemon" onTabPress={vi.fn()}>
40
+ <Screen scrollViewProps={{ testID: "tab-scroll" } as never}>
41
+ {rows.map((row) => (
42
+ <span key={row}>{row}</span>
43
+ ))}
44
+ </Screen>
45
+ </NativeTabHost>
46
+ );
47
+ }
48
+
49
+ function bottomPads(el: Element): string[] {
50
+ return String(el.className)
51
+ .split(" ")
52
+ .filter((c) => c.startsWith("_pb-") && c !== "_pb-0px");
53
+ }
54
+
55
+ function outerColumn(container: HTMLElement): Element {
56
+ return [...container.querySelectorAll('[data-testid="screen"]')].find(
57
+ (el) => !el.hasAttribute("data-screen-nested"),
58
+ )!;
59
+ }
60
+
61
+ function EdgeProbe() {
62
+ return <span data-testid="edge">{String(useBottomEdgeOwnedByTabHost())}</span>;
63
+ }
64
+
65
+ function clearanceIn(el: HTMLElement): number {
66
+ const spacers = el.querySelectorAll<HTMLElement>('[data-testid="screen-chrome-clearance"]');
67
+ return spacers.length;
68
+ }
69
+
70
+ describe("a Screen under a native tab inside another page (FZ-8640)", () => {
71
+ it("owns its scroll view, so every row can scroll into the tab's frame", () => {
72
+ renderWithProviders(
73
+ <Screen scrollViewProps={{ testID: "page-scroll" } as never}>
74
+ <TabPage />
75
+ </Screen>,
76
+ );
77
+ const tabScroll = screen.getByTestId("tab-scroll");
78
+ expect(screen.getByTestId("tab-/pokemon").contains(tabScroll)).toBe(true);
79
+ expect(tabScroll.contains(screen.getByText("Row 30"))).toBe(true);
80
+ });
81
+
82
+ it("ends that scroll view with the tab bar's clearance, once", () => {
83
+ renderWithProviders(
84
+ <Screen scrollViewProps={{ testID: "page-scroll" } as never}>
85
+ <TabPage />
86
+ </Screen>,
87
+ );
88
+ const tabScroll = screen.getByTestId("tab-scroll");
89
+ expect(clearanceIn(tabScroll)).toBe(1);
90
+ const spacer = tabScroll.querySelector<HTMLElement>('[data-testid="screen-chrome-clearance"]')!;
91
+ expect(spacer.compareDocumentPosition(screen.getByText("Row 30"))).toBe(
92
+ Node.DOCUMENT_POSITION_PRECEDING,
93
+ );
94
+ });
95
+
96
+ it("leaves the outer page unpadded for a bar inside its own content", () => {
97
+ renderWithProviders(
98
+ <Screen scrollViewProps={{ testID: "page-scroll" } as never}>
99
+ <TabPage />
100
+ </Screen>,
101
+ );
102
+ const page = screen.getByTestId("page-scroll");
103
+ const tabScroll = screen.getByTestId("tab-scroll");
104
+ const all = [...page.querySelectorAll('[data-testid="screen-chrome-clearance"]')];
105
+ expect(all.filter((el) => !tabScroll.contains(el))).toEqual([]);
106
+ });
107
+
108
+ it("ends the tab's scroll with the page's bottom gutter above the clearance", () => {
109
+ const { container } = renderWithProviders(
110
+ <Screen>
111
+ <TabPage />
112
+ </Screen>,
113
+ );
114
+ const nested = container.querySelector("[data-screen-nested]") as HTMLElement;
115
+ const bottom = String(nested.className)
116
+ .split(" ")
117
+ .filter((c) => c.startsWith("_pb-"));
118
+ expect(bottom.length).toBe(1);
119
+ });
120
+
121
+ it("gives the page's bottom edge to the tab host, so the bar sits on the screen's inset", () => {
122
+ const plain = renderWithProviders(
123
+ <Screen>
124
+ <span>Row</span>
125
+ </Screen>,
126
+ );
127
+ expect(bottomPads(outerColumn(plain.container)).length).toBeGreaterThan(0);
128
+ plain.unmount();
129
+ const { container } = renderWithProviders(
130
+ <Screen>
131
+ <TabPage />
132
+ </Screen>,
133
+ );
134
+ expect(bottomPads(outerColumn(container))).toEqual([]);
135
+ });
136
+
137
+ it("tells a host frame around the page that the tab host owns the bottom edge", () => {
138
+ const { rerender } = renderWithProviders(
139
+ <>
140
+ <EdgeProbe />
141
+ <Screen>
142
+ <TabPage />
143
+ </Screen>
144
+ </>,
145
+ );
146
+ expect(screen.getByTestId("edge").textContent).toBe("true");
147
+ rerender(
148
+ <>
149
+ <EdgeProbe />
150
+ <Screen>
151
+ <span>Row</span>
152
+ </Screen>
153
+ </>,
154
+ );
155
+ expect(screen.getByTestId("edge").textContent).toBe("false");
156
+ });
157
+
158
+ it("keeps the page's one gutter: the tab's Screen pads no sides of its own", () => {
159
+ const { container } = renderWithProviders(
160
+ <Screen>
161
+ <TabPage />
162
+ </Screen>,
163
+ );
164
+ const nested = container.querySelector("[data-screen-nested]") as HTMLElement;
165
+ expect(nested).not.toBeNull();
166
+ const sides = String(nested.className)
167
+ .split(" ")
168
+ .filter((c) => ["_pl-", "_pr-", "_p-", "_px-"].some((p) => c.startsWith(p)));
169
+ expect(sides).toEqual([]);
170
+ });
171
+
172
+ it("is a page of its own at the top of an app (One's routes), unchanged", () => {
173
+ const { container } = renderWithProviders(<TabPage />);
174
+ expect(container.querySelector("[data-screen-nested]")).toBeNull();
175
+ expect(screen.getByTestId("tab-scroll").contains(screen.getByText("Row 30"))).toBe(true);
176
+ });
177
+ });
@@ -66,3 +66,5 @@ export function setFloatingBarMounted(id: symbol, mounted: boolean) {
66
66
  export function useFloatingBarMounted(): boolean {
67
67
  return useSyncExternalStore(bars.subscribe, bars.get, bars.empty);
68
68
  }
69
+
70
+ export { setBottomEdgeOwnedByTabHost, useBottomEdgeOwnedByTabHost } from "@multiplatform.one/theme";
@@ -7,5 +7,5 @@ export * from "./Springboard";
7
7
  export type { AppEntry } from "./appTile";
8
8
  export * from "./SettingsSplit";
9
9
  export * from "./AppShell";
10
- export { useBottomChromeInset } from "./bottomChrome";
10
+ export { useBottomChromeInset, useBottomEdgeOwnedByTabHost } from "./bottomChrome";
11
11
  export { BottomChromeClearance } from "./BottomChromeClearance";
@@ -47,7 +47,6 @@ export function ChartDataView({ data, title, valueFormatter, children }: ChartDa
47
47
  const action = (
48
48
  <Dialog.Trigger asChild>
49
49
  <Button
50
- circular
51
50
  chromeless
52
51
  icon={TableIcon}
53
52
  id={triggerId}
@@ -63,6 +63,26 @@ export const BarCategorical = {
63
63
  ),
64
64
  };
65
65
 
66
+ export const SixCategories = {
67
+ render: () => {
68
+ const six = [
69
+ { label: "North", value: 42 },
70
+ { label: "South", value: 35 },
71
+ { label: "East", value: 28 },
72
+ { label: "West", value: 24 },
73
+ { label: "Central", value: 18 },
74
+ { label: "Online", value: 12 },
75
+ ];
76
+ return (
77
+ <YStack maxWidth={560} gap="$4">
78
+ <BarChart data={six} categorical title="Orders by region" />
79
+ <PieChart data={six} title="Orders by region" />
80
+ <LineChart data={six} title="Orders by region" />
81
+ </YStack>
82
+ );
83
+ },
84
+ };
85
+
66
86
  export const Line = {
67
87
  render: () => (
68
88
  <YStack maxWidth={560} gap="$4">