@yamada-ui/charts 2.0.0-next-20240729113003 → 2.0.0-next-20240820160301
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart.d.mts +1 -0
- package/dist/area-chart.d.ts +1 -0
- package/dist/area-chart.js +23 -10
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +4 -4
- package/dist/bar-chart.d.mts +2 -0
- package/dist/bar-chart.d.ts +2 -0
- package/dist/bar-chart.js +84 -45
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +5 -5
- package/dist/chart-tooltip.d.mts +2 -1
- package/dist/chart-tooltip.d.ts +2 -1
- package/dist/chart-tooltip.js +15 -6
- package/dist/chart-tooltip.js.map +1 -1
- package/dist/chart-tooltip.mjs +1 -1
- package/dist/chart.types.d.mts +7 -5
- package/dist/chart.types.d.ts +7 -5
- package/dist/chart.types.js.map +1 -1
- package/dist/{chunk-J2HFHUKE.mjs → chunk-4MW4FB2T.mjs} +4 -4
- package/dist/{chunk-J2HFHUKE.mjs.map → chunk-4MW4FB2T.mjs.map} +1 -1
- package/dist/{chunk-IOVOXWUL.mjs → chunk-AODYT4HF.mjs} +14 -20
- package/dist/chunk-AODYT4HF.mjs.map +1 -0
- package/dist/{chunk-UK6B6KJ7.mjs → chunk-AOGTJ4EN.mjs} +1 -1
- package/dist/chunk-AOGTJ4EN.mjs.map +1 -0
- package/dist/{chunk-FTAFXLVL.mjs → chunk-BGMNYKQY.mjs} +5 -5
- package/dist/chunk-BGMNYKQY.mjs.map +1 -0
- package/dist/{chunk-OOWHC7AF.mjs → chunk-FALZDKAW.mjs} +6 -5
- package/dist/chunk-FALZDKAW.mjs.map +1 -0
- package/dist/{chunk-X7MOM6U4.mjs → chunk-FCMP6QEZ.mjs} +10 -5
- package/dist/chunk-FCMP6QEZ.mjs.map +1 -0
- package/dist/{chunk-KPKLW25H.mjs → chunk-KBBHISBO.mjs} +10 -5
- package/dist/chunk-KBBHISBO.mjs.map +1 -0
- package/dist/{chunk-CIRGC4FT.mjs → chunk-MOFNE6PO.mjs} +7 -6
- package/dist/chunk-MOFNE6PO.mjs.map +1 -0
- package/dist/{chunk-PSJKBKOF.mjs → chunk-MT5JI4OR.mjs} +16 -7
- package/dist/chunk-MT5JI4OR.mjs.map +1 -0
- package/dist/{chunk-MVKJVXAK.mjs → chunk-S5NKKKV5.mjs} +40 -9
- package/dist/chunk-S5NKKKV5.mjs.map +1 -0
- package/dist/{chunk-CCFQC3T6.mjs → chunk-UHQ6WE5D.mjs} +8 -5
- package/dist/chunk-UHQ6WE5D.mjs.map +1 -0
- package/dist/{chunk-XHDDK4ZU.mjs → chunk-VK4VQQYY.mjs} +3 -4
- package/dist/chunk-VK4VQQYY.mjs.map +1 -0
- package/dist/{chunk-TSAITPYC.mjs → chunk-XUAAKVRL.mjs} +6 -5
- package/dist/chunk-XUAAKVRL.mjs.map +1 -0
- package/dist/donut-chart.d.mts +1 -0
- package/dist/donut-chart.d.ts +1 -0
- package/dist/donut-chart.js +23 -13
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +5 -5
- package/dist/index.d.mts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +213 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -13
- package/dist/index.mjs.map +1 -1
- package/dist/line-chart.d.mts +1 -0
- package/dist/line-chart.d.ts +1 -0
- package/dist/line-chart.js +23 -10
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +4 -4
- package/dist/pie-chart-label.d.mts +1 -1
- package/dist/pie-chart-label.d.ts +1 -1
- package/dist/pie-chart-label.js +3 -3
- package/dist/pie-chart-label.js.map +1 -1
- package/dist/pie-chart-label.mjs +1 -1
- package/dist/pie-chart.d.mts +2 -5
- package/dist/pie-chart.d.ts +2 -5
- package/dist/pie-chart.js +23 -13
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +5 -5
- package/dist/radar-chart.d.mts +2 -1
- package/dist/radar-chart.d.ts +2 -1
- package/dist/radar-chart.js +25 -12
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +4 -4
- package/dist/use-area-chart.d.mts +1 -0
- package/dist/use-area-chart.d.ts +1 -0
- package/dist/use-bar-chart.d.mts +16 -2
- package/dist/use-bar-chart.d.ts +16 -2
- package/dist/use-bar-chart.js +38 -2
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +1 -1
- package/dist/use-chart-axis.d.mts +8 -3
- package/dist/use-chart-axis.d.ts +8 -3
- package/dist/use-chart-axis.js +2 -3
- package/dist/use-chart-axis.js.map +1 -1
- package/dist/use-chart-axis.mjs +1 -1
- package/dist/use-chart-grid.d.mts +1 -0
- package/dist/use-chart-grid.d.ts +1 -0
- package/dist/use-chart-legend.d.mts +1 -0
- package/dist/use-chart-legend.d.ts +1 -0
- package/dist/use-chart-reference-line.d.mts +1 -0
- package/dist/use-chart-reference-line.d.ts +1 -0
- package/dist/use-chart-tooltip.d.mts +9 -0
- package/dist/use-chart-tooltip.d.ts +9 -0
- package/dist/use-chart-tooltip.js.map +1 -1
- package/dist/use-chart-tooltip.mjs +1 -1
- package/dist/use-chart.d.mts +1 -0
- package/dist/use-chart.d.ts +1 -0
- package/dist/use-line-chart.d.mts +1 -0
- package/dist/use-line-chart.d.ts +1 -0
- package/dist/use-pie-chart.d.mts +4 -3
- package/dist/use-pie-chart.d.ts +4 -3
- package/dist/use-pie-chart.js +6 -6
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +2 -2
- package/dist/use-radar-chart.d.mts +8 -3
- package/dist/use-radar-chart.d.ts +8 -3
- package/dist/use-radar-chart.js +6 -5
- package/dist/use-radar-chart.js.map +1 -1
- package/dist/use-radar-chart.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-CCFQC3T6.mjs.map +0 -1
- package/dist/chunk-CIRGC4FT.mjs.map +0 -1
- package/dist/chunk-FTAFXLVL.mjs.map +0 -1
- package/dist/chunk-IOVOXWUL.mjs.map +0 -1
- package/dist/chunk-KPKLW25H.mjs.map +0 -1
- package/dist/chunk-MVKJVXAK.mjs.map +0 -1
- package/dist/chunk-OOWHC7AF.mjs.map +0 -1
- package/dist/chunk-PSJKBKOF.mjs.map +0 -1
- package/dist/chunk-TSAITPYC.mjs.map +0 -1
- package/dist/chunk-UK6B6KJ7.mjs.map +0 -1
- package/dist/chunk-X7MOM6U4.mjs.map +0 -1
- package/dist/chunk-XHDDK4ZU.mjs.map +0 -1
package/dist/index.js
CHANGED
@@ -23,6 +23,7 @@ var src_exports = {};
|
|
23
23
|
__export(src_exports, {
|
24
24
|
AreaChart: () => AreaChart,
|
25
25
|
BarChart: () => BarChart,
|
26
|
+
ChartCell: () => import_recharts8.Cell,
|
26
27
|
DonutChart: () => DonutChart,
|
27
28
|
LineChart: () => LineChart,
|
28
29
|
PieChart: () => PieChart,
|
@@ -601,20 +602,29 @@ var import_core4 = require("@yamada-ui/core");
|
|
601
602
|
var import_utils4 = require("@yamada-ui/utils");
|
602
603
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
603
604
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
604
|
-
({
|
605
|
+
({
|
606
|
+
label,
|
607
|
+
className,
|
608
|
+
payload = [],
|
609
|
+
valueFormatter,
|
610
|
+
labelFormatter,
|
611
|
+
unit,
|
612
|
+
...rest
|
613
|
+
}, ref) => {
|
614
|
+
var _a;
|
605
615
|
const { styles } = useTooltip();
|
606
616
|
const items = payload.map(
|
607
617
|
({ color: colorProp, name, value: valueProp, payload: payload2 } = {}, index) => {
|
608
|
-
var
|
618
|
+
var _a2;
|
609
619
|
const color = colorProp != null ? colorProp : payload2 == null ? void 0 : payload2.color;
|
610
620
|
let value;
|
611
621
|
if ((0, import_utils4.isArray)(valueProp)) {
|
612
622
|
value = valueProp.map((value2) => {
|
613
|
-
var
|
614
|
-
return `${(
|
623
|
+
var _a3;
|
624
|
+
return `${(_a3 = valueFormatter == null ? void 0 : valueFormatter(value2)) != null ? _a3 : value2}`;
|
615
625
|
}).join(" - ");
|
616
626
|
} else {
|
617
|
-
value = (
|
627
|
+
value = (_a2 = valueFormatter == null ? void 0 : valueFormatter(valueProp)) != null ? _a2 : valueProp;
|
618
628
|
}
|
619
629
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
620
630
|
import_core4.ui.div,
|
@@ -663,7 +673,7 @@ var ChartTooltip = (0, import_core4.forwardRef)(
|
|
663
673
|
__css: styles.tooltip,
|
664
674
|
...rest,
|
665
675
|
children: [
|
666
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: label }) : null,
|
676
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: (_a = labelFormatter == null ? void 0 : labelFormatter(label)) != null ? _a : label }) : null,
|
667
677
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.div, { className: "ui-chart__tooltip-list", __css: styles.tooltipList, children: items })
|
668
678
|
]
|
669
679
|
}
|
@@ -686,7 +696,8 @@ var useChartAxis = ({
|
|
686
696
|
xAxisLabel: xAxisLabelProp,
|
687
697
|
yAxisLabel: yAxisLabelProp,
|
688
698
|
unit,
|
689
|
-
|
699
|
+
yAxisTickFormatter = type === "percent" && layoutType === "horizontal" ? valueToPercent : void 0,
|
700
|
+
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
690
701
|
styles,
|
691
702
|
...rest
|
692
703
|
}) => {
|
@@ -705,8 +716,6 @@ var useChartAxis = ({
|
|
705
716
|
const getTickLine = (withTickLine) => withTickLine ? { stroke: "currentColor" } : false;
|
706
717
|
const xTickLine = getTickLine(withXTickLine);
|
707
718
|
const yTickLine = getTickLine(withYTickLine);
|
708
|
-
const yAxisTickFormatter = type === "percent" && layoutType !== "vertical" ? valueToPercent : valueFormatter;
|
709
|
-
const xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : valueFormatter;
|
710
719
|
const xAxisLabel = layoutType === "vertical" ? yAxisLabelProp : xAxisLabelProp;
|
711
720
|
const yAxisLabel = layoutType === "vertical" ? xAxisLabelProp : yAxisLabelProp;
|
712
721
|
const [xAxisProps, xAxisClassName] = getComponentProps(
|
@@ -1220,7 +1229,10 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1220
1229
|
xAxisLabelProps,
|
1221
1230
|
yAxisLabelProps,
|
1222
1231
|
unit,
|
1232
|
+
yAxisTickFormatter,
|
1233
|
+
xAxisTickFormatter,
|
1223
1234
|
valueFormatter,
|
1235
|
+
labelFormatter,
|
1224
1236
|
referenceLineProps,
|
1225
1237
|
tooltipProps,
|
1226
1238
|
tooltipAnimationDuration,
|
@@ -1279,7 +1291,8 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1279
1291
|
xAxisLabelProps,
|
1280
1292
|
yAxisLabelProps,
|
1281
1293
|
unit,
|
1282
|
-
|
1294
|
+
yAxisTickFormatter,
|
1295
|
+
xAxisTickFormatter,
|
1283
1296
|
styles
|
1284
1297
|
});
|
1285
1298
|
const { getReferenceLineProps } = useChartReferenceLine({
|
@@ -1387,6 +1400,7 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1387
1400
|
label,
|
1388
1401
|
payload,
|
1389
1402
|
valueFormatter,
|
1403
|
+
labelFormatter,
|
1390
1404
|
unit,
|
1391
1405
|
...computedTooltipProps
|
1392
1406
|
}
|
@@ -1409,12 +1423,14 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1409
1423
|
var import_core12 = require("@yamada-ui/core");
|
1410
1424
|
var import_utils13 = require("@yamada-ui/utils");
|
1411
1425
|
var import_react10 = require("react");
|
1412
|
-
var
|
1426
|
+
var import_recharts3 = require("recharts");
|
1413
1427
|
|
1414
|
-
// src/use-bar-chart.
|
1428
|
+
// src/use-bar-chart.tsx
|
1415
1429
|
var import_core11 = require("@yamada-ui/core");
|
1416
1430
|
var import_utils12 = require("@yamada-ui/utils");
|
1417
1431
|
var import_react9 = require("react");
|
1432
|
+
var import_recharts2 = require("recharts");
|
1433
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
1418
1434
|
var useBarChart = ({
|
1419
1435
|
data,
|
1420
1436
|
series,
|
@@ -1426,6 +1442,7 @@ var useBarChart = ({
|
|
1426
1442
|
xAxisLabel,
|
1427
1443
|
yAxisLabel,
|
1428
1444
|
styles,
|
1445
|
+
cell = defaultBarCell,
|
1429
1446
|
...rest
|
1430
1447
|
}) => {
|
1431
1448
|
var _a;
|
@@ -1582,6 +1599,22 @@ var useBarChart = ({
|
|
1582
1599
|
},
|
1583
1600
|
[barPropsList, stacked]
|
1584
1601
|
);
|
1602
|
+
const bars = (0, import_react9.useMemo)(() => {
|
1603
|
+
const hasStack = series.some((entry) => entry.stackId);
|
1604
|
+
return series.map((series2, index) => {
|
1605
|
+
const { dataKey } = series2;
|
1606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
1607
|
+
import_recharts2.Bar,
|
1608
|
+
{
|
1609
|
+
...getBarProps({ index, className: "ui-bar-chart__bar" }),
|
1610
|
+
children: data.map(
|
1611
|
+
(data2, index2) => (0, import_utils12.runIfFunc)(cell, { series: series2, data: data2, index: index2, hasStack })
|
1612
|
+
)
|
1613
|
+
},
|
1614
|
+
`bar-${dataKey}`
|
1615
|
+
);
|
1616
|
+
});
|
1617
|
+
}, [series, getBarProps, cell, data]);
|
1585
1618
|
const getBarChartProps = (0, import_react9.useCallback)(
|
1586
1619
|
({ className, ...props } = {}, ref = null) => ({
|
1587
1620
|
ref,
|
@@ -1610,15 +1643,32 @@ var useBarChart = ({
|
|
1610
1643
|
]
|
1611
1644
|
);
|
1612
1645
|
return {
|
1646
|
+
bars,
|
1613
1647
|
barVars,
|
1614
1648
|
getBarProps,
|
1615
1649
|
getBarChartProps,
|
1616
1650
|
setHighlightedArea
|
1617
1651
|
};
|
1618
1652
|
};
|
1653
|
+
var defaultBarCell = ({
|
1654
|
+
hasStack,
|
1655
|
+
series,
|
1656
|
+
data,
|
1657
|
+
index
|
1658
|
+
}) => {
|
1659
|
+
const { dataKey } = series;
|
1660
|
+
const key = `cell-${dataKey}-${index}`;
|
1661
|
+
if (!hasStack) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts2.Cell, {}, key);
|
1662
|
+
const keys = Object.keys(data);
|
1663
|
+
const values = Object.values(data);
|
1664
|
+
const currentIndex = keys.findIndex((key2) => key2 === dataKey);
|
1665
|
+
const lastIndex = values.findLastIndex((value) => value !== 0);
|
1666
|
+
if (currentIndex === lastIndex) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts2.Cell, {}, key);
|
1667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts2.Cell, { radius: 0 }, key);
|
1668
|
+
};
|
1619
1669
|
|
1620
1670
|
// src/bar-chart.tsx
|
1621
|
-
var
|
1671
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
1622
1672
|
var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
1623
1673
|
const [styles, mergedProps] = (0, import_core12.useMultiComponentStyle)("BarChart", props);
|
1624
1674
|
const {
|
@@ -1642,7 +1692,10 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1642
1692
|
withLegend = false,
|
1643
1693
|
containerProps,
|
1644
1694
|
unit,
|
1695
|
+
yAxisTickFormatter,
|
1696
|
+
xAxisTickFormatter,
|
1645
1697
|
valueFormatter,
|
1698
|
+
labelFormatter,
|
1646
1699
|
tooltipProps,
|
1647
1700
|
tooltipAnimationDuration,
|
1648
1701
|
legendProps,
|
@@ -1653,11 +1706,13 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1653
1706
|
fillOpacity,
|
1654
1707
|
chartProps,
|
1655
1708
|
syncId,
|
1709
|
+
cell,
|
1656
1710
|
...rest
|
1657
1711
|
} = (0, import_core12.omitThemeProps)(mergedProps);
|
1658
|
-
const {
|
1712
|
+
const { bars, barVars, getBarChartProps, setHighlightedArea } = useBarChart({
|
1659
1713
|
data,
|
1660
1714
|
series,
|
1715
|
+
cell,
|
1661
1716
|
type,
|
1662
1717
|
layoutType,
|
1663
1718
|
chartProps,
|
@@ -1690,7 +1745,8 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1690
1745
|
xAxisLabelProps,
|
1691
1746
|
yAxisLabelProps,
|
1692
1747
|
unit,
|
1693
|
-
|
1748
|
+
yAxisTickFormatter,
|
1749
|
+
xAxisTickFormatter,
|
1694
1750
|
styles
|
1695
1751
|
});
|
1696
1752
|
const { getReferenceLineProps } = useChartReferenceLine({
|
@@ -1711,21 +1767,9 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1711
1767
|
const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
|
1712
1768
|
legendProps
|
1713
1769
|
});
|
1714
|
-
const bars = (0, import_react10.useMemo)(
|
1715
|
-
() => series.map(({ dataKey: dataKey2 }, index) => {
|
1716
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
1717
|
-
import_recharts2.Bar,
|
1718
|
-
{
|
1719
|
-
...getBarProps({ index, className: "ui-bar-chart__bar" })
|
1720
|
-
},
|
1721
|
-
`bar-${dataKey2}`
|
1722
|
-
);
|
1723
|
-
}),
|
1724
|
-
[getBarProps, series]
|
1725
|
-
);
|
1726
1770
|
const referenceLinesItems = (0, import_react10.useMemo)(
|
1727
|
-
() => referenceLineProps.map((_, index) => /* @__PURE__ */ (0,
|
1728
|
-
|
1771
|
+
() => referenceLineProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1772
|
+
import_recharts3.ReferenceLine,
|
1729
1773
|
{
|
1730
1774
|
...getReferenceLineProps({
|
1731
1775
|
index,
|
@@ -1736,7 +1780,7 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1736
1780
|
)),
|
1737
1781
|
[getReferenceLineProps, referenceLineProps]
|
1738
1782
|
);
|
1739
|
-
return /* @__PURE__ */ (0,
|
1783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1740
1784
|
import_core12.ui.div,
|
1741
1785
|
{
|
1742
1786
|
ref,
|
@@ -1744,41 +1788,41 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1744
1788
|
var: barVars,
|
1745
1789
|
__css: { ...styles.container },
|
1746
1790
|
...rest,
|
1747
|
-
children: /* @__PURE__ */ (0,
|
1748
|
-
|
1791
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1792
|
+
import_recharts3.ResponsiveContainer,
|
1749
1793
|
{
|
1750
1794
|
...getContainerProps({ className: "ui-bar-chart__container" }),
|
1751
|
-
children: /* @__PURE__ */ (0,
|
1752
|
-
|
1795
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
1796
|
+
import_recharts3.BarChart,
|
1753
1797
|
{
|
1754
1798
|
...getBarChartProps({ className: "ui-bar-chart__chart" }),
|
1755
1799
|
children: [
|
1756
|
-
/* @__PURE__ */ (0,
|
1757
|
-
|
1800
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1801
|
+
import_recharts3.CartesianGrid,
|
1758
1802
|
{
|
1759
1803
|
...getGridProps({ className: "ui-bar-chart__grid" })
|
1760
1804
|
}
|
1761
1805
|
),
|
1762
|
-
/* @__PURE__ */ (0,
|
1763
|
-
|
1806
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts3.XAxis, { ...getXAxisProps({ className: "ui-bar-chart__x-axis" }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1807
|
+
import_recharts3.Label,
|
1764
1808
|
{
|
1765
1809
|
...getXAxisLabelProps({
|
1766
1810
|
className: "ui-bar-chart__x-axis-label"
|
1767
1811
|
})
|
1768
1812
|
}
|
1769
1813
|
) }),
|
1770
|
-
/* @__PURE__ */ (0,
|
1771
|
-
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_recharts3.YAxis, { ...getYAxisProps({ className: "ui-bar-chart__y-axis" }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1815
|
+
import_recharts3.Label,
|
1772
1816
|
{
|
1773
1817
|
...getYAxisLabelProps({
|
1774
1818
|
className: "ui-bar-chart__y-axis-label"
|
1775
1819
|
})
|
1776
1820
|
}
|
1777
1821
|
) }),
|
1778
|
-
withLegend ? /* @__PURE__ */ (0,
|
1779
|
-
|
1822
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1823
|
+
import_recharts3.Legend,
|
1780
1824
|
{
|
1781
|
-
content: ({ payload }) => /* @__PURE__ */ (0,
|
1825
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1782
1826
|
ChartLegend,
|
1783
1827
|
{
|
1784
1828
|
className: "ui-bar-chart__legend",
|
@@ -1790,16 +1834,17 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1790
1834
|
...getLegendProps()
|
1791
1835
|
}
|
1792
1836
|
) : null,
|
1793
|
-
withTooltip ? /* @__PURE__ */ (0,
|
1794
|
-
|
1837
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1838
|
+
import_recharts3.Tooltip,
|
1795
1839
|
{
|
1796
|
-
content: ({ label, payload }) => /* @__PURE__ */ (0,
|
1840
|
+
content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
1797
1841
|
ChartTooltip,
|
1798
1842
|
{
|
1799
1843
|
className: "ui-bar-chart__tooltip",
|
1800
1844
|
label,
|
1801
1845
|
payload,
|
1802
1846
|
valueFormatter,
|
1847
|
+
labelFormatter,
|
1803
1848
|
unit,
|
1804
1849
|
...computedTooltipProps
|
1805
1850
|
}
|
@@ -1822,10 +1867,10 @@ var BarChart = (0, import_core12.forwardRef)((props, ref) => {
|
|
1822
1867
|
var import_core14 = require("@yamada-ui/core");
|
1823
1868
|
var import_utils15 = require("@yamada-ui/utils");
|
1824
1869
|
var import_react12 = require("react");
|
1825
|
-
var
|
1870
|
+
var import_recharts4 = require("recharts");
|
1826
1871
|
|
1827
1872
|
// src/area-chart-gradient.tsx
|
1828
|
-
var
|
1873
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
1829
1874
|
var AreaGradient = ({
|
1830
1875
|
color,
|
1831
1876
|
id,
|
@@ -1833,20 +1878,20 @@ var AreaGradient = ({
|
|
1833
1878
|
fillOpacity
|
1834
1879
|
}) => {
|
1835
1880
|
if (withGradient) {
|
1836
|
-
return /* @__PURE__ */ (0,
|
1837
|
-
/* @__PURE__ */ (0,
|
1838
|
-
/* @__PURE__ */ (0,
|
1881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
1882
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
|
1883
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
|
1839
1884
|
] });
|
1840
1885
|
} else {
|
1841
|
-
return /* @__PURE__ */ (0,
|
1886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("stop", { stopColor: color, stopOpacity: fillOpacity }) });
|
1842
1887
|
}
|
1843
1888
|
};
|
1844
1889
|
|
1845
1890
|
// src/area-chart-split.tsx
|
1846
|
-
var
|
1891
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
1847
1892
|
var AreaSplit = ({ offset, id, fillOpacity }) => {
|
1848
|
-
return /* @__PURE__ */ (0,
|
1849
|
-
/* @__PURE__ */ (0,
|
1893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
1850
1895
|
"stop",
|
1851
1896
|
{
|
1852
1897
|
offset,
|
@@ -1854,7 +1899,7 @@ var AreaSplit = ({ offset, id, fillOpacity }) => {
|
|
1854
1899
|
stopOpacity: fillOpacity != null ? fillOpacity : 0.4
|
1855
1900
|
}
|
1856
1901
|
),
|
1857
|
-
/* @__PURE__ */ (0,
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
1858
1903
|
"stop",
|
1859
1904
|
{
|
1860
1905
|
offset,
|
@@ -2189,7 +2234,7 @@ var useAreaChart = ({
|
|
2189
2234
|
};
|
2190
2235
|
|
2191
2236
|
// src/area-chart.tsx
|
2192
|
-
var
|
2237
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
2193
2238
|
var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
2194
2239
|
const [styles, mergedProps] = (0, import_core14.useMultiComponentStyle)("AreaChart", props);
|
2195
2240
|
const {
|
@@ -2215,7 +2260,10 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2215
2260
|
unit,
|
2216
2261
|
gridProps,
|
2217
2262
|
strokeDasharray,
|
2263
|
+
yAxisTickFormatter,
|
2264
|
+
xAxisTickFormatter,
|
2218
2265
|
valueFormatter,
|
2266
|
+
labelFormatter,
|
2219
2267
|
tooltipProps,
|
2220
2268
|
tooltipAnimationDuration,
|
2221
2269
|
legendProps,
|
@@ -2284,7 +2332,8 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2284
2332
|
xAxisLabelProps,
|
2285
2333
|
yAxisLabelProps,
|
2286
2334
|
unit,
|
2287
|
-
|
2335
|
+
yAxisTickFormatter,
|
2336
|
+
xAxisTickFormatter,
|
2288
2337
|
styles
|
2289
2338
|
});
|
2290
2339
|
const { getReferenceLineProps } = useChartReferenceLine({
|
@@ -2311,16 +2360,16 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2311
2360
|
index,
|
2312
2361
|
className: "ui-area-chart__area"
|
2313
2362
|
});
|
2314
|
-
return /* @__PURE__ */ (0,
|
2315
|
-
/* @__PURE__ */ (0,
|
2316
|
-
/* @__PURE__ */ (0,
|
2363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react12.Fragment, { children: [
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AreaGradient, { ...getAreaGradientProps({ id, color: stroke }) }) }),
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_recharts4.Area, { id, stroke, ...rest2 })
|
2317
2366
|
] }, `area-${dataKey2}`);
|
2318
2367
|
}),
|
2319
2368
|
[getAreaGradientProps, getAreaProps, series]
|
2320
2369
|
);
|
2321
2370
|
const referenceLinesItems = (0, import_react12.useMemo)(
|
2322
|
-
() => referenceLineProps.map((_, index) => /* @__PURE__ */ (0,
|
2323
|
-
|
2371
|
+
() => referenceLineProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2372
|
+
import_recharts4.ReferenceLine,
|
2324
2373
|
{
|
2325
2374
|
...getReferenceLineProps({
|
2326
2375
|
index,
|
@@ -2331,7 +2380,7 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2331
2380
|
)),
|
2332
2381
|
[getReferenceLineProps, referenceLineProps]
|
2333
2382
|
);
|
2334
|
-
return /* @__PURE__ */ (0,
|
2383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2335
2384
|
import_core14.ui.div,
|
2336
2385
|
{
|
2337
2386
|
ref,
|
@@ -2339,41 +2388,41 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2339
2388
|
var: areaVars,
|
2340
2389
|
__css: { ...styles.container },
|
2341
2390
|
...rest,
|
2342
|
-
children: /* @__PURE__ */ (0,
|
2343
|
-
|
2391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2392
|
+
import_recharts4.ResponsiveContainer,
|
2344
2393
|
{
|
2345
2394
|
...getContainerProps({ className: "ui-area-chart__container" }),
|
2346
|
-
children: /* @__PURE__ */ (0,
|
2347
|
-
|
2395
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
2396
|
+
import_recharts4.AreaChart,
|
2348
2397
|
{
|
2349
2398
|
...getAreaChartProps({ className: "ui-area-chart__chart" }),
|
2350
2399
|
children: [
|
2351
|
-
/* @__PURE__ */ (0,
|
2352
|
-
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2401
|
+
import_recharts4.CartesianGrid,
|
2353
2402
|
{
|
2354
2403
|
...getGridProps({ className: "ui-area-chart__grid" })
|
2355
2404
|
}
|
2356
2405
|
),
|
2357
|
-
/* @__PURE__ */ (0,
|
2358
|
-
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_recharts4.XAxis, { ...getXAxisProps({ className: "ui-area-chart__x-axis" }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2407
|
+
import_recharts4.Label,
|
2359
2408
|
{
|
2360
2409
|
...getXAxisLabelProps({
|
2361
2410
|
className: "ui-area-chart__x-axis-label"
|
2362
2411
|
})
|
2363
2412
|
}
|
2364
2413
|
) }),
|
2365
|
-
/* @__PURE__ */ (0,
|
2366
|
-
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_recharts4.YAxis, { ...getYAxisProps({ className: "ui-area-chart__y-axis" }), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2415
|
+
import_recharts4.Label,
|
2367
2416
|
{
|
2368
2417
|
...getYAxisLabelProps({
|
2369
2418
|
className: "ui-area-chart__y-axis-label"
|
2370
2419
|
})
|
2371
2420
|
}
|
2372
2421
|
) }),
|
2373
|
-
withLegend ? /* @__PURE__ */ (0,
|
2374
|
-
|
2422
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2423
|
+
import_recharts4.Legend,
|
2375
2424
|
{
|
2376
|
-
content: ({ payload }) => /* @__PURE__ */ (0,
|
2425
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2377
2426
|
ChartLegend,
|
2378
2427
|
{
|
2379
2428
|
className: "ui-area-chart__legend",
|
@@ -2385,16 +2434,17 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2385
2434
|
...getLegendProps()
|
2386
2435
|
}
|
2387
2436
|
) : null,
|
2388
|
-
withTooltip ? /* @__PURE__ */ (0,
|
2389
|
-
|
2437
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2438
|
+
import_recharts4.Tooltip,
|
2390
2439
|
{
|
2391
|
-
content: ({ label, payload }) => /* @__PURE__ */ (0,
|
2440
|
+
content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
2392
2441
|
ChartTooltip,
|
2393
2442
|
{
|
2394
2443
|
className: "ui-area-chart__tooltip",
|
2395
2444
|
label,
|
2396
2445
|
payload,
|
2397
2446
|
valueFormatter,
|
2447
|
+
labelFormatter,
|
2398
2448
|
unit,
|
2399
2449
|
...computedTooltipProps
|
2400
2450
|
}
|
@@ -2402,7 +2452,7 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2402
2452
|
...getTooltipProps()
|
2403
2453
|
}
|
2404
2454
|
) : null,
|
2405
|
-
type === "split" ? /* @__PURE__ */ (0,
|
2455
|
+
type === "split" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AreaSplit, { ...getAreaSplitProps() }) }) : null,
|
2406
2456
|
areas,
|
2407
2457
|
referenceLinesItems
|
2408
2458
|
]
|
@@ -2418,7 +2468,7 @@ var AreaChart = (0, import_core14.forwardRef)((props, ref) => {
|
|
2418
2468
|
var import_core16 = require("@yamada-ui/core");
|
2419
2469
|
var import_utils17 = require("@yamada-ui/utils");
|
2420
2470
|
var import_react14 = require("react");
|
2421
|
-
var
|
2471
|
+
var import_recharts5 = require("recharts");
|
2422
2472
|
|
2423
2473
|
// src/use-radar-chart.ts
|
2424
2474
|
var import_core15 = require("@yamada-ui/core");
|
@@ -2432,7 +2482,8 @@ var useRadarChart = ({
|
|
2432
2482
|
withActiveDots = false,
|
2433
2483
|
strokeWidth = 2,
|
2434
2484
|
fillOpacity = 0.4,
|
2435
|
-
|
2485
|
+
polarAngleAxisTickFormatter,
|
2486
|
+
polarRadiusAxisTickFormatter,
|
2436
2487
|
strokeDasharray,
|
2437
2488
|
styles,
|
2438
2489
|
...rest
|
@@ -2700,7 +2751,7 @@ var useRadarChart = ({
|
|
2700
2751
|
polarAngleAxisTickClassName
|
2701
2752
|
)
|
2702
2753
|
},
|
2703
|
-
tickFormatter:
|
2754
|
+
tickFormatter: polarAngleAxisTickFormatter,
|
2704
2755
|
tickSize: 16,
|
2705
2756
|
...props,
|
2706
2757
|
...polarAngleAxisProps
|
@@ -2710,7 +2761,7 @@ var useRadarChart = ({
|
|
2710
2761
|
polarAngleAxisClassName,
|
2711
2762
|
polarAngleAxisProps,
|
2712
2763
|
polarAngleAxisTickClassName,
|
2713
|
-
|
2764
|
+
polarAngleAxisTickFormatter
|
2714
2765
|
]
|
2715
2766
|
);
|
2716
2767
|
const getPolarRadiusAxisProps = (0, import_react13.useCallback)(
|
@@ -2723,7 +2774,7 @@ var useRadarChart = ({
|
|
2723
2774
|
polarRadiusAxisTickClassName
|
2724
2775
|
)
|
2725
2776
|
},
|
2726
|
-
tickFormatter:
|
2777
|
+
tickFormatter: polarRadiusAxisTickFormatter,
|
2727
2778
|
...props,
|
2728
2779
|
...polarRadiusAxisProps
|
2729
2780
|
}),
|
@@ -2731,7 +2782,7 @@ var useRadarChart = ({
|
|
2731
2782
|
polarRadiusAxisClassName,
|
2732
2783
|
polarRadiusAxisProps,
|
2733
2784
|
polarRadiusAxisTickClassName,
|
2734
|
-
|
2785
|
+
polarRadiusAxisTickFormatter
|
2735
2786
|
]
|
2736
2787
|
);
|
2737
2788
|
return {
|
@@ -2746,7 +2797,7 @@ var useRadarChart = ({
|
|
2746
2797
|
};
|
2747
2798
|
|
2748
2799
|
// src/radar-chart.tsx
|
2749
|
-
var
|
2800
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
2750
2801
|
var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
2751
2802
|
const [styles, mergedProps] = (0, import_core16.useMultiComponentStyle)("RadarChart", props);
|
2752
2803
|
const {
|
@@ -2767,6 +2818,8 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2767
2818
|
tooltipAnimationDuration,
|
2768
2819
|
unit,
|
2769
2820
|
valueFormatter,
|
2821
|
+
polarAngleAxisTickFormatter,
|
2822
|
+
polarRadiusAxisTickFormatter,
|
2770
2823
|
strokeDasharray,
|
2771
2824
|
withDots,
|
2772
2825
|
withActiveDots,
|
@@ -2802,7 +2855,8 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2802
2855
|
withActiveDots,
|
2803
2856
|
strokeWidth,
|
2804
2857
|
fillOpacity,
|
2805
|
-
|
2858
|
+
polarAngleAxisTickFormatter,
|
2859
|
+
polarRadiusAxisTickFormatter,
|
2806
2860
|
strokeDasharray,
|
2807
2861
|
styles
|
2808
2862
|
});
|
@@ -2816,8 +2870,8 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2816
2870
|
legendProps
|
2817
2871
|
});
|
2818
2872
|
const radars = (0, import_react14.useMemo)(
|
2819
|
-
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0,
|
2820
|
-
|
2873
|
+
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2874
|
+
import_recharts5.Radar,
|
2821
2875
|
{
|
2822
2876
|
...getRadarProps({ index, className: "ui-radar-chart__radar" })
|
2823
2877
|
},
|
@@ -2825,7 +2879,7 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2825
2879
|
)),
|
2826
2880
|
[getRadarProps, series]
|
2827
2881
|
);
|
2828
|
-
return /* @__PURE__ */ (0,
|
2882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2829
2883
|
import_core16.ui.div,
|
2830
2884
|
{
|
2831
2885
|
ref,
|
@@ -2833,43 +2887,43 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2833
2887
|
var: radarVars,
|
2834
2888
|
__css: { ...styles.container },
|
2835
2889
|
...rest,
|
2836
|
-
children: /* @__PURE__ */ (0,
|
2837
|
-
|
2890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2891
|
+
import_recharts5.ResponsiveContainer,
|
2838
2892
|
{
|
2839
2893
|
...getContainerProps({ className: "ui-radar-chart__container" }),
|
2840
|
-
children: /* @__PURE__ */ (0,
|
2841
|
-
|
2894
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
2895
|
+
import_recharts5.RadarChart,
|
2842
2896
|
{
|
2843
2897
|
...getRadarChartProps({ className: "ui-radar-chart__chart" }),
|
2844
2898
|
children: [
|
2845
|
-
withPolarGrid ? /* @__PURE__ */ (0,
|
2846
|
-
|
2899
|
+
withPolarGrid ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2900
|
+
import_recharts5.PolarGrid,
|
2847
2901
|
{
|
2848
2902
|
...getPolarGridProps({
|
2849
2903
|
className: "ui-radar-chart__polar-grid"
|
2850
2904
|
})
|
2851
2905
|
}
|
2852
2906
|
) : null,
|
2853
|
-
withPolarAngleAxis ? /* @__PURE__ */ (0,
|
2854
|
-
|
2907
|
+
withPolarAngleAxis ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2908
|
+
import_recharts5.PolarAngleAxis,
|
2855
2909
|
{
|
2856
2910
|
...getPolarAngleAxisProps({
|
2857
2911
|
className: "ui-radar-chart__polar-angle-axis"
|
2858
2912
|
})
|
2859
2913
|
}
|
2860
2914
|
) : null,
|
2861
|
-
withPolarRadiusAxis ? /* @__PURE__ */ (0,
|
2862
|
-
|
2915
|
+
withPolarRadiusAxis ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2916
|
+
import_recharts5.PolarRadiusAxis,
|
2863
2917
|
{
|
2864
2918
|
...getPolarRadiusAxisProps({
|
2865
2919
|
className: "ui-radar-chart__polar-radius-axis"
|
2866
2920
|
})
|
2867
2921
|
}
|
2868
2922
|
) : null,
|
2869
|
-
withLegend ? /* @__PURE__ */ (0,
|
2870
|
-
|
2923
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2924
|
+
import_recharts5.Legend,
|
2871
2925
|
{
|
2872
|
-
content: ({ payload }) => /* @__PURE__ */ (0,
|
2926
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2873
2927
|
ChartLegend,
|
2874
2928
|
{
|
2875
2929
|
className: "ui-area-chart__legend",
|
@@ -2881,10 +2935,10 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2881
2935
|
...getLegendProps()
|
2882
2936
|
}
|
2883
2937
|
) : null,
|
2884
|
-
withTooltip ? /* @__PURE__ */ (0,
|
2885
|
-
|
2938
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2939
|
+
import_recharts5.Tooltip,
|
2886
2940
|
{
|
2887
|
-
content: ({ label, payload }) => /* @__PURE__ */ (0,
|
2941
|
+
content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
2888
2942
|
ChartTooltip,
|
2889
2943
|
{
|
2890
2944
|
className: "ui-line-chart__tooltip",
|
@@ -2912,7 +2966,7 @@ var RadarChart = (0, import_core16.forwardRef)((props, ref) => {
|
|
2912
2966
|
var import_core19 = require("@yamada-ui/core");
|
2913
2967
|
var import_utils20 = require("@yamada-ui/utils");
|
2914
2968
|
var import_react16 = require("react");
|
2915
|
-
var
|
2969
|
+
var import_recharts6 = require("recharts");
|
2916
2970
|
|
2917
2971
|
// src/use-pie-chart.ts
|
2918
2972
|
var import_core18 = require("@yamada-ui/core");
|
@@ -2922,7 +2976,7 @@ var import_react15 = require("react");
|
|
2922
2976
|
// src/pie-chart-label.tsx
|
2923
2977
|
var import_core17 = require("@yamada-ui/core");
|
2924
2978
|
var import_utils18 = require("@yamada-ui/utils");
|
2925
|
-
var
|
2979
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
2926
2980
|
var RADIAN = Math.PI / 180;
|
2927
2981
|
var DEFAULT_LABEL_OFFSET = 22;
|
2928
2982
|
var pieChartLabel = ({
|
@@ -2938,7 +2992,7 @@ var pieChartLabel = ({
|
|
2938
2992
|
labelOffset: labelOffsetProp,
|
2939
2993
|
isPercent,
|
2940
2994
|
labelProps,
|
2941
|
-
|
2995
|
+
labelFormatter,
|
2942
2996
|
styles
|
2943
2997
|
}) => {
|
2944
2998
|
const labelOffset = labelOffsetProp != null ? labelOffsetProp : (outerRadius - innerRadius) * 0.5 + DEFAULT_LABEL_OFFSET;
|
@@ -2948,13 +3002,13 @@ var pieChartLabel = ({
|
|
2948
3002
|
const displayLabel = () => {
|
2949
3003
|
if (isPercent) {
|
2950
3004
|
return parseFloat((percent * 100).toFixed(0)) > 0 && `${(percent * 100).toFixed(0)}%`;
|
2951
|
-
} else if (!(0, import_utils18.isUndefined)(
|
2952
|
-
return
|
3005
|
+
} else if (!(0, import_utils18.isUndefined)(labelFormatter)) {
|
3006
|
+
return labelFormatter(value);
|
2953
3007
|
} else {
|
2954
3008
|
return value;
|
2955
3009
|
}
|
2956
3010
|
};
|
2957
|
-
return /* @__PURE__ */ (0,
|
3011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
2958
3012
|
import_core17.ui.text,
|
2959
3013
|
{
|
2960
3014
|
className: (0, import_utils18.cx)(cellClassName, "ui-chart__label"),
|
@@ -2985,7 +3039,7 @@ var pieChartLabelLine = ({
|
|
2985
3039
|
const x = cxProp + (middleRadius + labelOffset) * Math.cos(-midAngle * RADIAN);
|
2986
3040
|
const y = cyProp + (middleRadius + labelOffset) * Math.sin(-midAngle * RADIAN);
|
2987
3041
|
const d = `M ${points[0].x} ${points[0].y} L ${x} ${y}`;
|
2988
|
-
return /* @__PURE__ */ (0,
|
3042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
2989
3043
|
import_core17.ui.path,
|
2990
3044
|
{
|
2991
3045
|
className: (0, import_utils18.cx)(cellClassName, "ui-chart__label-line"),
|
@@ -3010,7 +3064,7 @@ var usePieChart = ({
|
|
3010
3064
|
paddingAngle = 0,
|
3011
3065
|
startAngle = 90,
|
3012
3066
|
endAngle = -270,
|
3013
|
-
|
3067
|
+
labelFormatter,
|
3014
3068
|
styles,
|
3015
3069
|
...rest
|
3016
3070
|
}) => {
|
@@ -3090,11 +3144,11 @@ var usePieChart = ({
|
|
3090
3144
|
labelOffset,
|
3091
3145
|
isPercent,
|
3092
3146
|
labelProps,
|
3093
|
-
|
3147
|
+
labelFormatter,
|
3094
3148
|
styles: styles.label,
|
3095
3149
|
...props
|
3096
3150
|
}),
|
3097
|
-
[isPercent, labelOffset, labelProps, styles.label,
|
3151
|
+
[isPercent, labelOffset, labelProps, styles.label, labelFormatter]
|
3098
3152
|
);
|
3099
3153
|
const labelLine = (0, import_react15.useCallback)(
|
3100
3154
|
(props) => {
|
@@ -3207,7 +3261,7 @@ var usePieChart = ({
|
|
3207
3261
|
};
|
3208
3262
|
|
3209
3263
|
// src/donut-chart.tsx
|
3210
|
-
var
|
3264
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
3211
3265
|
var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
3212
3266
|
const [styles, mergedProps] = (0, import_core19.useMultiComponentStyle)("DonutChart", props);
|
3213
3267
|
const {
|
@@ -3223,6 +3277,7 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3223
3277
|
tooltipAnimationDuration,
|
3224
3278
|
tooltipDataSource = "all",
|
3225
3279
|
valueFormatter,
|
3280
|
+
labelFormatter,
|
3226
3281
|
unit,
|
3227
3282
|
paddingAngle,
|
3228
3283
|
startAngle,
|
@@ -3258,7 +3313,7 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3258
3313
|
withLabelLines,
|
3259
3314
|
labelOffset,
|
3260
3315
|
isPercent,
|
3261
|
-
|
3316
|
+
labelFormatter,
|
3262
3317
|
styles
|
3263
3318
|
});
|
3264
3319
|
const { getContainerProps } = useChart({ containerProps });
|
@@ -3271,8 +3326,8 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3271
3326
|
legendProps
|
3272
3327
|
});
|
3273
3328
|
const cells = (0, import_react16.useMemo)(
|
3274
|
-
() => data.map(({ name }, index) => /* @__PURE__ */ (0,
|
3275
|
-
|
3329
|
+
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3330
|
+
import_recharts6.Cell,
|
3276
3331
|
{
|
3277
3332
|
...getCellProps({ index, className: "ui-donut-chart__cell" })
|
3278
3333
|
},
|
@@ -3280,7 +3335,7 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3280
3335
|
)),
|
3281
3336
|
[data, getCellProps]
|
3282
3337
|
);
|
3283
|
-
return /* @__PURE__ */ (0,
|
3338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3284
3339
|
import_core19.ui.div,
|
3285
3340
|
{
|
3286
3341
|
ref,
|
@@ -3288,17 +3343,17 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3288
3343
|
var: pieVars,
|
3289
3344
|
__css: { ...styles.container },
|
3290
3345
|
...rest,
|
3291
|
-
children: /* @__PURE__ */ (0,
|
3292
|
-
|
3346
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3347
|
+
import_recharts6.ResponsiveContainer,
|
3293
3348
|
{
|
3294
3349
|
...getContainerProps({ className: "ui-donut-chart__container" }),
|
3295
|
-
children: /* @__PURE__ */ (0,
|
3296
|
-
|
3350
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
3351
|
+
import_recharts6.PieChart,
|
3297
3352
|
{
|
3298
3353
|
...getPieChartProps({ className: "ui-donut-chart__chart" }),
|
3299
3354
|
children: [
|
3300
|
-
/* @__PURE__ */ (0,
|
3301
|
-
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3356
|
+
import_recharts6.Pie,
|
3302
3357
|
{
|
3303
3358
|
...getPieProps({
|
3304
3359
|
className: "ui-donut-chart__donut"
|
@@ -3306,10 +3361,10 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3306
3361
|
children: cells
|
3307
3362
|
}
|
3308
3363
|
),
|
3309
|
-
withLegend ? /* @__PURE__ */ (0,
|
3310
|
-
|
3364
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3365
|
+
import_recharts6.Legend,
|
3311
3366
|
{
|
3312
|
-
content: ({ payload }) => /* @__PURE__ */ (0,
|
3367
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3313
3368
|
ChartLegend,
|
3314
3369
|
{
|
3315
3370
|
className: "ui-donut-chart__legend",
|
@@ -3321,10 +3376,10 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3321
3376
|
...getLegendProps()
|
3322
3377
|
}
|
3323
3378
|
) : null,
|
3324
|
-
withTooltip ? /* @__PURE__ */ (0,
|
3325
|
-
|
3379
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3380
|
+
import_recharts6.Tooltip,
|
3326
3381
|
{
|
3327
|
-
content: ({ label, payload }) => /* @__PURE__ */ (0,
|
3382
|
+
content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
3328
3383
|
ChartTooltip,
|
3329
3384
|
{
|
3330
3385
|
className: "ui-donut-chart__tooltip",
|
@@ -3351,8 +3406,8 @@ var DonutChart = (0, import_core19.forwardRef)((props, ref) => {
|
|
3351
3406
|
var import_core20 = require("@yamada-ui/core");
|
3352
3407
|
var import_utils21 = require("@yamada-ui/utils");
|
3353
3408
|
var import_react17 = require("react");
|
3354
|
-
var
|
3355
|
-
var
|
3409
|
+
var import_recharts7 = require("recharts");
|
3410
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
3356
3411
|
var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
3357
3412
|
const [styles, mergedProps] = (0, import_core20.useMultiComponentStyle)("PieChart", props);
|
3358
3413
|
const {
|
@@ -3368,6 +3423,7 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3368
3423
|
tooltipAnimationDuration,
|
3369
3424
|
tooltipDataSource = "all",
|
3370
3425
|
valueFormatter,
|
3426
|
+
labelFormatter,
|
3371
3427
|
unit,
|
3372
3428
|
innerRadius,
|
3373
3429
|
outerRadius,
|
@@ -3403,7 +3459,7 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3403
3459
|
withLabelLines,
|
3404
3460
|
labelOffset,
|
3405
3461
|
isPercent,
|
3406
|
-
|
3462
|
+
labelFormatter,
|
3407
3463
|
styles
|
3408
3464
|
});
|
3409
3465
|
const { getContainerProps } = useChart({ containerProps });
|
@@ -3416,8 +3472,8 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3416
3472
|
legendProps
|
3417
3473
|
});
|
3418
3474
|
const cells = (0, import_react17.useMemo)(
|
3419
|
-
() => data.map(({ name }, index) => /* @__PURE__ */ (0,
|
3420
|
-
|
3475
|
+
() => data.map(({ name }, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3476
|
+
import_recharts7.Cell,
|
3421
3477
|
{
|
3422
3478
|
...getCellProps({ index, className: "ui-pie-chart__cell" })
|
3423
3479
|
},
|
@@ -3425,7 +3481,7 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3425
3481
|
)),
|
3426
3482
|
[data, getCellProps]
|
3427
3483
|
);
|
3428
|
-
return /* @__PURE__ */ (0,
|
3484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3429
3485
|
import_core20.ui.div,
|
3430
3486
|
{
|
3431
3487
|
ref,
|
@@ -3433,17 +3489,17 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3433
3489
|
var: pieVars,
|
3434
3490
|
__css: { ...styles.container },
|
3435
3491
|
...rest,
|
3436
|
-
children: /* @__PURE__ */ (0,
|
3437
|
-
|
3492
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3493
|
+
import_recharts7.ResponsiveContainer,
|
3438
3494
|
{
|
3439
3495
|
...getContainerProps({ className: "ui-pie-chart__container" }),
|
3440
|
-
children: /* @__PURE__ */ (0,
|
3441
|
-
|
3496
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
3497
|
+
import_recharts7.PieChart,
|
3442
3498
|
{
|
3443
3499
|
...getPieChartProps({ className: "ui-pie-chart__chart" }),
|
3444
3500
|
children: [
|
3445
|
-
/* @__PURE__ */ (0,
|
3446
|
-
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3502
|
+
import_recharts7.Pie,
|
3447
3503
|
{
|
3448
3504
|
...getPieProps({
|
3449
3505
|
className: "ui-pie-chart__pie"
|
@@ -3451,10 +3507,10 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3451
3507
|
children: cells
|
3452
3508
|
}
|
3453
3509
|
),
|
3454
|
-
withLegend ? /* @__PURE__ */ (0,
|
3455
|
-
|
3510
|
+
withLegend ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3511
|
+
import_recharts7.Legend,
|
3456
3512
|
{
|
3457
|
-
content: ({ payload }) => /* @__PURE__ */ (0,
|
3513
|
+
content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3458
3514
|
ChartLegend,
|
3459
3515
|
{
|
3460
3516
|
className: "ui-pie-chart__legend",
|
@@ -3466,10 +3522,10 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3466
3522
|
...getLegendProps()
|
3467
3523
|
}
|
3468
3524
|
) : null,
|
3469
|
-
withTooltip ? /* @__PURE__ */ (0,
|
3470
|
-
|
3525
|
+
withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3526
|
+
import_recharts7.Tooltip,
|
3471
3527
|
{
|
3472
|
-
content: ({ label, payload }) => /* @__PURE__ */ (0,
|
3528
|
+
content: ({ label, payload }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
3473
3529
|
ChartTooltip,
|
3474
3530
|
{
|
3475
3531
|
className: "ui-pie-chart__tooltip",
|
@@ -3491,10 +3547,14 @@ var PieChart = (0, import_core20.forwardRef)((props, ref) => {
|
|
3491
3547
|
}
|
3492
3548
|
) });
|
3493
3549
|
});
|
3550
|
+
|
3551
|
+
// src/index.ts
|
3552
|
+
var import_recharts8 = require("recharts");
|
3494
3553
|
// Annotate the CommonJS export names for ESM import in node:
|
3495
3554
|
0 && (module.exports = {
|
3496
3555
|
AreaChart,
|
3497
3556
|
BarChart,
|
3557
|
+
ChartCell,
|
3498
3558
|
DonutChart,
|
3499
3559
|
LineChart,
|
3500
3560
|
PieChart,
|