@multiplatform.one/components 7.47.4 → 7.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/cjs/Dialog.cjs +5 -2
  2. package/dist/cjs/Dialog.native.js +5 -2
  3. package/dist/cjs/Dialog.native.js.map +1 -1
  4. package/dist/cjs/Popover.cjs +6 -3
  5. package/dist/cjs/Popover.native.js +7 -3
  6. package/dist/cjs/Popover.native.js.map +1 -1
  7. package/dist/cjs/Sheet.cjs +59 -0
  8. package/dist/cjs/Sheet.native.js +63 -0
  9. package/dist/cjs/Sheet.native.js.map +1 -0
  10. package/dist/cjs/SheetModal/index.cjs +28 -21
  11. package/dist/cjs/SheetModal/index.native.js +126 -121
  12. package/dist/cjs/SheetModal/index.native.js.map +1 -1
  13. package/dist/cjs/Tabs/index.cjs +113 -11
  14. package/dist/cjs/Tabs/index.native.js +117 -12
  15. package/dist/cjs/Tabs/index.native.js.map +1 -1
  16. package/dist/cjs/Tooltip/index.cjs +2 -1
  17. package/dist/cjs/Tooltip/index.native.js +3 -2
  18. package/dist/cjs/Tooltip/index.native.js.map +1 -1
  19. package/dist/cjs/TreeSelect/index.cjs +2 -1
  20. package/dist/cjs/TreeSelect/index.native.js +2 -1
  21. package/dist/cjs/TreeSelect/index.native.js.map +1 -1
  22. package/dist/cjs/charts/ChartDataView.cjs +7 -6
  23. package/dist/cjs/charts/ChartDataView.native.js +7 -6
  24. package/dist/cjs/charts/ChartDataView.native.js.map +1 -1
  25. package/dist/cjs/feedback/ConfirmDialog.cjs +5 -4
  26. package/dist/cjs/feedback/ConfirmDialog.native.js +5 -4
  27. package/dist/cjs/feedback/ConfirmDialog.native.js.map +1 -1
  28. package/dist/cjs/knobImmuneExports.cjs +0 -1
  29. package/dist/cjs/knobImmuneExports.native.js +0 -1
  30. package/dist/cjs/knobImmuneExports.native.js.map +1 -1
  31. package/dist/cjs/layouts/attachments.cjs +4 -3
  32. package/dist/cjs/layouts/attachments.native.js +4 -3
  33. package/dist/cjs/layouts/attachments.native.js.map +1 -1
  34. package/dist/cjs/surfaces.cjs +4 -2
  35. package/dist/cjs/surfaces.native.js +4 -2
  36. package/dist/cjs/surfaces.native.js.map +1 -1
  37. package/dist/cjs/tamagui.cjs +2 -1
  38. package/dist/cjs/tamagui.native.js +2 -1
  39. package/dist/cjs/tamagui.native.js.map +1 -1
  40. package/dist/esm/Dialog.mjs +5 -2
  41. package/dist/esm/Dialog.mjs.map +1 -1
  42. package/dist/esm/Dialog.native.js +5 -2
  43. package/dist/esm/Dialog.native.js.map +1 -1
  44. package/dist/esm/Popover.mjs +7 -4
  45. package/dist/esm/Popover.mjs.map +1 -1
  46. package/dist/esm/Popover.native.js +8 -4
  47. package/dist/esm/Popover.native.js.map +1 -1
  48. package/dist/esm/Sheet.mjs +34 -0
  49. package/dist/esm/Sheet.mjs.map +1 -0
  50. package/dist/esm/Sheet.native.js +35 -0
  51. package/dist/esm/Sheet.native.js.map +1 -0
  52. package/dist/esm/SheetModal/index.mjs +29 -22
  53. package/dist/esm/SheetModal/index.mjs.map +1 -1
  54. package/dist/esm/SheetModal/index.native.js +126 -121
  55. package/dist/esm/SheetModal/index.native.js.map +1 -1
  56. package/dist/esm/Tabs/index.mjs +113 -14
  57. package/dist/esm/Tabs/index.mjs.map +1 -1
  58. package/dist/esm/Tabs/index.native.js +117 -15
  59. package/dist/esm/Tabs/index.native.js.map +1 -1
  60. package/dist/esm/Tooltip/index.mjs +3 -2
  61. package/dist/esm/Tooltip/index.mjs.map +1 -1
  62. package/dist/esm/Tooltip/index.native.js +4 -3
  63. package/dist/esm/Tooltip/index.native.js.map +1 -1
  64. package/dist/esm/TreeSelect/index.mjs +3 -2
  65. package/dist/esm/TreeSelect/index.mjs.map +1 -1
  66. package/dist/esm/TreeSelect/index.native.js +3 -2
  67. package/dist/esm/TreeSelect/index.native.js.map +1 -1
  68. package/dist/esm/charts/ChartDataView.mjs +2 -1
  69. package/dist/esm/charts/ChartDataView.mjs.map +1 -1
  70. package/dist/esm/charts/ChartDataView.native.js +2 -1
  71. package/dist/esm/charts/ChartDataView.native.js.map +1 -1
  72. package/dist/esm/feedback/ConfirmDialog.mjs +2 -1
  73. package/dist/esm/feedback/ConfirmDialog.mjs.map +1 -1
  74. package/dist/esm/feedback/ConfirmDialog.native.js +2 -1
  75. package/dist/esm/feedback/ConfirmDialog.native.js.map +1 -1
  76. package/dist/esm/knobImmuneExports.mjs +0 -1
  77. package/dist/esm/knobImmuneExports.mjs.map +1 -1
  78. package/dist/esm/knobImmuneExports.native.js +0 -1
  79. package/dist/esm/knobImmuneExports.native.js.map +1 -1
  80. package/dist/esm/layouts/attachments.mjs +2 -1
  81. package/dist/esm/layouts/attachments.mjs.map +1 -1
  82. package/dist/esm/layouts/attachments.native.js +2 -1
  83. package/dist/esm/layouts/attachments.native.js.map +1 -1
  84. package/dist/esm/surfaces.mjs +5 -3
  85. package/dist/esm/surfaces.mjs.map +1 -1
  86. package/dist/esm/surfaces.native.js +5 -3
  87. package/dist/esm/surfaces.native.js.map +1 -1
  88. package/dist/esm/tamagui.mjs +2 -1
  89. package/dist/esm/tamagui.mjs.map +1 -1
  90. package/dist/esm/tamagui.native.js +2 -1
  91. package/dist/esm/tamagui.native.js.map +1 -1
  92. package/dist/jsx/Dialog.mjs +5 -2
  93. package/dist/jsx/Dialog.mjs.map +1 -1
  94. package/dist/jsx/Dialog.native.js +5 -2
  95. package/dist/jsx/Dialog.native.js.map +1 -1
  96. package/dist/jsx/Popover.mjs +7 -4
  97. package/dist/jsx/Popover.mjs.map +1 -1
  98. package/dist/jsx/Popover.native.js +7 -3
  99. package/dist/jsx/Popover.native.js.map +1 -1
  100. package/dist/jsx/Sheet.mjs +34 -0
  101. package/dist/jsx/Sheet.mjs.map +1 -0
  102. package/dist/jsx/Sheet.native.js +63 -0
  103. package/dist/jsx/Sheet.native.js.map +1 -0
  104. package/dist/jsx/SheetModal/index.mjs +29 -22
  105. package/dist/jsx/SheetModal/index.mjs.map +1 -1
  106. package/dist/jsx/SheetModal/index.native.js +126 -121
  107. package/dist/jsx/SheetModal/index.native.js.map +1 -1
  108. package/dist/jsx/Tabs/index.mjs +113 -14
  109. package/dist/jsx/Tabs/index.mjs.map +1 -1
  110. package/dist/jsx/Tabs/index.native.js +117 -12
  111. package/dist/jsx/Tabs/index.native.js.map +1 -1
  112. package/dist/jsx/Tooltip/index.mjs +3 -2
  113. package/dist/jsx/Tooltip/index.mjs.map +1 -1
  114. package/dist/jsx/Tooltip/index.native.js +3 -2
  115. package/dist/jsx/Tooltip/index.native.js.map +1 -1
  116. package/dist/jsx/TreeSelect/index.mjs +3 -2
  117. package/dist/jsx/TreeSelect/index.mjs.map +1 -1
  118. package/dist/jsx/TreeSelect/index.native.js +2 -1
  119. package/dist/jsx/TreeSelect/index.native.js.map +1 -1
  120. package/dist/jsx/charts/ChartDataView.mjs +2 -1
  121. package/dist/jsx/charts/ChartDataView.mjs.map +1 -1
  122. package/dist/jsx/charts/ChartDataView.native.js +7 -6
  123. package/dist/jsx/charts/ChartDataView.native.js.map +1 -1
  124. package/dist/jsx/feedback/ConfirmDialog.mjs +2 -1
  125. package/dist/jsx/feedback/ConfirmDialog.mjs.map +1 -1
  126. package/dist/jsx/feedback/ConfirmDialog.native.js +5 -4
  127. package/dist/jsx/feedback/ConfirmDialog.native.js.map +1 -1
  128. package/dist/jsx/knobImmuneExports.mjs +0 -1
  129. package/dist/jsx/knobImmuneExports.mjs.map +1 -1
  130. package/dist/jsx/knobImmuneExports.native.js +0 -1
  131. package/dist/jsx/knobImmuneExports.native.js.map +1 -1
  132. package/dist/jsx/layouts/attachments.mjs +2 -1
  133. package/dist/jsx/layouts/attachments.mjs.map +1 -1
  134. package/dist/jsx/layouts/attachments.native.js +4 -3
  135. package/dist/jsx/layouts/attachments.native.js.map +1 -1
  136. package/dist/jsx/surfaces.mjs +5 -3
  137. package/dist/jsx/surfaces.mjs.map +1 -1
  138. package/dist/jsx/surfaces.native.js +4 -2
  139. package/dist/jsx/surfaces.native.js.map +1 -1
  140. package/dist/jsx/tamagui.mjs +2 -1
  141. package/dist/jsx/tamagui.mjs.map +1 -1
  142. package/dist/jsx/tamagui.native.js +2 -1
  143. package/dist/jsx/tamagui.native.js.map +1 -1
  144. package/package.json +9 -9
  145. package/src/Button.native-press.spec.tsx +86 -0
  146. package/src/Dialog.spec.tsx +6 -5
  147. package/src/Dialog.tsx +9 -1
  148. package/src/Popover.coverTrigger.spec.tsx +1 -1
  149. package/src/Popover.tsx +17 -4
  150. package/src/Sheet.tsx +35 -0
  151. package/src/SheetModal/index.native.tsx +117 -113
  152. package/src/SheetModal/index.tsx +30 -26
  153. package/src/Tabs/Tabs.fades.native.spec.tsx +201 -0
  154. package/src/Tabs/Tabs.gutter.spec.tsx +95 -0
  155. package/src/Tabs/Tabs.stories.tsx +37 -0
  156. package/src/Tabs/index.tsx +149 -12
  157. package/src/Tooltip/index.native.tsx +4 -3
  158. package/src/Tooltip/index.tsx +3 -2
  159. package/src/TreeSelect/index.tsx +3 -2
  160. package/src/charts/ChartDataView.tsx +2 -1
  161. package/src/feedback/ConfirmDialog.stories.tsx +48 -0
  162. package/src/feedback/ConfirmDialog.tsx +2 -1
  163. package/src/knobImmuneExports.ts +0 -1
  164. package/src/layouts/attachments.tsx +1 -1
  165. package/src/layouts/layouts.spec.tsx +4 -2
  166. package/src/overlayStack.native-press.spec.tsx +214 -0
  167. package/src/surfaces.spec.tsx +2 -1
  168. package/src/surfaces.tsx +5 -2
  169. package/src/tamagui.spec.ts +4 -4
  170. package/src/tamagui.ts +3 -1
  171. package/types/Dialog.d.ts.map +1 -1
  172. package/types/Popover.d.ts.map +1 -1
  173. package/types/Sheet.d.ts +3 -0
  174. package/types/Sheet.d.ts.map +1 -0
  175. package/types/SheetModal/index.d.ts.map +1 -1
  176. package/types/SheetModal/index.native.d.ts.map +1 -1
  177. package/types/Tabs/index.d.ts +15 -0
  178. package/types/Tabs/index.d.ts.map +1 -1
  179. package/types/Tooltip/index.d.ts.map +1 -1
  180. package/types/Tooltip/index.native.d.ts.map +1 -1
  181. package/types/TreeSelect/index.d.ts.map +1 -1
  182. package/types/charts/ChartDataView.d.ts.map +1 -1
  183. package/types/feedback/ConfirmDialog.d.ts.map +1 -1
  184. package/types/knobImmuneExports.d.ts.map +1 -1
  185. package/types/layouts/attachments.d.ts.map +1 -1
  186. package/types/surfaces.d.ts +6 -1
  187. package/types/surfaces.d.ts.map +1 -1
  188. package/types/tamagui.d.ts +2 -1
  189. package/types/tamagui.d.ts.map +1 -1
