@box/blueprint-web 14.6.0 → 14.7.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/dist/lib-esm/breadcrumb/breadcrumb.js +13 -3
- package/dist/lib-esm/breadcrumb/breadcrumb.module.js +1 -1
- package/dist/lib-esm/breadcrumb/ellipsis-truncation-view.js +2 -1
- package/dist/lib-esm/breadcrumb/folder-tree-truncation-view.js +2 -1
- package/dist/lib-esm/breadcrumb/mobile-view.js +2 -1
- package/dist/lib-esm/breadcrumb/utils.d.ts +6 -2
- package/dist/lib-esm/breadcrumb/utils.js +84 -2
- package/dist/lib-esm/combobox/combobox.figma.d.ts +1 -0
- package/dist/lib-esm/index.css +9 -9
- package/package.json +3 -3
|
@@ -9,7 +9,7 @@ import { FolderTreeTruncationView } from './folder-tree-truncation-view.js';
|
|
|
9
9
|
import { FullView } from './full-view.js';
|
|
10
10
|
import { MobileView } from './mobile-view.js';
|
|
11
11
|
import { useFolderTreeTruncation } from './useFolderTreeTruncation.js';
|
|
12
|
-
import { getSeparatorSize } from './utils.js';
|
|
12
|
+
import { getSeparatorSize, getContainerHeight, getRootIconSize } from './utils.js';
|
|
13
13
|
import styles from './breadcrumb.module.js';
|
|
14
14
|
|
|
15
15
|
const ELLIPSIS_TRUNCATION_THRESHOLD = 7;
|
|
@@ -36,6 +36,9 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
36
36
|
isTruncationRequired,
|
|
37
37
|
visibleCrumbCount
|
|
38
38
|
} = useFolderTreeTruncation(breadcrumbListRef, crumbs, isMobile);
|
|
39
|
+
const hasTruncation = isMobile || truncationMethod === 'ellipsis' && crumbs.length > ELLIPSIS_TRUNCATION_THRESHOLD || truncationMethod === 'folder-tree' && isTruncationRequired;
|
|
40
|
+
const rootIconSize = getRootIconSize(size, hasTruncation);
|
|
41
|
+
const containerHeight = getContainerHeight(size, hasTruncation);
|
|
39
42
|
if (!crumbs || crumbs.length === 0) {
|
|
40
43
|
return null;
|
|
41
44
|
}
|
|
@@ -81,6 +84,9 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
81
84
|
ref: forwardedRef,
|
|
82
85
|
"aria-label": breadcrumbAriaLabel,
|
|
83
86
|
className: styles.container,
|
|
87
|
+
style: {
|
|
88
|
+
height: containerHeight
|
|
89
|
+
},
|
|
84
90
|
...rest,
|
|
85
91
|
children: jsxs("ol", {
|
|
86
92
|
ref: breadcrumbListRef,
|
|
@@ -88,9 +94,13 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
88
94
|
children: [!isMobile && rootIconVariant && jsxs("li", {
|
|
89
95
|
className: styles.pageLink,
|
|
90
96
|
children: [rootIconVariant === 'home' ? jsx(Home, {
|
|
91
|
-
"aria-label": rootIconAriaLabel
|
|
97
|
+
"aria-label": rootIconAriaLabel,
|
|
98
|
+
height: rootIconSize,
|
|
99
|
+
width: rootIconSize
|
|
92
100
|
}) : jsx(FolderTree, {
|
|
93
|
-
"aria-label": rootIconAriaLabel
|
|
101
|
+
"aria-label": rootIconAriaLabel,
|
|
102
|
+
height: rootIconSize,
|
|
103
|
+
width: rootIconSize
|
|
94
104
|
}), jsx(PointerRight, {
|
|
95
105
|
height: getSeparatorSize(size),
|
|
96
106
|
role: "presentation",
|
|
@@ -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--30dee","breadcrumb":"bp_breadcrumb_module_breadcrumb--30dee","pageLink":"bp_breadcrumb_module_pageLink--30dee","linkWithHover":"bp_breadcrumb_module_linkWithHover--30dee","dropdownContent":"bp_breadcrumb_module_dropdownContent--30dee"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -3,6 +3,7 @@ import { Ellipsis } from '@box/blueprint-web-assets/icons/Medium';
|
|
|
3
3
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
4
4
|
import { BreadcrumbDropdown } from './breadcrumb-dropdown.js';
|
|
5
5
|
import { PageLink } from './page-link.js';
|
|
6
|
+
import { getIconButtonSize } from './utils.js';
|
|
6
7
|
|
|
7
8
|
const EllipsisTruncationView = ({
|
|
8
9
|
crumbs,
|
|
@@ -25,7 +26,7 @@ const EllipsisTruncationView = ({
|
|
|
25
26
|
iconButton: jsx(IconButton, {
|
|
26
27
|
"aria-label": truncatedLinksIconAriaLabel,
|
|
27
28
|
icon: Ellipsis,
|
|
28
|
-
size:
|
|
29
|
+
size: getIconButtonSize(size)
|
|
29
30
|
}),
|
|
30
31
|
onPageLinkClick: onPageLinkClick,
|
|
31
32
|
size: size
|
|
@@ -3,6 +3,7 @@ import { FolderTree } from '@box/blueprint-web-assets/icons/Fill';
|
|
|
3
3
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
4
4
|
import { BreadcrumbDropdown } from './breadcrumb-dropdown.js';
|
|
5
5
|
import { PageLink } from './page-link.js';
|
|
6
|
+
import { getIconButtonSize } from './utils.js';
|
|
6
7
|
|
|
7
8
|
const FolderTreeTruncationView = ({
|
|
8
9
|
crumbs,
|
|
@@ -22,7 +23,7 @@ const FolderTreeTruncationView = ({
|
|
|
22
23
|
iconButton: jsx(IconButton, {
|
|
23
24
|
"aria-label": truncatedLinksIconAriaLabel,
|
|
24
25
|
icon: FolderTree,
|
|
25
|
-
size:
|
|
26
|
+
size: getIconButtonSize(size)
|
|
26
27
|
}),
|
|
27
28
|
listRef: iconButtonRef,
|
|
28
29
|
onPageLinkClick: onPageLinkClick,
|
|
@@ -3,6 +3,7 @@ import { FolderTree } from '@box/blueprint-web-assets/icons/Fill';
|
|
|
3
3
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
4
4
|
import { BreadcrumbDropdown } from './breadcrumb-dropdown.js';
|
|
5
5
|
import { PageLink } from './page-link.js';
|
|
6
|
+
import { getIconButtonSize } from './utils.js';
|
|
6
7
|
|
|
7
8
|
const MobileView = ({
|
|
8
9
|
crumbs,
|
|
@@ -19,7 +20,7 @@ const MobileView = ({
|
|
|
19
20
|
iconButton: jsx(IconButton, {
|
|
20
21
|
"aria-label": truncatedLinksIconAriaLabel,
|
|
21
22
|
icon: FolderTree,
|
|
22
|
-
size:
|
|
23
|
+
size: getIconButtonSize(size)
|
|
23
24
|
}),
|
|
24
25
|
onPageLinkClick: onPageLinkClick,
|
|
25
26
|
size: size
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type BreadcrumbProps } from './types';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import { type TypographyVariant } from '../text/types';
|
|
3
|
+
export declare const getTextVariantFromSize: (size: BreadcrumbProps["size"]) => TypographyVariant;
|
|
4
|
+
export declare const getBoldTextVariantFromSize: (size: BreadcrumbProps["size"]) => TypographyVariant;
|
|
4
5
|
export declare const getSeparatorSize: (size: BreadcrumbProps["size"]) => string;
|
|
6
|
+
export declare const getRootIconSize: (size: BreadcrumbProps["size"], hasTruncation?: boolean) => string;
|
|
7
|
+
export declare const getContainerHeight: (size: BreadcrumbProps["size"], hasTruncation?: boolean) => string;
|
|
8
|
+
export declare const getIconButtonSize: (size: BreadcrumbProps["size"]) => "x-small" | "small" | "large";
|
|
@@ -1,34 +1,116 @@
|
|
|
1
|
-
import { bpSize030, bpSize020 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
1
|
+
import { bpSize030, bpSize040, bpSize020, bpSize060, bpSize080, bpSize050 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
2
2
|
|
|
3
3
|
const getTextVariantFromSize = size => {
|
|
4
4
|
switch (size) {
|
|
5
|
+
case 'xsmall':
|
|
6
|
+
return 'caption';
|
|
5
7
|
case 'small':
|
|
6
8
|
return 'bodyDefault';
|
|
7
9
|
case 'medium':
|
|
8
10
|
return 'bodyLarge';
|
|
11
|
+
case 'large':
|
|
12
|
+
return 'titleXLarge';
|
|
9
13
|
default:
|
|
10
14
|
return 'bodyLarge';
|
|
11
15
|
}
|
|
12
16
|
};
|
|
13
17
|
const getBoldTextVariantFromSize = size => {
|
|
14
18
|
switch (size) {
|
|
19
|
+
case 'xsmall':
|
|
20
|
+
return 'captionBold';
|
|
15
21
|
case 'small':
|
|
16
22
|
return 'bodyDefaultBold';
|
|
17
23
|
case 'medium':
|
|
18
24
|
return 'bodyLargeBold';
|
|
25
|
+
case 'large':
|
|
26
|
+
return 'titleXLarge';
|
|
19
27
|
default:
|
|
20
28
|
return 'bodyLargeBold';
|
|
21
29
|
}
|
|
22
30
|
};
|
|
23
31
|
const getSeparatorSize = size => {
|
|
24
32
|
switch (size) {
|
|
33
|
+
case 'xsmall':
|
|
34
|
+
return bpSize020;
|
|
25
35
|
case 'small':
|
|
26
36
|
return bpSize020;
|
|
27
37
|
case 'medium':
|
|
28
38
|
return bpSize030;
|
|
39
|
+
case 'large':
|
|
40
|
+
return bpSize040;
|
|
29
41
|
default:
|
|
30
42
|
return bpSize030;
|
|
31
43
|
}
|
|
32
44
|
};
|
|
45
|
+
const getRootIconSize = (size, hasTruncation = false) => {
|
|
46
|
+
if (hasTruncation) {
|
|
47
|
+
switch (size) {
|
|
48
|
+
case 'xsmall':
|
|
49
|
+
return bpSize060;
|
|
50
|
+
case 'small':
|
|
51
|
+
return bpSize060;
|
|
52
|
+
case 'medium':
|
|
53
|
+
return bpSize060;
|
|
54
|
+
case 'large':
|
|
55
|
+
return bpSize080;
|
|
56
|
+
default:
|
|
57
|
+
return bpSize060;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
switch (size) {
|
|
61
|
+
case 'xsmall':
|
|
62
|
+
return bpSize040;
|
|
63
|
+
case 'small':
|
|
64
|
+
return bpSize040;
|
|
65
|
+
case 'medium':
|
|
66
|
+
return bpSize050;
|
|
67
|
+
case 'large':
|
|
68
|
+
return bpSize060;
|
|
69
|
+
default:
|
|
70
|
+
return bpSize050;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const getContainerHeight = (size, hasTruncation = false) => {
|
|
74
|
+
if (hasTruncation) {
|
|
75
|
+
switch (size) {
|
|
76
|
+
case 'xsmall':
|
|
77
|
+
return bpSize060;
|
|
78
|
+
case 'small':
|
|
79
|
+
return bpSize060;
|
|
80
|
+
case 'medium':
|
|
81
|
+
return bpSize060;
|
|
82
|
+
case 'large':
|
|
83
|
+
return bpSize080;
|
|
84
|
+
default:
|
|
85
|
+
return bpSize060;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
switch (size) {
|
|
89
|
+
case 'xsmall':
|
|
90
|
+
return bpSize040;
|
|
91
|
+
case 'small':
|
|
92
|
+
return bpSize050;
|
|
93
|
+
case 'medium':
|
|
94
|
+
return bpSize060;
|
|
95
|
+
case 'large':
|
|
96
|
+
return bpSize080;
|
|
97
|
+
default:
|
|
98
|
+
return bpSize060;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const getIconButtonSize = size => {
|
|
102
|
+
switch (size) {
|
|
103
|
+
case 'xsmall':
|
|
104
|
+
return 'x-small';
|
|
105
|
+
case 'small':
|
|
106
|
+
return 'x-small';
|
|
107
|
+
case 'medium':
|
|
108
|
+
return 'x-small';
|
|
109
|
+
case 'large':
|
|
110
|
+
return 'small';
|
|
111
|
+
default:
|
|
112
|
+
return 'x-small';
|
|
113
|
+
}
|
|
114
|
+
};
|
|
33
115
|
|
|
34
|
-
export { getBoldTextVariantFromSize, getSeparatorSize, getTextVariantFromSize };
|
|
116
|
+
export { getBoldTextVariantFromSize, getContainerHeight, getIconButtonSize, getRootIconSize, getSeparatorSize, getTextVariantFromSize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/lib-esm/index.css
CHANGED
|
@@ -3072,11 +3072,10 @@
|
|
|
3072
3072
|
.bp_menu_item_sections_module_menuItemSideContent--dd1ef.bp_menu_item_sections_module_textOnLightSecondary--dd1ef{
|
|
3073
3073
|
color:var(--menu-item-text-color);
|
|
3074
3074
|
}
|
|
3075
|
-
.bp_breadcrumb_module_container--
|
|
3076
|
-
height:var(--bp-size-060);
|
|
3075
|
+
.bp_breadcrumb_module_container--30dee{
|
|
3077
3076
|
width:100%;
|
|
3078
3077
|
}
|
|
3079
|
-
.bp_breadcrumb_module_container--
|
|
3078
|
+
.bp_breadcrumb_module_container--30dee .bp_breadcrumb_module_breadcrumb--30dee{
|
|
3080
3079
|
align-items:center;
|
|
3081
3080
|
display:flex;
|
|
3082
3081
|
flex-wrap:nowrap;
|
|
@@ -3086,7 +3085,7 @@
|
|
|
3086
3085
|
margin:0;
|
|
3087
3086
|
padding:0;
|
|
3088
3087
|
}
|
|
3089
|
-
.bp_breadcrumb_module_container--
|
|
3088
|
+
.bp_breadcrumb_module_container--30dee .bp_breadcrumb_module_pageLink--30dee{
|
|
3090
3089
|
align-items:center;
|
|
3091
3090
|
display:flex;
|
|
3092
3091
|
flex-shrink:0;
|
|
@@ -3095,15 +3094,16 @@
|
|
|
3095
3094
|
overflow:hidden;
|
|
3096
3095
|
white-space:nowrap;
|
|
3097
3096
|
}
|
|
3098
|
-
.bp_breadcrumb_module_container--
|
|
3097
|
+
.bp_breadcrumb_module_container--30dee .bp_breadcrumb_module_pageLink--30dee:last-child{
|
|
3099
3098
|
flex-shrink:1;
|
|
3100
3099
|
}
|
|
3101
3100
|
|
|
3102
|
-
.bp_breadcrumb_module_linkWithHover--
|
|
3101
|
+
.bp_breadcrumb_module_linkWithHover--30dee{
|
|
3103
3102
|
cursor:pointer;
|
|
3103
|
+
display:inline-flex;
|
|
3104
3104
|
position:relative;
|
|
3105
3105
|
}
|
|
3106
|
-
.bp_breadcrumb_module_linkWithHover--
|
|
3106
|
+
.bp_breadcrumb_module_linkWithHover--30dee::after{
|
|
3107
3107
|
background-color:var(--bp-text-text-on-light-secondary);
|
|
3108
3108
|
bottom:0;
|
|
3109
3109
|
content:"";
|
|
@@ -3115,11 +3115,11 @@
|
|
|
3115
3115
|
transition:transform var(--animation-duration-2) var(--animation-easing-ease-base);
|
|
3116
3116
|
width:100%;
|
|
3117
3117
|
}
|
|
3118
|
-
.bp_breadcrumb_module_linkWithHover--
|
|
3118
|
+
.bp_breadcrumb_module_linkWithHover--30dee:hover::after{
|
|
3119
3119
|
transform:scaleX(1);
|
|
3120
3120
|
}
|
|
3121
3121
|
|
|
3122
|
-
.bp_breadcrumb_module_dropdownContent--
|
|
3122
|
+
.bp_breadcrumb_module_dropdownContent--30dee{
|
|
3123
3123
|
--blueprint-web-dropdown-menu-max-height:calc(var(--bp-size-300)*2);
|
|
3124
3124
|
}
|
|
3125
3125
|
.bp_link_module_link--27104{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ariakit/react": "0.4.21",
|
|
49
49
|
"@ariakit/react-core": "0.4.21",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.112.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.112.4",
|
|
51
51
|
"@internationalized/date": "^3.12.0",
|
|
52
52
|
"@radix-ui/react-accordion": "1.1.2",
|
|
53
53
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"type-fest": "^3.2.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@box/storybook-utils": "^0.17.
|
|
80
|
+
"@box/storybook-utils": "^0.17.31",
|
|
81
81
|
"@figma/code-connect": "1.3.12",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|