@multiplatform.one/components 7.54.0 → 7.54.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/components",
|
|
3
|
-
"version": "7.54.
|
|
3
|
+
"version": "7.54.1",
|
|
4
4
|
"description": "multiplatform.one ui components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"components",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@floating-ui/react": "^0.27.20",
|
|
61
|
-
"@multiplatform.one/forms": "^7.54.
|
|
62
|
-
"@multiplatform.one/i18n": "^7.54.
|
|
63
|
-
"@multiplatform.one/platform": "^7.54.
|
|
64
|
-
"@multiplatform.one/router": "^7.54.
|
|
65
|
-
"@multiplatform.one/theme": "^7.54.
|
|
61
|
+
"@multiplatform.one/forms": "^7.54.1",
|
|
62
|
+
"@multiplatform.one/i18n": "^7.54.1",
|
|
63
|
+
"@multiplatform.one/platform": "^7.54.1",
|
|
64
|
+
"@multiplatform.one/router": "^7.54.1",
|
|
65
|
+
"@multiplatform.one/theme": "^7.54.1",
|
|
66
66
|
"@phosphor-icons/react": "^2.1.10",
|
|
67
67
|
"@shopify/flash-list": "^2.3.1",
|
|
68
68
|
"@tamagui/colors": "2.7.6",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"tamagui": "2.7.6"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@multiplatform.one/config": "7.54.
|
|
93
|
-
"@multiplatform.one/storybook": "7.54.
|
|
94
|
-
"@multiplatform.one/test-utils": "7.54.
|
|
92
|
+
"@multiplatform.one/config": "7.54.1",
|
|
93
|
+
"@multiplatform.one/storybook": "7.54.1",
|
|
94
|
+
"@multiplatform.one/test-utils": "7.54.1",
|
|
95
95
|
"@tamagui/build": "2.7.6",
|
|
96
96
|
"@testing-library/jest-dom": "^7.0.1",
|
|
97
97
|
"@testing-library/react": "^16.3.3",
|
package/src/Text.native.spec.tsx
CHANGED
|
@@ -10,7 +10,7 @@ import { createTamagui, TamaguiProvider } from "tamagui";
|
|
|
10
10
|
*/
|
|
11
11
|
import { cleanup, screen } from "@testing-library/react";
|
|
12
12
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
13
|
-
import { Preset } from "@multiplatform.one/theme";
|
|
13
|
+
import { createDefaultThemeConfig, Preset } from "@multiplatform.one/theme";
|
|
14
14
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
15
15
|
import { Paragraph, SizableText, Text } from "./Text";
|
|
16
16
|
|
|
@@ -20,9 +20,13 @@ vi.mock("@multiplatform.one/platform", async (importOriginal) => ({
|
|
|
20
20
|
isNative: true,
|
|
21
21
|
}));
|
|
22
22
|
|
|
23
|
+
// LC-152: the dim textAccent stops paint MPO's secondary ink, `$textMuted`,
|
|
24
|
+
// a key only MPO's themes define. Under the stock themes tamagui drops it to
|
|
25
|
+
// `$color`, and every stop would read as the primary ink.
|
|
23
26
|
const bodyConfig = createTamagui({
|
|
24
27
|
...configWithoutAnimations,
|
|
25
28
|
animations: animationsCSS,
|
|
29
|
+
themes: createDefaultThemeConfig({}).tamagui.themes,
|
|
26
30
|
fonts: { ...configWithoutAnimations.fonts, body: defaultConfig.fonts.body },
|
|
27
31
|
});
|
|
28
32
|
|
|
@@ -62,7 +66,7 @@ describe("house Text — NATIVE environment (isWeb false)", () => {
|
|
|
62
66
|
expect(platform.isNative).toBe(true);
|
|
63
67
|
});
|
|
64
68
|
|
|
65
|
-
it("changes colour on a textAccent flip", () => {
|
|
69
|
+
it("changes colour on a textAccent flip: high the primary ink, low the secondary (LC-152)", () => {
|
|
66
70
|
const high = renderTextClasses(
|
|
67
71
|
<Preset overrides={{ textAccent: "high" }}>
|
|
68
72
|
<Text>{LABEL}</Text>
|
|
@@ -77,6 +81,8 @@ describe("house Text — NATIVE environment (isWeb false)", () => {
|
|
|
77
81
|
);
|
|
78
82
|
expect(high).not.toHaveLength(0);
|
|
79
83
|
expect(high).not.toEqual(low);
|
|
84
|
+
expect(high).toEqual(["_col-color"]);
|
|
85
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
80
86
|
});
|
|
81
87
|
|
|
82
88
|
it("changes weight on a fontWeight flip, pinned to the 400/700 label law", () => {
|
|
@@ -122,7 +128,7 @@ describe("house Text — NATIVE environment (isWeb false)", () => {
|
|
|
122
128
|
expect(mono).toBe("font_mono");
|
|
123
129
|
});
|
|
124
130
|
|
|
125
|
-
it("carries the same knobs on the sibling body voices", () => {
|
|
131
|
+
it("carries the same knobs on the sibling body voices (LC-152 secondary ink at low)", () => {
|
|
126
132
|
for (const Voice of [SizableText, Paragraph]) {
|
|
127
133
|
const high = renderTextClasses(
|
|
128
134
|
<Preset overrides={{ textAccent: "high" }}>
|
|
@@ -138,6 +144,8 @@ describe("house Text — NATIVE environment (isWeb false)", () => {
|
|
|
138
144
|
);
|
|
139
145
|
expect(high).not.toHaveLength(0);
|
|
140
146
|
expect(high).not.toEqual(low);
|
|
147
|
+
expect(high).toEqual(["_col-color"]);
|
|
148
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
141
149
|
}
|
|
142
150
|
});
|
|
143
151
|
|
package/src/Text.spec.tsx
CHANGED
|
@@ -25,14 +25,18 @@ import { createTamagui, TamaguiProvider } from "tamagui";
|
|
|
25
25
|
*/
|
|
26
26
|
import { cleanup, screen } from "@testing-library/react";
|
|
27
27
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
28
|
-
import { Preset, useAccentOnSurface } from "@multiplatform.one/theme";
|
|
28
|
+
import { createDefaultThemeConfig, Preset, useAccentOnSurface } from "@multiplatform.one/theme";
|
|
29
29
|
import { XStack } from "tamagui";
|
|
30
30
|
import { afterEach, describe, expect, it } from "vitest";
|
|
31
31
|
import { Anchor, Paragraph, Text } from "./Text";
|
|
32
32
|
|
|
33
|
+
// LC-152: the dim textAccent stops paint MPO's secondary ink, `$textMuted`,
|
|
34
|
+
// a key only MPO's themes define. Under the stock themes tamagui drops it to
|
|
35
|
+
// `$color`, and every stop would read as the primary ink.
|
|
33
36
|
const bodyConfig = createTamagui({
|
|
34
37
|
...configWithoutAnimations,
|
|
35
38
|
animations: animationsCSS,
|
|
39
|
+
themes: createDefaultThemeConfig({}).tamagui.themes,
|
|
36
40
|
fonts: { ...configWithoutAnimations.fonts, body: defaultConfig.fonts.body },
|
|
37
41
|
});
|
|
38
42
|
|
|
@@ -66,7 +70,7 @@ function renderTextClasses(node: React.ReactElement, prefixes: string[]): string
|
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
describe("house Text — textAccent reaches the text node (MPO-20)", () => {
|
|
69
|
-
it("changes colour on a textAccent flip", () => {
|
|
73
|
+
it("changes colour on a textAccent flip: high the primary ink, low the secondary (LC-152)", () => {
|
|
70
74
|
const high = renderTextClasses(
|
|
71
75
|
<Preset overrides={{ textAccent: "high" }}>
|
|
72
76
|
<Text>{LABEL}</Text>
|
|
@@ -82,9 +86,11 @@ describe("house Text — textAccent reaches the text node (MPO-20)", () => {
|
|
|
82
86
|
expect(high).not.toHaveLength(0);
|
|
83
87
|
expect(low).not.toHaveLength(0);
|
|
84
88
|
expect(high).not.toEqual(low);
|
|
89
|
+
expect(high).toEqual(["_col-color"]);
|
|
90
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
85
91
|
});
|
|
86
92
|
|
|
87
|
-
it("low and medium share the
|
|
93
|
+
it("low and medium share the secondary ink ($textMuted, LC-152)", () => {
|
|
88
94
|
const low = renderTextClasses(
|
|
89
95
|
<Preset overrides={{ textAccent: "low" }}>
|
|
90
96
|
<Text>{LABEL}</Text>
|
|
@@ -98,6 +104,7 @@ describe("house Text — textAccent reaches the text node (MPO-20)", () => {
|
|
|
98
104
|
["_col-"],
|
|
99
105
|
);
|
|
100
106
|
expect(low).toEqual(medium);
|
|
107
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
101
108
|
});
|
|
102
109
|
|
|
103
110
|
it("measures the TEXT NODE, never the frame (MPO-44 discipline)", () => {
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
8
8
|
import {
|
|
9
9
|
Preset,
|
|
10
|
+
createDefaultThemeConfig,
|
|
10
11
|
getActiveScaleTokens,
|
|
11
12
|
normalizeToHex,
|
|
12
13
|
useGlyphColor,
|
|
@@ -28,6 +29,11 @@ import {
|
|
|
28
29
|
tabBarRowHeight,
|
|
29
30
|
} from "./TabBar";
|
|
30
31
|
|
|
32
|
+
// LC-152: the inactive ink is `$textMuted`, a key only MPO's themes define.
|
|
33
|
+
// Under the stock test themes it resolves to the primary ink, so the bar
|
|
34
|
+
// renders under MPO's own config.
|
|
35
|
+
createDefaultThemeConfig({});
|
|
36
|
+
|
|
31
37
|
afterEach(cleanup);
|
|
32
38
|
|
|
33
39
|
function rgbOf(color: string): [number, number, number] {
|
|
@@ -19,6 +19,8 @@ function renderWithProviders(node: ReactElement) {
|
|
|
19
19
|
}
|
|
20
20
|
afterEach(cleanup);
|
|
21
21
|
|
|
22
|
+
// LC-152: moderate is the HIG large-title step, `$9` (30px on web); it
|
|
23
|
+
// replaced LC-17's 40px rider. Display stays `$12` (52px).
|
|
22
24
|
describe("PageHeader rendered Tamagui title recipes", () => {
|
|
23
25
|
for (const scale of ["moderate", "display"] as const) {
|
|
24
26
|
for (const weight of ["regular", "bold"] as const) {
|
|
@@ -29,7 +31,7 @@ describe("PageHeader rendered Tamagui title recipes", () => {
|
|
|
29
31
|
</Preset>,
|
|
30
32
|
);
|
|
31
33
|
const title = screen.getByRole("heading", { name: "Measured title" });
|
|
32
|
-
expect(getComputedStyle(title).fontSize).toBe(scale === "moderate" ? "
|
|
34
|
+
expect(getComputedStyle(title).fontSize).toBe(scale === "moderate" ? "30px" : "52px");
|
|
33
35
|
expect(getComputedStyle(title).fontWeight).toBe(weight === "regular" ? "800" : "700");
|
|
34
36
|
expect(title.tagName).toBe("H1");
|
|
35
37
|
if (weight === "bold") expect(title).toHaveAttribute("data-font-weight-knob", "bold");
|
|
@@ -55,7 +57,7 @@ describe("PageHeader rendered Tamagui title recipes", () => {
|
|
|
55
57
|
</Preset>,
|
|
56
58
|
);
|
|
57
59
|
const title = screen.getByRole("heading", { name: "Nested title" });
|
|
58
|
-
expect(getComputedStyle(title).fontSize).toBe(scale === "moderate" ? "52px" : "
|
|
60
|
+
expect(getComputedStyle(title).fontSize).toBe(scale === "moderate" ? "52px" : "30px");
|
|
59
61
|
expect(getComputedStyle(title).fontWeight).toBe(weight === "regular" ? "800" : "700");
|
|
60
62
|
expect(title.tagName).toBe("H2");
|
|
61
63
|
if (weight === "bold") expect(title).toHaveAttribute("data-font-weight-knob", "bold");
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* The `secondary` / `muted` keys on componentColors' text table were a static
|
|
5
5
|
* `$color11` read straight into the `color` prop, so every helper, caption and
|
|
6
6
|
* inactive label rendered the same ink at `low`, `medium` and `high`. The resolver
|
|
7
|
-
* already answers this: `knobProps.textAccentColor` is `$
|
|
8
|
-
* dim stops (
|
|
7
|
+
* already answers this: `knobProps.textAccentColor` is `$textMuted` at the
|
|
8
|
+
* two dim stops (LC-152's secondary ink, which replaced the `$color11` floor)
|
|
9
|
+
* and `$color` at `high`. Tab labels left this family under LC-152.
|
|
9
10
|
*
|
|
10
11
|
* Measurement follows the Text.spec.tsx discipline: read the TEXT NODE's
|
|
11
12
|
* `_col-` atomic class, compare between knob stops by identity, never against
|
|
@@ -18,7 +19,7 @@
|
|
|
18
19
|
*/
|
|
19
20
|
import { cleanup, screen } from "@testing-library/react";
|
|
20
21
|
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
21
|
-
import { Preset, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
22
|
+
import { createDefaultThemeConfig, Preset, useResolvedKnobs } from "@multiplatform.one/theme";
|
|
22
23
|
import type { ReactElement } from "react";
|
|
23
24
|
import { SizableText, Theme } from "tamagui";
|
|
24
25
|
import { afterEach, describe, expect, it } from "vitest";
|
|
@@ -28,6 +29,11 @@ import { Meter } from "./Meter";
|
|
|
28
29
|
import { Quote } from "./Quote";
|
|
29
30
|
import { Tabs } from "./Tabs";
|
|
30
31
|
|
|
32
|
+
// LC-152: the dim stops paint `$textMuted`, a key only MPO's themes define.
|
|
33
|
+
// Under the stock test themes tamagui drops it to `$color` and every stop
|
|
34
|
+
// reads as the primary ink, so this file renders under MPO's own config.
|
|
35
|
+
createDefaultThemeConfig({});
|
|
36
|
+
|
|
31
37
|
afterEach(cleanup);
|
|
32
38
|
|
|
33
39
|
type Accent = "low" | "medium" | "high";
|
|
@@ -54,7 +60,10 @@ function inkOf(scheme: Scheme, accent: Accent, label: string, node: ReactElement
|
|
|
54
60
|
|
|
55
61
|
const schemes: Scheme[] = ["light", "dark"];
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
// LC-152 replaces MPO-154 for tab labels: an inactive label is the label
|
|
64
|
+
// role's secondary ink at every textAccent stop, so `high` (the Default and
|
|
65
|
+
// Bold presets) no longer paints it as loud as the active one.
|
|
66
|
+
describe("Tabs — the inactive tab label is the secondary ink at every stop (LC-152)", () => {
|
|
58
67
|
const items = [
|
|
59
68
|
{ value: "address", label: "Address & Contact", content: <>address panel</> },
|
|
60
69
|
{ value: "settings", label: "Settings", content: <>settings panel</> },
|
|
@@ -62,15 +71,14 @@ describe("Tabs — textAccent reaches the inactive tab label (MPO-154)", () => {
|
|
|
62
71
|
const tabs = <Tabs items={items} defaultValue="address" />;
|
|
63
72
|
|
|
64
73
|
for (const scheme of schemes) {
|
|
65
|
-
it(`${scheme}: the inactive label
|
|
74
|
+
it(`${scheme}: the inactive label holds $textMuted from low to high`, () => {
|
|
66
75
|
const low = inkOf(scheme, "low", "Settings", tabs);
|
|
67
76
|
const high = inkOf(scheme, "high", "Settings", tabs);
|
|
68
|
-
expect(low).
|
|
69
|
-
expect(high).
|
|
70
|
-
expect(high).not.toEqual(low);
|
|
77
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
78
|
+
expect(high).toEqual(low);
|
|
71
79
|
});
|
|
72
80
|
|
|
73
|
-
it(`${scheme}: the inactive label keeps the
|
|
81
|
+
it(`${scheme}: the inactive label keeps the secondary ink at low and medium`, () => {
|
|
74
82
|
expect(inkOf(scheme, "low", "Settings", tabs)).toEqual(
|
|
75
83
|
inkOf(scheme, "medium", "Settings", tabs),
|
|
76
84
|
);
|
|
@@ -96,9 +104,12 @@ describe("Accordion — textAccent reaches the section description (MPO-154)", (
|
|
|
96
104
|
expect(low).not.toHaveLength(0);
|
|
97
105
|
expect(high).not.toHaveLength(0);
|
|
98
106
|
expect(high).not.toEqual(low);
|
|
107
|
+
// LC-152: low is the secondary ink, high the primary.
|
|
108
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
109
|
+
expect(high).toEqual(["_col-color"]);
|
|
99
110
|
});
|
|
100
111
|
|
|
101
|
-
it(`${scheme}: the description keeps the
|
|
112
|
+
it(`${scheme}: the description keeps the secondary ink at low and medium`, () => {
|
|
102
113
|
expect(inkOf(scheme, "low", description, accordion)).toEqual(
|
|
103
114
|
inkOf(scheme, "medium", description, accordion),
|
|
104
115
|
);
|
|
@@ -129,9 +140,12 @@ describe("Quote — textAccent reaches the attribution (MPO-154)", () => {
|
|
|
129
140
|
expect(low).not.toHaveLength(0);
|
|
130
141
|
expect(high).not.toHaveLength(0);
|
|
131
142
|
expect(high).not.toEqual(low);
|
|
143
|
+
// LC-152: low is the secondary ink, high the primary.
|
|
144
|
+
expect(low).toEqual(["_col-textMuted"]);
|
|
145
|
+
expect(high).toEqual(["_col-color"]);
|
|
132
146
|
});
|
|
133
147
|
|
|
134
|
-
it(`${scheme}: the attribution keeps the
|
|
148
|
+
it(`${scheme}: the attribution keeps the secondary ink at low and medium`, () => {
|
|
135
149
|
expect(citeInk(scheme, "low")).toEqual(citeInk(scheme, "medium"));
|
|
136
150
|
});
|
|
137
151
|
}
|
|
@@ -152,9 +166,9 @@ describe("Meter — textAccent reaches the ok-zone value readout (MPO-154)", ()
|
|
|
152
166
|
}
|
|
153
167
|
|
|
154
168
|
for (const scheme of schemes) {
|
|
155
|
-
it(`${scheme}: the ok value readout rides the resolver, not a static $
|
|
156
|
-
expect(valueInk(scheme, "low")).toBe("$
|
|
157
|
-
expect(valueInk(scheme, "medium")).toBe("$
|
|
169
|
+
it(`${scheme}: the ok value readout rides the resolver, not a static step (LC-152 $textMuted)`, () => {
|
|
170
|
+
expect(valueInk(scheme, "low")).toBe("$textMuted");
|
|
171
|
+
expect(valueInk(scheme, "medium")).toBe("$textMuted");
|
|
158
172
|
expect(valueInk(scheme, "high")).toBe("$color");
|
|
159
173
|
});
|
|
160
174
|
}
|
|
@@ -226,7 +240,7 @@ function againstResolver(
|
|
|
226
240
|
return result;
|
|
227
241
|
}
|
|
228
242
|
|
|
229
|
-
describe("the dim stops paint the resolver's
|
|
243
|
+
describe("the dim stops paint the resolver's secondary ink, not a pinned step (MPO-154, LC-152)", () => {
|
|
230
244
|
const surfaces: Array<[string, ReactElement, (container: HTMLElement) => Element | null]> = [
|
|
231
245
|
[
|
|
232
246
|
"Tabs inactive label",
|
|
@@ -266,7 +280,7 @@ describe("the dim stops paint the resolver's AA floor, not a pinned step (MPO-15
|
|
|
266
280
|
for (const accent of ["low", "medium"] as const) {
|
|
267
281
|
it(`${scheme}: ${name} at ${accent} equals the resolver's textAccentColor`, () => {
|
|
268
282
|
const { surface, resolver, token } = againstResolver(scheme, accent, node, pick);
|
|
269
|
-
expect(token).toBe("$
|
|
283
|
+
expect(token).toBe("$textMuted");
|
|
270
284
|
expect(resolver).toBeDefined();
|
|
271
285
|
expect(surface).toBe(resolver);
|
|
272
286
|
});
|