@coinbase/cds-mobile-visualization 3.4.0 → 3.6.2
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 +24 -0
- package/dts/chart/Path.d.ts +7 -0
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +8 -0
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
- package/dts/chart/bar/PercentageBarChart.d.ts +106 -0
- package/dts/chart/bar/PercentageBarChart.d.ts.map +1 -0
- package/dts/chart/bar/index.d.ts +1 -0
- package/dts/chart/bar/index.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +5 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/transition.d.ts.map +1 -1
- package/esm/chart/Path.js +42 -10
- package/esm/chart/bar/BarPlot.js +11 -2
- package/esm/chart/bar/DefaultBar.js +17 -3
- package/esm/chart/bar/DefaultBarStack.js +9 -4
- package/esm/chart/bar/PercentageBarChart.js +99 -0
- package/esm/chart/bar/__stories__/BarChart.stories.js +0 -7
- package/esm/chart/bar/__stories__/PercentageBarChart.stories.js +833 -0
- package/esm/chart/bar/index.js +1 -0
- package/esm/chart/utils/bar.js +9 -0
- package/esm/chart/utils/transition.js +12 -4
- package/package.json +5 -5
package/esm/chart/bar/index.js
CHANGED
package/esm/chart/utils/bar.js
CHANGED
|
@@ -63,6 +63,15 @@ export const defaultBarEnterTransition = _extends({}, defaultTransition, {
|
|
|
63
63
|
staggerDelay: 250
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Default bar enter opacity transition.
|
|
68
|
+
* `{ type: 'timing', duration: 200 }`
|
|
69
|
+
*/
|
|
70
|
+
export const defaultBarEnterOpacityTransition = {
|
|
71
|
+
type: 'timing',
|
|
72
|
+
duration: 200
|
|
73
|
+
};
|
|
74
|
+
|
|
66
75
|
/**
|
|
67
76
|
* Calculates the size adjustment needed for bars when accounting for gaps between them.
|
|
68
77
|
* This function helps determine how much to reduce each bar's width to accommodate
|
|
@@ -173,8 +173,12 @@ export const usePathTransition = _ref => {
|
|
|
173
173
|
transitions,
|
|
174
174
|
transition = defaultTransition
|
|
175
175
|
} = _ref;
|
|
176
|
-
const
|
|
177
|
-
|
|
176
|
+
const transitionRef = useRef({
|
|
177
|
+
enter: transitions == null ? void 0 : transitions.enter,
|
|
178
|
+
update: (transitions == null ? void 0 : transitions.update) !== undefined ? transitions.update : transition
|
|
179
|
+
});
|
|
180
|
+
transitionRef.current.enter = transitions == null ? void 0 : transitions.enter;
|
|
181
|
+
transitionRef.current.update = (transitions == null ? void 0 : transitions.update) !== undefined ? transitions.update : transition;
|
|
178
182
|
const targetPathRef = useRef(initialPath != null ? initialPath : currentPath);
|
|
179
183
|
const isFirstAnimation = useRef(!!initialPath);
|
|
180
184
|
const interpolatorRef = useRef(null);
|
|
@@ -193,7 +197,11 @@ export const usePathTransition = _ref => {
|
|
|
193
197
|
fromPath = interpolatorRef.current(p);
|
|
194
198
|
}
|
|
195
199
|
targetPathRef.current = currentPath;
|
|
196
|
-
const
|
|
200
|
+
const {
|
|
201
|
+
enter,
|
|
202
|
+
update
|
|
203
|
+
} = transitionRef.current;
|
|
204
|
+
const activeTransition = isFirstAnimation.current && enter !== undefined ? enter : update;
|
|
197
205
|
isFirstAnimation.current = false;
|
|
198
206
|
if (activeTransition === null) {
|
|
199
207
|
var _Skia$Path$MakeFromSV2;
|
|
@@ -215,7 +223,7 @@ export const usePathTransition = _ref => {
|
|
|
215
223
|
progress.value = 0;
|
|
216
224
|
progress.value = buildTransition(1, activeTransition);
|
|
217
225
|
}
|
|
218
|
-
}, [currentPath,
|
|
226
|
+
}, [currentPath, progress, normalizedStartShared, normalizedEndShared, fallbackPathShared, result]);
|
|
219
227
|
useAnimatedReaction(() => ({
|
|
220
228
|
p: progress.value,
|
|
221
229
|
to: fallbackPathShared.value
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile-visualization",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.2",
|
|
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.
|
|
39
|
+
"@coinbase/cds-common": "^8.66.0",
|
|
40
40
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
41
|
-
"@coinbase/cds-mobile": "^8.
|
|
41
|
+
"@coinbase/cds-mobile": "^8.66.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.
|
|
60
|
+
"@coinbase/cds-common": "^8.66.0",
|
|
61
61
|
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
62
|
-
"@coinbase/cds-mobile": "^8.
|
|
62
|
+
"@coinbase/cds-mobile": "^8.66.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",
|