@box/blueprint-web 12.101.0 → 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
- // Add aria-label: breadcrumb https://jira.inside-box.net/browse/UXF-427
34
- jsx("nav", {
35
- ref: forwardedRef,
36
- className: styles.container,
37
- ...rest,
38
- children: jsxs("ol", {
39
- className: styles.breadcrumb,
40
- children: [rootIconVariant && jsxs("li", {
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: [rootIconVariant === 'home' ? jsx(Home, {
43
- "aria-label": rootIconAriaLabel
44
- }) : jsx(FolderTree, {
45
- "aria-label": rootIconAriaLabel
46
- }), rootIconVariant && jsx(PointerRight, {
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
- }), 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", {
59
- className: styles.pageLink,
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, {
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
 
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "12.101.0",
3
+ "version": "12.102.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {