@coinbase/cds-web 9.0.2 → 9.1.1

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,18 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
  <!-- template-start -->
10
10
 
11
+ ## 9.1.1 (5/27/2026 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Fix: support inside label variant on select. [[#726](https://github.com/coinbase/cds/pull/726)]
16
+
17
+ ## 9.1.0 (5/26/2026 PST)
18
+
19
+ #### 🚀 Updates
20
+
21
+ - Feat: support DotCount theming. [[#723](https://github.com/coinbase/cds/pull/723)]
22
+
11
23
  ## 9.0.2 (5/22/2026 PST)
12
24
 
13
25
  #### 🐞 Fixes
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultSelectControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select/DefaultSelectControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAiB9E,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AA4BlB,KAAK,wBAAwB,GAAG,CAC9B,IAAI,SAAS,UAAU,EACvB,iBAAiB,SAAS,MAAM,GAAG,MAAM,EAEzC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IACnD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B,KACE,KAAK,CAAC,YAAY,CAAC;AAycxB,eAAO,MAAM,oBAAoB,EAAoC,wBAAwB,CAAC"}
1
+ {"version":3,"file":"DefaultSelectControl.d.ts","sourceRoot":"","sources":["../../../src/alpha/select/DefaultSelectControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAgB9E,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AA4BlB,KAAK,wBAAwB,GAAG,CAC9B,IAAI,SAAS,UAAU,EACvB,iBAAiB,SAAS,MAAM,GAAG,MAAM,EAEzC,KAAK,EAAE,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,CAAC,GAAG;IACnD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;CAC9B,KACE,KAAK,CAAC,YAAY,CAAC;AA+exB,eAAO,MAAM,oBAAoB,EAAoC,wBAAwB,CAAC"}
@@ -6,11 +6,13 @@ 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 DotCountBaseProps = SharedProps &
10
11
  Pick<
11
12
  SharedAccessibilityProps,
12
13
  'accessibilityLabel' | 'accessibilityLabelledBy' | 'accessibilityHint'
13
- > & {
14
+ > &
15
+ Omit<BoxBaseProps, 'children' | 'color' | 'background' | 'pin' | 'height'> & {
14
16
  /**
15
17
  * The number value to be shown in the dot. If count is <= 0, dot will not show up.
16
18
  * */
@@ -32,21 +34,16 @@ export type DotCountBaseProps = SharedProps &
32
34
  /** Indicates what shape Dot is overlapping */
33
35
  overlap?: DotOverlap;
34
36
  /**
35
- * An optional fixed height of the DotCount component.
36
- * Width grows based on content length.
37
+ * Fixed height of the DotCount badge container. Width grows based on content length.
37
38
  * @default 24
38
- * */
39
- height?: number;
40
- /**
41
- * An optional fixed width of the DotCount component.
42
- * By default, width grows based on content length.
43
- * @default auto
44
- * */
45
- width?: number;
39
+ */
40
+ height?: BoxBaseProps['height'];
46
41
  };
47
42
  export type DotCountProps = DotCountBaseProps & {
43
+ /** Class name for the root element */
48
44
  className?: string;
49
- style?: React.CSSProperties;
45
+ /** Color token for the count label */
46
+ color?: BoxBaseProps['color'];
50
47
  /** Custom class names for individual elements of the DotCount component */
51
48
  classNames?: {
52
49
  /** Root element */
@@ -1 +1 @@
1
- {"version":3,"file":"D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A2E;IAC3E,UAAU,CAAC,EAAE;QACX,mBAAmB;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,wBAAwB;QACxB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,mBAAmB;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,sEAAsE;IACtE,MAAM,CAAC,EAAE;QACP,mBAAmB;QACnB,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC3B,wBAAwB;QACxB,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAChC,mBAAmB;QACnB,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,QAAQ,qCAAiB,aAAa,6CA6GjD,CAAC"}
@@ -12,7 +12,6 @@ import { HelperText } from '../../controls/HelperText';
12
12
  import { InputLabel } from '../../controls/InputLabel';
13
13
  import { InputStack } from '../../controls/InputStack';
14
14
  import { cx } from '../../cx';
15
- import { useTheme } from '../../hooks/useTheme';
16
15
  import { HStack } from '../../layout/HStack';
17
16
  import { VStack } from '../../layout/VStack';
18
17
  import { AnimatedCaret } from '../../motion/AnimatedCaret';
@@ -45,7 +44,7 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
45
44
  variant,
46
45
  helperText,
47
46
  label,
48
- labelVariant,
47
+ labelVariant: labelVariantProp,
49
48
  contentNode,
50
49
  startNode,
51
50
  endNode: customEndNode,
@@ -67,11 +66,13 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
67
66
  classNames
68
67
  } = _ref,
69
68
  props = _objectWithoutProperties(_ref, _excluded);
70
- const theme = useTheme();
71
69
  const isMultiSelect = type === 'multi';
70
+ // When compact, labelVariant is ignored
71
+ const labelVariant = compact ? undefined : labelVariantProp;
72
72
  // horizontal/inline label is used for compact selesct exepct for multi-selects
73
73
  // multi-selects render their label outside of the control unless labelVariant is set to 'inside'
74
74
  const shouldShowCompactLabel = compact && label && !isMultiSelect;
75
+ const shouldShowInsideLabel = labelVariant === 'inside' && !compact && label;
75
76
  const hasValue = value !== null && !(Array.isArray(value) && value.length === 0);
76
77
  // Map of options to their values
77
78
  // If multiple options share the same value, the first occurrence wins (matches native HTML select behavior)
@@ -158,27 +159,32 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
158
159
  style: styles === null || styles === void 0 ? void 0 : styles.controlHelperTextNode,
159
160
  children: helperText
160
161
  }) : helperText, [helperText, variant, classNames === null || classNames === void 0 ? void 0 : classNames.controlHelperTextNode, styles === null || styles === void 0 ? void 0 : styles.controlHelperTextNode]);
161
- const labelNode = useMemo(() =>
162
- // labelVariant has no effect when compact is true
163
- labelVariant === 'inside' && !compact ? /*#__PURE__*/_jsx(Pressable, {
164
- noScaleOnPress: true,
165
- onClick: () => setOpen(s => !s),
166
- tabIndex: -1,
167
- children: /*#__PURE__*/_jsx(InputLabel, {
168
- className: classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode,
169
- color: "fg",
170
- style: styles === null || styles === void 0 ? void 0 : styles.controlLabelNode,
171
- children: label
172
- })
173
- }) : typeof label === 'string' ? /*#__PURE__*/_jsx(InputLabel, {
174
- className: classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode,
175
- color: "fg"
176
- // remove default vertical padding when label is the compact/inline version
177
- ,
178
- paddingY: shouldShowCompactLabel ? 0 : 0.5,
179
- style: styles === null || styles === void 0 ? void 0 : styles.controlLabelNode,
180
- children: label
181
- }) : label, [labelVariant, compact, classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode, styles === null || styles === void 0 ? void 0 : styles.controlLabelNode, label, shouldShowCompactLabel, setOpen]);
162
+ const labelNode = useMemo(() => {
163
+ if (shouldShowInsideLabel || shouldShowCompactLabel) return null;
164
+ if (typeof label === 'string') {
165
+ return /*#__PURE__*/_jsx(InputLabel, {
166
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode,
167
+ color: "fg",
168
+ paddingY: 0.5,
169
+ style: styles === null || styles === void 0 ? void 0 : styles.controlLabelNode,
170
+ children: label
171
+ });
172
+ }
173
+ return label;
174
+ }, [shouldShowInsideLabel, shouldShowCompactLabel, classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode, styles === null || styles === void 0 ? void 0 : styles.controlLabelNode, label]);
175
+ const inlineLabelNode = useMemo(() => {
176
+ if (!shouldShowInsideLabel && !shouldShowCompactLabel) return null;
177
+ if (typeof label === 'string') {
178
+ return /*#__PURE__*/_jsx(InputLabel, {
179
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode,
180
+ color: "fg",
181
+ paddingY: 0,
182
+ style: styles === null || styles === void 0 ? void 0 : styles.controlLabelNode,
183
+ children: label
184
+ });
185
+ }
186
+ return label;
187
+ }, [shouldShowInsideLabel, shouldShowCompactLabel, classNames === null || classNames === void 0 ? void 0 : classNames.controlLabelNode, styles === null || styles === void 0 ? void 0 : styles.controlLabelNode, label]);
182
188
  const valueNode = useMemo(() => {
183
189
  if (hasValue && isMultiSelect) {
184
190
  const valuesToShow = value.length <= maxSelectedOptionsToShow ? value : value.slice(0, maxSelectedOptionsToShow);
@@ -262,8 +268,32 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
262
268
  }), shouldShowCompactLabel ? /*#__PURE__*/_jsx(HStack, {
263
269
  alignItems: "center",
264
270
  paddingEnd: 1,
265
- children: labelNode
266
- }) : null, /*#__PURE__*/_jsx(HStack, {
271
+ children: inlineLabelNode
272
+ }) : null, shouldShowInsideLabel ? /*#__PURE__*/_jsxs(VStack, {
273
+ flexGrow: 1,
274
+ minWidth: 0,
275
+ width: "100%",
276
+ children: [inlineLabelNode, /*#__PURE__*/_jsx(HStack, {
277
+ alignItems: "center",
278
+ flexGrow: 1,
279
+ minWidth: 0,
280
+ width: "100%",
281
+ children: /*#__PURE__*/_jsxs(VStack, {
282
+ ref: valueNodeContainerRef,
283
+ alignItems: align,
284
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.controlValueNode,
285
+ flexGrow: 1,
286
+ flexShrink: 1,
287
+ flexWrap: "wrap",
288
+ gap: 1,
289
+ justifyContent: "flex-start",
290
+ minWidth: 0,
291
+ overflow: "hidden",
292
+ style: styles === null || styles === void 0 ? void 0 : styles.controlValueNode,
293
+ children: [valueNode, contentNode]
294
+ })
295
+ })]
296
+ }) : /*#__PURE__*/_jsx(HStack, {
267
297
  alignItems: "center",
268
298
  flexGrow: 1,
269
299
  flexShrink: 1,
@@ -286,7 +316,7 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
286
316
  children: [valueNode, contentNode]
287
317
  })
288
318
  })]
