@acronis-platform/ui-react 0.60.0 → 0.62.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.
Files changed (99) hide show
  1. package/README.md +5 -5
  2. package/dist/components/ui/app-shell/app-shell.js.map +1 -1
  3. package/dist/components/ui/area-chart/area-chart.js +209 -146
  4. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  5. package/dist/components/ui/avatar/avatar.js +26 -23
  6. package/dist/components/ui/avatar/avatar.js.map +1 -1
  7. package/dist/components/ui/bar-chart/bar-chart.js +595 -180
  8. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  9. package/dist/components/ui/calendar-panel/calendar-panel-utils.js +63 -0
  10. package/dist/components/ui/calendar-panel/calendar-panel-utils.js.map +1 -0
  11. package/dist/components/ui/calendar-panel/calendar-panel.js +260 -0
  12. package/dist/components/ui/calendar-panel/calendar-panel.js.map +1 -0
  13. package/dist/components/ui/category-bar/category-bar.js +98 -77
  14. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  15. package/dist/components/ui/chart/chart-format.js +144 -14
  16. package/dist/components/ui/chart/chart-format.js.map +1 -1
  17. package/dist/components/ui/chart/chart.js +204 -150
  18. package/dist/components/ui/chart/chart.js.map +1 -1
  19. package/dist/components/ui/composed-chart/composed-chart.js +422 -125
  20. package/dist/components/ui/composed-chart/composed-chart.js.map +1 -1
  21. package/dist/components/ui/confidence-cone/confidence-cone.js +308 -202
  22. package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -1
  23. package/dist/components/ui/filter-cards/filter-cards.js +25 -0
  24. package/dist/components/ui/filter-cards/filter-cards.js.map +1 -0
  25. package/dist/components/ui/funnel-chart/funnel-chart.js +245 -51
  26. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  27. package/dist/components/ui/histogram/histogram.js +85 -81
  28. package/dist/components/ui/histogram/histogram.js.map +1 -1
  29. package/dist/components/ui/line-chart/line-chart.js +227 -184
  30. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  31. package/dist/components/ui/metric/metric.js +88 -70
  32. package/dist/components/ui/metric/metric.js.map +1 -1
  33. package/dist/components/ui/pie-chart/pie-chart.js +234 -80
  34. package/dist/components/ui/pie-chart/pie-chart.js.map +1 -1
  35. package/dist/components/ui/radar-chart/radar-chart.js +210 -57
  36. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  37. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +358 -50
  38. package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -1
  39. package/dist/components/ui/resizable/resizable.js +23 -11
  40. package/dist/components/ui/resizable/resizable.js.map +1 -1
  41. package/dist/components/ui/sankey-chart/sankey-chart.js +25 -18
  42. package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -1
  43. package/dist/components/ui/scatter-chart/scatter-chart.js +86 -78
  44. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  45. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
  46. package/dist/components/ui/timeline/timeline.js +206 -142
  47. package/dist/components/ui/timeline/timeline.js.map +1 -1
  48. package/dist/components/ui/treemap/treemap.js +183 -59
  49. package/dist/components/ui/treemap/treemap.js.map +1 -1
  50. package/dist/index.js +446 -420
  51. package/dist/index.js.map +1 -1
  52. package/dist/node_modules/.pnpm/react-day-picker@10.0.1_@types_react@19.2.15_react@19.2.6/node_modules/react-day-picker/dist/esm/useDayPicker.js +3 -3
  53. package/dist/react.js +446 -420
  54. package/dist/react.js.map +1 -1
  55. package/dist/src/components/ui/area-chart/area-chart.d.ts +53 -3
  56. package/dist/src/components/ui/area-chart/index.d.ts +1 -1
  57. package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
  58. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +154 -16
  59. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  60. package/dist/src/components/ui/button/button.d.ts +1 -1
  61. package/dist/src/components/ui/button-menu/button-menu.d.ts +1 -1
  62. package/dist/src/components/ui/calendar-panel/__tests__/calendar-panel-utils.test.d.ts +1 -0
  63. package/dist/src/components/ui/calendar-panel/calendar-panel-utils.d.ts +55 -0
  64. package/dist/src/components/ui/calendar-panel/calendar-panel.d.ts +112 -0
  65. package/dist/src/components/ui/calendar-panel/index.d.ts +1 -0
  66. package/dist/src/components/ui/chart/__tests__/chart-layout.d.ts +63 -0
  67. package/dist/src/components/ui/chart/__tests__/chart-layout.test.d.ts +1 -0
  68. package/dist/src/components/ui/chart/chart-format.d.ts +415 -0
  69. package/dist/src/components/ui/chart/chart.d.ts +9 -3
  70. package/dist/src/components/ui/chart/index.d.ts +2 -2
  71. package/dist/src/components/ui/composed-chart/composed-chart.d.ts +156 -7
  72. package/dist/src/components/ui/composed-chart/index.d.ts +1 -1
  73. package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +138 -20
  74. package/dist/src/components/ui/confidence-cone/index.d.ts +1 -1
  75. package/dist/src/components/ui/filter-cards/filter-cards.d.ts +11 -0
  76. package/dist/src/components/ui/filter-cards/index.d.ts +1 -0
  77. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +201 -3
  78. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
  79. package/dist/src/components/ui/histogram/histogram.d.ts +2 -2
  80. package/dist/src/components/ui/line-chart/index.d.ts +1 -1
  81. package/dist/src/components/ui/line-chart/line-chart.d.ts +51 -3
  82. package/dist/src/components/ui/pie-chart/index.d.ts +1 -1
  83. package/dist/src/components/ui/pie-chart/pie-chart.d.ts +145 -4
  84. package/dist/src/components/ui/radar-chart/index.d.ts +1 -1
  85. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +219 -6
  86. package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -1
  87. package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +215 -9
  88. package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +2 -2
  89. package/dist/src/components/ui/timeline/index.d.ts +1 -1
  90. package/dist/src/components/ui/timeline/timeline.d.ts +79 -20
  91. package/dist/src/components/ui/treemap/index.d.ts +1 -1
  92. package/dist/src/components/ui/treemap/treemap.d.ts +68 -8
  93. package/dist/src/index.d.ts +2 -1
  94. package/dist/ui-react.css +1 -1
  95. package/package.json +2 -2
  96. package/dist/components/ui/search-global/search-global.js +0 -60
  97. package/dist/components/ui/search-global/search-global.js.map +0 -1
  98. package/dist/src/components/ui/search-global/index.d.ts +0 -1
  99. package/dist/src/components/ui/search-global/search-global.d.ts +0 -7
