Skip to content

Commit ede029e

Browse files
authored
refactor(PieChart): replace react-jss with css module (#5718)
1 parent f0077f0 commit ede029e

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.piechart {
2+
g:focus,
3+
path:focus {
4+
outline: none;
5+
}
6+
}

packages/charts/src/components/PieChart/PieChart.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
'use client';
22

3-
import { enrichEventWithDetails } from '@ui5/webcomponents-react-base';
3+
import { enrichEventWithDetails, useStylesheet } from '@ui5/webcomponents-react-base';
44
import { clsx } from 'clsx';
55
import type { CSSProperties } from 'react';
66
import React, { cloneElement, forwardRef, isValidElement, useCallback, useMemo } from 'react';
7-
import { createUseStyles } from 'react-jss';
87
import {
98
Cell,
109
Label as RechartsLabel,
@@ -25,15 +24,9 @@ import type { IPolarChartConfig } from '../../interfaces/IPolarChartConfig.js';
2524
import { ChartContainer } from '../../internal/ChartContainer.js';
2625
import { defaultFormatter } from '../../internal/defaults.js';
2726
import { tooltipContentStyle, tooltipFillOpacity } from '../../internal/staticProps.js';
27+
import { classNames, styleData } from './PieChart.module.css.js';
2828
import { PieChartPlaceholder } from './Placeholder.js';
2929

30-
const useStyles = createUseStyles(
31-
{
32-
piechart: { '& g:focus,& path:focus': { outline: 'none' } }
33-
},
34-
{ name: 'PieChartStyles' }
35-
);
36-
3730
interface MeasureConfig extends Omit<IChartMeasure, 'accessor' | 'label' | 'color' | 'hideDataLabel'> {
3831
/**
3932
* A string containing the path to the dataset key this pie should display.
@@ -114,7 +107,7 @@ const PieChart = forwardRef<HTMLDivElement, PieChartProps>((props, ref) => {
114107
...rest
115108
} = props;
116109

117-
const classes = useStyles();
110+
useStylesheet(styleData, PieChart.displayName);
118111

119112
const chartConfig = {
120113
margin: { right: 30, left: 30, bottom: 30, top: 30, ...(props.chartConfig?.margin ?? {}) },
@@ -286,7 +279,7 @@ const PieChart = forwardRef<HTMLDivElement, PieChartProps>((props, ref) => {
286279
margin={chartConfig.margin}
287280
className={clsx(
288281
typeof onDataPointClick === 'function' || typeof onClick === 'function' ? 'has-click-handler' : undefined,
289-
classes.piechart
282+
classNames.piechart
290283
)}
291284
>
292285
<Pie

0 commit comments

Comments
 (0)