@box/blueprint-web 13.1.1 → 13.1.2

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.
@@ -4,8 +4,9 @@ import { Checkmark } from '@box/blueprint-web-assets/icons/Medium';
4
4
  import { Size5, Size4, bpIconIconOnLight, Gray100 } from '@box/blueprint-web-assets/tokens/tokens';
5
5
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
6
6
  import clsx from 'clsx';
7
- import { forwardRef } from 'react';
7
+ import { forwardRef, useCallback } from 'react';
8
8
  import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
9
+ import { composeEventHandlers } from '../../utils/composeEventHandlers.js';
9
10
  import styles from './dropdown-menu.module.js';
10
11
  import { useMenuItemVariant } from './menu-item-variant-context.js';
11
12
 
@@ -25,6 +26,7 @@ const DropdownMenuCheckboxItem = /*#__PURE__*/forwardRef((props, forwardedRef) =
25
26
  const {
26
27
  enableModernizedComponents
27
28
  } = useBlueprintModernization();
29
+ const preventDefault = useCallback(event => event.preventDefault(), []);
28
30
  const isSizeSmall = internalSize === 'small';
29
31
  const checkmarkSize = enableModernizedComponents ? Size5 : Size4;
30
32
  const Checkmark$2 = enableModernizedComponents ? Checkmark : Checkmark$1;
@@ -33,6 +35,9 @@ const DropdownMenuCheckboxItem = /*#__PURE__*/forwardRef((props, forwardedRef) =
33
35
  ...rest,
34
36
  ref: forwardedRef,
35
37
  className: clsx(styles.item, styles.checkboxItem, className),
38
+ // If click starts at trigger button, and ends on the item, it should not trigger the item.
39
+ // Note: this also has a side effect of not allowing to start click and end on a different time.
40
+ onPointerUp: composeEventHandlers(props.onPointerUp, preventDefault),
36
41
  children: [jsx(DropdownMenuPrimitive.ItemIndicator, {
37
42
  className: clsx(styles.checkmark, {
38
43
  [styles.mediumSpacing]: !isSizeSmall
@@ -4,8 +4,9 @@ import { Checkmark } from '@box/blueprint-web-assets/icons/Medium';
4
4
  import { Size5, Size4, bpIconIconOnLight, Gray100 } from '@box/blueprint-web-assets/tokens/tokens';
5
5
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
6
6
  import clsx from 'clsx';
7
- import { forwardRef } from 'react';
7
+ import { forwardRef, useCallback } from 'react';
8
8
  import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
9
+ import { composeEventHandlers } from '../../utils/composeEventHandlers.js';
9
10
  import styles from './dropdown-menu.module.js';
10
11
  import { useMenuItemVariant } from './menu-item-variant-context.js';
11
12
 
@@ -25,6 +26,7 @@ const DropdownMenuRadioSelectItem = /*#__PURE__*/forwardRef((props, forwardedRef
25
26
  const {
26
27
  enableModernizedComponents
27
28
  } = useBlueprintModernization();
29
+ const preventDefault = useCallback(event => event.preventDefault(), []);
28
30
  const isSizeSmall = internalSize === 'small';
29
31
  const checkmarkSize = enableModernizedComponents ? Size5 : Size4;
30
32
  const Checkmark$2 = enableModernizedComponents ? Checkmark : Checkmark$1;
@@ -34,6 +36,9 @@ const DropdownMenuRadioSelectItem = /*#__PURE__*/forwardRef((props, forwardedRef
34
36
  ref: forwardedRef,
35
37
  className: clsx(styles.item, styles.radioItem),
36
38
  value: value,
39
+ // If click starts at trigger button, and ends on the item, it should not trigger the item.
40
+ // Note: this also has a side effect of not allowing to start click and end on a different time.
41
+ onPointerUp: composeEventHandlers(props.onPointerUp, preventDefault),
37
42
  children: [jsx(DropdownMenuPrimitive.ItemIndicator, {
38
43
  className: clsx(styles.checkmark, {
39
44
  [styles.mediumSpacing]: !isSizeSmall
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "13.1.1",
3
+ "version": "13.1.2",
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.15",
49
49
  "@ariakit/react-core": "0.4.15",
50
- "@box/blueprint-web-assets": "^4.101.11",
50
+ "@box/blueprint-web-assets": "^4.101.12",
51
51
  "@internationalized/date": "^3.7.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.16.48",
80
+ "@box/storybook-utils": "^0.16.49",
81
81
  "@figma/code-connect": "1.3.12",
82
82
  "@types/react": "^18.0.0",
83
83
  "@types/react-dom": "^18.0.0",