@mui/x-charts 8.0.0-alpha.6 → 8.0.0-alpha.7
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/BarChart/AnimatedBarElement.js +1 -0
- package/BarChart/BarChart.js +17 -7
- package/BarChart/BarLabel/BarLabel.d.ts +1 -479
- package/BarChart/BarLabel/barLabelClasses.d.ts +1 -1
- package/BarChart/legend.js +1 -0
- package/BarChart/useBarChartProps.d.ts +4 -2
- package/BarChart/useBarChartProps.js +16 -3
- package/CHANGELOG.md +127 -1
- package/ChartsLabel/ChartsLabel.d.ts +2 -3
- package/ChartsLabel/ChartsLabel.js +3 -18
- package/ChartsLabel/ChartsLabelGradient.d.ts +9 -8
- package/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/ChartsLabel/ChartsLabelMark.d.ts +2 -3
- package/ChartsLabel/ChartsLabelMark.js +5 -2
- package/ChartsLabel/index.d.ts +7 -0
- package/ChartsLabel/index.js +6 -0
- package/ChartsLabel/labelClasses.d.ts +0 -1
- package/ChartsLabel/labelGradientClasses.d.ts +5 -4
- package/ChartsLabel/labelGradientClasses.js +3 -2
- package/ChartsLabel/labelMarkClasses.d.ts +3 -2
- package/ChartsLabel/labelMarkClasses.js +3 -2
- package/ChartsLabel/package.json +6 -0
- package/ChartsLegend/ChartsLegend.d.ts +18 -22
- package/ChartsLegend/ChartsLegend.js +100 -109
- package/ChartsLegend/ContinuousColorLegend.d.ts +29 -38
- package/ChartsLegend/ContinuousColorLegend.js +198 -321
- package/ChartsLegend/PiecewiseColorLegend.d.ts +27 -19
- package/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/ChartsLegend/chartsLegend.types.d.ts +17 -60
- package/ChartsLegend/chartsLegendClasses.d.ts +7 -8
- package/ChartsLegend/chartsLegendClasses.js +16 -2
- package/ChartsLegend/colorLegend.types.d.ts +13 -0
- package/ChartsLegend/colorLegend.types.js +1 -0
- package/ChartsLegend/continuousColorLegendClasses.d.ts +26 -0
- package/ChartsLegend/continuousColorLegendClasses.js +23 -0
- package/ChartsLegend/direction.d.ts +1 -0
- package/ChartsLegend/direction.js +1 -0
- package/ChartsLegend/index.d.ts +13 -3
- package/ChartsLegend/index.js +9 -3
- package/ChartsLegend/legend.types.d.ts +10 -54
- package/ChartsLegend/legendContext.types.d.ts +55 -0
- package/ChartsLegend/legendContext.types.js +1 -0
- package/ChartsLegend/onClickContextBuilder.d.ts +2 -0
- package/ChartsLegend/onClickContextBuilder.js +7 -0
- package/ChartsLegend/piecewiseColorDefaultLabelFormatter.d.ts +2 -0
- package/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +9 -0
- package/ChartsLegend/piecewiseColorLegend.types.d.ts +26 -0
- package/ChartsLegend/piecewiseColorLegend.types.js +1 -0
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +28 -0
- package/ChartsLegend/piecewiseColorLegendClasses.js +23 -0
- package/ChartsLegend/useAxis.d.ts +1 -1
- package/ChartsLegend/useAxis.js +0 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/ChartsSurface/ChartsSurface.js +0 -1
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/LineChart/AnimatedArea.js +1 -0
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/AppearingMask.js +1 -0
- package/LineChart/CircleMarkElement.js +1 -0
- package/LineChart/LineChart.js +20 -10
- package/LineChart/MarkElement.js +3 -1
- package/LineChart/legend.js +1 -0
- package/LineChart/useLineChartProps.d.ts +4 -2
- package/LineChart/useLineChartProps.js +15 -2
- package/PieChart/PieArc.js +3 -1
- package/PieChart/PieArcLabel.js +13 -9
- package/PieChart/PieArcLabelPlot.js +1 -0
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.js +42 -41
- package/PieChart/legend.js +1 -0
- package/ScatterChart/ScatterChart.js +21 -11
- package/ScatterChart/legend.js +1 -0
- package/ScatterChart/useScatterChartProps.d.ts +4 -2
- package/ScatterChart/useScatterChartProps.js +15 -2
- package/SparkLineChart/SparkLineChart.js +1 -4
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -9
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +18 -18
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -9
- package/context/ChartProvider/ChartProvider.types.d.ts +1 -1
- package/context/InteractionSelectors.d.ts +11 -11
- package/context/PluginProvider/SeriesFormatter.types.d.ts +1 -1
- package/context/PluginProvider/mergePlugins.d.ts +8 -8
- package/context/SizeProvider/Size.types.d.ts +1 -1
- package/context/SizeProvider/useChartContainerDimensions.d.ts +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useLegend.d.ts +13 -0
- package/{modern/ChartsLegend/utils.js → hooks/useLegend.js} +20 -1
- package/hooks/useSvgRef.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/internals/calculateMargins.d.ts +7 -0
- package/internals/calculateMargins.js +25 -0
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +60 -16
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.d.ts +13 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +61 -0
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +17 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.js +66 -0
- package/internals/components/ChartsWrapper/index.d.ts +1 -0
- package/internals/components/ChartsWrapper/index.js +1 -0
- package/internals/consumeSlots.d.ts +48 -0
- package/internals/consumeSlots.js +101 -0
- package/internals/consumeThemeProps.d.ts +3 -7
- package/internals/consumeThemeProps.js +18 -27
- package/internals/defaultizeColor.d.ts +6 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +11 -11
- package/internals/plugins/models/plugin.d.ts +1 -1
- package/internals/store/useCharts.d.ts +2 -2
- package/internals/store/useCharts.types.d.ts +1 -1
- package/models/seriesType/common.d.ts +9 -0
- package/models/seriesType/pie.d.ts +9 -0
- package/modern/BarChart/AnimatedBarElement.js +1 -0
- package/modern/BarChart/BarChart.js +17 -7
- package/modern/BarChart/legend.js +1 -0
- package/modern/BarChart/useBarChartProps.js +16 -3
- package/modern/ChartsLabel/ChartsLabel.js +3 -18
- package/modern/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/modern/ChartsLabel/ChartsLabelMark.js +5 -2
- package/modern/ChartsLabel/index.js +6 -0
- package/modern/ChartsLabel/labelGradientClasses.js +3 -2
- package/modern/ChartsLabel/labelMarkClasses.js +3 -2
- package/modern/ChartsLegend/ChartsLegend.js +100 -109
- package/modern/ChartsLegend/ContinuousColorLegend.js +198 -321
- package/modern/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/modern/ChartsLegend/chartsLegendClasses.js +16 -2
- package/modern/ChartsLegend/colorLegend.types.js +1 -0
- package/modern/ChartsLegend/continuousColorLegendClasses.js +23 -0
- package/modern/ChartsLegend/direction.js +1 -0
- package/modern/ChartsLegend/index.js +9 -3
- package/modern/ChartsLegend/legendContext.types.js +1 -0
- package/modern/ChartsLegend/onClickContextBuilder.js +7 -0
- package/modern/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +9 -0
- package/modern/ChartsLegend/piecewiseColorLegend.types.js +1 -0
- package/modern/ChartsLegend/piecewiseColorLegendClasses.js +23 -0
- package/modern/ChartsLegend/useAxis.js +0 -1
- package/modern/ChartsSurface/ChartsSurface.js +0 -1
- package/modern/LineChart/AnimatedArea.js +1 -0
- package/modern/LineChart/AnimatedLine.js +1 -0
- package/modern/LineChart/AppearingMask.js +1 -0
- package/modern/LineChart/CircleMarkElement.js +1 -0
- package/modern/LineChart/LineChart.js +20 -10
- package/modern/LineChart/MarkElement.js +3 -1
- package/modern/LineChart/legend.js +1 -0
- package/modern/LineChart/useLineChartProps.js +15 -2
- package/modern/PieChart/PieArc.js +3 -1
- package/modern/PieChart/PieArcLabel.js +13 -9
- package/modern/PieChart/PieArcLabelPlot.js +1 -0
- package/modern/PieChart/PieArcPlot.js +1 -0
- package/modern/PieChart/PieChart.js +42 -41
- package/modern/PieChart/legend.js +1 -0
- package/modern/ScatterChart/ScatterChart.js +21 -11
- package/modern/ScatterChart/legend.js +1 -0
- package/modern/ScatterChart/useScatterChartProps.js +15 -2
- package/modern/SparkLineChart/SparkLineChart.js +1 -4
- package/modern/constants/index.js +2 -1
- package/modern/hooks/index.js +2 -1
- package/{ChartsLegend/utils.js → modern/hooks/useLegend.js} +20 -1
- package/modern/index.js +2 -1
- package/modern/internals/calculateMargins.js +25 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +60 -16
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +61 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/modern/internals/components/ChartsWrapper/ChartsWrapper.js +66 -0
- package/modern/internals/components/ChartsWrapper/index.js +1 -0
- package/modern/internals/consumeSlots.js +101 -0
- package/modern/internals/consumeThemeProps.js +18 -27
- package/modern/internals/index.js +1 -0
- package/node/BarChart/AnimatedBarElement.js +1 -0
- package/node/BarChart/BarChart.js +17 -7
- package/node/BarChart/legend.js +1 -0
- package/node/BarChart/useBarChartProps.js +15 -3
- package/node/ChartsLabel/ChartsLabel.js +3 -18
- package/node/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/node/ChartsLabel/ChartsLabelMark.js +5 -2
- package/node/ChartsLabel/index.js +26 -0
- package/node/ChartsLabel/labelGradientClasses.js +3 -2
- package/node/ChartsLabel/labelMarkClasses.js +3 -2
- package/node/ChartsLegend/ChartsLegend.js +99 -108
- package/node/ChartsLegend/ContinuousColorLegend.js +199 -322
- package/node/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/node/ChartsLegend/chartsLegendClasses.js +17 -3
- package/node/ChartsLegend/colorLegend.types.js +5 -0
- package/node/ChartsLegend/continuousColorLegendClasses.js +31 -0
- package/node/ChartsLegend/direction.js +5 -0
- package/node/ChartsLegend/index.js +80 -16
- package/node/ChartsLegend/legendContext.types.js +5 -0
- package/node/ChartsLegend/onClickContextBuilder.js +14 -0
- package/node/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +15 -0
- package/node/ChartsLegend/piecewiseColorLegend.types.js +5 -0
- package/node/ChartsLegend/piecewiseColorLegendClasses.js +31 -0
- package/node/ChartsSurface/ChartsSurface.js +0 -1
- package/node/LineChart/AnimatedArea.js +1 -0
- package/node/LineChart/AnimatedLine.js +1 -0
- package/node/LineChart/AppearingMask.js +1 -0
- package/node/LineChart/CircleMarkElement.js +1 -0
- package/node/LineChart/LineChart.js +20 -10
- package/node/LineChart/MarkElement.js +3 -1
- package/node/LineChart/legend.js +1 -0
- package/node/LineChart/useLineChartProps.js +14 -2
- package/node/PieChart/PieArc.js +3 -1
- package/node/PieChart/PieArcLabel.js +13 -9
- package/node/PieChart/PieArcLabelPlot.js +1 -0
- package/node/PieChart/PieArcPlot.js +1 -0
- package/node/PieChart/PieChart.js +42 -41
- package/node/PieChart/legend.js +1 -0
- package/node/ScatterChart/ScatterChart.js +21 -11
- package/node/ScatterChart/legend.js +1 -0
- package/node/ScatterChart/useScatterChartProps.js +14 -2
- package/node/SparkLineChart/SparkLineChart.js +1 -4
- package/node/constants/index.js +3 -2
- package/node/hooks/index.js +13 -1
- package/node/{ChartsLegend/utils.js → hooks/useLegend.js} +19 -1
- package/node/index.js +12 -1
- package/node/internals/calculateMargins.js +33 -0
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +61 -16
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +69 -0
- package/node/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/node/internals/components/ChartsWrapper/ChartsWrapper.js +72 -0
- package/node/internals/components/ChartsWrapper/index.js +16 -0
- package/node/internals/consumeSlots.js +109 -0
- package/node/internals/consumeThemeProps.js +18 -27
- package/node/internals/index.js +12 -0
- package/package.json +4 -4
- package/ChartsLegend/ChartsLegendItem.d.ts +0 -26
- package/ChartsLegend/ChartsLegendItem.js +0 -65
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -25
- package/ChartsLegend/DefaultChartsLegend.js +0 -112
- package/ChartsLegend/LegendPerItem.d.ts +0 -65
- package/ChartsLegend/LegendPerItem.js +0 -129
- package/ChartsLegend/legendItemsPlacement.d.ts +0 -3
- package/ChartsLegend/legendItemsPlacement.js +0 -72
- package/ChartsLegend/utils.d.ts +0 -2
- package/modern/ChartsLegend/ChartsLegendItem.js +0 -65
- package/modern/ChartsLegend/DefaultChartsLegend.js +0 -112
- package/modern/ChartsLegend/LegendPerItem.js +0 -129
- package/modern/ChartsLegend/legendItemsPlacement.js +0 -72
- package/node/ChartsLegend/ChartsLegendItem.js +0 -72
- package/node/ChartsLegend/DefaultChartsLegend.js +0 -118
- package/node/ChartsLegend/LegendPerItem.js +0 -137
- package/node/ChartsLegend/legendItemsPlacement.js +0 -79
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { useTheme, useThemeProps } from '@mui/material/styles';
|
|
3
3
|
import resolveProps from '@mui/utils/resolveProps';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import * as ReactIs from 'react-is';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* A higher order component that consumes and merges the theme `defaultProps` and handles the `classes` and renders the component.
|
|
@@ -50,30 +49,22 @@ import * as ReactIs from 'react-is';
|
|
|
50
49
|
* @param InComponent The component to render if the slot is not provided.
|
|
51
50
|
*/
|
|
52
51
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
53
|
-
export const consumeThemeProps = (name, options, InComponent) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
InComponent.displayName = name;
|
|
67
|
-
}
|
|
68
|
-
const OutComponent = ReactIs.isForwardRef(InComponent) ? InComponent :
|
|
69
|
-
/*#__PURE__*/
|
|
70
|
-
// InComponent needs to be a function that accepts `(props, ref)`
|
|
71
|
-
// @ts-expect-error
|
|
72
|
-
React.forwardRef(InComponent);
|
|
73
|
-
return /*#__PURE__*/_jsx(OutComponent, _extends({}, outProps, {
|
|
74
|
-
classes: classes,
|
|
75
|
-
ref: ref
|
|
76
|
-
}));
|
|
52
|
+
export const consumeThemeProps = (name, options, InComponent) => /*#__PURE__*/React.forwardRef(function ConsumeThemeInternal(props, ref) {
|
|
53
|
+
const themedProps = useThemeProps({
|
|
54
|
+
props,
|
|
55
|
+
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
56
|
+
name
|
|
57
|
+
});
|
|
58
|
+
const defaultProps = typeof options.defaultProps === 'function' ? options.defaultProps(themedProps) : options.defaultProps ?? {};
|
|
59
|
+
const outProps = resolveProps(defaultProps, themedProps);
|
|
60
|
+
const theme = useTheme();
|
|
61
|
+
const classes = options.classesResolver?.(outProps, theme);
|
|
62
|
+
const OutComponent = /*#__PURE__*/React.forwardRef(InComponent);
|
|
63
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
64
|
+
OutComponent.displayName = `consumeThemeProps(${name})`;
|
|
77
65
|
}
|
|
78
|
-
return /*#__PURE__*/
|
|
79
|
-
|
|
66
|
+
return /*#__PURE__*/_jsx(OutComponent, _extends({}, outProps, {
|
|
67
|
+
classes: classes,
|
|
68
|
+
ref: ref
|
|
69
|
+
}));
|
|
70
|
+
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AllSeriesType } from '../models/seriesType';
|
|
2
2
|
export declare function defaultizeColor(series: AllSeriesType, seriesIndex: number, colors?: string[]): {
|
|
3
3
|
data: {
|
|
4
|
-
color: string;
|
|
5
4
|
label?: string | ((location: "tooltip" | "legend" | "arc") => string) | undefined;
|
|
5
|
+
color: string;
|
|
6
|
+
labelMarkType?: "line" | "square" | "circle" | undefined;
|
|
6
7
|
value: number;
|
|
7
8
|
id?: import("..").PieItemId | undefined;
|
|
8
9
|
}[];
|
|
@@ -43,6 +44,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
43
44
|
color?: string;
|
|
44
45
|
valueFormatter?: import(".").SeriesValueFormatter<import("@mui/x-internals/types").MakeOptional<import("..").PieValueType, "id">> | undefined;
|
|
45
46
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
47
|
+
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
46
48
|
} | {
|
|
47
49
|
type: "bar";
|
|
48
50
|
data?: (number | null)[];
|
|
@@ -54,6 +56,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
54
56
|
color: string;
|
|
55
57
|
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
56
58
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
59
|
+
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
57
60
|
xAxisId?: string;
|
|
58
61
|
yAxisId?: string;
|
|
59
62
|
stack?: string;
|
|
@@ -75,6 +78,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
75
78
|
color: string;
|
|
76
79
|
valueFormatter?: import(".").SeriesValueFormatter<import("..").ScatterValueType | null> | undefined;
|
|
77
80
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
81
|
+
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
78
82
|
xAxisId?: string;
|
|
79
83
|
yAxisId?: string;
|
|
80
84
|
} | {
|
|
@@ -94,6 +98,7 @@ export declare function defaultizeColor(series: AllSeriesType, seriesIndex: numb
|
|
|
94
98
|
color: string;
|
|
95
99
|
valueFormatter?: import(".").SeriesValueFormatter<number | null> | undefined;
|
|
96
100
|
highlightScope?: Partial<import("..").HighlightScope>;
|
|
101
|
+
labelMarkType?: import("..").ChartsLabelMarkProps["type"];
|
|
97
102
|
xAxisId?: string;
|
|
98
103
|
yAxisId?: string;
|
|
99
104
|
stackOrder?: import("..").StackOrderType;
|
package/internals/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './components/ChartsAxesGradients';
|
|
2
|
+
export * from './components/ChartsWrapper';
|
|
2
3
|
export { useSeries } from '../hooks/useSeries';
|
|
3
4
|
export { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
4
5
|
export { useDrawingArea } from '../hooks/useDrawingArea';
|
package/internals/index.js
CHANGED
|
@@ -31,6 +31,6 @@ export declare const selectorChartId: ((state: import("./useChartId.types").UseC
|
|
|
31
31
|
dependencyRecomputations: () => number;
|
|
32
32
|
resetDependencyRecomputations: () => void;
|
|
33
33
|
} & {
|
|
34
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
35
34
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
35
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
36
36
|
};
|
package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts
CHANGED
|
@@ -28,8 +28,8 @@ export declare const selectorChartsInteractionItem: ((state: import("../../coreP
|
|
|
28
28
|
dependencyRecomputations: () => number;
|
|
29
29
|
resetDependencyRecomputations: () => void;
|
|
30
30
|
} & {
|
|
31
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
32
31
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
32
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
33
33
|
};
|
|
34
34
|
export declare const selectorChartsInteractionAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
35
35
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -59,8 +59,8 @@ export declare const selectorChartsInteractionAxis: ((state: import("../../coreP
|
|
|
59
59
|
dependencyRecomputations: () => number;
|
|
60
60
|
resetDependencyRecomputations: () => void;
|
|
61
61
|
} & {
|
|
62
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
63
62
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
63
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
64
64
|
};
|
|
65
65
|
export declare const selectorChartsInteractionXAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
66
66
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -102,8 +102,8 @@ export declare const selectorChartsInteractionXAxis: ((state: import("../../core
|
|
|
102
102
|
dependencyRecomputations: () => number;
|
|
103
103
|
resetDependencyRecomputations: () => void;
|
|
104
104
|
} & {
|
|
105
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
106
105
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
106
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
107
107
|
};
|
|
108
108
|
export declare const selectorChartsInteractionYAxis: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
109
109
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -145,8 +145,8 @@ export declare const selectorChartsInteractionYAxis: ((state: import("../../core
|
|
|
145
145
|
dependencyRecomputations: () => number;
|
|
146
146
|
resetDependencyRecomputations: () => void;
|
|
147
147
|
} & {
|
|
148
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
149
148
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
149
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
150
150
|
};
|
|
151
151
|
export declare const selectorChartsInteractionItemIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
152
152
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -190,16 +190,16 @@ export declare const selectorChartsInteractionItemIsDefined: ((state: import("..
|
|
|
190
190
|
dependencyRecomputations: () => number;
|
|
191
191
|
resetDependencyRecomputations: () => void;
|
|
192
192
|
} & {
|
|
193
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
194
193
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
194
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
195
195
|
}];
|
|
196
196
|
recomputations: () => number;
|
|
197
197
|
resetRecomputations: () => void;
|
|
198
198
|
dependencyRecomputations: () => number;
|
|
199
199
|
resetDependencyRecomputations: () => void;
|
|
200
200
|
} & {
|
|
201
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
202
201
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
202
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
203
203
|
};
|
|
204
204
|
export declare const selectorChartsInteractionXAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
205
205
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -261,16 +261,16 @@ export declare const selectorChartsInteractionXAxisIsDefined: ((state: import(".
|
|
|
261
261
|
dependencyRecomputations: () => number;
|
|
262
262
|
resetDependencyRecomputations: () => void;
|
|
263
263
|
} & {
|
|
264
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
265
264
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
265
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
266
266
|
}];
|
|
267
267
|
recomputations: () => number;
|
|
268
268
|
resetRecomputations: () => void;
|
|
269
269
|
dependencyRecomputations: () => number;
|
|
270
270
|
resetDependencyRecomputations: () => void;
|
|
271
271
|
} & {
|
|
272
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
273
272
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
273
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
274
274
|
};
|
|
275
275
|
export declare const selectorChartsInteractionYAxisIsDefined: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
276
276
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -332,16 +332,16 @@ export declare const selectorChartsInteractionYAxisIsDefined: ((state: import(".
|
|
|
332
332
|
dependencyRecomputations: () => number;
|
|
333
333
|
resetDependencyRecomputations: () => void;
|
|
334
334
|
} & {
|
|
335
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
336
335
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
336
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
337
337
|
}];
|
|
338
338
|
recomputations: () => number;
|
|
339
339
|
resetRecomputations: () => void;
|
|
340
340
|
dependencyRecomputations: () => number;
|
|
341
341
|
resetDependencyRecomputations: () => void;
|
|
342
342
|
} & {
|
|
343
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
344
343
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
344
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
345
345
|
};
|
|
346
346
|
export declare const selectorChartsInteractionIsVoronoiEnabled: ((state: import("../../corePlugins/useChartId/useChartId.types").UseChartIdState & import("./useChartInteraction.types").UseChartInteractionState & Partial<{}> & {
|
|
347
347
|
cacheKey: import("../../models").ChartStateCacheKey;
|
|
@@ -371,6 +371,6 @@ export declare const selectorChartsInteractionIsVoronoiEnabled: ((state: import(
|
|
|
371
371
|
dependencyRecomputations: () => number;
|
|
372
372
|
resetDependencyRecomputations: () => void;
|
|
373
373
|
} & {
|
|
374
|
-
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
375
374
|
memoize: typeof import("reselect").weakMapMemoize;
|
|
375
|
+
argsMemoize: typeof import("reselect").weakMapMemoize;
|
|
376
376
|
};
|
|
@@ -6,7 +6,7 @@ export interface ChartPluginOptions<TSignature extends ChartAnyPluginSignature>
|
|
|
6
6
|
instance: ChartUsedInstance<TSignature>;
|
|
7
7
|
params: ChartUsedDefaultizedParams<TSignature>;
|
|
8
8
|
store: ChartUsedStore<TSignature>;
|
|
9
|
-
svgRef: React.RefObject<SVGSVGElement>;
|
|
9
|
+
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
10
10
|
plugins: ChartPlugin<ChartAnyPluginSignature>[];
|
|
11
11
|
}
|
|
12
12
|
type ChartResponse<TSignature extends ChartAnyPluginSignature> = OptionalIfEmpty<'publicAPI', TSignature['publicAPI']> & OptionalIfEmpty<'instance', TSignature['instance']>;
|
|
@@ -3,12 +3,12 @@ import { ChartStore } from '../plugins/utils/ChartStore';
|
|
|
3
3
|
import { ChartAnyPluginSignature, ChartInstance, ChartPublicAPI, ConvertSignaturesIntoPlugins } from '../plugins/models';
|
|
4
4
|
import { UseChartBaseProps } from './useCharts.types';
|
|
5
5
|
import { UseChartInteractionState } from '../plugins/featurePlugins/useChartInteraction/useChartInteraction.types';
|
|
6
|
-
export declare function useChartApiInitialization<T>(inputApiRef: React.
|
|
6
|
+
export declare function useChartApiInitialization<T>(inputApiRef: React.RefObject<T | undefined> | undefined): T;
|
|
7
7
|
export declare function useCharts<TSignatures extends readonly ChartAnyPluginSignature[], TProps extends Partial<UseChartBaseProps<TSignatures>>>(inPlugins: ConvertSignaturesIntoPlugins<TSignatures>, props: TProps): {
|
|
8
8
|
contextValue: {
|
|
9
9
|
store: ChartStore<readonly [import("../plugins/corePlugins/useChartId").UseChartIdSignature, ...TSignatures]> & UseChartInteractionState;
|
|
10
10
|
publicAPI: ChartPublicAPI<TSignatures>;
|
|
11
11
|
instance: ChartInstance<TSignatures>;
|
|
12
|
-
svgRef: React.RefObject<SVGSVGElement>;
|
|
12
|
+
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChartAnyPluginSignature, ChartPublicAPI } from '../plugins/models';
|
|
3
3
|
export interface UseChartBaseProps<TSignatures extends readonly ChartAnyPluginSignature[]> {
|
|
4
|
-
apiRef: React.
|
|
4
|
+
apiRef: React.RefObject<ChartPublicAPI<TSignatures> | undefined> | undefined;
|
|
5
5
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ChartsLabelMarkProps } from '../../ChartsLabel';
|
|
1
2
|
import type { HighlightScope } from '../../context';
|
|
2
3
|
import type { StackOffsetType, StackOrderType } from '../stacking';
|
|
3
4
|
export type SeriesId = number | string;
|
|
@@ -22,6 +23,14 @@ export type CommonSeriesType<TValue> = {
|
|
|
22
23
|
* The scope to apply when the series is highlighted.
|
|
23
24
|
*/
|
|
24
25
|
highlightScope?: Partial<HighlightScope>;
|
|
26
|
+
/**
|
|
27
|
+
* Defines the mark type for the series.
|
|
28
|
+
*
|
|
29
|
+
* There is a default mark type for each series type.
|
|
30
|
+
*
|
|
31
|
+
* It allows custom values which will be passed to the mark component if it was customized.
|
|
32
|
+
*/
|
|
33
|
+
labelMarkType?: ChartsLabelMarkProps['type'];
|
|
25
34
|
};
|
|
26
35
|
export type CommonDefaultizedProps = 'id' | 'valueFormatter' | 'data';
|
|
27
36
|
export type CartesianSeriesType = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PieArcDatum as D3PieArcDatum } from '@mui/x-charts-vendor/d3-shape';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { CommonDefaultizedProps, CommonSeriesType, SeriesId } from './common';
|
|
4
|
+
import type { ChartsLabelMarkProps } from '../../ChartsLabel';
|
|
4
5
|
export type PieItemId = string | number;
|
|
5
6
|
export type PieValueType = {
|
|
6
7
|
/**
|
|
@@ -13,6 +14,14 @@ export type PieValueType = {
|
|
|
13
14
|
*/
|
|
14
15
|
label?: string | ((location: 'tooltip' | 'legend' | 'arc') => string);
|
|
15
16
|
color?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Defines the mark type for the pie item.
|
|
19
|
+
*
|
|
20
|
+
* It allows custom values which will be passed to the mark component if it was customized.
|
|
21
|
+
*
|
|
22
|
+
* @default 'circle'
|
|
23
|
+
*/
|
|
24
|
+
labelMarkType?: ChartsLabelMarkProps['type'];
|
|
16
25
|
};
|
|
17
26
|
export type DefaultizedPieValueType = PieValueType & Omit<D3PieArcDatum<any>, 'data'> & {
|
|
18
27
|
color: string;
|
|
@@ -15,6 +15,7 @@ export function AnimatedBarElement(props) {
|
|
|
15
15
|
} = props,
|
|
16
16
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
17
17
|
return /*#__PURE__*/_jsx(animated.rect, _extends({}, other, {
|
|
18
|
+
// @ts-expect-error
|
|
18
19
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
19
20
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
20
21
|
}));
|
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { BarPlot } from "./BarPlot.js";
|
|
8
|
-
import { ChartContainer } from "../ChartContainer/index.js";
|
|
9
8
|
import { ChartsAxis } from "../ChartsAxis/index.js";
|
|
10
9
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
11
10
|
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
@@ -15,6 +14,10 @@ import { ChartsGrid } from "../ChartsGrid/index.js";
|
|
|
15
14
|
import { ChartsOnAxisClickHandler } from "../ChartsOnAxisClickHandler/index.js";
|
|
16
15
|
import { ChartsOverlay } from "../ChartsOverlay/ChartsOverlay.js";
|
|
17
16
|
import { useBarChartProps } from "./useBarChartProps.js";
|
|
17
|
+
import { ChartDataProvider } from "../context/index.js";
|
|
18
|
+
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
19
|
+
import { useChartContainerProps } from "../ChartContainer/useChartContainerProps.js";
|
|
20
|
+
import { ChartsWrapper } from "../internals/components/ChartsWrapper/index.js";
|
|
18
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
22
|
/**
|
|
20
23
|
* Demos:
|
|
@@ -33,6 +36,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
|
|
|
33
36
|
name: 'MuiBarChart'
|
|
34
37
|
});
|
|
35
38
|
const {
|
|
39
|
+
chartsWrapperProps,
|
|
36
40
|
chartContainerProps,
|
|
37
41
|
barPlotProps,
|
|
38
42
|
axisClickHandlerProps,
|
|
@@ -45,13 +49,19 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(inProps, ref) {
|
|
|
45
49
|
legendProps,
|
|
46
50
|
children
|
|
47
51
|
} = useBarChartProps(props);
|
|
52
|
+
const {
|
|
53
|
+
chartDataProviderProps,
|
|
54
|
+
chartsSurfaceProps
|
|
55
|
+
} = useChartContainerProps(chartContainerProps, ref);
|
|
48
56
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
49
|
-
return /*#__PURE__*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
58
|
+
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
59
|
+
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
60
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
61
|
+
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
62
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
63
|
+
}))]
|
|
64
|
+
}))
|
|
55
65
|
}));
|
|
56
66
|
});
|
|
57
67
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -5,6 +5,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
|
|
6
6
|
import useId from '@mui/utils/useId';
|
|
7
7
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
|
|
8
|
+
import { calculateMargins } from "../internals/calculateMargins.js";
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* A helper function that extracts BarChartProps from the input props
|
|
10
12
|
* and returns an object with props for the children components of BarChart.
|
|
@@ -41,7 +43,8 @@ export const useBarChartProps = props => {
|
|
|
41
43
|
onHighlightChange,
|
|
42
44
|
borderRadius,
|
|
43
45
|
barLabel,
|
|
44
|
-
className
|
|
46
|
+
className,
|
|
47
|
+
hideLegend
|
|
45
48
|
} = props,
|
|
46
49
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
47
50
|
const id = useId();
|
|
@@ -61,7 +64,12 @@ export const useBarChartProps = props => {
|
|
|
61
64
|
})),
|
|
62
65
|
width,
|
|
63
66
|
height,
|
|
64
|
-
margin
|
|
67
|
+
margin: calculateMargins({
|
|
68
|
+
margin,
|
|
69
|
+
hideLegend,
|
|
70
|
+
slotProps,
|
|
71
|
+
series
|
|
72
|
+
}),
|
|
65
73
|
colors,
|
|
66
74
|
dataset,
|
|
67
75
|
xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
|
|
@@ -70,7 +78,6 @@ export const useBarChartProps = props => {
|
|
|
70
78
|
yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
|
|
71
79
|
id: DEFAULT_Y_AXIS_KEY
|
|
72
80
|
}, defaultAxisConfig)] : undefined),
|
|
73
|
-
sx,
|
|
74
81
|
highlightedItem,
|
|
75
82
|
onHighlightChange,
|
|
76
83
|
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
@@ -119,7 +126,13 @@ export const useBarChartProps = props => {
|
|
|
119
126
|
slots,
|
|
120
127
|
slotProps
|
|
121
128
|
};
|
|
129
|
+
const chartsWrapperProps = {
|
|
130
|
+
sx,
|
|
131
|
+
legendPosition: props.slotProps?.legend?.position,
|
|
132
|
+
legendDirection: props.slotProps?.legend?.direction
|
|
133
|
+
};
|
|
122
134
|
return {
|
|
135
|
+
chartsWrapperProps,
|
|
123
136
|
chartContainerProps,
|
|
124
137
|
barPlotProps,
|
|
125
138
|
axisClickHandlerProps,
|
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["children", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { styled } from '@mui/material/styles';
|
|
9
8
|
import clsx from 'clsx';
|
|
10
9
|
import { useUtilityClasses } from "./labelClasses.js";
|
|
11
10
|
import { consumeThemeProps } from "../internals/consumeThemeProps.js";
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const Root = styled('span', {
|
|
14
|
-
name: 'MuiChartsLabel',
|
|
15
|
-
slot: 'Root',
|
|
16
|
-
overridesResolver: (props, styles) => styles.root
|
|
17
|
-
})(({
|
|
18
|
-
theme
|
|
19
|
-
}) => _extends({}, theme.typography.caption, {
|
|
20
|
-
color: (theme.vars || theme).palette.text.primary,
|
|
21
|
-
lineHeight: undefined,
|
|
22
|
-
display: 'flex'
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
12
|
/**
|
|
26
|
-
* @ignore - internal component.
|
|
27
|
-
*
|
|
28
13
|
* Generates the label mark for the tooltip and legend.
|
|
14
|
+
* @ignore - internal component.
|
|
29
15
|
*/
|
|
30
16
|
const ChartsLabel = consumeThemeProps('MuiChartsLabel', {
|
|
31
17
|
classesResolver: useUtilityClasses
|
|
@@ -36,9 +22,8 @@ const ChartsLabel = consumeThemeProps('MuiChartsLabel', {
|
|
|
36
22
|
classes
|
|
37
23
|
} = props,
|
|
38
24
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
39
|
-
return /*#__PURE__*/_jsx(
|
|
25
|
+
return /*#__PURE__*/_jsx("span", _extends({
|
|
40
26
|
className: clsx(classes?.root, className),
|
|
41
|
-
ownerState: props,
|
|
42
27
|
ref: ref
|
|
43
28
|
}, other, {
|
|
44
29
|
children: children
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["gradientId", "direction", "classes", "className"];
|
|
5
|
+
const _excluded = ["gradientId", "direction", "classes", "className", "rotate", "reverse", "thickness"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
@@ -12,15 +12,15 @@ import { consumeThemeProps } from "../internals/consumeThemeProps.js";
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const getRotation = (direction, reverse, rotate) => {
|
|
14
14
|
if (!rotate && reverse) {
|
|
15
|
-
return direction === '
|
|
15
|
+
return direction === 'vertical' ? 90 : 180;
|
|
16
16
|
}
|
|
17
17
|
if (rotate && !reverse) {
|
|
18
|
-
return direction === '
|
|
18
|
+
return direction === 'vertical' ? 0 : 90;
|
|
19
19
|
}
|
|
20
20
|
if (rotate && reverse) {
|
|
21
|
-
return direction === '
|
|
21
|
+
return direction === 'vertical' ? 180 : -90;
|
|
22
22
|
}
|
|
23
|
-
return direction === '
|
|
23
|
+
return direction === 'vertical' ? -90 : 0;
|
|
24
24
|
};
|
|
25
25
|
const Root = styled('div', {
|
|
26
26
|
name: 'MuiChartsLabelGradient',
|
|
@@ -38,17 +38,17 @@ const Root = styled('div', {
|
|
|
38
38
|
borderRadius: 2,
|
|
39
39
|
overflow: 'hidden'
|
|
40
40
|
},
|
|
41
|
-
[`&.${labelGradientClasses.
|
|
41
|
+
[`&.${labelGradientClasses.horizontal}`]: {
|
|
42
42
|
width: '100%',
|
|
43
43
|
[`.${labelGradientClasses.mask}`]: {
|
|
44
|
-
height:
|
|
44
|
+
height: ownerState.thickness,
|
|
45
45
|
width: '100%'
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
[`&.${labelGradientClasses.
|
|
48
|
+
[`&.${labelGradientClasses.vertical}`]: {
|
|
49
49
|
height: '100%',
|
|
50
50
|
[`.${labelGradientClasses.mask}`]: {
|
|
51
|
-
width:
|
|
51
|
+
width: ownerState.thickness,
|
|
52
52
|
height: '100%',
|
|
53
53
|
'> svg': {
|
|
54
54
|
height: '100%'
|
|
@@ -63,13 +63,13 @@ const Root = styled('div', {
|
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
|
-
* @ignore - internal component.
|
|
67
|
-
*
|
|
68
66
|
* Generates the label Gradient for the tooltip and legend.
|
|
67
|
+
* @ignore - internal component.
|
|
69
68
|
*/
|
|
70
69
|
const ChartsLabelGradient = consumeThemeProps('MuiChartsLabelGradient', {
|
|
71
70
|
defaultProps: {
|
|
72
|
-
direction: '
|
|
71
|
+
direction: 'horizontal',
|
|
72
|
+
thickness: 12
|
|
73
73
|
},
|
|
74
74
|
classesResolver: useUtilityClasses
|
|
75
75
|
}, function ChartsLabelGradient(props, ref) {
|
|
@@ -90,6 +90,7 @@ const ChartsLabelGradient = consumeThemeProps('MuiChartsLabelGradient', {
|
|
|
90
90
|
children: /*#__PURE__*/_jsx("svg", {
|
|
91
91
|
viewBox: "0 0 24 24",
|
|
92
92
|
children: /*#__PURE__*/_jsx("rect", {
|
|
93
|
+
className: classes?.fill,
|
|
93
94
|
width: "24",
|
|
94
95
|
height: "24",
|
|
95
96
|
fill: `url(#${gradientId})`
|
|
@@ -109,13 +110,11 @@ process.env.NODE_ENV !== "production" ? ChartsLabelGradient.propTypes = {
|
|
|
109
110
|
classes: PropTypes.object,
|
|
110
111
|
/**
|
|
111
112
|
* The direction of the gradient.
|
|
112
|
-
*
|
|
113
|
-
* @default 'row'
|
|
113
|
+
* @default 'horizontal'
|
|
114
114
|
*/
|
|
115
|
-
direction: PropTypes.oneOf(['
|
|
115
|
+
direction: PropTypes.oneOf(['vertical', 'horizontal']),
|
|
116
116
|
/**
|
|
117
117
|
* A unique identifier for the gradient.
|
|
118
|
-
*
|
|
119
118
|
* The `gradientId` will be used as `fill="url(#gradientId)"`.
|
|
120
119
|
*/
|
|
121
120
|
gradientId: PropTypes.string.isRequired,
|
|
@@ -125,9 +124,13 @@ process.env.NODE_ENV !== "production" ? ChartsLabelGradient.propTypes = {
|
|
|
125
124
|
reverse: PropTypes.bool,
|
|
126
125
|
/**
|
|
127
126
|
* If provided, the gradient will be rotated by 90deg.
|
|
128
|
-
*
|
|
129
127
|
* Useful for linear gradients that are not in the correct orientation.
|
|
130
128
|
*/
|
|
131
|
-
rotate: PropTypes.bool
|
|
129
|
+
rotate: PropTypes.bool,
|
|
130
|
+
/**
|
|
131
|
+
* The thickness of the gradient
|
|
132
|
+
* @default 12
|
|
133
|
+
*/
|
|
134
|
+
thickness: PropTypes.number
|
|
132
135
|
} : void 0;
|
|
133
136
|
export { ChartsLabelGradient };
|
|
@@ -52,11 +52,13 @@ const Root = styled('div', {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
|
-
* @ignore - internal component.
|
|
56
|
-
*
|
|
57
55
|
* Generates the label mark for the tooltip and legend.
|
|
56
|
+
* @ignore - internal component.
|
|
58
57
|
*/
|
|
59
58
|
const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
|
|
59
|
+
defaultProps: {
|
|
60
|
+
type: 'square'
|
|
61
|
+
},
|
|
60
62
|
classesResolver: useUtilityClasses
|
|
61
63
|
}, function ChartsLabelMark(props, ref) {
|
|
62
64
|
const {
|
|
@@ -78,6 +80,7 @@ const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
|
|
|
78
80
|
viewBox: "0 0 24 24",
|
|
79
81
|
preserveAspectRatio: type === 'line' ? 'none' : undefined,
|
|
80
82
|
children: /*#__PURE__*/_jsx("rect", {
|
|
83
|
+
className: classes?.fill,
|
|
81
84
|
width: "24",
|
|
82
85
|
height: "24",
|
|
83
86
|
fill: color
|
|
@@ -4,14 +4,15 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
|
4
4
|
export function getLabelGradientUtilityClass(slot) {
|
|
5
5
|
return generateUtilityClass('MuiChartsLabelGradient', slot);
|
|
6
6
|
}
|
|
7
|
-
export const labelGradientClasses = generateUtilityClasses('MuiChartsLabelGradient', ['root', '
|
|
7
|
+
export const labelGradientClasses = generateUtilityClasses('MuiChartsLabelGradient', ['root', 'vertical', 'horizontal', 'mask', 'fill']);
|
|
8
8
|
export const useUtilityClasses = props => {
|
|
9
9
|
const {
|
|
10
10
|
direction
|
|
11
11
|
} = props;
|
|
12
12
|
const slots = {
|
|
13
13
|
root: ['root', direction],
|
|
14
|
-
mask: ['mask']
|
|
14
|
+
mask: ['mask'],
|
|
15
|
+
fill: ['fill']
|
|
15
16
|
};
|
|
16
17
|
return composeClasses(slots, getLabelGradientUtilityClass, props.classes);
|
|
17
18
|
};
|