@automattic/charts 4.13.0 → 4.15.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 (56) hide show
  1. package/CHANGELOG.md +34 -29
  2. package/TOKENS.md +4 -1
  3. package/dist/index.cjs +1069 -1620
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +33 -1
  6. package/dist/index.d.cts +60 -15
  7. package/dist/index.d.ts +60 -15
  8. package/dist/index.js +1072 -1575
  9. package/dist/index.js.map +1 -1
  10. package/package.json +11 -10
  11. package/src/charts/area-chart/area-chart.tsx +29 -20
  12. package/src/charts/area-chart/types.ts +3 -1
  13. package/src/charts/bar-chart/bar-chart.module.scss +38 -0
  14. package/src/charts/bar-chart/bar-chart.tsx +159 -56
  15. package/src/charts/bar-chart/private/band-tooltip.tsx +40 -5
  16. package/src/charts/bar-chart/private/bar-layer.tsx +66 -13
  17. package/src/charts/bar-chart/private/category.ts +25 -0
  18. package/src/charts/bar-chart/private/comparison-bars-geometry.ts +13 -1
  19. package/src/charts/bar-chart/private/index.ts +3 -1
  20. package/src/charts/bar-chart/private/selected-bar-ring.tsx +17 -6
  21. package/src/charts/bar-chart/private/stack-layout.ts +99 -0
  22. package/src/charts/bar-chart/private/stacked-bar-series.tsx +145 -0
  23. package/src/charts/bar-chart/private/test/stack-layout.test.ts +81 -0
  24. package/src/charts/bar-chart/private/test/value-domain.test.ts +10 -0
  25. package/src/charts/bar-chart/private/use-bar-chart-options.ts +35 -11
  26. package/src/charts/bar-chart/private/{use-overlap-slots.ts → use-bar-slots.ts} +36 -38
  27. package/src/charts/bar-chart/private/use-bar-stops.ts +19 -19
  28. package/src/charts/bar-chart/private/value-domain.ts +10 -8
  29. package/src/charts/bar-chart/test/bar-chart-stacked.test.tsx +546 -0
  30. package/src/charts/bar-chart/test/bar-chart.test.tsx +75 -0
  31. package/src/charts/bar-chart/test/use-bar-legend-items.test.tsx +18 -0
  32. package/src/charts/bar-chart/types.ts +3 -1
  33. package/src/charts/bar-chart/use-bar-colors.ts +12 -0
  34. package/src/charts/bar-chart/use-bar-legend-items.ts +4 -2
  35. package/src/charts/bar-list-chart/bar-list-chart.tsx +2 -0
  36. package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +1 -1
  37. package/src/charts/leaderboard-chart/leaderboard-chart.tsx +26 -9
  38. package/src/charts/leaderboard-chart/private/resolve-leaderboard-entries.ts +53 -0
  39. package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +41 -0
  40. package/src/charts/leaderboard-chart/test/resolve-leaderboard-entries.test.ts +146 -0
  41. package/src/charts/leaderboard-chart/types.ts +6 -0
  42. package/src/charts/line-chart/line-chart.tsx +55 -26
  43. package/src/charts/line-chart/test/line-chart.test.tsx +86 -0
  44. package/src/charts/line-chart/types.ts +3 -1
  45. package/src/charts/private/test/compact-when-short.test.tsx +170 -0
  46. package/src/charts/private/test/tick-decimals.test.tsx +95 -0
  47. package/src/charts/private/tick-decimals.tsx +132 -0
  48. package/src/charts/private/use-compact-when-short.ts +18 -0
  49. package/src/components/legend/private/base-legend.tsx +13 -8
  50. package/src/components/legend/test/legend.test.tsx +125 -0
  51. package/src/components/legend/types.ts +9 -1
  52. package/src/providers/chart-context/themes.ts +4 -0
  53. package/src/styles/chart-scope.scss +1 -0
  54. package/src/types.ts +40 -9
  55. package/src/charts/private/test/whole-number-ticks.test.tsx +0 -57
  56. package/src/charts/private/whole-number-ticks.tsx +0 -79
package/dist/index.css CHANGED
@@ -37,6 +37,7 @@
37
37
  --a8c-charts-border-radius-leaderboard-bar: 9999px;
