@multiplatform.one/components 7.83.2 → 7.84.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 (108) hide show
  1. package/dist/cjs/Carousel/index.cjs +11 -9
  2. package/dist/cjs/Carousel/index.native.js +12 -10
  3. package/dist/cjs/Carousel/index.native.js.map +1 -1
  4. package/dist/cjs/Meter/meter.cjs +1 -1
  5. package/dist/cjs/Meter/meter.native.js +1 -1
  6. package/dist/cjs/Meter/meter.native.js.map +1 -1
  7. package/dist/cjs/SheetModal/index.cjs +33 -5
  8. package/dist/cjs/appShell/TabBar.cjs +1 -1
  9. package/dist/cjs/appShell/TabBar.native.js +1 -1
  10. package/dist/cjs/appShell/TabBar.native.js.map +1 -1
  11. package/dist/cjs/appShell/TabHost.native.js +52 -5
  12. package/dist/cjs/appShell/TabHost.native.js.map +1 -1
  13. package/dist/cjs/layouts/PageTemplates.cjs +15 -12
  14. package/dist/cjs/layouts/PageTemplates.native.js +16 -13
  15. package/dist/cjs/layouts/PageTemplates.native.js.map +1 -1
  16. package/dist/cjs/layouts/bottomAccessory.cjs +25 -13
  17. package/dist/cjs/layouts/bottomAccessory.native.js +29 -13
  18. package/dist/cjs/layouts/bottomAccessory.native.js.map +1 -1
  19. package/dist/cjs/layouts/page.cjs +44 -6
  20. package/dist/cjs/layouts/page.native.js +48 -6
  21. package/dist/cjs/layouts/page.native.js.map +1 -1
  22. package/dist/esm/Carousel/index.mjs +12 -10
  23. package/dist/esm/Carousel/index.mjs.map +1 -1
  24. package/dist/esm/Carousel/index.native.js +13 -11
  25. package/dist/esm/Carousel/index.native.js.map +1 -1
  26. package/dist/esm/Meter/meter.mjs +1 -1
  27. package/dist/esm/Meter/meter.mjs.map +1 -1
  28. package/dist/esm/Meter/meter.native.js +1 -1
  29. package/dist/esm/Meter/meter.native.js.map +1 -1
  30. package/dist/esm/SheetModal/index.mjs +34 -6
  31. package/dist/esm/SheetModal/index.mjs.map +1 -1
  32. package/dist/esm/appShell/TabBar.mjs +2 -2
  33. package/dist/esm/appShell/TabBar.mjs.map +1 -1
  34. package/dist/esm/appShell/TabBar.native.js +2 -2
  35. package/dist/esm/appShell/TabBar.native.js.map +1 -1
  36. package/dist/esm/appShell/TabHost.native.js +53 -9
  37. package/dist/esm/appShell/TabHost.native.js.map +1 -1
  38. package/dist/esm/layouts/PageTemplates.mjs +16 -13
  39. package/dist/esm/layouts/PageTemplates.mjs.map +1 -1
  40. package/dist/esm/layouts/PageTemplates.native.js +17 -14
  41. package/dist/esm/layouts/PageTemplates.native.js.map +1 -1
  42. package/dist/esm/layouts/bottomAccessory.mjs +26 -15
  43. package/dist/esm/layouts/bottomAccessory.mjs.map +1 -1
  44. package/dist/esm/layouts/bottomAccessory.native.js +30 -15
  45. package/dist/esm/layouts/bottomAccessory.native.js.map +1 -1
  46. package/dist/esm/layouts/page.mjs +44 -8
  47. package/dist/esm/layouts/page.mjs.map +1 -1
  48. package/dist/esm/layouts/page.native.js +48 -8
  49. package/dist/esm/layouts/page.native.js.map +1 -1
  50. package/dist/jsx/Carousel/index.mjs +12 -10
  51. package/dist/jsx/Carousel/index.mjs.map +1 -1
  52. package/dist/jsx/Carousel/index.native.js +12 -10
  53. package/dist/jsx/Carousel/index.native.js.map +1 -1
  54. package/dist/jsx/Meter/meter.mjs +1 -1
  55. package/dist/jsx/Meter/meter.mjs.map +1 -1
  56. package/dist/jsx/Meter/meter.native.js +1 -1
  57. package/dist/jsx/Meter/meter.native.js.map +1 -1
  58. package/dist/jsx/SheetModal/index.mjs +34 -6
  59. package/dist/jsx/SheetModal/index.mjs.map +1 -1
  60. package/dist/jsx/appShell/TabBar.mjs +2 -2
  61. package/dist/jsx/appShell/TabBar.mjs.map +1 -1
  62. package/dist/jsx/appShell/TabBar.native.js +1 -1
  63. package/dist/jsx/appShell/TabBar.native.js.map +1 -1
  64. package/dist/jsx/appShell/TabHost.native.js +52 -5
  65. package/dist/jsx/appShell/TabHost.native.js.map +1 -1
  66. package/dist/jsx/layouts/PageTemplates.mjs +16 -13
  67. package/dist/jsx/layouts/PageTemplates.mjs.map +1 -1
  68. package/dist/jsx/layouts/PageTemplates.native.js +16 -13
  69. package/dist/jsx/layouts/PageTemplates.native.js.map +1 -1
  70. package/dist/jsx/layouts/bottomAccessory.mjs +26 -15
  71. package/dist/jsx/layouts/bottomAccessory.mjs.map +1 -1
  72. package/dist/jsx/layouts/bottomAccessory.native.js +29 -13
  73. package/dist/jsx/layouts/bottomAccessory.native.js.map +1 -1
  74. package/dist/jsx/layouts/page.mjs +44 -8
  75. package/dist/jsx/layouts/page.mjs.map +1 -1
  76. package/dist/jsx/layouts/page.native.js +48 -6
  77. package/dist/jsx/layouts/page.native.js.map +1 -1
  78. package/package.json +9 -9
  79. package/src/Carousel/Carousel.native.spec.tsx +25 -8
  80. package/src/Carousel/index.tsx +18 -11
  81. package/src/Meter/Meter.spec.tsx +5 -4
  82. package/src/Meter/meter.ts +6 -4
  83. package/src/SheetModal/SheetModal.regularWidth.spec.tsx +87 -0
  84. package/src/SheetModal/index.tsx +52 -5
  85. package/src/Text.stories.tsx +13 -0
  86. package/src/appShell/TabBar.spec.tsx +10 -4
  87. package/src/appShell/TabBar.tsx +4 -8
  88. package/src/appShell/TabHost.native.spec.tsx +109 -1
  89. package/src/appShell/TabHost.native.tsx +84 -13
  90. package/src/icons/themedButtonInk.spec.tsx +117 -0
  91. package/src/layouts/PageTemplates.tsx +14 -11
  92. package/src/layouts/Screen.chromeClearance.spec.tsx +28 -0
  93. package/src/layouts/bottomAccessory.tsx +40 -15
  94. package/src/layouts/page.tsx +73 -19
  95. package/src/layouts/pageTitleOneLine.spec.tsx +42 -0
  96. package/src/layouts/pushedPageTitle.spec.tsx +116 -0
  97. package/types/Carousel/index.d.ts.map +1 -1
  98. package/types/Meter/meter.d.ts +6 -4
  99. package/types/Meter/meter.d.ts.map +1 -1
  100. package/types/SheetModal/index.d.ts.map +1 -1
  101. package/types/appShell/TabBar.d.ts.map +1 -1
  102. package/types/appShell/TabHost.native.d.ts +13 -1
  103. package/types/appShell/TabHost.native.d.ts.map +1 -1
  104. package/types/layouts/PageTemplates.d.ts.map +1 -1
  105. package/types/layouts/bottomAccessory.d.ts +6 -1
  106. package/types/layouts/bottomAccessory.d.ts.map +1 -1
  107. package/types/layouts/page.d.ts +16 -1
  108. package/types/layouts/page.d.ts.map +1 -1
