@@ -5,7 +5,7 @@ import { enrichEventWithDetails, ThemingParameters } from '@ui5/webcomponents-re
5
5
import type { CSSProperties } from 'react' ;
6
6
import { forwardRef } from 'react' ;
7
7
import { PolarAngleAxis , RadialBar , RadialBarChart } from 'recharts' ;
8
- import { useOnClickInternal } from '../../hooks/useOnClickInternal .js' ;
8
+ import type { CategoricalChartFunc } from 'recharts/types/chart/types .js' ;
9
9
import type { IChartBaseProps } from '../../interfaces/IChartBaseProps.js' ;
10
10
import { ChartContainer } from '../../internal/ChartContainer.js' ;
11
11
import { PieChartPlaceholder } from '../PieChart/Placeholder.js' ;
@@ -18,6 +18,7 @@ interface RadialChartConfig {
18
18
19
19
[ rest : string ] : any ;
20
20
}
21
+
21
22
export interface RadialChartProps
22
23
extends Omit < CommonProps , 'onClick' | 'children' | 'onLegendClick' > ,
23
24
Pick < IChartBaseProps , 'loading' | 'loadingDelay' > {
@@ -57,7 +58,7 @@ export interface RadialChartProps
57
58
*/
58
59
onClick ?: (
59
60
event : CustomEvent < {
60
- // todo: map new values to old ones to prevent breaking changes
61
+ // todo: remove payload and activePayloads in next major?
61
62
payload : unknown ;
62
63
activePayloads : Record < string , unknown > [ ] ;
63
64
dataIndex : number ;
@@ -127,7 +128,15 @@ const RadialChart = forwardRef<HTMLDivElement, RadialChartProps>((props, ref) =>
127
128
}
128
129
} ;
129
130
130
- const onClickInternal = useOnClickInternal ( onClick ) ;
131
+ const handleOnClick : CategoricalChartFunc = ( _ , e ) => {
132
+ onClick (
133
+ // @ts -expect-error: enrichEventWithDetails expects a CustomEvent
134
+ enrichEventWithDetails ( e , {
135
+ // @ts -expect-error: detail property exists
136
+ activePayloads : [ e . detail . payload ] ,
137
+ } ) ,
138
+ ) ;
139
+ } ;
131
140
132
141
return (
133
142
< ChartContainer
@@ -143,7 +152,7 @@ const RadialChart = forwardRef<HTMLDivElement, RadialChartProps>((props, ref) =>
143
152
{ ...rest }
144
153
>
145
154
< RadialBarChart
146
- onClick = { onClickInternal }
155
+ onClick = { handleOnClick }
147
156
innerRadius = "90%"
148
157
outerRadius = "100%"
149
158
barSize = { 10 }
@@ -168,8 +177,9 @@ const RadialChart = forwardRef<HTMLDivElement, RadialChartProps>((props, ref) =>
168
177
y = "50%"
169
178
textAnchor = "middle"
170
179
dominantBaseline = "middle"
171
- className = "progress-label"
172
- style = { { ...defaultDisplayValueStyles , ...displayValueStyle } }
180
+ //todo: why do we need this?
181
+ // className="progress-label"
182
+ style = { displayValueStyle }
173
183
>
174
184
{ displayValue }
175
185
</ text >
0 commit comments