@@ -0,0 +1,201 @@
1
+ /**
2
+ * LC-120 on the native Tabs strip (FZ-7831). Web fades the strip's ends with a
3
+ * CSS mask; native has no mask, so the strip lays a gradient of its own
4
+ * surface over each end it can scroll toward. These cases drive the native
5
+ * scroll callbacks (layout, content size, scroll) the way React Native fires
6
+ * them on iOS and Android, LTR and RTL.
7
+ */
8
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
9
+ import { act, cleanup } from "@testing-library/react";
10
+ import { forwardRef, useImperativeHandle } from "react";
11
+ import { Theme, useTheme } from "tamagui";
12
+ import { afterEach, describe, expect, it, vi } from "vitest";
13
+ import { TABS_EDGE_FADE, Tabs, tabsFadeEdge, type TabsProps } from "./index";
14
+
15
+ const native = vi.hoisted(() => ({
16
+ os: "ios",
17
+ direction: "ltr" as "ltr" | "rtl",
18
+ scroll: undefined as Record<string, any> | undefined,
19
+ }));
20
+
21
+ vi.mock("tamagui", async (importOriginal) => ({
22
+ ...(await importOriginal<typeof import("tamagui")>()),
23
+ isWeb: false,
24
+ }));
25
+
26
+ // Vitest aliases react-native to react-native-web.
27
+ vi.mock("react-native-web", async (importOriginal) => {
28
+ const actual = await importOriginal<Record<string, any>>();
29
+ return {
30
+ ...actual,
31
+ Platform: {
32
+ ...actual.Platform,
33
+ get OS() {
34
+ return native.os;
35
+ },
36
+ },
37
+ };
38
+ });
39
+
40
+ vi.mock("../hooks/useDirection", () => ({ useDirection: () => native.direction }));
41
+
42
+ vi.mock("../ScrollView", async () => {
43
+ const React = await import("react");
44
+ return {
45
+ ScrollView: forwardRef(function NativeScroll(props: Record<string, any>, ref) {
46
+ native.scroll = props;
47
+ useImperativeHandle(ref, () => ({ scrollTo() {} }), []);
48
+ return React.createElement("div", { "data-tabs-scroll": "true" }, props.children);
49
+ }),
50
+ };
51
+ });
52
+
53
+ afterEach(() => {
54
+ cleanup();
55
+ native.os = "ios";
56
+ native.direction = "ltr";
57
+ native.scroll = undefined;
58
+ });
59
+
60
+ const items = Array.from({ length: 9 }, (_, i) => ({ value: `t${i}`, label: `Section ${i}` }));
61
+ const seen = { background: "" };
62
+
63
+ function Probe() {
64
+ seen.background = String(useTheme().background?.val);
65
+ return null;
66
+ }
67
+
68
+ function render(props: Partial<TabsProps> = {}, scheme?: "light" | "dark") {
69
+ const ui = (
70
+ <>
71
+ <Probe />
72
+ <Tabs items={items} {...props} />
73
+ </>
74
+ );
75
+ return renderWithProviders(scheme ? <Theme name={scheme}>{ui}</Theme> : ui);
76
+ }
77
+
78
+ /** The strip settles: React Native reports the viewport, then the content. */
79
+ function settle(viewport: number, content: number) {
80
+ act(() => native.scroll!.onLayout({ nativeEvent: { layout: { width: viewport, height: 44 } } }));
81
+ act(() => native.scroll!.onContentSizeChange(content, 44));
82
+ }
83
+
84
+ function scrollTo(x: number) {
85
+ act(() => native.scroll!.onScroll({ nativeEvent: { contentOffset: { x, y: 0 } } }));
86
+ }
87
+
88
+ function fade(side: "left" | "right") {
89
+ return document.querySelector<HTMLElement>(`[data-tabs-fade="${side}"]`);
90
+ }
91
+
92
+ function shown() {
93
+ return { left: Boolean(fade("left")), right: Boolean(fade("right")) };
94
+ }
95
+
96
+ /** [colour, opacity] at the gradient's physical left and right. */
97
+ function stops(side: "left" | "right") {
98
+ return Array.from(fade(side)!.querySelectorAll("stop")).map((stop) => [
99
+ stop.getAttribute("stop-color"),
100
+ stop.getAttribute("stop-opacity"),
101
+ ]);
102
+ }
103
+
104
+ describe("native Tabs overflow fades (LC-120, FZ-7831)", () => {
105
+ it("draws no fade while the strip fits", () => {
106
+ render();
107
+ settle(390, 300);
108
+ expect(shown()).toEqual({ left: false, right: false });
109
+ });
110
+
111
+ it.each(["ios", "android"])("%s LTR: fades only the end the strip can scroll toward", (os) => {
112
+ native.os = os;
113
+ render();
114
+ settle(390, 900);
115
+ expect(shown()).toEqual({ left: false, right: true });
116
+ scrollTo(250);
117
+ expect(shown()).toEqual({ left: true, right: true });
118
+ scrollTo(510);
119
+ expect(shown()).toEqual({ left: true, right: false });
120
+ scrollTo(0);
121
+ expect(shown()).toEqual({ left: false, right: true });
122
+ });
123
+
124
+ it("fades into the strip's own surface, clear toward the tabs", () => {
125
+ render();
126
+ settle(390, 900);
127
+ scrollTo(250);
128
+ const surface = seen.background;
129
+ expect(surface).toMatch(/\S/);
130
+ expect(stops("left")).toEqual([
131
+ [surface, "1"],
132
+ [surface, "0"],
133
+ ]);
134
+ expect(stops("right")).toEqual([
135
+ [surface, "0"],
136
+ [surface, "1"],
137
+ ]);
138
+ });
139
+
140
+ it("follows the dark theme's surface", () => {
141
+ render({}, "light");
142
+ settle(390, 900);
143
+ const light = stops("right")[1]![0];
144
+ cleanup();
145
+ render({}, "dark");
146
+ settle(390, 900);
147
+ const dark = stops("right")[1]![0];
148
+ expect(dark).toBe(seen.background);
149
+ expect(dark).not.toBe(light);
150
+ });
151
+
152
+ it("is the web fade's width and never takes a touch", () => {
153
+ render();
154
+ settle(390, 900);
155
+ const end = fade("right")!;
156
+ expect(TABS_EDGE_FADE).toBe(32);
157
+ expect(end.className).toContain("_w-32px");
158
+ expect(end.className).toContain("_pe-none");
159
+ expect(end.className).toContain("_pos-absolute");
160
+ });
161
+
162
+ it("iOS RTL: rests on the physical right, so only the left end fades", () => {
163
+ native.direction = "rtl";
164
+ render();
165
+ settle(390, 900);
166
+ expect(shown()).toEqual({ left: true, right: false });
167
+ expect(stops("left").map(([, opacity]) => opacity)).toEqual(["1", "0"]);
168
+ scrollTo(510);
169
+ expect(shown()).toEqual({ left: false, right: true });
170
+ });
171
+
172
+ it("anchors each fade by its logical edge, which React Native mirrors under RTL", () => {
173
+ expect(tabsFadeEdge("left", "ltr")).toBe("start");
174
+ expect(tabsFadeEdge("right", "ltr")).toBe("end");
175
+ expect(tabsFadeEdge("left", "rtl")).toBe("end");
176
+ expect(tabsFadeEdge("right", "rtl")).toBe("start");
177
+ });
178
+
179
+ it("Android RTL: offsets count from the physical left", () => {
180
+ native.os = "android";
181
+ native.direction = "rtl";
182
+ render();
183
+ settle(390, 900);
184
+ expect(shown()).toEqual({ left: true, right: false });
185
+ scrollTo(250);
186
+ expect(shown()).toEqual({ left: true, right: true });
187
+ scrollTo(0);
188
+ expect(shown()).toEqual({ left: false, right: true });
189
+ scrollTo(510);
190
+ expect(shown()).toEqual({ left: true, right: false });
191
+ });
192
+
193
+ it.each([{ variant: "band" as const }, { distribution: "equal" as const }])(
194
+ "a strip that shares the row (%o) never scrolls and never fades",
195
+ (props) => {
196
+ render(props);
197
+ expect(native.scroll).toBeUndefined();
198
+ expect(shown()).toEqual({ left: false, right: false });
199
+ },
200
+ );
201
+ });
@@ -0,0 +1,95 @@
1
+ /**
2
+ * FZ-7813, LC-122 side inset: a tab panel inside a gutter-padded Screen sits
3
+ * on the page's gutter and adds none of its own; edge-to-edge Tabs (no Screen,
4
+ * or `noPadding`) supply that gutter. The strip-to-content gap is the page's
5
+ * section gap in both.
6
+ *
7
+ * jsdom cannot cascade Tamagui's atomic CSS; these read the atoms.
8
+ */
9
+ import { cleanup, screen } from "@testing-library/react";
10
+ import { renderWithProviders } from "@multiplatform.one/test-utils";
11
+ import { PageGutter } from "@multiplatform.one/theme";
12
+ import type { ReactNode } from "react";
13
+ import { afterEach, describe, expect, it } from "vitest";
14
+ import { Screen } from "../layouts/page";
15
+ import { Tabs } from "./index";
16
+
17
+ afterEach(cleanup);
18
+
19
+ const items = [
20
+ { value: "overview", label: "Overview", content: "Abilities" },
21
+ { value: "stats", label: "Stats", content: "Stats content" },
22
+ ];
23
+
24
+ function atoms(el: Element | null, ...prefixes: string[]): string[] {
25
+ return String((el as HTMLElement | null)?.className || "")
26
+ .split(" ")
27
+ .filter((c) => prefixes.some((p) => c.startsWith(p)))
28
+ .sort();
29
+ }
30
+
31
+ /** The value half of an atom: `_pl-t-space-4` → `t-space-4`. */
32
+ function value(atom: string | undefined): string | undefined {
33
+ return atom?.replace(/^_[a-z]+-/, "");
34
+ }
35
+
36
+ const side = ["_pl-", "_pr-", "_p-", "_px-", "_ps-", "_pe-"];
37
+
38
+ describe.each(["underline", "contained", "band"] as const)("%s Tabs panel inset", (variant) => {
39
+ it("adds no side padding inside a gutter-padded Screen", () => {
40
+ const { container } = renderWithProviders(
41
+ <Screen scroll={false}>
42
+ <Tabs items={items} variant={variant} />
43
+ </Screen>,
44
+ );
45
+ const panel = screen.getByRole("tabpanel");
46
+ expect(atoms(panel, ...side)).toEqual([]);
47
+ const page = container.querySelector('[data-testid="screen"]');
48
+ expect(atoms(page, "_pl-")).toHaveLength(1);
49
+ });
50
+
51
+ it.each([
52
+ [
53
+ "a host that declares PageGutter",
54
+ (tabs: ReactNode) => <PageGutter inset="$4">{tabs}</PageGutter>,
55
+ ],
56
+ [
57
+ "a card in a padded Screen that resets the gutter",
58
+ (tabs: ReactNode) => (
59
+ <Screen scroll={false}>
60
+ <PageGutter inset={null}>{tabs}</PageGutter>
61
+ </Screen>
62
+ ),
63
+ ],
64
+ ])("adds no side padding under %s", (_name, wrap) => {
65
+ renderWithProviders(<>{wrap(<Tabs items={items} variant={variant} />)}</>);
66
+ expect(atoms(screen.getByRole("tabpanel"), ...side)).toEqual([]);
67
+ });
68
+
69
+ it("puts one section gap between the strip and the first content", () => {
70
+ const { container } = renderWithProviders(
71
+ <Screen scroll={false}>
72
+ <Tabs items={items} variant={variant} />
73
+ </Screen>,
74
+ );
75
+ const page = container.querySelector('[data-testid="screen"]');
76
+ const sectionGap = value(atoms(page, "_gap-")[0]);
77
+ expect(sectionGap).toBeTruthy();
78
+ const panel = screen.getByRole("tabpanel");
79
+ expect(atoms(panel, "_pt-").map(value)).toEqual([sectionGap]);
80
+ expect(atoms(panel, "_pb-", "_p-")).toEqual([]);
81
+ });
82
+
83
+ it.each([
84
+ ["standalone", (tabs: ReactNode) => tabs],
85
+ ["noPadding Screen", (tabs: ReactNode) => <Screen noPadding>{tabs}</Screen>],
86
+ ])("edge-to-edge (%s) keeps the page gutter on both sides", (_name, wrap) => {
87
+ const { container: padded } = renderWithProviders(<Screen scroll={false}>x</Screen>);
88
+ const gutter = value(atoms(padded.querySelector('[data-testid="screen"]'), "_pl-")[0]);
89
+ cleanup();
90
+ renderWithProviders(<>{wrap(<Tabs items={items} variant={variant} />)}</>);
91
+ const panel = screen.getByRole("tabpanel");
92
+ expect(atoms(panel, "_pl-").map(value)).toEqual([gutter]);
93
+ expect(atoms(panel, "_pr-").map(value)).toEqual([gutter]);
94
+ });
95
+ });
@@ -11,6 +11,7 @@ import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
11
11
  import React from "react";
