@clayui/breadcrumb 3.156.0 → 3.157.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/lib/Item.d.ts +3 -3
- package/lib/cjs/Item.js +64 -39
- package/lib/cjs/index.js +96 -72
- package/lib/esm/Item.js +35 -35
- package/lib/esm/index.js +67 -66
- package/lib/index.d.ts +4 -4
- package/package.json +34 -35
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Breadcrumb is a secondary navigation pattern that identifies the page position inside a hierarchy.
|
|
4
4
|
|
|
5
|
-
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
5
|
+
- [Documentation](https://clayui.com/docs/components/breadcrumb.html)
|
|
6
|
+
- [Changelog](./CHANGELOG.md)
|
|
7
|
+
- [Breaking change schedule](./BREAKING.md)
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -16,4 +16,4 @@ yarn add @clayui/breadcrumb
|
|
|
16
16
|
|
|
17
17
|
## Contribute
|
|
18
18
|
|
|
19
|
-
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.
|
|
19
|
+
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.
|
package/lib/Item.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SPDX-FileCopyrightText:
|
|
3
|
-
* SPDX-License-Identifier:
|
|
2
|
+
* SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com
|
|
3
|
+
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
interface IItem extends React.HTMLAttributes<HTMLLIElement> {
|
|
@@ -21,5 +21,5 @@ interface IItem extends React.HTMLAttributes<HTMLLIElement> {
|
|
|
21
21
|
*/
|
|
22
22
|
onClick?: (event: React.SyntheticEvent) => void;
|
|
23
23
|
}
|
|
24
|
-
declare
|
|
24
|
+
declare function Item({ active, href, label, onClick, ...otherProps }: IItem): React.JSX.Element;
|
|
25
25
|
export default Item;
|
package/lib/cjs/Item.js
CHANGED
|
@@ -1,41 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
label,
|
|
20
|
-
onClick,
|
|
21
|
-
...otherProps
|
|
22
|
-
} = _ref;
|
|
23
|
-
return /*#__PURE__*/_react.default.createElement("li", _extends({
|
|
24
|
-
className: (0, _classnames.default)('breadcrumb-item', {
|
|
25
|
-
active
|
|
26
|
-
})
|
|
27
|
-
}, otherProps), /*#__PURE__*/_react.default.createElement(_shared.LinkOrButton, {
|
|
28
|
-
"aria-current": active ? 'page' : undefined,
|
|
29
|
-
buttonDisplayType: "unstyled",
|
|
30
|
-
buttonType: "button",
|
|
31
|
-
className: "breadcrumb-link",
|
|
32
|
-
href: active ? '#' : href,
|
|
33
|
-
onClick: event => {
|
|
34
|
-
if (onClick) {
|
|
35
|
-
event.preventDefault();
|
|
36
|
-
onClick(event);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}, label));
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
40
19
|
};
|
|
41
|
-
var
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Item_exports = {};
|
|
30
|
+
__export(Item_exports, {
|
|
31
|
+
default: () => Item_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Item_exports);
|
|
34
|
+
var import_shared = require("@clayui/shared");
|
|
35
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
function Item({ active, href, label, onClick, ...otherProps }) {
|
|
38
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
39
|
+
"li",
|
|
40
|
+
{
|
|
41
|
+
className: (0, import_classnames.default)("breadcrumb-item", {
|
|
42
|
+
active
|
|
43
|
+
}),
|
|
44
|
+
...otherProps
|
|
45
|
+
},
|
|
46
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
47
|
+
import_shared.LinkOrButton,
|
|
48
|
+
{
|
|
49
|
+
"aria-current": active ? "page" : void 0,
|
|
50
|
+
buttonDisplayType: "unstyled",
|
|
51
|
+
buttonType: "button",
|
|
52
|
+
className: "breadcrumb-link",
|
|
53
|
+
"data-testid": `testId${label}`,
|
|
54
|
+
href: active ? "#" : href,
|
|
55
|
+
onClick: (event) => {
|
|
56
|
+
if (onClick) {
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
onClick(event);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
label
|
|
63
|
+
)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
var Item_default = Item;
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,77 +1,101 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => src_default
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); } /**
|
|
16
|
-
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
|
|
17
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
-
*/
|
|
19
|
-
const findActiveItems = items => {
|
|
20
|
-
return items.filter(item => {
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
var import_button = require("@clayui/button");
|
|
35
|
+
var import_classnames = __toESM(require("classnames"));
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_warning = __toESM(require("warning"));
|
|
38
|
+
var import_Item = __toESM(require("./Item"));
|
|
39
|
+
function findActiveItems(items) {
|
|
40
|
+
return items.filter((item) => {
|
|
21
41
|
return item.active;
|
|
22
42
|
});
|
|
23
|
-
};
|
|
24
|
-
const Breadcrumb = _ref => {
|
|
25
|
-
let {
|
|
26
|
-
ariaLabels = {
|
|
27
|
-
breadcrumb: 'Breadcrumb',
|
|
28
|
-
close: 'Partially nest breadcrumbs',
|
|
29
|
-
open: 'See full nested'
|
|
30
|
-
},
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
ellipsisBuffer = 1,
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
34
|
-
ellipsisProps = {},
|
|
35
|
-
className,
|
|
36
|
-
items,
|
|
37
|
-
spritemap,
|
|
38
|
-
...otherProps
|
|
39
|
-
} = _ref;
|
|
40
|
-
"production" !== "production" ? (0, _warning.default)(findActiveItems(items).length === 1, 'ClayBreadcrumb expects at least one `active` item on `items`.') : void 0;
|
|
41
|
-
const [collapsed, setCollapsed] = (0, _react.useState)(false);
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement("nav", {
|
|
43
|
-
"aria-label": ariaLabels.breadcrumb,
|
|
44
|
-
className: "breadcrumb-bar"
|
|
45
|
-
}, items.length > 3 && /*#__PURE__*/_react.default.createElement(_button.ClayButtonWithIcon, {
|
|
46
|
-
"aria-expanded": collapsed,
|
|
47
|
-
"aria-label": collapsed ? ariaLabels.close : ariaLabels.open,
|
|
48
|
-
className: "breadcrumb-toggle",
|
|
49
|
-
displayType: null,
|
|
50
|
-
onClick: () => setCollapsed(!collapsed),
|
|
51
|
-
size: "xs",
|
|
52
|
-
spritemap: spritemap,
|
|
53
|
-
symbol: collapsed ? 'angle-double-left' : 'angle-double-right',
|
|
54
|
-
title: collapsed ? ariaLabels.close : ariaLabels.open
|
|
55
|
-
}), /*#__PURE__*/_react.default.createElement("ol", _extends({}, otherProps, {
|
|
56
|
-
className: (0, _classnames.default)('breadcrumb', className)
|
|
57
|
-
}), items.length > 3 && !collapsed ? /*#__PURE__*/_react.default.createElement(Items, {
|
|
58
|
-
items: [items[items.length - 2], items[items.length - 1]]
|
|
59
|
-
}) : /*#__PURE__*/_react.default.createElement(Items, {
|
|
60
|
-
items: items
|
|
61
|
-
})));
|
|
62
|
-
};
|
|
63
|
-
function Items(_ref2) {
|
|
64
|
-
let {
|
|
65
|
-
items
|
|
66
|
-
} = _ref2;
|
|
67
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, items.map((item, i) => /*#__PURE__*/_react.default.isValidElement(item) ? (/*#__PURE__*/_react.default.cloneElement(item, {
|
|
68
|
-
key: `ellipsis${i}`
|
|
69
|
-
})) : /*#__PURE__*/_react.default.createElement(_Item.default, {
|
|
70
|
-
active: item.active,
|
|
71
|
-
href: item.href,
|
|
72
|
-
key: `breadcrumbItem${i}`,
|
|
73
|
-
label: item.label,
|
|
74
|
-
onClick: item.onClick
|
|
75
|
-
})));
|
|
76
43
|
}
|
|
77
|
-
|
|
44
|
+
function Breadcrumb({
|
|
45
|
+
ariaLabels = {
|
|
46
|
+
breadcrumb: "Breadcrumb",
|
|
47
|
+
close: "Partially nest breadcrumbs",
|
|
48
|
+
open: "See full nested"
|
|
49
|
+
},
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
51
|
+
ellipsisBuffer = 1,
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
+
ellipsisProps = {},
|
|
54
|
+
className,
|
|
55
|
+
items,
|
|
56
|
+
spritemap,
|
|
57
|
+
...otherProps
|
|
58
|
+
}) {
|
|
59
|
+
(0, import_warning.default)(
|
|
60
|
+
findActiveItems(items).length === 1,
|
|
61
|
+
"ClayBreadcrumb expects at least one `active` item on `items`."
|
|
62
|
+
);
|
|
63
|
+
const [collapsed, setCollapsed] = (0, import_react.useState)(false);
|
|
64
|
+
return /* @__PURE__ */ import_react.default.createElement("nav", { "aria-label": ariaLabels.breadcrumb, className: "breadcrumb-bar" }, items.length > 3 && /* @__PURE__ */ import_react.default.createElement(
|
|
65
|
+
import_button.ClayButtonWithIcon,
|
|
66
|
+
{
|
|
67
|
+
"aria-expanded": collapsed,
|
|
68
|
+
"aria-label": collapsed ? ariaLabels.close : ariaLabels.open,
|
|
69
|
+
className: "breadcrumb-toggle",
|
|
70
|
+
displayType: null,
|
|
71
|
+
onClick: () => setCollapsed(!collapsed),
|
|
72
|
+
size: "xs",
|
|
73
|
+
spritemap,
|
|
74
|
+
symbol: collapsed ? "angle-double-left" : "angle-double-right",
|
|
75
|
+
title: collapsed ? ariaLabels.close : ariaLabels.open
|
|
76
|
+
}
|
|
77
|
+
), /* @__PURE__ */ import_react.default.createElement("ol", { ...otherProps, className: (0, import_classnames.default)("breadcrumb", className) }, items.length > 3 && !collapsed ? /* @__PURE__ */ import_react.default.createElement(
|
|
78
|
+
Items,
|
|
79
|
+
{
|
|
80
|
+
items: [
|
|
81
|
+
items[items.length - 2],
|
|
82
|
+
items[items.length - 1]
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
) : /* @__PURE__ */ import_react.default.createElement(Items, { items })));
|
|
86
|
+
}
|
|
87
|
+
function Items({ items }) {
|
|
88
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, items.map(
|
|
89
|
+
(item, i) => import_react.default.isValidElement(item) ? import_react.default.cloneElement(item, { key: `ellipsis${i}` }) : /* @__PURE__ */ import_react.default.createElement(
|
|
90
|
+
import_Item.default,
|
|
91
|
+
{
|
|
92
|
+
active: item.active,
|
|
93
|
+
href: item.href,
|
|
94
|
+
key: `breadcrumbItem${i}`,
|
|
95
|
+
label: item.label,
|
|
96
|
+
onClick: item.onClick
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
));
|
|
100
|
+
}
|
|
101
|
+
var src_default = Breadcrumb;
|
package/lib/esm/Item.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
import { LinkOrButton } from "@clayui/shared";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import React from "react";
|
|
4
|
+
function Item({ active, href, label, onClick, ...otherProps }) {
|
|
5
|
+
return /* @__PURE__ */ React.createElement(
|
|
6
|
+
"li",
|
|
7
|
+
{
|
|
8
|
+
className: classNames("breadcrumb-item", {
|
|
9
|
+
active
|
|
10
|
+
}),
|
|
11
|
+
...otherProps
|
|
12
|
+
},
|
|
13
|
+
/* @__PURE__ */ React.createElement(
|
|
14
|
+
LinkOrButton,
|
|
15
|
+
{
|
|
16
|
+
"aria-current": active ? "page" : void 0,
|
|
17
|
+
buttonDisplayType: "unstyled",
|
|
18
|
+
buttonType: "button",
|
|
19
|
+
className: "breadcrumb-link",
|
|
20
|
+
"data-testid": `testId${label}`,
|
|
21
|
+
href: active ? "#" : href,
|
|
22
|
+
onClick: (event) => {
|
|
23
|
+
if (onClick) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
onClick(event);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
label
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
var Item_default = Item;
|
|
34
|
+
export {
|
|
35
|
+
Item_default as default
|
|
35
36
|
};
|
|
36
|
-
export default Item;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import classNames from 'classnames';
|
|
9
|
-
import React, { useState } from 'react';
|
|
10
|
-
import warning from 'warning';
|
|
11
|
-
import Item from "./Item.js";
|
|
12
|
-
const findActiveItems = items => {
|
|
13
|
-
return items.filter(item => {
|
|
1
|
+
import { ClayButtonWithIcon } from "@clayui/button";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
import warning from "warning";
|
|
5
|
+
import Item from "./Item";
|
|
6
|
+
function findActiveItems(items) {
|
|
7
|
+
return items.filter((item) => {
|
|
14
8
|
return item.active;
|
|
15
9
|
});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
10
|
+
}
|
|
11
|
+
function Breadcrumb({
|
|
12
|
+
ariaLabels = {
|
|
13
|
+
breadcrumb: "Breadcrumb",
|
|
14
|
+
close: "Partially nest breadcrumbs",
|
|
15
|
+
open: "See full nested"
|
|
16
|
+
},
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
18
|
+
ellipsisBuffer = 1,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
+
ellipsisProps = {},
|
|
21
|
+
className,
|
|
22
|
+
items,
|
|
23
|
+
spritemap,
|
|
24
|
+
...otherProps
|
|
25
|
+
}) {
|
|
26
|
+
warning(
|
|
27
|
+
findActiveItems(items).length === 1,
|
|
28
|
+
"ClayBreadcrumb expects at least one `active` item on `items`."
|
|
29
|
+
);
|
|
34
30
|
const [collapsed, setCollapsed] = useState(false);
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
let {
|
|
58
|
-
items
|
|
59
|
-
} = _ref2;
|
|
60
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, items.map((item, i) => /*#__PURE__*/React.isValidElement(item) ? (/*#__PURE__*/React.cloneElement(item, {
|
|
61
|
-
key: `ellipsis${i}`
|
|
62
|
-
})) : /*#__PURE__*/React.createElement(Item, {
|
|
63
|
-
active: item.active,
|
|
64
|
-
href: item.href,
|
|
65
|
-
key: `breadcrumbItem${i}`,
|
|
66
|
-
label: item.label,
|
|
67
|
-
onClick: item.onClick
|
|
68
|
-
})));
|
|
31
|
+
return /* @__PURE__ */ React.createElement("nav", { "aria-label": ariaLabels.breadcrumb, className: "breadcrumb-bar" }, items.length > 3 && /* @__PURE__ */ React.createElement(
|
|
32
|
+
ClayButtonWithIcon,
|
|
33
|
+
{
|
|
34
|
+
"aria-expanded": collapsed,
|
|
35
|
+
"aria-label": collapsed ? ariaLabels.close : ariaLabels.open,
|
|
36
|
+
className: "breadcrumb-toggle",
|
|
37
|
+
displayType: null,
|
|
38
|
+
onClick: () => setCollapsed(!collapsed),
|
|
39
|
+
size: "xs",
|
|
40
|
+
spritemap,
|
|
41
|
+
symbol: collapsed ? "angle-double-left" : "angle-double-right",
|
|
42
|
+
title: collapsed ? ariaLabels.close : ariaLabels.open
|
|
43
|
+
}
|
|
44
|
+
), /* @__PURE__ */ React.createElement("ol", { ...otherProps, className: classNames("breadcrumb", className) }, items.length > 3 && !collapsed ? /* @__PURE__ */ React.createElement(
|
|
45
|
+
Items,
|
|
46
|
+
{
|
|
47
|
+
items: [
|
|
48
|
+
items[items.length - 2],
|
|
49
|
+
items[items.length - 1]
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
) : /* @__PURE__ */ React.createElement(Items, { items })));
|
|
69
53
|
}
|
|
70
|
-
|
|
54
|
+
function Items({ items }) {
|
|
55
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, items.map(
|
|
56
|
+
(item, i) => React.isValidElement(item) ? React.cloneElement(item, { key: `ellipsis${i}` }) : /* @__PURE__ */ React.createElement(
|
|
57
|
+
Item,
|
|
58
|
+
{
|
|
59
|
+
active: item.active,
|
|
60
|
+
href: item.href,
|
|
61
|
+
key: `breadcrumbItem${i}`,
|
|
62
|
+
label: item.label,
|
|
63
|
+
onClick: item.onClick
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
var src_default = Breadcrumb;
|
|
69
|
+
export {
|
|
70
|
+
src_default as default
|
|
71
|
+
};
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SPDX-FileCopyrightText:
|
|
3
|
-
* SPDX-License-Identifier:
|
|
2
|
+
* SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com
|
|
3
|
+
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Item from './Item';
|
|
@@ -10,8 +10,8 @@ interface IProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
|
10
10
|
*/
|
|
11
11
|
ariaLabels?: {
|
|
12
12
|
breadcrumb: string;
|
|
13
|
-
open: string;
|
|
14
13
|
close: string;
|
|
14
|
+
open: string;
|
|
15
15
|
};
|
|
16
16
|
/**
|
|
17
17
|
* The number of Breadcrumb Items to show on each side of the active Breadcrumb Item before
|
|
@@ -33,5 +33,5 @@ interface IProps extends React.HTMLAttributes<HTMLOListElement> {
|
|
|
33
33
|
*/
|
|
34
34
|
spritemap?: string;
|
|
35
35
|
}
|
|
36
|
-
declare
|
|
36
|
+
declare function Breadcrumb({ ariaLabels, ellipsisBuffer, ellipsisProps, className, items, spritemap, ...otherProps }: IProps): React.JSX.Element;
|
|
37
37
|
export default Breadcrumb;
|
package/package.json
CHANGED
|
@@ -1,49 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"import": "./lib/esm/index.js",
|
|
13
|
-
"require": "./lib/cjs/index.js"
|
|
14
|
-
}
|
|
2
|
+
"browserslist": [
|
|
3
|
+
"extends browserslist-config-clay"
|
|
4
|
+
],
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@clayui/button": "^3.157.0-alpha.1",
|
|
7
|
+
"@clayui/icon": "^3.157.0-alpha.1",
|
|
8
|
+
"@clayui/link": "^3.157.0-alpha.1",
|
|
9
|
+
"@clayui/shared": "^3.157.0-alpha.1",
|
|
10
|
+
"classnames": "2.3.1",
|
|
11
|
+
"warning": "^4.0.3"
|
|
15
12
|
},
|
|
16
|
-
"
|
|
17
|
-
"ts:main": "src/index.tsx",
|
|
13
|
+
"description": "ClayBreadcrumb component",
|
|
18
14
|
"files": [
|
|
19
15
|
"lib"
|
|
20
16
|
],
|
|
21
|
-
"scripts": {
|
|
22
|
-
"build": "yarn build:cjs && yarn build:esm",
|
|
23
|
-
"build:cjs": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib/cjs --extensions .ts,.tsx",
|
|
24
|
-
"build:esm": "cross-env NODE_ENV=production babel src --root-mode upward --out-dir lib/esm --extensions .ts,.tsx --env-name esm",
|
|
25
|
-
"buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
|
|
26
|
-
"test": "jest --config ../../jest.config.js"
|
|
27
|
-
},
|
|
28
17
|
"keywords": [
|
|
29
18
|
"clay",
|
|
30
19
|
"react"
|
|
31
20
|
],
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"@clayui/link": "^3.144.1",
|
|
36
|
-
"@clayui/shared": "^3.156.0",
|
|
37
|
-
"classnames": "^2.2.6",
|
|
38
|
-
"warning": "^4.0.3"
|
|
39
|
-
},
|
|
21
|
+
"license": "BSD-3-Clause",
|
|
22
|
+
"main": "lib/cjs/index.js",
|
|
23
|
+
"name": "@clayui/breadcrumb",
|
|
40
24
|
"peerDependencies": {
|
|
41
|
-
"@clayui/css": "3.
|
|
25
|
+
"@clayui/css": "^3.157.0-alpha.1",
|
|
42
26
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
43
27
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
|
|
44
28
|
},
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
"repository": "https://github.com/liferay/clay",
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "yarn build:cjs && yarn build:esm",
|
|
32
|
+
"build:cjs": "cross-env NODE_ENV=production node ../build-package-esbuild.js --format=cjs --outdir=lib/cjs",
|
|
33
|
+
"build:esm": "cross-env NODE_ENV=production node ../build-package-esbuild.js --format=esm --outdir=lib/esm",
|
|
34
|
+
"buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
|
|
35
|
+
"test": "jest --config ../../jest.config.js"
|
|
36
|
+
},
|
|
37
|
+
"version": "3.157.0-alpha.1",
|
|
38
|
+
"module": "lib/esm/index.js",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./lib/index.d.ts",
|
|
42
|
+
"import": "./lib/esm/index.js",
|
|
43
|
+
"require": "./lib/cjs/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"types": "lib/index.d.ts",
|
|
47
|
+
"ts:main": "src/index.tsx"
|
|
49
48
|
}
|