@centreon/ui 24.4.45-develop.0 → 24.4.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/package.json +5 -1
  2. package/src/Graph/BarStack/BarStack.cypress.spec.tsx +154 -0
  3. package/src/Graph/BarStack/BarStack.stories.tsx +123 -0
  4. package/src/Graph/BarStack/BarStack.styles.ts +36 -0
  5. package/src/Graph/BarStack/BarStack.tsx +14 -0
  6. package/src/Graph/BarStack/ResponsiveBarStack.tsx +208 -0
  7. package/src/Graph/BarStack/index.ts +1 -0
  8. package/src/Graph/BarStack/models.ts +19 -0
  9. package/src/Graph/BarStack/useResponsiveBarStack.ts +139 -0
  10. package/src/Graph/Gauge/Gauge.cypress.spec.tsx +102 -0
  11. package/src/Graph/Gauge/Gauge.tsx +1 -1
  12. package/src/Graph/HeatMap/HeatMap.cypress.spec.tsx +145 -0
  13. package/src/Graph/HeatMap/HeatMap.stories.tsx +0 -25
  14. package/src/Graph/HeatMap/ResponsiveHeatMap.tsx +8 -2
  15. package/src/Graph/Legend/Legend.tsx +21 -0
  16. package/src/Graph/Legend/index.ts +1 -0
  17. package/src/Graph/Legend/models.ts +11 -0
  18. package/src/Graph/LineChart/Legend/Legend.styles.ts +1 -1
  19. package/src/Graph/LineChart/Legend/LegendHeader.tsx +1 -1
  20. package/src/Graph/LineChart/Legend/useInteractiveValues.ts +2 -2
  21. package/src/Graph/LineChart/index.tsx +1 -1
  22. package/src/Graph/PieChart/PieChart.cypress.spec.tsx +169 -0
  23. package/src/Graph/PieChart/PieChart.stories.tsx +194 -0
  24. package/src/Graph/PieChart/PieChart.styles.ts +39 -0
  25. package/src/Graph/PieChart/PieChart.tsx +14 -0
  26. package/src/Graph/PieChart/ResponsivePie.tsx +251 -0
  27. package/src/Graph/PieChart/index.ts +1 -0
  28. package/src/Graph/PieChart/models.ts +19 -0
  29. package/src/Graph/PieChart/useResponsivePie.ts +86 -0
  30. package/src/Graph/SingleBar/SingleBar.cypress.spec.tsx +121 -0
  31. package/src/Graph/Text/Text.cypress.spec.tsx +101 -0
  32. package/src/Graph/Text/Text.tsx +1 -1
  33. package/src/Graph/common/testUtils.ts +71 -0
  34. package/src/Graph/common/timeSeries/index.ts +19 -11
  35. package/src/Graph/common/utils.ts +19 -0
  36. package/src/Graph/index.ts +3 -0
  37. package/src/Graph/translatedLabels.ts +1 -0
  38. package/src/Listing/ActionBar/index.tsx +9 -8
  39. package/src/Listing/Cell/DataCell.styles.ts +3 -0
  40. package/src/Listing/Cell/DataCell.tsx +8 -4
  41. package/src/Listing/Listing.cypress.spec.tsx +80 -4
  42. package/src/Listing/Listing.styles.ts +3 -5
  43. package/src/Listing/index.stories.tsx +25 -2
  44. package/src/Listing/index.test.tsx +1 -1
  45. package/src/Listing/index.tsx +3 -1
  46. package/src/Listing/models.ts +1 -0
  47. package/src/api/useMutationQuery/index.test.ts +4 -4
  48. package/src/api/useMutationQuery/index.ts +24 -13
  49. package/src/components/Form/AccessRights/ShareInput/ContactSwitch.tsx +3 -3
  50. package/src/components/Form/AccessRights/ShareInput/ShareInput.tsx +1 -0