289
- }), [computedControlAccessibilityLabel, ariaHaspopup, open, role, interactableBlendStyles, classNames === null || classNames === void 0 ? void 0 : classNames.controlInputNode, classNames === null || classNames === void 0 ? void 0 : classNames.controlStartNode, classNames === null || classNames === void 0 ? void 0 : classNames.controlValueNode, disabled, styles === null || styles === void 0 ? void 0 : styles.controlInputNode, styles === null || styles === void 0 ? void 0 : styles.controlStartNode, styles === null || styles === void 0 ? void 0 : styles.controlValueNode, tabIndex, onKeyDown, startNode, shouldShowCompactLabel, labelNode, align, valueNode, contentNode, setOpen]);
319
+ }), [computedControlAccessibilityLabel, ariaHaspopup, open, role, interactableBlendStyles, classNames === null || classNames === void 0 ? void 0 : classNames.controlInputNode, classNames === null || classNames === void 0 ? void 0 : classNames.controlStartNode, classNames === null || classNames === void 0 ? void 0 : classNames.controlValueNode, disabled, styles === null || styles === void 0 ? void 0 : styles.controlInputNode, styles === null || styles === void 0 ? void 0 : styles.controlStartNode, styles === null || styles === void 0 ? void 0 : styles.controlValueNode, tabIndex, onKeyDown, startNode, shouldShowCompactLabel, shouldShowInsideLabel, inlineLabelNode, align, valueNode, contentNode, setOpen]);
290
320
  const endNode = useMemo(() => /*#__PURE__*/_jsx(Pressable, {
291
321
  "aria-hidden": true,
292
322
  flexShrink: 0,
@@ -307,13 +337,11 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
307
337
  })
308
338
  }), [classNames === null || classNames === void 0 ? void 0 : classNames.controlEndNode, labelVariant, styles === null || styles === void 0 ? void 0 : styles.controlEndNode, customEndNode, open, variant, setOpen]);
