@wordpress/admin-ui 1.9.1-next.v.202603161435.0 → 1.11.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 +13 -2
- package/README.md +23 -2
- package/build/breadcrumbs/index.cjs +15 -10
- package/build/breadcrumbs/index.cjs.map +3 -3
- package/build/breadcrumbs/types.cjs.map +1 -1
- 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 +3 -1
- package/build/page/index.cjs.map +2 -2
- package/build-module/breadcrumbs/index.mjs +16 -11
- package/build-module/breadcrumbs/index.mjs.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 +3 -1
- 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/index.d.ts +22 -0
- package/build-types/breadcrumbs/index.d.ts.map +1 -1
- 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/breadcrumbs/types.d.ts +5 -2
- package/build-types/breadcrumbs/types.d.ts.map +1 -1
- 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 +21 -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 +13 -9
- package/src/breadcrumbs/index.tsx +48 -28
- package/src/breadcrumbs/stories/index.story.tsx +45 -0
- package/src/breadcrumbs/style.scss +5 -2
- package/src/breadcrumbs/test/index.test.tsx +169 -0
- package/src/breadcrumbs/types.ts +5 -2
- package/src/lock-unlock.ts +10 -0
- package/src/page/header.tsx +5 -2
- package/src/page/index.tsx +4 -1
- package/src/page/stories/index.story.tsx +167 -0
- package/src/page/style.scss +8 -3
- package/src/stories/with-router.tsx +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,17 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 1.11.0 (2026-04-01)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- `Breadcrumbs`: throw a runtime error when non-last items are missing a `to` prop [#76493](https://github.com/WordPress/gutenberg/pull/76493/)
|
|
10
|
+
- Fix Page Header not rendering when only `actions` prop is provided. [#76695](https://github.com/WordPress/gutenberg/pull/76695)
|
|
11
|
+
|
|
12
|
+
## 1.10.0 (2026-03-18)
|
|
13
|
+
|
|
14
|
+
- Update Title and Breadcrumbs font sizes. [#76452](https://github.com/WordPress/gutenberg/pull/76452)
|
|
15
|
+
|
|
5
16
|
## 1.9.0 (2026-03-04)
|
|
6
17
|
|
|
7
18
|
### Bug Fixes
|
|
8
19
|
|
|
9
|
-
-
|
|
20
|
+
- Fix type mismatch between Page `title` (ReactNode) and NavigableRegion `ariaLabel` (string) by adding an optional `ariaLabel` prop to Page that falls back to `title` when it is a string. [#75899](https://github.com/WordPress/gutenberg/pull/75899/)
|
|
10
21
|
|
|
11
22
|
## 1.8.0 (2026-02-18)
|
|
12
23
|
|
|
13
24
|
### Enhancements
|
|
14
25
|
|
|
15
|
-
-
|
|
26
|
+
- Apply `text-wrap: pretty` for more balanced text in Page component [#74907](https://github.com/WordPress/gutenberg/pull/74907)
|
|
16
27
|
|
|
17
28
|
## 1.7.0 (2026-01-29)
|
|
18
29
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Admin UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
UI components for building consistent admin page layouts.
|
|
4
|
+
|
|
5
|
+
While `@wordpress/ui` provides low-level, generic UI components that can be composed in flexible arrangements for building admin features, the purpose of this package is to guarantee consistency in the common page structure of an admin page layout. This includes high-level abstractions for a page, its sidebar, header, navigation, and other standardized page layout elements. The goal of standardizing these layouts is to provide a cohesive and predictable experience for users.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -16,7 +18,26 @@ npm install @wordpress/admin-ui --save
|
|
|
16
18
|
|
|
17
19
|
### Breadcrumbs
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
Renders a breadcrumb navigation trail.
|
|
22
|
+
|
|
23
|
+
All items except the last one must provide a `to` prop for navigation. In development mode, an error is thrown when a non-last item is missing `to`. The last item represents the current page and its `to` prop is optional. Only the last item (when it has no `to` prop) is rendered as an `h1`.
|
|
24
|
+
|
|
25
|
+
_Usage_
|
|
26
|
+
|
|
27
|
+
```jsx
|
|
28
|
+
<Breadcrumbs
|
|
29
|
+
items={ [
|
|
30
|
+
{ label: 'Home', to: '/' },
|
|
31
|
+
{ label: 'Settings', to: '/settings' },
|
|
32
|
+
{ label: 'General' },
|
|
33
|
+
] }
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
_Parameters_
|
|
38
|
+
|
|
39
|
+
- _props_ `BreadcrumbsProps`:
|
|
40
|
+
- _props.items_ `BreadcrumbsProps[ 'items' ]`: The breadcrumb items to display.
|
|
20
41
|
|
|
21
42
|
### NavigableRegion
|
|
22
43
|
|
|
@@ -28,19 +28,21 @@ var import_route = require("@wordpress/route");
|
|
|
28
28
|
var import_i18n = require("@wordpress/i18n");
|
|
29
29
|
var import_components = require("@wordpress/components");
|
|
30
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
var BreadcrumbItem = ({
|
|
32
|
-
item: { label, to }
|
|
33
|
-
}) => {
|
|
34
|
-
if (!to) {
|
|
35
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHeading, { level: 1, truncate: true, children: label }) });
|
|
36
|
-
}
|
|
37
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_route.Link, { to, children: label }) });
|
|
38
|
-
};
|
|
39
31
|
var Breadcrumbs = ({ items }) => {
|
|
40
32
|
if (!items.length) {
|
|
41
33
|
return null;
|
|
42
34
|
}
|
|
43
|
-
|
|
35
|
+
const precedingItems = items.slice(0, -1);
|
|
36
|
+
const lastItem = items[items.length - 1];
|
|
37
|
+
if (process.env.NODE_ENV !== "production") {
|
|
38
|
+
const invalidItem = precedingItems.find((item) => !item.to);
|
|
39
|
+
if (invalidItem) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Breadcrumbs: item "${invalidItem.label}" is missing a \`to\` prop. All items except the last one must have a \`to\` prop.`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": (0, import_i18n.__)("Breadcrumbs"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
44
46
|
import_components.__experimentalHStack,
|
|
45
47
|
{
|
|
46
48
|
as: "ul",
|
|
@@ -48,7 +50,10 @@ var Breadcrumbs = ({ items }) => {
|
|
|
48
50
|
spacing: 0,
|
|
49
51
|
justify: "flex-start",
|
|
50
52
|
alignment: "center",
|
|
51
|
-
children:
|
|
53
|
+
children: [
|
|
54
|
+
precedingItems.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_route.Link, { to: item.to, children: item.label }) }, index)),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: lastItem.to ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_route.Link, { to: lastItem.to, children: lastItem.label }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalHeading, { level: 1, truncate: true, children: lastItem.label }) })
|
|
56
|
+
]
|
|
52
57
|
}
|
|
53
58
|
) });
|
|
54
59
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/breadcrumbs/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Link } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAqB;AACrB,kBAAmB;AACnB,wBAGO;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Link } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BreadcrumbsProps } from './types';\n\n/**\n * Renders a breadcrumb navigation trail.\n *\n * All items except the last one must provide a `to` prop for navigation.\n * In development mode, an error is thrown when a non-last item is missing `to`.\n * The last item represents the current page and its `to` prop is optional.\n * Only the last item (when it has no `to` prop) is rendered as an `h1`.\n *\n * @param props\n * @param props.items The breadcrumb items to display.\n *\n * @example\n * ```jsx\n * <Breadcrumbs\n * items={ [\n * { label: 'Home', to: '/' },\n * { label: 'Settings', to: '/settings' },\n * { label: 'General' },\n * ] }\n * />\n * ```\n */\nexport const Breadcrumbs = ( { items }: BreadcrumbsProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst precedingItems = items.slice( 0, -1 );\n\tconst lastItem = items[ items.length - 1 ];\n\n\tif ( process.env.NODE_ENV !== 'production' ) {\n\t\tconst invalidItem = precedingItems.find( ( item ) => ! item.to );\n\t\tif ( invalidItem ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Breadcrumbs: item \"${ invalidItem.label }\" is missing a \\`to\\` prop. All items except the last one must have a \\`to\\` prop.`\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<nav aria-label={ __( 'Breadcrumbs' ) }>\n\t\t\t<HStack\n\t\t\t\tas=\"ul\"\n\t\t\t\tclassName=\"admin-ui-breadcrumbs__list\"\n\t\t\t\tspacing={ 0 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\talignment=\"center\"\n\t\t\t>\n\t\t\t\t{ precedingItems.map( ( item, index ) => (\n\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t<Link to={ item.to }>{ item.label }</Link>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t\t<li>\n\t\t\t\t\t{ lastItem.to ? (\n\t\t\t\t\t\t<Link to={ lastItem.to }>{ lastItem.label }</Link>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Heading level={ 1 } truncate>\n\t\t\t\t\t\t\t{ lastItem.label }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t) }\n\t\t\t\t</li>\n\t\t\t</HStack>\n\t\t</nav>\n\t);\n};\n\nexport default Breadcrumbs;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAAqB;AACrB,kBAAmB;AACnB,wBAGO;AAgDJ;AAnBI,IAAM,cAAc,CAAE,EAAE,MAAM,MAAyB;AAC7D,MAAK,CAAE,MAAM,QAAS;AACrB,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,MAAM,MAAO,GAAG,EAAG;AAC1C,QAAM,WAAW,MAAO,MAAM,SAAS,CAAE;AAEzC,MAAK,QAAQ,IAAI,aAAa,cAAe;AAC5C,UAAM,cAAc,eAAe,KAAM,CAAE,SAAU,CAAE,KAAK,EAAG;AAC/D,QAAK,aAAc;AAClB,YAAM,IAAI;AAAA,QACT,sBAAuB,YAAY,KAAM;AAAA,MAC1C;AAAA,IACD;AAAA,EACD;AAEA,SACC,4CAAC,SAAI,kBAAa,gBAAI,aAAc,GACnC;AAAA,IAAC,kBAAAA;AAAA,IAAA;AAAA,MACA,IAAG;AAAA,MACH,WAAU;AAAA,MACV,SAAU;AAAA,MACV,SAAQ;AAAA,MACR,WAAU;AAAA,MAER;AAAA,uBAAe,IAAK,CAAE,MAAM,UAC7B,4CAAC,QACA,sDAAC,qBAAK,IAAK,KAAK,IAAO,eAAK,OAAO,KAD1B,KAEV,CACC;AAAA,QACF,4CAAC,QACE,mBAAS,KACV,4CAAC,qBAAK,IAAK,SAAS,IAAO,mBAAS,OAAO,IAE3C,4CAAC,kBAAAC,uBAAA,EAAQ,OAAQ,GAAI,UAAQ,MAC1B,mBAAS,OACZ,GAEF;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": ["HStack", "Heading"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/breadcrumbs/types.ts"],
|
|
4
|
-
"sourcesContent": ["export interface BreadcrumbItem {\n\t/**\n\t * The label text for the breadcrumb item.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The router path that the breadcrumb item should link to.\n\t * It is optional
|
|
4
|
+
"sourcesContent": ["export interface BreadcrumbItem {\n\t/**\n\t * The label text for the breadcrumb item.\n\t */\n\tlabel: string;\n\n\t/**\n\t * The router path that the breadcrumb item should link to.\n\t * It is optional for the last item (the current page).\n\t * All preceding items should provide a `to` prop.\n\t */\n\tto?: string;\n}\n\nexport interface BreadcrumbsProps extends React.HTMLAttributes< HTMLElement > {\n\t/**\n\t * An array of items to display in the breadcrumb trail.\n\t * The last item is considered the current item and has an optional `to` prop.\n\t * All preceding items must have a `to` prop \u2014 in development mode,\n\t * an error is thrown when this requirement is not met.\n\t */\n\titems: BreadcrumbItem[];\n\t/**\n\t * A boolean to show/hide the current item in the trail.\n\t * Note that when `false` the current item is only visually hidden.\n\t */\n\tshowCurrentItem?: boolean;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -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,
|
|
@@ -53,9 +54,10 @@ function Page({
|
|
|
53
54
|
const classes = (0, import_clsx.default)("admin-ui-page", className);
|
|
54
55
|
const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : "");
|
|
55
56
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_navigable_region.default, { className: classes, ariaLabel: effectiveAriaLabel, children: [
|
|
56
|
-
(title || breadcrumbs || badges) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
(title || breadcrumbs || badges || actions) && /* @__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 || actions ) && (\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,UAAU,YACrC;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
|
}
|
|
@@ -5,20 +5,22 @@ import {
|
|
|
5
5
|
__experimentalHeading as Heading,
|
|
6
6
|
__experimentalHStack as HStack
|
|
7
7
|
} from "@wordpress/components";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
var BreadcrumbItem = ({
|
|
10
|
-
item: { label, to }
|
|
11
|
-
}) => {
|
|
12
|
-
if (!to) {
|
|
13
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Heading, { level: 1, truncate: true, children: label }) });
|
|
14
|
-
}
|
|
15
|
-
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, { to, children: label }) });
|
|
16
|
-
};
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
9
|
var Breadcrumbs = ({ items }) => {
|
|
18
10
|
if (!items.length) {
|
|
19
11
|
return null;
|
|
20
12
|
}
|
|
21
|
-
|
|
13
|
+
const precedingItems = items.slice(0, -1);
|
|
14
|
+
const lastItem = items[items.length - 1];
|
|
15
|
+
if (process.env.NODE_ENV !== "production") {
|
|
16
|
+
const invalidItem = precedingItems.find((item) => !item.to);
|
|
17
|
+
if (invalidItem) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
`Breadcrumbs: item "${invalidItem.label}" is missing a \`to\` prop. All items except the last one must have a \`to\` prop.`
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": __("Breadcrumbs"), children: /* @__PURE__ */ jsxs(
|
|
22
24
|
HStack,
|
|
23
25
|
{
|
|
24
26
|
as: "ul",
|
|
@@ -26,7 +28,10 @@ var Breadcrumbs = ({ items }) => {
|
|
|
26
28
|
spacing: 0,
|
|
27
29
|
justify: "flex-start",
|
|
28
30
|
alignment: "center",
|
|
29
|
-
children:
|
|
31
|
+
children: [
|
|
32
|
+
precedingItems.map((item, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, { to: item.to, children: item.label }) }, index)),
|
|
33
|
+
/* @__PURE__ */ jsx("li", { children: lastItem.to ? /* @__PURE__ */ jsx(Link, { to: lastItem.to, children: lastItem.label }) : /* @__PURE__ */ jsx(Heading, { level: 1, truncate: true, children: lastItem.label }) })
|
|
34
|
+
]
|
|
30
35
|
}
|
|
31
36
|
) });
|
|
32
37
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/breadcrumbs/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Link } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type {
|
|
5
|
-
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB;AAAA,EACC,yBAAyB;AAAA,EACzB,wBAAwB;AAAA,OAClB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Link } from '@wordpress/route';\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BreadcrumbsProps } from './types';\n\n/**\n * Renders a breadcrumb navigation trail.\n *\n * All items except the last one must provide a `to` prop for navigation.\n * In development mode, an error is thrown when a non-last item is missing `to`.\n * The last item represents the current page and its `to` prop is optional.\n * Only the last item (when it has no `to` prop) is rendered as an `h1`.\n *\n * @param props\n * @param props.items The breadcrumb items to display.\n *\n * @example\n * ```jsx\n * <Breadcrumbs\n * items={ [\n * { label: 'Home', to: '/' },\n * { label: 'Settings', to: '/settings' },\n * { label: 'General' },\n * ] }\n * />\n * ```\n */\nexport const Breadcrumbs = ( { items }: BreadcrumbsProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\n\t}\n\n\tconst precedingItems = items.slice( 0, -1 );\n\tconst lastItem = items[ items.length - 1 ];\n\n\tif ( process.env.NODE_ENV !== 'production' ) {\n\t\tconst invalidItem = precedingItems.find( ( item ) => ! item.to );\n\t\tif ( invalidItem ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Breadcrumbs: item \"${ invalidItem.label }\" is missing a \\`to\\` prop. All items except the last one must have a \\`to\\` prop.`\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<nav aria-label={ __( 'Breadcrumbs' ) }>\n\t\t\t<HStack\n\t\t\t\tas=\"ul\"\n\t\t\t\tclassName=\"admin-ui-breadcrumbs__list\"\n\t\t\t\tspacing={ 0 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\talignment=\"center\"\n\t\t\t>\n\t\t\t\t{ precedingItems.map( ( item, index ) => (\n\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t<Link to={ item.to }>{ item.label }</Link>\n\t\t\t\t\t</li>\n\t\t\t\t) ) }\n\t\t\t\t<li>\n\t\t\t\t\t{ lastItem.to ? (\n\t\t\t\t\t\t<Link to={ lastItem.to }>{ lastItem.label }</Link>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Heading level={ 1 } truncate>\n\t\t\t\t\t\t\t{ lastItem.label }\n\t\t\t\t\t\t</Heading>\n\t\t\t\t\t) }\n\t\t\t\t</li>\n\t\t\t</HStack>\n\t\t</nav>\n\t);\n};\n\nexport default Breadcrumbs;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB;AAAA,EACC,yBAAyB;AAAA,EACzB,wBAAwB;AAAA,OAClB;AAgDJ,SASG,KATH;AAnBI,IAAM,cAAc,CAAE,EAAE,MAAM,MAAyB;AAC7D,MAAK,CAAE,MAAM,QAAS;AACrB,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,MAAM,MAAO,GAAG,EAAG;AAC1C,QAAM,WAAW,MAAO,MAAM,SAAS,CAAE;AAEzC,MAAK,QAAQ,IAAI,aAAa,cAAe;AAC5C,UAAM,cAAc,eAAe,KAAM,CAAE,SAAU,CAAE,KAAK,EAAG;AAC/D,QAAK,aAAc;AAClB,YAAM,IAAI;AAAA,QACT,sBAAuB,YAAY,KAAM;AAAA,MAC1C;AAAA,IACD;AAAA,EACD;AAEA,SACC,oBAAC,SAAI,cAAa,GAAI,aAAc,GACnC;AAAA,IAAC;AAAA;AAAA,MACA,IAAG;AAAA,MACH,WAAU;AAAA,MACV,SAAU;AAAA,MACV,SAAQ;AAAA,MACR,WAAU;AAAA,MAER;AAAA,uBAAe,IAAK,CAAE,MAAM,UAC7B,oBAAC,QACA,8BAAC,QAAK,IAAK,KAAK,IAAO,eAAK,OAAO,KAD1B,KAEV,CACC;AAAA,QACF,oBAAC,QACE,mBAAS,KACV,oBAAC,QAAK,IAAK,SAAS,IAAO,mBAAS,OAAO,IAE3C,oBAAC,WAAQ,OAAQ,GAAI,UAAQ,MAC1B,mBAAS,OACZ,GAEF;AAAA;AAAA;AAAA,EACD,GACD;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
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,
|
|
@@ -19,9 +20,10 @@ function Page({
|
|
|
19
20
|
const classes = clsx("admin-ui-page", className);
|
|
20
21
|
const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : "");
|
|
21
22
|
return /* @__PURE__ */ jsxs(NavigableRegion, { className: classes, ariaLabel: effectiveAriaLabel, children: [
|
|
22
|
-
(title || breadcrumbs || badges) && /* @__PURE__ */ jsx(
|
|
23
|
+
(title || breadcrumbs || badges || actions) && /* @__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 || actions ) && (\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,UAAU,YACrC;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: "/";
|
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { BreadcrumbsProps } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Renders a breadcrumb navigation trail.
|
|
7
|
+
*
|
|
8
|
+
* All items except the last one must provide a `to` prop for navigation.
|
|
9
|
+
* In development mode, an error is thrown when a non-last item is missing `to`.
|
|
10
|
+
* The last item represents the current page and its `to` prop is optional.
|
|
11
|
+
* Only the last item (when it has no `to` prop) is rendered as an `h1`.
|
|
12
|
+
*
|
|
13
|
+
* @param props
|
|
14
|
+
* @param props.items The breadcrumb items to display.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```jsx
|
|
18
|
+
* <Breadcrumbs
|
|
19
|
+
* items={ [
|
|
20
|
+
* { label: 'Home', to: '/' },
|
|
21
|
+
* { label: 'Settings', to: '/settings' },
|
|
22
|
+
* { label: 'General' },
|
|
23
|
+
* ] }
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
5
27
|
export declare const Breadcrumbs: ({ items }: BreadcrumbsProps) => import("react").JSX.Element | null;
|
|
6
28
|
export default Breadcrumbs;
|
|
7
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/breadcrumbs/index.tsx"],"names":[],"mappings":"AAUA;;GAEG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/breadcrumbs/index.tsx"],"names":[],"mappings":"AAUA;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GAAK,WAAW,gBAAgB,uCA2CvD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -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"}
|
|
@@ -5,14 +5,17 @@ export interface BreadcrumbItem {
|
|
|
5
5
|
label: string;
|
|
6
6
|
/**
|
|
7
7
|
* The router path that the breadcrumb item should link to.
|
|
8
|
-
* It is optional
|
|
8
|
+
* It is optional for the last item (the current page).
|
|
9
|
+
* All preceding items should provide a `to` prop.
|
|
9
10
|
*/
|
|
10
11
|
to?: string;
|
|
11
12
|
}
|
|
12
13
|
export interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement> {
|
|
13
14
|
/**
|
|
14
15
|
* An array of items to display in the breadcrumb trail.
|
|
15
|
-
* The last item is considered the current item.
|
|
16
|
+
* The last item is considered the current item and has an optional `to` prop.
|
|
17
|
+
* All preceding items must have a `to` prop — in development mode,
|
|
18
|
+
* an error is thrown when this requirement is not met.
|
|
16
19
|
*/
|
|
17
20
|
items: BreadcrumbItem[];
|
|
18
21
|
/**
|