@box/blueprint-web 14.26.1 → 14.30.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 +28 -8
- package/dist/lib-esm/breadcrumb/folder-tree-truncation-view.d.ts +1 -1
- package/dist/lib-esm/breadcrumb/folder-tree-truncation-view.js +10 -1
- package/dist/lib-esm/breadcrumb/types.d.ts +2 -1
- package/dist/lib-esm/index.css +398 -182
- package/dist/lib-esm/inline-trigger-button/inline-trigger-button-types.d.ts +3 -10
- package/dist/lib-esm/inline-trigger-button/inline-trigger-button.d.ts +5 -3
- package/dist/lib-esm/inline-trigger-button/inline-trigger-button.js +28 -25
- package/dist/lib-esm/modal/modal-content.js +1 -0
- package/dist/lib-esm/modal/modal.module.js +1 -1
- package/dist/lib-esm/primitives/context-menu/context-menu-menu-content.js +13 -2
- package/dist/lib-esm/primitives/context-menu/context-menu-sub-menu-content.js +13 -2
- package/dist/lib-esm/primitives/context-menu/context-menu.module.js +1 -1
- package/dist/lib-esm/primitives/dropdown-menu/dropdown-menu.module.js +1 -1
- package/package.json +3 -3
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import noop from 'lodash/noop';
|
|
3
3
|
import { forwardRef, useRef } from 'react';
|
|
4
4
|
import { FolderTree } from '@box/blueprint-web-assets/icons/Fill';
|
|
5
|
+
import { Taxonomy } from '@box/blueprint-web-assets/icons/Medium';
|
|
5
6
|
import { Home } from '@box/blueprint-web-assets/icons/MediumFilled';
|
|
6
7
|
import { useBreakpoint, Breakpoint } from '../utils/useBreakpoint.js';
|
|
7
8
|
import { EllipsisTruncationView } from './ellipsis-truncation-view.js';
|
|
@@ -14,6 +15,26 @@ import { getContainerHeight, getRootIconSize } from './utils.js';
|
|
|
14
15
|
import styles from './breadcrumb.module.js';
|
|
15
16
|
|
|
16
17
|
const ELLIPSIS_TRUNCATION_THRESHOLD = 7;
|
|
18
|
+
const renderRootIcon = (variant, size) => {
|
|
19
|
+
switch (variant) {
|
|
20
|
+
case 'home':
|
|
21
|
+
return jsx(Home, {
|
|
22
|
+
height: size,
|
|
23
|
+
width: size
|
|
24
|
+
});
|
|
25
|
+
case 'taxonomy':
|
|
26
|
+
return jsx(Taxonomy, {
|
|
27
|
+
height: size,
|
|
28
|
+
width: size
|
|
29
|
+
});
|
|
30
|
+
case 'folder-tree':
|
|
31
|
+
default:
|
|
32
|
+
return jsx(FolderTree, {
|
|
33
|
+
height: size,
|
|
34
|
+
width: size
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
17
38
|
const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
18
39
|
const {
|
|
19
40
|
breadcrumbAriaLabel,
|
|
@@ -38,6 +59,10 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
38
59
|
visibleCrumbCount
|
|
39
60
|
} = useFolderTreeTruncation(breadcrumbListRef, crumbs, isMobile);
|
|
40
61
|
const hasTruncation = isMobile || truncationMethod === 'ellipsis' && crumbs.length > ELLIPSIS_TRUNCATION_THRESHOLD || truncationMethod === 'folder-tree' && isTruncationRequired;
|
|
62
|
+
// For the `taxonomy` variant the dropdown trigger IS the root icon, so suppress the
|
|
63
|
+
// decorative one to avoid two Taxonomy icons in a row. `home`/`folder-tree` keep both.
|
|
64
|
+
const isFolderTreeTruncationActive = !isMobile && truncationMethod === 'folder-tree' && isTruncationRequired;
|
|
65
|
+
const shouldHideRootIconForTaxonomyTrigger = rootIconVariant === 'taxonomy' && isFolderTreeTruncationActive;
|
|
41
66
|
const rootIconSize = getRootIconSize(size, hasTruncation);
|
|
42
67
|
const containerHeight = getContainerHeight(size, hasTruncation);
|
|
43
68
|
if (!crumbs || crumbs.length === 0) {
|
|
@@ -68,6 +93,7 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
68
93
|
iconButtonRef: iconButtonRef,
|
|
69
94
|
isInteractive: isInteractive,
|
|
70
95
|
onPageLinkClick: onPageLinkClick,
|
|
96
|
+
rootIconVariant: rootIconVariant,
|
|
71
97
|
size: size,
|
|
72
98
|
truncatedLinksIconAriaLabel: truncatedLinksIconAriaLabel,
|
|
73
99
|
visibleCrumbCount: visibleCrumbCount
|
|
@@ -92,16 +118,10 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
92
118
|
children: jsxs("ol", {
|
|
93
119
|
ref: breadcrumbListRef,
|
|
94
120
|
className: styles.breadcrumb,
|
|
95
|
-
children: [!isMobile && rootIconVariant && jsxs("li", {
|
|
121
|
+
children: [!isMobile && rootIconVariant && !shouldHideRootIconForTaxonomyTrigger && jsxs("li", {
|
|
96
122
|
"aria-hidden": "true",
|
|
97
123
|
className: styles.pageLink,
|
|
98
|
-
children: [rootIconVariant
|
|
99
|
-
height: rootIconSize,
|
|
100
|
-
width: rootIconSize
|
|
101
|
-
}) : jsx(FolderTree, {
|
|
102
|
-
height: rootIconSize,
|
|
103
|
-
width: rootIconSize
|
|
104
|
-
}), jsx(BreadcrumbItemSeparator, {
|
|
124
|
+
children: [renderRootIcon(rootIconVariant, rootIconSize), jsx(BreadcrumbItemSeparator, {
|
|
105
125
|
isInteractive: isInteractive,
|
|
106
126
|
size: size
|
|
107
127
|
})]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type FolderTreeTruncationViewProps } from './types';
|
|
2
|
-
export declare const FolderTreeTruncationView: ({ crumbs, ellipsizeLastCrumb, iconButtonRef, isInteractive, onPageLinkClick, size, truncatedLinksIconAriaLabel, visibleCrumbCount, }: FolderTreeTruncationViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const FolderTreeTruncationView: ({ crumbs, ellipsizeLastCrumb, iconButtonRef, isInteractive, onPageLinkClick, rootIconVariant, size, truncatedLinksIconAriaLabel, visibleCrumbCount, }: FolderTreeTruncationViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { FolderTree } from '@box/blueprint-web-assets/icons/Fill';
|
|
3
|
+
import { Taxonomy } from '@box/blueprint-web-assets/icons/Medium';
|
|
3
4
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
4
5
|
import { BreadcrumbDropdown } from './breadcrumb-dropdown.js';
|
|
5
6
|
import { PageLink } from './page-link.js';
|
|
6
7
|
import { getIconButtonSize } from './utils.js';
|
|
7
8
|
|
|
9
|
+
const getDropdownTriggerIcon = rootIconVariant => {
|
|
10
|
+
if (rootIconVariant === 'taxonomy') {
|
|
11
|
+
return Taxonomy;
|
|
12
|
+
}
|
|
13
|
+
return FolderTree;
|
|
14
|
+
};
|
|
8
15
|
const FolderTreeTruncationView = ({
|
|
9
16
|
crumbs,
|
|
10
17
|
ellipsizeLastCrumb,
|
|
11
18
|
iconButtonRef,
|
|
12
19
|
isInteractive,
|
|
13
20
|
onPageLinkClick,
|
|
21
|
+
rootIconVariant,
|
|
14
22
|
size,
|
|
15
23
|
truncatedLinksIconAriaLabel,
|
|
16
24
|
visibleCrumbCount
|
|
17
25
|
}) => {
|
|
18
26
|
const visibleCrumbs = crumbs.slice(-visibleCrumbCount);
|
|
19
27
|
const hiddenCrumbs = crumbs.slice(0, -visibleCrumbCount);
|
|
28
|
+
const TriggerIcon = getDropdownTriggerIcon(rootIconVariant);
|
|
20
29
|
return jsxs(Fragment, {
|
|
21
30
|
children: [jsx(BreadcrumbDropdown, {
|
|
22
31
|
crumbsToRender: hiddenCrumbs,
|
|
23
32
|
iconButton: jsx(IconButton, {
|
|
24
33
|
"aria-label": truncatedLinksIconAriaLabel,
|
|
25
|
-
icon:
|
|
34
|
+
icon: TriggerIcon,
|
|
26
35
|
size: getIconButtonSize(size)
|
|
27
36
|
}),
|
|
28
37
|
isInteractive: isInteractive,
|
|
@@ -44,7 +44,7 @@ type RootIconProps = {
|
|
|
44
44
|
*/
|
|
45
45
|
rootIconAriaLabel?: string;
|
|
46
46
|
/** Determines which icon is displayed at the root. */
|
|
47
|
-
rootIconVariant: 'home' | 'folder-tree';
|
|
47
|
+
rootIconVariant: 'home' | 'folder-tree' | 'taxonomy';
|
|
48
48
|
};
|
|
49
49
|
export interface BreadcrumbViewProps {
|
|
50
50
|
crumbs: Crumb[];
|
|
@@ -56,6 +56,7 @@ export interface BreadcrumbViewProps {
|
|
|
56
56
|
}
|
|
57
57
|
export interface FolderTreeTruncationViewProps extends BreadcrumbViewProps {
|
|
58
58
|
iconButtonRef: React.RefObject<HTMLLIElement>;
|
|
59
|
+
rootIconVariant?: BreadcrumbProps['rootIconVariant'];
|
|
59
60
|
visibleCrumbCount: number;
|
|
60
61
|
}
|
|
61
62
|
/**
|