38
38
  --a8c-charts-dimension-leaderboard-row-gap: var(--wpds-dimension-gap-md, 12px);
39
39
  --a8c-charts-dimension-leaderboard-column-gap: var(--wpds-dimension-gap-xs, 4px);
40
+ --a8c-charts-dimension-leaderboard-label-inset: var(--wpds-dimension-padding-sm, 8px);
40
41
  --a8c-charts-dimension-legend-column-gap: var(--wpds-dimension-gap-lg, 16px);
41
42
  --a8c-charts-dimension-legend-row-gap: var(--wpds-dimension-gap-sm, 8px);
42
43
  }
@@ -348,6 +349,37 @@
348
349
  transform: scaleX(1);
349
350
  }
350
351
  }
352
+
353
+ .a8ccharts-97yN9W-bar-chart--stacked .visx-bar-group rect {
354
+ rx: 0;
355
+ animation: none;
356
+ }
357
+
358
+ .a8ccharts-97yN9W-bar-chart--stacked .visx-bar-group rect[data-stack-end="top"] {
359
+ clip-path: inset(0 round var(--a8c-charts-border-radius-bar-chart) var(--a8c-charts-border-radius-bar-chart) 0 0);
360
+ }
361
+
362
+ .a8ccharts-97yN9W-bar-chart--stacked .visx-bar-group rect[data-stack-end="right"] {
363
+ clip-path: inset(0 round 0 var(--a8c-charts-border-radius-bar-chart) var(--a8c-charts-border-radius-bar-chart) 0);
364
+ }
365
+
366
+ .a8ccharts-97yN9W-bar-chart--stacked .visx-bar-group rect[data-stack-end="bottom"] {
367
+ clip-path: inset(0 round 0 0 var(--a8c-charts-border-radius-bar-chart) var(--a8c-charts-border-radius-bar-chart));
368
+ }
369
+
370
+ .a8ccharts-97yN9W-bar-chart--stacked .visx-bar-group rect[data-stack-end="left"] {
371
+ clip-path: inset(0 round var(--a8c-charts-border-radius-bar-chart) 0 0 var(--a8c-charts-border-radius-bar-chart));
372
+ }
373
+
374
+ .a8ccharts-97yN9W-bar-chart--stacked.a8ccharts-97yN9W-bar-chart--animated .visx-bar-group {
375
+ transform-box: view-box;
376
+ animation: a8ccharts-97yN9W-rise var(--a8c-charts-motion-duration-entrance) var(--a8c-charts-motion-easing-entrance) both;
377
+ }
378
+
379
+ .a8ccharts-97yN9W-bar-chart--stacked.a8ccharts-97yN9W-bar-chart--animated-horizontal .visx-bar-group {
380
+ transform-box: view-box;
381
+ animation: a8ccharts-97yN9W-stretch var(--a8c-charts-motion-duration-entrance) var(--a8c-charts-motion-easing-entrance) both;
382
+ }
351
383
  .a8ccharts-gx1_AW-selected-ring__far, .a8ccharts-gx1_AW-selected-ring__edge {
352
384
  fill: none;
353
385
  }
@@ -762,7 +794,7 @@
762
794
  }
763
795
 
764
796
  .a8ccharts-GovfoW-barWithLabelContainer.a8ccharts-GovfoW-is-overlay .a8ccharts-GovfoW-label {
765
- padding-left: var(--wpds-dimension-padding-sm, 8px);
797
+ padding-inline-start: var(--a8c-charts-dimension-leaderboard-label-inset);
766
798
  }
767
799
 
