@wordpress/admin-ui 1.9.1-next.v.202603102151.0 → 1.10.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/CHANGELOG.md +4 -0
- package/build/lock-unlock.cjs +37 -0
- package/build/lock-unlock.cjs.map +7 -0
- package/build/page/header.cjs +3 -1
- package/build/page/header.cjs.map +2 -2
- package/build/page/index.cjs +2 -0
- package/build/page/index.cjs.map +2 -2
- package/build-module/lock-unlock.mjs +11 -0
- package/build-module/lock-unlock.mjs.map +7 -0
- package/build-module/page/header.mjs +3 -1
- package/build-module/page/header.mjs.map +2 -2
- package/build-module/page/index.mjs +2 -0
- package/build-module/page/index.mjs.map +2 -2
- package/build-style/style-rtl.css +7 -5
- package/build-style/style.css +7 -5
- package/build-types/breadcrumbs/stories/index.story.d.ts +15 -0
- package/build-types/breadcrumbs/stories/index.story.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/page/header.d.ts +2 -1
- package/build-types/page/header.d.ts.map +1 -1
- package/build-types/page/index.d.ts +2 -1
- package/build-types/page/index.d.ts.map +1 -1
- package/build-types/page/stories/index.story.d.ts +16 -0
- package/build-types/page/stories/index.story.d.ts.map +1 -0
- package/build-types/stories/with-router.d.ts +9 -0
- package/build-types/stories/with-router.d.ts.map +1 -0
- package/package.json +9 -8
- package/src/breadcrumbs/stories/index.story.tsx +45 -0
- package/src/breadcrumbs/style.scss +5 -2
- package/src/lock-unlock.ts +10 -0
- package/src/page/header.tsx +5 -2
- package/src/page/index.tsx +3 -0
- package/src/page/stories/index.story.tsx +84 -0
- package/src/page/style.scss +4 -3
- package/src/stories/with-router.tsx +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// packages/admin-ui/src/lock-unlock.ts
|
|
21
|
+
var lock_unlock_exports = {};
|
|
22
|
+
__export(lock_unlock_exports, {
|
|
23
|
+
lock: () => lock,
|
|
24
|
+
unlock: () => unlock
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(lock_unlock_exports);
|
|
27
|
+
var import_private_apis = require("@wordpress/private-apis");
|
|
28
|
+
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
29
|
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
30
|
+
"@wordpress/admin-ui"
|
|
31
|
+
);
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
lock,
|
|
35
|
+
unlock
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=lock-unlock.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lock-unlock.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/admin-ui'\n\t);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/page/header.cjs
CHANGED
|
@@ -27,6 +27,7 @@ var import_ui = require("@wordpress/ui");
|
|
|
27
27
|
var import_sidebar_toggle_slot = require("./sidebar-toggle-slot.cjs");
|
|
28
28
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
function Header({
|
|
30
|
+
headingLevel = 2,
|
|
30
31
|
breadcrumbs,
|
|
31
32
|
badges,
|
|
32
33
|
title,
|
|
@@ -34,6 +35,7 @@ function Header({
|
|
|
34
35
|
actions,
|
|
35
36
|
showSidebarToggle = true
|
|
36
37
|
}) {
|
|
38
|
+
const HeadingTag = `h${headingLevel}`;
|
|
37
39
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
38
40
|
import_ui.Stack,
|
|
39
41
|
{
|
|
@@ -50,7 +52,7 @@ function Header({
|
|
|
50
52
|
className: "admin-ui-page__sidebar-toggle-slot"
|
|
51
53
|
}
|
|
52
54
|
),
|
|
53
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HeadingTag, { className: "admin-ui-page__header-title", children: title }),
|
|
54
56
|
breadcrumbs,
|
|
55
57
|
badges
|
|
56
58
|
] }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/page/header.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { SidebarToggleSlot } from './sidebar-toggle-slot';\n\nexport default function Header( {\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tactions,\n\tshowSidebarToggle = true,\n}: {\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle: React.ReactNode;\n\tactions?: React.ReactNode;\n\tshowSidebarToggle?: boolean;\n} ) {\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tclassName=\"admin-ui-page__header\"\n\t\t\trender={ <header /> }\n\t\t>\n\t\t\t<Stack direction=\"row\" justify=\"space-between\" gap=\"sm\">\n\t\t\t\t<Stack direction=\"row\" gap=\"sm\" align=\"center\" justify=\"start\">\n\t\t\t\t\t{ showSidebarToggle && (\n\t\t\t\t\t\t<SidebarToggleSlot\n\t\t\t\t\t\t\tbubblesVirtually\n\t\t\t\t\t\t\tclassName=\"admin-ui-page__sidebar-toggle-slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ title && (\n\t\t\t\t\t\t<
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAAsB;AAKtB,iCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { SidebarToggleSlot } from './sidebar-toggle-slot';\n\nexport default function Header( {\n\theadingLevel = 2,\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tactions,\n\tshowSidebarToggle = true,\n}: {\n\theadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle: React.ReactNode;\n\tactions?: React.ReactNode;\n\tshowSidebarToggle?: boolean;\n} ) {\n\tconst HeadingTag = `h${ headingLevel }` as const;\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tclassName=\"admin-ui-page__header\"\n\t\t\trender={ <header /> }\n\t\t>\n\t\t\t<Stack direction=\"row\" justify=\"space-between\" gap=\"sm\">\n\t\t\t\t<Stack direction=\"row\" gap=\"sm\" align=\"center\" justify=\"start\">\n\t\t\t\t\t{ showSidebarToggle && (\n\t\t\t\t\t\t<SidebarToggleSlot\n\t\t\t\t\t\t\tbubblesVirtually\n\t\t\t\t\t\t\tclassName=\"admin-ui-page__sidebar-toggle-slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ title && (\n\t\t\t\t\t\t<HeadingTag className=\"admin-ui-page__header-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</HeadingTag>\n\t\t\t\t\t) }\n\t\t\t\t\t{ breadcrumbs }\n\t\t\t\t\t{ badges }\n\t\t\t\t</Stack>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tgap=\"sm\"\n\t\t\t\t\tstyle={ { width: 'auto', flexShrink: 0 } }\n\t\t\t\t\tclassName=\"admin-ui-page__header-actions\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t>\n\t\t\t\t\t{ actions }\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t\t{ subTitle && (\n\t\t\t\t<p className=\"admin-ui-page__header-subtitle\">{ subTitle }</p>\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAAsB;AAKtB,iCAAkC;AAwBtB;AAtBG,SAAR,OAAyB;AAAA,EAC/B,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AACrB,GAQI;AACH,QAAM,aAAa,IAAK,YAAa;AACrC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAU;AAAA,MACV,QAAS,4CAAC,YAAO;AAAA,MAEjB;AAAA,qDAAC,mBAAM,WAAU,OAAM,SAAQ,iBAAgB,KAAI,MAClD;AAAA,uDAAC,mBAAM,WAAU,OAAM,KAAI,MAAK,OAAM,UAAS,SAAQ,SACpD;AAAA,iCACD;AAAA,cAAC;AAAA;AAAA,gBACA,kBAAgB;AAAA,gBAChB,WAAU;AAAA;AAAA,YACX;AAAA,YAEC,SACD,4CAAC,cAAW,WAAU,+BACnB,iBACH;AAAA,YAEC;AAAA,YACA;AAAA,aACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,KAAI;AAAA,cACJ,OAAQ,EAAE,OAAO,QAAQ,YAAY,EAAE;AAAA,cACvC,WAAU;AAAA,cACV,OAAM;AAAA,cAEJ;AAAA;AAAA,UACH;AAAA,WACD;AAAA,QACE,YACD,4CAAC,OAAE,WAAU,kCAAmC,oBAAU;AAAA;AAAA;AAAA,EAE5D;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/page/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ var import_navigable_region = __toESM(require("../navigable-region/index.cjs"));
|
|
|
39
39
|
var import_sidebar_toggle_slot = require("./sidebar-toggle-slot.cjs");
|
|
40
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
41
|
function Page({
|
|
42
|
+
headingLevel,
|
|
42
43
|
breadcrumbs,
|
|
43
44
|
badges,
|
|
44
45
|
title,
|
|
@@ -56,6 +57,7 @@ function Page({
|
|
|
56
57
|
(title || breadcrumbs || badges) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
58
|
import_header.default,
|
|
58
59
|
{
|
|
60
|
+
headingLevel,
|
|
59
61
|
breadcrumbs,
|
|
60
62
|
badges,
|
|
61
63
|
title,
|
package/build/page/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/page/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Header from './header';\nimport NavigableRegion from '../navigable-region';\nimport { SidebarToggleFill } from './sidebar-toggle-slot';\n\nfunction Page( {\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tchildren,\n\tclassName,\n\tactions,\n\tariaLabel,\n\thasPadding = false,\n\tshowSidebarToggle = true,\n}: {\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle?: React.ReactNode;\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tactions?: React.ReactNode;\n\tariaLabel?: string;\n\thasPadding?: boolean;\n\tshowSidebarToggle?: boolean;\n} ) {\n\tconst classes = clsx( 'admin-ui-page', className );\n\tconst effectiveAriaLabel =\n\t\tariaLabel ?? ( typeof title === 'string' ? title : '' );\n\n\treturn (\n\t\t<NavigableRegion className={ classes } ariaLabel={ effectiveAriaLabel }>\n\t\t\t{ ( title || breadcrumbs || badges ) && (\n\t\t\t\t<Header\n\t\t\t\t\tbreadcrumbs={ breadcrumbs }\n\t\t\t\t\tbadges={ badges }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tsubTitle={ subTitle }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tshowSidebarToggle={ showSidebarToggle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPadding ? (\n\t\t\t\t<div className=\"admin-ui-page__content has-padding\">\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n\nPage.SidebarToggleFill = SidebarToggleFill;\n\nexport default Page;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAAmB;AACnB,8BAA4B;AAC5B,iCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Header from './header';\nimport NavigableRegion from '../navigable-region';\nimport { SidebarToggleFill } from './sidebar-toggle-slot';\n\nfunction Page( {\n\theadingLevel,\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tchildren,\n\tclassName,\n\tactions,\n\tariaLabel,\n\thasPadding = false,\n\tshowSidebarToggle = true,\n}: {\n\theadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle?: React.ReactNode;\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tactions?: React.ReactNode;\n\tariaLabel?: string;\n\thasPadding?: boolean;\n\tshowSidebarToggle?: boolean;\n} ) {\n\tconst classes = clsx( 'admin-ui-page', className );\n\tconst effectiveAriaLabel =\n\t\tariaLabel ?? ( typeof title === 'string' ? title : '' );\n\n\treturn (\n\t\t<NavigableRegion className={ classes } ariaLabel={ effectiveAriaLabel }>\n\t\t\t{ ( title || breadcrumbs || badges ) && (\n\t\t\t\t<Header\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t\tbreadcrumbs={ breadcrumbs }\n\t\t\t\t\tbadges={ badges }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tsubTitle={ subTitle }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tshowSidebarToggle={ showSidebarToggle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPadding ? (\n\t\t\t\t<div className=\"admin-ui-page__content has-padding\">\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n\nPage.SidebarToggleFill = SidebarToggleFill;\n\nexport default Page;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAAmB;AACnB,8BAA4B;AAC5B,iCAAkC;AAgChC;AA9BF,SAAS,KAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,oBAAoB;AACrB,GAYI;AACH,QAAM,cAAU,YAAAA,SAAM,iBAAiB,SAAU;AACjD,QAAM,qBACL,cAAe,OAAO,UAAU,WAAW,QAAQ;AAEpD,SACC,6CAAC,wBAAAC,SAAA,EAAgB,WAAY,SAAU,WAAY,oBAC9C;AAAA,cAAS,eAAe,WAC3B;AAAA,MAAC,cAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IAEC,aACD,4CAAC,SAAI,WAAU,sCACZ,UACH,IAEA;AAAA,KAEF;AAEF;AAEA,KAAK,oBAAoB;AAEzB,IAAO,eAAQ;",
|
|
6
6
|
"names": ["clsx", "NavigableRegion", "Header"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// packages/admin-ui/src/lock-unlock.ts
|
|
2
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
|
|
3
|
+
var { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
4
|
+
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
5
|
+
"@wordpress/admin-ui"
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
lock,
|
|
9
|
+
unlock
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=lock-unlock.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lock-unlock.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/admin-ui'\n\t);\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,wDAAwD;AAE1D,IAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,6 +3,7 @@ import { Stack } from "@wordpress/ui";
|
|
|
3
3
|
import { SidebarToggleSlot } from "./sidebar-toggle-slot.mjs";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
function Header({
|
|
6
|
+
headingLevel = 2,
|
|
6
7
|
breadcrumbs,
|
|
7
8
|
badges,
|
|
8
9
|
title,
|
|
@@ -10,6 +11,7 @@ function Header({
|
|
|
10
11
|
actions,
|
|
11
12
|
showSidebarToggle = true
|
|
12
13
|
}) {
|
|
14
|
+
const HeadingTag = `h${headingLevel}`;
|
|
13
15
|
return /* @__PURE__ */ jsxs(
|
|
14
16
|
Stack,
|
|
15
17
|
{
|
|
@@ -26,7 +28,7 @@ function Header({
|
|
|
26
28
|
className: "admin-ui-page__sidebar-toggle-slot"
|
|
27
29
|
}
|
|
28
30
|
),
|
|
29
|
-
title && /* @__PURE__ */ jsx(
|
|
31
|
+
title && /* @__PURE__ */ jsx(HeadingTag, { className: "admin-ui-page__header-title", children: title }),
|
|
30
32
|
breadcrumbs,
|
|
31
33
|
badges
|
|
32
34
|
] }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/page/header.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { SidebarToggleSlot } from './sidebar-toggle-slot';\n\nexport default function Header( {\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tactions,\n\tshowSidebarToggle = true,\n}: {\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle: React.ReactNode;\n\tactions?: React.ReactNode;\n\tshowSidebarToggle?: boolean;\n} ) {\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tclassName=\"admin-ui-page__header\"\n\t\t\trender={ <header /> }\n\t\t>\n\t\t\t<Stack direction=\"row\" justify=\"space-between\" gap=\"sm\">\n\t\t\t\t<Stack direction=\"row\" gap=\"sm\" align=\"center\" justify=\"start\">\n\t\t\t\t\t{ showSidebarToggle && (\n\t\t\t\t\t\t<SidebarToggleSlot\n\t\t\t\t\t\t\tbubblesVirtually\n\t\t\t\t\t\t\tclassName=\"admin-ui-page__sidebar-toggle-slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ title && (\n\t\t\t\t\t\t<
|
|
5
|
-
"mappings": ";AAGA,SAAS,aAAa;AAKtB,SAAS,yBAAyB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { SidebarToggleSlot } from './sidebar-toggle-slot';\n\nexport default function Header( {\n\theadingLevel = 2,\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tactions,\n\tshowSidebarToggle = true,\n}: {\n\theadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle: React.ReactNode;\n\tactions?: React.ReactNode;\n\tshowSidebarToggle?: boolean;\n} ) {\n\tconst HeadingTag = `h${ headingLevel }` as const;\n\treturn (\n\t\t<Stack\n\t\t\tdirection=\"column\"\n\t\t\tclassName=\"admin-ui-page__header\"\n\t\t\trender={ <header /> }\n\t\t>\n\t\t\t<Stack direction=\"row\" justify=\"space-between\" gap=\"sm\">\n\t\t\t\t<Stack direction=\"row\" gap=\"sm\" align=\"center\" justify=\"start\">\n\t\t\t\t\t{ showSidebarToggle && (\n\t\t\t\t\t\t<SidebarToggleSlot\n\t\t\t\t\t\t\tbubblesVirtually\n\t\t\t\t\t\t\tclassName=\"admin-ui-page__sidebar-toggle-slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ title && (\n\t\t\t\t\t\t<HeadingTag className=\"admin-ui-page__header-title\">\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t</HeadingTag>\n\t\t\t\t\t) }\n\t\t\t\t\t{ breadcrumbs }\n\t\t\t\t\t{ badges }\n\t\t\t\t</Stack>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tgap=\"sm\"\n\t\t\t\t\tstyle={ { width: 'auto', flexShrink: 0 } }\n\t\t\t\t\tclassName=\"admin-ui-page__header-actions\"\n\t\t\t\t\talign=\"center\"\n\t\t\t\t>\n\t\t\t\t\t{ actions }\n\t\t\t\t</Stack>\n\t\t\t</Stack>\n\t\t\t{ subTitle && (\n\t\t\t\t<p className=\"admin-ui-page__header-subtitle\">{ subTitle }</p>\n\t\t\t) }\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa;AAKtB,SAAS,yBAAyB;AAwBtB,cAGR,YAHQ;AAtBG,SAAR,OAAyB;AAAA,EAC/B,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AACrB,GAQI;AACH,QAAM,aAAa,IAAK,YAAa;AACrC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAU;AAAA,MACV,QAAS,oBAAC,YAAO;AAAA,MAEjB;AAAA,6BAAC,SAAM,WAAU,OAAM,SAAQ,iBAAgB,KAAI,MAClD;AAAA,+BAAC,SAAM,WAAU,OAAM,KAAI,MAAK,OAAM,UAAS,SAAQ,SACpD;AAAA,iCACD;AAAA,cAAC;AAAA;AAAA,gBACA,kBAAgB;AAAA,gBAChB,WAAU;AAAA;AAAA,YACX;AAAA,YAEC,SACD,oBAAC,cAAW,WAAU,+BACnB,iBACH;AAAA,YAEC;AAAA,YACA;AAAA,aACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACA,WAAU;AAAA,cACV,KAAI;AAAA,cACJ,OAAQ,EAAE,OAAO,QAAQ,YAAY,EAAE;AAAA,cACvC,WAAU;AAAA,cACV,OAAM;AAAA,cAEJ;AAAA;AAAA,UACH;AAAA,WACD;AAAA,QACE,YACD,oBAAC,OAAE,WAAU,kCAAmC,oBAAU;AAAA;AAAA;AAAA,EAE5D;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,6 +5,7 @@ import NavigableRegion from "../navigable-region/index.mjs";
|
|
|
5
5
|
import { SidebarToggleFill } from "./sidebar-toggle-slot.mjs";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
function Page({
|
|
8
|
+
headingLevel,
|
|
8
9
|
breadcrumbs,
|
|
9
10
|
badges,
|
|
10
11
|
title,
|
|
@@ -22,6 +23,7 @@ function Page({
|
|
|
22
23
|
(title || breadcrumbs || badges) && /* @__PURE__ */ jsx(
|
|
23
24
|
Header,
|
|
24
25
|
{
|
|
26
|
+
headingLevel,
|
|
25
27
|
breadcrumbs,
|
|
26
28
|
badges,
|
|
27
29
|
title,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/page/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Header from './header';\nimport NavigableRegion from '../navigable-region';\nimport { SidebarToggleFill } from './sidebar-toggle-slot';\n\nfunction Page( {\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tchildren,\n\tclassName,\n\tactions,\n\tariaLabel,\n\thasPadding = false,\n\tshowSidebarToggle = true,\n}: {\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle?: React.ReactNode;\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tactions?: React.ReactNode;\n\tariaLabel?: string;\n\thasPadding?: boolean;\n\tshowSidebarToggle?: boolean;\n} ) {\n\tconst classes = clsx( 'admin-ui-page', className );\n\tconst effectiveAriaLabel =\n\t\tariaLabel ?? ( typeof title === 'string' ? title : '' );\n\n\treturn (\n\t\t<NavigableRegion className={ classes } ariaLabel={ effectiveAriaLabel }>\n\t\t\t{ ( title || breadcrumbs || badges ) && (\n\t\t\t\t<Header\n\t\t\t\t\tbreadcrumbs={ breadcrumbs }\n\t\t\t\t\tbadges={ badges }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tsubTitle={ subTitle }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tshowSidebarToggle={ showSidebarToggle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPadding ? (\n\t\t\t\t<div className=\"admin-ui-page__content has-padding\">\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n\nPage.SidebarToggleFill = SidebarToggleFill;\n\nexport default Page;\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,UAAU;AAKjB,OAAO,YAAY;AACnB,OAAO,qBAAqB;AAC5B,SAAS,yBAAyB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport Header from './header';\nimport NavigableRegion from '../navigable-region';\nimport { SidebarToggleFill } from './sidebar-toggle-slot';\n\nfunction Page( {\n\theadingLevel,\n\tbreadcrumbs,\n\tbadges,\n\ttitle,\n\tsubTitle,\n\tchildren,\n\tclassName,\n\tactions,\n\tariaLabel,\n\thasPadding = false,\n\tshowSidebarToggle = true,\n}: {\n\theadingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n\tbreadcrumbs?: React.ReactNode;\n\tbadges?: React.ReactNode;\n\ttitle?: React.ReactNode;\n\tsubTitle?: React.ReactNode;\n\tchildren: React.ReactNode;\n\tclassName?: string;\n\tactions?: React.ReactNode;\n\tariaLabel?: string;\n\thasPadding?: boolean;\n\tshowSidebarToggle?: boolean;\n} ) {\n\tconst classes = clsx( 'admin-ui-page', className );\n\tconst effectiveAriaLabel =\n\t\tariaLabel ?? ( typeof title === 'string' ? title : '' );\n\n\treturn (\n\t\t<NavigableRegion className={ classes } ariaLabel={ effectiveAriaLabel }>\n\t\t\t{ ( title || breadcrumbs || badges ) && (\n\t\t\t\t<Header\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t\tbreadcrumbs={ breadcrumbs }\n\t\t\t\t\tbadges={ badges }\n\t\t\t\t\ttitle={ title }\n\t\t\t\t\tsubTitle={ subTitle }\n\t\t\t\t\tactions={ actions }\n\t\t\t\t\tshowSidebarToggle={ showSidebarToggle }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPadding ? (\n\t\t\t\t<div className=\"admin-ui-page__content has-padding\">\n\t\t\t\t\t{ children }\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tchildren\n\t\t\t) }\n\t\t</NavigableRegion>\n\t);\n}\n\nPage.SidebarToggleFill = SidebarToggleFill;\n\nexport default Page;\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAKjB,OAAO,YAAY;AACnB,OAAO,qBAAqB;AAC5B,SAAS,yBAAyB;AAgChC,SAEE,KAFF;AA9BF,SAAS,KAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,oBAAoB;AACrB,GAYI;AACH,QAAM,UAAU,KAAM,iBAAiB,SAAU;AACjD,QAAM,qBACL,cAAe,OAAO,UAAU,WAAW,QAAQ;AAEpD,SACC,qBAAC,mBAAgB,WAAY,SAAU,WAAY,oBAC9C;AAAA,cAAS,eAAe,WAC3B;AAAA,MAAC;AAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,IAEC,aACD,oBAAC,SAAI,WAAU,sCACZ,UACH,IAEA;AAAA,KAEF;AAEF;AAEA,KAAK,oBAAoB;AAEzB,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.admin-ui-page__header {
|
|
13
|
-
padding: var(--wpds-dimension-padding-
|
|
13
|
+
padding: var(--wpds-dimension-padding-md, 12px) var(--wpds-dimension-padding-2xl, 24px);
|
|
14
14
|
border-bottom: var(--wpds-border-width-xs, 1px) solid var(--wpds-color-stroke-surface-neutral-weak, #e0e0e0);
|
|
15
15
|
background: var(--wpds-color-bg-surface-neutral-strong, #ffffff);
|
|
16
16
|
position: sticky;
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
|
|
21
21
|
.admin-ui-page__header-title {
|
|
22
22
|
font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
|
|
23
|
-
font-size: var(--wpds-font-size-
|
|
23
|
+
font-size: var(--wpds-font-size-lg, 15px);
|
|
24
24
|
font-weight: var(--wpds-font-weight-medium, 499);
|
|
25
|
-
line-height: var(--wpds-font-line-height-
|
|
25
|
+
line-height: var(--wpds-font-line-height-lg, 28px);
|
|
26
26
|
margin: 0;
|
|
27
27
|
overflow: hidden;
|
|
28
28
|
text-overflow: ellipsis;
|
|
@@ -109,13 +109,15 @@
|
|
|
109
109
|
* These variables do not appear to be used anywhere else.
|
|
110
110
|
*/
|
|
111
111
|
.admin-ui-breadcrumbs__list {
|
|
112
|
+
font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
|
|
113
|
+
font-size: var(--wpds-font-size-lg, 15px);
|
|
114
|
+
font-weight: var(--wpds-font-weight-medium, 499);
|
|
115
|
+
line-height: var(--wpds-font-line-height-lg, 28px);
|
|
112
116
|
list-style: none;
|
|
113
117
|
padding: 0;
|
|
114
118
|
margin: 0;
|
|
115
119
|
gap: 0;
|
|
116
|
-
font-size: 15px;
|
|
117
120
|
min-height: 32px;
|
|
118
|
-
font-weight: 500;
|
|
119
121
|
}
|
|
120
122
|
.admin-ui-breadcrumbs__list li:not(:last-child)::after {
|
|
121
123
|
content: "/";
|
package/build-style/style.css
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.admin-ui-page__header {
|
|
13
|
-
padding: var(--wpds-dimension-padding-
|
|
13
|
+
padding: var(--wpds-dimension-padding-md, 12px) var(--wpds-dimension-padding-2xl, 24px);
|
|
14
14
|
border-bottom: var(--wpds-border-width-xs, 1px) solid var(--wpds-color-stroke-surface-neutral-weak, #e0e0e0);
|
|
15
15
|
background: var(--wpds-color-bg-surface-neutral-strong, #ffffff);
|
|
16
16
|
position: sticky;
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
|
|
21
21
|
.admin-ui-page__header-title {
|
|
22
22
|
font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
|
|
23
|
-
font-size: var(--wpds-font-size-
|
|
23
|
+
font-size: var(--wpds-font-size-lg, 15px);
|
|
24
24
|
font-weight: var(--wpds-font-weight-medium, 499);
|
|
25
|
-
line-height: var(--wpds-font-line-height-
|
|
25
|
+
line-height: var(--wpds-font-line-height-lg, 28px);
|
|
26
26
|
margin: 0;
|
|
27
27
|
overflow: hidden;
|
|
28
28
|
text-overflow: ellipsis;
|
|
@@ -109,13 +109,15 @@
|
|
|
109
109
|
* These variables do not appear to be used anywhere else.
|
|
110
110
|
*/
|
|
111
111
|
.admin-ui-breadcrumbs__list {
|
|
112
|
+
font-family: var(--wpds-font-family-heading, -apple-system, system-ui, "Segoe UI", "Roboto", "Oxygen-Sans", "Ubuntu", "Cantarell", "Helvetica Neue", sans-serif);
|
|
113
|
+
font-size: var(--wpds-font-size-lg, 15px);
|
|
114
|
+
font-weight: var(--wpds-font-weight-medium, 499);
|
|
115
|
+
line-height: var(--wpds-font-line-height-lg, 28px);
|
|
112
116
|
list-style: none;
|
|
113
117
|
padding: 0;
|
|
114
118
|
margin: 0;
|
|
115
119
|
gap: 0;
|
|
116
|
-
font-size: 15px;
|
|
117
120
|
min-height: 32px;
|
|
118
|
-
font-weight: 500;
|
|
119
121
|
}
|
|
120
122
|
.admin-ui-breadcrumbs__list li:not(:last-child)::after {
|
|
121
123
|
content: "/";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import Breadcrumbs from '..';
|
|
9
|
+
declare const meta: Meta<typeof Breadcrumbs>;
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const SingleItem: Story;
|
|
13
|
+
export declare const TwoLevels: Story;
|
|
14
|
+
export declare const ThreeLevels: Story;
|
|
15
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/breadcrumbs/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;GAEG;AACH,OAAO,WAAW,MAAM,IAAI,CAAC;AAG7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,WAAW,CAInC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,IAAI,CAAE,CAAC;AAErC,eAAO,MAAM,UAAU,EAAE,KAIxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAQzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-unlock.d.ts","sourceRoot":"","sources":["../src/lock-unlock.ts"],"names":[],"mappings":"AAKA,eAAO,MAAQ,IAAI,mDAAE,MAAM,iCAIzB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export default function Header({ breadcrumbs, badges, title, subTitle, actions, showSidebarToggle, }: {
|
|
1
|
+
export default function Header({ headingLevel, breadcrumbs, badges, title, subTitle, actions, showSidebarToggle, }: {
|
|
2
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2
3
|
breadcrumbs?: React.ReactNode;
|
|
3
4
|
badges?: React.ReactNode;
|
|
4
5
|
title?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/page/header.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,EAC/B,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,iBAAwB,GACxB,EAAE;IACF,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B,+
|
|
1
|
+
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/page/header.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAE,EAC/B,YAAgB,EAChB,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,iBAAwB,GACxB,EAAE;IACF,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B,+BAuCA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
declare function Page({ breadcrumbs, badges, title, subTitle, children, className, actions, ariaLabel, hasPadding, showSidebarToggle, }: {
|
|
1
|
+
declare function Page({ headingLevel, breadcrumbs, badges, title, subTitle, children, className, actions, ariaLabel, hasPadding, showSidebarToggle, }: {
|
|
2
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
2
3
|
breadcrumbs?: React.ReactNode;
|
|
3
4
|
badges?: React.ReactNode;
|
|
4
5
|
title?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page/index.tsx"],"names":[],"mappings":"AAYA,iBAAS,IAAI,CAAE,EACd,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAS,EACT,UAAkB,EAClB,iBAAwB,GACxB,EAAE;IACF,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/page/index.tsx"],"names":[],"mappings":"AAYA,iBAAS,IAAI,CAAE,EACd,YAAY,EACZ,WAAW,EACX,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,SAAS,EACT,UAAkB,EAClB,iBAAwB,GACxB,EAAE;IACF,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B,+BA2BA;kBAnDQ,IAAI;;;;;;AAuDb,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import Page from '..';
|
|
9
|
+
declare const meta: Meta<typeof Page>;
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
export declare const Default: Story;
|
|
13
|
+
export declare const WithSubtitle: Story;
|
|
14
|
+
export declare const WithBreadcrumbs: Story;
|
|
15
|
+
export declare const WithBreadcrumbsAndSubtitle: Story;
|
|
16
|
+
//# sourceMappingURL=index.story.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/page/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;GAEG;AACH,OAAO,IAAI,MAAM,IAAI,CAAC;AAItB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,IAAI,CAc5B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,IAAI,CAAE,CAAC;AAErC,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAQ1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAc7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,KAexC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storybook decorator that provides a router context.
|
|
3
|
+
*
|
|
4
|
+
* Wraps stories in a minimal tanstack router (via @wordpress/route private
|
|
5
|
+
* APIs) so that components consuming `Link` from `@wordpress/route` can
|
|
6
|
+
* render without errors.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withRouter(Story: React.ComponentType): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=with-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-router.d.ts","sourceRoot":"","sources":["../../src/stories/with-router.tsx"],"names":[],"mappings":"AAaA;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAE,KAAK,EAAE,KAAK,CAAC,aAAa,+BAQrD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/admin-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Generic components to be used in the Admin UI.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -45,12 +45,13 @@
|
|
|
45
45
|
"types": "build-types",
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@wordpress/base-styles": "^6.
|
|
49
|
-
"@wordpress/components": "^32.4.
|
|
50
|
-
"@wordpress/element": "^6.
|
|
51
|
-
"@wordpress/i18n": "^6.
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
48
|
+
"@wordpress/base-styles": "^6.18.0",
|
|
49
|
+
"@wordpress/components": "^32.4.0",
|
|
50
|
+
"@wordpress/element": "^6.42.0",
|
|
51
|
+
"@wordpress/i18n": "^6.15.0",
|
|
52
|
+
"@wordpress/private-apis": "^1.42.0",
|
|
53
|
+
"@wordpress/route": "^0.8.0",
|
|
54
|
+
"@wordpress/ui": "^0.9.0",
|
|
54
55
|
"clsx": "^2.1.1"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"publishConfig": {
|
|
60
61
|
"access": "public"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "c20787b1778ae64c2db65643b1c236309d68e6ba"
|
|
63
64
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import Breadcrumbs from '..';
|
|
10
|
+
import { withRouter } from '../../stories/with-router';
|
|
11
|
+
|
|
12
|
+
const meta: Meta< typeof Breadcrumbs > = {
|
|
13
|
+
component: Breadcrumbs,
|
|
14
|
+
title: 'Admin UI/Breadcrumbs',
|
|
15
|
+
decorators: [ withRouter ],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj< typeof meta >;
|
|
21
|
+
|
|
22
|
+
export const SingleItem: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
items: [ { label: 'Root breadcrumb' } ],
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const TwoLevels: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
items: [
|
|
31
|
+
{ label: 'Root breadcrumb', to: '/settings' },
|
|
32
|
+
{ label: 'Level 1 breadcrumb' },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const ThreeLevels: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
items: [
|
|
40
|
+
{ label: 'Root breadcrumb', to: '/settings' },
|
|
41
|
+
{ label: 'Level 1 breadcrumb', to: '/settings/connectors' },
|
|
42
|
+
{ label: 'Level 2 breadcrumb' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
@use "@wordpress/base-styles/variables";
|
|
2
2
|
|
|
3
3
|
.admin-ui-breadcrumbs__list {
|
|
4
|
+
// @TODO: use Text component from UI when available.
|
|
5
|
+
font-family: var(--wpds-font-family-heading);
|
|
6
|
+
font-size: var(--wpds-font-size-lg);
|
|
7
|
+
font-weight: var(--wpds-font-weight-medium);
|
|
8
|
+
line-height: var(--wpds-font-line-height-lg);
|
|
4
9
|
list-style: none;
|
|
5
10
|
padding: 0;
|
|
6
11
|
margin: 0;
|
|
7
12
|
// gap prop don't seem to be working properly.
|
|
8
13
|
gap: 0;
|
|
9
|
-
font-size: 15px;
|
|
10
14
|
min-height: 32px;
|
|
11
|
-
font-weight: 500;
|
|
12
15
|
|
|
13
16
|
li:not(:last-child)::after {
|
|
14
17
|
content: "/";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
|
|
5
|
+
|
|
6
|
+
export const { lock, unlock } =
|
|
7
|
+
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
8
|
+
'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',
|
|
9
|
+
'@wordpress/admin-ui'
|
|
10
|
+
);
|
package/src/page/header.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { Stack } from '@wordpress/ui';
|
|
|
9
9
|
import { SidebarToggleSlot } from './sidebar-toggle-slot';
|
|
10
10
|
|
|
11
11
|
export default function Header( {
|
|
12
|
+
headingLevel = 2,
|
|
12
13
|
breadcrumbs,
|
|
13
14
|
badges,
|
|
14
15
|
title,
|
|
@@ -16,6 +17,7 @@ export default function Header( {
|
|
|
16
17
|
actions,
|
|
17
18
|
showSidebarToggle = true,
|
|
18
19
|
}: {
|
|
20
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
19
21
|
breadcrumbs?: React.ReactNode;
|
|
20
22
|
badges?: React.ReactNode;
|
|
21
23
|
title?: React.ReactNode;
|
|
@@ -23,6 +25,7 @@ export default function Header( {
|
|
|
23
25
|
actions?: React.ReactNode;
|
|
24
26
|
showSidebarToggle?: boolean;
|
|
25
27
|
} ) {
|
|
28
|
+
const HeadingTag = `h${ headingLevel }` as const;
|
|
26
29
|
return (
|
|
27
30
|
<Stack
|
|
28
31
|
direction="column"
|
|
@@ -38,9 +41,9 @@ export default function Header( {
|
|
|
38
41
|
/>
|
|
39
42
|
) }
|
|
40
43
|
{ title && (
|
|
41
|
-
<
|
|
44
|
+
<HeadingTag className="admin-ui-page__header-title">
|
|
42
45
|
{ title }
|
|
43
|
-
</
|
|
46
|
+
</HeadingTag>
|
|
44
47
|
) }
|
|
45
48
|
{ breadcrumbs }
|
|
46
49
|
{ badges }
|
package/src/page/index.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import NavigableRegion from '../navigable-region';
|
|
|
11
11
|
import { SidebarToggleFill } from './sidebar-toggle-slot';
|
|
12
12
|
|
|
13
13
|
function Page( {
|
|
14
|
+
headingLevel,
|
|
14
15
|
breadcrumbs,
|
|
15
16
|
badges,
|
|
16
17
|
title,
|
|
@@ -22,6 +23,7 @@ function Page( {
|
|
|
22
23
|
hasPadding = false,
|
|
23
24
|
showSidebarToggle = true,
|
|
24
25
|
}: {
|
|
26
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
25
27
|
breadcrumbs?: React.ReactNode;
|
|
26
28
|
badges?: React.ReactNode;
|
|
27
29
|
title?: React.ReactNode;
|
|
@@ -41,6 +43,7 @@ function Page( {
|
|
|
41
43
|
<NavigableRegion className={ classes } ariaLabel={ effectiveAriaLabel }>
|
|
42
44
|
{ ( title || breadcrumbs || badges ) && (
|
|
43
45
|
<Header
|
|
46
|
+
headingLevel={ headingLevel }
|
|
44
47
|
breadcrumbs={ breadcrumbs }
|
|
45
48
|
badges={ badges }
|
|
46
49
|
title={ title }
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
5
|
+
import { __experimentalText as Text } from '@wordpress/components';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import Page from '..';
|
|
11
|
+
import Breadcrumbs from '../../breadcrumbs';
|
|
12
|
+
import { withRouter } from '../../stories/with-router';
|
|
13
|
+
|
|
14
|
+
const meta: Meta< typeof Page > = {
|
|
15
|
+
component: Page,
|
|
16
|
+
title: 'Admin UI/Page',
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
},
|
|
20
|
+
decorators: [
|
|
21
|
+
( Story ) => (
|
|
22
|
+
<div style={ { minHeight: '400px' } }>
|
|
23
|
+
<Story />
|
|
24
|
+
</div>
|
|
25
|
+
),
|
|
26
|
+
withRouter,
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
31
|
+
|
|
32
|
+
type Story = StoryObj< typeof meta >;
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
title: 'Page title',
|
|
37
|
+
showSidebarToggle: false,
|
|
38
|
+
hasPadding: true,
|
|
39
|
+
children: <Text>Page content here</Text>,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const WithSubtitle: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
title: 'Page title',
|
|
46
|
+
subTitle: 'All of the subtitle text you need goes here.',
|
|
47
|
+
showSidebarToggle: false,
|
|
48
|
+
hasPadding: true,
|
|
49
|
+
children: <Text>Page content here</Text>,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const WithBreadcrumbs: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
showSidebarToggle: false,
|
|
56
|
+
breadcrumbs: (
|
|
57
|
+
<Breadcrumbs
|
|
58
|
+
items={ [
|
|
59
|
+
{ label: 'Root breadcrumb', to: '/connectors' },
|
|
60
|
+
{ label: 'Level 1 breadcrumb' },
|
|
61
|
+
] }
|
|
62
|
+
/>
|
|
63
|
+
),
|
|
64
|
+
hasPadding: true,
|
|
65
|
+
children: <Text>Page content here</Text>,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const WithBreadcrumbsAndSubtitle: Story = {
|
|
70
|
+
args: {
|
|
71
|
+
showSidebarToggle: false,
|
|
72
|
+
subTitle: 'All of the subtitle text you need goes here.',
|
|
73
|
+
breadcrumbs: (
|
|
74
|
+
<Breadcrumbs
|
|
75
|
+
items={ [
|
|
76
|
+
{ label: 'Root breadcrumb', to: '/connectors' },
|
|
77
|
+
{ label: 'Level 1 breadcrumb' },
|
|
78
|
+
] }
|
|
79
|
+
/>
|
|
80
|
+
),
|
|
81
|
+
hasPadding: true,
|
|
82
|
+
children: <Text>Page content here</Text>,
|
|
83
|
+
},
|
|
84
|
+
};
|
package/src/page/style.scss
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.admin-ui-page__header {
|
|
13
|
-
padding: var(--wpds-dimension-padding-
|
|
13
|
+
padding: var(--wpds-dimension-padding-md) var(--wpds-dimension-padding-2xl);
|
|
14
14
|
border-bottom: var(--wpds-border-width-xs) solid var(--wpds-color-stroke-surface-neutral-weak);
|
|
15
15
|
background: var(--wpds-color-bg-surface-neutral-strong);
|
|
16
16
|
position: sticky;
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
.admin-ui-page__header-title {
|
|
22
|
+
// @TODO: use Text component from UI when available.
|
|
22
23
|
font-family: var(--wpds-font-family-heading);
|
|
23
|
-
font-size: var(--wpds-font-size-
|
|
24
|
+
font-size: var(--wpds-font-size-lg);
|
|
24
25
|
font-weight: var(--wpds-font-weight-medium);
|
|
25
|
-
line-height: var(--wpds-font-line-height-
|
|
26
|
+
line-height: var(--wpds-font-line-height-lg);
|
|
26
27
|
margin: 0;
|
|
27
28
|
overflow: hidden;
|
|
28
29
|
text-overflow: ellipsis;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as routePrivateApis } from '@wordpress/route';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { unlock } from '../lock-unlock';
|
|
10
|
+
|
|
11
|
+
const { createMemoryHistory, createRootRoute, createRouter, RouterProvider } =
|
|
12
|
+
unlock( routePrivateApis );
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Storybook decorator that provides a router context.
|
|
16
|
+
*
|
|
17
|
+
* Wraps stories in a minimal tanstack router (via @wordpress/route private
|
|
18
|
+
* APIs) so that components consuming `Link` from `@wordpress/route` can
|
|
19
|
+
* render without errors.
|
|
20
|
+
*/
|
|
21
|
+
export function withRouter( Story: React.ComponentType ) {
|
|
22
|
+
const rootRoute = createRootRoute( { component: Story } );
|
|
23
|
+
const router = createRouter( {
|
|
24
|
+
routeTree: rootRoute,
|
|
25
|
+
history: createMemoryHistory( { initialEntries: [ '/' ] } ),
|
|
26
|
+
defaultNotFoundComponent: () => null,
|
|
27
|
+
} );
|
|
28
|
+
return <RouterProvider router={ router } />;
|
|
29
|
+
}
|