@automattic/charts 4.10.0 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/TOKENS.md +7 -3
- package/dist/index.cjs +337 -708
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +52 -3
- package/dist/index.d.cts +39 -39
- package/dist/index.d.ts +39 -39
- package/dist/index.js +308 -660
- package/dist/index.js.map +1 -1
- package/dist/visx/group/index.js +1 -2
- package/dist/visx/legend/index.js +1 -2
- package/dist/visx/text/index.js +1 -2
- package/package.json +13 -12
- package/src/charts/conversion-funnel-chart/conversion-funnel-chart.module.scss +5 -0
- package/src/charts/geo-chart/geo-chart.module.scss +27 -0
- package/src/charts/geo-chart/geo-chart.tsx +68 -43
- package/src/charts/geo-chart/private/use-tooltip-position.ts +106 -0
- package/src/charts/geo-chart/test/geo-chart.test.tsx +68 -42
- package/src/charts/geo-chart/test/use-tooltip-position.test.ts +43 -0
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +3 -3
- package/src/charts/heatmap-chart/private/heatmap-scale.ts +48 -43
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +5 -5
- package/src/charts/heatmap-chart/test/heatmap-scale.test.ts +55 -27
- package/src/charts/heatmap-chart/types.ts +1 -1
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +8 -5
- package/src/components/legend/private/base-legend.module.scss +5 -0
- package/src/components/legend/private/base-legend.tsx +8 -2
- package/src/components/tooltip/_surface.scss +19 -0
- package/src/components/tooltip/private/bounded-tooltip.tsx +2 -2
- package/src/components/tooltip/tooltip-box.module.scss +3 -17
- package/src/styles/chart-scope.scss +6 -4
- package/src/styles/test/chart-scope.test.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ 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
|
+
## [4.11.1] - 2026-10-20
|
|
9
|
+
### Changed
|
|
10
|
+
- Internal updates.
|
|
11
|
+
|
|
12
|
+
## [4.11.0] - 2026-10-19
|
|
13
|
+
### Changed
|
|
14
|
+
- Geo chart: Draw tooltips on the same dark surface, and at the same distance from the cursor, as the other chart tooltips. [#53515]
|
|
15
|
+
- Heatmap chart: Lighten the color scale to 2.5:1 contrast at the lowest step and 6:1 at the highest, and keep the two ends apart when the empty-cell color sits far from the background. [#53450]
|
|
16
|
+
- Heatmap chart: Offset the grid's focus ring by the design system focus width. [#53522]
|
|
17
|
+
- Legend: Set wrapped rows of a horizontal legend closer together than items on one row, and expose both gaps as CSS variables. [#53704]
|
|
18
|
+
- Update package dependencies. [#53004]
|
|
19
|
+
- Update package dependencies. [#53678]
|
|
20
|
+
- Update package dependencies. [#53806]
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- Conversion funnel chart: Show a focus ring on the focused step bar. [#53522]
|
|
24
|
+
|
|
8
25
|
## [4.10.0] - 2026-10-14
|
|
9
26
|
### Added
|
|
10
27
|
- Give the geo, leaderboard, conversion funnel and bar list charts an accessible name, and accept `ariaLabel` on every chart except Sparkline. [#53516]
|
|
@@ -1187,6 +1204,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1187
1204
|
- Fixed lints following ESLint rule changes for TS [#40584]
|
|
1188
1205
|
- Fixing a bug in Chart storybook data. [#40640]
|
|
1189
1206
|
|
|
1207
|
+
[4.11.1]: https://github.com/Automattic/charts/compare/v4.11.0...v4.11.1
|
|
1208
|
+
[4.11.0]: https://github.com/Automattic/charts/compare/v4.10.0...v4.11.0
|
|
1190
1209
|
[4.10.0]: https://github.com/Automattic/charts/compare/v4.9.0...v4.10.0
|
|
1191
1210
|
[4.9.0]: https://github.com/Automattic/charts/compare/v4.8.0...v4.9.0
|
|
1192
1211
|
[4.8.0]: https://github.com/Automattic/charts/compare/v4.7.0...v4.8.0
|
package/TOKENS.md
CHANGED
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
## How it resolves
|
|
6
6
|
|
|
7
|
-
`src/styles/chart-scope.scss` declares the whole catalog once, on the `GlobalChartsProvider` wrapper, via `:where(.a8c-charts-scope, .a8c-charts-tooltip-scope)`. `:where()` keeps the rule at zero specificity, so a consumer rule targeting that same element wins without `!important`. It is declared on the wrapper rather than `:root` because `@wordpress/theme`'s `ThemeProvider` emits its generated `--wpds-*` ramp as inline styles on its own wrapper div — a `:root` declaration would miss a `ThemeProvider` entirely.
|
|
7
|
+
`src/styles/chart-scope.scss` declares the whole catalog once, on the `GlobalChartsProvider` wrapper, via `:where(.a8c-charts-scope, .a8c-charts-tooltip-scope, .geo-chart .google-visualization-tooltip)`. `:where()` keeps the rule at zero specificity, so a consumer rule targeting that same element wins without `!important`. It is declared on the wrapper rather than `:root` because `@wordpress/theme`'s `ThemeProvider` emits its generated `--wpds-*` ramp as inline styles on its own wrapper div — a `:root` declaration would miss a `ThemeProvider` entirely.
|
|
8
8
|
|
|
9
9
|
Chart roots deliberately do *not* carry the `a8c-charts-scope` class. Custom properties inherit down the tree, and an element only shadows an inherited value by re-declaring it, so a chart root that re-declared the catalog would beat an override set between it and the provider — closing off the one place consumers are meant to set overrides. This inheritance rule drives every precedence question below.
|
|
10
10
|
|
|
11
|
-
The tooltip box, `TooltipBox`, is the exception, and on purpose. Like the `@wordpress/ui` Tooltip popup, it renders inside its own `ThemeProvider`, seeded with `--a8c-charts-color-tooltip-surface`, and carries its own `a8c-charts-tooltip-scope` class, so it re-declares the catalog under that dark theme. Every role read inside the box resolves for the dark surface, whatever theme the chart is in, and neither an override set on the chart nor a rule on `.a8c-charts-scope` reaches the box. To override a role inside every tooltip, target `.a8c-charts-tooltip-scope`. An `unstyled` box gets neither the theme nor the class.
|
|
11
|
+
The tooltip box, `TooltipBox`, is the exception, and on purpose. Like the `@wordpress/ui` Tooltip popup, it renders inside its own `ThemeProvider`, seeded with `--a8c-charts-color-tooltip-surface`, and carries its own `a8c-charts-tooltip-scope` class, so it re-declares the catalog under that dark theme. Every role read inside the box resolves for the dark surface, whatever theme the chart is in, and neither an override set on the chart nor a rule on `.a8c-charts-scope` reaches the box. To override a role inside every tooltip, target `.a8c-charts-tooltip-scope`. An `unstyled` box gets neither the theme nor the class. `GeoChart`'s Google tooltip (`.google-visualization-tooltip`) follows the same pattern: the chart renders under the same dark theme and the selector above re-declares the catalog on it. It does not carry `a8c-charts-tooltip-scope`, so override a role there with `.geo-chart .google-visualization-tooltip`: any rule beats the zero-specificity `:where()`.
|
|
12
12
|
|
|
13
13
|
`TrendIndicator` and `BaseLegend` carry the class only when no provider is above them (`useStandaloneScopeClass()`), so inside a provider they inherit its overrides like the chart they belong to.
|
|
14
14
|
|
|
15
15
|
Catalog entries normally map to WPDS tokens. Source writes these mappings bare; the LightningCSS plugin in `tsdown.config.ts` injects the WPDS spec value as a fallback into `dist/`:
|
|
16
16
|
|
|
17
17
|
```scss
|
|
18
|
-
:where(.a8c-charts-scope, .a8c-charts-tooltip-scope) {
|
|
18
|
+
:where(.a8c-charts-scope, .a8c-charts-tooltip-scope, .geo-chart .google-visualization-tooltip) {
|
|
19
19
|
--a8c-charts-color-grid: var(--wpds-color-stroke-surface-neutral);
|
|
20
20
|
}
|
|
21
21
|
```
|
|
@@ -152,6 +152,8 @@ The palette is resolved per provider, so one `ColorCache` and one group-to-color
|
|
|
152
152
|
| `--a8c-charts-border-radius-leaderboard-bar` | _(none — pill shape, no WPDS radius fits)_ | `9999px` |
|
|
153
153
|
| `--a8c-charts-dimension-leaderboard-row-gap` | `--wpds-dimension-gap-md` | `12px` |
|
|
154
154
|
| `--a8c-charts-dimension-leaderboard-column-gap` | `--wpds-dimension-gap-xs` | `4px` |
|
|
155
|
+
| `--a8c-charts-dimension-legend-column-gap` | `--wpds-dimension-gap-lg` | `16px` |
|
|
156
|
+
| `--a8c-charts-dimension-legend-row-gap` | `--wpds-dimension-gap-sm` | `8px` |
|
|
155
157
|
| `--a8c-charts-elevation-xs` | _(none — `--wpds-elevation-*` removed in theme 1.0.0)_ | `0 1px 1px 0 #00000008, 0 1px 2px 0 #00000005, 0 3px 3px 0 #00000005, 0 4px 4px 0 #00000003` |
|
|
156
158
|
| `--a8c-charts-elevation-sm` | _(none — `--wpds-elevation-*` removed in theme 1.0.0)_ | `0 1px 2px 0 #0000000d, 0 2px 3px 0 #0000000a, 0 6px 6px 0 #00000008, 0 8px 8px 0 #00000005` |
|
|
157
159
|
|
|
@@ -159,6 +161,8 @@ The motion pair carries the one-shot reveal a data mark plays on first paint, ac
|
|
|
159
161
|
|
|
160
162
|
`--a8c-charts-border-radius-bar` rounds the conversion funnel's bars. `--a8c-charts-border-radius-bar-chart` rounds the bars of the bar chart and bar list chart; set it to a radius such as `var(--wpds-border-radius-sm)` to opt in. Bar charts apply it as the CSS `rx` property, so it rounds all four corners of a bar. It resolves in CSS at the bar, so an override set anywhere inside the provider tree applies, the chart's own class included; see [Precedence](#precedence) for overrides above the provider.
|
|
161
163
|
|
|
164
|
+
The legend pair spaces the items of a horizontal legend: the column gap between items on one line, and the smaller row gap between lines once the legend wraps.
|
|
165
|
+
|
|
162
166
|
The elevation fallbacks hold the values their removed `--wpds-elevation-*` tokens used to resolve to, until a replacement exists.
|
|
163
167
|
|
|
164
168
|
## Tier 2 — component-specific variables
|