309
339
  const inputStackStyles = useMemo(() => ({
310
- input: {
311
- paddingTop: compact || labelVariant === 'inside' ? theme.space[1] : theme.space[2],
312
- paddingBottom: compact ? theme.space[1] : theme.space[2],
313
- paddingLeft: theme.space[2],
314
- paddingRight: theme.space[2]
315
- }
316
- }), [compact, theme.space, labelVariant]);
340
+ paddingTop: compact || labelVariant === 'inside' ? 'var(--space-1)' : 'var(--space-2)',
341
+ paddingBottom: compact || labelVariant === 'inside' ? 'var(--space-1)' : 'var(--space-2)',
342
+ paddingLeft: 'var(--space-2)',
343
+ paddingRight: 'var(--space-2)'
344
+ }), [compact, labelVariant]);
317
345
  return /*#__PURE__*/_jsx(InputStack, _objectSpread({
318
346
  ref: ref,
319
347
  blendStyles: interactableBlendStyles,
@@ -323,9 +351,11 @@ const DefaultSelectControlComponent = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(
323
351
  focusedBorderWidth: focusedBorderWidth,
324
352
  helperTextNode: helperTextNode,
325
353
  inputNode: inputNode,
326
- labelNode: shouldShowCompactLabel ? null : labelNode,
354
+ labelNode: labelNode,
327
355
  labelVariant: labelVariant,
328
- styles: inputStackStyles,
356
+ styles: {
357
+ input: inputStackStyles
358
+ },
329
359
  variant: variant
330
360
  }, props));
331
361
  }));
