11'use client' ;
22
3- import { ThemingParameters } from '@ui5/webcomponents-react-base' ;
3+ import { ThemingParameters , useStylesheet } from '@ui5/webcomponents-react-base' ;
4+ import { clsx } from 'clsx' ;
45import type { CSSProperties } from 'react' ;
56import { forwardRef , useId } from 'react' ;
67import type { TooltipProps , YAxisProps } from 'recharts' ;
@@ -13,6 +14,7 @@ import type { IChartDimension } from '../../interfaces/IChartDimension.js';
1314import type { IChartMeasure } from '../../interfaces/IChartMeasure.js' ;
1415import { defaultFormatter } from '../../internal/defaults.js' ;
1516import { ComposedChart } from '../ComposedChart/index.js' ;
17+ import { classNames , content } from './ColumnChartWithTrend.module.css.js' ;
1618import { ColumnChartWithTrendPlaceholder } from './Placeholder.js' ;
1719
1820interface MeasureConfig extends IChartMeasure {
@@ -111,9 +113,7 @@ const ColumnChartWithTrend = forwardRef<HTMLDivElement, ColumnChartWithTrendProp
111113 loading,
112114 loadingDelay,
113115 dataset,
114- style,
115116 className,
116- slot,
117117 onClick,
118118 noLegend,
119119 noAnimation,
@@ -122,9 +122,10 @@ const ColumnChartWithTrend = forwardRef<HTMLDivElement, ColumnChartWithTrendProp
122122 ChartPlaceholder,
123123 ...rest
124124 } = props ;
125-
126125 const syncId = useId ( ) ;
127126
127+ useStylesheet ( content , ColumnChartWithTrend . displayName ) ;
128+
128129 const chartConfig : ColumnChartWithTrendProps [ 'chartConfig' ] = {
129130 yAxisVisible : false ,
130131 xAxisVisible : true ,
@@ -165,25 +166,19 @@ const ColumnChartWithTrend = forwardRef<HTMLDivElement, ColumnChartWithTrendProp
165166 const { chartConfig : _0 , dimensions : _1 , measures : _2 , ...propsWithoutOmitted } = rest ;
166167
167168 return (
168- < div
169- ref = { ref }
170- style = { { display : 'flex' , flexDirection : 'column' , height : style ?. height , width : style ?. width , ...style } }
171- className = { className }
172- slot = { slot }
173- { ...propsWithoutOmitted }
174- >
169+ < div ref = { ref } className = { clsx ( className , classNames . container ) } { ...propsWithoutOmitted } >
175170 { dataset ?. length !== 0 && (
176171 < ComposedChart
177- className = {
178- typeof onDataPointClick === 'function' || typeof onClick === 'function' ? 'has-click-handler' : undefined
179- }
172+ className = { clsx (
173+ typeof onDataPointClick === 'function' || typeof onClick === 'function' ? 'has-click-handler' : undefined ,
174+ classNames . trendContainer
175+ ) }
180176 tooltipConfig = { lineTooltipConfig }
181177 noAnimation = { noAnimation }
182178 loading = { loading }
183179 loadingDelay = { loadingDelay }
184180 onClick = { onClick }
185181 syncId = { syncId }
186- style = { { ...style , height : `calc(${ style ?. height } * 0.2)` } }
187182 dataset = { dataset }
188183 measures = { lineMeasures }
189184 dimensions = { dimensions }
@@ -201,6 +196,10 @@ const ColumnChartWithTrend = forwardRef<HTMLDivElement, ColumnChartWithTrendProp
201196 />
202197 ) }
203198 < ComposedChart
199+ className = { clsx (
200+ typeof onDataPointClick === 'function' || typeof onClick === 'function' ? 'has-click-handler' : undefined ,
201+ classNames . chartContainer
202+ ) }
204203 onLegendClick = { onLegendClick }
205204 tooltipConfig = { columnTooltipConfig }
206205 noAnimation = { noAnimation }
@@ -215,10 +214,6 @@ const ColumnChartWithTrend = forwardRef<HTMLDivElement, ColumnChartWithTrendProp
215214 measures = { columnMeasures }
216215 dimensions = { dimensions }
217216 chartConfig = { chartConfig }
218- style = { { ...style , height : `calc(${ style ?. height } * ${ dataset ?. length !== 0 ? 0.8 : 1 } )` } }
219- className = {
220- typeof onDataPointClick === 'function' || typeof onClick === 'function' ? 'has-click-handler' : undefined
221- }
222217 />
223218 </ div >
224219 ) ;
0 commit comments