@mantine/charts 9.4.2 → 9.5.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/cjs/AreaChart/AreaChart.cjs +12 -3
- package/cjs/AreaChart/AreaChart.cjs.map +1 -1
- package/cjs/BarChart/BarChart.cjs +12 -3
- package/cjs/BarChart/BarChart.cjs.map +1 -1
- package/cjs/BubbleChart/BubbleChart.cjs +70 -66
- package/cjs/BubbleChart/BubbleChart.cjs.map +1 -1
- package/cjs/BulletChart/BulletChart.cjs +137 -0
- package/cjs/BulletChart/BulletChart.cjs.map +1 -0
- package/cjs/BulletChart/BulletChart.module.cjs +18 -0
- package/cjs/BulletChart/BulletChart.module.cjs.map +1 -0
- package/cjs/ChartBrush/ChartBrush.cjs +35 -0
- package/cjs/ChartBrush/ChartBrush.cjs.map +1 -0
- package/cjs/ChartBrush/ChartBrush.module.cjs +7 -0
- package/cjs/ChartBrush/ChartBrush.module.cjs.map +1 -0
- package/cjs/CompositeChart/CompositeChart.cjs +12 -3
- package/cjs/CompositeChart/CompositeChart.cjs.map +1 -1
- package/cjs/DonutChart/DonutChart.cjs +5 -3
- package/cjs/DonutChart/DonutChart.cjs.map +1 -1
- package/cjs/DonutChart/DonutChart.module.cjs.map +1 -1
- package/cjs/FunnelChart/FunnelChart.cjs +5 -3
- package/cjs/FunnelChart/FunnelChart.cjs.map +1 -1
- package/cjs/FunnelChart/FunnelChart.module.cjs.map +1 -1
- package/cjs/Heatmap/Heatmap.cjs +12 -5
- package/cjs/Heatmap/Heatmap.cjs.map +1 -1
- package/cjs/LineChart/LineChart.cjs +12 -3
- package/cjs/LineChart/LineChart.cjs.map +1 -1
- package/cjs/PieChart/PieChart.cjs +5 -3
- package/cjs/PieChart/PieChart.cjs.map +1 -1
- package/cjs/PieChart/PieChart.module.cjs.map +1 -1
- package/cjs/RadarChart/RadarChart.cjs +5 -3
- package/cjs/RadarChart/RadarChart.cjs.map +1 -1
- package/cjs/RadarChart/RadarChart.module.cjs.map +1 -1
- package/cjs/RadialBarChart/RadialBarChart.cjs +5 -3
- package/cjs/RadialBarChart/RadialBarChart.cjs.map +1 -1
- package/cjs/RadialBarChart/RadialBarChart.module.cjs.map +1 -1
- package/cjs/SankeyChart/SankeyChart.cjs +1 -1
- package/cjs/ScatterChart/ScatterChart.cjs +5 -3
- package/cjs/ScatterChart/ScatterChart.cjs.map +1 -1
- package/cjs/Sparkline/Sparkline.cjs +1 -1
- package/cjs/SunburstChart/SunburstChart.cjs +129 -0
- package/cjs/SunburstChart/SunburstChart.cjs.map +1 -0
- package/cjs/SunburstChart/SunburstChart.module.cjs +7 -0
- package/cjs/SunburstChart/SunburstChart.module.cjs.map +1 -0
- package/cjs/Treemap/Treemap.cjs +1 -1
- package/cjs/grid-chart.module.cjs.map +1 -1
- package/cjs/index.cjs +6 -0
- package/esm/AreaChart/AreaChart.mjs +12 -3
- package/esm/AreaChart/AreaChart.mjs.map +1 -1
- package/esm/BarChart/BarChart.mjs +12 -3
- package/esm/BarChart/BarChart.mjs.map +1 -1
- package/esm/BubbleChart/BubbleChart.mjs +70 -66
- package/esm/BubbleChart/BubbleChart.mjs.map +1 -1
- package/esm/BulletChart/BulletChart.mjs +137 -0
- package/esm/BulletChart/BulletChart.mjs.map +1 -0
- package/esm/BulletChart/BulletChart.module.mjs +18 -0
- package/esm/BulletChart/BulletChart.module.mjs.map +1 -0
- package/esm/ChartBrush/ChartBrush.mjs +35 -0
- package/esm/ChartBrush/ChartBrush.mjs.map +1 -0
- package/esm/ChartBrush/ChartBrush.module.mjs +7 -0
- package/esm/ChartBrush/ChartBrush.module.mjs.map +1 -0
- package/esm/CompositeChart/CompositeChart.mjs +12 -3
- package/esm/CompositeChart/CompositeChart.mjs.map +1 -1
- package/esm/DonutChart/DonutChart.mjs +5 -3
- package/esm/DonutChart/DonutChart.mjs.map +1 -1
- package/esm/DonutChart/DonutChart.module.mjs.map +1 -1
- package/esm/FunnelChart/FunnelChart.mjs +5 -3
- package/esm/FunnelChart/FunnelChart.mjs.map +1 -1
- package/esm/FunnelChart/FunnelChart.module.mjs.map +1 -1
- package/esm/Heatmap/Heatmap.mjs +12 -5
- package/esm/Heatmap/Heatmap.mjs.map +1 -1
- package/esm/LineChart/LineChart.mjs +12 -3
- package/esm/LineChart/LineChart.mjs.map +1 -1
- package/esm/PieChart/PieChart.mjs +5 -3
- package/esm/PieChart/PieChart.mjs.map +1 -1
- package/esm/PieChart/PieChart.module.mjs.map +1 -1
- package/esm/RadarChart/RadarChart.mjs +5 -3
- package/esm/RadarChart/RadarChart.mjs.map +1 -1
- package/esm/RadarChart/RadarChart.module.mjs.map +1 -1
- package/esm/RadialBarChart/RadialBarChart.mjs +5 -3
- package/esm/RadialBarChart/RadialBarChart.mjs.map +1 -1
- package/esm/RadialBarChart/RadialBarChart.module.mjs.map +1 -1
- package/esm/SankeyChart/SankeyChart.mjs +1 -1
- package/esm/ScatterChart/ScatterChart.mjs +5 -3
- package/esm/ScatterChart/ScatterChart.mjs.map +1 -1
- package/esm/Sparkline/Sparkline.mjs +1 -1
- package/esm/SunburstChart/SunburstChart.mjs +129 -0
- package/esm/SunburstChart/SunburstChart.mjs.map +1 -0
- package/esm/SunburstChart/SunburstChart.module.mjs +7 -0
- package/esm/SunburstChart/SunburstChart.module.mjs.map +1 -0
- package/esm/Treemap/Treemap.mjs +1 -1
- package/esm/grid-chart.module.mjs.map +1 -1
- package/esm/index.mjs +4 -1
- package/lib/BubbleChart/BubbleChart.d.ts +2 -0
- package/lib/BulletChart/BulletChart.d.ts +58 -0
- package/lib/BulletChart/index.d.ts +9 -0
- package/lib/ChartBrush/ChartBrush.d.ts +15 -0
- package/lib/ChartBrush/index.d.ts +2 -0
- package/lib/DonutChart/DonutChart.d.ts +2 -0
- package/lib/FunnelChart/FunnelChart.d.ts +2 -0
- package/lib/Heatmap/Heatmap.d.ts +2 -0
- package/lib/PieChart/PieChart.d.ts +2 -0
- package/lib/RadarChart/RadarChart.d.ts +2 -0
- package/lib/RadialBarChart/RadialBarChart.d.ts +2 -0
- package/lib/ScatterChart/ScatterChart.d.ts +2 -2
- package/lib/SunburstChart/SunburstChart.d.ts +58 -0
- package/lib/SunburstChart/index.d.ts +10 -0
- package/lib/index.d.mts +3 -0
- package/lib/index.d.ts +3 -0
- package/lib/types.d.ts +8 -2
- package/package.json +3 -3
- package/styles.css +218 -2
- package/styles.layer.css +218 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_BulletChart_module = require("./BulletChart.module.cjs");
|
|
3
|
+
let _mantine_core = require("@mantine/core");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
//#region packages/@mantine/charts/src/BulletChart/BulletChart.tsx
|
|
6
|
+
const defaultProps = {
|
|
7
|
+
orientation: "horizontal",
|
|
8
|
+
size: 32,
|
|
9
|
+
barSize: 16,
|
|
10
|
+
targetRatio: .7,
|
|
11
|
+
targetSize: 2,
|
|
12
|
+
withTooltip: false
|
|
13
|
+
};
|
|
14
|
+
const varsResolver = (0, _mantine_core.createVarsResolver)((_theme, { size, barSize }) => ({ root: {
|
|
15
|
+
"--bullet-size": (0, _mantine_core.rem)(size),
|
|
16
|
+
"--bullet-bar-size": (0, _mantine_core.rem)(barSize)
|
|
17
|
+
} }));
|
|
18
|
+
const BulletChart = (0, _mantine_core.factory)((_props) => {
|
|
19
|
+
const props = (0, _mantine_core.useProps)("BulletChart", defaultProps, _props);
|
|
20
|
+
const { classNames, className, style, styles, unstyled, vars, attributes, value, target, ranges, orientation, label, valueFormatter, barColor, targetColor, size, barSize, targetRatio, targetSize, withTooltip, getTooltipLabel, variant, ...others } = props;
|
|
21
|
+
const theme = (0, _mantine_core.useMantineTheme)();
|
|
22
|
+
const getStyles = (0, _mantine_core.useStyles)({
|
|
23
|
+
name: "BulletChart",
|
|
24
|
+
classes: require_BulletChart_module.default,
|
|
25
|
+
props,
|
|
26
|
+
className,
|
|
27
|
+
style,
|
|
28
|
+
classNames,
|
|
29
|
+
styles,
|
|
30
|
+
unstyled,
|
|
31
|
+
attributes,
|
|
32
|
+
vars,
|
|
33
|
+
varsResolver
|
|
34
|
+
});
|
|
35
|
+
const isVertical = orientation === "vertical";
|
|
36
|
+
const maxRange = Math.max(...ranges.map((r) => r.value), 0);
|
|
37
|
+
const formatValue = (v) => valueFormatter ? valueFormatter(v) : v.toString();
|
|
38
|
+
const toPercentage = (v) => maxRange > 0 ? Math.max(0, Math.min(v / maxRange * 100, 100)) : 0;
|
|
39
|
+
const resolvedBarColor = barColor ? (0, _mantine_core.getThemeColor)(barColor, theme) : "var(--mantine-color-white)";
|
|
40
|
+
const resolvedTargetColor = targetColor ? (0, _mantine_core.getThemeColor)(targetColor, theme) : void 0;
|
|
41
|
+
const sortedRanges = [...ranges].sort((a, b) => b.value - a.value);
|
|
42
|
+
const rangeBands = sortedRanges.map((range, index) => {
|
|
43
|
+
const percentage = toPercentage(range.value);
|
|
44
|
+
const sizeStyle = isVertical ? {
|
|
45
|
+
height: `${percentage}%`,
|
|
46
|
+
bottom: 0
|
|
47
|
+
} : { width: `${percentage}%` };
|
|
48
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...getStyles("range", { style: {
|
|
49
|
+
...sizeStyle,
|
|
50
|
+
backgroundColor: (0, _mantine_core.getThemeColor)(range.color, theme)
|
|
51
|
+
} }) }, index);
|
|
52
|
+
});
|
|
53
|
+
const rangeLabels = sortedRanges.map((range, index) => {
|
|
54
|
+
const percentage = toPercentage(range.value);
|
|
55
|
+
const positionStyle = isVertical ? { bottom: `${percentage}%` } : { left: `${percentage}%` };
|
|
56
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
57
|
+
...getStyles("rangeLabel", { style: positionStyle }),
|
|
58
|
+
children: formatValue(range.value)
|
|
59
|
+
}, index);
|
|
60
|
+
});
|
|
61
|
+
const barPercentage = toPercentage(value);
|
|
62
|
+
const barElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...getStyles("bar", { style: {
|
|
63
|
+
...isVertical ? {
|
|
64
|
+
height: `${barPercentage}%`,
|
|
65
|
+
bottom: 0
|
|
66
|
+
} : { width: `${barPercentage}%` },
|
|
67
|
+
backgroundColor: resolvedBarColor
|
|
68
|
+
} }) });
|
|
69
|
+
const barLabelElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
70
|
+
...getStyles("barLabel", { style: isVertical ? { bottom: `${barPercentage}%` } : { left: `${barPercentage}%` } }),
|
|
71
|
+
children: formatValue(value)
|
|
72
|
+
});
|
|
73
|
+
const targetPercentage = target != null ? toPercentage(target) : 0;
|
|
74
|
+
const targetElement = target != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { ...getStyles("target", { style: isVertical ? {
|
|
75
|
+
bottom: `${targetPercentage}%`,
|
|
76
|
+
width: `${targetRatio * 100}%`,
|
|
77
|
+
height: (0, _mantine_core.rem)(targetSize),
|
|
78
|
+
backgroundColor: resolvedTargetColor
|
|
79
|
+
} : {
|
|
80
|
+
left: `${targetPercentage}%`,
|
|
81
|
+
height: `${targetRatio * 100}%`,
|
|
82
|
+
width: (0, _mantine_core.rem)(targetSize),
|
|
83
|
+
backgroundColor: resolvedTargetColor
|
|
84
|
+
} }) }) : null;
|
|
85
|
+
const targetLabelElement = target != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
86
|
+
...getStyles("targetLabel", { style: isVertical ? { bottom: `${targetPercentage}%` } : { left: `${targetPercentage}%` } }),
|
|
87
|
+
children: formatValue(target)
|
|
88
|
+
}) : null;
|
|
89
|
+
const getDefaultTooltipLabel = () => {
|
|
90
|
+
const parts = [`Value: ${formatValue(value)}`];
|
|
91
|
+
if (target != null) parts.push(`Target: ${formatValue(target)}`);
|
|
92
|
+
return parts.join(" / ");
|
|
93
|
+
};
|
|
94
|
+
const tooltipLabel = getTooltipLabel ? getTooltipLabel({
|
|
95
|
+
value,
|
|
96
|
+
target
|
|
97
|
+
}) : getDefaultTooltipLabel();
|
|
98
|
+
const trackWrapper = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
99
|
+
...getStyles("trackWrapper"),
|
|
100
|
+
"data-orientation": orientation,
|
|
101
|
+
children: [
|
|
102
|
+
rangeLabels,
|
|
103
|
+
targetLabelElement,
|
|
104
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
105
|
+
...getStyles("track"),
|
|
106
|
+
"data-orientation": orientation,
|
|
107
|
+
children: [
|
|
108
|
+
rangeBands,
|
|
109
|
+
barElement,
|
|
110
|
+
targetElement
|
|
111
|
+
]
|
|
112
|
+
}),
|
|
113
|
+
barLabelElement
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Box, {
|
|
117
|
+
...getStyles("root"),
|
|
118
|
+
variant,
|
|
119
|
+
mod: { orientation },
|
|
120
|
+
...others,
|
|
121
|
+
children: [label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
122
|
+
...getStyles("label"),
|
|
123
|
+
children: label
|
|
124
|
+
}), withTooltip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Tooltip, {
|
|
125
|
+
label: tooltipLabel,
|
|
126
|
+
position: isVertical ? "right" : "top",
|
|
127
|
+
children: trackWrapper
|
|
128
|
+
}) : trackWrapper]
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
BulletChart.displayName = "@mantine/charts/BulletChart";
|
|
132
|
+
BulletChart.classes = require_BulletChart_module.default;
|
|
133
|
+
BulletChart.varsResolver = varsResolver;
|
|
134
|
+
//#endregion
|
|
135
|
+
exports.BulletChart = BulletChart;
|
|
136
|
+
|
|
137
|
+
//# sourceMappingURL=BulletChart.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulletChart.cjs","names":["Box","Tooltip","classes"],"sources":["../../src/BulletChart/BulletChart.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n rem,\n StylesApiProps,\n Tooltip,\n useMantineTheme,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport classes from './BulletChart.module.css';\n\nexport interface BulletChartRange {\n /** Upper bound value for this range */\n value: number;\n\n /** Background color of the range band */\n color: MantineColor;\n\n /** Optional label for the range */\n label?: string;\n}\n\nexport type BulletChartStylesNames =\n | 'root'\n | 'label'\n | 'trackWrapper'\n | 'track'\n | 'range'\n | 'bar'\n | 'target'\n | 'rangeLabel'\n | 'barLabel'\n | 'targetLabel';\n\nexport type BulletChartCssVariables = {\n root: '--bullet-size' | '--bullet-bar-size';\n};\n\nexport interface BulletChartProps\n extends BoxProps, StylesApiProps<BulletChartFactory>, ElementProps<'div'> {\n /** Current actual value */\n value: number;\n\n /** Target value, displayed as a marker line */\n target?: number;\n\n /** Qualitative ranges displayed as background bands */\n ranges: BulletChartRange[];\n\n /** Orientation, @default 'horizontal' */\n orientation?: 'horizontal' | 'vertical';\n\n /** Label displayed next to the chart */\n label?: React.ReactNode;\n\n /** Value formatter for tooltip/display and labels */\n valueFormatter?: (value: number) => string;\n\n /** Color of the actual value bar, @default 'white' */\n barColor?: MantineColor;\n\n /** Color of the target marker, @default 'dark' for light, 'white' for dark */\n targetColor?: MantineColor;\n\n /** Height of the chart track area (ranges), @default 32 */\n size?: number | string;\n\n /** Height of the actual value bar, @default 16 */\n barSize?: number | string;\n\n /** Target marker size relative to chart size, @default 0.7 */\n targetRatio?: number;\n\n /** Target marker thickness, @default 2 */\n targetSize?: number | string;\n\n /** Whether to show tooltip on hover, @default false */\n withTooltip?: boolean;\n\n /** Custom tooltip content */\n getTooltipLabel?: (data: { value: number; target?: number }) => React.ReactNode;\n}\n\nexport type BulletChartFactory = Factory<{\n props: BulletChartProps;\n ref: HTMLDivElement;\n stylesNames: BulletChartStylesNames;\n vars: BulletChartCssVariables;\n}>;\n\nconst defaultProps = {\n orientation: 'horizontal',\n size: 32,\n barSize: 16,\n targetRatio: 0.7,\n targetSize: 2,\n withTooltip: false,\n} satisfies Partial<BulletChartProps>;\n\nconst varsResolver = createVarsResolver<BulletChartFactory>((_theme, { size, barSize }) => ({\n root: {\n '--bullet-size': rem(size),\n '--bullet-bar-size': rem(barSize),\n },\n}));\n\nexport const BulletChart = factory<BulletChartFactory>((_props) => {\n const props = useProps('BulletChart', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n attributes,\n value,\n target,\n ranges,\n orientation,\n label,\n valueFormatter,\n barColor,\n targetColor,\n size,\n barSize,\n targetRatio,\n targetSize,\n withTooltip,\n getTooltipLabel,\n variant,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n\n const getStyles = useStyles<BulletChartFactory>({\n name: 'BulletChart',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const isVertical = orientation === 'vertical';\n const maxRange = Math.max(...ranges.map((r) => r.value), 0);\n const formatValue = (v: number) => (valueFormatter ? valueFormatter(v) : v.toString());\n\n // Clamp positions/sizes to the track so out-of-range values and targets never overflow it\n const toPercentage = (v: number) =>\n maxRange > 0 ? Math.max(0, Math.min((v / maxRange) * 100, 100)) : 0;\n\n const resolvedBarColor = barColor ? getThemeColor(barColor, theme) : 'var(--mantine-color-white)';\n\n const resolvedTargetColor = targetColor ? getThemeColor(targetColor, theme) : undefined;\n\n const sortedRanges = [...ranges].sort((a, b) => b.value - a.value);\n\n const rangeBands = sortedRanges.map((range, index) => {\n const percentage = toPercentage(range.value);\n const sizeStyle = isVertical\n ? { height: `${percentage}%`, bottom: 0 }\n : { width: `${percentage}%` };\n\n return (\n <div\n key={index}\n {...getStyles('range', {\n style: {\n ...sizeStyle,\n backgroundColor: getThemeColor(range.color, theme),\n },\n })}\n />\n );\n });\n\n const rangeLabels = sortedRanges.map((range, index) => {\n const percentage = toPercentage(range.value);\n const positionStyle = isVertical ? { bottom: `${percentage}%` } : { left: `${percentage}%` };\n\n return (\n <div key={index} {...getStyles('rangeLabel', { style: positionStyle })}>\n {formatValue(range.value)}\n </div>\n );\n });\n\n const barPercentage = toPercentage(value);\n const barSizeStyle = isVertical\n ? { height: `${barPercentage}%`, bottom: 0 }\n : { width: `${barPercentage}%` };\n\n const barElement = (\n <div\n {...getStyles('bar', {\n style: {\n ...barSizeStyle,\n backgroundColor: resolvedBarColor,\n },\n })}\n />\n );\n\n const barLabelPosition = isVertical\n ? { bottom: `${barPercentage}%` }\n : { left: `${barPercentage}%` };\n\n const barLabelElement = (\n <div {...getStyles('barLabel', { style: barLabelPosition })}>{formatValue(value)}</div>\n );\n\n const targetPercentage = target != null ? toPercentage(target) : 0;\n\n const targetElement =\n target != null ? (\n <div\n {...getStyles('target', {\n style: isVertical\n ? {\n bottom: `${targetPercentage}%`,\n width: `${targetRatio! * 100}%`,\n height: rem(targetSize),\n backgroundColor: resolvedTargetColor,\n }\n : {\n left: `${targetPercentage}%`,\n height: `${targetRatio! * 100}%`,\n width: rem(targetSize),\n backgroundColor: resolvedTargetColor,\n },\n })}\n />\n ) : null;\n\n const targetLabelElement =\n target != null ? (\n <div\n {...getStyles('targetLabel', {\n style: isVertical ? { bottom: `${targetPercentage}%` } : { left: `${targetPercentage}%` },\n })}\n >\n {formatValue(target)}\n </div>\n ) : null;\n\n const getDefaultTooltipLabel = () => {\n const parts = [`Value: ${formatValue(value)}`];\n if (target != null) {\n parts.push(`Target: ${formatValue(target)}`);\n }\n return parts.join(' / ');\n };\n\n const tooltipLabel = getTooltipLabel\n ? getTooltipLabel({ value, target })\n : getDefaultTooltipLabel();\n\n const trackWrapper = (\n <div {...getStyles('trackWrapper')} data-orientation={orientation}>\n {rangeLabels}\n {targetLabelElement}\n <div {...getStyles('track')} data-orientation={orientation}>\n {rangeBands}\n {barElement}\n {targetElement}\n </div>\n {barLabelElement}\n </div>\n );\n\n return (\n <Box {...getStyles('root')} variant={variant} mod={{ orientation }} {...others}>\n {label && <div {...getStyles('label')}>{label}</div>}\n {withTooltip ? (\n <Tooltip label={tooltipLabel} position={isVertical ? 'right' : 'top'}>\n {trackWrapper}\n </Tooltip>\n ) : (\n trackWrapper\n )}\n </Box>\n );\n});\n\nBulletChart.displayName = '@mantine/charts/BulletChart';\nBulletChart.classes = classes;\nBulletChart.varsResolver = varsResolver;\n"],"mappings":";;;;;AAiGA,MAAM,eAAe;CACnB,aAAa;CACb,MAAM;CACN,SAAS;CACT,aAAa;CACb,YAAY;CACZ,aAAa;AACf;AAEA,MAAM,gBAAA,GAAA,cAAA,mBAAA,EAAuD,QAAQ,EAAE,MAAM,eAAe,EAC1F,MAAM;CACJ,kBAAA,GAAA,cAAA,IAAA,CAAqB,IAAI;CACzB,sBAAA,GAAA,cAAA,IAAA,CAAyB,OAAO;AAClC,EACF,EAAE;AAEF,MAAa,eAAA,GAAA,cAAA,QAAA,EAA2C,WAAW;CACjE,MAAM,SAAA,GAAA,cAAA,SAAA,CAAiB,eAAe,cAAc,MAAM;CAC1D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,YACA,OACA,QACA,QACA,aACA,OACA,gBACA,UACA,aACA,MACA,SACA,aACA,YACA,aACA,iBACA,SACA,GAAG,WACD;CAEJ,MAAM,SAAA,GAAA,cAAA,gBAAA,CAAwB;CAE9B,MAAM,aAAA,GAAA,cAAA,UAAA,CAA0C;EAC9C,MAAM;EACN,SAAA,2BAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,aAAa,gBAAgB;CACnC,MAAM,WAAW,KAAK,IAAI,GAAG,OAAO,KAAK,MAAM,EAAE,KAAK,GAAG,CAAC;CAC1D,MAAM,eAAe,MAAe,iBAAiB,eAAe,CAAC,IAAI,EAAE,SAAS;CAGpF,MAAM,gBAAgB,MACpB,WAAW,IAAI,KAAK,IAAI,GAAG,KAAK,IAAK,IAA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ACG;GACA;GACD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;IAAK,GAAI,UAAU,OAAO;IAAG,oBAAkB;cAA/C;KACG;KACA;KACA;IACE;;GACJ;EACE;;CAGP,OACE,iBAAA,GAAA,kBAAA,KAAA,CAACA,cAAAA,KAAD;EAAK,GAAI,UAAU,MAAM;EAAY;EAAS,KAAK,EAAE,YAAY;EAAG,GAAI;YAAxE,CACG,SAAS,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;GAAK,GAAI,UAAU,OAAO;aAAI;EAAW,CAAA,GAClD,cACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,SAAD;GAAS,OAAO;GAAc,UAAU,aAAa,UAAU;aAC5D;EACM,CAAA,IAET,YAEC;;AAET,CAAC;AAED,YAAY,cAAc;AAC1B,YAAY,UAAUC,2BAAAA;AACtB,YAAY,eAAe"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region packages/@mantine/charts/src/BulletChart/BulletChart.module.css
|
|
3
|
+
var BulletChart_module_default = {
|
|
4
|
+
"root": "m_f1b033",
|
|
5
|
+
"label": "m_1ce939c3",
|
|
6
|
+
"trackWrapper": "m_dcd57f19",
|
|
7
|
+
"track": "m_1d61ac1a",
|
|
8
|
+
"range": "m_1d3df40c",
|
|
9
|
+
"bar": "m_8499ea2",
|
|
10
|
+
"target": "m_8dec10a2",
|
|
11
|
+
"rangeLabel": "m_18314248",
|
|
12
|
+
"barLabel": "m_73d6c572",
|
|
13
|
+
"targetLabel": "m_abeb9372"
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.default = BulletChart_module_default;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=BulletChart.module.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulletChart.module.cjs","names":[],"sources":["../../src/BulletChart/BulletChart.module.css"],"sourcesContent":[".root {\n display: flex;\n align-items: center;\n gap: var(--mantine-spacing-md);\n width: 100%;\n\n &[data-orientation='vertical'] {\n flex-direction: column;\n width: auto;\n height: 100%;\n }\n}\n\n.label {\n font-size: var(--mantine-font-size-sm);\n font-weight: var(--mantine-font-weight-medium);\n white-space: nowrap;\n color: var(--mantine-color-text);\n}\n\n.trackWrapper {\n position: relative;\n flex: 1;\n padding-top: calc(var(--mantine-font-size-xs) + rem(4px));\n padding-bottom: calc(var(--mantine-font-size-xs) + rem(4px));\n\n &[data-orientation='vertical'] {\n flex: 1;\n height: 100%;\n padding-top: 0;\n padding-bottom: 0;\n padding-left: calc(var(--mantine-font-size-xs) + 40px);\n padding-right: calc(var(--mantine-font-size-xs) + 40px);\n }\n}\n\n.track {\n position: relative;\n height: var(--bullet-size);\n border-radius: var(--mantine-radius-sm);\n overflow: hidden;\n\n [data-orientation='vertical'] > & {\n width: var(--bullet-size);\n height: 100%;\n }\n}\n\n.range {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: var(--mantine-radius-sm);\n\n [data-orientation='vertical'] > .track > & {\n top: auto;\n left: 0;\n width: 100%;\n height: auto;\n border-radius: var(--mantine-radius-sm);\n }\n}\n\n.bar {\n position: absolute;\n top: 50%;\n left: 0;\n height: var(--bullet-bar-size);\n transform: translateY(-50%);\n border-radius: 0 var(--mantine-radius-xs) var(--mantine-radius-xs) 0;\n z-index: 1;\n\n [data-orientation='vertical'] > .track > & {\n top: auto;\n left: 50%;\n width: var(--bullet-bar-size);\n height: auto;\n transform: translateX(-50%);\n border-radius: var(--mantine-radius-xs) var(--mantine-radius-xs) 0 0;\n }\n}\n\n.target {\n position: absolute;\n top: 50%;\n transform: translateY(-50%) translateX(-50%);\n z-index: 2;\n border-radius: var(--mantine-radius-xs);\n\n @mixin where-light {\n background-color: var(--mantine-color-dark-filled);\n }\n\n @mixin where-dark {\n background-color: var(--mantine-color-white);\n }\n\n [data-orientation='vertical'] > .track > & {\n top: auto;\n left: 50%;\n transform: translateX(-50%) translateY(50%);\n }\n}\n\n.rangeLabel {\n position: absolute;\n top: 0;\n transform: translateX(-50%);\n font-size: var(--mantine-font-size-xs);\n color: var(--mantine-color-dimmed);\n white-space: nowrap;\n line-height: 1;\n\n [data-orientation='vertical'] > & {\n top: auto;\n left: auto;\n right: 0;\n transform: translateY(50%);\n }\n}\n\n.barLabel {\n position: absolute;\n bottom: 0;\n transform: translateX(-50%);\n font-size: var(--mantine-font-size-xs);\n font-weight: var(--mantine-font-weight-bold);\n color: var(--mantine-color-text);\n white-space: nowrap;\n line-height: 1;\n\n [data-orientation='vertical'] > & {\n bottom: auto;\n left: 0;\n transform: translateY(50%);\n }\n}\n\n.targetLabel {\n position: absolute;\n top: 0;\n transform: translateX(-50%);\n font-size: var(--mantine-font-size-xs);\n color: var(--mantine-color-dimmed);\n white-space: nowrap;\n line-height: 1;\n\n [data-orientation='vertical'] > & {\n top: auto;\n left: auto;\n right: 0;\n transform: translateY(50%);\n }\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_ChartBrush_module = require("./ChartBrush.module.cjs");
|
|
3
|
+
let _mantine_core = require("@mantine/core");
|
|
4
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
5
|
+
let recharts = require("recharts");
|
|
6
|
+
//#region packages/@mantine/charts/src/ChartBrush/ChartBrush.tsx
|
|
7
|
+
const defaultProps = {};
|
|
8
|
+
const ChartBrush = (0, _mantine_core.factory)((_props) => {
|
|
9
|
+
const props = (0, _mantine_core.useProps)("ChartBrush", defaultProps, _props);
|
|
10
|
+
const { classNames, className, style, styles, unstyled, vars, attributes, ...others } = props;
|
|
11
|
+
const getStyles = (0, _mantine_core.useStyles)({
|
|
12
|
+
name: "ChartBrush",
|
|
13
|
+
classes: require_ChartBrush_module.default,
|
|
14
|
+
props,
|
|
15
|
+
className,
|
|
16
|
+
style,
|
|
17
|
+
classNames,
|
|
18
|
+
styles,
|
|
19
|
+
unstyled,
|
|
20
|
+
attributes
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Brush, {
|
|
23
|
+
dy: 8,
|
|
24
|
+
stroke: "var(--chart-grid-color)",
|
|
25
|
+
fill: "var(--mantine-color-body)",
|
|
26
|
+
...others,
|
|
27
|
+
...getStyles("brush")
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
ChartBrush.classes = require_ChartBrush_module.default;
|
|
31
|
+
ChartBrush.displayName = "@mantine/charts/ChartBrush";
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.ChartBrush = ChartBrush;
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=ChartBrush.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartBrush.cjs","names":["Brush","classes"],"sources":["../../src/ChartBrush/ChartBrush.tsx"],"sourcesContent":["import { Brush, BrushProps } from 'recharts';\nimport { factory, Factory, StylesApiProps, useProps, useStyles } from '@mantine/core';\nimport classes from './ChartBrush.module.css';\n\nexport type ChartBrushStylesNames = 'brush';\n\nexport interface ChartBrushProps\n extends Omit<BrushProps, 'ref'>, StylesApiProps<ChartBrushFactory> {}\n\nexport type ChartBrushFactory = Factory<{\n props: ChartBrushProps;\n ref: SVGElement;\n stylesNames: ChartBrushStylesNames;\n}>;\n\nconst defaultProps = {} satisfies Partial<ChartBrushProps>;\n\nexport const ChartBrush = factory<ChartBrushFactory>((_props) => {\n const props = useProps('ChartBrush', defaultProps, _props);\n const { classNames, className, style, styles, unstyled, vars, attributes, ...others } = props;\n\n const getStyles = useStyles<ChartBrushFactory>({\n name: 'ChartBrush',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n });\n\n return (\n <Brush\n dy={8}\n stroke=\"var(--chart-grid-color)\"\n fill=\"var(--mantine-color-body)\"\n {...others}\n {...getStyles('brush')}\n />\n );\n});\n\nChartBrush.classes = classes;\nChartBrush.displayName = '@mantine/charts/ChartBrush';\n"],"mappings":";;;;;;AAeA,MAAM,eAAe,CAAC;AAEtB,MAAa,cAAA,GAAA,cAAA,QAAA,EAAyC,WAAW;CAC/D,MAAM,SAAA,GAAA,cAAA,SAAA,CAAiB,cAAc,cAAc,MAAM;CACzD,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,UAAU,MAAM,YAAY,GAAG,WAAW;CAExF,MAAM,aAAA,GAAA,cAAA,UAAA,CAAyC;EAC7C,MAAM;EACN,SAAA,0BAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACA,SAAAA,OAAD;EACE,IAAI;EACJ,QAAO;EACP,MAAK;EACL,GAAI;EACJ,GAAI,UAAU,OAAO;CACtB,CAAA;AAEL,CAAC;AAED,WAAW,UAAUC,0BAAAA;AACrB,WAAW,cAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartBrush.module.cjs","names":[],"sources":["../../src/ChartBrush/ChartBrush.module.css"],"sourcesContent":[".brush {\n & :where(text) {\n font-size: var(--mantine-font-size-xs);\n fill: var(--chart-text-color, var(--mantine-color-dimmed));\n font-family: var(--mantine-font-family);\n }\n\n & :where(:global(.recharts-brush-slide)) {\n fill: var(--mantine-primary-color-light);\n fill-opacity: 1;\n }\n\n & :where(:global(.recharts-brush-traveller)) rect {\n fill: var(--mantine-primary-color-filled);\n }\n}\n"],"mappings":""}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
const require_ChartTooltip = require("../ChartTooltip/ChartTooltip.cjs");
|
|
3
3
|
const require_ChartLegend = require("../ChartLegend/ChartLegend.cjs");
|
|
4
|
+
const require_ChartBrush = require("../ChartBrush/ChartBrush.cjs");
|
|
4
5
|
const require_PointLabel = require("../PointLabel/PointLabel.cjs");
|
|
5
6
|
const require_grid_chart_module = require("../grid-chart.module.cjs");
|
|
6
7
|
let _mantine_core = require("@mantine/core");
|
|
7
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
let react = require("react");
|
|
9
9
|
let recharts = require("recharts");
|
|
10
|
+
let react = require("react");
|
|
10
11
|
//#region packages/@mantine/charts/src/CompositeChart/CompositeChart.tsx
|
|
11
12
|
const defaultProps = {
|
|
12
13
|
withXAxis: true,
|
|
@@ -19,7 +20,8 @@ const defaultProps = {
|
|
|
19
20
|
withDots: true,
|
|
20
21
|
connectNulls: true,
|
|
21
22
|
strokeWidth: 2,
|
|
22
|
-
curveType: "monotone"
|
|
23
|
+
curveType: "monotone",
|
|
24
|
+
accessibilityLayer: true
|
|
23
25
|
};
|
|
24
26
|
const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { textColor, gridColor }) => ({ root: {
|
|
25
27
|
"--chart-text-color": textColor ? (0, _mantine_core.getThemeColor)(textColor, theme) : void 0,
|
|
@@ -27,7 +29,7 @@ const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { textColor,
|
|
|
27
29
|
} }));
|
|
28
30
|
const CompositeChart = (0, _mantine_core.factory)((_props) => {
|
|
29
31
|
const props = (0, _mantine_core.useProps)("CompositeChart", defaultProps, _props);
|
|
30
|
-
const { classNames, className, style, styles, unstyled, vars, data, withLegend, legendProps, series, onMouseLeave, dataKey, withTooltip, withXAxis, withYAxis, gridAxis, tickLine, xAxisProps, yAxisProps, unit, tooltipAnimationDuration, strokeDasharray, gridProps, tooltipProps, referenceLines, withDots, dotProps, activeDotProps, strokeWidth, connectNulls, curveType, dir, valueFormatter, children, lineProps, xAxisLabel, yAxisLabel, withRightYAxis, rightYAxisLabel, rightYAxisProps, withPointLabels, areaProps, barProps, withBarValueLabel, minBarSize, maxBarWidth, composedChartProps, attributes, ...others } = props;
|
|
32
|
+
const { classNames, className, style, styles, unstyled, vars, data, withLegend, legendProps, series, onMouseLeave, dataKey, withTooltip, withXAxis, withYAxis, gridAxis, tickLine, xAxisProps, yAxisProps, unit, tooltipAnimationDuration, strokeDasharray, gridProps, tooltipProps, referenceLines, withDots, dotProps, activeDotProps, strokeWidth, connectNulls, curveType, dir, valueFormatter, children, lineProps, xAxisLabel, yAxisLabel, withRightYAxis, rightYAxisLabel, rightYAxisProps, withPointLabels, areaProps, barProps, withBarValueLabel, minBarSize, maxBarWidth, composedChartProps, attributes, accessibilityLayer, withBrush, brushProps, ...others } = props;
|
|
31
33
|
const theme = (0, _mantine_core.useMantineTheme)();
|
|
32
34
|
const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
|
|
33
35
|
const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
|
|
@@ -183,6 +185,7 @@ const CompositeChart = (0, _mantine_core.factory)((_props) => {
|
|
|
183
185
|
left: yAxisLabel ? 10 : void 0,
|
|
184
186
|
right: yAxisLabel ? 5 : void 0
|
|
185
187
|
},
|
|
188
|
+
accessibilityLayer,
|
|
186
189
|
...composedChartProps,
|
|
187
190
|
children: [
|
|
188
191
|
withLegend && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Legend, {
|
|
@@ -291,6 +294,12 @@ const CompositeChart = (0, _mantine_core.factory)((_props) => {
|
|
|
291
294
|
}),
|
|
292
295
|
lines,
|
|
293
296
|
referenceLinesItems,
|
|
297
|
+
withBrush && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ChartBrush.ChartBrush, {
|
|
298
|
+
dataKey,
|
|
299
|
+
classNames: resolvedClassNames,
|
|
300
|
+
styles: resolvedStyles,
|
|
301
|
+
...brushProps
|
|
302
|
+
}),
|
|
294
303
|
children
|
|
295
304
|
]
|
|
296
305
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeChart.cjs","names":["Line","PointLabel","Area","Bar","LabelList","ReferenceLine","Box","ResponsiveContainer","ReChartsCompositeChart","Legend","ChartLegend","XAxis","Label","YAxis","CartesianGrid","Tooltip","ChartTooltip","classes"],"sources":["../../src/CompositeChart/CompositeChart.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n Area,\n AreaProps,\n Bar,\n BarProps,\n CartesianGrid,\n Label,\n LabelList,\n Legend,\n Line,\n LineProps,\n ComposedChart as ReChartsCompositeChart,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n StylesApiProps,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { ChartLegend, ChartLegendStylesNames } from '../ChartLegend';\nimport { ChartTooltip, ChartTooltipStylesNames } from '../ChartTooltip';\nimport { PointLabel } from '../PointLabel/PointLabel';\nimport type {\n BaseChartStylesNames,\n ChartSeries,\n GridChartBaseProps,\n MantineChartDotProps,\n} from '../types';\nimport classes from '../grid-chart.module.css';\n\nexport type CompositeChartCurveType =\n | 'bump'\n | 'linear'\n | 'natural'\n | 'monotone'\n | 'step'\n | 'stepBefore'\n | 'stepAfter';\n\nexport interface CompositeChartSeries extends ChartSeries {\n type: 'line' | 'area' | 'bar';\n strokeDasharray?: string | number;\n}\n\nexport type CompositeChartStylesNames =\n | 'line'\n | 'area'\n | 'bar'\n | BaseChartStylesNames\n | ChartLegendStylesNames\n | ChartTooltipStylesNames;\n\nexport type CompositeChartCssVariables = {\n root: '--chart-text-color' | '--chart-grid-color';\n};\n\nexport interface CompositeChartProps\n extends\n BoxProps,\n Omit<GridChartBaseProps, 'orientation'>,\n StylesApiProps<CompositeChartFactory>,\n ElementProps<'div'> {\n /** Data used to display chart */\n data: Record<string, any>[];\n\n /** An array of objects with `name` and `color` keys. Determines which data should be consumed from the `data` array. */\n series: CompositeChartSeries[];\n\n /** Type of the curve @default 'monotone' */\n curveType?: CompositeChartCurveType;\n\n /** Determines whether dots should be displayed @default true */\n withDots?: boolean;\n\n /** Props passed down to all dots. Ignored if `withDots={false}` is set. */\n dotProps?: MantineChartDotProps;\n\n /** Props passed down to all active dots. Ignored if `withDots={false}` is set. */\n activeDotProps?: MantineChartDotProps;\n\n /** Stroke width for the chart lines @default 2 */\n strokeWidth?: number;\n\n /** Determines whether points with `null` values should be connected @default true */\n connectNulls?: boolean;\n\n /** Additional components that are rendered inside recharts `AreaChart` component */\n children?: React.ReactNode;\n\n /** Props passed down to recharts `Line` component */\n lineProps?:\n | ((series: CompositeChartSeries) => Partial<Omit<LineProps, 'ref'>>)\n | Partial<Omit<LineProps, 'ref'>>;\n\n /** Props passed down to recharts `Area` component */\n areaProps?:\n | ((series: CompositeChartSeries) => Partial<Omit<AreaProps<any, any>, 'ref'>>)\n | Partial<Omit<AreaProps<any, any>, 'ref'>>;\n\n /** Props passed down to recharts `Bar` component */\n barProps?:\n | ((series: CompositeChartSeries) => Partial<Omit<BarProps, 'ref'>>)\n | Partial<Omit<BarProps, 'ref'>>;\n\n /** Determines whether each point should have associated label @default false */\n withPointLabels?: boolean;\n\n /** Determines whether a label with bar value should be displayed on top of each bar @default false */\n withBarValueLabel?: boolean;\n\n /** Sets minimum height of the bar in px @default 0 */\n minBarSize?: number;\n\n /** Maximum bar width in px */\n maxBarWidth?: number;\n\n /** Props passed down to recharts `AreaChart` component */\n composedChartProps?: React.ComponentProps<typeof ReChartsCompositeChart>;\n}\n\nexport type CompositeChartFactory = Factory<{\n props: CompositeChartProps;\n ref: HTMLDivElement;\n stylesNames: CompositeChartStylesNames;\n vars: CompositeChartCssVariables;\n}>;\n\nconst defaultProps = {\n withXAxis: true,\n withYAxis: true,\n withTooltip: true,\n tooltipAnimationDuration: 0,\n tickLine: 'y',\n strokeDasharray: '5 5',\n gridAxis: 'x',\n withDots: true,\n connectNulls: true,\n strokeWidth: 2,\n curveType: 'monotone',\n} satisfies Partial<CompositeChartProps>;\n\nconst varsResolver = createVarsResolver<CompositeChartFactory>(\n (theme, { textColor, gridColor }) => ({\n root: {\n '--chart-text-color': textColor ? getThemeColor(textColor, theme) : undefined,\n '--chart-grid-color': gridColor ? getThemeColor(gridColor, theme) : undefined,\n },\n })\n);\n\nexport const CompositeChart = factory<CompositeChartFactory>((_props) => {\n const props = useProps('CompositeChart', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n data,\n withLegend,\n legendProps,\n series,\n onMouseLeave,\n dataKey,\n withTooltip,\n withXAxis,\n withYAxis,\n gridAxis,\n tickLine,\n xAxisProps,\n yAxisProps,\n unit,\n tooltipAnimationDuration,\n strokeDasharray,\n gridProps,\n tooltipProps,\n referenceLines,\n withDots,\n dotProps,\n activeDotProps,\n strokeWidth,\n connectNulls,\n curveType,\n dir,\n valueFormatter,\n children,\n lineProps,\n xAxisLabel,\n yAxisLabel,\n withRightYAxis,\n rightYAxisLabel,\n rightYAxisProps,\n withPointLabels,\n areaProps,\n barProps,\n withBarValueLabel,\n minBarSize,\n maxBarWidth,\n composedChartProps,\n attributes,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n const withXTickLine = gridAxis !== 'none' && (tickLine === 'x' || tickLine === 'xy');\n const withYTickLine = gridAxis !== 'none' && (tickLine === 'y' || tickLine === 'xy');\n const [highlightedArea, setHighlightedArea] = useState<string | number | null>(null);\n const shouldHighlight = highlightedArea !== null;\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n setHighlightedArea(null);\n onMouseLeave?.(event);\n };\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<CompositeChartFactory>({\n classNames,\n styles,\n props,\n });\n\n const getStyles = useStyles<CompositeChartFactory>({\n name: 'CompositeChart',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const lines = series.map((item) => {\n const color = getThemeColor(item.color, theme);\n const dimmed = shouldHighlight && highlightedArea !== item.name;\n\n if (item.type === 'line') {\n return (\n <Line\n {...getStyles('line')}\n key={item.name}\n name={item.name}\n dataKey={item.name}\n dot={\n withDots\n ? {\n fillOpacity: dimmed ? 0 : 1,\n strokeOpacity: dimmed ? 0 : 1,\n strokeWidth: 1,\n fill: color,\n stroke: color,\n ...dotProps,\n }\n : false\n }\n activeDot={\n withDots\n ? { fill: 'var(--mantine-color-white)', stroke: color, ...activeDotProps }\n : false\n }\n fill={color}\n stroke={color}\n strokeWidth={strokeWidth}\n isAnimationActive={false}\n fillOpacity={dimmed ? 0 : 1}\n strokeOpacity={dimmed ? 0.5 : 1}\n connectNulls={connectNulls}\n type={curveType}\n strokeDasharray={item.strokeDasharray}\n yAxisId={item.yAxisId || undefined}\n label={withPointLabels ? <PointLabel valueFormatter={valueFormatter} /> : undefined}\n {...(typeof lineProps === 'function' ? lineProps(item) : lineProps)}\n />\n );\n }\n\n if (item.type === 'area') {\n return (\n <Area\n {...getStyles('area')}\n key={item.name}\n name={item.name}\n type={curveType}\n dataKey={item.name}\n fill={color}\n strokeWidth={strokeWidth}\n stroke={color}\n isAnimationActive={false}\n connectNulls={connectNulls}\n dot={\n withDots\n ? {\n fillOpacity: dimmed ? 0 : 1,\n strokeOpacity: dimmed ? 0 : 1,\n strokeWidth: 1,\n fill: color,\n stroke: color,\n ...dotProps,\n }\n : false\n }\n activeDot={\n withDots\n ? {\n fill: theme.white,\n stroke: color,\n strokeWidth: 2,\n r: 4,\n ...activeDotProps,\n }\n : false\n }\n fillOpacity={dimmed ? 0 : 0.2}\n strokeOpacity={dimmed ? 0.5 : 1}\n strokeDasharray={item.strokeDasharray}\n yAxisId={item.yAxisId || undefined}\n label={withPointLabels ? <PointLabel valueFormatter={valueFormatter} /> : undefined}\n {...(typeof areaProps === 'function' ? areaProps(item) : areaProps)}\n />\n );\n }\n\n if (item.type === 'bar') {\n return (\n <Bar\n {...getStyles('bar')}\n key={item.name}\n name={item.name}\n dataKey={item.name}\n fill={color}\n stroke={color}\n isAnimationActive={false}\n fillOpacity={dimmed ? 0.1 : 1}\n strokeOpacity={dimmed ? 0.2 : 0}\n yAxisId={item.yAxisId || undefined}\n minPointSize={minBarSize}\n {...(typeof barProps === 'function' ? barProps(item) : barProps)}\n >\n {withBarValueLabel && (\n <LabelList\n position=\"top\"\n fontSize={12}\n fill=\"var(--chart-bar-label-color, var(--mantine-color-dimmed))\"\n formatter={(val: any) => valueFormatter?.(val as any)}\n />\n )}\n </Bar>\n );\n }\n\n return null;\n });\n\n const referenceLinesItems = referenceLines?.map((line, index) => {\n const color = getThemeColor(line.color, theme);\n return (\n <ReferenceLine\n key={index}\n stroke={line.color ? color : 'var(--chart-grid-color)'}\n strokeWidth={1}\n yAxisId={line.yAxisId || undefined}\n {...line}\n label={{\n fill: line.color ? color : 'currentColor',\n fontSize: 12,\n position: line.labelPosition ?? 'insideBottomLeft',\n ...(typeof line.label === 'object' ? line.label : { value: line.label }),\n }}\n {...getStyles('referenceLine')}\n />\n );\n });\n\n const sharedYAxisProps = {\n axisLine: false,\n type: 'number' as const,\n tickLine: withYTickLine ? { stroke: 'currentColor' } : false,\n allowDecimals: true,\n unit,\n tickFormatter: valueFormatter,\n ...getStyles('axis'),\n };\n\n return (\n <Box {...getStyles('root')} onMouseLeave={handleMouseLeave} dir={dir || 'ltr'} {...others}>\n <ResponsiveContainer {...getStyles('container')}>\n <ReChartsCompositeChart\n data={data}\n maxBarSize={maxBarWidth}\n margin={{\n bottom: xAxisLabel ? 30 : undefined,\n left: yAxisLabel ? 10 : undefined,\n right: yAxisLabel ? 5 : undefined,\n }}\n {...composedChartProps}\n >\n {withLegend && (\n <Legend\n verticalAlign=\"top\"\n content={(payload) => (\n <ChartLegend\n payload={payload.payload}\n onHighlight={setHighlightedArea}\n legendPosition={legendProps?.verticalAlign || 'top'}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n series={series}\n attributes={attributes}\n />\n )}\n {...legendProps}\n />\n )}\n\n <XAxis\n hide={!withXAxis}\n dataKey={dataKey}\n tick={{ transform: 'translate(0, 10)', fontSize: 12, fill: 'currentColor' }}\n stroke=\"\"\n interval=\"preserveStartEnd\"\n tickLine={withXTickLine ? { stroke: 'currentColor' } : false}\n minTickGap={5}\n {...getStyles('axis')}\n {...xAxisProps}\n >\n {xAxisLabel && (\n <Label position=\"insideBottom\" offset={-20} fontSize={12} {...getStyles('axisLabel')}>\n {xAxisLabel}\n </Label>\n )}\n {xAxisProps?.children}\n </XAxis>\n\n <YAxis\n orientation=\"left\"\n tick={{ transform: 'translate(-10, 0)', fontSize: 12, fill: 'currentColor' }}\n hide={!withYAxis}\n {...sharedYAxisProps}\n {...yAxisProps}\n >\n {yAxisLabel && (\n <Label\n position=\"insideLeft\"\n angle={-90}\n textAnchor=\"middle\"\n fontSize={12}\n offset={-5}\n {...getStyles('axisLabel')}\n >\n {yAxisLabel}\n </Label>\n )}\n {yAxisProps?.children}\n </YAxis>\n\n <YAxis\n yAxisId=\"right\"\n orientation=\"right\"\n tick={{ transform: 'translate(10, 0)', fontSize: 12, fill: 'currentColor' }}\n hide={!withRightYAxis}\n {...sharedYAxisProps}\n {...rightYAxisProps}\n >\n {rightYAxisLabel && (\n <Label\n position=\"insideRight\"\n angle={90}\n textAnchor=\"middle\"\n fontSize={12}\n offset={-5}\n {...getStyles('axisLabel')}\n >\n {rightYAxisLabel}\n </Label>\n )}\n {yAxisProps?.children}\n </YAxis>\n\n <CartesianGrid\n strokeDasharray={strokeDasharray as string}\n vertical={gridAxis === 'y' || gridAxis === 'xy'}\n horizontal={gridAxis === 'x' || gridAxis === 'xy'}\n {...getStyles('grid')}\n {...gridProps}\n />\n\n {withTooltip && (\n <Tooltip\n animationDuration={tooltipAnimationDuration}\n isAnimationActive={tooltipAnimationDuration !== 0}\n position={{ y: 0 }}\n cursor={{\n stroke: 'var(--chart-grid-color)',\n strokeWidth: 1,\n strokeDasharray,\n }}\n content={({ label, payload, labelFormatter }) => (\n <ChartTooltip\n label={labelFormatter && payload ? labelFormatter(label, payload) : label}\n payload={payload}\n unit={unit}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n series={series}\n valueFormatter={valueFormatter}\n attributes={attributes}\n />\n )}\n {...tooltipProps}\n />\n )}\n\n {lines}\n {referenceLinesItems}\n {children}\n </ReChartsCompositeChart>\n </ResponsiveContainer>\n </Box>\n );\n});\n\nCompositeChart.displayName = '@mantine/charts/CompositeChart';\nCompositeChart.classes = classes;\nCompositeChart.varsResolver = varsResolver;\n\nexport namespace CompositeChart {\n export type Props = CompositeChartProps;\n export type StylesNames = CompositeChartStylesNames;\n export type CssVariables = CompositeChartCssVariables;\n export type Factory = CompositeChartFactory;\n export type Series = CompositeChartSeries;\n export type CurveType = CompositeChartCurveType;\n}\n"],"mappings":";;;;;;;;;;AA6IA,MAAM,eAAe;CACnB,WAAW;CACX,WAAW;CACX,aAAa;CACb,0BAA0B;CAC1B,UAAU;CACV,iBAAiB;CACjB,UAAU;CACV,UAAU;CACV,cAAc;CACd,aAAa;CACb,WAAW;AACb;AAEA,MAAM,gBAAA,GAAA,cAAA,mBAAA,EACH,OAAO,EAAE,WAAW,iBAAiB,EACpC,MAAM;CACJ,sBAAsB,aAAA,GAAA,cAAA,cAAA,CAA0B,WAAW,KAAK,IAAI,KAAA;CACpE,sBAAsB,aAAA,GAAA,cAAA,cAAA,CAA0B,WAAW,KAAK,IAAI,KAAA;AACtE,EACF,EACF;AAEA,MAAa,kBAAA,GAAA,cAAA,QAAA,EAAiD,WAAW;CACvE,MAAM,SAAA,GAAA,cAAA,SAAA,CAAiB,kBAAkB,cAAc,MAAM;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,MACA,YACA,aACA,QACA,cACA,SACA,aACA,WACA,WACA,UACA,UACA,YACA,YACA,MACA,0BACA,iBACA,WACA,cACA,gBACA,UACA,UACA,gBACA,aACA,cACA,WACA,KACA,gBACA,UACA,WACA,YACA,YACA,gBACA,iBACA,iBACA,iBACA,WACA,UACA,mBACA,YACA,aACA,oBACA,YACA,GAAG,WACD;CAEJ,MAAM,SAAA,GAAA,cAAA,gBAAA,CAAwB;CAC9B,MAAM,gBAAgB,aAAa,WAAW,aAAa,OAAO,aAAa;CAC/E,MAAM,gBAAgB,aAAa,WAAW,aAAa,OAAO,aA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C,SAAAA,SAAD;MACE,mBAAmB;MACnB,mBAAmB,6BAA6B;MAChD,UAAU,EAAE,GAAG,EAAE;MACjB,QAAQ;OACN,QAAQ;OACR,aAAa;OACb;MACF;MACA,UAAU,EAAE,OAAO,SAAS,qBAC1B,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,cAAD;OACE,OAAO,kBAAkB,UAAU,eAAe,OAAO,OAAO,IAAI;OAC3D;OACH;OACN,YAAY;OACZ,QAAQ;OACA;OACQ;OACJ;MACb,CAAA;MAEH,GAAI;KACL,CAAA;KAGF;KACA;KACA;IACqB;;EACL,CAAA;CAClB,CAAA;AAET,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUC,0BAAAA;AACzB,eAAe,eAAe"}
|
|
1
|
+
{"version":3,"file":"CompositeChart.cjs","names":["Line","PointLabel","Area","Bar","LabelList","ReferenceLine","Box","ResponsiveContainer","ReChartsCompositeChart","Legend","ChartLegend","XAxis","Label","YAxis","CartesianGrid","Tooltip","ChartTooltip","ChartBrush","classes"],"sources":["../../src/CompositeChart/CompositeChart.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n Area,\n AreaProps,\n Bar,\n BarProps,\n CartesianGrid,\n Label,\n LabelList,\n Legend,\n Line,\n LineProps,\n ComposedChart as ReChartsCompositeChart,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from 'recharts';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n StylesApiProps,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { ChartBrush } from '../ChartBrush';\nimport { ChartLegend, ChartLegendStylesNames } from '../ChartLegend';\nimport { ChartTooltip, ChartTooltipStylesNames } from '../ChartTooltip';\nimport { PointLabel } from '../PointLabel/PointLabel';\nimport type {\n BaseChartStylesNames,\n ChartSeries,\n GridChartBaseProps,\n MantineChartDotProps,\n} from '../types';\nimport classes from '../grid-chart.module.css';\n\nexport type CompositeChartCurveType =\n | 'bump'\n | 'linear'\n | 'natural'\n | 'monotone'\n | 'step'\n | 'stepBefore'\n | 'stepAfter';\n\nexport interface CompositeChartSeries extends ChartSeries {\n type: 'line' | 'area' | 'bar';\n strokeDasharray?: string | number;\n}\n\nexport type CompositeChartStylesNames =\n | 'line'\n | 'area'\n | 'bar'\n | BaseChartStylesNames\n | ChartLegendStylesNames\n | ChartTooltipStylesNames;\n\nexport type CompositeChartCssVariables = {\n root: '--chart-text-color' | '--chart-grid-color';\n};\n\nexport interface CompositeChartProps\n extends\n BoxProps,\n Omit<GridChartBaseProps, 'orientation'>,\n StylesApiProps<CompositeChartFactory>,\n ElementProps<'div'> {\n /** Data used to display chart */\n data: Record<string, any>[];\n\n /** An array of objects with `name` and `color` keys. Determines which data should be consumed from the `data` array. */\n series: CompositeChartSeries[];\n\n /** Type of the curve @default 'monotone' */\n curveType?: CompositeChartCurveType;\n\n /** Determines whether dots should be displayed @default true */\n withDots?: boolean;\n\n /** Props passed down to all dots. Ignored if `withDots={false}` is set. */\n dotProps?: MantineChartDotProps;\n\n /** Props passed down to all active dots. Ignored if `withDots={false}` is set. */\n activeDotProps?: MantineChartDotProps;\n\n /** Stroke width for the chart lines @default 2 */\n strokeWidth?: number;\n\n /** Determines whether points with `null` values should be connected @default true */\n connectNulls?: boolean;\n\n /** Additional components that are rendered inside recharts `AreaChart` component */\n children?: React.ReactNode;\n\n /** Props passed down to recharts `Line` component */\n lineProps?:\n | ((series: CompositeChartSeries) => Partial<Omit<LineProps, 'ref'>>)\n | Partial<Omit<LineProps, 'ref'>>;\n\n /** Props passed down to recharts `Area` component */\n areaProps?:\n | ((series: CompositeChartSeries) => Partial<Omit<AreaProps<any, any>, 'ref'>>)\n | Partial<Omit<AreaProps<any, any>, 'ref'>>;\n\n /** Props passed down to recharts `Bar` component */\n barProps?:\n | ((series: CompositeChartSeries) => Partial<Omit<BarProps, 'ref'>>)\n | Partial<Omit<BarProps, 'ref'>>;\n\n /** Determines whether each point should have associated label @default false */\n withPointLabels?: boolean;\n\n /** Determines whether a label with bar value should be displayed on top of each bar @default false */\n withBarValueLabel?: boolean;\n\n /** Sets minimum height of the bar in px @default 0 */\n minBarSize?: number;\n\n /** Maximum bar width in px */\n maxBarWidth?: number;\n\n /** Props passed down to recharts `AreaChart` component */\n composedChartProps?: React.ComponentProps<typeof ReChartsCompositeChart>;\n}\n\nexport type CompositeChartFactory = Factory<{\n props: CompositeChartProps;\n ref: HTMLDivElement;\n stylesNames: CompositeChartStylesNames;\n vars: CompositeChartCssVariables;\n}>;\n\nconst defaultProps = {\n withXAxis: true,\n withYAxis: true,\n withTooltip: true,\n tooltipAnimationDuration: 0,\n tickLine: 'y',\n strokeDasharray: '5 5',\n gridAxis: 'x',\n withDots: true,\n connectNulls: true,\n strokeWidth: 2,\n curveType: 'monotone',\n accessibilityLayer: true,\n} satisfies Partial<CompositeChartProps>;\n\nconst varsResolver = createVarsResolver<CompositeChartFactory>(\n (theme, { textColor, gridColor }) => ({\n root: {\n '--chart-text-color': textColor ? getThemeColor(textColor, theme) : undefined,\n '--chart-grid-color': gridColor ? getThemeColor(gridColor, theme) : undefined,\n },\n })\n);\n\nexport const CompositeChart = factory<CompositeChartFactory>((_props) => {\n const props = useProps('CompositeChart', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n data,\n withLegend,\n legendProps,\n series,\n onMouseLeave,\n dataKey,\n withTooltip,\n withXAxis,\n withYAxis,\n gridAxis,\n tickLine,\n xAxisProps,\n yAxisProps,\n unit,\n tooltipAnimationDuration,\n strokeDasharray,\n gridProps,\n tooltipProps,\n referenceLines,\n withDots,\n dotProps,\n activeDotProps,\n strokeWidth,\n connectNulls,\n curveType,\n dir,\n valueFormatter,\n children,\n lineProps,\n xAxisLabel,\n yAxisLabel,\n withRightYAxis,\n rightYAxisLabel,\n rightYAxisProps,\n withPointLabels,\n areaProps,\n barProps,\n withBarValueLabel,\n minBarSize,\n maxBarWidth,\n composedChartProps,\n attributes,\n accessibilityLayer,\n withBrush,\n brushProps,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n const withXTickLine = gridAxis !== 'none' && (tickLine === 'x' || tickLine === 'xy');\n const withYTickLine = gridAxis !== 'none' && (tickLine === 'y' || tickLine === 'xy');\n const [highlightedArea, setHighlightedArea] = useState<string | number | null>(null);\n const shouldHighlight = highlightedArea !== null;\n const handleMouseLeave = (event: React.MouseEvent<HTMLDivElement>) => {\n setHighlightedArea(null);\n onMouseLeave?.(event);\n };\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<CompositeChartFactory>({\n classNames,\n styles,\n props,\n });\n\n const getStyles = useStyles<CompositeChartFactory>({\n name: 'CompositeChart',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const lines = series.map((item) => {\n const color = getThemeColor(item.color, theme);\n const dimmed = shouldHighlight && highlightedArea !== item.name;\n\n if (item.type === 'line') {\n return (\n <Line\n {...getStyles('line')}\n key={item.name}\n name={item.name}\n dataKey={item.name}\n dot={\n withDots\n ? {\n fillOpacity: dimmed ? 0 : 1,\n strokeOpacity: dimmed ? 0 : 1,\n strokeWidth: 1,\n fill: color,\n stroke: color,\n ...dotProps,\n }\n : false\n }\n activeDot={\n withDots\n ? { fill: 'var(--mantine-color-white)', stroke: color, ...activeDotProps }\n : false\n }\n fill={color}\n stroke={color}\n strokeWidth={strokeWidth}\n isAnimationActive={false}\n fillOpacity={dimmed ? 0 : 1}\n strokeOpacity={dimmed ? 0.5 : 1}\n connectNulls={connectNulls}\n type={curveType}\n strokeDasharray={item.strokeDasharray}\n yAxisId={item.yAxisId || undefined}\n label={withPointLabels ? <PointLabel valueFormatter={valueFormatter} /> : undefined}\n {...(typeof lineProps === 'function' ? lineProps(item) : lineProps)}\n />\n );\n }\n\n if (item.type === 'area') {\n return (\n <Area\n {...getStyles('area')}\n key={item.name}\n name={item.name}\n type={curveType}\n dataKey={item.name}\n fill={color}\n strokeWidth={strokeWidth}\n stroke={color}\n isAnimationActive={false}\n connectNulls={connectNulls}\n dot={\n withDots\n ? {\n fillOpacity: dimmed ? 0 : 1,\n strokeOpacity: dimmed ? 0 : 1,\n strokeWidth: 1,\n fill: color,\n stroke: color,\n ...dotProps,\n }\n : false\n }\n activeDot={\n withDots\n ? {\n fill: theme.white,\n stroke: color,\n strokeWidth: 2,\n r: 4,\n ...activeDotProps,\n }\n : false\n }\n fillOpacity={dimmed ? 0 : 0.2}\n strokeOpacity={dimmed ? 0.5 : 1}\n strokeDasharray={item.strokeDasharray}\n yAxisId={item.yAxisId || undefined}\n label={withPointLabels ? <PointLabel valueFormatter={valueFormatter} /> : undefined}\n {...(typeof areaProps === 'function' ? areaProps(item) : areaProps)}\n />\n );\n }\n\n if (item.type === 'bar') {\n return (\n <Bar\n {...getStyles('bar')}\n key={item.name}\n name={item.name}\n dataKey={item.name}\n fill={color}\n stroke={color}\n isAnimationActive={false}\n fillOpacity={dimmed ? 0.1 : 1}\n strokeOpacity={dimmed ? 0.2 : 0}\n yAxisId={item.yAxisId || undefined}\n minPointSize={minBarSize}\n {...(typeof barProps === 'function' ? barProps(item) : barProps)}\n >\n {withBarValueLabel && (\n <LabelList\n position=\"top\"\n fontSize={12}\n fill=\"var(--chart-bar-label-color, var(--mantine-color-dimmed))\"\n formatter={(val: any) => valueFormatter?.(val as any)}\n />\n )}\n </Bar>\n );\n }\n\n return null;\n });\n\n const referenceLinesItems = referenceLines?.map((line, index) => {\n const color = getThemeColor(line.color, theme);\n return (\n <ReferenceLine\n key={index}\n stroke={line.color ? color : 'var(--chart-grid-color)'}\n strokeWidth={1}\n yAxisId={line.yAxisId || undefined}\n {...line}\n label={{\n fill: line.color ? color : 'currentColor',\n fontSize: 12,\n position: line.labelPosition ?? 'insideBottomLeft',\n ...(typeof line.label === 'object' ? line.label : { value: line.label }),\n }}\n {...getStyles('referenceLine')}\n />\n );\n });\n\n const sharedYAxisProps = {\n axisLine: false,\n type: 'number' as const,\n tickLine: withYTickLine ? { stroke: 'currentColor' } : false,\n allowDecimals: true,\n unit,\n tickFormatter: valueFormatter,\n ...getStyles('axis'),\n };\n\n return (\n <Box {...getStyles('root')} onMouseLeave={handleMouseLeave} dir={dir || 'ltr'} {...others}>\n <ResponsiveContainer {...getStyles('container')}>\n <ReChartsCompositeChart\n data={data}\n maxBarSize={maxBarWidth}\n margin={{\n bottom: xAxisLabel ? 30 : undefined,\n left: yAxisLabel ? 10 : undefined,\n right: yAxisLabel ? 5 : undefined,\n }}\n accessibilityLayer={accessibilityLayer}\n {...composedChartProps}\n >\n {withLegend && (\n <Legend\n verticalAlign=\"top\"\n content={(payload) => (\n <ChartLegend\n payload={payload.payload}\n onHighlight={setHighlightedArea}\n legendPosition={legendProps?.verticalAlign || 'top'}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n series={series}\n attributes={attributes}\n />\n )}\n {...legendProps}\n />\n )}\n\n <XAxis\n hide={!withXAxis}\n dataKey={dataKey}\n tick={{ transform: 'translate(0, 10)', fontSize: 12, fill: 'currentColor' }}\n stroke=\"\"\n interval=\"preserveStartEnd\"\n tickLine={withXTickLine ? { stroke: 'currentColor' } : false}\n minTickGap={5}\n {...getStyles('axis')}\n {...xAxisProps}\n >\n {xAxisLabel && (\n <Label position=\"insideBottom\" offset={-20} fontSize={12} {...getStyles('axisLabel')}>\n {xAxisLabel}\n </Label>\n )}\n {xAxisProps?.children}\n </XAxis>\n\n <YAxis\n orientation=\"left\"\n tick={{ transform: 'translate(-10, 0)', fontSize: 12, fill: 'currentColor' }}\n hide={!withYAxis}\n {...sharedYAxisProps}\n {...yAxisProps}\n >\n {yAxisLabel && (\n <Label\n position=\"insideLeft\"\n angle={-90}\n textAnchor=\"middle\"\n fontSize={12}\n offset={-5}\n {...getStyles('axisLabel')}\n >\n {yAxisLabel}\n </Label>\n )}\n {yAxisProps?.children}\n </YAxis>\n\n <YAxis\n yAxisId=\"right\"\n orientation=\"right\"\n tick={{ transform: 'translate(10, 0)', fontSize: 12, fill: 'currentColor' }}\n hide={!withRightYAxis}\n {...sharedYAxisProps}\n {...rightYAxisProps}\n >\n {rightYAxisLabel && (\n <Label\n position=\"insideRight\"\n angle={90}\n textAnchor=\"middle\"\n fontSize={12}\n offset={-5}\n {...getStyles('axisLabel')}\n >\n {rightYAxisLabel}\n </Label>\n )}\n {yAxisProps?.children}\n </YAxis>\n\n <CartesianGrid\n strokeDasharray={strokeDasharray as string}\n vertical={gridAxis === 'y' || gridAxis === 'xy'}\n horizontal={gridAxis === 'x' || gridAxis === 'xy'}\n {...getStyles('grid')}\n {...gridProps}\n />\n\n {withTooltip && (\n <Tooltip\n animationDuration={tooltipAnimationDuration}\n isAnimationActive={tooltipAnimationDuration !== 0}\n position={{ y: 0 }}\n cursor={{\n stroke: 'var(--chart-grid-color)',\n strokeWidth: 1,\n strokeDasharray,\n }}\n content={({ label, payload, labelFormatter }) => (\n <ChartTooltip\n label={labelFormatter && payload ? labelFormatter(label, payload) : label}\n payload={payload}\n unit={unit}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n series={series}\n valueFormatter={valueFormatter}\n attributes={attributes}\n />\n )}\n {...tooltipProps}\n />\n )}\n\n {lines}\n {referenceLinesItems}\n {withBrush && (\n <ChartBrush\n dataKey={dataKey}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n {...brushProps}\n />\n )}\n {children}\n </ReChartsCompositeChart>\n </ResponsiveContainer>\n </Box>\n );\n});\n\nCompositeChart.displayName = '@mantine/charts/CompositeChart';\nCompositeChart.classes = classes;\nCompositeChart.varsResolver = varsResolver;\n\nexport namespace CompositeChart {\n export type Props = CompositeChartProps;\n export type StylesNames = CompositeChartStylesNames;\n export type CssVariables = CompositeChartCssVariables;\n export type Factory = CompositeChartFactory;\n export type Series = CompositeChartSeries;\n export type CurveType = CompositeChartCurveType;\n}\n"],"mappings":";;;;;;;;;;;AA8IA,MAAM,eAAe;CACnB,WAAW;CAC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Q;OACJ;MACb,CAAA;MAEH,GAAI;KACL,CAAA;KAGF;KACA;KACA,aACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,mBAAAA,YAAD;MACW;MACT,YAAY;MACZ,QAAQ;MACR,GAAI;KACL,CAAA;KAEF;IACqB;;EACL,CAAA;CAClB,CAAA;AAET,CAAC;AAED,eAAe,cAAc;AAC7B,eAAe,UAAUC,0BAAAA;AACzB,eAAe,eAAe"}
|
|
@@ -5,8 +5,8 @@ const require_ChartLegend = require("../ChartLegend/ChartLegend.cjs");
|
|
|
5
5
|
const require_DonutChart_module = require("./DonutChart.module.cjs");
|
|
6
6
|
let _mantine_core = require("@mantine/core");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
-
let react = require("react");
|
|
9
8
|
let recharts = require("recharts");
|
|
9
|
+
let react = require("react");
|
|
10
10
|
//#region packages/@mantine/charts/src/DonutChart/DonutChart.tsx
|
|
11
11
|
const defaultProps = {
|
|
12
12
|
withTooltip: true,
|
|
@@ -18,7 +18,8 @@ const defaultProps = {
|
|
|
18
18
|
startAngle: 0,
|
|
19
19
|
endAngle: 360,
|
|
20
20
|
labelsType: "value",
|
|
21
|
-
tooltipDataSource: "all"
|
|
21
|
+
tooltipDataSource: "all",
|
|
22
|
+
accessibilityLayer: true
|
|
22
23
|
};
|
|
23
24
|
const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { strokeColor, labelColor, withLabels, withLegend, size }) => ({ root: {
|
|
24
25
|
"--chart-stroke-color": strokeColor ? (0, _mantine_core.getThemeColor)(strokeColor, theme) : void 0,
|
|
@@ -47,7 +48,7 @@ const getLabel = (labelsType, valueFormatter) => ({ x, y, cx, cy, percent, value
|
|
|
47
48
|
});
|
|
48
49
|
const DonutChart = (0, _mantine_core.factory)((_props) => {
|
|
49
50
|
const props = (0, _mantine_core.useProps)("DonutChart", defaultProps, _props);
|
|
50
|
-
const { classNames, className, style, styles, unstyled, vars, data, withTooltip, withLegend, legendProps, tooltipAnimationDuration, tooltipProps, pieProps, paddingAngle, withLabels, withLabelsLine, size, thickness, strokeWidth, startAngle, endAngle, tooltipDataSource, chartLabel, children, pieChartProps, valueFormatter, strokeColor, labelsType, attributes, cellProps, ...others } = props;
|
|
51
|
+
const { classNames, className, style, styles, unstyled, vars, data, withTooltip, withLegend, legendProps, tooltipAnimationDuration, tooltipProps, pieProps, paddingAngle, withLabels, withLabelsLine, size, thickness, strokeWidth, startAngle, endAngle, tooltipDataSource, chartLabel, children, pieChartProps, valueFormatter, strokeColor, labelsType, attributes, cellProps, accessibilityLayer, ...others } = props;
|
|
51
52
|
const theme = (0, _mantine_core.useMantineTheme)();
|
|
52
53
|
const [highlightedIndex, setHighlightedIndex] = (0, react.useState)(null);
|
|
53
54
|
const getStyles = (0, _mantine_core.useStyles)({
|
|
@@ -80,6 +81,7 @@ const DonutChart = (0, _mantine_core.factory)((_props) => {
|
|
|
80
81
|
...getStyles("root"),
|
|
81
82
|
...others,
|
|
82
83
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ResponsiveContainer, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.PieChart, {
|
|
84
|
+
accessibilityLayer,
|
|
83
85
|
...pieChartProps,
|
|
84
86
|
children: [
|
|
85
87
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Pie, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.cjs","names":["getPieChartData","Box","ResponsiveContainer","ReChartsPieChart","Pie","Tooltip","ChartTooltip","Legend","ChartLegend","classes"],"sources":["../../src/DonutChart/DonutChart.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n Legend,\n LegendProps,\n Pie,\n PieLabel,\n PieProps,\n PieChart as ReChartsPieChart,\n ResponsiveContainer,\n Tooltip,\n TooltipProps,\n} from 'recharts';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n rem,\n StylesApiProps,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { ChartLegend, ChartLegendStylesNames } from '../ChartLegend';\nimport { ChartTooltip, ChartTooltipStylesNames } from '../ChartTooltip/ChartTooltip';\nimport { getPieChartData } from '../utils';\nimport classes from './DonutChart.module.css';\n\nexport interface DonutChartCell {\n name: string;\n value: number;\n color: MantineColor;\n}\n\nexport type DonutChartStylesNames =\n | 'root'\n | 'label'\n | ChartTooltipStylesNames\n | ChartLegendStylesNames;\nexport type DonutChartCssVariables = {\n root: '--chart-stroke-color' | '--chart-labels-color' | '--chart-size';\n};\n\nexport interface DonutChartProps\n extends BoxProps, StylesApiProps<DonutChartFactory>, ElementProps<'div'> {\n /** Data used to render chart */\n data: DonutChartCell[];\n\n /** Determines whether the tooltip should be displayed when one of the section is hovered @default true */\n withTooltip?: boolean;\n\n /** Determines whether the legend should be displayed @default false */\n withLegend?: boolean;\n\n /** Props passed down to recharts `Legend` component */\n legendProps?: Omit<LegendProps, 'ref'>;\n\n /** Tooltip animation duration in ms @default 0 */\n tooltipAnimationDuration?: number;\n\n /** Props passed down to `Tooltip` recharts component */\n tooltipProps?: Omit<TooltipProps<any, any>, 'ref'>;\n\n /** Props passed down to recharts `Pie` component */\n pieProps?: Partial<Omit<PieProps, 'ref'>>;\n\n /** Controls color of the segments stroke, by default depends on color scheme */\n strokeColor?: MantineColor;\n\n /** Controls text color of all labels, by default depends on color scheme */\n labelColor?: MantineColor;\n\n /** Controls padding between segments @default 0 */\n paddingAngle?: number;\n\n /** Determines whether each segment should have associated label @default false */\n withLabels?: boolean;\n\n /** Determines whether segments labels should have lines that connect the segment with the label @default true */\n withLabelsLine?: boolean;\n\n /** Controls thickness of the chart segments @default 20 */\n thickness?: number;\n\n /** Controls chart width and height, height is increased by 40 if `withLabels` prop is set. Cannot be less than `thickness`. @default 80 */\n size?: number;\n\n /** Controls width of segments stroke @default 1 */\n strokeWidth?: number;\n\n /** Controls angle at which chart starts. Set to `180` to render the chart as semicircle. @default 0 */\n startAngle?: number;\n\n /** Controls angle at which charts ends. Set to `0` to render the chart as semicircle. @default 360 */\n endAngle?: number;\n\n /** Determines which data is displayed in the tooltip. `'all'` – display all values, `'segment'` – display only hovered segment. @default 'all' */\n tooltipDataSource?: 'segment' | 'all';\n\n /** Chart label, displayed in the center of the chart */\n chartLabel?: string | number;\n\n /** Additional elements rendered inside `PieChart` component */\n children?: React.ReactNode;\n\n /** Props passed down to recharts `PieChart` component */\n pieChartProps?: React.ComponentProps<typeof ReChartsPieChart>;\n\n /** Type of labels to display, `'value'` by default */\n labelsType?: 'value' | 'percent' | 'name';\n\n /** A function to format values inside the tooltip */\n valueFormatter?: (value: number) => string;\n\n /** Props passed down to each segment of the chart */\n cellProps?:\n | ((series: DonutChartCell) => Partial<Omit<React.SVGProps<SVGElement>, 'ref'>>)\n | Partial<Omit<React.SVGProps<SVGElement>, 'ref'>>;\n}\n\nexport type DonutChartFactory = Factory<{\n props: DonutChartProps;\n ref: HTMLDivElement;\n stylesNames: DonutChartStylesNames;\n vars: DonutChartCssVariables;\n}>;\n\nconst defaultProps = {\n withTooltip: true,\n withLabelsLine: true,\n paddingAngle: 0,\n thickness: 20,\n size: 160,\n strokeWidth: 1,\n startAngle: 0,\n endAngle: 360,\n labelsType: 'value',\n tooltipDataSource: 'all',\n} satisfies Partial<DonutChartProps>;\n\nconst varsResolver = createVarsResolver<DonutChartFactory>(\n (theme, { strokeColor, labelColor, withLabels, withLegend, size }) => ({\n root: {\n '--chart-stroke-color': strokeColor ? getThemeColor(strokeColor, theme) : undefined,\n '--chart-labels-color': labelColor ? getThemeColor(labelColor, theme) : undefined,\n '--chart-size': rem(size! + (withLabels ? 80 : 0) + (withLegend ? 80 : 0)),\n },\n })\n);\n\nconst getLabelValue = (\n labelsType: DonutChartProps['labelsType'],\n value: number | undefined,\n percent: number | undefined,\n name: string | undefined,\n valueFormatter?: DonutChartProps['valueFormatter']\n) => {\n if (labelsType === 'name') {\n return name;\n }\n\n if (labelsType === 'percent') {\n return `${((percent || 0) * 100).toFixed(0)}%`;\n }\n\n if (typeof valueFormatter === 'function') {\n return valueFormatter(value || 0);\n }\n\n return value;\n};\n\nconst getLabel =\n (\n labelsType: 'value' | 'percent' | 'name',\n valueFormatter?: DonutChartProps['valueFormatter']\n ): PieLabel =>\n ({ x, y, cx, cy, percent, value, name }) => (\n <text\n x={x}\n y={y}\n cx={cx}\n cy={cy}\n textAnchor={x > Number(cx) ? 'start' : 'end'}\n fill=\"var(--chart-labels-color, var(--mantine-color-dimmed))\"\n fontFamily=\"var(--mantine-font-family)\"\n fontSize={12}\n >\n <tspan x={x}>\n {getLabelValue(labelsType, Number(value), Number(percent), name as string, valueFormatter)}\n </tspan>\n </text>\n );\n\nexport const DonutChart = factory<DonutChartFactory>((_props) => {\n const props = useProps('DonutChart', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n data,\n withTooltip,\n withLegend,\n legendProps,\n tooltipAnimationDuration,\n tooltipProps,\n pieProps,\n paddingAngle,\n withLabels,\n withLabelsLine,\n size,\n thickness,\n strokeWidth,\n startAngle,\n endAngle,\n tooltipDataSource,\n chartLabel,\n children,\n pieChartProps,\n valueFormatter,\n strokeColor,\n labelsType,\n attributes,\n cellProps,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n const [highlightedIndex, setHighlightedIndex] = useState<number | null>(null);\n\n const getStyles = useStyles<DonutChartFactory>({\n name: 'DonutChart',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<DonutChartFactory>({\n classNames,\n styles,\n props,\n });\n\n const pieData = getPieChartData({ data, theme, strokeWidth, highlightedIndex, cellProps });\n\n return (\n <Box size={size} {...getStyles('root')} {...others}>\n <ResponsiveContainer>\n <ReChartsPieChart {...pieChartProps}>\n <Pie\n data={pieData as any}\n innerRadius={size / 2 - thickness}\n outerRadius={size / 2}\n dataKey=\"value\"\n isAnimationActive={false}\n paddingAngle={paddingAngle}\n startAngle={startAngle}\n endAngle={endAngle}\n label={withLabels ? getLabel(labelsType || 'value', valueFormatter) : false}\n labelLine={\n withLabelsLine\n ? {\n stroke: 'var(--chart-label-color, var(--mantine-color-dimmed))',\n strokeWidth: 1,\n }\n : false\n }\n {...pieProps}\n />\n\n {chartLabel && (\n <text\n x=\"50%\"\n y=\"50%\"\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n {...getStyles('label')}\n >\n {chartLabel}\n </text>\n )}\n\n {withTooltip && (\n <Tooltip\n animationDuration={tooltipAnimationDuration}\n isAnimationActive={false}\n content={({ payload }) => (\n <ChartTooltip\n payload={data}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n type=\"radial\"\n segmentId={\n tooltipDataSource === 'segment'\n ? (payload?.[0]?.payload?.__segmentIndex as number)\n : undefined\n }\n valueFormatter={valueFormatter}\n attributes={attributes}\n />\n )}\n {...tooltipProps}\n />\n )}\n\n {withLegend && (\n <Legend\n verticalAlign=\"bottom\"\n content={(payload) => (\n <ChartLegend\n payload={payload.payload?.map((item) => ({\n ...item,\n dataKey: (item.payload as any)?.name,\n highlightKey: (item.payload as any)?.__segmentIndex,\n }))}\n onHighlight={(value) =>\n setHighlightedIndex(typeof value === 'number' ? value : null)\n }\n legendPosition={legendProps?.verticalAlign || 'bottom'}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n centered\n attributes={attributes}\n />\n )}\n {...legendProps}\n />\n )}\n\n {children}\n </ReChartsPieChart>\n </ResponsiveContainer>\n </Box>\n );\n});\n\nDonutChart.displayName = '@mantine/charts/DonutChart';\nDonutChart.classes = classes;\nDonutChart.varsResolver = varsResolver;\n\nexport namespace DonutChart {\n export type Props = DonutChartProps;\n export type StylesNames = DonutChartStylesNames;\n export type Factory = DonutChartFactory;\n export type CssVariables = DonutChartCssVariables;\n export type Cell = DonutChartCell;\n}\n"],"mappings":";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B;KACnB,mBAAmB;KACnB,UAAU,EAAE,cACV,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,cAAD;MACE,SAAS;MACT,YAAY;MACZ,QAAQ;MACR,MAAK;MACL,WACE,sBAAsB,YACjB,UAAU,EAAE,EAAE,SAAS,iBACxB,KAAA;MAEU;MACJ;KACb,CAAA;KAEH,GAAI;IACL,CAAA;IAGF,cACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,SAAAA,QAAD;KACE,eAAc;KACd,UAAU,YACR,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,aAAD;MACE,SAAS,QAAQ,SAAS,KAAK,UAAU;OACvC,GAAG;OACH,SAAU,KAAK,SAAiB;OAChC,cAAe,KAAK,SAAiB;MACvC,EAAE;MACF,cAAc,UACZ,oBAAoB,OAAO,UAAU,WAAW,QAAQ,IAAI;MAE9D,gBAAgB,aAAa,iBAAiB;MAC9C,YAAY;MACZ,QAAQ;MACR,UAAA;MACY;KACb,CAAA;KAEH,GAAI;IACL,CAAA;IAGF;GACe;KACC,CAAA;CAClB,CAAA;AAET,CAAC;AAED,WAAW,cAAc;AACzB,WAAW,UAAUC,0BAAAA;AACrB,WAAW,eAAe"}
|
|
1
|
+
{"version":3,"file":"DonutChart.cjs","names":["getPieChartData","Box","ResponsiveContainer","ReChartsPieChart","Pie","Tooltip","ChartTooltip","Legend","ChartLegend","classes"],"sources":["../../src/DonutChart/DonutChart.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n Legend,\n LegendProps,\n Pie,\n PieLabel,\n PieProps,\n PieChart as ReChartsPieChart,\n ResponsiveContainer,\n Tooltip,\n TooltipProps,\n} from 'recharts';\nimport {\n Box,\n BoxProps,\n createVarsResolver,\n ElementProps,\n factory,\n Factory,\n getThemeColor,\n MantineColor,\n rem,\n StylesApiProps,\n useMantineTheme,\n useProps,\n useResolvedStylesApi,\n useStyles,\n} from '@mantine/core';\nimport { ChartLegend, ChartLegendStylesNames } from '../ChartLegend';\nimport { ChartTooltip, ChartTooltipStylesNames } from '../ChartTooltip/ChartTooltip';\nimport { getPieChartData } from '../utils';\nimport classes from './DonutChart.module.css';\n\nexport interface DonutChartCell {\n name: string;\n value: number;\n color: MantineColor;\n}\n\nexport type DonutChartStylesNames =\n | 'root'\n | 'label'\n | ChartTooltipStylesNames\n | ChartLegendStylesNames;\nexport type DonutChartCssVariables = {\n root: '--chart-stroke-color' | '--chart-labels-color' | '--chart-size';\n};\n\nexport interface DonutChartProps\n extends BoxProps, StylesApiProps<DonutChartFactory>, ElementProps<'div'> {\n /** Data used to render chart */\n data: DonutChartCell[];\n\n /** Determines whether the tooltip should be displayed when one of the section is hovered @default true */\n withTooltip?: boolean;\n\n /** Determines whether the legend should be displayed @default false */\n withLegend?: boolean;\n\n /** Props passed down to recharts `Legend` component */\n legendProps?: Omit<LegendProps, 'ref'>;\n\n /** Tooltip animation duration in ms @default 0 */\n tooltipAnimationDuration?: number;\n\n /** Props passed down to `Tooltip` recharts component */\n tooltipProps?: Omit<TooltipProps<any, any>, 'ref'>;\n\n /** Props passed down to recharts `Pie` component */\n pieProps?: Partial<Omit<PieProps, 'ref'>>;\n\n /** Controls color of the segments stroke, by default depends on color scheme */\n strokeColor?: MantineColor;\n\n /** Controls text color of all labels, by default depends on color scheme */\n labelColor?: MantineColor;\n\n /** Controls padding between segments @default 0 */\n paddingAngle?: number;\n\n /** Determines whether each segment should have associated label @default false */\n withLabels?: boolean;\n\n /** Determines whether segments labels should have lines that connect the segment with the label @default true */\n withLabelsLine?: boolean;\n\n /** Controls thickness of the chart segments @default 20 */\n thickness?: number;\n\n /** Controls chart width and height, height is increased by 40 if `withLabels` prop is set. Cannot be less than `thickness`. @default 80 */\n size?: number;\n\n /** Controls width of segments stroke @default 1 */\n strokeWidth?: number;\n\n /** Controls angle at which chart starts. Set to `180` to render the chart as semicircle. @default 0 */\n startAngle?: number;\n\n /** Controls angle at which charts ends. Set to `0` to render the chart as semicircle. @default 360 */\n endAngle?: number;\n\n /** Determines which data is displayed in the tooltip. `'all'` – display all values, `'segment'` – display only hovered segment. @default 'all' */\n tooltipDataSource?: 'segment' | 'all';\n\n /** Chart label, displayed in the center of the chart */\n chartLabel?: string | number;\n\n /** Additional elements rendered inside `PieChart` component */\n children?: React.ReactNode;\n\n /** Props passed down to recharts `PieChart` component */\n pieChartProps?: React.ComponentProps<typeof ReChartsPieChart>;\n\n /** Type of labels to display, `'value'` by default */\n labelsType?: 'value' | 'percent' | 'name';\n\n /** A function to format values inside the tooltip */\n valueFormatter?: (value: number) => string;\n\n /** Props passed down to each segment of the chart */\n cellProps?:\n | ((series: DonutChartCell) => Partial<Omit<React.SVGProps<SVGElement>, 'ref'>>)\n | Partial<Omit<React.SVGProps<SVGElement>, 'ref'>>;\n\n /** Determines whether the chart should be keyboard-navigable with the recharts accessibility layer, `true` by default */\n accessibilityLayer?: boolean;\n}\n\nexport type DonutChartFactory = Factory<{\n props: DonutChartProps;\n ref: HTMLDivElement;\n stylesNames: DonutChartStylesNames;\n vars: DonutChartCssVariables;\n}>;\n\nconst defaultProps = {\n withTooltip: true,\n withLabelsLine: true,\n paddingAngle: 0,\n thickness: 20,\n size: 160,\n strokeWidth: 1,\n startAngle: 0,\n endAngle: 360,\n labelsType: 'value',\n tooltipDataSource: 'all',\n accessibilityLayer: true,\n} satisfies Partial<DonutChartProps>;\n\nconst varsResolver = createVarsResolver<DonutChartFactory>(\n (theme, { strokeColor, labelColor, withLabels, withLegend, size }) => ({\n root: {\n '--chart-stroke-color': strokeColor ? getThemeColor(strokeColor, theme) : undefined,\n '--chart-labels-color': labelColor ? getThemeColor(labelColor, theme) : undefined,\n '--chart-size': rem(size! + (withLabels ? 80 : 0) + (withLegend ? 80 : 0)),\n },\n })\n);\n\nconst getLabelValue = (\n labelsType: DonutChartProps['labelsType'],\n value: number | undefined,\n percent: number | undefined,\n name: string | undefined,\n valueFormatter?: DonutChartProps['valueFormatter']\n) => {\n if (labelsType === 'name') {\n return name;\n }\n\n if (labelsType === 'percent') {\n return `${((percent || 0) * 100).toFixed(0)}%`;\n }\n\n if (typeof valueFormatter === 'function') {\n return valueFormatter(value || 0);\n }\n\n return value;\n};\n\nconst getLabel =\n (\n labelsType: 'value' | 'percent' | 'name',\n valueFormatter?: DonutChartProps['valueFormatter']\n ): PieLabel =>\n ({ x, y, cx, cy, percent, value, name }) => (\n <text\n x={x}\n y={y}\n cx={cx}\n cy={cy}\n textAnchor={x > Number(cx) ? 'start' : 'end'}\n fill=\"var(--chart-labels-color, var(--mantine-color-dimmed))\"\n fontFamily=\"var(--mantine-font-family)\"\n fontSize={12}\n >\n <tspan x={x}>\n {getLabelValue(labelsType, Number(value), Number(percent), name as string, valueFormatter)}\n </tspan>\n </text>\n );\n\nexport const DonutChart = factory<DonutChartFactory>((_props) => {\n const props = useProps('DonutChart', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n data,\n withTooltip,\n withLegend,\n legendProps,\n tooltipAnimationDuration,\n tooltipProps,\n pieProps,\n paddingAngle,\n withLabels,\n withLabelsLine,\n size,\n thickness,\n strokeWidth,\n startAngle,\n endAngle,\n tooltipDataSource,\n chartLabel,\n children,\n pieChartProps,\n valueFormatter,\n strokeColor,\n labelsType,\n attributes,\n cellProps,\n accessibilityLayer,\n ...others\n } = props;\n\n const theme = useMantineTheme();\n const [highlightedIndex, setHighlightedIndex] = useState<number | null>(null);\n\n const getStyles = useStyles<DonutChartFactory>({\n name: 'DonutChart',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n varsResolver,\n });\n\n const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<DonutChartFactory>({\n classNames,\n styles,\n props,\n });\n\n const pieData = getPieChartData({ data, theme, strokeWidth, highlightedIndex, cellProps });\n\n return (\n <Box size={size} {...getStyles('root')} {...others}>\n <ResponsiveContainer>\n <ReChartsPieChart accessibilityLayer={accessibilityLayer} {...pieChartProps}>\n <Pie\n data={pieData as any}\n innerRadius={size / 2 - thickness}\n outerRadius={size / 2}\n dataKey=\"value\"\n isAnimationActive={false}\n paddingAngle={paddingAngle}\n startAngle={startAngle}\n endAngle={endAngle}\n label={withLabels ? getLabel(labelsType || 'value', valueFormatter) : false}\n labelLine={\n withLabelsLine\n ? {\n stroke: 'var(--chart-label-color, var(--mantine-color-dimmed))',\n strokeWidth: 1,\n }\n : false\n }\n {...pieProps}\n />\n\n {chartLabel && (\n <text\n x=\"50%\"\n y=\"50%\"\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n {...getStyles('label')}\n >\n {chartLabel}\n </text>\n )}\n\n {withTooltip && (\n <Tooltip\n animationDuration={tooltipAnimationDuration}\n isAnimationActive={false}\n content={({ payload }) => (\n <ChartTooltip\n payload={data}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n type=\"radial\"\n segmentId={\n tooltipDataSource === 'segment'\n ? (payload?.[0]?.payload?.__segmentIndex as number)\n : undefined\n }\n valueFormatter={valueFormatter}\n attributes={attributes}\n />\n )}\n {...tooltipProps}\n />\n )}\n\n {withLegend && (\n <Legend\n verticalAlign=\"bottom\"\n content={(payload) => (\n <ChartLegend\n payload={payload.payload?.map((item) => ({\n ...item,\n dataKey: (item.payload as any)?.name,\n highlightKey: (item.payload as any)?.__segmentIndex,\n }))}\n onHighlight={(value) =>\n setHighlightedIndex(typeof value === 'number' ? value : null)\n }\n legendPosition={legendProps?.verticalAlign || 'bottom'}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n centered\n attributes={attributes}\n />\n )}\n {...legendProps}\n />\n )}\n\n {children}\n </ReChartsPieChart>\n </ResponsiveContainer>\n </Box>\n );\n});\n\nDonutChart.displayName = '@mantine/charts/DonutChart';\nDonutChart.classes = classes;\nDonutChart.varsResolver = varsResolver;\n\nexport namespace DonutChart {\n export type Props = DonutChartProps;\n export type StylesNames = DonutChartStylesNames;\n export type Factory = DonutChartFactory;\n export type CssVariables = DonutChartCssVariables;\n export type Cell = DonutChartCell;\n}\n"],"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AA,CAACC,SAAAA,SAAD;KACE,mBAAmB;KACnB,mBAAmB;KACnB,UAAU,EAAE,cACV,iBAAA,GAAA,kBAAA,IAAA,CAACC,qBAAAA,cAAD;MACE,SAAS;MACT,YAAY;MACZ,QAAQ;MACR,MAAK;MACL,WACE,sBAAsB,YACjB,UAAU,EAAE,EAAE,SAAS,iBACxB,KAAA;MAEU;MACJ;KACb,CAAA;KAEH,GAAI;IACL,CAAA;IAGF,cACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,SAAAA,QAAD;KACE,eAAc;KACd,UAAU,YACR,iBAAA,GAAA,kBAAA,IAAA,CAACC,oBAAAA,aAAD;MACE,SAAS,QAAQ,SAAS,KAAK,UAAU;OACvC,GAAG;OACH,SAAU,KAAK,SAAiB;OAChC,cAAe,KAAK,SAAiB;MACvC,EAAE;MACF,cAAc,UACZ,oBAAoB,OAAO,UAAU,WAAW,QAAQ,IAAI;MAE9D,gBAAgB,aAAa,iBAAiB;MAC9C,YAAY;MACZ,QAAQ;MACR,UAAA;MACY;KACb,CAAA;KAEH,GAAI;IACL,CAAA;IAGF;GACe;KACC,CAAA;CAClB,CAAA;AAET,CAAC;AAED,WAAW,cAAc;AACzB,WAAW,UAAUC,0BAAAA;AACrB,WAAW,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.module.cjs","names":[],"sources":["../../src/DonutChart/DonutChart.module.css"],"sourcesContent":[".root {\n min-height: var(--chart-size, auto);\n height: var(--chart-size, auto);\n width: var(--chart-size, auto);\n min-width: var(--chart-size, auto);\n\n & :where(*) {\n outline: 0;\n }\n\n & :where(:global(.recharts-surface)) {\n overflow: visible;\n }\n}\n\n.label {\n fill: var(--mantine-color-text);\n font-size: var(--mantine-font-size-sm);\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"DonutChart.module.cjs","names":[],"sources":["../../src/DonutChart/DonutChart.module.css"],"sourcesContent":[".root {\n min-height: var(--chart-size, auto);\n height: var(--chart-size, auto);\n width: var(--chart-size, auto);\n min-width: var(--chart-size, auto);\n\n & :where(*) {\n outline: 0;\n }\n\n & :where(:global(.recharts-surface)) {\n overflow: visible;\n }\n\n svg:focus-visible {\n outline: 2px solid var(--mantine-primary-color-filled);\n outline-offset: 2px;\n }\n}\n\n.label {\n fill: var(--mantine-color-text);\n font-size: var(--mantine-font-size-sm);\n}\n"],"mappings":""}
|
|
@@ -4,8 +4,8 @@ const require_ChartLegend = require("../ChartLegend/ChartLegend.cjs");
|
|
|
4
4
|
const require_FunnelChart_module = require("./FunnelChart.module.cjs");
|
|
5
5
|
let _mantine_core = require("@mantine/core");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
let react = require("react");
|
|
8
7
|
let recharts = require("recharts");
|
|
8
|
+
let react = require("react");
|
|
9
9
|
//#region packages/@mantine/charts/src/FunnelChart/FunnelChart.tsx
|
|
10
10
|
const defaultProps = {
|
|
11
11
|
withTooltip: true,
|
|
@@ -13,7 +13,8 @@ const defaultProps = {
|
|
|
13
13
|
strokeWidth: 1,
|
|
14
14
|
withLabels: false,
|
|
15
15
|
labelsPosition: "right",
|
|
16
|
-
tooltipDataSource: "all"
|
|
16
|
+
tooltipDataSource: "all",
|
|
17
|
+
accessibilityLayer: true
|
|
17
18
|
};
|
|
18
19
|
const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { strokeColor, labelColor, size }) => ({ root: {
|
|
19
20
|
"--chart-stroke-color": strokeColor ? (0, _mantine_core.getThemeColor)(strokeColor, theme) : void 0,
|
|
@@ -22,7 +23,7 @@ const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { strokeColor
|
|
|
22
23
|
} }));
|
|
23
24
|
const FunnelChart = (0, _mantine_core.factory)((_props) => {
|
|
24
25
|
const props = (0, _mantine_core.useProps)("FunnelChart", defaultProps, _props);
|
|
25
|
-
const { classNames, className, style, styles, unstyled, vars, data, withTooltip, withLegend, legendProps, tooltipAnimationDuration, tooltipProps, strokeWidth, withLabels, size, valueFormatter, children, funnelChartProps, funnelProps, labelsPosition, tooltipDataSource, strokeColor, labelColor, attributes, ...others } = props;
|
|
26
|
+
const { classNames, className, style, styles, unstyled, vars, data, withTooltip, withLegend, legendProps, tooltipAnimationDuration, tooltipProps, strokeWidth, withLabels, size, valueFormatter, children, funnelChartProps, funnelProps, labelsPosition, tooltipDataSource, strokeColor, labelColor, attributes, accessibilityLayer, ...others } = props;
|
|
26
27
|
const theme = (0, _mantine_core.useMantineTheme)();
|
|
27
28
|
const [highlightedIndex, setHighlightedIndex] = (0, react.useState)(null);
|
|
28
29
|
const getStyles = (0, _mantine_core.useStyles)({
|
|
@@ -48,6 +49,7 @@ const FunnelChart = (0, _mantine_core.factory)((_props) => {
|
|
|
48
49
|
...getStyles("root"),
|
|
49
50
|
...others,
|
|
50
51
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.ResponsiveContainer, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(recharts.FunnelChart, {
|
|
52
|
+
accessibilityLayer,
|
|
51
53
|
...funnelChartProps,
|
|
52
54
|
children: [
|
|
53
55
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(recharts.Funnel, {
|