diff --git a/projects/js-packages/charts/TOKENS.md b/projects/js-packages/charts/TOKENS.md index d836c2cb1e0c..3c0434e30be5 100644 --- a/projects/js-packages/charts/TOKENS.md +++ b/projects/js-packages/charts/TOKENS.md @@ -152,6 +152,7 @@ The palette is resolved per provider, so one `ColorCache` and one group-to-color | `--a8c-charts-border-radius-leaderboard-bar` | _(none — pill shape, no WPDS radius fits)_ | `9999px` | | `--a8c-charts-dimension-leaderboard-row-gap` | `--wpds-dimension-gap-md` | `12px` | | `--a8c-charts-dimension-leaderboard-column-gap` | `--wpds-dimension-gap-xs` | `4px` | +| `--a8c-charts-dimension-leaderboard-label-inset` | `--wpds-dimension-padding-sm` | `8px` | | `--a8c-charts-dimension-legend-column-gap` | `--wpds-dimension-gap-lg` | `16px` | | `--a8c-charts-dimension-legend-row-gap` | `--wpds-dimension-gap-sm` | `8px` | | `--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` | @@ -161,6 +162,8 @@ The motion pair carries the one-shot reveal a data mark plays on first paint, ac `--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. +`--a8c-charts-dimension-leaderboard-label-inset` pads an overlay label at its inline start, inside the `--wpds-border-width-focus` every row reserves for its focus ring. Read both to line up content outside the chart, such as a column header, with the row text. + 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. The elevation fallbacks hold the values their removed `--wpds-elevation-*` tokens used to resolve to, until a replacement exists. diff --git a/projects/js-packages/charts/changelog/charts-307-leaderboard-text-inset b/projects/js-packages/charts/changelog/charts-307-leaderboard-text-inset new file mode 100644 index 000000000000..cb1720dfa890 --- /dev/null +++ b/projects/js-packages/charts/changelog/charts-307-leaderboard-text-inset @@ -0,0 +1,4 @@ +Significance: minor +Type: fixed + +Leaderboard chart: Inset overlay labels from the inline start, so they keep their padding in right-to-left languages, and expose the label inset as a CSS custom property. diff --git a/projects/js-packages/charts/src/charts/leaderboard-chart/leaderboard-chart.module.scss b/projects/js-packages/charts/src/charts/leaderboard-chart/leaderboard-chart.module.scss index f1543a073a4a..8925db4d3b84 100644 --- a/projects/js-packages/charts/src/charts/leaderboard-chart/leaderboard-chart.module.scss +++ b/projects/js-packages/charts/src/charts/leaderboard-chart/leaderboard-chart.module.scss @@ -49,7 +49,7 @@ } .label { - padding-left: var(--wpds-dimension-padding-sm); + padding-inline-start: var(--a8c-charts-dimension-leaderboard-label-inset); } // The bar's 100% height needs a track that fills the row, diff --git a/projects/js-packages/charts/src/styles/chart-scope.scss b/projects/js-packages/charts/src/styles/chart-scope.scss index 6a7a871b272a..f07a8d4f3b06 100644 --- a/projects/js-packages/charts/src/styles/chart-scope.scss +++ b/projects/js-packages/charts/src/styles/chart-scope.scss @@ -87,6 +87,7 @@ --a8c-charts-dimension-leaderboard-row-gap: var(--wpds-dimension-gap-md); --a8c-charts-dimension-leaderboard-column-gap: var(--wpds-dimension-gap-xs); + --a8c-charts-dimension-leaderboard-label-inset: var(--wpds-dimension-padding-sm); --a8c-charts-dimension-legend-column-gap: var(--wpds-dimension-gap-lg); --a8c-charts-dimension-legend-row-gap: var(--wpds-dimension-gap-sm); }