@coinbase/cds-mobile-visualization 3.4.0-beta.2 → 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 +122 -0
- package/dts/chart/CartesianChart.d.ts +92 -34
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/ChartContextBridge.d.ts +28 -0
- package/dts/chart/ChartContextBridge.d.ts.map +1 -0
- package/dts/chart/ChartProvider.d.ts +3 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +97 -32
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +6 -13
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +39 -28
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +51 -10
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts +21 -2
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts +19 -13
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts +17 -2
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +86 -118
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
- package/dts/chart/axis/XAxis.d.ts +1 -1
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +2 -2
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/axis/index.d.ts +1 -0
- package/dts/chart/axis/index.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +49 -12
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +40 -19
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +3 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +41 -46
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +2 -0
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts +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/gradient/Gradient.d.ts +25 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -0
- package/dts/chart/gradient/index.d.ts +2 -0
- package/dts/chart/gradient/index.d.ts.map +1 -0
- package/dts/chart/index.d.ts +4 -1
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +5 -0
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts +5 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/chart/legend/Legend.d.ts +168 -0
- package/dts/chart/legend/Legend.d.ts.map +1 -0
- package/dts/chart/legend/index.d.ts +4 -0
- package/dts/chart/legend/index.d.ts.map +1 -0
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts +13 -5
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +61 -27
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +43 -9
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +68 -20
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts +8 -5
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/line/index.d.ts +1 -1
- package/dts/chart/line/index.d.ts.map +1 -1
- package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
- package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
- package/dts/chart/point/Point.d.ts +136 -0
- package/dts/chart/point/Point.d.ts.map +1 -0
- package/dts/chart/point/index.d.ts +3 -0
- package/dts/chart/point/index.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +38 -0
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +11 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/Scrubber.d.ts +230 -42
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +54 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +46 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberProvider.d.ts +6 -3
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- package/dts/chart/scrubber/index.d.ts +3 -0
- package/dts/chart/scrubber/index.d.ts.map +1 -1
- package/dts/chart/text/ChartText.d.ts +151 -77
- package/dts/chart/text/ChartText.d.ts.map +1 -1
- package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
- package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
- package/dts/chart/text/index.d.ts +1 -1
- package/dts/chart/text/index.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +25 -1
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +34 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +52 -7
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +28 -7
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +117 -0
- package/dts/chart/utils/gradient.d.ts.map +1 -0
- package/dts/chart/utils/index.d.ts +3 -0
- package/dts/chart/utils/index.d.ts.map +1 -1
- package/dts/chart/utils/path.d.ts +59 -0
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +71 -7
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +102 -0
- package/dts/chart/utils/scale.d.ts.map +1 -1
- package/dts/chart/utils/scrubber.d.ts +40 -0
- package/dts/chart/utils/scrubber.d.ts.map +1 -0
- package/dts/chart/utils/transition.d.ts +178 -0
- package/dts/chart/utils/transition.d.ts.map +1 -0
- package/esm/chart/CartesianChart.js +199 -75
- package/esm/chart/ChartContextBridge.js +159 -0
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +200 -114
- package/esm/chart/PeriodSelector.js +7 -3
- package/esm/chart/__stories__/CartesianChart.stories.js +307 -134
- package/esm/chart/__stories__/ChartTransitions.stories.js +629 -0
- package/esm/chart/__stories__/PeriodSelector.stories.js +201 -75
- package/esm/chart/area/Area.js +27 -35
- package/esm/chart/area/AreaChart.js +17 -12
- package/esm/chart/area/DottedArea.js +64 -108
- package/esm/chart/area/GradientArea.js +37 -91
- package/esm/chart/area/SolidArea.js +24 -8
- package/esm/chart/area/__stories__/AreaChart.stories.js +1 -1
- package/esm/chart/axis/Axis.js +5 -39
- package/esm/chart/axis/DefaultAxisTickLabel.js +11 -0
- package/esm/chart/axis/XAxis.js +148 -66
- package/esm/chart/axis/YAxis.js +149 -65
- package/esm/chart/axis/__stories__/Axis.stories.js +259 -1
- package/esm/chart/axis/index.js +1 -0
- package/esm/chart/bar/Bar.js +7 -1
- package/esm/chart/bar/BarChart.js +17 -37
- package/esm/chart/bar/BarPlot.js +43 -35
- package/esm/chart/bar/BarStack.js +84 -37
- package/esm/chart/bar/BarStackGroup.js +7 -17
- package/esm/chart/bar/DefaultBar.js +29 -51
- package/esm/chart/bar/DefaultBarStack.js +34 -58
- package/esm/chart/bar/__stories__/BarChart.stories.js +948 -88
- package/esm/chart/gradient/Gradient.js +53 -0
- package/esm/chart/gradient/index.js +1 -0
- package/esm/chart/index.js +4 -1
- package/esm/chart/legend/DefaultLegendEntry.js +42 -0
- package/esm/chart/legend/DefaultLegendShape.js +64 -0
- package/esm/chart/legend/Legend.js +59 -0
- package/esm/chart/legend/__stories__/Legend.stories.js +574 -0
- package/esm/chart/legend/index.js +3 -0
- package/esm/chart/line/DefaultReferenceLineLabel.js +66 -0
- package/esm/chart/line/DottedLine.js +31 -14
- package/esm/chart/line/Line.js +96 -68
- package/esm/chart/line/LineChart.js +21 -14
- package/esm/chart/line/ReferenceLine.js +80 -63
- package/esm/chart/line/SolidLine.js +27 -10
- package/esm/chart/line/__stories__/LineChart.stories.js +1748 -2048
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +177 -28
- package/esm/chart/line/index.js +1 -1
- package/esm/chart/point/DefaultPointLabel.js +39 -0
- package/esm/chart/point/Point.js +186 -0
- package/esm/chart/point/index.js +2 -0
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +180 -0
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +43 -0
- package/esm/chart/scrubber/DefaultScrubberLabel.js +28 -0
- package/esm/chart/scrubber/Scrubber.js +130 -144
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +165 -0
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +208 -0
- package/esm/chart/scrubber/ScrubberProvider.js +46 -54
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +760 -0
- package/esm/chart/scrubber/index.js +3 -1
- package/esm/chart/text/ChartText.js +242 -174
- package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +6 -5
- package/esm/chart/text/index.js +1 -1
- package/esm/chart/utils/axis.js +47 -31
- package/esm/chart/utils/bar.js +43 -0
- package/esm/chart/utils/chart.js +57 -3
- package/esm/chart/utils/gradient.js +305 -0
- package/esm/chart/utils/index.js +3 -0
- package/esm/chart/utils/path.js +84 -8
- package/esm/chart/utils/point.js +171 -17
- package/esm/chart/utils/scale.js +242 -2
- package/esm/chart/utils/scrubber.js +146 -0
- package/esm/chart/utils/transition.js +220 -0
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/__stories__/Sparkline.stories.js +11 -7
- package/esm/sparkline/__stories__/SparklineGradient.stories.js +7 -4
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +51 -26
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +17 -9
- package/package.json +15 -10
- package/dts/chart/Point.d.ts +0 -103
- package/dts/chart/Point.d.ts.map +0 -1
- package/dts/chart/line/GradientLine.d.ts +0 -45
- package/dts/chart/line/GradientLine.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -75
- package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
- package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
- package/esm/chart/Point.js +0 -111
- package/esm/chart/__stories__/Chart.stories.js +0 -79
- package/esm/chart/line/GradientLine.js +0 -62
- package/esm/chart/scrubber/ScrubberBeacon.js +0 -199
package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js
CHANGED
|
@@ -6,7 +6,7 @@ import { IconButton } from '@coinbase/cds-mobile/buttons';
|
|
|
6
6
|
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
7
7
|
import { Icon } from '@coinbase/cds-mobile/icons';
|
|
8
8
|
import { Box, HStack } from '@coinbase/cds-mobile/layout';
|
|
9
|
-
import {
|
|
9
|
+
import { Text } from '@coinbase/cds-mobile/typography';
|
|
10
10
|
import { SparklineInteractive } from '../../sparkline-interactive/SparklineInteractive';
|
|
11
11
|
import { SparklineInteractiveHeader } from '../SparklineInteractiveHeader';
|
|
12
12
|
import { useSparklineInteractiveHeaderStyles } from '../useSparklineInteractiveHeaderStyles';
|
|
@@ -155,7 +155,8 @@ const HeaderLabel = () => {
|
|
|
155
155
|
active: true,
|
|
156
156
|
name: "wallet",
|
|
157
157
|
size: "s"
|
|
158
|
-
}), /*#__PURE__*/_jsx(
|
|
158
|
+
}), /*#__PURE__*/_jsx(Text, {
|
|
159
|
+
font: "title3",
|
|
159
160
|
children: "CustomHeader"
|
|
160
161
|
})]
|
|
161
162
|
});
|
|
@@ -468,7 +469,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
468
469
|
children: [/*#__PURE__*/_jsx(Example, {
|
|
469
470
|
padding: 0,
|
|
470
471
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
471
|
-
children: [/*#__PURE__*/_jsx(
|
|
472
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
473
|
+
font: "title3",
|
|
472
474
|
paddingX: 3,
|
|
473
475
|
paddingY: 3,
|
|
474
476
|
children: "SparklineInteractive Header Example"
|
|
@@ -480,7 +482,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
480
482
|
}), /*#__PURE__*/_jsx(Example, {
|
|
481
483
|
padding: 0,
|
|
482
484
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
483
|
-
children: [/*#__PURE__*/_jsx(
|
|
485
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
486
|
+
font: "title3",
|
|
484
487
|
paddingX: 3,
|
|
485
488
|
paddingY: 3,
|
|
486
489
|
children: "SparklineInteractive Header Trailing"
|
|
@@ -493,7 +496,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
493
496
|
}), /*#__PURE__*/_jsx(Example, {
|
|
494
497
|
padding: 0,
|
|
495
498
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
496
|
-
children: [/*#__PURE__*/_jsx(
|
|
499
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
500
|
+
font: "title3",
|
|
497
501
|
paddingX: 3,
|
|
498
502
|
paddingY: 3,
|
|
499
503
|
children: "SparklineInteractive Header Custom Label"
|
|
@@ -506,7 +510,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
506
510
|
}), /*#__PURE__*/_jsx(Example, {
|
|
507
511
|
padding: 0,
|
|
508
512
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
509
|
-
children: [/*#__PURE__*/_jsx(
|
|
513
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
514
|
+
font: "title3",
|
|
510
515
|
paddingX: 3,
|
|
511
516
|
paddingY: 3,
|
|
512
517
|
children: "SparklineInteractive Header Example with AltHeader"
|
|
@@ -518,7 +523,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
518
523
|
}), /*#__PURE__*/_jsx(Example, {
|
|
519
524
|
padding: 0,
|
|
520
525
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
521
|
-
children: [/*#__PURE__*/_jsx(
|
|
526
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
527
|
+
font: "title3",
|
|
522
528
|
paddingX: 3,
|
|
523
529
|
paddingY: 3,
|
|
524
530
|
children: "SparklineInteractive Header Example with Smaller Period Set"
|
|
@@ -530,7 +536,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
530
536
|
}), /*#__PURE__*/_jsx(Example, {
|
|
531
537
|
padding: 0,
|
|
532
538
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
533
|
-
children: [/*#__PURE__*/_jsx(
|
|
539
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
540
|
+
font: "title3",
|
|
534
541
|
paddingX: 3,
|
|
535
542
|
paddingY: 3,
|
|
536
543
|
children: "SparklineInteractive Header Example with No Period Set"
|
|
@@ -543,7 +550,8 @@ const SparklineInteractiveHeaderScreen = () => {
|
|
|
543
550
|
}), /*#__PURE__*/_jsx(Example, {
|
|
544
551
|
padding: 0,
|
|
545
552
|
children: /*#__PURE__*/_jsxs(Box, {
|
|
546
|
-
children: [/*#__PURE__*/_jsx(
|
|
553
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
554
|
+
font: "title3",
|
|
547
555
|
paddingX: 3,
|
|
548
556
|
paddingY: 3,
|
|
549
557
|
children: "SparklineInteractive Header Custom Title"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinbase/cds-mobile-visualization",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.20",
|
|
4
4
|
"description": "Coinbase Design System - Mobile Visualization Native",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"types": "./dts/index.d.ts",
|
|
17
17
|
"default": "./esm/index.js"
|
|
18
18
|
},
|
|
19
|
+
"./chart": {
|
|
20
|
+
"types": "./dts/chart/index.d.ts",
|
|
21
|
+
"default": "./esm/chart/index.js"
|
|
22
|
+
},
|
|
19
23
|
"./sparkline": {
|
|
20
24
|
"types": "./dts/sparkline/index.d.ts",
|
|
21
25
|
"default": "./esm/sparkline/index.js"
|
|
@@ -32,10 +36,11 @@
|
|
|
32
36
|
"CHANGELOG"
|
|
33
37
|
],
|
|
34
38
|
"peerDependencies": {
|
|
35
|
-
"@coinbase/cds-common": "^8.
|
|
36
|
-
"@coinbase/cds-lottie-files": "^3.3.
|
|
37
|
-
"@coinbase/cds-mobile": "^8.
|
|
38
|
-
"@coinbase/cds-utils": "^2.3.
|
|
39
|
+
"@coinbase/cds-common": "^8.49.0",
|
|
40
|
+
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
41
|
+
"@coinbase/cds-mobile": "^8.49.0",
|
|
42
|
+
"@coinbase/cds-utils": "^2.3.5",
|
|
43
|
+
"@shopify/react-native-skia": "^1.12.4 || ^2.0.0",
|
|
39
44
|
"react": "^18.3.1",
|
|
40
45
|
"react-native": "^0.74.5",
|
|
41
46
|
"react-native-gesture-handler": "^2.16.2",
|
|
@@ -52,11 +57,11 @@
|
|
|
52
57
|
"@babel/preset-env": "^7.28.0",
|
|
53
58
|
"@babel/preset-react": "^7.27.1",
|
|
54
59
|
"@babel/preset-typescript": "^7.27.1",
|
|
55
|
-
"@coinbase/cds-common": "^8.
|
|
56
|
-
"@coinbase/cds-lottie-files": "^3.3.
|
|
57
|
-
"@coinbase/cds-mobile": "^8.
|
|
58
|
-
"@coinbase/cds-utils": "^2.3.
|
|
59
|
-
"@
|
|
60
|
+
"@coinbase/cds-common": "^8.49.0",
|
|
61
|
+
"@coinbase/cds-lottie-files": "^3.3.4",
|
|
62
|
+
"@coinbase/cds-mobile": "^8.49.0",
|
|
63
|
+
"@coinbase/cds-utils": "^2.3.5",
|
|
64
|
+
"@shopify/react-native-skia": "1.12.4",
|
|
60
65
|
"@types/react": "^18.3.12",
|
|
61
66
|
"react-native-gesture-handler": "2.16.2",
|
|
62
67
|
"react-native-reanimated": "3.14.0",
|
package/dts/chart/Point.d.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { SharedProps } from '@coinbase/cds-common/types';
|
|
2
|
-
import type { ChartTextChildren } from './text/ChartText';
|
|
3
|
-
import { type ChartTextProps } from './text';
|
|
4
|
-
/**
|
|
5
|
-
* Parameters passed to renderPoints callback function.
|
|
6
|
-
*/
|
|
7
|
-
export type RenderPointsParams = {
|
|
8
|
-
/**
|
|
9
|
-
* X coordinate in SVG pixel space.
|
|
10
|
-
*/
|
|
11
|
-
x: number;
|
|
12
|
-
/**
|
|
13
|
-
* Y coordinate in SVG pixel space.
|
|
14
|
-
*/
|
|
15
|
-
y: number;
|
|
16
|
-
/**
|
|
17
|
-
* X coordinate in data space (usually same as index).
|
|
18
|
-
*/
|
|
19
|
-
dataX: number;
|
|
20
|
-
/**
|
|
21
|
-
* Y coordinate in data space (same as value).
|
|
22
|
-
*/
|
|
23
|
-
dataY: number;
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Shared configuration for point appearance and behavior.
|
|
27
|
-
* Used by line-associated points rendered via Line/LineChart components.
|
|
28
|
-
*/
|
|
29
|
-
export type PointConfig = {
|
|
30
|
-
/**
|
|
31
|
-
* The fill color of the point.
|
|
32
|
-
*/
|
|
33
|
-
fill?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Optional Y-axis id to specify which axis to plot along.
|
|
36
|
-
* Defaults to the first y-axis
|
|
37
|
-
*/
|
|
38
|
-
yAxisId?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Radius of the point.
|
|
41
|
-
* @default 4
|
|
42
|
-
*/
|
|
43
|
-
radius?: number;
|
|
44
|
-
/**
|
|
45
|
-
* Opacity of the point.
|
|
46
|
-
*/
|
|
47
|
-
opacity?: number;
|
|
48
|
-
/**
|
|
49
|
-
* Handler for when the point is clicked.
|
|
50
|
-
*/
|
|
51
|
-
onPress?: (point: { x: number; y: number; dataX: number; dataY: number }) => void;
|
|
52
|
-
/**
|
|
53
|
-
* Handler for when the scrubber enters this point.
|
|
54
|
-
*/
|
|
55
|
-
onScrubberEnter?: (point: { x: number; y: number }) => void;
|
|
56
|
-
/**
|
|
57
|
-
* Color of the outer stroke around the point.
|
|
58
|
-
* @default theme.color.bg
|
|
59
|
-
*/
|
|
60
|
-
stroke?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Outer stroke width of the point.
|
|
63
|
-
* Set to 0 to remove the stroke.
|
|
64
|
-
* @default 2
|
|
65
|
-
*/
|
|
66
|
-
strokeWidth?: number;
|
|
67
|
-
/**
|
|
68
|
-
* Simple text label to display at the point position.
|
|
69
|
-
* If provided, a ChartText will be automatically rendered.
|
|
70
|
-
*/
|
|
71
|
-
label?: ChartTextChildren;
|
|
72
|
-
/**
|
|
73
|
-
* Configuration for the automatically rendered label.
|
|
74
|
-
* Only used when `label` prop is provided.
|
|
75
|
-
*/
|
|
76
|
-
labelProps?: Omit<ChartTextProps, 'x' | 'y' | 'children'>;
|
|
77
|
-
/**
|
|
78
|
-
* Accessibility label for screen readers to describe the point.
|
|
79
|
-
* If not provided, a default label will be generated using the data coordinates.
|
|
80
|
-
*/
|
|
81
|
-
accessibilityLabel?: string;
|
|
82
|
-
};
|
|
83
|
-
export type PointProps = SharedProps &
|
|
84
|
-
PointConfig & {
|
|
85
|
-
/**
|
|
86
|
-
* X coordinate in data space (not pixel coordinates).
|
|
87
|
-
*/
|
|
88
|
-
dataX: number;
|
|
89
|
-
/**
|
|
90
|
-
* Y coordinate in data space (not pixel coordinates).
|
|
91
|
-
*/
|
|
92
|
-
dataY: number;
|
|
93
|
-
/**
|
|
94
|
-
* Optional pixel coordinates to use instead of calculating from dataX/dataY.
|
|
95
|
-
* Useful for performance when coordinates are already calculated.
|
|
96
|
-
*/
|
|
97
|
-
pixelCoordinates?: {
|
|
98
|
-
x: number;
|
|
99
|
-
y: number;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
export declare const Point: import('react').NamedExoticComponent<PointProps>;
|
|
103
|
-
//# sourceMappingURL=Point.d.ts.map
|
package/dts/chart/Point.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../src/chart/Point.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAGxD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAClF;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,GAAG,GAAG,GAAG,GAAG,UAAU,CAAC,CAAC;IAC1D;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,WAAW,GAClC,WAAW,GAAG;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7C,CAAC;AAEJ,eAAO,MAAM,KAAK,kDAyFjB,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { SharedProps } from '@coinbase/cds-common/types';
|
|
2
|
-
import { type PathProps } from '../Path';
|
|
3
|
-
export type GradientLineProps = SharedProps &
|
|
4
|
-
Omit<PathProps, 'stroke' | 'strokeOpacity' | 'strokeWidth'> & {
|
|
5
|
-
/**
|
|
6
|
-
* The color of the line.
|
|
7
|
-
* @default theme.color.bgLine
|
|
8
|
-
*/
|
|
9
|
-
stroke?: string;
|
|
10
|
-
/**
|
|
11
|
-
* Opacity of the line.
|
|
12
|
-
* @default 1
|
|
13
|
-
*/
|
|
14
|
-
strokeOpacity?: number;
|
|
15
|
-
/**
|
|
16
|
-
* Path stroke width
|
|
17
|
-
* @default 2
|
|
18
|
-
*/
|
|
19
|
-
strokeWidth?: number;
|
|
20
|
-
/**
|
|
21
|
-
* The color of the start of the gradient.
|
|
22
|
-
* @default stroke or theme.color.bgLine
|
|
23
|
-
*/
|
|
24
|
-
startColor?: string;
|
|
25
|
-
/**
|
|
26
|
-
* The color of the end of the gradient.
|
|
27
|
-
* @default stroke or theme.color.bgLine
|
|
28
|
-
*/
|
|
29
|
-
endColor?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Opacity of the start color.
|
|
32
|
-
* @default strokeOpacity
|
|
33
|
-
*/
|
|
34
|
-
startOpacity?: number;
|
|
35
|
-
/**
|
|
36
|
-
* Opacity of the end color.
|
|
37
|
-
* @default strokeOpacity
|
|
38
|
-
*/
|
|
39
|
-
endOpacity?: number;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* A gradient line component which uses path element.
|
|
43
|
-
*/
|
|
44
|
-
export declare const GradientLine: import('react').NamedExoticComponent<GradientLineProps>;
|
|
45
|
-
//# sourceMappingURL=GradientLine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GradientLine.d.ts","sourceRoot":"","sources":["../../../src/chart/line/GradientLine.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAI9D,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,WAAW,GACzC,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,eAAe,GAAG,aAAa,CAAC,GAAG;IAC5D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,YAAY,yDAmDxB,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { SharedProps } from '@coinbase/cds-common/types';
|
|
2
|
-
export type ScrubberBeaconRef = {
|
|
3
|
-
/**
|
|
4
|
-
* Triggers a single pulse animation.
|
|
5
|
-
*/
|
|
6
|
-
pulse: () => void;
|
|
7
|
-
};
|
|
8
|
-
export type ScrubberBeaconProps = SharedProps & {
|
|
9
|
-
/**
|
|
10
|
-
* Optional data X coordinate to position the beacon.
|
|
11
|
-
* If not provided, uses the scrubber position from context.
|
|
12
|
-
*/
|
|
13
|
-
dataX?: number;
|
|
14
|
-
/**
|
|
15
|
-
* Optional data Y coordinate to position the beacon.
|
|
16
|
-
* If not provided, looks up the Y value from series data at scrubber position.
|
|
17
|
-
*/
|
|
18
|
-
dataY?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Filter to only show dot for specific series (used for hover-based positioning).
|
|
21
|
-
*/
|
|
22
|
-
seriesId?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Color of the beacon point.
|
|
25
|
-
* If not provided, uses the series color.
|
|
26
|
-
*/
|
|
27
|
-
color?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Opacity of the beacon.
|
|
30
|
-
* @default 1
|
|
31
|
-
*/
|
|
32
|
-
opacity?: number;
|
|
33
|
-
/**
|
|
34
|
-
* Pulse the scrubber beacon while it is at rest.
|
|
35
|
-
*/
|
|
36
|
-
idlePulse?: boolean;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* The ScrubberBeacon is a special instance of a Point used to mark the scrubber's position on a specific series.
|
|
40
|
-
*/
|
|
41
|
-
export declare const ScrubberBeacon: import('react').MemoExoticComponent<
|
|
42
|
-
import('react').ForwardRefExoticComponent<
|
|
43
|
-
SharedProps & {
|
|
44
|
-
/**
|
|
45
|
-
* Optional data X coordinate to position the beacon.
|
|
46
|
-
* If not provided, uses the scrubber position from context.
|
|
47
|
-
*/
|
|
48
|
-
dataX?: number;
|
|
49
|
-
/**
|
|
50
|
-
* Optional data Y coordinate to position the beacon.
|
|
51
|
-
* If not provided, looks up the Y value from series data at scrubber position.
|
|
52
|
-
*/
|
|
53
|
-
dataY?: number;
|
|
54
|
-
/**
|
|
55
|
-
* Filter to only show dot for specific series (used for hover-based positioning).
|
|
56
|
-
*/
|
|
57
|
-
seriesId?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Color of the beacon point.
|
|
60
|
-
* If not provided, uses the series color.
|
|
61
|
-
*/
|
|
62
|
-
color?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Opacity of the beacon.
|
|
65
|
-
* @default 1
|
|
66
|
-
*/
|
|
67
|
-
opacity?: number;
|
|
68
|
-
/**
|
|
69
|
-
* Pulse the scrubber beacon while it is at rest.
|
|
70
|
-
*/
|
|
71
|
-
idlePulse?: boolean;
|
|
72
|
-
} & import('react').RefAttributes<ScrubberBeaconRef>
|
|
73
|
-
>
|
|
74
|
-
>;
|
|
75
|
-
//# sourceMappingURL=ScrubberBeacon.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScrubberBeacon.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeacon.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAe9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;IAjCzB;;;OAGG;YACK,MAAM;IACd;;;OAGG;YACK,MAAM;IACd;;OAEG;eACQ,MAAM;IACjB;;;OAGG;YACK,MAAM;IACd;;;OAGG;cACO,MAAM;IAChB;;OAEG;gBACS,OAAO;sDAgMpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SmartChartTextGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/text/SmartChartTextGroup.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAiBF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,gEAwL/B,CAAC"}
|
package/esm/chart/Point.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
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); }
|
|
2
|
-
import { memo, useEffect, useMemo } from 'react';
|
|
3
|
-
import { Circle, G } from 'react-native-svg';
|
|
4
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
5
|
-
import { useCartesianChartContext } from './ChartProvider';
|
|
6
|
-
import { ChartText } from './text';
|
|
7
|
-
import { projectPoint, useScrubberContext } from './utils';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Parameters passed to renderPoints callback function.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Shared configuration for point appearance and behavior.
|
|
15
|
-
* Used by line-associated points rendered via Line/LineChart components.
|
|
16
|
-
*/
|
|
17
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
export const Point = /*#__PURE__*/memo(_ref => {
|
|
19
|
-
let {
|
|
20
|
-
dataX,
|
|
21
|
-
dataY,
|
|
22
|
-
yAxisId,
|
|
23
|
-
fill,
|
|
24
|
-
radius = 4,
|
|
25
|
-
opacity,
|
|
26
|
-
onPress,
|
|
27
|
-
onScrubberEnter,
|
|
28
|
-
stroke,
|
|
29
|
-
strokeWidth = 2,
|
|
30
|
-
accessibilityLabel,
|
|
31
|
-
label,
|
|
32
|
-
labelProps,
|
|
33
|
-
pixelCoordinates,
|
|
34
|
-
testID
|
|
35
|
-
} = _ref;
|
|
36
|
-
const theme = useTheme();
|
|
37
|
-
const effectiveStroke = stroke != null ? stroke : theme.color.bg;
|
|
38
|
-
const {
|
|
39
|
-
getXScale,
|
|
40
|
-
getYScale
|
|
41
|
-
} = useCartesianChartContext();
|
|
42
|
-
const {
|
|
43
|
-
scrubberPosition
|
|
44
|
-
} = useScrubberContext();
|
|
45
|
-
const xScale = getXScale();
|
|
46
|
-
const yScale = getYScale(yAxisId);
|
|
47
|
-
|
|
48
|
-
// Scrubber detection: check if this point is highlighted by the scrubber
|
|
49
|
-
const isScrubberHighlighted = scrubberPosition !== undefined && scrubberPosition === dataX;
|
|
50
|
-
|
|
51
|
-
// Use provided pixelCoordinates or calculate from data coordinates
|
|
52
|
-
const pixelCoordinate = useMemo(() => {
|
|
53
|
-
if (pixelCoordinates) {
|
|
54
|
-
return pixelCoordinates;
|
|
55
|
-
}
|
|
56
|
-
if (!xScale || !yScale) {
|
|
57
|
-
return {
|
|
58
|
-
x: 0,
|
|
59
|
-
y: 0
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return projectPoint({
|
|
63
|
-
x: dataX,
|
|
64
|
-
y: dataY,
|
|
65
|
-
xScale,
|
|
66
|
-
yScale
|
|
67
|
-
});
|
|
68
|
-
}, [pixelCoordinates, xScale, yScale, dataX, dataY]);
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
if (isScrubberHighlighted && onScrubberEnter) {
|
|
71
|
-
onScrubberEnter({
|
|
72
|
-
x: pixelCoordinate.x,
|
|
73
|
-
y: pixelCoordinate.y
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}, [isScrubberHighlighted, onScrubberEnter, pixelCoordinate.x, pixelCoordinate.y]);
|
|
77
|
-
if (!xScale || !yScale) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
81
|
-
children: [/*#__PURE__*/_jsx(G, {
|
|
82
|
-
opacity: opacity,
|
|
83
|
-
testID: testID,
|
|
84
|
-
transform: [{
|
|
85
|
-
translateX: pixelCoordinate.x
|
|
86
|
-
}, {
|
|
87
|
-
translateY: pixelCoordinate.y
|
|
88
|
-
}],
|
|
89
|
-
children: /*#__PURE__*/_jsx(Circle, {
|
|
90
|
-
accessibilityLabel: accessibilityLabel,
|
|
91
|
-
cx: 0,
|
|
92
|
-
cy: 0,
|
|
93
|
-
fill: fill != null ? fill : theme.color.fgPrimary,
|
|
94
|
-
onPress: onPress ? event => onPress({
|
|
95
|
-
dataX,
|
|
96
|
-
dataY,
|
|
97
|
-
x: pixelCoordinate.x,
|
|
98
|
-
y: pixelCoordinate.y
|
|
99
|
-
}) : undefined,
|
|
100
|
-
r: radius,
|
|
101
|
-
stroke: effectiveStroke,
|
|
102
|
-
strokeWidth: strokeWidth
|
|
103
|
-
})
|
|
104
|
-
}), label && /*#__PURE__*/_jsx(ChartText, _extends({
|
|
105
|
-
x: pixelCoordinate.x,
|
|
106
|
-
y: pixelCoordinate.y
|
|
107
|
-
}, labelProps, {
|
|
108
|
-
children: label
|
|
109
|
-
}))]
|
|
110
|
-
});
|
|
111
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
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); }
|
|
2
|
-
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
3
|
-
import { CartesianChart, DottedArea, GradientLine, Line, LineChart } from '../';
|
|
4
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
const defaultChartHeight = 250;
|
|
6
|
-
const BasicLineChart = () => {
|
|
7
|
-
const chartData = [65, 78, 45, 88, 92, 73, 69];
|
|
8
|
-
return /*#__PURE__*/_jsx(LineChart, {
|
|
9
|
-
showYAxis: true,
|
|
10
|
-
height: defaultChartHeight,
|
|
11
|
-
series: [{
|
|
12
|
-
id: 'monthly-growth',
|
|
13
|
-
data: chartData,
|
|
14
|
-
label: 'Monthly Growth',
|
|
15
|
-
color: '#2ca02c'
|
|
16
|
-
}],
|
|
17
|
-
yAxis: {
|
|
18
|
-
requestedTickCount: 2,
|
|
19
|
-
tickLabelFormatter: value => "$" + value,
|
|
20
|
-
showGrid: true
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
const LineStyles = () => {
|
|
25
|
-
const topChartData = [15, 28, 32, 44, 46, 36, 40, 45, 48, 38];
|
|
26
|
-
const upperMiddleChartData = [12, 23, 21, 29, 34, 28, 31, 38, 42, 35];
|
|
27
|
-
const lowerMiddleChartData = [8, 15, 14, 25, 20, 18, 22, 28, 24, 30];
|
|
28
|
-
const bottomChartData = [4, 8, 11, 15, 16, 14, 16, 10, 12, 14];
|
|
29
|
-
return /*#__PURE__*/_jsxs(CartesianChart, {
|
|
30
|
-
height: defaultChartHeight,
|
|
31
|
-
series: [{
|
|
32
|
-
id: 'top',
|
|
33
|
-
data: topChartData
|
|
34
|
-
}, {
|
|
35
|
-
id: 'upperMiddle',
|
|
36
|
-
data: upperMiddleChartData,
|
|
37
|
-
color: '#ef4444'
|
|
38
|
-
}, {
|
|
39
|
-
id: 'lowerMiddle',
|
|
40
|
-
data: lowerMiddleChartData,
|
|
41
|
-
color: '#f59e0b'
|
|
42
|
-
}, {
|
|
43
|
-
id: 'bottom',
|
|
44
|
-
data: bottomChartData,
|
|
45
|
-
color: '#800080'
|
|
46
|
-
}],
|
|
47
|
-
children: [/*#__PURE__*/_jsx(Line, {
|
|
48
|
-
seriesId: "top"
|
|
49
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
50
|
-
seriesId: "upperMiddle",
|
|
51
|
-
type: "dotted"
|
|
52
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
53
|
-
LineComponent: props => /*#__PURE__*/_jsx(GradientLine, _extends({}, props, {
|
|
54
|
-
endColor: "#F7931A",
|
|
55
|
-
startColor: "#E3D74D",
|
|
56
|
-
strokeWidth: 4
|
|
57
|
-
})),
|
|
58
|
-
curve: "natural",
|
|
59
|
-
seriesId: "lowerMiddle"
|
|
60
|
-
}), /*#__PURE__*/_jsx(Line, {
|
|
61
|
-
showArea: true,
|
|
62
|
-
AreaComponent: DottedArea,
|
|
63
|
-
curve: "step",
|
|
64
|
-
seriesId: "bottom"
|
|
65
|
-
})]
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
const ChartStories = () => {
|
|
69
|
-
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
70
|
-
children: [/*#__PURE__*/_jsx(Example, {
|
|
71
|
-
title: "Basic Line Chart",
|
|
72
|
-
children: /*#__PURE__*/_jsx(BasicLineChart, {})
|
|
73
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
74
|
-
title: "Line Styles",
|
|
75
|
-
children: /*#__PURE__*/_jsx(LineStyles, {})
|
|
76
|
-
})]
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
export default ChartStories;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
const _excluded = ["fill", "stroke", "startColor", "endColor", "strokeOpacity", "startOpacity", "endOpacity", "strokeLinecap", "strokeLinejoin", "strokeWidth", "animate"];
|
|
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 { memo, useId } from 'react';
|
|
5
|
-
import { Defs, LinearGradient, Stop } from 'react-native-svg';
|
|
6
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
7
|
-
import { useCartesianChartContext } from '../ChartProvider';
|
|
8
|
-
import { Path } from '../Path';
|
|
9
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
10
|
-
/**
|
|
11
|
-
* A gradient line component which uses path element.
|
|
12
|
-
*/
|
|
13
|
-
export const GradientLine = /*#__PURE__*/memo(_ref => {
|
|
14
|
-
var _ref2, _ref3;
|
|
15
|
-
let {
|
|
16
|
-
fill = 'none',
|
|
17
|
-
stroke,
|
|
18
|
-
startColor,
|
|
19
|
-
endColor,
|
|
20
|
-
strokeOpacity = 1,
|
|
21
|
-
startOpacity = strokeOpacity,
|
|
22
|
-
endOpacity = strokeOpacity,
|
|
23
|
-
strokeLinecap = 'round',
|
|
24
|
-
strokeLinejoin = 'round',
|
|
25
|
-
strokeWidth = 2,
|
|
26
|
-
animate
|
|
27
|
-
} = _ref,
|
|
28
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
|
-
const context = useCartesianChartContext();
|
|
30
|
-
const theme = useTheme();
|
|
31
|
-
const patternId = useId();
|
|
32
|
-
const shouldAnimate = animate != null ? animate : context.animate;
|
|
33
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
34
|
-
children: [/*#__PURE__*/_jsx(Defs, {
|
|
35
|
-
children: /*#__PURE__*/_jsxs(LinearGradient, {
|
|
36
|
-
id: patternId,
|
|
37
|
-
x1: "0%",
|
|
38
|
-
x2: "0%",
|
|
39
|
-
y1: "0%",
|
|
40
|
-
y2: "100%",
|
|
41
|
-
children: [/*#__PURE__*/_jsx(Stop, {
|
|
42
|
-
offset: "0%",
|
|
43
|
-
stopColor: (_ref2 = startColor != null ? startColor : stroke) != null ? _ref2 : theme.color.bgLine,
|
|
44
|
-
stopOpacity: startOpacity
|
|
45
|
-
}), /*#__PURE__*/_jsx(Stop, {
|
|
46
|
-
offset: "100%",
|
|
47
|
-
stopColor: (_ref3 = endColor != null ? endColor : stroke) != null ? _ref3 : theme.color.bgLine,
|
|
48
|
-
stopOpacity: endOpacity
|
|
49
|
-
})]
|
|
50
|
-
})
|
|
51
|
-
}), /*#__PURE__*/_jsx(Path, _extends({
|
|
52
|
-
animate: shouldAnimate,
|
|
53
|
-
clipOffset: strokeWidth,
|
|
54
|
-
fill: fill,
|
|
55
|
-
stroke: "url(#" + patternId + ")",
|
|
56
|
-
strokeLinecap: strokeLinecap,
|
|
57
|
-
strokeLinejoin: strokeLinejoin,
|
|
58
|
-
strokeOpacity: strokeOpacity,
|
|
59
|
-
strokeWidth: strokeWidth
|
|
60
|
-
}, props))]
|
|
61
|
-
});
|
|
62
|
-
});
|