@@ -15,21 +15,23 @@
15
15
  * (Material bottom navigation, PNG template icons) is built and switched off
16
16
  * until an Android build proves it (FZ-8140).
17
17
  *
18
+ * A page's bottom accessory (LC-174, e.g. a DataTable pager) rides the
19
+ * system bar too: on iOS 26, where the binary carries RNSTabsBottomAccessory,
20
+ * it is UITabBarController's bottom accessory, the system's own glass capsule
21
+ * above the bar (FZ-7995). Anywhere else it stays in the page's slot, which
22
+ * sits above the bar.
23
+ *
18
24
  * The bar's clearance is the inset this host publishes, as with the MPO
19
25
  * TabBar, so a Screen pads by it whether or not it scrolls. Each tab screen
20
26
  * leaves its scroll view's inset adjustment off: react-native-screens would
21
27
  * otherwise flip the first scroll view to `automatic`, and UIKit would add
22
28
  * the bar's height a second time (FZ-8640).
23
29
  */
24
- import {
25
- useAccentTintedSurface,
26
- useGlyphColor,
27
- useIdentityInkOnSurface,
28
- } from "@multiplatform.one/theme";
30
+ import { useAccentTintedSurface, useActiveTabInk, useGlyphColor } from "@multiplatform.one/theme";
29
31
  import { type ComponentType, type ReactNode, useEffect, useRef, useState } from "react";
30
32
  import { type ImageSourcePropType, Platform, UIManager } from "react-native";
31
- import { YStack } from "tamagui";
32
- import { setBottomChromeInset } from "./bottomChrome";
33
+ import { XStack, YStack } from "tamagui";
34
+ import { setBottomChromeInset, setFloatingBarMounted, useBottomAccessory } from "./bottomChrome";
33
35
  import { useBottomInset } from "./bottomInset";
34
36
  import { type TabBarItem, tabBarInactiveInk } from "./TabBar";
35
37
  import { MpoTabHost, type TabHostProps } from "./MpoTabHost";
@@ -42,6 +44,12 @@ export const nativeTabsComponents = ["RNSTabsHost", "RNSTabsScreen"] as const;
42
44
  /** Points the system tab bar covers above the home-indicator band. */
43
45
  export const nativeTabBarHeight = 49;
44
46
 
47
+ /** The Fabric component behind UITabBarController's bottom accessory (iOS 26). */
48
+ export const nativeTabsAccessoryComponent = "RNSTabsBottomAccessory";
49
+
50
+ /** Points the bottom accessory's capsule adds above the system bar, its gap included. */
51
+ export const nativeTabsAccessoryHeight = 56;
52
+
45
53
  type ImageIcon = { type: "imageSource"; imageSource: ImageSourcePropType };
