@coinbase/cds-mobile-visualization 3.4.0-beta.8 → 3.4.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 +142 -0
- package/dts/chart/CartesianChart.d.ts +92 -7
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/ChartContextBridge.d.ts.map +1 -1
- package/dts/chart/ChartProvider.d.ts +3 -0
- package/dts/chart/ChartProvider.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +36 -13
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +21 -6
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +14 -11
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +33 -9
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +22 -42
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/XAxis.d.ts +6 -0
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +1 -0
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +51 -51
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +56 -11
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +2 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +45 -20
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +2 -1
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
- package/dts/chart/gradient/Gradient.d.ts +5 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -1
- package/dts/chart/index.d.ts +1 -0
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/legend/DefaultLegendEntry.d.ts +5 -0
- package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts +5 -0
- package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
- package/dts/chart/legend/Legend.d.ts +168 -0
- package/dts/chart/legend/Legend.d.ts.map +1 -0
- package/dts/chart/legend/index.d.ts +4 -0
- package/dts/chart/legend/index.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +23 -19
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +26 -9
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +1 -0
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/point/Point.d.ts +26 -2
- package/dts/chart/point/Point.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +32 -2
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +2 -1
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -1
- package/dts/chart/scrubber/Scrubber.d.ts +86 -17
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts +12 -0
- package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +10 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +16 -1
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +45 -10
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/bar.d.ts +190 -0
- package/dts/chart/utils/bar.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +32 -0
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +21 -6
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +3 -1
- package/dts/chart/utils/gradient.d.ts.map +1 -1
- package/dts/chart/utils/path.d.ts +26 -0
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +24 -12
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +11 -0
- package/dts/chart/utils/scale.d.ts.map +1 -1
- package/dts/chart/utils/scrubber.d.ts +2 -1
- package/dts/chart/utils/scrubber.d.ts.map +1 -1
- package/dts/chart/utils/transition.d.ts +63 -22
- package/dts/chart/utils/transition.d.ts.map +1 -1
- package/dts/sparkline/Sparkline.d.ts +2 -1
- package/dts/sparkline/Sparkline.d.ts.map +1 -1
- package/dts/sparkline/SparklineArea.d.ts +2 -1
- package/dts/sparkline/SparklineArea.d.ts.map +1 -1
- package/dts/sparkline/SparklineGradient.d.ts +2 -1
- package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +2 -1
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
- package/esm/chart/CartesianChart.js +176 -82
- package/esm/chart/ChartContextBridge.js +14 -3
- package/esm/chart/ChartProvider.js +2 -2
- package/esm/chart/Path.js +34 -29
- package/esm/chart/PeriodSelector.js +6 -2
- package/esm/chart/__stories__/CartesianChart.stories.js +27 -86
- package/esm/chart/__stories__/ChartAccessibility.stories.js +721 -0
- package/esm/chart/__stories__/ChartTransitions.stories.js +625 -0
- package/esm/chart/__stories__/PeriodSelector.stories.js +102 -4
- package/esm/chart/area/Area.js +21 -9
- package/esm/chart/area/AreaChart.js +18 -13
- package/esm/chart/area/DottedArea.js +28 -18
- package/esm/chart/area/GradientArea.js +14 -7
- package/esm/chart/area/SolidArea.js +6 -2
- package/esm/chart/area/__stories__/AreaChart.stories.js +47 -5
- package/esm/chart/axis/Axis.js +5 -41
- package/esm/chart/axis/XAxis.js +116 -47
- package/esm/chart/axis/YAxis.js +105 -26
- package/esm/chart/axis/__stories__/Axis.stories.js +324 -48
- package/esm/chart/bar/Bar.js +17 -15
- package/esm/chart/bar/BarChart.js +38 -33
- package/esm/chart/bar/BarPlot.js +40 -45
- package/esm/chart/bar/BarStack.js +92 -475
- package/esm/chart/bar/BarStackGroup.js +37 -27
- package/esm/chart/bar/DefaultBar.js +27 -18
- package/esm/chart/bar/DefaultBarStack.js +25 -9
- package/esm/chart/bar/__stories__/BarChart.stories.js +728 -54
- package/esm/chart/gradient/Gradient.js +2 -1
- package/esm/chart/index.js +1 -0
- package/esm/chart/legend/DefaultLegendEntry.js +42 -0
- package/esm/chart/legend/DefaultLegendShape.js +64 -0
- package/esm/chart/legend/Legend.js +59 -0
- package/esm/chart/legend/__stories__/Legend.stories.js +574 -0
- package/esm/chart/legend/index.js +3 -0
- package/esm/chart/line/DottedLine.js +6 -2
- package/esm/chart/line/Line.js +42 -38
- package/esm/chart/line/LineChart.js +36 -12
- package/esm/chart/line/SolidLine.js +6 -2
- package/esm/chart/line/__stories__/LineChart.stories.js +241 -594
- package/esm/chart/line/__stories__/ReferenceLine.stories.js +95 -1
- package/esm/chart/point/Point.js +35 -36
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +41 -38
- package/esm/chart/scrubber/DefaultScrubberLabel.js +26 -10
- package/esm/chart/scrubber/Scrubber.js +67 -35
- package/esm/chart/scrubber/ScrubberAccessibilityView.js +177 -0
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +30 -22
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +35 -8
- package/esm/chart/scrubber/ScrubberProvider.js +29 -24
- package/esm/chart/scrubber/__stories__/Scrubber.stories.js +946 -0
- package/esm/chart/utils/axis.js +88 -44
- package/esm/chart/utils/bar.js +820 -0
- package/esm/chart/utils/chart.js +34 -7
- package/esm/chart/utils/context.js +7 -0
- package/esm/chart/utils/gradient.js +8 -4
- package/esm/chart/utils/path.js +91 -61
- package/esm/chart/utils/point.js +92 -39
- package/esm/chart/utils/scale.js +13 -2
- package/esm/chart/utils/scrubber.js +12 -5
- package/esm/chart/utils/transition.js +108 -60
- package/esm/sparkline/Sparkline.js +2 -1
- package/esm/sparkline/SparklineArea.js +2 -1
- package/esm/sparkline/SparklineGradient.js +2 -1
- package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
- package/esm/sparkline/__stories__/Sparkline.stories.js +11 -7
- package/esm/sparkline/__stories__/SparklineGradient.stories.js +7 -4
- package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +2 -1
- package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +51 -26
- package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
- package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +19 -9
- package/package.json +13 -10
- package/esm/chart/__stories__/Chart.stories.js +0 -77
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type AnimatedProp, type SkParagraph } from '@shopify/react-native-skia';
|
|
3
3
|
import { type ReferenceLineBaseProps, type ReferenceLineLabelComponentProps } from '../line';
|
|
4
|
-
import type { ChartTextProps } from '../text';
|
|
4
|
+
import type { ChartTextChildren, ChartTextProps } from '../text';
|
|
5
5
|
import { type ChartInset, type Series } from '../utils';
|
|
6
6
|
import type { Transition } from '../utils/transition';
|
|
7
7
|
import {
|
|
@@ -20,7 +20,7 @@ export type ScrubberBeaconRef = {
|
|
|
20
20
|
*/
|
|
21
21
|
pulse: () => void;
|
|
22
22
|
};
|
|
23
|
-
export type
|
|
23
|
+
export type ScrubberBeaconBaseProps = {
|
|
24
24
|
/**
|
|
25
25
|
* Id of the series.
|
|
26
26
|
*/
|
|
@@ -31,10 +31,14 @@ export type ScrubberBeaconProps = {
|
|
|
31
31
|
color?: AnimatedProp<string>;
|
|
32
32
|
/**
|
|
33
33
|
* X coordinate in data space.
|
|
34
|
+
* In vertical layout this is the scrubber index-axis value.
|
|
35
|
+
* In horizontal layout this is the series value.
|
|
34
36
|
*/
|
|
35
37
|
dataX: AnimatedProp<number>;
|
|
36
38
|
/**
|
|
37
39
|
* Y coordinate in data space.
|
|
40
|
+
* In vertical layout this is the series value.
|
|
41
|
+
* In horizontal layout this is the scrubber index-axis value.
|
|
38
42
|
*/
|
|
39
43
|
dataY: AnimatedProp<number>;
|
|
40
44
|
/**
|
|
@@ -43,25 +47,45 @@ export type ScrubberBeaconProps = {
|
|
|
43
47
|
isIdle: AnimatedProp<boolean>;
|
|
44
48
|
/**
|
|
45
49
|
* Pulse the beacon while it is at rest.
|
|
50
|
+
*
|
|
51
|
+
* @note Only has an effect when `isIdle` is `true`. Pulse animations work
|
|
52
|
+
* regardless of the chart's `animate` prop.
|
|
46
53
|
*/
|
|
47
54
|
idlePulse?: boolean;
|
|
48
55
|
/**
|
|
49
|
-
* Whether animations are enabled.
|
|
50
|
-
* @default
|
|
56
|
+
* Whether position animations are enabled.
|
|
57
|
+
* @default to ChartContext's animate value
|
|
51
58
|
*/
|
|
52
59
|
animate?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Opacity of the beacon.
|
|
62
|
+
* @default 1
|
|
63
|
+
*/
|
|
64
|
+
opacity?: AnimatedProp<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Stroke color of the beacon circle.
|
|
67
|
+
* @default theme.color.bg
|
|
68
|
+
*/
|
|
69
|
+
stroke?: string;
|
|
70
|
+
};
|
|
71
|
+
export type ScrubberBeaconProps = ScrubberBeaconBaseProps & {
|
|
53
72
|
/**
|
|
54
73
|
* Transition configuration for beacon animations.
|
|
55
74
|
*/
|
|
56
75
|
transitions?: {
|
|
57
76
|
/**
|
|
58
|
-
* Transition
|
|
59
|
-
*
|
|
77
|
+
* Transition for the initial enter/reveal animation.
|
|
78
|
+
* Set to `null` to disable.
|
|
60
79
|
*/
|
|
61
|
-
|
|
80
|
+
enter?: Transition | null;
|
|
81
|
+
/**
|
|
82
|
+
* Transition for subsequent data update animations.
|
|
83
|
+
* Set to `null` to disable.
|
|
84
|
+
*/
|
|
85
|
+
update?: Transition | null;
|
|
62
86
|
/**
|
|
63
87
|
* Transition used for the pulse animation.
|
|
64
|
-
* @default { type: 'timing', duration: 1600, easing: Easing.bezier(0.0, 0.0, 0.0, 1.0) }
|
|
88
|
+
* @default transition { type: 'timing', duration: 1600, easing: Easing.bezier(0.0, 0.0, 0.0, 1.0) }
|
|
65
89
|
*/
|
|
66
90
|
pulse?: Transition;
|
|
67
91
|
/**
|
|
@@ -71,11 +95,6 @@ export type ScrubberBeaconProps = {
|
|
|
71
95
|
*/
|
|
72
96
|
pulseRepeatDelay?: number;
|
|
73
97
|
};
|
|
74
|
-
/**
|
|
75
|
-
* Opacity of the beacon.
|
|
76
|
-
* @default 1
|
|
77
|
-
*/
|
|
78
|
-
opacity?: AnimatedProp<number>;
|
|
79
98
|
};
|
|
80
99
|
export type ScrubberBeaconComponent = React.FC<
|
|
81
100
|
ScrubberBeaconProps & {
|
|
@@ -90,7 +109,7 @@ export type ScrubberBeaconLabelProps = Pick<Series, 'color'> &
|
|
|
90
109
|
/**
|
|
91
110
|
* Label for the series.
|
|
92
111
|
*/
|
|
93
|
-
label:
|
|
112
|
+
label: ChartTextChildren;
|
|
94
113
|
/**
|
|
95
114
|
* Id of the series.
|
|
96
115
|
*/
|
|
@@ -108,6 +127,12 @@ export type ScrubberBaseProps = Pick<ScrubberBeaconGroupBaseProps, 'idlePulse'>
|
|
|
108
127
|
* By default, all series will be highlighted.
|
|
109
128
|
*/
|
|
110
129
|
seriesIds?: string[];
|
|
130
|
+
/**
|
|
131
|
+
* Hides the beacon labels while keeping the line label visible (if provided).
|
|
132
|
+
* @default true in horizontal layout, false in vertical layout.
|
|
133
|
+
* @note Beacon labels are always hidden in horizontal layout, and cannot be overridden.
|
|
134
|
+
*/
|
|
135
|
+
hideBeaconLabels?: boolean;
|
|
111
136
|
/**
|
|
112
137
|
* Hides the scrubber line.
|
|
113
138
|
* @note This hides Scrubber's ReferenceLine including the label.
|
|
@@ -133,6 +158,12 @@ export type ScrubberBaseProps = Pick<ScrubberBeaconGroupBaseProps, 'idlePulse'>
|
|
|
133
158
|
* Measured in pixels.
|
|
134
159
|
*/
|
|
135
160
|
beaconLabelHorizontalOffset?: ScrubberBeaconLabelGroupBaseProps['labelHorizontalOffset'];
|
|
161
|
+
/**
|
|
162
|
+
* Preferred side for beacon labels.
|
|
163
|
+
* @note labels will switch to the opposite side if there's not enough space on the preferred side.
|
|
164
|
+
* @default 'right'
|
|
165
|
+
*/
|
|
166
|
+
beaconLabelPreferredSide?: ScrubberBeaconLabelGroupBaseProps['labelPreferredSide'];
|
|
136
167
|
/**
|
|
137
168
|
* Label text displayed above the scrubber line.
|
|
138
169
|
* Can be a static string or a function that receives the current dataIndex.
|
|
@@ -156,11 +187,24 @@ export type ScrubberBaseProps = Pick<ScrubberBeaconGroupBaseProps, 'idlePulse'>
|
|
|
156
187
|
*/
|
|
157
188
|
lineStroke?: ReferenceLineBaseProps['stroke'];
|
|
158
189
|
/**
|
|
159
|
-
*
|
|
190
|
+
* Stroke color of the scrubber beacon circle.
|
|
191
|
+
* @default theme.color.bg
|
|
160
192
|
*/
|
|
161
|
-
|
|
193
|
+
beaconStroke?: string;
|
|
162
194
|
};
|
|
163
|
-
export type ScrubberProps = ScrubberBaseProps
|
|
195
|
+
export type ScrubberProps = ScrubberBaseProps & {
|
|
196
|
+
/**
|
|
197
|
+
* Transition configuration for the scrubber.
|
|
198
|
+
* Controls enter, update, and pulse animations for beacons and beacon labels.
|
|
199
|
+
*/
|
|
200
|
+
transitions?: ScrubberBeaconProps['transitions'];
|
|
201
|
+
/**
|
|
202
|
+
* Transition configuration for the scrubber beacon.
|
|
203
|
+
* @deprecated Use `transitions` instead. This will be removed in a future major release.
|
|
204
|
+
* @deprecationExpectedRemoval v4
|
|
205
|
+
*/
|
|
206
|
+
beaconTransitions?: ScrubberBeaconProps['transitions'];
|
|
207
|
+
};
|
|
164
208
|
export type ScrubberRef = ScrubberBeaconGroupRef;
|
|
165
209
|
/**
|
|
166
210
|
* Unified component that manages all scrubber elements (beacons, line, labels).
|
|
@@ -176,6 +220,12 @@ export declare const Scrubber: React.MemoExoticComponent<
|
|
|
176
220
|
* By default, all series will be highlighted.
|
|
177
221
|
*/
|
|
178
222
|
seriesIds?: string[];
|
|
223
|
+
/**
|
|
224
|
+
* Hides the beacon labels while keeping the line label visible (if provided).
|
|
225
|
+
* @default true in horizontal layout, false in vertical layout.
|
|
226
|
+
* @note Beacon labels are always hidden in horizontal layout, and cannot be overridden.
|
|
227
|
+
*/
|
|
228
|
+
hideBeaconLabels?: boolean;
|
|
179
229
|
/**
|
|
180
230
|
* Hides the scrubber line.
|
|
181
231
|
* @note This hides Scrubber's ReferenceLine including the label.
|
|
@@ -201,6 +251,12 @@ export declare const Scrubber: React.MemoExoticComponent<
|
|
|
201
251
|
* Measured in pixels.
|
|
202
252
|
*/
|
|
203
253
|
beaconLabelHorizontalOffset?: ScrubberBeaconLabelGroupBaseProps['labelHorizontalOffset'];
|
|
254
|
+
/**
|
|
255
|
+
* Preferred side for beacon labels.
|
|
256
|
+
* @note labels will switch to the opposite side if there's not enough space on the preferred side.
|
|
257
|
+
* @default 'right'
|
|
258
|
+
*/
|
|
259
|
+
beaconLabelPreferredSide?: ScrubberBeaconLabelGroupBaseProps['labelPreferredSide'];
|
|
204
260
|
/**
|
|
205
261
|
* Label text displayed above the scrubber line.
|
|
206
262
|
* Can be a static string or a function that receives the current dataIndex.
|
|
@@ -223,8 +279,21 @@ export declare const Scrubber: React.MemoExoticComponent<
|
|
|
223
279
|
* Stroke color for the scrubber line.
|
|
224
280
|
*/
|
|
225
281
|
lineStroke?: ReferenceLineBaseProps['stroke'];
|
|
282
|
+
/**
|
|
283
|
+
* Stroke color of the scrubber beacon circle.
|
|
284
|
+
* @default theme.color.bg
|
|
285
|
+
*/
|
|
286
|
+
beaconStroke?: string;
|
|
287
|
+
} & {
|
|
288
|
+
/**
|
|
289
|
+
* Transition configuration for the scrubber.
|
|
290
|
+
* Controls enter, update, and pulse animations for beacons and beacon labels.
|
|
291
|
+
*/
|
|
292
|
+
transitions?: ScrubberBeaconProps['transitions'];
|
|
226
293
|
/**
|
|
227
294
|
* Transition configuration for the scrubber beacon.
|
|
295
|
+
* @deprecated Use `transitions` instead. This will be removed in a future major release.
|
|
296
|
+
* @deprecationExpectedRemoval v4
|
|
228
297
|
*/
|
|
229
298
|
beaconTransitions?: ScrubberBeaconProps['transitions'];
|
|
230
299
|
} & React.RefAttributes<ScrubberBeaconGroupRef>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Scrubber.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/Scrubber.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Scrubber.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/Scrubber.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,KAAK,YAAY,EAAe,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG9F,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACtC,MAAM,SAAS,CAAC;AACjB,OAA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C,CAAC,aAAa,CAAC;IACpE;;;OAGG;kCAC2B,iCAAiC,CAAC,uBAAuB,CAAC;IACxF;;;;OAIG;+BACwB,iCAAiC,CAAC,oBAAoB,CAAC;IAClF;;;OAGG;YACK,MAAM,GAAG,WAAW,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,WAAW,CAAC;IAC5E;;OAEG;gBACS,cAAc,CAAC,MAAM,CAAC;IAClC;;;OAGG;uBACgB,MAAM,GAAG,UAAU;IACtC;;OAEG;sBACe,cAAc,CAAC,MAAM,CAAC;IACxC;;OAEG;iBACU,sBAAsB,CAAC,QAAQ,CAAC;IAC7C;;;OAGG;mBACY,MAAM;;IAIvB;;;OAGG;kBACW,mBAAmB,CAAC,aAAa,CAAC;IAChD;;;;OAIG;wBACiB,mBAAmB,CAAC,aAAa,CAAC;iDA+OvD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ScrubberAccessibilityViewProps = {
|
|
3
|
+
accessibilityLabel?: (dataIndex: number) => string;
|
|
4
|
+
accessibilityStep?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const ScrubberAccessibilityView: React.MemoExoticComponent<
|
|
7
|
+
({
|
|
8
|
+
accessibilityLabel,
|
|
9
|
+
accessibilityStep,
|
|
10
|
+
}: ScrubberAccessibilityViewProps) => import('react/jsx-runtime').JSX.Element | undefined
|
|
11
|
+
>;
|
|
12
|
+
//# sourceMappingURL=ScrubberAccessibilityView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrubberAccessibilityView.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberAccessibilityView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAqI1D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACnD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,yBAAyB,wEACQ,8BAA8B,yDAmH3E,CAAC"}
|
|
@@ -25,6 +25,11 @@ export type ScrubberBeaconGroupProps = ScrubberBeaconGroupBaseProps & {
|
|
|
25
25
|
* @default DefaultScrubberBeacon
|
|
26
26
|
*/
|
|
27
27
|
BeaconComponent?: ScrubberBeaconComponent;
|
|
28
|
+
/**
|
|
29
|
+
* Stroke color of the beacon circle.
|
|
30
|
+
* @default theme.color.bg
|
|
31
|
+
*/
|
|
32
|
+
stroke?: string;
|
|
28
33
|
};
|
|
29
34
|
export declare const ScrubberBeaconGroup: import('react').MemoExoticComponent<
|
|
30
35
|
import('react').ForwardRefExoticComponent<
|
|
@@ -38,6 +43,11 @@ export declare const ScrubberBeaconGroup: import('react').MemoExoticComponent<
|
|
|
38
43
|
* @default DefaultScrubberBeacon
|
|
39
44
|
*/
|
|
40
45
|
BeaconComponent?: ScrubberBeaconComponent;
|
|
46
|
+
/**
|
|
47
|
+
* Stroke color of the beacon circle.
|
|
48
|
+
* @default theme.color.bg
|
|
49
|
+
*/
|
|
50
|
+
stroke?: string;
|
|
41
51
|
} & import('react').RefAttributes<ScrubberBeaconGroupRef>
|
|
42
52
|
>
|
|
43
53
|
>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrubberBeaconGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeaconGroup.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAqB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ScrubberBeaconGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeaconGroup.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,uBAAuB,EAAE,mBAAmB,EAAqB,MAAM,YAAY,CAAC;AA4HlG,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,4BAA4B,GAAG;IACpE;;OAEG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACjD;;;OAGG;IACH,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAC1C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,mBAAmB;IAhB9B;;OAEG;kBACW,mBAAmB,CAAC,aAAa,CAAC;IAChD;;;OAGG;sBACe,uBAAuB;IACzC;;;OAGG;aACM,MAAM;2DAkFhB,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ChartTextProps } from '../text';
|
|
2
|
-
import
|
|
2
|
+
import { type ScrubberLabelPosition } from '../utils/scrubber';
|
|
3
|
+
import type {
|
|
4
|
+
ScrubberBeaconLabelComponent,
|
|
5
|
+
ScrubberBeaconLabelProps,
|
|
6
|
+
ScrubberBeaconProps,
|
|
7
|
+
} from './Scrubber';
|
|
3
8
|
export type ScrubberBeaconLabelGroupBaseProps = {
|
|
4
9
|
/**
|
|
5
10
|
* Labels to be displayed.
|
|
@@ -19,6 +24,12 @@ export type ScrubberBeaconLabelGroupBaseProps = {
|
|
|
19
24
|
* Font style for the beacon labels.
|
|
20
25
|
*/
|
|
21
26
|
labelFont?: ChartTextProps['font'];
|
|
27
|
+
/**
|
|
28
|
+
* Preferred side for labels.
|
|
29
|
+
* @note labels will switch to the opposite side if there's not enough space on the preferred side.
|
|
30
|
+
* @default 'right'
|
|
31
|
+
*/
|
|
32
|
+
labelPreferredSide?: ScrubberLabelPosition;
|
|
22
33
|
};
|
|
23
34
|
export type ScrubberBeaconLabelGroupProps = ScrubberBeaconLabelGroupBaseProps & {
|
|
24
35
|
/**
|
|
@@ -26,6 +37,10 @@ export type ScrubberBeaconLabelGroupProps = ScrubberBeaconLabelGroupBaseProps &
|
|
|
26
37
|
* @default DefaultScrubberBeaconLabel
|
|
27
38
|
*/
|
|
28
39
|
BeaconLabelComponent?: ScrubberBeaconLabelComponent;
|
|
40
|
+
/**
|
|
41
|
+
* Transition configuration for beacon label animations.
|
|
42
|
+
*/
|
|
43
|
+
transitions?: ScrubberBeaconProps['transitions'];
|
|
29
44
|
};
|
|
30
45
|
export declare const ScrubberBeaconLabelGroup: import('react').NamedExoticComponent<ScrubberBeaconLabelGroupProps>;
|
|
31
46
|
//# sourceMappingURL=ScrubberBeaconLabelGroup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrubberBeaconLabelGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeaconLabelGroup.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ScrubberBeaconLabelGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeaconLabelGroup.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAS3B,OAAO,KAAK,EACV,4BAA4B,EAC5B,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAsFpB,MAAM,MAAM,iCAAiC,GAAG;IAC9C;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAC9E;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACnC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,iCAAiC,GAAG;IAC9E;;;OAGG;IACH,oBAAoB,CAAC,EAAE,4BAA4B,CAAC;IACpD;;OAEG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,wBAAwB,qEAoMpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAA4C,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG/F,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,GAAG;IAC3F,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAOpD,OAAO,EAA4C,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG/F,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,GAAG;IAC3F,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA+J5D,CAAC"}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { Rect } from '@coinbase/cds-common/types';
|
|
3
3
|
import { type AxisBounds, type Series } from './chart';
|
|
4
|
-
import
|
|
4
|
+
import type { CartesianChartLayout } from './context';
|
|
5
|
+
import { type ChartAxisScaleType, type ChartScaleFunction, type PointAnchor } from './scale';
|
|
5
6
|
export declare const defaultAxisId = 'DEFAULT_AXIS_ID';
|
|
6
7
|
export declare const defaultAxisScaleType = 'linear';
|
|
8
|
+
/**
|
|
9
|
+
* Position options for band scale axis elements (grid lines, tick marks, labels).
|
|
10
|
+
*
|
|
11
|
+
* - `'start'` - At the start of each step (before bar padding)
|
|
12
|
+
* - `'middle'` - At the center of each band
|
|
13
|
+
* - `'end'` - At the end of each step (after bar padding)
|
|
14
|
+
* - `'edges'` - At start of each tick, plus end for the last tick (encloses the chart)
|
|
15
|
+
*
|
|
16
|
+
* @note These properties only apply when using a band scale (`scaleType: 'band'`).
|
|
17
|
+
*/
|
|
18
|
+
export type AxisBandPlacement = 'start' | 'middle' | 'end' | 'edges';
|
|
19
|
+
/**
|
|
20
|
+
* Converts an AxisBandPlacement to the corresponding PointAnchor for use with getPointOnScale.
|
|
21
|
+
*
|
|
22
|
+
* @param placement - The axis placement value
|
|
23
|
+
* @returns The corresponding PointAnchor for scale calculations
|
|
24
|
+
*/
|
|
25
|
+
export declare const toPointAnchor: (placement: AxisBandPlacement) => PointAnchor;
|
|
7
26
|
/**
|
|
8
27
|
* Axis configuration with computed bounds
|
|
9
28
|
*/
|
|
@@ -38,7 +57,7 @@ export type AxisConfig = {
|
|
|
38
57
|
/**
|
|
39
58
|
* Axis configuration without computed bounds (used for input)
|
|
40
59
|
*/
|
|
41
|
-
export type
|
|
60
|
+
export type CartesianAxisConfigProps = Omit<AxisConfig, 'domain' | 'range'> & {
|
|
42
61
|
/**
|
|
43
62
|
* Unique identifier for this axis.
|
|
44
63
|
*/
|
|
@@ -66,8 +85,14 @@ export type AxisConfigProps = Omit<AxisConfig, 'domain' | 'range'> & {
|
|
|
66
85
|
*/
|
|
67
86
|
range?: Partial<AxisBounds> | ((bounds: AxisBounds) => AxisBounds);
|
|
68
87
|
};
|
|
88
|
+
export type CartesianAxisConfig = AxisConfig & {
|
|
89
|
+
/**
|
|
90
|
+
* Domain limit type for numeric scales
|
|
91
|
+
*/
|
|
92
|
+
domainLimit?: 'nice' | 'strict';
|
|
93
|
+
};
|
|
69
94
|
/**
|
|
70
|
-
* Gets a D3 scale based on the axis configuration.
|
|
95
|
+
* Gets a D3 scale based on the cartesian axis configuration.
|
|
71
96
|
* Handles both numeric (linear/log) and categorical (band) scales.
|
|
72
97
|
*
|
|
73
98
|
* For numeric scales, the domain limit controls whether bounds are "nice" (human-friendly)
|
|
@@ -77,16 +102,18 @@ export type AxisConfigProps = Omit<AxisConfig, 'domain' | 'range'> & {
|
|
|
77
102
|
* @returns The D3 scale function
|
|
78
103
|
* @throws An Error if bounds are invalid
|
|
79
104
|
*/
|
|
80
|
-
export declare const
|
|
105
|
+
export declare const getCartesianAxisScale: ({
|
|
81
106
|
config,
|
|
82
107
|
type,
|
|
83
108
|
range,
|
|
84
109
|
dataDomain,
|
|
110
|
+
layout,
|
|
85
111
|
}: {
|
|
86
|
-
config?:
|
|
112
|
+
config?: CartesianAxisConfig;
|
|
87
113
|
type: 'x' | 'y';
|
|
88
114
|
range: AxisBounds;
|
|
89
115
|
dataDomain: AxisBounds;
|
|
116
|
+
layout?: CartesianChartLayout;
|
|
90
117
|
}) => ChartScaleFunction;
|
|
91
118
|
/**
|
|
92
119
|
* Formats the array of user-provided axis configs with default values and validates axis ids.
|
|
@@ -101,10 +128,10 @@ export declare const getAxisScale: ({
|
|
|
101
128
|
*/
|
|
102
129
|
export declare const getAxisConfig: (
|
|
103
130
|
type: 'x' | 'y',
|
|
104
|
-
axes: Partial<
|
|
131
|
+
axes: Partial<CartesianAxisConfigProps> | Partial<CartesianAxisConfigProps>[] | undefined,
|
|
105
132
|
defaultId?: string,
|
|
106
133
|
defaultScaleType?: ChartAxisScaleType,
|
|
107
|
-
) =>
|
|
134
|
+
) => CartesianAxisConfigProps[];
|
|
108
135
|
/**
|
|
109
136
|
* Calculates the data domain for an axis based on its configuration and series data.
|
|
110
137
|
* Handles both x and y axes, categorical data, custom domain configurations, and stacking.
|
|
@@ -112,12 +139,14 @@ export declare const getAxisConfig: (
|
|
|
112
139
|
* @param axisParam - The axis configuration
|
|
113
140
|
* @param series - Array of series objects (for stacking support)
|
|
114
141
|
* @param axisType - Whether this is an 'x' or 'y' axis
|
|
142
|
+
* @param layout - The chart layout orientation
|
|
115
143
|
* @returns The calculated axis bounds
|
|
116
144
|
*/
|
|
117
|
-
export declare const
|
|
118
|
-
axisParam:
|
|
145
|
+
export declare const getCartesianAxisDomain: (
|
|
146
|
+
axisParam: CartesianAxisConfigProps,
|
|
119
147
|
series: Series[],
|
|
120
148
|
axisType: 'x' | 'y',
|
|
149
|
+
layout?: CartesianChartLayout,
|
|
121
150
|
) => AxisBounds;
|
|
122
151
|
/**
|
|
123
152
|
* Calculates the visual range for an axis based on the chart rectangle and configuration.
|
|
@@ -129,7 +158,7 @@ export declare const getAxisDomain: (
|
|
|
129
158
|
* @returns The calculated axis range bounds
|
|
130
159
|
*/
|
|
131
160
|
export declare const getAxisRange: (
|
|
132
|
-
axisParam:
|
|
161
|
+
axisParam: CartesianAxisConfigProps,
|
|
133
162
|
chartRect: Rect,
|
|
134
163
|
axisType: 'x' | 'y',
|
|
135
164
|
) => AxisBounds;
|
|
@@ -154,6 +183,12 @@ type TickGenerationOptions = {
|
|
|
154
183
|
* @default 4
|
|
155
184
|
*/
|
|
156
185
|
minTickCount?: number;
|
|
186
|
+
/**
|
|
187
|
+
* Anchor position for band/categorical scales.
|
|
188
|
+
* Controls where tick labels are positioned within each band.
|
|
189
|
+
* @default 'middle'
|
|
190
|
+
*/
|
|
191
|
+
anchor?: PointAnchor;
|
|
157
192
|
};
|
|
158
193
|
export type GetAxisTicksDataProps = {
|
|
159
194
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../../src/chart/utils/axis.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EACL,KAAK,UAAU,EAIf,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAMvB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GA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YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,GAAG,EACV,gBAAgB,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,KAC9C,KAAK,CAAC,SAKR,CAAC;AAoIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsFG;AACH,eAAO,MAAM,gBAAgB,GAAI,sGAQ9B,qBAAqB,KAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA8ElE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;uBAIvB,MAAM,YAAY,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,QAAQ,MAAM;yBAclC,MAAM;CAwB/C,CAAC"}
|
package/dts/chart/utils/bar.d.ts
CHANGED
|
@@ -1,3 +1,61 @@
|
|
|
1
|
+
import type { Rect } from '@coinbase/cds-common/types';
|
|
2
|
+
import type { BarComponent } from '../bar/Bar';
|
|
3
|
+
import type { BarSeries } from '../bar/BarStack';
|
|
4
|
+
import type { CartesianChartLayout } from './context';
|
|
5
|
+
import type { GradientDefinition, GradientStop } from './gradient';
|
|
6
|
+
import type { ChartScaleFunction, SerializableScale } from './scale';
|
|
7
|
+
import { type Transition } from './transition';
|
|
8
|
+
/**
|
|
9
|
+
* A bar-specific transition that extends Transition with stagger support.
|
|
10
|
+
* When `staggerDelay` is provided, bars will animate with increasing delays
|
|
11
|
+
* based on their position along the category axis (vertical: left-to-right,
|
|
12
|
+
* horizontal: top-to-bottom).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Bars stagger in from left to right over 250ms, each animating for 750ms
|
|
16
|
+
* { type: 'timing', duration: 750, staggerDelay: 250 }
|
|
17
|
+
*/
|
|
18
|
+
export type BarTransition = Transition & {
|
|
19
|
+
/**
|
|
20
|
+
* Maximum stagger delay (ms) distributed across bars by x position.
|
|
21
|
+
* Leftmost bar starts immediately, rightmost starts after this delay.
|
|
22
|
+
*/
|
|
23
|
+
staggerDelay?: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Computes a bar's normalized [0, 1] position along the category axis, used for
|
|
27
|
+
* stagger-delay calculations.
|
|
28
|
+
*
|
|
29
|
+
* Vertical charts stagger left-to-right (x axis); horizontal charts stagger
|
|
30
|
+
* top-to-bottom (y axis). Returns 0 when the drawing area has no extent.
|
|
31
|
+
*
|
|
32
|
+
* @param layout - The layout of the chart
|
|
33
|
+
* @param x - Bar's left edge in pixels
|
|
34
|
+
* @param y - Bar's top edge in pixels
|
|
35
|
+
*/
|
|
36
|
+
export declare const getNormalizedStagger: (
|
|
37
|
+
layout: CartesianChartLayout,
|
|
38
|
+
x: number,
|
|
39
|
+
y: number,
|
|
40
|
+
drawingArea: Rect,
|
|
41
|
+
) => number;
|
|
42
|
+
/**
|
|
43
|
+
* Strips `staggerDelay` from a transition and computes a positional delay.
|
|
44
|
+
*
|
|
45
|
+
* @param transition - The transition config (may include staggerDelay)
|
|
46
|
+
* @param normalizedPosition - The bar's normalized position along the category axis (0–1)
|
|
47
|
+
* @returns A standard Transition with computed delay
|
|
48
|
+
*/
|
|
49
|
+
export declare const withStaggerDelayTransition: (
|
|
50
|
+
transition: BarTransition | null,
|
|
51
|
+
normalizedPosition: number,
|
|
52
|
+
) => Transition | null;
|
|
53
|
+
/**
|
|
54
|
+
* Default bar enter transition. Uses the default spring with a stagger delay
|
|
55
|
+
* so bars spring into place from left to right.
|
|
56
|
+
* `{ type: 'spring', stiffness: 900, damping: 120, staggerDelay: 250 }`
|
|
57
|
+
*/
|
|
58
|
+
export declare const defaultBarEnterTransition: BarTransition;
|
|
1
59
|
/**
|
|
2
60
|
* Calculates the size adjustment needed for bars when accounting for gaps between them.
|
|
3
61
|
* This function helps determine how much to reduce each bar's width to accommodate
|
|
@@ -17,4 +75,136 @@
|
|
|
17
75
|
* ```
|
|
18
76
|
*/
|
|
19
77
|
export declare function getBarSizeAdjustment(barCount: number, gapSize: number): number;
|
|
78
|
+
type StackGroup = {
|
|
79
|
+
stackId: string;
|
|
80
|
+
series: BarSeries[];
|
|
81
|
+
xAxisId?: string;
|
|
82
|
+
yAxisId?: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Groups bar series into stack groups scoped by stackId + axis IDs.
|
|
86
|
+
*
|
|
87
|
+
* Series with no `stackId` are treated as independent stacks keyed by series id.
|
|
88
|
+
* Axis IDs are included in the group key so series on different axes never stack together.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getStackGroups(series: BarSeries[], defaultAxisId?: string): StackGroup[];
|
|
91
|
+
/**
|
|
92
|
+
* Computes stack clip origin [start, end] that covers the bounding box
|
|
93
|
+
* of all bars at their stacked starting positions (as computed by `getBarOrigins`).
|
|
94
|
+
*
|
|
95
|
+
* This is passed to `DefaultBarStack` so the clip animation starts in sync with the
|
|
96
|
+
* individual bar animations — no bars leak outside the clip on frame 0.
|
|
97
|
+
*
|
|
98
|
+
* @param barOrigins - Per-bar initial origins from `getBarOrigins`
|
|
99
|
+
* @param barMinSizes - Per-bar minimum sizes in pixels (or a uniform value)
|
|
100
|
+
* @returns [originStart, originEnd] or undefined when barMinSize is 0 / no bars
|
|
101
|
+
*/
|
|
102
|
+
export declare function getStackOrigin(
|
|
103
|
+
barOrigins: number[],
|
|
104
|
+
barMinSizes: number[] | number,
|
|
105
|
+
): [number, number] | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Computes the initial clip rect used for stack enter animations.
|
|
108
|
+
*/
|
|
109
|
+
export declare function getStackInitialClipRect(
|
|
110
|
+
stackRect: Rect,
|
|
111
|
+
layout: CartesianChartLayout,
|
|
112
|
+
origin?: number | [number, number],
|
|
113
|
+
): Rect;
|
|
114
|
+
/**
|
|
115
|
+
* Threshold for treating a position as touching the baseline.
|
|
116
|
+
* Positions within this distance are considered at the baseline for rounding purposes.
|
|
117
|
+
*/
|
|
118
|
+
export declare const EPSILON = 0.0001;
|
|
119
|
+
/**
|
|
120
|
+
* Computes and clamps the stack baseline position on the value axis.
|
|
121
|
+
*
|
|
122
|
+
* - If the full domain is positive, baseline is domain min.
|
|
123
|
+
* - If the full domain is negative, baseline is domain max.
|
|
124
|
+
* - If the domain crosses zero, baseline is 0.
|
|
125
|
+
*/
|
|
126
|
+
export declare function getStackBaseline(
|
|
127
|
+
valueScale: ChartScaleFunction,
|
|
128
|
+
stackRect: Rect,
|
|
129
|
+
layout: CartesianChartLayout,
|
|
130
|
+
): number;
|
|
131
|
+
type SeriesGradientEntry =
|
|
132
|
+
| {
|
|
133
|
+
seriesId: string;
|
|
134
|
+
gradient: GradientDefinition;
|
|
135
|
+
scale: SerializableScale | ChartScaleFunction;
|
|
136
|
+
stops: GradientStop[];
|
|
137
|
+
}
|
|
138
|
+
| undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Computes the positioned bar entries and bounding rect for a single stack at one category index.
|
|
141
|
+
*
|
|
142
|
+
* This is the pure computation extracted from `BarStack`'s `useMemo` so it can be tested
|
|
143
|
+
* independently and reused across contexts.
|
|
144
|
+
*
|
|
145
|
+
* @param params.series - Series configs for this stack
|
|
146
|
+
* @param params.seriesData - Stacked data for each series, keyed by series id
|
|
147
|
+
* @param params.categoryIndex - Index of the category being rendered
|
|
148
|
+
* @param params.indexPos - Pixel position along the categorical axis
|
|
149
|
+
* @param params.thickness - Bar thickness in pixels
|
|
150
|
+
* @param params.valueScale - Scale function for the value axis
|
|
151
|
+
* @param params.seriesGradients - Precomputed gradient configs per series (undefined entries are skipped)
|
|
152
|
+
* @param params.roundBaseline - Whether to round the face touching the baseline
|
|
153
|
+
* @param params.layout - The layout of the chart
|
|
154
|
+
* @param params.baseline - Pixel position of the zero value on the value axis
|
|
155
|
+
* @param params.stackGap - Gap between adjacent bars in pixels
|
|
156
|
+
* @param params.barMinSize - Minimum individual bar size in pixels
|
|
157
|
+
* @param params.stackMinSize - Minimum total stack size in pixels
|
|
158
|
+
* @param params.defaultFill - Fallback fill color when a series has no color or gradient
|
|
159
|
+
* @returns Positioned bar entries and the stack's bounding rect
|
|
160
|
+
*/
|
|
161
|
+
export declare function getBars(params: {
|
|
162
|
+
series: BarSeries[];
|
|
163
|
+
seriesData: Record<string, ([number, number] | null)[]>;
|
|
164
|
+
categoryIndex: number;
|
|
165
|
+
categoryValue: number;
|
|
166
|
+
indexPos: number;
|
|
167
|
+
thickness: number;
|
|
168
|
+
valueScale: ChartScaleFunction;
|
|
169
|
+
seriesGradients: SeriesGradientEntry[];
|
|
170
|
+
roundBaseline?: boolean;
|
|
171
|
+
layout: CartesianChartLayout;
|
|
172
|
+
baseline: number;
|
|
173
|
+
stackGap?: number;
|
|
174
|
+
barMinSize?: number;
|
|
175
|
+
stackMinSize?: number;
|
|
176
|
+
defaultFill: string;
|
|
177
|
+
borderRadius?: number;
|
|
178
|
+
defaultFillOpacity?: number;
|
|
179
|
+
defaultStroke?: string;
|
|
180
|
+
defaultStrokeWidth?: number;
|
|
181
|
+
defaultBarComponent?: BarComponent;
|
|
182
|
+
}): {
|
|
183
|
+
x: number;
|
|
184
|
+
y: number;
|
|
185
|
+
width: number;
|
|
186
|
+
height: number;
|
|
187
|
+
dataX: number | [number, number];
|
|
188
|
+
dataY: number | [number, number];
|
|
189
|
+
origin: number;
|
|
190
|
+
borderRadius: number | undefined;
|
|
191
|
+
fillOpacity: number | undefined;
|
|
192
|
+
stroke: string | undefined;
|
|
193
|
+
strokeWidth: number | undefined;
|
|
194
|
+
minSize: number;
|
|
195
|
+
BarComponent: BarComponent | undefined;
|
|
196
|
+
roundTop?: boolean;
|
|
197
|
+
roundBottom?: boolean;
|
|
198
|
+
seriesId: string;
|
|
199
|
+
fill?: string;
|
|
200
|
+
/** Position along the value axis in pixels (axis-agnostic, used by layout helpers). */
|
|
201
|
+
valuePos: number;
|
|
202
|
+
/** Size along the value axis in pixels (axis-agnostic, used by layout helpers). */
|
|
203
|
+
length: number;
|
|
204
|
+
/** The raw data value as [baseline, value], used by layout helpers for gap/rounding logic. */
|
|
205
|
+
dataValue: [number, number];
|
|
206
|
+
/** Whether gap distribution should be applied to this bar in a stack. */
|
|
207
|
+
shouldApplyGap?: boolean;
|
|
208
|
+
}[];
|
|
209
|
+
export {};
|
|
20
210
|
//# sourceMappingURL=bar.d.ts.map
|