@remit/ui 0.0.22 → 0.0.24
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
|
@@ -76,7 +76,7 @@ export const InlineReply: Story = {
|
|
|
76
76
|
|
|
77
77
|
export const MobileSheet: Story = {
|
|
78
78
|
name: "Mobile sheet — Send within viewport",
|
|
79
|
-
|
|
79
|
+
globals: { viewport: { value: "mobile" } },
|
|
80
80
|
render: () => (
|
|
81
81
|
<div className="flex h-[95dvh] w-[390px] flex-col rounded-t-lg border border-line bg-canvas">
|
|
82
82
|
<div className="mx-auto mt-2 mb-1 h-1.5 w-12 rounded-full bg-fg-muted/30" />
|
|
@@ -57,7 +57,6 @@ export const Refreshing: Story = {
|
|
|
57
57
|
export const DesktopNoop: Story = {
|
|
58
58
|
name: "Desktop — gesture inert",
|
|
59
59
|
parameters: {
|
|
60
|
-
viewport: { defaultViewport: "desktop" },
|
|
61
60
|
docs: {
|
|
62
61
|
description: {
|
|
63
62
|
story:
|
|
@@ -65,6 +64,7 @@ export const DesktopNoop: Story = {
|
|
|
65
64
|
},
|
|
66
65
|
},
|
|
67
66
|
},
|
|
67
|
+
globals: { viewport: { value: "desktop" } },
|
|
68
68
|
args: {
|
|
69
69
|
onRefresh: () => Promise.resolve(),
|
|
70
70
|
},
|
|
@@ -286,7 +286,7 @@ export function SwipeableRow({
|
|
|
286
286
|
e.stopPropagation();
|
|
287
287
|
onLongPress();
|
|
288
288
|
}}
|
|
289
|
-
className="inline-flex size-
|
|
289
|
+
className="-m-2 inline-flex size-11 shrink-0 items-center justify-center rounded-full"
|
|
290
290
|
>
|
|
291
291
|
<Avatar name={thread.fromName} email={thread.fromEmail} size="sm" />
|
|
292
292
|
</button>
|
|
@@ -98,16 +98,6 @@ export const ServerFieldsStory: Story = {
|
|
|
98
98
|
/** Phone width: the grid stacks so the Security select stays reachable (#780). */
|
|
99
99
|
export const ServerFieldsPhone: Story = {
|
|
100
100
|
name: "ServerFields — phone",
|
|
101
|
-
|
|
102
|
-
viewport: {
|
|
103
|
-
options: {
|
|
104
|
-
phone390: {
|
|
105
|
-
name: "Phone 390",
|
|
106
|
-
styles: { width: "390px", height: "844px" },
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
defaultViewport: "phone390",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
101
|
+
globals: { viewport: { value: "mobile" } },
|
|
112
102
|
render: () => <ServerFieldsDemo />,
|
|
113
103
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, relative, resolve } from "node:path";
|
|
4
|
+
import { describe, it } from "node:test";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Storybook 9 dropped `parameters.viewport.defaultViewport` (the Storybook
|
|
9
|
+
* 6/7 API) — it is silently ignored, so a story written against it renders
|
|
10
|
+
* full width instead of the intended breakpoint. The replacement is a
|
|
11
|
+
* per-story viewport global: `globals: { viewport: { value: "mobile" } }`
|
|
12
|
+
* (#67, #68).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
|
|
17
|
+
const storyFiles = (root: string): string[] => {
|
|
18
|
+
const found: string[] = [];
|
|
19
|
+
const walk = (dir: string): void => {
|
|
20
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
21
|
+
if (entry.isDirectory() && entry.name !== "node_modules") {
|
|
22
|
+
walk(resolve(dir, entry.name));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (entry.isFile() && entry.name.endsWith(".stories.tsx")) {
|
|
26
|
+
found.push(resolve(dir, entry.name));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
walk(root);
|
|
31
|
+
return found;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
describe("story files use the viewport globals pattern (#68)", () => {
|
|
35
|
+
const roots = [here, resolve(here, "../../workbench/src")];
|
|
36
|
+
|
|
37
|
+
it("scans at least one story file", () => {
|
|
38
|
+
const files = roots.flatMap((root) => storyFiles(root));
|
|
39
|
+
assert.ok(files.length > 0);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("never references parameters.viewport.defaultViewport", () => {
|
|
43
|
+
const offenders = roots
|
|
44
|
+
.flatMap((root) => storyFiles(root))
|
|
45
|
+
.filter((file) => readFileSync(file, "utf8").includes("defaultViewport"))
|
|
46
|
+
.map((file) => relative(here, file));
|
|
47
|
+
assert.deepEqual(offenders, []);
|
|
48
|
+
});
|
|
49
|
+
});
|