46
54
  type IconProp = { ios?: { type: "sfSymbol"; name: string }; android?: ImageIcon };
47
55
 
@@ -66,6 +74,7 @@ export interface NativeTabs {
66
74
  tabBarBackgroundColor?: string;
67
75
  tabBarItemActiveIndicatorColor?: string;
68
76
  experimentalControlNavigationStateInJS?: boolean;
77
+ bottomAccessory?: (environment: "regular" | "inline") => ReactNode;
69
78
  onNativeFocusChange?: (event: { nativeEvent: { tabKey: string } }) => void;
70
79
  }>;
71
80
  Screen: ComponentType<{
@@ -107,13 +116,39 @@ export function resolveNativeTabs(
107
116
  }
108
117
  }
109
118
 
119
+ /**
120
+ * True when the system bar can host the page's bottom accessory: iOS 26 or
121
+ * later (UITabAccessory) and a binary that carries react-native-screens'
122
+ * accessory view. Otherwise the accessory stays in the page's slot.
123
+ */
124
+ export function resolveNativeAccessory(
125
+ sources: Pick<NativeTabsSources, "hasComponent">,
126
+ os: string,
127
+ version: string | number,
128
+ ): boolean {
129
+ if (os !== "ios" || Number.parseInt(String(version), 10) < 26) return false;
130
+ try {
131
+ return sources.hasComponent(nativeTabsAccessoryComponent);
132
+ } catch {
133
+ return false;
134
+ }
135
+ }
136
+
110
137
  let cached: NativeTabs | null | undefined;
138
+ let cachedAccessory: boolean | undefined;
111
139
 
112
140
  function loadNativeTabs(): NativeTabs | null {
113
141
  if (cached === undefined) cached = resolveNativeTabs(appSources, Platform.OS);
114
142
  return cached;
115
143
  }
116
144
 
145
+ function loadNativeAccessory(): boolean {
146
+ if (cachedAccessory === undefined) {
147
+ cachedAccessory = resolveNativeAccessory(appSources, Platform.OS, Platform.Version);
148
+ }
149
+ return cachedAccessory;
150
+ }
151
+
117
152
  /** True when every item names the glyph this platform's system bar draws. */
118
153
  export function itemsHaveNativeIcons(items: readonly TabBarItem[], os = "ios"): boolean {
119
154
  const glyph = (item: TabBarItem) =>
@@ -130,15 +165,31 @@ export function nativeIconFor(item: TabBarItem): IconProp {
130
165
  };
131
166
  }
132
167
 