@@ -83,6 +83,421 @@ export interface CartesianChartProps {
83
83
  * make the preset indistinguishable from `zero`.
84
84
  */
85
85
  export declare function resolveAxisDomain(preset: 'auto' | 'dataMin-dataMax' | 'zero' | undefined): Readonly<[AxisDomainItem, AxisDomainItem]> | undefined;
86
+ /**
87
+ * `text-anchor` for a rotated X tick row, so the tick's text ends (or begins) at
88
+ * the tick it labels instead of straddling it. Shared by all 7 cartesian charts.
89
+ *
90
+ * A tick rotated anti-clockwise trails off to the lower left, so it must be
91
+ * anchored at its end; a clockwise one trails to the lower right and is anchored
92
+ * at its start. Only an *omitted* angle keeps recharts' own default (`middle`):
93
+ * the branch is on `angle < 0`, so `angle={0}` anchors at `start` like any
94
+ * clockwise rotation. A caller that normalises "upright" to `0` instead of
95
+ * leaving `xAxisAngle` off therefore gets the rotated-tick treatment — here and
96
+ * in `resolveXAxisHeight`.
97
+ */
98
+ export declare function resolveRotatedTickAnchor(angle: number | undefined): 'start' | 'end' | undefined;
99
+ /**
100
+ * Height to reserve for the X tick row, or `undefined` to keep recharts' own
101
+ * default. Shared by all 7 cartesian charts.
102
+ *
103
+ * recharts' default 30 covers one upright tick row and nothing else, so a
104
+ * rotated row (+20) and an axis title (+18) each need their own allowance. The
105
+ * two are additive rather than exclusive — a chart can rotate its ticks *and*
106
+ * title the axis, which a label-or-angle ternary under-allocates.
107
+ *
108
+ * The +20 keys off the angle being *present*, not non-zero, so `angle={0}`
109
+ * reserves the rotated row's height as well — the same edge case
110
+ * `resolveRotatedTickAnchor` has, kept consistent between the two.
111
+ */
112
+ export declare function resolveXAxisHeight(label: string | undefined, angle: number | undefined): number | undefined;
113
+ /**
114
+ * recharts `label` for an X axis title, placed below the tick row. Shared by all
115
+ * 7 cartesian charts; `insideTop` is for a secondary scale on the top edge.
116
+ */
117
+ export declare function resolveXAxisTitle(label: string | undefined, position?: 'insideBottom' | 'insideTop', offset?: number): {
118
+ value: string;
119
+ position: "insideBottom" | "insideTop";
120
+ offset: number;
121
+ } | undefined;
122
+ /**
123
+ * recharts `label` for a rotated value-axis title, angled so it reads from the
124
+ * outside in — upward on a left axis (the convention), downward on a right one,
125
+ * where -90° would put the text's baseline against the plot. Shared by all 7
126
+ * cartesian charts; only `ComposedChart` currently uses the right-hand side.
127
+ */
128
+ export declare function resolveYAxisTitle(label: string | undefined, orientation?: 'left' | 'right'): {
129
+ value: string;
130
+ angle: number;
131
+ position: "insideLeft" | "insideRight";
132
+ style: {
133
+ textAnchor: "middle";
134
+ };
135
+ } | undefined;
136
+ /**
137
+ * A category range on a cartesian chart: `from`/`to` accept either the
138
+ * category's value (an `xKey` cell, e.g. `'Sep'`) or its 0-based row index. Both
139
+ * ends are inclusive, and either can be omitted to run to that end of the data.
140
+ * Shared by the charts that scope something to a slice of the categories — a
141
+ * reference band, a per-series style override.
142
+ */
143
+ export interface ChartCategoryRange {
144
+ from?: string | number;
145
+ to?: string | number;
146
+ }
147
+ /**
148
+ * Resolve a category range to inclusive row indices. A bound is either the
149
+ * category's own value (matched against the `xKey` cell) or a 0-based index;
150
+ * an omitted bound runs to that end of the data. Returns `undefined` when the
151
+ * data is empty or the range resolves to nothing (an unknown value, or a `to`
152
+ * that lands before its `from`).
153
+ *
154
+ * Exported for unit tests; not part of the package's public API.
155
+ */
156
+ export declare function resolveCategoryRange(range: ChartCategoryRange, data: ReadonlyArray<Record<string, unknown>>, xKey: string): [number, number] | undefined;
157
+ /**
158
+ * Which value axis a series is measured against, on a chart that can carry two.
159
+ *
160
+ * `secondary` is the opt-in: the second axis exists only when at least one series
161
+ * asks for it, so a chart whose series all leave this unset keeps the single
162
+ * shared scale — and its recharts output — exactly as before.
163
+ */
164
+ export type ChartYAxisTarget = 'primary' | 'secondary';
165
+ /**
166
+ * Second value-axis props, for a chart whose series can be measured on two
167
+ * independent scales. **Only `ComposedChart` implements these today.** It is the
168
+ * one chart in the suite where two scales are unambiguous: its series already
169
+ * differ in mark type, so a bar read against the left axis and a line against the
170
+ * right can't be mistaken for two marks sharing one. On a single-mark chart (Bar,
171
+ * Area) two scales invite comparing heights that aren't comparable, which is why
172
+ * these props are not mixed into `CartesianChartProps`.
173
+ *
174
+ * The primary axis is configured through `CartesianChartProps` (`yAxisLabel`,
175
+ * `yUnit`, `yTickFormatter`, `yAxisTickCount`, `yAxisDomain`, `showYAxis`); every
176
+ * `secondary*` prop here is its counterpart on the second axis, so the two scales
177
+ * format and bound themselves independently, and each is inert until a series
178
+ * selects that axis.
179
+ *
180
+ * `yAxisOrientation` is the exception on both counts: it places the *primary*
181
+ * axis, and it applies whether or not a second one exists. It lives here because
182
+ * it is only meaningful once a chart can mirror a pair of axes — a single-axis
183
+ * chart has no second side to give up.
184
+ */
185
+ export interface SecondaryYAxisProps {
186
+ /**
187
+ * Which side the *primary* value axis sits on. Defaults to `left`. The secondary
188
+ * axis always takes the opposite side. Unlike the `secondary*` props below, this
189
+ * one applies to a single-scale chart too.
190
+ *
191
+ * Inert on a chart whose marks grow horizontally: the value axis is X there, so
192
+ * the primary sits along the bottom edge and the secondary along the top, and
193
+ * neither has a left/right side to pick.
194
+ */
195
+ yAxisOrientation?: 'left' | 'right';
196
+ /**
197
+ * Show the secondary axis's ticks + title. Defaults to `true`. Setting it false
198
+ * keeps the second *scale* (series still measure against it) and only drops its
199
+ * chrome — the same meaning `showYAxis` has for the primary axis.
200
+ */
201
+ showSecondaryYAxis?: boolean;
202
+ /** Title rendered beside the secondary axis (rotated). */
203
+ secondaryYAxisLabel?: string;
204
+ /** Unit suffix appended to the secondary axis's tick values (recharts `unit`). */
205
+ secondaryYUnit?: string;
206
+ /** Format each secondary-axis tick value — the counterpart of `yTickFormatter`. */
207
+ secondaryYTickFormatter?: TickFormatter;
208
+ /** Desired number of ticks on the secondary axis (recharts `tickCount`; a hint, not exact). */
209
+ secondaryYAxisTickCount?: number;
210
+ /** Domain preset for the secondary axis — same presets as `yAxisDomain`. */
211
+ secondaryYAxisDomain?: 'auto' | 'dataMin-dataMax' | 'zero';
212
+ }
213
+ /**
214
+ * How a series interpolates between its points (recharts `type`), shared by the
215
+ * Line and Area families so both offer the same set:
216
+ *
217
+ * - `linear` — straight segments between points.
218
+ * - `monotone` — smoothed, without overshooting a point's value.
219
+ * - `natural` — a natural cubic spline; smoother than `monotone`, but it may
220
+ * overshoot, so read it as a trend rather than exact values.
221
+ * - `basis` — a B-spline that is *not* required to pass through the points at
222
+ * all; the smoothest option, and the least literal.
223
+ * - `step` — right-angle segments, changing value at the midpoint between two
224
+ * points; `stepBefore` changes at the leading point and `stepAfter` at the
225
+ * trailing one.
226
+ */
227
+ export type ChartCurveType = 'linear' | 'monotone' | 'natural' | 'basis' | 'step' | 'stepBefore' | 'stepAfter';
228
+ /** recharts animation easing curves. */
229
+ export type ChartAnimationEasing = 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
230
+ /**
231
+ * Entrance-animation props shared by *every* chart type (not just the cartesian
232
+ * ones) — charts hardcode `isAnimationActive={false}` otherwise. All optional and
233
+ * off by default, so an unset chart renders byte-identically to before (and its
234
+ * VR baselines stay stable). Spread `resolveAnimation(props)` onto each series.
235
+ */
236
+ export interface ChartAnimationProps {
237
+ /** Enable entrance animation. Defaults to `false` (keeps output/baselines stable). */
238
+ animate?: boolean;
239
+ /** Animation duration in ms (recharts `animationDuration`). */
240
+ animationDuration?: number;
241
+ /** Delay before the animation starts, in ms (recharts `animationBegin`). */
242
+ animationBegin?: number;
243
+ /** Easing curve (recharts `animationEasing`). */
244
+ animationEasing?: ChartAnimationEasing;
245
+ }
246
+ /** The resolved recharts animation props to spread onto a series/shape. */
247
+ export interface ResolvedAnimation {
248
+ isAnimationActive: boolean | 'auto';
249
+ animationDuration?: number;
250
+ animationBegin?: number;
251
+ animationEasing?: ChartAnimationEasing;
252
+ }
253
+ /**
254
+ * Turn the shared `ChartAnimationProps` into the recharts series props. The
255
+ * timing props only appear when given, so an unset chart spreads exactly
256
+ * `{ isAnimationActive: false }` — the previous hardcoded value.
257
+ *
258
+ * `animate` maps to recharts' `'auto'`, not to a literal `true`: `'auto'` is the
259
+ * only value that honors `prefers-reduced-motion` (and disables the animation in
260
+ * SSR). recharts resolves it as
261
+ * `isActive = isActiveProp === 'auto' ? !isSsr && !prefersReducedMotion : isActiveProp`,
262
+ * so a literal `true` would force motion on users who asked for none — this
263
+ * library has no other reduced-motion escape hatch.
264
+ */
265
+ export declare function resolveAnimation(props: ChartAnimationProps): ResolvedAnimation;
266
+ /** Where a data label sits on a cartesian series (recharts `LabelList` position). */
267
+ export type CartesianLabelPosition = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'insideTop' | 'insideBottom' | 'insideLeft' | 'insideRight' | 'insideStart' | 'insideEnd';
268
+ /**
269
+ * Where a data label sits on a *polar* series (Pie, RadialBar). Deliberately not
270
+ * `CartesianLabelPosition`: recharts routes a polar label list through
271
+ * `getAttrsOfPolarLabel` / `renderRadialLabel`, which understand only these
272
+ * seven values — every cartesian-only position (`top`, `insideLeft`, …) silently
273
+ * collapses to the same mid-radius placement, so offering them would advertise
274
+ * distinctions that don't exist.
275
+ */
276
+ export type PolarLabelPosition = 'outside' | 'center' | 'centerTop' | 'centerBottom' | 'insideStart' | 'insideEnd' | 'end';
277
+ /** Any position accepted by the suite's data labels. */
278
+ export type ChartLabelPosition = CartesianLabelPosition | PolarLabelPosition;
279
+ /**
280
+ * Data-label props shared by the charts that can annotate each point/segment with
281
+ * its value. `labelPosition` stays per-chart (the valid position set differs by
282
+ * family), but `showLabels` + `labelFormatter` are common. Label formatting reuses
283
+ * the same `TickFormatter` type as the axes, so a label and its axis read the same.
284
+ */
285
+ export interface ChartDataLabelProps {
286
+ /** Render a value label on each data point/segment. Defaults to `false`. */
287
+ showLabels?: boolean;
288
+ /** Format each label value — pass the same formatter used on the value axis. */
289
+ labelFormatter?: TickFormatter;
290
+ }
291
+ /**
292
+ * Fill for a label that sits on the chart *surface* — i.e. an outside position
293
+ * (`top`, `right`, polar `outside`). Inverts with the theme, so it only works
294
+ * against the surface background.
295
+ */
296
+ export declare const CHART_LABEL_FILL_CLASS = "fill-[var(--ui-text-on-surface-primary)]!";
297
+ /**
298
+ * Fill for a label that sits on an *opaque series fill* — any `inside*`
299
+ * position, a polar mid-radius/centroid placement, or a stacked bar/arc segment
300
+ * (an area's fill is translucent, so it uses the on-surface token). The on-surface
301
+ * token must not be used there: it resolves near-white in dark mode and drops to
302
+ * ~1.6:1 against the saturated status/brand fills the charts colour series with,
303
+ * failing the `accessibility/contrast` grammar rule (`must`, WCAG 1.4.3). This is
304
+ * the same "text on a strong colored surface" token `Treemap` already uses; it is
305
+ * white in both themes, so it holds up over every series colour.
306
+ */
307
+ export declare const CHART_LABEL_FILL_ON_SERIES_CLASS = "fill-[var(--ui-text-on-status-strong-neutral)]!";
308
+ export declare const CHART_LABEL_FONT_SIZE = 12;
309
+ /**
310
+ * Plot-area inset to apply when a Line/Area series carries outside data labels.
311
+ * recharts hands those label lists `parentViewBox: undefined` (its own source
312
+ * calls this out as a bug in `cartesian/Line.js`), so `getCartesianPosition`'s
313
+ * `clamp` has nothing to clamp against and the first/last point's value is cut
314
+ * off at the SVG edge. Widening the margin is the only lever a composition over
315
+ * recharts has. `Bar` does pass a `parentViewBox`, so bar series don't need it.
316
+ */
317
+ export declare const CHART_LABEL_MARGIN: {
318
+ readonly top: 16;
319
+ readonly right: 24;
320
+ readonly bottom: 5;
321
+ readonly left: 12;
322
+ };
323
+ /**
324
+ * Resolve where a cartesian value label sits, given the caller's override, the
325
+ * layout, and the position of the series' growing end (`top` for a vertical bar
326
+ * or a line/area point, `right` for a horizontal bar).
327
+ *
328
+ * The stacked branch is the reason this isn't inlined: a stacked segment has no
329
+ * free space at its growing end — the next segment is drawn there — so a `top`
330
+ * label lands *inside* its neighbour rather than over its own segment. Centring
331
+ * it in its own segment is the readable placement; `resolveLabelFillClass` then
332
+ * pairs it with the fill that has contrast over that family's series colour.
333
+ */
334
+ export declare function resolveCartesianLabelPosition(options: {
335
+ labelPosition?: CartesianLabelPosition;
336
+ isStacked?: boolean;
337
+ growingEnd?: CartesianLabelPosition;
338
+ }): CartesianLabelPosition;
339
+ /**
340
+ * Pick the label fill that actually has contrast at `position`. Callers must pass
341
+ * the *resolved* position (after their own default), never `undefined` for a
342
+ * polar chart — recharts' polar fallback is a mid-radius placement, which is on
343
+ * the fill even though no `inside*` value was given.
344
+ *
345
+ * Returns a `className`, not a `fill` attribute, and the utility is `!`-flagged:
346
+ * the cartesian charts scope `[&_.recharts-label]:fill-foreground` on their
347
+ * container to theme axis titles, and a `LabelList`'s text carries
348
+ * `.recharts-label` too — so a CSS rule would quietly beat an SVG presentation
349
+ * attribute and undo the contrast fix.
350
+ *
351
+ * `translucentSeries` opts a family out of the on-fill token: an area's fill is
352
+ * a gradient (0.8 → 0.1 alpha) or a flat `fillOpacity`, so what sits behind the
353
+ * label is the surface tinted by the series colour, not the series colour. The
354
+ * white on-fill token disappears into it in light mode — the theme-inverting
355
+ * on-surface token is the readable one there, and stays white in dark mode.
356
+ */
357
+ export declare function resolveLabelFillClass(position: ChartLabelPosition, options?: {
358
+ translucentSeries?: boolean;
359
+ }): string;
360
+ /**
361
+ * Adapt a `TickFormatter` to recharts' `LabelList` `formatter` prop, whose value
362
+ * type is wider. Returns `undefined` when no formatter is given, so a label
363
+ * renders its raw value. Lets labels reuse the same formatters as the value axis.
364
+ *
365
+ * Null/undefined is filtered out rather than forwarded: recharts builds a label
366
+ * entry for *every* point including the null ones that `connectNulls` is meant to
367
+ * bridge, and the tick formatters coerce (`formatCompactNumber(null)` is `"0"`,
368
+ * `formatPercent(undefined)` is `"undefined"`) — which would paint a phantom
369
+ * value over an intentional gap.
370
+ */
371
+ export declare function toLabelFormatter(formatter: TickFormatter | undefined): ((value: unknown) => string) | undefined;
372
+ /** Where a reference line's caption sits relative to the rule. */
373
+ export type ChartReferenceLabelPosition = 'top' | 'insideTopLeft' | 'insideTopRight' | 'insideBottomLeft' | 'insideBottomRight';
374
+ /**
375
+ * A dashed rule across the value axis — a target, a threshold, or a series
376
+ * average. Shared by the cartesian charts that draw one (`BarChart`,
377
+ * `LineChart`, `AreaChart`) so the config reads the same on all three.
378
+ */
379
+ export interface ChartReferenceLine {
380
+ /** Fixed position on the value axis. Takes precedence over `average`. */
381
+ value?: number;
382
+ /**
383
+ * Draw the line at the mean of one series (a `dataKeys` entry) or, when
384
+ * `true`, of every plotted series' values.
385
+ */
386
+ average?: boolean | string;
387
+ /** Optional caption rendered alongside the line. */
388
+ label?: string;
389
+ /**
390
+ * Where the caption sits. Defaults to the chart's own placement — move it
391
+ * when the rule lands where the series already is and the two collide.
392
+ */
393
+ labelPosition?: ChartReferenceLabelPosition;
394
+ }
395
+ /**
396
+ * Normalize the `referenceLine` prop — a single config or an array — to a list.
397
+ * Every chart accepts both forms, so this keeps the render path uniform.
398
+ */
399
+ export declare function toReferenceLineList(referenceLine: ChartReferenceLine | ChartReferenceLine[] | undefined): ChartReferenceLine[];
400
+ /**
401
+ * Resolve a `referenceLine` config to a position on the value axis: a fixed
402
+ * `value` wins; otherwise the mean of the requested series (a single `dataKeys`
403
+ * entry, or all of them when `average` is `true`). Returns `undefined` when
404
+ * there is nothing to draw (no config, or no numeric values to average) — the
405
+ * caller skips the line rather than drawing it at 0.
406
+ *
407
+ * Rows are `unknown`-valued because `ComposedChart` types its data that way; the
408
+ * body only ever reads cells that are numbers, so a wider row type costs nothing
409
+ * and saves every caller a cast.
410
+ */
411
+ export declare function resolveChartReferenceValue(referenceLine: ChartReferenceLine | undefined, data: ReadonlyArray<Record<string, unknown>>, dataKeys: string[]): number | undefined;
412
+ /**
413
+ * Stroke (and caption fill) of a reference rule. The muted text token, so the
414
+ * rule reads as annotation rather than as another series — and stays legible in
415
+ * both themes without competing with the series colors.
416
+ */
417
+ export declare const CHART_REFERENCE_LINE_STROKE = "var(--ui-text-on-surface-secondary)";
418
+ /**
419
+ * The recharts props that paint a reference rule: a dashed line in the muted
420
+ * text token with an optional caption. Shared so the three charts that draw one
421
+ * can't drift on the stroke, dash pattern, or caption styling.
422
+ *
423
+ * `labelPosition` is the chart's default placement; a config's own
424
+ * `labelPosition` overrides it at the call site.
425
+ *
426
+ * `ifOverflow: 'extendDomain'` is part of the contract, not a detail: a target
427
+ * above the data maximum is exactly the case a reference line is for, and
428
+ * recharts' default (`discard`) would silently drop it.
429
+ */
430
+ export declare function resolveReferenceLineProps(label: string | undefined, labelPosition?: ChartReferenceLabelPosition): {
431
+ stroke: string;
432
+ strokeDasharray: string;
433
+ ifOverflow: "extendDomain";
434
+ label: {
435
+ value: string;
436
+ position: ChartReferenceLabelPosition;
437
+ fill: string;
438
+ fontSize: number;
439
+ } | undefined;
440
+ };
441
+ /**
442
+ * Range-brush props for the cartesian charts that support one — `BarChart`,
443
+ * `LineChart`, `AreaChart`, `ComposedChart`. Deliberately not folded into
444
+ * `CartesianChartProps`: `ScatterChart` plots a continuous X (the brush indexes
445
+ * rows, not values) and `Histogram` / `ConfidenceCone` render a derived series,
446
+ * so a brush over their row order would slice the wrong thing.
447
+ */
448
+ export interface ChartBrushProps {
449
+ /**
450
+ * Render a range brush beneath the chart — drag its handles (or the selected
451
+ * window) to zoom the series to a slice of the data. Defaults to `false`.
452
+ */
453
+ showBrush?: boolean;
454
+ /** Height of the brush strip in px. Defaults to 28. */
455
+ brushHeight?: number;
456
+ /**
457
+ * Accessible name for the brush's two range handles. Both are focusable
458
+ * `role="slider"` elements, so they need one. Defaults to
459
+ * `'Chart range selector'`.
460
+ */
461
+ brushAriaLabel?: string;
462
+ }
463
+ /**
464
+ * Height of the brush strip. recharts' own default is 40, which eats an eighth
465
+ * of a 320px-tall dashboard widget; 28 still fits the travellers and the
466
+ * range captions.
467
+ */
468
+ export declare const CHART_BRUSH_HEIGHT = 28;
469
+ /**
470
+ * Accessible name for the brush handles. recharts' own fallback is
471
+ * `"Min value: ".concat(start, ", Max value: ").concat(end)`, where both halves
472
+ * come from a `name` property on the data row — a field none of our charts
473
+ * require, so it announces "Min value: undefined, Max value: undefined". Always
474
+ * pass `ariaLabel` to suppress it.
475
+ */
476
+ export declare const CHART_BRUSH_ARIA_LABEL = "Chart range selector";
477
+ /** The resolved recharts brush props to spread onto a `<Brush>`. */
478
+ export interface ResolvedBrush {
479
+ height: number;
480
+ fill: string;
481
+ stroke: string;
482
+ travellerWidth: number;
483
+ ariaLabel: string;
484
+ }
485
+ /**
486
+ * Theme + size a recharts `<Brush>` from the shared `ChartBrushProps`.
487
+ *
488
+ * recharts derives the *whole* brush from two color props, so both have to be
489
+ * chosen for every element they reach (`cartesian/Brush.js`):
490
+ * - `fill` paints only the strip's background rect.
491
+ * - `stroke` paints its border, the traveller handles' **fill**, the selected
492
+ * window at 20% opacity, and the range caption text.
493
+ *
494
+ * Hence the mid-grey text token rather than the border one: the travellers are
495
+ * solid `stroke`-colored rects with two hardcoded `#fff` grip lines drawn on
496
+ * top, so a pale stroke would render the grips invisible in light mode. That
497
+ * token is theme-stable (same grey in light and dark), and white grips read
498
+ * against it either way.
499
+ */
500
+ export declare function resolveBrushProps({ brushHeight, brushAriaLabel, }: Omit<ChartBrushProps, 'showBrush'>): ResolvedBrush;
86
501
  /**
87
502
  * Compact thousands/millions: `1234 → "1.2K"`, `1_500_000 → "1.5M"`. Non-numeric
88
503
  * values (including blank strings) pass through unchanged. Use for large-count
@@ -24,7 +24,6 @@ export type ChartTooltipContentProps = Partial<TooltipContentProps<ValueType, Na
24
24
  className?: string;
25
25
  hideLabel?: boolean;
26
26
  hideIndicator?: boolean;
27
- indicator?: 'line' | 'dot' | 'dashed';
28
27
  nameKey?: string;
29
28
  labelKey?: string;
30
29
  labelFormatter?: (label: TooltipContentProps<number, string>['label'], payload: TooltipContentProps<number, string>['payload']) => React.ReactNode;
@@ -38,6 +37,13 @@ export type ChartLegendContentProps = {
38
37
  verticalAlign?: LegendProps['verticalAlign'];
39
38
  payload?: LegendPayload[];
40
39
  nameKey?: string;
40
+ /**
41
+ * The series config the entries take their labels and icons from. Defaults to
42
+ * the enclosing `ChartContainer`'s — pass it only to render the legend *outside*
43
+ * the container, which a chart type has to do when the renderer can't lay a
44
+ * legend out inside its plot (see `Treemap`).
45
+ */
46
+ config?: ChartConfig;
41
47
  };
