@yamada-ui/charts 1.5.4-dev-20241005224505 → 1.5.4-dev-20241006000212
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart-gradient.d.mts +1 -1
- package/dist/area-chart-gradient.d.ts +1 -1
- package/dist/area-chart-gradient.js +5 -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 +1 -1
- package/dist/area-chart-split.d.ts +1 -1
- package/dist/area-chart-split.js +2 -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 +180 -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 +137 -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 +2 -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 +7 -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-YSPGYMRF.mjs → chunk-5VLSGWQD.mjs} +8 -8
- package/dist/{chunk-YSPGYMRF.mjs.map → chunk-5VLSGWQD.mjs.map} +1 -1
- 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-54WAXZP7.mjs → chunk-NMPNNSBN.mjs} +74 -74
- package/dist/chunk-NMPNNSBN.mjs.map +1 -0
- package/dist/{chunk-OEM3VCHN.mjs → chunk-NQPC5LPY.mjs} +82 -82
- package/dist/chunk-NQPC5LPY.mjs.map +1 -0
- package/dist/{chunk-AYVZF37W.mjs → chunk-OG5CVPPV.mjs} +3 -3
- package/dist/chunk-OG5CVPPV.mjs.map +1 -0
- package/dist/{chunk-X6CD7LHX.mjs → chunk-OUIKA4AX.mjs} +3 -3
- package/dist/{chunk-X6CD7LHX.mjs.map → chunk-OUIKA4AX.mjs.map} +1 -1
- 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-6OYWQ3NO.mjs → chunk-SCY5V45W.mjs} +56 -56
- package/dist/chunk-SCY5V45W.mjs.map +1 -0
- package/dist/{chunk-CQTRL3BW.mjs → chunk-SYBJTMPL.mjs} +90 -90
- package/dist/chunk-SYBJTMPL.mjs.map +1 -0
- package/dist/{chunk-XKVM7WUW.mjs → chunk-TA7YJAW4.mjs} +47 -47
- package/dist/{chunk-XKVM7WUW.mjs.map → chunk-TA7YJAW4.mjs.map} +1 -1
- 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-EE6KEX6V.mjs → chunk-U325CYNR.mjs} +6 -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-NETTMC2D.mjs → chunk-YTUEG4IY.mjs} +45 -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-DZL5KQOJ.mjs → chunk-ZRV4LO67.mjs} +42 -42
- package/dist/chunk-ZRV4LO67.mjs.map +1 -0
- package/dist/donut-chart.js +91 -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 +2069 -2043
- 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 +140 -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 +89 -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 +81 -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 +63 -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-54WAXZP7.mjs.map +0 -1
- package/dist/chunk-6O5G3WYP.mjs.map +0 -1
- package/dist/chunk-6OYWQ3NO.mjs.map +0 -1
- package/dist/chunk-A3IWA366.mjs.map +0 -1
- package/dist/chunk-AYVZF37W.mjs.map +0 -1
- package/dist/chunk-C3ZYUDXE.mjs.map +0 -1
- package/dist/chunk-CQTRL3BW.mjs.map +0 -1
- package/dist/chunk-DZL5KQOJ.mjs.map +0 -1
- package/dist/chunk-EE6KEX6V.mjs.map +0 -1
- package/dist/chunk-FYAC4RRZ.mjs.map +0 -1
- package/dist/chunk-MSG3WFBO.mjs.map +0 -1
- package/dist/chunk-MVRWZTQ5.mjs.map +0 -1
- package/dist/chunk-NETTMC2D.mjs.map +0 -1
- package/dist/chunk-O3LMKYXK.mjs.map +0 -1
- package/dist/chunk-OEM3VCHN.mjs.map +0 -1
- package/dist/chunk-OJ2MLZZ7.mjs.map +0 -1
- package/dist/chunk-OPPMMNGP.mjs.map +0 -1
- package/dist/chunk-VEFEKDMH.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/bar-chart.js
CHANGED
@@ -305,13 +305,13 @@ var useChart = ({ containerProps = {} }) => {
|
|
305
305
|
getContainerProps
|
306
306
|
};
|
307
307
|
};
|
308
|
-
var useLegend = (
|
308
|
+
var useLegend = () => {
|
309
309
|
const { styles } = useChartContext();
|
310
310
|
return {
|
311
311
|
styles
|
312
312
|
};
|
313
313
|
};
|
314
|
-
var useTooltip = (
|
314
|
+
var useTooltip = () => {
|
315
315
|
const { styles } = useChartContext();
|
316
316
|
return {
|
317
317
|
styles
|
@@ -323,7 +323,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
323
323
|
var ChartLegend = (0, import_core3.forwardRef)(
|
324
324
|
({ className, payload = [], onHighlight, ...rest }, ref) => {
|
325
325
|
const { styles } = useLegend();
|
326
|
-
const items = payload.map(({ dataKey, value: valueProp
|
326
|
+
const items = payload.map(({ color, dataKey, value: valueProp }, index) => {
|
327
327
|
const value = dataKey != null ? dataKey : valueProp;
|
328
328
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
329
329
|
import_core3.ui.div,
|
@@ -368,22 +368,22 @@ var import_utils4 = require("@yamada-ui/utils");
|
|
368
368
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
369
369
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
370
370
|
({
|
371
|
-
label,
|
372
|
-
dataKey = "value",
|
373
371
|
className,
|
374
|
-
|
375
|
-
|
372
|
+
dataKey = "value",
|
373
|
+
isRadialChart,
|
374
|
+
label,
|
376
375
|
labelFormatter,
|
376
|
+
payload = [],
|
377
377
|
unit,
|
378
|
-
|
378
|
+
valueFormatter,
|
379
379
|
...rest
|
380
380
|
}, ref) => {
|
381
381
|
var _a;
|
382
382
|
const { styles } = useTooltip();
|
383
383
|
const items = payload.map(
|
384
384
|
({
|
385
|
-
color: colorProp,
|
386
385
|
name: nameProp,
|
386
|
+
color: colorProp,
|
387
387
|
[dataKey]: valueProp,
|
388
388
|
payload: payload2
|
389
389
|
} = {}, index) => {
|
@@ -463,17 +463,17 @@ var import_react2 = require("react");
|
|
463
463
|
var import_recharts = require("recharts");
|
464
464
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
465
465
|
var useBarChart = ({
|
466
|
-
data,
|
467
|
-
series,
|
468
466
|
type = "default",
|
469
|
-
|
470
|
-
|
467
|
+
cell = defaultBarCell,
|
468
|
+
data,
|
471
469
|
fillOpacity = 1,
|
470
|
+
layoutType = "horizontal",
|
471
|
+
series,
|
472
|
+
styles,
|
472
473
|
syncId,
|
473
474
|
xAxisLabel,
|
474
475
|
yAxisLabel,
|
475
|
-
|
476
|
-
cell = defaultBarCell,
|
476
|
+
referenceLineProps = [],
|
477
477
|
...rest
|
478
478
|
}) => {
|
479
479
|
var _a;
|
@@ -552,9 +552,9 @@ var useBarChart = ({
|
|
552
552
|
const barPropsList = (0, import_react2.useMemo)(
|
553
553
|
() => series.map((props, index) => {
|
554
554
|
const {
|
555
|
-
dataKey,
|
556
555
|
activeBar: activeBar2 = {},
|
557
556
|
background: background2 = {},
|
557
|
+
dataKey,
|
558
558
|
dimBar: dimBar2 = {},
|
559
559
|
...computedProps
|
560
560
|
} = props;
|
@@ -608,20 +608,29 @@ var useBarChart = ({
|
|
608
608
|
]
|
609
609
|
);
|
610
610
|
const getBarProps = (0, import_react2.useCallback)(
|
611
|
-
({
|
612
|
-
|
611
|
+
({ className: classNameProp, index, ...props }, ref = null) => {
|
612
|
+
var _a2;
|
613
|
+
const {
|
614
|
+
id,
|
615
|
+
className,
|
616
|
+
activeBar: activeBar2,
|
617
|
+
background: background2,
|
618
|
+
color,
|
619
|
+
dataKey = "",
|
620
|
+
...rest2
|
621
|
+
} = (_a2 = barPropsList[index]) != null ? _a2 : {};
|
613
622
|
return {
|
623
|
+
id,
|
614
624
|
ref,
|
625
|
+
name: dataKey,
|
615
626
|
className: (0, import_utils5.cx)(classNameProp, className),
|
616
627
|
activeBar: activeBar2,
|
617
628
|
background: background2,
|
618
|
-
id,
|
619
|
-
name: dataKey,
|
620
629
|
dataKey,
|
621
630
|
fill: color,
|
622
|
-
stroke: color,
|
623
631
|
isAnimationActive: false,
|
624
632
|
stackId: stacked ? "stack" : void 0,
|
633
|
+
stroke: color,
|
625
634
|
...props,
|
626
635
|
...rest2
|
627
636
|
};
|
@@ -635,9 +644,9 @@ var useBarChart = ({
|
|
635
644
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
636
645
|
import_recharts.Bar,
|
637
646
|
{
|
638
|
-
...getBarProps({
|
647
|
+
...getBarProps({ className: "ui-bar-chart__bar", index }),
|
639
648
|
children: data.map(
|
640
|
-
(data2, index2) => (0, import_utils5.runIfFunc)(cell, {
|
649
|
+
(data2, index2) => (0, import_utils5.runIfFunc)(cell, { data: data2, hasStack, index: index2, series: series2 })
|
641
650
|
)
|
642
651
|
},
|
643
652
|
`bar-${dataKey}`
|
@@ -649,14 +658,14 @@ var useBarChart = ({
|
|
649
658
|
ref,
|
650
659
|
className: (0, import_utils5.cx)(className, barChartClassName),
|
651
660
|
data,
|
652
|
-
stackOffset: type === "percent" ? "expand" : void 0,
|
653
661
|
layout: layoutType,
|
654
|
-
syncId,
|
655
662
|
margin: {
|
656
663
|
bottom: xAxisLabel ? 30 : void 0,
|
657
664
|
left: yAxisLabel ? 10 : void 0,
|
658
665
|
right: yAxisLabel ? 5 : void 0
|
659
666
|
},
|
667
|
+
stackOffset: type === "percent" ? "expand" : void 0,
|
668
|
+
syncId,
|
660
669
|
...props,
|
661
670
|
...chartProps
|
662
671
|
}),
|
@@ -674,16 +683,16 @@ var useBarChart = ({
|
|
674
683
|
return {
|
675
684
|
bars,
|
676
685
|
barVars,
|
677
|
-
|
686
|
+
setHighlightedArea,
|
678
687
|
getBarChartProps,
|
679
|
-
|
688
|
+
getBarProps
|
680
689
|
};
|
681
690
|
};
|
682
691
|
var defaultBarCell = ({
|
683
|
-
hasStack,
|
684
|
-
series,
|
685
692
|
data,
|
686
|
-
|
693
|
+
hasStack,
|
694
|
+
index,
|
695
|
+
series
|
687
696
|
}) => {
|
688
697
|
const { dataKey } = series;
|
689
698
|
const key = `cell-${dataKey}-${index}`;
|
@@ -701,19 +710,19 @@ var import_core6 = require("@yamada-ui/core");
|
|
701
710
|
var import_utils6 = require("@yamada-ui/utils");
|
702
711
|
var import_react3 = require("react");
|
703
712
|
var useChartAxis = ({
|
704
|
-
dataKey,
|
705
713
|
type,
|
714
|
+
dataKey,
|
715
|
+
gridAxis = "x",
|
706
716
|
layoutType = "horizontal",
|
717
|
+
styles,
|
707
718
|
tickLine = "y",
|
708
|
-
|
719
|
+
unit,
|
709
720
|
withXAxis = true,
|
710
721
|
withYAxis = true,
|
711
722
|
xAxisLabel: xAxisLabelProp,
|
723
|
+
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
712
724
|
yAxisLabel: yAxisLabelProp,
|
713
|
-
unit,
|
714
725
|
yAxisTickFormatter = type === "percent" && layoutType === "horizontal" ? valueToPercent : void 0,
|
715
|
-
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
716
|
-
styles,
|
717
726
|
...rest
|
718
727
|
}) => {
|
719
728
|
var _a, _b, _c, _d;
|
@@ -723,7 +732,7 @@ var useChartAxis = ({
|
|
723
732
|
[dataKey, layoutType]
|
724
733
|
);
|
725
734
|
const yAxisKey = (0, import_react3.useMemo)(
|
726
|
-
() => layoutType === "vertical" ? {
|
735
|
+
() => layoutType === "vertical" ? { type: "category", dataKey } : { type: "number" },
|
727
736
|
[dataKey, layoutType]
|
728
737
|
);
|
729
738
|
const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
|
@@ -754,15 +763,15 @@ var useChartAxis = ({
|
|
754
763
|
className: (0, import_utils6.cx)(className, xAxisClassName),
|
755
764
|
hide: !withXAxis,
|
756
765
|
...xAxisKey,
|
757
|
-
tick: {
|
758
|
-
transform: "translate(0, 10)",
|
759
|
-
fill: "currentColor"
|
760
|
-
},
|
761
|
-
stroke: "",
|
762
766
|
interval: "preserveStartEnd",
|
763
|
-
tickLine: xTickLine,
|
764
767
|
minTickGap: 5,
|
768
|
+
stroke: "",
|
769
|
+
tick: {
|
770
|
+
fill: "currentColor",
|
771
|
+
transform: "translate(0, 10)"
|
772
|
+
},
|
765
773
|
tickFormatter: xAxisTickFormatter,
|
774
|
+
tickLine: xTickLine,
|
766
775
|
...props,
|
767
776
|
...xAxisProps
|
768
777
|
}),
|
@@ -778,17 +787,17 @@ var useChartAxis = ({
|
|
778
787
|
const getYAxisProps = (0, import_react3.useCallback)(
|
779
788
|
({ className, ...props } = {}) => ({
|
780
789
|
className: (0, import_utils6.cx)(className, yAxisClassName),
|
781
|
-
hide: !withYAxis,
|
782
790
|
axisLine: false,
|
791
|
+
hide: !withYAxis,
|
783
792
|
...yAxisKey,
|
784
|
-
|
793
|
+
allowDecimals: true,
|
785
794
|
tick: {
|
786
|
-
|
787
|
-
|
795
|
+
fill: "currentColor",
|
796
|
+
transform: "translate(-10, 0)"
|
788
797
|
},
|
789
|
-
allowDecimals: true,
|
790
|
-
unit,
|
791
798
|
tickFormatter: yAxisTickFormatter,
|
799
|
+
tickLine: yTickLine,
|
800
|
+
unit,
|
792
801
|
...props,
|
793
802
|
...yAxisProps
|
794
803
|
}),
|
@@ -805,9 +814,9 @@ var useChartAxis = ({
|
|
805
814
|
const getXAxisLabelProps = (0, import_react3.useCallback)(
|
806
815
|
({ className, ...props } = {}) => ({
|
807
816
|
className: (0, import_utils6.cx)(className, xAxisLabelClassName),
|
808
|
-
value: xAxisLabel,
|
809
|
-
position: "insideBottom",
|
810
817
|
offset: -20,
|
818
|
+
position: "insideBottom",
|
819
|
+
value: xAxisLabel,
|
811
820
|
...props,
|
812
821
|
...xAxisLabelProps
|
813
822
|
}),
|
@@ -816,21 +825,21 @@ var useChartAxis = ({
|
|
816
825
|
const getYAxisLabelProps = (0, import_react3.useCallback)(
|
817
826
|
({ className, ...props } = {}) => ({
|
818
827
|
className: (0, import_utils6.cx)(className, yAxisLabelClassName),
|
819
|
-
value: yAxisLabel,
|
820
|
-
position: "insideLeft",
|
821
828
|
angle: -90,
|
822
|
-
textAnchor: "middle",
|
823
829
|
offset: -5,
|
830
|
+
position: "insideLeft",
|
831
|
+
textAnchor: "middle",
|
832
|
+
value: yAxisLabel,
|
824
833
|
...props,
|
825
834
|
...yAxisLabelProps
|
826
835
|
}),
|
827
836
|
[yAxisLabel, yAxisLabelClassName, yAxisLabelProps]
|
828
837
|
);
|
829
838
|
return {
|
830
|
-
getXAxisProps,
|
831
|
-
getYAxisProps,
|
832
839
|
getXAxisLabelProps,
|
833
|
-
|
840
|
+
getXAxisProps,
|
841
|
+
getYAxisLabelProps,
|
842
|
+
getYAxisProps
|
834
843
|
};
|
835
844
|
};
|
836
845
|
var valueToPercent = (value) => {
|
@@ -842,10 +851,10 @@ var import_core7 = require("@yamada-ui/core");
|
|
842
851
|
var import_utils7 = require("@yamada-ui/utils");
|
843
852
|
var import_react4 = require("react");
|
844
853
|
var useChartGrid = ({
|
845
|
-
gridProps = {},
|
846
854
|
gridAxis = "x",
|
847
855
|
strokeDasharray = "5 5",
|
848
|
-
styles
|
856
|
+
styles,
|
857
|
+
gridProps = {}
|
849
858
|
}) => {
|
850
859
|
const { theme } = (0, import_core7.useTheme)();
|
851
860
|
const [reChartsProps, propClassName] = getComponentProps(
|
@@ -856,9 +865,9 @@ var useChartGrid = ({
|
|
856
865
|
({ className, ...props } = {}, ref = null) => ({
|
857
866
|
ref,
|
858
867
|
className: (0, import_utils7.cx)("ui-chart__grid", className, propClassName),
|
868
|
+
horizontal: gridAxis === "x" || gridAxis === "xy",
|
859
869
|
strokeDasharray,
|
860
870
|
vertical: gridAxis === "y" || gridAxis === "xy",
|
861
|
-
horizontal: gridAxis === "x" || gridAxis === "xy",
|
862
871
|
...props,
|
863
872
|
...reChartsProps
|
864
873
|
}),
|
@@ -888,7 +897,7 @@ var useChartLegend = ({
|
|
888
897
|
},
|
889
898
|
[rest]
|
890
899
|
);
|
891
|
-
return {
|
900
|
+
return { getLegendProps, legendProps };
|
892
901
|
};
|
893
902
|
|
894
903
|
// src/use-chart-reference-line.ts
|
@@ -896,8 +905,8 @@ var import_core8 = require("@yamada-ui/core");
|
|
896
905
|
var import_utils9 = require("@yamada-ui/utils");
|
897
906
|
var import_react6 = require("react");
|
898
907
|
var useChartReferenceLine = ({
|
899
|
-
|
900
|
-
|
908
|
+
styles,
|
909
|
+
referenceLineProps = []
|
901
910
|
}) => {
|
902
911
|
const { theme } = (0, import_core8.useTheme)();
|
903
912
|
const styleClassName = (0, import_core8.getCSS)(styles.referenceLine)(theme);
|
@@ -909,23 +918,24 @@ var useChartReferenceLine = ({
|
|
909
918
|
)(theme);
|
910
919
|
const color = (0, import_core8.getVar)(`reference-line-${index}`)(theme);
|
911
920
|
const label = {
|
912
|
-
value: labelProp,
|
913
921
|
fill: color,
|
914
922
|
position: "insideBottomLeft",
|
923
|
+
value: labelProp,
|
915
924
|
...(0, import_utils9.isObject)(labelProp) ? labelProp : {}
|
916
925
|
};
|
917
|
-
return {
|
926
|
+
return { color, label, propClassName, ...rest };
|
918
927
|
}),
|
919
928
|
[referenceLineProps, styleClassName, theme]
|
920
929
|
);
|
921
930
|
const getReferenceLineProps = (0, import_react6.useCallback)(
|
922
|
-
({
|
923
|
-
|
931
|
+
({ className, index, ...props }, ref = null) => {
|
932
|
+
var _a;
|
933
|
+
const { color, label, propClassName, ...rest } = (_a = propList[index]) != null ? _a : {};
|
924
934
|
return {
|
925
935
|
ref,
|
926
936
|
className: (0, import_utils9.cx)(className, propClassName),
|
927
|
-
stroke: color,
|
928
937
|
label,
|
938
|
+
stroke: color,
|
929
939
|
...props,
|
930
940
|
...rest
|
931
941
|
};
|
@@ -940,9 +950,9 @@ var import_core9 = require("@yamada-ui/core");
|
|
940
950
|
var import_utils10 = require("@yamada-ui/utils");
|
941
951
|
var import_react7 = require("react");
|
942
952
|
var useChartTooltip = ({
|
943
|
-
|
953
|
+
styles,
|
944
954
|
tooltipAnimationDuration = 0,
|
945
|
-
|
955
|
+
tooltipProps: _tooltipProps = {}
|
946
956
|
}) => {
|
947
957
|
const { theme } = (0, import_core9.useTheme)();
|
948
958
|
const { cursor, ...rest } = _tooltipProps;
|
@@ -958,16 +968,16 @@ var useChartTooltip = ({
|
|
958
968
|
(props, ref = null) => ({
|
959
969
|
ref,
|
960
970
|
animationDuration: tooltipAnimationDuration,
|
961
|
-
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
962
971
|
cursor: {
|
963
972
|
className: (0, import_utils10.cx)("ui-chart__cursor", cursorClassName)
|
964
973
|
},
|
974
|
+
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
965
975
|
...props,
|
966
976
|
...tooltipProps
|
967
977
|
}),
|
968
978
|
[cursorClassName, tooltipAnimationDuration, tooltipProps]
|
969
979
|
);
|
970
|
-
return { tooltipProps: tooltipUIProps
|
980
|
+
return { getTooltipProps, tooltipProps: tooltipUIProps };
|
971
981
|
};
|
972
982
|
|
973
983
|
// src/bar-chart.tsx
|
@@ -975,99 +985,99 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
975
985
|
var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
976
986
|
const [styles, mergedProps] = (0, import_core10.useComponentMultiStyle)("BarChart", props);
|
977
987
|
const {
|
988
|
+
type = "default",
|
978
989
|
className,
|
979
|
-
|
990
|
+
cell,
|
991
|
+
data,
|
980
992
|
dataKey,
|
993
|
+
fillOpacity,
|
994
|
+
gridAxis,
|
995
|
+
labelFormatter,
|
981
996
|
layoutType,
|
997
|
+
series,
|
998
|
+
strokeDasharray,
|
999
|
+
syncId,
|
982
1000
|
tickLine,
|
983
|
-
|
1001
|
+
tooltipAnimationDuration,
|
1002
|
+
unit,
|
1003
|
+
valueFormatter,
|
1004
|
+
withLegend = false,
|
1005
|
+
withTooltip = true,
|
984
1006
|
withXAxis,
|
985
1007
|
withYAxis,
|
986
|
-
barProps,
|
987
|
-
xAxisProps,
|
988
|
-
yAxisProps,
|
989
1008
|
xAxisLabel,
|
1009
|
+
xAxisTickFormatter,
|
990
1010
|
yAxisLabel,
|
991
|
-
xAxisLabelProps,
|
992
|
-
yAxisLabelProps,
|
993
|
-
type = "default",
|
994
|
-
withTooltip = true,
|
995
|
-
withLegend = false,
|
996
|
-
containerProps,
|
997
|
-
unit,
|
998
1011
|
yAxisTickFormatter,
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
tooltipAnimationDuration,
|
1012
|
+
barProps,
|
1013
|
+
chartProps,
|
1014
|
+
containerProps,
|
1015
|
+
gridProps,
|
1004
1016
|
legendProps,
|
1005
|
-
data,
|
1006
1017
|
referenceLineProps = [],
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
cell,
|
1018
|
+
tooltipProps,
|
1019
|
+
xAxisLabelProps,
|
1020
|
+
xAxisProps,
|
1021
|
+
yAxisLabelProps,
|
1022
|
+
yAxisProps,
|
1013
1023
|
...rest
|
1014
1024
|
} = (0, import_core10.omitThemeProps)(mergedProps);
|
1015
|
-
const { bars, barVars,
|
1016
|
-
data,
|
1017
|
-
series,
|
1018
|
-
cell,
|
1025
|
+
const { bars, barVars, setHighlightedArea, getBarChartProps } = useBarChart({
|
1019
1026
|
type,
|
1020
|
-
|
1021
|
-
|
1022
|
-
barProps,
|
1023
|
-
referenceLineProps,
|
1027
|
+
cell,
|
1028
|
+
data,
|
1024
1029
|
fillOpacity,
|
1030
|
+
layoutType,
|
1031
|
+
series,
|
1032
|
+
styles,
|
1025
1033
|
syncId,
|
1026
1034
|
xAxisLabel,
|
1027
1035
|
yAxisLabel,
|
1028
|
-
|
1036
|
+
barProps,
|
1037
|
+
chartProps,
|
1038
|
+
referenceLineProps
|
1029
1039
|
});
|
1030
1040
|
const { getContainerProps } = useChart({ containerProps });
|
1031
1041
|
const {
|
1032
|
-
getXAxisProps,
|
1033
|
-
getYAxisProps,
|
1034
1042
|
getXAxisLabelProps,
|
1035
|
-
|
1043
|
+
getXAxisProps,
|
1044
|
+
getYAxisLabelProps,
|
1045
|
+
getYAxisProps
|
1036
1046
|
} = useChartAxis({
|
1037
|
-
dataKey,
|
1038
1047
|
type,
|
1048
|
+
dataKey,
|
1049
|
+
gridAxis,
|
1039
1050
|
layoutType,
|
1051
|
+
styles,
|
1040
1052
|
tickLine,
|
1041
|
-
|
1053
|
+
unit,
|
1042
1054
|
withXAxis,
|
1043
1055
|
withYAxis,
|
1044
|
-
xAxisProps,
|
1045
|
-
yAxisProps,
|
1046
1056
|
xAxisLabel,
|
1057
|
+
xAxisTickFormatter,
|
1047
1058
|
yAxisLabel,
|
1059
|
+
yAxisTickFormatter,
|
1048
1060
|
xAxisLabelProps,
|
1061
|
+
xAxisProps,
|
1049
1062
|
yAxisLabelProps,
|
1050
|
-
|
1051
|
-
yAxisTickFormatter,
|
1052
|
-
xAxisTickFormatter,
|
1053
|
-
styles
|
1063
|
+
yAxisProps
|
1054
1064
|
});
|
1055
1065
|
const { getReferenceLineProps } = useChartReferenceLine({
|
1056
|
-
|
1057
|
-
|
1066
|
+
styles,
|
1067
|
+
referenceLineProps
|
1058
1068
|
});
|
1059
1069
|
const { getGridProps } = useChartGrid({
|
1060
|
-
gridProps,
|
1061
1070
|
gridAxis,
|
1062
1071
|
strokeDasharray,
|
1063
|
-
styles
|
1072
|
+
styles,
|
1073
|
+
gridProps
|
1064
1074
|
});
|
1065
|
-
const { tooltipProps: computedTooltipProps
|
1066
|
-
|
1075
|
+
const { getTooltipProps, tooltipProps: computedTooltipProps } = useChartTooltip({
|
1076
|
+
styles,
|
1067
1077
|
tooltipAnimationDuration,
|
1068
|
-
|
1078
|
+
tooltipProps
|
1069
1079
|
});
|
1070
|
-
const { legendProps: computedLegendProps
|
1080
|
+
const { getLegendProps, legendProps: computedLegendProps } = useChartLegend({
|
1071
1081
|
legendProps
|
1072
1082
|
});
|
1073
1083
|
const referenceLinesItems = (0, import_react8.useMemo)(
|
@@ -1075,8 +1085,8 @@ var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1075
1085
|
import_recharts2.ReferenceLine,
|
1076
1086
|
{
|
1077
1087
|
...getReferenceLineProps({
|
1078
|
-
|
1079
|
-
|
1088
|
+
className: "ui-bar-chart__reference-line",
|
1089
|
+
index
|
1080
1090
|
})
|
1081
1091
|
},
|
1082
1092
|
`referenceLine-${index}`
|
@@ -1144,10 +1154,10 @@ var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1144
1154
|
{
|
1145
1155
|
className: "ui-bar-chart__tooltip",
|
1146
1156
|
label,
|
1147
|
-
payload,
|
1148
|
-
valueFormatter,
|
1149
1157
|
labelFormatter,
|
1158
|
+
payload,
|
1150
1159
|
unit,
|
1160
|
+
valueFormatter,
|
1151
1161
|
...computedTooltipProps
|
1152
1162
|
}
|
1153
1163
|
),
|