@coinbase/cds-web 8.47.4 → 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 CHANGED
@@ -8,6 +8,12 @@ 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
+
11
17
  ## 8.47.4 ((2/23/2026, 03:04 PM PST))
12
18
 
13
19
  This is an artificial version bump with no new change.
package/dts/tag/Tag.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { ThemeVars } from '@coinbase/cds-common/core/theme';
3
3
  import type {
4
+ IconName,
4
5
  SharedAccessibilityProps,
5
6
  SharedProps,
6
7
  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<BoxDefaultElement>['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<BoxDefaultElement>, 'color' | 'background' | 'children' | 'maxWidth'>;
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.d.ts","sourceRoot":"","sources":["../../src/tag/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAA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K,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQ3E,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C,MAAM,MAAM,YAAY,GAAG,WAAW,GACpC,wBAAwB,GAAG;IACzB,yCAAyC;IACzC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,sCAAsC;IACtC,UAAU,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC;IACrC,gCAAgC;IAChC,KAAK,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,UAAU,CAAC,CAAC;IACnD,yBAAyB;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,uCAAuC;IACvC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB;IACvB,GAAG,CAAC,EAAE,KAAK,CAAC,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,CAAC,iBAAiB,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;AAEtF,eAAO,MAAM,GAAG,yHAgFf,CAAC"}
@@ -0,0 +1 @@
1
+ @layer cds{.nodeCss-n1hf567u{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}}
package/esm/tag/Tag.js CHANGED
@@ -1,4 +1,4 @@
1
- const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "display", "alignItems", "justifyContent", "testID"];
1
+ const _excluded = ["children", "intent", "emphasis", "colorScheme", "background", "color", "start", "startIcon", "startIconActive", "end", "endIcon", "endIconActive", "display", "alignItems", "gap", "justifyContent", "paddingY", "testID"];
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; }
@@ -9,9 +9,11 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
9
9
  import React, { forwardRef, memo, useMemo } from 'react';
10
10
  import { tagBorderRadiusMap, tagEmphasisColorMap, tagFontMap, tagHorizontalSpacing } from '@coinbase/cds-common/tokens/tags';
11
11
  import { useTheme } from '../hooks/useTheme';
12
+ import { Icon } from '../icons/Icon';
12
13
  import { Box } from '../layout/Box';
13
14
  import { Text } from '../typography/Text';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ const nodeCss = "nodeCss-n1hf567u";
15
17
  export const tagStaticClassName = 'cds-tag';
16
18
  export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tag(_ref, forwardedRef) {
17
19
  let {
@@ -21,9 +23,17 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tag(_ref,
21
23
  colorScheme = 'blue',
22
24
  background: customBackground,
23
25
  color: customColor,
26
+ start,
27
+ startIcon,
28
+ startIconActive,
29
+ end,
30
+ endIcon,
31
+ endIconActive,
24
32
  display = 'inline-flex',
25
33
  alignItems = 'center',
34
+ gap = 0.5,
26
35
  justifyContent = 'center',
36
+ paddingY = 0.25,
27
37
  testID = tagStaticClassName
28
38
  } = _ref,
29
39
  props = _objectWithoutProperties(_ref, _excluded);
@@ -33,12 +43,10 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tag(_ref,
33
43
  foreground
34
44
  } = tagEmphasisColorMap[emphasis][colorScheme];
35
45
  const boxStyles = useMemo(() => ({
36
- backgroundColor: "rgb(".concat(theme.spectrum[customBackground !== null && customBackground !== void 0 ? customBackground : background], ")")
37
- }), [background, customBackground, theme.spectrum]);
38
- const textStyles = useMemo(() => ({
46
+ backgroundColor: "rgb(".concat(theme.spectrum[customBackground !== null && customBackground !== void 0 ? customBackground : background], ")"),
39
47
  color: "rgb(".concat(theme.spectrum[customColor !== null && customColor !== void 0 ? customColor : foreground], ")")
40
- }), [foreground, customColor, theme.spectrum]);
41
- return /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
48
+ }), [background, customBackground, foreground, customColor, theme.spectrum]);
49
+ return /*#__PURE__*/_jsxs(Box, _objectSpread(_objectSpread({
42
50
  ref: forwardedRef,
43
51
  alignItems: alignItems,
44
52
  background: "bg",
@@ -46,19 +54,43 @@ export const Tag = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function Tag(_ref,
46
54
  className: tagStaticClassName,
47
55
  "data-testid": testID,
48
56
  display: display,
57
+ gap: gap,
49
58
  justifyContent: justifyContent,
50
59
  paddingX: tagHorizontalSpacing[intent],
51
- paddingY: 0.25,
60
+ paddingY: paddingY,
52
61
  style: boxStyles,
53
62
  testID: testID
54
63
  }, props), {}, {
55
- children: /*#__PURE__*/_jsx(Text, {
64
+ children: [start ? /*#__PURE__*/_jsx("span", {
65
+ className: nodeCss,
66
+ children: start
67
+ }) : startIcon ? /*#__PURE__*/_jsx("span", {
68
+ className: nodeCss,
69
+ children: /*#__PURE__*/_jsx(Icon, {
70
+ active: startIconActive,
71
+ color: "currentColor",
72
+ name: startIcon,
73
+ size: "xs"
74
+ })
75
+ }) : null, /*#__PURE__*/_jsx(Text, {
76
+ color: "currentColor",
56
77
  display: "inline",
57
78
  font: tagFontMap[intent],
58
79
  overflow: "truncate",
59
- style: textStyles,
60
80
  testID: "".concat(testID, "--text"),
61
81
  children: children
62
- })
82
+ }), end ? /*#__PURE__*/_jsx("span", {
83
+ className: nodeCss,
84
+ children: end
85
+ }) : endIcon ? /*#__PURE__*/_jsx("span", {
86
+ className: nodeCss,
87
+ children: /*#__PURE__*/_jsx(Icon, {
88
+ active: endIconActive,
89
+ color: "currentColor",
90
+ name: endIcon,
91
+ size: "xs"
92
+ })
93
+ }) : null]
63
94
  }));
64
- }));
95
+ }));
96
+ import "./Tag.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "8.47.4",
3
+ "version": "8.48.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.47.4",
210
+ "@coinbase/cds-common": "^8.48.0",
211
211
  "@coinbase/cds-icons": "^5.11.0",
212
212
  "@coinbase/cds-illustrations": "^4.31.0",
213
213
  "@coinbase/cds-lottie-files": "^3.3.4",