@acronis-platform/ui-react 0.58.0 → 0.61.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/README.md +5 -5
- package/dist/components/ui/app-shell/app-shell.js.map +1 -1
- package/dist/components/ui/area-chart/area-chart.js +210 -119
- package/dist/components/ui/area-chart/area-chart.js.map +1 -1
- package/dist/components/ui/avatar/avatar.js +26 -23
- package/dist/components/ui/avatar/avatar.js.map +1 -1
- package/dist/components/ui/bar-chart/bar-chart.js +595 -149
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +17 -15
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/carousel-dialog/carousel-dialog.js +87 -0
- package/dist/components/ui/carousel-dialog/carousel-dialog.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +147 -0
- package/dist/components/ui/category-bar/category-bar.js.map +1 -0
- package/dist/components/ui/chart/chart-format.js +170 -0
- package/dist/components/ui/chart/chart-format.js.map +1 -0
- package/dist/components/ui/chart/chart.js +204 -150
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/composed-chart/composed-chart.js +423 -98
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
- package/dist/components/ui/confidence-cone/confidence-cone.js +306 -172
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +29 -29
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js +57 -0
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js.map +1 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +1 -1
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -1
- package/dist/components/ui/dialog-welcome/dialog-welcome.js +272 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js.map +1 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js +245 -51
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/ui/histogram/histogram.js +96 -64
- package/dist/components/ui/histogram/histogram.js.map +1 -1
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +230 -159
- package/dist/components/ui/line-chart/line-chart.js.map +1 -1
- package/dist/components/ui/metric/metric.js +88 -70
- package/dist/components/ui/metric/metric.js.map +1 -1
- package/dist/components/ui/pie-chart/pie-chart.js +234 -80
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +210 -57
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +358 -50
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
- package/dist/components/ui/sankey-chart/sankey-chart.js +199 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js +86 -50
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +206 -142
- package/dist/components/ui/timeline/timeline.js.map +1 -1
- package/dist/components/ui/toolbar/toolbar.js +82 -92
- package/dist/components/ui/toolbar/toolbar.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +183 -59
- package/dist/components/ui/treemap/treemap.js.map +1 -1
- package/dist/index.js +481 -439
- package/dist/index.js.map +1 -1
- package/dist/lib/breakpoints.js +9 -6
- package/dist/lib/breakpoints.js.map +1 -1
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +25 -0
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +36 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1205 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
- package/dist/react.js +481 -439
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +52 -17
- package/dist/src/components/ui/area-chart/index.d.ts +1 -1
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +152 -29
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/button/button.d.ts +1 -1
- package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
- package/dist/src/components/ui/carousel-dialog/carousel-dialog.d.ts +28 -0
- package/dist/src/components/ui/carousel-dialog/index.d.ts +1 -0
- package/dist/src/components/ui/category-bar/category-bar.d.ts +51 -0
- package/dist/src/components/ui/category-bar/index.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-format.test.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-layout.d.ts +63 -0
- package/dist/src/components/ui/chart/__tests__/chart-layout.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-format.d.ts +526 -0
- package/dist/src/components/ui/chart/chart.d.ts +11 -3
- package/dist/src/components/ui/chart/index.d.ts +3 -1
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +154 -20
- package/dist/src/components/ui/composed-chart/index.d.ts +1 -1
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +138 -37
- package/dist/src/components/ui/confidence-cone/index.d.ts +1 -1
- package/dist/src/components/ui/dialog-footer-carousel/dialog-footer-carousel.d.ts +9 -0
- package/dist/src/components/ui/dialog-footer-carousel/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.d.ts +54 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.docs.d.ts +55 -0
- package/dist/src/components/ui/dialog-welcome/index.d.ts +1 -0
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +201 -3
- package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
- package/dist/src/components/ui/histogram/histogram.d.ts +2 -17
- package/dist/src/components/ui/line-chart/index.d.ts +1 -1
- package/dist/src/components/ui/line-chart/line-chart.d.ts +50 -17
- package/dist/src/components/ui/pie-chart/index.d.ts +1 -1
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +145 -4
- package/dist/src/components/ui/radar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +219 -6
- package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +215 -9
- package/dist/src/components/ui/sankey-chart/index.d.ts +2 -0
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +69 -0
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +2 -17
- package/dist/src/components/ui/timeline/index.d.ts +1 -1
- package/dist/src/components/ui/timeline/timeline.d.ts +79 -20
- package/dist/src/components/ui/treemap/index.d.ts +1 -1
- package/dist/src/components/ui/treemap/treemap.d.ts +68 -8
- package/dist/src/index.d.ts +5 -1
- package/dist/ui-react.css +1 -1
- package/package.json +5 -4
- package/dist/components/ui/search-global/search-global.js +0 -60
- package/dist/components/ui/search-global/search-global.js.map +0 -1
- package/dist/src/components/ui/search-global/index.d.ts +0 -1
- package/dist/src/components/ui/search-global/search-global.d.ts +0 -7
|
@@ -1,10 +1,125 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { ChartTooltip, ChartConfig } from '../chart';
|
|
2
|
+
import { ChartTooltip, ChartAnimationProps, ChartConfig, TickFormatter } from '../chart';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const funnelChartVariants: (props?: ({
|
|
5
5
|
lastShape?: "triangle" | "rectangle" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
-
|
|
7
|
+
/** Where a stage's label sits relative to its segment. */
|
|
8
|
+
export type FunnelChartLabelPosition = 'right' | 'left' | 'inside';
|
|
9
|
+
/** What a stage's label says. */
|
|
10
|
+
export type FunnelChartLabelFormat = 'name' | 'value' | 'percent' | 'name-value' | 'name-percent' | 'value-percent';
|
|
11
|
+
/** How the stages are coloured: one `config` entry each, or one shared ramp. */
|
|
12
|
+
export type FunnelChartColorMode = 'palette' | 'gradient';
|
|
13
|
+
/** Override for a single stage, keyed by its `nameKey` value. */
|
|
14
|
+
export interface FunnelChartStageSettings {
|
|
15
|
+
/**
|
|
16
|
+
* Paint this stage with a colour of its own, overriding both `config` and
|
|
17
|
+
* `colorMode`. Reference an existing semantic `--ui-*` token.
|
|
18
|
+
*/
|
|
19
|
+
color?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Drop the stage from the funnel — and from the legend, labels and the
|
|
22
|
+
* conversion percentages, which are computed over the visible stages only.
|
|
23
|
+
*/
|
|
24
|
+
hidden?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Where the value labels sit when the caller doesn't say: opposite the names, so
|
|
28
|
+
* the two lists never stack on the same edge. `inside` names sit on the segments
|
|
29
|
+
* and leave both edges free, so the values take the default `right`.
|
|
30
|
+
*
|
|
31
|
+
* A static default can't do this — `valuePosition="left"` beside
|
|
32
|
+
* `labelPosition="left"` draws both lists at the same anchor, overprinting the
|
|
33
|
+
* name with its own value.
|
|
34
|
+
*/
|
|
35
|
+
export declare function funnelChartOppositeSide(labelPosition: FunnelChartLabelPosition): FunnelChartLabelPosition;
|
|
36
|
+
/**
|
|
37
|
+
* Reserve room for a composite label beside the funnel, by narrowing the
|
|
38
|
+
* **funnel** rather than the plot area.
|
|
39
|
+
*
|
|
40
|
+
* recharts word-wraps a label against the space between its trapezoid's
|
|
41
|
+
* mid-height edge and the *plot area* edge (`getCartesianPosition` clamps
|
|
42
|
+
* `width` to `parentViewBox`, which `Funnel` sets to the plot box). A margin
|
|
43
|
+
* shrinks the plot area and the funnel inside it in lockstep, so widening
|
|
44
|
+
* `margin.right` moves the clamp edge *inward* and leaves a composite label
|
|
45
|
+
* with less room, not more — the reserved strip sits outside `parentViewBox`
|
|
46
|
+
* where the text can never reach it.
|
|
47
|
+
*
|
|
48
|
+
* `Funnel`'s `width` is the lever that works: it scales the funnel within the
|
|
49
|
+
* plot area while `parentViewBox` stays put, and because recharts anchors the
|
|
50
|
+
* funnel at the plot area's left edge (`offsetX = offset.left`), everything it
|
|
51
|
+
* frees lands on the right. Narrowing the funnel to
|
|
52
|
+
* `COMPOSITE_FUNNEL_WIDTH` turns ~35px of wrap width into ~140px on a 460px
|
|
53
|
+
* chart.
|
|
54
|
+
*
|
|
55
|
+
* Returns `undefined` — i.e. leave the funnel at its full width — for every
|
|
56
|
+
* other case, so a funnel with plain labels, no labels, or `inside` labels keeps
|
|
57
|
+
* exactly the geometry it has always had.
|
|
58
|
+
*
|
|
59
|
+
* There is no equivalent lever for `labelPosition="left"`: the widest trapezoid
|
|
60
|
+
* always starts flush at the plot area's left edge, so a left-hand label is
|
|
61
|
+
* bounded by how sharply the funnel narrows and narrowing it further only makes
|
|
62
|
+
* that worse. Composite left-hand labels wrap; that's a recharts limitation, not
|
|
63
|
+
* a tuning choice.
|
|
64
|
+
*
|
|
65
|
+
* A caller-supplied `funnelWidth` always wins — this is only the default.
|
|
66
|
+
*/
|
|
67
|
+
export declare function funnelChartLabelReserve(options: {
|
|
68
|
+
showLabels: boolean;
|
|
69
|
+
labelPosition: FunnelChartLabelPosition;
|
|
70
|
+
labelFormat: FunnelChartLabelFormat;
|
|
71
|
+
}): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The plot-area margin. Reserves the left inset when a label list sits there, so
|
|
74
|
+
* a left-hand label isn't clipped at the SVG edge; the right inset is always
|
|
75
|
+
* reserved, since that is the geometry every existing funnel was drawn with.
|
|
76
|
+
*
|
|
77
|
+
* This is overflow protection, not label room — the wrap width comes from
|
|
78
|
+
* `funnelChartLabelReserve`. A caller-supplied `margin` is merged over these
|
|
79
|
+
* defaults per side, so `margin={{ right: 160 }}` keeps the default top, bottom
|
|
80
|
+
* and left rather than collapsing them to zero.
|
|
81
|
+
*/
|
|
82
|
+
export declare function funnelChartLabelMargin(options: {
|
|
83
|
+
showLabels: boolean;
|
|
84
|
+
labelPosition: FunnelChartLabelPosition;
|
|
85
|
+
showValueLabels: boolean;
|
|
86
|
+
valuePosition: FunnelChartLabelPosition;
|
|
87
|
+
}): {
|
|
88
|
+
left: number;
|
|
89
|
+
top: number;
|
|
90
|
+
right: number;
|
|
91
|
+
bottom: number;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Format a conversion share the way the default `percent` label reads it:
|
|
95
|
+
* `0.52 → "52.0%"`. Exported so a `percentFormatter` can wrap or replace it.
|
|
96
|
+
*/
|
|
97
|
+
export declare const funnelChartPercent: TickFormatter;
|
|
98
|
+
/**
|
|
99
|
+
* Compose one stage's label text.
|
|
100
|
+
*
|
|
101
|
+
* `base` is the value the percentage is measured against — the funnel's widest
|
|
102
|
+
* stage, not the sum of every stage. A funnel's stages are nested subsets of
|
|
103
|
+
* each other rather than parts of a whole, so their values don't add up to
|
|
104
|
+
* anything meaningful; the share that reads as information is the conversion
|
|
105
|
+
* from the top of the funnel. (A pie's `percent` is the other way round — there
|
|
106
|
+
* a slice really is a share of the total.)
|
|
107
|
+
*
|
|
108
|
+
* Only the numeric part goes through `formatter`, so a label and its tooltip can
|
|
109
|
+
* share one formatter; the share goes through `percentFormatter`, so a locale
|
|
110
|
+
* that doesn't write a bare `%` can replace it. The percent formats degrade to
|
|
111
|
+
* the name (or to the value) rather than printing `NaN%` when there is nothing
|
|
112
|
+
* to divide by.
|
|
113
|
+
*/
|
|
114
|
+
export declare function funnelChartLabelText(options: {
|
|
115
|
+
name: string;
|
|
116
|
+
value: number | string;
|
|
117
|
+
base: number;
|
|
118
|
+
format: FunnelChartLabelFormat;
|
|
119
|
+
formatter?: TickFormatter;
|
|
120
|
+
percentFormatter?: TickFormatter;
|
|
121
|
+
}): string;
|
|
122
|
+
export interface FunnelChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof funnelChartVariants>, ChartAnimationProps {
|
|
8
123
|
/** Row-per-stage data. Each object holds the stage's `nameKey` label + its `dataKey` numeric value. */
|
|
9
124
|
data: ReadonlyArray<Record<string, string | number>>;
|
|
10
125
|
/**
|
|
@@ -24,8 +139,91 @@ export interface FunnelChartProps extends Omit<React.ComponentProps<'div'>, 'chi
|
|
|
24
139
|
nameKey: string;
|
|
25
140
|
/** Flip the funnel so it widens toward the bottom instead of narrowing. */
|
|
26
141
|
reversed?: boolean;
|
|
27
|
-
/** Render each stage
|
|
142
|
+
/** Render a label for each stage — see `labelFormat` and `labelPosition`. */
|
|
28
143
|
showLabels?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* What each stage's label says. `percent` is the stage's share of the widest
|
|
146
|
+
* stage — its conversion from the top of the funnel.
|
|
147
|
+
*/
|
|
148
|
+
labelFormat?: FunnelChartLabelFormat;
|
|
149
|
+
/**
|
|
150
|
+
* Where each stage's label sits. Defaults to `right`, beside the segment.
|
|
151
|
+
* `inside` centres it on the segment, which only works while every stage is
|
|
152
|
+
* wide enough to hold the text — a funnel narrows, so its last stages often
|
|
153
|
+
* are not. Keep the text short there (`percent`) or leave the labels beside
|
|
154
|
+
* the funnel.
|
|
155
|
+
*/
|
|
156
|
+
labelPosition?: FunnelChartLabelPosition;
|
|
157
|
+
/**
|
|
158
|
+
* Render a second label carrying the stage's value, so the name and the number
|
|
159
|
+
* can sit on opposite sides of the funnel.
|
|
160
|
+
*/
|
|
161
|
+
showValueLabels?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Where the value label sits. Defaults to the side opposite `labelPosition`,
|
|
164
|
+
* where every stage has room — so it follows the names rather than pinning
|
|
165
|
+
* itself to one edge. See `labelPosition` before choosing `inside`.
|
|
166
|
+
*/
|
|
167
|
+
valuePosition?: FunnelChartLabelPosition;
|
|
168
|
+
/**
|
|
169
|
+
* Colour for both label lists, overriding the contrast-matched default (the
|
|
170
|
+
* on-surface token beside the funnel, the on-fill token on a segment). Pass a
|
|
171
|
+
* `--ui-*` token; only use it when the default doesn't work on your surface.
|
|
172
|
+
*/
|
|
173
|
+
labelFill?: string;
|
|
174
|
+
/** Format the numeric part of a label — pass the same formatter used elsewhere. */
|
|
175
|
+
labelFormatter?: TickFormatter;
|
|
176
|
+
/**
|
|
177
|
+
* Format the conversion share behind the `percent` formats. Receives the share
|
|
178
|
+
* as a fraction (`0.52`); defaults to `funnelChartPercent` (`"52.0%"`). Pass
|
|
179
|
+
* `createTickFormatter({ style: 'percent', minimumFractionDigits: 1 }, locale)`
|
|
180
|
+
* for a locale that doesn't write a bare `%`.
|
|
181
|
+
*/
|
|
182
|
+
percentFormatter?: TickFormatter;
|
|
183
|
+
/** Render the legend. Off by default: a funnel labels its stages on the chart. */
|
|
184
|
+
showLegend?: boolean;
|
|
185
|
+
/** Which edge the legend sits on. */
|
|
186
|
+
legendPos?: 'top' | 'bottom';
|
|
187
|
+
/**
|
|
188
|
+
* How the stages are coloured. `palette` (the default) gives each stage its own
|
|
189
|
+
* `config` colour; `gradient` ramps one hue — `gradientColor` — from the widest
|
|
190
|
+
* stage down to the narrowest.
|
|
191
|
+
*/
|
|
192
|
+
colorMode?: FunnelChartColorMode;
|
|
193
|
+
/**
|
|
194
|
+
* The hue `colorMode="gradient"` ramps. Defaults to the first visible stage's
|
|
195
|
+
* own colour — including a `stageSettings` colour set on it — so a palette
|
|
196
|
+
* config becomes a ramp without a second colour decision. Ignored when
|
|
197
|
+
* `colorMode` is `palette`.
|
|
198
|
+
*/
|
|
199
|
+
gradientColor?: string;
|
|
200
|
+
/** Per-stage `color` / `hidden` overrides, keyed by the stage's `nameKey` value. */
|
|
201
|
+
stageSettings?: Record<string, FunnelChartStageSettings>;
|
|
202
|
+
/** Outline the hovered segment. */
|
|
203
|
+
showActiveShape?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Segment border colour. Reference an existing semantic `--ui-*` token.
|
|
206
|
+
* Defaults to the border token when `strokeWidth` is set on its own.
|
|
207
|
+
*/
|
|
208
|
+
stroke?: string;
|
|
209
|
+
/** Segment border width, in px. Implies a default `stroke` when given alone. */
|
|
210
|
+
strokeWidth?: number;
|
|
211
|
+
/**
|
|
212
|
+
* Funnel width — a number in px or a percentage of the plot area (`'70%'`).
|
|
213
|
+
* Defaults to the full plot area, except that a composite `labelFormat` beside
|
|
214
|
+
* the funnel narrows it to leave the label real room to wrap into.
|
|
215
|
+
*/
|
|
216
|
+
funnelWidth?: number | string;
|
|
217
|
+
/**
|
|
218
|
+
* Plot-area margin, in px. Merged over the defaults per side, so passing one
|
|
219
|
+
* side keeps the others.
|
|
220
|
+
*/
|
|
221
|
+
margin?: {
|
|
222
|
+
top?: number;
|
|
223
|
+
right?: number;
|
|
224
|
+
bottom?: number;
|
|
225
|
+
left?: number;
|
|
226
|
+
};
|
|
29
227
|
showTooltip?: boolean;
|
|
30
228
|
/**
|
|
31
229
|
* Replace the default tooltip. Pass a configured `ChartTooltipContent`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FunnelChart, funnelChartVariants, type FunnelChartProps, } from './funnel-chart';
|
|
1
|
+
export { FunnelChart, funnelChartVariants, funnelChartPercent, type FunnelChartProps, type FunnelChartColorMode, type FunnelChartLabelFormat, type FunnelChartLabelPosition, type FunnelChartStageSettings, } from './funnel-chart';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChartConfig, CartesianChartProps, ChartAnimationProps } from '../chart';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
export interface HistogramBin {
|
|
4
4
|
/** Lower bound of the bin (inclusive). */
|
|
@@ -18,7 +18,7 @@ export interface HistogramBin {
|
|
|
18
18
|
* the package's public API.
|
|
19
19
|
*/
|
|
20
20
|
export declare function computeHistogramBins(values: ReadonlyArray<number>, binCount: number, domain?: [number, number]): HistogramBin[];
|
|
21
|
-
export interface HistogramProps extends Omit<React.ComponentProps<'div'>, 'children'
|
|
21
|
+
export interface HistogramProps extends Omit<React.ComponentProps<'div'>, 'children'>, CartesianChartProps, ChartAnimationProps {
|
|
22
22
|
/** Raw continuous samples to bin (non-finite values are ignored). */
|
|
23
23
|
values: ReadonlyArray<number>;
|
|
24
24
|
/**
|
|
@@ -33,23 +33,8 @@ export interface HistogramProps extends Omit<React.ComponentProps<'div'>, 'child
|
|
|
33
33
|
binCount?: number;
|
|
34
34
|
/** Fix the binning range instead of deriving it from the data's min/max. */
|
|
35
35
|
domain?: [number, number];
|
|
36
|
-
/** Title rendered beneath the horizontal (X) axis. */
|
|
37
|
-
xAxisLabel?: string;
|
|
38
|
-
/** Title rendered beside the vertical (Y) axis (rotated). */
|
|
39
|
-
yAxisLabel?: string;
|
|
40
|
-
/** Unit suffix appended to Y-axis tick values (recharts `unit`; the X axis is the bin label). */
|
|
41
|
-
yUnit?: string;
|
|
42
36
|
/** Corner radius on the top of each bar. */
|
|
43
37
|
barRadius?: number;
|
|
44
|
-
showGrid?: boolean;
|
|
45
|
-
showTooltip?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Replace the default tooltip. Pass a configured `ChartTooltipContent`
|
|
48
|
-
* (imported from this library) — e.g. with a `formatter` / `labelFormatter` —
|
|
49
|
-
* to customize the tooltip without composing recharts yourself. Ignored when
|
|
50
|
-
* `showTooltip` is false.
|
|
51
|
-
*/
|
|
52
|
-
tooltipContent?: React.ComponentProps<typeof ChartTooltip>['content'];
|
|
53
38
|
}
|
|
54
39
|
declare const Histogram: React.ForwardRefExoticComponent<Omit<HistogramProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
55
40
|
export { Histogram };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { LineChart, lineChartVariants, type LineChartProps } from './line-chart';
|
|
1
|
+
export { LineChart, lineChartVariants, type LineChartProps, type LineChartLineSettings, } from './line-chart';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { ChartTooltip, ChartConfig } from '../chart';
|
|
2
|
+
import { ChartTooltip, ChartConfig, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartCurveType, ChartDataLabelProps, ChartReferenceLine, CartesianLabelPosition } from '../chart';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const lineChartVariants: (props?: ({
|
|
5
|
-
curve?: "step" | "linear" | "monotone" | null | undefined;
|
|
5
|
+
curve?: "step" | "linear" | "monotone" | "natural" | "basis" | "stepBefore" | "stepAfter" | null | undefined;
|
|
6
6
|
lineStyle?: "dashed" | "solid" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
/**
|
|
@@ -27,7 +27,34 @@ type TooltipRenderProps = Parameters<TooltipContentFn>[0];
|
|
|
27
27
|
* component is a stable content type (memoize it on `tooltipContent`).
|
|
28
28
|
*/
|
|
29
29
|
export declare function createBandStrippedTooltip(tooltipContent: TooltipContentType): (props: TooltipRenderProps) => React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<import('recharts').TooltipContentProps<import('recharts').TooltipValueType, import('recharts/types/component/DefaultTooltipContent').NameType>>;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Style override for one series, keyed by its `dataKeys` entry. Anything left
|
|
32
|
+
* unset falls back to the chart-wide prop, so an entry only states what differs
|
|
33
|
+
* — e.g. one thicker, dashed "target" line among otherwise identical series.
|
|
34
|
+
*
|
|
35
|
+
* A series listed in `comparisonKeys` keeps its dashed, dimmed, dot-less
|
|
36
|
+
* treatment: `color`, `strokeWidth` and `curveType` still apply to it, but
|
|
37
|
+
* `showDots` / `dotSize` do not (the overlay is defined by having no dots).
|
|
38
|
+
*/
|
|
39
|
+
export interface LineChartLineSettings {
|
|
40
|
+
/** Stroke color. Defaults to the series' `config` color. */
|
|
41
|
+
color?: string;
|
|
42
|
+
/** Stroke width. Defaults to the chart's `strokeWidth`. */
|
|
43
|
+
strokeWidth?: number;
|
|
44
|
+
/** Dash this series' stroke, whatever the chart-wide `lineStyle` is. */
|
|
45
|
+
dashed?: boolean;
|
|
46
|
+
/** Interpolation for this series only. Defaults to the chart's `curve`. */
|
|
47
|
+
curveType?: ChartCurveType;
|
|
48
|
+
/** Render this series' per-point dots. Defaults to the chart's `showDots`. */
|
|
49
|
+
showDots?: boolean;
|
|
50
|
+
/** Dot radius for this series, in px. Defaults to the chart's `dotSize`. */
|
|
51
|
+
dotSize?: number;
|
|
52
|
+
/** Show/hide this series' value labels, overriding the chart's `showLabels`. */
|
|
53
|
+
showLabel?: boolean;
|
|
54
|
+
/** Position of this series' value labels. Defaults to the chart's `labelPosition`. */
|
|
55
|
+
labelPosition?: CartesianLabelPosition;
|
|
56
|
+
}
|
|
57
|
+
export interface LineChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof lineChartVariants>, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartDataLabelProps {
|
|
31
58
|
/** Row-per-point data. Each object holds the category key + one numeric field per series (`null` breaks the line unless `connectNulls`). */
|
|
32
59
|
data: ReadonlyArray<Record<string, string | number | null>>;
|
|
33
60
|
/**
|
|
@@ -56,28 +83,34 @@ export interface LineChartProps extends Omit<React.ComponentProps<'div'>, 'child
|
|
|
56
83
|
deltaBands?: Array<[string, string]>;
|
|
57
84
|
/** Category axis key (the shared dimension across rows, e.g. `"month"`). */
|
|
58
85
|
xKey: string;
|
|
59
|
-
/** Title rendered beneath the horizontal (X) axis. */
|
|
60
|
-
xAxisLabel?: string;
|
|
61
|
-
/** Title rendered beside the vertical (Y) axis (rotated). */
|
|
62
|
-
yAxisLabel?: string;
|
|
63
|
-
/** Unit suffix appended to Y-axis tick values (recharts `unit`; the X axis is categorical). */
|
|
64
|
-
yUnit?: string;
|
|
65
86
|
/** Stroke width of each line. */
|
|
66
87
|
strokeWidth?: number;
|
|
67
88
|
/** Render a dot at each data point. */
|
|
68
89
|
showDots?: boolean;
|
|
90
|
+
/** Radius of each point's dot, in px. Its hover dot is 2px larger. */
|
|
91
|
+
dotSize?: number;
|
|
92
|
+
/**
|
|
93
|
+
* Enlarge the hovered point's dot. Defaults to following `showDots`, so pass
|
|
94
|
+
* it explicitly to get hover dots on a dot-less line (`showDots={false}`
|
|
95
|
+
* with `showActiveDot`) or a static-only line (dots without the hover one).
|
|
96
|
+
*/
|
|
97
|
+
showActiveDot?: boolean;
|
|
69
98
|
/** Bridge `null` gaps in the data instead of breaking the line. */
|
|
70
99
|
connectNulls?: boolean;
|
|
71
|
-
showGrid?: boolean;
|
|
72
|
-
showTooltip?: boolean;
|
|
73
|
-
showLegend?: boolean;
|
|
74
100
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* `indicator` — to customize formatting, per-series rows, or extra fields
|
|
78
|
-
* without composing recharts yourself. Ignored when `showTooltip` is false.
|
|
101
|
+
* Per-series style overrides, keyed by `dataKeys` entry. Series with no entry
|
|
102
|
+
* render from the chart-wide props.
|
|
79
103
|
*/
|
|
80
|
-
|
|
104
|
+
lineSettings?: Record<string, LineChartLineSettings>;
|
|
105
|
+
/**
|
|
106
|
+
* One or more dashed reference/average lines on the value axis — a target, a
|
|
107
|
+
* threshold, or a series mean. Pass a single object or an array to draw
|
|
108
|
+
* several at once.
|
|
109
|
+
*/
|
|
110
|
+
referenceLine?: ChartReferenceLine | ChartReferenceLine[];
|
|
111
|
+
showLegend?: boolean;
|
|
112
|
+
/** Position of the value labels when `showLabels` is on. Defaults to `top`. */
|
|
113
|
+
labelPosition?: CartesianLabelPosition;
|
|
81
114
|
}
|
|
82
115
|
declare const LineChart: React.ForwardRefExoticComponent<Omit<LineChartProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
83
116
|
export { LineChart, lineChartVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PieChart, pieChartVariants, type PieChartProps, type PieChartCenterLabel, } from './pie-chart';
|
|
1
|
+
export { PieChart, pieChartVariants, type PieChartProps, type PieChartCenterLabel, type PieChartLabelFormat, type PieChartTooltipFormat, type PieChartSliceSettings, } from './pie-chart';
|
|
@@ -1,18 +1,88 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { ChartTooltip, ChartConfig } from '../chart';
|
|
2
|
+
import { ChartTooltip, ChartConfig, ChartTooltipContentProps, ChartAnimationProps, ChartDataLabelProps, PolarLabelPosition, TickFormatter } from '../chart';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
declare const pieChartVariants: (props?: ({
|
|
5
5
|
shape?: "pie" | "donut" | null | undefined;
|
|
6
6
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
7
|
+
/** Row-per-slice datum: the `nameKey` label plus the `dataKey` value. */
|
|
8
|
+
type PieChartDatum = Record<string, string | number>;
|
|
9
|
+
/**
|
|
10
|
+
* What a slice's data label reads. `percent` is the slice's share of the sum of
|
|
11
|
+
* every slice value, to one decimal.
|
|
12
|
+
*/
|
|
13
|
+
export type PieChartLabelFormat = 'value' | 'name-value' | 'name-percent' | 'percent';
|
|
14
|
+
/** What the tooltip's value reads — the raw value, or the value and its share. */
|
|
15
|
+
export type PieChartTooltipFormat = 'value' | 'value-percent';
|
|
16
|
+
/** Per-slice overrides, keyed by the slice's `nameKey` value. */
|
|
17
|
+
export interface PieChartSliceSettings {
|
|
18
|
+
/**
|
|
19
|
+
* Fill for this slice, overriding its `config` color. Reference an existing
|
|
20
|
+
* semantic `--ui-*` token, same as `config`.
|
|
21
|
+
*/
|
|
22
|
+
color?: string;
|
|
23
|
+
/** Drop this slice's data label while every other slice keeps its own. */
|
|
24
|
+
hideLabel?: boolean;
|
|
25
|
+
/** Label format for this slice only — overrides the chart-level `labelFormat`. */
|
|
26
|
+
labelFormat?: PieChartLabelFormat;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Compose one slice's data-label text. Exported for unit tests; not part of the
|
|
30
|
+
* package's public API.
|
|
31
|
+
*
|
|
32
|
+
* A percent needs a numeric slice value *and* a non-zero total, and a value
|
|
33
|
+
* label needs a value at all — so every format degrades rather than printing
|
|
34
|
+
* `NaN%` or a dangling `"Chrome: "`. The two name-carrying formats fall back to
|
|
35
|
+
* the bare name; the value-only ones to `''`, which `resolveSliceLabel`
|
|
36
|
+
* normalizes to `null` (the one value recharts renders no `<text>` for).
|
|
37
|
+
*
|
|
38
|
+
* `labelFormatter` formats the slice's *value*, so it reaches `value` and
|
|
39
|
+
* `name-value` only. A percent is always composed by `slicePercentText` and
|
|
40
|
+
* never passes through the formatter.
|
|
41
|
+
*/
|
|
42
|
+
export declare function pieChartLabelText(options: {
|
|
43
|
+
format: PieChartLabelFormat;
|
|
44
|
+
name: string | number;
|
|
45
|
+
value: string | number | undefined;
|
|
46
|
+
total: number;
|
|
47
|
+
formatter?: TickFormatter;
|
|
48
|
+
}): string;
|
|
49
|
+
/**
|
|
50
|
+
* The row renderer behind `tooltipFormat="value-percent"` — a slice's value
|
|
51
|
+
* followed by its share. Exported for unit tests; not part of the package's
|
|
52
|
+
* public API.
|
|
53
|
+
*
|
|
54
|
+
* A `formatter` replaces the default row wholesale, so the swatch and the name
|
|
55
|
+
* are rebuilt here to match it: the shared `ChartTooltipContent` prefers a
|
|
56
|
+
* `config` entry's `icon` over the color swatch, and this has to do the same or
|
|
57
|
+
* a chart with icons would silently lose them under this preset — and the
|
|
58
|
+
* name/value `gap-4`, which has to be repeated here because a `formatter`
|
|
59
|
+
* replaces the shared row that carries it.
|
|
60
|
+
*/
|
|
61
|
+
export declare function pieChartValuePercentRow(options: {
|
|
62
|
+
config: ChartConfig;
|
|
63
|
+
total: number;
|
|
64
|
+
}): NonNullable<ChartTooltipContentProps['formatter']>;
|
|
65
|
+
/**
|
|
66
|
+
* The configured `ChartTooltipContent` for `tooltipFormat="value-percent"`.
|
|
67
|
+
* Exported so the visual-regression story renders the very same element the
|
|
68
|
+
* component does — recharts can only open a hover tooltip statically via
|
|
69
|
+
* `defaultIndex` on a raw composition, so the preset has to be reachable from
|
|
70
|
+
* outside the component to be snapshotted at all.
|
|
71
|
+
*/
|
|
72
|
+
export declare function pieChartValuePercentTooltip(options: {
|
|
73
|
+
nameKey: string;
|
|
74
|
+
config: ChartConfig;
|
|
75
|
+
total: number;
|
|
76
|
+
}): React.ReactElement;
|
|
7
77
|
export interface PieChartCenterLabel {
|
|
8
78
|
/** Headline metric rendered large in the donut hole (e.g. a total). */
|
|
9
79
|
value?: string | number;
|
|
10
80
|
/** Caption rendered under the value. */
|
|
11
81
|
label?: string | number;
|
|
12
82
|
}
|
|
13
|
-
export interface PieChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof pieChartVariants
|
|
83
|
+
export interface PieChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof pieChartVariants>, ChartAnimationProps, ChartDataLabelProps {
|
|
14
84
|
/** Row-per-slice data. Each object holds the slice's `nameKey` label + its `dataKey` numeric value. */
|
|
15
|
-
data: ReadonlyArray<
|
|
85
|
+
data: ReadonlyArray<PieChartDatum>;
|
|
16
86
|
/**
|
|
17
87
|
* Per-slice map of `label` / `color`, keyed by the slice's `nameKey` value
|
|
18
88
|
* (imported from the shared `Chart` primitives). Turned into `--color-<name>`
|
|
@@ -40,15 +110,86 @@ export interface PieChartProps extends Omit<React.ComponentProps<'div'>, 'childr
|
|
|
40
110
|
outerRadius?: number;
|
|
41
111
|
/** Gap between slices, in degrees. */
|
|
42
112
|
paddingAngle?: number;
|
|
113
|
+
/** Corner radius of each slice. */
|
|
114
|
+
cornerRadius?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Angle the sweep starts at, in degrees (0 is 3 o'clock, counter-clockwise).
|
|
117
|
+
* Pair with `endAngle` for a semicircle (`180` → `0`) or an arc.
|
|
118
|
+
*
|
|
119
|
+
* A partial sweep still centres on the full plot area, so a half turn fills
|
|
120
|
+
* only half its box — give the chart a short, wide one rather than expecting
|
|
121
|
+
* the arc to grow into a square.
|
|
122
|
+
*/
|
|
123
|
+
startAngle?: number;
|
|
124
|
+
/** Angle the sweep ends at, in degrees. Defaults to a full `360` circle. */
|
|
125
|
+
endAngle?: number;
|
|
126
|
+
/**
|
|
127
|
+
* Smallest angle a non-zero slice may occupy, in degrees — keeps a tiny slice
|
|
128
|
+
* visible (and hoverable) at the cost of being drawn out of proportion.
|
|
129
|
+
*/
|
|
130
|
+
minAngle?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Per-slice overrides keyed by the slice's `nameKey` value: its `color`, and
|
|
133
|
+
* whether/how its data label reads. A name with no entry keeps the chart-level
|
|
134
|
+
* behavior.
|
|
135
|
+
*/
|
|
136
|
+
sliceSettings?: Record<string, PieChartSliceSettings>;
|
|
43
137
|
showTooltip?: boolean;
|
|
44
138
|
showLegend?: boolean;
|
|
139
|
+
/** Which edge the legend sits on. Defaults to `bottom`. */
|
|
140
|
+
legendPosition?: 'top' | 'bottom';
|
|
141
|
+
/** Plot-area margin, in px. Omit to use recharts' default (5 on every side). */
|
|
142
|
+
margin?: {
|
|
143
|
+
top?: number;
|
|
144
|
+
right?: number;
|
|
145
|
+
bottom?: number;
|
|
146
|
+
left?: number;
|
|
147
|
+
};
|
|
45
148
|
/**
|
|
46
149
|
* Replace the default tooltip. Pass a configured `ChartTooltipContent`
|
|
47
150
|
* (imported from this library) — e.g. with a `formatter` / `labelFormatter` —
|
|
48
151
|
* to customize formatting, per-slice rows, or extra fields without composing
|
|
49
|
-
* recharts yourself.
|
|
152
|
+
* recharts yourself. Takes precedence over `tooltipFormat`. Ignored when
|
|
153
|
+
* `showTooltip` is false.
|
|
50
154
|
*/
|
|
51
155
|
tooltipContent?: React.ComponentProps<typeof ChartTooltip>['content'];
|
|
156
|
+
/**
|
|
157
|
+
* How the default tooltip reads a slice: its `value` alone (the default), or
|
|
158
|
+
* the value followed by its share of the total (`value-percent`). The preset
|
|
159
|
+
* covers the common case without hand-rolling a `tooltipContent`.
|
|
160
|
+
*
|
|
161
|
+
* The share is rendered as `NN.N%`, same as a data label's — not locale-aware.
|
|
162
|
+
* Pass your own `tooltipContent` if you need to format it.
|
|
163
|
+
*/
|
|
164
|
+
tooltipFormat?: PieChartTooltipFormat;
|
|
165
|
+
/**
|
|
166
|
+
* Position of the value labels when `showLabels` is on. Defaults to `outside`,
|
|
167
|
+
* which keeps them on the chart surface — the only placement that reliably
|
|
168
|
+
* has contrast, since slice fills are caller-supplied saturated colors. The
|
|
169
|
+
* on-arc placements are available but switch to the on-fill label token.
|
|
170
|
+
* Ignored when `labelLine` is on — a leader line only ever ends outside the arc.
|
|
171
|
+
*/
|
|
172
|
+
labelPosition?: PolarLabelPosition;
|
|
173
|
+
/**
|
|
174
|
+
* What each data label reads when `showLabels` is on — the value alone (the
|
|
175
|
+
* default), or the slice name and/or its share of the total. Overridable per
|
|
176
|
+
* slice via `sliceSettings`.
|
|
177
|
+
*
|
|
178
|
+
* `labelFormatter` formats the slice's *value*, so it reaches `value` and
|
|
179
|
+
* `name-value` only: a share is always rendered as `NN.N%` (a `.` decimal and
|
|
180
|
+
* a bare `%`, not locale-aware) and never passes through the formatter.
|
|
181
|
+
*/
|
|
182
|
+
labelFormat?: PieChartLabelFormat;
|
|
183
|
+
/**
|
|
184
|
+
* Draw a leader line from each slice to its data label, in the slice's own
|
|
185
|
+
* color. Moves the labels outside the arc (see `labelPosition`); slices whose
|
|
186
|
+
* label is hidden by `sliceSettings` get no line either.
|
|
187
|
+
*
|
|
188
|
+
* A label reaching out past the arc needs horizontal room — give the chart a
|
|
189
|
+
* box wider than it is tall, or shrink the arc (`outerRadius`/`margin`), or
|
|
190
|
+
* the outermost labels are clipped at the surface edge.
|
|
191
|
+
*/
|
|
192
|
+
labelLine?: boolean;
|
|
52
193
|
}
|
|
53
194
|
declare const PieChart: React.ForwardRefExoticComponent<Omit<PieChartProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
54
195
|
export { PieChart, pieChartVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { RadarChart, radarChartVariants, type RadarChartProps } from './radar-chart';
|
|
1
|
+
export { RadarChart, radarChartVariants, type RadarChartProps, type RadarChartSeriesSettings, } from './radar-chart';
|