@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
package/esm/sparkline/Counter.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import { useCounter } from '@coinbase/cds-common/visualizations/useCounter';
|
|
4
|
-
import { Box } from '@coinbase/cds-mobile/layout';
|
|
5
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
const styles = StyleSheet.create({
|
|
7
|
-
hidden: {
|
|
8
|
-
opacity: 0
|
|
9
|
-
},
|
|
10
|
-
visible: {
|
|
11
|
-
position: 'absolute',
|
|
12
|
-
top: 0,
|
|
13
|
-
left: 0,
|
|
14
|
-
display: 'flex'
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
export const Counter = _ref => {
|
|
18
|
-
let {
|
|
19
|
-
startNum,
|
|
20
|
-
endNum,
|
|
21
|
-
renderNum,
|
|
22
|
-
durationInMillis
|
|
23
|
-
} = _ref;
|
|
24
|
-
const count = useCounter({
|
|
25
|
-
startNum,
|
|
26
|
-
endNum,
|
|
27
|
-
durationInMillis
|
|
28
|
-
});
|
|
29
|
-
const renderFunction = useMemo(() => {
|
|
30
|
-
return num => {
|
|
31
|
-
return renderNum ? renderNum(num) : num;
|
|
32
|
-
};
|
|
33
|
-
}, [renderNum]);
|
|
34
|
-
return /*#__PURE__*/_jsxs(Box, {
|
|
35
|
-
alignSelf: "flex-start",
|
|
36
|
-
justifyContent: "center",
|
|
37
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
38
|
-
style: styles.hidden,
|
|
39
|
-
children: renderFunction(endNum)
|
|
40
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
41
|
-
style: styles.visible,
|
|
42
|
-
children: renderFunction(count)
|
|
43
|
-
})]
|
|
44
|
-
});
|
|
45
|
-
};
|
|
@@ -1,165 +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 React, { forwardRef, memo, useMemo, useRef } from 'react';
|
|
3
|
-
import { Defs, G, LinearGradient, Mask, Path, Rect, Stop, Svg } from 'react-native-svg';
|
|
4
|
-
import { getAccessibleForegroundGradient } from '@coinbase/cds-common/color/getAccessibleForegroundGradient';
|
|
5
|
-
import { borderWidth } from '@coinbase/cds-common/tokens/sparkline';
|
|
6
|
-
import { getAccessibleColor } from '@coinbase/cds-common/utils/getAccessibleColor';
|
|
7
|
-
import { getSparklineRange } from '@coinbase/cds-common/visualizations/getSparklineRange';
|
|
8
|
-
import { getSparklineTransform } from '@coinbase/cds-common/visualizations/getSparklineTransform';
|
|
9
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
10
|
-
import { generateRandomId } from '@coinbase/cds-utils';
|
|
11
|
-
import { generateSparklineAreaWithId } from './generateSparklineWithId';
|
|
12
|
-
import { SparklineAreaPattern } from './SparklineAreaPattern';
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Use LineChart instead. This will be removed in a future major release.
|
|
16
|
-
* @deprecationExpectedRemoval v4
|
|
17
|
-
*/
|
|
18
|
-
export const Sparkline = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
-
let {
|
|
20
|
-
background,
|
|
21
|
-
color,
|
|
22
|
-
height,
|
|
23
|
-
path,
|
|
24
|
-
width,
|
|
25
|
-
yAxisScalingFactor,
|
|
26
|
-
children,
|
|
27
|
-
strokeType = 'solid',
|
|
28
|
-
fillType = 'dotted'
|
|
29
|
-
} = _ref;
|
|
30
|
-
const theme = useTheme();
|
|
31
|
-
const patternId = useRef(generateRandomId());
|
|
32
|
-
const strokeColor = color !== 'auto' ? color : getAccessibleColor({
|
|
33
|
-
background: background != null ? background : theme.color.bg,
|
|
34
|
-
foreground: 'auto',
|
|
35
|
-
usage: 'graphic'
|
|
36
|
-
});
|
|
37
|
-
const translateProps = getSparklineTransform(width, height, yAxisScalingFactor);
|
|
38
|
-
const hasChildren = !!children;
|
|
39
|
-
const useModernFill = fillType === 'gradient' || fillType === 'gradientDotted';
|
|
40
|
-
|
|
41
|
-
// Stroke gradient (for strokeType='gradient')
|
|
42
|
-
const strokeGradient = useMemo(() => {
|
|
43
|
-
if (strokeType !== 'gradient') return null;
|
|
44
|
-
return getAccessibleForegroundGradient({
|
|
45
|
-
background: background != null ? background : theme.color.bg,
|
|
46
|
-
color,
|
|
47
|
-
colorScheme: theme.activeColorScheme,
|
|
48
|
-
usage: 'graphic'
|
|
49
|
-
});
|
|
50
|
-
}, [strokeType, background, color, theme]);
|
|
51
|
-
|
|
52
|
-
// Calculate gradient coordinates for modern fills
|
|
53
|
-
const {
|
|
54
|
-
gradientY1,
|
|
55
|
-
gradientY2
|
|
56
|
-
} = useMemo(() => {
|
|
57
|
-
if (!useModernFill) return {
|
|
58
|
-
gradientY1: 0,
|
|
59
|
-
gradientY2: 0
|
|
60
|
-
};
|
|
61
|
-
if (!Number.isFinite(yAxisScalingFactor)) {
|
|
62
|
-
return {
|
|
63
|
-
gradientY1: 2,
|
|
64
|
-
gradientY2: height - 2
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const {
|
|
68
|
-
yRange
|
|
69
|
-
} = getSparklineRange({
|
|
70
|
-
height,
|
|
71
|
-
width,
|
|
72
|
-
yAxisScalingFactor
|
|
73
|
-
});
|
|
74
|
-
const pathHeight = Math.abs(yRange[0] - yRange[1]);
|
|
75
|
-
const yTranslate = height / 2 - pathHeight / 2;
|
|
76
|
-
return {
|
|
77
|
-
gradientY1: yRange[1],
|
|
78
|
-
gradientY2: height - yTranslate
|
|
79
|
-
};
|
|
80
|
-
}, [useModernFill, height, width, yAxisScalingFactor]);
|
|
81
|
-
const maskGradientId = patternId.current + "-mask-gradient";
|
|
82
|
-
const maskId = patternId.current + "-mask";
|
|
83
|
-
const defs = useMemo(() => {
|
|
84
|
-
if (!strokeGradient && !hasChildren) return null;
|
|
85
|
-
return /*#__PURE__*/_jsxs(Defs, {
|
|
86
|
-
children: [strokeGradient && /*#__PURE__*/_jsx(LinearGradient, {
|
|
87
|
-
id: "gradient",
|
|
88
|
-
x1: "0%",
|
|
89
|
-
x2: "100%",
|
|
90
|
-
y1: "0%",
|
|
91
|
-
y2: "0%",
|
|
92
|
-
children: strokeGradient.map((item, i) => /*#__PURE__*/_jsx(Stop, {
|
|
93
|
-
offset: item.offset,
|
|
94
|
-
stopColor: item.color
|
|
95
|
-
}, i + "_" + item))
|
|
96
|
-
}), hasChildren && fillType === 'dotted' && /*#__PURE__*/_jsx(SparklineAreaPattern, {
|
|
97
|
-
color: strokeColor,
|
|
98
|
-
id: patternId.current
|
|
99
|
-
}), hasChildren && fillType === 'gradient' && /*#__PURE__*/_jsxs(LinearGradient, {
|
|
100
|
-
gradientUnits: "userSpaceOnUse",
|
|
101
|
-
id: patternId.current,
|
|
102
|
-
x1: "0",
|
|
103
|
-
x2: "0",
|
|
104
|
-
y1: gradientY1,
|
|
105
|
-
y2: gradientY2,
|
|
106
|
-
children: [/*#__PURE__*/_jsx(Stop, {
|
|
107
|
-
offset: "0%",
|
|
108
|
-
stopColor: strokeColor,
|
|
109
|
-
stopOpacity: 0.3
|
|
110
|
-
}), /*#__PURE__*/_jsx(Stop, {
|
|
111
|
-
offset: "100%",
|
|
112
|
-
stopColor: strokeColor,
|
|
113
|
-
stopOpacity: 0
|
|
114
|
-
})]
|
|
115
|
-
}), hasChildren && fillType === 'gradientDotted' && /*#__PURE__*/_jsxs(_Fragment, {
|
|
116
|
-
children: [/*#__PURE__*/_jsx(SparklineAreaPattern, {
|
|
117
|
-
color: strokeColor,
|
|
118
|
-
id: patternId.current,
|
|
119
|
-
opacity: 1
|
|
120
|
-
}), /*#__PURE__*/_jsxs(LinearGradient, {
|
|
121
|
-
gradientUnits: "userSpaceOnUse",
|
|
122
|
-
id: maskGradientId,
|
|
123
|
-
x1: "0",
|
|
124
|
-
x2: "0",
|
|
125
|
-
y1: gradientY1,
|
|
126
|
-
y2: gradientY2,
|
|
127
|
-
children: [/*#__PURE__*/_jsx(Stop, {
|
|
128
|
-
offset: "0%",
|
|
129
|
-
stopColor: "white",
|
|
130
|
-
stopOpacity: 1
|
|
131
|
-
}), /*#__PURE__*/_jsx(Stop, {
|
|
132
|
-
offset: "100%",
|
|
133
|
-
stopColor: "white",
|
|
134
|
-
stopOpacity: 0
|
|
135
|
-
})]
|
|
136
|
-
}), /*#__PURE__*/_jsx(Mask, {
|
|
137
|
-
id: maskId,
|
|
138
|
-
children: /*#__PURE__*/_jsx(Rect, {
|
|
139
|
-
fill: "url(#" + maskGradientId + ")",
|
|
140
|
-
height: height,
|
|
141
|
-
width: width
|
|
142
|
-
})
|
|
143
|
-
})]
|
|
144
|
-
})]
|
|
145
|
-
});
|
|
146
|
-
}, [strokeGradient, hasChildren, fillType, strokeColor, gradientY1, gradientY2, height, width, maskGradientId, maskId]);
|
|
147
|
-
const stroke = strokeType === 'gradient' ? 'url(#gradient)' : strokeColor;
|
|
148
|
-
const shouldPlaceDefsInside = useModernFill;
|
|
149
|
-
return /*#__PURE__*/_jsxs(Svg, {
|
|
150
|
-
fill: "none",
|
|
151
|
-
height: height,
|
|
152
|
-
width: width,
|
|
153
|
-
children: [!shouldPlaceDefsInside && defs, /*#__PURE__*/_jsxs(G, _extends({}, translateProps, {
|
|
154
|
-
children: [shouldPlaceDefsInside && defs, /*#__PURE__*/_jsx(Path, {
|
|
155
|
-
ref: ref,
|
|
156
|
-
d: path,
|
|
157
|
-
stroke: stroke,
|
|
158
|
-
strokeLinecap: "round",
|
|
159
|
-
strokeLinejoin: "round",
|
|
160
|
-
strokeWidth: borderWidth
|
|
161
|
-
}), generateSparklineAreaWithId(patternId.current, children, fillType === 'gradientDotted' ? maskId : undefined)]
|
|
162
|
-
}))]
|
|
163
|
-
});
|
|
164
|
-
}));
|
|
165
|
-
Sparkline.displayName = 'Sparkline';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, memo } from 'react';
|
|
2
|
-
import { Path } from 'react-native-svg';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated Use AreaChart instead. This will be removed in a future major release.
|
|
6
|
-
* @deprecationExpectedRemoval v4
|
|
7
|
-
*/
|
|
8
|
-
export const SparklineArea = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
9
|
-
let {
|
|
10
|
-
area,
|
|
11
|
-
patternId,
|
|
12
|
-
maskId
|
|
13
|
-
} = _ref;
|
|
14
|
-
return /*#__PURE__*/_jsx(Path, {
|
|
15
|
-
ref: ref,
|
|
16
|
-
d: area,
|
|
17
|
-
fill: "url(#" + patternId + ")",
|
|
18
|
-
mask: maskId ? "url(#" + maskId + ")" : undefined
|
|
19
|
-
});
|
|
20
|
-
}));
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Circle, G, Pattern, Rect } from 'react-native-svg';
|
|
3
|
-
import { useSparklineAreaOpacity } from '@coinbase/cds-common/visualizations/useSparklineAreaOpacity';
|
|
4
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
5
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export const SparklineAreaPattern = _ref => {
|
|
7
|
-
let {
|
|
8
|
-
color,
|
|
9
|
-
id,
|
|
10
|
-
opacity
|
|
11
|
-
} = _ref;
|
|
12
|
-
const {
|
|
13
|
-
activeColorScheme
|
|
14
|
-
} = useTheme();
|
|
15
|
-
const themeOpacity = useSparklineAreaOpacity(activeColorScheme);
|
|
16
|
-
const fillOpacity = opacity != null ? opacity : themeOpacity;
|
|
17
|
-
return /*#__PURE__*/_jsx(Pattern, {
|
|
18
|
-
height: "4",
|
|
19
|
-
id: id,
|
|
20
|
-
patternUnits: "userSpaceOnUse",
|
|
21
|
-
width: "4",
|
|
22
|
-
x: "0",
|
|
23
|
-
y: "0",
|
|
24
|
-
children: /*#__PURE__*/_jsxs(G, {
|
|
25
|
-
children: [/*#__PURE__*/_jsx(Rect, {
|
|
26
|
-
fill: "transparent",
|
|
27
|
-
height: "4",
|
|
28
|
-
width: "4"
|
|
29
|
-
}), /*#__PURE__*/_jsx(Circle, {
|
|
30
|
-
cx: "1",
|
|
31
|
-
cy: "1",
|
|
32
|
-
fill: color,
|
|
33
|
-
fillOpacity: fillOpacity,
|
|
34
|
-
r: "1"
|
|
35
|
-
})]
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
};
|
|
@@ -1,77 +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 React, { forwardRef, memo, useMemo, useRef } from 'react';
|
|
3
|
-
import { Defs, G, LinearGradient, Path, Stop, Svg } from 'react-native-svg';
|
|
4
|
-
import { getAccessibleForegroundGradient } from '@coinbase/cds-common/color/getAccessibleForegroundGradient';
|
|
5
|
-
import { borderWidth } from '@coinbase/cds-common/tokens/sparkline';
|
|
6
|
-
import { getAccessibleColor } from '@coinbase/cds-common/utils/getAccessibleColor';
|
|
7
|
-
import { getSparklineTransform } from '@coinbase/cds-common/visualizations/getSparklineTransform';
|
|
8
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
9
|
-
import { generateRandomId } from '@coinbase/cds-utils';
|
|
10
|
-
import { generateSparklineAreaWithId } from './generateSparklineWithId';
|
|
11
|
-
import { SparklineAreaPattern } from './SparklineAreaPattern';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use LineChart instead. This will be removed in a future major release.
|
|
15
|
-
* @deprecationExpectedRemoval v4
|
|
16
|
-
*/
|
|
17
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
export const SparklineGradient = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
19
|
-
let {
|
|
20
|
-
background,
|
|
21
|
-
color,
|
|
22
|
-
path,
|
|
23
|
-
height,
|
|
24
|
-
width,
|
|
25
|
-
yAxisScalingFactor,
|
|
26
|
-
children
|
|
27
|
-
} = _ref;
|
|
28
|
-
const theme = useTheme();
|
|
29
|
-
const patternId = useRef(generateRandomId());
|
|
30
|
-
const translateProps = getSparklineTransform(width, height, yAxisScalingFactor);
|
|
31
|
-
const gradient = getAccessibleForegroundGradient({
|
|
32
|
-
background: background != null ? background : theme.color.bg,
|
|
33
|
-
color,
|
|
34
|
-
colorScheme: theme.activeColorScheme,
|
|
35
|
-
usage: 'graphic'
|
|
36
|
-
});
|
|
37
|
-
const areaColor = color !== 'auto' ? color : getAccessibleColor({
|
|
38
|
-
background: background != null ? background : theme.color.bg,
|
|
39
|
-
foreground: 'auto',
|
|
40
|
-
usage: 'graphic'
|
|
41
|
-
});
|
|
42
|
-
const hasChildren = !!children;
|
|
43
|
-
const linearGradient = useMemo(() => {
|
|
44
|
-
return /*#__PURE__*/_jsxs(Defs, {
|
|
45
|
-
children: [/*#__PURE__*/_jsx(LinearGradient, {
|
|
46
|
-
id: "gradient",
|
|
47
|
-
x1: "0%",
|
|
48
|
-
x2: "100%",
|
|
49
|
-
y1: "0%",
|
|
50
|
-
y2: "0%",
|
|
51
|
-
children: gradient.map((item, i) => /*#__PURE__*/_jsx(Stop, {
|
|
52
|
-
offset: item.offset,
|
|
53
|
-
stopColor: item.color
|
|
54
|
-
}, i + "_" + item))
|
|
55
|
-
}), hasChildren && /*#__PURE__*/_jsx(SparklineAreaPattern, {
|
|
56
|
-
color: areaColor,
|
|
57
|
-
id: patternId.current
|
|
58
|
-
})]
|
|
59
|
-
});
|
|
60
|
-
}, [areaColor, hasChildren, gradient]);
|
|
61
|
-
return /*#__PURE__*/_jsxs(Svg, {
|
|
62
|
-
fill: "none",
|
|
63
|
-
height: height,
|
|
64
|
-
width: width,
|
|
65
|
-
children: [linearGradient, /*#__PURE__*/_jsxs(G, _extends({}, translateProps, {
|
|
66
|
-
children: [/*#__PURE__*/_jsx(Path, {
|
|
67
|
-
ref: ref,
|
|
68
|
-
d: path,
|
|
69
|
-
stroke: "url(#gradient)",
|
|
70
|
-
strokeLinecap: "round",
|
|
71
|
-
strokeLinejoin: "round",
|
|
72
|
-
strokeWidth: borderWidth
|
|
73
|
-
}), generateSparklineAreaWithId(patternId.current, children)]
|
|
74
|
-
}))]
|
|
75
|
-
});
|
|
76
|
-
}));
|
|
77
|
-
SparklineGradient.displayName = 'SparklineGradient';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';
|
|
3
|
-
import { figma } from '@figma/code-connect';
|
|
4
|
-
import { Sparkline } from '../Sparkline';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
figma.connect(Sparkline, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=320%3A15040', {
|
|
7
|
-
imports: ["import { Sparkline } from '@coinbase/cds-mobile-visualization'", "import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath'"],
|
|
8
|
-
example: function Example() {
|
|
9
|
-
const data = [20, 30, 5, 45, 0];
|
|
10
|
-
const path = useSparklinePath({
|
|
11
|
-
height: 200,
|
|
12
|
-
width: 200,
|
|
13
|
-
data
|
|
14
|
-
});
|
|
15
|
-
return /*#__PURE__*/_jsx(Sparkline, {
|
|
16
|
-
color: "auto",
|
|
17
|
-
height: 200,
|
|
18
|
-
path: path,
|
|
19
|
-
width: 400
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
});
|
|
@@ -1,124 +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 React from 'react';
|
|
3
|
-
import { Dimensions } from 'react-native';
|
|
4
|
-
import { assets } from '@coinbase/cds-common/internal/data/assets';
|
|
5
|
-
import { prices, pricesWithScalingFactor } from '@coinbase/cds-common/internal/data/prices';
|
|
6
|
-
import { gutter } from '@coinbase/cds-common/tokens/sizing';
|
|
7
|
-
import { useSparklineArea } from '@coinbase/cds-common/visualizations/useSparklineArea';
|
|
8
|
-
import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';
|
|
9
|
-
import { Cell } from '@coinbase/cds-mobile/cells/Cell';
|
|
10
|
-
import { CellMedia } from '@coinbase/cds-mobile/cells/CellMedia';
|
|
11
|
-
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
12
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
13
|
-
import { HStack } from '@coinbase/cds-mobile/layout/HStack';
|
|
14
|
-
import { VStack } from '@coinbase/cds-mobile/layout/VStack';
|
|
15
|
-
import { Text } from '@coinbase/cds-mobile/typography';
|
|
16
|
-
import { Sparkline } from '../Sparkline';
|
|
17
|
-
import { SparklineArea } from '../SparklineArea';
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
const SparklineExample = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
imageUrl,
|
|
22
|
-
name,
|
|
23
|
-
symbol,
|
|
24
|
-
color
|
|
25
|
-
} = _ref;
|
|
26
|
-
const dimensions = {
|
|
27
|
-
width: 64,
|
|
28
|
-
height: 20
|
|
29
|
-
};
|
|
30
|
-
const path = useSparklinePath(_extends({}, dimensions, {
|
|
31
|
-
data: prices
|
|
32
|
-
}));
|
|
33
|
-
return /*#__PURE__*/_jsx(Cell, {
|
|
34
|
-
detail: /*#__PURE__*/_jsxs(HStack, {
|
|
35
|
-
alignItems: "center",
|
|
36
|
-
children: [/*#__PURE__*/_jsx(Sparkline, _extends({}, dimensions, {
|
|
37
|
-
color: color,
|
|
38
|
-
path: path
|
|
39
|
-
})), /*#__PURE__*/_jsxs(VStack, {
|
|
40
|
-
alignContent: "flex-end",
|
|
41
|
-
alignItems: "flex-end",
|
|
42
|
-
justifyContent: "center",
|
|
43
|
-
paddingStart: 2,
|
|
44
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
45
|
-
align: "end",
|
|
46
|
-
font: "body",
|
|
47
|
-
numberOfLines: 1,
|
|
48
|
-
children: "$2,874.49"
|
|
49
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
50
|
-
align: "end",
|
|
51
|
-
color: "fgMuted",
|
|
52
|
-
font: "body",
|
|
53
|
-
numberOfLines: 1,
|
|
54
|
-
children: "+36.08%"
|
|
55
|
-
})]
|
|
56
|
-
})]
|
|
57
|
-
}),
|
|
58
|
-
media: /*#__PURE__*/_jsx(CellMedia, {
|
|
59
|
-
source: imageUrl,
|
|
60
|
-
title: "Title",
|
|
61
|
-
type: "image"
|
|
62
|
-
}),
|
|
63
|
-
children: /*#__PURE__*/_jsxs(VStack, {
|
|
64
|
-
justifyContent: "center",
|
|
65
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
66
|
-
ellipsize: "tail",
|
|
67
|
-
font: "headline",
|
|
68
|
-
numberOfLines: 1,
|
|
69
|
-
children: name
|
|
70
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
71
|
-
ellipsize: "tail",
|
|
72
|
-
font: "body",
|
|
73
|
-
numberOfLines: 1,
|
|
74
|
-
children: symbol
|
|
75
|
-
})]
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const SparklineScalingExample = props => {
|
|
80
|
-
const theme = useTheme();
|
|
81
|
-
const chartHorizontalGutter = theme.space[gutter];
|
|
82
|
-
const width = Dimensions.get('screen').width - chartHorizontalGutter * 2;
|
|
83
|
-
const dimensions = {
|
|
84
|
-
width,
|
|
85
|
-
height: 320
|
|
86
|
-
};
|
|
87
|
-
const path = useSparklinePath(_extends({}, dimensions, props));
|
|
88
|
-
const area = useSparklineArea(_extends({}, dimensions, props));
|
|
89
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
90
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
91
|
-
ellipsize: "tail",
|
|
92
|
-
font: "headline",
|
|
93
|
-
numberOfLines: 1,
|
|
94
|
-
children: ["Scale: ", props.yAxisScalingFactor]
|
|
95
|
-
}), /*#__PURE__*/_jsx(Sparkline, _extends({}, dimensions, {
|
|
96
|
-
color: "#F7931A",
|
|
97
|
-
path: path,
|
|
98
|
-
yAxisScalingFactor: props.yAxisScalingFactor,
|
|
99
|
-
children: props.fill && /*#__PURE__*/_jsx(SparklineArea, {
|
|
100
|
-
area: area
|
|
101
|
-
})
|
|
102
|
-
}))]
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
const PressableOpacityScreen = () => {
|
|
106
|
-
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
107
|
-
children: [/*#__PURE__*/_jsx(Example, {
|
|
108
|
-
title: "Sparkline",
|
|
109
|
-
children: /*#__PURE__*/_jsxs(VStack, {
|
|
110
|
-
marginX: -2,
|
|
111
|
-
children: [/*#__PURE__*/_jsx(SparklineExample, _extends({}, assets.btc)), /*#__PURE__*/_jsx(SparklineExample, _extends({}, assets.eth)), /*#__PURE__*/_jsx(SparklineExample, _extends({}, assets.xrp)), /*#__PURE__*/_jsx(SparklineExample, _extends({}, assets.dai)), /*#__PURE__*/_jsx(SparklineExample, _extends({}, assets.sushi))]
|
|
112
|
-
})
|
|
113
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
114
|
-
title: "SparklineWithScale",
|
|
115
|
-
children: pricesWithScalingFactor.map(item => /*#__PURE__*/_jsx(SparklineScalingExample, _extends({}, item), item.yAxisScalingFactor))
|
|
116
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
117
|
-
title: "SparklineWithScaleAndFill",
|
|
118
|
-
children: pricesWithScalingFactor.map(item => /*#__PURE__*/_jsx(SparklineScalingExample, _extends({}, item, {
|
|
119
|
-
fill: true
|
|
120
|
-
}), item.yAxisScalingFactor))
|
|
121
|
-
})]
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
export default PressableOpacityScreen;
|
|
@@ -1,126 +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 React from 'react';
|
|
3
|
-
import { Dimensions } from 'react-native';
|
|
4
|
-
import { assets } from '@coinbase/cds-common/internal/data/assets';
|
|
5
|
-
import { prices, pricesWithScalingFactor } from '@coinbase/cds-common/internal/data/prices';
|
|
6
|
-
import { gutter } from '@coinbase/cds-common/tokens/sizing';
|
|
7
|
-
import { useSparklineArea } from '@coinbase/cds-common/visualizations/useSparklineArea';
|
|
8
|
-
import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';
|
|
9
|
-
import { Cell } from '@coinbase/cds-mobile/cells/Cell';
|
|
10
|
-
import { CellMedia } from '@coinbase/cds-mobile/cells/CellMedia';
|
|
11
|
-
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
12
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
13
|
-
import { VStack } from '@coinbase/cds-mobile/layout';
|
|
14
|
-
import { Text } from '@coinbase/cds-mobile/typography';
|
|
15
|
-
import { SparklineArea } from '../SparklineArea';
|
|
16
|
-
import { SparklineGradient } from '../SparklineGradient';
|
|
17
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
-
const height = 320;
|
|
19
|
-
const SparklineGradientExample = _ref => {
|
|
20
|
-
let {
|
|
21
|
-
imageUrl,
|
|
22
|
-
name,
|
|
23
|
-
symbol,
|
|
24
|
-
color,
|
|
25
|
-
fill
|
|
26
|
-
} = _ref;
|
|
27
|
-
const theme = useTheme();
|
|
28
|
-
const chartHorizontalGutter = theme.space[gutter];
|
|
29
|
-
const width = Dimensions.get('screen').width - chartHorizontalGutter * 2;
|
|
30
|
-
const dimensions = {
|
|
31
|
-
width,
|
|
32
|
-
height
|
|
33
|
-
};
|
|
34
|
-
const path = useSparklinePath(_extends({}, dimensions, {
|
|
35
|
-
data: prices
|
|
36
|
-
}));
|
|
37
|
-
const area = useSparklineArea(_extends({}, dimensions, {
|
|
38
|
-
data: prices
|
|
39
|
-
}));
|
|
40
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
41
|
-
children: [/*#__PURE__*/_jsx(Cell, {
|
|
42
|
-
media: /*#__PURE__*/_jsx(CellMedia, {
|
|
43
|
-
source: imageUrl,
|
|
44
|
-
type: "image"
|
|
45
|
-
}),
|
|
46
|
-
children: /*#__PURE__*/_jsxs(VStack, {
|
|
47
|
-
justifyContent: "center",
|
|
48
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
49
|
-
ellipsize: "tail",
|
|
50
|
-
font: "headline",
|
|
51
|
-
numberOfLines: 1,
|
|
52
|
-
children: name
|
|
53
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
54
|
-
ellipsize: "tail",
|
|
55
|
-
font: "body",
|
|
56
|
-
numberOfLines: 1,
|
|
57
|
-
children: symbol
|
|
58
|
-
})]
|
|
59
|
-
})
|
|
60
|
-
}), /*#__PURE__*/_jsx(SparklineGradient, _extends({}, dimensions, {
|
|
61
|
-
color: color,
|
|
62
|
-
path: path,
|
|
63
|
-
children: fill && /*#__PURE__*/_jsx(SparklineArea, {
|
|
64
|
-
area: area
|
|
65
|
-
})
|
|
66
|
-
}))]
|
|
67
|
-
});
|
|
68
|
-
};
|
|
69
|
-
const SparklineScalingExample = props => {
|
|
70
|
-
const theme = useTheme();
|
|
71
|
-
const chartHorizontalGutter = theme.space[gutter];
|
|
72
|
-
const width = Dimensions.get('screen').width - chartHorizontalGutter * 2;
|
|
73
|
-
const dimensions = {
|
|
74
|
-
width,
|
|
75
|
-
height
|
|
76
|
-
};
|
|
77
|
-
const path = useSparklinePath(_extends({}, dimensions, props));
|
|
78
|
-
const area = useSparklineArea(_extends({}, dimensions, props));
|
|
79
|
-
return /*#__PURE__*/_jsxs(VStack, {
|
|
80
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
81
|
-
ellipsize: "tail",
|
|
82
|
-
font: "headline",
|
|
83
|
-
numberOfLines: 1,
|
|
84
|
-
children: ["Scale: ", props.yAxisScalingFactor]
|
|
85
|
-
}), /*#__PURE__*/_jsx(SparklineGradient, _extends({}, dimensions, {
|
|
86
|
-
color: "#F7931A",
|
|
87
|
-
path: path,
|
|
88
|
-
yAxisScalingFactor: props.yAxisScalingFactor,
|
|
89
|
-
children: props.fill && /*#__PURE__*/_jsx(SparklineArea, {
|
|
90
|
-
area: area
|
|
91
|
-
})
|
|
92
|
-
}))]
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
const PressableOpacityScreen = () => {
|
|
96
|
-
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
97
|
-
children: [/*#__PURE__*/_jsxs(Example, {
|
|
98
|
-
title: "SparklineGradient",
|
|
99
|
-
children: [/*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.btc)), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.eth)), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.ltc)), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.xrp)), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.dai)), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.sushi))]
|
|
100
|
-
}), /*#__PURE__*/_jsxs(Example, {
|
|
101
|
-
title: "SparklineGradientWithArea",
|
|
102
|
-
children: [/*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.btc, {
|
|
103
|
-
fill: true
|
|
104
|
-
})), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.eth, {
|
|
105
|
-
fill: true
|
|
106
|
-
})), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.ltc, {
|
|
107
|
-
fill: true
|
|
108
|
-
})), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.xrp, {
|
|
109
|
-
fill: true
|
|
110
|
-
})), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.dai, {
|
|
111
|
-
fill: true
|
|
112
|
-
})), /*#__PURE__*/_jsx(SparklineGradientExample, _extends({}, assets.sushi, {
|
|
113
|
-
fill: true
|
|
114
|
-
}))]
|
|
115
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
116
|
-
title: "SparklineGradientWithScale",
|
|
117
|
-
children: pricesWithScalingFactor.map(item => /*#__PURE__*/_jsx(SparklineScalingExample, _extends({}, item), item.yAxisScalingFactor))
|
|
118
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
119
|
-
title: "SparklineGradientWithAreaAndScale",
|
|
120
|
-
children: pricesWithScalingFactor.map(item => /*#__PURE__*/_jsx(SparklineScalingExample, _extends({}, item, {
|
|
121
|
-
fill: true
|
|
122
|
-
}), item.yAxisScalingFactor))
|
|
123
|
-
})]
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
export default PressableOpacityScreen;
|