Skip to content

Commit dc5ad7f

Browse files
committed
fix: improve naming
1 parent 58d4f57 commit dc5ad7f

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/core/__tests__/chart-core-legend.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,13 @@ describe("CoreChart: legend", () => {
453453
});
454454
});
455455

456-
test("calls onLegendHover when hovering over a legend item", () => {
457-
const onLegendHover = vi.fn();
458-
const { wrapper } = renderChart({ highcharts, options: { series }, onLegendHover });
456+
test("calls onLegendItemHighlight when hovering over a legend item", () => {
457+
const onLegendItemHighlight = vi.fn();
458+
const { wrapper } = renderChart({ highcharts, options: { series }, onLegendItemHighlight });
459459

460460
hoverLegendItem(0, wrapper);
461461

462-
expect(onLegendHover).toHaveBeenCalledWith(
462+
expect(onLegendItemHighlight).toHaveBeenCalledWith(
463463
expect.objectContaining({
464464
item: expect.objectContaining({
465465
id: "L1",

src/core/__tests__/common.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function StatefulChart(props: CoreChartProps) {
3333
}
3434

3535
type TestProps = Partial<CoreChartProps> & {
36-
onLegendHover?: () => void;
36+
onLegendItemHighlight?: () => void;
3737
i18nProvider?: Record<string, Record<string, string>>;
3838
};
3939

src/core/chart-core.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function InternalCoreChart({
5858
filter,
5959
keyboardNavigation = true,
6060
onHighlight,
61-
onLegendHover,
61+
onLegendItemHighlight,
6262
onClearHighlight,
6363
onVisibleItemsChange,
6464
visibleItems,
@@ -308,7 +308,7 @@ export function InternalCoreChart({
308308
position={legendPosition}
309309
api={api}
310310
i18nStrings={i18nStrings}
311-
onItemHover={onLegendHover}
311+
onItemHighlight={onLegendItemHighlight}
312312
getLegendTooltipContent={rest.getLegendTooltipContent}
313313
/>
314314
) : null

src/core/components/core-legend.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ export function ChartLegend({
1414
actions,
1515
position,
1616
i18nStrings,
17-
onItemHover,
17+
onItemHighlight,
1818
getLegendTooltipContent,
1919
}: {
2020
api: ChartAPI;
2121
title?: string;
2222
actions?: React.ReactNode;
2323
position: "bottom" | "side";
2424
i18nStrings?: BaseI18nStrings;
25-
onItemHover?: (detail: CoreChartProps.LegendHoverDetail) => void;
25+
onItemHighlight?: (detail: CoreChartProps.LegendHoverDetail) => void;
2626
getLegendTooltipContent?: CoreChartProps.GetLegendTooltipContent;
2727
}) {
2828
const i18n = useInternalI18n("[charts]");
@@ -44,7 +44,7 @@ export function ChartLegend({
4444
onItemHighlightExit={api.onClearChartItemsHighlight}
4545
onItemHighlightEnter={(item) => {
4646
api.onHighlightChartItems([item.id]);
47-
onItemHover?.({ item });
47+
onItemHighlight?.({ item });
4848
}}
4949
getTooltipContent={(props) => {
5050
if (isChartTooltipPinned) {

src/core/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ export interface CoreChartProps
342342
*/
343343
visibleItems?: readonly string[];
344344
/**
345-
* Called when the user hovers over a legend item.
345+
* Called when a legend item is highlighted.
346346
*/
347-
onLegendHover?: (detail: CoreChartProps.LegendHoverDetail) => void;
347+
onLegendItemHighlight?: (detail: CoreChartProps.LegendHoverDetail) => void;
348348
/**
349349
* Called when series/points visibility changes due to user interaction with legend or filter.
350350
*/

0 commit comments

Comments
 (0)