12
12
  import { ScrollView, XStack, YStack } from "tamagui";
13
13
  import { Chip } from "../Chip";
14
+ import { PageHeader, Screen } from "../layouts/page";
14
15
  import { ScrollView as PanelScrollView } from "../ScrollView";
15
16
  import { Tabs, type TabsItem } from "./index";
16
17
  import { Text } from "../Text";
@@ -454,3 +455,39 @@ export const InitialSixthActive: Story = {
454
455
  );
455
456
  },
456
457
  };
458
+
459
+ export const InPageGutter: Story = {
460
+ parameters: {
461
+ docs: {
462
+ description: {
463
+ story:
464
+ "LC-122 side inset (FZ-7813): inside a padded Screen the panel adds no side padding, so its content starts on the page gutter with the title above it. The strip-to-content gap is the page's section gap.",
465
+ },
466
+ },
467
+ },
468
+ render: (args) => (
469
+ <Screen scroll={false}>
470
+ <PageHeader title="Butterfree" subtitle="Bug · Flying" />
471
+ <Tabs
472
+ {...args}
473
+ items={[
474
+ {
475
+ value: "overview",
476
+ label: "Overview",
477
+ content: <Panel title="Abilities" body="Compound Eyes, Tinted Lens." />,
478
+ },
479
+ {
480
+ value: "stats",
481
+ label: "Stats",
482
+ content: <Panel title="Stats" body="HP 60, Attack 45." />,
483
+ },
484
+ {
485
+ value: "moves",
486
+ label: "Moves",
487
+ content: <Panel title="Moves" body="Confusion, Gust." />,
488
+ },
489
+ ]}
490
+ />
491
+ </Screen>
492
+ ),
493
+ };
@@ -11,9 +11,10 @@ import { IconSlot } from "@multiplatform.one/theme";
11
11
  * stays on the radius knob), spacing roles (pad + panel), animation
