@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,420 +0,0 @@
|
|
|
1
|
-
const _excluded = ["label"],
|
|
2
|
-
_excluded2 = ["label", "font", "hideDot", "style"];
|
|
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
|
-
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); }
|
|
5
|
-
import { forwardRef, memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
6
|
-
import { ScrollView, View } from 'react-native';
|
|
7
|
-
import { interpolateColor, runOnJS, useAnimatedReaction, useSharedValue, withSpring } from 'react-native-reanimated';
|
|
8
|
-
import { assets } from '@coinbase/cds-common/internal/data/assets';
|
|
9
|
-
import { useTabsContext } from '@coinbase/cds-common/tabs/TabsContext';
|
|
10
|
-
import { IconButton } from '@coinbase/cds-mobile/buttons';
|
|
11
|
-
import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
|
|
12
|
-
import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
|
|
13
|
-
import { Icon } from '@coinbase/cds-mobile/icons';
|
|
14
|
-
import { HStack } from '@coinbase/cds-mobile/layout';
|
|
15
|
-
import { SegmentedTab } from '@coinbase/cds-mobile/tabs/SegmentedTab';
|
|
16
|
-
import { tabsSpringConfig } from '@coinbase/cds-mobile/tabs/Tabs';
|
|
17
|
-
import { Text } from '@coinbase/cds-mobile/typography';
|
|
18
|
-
import { LiveTabLabel, PeriodSelector, PeriodSelectorActiveIndicator } from '../PeriodSelector';
|
|
19
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
const PeriodSelectorExample = () => {
|
|
21
|
-
const tabs = [{
|
|
22
|
-
id: '1H',
|
|
23
|
-
label: '1H'
|
|
24
|
-
}, {
|
|
25
|
-
id: '1D',
|
|
26
|
-
label: '1D'
|
|
27
|
-
}, {
|
|
28
|
-
id: '1W',
|
|
29
|
-
label: '1W'
|
|
30
|
-
}, {
|
|
31
|
-
id: '1M',
|
|
32
|
-
label: '1M'
|
|
33
|
-
}, {
|
|
34
|
-
id: '1Y',
|
|
35
|
-
label: '1Y'
|
|
36
|
-
}, {
|
|
37
|
-
id: 'All',
|
|
38
|
-
label: 'All'
|
|
39
|
-
}];
|
|
40
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
41
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
42
|
-
activeTab: activeTab,
|
|
43
|
-
onChange: tab => setActiveTab(tab),
|
|
44
|
-
tabs: tabs
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
const MinWidthPeriodSelectorExample = () => {
|
|
48
|
-
const tabs = [{
|
|
49
|
-
id: '1H',
|
|
50
|
-
label: '1H'
|
|
51
|
-
}, {
|
|
52
|
-
id: '1D',
|
|
53
|
-
label: '1D'
|
|
54
|
-
}, {
|
|
55
|
-
id: '1W',
|
|
56
|
-
label: '1W'
|
|
57
|
-
}, {
|
|
58
|
-
id: '1M',
|
|
59
|
-
label: '1M'
|
|
60
|
-
}, {
|
|
61
|
-
id: '1Y',
|
|
62
|
-
label: '1Y'
|
|
63
|
-
}, {
|
|
64
|
-
id: 'All',
|
|
65
|
-
label: 'All'
|
|
66
|
-
}];
|
|
67
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
68
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
69
|
-
activeTab: activeTab,
|
|
70
|
-
gap: 0.5,
|
|
71
|
-
onChange: tab => setActiveTab(tab),
|
|
72
|
-
tabs: tabs,
|
|
73
|
-
width: "fit-content"
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
const PaddedPeriodSelectorExample = () => {
|
|
77
|
-
const tabs = [{
|
|
78
|
-
id: '1W',
|
|
79
|
-
label: '1W'
|
|
80
|
-
}, {
|
|
81
|
-
id: '1M',
|
|
82
|
-
label: '1M'
|
|
83
|
-
}, {
|
|
84
|
-
id: 'YTD',
|
|
85
|
-
label: 'YTD'
|
|
86
|
-
}];
|
|
87
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
88
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
89
|
-
activeTab: activeTab,
|
|
90
|
-
gap: 2,
|
|
91
|
-
onChange: tab => setActiveTab(tab),
|
|
92
|
-
padding: 3,
|
|
93
|
-
tabs: tabs,
|
|
94
|
-
width: "fit-content"
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
const LivePeriodSelectorExample = () => {
|
|
98
|
-
const tabs = useMemo(() => [{
|
|
99
|
-
id: '1H',
|
|
100
|
-
label: /*#__PURE__*/_jsx(LiveTabLabel, {})
|
|
101
|
-
}, {
|
|
102
|
-
id: '1D',
|
|
103
|
-
label: '1D'
|
|
104
|
-
}, {
|
|
105
|
-
id: '1W',
|
|
106
|
-
label: '1W'
|
|
107
|
-
}, {
|
|
108
|
-
id: '1M',
|
|
109
|
-
label: '1M'
|
|
110
|
-
}, {
|
|
111
|
-
id: '1Y',
|
|
112
|
-
label: '1Y'
|
|
113
|
-
}, {
|
|
114
|
-
id: 'All',
|
|
115
|
-
label: 'All'
|
|
116
|
-
}], []);
|
|
117
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
118
|
-
const isLive = useMemo(() => (activeTab == null ? void 0 : activeTab.id) === '1H', [activeTab]);
|
|
119
|
-
const activeBackground = useMemo(() => !isLive ? 'bgPrimaryWash' : 'bgNegativeWash', [isLive]);
|
|
120
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
121
|
-
activeBackground: activeBackground,
|
|
122
|
-
activeTab: activeTab,
|
|
123
|
-
onChange: setActiveTab,
|
|
124
|
-
tabs: tabs
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
const TooManyPeriodsSelectorExample = () => {
|
|
128
|
-
const tabs = useMemo(() => [{
|
|
129
|
-
id: '1H',
|
|
130
|
-
label: /*#__PURE__*/_jsx(LiveTabLabel, {})
|
|
131
|
-
}, {
|
|
132
|
-
id: '1D',
|
|
133
|
-
label: '1D'
|
|
134
|
-
}, {
|
|
135
|
-
id: '1W',
|
|
136
|
-
label: '1W'
|
|
137
|
-
}, {
|
|
138
|
-
id: '1M',
|
|
139
|
-
label: '1M'
|
|
140
|
-
}, {
|
|
141
|
-
id: 'YTD',
|
|
142
|
-
label: 'YTD'
|
|
143
|
-
}, {
|
|
144
|
-
id: '1Y',
|
|
145
|
-
label: '1Y'
|
|
146
|
-
}, {
|
|
147
|
-
id: '5Y',
|
|
148
|
-
label: '5Y'
|
|
149
|
-
}, {
|
|
150
|
-
id: 'All',
|
|
151
|
-
label: 'All'
|
|
152
|
-
}], []);
|
|
153
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
154
|
-
const isLive = useMemo(() => (activeTab == null ? void 0 : activeTab.id) === '1H', [activeTab]);
|
|
155
|
-
const activeBackground = useMemo(() => !isLive ? 'bgPrimaryWash' : 'bgNegativeWash', [isLive]);
|
|
156
|
-
return /*#__PURE__*/_jsxs(HStack, {
|
|
157
|
-
alignItems: "center",
|
|
158
|
-
justifyContent: "space-between",
|
|
159
|
-
maxWidth: "100%",
|
|
160
|
-
width: "100%",
|
|
161
|
-
children: [/*#__PURE__*/_jsx(ScrollView, {
|
|
162
|
-
horizontal: true,
|
|
163
|
-
contentContainerStyle: {
|
|
164
|
-
paddingEnd: 8,
|
|
165
|
-
flexGrow: 1
|
|
166
|
-
},
|
|
167
|
-
showsHorizontalScrollIndicator: false,
|
|
168
|
-
children: /*#__PURE__*/_jsx(PeriodSelector, {
|
|
169
|
-
activeBackground: activeBackground,
|
|
170
|
-
activeTab: activeTab,
|
|
171
|
-
gap: 1,
|
|
172
|
-
justifyContent: "flex-start",
|
|
173
|
-
onChange: setActiveTab,
|
|
174
|
-
tabs: tabs,
|
|
175
|
-
width: "fit-content"
|
|
176
|
-
})
|
|
177
|
-
}), /*#__PURE__*/_jsx(IconButton, {
|
|
178
|
-
compact: true,
|
|
179
|
-
accessibilityLabel: "Configure chart",
|
|
180
|
-
flexShrink: 0,
|
|
181
|
-
name: "filter",
|
|
182
|
-
variant: "secondary"
|
|
183
|
-
})]
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
const btcColor = assets.btc.color;
|
|
187
|
-
const BTCActiveIndicator = /*#__PURE__*/memo(props => {
|
|
188
|
-
const theme = useTheme();
|
|
189
|
-
const {
|
|
190
|
-
activeTab
|
|
191
|
-
} = useTabsContext();
|
|
192
|
-
const isLive = useMemo(() => (activeTab == null ? void 0 : activeTab.id) === '1H', [activeTab]);
|
|
193
|
-
const backgroundColor = useMemo(() => isLive ? theme.color.bgNegativeWash : btcColor + "1A", [isLive, theme.color.bgNegativeWash]);
|
|
194
|
-
return /*#__PURE__*/_jsx(PeriodSelectorActiveIndicator, _extends({}, props, {
|
|
195
|
-
background: backgroundColor
|
|
196
|
-
}));
|
|
197
|
-
});
|
|
198
|
-
const BTCActiveExcludingLiveIndicator = /*#__PURE__*/memo(props => {
|
|
199
|
-
const theme = useTheme();
|
|
200
|
-
const {
|
|
201
|
-
activeTab
|
|
202
|
-
} = useTabsContext();
|
|
203
|
-
const isLive = useMemo(() => (activeTab == null ? void 0 : activeTab.id) === '1H', [activeTab]);
|
|
204
|
-
const backgroundColor = useMemo(() => isLive ? theme.color.bgNegativeWash : btcColor + "1A", [isLive, theme.color.bgNegativeWash]);
|
|
205
|
-
return /*#__PURE__*/_jsx(PeriodSelectorActiveIndicator, _extends({}, props, {
|
|
206
|
-
background: backgroundColor
|
|
207
|
-
}));
|
|
208
|
-
});
|
|
209
|
-
const BTCTab = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
210
|
-
let {
|
|
211
|
-
label
|
|
212
|
-
} = _ref,
|
|
213
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
214
|
-
const {
|
|
215
|
-
activeTab
|
|
216
|
-
} = useTabsContext();
|
|
217
|
-
const isActive = (activeTab == null ? void 0 : activeTab.id) === props.id;
|
|
218
|
-
const theme = useTheme();
|
|
219
|
-
|
|
220
|
-
// If label is already a React element (like LiveTabLabel), pass it through directly
|
|
221
|
-
// For string labels, wrap with custom BTC color when active
|
|
222
|
-
const wrappedLabel = typeof label === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
223
|
-
dangerouslySetColor: isActive ? btcColor : theme.color.fg,
|
|
224
|
-
font: "label1",
|
|
225
|
-
children: label
|
|
226
|
-
}) : label;
|
|
227
|
-
return /*#__PURE__*/_jsx(SegmentedTab, _extends({
|
|
228
|
-
ref: ref,
|
|
229
|
-
label: wrappedLabel
|
|
230
|
-
}, props));
|
|
231
|
-
}));
|
|
232
|
-
const BTCLiveLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
233
|
-
let {
|
|
234
|
-
label = 'LIVE',
|
|
235
|
-
font = 'label1',
|
|
236
|
-
hideDot,
|
|
237
|
-
style
|
|
238
|
-
} = _ref2,
|
|
239
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
240
|
-
const theme = useTheme();
|
|
241
|
-
const dotStyle = useMemo(() => ({
|
|
242
|
-
width: theme.space[1],
|
|
243
|
-
height: theme.space[1],
|
|
244
|
-
borderRadius: 1000,
|
|
245
|
-
marginRight: theme.space[0.75],
|
|
246
|
-
backgroundColor: btcColor
|
|
247
|
-
}), [theme.space]);
|
|
248
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
249
|
-
ref: ref,
|
|
250
|
-
style: [{
|
|
251
|
-
flexDirection: 'row',
|
|
252
|
-
alignItems: 'center'
|
|
253
|
-
}, style],
|
|
254
|
-
children: [!hideDot && /*#__PURE__*/_jsx(View, {
|
|
255
|
-
style: dotStyle
|
|
256
|
-
}), /*#__PURE__*/_jsx(Text, _extends({
|
|
257
|
-
font: font,
|
|
258
|
-
style: {
|
|
259
|
-
color: btcColor
|
|
260
|
-
}
|
|
261
|
-
}, props, {
|
|
262
|
-
children: label
|
|
263
|
-
}))]
|
|
264
|
-
});
|
|
265
|
-
}));
|
|
266
|
-
const ColoredPeriodSelectorExample = () => {
|
|
267
|
-
const tabs = [{
|
|
268
|
-
id: '1H',
|
|
269
|
-
label: /*#__PURE__*/_jsx(BTCLiveLabel, {})
|
|
270
|
-
}, {
|
|
271
|
-
id: '1D',
|
|
272
|
-
label: '1D'
|
|
273
|
-
}, {
|
|
274
|
-
id: '1W',
|
|
275
|
-
label: '1W'
|
|
276
|
-
}, {
|
|
277
|
-
id: '1M',
|
|
278
|
-
label: '1M'
|
|
279
|
-
}, {
|
|
280
|
-
id: '1Y',
|
|
281
|
-
label: '1Y'
|
|
282
|
-
}, {
|
|
283
|
-
id: 'All',
|
|
284
|
-
label: 'All'
|
|
285
|
-
}];
|
|
286
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
287
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
288
|
-
TabComponent: BTCTab,
|
|
289
|
-
TabsActiveIndicatorComponent: BTCActiveIndicator,
|
|
290
|
-
activeTab: activeTab,
|
|
291
|
-
onChange: tab => setActiveTab(tab),
|
|
292
|
-
tabs: tabs
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
const ColoredExcludingLivePeriodSelectorExample = () => {
|
|
296
|
-
const tabs = [{
|
|
297
|
-
id: '1H',
|
|
298
|
-
label: /*#__PURE__*/_jsx(LiveTabLabel, {})
|
|
299
|
-
}, {
|
|
300
|
-
id: '1D',
|
|
301
|
-
label: '1D'
|
|
302
|
-
}, {
|
|
303
|
-
id: '1W',
|
|
304
|
-
label: '1W'
|
|
305
|
-
}, {
|
|
306
|
-
id: '1M',
|
|
307
|
-
label: '1M'
|
|
308
|
-
}, {
|
|
309
|
-
id: '1Y',
|
|
310
|
-
label: '1Y'
|
|
311
|
-
}, {
|
|
312
|
-
id: 'All',
|
|
313
|
-
label: 'All'
|
|
314
|
-
}];
|
|
315
|
-
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
316
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
317
|
-
TabComponent: BTCTab,
|
|
318
|
-
TabsActiveIndicatorComponent: BTCActiveExcludingLiveIndicator,
|
|
319
|
-
activeTab: activeTab,
|
|
320
|
-
onChange: tab => setActiveTab(tab),
|
|
321
|
-
tabs: tabs
|
|
322
|
-
});
|
|
323
|
-
};
|
|
324
|
-
const ColoredIcon = /*#__PURE__*/memo(_ref3 => {
|
|
325
|
-
let {
|
|
326
|
-
tabId,
|
|
327
|
-
name
|
|
328
|
-
} = _ref3;
|
|
329
|
-
const {
|
|
330
|
-
activeTab
|
|
331
|
-
} = useTabsContext();
|
|
332
|
-
const isActive = (activeTab == null ? void 0 : activeTab.id) === tabId;
|
|
333
|
-
const theme = useTheme();
|
|
334
|
-
const progress = useSharedValue(isActive ? 1 : 0);
|
|
335
|
-
const [color, setColor] = useState(isActive ? theme.color.fgPrimary : theme.color.fg);
|
|
336
|
-
useEffect(() => {
|
|
337
|
-
progress.value = withSpring(isActive ? 1 : 0, tabsSpringConfig);
|
|
338
|
-
}, [isActive, progress]);
|
|
339
|
-
useAnimatedReaction(() => interpolateColor(progress.value, [0, 1], [theme.color.fg, theme.color.fgPrimary]), newColor => {
|
|
340
|
-
runOnJS(setColor)(newColor);
|
|
341
|
-
});
|
|
342
|
-
return /*#__PURE__*/_jsx(Icon, {
|
|
343
|
-
active: true,
|
|
344
|
-
name: name,
|
|
345
|
-
size: "s",
|
|
346
|
-
styles: {
|
|
347
|
-
icon: {
|
|
348
|
-
color
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
function IconsPeriodSelectorExample() {
|
|
354
|
-
const theme = useTheme();
|
|
355
|
-
const tabs = [{
|
|
356
|
-
id: 'buy',
|
|
357
|
-
label: /*#__PURE__*/_jsx(ColoredIcon, {
|
|
358
|
-
name: "chartLine",
|
|
359
|
-
tabId: "buy"
|
|
360
|
-
})
|
|
361
|
-
}, {
|
|
362
|
-
id: 'sell',
|
|
363
|
-
label: /*#__PURE__*/_jsx(ColoredIcon, {
|
|
364
|
-
name: "chartCandles",
|
|
365
|
-
tabId: "sell"
|
|
366
|
-
})
|
|
367
|
-
}, {
|
|
368
|
-
id: 'convert',
|
|
369
|
-
label: /*#__PURE__*/_jsx(ColoredIcon, {
|
|
370
|
-
name: "chartBar",
|
|
371
|
-
tabId: "convert"
|
|
372
|
-
})
|
|
373
|
-
}];
|
|
374
|
-
const [activeTab, updateActiveTab] = useState(tabs[0]);
|
|
375
|
-
const handleChange = useCallback(activeTab => updateActiveTab(activeTab), []);
|
|
376
|
-
return /*#__PURE__*/_jsx(PeriodSelector, {
|
|
377
|
-
accessibilityLabel: "Switch token action views",
|
|
378
|
-
activeTab: activeTab,
|
|
379
|
-
borderRadius: 300,
|
|
380
|
-
gap: 0.5,
|
|
381
|
-
onChange: handleChange,
|
|
382
|
-
padding: 0.5,
|
|
383
|
-
styles: {
|
|
384
|
-
activeIndicator: {
|
|
385
|
-
borderRadius: theme.borderRadius[200]
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
tabs: tabs,
|
|
389
|
-
width: "fit-content"
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
export default function All() {
|
|
393
|
-
return /*#__PURE__*/_jsxs(ExampleScreen, {
|
|
394
|
-
children: [/*#__PURE__*/_jsx(Example, {
|
|
395
|
-
title: "Basic",
|
|
396
|
-
children: /*#__PURE__*/_jsx(PeriodSelectorExample, {})
|
|
397
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
398
|
-
title: "Min Width",
|
|
399
|
-
children: /*#__PURE__*/_jsx(MinWidthPeriodSelectorExample, {})
|
|
400
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
401
|
-
title: "Live Period",
|
|
402
|
-
children: /*#__PURE__*/_jsx(LivePeriodSelectorExample, {})
|
|
403
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
404
|
-
title: "Too Many Periods",
|
|
405
|
-
children: /*#__PURE__*/_jsx(TooManyPeriodsSelectorExample, {})
|
|
406
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
407
|
-
title: "Colored (BTC)",
|
|
408
|
-
children: /*#__PURE__*/_jsx(ColoredPeriodSelectorExample, {})
|
|
409
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
410
|
-
title: "Colored Excluding Live",
|
|
411
|
-
children: /*#__PURE__*/_jsx(ColoredExcludingLivePeriodSelectorExample, {})
|
|
412
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
413
|
-
title: "With Padding",
|
|
414
|
-
children: /*#__PURE__*/_jsx(PaddedPeriodSelectorExample, {})
|
|
415
|
-
}), /*#__PURE__*/_jsx(Example, {
|
|
416
|
-
title: "With Icons",
|
|
417
|
-
children: /*#__PURE__*/_jsx(IconsPeriodSelectorExample, {})
|
|
418
|
-
})]
|
|
419
|
-
});
|
|
420
|
-
}
|
package/esm/chart/area/Area.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React, { memo, useMemo } from 'react';
|
|
2
|
-
import { useCartesianChartContext } from '../ChartProvider';
|
|
3
|
-
import { getAreaPath } from '../utils';
|
|
4
|
-
import { DottedArea } from './DottedArea';
|
|
5
|
-
import { GradientArea } from './GradientArea';
|
|
6
|
-
import { SolidArea } from './SolidArea';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
export const Area = /*#__PURE__*/memo(_ref => {
|
|
9
|
-
let {
|
|
10
|
-
seriesId,
|
|
11
|
-
curve = 'bump',
|
|
12
|
-
type = 'solid',
|
|
13
|
-
AreaComponent: AreaComponentProp,
|
|
14
|
-
fill: fillProp,
|
|
15
|
-
fillOpacity = 1,
|
|
16
|
-
connectNulls,
|
|
17
|
-
gradient: gradientProp,
|
|
18
|
-
transitions,
|
|
19
|
-
transition,
|
|
20
|
-
animate
|
|
21
|
-
} = _ref;
|
|
22
|
-
const {
|
|
23
|
-
layout,
|
|
24
|
-
getSeries,
|
|
25
|
-
getSeriesData,
|
|
26
|
-
getXScale,
|
|
27
|
-
getYScale,
|
|
28
|
-
getXAxis,
|
|
29
|
-
getYAxis
|
|
30
|
-
} = useCartesianChartContext();
|
|
31
|
-
const matchedSeries = useMemo(() => getSeries(seriesId), [seriesId, getSeries]);
|
|
32
|
-
const gradient = useMemo(() => gradientProp != null ? gradientProp : matchedSeries == null ? void 0 : matchedSeries.gradient, [gradientProp, matchedSeries == null ? void 0 : matchedSeries.gradient]);
|
|
33
|
-
const fill = useMemo(() => fillProp != null ? fillProp : matchedSeries == null ? void 0 : matchedSeries.color, [fillProp, matchedSeries == null ? void 0 : matchedSeries.color]);
|
|
34
|
-
const sourceData = useMemo(() => getSeriesData(seriesId), [seriesId, getSeriesData]);
|
|
35
|
-
const xAxis = getXAxis(matchedSeries == null ? void 0 : matchedSeries.xAxisId);
|
|
36
|
-
const xScale = getXScale(matchedSeries == null ? void 0 : matchedSeries.xAxisId);
|
|
37
|
-
const yScale = getYScale(matchedSeries == null ? void 0 : matchedSeries.yAxisId);
|
|
38
|
-
const yAxis = getYAxis(matchedSeries == null ? void 0 : matchedSeries.yAxisId);
|
|
39
|
-
const categoryAxisIsX = useMemo(() => {
|
|
40
|
-
return layout !== 'horizontal';
|
|
41
|
-
}, [layout]);
|
|
42
|
-
const categoryAxis = useMemo(() => {
|
|
43
|
-
return categoryAxisIsX ? xAxis : yAxis;
|
|
44
|
-
}, [categoryAxisIsX, xAxis, yAxis]);
|
|
45
|
-
const area = useMemo(() => {
|
|
46
|
-
if (!sourceData || sourceData.length === 0 || !xScale || !yScale) return '';
|
|
47
|
-
const indexData = categoryAxis != null && categoryAxis.data && Array.isArray(categoryAxis.data) && typeof categoryAxis.data[0] === 'number' ? categoryAxis.data : undefined;
|
|
48
|
-
return getAreaPath({
|
|
49
|
-
data: sourceData,
|
|
50
|
-
xScale,
|
|
51
|
-
yScale,
|
|
52
|
-
curve,
|
|
53
|
-
xData: categoryAxisIsX ? indexData : undefined,
|
|
54
|
-
yData: !categoryAxisIsX ? indexData : undefined,
|
|
55
|
-
connectNulls,
|
|
56
|
-
layout
|
|
57
|
-
});
|
|
58
|
-
}, [sourceData, xScale, yScale, curve, categoryAxis, categoryAxisIsX, connectNulls, layout]);
|
|
59
|
-
const AreaComponent = useMemo(() => {
|
|
60
|
-
if (AreaComponentProp) {
|
|
61
|
-
return AreaComponentProp;
|
|
62
|
-
}
|
|
63
|
-
switch (type) {
|
|
64
|
-
case 'dotted':
|
|
65
|
-
return DottedArea;
|
|
66
|
-
case 'gradient':
|
|
67
|
-
return GradientArea;
|
|
68
|
-
case 'solid':
|
|
69
|
-
default:
|
|
70
|
-
return SolidArea;
|
|
71
|
-
}
|
|
72
|
-
}, [AreaComponentProp, type]);
|
|
73
|
-
if (!xScale || !yScale || !sourceData || !area) return;
|
|
74
|
-
return /*#__PURE__*/_jsx(AreaComponent, {
|
|
75
|
-
animate: animate,
|
|
76
|
-
d: area,
|
|
77
|
-
fill: fill,
|
|
78
|
-
fillOpacity: fillOpacity,
|
|
79
|
-
gradient: gradient,
|
|
80
|
-
transition: transition,
|
|
81
|
-
transitions: transitions,
|
|
82
|
-
xAxisId: matchedSeries == null ? void 0 : matchedSeries.xAxisId,
|
|
83
|
-
yAxisId: matchedSeries == null ? void 0 : matchedSeries.yAxisId
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
const _excluded = ["series", "stacked", "AreaComponent", "curve", "fillOpacity", "type", "connectNulls", "transition", "transitions", "LineComponent", "strokeWidth", "showXAxis", "showYAxis", "showLines", "lineType", "xAxis", "yAxis", "inset", "children"],
|
|
2
|
-
_excluded2 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range", "baseline", "id"],
|
|
3
|
-
_excluded3 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range", "baseline", "id"],
|
|
4
|
-
_excluded4 = ["id", "data", "label", "color", "xAxisId", "yAxisId", "opacity", "LineComponent", "stackId"],
|
|
5
|
-
_excluded5 = ["id", "data", "label", "color", "xAxisId", "yAxisId", "fill", "fillOpacity", "stackId", "type"];
|
|
6
|
-
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); }
|
|
7
|
-
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; }
|
|
8
|
-
import { forwardRef, memo, useMemo } from 'react';
|
|
9
|
-
import { XAxis, YAxis } from '../axis';
|
|
10
|
-
import { CartesianChart } from '../CartesianChart';
|
|
11
|
-
import { Line } from '../line/Line';
|
|
12
|
-
import { defaultStackId, withBaselineDomain } from '../utils';
|
|
13
|
-
import { Area } from './Area';
|
|
14
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
-
let {
|
|
17
|
-
series,
|
|
18
|
-
stacked,
|
|
19
|
-
AreaComponent,
|
|
20
|
-
curve,
|
|
21
|
-
fillOpacity,
|
|
22
|
-
type,
|
|
23
|
-
connectNulls,
|
|
24
|
-
transition,
|
|
25
|
-
transitions,
|
|
26
|
-
LineComponent,
|
|
27
|
-
strokeWidth,
|
|
28
|
-
showXAxis,
|
|
29
|
-
showYAxis,
|
|
30
|
-
showLines,
|
|
31
|
-
lineType = 'solid',
|
|
32
|
-
xAxis,
|
|
33
|
-
yAxis,
|
|
34
|
-
inset,
|
|
35
|
-
children
|
|
36
|
-
} = _ref,
|
|
37
|
-
chartProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
38
|
-
// Convert AreaSeries to Series for Chart context
|
|
39
|
-
const chartSeries = useMemo(() => {
|
|
40
|
-
return series == null ? void 0 : series.map(s => ({
|
|
41
|
-
id: s.id,
|
|
42
|
-
data: s.data,
|
|
43
|
-
label: s.label,
|
|
44
|
-
color: s.color,
|
|
45
|
-
gradient: s.gradient,
|
|
46
|
-
xAxisId: s.xAxisId,
|
|
47
|
-
yAxisId: s.yAxisId,
|
|
48
|
-
stackId: s.stackId,
|
|
49
|
-
legendShape: s.legendShape
|
|
50
|
-
}));
|
|
51
|
-
}, [series]);
|
|
52
|
-
const transformedSeries = useMemo(() => {
|
|
53
|
-
if (!stacked || !chartSeries) return chartSeries;
|
|
54
|
-
return chartSeries.map(s => {
|
|
55
|
-
var _s$stackId;
|
|
56
|
-
return _extends({}, s, {
|
|
57
|
-
stackId: (_s$stackId = s.stackId) != null ? _s$stackId : defaultStackId
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}, [chartSeries, stacked]);
|
|
61
|
-
const seriesToRender = transformedSeries != null ? transformedSeries : chartSeries;
|
|
62
|
-
|
|
63
|
-
// Split axis props into config props for Chart and visual props for axis components
|
|
64
|
-
const _ref2 = xAxis || {},
|
|
65
|
-
{
|
|
66
|
-
scaleType: xScaleType,
|
|
67
|
-
data: xData,
|
|
68
|
-
categoryPadding: xCategoryPadding,
|
|
69
|
-
domain: xDomain,
|
|
70
|
-
domainLimit: xDomainLimit,
|
|
71
|
-
range: xRange,
|
|
72
|
-
baseline: xBaseline,
|
|
73
|
-
id: xAxisId
|
|
74
|
-
} = _ref2,
|
|
75
|
-
xAxisVisualProps = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
76
|
-
const _ref3 = yAxis || {},
|
|
77
|
-
{
|
|
78
|
-
scaleType: yScaleType,
|
|
79
|
-
data: yData,
|
|
80
|
-
categoryPadding: yCategoryPadding,
|
|
81
|
-
domain: yDomain,
|
|
82
|
-
domainLimit: yDomainLimit,
|
|
83
|
-
range: yRange,
|
|
84
|
-
baseline: yBaseline,
|
|
85
|
-
id: yAxisId
|
|
86
|
-
} = _ref3,
|
|
87
|
-
yAxisVisualProps = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
88
|
-
const isHorizontalLayout = chartProps.layout === 'horizontal';
|
|
89
|
-
const valueAxisBaseline = isHorizontalLayout ? xBaseline : yBaseline;
|
|
90
|
-
const xAxisConfig = {
|
|
91
|
-
scaleType: xScaleType,
|
|
92
|
-
data: xData,
|
|
93
|
-
categoryPadding: xCategoryPadding,
|
|
94
|
-
domain: isHorizontalLayout ? withBaselineDomain(xDomain, valueAxisBaseline) : xDomain,
|
|
95
|
-
domainLimit: xDomainLimit,
|
|
96
|
-
range: xRange,
|
|
97
|
-
baseline: xBaseline
|
|
98
|
-
};
|
|
99
|
-
const yAxisConfig = {
|
|
100
|
-
scaleType: yScaleType,
|
|
101
|
-
data: yData,
|
|
102
|
-
categoryPadding: yCategoryPadding,
|
|
103
|
-
domain: !isHorizontalLayout ? withBaselineDomain(yDomain, valueAxisBaseline) : yDomain,
|
|
104
|
-
domainLimit: yDomainLimit,
|
|
105
|
-
range: yRange,
|
|
106
|
-
baseline: yBaseline
|
|
107
|
-
};
|
|
108
|
-
return /*#__PURE__*/_jsxs(CartesianChart, _extends({}, chartProps, {
|
|
109
|
-
ref: ref,
|
|
110
|
-
inset: inset,
|
|
111
|
-
series: seriesToRender,
|
|
112
|
-
xAxis: xAxisConfig,
|
|
113
|
-
yAxis: yAxisConfig,
|
|
114
|
-
children: [showXAxis && /*#__PURE__*/_jsx(XAxis, _extends({
|
|
115
|
-
axisId: xAxisId
|
|
116
|
-
}, xAxisVisualProps)), showYAxis && /*#__PURE__*/_jsx(YAxis, _extends({
|
|
117
|
-
axisId: yAxisId
|
|
118
|
-
}, yAxisVisualProps)), series == null ? void 0 : series.map(_ref4 => {
|
|
119
|
-
let {
|
|
120
|
-
id
|
|
121
|
-
} = _ref4,
|
|
122
|
-
areaPropsFromSeries = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
123
|
-
return /*#__PURE__*/_jsx(Area, _extends({
|
|
124
|
-
AreaComponent: AreaComponent,
|
|
125
|
-
connectNulls: connectNulls,
|
|
126
|
-
curve: curve,
|
|
127
|
-
fillOpacity: fillOpacity,
|
|
128
|
-
seriesId: id,
|
|
129
|
-
transition: transition,
|
|
130
|
-
transitions: transitions,
|
|
131
|
-
type: type
|
|
132
|
-
}, areaPropsFromSeries), id);
|
|
133
|
-
}), showLines && (series == null ? void 0 : series.map(_ref5 => {
|
|
134
|
-
let {
|
|
135
|
-
id
|
|
136
|
-
|
|
137
|
-
// Area type (don't pass to Line)
|
|
138
|
-
} = _ref5,
|
|
139
|
-
otherPropsFromSeries = _objectWithoutPropertiesLoose(_ref5, _excluded5);
|
|
140
|
-
return /*#__PURE__*/_jsx(Line, _extends({
|
|
141
|
-
LineComponent: LineComponent,
|
|
142
|
-
connectNulls: connectNulls,
|
|
143
|
-
curve: curve,
|
|
144
|
-
seriesId: id,
|
|
145
|
-
strokeWidth: strokeWidth,
|
|
146
|
-
transition: transition,
|
|
147
|
-
transitions: transitions,
|
|
148
|
-
type: lineType
|
|
149
|
-
}, otherPropsFromSeries), id);
|
|
150
|
-
})), children]
|
|
151
|
-
}));
|
|
152
|
-
}));
|