768
800
  .a8ccharts-GovfoW-barWithLabelContainer.a8ccharts-GovfoW-is-overlay .a8ccharts-GovfoW-barTrack {
package/dist/index.d.cts CHANGED
@@ -163,18 +163,16 @@ type LeaderboardEntryFields = {
163
163
  */
164
164
  previousValue?: number;
165
165
  /**
166
- * Width of current bar, as % of the largest absolute value across rows. A negative share
167
- * extends the bar from a shared zero point toward the inline start, for every row.
166
+ * Width of current bar, as %. Derived from the values when omitted; a passed value wins.
167
+ * A negative share extends the bar from a shared zero point toward the inline start, for every row.
168
168
  */
169
- currentShare: number;
169
+ currentShare?: number;
170
170
  /**
171
- * Width of previous bar, as % of the largest absolute value across rows. Omit when this
172
- * row has no matching comparison-period value.
171
+ * Width of previous bar, as %. Derived from `previousValue` when omitted; a passed value wins.
173
172
  */
174
173
  previousShare?: number;
175
174
  /**
176
- * Delta of the entry. Omit when the percentage change is unavailable, such
177
- * as when the row has no comparison value or its previous value is zero.
175
+ * Percentage change. Derived from the values when omitted; a passed value wins.
178
176
  */
179
177
  delta?: number;
180
178
  /**
@@ -255,9 +253,9 @@ type BarStyles = {
255
253
  opacity?: number;
256
254
  };
257
255
  /**
258
- * How a bar chart places its series in a category. `grouped` puts each primary series in a slot of its own; `overlap` puts every primary in one slot and every comparison in a second, and overlaps the `group`s within each slot.
256
+ * How a bar chart places its series in a category. `grouped` puts each primary series in a slot of its own; `overlap` puts every primary in one slot and every comparison in a second, and overlaps the `group`s within each slot; `stacked` stacks every primary in one bar, the first series at the bottom.
259
257
  */
260
- type BarChartLayout = 'grouped' | 'overlap';
258
+ type BarChartLayout = 'grouped' | 'overlap' | 'stacked';
261
259
  type MultipleDataPointsDate = {
262
260
  label: string;
263
261
  data: DataPointDate[];
@@ -369,6 +367,18 @@ type ChartTheme = {
369
367
  /** Stroke width for the sparkline line */
370
368
  strokeWidth?: number;
371
369
  };
370
+ /** Compact mode for `compactWhenShort` line, area and bar charts */
371
+ compactWhenShort?: {
372
+ /** Height (px) below which the chart turns compact */
373
+ below?: number;
374
+ /** Margin the chart defaults to while compact */
375
+ margin?: {
376
+ top?: number;
377
+ right?: number;
378
+ bottom?: number;
379
+ left?: number;
380
+ };
381
+ };
372
382
  /**
373
383
  * HeatmapChart settings. Cell gap, radius, value size and the selection ring come from
374
384
  * WPDS tokens in CSS, so only the compact sizing lives here.
@@ -398,6 +408,9 @@ type CompleteChartTheme = Required<ChartTheme> & {
398
408
  sparkline: Required<NonNullable<ChartTheme['sparkline']>> & {
399
409
  margin: Required<NonNullable<ChartTheme['sparkline']>['margin']>;
400
410
  };
411
+ compactWhenShort: Required<NonNullable<ChartTheme['compactWhenShort']>> & {
412
+ margin: Required<NonNullable<ChartTheme['compactWhenShort']>['margin']>;
413
+ };
401
414
  heatmapChart: Required<NonNullable<ChartTheme['heatmapChart']>>;
402
415
  };
403
416
  /**
@@ -447,6 +460,12 @@ type AxisOptions = {
447
460
  * so callers can force a specific axis (e.g. integer-only steps on a sparse chart).
448
461
  */
449
462
  tickValues?: ScaleInput<AxisScale>[];
463
+ /**
464
+ * Most decimal places a value-axis tick may carry, so labels rounded to that precision never repeat;
465
+ * an axis holding fewer than two steps widens to the nearest ones. Whole-number data always uses 0.
466
+ * Ignored on a log scale, or when `tickValues` or the value scale's `domain` is set. Line and bar charts only.
467
+ */
468
+ tickDecimals?: number;
450
469
  axisClassName?: string;
451
470
  axisLineClassName?: string;
452
471
  labelClassName?: string;
@@ -626,6 +645,17 @@ interface SeriesVisibilityProps {
626
645
  */
627
646
  defaultHiddenSeries?: readonly string[];
628
647
  }
648
+ /**
649
+ * Compact mode for cartesian charts placed in short containers.
650
+ */
651
+ interface CompactWhenShortProps {
652
+ /**
653
+ * Drop the axes, grid and legend, and default to `theme.compactWhenShort.margin`, while the
654
+ * chart is shorter than `theme.compactWhenShort.below`. Series hidden through the legend stay
655
+ * hidden until the chart is tall again. Horizontal bar charts ignore it.
656
+ */
657
+ compactWhenShort?: boolean;
658
+ }
629
659
  /**
630
660
  * Base properties shared across all chart components
631
661
  */
@@ -785,7 +815,15 @@ type BaseLegendItem = {
785
815
  interactive?: boolean;
786
816
  /** Label of the series this static item describes; the item is left out while it is hidden. */
787
817
  describesSeries?: string;
788
- };
818
+ } & ({
819
+ /** Pressed state of the toggle. */
820
+ pressed: boolean;
821
+ /** Makes an interactive legend item a toggle the consumer controls, instead of a series toggle. */
822
+ onToggle: () => void;
823
+ } | {
824
+ pressed?: never;
825
+ onToggle?: never;
826
+ });
789
827
  export declare const Legend: import("react").ForwardRefExoticComponent<Omit<BaseLegendProps, "items"> & {
790
828
  items?: BaseLegendItem[];
791
829
  chartId?: string;
@@ -925,7 +963,7 @@ type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
925
963
  glyphStyle?: SVGProps<SVGCircleElement>;
926
964
  position?: 'start' | 'end';
927
965
  };
928
- interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
966
+ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps, CompactWhenShortProps {
929
967
  /**
930
968
  * Legend configuration. Supports `collapseGroups` on top of the shared options.
931
969
  */
@@ -978,7 +1016,7 @@ type TooltipDatum = {
978
1016
  /** The series' reading, or null when the bucket has none. */
979
1017
  value: number | null;
980
1018
  };
981
- interface AreaChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
1019
+ interface AreaChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps, CompactWhenShortProps {
982
1020
  /**
983
1021
  * Legend configuration. Supports `collapseGroups` on top of the shared options.
984
1022
  */
@@ -1081,7 +1119,7 @@ type BandHighlightSelection = {
1081
1119
  width: number;
1082
1120
  height: number;
1083
1121
  };
1084
- interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
1122
+ interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps, CompactWhenShortProps {
1085
1123
  /**
1086
1124
  * Legend configuration. Supports `collapseGroups` on top of the shared options.
1087
1125
  */
@@ -1130,13 +1168,15 @@ type BarLegendOptions = Omit<ChartLegendOptions, 'seriesColors'> & {
1130
1168
  /**
1131
1169
  * Builds legend items that match `BarChart`'s bars in a layout, for a custom legend or a chart's own.
1132
1170
  *
1133
- * @param data - The series the chart draws.
1171
+ * @param allData - The chart's series; those the layout does not draw get no item.
1134
1172
  * @param options - The legend options, and the layout the bars are drawn in.
1135
1173
  * @param legendShape - The shape of the legend swatches.
1136
1174
  * @return The legend items.
1137
1175
  */
1138
- export declare function useBarLegendItems(data: SeriesData[], options?: BarLegendOptions, legendShape?: LegendShape<SeriesData[], number>): BaseLegendItem[];
1176
+ export declare function useBarLegendItems(allData: SeriesData[], options?: BarLegendOptions, legendShape?: LegendShape<SeriesData[], number>): BaseLegendItem[];
1139
1177
  interface BarListChartProps extends Exclude<BarChartProps, 'orientation' | 'size' | 'gridVisibility'> {
1178
+ /** Bar lists are always horizontal, and horizontal bars ignore `compactWhenShort`. */
1179
+ compactWhenShort?: never;
1140
1180
  options?: {
1141
1181
  /**
1142
1182
  * Scale for the y axis. Exclude the type property.
@@ -1603,6 +1643,11 @@ interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, '
1603
1643
  * Whether to overlay the label on top of bar
1604
1644
  */
1605
1645
  withOverlayLabel?: boolean;
1646
+ /**
1647
+ * How a negative value draws: `diverge` puts every row on a shared zero point, `clamp` draws it as an empty bar.
1648
+ * @default 'diverge'
1649
+ */
1650
+ negativeBars?: 'diverge' | 'clamp';
1606
1651
  /**
1607
1652
  * Primary color for current period bars
1608
1653
  */
package/dist/index.d.ts CHANGED
@@ -163,18 +163,16 @@ type LeaderboardEntryFields = {
163
163
  */
164
164
  previousValue?: number;
165
165
  /**
166
- * Width of current bar, as % of the largest absolute value across rows. A negative share
167
- * extends the bar from a shared zero point toward the inline start, for every row.
166
+ * Width of current bar, as %. Derived from the values when omitted; a passed value wins.
167
+ * A negative share extends the bar from a shared zero point toward the inline start, for every row.
168
168
  */
169
- currentShare: number;
169
+ currentShare?: number;
170
170
  /**
171
- * Width of previous bar, as % of the largest absolute value across rows. Omit when this
172
- * row has no matching comparison-period value.
171
+ * Width of previous bar, as %. Derived from `previousValue` when omitted; a passed value wins.
173
172
  */
174
173
  previousShare?: number;
175
174
  /**
176
- * Delta of the entry. Omit when the percentage change is unavailable, such
177
- * as when the row has no comparison value or its previous value is zero.
175
+ * Percentage change. Derived from the values when omitted; a passed value wins.
178
176
  */
179
177
  delta?: number;
180
178
  /**
@@ -255,9 +253,9 @@ type BarStyles = {
255
253
  opacity?: number;
256
254
  };
257
255
  /**
258
- * How a bar chart places its series in a category. `grouped` puts each primary series in a slot of its own; `overlap` puts every primary in one slot and every comparison in a second, and overlaps the `group`s within each slot.
256
+ * How a bar chart places its series in a category. `grouped` puts each primary series in a slot of its own; `overlap` puts every primary in one slot and every comparison in a second, and overlaps the `group`s within each slot; `stacked` stacks every primary in one bar, the first series at the bottom.
259
257
  */
260
- type BarChartLayout = 'grouped' | 'overlap';
258
+ type BarChartLayout = 'grouped' | 'overlap' | 'stacked';
261
259
  type MultipleDataPointsDate = {
262
260
  label: string;
263
261
  data: DataPointDate[];
@@ -369,6 +367,18 @@ type ChartTheme = {
369
367
  /** Stroke width for the sparkline line */
370
368
  strokeWidth?: number;
371
369
  };
370
+ /** Compact mode for `compactWhenShort` line, area and bar charts */
371
+ compactWhenShort?: {
372
+ /** Height (px) below which the chart turns compact */
373
+ below?: number;
374
+ /** Margin the chart defaults to while compact */
375
+ margin?: {
376
+ top?: number;
377
+ right?: number;
378
+ bottom?: number;
379
+ left?: number;
380
+ };
381
+ };
372
382
  /**
373
383
  * HeatmapChart settings. Cell gap, radius, value size and the selection ring come from
374
384
  * WPDS tokens in CSS, so only the compact sizing lives here.
@@ -398,6 +408,9 @@ type CompleteChartTheme = Required<ChartTheme> & {
398
408
  sparkline: Required<NonNullable<ChartTheme['sparkline']>> & {
399
409
  margin: Required<NonNullable<ChartTheme['sparkline']>['margin']>;
400
410
  };
411
+ compactWhenShort: Required<NonNullable<ChartTheme['compactWhenShort']>> & {
412
+ margin: Required<NonNullable<ChartTheme['compactWhenShort']>['margin']>;
413
+ };
401
414
  heatmapChart: Required<NonNullable<ChartTheme['heatmapChart']>>;
402
415
  };
403
416
  /**
@@ -447,6 +460,12 @@ type AxisOptions = {
447
460
  * so callers can force a specific axis (e.g. integer-only steps on a sparse chart).
448
461
  */
449
462
  tickValues?: ScaleInput<AxisScale>[];
463
+ /**
464
+ * Most decimal places a value-axis tick may carry, so labels rounded to that precision never repeat;
465
+ * an axis holding fewer than two steps widens to the nearest ones. Whole-number data always uses 0.
466
+ * Ignored on a log scale, or when `tickValues` or the value scale's `domain` is set. Line and bar charts only.
467
+ */
468
+ tickDecimals?: number;
450
469
  axisClassName?: string;
451
470
  axisLineClassName?: string;
452
471
  labelClassName?: string;
@@ -626,6 +645,17 @@ interface SeriesVisibilityProps {
626
645
  */
627
646
  defaultHiddenSeries?: readonly string[];
628
647
  }
648
+ /**
649
+ * Compact mode for cartesian charts placed in short containers.
650
+ */
651
+ interface CompactWhenShortProps {
652
+ /**
653
+ * Drop the axes, grid and legend, and default to `theme.compactWhenShort.margin`, while the
654
+ * chart is shorter than `theme.compactWhenShort.below`. Series hidden through the legend stay
655
+ * hidden until the chart is tall again. Horizontal bar charts ignore it.
656
+ */
657
+ compactWhenShort?: boolean;
658
+ }
629
659
  /**
630
660
  * Base properties shared across all chart components
631
661
  */
@@ -785,7 +815,15 @@ type BaseLegendItem = {
785
815
  interactive?: boolean;
786
816
  /** Label of the series this static item describes; the item is left out while it is hidden. */
787
817
  describesSeries?: string;
788
- };
818
+ } & ({
819
+ /** Pressed state of the toggle. */
820
+ pressed: boolean;
821
+ /** Makes an interactive legend item a toggle the consumer controls, instead of a series toggle. */
822
+ onToggle: () => void;
823
+ } | {
824
+ pressed?: never;
825
+ onToggle?: never;
826
+ });
789
827
  export declare const Legend: import("react").ForwardRefExoticComponent<Omit<BaseLegendProps, "items"> & {
790
828
  items?: BaseLegendItem[];
791
829
  chartId?: string;
@@ -925,7 +963,7 @@ type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
925
963
  glyphStyle?: SVGProps<SVGCircleElement>;
926
964
  position?: 'start' | 'end';
927
965
  };
928
- interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
966
+ interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps, CompactWhenShortProps {
929
967
  /**
930
968
  * Legend configuration. Supports `collapseGroups` on top of the shared options.
931
969
  */
@@ -978,7 +1016,7 @@ type TooltipDatum = {
978
1016
  /** The series' reading, or null when the bucket has none. */
979
1017
  value: number | null;
980
1018
  };
981
- interface AreaChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
1019
+ interface AreaChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps, CompactWhenShortProps {
982
1020
  /**
983
1021
  * Legend configuration. Supports `collapseGroups` on top of the shared options.
984
1022
  */
@@ -1081,7 +1119,7 @@ type BandHighlightSelection = {
1081
1119
  width: number;
1082
1120
  height: number;
1083
1121
  };
1084
- interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
1122
+ interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps, CompactWhenShortProps {
1085
1123
  /**
1086
1124
  * Legend configuration. Supports `collapseGroups` on top of the shared options.
1087
1125
  */
@@ -1130,13 +1168,15 @@ type BarLegendOptions = Omit<ChartLegendOptions, 'seriesColors'> & {
1130
1168
  /**
1131
1169
  * Builds legend items that match `BarChart`'s bars in a layout, for a custom legend or a chart's own.
1132
1170
  *
1133
- * @param data - The series the chart draws.
1171
+ * @param allData - The chart's series; those the layout does not draw get no item.
1134
1172
  * @param options - The legend options, and the layout the bars are drawn in.
1135
1173
  * @param legendShape - The shape of the legend swatches.
1136
1174
  * @return The legend items.
1137
1175
  */
1138
- export declare function useBarLegendItems(data: SeriesData[], options?: BarLegendOptions, legendShape?: LegendShape<SeriesData[], number>): BaseLegendItem[];
1176
+ export declare function useBarLegendItems(allData: SeriesData[], options?: BarLegendOptions, legendShape?: LegendShape<SeriesData[], number>): BaseLegendItem[];
1139
1177
  interface BarListChartProps extends Exclude<BarChartProps, 'orientation' | 'size' | 'gridVisibility'> {
1178
+ /** Bar lists are always horizontal, and horizontal bars ignore `compactWhenShort`. */
1179
+ compactWhenShort?: never;
1140
1180
  options?: {
1141
1181
  /**
1142
1182
  * Scale for the y axis. Exclude the type property.
@@ -1603,6 +1643,11 @@ interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, '
1603
1643
  * Whether to overlay the label on top of bar
1604
1644
  */
1605
1645
  withOverlayLabel?: boolean;
1646
+ /**
1647
+ * How a negative value draws: `diverge` puts every row on a shared zero point, `clamp` draws it as an empty bar.
1648
+ * @default 'diverge'
1649
+ */
1650
+ negativeBars?: 'diverge' | 'clamp';
1606
1651
  /**
1607
1652
  * Primary color for current period bars
1608
1653
  */