@acronis-platform/ui-react 4.1.0 → 5.1.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 (79) hide show
  1. package/dist/components/ui/area-chart/area-chart.js +191 -85
  2. package/dist/components/ui/area-chart/area-chart.js.map +1 -1
  3. package/dist/components/ui/bar-chart/bar-chart.js +288 -225
  4. package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
  5. package/dist/components/ui/card-widget-carousel/card-widget-carousel.js +85 -0
  6. package/dist/components/ui/card-widget-carousel/card-widget-carousel.js.map +1 -0
  7. package/dist/components/ui/card-widget-carousel/card-widget.js +82 -0
  8. package/dist/components/ui/card-widget-carousel/card-widget.js.map +1 -0
  9. package/dist/components/ui/category-bar/category-bar.js.map +1 -1
  10. package/dist/components/ui/chart/chart-format.js +25 -22
  11. package/dist/components/ui/chart/chart-format.js.map +1 -1
  12. package/dist/components/ui/chart/chart-palette.js +9 -8
  13. package/dist/components/ui/chart/chart-palette.js.map +1 -1
  14. package/dist/components/ui/chart/chart.js +127 -89
  15. package/dist/components/ui/chart/chart.js.map +1 -1
  16. package/dist/components/ui/funnel-chart/funnel-chart.js +189 -113
  17. package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -1
  18. package/dist/components/ui/input-select/input-select.js +18 -9
  19. package/dist/components/ui/input-select/input-select.js.map +1 -1
  20. package/dist/components/ui/line-chart/line-chart.js +194 -86
  21. package/dist/components/ui/line-chart/line-chart.js.map +1 -1
  22. package/dist/components/ui/radar-chart/radar-chart.js +76 -66
  23. package/dist/components/ui/radar-chart/radar-chart.js.map +1 -1
  24. package/dist/components/ui/scatter-chart/scatter-chart.js +5 -2
  25. package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -1
  26. package/dist/components/ui/separator/separator.js +52 -10
  27. package/dist/components/ui/separator/separator.js.map +1 -1
  28. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js +144 -121
  29. package/dist/components/ui/sidebar-secondary/sidebar-secondary.js.map +1 -1
  30. package/dist/components/ui/tree-item/tree-item.js +67 -0
  31. package/dist/components/ui/tree-item/tree-item.js.map +1 -0
  32. package/dist/components/ui/treemap/treemap.js +73 -66
  33. package/dist/components/ui/treemap/treemap.js.map +1 -1
  34. package/dist/index.js +109 -107
  35. package/dist/llms/area-chart.md +2 -1
  36. package/dist/llms/bar-chart.md +132 -33
  37. package/dist/llms/card-widget-carousel.md +252 -0
  38. package/dist/llms/category-bar.md +2 -2
  39. package/dist/llms/funnel-chart.md +269 -101
  40. package/dist/llms/input-select.md +175 -1
  41. package/dist/llms/line-chart.md +2 -1
  42. package/dist/llms/metric.md +10 -5
  43. package/dist/llms/radar-chart.md +15 -5
  44. package/dist/llms/scatter-chart.md +2 -1
  45. package/dist/llms/separator.md +27 -8
  46. package/dist/llms/sidebar-secondary.md +235 -4
  47. package/dist/llms/tree-item.md +359 -0
  48. package/dist/llms/treemap.md +47 -36
  49. package/dist/llms.txt +5 -4
  50. package/dist/react.js +109 -107
  51. package/dist/src/components/ui/area-chart/area-chart.d.ts +10 -0
  52. package/dist/src/components/ui/bar-chart/bar-chart.d.ts +75 -10
  53. package/dist/src/components/ui/bar-chart/bar-chart.docs.d.ts +146 -0
  54. package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
  55. package/dist/src/components/ui/card-widget-carousel/card-widget-carousel.d.ts +9 -0
  56. package/dist/src/components/ui/card-widget-carousel/card-widget.d.ts +43 -0
  57. package/dist/src/components/ui/card-widget-carousel/index.d.ts +2 -0
  58. package/dist/src/components/ui/chart/chart-format.d.ts +9 -1
  59. package/dist/src/components/ui/chart/chart-palette.d.ts +38 -10
  60. package/dist/src/components/ui/chart/chart.d.ts +8 -1
  61. package/dist/src/components/ui/chart/index.d.ts +2 -2
  62. package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +92 -26
  63. package/dist/src/components/ui/funnel-chart/index.d.ts +1 -1
  64. package/dist/src/components/ui/input-select/input-select.d.ts +34 -2
  65. package/dist/src/components/ui/line-chart/line-chart.d.ts +11 -1
  66. package/dist/src/components/ui/radar-chart/radar-chart.d.ts +42 -9
  67. package/dist/src/components/ui/separator/separator.d.ts +9 -1
  68. package/dist/src/components/ui/sidebar-secondary/sidebar-secondary.d.ts +23 -3
  69. package/dist/src/components/ui/tree-item/index.d.ts +1 -0
  70. package/dist/src/components/ui/tree-item/tree-item.d.ts +64 -0
  71. package/dist/src/components/ui/treemap/treemap.d.ts +16 -5
  72. package/dist/src/index.d.ts +2 -1
  73. package/dist/ui-react.css +1 -1
  74. package/package.json +1 -1
  75. package/dist/components/ui/meter/meter.js +0 -79
  76. package/dist/components/ui/meter/meter.js.map +0 -1
  77. package/dist/llms/meter.md +0 -177
  78. package/dist/src/components/ui/meter/index.d.ts +0 -1
  79. package/dist/src/components/ui/meter/meter.d.ts +0 -25
