@yamada-ui/charts 1.5.4-next-20241005220055 → 1.5.4
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/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,
|
@@ -359,6 +359,8 @@ var ChartLegend = (0, import_core3.forwardRef)(
|
|
359
359
|
);
|
360
360
|
}
|
361
361
|
);
|
362
|
+
ChartLegend.displayName = "ChartLegend";
|
363
|
+
ChartLegend.__ui__ = "ChartLegend";
|
362
364
|
|
363
365
|
// src/chart-tooltip.tsx
|
364
366
|
var import_core4 = require("@yamada-ui/core");
|
@@ -366,22 +368,22 @@ var import_utils4 = require("@yamada-ui/utils");
|
|
366
368
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
367
369
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
368
370
|
({
|
369
|
-
label,
|
370
|
-
dataKey = "value",
|
371
371
|
className,
|
372
|
-
|
373
|
-
|
372
|
+
dataKey = "value",
|
373
|
+
isRadialChart,
|
374
|
+
label,
|
374
375
|
labelFormatter,
|
376
|
+
payload = [],
|
375
377
|
unit,
|
376
|
-
|
378
|
+
valueFormatter,
|
377
379
|
...rest
|
378
380
|
}, ref) => {
|
379
381
|
var _a;
|
380
382
|
const { styles } = useTooltip();
|
381
383
|
const items = payload.map(
|
382
384
|
({
|
383
|
-
color: colorProp,
|
384
385
|
name: nameProp,
|
386
|
+
color: colorProp,
|
385
387
|
[dataKey]: valueProp,
|
386
388
|
payload: payload2
|
387
389
|
} = {}, index) => {
|
@@ -451,6 +453,8 @@ var ChartTooltip = (0, import_core4.forwardRef)(
|
|
451
453
|
);
|
452
454
|
}
|
453
455
|
);
|
456
|
+
ChartTooltip.displayName = "ChartTooltip";
|
457
|
+
ChartTooltip.__ui__ = "ChartTooltip";
|
454
458
|
|
455
459
|
// src/use-bar-chart.tsx
|
456
460
|
var import_core5 = require("@yamada-ui/core");
|
@@ -459,17 +463,17 @@ var import_react2 = require("react");
|
|
459
463
|
var import_recharts = require("recharts");
|
460
464
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
461
465
|
var useBarChart = ({
|
462
|
-
data,
|
463
|
-
series,
|
464
466
|
type = "default",
|
465
|
-
|
466
|
-
|
467
|
+
cell = defaultBarCell,
|
468
|
+
data,
|
467
469
|
fillOpacity = 1,
|
470
|
+
layoutType = "horizontal",
|
471
|
+
series,
|
472
|
+
styles,
|
468
473
|
syncId,
|
469
474
|
xAxisLabel,
|
470
475
|
yAxisLabel,
|
471
|
-
|
472
|
-
cell = defaultBarCell,
|
476
|
+
referenceLineProps = [],
|
473
477
|
...rest
|
474
478
|
}) => {
|
475
479
|
var _a;
|
@@ -548,9 +552,9 @@ var useBarChart = ({
|
|
548
552
|
const barPropsList = (0, import_react2.useMemo)(
|
549
553
|
() => series.map((props, index) => {
|
550
554
|
const {
|
551
|
-
dataKey,
|
552
555
|
activeBar: activeBar2 = {},
|
553
556
|
background: background2 = {},
|
557
|
+
dataKey,
|
554
558
|
dimBar: dimBar2 = {},
|
555
559
|
...computedProps
|
556
560
|
} = props;
|
@@ -604,20 +608,29 @@ var useBarChart = ({
|
|
604
608
|
]
|
605
609
|
);
|
606
610
|
const getBarProps = (0, import_react2.useCallback)(
|
607
|
-
({
|
608
|
-
|
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 : {};
|
609
622
|
return {
|
623
|
+
id,
|
610
624
|
ref,
|
625
|
+
name: dataKey,
|
611
626
|
className: (0, import_utils5.cx)(classNameProp, className),
|
612
627
|
activeBar: activeBar2,
|
613
628
|
background: background2,
|
614
|
-
id,
|
615
|
-
name: dataKey,
|
616
629
|
dataKey,
|
617
630
|
fill: color,
|
618
|
-
stroke: color,
|
619
631
|
isAnimationActive: false,
|
620
632
|
stackId: stacked ? "stack" : void 0,
|
633
|
+
stroke: color,
|
621
634
|
...props,
|
622
635
|
...rest2
|
623
636
|
};
|
@@ -631,9 +644,9 @@ var useBarChart = ({
|
|
631
644
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
632
645
|
import_recharts.Bar,
|
633
646
|
{
|
634
|
-
...getBarProps({
|
647
|
+
...getBarProps({ className: "ui-bar-chart__bar", index }),
|
635
648
|
children: data.map(
|
636
|
-
(data2, index2) => (0, import_utils5.runIfFunc)(cell, {
|
649
|
+
(data2, index2) => (0, import_utils5.runIfFunc)(cell, { data: data2, hasStack, index: index2, series: series2 })
|
637
650
|
)
|
638
651
|
},
|
639
652
|
`bar-${dataKey}`
|
@@ -645,14 +658,14 @@ var useBarChart = ({
|
|
645
658
|
ref,
|
646
659
|
className: (0, import_utils5.cx)(className, barChartClassName),
|
647
660
|
data,
|
648
|
-
stackOffset: type === "percent" ? "expand" : void 0,
|
649
661
|
layout: layoutType,
|
650
|
-
syncId,
|
651
662
|
margin: {
|
652
663
|
bottom: xAxisLabel ? 30 : void 0,
|
653
664
|
left: yAxisLabel ? 10 : void 0,
|
654
665
|
right: yAxisLabel ? 5 : void 0
|
655
666
|
},
|
667
|
+
stackOffset: type === "percent" ? "expand" : void 0,
|
668
|
+
syncId,
|
656
669
|
...props,
|
657
670
|
...chartProps
|
658
671
|
}),
|
@@ -670,16 +683,16 @@ var useBarChart = ({
|
|
670
683
|
return {
|
671
684
|
bars,
|
672
685
|
barVars,
|
673
|
-
|
686
|
+
setHighlightedArea,
|
674
687
|
getBarChartProps,
|
675
|
-
|
688
|
+
getBarProps
|
676
689
|
};
|
677
690
|
};
|
678
691
|
var defaultBarCell = ({
|
679
|
-
hasStack,
|
680
|
-
series,
|
681
692
|
data,
|
682
|
-
|
693
|
+
hasStack,
|
694
|
+
index,
|
695
|
+
series
|
683
696
|
}) => {
|
684
697
|
const { dataKey } = series;
|
685
698
|
const key = `cell-${dataKey}-${index}`;
|
@@ -697,19 +710,19 @@ var import_core6 = require("@yamada-ui/core");
|
|
697
710
|
var import_utils6 = require("@yamada-ui/utils");
|
698
711
|
var import_react3 = require("react");
|
699
712
|
var useChartAxis = ({
|
700
|
-
dataKey,
|
701
713
|
type,
|
714
|
+
dataKey,
|
715
|
+
gridAxis = "x",
|
702
716
|
layoutType = "horizontal",
|
717
|
+
styles,
|
703
718
|
tickLine = "y",
|
704
|
-
|
719
|
+
unit,
|
705
720
|
withXAxis = true,
|
706
721
|
withYAxis = true,
|
707
722
|
xAxisLabel: xAxisLabelProp,
|
723
|
+
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
708
724
|
yAxisLabel: yAxisLabelProp,
|
709
|
-
unit,
|
710
725
|
yAxisTickFormatter = type === "percent" && layoutType === "horizontal" ? valueToPercent : void 0,
|
711
|
-
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
712
|
-
styles,
|
713
726
|
...rest
|
714
727
|
}) => {
|
715
728
|
var _a, _b, _c, _d;
|
@@ -719,7 +732,7 @@ var useChartAxis = ({
|
|
719
732
|
[dataKey, layoutType]
|
720
733
|
);
|
721
734
|
const yAxisKey = (0, import_react3.useMemo)(
|
722
|
-
() => layoutType === "vertical" ? {
|
735
|
+
() => layoutType === "vertical" ? { type: "category", dataKey } : { type: "number" },
|
723
736
|
[dataKey, layoutType]
|
724
737
|
);
|
725
738
|
const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
|
@@ -750,15 +763,15 @@ var useChartAxis = ({
|
|
750
763
|
className: (0, import_utils6.cx)(className, xAxisClassName),
|
751
764
|
hide: !withXAxis,
|
752
765
|
...xAxisKey,
|
753
|
-
tick: {
|
754
|
-
transform: "translate(0, 10)",
|
755
|
-
fill: "currentColor"
|
756
|
-
},
|
757
|
-
stroke: "",
|
758
766
|
interval: "preserveStartEnd",
|
759
|
-
tickLine: xTickLine,
|
760
767
|
minTickGap: 5,
|
768
|
+
stroke: "",
|
769
|
+
tick: {
|
770
|
+
fill: "currentColor",
|
771
|
+
transform: "translate(0, 10)"
|
772
|
+
},
|
761
773
|
tickFormatter: xAxisTickFormatter,
|
774
|
+
tickLine: xTickLine,
|
762
775
|
...props,
|
763
776
|
...xAxisProps
|
764
777
|
}),
|
@@ -774,17 +787,17 @@ var useChartAxis = ({
|
|
774
787
|
const getYAxisProps = (0, import_react3.useCallback)(
|
775
788
|
({ className, ...props } = {}) => ({
|
776
789
|
className: (0, import_utils6.cx)(className, yAxisClassName),
|
777
|
-
hide: !withYAxis,
|
778
790
|
axisLine: false,
|
791
|
+
hide: !withYAxis,
|
779
792
|
...yAxisKey,
|
780
|
-
|
793
|
+
allowDecimals: true,
|
781
794
|
tick: {
|
782
|
-
|
783
|
-
|
795
|
+
fill: "currentColor",
|
796
|
+
transform: "translate(-10, 0)"
|
784
797
|
},
|
785
|
-
allowDecimals: true,
|
786
|
-
unit,
|
787
798
|
tickFormatter: yAxisTickFormatter,
|
799
|
+
tickLine: yTickLine,
|
800
|
+
unit,
|
788
801
|
...props,
|
789
802
|
...yAxisProps
|
790
803
|
}),
|
@@ -801,9 +814,9 @@ var useChartAxis = ({
|
|
801
814
|
const getXAxisLabelProps = (0, import_react3.useCallback)(
|
802
815
|
({ className, ...props } = {}) => ({
|
803
816
|
className: (0, import_utils6.cx)(className, xAxisLabelClassName),
|
804
|
-
value: xAxisLabel,
|
805
|
-
position: "insideBottom",
|
806
817
|
offset: -20,
|
818
|
+
position: "insideBottom",
|
819
|
+
value: xAxisLabel,
|
807
820
|
...props,
|
808
821
|
...xAxisLabelProps
|
809
822
|
}),
|
@@ -812,21 +825,21 @@ var useChartAxis = ({
|
|
812
825
|
const getYAxisLabelProps = (0, import_react3.useCallback)(
|
813
826
|
({ className, ...props } = {}) => ({
|
814
827
|
className: (0, import_utils6.cx)(className, yAxisLabelClassName),
|
815
|
-
value: yAxisLabel,
|
816
|
-
position: "insideLeft",
|
817
828
|
angle: -90,
|
818
|
-
textAnchor: "middle",
|
819
829
|
offset: -5,
|
830
|
+
position: "insideLeft",
|
831
|
+
textAnchor: "middle",
|
832
|
+
value: yAxisLabel,
|
820
833
|
...props,
|
821
834
|
...yAxisLabelProps
|
822
835
|
}),
|
823
836
|
[yAxisLabel, yAxisLabelClassName, yAxisLabelProps]
|
824
837
|
);
|
825
838
|
return {
|
826
|
-
getXAxisProps,
|
827
|
-
getYAxisProps,
|
828
839
|
getXAxisLabelProps,
|
829
|
-
|
840
|
+
getXAxisProps,
|
841
|
+
getYAxisLabelProps,
|
842
|
+
getYAxisProps
|
830
843
|
};
|
831
844
|
};
|
832
845
|
var valueToPercent = (value) => {
|
@@ -838,10 +851,10 @@ var import_core7 = require("@yamada-ui/core");
|
|
838
851
|
var import_utils7 = require("@yamada-ui/utils");
|
839
852
|
var import_react4 = require("react");
|
840
853
|
var useChartGrid = ({
|
841
|
-
gridProps = {},
|
842
854
|
gridAxis = "x",
|
843
855
|
strokeDasharray = "5 5",
|
844
|
-
styles
|
856
|
+
styles,
|
857
|
+
gridProps = {}
|
845
858
|
}) => {
|
846
859
|
const { theme } = (0, import_core7.useTheme)();
|
847
860
|
const [reChartsProps, propClassName] = getComponentProps(
|
@@ -852,9 +865,9 @@ var useChartGrid = ({
|
|
852
865
|
({ className, ...props } = {}, ref = null) => ({
|
853
866
|
ref,
|
854
867
|
className: (0, import_utils7.cx)("ui-chart__grid", className, propClassName),
|
868
|
+
horizontal: gridAxis === "x" || gridAxis === "xy",
|
855
869
|
strokeDasharray,
|
856
870
|
vertical: gridAxis === "y" || gridAxis === "xy",
|
857
|
-
horizontal: gridAxis === "x" || gridAxis === "xy",
|
858
871
|
...props,
|
859
872
|
...reChartsProps
|
860
873
|
}),
|
@@ -884,7 +897,7 @@ var useChartLegend = ({
|
|
884
897
|
},
|
885
898
|
[rest]
|
886
899
|
);
|
887
|
-
return {
|
900
|
+
return { getLegendProps, legendProps };
|
888
901
|
};
|
889
902
|
|
890
903
|
// src/use-chart-reference-line.ts
|
@@ -892,8 +905,8 @@ var import_core8 = require("@yamada-ui/core");
|
|
892
905
|
var import_utils9 = require("@yamada-ui/utils");
|
893
906
|
var import_react6 = require("react");
|
894
907
|
var useChartReferenceLine = ({
|
895
|
-
|
896
|
-
|
908
|
+
styles,
|
909
|
+
referenceLineProps = []
|
897
910
|
}) => {
|
898
911
|
const { theme } = (0, import_core8.useTheme)();
|
899
912
|
const styleClassName = (0, import_core8.getCSS)(styles.referenceLine)(theme);
|
@@ -905,23 +918,24 @@ var useChartReferenceLine = ({
|
|
905
918
|
)(theme);
|
906
919
|
const color = (0, import_core8.getVar)(`reference-line-${index}`)(theme);
|
907
920
|
const label = {
|
908
|
-
value: labelProp,
|
909
921
|
fill: color,
|
910
922
|
position: "insideBottomLeft",
|
923
|
+
value: labelProp,
|
911
924
|
...(0, import_utils9.isObject)(labelProp) ? labelProp : {}
|
912
925
|
};
|
913
|
-
return {
|
926
|
+
return { color, label, propClassName, ...rest };
|
914
927
|
}),
|
915
928
|
[referenceLineProps, styleClassName, theme]
|
916
929
|
);
|
917
930
|
const getReferenceLineProps = (0, import_react6.useCallback)(
|
918
|
-
({
|
919
|
-
|
931
|
+
({ className, index, ...props }, ref = null) => {
|
932
|
+
var _a;
|
933
|
+
const { color, label, propClassName, ...rest } = (_a = propList[index]) != null ? _a : {};
|
920
934
|
return {
|
921
935
|
ref,
|
922
936
|
className: (0, import_utils9.cx)(className, propClassName),
|
923
|
-
stroke: color,
|
924
937
|
label,
|
938
|
+
stroke: color,
|
925
939
|
...props,
|
926
940
|
...rest
|
927
941
|
};
|
@@ -936,9 +950,9 @@ var import_core9 = require("@yamada-ui/core");
|
|
936
950
|
var import_utils10 = require("@yamada-ui/utils");
|
937
951
|
var import_react7 = require("react");
|
938
952
|
var useChartTooltip = ({
|
939
|
-
|
953
|
+
styles,
|
940
954
|
tooltipAnimationDuration = 0,
|
941
|
-
|
955
|
+
tooltipProps: _tooltipProps = {}
|
942
956
|
}) => {
|
943
957
|
const { theme } = (0, import_core9.useTheme)();
|
944
958
|
const { cursor, ...rest } = _tooltipProps;
|
@@ -954,16 +968,16 @@ var useChartTooltip = ({
|
|
954
968
|
(props, ref = null) => ({
|
955
969
|
ref,
|
956
970
|
animationDuration: tooltipAnimationDuration,
|
957
|
-
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
958
971
|
cursor: {
|
959
972
|
className: (0, import_utils10.cx)("ui-chart__cursor", cursorClassName)
|
960
973
|
},
|
974
|
+
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
961
975
|
...props,
|
962
976
|
...tooltipProps
|
963
977
|
}),
|
964
978
|
[cursorClassName, tooltipAnimationDuration, tooltipProps]
|
965
979
|
);
|
966
|
-
return { tooltipProps: tooltipUIProps
|
980
|
+
return { getTooltipProps, tooltipProps: tooltipUIProps };
|
967
981
|
};
|
968
982
|
|
969
983
|
// src/bar-chart.tsx
|
@@ -971,99 +985,99 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
971
985
|
var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
972
986
|
const [styles, mergedProps] = (0, import_core10.useComponentMultiStyle)("BarChart", props);
|
973
987
|
const {
|
988
|
+
type = "default",
|
974
989
|
className,
|
975
|
-
|
990
|
+
cell,
|
991
|
+
data,
|
976
992
|
dataKey,
|
993
|
+
fillOpacity,
|
994
|
+
gridAxis,
|
995
|
+
labelFormatter,
|
977
996
|
layoutType,
|
997
|
+
series,
|
998
|
+
strokeDasharray,
|
999
|
+
syncId,
|
978
1000
|
tickLine,
|
979
|
-
|
1001
|
+
tooltipAnimationDuration,
|
1002
|
+
unit,
|
1003
|
+
valueFormatter,
|
1004
|
+
withLegend = false,
|
1005
|
+
withTooltip = true,
|
980
1006
|
withXAxis,
|
981
1007
|
withYAxis,
|
982
|
-
barProps,
|
983
|
-
xAxisProps,
|
984
|
-
yAxisProps,
|
985
1008
|
xAxisLabel,
|
1009
|
+
xAxisTickFormatter,
|
986
1010
|
yAxisLabel,
|
987
|
-
xAxisLabelProps,
|
988
|
-
yAxisLabelProps,
|
989
|
-
type = "default",
|
990
|
-
withTooltip = true,
|
991
|
-
withLegend = false,
|
992
|
-
containerProps,
|
993
|
-
unit,
|
994
1011
|
yAxisTickFormatter,
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
tooltipAnimationDuration,
|
1012
|
+
barProps,
|
1013
|
+
chartProps,
|
1014
|
+
containerProps,
|
1015
|
+
gridProps,
|
1000
1016
|
legendProps,
|
1001
|
-
data,
|
1002
1017
|
referenceLineProps = [],
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
cell,
|
1018
|
+
tooltipProps,
|
1019
|
+
xAxisLabelProps,
|
1020
|
+
xAxisProps,
|
1021
|
+
yAxisLabelProps,
|
1022
|
+
yAxisProps,
|
1009
1023
|
...rest
|
1010
1024
|
} = (0, import_core10.omitThemeProps)(mergedProps);
|
1011
|
-
const { bars, barVars,
|
1012
|
-
data,
|
1013
|
-
series,
|
1014
|
-
cell,
|
1025
|
+
const { bars, barVars, setHighlightedArea, getBarChartProps } = useBarChart({
|
1015
1026
|
type,
|
1016
|
-
|
1017
|
-
|
1018
|
-
barProps,
|
1019
|
-
referenceLineProps,
|
1027
|
+
cell,
|
1028
|
+
data,
|
1020
1029
|
fillOpacity,
|
1030
|
+
layoutType,
|
1031
|
+
series,
|
1032
|
+
styles,
|
1021
1033
|
syncId,
|
1022
1034
|
xAxisLabel,
|
1023
1035
|
yAxisLabel,
|
1024
|
-
|
1036
|
+
barProps,
|
1037
|
+
chartProps,
|
1038
|
+
referenceLineProps
|
1025
1039
|
});
|
1026
1040
|
const { getContainerProps } = useChart({ containerProps });
|
1027
1041
|
const {
|
1028
|
-
getXAxisProps,
|
1029
|
-
getYAxisProps,
|
1030
1042
|
getXAxisLabelProps,
|
1031
|
-
|
1043
|
+
getXAxisProps,
|
1044
|
+
getYAxisLabelProps,
|
1045
|
+
getYAxisProps
|
1032
1046
|
} = useChartAxis({
|
1033
|
-
dataKey,
|
1034
1047
|
type,
|
1048
|
+
dataKey,
|
1049
|
+
gridAxis,
|
1035
1050
|
layoutType,
|
1051
|
+
styles,
|
1036
1052
|
tickLine,
|
1037
|
-
|
1053
|
+
unit,
|
1038
1054
|
withXAxis,
|
1039
1055
|
withYAxis,
|
1040
|
-
xAxisProps,
|
1041
|
-
yAxisProps,
|
1042
1056
|
xAxisLabel,
|
1057
|
+
xAxisTickFormatter,
|
1043
1058
|
yAxisLabel,
|
1059
|
+
yAxisTickFormatter,
|
1044
1060
|
xAxisLabelProps,
|
1061
|
+
xAxisProps,
|
1045
1062
|
yAxisLabelProps,
|
1046
|
-
|
1047
|
-
yAxisTickFormatter,
|
1048
|
-
xAxisTickFormatter,
|
1049
|
-
styles
|
1063
|
+
yAxisProps
|
1050
1064
|
});
|
1051
1065
|
const { getReferenceLineProps } = useChartReferenceLine({
|
1052
|
-
|
1053
|
-
|
1066
|
+
styles,
|
1067
|
+
referenceLineProps
|
1054
1068
|
});
|
1055
1069
|
const { getGridProps } = useChartGrid({
|
1056
|
-
gridProps,
|
1057
1070
|
gridAxis,
|
1058
1071
|
strokeDasharray,
|
1059
|
-
styles
|
1072
|
+
styles,
|
1073
|
+
gridProps
|
1060
1074
|
});
|
1061
|
-
const { tooltipProps: computedTooltipProps
|
1062
|
-
|
1075
|
+
const { getTooltipProps, tooltipProps: computedTooltipProps } = useChartTooltip({
|
1076
|
+
styles,
|
1063
1077
|
tooltipAnimationDuration,
|
1064
|
-
|
1078
|
+
tooltipProps
|
1065
1079
|
});
|
1066
|
-
const { legendProps: computedLegendProps
|
1080
|
+
const { getLegendProps, legendProps: computedLegendProps } = useChartLegend({
|
1067
1081
|
legendProps
|
1068
1082
|
});
|
1069
1083
|
const referenceLinesItems = (0, import_react8.useMemo)(
|
@@ -1071,8 +1085,8 @@ var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1071
1085
|
import_recharts2.ReferenceLine,
|
1072
1086
|
{
|
1073
1087
|
...getReferenceLineProps({
|
1074
|
-
|
1075
|
-
|
1088
|
+
className: "ui-bar-chart__reference-line",
|
1089
|
+
index
|
1076
1090
|
})
|
1077
1091
|
},
|
1078
1092
|
`referenceLine-${index}`
|
@@ -1140,10 +1154,10 @@ var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1140
1154
|
{
|
1141
1155
|
className: "ui-bar-chart__tooltip",
|
1142
1156
|
label,
|
1143
|
-
payload,
|
1144
|
-
valueFormatter,
|
1145
1157
|
labelFormatter,
|
1158
|
+
payload,
|
1146
1159
|
unit,
|
1160
|
+
valueFormatter,
|
1147
1161
|
...computedTooltipProps
|
1148
1162
|
}
|
1149
1163
|
),
|
@@ -1160,6 +1174,8 @@ var BarChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1160
1174
|
}
|
1161
1175
|
) });
|
1162
1176
|
});
|
1177
|
+
BarChart.displayName = "BarChart";
|
1178
|
+
BarChart.__ui__ = "BarChart";
|
1163
1179
|
// Annotate the CommonJS export names for ESM import in node:
|
1164
1180
|
0 && (module.exports = {
|
1165
1181
|
BarChart
|