@gopherium/godmin 0.28.0 → 0.29.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/README.md +11 -1
- package/dist/base.css +24 -48
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/loading.d.ts +1 -10
- package/dist/loading.js +3 -12
- package/docs/design-system/accessibility.md +6 -4
- package/docs/design-system/loading.md +149 -0
- package/docs/design-system/motion.md +23 -37
- package/docs/design-system/overview.md +5 -1
- package/docs/design-system/radius-and-elevation.md +1 -1
- package/docs/design-system/toasts.md +3 -1
- package/docs/framing-an-application.md +1 -1
- package/docs/lists.md +66 -2
- package/docs/loading-and-feedback.md +102 -46
- package/docs/overview.md +1 -1
- package/package.json +13 -2
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ those two lines do for you.
|
|
|
49
49
|
|
|
50
50
|
| Entry point | Contents |
|
|
51
51
|
| --- | --- |
|
|
52
|
-
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `
|
|
52
|
+
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `ListEmpty`, `ConfirmBody`, `RenameBody`, `FormBody`, `FileButton`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `bulkNotes`, `useListRun`, `useBulkRun`, `RunConfirm`, `useCloseWhileOpen`, `focusInDialog`, `useFocusBack`, `focusedTrigger`, `openOnTap`, `useUnsavedText`, `markLatest`, `viewNarrows`, `offeredView`, `offeredSize`, `sizedView`, `useMediaQuery`, `useTokenDocument`, the breakpoints `HUGE_BREAKPOINT`, `SIDEBAR_BREAKPOINT`, `EDGE_BREAKPOINT`, `DENSE_BREAKPOINT`, `SHEET_BREAKPOINT`, `TITLE_BREAKPOINT` and `SMALL_VIEWPORT`, `SUPPORTED_WPDS` |
|
|
53
53
|
| `@gopherium/godmin/base.css` | Cascade layer order, design tokens, host rules, frame and screen styles |
|
|
54
54
|
| `@gopherium/godmin/dates` | `startListDates`, `listDate`, the only entry that loads `@wordpress/date` |
|
|
55
55
|
| `@gopherium/godmin/dialogs` | `ConfirmDialog`, `FormDialog`, the only entry that loads `@wordpress/components`. Load `@wordpress/components/build-style/style.css` once in your app, as DataViews asks |
|
|
@@ -92,6 +92,16 @@ render unthemed components with no error. Spread `godminDedupe` into
|
|
|
92
92
|
[Build configuration](docs/build-and-versioning.md) covers both, and lists the
|
|
93
93
|
design system versions each release supports.
|
|
94
94
|
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
`pnpm run cover` runs the unit tests in jsdom with the coverage gate.
|
|
98
|
+
The stories in `stories/` show the components in Storybook, opened
|
|
99
|
+
with `pnpm run storybook:dev`. `pnpm run storybook:test` runs every
|
|
100
|
+
story in headless Chromium with its accessibility check, and
|
|
101
|
+
`pnpm run test:browser` runs the browser tests in `test/browser/`.
|
|
102
|
+
Both need Chromium once:
|
|
103
|
+
`pnpm exec playwright install --only-shell chromium`.
|
|
104
|
+
|
|
95
105
|
## Status
|
|
96
106
|
|
|
97
107
|
Still 0.x, so minor releases may break. See the CHANGELOG for what each release
|
package/dist/base.css
CHANGED
|
@@ -977,16 +977,31 @@ body {
|
|
|
977
977
|
outline-offset: 2px;
|
|
978
978
|
}
|
|
979
979
|
|
|
980
|
-
.godmin-loading-screen
|
|
981
|
-
|
|
980
|
+
.godmin-loading-screen {
|
|
981
|
+
display: flex;
|
|
982
|
+
flex: 1 0 auto;
|
|
983
|
+
align-items: center;
|
|
984
|
+
justify-content: center;
|
|
985
|
+
box-sizing: border-box;
|
|
986
|
+
min-block-size: 100vh;
|
|
987
|
+
padding: var(--wpds-dimension-padding-3xl);
|
|
982
988
|
opacity: 0;
|
|
983
|
-
animation: godmin-fade-in
|
|
984
|
-
|
|
989
|
+
animation: godmin-fade-in 500ms ease 200ms forwards;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.godmin-layout .godmin-loading-screen {
|
|
993
|
+
min-block-size: auto;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
:is(.godmin-page, .godmin-navigation-screen, [role='dialog'], [role='alertdialog']) .godmin-loading-screen {
|
|
997
|
+
min-block-size: auto;
|
|
998
|
+
opacity: 1;
|
|
999
|
+
animation: none;
|
|
985
1000
|
}
|
|
986
1001
|
|
|
987
|
-
.godmin-
|
|
988
|
-
|
|
989
|
-
|
|
1002
|
+
.godmin-page .godmin-loading-screen {
|
|
1003
|
+
flex: none;
|
|
1004
|
+
padding: 0;
|
|
990
1005
|
}
|
|
991
1006
|
|
|
992
1007
|
@keyframes godmin-fade-in {
|
|
@@ -1006,10 +1021,8 @@ body {
|
|
|
1006
1021
|
}
|
|
1007
1022
|
|
|
1008
1023
|
@media (prefers-reduced-motion: reduce) {
|
|
1009
|
-
.godmin-loading-screen
|
|
1010
|
-
|
|
1011
|
-
.godmin-arrival {
|
|
1012
|
-
animation-duration: 1ms;
|
|
1024
|
+
.godmin-loading-screen {
|
|
1025
|
+
animation-duration: 0s;
|
|
1013
1026
|
}
|
|
1014
1027
|
|
|
1015
1028
|
.godmin-toasts__item,
|
|
@@ -1023,43 +1036,6 @@ body {
|
|
|
1023
1036
|
}
|
|
1024
1037
|
}
|
|
1025
1038
|
|
|
1026
|
-
.godmin-loading-screen {
|
|
1027
|
-
padding: var(--wpds-dimension-padding-xl);
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
.godmin-loading-screen__ghost {
|
|
1031
|
-
display: flex;
|
|
1032
|
-
flex-direction: column;
|
|
1033
|
-
gap: var(--wpds-dimension-gap-lg);
|
|
1034
|
-
max-width: var(--wpds-dimension-surface-width-sm);
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
.godmin-loading-screen__title {
|
|
1038
|
-
height: 32px;
|
|
1039
|
-
width: 40%;
|
|
1040
|
-
border-radius: var(--wpds-border-radius-sm);
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
.godmin-loading-screen__stroke {
|
|
1044
|
-
height: 14px;
|
|
1045
|
-
border-radius: var(--wpds-border-radius-sm);
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
.godmin-loading-screen__stroke:last-child {
|
|
1049
|
-
width: 70%;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
.godmin-loading-rows__ghost {
|
|
1053
|
-
display: flex;
|
|
1054
|
-
flex-direction: column;
|
|
1055
|
-
gap: var(--wpds-dimension-gap-sm);
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
.godmin-loading-rows__row {
|
|
1059
|
-
height: var(--wpds-dimension-size-lg);
|
|
1060
|
-
border-radius: var(--wpds-border-radius-sm);
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
1039
|
.godmin-rows__row:focus-visible {
|
|
1064
1040
|
outline: var(--wpds-border-width-focus) solid var(--wpds-color-stroke-focus);
|
|
1065
1041
|
outline-offset: 2px;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type { ListEmptyProps } from './list-empty.js';
|
|
|
27
27
|
export { focusInDialog, useListRun } from './list-run.js';
|
|
28
28
|
export type { ListRun, ListRunState, RunSettled } from './list-run.js';
|
|
29
29
|
export type { LayoutDefaults, ListDefaults, ListFilter, ListSearch, ListSortDirection, ListView, ListViewShape, } from './list-view.js';
|
|
30
|
-
export {
|
|
30
|
+
export { LoadingScreen } from './loading.js';
|
|
31
31
|
export { LogItem, LogList, LogTime } from './log-list.js';
|
|
32
32
|
export type { LogItemProps, LogListProps, LogTimeProps } from './log-list.js';
|
|
33
33
|
export { MenuCount } from './menu-count.js';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export { keyFromLabel } from './keys.js';
|
|
|
14
14
|
export { LIST_CHROME_DOMAIN, listChromeCatalogFor } from './list-chrome.js';
|
|
15
15
|
export { ListEmpty } from './list-empty.js';
|
|
16
16
|
export { focusInDialog, useListRun } from './list-run.js';
|
|
17
|
-
export {
|
|
17
|
+
export { LoadingScreen } from './loading.js';
|
|
18
18
|
export { LogItem, LogList, LogTime } from './log-list.js';
|
|
19
19
|
export { MenuCount } from './menu-count.js';
|
|
20
20
|
export { NavigationScreen } from './navigation-screen.js';
|
package/dist/loading.d.ts
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Renders
|
|
2
|
+
* Renders the design system spinner in place of a screen's content while it loads.
|
|
3
3
|
* @param props - The label a screen reader announces.
|
|
4
4
|
* @returns The loading screen element.
|
|
5
5
|
*/
|
|
6
6
|
export declare function LoadingScreen({ label }: {
|
|
7
7
|
label: string;
|
|
8
8
|
}): import("react").JSX.Element;
|
|
9
|
-
/**
|
|
10
|
-
* Renders a stack of row-shaped ghosts while a list's data loads.
|
|
11
|
-
* @param props - The label a screen reader announces and the row count.
|
|
12
|
-
* @returns The loading rows element.
|
|
13
|
-
*/
|
|
14
|
-
export declare function LoadingRows({ label, rows }: {
|
|
15
|
-
label: string;
|
|
16
|
-
rows?: number;
|
|
17
|
-
}): import("react").JSX.Element;
|
package/dist/loading.js
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
const STROKES = 3;
|
|
3
|
+
import { Spinner, VisuallyHidden } from '@wordpress/ui';
|
|
5
4
|
/**
|
|
6
|
-
* Renders
|
|
5
|
+
* Renders the design system spinner in place of a screen's content while it loads.
|
|
7
6
|
* @param props - The label a screen reader announces.
|
|
8
7
|
* @returns The loading screen element.
|
|
9
8
|
*/
|
|
10
9
|
export function LoadingScreen({ label }) {
|
|
11
|
-
return (_jsxs("div", { className: "godmin-loading-screen", children: [_jsx(VisuallyHidden, { role: "status", children: label }),
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Renders a stack of row-shaped ghosts while a list's data loads.
|
|
15
|
-
* @param props - The label a screen reader announces and the row count.
|
|
16
|
-
* @returns The loading rows element.
|
|
17
|
-
*/
|
|
18
|
-
export function LoadingRows({ label, rows = 5 }) {
|
|
19
|
-
return (_jsxs("div", { className: "godmin-loading-rows", children: [_jsx(VisuallyHidden, { role: "status", children: label }), _jsx("div", { className: "godmin-loading-rows__ghost", "aria-hidden": "true", children: Array.from({ length: rows }, (_, row) => (_jsx(Skeleton, { className: "godmin-loading-rows__row" }, row))) })] }));
|
|
10
|
+
return (_jsxs("div", { className: "godmin-loading-screen", children: [_jsx(VisuallyHidden, { role: "status", children: label }), _jsx(Spinner, {})] }));
|
|
20
11
|
}
|
|
@@ -130,16 +130,18 @@ So the sidebar rows, the page tabs and a log list keep
|
|
|
130
130
|
## What a screen reader hears
|
|
131
131
|
|
|
132
132
|
godmin gives a sentence for the ear wherever the eye gets a shape, a
|
|
133
|
-
glyph or a bare number.
|
|
133
|
+
glyph or a bare number. A list that loads is the one exception, as
|
|
134
|
+
in WordPress. Visually hidden text is text on the page that
|
|
134
135
|
only a screen reader meets. Some things appear without the reader
|
|
135
|
-
moving to them, such as a toast or a loading
|
|
136
|
+
moving to them, such as a toast or a loading screen. A screen reader
|
|
136
137
|
learns of those through a live region, a part of the page it reads
|
|
137
138
|
aloud when it changes.
|
|
138
139
|
|
|
139
140
|
| Part | What a screen reader hears | Set up in |
|
|
140
141
|
| --- | --- | --- |
|
|
141
142
|
| A toast | Its message, politely. Never its action | [What a screen reader hears](./toasts.md#what-a-screen-reader-hears) |
|
|
142
|
-
| A loading
|
|
143
|
+
| A loading screen | The `label` sentence, from a visually hidden status. The spinner is hidden | [What a screen reader hears](./loading.md#what-a-screen-reader-hears) |
|
|
144
|
+
| A list that loads | Nothing on its first load, as in WordPress. A table or a grid is marked busy on a later load | [What a screen reader hears](./loading.md#what-a-screen-reader-hears) |
|
|
143
145
|
| A count beside a row | The `label` sentence, in place of the bare number | [A count beside a row](../framing-an-application.md#a-count-beside-a-row) |
|
|
144
146
|
| An `ErrorNotice` | Its message, at once, as an alert | [ErrorNotice](../screens.md#errornotice) |
|
|
145
147
|
|
|
@@ -176,7 +178,7 @@ default stays in English: the hint a toast with no action gives a
|
|
|
176
178
|
screen reader, until you pass `dismissLabel`, as
|
|
177
179
|
[what a screen reader hears](./toasts.md#what-a-screen-reader-hears)
|
|
178
180
|
says. Every other word comes from your app, such as the `label` of a
|
|
179
|
-
loading
|
|
181
|
+
loading screen or a count. Pass each one through your translations.
|
|
180
182
|
|
|
181
183
|
A translated label may be longer than the English one, so godmin
|
|
182
184
|
gives no label a fixed width:
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Loading
|
|
3
|
+
description: What a list, a screen and a preview show while their data loads, how long each waits, what a screen reader hears, and what changes for a reader who asks for less motion.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
A screen that waits for its data shows that it is loading, as
|
|
7
|
+
WordPress's new admin does. A list leaves this to DataViews. Any
|
|
8
|
+
other screen shows a spinner. A skeleton, a grey shape that stands in
|
|
9
|
+
for content, shows only in a preview whose shape is known before it
|
|
10
|
+
loads. [Loading and feedback](../loading-and-feedback.md) shows how
|
|
11
|
+
to set each one up. This page gives every value of what a reader
|
|
12
|
+
sees.
|
|
13
|
+
|
|
14
|
+
## A list
|
|
15
|
+
|
|
16
|
+
A DataViews list that gets its loading state through `isLoading`
|
|
17
|
+
shows it on its own, as every WordPress list does.
|
|
18
|
+
[A list that loads](../lists.md#a-list-that-loads) says which flag to
|
|
19
|
+
pass.
|
|
20
|
+
|
|
21
|
+
On the first load:
|
|
22
|
+
|
|
23
|
+
- For its first 200ms the list shows nothing under its toolbar. A
|
|
24
|
+
load that ends sooner shows no spinner at all.
|
|
25
|
+
- Then a spinner shows in the middle of the space between the toolbar
|
|
26
|
+
and the bottom of the canvas. The search box and the filters stay
|
|
27
|
+
on screen. The footer stays away until the first rows arrive.
|
|
28
|
+
- This spinner is the one of `@wordpress/components`, which DataViews
|
|
29
|
+
draws: a quarter circle in the accent color that turns over a light
|
|
30
|
+
grey ring.
|
|
31
|
+
- The first rows replace the spinner at once.
|
|
32
|
+
|
|
33
|
+
On a later load, such as another page, a search or a new sort:
|
|
34
|
+
|
|
35
|
+
- The old rows and the footer stay on screen. Nobody can click them
|
|
36
|
+
or reach them with Tab until the next rows arrive.
|
|
37
|
+
- After 400ms the rows and the footer pulse. Their opacity goes from
|
|
38
|
+
1 to `0.5` and back every 1s, on an `ease-in-out` curve. A load
|
|
39
|
+
that ends sooner shows no pulse.
|
|
40
|
+
- When the last answer was empty, there are no old rows to keep. The
|
|
41
|
+
empty state stays on screen and pulses the same way after 400ms.
|
|
42
|
+
- The next rows replace the old ones at once.
|
|
43
|
+
|
|
44
|
+
## A screen
|
|
45
|
+
|
|
46
|
+
`LoadingScreen` stands in for a screen, or for the part of a screen
|
|
47
|
+
whose data has not arrived. It holds the `Spinner` of
|
|
48
|
+
`@wordpress/ui`, a half circle that turns. It is
|
|
49
|
+
`--wpds-dimension-size-2xs` (16px) wide and high and drawn in
|
|
50
|
+
`--wpds-color-foreground-content-neutral-weak`, the muted text color.
|
|
51
|
+
|
|
52
|
+
When it shows and where it sits depend on what is around it:
|
|
53
|
+
|
|
54
|
+
- Inside a `Page` it shows at once, with no wait and no fade, as a
|
|
55
|
+
WordPress screen shows the spinner under its title. The spinner
|
|
56
|
+
sits at the top of the page content, centred across, with the
|
|
57
|
+
page's own gap between it and the title. The title stays on screen.
|
|
58
|
+
- Inside a dialog it shows at once too, and takes only the space it
|
|
59
|
+
gets.
|
|
60
|
+
- Inside a sidebar screen it shows at once too, under the screen's
|
|
61
|
+
title, as in the sidebar of the WordPress Site Editor. That holds
|
|
62
|
+
on a phone, where the sidebar opens as a drawer, and on a wide
|
|
63
|
+
window alike.
|
|
64
|
+
- Directly in the canvas, with no page around it, nothing of the
|
|
65
|
+
screen is known yet. It shows nothing for its first 200ms, so a
|
|
66
|
+
load that ends sooner shows no spinner. Then it fades in over
|
|
67
|
+
500ms on the CSS `ease` curve, as the canvas loader of the
|
|
68
|
+
WordPress Site Editor does. It fills the canvas, the spinner sits
|
|
69
|
+
in the middle, and it keeps `--wpds-dimension-padding-3xl` (32px)
|
|
70
|
+
free on every side.
|
|
71
|
+
- Outside the frame, before the sidebar and the canvas are drawn, it
|
|
72
|
+
waits and fades in the same way. It is at least `100vh` tall, the
|
|
73
|
+
height of the window, as the frame is. So the spinner sits in the
|
|
74
|
+
middle of the window.
|
|
75
|
+
|
|
76
|
+
## A preview whose shape is known
|
|
77
|
+
|
|
78
|
+
Some parts know their size before their data arrives, such as an
|
|
79
|
+
image whose width and height you already hold. Such a part may show
|
|
80
|
+
a skeleton in its place, as WordPress does in its style and font
|
|
81
|
+
previews. godmin draws no skeleton of its own. Use the `Skeleton` of
|
|
82
|
+
`@wordpress/ui`:
|
|
83
|
+
|
|
84
|
+
- Give it the size and the corners of the part it stands in for. It
|
|
85
|
+
has no size of its own.
|
|
86
|
+
- It is drawn in `--wpds-color-background-surface-neutral-weak` and
|
|
87
|
+
pulses as its package makes it pulse. In forced colors it gets a
|
|
88
|
+
thin border, so its shape stays visible.
|
|
89
|
+
- It is hidden from screen readers. Mark the part around it
|
|
90
|
+
`aria-busy="true"` while it loads, or give that part a visually
|
|
91
|
+
hidden status with a label, as `LoadingScreen` does.
|
|
92
|
+
- When the image arrives, the skeleton goes at once and the image may
|
|
93
|
+
fade in. This is the one fade WordPress gives loaded content, in
|
|
94
|
+
its font previews: the opacity goes from 0 to 1 over
|
|
95
|
+
`--wpds-motion-duration-lg` (300ms) on `--wpds-motion-easing-subtle`
|
|
96
|
+
(`cubic-bezier(0.15, 0, 0.15, 1)`), only when the reader allows
|
|
97
|
+
motion. While it loads, keep the image in the page at opacity 0,
|
|
98
|
+
laid over the skeleton with `position: absolute`. WordPress does so
|
|
99
|
+
because a lazy image with `display: none` does not load.
|
|
100
|
+
|
|
101
|
+
In godmin a list or a screen shows a spinner, even when it knows how
|
|
102
|
+
many rows are coming, as above. Nothing else fades in when it
|
|
103
|
+
arrives.
|
|
104
|
+
|
|
105
|
+
## Moving between pages
|
|
106
|
+
|
|
107
|
+
These follow
|
|
108
|
+
[`routerDefaults()`](../framing-an-application.md#routes-and-the-frame):
|
|
109
|
+
|
|
110
|
+
- The page on screen stays until the next one has its code and the
|
|
111
|
+
data its route loader waits for. No loading screen shows in
|
|
112
|
+
between.
|
|
113
|
+
- A page starts to load when the pointer rests on its link or the
|
|
114
|
+
keyboard reaches it, so the wait is often over before the click.
|
|
115
|
+
- A loader that waits only for the small data the screen needs to
|
|
116
|
+
draw, and starts the rest without waiting, keeps that wait short.
|
|
117
|
+
[A list that loads](../lists.md#a-list-that-loads) shows how.
|
|
118
|
+
- A page that fetches its own data after it opens shows a list or a
|
|
119
|
+
screen loading, as above.
|
|
120
|
+
- The next page replaces the old one at once, with no fade and no
|
|
121
|
+
slide.
|
|
122
|
+
|
|
123
|
+
## What a screen reader hears
|
|
124
|
+
|
|
125
|
+
- `LoadingScreen` puts its `label` in a visually hidden status, and a
|
|
126
|
+
screen reader reads it politely. In the canvas and outside the
|
|
127
|
+
frame the status is there during the wait too. The spinner itself
|
|
128
|
+
is hidden.
|
|
129
|
+
- A list says nothing while it loads for the first time, as in
|
|
130
|
+
WordPress. Its spinner is hidden from screen readers.
|
|
131
|
+
- During a later load a table or a grid is marked busy. A screen
|
|
132
|
+
reader may say so when the reader moves into it. The other layouts
|
|
133
|
+
are not marked.
|
|
134
|
+
|
|
135
|
+
## Reduced motion
|
|
136
|
+
|
|
137
|
+
[Reduced motion](./motion.md#reduced-motion) says what changes for a
|
|
138
|
+
reader who asks for less motion. While a list or a screen loads:
|
|
139
|
+
|
|
140
|
+
- Both spinners keep turning, as WordPress keeps them. A spinner that
|
|
141
|
+
stood still would look like a page that froze.
|
|
142
|
+
- A list does not pulse. Its old rows and its footer stay at `0.5`
|
|
143
|
+
opacity until the next rows arrive.
|
|
144
|
+
- A loading screen in the canvas or outside the frame keeps its wait,
|
|
145
|
+
since a wait is no motion, and then shows at once with no fade.
|
|
146
|
+
Inside a `Page`, a sidebar screen or a dialog nothing changes, since
|
|
147
|
+
it never moves.
|
|
148
|
+
- A skeleton stops its pulse. Its package does that on its own.
|
|
149
|
+
- An image takes the place of its skeleton at once, with no fade.
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Motion
|
|
3
|
-
description: The sidebar slide, the toast motion and the
|
|
3
|
+
description: The sidebar slide, the toast motion and the fade of a loading screen in a godmin admin, the design tokens that time them, and what changes when a reader asks for less motion.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
godmin's own motion is short and small. The sidebar slides a new
|
|
7
7
|
menu screen in. Toasts grow in and fade, and the toasts around them
|
|
8
|
-
slide along.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
slide along. A loading screen that fills the canvas or stands outside
|
|
9
|
+
the frame waits a moment, then fades in. godmin's stylesheet animates
|
|
10
|
+
nothing else. It sets no transitions, so its own hover and focus
|
|
11
|
+
looks change at once.
|
|
12
12
|
|
|
13
13
|
Parts that WordPress packages draw keep the motion those packages
|
|
14
|
-
give them. These include the dialogs, the drawer on a small screen
|
|
15
|
-
and the
|
|
14
|
+
give them. These include the dialogs, the drawer on a small screen,
|
|
15
|
+
the spinners and the pulse of a list that loads.
|
|
16
16
|
|
|
17
17
|
## The tokens
|
|
18
18
|
|
|
19
19
|
A design token is a value the WordPress Design System names, written
|
|
20
20
|
as a CSS custom property. A custom property is a CSS variable. A
|
|
21
21
|
duration is how long an animation takes. An easing is the curve its
|
|
22
|
-
speed follows from start to end. godmin times its motion with
|
|
22
|
+
speed follows from start to end. godmin times its motion with three
|
|
23
23
|
design tokens:
|
|
24
24
|
|
|
25
25
|
| Token | Value | What it times |
|
|
26
26
|
| --- | --- | --- |
|
|
27
27
|
| `--wpds-motion-duration-lg` | 300ms | Toast motion, see [Motion](./toasts.md#motion) |
|
|
28
|
-
| `--wpds-motion-duration-md` | 200ms | A ghost or new content fading in |
|
|
29
28
|
| `--wpds-motion-duration-sm` | 100ms | Toast motion, see [Motion](./toasts.md#motion) |
|
|
30
29
|
| `--wpds-motion-duration-xs` | 50ms | Toast motion, see [Motion](./toasts.md#motion) |
|
|
31
|
-
| `--wpds-motion-easing-balanced` | `cubic-bezier(0.4, 0, 0.2, 1)` | The fades of ghosts and new content |
|
|
32
30
|
|
|
33
|
-
Some values have no token: the sidebar slide, the wait
|
|
34
|
-
|
|
35
|
-
them.
|
|
31
|
+
Some values have no token: the sidebar slide, the wait and the fade
|
|
32
|
+
of a loading screen, and the rest of the toast motion. The sections
|
|
33
|
+
below cover them.
|
|
36
34
|
|
|
37
35
|
## The sidebar slide
|
|
38
36
|
|
|
@@ -81,30 +79,21 @@ and curve, and says what a leaving toast does.
|
|
|
81
79
|
|
|
82
80
|
## Loading
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
all.
|
|
90
|
-
[Why a ghost does not appear immediately](../loading-and-feedback.md#why-a-ghost-does-not-appear-immediately)
|
|
91
|
-
gives the delay and the reason for it. The bars inside a ghost are
|
|
92
|
-
the `Skeleton` of `@wordpress/ui`, and they pulse the way that
|
|
93
|
-
package pulses them.
|
|
94
|
-
|
|
95
|
-
Content with the `godmin-arrival` class fades in the same way, with
|
|
96
|
-
no delay.
|
|
97
|
-
[Fading the content in](../loading-and-feedback.md#fading-the-content-in)
|
|
98
|
-
shows where to put the class.
|
|
82
|
+
A spinner turns while a list or a screen loads, and the old rows of a
|
|
83
|
+
list pulse while the next ones load. Both come from WordPress
|
|
84
|
+
packages. A loading screen that fills the canvas or stands outside
|
|
85
|
+
the frame waits, then fades in. [Loading](./loading.md) gives how
|
|
86
|
+
long each one waits and how it moves.
|
|
99
87
|
|
|
100
88
|
## Reduced motion
|
|
101
89
|
|
|
102
90
|
A reader can ask their system for less motion. The browser then
|
|
103
91
|
reports `prefers-reduced-motion: reduce` to CSS, and godmin changes
|
|
104
|
-
|
|
92
|
+
three things:
|
|
105
93
|
|
|
106
|
-
-
|
|
107
|
-
|
|
94
|
+
- A loading screen that fills the canvas or stands outside the frame
|
|
95
|
+
shows at once when its wait ends, with no fade. Its wait stays, so
|
|
96
|
+
a fast load still shows nothing.
|
|
108
97
|
- Every toast animation lasts 1ms and starts at once, with no wait.
|
|
109
98
|
It still runs and still ends, so a leaving toast still goes. A toast
|
|
110
99
|
shows in its place at once and goes at once, and the toasts above
|
|
@@ -113,9 +102,6 @@ two things:
|
|
|
113
102
|
when you set your own slide duration. It does not play, and the new
|
|
114
103
|
screen shows at once in its place.
|
|
115
104
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
The bars inside a ghost stop their pulse too. Their WordPress
|
|
121
|
-
package does that on its own.
|
|
105
|
+
Loading keeps its spinners turning, and a list holds its old rows
|
|
106
|
+
still. [Reduced motion](./loading.md#reduced-motion) on the loading
|
|
107
|
+
page says what loading does.
|
|
@@ -100,8 +100,12 @@ layer.
|
|
|
100
100
|
- [Custom properties](./custom-properties.md): every godmin custom
|
|
101
101
|
property, where it is set and what it changes.
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
Two more pages cover a single part each, how it looks and how it
|
|
104
|
+
behaves:
|
|
104
105
|
|
|
105
106
|
- [Toasts](./toasts.md): where a toast sits, how it looks, how long it
|
|
106
107
|
stays, how a reader clears it, and what a keyboard or a screen reader
|
|
107
108
|
meets.
|
|
109
|
+
- [Loading](./loading.md): what a list, a screen and a preview show
|
|
110
|
+
while their data loads, how long each waits and what a screen reader
|
|
111
|
+
hears.
|
|
@@ -24,7 +24,7 @@ presets.
|
|
|
24
24
|
| `--wpds-border-radius-xl` (12px) | Page and app shell surfaces | The canvas, the panel that shows the active screen |
|
|
25
25
|
| `--wpds-border-radius-lg` (8px) | Cards, dialogs, notices and other larger containers | A `LogList`, the box of items shown one under the other |
|
|
26
26
|
| `--wpds-border-radius-md` (4px) | Menus, popovers and other small overlays | A toast, which keeps its corners at every preset, as [toasts](./toasts.md#colors-corners-and-shadow) shows |
|
|
27
|
-
| `--wpds-border-radius-sm` (2px) | Buttons, inputs and compact controls | A sidebar row, the Back button of a sidebar screen, the
|
|
27
|
+
| `--wpds-border-radius-sm` (2px) | Buttons, inputs and compact controls | A sidebar row, the Back button of a sidebar screen, the focus ring of a page tab, and the focus ring of a toast action, which keeps its corners at every preset |
|
|
28
28
|
| `--wpds-border-radius-xs` (1px) | Elements nested inside controls | Nothing of godmin's own |
|
|
29
29
|
|
|
30
30
|
A surface inside another takes a smaller step than the one around
|
|
@@ -146,7 +146,9 @@ closes after it leaves, so the toasts above slide instead of jumping.
|
|
|
146
146
|
Space clears it. Its focus ring is a white line
|
|
147
147
|
`--wpds-border-width-xs` wide inside the toast and a ring of
|
|
148
148
|
`--wpds-color-stroke-focus` `--wpds-border-width-focus` wide around
|
|
149
|
-
it, both drawn as a shadow. The browser's own ring shows too.
|
|
149
|
+
it, both drawn as a shadow. The browser's own ring shows too. In
|
|
150
|
+
Chrome it is a dark ring that mostly covers the white line and the
|
|
151
|
+
focus ring, as it does on the WordPress snackbar.
|
|
150
152
|
- In a toast with an action, only the action takes focus. The rest of
|
|
151
153
|
the toast is no tab stop and no button. A keyboard reader runs the
|
|
152
154
|
action, or lets the toast leave on its own when its time is up. So
|
|
@@ -377,7 +377,7 @@ const router = createRouter({ routeTree, ...routerDefaults() })
|
|
|
377
377
|
|
|
378
378
|
A page then starts to load when the pointer rests on its link or the
|
|
379
379
|
keyboard reaches it.
|
|
380
|
-
[Moving between pages](./loading
|
|
380
|
+
[Moving between pages](./design-system/loading.md#moving-between-pages)
|
|
381
381
|
says what the reader sees while it loads.
|
|
382
382
|
|
|
383
383
|
`@tanstack/react-router` is an optional peer dependency, any 1.x
|
package/docs/lists.md
CHANGED
|
@@ -299,6 +299,63 @@ const empty = viewNarrows(view) ? (
|
|
|
299
299
|
A filter with an empty pick, or one still waiting for its value,
|
|
300
300
|
narrows nothing.
|
|
301
301
|
|
|
302
|
+
## A list that loads
|
|
303
|
+
|
|
304
|
+
Pass the loading state of the list to DataViews as `isLoading`.
|
|
305
|
+
DataViews then shows what every WordPress list shows: nothing at
|
|
306
|
+
first, a spinner while the first rows load, and the old rows, dimmed,
|
|
307
|
+
while the next ones load. [A list](./design-system/loading.md#a-list)
|
|
308
|
+
gives how long each step waits.
|
|
309
|
+
|
|
310
|
+
Pass true while the list waits for rows it does not hold yet: from
|
|
311
|
+
the first render until the first answer, even while the request still
|
|
312
|
+
waits for something else, and while a new page, search or sort waits
|
|
313
|
+
for its answer. With TanStack Query:
|
|
314
|
+
|
|
315
|
+
```tsx
|
|
316
|
+
<DataViews {...props} data={orders.data?.items ?? []} isLoading={orders.isPending || orders.isPlaceholderData} />
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Do not pass `isFetching`. TanStack Query sets it on the very first
|
|
320
|
+
render of a list whose stored rows are stale, and DataViews then hides
|
|
321
|
+
those rows behind its spinner until the fetch ends.
|
|
322
|
+
|
|
323
|
+
With urql, pass
|
|
324
|
+
`result.fetching || (result.data === undefined && result.error === undefined)`.
|
|
325
|
+
|
|
326
|
+
When the page already holds the first rows, such as data the server
|
|
327
|
+
put in the page, give them to TanStack Query as `initialData`. The
|
|
328
|
+
list then shows them at once, with no spinner, as WordPress does with
|
|
329
|
+
the data it preloads.
|
|
330
|
+
|
|
331
|
+
The flag has to be true on the very first render. DataViews decides
|
|
332
|
+
on that render whether the list has loaded. A list that starts with
|
|
333
|
+
`false` never shows the spinner. It shows its empty state, which dims
|
|
334
|
+
after a moment until the rows arrive.
|
|
335
|
+
|
|
336
|
+
Keep DataViews on screen while it loads, and never swap it for
|
|
337
|
+
`LoadingScreen`. DataViews keeps the search box and the filters in
|
|
338
|
+
place, and keeps the old rows during a later load.
|
|
339
|
+
|
|
340
|
+
Never give DataViews a `key` that changes with the view, such as the
|
|
341
|
+
layout, a status or a category. A new key mounts a new DataViews.
|
|
342
|
+
When the new view then loads, it starts over as on a first load: the
|
|
343
|
+
rows go, nothing shows for a moment, then the spinner, where a later
|
|
344
|
+
load would keep the rows on screen.
|
|
345
|
+
|
|
346
|
+
In a route, let the loader wait only for the small data the screen
|
|
347
|
+
needs before it can draw, and start the rows without waiting. The old
|
|
348
|
+
page then stays only that long, and the list shows its own loading.
|
|
349
|
+
With TanStack Query, `ensureQueryData` waits and `prefetchQuery`
|
|
350
|
+
with no `await` starts:
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
loader: () => {
|
|
354
|
+
void queryClient.prefetchQuery(ordersQuery)
|
|
355
|
+
return queryClient.ensureQueryData(orderStatusesQuery)
|
|
356
|
+
},
|
|
357
|
+
```
|
|
358
|
+
|
|
302
359
|
## Paging on the server
|
|
303
360
|
|
|
304
361
|
`filterSortAndPaginate` needs every row in the browser. A long list
|
|
@@ -312,7 +369,7 @@ import { Page, paginationOf, useServerPaging } from '@gopherium/godmin'
|
|
|
312
369
|
export function OrdersScreen() {
|
|
313
370
|
const [view, setView] = useState<View>({ type: 'table', page: 1, perPage: 20, fields: ['total'] })
|
|
314
371
|
const paging = useServerPaging(view, 100)
|
|
315
|
-
const { page, asked } = useOrderPage(paging.window)
|
|
372
|
+
const { page, asked, loading } = useOrderPage(paging.window)
|
|
316
373
|
paging.record(page, asked)
|
|
317
374
|
return (
|
|
318
375
|
<Page title="Orders" list>
|
|
@@ -323,6 +380,7 @@ export function OrdersScreen() {
|
|
|
323
380
|
view={view}
|
|
324
381
|
onChangeView={setView}
|
|
325
382
|
defaultLayouts={{ table: {} }}
|
|
383
|
+
isLoading={loading}
|
|
326
384
|
/>
|
|
327
385
|
</Page>
|
|
328
386
|
)
|
|
@@ -342,7 +400,9 @@ not arrived. `paginationOf` turns it into the totals DataViews shows.
|
|
|
342
400
|
`useOrderPage` also gives back `asked`, the limit of the request that
|
|
343
401
|
got this page. With urql, that is `result.operation?.variables.limit`.
|
|
344
402
|
Call `paging.record(page, asked)` in the same component, right after
|
|
345
|
-
your request, as the example does.
|
|
403
|
+
your request, as the example does. It also gives back `loading`, true
|
|
404
|
+
until its first answer and while a new page waits for its answer, as
|
|
405
|
+
[a list that loads](#a-list-that-loads) asks.
|
|
346
406
|
|
|
347
407
|
`paging.record` remembers the page size the server used for that
|
|
348
408
|
request. When the server used another size than you asked for, the
|
|
@@ -1349,6 +1409,10 @@ Inside a `list` page the table reaches the canvas edges too, and its
|
|
|
1349
1409
|
first and last cells pad by 24px, as DataViews does. A custom list
|
|
1350
1410
|
and a DataViews list then line up with each other and with the title.
|
|
1351
1411
|
|
|
1412
|
+
While its first rows load, show `LoadingScreen` in place of the
|
|
1413
|
+
table, as
|
|
1414
|
+
[a list that loads](./loading-and-feedback.md#a-list-that-loads) says.
|
|
1415
|
+
|
|
1352
1416
|
## The list chrome in Spanish
|
|
1353
1417
|
|
|
1354
1418
|
DataViews speaks English until you load its translations. Its words,
|
|
@@ -1,63 +1,120 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Loading and feedback
|
|
3
|
-
description:
|
|
3
|
+
description: What a list, a screen and a preview show while their data loads, and toasts for messages.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
While a screen waits for its data,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
for short messages.
|
|
6
|
+
While a screen waits for its data, it shows that it is loading, the
|
|
7
|
+
way WordPress does. A list leaves that to DataViews. Any other screen
|
|
8
|
+
shows `LoadingScreen`, a spinner. godmin also ships the toast region
|
|
9
|
+
for short messages. [Loading](./design-system/loading.md) in the
|
|
10
|
+
Design System gives how long each one waits, where it sits and what a
|
|
11
|
+
reader sees.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## A list that loads
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
Pass the loading state of a DataViews list to its `isLoading`.
|
|
16
|
+
DataViews then shows the loading itself.
|
|
17
|
+
[A list that loads](./lists.md#a-list-that-loads) says which flag to
|
|
18
|
+
pass.
|
|
19
|
+
|
|
20
|
+
A list that is not DataViews, such as a `godmin-table`, shows
|
|
21
|
+
`LoadingScreen` in its place until its first rows arrive.
|
|
22
|
+
|
|
23
|
+
## A screen that loads
|
|
24
|
+
|
|
25
|
+
`LoadingScreen` stands in for a screen, or for the part of a screen
|
|
26
|
+
whose data has not arrived:
|
|
16
27
|
|
|
17
28
|
```tsx
|
|
18
|
-
if (
|
|
19
|
-
return
|
|
29
|
+
if (report.isPending) {
|
|
30
|
+
return (
|
|
31
|
+
<Page title="Report">
|
|
32
|
+
<LoadingScreen label="Loading the report." />
|
|
33
|
+
</Page>
|
|
34
|
+
)
|
|
20
35
|
}
|
|
21
|
-
return <ReportTable className="godmin-arrival" />
|
|
22
36
|
```
|
|
23
37
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
shapes, and screen reader users hear the label, announced from a
|
|
27
|
-
visually hidden status region. The shapes themselves are hidden
|
|
28
|
-
from assistive technology.
|
|
38
|
+
Render it from the pending flag of your request. Where you put it
|
|
39
|
+
decides how it shows:
|
|
29
40
|
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
- Inside the `Page`, when you know the title. The title stays while
|
|
42
|
+
the data loads, and the spinner shows at once at the top of the
|
|
43
|
+
page, under the title, as on a WordPress screen.
|
|
44
|
+
- Inside a dialog, when nothing of the dialog body is known yet. It
|
|
45
|
+
shows at once there too.
|
|
46
|
+
- Alone, when nothing of the screen is known yet, such as while the
|
|
47
|
+
session loads before the frame is drawn. It then waits a moment, so
|
|
48
|
+
a fast load shows nothing, and fades in, in the middle of the space
|
|
49
|
+
it gets. The wait lives in the stylesheet, so your code needs no
|
|
50
|
+
timer.
|
|
32
51
|
|
|
33
|
-
|
|
52
|
+
Inside a `Page` a load that is often fast can show the spinner for a
|
|
53
|
+
moment. To keep the old page on screen instead, let the route loader
|
|
54
|
+
wait for the small data the screen needs, as
|
|
55
|
+
[a list that loads](./lists.md#a-list-that-loads) shows. Data the
|
|
56
|
+
page already holds can go to TanStack Query as `initialData`.
|
|
34
57
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
58
|
+
`label` is required. Write the sentence you would have shown as text,
|
|
59
|
+
like `Loading the report.` A screen reader hears it, as
|
|
60
|
+
[what a screen reader hears](./design-system/loading.md#what-a-screen-reader-hears)
|
|
61
|
+
says. Pass it through your translations.
|
|
39
62
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
No timers, no extra state.
|
|
63
|
+
Show the content as soon as it arrives. It replaces the spinner at
|
|
64
|
+
once.
|
|
43
65
|
|
|
44
|
-
|
|
45
|
-
of 0.5.0. It held ghosts on screen for a minimum time after the
|
|
46
|
-
data arrived, which made fast screens feel slow. Render from the
|
|
47
|
-
pending flag and let the stylesheet do the rest.
|
|
66
|
+
## A preview whose shape is known
|
|
48
67
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
and it fades in instead of snapping in:
|
|
68
|
+
When a part knows its size before its data arrives, such as an image
|
|
69
|
+
whose width and height you hold, it may show the `Skeleton` of
|
|
70
|
+
`@wordpress/ui` in its place until the image arrives:
|
|
53
71
|
|
|
54
72
|
```tsx
|
|
55
|
-
|
|
73
|
+
const [loadedUrl, setLoadedUrl] = useState<string>()
|
|
74
|
+
const loaded = loadedUrl === coverUrl
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<figure className="cover" aria-busy={!loaded}>
|
|
78
|
+
{loaded ? null : <Skeleton style={{ inlineSize: 320, blockSize: 180 }} />}
|
|
79
|
+
<img
|
|
80
|
+
src={coverUrl}
|
|
81
|
+
alt=""
|
|
82
|
+
width={320}
|
|
83
|
+
height={180}
|
|
84
|
+
className={loaded ? undefined : 'is-loading'}
|
|
85
|
+
onLoad={() => setLoadedUrl(coverUrl)}
|
|
86
|
+
onError={() => setLoadedUrl(coverUrl)}
|
|
87
|
+
/>
|
|
88
|
+
</figure>
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The image is in the page from the start, so the browser loads it.
|
|
93
|
+
Until then your own `is-loading` class lays it over the skeleton,
|
|
94
|
+
out of the flow and transparent, as WordPress does:
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
.cover {
|
|
98
|
+
position: relative;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.cover .is-loading {
|
|
102
|
+
position: absolute;
|
|
103
|
+
inset-block-start: 0;
|
|
104
|
+
inset-inline-start: 0;
|
|
105
|
+
opacity: 0;
|
|
106
|
+
}
|
|
56
107
|
```
|
|
57
108
|
|
|
58
|
-
The
|
|
59
|
-
|
|
60
|
-
|
|
109
|
+
The skeleton goes when the image loads, or fails, so it never pulses
|
|
110
|
+
for good. It comes back for a new `coverUrl` until that image loads.
|
|
111
|
+
|
|
112
|
+
Keep it for such a preview. A list or a screen shows a spinner, as
|
|
113
|
+
above. When the image arrives you may fade it in, the one fade
|
|
114
|
+
WordPress gives loaded content.
|
|
115
|
+
[A preview whose shape is known](./design-system/loading.md#a-preview-whose-shape-is-known)
|
|
116
|
+
says how to size the skeleton, how to hide the image and fade it in,
|
|
117
|
+
and what a screen reader needs.
|
|
61
118
|
|
|
62
119
|
## Moving between pages
|
|
63
120
|
|
|
@@ -65,13 +122,12 @@ A router can draw a loading screen while the next page loads.
|
|
|
65
122
|
WordPress's new admin draws none. To do the same, spread
|
|
66
123
|
[`routerDefaults()`](./framing-an-application.md#routes-and-the-frame)
|
|
67
124
|
into your router, and give it no `defaultPendingComponent` and no
|
|
68
|
-
route a `pendingComponent`.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
above.
|
|
125
|
+
route a `pendingComponent`. The old page then stays until the route
|
|
126
|
+
loader is done, so let the loader wait only for the small data the
|
|
127
|
+
screen needs, as [a list that loads](./lists.md#a-list-that-loads)
|
|
128
|
+
shows.
|
|
129
|
+
[Moving between pages](./design-system/loading.md#moving-between-pages)
|
|
130
|
+
says what the reader sees then.
|
|
75
131
|
|
|
76
132
|
## Toasts
|
|
77
133
|
|
package/docs/overview.md
CHANGED
|
@@ -29,7 +29,7 @@ duplicates something the packages above already ship.
|
|
|
29
29
|
|
|
30
30
|
| Entry point | Contents |
|
|
31
31
|
| --- | --- |
|
|
32
|
-
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `
|
|
32
|
+
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavigationScreen`, `MenuCount`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `ListEmpty`, `ConfirmBody`, `RenameBody`, `FormBody`, `FileButton`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `bulkNotes`, `useListRun`, `useBulkRun`, `RunConfirm`, `useCloseWhileOpen`, `focusInDialog`, `useFocusBack`, `focusedTrigger`, `openOnTap`, `useUnsavedText`, `markLatest`, `viewNarrows`, `offeredView`, `offeredSize`, `sizedView`, `useMediaQuery`, `useTokenDocument`, the breakpoints `HUGE_BREAKPOINT`, `SIDEBAR_BREAKPOINT`, `EDGE_BREAKPOINT`, `DENSE_BREAKPOINT`, `SHEET_BREAKPOINT`, `TITLE_BREAKPOINT` and `SMALL_VIEWPORT`, `SUPPORTED_WPDS` |
|
|
33
33
|
| `@gopherium/godmin/base.css` | Cascade layer order, design tokens, host rules, frame and screen styles |
|
|
34
34
|
| `@gopherium/godmin/dates` | `startListDates`, `listDate`, the only entry that loads `@wordpress/date` |
|
|
35
35
|
| `@gopherium/godmin/dialogs` | `ConfirmDialog`, `FormDialog`, the only entry that loads `@wordpress/components`. Load `@wordpress/components/build-style/style.css` once in your app, as DataViews asks |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gopherium/godmin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "The admin kit for Gopherium projects: host layer for React admin applications on the WordPress Design System.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -55,9 +55,12 @@
|
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "rm -rf dist && tsc -p tsconfig.build.json && cp src/base.css dist/base.css",
|
|
58
|
-
"cover": "vitest run --coverage",
|
|
58
|
+
"cover": "vitest run --coverage --project unit",
|
|
59
59
|
"lint": "oxlint",
|
|
60
60
|
"lint:css": "stylelint 'src/**/*.css'",
|
|
61
|
+
"storybook:dev": "storybook dev",
|
|
62
|
+
"storybook:test": "vitest run --project storybook",
|
|
63
|
+
"test:browser": "vitest run --project browser",
|
|
61
64
|
"typecheck": "tsc --noEmit",
|
|
62
65
|
"prepublishOnly": "pnpm run build"
|
|
63
66
|
},
|
|
@@ -104,6 +107,10 @@
|
|
|
104
107
|
}
|
|
105
108
|
},
|
|
106
109
|
"devDependencies": {
|
|
110
|
+
"@argos-ci/storybook": "6.4.4",
|
|
111
|
+
"@storybook/addon-a11y": "10.6.3",
|
|
112
|
+
"@storybook/addon-vitest": "10.6.3",
|
|
113
|
+
"@storybook/react-vite": "10.6.3",
|
|
107
114
|
"@tanstack/react-router": "1.170.45",
|
|
108
115
|
"@testing-library/react": "^16.3.2",
|
|
109
116
|
"@testing-library/user-event": "^14.6.7",
|
|
@@ -111,6 +118,7 @@
|
|
|
111
118
|
"@types/node": "^26.1.2",
|
|
112
119
|
"@types/react": "^19.2.17",
|
|
113
120
|
"@vitejs/plugin-react": "^6.0.3",
|
|
121
|
+
"@vitest/browser-playwright": "^5.0.3",
|
|
114
122
|
"@vitest/coverage-v8": "^5.0.3",
|
|
115
123
|
"@wordpress/a11y": "4.57.0",
|
|
116
124
|
"@wordpress/components": "42.0.0",
|
|
@@ -125,14 +133,17 @@
|
|
|
125
133
|
"eslint": "^10.7.0",
|
|
126
134
|
"eslint-plugin-jsdoc": "^63.2.0",
|
|
127
135
|
"eslint-plugin-sonarjs": "^4.2.0",
|
|
136
|
+
"eslint-plugin-storybook": "10.6.3",
|
|
128
137
|
"eslint-plugin-tsdoc": "^0.5.2",
|
|
129
138
|
"github-slugger": "2.0.0",
|
|
130
139
|
"jsdom": "^30.1.2",
|
|
131
140
|
"mdast-util-from-markdown": "2.0.3",
|
|
132
141
|
"mdast-util-to-string": "4.0.0",
|
|
133
142
|
"oxlint": "^1.71.0",
|
|
143
|
+
"playwright": "1.64.1",
|
|
134
144
|
"react": "^19.2.8",
|
|
135
145
|
"react-dom": "^19.2.8",
|
|
146
|
+
"storybook": "10.6.3",
|
|
136
147
|
"stylelint": "^17.0.0",
|
|
137
148
|
"typescript": "~6.0.2",
|
|
138
149
|
"typescript-eslint": "^8.65.0",
|