@multiplatform.one/components 7.84.7 → 7.85.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.
- 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/appShell/TabBar.cjs +44 -33
- package/dist/cjs/appShell/TabBar.native.js +48 -37
- package/dist/cjs/appShell/TabBar.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/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/appShell/TabBar.mjs +44 -33
- package/dist/esm/appShell/TabBar.mjs.map +1 -1
- package/dist/esm/appShell/TabBar.native.js +48 -37
- package/dist/esm/appShell/TabBar.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/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/appShell/TabBar.mjs +44 -33
- package/dist/jsx/appShell/TabBar.mjs.map +1 -1
- package/dist/jsx/appShell/TabBar.native.js +48 -37
- package/dist/jsx/appShell/TabBar.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/appShell/AppShell.spec.tsx +3 -2
- package/src/appShell/AppShell.tsx +1 -1
- package/src/appShell/TabBar.spec.tsx +24 -8
- package/src/appShell/TabBar.tsx +43 -35
- 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/appShell/TabBar.d.ts +1 -1
- package/types/appShell/TabBar.d.ts.map +1 -1
- package/types/code/CodeBlock/index.d.ts.map +1 -1
|
@@ -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
|
+
});
|
|
@@ -30,7 +30,7 @@ export interface TabBarProps {
|
|
|
30
30
|
activeKey?: string;
|
|
31
31
|
onTabPress?: (key: string) => void;
|
|
32
32
|
/**
|
|
33
|
-
* The bottom accessory (LC-174):
|
|
33
|
+
* The bottom accessory (LC-174): a flat strip docked under the bar. A
|
|
34
34
|
* page's `BottomAccessory` lands here when this prop is unset.
|
|
35
35
|
*/
|
|
36
36
|
accessory?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/appShell/TabBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/appShell/TabBar.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAUxD,wEAAwE;AACxE,MAAM,MAAM,UAAU,GAAG,aAAa,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC7B,CAAC,CAAC;AAEH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;IAWxB,oEAAoE;;;;CAI5D,CAAC;AAEX,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,QAKD,CAAC;AAEhC,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAC9C,eAAO,MAAM,cAAc,WAAwB,CAAC;AA0EpD,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,SAAS,EACT,UAAU,EACV,SAAS,EAAE,YAAY,EACvB,QAAe,EACf,KAAc,EACd,MAAkB,GACnB,EAAE,WAAW,2CAwFb"}
|
|
@@ -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"}
|