@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/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,
|
@@ -366,6 +366,8 @@ var ChartLegend = (0, import_core3.forwardRef)(
|
|
366
366
|
);
|
367
367
|
}
|
368
368
|
);
|
369
|
+
ChartLegend.displayName = "ChartLegend";
|
370
|
+
ChartLegend.__ui__ = "ChartLegend";
|
369
371
|
|
370
372
|
// src/chart-tooltip.tsx
|
371
373
|
var import_core4 = require("@yamada-ui/core");
|
@@ -373,22 +375,22 @@ var import_utils4 = require("@yamada-ui/utils");
|
|
373
375
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
374
376
|
var ChartTooltip = (0, import_core4.forwardRef)(
|
375
377
|
({
|
376
|
-
label,
|
377
|
-
dataKey = "value",
|
378
378
|
className,
|
379
|
-
|
380
|
-
|
379
|
+
dataKey = "value",
|
380
|
+
isRadialChart,
|
381
|
+
label,
|
381
382
|
labelFormatter,
|
383
|
+
payload = [],
|
382
384
|
unit,
|
383
|
-
|
385
|
+
valueFormatter,
|
384
386
|
...rest
|
385
387
|
}, ref) => {
|
386
388
|
var _a;
|
387
389
|
const { styles } = useTooltip();
|
388
390
|
const items = payload.map(
|
389
391
|
({
|
390
|
-
color: colorProp,
|
391
392
|
name: nameProp,
|
393
|
+
color: colorProp,
|
392
394
|
[dataKey]: valueProp,
|
393
395
|
payload: payload2
|
394
396
|
} = {}, index) => {
|
@@ -458,25 +460,27 @@ var ChartTooltip = (0, import_core4.forwardRef)(
|
|
458
460
|
);
|
459
461
|
}
|
460
462
|
);
|
463
|
+
ChartTooltip.displayName = "ChartTooltip";
|
464
|
+
ChartTooltip.__ui__ = "ChartTooltip";
|
461
465
|
|
462
466
|
// src/use-chart-axis.ts
|
463
467
|
var import_core5 = require("@yamada-ui/core");
|
464
468
|
var import_utils5 = require("@yamada-ui/utils");
|
465
469
|
var import_react2 = require("react");
|
466
470
|
var useChartAxis = ({
|
467
|
-
dataKey,
|
468
471
|
type,
|
472
|
+
dataKey,
|
473
|
+
gridAxis = "x",
|
469
474
|
layoutType = "horizontal",
|
475
|
+
styles,
|
470
476
|
tickLine = "y",
|
471
|
-
|
477
|
+
unit,
|
472
478
|
withXAxis = true,
|
473
479
|
withYAxis = true,
|
474
480
|
xAxisLabel: xAxisLabelProp,
|
481
|
+
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
475
482
|
yAxisLabel: yAxisLabelProp,
|
476
|
-
unit,
|
477
483
|
yAxisTickFormatter = type === "percent" && layoutType === "horizontal" ? valueToPercent : void 0,
|
478
|
-
xAxisTickFormatter = type === "percent" && layoutType === "vertical" ? valueToPercent : void 0,
|
479
|
-
styles,
|
480
484
|
...rest
|
481
485
|
}) => {
|
482
486
|
var _a, _b, _c, _d;
|
@@ -486,7 +490,7 @@ var useChartAxis = ({
|
|
486
490
|
[dataKey, layoutType]
|
487
491
|
);
|
488
492
|
const yAxisKey = (0, import_react2.useMemo)(
|
489
|
-
() => layoutType === "vertical" ? {
|
493
|
+
() => layoutType === "vertical" ? { type: "category", dataKey } : { type: "number" },
|
490
494
|
[dataKey, layoutType]
|
491
495
|
);
|
492
496
|
const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
|
@@ -517,15 +521,15 @@ var useChartAxis = ({
|
|
517
521
|
className: (0, import_utils5.cx)(className, xAxisClassName),
|
518
522
|
hide: !withXAxis,
|
519
523
|
...xAxisKey,
|
520
|
-
tick: {
|
521
|
-
transform: "translate(0, 10)",
|
522
|
-
fill: "currentColor"
|
523
|
-
},
|
524
|
-
stroke: "",
|
525
524
|
interval: "preserveStartEnd",
|
526
|
-
tickLine: xTickLine,
|
527
525
|
minTickGap: 5,
|
526
|
+
stroke: "",
|
527
|
+
tick: {
|
528
|
+
fill: "currentColor",
|
529
|
+
transform: "translate(0, 10)"
|
530
|
+
},
|
528
531
|
tickFormatter: xAxisTickFormatter,
|
532
|
+
tickLine: xTickLine,
|
529
533
|
...props,
|
530
534
|
...xAxisProps
|
531
535
|
}),
|
@@ -541,17 +545,17 @@ var useChartAxis = ({
|
|
541
545
|
const getYAxisProps = (0, import_react2.useCallback)(
|
542
546
|
({ className, ...props } = {}) => ({
|
543
547
|
className: (0, import_utils5.cx)(className, yAxisClassName),
|
544
|
-
hide: !withYAxis,
|
545
548
|
axisLine: false,
|
549
|
+
hide: !withYAxis,
|
546
550
|
...yAxisKey,
|
547
|
-
|
551
|
+
allowDecimals: true,
|
548
552
|
tick: {
|
549
|
-
|
550
|
-
|
553
|
+
fill: "currentColor",
|
554
|
+
transform: "translate(-10, 0)"
|
551
555
|
},
|
552
|
-
allowDecimals: true,
|
553
|
-
unit,
|
554
556
|
tickFormatter: yAxisTickFormatter,
|
557
|
+
tickLine: yTickLine,
|
558
|
+
unit,
|
555
559
|
...props,
|
556
560
|
...yAxisProps
|
557
561
|
}),
|
@@ -568,9 +572,9 @@ var useChartAxis = ({
|
|
568
572
|
const getXAxisLabelProps = (0, import_react2.useCallback)(
|
569
573
|
({ className, ...props } = {}) => ({
|
570
574
|
className: (0, import_utils5.cx)(className, xAxisLabelClassName),
|
571
|
-
value: xAxisLabel,
|
572
|
-
position: "insideBottom",
|
573
575
|
offset: -20,
|
576
|
+
position: "insideBottom",
|
577
|
+
value: xAxisLabel,
|
574
578
|
...props,
|
575
579
|
...xAxisLabelProps
|
576
580
|
}),
|
@@ -579,21 +583,21 @@ var useChartAxis = ({
|
|
579
583
|
const getYAxisLabelProps = (0, import_react2.useCallback)(
|
580
584
|
({ className, ...props } = {}) => ({
|
581
585
|
className: (0, import_utils5.cx)(className, yAxisLabelClassName),
|
582
|
-
value: yAxisLabel,
|
583
|
-
position: "insideLeft",
|
584
586
|
angle: -90,
|
585
|
-
textAnchor: "middle",
|
586
587
|
offset: -5,
|
588
|
+
position: "insideLeft",
|
589
|
+
textAnchor: "middle",
|
590
|
+
value: yAxisLabel,
|
587
591
|
...props,
|
588
592
|
...yAxisLabelProps
|
589
593
|
}),
|
590
594
|
[yAxisLabel, yAxisLabelClassName, yAxisLabelProps]
|
591
595
|
);
|
592
596
|
return {
|
593
|
-
getXAxisProps,
|
594
|
-
getYAxisProps,
|
595
597
|
getXAxisLabelProps,
|
596
|
-
|
598
|
+
getXAxisProps,
|
599
|
+
getYAxisLabelProps,
|
600
|
+
getYAxisProps
|
597
601
|
};
|
598
602
|
};
|
599
603
|
var valueToPercent = (value) => {
|
@@ -605,10 +609,10 @@ var import_core6 = require("@yamada-ui/core");
|
|
605
609
|
var import_utils6 = require("@yamada-ui/utils");
|
606
610
|
var import_react3 = require("react");
|
607
611
|
var useChartGrid = ({
|
608
|
-
gridProps = {},
|
609
612
|
gridAxis = "x",
|
610
613
|
strokeDasharray = "5 5",
|
611
|
-
styles
|
614
|
+
styles,
|
615
|
+
gridProps = {}
|
612
616
|
}) => {
|
613
617
|
const { theme } = (0, import_core6.useTheme)();
|
614
618
|
const [reChartsProps, propClassName] = getComponentProps(
|
@@ -619,9 +623,9 @@ var useChartGrid = ({
|
|
619
623
|
({ className, ...props } = {}, ref = null) => ({
|
620
624
|
ref,
|
621
625
|
className: (0, import_utils6.cx)("ui-chart__grid", className, propClassName),
|
626
|
+
horizontal: gridAxis === "x" || gridAxis === "xy",
|
622
627
|
strokeDasharray,
|
623
628
|
vertical: gridAxis === "y" || gridAxis === "xy",
|
624
|
-
horizontal: gridAxis === "x" || gridAxis === "xy",
|
625
629
|
...props,
|
626
630
|
...reChartsProps
|
627
631
|
}),
|
@@ -651,7 +655,7 @@ var useChartLegend = ({
|
|
651
655
|
},
|
652
656
|
[rest]
|
653
657
|
);
|
654
|
-
return {
|
658
|
+
return { getLegendProps, legendProps };
|
655
659
|
};
|
656
660
|
|
657
661
|
// src/use-chart-reference-line.ts
|
@@ -659,8 +663,8 @@ var import_core7 = require("@yamada-ui/core");
|
|
659
663
|
var import_utils8 = require("@yamada-ui/utils");
|
660
664
|
var import_react5 = require("react");
|
661
665
|
var useChartReferenceLine = ({
|
662
|
-
|
663
|
-
|
666
|
+
styles,
|
667
|
+
referenceLineProps = []
|
664
668
|
}) => {
|
665
669
|
const { theme } = (0, import_core7.useTheme)();
|
666
670
|
const styleClassName = (0, import_core7.getCSS)(styles.referenceLine)(theme);
|
@@ -672,23 +676,24 @@ var useChartReferenceLine = ({
|
|
672
676
|
)(theme);
|
673
677
|
const color = (0, import_core7.getVar)(`reference-line-${index}`)(theme);
|
674
678
|
const label = {
|
675
|
-
value: labelProp,
|
676
679
|
fill: color,
|
677
680
|
position: "insideBottomLeft",
|
681
|
+
value: labelProp,
|
678
682
|
...(0, import_utils8.isObject)(labelProp) ? labelProp : {}
|
679
683
|
};
|
680
|
-
return {
|
684
|
+
return { color, label, propClassName, ...rest };
|
681
685
|
}),
|
682
686
|
[referenceLineProps, styleClassName, theme]
|
683
687
|
);
|
684
688
|
const getReferenceLineProps = (0, import_react5.useCallback)(
|
685
|
-
({
|
686
|
-
|
689
|
+
({ className, index, ...props }, ref = null) => {
|
690
|
+
var _a;
|
691
|
+
const { color, label, propClassName, ...rest } = (_a = propList[index]) != null ? _a : {};
|
687
692
|
return {
|
688
693
|
ref,
|
689
694
|
className: (0, import_utils8.cx)(className, propClassName),
|
690
|
-
stroke: color,
|
691
695
|
label,
|
696
|
+
stroke: color,
|
692
697
|
...props,
|
693
698
|
...rest
|
694
699
|
};
|
@@ -703,9 +708,9 @@ var import_core8 = require("@yamada-ui/core");
|
|
703
708
|
var import_utils9 = require("@yamada-ui/utils");
|
704
709
|
var import_react6 = require("react");
|
705
710
|
var useChartTooltip = ({
|
706
|
-
|
711
|
+
styles,
|
707
712
|
tooltipAnimationDuration = 0,
|
708
|
-
|
713
|
+
tooltipProps: _tooltipProps = {}
|
709
714
|
}) => {
|
710
715
|
const { theme } = (0, import_core8.useTheme)();
|
711
716
|
const { cursor, ...rest } = _tooltipProps;
|
@@ -721,16 +726,16 @@ var useChartTooltip = ({
|
|
721
726
|
(props, ref = null) => ({
|
722
727
|
ref,
|
723
728
|
animationDuration: tooltipAnimationDuration,
|
724
|
-
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
725
729
|
cursor: {
|
726
730
|
className: (0, import_utils9.cx)("ui-chart__cursor", cursorClassName)
|
727
731
|
},
|
732
|
+
isAnimationActive: (tooltipAnimationDuration || 0) > 0,
|
728
733
|
...props,
|
729
734
|
...tooltipProps
|
730
735
|
}),
|
731
736
|
[cursorClassName, tooltipAnimationDuration, tooltipProps]
|
732
737
|
);
|
733
|
-
return { tooltipProps: tooltipUIProps
|
738
|
+
return { getTooltipProps, tooltipProps: tooltipUIProps };
|
734
739
|
};
|
735
740
|
|
736
741
|
// src/use-line-chart.ts
|
@@ -738,20 +743,20 @@ var import_core9 = require("@yamada-ui/core");
|
|
738
743
|
var import_utils10 = require("@yamada-ui/utils");
|
739
744
|
var import_react7 = require("react");
|
740
745
|
var useLineChart = ({
|
746
|
+
connectNulls = true,
|
747
|
+
curveType = "monotone",
|
741
748
|
data,
|
742
|
-
|
749
|
+
fillOpacity = 1,
|
743
750
|
layoutType = "horizontal",
|
744
|
-
|
745
|
-
withActiveDots = true,
|
746
|
-
curveType = "monotone",
|
751
|
+
series,
|
747
752
|
strokeWidth = 2,
|
748
|
-
|
749
|
-
referenceLineProps,
|
750
|
-
fillOpacity = 1,
|
753
|
+
styles,
|
751
754
|
syncId,
|
755
|
+
withActiveDots = true,
|
756
|
+
withDots = true,
|
752
757
|
xAxisLabel,
|
753
758
|
yAxisLabel,
|
754
|
-
|
759
|
+
referenceLineProps,
|
755
760
|
...rest
|
756
761
|
}) => {
|
757
762
|
var _a;
|
@@ -759,10 +764,10 @@ var useLineChart = ({
|
|
759
764
|
const [highlightedArea, setHighlightedArea] = (0, import_react7.useState)(null);
|
760
765
|
const shouldHighlight = highlightedArea !== null;
|
761
766
|
const {
|
762
|
-
dot = {},
|
763
767
|
activeDot = {},
|
764
768
|
dimDot,
|
765
769
|
dimLine,
|
770
|
+
dot = {},
|
766
771
|
...computedLineProps
|
767
772
|
} = (_a = rest.lineProps) != null ? _a : {};
|
768
773
|
const lineColors = (0, import_react7.useMemo)(
|
@@ -843,11 +848,11 @@ var useLineChart = ({
|
|
843
848
|
const linePropList = (0, import_react7.useMemo)(
|
844
849
|
() => series.map((props, index) => {
|
845
850
|
const {
|
846
|
-
dataKey,
|
847
|
-
dot: dot2 = {},
|
848
851
|
activeDot: activeDot2 = {},
|
852
|
+
dataKey,
|
849
853
|
dimDot: dimDot2 = {},
|
850
854
|
dimLine: dimLine2 = {},
|
855
|
+
dot: dot2 = {},
|
851
856
|
...computedProps
|
852
857
|
} = props;
|
853
858
|
const color = (0, import_core9.getVar)(`line-${index}`)(theme);
|
@@ -873,8 +878,8 @@ var useLineChart = ({
|
|
873
878
|
resolvedActiveDot = {
|
874
879
|
className: (0, import_utils10.cx)("ui-line-chart__active-dot", className),
|
875
880
|
fill: color,
|
876
|
-
stroke: color,
|
877
881
|
r: 4,
|
882
|
+
stroke: color,
|
878
883
|
...rest3
|
879
884
|
};
|
880
885
|
} else {
|
@@ -903,9 +908,9 @@ var useLineChart = ({
|
|
903
908
|
}
|
904
909
|
return {
|
905
910
|
...rest2,
|
911
|
+
activeDot: resolvedActiveDot,
|
906
912
|
color,
|
907
913
|
dataKey,
|
908
|
-
activeDot: resolvedActiveDot,
|
909
914
|
dot: resolvedDot
|
910
915
|
};
|
911
916
|
}),
|
@@ -934,12 +939,12 @@ var useLineChart = ({
|
|
934
939
|
className: (0, import_utils10.cx)(className, lineChartClassName),
|
935
940
|
data,
|
936
941
|
layout: layoutType,
|
937
|
-
syncId,
|
938
942
|
margin: {
|
939
943
|
bottom: xAxisLabel ? 30 : void 0,
|
940
944
|
left: yAxisLabel ? 10 : void 0,
|
941
945
|
right: yAxisLabel ? 5 : void 0
|
942
946
|
},
|
947
|
+
syncId,
|
943
948
|
...props,
|
944
949
|
...chartProps
|
945
950
|
}),
|
@@ -954,20 +959,21 @@ var useLineChart = ({
|
|
954
959
|
]
|
955
960
|
);
|
956
961
|
const getLineProps = (0, import_react7.useCallback)(
|
957
|
-
({
|
958
|
-
|
962
|
+
({ className: classNameProp, index, ...props }) => {
|
963
|
+
var _a2;
|
964
|
+
const { className, activeDot: activeDot2, color, dataKey, dot: dot2, ...rest2 } = (_a2 = linePropList[index]) != null ? _a2 : {};
|
959
965
|
return {
|
966
|
+
type: curveType,
|
967
|
+
name: (0, import_utils10.runIfFunc)(dataKey, {}),
|
960
968
|
className: (0, import_utils10.cx)(classNameProp, className),
|
961
969
|
activeDot: activeDot2,
|
962
|
-
|
963
|
-
name: dataKey,
|
964
|
-
type: curveType,
|
970
|
+
connectNulls,
|
965
971
|
dataKey,
|
972
|
+
dot: dot2,
|
966
973
|
fill: color,
|
967
|
-
strokeWidth,
|
968
|
-
stroke: color,
|
969
974
|
isAnimationActive: false,
|
970
|
-
|
975
|
+
stroke: color,
|
976
|
+
strokeWidth,
|
971
977
|
...props,
|
972
978
|
...rest2
|
973
979
|
};
|
@@ -975,10 +981,10 @@ var useLineChart = ({
|
|
975
981
|
[connectNulls, curveType, linePropList, strokeWidth]
|
976
982
|
);
|
977
983
|
return {
|
978
|
-
getLineProps,
|
979
|
-
getLineChartProps,
|
980
984
|
lineVars,
|
981
|
-
setHighlightedArea
|
985
|
+
setHighlightedArea,
|
986
|
+
getLineChartProps,
|
987
|
+
getLineProps
|
982
988
|
};
|
983
989
|
};
|
984
990
|
|
@@ -987,113 +993,113 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
987
993
|
var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
988
994
|
const [styles, mergedProps] = (0, import_core10.useComponentMultiStyle)("LineChart", props);
|
989
995
|
const {
|
996
|
+
type,
|
990
997
|
className,
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
strokeDasharray,
|
998
|
+
connectNulls,
|
999
|
+
curveType,
|
1000
|
+
data,
|
995
1001
|
dataKey,
|
996
|
-
|
1002
|
+
fillOpacity,
|
1003
|
+
gridAxis,
|
1004
|
+
labelFormatter,
|
997
1005
|
layoutType,
|
1006
|
+
series,
|
1007
|
+
strokeDasharray,
|
1008
|
+
strokeWidth,
|
1009
|
+
syncId,
|
998
1010
|
tickLine,
|
1011
|
+
tooltipAnimationDuration,
|
1012
|
+
unit,
|
1013
|
+
valueFormatter,
|
1014
|
+
withActiveDots,
|
1015
|
+
withDots,
|
1016
|
+
withLegend = false,
|
1017
|
+
withTooltip = true,
|
999
1018
|
withXAxis,
|
1000
1019
|
withYAxis,
|
1001
|
-
xAxisProps,
|
1002
|
-
yAxisProps,
|
1003
1020
|
xAxisLabel,
|
1021
|
+
xAxisTickFormatter,
|
1004
1022
|
yAxisLabel,
|
1005
|
-
xAxisLabelProps,
|
1006
|
-
yAxisLabelProps,
|
1007
|
-
unit,
|
1008
1023
|
yAxisTickFormatter,
|
1009
|
-
xAxisTickFormatter,
|
1010
|
-
valueFormatter,
|
1011
|
-
labelFormatter,
|
1012
|
-
referenceLineProps,
|
1013
|
-
tooltipProps,
|
1014
|
-
tooltipAnimationDuration,
|
1015
|
-
legendProps,
|
1016
|
-
withLegend = false,
|
1017
|
-
withTooltip = true,
|
1018
|
-
series,
|
1019
|
-
data,
|
1020
1024
|
chartProps,
|
1025
|
+
containerProps,
|
1026
|
+
gridProps,
|
1027
|
+
legendProps,
|
1021
1028
|
lineProps,
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
syncId,
|
1029
|
+
referenceLineProps,
|
1030
|
+
tooltipProps,
|
1031
|
+
xAxisLabelProps,
|
1032
|
+
xAxisProps,
|
1033
|
+
yAxisLabelProps,
|
1034
|
+
yAxisProps,
|
1029
1035
|
...rest
|
1030
1036
|
} = (0, import_core10.omitThemeProps)(mergedProps);
|
1031
|
-
const {
|
1037
|
+
const { lineVars, setHighlightedArea, getLineChartProps, getLineProps } = useLineChart({
|
1038
|
+
connectNulls,
|
1039
|
+
curveType,
|
1040
|
+
data,
|
1041
|
+
fillOpacity,
|
1032
1042
|
layoutType,
|
1033
1043
|
series,
|
1034
|
-
referenceLineProps,
|
1035
|
-
data,
|
1036
|
-
chartProps,
|
1037
|
-
lineProps,
|
1038
|
-
withDots,
|
1039
|
-
withActiveDots,
|
1040
|
-
curveType,
|
1041
1044
|
strokeWidth,
|
1042
|
-
|
1043
|
-
fillOpacity,
|
1045
|
+
styles,
|
1044
1046
|
syncId,
|
1047
|
+
withActiveDots,
|
1048
|
+
withDots,
|
1045
1049
|
xAxisLabel,
|
1046
1050
|
yAxisLabel,
|
1047
|
-
|
1051
|
+
chartProps,
|
1052
|
+
lineProps,
|
1053
|
+
referenceLineProps
|
1048
1054
|
});
|
1049
1055
|
const { getContainerProps } = useChart({ containerProps });
|
1050
1056
|
const {
|
1051
|
-
getXAxisProps,
|
1052
|
-
getYAxisProps,
|
1053
1057
|
getXAxisLabelProps,
|
1054
|
-
|
1058
|
+
getXAxisProps,
|
1059
|
+
getYAxisLabelProps,
|
1060
|
+
getYAxisProps
|
1055
1061
|
} = useChartAxis({
|
1056
|
-
dataKey,
|
1057
1062
|
type,
|
1063
|
+
dataKey,
|
1064
|
+
gridAxis,
|
1058
1065
|
layoutType,
|
1066
|
+
styles,
|
1059
1067
|
tickLine,
|
1060
|
-
|
1068
|
+
unit,
|
1061
1069
|
withXAxis,
|
1062
1070
|
withYAxis,
|
1063
|
-
xAxisProps,
|
1064
|
-
yAxisProps,
|
1065
1071
|
xAxisLabel,
|
1072
|
+
xAxisTickFormatter,
|
1066
1073
|
yAxisLabel,
|
1074
|
+
yAxisTickFormatter,
|
1067
1075
|
xAxisLabelProps,
|
1076
|
+
xAxisProps,
|
1068
1077
|
yAxisLabelProps,
|
1069
|
-
|
1070
|
-
yAxisTickFormatter,
|
1071
|
-
xAxisTickFormatter,
|
1072
|
-
styles
|
1078
|
+
yAxisProps
|
1073
1079
|
});
|
1074
1080
|
const { getReferenceLineProps } = useChartReferenceLine({
|
1075
|
-
|
1076
|
-
|
1081
|
+
styles,
|
1082
|
+
referenceLineProps
|
1077
1083
|
});
|
1078
1084
|
const { getGridProps } = useChartGrid({
|
1079
|
-
gridProps,
|
1080
1085
|
gridAxis,
|
1081
1086
|
strokeDasharray,
|
1082
|
-
styles
|
1087
|
+
styles,
|
1088
|
+
gridProps
|
1083
1089
|
});
|
1084
|
-
const { tooltipProps: computedTooltipProps
|
1085
|
-
|
1090
|
+
const { getTooltipProps, tooltipProps: computedTooltipProps } = useChartTooltip({
|
1091
|
+
styles,
|
1086
1092
|
tooltipAnimationDuration,
|
1087
|
-
|
1093
|
+
tooltipProps
|
1088
1094
|
});
|
1089
|
-
const { legendProps: computedLegendProps
|
1095
|
+
const { getLegendProps, legendProps: computedLegendProps } = useChartLegend({
|
1090
1096
|
legendProps
|
1091
1097
|
});
|
1092
1098
|
const lines = (0, import_react8.useMemo)(
|
1093
1099
|
() => series.map(({ dataKey: dataKey2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
1094
1100
|
import_recharts.Line,
|
1095
1101
|
{
|
1096
|
-
...getLineProps({
|
1102
|
+
...getLineProps({ className: "ui-line-chart__line", index })
|
1097
1103
|
},
|
1098
1104
|
`line-${dataKey2}`
|
1099
1105
|
)),
|
@@ -1104,8 +1110,8 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1104
1110
|
import_recharts.ReferenceLine,
|
1105
1111
|
{
|
1106
1112
|
...getReferenceLineProps({
|
1107
|
-
|
1108
|
-
|
1113
|
+
className: "ui-line-chart__reference-line",
|
1114
|
+
index
|
1109
1115
|
})
|
1110
1116
|
},
|
1111
1117
|
`referenceLine-${index}`
|
@@ -1173,10 +1179,10 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1173
1179
|
{
|
1174
1180
|
className: "ui-line-chart__tooltip",
|
1175
1181
|
label,
|
1176
|
-
payload,
|
1177
|
-
valueFormatter,
|
1178
1182
|
labelFormatter,
|
1183
|
+
payload,
|
1179
1184
|
unit,
|
1185
|
+
valueFormatter,
|
1180
1186
|
...computedTooltipProps
|
1181
1187
|
}
|
1182
1188
|
),
|
@@ -1193,6 +1199,8 @@ var LineChart = (0, import_core10.forwardRef)((props, ref) => {
|
|
1193
1199
|
}
|
1194
1200
|
) });
|
1195
1201
|
});
|
1202
|
+
LineChart.displayName = "LineChart";
|
1203
|
+
LineChart.__ui__ = "LineChart";
|
1196
1204
|
// Annotate the CommonJS export names for ESM import in node:
|
1197
1205
|
0 && (module.exports = {
|
1198
1206
|
LineChart
|