@coinbase/cds-web 9.2.1 → 9.3.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 +12 -0
- package/dts/controls/Switch.d.ts.map +1 -1
- package/dts/overlays/tooltip/Tooltip.d.ts.map +1 -1
- package/dts/overlays/tooltip/TooltipContent.d.ts +2 -2
- package/dts/overlays/tooltip/TooltipContent.d.ts.map +1 -1
- package/dts/overlays/tooltip/TooltipProps.d.ts +2 -0
- package/dts/overlays/tooltip/TooltipProps.d.ts.map +1 -1
- package/esm/controls/Switch.css +1 -1
- package/esm/controls/Switch.js +3 -1
- package/esm/overlays/tooltip/Tooltip.js +55 -23
- package/esm/overlays/tooltip/TooltipContent.js +33 -18
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,18 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 9.3.0 (6/11/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Feat: support tooltip theming. [[#753](https://github.com/coinbase/cds/pull/753)]
|
|
16
|
+
|
|
17
|
+
## 9.2.2 (6/10/2026 PST)
|
|
18
|
+
|
|
19
|
+
#### 🐞 Fixes
|
|
20
|
+
|
|
21
|
+
- Fix: custom Switch sizes now center in the background track correctly. [[#750](https://github.com/coinbase/cds/pull/750)]
|
|
22
|
+
|
|
11
23
|
## 9.2.1 (6/9/2026 PST)
|
|
12
24
|
|
|
13
25
|
#### 🐞 Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/controls/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAUjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,oDAAoD;;IAEpD,4CAA4C;;IAE5C,6BAA6B;;IAE7B,6BAA6B;;CAErB,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/controls/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAUjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;IAC3B,oDAAoD;;IAEpD,4CAA4C;;IAE5C,6BAA6B;;IAE7B,6BAA6B;;CAErB,CAAC;AA6BX,MAAM,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC,GAAG;IACvD;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,eAAe,GACvC,mBAAmB,CAAC,OAAO,gBAAgB,CAAC,GAAG;IAC7C;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AA+FJ,eAAO,MAAM,MAAM;;;;;;;;;;;IAhHjB;;OAEG;mBACY,SAAS,CAAC,KAAK;;IAzC9B,oDAAoD;;IAEpD,4CAA4C;;IAE5C,6BAA6B;;IAE7B,6BAA6B;;;IAwC3B;;;;;;;OAOG;eACQ,KAAK,CAAC,SAAS;0CAgGW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAWhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQnD,eAAO,MAAM,OAAO,qCAAiB,YAAY,6CA+H/C,CAAC"}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { type BoxBaseProps } from '../../layout/Box';
|
|
3
3
|
import type { PopperTooltipProps } from './TooltipProps';
|
|
4
4
|
export type TooltipContentBaseProps = PopperTooltipProps &
|
|
5
|
-
|
|
5
|
+
Omit<BoxBaseProps, 'children' | 'gap' | 'pin'>;
|
|
6
6
|
export type TooltipContentProps = TooltipContentBaseProps;
|
|
7
7
|
export declare const TooltipContent: React.NamedExoticComponent<
|
|
8
8
|
{
|
|
@@ -12,7 +12,7 @@ export declare const TooltipContent: React.NamedExoticComponent<
|
|
|
12
12
|
import('./TooltipProps').TooltipBaseProps,
|
|
13
13
|
'zIndex' | 'elevation' | 'content' | 'testID' | 'placement'
|
|
14
14
|
> &
|
|
15
|
-
|
|
15
|
+
Omit<BoxBaseProps, 'gap' | 'pin' | 'children'> &
|
|
16
16
|
React.RefAttributes<HTMLDivElement>
|
|
17
17
|
>;
|
|
18
18
|
//# sourceMappingURL=TooltipContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/TooltipContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAezD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAgBzD,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GACtD,IAAI,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/TooltipContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAezD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAI1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAgBzD,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GACtD,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC;AAEjD,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,CAAC;AAE1D,eAAO,MAAM,cAAc;;;wMA+E1B,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ThemeVars } from '@coinbase/cds-common/core/theme';
|
|
2
2
|
import type { BaseTooltipPlacement, ElevationProps, SharedProps } from '@coinbase/cds-common/types';
|
|
3
|
+
import type { BoxBaseProps } from '../../layout/Box';
|
|
3
4
|
import type { PopoverProps } from '../popover/PopoverProps';
|
|
4
5
|
export type TooltipBaseProps = SharedProps &
|
|
5
6
|
ElevationProps &
|
|
7
|
+
Omit<BoxBaseProps, 'children' | 'gap' | 'pin'> &
|
|
6
8
|
Pick<
|
|
7
9
|
PopoverProps,
|
|
8
10
|
| 'disableFocusTrap'
|
|
@@ -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;AAEpG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA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K,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC,CAAC"}
|
package/esm/controls/Switch.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
@layer cds{.trackCss-t1fng8qd{width:var(--controlSize-switchWidth);height:var(--controlSize-switchHeight);-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;padding:1px;-webkit-transition: border-color, background-color 0.2s linear;transition: border-color, background-color 0.2s linear;}.trackCss-t1fng8qd[data-filled='true']{-webkit-box-pack:end;-webkit-justify-content:flex-end;-ms-flex-pack:end;justify-content:flex-end;}
|
|
2
|
-
.thumbCss-t1l9xlcf{width:var(--controlSize-switchThumbSize);height:var(--controlSize-switchThumbSize);border:0.5px solid var(--color-bgLine);position:absolute;top:
|
|
2
|
+
.thumbCss-t1l9xlcf{width:var(--controlSize-switchThumbSize);height:var(--controlSize-switchThumbSize);border:0.5px solid var(--color-bgLine);position:absolute;top:calc((var(--controlSize-switchHeight) - var(--controlSize-switchThumbSize)) / 2);left:calc((var(--controlSize-switchHeight) - var(--controlSize-switchThumbSize)) / 2);}}
|
package/esm/controls/Switch.js
CHANGED
|
@@ -36,7 +36,9 @@ const thumbCss = "thumbCss-t1l9xlcf";
|
|
|
36
36
|
const MotionBox = motion(Box);
|
|
37
37
|
const thumbMotionVariants = {
|
|
38
38
|
checked: {
|
|
39
|
-
|
|
39
|
+
// Travel = trackWidth - 2*inset - thumbSize, which simplifies to
|
|
40
|
+
// trackWidth - trackHeight when the thumb is centered with equal insets.
|
|
41
|
+
x: "calc(var(--controlSize-switchWidth) - var(--controlSize-switchHeight))"
|
|
40
42
|
},
|
|
41
43
|
unchecked: {
|
|
42
44
|
x: 0
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
const _excluded = ["children", "content", "elevation", "placement", "gap", "testID", "zIndex", "tooltipId", "visible", "hasInteractiveContent", "invertColorScheme", "disableAutoFocus", "disableFocusTrap", "disablePortal", "disableTypeFocus", "focusTabIndexElements", "respectNegativeTabIndex", "autoFocusDelay", "openDelay", "closeDelay", "background", "borderRadius", "maxWidth", "paddingX", "paddingY", "color", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight"];
|
|
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
|
+
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
|
+
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; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
1
9
|
import React, { cloneElement, memo, useCallback, useMemo, useRef } from 'react';
|
|
10
|
+
import { tooltipMaxWidth, tooltipPaddingX, tooltipPaddingY } from '@coinbase/cds-common/tokens/tooltip';
|
|
2
11
|
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
3
12
|
import { Popover } from '../popover/Popover';
|
|
4
13
|
import { TooltipContent } from './TooltipContent';
|
|
@@ -11,27 +20,39 @@ const preventMouseDown = event => {
|
|
|
11
20
|
export const Tooltip = /*#__PURE__*/memo(_props => {
|
|
12
21
|
const mergedProps = useComponentConfig('Tooltip', _props);
|
|
13
22
|
const {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
children,
|
|
24
|
+
content,
|
|
25
|
+
elevation,
|
|
26
|
+
placement = 'top',
|
|
27
|
+
gap = 1,
|
|
28
|
+
testID,
|
|
29
|
+
zIndex,
|
|
30
|
+
tooltipId: tooltipIdDefault,
|
|
31
|
+
visible,
|
|
32
|
+
hasInteractiveContent,
|
|
33
|
+
invertColorScheme = true,
|
|
34
|
+
disableAutoFocus = hasInteractiveContent,
|
|
35
|
+
disableFocusTrap = hasInteractiveContent,
|
|
36
|
+
disablePortal = hasInteractiveContent,
|
|
37
|
+
disableTypeFocus,
|
|
38
|
+
focusTabIndexElements,
|
|
39
|
+
respectNegativeTabIndex,
|
|
40
|
+
autoFocusDelay = 20,
|
|
41
|
+
openDelay,
|
|
42
|
+
closeDelay,
|
|
43
|
+
background = 'bg',
|
|
44
|
+
borderRadius = 200,
|
|
45
|
+
maxWidth = tooltipMaxWidth,
|
|
46
|
+
paddingX = tooltipPaddingX,
|
|
47
|
+
paddingY = tooltipPaddingY,
|
|
48
|
+
color = 'fg',
|
|
49
|
+
font = 'label2',
|
|
50
|
+
fontFamily,
|
|
51
|
+
fontSize,
|
|
52
|
+
fontWeight,
|
|
53
|
+
lineHeight
|
|
54
|
+
} = mergedProps,
|
|
55
|
+
props = _objectWithoutProperties(mergedProps, _excluded);
|
|
35
56
|
const {
|
|
36
57
|
isOpen,
|
|
37
58
|
handleOnMouseEnter,
|
|
@@ -74,16 +95,27 @@ export const Tooltip = /*#__PURE__*/memo(_props => {
|
|
|
74
95
|
}, [handleOnBlur]);
|
|
75
96
|
return /*#__PURE__*/_jsx(Popover, {
|
|
76
97
|
autoFocusDelay: autoFocusDelay,
|
|
77
|
-
content: /*#__PURE__*/_jsx(TooltipContent, {
|
|
98
|
+
content: /*#__PURE__*/_jsx(TooltipContent, _objectSpread({
|
|
78
99
|
ref: tooltipContentRef,
|
|
100
|
+
background: background,
|
|
101
|
+
borderRadius: borderRadius,
|
|
102
|
+
color: color,
|
|
79
103
|
content: content,
|
|
80
104
|
elevation: elevation,
|
|
105
|
+
font: font,
|
|
106
|
+
fontFamily: fontFamily,
|
|
107
|
+
fontSize: fontSize,
|
|
108
|
+
fontWeight: fontWeight,
|
|
81
109
|
gap: gap,
|
|
110
|
+
lineHeight: lineHeight,
|
|
111
|
+
maxWidth: maxWidth,
|
|
112
|
+
paddingX: paddingX,
|
|
113
|
+
paddingY: paddingY,
|
|
82
114
|
placement: placement,
|
|
83
115
|
testID: testID,
|
|
84
116
|
tooltipId: tooltipId,
|
|
85
117
|
zIndex: zIndex
|
|
86
|
-
}),
|
|
118
|
+
}, props)),
|
|
87
119
|
contentPosition: contentPosition,
|
|
88
120
|
disableAutoFocus: disableAutoFocus,
|
|
89
121
|
disableFocusTrap: disableFocusTrap,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
const _excluded = ["content", "elevation", "gap", "testID", "zIndex", "tooltipId", "placement", "background", "borderRadius", "maxWidth", "paddingX", "paddingY", "color", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight"];
|
|
1
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; }
|
|
2
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; }
|
|
3
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; }
|
|
4
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
6
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
6
9
|
import React, { forwardRef, memo, useMemo } from 'react';
|
|
7
10
|
import { animateInOpacityConfig, animateOutOpacityConfig, getTranslateConfigByPlacement } from '@coinbase/cds-common/animation/tooltip';
|
|
8
11
|
import { tooltipMaxWidth, tooltipPaddingX, tooltipPaddingY } from '@coinbase/cds-common/tokens/tooltip';
|
|
@@ -15,19 +18,26 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
18
|
const textCss = "textCss-t15dzixe";
|
|
16
19
|
export const TooltipContent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
17
20
|
let {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
content,
|
|
22
|
+
elevation,
|
|
23
|
+
gap,
|
|
24
|
+
testID,
|
|
25
|
+
zIndex,
|
|
26
|
+
tooltipId,
|
|
27
|
+
placement = 'top',
|
|
28
|
+
background = 'bg',
|
|
29
|
+
borderRadius = 200,
|
|
30
|
+
maxWidth = tooltipMaxWidth,
|
|
31
|
+
paddingX = tooltipPaddingX,
|
|
32
|
+
paddingY = tooltipPaddingY,
|
|
33
|
+
color = 'fg',
|
|
34
|
+
font = 'label2',
|
|
35
|
+
fontFamily,
|
|
36
|
+
fontSize,
|
|
37
|
+
fontWeight,
|
|
38
|
+
lineHeight
|
|
39
|
+
} = _ref,
|
|
40
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
41
|
const outerStyle = useMemo(() => ({
|
|
32
42
|
padding: "var(--space-".concat(gap, ")"),
|
|
33
43
|
zIndex: zIndex !== null && zIndex !== void 0 ? zIndex : zIndexTokens.tooltip
|
|
@@ -45,7 +55,7 @@ export const TooltipContent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, r
|
|
|
45
55
|
});
|
|
46
56
|
return /*#__PURE__*/_jsx(motion.div, _objectSpread(_objectSpread({}, motionProps), {}, {
|
|
47
57
|
"data-testid": "".concat(testID, "-motion"),
|
|
48
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
58
|
+
children: /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
|
|
49
59
|
ref: ref,
|
|
50
60
|
background: background,
|
|
51
61
|
borderRadius: borderRadius,
|
|
@@ -55,16 +65,21 @@ export const TooltipContent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, r
|
|
|
55
65
|
maxWidth: maxWidth,
|
|
56
66
|
paddingX: paddingX,
|
|
57
67
|
paddingY: paddingY,
|
|
58
|
-
role: "tooltip"
|
|
68
|
+
role: "tooltip"
|
|
69
|
+
}, props), {}, {
|
|
59
70
|
children: typeof content === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
60
71
|
className: textCss,
|
|
61
|
-
color:
|
|
62
|
-
font:
|
|
72
|
+
color: color,
|
|
73
|
+
font: font,
|
|
74
|
+
fontFamily: fontFamily,
|
|
75
|
+
fontSize: fontSize,
|
|
76
|
+
fontWeight: fontWeight,
|
|
77
|
+
lineHeight: lineHeight,
|
|
63
78
|
children: content
|
|
64
79
|
}) : /*#__PURE__*/_jsx("div", {
|
|
65
80
|
children: content
|
|
66
81
|
})
|
|
67
|
-
})
|
|
82
|
+
}))
|
|
68
83
|
}));
|
|
69
84
|
}));
|
|
70
85
|
import "./TooltipContent.css";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "Coinbase Design System - Web",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -219,9 +219,9 @@
|
|
|
219
219
|
"react-dom": "^18.0.0 || ~19.1.2"
|
|
220
220
|
},
|
|
221
221
|
"dependencies": {
|
|
222
|
-
"@coinbase/cds-common": "^9.
|
|
223
|
-
"@coinbase/cds-icons": "^5.
|
|
224
|
-
"@coinbase/cds-illustrations": "^4.
|
|
222
|
+
"@coinbase/cds-common": "^9.3.0",
|
|
223
|
+
"@coinbase/cds-icons": "^5.19.0",
|
|
224
|
+
"@coinbase/cds-illustrations": "^4.41.0",
|
|
225
225
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
226
226
|
"@coinbase/cds-utils": "^2.3.5",
|
|
227
227
|
"@floating-ui/react-dom": "^2.1.1",
|