@automattic/charts 4.8.0 → 4.9.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 +14 -0
- package/dist/index.cjs +624 -228
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +58 -8
- package/dist/index.d.cts +42 -8
- package/dist/index.d.ts +42 -8
- package/dist/index.js +628 -232
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/charts/area-chart/area-chart.tsx +5 -2
- package/src/charts/area-chart/test/area-chart.test.tsx +23 -14
- package/src/charts/area-chart/test/tooltip-resolution.test.tsx +2 -2
- package/src/charts/area-chart/types.ts +2 -0
- package/src/charts/bar-chart/bar-chart.tsx +5 -2
- package/src/charts/bar-chart/test/bar-chart.test.tsx +82 -63
- package/src/charts/bar-chart/types.ts +2 -0
- package/src/charts/bar-list-chart/test/bar-list-chart.test.tsx +3 -1
- package/src/charts/heatmap-chart/heatmap-chart.module.scss +10 -4
- package/src/charts/heatmap-chart/heatmap-chart.tsx +144 -37
- package/src/charts/heatmap-chart/private/column-groups.ts +79 -8
- package/src/charts/heatmap-chart/private/fit-compact-cells.ts +72 -0
- package/src/charts/heatmap-chart/private/heatmap-legend.tsx +14 -2
- package/src/charts/heatmap-chart/private/index.ts +4 -2
- package/src/charts/heatmap-chart/test/column-groups.test.ts +41 -4
- package/src/charts/heatmap-chart/test/fit-compact-cells.test.ts +59 -0
- package/src/charts/heatmap-chart/test/heatmap-chart.test.tsx +132 -1
- package/src/charts/heatmap-chart/types.ts +2 -0
- package/src/charts/leaderboard-chart/leaderboard-chart.module.scss +46 -4
- package/src/charts/leaderboard-chart/leaderboard-chart.tsx +37 -1
- package/src/charts/leaderboard-chart/test/leaderboard-chart.test.tsx +53 -0
- package/src/charts/leaderboard-chart/types.ts +6 -1
- package/src/charts/line-chart/line-chart.tsx +5 -2
- package/src/charts/line-chart/private/line-chart-annotation-label-popover.tsx +19 -9
- package/src/charts/line-chart/test/default-tooltip-formatting.test.tsx +1 -1
- package/src/charts/line-chart/test/line-chart.test.tsx +45 -35
- package/src/charts/line-chart/test/tooltip-resolution.test.tsx +2 -2
- package/src/charts/line-chart/types.ts +5 -3
- package/src/charts/pie-chart/pie-chart.tsx +149 -139
- package/src/charts/pie-chart/test/pie-chart.test.tsx +171 -0
- package/src/charts/pie-semi-circle-chart/pie-semi-circle-chart.tsx +122 -120
- package/src/charts/pie-semi-circle-chart/test/pie-semi-circle-chart.test.tsx +54 -0
- package/src/charts/private/chart-composition/use-chart-children.ts +11 -6
- package/src/charts/private/pie-keyboard-navigation/index.ts +4 -0
- package/src/charts/private/pie-keyboard-navigation/order-arcs-for-navigation.ts +10 -0
- package/src/charts/private/pie-keyboard-navigation/pie-keyboard-navigation.module.scss +16 -0
- package/src/charts/private/pie-keyboard-navigation/pie-selection-announcement.tsx +14 -0
- package/src/charts/private/pie-keyboard-navigation/pie-selection-output.tsx +82 -0
- package/src/charts/private/pie-keyboard-navigation/pie-tooltip.tsx +44 -0
- package/src/charts/private/pie-keyboard-navigation/selected-segment-ring.tsx +47 -0
- package/src/charts/private/pie-keyboard-navigation/test/order-arcs-for-navigation.test.ts +34 -0
- package/src/charts/private/pie-keyboard-navigation/test/selected-segment-ring.test.ts +14 -0
- package/src/charts/private/pie-keyboard-navigation/use-pie-keyboard-navigation.ts +139 -0
- package/src/charts/private/x-zoom/test/x-zoom.test.tsx +3 -2
- package/src/components/tooltip/test/xy-chart-tooltip.test.tsx +20 -19
- package/src/components/tooltip/xy-chart-tooltip.tsx +3 -3
- package/src/types.ts +18 -2
package/dist/index.css
CHANGED
|
@@ -547,9 +547,9 @@
|
|
|
547
547
|
}
|
|
548
548
|
|
|
549
549
|
.a8ccharts-O3YMOW-heatmap-chart__group-label {
|
|
550
|
-
color: var(--a8c-charts-color-label
|
|
551
|
-
font-size: var(--wpds-typography-font-size-
|
|
552
|
-
line-height: var(--wpds-typography-line-height-
|
|
550
|
+
color: var(--a8c-charts-color-label);
|
|
551
|
+
font-size: var(--wpds-typography-font-size-md, 13px);
|
|
552
|
+
line-height: var(--wpds-typography-line-height-sm, 20px);
|
|
553
553
|
white-space: nowrap;
|
|
554
554
|
text-align: center;
|
|
555
555
|
padding-block-start: var(--wpds-dimension-padding-xs, 4px);
|
|
@@ -639,6 +639,10 @@
|
|
|
639
639
|
background: color-mix(in sRGB, var(--a8c-charts-color-heatmap-high, var(--a8c-charts-color-heatmap-primary)) calc(var(--a8c-charts-heatmap-cell-intensity) * 100%), var(--a8c-charts-color-heatmap-low, color-mix(in sRGB, var(--a8c-charts-color-heatmap-primary) 15%, var(--a8c-charts-color-background, #fff))));
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
+
.a8ccharts-O3YMOW-heatmap-chart__legend-swatch--empty {
|
|
643
|
+
background: var(--a8c-charts-color-track);
|
|
644
|
+
}
|
|
645
|
+
|
|
642
646
|
.a8ccharts-O3YMOW-heatmap-chart__legend-scale--bar {
|
|
643
647
|
border-radius: var(--a8c-charts-border-radius-cell);
|
|
644
648
|
overflow: hidden;
|
|
@@ -793,23 +797,23 @@
|
|
|
793
797
|
transition: transform var(--wpds-motion-duration-sm, .1s) var(--wpds-motion-easing-subtle, cubic-bezier(.15, 0, .15, 1));
|
|
794
798
|
}
|
|
795
799
|
|
|
796
|
-
.a8ccharts-GovfoW-interactiveRow:hover, .a8ccharts-GovfoW-interactiveRow:focus-visible {
|
|
800
|
+
.a8ccharts-GovfoW-interactiveRow:hover:not(:has(:is(a, button):not(.a8ccharts-GovfoW-rowButton):hover)), .a8ccharts-GovfoW-interactiveRow:focus-visible, .a8ccharts-GovfoW-interactiveRow:has( > .a8ccharts-GovfoW-rowButton:focus-visible) {
|
|
797
801
|
--a8c-charts-dimension-leaderboard-bar-hover-inset: var(--wpds-dimension-gap-2xl, 32px);
|
|
798
802
|
}
|
|
799
803
|
|
|
800
|
-
.a8ccharts-GovfoW-interactiveRow:hover .a8ccharts-GovfoW-bar, .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-bar {
|
|
804
|
+
.a8ccharts-GovfoW-interactiveRow:hover:not(:has(:is(a, button):not(.a8ccharts-GovfoW-rowButton):hover)) .a8ccharts-GovfoW-bar, .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-bar, .a8ccharts-GovfoW-interactiveRow:has( > .a8ccharts-GovfoW-rowButton:focus-visible) .a8ccharts-GovfoW-bar {
|
|
801
805
|
opacity: .5;
|
|
802
806
|
}
|
|
803
807
|
|
|
804
|
-
.a8ccharts-GovfoW-interactiveRow:hover .a8ccharts-GovfoW-valueContainer, .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-valueContainer {
|
|
808
|
+
.a8ccharts-GovfoW-interactiveRow:hover:not(:has(:is(a, button):not(.a8ccharts-GovfoW-rowButton):hover)) .a8ccharts-GovfoW-valueContainer, .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-valueContainer, .a8ccharts-GovfoW-interactiveRow:has( > .a8ccharts-GovfoW-rowButton:focus-visible) .a8ccharts-GovfoW-valueContainer {
|
|
805
809
|
transform: translateX(calc(var(--a8c-charts-dimension-leaderboard-bar-hover-inset) * -1));
|
|
806
810
|
}
|
|
807
811
|
|
|
808
|
-
.a8ccharts-GovfoW-interactiveRow:hover .a8ccharts-GovfoW-chevron, .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-chevron {
|
|
812
|
+
.a8ccharts-GovfoW-interactiveRow:hover:not(:has(:is(a, button):not(.a8ccharts-GovfoW-rowButton):hover)) .a8ccharts-GovfoW-chevron, .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-chevron, .a8ccharts-GovfoW-interactiveRow:has( > .a8ccharts-GovfoW-rowButton:focus-visible) .a8ccharts-GovfoW-chevron {
|
|
809
813
|
opacity: 1;
|
|
810
814
|
}
|
|
811
815
|
|
|
812
|
-
[dir="rtl"] .a8ccharts-GovfoW-interactiveRow:hover .a8ccharts-GovfoW-valueContainer, [dir="rtl"] .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-valueContainer {
|
|
816
|
+
[dir="rtl"] .a8ccharts-GovfoW-interactiveRow:hover:not(:has(:is(a, button):not(.a8ccharts-GovfoW-rowButton):hover)) .a8ccharts-GovfoW-valueContainer, [dir="rtl"] .a8ccharts-GovfoW-interactiveRow:focus-visible .a8ccharts-GovfoW-valueContainer, [dir="rtl"] .a8ccharts-GovfoW-interactiveRow:has( > .a8ccharts-GovfoW-rowButton:focus-visible) .a8ccharts-GovfoW-valueContainer {
|
|
813
817
|
transform: translateX(var(--a8c-charts-dimension-leaderboard-bar-hover-inset));
|
|
814
818
|
}
|
|
815
819
|
|
|
@@ -819,6 +823,39 @@
|
|
|
819
823
|
outline-offset: calc(-1 * var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)));
|
|
820
824
|
}
|
|
821
825
|
|
|
826
|
+
.a8ccharts-GovfoW-layeredRow {
|
|
827
|
+
isolation: isolate;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
.a8ccharts-GovfoW-layeredRow > :not(.a8ccharts-GovfoW-rowButton, .a8ccharts-GovfoW-chevron) {
|
|
831
|
+
z-index: 1;
|
|
832
|
+
pointer-events: none;
|
|
833
|
+
position: relative;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
.a8ccharts-GovfoW-layeredRow :is(a, button):not(.a8ccharts-GovfoW-rowButton) {
|
|
837
|
+
z-index: 1;
|
|
838
|
+
pointer-events: auto;
|
|
839
|
+
position: relative;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
.a8ccharts-GovfoW-rowButton {
|
|
843
|
+
appearance: none;
|
|
844
|
+
cursor: pointer;
|
|
845
|
+
z-index: 0;
|
|
846
|
+
background: none;
|
|
847
|
+
border: 0;
|
|
848
|
+
padding: 0;
|
|
849
|
+
position: absolute;
|
|
850
|
+
inset: 0;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
.a8ccharts-GovfoW-rowButton:focus-visible {
|
|
854
|
+
border-radius: var(--wpds-border-radius-sm, 2px);
|
|
855
|
+
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9));
|
|
856
|
+
outline-offset: calc(-1 * var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)));
|
|
857
|
+
}
|
|
858
|
+
|
|
822
859
|
.a8ccharts-GovfoW-chevron {
|
|
823
860
|
inset-inline-end: var(--wpds-dimension-padding-xs, 4px);
|
|
824
861
|
opacity: 0;
|
|
@@ -840,6 +877,19 @@
|
|
|
840
877
|
transition: none;
|
|
841
878
|
}
|
|
842
879
|
}
|
|
880
|
+
.a8ccharts-V2HDKq-selected-ring__contrast, .a8ccharts-V2HDKq-selected-ring__focus {
|
|
881
|
+
fill: none;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.a8ccharts-V2HDKq-selected-ring__contrast {
|
|
885
|
+
stroke: var(--a8c-charts-color-background, #fff);
|
|
886
|
+
stroke-width: calc(4 * var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)));
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
.a8ccharts-V2HDKq-selected-ring__focus {
|
|
890
|
+
stroke: var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9));
|
|
891
|
+
stroke-width: calc(2 * var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)));
|
|
892
|
+
}
|
|
843
893
|
.a8ccharts-gnszbG-pie-chart__plot {
|
|
844
894
|
position: relative;
|
|
845
895
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -145,7 +145,7 @@ type DataPointDate = {
|
|
|
145
145
|
/** Per-point fill override for BarChart; other built-in charts ignore it. */
|
|
146
146
|
color?: string;
|
|
147
147
|
};
|
|
148
|
-
type
|
|
148
|
+
type LeaderboardEntryFields = {
|
|
149
149
|
/**
|
|
150
150
|
* Unique internal key (e.g., 'key-direct')
|
|
151
151
|
*/
|
|
@@ -191,7 +191,8 @@ type LeaderboardEntry = {
|
|
|
191
191
|
* For links or other interactive affordances (external-link icons, info
|
|
192
192
|
* tooltips), put them in the `label` render prop instead of using onClick —
|
|
193
193
|
* a row is either a button (onClick) or carries interactive label content,
|
|
194
|
-
* never both, since interactive elements cannot be nested in HTML.
|
|
194
|
+
* never both, since interactive elements cannot be nested in HTML. The
|
|
195
|
+
* exception is a row that sets `hasInteractiveLabel`.
|
|
195
196
|
*/
|
|
196
197
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
197
198
|
/**
|
|
@@ -205,6 +206,18 @@ type LeaderboardEntry = {
|
|
|
205
206
|
*/
|
|
206
207
|
ariaLabel?: string;
|
|
207
208
|
};
|
|
209
|
+
type LeaderboardEntry = LeaderboardEntryFields & ({
|
|
210
|
+
hasInteractiveLabel?: false;
|
|
211
|
+
} | {
|
|
212
|
+
/**
|
|
213
|
+
* Set when the `label` holds its own link or button. The row's button
|
|
214
|
+
* then sits behind the row instead of around it, so both stay operable.
|
|
215
|
+
* Requires `onClick`, and `ariaLabel` since the button wraps no text.
|
|
216
|
+
*/
|
|
217
|
+
hasInteractiveLabel: true;
|
|
218
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
219
|
+
ariaLabel: string;
|
|
220
|
+
});
|
|
208
221
|
type GradientStop = {
|
|
209
222
|
offset: string;
|
|
210
223
|
color?: string;
|
|
@@ -880,14 +893,14 @@ type LineChartAnnotationProps = {
|
|
|
880
893
|
subjectType?: 'circle' | 'line-vertical' | 'line-horizontal';
|
|
881
894
|
styles?: AnnotationStyles;
|
|
882
895
|
testId?: string;
|
|
883
|
-
renderLabel?:
|
|
896
|
+
renderLabel?: (props: {
|
|
884
897
|
title: string;
|
|
885
898
|
subtitle?: string;
|
|
886
|
-
}
|
|
887
|
-
renderLabelPopover?:
|
|
899
|
+
}) => ReactNode;
|
|
900
|
+
renderLabelPopover?: (props: {
|
|
888
901
|
title: string;
|
|
889
902
|
subtitle?: string;
|
|
890
|
-
}
|
|
903
|
+
}) => ReactNode;
|
|
891
904
|
};
|
|
892
905
|
type CurveType = 'smooth' | 'linear' | 'monotone';
|
|
893
906
|
type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
|
|
@@ -895,6 +908,8 @@ type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
|
|
|
895
908
|
position?: 'start' | 'end';
|
|
896
909
|
};
|
|
897
910
|
interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
911
|
+
/** Accessible name of the chart. Defaults to a localized "Line chart". */
|
|
912
|
+
ariaLabel?: string;
|
|
898
913
|
/**
|
|
899
914
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
900
915
|
*/
|
|
@@ -950,6 +965,8 @@ type TooltipDatum = {
|
|
|
950
965
|
//#endregion
|
|
951
966
|
//#region src/charts/area-chart/types.d.ts
|
|
952
967
|
interface AreaChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
968
|
+
/** Accessible name of the chart. Defaults to a localized "Area chart". */
|
|
969
|
+
ariaLabel?: string;
|
|
953
970
|
/**
|
|
954
971
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
955
972
|
*/
|
|
@@ -1059,6 +1076,8 @@ type BandHighlightSelection = {
|
|
|
1059
1076
|
height: number;
|
|
1060
1077
|
};
|
|
1061
1078
|
interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
1079
|
+
/** Accessible name of the chart. Defaults to a localized "Bar chart". */
|
|
1080
|
+
ariaLabel?: string;
|
|
1062
1081
|
/**
|
|
1063
1082
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
1064
1083
|
*/
|
|
@@ -1398,6 +1417,8 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1398
1417
|
ariaLabel?: string;
|
|
1399
1418
|
/** Compact mode: hide in-cell values, tighten gap, thin axis labels. Default false. */
|
|
1400
1419
|
compact?: boolean;
|
|
1420
|
+
/** Compact mode only: grow the cells to fill the chart's box, wrapping the column groups onto more rows when that makes them larger. Default false. */
|
|
1421
|
+
fitCells?: boolean;
|
|
1401
1422
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
1402
1423
|
showValues?: boolean;
|
|
1403
1424
|
/**
|
|
@@ -1485,7 +1506,7 @@ type MonthCalendarHeatmapResult = {
|
|
|
1485
1506
|
//#endregion
|
|
1486
1507
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
1487
1508
|
interface HeatmapLegendProps {
|
|
1488
|
-
/** Number of swatches in the scale. Default 5. */
|
|
1509
|
+
/** Number of color swatches in the scale, not counting the empty-cell swatch. Default 5. */
|
|
1489
1510
|
steps?: number;
|
|
1490
1511
|
/**
|
|
1491
1512
|
* `swatches` spaces the steps out as cell-sized squares; `bar` joins them
|
|
@@ -1550,7 +1571,12 @@ declare const useCalendarHeatmapData: (series: DataPointDate[], options?: Calend
|
|
|
1550
1571
|
declare const useMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1551
1572
|
//#endregion
|
|
1552
1573
|
//#region src/charts/leaderboard-chart/types.d.ts
|
|
1553
|
-
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | '
|
|
1574
|
+
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
1575
|
+
/**
|
|
1576
|
+
* Entries to display. Declared here rather than picked, since the base type
|
|
1577
|
+
* would split the entry union into one array type per member.
|
|
1578
|
+
*/
|
|
1579
|
+
data: LeaderboardEntry[];
|
|
1554
1580
|
/**
|
|
1555
1581
|
* Whether to show comparison data
|
|
1556
1582
|
*/
|
|
@@ -1936,6 +1962,10 @@ interface PieChartProps extends BaseChartProps<DataPointPercentage[]> {
|
|
|
1936
1962
|
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
1937
1963
|
*/
|
|
1938
1964
|
renderTooltip?: (params: PieChartRenderTooltipParams) => ReactNode;
|
|
1965
|
+
/**
|
|
1966
|
+
* Accessible name of the chart. Defaults to a localized "Pie chart".
|
|
1967
|
+
*/
|
|
1968
|
+
ariaLabel?: string;
|
|
1939
1969
|
}
|
|
1940
1970
|
type PieChartBaseProps = Optional<PieChartProps, 'size'>;
|
|
1941
1971
|
type PieChartComponent = ChartComponentWithComposition<PieChartBaseProps>;
|
|
@@ -2002,6 +2032,10 @@ interface PieSemiCircleChartProps extends BaseChartProps<DataPointPercentage[]>
|
|
|
2002
2032
|
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
2003
2033
|
*/
|
|
2004
2034
|
renderTooltip?: (params: PieSemiCircleChartRenderTooltipParams) => ReactNode;
|
|
2035
|
+
/**
|
|
2036
|
+
* Accessible name of the chart. Defaults to a localized "Semi-circle chart".
|
|
2037
|
+
*/
|
|
2038
|
+
ariaLabel?: string;
|
|
2005
2039
|
}
|
|
2006
2040
|
type PieSemiCircleChartBaseProps = Optional<PieSemiCircleChartProps, 'width'>;
|
|
2007
2041
|
type PieSemiCircleChartComponent = ChartComponentWithComposition<PieSemiCircleChartBaseProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -145,7 +145,7 @@ type DataPointDate = {
|
|
|
145
145
|
/** Per-point fill override for BarChart; other built-in charts ignore it. */
|
|
146
146
|
color?: string;
|
|
147
147
|
};
|
|
148
|
-
type
|
|
148
|
+
type LeaderboardEntryFields = {
|
|
149
149
|
/**
|
|
150
150
|
* Unique internal key (e.g., 'key-direct')
|
|
151
151
|
*/
|
|
@@ -191,7 +191,8 @@ type LeaderboardEntry = {
|
|
|
191
191
|
* For links or other interactive affordances (external-link icons, info
|
|
192
192
|
* tooltips), put them in the `label` render prop instead of using onClick —
|
|
193
193
|
* a row is either a button (onClick) or carries interactive label content,
|
|
194
|
-
* never both, since interactive elements cannot be nested in HTML.
|
|
194
|
+
* never both, since interactive elements cannot be nested in HTML. The
|
|
195
|
+
* exception is a row that sets `hasInteractiveLabel`.
|
|
195
196
|
*/
|
|
196
197
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
197
198
|
/**
|
|
@@ -205,6 +206,18 @@ type LeaderboardEntry = {
|
|
|
205
206
|
*/
|
|
206
207
|
ariaLabel?: string;
|
|
207
208
|
};
|
|
209
|
+
type LeaderboardEntry = LeaderboardEntryFields & ({
|
|
210
|
+
hasInteractiveLabel?: false;
|
|
211
|
+
} | {
|
|
212
|
+
/**
|
|
213
|
+
* Set when the `label` holds its own link or button. The row's button
|
|
214
|
+
* then sits behind the row instead of around it, so both stay operable.
|
|
215
|
+
* Requires `onClick`, and `ariaLabel` since the button wraps no text.
|
|
216
|
+
*/
|
|
217
|
+
hasInteractiveLabel: true;
|
|
218
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
219
|
+
ariaLabel: string;
|
|
220
|
+
});
|
|
208
221
|
type GradientStop = {
|
|
209
222
|
offset: string;
|
|
210
223
|
color?: string;
|
|
@@ -880,14 +893,14 @@ type LineChartAnnotationProps = {
|
|
|
880
893
|
subjectType?: 'circle' | 'line-vertical' | 'line-horizontal';
|
|
881
894
|
styles?: AnnotationStyles;
|
|
882
895
|
testId?: string;
|
|
883
|
-
renderLabel?:
|
|
896
|
+
renderLabel?: (props: {
|
|
884
897
|
title: string;
|
|
885
898
|
subtitle?: string;
|
|
886
|
-
}
|
|
887
|
-
renderLabelPopover?:
|
|
899
|
+
}) => ReactNode;
|
|
900
|
+
renderLabelPopover?: (props: {
|
|
888
901
|
title: string;
|
|
889
902
|
subtitle?: string;
|
|
890
|
-
}
|
|
903
|
+
}) => ReactNode;
|
|
891
904
|
};
|
|
892
905
|
type CurveType = 'smooth' | 'linear' | 'monotone';
|
|
893
906
|
type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
|
|
@@ -895,6 +908,8 @@ type RenderLineGlyphProps<Datum extends object> = GlyphProps<Datum> & {
|
|
|
895
908
|
position?: 'start' | 'end';
|
|
896
909
|
};
|
|
897
910
|
interface LineChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
911
|
+
/** Accessible name of the chart. Defaults to a localized "Line chart". */
|
|
912
|
+
ariaLabel?: string;
|
|
898
913
|
/**
|
|
899
914
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
900
915
|
*/
|
|
@@ -950,6 +965,8 @@ type TooltipDatum = {
|
|
|
950
965
|
//#endregion
|
|
951
966
|
//#region src/charts/area-chart/types.d.ts
|
|
952
967
|
interface AreaChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
968
|
+
/** Accessible name of the chart. Defaults to a localized "Area chart". */
|
|
969
|
+
ariaLabel?: string;
|
|
953
970
|
/**
|
|
954
971
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
955
972
|
*/
|
|
@@ -1059,6 +1076,8 @@ type BandHighlightSelection = {
|
|
|
1059
1076
|
height: number;
|
|
1060
1077
|
};
|
|
1061
1078
|
interface BarChartProps extends BaseChartProps<SeriesData[]>, SeriesVisibilityProps {
|
|
1079
|
+
/** Accessible name of the chart. Defaults to a localized "Bar chart". */
|
|
1080
|
+
ariaLabel?: string;
|
|
1062
1081
|
/**
|
|
1063
1082
|
* Legend configuration. Supports `collapseGroups` on top of the shared options.
|
|
1064
1083
|
*/
|
|
@@ -1398,6 +1417,8 @@ interface HeatmapChartProps extends Omit<BaseChartProps<HeatmapColumn[]>, 'showL
|
|
|
1398
1417
|
ariaLabel?: string;
|
|
1399
1418
|
/** Compact mode: hide in-cell values, tighten gap, thin axis labels. Default false. */
|
|
1400
1419
|
compact?: boolean;
|
|
1420
|
+
/** Compact mode only: grow the cells to fill the chart's box, wrapping the column groups onto more rows when that makes them larger. Default false. */
|
|
1421
|
+
fitCells?: boolean;
|
|
1401
1422
|
/** Render the numeric value inside each cell. Default `! compact`. */
|
|
1402
1423
|
showValues?: boolean;
|
|
1403
1424
|
/**
|
|
@@ -1485,7 +1506,7 @@ type MonthCalendarHeatmapResult = {
|
|
|
1485
1506
|
//#endregion
|
|
1486
1507
|
//#region src/charts/heatmap-chart/private/heatmap-legend.d.ts
|
|
1487
1508
|
interface HeatmapLegendProps {
|
|
1488
|
-
/** Number of swatches in the scale. Default 5. */
|
|
1509
|
+
/** Number of color swatches in the scale, not counting the empty-cell swatch. Default 5. */
|
|
1489
1510
|
steps?: number;
|
|
1490
1511
|
/**
|
|
1491
1512
|
* `swatches` spaces the steps out as cell-sized squares; `bar` joins them
|
|
@@ -1550,7 +1571,12 @@ declare const useCalendarHeatmapData: (series: DataPointDate[], options?: Calend
|
|
|
1550
1571
|
declare const useMonthCalendarHeatmapData: (valueByDay: Record<string, number | null>, range: MonthCalendarHeatmapRange, options?: MonthCalendarHeatmapOptions) => MonthCalendarHeatmapResult;
|
|
1551
1572
|
//#endregion
|
|
1552
1573
|
//#region src/charts/leaderboard-chart/types.d.ts
|
|
1553
|
-
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | '
|
|
1574
|
+
interface LeaderboardChartProps extends Pick<BaseChartProps<LeaderboardEntry>, 'className' | 'showLegend' | 'legend' | 'chartId' | 'width' | 'height' | 'size' | 'gap' | 'animation'> {
|
|
1575
|
+
/**
|
|
1576
|
+
* Entries to display. Declared here rather than picked, since the base type
|
|
1577
|
+
* would split the entry union into one array type per member.
|
|
1578
|
+
*/
|
|
1579
|
+
data: LeaderboardEntry[];
|
|
1554
1580
|
/**
|
|
1555
1581
|
* Whether to show comparison data
|
|
1556
1582
|
*/
|
|
@@ -1936,6 +1962,10 @@ interface PieChartProps extends BaseChartProps<DataPointPercentage[]> {
|
|
|
1936
1962
|
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
1937
1963
|
*/
|
|
1938
1964
|
renderTooltip?: (params: PieChartRenderTooltipParams) => ReactNode;
|
|
1965
|
+
/**
|
|
1966
|
+
* Accessible name of the chart. Defaults to a localized "Pie chart".
|
|
1967
|
+
*/
|
|
1968
|
+
ariaLabel?: string;
|
|
1939
1969
|
}
|
|
1940
1970
|
type PieChartBaseProps = Optional<PieChartProps, 'size'>;
|
|
1941
1971
|
type PieChartComponent = ChartComponentWithComposition<PieChartBaseProps>;
|
|
@@ -2002,6 +2032,10 @@ interface PieSemiCircleChartProps extends BaseChartProps<DataPointPercentage[]>
|
|
|
2002
2032
|
* When provided, replaces the default `label: value` tooltip with custom content.
|
|
2003
2033
|
*/
|
|
2004
2034
|
renderTooltip?: (params: PieSemiCircleChartRenderTooltipParams) => ReactNode;
|
|
2035
|
+
/**
|
|
2036
|
+
* Accessible name of the chart. Defaults to a localized "Semi-circle chart".
|
|
2037
|
+
*/
|
|
2038
|
+
ariaLabel?: string;
|
|
2005
2039
|
}
|
|
2006
2040
|
type PieSemiCircleChartBaseProps = Optional<PieSemiCircleChartProps, 'width'>;
|
|
2007
2041
|
type PieSemiCircleChartComponent = ChartComponentWithComposition<PieSemiCircleChartBaseProps>;
|