@coinbase/cds-mobile-visualization 3.4.0 → 3.6.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 +18 -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/DefaultBar.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/DefaultBar.js +17 -3
- 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/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,24 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 3.6.1 (4/16/2026 PST)
|
|
12
|
+
|
|
13
|
+
#### 🐞 Fixes
|
|
14
|
+
|
|
15
|
+
- Fix: stabilize chart path transitions. [[#618](https://github.com/coinbase/cds/pull/618)]
|
|
16
|
+
|
|
17
|
+
## 3.6.0 (4/13/2026 PST)
|
|
18
|
+
|
|
19
|
+
#### 🚀 Updates
|
|
20
|
+
|
|
21
|
+
- Add PercentageBarChart component. [[#550](https://github.com/coinbase/cds/pull/550)]
|
|
22
|
+
|
|
23
|
+
## 3.5.0 (4/13/2026 PST)
|
|
24
|
+
|
|
25
|
+
#### 🚀 Updates
|
|
26
|
+
|
|
27
|
+
- Feat: add enter opacity transition to bars. [[#612](https://github.com/coinbase/cds/pull/612)]
|
|
28
|
+
|
|
11
29
|
## 3.4.0 (4/1/2026 PST)
|
|
12
30
|
|
|
13
31
|
#### 🐞 Fixes
|
package/dts/chart/Path.d.ts
CHANGED
|
@@ -60,6 +60,7 @@ export type PathProps = PathBaseProps &
|
|
|
60
60
|
*
|
|
61
61
|
* @default transitions = {{
|
|
62
62
|
* enter: { type: 'timing', duration: 500 },
|
|
63
|
+
* enterOpacity: undefined,
|
|
63
64
|
* update: { type: 'spring', stiffness: 900, damping: 120 }
|
|
64
65
|
* }}
|
|
65
66
|
*
|
|
@@ -77,6 +78,12 @@ export type PathProps = PathBaseProps &
|
|
|
77
78
|
* Set to `null` to disable.
|
|
78
79
|
*/
|
|
79
80
|
enter?: Transition | null;
|
|
81
|
+
/**
|
|
82
|
+
* Transition for the initial enter opacity animation.
|
|
83
|
+
* When provided, path opacity animates from 0 to 1.
|
|
84
|
+
* Set to `null` to disable.
|
|
85
|
+
*/
|
|
86
|
+
enterOpacity?: Transition | null;
|
|
80
87
|
/**
|
|
81
88
|
* Transition for subsequent data update animations.
|
|
82
89
|
* Set to `null` to disable.
|
package/dts/chart/Path.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Path.d.ts","sourceRoot":"","sources":["../../src/chart/Path.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,SAAS,IAAI,aAAa,EAGhC,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAI5B;;GAEG;AACH,eAAO,MAAM,2BAA2B,MAAM,CAAC;AAE/C,MAAM,MAAM,aAAa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AC;CACtC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,aAAa,GACnC,IAAI,CACF,aAAa,EACX,WAAW,GACX,WAAW,GACX,UAAU,GACV,QAAQ,GACR,YAAY,GACZ,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,aAAa,GACb,aAAa,GACb,OAAO,GACP,WAAW,CACd,GAAG;IACF;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE;QACZ;;;WAGG;QACH,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B;;;;WAIG;QACH,YAAY,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;QACjC;;;WAGG;QACH,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;KAC5B,CAAC;IACF;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;OAEG;IACH,CAAC,CAAC,EAAE,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACrC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,IAAI,CAAC;CACjB,CAAC;AAqEJ,eAAO,MAAM,IAAI,iDAwNf,CAAC"}
|
package/dts/chart/bar/Bar.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export type BarProps = BarBaseProps & {
|
|
|
39
39
|
*
|
|
40
40
|
* @default transitions = {{
|
|
41
41
|
* enter: { type: 'spring', stiffness: 900, damping: 120, staggerDelay: 250 },
|
|
42
|
+
* enterOpacity: { type: 'timing', duration: 200 },
|
|
42
43
|
* update: { type: 'spring', stiffness: 900, damping: 120 }
|
|
43
44
|
* }}
|
|
44
45
|
*
|
|
@@ -56,6 +57,13 @@ export type BarProps = BarBaseProps & {
|
|
|
56
57
|
* Set to `null` to disable.
|
|
57
58
|
*/
|
|
58
59
|
enter?: BarTransition | null;
|
|
60
|
+
/**
|
|
61
|
+
* Transition for the initial enter opacity animation.
|
|
62
|
+
* Uses a default subtle fade when undefined (unless `enter` is disabled).
|
|
63
|
+
* @note falls back to `enter` timing offsets (`delay` and `staggerDelay`) when not provided.
|
|
64
|
+
* Set to `null` to disable enter opacity animation. Automatically set to null if enter transition is disabled.
|
|
65
|
+
*/
|
|
66
|
+
enterOpacity?: BarTransition | null;
|
|
59
67
|
/**
|
|
60
68
|
* Transition for subsequent data update animations.
|
|
61
69
|
* Set to `null` to disable.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bar.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/Bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAIjD,OAAO,EAAE,KAAK,aAAa,EAAc,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3E,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACzC,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACzC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC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AC,EAAE,YAAY,CAAC;IAC5B,uFAAuF;IACvF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG;IACpC;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE;QACZ;;;WAGG;QACH,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;QAC7B;;;;;WAKG;QACH,YAAY,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;QACpC;;;WAGG;QACH,MAAM,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;KAC/B,CAAC;IACF;;;;OAIG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG;IAC/D;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,GAAG,sCA2Df,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultBar.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/DefaultBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DefaultBar.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/DefaultBar.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,UAAU,yDAgItB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { View } from 'react-native';
|
|
2
|
+
import type { BarChartBaseProps, BarChartProps } from './BarChart';
|
|
3
|
+
import type { BarSeries } from './BarStack';
|
|
4
|
+
/** Extended series type that supports single data values. */
|
|
5
|
+
export type PercentageBarSeries = Omit<BarSeries, 'data' | 'stackId' | 'xAxisId' | 'yAxisId'> & {
|
|
6
|
+
/**
|
|
7
|
+
* Data for this series.
|
|
8
|
+
*
|
|
9
|
+
* Can be either:
|
|
10
|
+
* - Single number: `1400`
|
|
11
|
+
* - Array of numbers: `[10, 15, 20]`
|
|
12
|
+
*/
|
|
13
|
+
data: number | Array<number | null>;
|
|
14
|
+
};
|
|
15
|
+
export type PercentageBarChartBaseProps = Omit<
|
|
16
|
+
BarChartBaseProps,
|
|
17
|
+
| 'series'
|
|
18
|
+
| 'stacked'
|
|
19
|
+
| 'layout'
|
|
20
|
+
| 'roundBaseline'
|
|
21
|
+
| 'inset'
|
|
22
|
+
| 'enableScrubbing'
|
|
23
|
+
| 'onScrubberPositionChange'
|
|
24
|
+
> & {
|
|
25
|
+
/**
|
|
26
|
+
* Configuration objects that define how to visualize the data.
|
|
27
|
+
* Each series contains its own data.
|
|
28
|
+
*/
|
|
29
|
+
series?: PercentageBarSeries[];
|
|
30
|
+
/**
|
|
31
|
+
* Chart layout - describes the direction bars/areas grow.
|
|
32
|
+
* - 'vertical': Bars grow vertically. X is category axis, Y is value axis.
|
|
33
|
+
* - 'horizontal' (default): Bars grow horizontally. Y is category axis, X is value axis.
|
|
34
|
+
* @default 'horizontal'
|
|
35
|
+
*/
|
|
36
|
+
layout?: BarChartBaseProps['layout'];
|
|
37
|
+
/**
|
|
38
|
+
* Whether to round the baseline of a bar (where the value is 0).
|
|
39
|
+
* @default true
|
|
40
|
+
*/
|
|
41
|
+
roundBaseline?: BarChartBaseProps['roundBaseline'];
|
|
42
|
+
/**
|
|
43
|
+
* Inset around the entire chart (outside the axes).
|
|
44
|
+
* @default 0
|
|
45
|
+
*/
|
|
46
|
+
inset?: BarChartBaseProps['inset'];
|
|
47
|
+
};
|
|
48
|
+
export type PercentageBarChartProps = PercentageBarChartBaseProps &
|
|
49
|
+
Omit<
|
|
50
|
+
BarChartProps,
|
|
51
|
+
| 'series'
|
|
52
|
+
| 'stacked'
|
|
53
|
+
| 'layout'
|
|
54
|
+
| 'roundBaseline'
|
|
55
|
+
| 'inset'
|
|
56
|
+
| 'enableScrubbing'
|
|
57
|
+
| 'onScrubberPositionChange'
|
|
58
|
+
>;
|
|
59
|
+
export declare const PercentageBarChart: import('react').MemoExoticComponent<
|
|
60
|
+
import('react').ForwardRefExoticComponent<
|
|
61
|
+
Omit<
|
|
62
|
+
BarChartBaseProps,
|
|
63
|
+
| 'inset'
|
|
64
|
+
| 'layout'
|
|
65
|
+
| 'series'
|
|
66
|
+
| 'roundBaseline'
|
|
67
|
+
| 'enableScrubbing'
|
|
68
|
+
| 'onScrubberPositionChange'
|
|
69
|
+
| 'stacked'
|
|
70
|
+
> & {
|
|
71
|
+
/**
|
|
72
|
+
* Configuration objects that define how to visualize the data.
|
|
73
|
+
* Each series contains its own data.
|
|
74
|
+
*/
|
|
75
|
+
series?: PercentageBarSeries[];
|
|
76
|
+
/**
|
|
77
|
+
* Chart layout - describes the direction bars/areas grow.
|
|
78
|
+
* - 'vertical': Bars grow vertically. X is category axis, Y is value axis.
|
|
79
|
+
* - 'horizontal' (default): Bars grow horizontally. Y is category axis, X is value axis.
|
|
80
|
+
* @default 'horizontal'
|
|
81
|
+
*/
|
|
82
|
+
layout?: BarChartBaseProps['layout'];
|
|
83
|
+
/**
|
|
84
|
+
* Whether to round the baseline of a bar (where the value is 0).
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
roundBaseline?: BarChartBaseProps['roundBaseline'];
|
|
88
|
+
/**
|
|
89
|
+
* Inset around the entire chart (outside the axes).
|
|
90
|
+
* @default 0
|
|
91
|
+
*/
|
|
92
|
+
inset?: BarChartBaseProps['inset'];
|
|
93
|
+
} & Omit<
|
|
94
|
+
BarChartProps,
|
|
95
|
+
| 'inset'
|
|
96
|
+
| 'layout'
|
|
97
|
+
| 'series'
|
|
98
|
+
| 'roundBaseline'
|
|
99
|
+
| 'enableScrubbing'
|
|
100
|
+
| 'onScrubberPositionChange'
|
|
101
|
+
| 'stacked'
|
|
102
|
+
> &
|
|
103
|
+
import('react').RefAttributes<View>
|
|
104
|
+
>
|
|
105
|
+
>;
|
|
106
|
+
//# sourceMappingURL=PercentageBarChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PercentageBarChart.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/PercentageBarChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,6DAA6D;AAC7D,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC,GAAG;IAC9F;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAC5C,iBAAiB,EACf,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,eAAe,GACf,OAAO,GACP,iBAAiB,GACjB,0BAA0B,CAC7B,GAAG;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC/B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACrC;;;OAGG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC,eAAe,CAAC,CAAC;IACnD;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;CACpC,CAAC;AAgBF,MAAM,MAAM,uBAAuB,GAAG,2BAA2B,GAC/D,IAAI,CACF,aAAa,EACX,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,eAAe,GACf,OAAO,GACP,iBAAiB,GACjB,0BAA0B,CAC7B,CAAC;AAEJ,eAAO,MAAM,kBAAkB;IAlD7B;;;OAGG;aACM,mBAAmB,EAAE;IAC9B;;;;;OAKG;aACM,iBAAiB,CAAC,QAAQ,CAAC;IACpC;;;OAGG;oBACa,iBAAiB,CAAC,eAAe,CAAC;IAClD;;;OAGG;YACK,iBAAiB,CAAC,OAAO,CAAC;6KAoGnC,CAAC"}
|
package/dts/chart/bar/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"}
|
package/dts/chart/utils/bar.d.ts
CHANGED
|
@@ -56,6 +56,11 @@ export declare const withStaggerDelayTransition: (
|
|
|
56
56
|
* `{ type: 'spring', stiffness: 900, damping: 120, staggerDelay: 250 }`
|
|
57
57
|
*/
|
|
58
58
|
export declare const defaultBarEnterTransition: BarTransition;
|
|
59
|
+
/**
|
|
60
|
+
* Default bar enter opacity transition.
|
|
61
|
+
* `{ type: 'timing', duration: 200 }`
|
|
62
|
+
*/
|
|
63
|
+
export declare const defaultBarEnterOpacityTransition: BarTransition;
|
|
59
64
|
/**
|
|
60
65
|
* Calculates the size adjustment needed for bars when accounting for gaps between them.
|
|
61
66
|
* This function helps determine how much to reduce each bar's width to accommodate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/bar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAElE;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG;IACvC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,oBAAoB,EAC5B,GAAG,MAAM,EACT,GAAG,MAAM,EACT,aAAa,IAAI,KAChB,MAKF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACrC,YAAY,aAAa,GAAG,IAAI,EAChC,oBAAoB,MAAM,KACzB,UAAU,GAAG,IAQf,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAGvC,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9E;AAED,KAAK,UAAU,GA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AE,YAAY,UAAU,GAAG,IAAI,KAAG,MA4BpF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,iBAAiB,GAAI,wDAK/B;IACD;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE;QACZ;;;;WAIG;QACH,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;QAC1B;;;WAGG;QACH,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;KAC5B,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,KAAG,WAAW,CAAC,MAAM,CAsFrB,CAAC"}
|
package/esm/chart/Path.js
CHANGED
|
@@ -2,7 +2,7 @@ const _excluded = ["d", "initialPath", "fill", "fillOpacity", "stroke", "strokeO
|
|
|
2
2
|
_excluded2 = ["animate", "clipRect", "clipPath", "clipOffset", "d", "initialPath", "fill", "fillOpacity", "stroke", "strokeOpacity", "strokeWidth", "strokeCap", "strokeJoin", "children", "transitions", "transition"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
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; }
|
|
5
|
-
import { memo, useEffect, useMemo } from 'react';
|
|
5
|
+
import { memo, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
import { useDerivedValue, useSharedValue } from 'react-native-reanimated';
|
|
7
7
|
import { Group, Path as SkiaPath, Skia, usePathInterpolation } from '@shopify/react-native-skia';
|
|
8
8
|
import { defaultPathEnterTransition } from './utils/path';
|
|
@@ -92,19 +92,46 @@ export const Path = /*#__PURE__*/memo(props => {
|
|
|
92
92
|
const isReady = !!context.getXScale();
|
|
93
93
|
const enterTransition = useMemo(() => getTransition(transitions == null ? void 0 : transitions.enter, animate, defaultPathEnterTransition), [animate, transitions == null ? void 0 : transitions.enter]);
|
|
94
94
|
const updateTransition = useMemo(() => getTransition((transitions == null ? void 0 : transitions.update) !== undefined ? transitions.update : transition, animate, defaultTransition), [animate, transitions == null ? void 0 : transitions.update, transition]);
|
|
95
|
-
const
|
|
95
|
+
const enterOpacityTransition = useMemo(() => {
|
|
96
|
+
if (!animate) return null;
|
|
97
|
+
return transitions == null ? void 0 : transitions.enterOpacity;
|
|
98
|
+
}, [animate, transitions == null ? void 0 : transitions.enterOpacity]);
|
|
99
|
+
const animateEnterOpacity = Boolean(enterOpacityTransition);
|
|
100
|
+
const enterOpacity = useSharedValue(animateEnterOpacity ? 0 : 1);
|
|
101
|
+
const hasAnimatedEnterOpacity = useRef(false);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (hasAnimatedEnterOpacity.current) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (!animateEnterOpacity) {
|
|
107
|
+
hasAnimatedEnterOpacity.current = true;
|
|
108
|
+
enterOpacity.value = 1;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!isReady) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (enterOpacityTransition === undefined || enterOpacityTransition === null) {
|
|
115
|
+
enterOpacity.value = 1;
|
|
116
|
+
hasAnimatedEnterOpacity.current = true;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
hasAnimatedEnterOpacity.current = true;
|
|
120
|
+
enterOpacity.value = buildTransition(1, enterOpacityTransition);
|
|
121
|
+
}, [animateEnterOpacity, isReady, enterOpacityTransition, enterOpacity]);
|
|
122
|
+
const animateClip = animate && enterTransition !== null;
|
|
96
123
|
|
|
97
124
|
// The clip offset provides extra padding to prevent path from being cut off
|
|
98
125
|
// Area charts typically use offset=0 for exact clipping, while lines use offset=2 for breathing room
|
|
99
126
|
const totalOffset = clipOffset * 2; // Applied on both sides
|
|
100
127
|
|
|
101
128
|
// Animation progress for clip path reveal
|
|
102
|
-
const clipProgress = useSharedValue(
|
|
129
|
+
const clipProgress = useSharedValue(animateClip ? 0 : 1);
|
|
103
130
|
useEffect(() => {
|
|
104
|
-
if (
|
|
131
|
+
if (animateClip && isReady) {
|
|
105
132
|
clipProgress.value = buildTransition(1, enterTransition);
|
|
106
133
|
}
|
|
107
|
-
}, [
|
|
134
|
+
}, [animateClip, isReady, clipProgress, enterTransition]);
|
|
108
135
|
|
|
109
136
|
// Create initial and target clip paths for animation
|
|
110
137
|
const {
|
|
@@ -143,7 +170,7 @@ export const Path = /*#__PURE__*/memo(props => {
|
|
|
143
170
|
}, [rect, clipOffset, totalOffset, context.layout]);
|
|
144
171
|
|
|
145
172
|
// Use usePathInterpolation for animated clip path
|
|
146
|
-
const animatedClipPath = usePathInterpolation(clipProgress, [0, 1],
|
|
173
|
+
const animatedClipPath = usePathInterpolation(clipProgress, [0, 1], animateClip && initialClipPath && targetClipPath ? [initialClipPath, targetClipPath] : targetClipPath ? [targetClipPath, targetClipPath] : [Skia.Path.Make(), Skia.Path.Make()]);
|
|
147
174
|
|
|
148
175
|
// Resolve the final clip path:
|
|
149
176
|
// 1. If clipPath prop was explicitly provided, use it (even if null = no clipping)
|
|
@@ -156,13 +183,13 @@ export const Path = /*#__PURE__*/memo(props => {
|
|
|
156
183
|
}
|
|
157
184
|
|
|
158
185
|
// If not animating or paths are null, return target clip path
|
|
159
|
-
if (!
|
|
186
|
+
if (!animateClip || !targetClipPath) {
|
|
160
187
|
return targetClipPath;
|
|
161
188
|
}
|
|
162
189
|
|
|
163
190
|
// Return undefined here since we'll use animatedClipPath directly
|
|
164
191
|
return undefined;
|
|
165
|
-
}, [clipPathProp,
|
|
192
|
+
}, [clipPathProp, animateClip, targetClipPath]);
|
|
166
193
|
|
|
167
194
|
// Convert SVG path string to SkPath for static rendering
|
|
168
195
|
const staticPath = useDerivedValue(() => {
|
|
@@ -204,20 +231,25 @@ export const Path = /*#__PURE__*/memo(props => {
|
|
|
204
231
|
strokeWidth: strokeWidth,
|
|
205
232
|
transitions: {
|
|
206
233
|
enter: enterTransition,
|
|
234
|
+
enterOpacity: enterOpacityTransition,
|
|
207
235
|
update: updateTransition
|
|
208
236
|
},
|
|
209
237
|
children: children
|
|
210
238
|
});
|
|
211
239
|
|
|
212
240
|
// Determine which clip path to use
|
|
213
|
-
const finalClipPath =
|
|
241
|
+
const finalClipPath = animateClip && resolvedClipPath === undefined ? animatedClipPath : resolvedClipPath;
|
|
214
242
|
|
|
215
243
|
// If finalClipPath is null, render without clipping
|
|
216
244
|
if (finalClipPath === null) {
|
|
217
|
-
return
|
|
245
|
+
return /*#__PURE__*/_jsx(Group, {
|
|
246
|
+
opacity: animateEnterOpacity ? enterOpacity : undefined,
|
|
247
|
+
children: content
|
|
248
|
+
});
|
|
218
249
|
}
|
|
219
250
|
return /*#__PURE__*/_jsx(Group, {
|
|
220
251
|
clip: finalClipPath,
|
|
252
|
+
opacity: animateEnterOpacity ? enterOpacity : undefined,
|
|
221
253
|
children: content
|
|
222
254
|
});
|
|
223
255
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
1
2
|
import { memo, useMemo } from 'react';
|
|
2
3
|
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
3
4
|
import { useCartesianChartContext } from '../ChartProvider';
|
|
4
5
|
import { Path } from '../Path';
|
|
5
|
-
import { defaultBarEnterTransition, getBarPath, withStaggerDelayTransition } from '../utils';
|
|
6
|
+
import { defaultBarEnterOpacityTransition, defaultBarEnterTransition, getBarPath, withStaggerDelayTransition } from '../utils';
|
|
6
7
|
import { getNormalizedStagger } from '../utils/bar';
|
|
7
8
|
import { defaultTransition, getTransition } from '../utils/transition';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -36,7 +37,19 @@ export const DefaultBar = /*#__PURE__*/memo(_ref => {
|
|
|
36
37
|
const theme = useTheme();
|
|
37
38
|
const defaultFill = fill || theme.color.fgPrimary;
|
|
38
39
|
const normalizedStagger = useMemo(() => getNormalizedStagger(layout, x, y, drawingArea), [layout, x, y, drawingArea]);
|
|
39
|
-
const enterTransition = useMemo(() =>
|
|
40
|
+
const enterTransition = useMemo(() => getTransition(transitions == null ? void 0 : transitions.enter, animate, defaultBarEnterTransition), [transitions == null ? void 0 : transitions.enter, animate]);
|
|
41
|
+
const enterTransitionWithStagger = useMemo(() => withStaggerDelayTransition(enterTransition, normalizedStagger), [enterTransition, normalizedStagger]);
|
|
42
|
+
const enterOpacityTransition = useMemo(() => {
|
|
43
|
+
var _enterOpacityTransiti, _enterOpacityTransiti2;
|
|
44
|
+
if ((transitions == null ? void 0 : transitions.enterOpacity) === undefined && enterTransition === null) return null;
|
|
45
|
+
const enterOpacityTransition = getTransition(transitions == null ? void 0 : transitions.enterOpacity, animate, defaultBarEnterOpacityTransition);
|
|
46
|
+
if (!enterOpacityTransition) return null;
|
|
47
|
+
return _extends({}, enterOpacityTransition, {
|
|
48
|
+
delay: (_enterOpacityTransiti = enterOpacityTransition.delay) != null ? _enterOpacityTransiti : enterTransition == null ? void 0 : enterTransition.delay,
|
|
49
|
+
staggerDelay: (_enterOpacityTransiti2 = enterOpacityTransition.staggerDelay) != null ? _enterOpacityTransiti2 : enterTransition == null ? void 0 : enterTransition.staggerDelay
|
|
50
|
+
});
|
|
51
|
+
}, [transitions == null ? void 0 : transitions.enterOpacity, animate, enterTransition]);
|
|
52
|
+
const enterOpacityTransitionWithStagger = useMemo(() => withStaggerDelayTransition(enterOpacityTransition, normalizedStagger), [enterOpacityTransition, normalizedStagger]);
|
|
40
53
|
const updateTransition = useMemo(() => withStaggerDelayTransition(getTransition((transitions == null ? void 0 : transitions.update) !== undefined ? transitions.update : transition, animate, defaultTransition), normalizedStagger), [transitions == null ? void 0 : transitions.update, transition, animate, normalizedStagger]);
|
|
41
54
|
const initialPath = useMemo(() => {
|
|
42
55
|
if (!animate) return;
|
|
@@ -58,7 +71,8 @@ export const DefaultBar = /*#__PURE__*/memo(_ref => {
|
|
|
58
71
|
stroke: stroke,
|
|
59
72
|
strokeWidth: strokeWidth,
|
|
60
73
|
transitions: {
|
|
61
|
-
enter:
|
|
74
|
+
enter: enterTransitionWithStagger,
|
|
75
|
+
enterOpacity: enterOpacityTransitionWithStagger,
|
|
62
76
|
update: updateTransition
|
|
63
77
|
}
|
|
64
78
|
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
const _excluded = ["series", "layout", "roundBaseline", "inset", "transitions", "xAxis", "yAxis", "testID", "children"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
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; }
|
|
4
|
+
import { forwardRef, memo, useMemo } from 'react';
|
|
5
|
+
import { BarChart } from './BarChart';
|
|
6
|
+
|
|
7
|
+
/** Extended series type that supports single data values. */
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
/**
|
|
10
|
+
* Returns the value for a group index from numeric shorthand or per-group series data.
|
|
11
|
+
* @param data - A single number (group `0` only) or an array of values per group.
|
|
12
|
+
* @param groupIndex - The group index to read.
|
|
13
|
+
* @returns The clamped value for that group, or `null` when the value is `null`, undefined, or out of range.
|
|
14
|
+
*/
|
|
15
|
+
const unwrapSeriesDataValue = (data, groupIndex) => {
|
|
16
|
+
const raw = typeof data === 'number' ? groupIndex === 0 ? data : null : data[groupIndex];
|
|
17
|
+
return raw != null ? Math.max(0, raw) : null;
|
|
18
|
+
};
|
|
19
|
+
export const PercentageBarChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
20
|
+
let {
|
|
21
|
+
series,
|
|
22
|
+
layout = 'horizontal',
|
|
23
|
+
roundBaseline = true,
|
|
24
|
+
inset = 0,
|
|
25
|
+
transitions,
|
|
26
|
+
xAxis,
|
|
27
|
+
yAxis,
|
|
28
|
+
testID,
|
|
29
|
+
children
|
|
30
|
+
} = _ref,
|
|
31
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
|
+
const barSeries = useMemo(() => {
|
|
33
|
+
var _series$map;
|
|
34
|
+
const groupCount = Math.max(0, ...((_series$map = series == null ? void 0 : series.map(_ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
data
|
|
37
|
+
} = _ref2;
|
|
38
|
+
return typeof data === 'number' ? 1 : data.length;
|
|
39
|
+
})) != null ? _series$map : []));
|
|
40
|
+
const totals = Array.from({
|
|
41
|
+
length: groupCount
|
|
42
|
+
}, (_, i) => {
|
|
43
|
+
var _series$reduce;
|
|
44
|
+
return (_series$reduce = series == null ? void 0 : series.reduce((sum, _ref3) => {
|
|
45
|
+
var _unwrapSeriesDataValu;
|
|
46
|
+
let {
|
|
47
|
+
data
|
|
48
|
+
} = _ref3;
|
|
49
|
+
return sum + ((_unwrapSeriesDataValu = unwrapSeriesDataValue(data, i)) != null ? _unwrapSeriesDataValu : 0);
|
|
50
|
+
}, 0)) != null ? _series$reduce : 0;
|
|
51
|
+
});
|
|
52
|
+
return series == null ? void 0 : series.map(s => _extends({}, s, {
|
|
53
|
+
data: Array.from({
|
|
54
|
+
length: groupCount
|
|
55
|
+
}, (_, i) => {
|
|
56
|
+
const val = unwrapSeriesDataValue(s.data, i);
|
|
57
|
+
return val != null && totals[i] > 0 ? val / totals[i] * 100 : null;
|
|
58
|
+
})
|
|
59
|
+
}));
|
|
60
|
+
}, [series]);
|
|
61
|
+
const isHorizontalLayout = layout === 'horizontal';
|
|
62
|
+
const xAxisConfig = useMemo(() => {
|
|
63
|
+
return isHorizontalLayout ? _extends({
|
|
64
|
+
domain: {
|
|
65
|
+
min: 0,
|
|
66
|
+
max: 100
|
|
67
|
+
},
|
|
68
|
+
domainLimit: 'strict'
|
|
69
|
+
}, xAxis) : _extends({
|
|
70
|
+
categoryPadding: 0
|
|
71
|
+
}, xAxis);
|
|
72
|
+
}, [isHorizontalLayout, xAxis]);
|
|
73
|
+
const yAxisConfig = useMemo(() => {
|
|
74
|
+
return isHorizontalLayout ? _extends({
|
|
75
|
+
categoryPadding: 0
|
|
76
|
+
}, yAxis) : _extends({
|
|
77
|
+
domain: {
|
|
78
|
+
min: 0,
|
|
79
|
+
max: 100
|
|
80
|
+
},
|
|
81
|
+
domainLimit: 'strict'
|
|
82
|
+
}, yAxis);
|
|
83
|
+
}, [isHorizontalLayout, yAxis]);
|
|
84
|
+
return /*#__PURE__*/_jsx(BarChart, _extends({
|
|
85
|
+
ref: ref,
|
|
86
|
+
stacked: true,
|
|
87
|
+
inset: inset,
|
|
88
|
+
layout: layout,
|
|
89
|
+
roundBaseline: roundBaseline,
|
|
90
|
+
series: barSeries,
|
|
91
|
+
testID: testID,
|
|
92
|
+
transitions: transitions,
|
|
93
|
+
xAxis: xAxisConfig,
|
|
94
|
+
yAxis: yAxisConfig
|
|
95
|
+
}, props, {
|
|
96
|
+
children: children
|
|
97
|
+
}));
|
|
98
|
+
}));
|
|
99
|
+
PercentageBarChart.displayName = 'PercentageBarChart';
|
|
@@ -1132,13 +1132,6 @@ function BuyVsSellExample() {
|
|
|
1132
1132
|
legendShape: 'circle'
|
|
1133
1133
|
}],
|
|
1134
1134
|
stackGap: stackGap,
|
|
1135
|
-
transitions: {
|
|
1136
|
-
enter: {
|
|
1137
|
-
type: 'timing',
|
|
1138
|
-
duration: 5000,
|
|
1139
|
-
delay: 2000
|
|
1140
|
-
}
|
|
1141
|
-
},
|
|
1142
1135
|
xAxis: _extends({
|
|
1143
1136
|
domainLimit: 'strict'
|
|
1144
1137
|
}, xAxis),
|