@automattic/charts 3.1.1 → 3.2.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.
- package/CHANGELOG.md +12 -0
- package/TOKENS.md +51 -12
- package/dist/index.cjs +292 -200
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +7 -1
- package/dist/index.d.cts +223 -127
- package/dist/index.d.ts +223 -127
- package/dist/index.js +291 -199
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/src/charts/bar-chart/bar-chart.tsx +36 -10
- package/src/charts/bar-chart/test/bar-chart-pointer-events.test.tsx +67 -0
- package/src/charts/bar-chart/test/bar-chart.test.tsx +79 -0
- package/src/charts/bar-list-chart/bar-list-chart.tsx +40 -2
- package/src/charts/bar-list-chart/test/bar-list-chart.test.tsx +38 -0
- package/src/charts/line-chart/line-chart.tsx +16 -1
- package/src/charts/line-chart/test/line-chart.test.tsx +47 -0
- package/src/charts/sparkline/sparkline.tsx +9 -3
- package/src/charts/sparkline/types.ts +1 -1
- package/src/components/tooltip/accessible-tooltip.tsx +32 -2
- package/src/components/tooltip/test/accessible-tooltip.test.tsx +68 -0
- package/src/hooks/test/use-xychart-theme-provider-override.test.tsx +4 -4
- package/src/hooks/test/use-xychart-theme-style-reads.test.tsx +17 -10
- package/src/hooks/test/use-xychart-theme.test.tsx +50 -5
- package/src/hooks/use-xychart-theme.ts +14 -20
- package/src/providers/chart-context/global-charts-provider.tsx +44 -33
- package/src/providers/chart-context/private/series-palette.ts +45 -0
- package/src/providers/chart-context/private/theme-override-vars.ts +46 -2
- package/src/providers/chart-context/private/with-catalog-pointers.ts +45 -2
- package/src/providers/chart-context/test/sparse-theme.test.ts +16 -2
- package/src/providers/chart-context/test/theme-override-vars.test.ts +65 -0
- package/src/providers/chart-context/test/use-global-charts-theme.test.tsx +8 -1
- package/src/providers/chart-context/test/with-catalog-pointers.test.ts +57 -0
- package/src/providers/chart-context/themes.ts +8 -3
- package/src/styles/chart-scope.scss +52 -24
- package/src/styles/test/chart-scope.test.ts +22 -9
- package/src/types.ts +148 -31
- package/src/utils/get-styles.ts +7 -1
package/src/utils/get-styles.ts
CHANGED
|
@@ -50,9 +50,15 @@ export function getSeriesBarStyles(
|
|
|
50
50
|
/**
|
|
51
51
|
* Utility function to get stroke color for a series
|
|
52
52
|
*
|
|
53
|
+
* `themeColors` must already be resolved. `useGlobalChartsTheme().colors` is not: its entries are
|
|
54
|
+
* the palette's `var()` chains, which an SVG presentation attribute cannot resolve. Prefer
|
|
55
|
+
* `getElementStyles( { data, index } ).color` from
|
|
56
|
+
* `useGlobalChartsContext()`, which resolves at the chart's scope element and generates past the
|
|
57
|
+
* seeds.
|
|
58
|
+
*
|
|
53
59
|
* @param {SeriesData} seriesData - The series data containing styling options
|
|
54
60
|
* @param {number} index - The index of the series in the data array
|
|
55
|
-
* @param {string[]} themeColors -
|
|
61
|
+
* @param {string[]} themeColors - The resolved series palette
|
|
56
62
|
* @return {string} The stroke color for the series
|
|
57
63
|
*/
|
|
58
64
|
export function getSeriesStroke(
|