@coinbase/cds-web-visualization 3.4.0-beta.19 → 3.4.0-beta.20
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 +11 -0
- package/dts/chart/PeriodSelector.d.ts +5 -11
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/esm/chart/ChartProvider.js +1 -1
- package/esm/chart/PeriodSelector.js +32 -15
- package/esm/chart/bar/BarStackGroup.js +1 -1
- package/esm/chart/utils/axis.js +2 -2
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,17 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 3.4.0-beta.20 (2/27/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🚀 Updates
|
|
14
|
+
|
|
15
|
+
- Add classnames and styles props to PeriodSelector. [[#438](https://github.com/coinbase/cds/pull/438/)]
|
|
16
|
+
|
|
17
|
+
#### 📘 Misc
|
|
18
|
+
|
|
19
|
+
- Clarify framer-motion is a peerDependency. [[#437](https://github.com/coinbase/cds/pull/437)]
|
|
20
|
+
- Update oudated doc links. [[#440](https://github.com/coinbase/cds/pull/440)]
|
|
21
|
+
|
|
11
22
|
## 3.4.0-beta.19 (2/20/2026 PST)
|
|
12
23
|
|
|
13
24
|
#### 🚀 Updates
|
|
@@ -9,6 +9,7 @@ export declare const PeriodSelectorActiveIndicator: React.MemoExoticComponent<
|
|
|
9
9
|
position,
|
|
10
10
|
borderRadius,
|
|
11
11
|
style,
|
|
12
|
+
...props
|
|
12
13
|
}: TabsActiveIndicatorProps) => import('react/jsx-runtime').JSX.Element | null
|
|
13
14
|
>;
|
|
14
15
|
export declare const liveTabLabelDefaultElement = 'span';
|
|
@@ -33,23 +34,16 @@ type LiveTabLabelComponent = (<AsComponent extends React.ElementType = LiveTabLa
|
|
|
33
34
|
) => Polymorphic.ReactReturn) &
|
|
34
35
|
Polymorphic.ReactNamed;
|
|
35
36
|
export declare const LiveTabLabel: LiveTabLabelComponent;
|
|
36
|
-
export type PeriodSelectorProps = SegmentedTabsProps
|
|
37
|
+
export type PeriodSelectorProps = Omit<SegmentedTabsProps, 'styles' | 'classNames'> &
|
|
38
|
+
Pick<SegmentedTabsProps, 'styles' | 'classNames'>;
|
|
37
39
|
/**
|
|
38
40
|
* PeriodSelector is a specialized version of SegmentedTabs optimized for chart period selection.
|
|
39
41
|
* It provides transparent background, primary wash active state, and full-width layout by default.
|
|
40
42
|
*/
|
|
41
43
|
export declare const PeriodSelector: React.MemoExoticComponent<
|
|
42
44
|
React.ForwardRefExoticComponent<
|
|
43
|
-
|
|
44
|
-
Pick<
|
|
45
|
-
import('@coinbase/cds-web/tabs').TabsProps<string>,
|
|
46
|
-
'TabComponent' | 'TabsActiveIndicatorComponent'
|
|
47
|
-
>
|
|
48
|
-
> &
|
|
49
|
-
Omit<
|
|
50
|
-
import('@coinbase/cds-web/tabs').TabsProps<string>,
|
|
51
|
-
'TabComponent' | 'TabsActiveIndicatorComponent'
|
|
52
|
-
> &
|
|
45
|
+
Omit<SegmentedTabsProps, 'styles' | 'classNames'> &
|
|
46
|
+
Pick<SegmentedTabsProps, 'styles' | 'classNames'> &
|
|
53
47
|
React.RefAttributes<HTMLElement>
|
|
54
48
|
>
|
|
55
49
|
>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PeriodSelector.d.ts","sourceRoot":"","sources":["../../src/chart/PeriodSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PeriodSelector.d.ts","sourceRoot":"","sources":["../../src/chart/PeriodSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEvE,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,wBAAwB,EAE9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAOxE,eAAO,MAAM,6BAA6B,qGAQrC,wBAAwB,oDA0B5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,SAAS,CAAC;AAEjD,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAC;AAE3E,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAAG;IAClD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,WAAW,SAAS,KAAK,CAAC,WAAW,IAAI,WAAW,CAAC,KAAK,CACtF,WAAW,EACX,qBAAqB,CACtB,CAAC;AAYF,KAAK,qBAAqB,GAAG,CAAC,CAAC,WAAW,SAAS,KAAK,CAAC,WAAW,GAAG,0BAA0B,EAC/F,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,KAClC,WAAW,CAAC,WAAW,CAAC,GAC3B,WAAW,CAAC,UAAU,CAAC;AAEzB,eAAO,MAAM,YAAY,EAAE,qBAiC1B,CAAC;AASF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,YAAY,CAAC,GACjF,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,YAAY,CAAC,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,cAAc,sMAwC1B,CAAC"}
|
|
@@ -3,7 +3,7 @@ export const CartesianChartContext = /*#__PURE__*/createContext(undefined);
|
|
|
3
3
|
export const useCartesianChartContext = () => {
|
|
4
4
|
const context = useContext(CartesianChartContext);
|
|
5
5
|
if (!context) {
|
|
6
|
-
throw new Error('useCartesianChartContext must be used within a CartesianChart component. See
|
|
6
|
+
throw new Error('useCartesianChartContext must be used within a CartesianChart component. See https://cds.coinbase.com/components/charts/CartesianChart.');
|
|
7
7
|
}
|
|
8
8
|
return context;
|
|
9
9
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const _excluded = ["
|
|
2
|
-
_excluded2 = ["
|
|
3
|
-
|
|
4
|
-
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; }
|
|
1
|
+
const _excluded = ["activeTabRect", "background", "position", "borderRadius", "style"],
|
|
2
|
+
_excluded2 = ["as", "color", "label", "display", "alignItems", "font", "hideDot"],
|
|
3
|
+
_excluded3 = ["background", "activeBackground", "width", "justifyContent", "TabComponent", "TabsActiveIndicatorComponent", "className", "classNames", "style", "styles"];
|
|
5
4
|
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; }
|
|
6
5
|
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; }
|
|
7
6
|
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; }
|
|
8
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
9
8
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
10
|
+
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; }
|
|
10
11
|
import React, { forwardRef, memo, useMemo } from 'react';
|
|
12
|
+
import { cx } from '@coinbase/cds-web';
|
|
11
13
|
import { Box } from '@coinbase/cds-web/layout';
|
|
12
14
|
import { SegmentedTabs, tabsTransitionConfig } from '@coinbase/cds-web/tabs';
|
|
13
15
|
import { SegmentedTab } from '@coinbase/cds-web/tabs/SegmentedTab';
|
|
@@ -19,12 +21,13 @@ const MotionBox = motion(Box);
|
|
|
19
21
|
// Animated active indicator to support smooth transition of background color
|
|
20
22
|
export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
21
23
|
let {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
activeTabRect,
|
|
25
|
+
background = 'bgPrimaryWash',
|
|
26
|
+
position = 'absolute',
|
|
27
|
+
borderRadius = 1000,
|
|
28
|
+
style
|
|
29
|
+
} = _ref,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
31
|
const {
|
|
29
32
|
width,
|
|
30
33
|
height,
|
|
@@ -35,7 +38,7 @@ export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
|
35
38
|
x
|
|
36
39
|
}), [width, x]);
|
|
37
40
|
if (!width) return null;
|
|
38
|
-
return /*#__PURE__*/_jsx(MotionBox, {
|
|
41
|
+
return /*#__PURE__*/_jsx(MotionBox, _objectSpread({
|
|
39
42
|
animate: activeAnimation,
|
|
40
43
|
borderRadius: borderRadius,
|
|
41
44
|
"data-testid": "period-selector-active-indicator",
|
|
@@ -49,7 +52,7 @@ export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
|
|
|
49
52
|
transition: 'background-color 0.2s ease'
|
|
50
53
|
}, style),
|
|
51
54
|
transition: tabsTransitionConfig
|
|
52
|
-
});
|
|
55
|
+
}, props));
|
|
53
56
|
});
|
|
54
57
|
export const liveTabLabelDefaultElement = 'span';
|
|
55
58
|
// is this bad to use var(--space-1) for height and width?
|
|
@@ -64,7 +67,7 @@ export const LiveTabLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, re
|
|
|
64
67
|
font = 'label1',
|
|
65
68
|
hideDot
|
|
66
69
|
} = _ref2,
|
|
67
|
-
props = _objectWithoutProperties(_ref2,
|
|
70
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
68
71
|
const Component = as !== null && as !== void 0 ? as : liveTabLabelDefaultElement;
|
|
69
72
|
return /*#__PURE__*/_jsxs(Text, _objectSpread(_objectSpread({
|
|
70
73
|
ref: ref,
|
|
@@ -97,16 +100,30 @@ export const PeriodSelector = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
|
|
|
97
100
|
width = '100%',
|
|
98
101
|
justifyContent = 'space-between',
|
|
99
102
|
TabComponent = PeriodSelectorTab,
|
|
100
|
-
TabsActiveIndicatorComponent = PeriodSelectorActiveIndicator
|
|
103
|
+
TabsActiveIndicatorComponent = PeriodSelectorActiveIndicator,
|
|
104
|
+
className,
|
|
105
|
+
classNames,
|
|
106
|
+
style,
|
|
107
|
+
styles
|
|
101
108
|
} = _ref3,
|
|
102
|
-
props = _objectWithoutProperties(_ref3,
|
|
109
|
+
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
103
110
|
return /*#__PURE__*/_jsx(SegmentedTabs, _objectSpread({
|
|
104
111
|
ref: ref,
|
|
105
112
|
TabComponent: TabComponent,
|
|
106
113
|
TabsActiveIndicatorComponent: TabsActiveIndicatorComponent,
|
|
107
114
|
activeBackground: activeBackground,
|
|
108
115
|
background: background,
|
|
116
|
+
className: cx(className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
117
|
+
classNames: {
|
|
118
|
+
tab: classNames === null || classNames === void 0 ? void 0 : classNames.tab,
|
|
119
|
+
activeIndicator: classNames === null || classNames === void 0 ? void 0 : classNames.activeIndicator
|
|
120
|
+
},
|
|
109
121
|
justifyContent: justifyContent,
|
|
122
|
+
style: styles !== null && styles !== void 0 && styles.root ? _objectSpread(_objectSpread({}, style), styles.root) : style,
|
|
123
|
+
styles: {
|
|
124
|
+
tab: styles === null || styles === void 0 ? void 0 : styles.tab,
|
|
125
|
+
activeIndicator: styles === null || styles === void 0 ? void 0 : styles.activeIndicator
|
|
126
|
+
},
|
|
110
127
|
width: width
|
|
111
128
|
}, props));
|
|
112
129
|
}));
|
|
@@ -63,7 +63,7 @@ export const BarStackGroup = /*#__PURE__*/memo(_ref => {
|
|
|
63
63
|
return configs;
|
|
64
64
|
}, [xScale, yScale, drawingArea, dataLength, stackIndex, totalStacks, barPadding]);
|
|
65
65
|
if (xScale && !isCategoricalScale(xScale)) {
|
|
66
|
-
throw new Error('BarStackGroup requires a band scale for x-axis. See https://cds.coinbase.com/components/
|
|
66
|
+
throw new Error('BarStackGroup requires a band scale for x-axis. See https://cds.coinbase.com/components/charts/XAxis/#scale-type');
|
|
67
67
|
}
|
|
68
68
|
if (!yScale || !drawingArea || stackConfigs.length === 0) return null;
|
|
69
69
|
return stackConfigs.map(_ref2 => {
|
package/esm/chart/utils/axis.js
CHANGED
|
@@ -88,7 +88,7 @@ export const getAxisScale = _ref => {
|
|
|
88
88
|
max: (_config$domain$max = config.domain.max) !== null && _config$domain$max !== void 0 ? _config$domain$max : dataDomain.max
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
if (!isValidBounds(adjustedDomain)) throw new Error('Invalid domain bounds. See https://cds.coinbase.com/
|
|
91
|
+
if (!isValidBounds(adjustedDomain)) throw new Error('Invalid domain bounds. See https://cds.coinbase.com/components/charts/XAxis/#domain');
|
|
92
92
|
if (scaleType === 'band') {
|
|
93
93
|
var _config$categoryPaddi;
|
|
94
94
|
return getCategoricalScale({
|
|
@@ -138,7 +138,7 @@ export const getAxisConfig = function (type, axes) {
|
|
|
138
138
|
} = _ref2;
|
|
139
139
|
return id === undefined;
|
|
140
140
|
})) {
|
|
141
|
-
throw new Error('When defining multiple axes, each must have a unique id. See https://cds.coinbase.com/components/
|
|
141
|
+
throw new Error('When defining multiple axes, each must have a unique id. See https://cds.coinbase.com/components/charts/YAxis/#multiple-y-axes.');
|
|
142
142
|
}
|
|
143
143
|
return axes.map(_ref3 => {
|
|
144
144
|
let {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-web-visualization",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.20",
|
|
4
4
|
"description": "Coinbase Design System - Web Sparkline",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
"CHANGELOG"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@coinbase/cds-common": "^8.
|
|
41
|
+
"@coinbase/cds-common": "^8.49.0",
|
|
42
42
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
43
43
|
"@coinbase/cds-utils": "^2.3.5",
|
|
44
|
-
"@coinbase/cds-web": "^8.
|
|
44
|
+
"@coinbase/cds-web": "^8.49.0",
|
|
45
|
+
"framer-motion": "^10.18.0",
|
|
45
46
|
"react": "^18.3.1",
|
|
46
47
|
"react-dom": "^18.3.1"
|
|
47
48
|
},
|
|
@@ -58,12 +59,13 @@
|
|
|
58
59
|
"@babel/preset-env": "^7.28.0",
|
|
59
60
|
"@babel/preset-react": "^7.27.1",
|
|
60
61
|
"@babel/preset-typescript": "^7.27.1",
|
|
61
|
-
"@coinbase/cds-common": "^8.
|
|
62
|
+
"@coinbase/cds-common": "^8.49.0",
|
|
62
63
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
63
64
|
"@coinbase/cds-utils": "^2.3.5",
|
|
64
|
-
"@coinbase/cds-web": "^8.
|
|
65
|
+
"@coinbase/cds-web": "^8.49.0",
|
|
65
66
|
"@linaria/core": "^3.0.0-beta.22",
|
|
66
67
|
"@types/react": "^18.3.12",
|
|
67
|
-
"@types/react-dom": "^18.3.1"
|
|
68
|
+
"@types/react-dom": "^18.3.1",
|
|
69
|
+
"framer-motion": "^10.18.0"
|
|
68
70
|
}
|
|
69
71
|
}
|