@coinbase/cds-mobile 8.47.3 → 8.48.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/tag/Tag.d.ts +25 -0
- package/dts/tag/Tag.d.ts.map +1 -1
- package/esm/controls/TextInput.js +1 -1
- package/esm/tag/Tag.js +28 -6
- package/esm/tag/__stories__/Tag.stories.js +61 -4
- package/package.json +2 -2
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
|
+
## 8.48.0 (2/24/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Add start/end icon/node support to Tag. [[#421](https://github.com/coinbase/cds/pull/421)]
|
|
16
|
+
|
|
17
|
+
## 8.47.4 (2/23/2026 PST)
|
|
18
|
+
|
|
19
|
+
#### 🐞 Fixes
|
|
20
|
+
|
|
21
|
+
- Fix: set paddingStart on Input for compact label. [[#423](https://github.com/coinbase/cds/pull/423)]
|
|
22
|
+
|
|
11
23
|
## 8.47.3 ((2/20/2026, 09:16 AM PST))
|
|
12
24
|
|
|
13
25
|
This is an artificial version bump with no new change.
|
package/dts/tag/Tag.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { View } from 'react-native';
|
|
3
3
|
import type { ThemeVars } from '@coinbase/cds-common/core/theme';
|
|
4
4
|
import type {
|
|
5
|
+
IconName,
|
|
5
6
|
SharedAccessibilityProps,
|
|
6
7
|
SharedProps,
|
|
7
8
|
TagColorScheme,
|
|
@@ -34,6 +35,18 @@ export type TagBaseProps = SharedProps &
|
|
|
34
35
|
color?: ThemeVars.SpectrumColor;
|
|
35
36
|
/** Setting a custom max width for this tag will enable text truncation */
|
|
36
37
|
maxWidth?: BoxProps['maxWidth'];
|
|
38
|
+
/** Set the start node */
|
|
39
|
+
start?: React.ReactNode;
|
|
40
|
+
/** Icon to render at the start of the tag. */
|
|
41
|
+
startIcon?: IconName;
|
|
42
|
+
/** Whether the start icon is active */
|
|
43
|
+
startIconActive?: boolean;
|
|
44
|
+
/** Set the end node */
|
|
45
|
+
end?: React.ReactNode;
|
|
46
|
+
/** Icon to render at the end of the tag. */
|
|
47
|
+
endIcon?: IconName;
|
|
48
|
+
/** Whether the end icon is active */
|
|
49
|
+
endIconActive?: boolean;
|
|
37
50
|
};
|
|
38
51
|
export type TagProps = TagBaseProps &
|
|
39
52
|
Omit<BoxProps, 'color' | 'background' | 'children' | 'maxWidth'>;
|
|
@@ -64,6 +77,18 @@ export declare const Tag: React.MemoExoticComponent<
|
|
|
64
77
|
color?: ThemeVars.SpectrumColor;
|
|
65
78
|
/** Setting a custom max width for this tag will enable text truncation */
|
|
66
79
|
maxWidth?: BoxProps['maxWidth'];
|
|
80
|
+
/** Set the start node */
|
|
81
|
+
start?: React.ReactNode;
|
|
82
|
+
/** Icon to render at the start of the tag. */
|
|
83
|
+
startIcon?: IconName;
|
|
84
|
+
/** Whether the start icon is active */
|
|
85
|
+
startIconActive?: boolean;
|
|
86
|
+
/** Set the end node */
|
|
87
|
+
end?: React.ReactNode;
|
|
88
|
+
/** Icon to render at the end of the tag. */
|
|
89
|
+
endIcon?: IconName;
|
|
90
|
+
/** Whether the end icon is active */
|
|
91
|
+
endIconActive?: boolean;
|
|
67
92
|
} & Omit<BoxProps, 'children' | 'color' | 'background' | 'maxWidth'> &
|
|
68
93
|
React.RefAttributes<View>
|
|
69
94
|
>
|
package/dts/tag/Tag.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../src/tag/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,O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AAC,SAAS,CAAC;IACtB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,qCAAqC;IACrC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEJ,MAAM,MAAM,QAAQ,GAAG,YAAY,GACjC,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;AAEnE,eAAO,MAAM,GAAG;IAxCZ,yCAAyC;cAC/B,KAAK,CAAC,SAAS;IACzB;;;OAGG;aACM,SAAS;IAClB;;;OAGG;eACQ,WAAW;IACtB;;;OAGG;kBACW,cAAc;IAC5B,sCAAsC;iBACzB,SAAS,CAAC,aAAa;IACpC,gCAAgC;YACxB,SAAS,CAAC,aAAa;IAC/B,0EAA0E;eAC/D,QAAQ,CAAC,UAAU,CAAC;IAC/B,yBAAyB;YACjB,KAAK,CAAC,SAAS;IACvB,8CAA8C;gBAClC,QAAQ;IACpB,uCAAuC;sBACrB,OAAO;IACzB,uBAAuB;UACjB,KAAK,CAAC,SAAS;IACrB,4CAA4C;cAClC,QAAQ;IAClB,qCAAqC;oBACrB,OAAO;kGA4E1B,CAAC"}
|
|
@@ -193,7 +193,7 @@ export const TextInput = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
|
|
|
193
193
|
importantForAccessibility: startIconA11yLabel ? 'auto' : 'no',
|
|
194
194
|
onPress: handleNodePress,
|
|
195
195
|
children: /*#__PURE__*/_jsxs(HStack, {
|
|
196
|
-
paddingStart: compact ? 2 : undefined,
|
|
196
|
+
paddingStart: compact && hasLabel ? 2 : undefined,
|
|
197
197
|
children: [compact && (labelNode ? labelNode : !!label && /*#__PURE__*/_jsx(InputLabel, {
|
|
198
198
|
children: label
|
|
199
199
|
})), !!start && /*#__PURE__*/_jsx(TextInputFocusVariantContext.Provider, {
|
package/esm/tag/Tag.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "alignItems", "justifyContent", "testID"];
|
|
1
|
+
const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "alignItems", "flexDirection", "gap", "justifyContent", "paddingY", "testID"];
|
|
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, { forwardRef, memo } from 'react';
|
|
5
5
|
import { tagBorderRadiusMap, tagEmphasisColorMap, tagFontMap, tagHorizontalSpacing } from '@coinbase/cds-common/tokens/tags';
|
|
6
6
|
import { useTheme } from '../hooks/useTheme';
|
|
7
|
+
import { Icon } from '../icons/Icon';
|
|
7
8
|
import { Box } from '../layout';
|
|
8
9
|
import { Text } from '../typography/Text';
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
11
12
|
let {
|
|
12
13
|
children,
|
|
@@ -15,8 +16,17 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, forwardedRef
|
|
|
15
16
|
colorScheme = 'blue',
|
|
16
17
|
background: customBackground,
|
|
17
18
|
color: customColor,
|
|
19
|
+
start,
|
|
20
|
+
startIcon,
|
|
21
|
+
startIconActive,
|
|
22
|
+
end,
|
|
23
|
+
endIcon,
|
|
24
|
+
endIconActive,
|
|
18
25
|
alignItems = 'center',
|
|
26
|
+
flexDirection = 'row',
|
|
27
|
+
gap = 0.5,
|
|
19
28
|
justifyContent = 'center',
|
|
29
|
+
paddingY = 0.25,
|
|
20
30
|
testID = 'cds-tag'
|
|
21
31
|
} = _ref,
|
|
22
32
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
@@ -27,23 +37,35 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, forwardedRef
|
|
|
27
37
|
} = tagEmphasisColorMap[emphasis][colorScheme];
|
|
28
38
|
const backgroundColor = "rgb(" + theme.spectrum[customBackground != null ? customBackground : background] + ")";
|
|
29
39
|
const color = "rgb(" + theme.spectrum[customColor != null ? customColor : foreground] + ")";
|
|
30
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/_jsxs(Box, _extends({
|
|
31
41
|
ref: forwardedRef,
|
|
32
42
|
alignItems: alignItems,
|
|
33
43
|
background: "bg",
|
|
34
44
|
borderRadius: tagBorderRadiusMap[intent],
|
|
35
45
|
dangerouslySetBackground: backgroundColor,
|
|
46
|
+
flexDirection: flexDirection,
|
|
47
|
+
gap: gap,
|
|
36
48
|
justifyContent: justifyContent,
|
|
37
49
|
paddingX: tagHorizontalSpacing[intent],
|
|
38
|
-
paddingY:
|
|
50
|
+
paddingY: paddingY,
|
|
39
51
|
testID: testID
|
|
40
52
|
}, props, {
|
|
41
|
-
children: /*#__PURE__*/_jsx(
|
|
53
|
+
children: [start ? start : startIcon ? /*#__PURE__*/_jsx(Icon, {
|
|
54
|
+
active: startIconActive,
|
|
55
|
+
dangerouslySetColor: color,
|
|
56
|
+
name: startIcon,
|
|
57
|
+
size: "xs"
|
|
58
|
+
}) : null, /*#__PURE__*/_jsx(Text, {
|
|
42
59
|
dangerouslySetColor: color,
|
|
43
60
|
font: tagFontMap[intent],
|
|
44
61
|
numberOfLines: 1,
|
|
45
62
|
testID: testID + "--text",
|
|
46
63
|
children: children
|
|
47
|
-
})
|
|
64
|
+
}), end ? end : endIcon ? /*#__PURE__*/_jsx(Icon, {
|
|
65
|
+
active: endIconActive,
|
|
66
|
+
dangerouslySetColor: color,
|
|
67
|
+
name: endIcon,
|
|
68
|
+
size: "xs"
|
|
69
|
+
}) : null]
|
|
48
70
|
}));
|
|
49
71
|
}));
|
|
@@ -2,8 +2,9 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import startCase from 'lodash/startCase';
|
|
4
4
|
import { Example, ExampleScreen } from '../../examples/ExampleScreen';
|
|
5
|
+
import { Icon } from '../../icons/Icon';
|
|
5
6
|
import { Tag } from '../Tag';
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
const tagProps = {
|
|
8
9
|
intent: ['informational', 'promotional'],
|
|
9
10
|
emphasis: ['high', 'low'],
|
|
@@ -60,8 +61,8 @@ const tagStories = {
|
|
|
60
61
|
}]
|
|
61
62
|
};
|
|
62
63
|
const TagScreen = () => {
|
|
63
|
-
return /*#__PURE__*/
|
|
64
|
-
children: Object.entries(tagStories).map(_ref => {
|
|
64
|
+
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
65
|
+
children: [Object.entries(tagStories).map(_ref => {
|
|
65
66
|
let [key, story] = _ref;
|
|
66
67
|
return /*#__PURE__*/_jsx(Example, {
|
|
67
68
|
inline: true,
|
|
@@ -70,7 +71,63 @@ const TagScreen = () => {
|
|
|
70
71
|
return /*#__PURE__*/_jsx(Tag, _extends({}, props), props.children + "-" + idx);
|
|
71
72
|
})
|
|
72
73
|
}, key);
|
|
73
|
-
})
|
|
74
|
+
}), /*#__PURE__*/_jsxs(Example, {
|
|
75
|
+
inline: true,
|
|
76
|
+
title: "With Icons",
|
|
77
|
+
children: [/*#__PURE__*/_jsx(Tag, {
|
|
78
|
+
colorScheme: "blue",
|
|
79
|
+
startIcon: "add",
|
|
80
|
+
children: "Start icon"
|
|
81
|
+
}), /*#__PURE__*/_jsx(Tag, {
|
|
82
|
+
colorScheme: "green",
|
|
83
|
+
endIcon: "add",
|
|
84
|
+
children: "End icon"
|
|
85
|
+
}), /*#__PURE__*/_jsx(Tag, {
|
|
86
|
+
colorScheme: "purple",
|
|
87
|
+
endIcon: "add",
|
|
88
|
+
startIcon: "add",
|
|
89
|
+
children: "Both icons"
|
|
90
|
+
}), /*#__PURE__*/_jsx(Tag, {
|
|
91
|
+
colorScheme: "red",
|
|
92
|
+
endIcon: "add",
|
|
93
|
+
intent: "promotional",
|
|
94
|
+
startIcon: "add",
|
|
95
|
+
children: "Promotional with icons"
|
|
96
|
+
})]
|
|
97
|
+
}), /*#__PURE__*/_jsxs(Example, {
|
|
98
|
+
inline: true,
|
|
99
|
+
title: "With Custom Nodes",
|
|
100
|
+
children: [/*#__PURE__*/_jsx(Tag, {
|
|
101
|
+
colorScheme: "blue",
|
|
102
|
+
start: /*#__PURE__*/_jsx(Icon, {
|
|
103
|
+
color: "fgNegative",
|
|
104
|
+
name: "add",
|
|
105
|
+
size: "xs"
|
|
106
|
+
}),
|
|
107
|
+
children: "Custom start node"
|
|
108
|
+
}), /*#__PURE__*/_jsx(Tag, {
|
|
109
|
+
colorScheme: "green",
|
|
110
|
+
end: /*#__PURE__*/_jsx(Icon, {
|
|
111
|
+
color: "fgPositive",
|
|
112
|
+
name: "add",
|
|
113
|
+
size: "xs"
|
|
114
|
+
}),
|
|
115
|
+
children: "Custom end node"
|
|
116
|
+
}), /*#__PURE__*/_jsx(Tag, {
|
|
117
|
+
colorScheme: "purple",
|
|
118
|
+
end: /*#__PURE__*/_jsx(Icon, {
|
|
119
|
+
color: "fgNegative",
|
|
120
|
+
name: "close",
|
|
121
|
+
size: "xs"
|
|
122
|
+
}),
|
|
123
|
+
start: /*#__PURE__*/_jsx(Icon, {
|
|
124
|
+
color: "fgPositive",
|
|
125
|
+
name: "add",
|
|
126
|
+
size: "xs"
|
|
127
|
+
}),
|
|
128
|
+
children: "Both custom nodes"
|
|
129
|
+
})]
|
|
130
|
+
})]
|
|
74
131
|
});
|
|
75
132
|
};
|
|
76
133
|
export default TagScreen;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.48.0",
|
|
4
4
|
"description": "Coinbase Design System - Mobile",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
"react-native-svg": "^14.1.0"
|
|
199
199
|
},
|
|
200
200
|
"dependencies": {
|
|
201
|
-
"@coinbase/cds-common": "^8.
|
|
201
|
+
"@coinbase/cds-common": "^8.48.0",
|
|
202
202
|
"@coinbase/cds-icons": "^5.11.0",
|
|
203
203
|
"@coinbase/cds-illustrations": "^4.31.0",
|
|
204
204
|
"@coinbase/cds-lottie-files": "^3.3.4",
|