@box/blueprint-web 12.100.4 → 12.102.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.
|
@@ -13,6 +13,7 @@ import { getSeparatorSize } from './utils.js';
|
|
|
13
13
|
|
|
14
14
|
const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
15
15
|
const {
|
|
16
|
+
breadcrumbAriaLabel,
|
|
16
17
|
crumbs,
|
|
17
18
|
truncatedLinksIconAriaLabel,
|
|
18
19
|
rootIconAriaLabel,
|
|
@@ -29,84 +30,82 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
29
30
|
// If there are more than 7 crumbs, break up crumbs into first link, ellipsis icon button, and current page ancestor
|
|
30
31
|
const shouldTruncateCrumbs = crumbs?.length > 7;
|
|
31
32
|
const shouldUseEllipsisTruncation = truncationMethod === 'ellipsis' && shouldTruncateCrumbs && crumbs;
|
|
32
|
-
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
return jsx("nav", {
|
|
34
|
+
ref: forwardedRef,
|
|
35
|
+
"aria-label": breadcrumbAriaLabel,
|
|
36
|
+
className: styles.container,
|
|
37
|
+
...rest,
|
|
38
|
+
children: jsxs("ol", {
|
|
39
|
+
className: styles.breadcrumb,
|
|
40
|
+
children: [rootIconVariant && jsxs("li", {
|
|
41
|
+
className: styles.pageLink,
|
|
42
|
+
children: [rootIconVariant === 'home' ? jsx(Home, {
|
|
43
|
+
"aria-label": rootIconAriaLabel
|
|
44
|
+
}) : jsx(FolderTree, {
|
|
45
|
+
"aria-label": rootIconAriaLabel
|
|
46
|
+
}), rootIconVariant && jsx(PointerRight, {
|
|
47
|
+
height: getSeparatorSize(size),
|
|
48
|
+
role: "presentation",
|
|
49
|
+
width: getSeparatorSize(size)
|
|
50
|
+
})]
|
|
51
|
+
}), shouldUseEllipsisTruncation && jsxs(Fragment, {
|
|
52
|
+
children: [jsx(PageLink, {
|
|
53
|
+
crumb: crumbs[0],
|
|
54
|
+
isInteractive: isInteractive,
|
|
55
|
+
isLast: false,
|
|
56
|
+
onPageLinkClick: onPageLinkClick,
|
|
57
|
+
size: size
|
|
58
|
+
}), jsxs("li", {
|
|
41
59
|
className: styles.pageLink,
|
|
42
|
-
children: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
children: [jsxs(DropdownMenu.Root, {
|
|
61
|
+
children: [jsx(DropdownMenu.Trigger, {
|
|
62
|
+
children: jsx(IconButton, {
|
|
63
|
+
"aria-label": truncatedLinksIconAriaLabel,
|
|
64
|
+
className: styles.iconButtonInline,
|
|
65
|
+
icon: Ellipsis,
|
|
66
|
+
size: "small"
|
|
67
|
+
})
|
|
68
|
+
}), jsx(DropdownMenu.Content, {
|
|
69
|
+
align: "start",
|
|
70
|
+
children: crumbs.slice(1, crumbs.length - 2).map(crumb => {
|
|
71
|
+
return jsx(DropdownMenu.Item, {
|
|
72
|
+
onSelect: handlePageLinkClick(crumb.id),
|
|
73
|
+
children: jsx(Text, {
|
|
74
|
+
as: "span",
|
|
75
|
+
children: crumb.name
|
|
76
|
+
})
|
|
77
|
+
}, crumb.id);
|
|
78
|
+
})
|
|
79
|
+
})]
|
|
80
|
+
}), jsx(PointerRight, {
|
|
47
81
|
height: getSeparatorSize(size),
|
|
48
82
|
role: "presentation",
|
|
49
83
|
width: getSeparatorSize(size)
|
|
50
84
|
})]
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"aria-label": truncatedLinksIconAriaLabel,
|
|
64
|
-
className: styles.iconButtonInline,
|
|
65
|
-
icon: Ellipsis,
|
|
66
|
-
size: "small"
|
|
67
|
-
})
|
|
68
|
-
}), jsx(DropdownMenu.Content, {
|
|
69
|
-
align: "start",
|
|
70
|
-
children: crumbs.slice(1, crumbs.length - 2).map(crumb => {
|
|
71
|
-
return jsx(DropdownMenu.Item, {
|
|
72
|
-
onSelect: handlePageLinkClick(crumb.id),
|
|
73
|
-
children: jsx(Text, {
|
|
74
|
-
as: "span",
|
|
75
|
-
children: crumb.name
|
|
76
|
-
})
|
|
77
|
-
}, crumb.id);
|
|
78
|
-
})
|
|
79
|
-
})]
|
|
80
|
-
}), jsx(PointerRight, {
|
|
81
|
-
height: getSeparatorSize(size),
|
|
82
|
-
role: "presentation",
|
|
83
|
-
width: getSeparatorSize(size)
|
|
84
|
-
})]
|
|
85
|
-
}), jsx(PageLink, {
|
|
86
|
-
crumb: crumbs[crumbs.length - 2],
|
|
87
|
-
isInteractive: isInteractive,
|
|
88
|
-
isLast: false,
|
|
89
|
-
onPageLinkClick: onPageLinkClick,
|
|
90
|
-
size: size
|
|
91
|
-
}), jsx(PageLink, {
|
|
92
|
-
crumb: crumbs[crumbs.length - 1],
|
|
93
|
-
isInteractive: isInteractive,
|
|
94
|
-
isLast: true,
|
|
95
|
-
onPageLinkClick: onPageLinkClick,
|
|
96
|
-
size: size
|
|
97
|
-
})]
|
|
98
|
-
}), !shouldUseEllipsisTruncation && crumbs?.map((crumb, index) => {
|
|
99
|
-
return jsx(PageLink, {
|
|
100
|
-
crumb: crumb,
|
|
101
|
-
isInteractive: isInteractive,
|
|
102
|
-
isLast: index === crumbs.length - 1,
|
|
103
|
-
onPageLinkClick: onPageLinkClick,
|
|
104
|
-
size: size
|
|
105
|
-
}, crumb.id);
|
|
85
|
+
}), jsx(PageLink, {
|
|
86
|
+
crumb: crumbs[crumbs.length - 2],
|
|
87
|
+
isInteractive: isInteractive,
|
|
88
|
+
isLast: false,
|
|
89
|
+
onPageLinkClick: onPageLinkClick,
|
|
90
|
+
size: size
|
|
91
|
+
}), jsx(PageLink, {
|
|
92
|
+
crumb: crumbs[crumbs.length - 1],
|
|
93
|
+
isInteractive: isInteractive,
|
|
94
|
+
isLast: true,
|
|
95
|
+
onPageLinkClick: onPageLinkClick,
|
|
96
|
+
size: size
|
|
106
97
|
})]
|
|
107
|
-
})
|
|
98
|
+
}), !shouldUseEllipsisTruncation && crumbs?.map((crumb, index) => {
|
|
99
|
+
return jsx(PageLink, {
|
|
100
|
+
crumb: crumb,
|
|
101
|
+
isInteractive: isInteractive,
|
|
102
|
+
isLast: index === crumbs.length - 1,
|
|
103
|
+
onPageLinkClick: onPageLinkClick,
|
|
104
|
+
size: size
|
|
105
|
+
}, crumb.id);
|
|
106
|
+
})]
|
|
108
107
|
})
|
|
109
|
-
);
|
|
108
|
+
});
|
|
110
109
|
});
|
|
111
110
|
Breadcrumb.displayName = 'Breadcrumb';
|
|
112
111
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"container":"bp_breadcrumb_module_container--
|
|
2
|
+
var styles = {"container":"bp_breadcrumb_module_container--51e29","breadcrumb":"bp_breadcrumb_module_breadcrumb--51e29","pageLink":"bp_breadcrumb_module_pageLink--51e29","linkWithHover":"bp_breadcrumb_module_linkWithHover--51e29"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -30,9 +30,8 @@ const PageLink = ({
|
|
|
30
30
|
}
|
|
31
31
|
return jsxs("li", {
|
|
32
32
|
className: styles.pageLink,
|
|
33
|
-
children: [isInteractive ?
|
|
34
|
-
|
|
35
|
-
jsx(Link, {
|
|
33
|
+
children: [isInteractive ? jsx(Link, {
|
|
34
|
+
className: styles.linkWithHover,
|
|
36
35
|
onClick: handlePageLinkClick,
|
|
37
36
|
variant: "standalone",
|
|
38
37
|
children: jsx(Text, {
|
|
@@ -6,6 +6,11 @@ export type Crumb = {
|
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
8
|
export type BreadcrumbProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Aria label for the breadcrumb navigation element.
|
|
11
|
+
* Suggested value: "Breadcrumb". Consumers can localize or modify this value as needed for their use case.
|
|
12
|
+
*/
|
|
13
|
+
breadcrumbAriaLabel: string;
|
|
9
14
|
/** Array of breadcrumb items to display. */
|
|
10
15
|
crumbs: Crumb[];
|
|
11
16
|
/** Controls whether individual crumbs (items) and icons are interactive, or clickable. */
|
package/dist/lib-esm/index.css
CHANGED
|
@@ -2376,10 +2376,10 @@
|
|
|
2376
2376
|
text-decoration-thickness:auto;
|
|
2377
2377
|
text-underline-offset:auto;
|
|
2378
2378
|
}
|
|
2379
|
-
.bp_breadcrumb_module_container--
|
|
2379
|
+
.bp_breadcrumb_module_container--51e29{
|
|
2380
2380
|
height:var(--bp-size-060);
|
|
2381
2381
|
}
|
|
2382
|
-
.bp_breadcrumb_module_container--
|
|
2382
|
+
.bp_breadcrumb_module_container--51e29 .bp_breadcrumb_module_breadcrumb--51e29{
|
|
2383
2383
|
align-items:center;
|
|
2384
2384
|
display:flex;
|
|
2385
2385
|
gap:var(--bp-size-010);
|
|
@@ -2388,11 +2388,30 @@
|
|
|
2388
2388
|
margin:0;
|
|
2389
2389
|
padding:0;
|
|
2390
2390
|
}
|
|
2391
|
-
.bp_breadcrumb_module_container--
|
|
2391
|
+
.bp_breadcrumb_module_container--51e29 .bp_breadcrumb_module_pageLink--51e29{
|
|
2392
2392
|
align-items:center;
|
|
2393
2393
|
display:flex;
|
|
2394
2394
|
gap:var(--bp-size-010);
|
|
2395
2395
|
}
|
|
2396
|
+
|
|
2397
|
+
.bp_breadcrumb_module_linkWithHover--51e29{
|
|
2398
|
+
position:relative;
|
|
2399
|
+
}
|
|
2400
|
+
.bp_breadcrumb_module_linkWithHover--51e29::after{
|
|
2401
|
+
background-color:var(--bp-text-text-on-light-secondary);
|
|
2402
|
+
bottom:0;
|
|
2403
|
+
content:"";
|
|
2404
|
+
height:1px;
|
|
2405
|
+
left:0;
|
|
2406
|
+
position:absolute;
|
|
2407
|
+
transform:scaleX(0);
|
|
2408
|
+
transform-origin:center;
|
|
2409
|
+
transition:transform var(--animation-duration-2) var(--animation-easing-ease-base);
|
|
2410
|
+
width:100%;
|
|
2411
|
+
}
|
|
2412
|
+
.bp_breadcrumb_module_linkWithHover--51e29:hover::after{
|
|
2413
|
+
transform:scaleX(1);
|
|
2414
|
+
}
|
|
2396
2415
|
.bp_button_wrapper_module_buttonWrapper--b0897{
|
|
2397
2416
|
all:unset;
|
|
2398
2417
|
}
|