@coinbase/cds-mobile 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/InternalTooltip.d.ts.map +1 -1
- package/dts/overlays/tooltip/Tooltip.d.ts.map +1 -1
- package/dts/overlays/tooltip/TooltipProps.d.ts +5 -2
- package/dts/overlays/tooltip/TooltipProps.d.ts.map +1 -1
- package/esm/controls/Switch.js +8 -4
- package/esm/controls/__stories__/Switch.stories.js +35 -0
- package/esm/overlays/tooltip/InternalTooltip.js +24 -9
- package/esm/overlays/tooltip/Tooltip.js +46 -20
- package/esm/system/__stories__/componentConfigStickerSheet/StickerSheet.js +4 -0
- package/esm/system/__stories__/componentConfigStickerSheet/customComponentConfig.js +2 -0
- package/esm/system/__stories__/componentConfigStickerSheet/examples/Tooltip.js +20 -0
- 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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,oCAAoC;IACpC,MAAM,CAAC,EAAE;QACP,oDAAoD;QACpD,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5B;;;WAGG;QACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAChC,CAAC;CACH,CAAC;AA6HF,eAAO,MAAM,MAAM;IAhJjB;;;;;;;OAOG;eACQ,KAAK,CAAC,SAAS;IAC1B,oCAAoC;aAC3B;QACP,oDAAoD;QACpD,IAAI,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5B;;;WAGG;QACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAChC;8BA8HsC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalTooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/InternalTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAahE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"InternalTooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/InternalTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAahE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D,eAAO,MAAM,eAAe,kDAqG1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4E,MAAM,OAAO,CAAC;AACjG,OAAO,EAAE,KAAK,kBAAkB,EAA4C,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4E,MAAM,OAAO,CAAC;AACjG,OAAO,EAAE,KAAK,kBAAkB,EAA4C,MAAM,cAAc,CAAC;AAWjG,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGtE,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG;IAC5C;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,OAAO,qCAAiB,YAAY,6CAsM/C,CAAC"}
|
|
@@ -6,9 +6,11 @@ import type {
|
|
|
6
6
|
SharedAccessibilityProps,
|
|
7
7
|
SharedProps,
|
|
8
8
|
} from '@coinbase/cds-common/types';
|
|
9
|
+
import type { BoxBaseProps } from '../../layout/Box';
|
|
9
10
|
export type TooltipPlacement = Extract<BaseTooltipPlacement, 'bottom' | 'top'>;
|
|
10
11
|
export type TooltipBaseProps = SharedProps &
|
|
11
|
-
ElevationProps &
|
|
12
|
+
ElevationProps &
|
|
13
|
+
Omit<BoxBaseProps, 'children' | 'gap' | 'opacity' | 'pin'> & {
|
|
12
14
|
/** Position of tooltip in relation to the subject. */
|
|
13
15
|
placement?: TooltipPlacement;
|
|
14
16
|
children: React.ReactElement;
|
|
@@ -91,7 +93,8 @@ export type InternalTooltipProps = SharedAccessibilityProps &
|
|
|
91
93
|
| 'yShiftByStatusBarHeight'
|
|
92
94
|
| 'invertColorScheme'
|
|
93
95
|
| 'elevation'
|
|
94
|
-
> &
|
|
96
|
+
> &
|
|
97
|
+
Omit<BoxBaseProps, 'children' | 'gap' | 'opacity' | 'pin'> & {
|
|
95
98
|
subjectLayout: SubjectLayout | undefined;
|
|
96
99
|
opacity: Animated.Value;
|
|
97
100
|
animateIn: Animated.CompositeAnimation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipProps.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/TooltipProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,EAAE,QAAQ,GAAG,KAAK,CAAC,CAAC;AAE/E,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,cAAc,GAAG;
|
|
1
|
+
{"version":3,"file":"TooltipProps.d.ts","sourceRoot":"","sources":["../../../src/overlays/tooltip/TooltipProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,EAAE,QAAQ,GAAG,KAAK,CAAC,CAAC;AAE/E,MAAM,MAAM,gBAAgB,GAAG,WAAW,GACxC,cAAc,GACd,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG;IAC3D,sDAAsD;IACtD,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;IAC7B,gDAAgD;IAChD,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;;OAIG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC,KA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,CAAC;IACxB,SAAS,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IACvC,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC;IAC3B,qBAAqB,CAAC,EAAE,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC3D,kBAAkB,CAAC,EAAE,SAAS,CAAC,oBAAoB,CAAC,CAAC;CACtD,CAAC;AAEJ,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;IACzC,aAAa,EAAE,eAAe,CAAC;CAChC,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAG,yBAAyB,CAAC,CAAC"}
|
package/esm/controls/Switch.js
CHANGED
|
@@ -31,6 +31,10 @@ const SwitchIcon = _ref => {
|
|
|
31
31
|
switchHeight,
|
|
32
32
|
switchThumbSize
|
|
33
33
|
} = theme.controlSize;
|
|
34
|
+
|
|
35
|
+
// Inset that keeps the thumb centered within the track regardless of the
|
|
36
|
+
// configured track/thumb sizes (built-in themes use a 1px inset).
|
|
37
|
+
const thumbInset = (switchHeight - switchThumbSize) / 2;
|
|
34
38
|
const trackStyle = useMemo(() => [{
|
|
35
39
|
width: switchWidth,
|
|
36
40
|
height: switchHeight
|
|
@@ -39,16 +43,16 @@ const SwitchIcon = _ref => {
|
|
|
39
43
|
width: switchThumbSize,
|
|
40
44
|
height: switchThumbSize,
|
|
41
45
|
position: 'absolute',
|
|
42
|
-
top:
|
|
43
|
-
left:
|
|
46
|
+
top: thumbInset - borderSize,
|
|
47
|
+
left: thumbInset - borderSize
|
|
44
48
|
}, {
|
|
45
49
|
transform: [{
|
|
46
50
|
translateX: animatedScaleValue.interpolate({
|
|
47
51
|
inputRange: [0.9, 1],
|
|
48
|
-
outputRange: [0, switchWidth - switchThumbSize - 2]
|
|
52
|
+
outputRange: [0, switchWidth - switchThumbSize - thumbInset * 2]
|
|
49
53
|
})
|
|
50
54
|
}]
|
|
51
|
-
}], [animatedScaleValue, borderSize, switchThumbSize, switchWidth]);
|
|
55
|
+
}], [animatedScaleValue, borderSize, thumbInset, switchThumbSize, switchWidth]);
|
|
52
56
|
return /*#__PURE__*/_jsx(Interactable, {
|
|
53
57
|
background: background,
|
|
54
58
|
borderColor: borderColor,
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1
2
|
import React, { useState } from 'react';
|
|
2
3
|
import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
3
4
|
import { VStack } from '../../layout';
|
|
5
|
+
import { ThemeProvider } from '../../system/ThemeProvider';
|
|
6
|
+
import { defaultTheme } from '../../themes/defaultTheme';
|
|
4
7
|
import { Switch } from '../Switch';
|
|
5
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
9
|
const SwitchScreen = () => {
|
|
7
10
|
const [isChecked, setIsChecked] = useState(false);
|
|
8
11
|
const [isChecked2, setIsChecked2] = useState(true);
|
|
9
12
|
const [isChecked3, setIsChecked3] = useState(false);
|
|
13
|
+
const [isChecked4, setIsChecked4] = useState(false);
|
|
10
14
|
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
11
15
|
children: [/*#__PURE__*/_jsx(Example, {
|
|
12
16
|
inline: true,
|
|
@@ -64,6 +68,37 @@ const SwitchScreen = () => {
|
|
|
64
68
|
})]
|
|
65
69
|
});
|
|
66
70
|
}
|
|
71
|
+
}), /*#__PURE__*/_jsx(Example, {
|
|
72
|
+
inline: true,
|
|
73
|
+
title: "Custom Theme",
|
|
74
|
+
children: () => {
|
|
75
|
+
const toggleChecked = () => setIsChecked4(prevChecked => !prevChecked);
|
|
76
|
+
const customTheme = _extends({}, defaultTheme, {
|
|
77
|
+
controlSize: _extends({}, defaultTheme.controlSize, {
|
|
78
|
+
switchHeight: 24,
|
|
79
|
+
switchThumbSize: 20,
|
|
80
|
+
switchWidth: 44
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
return /*#__PURE__*/_jsx(ThemeProvider, {
|
|
84
|
+
activeColorScheme: "light",
|
|
85
|
+
theme: customTheme,
|
|
86
|
+
children: /*#__PURE__*/_jsxs(VStack, {
|
|
87
|
+
gap: 2,
|
|
88
|
+
children: [/*#__PURE__*/_jsx(Switch, {
|
|
89
|
+
checked: isChecked4,
|
|
90
|
+
onChange: toggleChecked,
|
|
91
|
+
children: "Interactive"
|
|
92
|
+
}), /*#__PURE__*/_jsx(Switch, {
|
|
93
|
+
checked: false,
|
|
94
|
+
children: "Off"
|
|
95
|
+
}), /*#__PURE__*/_jsx(Switch, {
|
|
96
|
+
checked: true,
|
|
97
|
+
children: "On"
|
|
98
|
+
})]
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
67
102
|
}), /*#__PURE__*/_jsx(Example, {
|
|
68
103
|
inline: true,
|
|
69
104
|
title: "Elevation",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["subjectLayout", "content", "placement", "opacity", "animateIn", "translateY", "gap", "yShiftByStatusBarHeight", "testID", "onAccessibilityEscape", "onAccessibilityTap", "elevation"];
|
|
1
|
+
const _excluded = ["subjectLayout", "content", "placement", "opacity", "animateIn", "translateY", "gap", "yShiftByStatusBarHeight", "testID", "onAccessibilityEscape", "onAccessibilityTap", "elevation", "background", "borderRadius", "maxWidth", "paddingX", "paddingY", "color", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
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; }
|
|
4
4
|
import React, { memo, useEffect, useMemo, useRef } from 'react';
|
|
@@ -23,7 +23,18 @@ export const InternalTooltip = /*#__PURE__*/memo(function InternalTooltip(_ref)
|
|
|
23
23
|
testID,
|
|
24
24
|
onAccessibilityEscape,
|
|
25
25
|
onAccessibilityTap,
|
|
26
|
-
elevation
|
|
26
|
+
elevation,
|
|
27
|
+
background = 'bg',
|
|
28
|
+
borderRadius = 200,
|
|
29
|
+
maxWidth = tooltipMaxWidth,
|
|
30
|
+
paddingX = tooltipPaddingX,
|
|
31
|
+
paddingY = tooltipPaddingY,
|
|
32
|
+
color = 'fg',
|
|
33
|
+
font = 'label2',
|
|
34
|
+
fontFamily,
|
|
35
|
+
fontSize,
|
|
36
|
+
fontWeight,
|
|
37
|
+
lineHeight
|
|
27
38
|
} = _ref,
|
|
28
39
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
40
|
const theme = useTheme();
|
|
@@ -61,13 +72,13 @@ export const InternalTooltip = /*#__PURE__*/memo(function InternalTooltip(_ref)
|
|
|
61
72
|
style: outerTooltipStyles,
|
|
62
73
|
children: /*#__PURE__*/_jsx(Box, _extends({
|
|
63
74
|
animated: true,
|
|
64
|
-
background:
|
|
65
|
-
borderRadius:
|
|
75
|
+
background: background,
|
|
76
|
+
borderRadius: borderRadius,
|
|
66
77
|
elevation: elevation,
|
|
67
|
-
maxWidth:
|
|
78
|
+
maxWidth: maxWidth,
|
|
68
79
|
opacity: opacity,
|
|
69
|
-
paddingX:
|
|
70
|
-
paddingY:
|
|
80
|
+
paddingX: paddingX,
|
|
81
|
+
paddingY: paddingY,
|
|
71
82
|
style: {
|
|
72
83
|
transform: [{
|
|
73
84
|
translateY
|
|
@@ -76,8 +87,12 @@ export const InternalTooltip = /*#__PURE__*/memo(function InternalTooltip(_ref)
|
|
|
76
87
|
testID: testID
|
|
77
88
|
}, props, {
|
|
78
89
|
children: typeof content === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
79
|
-
color:
|
|
80
|
-
font:
|
|
90
|
+
color: color,
|
|
91
|
+
font: font,
|
|
92
|
+
fontFamily: fontFamily,
|
|
93
|
+
fontSize: fontSize,
|
|
94
|
+
fontWeight: fontWeight,
|
|
95
|
+
lineHeight: lineHeight,
|
|
81
96
|
children: content
|
|
82
97
|
}) : content
|
|
83
98
|
}))
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
const _excluded = ["children", "content", "placement", "onCloseTooltip", "onOpenTooltip", "gap", "yShiftByStatusBarHeight", "testID", "accessibilityLabel", "accessibilityHint", "accessibilityLabelForContent", "accessibilityHintForContent", "accessibilityState", "visible", "invertColorScheme", "elevation", "openDelay", "closeDelay", "background", "borderRadius", "maxWidth", "paddingX", "paddingY", "color", "font", "fontFamily", "fontSize", "fontWeight", "lineHeight"];
|
|
1
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
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; }
|
|
2
4
|
import React, { Fragment, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
5
|
import { Modal as RNModal, TouchableOpacity, View } from 'react-native';
|
|
6
|
+
import { tooltipMaxWidth, tooltipPaddingX, tooltipPaddingY } from '@coinbase/cds-common/tokens/tooltip';
|
|
4
7
|
import { useComponentConfig } from '../../hooks/useComponentConfig';
|
|
5
8
|
import { InvertedThemeProvider } from '../../system/ThemeProvider';
|
|
6
9
|
import { InternalTooltip } from './InternalTooltip';
|
|
@@ -9,25 +12,37 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
9
12
|
export const Tooltip = /*#__PURE__*/memo(_props => {
|
|
10
13
|
const mergedProps = useComponentConfig('Tooltip', _props);
|
|
11
14
|
const {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
children,
|
|
16
|
+
content,
|
|
17
|
+
placement = 'top',
|
|
18
|
+
onCloseTooltip,
|
|
19
|
+
onOpenTooltip,
|
|
20
|
+
gap = 1,
|
|
21
|
+
yShiftByStatusBarHeight,
|
|
22
|
+
testID,
|
|
23
|
+
accessibilityLabel,
|
|
24
|
+
accessibilityHint,
|
|
25
|
+
accessibilityLabelForContent,
|
|
26
|
+
accessibilityHintForContent,
|
|
27
|
+
accessibilityState,
|
|
28
|
+
visible,
|
|
29
|
+
invertColorScheme = true,
|
|
30
|
+
elevation,
|
|
31
|
+
openDelay,
|
|
32
|
+
closeDelay,
|
|
33
|
+
background = 'bg',
|
|
34
|
+
borderRadius = 200,
|
|
35
|
+
maxWidth = tooltipMaxWidth,
|
|
36
|
+
paddingX = tooltipPaddingX,
|
|
37
|
+
paddingY = tooltipPaddingY,
|
|
38
|
+
color = 'fg',
|
|
39
|
+
font = 'label2',
|
|
40
|
+
fontFamily,
|
|
41
|
+
fontSize,
|
|
42
|
+
fontWeight,
|
|
43
|
+
lineHeight
|
|
44
|
+
} = mergedProps,
|
|
45
|
+
props = _objectWithoutPropertiesLoose(mergedProps, _excluded);
|
|
31
46
|
const subjectRef = useRef(null);
|
|
32
47
|
const [isOpen, setIsOpen] = useState(false);
|
|
33
48
|
const isVisible = visible !== false && isOpen;
|
|
@@ -138,16 +153,27 @@ export const Tooltip = /*#__PURE__*/memo(_props => {
|
|
|
138
153
|
}), /*#__PURE__*/_jsx(WrapperComponent, {
|
|
139
154
|
children: /*#__PURE__*/_jsx(InternalTooltip, _extends({
|
|
140
155
|
animateIn: animateIn,
|
|
156
|
+
background: background,
|
|
157
|
+
borderRadius: borderRadius,
|
|
158
|
+
color: color,
|
|
141
159
|
content: content,
|
|
142
160
|
elevation: elevation,
|
|
161
|
+
font: font,
|
|
162
|
+
fontFamily: fontFamily,
|
|
163
|
+
fontSize: fontSize,
|
|
164
|
+
fontWeight: fontWeight,
|
|
143
165
|
gap: gap,
|
|
166
|
+
lineHeight: lineHeight,
|
|
167
|
+
maxWidth: maxWidth,
|
|
144
168
|
opacity: opacity,
|
|
169
|
+
paddingX: paddingX,
|
|
170
|
+
paddingY: paddingY,
|
|
145
171
|
placement: placement,
|
|
146
172
|
subjectLayout: subjectLayout,
|
|
147
173
|
testID: testID,
|
|
148
174
|
translateY: translateY,
|
|
149
175
|
yShiftByStatusBarHeight: yShiftByStatusBarHeight
|
|
150
|
-
}, accessibilityPropsForContent))
|
|
176
|
+
}, props, accessibilityPropsForContent))
|
|
151
177
|
})]
|
|
152
178
|
})]
|
|
153
179
|
});
|
|
@@ -19,6 +19,7 @@ import { SelectChipExample } from './examples/SelectChip';
|
|
|
19
19
|
import { TabsExample } from './examples/Tabs';
|
|
20
20
|
import { TagExample } from './examples/Tag';
|
|
21
21
|
import { TextInputExample } from './examples/TextInput';
|
|
22
|
+
import { TooltipExample } from './examples/Tooltip';
|
|
22
23
|
import { Container } from './Container';
|
|
23
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
export const StickerSheet = /*#__PURE__*/memo(() => {
|
|
@@ -91,6 +92,9 @@ export const StickerSheet = /*#__PURE__*/memo(() => {
|
|
|
91
92
|
}), /*#__PURE__*/_jsx(Container, {
|
|
92
93
|
title: "Coachmark",
|
|
93
94
|
children: /*#__PURE__*/_jsx(CoachmarkExample, {})
|
|
95
|
+
}), /*#__PURE__*/_jsx(Container, {
|
|
96
|
+
title: "Tooltip",
|
|
97
|
+
children: /*#__PURE__*/_jsx(TooltipExample, {})
|
|
94
98
|
})]
|
|
95
99
|
})]
|
|
96
100
|
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Button } from '../../../../buttons/Button';
|
|
4
|
+
import { Tooltip } from '../../../../overlays/tooltip/Tooltip';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export const TooltipExample = /*#__PURE__*/memo(() => {
|
|
7
|
+
return /*#__PURE__*/_jsx(Tooltip, {
|
|
8
|
+
accessibilityHint: "Additional information about this action",
|
|
9
|
+
accessibilityLabel: "Show tooltip",
|
|
10
|
+
content: "Additional information about this action",
|
|
11
|
+
children: /*#__PURE__*/_jsx(View, {
|
|
12
|
+
accessibilityElementsHidden: true,
|
|
13
|
+
pointerEvents: "none",
|
|
14
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
15
|
+
variant: "secondary",
|
|
16
|
+
children: "Show Tooltip"
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
});
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -206,9 +206,9 @@
|
|
|
206
206
|
"react-native-worklets": "0.5.2"
|
|
207
207
|
},
|
|
208
208
|
"dependencies": {
|
|
209
|
-
"@coinbase/cds-common": "^9.
|
|
210
|
-
"@coinbase/cds-icons": "^5.
|
|
211
|
-
"@coinbase/cds-illustrations": "^4.
|
|
209
|
+
"@coinbase/cds-common": "^9.3.0",
|
|
210
|
+
"@coinbase/cds-icons": "^5.19.0",
|
|
211
|
+
"@coinbase/cds-illustrations": "^4.41.0",
|
|
212
212
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
213
213
|
"@coinbase/cds-utils": "^2.3.5",
|
|
214
214
|
"@floating-ui/react-native": "^0.10.5",
|