@automattic/charts 1.11.0 → 1.12.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 (31) hide show
  1. package/CHANGELOG.md +10 -2
  2. package/TOKENS.md +12 -1
  3. package/dist/index.cjs +751 -97
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.css +11 -28
  6. package/dist/index.d.cts +58 -6
  7. package/dist/index.d.ts +58 -6
  8. package/dist/index.js +751 -97
  9. package/dist/index.js.map +1 -1
  10. package/package.json +2 -1
  11. package/src/charts/area-chart/area-chart.tsx +28 -8
  12. package/src/charts/area-chart/test/area-chart.test.tsx +102 -0
  13. package/src/charts/area-chart/types.ts +20 -6
  14. package/src/charts/bar-chart/bar-chart.tsx +33 -9
  15. package/src/charts/bar-chart/test/bar-chart.test.tsx +117 -0
  16. package/src/charts/line-chart/line-chart.tsx +40 -5
  17. package/src/charts/line-chart/test/line-chart.test.tsx +190 -1
  18. package/src/charts/line-chart/types.ts +14 -0
  19. package/src/charts/private/x-zoom/index.ts +1 -0
  20. package/src/charts/private/{test → x-zoom/test}/x-zoom.test.tsx +46 -3
  21. package/src/charts/private/x-zoom/x-zoom.module.scss +43 -0
  22. package/src/charts/private/{x-zoom.tsx → x-zoom/x-zoom.tsx} +52 -24
  23. package/src/components/legend/hooks/test/use-chart-legend-items.test.tsx +152 -0
  24. package/src/components/legend/hooks/use-chart-legend-items.ts +118 -16
  25. package/src/components/legend/private/base-legend.tsx +21 -9
  26. package/src/components/legend/test/legend-config-types.test.tsx +32 -0
  27. package/src/components/legend/test/legend.test.tsx +121 -1
  28. package/src/components/legend/types.ts +6 -0
  29. package/src/index.ts +1 -0
  30. package/src/types.ts +16 -0
  31. package/src/charts/private/x-zoom.module.scss +0 -50
package/CHANGELOG.md CHANGED
@@ -5,12 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.12.0] - 2026-08-03
9
+ ### Added
10
+ - New `legend.collapseGroups` option folds series that share a `group` into a single legend item, labelled by the group's primary series; with `legend.interactive` that item toggles the whole group in one click. Off by default, so legends keep one item per series unless you opt in. Available on the bar, line and area charts. The line chart gains a `rescaleYOnVisibilityChange` prop (matching the area chart) to pin the value axis to the full data range while series are hidden; and when every series is hidden, the grid and axes are dropped so the empty state stands on its own. The area chart's `rescaleYOnLegendToggle` prop is deprecated in favour of `rescaleYOnVisibilityChange` (still honoured as an alias). [#50194]
11
+
12
+ ### Changed
13
+ - Zoom: Render the reset control with the WordPress UI Button, fix keyboard activation, expose the selection rectangle's colors as `--a8c-charts-color-zoom-selection` and `--a8c-charts-color-zoom-selection-stroke`, and document the `zoomable` prop for the line and area charts. [#50796]
14
+
8
15
  ## [1.11.0] - 2026-07-27
9
16
  ### Added
10
- - Charts: add a `fitRows` prop to LeaderboardChart so a chart in a fixed-height container shows only the rows that fit instead of scrolling. [#50688]
17
+ - Add a `fitRows` prop to LeaderboardChart so a chart in a fixed-height container shows only the rows that fit instead of scrolling. [#50688]
11
18
 
12
19
  ### Changed
13
- - Charts: standardise package CSS custom properties on the --a8c-charts-{category}-{name} naming convention and document the token catalog; existing public override variables keep working via deprecated aliases. [#50656]
20
+ - Standardize CSS custom properties on the `--a8c-charts-{category}-{name}` naming convention; existing override variables keep working via deprecated aliases. [#50656]
14
21
 
15
22
  ### Fixed
16
23
  - Leaderboard: Distinguish unavailable percentage changes from missing comparison data. [#50690]
@@ -945,6 +952,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
945
952
  - Fixed lints following ESLint rule changes for TS [#40584]
946
953
  - Fixing a bug in Chart storybook data. [#40640]
947
954
 
955
+ [1.12.0]: https://github.com/Automattic/charts/compare/v1.11.0...v1.12.0
948
956
  [1.11.0]: https://github.com/Automattic/charts/compare/v1.10.3...v1.11.0
949
957
  [1.10.3]: https://github.com/Automattic/charts/compare/v1.10.2...v1.10.3
950
958
  [1.10.2]: https://github.com/Automattic/charts/compare/v1.10.1...v1.10.2
package/TOKENS.md CHANGED
@@ -49,7 +49,18 @@ Instance styling knobs, on the same convention but not shared semantic roles:
49
49
  `--a8c-charts-border-radius-leaderboard-bar`,
50
50
  `--a8c-charts-dimension-leaderboard-bar-hover-inset`,
51
51
  `--a8c-charts-color-heatmap-*`, `--a8c-charts-dimension-heatmap-*`,
52
- `--a8c-charts-heatmap-cell-intensity`.
52
+ `--a8c-charts-heatmap-cell-intensity`,
53
+ `--a8c-charts-color-zoom-selection`, `--a8c-charts-color-zoom-selection-stroke`.
54
+
55
+ | Role | Maps to `--wpds-*` | Fallback |
56
+ |---|---|---|
57
+ | `--a8c-charts-color-zoom-selection` | `--wpds-color-background-interactive-brand-strong` | `#3858e9` |
58
+ | `--a8c-charts-color-zoom-selection-stroke` | `--wpds-color-stroke-interactive-brand` | `#3858e9` |
59
+
60
+ The zoom selection roles carry the drag-to-zoom rectangle's fill and border. Their
61
+ translucency is not part of the role: it lives in the `fill-opacity` /
62
+ `stroke-opacity` properties, so overriding either role sets an opaque colour and
63
+ keeps the intended transparency.
53
64
 
54
65
  `--a8c-charts-heatmap-cell-intensity` is the one variable without a `{category}`
55
66
  segment: it holds a unitless 0–1 scalar consumed inside `color-mix()`, not a colour.