@multiplatform.one/components 7.84.6 → 7.84.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/DropdownMenu/index.cjs +1 -0
- package/dist/cjs/DropdownMenu/index.native.js +3 -0
- package/dist/cjs/DropdownMenu/index.native.js.map +1 -1
- package/dist/cjs/appShell/AppShell.cjs +1 -0
- package/dist/cjs/appShell/AppShell.native.js +1 -0
- package/dist/cjs/appShell/AppShell.native.js.map +1 -1
- package/dist/cjs/code/CodeBlock/index.cjs +3 -2
- package/dist/cjs/code/CodeBlock/index.native.js +3 -2
- package/dist/cjs/code/CodeBlock/index.native.js.map +1 -1
- package/dist/cjs/layouts/page.cjs +3 -0
- package/dist/cjs/layouts/page.native.js +3 -0
- package/dist/cjs/layouts/page.native.js.map +1 -1
- package/dist/esm/DropdownMenu/index.mjs +2 -1
- package/dist/esm/DropdownMenu/index.mjs.map +1 -1
- package/dist/esm/DropdownMenu/index.native.js +4 -1
- package/dist/esm/DropdownMenu/index.native.js.map +1 -1
- package/dist/esm/appShell/AppShell.mjs +1 -0
- package/dist/esm/appShell/AppShell.mjs.map +1 -1
- package/dist/esm/appShell/AppShell.native.js +1 -0
- package/dist/esm/appShell/AppShell.native.js.map +1 -1
- package/dist/esm/code/CodeBlock/index.mjs +4 -3
- package/dist/esm/code/CodeBlock/index.mjs.map +1 -1
- package/dist/esm/code/CodeBlock/index.native.js +4 -3
- package/dist/esm/code/CodeBlock/index.native.js.map +1 -1
- package/dist/esm/layouts/page.mjs +3 -0
- package/dist/esm/layouts/page.mjs.map +1 -1
- package/dist/esm/layouts/page.native.js +3 -0
- package/dist/esm/layouts/page.native.js.map +1 -1
- package/dist/jsx/DropdownMenu/index.mjs +2 -1
- package/dist/jsx/DropdownMenu/index.mjs.map +1 -1
- package/dist/jsx/DropdownMenu/index.native.js +3 -0
- package/dist/jsx/DropdownMenu/index.native.js.map +1 -1
- package/dist/jsx/appShell/AppShell.mjs +1 -0
- package/dist/jsx/appShell/AppShell.mjs.map +1 -1
- package/dist/jsx/appShell/AppShell.native.js +1 -0
- package/dist/jsx/appShell/AppShell.native.js.map +1 -1
- package/dist/jsx/code/CodeBlock/index.mjs +4 -3
- package/dist/jsx/code/CodeBlock/index.mjs.map +1 -1
- package/dist/jsx/code/CodeBlock/index.native.js +3 -2
- package/dist/jsx/code/CodeBlock/index.native.js.map +1 -1
- package/dist/jsx/layouts/page.mjs +3 -0
- package/dist/jsx/layouts/page.mjs.map +1 -1
- package/dist/jsx/layouts/page.native.js +3 -0
- package/dist/jsx/layouts/page.native.js.map +1 -1
- package/package.json +9 -9
- package/src/DropdownMenu/DropdownMenu.avatarTrigger.spec.tsx +51 -0
- package/src/DropdownMenu/index.tsx +6 -3
- package/src/appShell/AppShell.tsx +1 -1
- package/src/code/CodeBlock/CodeBlock.copy.spec.tsx +47 -1
- package/src/code/CodeBlock/index.tsx +6 -2
- package/src/layouts/page.tsx +3 -3
- package/src/layouts/topBarConfirm.spec.tsx +71 -0
- package/src/schemeFlipKnobs.native-press.spec.tsx +125 -0
- package/types/DropdownMenu/index.d.ts +2 -2
- package/types/DropdownMenu/index.d.ts.map +1 -1
- package/types/code/CodeBlock/index.d.ts.map +1 -1
|
@@ -9,6 +9,7 @@ import { waitFor } from "@testing-library/react";
|
|
|
9
9
|
import { describe, expect, it } from "vitest";
|
|
10
10
|
import { ListItem, Text, XStack } from "tamagui";
|
|
11
11
|
import { Avatar } from "../Avatar";
|
|
12
|
+
import { MENU_MIN_WIDTH } from "@multiplatform.one/forms";
|
|
12
13
|
import { DropdownMenu, isIconTrigger } from "./index";
|
|
13
14
|
|
|
14
15
|
const avatarInPressBox = (
|
|
@@ -91,4 +92,54 @@ describe("DropdownMenu avatar trigger (FZ-8220)", () => {
|
|
|
91
92
|
});
|
|
92
93
|
}
|
|
93
94
|
});
|
|
95
|
+
|
|
96
|
+
it.each([1024, 390])(
|
|
97
|
+
"opens at the 250 pt pull-down floor on the web at %ipx, not as narrow as its rows (FZ-8910)",
|
|
98
|
+
async (viewport) => {
|
|
99
|
+
const width = window.innerWidth;
|
|
100
|
+
Object.defineProperty(window, "innerWidth", {
|
|
101
|
+
configurable: true,
|
|
102
|
+
writable: true,
|
|
103
|
+
value: viewport,
|
|
104
|
+
});
|
|
105
|
+
try {
|
|
106
|
+
renderWithProviders(
|
|
107
|
+
<DropdownMenu defaultOpen placement="bottom-end">
|
|
108
|
+
<DropdownMenu.Trigger>{avatarInPressBox}</DropdownMenu.Trigger>
|
|
109
|
+
<DropdownMenu.Content aria-label="Account">
|
|
110
|
+
<DropdownMenu.Item>Sign out</DropdownMenu.Item>
|
|
111
|
+
</DropdownMenu.Content>
|
|
112
|
+
</DropdownMenu>,
|
|
113
|
+
);
|
|
114
|
+
await waitFor(() => {
|
|
115
|
+
const panel = document.querySelector<HTMLElement>(
|
|
116
|
+
'[data-testid="floating-panel-viewport"]',
|
|
117
|
+
);
|
|
118
|
+
expect(panel?.querySelector('[role="menu"]')).toBeTruthy();
|
|
119
|
+
expect(panel?.style.minWidth).toBe(`${MENU_MIN_WIDTH}px`);
|
|
120
|
+
});
|
|
121
|
+
} finally {
|
|
122
|
+
Object.defineProperty(window, "innerWidth", {
|
|
123
|
+
configurable: true,
|
|
124
|
+
writable: true,
|
|
125
|
+
value: width,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
it("holds the floor under a narrower content cap, so the rows fill the panel", async () => {
|
|
132
|
+
renderWithProviders(
|
|
133
|
+
<DropdownMenu defaultOpen>
|
|
134
|
+
<DropdownMenu.Trigger>{avatarInPressBox}</DropdownMenu.Trigger>
|
|
135
|
+
<DropdownMenu.Content aria-label="Account" maxWidth={240}>
|
|
136
|
+
<DropdownMenu.Item>Sign out</DropdownMenu.Item>
|
|
137
|
+
</DropdownMenu.Content>
|
|
138
|
+
</DropdownMenu>,
|
|
139
|
+
);
|
|
140
|
+
await waitFor(() => {
|
|
141
|
+
const panel = document.querySelector<HTMLElement>('[data-testid="floating-panel-viewport"]');
|
|
142
|
+
expect(panel?.style.minWidth).toBe("240px");
|
|
143
|
+
});
|
|
144
|
+
});
|
|
94
145
|
});
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
type RefObject,
|
|
54
54
|
} from "react";
|
|
55
55
|
|
|
56
|
-
import { FloatingPanel, type PanelWidth } from "@multiplatform.one/forms";
|
|
56
|
+
import { FloatingPanel, MENU_MIN_WIDTH, type PanelWidth } from "@multiplatform.one/forms";
|
|
57
57
|
import type { GetProps, SizeTokens, TamaguiElement } from "tamagui";
|
|
58
58
|
import {
|
|
59
59
|
Text,
|
|
@@ -167,8 +167,8 @@ export interface DropdownMenuProps {
|
|
|
167
167
|
/**
|
|
168
168
|
* How wide the menu opens over its trigger (LC-112, FZ-8438 r3):
|
|
169
169
|
* `"content"`, `"trigger"`, `"screen"` or a fixed width. Unset keeps the
|
|
170
|
-
* default: at least the trigger
|
|
171
|
-
* native.
|
|
170
|
+
* default: at least the trigger and the 250pt pull-down floor
|
|
171
|
+
* (`MENU_MIN_WIDTH`), on the web and native.
|
|
172
172
|
*/
|
|
173
173
|
panelWidth?: PanelWidth;
|
|
174
174
|
}
|
|
@@ -463,6 +463,9 @@ function DropdownMenuRoot({
|
|
|
463
463
|
contentPadding="none"
|
|
464
464
|
triggerSizing={triggerSizing}
|
|
465
465
|
panelWidth={panelWidth}
|
|
466
|
+
// FZ-8910: the web takes native's pull-down floor (FZ-8220), so an
|
|
467
|
+
// avatar's menu doesn't hug its rows, held under a content cap.
|
|
468
|
+
floor={Math.min(MENU_MIN_WIDTH, contentMaxWidth ?? MENU_MIN_WIDTH)}
|
|
466
469
|
// FZ-7830, LC-112: a menu is a menu over its trigger on native, the
|
|
467
470
|
// UIMenu pull-down, never a bottom sheet. The phone-width web keeps
|
|
468
471
|
// its sheet at page level and opens the menu inside an overlay, so a
|
|
@@ -179,7 +179,7 @@ function AppShellNavBar({ maxWidth, leading, trailing, title, showTitle, scrolle
|
|
|
179
179
|
const motion = transitionProps(knobProps.motion.control);
|
|
180
180
|
const clearance = Math.max(sides.leading, sides.trailing);
|
|
181
181
|
return (
|
|
182
|
-
<Surface bar>
|
|
182
|
+
<Surface bar topBar>
|
|
183
183
|
<YStack
|
|
184
184
|
role="banner"
|
|
185
185
|
data-testid="app-shell-bar"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { fireEvent } from "@testing-library/react";
|
|
2
2
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
3
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
4
|
-
import { Preset } from "@multiplatform.one/theme";
|
|
4
|
+
import { Preset, useGlyphTintOnSurface } from "@multiplatform.one/theme";
|
|
5
|
+
import type { ReactNode } from "react";
|
|
6
|
+
import { Theme } from "tamagui";
|
|
5
7
|
import { getToasts, resetToasts } from "../../Toast/store";
|
|
6
8
|
import { getFeedback, resetFeedback } from "../../feedback/store";
|
|
7
9
|
import { CodeBlock } from "./index";
|
|
@@ -142,3 +144,47 @@ describe("CodeBlock copy (Input.Button + notify)", () => {
|
|
|
142
144
|
expect(getToasts()).toHaveLength(1);
|
|
143
145
|
});
|
|
144
146
|
});
|
|
147
|
+
|
|
148
|
+
function TintProbe({ onTint }: { onTint: (glyph: string) => void }) {
|
|
149
|
+
onTint(useGlyphTintOnSurface().glyph);
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
describe("CodeBlock copy takes the icon-button tint (LC-176, LC-267, FZ-8990)", () => {
|
|
154
|
+
const scopes: Array<[string, (child: ReactNode) => ReactNode]> = [];
|
|
155
|
+
for (const scheme of ["light", "dark"] as const) {
|
|
156
|
+
scopes.push([scheme, (child) => <Theme name={scheme}>{child}</Theme>]);
|
|
157
|
+
for (const hue of ["blue", "purple"] as const) {
|
|
158
|
+
scopes.push([
|
|
159
|
+
`${scheme}_${hue}`,
|
|
160
|
+
(child) => (
|
|
161
|
+
<Theme name={scheme}>
|
|
162
|
+
<Theme name={hue}>{child}</Theme>
|
|
163
|
+
</Theme>
|
|
164
|
+
),
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
it.each(scopes)(
|
|
170
|
+
"%s: the copy glyph paints the same ink as an inline identifier copy",
|
|
171
|
+
(_name, wrap) => {
|
|
172
|
+
let tint = "";
|
|
173
|
+
const result = renderWithProviders(
|
|
174
|
+
<>
|
|
175
|
+
{wrap(
|
|
176
|
+
<>
|
|
177
|
+
<TintProbe onTint={(glyph) => (tint = glyph)} />
|
|
178
|
+
<CodeBlock language="sh">shc node join</CodeBlock>
|
|
179
|
+
</>,
|
|
180
|
+
)}
|
|
181
|
+
</>,
|
|
182
|
+
);
|
|
183
|
+
const svg = copyOf(result.container)?.querySelector("svg");
|
|
184
|
+
if (!svg) throw new Error("copy glyph missing");
|
|
185
|
+
const paint = svg.getAttribute("fill") ?? svg.getAttribute("color") ?? "";
|
|
186
|
+
expect(tint).toBeTruthy();
|
|
187
|
+
expect(paint.toLowerCase()).toBe(tint.toLowerCase());
|
|
188
|
+
},
|
|
189
|
+
);
|
|
190
|
+
});
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
useTouchSurface,
|
|
14
14
|
pressTargetHitSlop,
|
|
15
15
|
sizeRecipeForToken,
|
|
16
|
+
useGlyphTintOnSurface,
|
|
16
17
|
useResolvedKnobs,
|
|
17
18
|
transitionProps,
|
|
18
19
|
} from "@multiplatform.one/theme";
|
|
@@ -77,6 +78,9 @@ export function CodeBlock({
|
|
|
77
78
|
const { region, copy } = useCopyFeedback();
|
|
78
79
|
const { t } = useTranslation();
|
|
79
80
|
const { knobProps } = useResolvedKnobs();
|
|
81
|
+
// LC-176, LC-267 (FZ-8990): the copy is the inline identifier copy's glyph,
|
|
82
|
+
// in the icon-button tint, not the code's text ink.
|
|
83
|
+
const copyInk = useGlyphTintOnSurface().glyph;
|
|
80
84
|
const touch = useTouchSurface();
|
|
81
85
|
// Content type scale follows the size token (T-VALUE via sizeToken, LC-18);
|
|
82
86
|
// an explicit size prop ejects.
|
|
@@ -205,7 +209,7 @@ export function CodeBlock({
|
|
|
205
209
|
<Input.Button
|
|
206
210
|
glyphRing
|
|
207
211
|
size={codeSize}
|
|
208
|
-
color={
|
|
212
|
+
color={copyInk}
|
|
209
213
|
type="button"
|
|
210
214
|
aria-label="Copy to clipboard"
|
|
211
215
|
data-press-min={MIN_PRESS_TARGET}
|
|
@@ -221,7 +225,7 @@ export function CodeBlock({
|
|
|
221
225
|
}) as unknown as () => void
|
|
222
226
|
}
|
|
223
227
|
>
|
|
224
|
-
<Input.Icon aria-hidden color={
|
|
228
|
+
<Input.Icon aria-hidden color={copyInk}>
|
|
225
229
|
<CopyIcon weight="bold" />
|
|
226
230
|
</Input.Icon>
|
|
227
231
|
</Input.Button>
|
package/src/layouts/page.tsx
CHANGED
|
@@ -566,7 +566,7 @@ export function PageHeader({
|
|
|
566
566
|
data-page-header-actions=""
|
|
567
567
|
>
|
|
568
568
|
{/* LC-153: page-head actions are a bar; neutral buttons go plain. */}
|
|
569
|
-
<Surface bar>
|
|
569
|
+
<Surface bar topBar>
|
|
570
570
|
<IconButtonGroup {...knobProps.gap} justifyContent="flex-end">
|
|
571
571
|
{actions}
|
|
572
572
|
</IconButtonGroup>
|
|
@@ -818,7 +818,7 @@ function InlineToolbar({ leading, trailing, title, children, ...rest }: ScreenTo
|
|
|
818
818
|
const titleRole = pushedTitle ? pageTitleRole : null;
|
|
819
819
|
// LC-153: the toolbar is a bar, so its neutral buttons paint plain.
|
|
820
820
|
return (
|
|
821
|
-
<Surface bar>
|
|
821
|
+
<Surface bar topBar>
|
|
822
822
|
<XStack
|
|
823
823
|
data-testid="screen-toolbar"
|
|
824
824
|
justifyContent="space-between"
|
|
@@ -894,7 +894,7 @@ function PinnedTopBar({
|
|
|
894
894
|
const titleRole = pushedTitle ? pageTitleRole : null;
|
|
895
895
|
// LC-153: the pinned bar is a bar, so its neutral buttons paint plain.
|
|
896
896
|
return (
|
|
897
|
-
<Surface bar>
|
|
897
|
+
<Surface bar topBar>
|
|
898
898
|
<YStack
|
|
899
899
|
data-testid="screen-toolbar"
|
|
900
900
|
data-top-bar=""
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vitest-environment jsdom
|
|
3
|
+
*
|
|
4
|
+
* LC-176 / LC-260 (FZ-8989, round 62): the filled ✓ is an overlay's one
|
|
5
|
+
* confirm. A page's top bar draws its lifecycle confirm (a record's Save) as a
|
|
6
|
+
* bar glyph beside back and "…", never as a filled accent disc. A sheet's own
|
|
7
|
+
* header keeps its ✓ plate (FZ-8439) even when the sheet mounts inside a page
|
|
8
|
+
* bar's subtree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
12
|
+
import { Surface } from "@multiplatform.one/theme";
|
|
13
|
+
import { cleanup, screen } from "@testing-library/react";
|
|
14
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
15
|
+
import { ActionButton, OverlayHeader } from "../actions/StandardAction";
|
|
16
|
+
import { SheetHeader } from "../SheetModal/SheetHeader";
|
|
17
|
+
import { PageBackButton, PageHeader, ScreenToolbar } from "./page";
|
|
18
|
+
import { DetailPageLayout } from "./PageTemplates";
|
|
19
|
+
|
|
20
|
+
afterEach(cleanup);
|
|
21
|
+
|
|
22
|
+
function expectBarGlyph(name: string) {
|
|
23
|
+
const save = screen.getByRole("button", { name });
|
|
24
|
+
const face = save.getAttribute("data-mp-icon-button");
|
|
25
|
+
expect(face, `${name} in a top bar`).not.toBe("primary");
|
|
26
|
+
expect(["glyph", "glass"]).toContain(face);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe("a top bar's confirm is a bar glyph (LC-176, FZ-8989)", () => {
|
|
30
|
+
it("DetailPageLayout's Save beside back and … is not the filled ✓", () => {
|
|
31
|
+
renderWithProviders(
|
|
32
|
+
<DetailPageLayout
|
|
33
|
+
header={<PageHeader title="Caterpie" />}
|
|
34
|
+
toolbarLeading={<PageBackButton label="Pokemon" />}
|
|
35
|
+
toolbarTrailing={<ActionButton kind="save" />}
|
|
36
|
+
>
|
|
37
|
+
{null}
|
|
38
|
+
</DetailPageLayout>,
|
|
39
|
+
);
|
|
40
|
+
expectBarGlyph("Save");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("an inline ScreenToolbar's Save is not the filled ✓", () => {
|
|
44
|
+
renderWithProviders(<ScreenToolbar title="Todo" trailing={<ActionButton kind="save" />} />);
|
|
45
|
+
expectBarGlyph("Save");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("a PageHeader action's Done is not the filled ✓", () => {
|
|
49
|
+
renderWithProviders(<PageHeader title="Todo" actions={<ActionButton kind="done" />} />);
|
|
50
|
+
expectBarGlyph("Done");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("a sheet header's ✓ keeps its plate inside a top bar's subtree (FZ-8439)", () => {
|
|
54
|
+
renderWithProviders(
|
|
55
|
+
<Surface bar topBar>
|
|
56
|
+
<SheetHeader
|
|
57
|
+
header={<OverlayHeader title="Move" onClose={() => {}} onConfirm={() => {}} />}
|
|
58
|
+
/>
|
|
59
|
+
</Surface>,
|
|
60
|
+
);
|
|
61
|
+
const confirm = screen.getByRole("button", { name: "Done" });
|
|
62
|
+
expect(confirm.getAttribute("data-mp-icon-button")).toBe("primary");
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("an overlay's ✓ outside any bar keeps its plate", () => {
|
|
66
|
+
renderWithProviders(<OverlayHeader title="Move" onClose={() => {}} onConfirm={() => {}} />);
|
|
67
|
+
expect(screen.getByRole("button", { name: "Done" }).getAttribute("data-mp-icon-button")).toBe(
|
|
68
|
+
"primary",
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FZ-8425, under tamagui's NATIVE build (vitest.native.config.mjs).
|
|
3
|
+
*
|
|
4
|
+
* An overlay mounted before a light/dark flip resolves the new scheme's
|
|
5
|
+
* `elevatedSurface` on the next paint. On iOS with `fastSchemeChange` a
|
|
6
|
+
* long-lived SheetModal skipped the scheme-only re-render and kept the light
|
|
7
|
+
* branch's `$borderColor` hairline on a forced-dark panel, and the edge it did
|
|
8
|
+
* paint came through DynamicColorIOS, which a border inside an RN Modal
|
|
9
|
+
* resolved against the OS appearance instead of the app's.
|
|
10
|
+
*/
|
|
11
|
+
import {
|
|
12
|
+
createDefaultThemeConfig,
|
|
13
|
+
resolveKnobs,
|
|
14
|
+
defaultKnobs,
|
|
15
|
+
useResolvedKnobs,
|
|
16
|
+
} from "@multiplatform.one/theme";
|
|
17
|
+
import { act, cleanup, render, screen } from "@testing-library/react";
|
|
18
|
+
import { memo, type ReactElement } from "react";
|
|
19
|
+
import { TamaguiProvider, Text, isWeb } from "tamagui";
|
|
20
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
21
|
+
|
|
22
|
+
const config = createDefaultThemeConfig();
|
|
23
|
+
type Scheme = "light" | "dark";
|
|
24
|
+
|
|
25
|
+
afterEach(cleanup);
|
|
26
|
+
|
|
27
|
+
const settle = () =>
|
|
28
|
+
act(async () => {
|
|
29
|
+
await new Promise((done) => setTimeout(done, 50));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const OverlayProbe = memo(function OverlayProbe() {
|
|
33
|
+
const { knobProps } = useResolvedKnobs({ painted: false });
|
|
34
|
+
const surface = knobProps.elevatedSurface;
|
|
35
|
+
return (
|
|
36
|
+
<Text testID="probe">
|
|
37
|
+
{JSON.stringify({
|
|
38
|
+
backgroundColor: surface.backgroundColor,
|
|
39
|
+
borderColor: surface.borderColor,
|
|
40
|
+
borderWidth: surface.borderWidth,
|
|
41
|
+
})}
|
|
42
|
+
</Text>
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
function Themed({ scheme, children }: { scheme: Scheme; children: ReactElement }) {
|
|
47
|
+
return (
|
|
48
|
+
<TamaguiProvider config={config.tamagui} defaultTheme={scheme} disableInjectCSS>
|
|
49
|
+
{children}
|
|
50
|
+
</TamaguiProvider>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const probe = (): Record<string, unknown> =>
|
|
55
|
+
JSON.parse(screen.getByTestId("probe").textContent ?? "{}") as Record<string, unknown>;
|
|
56
|
+
|
|
57
|
+
function expected(scheme: Scheme) {
|
|
58
|
+
const surface = resolveKnobs(defaultKnobs, undefined, scheme, { painted: false }).knobProps
|
|
59
|
+
.elevatedSurface;
|
|
60
|
+
return JSON.parse(
|
|
61
|
+
JSON.stringify({
|
|
62
|
+
backgroundColor: surface.backgroundColor,
|
|
63
|
+
borderColor: surface.borderColor,
|
|
64
|
+
borderWidth: surface.borderWidth,
|
|
65
|
+
}),
|
|
66
|
+
) as Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
describe("the native harness", () => {
|
|
70
|
+
it("runs tamagui's native build", () => {
|
|
71
|
+
expect(isWeb).toBe(false);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("a scheme-only change after mount (FZ-8425)", () => {
|
|
76
|
+
it("keeps tamagui from skipping the scheme re-render or painting DynamicColorIOS", () => {
|
|
77
|
+
expect(config.tamagui.settings.fastSchemeChange).toBe(false);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("the two schemes resolve different overlay frames", () => {
|
|
81
|
+
expect(expected("dark")).not.toEqual(expected("light"));
|
|
82
|
+
expect(expected("dark").borderWidth).toBe(0);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it.each([
|
|
86
|
+
["light", "dark"],
|
|
87
|
+
["dark", "light"],
|
|
88
|
+
] as const)(
|
|
89
|
+
"an overlay mounted in %s resolves %s's elevatedSurface after the flip",
|
|
90
|
+
async (from, to) => {
|
|
91
|
+
const view = render(
|
|
92
|
+
<Themed scheme={from}>
|
|
93
|
+
<OverlayProbe />
|
|
94
|
+
</Themed>,
|
|
95
|
+
);
|
|
96
|
+
await settle();
|
|
97
|
+
expect(probe()).toEqual(expected(from));
|
|
98
|
+
view.rerender(
|
|
99
|
+
<Themed scheme={to}>
|
|
100
|
+
<OverlayProbe />
|
|
101
|
+
</Themed>,
|
|
102
|
+
);
|
|
103
|
+
await settle();
|
|
104
|
+
expect(probe()).toEqual(expected(to));
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
it("follows a flip back and forth without a remount", async () => {
|
|
109
|
+
const view = render(
|
|
110
|
+
<Themed scheme="light">
|
|
111
|
+
<OverlayProbe />
|
|
112
|
+
</Themed>,
|
|
113
|
+
);
|
|
114
|
+
await settle();
|
|
115
|
+
for (const scheme of ["dark", "light", "dark"] as const) {
|
|
116
|
+
view.rerender(
|
|
117
|
+
<Themed scheme={scheme}>
|
|
118
|
+
<OverlayProbe />
|
|
119
|
+
</Themed>,
|
|
120
|
+
);
|
|
121
|
+
await settle();
|
|
122
|
+
expect(probe()).toEqual(expected(scheme));
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -80,8 +80,8 @@ export interface DropdownMenuProps {
|
|
|
80
80
|
/**
|
|
81
81
|
* How wide the menu opens over its trigger (LC-112, FZ-8438 r3):
|
|
82
82
|
* `"content"`, `"trigger"`, `"screen"` or a fixed width. Unset keeps the
|
|
83
|
-
* default: at least the trigger
|
|
84
|
-
* native.
|
|
83
|
+
* default: at least the trigger and the 250pt pull-down floor
|
|
84
|
+
* (`MENU_MIN_WIDTH`), on the web and native.
|
|
85
85
|
*/
|
|
86
86
|
panelWidth?: PanelWidth;
|
|
87
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/index.tsx"],"names":[],"mappings":"AAqCA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IACjB,+EAA+E;IAC/E,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAwBD,MAAM,WAAW,0BAA2B,SAAQ,QAAQ,CAAC,OAAO,aAAa,CAAC;CAAG;AAErF,iBAAS,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,2CAE/D;AAED,MAAM,WAAW,sBAAuB,SAAQ,QAAQ,CAAC,OAAO,IAAI,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,sBAAsB,2CAgBxE;AAID,eAAO,MAAM,YAAY;;;;;;;CAOvB,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code/CodeBlock/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/code/CodeBlock/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA6CH,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qDAAqD;IACrD,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,sCAAsC;IACtC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAa,EACb,QAAgB,EAChB,KAAK,EACL,eAAe,EAAE,mBAAmB,EACpC,cAAmB,EACnB,WAAW,EACX,IAAI,GACL,EAAE,cAAc,2CAmKhB"}
|