@yamada-ui/charts 1.5.4-dev-20241005224505 → 1.5.4-dev-20241006032009
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/line-chart.js
CHANGED
@@ -312,13 +312,13 @@ var useChart = ({ containerProps = {} }) => {
|
|
312
312
|
getContainerProps
|
313
313
|
};
|
314
314
|
};
|
315
|
-
var useLegend = (
|
315
|
+
var useLegend = () => {
|
316
316
|
const { styles } = useChartContext();
|
317
317
|
return {
|
318
318
|
styles
|
319
319
|
};
|
320
320
|
};
|
321
|
-
var useTooltip = (
|
321
|
+
var useTooltip = () => {
|
322
322
|
const { styles } = useChartContext();
|
323
323
|
return {
|
324
324
|
styles
|
@@ -330,7 +330,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
330
330
|
var ChartLegend = (0, import_core3.forwardRef)(
|
331
331
|
({ className, payload = [], onHighlight, ...rest }, ref) => {
|
332
332
|
const { styles } = useLegend();
|
333
|
-
const items = payload.map(({ dataKey, value: valueProp
|
333
|
+
const items = payload.map(({ color, dataKey, value: valueProp }, index) => {
|
334
334
|
const value = dataKey != null ? dataKey : valueProp;
|
335
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
336
336
|
import_core3.ui.div,
|
@@ -375,22 +375,22 @@ var import_utils4 = require("@yamada-ui/utils");
|
|
375
375
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
376
376
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
377
377
|
({
|
378
|
-
label,
|
379
|
-
dataKey = "value",
|
380
378
|
className,
|
381
|
-
|
382
|
-
|
379
|
+
dataKey = "value",
|
380
|
+
isRadialChart,
|
381
|
+
label,
|
383
382
|
labelFormatter,
|
383
|
+
payload = [],
|
384
384
|
unit,
|
385
|
-
|
385
|
+
valueFormatter,
|
386
386
|
...rest
|
387
387
|
}, ref) => {
|
388
388
|
var _a;
|
389
389
|
const { styles } = useTooltip();
|
390
390
|
const items = payload.map(
|
391
391
|
({
|
392
|
-
color: colorProp,
|
393
392
|
name: nameProp,
|
393
|
+
color: colorProp,
|
394
394
|
[dataKey]: valueProp,
|
395
395
|
payload: payload2
|
396
396
|
} = {}, index) => {
|
@@ -468,19 +468,19 @@ var import_core5 = require("@yamada-ui/core");
|
|
468
468
|
var import_utils5 = require("@yamada-ui/utils");
|
469
469
|
var import_react2 = require("react");
|
470
470
|
var useChartAxis = ({
|
471
|
-
dataKey,
|
472
471
|
type,
|
472
|
+
dataKey,
|
473
|
+
gridAxis = "x",
|
473
474
|
layoutType = "horizontal",
|
475
|
+
styles,
|
474
476
|
tickLine = "y",
|
475
|
-
|
477
|
+
unit,
|
476
478
|
withXAxis = true,
|
477
479
|
withYAxis = true,
|
478
480
|
xAxisLabel: xAxisLabelProp,
|
481
|
+
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
479
482
|
yAxisLabel: yAxisLabelProp,
|
480
|
-
unit,
|
481
483
|
yAxisTickFormatter = type === "percent" && layoutType === "horizontal" ? valueToPercent : void 0,
|
482
|
-
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
483
|
-
styles,
|
484
484
|
...rest
|
485
485
|
}) => {
|
486
486
|
var _a, _b, _c, _d;
|
@@ -490,7 +490,7 @@ var useChartAxis = ({
|
|
490
490
|
[dataKey, layoutType]
|
491
491
|
);
|
492
492
|
const yAxisKey = (0, import_react2.useMemo)(
|
493
|
-
() => layoutType === "vertical" ? {
|
493
|
+
() => layoutType === "vertical" ? { type: "category", dataKey } : { type: "number" },
|
494
494
|
[dataKey, layoutType]
|
495
495
|
);
|
496
496
|
const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
|
@@ -521,15 +521,15 @@ var useChartAxis = ({
|
|
521
521
|
className: (0, import_utils5.cx)(className, xAxisClassName),
|
522
522
|
hide: !withXAxis,
|
523
523
|
...xAxisKey,
|
524
|
-
tick: {
|
525
|
-
transform: "translate(0, 10)",
|
526
|
-
fill: "currentColor"
|
527
|
-
},
|
528
|
-
stroke: "",
|
529
524
|
interval: "preserveStartEnd",
|
530
|
-
tickLine: xTickLine,
|
531
525
|
minTickGap: 5,
|
526
|
+
stroke: "",
|
527
|
+
tick: {
|
528
|
+
fill: "currentColor",
|
529
|
+
transform: "translate(0, 10)"
|
530
|
+
},
|
532
531
|
tickFormatter: xAxisTickFormatter,
|
532
|
+
tickLine: xTickLine,
|
533
533
|
...props,
|
534
534
|
...xAxisProps
|
535
535
|
}),
|
@@ -545,17 +545,17 @@ var useChartAxis = ({
|
|
545
545
|
const getYAxisProps = (0, import_react2.useCallback)(
|
546
546
|
({ className, ...props } = {}) => ({
|
547
547
|
className: (0, import_utils5.cx)(className, yAxisClassName),
|
548
|
-
hide: !withYAxis,
|
549
548
|
axisLine: false,
|
549
|
+
hide: !withYAxis,
|
550
550
|
...yAxisKey,
|
551
|
-
|
551
|
+
allowDecimals: true,
|
552
552
|
tick: {
|
553
|
-
|
554
|
-
|
553
|
+
fill: "currentColor",
|
554
|
+
transform: "translate(-10, 0)"
|
555
555
|
},
|
556
|
-
allowDecimals: true,
|
557
|
-
unit,
|
558
556
|
tickFormatter: yAxisTickFormatter,
|
557
|
+
tickLine: yTickLine,
|
558
|
+
unit,
|
559
559
|
...props,
|
560
560
|
...yAxisProps
|
561
561
|
}),
|
@@ -572,9 +572,9 @@ var useChartAxis = ({
|
|
572
572
|
const getXAxisLabelProps = (0, import_react2.useCallback)(
|
573
573
|
({ className, ...props } = {}) => ({
|
574
574
|
className: (0, import_utils5.cx)(className, xAxisLabelClassName),
|
575
|
-
value: xAxisLabel,
|
576
|
-
position: "insideBottom",
|
577
575
|
offset: -20,
|
576
|
+
position: "insideBottom",
|
577
|
+
value: xAxisLabel,
|
578
578
|
...props,
|
579
579
|
...xAxisLabelProps
|
580
580
|
}),
|
@@ -583,21 +583,21 @@ var useChartAxis = ({
|
|
583
583
|
const getYAxisLabelProps = (0, import_react2.useCallback)(
|
584
584
|
({ className, ...props } = {}) => ({
|
585
585
|
className: (0, import_utils5.cx)(className, yAxisLabelClassName),
|
586
|
-
value: yAxisLabel,
|
587
|
-
position: "insideLeft",
|
588
586
|
angle: -90,
|
589
|
-
textAnchor: "middle",
|
590
587
|
offset: -5,
|
588
|
+
position: "insideLeft",
|
589
|
+
textAnchor: "middle",
|
590
|
+
value: yAxisLabel,
|
591
591
|
...props,
|
592
592
|
...yAxisLabelProps
|
593
593
|
}),
|
594
594
|
[yAxisLabel, yAxisLabelClassName, yAxisLabelProps]
|
595
595
|
);
|
596
596
|
return {
|
597
|
-
getXAxisProps,
|
598
|
-
getYAxisProps,
|
599
597
|
getXAxisLabelProps,
|
600
|
-
|
598
|
+
getXAxisProps,
|
599
|
+
getYAxisLabelProps,
|
600
|
+
getYAxisProps
|
601
601
|
};
|
602
602
|
};
|
603
603
|
var valueToPercent = (value) => {
|
@@ -609,10 +609,10 @@ var import_core6 = require("@yamada-ui/core");
|
|
609
609
|
var import_utils6 = require("@yamada-ui/utils");
|
610
610
|
var import_react3 = require("react");
|
611
611
|
var useChartGrid = ({
|
612
|
-
gridProps = {},
|
613
612
|
gridAxis = "x",
|
614
613
|
strokeDasharray = "5 5",
|
615
|
-
styles
|
614
|
+
styles,
|
615
|
+
gridProps = {}
|
616
616
|
}) => {
|
617
617
|
const { theme } = (0, import_core6.useTheme)();
|
618
618
|
const [reChartsProps, propClassName] = getComponentProps(
|
@@ -623,9 +623,9 @@ var useChartGrid = ({
|
|
623
623
|
({ className, ...props } = {}, ref = null) => ({
|
624
624
|
ref,
|
625
625
|
className: (0, import_utils6.cx)("ui-chart__grid", className, propClassName),
|
626
|
+
horizontal: gridAxis === "x" || gridAxis === "xy",
|
626
627
|
strokeDasharray,
|
627
628
|
vertical: gridAxis === "y" || gridAxis === "xy",
|
628
|
-
horizontal: gridAxis === "x" || gridAxis === "xy",
|
629
629
|
...props,
|
630
630
|
...reChartsProps
|
631
631
|
}),
|
@@ -655,7 +655,7 @@ var useChartLegend = ({
|
|
655
655
|
},
|
656
656
|
[rest]
|
657
657
|
);
|
658
|
-
return {
|
658
|
+
return { getLegendProps, legendProps };
|
659
659
|
};
|
660
660
|
|
661
661
|
// src/use-chart-reference-line.ts
|
@@ -663,8 +663,8 @@ var import_core7 = require("@yamada-ui/core");
|
|
663
663
|
var import_utils8 = require("@yamada-ui/utils");
|
664
664
|
var import_react5 = require("react");
|
665
665
|
var useChartReferenceLine = ({
|
666
|
-
|
667
|
-
|
666
|
+
styles,
|
667
|
+
referenceLineProps = []
|
668
668
|
}) => {
|
669
669
|
const { theme } = (0, import_core7.useTheme)();
|
670
670
|
const styleClassName = (0, import_core7.getCSS)(styles.referenceLine)(theme);
|
@@ -676,23 +676,24 @@ var useChartReferenceLine = ({
|
|
676
676
|
)(theme);
|
677
677
|
const color = (0, import_core7.getVar)(`reference-line-${index}`)(theme);
|
678
678
|
const label = {
|
679
|
-
value: labelProp,
|
680
679
|
fill: color,
|
681
680
|
position: "insideBottomLeft",
|
681
|
+
value: labelProp,
|
682
682
|
...(0, import_utils8.isObject)(labelProp) ? labelProp : {}
|
683
683
|
};
|
684
|
-
return {
|
684
|
+
return { color, label, propClassName, ...rest };
|
685
685
|
}),
|
686
686
|
[referenceLineProps, styleClassName, theme]
|
687
687
|
);
|
688
688
|
const getReferenceLineProps = (0, import_react5.useCallback)(
|
689
|
-
({
|
690
|
-
|
689
|
+
({ className, index, ...props }, ref = null) => {
|
690
|
+
var _a;
|
691
|
+
const { color, label, propClassName, ...rest } = (_a = propList[index]) != null ? _a : {};
|
691
692
|
return {
|
692
693
|
ref,
|
693
694
|
className: (0, import_utils8.cx)(className, propClassName),
|
694
|
-
stroke: color,
|
695
695
|
label,
|
696
|
+
stroke: color,
|
696
697
|
...props,
|
697
698
|
...rest
|
698
699
|
};
|
@@ -707,9 +708,9 @@ var import_core8 = require("@yamada-ui/core");
|
|
707
708
|
var import_utils9 = require("@yamada-ui/utils");
|
708
709
|
var import_react6 = require("react");
|
709
710
|
var useChartTooltip = ({
|
710
|
-
|
711
|
+
styles,
|
711
712
|
tooltipAnimationDuration = 0,
|
712
|
-
|
713
|
+
tooltipProps: _tooltipProps = {}
|
713
714
|
}) => {
|
714
715
|
const { theme } = (0, import_core8.useTheme)();
|
715
716
|
const { cursor, ...rest } = _tooltipProps;
|
@@ -725,16 +726,16 @@ var useChartTooltip = ({
|
|
725
726
|
(props, ref = null) => ({
|
726
727
|
ref,
|
727
728
|
animationDuration: tooltipAnimationDuration,
|
728
|
-
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
729
729
|
cursor: {
|
730
730
|
className: (0, import_utils9.cx)("ui-chart__cursor", cursorClassName)
|
731
731
|
},
|
732
|
+
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
732
733
|
...props,
|
733
734
|
...tooltipProps
|
734
735
|
}),
|
735
736
|
[cursorClassName, tooltipAnimationDuration, tooltipProps]
|
736
737
|
);
|
737
|
-
return { tooltipProps: tooltipUIProps
|
738
|
+
return { getTooltipProps, tooltipProps: tooltipUIProps };
|
738
739
|
};
|
739
740
|
|
740
741
|
// src/use-line-chart.ts
|
@@ -742,20 +743,20 @@ var import_core9 = require("@yamada-ui/core");
|
|
742
743
|
var import_utils10 = require("@yamada-ui/utils");
|
743
744
|
var import_react7 = require("react");
|
744
745
|
var useLineChart = ({
|
746
|
+
connectNulls = true,
|
747
|
+
curveType = "monotone",
|
745
748
|
data,
|
746
|
-
|
749
|
+
fillOpacity = 1,
|
747
750
|
layoutType = "horizontal",
|
748
|
-
|
749
|
-
withActiveDots = true,
|
750
|
-
curveType = "monotone",
|
751
|
+
series,
|
751
752
|
strokeWidth = 2,
|
752
|
-
|
753
|
-
referenceLineProps,
|
754
|
-
fillOpacity = 1,
|
753
|
+
styles,
|
755
754
|
syncId,
|
755
|
+
withActiveDots = true,
|
756
|
+
withDots = true,
|
756
757
|
xAxisLabel,
|
757
758
|
yAxisLabel,
|
758
|
-
|
759
|
+
referenceLineProps,
|
759
760
|
...rest
|
760
761
|
}) => {
|
761
762
|
var _a;
|
@@ -763,10 +764,10 @@ var useLineChart = ({
|
|
763
764
|
const [highlightedArea, setHighlightedArea] = (0, import_react7.useState)(null);
|
764
765
|
const shouldHighlight = highlightedArea !== null;
|
765
766
|
const {
|
766
|
-
dot = {},
|
767
767
|
activeDot = {},
|
768
768
|
dimDot,
|
769
769
|
dimLine,
|
770
|
+
dot = {},
|
770
771
|
...computedLineProps
|
771
772
|
} = (_a = rest.lineProps) != null ? _a : {};
|
772
773
|
const lineColors = (0, import_react7.useMemo)(
|
@@ -847,11 +848,11 @@ var useLineChart = ({
|
|
847
848
|
const linePropList = (0, import_react7.useMemo)(
|
848
849
|
() => series.map((props, index) => {
|
849
850
|
const {
|
850
|
-
dataKey,
|
851
|
-
dot: dot2 = {},
|
852
851
|
activeDot: activeDot2 = {},
|
852
|
+
dataKey,
|
853
853
|
dimDot: dimDot2 = {},
|
854
854
|
dimLine: dimLine2 = {},
|
855
|
+
dot: dot2 = {},
|
855
856
|
...computedProps
|
856
857
|
} = props;
|
857
858
|
const color = (0, import_core9.getVar)(`line-${index}`)(theme);
|
@@ -877,8 +878,8 @@ var useLineChart = ({
|
|
877
878
|
resolvedActiveDot = {
|
878
879
|
className: (0, import_utils10.cx)("ui-line-chart__active-dot", className),
|
879
880
|
fill: color,
|
880
|
-
stroke: color,
|
881
881
|
r: 4,
|
882
|
+
stroke: color,
|
882
883
|
...rest3
|
883
884
|
};
|
884
885
|
} else {
|
@@ -907,9 +908,9 @@ var useLineChart = ({
|
|
907
908
|
}
|
908
909
|
return {
|
909
910
|
...rest2,
|
911
|
+
activeDot: resolvedActiveDot,
|
910
912
|
color,
|
911
913
|
dataKey,
|
912
|
-
activeDot: resolvedActiveDot,
|
913
914
|
dot: resolvedDot
|
914
915
|
};
|
915
916
|
}),
|
@@ -938,12 +939,12 @@ var useLineChart = ({
|
|
938
939
|
className: (0, import_utils10.cx)(className, lineChartClassName),
|
939
940
|
data,
|
940
941
|
layout: layoutType,
|
941
|
-
syncId,
|
942
942
|
margin: {
|
943
943
|
bottom: xAxisLabel ? 30 : void 0,
|
944
944
|
left: yAxisLabel ? 10 : void 0,
|
945
945
|
right: yAxisLabel ? 5 : void 0
|
946
946
|
},
|
947
|
+
syncId,
|
947
948
|
...props,
|
948
949
|
...chartProps
|
949
950
|
}),
|
@@ -958,20 +959,21 @@ var useLineChart = ({
|
|
958
959
|
]
|
959
960
|
);
|
960
961
|
const getLineProps = (0, import_react7.useCallback)(
|
961
|
-
({
|
962
|
-
|
962
|
+
({ className: classNameProp, index, ...props }) => {
|
963
|
+
var _a2;
|
964
|
+
const { className, activeDot: activeDot2, color, dataKey, dot: dot2, ...rest2 } = (_a2 = linePropList[index]) != null ? _a2 : {};
|
963
965
|
return {
|
966
|
+
type: curveType,
|
967
|
+
name: (0, import_utils10.runIfFunc)(dataKey, {}),
|
964
968
|
className: (0, import_utils10.cx)(classNameProp, className),
|
965
969
|
activeDot: activeDot2,
|
966
|
-
|
967
|
-
name: dataKey,
|
968
|
-
type: curveType,
|
970
|
+
connectNulls,
|
969
971
|
dataKey,
|
972
|
+
dot: dot2,
|
970
973
|
fill: color,
|
971
|
-
strokeWidth,
|
972
|
-
stroke: color,
|
973
974
|
isAnimationActive: false,
|
974
|
-
|
975
|
+
stroke: color,
|
976
|
+
strokeWidth,
|
975
977
|
...props,
|
976
978
|
...rest2
|
977
979
|
};
|
@@ -979,10 +981,10 @@ var useLineChart = ({
|
|
979
981
|
[connectNulls, curveType, linePropList, strokeWidth]
|
980
982
|
);
|
981
983
|
return {
|
982
|
-
getLineProps,
|
983
|
-
getLineChartProps,
|
984
984
|
lineVars,
|
985
|
-
setHighlightedArea
|
985
|
+
setHighlightedArea,
|
986
|
+
getLineChartProps,
|
987
|
+
getLineProps
|
986
988
|
};
|
987
989
|
};
|
988
990
|
|
@@ -991,113 +993,113 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
991
993
|
var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
992
994
|
const [styles, mergedProps] = (0, import_core10.useComponentMultiStyle)("LineChart", props);
|
993
995
|
const {
|
996
|
+
type,
|
994
997
|
className,
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
strokeDasharray,
|
998
|
+
connectNulls,
|
999
|
+
curveType,
|
1000
|
+
data,
|
999
1001
|
dataKey,
|
1000
|
-
|
1002
|
+
fillOpacity,
|
1003
|
+
gridAxis,
|
1004
|
+
labelFormatter,
|
1001
1005
|
layoutType,
|
1006
|
+
series,
|
1007
|
+
strokeDasharray,
|
1008
|
+
strokeWidth,
|
1009
|
+
syncId,
|
1002
1010
|
tickLine,
|
1011
|
+
tooltipAnimationDuration,
|
1012
|
+
unit,
|
1013
|
+
valueFormatter,
|
1014
|
+
withActiveDots,
|
1015
|
+
withDots,
|
1016
|
+
withLegend = false,
|
1017
|
+
withTooltip = true,
|
1003
1018
|
withXAxis,
|
1004
1019
|
withYAxis,
|
1005
|
-
xAxisProps,
|
1006
|
-
yAxisProps,
|
1007
1020
|
xAxisLabel,
|
1021
|
+
xAxisTickFormatter,
|
1008
1022
|
yAxisLabel,
|
1009
|
-
xAxisLabelProps,
|
1010
|
-
yAxisLabelProps,
|
1011
|
-
unit,
|
1012
1023
|
yAxisTickFormatter,
|
1013
|
-
xAxisTickFormatter,
|
1014
|
-
valueFormatter,
|
1015
|
-
labelFormatter,
|
1016
|
-
referenceLineProps,
|
1017
|
-
tooltipProps,
|
1018
|
-
tooltipAnimationDuration,
|
1019
|
-
legendProps,
|
1020
|
-
withLegend = false,
|
1021
|
-
withTooltip = true,
|
1022
|
-
series,
|
1023
|
-
data,
|
1024
1024
|
chartProps,
|
1025
|
+
containerProps,
|
1026
|
+
gridProps,
|
1027
|
+
legendProps,
|
1025
1028
|
lineProps,
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
syncId,
|
1029
|
+
referenceLineProps,
|
1030
|
+
tooltipProps,
|
1031
|
+
xAxisLabelProps,
|
1032
|
+
xAxisProps,
|
1033
|
+
yAxisLabelProps,
|
1034
|
+
yAxisProps,
|
1033
1035
|
...rest
|
1034
1036
|
} = (0, import_core10.omitThemeProps)(mergedProps);
|
1035
|
-
const {
|
1037
|
+
const { lineVars, setHighlightedArea, getLineChartProps, getLineProps } = useLineChart({
|
1038
|
+
connectNulls,
|
1039
|
+
curveType,
|
1040
|
+
data,
|
1041
|
+
fillOpacity,
|
1036
1042
|
layoutType,
|
1037
1043
|
series,
|
1038
|
-
referenceLineProps,
|
1039
|
-
data,
|
1040
|
-
chartProps,
|
1041
|
-
lineProps,
|
1042
|
-
withDots,
|
1043
|
-
withActiveDots,
|
1044
|
-
curveType,
|
1045
1044
|
strokeWidth,
|
1046
|
-
|
1047
|
-
fillOpacity,
|
1045
|
+
styles,
|
1048
1046
|
syncId,
|
1047
|
+
withActiveDots,
|
1048
|
+
withDots,
|
1049
1049
|
xAxisLabel,
|
1050
1050
|
yAxisLabel,
|
1051
|
-
|
1051
|
+
chartProps,
|
1052
|
+
lineProps,
|
1053
|
+
referenceLineProps
|
1052
1054
|
});
|
1053
1055
|
const { getContainerProps } = useChart({ containerProps });
|
1054
1056
|
const {
|
1055
|
-
getXAxisProps,
|
1056
|
-
getYAxisProps,
|
1057
1057
|
getXAxisLabelProps,
|
1058
|
-
|
1058
|
+
getXAxisProps,
|
1059
|
+
getYAxisLabelProps,
|
1060
|
+
getYAxisProps
|
1059
1061
|
} = useChartAxis({
|
1060
|
-
dataKey,
|
1061
1062
|
type,
|
1063
|
+
dataKey,
|
1064
|
+
gridAxis,
|
1062
1065
|
layoutType,
|
1066
|
+
styles,
|
1063
1067
|
tickLine,
|
1064
|
-
|
1068
|
+
unit,
|
1065
1069
|
withXAxis,
|
1066
1070
|
withYAxis,
|
1067
|
-
xAxisProps,
|
1068
|
-
yAxisProps,
|
1069
1071
|
xAxisLabel,
|
1072
|
+
xAxisTickFormatter,
|
1070
1073
|
yAxisLabel,
|
1074
|
+
yAxisTickFormatter,
|
1071
1075
|
xAxisLabelProps,
|
1076
|
+
xAxisProps,
|
1072
1077
|
yAxisLabelProps,
|
1073
|
-
|
1074
|
-
yAxisTickFormatter,
|
1075
|
-
xAxisTickFormatter,
|
1076
|
-
styles
|
1078
|
+
yAxisProps
|
1077
1079
|
});
|
1078
1080
|
const { getReferenceLineProps } = useChartReferenceLine({
|
1079
|
-
|
1080
|
-
|
1081
|
+
styles,
|
1082
|
+
referenceLineProps
|
1081
1083
|
});
|
1082
1084
|
const { getGridProps } = useChartGrid({
|
1083
|
-
gridProps,
|
1084
1085
|
gridAxis,
|
1085
1086
|
strokeDasharray,
|
1086
|
-
styles
|
1087
|
+
styles,
|
1088
|
+
gridProps
|
1087
1089
|
});
|
1088
|
-
const { tooltipProps: computedTooltipProps
|
1089
|
-
|
1090
|
+
const { getTooltipProps, tooltipProps: computedTooltipProps } = useChartTooltip({
|
1091
|
+
styles,
|
1090
1092
|
tooltipAnimationDuration,
|
1091
|
-
|
1093
|
+
tooltipProps
|
1092
1094
|
});
|
1093
|
-
const { legendProps: computedLegendProps
|
1095
|
+
const { getLegendProps, legendProps: computedLegendProps } = useChartLegend({
|
1094
1096
|
legendProps
|
1095
1097
|
});
|
1096
1098
|
const lines = (0, import_react8.useMemo)(
|
1097
1099
|
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
1098
1100
|
import_recharts.Line,
|
1099
1101
|
{
|
1100
|
-
...getLineProps({
|
1102
|
+
...getLineProps({ className: "ui-line-chart__line", index })
|
1101
1103
|
},
|
1102
1104
|
`line-${dataKey2}`
|
1103
1105
|
)),
|
@@ -1108,8 +1110,8 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1108
1110
|
import_recharts.ReferenceLine,
|
1109
1111
|
{
|
1110
1112
|
...getReferenceLineProps({
|
1111
|
-
|
1112
|
-
|
1113
|
+
className: "ui-line-chart__reference-line",
|
1114
|
+
index
|
1113
1115
|
})
|
1114
1116
|
},
|
1115
1117
|
`referenceLine-${index}`
|
@@ -1177,10 +1179,10 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1177
1179
|
{
|
1178
1180
|
className: "ui-line-chart__tooltip",
|
1179
1181
|
label,
|
1180
|
-
payload,
|
1181
|
-
valueFormatter,
|
1182
1182
|
labelFormatter,
|
1183
|
+
payload,
|
1183
1184
|
unit,
|
1185
|
+
valueFormatter,
|
1184
1186
|
...computedTooltipProps
|
1185
1187
|
}
|
1186
1188
|
),
|