@wordpress/admin-ui 1.3.0 → 1.3.1-next.dc3f6d3c1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/breadcrumbs/index.js +60 -0
- package/build/breadcrumbs/index.js.map +7 -0
- package/build/breadcrumbs/types.js +19 -0
- package/build/breadcrumbs/types.js.map +7 -0
- package/build/index.js +3 -0
- package/build/index.js.map +2 -2
- package/build-module/breadcrumbs/index.js +38 -0
- package/build-module/breadcrumbs/index.js.map +7 -0
- package/build-module/breadcrumbs/types.js +1 -0
- package/build-module/breadcrumbs/types.js.map +7 -0
- package/build-module/index.js +6 -4
- package/build-module/index.js.map +2 -2
- package/build-style/style-rtl.css +18 -0
- package/build-style/style.css +18 -0
- package/build-types/breadcrumbs/index.d.ts +7 -0
- package/build-types/breadcrumbs/index.d.ts.map +1 -0
- package/build-types/breadcrumbs/types.d.ts +24 -0
- package/build-types/breadcrumbs/types.d.ts.map +1 -0
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/package.json +7 -5
- package/src/breadcrumbs/index.tsx +63 -0
- package/src/breadcrumbs/style.scss +22 -0
- package/src/breadcrumbs/types.ts +25 -0
- package/src/index.ts +1 -0
- package/src/style.scss +2 -1
- package/tsconfig.json +6 -1
- package/tsconfig.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,60 @@
|
|
|
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/breadcrumbs/index.tsx
|
|
21
|
+
var breadcrumbs_exports = {};
|
|
22
|
+
__export(breadcrumbs_exports, {
|
|
23
|
+
Breadcrumbs: () => Breadcrumbs,
|
|
24
|
+
default: () => breadcrumbs_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(breadcrumbs_exports);
|
|
27
|
+
var import_route = require("@wordpress/route");
|
|
28
|
+
var import_i18n = require("@wordpress/i18n");
|
|
29
|
+
var import_components = require("@wordpress/components");
|
|
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
|
+
var Breadcrumbs = ({ items }) => {
|
|
40
|
+
if (!items.length) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { "aria-label": (0, import_i18n.__)("Breadcrumbs"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
44
|
+
import_components.__experimentalHStack,
|
|
45
|
+
{
|
|
46
|
+
as: "ul",
|
|
47
|
+
className: "admin-ui-breadcrumbs__list",
|
|
48
|
+
spacing: 0,
|
|
49
|
+
justify: "flex-start",
|
|
50
|
+
alignment: "center",
|
|
51
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbItem, { item }, index))
|
|
52
|
+
}
|
|
53
|
+
) });
|
|
54
|
+
};
|
|
55
|
+
var breadcrumbs_default = Breadcrumbs;
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
Breadcrumbs
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 {\n\tBreadcrumbsProps,\n\tBreadcrumbItem as BreadcrumbItemType,\n} from './types';\n\nconst BreadcrumbItem = ( {\n\titem: { label, to },\n}: {\n\titem: BreadcrumbItemType;\n} ) => {\n\tif ( ! to ) {\n\t\treturn (\n\t\t\t<li>\n\t\t\t\t<Heading level={ 1 } truncate>\n\t\t\t\t\t{ label }\n\t\t\t\t</Heading>\n\t\t\t</li>\n\t\t);\n\t}\n\n\treturn (\n\t\t<li>\n\t\t\t<Link to={ to }>{ label }</Link>\n\t\t</li>\n\t);\n};\n\nexport const Breadcrumbs = ( { items }: BreadcrumbsProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\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{ items.map( ( item, index ) => (\n\t\t\t\t\t<BreadcrumbItem key={ index } item={ item } />\n\t\t\t\t) ) }\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;AAkBH;AARJ,IAAM,iBAAiB,CAAE;AAAA,EACxB,MAAM,EAAE,OAAO,GAAG;AACnB,MAEO;AACN,MAAK,CAAE,IAAK;AACX,WACC,4CAAC,QACA,sDAAC,kBAAAA,uBAAA,EAAQ,OAAQ,GAAI,UAAQ,MAC1B,iBACH,GACD;AAAA,EAEF;AAEA,SACC,4CAAC,QACA,sDAAC,qBAAK,IAAY,iBAAO,GAC1B;AAEF;AAEO,IAAM,cAAc,CAAE,EAAE,MAAM,MAAyB;AAC7D,MAAK,CAAE,MAAM,QAAS;AACrB,WAAO;AAAA,EACR;AAEA,SACC,4CAAC,SAAI,kBAAa,gBAAI,aAAc,GACnC;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,IAAG;AAAA,MACH,WAAU;AAAA,MACV,SAAU;AAAA,MACV,SAAQ;AAAA,MACR,WAAU;AAAA,MAER,gBAAM,IAAK,CAAE,MAAM,UACpB,4CAAC,kBAA6B,QAAR,KAAsB,CAC3C;AAAA;AAAA,EACH,GACD;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": ["Heading", "HStack"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// packages/admin-ui/src/breadcrumbs/types.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
19
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 because the current item does not have a link.\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.\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
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/index.js
CHANGED
|
@@ -30,14 +30,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// packages/admin-ui/src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
Breadcrumbs: () => import_breadcrumbs.default,
|
|
33
34
|
NavigableRegion: () => import_navigable_region.default,
|
|
34
35
|
Page: () => import_page.default
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
var import_breadcrumbs = __toESM(require("./breadcrumbs"));
|
|
37
39
|
var import_navigable_region = __toESM(require("./navigable-region"));
|
|
38
40
|
var import_page = __toESM(require("./page"));
|
|
39
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
42
|
0 && (module.exports = {
|
|
43
|
+
Breadcrumbs,
|
|
41
44
|
NavigableRegion,
|
|
42
45
|
Page
|
|
43
46
|
});
|
package/build/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as NavigableRegion } from './navigable-region';\nexport { default as Page } from './page';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8BAA2C;AAC3C,kBAAgC;",
|
|
4
|
+
"sourcesContent": ["export { default as Breadcrumbs } from './breadcrumbs';\nexport { default as NavigableRegion } from './navigable-region';\nexport { default as Page } from './page';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAAuC;AACvC,8BAA2C;AAC3C,kBAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// packages/admin-ui/src/breadcrumbs/index.tsx
|
|
2
|
+
import { Link } from "@wordpress/route";
|
|
3
|
+
import { __ } from "@wordpress/i18n";
|
|
4
|
+
import {
|
|
5
|
+
__experimentalHeading as Heading,
|
|
6
|
+
__experimentalHStack as HStack
|
|
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
|
+
};
|
|
17
|
+
var Breadcrumbs = ({ items }) => {
|
|
18
|
+
if (!items.length) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": __("Breadcrumbs"), children: /* @__PURE__ */ jsx(
|
|
22
|
+
HStack,
|
|
23
|
+
{
|
|
24
|
+
as: "ul",
|
|
25
|
+
className: "admin-ui-breadcrumbs__list",
|
|
26
|
+
spacing: 0,
|
|
27
|
+
justify: "flex-start",
|
|
28
|
+
alignment: "center",
|
|
29
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx(BreadcrumbItem, { item }, index))
|
|
30
|
+
}
|
|
31
|
+
) });
|
|
32
|
+
};
|
|
33
|
+
var breadcrumbs_default = Breadcrumbs;
|
|
34
|
+
export {
|
|
35
|
+
Breadcrumbs,
|
|
36
|
+
breadcrumbs_default as default
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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 {\n\tBreadcrumbsProps,\n\tBreadcrumbItem as BreadcrumbItemType,\n} from './types';\n\nconst BreadcrumbItem = ( {\n\titem: { label, to },\n}: {\n\titem: BreadcrumbItemType;\n} ) => {\n\tif ( ! to ) {\n\t\treturn (\n\t\t\t<li>\n\t\t\t\t<Heading level={ 1 } truncate>\n\t\t\t\t\t{ label }\n\t\t\t\t</Heading>\n\t\t\t</li>\n\t\t);\n\t}\n\n\treturn (\n\t\t<li>\n\t\t\t<Link to={ to }>{ label }</Link>\n\t\t</li>\n\t);\n};\n\nexport const Breadcrumbs = ( { items }: BreadcrumbsProps ) => {\n\tif ( ! items.length ) {\n\t\treturn null;\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{ items.map( ( item, index ) => (\n\t\t\t\t\t<BreadcrumbItem key={ index } item={ item } />\n\t\t\t\t) ) }\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;AAkBH;AARJ,IAAM,iBAAiB,CAAE;AAAA,EACxB,MAAM,EAAE,OAAO,GAAG;AACnB,MAEO;AACN,MAAK,CAAE,IAAK;AACX,WACC,oBAAC,QACA,8BAAC,WAAQ,OAAQ,GAAI,UAAQ,MAC1B,iBACH,GACD;AAAA,EAEF;AAEA,SACC,oBAAC,QACA,8BAAC,QAAK,IAAY,iBAAO,GAC1B;AAEF;AAEO,IAAM,cAAc,CAAE,EAAE,MAAM,MAAyB;AAC7D,MAAK,CAAE,MAAM,QAAS;AACrB,WAAO;AAAA,EACR;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,gBAAM,IAAK,CAAE,MAAM,UACpB,oBAAC,kBAA6B,QAAR,KAAsB,CAC3C;AAAA;AAAA,EACH,GACD;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
package/build-module/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// packages/admin-ui/src/index.ts
|
|
2
|
-
import { default as default2 } from "./
|
|
3
|
-
import { default as default3 } from "./
|
|
2
|
+
import { default as default2 } from "./breadcrumbs";
|
|
3
|
+
import { default as default3 } from "./navigable-region";
|
|
4
|
+
import { default as default4 } from "./page";
|
|
4
5
|
export {
|
|
5
|
-
default2 as
|
|
6
|
-
default3 as
|
|
6
|
+
default2 as Breadcrumbs,
|
|
7
|
+
default3 as NavigableRegion,
|
|
8
|
+
default4 as Page
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as NavigableRegion } from './navigable-region';\nexport { default as Page } from './page';\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAuB;",
|
|
4
|
+
"sourcesContent": ["export { default as Breadcrumbs } from './breadcrumbs';\nexport { default as NavigableRegion } from './navigable-region';\nexport { default as Page } from './page';\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAoB,WAAXA,gBAA8B;AACvC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAAuB;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -147,4 +147,22 @@
|
|
|
147
147
|
.show-icon-labels .admin-ui-page__header-actions .components-button.has-icon::after {
|
|
148
148
|
content: attr(aria-label);
|
|
149
149
|
font-size: 12px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.admin-ui-breadcrumbs__list {
|
|
153
|
+
list-style: none;
|
|
154
|
+
padding: 0;
|
|
155
|
+
margin: 0;
|
|
156
|
+
gap: 0;
|
|
157
|
+
font-size: 15px;
|
|
158
|
+
min-height: 32px;
|
|
159
|
+
font-weight: 500;
|
|
160
|
+
}
|
|
161
|
+
.admin-ui-breadcrumbs__list li:not(:last-child)::after {
|
|
162
|
+
content: "/";
|
|
163
|
+
margin: 0 8px;
|
|
164
|
+
}
|
|
165
|
+
.admin-ui-breadcrumbs__list h1 {
|
|
166
|
+
font-size: inherit;
|
|
167
|
+
line-height: inherit;
|
|
150
168
|
}
|
package/build-style/style.css
CHANGED
|
@@ -147,4 +147,22 @@
|
|
|
147
147
|
.show-icon-labels .admin-ui-page__header-actions .components-button.has-icon::after {
|
|
148
148
|
content: attr(aria-label);
|
|
149
149
|
font-size: 12px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.admin-ui-breadcrumbs__list {
|
|
153
|
+
list-style: none;
|
|
154
|
+
padding: 0;
|
|
155
|
+
margin: 0;
|
|
156
|
+
gap: 0;
|
|
157
|
+
font-size: 15px;
|
|
158
|
+
min-height: 32px;
|
|
159
|
+
font-weight: 500;
|
|
160
|
+
}
|
|
161
|
+
.admin-ui-breadcrumbs__list li:not(:last-child)::after {
|
|
162
|
+
content: "/";
|
|
163
|
+
margin: 0 8px;
|
|
164
|
+
}
|
|
165
|
+
.admin-ui-breadcrumbs__list h1 {
|
|
166
|
+
font-size: inherit;
|
|
167
|
+
line-height: inherit;
|
|
150
168
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/breadcrumbs/index.tsx"],"names":[],"mappings":"AAUA;;GAEG;AACH,OAAO,KAAK,EACX,gBAAgB,EAEhB,MAAM,SAAS,CAAC;AAwBjB,eAAO,MAAM,WAAW,GAAK,WAAW,gBAAgB,uCAoBvD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface BreadcrumbItem {
|
|
2
|
+
/**
|
|
3
|
+
* The label text for the breadcrumb item.
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
/**
|
|
7
|
+
* The router path that the breadcrumb item should link to.
|
|
8
|
+
* It is optional because the current item does not have a link.
|
|
9
|
+
*/
|
|
10
|
+
to?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement> {
|
|
13
|
+
/**
|
|
14
|
+
* An array of items to display in the breadcrumb trail.
|
|
15
|
+
* The last item is considered the current item.
|
|
16
|
+
*/
|
|
17
|
+
items: BreadcrumbItem[];
|
|
18
|
+
/**
|
|
19
|
+
* A boolean to show/hide the current item in the trail.
|
|
20
|
+
* Note that when `false` the current item is only visually hidden.
|
|
21
|
+
*/
|
|
22
|
+
showCurrentItem?: boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/breadcrumbs/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAE,WAAW,CAAE;IAC5E;;;OAGG;IACH,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/admin-ui",
|
|
3
|
-
"version": "1.3.0",
|
|
3
|
+
"version": "1.3.1-next.dc3f6d3c1.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",
|
|
@@ -37,13 +37,15 @@
|
|
|
37
37
|
"types": "build-types",
|
|
38
38
|
"sideEffects": false,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wordpress/base-styles": "^6.11.0",
|
|
41
|
-
"@wordpress/components": "^30.8.0",
|
|
42
|
-
"@wordpress/element": "^6.35.0",
|
|
40
|
+
"@wordpress/base-styles": "^6.11.1-next.dc3f6d3c1.0",
|
|
41
|
+
"@wordpress/components": "^30.8.2-next.dc3f6d3c1.0",
|
|
42
|
+
"@wordpress/element": "^6.35.1-next.dc3f6d3c1.0",
|
|
43
|
+
"@wordpress/i18n": "^6.8.1-next.dc3f6d3c1.0",
|
|
44
|
+
"@wordpress/route": "^0.1.1-next.dc3f6d3c1.0",
|
|
43
45
|
"clsx": "^2.1.1"
|
|
44
46
|
},
|
|
45
47
|
"publishConfig": {
|
|
46
48
|
"access": "public"
|
|
47
49
|
},
|
|
48
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f73b5e69b34fbaccfb8c47783f4f993059ff1a41"
|
|
49
51
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Link } from '@wordpress/route';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import {
|
|
7
|
+
__experimentalHeading as Heading,
|
|
8
|
+
__experimentalHStack as HStack,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import type {
|
|
15
|
+
BreadcrumbsProps,
|
|
16
|
+
BreadcrumbItem as BreadcrumbItemType,
|
|
17
|
+
} from './types';
|
|
18
|
+
|
|
19
|
+
const BreadcrumbItem = ( {
|
|
20
|
+
item: { label, to },
|
|
21
|
+
}: {
|
|
22
|
+
item: BreadcrumbItemType;
|
|
23
|
+
} ) => {
|
|
24
|
+
if ( ! to ) {
|
|
25
|
+
return (
|
|
26
|
+
<li>
|
|
27
|
+
<Heading level={ 1 } truncate>
|
|
28
|
+
{ label }
|
|
29
|
+
</Heading>
|
|
30
|
+
</li>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<li>
|
|
36
|
+
<Link to={ to }>{ label }</Link>
|
|
37
|
+
</li>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Breadcrumbs = ( { items }: BreadcrumbsProps ) => {
|
|
42
|
+
if ( ! items.length ) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<nav aria-label={ __( 'Breadcrumbs' ) }>
|
|
48
|
+
<HStack
|
|
49
|
+
as="ul"
|
|
50
|
+
className="admin-ui-breadcrumbs__list"
|
|
51
|
+
spacing={ 0 }
|
|
52
|
+
justify="flex-start"
|
|
53
|
+
alignment="center"
|
|
54
|
+
>
|
|
55
|
+
{ items.map( ( item, index ) => (
|
|
56
|
+
<BreadcrumbItem key={ index } item={ item } />
|
|
57
|
+
) ) }
|
|
58
|
+
</HStack>
|
|
59
|
+
</nav>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default Breadcrumbs;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/variables";
|
|
2
|
+
|
|
3
|
+
.admin-ui-breadcrumbs__list {
|
|
4
|
+
list-style: none;
|
|
5
|
+
padding: 0;
|
|
6
|
+
margin: 0;
|
|
7
|
+
// gap prop don't seem to be working properly.
|
|
8
|
+
gap: 0;
|
|
9
|
+
font-size: 15px;
|
|
10
|
+
min-height: 32px;
|
|
11
|
+
font-weight: 500;
|
|
12
|
+
|
|
13
|
+
li:not(:last-child)::after {
|
|
14
|
+
content: "/";
|
|
15
|
+
margin: 0 variables.$grid-unit-10;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
h1 {
|
|
19
|
+
font-size: inherit;
|
|
20
|
+
line-height: inherit;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface BreadcrumbItem {
|
|
2
|
+
/**
|
|
3
|
+
* The label text for the breadcrumb item.
|
|
4
|
+
*/
|
|
5
|
+
label: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The router path that the breadcrumb item should link to.
|
|
9
|
+
* It is optional because the current item does not have a link.
|
|
10
|
+
*/
|
|
11
|
+
to?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface BreadcrumbsProps extends React.HTMLAttributes< HTMLElement > {
|
|
15
|
+
/**
|
|
16
|
+
* An array of items to display in the breadcrumb trail.
|
|
17
|
+
* The last item is considered the current item.
|
|
18
|
+
*/
|
|
19
|
+
items: BreadcrumbItem[];
|
|
20
|
+
/**
|
|
21
|
+
* A boolean to show/hide the current item in the trail.
|
|
22
|
+
* Note that when `false` the current item is only visually hidden.
|
|
23
|
+
*/
|
|
24
|
+
showCurrentItem?: boolean;
|
|
25
|
+
}
|
package/src/index.ts
CHANGED
package/src/style.scss
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
@use "./page/style.scss"
|
|
1
|
+
@use "./page/style.scss" as *;
|
|
2
|
+
@use "./breadcrumbs/style.scss" as *;
|
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig.json",
|
|
3
3
|
"extends": "../../tsconfig.base.json",
|
|
4
|
-
"references": [
|
|
4
|
+
"references": [
|
|
5
|
+
{ "path": "../components" },
|
|
6
|
+
{ "path": "../element" },
|
|
7
|
+
{ "path": "../i18n" },
|
|
8
|
+
{ "path": "../route" }
|
|
9
|
+
]
|
|
5
10
|
}
|