Skip to content

Commit 246c772

Browse files
committed
update callback names
1 parent 6ad075e commit 246c772

File tree

13 files changed

+32
-32
lines changed

13 files changed

+32
-32
lines changed

pages/01-cartesian-chart/controlled-visibility.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function ExampleMixedChart() {
108108
valueFormatter: numberFormatter,
109109
}}
110110
visibleSeries={visibleSeries}
111-
onChangeVisibleSeries={({ detail: { visibleSeries } }) => setSettings({ visibleItems: visibleSeries.join(",") })}
111+
onVisibleSeriesChange={({ detail: { visibleSeries } }) => setSettings({ visibleItems: visibleSeries.join(",") })}
112112
emphasizeBaseline={settings.emphasizeBaseline}
113113
/>
114114
);

pages/02-pie-chart/controlled-visibility.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function ExamplePieChart() {
7676
`${segmentValue} units, ${((segmentValue / totalValue) * 100).toFixed(0)}%`
7777
}
7878
visibleSegments={visibleSegments}
79-
onChangeVisibleSegments={({ detail: { visibleSegments } }) =>
79+
onVisibleSegmentsChange={({ detail: { visibleSegments } }) =>
8080
setSettings({ visibleItems: visibleSegments.join(",") })
8181
}
8282
/>

pages/04-migration/examples/line-chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export function ComponentNew({ headerFilter, legendFilter }: { headerFilter?: bo
136136
}
137137
tooltip={{ placement: "middle" }}
138138
visibleSeries={visibleSeries}
139-
onChangeVisibleSeries={({ detail }) => setVisibleSeries(detail.visibleSeries)}
139+
onVisibleSeriesChange={({ detail }) => setVisibleSeries(detail.visibleSeries)}
140140
/>
141141
);
142142
}

pages/04-migration/examples/pie-chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function ComponentNew({
9393
) : undefined,
9494
}}
9595
visibleSegments={visibleSegments}
96-
onChangeVisibleSegments={({ detail }) => setVisibleSegments(detail.visibleSegments)}
96+
onVisibleSegmentsChange={({ detail }) => setVisibleSegments(detail.visibleSegments)}
9797
innerAreaTitle="60"
9898
innerAreaDescription="total instances"
9999
/>

src/__tests__/__snapshots__/documenter.test.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ exports[`definition for cartesian-chart matches the snapshot > cartesian-chart 1
1919
"type": "object",
2020
},
2121
"detailType": "{ visibleSeries: Array<string>; }",
22-
"name": "onChangeVisibleSeries",
22+
"name": "onVisibleSeriesChange",
2323
},
2424
],
2525
"functions": [
@@ -383,7 +383,7 @@ When set to "side", displays the title along the axis line.",
383383
},
384384
{
385385
"description": "Specifies which series to show using their IDs. By default, all series are visible and managed by the component.
386-
If a series doesn't have an ID, its name is used. When using this property, manage state updates with \`onChangeVisibleSeries\`.",
386+
If a series doesn't have an ID, its name is used. When using this property, manage state updates with \`onVisibleSeriesChange\`.",
387387
"name": "visibleSeries",
388388
"optional": true,
389389
"type": "ReadonlyArray<string>",
@@ -551,7 +551,7 @@ exports[`definition for pie-chart matches the snapshot > pie-chart 1`] = `
551551
"type": "object",
552552
},
553553
"detailType": "{ visibleSegments: Array<string>; }",
554-
"name": "onChangeVisibleSegments",
554+
"name": "onVisibleSegmentsChange",
555555
},
556556
],
557557
"functions": [
@@ -914,7 +914,7 @@ Supported series types:
914914
},
915915
{
916916
"description": "Specifies which segments to show using their IDs. By default, all segments are visible and managed by the component.
917-
If a segment doesn't have an ID, its name is used. When using this property, manage state updates with \`onChangeVisibleSegments\`.",
917+
If a segment doesn't have an ID, its name is used. When using this property, manage state updates with \`onVisibleSegmentsChange\`.",
918918
"name": "visibleSegments",
919919
"optional": true,
920920
"type": "ReadonlyArray<string>",

src/cartesian-chart/__tests__/cartesian-chart-visibility.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ function getVisibilityState() {
2323
};
2424
}
2525

26-
const onChangeVisibleSeries = vi.fn();
26+
const onVisibleSeriesChange = vi.fn();
2727

2828
afterEach(() => {
29-
onChangeVisibleSeries.mockReset();
29+
onVisibleSeriesChange.mockReset();
3030
});
3131

