Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/charts/src/components/PieChart/PieChart.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.piechart {
g:focus,
path:focus {
outline: none;
}
}
15 changes: 4 additions & 11 deletions packages/charts/src/components/PieChart/PieChart.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use client';

import { enrichEventWithDetails } from '@ui5/webcomponents-react-base';
import { enrichEventWithDetails, useStylesheet } from '@ui5/webcomponents-react-base';
import { clsx } from 'clsx';
import type { CSSProperties } from 'react';
import React, { cloneElement, forwardRef, isValidElement, useCallback, useMemo } from 'react';
import { createUseStyles } from 'react-jss';
import {
Cell,
Label as RechartsLabel,
Expand All @@ -25,15 +24,9 @@ import type { IPolarChartConfig } from '../../interfaces/IPolarChartConfig.js';
import { ChartContainer } from '../../internal/ChartContainer.js';
import { defaultFormatter } from '../../internal/defaults.js';
import { tooltipContentStyle, tooltipFillOpacity } from '../../internal/staticProps.js';
import { classNames, styleData } from './PieChart.module.css.js';
import { PieChartPlaceholder } from './Placeholder.js';

const useStyles = createUseStyles(
{
piechart: { '& g:focus,& path:focus': { outline: 'none' } }
},
{ name: 'PieChartStyles' }
);

interface MeasureConfig extends Omit<IChartMeasure, 'accessor' | 'label' | 'color' | 'hideDataLabel'> {
/**
* A string containing the path to the dataset key this pie should display.
Expand Down Expand Up @@ -114,7 +107,7 @@ const PieChart = forwardRef<HTMLDivElement, PieChartProps>((props, ref) => {
...rest
} = props;

const classes = useStyles();
useStylesheet(styleData, PieChart.displayName);

const chartConfig = {
margin: { right: 30, left: 30, bottom: 30, top: 30, ...(props.chartConfig?.margin ?? {}) },
Expand Down Expand Up @@ -286,7 +279,7 @@ const PieChart = forwardRef<HTMLDivElement, PieChartProps>((props, ref) => {
margin={chartConfig.margin}
className={clsx(
typeof onDataPointClick === 'function' || typeof onClick === 'function' ? 'has-click-handler' : undefined,
classes.piechart
classNames.piechart
)}
>
<Pie
Expand Down