42
48
  export interface ChartContainerProps extends React.ComponentProps<'div'> {
43
49
  config: ChartConfig;
@@ -51,7 +57,7 @@ declare const ChartStyle: ({ id, config }: {
51
57
  declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
52
58
  /** The `content` a caller passes to override the default tooltip (recharts' `Tooltip['content']`). */
53
59
  export type ChartTooltipContentType = React.ComponentProps<typeof ChartTooltip>['content'];
54
- declare function ChartTooltipContent({ active, payload, label, className, indicator, hideLabel, hideIndicator, labelFormatter, formatter, labelClassName, color, nameKey, labelKey, }: ChartTooltipContentProps): import("react/jsx-runtime").JSX.Element | null;
60
+ declare function ChartTooltipContent({ active, payload, label, className, hideLabel, hideIndicator, labelFormatter, formatter, labelClassName, color, nameKey, labelKey, }: ChartTooltipContentProps): import("react/jsx-runtime").JSX.Element | null;
55
61
  declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
56
- declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
62
+ declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, config: configFromProps, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
57
63
  export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
@@ -1,4 +1,4 @@
1
1
  export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, } from './chart';
2
2
  export type { ChartConfig, ChartContainerProps, ChartTooltipContentProps, ChartLegendContentProps, ChartTooltipContentType, } from './chart';
3
- export { formatCompactNumber, formatPercent, createTickFormatter, resolveAxisDomain, } from './chart-format';
4
- export type { TickFormatter, CartesianChartProps } from './chart-format';
3
+ export { formatCompactNumber, formatPercent, createTickFormatter, resolveAxisDomain, resolveRotatedTickAnchor, resolveXAxisHeight, resolveXAxisTitle, resolveYAxisTitle, resolveCategoryRange, resolveAnimation, toLabelFormatter, resolveLabelFillClass, resolveCartesianLabelPosition, resolveBrushProps, resolveChartReferenceValue, resolveReferenceLineProps, toReferenceLineList, CHART_REFERENCE_LINE_STROKE, CHART_LABEL_MARGIN, CHART_LABEL_FILL_CLASS, CHART_LABEL_FILL_ON_SERIES_CLASS, CHART_LABEL_FONT_SIZE, CHART_BRUSH_HEIGHT, CHART_BRUSH_ARIA_LABEL, } from './chart-format';
4
+ export type { TickFormatter, ChartCurveType, ChartReferenceLine, ChartReferenceLabelPosition, CartesianChartProps, ChartCategoryRange, ChartYAxisTarget, SecondaryYAxisProps, ChartAnimationProps, ChartAnimationEasing, ResolvedAnimation, ChartDataLabelProps, CartesianLabelPosition, PolarLabelPosition, ChartLabelPosition, ChartBrushProps, ResolvedBrush, } from './chart-format';
@@ -1,15 +1,115 @@
1
- import { ChartConfig, CartesianChartProps } from '../chart';
1
+ import { VariantProps } from 'class-variance-authority';
2
+ import { ChartConfig, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartCategoryRange, ChartDataLabelProps, ChartReferenceLine, CartesianLabelPosition, ChartYAxisTarget, SecondaryYAxisProps } from '../chart';
2
3
  import * as React from 'react';
4
+ declare const composedChartVariants: (props?: ({
5
+ orientation?: "horizontal" | "vertical" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
3
7
  export type ComposedSeriesType = 'bar' | 'line' | 'area';
8
+ /** Interpolation for a line or area series. */
9
+ export type ComposedCurveType = 'linear' | 'monotone' | 'step';
10
+ /**
11
+ * How a series is marked in the legend. Deliberately narrower than recharts'
12
+ * icon set: `ChartLegendContent` draws its own marker and reads only whether the
13
+ * entry is a `line` (a rule, dashed when the series is) or anything else (a
14
+ * swatch), so the wider union would advertise icons that never render. `none`
15
+ * keeps the series off the legend entirely.
16
+ */
17
+ export type ComposedSeriesLegendType = 'line' | 'rect' | 'none';
18
+ /** Plot-area inset, in px. Any side left out keeps the chart's own default. */
19
+ export interface ComposedChartMargin {
20
+ top?: number;
21
+ right?: number;
22
+ bottom?: number;
23
+ left?: number;
24
+ }
4
25
  export interface ComposedSeries {
5
26
  /** Column key to plot — must match a `config` entry; drives its `--color-<key>` paint. */
6
27
  key: string;
7
28
  /** How this series renders. */
8
29
  type: ComposedSeriesType;
30
+ /**
31
+ * Which value axis this series is measured against. Defaults to `primary`.
32
+ * The secondary axis is rendered only when at least one series selects it — use
33
+ * it when a series carries a different unit or magnitude (a rate next to a
34
+ * count) that a shared scale would flatten.
35
+ */
36
+ yAxis?: ChartYAxisTarget;
37
+ /**
38
+ * Paint for this series, overriding its `config` color. Reference an existing
39
+ * semantic `--ui-*` token; there is no chart palette tier yet.
40
+ */
41
+ color?: string;
42
+ /**
43
+ * Stack this series with every other series of the *same mark type* carrying
44
+ * the same id. Bars stack with bars and areas with areas — the ids are
45
+ * namespaced per type, so one id can't merge a bar into an area stack. Ignored
46
+ * on a line series, which recharts does not stack.
47
+ */
48
+ stackId?: string;
49
+ /** Interpolation, overriding the chart's `curve`. Line and area series only. */
50
+ curve?: ComposedCurveType;
51
+ /**
52
+ * Stroke width, overriding the chart's `strokeWidth` on a line or area series.
53
+ * On a bar it sizes the dashed outline `strokeDasharray` draws — a bar has no
54
+ * other stroke, so the chart-level default never reaches one and this is the
55
+ * only way to set it.
56
+ */
57
+ strokeWidth?: number;
58
+ /**
59
+ * Dash pattern for the stroke (an SVG `stroke-dasharray`, e.g. `'5 5'`) — the
60
+ * conventional way to mark a series as a projection. On a bar series it draws a
61
+ * dashed outline in the series colour.
62
+ */
63
+ strokeDasharray?: string;
64
+ /** Render a dot at each point, overriding the chart's `showDots`. Line and area series only. */
65
+ showDots?: boolean;
66
+ /** Render the hover dot, overriding the chart's `showActiveDots`. Line and area series only. */
67
+ showActiveDots?: boolean;
68
+ /** Bridge `null` gaps instead of breaking the series, overriding `connectNulls`. */
69
+ connectNulls?: boolean;
70
+ /** Corner radius on the growing end, overriding the chart's `barRadius`. Bar series only. */
71
+ barRadius?: number;
72
+ /** Fixed bar thickness in px, overriding the chart's `barSize`. Bar series only. */
73
+ barSize?: number;
74
+ /** Highlight this bar on hover, overriding the chart's `showActiveBar`. Bar series only. */
75
+ showActiveBar?: boolean;
76
+ /** Draw a full-height track behind this series' bars, overriding `showBackground`. Bar series only. */
77
+ showBackground?: boolean;
78
+ /** Fill opacity, overriding the chart's `fillOpacity` (which applies to area series). */
79
+ fillOpacity?: number;
80
+ /** How this series is marked in the legend — `none` keeps it off the legend. */
81
+ legendType?: ComposedSeriesLegendType;
9
82
  }
10
- export interface ComposedChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, CartesianChartProps {
11
- /** Row-per-category data. Each object holds `xKey` + one numeric field per series. */
12
- data: ReadonlyArray<Record<string, string | number>>;
83
+ /**
84
+ * A dashed rule on the chart. Either a position on the *value* axis (a fixed
85
+ * `value`, or the mean of one/every series via `average`) or, with `category`, a
86
+ * rule across the *category* axis at one category — the "today" divider between
87
+ * actuals and forecast. A value position wins if both are given.
88
+ */
89
+ export interface ComposedChartReferenceLine extends ChartReferenceLine {
90
+ /**
91
+ * Category to draw the rule at — the category's own value (an `xKey` cell) or
92
+ * its 0-based row index.
93
+ */
94
+ category?: string | number;
95
+ /**
96
+ * Which value axis the rule is measured against, on a chart carrying two.
97
+ * Defaults to the axis of the series named by `average`, and to `primary`
98
+ * otherwise — so a target read off the secondary scale lands on it rather
99
+ * than being plotted against the primary one. `average: true` then pools only
100
+ * the series on this axis, never two scales at once. Inert while no series
101
+ * selects the secondary axis.
102
+ */
103
+ yAxis?: ChartYAxisTarget;
104
+ }
105
+ /** A shaded band behind a range of categories. */
106
+ export interface ComposedChartReferenceArea extends ChartCategoryRange {
107
+ /** Caption above the band. */
108
+ label?: string;
109
+ }
110
+ export interface ComposedChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof composedChartVariants>, CartesianChartProps, SecondaryYAxisProps, ChartAnimationProps, ChartBrushProps, ChartDataLabelProps {
111
+ /** Row-per-category data. Each object holds `xKey` + one numeric field per series (`null` breaks a line/area unless `connectNulls`). */
112
+ data: ReadonlyArray<Record<string, string | number | null>>;
13
113
  /**
14
114
  * Per-series map of `label` / `color`, keyed by `series[].key` (imported from
15
115
  * the shared `Chart` primitives). Turned into `--color-<key>` custom
@@ -17,17 +117,66 @@ export interface ComposedChartProps extends Omit<React.ComponentProps<'div'>, 'c
17
117
  * `--ui-*` token; there is no chart palette tier yet.
18
118
  */
19
119
  config: ChartConfig;
20
- /** Series to plot, each `{ key, type }` — one bar/line/area per entry. Each key must exist in `config` and every data row. */
120
+ /**
121
+ * Series to plot, each `{ key, type }` plus any per-series style override —
122
+ * one bar/line/area per entry. Each key must exist in `config` and every data
123
+ * row. Every styling prop on the chart is the default a series overrides here.
124
+ */
21
125
  series: ComposedSeries[];
22
126
  /** Category axis key (the shared dimension across rows, e.g. `"month"`). */
23
127
  xKey: string;
128
+ /**
129
+ * One or more dashed reference lines — on a value axis (`value` / `average`,
130
+ * placed by the entry's `yAxis`) or across the category axis (`category`).
131
+ * Pass a single object or an array.
132
+ */
133
+ referenceLine?: ComposedChartReferenceLine | ComposedChartReferenceLine[];
134
+ /**
135
+ * One or more shaded bands behind a range of categories — e.g. a forecast
136
+ * period. Pass a single object or an array to draw several.
137
+ */
138
+ referenceArea?: ComposedChartReferenceArea | ComposedChartReferenceArea[];
139
+ /** Unit suffix on the value-axis tick values when it is X (`orientation="horizontal"`). */
140
+ xUnit?: string;
24
141
  /** Interpolation for the line and area series. */
25
- curve?: 'linear' | 'monotone' | 'step';
142
+ curve?: ComposedCurveType;
26
143
  /** Corner radius on the growing end of bar series. */
27
144
  barRadius?: number;
145
+ /** Fixed bar thickness, in px. Unset, recharts sizes bars from the available width. */
146
+ barSize?: number;
147
+ /** Gap between bars of the same category, in px or a percentage string. */
148
+ barGap?: number | string;
149
+ /** Gap between category groups, in px or a percentage string. */
150
+ barCategoryGap?: number | string;
151
+ /** Draw a full-height track behind every bar. */
152
+ showBackground?: boolean;
153
+ /** Fill for the track background. Defaults to the secondary surface. */
154
+ backgroundFill?: string;
155
+ /** Highlight the hovered bar. */
156
+ showActiveBar?: boolean;
28
157
  /** Flat-fill opacity for area series. */
29
158
  fillOpacity?: number;
159
+ /** Stroke width for the line series. Areas keep recharts' thinner outline unless set. */
160
+ strokeWidth?: number;
161
+ /** Render a dot at each point of the line and area series. */
162
+ showDots?: boolean;
163
+ /** Render the hover dot on the line and area series. Unset, recharts' own default applies. */
164
+ showActiveDots?: boolean;
165
+ /** Bridge `null` gaps in the data instead of breaking the line/area. */
166
+ connectNulls?: boolean;
167
+ /** Plot-area inset. Any side left out keeps the chart's own default. */
168
+ margin?: ComposedChartMargin;
169
+ /** Draw the hover cursor (the band/rule under the tooltip). Defaults to `true`. */
170
+ tooltipCursor?: boolean;
30
171
  showLegend?: boolean;
172
+ /** Which edge the legend sits on. Defaults to `bottom`. */
173
+ legendPosition?: 'top' | 'bottom';
174
+ /**
175
+ * Position of the value labels when `showLabels` is on. Defaults to each
176
+ * series' growing end — `top` (or `right` when horizontal), and the centre of
177
+ * a stacked segment, which has no free space at its end.
178
+ */
179
+ labelPosition?: CartesianLabelPosition;
31
180
  }
32
181
  declare const ComposedChart: React.ForwardRefExoticComponent<Omit<ComposedChartProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
33
- export { ComposedChart };
182
+ export { ComposedChart, composedChartVariants };
@@ -1 +1 @@
1
- export { ComposedChart, type ComposedChartProps, type ComposedSeries, type ComposedSeriesType, } from './composed-chart';
1
+ export { ComposedChart, composedChartVariants, type ComposedChartProps, type ComposedChartMargin, type ComposedChartReferenceArea, type ComposedChartReferenceLine, type ComposedCurveType, type ComposedSeries, type ComposedSeriesLegendType, type ComposedSeriesType, } from './composed-chart';