@gopherium/godmin 0.15.0 → 0.16.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/README.md +8 -3
- package/dist/avatar.d.ts +4 -2
- package/dist/avatar.js +18 -3
- package/dist/base.css +48 -0
- package/dist/bulk.d.ts +22 -0
- package/dist/bulk.js +18 -0
- package/dist/confirm.d.ts +23 -0
- package/dist/confirm.js +12 -0
- package/dist/file-button.d.ts +24 -0
- package/dist/file-button.js +25 -0
- package/dist/frame.d.ts +2 -0
- package/dist/frame.js +9 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.js +5 -1
- package/dist/list-chrome/es-ES.js +48 -34
- package/dist/list-empty.d.ts +16 -0
- package/dist/list-empty.js +11 -0
- package/dist/list-view.d.ts +114 -0
- package/dist/list-view.js +246 -0
- package/dist/page-tabs.d.ts +1 -1
- package/dist/page-tabs.js +106 -7
- package/dist/rename.d.ts +24 -0
- package/dist/rename.js +20 -0
- package/dist/router.d.ts +2 -0
- package/dist/router.js +1 -0
- package/dist/testing.d.ts +22 -1
- package/dist/testing.js +38 -0
- package/dist/toaster.d.ts +6 -2
- package/dist/toaster.js +26 -3
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -23,6 +23,11 @@ pnpm add @gopherium/godmin
|
|
|
23
23
|
The design system packages are peer dependencies, so your application resolves
|
|
24
24
|
and pins them. GodMin never redistributes them.
|
|
25
25
|
|
|
26
|
+
## Browsers
|
|
27
|
+
|
|
28
|
+
GodMin needs `Intl.Segmenter`, which every browser WordPress supports has:
|
|
29
|
+
Chrome and Edge 87, Safari 14.1 and Firefox 125 or newer.
|
|
30
|
+
|
|
26
31
|
## Setup
|
|
27
32
|
|
|
28
33
|
Import the stylesheet once at your entry point, then mount `AdminRoot` around
|
|
@@ -47,10 +52,10 @@ two lines do for you.
|
|
|
47
52
|
|
|
48
53
|
| Entry point | Contents |
|
|
49
54
|
| --- | --- |
|
|
50
|
-
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavScreen`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `LoadingRows`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `useMediaQuery`, `useTokenDocument`, the breakpoints, `SUPPORTED_WPDS` |
|
|
55
|
+
| `@gopherium/godmin` | `AdminRoot`, `Frame`, `Page`, `PageTitle`, `PageTabs`, `PageTab`, `SectionTitle`, `InitialsAvatar`, `NavScreen`, `ErrorNotice`, `LoadMore`, `LogList`, `LogItem`, `LogTime`, `LoadingScreen`, `LoadingRows`, `Toaster`, `useToaster`, `RepeatRows`, `RowControls`, `useRowKeys`, `keyFromLabel`, `listChromeCatalogFor`, `LIST_CHROME_DOMAIN`, `ListEmpty`, `ConfirmBody`, `RenameBody`, `FileButton`, `useServerPaging`, `pageWindow`, `paginationOf`, `runEach`, `bulkNotes`, `useMediaQuery`, `useTokenDocument`, the breakpoints, `SUPPORTED_WPDS` |
|
|
51
56
|
| `@gopherium/godmin/base.css` | Cascade layer order, design tokens, host rules, frame and screen styles |
|
|
52
|
-
| `@gopherium/godmin/router` | `useCanvas`, `useFrameLocation`, the `canvas` route static data |
|
|
53
|
-
| `@gopherium/godmin/testing` | `installTestEnvironment`, `renderAdmin`, `setViewport`, `getAnnouncement`, `clearAnnouncements`, `assertElementPatched`, `WPDS_IGNORE_SELECTOR` |
|
|
57
|
+
| `@gopherium/godmin/router` | `useListView`, `listSearch`, `openOnTap`, `useCanvas`, `useFrameLocation`, the `canvas` route static data |
|
|
58
|
+
| `@gopherium/godmin/testing` | `installTestEnvironment`, `renderAdmin`, `setViewport`, `getAnnouncement`, `clearAnnouncements`, `assertElementPatched`, `WPDS_IGNORE_SELECTOR`, `textClasses`, `badgeClasses`, `buttonClasses` |
|
|
54
59
|
| `@gopherium/godmin/vite` | `godminDedupe`, `godminSingleCopy`, `godminStylesheetFirst`, `duplicateCopies`, `hoistStylesheet` |
|
|
55
60
|
| `@gopherium/godmin/stylelint` | The design system stylelint rules |
|
|
56
61
|
|
package/dist/avatar.d.ts
CHANGED
|
@@ -12,10 +12,12 @@ export declare const AVATAR_COLORS: readonly AvatarColor[];
|
|
|
12
12
|
export interface InitialsAvatarProps {
|
|
13
13
|
/** The name the avatar stands for, whose first letter it draws. */
|
|
14
14
|
name: string;
|
|
15
|
+
/** The avatar's width and height in pixels, the stylesheet size when absent. */
|
|
16
|
+
size?: number;
|
|
15
17
|
}
|
|
16
18
|
/**
|
|
17
19
|
* Renders a round avatar with the first letter of a name, in the letter colour of the circle colour the name picks.
|
|
18
|
-
* @param props - The name the avatar stands for.
|
|
20
|
+
* @param props - The name the avatar stands for and its size.
|
|
19
21
|
* @returns The avatar element.
|
|
20
22
|
*/
|
|
21
|
-
export declare function InitialsAvatar({ name }: InitialsAvatarProps): import("react").JSX.Element;
|
|
23
|
+
export declare function InitialsAvatar({ name, size }: InitialsAvatarProps): import("react").JSX.Element;
|
package/dist/avatar.js
CHANGED
|
@@ -31,12 +31,27 @@ function initialOf(name) {
|
|
|
31
31
|
const [first = ''] = Array.from(name.trim());
|
|
32
32
|
return first.toLocaleUpperCase();
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* The share of the circle a letter takes, 12px in the 32px stylesheet circle.
|
|
36
|
+
*/
|
|
37
|
+
const LETTER_SHARE = 12 / 32;
|
|
38
|
+
/**
|
|
39
|
+
* Returns the inline size of an avatar drawn at the given size, none for the stylesheet size.
|
|
40
|
+
* @param size - The width and height in pixels, absent for the stylesheet size.
|
|
41
|
+
* @returns The circle and letter sizes, or nothing.
|
|
42
|
+
*/
|
|
43
|
+
function sizedBy(size) {
|
|
44
|
+
if (size === undefined) {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
return { inlineSize: size, blockSize: size, fontSize: size * LETTER_SHARE };
|
|
48
|
+
}
|
|
34
49
|
/**
|
|
35
50
|
* Renders a round avatar with the first letter of a name, in the letter colour of the circle colour the name picks.
|
|
36
|
-
* @param props - The name the avatar stands for.
|
|
51
|
+
* @param props - The name the avatar stands for and its size.
|
|
37
52
|
* @returns The avatar element.
|
|
38
53
|
*/
|
|
39
|
-
export function InitialsAvatar({ name }) {
|
|
54
|
+
export function InitialsAvatar({ name, size }) {
|
|
40
55
|
const { background, letter } = colorFor(name);
|
|
41
|
-
return (_jsx("span", { className: "godmin-avatar", "aria-hidden": "true", style: { backgroundColor: background, color: letter }, children: initialOf(name) }));
|
|
56
|
+
return (_jsx("span", { className: "godmin-avatar", "aria-hidden": "true", style: { backgroundColor: background, color: letter, ...sizedBy(size) }, children: initialOf(name) }));
|
|
42
57
|
}
|
package/dist/base.css
CHANGED
|
@@ -28,6 +28,13 @@ body {
|
|
|
28
28
|
text-decoration: none;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/* Ends a DataViews table title link wider than its column in an ellipsis, as WordPress cuts its titles. */
|
|
32
|
+
.dataviews-view-table tbody .dataviews-view-table__cell-content-wrapper.dataviews-title-field--clickable {
|
|
33
|
+
display: block;
|
|
34
|
+
align-content: center;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
}
|
|
37
|
+
|
|
31
38
|
/* Draws a DataViews media link without an underline or the browser link colour. */
|
|
32
39
|
.dataviews-column-primary__media--clickable {
|
|
33
40
|
color: inherit;
|
|
@@ -377,6 +384,19 @@ body {
|
|
|
377
384
|
margin-inline: var(--wpds-dimension-padding-2xl);
|
|
378
385
|
}
|
|
379
386
|
|
|
387
|
+
.godmin-page__list:has(> .godmin-list-overlay),
|
|
388
|
+
.godmin-list:has(> .godmin-list-overlay) {
|
|
389
|
+
position: relative;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.godmin-page > .godmin-page__list > .godmin-list-overlay,
|
|
393
|
+
.godmin-page__main > .godmin-page__list > .godmin-list-overlay,
|
|
394
|
+
.godmin-list > .godmin-list-overlay {
|
|
395
|
+
position: absolute;
|
|
396
|
+
inset: 0;
|
|
397
|
+
margin: 0;
|
|
398
|
+
}
|
|
399
|
+
|
|
380
400
|
.godmin-page__tabs {
|
|
381
401
|
margin-inline: calc(-1 * var(--godmin-canvas-gutter, 0px));
|
|
382
402
|
padding-inline: var(--godmin-canvas-gutter, 0px);
|
|
@@ -392,9 +412,36 @@ body {
|
|
|
392
412
|
}
|
|
393
413
|
|
|
394
414
|
.godmin-page-tabs {
|
|
415
|
+
--godmin-page-tabs-start: left;
|
|
416
|
+
--godmin-page-tabs-end: right;
|
|
417
|
+
--godmin-page-tabs-fade-width: 4rem;
|
|
418
|
+
--godmin-page-tabs-fade: transparent 0%, #000 var(--godmin-page-tabs-fade-width);
|
|
419
|
+
--godmin-page-tabs-fade-both: var(--godmin-page-tabs-fade), #000 60%, transparent 50%;
|
|
420
|
+
|
|
395
421
|
display: flex;
|
|
422
|
+
position: relative;
|
|
396
423
|
gap: var(--wpds-dimension-gap-lg);
|
|
397
424
|
overflow-x: auto;
|
|
425
|
+
overscroll-behavior-inline: none;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.godmin-page-tabs:dir(rtl) {
|
|
429
|
+
--godmin-page-tabs-start: right;
|
|
430
|
+
--godmin-page-tabs-end: left;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.godmin-page-tabs--overflowing-first {
|
|
434
|
+
mask-image: linear-gradient(to var(--godmin-page-tabs-end), var(--godmin-page-tabs-fade));
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.godmin-page-tabs--overflowing-last {
|
|
438
|
+
mask-image: linear-gradient(to var(--godmin-page-tabs-start), var(--godmin-page-tabs-fade));
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.godmin-page-tabs--overflowing-first.godmin-page-tabs--overflowing-last {
|
|
442
|
+
mask-image:
|
|
443
|
+
linear-gradient(to right, var(--godmin-page-tabs-fade-both)),
|
|
444
|
+
linear-gradient(to left, var(--godmin-page-tabs-fade-both));
|
|
398
445
|
}
|
|
399
446
|
|
|
400
447
|
.godmin-page-tabs__tab {
|
|
@@ -403,6 +450,7 @@ body {
|
|
|
403
450
|
position: relative;
|
|
404
451
|
block-size: 48px;
|
|
405
452
|
padding: 0;
|
|
453
|
+
scroll-margin: 24px;
|
|
406
454
|
color: var(--wpds-color-foreground-interactive-neutral);
|
|
407
455
|
font-family: var(--wpds-typography-font-family-body);
|
|
408
456
|
font-size: var(--wpds-typography-font-size-md);
|
package/dist/bulk.d.ts
CHANGED
|
@@ -21,3 +21,25 @@ export interface BulkOutcome<Item> {
|
|
|
21
21
|
* @returns How many items were asked, how many finished, and each failure with its item.
|
|
22
22
|
*/
|
|
23
23
|
export declare function runEach<Item>(items: readonly Item[], call: (item: Item) => Promise<unknown>): Promise<BulkOutcome<Item>>;
|
|
24
|
+
/** The words a product turns a bulk outcome into. */
|
|
25
|
+
export interface BulkWords<Item> {
|
|
26
|
+
/** The toast for the items that finished, given their count and the one item when only one was asked. */
|
|
27
|
+
done: (count: number, only: Item | undefined) => string;
|
|
28
|
+
/** The notice for the items that failed, given every failure and how many items were asked. */
|
|
29
|
+
failed: (failures: BulkFailure<Item>[], asked: number) => string;
|
|
30
|
+
}
|
|
31
|
+
/** The messages a bulk outcome reads as, each absent when nothing calls for it. */
|
|
32
|
+
export interface BulkNotes {
|
|
33
|
+
/** The toast confirming the items that finished. */
|
|
34
|
+
toast?: string;
|
|
35
|
+
/** The notice naming the items that failed. */
|
|
36
|
+
notice?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Returns the toast and the notice a bulk outcome reads as, in the product's words.
|
|
40
|
+
* @param items - The items the run was given.
|
|
41
|
+
* @param outcome - What the run reached.
|
|
42
|
+
* @param words - The words for the items that finished and for the ones that failed.
|
|
43
|
+
* @returns A toast when an item finished and a notice when one failed.
|
|
44
|
+
*/
|
|
45
|
+
export declare function bulkNotes<Item>(items: readonly Item[], outcome: BulkOutcome<Item>, words: BulkWords<Item>): BulkNotes;
|
package/dist/bulk.js
CHANGED
|
@@ -36,3 +36,21 @@ export async function runEach(items, call) {
|
|
|
36
36
|
const failures = settled.flatMap((result, at) => failureOf(result, given[at]));
|
|
37
37
|
return { asked: given.length, done: given.length - failures.length, failures };
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Returns the toast and the notice a bulk outcome reads as, in the product's words.
|
|
41
|
+
* @param items - The items the run was given.
|
|
42
|
+
* @param outcome - What the run reached.
|
|
43
|
+
* @param words - The words for the items that finished and for the ones that failed.
|
|
44
|
+
* @returns A toast when an item finished and a notice when one failed.
|
|
45
|
+
*/
|
|
46
|
+
export function bulkNotes(items, outcome, words) {
|
|
47
|
+
const only = outcome.asked === 1 ? items.filter(() => true)[0] : undefined;
|
|
48
|
+
const notes = {};
|
|
49
|
+
if (outcome.done > 0) {
|
|
50
|
+
notes.toast = words.done(outcome.done, only);
|
|
51
|
+
}
|
|
52
|
+
if (outcome.failures.length > 0) {
|
|
53
|
+
notes.notice = words.failed(outcome.failures, outcome.asked);
|
|
54
|
+
}
|
|
55
|
+
return notes;
|
|
56
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface ConfirmBodyProps {
|
|
3
|
+
/** The question the modal asks. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** The label of the button that carries the action out. */
|
|
6
|
+
confirmLabel: string;
|
|
7
|
+
/** The label of the button that closes the modal. */
|
|
8
|
+
cancelLabel: string;
|
|
9
|
+
/** Whether the action is running, the confirm button then busy and Cancel greyed out. */
|
|
10
|
+
busy?: boolean;
|
|
11
|
+
/** The failure of the last try, shown inside the modal. */
|
|
12
|
+
failure?: string;
|
|
13
|
+
/** Carries the action out. */
|
|
14
|
+
onConfirm: () => void;
|
|
15
|
+
/** Closes the modal. */
|
|
16
|
+
onCancel?: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Renders the body of a confirmation modal: the question, a failure notice, a neutral Cancel and the confirm button.
|
|
20
|
+
* @param props - The question, the labels, the busy flag, the failure and the handlers.
|
|
21
|
+
* @returns The confirmation body.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ConfirmBody({ children, confirmLabel, cancelLabel, busy, failure, onConfirm, onCancel, }: ConfirmBodyProps): import("react").JSX.Element;
|
package/dist/confirm.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Button, Stack, Text } from '@wordpress/ui';
|
|
4
|
+
import { ErrorNotice } from './page.js';
|
|
5
|
+
/**
|
|
6
|
+
* Renders the body of a confirmation modal: the question, a failure notice, a neutral Cancel and the confirm button.
|
|
7
|
+
* @param props - The question, the labels, the busy flag, the failure and the handlers.
|
|
8
|
+
* @returns The confirmation body.
|
|
9
|
+
*/
|
|
10
|
+
export function ConfirmBody({ children, confirmLabel, cancelLabel, busy = false, failure, onConfirm, onCancel, }) {
|
|
11
|
+
return (_jsxs(Stack, { direction: "column", gap: "lg", children: [_jsx(Text, { children: children }), failure === undefined ? null : _jsx(ErrorNotice, { children: failure }), _jsxs(Stack, { direction: "row", gap: "sm", justify: "flex-end", children: [_jsx(Button, { variant: "minimal", tone: "neutral", disabled: busy, onClick: onCancel, children: cancelLabel }), _jsx(Button, { loading: busy, onClick: onConfirm, children: confirmLabel })] })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Button } from '@wordpress/ui';
|
|
2
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
export interface FileButtonProps {
|
|
4
|
+
/** The file types the dialog offers, as the input `accept` attribute takes them. */
|
|
5
|
+
accept?: string;
|
|
6
|
+
/** Whether the reader may choose more than one file. */
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
/** Whether an upload is running, the button then busy. */
|
|
9
|
+
busy?: boolean;
|
|
10
|
+
/** The icon drawn before the label. */
|
|
11
|
+
icon?: ComponentProps<typeof Button.Icon>['icon'];
|
|
12
|
+
/** The name of the hidden file input. */
|
|
13
|
+
inputLabel?: string;
|
|
14
|
+
/** Takes the files the reader chose, never called for a dialog closed with none. */
|
|
15
|
+
onChoose: (files: File[]) => void;
|
|
16
|
+
/** The button label. */
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Renders a compact solid button that opens the file dialog of a hidden file input.
|
|
21
|
+
* @param props - The file types, the many flag, the busy flag, the icon, the input name, the handler and the label.
|
|
22
|
+
* @returns The button beside its hidden input.
|
|
23
|
+
*/
|
|
24
|
+
export declare function FileButton({ accept, multiple, busy, icon, inputLabel, onChoose, children, }: FileButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { Button } from '@wordpress/ui';
|
|
4
|
+
import { useRef } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Empties the input, then hands the files it held to the handler, none for a closed dialog.
|
|
7
|
+
* @param event - The change the input reported.
|
|
8
|
+
* @param onChoose - Takes the files the reader chose.
|
|
9
|
+
*/
|
|
10
|
+
function handOver(event, onChoose) {
|
|
11
|
+
const files = Array.from(event.target.files ?? []);
|
|
12
|
+
event.target.value = '';
|
|
13
|
+
if (files.length > 0) {
|
|
14
|
+
onChoose(files);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Renders a compact solid button that opens the file dialog of a hidden file input.
|
|
19
|
+
* @param props - The file types, the many flag, the busy flag, the icon, the input name, the handler and the label.
|
|
20
|
+
* @returns The button beside its hidden input.
|
|
21
|
+
*/
|
|
22
|
+
export function FileButton({ accept, multiple = false, busy = false, icon, inputLabel, onChoose, children, }) {
|
|
23
|
+
const input = useRef(null);
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "solid", size: "compact", loading: busy, onClick: () => input.current.click(), children: [icon === undefined ? null : _jsx(Button.Icon, { icon: icon }), children] }), _jsx("input", { ref: input, type: "file", accept: accept, multiple: multiple, hidden: true, "aria-label": inputLabel, onChange: (event) => handOver(event, onChoose) })] }));
|
|
25
|
+
}
|
package/dist/frame.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ type ThemeColor = ComponentProps<typeof ThemeProvider>['color'];
|
|
|
4
4
|
export interface FrameRootProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
location?: string;
|
|
7
|
+
/** The theme colour of the frame, a #26292b background when absent. */
|
|
7
8
|
chromeColor?: ThemeColor;
|
|
9
|
+
/** The theme colour of the canvas, a #fcfcfc background when absent. */
|
|
8
10
|
canvasColor?: ThemeColor;
|
|
9
11
|
}
|
|
10
12
|
/**
|
package/dist/frame.js
CHANGED
|
@@ -10,13 +10,21 @@ import { useMediaQuery } from './use-media-query.js';
|
|
|
10
10
|
* The glyph on the button that opens the rail drawer, drawn where the admin bar menu toggle draws its bars.
|
|
11
11
|
*/
|
|
12
12
|
const menuIcon = (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "52", height: "46", viewBox: "0 0 52 46", fill: "currentColor", "aria-hidden": "true", focusable: "false", children: _jsx("path", { d: "M11 11h28v4H11zm0 10h28v4H11zm0 10h28v4H11z" }) }));
|
|
13
|
+
/**
|
|
14
|
+
* The chrome background seeded when an application names none.
|
|
15
|
+
*/
|
|
16
|
+
const CHROME_COLOR = { background: '#26292b' };
|
|
17
|
+
/**
|
|
18
|
+
* The canvas background seeded when an application names none, the design system default background.
|
|
19
|
+
*/
|
|
20
|
+
const CANVAS_COLOR = { background: '#fcfcfc' };
|
|
13
21
|
const FrameContext = createContext({ small: false, location: undefined, layout: null });
|
|
14
22
|
/**
|
|
15
23
|
* Frames an admin application, folding its rail away on a narrow viewport.
|
|
16
24
|
* @param props - The regions, the current location, and the region colors.
|
|
17
25
|
* @returns The frame element.
|
|
18
26
|
*/
|
|
19
|
-
function Root({ children, location, chromeColor, canvasColor }) {
|
|
27
|
+
function Root({ children, location, chromeColor = CHROME_COLOR, canvasColor = CANVAS_COLOR }) {
|
|
20
28
|
const small = useMediaQuery(SMALL_VIEWPORT);
|
|
21
29
|
const [layout, setLayout] = useState(null);
|
|
22
30
|
const classes = small ? 'godmin-layout godmin-layout--small' : 'godmin-layout';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,20 @@ export type { AdminRootProps } from './admin-root.js';
|
|
|
3
3
|
export { InitialsAvatar } from './avatar.js';
|
|
4
4
|
export type { InitialsAvatarProps } from './avatar.js';
|
|
5
5
|
export { DENSE_BREAKPOINT, EDGE_BREAKPOINT, RAIL_BREAKPOINT, SMALL_VIEWPORT } from './breakpoints.js';
|
|
6
|
-
export { runEach } from './bulk.js';
|
|
7
|
-
export type { BulkFailure, BulkOutcome } from './bulk.js';
|
|
6
|
+
export { bulkNotes, runEach } from './bulk.js';
|
|
7
|
+
export type { BulkFailure, BulkNotes, BulkOutcome, BulkWords } from './bulk.js';
|
|
8
|
+
export { ConfirmBody } from './confirm.js';
|
|
9
|
+
export type { ConfirmBodyProps } from './confirm.js';
|
|
10
|
+
export { FileButton } from './file-button.js';
|
|
11
|
+
export type { FileButtonProps } from './file-button.js';
|
|
8
12
|
export { Frame } from './frame.js';
|
|
9
13
|
export type { CanvasMode, FrameCanvasProps, FrameRailProps, FrameRootProps, } from './frame.js';
|
|
10
14
|
export { keyFromLabel } from './keys.js';
|
|
11
15
|
export type { KeyOptions, KeyStyle } from './keys.js';
|
|
12
16
|
export { LIST_CHROME_DOMAIN, listChromeCatalogFor } from './list-chrome.js';
|
|
13
17
|
export type { ListChromeCatalog } from './list-chrome.js';
|
|
18
|
+
export { ListEmpty } from './list-empty.js';
|
|
19
|
+
export type { ListEmptyProps } from './list-empty.js';
|
|
14
20
|
export { LoadingRows, LoadingScreen } from './loading.js';
|
|
15
21
|
export { LogItem, LogList, LogTime } from './log-list.js';
|
|
16
22
|
export type { LogItemProps, LogListProps, LogTimeProps } from './log-list.js';
|
|
@@ -20,6 +26,8 @@ export { ErrorNotice, LoadMore, Page, PageTitle, SectionTitle } from './page.js'
|
|
|
20
26
|
export type { LoadMoreQuery, PageProps } from './page.js';
|
|
21
27
|
export { PageTab, PageTabs } from './page-tabs.js';
|
|
22
28
|
export type { PageTabProps, PageTabsProps } from './page-tabs.js';
|
|
29
|
+
export { RenameBody } from './rename.js';
|
|
30
|
+
export type { RenameBodyProps } from './rename.js';
|
|
23
31
|
export { useRowKeys } from './row-keys.js';
|
|
24
32
|
export type { RowBounds, RowKeys } from './row-keys.js';
|
|
25
33
|
export { RepeatRows, RowControls } from './rows.js';
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
export { AdminRoot } from './admin-root.js';
|
|
3
3
|
export { InitialsAvatar } from './avatar.js';
|
|
4
4
|
export { DENSE_BREAKPOINT, EDGE_BREAKPOINT, RAIL_BREAKPOINT, SMALL_VIEWPORT } from './breakpoints.js';
|
|
5
|
-
export { runEach } from './bulk.js';
|
|
5
|
+
export { bulkNotes, runEach } from './bulk.js';
|
|
6
|
+
export { ConfirmBody } from './confirm.js';
|
|
7
|
+
export { FileButton } from './file-button.js';
|
|
6
8
|
export { Frame } from './frame.js';
|
|
7
9
|
export { keyFromLabel } from './keys.js';
|
|
8
10
|
export { LIST_CHROME_DOMAIN, listChromeCatalogFor } from './list-chrome.js';
|
|
11
|
+
export { ListEmpty } from './list-empty.js';
|
|
9
12
|
export { LoadingRows, LoadingScreen } from './loading.js';
|
|
10
13
|
export { LogItem, LogList, LogTime } from './log-list.js';
|
|
11
14
|
export { NavScreen } from './nav-screen.js';
|
|
12
15
|
export { ErrorNotice, LoadMore, Page, PageTitle, SectionTitle } from './page.js';
|
|
13
16
|
export { PageTab, PageTabs } from './page-tabs.js';
|
|
17
|
+
export { RenameBody } from './rename.js';
|
|
14
18
|
export { useRowKeys } from './row-keys.js';
|
|
15
19
|
export { RepeatRows, RowControls } from './rows.js';
|
|
16
20
|
export { pageWindow, paginationOf, useServerPaging } from './server-page.js';
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
const catalog = {
|
|
4
4
|
'': { lang: 'es-ES', 'plural-forms': 'nplurals=2; plural=(n != 1);' },
|
|
5
5
|
'%1$d of %2$d Item': ['%1$d de %2$d elemento', '%1$d de %2$d elementos'],
|
|
6
|
+
'%1$s, %2$s': ['%1$s, %2$s'],
|
|
6
7
|
'%1$s: %2$s': ['%1$s: %2$s'],
|
|
7
8
|
'%d Item': ['%d elemento', '%d elementos'],
|
|
8
9
|
'%d Item selected': ['%d elemento seleccionado', '%d elementos seleccionados'],
|
|
10
|
+
'%s, selected': ['%s, seleccionado'],
|
|
9
11
|
'%s: <groupName />': ['%s: <groupName />'],
|
|
10
12
|
'(no title)': ['(sin título)'],
|
|
11
13
|
'<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>': [
|
|
@@ -18,46 +20,46 @@ const catalog = {
|
|
|
18
20
|
'<Name>%1$s no contiene: </Name><Value>%2$s</Value>',
|
|
19
21
|
],
|
|
20
22
|
'<Name>%1$s includes all: </Name><Value>%2$s</Value>': [
|
|
21
|
-
'<Name>%1$s incluye
|
|
23
|
+
'<Name>%1$s incluye todo: </Name><Value>%2$s</Value>',
|
|
22
24
|
],
|
|
23
25
|
'<Name>%1$s includes: </Name><Value>%2$s</Value>': [
|
|
24
26
|
'<Name>%1$s incluye: </Name><Value>%2$s</Value>',
|
|
25
27
|
],
|
|
26
28
|
'<Name>%1$s is after: </Name><Value>%2$s</Value>': [
|
|
27
|
-
'<Name>%1$s es
|
|
29
|
+
'<Name>%1$s es después de: </Name><Value>%2$s</Value>',
|
|
28
30
|
],
|
|
29
31
|
'<Name>%1$s is before: </Name><Value>%2$s</Value>': [
|
|
30
|
-
'<Name>%1$s es
|
|
32
|
+
'<Name>%1$s es antes de: </Name><Value>%2$s</Value>',
|
|
31
33
|
],
|
|
32
34
|
'<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>': [
|
|
33
|
-
'<Name>%1$s
|
|
35
|
+
'<Name>%1$s superior o igual a: </Name><Value>%2$s</Value>',
|
|
34
36
|
],
|
|
35
37
|
'<Name>%1$s is greater than: </Name><Value>%2$s</Value>': [
|
|
36
|
-
'<Name>%1$s
|
|
38
|
+
'<Name>%1$s mayor que: </Name><Value>%2$s</Value>',
|
|
37
39
|
],
|
|
38
40
|
'<Name>%1$s is in the past: </Name><Value>%2$s</Value>': [
|
|
39
|
-
'<Name>%1$s en
|
|
41
|
+
'<Name>%1$s está en el pasado: </Name><Value>%2$s</Value>',
|
|
40
42
|
],
|
|
41
43
|
'<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>': [
|
|
42
|
-
'<Name>%1$s
|
|
44
|
+
'<Name>%1$s menor o igual a: </Name><Value>%2$s</Value>',
|
|
43
45
|
],
|
|
44
46
|
'<Name>%1$s is less than: </Name><Value>%2$s</Value>': [
|
|
45
47
|
'<Name>%1$s es menor que: </Name><Value>%2$s</Value>',
|
|
46
48
|
],
|
|
47
49
|
'<Name>%1$s is none of: </Name><Value>%2$s</Value>': [
|
|
48
|
-
'<Name>%1$s no es ninguno de: </Name><Value>%2$s</Value>',
|
|
50
|
+
'<Name>%1$s no es ninguno de los siguientes: </Name><Value>%2$s</Value>',
|
|
49
51
|
],
|
|
50
52
|
'<Name>%1$s is not: </Name><Value>%2$s</Value>': [
|
|
51
53
|
'<Name>%1$s no es: </Name><Value>%2$s</Value>',
|
|
52
54
|
],
|
|
53
55
|
'<Name>%1$s is on or after: </Name><Value>%2$s</Value>': [
|
|
54
|
-
'<Name>%1$s es
|
|
56
|
+
'<Name>%1$s es o es después de: </Name><Value>%2$s</Value>',
|
|
55
57
|
],
|
|
56
58
|
'<Name>%1$s is on or before: </Name><Value>%2$s</Value>': [
|
|
57
|
-
'<Name>%1$s es
|
|
59
|
+
'<Name>%1$s es o es antes de: </Name><Value>%2$s</Value>',
|
|
58
60
|
],
|
|
59
61
|
'<Name>%1$s is over: </Name><Value>%2$s</Value>': [
|
|
60
|
-
'<Name>%1$s
|
|
62
|
+
'<Name>%1$s ha terminado: </Name><Value>%2$s</Value>',
|
|
61
63
|
],
|
|
62
64
|
'<Name>%1$s is: </Name><Value>%2$s</Value>': [
|
|
63
65
|
'<Name>%1$s es: </Name><Value>%2$s</Value>',
|
|
@@ -68,34 +70,38 @@ const catalog = {
|
|
|
68
70
|
Actions: ['Acciones'],
|
|
69
71
|
Activity: ['Actividad'],
|
|
70
72
|
'Add filter': ['Añadir filtro'],
|
|
71
|
-
After: ['Después
|
|
72
|
-
'After (inc)': ['Después
|
|
73
|
+
After: ['Después'],
|
|
74
|
+
'After (inc)': ['Después (incl.)'],
|
|
73
75
|
Appearance: ['Apariencia'],
|
|
74
76
|
'Automatically load more content as you scroll, instead of showing pagination links.': [
|
|
75
|
-
'Carga más contenido
|
|
77
|
+
'Carga automáticamente más contenido a medida que navegas, en lugar de mostrar enlaces de paginación.',
|
|
76
78
|
],
|
|
77
|
-
Before: ['Antes
|
|
78
|
-
'Before (inc)': ['Antes
|
|
79
|
+
Before: ['Antes'],
|
|
80
|
+
'Before (inc)': ['Antes (incl.)'],
|
|
79
81
|
'Between (inc)': ['Entre (incl.)'],
|
|
80
82
|
Cancel: ['Cancelar'],
|
|
81
83
|
Close: ['Cerrar'],
|
|
82
84
|
Conditions: ['Condiciones'],
|
|
83
85
|
Contains: ['Contiene'],
|
|
86
|
+
'Coordinated Universal Time': ['Hora universal coordinada'],
|
|
84
87
|
'Current page': ['Página actual'],
|
|
88
|
+
'Date calendar': ['Calendario de fechas'],
|
|
89
|
+
'Date range calendar': ['Calendario de rango de fechas'],
|
|
90
|
+
'Date time': ['Fecha y hora'],
|
|
85
91
|
Density: ['Densidad'],
|
|
86
|
-
'Density option for DataView layout\u0004Balanced': ['
|
|
87
|
-
'Density option for DataView layout\u0004Comfortable': ['
|
|
88
|
-
'Density option for DataView layout\u0004Compact': ['
|
|
89
|
-
'Deselect all': ['
|
|
92
|
+
'Density option for DataView layout\u0004Balanced': ['Equilibrado'],
|
|
93
|
+
'Density option for DataView layout\u0004Comfortable': ['Cómodo'],
|
|
94
|
+
'Density option for DataView layout\u0004Compact': ['Compacto'],
|
|
95
|
+
'Deselect all': ['Anular selección de todo'],
|
|
90
96
|
"Doesn't contain": ['No contiene'],
|
|
91
97
|
'Enable infinite scroll': ['Activar el desplazamiento infinito'],
|
|
92
98
|
False: ['Falso'],
|
|
93
99
|
'Filter by: %1$s': ['Filtrar por: %1$s'],
|
|
94
100
|
'Greater than': ['Mayor que'],
|
|
95
|
-
'Greater than or equal': ['
|
|
101
|
+
'Greater than or equal': ['Superior a o igual'],
|
|
96
102
|
Grid: ['Cuadrícula'],
|
|
97
103
|
'Hide column': ['Ocultar columna'],
|
|
98
|
-
'In the past': ['En
|
|
104
|
+
'In the past': ['En el pasado'],
|
|
99
105
|
Includes: ['Incluye'],
|
|
100
106
|
'Includes all': ['Incluye todos'],
|
|
101
107
|
'Insert left': ['Insertar a la izquierda'],
|
|
@@ -104,31 +110,36 @@ const catalog = {
|
|
|
104
110
|
'Is none of': ['No es ninguno de'],
|
|
105
111
|
'Is not': ['No es'],
|
|
106
112
|
'Items per page': ['Elementos por página'],
|
|
107
|
-
Layout: ['
|
|
113
|
+
Layout: ['Estructura'],
|
|
108
114
|
'Less than': ['Menor que'],
|
|
109
|
-
'Less than or equal': ['
|
|
115
|
+
'Less than or equal': ['Inferior a o igual'],
|
|
110
116
|
List: ['Lista'],
|
|
111
117
|
'List of: %1$s': ['Lista de: %1$s'],
|
|
112
118
|
'Move left': ['Mover a la izquierda'],
|
|
113
119
|
'Move right': ['Mover a la derecha'],
|
|
114
|
-
'Navigate to item': ['
|
|
120
|
+
'Navigate to item': ['Navegar hasta el elemento'],
|
|
121
|
+
'Navigation bar': ['Barra de navegación'],
|
|
122
|
+
'Next month': ['Mes siguiente'],
|
|
115
123
|
'Next page': ['Página siguiente'],
|
|
116
124
|
'No elements found': ['No se han encontrado elementos'],
|
|
117
|
-
'No results': ['
|
|
118
|
-
'No results found': ['No se
|
|
119
|
-
'Not on': ['No
|
|
120
|
-
On: ['
|
|
125
|
+
'No results': ['No hay resultados'],
|
|
126
|
+
'No results found': ['No se encontraron resultados'],
|
|
127
|
+
'Not on': ['No el'],
|
|
128
|
+
On: ['El'],
|
|
129
|
+
Optional: ['Opcional'],
|
|
121
130
|
Order: ['Orden'],
|
|
122
131
|
'Original aspect ratio': ['Proporción original'],
|
|
123
132
|
Over: ['Hace más de'],
|
|
124
133
|
'Page %1$d of %2$d': ['Página %1$d de %2$d'],
|
|
125
134
|
'Preview size': ['Tamaño de la vista previa'],
|
|
135
|
+
'Previous month': ['Mes anterior'],
|
|
126
136
|
'Previous page': ['Página anterior'],
|
|
127
137
|
Properties: ['Propiedades'],
|
|
128
|
-
Remove: ['
|
|
138
|
+
Remove: ['Eliminar'],
|
|
139
|
+
Required: ['Obligatorio'],
|
|
129
140
|
Reset: ['Restablecer'],
|
|
130
141
|
'Reset search': ['Restablecer la búsqueda'],
|
|
131
|
-
'Reset view': ['Restablecer
|
|
142
|
+
'Reset view': ['Restablecer vista'],
|
|
132
143
|
'Row %d': ['Fila %d'],
|
|
133
144
|
Search: ['Buscar'],
|
|
134
145
|
'Search items': ['Buscar elementos'],
|
|
@@ -136,11 +147,14 @@ const catalog = {
|
|
|
136
147
|
'Sort ascending': ['Orden ascendente'],
|
|
137
148
|
'Sort by': ['Ordenar por'],
|
|
138
149
|
'Sort descending': ['Orden descendente'],
|
|
139
|
-
'Starts with': ['Empieza
|
|
150
|
+
'Starts with': ['Empieza con'],
|
|
140
151
|
Table: ['Tabla'],
|
|
152
|
+
'Timezone: %s': ['Zona horaria: %s'],
|
|
153
|
+
'Today, %s': ['Hoy, %s'],
|
|
154
|
+
'Today, %s, selected': ['Hoy, %s, seleccionado'],
|
|
141
155
|
True: ['Verdadero'],
|
|
142
|
-
'Unknown status for %1$s': ['Estado desconocido
|
|
143
|
-
'View is used as a noun\u0004View options': ['
|
|
156
|
+
'Unknown status for %1$s': ['Estado desconocido para %1$s'],
|
|
157
|
+
'View is used as a noun\u0004View options': ['Ver opciones'],
|
|
144
158
|
'paging\u0004<div>Page</div>%1$s<div>of %2$d</div>': ['<div>Página</div>%1$s<div>de %2$d</div>'],
|
|
145
159
|
'verb\u0004Filter': ['Filtrar'],
|
|
146
160
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EmptyState } from '@wordpress/ui';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
export interface ListEmptyProps {
|
|
4
|
+
/** The icon drawn above the title, from `@wordpress/icons`. */
|
|
5
|
+
icon: ComponentProps<typeof EmptyState.Icon>['icon'];
|
|
6
|
+
/** The sentence saying the list is empty. */
|
|
7
|
+
title: string;
|
|
8
|
+
/** The line under the title, such as what to do to fill the list. */
|
|
9
|
+
hint?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Renders what a list shows when it has no rows: an icon, a title and an optional hint.
|
|
13
|
+
* @param props - The icon, the title and the hint.
|
|
14
|
+
* @returns The empty state element.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ListEmpty({ icon, title, hint }: ListEmptyProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { EmptyState } from '@wordpress/ui';
|
|
4
|
+
/**
|
|
5
|
+
* Renders what a list shows when it has no rows: an icon, a title and an optional hint.
|
|
6
|
+
* @param props - The icon, the title and the hint.
|
|
7
|
+
* @returns The empty state element.
|
|
8
|
+
*/
|
|
9
|
+
export function ListEmpty({ icon, title, hint }) {
|
|
10
|
+
return (_jsxs(EmptyState.Root, { className: "godmin-empty", children: [_jsx(EmptyState.Icon, { icon: icon }), _jsx(EmptyState.Title, { children: title }), hint === undefined ? null : _jsx(EmptyState.Description, { children: hint })] }));
|
|
11
|
+
}
|