32-
const defaultProps = { highcharts, onChangeVisibleSeries };
32+
const defaultProps = { highcharts, onVisibleSeriesChange };
3333

3434
const lineSeries: CartesianChartProps.SeriesOptions[] = [
3535
{
@@ -74,7 +74,7 @@ describe("CartesianChart: visibility", () => {
7474
hiddenSeries: ["L1"],
7575
});
7676

77-
expect(onChangeVisibleSeries).toHaveBeenCalledWith(
77+
expect(onVisibleSeriesChange).toHaveBeenCalledWith(
7878
expect.objectContaining({
7979
detail: {
8080
visibleSeries: ["L2"],

src/cartesian-chart/__tests__/common.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const StatefulChart = forwardRef((props: CartesianChartProps, ref: React.
1919
ref={ref}
2020
{...props}
2121
visibleSeries={visibleSeries}
22-
onChangeVisibleSeries={(event) => {
22+
onVisibleSeriesChange={(event) => {
2323
setVisibleSeries(event.detail.visibleSeries);
24-
props.onChangeVisibleSeries?.(event);
24+
props.onVisibleSeriesChange?.(event);
2525
}}
2626
/>
2727
);

src/cartesian-chart/chart-cartesian-internal.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export const InternalCartesianChart = forwardRef(
3232
({ tooltip, ...props }: InternalCartesianChartProps, ref: React.Ref<CartesianChartProps.Ref>) => {
3333
const apiRef = useRef<null | CoreChartAPI>(null);
3434

35-
// When visibleSeries and onChangeVisibleSeries are provided - the series visibility can be controlled from the outside.
35+
// When visibleSeries and onVisibleSeriesChange are provided - the series visibility can be controlled from the outside.
3636
// Otherwise - the component handles series visibility using its internal state.
37-
useControllableState(props.visibleSeries, props.onChangeVisibleSeries, undefined, {
37+
useControllableState(props.visibleSeries, props.onVisibleSeriesChange, undefined, {
3838
componentName: "CartesianChart",
3939
propertyName: "visibleSeries",
40-
changeHandlerName: "onChangeVisibleSeries",
40+
changeHandlerName: "onVisibleSeriesChange",
4141
});
4242
const allSeriesIds = props.series.map((s) => getOptionsId(s));
4343
// We keep local visible series state to compute threshold series data, that depends on series visibility.
@@ -46,7 +46,7 @@ export const InternalCartesianChart = forwardRef(
4646
const onVisibleSeriesChange: CoreChartProps["onVisibleItemsChange"] = (items) => {
4747
const visibleSeries = items.filter((i) => i.visible).map((i) => i.id);
4848
if (props.visibleSeries) {
49-
fireNonCancelableEvent(props.onChangeVisibleSeries, { visibleSeries });
49+
fireNonCancelableEvent(props.onVisibleSeriesChange, { visibleSeries });
5050
} else {
5151
setVisibleSeriesLocal(visibleSeries);
5252
}

src/cartesian-chart/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,14 @@ export interface CartesianChartProps
9898

9999
/**
100100
* Specifies which series to show using their IDs. By default, all series are visible and managed by the component.
101-
* If a series doesn't have an ID, its name is used. When using this property, manage state updates with `onChangeVisibleSeries`.
101+
* If a series doesn't have an ID, its name is used. When using this property, manage state updates with `onVisibleSeriesChange`.
102102
*/
103103
visibleSeries?: readonly string[];
104104

105105
/**
106106
* A callback function, triggered when series visibility changes as a result of user interaction with the legend or filter.
107107
*/
108-
onChangeVisibleSeries?: NonCancelableEventHandler<{ visibleSeries: string[] }>;
108+
onVisibleSeriesChange?: NonCancelableEventHandler<{ visibleSeries: string[] }>;
109109
}
110110

111111
export namespace CartesianChartProps {

src/pie-chart/__tests__/common.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export const StatefulChart = forwardRef((props: PieChartProps, ref: React.Ref<Pi
1919
ref={ref}
2020
{...props}
2121
visibleSegments={visibleSegments}
22-
onChangeVisibleSegments={(event) => {
22+
onVisibleSegmentsChange={(event) => {
2323
setVisibleSegments(event.detail.visibleSegments);
24-
props.onChangeVisibleSegments?.(event);
24+
props.onVisibleSegmentsChange?.(event);
2525
}}
2626
/>
2727
);

0 commit comments

Comments
 (0)