@yamada-ui/charts 1.0.0
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/LICENSE +21 -0
- package/README.md +28 -0
- package/dist/area-chart-gradient.d.mts +11 -0
- package/dist/area-chart-gradient.d.ts +11 -0
- package/dist/area-chart-gradient.js +47 -0
- package/dist/area-chart-gradient.js.map +1 -0
- package/dist/area-chart-gradient.mjs +8 -0
- package/dist/area-chart-gradient.mjs.map +1 -0
- package/dist/area-chart-split.d.mts +10 -0
- package/dist/area-chart-split.d.ts +10 -0
- package/dist/area-chart-split.js +52 -0
- package/dist/area-chart-split.js.map +1 -0
- package/dist/area-chart-split.mjs +8 -0
- package/dist/area-chart-split.mjs.map +1 -0
- package/dist/area-chart.d.mts +36 -0
- package/dist/area-chart.d.ts +36 -0
- package/dist/area-chart.js +1249 -0
- package/dist/area-chart.js.map +1 -0
- package/dist/area-chart.mjs +21 -0
- package/dist/area-chart.mjs.map +1 -0
- package/dist/bar-chart.d.mts +33 -0
- package/dist/bar-chart.d.ts +33 -0
- package/dist/bar-chart.js +1053 -0
- package/dist/bar-chart.js.map +1 -0
- package/dist/bar-chart.mjs +19 -0
- package/dist/bar-chart.mjs.map +1 -0
- package/dist/chart-legend.d.mts +12 -0
- package/dist/chart-legend.d.ts +12 -0
- package/dist/chart-legend.js +87 -0
- package/dist/chart-legend.js.map +1 -0
- package/dist/chart-legend.mjs +11 -0
- package/dist/chart-legend.mjs.map +1 -0
- package/dist/chart-tooltip.d.mts +12 -0
- package/dist/chart-tooltip.d.ts +12 -0
- package/dist/chart-tooltip.js +120 -0
- package/dist/chart-tooltip.js.map +1 -0
- package/dist/chart-tooltip.mjs +11 -0
- package/dist/chart-tooltip.mjs.map +1 -0
- package/dist/chart-utils.d.mts +9 -0
- package/dist/chart-utils.d.ts +9 -0
- package/dist/chart-utils.js +45 -0
- package/dist/chart-utils.js.map +1 -0
- package/dist/chart-utils.mjs +10 -0
- package/dist/chart-utils.mjs.map +1 -0
- package/dist/chart.types.d.mts +65 -0
- package/dist/chart.types.d.ts +65 -0
- package/dist/chart.types.js +20 -0
- package/dist/chart.types.js.map +1 -0
- package/dist/chart.types.mjs +2 -0
- package/dist/chart.types.mjs.map +1 -0
- package/dist/chunk-32BO2QEP.mjs +83 -0
- package/dist/chunk-32BO2QEP.mjs.map +1 -0
- package/dist/chunk-3CY3IFRN.mjs +42 -0
- package/dist/chunk-3CY3IFRN.mjs.map +1 -0
- package/dist/chunk-3IBGJT6F.mjs +341 -0
- package/dist/chunk-3IBGJT6F.mjs.map +1 -0
- package/dist/chunk-5QCKM3B3.mjs +438 -0
- package/dist/chunk-5QCKM3B3.mjs.map +1 -0
- package/dist/chunk-AURFFNDQ.mjs +114 -0
- package/dist/chunk-AURFFNDQ.mjs.map +1 -0
- package/dist/chunk-FGDWJUA3.mjs +56 -0
- package/dist/chunk-FGDWJUA3.mjs.map +1 -0
- package/dist/chunk-GZLE5XDS.mjs +227 -0
- package/dist/chunk-GZLE5XDS.mjs.map +1 -0
- package/dist/chunk-HE6SM47L.mjs +234 -0
- package/dist/chunk-HE6SM47L.mjs.map +1 -0
- package/dist/chunk-LXZCGIND.mjs +33 -0
- package/dist/chunk-LXZCGIND.mjs.map +1 -0
- package/dist/chunk-MSIOYYWR.mjs +24 -0
- package/dist/chunk-MSIOYYWR.mjs.map +1 -0
- package/dist/chunk-PNE3JG54.mjs +29 -0
- package/dist/chunk-PNE3JG54.mjs.map +1 -0
- package/dist/chunk-QL3DB7OJ.mjs +21 -0
- package/dist/chunk-QL3DB7OJ.mjs.map +1 -0
- package/dist/chunk-RG5JQJXE.mjs +249 -0
- package/dist/chunk-RG5JQJXE.mjs.map +1 -0
- package/dist/chunk-RTTZPOUT.mjs +50 -0
- package/dist/chunk-RTTZPOUT.mjs.map +1 -0
- package/dist/chunk-RXWD2EJ2.mjs +56 -0
- package/dist/chunk-RXWD2EJ2.mjs.map +1 -0
- package/dist/chunk-TKLHZBVY.mjs +206 -0
- package/dist/chunk-TKLHZBVY.mjs.map +1 -0
- package/dist/chunk-WDSR6B47.mjs +324 -0
- package/dist/chunk-WDSR6B47.mjs.map +1 -0
- package/dist/chunk-WF3BD34Y.mjs +74 -0
- package/dist/chunk-WF3BD34Y.mjs.map +1 -0
- package/dist/chunk-YBAGOHS5.mjs +204 -0
- package/dist/chunk-YBAGOHS5.mjs.map +1 -0
- package/dist/chunk-YRY7MUCR.mjs +258 -0
- package/dist/chunk-YRY7MUCR.mjs.map +1 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +2725 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +36 -0
- package/dist/index.mjs.map +1 -0
- package/dist/line-chart.d.mts +33 -0
- package/dist/line-chart.d.ts +33 -0
- package/dist/line-chart.js +1114 -0
- package/dist/line-chart.js.map +1 -0
- package/dist/line-chart.mjs +19 -0
- package/dist/line-chart.mjs.map +1 -0
- package/dist/radar-chart.d.mts +52 -0
- package/dist/radar-chart.d.ts +52 -0
- package/dist/radar-chart.js +940 -0
- package/dist/radar-chart.js.map +1 -0
- package/dist/radar-chart.mjs +16 -0
- package/dist/radar-chart.mjs.map +1 -0
- package/dist/rechart-properties.d.mts +24 -0
- package/dist/rechart-properties.d.ts +24 -0
- package/dist/rechart-properties.js +479 -0
- package/dist/rechart-properties.js.map +1 -0
- package/dist/rechart-properties.mjs +44 -0
- package/dist/rechart-properties.mjs.map +1 -0
- package/dist/use-area-chart.d.mts +118 -0
- package/dist/use-area-chart.d.ts +118 -0
- package/dist/use-area-chart.js +418 -0
- package/dist/use-area-chart.js.map +1 -0
- package/dist/use-area-chart.mjs +10 -0
- package/dist/use-area-chart.mjs.map +1 -0
- package/dist/use-bar-chart.d.mts +68 -0
- package/dist/use-bar-chart.d.ts +68 -0
- package/dist/use-bar-chart.js +288 -0
- package/dist/use-bar-chart.js.map +1 -0
- package/dist/use-bar-chart.mjs +10 -0
- package/dist/use-bar-chart.mjs.map +1 -0
- package/dist/use-chart-axis.d.mts +73 -0
- package/dist/use-chart-axis.d.ts +73 -0
- package/dist/use-chart-axis.js +227 -0
- package/dist/use-chart-axis.js.map +1 -0
- package/dist/use-chart-axis.mjs +10 -0
- package/dist/use-chart-axis.mjs.map +1 -0
- package/dist/use-chart-grid.d.mts +32 -0
- package/dist/use-chart-grid.d.ts +32 -0
- package/dist/use-chart-grid.js +92 -0
- package/dist/use-chart-grid.js.map +1 -0
- package/dist/use-chart-grid.mjs +10 -0
- package/dist/use-chart-grid.mjs.map +1 -0
- package/dist/use-chart-legend.d.mts +18 -0
- package/dist/use-chart-legend.d.ts +18 -0
- package/dist/use-chart-legend.js +81 -0
- package/dist/use-chart-legend.js.map +1 -0
- package/dist/use-chart-legend.mjs +9 -0
- package/dist/use-chart-legend.mjs.map +1 -0
- package/dist/use-chart-reference-line.d.mts +22 -0
- package/dist/use-chart-reference-line.d.ts +22 -0
- package/dist/use-chart-reference-line.js +105 -0
- package/dist/use-chart-reference-line.js.map +1 -0
- package/dist/use-chart-reference-line.mjs +10 -0
- package/dist/use-chart-reference-line.mjs.map +1 -0
- package/dist/use-chart-tooltip.d.mts +35 -0
- package/dist/use-chart-tooltip.d.ts +35 -0
- package/dist/use-chart-tooltip.js +121 -0
- package/dist/use-chart-tooltip.js.map +1 -0
- package/dist/use-chart-tooltip.mjs +9 -0
- package/dist/use-chart-tooltip.mjs.map +1 -0
- package/dist/use-chart.d.mts +33 -0
- package/dist/use-chart.d.ts +33 -0
- package/dist/use-chart.js +104 -0
- package/dist/use-chart.js.map +1 -0
- package/dist/use-chart.mjs +18 -0
- package/dist/use-chart.mjs.map +1 -0
- package/dist/use-line-chart.d.mts +92 -0
- package/dist/use-line-chart.d.ts +92 -0
- package/dist/use-line-chart.js +342 -0
- package/dist/use-line-chart.js.map +1 -0
- package/dist/use-line-chart.mjs +10 -0
- package/dist/use-line-chart.mjs.map +1 -0
- package/dist/use-radar-chart.d.mts +93 -0
- package/dist/use-radar-chart.d.ts +93 -0
- package/dist/use-radar-chart.js +471 -0
- package/dist/use-radar-chart.js.map +1 -0
- package/dist/use-radar-chart.mjs +10 -0
- package/dist/use-radar-chart.mjs.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { As, HTMLUIProps, CSSUIProps } from '@yamada-ui/core';
|
|
2
|
+
import { Merge } from '@yamada-ui/utils';
|
|
3
|
+
import { ComponentPropsWithoutRef, SVGProps, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import * as Recharts from 'recharts';
|
|
5
|
+
|
|
6
|
+
type ChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
|
|
7
|
+
type RequiredChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
|
|
8
|
+
type ChartLayoutType = "horizontal" | "vertical";
|
|
9
|
+
type AreaChartType = "default" | "stacked" | "percent" | "split";
|
|
10
|
+
type BarChartType = Exclude<AreaChartType, "split">;
|
|
11
|
+
type ChartAxisType = "x" | "y" | "xy" | "none";
|
|
12
|
+
type ChartCurveType = "bump" | "linear" | "natural" | "monotone" | "step" | "stepBefore" | "stepAfter";
|
|
13
|
+
type AreaChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.AreaChart>>;
|
|
14
|
+
type BarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.BarChart>>;
|
|
15
|
+
type LineChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.LineChart>>;
|
|
16
|
+
type RadarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.RadarChart>>;
|
|
17
|
+
type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>;
|
|
18
|
+
type ResponsiveContainerProps = Merge<CSSUIProps, Omit<Recharts.ResponsiveContainerProps, "children">>;
|
|
19
|
+
type AreaProps = Merge<Merge<CSSUIProps, Recharts.AreaProps>, {
|
|
20
|
+
color: CSSUIProps["color"];
|
|
21
|
+
dot?: DotProps;
|
|
22
|
+
activeDot?: DotProps;
|
|
23
|
+
dimDot?: DotProps;
|
|
24
|
+
dimArea?: Partial<AreaProps>;
|
|
25
|
+
}>;
|
|
26
|
+
type LineProps = Merge<Merge<CSSUIProps, Recharts.LineProps>, {
|
|
27
|
+
color: CSSUIProps["color"];
|
|
28
|
+
activeDot?: DotProps;
|
|
29
|
+
dot?: DotProps;
|
|
30
|
+
dimDot?: DotProps;
|
|
31
|
+
dimLine?: Partial<LineProps>;
|
|
32
|
+
}>;
|
|
33
|
+
type BarProps = Merge<Merge<CSSUIProps, Recharts.BarProps>, {
|
|
34
|
+
color: CSSUIProps["color"];
|
|
35
|
+
activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
|
|
36
|
+
background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
|
|
37
|
+
dimBar?: Partial<BarProps>;
|
|
38
|
+
}>;
|
|
39
|
+
type RadarProps = Merge<Merge<CSSUIProps, Recharts.RadarProps>, {
|
|
40
|
+
color: CSSUIProps["color"];
|
|
41
|
+
dot?: DotProps;
|
|
42
|
+
activeDot?: DotProps;
|
|
43
|
+
dimDot?: DotProps;
|
|
44
|
+
dimRadar?: Partial<RadarProps>;
|
|
45
|
+
}>;
|
|
46
|
+
type DotProps = Merge<Omit<Recharts.DotProps, "ref">, CSSUIProps>;
|
|
47
|
+
type XAxisProps = Merge<Merge<CSSUIProps, Recharts.XAxisProps>, {
|
|
48
|
+
color?: CSSUIProps["color"];
|
|
49
|
+
stroke?: CSSUIProps["color"];
|
|
50
|
+
fill?: CSSUIProps["color"];
|
|
51
|
+
}>;
|
|
52
|
+
type YAxisProps = Merge<Merge<CSSUIProps, Recharts.YAxisProps>, {
|
|
53
|
+
color?: CSSUIProps["color"];
|
|
54
|
+
}>;
|
|
55
|
+
type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, "ref">>;
|
|
56
|
+
type TooltipProps = Merge<Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, "ref">>, {
|
|
57
|
+
cursor?: CSSUIProps;
|
|
58
|
+
}>;
|
|
59
|
+
type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>;
|
|
60
|
+
type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>;
|
|
61
|
+
type PolarAngleAxisProps = Merge<Recharts.PolarAngleAxisProps, CSSUIProps>;
|
|
62
|
+
type PolarRadiusAxisProps = Merge<CSSUIProps, Recharts.PolarRadiusAxisProps>;
|
|
63
|
+
type ChartTooltip = ReactElement | ((props: Recharts.TooltipProps<number | string | Array<number | string>, number | string>) => ReactNode);
|
|
64
|
+
|
|
65
|
+
export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, ChartAxisType, ChartCurveType, ChartLayoutType, ChartPropGetter, ChartTooltip, DotProps, GridProps, LegendProps, LineChartProps, LineProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipProps, XAxisProps, YAxisProps };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { As, HTMLUIProps, CSSUIProps } from '@yamada-ui/core';
|
|
2
|
+
import { Merge } from '@yamada-ui/utils';
|
|
3
|
+
import { ComponentPropsWithoutRef, SVGProps, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import * as Recharts from 'recharts';
|
|
5
|
+
|
|
6
|
+
type ChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
|
|
7
|
+
type RequiredChartPropGetter<Y extends As = "div", M = undefined, D = undefined> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D;
|
|
8
|
+
type ChartLayoutType = "horizontal" | "vertical";
|
|
9
|
+
type AreaChartType = "default" | "stacked" | "percent" | "split";
|
|
10
|
+
type BarChartType = Exclude<AreaChartType, "split">;
|
|
11
|
+
type ChartAxisType = "x" | "y" | "xy" | "none";
|
|
12
|
+
type ChartCurveType = "bump" | "linear" | "natural" | "monotone" | "step" | "stepBefore" | "stepAfter";
|
|
13
|
+
type AreaChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.AreaChart>>;
|
|
14
|
+
type BarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.BarChart>>;
|
|
15
|
+
type LineChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.LineChart>>;
|
|
16
|
+
type RadarChartProps = Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.RadarChart>>;
|
|
17
|
+
type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>;
|
|
18
|
+
type ResponsiveContainerProps = Merge<CSSUIProps, Omit<Recharts.ResponsiveContainerProps, "children">>;
|
|
19
|
+
type AreaProps = Merge<Merge<CSSUIProps, Recharts.AreaProps>, {
|
|
20
|
+
color: CSSUIProps["color"];
|
|
21
|
+
dot?: DotProps;
|
|
22
|
+
activeDot?: DotProps;
|
|
23
|
+
dimDot?: DotProps;
|
|
24
|
+
dimArea?: Partial<AreaProps>;
|
|
25
|
+
}>;
|
|
26
|
+
type LineProps = Merge<Merge<CSSUIProps, Recharts.LineProps>, {
|
|
27
|
+
color: CSSUIProps["color"];
|
|
28
|
+
activeDot?: DotProps;
|
|
29
|
+
dot?: DotProps;
|
|
30
|
+
dimDot?: DotProps;
|
|
31
|
+
dimLine?: Partial<LineProps>;
|
|
32
|
+
}>;
|
|
33
|
+
type BarProps = Merge<Merge<CSSUIProps, Recharts.BarProps>, {
|
|
34
|
+
color: CSSUIProps["color"];
|
|
35
|
+
activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
|
|
36
|
+
background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>;
|
|
37
|
+
dimBar?: Partial<BarProps>;
|
|
38
|
+
}>;
|
|
39
|
+
type RadarProps = Merge<Merge<CSSUIProps, Recharts.RadarProps>, {
|
|
40
|
+
color: CSSUIProps["color"];
|
|
41
|
+
dot?: DotProps;
|
|
42
|
+
activeDot?: DotProps;
|
|
43
|
+
dimDot?: DotProps;
|
|
44
|
+
dimRadar?: Partial<RadarProps>;
|
|
45
|
+
}>;
|
|
46
|
+
type DotProps = Merge<Omit<Recharts.DotProps, "ref">, CSSUIProps>;
|
|
47
|
+
type XAxisProps = Merge<Merge<CSSUIProps, Recharts.XAxisProps>, {
|
|
48
|
+
color?: CSSUIProps["color"];
|
|
49
|
+
stroke?: CSSUIProps["color"];
|
|
50
|
+
fill?: CSSUIProps["color"];
|
|
51
|
+
}>;
|
|
52
|
+
type YAxisProps = Merge<Merge<CSSUIProps, Recharts.YAxisProps>, {
|
|
53
|
+
color?: CSSUIProps["color"];
|
|
54
|
+
}>;
|
|
55
|
+
type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, "ref">>;
|
|
56
|
+
type TooltipProps = Merge<Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, "ref">>, {
|
|
57
|
+
cursor?: CSSUIProps;
|
|
58
|
+
}>;
|
|
59
|
+
type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>;
|
|
60
|
+
type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>;
|
|
61
|
+
type PolarAngleAxisProps = Merge<Recharts.PolarAngleAxisProps, CSSUIProps>;
|
|
62
|
+
type PolarRadiusAxisProps = Merge<CSSUIProps, Recharts.PolarRadiusAxisProps>;
|
|
63
|
+
type ChartTooltip = ReactElement | ((props: Recharts.TooltipProps<number | string | Array<number | string>, number | string>) => ReactNode);
|
|
64
|
+
|
|
65
|
+
export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, ChartAxisType, ChartCurveType, ChartLayoutType, ChartPropGetter, ChartTooltip, DotProps, GridProps, LegendProps, LineChartProps, LineProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, ReferenceLineProps, RequiredChartPropGetter, ResponsiveContainerProps, TooltipProps, XAxisProps, YAxisProps };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __copyProps = (to, from, except, desc) => {
|
|
8
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
9
|
+
for (let key of __getOwnPropNames(from))
|
|
10
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
11
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
+
}
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
|
|
17
|
+
// src/chart.types.ts
|
|
18
|
+
var chart_types_exports = {};
|
|
19
|
+
module.exports = __toCommonJS(chart_types_exports);
|
|
20
|
+
//# sourceMappingURL=chart.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chart.types.ts"],"sourcesContent":["import type { As, CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { Merge } from \"@yamada-ui/utils\"\nimport type {\n ComponentPropsWithoutRef,\n ReactElement,\n ReactNode,\n SVGProps,\n} from \"react\"\nimport type * as Recharts from \"recharts\"\n\nexport type ChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props?: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\n\nexport type RequiredChartPropGetter<\n Y extends As = \"div\",\n M = undefined,\n D = undefined,\n> = (props: Merge<HTMLUIProps<Y>, M>, ref?: React.Ref<any>) => D\n\nexport type ChartLayoutType = \"horizontal\" | \"vertical\"\nexport type AreaChartType = \"default\" | \"stacked\" | \"percent\" | \"split\"\nexport type BarChartType = Exclude<AreaChartType, \"split\">\nexport type ChartAxisType = \"x\" | \"y\" | \"xy\" | \"none\"\nexport type ChartCurveType =\n | \"bump\"\n | \"linear\"\n | \"natural\"\n | \"monotone\"\n | \"step\"\n | \"stepBefore\"\n | \"stepAfter\"\n\nexport type AreaChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>\n>\nexport type BarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.BarChart>\n>\nexport type LineChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.LineChart>\n>\nexport type RadarChartProps = Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>\n>\nexport type ReferenceLineProps = Merge<CSSUIProps, Recharts.ReferenceLineProps>\nexport type ResponsiveContainerProps = Merge<\n CSSUIProps,\n Omit<Recharts.ResponsiveContainerProps, \"children\">\n>\nexport type AreaProps = Merge<\n Merge<CSSUIProps, Recharts.AreaProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimArea?: Partial<AreaProps>\n }\n>\nexport type LineProps = Merge<\n Merge<CSSUIProps, Recharts.LineProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dot?: DotProps\n dimDot?: DotProps\n dimLine?: Partial<LineProps>\n }\n>\nexport type BarProps = Merge<\n Merge<CSSUIProps, Recharts.BarProps>,\n {\n color: CSSUIProps[\"color\"]\n activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n dimBar?: Partial<BarProps>\n }\n>\nexport type RadarProps = Merge<\n Merge<CSSUIProps, Recharts.RadarProps>,\n {\n color: CSSUIProps[\"color\"]\n dot?: DotProps\n activeDot?: DotProps\n dimDot?: DotProps\n dimRadar?: Partial<RadarProps>\n }\n>\nexport type DotProps = Merge<Omit<Recharts.DotProps, \"ref\">, CSSUIProps>\nexport type XAxisProps = Merge<\n Merge<CSSUIProps, Recharts.XAxisProps>,\n {\n color?: CSSUIProps[\"color\"]\n stroke?: CSSUIProps[\"color\"]\n fill?: CSSUIProps[\"color\"]\n }\n>\nexport type YAxisProps = Merge<\n Merge<CSSUIProps, Recharts.YAxisProps>,\n { color?: CSSUIProps[\"color\"] }\n>\nexport type LegendProps = Merge<CSSUIProps, Omit<Recharts.LegendProps, \"ref\">>\nexport type TooltipProps = Merge<\n Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, \"ref\">>,\n { cursor?: CSSUIProps }\n>\nexport type GridProps = Merge<CSSUIProps, Recharts.CartesianGridProps>\nexport type PolarGridProps = Merge<CSSUIProps, Recharts.PolarGridProps>\nexport type PolarAngleAxisProps = Merge<\n Recharts.PolarAngleAxisProps,\n CSSUIProps\n>\nexport type PolarRadiusAxisProps = Merge<\n CSSUIProps,\n Recharts.PolarRadiusAxisProps\n>\n\nexport type ChartTooltip =\n | ReactElement\n | ((\n props: Recharts.TooltipProps<\n number | string | Array<number | string>,\n number | string\n >,\n ) => ReactNode)\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import {
|
|
3
|
+
useTooltip
|
|
4
|
+
} from "./chunk-RXWD2EJ2.mjs";
|
|
5
|
+
|
|
6
|
+
// src/chart-tooltip.tsx
|
|
7
|
+
import { forwardRef, ui } from "@yamada-ui/core";
|
|
8
|
+
import { cx, isArray } from "@yamada-ui/utils";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var ChartTooltip = forwardRef(
|
|
11
|
+
({ label, className, payload = [], valueFormatter, unit, ...rest }, ref) => {
|
|
12
|
+
const { styles } = useTooltip();
|
|
13
|
+
const items = payload.map(
|
|
14
|
+
({ color, name, value: valueProp } = {}, index) => {
|
|
15
|
+
var _a;
|
|
16
|
+
let value;
|
|
17
|
+
if (isArray(valueProp)) {
|
|
18
|
+
value = valueProp.map((value2) => {
|
|
19
|
+
var _a2;
|
|
20
|
+
return `${(_a2 = valueFormatter == null ? void 0 : valueFormatter(value2)) != null ? _a2 : value2}`;
|
|
21
|
+
}).join(" - ");
|
|
22
|
+
} else {
|
|
23
|
+
value = (_a = valueFormatter == null ? void 0 : valueFormatter(valueProp)) != null ? _a : valueProp;
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
ui.div,
|
|
27
|
+
{
|
|
28
|
+
className: "ui-chart__tooltip-item",
|
|
29
|
+
__css: styles.tooltipItem,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx(
|
|
32
|
+
ui.div,
|
|
33
|
+
{
|
|
34
|
+
className: "ui-chart__tooltip-swatch",
|
|
35
|
+
background: color,
|
|
36
|
+
__css: styles.tooltipSwatch
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
ui.span,
|
|
41
|
+
{
|
|
42
|
+
className: "ui-chart__tooltip-label",
|
|
43
|
+
__css: styles.tooltipLabel,
|
|
44
|
+
children: name
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsxs(
|
|
48
|
+
ui.span,
|
|
49
|
+
{
|
|
50
|
+
className: "ui-chart__tooltip-value",
|
|
51
|
+
__css: styles.tooltipValue,
|
|
52
|
+
children: [
|
|
53
|
+
value,
|
|
54
|
+
unit ? unit : ""
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
`tooltip-payload-${index}`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
return /* @__PURE__ */ jsxs(
|
|
65
|
+
ui.div,
|
|
66
|
+
{
|
|
67
|
+
ref,
|
|
68
|
+
className: cx("ui-chart__tooltip", className),
|
|
69
|
+
__css: styles.tooltip,
|
|
70
|
+
...rest,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: label }),
|
|
73
|
+
/* @__PURE__ */ jsx(ui.div, { className: "ui-chart__tooltip-list", __css: styles.tooltipList, children: items })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export {
|
|
81
|
+
ChartTooltip
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=chunk-32BO2QEP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/chart-tooltip.tsx"],"sourcesContent":["import { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx, isArray, type Dict } from \"@yamada-ui/utils\"\nimport { useTooltip } from \"./use-chart\"\n\nexport type ChartTooltipProps = {\n label: string\n payload: Dict[] | undefined\n valueFormatter?: (value: number) => string\n unit?: string\n}\n\nexport const ChartTooltip = forwardRef<ChartTooltipProps, \"div\">(\n ({ label, className, payload = [], valueFormatter, unit, ...rest }, ref) => {\n const { styles } = useTooltip()\n\n const items = payload.map(\n ({ color, name, value: valueProp } = {}, index) => {\n let value: string\n\n if (isArray(valueProp)) {\n value = valueProp\n .map((value) => {\n return `${valueFormatter?.(value) ?? value}`\n })\n .join(\" - \")\n } else {\n value = valueFormatter?.(valueProp) ?? valueProp\n }\n\n return (\n <ui.div\n className=\"ui-chart__tooltip-item\"\n key={`tooltip-payload-${index}`}\n __css={styles.tooltipItem}\n >\n <ui.div\n className=\"ui-chart__tooltip-swatch\"\n background={color}\n __css={styles.tooltipSwatch}\n />\n\n <ui.span\n className=\"ui-chart__tooltip-label\"\n __css={styles.tooltipLabel}\n >\n {name}\n </ui.span>\n\n <ui.span\n className=\"ui-chart__tooltip-value\"\n __css={styles.tooltipValue}\n >\n {value}\n {unit ? unit : \"\"}\n </ui.span>\n </ui.div>\n )\n },\n )\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-chart__tooltip\", className)}\n __css={styles.tooltip}\n {...rest}\n >\n <ui.p className=\"ui-chart__tooltip-title\" __css={styles.tooltipTitle}>\n {label}\n </ui.p>\n\n <ui.div className=\"ui-chart__tooltip-list\" __css={styles.tooltipList}>\n {items}\n </ui.div>\n </ui.div>\n )\n },\n)\n"],"mappings":";;;;;;AAAA,SAAS,YAAY,UAAU;AAC/B,SAAS,IAAI,eAA0B;AAkC3B,cAaA,YAbA;AAxBL,IAAM,eAAe;AAAA,EAC1B,CAAC,EAAE,OAAO,WAAW,UAAU,CAAC,GAAG,gBAAgB,MAAM,GAAG,KAAK,GAAG,QAAQ;AAC1E,UAAM,EAAE,OAAO,IAAI,WAAW;AAE9B,UAAM,QAAQ,QAAQ;AAAA,MACpB,CAAC,EAAE,OAAO,MAAM,OAAO,UAAU,IAAI,CAAC,GAAG,UAAU;AAhBzD;AAiBQ,YAAI;AAEJ,YAAI,QAAQ,SAAS,GAAG;AACtB,kBAAQ,UACL,IAAI,CAACA,WAAU;AArB5B,gBAAAC;AAsBc,mBAAO,IAAGA,MAAA,iDAAiBD,YAAjB,OAAAC,MAA2BD,MAAK;AAAA,UAC5C,CAAC,EACA,KAAK,KAAK;AAAA,QACf,OAAO;AACL,mBAAQ,sDAAiB,eAAjB,YAA+B;AAAA,QACzC;AAEA,eACE;AAAA,UAAC,GAAG;AAAA,UAAH;AAAA,YACC,WAAU;AAAA,YAEV,OAAO,OAAO;AAAA,YAEd;AAAA;AAAA,gBAAC,GAAG;AAAA,gBAAH;AAAA,kBACC,WAAU;AAAA,kBACV,YAAY;AAAA,kBACZ,OAAO,OAAO;AAAA;AAAA,cAChB;AAAA,cAEA;AAAA,gBAAC,GAAG;AAAA,gBAAH;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO,OAAO;AAAA,kBAEb;AAAA;AAAA,cACH;AAAA,cAEA;AAAA,gBAAC,GAAG;AAAA,gBAAH;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO,OAAO;AAAA,kBAEb;AAAA;AAAA,oBACA,OAAO,OAAO;AAAA;AAAA;AAAA,cACjB;AAAA;AAAA;AAAA,UAtBK,mBAAmB,KAAK;AAAA,QAuB/B;AAAA,MAEJ;AAAA,IACF;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO,OAAO;AAAA,QACb,GAAG;AAAA,QAEJ;AAAA,8BAAC,GAAG,GAAH,EAAK,WAAU,2BAA0B,OAAO,OAAO,cACrD,iBACH;AAAA,UAEA,oBAAC,GAAG,KAAH,EAAO,WAAU,0BAAyB,OAAO,OAAO,aACtD,iBACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;","names":["value","_a"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import {
|
|
3
|
+
gridProperties
|
|
4
|
+
} from "./chunk-5QCKM3B3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
getComponentProps
|
|
7
|
+
} from "./chunk-QL3DB7OJ.mjs";
|
|
8
|
+
|
|
9
|
+
// src/use-chart-grid.ts
|
|
10
|
+
import { useTheme } from "@yamada-ui/core";
|
|
11
|
+
import { cx } from "@yamada-ui/utils";
|
|
12
|
+
import { useCallback } from "react";
|
|
13
|
+
var useChartGrid = ({
|
|
14
|
+
gridProps = {},
|
|
15
|
+
gridAxis = "x",
|
|
16
|
+
strokeDasharray = "5 5",
|
|
17
|
+
styles
|
|
18
|
+
}) => {
|
|
19
|
+
const { theme } = useTheme();
|
|
20
|
+
const [reChartsProps, propClassName] = getComponentProps(
|
|
21
|
+
[gridProps, gridProperties],
|
|
22
|
+
styles.grid
|
|
23
|
+
)(theme);
|
|
24
|
+
const getGridProps = useCallback(
|
|
25
|
+
({ className, ...props } = {}, ref = null) => ({
|
|
26
|
+
ref,
|
|
27
|
+
className: cx("ui-chart__grid", className, propClassName),
|
|
28
|
+
strokeDasharray,
|
|
29
|
+
vertical: gridAxis === "y" || gridAxis === "xy",
|
|
30
|
+
horizontal: gridAxis === "x" || gridAxis === "xy",
|
|
31
|
+
...props,
|
|
32
|
+
...reChartsProps
|
|
33
|
+
}),
|
|
34
|
+
[propClassName, strokeDasharray, gridAxis, reChartsProps]
|
|
35
|
+
);
|
|
36
|
+
return { getGridProps };
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
useChartGrid
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=chunk-3CY3IFRN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/use-chart-grid.ts"],"sourcesContent":["import type { CSSUIObject } from \"@yamada-ui/core\"\nimport { useTheme } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport type { CartesianGridProps } from \"recharts\"\nimport { getComponentProps } from \"./chart-utils\"\nimport type { ChartAxisType, ChartPropGetter, GridProps } from \"./chart.types\"\nimport { gridProperties } from \"./rechart-properties\"\n\nexport type UseChartGridOptions = {\n /**\n * Props passed down to recharts 'CartesianGrid' component.\n */\n gridProps?: GridProps\n /**\n * Specifies which lines should be displayed in the grid.\n *\n * @default 'x'\n */\n gridAxis?: ChartAxisType\n /**\n * Dash array for the grid lines and cursor. The first number is the length of the solid line section and the second number is the length of the interval.\n *\n * @default '5 5'\n */\n strokeDasharray?: string | number\n}\n\ntype UseChartGridProps = UseChartGridOptions & {\n styles: Dict<CSSUIObject>\n}\n\nexport const useChartGrid = ({\n gridProps = {},\n gridAxis = \"x\",\n strokeDasharray = \"5 5\",\n styles,\n}: UseChartGridProps) => {\n const { theme } = useTheme()\n const [reChartsProps, propClassName] = getComponentProps(\n [gridProps, gridProperties],\n styles.grid,\n )(theme)\n\n const getGridProps: ChartPropGetter<\n \"div\",\n Partial<CartesianGridProps>,\n CartesianGridProps\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(\"ui-chart__grid\", className, propClassName),\n strokeDasharray: strokeDasharray,\n vertical: gridAxis === \"y\" || gridAxis === \"xy\",\n horizontal: gridAxis === \"x\" || gridAxis === \"xy\",\n ...props,\n ...reChartsProps,\n }),\n [propClassName, strokeDasharray, gridAxis, reChartsProps],\n )\n\n return { getGridProps }\n}\n"],"mappings":";;;;;;;;;AACA,SAAS,gBAAgB;AAEzB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AA6BrB,IAAM,eAAe,CAAC;AAAA,EAC3B,YAAY,CAAC;AAAA,EACb,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB;AACF,MAAyB;AACvB,QAAM,EAAE,MAAM,IAAI,SAAS;AAC3B,QAAM,CAAC,eAAe,aAAa,IAAI;AAAA,IACrC,CAAC,WAAW,cAAc;AAAA,IAC1B,OAAO;AAAA,EACT,EAAE,KAAK;AAEP,QAAM,eAIF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU;AAAA,MAC7C;AAAA,MACA,WAAW,GAAG,kBAAkB,WAAW,aAAa;AAAA,MACxD;AAAA,MACA,UAAU,aAAa,OAAO,aAAa;AAAA,MAC3C,YAAY,aAAa,OAAO,aAAa;AAAA,MAC7C,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,eAAe,iBAAiB,UAAU,aAAa;AAAA,EAC1D;AAEA,SAAO,EAAE,aAAa;AACxB;","names":[]}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
import {
|
|
3
|
+
dotProperties,
|
|
4
|
+
polarAngleAxisProperties,
|
|
5
|
+
polarGridProperties,
|
|
6
|
+
polarRadiusAxisProperties,
|
|
7
|
+
radarChartProperties,
|
|
8
|
+
radarProperties
|
|
9
|
+
} from "./chunk-5QCKM3B3.mjs";
|
|
10
|
+
import {
|
|
11
|
+
getComponentProps
|
|
12
|
+
} from "./chunk-QL3DB7OJ.mjs";
|
|
13
|
+
|
|
14
|
+
// src/use-radar-chart.ts
|
|
15
|
+
import { useTheme } from "@yamada-ui/core";
|
|
16
|
+
import { cx, splitObject } from "@yamada-ui/utils";
|
|
17
|
+
import { useCallback, useMemo, useState } from "react";
|
|
18
|
+
var useRadarChart = ({
|
|
19
|
+
data,
|
|
20
|
+
series,
|
|
21
|
+
dataKey,
|
|
22
|
+
withDots = false,
|
|
23
|
+
withActiveDots = false,
|
|
24
|
+
strokeWidth = 2,
|
|
25
|
+
fillOpacity = 0.4,
|
|
26
|
+
valueFormatter,
|
|
27
|
+
styles,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
var _a;
|
|
31
|
+
const { theme } = useTheme();
|
|
32
|
+
const [highlightedArea, setHighlightedArea] = useState(null);
|
|
33
|
+
const shouldHighlight = highlightedArea !== null;
|
|
34
|
+
const {
|
|
35
|
+
dot = {},
|
|
36
|
+
activeDot = {},
|
|
37
|
+
dimDot,
|
|
38
|
+
dimRadar,
|
|
39
|
+
...computedRadarProps
|
|
40
|
+
} = (_a = rest.radarProps) != null ? _a : {};
|
|
41
|
+
const radarColors = useMemo(
|
|
42
|
+
() => series.map(({ color }, index) => ({
|
|
43
|
+
__prefix: "ui",
|
|
44
|
+
name: `radar-${index}`,
|
|
45
|
+
token: "colors",
|
|
46
|
+
value: color != null ? color : "transparent"
|
|
47
|
+
})),
|
|
48
|
+
[series]
|
|
49
|
+
);
|
|
50
|
+
const radarVars = useMemo(
|
|
51
|
+
() => [
|
|
52
|
+
...radarColors,
|
|
53
|
+
{ __prefix: "ui", name: "fill-opacity", value: fillOpacity }
|
|
54
|
+
],
|
|
55
|
+
[fillOpacity, radarColors]
|
|
56
|
+
);
|
|
57
|
+
const [polarAngleAxisProps, polarAngleAxisStyles] = useMemo(
|
|
58
|
+
() => {
|
|
59
|
+
var _a2;
|
|
60
|
+
return splitObject(
|
|
61
|
+
(_a2 = rest.polarAngleAxisProps) != null ? _a2 : {},
|
|
62
|
+
polarAngleAxisProperties
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
[rest.polarAngleAxisProps]
|
|
66
|
+
);
|
|
67
|
+
const [polarRadiusAxisProps, polarRadiusAxisStyles] = useMemo(
|
|
68
|
+
() => {
|
|
69
|
+
var _a2;
|
|
70
|
+
return splitObject(
|
|
71
|
+
(_a2 = rest.polarRadiusAxisProps) != null ? _a2 : {},
|
|
72
|
+
polarRadiusAxisProperties
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
[rest.polarRadiusAxisProps]
|
|
76
|
+
);
|
|
77
|
+
const [radarChartProps, radarChartClassName] = useMemo(() => {
|
|
78
|
+
const resolvedRadarChartProps = {
|
|
79
|
+
"& .recharts-polar-grid-concentric-polygon": { ...styles.polarGrid },
|
|
80
|
+
"& .recharts-polar-grid-concentric-circle": { ...styles.polarGrid },
|
|
81
|
+
"& .recharts-polar-angle-axis": {
|
|
82
|
+
...styles.polarAngleAxis,
|
|
83
|
+
...polarAngleAxisStyles
|
|
84
|
+
},
|
|
85
|
+
"& .recharts-polar-angle-axis-tick": { ...styles.polarAngleAxisTick },
|
|
86
|
+
"& .recharts-polar-radius-axis": {
|
|
87
|
+
...styles.polarRadiusAxis,
|
|
88
|
+
...polarRadiusAxisStyles
|
|
89
|
+
},
|
|
90
|
+
"& .recharts-polar-radius-axis-tick": { ...styles.polarRadiusAxisTick },
|
|
91
|
+
...rest.radarChartProps
|
|
92
|
+
};
|
|
93
|
+
return getComponentProps(
|
|
94
|
+
[resolvedRadarChartProps, radarChartProperties],
|
|
95
|
+
styles.chart
|
|
96
|
+
)(theme);
|
|
97
|
+
}, [
|
|
98
|
+
polarAngleAxisStyles,
|
|
99
|
+
polarRadiusAxisStyles,
|
|
100
|
+
rest.radarChartProps,
|
|
101
|
+
styles.chart,
|
|
102
|
+
styles.polarAngleAxis,
|
|
103
|
+
styles.polarAngleAxisTick,
|
|
104
|
+
styles.polarGrid,
|
|
105
|
+
styles.polarRadiusAxis,
|
|
106
|
+
styles.polarRadiusAxisTick,
|
|
107
|
+
theme
|
|
108
|
+
]);
|
|
109
|
+
const [polarGridProps, polarGridClassName] = useMemo(
|
|
110
|
+
() => {
|
|
111
|
+
var _a2;
|
|
112
|
+
return getComponentProps(
|
|
113
|
+
[(_a2 = rest.polarGridProps) != null ? _a2 : {}, polarGridProperties],
|
|
114
|
+
styles.polarGrid
|
|
115
|
+
)(theme);
|
|
116
|
+
},
|
|
117
|
+
[rest.polarGridProps, styles.polarGrid, theme]
|
|
118
|
+
);
|
|
119
|
+
const [radarProps, radarClassName] = useMemo(() => {
|
|
120
|
+
const resolvedRadarProps = {
|
|
121
|
+
fillOpacity: "var(--ui-fill-opacity)",
|
|
122
|
+
...computedRadarProps
|
|
123
|
+
};
|
|
124
|
+
return getComponentProps(
|
|
125
|
+
[resolvedRadarProps, radarProperties],
|
|
126
|
+
styles.radar
|
|
127
|
+
)(theme);
|
|
128
|
+
}, [computedRadarProps, styles.radar, theme]);
|
|
129
|
+
const [dimRadarProps, dimRadarClassName] = useMemo(() => {
|
|
130
|
+
const resolvedDimRadar = {
|
|
131
|
+
fillOpacity: 0.3,
|
|
132
|
+
strokeOpacity: 0.3,
|
|
133
|
+
...dimRadar
|
|
134
|
+
};
|
|
135
|
+
return getComponentProps([resolvedDimRadar, radarProperties])(
|
|
136
|
+
theme
|
|
137
|
+
);
|
|
138
|
+
}, [dimRadar, theme]);
|
|
139
|
+
const [dotProps, dotClassName] = useMemo(() => {
|
|
140
|
+
const resolvedDot = { fillOpacity: 1, strokeWidth: 2, ...dot };
|
|
141
|
+
return getComponentProps(
|
|
142
|
+
[resolvedDot, dotProperties],
|
|
143
|
+
styles.dot
|
|
144
|
+
)(theme);
|
|
145
|
+
}, [dot, styles.dot, theme]);
|
|
146
|
+
const [activeDotProps, activeDotClassName] = useMemo(
|
|
147
|
+
() => getComponentProps(
|
|
148
|
+
[activeDot, dotProperties],
|
|
149
|
+
styles.activeDot
|
|
150
|
+
)(theme),
|
|
151
|
+
[activeDot, styles.activeDot, theme]
|
|
152
|
+
);
|
|
153
|
+
const [dimDotProps, dimDotClassName] = useMemo(() => {
|
|
154
|
+
const resolvedDimDot = { fillOpacity: 0, strokeOpacity: 0, ...dimDot };
|
|
155
|
+
return getComponentProps([resolvedDimDot, dotProperties])(
|
|
156
|
+
theme
|
|
157
|
+
);
|
|
158
|
+
}, [dimDot, theme]);
|
|
159
|
+
const radarPropList = useMemo(
|
|
160
|
+
() => series.map((props, index) => {
|
|
161
|
+
const {
|
|
162
|
+
dataKey: dataKey2,
|
|
163
|
+
dot: dot2 = {},
|
|
164
|
+
activeDot: activeDot2 = {},
|
|
165
|
+
dimDot: dimDot2 = {},
|
|
166
|
+
dimRadar: dimRadar2 = {},
|
|
167
|
+
...computedProps
|
|
168
|
+
} = props;
|
|
169
|
+
const color = `var(--ui-radar-${index})`;
|
|
170
|
+
const dimmed = shouldHighlight && highlightedArea !== dataKey2;
|
|
171
|
+
const computedDimRadar = { ...dimRadarProps, ...dimRadar2 };
|
|
172
|
+
const resolvedProps = {
|
|
173
|
+
...radarProps,
|
|
174
|
+
...computedProps,
|
|
175
|
+
...dimmed ? computedDimRadar : {}
|
|
176
|
+
};
|
|
177
|
+
const rest2 = getComponentProps(
|
|
178
|
+
[resolvedProps, radarProperties],
|
|
179
|
+
radarClassName,
|
|
180
|
+
dimmed ? dimRadarClassName : void 0
|
|
181
|
+
)(theme, true);
|
|
182
|
+
let resolvedActiveDot;
|
|
183
|
+
if (withActiveDots) {
|
|
184
|
+
const computedActiveDot = {
|
|
185
|
+
...activeDotProps,
|
|
186
|
+
...activeDot2
|
|
187
|
+
};
|
|
188
|
+
const [rest3, className] = getComponentProps(
|
|
189
|
+
[computedActiveDot, dotProperties],
|
|
190
|
+
activeDotClassName
|
|
191
|
+
)(theme);
|
|
192
|
+
resolvedActiveDot = {
|
|
193
|
+
className: cx("ui-radar-chart__active-dot", className),
|
|
194
|
+
fill: color,
|
|
195
|
+
stroke: color,
|
|
196
|
+
r: 4,
|
|
197
|
+
...rest3
|
|
198
|
+
};
|
|
199
|
+
} else {
|
|
200
|
+
resolvedActiveDot = false;
|
|
201
|
+
}
|
|
202
|
+
let resolvedDot;
|
|
203
|
+
if (withDots) {
|
|
204
|
+
const computedDimDot = { ...dimDotProps, ...dimDot2 };
|
|
205
|
+
const computedDot = {
|
|
206
|
+
...dotProps,
|
|
207
|
+
...dot2,
|
|
208
|
+
...dimmed ? computedDimDot : {}
|
|
209
|
+
};
|
|
210
|
+
const [rest3, className] = getComponentProps(
|
|
211
|
+
[computedDot, dotProperties],
|
|
212
|
+
dotClassName,
|
|
213
|
+
dimmed ? dimDotClassName : void 0
|
|
214
|
+
)(theme);
|
|
215
|
+
resolvedDot = {
|
|
216
|
+
// BUG: className is not applied.
|
|
217
|
+
className: cx("ui-radar-chart__dot", className),
|
|
218
|
+
fill: color,
|
|
219
|
+
r: 4,
|
|
220
|
+
...rest3
|
|
221
|
+
};
|
|
222
|
+
} else {
|
|
223
|
+
resolvedDot = false;
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
...rest2,
|
|
227
|
+
color,
|
|
228
|
+
dataKey: dataKey2,
|
|
229
|
+
dot: resolvedDot,
|
|
230
|
+
activeDot: resolvedActiveDot
|
|
231
|
+
};
|
|
232
|
+
}),
|
|
233
|
+
[
|
|
234
|
+
activeDotClassName,
|
|
235
|
+
activeDotProps,
|
|
236
|
+
dimDotClassName,
|
|
237
|
+
dimDotProps,
|
|
238
|
+
dimRadarClassName,
|
|
239
|
+
dimRadarProps,
|
|
240
|
+
dotClassName,
|
|
241
|
+
dotProps,
|
|
242
|
+
highlightedArea,
|
|
243
|
+
radarClassName,
|
|
244
|
+
radarProps,
|
|
245
|
+
series,
|
|
246
|
+
shouldHighlight,
|
|
247
|
+
theme,
|
|
248
|
+
withActiveDots,
|
|
249
|
+
withDots
|
|
250
|
+
]
|
|
251
|
+
);
|
|
252
|
+
const getRadarChartProps = useCallback(
|
|
253
|
+
({ className, ...props } = {}, ref = null) => ({
|
|
254
|
+
ref,
|
|
255
|
+
className: cx(className, radarChartClassName),
|
|
256
|
+
data,
|
|
257
|
+
...props,
|
|
258
|
+
...radarChartProps
|
|
259
|
+
}),
|
|
260
|
+
[data, radarChartClassName, radarChartProps]
|
|
261
|
+
);
|
|
262
|
+
const getRadarProps = useCallback(
|
|
263
|
+
({ index, className: classNameProp, ...props }, ref = null) => {
|
|
264
|
+
const { color, className, dataKey: dataKey2, activeDot: activeDot2, dot: dot2, ...rest2 } = radarPropList[index];
|
|
265
|
+
return {
|
|
266
|
+
ref,
|
|
267
|
+
className: cx(classNameProp, className),
|
|
268
|
+
activeDot: activeDot2,
|
|
269
|
+
dot: dot2,
|
|
270
|
+
name: dataKey2,
|
|
271
|
+
dataKey: dataKey2,
|
|
272
|
+
fill: color,
|
|
273
|
+
strokeWidth,
|
|
274
|
+
stroke: color,
|
|
275
|
+
isAnimationActive: false,
|
|
276
|
+
...props,
|
|
277
|
+
...rest2
|
|
278
|
+
};
|
|
279
|
+
},
|
|
280
|
+
[radarPropList, strokeWidth]
|
|
281
|
+
);
|
|
282
|
+
const getPolarGridProps = useCallback(
|
|
283
|
+
({ className, ...props } = {}, ref = null) => ({
|
|
284
|
+
ref,
|
|
285
|
+
// BUG: `.recharts-polar-grid-concentric-xxx` is not applied className.
|
|
286
|
+
className: cx(className, polarGridClassName),
|
|
287
|
+
...props,
|
|
288
|
+
...polarGridProps
|
|
289
|
+
}),
|
|
290
|
+
[polarGridClassName, polarGridProps]
|
|
291
|
+
);
|
|
292
|
+
const getPolarAngleAxisProps = useCallback(
|
|
293
|
+
({ className, ...props } = {}, ref = null) => ({
|
|
294
|
+
ref,
|
|
295
|
+
// BUG: className is not applied.
|
|
296
|
+
// className: cx(className, polarAngleAxisClassName),
|
|
297
|
+
className,
|
|
298
|
+
dataKey,
|
|
299
|
+
tickFormatter: valueFormatter,
|
|
300
|
+
tickSize: 16,
|
|
301
|
+
...props,
|
|
302
|
+
...polarAngleAxisProps
|
|
303
|
+
}),
|
|
304
|
+
[
|
|
305
|
+
dataKey,
|
|
306
|
+
// polarAngleAxisClassName,
|
|
307
|
+
polarAngleAxisProps,
|
|
308
|
+
valueFormatter
|
|
309
|
+
]
|
|
310
|
+
);
|
|
311
|
+
const getPolarRadiusAxisProps = useCallback(
|
|
312
|
+
({ className, ...props } = {}, ref = null) => ({
|
|
313
|
+
ref,
|
|
314
|
+
// BUG: className is not applied.
|
|
315
|
+
// className: cx(className, polarRadiusAxisClassName),
|
|
316
|
+
className,
|
|
317
|
+
tickFormatter: valueFormatter,
|
|
318
|
+
...props,
|
|
319
|
+
...polarRadiusAxisProps
|
|
320
|
+
}),
|
|
321
|
+
[
|
|
322
|
+
// polarRadiusAxisClassName,
|
|
323
|
+
polarRadiusAxisProps,
|
|
324
|
+
valueFormatter
|
|
325
|
+
]
|
|
326
|
+
);
|
|
327
|
+
return {
|
|
328
|
+
radarVars,
|
|
329
|
+
getRadarChartProps,
|
|
330
|
+
getRadarProps,
|
|
331
|
+
getPolarGridProps,
|
|
332
|
+
getPolarAngleAxisProps,
|
|
333
|
+
getPolarRadiusAxisProps,
|
|
334
|
+
setHighlightedArea
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
export {
|
|
339
|
+
useRadarChart
|
|
340
|
+
};
|
|
341
|
+
//# sourceMappingURL=chunk-3IBGJT6F.mjs.map
|