@yamada-ui/charts 1.5.4-next-20241005220055 → 1.5.4-next-20241008193728
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart-gradient.d.mts +2 -2
- package/dist/area-chart-gradient.d.ts +2 -2
- package/dist/area-chart-gradient.js +7 -5
- package/dist/area-chart-gradient.js.map +1 -1
- package/dist/area-chart-gradient.mjs +1 -1
- package/dist/area-chart-split.d.mts +2 -2
- package/dist/area-chart-split.d.ts +2 -2
- package/dist/area-chart-split.js +4 -2
- package/dist/area-chart-split.js.map +1 -1
- package/dist/area-chart-split.mjs +1 -1
- package/dist/area-chart.d.mts +8 -8
- package/dist/area-chart.d.ts +8 -8
- package/dist/area-chart.js +190 -175
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +13 -13
- package/dist/bar-chart.d.mts +8 -8
- package/dist/bar-chart.d.ts +8 -8
- package/dist/bar-chart.js +143 -127
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +11 -11
- package/dist/chart-legend.d.mts +1 -1
- package/dist/chart-legend.d.ts +1 -1
- package/dist/chart-legend.js +4 -2
- package/dist/chart-legend.js.map +1 -1
- package/dist/chart-legend.mjs +3 -3
- package/dist/chart-tooltip.d.mts +4 -4
- package/dist/chart-tooltip.d.ts +4 -4
- package/dist/chart-tooltip.js +9 -7
- package/dist/chart-tooltip.js.map +1 -1
- package/dist/chart-tooltip.mjs +3 -3
- package/dist/chart-utils.js.map +1 -1
- package/dist/chart-utils.mjs +1 -1
- package/dist/chart.types.d.mts +14 -14
- package/dist/chart.types.d.ts +14 -14
- package/dist/chart.types.js.map +1 -1
- package/dist/{chunk-UANITMH7.mjs → chunk-5VLSGWQD.mjs} +10 -8
- package/dist/chunk-5VLSGWQD.mjs.map +1 -0
- package/dist/{chunk-XYUYAHJX.mjs → chunk-6JRMEI6J.mjs} +2 -2
- package/dist/chunk-6JRMEI6J.mjs.map +1 -0
- package/dist/{chunk-VKBRU4Z4.mjs → chunk-AYVTBRCS.mjs} +29 -28
- package/dist/chunk-AYVTBRCS.mjs.map +1 -0
- package/dist/{chunk-6O5G3WYP.mjs → chunk-EZG52466.mjs} +29 -21
- package/dist/chunk-EZG52466.mjs.map +1 -0
- package/dist/{chunk-VEFEKDMH.mjs → chunk-FDALM73K.mjs} +15 -14
- package/dist/chunk-FDALM73K.mjs.map +1 -0
- package/dist/{chunk-2GQHI23M.mjs → chunk-GU4SGNWX.mjs} +5 -5
- package/dist/chunk-GU4SGNWX.mjs.map +1 -0
- package/dist/{chunk-MVRWZTQ5.mjs → chunk-NLXYCM5J.mjs} +2 -2
- package/dist/chunk-NLXYCM5J.mjs.map +1 -0
- package/dist/{chunk-EXBYAVSP.mjs → chunk-NMPNNSBN.mjs} +76 -74
- package/dist/chunk-NMPNNSBN.mjs.map +1 -0
- package/dist/{chunk-AL4MDJ4U.mjs → chunk-NQPC5LPY.mjs} +84 -82
- package/dist/chunk-NQPC5LPY.mjs.map +1 -0
- package/dist/{chunk-MN7T76SY.mjs → chunk-OG5CVPPV.mjs} +5 -3
- package/dist/chunk-OG5CVPPV.mjs.map +1 -0
- package/dist/{chunk-LLOU2WIV.mjs → chunk-OUIKA4AX.mjs} +5 -3
- package/dist/chunk-OUIKA4AX.mjs.map +1 -0
- package/dist/{chunk-3EHZJFIA.mjs → chunk-PKQB4BFG.mjs} +28 -28
- package/dist/chunk-PKQB4BFG.mjs.map +1 -0
- package/dist/{chunk-C3ZYUDXE.mjs → chunk-QPMW56KA.mjs} +52 -48
- package/dist/chunk-QPMW56KA.mjs.map +1 -0
- package/dist/{chunk-IJRYXT4V.mjs → chunk-R2LOTDR3.mjs} +2 -2
- package/dist/{chunk-IJRYXT4V.mjs.map → chunk-R2LOTDR3.mjs.map} +1 -1
- package/dist/{chunk-LSCPL7PM.mjs → chunk-SCY5V45W.mjs} +58 -56
- package/dist/chunk-SCY5V45W.mjs.map +1 -0
- package/dist/{chunk-VGNCWS23.mjs → chunk-SYBJTMPL.mjs} +92 -90
- package/dist/chunk-SYBJTMPL.mjs.map +1 -0
- package/dist/{chunk-ZGXEF3LO.mjs → chunk-TA7YJAW4.mjs} +49 -47
- package/dist/chunk-TA7YJAW4.mjs.map +1 -0
- package/dist/{chunk-O3LMKYXK.mjs → chunk-TU6MKMMV.mjs} +29 -28
- package/dist/chunk-TU6MKMMV.mjs.map +1 -0
- package/dist/{chunk-QL3DB7OJ.mjs → chunk-TXNC7GLT.mjs} +1 -1
- package/dist/{chunk-QL3DB7OJ.mjs.map → chunk-TXNC7GLT.mjs.map} +1 -1
- package/dist/{chunk-NHHJ5XFF.mjs → chunk-U325CYNR.mjs} +8 -6
- package/dist/chunk-U325CYNR.mjs.map +1 -0
- package/dist/{chunk-OPPMMNGP.mjs → chunk-UER5GW4M.mjs} +33 -24
- package/dist/chunk-UER5GW4M.mjs.map +1 -0
- package/dist/{chunk-FYAC4RRZ.mjs → chunk-UTD4XZDM.mjs} +11 -10
- package/dist/chunk-UTD4XZDM.mjs.map +1 -0
- package/dist/{chunk-A3IWA366.mjs → chunk-VK65X6Q2.mjs} +4 -4
- package/dist/chunk-VK65X6Q2.mjs.map +1 -0
- package/dist/{chunk-OJ2MLZZ7.mjs → chunk-X6PIY2M3.mjs} +7 -7
- package/dist/chunk-X6PIY2M3.mjs.map +1 -0
- package/dist/{chunk-MSG3WFBO.mjs → chunk-YIAK5DIM.mjs} +7 -6
- package/dist/chunk-YIAK5DIM.mjs.map +1 -0
- package/dist/{chunk-ZXBE4ERW.mjs → chunk-YTUEG4IY.mjs} +47 -45
- package/dist/chunk-YTUEG4IY.mjs.map +1 -0
- package/dist/{chunk-VUTCH2CU.mjs → chunk-YX23LEQ7.mjs} +13 -13
- package/dist/chunk-YX23LEQ7.mjs.map +1 -0
- package/dist/{chunk-BQT5TIKZ.mjs → chunk-ZRV4LO67.mjs} +44 -42
- package/dist/chunk-ZRV4LO67.mjs.map +1 -0
- package/dist/donut-chart.js +97 -89
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +10 -10
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +2084 -2036
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -28
- package/dist/index.mjs.map +1 -1
- package/dist/line-chart.d.mts +7 -7
- package/dist/line-chart.d.ts +7 -7
- package/dist/line-chart.js +146 -138
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +11 -11
- package/dist/pie-chart-label.d.mts +9 -9
- package/dist/pie-chart-label.d.ts +9 -9
- package/dist/pie-chart-label.js +14 -13
- package/dist/pie-chart-label.js.map +1 -1
- package/dist/pie-chart-label.mjs +1 -1
- package/dist/pie-chart.d.mts +11 -11
- package/dist/pie-chart.d.ts +11 -11
- package/dist/pie-chart.js +95 -87
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +9 -9
- package/dist/radar-chart.d.mts +11 -11
- package/dist/radar-chart.d.ts +11 -11
- package/dist/radar-chart.js +87 -73
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +9 -9
- package/dist/radial-chart.d.mts +10 -10
- package/dist/radial-chart.d.ts +10 -10
- package/dist/radial-chart.js +69 -62
- package/dist/radial-chart.js.map +1 -1
- package/dist/radial-chart.mjs +10 -10
- package/dist/use-area-chart.d.mts +53 -53
- package/dist/use-area-chart.d.ts +53 -53
- package/dist/use-area-chart.js +50 -46
- package/dist/use-area-chart.js.map +1 -1
- package/dist/use-area-chart.mjs +2 -2
- package/dist/use-bar-chart.d.mts +32 -32
- package/dist/use-bar-chart.d.ts +32 -32
- package/dist/use-bar-chart.js +30 -21
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +2 -2
- package/dist/use-chart-axis.d.mts +27 -27
- package/dist/use-chart-axis.d.ts +27 -27
- package/dist/use-chart-axis.js +26 -26
- package/dist/use-chart-axis.js.map +1 -1
- package/dist/use-chart-axis.mjs +2 -2
- package/dist/use-chart-grid.d.mts +8 -8
- package/dist/use-chart-grid.d.ts +8 -8
- package/dist/use-chart-grid.js +3 -3
- package/dist/use-chart-grid.js.map +1 -1
- package/dist/use-chart-grid.mjs +2 -2
- package/dist/use-chart-label-list.d.mts +4 -4
- package/dist/use-chart-label-list.d.ts +4 -4
- package/dist/use-chart-label-list.js +5 -4
- package/dist/use-chart-label-list.js.map +1 -1
- package/dist/use-chart-label-list.mjs +2 -2
- package/dist/use-chart-label.d.mts +1 -1
- package/dist/use-chart-label.d.ts +1 -1
- package/dist/use-chart-label.js.map +1 -1
- package/dist/use-chart-label.mjs +2 -2
- package/dist/use-chart-legend.d.mts +1 -1
- package/dist/use-chart-legend.d.ts +1 -1
- package/dist/use-chart-legend.js +1 -1
- package/dist/use-chart-legend.js.map +1 -1
- package/dist/use-chart-legend.mjs +1 -1
- package/dist/use-chart-reference-line.d.mts +4 -4
- package/dist/use-chart-reference-line.d.ts +4 -4
- package/dist/use-chart-reference-line.js +8 -7
- package/dist/use-chart-reference-line.js.map +1 -1
- package/dist/use-chart-reference-line.mjs +2 -2
- package/dist/use-chart-tooltip.d.mts +7 -7
- package/dist/use-chart-tooltip.d.ts +7 -7
- package/dist/use-chart-tooltip.js +4 -4
- package/dist/use-chart-tooltip.js.map +1 -1
- package/dist/use-chart-tooltip.mjs +2 -2
- package/dist/use-chart.d.mts +6 -10
- package/dist/use-chart.d.ts +6 -10
- package/dist/use-chart.js +2 -2
- package/dist/use-chart.js.map +1 -1
- package/dist/use-chart.mjs +2 -2
- package/dist/use-line-chart.d.mts +43 -43
- package/dist/use-line-chart.d.ts +43 -43
- package/dist/use-line-chart.js +26 -25
- package/dist/use-line-chart.js.map +1 -1
- package/dist/use-line-chart.mjs +2 -2
- package/dist/use-pie-chart.d.mts +47 -47
- package/dist/use-pie-chart.d.ts +47 -47
- package/dist/use-pie-chart.js +40 -38
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +3 -3
- package/dist/use-polar-grid.d.mts +5 -5
- package/dist/use-polar-grid.d.ts +5 -5
- package/dist/use-polar-grid.js.map +1 -1
- package/dist/use-polar-grid.mjs +2 -2
- package/dist/use-radar-chart.d.mts +41 -41
- package/dist/use-radar-chart.d.ts +41 -41
- package/dist/use-radar-chart.js +27 -19
- package/dist/use-radar-chart.js.map +1 -1
- package/dist/use-radar-chart.mjs +2 -2
- package/dist/use-radial-chart.d.mts +17 -17
- package/dist/use-radial-chart.d.ts +17 -17
- package/dist/use-radial-chart.js +11 -11
- package/dist/use-radial-chart.js.map +1 -1
- package/dist/use-radial-chart.mjs +2 -2
- package/package.json +3 -3
- package/dist/chunk-2GQHI23M.mjs.map +0 -1
- package/dist/chunk-3EHZJFIA.mjs.map +0 -1
- package/dist/chunk-6O5G3WYP.mjs.map +0 -1
- package/dist/chunk-A3IWA366.mjs.map +0 -1
- package/dist/chunk-AL4MDJ4U.mjs.map +0 -1
- package/dist/chunk-BQT5TIKZ.mjs.map +0 -1
- package/dist/chunk-C3ZYUDXE.mjs.map +0 -1
- package/dist/chunk-EXBYAVSP.mjs.map +0 -1
- package/dist/chunk-FYAC4RRZ.mjs.map +0 -1
- package/dist/chunk-LLOU2WIV.mjs.map +0 -1
- package/dist/chunk-LSCPL7PM.mjs.map +0 -1
- package/dist/chunk-MN7T76SY.mjs.map +0 -1
- package/dist/chunk-MSG3WFBO.mjs.map +0 -1
- package/dist/chunk-MVRWZTQ5.mjs.map +0 -1
- package/dist/chunk-NHHJ5XFF.mjs.map +0 -1
- package/dist/chunk-O3LMKYXK.mjs.map +0 -1
- package/dist/chunk-OJ2MLZZ7.mjs.map +0 -1
- package/dist/chunk-OPPMMNGP.mjs.map +0 -1
- package/dist/chunk-UANITMH7.mjs.map +0 -1
- package/dist/chunk-VEFEKDMH.mjs.map +0 -1
- package/dist/chunk-VGNCWS23.mjs.map +0 -1
- package/dist/chunk-VKBRU4Z4.mjs.map +0 -1
- package/dist/chunk-VUTCH2CU.mjs.map +0 -1
- package/dist/chunk-XYUYAHJX.mjs.map +0 -1
- package/dist/chunk-ZGXEF3LO.mjs.map +0 -1
- package/dist/chunk-ZXBE4ERW.mjs.map +0 -1
package/dist/pie-chart.d.mts
CHANGED
@@ -12,11 +12,15 @@ import 'recharts/types/chart/generateCategoricalChart';
|
|
12
12
|
|
13
13
|
interface PieChartOptions {
|
14
14
|
/**
|
15
|
-
*
|
15
|
+
* Determines which data is displayed in the tooltip.
|
16
16
|
*
|
17
|
-
* @default
|
17
|
+
* @default 'all'
|
18
18
|
*/
|
19
|
-
|
19
|
+
tooltipDataSource?: TooltipDataSourceType;
|
20
|
+
/**
|
21
|
+
* Unit displayed next to each value in tooltip.
|
22
|
+
*/
|
23
|
+
unit?: string;
|
20
24
|
/**
|
21
25
|
* If `true`, legend is visible.
|
22
26
|
*
|
@@ -24,17 +28,13 @@ interface PieChartOptions {
|
|
24
28
|
*/
|
25
29
|
withLegend?: boolean;
|
26
30
|
/**
|
27
|
-
*
|
31
|
+
* If `true`, tooltip is visible.
|
28
32
|
*
|
29
|
-
* @default
|
30
|
-
*/
|
31
|
-
tooltipDataSource?: TooltipDataSourceType;
|
32
|
-
/**
|
33
|
-
* Unit displayed next to each value in tooltip.
|
33
|
+
* @default true
|
34
34
|
*/
|
35
|
-
|
35
|
+
withTooltip?: boolean;
|
36
36
|
}
|
37
|
-
interface PieChartProps extends Omit<HTMLUIProps, "
|
37
|
+
interface PieChartProps extends Omit<HTMLUIProps, "fillOpacity" | "strokeWidth">, ThemeProps<"pieChart">, PieChartOptions, UsePieChartOptions, Omit<UseChartTooltipOptions, "labelFormatter">, UseChartLegendProps, UseChartProps {
|
38
38
|
}
|
39
39
|
/**
|
40
40
|
* `PieChart` is a component for drawing pie charts to compare multiple sets of data.
|
package/dist/pie-chart.d.ts
CHANGED
@@ -12,11 +12,15 @@ import 'recharts/types/chart/generateCategoricalChart';
|
|
12
12
|
|
13
13
|
interface PieChartOptions {
|
14
14
|
/**
|
15
|
-
*
|
15
|
+
* Determines which data is displayed in the tooltip.
|
16
16
|
*
|
17
|
-
* @default
|
17
|
+
* @default 'all'
|
18
18
|
*/
|
19
|
-
|
19
|
+
tooltipDataSource?: TooltipDataSourceType;
|
20
|
+
/**
|
21
|
+
* Unit displayed next to each value in tooltip.
|
22
|
+
*/
|
23
|
+
unit?: string;
|
20
24
|
/**
|
21
25
|
* If `true`, legend is visible.
|
22
26
|
*
|
@@ -24,17 +28,13 @@ interface PieChartOptions {
|
|
24
28
|
*/
|
25
29
|
withLegend?: boolean;
|
26
30
|
/**
|
27
|
-
*
|
31
|
+
* If `true`, tooltip is visible.
|
28
32
|
*
|
29
|
-
* @default
|
30
|
-
*/
|
31
|
-
tooltipDataSource?: TooltipDataSourceType;
|
32
|
-
/**
|
33
|
-
* Unit displayed next to each value in tooltip.
|
33
|
+
* @default true
|
34
34
|
*/
|
35
|
-
|
35
|
+
withTooltip?: boolean;
|
36
36
|
}
|
37
|
-
interface PieChartProps extends Omit<HTMLUIProps, "
|
37
|
+
interface PieChartProps extends Omit<HTMLUIProps, "fillOpacity" | "strokeWidth">, ThemeProps<"pieChart">, PieChartOptions, UsePieChartOptions, Omit<UseChartTooltipOptions, "labelFormatter">, UseChartLegendProps, UseChartProps {
|
38
38
|
}
|
39
39
|
/**
|
40
40
|
* `PieChart` is a component for drawing pie charts to compare multiple sets of data.
|
package/dist/pie-chart.js
CHANGED
@@ -168,13 +168,13 @@ var useChart = ({ containerProps = {} }) => {
|
|
168
168
|
getContainerProps
|
169
169
|
};
|
170
170
|
};
|
171
|
-
var useLegend = (
|
171
|
+
var useLegend = () => {
|
172
172
|
const { styles } = useChartContext();
|
173
173
|
return {
|
174
174
|
styles
|
175
175
|
};
|
176
176
|
};
|
177
|
-
var useTooltip = (
|
177
|
+
var useTooltip = () => {
|
178
178
|
const { styles } = useChartContext();
|
179
179
|
return {
|
180
180
|
styles
|
@@ -186,7 +186,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
186
186
|
var ChartLegend = (0, import_core3.forwardRef)(
|
187
187
|
({ className, payload = [], onHighlight, ...rest }, ref) => {
|
188
188
|
const { styles } = useLegend();
|
189
|
-
const items = payload.map(({ dataKey, value: valueProp
|
189
|
+
const items = payload.map(({ color, dataKey, value: valueProp }, index) => {
|
190
190
|
const value = dataKey != null ? dataKey : valueProp;
|
191
191
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
192
192
|
import_core3.ui.div,
|
@@ -222,6 +222,8 @@ var ChartLegend = (0, import_core3.forwardRef)(
|
|
222
222
|
);
|
223
223
|
}
|
224
224
|
);
|
225
|
+
ChartLegend.displayName = "ChartLegend";
|
226
|
+
ChartLegend.__ui__ = "ChartLegend";
|
225
227
|
|
226
228
|
// src/chart-tooltip.tsx
|
227
229
|
var import_core4 = require("@yamada-ui/core");
|
@@ -229,22 +231,22 @@ var import_utils4 = require("@yamada-ui/utils");
|
|
229
231
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
230
232
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
231
233
|
({
|
232
|
-
label,
|
233
|
-
dataKey = "value",
|
234
234
|
className,
|
235
|
-
|
236
|
-
|
235
|
+
dataKey = "value",
|
236
|
+
isRadialChart,
|
237
|
+
label,
|
237
238
|
labelFormatter,
|
239
|
+
payload = [],
|
238
240
|
unit,
|
239
|
-
|
241
|
+
valueFormatter,
|
240
242
|
...rest
|
241
243
|
}, ref) => {
|
242
244
|
var _a;
|
243
245
|
const { styles } = useTooltip();
|
244
246
|
const items = payload.map(
|
245
247
|
({
|
246
|
-
color: colorProp,
|
247
248
|
name: nameProp,
|
249
|
+
color: colorProp,
|
248
250
|
[dataKey]: valueProp,
|
249
251
|
payload: payload2
|
250
252
|
} = {}, index) => {
|
@@ -314,6 +316,8 @@ var ChartTooltip = (0, import_core4.forwardRef)(
|
|
314
316
|
);
|
315
317
|
}
|
316
318
|
);
|
319
|
+
ChartTooltip.displayName = "ChartTooltip";
|
320
|
+
ChartTooltip.__ui__ = "ChartTooltip";
|
317
321
|
|
318
322
|
// src/use-chart-legend.ts
|
319
323
|
var import_utils5 = require("@yamada-ui/utils");
|
@@ -336,7 +340,7 @@ var useChartLegend = ({
|
|
336
340
|
},
|
337
341
|
[rest]
|
338
342
|
);
|
339
|
-
return {
|
343
|
+
return { getLegendProps, legendProps };
|
340
344
|
};
|
341
345
|
|
342
346
|
// src/use-chart-tooltip.ts
|
@@ -344,9 +348,9 @@ var import_core5 = require("@yamada-ui/core");
|
|
344
348
|
var import_utils6 = require("@yamada-ui/utils");
|
345
349
|
var import_react3 = require("react");
|
346
350
|
var useChartTooltip = ({
|
347
|
-
|
351
|
+
styles,
|
348
352
|
tooltipAnimationDuration = 0,
|
349
|
-
|
353
|
+
tooltipProps: _tooltipProps = {}
|
350
354
|
}) => {
|
351
355
|
const { theme } = (0, import_core5.useTheme)();
|
352
356
|
const { cursor, ...rest } = _tooltipProps;
|
@@ -362,16 +366,16 @@ var useChartTooltip = ({
|
|
362
366
|
(props, ref = null) => ({
|
363
367
|
ref,
|
364
368
|
animationDuration: tooltipAnimationDuration,
|
365
|
-
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
366
369
|
cursor: {
|
367
370
|
className: (0, import_utils6.cx)("ui-chart__cursor", cursorClassName)
|
368
371
|
},
|
372
|
+
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
369
373
|
...props,
|
370
374
|
...tooltipProps
|
371
375
|
}),
|
372
376
|
[cursorClassName, tooltipAnimationDuration, tooltipProps]
|
373
377
|
);
|
374
|
-
return { tooltipProps: tooltipUIProps
|
378
|
+
return { getTooltipProps, tooltipProps: tooltipUIProps };
|
375
379
|
};
|
376
380
|
|
377
381
|
// src/use-pie-chart.ts
|
@@ -389,17 +393,17 @@ var pieChartLabel = ({
|
|
389
393
|
className: cellClassName,
|
390
394
|
cx: cxProp = 0,
|
391
395
|
cy: cyProp = 0,
|
392
|
-
midAngle = 0,
|
393
396
|
innerRadius = 0,
|
394
|
-
|
397
|
+
isPercent,
|
398
|
+
labelFormatter,
|
399
|
+
labelOffset: labelOffsetProp,
|
400
|
+
midAngle = 0,
|
395
401
|
middleRadius = 0,
|
402
|
+
outerRadius = 0,
|
396
403
|
percent = 0,
|
404
|
+
styles,
|
397
405
|
value = 0,
|
398
|
-
|
399
|
-
isPercent,
|
400
|
-
labelProps,
|
401
|
-
labelFormatter,
|
402
|
-
styles
|
406
|
+
labelProps
|
403
407
|
}) => {
|
404
408
|
const labelOffset = labelOffsetProp != null ? labelOffsetProp : (outerRadius - innerRadius) * 0.5 + DEFAULT_LABEL_OFFSET;
|
405
409
|
const x = cxProp + (middleRadius + labelOffset) * Math.cos(-midAngle * RADIAN);
|
@@ -418,10 +422,10 @@ var pieChartLabel = ({
|
|
418
422
|
import_core6.ui.text,
|
419
423
|
{
|
420
424
|
className: (0, import_utils7.cx)(cellClassName, "ui-chart__label"),
|
425
|
+
dominantBaseline: "central",
|
426
|
+
textAnchor,
|
421
427
|
x,
|
422
428
|
y,
|
423
|
-
textAnchor,
|
424
|
-
dominantBaseline: "central",
|
425
429
|
__css: styles,
|
426
430
|
...labelProps,
|
427
431
|
children: displayLabel()
|
@@ -433,18 +437,19 @@ var pieChartLabelLine = ({
|
|
433
437
|
cx: cxProp = 0,
|
434
438
|
cy: cyProp = 0,
|
435
439
|
innerRadius = 0,
|
440
|
+
labelOffset: labelOffsetProp,
|
436
441
|
midAngle = 0,
|
437
442
|
middleRadius = 0,
|
438
443
|
outerRadius = 0,
|
439
444
|
points = [{ x: 0, y: 0 }],
|
440
|
-
|
441
|
-
labelLineProps
|
442
|
-
styles
|
445
|
+
styles,
|
446
|
+
labelLineProps
|
443
447
|
}) => {
|
448
|
+
var _a, _b;
|
444
449
|
const labelOffset = labelOffsetProp != null ? labelOffsetProp : (outerRadius - innerRadius) * 0.5 + DEFAULT_LABEL_OFFSET;
|
445
450
|
const x = cxProp + (middleRadius + labelOffset) * Math.cos(-midAngle * RADIAN);
|
446
451
|
const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN);
|
447
|
-
const d = `M ${points[0].x} ${points[0].y} L ${x} ${y}`;
|
452
|
+
const d = `M ${(_a = points[0]) == null ? void 0 : _a.x} ${(_b = points[0]) == null ? void 0 : _b.y} L ${x} ${y}`;
|
448
453
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
449
454
|
import_core6.ui.path,
|
450
455
|
{
|
@@ -459,19 +464,19 @@ var pieChartLabelLine = ({
|
|
459
464
|
// src/use-pie-chart.ts
|
460
465
|
var usePieChart = ({
|
461
466
|
data,
|
462
|
-
|
463
|
-
withLabelLines = false,
|
464
|
-
labelOffset,
|
465
|
-
isPercent = false,
|
466
|
-
strokeWidth = 1,
|
467
|
+
endAngle = -270,
|
467
468
|
fillOpacity = 1,
|
468
469
|
innerRadius = "0%",
|
470
|
+
isPercent = false,
|
471
|
+
labelFormatter,
|
472
|
+
labelOffset,
|
473
|
+
withLabels = false,
|
469
474
|
outerRadius = withLabels ? "80%" : "100%",
|
470
475
|
paddingAngle = 0,
|
471
476
|
startAngle = 90,
|
472
|
-
|
473
|
-
labelFormatter,
|
477
|
+
strokeWidth = 1,
|
474
478
|
styles,
|
479
|
+
withLabelLines = false,
|
475
480
|
...rest
|
476
481
|
}) => {
|
477
482
|
var _a, _b;
|
@@ -546,11 +551,11 @@ var usePieChart = ({
|
|
546
551
|
);
|
547
552
|
const label = (0, import_react4.useCallback)(
|
548
553
|
(props) => pieChartLabel({
|
549
|
-
labelOffset,
|
550
554
|
isPercent,
|
551
|
-
labelProps,
|
552
555
|
labelFormatter,
|
556
|
+
labelOffset,
|
553
557
|
styles: styles.label,
|
558
|
+
labelProps,
|
554
559
|
...props
|
555
560
|
}),
|
556
561
|
[isPercent, labelOffset, labelProps, styles.label, labelFormatter]
|
@@ -559,8 +564,8 @@ var usePieChart = ({
|
|
559
564
|
(props) => {
|
560
565
|
return pieChartLabelLine({
|
561
566
|
labelOffset,
|
562
|
-
labelLineProps,
|
563
567
|
styles: styles.labelLine,
|
568
|
+
labelLineProps,
|
564
569
|
...props
|
565
570
|
});
|
566
571
|
},
|
@@ -583,8 +588,8 @@ var usePieChart = ({
|
|
583
588
|
dimmed ? dimCellClassName : void 0
|
584
589
|
)(theme);
|
585
590
|
return {
|
586
|
-
|
587
|
-
|
591
|
+
className,
|
592
|
+
color
|
588
593
|
};
|
589
594
|
}),
|
590
595
|
[
|
@@ -609,19 +614,19 @@ var usePieChart = ({
|
|
609
614
|
({ className, ...props }, ref = null) => ({
|
610
615
|
ref,
|
611
616
|
className: (0, import_utils8.cx)(className, pieClassName),
|
612
|
-
|
617
|
+
activeShape: activeShapeProps,
|
613
618
|
data,
|
614
|
-
|
615
|
-
outerRadius,
|
616
|
-
innerRadius,
|
617
|
-
paddingAngle,
|
618
|
-
startAngle,
|
619
|
+
dataKey: "value",
|
619
620
|
endAngle,
|
621
|
+
inactiveShape: inactiveShapeProps,
|
622
|
+
innerRadius,
|
620
623
|
isAnimationActive: false,
|
621
624
|
label: withLabels ? label : false,
|
622
625
|
labelLine: withLabelLines ? labelLine : false,
|
623
|
-
|
624
|
-
|
626
|
+
outerRadius,
|
627
|
+
paddingAngle,
|
628
|
+
rootTabIndex: -1,
|
629
|
+
startAngle,
|
625
630
|
...props,
|
626
631
|
...pieProps
|
627
632
|
}),
|
@@ -643,8 +648,9 @@ var usePieChart = ({
|
|
643
648
|
]
|
644
649
|
);
|
645
650
|
const getCellProps = (0, import_react4.useCallback)(
|
646
|
-
({
|
647
|
-
|
651
|
+
({ className: classNameProp, index, ...props }, ref = null) => {
|
652
|
+
var _a2;
|
653
|
+
const { className, color } = (_a2 = cellPropList[index]) != null ? _a2 : {};
|
648
654
|
return {
|
649
655
|
ref,
|
650
656
|
className: (0, import_utils8.cx)(classNameProp, className),
|
@@ -658,10 +664,10 @@ var usePieChart = ({
|
|
658
664
|
);
|
659
665
|
return {
|
660
666
|
pieVars,
|
661
|
-
|
662
|
-
getPieChartProps,
|
667
|
+
setHighlightedArea,
|
663
668
|
getCellProps,
|
664
|
-
|
669
|
+
getPieChartProps,
|
670
|
+
getPieProps
|
665
671
|
};
|
666
672
|
};
|
667
673
|
|
@@ -672,69 +678,69 @@ var PieChart = (0, import_core8.forwardRef)((props, ref) => {
|
|
672
678
|
const {
|
673
679
|
className,
|
674
680
|
data,
|
675
|
-
|
676
|
-
chartProps,
|
677
|
-
cellProps,
|
678
|
-
containerProps,
|
679
|
-
withTooltip = true,
|
680
|
-
withLegend = false,
|
681
|
-
tooltipProps,
|
682
|
-
tooltipAnimationDuration,
|
683
|
-
tooltipDataSource = "all",
|
684
|
-
valueFormatter,
|
685
|
-
labelFormatter,
|
686
|
-
unit,
|
681
|
+
endAngle,
|
687
682
|
innerRadius,
|
683
|
+
isPercent,
|
684
|
+
labelFormatter,
|
685
|
+
labelOffset,
|
688
686
|
outerRadius,
|
689
687
|
paddingAngle,
|
690
688
|
startAngle,
|
691
|
-
endAngle,
|
692
|
-
withLabels,
|
693
|
-
withLabelLines,
|
694
|
-
labelOffset,
|
695
|
-
isPercent,
|
696
689
|
strokeWidth,
|
690
|
+
tooltipAnimationDuration,
|
691
|
+
tooltipDataSource = "all",
|
692
|
+
unit,
|
693
|
+
valueFormatter,
|
694
|
+
withLabelLines,
|
695
|
+
withLabels,
|
696
|
+
withLegend = false,
|
697
|
+
withTooltip = true,
|
698
|
+
cellProps,
|
699
|
+
chartProps,
|
700
|
+
containerProps,
|
697
701
|
legendProps,
|
702
|
+
pieProps,
|
703
|
+
tooltipProps,
|
698
704
|
...rest
|
699
705
|
} = (0, import_core8.omitThemeProps)(mergedProps);
|
700
706
|
const {
|
701
707
|
pieVars,
|
702
|
-
|
703
|
-
getPieChartProps,
|
708
|
+
setHighlightedArea,
|
704
709
|
getCellProps,
|
705
|
-
|
710
|
+
getPieChartProps,
|
711
|
+
getPieProps
|
706
712
|
} = usePieChart({
|
707
713
|
data,
|
708
|
-
|
709
|
-
chartProps,
|
710
|
-
cellProps,
|
714
|
+
endAngle,
|
711
715
|
innerRadius,
|
716
|
+
isPercent,
|
717
|
+
labelFormatter,
|
718
|
+
labelOffset,
|
712
719
|
outerRadius,
|
713
720
|
paddingAngle,
|
714
721
|
startAngle,
|
715
|
-
endAngle,
|
716
722
|
strokeWidth,
|
717
|
-
|
723
|
+
styles,
|
718
724
|
withLabelLines,
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
725
|
+
withLabels,
|
726
|
+
cellProps,
|
727
|
+
chartProps,
|
728
|
+
pieProps
|
723
729
|
});
|
724
730
|
const { getContainerProps } = useChart({ containerProps });
|
725
|
-
const { tooltipProps: computedTooltipProps
|
726
|
-
|
731
|
+
const { getTooltipProps, tooltipProps: computedTooltipProps } = useChartTooltip({
|
732
|
+
styles,
|
727
733
|
tooltipAnimationDuration,
|
728
|
-
|
734
|
+
tooltipProps
|
729
735
|
});
|
730
|
-
const { legendProps: computedLegendProps
|
736
|
+
const { getLegendProps, legendProps: computedLegendProps } = useChartLegend({
|
731
737
|
legendProps
|
732
738
|
});
|
733
739
|
const cells = (0, import_react5.useMemo)(
|
734
740
|
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
735
741
|
import_recharts.Cell,
|
736
742
|
{
|
737
|
-
...getCellProps({
|
743
|
+
...getCellProps({ className: "ui-pie-chart__cell", index })
|
738
744
|
},
|
739
745
|
`pie-cell-${name}`
|
740
746
|
)),
|
@@ -789,8 +795,8 @@ var PieChart = (0, import_core8.forwardRef)((props, ref) => {
|
|
789
795
|
className: "ui-pie-chart__tooltip",
|
790
796
|
label,
|
791
797
|
payload: tooltipDataSource === "segment" ? payload : data,
|
792
|
-
valueFormatter,
|
793
798
|
unit,
|
799
|
+
valueFormatter,
|
794
800
|
...computedTooltipProps
|
795
801
|
}
|
796
802
|
),
|
@@ -805,6 +811,8 @@ var PieChart = (0, import_core8.forwardRef)((props, ref) => {
|
|
805
811
|
}
|
806
812
|
) });
|
807
813
|
});
|
814
|
+
PieChart.displayName = "PieChart";
|
815
|
+
PieChart.__ui__ = "PieChart";
|
808
816
|
// Annotate the CommonJS export names for ESM import in node:
|
809
817
|
0 && (module.exports = {
|
810
818
|
PieChart
|