@box/blueprint-web 12.98.3 → 12.99.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/dist/lib-esm/breadcrumb/breadcrumb.js +15 -12
- package/dist/lib-esm/breadcrumb/breadcrumb.module.js +1 -1
- package/dist/lib-esm/breadcrumb/page-link.d.ts +3 -1
- package/dist/lib-esm/breadcrumb/page-link.js +14 -7
- package/dist/lib-esm/breadcrumb/utils.d.ts +3 -0
- package/dist/lib-esm/breadcrumb/utils.js +24 -0
- package/dist/lib-esm/index.css +5 -13
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
|
9
9
|
import { Text } from '../text/text.js';
|
|
10
10
|
import { PageLink } from './page-link.js';
|
|
11
11
|
import styles from './breadcrumb.module.js';
|
|
12
|
+
import { getSeparatorSize } from './utils.js';
|
|
12
13
|
|
|
13
14
|
const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
14
15
|
const {
|
|
@@ -43,15 +44,17 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
43
44
|
}) : jsx(FolderTree, {
|
|
44
45
|
"aria-label": rootIconAriaLabel
|
|
45
46
|
}), rootIconVariant && jsx(PointerRight, {
|
|
46
|
-
|
|
47
|
-
role: "presentation"
|
|
47
|
+
height: getSeparatorSize(size),
|
|
48
|
+
role: "presentation",
|
|
49
|
+
width: getSeparatorSize(size)
|
|
48
50
|
})]
|
|
49
51
|
}), shouldUseEllipsisTruncation && jsxs(Fragment, {
|
|
50
52
|
children: [jsx(PageLink, {
|
|
51
53
|
crumb: crumbs[0],
|
|
52
54
|
isInteractive: isInteractive,
|
|
53
55
|
isLast: false,
|
|
54
|
-
onPageLinkClick: onPageLinkClick
|
|
56
|
+
onPageLinkClick: onPageLinkClick,
|
|
57
|
+
size: size
|
|
55
58
|
}), jsxs("li", {
|
|
56
59
|
className: styles.pageLink,
|
|
57
60
|
children: [jsxs(DropdownMenu.Root, {
|
|
@@ -75,31 +78,31 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
75
78
|
})
|
|
76
79
|
})]
|
|
77
80
|
}), jsx(PointerRight, {
|
|
78
|
-
|
|
79
|
-
role: "presentation"
|
|
81
|
+
height: getSeparatorSize(size),
|
|
82
|
+
role: "presentation",
|
|
83
|
+
width: getSeparatorSize(size)
|
|
80
84
|
})]
|
|
81
85
|
}), jsx(PageLink, {
|
|
82
86
|
crumb: crumbs[crumbs.length - 2],
|
|
83
87
|
isInteractive: isInteractive,
|
|
84
88
|
isLast: false,
|
|
85
|
-
onPageLinkClick: onPageLinkClick
|
|
89
|
+
onPageLinkClick: onPageLinkClick,
|
|
90
|
+
size: size
|
|
86
91
|
}), jsx(PageLink, {
|
|
87
92
|
crumb: crumbs[crumbs.length - 1],
|
|
88
93
|
isInteractive: isInteractive,
|
|
89
94
|
isLast: true,
|
|
90
|
-
onPageLinkClick: onPageLinkClick
|
|
95
|
+
onPageLinkClick: onPageLinkClick,
|
|
96
|
+
size: size
|
|
91
97
|
})]
|
|
92
98
|
}), !shouldUseEllipsisTruncation && crumbs?.map((crumb, index) => {
|
|
93
99
|
return jsx(PageLink, {
|
|
94
100
|
crumb: crumb,
|
|
95
101
|
isInteractive: isInteractive,
|
|
96
102
|
isLast: index === crumbs.length - 1,
|
|
97
|
-
onPageLinkClick: onPageLinkClick
|
|
103
|
+
onPageLinkClick: onPageLinkClick,
|
|
104
|
+
size: size
|
|
98
105
|
}, crumb.id);
|
|
99
|
-
}), jsx("li", {
|
|
100
|
-
children: jsxs("span", {
|
|
101
|
-
children: [size, " size breadcrumb"]
|
|
102
|
-
})
|
|
103
106
|
})]
|
|
104
107
|
})
|
|
105
108
|
})
|
|
@@ -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--19a63","breadcrumb":"bp_breadcrumb_module_breadcrumb--19a63","pageLink":"bp_breadcrumb_module_pageLink--19a63"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -11,5 +11,7 @@ export interface PageLinkProps {
|
|
|
11
11
|
isInteractive: boolean;
|
|
12
12
|
/** The callback to call when the page link is clicked. */
|
|
13
13
|
onPageLinkClick: (id: string) => void;
|
|
14
|
+
/** The text size of the page link. */
|
|
15
|
+
size: 'xsmall' | 'small' | 'medium' | 'large';
|
|
14
16
|
}
|
|
15
|
-
export declare const PageLink: ({ crumb, isLast, isInteractive, onPageLinkClick }: PageLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const PageLink: ({ crumb, isLast, isInteractive, onPageLinkClick, size }: PageLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,12 +4,14 @@ import { PointerRight } from '@box/blueprint-web-assets/icons/Fill';
|
|
|
4
4
|
import { Link } from '../primitives/link/link.js';
|
|
5
5
|
import { Text } from '../text/text.js';
|
|
6
6
|
import styles from './breadcrumb.module.js';
|
|
7
|
+
import { getTextVariantFromSize, getSeparatorSize } from './utils.js';
|
|
7
8
|
|
|
8
9
|
const PageLink = ({
|
|
9
10
|
crumb,
|
|
10
11
|
isLast,
|
|
11
12
|
isInteractive,
|
|
12
|
-
onPageLinkClick
|
|
13
|
+
onPageLinkClick,
|
|
14
|
+
size
|
|
13
15
|
}) => {
|
|
14
16
|
const handlePageLinkClick = useCallback(() => {
|
|
15
17
|
onPageLinkClick(crumb.id);
|
|
@@ -21,7 +23,7 @@ const PageLink = ({
|
|
|
21
23
|
"aria-current": "page",
|
|
22
24
|
as: "span",
|
|
23
25
|
color: "textOnLightDefault",
|
|
24
|
-
variant:
|
|
26
|
+
variant: getTextVariantFromSize(size),
|
|
25
27
|
children: crumb.name
|
|
26
28
|
})
|
|
27
29
|
}, crumb.id);
|
|
@@ -31,17 +33,22 @@ const PageLink = ({
|
|
|
31
33
|
children: [isInteractive ?
|
|
32
34
|
// Add hover behavior https://jira.inside-box.net/browse/UXF-428
|
|
33
35
|
jsx(Link, {
|
|
34
|
-
className: styles.pageLinkInteractive,
|
|
35
|
-
inheritFont: true,
|
|
36
36
|
onClick: handlePageLinkClick,
|
|
37
37
|
variant: "standalone",
|
|
38
|
-
children:
|
|
38
|
+
children: jsx(Text, {
|
|
39
|
+
as: "span",
|
|
40
|
+
color: "textOnLightSecondary",
|
|
41
|
+
variant: getTextVariantFromSize(size),
|
|
42
|
+
children: crumb.name
|
|
43
|
+
})
|
|
39
44
|
}) : jsx(Text, {
|
|
40
45
|
as: "span",
|
|
46
|
+
variant: getTextVariantFromSize(size),
|
|
41
47
|
children: crumb.name
|
|
42
48
|
}), jsx(PointerRight, {
|
|
43
|
-
|
|
44
|
-
role: "presentation"
|
|
49
|
+
height: getSeparatorSize(size),
|
|
50
|
+
role: "presentation",
|
|
51
|
+
width: getSeparatorSize(size)
|
|
45
52
|
})]
|
|
46
53
|
}, crumb.id);
|
|
47
54
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { bpSize030, bpSize020 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
2
|
+
|
|
3
|
+
const getTextVariantFromSize = size => {
|
|
4
|
+
switch (size) {
|
|
5
|
+
case 'small':
|
|
6
|
+
return 'bodyDefault';
|
|
7
|
+
case 'medium':
|
|
8
|
+
return 'bodyLarge';
|
|
9
|
+
default:
|
|
10
|
+
return 'bodyLarge';
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const getSeparatorSize = size => {
|
|
14
|
+
switch (size) {
|
|
15
|
+
case 'small':
|
|
16
|
+
return bpSize020;
|
|
17
|
+
case 'medium':
|
|
18
|
+
return bpSize030;
|
|
19
|
+
default:
|
|
20
|
+
return bpSize030;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { getSeparatorSize, getTextVariantFromSize };
|
package/dist/lib-esm/index.css
CHANGED
|
@@ -2370,29 +2370,21 @@
|
|
|
2370
2370
|
text-decoration-thickness:auto;
|
|
2371
2371
|
text-underline-offset:auto;
|
|
2372
2372
|
}
|
|
2373
|
-
.bp_breadcrumb_module_container--
|
|
2374
|
-
|
|
2375
|
-
font-size:var(--bp-font-size-06);
|
|
2376
|
-
line-height:var(--bp-size-060);
|
|
2373
|
+
.bp_breadcrumb_module_container--19a63{
|
|
2374
|
+
height:var(--bp-size-060);
|
|
2377
2375
|
}
|
|
2378
|
-
.bp_breadcrumb_module_container--
|
|
2376
|
+
.bp_breadcrumb_module_container--19a63 .bp_breadcrumb_module_breadcrumb--19a63{
|
|
2379
2377
|
align-items:center;
|
|
2380
2378
|
display:flex;
|
|
2381
2379
|
gap:var(--bp-size-010);
|
|
2380
|
+
height:100%;
|
|
2382
2381
|
list-style:none;
|
|
2383
2382
|
}
|
|
2384
|
-
.bp_breadcrumb_module_container--
|
|
2383
|
+
.bp_breadcrumb_module_container--19a63 .bp_breadcrumb_module_pageLink--19a63{
|
|
2385
2384
|
align-items:center;
|
|
2386
2385
|
display:flex;
|
|
2387
2386
|
gap:var(--bp-size-010);
|
|
2388
2387
|
}
|
|
2389
|
-
.bp_breadcrumb_module_container--ce1b6 .bp_breadcrumb_module_pageLink--ce1b6 .bp_breadcrumb_module_pageLinkInteractive--ce1b6{
|
|
2390
|
-
color:inherit;
|
|
2391
|
-
}
|
|
2392
|
-
.bp_breadcrumb_module_container--ce1b6 .bp_breadcrumb_module_pageLink--ce1b6 .bp_breadcrumb_module_separator--ce1b6{
|
|
2393
|
-
height:var(--bp-size-030);
|
|
2394
|
-
width:var(--bp-size-030);
|
|
2395
|
-
}
|
|
2396
2388
|
.bp_button_wrapper_module_buttonWrapper--b0897{
|
|
2397
2389
|
all:unset;
|
|
2398
2390
|
}
|