@gopherium/godmin 0.32.0 → 0.33.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 +19 -9
- package/dist/admin-root.d.ts +4 -2
- package/dist/admin-root.js +6 -3
- package/dist/announcer-heading.d.ts +4 -0
- package/dist/announcer-heading.js +25 -0
- package/dist/base.css +36 -4
- package/dist/bulk-run.d.ts +2 -2
- package/dist/bulk-run.js +18 -2
- package/dist/confirm-dialog.d.ts +2 -2
- package/dist/confirm-dialog.js +3 -2
- package/dist/dialog-open.d.ts +16 -2
- package/dist/dialog-open.js +126 -5
- package/dist/drilldown-item.d.ts +5 -2
- package/dist/drilldown-item.js +14 -2
- package/dist/filter-offer.d.ts +5 -5
- package/dist/filter-offer.js +9 -9
- package/dist/focus-back.js +12 -2
- package/dist/form-dialog.d.ts +2 -2
- package/dist/form-dialog.js +3 -2
- package/dist/frame.d.ts +8 -4
- package/dist/frame.js +16 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -2
- package/dist/list-chrome/es-ES.d.ts +1 -1
- package/dist/list-chrome/es-ES.js +11 -8
- package/dist/list-chrome/fr-FR.d.ts +1 -1
- package/dist/list-chrome/fr-FR.js +9 -1
- package/dist/navigation-item.d.ts +4 -2
- package/dist/navigation-item.js +2 -2
- package/dist/navigation-screen.js +10 -3
- package/dist/navigation.js +5 -1
- package/dist/page.d.ts +3 -2
- package/dist/page.js +23 -4
- package/dist/rejected-field.d.ts +25 -0
- package/dist/rejected-field.js +121 -0
- package/dist/rename-dialog.d.ts +2 -2
- package/dist/rename-dialog.js +1 -1
- package/dist/route-not-found.d.ts +5 -0
- package/dist/route-not-found.js +12 -0
- package/dist/router.d.ts +8 -2
- package/dist/router.js +10 -2
- package/dist/screen-title.d.ts +52 -0
- package/dist/screen-title.js +165 -0
- package/dist/stylelint.d.ts +1 -4
- package/dist/stylelint.js +4 -7
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +3 -3
- package/dist/vite.js +1 -0
- package/docs/build-and-versioning.md +109 -4
- package/docs/design-system/accessibility.md +18 -9
- package/docs/design-system/color.md +1 -1
- package/docs/design-system/custom-properties.md +3 -3
- package/docs/design-system/dialogs.md +71 -9
- package/docs/design-system/frame.md +276 -0
- package/docs/design-system/layout.md +24 -16
- package/docs/design-system/lists.md +17 -11
- package/docs/design-system/loading.md +20 -12
- package/docs/design-system/motion.md +41 -47
- package/docs/design-system/overview.md +8 -3
- package/docs/design-system/radius-and-elevation.md +2 -2
- package/docs/design-system/record-pages.md +9 -1
- package/docs/design-system/toasts.md +7 -1
- package/docs/framing-an-application.md +77 -23
- package/docs/lists.md +80 -39
- package/docs/overview.md +9 -3
- package/docs/screens.md +94 -3
- package/docs/testing.md +29 -0
- package/package.json +27 -19
package/dist/focus-back.js
CHANGED
|
@@ -12,14 +12,24 @@ const TRIGGERS = {
|
|
|
12
12
|
actions: '[aria-haspopup="menu"]',
|
|
13
13
|
};
|
|
14
14
|
/** Finds the bar DataViews draws the actions on the ticked items in. */
|
|
15
|
-
const BULK_BAR = '.dataviews-bulk-actions
|
|
15
|
+
const BULK_BAR = '.dataviews-bulk-actions';
|
|
16
|
+
/** Finds the open menu button of the bulk bar, whose menu DataViews draws outside the bar on a narrow screen. */
|
|
17
|
+
const BULK_MENU_OPEN = `${BULK_BAR} [aria-haspopup="menu"][aria-expanded="true"]`;
|
|
18
|
+
/**
|
|
19
|
+
* Reports whether a control sits in a menu while the menu button of the bulk bar is open.
|
|
20
|
+
* @param control - The control.
|
|
21
|
+
* @returns Whether it does, as a bulk action chosen on a narrow screen does.
|
|
22
|
+
*/
|
|
23
|
+
function inBulkMenu(control) {
|
|
24
|
+
return control.closest('[role="menu"]') !== null && document.querySelector(BULK_MENU_OPEN) !== null;
|
|
25
|
+
}
|
|
16
26
|
/**
|
|
17
27
|
* Returns the trigger a control stands for.
|
|
18
28
|
* @param control - The control.
|
|
19
29
|
* @returns The bulk bar, the media, the title or the phone row holding the control, the actions menu otherwise.
|
|
20
30
|
*/
|
|
21
31
|
function triggerAt(control) {
|
|
22
|
-
if (control.closest(BULK_BAR) !== null) {
|
|
32
|
+
if (control.closest(BULK_BAR) !== null || inBulkMenu(control)) {
|
|
23
33
|
return 'bulk';
|
|
24
34
|
}
|
|
25
35
|
const triggers = ['media', 'title', 'row'];
|
package/dist/form-dialog.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export interface FormDialogProps {
|
|
|
14
14
|
cancelLabel?: string;
|
|
15
15
|
/** Whether the form may be sent now, false while a needed field is empty, true when left out. */
|
|
16
16
|
canSubmit?: boolean;
|
|
17
|
-
/** Sends the form. Return nothing to close
|
|
18
|
-
onSubmit: () => void | DialogAnswer | PromiseLike<unknown>;
|
|
17
|
+
/** Sends the form with the time limit's signal. Return nothing to close, the write to hold it, or an answer. */
|
|
18
|
+
onSubmit: (signal: AbortSignal) => void | DialogAnswer | PromiseLike<unknown>;
|
|
19
19
|
/** Takes the dialog away, once its card has left the page. */
|
|
20
20
|
onClose: () => void;
|
|
21
21
|
}
|
package/dist/form-dialog.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { speak } from '@wordpress/a11y';
|
|
4
4
|
import { Button, Dialog, Notice, Stack } from '@wordpress/ui';
|
|
5
5
|
import { useId, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
-
import { POPUP_CLASS,
|
|
6
|
+
import { POPUP_CLASS, isThenable, refuseSecondClick, useAnswering, useDialogOpen, useFinalFocus, } from './dialog-open.js';
|
|
7
7
|
/**
|
|
8
8
|
* Renders a form dialog opened from a button outside a list row, on the WPDS dialog, the first field focused.
|
|
9
9
|
* @param props - The fields, the title, the help sentence, the labels, the send gate and the handlers.
|
|
@@ -12,6 +12,7 @@ import { POPUP_CLASS, answered, isThenable, refuseSecondClick, useDialogOpen, us
|
|
|
12
12
|
export function FormDialog({ children, title, description, submitLabel, cancelLabel, canSubmit = true, onSubmit, onClose, }) {
|
|
13
13
|
const { open, change, exitWatch } = useDialogOpen(onClose);
|
|
14
14
|
const finalFocus = useFinalFocus();
|
|
15
|
+
const answering = useAnswering();
|
|
15
16
|
const [busy, setBusy] = useState(false);
|
|
16
17
|
const [failure, setFailure] = useState();
|
|
17
18
|
const [failures, setFailures] = useState(0);
|
|
@@ -46,7 +47,7 @@ export function FormDialog({ children, title, description, submitLabel, cancelLa
|
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
clear();
|
|
49
|
-
const answer =
|
|
50
|
+
const answer = answering(onSubmit);
|
|
50
51
|
if (!isThenable(answer)) {
|
|
51
52
|
settle(answer);
|
|
52
53
|
return;
|
package/dist/frame.d.ts
CHANGED
|
@@ -4,18 +4,22 @@ type ThemeColor = ComponentProps<typeof ThemeProvider>['color'];
|
|
|
4
4
|
export interface FrameRootProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
location?: string;
|
|
7
|
+
/** The path the router has finished showing, whose change speaks the new screen's title, nothing without it. */
|
|
8
|
+
shownPath?: string;
|
|
9
|
+
/** The name of the app, which the tab title ends with. The tab title is left alone without it. */
|
|
10
|
+
appName?: string;
|
|
7
11
|
/** The theme colour of the frame, a #26292b background when absent. */
|
|
8
12
|
chromeColor?: ThemeColor;
|
|
9
13
|
/** The theme colour of the canvas, a #fcfcfc background when absent. */
|
|
10
14
|
canvasColor?: ThemeColor;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
|
-
* Frames an admin application, folding its sidebar away on a narrow viewport,
|
|
14
|
-
* and
|
|
15
|
-
* @param props - The regions, the current location, and the region colors.
|
|
17
|
+
* Frames an admin application, folding its sidebar away on a narrow viewport, holds the moves its sidebar
|
|
18
|
+
* parts share, and speaks the title of each new screen and sets the tab title from it.
|
|
19
|
+
* @param props - The regions, the current location, the shown path, the app name, and the region colors.
|
|
16
20
|
* @returns The frame element.
|
|
17
21
|
*/
|
|
18
|
-
declare function Root({ children, location, chromeColor, canvasColor }: FrameRootProps): import("react").JSX.Element;
|
|
22
|
+
declare function Root({ children, location, shownPath, appName, chromeColor, canvasColor, }: FrameRootProps): import("react").JSX.Element;
|
|
19
23
|
export interface FrameSidebarProps {
|
|
20
24
|
children: ReactNode;
|
|
21
25
|
brand?: ReactNode;
|
package/dist/frame.js
CHANGED
|
@@ -8,6 +8,7 @@ import { Drawer, VisuallyHidden } from '@wordpress/ui';
|
|
|
8
8
|
import { Children, createContext, useContext, useEffect, useState } from 'react';
|
|
9
9
|
import { SMALL_VIEWPORT } from './breakpoints.js';
|
|
10
10
|
import { NavigationStateContext, createNavigationState, takeDrawerStays } from './navigation-state.js';
|
|
11
|
+
import { ScreenTitleContext, TitleWatch, createScreenTitles } from './screen-title.js';
|
|
11
12
|
import { useMediaQuery } from './use-media-query.js';
|
|
12
13
|
/**
|
|
13
14
|
* The chrome background seeded when an application names none.
|
|
@@ -24,17 +25,18 @@ const FrameContext = createContext({
|
|
|
24
25
|
navigation: createNavigationState(),
|
|
25
26
|
});
|
|
26
27
|
/**
|
|
27
|
-
* Frames an admin application, folding its sidebar away on a narrow viewport,
|
|
28
|
-
* and
|
|
29
|
-
* @param props - The regions, the current location, and the region colors.
|
|
28
|
+
* Frames an admin application, folding its sidebar away on a narrow viewport, holds the moves its sidebar
|
|
29
|
+
* parts share, and speaks the title of each new screen and sets the tab title from it.
|
|
30
|
+
* @param props - The regions, the current location, the shown path, the app name, and the region colors.
|
|
30
31
|
* @returns The frame element.
|
|
31
32
|
*/
|
|
32
|
-
function Root({ children, location, chromeColor = CHROME_COLOR, canvasColor = CANVAS_COLOR }) {
|
|
33
|
+
function Root({ children, location, shownPath, appName, chromeColor = CHROME_COLOR, canvasColor = CANVAS_COLOR, }) {
|
|
33
34
|
const small = useMediaQuery(SMALL_VIEWPORT);
|
|
34
35
|
const [layout, setLayout] = useState(null);
|
|
35
36
|
const [navigation] = useState(createNavigationState);
|
|
37
|
+
const [titles] = useState(createScreenTitles);
|
|
36
38
|
const classes = small ? 'godmin-layout godmin-layout--small' : 'godmin-layout';
|
|
37
|
-
return (_jsx(ThemeProvider, { color: chromeColor, children: _jsx(FrameContext.Provider, { value: { small, location, layout, navigation }, children: _jsx(NavigationStateContext.Provider, { value: navigation, children: _jsx("div", { ref: setLayout, className: classes, children: _jsx(CanvasColorContext.Provider, { value: canvasColor, children: children }) }) }) }) }));
|
|
39
|
+
return (_jsx(ThemeProvider, { color: chromeColor, children: _jsx(FrameContext.Provider, { value: { small, location, layout, navigation }, children: _jsx(NavigationStateContext.Provider, { value: navigation, children: _jsxs(ScreenTitleContext.Provider, { value: titles, children: [_jsx(TitleWatch, { titles: titles, shownPath: shownPath, location: location, appName: appName }), _jsx("div", { ref: setLayout, className: classes, children: _jsx(CanvasColorContext.Provider, { value: canvasColor, children: children }) })] }) }) }) }));
|
|
38
40
|
}
|
|
39
41
|
const CanvasColorContext = createContext(undefined);
|
|
40
42
|
/**
|
|
@@ -62,6 +64,14 @@ function Sidebar({ children, brand, menuLabel = __('Open navigation panel'), lab
|
|
|
62
64
|
}
|
|
63
65
|
return (_jsx(TopBar, { brand: brand, menuLabel: menuLabel, children: content }));
|
|
64
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns the edge the drawer opens from and swipes away to, the start edge of the frame.
|
|
69
|
+
* @param layout - The frame element, null before it is drawn.
|
|
70
|
+
* @returns Right in a right-to-left frame, else left.
|
|
71
|
+
*/
|
|
72
|
+
function drawerSide(layout) {
|
|
73
|
+
return layout !== null && getComputedStyle(layout).direction === 'rtl' ? 'right' : 'left';
|
|
74
|
+
}
|
|
65
75
|
/**
|
|
66
76
|
* Renders the narrow viewport chrome: a menu button opening the sidebar content in
|
|
67
77
|
* a drawer, beside the brand. The drawer closes on a page change, unless a drilldown row or Back made it,
|
|
@@ -77,7 +87,7 @@ function TopBar({ children, brand, menuLabel, }) {
|
|
|
77
87
|
setOpen(false);
|
|
78
88
|
}
|
|
79
89
|
}, [location, navigation]);
|
|
80
|
-
return (_jsxs("div", { className: "godmin-layout__topbar", children: [_jsxs(Drawer.Root, { open: open, onOpenChange: setOpen, children: [_jsx(Drawer.Trigger, { render: _jsx("button", { type: "button", className: "godmin-layout__menu", "aria-label": menuLabel }), children: _jsx(Icon, { icon: menu }) }), _jsxs(Drawer.Popup, { className: "godmin-layout__drawer", portal: _jsx(Drawer.Portal, { container: layout }), children: [_jsx(VisuallyHidden, { render: _jsx(Drawer.Title, {}), children: __('Navigation') }), children, _jsx(VisuallyHidden, { render: _jsx(Drawer.Action, { variant: "unstyled", tabIndex: -1 }), children: __('Close navigation panel') })] })] }), brand] }));
|
|
90
|
+
return (_jsxs("div", { className: "godmin-layout__topbar", children: [_jsxs(Drawer.Root, { open: open, onOpenChange: setOpen, swipeDirection: drawerSide(layout), children: [_jsx(Drawer.Trigger, { render: _jsx("button", { type: "button", className: "godmin-layout__menu", "aria-label": menuLabel }), children: _jsx(Icon, { icon: menu }) }), _jsxs(Drawer.Popup, { className: "godmin-layout__drawer", portal: _jsx(Drawer.Portal, { container: layout }), children: [_jsx(VisuallyHidden, { render: _jsx(Drawer.Title, {}), children: __('Navigation') }), children, _jsx(VisuallyHidden, { render: _jsx(Drawer.Action, { variant: "unstyled", tabIndex: -1 }), children: __('Close navigation panel') })] })] }), brand] }));
|
|
81
91
|
}
|
|
82
92
|
/**
|
|
83
93
|
* Tells whether notices hold anything React draws.
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ export { PageBreadcrumb, PageBreadcrumbs } from './page-breadcrumbs.js';
|
|
|
42
42
|
export type { PageBreadcrumbProps, PageBreadcrumbsProps } from './page-breadcrumbs.js';
|
|
43
43
|
export { PageTab, PageTabs } from './page-tabs.js';
|
|
44
44
|
export type { PageTabProps, PageTabsProps } from './page-tabs.js';
|
|
45
|
+
export { useRejectedField } from './rejected-field.js';
|
|
46
|
+
export type { RejectedField, RejectedValidity } from './rejected-field.js';
|
|
45
47
|
export { RenameDialog } from './rename-dialog.js';
|
|
46
48
|
export type { RenameDialogProps } from './rename-dialog.js';
|
|
47
49
|
export { useRowKeys } from './row-keys.js';
|
|
@@ -62,6 +64,6 @@ export type { GuardedField, OfferedView, ViewGuard } from './view-guard.js';
|
|
|
62
64
|
* The design system version window this build was tested against.
|
|
63
65
|
*/
|
|
64
66
|
export declare const SUPPORTED_WPDS: {
|
|
65
|
-
readonly '@wordpress/ui': ">=0.
|
|
66
|
-
readonly '@wordpress/theme': ">=
|
|
67
|
+
readonly '@wordpress/ui': ">=0.26.0 <0.27.0";
|
|
68
|
+
readonly '@wordpress/theme': ">=4.0.0 <5.0.0";
|
|
67
69
|
};
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { openOnTap } from './open-on-tap.js';
|
|
|
21
21
|
export { ErrorNotice, LoadMore, Page, PageTitle, SectionTitle } from './page.js';
|
|
22
22
|
export { PageBreadcrumb, PageBreadcrumbs } from './page-breadcrumbs.js';
|
|
23
23
|
export { PageTab, PageTabs } from './page-tabs.js';
|
|
24
|
+
export { useRejectedField } from './rejected-field.js';
|
|
24
25
|
export { RenameDialog } from './rename-dialog.js';
|
|
25
26
|
export { useRowKeys } from './row-keys.js';
|
|
26
27
|
export { RepeatRows, RowControls } from './rows.js';
|
|
@@ -34,6 +35,6 @@ export { offeredView, viewNarrows } from './view-guard.js';
|
|
|
34
35
|
* The design system version window this build was tested against.
|
|
35
36
|
*/
|
|
36
37
|
export const SUPPORTED_WPDS = {
|
|
37
|
-
'@wordpress/ui': '>=0.
|
|
38
|
-
'@wordpress/theme': '>=
|
|
38
|
+
'@wordpress/ui': '>=0.26.0 <0.27.0',
|
|
39
|
+
'@wordpress/theme': '>=4.0.0 <5.0.0',
|
|
39
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ListChromeCatalog } from '../list-chrome.js';
|
|
2
|
-
/** The Spanish list chrome, list dates, sidebar
|
|
2
|
+
/** The Spanish list chrome, list dates, sidebar, frame, no results, time-out and live region words, from es-ES.po. */
|
|
3
3
|
declare const catalog: ListChromeCatalog;
|
|
4
4
|
export default catalog;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
/** The Spanish list chrome, list dates, sidebar
|
|
2
|
+
/** The Spanish list chrome, list dates, sidebar, frame, no results, time-out and live region words, from es-ES.po. */
|
|
3
3
|
const catalog = {
|
|
4
4
|
'': { lang: 'es-ES', 'plural-forms': 'nplurals=2; plural=(n != 1);' },
|
|
5
|
-
'%1$s of %2$s
|
|
5
|
+
'%1$s of %2$s item': ['%1$s de %2$s elemento', '%1$s de %2$s elementos'],
|
|
6
|
+
'%1$s ‹ %2$s': ['%1$s ‹ %2$s'],
|
|
6
7
|
'%1$s, %2$s': ['%1$s, %2$s'],
|
|
7
8
|
'%1$s: %2$s': ['%1$s: %2$s'],
|
|
8
|
-
'%s
|
|
9
|
-
'%s
|
|
9
|
+
'%s item': ['%s elemento', '%s elementos'],
|
|
10
|
+
'%s item selected': ['%s elemento seleccionado', '%s elementos seleccionados'],
|
|
10
11
|
'%s, selected': ['%s, seleccionado'],
|
|
11
12
|
'%s: <groupName />': ['%s: <groupName />'],
|
|
12
13
|
'(no title)': ['(sin título)'],
|
|
@@ -78,9 +79,6 @@ const catalog = {
|
|
|
78
79
|
'April abbreviation\u0004Apr': ['Abr'],
|
|
79
80
|
August: ['agosto'],
|
|
80
81
|
'August abbreviation\u0004Aug': ['Ago'],
|
|
81
|
-
'Automatically load more content as you scroll, instead of showing pagination links.': [
|
|
82
|
-
'Carga automáticamente más contenido a medida que navegas, en lugar de mostrar enlaces de paginación.',
|
|
83
|
-
],
|
|
84
82
|
Back: ['Volver'],
|
|
85
83
|
Before: ['Antes'],
|
|
86
84
|
'Before (inc)': ['Antes (incl.)'],
|
|
@@ -91,6 +89,7 @@ const catalog = {
|
|
|
91
89
|
Conditions: ['Condiciones'],
|
|
92
90
|
Contains: ['Contiene'],
|
|
93
91
|
'Coordinated Universal Time': ['Hora universal coordinada'],
|
|
92
|
+
'Could not get a valid response from the server.': ['No se pudo obtener una respuesta válida del servidor.'],
|
|
94
93
|
'Current page': ['Página actual'],
|
|
95
94
|
'Date calendar': ['Calendario de fechas'],
|
|
96
95
|
'Date range calendar': ['Calendario de rango de fechas'],
|
|
@@ -103,7 +102,6 @@ const catalog = {
|
|
|
103
102
|
'Density option for DataView layout\u0004Compact': ['Compacto'],
|
|
104
103
|
'Deselect all': ['Anular selección de todo'],
|
|
105
104
|
"Doesn't contain": ['No contiene'],
|
|
106
|
-
'Enable infinite scroll': ['Activar el desplazamiento infinito'],
|
|
107
105
|
'F j, Y g:i a': ['j \\d\\e F \\d\\e Y H:i'],
|
|
108
106
|
False: ['Falso'],
|
|
109
107
|
February: ['febrero'],
|
|
@@ -154,6 +152,7 @@ const catalog = {
|
|
|
154
152
|
'No results': ['No hay resultados'],
|
|
155
153
|
'No results found': ['No se encontraron resultados'],
|
|
156
154
|
'Not on': ['No el'],
|
|
155
|
+
Notifications: ['Avisos'],
|
|
157
156
|
November: ['noviembre'],
|
|
158
157
|
'November abbreviation\u0004Nov': ['Nov'],
|
|
159
158
|
October: ['octubre'],
|
|
@@ -175,6 +174,7 @@ const catalog = {
|
|
|
175
174
|
Reset: ['Restablecer'],
|
|
176
175
|
'Reset search': ['Restablecer la búsqueda'],
|
|
177
176
|
'Reset view': ['Restablecer vista'],
|
|
177
|
+
'Route not found': ['Ruta no encontrada'],
|
|
178
178
|
'Row %d': ['Fila %d'],
|
|
179
179
|
Sat: ['Sáb'],
|
|
180
180
|
Saturday: ['sábado'],
|
|
@@ -191,6 +191,7 @@ const catalog = {
|
|
|
191
191
|
Sun: ['Dom'],
|
|
192
192
|
Sunday: ['domingo'],
|
|
193
193
|
Table: ['Tabla'],
|
|
194
|
+
"The page you're looking for does not exist": ['La página que estás buscando no existe'],
|
|
194
195
|
Thu: ['Jue'],
|
|
195
196
|
Thursday: ['jueves'],
|
|
196
197
|
'Timezone: %s': ['Zona horaria: %s'],
|
|
@@ -202,11 +203,13 @@ const catalog = {
|
|
|
202
203
|
],
|
|
203
204
|
Tue: ['Mar'],
|
|
204
205
|
Tuesday: ['martes'],
|
|
206
|
+
'Unable to connect. Please check your Internet connection.': ['No se puede conectar. Revisa tu conexión a Internet.'],
|
|
205
207
|
'Unknown status for %1$s': ['Estado desconocido para %1$s'],
|
|
206
208
|
'View is used as a noun\u0004View options': ['Ver opciones'],
|
|
207
209
|
Wed: ['Mié'],
|
|
208
210
|
Wednesday: ['miércoles'],
|
|
209
211
|
am: ['am'],
|
|
212
|
+
'menu item requiring further input\u0004%s…': ['%s…'],
|
|
210
213
|
'paging\u0004<div>Page</div>%1$s<div>of %2$d</div>': ['<div>Página</div>%1$s<div>de %2$d</div>'],
|
|
211
214
|
pm: ['pm'],
|
|
212
215
|
'start of week\u00041': ['1'],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ListChromeCatalog } from '../list-chrome.js';
|
|
2
|
-
/** The French list dates, dialog, sidebar
|
|
2
|
+
/** The French list dates, dialog, sidebar, frame, no results, time-out and live region words, from fr-FR.po. */
|
|
3
3
|
declare const catalog: ListChromeCatalog;
|
|
4
4
|
export default catalog;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
/** The French list dates, dialog, sidebar
|
|
2
|
+
/** The French list dates, dialog, sidebar, frame, no results, time-out and live region words, from fr-FR.po. */
|
|
3
3
|
const catalog = {
|
|
4
4
|
'': { lang: 'fr-FR', 'plural-forms': 'nplurals=2; plural=(n > 1);' },
|
|
5
|
+
'%1$s ‹ %2$s': ['%1$s ‹ %2$s'],
|
|
5
6
|
AM: ['AM'],
|
|
6
7
|
April: ['avril'],
|
|
7
8
|
'April abbreviation\u0004Apr': ['Avr'],
|
|
@@ -10,6 +11,7 @@ const catalog = {
|
|
|
10
11
|
Back: ['Retour'],
|
|
11
12
|
Close: ['Fermer'],
|
|
12
13
|
'Close navigation panel': ['Fermer le panneau de navigation'],
|
|
14
|
+
'Could not get a valid response from the server.': ['Impossible d’obtenir du serveur une réponse valide.'],
|
|
13
15
|
December: ['décembre'],
|
|
14
16
|
'December abbreviation\u0004Dec': ['Déc'],
|
|
15
17
|
'F j, Y g:i a': ['d F Y G\\hi'],
|
|
@@ -33,12 +35,14 @@ const catalog = {
|
|
|
33
35
|
Monday: ['lundi'],
|
|
34
36
|
Navigation: ['Navigation'],
|
|
35
37
|
'No results found': ['Aucun résultat trouvé'],
|
|
38
|
+
Notifications: ['Notifications'],
|
|
36
39
|
November: ['novembre'],
|
|
37
40
|
'November abbreviation\u0004Nov': ['Nov'],
|
|
38
41
|
October: ['octobre'],
|
|
39
42
|
'October abbreviation\u0004Oct': ['Oct'],
|
|
40
43
|
'Open navigation panel': ['Ouvrir le panneau de navigation'],
|
|
41
44
|
PM: ['PM'],
|
|
45
|
+
'Route not found': ['Route introuvable'],
|
|
42
46
|
Sat: ['Sam'],
|
|
43
47
|
Saturday: ['samedi'],
|
|
44
48
|
'Scrollable section': ['Section défilable'],
|
|
@@ -46,6 +50,7 @@ const catalog = {
|
|
|
46
50
|
'September abbreviation\u0004Sep': ['Sep'],
|
|
47
51
|
Sun: ['Dim'],
|
|
48
52
|
Sunday: ['dimanche'],
|
|
53
|
+
"The page you're looking for does not exist": ["La page que vous cherchez n'existe pas"],
|
|
49
54
|
Thu: ['Jeu'],
|
|
50
55
|
Thursday: ['jeudi'],
|
|
51
56
|
"Try adjusting your search or filters to find what you're looking for.": [
|
|
@@ -53,6 +58,9 @@ const catalog = {
|
|
|
53
58
|
],
|
|
54
59
|
Tue: ['Mar'],
|
|
55
60
|
Tuesday: ['mardi'],
|
|
61
|
+
'Unable to connect. Please check your Internet connection.': [
|
|
62
|
+
'Impossible de se connecter. Veuillez vérifier votre connexion Internet.',
|
|
63
|
+
],
|
|
56
64
|
Wed: ['Mer'],
|
|
57
65
|
Wednesday: ['mercredi'],
|
|
58
66
|
am: ['am'],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyRouter, LinkComponentProps, RegisteredRouter } from '@tanstack/react-router';
|
|
2
|
-
import type { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
3
3
|
import type { RowRoutes } from './path-matching.js';
|
|
4
4
|
/** The class every sidebar row link carries. */
|
|
5
5
|
export declare const ROW_CLASS = "godmin-navigation-item";
|
|
@@ -28,6 +28,8 @@ interface RowProps {
|
|
|
28
28
|
id?: string;
|
|
29
29
|
/** What ends the row, such as a suffix or a chevron. */
|
|
30
30
|
end?: ReactNode;
|
|
31
|
+
/** The router link the row draws, TanStack's Link when absent. */
|
|
32
|
+
linkComponent?: ComponentType<LinkComponentProps>;
|
|
31
33
|
children: ReactNode;
|
|
32
34
|
}
|
|
33
35
|
/**
|
|
@@ -43,7 +45,7 @@ export declare function RowSuffix({ children }: {
|
|
|
43
45
|
* @param props - The link props, where the row goes, the icon, the classes, the id, the end of the row and its label.
|
|
44
46
|
* @returns The list item element, or null.
|
|
45
47
|
*/
|
|
46
|
-
export declare function Row({ link, routes, icon, className, id, end, children }: RowProps): import("react").JSX.Element | null;
|
|
48
|
+
export declare function Row({ link, routes, icon, className, id, end, linkComponent: RowLink, children }: RowProps): import("react").JSX.Element | null;
|
|
47
49
|
/**
|
|
48
50
|
* Renders a sidebar row that goes to a page: its icon, its label and its suffix, current on every address under it.
|
|
49
51
|
* @param props - The TanStack Link props, the icon, the suffix and the label.
|
package/dist/navigation-item.js
CHANGED
|
@@ -35,12 +35,12 @@ export function RowSuffix({ children }) {
|
|
|
35
35
|
* @param props - The link props, where the row goes, the icon, the classes, the id, the end of the row and its label.
|
|
36
36
|
* @returns The list item element, or null.
|
|
37
37
|
*/
|
|
38
|
-
export function Row({ link, routes, icon, className, id, end, children }) {
|
|
38
|
+
export function Row({ link, routes, icon, className, id, end, linkComponent: RowLink = Link, children }) {
|
|
39
39
|
const { can } = useContext(ScreenContext);
|
|
40
40
|
if (!canOpenRoutes(routes.capabilities, can)) {
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
|
-
return (_jsx("li", { children: _jsxs(
|
|
43
|
+
return (_jsx("li", { children: _jsxs(RowLink, { ...link, id: id ?? link.id, className: link.className === undefined ? className : `${className} ${link.className}`, children: [_jsx(RowIcon, { icon: icon }), _jsx("div", { className: "godmin-navigation-item__label", children: children }), end] }) }));
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Renders a sidebar row that goes to a page: its icon, its label and its suffix, current on every address under it.
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { __, isRTL } from '@wordpress/i18n';
|
|
3
3
|
import { Icon, chevronLeft, chevronRight } from '@wordpress/icons';
|
|
4
|
-
import {
|
|
5
|
-
import { useContext } from 'react';
|
|
4
|
+
import { cloneElement, useContext } from 'react';
|
|
6
5
|
import { NavigationStateContext, ScreenContext, isPlainClick, recordBack } from './navigation-state.js';
|
|
7
6
|
/** The class of the title row, the Site Editor's name for it. */
|
|
8
7
|
const TITLE_ROW = 'godmin-navigation-screen__title-icon';
|
|
8
|
+
/** The class of Back. */
|
|
9
|
+
const BACK = 'godmin-navigation-screen__back';
|
|
9
10
|
/** The class of the region holding the title row and the content. */
|
|
10
11
|
const MAIN = 'godmin-navigation-screen__main';
|
|
11
12
|
/**
|
|
@@ -27,12 +28,18 @@ function Region({ content, className, as: Tag = 'div' }) {
|
|
|
27
28
|
function BackLink({ target, label }) {
|
|
28
29
|
const state = useContext(NavigationStateContext);
|
|
29
30
|
const { targetOf } = useContext(ScreenContext);
|
|
31
|
+
const own = target.props;
|
|
30
32
|
const onClick = (event) => {
|
|
33
|
+
own.onClick?.(event);
|
|
31
34
|
if (state !== undefined && isPlainClick(event)) {
|
|
32
35
|
recordBack(state, targetOf?.(target));
|
|
33
36
|
}
|
|
34
37
|
};
|
|
35
|
-
return (
|
|
38
|
+
return cloneElement(target, {
|
|
39
|
+
'aria-label': own['aria-label'] ?? label,
|
|
40
|
+
className: own.className === undefined ? BACK : `${BACK} ${own.className}`,
|
|
41
|
+
onClick,
|
|
42
|
+
}, _jsx(Icon, { icon: isRTL() ? chevronRight : chevronLeft, size: 24 }));
|
|
36
43
|
}
|
|
37
44
|
/**
|
|
38
45
|
* Renders a sidebar screen as the Site Editor draws it: a title row with Back, the title and the actions,
|
package/dist/navigation.js
CHANGED
|
@@ -110,7 +110,11 @@ function ScreenWrapper({ state, children }) {
|
|
|
110
110
|
setDirection(move.direction);
|
|
111
111
|
}
|
|
112
112
|
}, [state, router]);
|
|
113
|
-
return (_jsx("div", { ref: wrapper, tabIndex: -1, className: direction === undefined ? WRAPPER : `${WRAPPER} ${WRAPPER}--${direction}`,
|
|
113
|
+
return (_jsx("div", { ref: wrapper, tabIndex: -1, className: direction === undefined ? WRAPPER : `${WRAPPER} ${WRAPPER}--${direction}`, onAnimationEnd: (event) => {
|
|
114
|
+
if (event.target === event.currentTarget) {
|
|
115
|
+
setDirection(undefined);
|
|
116
|
+
}
|
|
117
|
+
}, children: children }));
|
|
114
118
|
}
|
|
115
119
|
/**
|
|
116
120
|
* Renders the sidebar menu, as WordPress's new admin names it: the root screen drawn from its title and rows,
|
package/dist/page.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare function useHeadingUnderPage(): HeadingTag;
|
|
13
13
|
/**
|
|
14
|
-
* Renders a screen's title as the page heading.
|
|
14
|
+
* Renders a screen's title as the page heading, and reports its text to the frame when no Page holds it.
|
|
15
15
|
* @param props - The title text, the type scale to render it at and its heading level, 1 when absent.
|
|
16
16
|
* @returns The page title element.
|
|
17
17
|
*/
|
|
@@ -54,7 +54,8 @@ export interface PageProps {
|
|
|
54
54
|
children: ReactNode;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Renders a screen: a header with the title, actions and subtitle, then optional tabs and the content
|
|
57
|
+
* Renders a screen: a header with the title, actions and subtitle, then optional tabs and the content, and
|
|
58
|
+
* reports its title to the frame, as waiting while it holds nothing but one LoadingScreen.
|
|
58
59
|
* @param props - The title, subtitle, actions, tabs, aside and its name, breadcrumbs, list flag, list name and ref,
|
|
59
60
|
* extra class, title level and content.
|
|
60
61
|
* @returns The page element.
|
package/dist/page.js
CHANGED
|
@@ -2,10 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
/* oxlint-disable react/only-export-components -- the page kit ships its parts
|
|
3
3
|
beside the type they share. */
|
|
4
4
|
import { Button, Notice, Stack, Text } from '@wordpress/ui';
|
|
5
|
-
import { Children, createContext, useContext, useImperativeHandle, useRef } from 'react';
|
|
5
|
+
import { Children, createContext, isValidElement, useContext, useImperativeHandle, useRef } from 'react';
|
|
6
|
+
import { LoadingScreen } from './loading.js';
|
|
7
|
+
import { useReportTitle } from './screen-title.js';
|
|
6
8
|
import { useWideList } from './wide-list.js';
|
|
7
9
|
/** The level of the title of the Page around a section title, 1 outside any Page. */
|
|
8
10
|
const PageLevelContext = createContext(1);
|
|
11
|
+
/** How many Pages hold a part, 0 outside any Page. */
|
|
12
|
+
const PageDepthContext = createContext(0);
|
|
9
13
|
/**
|
|
10
14
|
* Returns the heading element of a level.
|
|
11
15
|
* @param level - The heading level, 1 to 4.
|
|
@@ -22,11 +26,13 @@ export function useHeadingUnderPage() {
|
|
|
22
26
|
return headingTag(useContext(PageLevelContext) + 1);
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
|
-
* Renders a screen's title as the page heading.
|
|
29
|
+
* Renders a screen's title as the page heading, and reports its text to the frame when no Page holds it.
|
|
26
30
|
* @param props - The title text, the type scale to render it at and its heading level, 1 when absent.
|
|
27
31
|
* @returns The page title element.
|
|
28
32
|
*/
|
|
29
33
|
export function PageTitle({ children, variant = 'heading-lg', level = 1, }) {
|
|
34
|
+
const alone = useContext(PageDepthContext) === 0;
|
|
35
|
+
useReportTitle(alone && typeof children === 'string' ? children : undefined, 0, false);
|
|
30
36
|
const Heading = headingTag(level);
|
|
31
37
|
return (_jsx(Text, { variant: variant, render: _jsx(Heading, {}), children: children }));
|
|
32
38
|
}
|
|
@@ -90,14 +96,27 @@ function PageHeading({ title, level, breadcrumbs }) {
|
|
|
90
96
|
return (_jsxs("div", { className: "godmin-page__heading", children: [breadcrumbs, _jsx(PageTitle, { level: level, children: title })] }));
|
|
91
97
|
}
|
|
92
98
|
/**
|
|
93
|
-
*
|
|
99
|
+
* Tells whether a page waits for its record: its whole content is one LoadingScreen element and it has no aside.
|
|
100
|
+
* @param aside - The aside the page was given.
|
|
101
|
+
* @param children - The content the page was given.
|
|
102
|
+
* @returns Whether the page holds nothing but that LoadingScreen.
|
|
103
|
+
*/
|
|
104
|
+
function waitsForRecord(aside, children) {
|
|
105
|
+
const content = Children.toArray(children);
|
|
106
|
+
return aside === undefined && content.length === 1 && isValidElement(content[0]) && content[0].type === LoadingScreen;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Renders a screen: a header with the title, actions and subtitle, then optional tabs and the content, and
|
|
110
|
+
* reports its title to the frame, as waiting while it holds nothing but one LoadingScreen.
|
|
94
111
|
* @param props - The title, subtitle, actions, tabs, aside and its name, breadcrumbs, list flag, list name and ref,
|
|
95
112
|
* extra class, title level and content.
|
|
96
113
|
* @returns The page element.
|
|
97
114
|
*/
|
|
98
115
|
export function Page({ title, subtitle, actions, tabs, aside, asideLabel, breadcrumbs, list = false, listLabel, listRef, className, headingLevel = 1, children, }) {
|
|
99
116
|
const classes = className === undefined ? 'godmin-page' : `godmin-page ${className}`;
|
|
100
|
-
|
|
117
|
+
const depth = useContext(PageDepthContext) + 1;
|
|
118
|
+
useReportTitle(title, depth, waitsForRecord(aside, children));
|
|
119
|
+
return (_jsx(PageDepthContext.Provider, { value: depth, children: _jsx(PageLevelContext.Provider, { value: headingLevel, children: _jsxs(Stack, { direction: "column", gap: "lg", className: classes, children: [_jsxs(Stack, { direction: "column", render: _jsx("header", {}), className: "godmin-page__header", children: [_jsxs(Stack, { direction: "row", wrap: "wrap", gap: "md", align: "center", justify: "space-between", className: "godmin-page__head", children: [_jsx(PageHeading, { title: title, level: headingLevel, breadcrumbs: breadcrumbs }), actions !== undefined && (_jsx(Stack, { direction: "row", gap: "sm", align: "center", children: actions }))] }), subtitle !== undefined && (_jsx(Text, { variant: "body-md", render: _jsx("p", {}), className: "godmin-page__subtitle", children: subtitle }))] }), tabs !== undefined && _jsx("div", { className: "godmin-page__tabs", children: tabs }), _jsx(PageBody, { aside: aside, asideLabel: asideLabel, children: list ? (_jsx(ListRegion, { label: listLabel, listRef: listRef, children: children })) : (children) })] }) }) }));
|
|
101
120
|
}
|
|
102
121
|
/**
|
|
103
122
|
* Renders a page's content, beside its aside when it has one.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The custom validity a WPDS field takes while a server's message stands under it. */
|
|
2
|
+
export interface RejectedValidity {
|
|
3
|
+
/** Always invalid, so the message shows and holds the form back. */
|
|
4
|
+
type: 'invalid';
|
|
5
|
+
/** The words the field shows under it. */
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
/** A form control that holds a validity message of its own. */
|
|
9
|
+
type FieldElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;
|
|
10
|
+
/** What a field takes from the hook, and the way to put a server's message under it. */
|
|
11
|
+
export interface RejectedField {
|
|
12
|
+
/** The ref the field takes, so the hook knows the field it rejects. */
|
|
13
|
+
ref: (field: FieldElement | null) => void;
|
|
14
|
+
/** The custom validity the field takes, none while no message stands. */
|
|
15
|
+
validity: RejectedValidity | undefined;
|
|
16
|
+
/** Puts the message under the field and answers true, or answers false so the caller says it another way. */
|
|
17
|
+
reject: (message: string, sent: string) => boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Holds a server's message about one field under it, until what the message is about changes.
|
|
21
|
+
* @param held - What the message is about now, the value of the field in most forms.
|
|
22
|
+
* @returns The ref and the custom validity the field takes, and the way to reject what was sent.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useRejectedField(held: string): RejectedField;
|
|
25
|
+
export {};
|