@coinbase/cds-mobile-visualization 3.8.1 → 4.0.0
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 +8 -0
- package/dts/chart/index.d.ts +1 -15
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/index.d.ts.map +1 -1
- package/dts/sparkline/index.d.ts +1 -5
- package/dts/sparkline/index.d.ts.map +1 -1
- package/esm/chart/index.js +1 -17
- package/esm/index.js +1 -3
- package/esm/sparkline/index.js +1 -5
- package/package.json +26 -20
- package/dts/chart/CartesianChart.d.ts +0 -206
- package/dts/chart/CartesianChart.d.ts.map +0 -1
- package/dts/chart/ChartContextBridge.d.ts +0 -28
- package/dts/chart/ChartContextBridge.d.ts.map +0 -1
- package/dts/chart/ChartProvider.d.ts +0 -9
- package/dts/chart/ChartProvider.d.ts.map +0 -1
- package/dts/chart/Path.d.ts +0 -121
- package/dts/chart/Path.d.ts.map +0 -1
- package/dts/chart/PeriodSelector.d.ts +0 -100
- package/dts/chart/PeriodSelector.d.ts.map +0 -1
- package/dts/chart/area/Area.d.ts +0 -83
- package/dts/chart/area/Area.d.ts.map +0 -1
- package/dts/chart/area/AreaChart.d.ts +0 -155
- package/dts/chart/area/AreaChart.d.ts.map +0 -1
- package/dts/chart/area/DottedArea.d.ts +0 -46
- package/dts/chart/area/DottedArea.d.ts.map +0 -1
- package/dts/chart/area/GradientArea.d.ts +0 -36
- package/dts/chart/area/GradientArea.d.ts.map +0 -1
- package/dts/chart/area/SolidArea.d.ts +0 -23
- package/dts/chart/area/SolidArea.d.ts.map +0 -1
- package/dts/chart/area/index.d.ts +0 -6
- package/dts/chart/area/index.d.ts.map +0 -1
- package/dts/chart/axis/Axis.d.ts +0 -174
- package/dts/chart/axis/Axis.d.ts.map +0 -1
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts +0 -8
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +0 -1
- package/dts/chart/axis/XAxis.d.ts +0 -22
- package/dts/chart/axis/XAxis.d.ts.map +0 -1
- package/dts/chart/axis/YAxis.d.ts +0 -22
- package/dts/chart/axis/YAxis.d.ts.map +0 -1
- package/dts/chart/axis/index.d.ts +0 -5
- package/dts/chart/axis/index.d.ts.map +0 -1
- package/dts/chart/bar/Bar.d.ts +0 -100
- package/dts/chart/bar/Bar.d.ts.map +0 -1
- package/dts/chart/bar/BarChart.d.ts +0 -158
- package/dts/chart/bar/BarChart.d.ts.map +0 -1
- package/dts/chart/bar/BarPlot.d.ts +0 -31
- package/dts/chart/bar/BarPlot.d.ts.map +0 -1
- package/dts/chart/bar/BarStack.d.ts +0 -127
- package/dts/chart/bar/BarStack.d.ts.map +0 -1
- package/dts/chart/bar/BarStackGroup.d.ts +0 -37
- package/dts/chart/bar/BarStackGroup.d.ts.map +0 -1
- package/dts/chart/bar/DefaultBar.d.ts +0 -7
- package/dts/chart/bar/DefaultBar.d.ts.map +0 -1
- package/dts/chart/bar/DefaultBarStack.d.ts +0 -7
- package/dts/chart/bar/DefaultBarStack.d.ts.map +0 -1
- package/dts/chart/bar/PercentageBarChart.d.ts +0 -106
- package/dts/chart/bar/PercentageBarChart.d.ts.map +0 -1
- package/dts/chart/bar/index.d.ts +0 -9
- package/dts/chart/bar/index.d.ts.map +0 -1
- package/dts/chart/gradient/Gradient.d.ts +0 -41
- package/dts/chart/gradient/Gradient.d.ts.map +0 -1
- package/dts/chart/gradient/index.d.ts +0 -2
- package/dts/chart/gradient/index.d.ts.map +0 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +0 -5
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +0 -1
- package/dts/chart/legend/DefaultLegendShape.d.ts +0 -5
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +0 -1
- package/dts/chart/legend/Legend.d.ts +0 -168
- package/dts/chart/legend/Legend.d.ts.map +0 -1
- package/dts/chart/legend/index.d.ts +0 -4
- package/dts/chart/legend/index.d.ts.map +0 -1
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts +0 -9
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +0 -1
- package/dts/chart/line/DottedLine.d.ts +0 -20
- package/dts/chart/line/DottedLine.d.ts.map +0 -1
- package/dts/chart/line/Line.d.ts +0 -122
- package/dts/chart/line/Line.d.ts.map +0 -1
- package/dts/chart/line/LineChart.d.ts +0 -135
- package/dts/chart/line/LineChart.d.ts.map +0 -1
- package/dts/chart/line/ReferenceLine.d.ts +0 -140
- package/dts/chart/line/ReferenceLine.d.ts.map +0 -1
- package/dts/chart/line/SolidLine.d.ts +0 -15
- package/dts/chart/line/SolidLine.d.ts.map +0 -1
- package/dts/chart/line/index.d.ts +0 -7
- package/dts/chart/line/index.d.ts.map +0 -1
- package/dts/chart/point/DefaultPointLabel.d.ts +0 -10
- package/dts/chart/point/DefaultPointLabel.d.ts.map +0 -1
- package/dts/chart/point/Point.d.ts +0 -144
- package/dts/chart/point/Point.d.ts.map +0 -1
- package/dts/chart/point/index.d.ts +0 -3
- package/dts/chart/point/index.d.ts.map +0 -1
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +0 -38
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +0 -1
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +0 -12
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +0 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +0 -12
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +0 -1
- package/dts/chart/scrubber/Scrubber.d.ts +0 -302
- package/dts/chart/scrubber/Scrubber.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts +0 -12
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +0 -54
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +0 -46
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberProvider.d.ts +0 -20
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +0 -1
- package/dts/chart/scrubber/index.d.ts +0 -5
- package/dts/chart/scrubber/index.d.ts.map +0 -1
- package/dts/chart/text/ChartText.d.ts +0 -164
- package/dts/chart/text/ChartText.d.ts.map +0 -1
- package/dts/chart/text/ChartTextGroup.d.ts +0 -61
- package/dts/chart/text/ChartTextGroup.d.ts.map +0 -1
- package/dts/chart/text/index.d.ts +0 -3
- package/dts/chart/text/index.d.ts.map +0 -1
- package/dts/chart/utils/axis.d.ts +0 -387
- package/dts/chart/utils/axis.d.ts.map +0 -1
- package/dts/chart/utils/bar.d.ts +0 -225
- package/dts/chart/utils/bar.d.ts.map +0 -1
- package/dts/chart/utils/chart.d.ts +0 -165
- package/dts/chart/utils/chart.d.ts.map +0 -1
- package/dts/chart/utils/context.d.ts +0 -131
- package/dts/chart/utils/context.d.ts.map +0 -1
- package/dts/chart/utils/gradient.d.ts +0 -129
- package/dts/chart/utils/gradient.d.ts.map +0 -1
- package/dts/chart/utils/index.d.ts +0 -11
- package/dts/chart/utils/index.d.ts.map +0 -1
- package/dts/chart/utils/path.d.ts +0 -186
- package/dts/chart/utils/path.d.ts.map +0 -1
- package/dts/chart/utils/point.d.ts +0 -146
- package/dts/chart/utils/point.d.ts.map +0 -1
- package/dts/chart/utils/scale.d.ts +0 -145
- package/dts/chart/utils/scale.d.ts.map +0 -1
- package/dts/chart/utils/scrubber.d.ts +0 -40
- package/dts/chart/utils/scrubber.d.ts.map +0 -1
- package/dts/chart/utils/transition.d.ts +0 -181
- package/dts/chart/utils/transition.d.ts.map +0 -1
- package/dts/sparkline/Counter.d.ts +0 -8
- package/dts/sparkline/Counter.d.ts.map +0 -1
- package/dts/sparkline/Sparkline.d.ts +0 -74
- package/dts/sparkline/Sparkline.d.ts.map +0 -1
- package/dts/sparkline/SparklineArea.d.ts +0 -15
- package/dts/sparkline/SparklineArea.d.ts.map +0 -1
- package/dts/sparkline/SparklineAreaPattern.d.ts +0 -14
- package/dts/sparkline/SparklineAreaPattern.d.ts.map +0 -1
- package/dts/sparkline/SparklineGradient.d.ts +0 -24
- package/dts/sparkline/SparklineGradient.d.ts.map +0 -1
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts +0 -2
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts.map +0 -1
- package/dts/sparkline/generateSparklineWithId.d.ts +0 -11
- package/dts/sparkline/generateSparklineWithId.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts +0 -23
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +0 -185
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +0 -25
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +0 -28
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +0 -13
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +0 -17
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts +0 -11
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts +0 -26
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +0 -25
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +0 -25
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +0 -39
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +0 -31
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts +0 -13
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts +0 -16
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts +0 -6
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +0 -22
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts +0 -34
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +0 -118
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts +0 -29
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map +0 -1
- package/esm/chart/CartesianChart.js +0 -431
- package/esm/chart/ChartContextBridge.js +0 -159
- package/esm/chart/ChartProvider.js +0 -10
- package/esm/chart/Path.js +0 -255
- package/esm/chart/PeriodSelector.js +0 -139
- package/esm/chart/__stories__/CartesianChart.stories.js +0 -659
- package/esm/chart/__stories__/ChartAccessibility.stories.js +0 -721
- package/esm/chart/__stories__/ChartTransitions.stories.js +0 -693
- package/esm/chart/__stories__/PeriodSelector.stories.js +0 -420
- package/esm/chart/area/Area.js +0 -85
- package/esm/chart/area/AreaChart.js +0 -152
- package/esm/chart/area/DottedArea.js +0 -92
- package/esm/chart/area/GradientArea.js +0 -63
- package/esm/chart/area/SolidArea.js +0 -45
- package/esm/chart/area/__stories__/AreaChart.stories.js +0 -370
- package/esm/chart/area/index.js +0 -7
- package/esm/chart/axis/Axis.js +0 -9
- package/esm/chart/axis/DefaultAxisTickLabel.js +0 -11
- package/esm/chart/axis/XAxis.js +0 -256
- package/esm/chart/axis/YAxis.js +0 -255
- package/esm/chart/axis/__stories__/Axis.stories.js +0 -552
- package/esm/chart/axis/index.js +0 -6
- package/esm/chart/bar/Bar.js +0 -71
- package/esm/chart/bar/BarChart.js +0 -122
- package/esm/chart/bar/BarPlot.js +0 -106
- package/esm/chart/bar/BarStack.js +0 -173
- package/esm/chart/bar/BarStackGroup.js +0 -89
- package/esm/chart/bar/DefaultBar.js +0 -79
- package/esm/chart/bar/DefaultBarStack.js +0 -68
- package/esm/chart/bar/PercentageBarChart.js +0 -99
- package/esm/chart/bar/__stories__/BarChart.stories.js +0 -1417
- package/esm/chart/bar/__stories__/PercentageBarChart.stories.js +0 -833
- package/esm/chart/bar/index.js +0 -10
- package/esm/chart/gradient/Gradient.js +0 -156
- package/esm/chart/gradient/index.js +0 -1
- package/esm/chart/legend/DefaultLegendEntry.js +0 -42
- package/esm/chart/legend/DefaultLegendShape.js +0 -64
- package/esm/chart/legend/Legend.js +0 -59
- package/esm/chart/legend/__stories__/Legend.stories.js +0 -574
- package/esm/chart/legend/index.js +0 -3
- package/esm/chart/line/DefaultReferenceLineLabel.js +0 -66
- package/esm/chart/line/DottedLine.js +0 -57
- package/esm/chart/line/Line.js +0 -180
- package/esm/chart/line/LineChart.js +0 -149
- package/esm/chart/line/ReferenceLine.js +0 -132
- package/esm/chart/line/SolidLine.js +0 -53
- package/esm/chart/line/__stories__/LineChart.stories.js +0 -2018
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +0 -226
- package/esm/chart/line/index.js +0 -8
- package/esm/chart/point/DefaultPointLabel.js +0 -39
- package/esm/chart/point/Point.js +0 -187
- package/esm/chart/point/index.js +0 -2
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +0 -182
- package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +0 -43
- package/esm/chart/scrubber/DefaultScrubberLabel.js +0 -44
- package/esm/chart/scrubber/Scrubber.js +0 -198
- package/esm/chart/scrubber/ScrubberAccessibilityView.js +0 -177
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +0 -169
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +0 -212
- package/esm/chart/scrubber/ScrubberProvider.js +0 -140
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +0 -946
- package/esm/chart/scrubber/index.js +0 -4
- package/esm/chart/text/ChartText.js +0 -305
- package/esm/chart/text/ChartTextGroup.js +0 -211
- package/esm/chart/text/index.js +0 -4
- package/esm/chart/utils/axis.js +0 -664
- package/esm/chart/utils/bar.js +0 -906
- package/esm/chart/utils/chart.js +0 -329
- package/esm/chart/utils/context.js +0 -22
- package/esm/chart/utils/gradient.js +0 -319
- package/esm/chart/utils/index.js +0 -12
- package/esm/chart/utils/path.js +0 -304
- package/esm/chart/utils/point.js +0 -282
- package/esm/chart/utils/scale.js +0 -288
- package/esm/chart/utils/scrubber.js +0 -146
- package/esm/chart/utils/transition.js +0 -241
- package/esm/sparkline/Counter.js +0 -45
- package/esm/sparkline/Sparkline.js +0 -165
- package/esm/sparkline/SparklineArea.js +0 -20
- package/esm/sparkline/SparklineAreaPattern.js +0 -38
- package/esm/sparkline/SparklineGradient.js +0 -77
- package/esm/sparkline/__figma__/Sparkline.figma.js +0 -22
- package/esm/sparkline/__stories__/Sparkline.stories.js +0 -124
- package/esm/sparkline/__stories__/SparklineGradient.stories.js +0 -126
- package/esm/sparkline/generateSparklineWithId.js +0 -7
- package/esm/sparkline/sparkline-interactive/SparklineAccessibleView.js +0 -75
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +0 -308
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +0 -116
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.js +0 -131
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.js +0 -99
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +0 -82
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMinMax.js +0 -103
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.js +0 -104
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePaths.js +0 -57
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.js +0 -124
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveProvider.js +0 -80
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.js +0 -109
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +0 -85
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +0 -526
- package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.js +0 -58
- package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.js +0 -37
- package/esm/sparkline/sparkline-interactive/useMinMaxTransform.js +0 -56
- package/esm/sparkline/sparkline-interactive/useOpacityAnimation.js +0 -23
- package/esm/sparkline/sparkline-interactive/useSparklineInteractiveConstants.js +0 -47
- package/esm/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.js +0 -34
- package/esm/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.js +0 -233
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +0 -104
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +0 -565
- package/esm/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.js +0 -117
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
compact?: boolean;
|
|
3
|
-
};
|
|
4
|
-
export declare function useSparklineInteractiveConstants({ compact }: Props): {
|
|
5
|
-
chartHorizontalGutter: number;
|
|
6
|
-
chartWidth: number;
|
|
7
|
-
chartHeight: number;
|
|
8
|
-
chartDimensionStyles: {
|
|
9
|
-
height: number;
|
|
10
|
-
width: number;
|
|
11
|
-
};
|
|
12
|
-
chartMarkerSize: number;
|
|
13
|
-
SparklineInteractiveMinMaxLabelHeight: number;
|
|
14
|
-
SparklineInteractiveMinMaxVerticalGutter: number;
|
|
15
|
-
chartVerticalLineWidth: number;
|
|
16
|
-
xRange: number[];
|
|
17
|
-
yRange: number[];
|
|
18
|
-
startX: number;
|
|
19
|
-
endX: number;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=useSparklineInteractiveConstants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSparklineInteractiveConstants.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useSparklineInteractiveConstants.ts"],"names":[],"mappings":"AAWA,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,EAAE,OAAe,EAAE,EAAE,KAAK;;;;;;;;;;;;;;;;EAoC1E"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare function useSparklineInteractiveLineStyles(): {
|
|
2
|
-
dotStyle: (
|
|
3
|
-
| {
|
|
4
|
-
backgroundColor: string;
|
|
5
|
-
position?: undefined;
|
|
6
|
-
top?: undefined;
|
|
7
|
-
left?: undefined;
|
|
8
|
-
height?: undefined;
|
|
9
|
-
width?: undefined;
|
|
10
|
-
borderRadius?: undefined;
|
|
11
|
-
opacity?: undefined;
|
|
12
|
-
}
|
|
13
|
-
| {
|
|
14
|
-
position: string;
|
|
15
|
-
top: number;
|
|
16
|
-
left: number;
|
|
17
|
-
height: number;
|
|
18
|
-
width: number;
|
|
19
|
-
borderRadius: number;
|
|
20
|
-
opacity: number;
|
|
21
|
-
backgroundColor?: undefined;
|
|
22
|
-
}
|
|
23
|
-
)[];
|
|
24
|
-
lineProps: {
|
|
25
|
-
strokeWidth: number;
|
|
26
|
-
stroke: string;
|
|
27
|
-
x1: number;
|
|
28
|
-
x2: number;
|
|
29
|
-
y1: number;
|
|
30
|
-
y2: number;
|
|
31
|
-
strokeDasharray: number[];
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=useSparklineInteractiveLineStyles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSparklineInteractiveLineStyles.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.ts"],"names":[],"mappings":"AAYA,wBAAgB,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BhD"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
SharedProps,
|
|
5
|
-
SparklineInteractiveHeaderSignVariant,
|
|
6
|
-
SparklineInteractiveHeaderVariant,
|
|
7
|
-
} from '@coinbase/cds-common/types';
|
|
8
|
-
export * from '@coinbase/cds-common/types/SparklineInteractiveHeaderBaseProps';
|
|
9
|
-
export type SparklineInteractiveSubHead = {
|
|
10
|
-
/**
|
|
11
|
-
* Free form percentage change
|
|
12
|
-
*/
|
|
13
|
-
percent: string;
|
|
14
|
-
/**
|
|
15
|
-
* Sign to denote the change in price
|
|
16
|
-
*/
|
|
17
|
-
sign: SparklineInteractiveHeaderSignVariant;
|
|
18
|
-
/**
|
|
19
|
-
* The variant to use for the price and percentage change
|
|
20
|
-
*/
|
|
21
|
-
variant: SparklineInteractiveHeaderVariant;
|
|
22
|
-
/**
|
|
23
|
-
* Show the dollar amount of price change
|
|
24
|
-
*/
|
|
25
|
-
priceChange?: string;
|
|
26
|
-
/**
|
|
27
|
-
* The accessoryText to show after the price and / or percentage change. An example is "All time"
|
|
28
|
-
*/
|
|
29
|
-
accessoryText?: string;
|
|
30
|
-
/**
|
|
31
|
-
* The accessibilityLabel to show for the price and / or percentage change. This should be localized
|
|
32
|
-
* @example
|
|
33
|
-
* // First, configure your i18n strings
|
|
34
|
-
* const messages = defineMessages({
|
|
35
|
-
* subHeadPrefix: {
|
|
36
|
-
* id: `${i18nKey}.subHeadPrefix`,
|
|
37
|
-
* defaultMessage: 'Price increase in the amount of',
|
|
38
|
-
* description: 'A prefix to make it clear which direction the price action was moving',
|
|
39
|
-
* }
|
|
40
|
-
* });
|
|
41
|
-
*
|
|
42
|
-
* // then provide the translated string the accessibilityLabel prop
|
|
43
|
-
* messages.subHeadPrefix
|
|
44
|
-
*/
|
|
45
|
-
accessibilityLabel?: string;
|
|
46
|
-
};
|
|
47
|
-
export type SparklineInteractiveHeaderValues = {
|
|
48
|
-
/**
|
|
49
|
-
* Describes what the Header represents e.g. Bitcoin Price
|
|
50
|
-
*/
|
|
51
|
-
label?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Main content of header, this is usually the price
|
|
54
|
-
*/
|
|
55
|
-
title?: React.ReactNode;
|
|
56
|
-
/**
|
|
57
|
-
* Provides additional information about the title, such as a price change
|
|
58
|
-
*/
|
|
59
|
-
subHead?: SparklineInteractiveSubHead;
|
|
60
|
-
};
|
|
61
|
-
export type SparklineInteractiveHeaderRef = {
|
|
62
|
-
update: (params: SparklineInteractiveHeaderValues) => void;
|
|
63
|
-
};
|
|
64
|
-
export type SparklineInteractiveHeaderProps = SharedProps & {
|
|
65
|
-
/**
|
|
66
|
-
* Default title, changing this prop has no effect once the default is rendered. If you use a ReactNode that is not a string, then you cannot use the text based label that supports updates.
|
|
67
|
-
*/
|
|
68
|
-
defaultTitle: React.ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* Default label, changing this prop has no effect once the default is rendered.
|
|
71
|
-
*/
|
|
72
|
-
defaultLabel?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Default SubHead, changing this prop has no effect once the default is rendered.
|
|
75
|
-
*/
|
|
76
|
-
defaultSubHead?: SparklineInteractiveSubHead;
|
|
77
|
-
/**
|
|
78
|
-
* Adds a label node that allows React components. If you use this node then you cannot use the text based label that supports updates.
|
|
79
|
-
*/
|
|
80
|
-
labelNode?: React.ReactNode;
|
|
81
|
-
/**
|
|
82
|
-
* Reduce the font size used for the header itself.
|
|
83
|
-
*/
|
|
84
|
-
compact?: boolean;
|
|
85
|
-
};
|
|
86
|
-
export declare const interpolateSubHeadText: (subHead: SparklineInteractiveSubHead) => string;
|
|
87
|
-
export declare const SparklineInteractiveHeader: React.MemoExoticComponent<
|
|
88
|
-
React.ForwardRefExoticComponent<
|
|
89
|
-
{
|
|
90
|
-
/**
|
|
91
|
-
* Adds content next to the header. This is useful for interactive buttons
|
|
92
|
-
*/
|
|
93
|
-
trailing?: ReactNode;
|
|
94
|
-
} & SharedProps & {
|
|
95
|
-
/**
|
|
96
|
-
* Default title, changing this prop has no effect once the default is rendered. If you use a ReactNode that is not a string, then you cannot use the text based label that supports updates.
|
|
97
|
-
*/
|
|
98
|
-
defaultTitle: React.ReactNode;
|
|
99
|
-
/**
|
|
100
|
-
* Default label, changing this prop has no effect once the default is rendered.
|
|
101
|
-
*/
|
|
102
|
-
defaultLabel?: string;
|
|
103
|
-
/**
|
|
104
|
-
* Default SubHead, changing this prop has no effect once the default is rendered.
|
|
105
|
-
*/
|
|
106
|
-
defaultSubHead?: SparklineInteractiveSubHead;
|
|
107
|
-
/**
|
|
108
|
-
* Adds a label node that allows React components. If you use this node then you cannot use the text based label that supports updates.
|
|
109
|
-
*/
|
|
110
|
-
labelNode?: React.ReactNode;
|
|
111
|
-
/**
|
|
112
|
-
* Reduce the font size used for the header itself.
|
|
113
|
-
*/
|
|
114
|
-
compact?: boolean;
|
|
115
|
-
} & React.RefAttributes<SparklineInteractiveHeaderRef>
|
|
116
|
-
>
|
|
117
|
-
>;
|
|
118
|
-
//# sourceMappingURL=SparklineInteractiveHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineInteractiveHeader.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqE,MAAM,OAAO,CAAC;AAE1F,OAAO,KAAK,EAAqB,SAAS,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,KAAK,EACV,WAAW,EACX,qCAAqC,EACrC,iCAAiC,EAClC,MAAM,4BAA4B,CAAC;AAKpC,cAAc,gEAAgE,CAAC;AAE/E,MAAM,MAAM,2BAA2B,GAAG;IACxC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,qCAAqC,CAAC;IAC5C;;OAEG;IACH,OAAO,EAAE,iCAAiC,CAAC;IAC3C;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;;;OAcG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,MAAM,EAAE,CAAC,MAAM,EAAE,gCAAgC,KAAK,IAAI,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG,WAAW,GAAG;IAC1D;;OAEG;IACH,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,2BAA2B,CAAC;IAC7C;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,SAAS,2BAA2B,WAQ1E,CAAC;AAwNF,eAAO,MAAM,0BAA0B;IANrC;;OAEG;eACQ,SAAS;;IAnPpB;;OAEG;kBACW,KAAK,CAAC,SAAS;IAC7B;;OAEG;mBACY,MAAM;IACrB;;OAEG;qBACc,2BAA2B;IAC5C;;OAEG;gBACS,KAAK,CAAC,SAAS;IAC3B;;OAEG;cACO,OAAO;wDAuPlB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineInteractiveHeader.figma.d.ts","sourceRoot":"","sources":["../../../../src/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.tsx"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { StyleProp, TextStyle } from 'react-native';
|
|
2
|
-
import type { SparklineInteractiveSubHead } from './SparklineInteractiveHeader';
|
|
3
|
-
export type SparklineInteractiveSubHeadIconColor = SparklineInteractiveSubHead['variant'];
|
|
4
|
-
export declare const styles: {
|
|
5
|
-
inputReset: {
|
|
6
|
-
padding: number;
|
|
7
|
-
margin: number;
|
|
8
|
-
backgroundColor: string;
|
|
9
|
-
overflow: 'visible';
|
|
10
|
-
lineHeight: undefined;
|
|
11
|
-
};
|
|
12
|
-
fullWidth: {
|
|
13
|
-
width: '100%';
|
|
14
|
-
};
|
|
15
|
-
tabularNumbers: {
|
|
16
|
-
fontVariant: 'tabular-nums'[];
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export declare function useSparklineInteractiveHeaderStyles(): {
|
|
20
|
-
readonly title: (text: string) => StyleProp<TextStyle>;
|
|
21
|
-
readonly label: StyleProp<TextStyle>;
|
|
22
|
-
readonly subHeadIcon: (color: SparklineInteractiveSubHeadIconColor) => StyleProp<TextStyle>;
|
|
23
|
-
readonly subHead: (
|
|
24
|
-
color: SparklineInteractiveSubHeadIconColor,
|
|
25
|
-
useFullWidth?: boolean,
|
|
26
|
-
) => StyleProp<TextStyle>;
|
|
27
|
-
readonly subHeadAccessory: () => StyleProp<TextStyle>;
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=useSparklineInteractiveHeaderStyles.d.ts.map
|
package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSparklineInteractiveHeaderStyles.d.ts","sourceRoot":"","sources":["../../../src/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAEhF,MAAM,MAAM,oCAAoC,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;AA0B1F,eAAO,MAAM,MAAM;;;;;;;;;;;;;;CAejB,CAAC;AAEH,wBAAgB,mCAAmC;2BA+B/B,MAAM,KAAG,SAAS,CAAC,SAAS,CAAC;oBA+BtC,SAAS,CAAC,SAAS,CAAC;kCAEJ,oCAAoC,KAAG,SAAS,CAAC,SAAS,CAAC;8BAYvE,oCAAoC,6BAE1C,SAAS,CAAC,SAAS,CAAC;qCAUD,SAAS,CAAC,SAAS,CAAC;EAqB/C"}
|
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
const _excluded = ["series", "children", "layout", "animate", "enableScrubbing", "getScrubberAccessibilityLabel", "scrubberAccessibilityLabelStep", "xAxis", "yAxis", "inset", "onScrubberPositionChange", "legend", "legendPosition", "legendAccessibilityLabel", "width", "height", "style", "styles", "allowOverflowGestures", "fontFamilies", "fontProvider", "collapsable", "accessible", "accessibilityLabel", "accessibilityLiveRegion"];
|
|
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 React, { forwardRef, memo, useCallback, useMemo } from 'react';
|
|
5
|
-
import { useLayout } from '@coinbase/cds-mobile/hooks/useLayout';
|
|
6
|
-
import { Box } from '@coinbase/cds-mobile/layout';
|
|
7
|
-
import { Canvas, Skia } from '@shopify/react-native-skia';
|
|
8
|
-
import { ScrubberAccessibilityView } from './scrubber/ScrubberAccessibilityView';
|
|
9
|
-
import { ScrubberProvider } from './scrubber/ScrubberProvider';
|
|
10
|
-
import { convertToSerializableScale } from './utils/scale';
|
|
11
|
-
import { useChartContextBridge } from './ChartContextBridge';
|
|
12
|
-
import { CartesianChartProvider } from './ChartProvider';
|
|
13
|
-
import { Legend } from './legend';
|
|
14
|
-
import { defaultAxisId, defaultHorizontalLayoutChartInset, defaultVerticalLayoutChartInset, getAxisConfig, getAxisRange, getCartesianAxisDomain, getCartesianAxisScale, getChartInset, getStackedSeriesData as calculateStackedSeriesData, useTotalAxisPadding } from './utils';
|
|
15
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
const ChartCanvas = /*#__PURE__*/memo(_ref => {
|
|
17
|
-
let {
|
|
18
|
-
children,
|
|
19
|
-
style,
|
|
20
|
-
accessible = true,
|
|
21
|
-
accessibilityLabel,
|
|
22
|
-
accessibilityLiveRegion = 'polite'
|
|
23
|
-
} = _ref;
|
|
24
|
-
const ContextBridge = useChartContextBridge();
|
|
25
|
-
const isAccessible = accessible && accessibilityLabel !== null;
|
|
26
|
-
return /*#__PURE__*/_jsx(Canvas, {
|
|
27
|
-
accessibilityLabel: isAccessible ? accessibilityLabel : undefined,
|
|
28
|
-
accessibilityLiveRegion: isAccessible ? accessibilityLiveRegion : undefined,
|
|
29
|
-
accessible: isAccessible,
|
|
30
|
-
style: [{
|
|
31
|
-
width: '100%',
|
|
32
|
-
height: '100%'
|
|
33
|
-
}, style],
|
|
34
|
-
children: /*#__PURE__*/_jsx(ContextBridge, {
|
|
35
|
-
children: children
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
export const CartesianChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
40
|
-
let {
|
|
41
|
-
series,
|
|
42
|
-
children,
|
|
43
|
-
layout = 'vertical',
|
|
44
|
-
animate = true,
|
|
45
|
-
enableScrubbing,
|
|
46
|
-
getScrubberAccessibilityLabel,
|
|
47
|
-
scrubberAccessibilityLabelStep,
|
|
48
|
-
xAxis: xAxisConfigProp,
|
|
49
|
-
yAxis: yAxisConfigProp,
|
|
50
|
-
inset,
|
|
51
|
-
onScrubberPositionChange,
|
|
52
|
-
legend,
|
|
53
|
-
legendPosition = 'bottom',
|
|
54
|
-
legendAccessibilityLabel,
|
|
55
|
-
width = '100%',
|
|
56
|
-
height = '100%',
|
|
57
|
-
style,
|
|
58
|
-
styles,
|
|
59
|
-
allowOverflowGestures,
|
|
60
|
-
fontFamilies,
|
|
61
|
-
fontProvider: fontProviderProp,
|
|
62
|
-
// React Native will collapse views by default when only used
|
|
63
|
-
// to group children, which interferes with gesture-handler
|
|
64
|
-
// https://docs.swmansion.com/react-native-gesture-handler/docs/gestures/gesture-detector/#:~:text=%7B%0A%20%20return%20%3C-,View,-collapsable%3D%7B
|
|
65
|
-
collapsable = false,
|
|
66
|
-
accessible = true,
|
|
67
|
-
accessibilityLabel,
|
|
68
|
-
accessibilityLiveRegion = 'polite'
|
|
69
|
-
} = _ref2,
|
|
70
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
71
|
-
const [containerLayout, onContainerLayout] = useLayout();
|
|
72
|
-
const chartWidth = containerLayout.width;
|
|
73
|
-
const chartHeight = containerLayout.height;
|
|
74
|
-
const calculatedInset = useMemo(() => getChartInset(inset, layout === 'horizontal' ? defaultHorizontalLayoutChartInset : defaultVerticalLayoutChartInset), [inset, layout]);
|
|
75
|
-
const xAxisConfig = useMemo(() => getAxisConfig('x', xAxisConfigProp), [xAxisConfigProp]);
|
|
76
|
-
const yAxisConfig = useMemo(() => getAxisConfig('y', yAxisConfigProp), [yAxisConfigProp]);
|
|
77
|
-
|
|
78
|
-
// Horizontal layout supports multiple value axes on x, but only a single category axis on y.
|
|
79
|
-
// Vertical layout keeps a single x-axis to preserve existing behavior.
|
|
80
|
-
if (layout === 'horizontal' && yAxisConfig.length > 1) {
|
|
81
|
-
throw new Error('When layout="horizontal", only one y-axis is supported. See https://cds.coinbase.com/components/charts/CartesianChart.');
|
|
82
|
-
}
|
|
83
|
-
if (layout !== 'horizontal' && xAxisConfig.length > 1) {
|
|
84
|
-
throw new Error('Multiple x-axes are only supported when layout="horizontal". See https://cds.coinbase.com/components/charts/CartesianChart.');
|
|
85
|
-
}
|
|
86
|
-
const {
|
|
87
|
-
renderedAxes,
|
|
88
|
-
registerAxis,
|
|
89
|
-
unregisterAxis,
|
|
90
|
-
axisPadding
|
|
91
|
-
} = useTotalAxisPadding();
|
|
92
|
-
const totalInset = useMemo(() => ({
|
|
93
|
-
top: calculatedInset.top + axisPadding.top,
|
|
94
|
-
right: calculatedInset.right + axisPadding.right,
|
|
95
|
-
bottom: calculatedInset.bottom + axisPadding.bottom,
|
|
96
|
-
left: calculatedInset.left + axisPadding.left
|
|
97
|
-
}), [calculatedInset, axisPadding]);
|
|
98
|
-
const chartRect = useMemo(() => {
|
|
99
|
-
if (chartWidth <= 0 || chartHeight <= 0) return {
|
|
100
|
-
x: 0,
|
|
101
|
-
y: 0,
|
|
102
|
-
width: 0,
|
|
103
|
-
height: 0
|
|
104
|
-
};
|
|
105
|
-
const availableWidth = chartWidth - totalInset.left - totalInset.right;
|
|
106
|
-
const availableHeight = chartHeight - totalInset.top - totalInset.bottom;
|
|
107
|
-
return {
|
|
108
|
-
x: totalInset.left,
|
|
109
|
-
y: totalInset.top,
|
|
110
|
-
width: availableWidth > 0 ? availableWidth : 0,
|
|
111
|
-
height: availableHeight > 0 ? availableHeight : 0
|
|
112
|
-
};
|
|
113
|
-
}, [chartHeight, chartWidth, totalInset]);
|
|
114
|
-
const {
|
|
115
|
-
xAxes,
|
|
116
|
-
xScales
|
|
117
|
-
} = useMemo(() => {
|
|
118
|
-
const axes = new Map();
|
|
119
|
-
const scales = new Map();
|
|
120
|
-
if (!chartRect || chartRect.width <= 0 || chartRect.height <= 0) return {
|
|
121
|
-
xAxes: axes,
|
|
122
|
-
xScales: scales
|
|
123
|
-
};
|
|
124
|
-
xAxisConfig.forEach(axisParam => {
|
|
125
|
-
var _axisParam$id, _series$filter, _axisParam$domainLimi;
|
|
126
|
-
const axisId = (_axisParam$id = axisParam.id) != null ? _axisParam$id : defaultAxisId;
|
|
127
|
-
|
|
128
|
-
// Get relevant series data.
|
|
129
|
-
const relevantSeries = xAxisConfig.length > 1 ? (_series$filter = series == null ? void 0 : series.filter(s => {
|
|
130
|
-
var _s$xAxisId;
|
|
131
|
-
return ((_s$xAxisId = s.xAxisId) != null ? _s$xAxisId : defaultAxisId) === axisId;
|
|
132
|
-
})) != null ? _series$filter : [] : series != null ? series : [];
|
|
133
|
-
|
|
134
|
-
// Calculate domain and range.
|
|
135
|
-
const dataDomain = getCartesianAxisDomain(axisParam, relevantSeries, 'x', layout);
|
|
136
|
-
const range = getAxisRange(axisParam, chartRect, 'x');
|
|
137
|
-
const axisConfig = {
|
|
138
|
-
scaleType: axisParam.scaleType,
|
|
139
|
-
domain: dataDomain,
|
|
140
|
-
range,
|
|
141
|
-
data: axisParam.data,
|
|
142
|
-
categoryPadding: axisParam.categoryPadding,
|
|
143
|
-
domainLimit: (_axisParam$domainLimi = axisParam.domainLimit) != null ? _axisParam$domainLimi : layout === 'horizontal' ? 'nice' : 'strict',
|
|
144
|
-
baseline: axisParam.baseline
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
// Create the scale.
|
|
148
|
-
const scale = getCartesianAxisScale({
|
|
149
|
-
config: axisConfig,
|
|
150
|
-
type: 'x',
|
|
151
|
-
range: axisConfig.range,
|
|
152
|
-
dataDomain: axisConfig.domain,
|
|
153
|
-
layout
|
|
154
|
-
});
|
|
155
|
-
if (scale) {
|
|
156
|
-
scales.set(axisId, scale);
|
|
157
|
-
|
|
158
|
-
// Update axis config with actual scale domain (after .nice() or other adjustments).
|
|
159
|
-
const scaleDomain = scale.domain();
|
|
160
|
-
const actualDomain = Array.isArray(scaleDomain) && scaleDomain.length === 2 ? {
|
|
161
|
-
min: scaleDomain[0],
|
|
162
|
-
max: scaleDomain[1]
|
|
163
|
-
} : axisConfig.domain;
|
|
164
|
-
axes.set(axisId, _extends({}, axisConfig, {
|
|
165
|
-
domain: actualDomain
|
|
166
|
-
}));
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
return {
|
|
170
|
-
xAxes: axes,
|
|
171
|
-
xScales: scales
|
|
172
|
-
};
|
|
173
|
-
}, [xAxisConfig, series, chartRect, layout]);
|
|
174
|
-
|
|
175
|
-
// We need a set of serialized scales usable in UI thread.
|
|
176
|
-
const xSerializableScales = useMemo(() => {
|
|
177
|
-
const serializableScales = new Map();
|
|
178
|
-
xScales.forEach((scale, id) => {
|
|
179
|
-
const serializableScale = convertToSerializableScale(scale);
|
|
180
|
-
if (serializableScale) {
|
|
181
|
-
serializableScales.set(id, serializableScale);
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
return serializableScales;
|
|
185
|
-
}, [xScales]);
|
|
186
|
-
const {
|
|
187
|
-
yAxes,
|
|
188
|
-
yScales
|
|
189
|
-
} = useMemo(() => {
|
|
190
|
-
const axes = new Map();
|
|
191
|
-
const scales = new Map();
|
|
192
|
-
if (!chartRect || chartRect.width <= 0 || chartRect.height <= 0) return {
|
|
193
|
-
yAxes: axes,
|
|
194
|
-
yScales: scales
|
|
195
|
-
};
|
|
196
|
-
yAxisConfig.forEach(axisParam => {
|
|
197
|
-
var _axisParam$id2, _series$filter2, _axisParam$domainLimi2;
|
|
198
|
-
const axisId = (_axisParam$id2 = axisParam.id) != null ? _axisParam$id2 : defaultAxisId;
|
|
199
|
-
|
|
200
|
-
// Get relevant series data.
|
|
201
|
-
const relevantSeries = yAxisConfig.length > 1 ? (_series$filter2 = series == null ? void 0 : series.filter(s => {
|
|
202
|
-
var _s$yAxisId;
|
|
203
|
-
return ((_s$yAxisId = s.yAxisId) != null ? _s$yAxisId : defaultAxisId) === axisId;
|
|
204
|
-
})) != null ? _series$filter2 : [] : series != null ? series : [];
|
|
205
|
-
|
|
206
|
-
// Calculate domain and range.
|
|
207
|
-
const dataDomain = getCartesianAxisDomain(axisParam, relevantSeries, 'y', layout);
|
|
208
|
-
const range = getAxisRange(axisParam, chartRect, 'y');
|
|
209
|
-
const axisConfig = {
|
|
210
|
-
scaleType: axisParam.scaleType,
|
|
211
|
-
domain: dataDomain,
|
|
212
|
-
range,
|
|
213
|
-
data: axisParam.data,
|
|
214
|
-
categoryPadding: axisParam.categoryPadding,
|
|
215
|
-
domainLimit: (_axisParam$domainLimi2 = axisParam.domainLimit) != null ? _axisParam$domainLimi2 : layout === 'horizontal' ? 'strict' : 'nice',
|
|
216
|
-
baseline: axisParam.baseline
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
// Create the scale.
|
|
220
|
-
const scale = getCartesianAxisScale({
|
|
221
|
-
config: axisConfig,
|
|
222
|
-
type: 'y',
|
|
223
|
-
range: axisConfig.range,
|
|
224
|
-
dataDomain: axisConfig.domain,
|
|
225
|
-
layout
|
|
226
|
-
});
|
|
227
|
-
if (scale) {
|
|
228
|
-
scales.set(axisId, scale);
|
|
229
|
-
|
|
230
|
-
// Update axis config with actual scale domain (after .nice() or other adjustments).
|
|
231
|
-
const scaleDomain = scale.domain();
|
|
232
|
-
const actualDomain = Array.isArray(scaleDomain) && scaleDomain.length === 2 ? {
|
|
233
|
-
min: scaleDomain[0],
|
|
234
|
-
max: scaleDomain[1]
|
|
235
|
-
} : axisConfig.domain;
|
|
236
|
-
axes.set(axisId, _extends({}, axisConfig, {
|
|
237
|
-
domain: actualDomain
|
|
238
|
-
}));
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
return {
|
|
242
|
-
yAxes: axes,
|
|
243
|
-
yScales: scales
|
|
244
|
-
};
|
|
245
|
-
}, [yAxisConfig, series, chartRect, layout]);
|
|
246
|
-
|
|
247
|
-
// We need a set of serialized scales usable in UI thread
|
|
248
|
-
const ySerializableScales = useMemo(() => {
|
|
249
|
-
const serializableScales = new Map();
|
|
250
|
-
yScales.forEach((scale, id) => {
|
|
251
|
-
const serializableScale = convertToSerializableScale(scale);
|
|
252
|
-
if (serializableScale) {
|
|
253
|
-
serializableScales.set(id, serializableScale);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
return serializableScales;
|
|
257
|
-
}, [yScales]);
|
|
258
|
-
const getXAxis = useCallback(id => xAxes.get(id != null ? id : defaultAxisId), [xAxes]);
|
|
259
|
-
const getYAxis = useCallback(id => yAxes.get(id != null ? id : defaultAxisId), [yAxes]);
|
|
260
|
-
const getXScale = useCallback(id => xScales.get(id != null ? id : defaultAxisId), [xScales]);
|
|
261
|
-
const getYScale = useCallback(id => yScales.get(id != null ? id : defaultAxisId), [yScales]);
|
|
262
|
-
const getXSerializableScale = useCallback(id => xSerializableScales.get(id != null ? id : defaultAxisId), [xSerializableScales]);
|
|
263
|
-
const getYSerializableScale = useCallback(id => ySerializableScales.get(id != null ? id : defaultAxisId), [ySerializableScales]);
|
|
264
|
-
const getSeries = useCallback(seriesId => series == null ? void 0 : series.find(s => s.id === seriesId), [series]);
|
|
265
|
-
const stackedDataMap = useMemo(() => {
|
|
266
|
-
if (!series) return new Map();
|
|
267
|
-
return calculateStackedSeriesData(series, layout, xAxisConfig, yAxisConfig);
|
|
268
|
-
}, [series, layout, xAxisConfig, yAxisConfig]);
|
|
269
|
-
const getStackedSeriesData = useCallback(seriesId => {
|
|
270
|
-
if (!seriesId) return undefined;
|
|
271
|
-
return stackedDataMap.get(seriesId);
|
|
272
|
-
}, [stackedDataMap]);
|
|
273
|
-
const categoryAxisIsX = useMemo(() => {
|
|
274
|
-
return layout !== 'horizontal';
|
|
275
|
-
}, [layout]);
|
|
276
|
-
const categoryAxisConfig = useMemo(() => {
|
|
277
|
-
var _xAxisConfig$, _yAxisConfig$;
|
|
278
|
-
return categoryAxisIsX ? (_xAxisConfig$ = xAxisConfig[0]) != null ? _xAxisConfig$ : yAxisConfig[0] : (_yAxisConfig$ = yAxisConfig[0]) != null ? _yAxisConfig$ : xAxisConfig[0];
|
|
279
|
-
}, [categoryAxisIsX, xAxisConfig, yAxisConfig]);
|
|
280
|
-
const dataLength = useMemo(() => {
|
|
281
|
-
// If category axis has categorical data, use that length.
|
|
282
|
-
if (categoryAxisConfig.data && categoryAxisConfig.data.length > 0) {
|
|
283
|
-
return categoryAxisConfig.data.length;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
// Otherwise, find the longest series.
|
|
287
|
-
if (!series || series.length === 0) return 0;
|
|
288
|
-
return series.reduce((max, s) => {
|
|
289
|
-
var _seriesData$length;
|
|
290
|
-
const seriesData = getStackedSeriesData(s.id);
|
|
291
|
-
return Math.max(max, (_seriesData$length = seriesData == null ? void 0 : seriesData.length) != null ? _seriesData$length : 0);
|
|
292
|
-
}, 0);
|
|
293
|
-
}, [categoryAxisConfig, series, getStackedSeriesData]);
|
|
294
|
-
const getAxisBounds = useCallback(axisId => {
|
|
295
|
-
const axis = renderedAxes.get(axisId);
|
|
296
|
-
if (!axis || !chartRect) return;
|
|
297
|
-
const axesAtPosition = Array.from(renderedAxes.values()).filter(a => a.position === axis.position).sort((a, b) => a.id.localeCompare(b.id));
|
|
298
|
-
const axisIndex = axesAtPosition.findIndex(a => a.id === axisId);
|
|
299
|
-
if (axisIndex === -1) return;
|
|
300
|
-
|
|
301
|
-
// Calculate offset from previous axes at the same position
|
|
302
|
-
const offsetFromPreviousAxes = axesAtPosition.slice(0, axisIndex).reduce((sum, a) => sum + a.size, 0);
|
|
303
|
-
if (axis.position === 'top') {
|
|
304
|
-
// Position above the chart rect, accounting for user inset
|
|
305
|
-
const startY = calculatedInset.top + offsetFromPreviousAxes;
|
|
306
|
-
return {
|
|
307
|
-
x: chartRect.x,
|
|
308
|
-
y: startY,
|
|
309
|
-
width: chartRect.width,
|
|
310
|
-
height: axis.size
|
|
311
|
-
};
|
|
312
|
-
} else if (axis.position === 'bottom') {
|
|
313
|
-
// Position below the chart rect, accounting for user inset
|
|
314
|
-
const startY = chartRect.y + chartRect.height + offsetFromPreviousAxes;
|
|
315
|
-
return {
|
|
316
|
-
x: chartRect.x,
|
|
317
|
-
y: startY,
|
|
318
|
-
width: chartRect.width,
|
|
319
|
-
height: axis.size
|
|
320
|
-
};
|
|
321
|
-
} else if (axis.position === 'left') {
|
|
322
|
-
// Position to the left of the chart rect, accounting for user inset
|
|
323
|
-
const startX = calculatedInset.left + offsetFromPreviousAxes;
|
|
324
|
-
return {
|
|
325
|
-
x: startX,
|
|
326
|
-
y: chartRect.y,
|
|
327
|
-
width: axis.size,
|
|
328
|
-
height: chartRect.height
|
|
329
|
-
};
|
|
330
|
-
} else {
|
|
331
|
-
// right - position to the right of the chart rect, accounting for user inset
|
|
332
|
-
const startX = chartRect.x + chartRect.width + offsetFromPreviousAxes;
|
|
333
|
-
return {
|
|
334
|
-
x: startX,
|
|
335
|
-
y: chartRect.y,
|
|
336
|
-
width: axis.size,
|
|
337
|
-
height: chartRect.height
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
}, [renderedAxes, chartRect, calculatedInset]);
|
|
341
|
-
const fontProvider = useMemo(() => {
|
|
342
|
-
if (fontProviderProp) return fontProviderProp;
|
|
343
|
-
return Skia.TypefaceFontProvider.Make();
|
|
344
|
-
}, [fontProviderProp]);
|
|
345
|
-
const contextValue = useMemo(() => ({
|
|
346
|
-
layout,
|
|
347
|
-
series: series != null ? series : [],
|
|
348
|
-
getSeries,
|
|
349
|
-
getSeriesData: getStackedSeriesData,
|
|
350
|
-
animate,
|
|
351
|
-
width: chartWidth,
|
|
352
|
-
height: chartHeight,
|
|
353
|
-
fontFamilies,
|
|
354
|
-
fontProvider,
|
|
355
|
-
getXAxis,
|
|
356
|
-
getYAxis,
|
|
357
|
-
getXScale,
|
|
358
|
-
getYScale,
|
|
359
|
-
getXSerializableScale,
|
|
360
|
-
getYSerializableScale,
|
|
361
|
-
drawingArea: chartRect,
|
|
362
|
-
dataLength,
|
|
363
|
-
registerAxis,
|
|
364
|
-
unregisterAxis,
|
|
365
|
-
getAxisBounds
|
|
366
|
-
}), [layout, series, getSeries, getStackedSeriesData, animate, chartWidth, chartHeight, fontFamilies, fontProvider, getXAxis, getYAxis, getXScale, getYScale, getXSerializableScale, getYSerializableScale, chartRect, dataLength, registerAxis, unregisterAxis, getAxisBounds]);
|
|
367
|
-
const rootStyles = useMemo(() => {
|
|
368
|
-
return [style, styles == null ? void 0 : styles.root];
|
|
369
|
-
}, [style, styles == null ? void 0 : styles.root]);
|
|
370
|
-
const legendElement = useMemo(() => {
|
|
371
|
-
if (!legend) return;
|
|
372
|
-
if (legend === true) {
|
|
373
|
-
const isHorizontal = legendPosition === 'top' || legendPosition === 'bottom';
|
|
374
|
-
const flexDirection = isHorizontal ? 'row' : 'column';
|
|
375
|
-
return /*#__PURE__*/_jsx(Legend, {
|
|
376
|
-
accessibilityLabel: legendAccessibilityLabel,
|
|
377
|
-
flexDirection: flexDirection
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
return legend;
|
|
381
|
-
}, [legend, legendAccessibilityLabel, legendPosition]);
|
|
382
|
-
const rootBoxProps = useMemo(() => _extends({
|
|
383
|
-
ref,
|
|
384
|
-
height,
|
|
385
|
-
style: rootStyles,
|
|
386
|
-
width
|
|
387
|
-
}, props), [ref, height, rootStyles, width, props]);
|
|
388
|
-
return /*#__PURE__*/_jsx(CartesianChartProvider, {
|
|
389
|
-
value: contextValue,
|
|
390
|
-
children: /*#__PURE__*/_jsx(ScrubberProvider, {
|
|
391
|
-
allowOverflowGestures: allowOverflowGestures,
|
|
392
|
-
enableScrubbing: enableScrubbing,
|
|
393
|
-
onScrubberPositionChange: onScrubberPositionChange,
|
|
394
|
-
children: legend ? /*#__PURE__*/_jsxs(Box, _extends({
|
|
395
|
-
flexDirection: legendPosition === 'top' || legendPosition === 'bottom' ? 'column' : 'row'
|
|
396
|
-
}, rootBoxProps, {
|
|
397
|
-
children: [(legendPosition === 'top' || legendPosition === 'left') && legendElement, /*#__PURE__*/_jsxs(Box, {
|
|
398
|
-
collapsable: collapsable,
|
|
399
|
-
onLayout: onContainerLayout,
|
|
400
|
-
style: {
|
|
401
|
-
flex: 1
|
|
402
|
-
},
|
|
403
|
-
children: [/*#__PURE__*/_jsx(ChartCanvas, {
|
|
404
|
-
accessibilityLabel: accessibilityLabel,
|
|
405
|
-
accessibilityLiveRegion: accessibilityLiveRegion,
|
|
406
|
-
accessible: accessible,
|
|
407
|
-
style: styles == null ? void 0 : styles.chart,
|
|
408
|
-
children: children
|
|
409
|
-
}), /*#__PURE__*/_jsx(ScrubberAccessibilityView, {
|
|
410
|
-
accessibilityLabel: getScrubberAccessibilityLabel,
|
|
411
|
-
accessibilityStep: scrubberAccessibilityLabelStep
|
|
412
|
-
})]
|
|
413
|
-
}), (legendPosition === 'bottom' || legendPosition === 'right') && legendElement]
|
|
414
|
-
})) : /*#__PURE__*/_jsxs(Box, _extends({
|
|
415
|
-
collapsable: collapsable,
|
|
416
|
-
onLayout: onContainerLayout
|
|
417
|
-
}, rootBoxProps, {
|
|
418
|
-
children: [/*#__PURE__*/_jsx(ChartCanvas, {
|
|
419
|
-
accessibilityLabel: accessibilityLabel,
|
|
420
|
-
accessibilityLiveRegion: accessibilityLiveRegion,
|
|
421
|
-
accessible: accessible,
|
|
422
|
-
style: styles == null ? void 0 : styles.chart,
|
|
423
|
-
children: children
|
|
424
|
-
}), /*#__PURE__*/_jsx(ScrubberAccessibilityView, {
|
|
425
|
-
accessibilityLabel: getScrubberAccessibilityLabel,
|
|
426
|
-
accessibilityStep: scrubberAccessibilityLabelStep
|
|
427
|
-
})]
|
|
428
|
-
}))
|
|
429
|
-
})
|
|
430
|
-
});
|
|
431
|
-
}));
|