@@ -0,0 +1,169 @@
1
+ import numeral from 'numeral';
2
+
3
+ import PieChart from './PieChart';
4
+ import { ArcType, PieProps } from './models';
5
+
6
+ const defaultData = [
7
+ { color: '#88B922', label: 'Ok', value: 148 },
8
+ { color: '#999999', label: 'Unknown', value: 13 },
9
+ { color: '#F7931A', label: 'Warning', value: 16 },
10
+ { color: '#FF6666', label: 'Down', value: 62 }
11
+ ];
12
+
13
+ const dataWithNullValues = [
14
+ { color: '#88B922', label: 'Ok', value: 0 },
15
+ { color: '#999999', label: 'Unknown', value: 0 },
16
+ { color: '#F7931A', label: 'Warning', value: 0 },
17
+ { color: '#FF6666', label: 'Down', value: 0 }
18
+ ];
19
+
20
+ const total = Math.floor(
21
+ defaultData.reduce((acc, { value }) => acc + value, 0)
22
+ );
23
+
24
+ const TooltipContent = ({ label, color, value }: ArcType): JSX.Element => {
25
+ return (
26
+ <div data-testid={`tooltip-${label}`} style={{ color }}>
27
+ {label} : {value}
28
+ </div>
29
+ );
30
+ };
31
+
32
+ const initialize = ({
33
+ width = '500px',
34
+ height = '500px',
35
+ data = defaultData,
36
+ ...args
37
+ }: Omit<PieProps, 'data'> & {
38
+ data?;
39
+ height?: string;
40
+ width?: string;
41
+ }): void => {
42
+ cy.mount({
43
+ Component: (
44
+ <div style={{ height, width }}>
45
+ <PieChart {...args} data={data} />
46
+ </div>
47
+ )
48
+ });
49
+ };
50
+
51
+ describe('Pie chart', () => {
52
+ it('renders pie chart correctly with provided data', () => {
53
+ initialize({});
54
+
55
+ defaultData.forEach(({ label }) => {
56
+ cy.findByTestId(label).should('be.visible');
57
+ });
58
+
59
+ cy.makeSnapshot();
60
+ });
61
+
62
+ it('adjusts size based on the provided width and height', () => {
63
+ initialize({ displayLegend: false, height: '300px', width: '300px' });
64
+
65
+ cy.findByTestId('pieChart')
66
+ .should('have.css', 'width', '300px')
67
+ .and('have.css', 'height', '300px');
68
+
69
+ cy.makeSnapshot();
70
+ });
71
+
72
+ it('renders as a donut when variant is set to "donut"', () => {
73
+ initialize({ variant: 'donut' });
74
+ cy.get('[data-variant="donut"]').should('exist');
75
+
76
+ cy.makeSnapshot();
77
+ });
78
+
79
+ it('renders as a pie when variant is set to "pie"', () => {
80
+ initialize({ variant: 'pie' });
81
+ cy.get('[data-variant="pie"]').should('exist');
82
+
83
+ cy.makeSnapshot();
84
+ });
85
+
86
+ it('displays tooltip with correct information on hover', () => {
87
+ initialize({ TooltipContent });
88
+
89
+ defaultData.forEach(({ label, value }) => {
90
+ cy.findByTestId(label).trigger('mouseover', { force: true });
91
+
92
+ cy.findByTestId(`tooltip-${label}`)
93
+ .should('contain', label)
94
+ .and('contain', numeral(value).format('0a').toUpperCase());
95
+ });
96
+
97
+ cy.makeSnapshot();
98
+ });
99
+ it('conditionally displays values on arcs based on displayValues prop', () => {
100
+ initialize({ displayValues: true });
101
+ defaultData.forEach(({ value }, index) => {
102
+ cy.findAllByTestId('value')
103
+ .eq(index)
104
+ .children()
105
+ .eq(0)
106
+ .should('have.text', value);
107
+ });
108
+
109
+ initialize({ displayValues: false });
110
+ cy.findAllByTestId('value').should('not.exist');
111
+
112
+ cy.makeSnapshot();
113
+ });
114
+
115
+ it('displays values on arcs in percentage unit when displayValues is set to true and unit to percentage', () => {
116
+ initialize({ displayValues: true, unit: 'percentage' });
117
+ defaultData.forEach(({ value }, index) => {
118
+ cy.findAllByTestId('value')
119
+ .eq(index)
120
+ .children()
121
+ .eq(0)
122
+ .should('have.text', `${((value * 100) / total).toFixed(1)}%`);
123
+ });
124
+
125
+ cy.makeSnapshot();
126
+ });
127
+
128
+ it('displays Legend component based on displayLegend prop', () => {
129
+ initialize({ displayLegend: true });
130
+ cy.findByTestId('Legend').should('be.visible');
131
+
132
+ initialize({ displayLegend: false });
133
+ cy.findByTestId('Legend').should('not.exist');
134
+
135
+ cy.makeSnapshot();
136
+ });
137
+
138
+ it('displays the title when the title is giving', () => {
139
+ initialize({ title: 'host' });
140
+ cy.findByTestId('Title').should('be.visible');
141
+
142
+ initialize({});
143
+ cy.findByTestId('Title').should('not.exist');
144
+
145
+ cy.makeSnapshot();
146
+ });
147
+
148
+ it('adjusts outer radius when chart dimensions are too small', () => {
149
+ initialize({
150
+ displayLegend: false,
151
+ height: '120px',
152
+ title: 'hosts',
153
+ variant: 'donut',
154
+ width: '120px'
155
+ });
156
+
157
+ cy.get('[data-variant="donut"]').should('have.css', 'width', '100px');
158
+
159
+ cy.makeSnapshot();
160
+ });
161
+
162
+ it('displays a message "No Data Available" when all values are null', () => {
163
+ initialize({ data: dataWithNullValues, title: 'host' });
164
+
165
+ cy.contains('No Data Available');
166
+
167
+ cy.makeSnapshot();
168
+ });
169
+ });
@@ -0,0 +1,194 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+
3
+ import { ArcType } from './models';
4
+
5
+ import { PieChart } from '.';
6
+
7
+ const data = [
8
+ { color: '#88B922', label: 'Ok', value: 148 },
9
+ { color: '#999999', label: 'Unknown', value: 13 },
10
+ { color: '#F7931A', label: 'Warning', value: 16 },
11
+ { color: '#FF6666', label: 'Down', value: 62 }
12
+ ];
13
+
14
+ const dataWithBigNumbers = [
15
+ { color: '#88B922', label: 'Ok', value: 260000 },
16
+ { color: '#999999', label: 'Unknown', value: 1010900 },
17
+ { color: '#F7931A', label: 'Warning', value: 63114 },
18
+ { color: '#FF6666', label: 'Down', value: 122222 }
19
+ ];
20
+
21
+ const meta: Meta<typeof PieChart> = {
22
+ component: PieChart
23
+ };
24
+
25
+ export default meta;
26
+ type Story = StoryObj<typeof PieChart>;
27
+
28
+ const Template = (args): JSX.Element => {
29
+ return (
30
+ <div style={{ height: '350px', width: '350px' }}>
31
+ <PieChart {...args} />
32
+ </div>
33
+ );
34
+ };
35
+
36
+ export const Pie: Story = {
37
+ args: {
38
+ data,
39
+ title: 'hosts'
40
+ },
41
+ render: Template
42
+ };
43
+
44
+ export const Donut: Story = {
45
+ args: {
46
+ data,
47
+ title: 'hosts',
48
+ variant: 'donut'
49
+ },
50
+ render: Template
51
+ };
52
+
53
+ export const WithPencentage: Story = {
54
+ args: {
55
+ data,
56
+ title: 'hosts',
57
+ unit: 'percentage',
58
+ variant: 'donut'
59
+ },
60
+ render: Template
61
+ };
62
+
63
+ export const WithBigNumbers: Story = {
64
+ args: {
65
+ data: dataWithBigNumbers,
66
+ title: 'hosts',
67
+ unit: 'number',
68
+ variant: 'donut'
69
+ },
70
+ render: Template
71
+ };
72
+
73
+ export const WithoutLegend: Story = {
74
+ args: {
75
+ data,
76
+ displayLegend: false,
77
+ title: 'hosts',
78
+ variant: 'donut'
79
+ },
80
+ render: Template
81
+ };
82
+
83
+ export const DonutWithoutTitle: Story = {
84
+ args: {
85
+ data,
86
+ variant: 'donut'
87
+ },
88
+ render: Template
89
+ };
90
+
91
+ export const PieWithoutTitle: Story = {
92
+ args: {
93
+ data
94
+ },
95
+ render: Template
96
+ };
97
+
98
+ export const DonutWithDisplayedValues: Story = {
99
+ args: {
100
+ data,
101
+ displayValues: true,
102
+ variant: 'donut'
103
+ },
104
+ render: Template
105
+ };
106
+
107
+ export const PieWithDisplayedValues: Story = {
108
+ args: {
109
+ data,
110
+ displayValues: true
111
+ },
112
+ render: Template
113
+ };
114
+
115
+ const TooltipContent = ({ label, color, value }: ArcType): JSX.Element => {
116
+ return (
117
+ <div style={{ color }}>
118
+ {label} : {value}
119
+ </div>
120
+ );
121
+ };
122
+
123
+ export const PieWithTooltip: Story = {
124
+ args: {
125
+ TooltipContent,
126
+ data,
127
+ displayValues: true,
128
+ unit: 'percentage'
129
+ },
130
+ render: Template
131
+ };
132
+
133
+ export const DonutWithTooltip: Story = {
134
+ args: {
135
+ TooltipContent,
136
+ data,
137
+ displayValues: true,
138
+ variant: 'donut'
139
+ },
140
+ render: Template
141
+ };
142
+
143
+ const TemplateForSmallDimensions = (args): JSX.Element => {
144
+ return (
145
+ <div style={{ height: '130px', width: '130px' }}>
146
+ <PieChart {...args} />
147
+ </div>
148
+ );
149
+ };
150
+
151
+ export const PieWithSmallDimensions: Story = {
152
+ args: {
153
+ data,
154
+ displayLegend: false
155
+ },
156
+ render: TemplateForSmallDimensions
157
+ };
158
+
159
+ export const DonutWithSmallDimensions: Story = {
160
+ args: {
161
+ data,
162
+ displayLegend: false,
163
+ title: 'hosts',
164
+ variant: 'donut'
165
+ },
166
+ render: TemplateForSmallDimensions
167
+ };
168
+
169
+ const dataWidthOneNoZeroValue = [
170
+ { color: '#88B922', label: 'Ok', value: 13 },
171
+ { color: '#999999', label: 'Unknown', value: 0 },
172
+ { color: '#F7931A', label: 'Warning', value: 0 },
173
+ { color: '#FF6666', label: 'Down', value: 0 }
174
+ ];
175
+
176
+ export const PieWithOneNoZeroValue: Story = {
177
+ args: {
178
+ data: dataWidthOneNoZeroValue,
179
+ displayLegend: false,
180
+ title: 'hosts',
181
+ variant: 'pie'
182
+ },
183
+ render: Template
184
+ };
185
+
186
+ export const donutWithOneNoZeroValue: Story = {
187
+ args: {
188
+ data: dataWidthOneNoZeroValue,
189
+ displayLegend: false,
190
+ title: 'hosts',
191
+ variant: 'donut'
192
+ },
193
+ render: Template
194
+ };
@@ -0,0 +1,39 @@
1
+ import { lt } from 'ramda';
2
+ import { makeStyles } from 'tss-react/mui';
3
+
4
+ export const usePieStyles = makeStyles<{ svgSize: number }>()(
5
+ (theme, { svgSize }) => ({
6
+ container: {
7
+ alignItems: 'center',
8
+ display: 'flex',
9
+ gap: theme.spacing(2),
10
+ justifyContent: 'center'
11
+ },
12
+ pieChartTooltip: {
13
+ backgroundColor: theme.palette.background.paper,
14
+ color: theme.palette.text.primary,
15
+ padding: 0,
16
+ position: 'relative'
17
+ },
18
+ svgContainer: {
19
+ alignItems: 'center',
20
+ backgroundColor: theme.palette.background.panelGroups,
21
+ borderRadius: '100%',
22
+ display: 'flex',
23
+ justifyContent: 'center'
24
+ },
25
+ svgWrapper: {
26
+ alignItems: 'center',
27
+ display: 'flex',
28
+ flexDirection: 'column',
29
+ gap: theme.spacing(1),
30
+ justifyContent: 'center'
31
+ },
32
+ title: {
33
+ fontSize: lt(svgSize, 150)
34
+ ? theme.typography.body1.fontSize
35
+ : theme.typography.h6.fontSize,
36
+ fontWeight: theme.typography.fontWeightMedium
37
+ }
38
+ })
39
+ );
@@ -0,0 +1,14 @@
1
+ import { ParentSize } from '../..';
2
+
3
+ import ResponsivePie from './ResponsivePie';
4
+ import { PieProps } from './models';
5
+
6
+ const PieChart = (props: PieProps): JSX.Element => (
7
+ <ParentSize>
8
+ {({ width, height }) => (
9
+ <ResponsivePie {...props} height={height} width={width} />
10
+ )}
11
+ </ParentSize>
12
+ );
13
+
14
+ export default PieChart;
@@ -0,0 +1,251 @@
1
+ import { useRef } from 'react';
2
+
3
+ import { Pie } from '@visx/shape';
4
+ import { Group } from '@visx/group';
5
+ import { Text } from '@visx/text';
6
+ import numeral from 'numeral';
7
+ import { always, equals, gt, ifElse, lt } from 'ramda';
8
+ import { useTranslation } from 'react-i18next';
9
+
10
+ import { Typography, useTheme } from '@mui/material';
11
+
12
+ import { Tooltip } from '../../components';
13
+ import { Legend as LegendComponent } from '../Legend';
14
+ import { LegendProps } from '../Legend/models';
15
+ import { getValueByUnit } from '../common/utils';
16
+ import { labelNoDataFound } from '../translatedLabels';
17
+
18
+ import { PieProps } from './models';
19
+ import { usePieStyles } from './PieChart.styles';
20
+ import { useResponsivePie } from './useResponsivePie';
21
+
22
+ const DefaultLengd = ({ scale, direction }: LegendProps): JSX.Element => (
23
+ <LegendComponent direction={direction} scale={scale} />
24
+ );
25
+
26
+ type Placement = 'left' | 'right' | 'top' | 'bottom';
27
+
28
+ const getTooltipPlacement = ({ radianX, radianY }): Placement => {
29
+ if (gt(Math.abs(radianX), Math.abs(radianY))) {
30
+ return ifElse<[b: number], Placement, Placement>(
31
+ lt(0),
32
+ always<Placement>('right'),
33
+ always<Placement>('left')
34
+ )(radianX);
35
+ }
36
+
37
+ return ifElse<[b: number], Placement, Placement>(
38
+ lt(0),
39
+ always<Placement>('bottom'),
40
+ always<Placement>('top')
41
+ )(radianY);
42
+ };
43
+
44
+ const ResponsivePie = ({
45
+ title,
46
+ variant = 'pie',
47
+ width,
48
+ height,
49
+ data,
50
+ unit = 'number',
51
+ Legend = DefaultLengd,
52
+ displayLegend = true,
53
+ innerRadius: defaultInnerRadius = 40,
54
+ onArcClick,
55
+ displayValues,
56
+ TooltipContent,
57
+ legendDirection = 'column'
58
+ }: PieProps & { height: number; width: number }): JSX.Element => {
59
+ const { t } = useTranslation();
60
+ const theme = useTheme();
61
+
62
+ const legendRef = useRef(null);
63
+ const titleRef = useRef(null);
64
+
65
+ const {
66
+ half,
67
+ legendScale,
68
+ svgContainerSize,
69
+ svgSize,
70
+ svgWrapperWidth,
71
+ total,
72
+ innerRadius,
73
+ isContainsExactlyOneNonZeroValue,
74
+ areAllValuesNull
75
+ } = useResponsivePie({
76
+ data,
77
+ defaultInnerRadius,
78
+ height,
79
+ legendRef,
80
+ titleRef,
81
+ unit,
82
+ width
83
+ });
84
+
85
+ const { classes } = usePieStyles({ svgSize });
86
+
87
+ if (areAllValuesNull) {
88
+ return (
89
+ <div className={classes.container} style={{ height, width }}>
90
+ <Typography variant="h3">{t(labelNoDataFound)}</Typography>
91
+ </div>
92
+ );
93
+ }
94
+
95
+ return (
96
+ <div
97
+ className={classes.container}
98
+ style={{
99
+ height,
100
+ width
101
+ }}
102
+ >
103
+ <div
104
+ className={classes.svgWrapper}
105
+ style={{
106
+ height,
107
+ width: svgWrapperWidth
108
+ }}
109
+ >
110
+ {equals(variant, 'pie') && title && (
111
+ <div className={classes.title} data-testid="Title" ref={titleRef}>
112
+ {`${numeral(total).format('0a').toUpperCase()} `} {title}
113
+ </div>
114
+ )}
115
+ <div
116
+ className={classes.svgContainer}
117
+ data-testid="pieChart"
118
+ style={{
119
+ height: svgContainerSize,
120
+ width: svgContainerSize
121
+ }}
122
+ >
123
+ <svg data-variant={variant} height={svgSize} width={svgSize}>
124
+ <Group left={half} top={half}>
125
+ <Pie
126
+ cornerRadius={4}
127
+ data={data}
128
+ innerRadius={() => {
129
+ return equals(variant, 'pie') ? 0 : half - innerRadius;
130
+ }}
131
+ outerRadius={half}
132
+ pieValue={(items) => items.value}
133
+ >
134
+ {(pie) => {
135
+ return pie.arcs.map((arc) => {
136
+ const [centroidX, centroidY] = pie.path.centroid(arc);
137
+ const midAngle = Math.atan2(centroidY, centroidX);
138
+
139
+ const labelRadius = half * 0.8;
140
+
141
+ const labelX = Math.cos(midAngle) * labelRadius;
142
+ const labelY = Math.sin(midAngle) * labelRadius;
143
+
144
+ const angle = arc.endAngle - arc.startAngle;
145
+ const minAngle = 0.2;
146
+
147
+ const x = equals(variant, 'donut') ? centroidX : labelX;
148
+ const y = equals(variant, 'donut') ? centroidY : labelY;
149
+
150
+ const onClick = (): void => {
151
+ onArcClick?.(arc.data);
152
+ };
153
+
154
+ return (
155
+ <Tooltip
156
+ hasCaret
157
+ classes={{
158
+ tooltip: classes.pieChartTooltip
159
+ }}
160
+ followCursor={false}
161
+ key={arc.data.label}
162
+ label={
163
+ TooltipContent && (
164
+ <TooltipContent
165
+ color={arc.data.color}
166
+ label={arc.data.label}
167
+ title={title}
168
+ total={total}
169
+ value={arc.data.value}
170
+ />
171
+ )
172
+ }
173
+ leaveDelay={200}
174
+ placement={getTooltipPlacement({
175
+ radianX: Math.cos(midAngle),
176
+ radianY: Math.sin(midAngle)
177
+ })}
178
+ >
179
+ <g data-testid={arc.data.label} onClick={onClick}>
180
+ <path
181
+ d={pie.path(arc) as string}
182
+ fill={arc.data.color}
183
+ />
184
+ {displayValues &&
185
+ !isContainsExactlyOneNonZeroValue &&
186
+ angle > minAngle && (
187
+ <Text
188
+ data-testid="value"
189
+ dy=".33em"
190
+ fill="#000"
191
+ fontSize={12}
192
+ pointerEvents="none"
193
+ textAnchor="middle"
194
+ x={x}
195
+ y={y}
196
+ >
197
+ {getValueByUnit({
198
+ total,
199
+ unit,
200
+ value: arc.data.value
201
+ })}
202
+ </Text>
203
+ )}
204
+ </g>
205
+ </Tooltip>
206
+ );
207
+ });
208
+ }}
209
+ </Pie>
210
+ {equals(variant, 'donut') && title && (
211
+ <>
212
+ <Text
213
+ className={classes.title}
214
+ dy={lt(svgSize, 150) ? -10 : -15}
215
+ fill={theme.palette.text.primary}
216
+ textAnchor="middle"
217
+ >
218
+ {numeral(total).format('0a').toUpperCase()}
219
+ </Text>
220
+ <Text
221
+ className={classes.title}
222
+ data-testid="Title"
223
+ dy={lt(svgSize, 150) ? 10 : 15}
224
+ fill={theme.palette.text.primary}
225
+ textAnchor="middle"
226
+ >
227
+ {title}
228
+ </Text>
229
+ </>
230
+ )}
231
+ </Group>
232
+ </svg>
233
+ </div>
234
+ </div>
235
+ {displayLegend && (
236
+ <div data-testid="Legend" ref={legendRef}>
237
+ <Legend
238
+ data={data}
239
+ direction={legendDirection}
240
+ scale={legendScale}
241
+ title={title}
242
+ total={total}
243
+ unit={unit}
244
+ />
245
+ </div>
246
+ )}
247
+ </div>
248
+ );
249
+ };
250
+
251
+ export default ResponsivePie;
@@ -0,0 +1 @@
1
+ export { default as PieChart } from './PieChart';
@@ -0,0 +1,19 @@
1
+ export interface ArcType {
2
+ color: string;
3
+ label: string;
4
+ value: number;
5
+ }
6
+
7
+ export interface PieProps {
8
+ Legend?: ({ scale, direction, data, title, total, unit }) => JSX.Element;
9
+ TooltipContent?: (arcData) => JSX.Element | boolean | null;
10
+ data: Array<ArcType>;
11
+ displayLegend?: boolean;
12
+ displayValues?: boolean;
13
+ innerRadius?: number;
14
+ legendDirection?: 'row' | 'column';
15
+ onArcClick?: (ardata) => void;
16
+ title?: string;
17
+ unit?: 'percentage' | 'number';
18
+ variant?: 'pie' | 'donut';
19
+ }