@coinbase/cds-web 9.0.2 → 9.1.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 +6 -0
- package/dts/dots/DotCount.d.ts +9 -12
- package/dts/dots/DotCount.d.ts.map +1 -1
- package/esm/dots/DotCount.css +1 -2
- package/esm/dots/DotCount.js +45 -29
- package/package.json +2 -2
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
|
+
## 9.1.0 (5/26/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Feat: support DotCount theming. [[#723](https://github.com/coinbase/cds/pull/723)]
|
|
16
|
+
|
|
11
17
|
## 9.0.2 (5/22/2026 PST)
|
|
12
18
|
|
|
13
19
|
#### 🐞 Fixes
|
package/dts/dots/DotCount.d.ts
CHANGED
|
@@ -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
|
-
*
|
|
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?:
|
|
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
|
-
|
|
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":"DotCount.d.ts","sourceRoot":"","sources":["../../src/dots/DotCount.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAS7C,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,wBAAwB,EACxB,WAAW,EACZ,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"DotCount.d.ts","sourceRoot":"","sources":["../../src/dots/DotCount.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAS7C,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,wBAAwB,EACxB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAQpC,OAAO,EAAO,KAAK,YAAY,EAAyC,MAAM,eAAe,CAAC;AAkB9F,MAAM,MAAM,iBAAiB,GAAG,WAAW,GACzC,IAAI,CACF,wBAAwB,EACxB,oBAAoB,GAAG,yBAAyB,GAAG,mBAAmB,CACvE,GACD,IAAI,CAAC,YAAY,EAAE,U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it-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;}}
|
package/esm/dots/DotCount.js
CHANGED
|
@@ -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 {
|
|
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
|
|
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
|
-
|
|
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(
|
|
77
|
-
|
|
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
|
-
|
|
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:
|
|
96
|
+
color: color,
|
|
85
97
|
display: "block",
|
|
86
|
-
font:
|
|
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:
|
|
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
|
|
3
|
+
"version": "9.1.0",
|
|
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
|
|
218
|
+
"@coinbase/cds-common": "^9.1.0",
|
|
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",
|