@@ -1,2 +1 @@
1
- @layer cds{.baseCss-b1qqkfau{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;position:relative;}
2
- .dotCountContentCss-dqpqhs5{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border-style:solid;border-width:var(--borderWidth-100);border-radius:var(--borderRadius-400);padding-inline-start:var(--space-0_75);padding-inline-end:var(--space-0_75);}}
1
+ @layer cds{.baseCss-b1qqkfau{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;position:relative;}}
@@ -1,4 +1,4 @@
1
- const _excluded = ["children", "pin", "variant", "count", "max", "height", "width", "testID", "accessibilityLabel", "overlap", "className", "classNames", "style", "styles"];
1
+ const _excluded = ["children", "pin", "variant", "count", "max", "height", "width", "testID", "accessibilityLabel", "overlap", "className", "classNames", "style", "styles", "alignItems", "justifyContent", "display", "paddingX", "borderWidth", "borderRadius", "borderColor", "font", "color", "fontFamily", "fontSize", "fontWeight", "lineHeight"];
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; }
@@ -14,13 +14,13 @@ import { m as motion } from 'framer-motion';
14
14
  import { NewAnimatePresence } from '../animation/NewAnimatePresence';
15
15
  import { cx } from '../cx';
16
16
  import { useComponentConfig } from '../hooks/useComponentConfig';
17
- import { useTheme } from '../hooks/useTheme';
17
+ import { Box } from '../layout/Box';
18
18
  import { useMotionProps } from '../motion/useMotionProps';
19
19
  import { Text } from '../typography/Text';
20
20
  import { getTransform } from './dotStyles';
21
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ const MotionBox = motion(Box);
22
23
  const baseCss = "baseCss-b1qqkfau";
23
- const dotCountContentCss = "dotCountContentCss-dqpqhs5";
24
24
  const variantColorMap = {
25
25
  negative: 'fgNegative'
26
26
  };
