@automattic/charts 1.5.3 → 1.7.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 +17 -0
- package/README.md +2 -2
- package/dist/index.cjs +8981 -9569
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +318 -202
- package/dist/index.d.cts +1319 -1183
- package/dist/index.d.ts +1319 -1183
- package/dist/index.js +8561 -9570
- package/dist/index.js.map +1 -1
- package/dist/visx/group/index.cjs +8 -8
- package/dist/visx/group/index.d.cts +2 -3
- package/dist/visx/group/index.d.ts +2 -3
- package/dist/visx/group/index.js +1 -7
- package/dist/visx/legend/index.cjs +20 -10
- package/dist/visx/legend/index.d.cts +2 -1
- package/dist/visx/legend/index.d.ts +2 -1
- package/dist/visx/legend/index.js +2 -10
- package/dist/visx/text/index.cjs +20 -12
- package/dist/visx/text/index.d.cts +2 -1
- package/dist/visx/text/index.d.ts +2 -1
- package/dist/visx/text/index.js +2 -12
- package/package.json +32 -38
- package/src/charts/area-chart/types.ts +1 -1
- package/src/charts/bar-chart/bar-chart.tsx +1 -1
- package/src/charts/geo-chart/geo-chart.tsx +3 -1
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +113 -1
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +37 -6
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +81 -0
- package/src/charts/line-chart/line-chart.tsx +1 -1
- package/src/charts/line-chart/private/line-chart-annotation-label-popover.tsx +18 -2
- package/src/charts/line-chart/private/line-chart-annotation.tsx +1 -1
- package/src/charts/line-chart/types.ts +1 -1
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +2 -2
- package/src/charts/private/chart-layout/chart-layout.tsx +1 -2
- package/src/charts/private/x-zoom.tsx +2 -2
- package/src/components/legend/hooks/use-chart-legend-items.ts +6 -2
- package/src/components/legend/legend.tsx +1 -2
- package/src/components/legend/utils/label-transform-factory.ts +1 -1
- package/src/components/tooltip/accessible-tooltip.tsx +2 -6
- package/src/index.ts +6 -5
- package/src/providers/chart-context/themes.ts +1 -1
- package/src/providers/chart-context/types.ts +7 -2
- package/src/types.ts +118 -11
- package/src/utils/get-styles.ts +1 -2
- package/src/visx/types.ts +30 -1
- package/dist/chunk-5WRI5ZAA.js +0 -31
- package/dist/chunk-5WRI5ZAA.js.map +0 -1
- package/dist/chunk-7OZEQ5HE.cjs +0 -9
- package/dist/chunk-7OZEQ5HE.cjs.map +0 -1
- package/dist/chunk-DZUJEN5N.cjs +0 -31
- package/dist/chunk-DZUJEN5N.cjs.map +0 -1
- package/dist/chunk-NFRB2POF.js +0 -9
- package/dist/chunk-NFRB2POF.js.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/visx/group/index.cjs.map +0 -1
- package/dist/visx/group/index.js.map +0 -1
- package/dist/visx/legend/index.cjs.map +0 -1
- package/dist/visx/legend/index.js.map +0 -1
- package/dist/visx/text/index.cjs.map +0 -1
- package/dist/visx/text/index.js.map +0 -1
- package/tsup.config.ts +0 -46
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,79 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CSSProperties,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { LabelProps } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { ScaleType, ScaleInput } from '@visx/scale';
|
|
11
|
-
import { TextProps } from '@visx/text/lib/Text';
|
|
12
|
-
import { LineStyles, EventHandlerParams, GridStyles, GlyphProps } from '@visx/xychart';
|
|
13
|
-
export { EventHandlerParams, GridStyles, LineStyles } from '@visx/xychart';
|
|
14
|
-
import { GapSize } from '@wordpress/theme';
|
|
15
|
-
import { GoogleDataTableColumn, GoogleDataTableRow } from 'react-google-charts';
|
|
16
|
-
export { GoogleDataTableColumn, GoogleDataTableColumnRoleType, GoogleDataTableRow } from 'react-google-charts';
|
|
17
|
-
import { RenderTooltipParams, TooltipProps as TooltipProps$1 } from '@visx/xychart/lib/components/Tooltip';
|
|
18
|
-
export { RenderTooltipParams } from '@visx/xychart/lib/components/Tooltip';
|
|
19
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
20
|
-
import { TextProps as TextProps$1 } from '@visx/text';
|
|
21
|
-
import { PieArcDatum } from '@visx/shape/lib/shapes/Pie';
|
|
1
|
+
import { EventHandlerParams, EventHandlerParams as EventHandlerParams$1, GlyphProps, GridStyles, GridStyles as GridStyles$1, LineStyles, LineStyles as LineStyles$1, TooltipContextType } from "@visx/xychart";
|
|
2
|
+
import { CSSProperties, ComponentClass, ComponentProps, ComponentType, FC, MouseEvent, PointerEvent, PropsWithChildren, ReactElement, ReactNode, SVGProps } from "react";
|
|
3
|
+
import { TextProps } from "@visx/text";
|
|
4
|
+
import { PickD3Scale, ScaleInput, ScaleType } from "@visx/scale";
|
|
5
|
+
import { LegendOrdinal } from "@visx/legend";
|
|
6
|
+
import { CircleSubjectProps, ConnectorProps, LabelProps, LineSubjectProps } from "@visx/annotation";
|
|
7
|
+
import { TooltipProps as TooltipProps$1, UseTooltipPortalOptions } from "@visx/tooltip";
|
|
8
|
+
import { PieProvidedProps } from "@visx/shape";
|
|
9
|
+
import { AxisRendererProps, AxisScale, Orientation, TickFormatter } from "@visx/axis";
|
|
22
10
|
|
|
11
|
+
//#region src/types.d.ts
|
|
23
12
|
type ValueOf<T> = T[keyof T];
|
|
24
13
|
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
14
|
+
/**
|
|
15
|
+
* Mirrors the WordPress Design System gap token scale used by the WordPress UI Stack.
|
|
16
|
+
*/
|
|
17
|
+
type GapSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
|
|
18
|
+
type LegendShapeLabel<Data, Output, ExtraAttributes = object> = {
|
|
19
|
+
datum: Data;
|
|
20
|
+
index: number;
|
|
21
|
+
text: string;
|
|
22
|
+
value?: Output;
|
|
23
|
+
} & ExtraAttributes;
|
|
24
|
+
type LegendShapeRenderProps<Data, Output> = {
|
|
25
|
+
width?: string | number;
|
|
26
|
+
height?: string | number;
|
|
27
|
+
label: LegendShapeLabel<Data, Output>;
|
|
28
|
+
item: Data;
|
|
29
|
+
itemIndex: number;
|
|
30
|
+
fill?: string;
|
|
31
|
+
size?: string | number;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
};
|
|
34
|
+
type LegendShape<Data, Output> = 'rect' | 'circle' | 'line' | FC<LegendShapeRenderProps<Data, Output>> | ComponentClass<LegendShapeRenderProps<Data, Output>>;
|
|
35
|
+
type GoogleDataTableColumnType = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'timeofday';
|
|
36
|
+
declare enum GoogleDataTableColumnRoleType {
|
|
37
|
+
annotation = "annotation",
|
|
38
|
+
annotationText = "annotationText",
|
|
39
|
+
certainty = "certainty",
|
|
40
|
+
emphasis = "emphasis",
|
|
41
|
+
interval = "interval",
|
|
42
|
+
scope = "scope",
|
|
43
|
+
style = "style",
|
|
44
|
+
tooltip = "tooltip",
|
|
45
|
+
domain = "domain"
|
|
46
|
+
}
|
|
47
|
+
type GoogleDataTableColumn = {
|
|
48
|
+
type: GoogleDataTableColumnType;
|
|
49
|
+
label?: string;
|
|
50
|
+
role?: GoogleDataTableColumnRoleType;
|
|
51
|
+
pattern?: string;
|
|
52
|
+
p?: Record<string, unknown>;
|
|
53
|
+
id?: string;
|
|
54
|
+
} | string;
|
|
55
|
+
type GoogleDataTableCell = {
|
|
56
|
+
v?: unknown;
|
|
57
|
+
f?: string;
|
|
58
|
+
p?: Record<string, unknown>;
|
|
59
|
+
} | string | number | boolean | Date | null;
|
|
60
|
+
type GoogleDataTableRow = GoogleDataTableCell[];
|
|
25
61
|
type ChartType = 'area' | 'bar' | 'conversion-funnel' | 'leaderboard' | 'line' | 'pie' | 'pie-semi-circle';
|
|
26
62
|
type OrientationType = ValueOf<typeof Orientation>;
|
|
27
63
|
type AnnotationStyles = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
64
|
+
circleSubject?: Omit<CircleSubjectProps, 'x' | 'y'> & {
|
|
65
|
+
fill?: string;
|
|
66
|
+
};
|
|
67
|
+
lineSubject?: Omit<LineSubjectProps, 'x' | 'y'>;
|
|
68
|
+
connector?: Omit<ConnectorProps, 'x' | 'y' | 'dx' | 'dy'>;
|
|
69
|
+
label?: Omit<LabelProps, 'title' | 'subtitle' | 'x' | 'y'> & {
|
|
70
|
+
x?: number | 'start' | 'end';
|
|
71
|
+
y?: number | 'start' | 'end';
|
|
72
|
+
};
|
|
37
73
|
};
|
|
38
74
|
type DataPoint = {
|
|
39
|
-
|
|
40
|
-
|
|
75
|
+
label: string;
|
|
76
|
+
value: number;
|
|
41
77
|
};
|
|
42
78
|
/**
|
|
43
79
|
* Data format for GeoChart - uses Google Charts native data format for maximum flexibility.
|
|
@@ -72,315 +108,298 @@ type DataPoint = {
|
|
|
72
108
|
*/
|
|
73
109
|
type GeoData = [GoogleDataTableColumn[], ...GoogleDataTableRow[]];
|
|
74
110
|
type DataPointDate = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
111
|
+
date?: Date;
|
|
112
|
+
/**
|
|
113
|
+
* Supported Formats:
|
|
114
|
+
* - YYYY-MM-DD (local)
|
|
115
|
+
* - YYYY-MM-DD HH:mm:ss (local)
|
|
116
|
+
* - YYYY-MM-DD HH:mm (local)
|
|
117
|
+
* - YYYY-MM-DDTHH:mm:ss (local)
|
|
118
|
+
* - YYYY-MM-DDTHH:mm:ss.SSS (local)
|
|
119
|
+
* - YYYY-MM-DDTHH:mm (local)
|
|
120
|
+
* - YYYY-MM-DDTHH:mm:ssZ (UTC → local)
|
|
121
|
+
* - YYYY-MM-DDTHH:mm:ss±HH:mm (offset → local)
|
|
122
|
+
*/
|
|
123
|
+
dateString?: string;
|
|
124
|
+
value: number | null;
|
|
125
|
+
label?: string;
|
|
90
126
|
};
|
|
91
127
|
type LeaderboardEntry = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Unique internal key (e.g., 'key-direct')
|
|
130
|
+
*/
|
|
131
|
+
id: string;
|
|
132
|
+
/**
|
|
133
|
+
* Human-readable name (e.g., 'Direct') or a JSX element (e.g., <h4>Direct</h4>)
|
|
134
|
+
*/
|
|
135
|
+
label: string | ReactElement;
|
|
136
|
+
/**
|
|
137
|
+
* Value of the entry
|
|
138
|
+
*/
|
|
139
|
+
currentValue: number;
|
|
140
|
+
/**
|
|
141
|
+
* Value of the entry in the previous period
|
|
142
|
+
*/
|
|
143
|
+
previousValue: number;
|
|
144
|
+
/**
|
|
145
|
+
* Width of current bar, as % of the current value
|
|
146
|
+
*/
|
|
147
|
+
currentShare: number;
|
|
148
|
+
/**
|
|
149
|
+
* Width of previous bar, as % of the current value
|
|
150
|
+
*/
|
|
151
|
+
previousShare: number;
|
|
152
|
+
/**
|
|
153
|
+
* Delta of the entry
|
|
154
|
+
*/
|
|
155
|
+
delta: number;
|
|
156
|
+
/**
|
|
157
|
+
* Optional color for the entry's image/icon
|
|
158
|
+
*/
|
|
159
|
+
imageColor?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Optional click handler. When provided, the entire row becomes an
|
|
162
|
+
* interactive `<button>`: clickable and keyboard-focusable (Enter/Space),
|
|
163
|
+
* with a chevron affordance revealed on hover/focus. The consumer
|
|
164
|
+
* decides what the action does (e.g. drill-down). Rows without onClick are
|
|
165
|
+
* inert and render unchanged.
|
|
166
|
+
*
|
|
167
|
+
* For links or other interactive affordances (external-link icons, info
|
|
168
|
+
* tooltips), put them in the `label` render prop instead of using onClick —
|
|
169
|
+
* a row is either a button (onClick) or carries interactive label content,
|
|
170
|
+
* never both, since interactive elements cannot be nested in HTML.
|
|
171
|
+
*/
|
|
172
|
+
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
173
|
+
/**
|
|
174
|
+
* Optional accessible name for the interactive row's `<button>`. Only applies
|
|
175
|
+
* when `onClick` is set — without it the row renders as a Fragment with no
|
|
176
|
+
* element to receive `aria-label`. By default the button derives its name from
|
|
177
|
+
* its rendered content (label text plus the formatted value), which is the
|
|
178
|
+
* right outcome for plain-text labels. Set this when the `label` is JSX whose
|
|
179
|
+
* text content does not yield a clean name on its own — e.g. an image-only
|
|
180
|
+
* label — to give assistive tech a deterministic, human-readable name.
|
|
181
|
+
*/
|
|
182
|
+
ariaLabel?: string;
|
|
124
183
|
};
|
|
125
184
|
type GradientStop = {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
185
|
+
offset: string;
|
|
186
|
+
color?: string;
|
|
187
|
+
opacity?: number;
|
|
129
188
|
};
|
|
130
189
|
type SeriesDataOptions = {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
190
|
+
gradient?: {
|
|
191
|
+
from: string;
|
|
192
|
+
to: string;
|
|
193
|
+
fromOpacity?: number;
|
|
194
|
+
toOpacity?: number;
|
|
195
|
+
stops?: GradientStop[];
|
|
196
|
+
};
|
|
197
|
+
stroke?: string;
|
|
198
|
+
seriesLineStyle?: LineStyles$1;
|
|
199
|
+
legendShapeStyle?: CSSProperties;
|
|
200
|
+
type?: 'comparison';
|
|
142
201
|
};
|
|
143
202
|
type SeriesData = {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
203
|
+
group?: string;
|
|
204
|
+
label: string;
|
|
205
|
+
data: DataPointDate[] | DataPoint[];
|
|
206
|
+
options?: SeriesDataOptions;
|
|
148
207
|
};
|
|
149
208
|
type MultipleDataPointsDate = {
|
|
150
|
-
|
|
151
|
-
|
|
209
|
+
label: string;
|
|
210
|
+
data: DataPointDate[];
|
|
152
211
|
};
|
|
153
212
|
/**
|
|
154
213
|
* Input data point for percentage-based charts (pie, donut, semi-circle).
|
|
155
214
|
* Provide values; percentages will be calculated automatically.
|
|
156
215
|
*/
|
|
157
216
|
type DataPointPercentage = {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Label for the data point
|
|
219
|
+
*/
|
|
220
|
+
label: string;
|
|
221
|
+
/**
|
|
222
|
+
* Numerical value used for slice sizing.
|
|
223
|
+
* Percentages are calculated automatically from values.
|
|
224
|
+
*/
|
|
225
|
+
value: number;
|
|
226
|
+
/**
|
|
227
|
+
* Formatted value for display (e.g., "30K" instead of 30000)
|
|
228
|
+
*/
|
|
229
|
+
valueDisplay?: string;
|
|
230
|
+
/**
|
|
231
|
+
* Color code for the segment, by default colours are taken from the theme but this property can overrides it
|
|
232
|
+
*/
|
|
233
|
+
color?: string;
|
|
234
|
+
/**
|
|
235
|
+
* Group for the data point, used to match color with groups on other charts
|
|
236
|
+
*/
|
|
237
|
+
group?: string;
|
|
179
238
|
};
|
|
180
239
|
/**
|
|
181
240
|
* Internal type with calculated percentage.
|
|
182
241
|
* Used internally after percentage calculation from values.
|
|
183
242
|
*/
|
|
184
243
|
type DataPointPercentageCalculated = DataPointPercentage & {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
244
|
+
/**
|
|
245
|
+
* Calculated percentage (0-100) based on value relative to total
|
|
246
|
+
*/
|
|
247
|
+
percentage: number;
|
|
189
248
|
};
|
|
190
249
|
/**
|
|
191
250
|
* Base theme configuration for chart components with optional properties
|
|
192
251
|
*/
|
|
193
252
|
type ChartTheme = {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
/** Spacing between label and progress bars */
|
|
244
|
-
labelSpacing?: number;
|
|
245
|
-
/** Primary color for current period bars */
|
|
246
|
-
primaryColor?: string;
|
|
247
|
-
/** Secondary color for comparison period bars */
|
|
248
|
-
secondaryColor?: string;
|
|
249
|
-
/** Delta colors: [negative, neutral, positive] */
|
|
250
|
-
deltaColors?: [string, string, string];
|
|
251
|
-
};
|
|
252
|
-
/** ConversionFunnelChart specific settings */
|
|
253
|
-
conversionFunnelChart?: {
|
|
254
|
-
/** Primary color for funnel bars */
|
|
255
|
-
primaryColor?: string;
|
|
256
|
-
/** Background color for chart container */
|
|
257
|
-
backgroundColor?: string;
|
|
258
|
-
/** Color for positive change indicators */
|
|
259
|
-
positiveChangeColor?: string;
|
|
260
|
-
/** Color for negative change indicators */
|
|
261
|
-
negativeChangeColor?: string;
|
|
262
|
-
};
|
|
263
|
-
lineChart?: {
|
|
264
|
-
lineStyles?: Partial<Record<NonNullable<SeriesDataOptions['type']>, LineStyles>>;
|
|
265
|
-
};
|
|
266
|
-
/** Sparkline specific settings */
|
|
267
|
-
sparkline?: {
|
|
268
|
-
/** Margin around the sparkline chart */
|
|
269
|
-
margin?: {
|
|
270
|
-
top?: number;
|
|
271
|
-
right?: number;
|
|
272
|
-
bottom?: number;
|
|
273
|
-
left?: number;
|
|
274
|
-
};
|
|
275
|
-
/** Stroke width for the sparkline line */
|
|
276
|
-
strokeWidth?: number;
|
|
277
|
-
};
|
|
253
|
+
/** Background color for chart components */backgroundColor: string; /** Background color for labels */
|
|
254
|
+
labelBackgroundColor?: string; /** Text color for labels */
|
|
255
|
+
labelTextColor?: string; /** Array of colors used for data visualization */
|
|
256
|
+
colors: string[]; /** Optional CSS styles for grid lines */
|
|
257
|
+
gridStyles?: GridStyles$1; /** Length of axis ticks in pixels */
|
|
258
|
+
tickLength: number; /** Color of the grid lines */
|
|
259
|
+
gridColor: string; /** Color of the grid lines in dark mode */
|
|
260
|
+
gridColorDark: string; /** Styles for x-axis tick lines */
|
|
261
|
+
xTickLineStyles?: LineStyles$1; /** Styles for x-axis line */
|
|
262
|
+
xAxisLineStyles?: LineStyles$1; /** Styles for series lines */
|
|
263
|
+
seriesLineStyles?: LineStyles$1[]; /** Array of render functions for glyphs */
|
|
264
|
+
glyphs?: Array<(<Datum extends object>(props: GlyphProps<Datum>) => ReactNode)>; /** Legend specific settings */
|
|
265
|
+
legend?: {
|
|
266
|
+
/** Styles for legend shapes */shapeStyles?: Record<string, unknown>[]; /** Styles for legend labels */
|
|
267
|
+
labelStyles?: CSSProperties; /** Styles for legend container */
|
|
268
|
+
containerStyles?: CSSProperties;
|
|
269
|
+
}; /** Styles for small SVG text (eg. axis tick labels), passed through to the XYChart theme. */
|
|
270
|
+
svgLabelSmall?: TextProps; /** Styles for large SVG text (eg. axis titles), passed through to the XYChart theme. */
|
|
271
|
+
svgLabelBig?: TextProps;
|
|
272
|
+
annotationStyles?: AnnotationStyles; /** GeoChart specific settings */
|
|
273
|
+
geoChart?: {
|
|
274
|
+
/** Default fill color for a geo chart feature (e.g. country) with no data */featureFillColor?: string;
|
|
275
|
+
}; /** LeaderboardChart specific settings */
|
|
276
|
+
leaderboardChart?: {
|
|
277
|
+
/** Gap between rows in the leaderboard grid */rowGap?: number; /** Gap between columns in the leaderboard grid */
|
|
278
|
+
columnGap?: number; /** Spacing between label and progress bars */
|
|
279
|
+
labelSpacing?: GapSize; /** Primary color for current period bars */
|
|
280
|
+
primaryColor?: string; /** Secondary color for comparison period bars */
|
|
281
|
+
secondaryColor?: string; /** Delta colors: [negative, neutral, positive] */
|
|
282
|
+
deltaColors?: [string, string, string];
|
|
283
|
+
}; /** ConversionFunnelChart specific settings */
|
|
284
|
+
conversionFunnelChart?: {
|
|
285
|
+
/** Primary color for funnel bars */primaryColor?: string; /** Background color for chart container */
|
|
286
|
+
backgroundColor?: string; /** Color for positive change indicators */
|
|
287
|
+
positiveChangeColor?: string; /** Color for negative change indicators */
|
|
288
|
+
negativeChangeColor?: string;
|
|
289
|
+
};
|
|
290
|
+
lineChart?: {
|
|
291
|
+
lineStyles?: Partial<Record<NonNullable<SeriesDataOptions['type']>, LineStyles$1>>;
|
|
292
|
+
}; /** Sparkline specific settings */
|
|
293
|
+
sparkline?: {
|
|
294
|
+
/** Margin around the sparkline chart */margin?: {
|
|
295
|
+
top?: number;
|
|
296
|
+
right?: number;
|
|
297
|
+
bottom?: number;
|
|
298
|
+
left?: number;
|
|
299
|
+
}; /** Stroke width for the sparkline line */
|
|
300
|
+
strokeWidth?: number;
|
|
301
|
+
};
|
|
278
302
|
};
|
|
279
303
|
/**
|
|
280
304
|
* Theme configuration with all properties guaranteed to be defined.
|
|
281
305
|
* Useful for merged themes where defaults are provided for all optional properties.
|
|
282
306
|
*/
|
|
283
307
|
type CompleteChartTheme = Required<ChartTheme> & {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
308
|
+
leaderboardChart: Omit<Required<NonNullable<ChartTheme['leaderboardChart']>>, 'primaryColor' | 'secondaryColor'> & Pick<NonNullable<ChartTheme['leaderboardChart']>, 'primaryColor' | 'secondaryColor'>;
|
|
309
|
+
conversionFunnelChart: Omit<Required<NonNullable<ChartTheme['conversionFunnelChart']>>, 'primaryColor'> & Pick<NonNullable<ChartTheme['conversionFunnelChart']>, 'primaryColor'>;
|
|
310
|
+
lineChart: {
|
|
311
|
+
lineStyles: Record<NonNullable<SeriesDataOptions['type']>, LineStyles$1>;
|
|
312
|
+
};
|
|
313
|
+
legend: Required<NonNullable<ChartTheme['legend']>>;
|
|
314
|
+
sparkline: Required<NonNullable<ChartTheme['sparkline']>> & {
|
|
315
|
+
margin: Required<NonNullable<ChartTheme['sparkline']>['margin']>;
|
|
316
|
+
};
|
|
293
317
|
};
|
|
294
318
|
type AxisOptions = {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
319
|
+
orientation?: OrientationType;
|
|
320
|
+
numTicks?: number;
|
|
321
|
+
/**
|
|
322
|
+
* Explicit tick values for the axis. When set, takes precedence over `numTicks`
|
|
323
|
+
* so callers can force a specific axis (e.g. integer-only steps on a sparse chart).
|
|
324
|
+
*/
|
|
325
|
+
tickValues?: ScaleInput<AxisScale>[];
|
|
326
|
+
axisClassName?: string;
|
|
327
|
+
axisLineClassName?: string;
|
|
328
|
+
labelClassName?: string;
|
|
329
|
+
tickClassName?: string;
|
|
330
|
+
tickFormat?: TickFormatter<ScaleInput<AxisScale>>;
|
|
331
|
+
/**
|
|
332
|
+
* Whether to display this axis. Defaults to true.
|
|
333
|
+
*/
|
|
334
|
+
display?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* For more control over rendering or to add event handlers to datum, pass a function as children.
|
|
337
|
+
*/
|
|
338
|
+
children?: (renderProps: AxisRendererProps<AxisScale>) => ReactNode;
|
|
339
|
+
/**
|
|
340
|
+
* Controls tick label overflow (bar charts only):
|
|
341
|
+
*
|
|
342
|
+
* - 'ellipsis': Truncate with ellipsis and fit to available space. Labels show full text
|
|
343
|
+
* on hover via native tooltip. Note: A minimum width (20px) is enforced for readability.
|
|
344
|
+
* On very dense charts (bandwidth < 20px), adjacent labels may overlap. To mitigate, use `numTicks`
|
|
345
|
+
* to reduce labels or `tickFormat` to abbreviate text.
|
|
346
|
+
* - undefined: No truncation; labels may overlap.
|
|
347
|
+
*
|
|
348
|
+
* Default: No truncation; labels may overlap.
|
|
349
|
+
*/
|
|
350
|
+
labelOverflow?: 'ellipsis';
|
|
327
351
|
};
|
|
328
352
|
type ScaleOptions = {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
353
|
+
type?: ScaleType;
|
|
354
|
+
zero?: boolean;
|
|
355
|
+
/**
|
|
356
|
+
* Extends the scale's domain to nice round values. Pass `false` together with
|
|
357
|
+
* an explicit `domain` to keep the tick values you set exactly.
|
|
358
|
+
*/
|
|
359
|
+
nice?: boolean;
|
|
360
|
+
domain?: [number, number] | [Date, Date];
|
|
361
|
+
range?: [number, number];
|
|
362
|
+
/**
|
|
363
|
+
* For band scale, shortcut for setting `paddingInner` and `paddingOuter` to the same value.
|
|
364
|
+
*
|
|
365
|
+
* For point scale, the outer padding (spacing) at the ends of the range.
|
|
366
|
+
* This is similar to band scale's `paddingOuter`.
|
|
367
|
+
*
|
|
368
|
+
*/
|
|
369
|
+
padding?: number;
|
|
370
|
+
/**
|
|
371
|
+
* The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].
|
|
372
|
+
*
|
|
373
|
+
*/
|
|
374
|
+
paddingInner?: number;
|
|
375
|
+
/**
|
|
376
|
+
* The outer padding (spacing) at the ends of the range of band and point scales,
|
|
377
|
+
* as a fraction of the step size. This value must lie in the range [0,1].
|
|
378
|
+
*
|
|
379
|
+
*/
|
|
380
|
+
paddingOuter?: number;
|
|
357
381
|
};
|
|
358
382
|
type LegendItemStyles = {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
/** Flex direction for items within each legend entry. */
|
|
362
|
-
flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
383
|
+
/** Margin around each legend item. */margin?: CSSProperties['margin']; /** Flex direction for items within each legend entry. */
|
|
384
|
+
flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
363
385
|
};
|
|
364
386
|
type LegendLabelStyles = Pick<CSSProperties, 'justifyContent' | 'flex' | 'margin'> & {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
387
|
+
/**
|
|
388
|
+
* Maximum width for legend label text as a CSS value (e.g. '200px', '50%', '10rem').
|
|
389
|
+
* When set, text overflow behavior is controlled by textOverflow.
|
|
390
|
+
*/
|
|
391
|
+
maxWidth?: string;
|
|
392
|
+
/**
|
|
393
|
+
* Controls how text behaves when it exceeds maxWidth.
|
|
394
|
+
* - 'ellipsis': Truncate with ellipsis (ideal for widgets/small devices)
|
|
395
|
+
* - 'wrap': Wrap text to multiple lines (default, ideal for larger displays)
|
|
396
|
+
*/
|
|
397
|
+
textOverflow?: 'ellipsis' | 'wrap';
|
|
376
398
|
};
|
|
377
399
|
type LegendShapeStyles = {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
height?: number;
|
|
382
|
-
/** Margin around the legend shape. */
|
|
383
|
-
margin?: CSSProperties['margin'];
|
|
400
|
+
/** Width of the legend shape in pixels. */width?: number; /** Height of the legend shape in pixels. */
|
|
401
|
+
height?: number; /** Margin around the legend shape. */
|
|
402
|
+
margin?: CSSProperties['margin'];
|
|
384
403
|
};
|
|
385
404
|
/** Position of the legend relative to chart content. */
|
|
386
405
|
type LegendPosition = 'top' | 'bottom';
|
|
@@ -389,229 +408,227 @@ type LegendPosition = 'top' | 'bottom';
|
|
|
389
408
|
* Consolidates all legend styling and layout props into a single structured object.
|
|
390
409
|
*/
|
|
391
410
|
type ChartLegendConfig<T = DataPoint | DataPointDate | LeaderboardEntry> = {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
411
|
+
/**
|
|
412
|
+
* Layout direction of legend items.
|
|
413
|
+
*/
|
|
414
|
+
orientation?: 'horizontal' | 'vertical';
|
|
415
|
+
/**
|
|
416
|
+
* Position of the legend relative to the chart.
|
|
417
|
+
* TODO: Add 'left' | 'right' positioning support in future implementation
|
|
418
|
+
*/
|
|
419
|
+
position?: LegendPosition;
|
|
420
|
+
/**
|
|
421
|
+
* Alignment of the legend within its position.
|
|
422
|
+
*/
|
|
423
|
+
alignment?: 'start' | 'center' | 'end';
|
|
424
|
+
/**
|
|
425
|
+
* Shape of the legend marker icon.
|
|
426
|
+
*/
|
|
427
|
+
shape?: LegendShape<T, number>;
|
|
428
|
+
/**
|
|
429
|
+
* Enable interactive legend items that can toggle series visibility.
|
|
430
|
+
* Supported for all chart types that render series.
|
|
431
|
+
* Requires chartId and GlobalChartsProvider.
|
|
432
|
+
* For pie charts, percentages are recalculated so visible segments total 100%.
|
|
433
|
+
*/
|
|
434
|
+
interactive?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Additional CSS class name for individual legend items.
|
|
437
|
+
*/
|
|
438
|
+
itemClassName?: string;
|
|
439
|
+
/**
|
|
440
|
+
* CSS styles for each legend item (margin, flexDirection).
|
|
441
|
+
*/
|
|
442
|
+
itemStyles?: LegendItemStyles;
|
|
443
|
+
/**
|
|
444
|
+
* CSS styles for legend labels (maxWidth, textOverflow, justifyContent, flex, margin).
|
|
445
|
+
*/
|
|
446
|
+
labelStyles?: LegendLabelStyles;
|
|
447
|
+
/**
|
|
448
|
+
* Styles for legend shapes (width, height, margin).
|
|
449
|
+
*/
|
|
450
|
+
shapeStyles?: LegendShapeStyles;
|
|
432
451
|
};
|
|
433
452
|
/**
|
|
434
453
|
* Base properties shared across all chart components
|
|
435
454
|
*/
|
|
436
455
|
type BaseChartProps<T = DataPoint | DataPointDate | LeaderboardEntry> = {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
};
|
|
456
|
+
/**
|
|
457
|
+
* Array of data points to display in the chart
|
|
458
|
+
*/
|
|
459
|
+
data: T extends DataPoint | DataPointDate | LeaderboardEntry ? T[] : T;
|
|
460
|
+
/**
|
|
461
|
+
* Optional unique identifier for the chart (auto-generated if not provided)
|
|
462
|
+
*/
|
|
463
|
+
chartId?: string;
|
|
464
|
+
/**
|
|
465
|
+
* Additional CSS class name for the chart container
|
|
466
|
+
*/
|
|
467
|
+
className?: string;
|
|
468
|
+
/**
|
|
469
|
+
* Width of the chart container in pixels. When omitted, the chart fills its parent's width.
|
|
470
|
+
*/
|
|
471
|
+
width?: number;
|
|
472
|
+
/**
|
|
473
|
+
* Height of the chart container in pixels. When omitted, the chart fills its parent's height.
|
|
474
|
+
*/
|
|
475
|
+
height?: number;
|
|
476
|
+
/**
|
|
477
|
+
* Maximum diameter of the pie in pixels (pie and donut charts only).
|
|
478
|
+
* The pie will shrink if the container is smaller than this value.
|
|
479
|
+
* When omitted, the pie fills the available space.
|
|
480
|
+
*/
|
|
481
|
+
size?: number;
|
|
482
|
+
/**
|
|
483
|
+
* Chart margins
|
|
484
|
+
*/
|
|
485
|
+
margin?: {
|
|
486
|
+
top?: number;
|
|
487
|
+
right?: number;
|
|
488
|
+
bottom?: number;
|
|
489
|
+
left?: number;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Callback function for pointer down event
|
|
493
|
+
*/
|
|
494
|
+
onPointerDown?: (event: EventHandlerParams$1<DataPoint | DataPointDate>) => void;
|
|
495
|
+
/**
|
|
496
|
+
* Callback function for pointer up event
|
|
497
|
+
*/
|
|
498
|
+
onPointerUp?: (event: EventHandlerParams$1<DataPoint | DataPointDate>) => void;
|
|
499
|
+
/**
|
|
500
|
+
* Callback function for pointer move event
|
|
501
|
+
*/
|
|
502
|
+
onPointerMove?: (event: EventHandlerParams$1<DataPoint | DataPointDate>) => void;
|
|
503
|
+
/**
|
|
504
|
+
* Callback function for pointer out event
|
|
505
|
+
*/
|
|
506
|
+
onPointerOut?: (event: PointerEvent<Element>) => void;
|
|
507
|
+
/**
|
|
508
|
+
* Whether to show tooltips on hover. False by default.
|
|
509
|
+
*/
|
|
510
|
+
withTooltips?: boolean;
|
|
511
|
+
/**
|
|
512
|
+
* Whether to show legend
|
|
513
|
+
*/
|
|
514
|
+
showLegend?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Legend configuration object for controlling legend appearance and behavior.
|
|
517
|
+
* Includes orientation, position, alignment, shape, styling, and interactivity options.
|
|
518
|
+
*/
|
|
519
|
+
legend?: ChartLegendConfig<T>;
|
|
520
|
+
/**
|
|
521
|
+
* Grid visibility. x is default when orientation is vertical. y is default when orientation is horizontal.
|
|
522
|
+
*/
|
|
523
|
+
gridVisibility?: 'x' | 'y' | 'xy' | 'none';
|
|
524
|
+
/**
|
|
525
|
+
* Whether to show chart animation on initial render or not
|
|
526
|
+
*/
|
|
527
|
+
animation?: boolean;
|
|
528
|
+
/**
|
|
529
|
+
* Gap between chart elements (SVG, legend, children).
|
|
530
|
+
* Uses WordPress design system tokens.
|
|
531
|
+
* @default 'md'
|
|
532
|
+
*/
|
|
533
|
+
gap?: GapSize;
|
|
534
|
+
/**
|
|
535
|
+
* More options for the chart.
|
|
536
|
+
*/
|
|
537
|
+
options?: {
|
|
538
|
+
yScale?: ScaleOptions;
|
|
539
|
+
xScale?: ScaleOptions;
|
|
540
|
+
axis?: {
|
|
541
|
+
x?: AxisOptions;
|
|
542
|
+
y?: AxisOptions;
|
|
525
543
|
};
|
|
544
|
+
};
|
|
526
545
|
};
|
|
527
546
|
/**
|
|
528
547
|
* Properties for grid components
|
|
529
548
|
*/
|
|
530
549
|
type GridProps = {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
550
|
+
/**
|
|
551
|
+
* Width of the grid in pixels
|
|
552
|
+
*/
|
|
553
|
+
width: number;
|
|
554
|
+
/**
|
|
555
|
+
* Height of the grid in pixels
|
|
556
|
+
*/
|
|
557
|
+
height: number;
|
|
558
|
+
/**
|
|
559
|
+
* Grid visibility. x is default.
|
|
560
|
+
*/
|
|
561
|
+
gridVisibility?: 'x' | 'y' | 'xy' | 'none';
|
|
562
|
+
/**
|
|
563
|
+
* X-axis scale for the grid
|
|
564
|
+
* TODO: Fix any type after resolving visx scale type issues
|
|
565
|
+
*/
|
|
566
|
+
xScale: any;
|
|
567
|
+
/**
|
|
568
|
+
* Y-axis scale for the grid
|
|
569
|
+
* TODO: Fix any type after resolving visx scale type issues
|
|
570
|
+
*/
|
|
571
|
+
yScale: any;
|
|
572
|
+
/**
|
|
573
|
+
* Top offset for the grid
|
|
574
|
+
*/
|
|
575
|
+
top?: number;
|
|
557
576
|
};
|
|
558
|
-
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/components/legend/types.d.ts
|
|
559
579
|
type VisxLegendProps = Pick<ComponentProps<typeof LegendOrdinal>, 'className' | 'shape' | 'fill' | 'size' | 'labelFormat' | 'labelTransform'>;
|
|
560
580
|
type BaseLegendProps = VisxLegendProps & {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
interactive?: boolean;
|
|
584
|
-
/**
|
|
585
|
-
* Chart ID for series visibility tracking when interactive mode is enabled.
|
|
586
|
-
*/
|
|
587
|
-
chartId?: string;
|
|
581
|
+
items: BaseLegendItem[];
|
|
582
|
+
orientation?: 'horizontal' | 'vertical';
|
|
583
|
+
position?: LegendPosition;
|
|
584
|
+
alignment?: 'start' | 'center' | 'end'; /** Additional CSS class name for legend items. */
|
|
585
|
+
itemClassName?: string; /** CSS styles for each legend item (margin, flexDirection). */
|
|
586
|
+
itemStyles?: LegendItemStyles; /** Additional CSS class name for legend labels. */
|
|
587
|
+
labelClassName?: string; /** CSS styles for legend labels (justifyContent, flex, margin). */
|
|
588
|
+
labelStyles?: LegendLabelStyles; /** Styles for legend shapes (width, height, margin). */
|
|
589
|
+
shapeStyles?: LegendShapeStyles;
|
|
590
|
+
/**
|
|
591
|
+
* Function for rendering a custom legend layout.
|
|
592
|
+
*/
|
|
593
|
+
render?: (items: BaseLegendItem[]) => ReactNode;
|
|
594
|
+
/**
|
|
595
|
+
* Enable interactive legend items that can toggle series visibility.
|
|
596
|
+
* Requires GlobalChartsProvider and chartId to be set.
|
|
597
|
+
*/
|
|
598
|
+
interactive?: boolean;
|
|
599
|
+
/**
|
|
600
|
+
* Chart ID for series visibility tracking when interactive mode is enabled.
|
|
601
|
+
*/
|
|
602
|
+
chartId?: string;
|
|
588
603
|
};
|
|
589
604
|
type LegendProps = Omit<BaseLegendProps, 'items'> & {
|
|
590
|
-
|
|
591
|
-
|
|
605
|
+
items?: BaseLegendItem[];
|
|
606
|
+
chartId?: string;
|
|
592
607
|
};
|
|
593
608
|
type BaseLegendItem = {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
609
|
+
label: string;
|
|
610
|
+
value?: number | string;
|
|
611
|
+
color: string;
|
|
612
|
+
glyphSize?: number;
|
|
613
|
+
renderGlyph?: <Datum extends object>(props: GlyphProps<Datum>) => ReactNode;
|
|
614
|
+
shapeStyle?: CSSProperties & LineStyles$1;
|
|
600
615
|
};
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/components/legend/legend.d.ts
|
|
618
|
+
declare const Legend: import("react").ForwardRefExoticComponent<Omit<BaseLegendProps, "items"> & {
|
|
619
|
+
items?: BaseLegendItem[];
|
|
620
|
+
chartId?: string;
|
|
621
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/components/legend/hooks/use-chart-legend-items.d.ts
|
|
607
624
|
type LegendValueDisplay = 'percentage' | 'value' | 'valueDisplay' | 'none';
|
|
608
625
|
interface ChartLegendOptions {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
626
|
+
withGlyph?: boolean;
|
|
627
|
+
glyphSize?: number;
|
|
628
|
+
renderGlyph?: <Datum extends object>(props: GlyphProps<Datum>) => ReactNode;
|
|
629
|
+
showValues?: boolean;
|
|
630
|
+
legendValueDisplay?: LegendValueDisplay;
|
|
631
|
+
legendShape?: LegendShape<SeriesData[], number>;
|
|
615
632
|
}
|
|
616
633
|
/**
|
|
617
634
|
* Hook to transform chart data into legend items
|
|
@@ -621,320 +638,360 @@ interface ChartLegendOptions {
|
|
|
621
638
|
* @return Array of legend items ready for display
|
|
622
639
|
*/
|
|
623
640
|
declare function useChartLegendItems<T extends SeriesData[] | DataPointDate[] | DataPointPercentageCalculated[]>(data: T, options?: ChartLegendOptions, legendShape?: LegendShape<SeriesData[], number>): BaseLegendItem[];
|
|
624
|
-
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region src/charts/private/single-chart-context/single-chart-context.d.ts
|
|
625
643
|
interface ChartInstanceRef {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
};
|
|
644
|
+
getScales: () => {
|
|
645
|
+
xScale: unknown;
|
|
646
|
+
yScale: unknown;
|
|
647
|
+
} | null;
|
|
648
|
+
getChartDimensions: () => {
|
|
649
|
+
width: number;
|
|
650
|
+
height: number;
|
|
651
|
+
margin: {
|
|
652
|
+
top?: number;
|
|
653
|
+
right?: number;
|
|
654
|
+
bottom?: number;
|
|
655
|
+
left?: number;
|
|
639
656
|
};
|
|
657
|
+
};
|
|
640
658
|
}
|
|
641
659
|
type SingleChartRef = ChartInstanceRef;
|
|
642
|
-
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region src/visx/types.d.ts
|
|
662
|
+
type RenderTooltipParams<Datum extends object> = TooltipContextType<Datum> & {
|
|
663
|
+
colorScale?: PickD3Scale<'ordinal', string, string>;
|
|
664
|
+
};
|
|
665
|
+
interface RenderTooltipGlyphProps<Datum extends object> extends GlyphProps<Datum> {
|
|
666
|
+
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
667
|
+
isNearestDatum: boolean;
|
|
668
|
+
}
|
|
669
|
+
type XyChartTooltipProps<Datum extends object> = {
|
|
670
|
+
renderTooltip: (params: RenderTooltipParams<Datum>) => ReactNode;
|
|
671
|
+
renderGlyph?: (params: RenderTooltipGlyphProps<Datum>) => ReactNode;
|
|
672
|
+
snapTooltipToDatumX?: boolean;
|
|
673
|
+
snapTooltipToDatumY?: boolean;
|
|
674
|
+
showVerticalCrosshair?: boolean;
|
|
675
|
+
showHorizontalCrosshair?: boolean;
|
|
676
|
+
showDatumGlyph?: boolean;
|
|
677
|
+
showSeriesGlyphs?: boolean;
|
|
678
|
+
verticalCrosshairStyle?: SVGProps<SVGLineElement>;
|
|
679
|
+
horizontalCrosshairStyle?: SVGProps<SVGLineElement>;
|
|
680
|
+
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
681
|
+
resizeObserverPolyfill?: UseTooltipPortalOptions['polyfill'];
|
|
682
|
+
} & Omit<TooltipProps$1, 'left' | 'top' | 'children'> & Pick<UseTooltipPortalOptions, 'debounce' | 'detectBounds' | 'scroll' | 'zIndex'>;
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/charts/line-chart/types.d.ts
|
|
643
685
|
type LineChartAnnotationProps = {
|
|
644
|
-
|
|
686
|
+
datum: DataPointDate;
|
|
687
|
+
title: string;
|
|
688
|
+
subtitle?: string;
|
|
689
|
+
subjectType?: 'circle' | 'line-vertical' | 'line-horizontal';
|
|
690
|
+
styles?: AnnotationStyles;
|
|
691
|
+
testId?: string;
|
|
692
|
+
renderLabel?: FC<{
|
|
693
|
+
title: string;
|
|
694
|
+
subtitle?: string;
|
|
695
|
+
}>;
|
|
696
|
+
renderLabelPopover?: FC<{
|
|
645
697
|
title: string;
|
|
646
698
|
subtitle?: string;
|
|
647
|
-
|
|
648
|
-
styles?: AnnotationStyles;
|
|
649
|
-
testId?: string;
|
|
650
|
-
renderLabel?: FC<{
|
|
651
|
-
title: string;
|
|
652
|
-
subtitle?: string;
|
|
653
|
-
}>;
|
|
654
|
-
renderLabelPopover?: FC<{
|
|
655
|
-
title: string;
|
|
656
|
-
subtitle?: string;
|
|
657
|
-
}>;
|
|
699
|
+
}>;
|
|
658
700
|
};
|
|
659
701
|
type CurveType = 'smooth' | 'linear' | 'monotone';
|
|
660
702
|
type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
|
|
661
|
-
|
|
662
|
-
|
|
703
|
+
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
704
|
+
position?: 'start' | 'end';
|
|
663
705
|
};
|
|
664
706
|
interface LineChartProps extends BaseChartProps<SeriesData[]> {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
707
|
+
withGradientFill: boolean;
|
|
708
|
+
smoothing?: boolean;
|
|
709
|
+
curveType?: CurveType;
|
|
710
|
+
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
711
|
+
withStartGlyphs?: boolean;
|
|
712
|
+
withEndGlyphs?: boolean;
|
|
713
|
+
renderGlyph?: <Datum extends object>(props: GlyphProps<Datum>) => ReactNode;
|
|
714
|
+
glyphStyle?: SVGProps<SVGCircleElement>;
|
|
715
|
+
withLegendGlyph?: boolean;
|
|
716
|
+
withTooltipCrosshairs?: {
|
|
717
|
+
showVertical?: boolean;
|
|
718
|
+
showHorizontal?: boolean;
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Enable drag-to-zoom on the X axis. The user drags horizontally to
|
|
722
|
+
* select a range; the X axis rescales to that range. A small reset
|
|
723
|
+
* button appears in the top-right of the chart while zoomed.
|
|
724
|
+
*/
|
|
725
|
+
zoomable?: boolean;
|
|
726
|
+
children?: ReactNode;
|
|
685
727
|
}
|
|
686
728
|
type TooltipDatum = {
|
|
687
|
-
|
|
688
|
-
|
|
729
|
+
key: string;
|
|
730
|
+
value: number;
|
|
689
731
|
};
|
|
690
|
-
|
|
732
|
+
//#endregion
|
|
733
|
+
//#region src/charts/area-chart/types.d.ts
|
|
691
734
|
interface AreaChartProps extends BaseChartProps<SeriesData[]> {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
735
|
+
/**
|
|
736
|
+
* Whether series should be stacked on top of each other.
|
|
737
|
+
* When false, series are rendered as overlapping filled areas.
|
|
738
|
+
* @default true
|
|
739
|
+
*/
|
|
740
|
+
stacked?: boolean;
|
|
741
|
+
/**
|
|
742
|
+
* Stack offset strategy when stacked is true. Mirrors d3-shape stack offsets.
|
|
743
|
+
* - 'none' (default): values stack at their natural magnitude
|
|
744
|
+
* - 'expand': values are normalized to the [0,1] range (percentage stacks)
|
|
745
|
+
* - 'wiggle': used for streamgraphs
|
|
746
|
+
* - 'silhouette': stack centered around zero
|
|
747
|
+
*/
|
|
748
|
+
stackOffset?: 'none' | 'expand' | 'wiggle' | 'silhouette';
|
|
749
|
+
/**
|
|
750
|
+
* Smoothing using a Catmull-Rom curve. Ignored if `curveType` is set.
|
|
751
|
+
*/
|
|
752
|
+
smoothing?: boolean;
|
|
753
|
+
/**
|
|
754
|
+
* Curve interpolation type. Takes precedence over `smoothing`.
|
|
755
|
+
*/
|
|
756
|
+
curveType?: CurveType;
|
|
757
|
+
/**
|
|
758
|
+
* Custom tooltip renderer.
|
|
759
|
+
*/
|
|
760
|
+
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
761
|
+
/**
|
|
762
|
+
* Whether to show crosshair lines in the tooltip.
|
|
763
|
+
*/
|
|
764
|
+
withTooltipCrosshairs?: {
|
|
765
|
+
showVertical?: boolean;
|
|
766
|
+
showHorizontal?: boolean;
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Fill opacity for the stacked areas. 0–1.
|
|
770
|
+
* @default 0.85 when stacked, 0.4 when overlapping
|
|
771
|
+
*/
|
|
772
|
+
fillOpacity?: number;
|
|
773
|
+
/**
|
|
774
|
+
* Whether to render a stroke (line) on top of each area.
|
|
775
|
+
* @default false when stacked, true when overlapping
|
|
776
|
+
*/
|
|
777
|
+
withStroke?: boolean;
|
|
778
|
+
/**
|
|
779
|
+
* Enable drag-to-zoom on the X axis. The user drags horizontally to
|
|
780
|
+
* select a range; the X axis rescales to that range. A small reset
|
|
781
|
+
* button appears in the top-right of the chart while zoomed.
|
|
782
|
+
*/
|
|
783
|
+
zoomable?: boolean;
|
|
784
|
+
/**
|
|
785
|
+
* When using an interactive legend, controls whether the Y axis rescales
|
|
786
|
+
* to fit only the visible series. Defaults to `true`, matching the
|
|
787
|
+
* intuitive default for LineChart and BarChart. Set to `false` to pin
|
|
788
|
+
* the Y axis to the full data extent so toggling legend items off does
|
|
789
|
+
* not move the chart's baseline.
|
|
790
|
+
* @default true
|
|
791
|
+
*/
|
|
792
|
+
rescaleYOnLegendToggle?: boolean;
|
|
793
|
+
children?: ReactNode;
|
|
751
794
|
}
|
|
752
|
-
|
|
795
|
+
//#endregion
|
|
796
|
+
//#region src/charts/private/with-responsive/with-responsive.d.ts
|
|
753
797
|
type ResponsiveConfig = {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
798
|
+
/**
|
|
799
|
+
* The maximum width of the chart. Defaults to 1200.
|
|
800
|
+
*/
|
|
801
|
+
maxWidth?: number;
|
|
802
|
+
/**
|
|
803
|
+
* The aspect ratio of the chart (height = width * aspectRatio).
|
|
804
|
+
* When provided, height is calculated from width.
|
|
805
|
+
* When omitted, the chart fills the parent container's height.
|
|
806
|
+
*/
|
|
807
|
+
aspectRatio?: number;
|
|
808
|
+
/**
|
|
809
|
+
* Child render updates upon resize are delayed until debounceTime milliseconds after the last resize event is observed.
|
|
810
|
+
*/
|
|
811
|
+
resizeDebounceTime?: number;
|
|
768
812
|
};
|
|
769
|
-
|
|
813
|
+
//#endregion
|
|
814
|
+
//#region src/charts/area-chart/area-chart.d.ts
|
|
770
815
|
type AreaChartSubComponents = {
|
|
771
|
-
|
|
816
|
+
Legend: typeof Legend;
|
|
772
817
|
};
|
|
773
818
|
type AreaChartBaseProps = Optional<AreaChartProps, 'width' | 'height' | 'size'>;
|
|
774
819
|
type AreaChartComponent = React.ForwardRefExoticComponent<AreaChartBaseProps & React.RefAttributes<SingleChartRef>> & AreaChartSubComponents;
|
|
775
820
|
type AreaChartResponsiveComponent = React.ForwardRefExoticComponent<AreaChartBaseProps & ResponsiveConfig & React.RefAttributes<SingleChartRef>> & AreaChartSubComponents;
|
|
776
821
|
declare const AreaChart: AreaChartComponent;
|
|
777
822
|
declare const AreaChartResponsive: AreaChartResponsiveComponent;
|
|
778
|
-
|
|
823
|
+
//#endregion
|
|
824
|
+
//#region src/charts/bar-chart/bar-chart.d.ts
|
|
779
825
|
interface BarChartProps extends BaseChartProps<SeriesData[]> {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
826
|
+
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
827
|
+
orientation?: 'horizontal' | 'vertical';
|
|
828
|
+
withPatterns?: boolean;
|
|
829
|
+
showZeroValues?: boolean;
|
|
830
|
+
children?: ReactNode;
|
|
785
831
|
}
|
|
786
832
|
type BarChartBaseProps = Optional<BarChartProps, 'width' | 'height' | 'size'>;
|
|
787
833
|
interface BarChartSubComponents {
|
|
788
|
-
|
|
834
|
+
Legend: ComponentType<React.ComponentProps<typeof Legend>>;
|
|
789
835
|
}
|
|
790
836
|
type BarChartComponent = FC<BarChartBaseProps> & BarChartSubComponents;
|
|
791
837
|
type BarChartResponsiveComponent = FC<BarChartBaseProps & ResponsiveConfig> & BarChartSubComponents;
|
|
792
838
|
declare const BarChart: BarChartComponent;
|
|
793
839
|
declare const BarChartResponsive: BarChartResponsiveComponent;
|
|
794
|
-
|
|
840
|
+
//#endregion
|
|
841
|
+
//#region src/charts/bar-list-chart/bar-list-chart.d.ts
|
|
795
842
|
interface BarListChartProps extends Exclude<BarChartProps, 'orientation' | 'size' | 'gridVisibility'> {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
/**
|
|
806
|
-
* Formatter for the label.
|
|
807
|
-
*/
|
|
808
|
-
labelFormatter?: (value: string) => string;
|
|
809
|
-
/**
|
|
810
|
-
* Formatter for the value.
|
|
811
|
-
*/
|
|
812
|
-
valueFormatter?: (value: number) => string;
|
|
813
|
-
/**
|
|
814
|
-
* y offset of the label and value. Default is based on the number of series, automatically computed.
|
|
815
|
-
*/
|
|
816
|
-
yOffset?: number;
|
|
817
|
-
/**
|
|
818
|
-
* x position of the label.
|
|
819
|
-
*/
|
|
820
|
-
labelPosition?: number;
|
|
821
|
-
/**
|
|
822
|
-
* x position of the value.
|
|
823
|
-
*/
|
|
824
|
-
valuePosition?: number;
|
|
825
|
-
/**
|
|
826
|
-
* Custom render function for the label.
|
|
827
|
-
*/
|
|
828
|
-
labelComponent?: ComponentType<RenderLabelProps>;
|
|
829
|
-
/**
|
|
830
|
-
* Custom render function for the value.
|
|
831
|
-
*/
|
|
832
|
-
valueComponent?: ComponentType<RenderValueProps>;
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
interface RenderLabelProps {
|
|
836
|
-
textProps: TextProps$1;
|
|
837
|
-
x: number;
|
|
838
|
-
y: number;
|
|
839
|
-
label: string;
|
|
840
|
-
formatter: (value: string) => string;
|
|
841
|
-
}
|
|
842
|
-
interface RenderValueProps {
|
|
843
|
-
textProps: TextProps$1;
|
|
844
|
-
x: number;
|
|
845
|
-
y: number;
|
|
846
|
-
value: number;
|
|
843
|
+
options?: {
|
|
844
|
+
/**
|
|
845
|
+
* Scale for the y axis. Exclude the type property.
|
|
846
|
+
*/
|
|
847
|
+
yScale: Omit<ScaleOptions, 'type'>;
|
|
848
|
+
/**
|
|
849
|
+
* Scale for the x axis. Exclude the type property.
|
|
850
|
+
*/
|
|
851
|
+
xScale: Omit<ScaleOptions, 'type'>;
|
|
847
852
|
/**
|
|
848
|
-
*
|
|
853
|
+
* Formatter for the label.
|
|
849
854
|
*/
|
|
850
|
-
|
|
855
|
+
labelFormatter?: (value: string) => string;
|
|
851
856
|
/**
|
|
852
|
-
*
|
|
857
|
+
* Formatter for the value.
|
|
853
858
|
*/
|
|
854
|
-
|
|
855
|
-
|
|
859
|
+
valueFormatter?: (value: number) => string;
|
|
860
|
+
/**
|
|
861
|
+
* y offset of the label and value. Default is based on the number of series, automatically computed.
|
|
862
|
+
*/
|
|
863
|
+
yOffset?: number;
|
|
864
|
+
/**
|
|
865
|
+
* x position of the label.
|
|
866
|
+
*/
|
|
867
|
+
labelPosition?: number;
|
|
868
|
+
/**
|
|
869
|
+
* x position of the value.
|
|
870
|
+
*/
|
|
871
|
+
valuePosition?: number;
|
|
872
|
+
/**
|
|
873
|
+
* Custom render function for the label.
|
|
874
|
+
*/
|
|
875
|
+
labelComponent?: ComponentType<RenderLabelProps>;
|
|
876
|
+
/**
|
|
877
|
+
* Custom render function for the value.
|
|
878
|
+
*/
|
|
879
|
+
valueComponent?: ComponentType<RenderValueProps>;
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
interface RenderLabelProps {
|
|
883
|
+
textProps: TextProps;
|
|
884
|
+
x: number;
|
|
885
|
+
y: number;
|
|
886
|
+
label: string;
|
|
887
|
+
formatter: (value: string) => string;
|
|
888
|
+
}
|
|
889
|
+
interface RenderValueProps {
|
|
890
|
+
textProps: TextProps;
|
|
891
|
+
x: number;
|
|
892
|
+
y: number;
|
|
893
|
+
value: number;
|
|
894
|
+
/**
|
|
895
|
+
* Original data
|
|
896
|
+
*/
|
|
897
|
+
data: SeriesData[];
|
|
898
|
+
/**
|
|
899
|
+
* Index of the data point
|
|
900
|
+
*/
|
|
901
|
+
index: number;
|
|
902
|
+
formatter: (value: number) => string;
|
|
856
903
|
}
|
|
857
904
|
declare const BarListChart: FC<BarListChartProps>;
|
|
858
|
-
declare const BarListChartResponsive: ({
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
905
|
+
declare const BarListChartResponsive: ({
|
|
906
|
+
resizeDebounceTime,
|
|
907
|
+
maxWidth,
|
|
908
|
+
aspectRatio,
|
|
909
|
+
size,
|
|
910
|
+
width,
|
|
911
|
+
height,
|
|
912
|
+
...chartProps
|
|
913
|
+
}: Omit<BarListChartProps, "width" | "height" | "size"> & {
|
|
914
|
+
width?: number;
|
|
915
|
+
height?: number;
|
|
916
|
+
size?: number;
|
|
917
|
+
} & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element;
|
|
918
|
+
//#endregion
|
|
919
|
+
//#region src/charts/conversion-funnel-chart/types.d.ts
|
|
864
920
|
/**
|
|
865
921
|
* Represents a single step in the conversion funnel
|
|
866
922
|
*/
|
|
867
923
|
interface FunnelStep {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
924
|
+
/** Step identifier */
|
|
925
|
+
id: string;
|
|
926
|
+
/** Display label for the step */
|
|
927
|
+
label: string;
|
|
928
|
+
/** Conversion rate as percentage (0-100) */
|
|
929
|
+
rate: number;
|
|
930
|
+
/** Absolute count (optional, for tooltip/details) */
|
|
931
|
+
count?: number;
|
|
876
932
|
}
|
|
877
933
|
/**
|
|
878
934
|
* Render prop for customizing step labels
|
|
879
935
|
*/
|
|
880
936
|
interface StepLabelRenderProps {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
937
|
+
step: FunnelStep;
|
|
938
|
+
index: number;
|
|
939
|
+
className?: string;
|
|
884
940
|
}
|
|
885
941
|
/**
|
|
886
942
|
* Render prop for customizing step rates
|
|
887
943
|
*/
|
|
888
944
|
interface StepRateRenderProps {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
945
|
+
step: FunnelStep;
|
|
946
|
+
index: number;
|
|
947
|
+
className?: string;
|
|
892
948
|
}
|
|
893
949
|
/**
|
|
894
950
|
* Render prop for customizing the entire main metric section
|
|
895
951
|
*/
|
|
896
952
|
interface MainMetricRenderProps {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
953
|
+
mainRate: number;
|
|
954
|
+
changeIndicator?: string;
|
|
955
|
+
className?: string;
|
|
956
|
+
changeColor?: string;
|
|
901
957
|
}
|
|
902
958
|
/**
|
|
903
959
|
* Render prop for customizing tooltip content
|
|
904
960
|
*/
|
|
905
961
|
interface TooltipRenderProps {
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
962
|
+
step: FunnelStep;
|
|
963
|
+
index: number;
|
|
964
|
+
top: number;
|
|
965
|
+
left: number;
|
|
966
|
+
className?: string;
|
|
911
967
|
}
|
|
912
968
|
/**
|
|
913
969
|
* Props for the ConversionFunnelChart component
|
|
914
970
|
*/
|
|
915
971
|
interface ConversionFunnelChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'animation'> {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
972
|
+
/** Main conversion rate to highlight */
|
|
973
|
+
mainRate: number;
|
|
974
|
+
/** Change indicator (e.g., +2%, -1.5%) */
|
|
975
|
+
changeIndicator?: string;
|
|
976
|
+
/** Array of funnel steps */
|
|
977
|
+
steps: FunnelStep[];
|
|
978
|
+
/** Whether the chart is in loading state */
|
|
979
|
+
loading?: boolean;
|
|
980
|
+
/** Height of the chart container. Accepts a number (pixels) or CSS string (e.g., "400px", "100%"). Falls back to style.height if set, otherwise defaults to "100%". */
|
|
981
|
+
height?: string | number;
|
|
982
|
+
/** Custom styling */
|
|
983
|
+
style?: React.CSSProperties;
|
|
984
|
+
/** Custom render function for step labels */
|
|
985
|
+
renderStepLabel?: (props: StepLabelRenderProps) => React.ReactNode;
|
|
986
|
+
/** Custom render function for step rates */
|
|
987
|
+
renderStepRate?: (props: StepRateRenderProps) => React.ReactNode;
|
|
988
|
+
/** Custom render function for the entire main metric section */
|
|
989
|
+
renderMainMetric?: (props: MainMetricRenderProps) => React.ReactNode;
|
|
990
|
+
/** Custom render function for tooltip content */
|
|
991
|
+
renderTooltip?: (props: TooltipRenderProps) => React.ReactNode;
|
|
936
992
|
}
|
|
937
|
-
|
|
993
|
+
//#endregion
|
|
994
|
+
//#region src/charts/conversion-funnel-chart/conversion-funnel-chart.d.ts
|
|
938
995
|
/**
|
|
939
996
|
* ConversionFunnelChart component with provider wrapper
|
|
940
997
|
*
|
|
@@ -942,7 +999,8 @@ interface ConversionFunnelChartProps extends Pick<BaseChartProps, 'className' |
|
|
|
942
999
|
* @return JSX element representing the conversion funnel chart
|
|
943
1000
|
*/
|
|
944
1001
|
declare const ConversionFunnelChartWithProvider: FC<ConversionFunnelChartProps>;
|
|
945
|
-
|
|
1002
|
+
//#endregion
|
|
1003
|
+
//#region src/charts/geo-chart/types.d.ts
|
|
946
1004
|
/**
|
|
947
1005
|
* Region to display on the map.
|
|
948
1006
|
* Use 'world' for global view or any ISO 3166-1 alpha-2 country code
|
|
@@ -957,113 +1015,133 @@ type GeoRegion = 'world' | (string & {});
|
|
|
957
1015
|
*/
|
|
958
1016
|
type GeoResolution = 'countries' | 'provinces' | 'metros';
|
|
959
1017
|
interface GeoChartProps extends Pick<BaseChartProps, 'className' | 'chartId' | 'width' | 'height'> {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1018
|
+
/**
|
|
1019
|
+
* Data in Google Charts native format for maximum flexibility.
|
|
1020
|
+
* First row contains column headers, subsequent rows contain data.
|
|
1021
|
+
*
|
|
1022
|
+
* Country identifiers can be either full country names or ISO 3166-1 alpha-2 codes
|
|
1023
|
+
* (e.g., 'United States' or 'US').
|
|
1024
|
+
*/
|
|
1025
|
+
data: GeoData;
|
|
1026
|
+
/**
|
|
1027
|
+
* Region to display. Use 'world' for global view, 'US' for United States,
|
|
1028
|
+
* or any ISO 3166-1 alpha-2 country code.
|
|
1029
|
+
* @default 'world'
|
|
1030
|
+
*/
|
|
1031
|
+
region?: GeoRegion;
|
|
1032
|
+
/**
|
|
1033
|
+
* Resolution level for the map.
|
|
1034
|
+
* - 'countries': Country-level (default for 'world')
|
|
1035
|
+
* - 'provinces': State/province level (use with specific region like 'US')
|
|
1036
|
+
* - 'metros': Metropolitan areas (US only)
|
|
1037
|
+
* @default 'countries'
|
|
1038
|
+
*/
|
|
1039
|
+
resolution?: GeoResolution;
|
|
1040
|
+
/**
|
|
1041
|
+
* Optional render function for the loading placeholder.
|
|
1042
|
+
* Called while Google Charts is loading.
|
|
1043
|
+
*/
|
|
1044
|
+
renderPlaceholder?: () => React.ReactNode;
|
|
987
1045
|
}
|
|
988
|
-
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region src/charts/geo-chart/geo-chart.d.ts
|
|
989
1048
|
declare const GeoChartWithProvider: FC<GeoChartProps>;
|
|
990
|
-
declare const GeoChartResponsive: ({
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1049
|
+
declare const GeoChartResponsive: ({
|
|
1050
|
+
resizeDebounceTime,
|
|
1051
|
+
maxWidth,
|
|
1052
|
+
aspectRatio,
|
|
1053
|
+
size,
|
|
1054
|
+
width,
|
|
1055
|
+
height,
|
|
1056
|
+
...chartProps
|
|
1057
|
+
}: Omit<GeoChartProps, "width" | "height" | "size"> & {
|
|
1058
|
+
width?: number;
|
|
1059
|
+
height?: number;
|
|
1060
|
+
size?: number;
|
|
1061
|
+
} & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element;
|
|
1062
|
+
//#endregion
|
|
1063
|
+
//#region src/charts/leaderboard-chart/types.d.ts
|
|
996
1064
|
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'data' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1065
|
+
/**
|
|
1066
|
+
* Whether to show comparison data
|
|
1067
|
+
*/
|
|
1068
|
+
withComparison?: boolean;
|
|
1069
|
+
/**
|
|
1070
|
+
* Whether to overlay the label on top of bar
|
|
1071
|
+
*/
|
|
1072
|
+
withOverlayLabel?: boolean;
|
|
1073
|
+
/**
|
|
1074
|
+
* Primary color for current period bars
|
|
1075
|
+
*/
|
|
1076
|
+
primaryColor?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* Secondary color for comparison period bars
|
|
1079
|
+
*/
|
|
1080
|
+
secondaryColor?: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* Formatter for values
|
|
1083
|
+
*/
|
|
1084
|
+
valueFormatter?: (value: number) => string;
|
|
1085
|
+
/**
|
|
1086
|
+
* Formatter for delta values
|
|
1087
|
+
*/
|
|
1088
|
+
deltaFormatter?: (value: number) => string;
|
|
1089
|
+
/**
|
|
1090
|
+
* Whether the chart is in loading state
|
|
1091
|
+
*/
|
|
1092
|
+
loading?: boolean;
|
|
1093
|
+
/**
|
|
1094
|
+
* Custom styling for the chart container
|
|
1095
|
+
*/
|
|
1096
|
+
style?: React.CSSProperties & {
|
|
1097
|
+
'--a8c--charts--leaderboard--bar--border-radius'?: string;
|
|
1098
|
+
};
|
|
1099
|
+
/**
|
|
1100
|
+
* Custom labels for legend items
|
|
1101
|
+
*/
|
|
1102
|
+
legendLabels?: {
|
|
1103
|
+
/**
|
|
1104
|
+
* Label for primary period data
|
|
1105
|
+
*/
|
|
1106
|
+
primary?: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Label for comparison period data (only used when withComparison is true)
|
|
1109
|
+
*/
|
|
1110
|
+
comparison?: string;
|
|
1111
|
+
};
|
|
1112
|
+
/**
|
|
1113
|
+
* Child components for composition API
|
|
1114
|
+
*/
|
|
1115
|
+
children?: ReactNode;
|
|
1048
1116
|
}
|
|
1049
|
-
|
|
1117
|
+
//#endregion
|
|
1118
|
+
//#region src/charts/leaderboard-chart/leaderboard-chart.d.ts
|
|
1050
1119
|
declare const LeaderboardChart: FC<LeaderboardChartProps> & {
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1120
|
+
Legend: import("react").ForwardRefExoticComponent<Omit<BaseLegendProps, "items"> & {
|
|
1121
|
+
items?: BaseLegendItem[];
|
|
1122
|
+
chartId?: string;
|
|
1123
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
1055
1124
|
};
|
|
1056
|
-
declare const LeaderboardChartResponsive: (({
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1125
|
+
declare const LeaderboardChartResponsive: (({
|
|
1126
|
+
resizeDebounceTime,
|
|
1127
|
+
maxWidth,
|
|
1128
|
+
aspectRatio,
|
|
1129
|
+
size,
|
|
1130
|
+
width,
|
|
1131
|
+
height,
|
|
1132
|
+
...chartProps
|
|
1133
|
+
}: Omit<LeaderboardChartProps, "width" | "height" | "size"> & {
|
|
1134
|
+
width?: number;
|
|
1135
|
+
height?: number;
|
|
1136
|
+
size?: number;
|
|
1137
|
+
} & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element) & {
|
|
1138
|
+
Legend: import("react").ForwardRefExoticComponent<Omit<BaseLegendProps, "items"> & {
|
|
1139
|
+
items?: BaseLegendItem[];
|
|
1140
|
+
chartId?: string;
|
|
1141
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
1065
1142
|
};
|
|
1066
|
-
|
|
1143
|
+
//#endregion
|
|
1144
|
+
//#region src/utils/date-parsing.d.ts
|
|
1067
1145
|
/**
|
|
1068
1146
|
* @file Date parsing utilities using date-fns for local timezone handling
|
|
1069
1147
|
*
|
|
@@ -1121,15 +1199,16 @@ declare const LeaderboardChartResponsive: (({ resizeDebounceTime, maxWidth, aspe
|
|
|
1121
1199
|
* @return {Date} A Date object representing the parsed date in local timezone, or an invalid Date if parsing fails
|
|
1122
1200
|
*/
|
|
1123
1201
|
declare const parseAsLocalDate: (dateString: string) => Date;
|
|
1124
|
-
|
|
1202
|
+
//#endregion
|
|
1203
|
+
//#region src/utils/format-metric-value.d.ts
|
|
1125
1204
|
/**
|
|
1126
1205
|
* Types for formatMetricValue
|
|
1127
1206
|
*/
|
|
1128
1207
|
type MetricValueType = 'number' | 'average' | 'currency';
|
|
1129
1208
|
type FormatMetricValueOptions = {
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1209
|
+
decimals?: number;
|
|
1210
|
+
useMultipliers?: boolean;
|
|
1211
|
+
signDisplay?: Intl.NumberFormatOptions['signDisplay'];
|
|
1133
1212
|
};
|
|
1134
1213
|
/**
|
|
1135
1214
|
* Format a numeric metric value based on type, precision and scale.
|
|
@@ -1143,8 +1222,13 @@ type FormatMetricValueOptions = {
|
|
|
1143
1222
|
* @param options.signDisplay - Controls when to display the sign (auto, always, never, exceptZero)
|
|
1144
1223
|
* @return Formatted string
|
|
1145
1224
|
*/
|
|
1146
|
-
declare const formatMetricValue: (value: string | number, type?: MetricValueType, {
|
|
1147
|
-
|
|
1225
|
+
declare const formatMetricValue: (value: string | number, type?: MetricValueType, {
|
|
1226
|
+
decimals,
|
|
1227
|
+
useMultipliers,
|
|
1228
|
+
signDisplay
|
|
1229
|
+
}?: FormatMetricValueOptions) => string;
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region src/utils/format-percentage.d.ts
|
|
1148
1232
|
/**
|
|
1149
1233
|
* Format a percentage value with smart decimal handling.
|
|
1150
1234
|
* Uses `@automattic/number-formatters` for consistent formatting.
|
|
@@ -1154,7 +1238,8 @@ declare const formatMetricValue: (value: string | number, type?: MetricValueType
|
|
|
1154
1238
|
* @return Formatted percentage string (e.g., "30%", "30.1%", "30.25%")
|
|
1155
1239
|
*/
|
|
1156
1240
|
declare const formatPercentage: (value: number) => string;
|
|
1157
|
-
|
|
1241
|
+
//#endregion
|
|
1242
|
+
//#region src/utils/merge-themes.d.ts
|
|
1158
1243
|
/**
|
|
1159
1244
|
* Merges chart themes with proper precedence.
|
|
1160
1245
|
* The second theme (override) takes precedence over the first theme (base).
|
|
@@ -1165,7 +1250,8 @@ declare const formatPercentage: (value: number) => string;
|
|
|
1165
1250
|
*/
|
|
1166
1251
|
declare function mergeThemes(baseTheme: CompleteChartTheme, overrideTheme: Partial<ChartTheme>): CompleteChartTheme;
|
|
1167
1252
|
declare function mergeThemes(baseTheme: ChartTheme, overrideTheme: Partial<ChartTheme>): ChartTheme;
|
|
1168
|
-
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/utils/color-utils.d.ts
|
|
1169
1255
|
/**
|
|
1170
1256
|
* Check if a value is a valid 6-digit hex color
|
|
1171
1257
|
* @param hex - The value to check
|
|
@@ -1230,7 +1316,8 @@ declare const normalizeColorToHex: (color: string, element?: HTMLElement | null,
|
|
|
1230
1316
|
* @throws {Error} if hex string is malformed
|
|
1231
1317
|
*/
|
|
1232
1318
|
declare const lightenHexColor: (hex: string, blend: number) => string;
|
|
1233
|
-
|
|
1319
|
+
//#endregion
|
|
1320
|
+
//#region src/charts/leaderboard-chart/hooks/use-leaderboard-legend-items.d.ts
|
|
1234
1321
|
/**
|
|
1235
1322
|
* Hook to create legend items from leaderboard data
|
|
1236
1323
|
* @param root0 - Configuration object
|
|
@@ -1244,43 +1331,54 @@ declare const lightenHexColor: (hex: string, blend: number) => string;
|
|
|
1244
1331
|
* @param root0.legendLabels.comparison - Label for comparison period data
|
|
1245
1332
|
* @return Array of legend items for the leaderboard chart
|
|
1246
1333
|
*/
|
|
1247
|
-
declare function useLeaderboardLegendItems({
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1334
|
+
declare function useLeaderboardLegendItems({
|
|
1335
|
+
data,
|
|
1336
|
+
primaryColor,
|
|
1337
|
+
secondaryColor,
|
|
1338
|
+
withComparison,
|
|
1339
|
+
withOverlayLabel,
|
|
1340
|
+
legendLabels
|
|
1341
|
+
}: {
|
|
1342
|
+
data: LeaderboardEntry[];
|
|
1343
|
+
primaryColor?: string;
|
|
1344
|
+
secondaryColor?: string;
|
|
1345
|
+
withComparison: boolean;
|
|
1346
|
+
withOverlayLabel: boolean;
|
|
1347
|
+
legendLabels?: {
|
|
1348
|
+
primary?: string;
|
|
1349
|
+
comparison?: string;
|
|
1350
|
+
};
|
|
1257
1351
|
}): BaseLegendItem[];
|
|
1258
|
-
|
|
1352
|
+
//#endregion
|
|
1353
|
+
//#region src/charts/line-chart/private/line-chart-annotations-overlay.d.ts
|
|
1259
1354
|
interface LineChartAnnotationsProps {
|
|
1260
|
-
|
|
1355
|
+
children?: ReactNode;
|
|
1261
1356
|
}
|
|
1262
1357
|
declare const LineChartAnnotationsOverlay: FC<LineChartAnnotationsProps>;
|
|
1263
|
-
|
|
1358
|
+
//#endregion
|
|
1359
|
+
//#region src/charts/line-chart/private/line-chart-annotation.d.ts
|
|
1264
1360
|
declare const LineChartAnnotation: FC<LineChartAnnotationProps>;
|
|
1265
|
-
|
|
1361
|
+
//#endregion
|
|
1362
|
+
//#region src/charts/line-chart/line-chart.d.ts
|
|
1266
1363
|
type LineChartAnnotationComponents = {
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1364
|
+
AnnotationsOverlay: typeof LineChartAnnotationsOverlay;
|
|
1365
|
+
Annotation: typeof LineChartAnnotation;
|
|
1366
|
+
Legend: typeof Legend;
|
|
1270
1367
|
};
|
|
1271
1368
|
type LineChartBaseProps = Optional<LineChartProps, 'width' | 'height' | 'size'>;
|
|
1272
1369
|
type LineChartComponent = React.ForwardRefExoticComponent<LineChartBaseProps & React.RefAttributes<SingleChartRef>> & LineChartAnnotationComponents;
|
|
1273
1370
|
type LineChartResponsiveComponent = React.ForwardRefExoticComponent<LineChartBaseProps & ResponsiveConfig & React.RefAttributes<SingleChartRef>> & LineChartAnnotationComponents;
|
|
1274
1371
|
declare const LineChart: LineChartComponent;
|
|
1275
1372
|
declare const LineChartResponsive: LineChartResponsiveComponent;
|
|
1276
|
-
|
|
1373
|
+
//#endregion
|
|
1374
|
+
//#region src/charts/private/chart-composition/types.d.ts
|
|
1277
1375
|
/**
|
|
1278
1376
|
* Base interface for chart subcomponents in the composition API
|
|
1279
1377
|
*/
|
|
1280
1378
|
interface BaseChartSubComponents {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1379
|
+
Legend: ComponentType<React.ComponentProps<typeof Legend>>;
|
|
1380
|
+
SVG: FC<PropsWithChildren>;
|
|
1381
|
+
HTML: FC<PropsWithChildren>;
|
|
1284
1382
|
}
|
|
1285
1383
|
/**
|
|
1286
1384
|
* Type helper for creating chart components with composition API
|
|
@@ -1288,231 +1386,235 @@ interface BaseChartSubComponents {
|
|
|
1288
1386
|
* @template TSubComponents - Additional subcomponents beyond the base ones
|
|
1289
1387
|
*/
|
|
1290
1388
|
type ChartComponentWithComposition<TProps, TSubComponents extends BaseChartSubComponents = BaseChartSubComponents> = FC<TProps> & TSubComponents;
|
|
1291
|
-
|
|
1389
|
+
//#endregion
|
|
1390
|
+
//#region src/charts/pie-chart/pie-chart.d.ts
|
|
1292
1391
|
/**
|
|
1293
1392
|
* Parameters passed to the renderTooltip function for pie charts.
|
|
1294
1393
|
*/
|
|
1295
1394
|
type PieChartRenderTooltipParams = {
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1395
|
+
/**
|
|
1396
|
+
* The data point being hovered, including label, value, and calculated percentage.
|
|
1397
|
+
*/
|
|
1398
|
+
tooltipData: DataPointPercentageCalculated;
|
|
1300
1399
|
};
|
|
1301
1400
|
interface PieChartProps extends BaseChartProps<DataPointPercentage[]> {
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1401
|
+
/**
|
|
1402
|
+
* Inner radius in pixels. If > 0, creates a donut chart. Defaults to 0.
|
|
1403
|
+
*/
|
|
1404
|
+
innerRadius?: number;
|
|
1405
|
+
/**
|
|
1406
|
+
* Add padding to the chart
|
|
1407
|
+
*/
|
|
1408
|
+
padding?: number;
|
|
1409
|
+
/**
|
|
1410
|
+
* Thickness of the pie chart.
|
|
1411
|
+
* A value between 0 and 1, where 0 means no thickness
|
|
1412
|
+
* and 1 means the maximum thickness.
|
|
1413
|
+
*/
|
|
1414
|
+
thickness?: number;
|
|
1415
|
+
/**
|
|
1416
|
+
* Scale of the gap between groups in the pie chart
|
|
1417
|
+
* A value between 0 and 1, where 0 means no gap.
|
|
1418
|
+
*/
|
|
1419
|
+
gapScale?: number;
|
|
1420
|
+
/**
|
|
1421
|
+
* Scale of the corner radius for the pie chart segments.
|
|
1422
|
+
* A value between 0 and 1, where 0 means no corner radius.
|
|
1423
|
+
*/
|
|
1424
|
+
cornerScale?: number;
|
|
1425
|
+
/**
|
|
1426
|
+
* Whether to show labels on pie segments. Defaults to true.
|
|
1427
|
+
*/
|
|
1428
|
+
showLabels?: boolean;
|
|
1429
|
+
/**
|
|
1430
|
+
* What type of value to display in the legend when showValues is true.
|
|
1431
|
+
* - 'percentage': Shows percentage values (e.g., "23%") [default]
|
|
1432
|
+
* - 'value': Shows raw numeric values (e.g., "30000")
|
|
1433
|
+
* - 'valueDisplay': Shows formatted values (e.g., "30K")
|
|
1434
|
+
* - 'none': Shows no values, only labels
|
|
1435
|
+
*/
|
|
1436
|
+
legendValueDisplay?: LegendValueDisplay;
|
|
1437
|
+
/**
|
|
1438
|
+
* Use the children prop to render additional elements on the chart.
|
|
1439
|
+
*/
|
|
1440
|
+
children?: ReactNode;
|
|
1441
|
+
/**
|
|
1442
|
+
* Horizontal offset for tooltip positioning in pixels (default: 0)
|
|
1443
|
+
*/
|
|
1444
|
+
tooltipOffsetX?: number;
|
|
1445
|
+
/**
|
|
1446
|
+
* Vertical offset for tooltip positioning in pixels (default: -15)
|
|
1447
|
+
*/
|
|
1448
|
+
tooltipOffsetY?: number;
|
|
1449
|
+
/**
|
|
1450
|
+
* Custom render function for tooltip content.
|
|
1451
|
+
* When provided, replaces the default BaseTooltip with custom content.
|
|
1452
|
+
*/
|
|
1453
|
+
renderTooltip?: (params: PieChartRenderTooltipParams) => ReactNode;
|
|
1355
1454
|
}
|
|
1356
1455
|
type PieChartBaseProps = Optional<PieChartProps, 'size'>;
|
|
1357
1456
|
type PieChartComponent = ChartComponentWithComposition<PieChartBaseProps>;
|
|
1358
1457
|
type PieChartResponsiveComponent = ChartComponentWithComposition<PieChartBaseProps & ResponsiveConfig>;
|
|
1359
1458
|
declare const PieChart: PieChartComponent;
|
|
1360
1459
|
declare const PieChartResponsive: PieChartResponsiveComponent;
|
|
1361
|
-
|
|
1460
|
+
//#endregion
|
|
1461
|
+
//#region src/charts/pie-semi-circle-chart/pie-semi-circle-chart.d.ts
|
|
1362
1462
|
/**
|
|
1363
1463
|
* Parameters passed to the renderTooltip function for semi-circle charts.
|
|
1364
1464
|
*/
|
|
1365
1465
|
type PieSemiCircleChartRenderTooltipParams = {
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1466
|
+
/**
|
|
1467
|
+
* The data point being hovered, including label, value, and calculated percentage.
|
|
1468
|
+
*/
|
|
1469
|
+
tooltipData: DataPointPercentageCalculated;
|
|
1370
1470
|
};
|
|
1371
1471
|
interface PieSemiCircleChartProps extends BaseChartProps<DataPointPercentage[]> {
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1472
|
+
/**
|
|
1473
|
+
* Explicit width of the chart container in pixels.
|
|
1474
|
+
* When omitted, the chart fills its parent container's width.
|
|
1475
|
+
* The chart always maintains a 2:1 width-to-height ratio, constrained by available space.
|
|
1476
|
+
*/
|
|
1477
|
+
width?: number;
|
|
1478
|
+
/**
|
|
1479
|
+
* Thickness of the pie chart. A value between 0 and 1
|
|
1480
|
+
*/
|
|
1481
|
+
thickness?: number;
|
|
1482
|
+
/**
|
|
1483
|
+
* Direction of chart rendering
|
|
1484
|
+
* true for clockwise, false for counter-clockwise
|
|
1485
|
+
*/
|
|
1486
|
+
clockwise?: boolean;
|
|
1487
|
+
/**
|
|
1488
|
+
* Label text to display above the chart
|
|
1489
|
+
*/
|
|
1490
|
+
label?: string;
|
|
1491
|
+
/**
|
|
1492
|
+
* Note text to display below the label
|
|
1493
|
+
*/
|
|
1494
|
+
note?: string;
|
|
1495
|
+
/**
|
|
1496
|
+
* Use the children prop to render additional elements on the chart.
|
|
1497
|
+
*/
|
|
1498
|
+
children?: ReactNode;
|
|
1499
|
+
/**
|
|
1500
|
+
* What type of value to display in the legend when showValues is true.
|
|
1501
|
+
* - 'percentage': Shows percentage values (e.g., "23%") [default]
|
|
1502
|
+
* - 'value': Shows raw numeric values (e.g., "30000")
|
|
1503
|
+
* - 'valueDisplay': Shows formatted values (e.g., "30K")
|
|
1504
|
+
* - 'none': Shows no values, only labels
|
|
1505
|
+
*/
|
|
1506
|
+
legendValueDisplay?: LegendValueDisplay;
|
|
1507
|
+
/**
|
|
1508
|
+
* Horizontal offset for tooltip positioning in pixels (default: 0)
|
|
1509
|
+
*/
|
|
1510
|
+
tooltipOffsetX?: number;
|
|
1511
|
+
/**
|
|
1512
|
+
* Vertical offset for tooltip positioning in pixels (default: -15)
|
|
1513
|
+
*/
|
|
1514
|
+
tooltipOffsetY?: number;
|
|
1515
|
+
/**
|
|
1516
|
+
* Custom render function for tooltip content.
|
|
1517
|
+
* When provided, replaces the default BaseTooltip with custom content.
|
|
1518
|
+
*/
|
|
1519
|
+
renderTooltip?: (params: PieSemiCircleChartRenderTooltipParams) => ReactNode;
|
|
1420
1520
|
}
|
|
1421
1521
|
type PieSemiCircleChartBaseProps = Optional<PieSemiCircleChartProps, 'width'>;
|
|
1422
1522
|
type PieSemiCircleChartComponent = ChartComponentWithComposition<PieSemiCircleChartBaseProps>;
|
|
1423
1523
|
type PieSemiCircleChartResponsiveComponent = ChartComponentWithComposition<PieSemiCircleChartBaseProps & ResponsiveConfig>;
|
|
1424
|
-
type ArcData =
|
|
1524
|
+
type ArcData = PieProvidedProps<DataPointPercentageCalculated>['arcs'][number];
|
|
1425
1525
|
declare const PieSemiCircleChart: PieSemiCircleChartComponent;
|
|
1426
1526
|
declare const PieSemiCircleChartResponsive: PieSemiCircleChartResponsiveComponent;
|
|
1427
|
-
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region src/charts/sparkline/types.d.ts
|
|
1428
1529
|
type SparklineDataPoint = number;
|
|
1429
1530
|
type GradientConfig = {
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1531
|
+
/**
|
|
1532
|
+
* Start color for gradient (defaults to color prop)
|
|
1533
|
+
*/
|
|
1534
|
+
from?: string;
|
|
1535
|
+
/**
|
|
1536
|
+
* End color for gradient (defaults to theme backgroundColor)
|
|
1537
|
+
*/
|
|
1538
|
+
to?: string;
|
|
1539
|
+
/**
|
|
1540
|
+
* Start opacity (0-1)
|
|
1541
|
+
* @default 0.5
|
|
1542
|
+
*/
|
|
1543
|
+
fromOpacity?: number;
|
|
1544
|
+
/**
|
|
1545
|
+
* End opacity (0-1)
|
|
1546
|
+
* @default 0.0
|
|
1547
|
+
*/
|
|
1548
|
+
toOpacity?: number;
|
|
1448
1549
|
};
|
|
1449
1550
|
interface SparklineProps {
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1551
|
+
/**
|
|
1552
|
+
* Array of numeric values to plot
|
|
1553
|
+
* @example [10, 25, 15, 30, 22, 35]
|
|
1554
|
+
*/
|
|
1555
|
+
data: SparklineDataPoint[];
|
|
1556
|
+
/**
|
|
1557
|
+
* Width of the sparkline in pixels
|
|
1558
|
+
* @default 100
|
|
1559
|
+
*/
|
|
1560
|
+
width?: number;
|
|
1561
|
+
/**
|
|
1562
|
+
* Height of the sparkline in pixels
|
|
1563
|
+
* @default 40
|
|
1564
|
+
*/
|
|
1565
|
+
height?: number;
|
|
1566
|
+
/**
|
|
1567
|
+
* Size (used by responsive variant, equivalent to width for square charts)
|
|
1568
|
+
*/
|
|
1569
|
+
size?: number;
|
|
1570
|
+
/**
|
|
1571
|
+
* Color for the line stroke (hex or CSS color)
|
|
1572
|
+
* @default Theme color (first color in theme.colors array)
|
|
1573
|
+
*/
|
|
1574
|
+
color?: string;
|
|
1575
|
+
/**
|
|
1576
|
+
* Line stroke width in pixels
|
|
1577
|
+
* @default 1
|
|
1578
|
+
*/
|
|
1579
|
+
strokeWidth?: number;
|
|
1580
|
+
/**
|
|
1581
|
+
* Whether to render the gradient fill beneath the line
|
|
1582
|
+
* @default true
|
|
1583
|
+
*/
|
|
1584
|
+
withGradientFill?: boolean;
|
|
1585
|
+
/**
|
|
1586
|
+
* Gradient configuration for area fill
|
|
1587
|
+
* If not provided, uses color prop with default opacity values
|
|
1588
|
+
*/
|
|
1589
|
+
gradient?: GradientConfig;
|
|
1590
|
+
/**
|
|
1591
|
+
* Additional CSS class name
|
|
1592
|
+
*/
|
|
1593
|
+
className?: string;
|
|
1594
|
+
/**
|
|
1595
|
+
* Chart ID for unique gradient/element identification
|
|
1596
|
+
*/
|
|
1597
|
+
chartId?: string;
|
|
1598
|
+
/**
|
|
1599
|
+
* Margin around the chart
|
|
1600
|
+
* @default { top: 2, right: 2, bottom: 2, left: 2 }
|
|
1601
|
+
*/
|
|
1602
|
+
margin?: {
|
|
1603
|
+
top?: number;
|
|
1604
|
+
right?: number;
|
|
1605
|
+
bottom?: number;
|
|
1606
|
+
left?: number;
|
|
1607
|
+
};
|
|
1608
|
+
/**
|
|
1609
|
+
* Enable entry animation on initial render
|
|
1610
|
+
* Creates a rising effect where the line scales up from the bottom.
|
|
1611
|
+
* Automatically respects user's prefers-reduced-motion system setting.
|
|
1612
|
+
* @default false
|
|
1613
|
+
*/
|
|
1614
|
+
animation?: boolean;
|
|
1514
1615
|
}
|
|
1515
|
-
|
|
1616
|
+
//#endregion
|
|
1617
|
+
//#region src/charts/sparkline/sparkline.d.ts
|
|
1516
1618
|
/**
|
|
1517
1619
|
* Sparkline - A minimal line chart for inline data visualization.
|
|
1518
1620
|
*
|
|
@@ -1523,86 +1625,107 @@ interface SparklineProps {
|
|
|
1523
1625
|
* This component is built on top of LineChart with preconfigured settings
|
|
1524
1626
|
* for minimal display (no axes, grid, tooltips, or legend).
|
|
1525
1627
|
*/
|
|
1526
|
-
declare const SparklineUnresponsive: react.ForwardRefExoticComponent<SparklineProps & react.RefAttributes<HTMLDivElement>>;
|
|
1628
|
+
declare const SparklineUnresponsive: import("react").ForwardRefExoticComponent<SparklineProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
1527
1629
|
/**
|
|
1528
1630
|
* Responsive Sparkline chart component
|
|
1529
1631
|
*/
|
|
1530
|
-
declare const Sparkline: ({
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1632
|
+
declare const Sparkline: ({
|
|
1633
|
+
resizeDebounceTime,
|
|
1634
|
+
maxWidth,
|
|
1635
|
+
aspectRatio,
|
|
1636
|
+
size,
|
|
1637
|
+
width,
|
|
1638
|
+
height,
|
|
1639
|
+
...chartProps
|
|
1640
|
+
}: Omit<SparklineProps, "width" | "height" | "size"> & {
|
|
1641
|
+
width?: number;
|
|
1642
|
+
height?: number;
|
|
1643
|
+
size?: number;
|
|
1644
|
+
} & ResponsiveConfig) => import("react/jsx-runtime").JSX.Element;
|
|
1645
|
+
//#endregion
|
|
1646
|
+
//#region src/components/tooltip/base-tooltip.d.ts
|
|
1536
1647
|
type TooltipData = {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1648
|
+
label: string;
|
|
1649
|
+
value: number;
|
|
1650
|
+
valueDisplay?: string;
|
|
1540
1651
|
};
|
|
1541
1652
|
type TooltipComponentProps = {
|
|
1542
|
-
|
|
1543
|
-
|
|
1653
|
+
data: TooltipData;
|
|
1654
|
+
className?: string;
|
|
1544
1655
|
};
|
|
1545
1656
|
type TooltipCommonProps = {
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1657
|
+
top: number;
|
|
1658
|
+
left: number;
|
|
1659
|
+
style?: CSSProperties;
|
|
1660
|
+
className?: string;
|
|
1661
|
+
/**
|
|
1662
|
+
* Whether to render the tooltip container div. When false, only renders the content.
|
|
1663
|
+
* Useful when the tooltip is rendered inside a portal or custom container.
|
|
1664
|
+
* @default true
|
|
1665
|
+
*/
|
|
1666
|
+
renderContainer?: boolean;
|
|
1556
1667
|
};
|
|
1557
1668
|
type DefaultDataTooltip = {
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1669
|
+
data: TooltipData;
|
|
1670
|
+
component?: ComponentType<TooltipComponentProps>;
|
|
1671
|
+
children?: never;
|
|
1561
1672
|
};
|
|
1562
1673
|
type CustomTooltip = {
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1674
|
+
children: ReactNode;
|
|
1675
|
+
data?: never;
|
|
1676
|
+
component?: never;
|
|
1566
1677
|
};
|
|
1567
1678
|
type BaseTooltipProps = TooltipCommonProps & (DefaultDataTooltip | CustomTooltip);
|
|
1568
|
-
declare const BaseTooltip: ({
|
|
1569
|
-
|
|
1679
|
+
declare const BaseTooltip: ({
|
|
1680
|
+
data,
|
|
1681
|
+
top,
|
|
1682
|
+
left,
|
|
1683
|
+
component: Component,
|
|
1684
|
+
children,
|
|
1685
|
+
className,
|
|
1686
|
+
style,
|
|
1687
|
+
renderContainer
|
|
1688
|
+
}: BaseTooltipProps) => string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
1689
|
+
//#endregion
|
|
1690
|
+
//#region src/components/tooltip/accessible-tooltip.d.ts
|
|
1570
1691
|
type FlattenedTooltipData = {
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1692
|
+
datum: DataPointDate;
|
|
1693
|
+
seriesLabel: string;
|
|
1694
|
+
seriesIndex: number;
|
|
1695
|
+
dataPointIndex: number;
|
|
1575
1696
|
};
|
|
1576
|
-
interface AccessibleTooltipProps extends Omit<
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1697
|
+
interface AccessibleTooltipProps extends Omit<XyChartTooltipProps<DataPointDate>, 'renderTooltip'> {
|
|
1698
|
+
renderTooltip?: (params: RenderTooltipParams<DataPointDate>) => ReactNode;
|
|
1699
|
+
selectedIndex?: number | undefined;
|
|
1700
|
+
tooltipRef?: (element: HTMLDivElement | null) => void;
|
|
1701
|
+
keyboardFocusedClassName?: string;
|
|
1702
|
+
/**
|
|
1703
|
+
* Flattened tooltip data prepared by parent component
|
|
1704
|
+
* Each index corresponds to one tooltip to show
|
|
1705
|
+
*/
|
|
1706
|
+
tooltipData?: FlattenedTooltipData[];
|
|
1707
|
+
/**
|
|
1708
|
+
* For line charts: series data to show all series at selected data point
|
|
1709
|
+
* When provided, shows all series instead of individual tooltips
|
|
1710
|
+
*/
|
|
1711
|
+
series?: SeriesData[];
|
|
1712
|
+
/**
|
|
1713
|
+
* Whether to combine tooltip information from multiple series into a single tooltip. This is useful for line charts.
|
|
1714
|
+
* Or to show individual tooltips for each series. This is useful for bar charts.
|
|
1715
|
+
*/
|
|
1716
|
+
mode?: 'individual' | 'group';
|
|
1596
1717
|
}
|
|
1597
1718
|
declare const AccessibleTooltip: React.FC<AccessibleTooltipProps>;
|
|
1598
|
-
|
|
1719
|
+
//#endregion
|
|
1720
|
+
//#region src/components/tooltip/types.d.ts
|
|
1599
1721
|
type TooltipProps = {
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1722
|
+
data: {
|
|
1723
|
+
label: string;
|
|
1724
|
+
value: number;
|
|
1725
|
+
};
|
|
1604
1726
|
};
|
|
1605
|
-
|
|
1727
|
+
//#endregion
|
|
1728
|
+
//#region src/components/trend-indicator/types.d.ts
|
|
1606
1729
|
/**
|
|
1607
1730
|
* The direction of the trend
|
|
1608
1731
|
*/
|
|
@@ -1611,29 +1734,30 @@ type TrendDirection = 'up' | 'down' | 'neutral';
|
|
|
1611
1734
|
* Props for the TrendIndicator component
|
|
1612
1735
|
*/
|
|
1613
1736
|
type TrendIndicatorProps = {
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1737
|
+
/**
|
|
1738
|
+
* The direction of the trend (up, down, or neutral)
|
|
1739
|
+
*/
|
|
1740
|
+
direction: TrendDirection;
|
|
1741
|
+
/**
|
|
1742
|
+
* The value to display (e.g., "14%", "+$500", "2.5k")
|
|
1743
|
+
*/
|
|
1744
|
+
value: string | number;
|
|
1745
|
+
/**
|
|
1746
|
+
* Additional CSS class name
|
|
1747
|
+
*/
|
|
1748
|
+
className?: string;
|
|
1749
|
+
/**
|
|
1750
|
+
* Inline styles
|
|
1751
|
+
*/
|
|
1752
|
+
style?: CSSProperties;
|
|
1753
|
+
/**
|
|
1754
|
+
* Whether to show the directional icon
|
|
1755
|
+
* @default true
|
|
1756
|
+
*/
|
|
1757
|
+
showIcon?: boolean;
|
|
1635
1758
|
};
|
|
1636
|
-
|
|
1759
|
+
//#endregion
|
|
1760
|
+
//#region src/components/trend-indicator/trend-indicator.d.ts
|
|
1637
1761
|
/**
|
|
1638
1762
|
* TrendIndicator displays a directional trend with a value.
|
|
1639
1763
|
* Used to show percentage changes or growth metrics.
|
|
@@ -1641,57 +1765,69 @@ type TrendIndicatorProps = {
|
|
|
1641
1765
|
* @param {TrendIndicatorProps} props - Component props
|
|
1642
1766
|
* @return {JSX.Element} The rendered trend indicator
|
|
1643
1767
|
*/
|
|
1644
|
-
declare function TrendIndicator({
|
|
1645
|
-
|
|
1768
|
+
declare function TrendIndicator({
|
|
1769
|
+
direction,
|
|
1770
|
+
value,
|
|
1771
|
+
className,
|
|
1772
|
+
style,
|
|
1773
|
+
showIcon
|
|
1774
|
+
}: TrendIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
1775
|
+
//#endregion
|
|
1776
|
+
//#region src/providers/chart-context/types.d.ts
|
|
1646
1777
|
interface ChartRegistration {
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1778
|
+
legendItems: BaseLegendItem[];
|
|
1779
|
+
chartType: ChartType;
|
|
1780
|
+
metadata?: Record<string, unknown>;
|
|
1650
1781
|
}
|
|
1651
1782
|
type GetElementStylesParams = {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1783
|
+
index: number;
|
|
1784
|
+
data?: SeriesData | DataPointPercentage;
|
|
1785
|
+
overrideColor?: string;
|
|
1786
|
+
legendShape?: LegendShape<SeriesData[], number>;
|
|
1656
1787
|
};
|
|
1657
1788
|
type ElementStyles = {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1789
|
+
color: string;
|
|
1790
|
+
lineStyles: LineStyles$1;
|
|
1791
|
+
glyph: <Datum extends object>(props: GlyphProps<Datum>) => ReactNode;
|
|
1792
|
+
shapeStyles: CSSProperties & LineStyles$1;
|
|
1662
1793
|
};
|
|
1663
1794
|
interface GlobalChartsContextValue {
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1795
|
+
charts: Map<string, ChartRegistration>;
|
|
1796
|
+
registerChart: (id: string, data: ChartRegistration) => void;
|
|
1797
|
+
unregisterChart: (id: string) => void;
|
|
1798
|
+
getChartData: (id: string) => ChartRegistration | undefined;
|
|
1799
|
+
theme: CompleteChartTheme;
|
|
1800
|
+
getElementStyles: (params: GetElementStylesParams) => ElementStyles;
|
|
1801
|
+
toggleSeriesVisibility: (chartId: string, seriesLabel: string) => void;
|
|
1802
|
+
isSeriesVisible: (chartId: string, seriesLabel: string) => boolean;
|
|
1803
|
+
getHiddenSeries: (chartId: string) => Set<string>;
|
|
1804
|
+
isColorPaletteResolved: boolean;
|
|
1674
1805
|
}
|
|
1675
|
-
|
|
1676
|
-
|
|
1806
|
+
//#endregion
|
|
1807
|
+
//#region src/providers/chart-context/global-charts-provider.d.ts
|
|
1808
|
+
declare const GlobalChartsContext: import("react").Context<GlobalChartsContextValue>;
|
|
1677
1809
|
interface GlobalChartsProviderProps {
|
|
1678
|
-
|
|
1679
|
-
|
|
1810
|
+
children: ReactNode;
|
|
1811
|
+
theme?: Partial<ChartTheme>;
|
|
1680
1812
|
}
|
|
1681
1813
|
declare const GlobalChartsProvider: FC<GlobalChartsProviderProps>;
|
|
1682
|
-
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region src/providers/chart-context/hooks/use-global-charts-context.d.ts
|
|
1683
1816
|
declare const useGlobalChartsContext: () => GlobalChartsContextValue;
|
|
1684
|
-
|
|
1817
|
+
//#endregion
|
|
1818
|
+
//#region src/providers/chart-context/hooks/use-global-charts-theme.d.ts
|
|
1685
1819
|
/**
|
|
1686
1820
|
* Hook to get the global chart theme from GlobalChartsProvider
|
|
1687
1821
|
*
|
|
1688
1822
|
* @return The global chart theme
|
|
1689
1823
|
*/
|
|
1690
1824
|
declare const useGlobalChartsTheme: () => CompleteChartTheme;
|
|
1691
|
-
|
|
1825
|
+
//#endregion
|
|
1826
|
+
//#region src/providers/chart-context/themes.d.ts
|
|
1692
1827
|
/**
|
|
1693
1828
|
* Default theme configuration
|
|
1694
1829
|
*/
|
|
1695
1830
|
declare const defaultTheme: CompleteChartTheme;
|
|
1696
|
-
|
|
1697
|
-
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, BarChartResponsive as BarChart, type BarChartProps, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, type BarListChartProps, BarListChart as BarListChartUnresponsive, type BaseChartProps, type BaseLegendItem, type BaseLegendProps, BaseTooltip, type BaseTooltipProps, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, type CurveType, type DataPoint, type DataPointDate, type DataPointPercentage, type FunnelStep, GeoChartResponsive as GeoChart, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, type GeoData, type GeoRegion, type GeoResolution, GlobalChartsContext, GlobalChartsProvider, type GradientConfig, type GradientStop, type GridProps, LeaderboardChartResponsive as LeaderboardChart, type LeaderboardChartProps, LeaderboardChart as LeaderboardChartUnresponsive, type LeaderboardEntry, Legend, type LegendItemStyles, type LegendLabelStyles, type LegendPosition, type LegendProps, type LegendShapeStyles, type LegendValueDisplay, LineChartResponsive as LineChart, type LineChartAnnotationProps, type LineChartProps, LineChart as LineChartUnresponsive, type MainMetricRenderProps, type MetricValueType, type MultipleDataPointsDate, type Optional, type OrientationType, PieChartResponsive as PieChart, type PieChartProps, type PieChartRenderTooltipParams, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, type PieSemiCircleChartProps, type PieSemiCircleChartRenderTooltipParams, PieSemiCircleChart as PieSemiCircleChartUnresponsive, type RenderLabelProps, type RenderLineGlyphProps, type RenderValueProps, type ScaleOptions, type SeriesData, type SeriesDataOptions, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps,
|
|
1831
|
+
//#endregion
|
|
1832
|
+
export { AccessibleTooltip, type AnnotationStyles, type ArcData, AreaChartResponsive as AreaChart, type AreaChartProps, AreaChart as AreaChartUnresponsive, type AxisOptions, BarChartResponsive as BarChart, type BarChartProps, BarChart as BarChartUnresponsive, BarListChartResponsive as BarListChart, type BarListChartProps, BarListChart as BarListChartUnresponsive, type BaseChartProps, type BaseLegendItem, type BaseLegendProps, BaseTooltip, type BaseTooltipProps, type ChartLegendConfig, type ChartLegendOptions, type ChartTheme, type CompleteChartTheme, ConversionFunnelChartWithProvider as ConversionFunnelChart, type ConversionFunnelChartProps, type CurveType, type DataPoint, type DataPointDate, type DataPointPercentage, type EventHandlerParams, type FunnelStep, GeoChartResponsive as GeoChart, type GeoChartProps, GeoChartWithProvider as GeoChartUnresponsive, type GeoData, type GeoRegion, type GeoResolution, GlobalChartsContext, GlobalChartsProvider, GlobalChartsProvider as ThemeProvider, type GoogleDataTableColumn, type GoogleDataTableColumnRoleType, type GoogleDataTableRow, type GradientConfig, type GradientStop, type GridProps, type GridStyles, LeaderboardChartResponsive as LeaderboardChart, type LeaderboardChartProps, LeaderboardChart as LeaderboardChartUnresponsive, type LeaderboardEntry, Legend, type LegendItemStyles, type LegendLabelStyles, type LegendPosition, type LegendProps, type LegendShape, type LegendShapeLabel, type LegendShapeRenderProps, type LegendShapeStyles, type LegendValueDisplay, LineChartResponsive as LineChart, type LineChartAnnotationProps, type LineChartProps, LineChart as LineChartUnresponsive, type LineStyles, type MainMetricRenderProps, type MetricValueType, type MultipleDataPointsDate, type Optional, type OrientationType, PieChartResponsive as PieChart, type PieChartProps, type PieChartRenderTooltipParams, PieChart as PieChartUnresponsive, PieSemiCircleChartResponsive as PieSemiCircleChart, type PieSemiCircleChartProps, type PieSemiCircleChartRenderTooltipParams, PieSemiCircleChart as PieSemiCircleChartUnresponsive, type RenderLabelProps, type RenderLineGlyphProps, type RenderTooltipGlyphProps, type RenderTooltipParams, type RenderValueProps, type ScaleOptions, type SeriesData, type SeriesDataOptions, Sparkline, type SparklineDataPoint, type SparklineProps, SparklineUnresponsive, type StepLabelRenderProps, type StepRateRenderProps, type TooltipData, type TooltipDatum, type TooltipProps, type TooltipRenderProps, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type XyChartTooltipProps, defaultTheme, formatMetricValue, formatPercentage, getColorDistance, hexToRgba, isValidHexColor, lightenHexColor, mergeThemes, normalizeColorToHex, parseAsLocalDate, parseHslString, parseRgbString, useChartLegendItems, useGlobalChartsContext, useGlobalChartsTheme, useLeaderboardLegendItems, validateHexColor };
|
|
1833
|
+
//# sourceMappingURL=index.d.ts.map
|