@box/blueprint-web 14.24.2 → 14.25.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.
@@ -2,9 +2,10 @@ import { type Crumb } from './types';
2
2
  interface BreadcrumbDropdownProps {
3
3
  crumbsToRender: Crumb[];
4
4
  iconButton: React.ReactNode;
5
+ isInteractive: boolean;
5
6
  listRef?: React.RefObject<HTMLLIElement>;
6
7
  onPageLinkClick: (id: string) => void;
7
8
  size: 'xsmall' | 'small' | 'medium' | 'large';
8
9
  }
9
- export declare function BreadcrumbDropdown({ crumbsToRender, iconButton, listRef, onPageLinkClick, size, }: BreadcrumbDropdownProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function BreadcrumbDropdown({ crumbsToRender, iconButton, isInteractive, listRef, onPageLinkClick, size, }: BreadcrumbDropdownProps): import("react/jsx-runtime").JSX.Element;
10
11
  export {};
@@ -1,14 +1,14 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { useCallback } from 'react';
3
- import { PointerRight } from '@box/blueprint-web-assets/icons/Fill';
4
3
  import { EllipsizableText } from '../ellipsizable-text/ellipsizable-text.js';
5
4
  import { DropdownMenu } from '../primitives/dropdown-menu/index.js';
6
- import { getSeparatorSize } from './utils.js';
5
+ import { BreadcrumbItemSeparator } from './breadcrumb-item-separator.js';
7
6
  import styles from './breadcrumb.module.js';
8
7
 
9
8
  function BreadcrumbDropdown({
10
9
  crumbsToRender,
11
10
  iconButton,
11
+ isInteractive,
12
12
  listRef,
13
13
  onPageLinkClick,
14
14
  size
@@ -35,10 +35,9 @@ function BreadcrumbDropdown({
35
35
  })
36
36
  }, crumb.id))
37
37
  })]
38
- }), jsx(PointerRight, {
39
- height: getSeparatorSize(size),
40
- role: "presentation",
41
- width: getSeparatorSize(size)
38
+ }), jsx(BreadcrumbItemSeparator, {
39
+ isInteractive: isInteractive,
40
+ size: size
42
41
  })]
43
42
  });
44
43
  }
@@ -0,0 +1,7 @@
1
+ import { type BreadcrumbProps } from './types';
2
+ type BreadcrumbItemSeparatorProps = {
3
+ isInteractive: boolean;
4
+ size: NonNullable<BreadcrumbProps['size']>;
5
+ };
6
+ export declare function BreadcrumbItemSeparator({ isInteractive, size }: BreadcrumbItemSeparatorProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { PointerRight } from '@box/blueprint-web-assets/icons/Fill';
3
+ import { Text } from '../text/text.js';
4
+ import { getNonInteractiveSeparatorVariantFromSize, getSeparatorSize } from './utils.js';
5
+ import styles from './breadcrumb.module.js';
6
+
7
+ function BreadcrumbItemSeparator({
8
+ isInteractive,
9
+ size
10
+ }) {
11
+ if (isInteractive) {
12
+ const dimension = getSeparatorSize(size);
13
+ return jsx(PointerRight, {
14
+ height: dimension,
15
+ role: "presentation",
16
+ width: dimension
17
+ });
18
+ }
19
+ return jsx("span", {
20
+ "aria-hidden": "true",
21
+ className: styles.breadcrumbSlashSeparator,
22
+ children: jsx(Text, {
23
+ as: "span",
24
+ style: {
25
+ color: 'var(--bp-text-text-on-light-tertiary)'
26
+ },
27
+ variant: getNonInteractiveSeparatorVariantFromSize(size),
28
+ children: "/"
29
+ })
30
+ });
31
+ }
32
+
33
+ export { BreadcrumbItemSeparator };
@@ -1,15 +1,16 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import noop from 'lodash/noop';
3
3
  import { forwardRef, useRef } from 'react';
4
- import { FolderTree, PointerRight } from '@box/blueprint-web-assets/icons/Fill';
4
+ import { FolderTree } from '@box/blueprint-web-assets/icons/Fill';
5
5
  import { Home } from '@box/blueprint-web-assets/icons/MediumFilled';
6
6
  import { useBreakpoint, Breakpoint } from '../utils/useBreakpoint.js';
7
7
  import { EllipsisTruncationView } from './ellipsis-truncation-view.js';
8
8
  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
+ import { BreadcrumbItemSeparator } from './breadcrumb-item-separator.js';
11
12
  import { useFolderTreeTruncation } from './useFolderTreeTruncation.js';
12
- import { getSeparatorSize, getContainerHeight, getRootIconSize } from './utils.js';
13
+ import { getContainerHeight, getRootIconSize } from './utils.js';
13
14
  import styles from './breadcrumb.module.js';
14
15
 
15
16
  const ELLIPSIS_TRUNCATION_THRESHOLD = 7;
@@ -100,10 +101,9 @@ const Breadcrumb = /*#__PURE__*/forwardRef((props, forwardedRef) => {
100
101
  }) : jsx(FolderTree, {
101
102
  height: rootIconSize,
102
103
  width: rootIconSize
103
- }), jsx(PointerRight, {
104
- height: getSeparatorSize(size),
105
- role: "presentation",
106
- width: getSeparatorSize(size)
104
+ }), jsx(BreadcrumbItemSeparator, {
105
+ isInteractive: isInteractive,
106
+ size: size
107
107
  })]