@@ -34,62 +34,78 @@ export const DotCount = /*#__PURE__*/memo(_props => {
34
34
  max,
35
35
  height = dotCountSize,
36
36
  width,
37
- testID,
37
+ testID = 'dot-count',
38
38
  accessibilityLabel,
39
39
  overlap,
40
40
  className,
41
41
  classNames,
42
42
  style,
43
- styles
43
+ styles,
44
+ alignItems = 'center',
45
+ justifyContent = 'center',
46
+ display = 'flex',
47
+ paddingX = 0.75,
48
+ borderWidth = 100,
49
+ borderRadius = 400,
50
+ borderColor = 'bgSecondary',
51
+ font = 'caption',
52
+ color = 'fgInverse',
53
+ fontFamily,
54
+ fontSize,
55
+ fontWeight,
56
+ lineHeight
44
57
  } = mergedProps,
45
58
  props = _objectWithoutProperties(mergedProps, _excluded);
46
- const {
47
- color
48
- } = useTheme();
49
59
  const pinStyles = getTransform(pin, overlap);
50
- const containerStyles = useMemo(() => {
51
- const variantColor = variantColorMap[variant];
52
- return _objectSpread(_objectSpread({
53
- height,
54
- minWidth: height,
55
- width,
56
- backgroundColor: color[variantColor],
57
- borderColor: color.bgSecondary
58
- }, pinStyles), styles === null || styles === void 0 ? void 0 : styles.container);
59
- }, [height, width, color, pinStyles, styles === null || styles === void 0 ? void 0 : styles.container, variant]);
60
+ const containerStyle = useMemo(() => _objectSpread(_objectSpread({}, pinStyles), styles === null || styles === void 0 ? void 0 : styles.container), [pinStyles, styles === null || styles === void 0 ? void 0 : styles.container]);
60
61
  const motionProps = useMotionProps({
61
62
  enterConfigs: [dotOpacityEnterConfig, dotScaleEnterConfig],
62
63
  exitConfigs: [dotOpacityExitConfig, dotScaleExitConfig],
63
64
  exit: 'exit'
64
65
  });
65
66
  const rootStyles = useMemo(() => _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root), [styles === null || styles === void 0 ? void 0 : styles.root, style]);
66
- return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
67
+ const displayCount = useMemo(() => parseDotCountMaxOverflow(count, max), [count, max]);
68
+ return /*#__PURE__*/_jsxs("div", {
67
69
  "aria-label": accessibilityLabel,
68
70
  className: cx(baseCss, className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
69
71
  "data-testid": testID,
70
- style: rootStyles
71
- }, props), {}, {
72
+ style: rootStyles,
72
73
  children: [children, /*#__PURE__*/_jsx(NewAnimatePresence, {
73
74
  children: count > 0 &&
74
75
  /*#__PURE__*/
75
76
  // TODO: Remove type assertion after upgrading framer-motion to v11+ for React 19 compatibility
76
- _jsx(motion.div, _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, motionProps), {}, {
77
- className: cx(dotCountContentCss, classNames === null || classNames === void 0 ? void 0 : classNames.container),
77
+ _jsx(MotionBox, _objectSpread(_objectSpread({}, _objectSpread(_objectSpread({}, motionProps), {}, {
78
+ alignItems,
79
+ background: variantColorMap[variant],
80
+ borderColor,
81
+ borderRadius,
82
+ borderWidth,
83
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.container,
78
84
  'data-testid': 'dotcount-container',
79
- style: containerStyles
80
- })), {}, {
85
+ display,
86
+ height,
87
+ justifyContent,
88
+ minWidth: height,
89
+ paddingX,
90
+ style: containerStyle,
91
+ width
92
+ }, props)), {}, {
81
93
  children: /*#__PURE__*/_jsx(Text, {
82
94
  as: "p",
83
95
  className: classNames === null || classNames === void 0 ? void 0 : classNames.text,
84
- color: "fgInverse",
96
+ color: color,
85
97
  display: "block",
86
- font: "caption",
98
+ font: font,
99
+ fontFamily: fontFamily,
100
+ fontSize: fontSize,
101
+ fontWeight: fontWeight,
102
+ lineHeight: lineHeight,
87
103
  style: styles === null || styles === void 0 ? void 0 : styles.text,
88
104
  textAlign: "center",
89
- children: parseDotCountMaxOverflow(count, max)
105
+ children: displayCount
90
106
  })
91
107
  }))
92
108
  })]
93
- }));
109
+ });
94
110
  });
95
111
  import "./DotCount.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "9.0.2",
3
+ "version": "9.1.1",
4
4
  "description": "Coinbase Design System - Web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -215,7 +215,7 @@
215
215
  "react-dom": "^18.0.0 || ~19.1.2"
216
216
  },
217
217
  "dependencies": {
218
- "@coinbase/cds-common": "^9.0.2",
218
+ "@coinbase/cds-common": "^9.1.1",
219
219
  "@coinbase/cds-icons": "^5.17.0",
220
220
  "@coinbase/cds-illustrations": "^4.40.1",
221
221
  "@coinbase/cds-lottie-files": "^3.3.4",