@@ -12,7 +12,6 @@ import { CoreChartProps } from "../core/interfaces";
1212import { getOptionsId } from "../core/utils" ;
1313import { InternalBaseComponentProps } from "../internal/base-component/use-base-component" ;
1414import * as Styles from "../internal/chart-styles" ;
15- import ChartSeriesDetails from "../internal/components/series-details" ;
1615import { fireNonCancelableEvent } from "../internal/events" ;
1716import { SomeRequired , Writeable } from "../internal/utils/utils" ;
1817import { useInnerArea } from "./chart-inner-area" ;
@@ -62,29 +61,24 @@ export const InternalPieChart = forwardRef(
6261 // We convert pie tooltip options to the core chart's getTooltipContent callback,
6362 // ensuring no internal types are exposed to the consumer-defined render functions.
6463 const getTooltipContent : CoreChartProps [ "getTooltipContent" ] = ( ) => {
65- const transformSlotProps = ( props : CoreChartProps . TooltipSlotProps ) : PieChartProps . TooltipDetailsRenderProps => {
66- const point = props . items [ 0 ] . point ;
64+ const transformDetailsProps = ( {
65+ point,
66+ } : CoreChartProps . TooltipDetailsProps ) : PieChartProps . TooltipDetailsRenderProps => {
6767 return {
6868 totalValue : point . total ?? 0 ,
6969 segmentValue : point . y ?? 0 ,
7070 segmentId : getOptionsId ( point . options ) ,
7171 segmentName : point . name ?? "" ,
7272 } ;
7373 } ;
74+ const transformSlotProps = ( props : CoreChartProps . TooltipSlotProps ) : PieChartProps . TooltipDetailsRenderProps => {
75+ const point = props . items [ 0 ] . point ;
76+ return transformDetailsProps ( { point } ) ;
77+ } ;
7478 return {
7579 header : tooltip ?. header ? ( props ) => tooltip . header ! ( transformSlotProps ( props ) ) : undefined ,
76- body :
77- tooltip ?. body || tooltip ?. details
78- ? ( props ) =>
79- tooltip . body ? (
80- tooltip . body ( transformSlotProps ( props ) )
81- ) : (
82- < ChartSeriesDetails
83- details = { tooltip ?. details ?.( transformSlotProps ( props ) ) ?? [ ] }
84- compactList = { true }
85- />
86- )
87- : undefined ,
80+ details : tooltip ?. details ? ( props ) => tooltip . details ! ( transformDetailsProps ( props ) ) : undefined ,
81+ body : tooltip ?. body ? ( props ) => tooltip . body ! ( transformSlotProps ( props ) ) : undefined ,
8882 footer : tooltip ?. footer ? ( props ) => tooltip . footer ! ( transformSlotProps ( props ) ) : undefined ,
8983 } ;
9084 } ;
0 commit comments