12
12
  * (indicator slide), elevation (thumb)
13
13
  * - intent: neutral selection by default; error / warning / success theme the indicator
14
- * - overflow: horizontal scroll with web edge fades when tabs exceed width
15
- * (RTL-aware: CSSOM `scrollLeft` is 0 → −range; G10 hairline on the
16
- * underline strip, not a knob-driven border)
14
+ * - overflow: horizontal scroll with an edge fade at each end that can scroll
15
+ * (web: a CSS mask; native: an SVG gradient into the strip's surface. RTL-aware:
16
+ * CSSOM `scrollLeft` is 0 → −range; G10 hairline on the underline strip, not a
17
+ * knob-driven border)
17
18
  * - lazyMount: panels mount on first visit and stay mounted (state preserved)
18
19
  * - fill: root + panel host grow into a bounded parent (Tabs contract,
19
20
  * docs/theme-propagation-spec.md)
@@ -26,6 +27,7 @@ import { IconSlot } from "@multiplatform.one/theme";
26
27
 
27
28
  import {
28
29
  MIN_PRESS_TARGET,
30
+ usePageGutter,
29
31
  ensureKeyboardModalityTracking,
30
32
  getGroupPosition,
31
33
  hairline,
@@ -40,7 +42,23 @@ import {
40
42
  } from "@multiplatform.one/theme";
41
43
  import type { ReactNode } from "react";
42
44
  import React from "react";
45
+ import { Platform } from "react-native";
46
+ import {
47
+ Defs as TSvgDefs,
48
+ LinearGradient as TSvgLinearGradient,
49
+ Rect as TSvgRect,
50
+ Stop as TSvgStop,
51
+ Svg as TSvg,
52
+ } from "@tamagui/react-native-svg";
53
+ import type {
54
+ Defs as RNSvgDefs,
55
+ LinearGradient as RNSvgLinearGradient,
56
+ Rect as RNSvgRect,
57
+ Stop as RNSvgStop,
58
+ Svg as RNSvg,
59
+ } from "react-native-svg";
43
60
  import { useDirection } from "../hooks/useDirection";
61
+ import { usePageChromeInset } from "../layouts/pageHeadingScope";
44
62
  import { useTranslation } from "../shared/i18n";
45
63
  import { wrapBareTextChildren } from "../shared/textRidesText";
46
64
  import type { GetProps, SizeTokens } from "tamagui";
@@ -52,12 +70,23 @@ import {
52
70
  YStack,
53
71
  isWeb,
54
72
  styled,
73
+ useTheme,
55
74
  useWindowDimensions,
56
75
  withStaticProperties,
57
76
  } from "tamagui";
58
77
  import { componentColors } from "../componentColors";
59
78
  import { ScrollView } from "../ScrollView";
60
79
 
80
+ // The shim ships no types; it is react-native-svg on native (as charts/svg.ts).
81
+ const Svg = TSvg as unknown as typeof RNSvg;
82
+ const SvgDefs = TSvgDefs as unknown as typeof RNSvgDefs;
83
+ const SvgLinearGradient = TSvgLinearGradient as unknown as typeof RNSvgLinearGradient;
84
+ const SvgStop = TSvgStop as unknown as typeof RNSvgStop;
85
+ const SvgRect = TSvgRect as unknown as typeof RNSvgRect;
86
+
87
+ /** Width of each overflow edge fade, web mask and native gradient alike. */
88
+ export const TABS_EDGE_FADE = 32;
89
+
61
90
  // ── Types ─────────────────────────────────────────────────────
62
91
 
63
92
  export type TabsVariant = "underline" | "contained" | "band";
@@ -166,13 +195,81 @@ export function tabsOverflowFades(
166
195
  return { left: fromLeft > threshold, right: fromRight > threshold };
167
196
  }
168
197
 
198
+ /**
199
+ * Native overflow fades, as the same physical `{ left, right }` pair.
200
+ *
201
+ * React Native's horizontal ScrollView reports `contentOffset.x` from the
202
+ * logical start on iOS under RTL and from the physical left on Android, and
203
+ * nothing at rest: an `undefined` offset is a strip still at its start.
204
+ */
205
+ export function tabsNativeOverflowFades(
206
+ offset: number | undefined,
207
+ viewport: number,
208
+ content: number,
209
+ direction: TabsDirection,
210
+ platform: string,
211
+ threshold = 4,
212
+ ): { left: boolean; right: boolean } {
213
+ const range = Math.max(content - viewport, 0);
214
+ const rtl = direction === "rtl";
215
+ const raw = offset ?? (rtl && platform === "android" ? range : 0);
216
+ const fromStart = Math.min(Math.max(rtl && platform === "android" ? range - raw : raw, 0), range);
217
+ const start = fromStart > threshold;
218
+ const end = range - fromStart > threshold;
219
+ return rtl ? { left: end, right: start } : { left: start, right: end };
220
+ }
221
+
222
+ /** React Native mirrors left/right under RTL, so a fade anchors by its logical edge. */
223
+ export function tabsFadeEdge(side: "left" | "right", direction: TabsDirection): "start" | "end" {
224
+ return (side === "left") === (direction === "ltr") ? "start" : "end";
225
+ }
226
+
227
+ /**
228
+ * One native edge fade: the strip's own surface colour, opaque at the edge
229
+ * and clear toward the tabs, laid over the scroller and never hit-tested.
230
+ */
231
+ function TabsEdgeFade({
232
+ side,
233
+ color,
234
+ direction,
235
+ }: {
236
+ side: "left" | "right";
237
+ color: string;
238
+ direction: TabsDirection;
239
+ }) {
240
+ const id = `mpTabsFade${React.useId().replace(/[^a-zA-Z0-9]/g, "")}`;
241
+ return (
242
+ <View
243
+ pointerEvents="none"
244
+ position="absolute"
245
+ top={0}
246
+ bottom={0}
247
+ width={TABS_EDGE_FADE}
248
+ zIndex={1}
249
+ style={{ [tabsFadeEdge(side, direction)]: 0 }}
250
+ data-tabs-fade={side}
251
+ testID={`tabs-fade-${side}`}
252
+ >
253
+ <Svg width="100%" height="100%" pointerEvents="none">
254
+ <SvgDefs>
255
+ <SvgLinearGradient id={id} x1="0" y1="0" x2="1" y2="0">
256
+ <SvgStop offset="0" stopColor={color} stopOpacity={side === "left" ? 1 : 0} />
257
+ <SvgStop offset="1" stopColor={color} stopOpacity={side === "left" ? 0 : 1} />
258
+ </SvgLinearGradient>
259
+ </SvgDefs>
260
+ <SvgRect x="0" y="0" width="100%" height="100%" fill={`url(#${id})`} />
261
+ </Svg>
262
+ </View>
263
+ );
264
+ }
265
+
169
266
  export function tabsScrollIntoViewX(
170
267
  layout: TabLayout,
171
268
  offset: number,
172
269
  viewport: number,
173
270
  content: number,
174
271
  direction: TabsDirection,
175
- pad = 32,
272
+ pad = TABS_EDGE_FADE,
176
273
  ): number | undefined {
177
274
  if (
178
275
  ![layout.x, layout.width, layout.height, offset, viewport, content].every(Number.isFinite) ||
@@ -323,6 +420,9 @@ function TabsRoot({
323
420
  }: TabsProps) {
324
421
  const { t } = useTranslation();
325
422
  const direction = useDirection();
423
+ const pageGutter = usePageGutter();
424
+ const screenInset = usePageChromeInset();
425
+ const pageInset = pageGutter ?? screenInset;
326
426
  const intent =
327
427
  (accent && "accent") ||
328
428
  (error && "error") ||
@@ -396,14 +496,30 @@ function TabsRoot({
396
496
  };
397
497
 
398
498
  // Overflow tracking for edge fades + keep-active-visible scrolling
499
+ const theme = useTheme();
500
+ // A scrolling strip paints no fill of its own: its surface is the theme's.
501
+ // Read only on native, so web never subscribes to a value it does not paint.
502
+ const stripSurface = isWeb
503
+ ? "transparent"
504
+ : String(
505
+ theme[componentColors.surface.background.slice(1) as "background"]?.val ?? "transparent",
506
+ );
399
507
  const scrollRef = React.useRef<ScrollView>(null);
400
508
  const tabRefs = React.useRef(new Map<string, HTMLElement>());
401
- const scrollMetrics = React.useRef({ offset: 0, viewport: 0, content: 0 });
509
+ const scrollMetrics = React.useRef({ offset: 0, viewport: 0, content: 0, scrolled: false });
402
510
  const [sizeRevision, setSizeRevision] = React.useState(0);
403
511
  const [fades, setFades] = React.useState({ left: false, right: false });
404
512
  const updateFades = () => {
405
- const { offset, viewport, content } = scrollMetrics.current;
406
- const next = tabsOverflowFades(offset, viewport, content, direction);
513
+ const { offset, viewport, content, scrolled } = scrollMetrics.current;
514
+ const next = isWeb
515
+ ? tabsOverflowFades(offset, viewport, content, direction)
516
+ : tabsNativeOverflowFades(
517
+ scrolled ? offset : undefined,
518
+ viewport,
519
+ content,
520
+ direction,
521
+ Platform.OS,
522
+ );
407
523
  setFades((prev) => (prev.left === next.left && prev.right === next.right ? prev : next));
408
524
  };
409
525
 
@@ -478,13 +594,15 @@ function TabsRoot({
478
594
  ? undefined
479
595
  : stackRadiusProps(activePosition, outerRadiusToken, "horizontal");
480
596
 
481
- // Web-only edge fades: a scroll-state mask keeps the fade background-agnostic
597
+ // Web edge fades: a scroll-state mask keeps the fade background-agnostic.
598
+ // Native has no mask, so it lays a gradient of the strip's surface over the
599
+ // same edges (TabsEdgeFade).
482
600
  const maskStyle: Record<string, string> | undefined =
483
601
  isWeb && (fades.left || fades.right)
484
602
  ? (() => {
485
- const leftStop = fades.left ? "transparent 0px, black 32px" : "black 0px";
603
+ const leftStop = fades.left ? `transparent 0px, black ${TABS_EDGE_FADE}px` : "black 0px";
486
604
  const rightStop = fades.right
487
- ? "black calc(100% - 32px), transparent 100%"
605
+ ? `black calc(100% - ${TABS_EDGE_FADE}px), transparent 100%`
488
606
  : "black 100%";
489
607
  const mask = `linear-gradient(to right, ${leftStop}, ${rightStop})`;
490
608
  return { maskImage: mask, WebkitMaskImage: mask };
@@ -528,6 +646,18 @@ function TabsRoot({
528
646
  indicatorContent
529
647
  );
530
648
 
649
+ // LC-122 side inset: under a page gutter, or anywhere inside a padded
650
+ // Screen (a card there resets the gutter but still pads), the panel sits on
651
+ // the padding it is given; edge-to-edge Tabs supply the gutter themselves.
652
+ // The strip-to-content gap is one section gap either way.
653
+ const panelInset = pageInset
654
+ ? { paddingTop: knobProps.gapLg.gap }
655
+ : {
656
+ paddingHorizontal: knobProps.panelPadding.padding,
657
+ paddingTop: knobProps.gapLg.gap,
658
+ paddingBottom: knobProps.panelPadding.padding,
659
+ };
660
+
531
661
  if (items.length === 0) return null;
532
662
 
533
663
  const tabListLabel = ariaLabel ?? t("Tabs");
@@ -764,6 +894,7 @@ function TabsRoot({
764
894
  marginVertical={-slop}
765
895
  onScroll={(e) => {
766
896
  scrollMetrics.current.offset = e.nativeEvent.contentOffset.x;
897
+ scrollMetrics.current.scrolled = true;
767
898
  updateFades();
768
899
  }}
769
900
  onLayout={(e) => {
@@ -776,6 +907,12 @@ function TabsRoot({
776
907
  {tabList}
777
908
  </TabStripScroll>
778
909
  )}
910
+ {!isWeb && !equalDistribution && fades.left ? (
911
+ <TabsEdgeFade side="left" color={stripSurface} direction={direction} />
912
+ ) : null}
913
+ {!isWeb && !equalDistribution && fades.right ? (
914
+ <TabsEdgeFade side="right" color={stripSurface} direction={direction} />
915
+ ) : null}
779
916
  </StripWrapper>
780
917
 
781
918
  {/*
@@ -814,7 +951,7 @@ function TabsRoot({
814
951
  display={isActive ? "flex" : "none"}
815
952
  onLayout={isActive && !fill ? releasePanelHeight : undefined}
816
953
  {...(fill ? fillProps : undefined)}
817
- {...knobProps.panelPadding}
954
+ {...panelInset}
818
955
  tabIndex={-1}
819
956
  outlineWidth={0}
820
957
  focusStyle={{ outlineWidth: 0 }}
@@ -830,7 +967,7 @@ function TabsRoot({
830
967
  value={item.value}
831
968
  onLayout={isActive && !fill ? releasePanelHeight : undefined}
832
969
  {...(fill ? fillProps : undefined)}
833
- {...knobProps.panelPadding}
970
+ {...panelInset}
834
971
  tabIndex={-1}
835
972
  outlineWidth={0}
836
973
  focusStyle={{ outlineWidth: 0 }}
@@ -13,7 +13,7 @@ import {
13
13
  useResolvedKnobs,
14
14
  warnTooltipOnDisabled,
15
15
  } from "@multiplatform.one/theme";
16
- import { zIndex } from "@multiplatform.one/forms";
16
+ import { useOverlayZIndex } from "@multiplatform.one/forms";
17
17
 
18
18
  import React from "react";
19
19
  import { Pressable, StyleSheet } from "react-native";
@@ -71,6 +71,7 @@ export function Tooltip({
71
71
  open: openProp,
72
72
  onOpenChange: onOpenChangeProp,
73
73
  }: TooltipProps) {
74
+ const overlayZIndex = useOverlayZIndex("dropdown");
74
75
  const { knobProps } = useResolvedKnobs({ component: "Tooltip", painted: false });
75
76
  const theme = useTheme();
76
77
  const elevated = knobProps.elevatedSurface;
@@ -153,7 +154,7 @@ export function Tooltip({
153
154
  onPress={() => {
154
155
  if (outsideArmed) press.tapOutside();
155
156
  }}
156
- style={[StyleSheet.absoluteFill, { zIndex: zIndex.dropdown - 1 }]}
157
+ style={[StyleSheet.absoluteFill, { zIndex: overlayZIndex - 1 }]}
157
158
  />
158
159
  </Portal>
159
160
  ) : null}
@@ -162,7 +163,7 @@ export function Tooltip({
162
163
  delay={0}
163
164
  restMs={0}
164
165
  offset={OVERLAY_ANCHOR_GAP}
165
- zIndex={zIndex.dropdown}
166
+ zIndex={overlayZIndex}
166
167
  open={open}
167
168
  onOpenChange={setOpen}
168
169
  >
@@ -17,7 +17,7 @@ import {
17
17
  useResolvedKnobs,
18
18
  warnTooltipOnDisabled,
19
19
  } from "@multiplatform.one/theme";
20
- import { zIndex } from "@multiplatform.one/forms";
20
+ import { useOverlayZIndex } from "@multiplatform.one/forms";
21
21
  import React from "react";
22
22
  import {
23
23
  Tooltip as TamaguiTooltip,
@@ -73,6 +73,7 @@ export function Tooltip({
73
73
  open: openProp,
74
74
  onOpenChange: onOpenChangeProp,
75
75
  }: TooltipProps) {
76
+ const overlayZIndex = useOverlayZIndex("dropdown");
76
77
  const { knobProps } = useResolvedKnobs({ component: "Tooltip", painted: false });
77
78
  const theme = useTheme();
78
79
  const elevated = knobProps.elevatedSurface;
@@ -156,7 +157,7 @@ export function Tooltip({
156
157
  delay={{ open: delayMs, close: 0 }}
157
158
  restMs={100}
158
159
  offset={OVERLAY_ANCHOR_GAP}
159
- zIndex={zIndex.dropdown}
160
+ zIndex={overlayZIndex}
160
161
  open={open}
161
162
  onOpenChange={setOpen}
162
163
  >