@coinbase/cds-web-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 +36 -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 +34 -0
- package/dts/chart/Path.d.ts.map +1 -0
- package/dts/chart/PeriodSelector.d.ts +61 -0
- package/dts/chart/PeriodSelector.d.ts.map +1 -0
- package/dts/chart/Point.d.ts +153 -0
- package/dts/chart/Point.d.ts.map +1 -0
- package/dts/chart/area/Area.d.ts +48 -0
- package/dts/chart/area/Area.d.ts.map +1 -0
- package/dts/chart/area/AreaChart.d.ts +52 -0
- package/dts/chart/area/AreaChart.d.ts.map +1 -0
- package/dts/chart/area/DottedArea.d.ts +68 -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 +208 -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 +91 -0
- package/dts/chart/bar/Bar.d.ts.map +1 -0
- package/dts/chart/bar/BarChart.d.ts +53 -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 +17 -0
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -0
- package/dts/chart/bar/DefaultBarStack.d.ts +16 -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 +14 -0
- package/dts/chart/line/DottedLine.d.ts.map +1 -0
- package/dts/chart/line/GradientLine.d.ts +42 -0
- package/dts/chart/line/GradientLine.d.ts.map +1 -0
- package/dts/chart/line/Line.d.ts +80 -0
- package/dts/chart/line/Line.d.ts.map +1 -0
- package/dts/chart/line/LineChart.d.ts +59 -0
- package/dts/chart/line/LineChart.d.ts.map +1 -0
- package/dts/chart/line/ReferenceLine.d.ts +131 -0
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -0
- package/dts/chart/line/SolidLine.d.ts +14 -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 +149 -0
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeacon.d.ts +93 -0
- package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts +7 -0
- package/dts/chart/scrubber/ScrubberBeaconLabel.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 +114 -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 +61 -16
- package/dts/sparkline/Sparkline.d.ts.map +1 -1
- package/dts/sparkline/SparklineArea.d.ts +12 -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/SparklinePath.d.ts +8 -6
- 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/InnerSparklineInteractiveProvider.d.ts +9 -5
- package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +168 -118
- 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 +4 -2
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverPrice.d.ts +4 -2
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +5 -3
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +11 -6
- 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 +17 -12
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveScrubHandler.d.ts +23 -10
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveScrubProvider.d.ts +12 -12
- 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/fade.d.ts +1 -1
- package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +11 -11
- package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +101 -93
- package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +1 -1
- package/esm/chart/CartesianChart.css +1 -0
- package/esm/chart/CartesianChart.js +258 -0
- package/esm/chart/ChartProvider.js +10 -0
- package/esm/chart/Path.js +89 -0
- package/esm/chart/PeriodSelector.css +1 -0
- package/esm/chart/PeriodSelector.js +126 -0
- package/esm/chart/Point.css +2 -0
- package/esm/chart/Point.js +171 -0
- package/esm/chart/area/Area.js +85 -0
- package/esm/chart/area/AreaChart.js +164 -0
- package/esm/chart/area/DottedArea.js +141 -0
- package/esm/chart/area/GradientArea.js +111 -0
- package/esm/chart/area/SolidArea.js +29 -0
- package/esm/chart/area/index.js +7 -0
- package/esm/chart/axis/Axis.js +46 -0
- package/esm/chart/axis/XAxis.css +2 -0
- package/esm/chart/axis/XAxis.js +195 -0
- package/esm/chart/axis/YAxis.css +2 -0
- package/esm/chart/axis/YAxis.js +183 -0
- package/esm/chart/axis/index.js +5 -0
- package/esm/chart/bar/Bar.js +59 -0
- package/esm/chart/bar/BarChart.js +147 -0
- package/esm/chart/bar/BarPlot.js +96 -0
- package/esm/chart/bar/BarStack.js +519 -0
- package/esm/chart/bar/BarStackGroup.js +96 -0
- package/esm/chart/bar/DefaultBar.js +64 -0
- package/esm/chart/bar/DefaultBarStack.js +60 -0
- package/esm/chart/bar/index.js +9 -0
- package/esm/chart/index.js +14 -0
- package/esm/chart/line/DottedLine.js +38 -0
- package/esm/chart/line/GradientLine.js +58 -0
- package/esm/chart/line/Line.js +159 -0
- package/esm/chart/line/LineChart.js +120 -0
- package/esm/chart/line/ReferenceLine.js +142 -0
- package/esm/chart/line/SolidLine.js +34 -0
- package/esm/chart/line/index.js +8 -0
- package/esm/chart/scrubber/Scrubber.js +483 -0
- package/esm/chart/scrubber/ScrubberBeacon.js +195 -0
- package/esm/chart/scrubber/ScrubberBeaconLabel.js +33 -0
- package/esm/chart/scrubber/ScrubberProvider.js +228 -0
- package/esm/chart/scrubber/index.js +2 -0
- package/esm/chart/text/ChartText.js +236 -0
- package/esm/chart/text/SmartChartTextGroup.js +226 -0
- package/esm/chart/text/index.js +4 -0
- package/esm/chart/utils/axis.js +593 -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 +204 -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 -15
- package/esm/sparkline/SparklineArea.js +7 -2
- package/esm/sparkline/SparklineAreaPattern.js +4 -2
- package/esm/sparkline/SparklineGradient.js +16 -58
- 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/package.json +15 -11
- package/dts/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.d.ts +0 -374
- 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__/SparklineInteractivePeriodSelector.test.d.ts +0 -2
- package/dts/sparkline/sparkline-interactive/__tests__/SparklineInteractivePeriodSelector.test.d.ts.map +0 -1
- package/dts/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.d.ts +0 -87
- 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
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { type LineComponent } from '../line';
|
|
3
|
+
import type { ChartTextChildren } from '../text/ChartText';
|
|
4
|
+
export declare const axisLineStyles =
|
|
5
|
+
'\n stroke: var(--color-fg);\n stroke-linecap: square;\n stroke-width: 1px;\n';
|
|
6
|
+
export declare const axisTickMarkStyles =
|
|
7
|
+
'\n stroke: var(--color-fg);\n stroke-linecap: square;\n stroke-width: 1px;\n';
|
|
8
|
+
/**
|
|
9
|
+
* Animation variants for grouped axis tick labels - initial mount
|
|
10
|
+
*/
|
|
11
|
+
export declare const axisTickLabelsInitialAnimationVariants: {
|
|
12
|
+
initial: {
|
|
13
|
+
opacity: number;
|
|
14
|
+
};
|
|
15
|
+
animate: {
|
|
16
|
+
opacity: number;
|
|
17
|
+
transition: {
|
|
18
|
+
duration: number;
|
|
19
|
+
delay: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exit: {
|
|
23
|
+
opacity: number;
|
|
24
|
+
transition: {
|
|
25
|
+
duration: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Animation variants for axis elements - updates (used for both grid lines and tick labels)
|
|
31
|
+
*/
|
|
32
|
+
export declare const axisUpdateAnimationVariants: {
|
|
33
|
+
initial: {
|
|
34
|
+
opacity: number;
|
|
35
|
+
};
|
|
36
|
+
animate: {
|
|
37
|
+
opacity: number;
|
|
38
|
+
transition: {
|
|
39
|
+
duration: number;
|
|
40
|
+
delay: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
exit: {
|
|
44
|
+
opacity: number;
|
|
45
|
+
transition: {
|
|
46
|
+
duration: number;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export type AxisBaseProps = {
|
|
51
|
+
/**
|
|
52
|
+
* Component to render the grid lines.
|
|
53
|
+
* @default DottedLine
|
|
54
|
+
*/
|
|
55
|
+
GridLineComponent?: LineComponent;
|
|
56
|
+
/**
|
|
57
|
+
* Minimum gap between tick labels.
|
|
58
|
+
* Labels will be hidden if they are closer than this gap.
|
|
59
|
+
* @default 4
|
|
60
|
+
*/
|
|
61
|
+
minTickLabelGap?: number;
|
|
62
|
+
/**
|
|
63
|
+
* Requested number of ticks to display.
|
|
64
|
+
* This value is passed into d3 and may not be respected.
|
|
65
|
+
* @note This property is overridden when `ticks` is provided.
|
|
66
|
+
* @note this property overrides the `tickInterval` property.
|
|
67
|
+
* @default 5 (for y-axis)
|
|
68
|
+
*/
|
|
69
|
+
requestedTickCount?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to show grid lines at each tick position.
|
|
72
|
+
*/
|
|
73
|
+
showGrid?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to show the axis line.
|
|
76
|
+
*/
|
|
77
|
+
showLine?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to show tick marks on the axis.
|
|
80
|
+
*/
|
|
81
|
+
showTickMarks?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Size of the tick marks.
|
|
84
|
+
* @default 4
|
|
85
|
+
*/
|
|
86
|
+
tickMarkSize?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Custom tick configuration for the axis.
|
|
89
|
+
* When provided, this overrides the `requestedTickCount` property.
|
|
90
|
+
*
|
|
91
|
+
* - **Array**: Uses these exact values for tick positioning and labels.
|
|
92
|
+
* - **Function**: Filters based on the predicate function.
|
|
93
|
+
* - For **x-axis**: Checks every data index (0, 1, 2, ..., dataLength-1)
|
|
94
|
+
* - For **y-axis**: Filters d3-generated tick values
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Exact tick values
|
|
98
|
+
* ticks: [0, 25, 50, 75, 100]
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* // Show every 12th data point on x-axis
|
|
102
|
+
* ticks: (index) => index % 12 === 0
|
|
103
|
+
*/
|
|
104
|
+
ticks?: number[] | ((value: number) => boolean);
|
|
105
|
+
/**
|
|
106
|
+
* Formatter function for axis tick values.
|
|
107
|
+
* Tick values will be wrapped in ChartText component.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // Simple string formatting
|
|
111
|
+
* tickLabelFormatter: (value) => `$${prices[value]}`
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* // ReactNode with conditional styling
|
|
115
|
+
* tickLabelFormatter: (index) => {
|
|
116
|
+
* if (index % 12 === 0) {
|
|
117
|
+
* return <tspan style={{ fontWeight: 'bold' }}>${prices[index]}</tspan>;
|
|
118
|
+
* }
|
|
119
|
+
* return `$${prices[index]}`;
|
|
120
|
+
* }
|
|
121
|
+
*/
|
|
122
|
+
tickLabelFormatter?: (value: any) => ChartTextChildren;
|
|
123
|
+
/**
|
|
124
|
+
* Space between the axis tick mark and labels.
|
|
125
|
+
* If tick marks are not shown, this is the gap between the axis and the chart.
|
|
126
|
+
* @default 2 for x-axis, 8 for y-axis
|
|
127
|
+
*/
|
|
128
|
+
tickMarkLabelGap?: number;
|
|
129
|
+
/**
|
|
130
|
+
* Interval at which to show ticks.
|
|
131
|
+
* When provided, calculates tick count based on available space.
|
|
132
|
+
* @note this property is overridden by the `requestedTickCount` and `ticks` properties.
|
|
133
|
+
* @default 32 (for x-axis)
|
|
134
|
+
*/
|
|
135
|
+
tickInterval?: number;
|
|
136
|
+
/**
|
|
137
|
+
* Minimum step size for tick generation.
|
|
138
|
+
* Prevents the step from being smaller than this value.
|
|
139
|
+
* @default 1
|
|
140
|
+
*/
|
|
141
|
+
tickMinStep?: number;
|
|
142
|
+
/**
|
|
143
|
+
* Maximum step size for tick generation.
|
|
144
|
+
* Prevents the step from being larger than this value.
|
|
145
|
+
*/
|
|
146
|
+
tickMaxStep?: number;
|
|
147
|
+
};
|
|
148
|
+
export type AxisProps = AxisBaseProps & {
|
|
149
|
+
/**
|
|
150
|
+
* Custom className for the axis.
|
|
151
|
+
*/
|
|
152
|
+
className?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Custom classNames for the axis.
|
|
155
|
+
*/
|
|
156
|
+
classNames?: {
|
|
157
|
+
/**
|
|
158
|
+
* Custom className for the root element.
|
|
159
|
+
*/
|
|
160
|
+
root?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Custom className for the tick labels.
|
|
163
|
+
*/
|
|
164
|
+
tickLabel?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Custom className for the grid lines.
|
|
167
|
+
*/
|
|
168
|
+
gridLine?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Custom className for the axis line.
|
|
171
|
+
*/
|
|
172
|
+
line?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Custom className for the tick marks.
|
|
175
|
+
*/
|
|
176
|
+
tickMark?: string;
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Custom style for the axis.
|
|
180
|
+
*/
|
|
181
|
+
style?: React.CSSProperties;
|
|
182
|
+
/**
|
|
183
|
+
* Custom styles for the axis.
|
|
184
|
+
*/
|
|
185
|
+
styles?: {
|
|
186
|
+
/**
|
|
187
|
+
* Custom style for the root element.
|
|
188
|
+
*/
|
|
189
|
+
root?: React.CSSProperties;
|
|
190
|
+
/**
|
|
191
|
+
* Custom style for the tick labels.
|
|
192
|
+
*/
|
|
193
|
+
tickLabel?: React.CSSProperties;
|
|
194
|
+
/**
|
|
195
|
+
* Custom style for the grid lines.
|
|
196
|
+
*/
|
|
197
|
+
gridLine?: React.CSSProperties;
|
|
198
|
+
/**
|
|
199
|
+
* Custom style for the axis line.
|
|
200
|
+
*/
|
|
201
|
+
line?: React.CSSProperties;
|
|
202
|
+
/**
|
|
203
|
+
* Custom style for the tick marks.
|
|
204
|
+
*/
|
|
205
|
+
tickMark?: React.CSSProperties;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
//# sourceMappingURL=Axis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Axis.d.ts","sourceRoot":"","sources":["../../../src/chart/axis/Axis.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,eAAO,MAAM,cAAc,oFAI1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,oFAI9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;CAiBlD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;CAiBvC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,aAAa,CAAC;IAClC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAChD;;;;;;;;;;;;;;;;OAgBG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,iBAAiB,CAAC;IACvD;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG;IACtC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE;QACX;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC3B;;WAEG;QACH,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAChC;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC/B;;WAEG;QACH,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAC3B;;WAEG;QACH,QAAQ,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;KAChC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type AxisBaseProps, type AxisProps } from './Axis';
|
|
2
|
+
export type XAxisBaseProps = AxisBaseProps & {
|
|
3
|
+
/**
|
|
4
|
+
* The position of the axis relative to the chart's drawing area.
|
|
5
|
+
* @default 'bottom'
|
|
6
|
+
*/
|
|
7
|
+
position?: 'top' | 'bottom';
|
|
8
|
+
/**
|
|
9
|
+
* Height of the axis. This value is inclusive of the padding.
|
|
10
|
+
* @default 32
|
|
11
|
+
*/
|
|
12
|
+
height?: number;
|
|
13
|
+
};
|
|
14
|
+
export type XAxisProps = AxisProps & XAxisBaseProps;
|
|
15
|
+
export declare const XAxis: import('react').NamedExoticComponent<XAxisProps>;
|
|
16
|
+
//# sourceMappingURL=XAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../src/chart/axis/XAxis.tsx"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAIf,MAAM,QAAQ,CAAC;AAShB,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;AAEpD,eAAO,MAAM,KAAK,kDAqOjB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AxisBaseProps, AxisProps } from './Axis';
|
|
2
|
+
export type YAxisBaseProps = AxisBaseProps & {
|
|
3
|
+
/**
|
|
4
|
+
* The ID of the axis to render.
|
|
5
|
+
* Defaults to defaultAxisId if not specified.
|
|
6
|
+
*/
|
|
7
|
+
axisId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The position of the axis relative to the chart's drawing area.
|
|
10
|
+
* @default 'right'
|
|
11
|
+
*/
|
|
12
|
+
position?: 'left' | 'right';
|
|
13
|
+
/**
|
|
14
|
+
* Width of the axis. This value is inclusive of the padding.
|
|
15
|
+
* @default 44
|
|
16
|
+
*/
|
|
17
|
+
width?: number;
|
|
18
|
+
};
|
|
19
|
+
export type YAxisProps = AxisProps & YAxisBaseProps;
|
|
20
|
+
export declare const YAxis: import('react').NamedExoticComponent<YAxisProps>;
|
|
21
|
+
//# sourceMappingURL=YAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../src/chart/axis/YAxis.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAevD,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG;IAC3C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,cAAc,CAAC;AAEpD,eAAO,MAAM,KAAK,kDAoNjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/axis/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SVGProps } from 'react';
|
|
3
|
+
export type BarComponentProps = {
|
|
4
|
+
/**
|
|
5
|
+
* X coordinate of the bar (left edge).
|
|
6
|
+
*/
|
|
7
|
+
x: number;
|
|
8
|
+
/**
|
|
9
|
+
* Y coordinate of the bar (top edge).
|
|
10
|
+
*/
|
|
11
|
+
y: number;
|
|
12
|
+
/**
|
|
13
|
+
* Width of the bar.
|
|
14
|
+
*/
|
|
15
|
+
width: number;
|
|
16
|
+
/**
|
|
17
|
+
* Height of the bar.
|
|
18
|
+
*/
|
|
19
|
+
height: number;
|
|
20
|
+
/**
|
|
21
|
+
* Border radius of the bar.
|
|
22
|
+
*/
|
|
23
|
+
borderRadius?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Whether to round the top of the bar.
|
|
26
|
+
*/
|
|
27
|
+
roundTop?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to round the bottom of the bar.
|
|
30
|
+
*/
|
|
31
|
+
roundBottom?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Y coordinate of the baseline/origin for animations.
|
|
34
|
+
* Used to calculate initial animation state.
|
|
35
|
+
*/
|
|
36
|
+
originY?: number;
|
|
37
|
+
/**
|
|
38
|
+
* The x-axis data value for this bar.
|
|
39
|
+
*/
|
|
40
|
+
dataX?: number | string;
|
|
41
|
+
/**
|
|
42
|
+
* The y-axis data value for this bar.
|
|
43
|
+
*/
|
|
44
|
+
dataY?: number | [number, number] | null;
|
|
45
|
+
/**
|
|
46
|
+
* The path data for the bar shape.
|
|
47
|
+
*/
|
|
48
|
+
d: SVGProps<SVGPathElement>['d'];
|
|
49
|
+
/**
|
|
50
|
+
* Fill color for the bar.
|
|
51
|
+
*/
|
|
52
|
+
fill?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Fill opacity for the bar.
|
|
55
|
+
*/
|
|
56
|
+
fillOpacity?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Stroke color for the bar outline.
|
|
59
|
+
*/
|
|
60
|
+
stroke?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Stroke width for the bar outline.
|
|
63
|
+
*/
|
|
64
|
+
strokeWidth?: number;
|
|
65
|
+
};
|
|
66
|
+
export type BarComponent = React.FC<BarComponentProps>;
|
|
67
|
+
export type BarProps = Omit<BarComponentProps, 'd'> & {
|
|
68
|
+
/**
|
|
69
|
+
* Border radius for the bar.
|
|
70
|
+
* @default 4
|
|
71
|
+
*/
|
|
72
|
+
borderRadius?: BarComponentProps['borderRadius'];
|
|
73
|
+
/**
|
|
74
|
+
* Component to render the bar.
|
|
75
|
+
*/
|
|
76
|
+
BarComponent?: BarComponent;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Simple bar component that renders a single bar at the specified position.
|
|
80
|
+
*
|
|
81
|
+
* This component is intentionally kept simple - it just renders a bar at the given
|
|
82
|
+
* x, y, width, height coordinates. Complex positioning logic (like handling stacks,
|
|
83
|
+
* groups, gaps, etc.) should be handled by parent components like BarChart or BarStack.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* <Bar x={10} y={20} width={50} height={100} fill="blue" />
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare const Bar: React.NamedExoticComponent<BarProps>;
|
|
91
|
+
//# sourceMappingURL=Bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Bar.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/Bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IACzC;;OAEG;IACH,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC;IACjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAAC,GAAG;IACpD;;;OAGG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACjD;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,GAAG,sCAgDf,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type XAxisProps, type YAxisProps } from '../axis';
|
|
2
|
+
import { type CartesianChartProps } from '../CartesianChart';
|
|
3
|
+
import { type AxisConfigProps, type Series } from '../utils';
|
|
4
|
+
import { type BarProps } from './Bar';
|
|
5
|
+
import { type BarPlotProps } from './BarPlot';
|
|
6
|
+
export type BarSeries = Series &
|
|
7
|
+
Partial<Pick<BarProps, 'BarComponent' | 'fill' | 'fillOpacity' | 'stroke' | 'strokeWidth'>>;
|
|
8
|
+
export type BarChartProps = Omit<CartesianChartProps, 'xAxis' | 'yAxis' | 'series'> &
|
|
9
|
+
Pick<
|
|
10
|
+
BarPlotProps,
|
|
11
|
+
| 'barPadding'
|
|
12
|
+
| 'BarComponent'
|
|
13
|
+
| 'fillOpacity'
|
|
14
|
+
| 'stroke'
|
|
15
|
+
| 'strokeWidth'
|
|
16
|
+
| 'borderRadius'
|
|
17
|
+
| 'BarStackComponent'
|
|
18
|
+
| 'roundBaseline'
|
|
19
|
+
| 'stackGap'
|
|
20
|
+
| 'barMinSize'
|
|
21
|
+
| 'stackMinSize'
|
|
22
|
+
> & {
|
|
23
|
+
/**
|
|
24
|
+
* Configuration objects that define how to visualize the data.
|
|
25
|
+
* Each series supports Bar component props for individual customization.
|
|
26
|
+
*/
|
|
27
|
+
series?: Array<BarSeries>;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to stack the areas on top of each other.
|
|
30
|
+
* When true, each series builds cumulative values on top of the previous series.
|
|
31
|
+
*
|
|
32
|
+
* **Note**: Only applies to series data containing singular numbers (e.g., `[10, 20, 30]`).
|
|
33
|
+
* Series with start & end value tuples (e.g., `[[0, 10], [5, 20]]`) will be skipped during stacking
|
|
34
|
+
* and rendered as-is.
|
|
35
|
+
*/
|
|
36
|
+
stacked?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether to show the X axis.
|
|
39
|
+
*/
|
|
40
|
+
showXAxis?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to show the Y axis.
|
|
43
|
+
*/
|
|
44
|
+
showYAxis?: boolean;
|
|
45
|
+
xAxis?: Partial<AxisConfigProps> & XAxisProps;
|
|
46
|
+
yAxis?: Partial<AxisConfigProps> & YAxisProps;
|
|
47
|
+
};
|
|
48
|
+
export declare const BarChart: import('react').MemoExoticComponent<
|
|
49
|
+
import('react').ForwardRefExoticComponent<
|
|
50
|
+
Omit<BarChartProps, 'ref'> & import('react').RefAttributes<SVGSVGElement>
|
|
51
|
+
>
|
|
52
|
+
>;
|
|
53
|
+
//# sourceMappingURL=BarChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/BarChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,UAAU,EAAS,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EACL,KAAK,eAAe,EAIpB,KAAK,MAAM,EACZ,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,MAAM,MAAM,SAAS,GAAG,MAAM,GAC5B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC;AAE9F,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC,GACjF,IAAI,CACF,YAAY,EACV,YAAY,GACZ,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,eAAe,GACf,UAAU,GACV,YAAY,GACZ,cAAc,CACjB,GAAG;IACF;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;CAC/C,CAAC;AAEJ,eAAO,MAAM,QAAQ,2JA4IpB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BarStackGroupProps } from './BarStackGroup';
|
|
2
|
+
export type BarPlotProps = Pick<
|
|
3
|
+
BarStackGroupProps,
|
|
4
|
+
| 'barPadding'
|
|
5
|
+
| 'BarComponent'
|
|
6
|
+
| 'fillOpacity'
|
|
7
|
+
| 'stroke'
|
|
8
|
+
| 'strokeWidth'
|
|
9
|
+
| 'borderRadius'
|
|
10
|
+
| 'roundBaseline'
|
|
11
|
+
| 'stackGap'
|
|
12
|
+
| 'barMinSize'
|
|
13
|
+
| 'stackMinSize'
|
|
14
|
+
| 'BarStackComponent'
|
|
15
|
+
> & {
|
|
16
|
+
/**
|
|
17
|
+
* Array of series IDs to render.
|
|
18
|
+
* If not provided, renders all series in the chart.
|
|
19
|
+
*/
|
|
20
|
+
seriesIds?: string[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* BarPlot component that handles multiple series with proper stacking coordination.
|
|
24
|
+
* Groups series by stack ID + y-axis ID combination and renders BarStackGroup for each group.
|
|
25
|
+
* This allows series with different y-axes to be rendered side by side while preventing
|
|
26
|
+
* cross-axis stacking (e.g., comparing $1M vs $1B companies on different scales).
|
|
27
|
+
*/
|
|
28
|
+
export declare const BarPlot: import('react').NamedExoticComponent<BarPlotProps>;
|
|
29
|
+
//# sourceMappingURL=BarPlot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarPlot.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/BarPlot.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,kBAAkB,EAChB,YAAY,GACZ,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,GACb,cAAc,GACd,eAAe,GACf,UAAU,GACV,YAAY,GACZ,cAAc,GACd,mBAAmB,CACtB,GAAG;IACF;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,OAAO,oDAmGnB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Rect } from '@coinbase/cds-common';
|
|
3
|
+
import type { ChartScaleFunction } from '../utils';
|
|
4
|
+
import { type BarProps } from './Bar';
|
|
5
|
+
import type { BarSeries } from './BarChart';
|
|
6
|
+
export type BarStackComponentProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The x position of the stack.
|
|
9
|
+
*/
|
|
10
|
+
x: number;
|
|
11
|
+
/**
|
|
12
|
+
* The y position of the stack.
|
|
13
|
+
*/
|
|
14
|
+
y: number;
|
|
15
|
+
/**
|
|
16
|
+
* The width of the stack.
|
|
17
|
+
*/
|
|
18
|
+
width: number;
|
|
19
|
+
/**
|
|
20
|
+
* The height of the stack.
|
|
21
|
+
*/
|
|
22
|
+
height: number;
|
|
23
|
+
/**
|
|
24
|
+
* The bar elements to render within the stack.
|
|
25
|
+
*/
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The index of the category this stack belongs to.
|
|
29
|
+
*/
|
|
30
|
+
categoryIndex: number;
|
|
31
|
+
/**
|
|
32
|
+
* Border radius for the bar.
|
|
33
|
+
* @default 4
|
|
34
|
+
*/
|
|
35
|
+
borderRadius?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to round the top corners.
|
|
38
|
+
*/
|
|
39
|
+
roundTop?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to round the bottom corners.
|
|
42
|
+
*/
|
|
43
|
+
roundBottom?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The y-origin for animations (baseline position).
|
|
46
|
+
*/
|
|
47
|
+
yOrigin?: number;
|
|
48
|
+
};
|
|
49
|
+
export type BarStackComponent = React.FC<BarStackComponentProps>;
|
|
50
|
+
export type BarStackProps = Pick<
|
|
51
|
+
BarProps,
|
|
52
|
+
'BarComponent' | 'fillOpacity' | 'stroke' | 'strokeWidth' | 'borderRadius'
|
|
53
|
+
> & {
|
|
54
|
+
/**
|
|
55
|
+
* Array of series configurations that belong to this stack.
|
|
56
|
+
*/
|
|
57
|
+
series: BarSeries[];
|
|
58
|
+
/**
|
|
59
|
+
* The category index for this stack.
|
|
60
|
+
*/
|
|
61
|
+
categoryIndex: number;
|
|
62
|
+
/**
|
|
63
|
+
* X position for this stack.
|
|
64
|
+
*/
|
|
65
|
+
x: number;
|
|
66
|
+
/**
|
|
67
|
+
* Width of this stack.
|
|
68
|
+
*/
|
|
69
|
+
width: number;
|
|
70
|
+
/**
|
|
71
|
+
* Y scale function.
|
|
72
|
+
*/
|
|
73
|
+
yScale: ChartScaleFunction;
|
|
74
|
+
/**
|
|
75
|
+
* Chart rect for bounds.
|
|
76
|
+
*/
|
|
77
|
+
rect: Rect;
|
|
78
|
+
/**
|
|
79
|
+
* Y axis ID to use.
|
|
80
|
+
* If not provided, will use the yAxisId from the first series.
|
|
81
|
+
*/
|
|
82
|
+
yAxisId?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Custom component to render the stack container.
|
|
85
|
+
* Can be used to add clip paths, outlines, or other custom styling.
|
|
86
|
+
* @default DefaultBarStack
|
|
87
|
+
*/
|
|
88
|
+
BarStackComponent?: BarStackComponent;
|
|
89
|
+
/**
|
|
90
|
+
* Whether to round the baseline of a bar (where the value is 0).
|
|
91
|
+
*/
|
|
92
|
+
roundBaseline?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Gap between bars in the stack.
|
|
95
|
+
*/
|
|
96
|
+
stackGap?: number;
|
|
97
|
+
/**
|
|
98
|
+
* Minimum size for individual bars in the stack.
|
|
99
|
+
*/
|
|
100
|
+
barMinSize?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Minimum size for the entire stack.
|
|
103
|
+
*/
|
|
104
|
+
stackMinSize?: number;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* BarStack component that renders a single stack of bars at a specific category index.
|
|
108
|
+
* Handles the stacking logic for bars within a single category.
|
|
109
|
+
*/
|
|
110
|
+
export declare const BarStack: React.NamedExoticComponent<BarStackProps>;
|
|
111
|
+
//# sourceMappingURL=BarStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarStack.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/BarStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAEnD,OAAO,EAA0B,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,QAAQ,EACR,cAAc,GAAG,aAAa,GAAG,QAAQ,GAAG,aAAa,GAAG,cAAc,CAC3E,GAAG;IACF;;OAEG;IACH,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAC3B;;OAEG;IACH,IAAI,EAAE,IAAI,CAAC;IACX;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,2CAijBpB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BarStackProps } from './BarStack';
|
|
2
|
+
export type BarStackGroupProps = Pick<
|
|
3
|
+
BarStackProps,
|
|
4
|
+
| 'BarComponent'
|
|
5
|
+
| 'fillOpacity'
|
|
6
|
+
| 'stroke'
|
|
7
|
+
| 'strokeWidth'
|
|
8
|
+
| 'borderRadius'
|
|
9
|
+
| 'roundBaseline'
|
|
10
|
+
| 'stackGap'
|
|
11
|
+
| 'barMinSize'
|
|
12
|
+
| 'stackMinSize'
|
|
13
|
+
| 'BarStackComponent'
|
|
14
|
+
> &
|
|
15
|
+
Pick<BarStackProps, 'series' | 'yAxisId'> & {
|
|
16
|
+
/**
|
|
17
|
+
* Index of this stack within the category (0-based).
|
|
18
|
+
*/
|
|
19
|
+
stackIndex: number;
|
|
20
|
+
/**
|
|
21
|
+
* Total number of stacks per category.
|
|
22
|
+
*/
|
|
23
|
+
totalStacks: number;
|
|
24
|
+
/**
|
|
25
|
+
* Padding between bar groups (0-1).
|
|
26
|
+
* @default 0.1
|
|
27
|
+
*/
|
|
28
|
+
barPadding?: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* BarStackGroup component that renders a group of stacks across all categories.
|
|
32
|
+
* Delegates the actual stacking logic to BarStack for each category.
|
|
33
|
+
*/
|
|
34
|
+
export declare const BarStackGroup: import('react').NamedExoticComponent<BarStackGroupProps>;
|
|
35
|
+
//# sourceMappingURL=BarStackGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BarStackGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/BarStackGroup.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,aAAa,EACX,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,GACb,cAAc,GACd,eAAe,GACf,UAAU,GACV,YAAY,GACZ,cAAc,GACd,mBAAmB,CACtB,GACC,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG;IAC1C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,aAAa,0DAkFzB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BarComponentProps } from './Bar';
|
|
3
|
+
export type DefaultBarProps = BarComponentProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Custom class name for the bar.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom styles for the bar.
|
|
10
|
+
*/
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Default bar component that renders a solid bar with animation.
|
|
15
|
+
*/
|
|
16
|
+
export declare const DefaultBar: React.NamedExoticComponent<DefaultBarProps>;
|
|
17
|
+
//# sourceMappingURL=DefaultBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultBar.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/DefaultBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAM7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,6CAuCtB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BarStackComponentProps } from './BarStack';
|
|
2
|
+
export type DefaultBarStackProps = BarStackComponentProps & {
|
|
3
|
+
/**
|
|
4
|
+
* Custom class name for the stack group.
|
|
5
|
+
*/
|
|
6
|
+
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Custom styles for the stack group.
|
|
9
|
+
*/
|
|
10
|
+
style?: React.CSSProperties;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Default stack component that renders children in a group with animated clip path.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DefaultBarStack: import('react').NamedExoticComponent<DefaultBarStackProps>;
|
|
16
|
+
//# sourceMappingURL=DefaultBarStack.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultBarStack.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/DefaultBarStack.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GAAG;IAC1D;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,4DA8C3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/chart/bar/index.ts"],"names":[],"mappings":"AACA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|