@coinbase/cds-mobile-visualization 3.3.0 → 3.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dts/chart/CartesianChart.d.ts +101 -0
- package/dts/chart/CartesianChart.d.ts.map +1 -0
- package/dts/chart/ChartProvider.d.ts +6 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -0
- package/dts/chart/Path.d.ts +48 -0
- package/dts/chart/Path.d.ts.map +1 -0
- package/dts/chart/PeriodSelector.d.ts +85 -0
- package/dts/chart/PeriodSelector.d.ts.map +1 -0
- package/dts/chart/Point.d.ts +103 -0
- package/dts/chart/Point.d.ts.map +1 -0
- package/dts/chart/area/Area.d.ts +62 -0
- package/dts/chart/area/Area.d.ts.map +1 -0
- package/dts/chart/area/AreaChart.d.ts +90 -0
- package/dts/chart/area/AreaChart.d.ts.map +1 -0
- package/dts/chart/area/DottedArea.d.ts +27 -0
- package/dts/chart/area/DottedArea.d.ts.map +1 -0
- package/dts/chart/area/GradientArea.d.ts +30 -0
- package/dts/chart/area/GradientArea.d.ts.map +1 -0
- package/dts/chart/area/SolidArea.d.ts +8 -0
- package/dts/chart/area/SolidArea.d.ts.map +1 -0
- package/dts/chart/area/index.d.ts +6 -0
- package/dts/chart/area/index.d.ts.map +1 -0
- package/dts/chart/axis/Axis.d.ts +204 -0
- package/dts/chart/axis/Axis.d.ts.map +1 -0
- package/dts/chart/axis/XAxis.d.ts +16 -0
- package/dts/chart/axis/XAxis.d.ts.map +1 -0
- package/dts/chart/axis/YAxis.d.ts +21 -0
- package/dts/chart/axis/YAxis.d.ts.map +1 -0
- package/dts/chart/axis/index.d.ts +4 -0
- package/dts/chart/axis/index.d.ts.map +1 -0
- package/dts/chart/bar/Bar.d.ts +89 -0
- package/dts/chart/bar/Bar.d.ts.map +1 -0
- package/dts/chart/bar/BarChart.d.ts +97 -0
- package/dts/chart/bar/BarChart.d.ts.map +1 -0
- package/dts/chart/bar/BarPlot.d.ts +29 -0
- package/dts/chart/bar/BarPlot.d.ts.map +1 -0
- package/dts/chart/bar/BarStack.d.ts +111 -0
- package/dts/chart/bar/BarStack.d.ts.map +1 -0
- package/dts/chart/bar/BarStackGroup.d.ts +35 -0
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -0
- package/dts/chart/bar/DefaultBar.d.ts +7 -0
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -0
- package/dts/chart/bar/DefaultBarStack.d.ts +7 -0
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -0
- package/dts/chart/bar/index.d.ts +8 -0
- package/dts/chart/bar/index.d.ts.map +1 -0
- package/dts/chart/index.d.ts +13 -0
- package/dts/chart/index.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts +12 -0
- package/dts/chart/line/DottedLine.d.ts.map +1 -0
- package/dts/chart/line/GradientLine.d.ts +45 -0
- package/dts/chart/line/GradientLine.d.ts.map +1 -0
- package/dts/chart/line/Line.d.ts +78 -0
- package/dts/chart/line/Line.d.ts.map +1 -0
- package/dts/chart/line/LineChart.d.ts +84 -0
- package/dts/chart/line/LineChart.d.ts.map +1 -0
- package/dts/chart/line/ReferenceLine.d.ts +91 -0
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -0
- package/dts/chart/line/SolidLine.d.ts +12 -0
- package/dts/chart/line/SolidLine.d.ts.map +1 -0
- package/dts/chart/line/index.d.ts +7 -0
- package/dts/chart/line/index.d.ts.map +1 -0
- package/dts/chart/scrubber/Scrubber.d.ts +104 -0
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeacon.d.ts +75 -0
- package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberProvider.d.ts +17 -0
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -0
- package/dts/chart/scrubber/index.d.ts +2 -0
- package/dts/chart/scrubber/index.d.ts.map +1 -0
- package/dts/chart/text/ChartText.d.ts +90 -0
- package/dts/chart/text/ChartText.d.ts.map +1 -0
- package/dts/chart/text/SmartChartTextGroup.d.ts +55 -0
- package/dts/chart/text/SmartChartTextGroup.d.ts.map +1 -0
- package/dts/chart/text/index.d.ts +3 -0
- package/dts/chart/text/index.d.ts.map +1 -0
- package/dts/chart/utils/axis.d.ts +342 -0
- package/dts/chart/utils/axis.d.ts.map +1 -0
- package/dts/chart/utils/bar.d.ts +20 -0
- package/dts/chart/utils/bar.d.ts.map +1 -0
- package/dts/chart/utils/chart.d.ts +97 -0
- package/dts/chart/utils/chart.d.ts.map +1 -0
- package/dts/chart/utils/context.d.ts +95 -0
- package/dts/chart/utils/context.d.ts.map +1 -0
- package/dts/chart/utils/index.d.ts +8 -0
- package/dts/chart/utils/index.d.ts.map +1 -0
- package/dts/chart/utils/path.d.ts +107 -0
- package/dts/chart/utils/path.d.ts.map +1 -0
- package/dts/chart/utils/point.d.ts +75 -0
- package/dts/chart/utils/point.d.ts.map +1 -0
- package/dts/chart/utils/scale.d.ts +43 -0
- package/dts/chart/utils/scale.d.ts.map +1 -0
- package/dts/index.d.ts +2 -1
- package/dts/index.d.ts.map +1 -1
- package/dts/sparkline/Counter.d.ts +7 -2
- package/dts/sparkline/Sparkline.d.ts +67 -16
- package/dts/sparkline/Sparkline.d.ts.map +1 -1
- package/dts/sparkline/SparklineArea.d.ts +10 -4
- package/dts/sparkline/SparklineArea.d.ts.map +1 -1
- package/dts/sparkline/SparklineAreaPattern.d.ts +12 -4
- package/dts/sparkline/SparklineAreaPattern.d.ts.map +1 -1
- package/dts/sparkline/SparklineGradient.d.ts +21 -10
- package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
- package/dts/sparkline/__figma__/Sparkline.figma.d.ts +1 -1
- package/dts/sparkline/generateSparklineWithId.d.ts +8 -2
- package/dts/sparkline/generateSparklineWithId.d.ts.map +1 -1
- package/dts/sparkline/index.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts +8 -3
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +132 -110
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +22 -9
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +18 -7
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +9 -4
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +11 -6
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts +7 -5
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts +22 -10
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +21 -7
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +21 -16
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +29 -23
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +22 -14
- package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts +9 -5
- package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts +11 -6
- package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts +5 -2
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +17 -17
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts +16 -13
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +106 -98
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts +22 -19
- package/esm/chart/CartesianChart.js +241 -0
- package/esm/chart/ChartProvider.js +10 -0
- package/esm/chart/Path.js +133 -0
- package/esm/chart/PeriodSelector.js +136 -0
- package/esm/chart/Point.js +111 -0
- package/esm/chart/__stories__/CartesianChart.stories.js +476 -0
- package/esm/chart/__stories__/Chart.stories.js +79 -0
- package/esm/chart/__stories__/PeriodSelector.stories.js +294 -0
- package/esm/chart/area/Area.js +85 -0
- package/esm/chart/area/AreaChart.js +146 -0
- package/esm/chart/area/DottedArea.js +128 -0
- package/esm/chart/area/GradientArea.js +110 -0
- package/esm/chart/area/SolidArea.js +24 -0
- package/esm/chart/area/__stories__/AreaChart.stories.js +100 -0
- package/esm/chart/area/index.js +7 -0
- package/esm/chart/axis/Axis.js +43 -0
- package/esm/chart/axis/XAxis.js +181 -0
- package/esm/chart/axis/YAxis.js +170 -0
- package/esm/chart/axis/__stories__/Axis.stories.js +277 -0
- package/esm/chart/axis/index.js +5 -0
- package/esm/chart/bar/Bar.js +67 -0
- package/esm/chart/bar/BarChart.js +147 -0
- package/esm/chart/bar/BarPlot.js +96 -0
- package/esm/chart/bar/BarStack.js +514 -0
- package/esm/chart/bar/BarStackGroup.js +89 -0
- package/esm/chart/bar/DefaultBar.js +78 -0
- package/esm/chart/bar/DefaultBarStack.js +82 -0
- package/esm/chart/bar/__stories__/BarChart.stories.js +282 -0
- package/esm/chart/bar/index.js +9 -0
- package/esm/chart/index.js +14 -0
- package/esm/chart/line/DottedLine.js +35 -0
- package/esm/chart/line/GradientLine.js +62 -0
- package/esm/chart/line/Line.js +139 -0
- package/esm/chart/line/LineChart.js +115 -0
- package/esm/chart/line/ReferenceLine.js +115 -0
- package/esm/chart/line/SolidLine.js +31 -0
- package/esm/chart/line/__stories__/LineChart.stories.js +2248 -0
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +77 -0
- package/esm/chart/line/index.js +8 -0
- package/esm/chart/scrubber/Scrubber.js +186 -0
- package/esm/chart/scrubber/ScrubberBeacon.js +199 -0
- package/esm/chart/scrubber/ScrubberProvider.js +143 -0
- package/esm/chart/scrubber/index.js +2 -0
- package/esm/chart/text/ChartText.js +237 -0
- package/esm/chart/text/SmartChartTextGroup.js +210 -0
- package/esm/chart/text/index.js +4 -0
- package/esm/chart/utils/axis.js +592 -0
- package/esm/chart/utils/bar.js +24 -0
- package/esm/chart/utils/chart.js +229 -0
- package/esm/chart/utils/context.js +15 -0
- package/esm/chart/utils/index.js +9 -0
- package/esm/chart/utils/path.js +206 -0
- package/esm/chart/utils/point.js +118 -0
- package/esm/chart/utils/scale.js +48 -0
- package/esm/index.js +4 -1
- package/esm/sparkline/Sparkline.js +129 -16
- package/esm/sparkline/SparklineArea.js +7 -2
- package/esm/sparkline/SparklineAreaPattern.js +4 -2
- package/esm/sparkline/SparklineGradient.js +4 -0
- package/esm/sparkline/generateSparklineWithId.js +3 -2
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +5 -1
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +5 -2
- package/esm/sparkline/sparkline-interactive/SparklineInteractivePaths.js +4 -0
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +27 -0
- package/package.json +11 -11
- package/dts/sparkline/__stories__/Sparkline.stories.d.ts +0 -3
- package/dts/sparkline/__stories__/Sparkline.stories.d.ts.map +0 -1
- package/dts/sparkline/__stories__/SparklineGradient.stories.d.ts +0 -3
- package/dts/sparkline/__stories__/SparklineGradient.stories.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts +0 -3
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractive.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveHoverDate.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveHoverDate.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePanGestureHandler.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePanGestureHandler.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveTimeseriesPaths.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractiveTimeseriesPaths.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/__tests__/useMinMaxTransform.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/useMinMaxTransform.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts +0 -4
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive-header/__tests__/SparklineInteractiveHeader.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__tests__/useSparklineInteractiveHeaderStyles.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive-header/__tests__/useSparklineInteractiveHeaderStyles.test.d.ts.map +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Rect } from '@coinbase/cds-common/types';
|
|
2
|
+
import type { AxisConfig } from './axis';
|
|
3
|
+
import type { Series } from './chart';
|
|
4
|
+
import type { ChartScaleFunction } from './scale';
|
|
5
|
+
/**
|
|
6
|
+
* Context value for Cartesian (X/Y) coordinate charts.
|
|
7
|
+
* Contains axis-specific methods and properties for rectangular coordinate systems.
|
|
8
|
+
*/
|
|
9
|
+
export type CartesianChartContextValue = {
|
|
10
|
+
/**
|
|
11
|
+
* The series data for the chart.
|
|
12
|
+
*/
|
|
13
|
+
series: Series[];
|
|
14
|
+
/**
|
|
15
|
+
* Returns the series which matches the seriesId or undefined.
|
|
16
|
+
* @param seriesId - A series' id
|
|
17
|
+
*/
|
|
18
|
+
getSeries: (seriesId?: string) => Series | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the data for a series
|
|
21
|
+
* @param seriesId - A series' id
|
|
22
|
+
* @returns data for series, if series exists
|
|
23
|
+
*/
|
|
24
|
+
getSeriesData: (seriesId?: string) => Array<[number, number] | null> | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to animate the chart.
|
|
27
|
+
*/
|
|
28
|
+
animate: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Width of the chart SVG.
|
|
31
|
+
*/
|
|
32
|
+
width: number;
|
|
33
|
+
/**
|
|
34
|
+
* Height of the chart SVG.
|
|
35
|
+
*/
|
|
36
|
+
height: number;
|
|
37
|
+
/**
|
|
38
|
+
* Get x-axis configuration.
|
|
39
|
+
*/
|
|
40
|
+
getXAxis: () => AxisConfig | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get y-axis configuration by ID.
|
|
43
|
+
* @param id - The axis ID. Defaults to defaultAxisId.
|
|
44
|
+
*/
|
|
45
|
+
getYAxis: (id?: string) => AxisConfig | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Get x-axis scale function.
|
|
48
|
+
*/
|
|
49
|
+
getXScale: () => ChartScaleFunction | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Get y-axis scale function by ID.
|
|
52
|
+
* @param id - The axis ID. Defaults to defaultAxisId.
|
|
53
|
+
*/
|
|
54
|
+
getYScale: (id?: string) => ChartScaleFunction | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Drawing area of the chart.
|
|
57
|
+
*/
|
|
58
|
+
drawingArea: Rect;
|
|
59
|
+
/**
|
|
60
|
+
* Registers an axis.
|
|
61
|
+
* Used by axis components to reserve space in the chart, preventing overlap with the drawing area.
|
|
62
|
+
* @param id - The axis ID
|
|
63
|
+
* @param position - The axis position ('top'/'bottom' for x-axis, 'left'/'right' for y-axis)
|
|
64
|
+
* @param size - The size of the axis in pixels
|
|
65
|
+
*/
|
|
66
|
+
registerAxis: (id: string, position: 'top' | 'bottom' | 'left' | 'right', size: number) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Unregisters an axis.
|
|
69
|
+
*/
|
|
70
|
+
unregisterAxis: (id: string) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Gets the rectangle bounds of a requested axis.
|
|
73
|
+
* Computes the bounds of the axis based on the chart's drawing area chart/axis config, and axis position.
|
|
74
|
+
*/
|
|
75
|
+
getAxisBounds: (id: string) => Rect | undefined;
|
|
76
|
+
};
|
|
77
|
+
export type ScrubberContextValue = {
|
|
78
|
+
/**
|
|
79
|
+
* Enables scrubbing interactions.
|
|
80
|
+
* When true, allows scrubbing and makes scrubber components interactive.
|
|
81
|
+
*/
|
|
82
|
+
enableScrubbing: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The current position of the scrubber.
|
|
85
|
+
*/
|
|
86
|
+
scrubberPosition?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Callback fired when the scrubber position changes.
|
|
89
|
+
* Receives the dataIndex of the scrubber or undefined when not scrubbing.
|
|
90
|
+
*/
|
|
91
|
+
onScrubberPositionChange: (index: number | undefined) => void;
|
|
92
|
+
};
|
|
93
|
+
export declare const ScrubberContext: import('react').Context<ScrubberContextValue | undefined>;
|
|
94
|
+
export declare const useScrubberContext: () => ScrubberContextValue;
|
|
95
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACrD;;;;OAIG;IACH,aAAa,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACjF;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,UAAU,GAAG,SAAS,CAAC;IACvC;;;OAGG;IACH,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,UAAU,GAAG,SAAS,CAAC;IAClD;;OAEG;IACH,SAAS,EAAE,MAAM,kBAAkB,GAAG,SAAS,CAAC;IAChD;;;OAGG;IACH,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;IAC3D;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChG;;OAEG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;;;OAGG;IACH,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,eAAO,MAAM,eAAe,2DAA6D,CAAC;AAE1F,eAAO,MAAM,kBAAkB,QAAO,oBAMrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type ChartScaleFunction } from './scale';
|
|
2
|
+
export type ChartPathCurveType =
|
|
3
|
+
| 'bump'
|
|
4
|
+
| 'catmullRom'
|
|
5
|
+
| 'linear'
|
|
6
|
+
| 'linearClosed'
|
|
7
|
+
| 'monotone'
|
|
8
|
+
| 'natural'
|
|
9
|
+
| 'step'
|
|
10
|
+
| 'stepBefore'
|
|
11
|
+
| 'stepAfter';
|
|
12
|
+
/**
|
|
13
|
+
* Get the d3 curve function for a path.
|
|
14
|
+
* See https://d3js.org/d3-shape/curve
|
|
15
|
+
* @param curve - The curve type. Defaults to 'linear'.
|
|
16
|
+
* @returns The d3 curve function.
|
|
17
|
+
*/
|
|
18
|
+
export declare const getPathCurveFunction: (
|
|
19
|
+
curve?: ChartPathCurveType,
|
|
20
|
+
) => import('d3-shape').CurveFactory;
|
|
21
|
+
/**
|
|
22
|
+
* Generates an SVG line path string from data using chart scale functions.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const chartScale = getChartScale({ chartRect, domain, range, xScale, yScale });
|
|
27
|
+
* const path = getLinePath({ data: [1, 2, 3], chartScale, curve: 'linear' });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const getLinePath: ({
|
|
31
|
+
data,
|
|
32
|
+
curve,
|
|
33
|
+
xScale,
|
|
34
|
+
yScale,
|
|
35
|
+
xData,
|
|
36
|
+
}: {
|
|
37
|
+
data: (
|
|
38
|
+
| number
|
|
39
|
+
| null
|
|
40
|
+
| {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
}
|
|
44
|
+
)[];
|
|
45
|
+
curve?: ChartPathCurveType;
|
|
46
|
+
xScale: ChartScaleFunction;
|
|
47
|
+
yScale: ChartScaleFunction;
|
|
48
|
+
xData?: number[];
|
|
49
|
+
}) => string;
|
|
50
|
+
/**
|
|
51
|
+
* Generates an SVG area path string from data using chart scale functions.
|
|
52
|
+
* Supports both single values (area from baseline to value) and tuples ([baseline, value]).
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* // Single values - area from baseline to value
|
|
57
|
+
* const area = getAreaPath({
|
|
58
|
+
* data: [1, 2, 3],
|
|
59
|
+
* xScale,
|
|
60
|
+
* yScale,
|
|
61
|
+
* });
|
|
62
|
+
*
|
|
63
|
+
* // Range values - area from low to high
|
|
64
|
+
* const rangeArea = getAreaPath({
|
|
65
|
+
* data: [[0, 3], [2, 4], [1, 5]],
|
|
66
|
+
* xScale,
|
|
67
|
+
* yScale,
|
|
68
|
+
* curve: 'monotone'
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare const getAreaPath: ({
|
|
73
|
+
data,
|
|
74
|
+
curve,
|
|
75
|
+
xScale,
|
|
76
|
+
yScale,
|
|
77
|
+
xData,
|
|
78
|
+
}: {
|
|
79
|
+
data: (number | null)[] | Array<[number, number] | null>;
|
|
80
|
+
xScale: ChartScaleFunction;
|
|
81
|
+
yScale: ChartScaleFunction;
|
|
82
|
+
curve: ChartPathCurveType;
|
|
83
|
+
xData?: number[];
|
|
84
|
+
}) => string;
|
|
85
|
+
/**
|
|
86
|
+
* Creates an SVG path string for a rectangle with selective corner rounding.
|
|
87
|
+
* Useful for creating bars in charts with optional rounded corners.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* // Simple rectangle bar
|
|
92
|
+
* const barPath = getBarPath(10, 20, 50, 100, 0, false, false);
|
|
93
|
+
*
|
|
94
|
+
* // Bar with rounded top corners
|
|
95
|
+
* const roundedPath = getBarPath(10, 20, 50, 100, 8, true, false);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare const getBarPath: (
|
|
99
|
+
x: number,
|
|
100
|
+
y: number,
|
|
101
|
+
width: number,
|
|
102
|
+
height: number,
|
|
103
|
+
radius: number,
|
|
104
|
+
roundTop: boolean,
|
|
105
|
+
roundBottom: boolean,
|
|
106
|
+
) => string;
|
|
107
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/path.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,SAAS,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,YAAY,GACZ,QAAQ,GACR,cAAc,GACd,UAAU,GACV,SAAS,GACT,MAAM,GACN,YAAY,GACZ,WAAW,CAAC;AAEhB;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAO,kBAA6B,oCAsBxE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,yCAMzB;IACD,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IACnD,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,KAAG,MAgBH,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GAAI,yCAMzB;IACD,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACzD,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,KAAG,MAgFH,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GACrB,GAAG,MAAM,EACT,GAAG,MAAM,EACT,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,UAAU,OAAO,EACjB,aAAa,OAAO,KACnB,MA0BF,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { type ChartScaleFunction } from './scale';
|
|
2
|
+
/**
|
|
3
|
+
* Get a point from a data value and a scale.
|
|
4
|
+
* @note for categorical scales, the point will be centered within the band.
|
|
5
|
+
* @note for log scales, zero and negative values are clamped to a small positive value.
|
|
6
|
+
* @param data - the data value.
|
|
7
|
+
* @param scale - the scale function.
|
|
8
|
+
* @returns the pixel value (defaulting to 0 if data value is not defined in scale).
|
|
9
|
+
*/
|
|
10
|
+
export declare const getPointOnScale: (dataValue: number, scale: ChartScaleFunction) => number;
|
|
11
|
+
/**
|
|
12
|
+
* Projects a data point to pixel coordinates using the chart scale.
|
|
13
|
+
* Automatically handles log scale transformations for zero/negative values.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const chartScale = getChartScale({ chartRect, domain, range, xScale, yScale });
|
|
18
|
+
* const pixelCoord = projectPoint({ x: 5, y: 10, chartScale });
|
|
19
|
+
* ```
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const chartScale = getChartScale({ chartRect, domain, range, xScale, yScale });
|
|
23
|
+
* const pixelCoord = projectPoint({ x: 2, y: 10, chartScale, xData: ['Jan', 'Feb', 'Mar'] });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const projectPoint: ({
|
|
27
|
+
x,
|
|
28
|
+
y,
|
|
29
|
+
xScale,
|
|
30
|
+
yScale,
|
|
31
|
+
}: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
xScale: ChartScaleFunction;
|
|
35
|
+
yScale: ChartScaleFunction;
|
|
36
|
+
}) => {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Projects multiple data points to pixel coordinates using chart scale functions.
|
|
42
|
+
* Handles both numeric and band scales automatically.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const chartScale = getChartScale({ chartRect, domain, range, xScale, yScale });
|
|
47
|
+
* const pixelPoints = projectPoints({ data, chartScale });
|
|
48
|
+
* // For mixed scales
|
|
49
|
+
* const pixelPoints = projectPoints({ data, chartScale, xData: ['Jan', 'Feb', 'Mar'] });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const projectPoints: ({
|
|
53
|
+
data,
|
|
54
|
+
xScale,
|
|
55
|
+
yScale,
|
|
56
|
+
xData,
|
|
57
|
+
yData,
|
|
58
|
+
}: {
|
|
59
|
+
data: (
|
|
60
|
+
| number
|
|
61
|
+
| null
|
|
62
|
+
| {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
}
|
|
66
|
+
)[];
|
|
67
|
+
xData?: number[];
|
|
68
|
+
yData?: number[];
|
|
69
|
+
xScale: ChartScaleFunction;
|
|
70
|
+
yScale: ChartScaleFunction;
|
|
71
|
+
}) => Array<{
|
|
72
|
+
x: number;
|
|
73
|
+
y: number;
|
|
74
|
+
} | null>;
|
|
75
|
+
//# sourceMappingURL=point.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAkD,MAAM,SAAS,CAAC;AAElG;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,EAAE,OAAO,kBAAkB,KAAG,MAc9E,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,GAAI,2BAK1B;IACD,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;CAC5B,KAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAEzB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,yCAM3B;IACD,IAAI,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,kBAAkB,CAAC;CAC5B,KAAG,KAAK,CAAC;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAqDxC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ScaleBand, ScaleLinear, ScaleLogarithmic } from 'd3-scale';
|
|
2
|
+
import type { AxisBounds } from './chart';
|
|
3
|
+
export type ChartAxisScaleType = 'linear' | 'log' | 'band';
|
|
4
|
+
export type NumericScale =
|
|
5
|
+
| ScaleLinear<number, number, never>
|
|
6
|
+
| ScaleLogarithmic<number, number, never>;
|
|
7
|
+
export type CategoricalScale = ScaleBand<number>;
|
|
8
|
+
export type ChartScaleFunction = NumericScale | CategoricalScale;
|
|
9
|
+
export declare const isCategoricalScale: (scale: ChartScaleFunction) => scale is CategoricalScale;
|
|
10
|
+
export declare const isNumericScale: (scale: ChartScaleFunction) => scale is NumericScale;
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if a scale is logarithmic.
|
|
13
|
+
*/
|
|
14
|
+
export declare const isLogScale: (
|
|
15
|
+
scale: ChartScaleFunction,
|
|
16
|
+
) => scale is ScaleLogarithmic<number, number, never>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a numeric scale (linear or logarithmic)
|
|
19
|
+
* @returns A numeric scale function
|
|
20
|
+
*/
|
|
21
|
+
export declare const getNumericScale: ({
|
|
22
|
+
scaleType,
|
|
23
|
+
domain,
|
|
24
|
+
range,
|
|
25
|
+
}: {
|
|
26
|
+
scaleType: 'linear' | 'log';
|
|
27
|
+
domain: AxisBounds;
|
|
28
|
+
range: AxisBounds;
|
|
29
|
+
}) => NumericScale;
|
|
30
|
+
/**
|
|
31
|
+
* Create a categorical scale (band)
|
|
32
|
+
* @returns A categorical scale function
|
|
33
|
+
*/
|
|
34
|
+
export declare const getCategoricalScale: ({
|
|
35
|
+
domain,
|
|
36
|
+
range,
|
|
37
|
+
padding,
|
|
38
|
+
}: {
|
|
39
|
+
domain: AxisBounds;
|
|
40
|
+
range: AxisBounds;
|
|
41
|
+
padding?: number;
|
|
42
|
+
}) => CategoricalScale;
|
|
43
|
+
//# sourceMappingURL=scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/scale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,YAAY,GACpB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAClC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAEjD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEjE,eAAO,MAAM,kBAAkB,GAAI,OAAO,kBAAkB,KAAG,KAAK,IAAI,gBAEvE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,kBAAkB,KAAG,KAAK,IAAI,YAEnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAEjD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAGH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAOH,CAAC"}
|
package/dts/index.d.ts
CHANGED
package/dts/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { CounterBaseProps } from '@coinbase/cds-mobile/visualizations/Counter';
|
|
2
|
-
export declare const Counter: ({
|
|
3
|
-
|
|
2
|
+
export declare const Counter: ({
|
|
3
|
+
startNum,
|
|
4
|
+
endNum,
|
|
5
|
+
renderNum,
|
|
6
|
+
durationInMillis,
|
|
7
|
+
}: CounterBaseProps) => import('react/jsx-runtime').JSX.Element;
|
|
8
|
+
//# sourceMappingURL=Counter.d.ts.map
|
|
@@ -1,22 +1,73 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Path } from 'react-native-svg';
|
|
2
3
|
import type { ElementChildren, SharedProps } from '@coinbase/cds-common/types';
|
|
3
4
|
import type { SparklineAreaBaseProps } from './SparklineArea';
|
|
5
|
+
export type SparklineStrokeType = 'gradient' | 'solid';
|
|
6
|
+
export type SparklineFillType = 'dotted' | 'gradient' | 'gradientDotted';
|
|
4
7
|
export type SparklineBaseProps = SharedProps & {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
/** @danger Use this only if the background color beneath the Sparkline is a non-CDS color. It ensures an accessible contrast by returning either white or black when color is set to 'auto'. Accepts any valid color format (hex, RGB, RGBA). */
|
|
9
|
+
background?: string;
|
|
10
|
+
/** The color of the Sparkline graph's line. Accepts any raw color value (hex, rgba, hsl, etc) or 'auto'. Using 'auto' dynamically selects black or white for optimal accessibility. Does not work with CDS theme color names like 'fgPrimary' or CSS variables. */
|
|
11
|
+
color: string;
|
|
12
|
+
/** Height of the Sparkline */
|
|
13
|
+
height: number;
|
|
14
|
+
/** Svg path as string. CDS offers a `useSparklinePath` which is useful to generate this string. This is accessible via `import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';`. Alternatively, you can use product tailored tooling to generate the SVG path. This component only requires a valid path string is provided. */
|
|
15
|
+
path?: string;
|
|
16
|
+
/** Width of the Sparkline */
|
|
17
|
+
width: number;
|
|
18
|
+
/** an optional SparklineArea that can be used to fill in the Sparkline */
|
|
19
|
+
children?: ElementChildren<SparklineAreaBaseProps>;
|
|
20
|
+
/** Scales the sparkline to show more or less variance. Use a number less than 1 for less variance and a number greater than 1 for more variance. If you use a number greater than 1 it may clip the boundaries of the sparkline. */
|
|
21
|
+
yAxisScalingFactor?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Type of stroke to use for the line
|
|
24
|
+
* - 'gradient': Gradient colored stroke line
|
|
25
|
+
* - 'solid': Solid colored stroke line
|
|
26
|
+
*
|
|
27
|
+
* @default 'solid'
|
|
28
|
+
*/
|
|
29
|
+
strokeType?: SparklineStrokeType;
|
|
30
|
+
/**
|
|
31
|
+
* Type of fill to use for the area
|
|
32
|
+
* @default 'dotted'
|
|
33
|
+
*/
|
|
34
|
+
fillType?: SparklineFillType;
|
|
19
35
|
};
|
|
20
36
|
export type SparklineProps = SparklineBaseProps;
|
|
21
|
-
|
|
22
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use LineChart instead.
|
|
39
|
+
*/
|
|
40
|
+
export declare const Sparkline: React.MemoExoticComponent<
|
|
41
|
+
React.ForwardRefExoticComponent<
|
|
42
|
+
SharedProps & {
|
|
43
|
+
/** @danger Use this only if the background color beneath the Sparkline is a non-CDS color. It ensures an accessible contrast by returning either white or black when color is set to 'auto'. Accepts any valid color format (hex, RGB, RGBA). */
|
|
44
|
+
background?: string;
|
|
45
|
+
/** The color of the Sparkline graph's line. Accepts any raw color value (hex, rgba, hsl, etc) or 'auto'. Using 'auto' dynamically selects black or white for optimal accessibility. Does not work with CDS theme color names like 'fgPrimary' or CSS variables. */
|
|
46
|
+
color: string;
|
|
47
|
+
/** Height of the Sparkline */
|
|
48
|
+
height: number;
|
|
49
|
+
/** Svg path as string. CDS offers a `useSparklinePath` which is useful to generate this string. This is accessible via `import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';`. Alternatively, you can use product tailored tooling to generate the SVG path. This component only requires a valid path string is provided. */
|
|
50
|
+
path?: string;
|
|
51
|
+
/** Width of the Sparkline */
|
|
52
|
+
width: number;
|
|
53
|
+
/** an optional SparklineArea that can be used to fill in the Sparkline */
|
|
54
|
+
children?: ElementChildren<SparklineAreaBaseProps>;
|
|
55
|
+
/** Scales the sparkline to show more or less variance. Use a number less than 1 for less variance and a number greater than 1 for more variance. If you use a number greater than 1 it may clip the boundaries of the sparkline. */
|
|
56
|
+
yAxisScalingFactor?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Type of stroke to use for the line
|
|
59
|
+
* - 'gradient': Gradient colored stroke line
|
|
60
|
+
* - 'solid': Solid colored stroke line
|
|
61
|
+
*
|
|
62
|
+
* @default 'solid'
|
|
63
|
+
*/
|
|
64
|
+
strokeType?: SparklineStrokeType;
|
|
65
|
+
/**
|
|
66
|
+
* Type of fill to use for the area
|
|
67
|
+
* @default 'dotted'
|
|
68
|
+
*/
|
|
69
|
+
fillType?: SparklineFillType;
|
|
70
|
+
} & React.RefAttributes<Path | null>
|
|
71
|
+
>
|
|
72
|
+
>;
|
|
73
|
+
//# sourceMappingURL=Sparkline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/sparkline/Sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/sparkline/Sparkline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAAiC,IAAI,EAAmB,MAAM,kBAAkB,CAAC;AAGxF,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQ/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAG9D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,CAAC;AACvD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAEzE,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG;IAC7C,iPAAiP;IACjP,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oQAAoQ;IACpQ,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,kWAAkW;IAClW,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAC;IACnD,oOAAoO;IACpO,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,SAAS;IAlCpB,iPAAiP;iBACpO,MAAM;IACnB,oQAAoQ;WAC7P,MAAM;IACb,8BAA8B;YACtB,MAAM;IACd,kWAAkW;WAC3V,MAAM;IACb,6BAA6B;WACtB,MAAM;IACb,0EAA0E;eAC/D,eAAe,CAAC,sBAAsB,CAAC;IAClD,oOAAoO;yBAC/M,MAAM;IAC3B;;;;;;OAMG;iBACU,mBAAmB;IAChC;;;OAGG;eACQ,iBAAiB;sCAiK7B,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Path } from 'react-native-svg';
|
|
3
3
|
export type SparklineAreaBaseProps = {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
area?: string;
|
|
5
|
+
patternId?: string;
|
|
6
|
+
maskId?: string;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use AreaChart instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SparklineArea: React.MemoExoticComponent<
|
|
12
|
+
React.ForwardRefExoticComponent<SparklineAreaBaseProps & React.RefAttributes<Path | null>>
|
|
13
|
+
>;
|
|
14
|
+
//# sourceMappingURL=SparklineArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineArea.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SparklineArea.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,uHAazB,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export type SparklineAreaPatternBaseProps = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
color: string;
|
|
3
|
+
id: string;
|
|
4
|
+
/**
|
|
5
|
+
* Opacity for the pattern. If not provided, uses theme-based opacity from useSparklineAreaOpacity.
|
|
6
|
+
*/
|
|
7
|
+
opacity?: number;
|
|
4
8
|
};
|
|
5
|
-
export declare const SparklineAreaPattern: ({
|
|
6
|
-
|
|
9
|
+
export declare const SparklineAreaPattern: ({
|
|
10
|
+
color,
|
|
11
|
+
id,
|
|
12
|
+
opacity,
|
|
13
|
+
}: SparklineAreaPatternBaseProps) => import('react/jsx-runtime').JSX.Element;
|
|
14
|
+
//# sourceMappingURL=SparklineAreaPattern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineAreaPattern.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineAreaPattern.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"SparklineAreaPattern.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineAreaPattern.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,6BAA6B,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,wBAAwB,6BAA6B,4CAazF,CAAC"}
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Path } from 'react-native-svg';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Use LineChart instead.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SparklineGradient: React.MemoExoticComponent<
|
|
7
|
+
React.ForwardRefExoticComponent<
|
|
8
|
+
import('@coinbase/cds-common').SharedProps & {
|
|
9
|
+
background?: string;
|
|
10
|
+
color: string;
|
|
11
|
+
height: number;
|
|
12
|
+
path?: string;
|
|
13
|
+
width: number;
|
|
14
|
+
children?: import('@coinbase/cds-common').ElementChildren<
|
|
15
|
+
import('./SparklineArea').SparklineAreaBaseProps
|
|
16
|
+
>;
|
|
17
|
+
yAxisScalingFactor?: number;
|
|
18
|
+
strokeType?: import('./Sparkline').SparklineStrokeType;
|
|
19
|
+
fillType?: import('./Sparkline').SparklineFillType;
|
|
20
|
+
} & React.RefAttributes<Path | null>
|
|
21
|
+
>
|
|
22
|
+
>;
|
|
23
|
+
//# sourceMappingURL=SparklineGradient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SparklineGradient.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAA2B,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAY5E,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"SparklineGradient.d.ts","sourceRoot":"","sources":["../../src/sparkline/SparklineGradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAA2B,IAAI,EAAa,MAAM,kBAAkB,CAAC;AAY5E;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;sCAqD7B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=Sparkline.figma.d.ts.map
|
|
2
|
+
//# sourceMappingURL=Sparkline.figma.d.ts.map
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ElementChildren } from '@coinbase/cds-common/types';
|
|
3
3
|
import type { SparklineAreaBaseProps } from './SparklineArea';
|
|
4
|
-
export declare function generateSparklineAreaWithId(
|
|
5
|
-
|
|
4
|
+
export declare function generateSparklineAreaWithId(
|
|
5
|
+
id: string,
|
|
6
|
+
children: ElementChildren<SparklineAreaBaseProps>,
|
|
7
|
+
maskId?: string,
|
|
8
|
+
):
|
|
9
|
+
| React.ReactElement<SparklineAreaBaseProps, string | React.JSXElementConstructor<any>>
|
|
10
|
+
| undefined;
|
|
11
|
+
//# sourceMappingURL=generateSparklineWithId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSparklineWithId.d.ts","sourceRoot":"","sources":["../../src/sparkline/generateSparklineWithId.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,eAAe,CAAC,sBAAsB,CAAC,
|
|
1
|
+
{"version":3,"file":"generateSparklineWithId.d.ts","sourceRoot":"","sources":["../../src/sparkline/generateSparklineWithId.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,eAAe,CAAC,sBAAsB,CAAC,EACjD,MAAM,CAAC,EAAE,MAAM,qGAQhB"}
|
package/dts/sparkline/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export * from './sparkline-interactive/SparklineInteractive';
|
|
|
3
3
|
export * from './sparkline-interactive-header/SparklineInteractiveHeader';
|
|
4
4
|
export * from './SparklineArea';
|
|
5
5
|
export * from './SparklineGradient';
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SparklineInteractiveBaseProps } from './SparklineInteractive';
|
|
3
3
|
type SparklineAccessibleViewProps<Period extends string> = {
|
|
4
|
-
|
|
4
|
+
selectedPeriod: Period;
|
|
5
5
|
} & Pick<SparklineInteractiveBaseProps<Period>, 'data'>;
|
|
6
6
|
/**
|
|
7
7
|
* SparklineAccessibleView renders an accessible view for Sparkline Chart.
|
|
@@ -13,6 +13,11 @@ type SparklineAccessibleViewProps<Period extends string> = {
|
|
|
13
13
|
* @param data - The sparkline data mapped by time period
|
|
14
14
|
* @param selectedPeriod - The currently selected time period
|
|
15
15
|
*/
|
|
16
|
-
export declare const SparklineAccessibleView: React.MemoExoticComponent<
|
|
16
|
+
export declare const SparklineAccessibleView: React.MemoExoticComponent<
|
|
17
|
+
<Period extends string>({
|
|
18
|
+
data,
|
|
19
|
+
selectedPeriod,
|
|
20
|
+
}: SparklineAccessibleViewProps<Period>) => import('react/jsx-runtime').JSX.Element
|
|
21
|
+
>;
|
|
17
22
|
export {};
|
|
18
|
-
//# sourceMappingURL=SparklineAccessibleView.d.ts.map
|
|
23
|
+
//# sourceMappingURL=SparklineAccessibleView.d.ts.map
|