168
+ /** The accessory's content inside the system capsule: one centred row. */
169
+ function NativeAccessoryContent({ children }: { children: ReactNode }) {
170
+ return (
171
+ <XStack
172
+ flex={1}
173
+ alignItems="center"
174
+ justifyContent="center"
175
+ paddingHorizontal="$3"
176
+ data-testid="native-tab-accessory"
177
+ >
178
+ {children}
179
+ </XStack>
180
+ );
181
+ }
182
+
133
183
  export function NativeTabHost({
134
184
  tabs,
135
185
  items,
136
186
  activeKey,
137
187
  onTabPress,
138
188
  children,
139
- }: TabHostProps & { tabs: NativeTabs }) {
189
+ hostsAccessory = false,
190
+ }: TabHostProps & { tabs: NativeTabs; hostsAccessory?: boolean }) {
140
191
  const { Host, Screen } = tabs;
141
- const accent = useIdentityInkOnSurface();
192
+ const accent = useActiveTabInk();
142
193
  const ink = useGlyphColor(tabBarInactiveInk);
143
194
  const surface = useGlyphColor("$color2");
144
195
  const indicator = useAccentTintedSurface();
@@ -147,11 +198,28 @@ export function NativeTabHost({
147
198
  const lastKey = useRef(activeKey ?? items[0]?.key);
148
199
  if (activeKey) lastKey.current = activeKey;
149
200
  const focusedKey = lastKey.current;
201
+ const hosting = hostsAccessory && Boolean(activeKey);
202
+ const pageAccessory = useBottomAccessory();
203
+ const accessory = hosting ? pageAccessory : null;
150
204
 
151
205
  useEffect(() => {
152
- setBottomChromeInset(id, activeKey ? nativeTabBarHeight + deviceInset : null);
153
- }, [activeKey, deviceInset, id]);
154
- useEffect(() => () => setBottomChromeInset(id, null), [id]);
206
+ setBottomChromeInset(
207
+ id,
208
+ activeKey
209
+ ? nativeTabBarHeight + deviceInset + (accessory ? nativeTabsAccessoryHeight : 0)
210
+ : null,
211
+ );
212
+ }, [activeKey, accessory, deviceInset, id]);
213
+ useEffect(() => {
214
+ setFloatingBarMounted(id, hosting);
215
+ }, [hosting, id]);
216
+ useEffect(
217
+ () => () => {
218
+ setBottomChromeInset(id, null);
219
+ setFloatingBarMounted(id, false);
220
+ },
221
+ [id],
222
+ );
155
223
 
156
224
  return (
157
225
  <Host
@@ -164,6 +232,9 @@ export function NativeTabHost({
164
232
  tabBarBackgroundColor={surface}
165
233
  tabBarItemActiveIndicatorColor={indicator}
166
234
  experimentalControlNavigationStateInJS
235
+ bottomAccessory={
236
+ accessory ? () => <NativeAccessoryContent>{accessory}</NativeAccessoryContent> : undefined
237
+ }
167
238
  onNativeFocusChange={(event) => {
168
239
  const key = event.nativeEvent.tabKey;
169
240
  if (key !== activeKey) onTabPress(key);
@@ -199,5 +270,5 @@ export function NativeTabHost({
199
270
  export function TabHost(props: TabHostProps) {
200
271
  const tabs = loadNativeTabs();
201
272
  if (!tabs || !itemsHaveNativeIcons(props.items, Platform.OS)) return <MpoTabHost {...props} />;
202
- return <NativeTabHost tabs={tabs} {...props} />;
273
+ return <NativeTabHost tabs={tabs} hostsAccessory={loadNativeAccessory()} {...props} />;
203
274
  }
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @vitest-environment jsdom
3
+ *
4
+ * FZ-8577: a `themed` glyph inside a Button fills with the Button's ink on
5
+ * web, as it does on native. Before, an accentInk icon Button painted its
6
+ * frame in the bar tint while the svg filled with the theme's `var(--color)`,
7
+ * so the SHC console's search, graph and gauge glyphs drew near-black on web
8
+ * and purple on iOS. The same held for an intent icon button and a disabled
9
+ * one (FZ-8044, LC-40: the disabled twin keeps its ink, dimmed).
10
+ *
11
+ * jsdom cascades no Tamagui CSS, so the frame's ink is read from the rule
12
+ * behind its `_col-` class, and the glyph's from its own fill: either that
13
+ * ink itself or `currentColor`, which inherits it.
14
+ */
15
+
16
+ import { cleanup, render, screen } from "@testing-library/react";
17
+ import { Button } from "@multiplatform.one/forms";
18
+ import { createDefaultThemeConfig, Surface } from "@multiplatform.one/theme";
19
+ import { MagnifyingGlassIcon } from "@phosphor-icons/react";
20
+ import type { ReactElement } from "react";
21
+ import { TamaguiProvider, YStack } from "tamagui";
22
+ import { afterEach, describe, expect, it } from "vitest";
23
+ import { themed } from "./themed";
24
+
25
+ afterEach(cleanup);
26
+
27
+ const houseConfig = createDefaultThemeConfig();
28
+ const SearchGlyph = themed(MagnifyingGlassIcon);
29
+
30
+ function renderUnder(ui: ReactElement, theme: string) {
31
+ return render(
32
+ <TamaguiProvider config={houseConfig.tamagui} defaultTheme={theme}>
33
+ <YStack backgroundColor="$background">{ui}</YStack>
34
+ </TamaguiProvider>,
35
+ );
36
+ }
37
+
38
+ function ruleValue(className: string, property: string): string | null {
39
+ for (const sheet of Array.from(document.styleSheets)) {
40
+ for (const rule of Array.from(sheet.cssRules)) {
41
+ if (!(rule instanceof CSSStyleRule)) continue;
42
+ if (!rule.selectorText.endsWith(`.${className}`)) continue;
43
+ const value = rule.style.getPropertyValue(property);
44
+ if (value) return value.trim();
45
+ }
46
+ }
47
+ return null;
48
+ }
49
+
50
+ function frameInk(label: string): string | null {
51
+ const frame = screen.getByLabelText(label);
52
+ const cls = Array.from(frame.classList).find(
53
+ (c) => c.startsWith("_col-") && !/^_col-0(hover|active|focus|press)/.test(c),
54
+ );
55
+ return cls ? ruleValue(cls, "color") : null;
56
+ }
57
+
58
+ function glyphFill(label: string): string | null {
59
+ const svg = screen.getByLabelText(label).querySelector("svg");
60
+ return svg?.getAttribute("fill") ?? null;
61
+ }
62
+
63
+ /** The glyph takes the frame's ink: the same value, or currentColor, which inherits it. */
64
+ function expectGlyphTakesFrameInk(label: string) {
65
+ const ink = frameInk(label);
66
+ const fill = glyphFill(label);
67
+ expect(ink, `${label} frame ink`).toBeTruthy();
68
+ expect(fill, `${label} glyph fill`).toBeTruthy();
69
+ expect(fill).not.toBe("var(--color)");
70
+ if (fill !== "currentColor") expect(fill?.toLowerCase()).toBe(ink?.toLowerCase());
71
+ }
72
+
73
+ describe("FZ-8577: a themed glyph in a Button fills with the Button's ink on web", () => {
74
+ for (const theme of ["light_purple", "dark_purple", "light_blue", "dark_blue"]) {
75
+ it(`${theme}: an accentInk icon button in a bar`, () => {
76
+ renderUnder(
77
+ <Surface bar>
78
+ <Button chromeless accentInk icon={SearchGlyph} aria-label="Search" />
79
+ </Surface>,
80
+ theme,
81
+ );
82
+ expectGlyphTakesFrameInk("Search");
83
+ });
84
+
85
+ it(`${theme}: an accentInk icon button in content`, () => {
86
+ renderUnder(<Button chromeless accentInk icon={SearchGlyph} aria-label="Find" />, theme);
87
+ expectGlyphTakesFrameInk("Find");
88
+ });
89
+
90
+ it(`${theme}: an intent icon button`, () => {
91
+ renderUnder(<Button error icon={SearchGlyph} aria-label="Remove" />, theme);
92
+ expectGlyphTakesFrameInk("Remove");
93
+ });
94
+
95
+ it(`${theme}: a disabled accentInk icon button keeps the enabled twin's ink`, () => {
96
+ renderUnder(
97
+ <Surface bar>
98
+ <Button chromeless accentInk icon={SearchGlyph} aria-label="Next" />
99
+ <Button chromeless accentInk disabled icon={SearchGlyph} aria-label="Previous" />
100
+ </Surface>,
101
+ theme,
102
+ );
103
+ expectGlyphTakesFrameInk("Previous");
104
+ expect(frameInk("Previous")).toBe(frameInk("Next"));
105
+ });
106
+ }
107
+
108
+ it("a glyph with its own colour keeps it", () => {
109
+ renderUnder(
110
+ <Surface bar>
111
+ <Button chromeless accentInk icon={<SearchGlyph color="red" />} aria-label="Own" />
112
+ </Surface>,
113
+ "light_purple",
114
+ );
115
+ expect(glyphFill("Own")).toBe("red");
116
+ });
117
+ });
@@ -32,7 +32,7 @@ import {
32
32
  } from "@multiplatform.one/theme";
33
33
  import { useState, type ReactNode } from "react";
34
34
  import { XStack, YStack, isWeb, type SizeTokens } from "tamagui";
35
- import { PageHeader, Screen, ScreenToolbar, type ScreenProps } from "./page";
35
+ import { PageHeader, PushedPage, Screen, ScreenToolbar, type ScreenProps } from "./page";
36
36
  import { SupportingPaneLayout } from "./PaneScaffold";
37
37
  import { useShellSidebarPanel } from "./shellSidebarSlot";
38
38
 
@@ -266,16 +266,19 @@ export function DetailPageLayout({
266
266
  return (
267
267
  // LC-157: the toolbar is the Screen's pinned top bar, so it stays put
268
268
  // while the record scrolls and takes the title once the header scrolls away.
269
- <Screen
270
- data-canonical="detail-page"
271
- topBar={toolbar}
272
- // LC-263: one readable column; a supporting pane gets the full width.
273
- maxWidth={aside == null ? DETAIL_READABLE_WIDTH : undefined}
274
- {...rest}
275
- >
276
- {renderTemplateHeader({ title, subtitle, actions, header, nav })}
277
- {body}
278
- </Screen>
269
+ // LC-270: a detail page is pushed, so on a phone its title starts there.
270
+ <PushedPage>
271
+ <Screen
272
+ data-canonical="detail-page"
273
+ topBar={toolbar}
274
+ // LC-263: one readable column; a supporting pane gets the full width.
275
+ maxWidth={aside == null ? DETAIL_READABLE_WIDTH : undefined}
276
+ {...rest}
277
+ >
278
+ {renderTemplateHeader({ title, subtitle, actions, header, nav })}
279
+ {body}
280
+ </Screen>
281
+ </PushedPage>
279
282
  );
280
283
  }
281
284
 
@@ -7,6 +7,7 @@ import { renderWithProviders } from "@multiplatform.one/test-utils";
7
7
  import { act, cleanup, screen } from "@testing-library/react";
8
8
  import { afterEach, expect, it } from "vitest";
9
9
  import { setBottomChromeInset } from "../appShell/bottomChrome";
10
+ import { BottomAccessory } from "./bottomAccessory";
10
11
  import { Screen } from "./page";
11
12
 
12
13
  const bar = Symbol("bar");
@@ -39,3 +40,30 @@ it("clears the bar on a screen that does not scroll", () => {
39
40
  renderWithProviders(<Screen scroll={false}>row</Screen>);
40
41
  expect(screen.getByTestId("screen-chrome-clearance")).toBeTruthy();
41
42
  });
43
+
44
+ it("hands the clearance to a slot accessory that stands on a bar it does not ride (FZ-7995)", () => {
45
+ act(() => setBottomChromeInset(bar, 83));
46
+ renderWithProviders(
47
+ <Screen>
48
+ row
49
+ <BottomAccessory>
50
+ <span data-testid="pager">pager</span>
51
+ </BottomAccessory>
52
+ </Screen>,
53
+ );
54
+ expect(screen.queryByTestId("screen-chrome-clearance")).toBeNull();
55
+ const lift = screen.getByTestId("bottom-accessory-lift");
56
+ expect(lift.contains(screen.getByTestId("pager"))).toBe(true);
57
+ expect(getComputedStyle(lift).paddingBottom === "83px" || /83px/.test(lift.outerHTML)).toBe(true);
58
+ });
59
+
60
+ it("grows its scrolling column to its content, so the clearance ends the content, not the viewport", () => {
61
+ act(() => setBottomChromeInset(bar, 77));
62
+ renderWithProviders(<Screen>row</Screen>);
63
+ const column = screen.getByTestId("screen");
64
+ const style = getComputedStyle(column);
65
+ const html = column.outerHTML;
66
+ expect(style.flexShrink === "0" || /_fs-0\b|flex-shrink: 0/.test(html)).toBe(true);
67
+ expect(style.flexBasis === "0px" || /_fb-0px\b|flex-basis: 0px/.test(html)).toBe(false);
68
+ expect(column.nextElementSibling).toBe(screen.getByTestId("screen-chrome-clearance"));
69
+ });
@@ -4,7 +4,10 @@
4
4
  * UIPageControl under a paged list), not inline after the content.
5
5
  *
6
6
  * Under a floating TabBar the accessory moves into the bar, which floats it
7
- * as its own capsule above the tab capsule (LC-150). Otherwise a page shell
7
+ * as its own capsule above the tab capsule (LC-150), and under the system tab
8
+ * bar on iOS 26 into its bottom accessory (FZ-7995). A tab bar that hosts no
9
+ * accessory (the system bar before iOS 26) still covers the bottom of the
10
+ * screen, so the slot's bar stands on it instead of on the home indicator. Otherwise a page shell
8
11
  * (`Screen`) owns one bottom-accessory slot. Any component
9
12
  * hands it a control with `<BottomAccessory>`; the shell draws it in a bar
10
13
  * under its scroll view that stays put while the content scrolls, so the
@@ -30,7 +33,11 @@ import {
30
33
  type ReactNode,
31
34
  } from "react";
32
35
  import { YStack, isWeb } from "tamagui";
33
- import { setBottomAccessory, useFloatingBarMounted } from "../appShell/bottomChrome";
36
+ import {
37
+ setBottomAccessory,
38
+ useBottomChromeInset,
39
+ useFloatingBarMounted,
40
+ } from "../appShell/bottomChrome";
34
41
  import { componentColors } from "../componentColors";
35
42
  import { BottomSafeArea } from "./bottomSafeArea";
36
43
 
@@ -140,6 +147,15 @@ export function BottomAccessory({ children }: BottomAccessoryProps) {
140
147
  }
141
148
 
142
149
  /** A page shell's slot: the bar the registered accessories render in. */
150
+ /** True while a page's slot holds an accessory. */
151
+ export function useBottomAccessoryOccupied(store: BottomAccessoryStore): boolean {
152
+ return useSyncExternalStore(
153
+ store.subscribe,
154
+ () => store.getSnapshot().length > 0,
155
+ () => false,
156
+ );
157
+ }
158
+
143
159
  export function BottomAccessoryHost({
144
160
  store,
145
161
  inset,
@@ -161,8 +177,8 @@ export function BottomAccessoryHost({
161
177
  }
162
178
 
163
179
  /**
164
- * The bar: the page's fill under a top hairline, and the home indicator's
165
- * inset below the controls.
180
+ * The bar: the page's fill under a top hairline, and below the controls the
181
+ * home indicator's inset, or in a page's slot the height a tab bar covers.
166
182
  */
167
183
  function BottomAccessoryBar({
168
184
  children,
@@ -176,6 +192,20 @@ function BottomAccessoryBar({
176
192
  hosted?: boolean;
177
193
  }) {
178
194
  const { knobProps } = useResolvedKnobs({ component: "ScreenToolbar" });
195
+ const chromeInset = useBottomChromeInset();
196
+ const lift = hosted && chromeInset > 0;
197
+ const controls = (
198
+ <YStack
199
+ width="100%"
200
+ {...(maxWidth ? { maxWidth, alignSelf: "center" as const } : null)}
201
+ alignItems="center"
202
+ paddingHorizontal={(inset ?? knobProps.panelPadding.padding) as "$4"}
203
+ paddingVertical={knobProps.gap.gap as "$2"}
204
+ {...knobProps.gap}
205
+ >
206
+ {children}
207
+ </YStack>
208
+ );
179
209
  return (
180
210
  <Surface bar>
181
211
  <YStack
@@ -188,18 +218,13 @@ function BottomAccessoryBar({
188
218
  borderColor={componentColors.divider as never}
189
219
  style={webSticky as never}
190
220
  >
191
- <BottomSafeArea>
192
- <YStack
193
- width="100%"
194
- {...(maxWidth ? { maxWidth, alignSelf: "center" as const } : null)}
195
- alignItems="center"
196
- paddingHorizontal={(inset ?? knobProps.panelPadding.padding) as "$4"}
197
- paddingVertical={knobProps.gap.gap as "$2"}
198
- {...knobProps.gap}
199
- >
200
- {children}
221
+ {lift ? (
222
+ <YStack width="100%" paddingBottom={chromeInset} data-testid="bottom-accessory-lift">
223
+ {controls}
201
224
  </YStack>
202
- </BottomSafeArea>
225
+ ) : (
226
+ <BottomSafeArea>{controls}</BottomSafeArea>
227
+ )}
203
228
  </YStack>
204
229
  </Surface>
205
230
  );
@@ -40,7 +40,7 @@ import {
40
40
  type ButtonProps,
41
41
  } from "@multiplatform.one/forms";
42
42
  import { CaretLeftIcon, CaretRightIcon, DotsThreeIcon } from "@phosphor-icons/react";
43
- import { useState, type ReactNode } from "react";
43
+ import { createContext, useContext, useState, type ReactNode } from "react";
44
44
  import { barTitleSpan, sideExtents } from "./barTitleSpan";
45
45
  import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent } from "react-native";
46
46
  import type { ScrollViewProps as TamaguiScrollViewProps, XStackProps, YStackProps } from "tamagui";
@@ -66,6 +66,7 @@ import { ScrollView } from "../ScrollView";
66
66
  import { KeyboardAvoidingWrapper } from "./KeyboardAvoidingWrapper";
67
67
  import {
68
68
  BottomAccessoryHost,
69
+ useBottomAccessoryOccupied,
69
70
  BottomAccessoryScope,
70
71
  createBottomAccessoryStore,
71
72
  } from "./bottomAccessory";
@@ -293,7 +294,10 @@ function PageShell({
293
294
  <YStack
294
295
  ref={scrollState.contentRoot as never}
295
296
  data-testid="screen"
296
- flex={1}
297
+ // In a scroll view the column grows to its content (basis auto, no
298
+ // shrink): with flex 1 it was held to the viewport on web, its rows
299
+ // overflowed it, and the chrome clearance after it landed mid-list.
300
+ {...(scroll ? { flexGrow: 1, flexShrink: 0, flexBasis: "auto" as const } : { flex: 1 })}
297
301
  width="100%"
298
302
  {...(maxWidth && !bleed ? { maxWidth, alignSelf: "center" } : null)}
299
303
  {...(noPadding ? null : knobProps.panelPadding)}
@@ -334,8 +338,12 @@ function PageShell({
334
338
  };
335
339
 
336
340
  // The floating tab bar covers the bottom of the screen; content scrolls
337
- // under it, and this clears its last row.
338
- const chromeClearance = <BottomChromeClearance testID="screen-chrome-clearance" />;
341
+ // under it, and this clears its last row. A slot accessory stands on the bar
342
+ // and ends the scroll view above it, so it takes the clearance instead.
343
+ const accessoryOccupied = useBottomAccessoryOccupied(accessories);
344
+ const chromeClearance = accessoryOccupied ? null : (
345
+ <BottomChromeClearance testID="screen-chrome-clearance" />
346
+ );
339
347
 
340
348
  if (!scroll) {
341
349
  return shell(
@@ -416,6 +424,32 @@ export interface PageHeaderProps extends YStackProps {
416
424
  titleScale?: PageTitleScale;
417
425
  }
418
426
 
427
+ const PushedPageContext = createContext<"inline" | "hero" | null>(null);
428
+
429
+ /**
430
+ * LC-270 PUSHED-PAGE-INLINE-TITLE: marks a pushed page, a detail or form page
431
+ * reached through a back control. At compact width its title rides the top
432
+ * bar, centred between back and the actions, and its `PageHeader` draws no
433
+ * large title. Root pages keep LC-157's large title. `hero` is the App Store
434
+ * and Music variant: the page's own title (an identity block's name) stays in
435
+ * the content, the bar shows nothing at rest, and the same title fades into
436
+ * the bar once that name scrolls out of view (LC-157's measured collapse).
437
+ */
438
+ export function PushedPage({ hero = false, children }: { hero?: boolean; children: ReactNode }) {
439
+ return (
440
+ <PushedPageContext.Provider value={hero ? "hero" : "inline"}>
441
+ {children}
442
+ </PushedPageContext.Provider>
443
+ );
444
+ }
445
+
446
+ /** True when the page's title belongs in its top bar from rest (LC-270). */
447
+ export function useInlinePageTitle(): boolean {
448
+ const pushed = useContext(PushedPageContext);
449
+ const compact = useLayoutSizeClass() === "compact";
450
+ return pushed === "inline" && compact;
451
+ }
452
+
419
453
  /**
420
454
  * Standard page header (Polaris Page / Primer PageHeader / Linear).
421
455
  *
@@ -452,24 +486,32 @@ export function PageHeader({
452
486
  // LC-157: the page title is the Screen's large title; its top bar shows it
453
487
  // once it scrolls away.
454
488
  const largeTitle = useLargeTitle(title, headingLevel === 1 && !heading);
489
+ // LC-270: a pushed page's title is in its top bar at compact width.
490
+ const inlineTitle = useInlinePageTitle() && headingLevel === 1;
491
+ // LC-143: a phone's page title takes the width its actions leave, on one
492
+ // line, so wide actions truncate it instead of breaking it into letters.
493
+ const compact = useLayoutSizeClass() === "compact";
455
494
  // D-11: the page-title step comes from the knob (`moderate` by default), so
456
495
  // one dial re-scales every composed screen; `titleScale` is the explicit
457
496
  // per-instance eject and resolves through the same table. The semantic tag
458
497
  // still follows headingLevel — the step is emphasis, not structure.
459
498
  const titleSize = titleScale ? resolvePageTitleScale(titleScale) : knobProps.pageTitle;
460
- const titleNode =
461
- heading ??
462
- (title ? (
463
- <TitleTag
464
- margin={0}
465
- {...largeTitle}
466
- {...titleSize}
467
- {...knobProps.heading}
468
- {...(knobProps.heading.fontWeight ? { "data-font-weight-knob": "bold" } : null)}
469
- >
470
- {title}
471
- </TitleTag>
472
- ) : null);
499
+ const titleNode = inlineTitle
500
+ ? null
501
+ : (heading ??
502
+ (title ? (
503
+ <TitleTag
504
+ margin={0}
505
+ {...(compact ? { numberOfLines: 1 } : null)}
506
+ {...largeTitle}
507
+ {...titleSize}
508
+ {...knobProps.heading}
509
+ {...(knobProps.heading.fontWeight ? { "data-font-weight-knob": "bold" } : null)}
510
+ >
511
+ {title}
512
+ </TitleTag>
513
+ ) : null));
514
+ if (inlineTitle && !subtitle && !status && !actions && !nav && !children) return null;
473
515
 
474
516
  // When nav is present the strip's active indicator sits ON this rule, so
475
517
  // there is one hairline — not a second competing line. The header then
@@ -688,6 +730,9 @@ function useBarTitleSpan() {
688
730
  };
689
731
  }
690
732
 
733
+ // LC-270: the pushed page's bar title is the page's heading.
734
+ const pageTitleRole = { role: "heading", "aria-level": 1 } as const;
735
+
691
736
  function BarTitle({
692
737
  title,
693
738
  span,
@@ -766,6 +811,7 @@ function InlineToolbar({ leading, trailing, title, children, ...rest }: ScreenTo
766
811
  const bleed = insetToken ? { marginHorizontal: negateSpaceToken(insetToken) as "$4" } : null;
767
812
  // LC-145: a phone top bar is one row; the leading group shrinks first.
768
813
  const oneRow = useLayoutSizeClass() === "compact";
814
+ const pushedTitle = useInlinePageTitle();
769
815
  // LC-153: the toolbar is a bar, so its neutral buttons paint plain.
770
816
  return (
771
817
  <Surface bar>
@@ -804,7 +850,12 @@ function InlineToolbar({ leading, trailing, title, children, ...rest }: ScreenTo
804
850
  {trailing}
805
851
  </IconButtonGroup>
806
852
  {title ? (
807
- <BarTitle title={title} span={titleSpan.span} onTitleWidth={titleSpan.measureTitle} />
853
+ <BarTitle
854
+ title={title}
855
+ span={titleSpan.span}
856
+ onTitleWidth={titleSpan.measureTitle}
857
+ {...(pushedTitle ? pageTitleRole : null)}
858
+ />
808
859
  ) : null}
809
860
  </XStack>
810
861
  </Surface>
@@ -834,6 +885,8 @@ function PinnedTopBar({
834
885
  const titleSpan = useBarTitleSpan();
835
886
  const motion = transitionProps(knobProps.motion.control);
836
887
  const title = inlineTitle ?? largeTitle;
888
+ // LC-270: a pushed page shows its title in the bar from rest, as its heading.
889
+ const pushedTitle = useInlinePageTitle();
837
890
  // LC-153: the pinned bar is a bar, so its neutral buttons paint plain.
838
891
  return (
839
892
  <Surface bar>
@@ -888,7 +941,8 @@ function PinnedTopBar({
888
941
  title={title}
889
942
  span={titleSpan.span}
890
943
  onTitleWidth={titleSpan.measureTitle}
891
- shown={Boolean(inlineTitle) || collapsed}
944
+ shown={Boolean(inlineTitle) || collapsed || pushedTitle}
945
+ {...(pushedTitle ? pageTitleRole : null)}
892
946
  {...motion}
893
947
  />
894
948
  ) : null}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * LC-143: on a phone a page title takes the width its actions leave, on one
3
+ * line with an ellipsis. Wide actions beside it (a view switcher, "…", Add)
4
+ * once squeezed the title column until it broke one letter per line.
5
+ */
6
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
7
+ import { cleanup, screen } from "@testing-library/react";
8
+ import { afterEach, describe, expect, it, vi } from "vitest";
9
+ import { PageHeader } from "./page";
10
+
11
+ const layout = vi.hoisted(() => ({ size: "wide" }));
12
+ vi.mock("@multiplatform.one/theme", async (original) => {
13
+ const actual = await original<typeof import("@multiplatform.one/theme")>();
14
+ return { ...actual, useLayoutSizeClass: () => layout.size };
15
+ });
16
+
17
+ afterEach(() => {
18
+ layout.size = "wide";
19
+ cleanup();
20
+ });
21
+
22
+ function header() {
23
+ return (
24
+ <PageHeader title="Pokemon" actions={<div style={{ width: 320 }}>List · Report · … · +</div>} />
25
+ );
26
+ }
27
+
28
+ describe("page title width (LC-143)", () => {
29
+ it("keeps a phone's page title on one line and truncates it beside wide actions", () => {
30
+ layout.size = "compact";
31
+ renderWithProviders(header());
32
+ const style = getComputedStyle(screen.getByRole("heading", { name: "Pokemon" }));
33
+ expect(style.textOverflow).toBe("ellipsis");
34
+ expect(style.whiteSpace).toBe("nowrap");
35
+ });
36
+
37
+ it("lets a wide screen's page title wrap", () => {
38
+ renderWithProviders(header());
39
+ const style = getComputedStyle(screen.getByRole("heading", { name: "Pokemon" }));
40
+ expect(style.textOverflow).not.toBe("ellipsis");
41
+ });
42
+ });