108
108
  }), breadcrumbList]
109
109
  })
@@ -1,4 +1,4 @@
1
1
  import '../index.css';
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"};
2
+ var styles = {"container":"bp_breadcrumb_module_container--ef73b","breadcrumb":"bp_breadcrumb_module_breadcrumb--ef73b","pageLink":"bp_breadcrumb_module_pageLink--ef73b","breadcrumbSlashSeparator":"bp_breadcrumb_module_breadcrumbSlashSeparator--ef73b","linkWithHover":"bp_breadcrumb_module_linkWithHover--ef73b","dropdownContent":"bp_breadcrumb_module_dropdownContent--ef73b"};
3
3
 
4
4
  export { styles as default };
@@ -28,6 +28,7 @@ const EllipsisTruncationView = ({
28
28
  icon: Ellipsis,
29
29
  size: getIconButtonSize(size)
30
30
  }),
31
+ isInteractive: isInteractive,
31
32
  onPageLinkClick: onPageLinkClick,
32
33
  size: size
33
34
  }), lastTwoCrumbs.map((crumb, index) => jsx(PageLink, {
@@ -25,6 +25,7 @@ const FolderTreeTruncationView = ({
25
25
  icon: FolderTree,
26
26
  size: getIconButtonSize(size)
27
27
  }),
28
+ isInteractive: isInteractive,
28
29
  listRef: iconButtonRef,
29
30
  onPageLinkClick: onPageLinkClick,
30
31
  size: size
@@ -17,6 +17,7 @@ const MobileView = ({
17
17
  return jsxs(Fragment, {
18
18
  children: [hiddenCrumbs.length > 0 && jsx(BreadcrumbDropdown, {
19
19
  crumbsToRender: hiddenCrumbs,
20
+ isInteractive: isInteractive,
20
21
  iconButton: jsx(IconButton, {
21
22
  "aria-label": truncatedLinksIconAriaLabel,
22
23
  icon: FolderTree,
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useCallback } from 'react';
3
- import { PointerRight } from '@box/blueprint-web-assets/icons/Fill';
4
3
  import { EllipsizableText } from '../ellipsizable-text/ellipsizable-text.js';
5
4
  import { Link } from '../primitives/link/link.js';
6
5
  import { Text } from '../text/text.js';
7
- import { getBoldTextVariantFromSize, getTextVariantFromSize, getSeparatorSize } from './utils.js';
6
+ import { BreadcrumbItemSeparator } from './breadcrumb-item-separator.js';
7
+ import { getBoldTextVariantFromSize, getTextVariantFromSize } from './utils.js';
8
8
  import styles from './breadcrumb.module.js';
9
9
 
10
10
  const PageLink = ({
@@ -53,10 +53,9 @@ const PageLink = ({
53
53
  as: "span",
54
54
  variant: getTextVariantFromSize(size),
55
55
  children: crumb.name
56
- }), jsx(PointerRight, {
57
- height: getSeparatorSize(size),
58
- role: "presentation",
59
- width: getSeparatorSize(size)
56
+ }), jsx(BreadcrumbItemSeparator, {
57
+ isInteractive: isInteractive,
58
+ size: size
60
59
  })]
61
60
  }, crumb.id);
62
61
  };
@@ -1,7 +1,8 @@
1
- import { type BreadcrumbProps } from './types';
2
1
  import { type TypographyVariant } from '../text/types';
2
+ import { type BreadcrumbProps } from './types';
3
3
  export declare const getTextVariantFromSize: (size: BreadcrumbProps["size"]) => TypographyVariant;
4
4
  export declare const getBoldTextVariantFromSize: (size: BreadcrumbProps["size"]) => TypographyVariant;
5
+ export declare const getNonInteractiveSeparatorVariantFromSize: (size: BreadcrumbProps["size"]) => TypographyVariant;
5
6
  export declare const getSeparatorSize: (size: BreadcrumbProps["size"]) => string;
6
7
  export declare const getRootIconSize: (size: BreadcrumbProps["size"], hasTruncation?: boolean) => string;
7
8
  export declare const getContainerHeight: (size: BreadcrumbProps["size"], hasTruncation?: boolean) => string;
@@ -1,4 +1,4 @@
1
- import { bpSize030, bpSize040, bpSize020, bpSize060, bpSize080, bpSize050 } from '@box/blueprint-web-assets/tokens/tokens';
1
+ import { bpSize060, bpSize080, bpSize050, bpSize040, bpSize030, bpSize020 } from '@box/blueprint-web-assets/tokens/tokens';
2
2
 
3
3
  const getTextVariantFromSize = size => {
4
4
  switch (size) {
@@ -28,6 +28,19 @@ const getBoldTextVariantFromSize = size => {
28
28
  return 'bodyLargeBold';
29
29
  }
30
30
  };
31
+ const getNonInteractiveSeparatorVariantFromSize = size => {
32
+ switch (size) {
33
+ case 'xsmall':
34
+ case 'small':
35
+ return 'bodyDefault';
36
+ case 'medium':
37
+ return 'bodyLarge';
38
+ case 'large':
39
+ return 'titleXLarge';
40
+ default:
41
+ return 'bodyLarge';
42
+ }
43
+ };
31
44
  const getSeparatorSize = size => {
32
45
  switch (size) {
33
46
  case 'xsmall':
@@ -113,4 +126,4 @@ const getIconButtonSize = size => {
113
126
  }
114
127
  };
115
128
 
116
- export { getBoldTextVariantFromSize, getContainerHeight, getIconButtonSize, getRootIconSize, getSeparatorSize, getTextVariantFromSize };
129
+ export { getBoldTextVariantFromSize, getContainerHeight, getIconButtonSize, getNonInteractiveSeparatorVariantFromSize, getRootIconSize, getSeparatorSize, getTextVariantFromSize };
@@ -3300,10 +3300,10 @@
3300
3300
  .bp_menu_item_sections_module_menuItemSideContent--dd1ef.bp_menu_item_sections_module_textOnLightSecondary--dd1ef{
3301
3301
  color:var(--menu-item-text-color);
3302
3302
  }
3303
- .bp_breadcrumb_module_container--30dee{
3303
+ .bp_breadcrumb_module_container--ef73b{
3304
3304
  width:100%;
3305
3305
  }
3306
- .bp_breadcrumb_module_container--30dee .bp_breadcrumb_module_breadcrumb--30dee{
3306
+ .bp_breadcrumb_module_container--ef73b .bp_breadcrumb_module_breadcrumb--ef73b{
3307
3307
  align-items:center;
3308
3308
  display:flex;
3309
3309
  flex-wrap:nowrap;
@@ -3313,7 +3313,7 @@
3313
3313
  margin:0;
3314
3314
  padding:0;
3315
3315
  }
3316
- .bp_breadcrumb_module_container--30dee .bp_breadcrumb_module_pageLink--30dee{
3316
+ .bp_breadcrumb_module_container--ef73b .bp_breadcrumb_module_pageLink--ef73b{
3317
3317
  align-items:center;
3318
3318
  display:flex;
3319
3319
  flex-shrink:0;
@@ -3322,16 +3322,21 @@
3322
3322
  overflow:hidden;
3323
3323
  white-space:nowrap;
3324
3324
  }
3325
- .bp_breadcrumb_module_container--30dee .bp_breadcrumb_module_pageLink--30dee:last-child{
3325
+ .bp_breadcrumb_module_container--ef73b .bp_breadcrumb_module_pageLink--ef73b:last-child{
3326
3326
  flex-shrink:1;
3327
3327
  }
3328
+ .bp_breadcrumb_module_container--ef73b .bp_breadcrumb_module_breadcrumbSlashSeparator--ef73b{
3329
+ align-items:center;
3330
+ display:inline-flex;
3331
+ flex-shrink:0;
3332
+ }
3328
3333
 
3329
- .bp_breadcrumb_module_linkWithHover--30dee{
3334
+ .bp_breadcrumb_module_linkWithHover--ef73b{
3330
3335
  cursor:pointer;
3331
3336
  display:inline-flex;
3332
3337
  position:relative;
3333
3338
  }
3334
- .bp_breadcrumb_module_linkWithHover--30dee::after{
3339
+ .bp_breadcrumb_module_linkWithHover--ef73b::after{
3335
3340
  background-color:var(--bp-text-text-on-light-secondary);
3336
3341
  bottom:0;
3337
3342
  content:"";
@@ -3343,11 +3348,11 @@
3343
3348
  transition:transform var(--animation-duration-2) var(--animation-easing-ease-base);
3344
3349
  width:100%;
3345
3350
  }
3346
- .bp_breadcrumb_module_linkWithHover--30dee:hover::after{
3351
+ .bp_breadcrumb_module_linkWithHover--ef73b:hover::after{
3347
3352
  transform:scaleX(1);
3348
3353
  }
3349
3354
 
3350
- .bp_breadcrumb_module_dropdownContent--30dee{
3355
+ .bp_breadcrumb_module_dropdownContent--ef73b{
3351
3356
  --blueprint-web-dropdown-menu-max-height:calc(var(--bp-size-300)*2);
3352
3357
  }
3353
3358
  .bp_link_module_link--27104{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "14.24.2",
3
+ "version": "14.25.0",
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.115.13",
50
+ "@box/blueprint-web-assets": "^4.116.0",
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.18.13",
80
+ "@box/storybook-utils": "^0.18.14",
81
81
  "@figma/code-connect": "1.4.4",
82
82
  "@types/react": "^18.0.0",
83
83
  "@types/react-dom": "^18.0.0",