@coinbase/cds-web 8.49.2 → 8.51.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/CHANGELOG.md CHANGED
@@ -8,6 +8,22 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  <!-- template-start -->
10
10
 
11
+ ## 8.51.0 (3/9/2026 PST)
12
+
13
+ #### 🚀 Updates
14
+
15
+ - Added hasInteractiveContent prop to Tooltip to correctly handle keyboard navigation when content includes interactive elements. [[#469](https://github.com/coinbase/cds/pull/469)] [DX-5097]
16
+
17
+ #### 🐞 Fixes
18
+
19
+ - Fixed issue when tooltip does not announce its content when content is a React Node instead of a string. [[#469](https://github.com/coinbase/cds/pull/469)]
20
+
21
+ ## 8.50.0 (3/6/2026 PST)
22
+
23
+ #### 🚀 Updates
24
+
25
+ - Feat: iconSize customization for IconButton. [[#474](https://github.com/coinbase/cds/pull/474)]
26
+
11
27
  ## 8.49.2 (3/6/2026 PST)
12
28
 
13
29
  #### 🐞 Fixes
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { IconButtonVariant, IconName } from '@coinbase/cds-common/types';
2
+ import type { IconButtonVariant, IconName, IconSize } from '@coinbase/cds-common/types';
3
3
  import type { Polymorphic } from '../core/polymorphism';
4
4
  import { type PressableBaseProps } from '../system/Pressable';
5
5
  import { type ButtonBaseProps } from './Button';
@@ -10,6 +10,11 @@ export type IconButtonBaseProps = Polymorphic.ExtendableProps<
10
10
  Pick<ButtonBaseProps, 'disabled' | 'transparent' | 'compact' | 'flush'> & {
11
11
  /** Name of the icon, as defined in Figma. */
12
12
  name: IconName;
13
+ /**
14
+ * Size for the icon rendered inside the button.
15
+ * @default compact ? 's' : 'm'
16
+ */
17
+ iconSize?: IconSize;
13
18
  /** Whether the icon is active */
14
19
  active?: boolean;
15
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../src/buttons/IconButton.tsx"],"names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  visible,
12
+ hasInteractiveContent,
13
13
  invertColorScheme,
14
- disableFocusTrap,
15
14
  disableAutoFocus,
15
+ disableFocusTrap,
16
+ disablePortal,
16
17
  disableTypeFocus,
17
18
  focusTabIndexElements,
18
19
  respectNegativeTabIndex,
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,eAAO,MAAM,OAAO,GAAI,wRAoBrB,YAAY,4CAiEd,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,eAAO,MAAM,OAAO,GAAI,+SAqBrB,YAAY,4CAoFd,CAAC"}
@@ -58,6 +58,10 @@ export type TooltipBaseProps = SharedProps &
58
58
  * A unique ID used to ensure tooltips are accessible
59
59
  */
60
60
  tooltipId?: string;
61
+ /**
62
+ * Whether the tooltip has interactive elements inside the content.
63
+ */
64
+ hasInteractiveContent?: boolean;
61
65
  };
62
66
  export type TooltipProps = TooltipBaseProps;
63
67
  export type PopperTooltipProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"TooltipProps.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/TooltipProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,cAA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as", "variant", "transparent", "compact", "background", "color", "borderColor", "borderRadius", "borderWidth", "alignItems", "justifyContent", "height", "width", "className", "name", "active", "flush", "loading", "accessibilityLabel", "accessibilityHint"];
1
+ const _excluded = ["as", "variant", "transparent", "compact", "background", "color", "borderColor", "borderRadius", "borderWidth", "alignItems", "justifyContent", "height", "width", "className", "name", "iconSize", "active", "flush", "loading", "accessibilityLabel", "accessibilityHint"];
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -39,6 +39,7 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
39
39
  width = compact ? 40 : 56,
40
40
  className,
41
41
  name,
42
+ iconSize = compact ? 's' : 'm',
42
43
  active,
43
44
  flush,
44
45
  loading,
@@ -48,7 +49,6 @@ export const IconButton = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref)
48
49
  props = _objectWithoutProperties(_ref, _excluded);
49
50
  const Component = as !== null && as !== void 0 ? as : iconButtonDefaultElement;
50
51
  const theme = useTheme();
51
- const iconSize = compact ? 's' : 'm';
52
52
  const iconSizeValue = theme.iconSize[iconSize];
53
53
  const spinnerSizeStyles = useMemo(() => ({
54
54
  width: iconSizeValue,
@@ -101,7 +101,7 @@ export const Popover = /*#__PURE__*/memo(_ref => {
101
101
  children: content
102
102
  }))
103
103
  })
104
- })), [setPopper, popperStyles.popper, popperAttributes.popper, handleCaptureEvents, handleClose, testID, content, controlledElementAccessibilityProps, disableFocusTrap, disableAutoFocus, disableTypeFocus, focusTabIndexElements, respectNegativeTabIndex, autoFocusDelay, restoreFocusOnUnmount]);
104
+ })), [setPopper, popperStyles.popper, popperAttributes.popper, handleCaptureEvents, autoFocusDelay, disableAutoFocus, disableFocusTrap, disableTypeFocus, focusTabIndexElements, handleClose, respectNegativeTabIndex, restoreFocusOnUnmount, testID, controlledElementAccessibilityProps, content]);
105
105
  const renderContent = hasHoverInteractions ? memoizedContent : /*#__PURE__*/_jsx(Box, {
106
106
  "aria-label": accessibilityLabel,
107
107
  "aria-modal": "true",
@@ -115,12 +115,12 @@ export const Popover = /*#__PURE__*/memo(_ref => {
115
115
  const Wrapper = invertColorScheme ? InvertedThemeProvider : React.Fragment;
116
116
  return /*#__PURE__*/_jsxs("div", {
117
117
  className: block ? blockCss : undefined,
118
+ onBlur: onBlur,
118
119
  onMouseEnter: disabled ? undefined : onMouseEnter,
119
120
  onMouseLeave: disabled ? undefined : onMouseLeave,
120
121
  children: [/*#__PURE__*/_jsx("div", {
121
122
  ref: setSubject,
122
123
  className: cx(subjectCss, block && blockCss),
123
- onBlur: onBlur,
124
124
  onClick: disabled ? undefined : onPressSubject,
125
125
  onFocus: disabled ? undefined : onFocus,
126
126
  onMouseDown: disabled ? undefined : onMouseDown,
@@ -14,14 +14,15 @@ export const Tooltip = _ref => {
14
14
  elevation,
15
15
  placement = 'top',
16
16
  gap = 1,
17
- disablePortal,
18
17
  testID,
19
18
  zIndex,
20
19
  tooltipId: tooltipIdDefault,
21
20
  visible,
21
+ hasInteractiveContent,
22
22
  invertColorScheme = true,
23
- disableFocusTrap,
24
- disableAutoFocus,
23
+ disableAutoFocus = hasInteractiveContent,
24
+ disableFocusTrap = hasInteractiveContent,
25
+ disablePortal = hasInteractiveContent,
25
26
  disableTypeFocus,
26
27
  focusTabIndexElements,
27
28
  respectNegativeTabIndex,
@@ -50,14 +51,31 @@ export const Tooltip = _ref => {
50
51
  }
51
52
  }, [handleOnMouseEnter]);
52
53
  const clonedChild = useMemo(() => {
53
- return /*#__PURE__*/cloneElement(children, {
54
+ const isStringContent = typeof content === 'string';
55
+ return /*#__PURE__*/cloneElement(children,
56
+ // String content: Use only aria-label so the trigger is announced on focus without
57
+ // double announcement (aria-describedby would point to the same text when the tooltip is open).
58
+ // Non-string content: Use only aria-describedby to associate the visible tooltip (id=tooltipId).
59
+ // We cannot use aria-label here (it accepts only strings). May not announce on focus for
60
+ // non-button triggers due to timing (describedby target mounts when tooltip opens).
61
+ isStringContent ? {
62
+ 'aria-label': content
63
+ } : {
54
64
  'aria-describedby': tooltipId
55
65
  });
56
- }, [children, tooltipId]);
66
+ }, [children, content, tooltipId]);
57
67
  const contentPosition = useMemo(() => ({
58
68
  placement
59
69
  }), [placement]);
60
70
  const isVisible = useMemo(() => visible !== false && isOpen, [visible, isOpen]);
71
+ const handleBlur = useCallback(event => {
72
+ const relatedTarget = event === null || event === void 0 ? void 0 : event.relatedTarget;
73
+ const currentTarget = event === null || event === void 0 ? void 0 : event.currentTarget;
74
+ if (relatedTarget && currentTarget !== null && currentTarget !== void 0 && currentTarget.contains(relatedTarget)) {
75
+ return;
76
+ }
77
+ handleOnBlur();
78
+ }, [handleOnBlur]);
61
79
  return /*#__PURE__*/_jsx(Popover, {
62
80
  autoFocusDelay: autoFocusDelay,
63
81
  content: /*#__PURE__*/_jsx(TooltipContent, {
@@ -77,7 +95,7 @@ export const Tooltip = _ref => {
77
95
  disableTypeFocus: disableTypeFocus,
78
96
  focusTabIndexElements: focusTabIndexElements,
79
97
  invertColorScheme: invertColorScheme,
80
- onBlur: handleOnBlur,
98
+ onBlur: handleBlur,
81
99
  onFocus: handleOnFocus,
82
100
  onMouseDown: preventMouseDown,
83
101
  onMouseEnter: handleMouseEnter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "8.49.2",
3
+ "version": "8.51.0",
4
4
  "description": "Coinbase Design System - Web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -207,7 +207,7 @@
207
207
  "react-dom": "^18.3.1"
208
208
  },
209
209
  "dependencies": {
210
- "@coinbase/cds-common": "^8.49.2",
210
+ "@coinbase/cds-common": "^8.51.0",
211
211
  "@coinbase/cds-icons": "^5.12.0",
212
212
  "@coinbase/cds-illustrations": "^4.32.0",
213
213
  "@coinbase/cds-lottie-files": "^3.3.4",