@box/blueprint-web 12.96.0 → 12.98.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 +26 -6
- package/dist/lib-esm/index.css +579 -518
- package/dist/lib-esm/modal/constants.d.ts +1 -0
- package/dist/lib-esm/modal/constants.js +3 -0
- package/dist/lib-esm/modal/index.d.ts +1 -1
- package/dist/lib-esm/modal/modal-loading.d.ts +2 -0
- package/dist/lib-esm/modal/modal-loading.js +63 -0
- package/dist/lib-esm/modal/modal.d.ts +1 -0
- package/dist/lib-esm/modal/modal.js +2 -0
- package/dist/lib-esm/modal/modal.module.js +1 -1
- package/dist/lib-esm/modal/types.d.ts +8 -0
- package/dist/lib-esm/text/text.module.js +1 -1
- package/dist/lib-esm/text/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import { forwardRef, useCallback } from 'react';
|
|
3
3
|
import { FolderTree, PointerRight } from '@box/blueprint-web-assets/icons/Fill';
|
|
4
4
|
import { Ellipsis } from '@box/blueprint-web-assets/icons/Medium';
|
|
5
5
|
import { Home } from '@box/blueprint-web-assets/icons/MediumFilled';
|
|
6
6
|
import noop from 'lodash/noop';
|
|
7
|
+
import { DropdownMenu } from '../primitives/dropdown-menu/index.js';
|
|
7
8
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
9
|
+
import { Text } from '../text/text.js';
|
|
8
10
|
import { PageLink } from './page-link.js';
|
|
9
11
|
import styles from './breadcrumb.module.js';
|
|
10
12
|
|
|
@@ -20,6 +22,9 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
20
22
|
onPageLinkClick = noop,
|
|
21
23
|
...rest
|
|
22
24
|
} = props;
|
|
25
|
+
const handlePageLinkClick = useCallback(crumbId => () => {
|
|
26
|
+
onPageLinkClick(crumbId);
|
|
27
|
+
}, [onPageLinkClick]);
|
|
23
28
|
// If there are more than 7 crumbs, break up crumbs into first link, ellipsis icon button, and current page ancestor
|
|
24
29
|
const shouldTruncateCrumbs = crumbs?.length > 7;
|
|
25
30
|
const shouldUseEllipsisTruncation = truncationMethod === 'ellipsis' && shouldTruncateCrumbs && crumbs;
|
|
@@ -49,11 +54,26 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
49
54
|
onPageLinkClick: onPageLinkClick
|
|
50
55
|
}), jsxs("li", {
|
|
51
56
|
className: styles.pageLink,
|
|
52
|
-
children: [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
children: [jsxs(DropdownMenu.Root, {
|
|
58
|
+
children: [jsx(DropdownMenu.Trigger, {
|
|
59
|
+
children: jsx(IconButton, {
|
|
60
|
+
"aria-label": truncatedLinksIconAriaLabel,
|
|
61
|
+
className: styles.iconButtonInline,
|
|
62
|
+
icon: Ellipsis,
|
|
63
|
+
size: "small"
|
|
64
|
+
})
|
|
65
|
+
}), jsx(DropdownMenu.Content, {
|
|
66
|
+
align: "start",
|
|
67
|
+
children: crumbs.slice(1, crumbs.length - 2).map(crumb => {
|
|
68
|
+
return jsx(DropdownMenu.Item, {
|
|
69
|
+
onSelect: handlePageLinkClick(crumb.id),
|
|
70
|
+
children: jsx(Text, {
|
|
71
|
+
as: "span",
|
|
72
|
+
children: crumb.name
|
|
73
|
+
})
|
|
74
|
+
}, crumb.id);
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
57
77
|
}), jsx(PointerRight, {
|
|
58
78
|
className: styles.separator,
|
|
59
79
|
role: "presentation"
|