@@ -1,6 +1,6 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  import { BarShapeProps } from 'recharts/types/cartesian/Bar';
3
- import { ChartLegend, ChartTooltip, ChartConfig, ChartPalette, ChartReferenceLine, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartCategoryRange, ChartDataLabelProps, CartesianLabelPosition } from '../chart';
3
+ import { ChartLegend, ChartTooltip, ChartConfig, ChartPalette, ChartStatusTone, ChartReferenceLine, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartCategoryRange, ChartDataLabelProps, CartesianLabelPosition } from '../chart';
4
4
  import * as React from 'react';
5
5
  declare const barChartVariants: (props?: ({
6
6
  orientation?: "horizontal" | "vertical" | null | undefined;
@@ -117,7 +117,14 @@ export declare function createTrackShape({ inRange, trackFill, paint, }: {
117
117
  trackFill: string;
118
118
  paint?: BarPaintOverride;
119
119
  }): ({ background: track, index: row, ...bar }: BarShapeProps) => import("react/jsx-runtime").JSX.Element;
120
- export interface BarChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof barChartVariants>, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartDataLabelProps {
120
+ /**
121
+ * The recharts bar chart: bars rising from a category X axis, with axes, grid,
122
+ * tooltip and legend. This is the default — `orientation` is only spelled out
123
+ * to discriminate it from the horizontal mode below.
124
+ */
125
+ export interface BarChartVerticalProps extends Omit<React.ComponentProps<'div'>, 'children'>, Omit<VariantProps<typeof barChartVariants>, 'orientation'>, CartesianChartProps, ChartAnimationProps, ChartBrushProps, ChartDataLabelProps {
126
+ /** Selects the recharts bar chart. Omit it — this is the default. */
127
+ orientation?: 'vertical';
121
128
  /**
122
129
  * The dataviz palette this chart's series are painted from. Series that
123
130
  * state no `color` of their own take a stop of it. See `ChartPalette`.
@@ -136,9 +143,9 @@ export interface BarChartProps extends Omit<React.ComponentProps<'div'>, 'childr
136
143
  /** Category axis key (the shared dimension across rows, e.g. `"month"`). */
137
144
  xKey: string;
138
145
  /**
139
- * One or more dashed reference/average lines on the value axis (Y for vertical
140
- * bars, X for horizontal). Each is driven by a fixed `value` or a computed
141
- * series `average`. Pass a single object or an array to draw several at once.
146
+ * One or more dashed reference/average lines on the value (Y) axis. Each is
147
+ * driven by a fixed `value` or a computed series `average`. Pass a single
148
+ * object or an array to draw several at once.
142
149
  */
143
150
  referenceLine?: ChartReferenceLine | ChartReferenceLine[];
144
151
  /**
@@ -152,8 +159,6 @@ export interface BarChartProps extends Omit<React.ComponentProps<'div'>, 'childr
152
159
  * normally.
153
160
  */
154
161
  barSettings?: Record<string, BarChartBarSettings>;
155
- /** Unit suffix on X-axis tick values (recharts `unit`) — applies when the X axis is numeric (`orientation="horizontal"`). */
156
- xUnit?: string;
157
162
  /** Corner radius applied to the growing end of each bar. */
158
163
  barRadius?: number;
159
164
  /** How every bar is painted. Per-range overrides come from `barSettings`. */
@@ -187,10 +192,70 @@ export interface BarChartProps extends Omit<React.ComponentProps<'div'>, 'childr
187
192
  };
188
193
  showLegend?: boolean;
189
194
  /**
190
- * Position of the value labels when `showLabels` is on. Defaults to the growing
191
- * end — `top` for vertical bars, `right` for horizontal.
195
+ * Position of the value labels when `showLabels` is on. Defaults to the bar's
196
+ * growing end (`top`), or the segment centre when the layout is stacked.
192
197
  */
193
198
  labelPosition?: CartesianLabelPosition;
194
199
  }
195
- declare const BarChart: React.ForwardRefExoticComponent<Omit<BarChartProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
200
+ /** One row of the horizontal bar list. */
201
+ export interface BarChartItem {
202
+ /** Row label, shown at the start of the row. */
203
+ label: string;
204
+ /** The value this row represents. */
205
+ value: number;
206
+ /**
207
+ * Fill color — any CSS color; prefer an existing `--ui-*` token. Required
208
+ * when no `palette` is passed to the chart. Omit when supplying `tone`
209
+ * together with `palette`.
210
+ */
211
+ color?: string;
212
+ /**
213
+ * Palette tone for this row. Resolved against the `palette` prop on the
214
+ * enclosing `BarChart`; ignored when `palette` is omitted and `color` is set.
215
+ */
216
+ tone?: {
217
+ status: ChartStatusTone;
218
+ };
219
+ /**
220
+ * Projected/forecast total value. When set and greater than `value`, renders
221
+ * a translucent bar (same color, 30% opacity) extending from the actual
222
+ * value's edge to the forecast value. The actual bar renders solid on top.
223
+ * ARIA values always reflect the actual value; `aria-valuetext` also
224
+ * mentions the forecast value. Ignored when `<= value`.
225
+ */
226
+ forecast?: number;
227
+ }
228
+ /**
229
+ * The labelled proportional bar list: one row per `items` entry carrying its
230
+ * label, value, share of `max`, and a track bar. No axes, grid, or recharts.
231
+ */
232
+ export interface BarChartHorizontalProps extends Omit<React.ComponentProps<'div'>, 'children'> {
233
+ /** Selects the labelled bar list. */
234
+ orientation: 'horizontal';
235
+ /** Rows to render — one labelled bar per item. */
236
+ items: BarChartItem[];
237
+ /** Upper bound the values are shares of. Defaults to the sum of every item's value. */
238
+ max?: number;
239
+ /** Format the numeric value in the label. Defaults to `toLocaleString()`. */
240
+ valueFormatter?: (value: number) => string;
241
+ /** Show the hover tooltip per row. On by default. */
242
+ showTooltip?: boolean;
243
+ /** Tooltip content shared by every row (replaces the default). Ignored when `showTooltip` is false. */
244
+ tooltip?: React.ReactNode;
245
+ /**
246
+ * Dataviz palette to resolve each item's color from. When provided, each
247
+ * `items` entry should carry a `tone` (and can omit `color`). The colors are
248
+ * resolved in the same order and with the same tone rules as the vertical
249
+ * chart — `status` tones pick a specific palette stop, slot-less items
250
+ * consume the next available stop.
251
+ */
252
+ palette?: ChartPalette;
253
+ }
254
+ /**
255
+ * Unified BarChart props — `orientation` selects what gets rendered:
256
+ * - omitted / `'vertical'`: the recharts bar chart (axes, grid, legend).
257
+ * - `'horizontal'`: the labelled proportional bar list.
258
+ */
259
+ export type BarChartProps = BarChartVerticalProps | BarChartHorizontalProps;
260
+ declare const BarChart: React.ForwardRefExoticComponent<(Omit<BarChartVerticalProps, "ref"> | Omit<BarChartHorizontalProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
196
261
  export { BarChart, barChartVariants };
@@ -0,0 +1,146 @@
1
+ import type * as React from 'react';
2
+ type BarChartBarShape = 'rounded' | 'pill' | 'gradient' | 'pattern';
3
+ type CartesianLabelPosition = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'insideTop' | 'insideBottom' | 'insideLeft' | 'insideRight' | 'insideStart' | 'insideEnd';
4
+ export interface BarChartItem {
5
+ /** Row label, shown at the start of the row. */
6
+ label: string;
7
+ /** The value this row represents. */
8
+ value: number;
9
+ /** Fill color — any CSS color; prefer an existing `--ui-*` token. Required when no `palette` is passed to the chart. */
10
+ color?: string;
11
+ /** Palette tone for this row. Resolved against the `palette` prop on the enclosing `BarChart`. */
12
+ tone?: {
13
+ status: 'success' | 'warning' | 'danger' | 'info' | 'neutral';
14
+ };
15
+ /** Projected/forecast total. When greater than `value`, renders a translucent bar (30% opacity) extending from `value` to `forecast`. */
16
+ forecast?: number;
17
+ }
18
+ export interface BarChartVerticalProps {
19
+ /** Selects the recharts bar chart. Omit it — this is the default. */
20
+ orientation?: 'vertical';
21
+ /** Row-per-category data. Each object holds the category key + one numeric field per series. */
22
+ data: ReadonlyArray<Record<string, string | number>>;
23
+ /** Per-series map of `label` / `icon` / `tone`. */
24
+ config: Record<string, {
25
+ label: string;
26
+ icon?: React.ComponentType;
27
+ color?: string;
28
+ tone?: string;
29
+ }>;
30
+ /** Series to plot — one `<Bar>` per key. Each must exist in `config` and in every data row. */
31
+ dataKeys: string[];
32
+ /** Category axis key (the shared dimension across rows, e.g. `"month"`). */
33
+ xKey: string;
34
+ /** Dataviz palette for series colors. Series that state no `color` of their own take a stop from it. */
35
+ palette?: string;
36
+ /** `"grouped"` (side-by-side, default) or `"stacked"` (summed into one column). */
37
+ layout?: 'grouped' | 'stacked';
38
+ /** One or more dashed reference/average lines on the value (Y) axis. */
39
+ referenceLine?: object | object[];
40
+ /** One or more shaded bands behind a range of categories. */
41
+ referenceArea?: object | object[];
42
+ /** Per-series style override for a range of categories, keyed by `dataKeys` entry. */
43
+ barSettings?: Record<string, object>;
44
+ /** Corner radius applied to the growing end of each bar. */
45
+ barRadius?: number;
46
+ /** How every bar is painted. Per-range overrides come from `barSettings`. */
47
+ barShape?: BarChartBarShape;
48
+ /** Fixed bar thickness, in px. */
49
+ barSize?: number;
50
+ /** Upper bound on the computed bar thickness, in px. */
51
+ maxBarSize?: number;
52
+ /** Gap between bars of the same category, in px or a percentage string. */
53
+ barGap?: number | string;
54
+ /** Gap between category groups, in px or a percentage string. */
55
+ barCategoryGap?: number | string;
56
+ /** Minimum rendered length for a bar, in px, so a tiny value stays visible. */
57
+ minPointSize?: number;
58
+ /** Draw a full-height track behind every bar. */
59
+ showBackground?: boolean;
60
+ /** Fill for the track background. Defaults to the secondary surface. */
61
+ backgroundFill?: string;
62
+ /** Highlight the hovered bar. */
63
+ showActiveBar?: boolean;
64
+ /** Painting of the hovered bar. */
65
+ activeBar?: {
66
+ fill?: string;
67
+ opacity?: number;
68
+ };
69
+ /** Show the legend. */
70
+ showLegend?: boolean;
71
+ /** Position of the value labels when `showLabels` is on. */
72
+ labelPosition?: CartesianLabelPosition;
73
+ /** Render the CartesianGrid. Defaults to `true`. */
74
+ showGrid?: boolean;
75
+ /** Render the hover tooltip. Defaults to `true`. */
76
+ showTooltip?: boolean;
77
+ /** Replace the default tooltip content. */
78
+ tooltipContent?: React.ReactNode;
79
+ /** Title rendered beneath the X axis. */
80
+ xAxisLabel?: string;
81
+ /** Title rendered beside the Y axis (rotated). */
82
+ yAxisLabel?: string;
83
+ /** Unit suffix appended to the Y axis's tick values. */
84
+ yUnit?: string;
85
+ /** Show the X axis. Defaults to `true`. */
86
+ showXAxis?: boolean;
87
+ /** Show the Y axis. Defaults to `true`. */
88
+ showYAxis?: boolean;
89
+ /** Format each X-axis tick value. */
90
+ xTickFormatter?: (value: string | number, index: number) => string;
91
+ /** Format each Y-axis tick value. */
92
+ yTickFormatter?: (value: string | number, index: number) => string;
93
+ /** Rotate the X-axis tick labels by this many degrees. */
94
+ xAxisAngle?: number;
95
+ /** X-axis tick density. */
96
+ xAxisInterval?: number | 'preserveStart' | 'preserveEnd' | 'preserveStartEnd' | 'equidistantPreserveStart';
97
+ /** Desired number of ticks on the value axis. */
98
+ yAxisTickCount?: number;
99
+ /** Value-axis domain preset. */
100
+ yAxisDomain?: 'auto' | 'dataMin-dataMax' | 'zero';
101
+ /** Draw grid lines dashed instead of solid. Defaults to `true`. */
102
+ gridDashed?: boolean;
103
+ /** Show horizontal grid lines. */
104
+ gridHorizontal?: boolean;
105
+ /** Show vertical grid lines. */
106
+ gridVertical?: boolean;
107
+ /** Enable entrance animation. Defaults to `false`. */
108
+ animate?: boolean;
109
+ /** Animation duration in ms. */
110
+ animationDuration?: number;
111
+ /** Delay before the animation starts, in ms. */
112
+ animationBegin?: number;
113
+ /** Easing curve. */
114
+ animationEasing?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear';
115
+ /** Render a range brush beneath the chart. */
116
+ showBrush?: boolean;
117
+ /** Height of the brush strip in px. Defaults to 28. */
118
+ brushHeight?: number;
119
+ /** Accessible name for the brush's range handles. */
120
+ brushAriaLabel?: string;
121
+ /** Render a value label on each data point. Defaults to `false`. */
122
+ showLabels?: boolean;
123
+ /** Format each label value. */
124
+ labelFormatter?: (value: string | number, index: number) => string;
125
+ /** Additional CSS class names. */
126
+ className?: string;
127
+ }
128
+ export interface BarChartHorizontalProps {
129
+ /** Selects the labelled bar list. */
130
+ orientation: 'horizontal';
131
+ /** Rows to render — one labelled bar per item. */
132
+ items: BarChartItem[];
133
+ /** Upper bound the values are shares of. Defaults to the sum of every item's value. */
134
+ max?: number;
135
+ /** Format the numeric value in the label. Defaults to `toLocaleString()`. */
136
+ valueFormatter?: (value: number) => string;
137
+ /** Show the hover tooltip per row. On by default. */
138
+ showTooltip?: boolean;
139
+ /** Tooltip content shared by every row (replaces the default). */
140
+ tooltip?: React.ReactNode;
141
+ /** Dataviz palette to resolve each item's color from. Items should carry a `tone` when a palette is set. */
142
+ palette?: string;
143
+ /** Additional CSS class names. */
144
+ className?: string;
145
+ }
146
+ export {};
@@ -1 +1 @@
1
- export { BarChart, barChartVariants, type BarChartProps, type BarChartReferenceArea, type BarChartBarSettings, type BarChartBarShape, } from './bar-chart';
1
+ export { BarChart, barChartVariants, type BarChartProps, type BarChartVerticalProps, type BarChartHorizontalProps, type BarChartItem, type BarChartReferenceArea, type BarChartBarSettings, type BarChartBarShape, } from './bar-chart';
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ export interface CardWidgetCarouselProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** Accessible label for the Next chevron button. Defaults to `'Next'`. */
4
+ nextLabel?: string;
5
+ /** Accessible label for the Previous chevron button. Defaults to `'Previous'`. */
6
+ prevLabel?: string;
7
+ }
8
+ declare const CardWidgetCarousel: React.ForwardRefExoticComponent<CardWidgetCarouselProps & React.RefAttributes<HTMLDivElement>>;
9
+ export { CardWidgetCarousel };
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ declare const statusBgToken: {
3
+ readonly danger: "var(--ui-background-status-danger)";
4
+ readonly warning: "var(--ui-background-status-warning)";
5
+ readonly info: "var(--ui-background-status-info)";
6
+ };
7
+ export type CardWidgetStatus = keyof typeof statusBgToken;
8
+ export interface CardWidgetProps extends React.HTMLAttributes<HTMLDivElement> {
9
+ /** Semantic status — drives the icon-box background and icon glyph color. */
10
+ status?: CardWidgetStatus;
11
+ /** The 16 px icon placed inside the status-colored icon box. */
12
+ icon?: React.ReactNode;
13
+ /** Card header title (the widget/category name, e.g. "Phishing attacks"). */
14
+ header?: string;
15
+ /** Insight title in the body (14 px, semibold). Hidden while `skeleton` is true. */
16
+ title?: string;
17
+ /** Supporting description (12 px). Hidden while `skeleton` is true. */
18
+ description?: string;
19
+ /**
20
+ * Primary value / metric (24 px, semibold). Accepts a string or any node.
21
+ * Hidden while `skeleton` is true.
22
+ */
23
+ metric?: React.ReactNode;
24
+ /** Small caption beside the metric (12 px). Hidden while `skeleton` is true. */
25
+ caption?: string;
26
+ /**
27
+ * When true the body shows animated placeholder lines instead of
28
+ * `title` / `description` / `metric` / `caption`.
29
+ */
30
+ skeleton?: boolean;
31
+ /**
32
+ * Accessible label for the skeleton loading indicator (`aria-label`).
33
+ * Defaults to `'Loading'`. Localize when deploying in a non-English context.
34
+ */
35
+ loadingLabel?: string;
36
+ /**
37
+ * Content rendered in the card footer (action buttons). Omit the prop to
38
+ * hide the footer entirely.
39
+ */
40
+ footer?: React.ReactNode;
41
+ }
42
+ declare const CardWidget: React.ForwardRefExoticComponent<CardWidgetProps & React.RefAttributes<HTMLDivElement>>;
43
+ export { CardWidget };
@@ -0,0 +1,2 @@
1
+ export { CardWidgetCarousel, type CardWidgetCarouselProps } from './card-widget-carousel';
2
+ export { CardWidget, type CardWidgetProps, type CardWidgetStatus } from './card-widget';
@@ -26,7 +26,7 @@ export interface CartesianChartProps {
26
26
  yAxisLabel?: string;
27
27
  /**
28
28
  * Unit suffix appended to the Y axis's tick values (recharts `unit`) — applies
29
- * when the Y axis is the numeric one. `BarChart` with
29
+ * when the Y axis is the numeric one. `ComposedChart` with
30
30
  * `orientation="horizontal"` puts the values on X instead; use `xUnit` there.
31
31
  */
32
32
  yUnit?: string;
@@ -263,6 +263,14 @@ export interface ResolvedAnimation {
263
263
  * library has no other reduced-motion escape hatch.
264
264
  */
265
265
  export declare function resolveAnimation(props: ChartAnimationProps): ResolvedAnimation;
266
+ /**
267
+ * Remove synthetic `_proj_*` series entries from a recharts payload array so
268
+ * they don't appear in custom tooltip or legend content. Safe to call with
269
+ * `undefined` — returns `undefined` unchanged.
270
+ */
271
+ export declare function dropProjectionPayload<T extends {
272
+ dataKey?: unknown;
273
+ }>(payload: readonly T[] | undefined): T[] | undefined;
266
274
  /** Where a data label sits on a cartesian series (recharts `LabelList` position). */
267
275
  export type CartesianLabelPosition = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'insideTop' | 'insideBottom' | 'insideLeft' | 'insideRight' | 'insideStart' | 'insideEnd';
268
276
  /**
@@ -10,6 +10,8 @@ export type ChartDivergingPair = 'blue-orange' | 'teal-violet';
10
10
  * tier, not a typo here.
11
11
  */
12
12
  export type ChartStatusTone = 'danger' | 'critical' | 'warning' | 'success' | 'info' | 'neutral';
13
+ /** Which hue side of a diverging pair a series belongs to. */
14
+ export type ChartDivergingSide = 'a' | 'b';
13
15
  /** Which palette a chart's series are painted from. */
14
16
  export type ChartPalette = {
15
17
  type: 'categorical';
@@ -25,29 +27,40 @@ export type ChartPalette = {
25
27
  /**
26
28
  * How one series picks its color out of the active palette.
27
29
  *
28
- * Only the two palettes whose colors are independent of each other accept an
29
- * override:
30
+ * Three palettes accept a per-series override:
30
31
  *
31
32
  * - `categorical` — `{ slot }` picks one of the 16 hues.
32
- * - `status` — `{ status }` names a tone.
33
+ * - `status` — `{ status }` names a tone (required; there is no meaningful
34
+ * positional fallback for status colors).
35
+ * - `diverging` — `{ side: 'a' | 'b' }` pins the series to one hue family.
36
+ * All side-`a` series walk the a-hue stops (a3 → a2 → a1, strongest-first,
37
+ * wrapping past three). All side-`b` series walk the b-hue stops likewise.
38
+ * Un-sided series walk the default interleaved ramp (a3-b3-a2-b2-a1-b1),
39
+ * skipping any stop already claimed by a sided series. This assignment
40
+ * requires the full config, so it happens in `resolveChartColors`, not here.
33
41
  *
34
- * `sequential` and `diverging` accept none. Their stops are a *ramp*: the
35
- * colors mean something only in relation to each other, so letting one series
36
- * jump to an arbitrary stop would break the reading order the ramp exists to
37
- * convey. The product's widget editor agrees — it offers a ramp/pair picker
38
- * and no per-series control. An override passed under those palettes is
42
+ * `sequential` accepts no override: its stops are a ramp, meaningful only in
43
+ * relation to each other. An override passed under a non-matching palette is
39
44
  * ignored, with a dev warning.
40
45
  *
41
- * Neither form can express a color from outside the palette — that is the point.
46
+ * `{ sameAs: key }` is palette-agnostic: the series mirrors whatever color
47
+ * another series resolves to. Use it for a twin series that is the *same*
48
+ * metric drawn differently (a forecast tail, a projection band), where two
49
+ * distinct hues would read as two separate metrics. An aliased series doesn't
50
+ * consume a stop.
51
+ *
52
+ * No form can express a color from outside the active palette — that is the point.
42
53
  */
43
54
  export type ChartSeriesTone = {
44
55
  slot: number;
45
56
  status?: never;
46
57
  sameAs?: never;
58
+ side?: never;
47
59
  } | {
48
60
  slot?: never;
49
61
  status: ChartStatusTone;
50
62
  sameAs?: never;
63
+ side?: never;
51
64
  }
52
65
  /**
53
66
  * Paint whatever the series under this key paints, under any palette. For a
@@ -60,10 +73,25 @@ export type ChartSeriesTone = {
60
73
  slot?: never;
61
74
  status?: never;
62
75
  sameAs: string;
76
+ side?: never;
77
+ }
78
+ /**
79
+ * Diverging palette only. Pins this series to one of the two hue sides.
80
+ * `resolveChartColors` groups all series that share a side together and
81
+ * assigns them that side's three stops (strongest first, wrapping). Series
82
+ * that declare no side walk the default interleaved ramp.
83
+ *
84
+ * Under any palette other than `diverging`, this is ignored with a dev warning.
85
+ */
86
+ | {
87
+ slot?: never;
88
+ status?: never;
89
+ sameAs?: never;
90
+ side: ChartDivergingSide;
63
91
  };
64
92
  /** The 16 categorical hues, in the order the product's picker lists them. */
65
93
  export declare const CHART_CATEGORICAL_TOKENS: readonly string[];
66
- /** Each sequential ramp's eight stops, lightest (1) to darkest (8). */
94
+ /** Each sequential ramp's eight stops, darkest (8) to lightest (1). */
67
95
  export declare const CHART_SEQUENTIAL_TOKENS: Readonly<Record<ChartSequentialRamp, readonly string[]>>;
68
96
  /** Each diverging pair's six stops, one hue's strongest through to the other's. */
69
97
  export declare const CHART_DIVERGING_TOKENS: Readonly<Record<ChartDivergingPair, readonly string[]>>;
@@ -80,6 +80,13 @@ export type ChartLegendContentProps = {
80
80
  * stringified with `String()`.
81
81
  */
82
82
  valueFormatter?: (value: string | number) => string;
83
+ /**
84
+ * Extra Tailwind class(es) applied to the right-hand value in a list entry,
85
+ * merged on top of the default colour (`text-[var(--ui-text-on-surface-link-idle)]`).
86
+ * Pass a replacement colour class to override the default; other utilities
87
+ * (e.g. `tabular-nums`) are additive and leave the default colour in place.
88
+ */
89
+ valueClassName?: string;
83
90
  };
84
91
  export interface ChartContainerProps extends React.ComponentProps<'div'> {
85
92
  /**
@@ -110,5 +117,5 @@ declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
110
117
  export type ChartTooltipContentType = React.ComponentProps<typeof ChartTooltip>['content'];
111
118
  declare function ChartTooltipContent({ active, payload, label, className, hideLabel, hideIndicator, labelFormatter, formatter, labelClassName, color, nameKey, labelKey, }: ChartTooltipContentProps): import("react/jsx-runtime").JSX.Element | null;
112
119
  declare const ChartLegend: React.MemoExoticComponent<(outsideProps: RechartsPrimitive.LegendProps) => React.ReactPortal | null>;
113
- declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, config: configFromProps, variant, valueKey, valueFormatter, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
120
+ declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, config: configFromProps, variant, valueKey, valueFormatter, valueClassName, }: ChartLegendContentProps): import("react/jsx-runtime").JSX.Element | null;
114
121
  export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, };
@@ -1,6 +1,6 @@
1
1
  export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, resolveChartColors, } from './chart';
2
2
  export type { ChartConfig, ResolvedChartConfig, ChartContainerProps, ChartTooltipContentProps, ChartLegendContentProps, ChartTooltipContentType, } from './chart';
3
3
  export { CHART_CATEGORICAL_TOKENS, CHART_SEQUENTIAL_TOKENS, CHART_DIVERGING_TOKENS, CHART_STATUS_TOKENS, CHART_DEFAULT_PALETTE, listPaletteStops, listPaletteChoices, resolveSeriesColor, findDuplicateTones, } from './chart-palette';
4
- export type { ChartPalette, ChartSeriesTone, ChartSequentialRamp, ChartDivergingPair, ChartStatusTone, ResolveSeriesColorOptions, } from './chart-palette';
5
- 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 { ChartPalette, ChartSeriesTone, ChartSequentialRamp, ChartDivergingPair, ChartDivergingSide, ChartStatusTone, ResolveSeriesColorOptions, } from './chart-palette';
5
+ 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, dropProjectionPayload, } from './chart-format';
6
6
  export type { TickFormatter, ChartCurveType, ChartReferenceLine, ChartReferenceLabelPosition, CartesianChartProps, ChartCategoryRange, ChartYAxisTarget, SecondaryYAxisProps, ChartAnimationProps, ChartAnimationEasing, ResolvedAnimation, ChartDataLabelProps, CartesianLabelPosition, PolarLabelPosition, ChartLabelPosition, ChartBrushProps, ResolvedBrush, } from './chart-format';
@@ -8,13 +8,12 @@ declare const funnelChartVariants: (props?: ({
8
8
  export type FunnelChartLabelPosition = 'right' | 'left' | 'inside';
9
9
  /** What a stage's label says. */
10
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
11
  /** Override for a single stage, keyed by its `nameKey` value. */
14
12
  export interface FunnelChartStageSettings {
15
13
  /**
16
- * Paint this stage with a colour of its own, overriding both `config` and
17
- * `colorMode`. Reference an existing semantic `--ui-*` token.
14
+ * Paint this stage with a colour of its own instead of its `palette` stop —
15
+ * the same per-item escape hatch `PieChart`'s `sliceSettings` offers.
16
+ * Reference an existing semantic `--ui-*` token.
18
17
  */
19
18
  color?: string;
20
19
  /**
@@ -33,6 +32,75 @@ export interface FunnelChartStageSettings {
33
32
  * name with its own value.
34
33
  */
35
34
  export declare function funnelChartOppositeSide(labelPosition: FunnelChartLabelPosition): FunnelChartLabelPosition;
35
+ /**
36
+ * The palette Figma paints the funnel from: the sequential blue ramp, whose
37
+ * stops read as one quantity falling down the funnel. Every other chart keeps
38
+ * the shared categorical default — a funnel's stages are an *ordered* series,
39
+ * which is what a sequential ramp is for.
40
+ *
41
+ * Figma `8811:175245` uses `dataviz/sequential/blue/{2,4,6,8}`.
42
+ */
43
+ export declare const FUNNEL_CHART_DEFAULT_PALETTE: ChartPalette;
44
+ /**
45
+ * The `d` for one funnel stage — recharts' trapezoid geometry with the design's
46
+ * rounded corners.
47
+ *
48
+ * `x`/`y` is the top-left of the *upper* edge and the shape is centred on
49
+ * `x + upperWidth / 2`, matching recharts' own `getTrapezoidPath`.
50
+ *
51
+ * Either edge can collapse to a single rounded apex rather than a zero-length
52
+ * one — the `triangle` last shape narrows to a point at the bottom, and a
53
+ * `reversed` funnel stands that same triangle on its head at the top.
54
+ */
55
+ export declare function funnelChartStagePath(options: {
56
+ x: number;
57
+ y: number;
58
+ upperWidth: number;
59
+ lowerWidth: number;
60
+ height: number;
61
+ /**
62
+ * Uniform corner radius — applies to all four corners. Overridden per-side
63
+ * by `topRadius` / `bottomRadius`. When absent, defaults to
64
+ * `STAGE_RADIUS` (top) and `STAGE_BOTTOM_RADIUS` (bottom).
65
+ */
66
+ radius?: number;
67
+ /** Radius for the two upper corners (default: `STAGE_RADIUS = 2`). */
68
+ topRadius?: number;
69
+ /**
70
+ * Radius for the two lower corners (default: `STAGE_BOTTOM_RADIUS = 1`).
71
+ *
72
+ * Figma's bottom corners clip ~0.85px — much smaller than the upper ones —
73
+ * so the default is intentionally lower than `topRadius`.
74
+ */
75
+ bottomRadius?: number;
76
+ }): string;
77
+ /**
78
+ * Pull a stage's **top** edge down by `gap`, so surface shows between it and the
79
+ * stage above.
80
+ *
81
+ * The top rather than the bottom on purpose: the bottom edge is what
82
+ * `lastShapeType` defines — the triangle's apex — so leaving it exactly where
83
+ * recharts put it keeps a `triangle` funnel ending in a real point instead of a
84
+ * blunt 2px edge. The upper edge slides down the funnel's own slope, so the
85
+ * taper is unchanged rather than steepened.
86
+ *
87
+ * A stage with no room for the gap is returned untouched: better a missing gap
88
+ * than an inverted shape.
89
+ */
90
+ export declare function funnelChartStageInset(options: {
91
+ x: number;
92
+ y: number;
93
+ upperWidth: number;
94
+ lowerWidth: number;
95
+ height: number;
96
+ gap: number;
97
+ }): {
98
+ x: number;
99
+ y: number;
100
+ upperWidth: number;
101
+ lowerWidth: number;
102
+ height: number;
103
+ };
36
104
  /**
37
105
  * Reserve room for a composite label beside the funnel, by narrowing the
38
106
  * **funnel** rather than the plot area.
@@ -70,11 +138,15 @@ export declare function funnelChartLabelReserve(options: {
70
138
  labelFormat: FunnelChartLabelFormat;
71
139
  }): string | undefined;
72
140
  /**
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.
141
+ * The plot-area margin.
142
+ *
143
+ * With nothing beside the funnel — the default, and what Figma draws — the plot
144
+ * is the design's own inset (`PLOT_MARGIN`): just the few px the rounded corners
145
+ * and the apex need, so the funnel fills its 120px square instead of being
146
+ * squeezed into the middle by label room it isn't using.
76
147
  *
77
- * This is overflow protection, not label room — the wrap width comes from
148
+ * As soon as a label list *does* sit beside the funnel, the side insets come
149
+ * back: this is overflow protection, not label room — the wrap width comes from
78
150
  * `funnelChartLabelReserve`. A caller-supplied `margin` is merged over these
79
151
  * defaults per side, so `margin={{ right: 160 }}` keeps the default top, bottom
80
152
  * and left rather than collapsing them to zero.
@@ -85,10 +157,10 @@ export declare function funnelChartLabelMargin(options: {
85
157
  showValueLabels: boolean;
86
158
  valuePosition: FunnelChartLabelPosition;
87
159
  }): {
88
- left: number;
89
160
  top: number;
90
161
  right: number;
91
162
  bottom: number;
163
+ left: number;
92
164
  };
93
165
  /**
94
166
  * Format a conversion share the way the default `percent` label reads it:
@@ -121,8 +193,12 @@ export declare function funnelChartLabelText(options: {
121
193
  }): string;
122
194
  export interface FunnelChartProps extends Omit<React.ComponentProps<'div'>, 'children'>, VariantProps<typeof funnelChartVariants>, ChartAnimationProps {
123
195
  /**
124
- * The dataviz palette this chart's series are painted from. Series that
125
- * state no `color` of their own take a stop of it. See `ChartPalette`.
196
+ * The dataviz palette the stages are painted from — the only source of a
197
+ * stage's colour, bar a per-stage `stageSettings.color`. Defaults to
198
+ * `FUNNEL_CHART_DEFAULT_PALETTE` (the sequential blue ramp), which is what
199
+ * Figma paints the funnel with; a funnel's stages are an ordered series, so a
200
+ * ramp reads them better than the shared categorical default.
201
+ * See `ChartPalette`.
126
202
  */
127
203
  palette?: ChartPalette;
128
204
  /** Row-per-stage data. Each object holds the stage's `nameKey` label + its `dataKey` numeric value. */
@@ -186,23 +262,13 @@ export interface FunnelChartProps extends Omit<React.ComponentProps<'div'>, 'chi
186
262
  * for a locale that doesn't write a bare `%`.
187
263
  */
188
264
  percentFormatter?: TickFormatter;
189
- /** Render the legend. Off by default: a funnel labels its stages on the chart. */
190
- showLegend?: boolean;
191
- /** Which edge the legend sits on. */
192
- legendPos?: 'top' | 'bottom';
193
265
  /**
194
- * How the stages are coloured. `palette` (the default) gives each stage its own
195
- * `config` colour; `gradient` ramps one hue — `gradientColor` — from the widest
196
- * stage down to the narrowest.
266
+ * Render the stage list beside the funnel. On by default: the design's funnel
267
+ * carries no on-plot labels, so the legend is where the stages are named.
197
268
  */
198
- colorMode?: FunnelChartColorMode;
199
- /**
200
- * The hue `colorMode="gradient"` ramps. Defaults to the first visible stage's
201
- * own colour — including a `stageSettings` colour set on it — so a palette
202
- * config becomes a ramp without a second colour decision. Ignored when
203
- * `colorMode` is `palette`.
204
- */
205
- gradientColor?: string;
269
+ showLegend?: boolean;
270
+ /** Format the value in each legend row — the stage's `dataKey` number. */
271
+ legendValueFormatter?: (value: string | number) => string;
206
272
  /** Per-stage `color` / `hidden` overrides, keyed by the stage's `nameKey` value. */
207
273
  stageSettings?: Record<string, FunnelChartStageSettings>;
208
274
  /** Outline the hovered segment. */
@@ -1 +1 @@
1
- export { FunnelChart, funnelChartVariants, funnelChartPercent, type FunnelChartProps, type FunnelChartColorMode, type FunnelChartLabelFormat, type FunnelChartLabelPosition, type FunnelChartStageSettings, } from './funnel-chart';
1
+ export { FunnelChart, funnelChartVariants, funnelChartPercent, FUNNEL_CHART_DEFAULT_PALETTE, type FunnelChartProps, type FunnelChartLabelFormat, type FunnelChartLabelPosition, type FunnelChartStageSettings, } from './funnel-chart';