@coinbase/cds-mobile-visualization 3.4.0-beta.14 → 3.4.0-beta.16

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
+ ## 3.4.0-beta.16 (1/28/2026 PST)
12
+
13
+ #### 🐞 Fixes
14
+
15
+ - Fix every context rendering a second time in CDS Chart for performance. [[#339](https://github.com/avocado-cb/cds/pull/339)] [DEX2-874]
16
+
17
+ ## 3.4.0-beta.15 (1/27/2026 PST)
18
+
19
+ #### 🐞 Fixes
20
+
21
+ - Fix padding on PeriodSelector. [[#330](https://github.com/coinbase/cds/pull/330)]
22
+
11
23
  ## 3.4.0-beta.14 (1/22/2026 PST)
12
24
 
13
25
  #### 🚀 Updates
@@ -1 +1 @@
1
- {"version":3,"file":"ChartContextBridge.d.ts","sourceRoot":"","sources":["../../src/chart/ChartContextBridge.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwE/B;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;IACtF,OAAO,CAAC,eAAe,CAAY;IAEnC,MAAM;CAOP;AA4BD,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG;IACtD,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;CAClD,CAAC;AA8BF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAgB1D"}
1
+ {"version":3,"file":"ChartContextBridge.d.ts","sourceRoot":"","sources":["../../src/chart/ChartContextBridge.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuF/B;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,SAAS,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC;IACtF,OAAO,CAAC,eAAe,CAAY;IAEnC,MAAM;CAOP;AA4BD,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG;IACtD,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;CAClD,CAAC;AAmCF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAE3E;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,kBAAkB,CAgB1D"}
@@ -1,4 +1,7 @@
1
1
  import type { CartesianChartContextValue } from './utils';
2
+ export declare const CartesianChartContext: import('react').Context<
3
+ CartesianChartContextValue | undefined
4
+ >;
2
5
  export declare const useCartesianChartContext: () => CartesianChartContextValue;
3
6
  export declare const CartesianChartProvider: import('react').Provider<
4
7
  CartesianChartContextValue | undefined
@@ -1 +1 @@
1
- {"version":3,"file":"ChartProvider.d.ts","sourceRoot":"","sources":["../../src/chart/ChartProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAI1D,eAAO,MAAM,wBAAwB,QAAO,0BAQ3C,CAAC;AAEF,eAAO,MAAM,sBAAsB,kEAAiC,CAAC"}
1
+ {"version":3,"file":"ChartProvider.d.ts","sourceRoot":"","sources":["../../src/chart/ChartProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAE1D,eAAO,MAAM,qBAAqB,iEAEjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,QAAO,0BAQ3C,CAAC;AAEF,eAAO,MAAM,sBAAsB,kEAAiC,CAAC"}
@@ -6,6 +6,17 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
6
6
  */
7
7
 
8
8
  import * as React from 'react';
9
+ import { ThemeContext } from '@coinbase/cds-mobile/system/ThemeProvider';
10
+ import { ScrubberContext } from './utils/context';
11
+ import { CartesianChartContext } from './ChartProvider';
12
+
13
+ /**
14
+ * Whitelist of contexts that should be bridged to the Skia canvas.
15
+ * Only these contexts will be made available inside the chart's Skia tree.
16
+ * This improves performance by avoiding the overhead of rendering every bridged context.
17
+ */
18
+ import { jsx as _jsx } from "react/jsx-runtime";
19
+ const BRIDGED_CONTEXTS = [ThemeContext, CartesianChartContext, ScrubberContext];
9
20
 
10
21
  /**
11
22
  * Represents a react-internal tree node.
@@ -14,7 +25,7 @@ import * as React from 'react';
14
25
  /**
15
26
  * Represents a tree node selector for traversal.
16
27
  */
17
- import { jsx as _jsx } from "react/jsx-runtime";
28
+
18
29
  /**
19
30
  * Traverses up or down a React tree, return `true` to stop and select a node.
20
31
  */
@@ -104,7 +115,7 @@ function useTreeNode() {
104
115
  return treeNode;
105
116
  }
106
117
  /**
107
- * Returns a map of all contexts and their values.
118
+ * Returns a map of whitelisted contexts and their values.
108
119
  */
109
120
  function useContextMap() {
110
121
  const treeNode = useTreeNode();
@@ -118,7 +129,7 @@ function useContextMap() {
118
129
  // https://github.com/facebook/react/pull/28226
119
130
  const enableRenderableContext = node.type._context === undefined && node.type.Provider === node.type;
120
131
  const context = enableRenderableContext ? node.type : node.type._context;
121
- if (context && context !== TreeNodeContext && !contextMap.has(context)) {
132
+ if (context && context !== TreeNodeContext && BRIDGED_CONTEXTS.includes(context) && !contextMap.has(context)) {
122
133
  // eslint-disable-next-line react-hooks/rules-of-hooks
123
134
  contextMap.set(context, React.useContext(wrapContext(context)));
124
135
  }
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext } from 'react';
2
- const CartesianChartContext = /*#__PURE__*/createContext(undefined);
2
+ export const CartesianChartContext = /*#__PURE__*/createContext(undefined);
3
3
  export const useCartesianChartContext = () => {
4
4
  const context = useContext(CartesianChartContext);
5
5
  if (!context) {
@@ -24,7 +24,8 @@ export const PeriodSelectorActiveIndicator = _ref => {
24
24
  const {
25
25
  width,
26
26
  height,
27
- x
27
+ x,
28
+ y
28
29
  } = activeTabRect;
29
30
 
30
31
  // Get the target background color
@@ -38,6 +39,7 @@ export const PeriodSelectorActiveIndicator = _ref => {
38
39
  // Combined animated value for position, size, and color
39
40
  const newAnimatedValues = {
40
41
  x,
42
+ y,
41
43
  width,
42
44
  backgroundColor: targetColor
43
45
  };
@@ -51,6 +53,8 @@ export const PeriodSelectorActiveIndicator = _ref => {
51
53
  const animatedStyles = useAnimatedStyle(() => ({
52
54
  transform: [{
53
55
  translateX: animatedValues.value.x
56
+ }, {
57
+ translateY: animatedValues.value.y
54
58
  }],
55
59
  width: animatedValues.value.width,
56
60
  backgroundColor: animatedValues.value.backgroundColor
@@ -70,6 +70,27 @@ const MinWidthPeriodSelectorExample = () => {
70
70
  width: "fit-content"
71
71
  });
72
72
  };
73
+ const PaddedPeriodSelectorExample = () => {
74
+ const tabs = [{
75
+ id: '1W',
76
+ label: '1W'
77
+ }, {
78
+ id: '1M',
79
+ label: '1M'
80
+ }, {
81
+ id: 'YTD',
82
+ label: 'YTD'
83
+ }];
84
+ const [activeTab, setActiveTab] = useState(tabs[0]);
85
+ return /*#__PURE__*/_jsx(PeriodSelector, {
86
+ activeTab: activeTab,
87
+ gap: 2,
88
+ onChange: tab => setActiveTab(tab),
89
+ padding: 3,
90
+ tabs: tabs,
91
+ width: "fit-content"
92
+ });
93
+ };
73
94
  const LivePeriodSelectorExample = () => {
74
95
  const tabs = useMemo(() => [{
75
96
  id: '1H',
@@ -317,6 +338,9 @@ export default function All() {
317
338
  }), /*#__PURE__*/_jsx(Example, {
318
339
  title: "Colored Excluding Live",
319
340
  children: /*#__PURE__*/_jsx(ColoredExcludingLivePeriodSelectorExample, {})
341
+ }), /*#__PURE__*/_jsx(Example, {
342
+ title: "With Padding",
343
+ children: /*#__PURE__*/_jsx(PaddedPeriodSelectorExample, {})
320
344
  })]
321
345
  });
322
346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile-visualization",
3
- "version": "3.4.0-beta.14",
3
+ "version": "3.4.0-beta.16",
4
4
  "description": "Coinbase Design System - Mobile Visualization Native",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,9 +36,9 @@
36
36
  "CHANGELOG"
37
37
  ],
38
38
  "peerDependencies": {
39
- "@coinbase/cds-common": "^8.38.6",
39
+ "@coinbase/cds-common": "^8.40.0",
40
40
  "@coinbase/cds-lottie-files": "^3.3.4",
41
- "@coinbase/cds-mobile": "^8.38.6",
41
+ "@coinbase/cds-mobile": "^8.40.0",
42
42
  "@coinbase/cds-utils": "^2.3.5",
43
43
  "@shopify/react-native-skia": "^1.12.4 || ^2.0.0",
44
44
  "react": "^18.3.1",
@@ -57,9 +57,9 @@
57
57
  "@babel/preset-env": "^7.28.0",
58
58
  "@babel/preset-react": "^7.27.1",
59
59
  "@babel/preset-typescript": "^7.27.1",
60
- "@coinbase/cds-common": "^8.38.6",
60
+ "@coinbase/cds-common": "^8.40.0",
61
61
  "@coinbase/cds-lottie-files": "^3.3.4",
62
- "@coinbase/cds-mobile": "^8.38.6",
62
+ "@coinbase/cds-mobile": "^8.40.0",
63
63
  "@coinbase/cds-utils": "^2.3.5",
64
64
  "@shopify/react-native-skia": "1.12.4",
65
65
  "@types/react": "^18.3.12",