@mui/x-charts 8.3.1 → 8.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/BarChart/BarChart.d.ts +9 -2
- package/BarChart/BarChart.js +11 -3
- package/BarChart/useBarChartProps.js +1 -1
- package/CHANGELOG.md +213 -0
- package/ChartContainer/ChartContainer.d.ts +21 -2
- package/ChartContainer/ChartContainer.js +17 -1
- package/ChartContainer/useChartContainerProps.js +7 -3
- package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/ChartDataProvider/ChartDataProvider.js +19 -2
- package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/ChartsAxis/axisClasses.d.ts +5 -0
- package/ChartsAxis/axisClasses.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/ChartsSurface/ChartsSurface.js +1 -0
- package/ChartsXAxis/ChartsXAxis.js +7 -16
- package/ChartsYAxis/ChartsYAxis.js +4 -8
- package/Gauge/Gauge.js +1 -0
- package/Gauge/GaugeContainer.js +1 -0
- package/Gauge/GaugeProvider.js +1 -3
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/LineChart.d.ts +9 -2
- package/LineChart/LineChart.js +11 -3
- package/LineChart/LineHighlightPlot.js +1 -4
- package/LineChart/MarkPlot.js +1 -4
- package/LineChart/useLineChartProps.js +1 -1
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieChart.d.ts +10 -3
- package/PieChart/PieChart.js +18 -9
- package/RadarChart/RadarChart.d.ts +21 -3
- package/RadarChart/RadarChart.js +20 -4
- package/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/RadarChart/RadarChart.plugins.js +10 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
- package/RadarChart/index.d.ts +2 -0
- package/RadarChart/index.js +15 -1
- package/RadarChart/useRadarChartProps.d.ts +2 -1
- package/RadarChart/useRadarChartProps.js +3 -1
- package/ScatterChart/Scatter.js +3 -11
- package/ScatterChart/ScatterChart.d.ts +9 -2
- package/ScatterChart/ScatterChart.js +13 -5
- package/ScatterChart/useScatterChartProps.js +4 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +31 -26
- package/Toolbar/Toolbar.d.ts +9 -3
- package/Toolbar/Toolbar.js +23 -7
- package/Toolbar/Toolbar.types.d.ts +15 -0
- package/Toolbar/Toolbar.types.js +5 -0
- package/Toolbar/ToolbarButton.d.ts +8 -2
- package/Toolbar/ToolbarButton.js +25 -6
- package/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/Toolbar/chartToolbarClasses.js +9 -0
- package/Toolbar/index.d.ts +3 -1
- package/Toolbar/index.js +22 -0
- package/Toolbar/internals/ChartsToolbar.d.ts +6 -0
- package/Toolbar/internals/ChartsToolbar.js +14 -0
- package/context/ChartProvider/ChartContext.js +1 -3
- package/context/ChartsSlotsContext.d.ts +20 -0
- package/context/ChartsSlotsContext.js +44 -0
- package/context/index.d.ts +2 -1
- package/context/index.js +11 -0
- package/context/useChartApiContext.d.ts +10 -0
- package/context/useChartApiContext.js +27 -0
- package/esm/BarChart/BarChart.d.ts +9 -2
- package/esm/BarChart/BarChart.js +11 -3
- package/esm/BarChart/useBarChartProps.js +1 -1
- package/esm/ChartContainer/ChartContainer.d.ts +21 -2
- package/esm/ChartContainer/ChartContainer.js +17 -1
- package/esm/ChartContainer/useChartContainerProps.js +7 -3
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/esm/ChartsAxis/axisClasses.d.ts +5 -0
- package/esm/ChartsAxis/axisClasses.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -0
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +1 -3
- package/esm/ChartsSurface/ChartsSurface.js +1 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -16
- package/esm/ChartsYAxis/ChartsYAxis.js +4 -8
- package/esm/Gauge/Gauge.js +1 -0
- package/esm/Gauge/GaugeContainer.js +1 -0
- package/esm/Gauge/GaugeProvider.js +1 -3
- package/esm/LineChart/AnimatedLine.js +1 -0
- package/esm/LineChart/LineChart.d.ts +9 -2
- package/esm/LineChart/LineChart.js +11 -3
- package/esm/LineChart/LineHighlightPlot.js +1 -4
- package/esm/LineChart/MarkPlot.js +1 -4
- package/esm/LineChart/useLineChartProps.js +1 -1
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieChart.d.ts +10 -3
- package/esm/PieChart/PieChart.js +16 -7
- package/esm/RadarChart/RadarChart.d.ts +21 -3
- package/esm/RadarChart/RadarChart.js +20 -4
- package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/esm/RadarChart/RadarChart.plugins.js +4 -0
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
- package/esm/RadarChart/index.d.ts +2 -0
- package/esm/RadarChart/index.js +2 -0
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
- package/esm/RadarChart/useRadarChartProps.js +3 -1
- package/esm/ScatterChart/Scatter.js +3 -11
- package/esm/ScatterChart/ScatterChart.d.ts +9 -2
- package/esm/ScatterChart/ScatterChart.js +13 -5
- package/esm/ScatterChart/useScatterChartProps.js +4 -2
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +31 -26
- package/esm/Toolbar/Toolbar.d.ts +9 -3
- package/esm/Toolbar/Toolbar.js +22 -7
- package/esm/Toolbar/Toolbar.types.d.ts +15 -0
- package/esm/Toolbar/Toolbar.types.js +1 -0
- package/esm/Toolbar/ToolbarButton.d.ts +8 -2
- package/esm/Toolbar/ToolbarButton.js +24 -5
- package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/esm/Toolbar/chartToolbarClasses.js +2 -0
- package/esm/Toolbar/index.d.ts +3 -1
- package/esm/Toolbar/index.js +3 -1
- package/esm/Toolbar/internals/ChartsToolbar.d.ts +6 -0
- package/esm/Toolbar/internals/ChartsToolbar.js +8 -0
- package/esm/context/ChartProvider/ChartContext.js +1 -3
- package/esm/context/ChartsSlotsContext.d.ts +20 -0
- package/esm/context/ChartsSlotsContext.js +35 -0
- package/esm/context/index.d.ts +2 -1
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +10 -0
- package/esm/context/useChartApiContext.js +21 -0
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/hooks/useTicks.js +2 -6
- package/esm/index.js +1 -1
- package/esm/internals/constants.d.ts +3 -1
- package/esm/internals/constants.js +2 -1
- package/esm/internals/consumeSlots.js +2 -1
- package/esm/internals/consumeThemeProps.js +3 -1
- package/esm/internals/dateHelpers.d.ts +15 -0
- package/esm/internals/dateHelpers.js +20 -0
- package/esm/internals/domUtils.d.ts +1 -2
- package/esm/internals/domUtils.js +8 -19
- package/esm/internals/index.d.ts +4 -1
- package/esm/internals/index.js +4 -1
- package/esm/internals/material/index.d.ts +2 -0
- package/esm/internals/plugins/allPlugins.d.ts +1 -0
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/esm/models/index.d.ts +2 -2
- package/esm/models/index.js +1 -0
- package/esm/models/slots/chartsBaseSlotProps.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/hooks/useTicks.js +2 -6
- package/index.js +1 -1
- package/internals/constants.d.ts +3 -1
- package/internals/constants.js +3 -2
- package/internals/consumeSlots.js +2 -1
- package/internals/consumeThemeProps.js +3 -1
- package/internals/dateHelpers.d.ts +15 -0
- package/internals/dateHelpers.js +28 -0
- package/internals/domUtils.d.ts +1 -2
- package/internals/domUtils.js +8 -20
- package/internals/index.d.ts +4 -1
- package/internals/index.js +44 -8
- package/internals/material/index.d.ts +2 -0
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +11 -17
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +16 -13
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +7 -8
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +6 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +83 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +17 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -3
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +2 -5
- package/models/index.d.ts +2 -2
- package/models/index.js +11 -0
- package/models/slots/chartsBaseSlotProps.d.ts +1 -0
- package/package.json +3 -3
package/RadarChart/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { RadarChart as Unstable_RadarChart } from "./RadarChart.js";
|
|
2
|
+
export { RadarChart } from "./RadarChart.js";
|
|
2
3
|
export { RadarDataProvider as Unstable_RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
4
|
+
export { RadarDataProvider } from "./RadarDataProvider/index.js";
|
|
3
5
|
export type { RadarChartProps } from "./RadarChart.js";
|
|
4
6
|
export type { RadarDataProviderProps } from "./RadarDataProvider/index.js";
|
|
5
7
|
export * from "./RadarGrid/index.js";
|
package/RadarChart/index.js
CHANGED
|
@@ -5,8 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Unstable_RadarChart: true,
|
|
8
|
-
|
|
8
|
+
RadarChart: true,
|
|
9
|
+
Unstable_RadarDataProvider: true,
|
|
10
|
+
RadarDataProvider: true
|
|
9
11
|
};
|
|
12
|
+
Object.defineProperty(exports, "RadarChart", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _RadarChart.RadarChart;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "RadarDataProvider", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _RadarDataProvider.RadarDataProvider;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
10
24
|
Object.defineProperty(exports, "Unstable_RadarChart", {
|
|
11
25
|
enumerable: true,
|
|
12
26
|
get: function () {
|
|
@@ -5,6 +5,7 @@ import type { ChartsWrapperProps } from "../internals/components/ChartsWrapper/i
|
|
|
5
5
|
import { RadarDataProviderProps } from "./RadarDataProvider/RadarDataProvider.js";
|
|
6
6
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
7
7
|
import { RadarGridProps } from "./RadarGrid/index.js";
|
|
8
|
+
import { RadarChartPluginsSignatures } from "./RadarChart.plugins.js";
|
|
8
9
|
/**
|
|
9
10
|
* A helper function that extracts RadarChartProps from the input props
|
|
10
11
|
* and returns an object with props for the children components of RadarChart.
|
|
@@ -16,7 +17,7 @@ export declare const useRadarChartProps: (props: RadarChartProps) => {
|
|
|
16
17
|
highlight: "none" | "series" | "axis";
|
|
17
18
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
18
19
|
chartsSurfaceProps: ChartsSurfaceProps;
|
|
19
|
-
radarDataProviderProps: RadarDataProviderProps
|
|
20
|
+
radarDataProviderProps: RadarDataProviderProps<RadarChartPluginsSignatures>;
|
|
20
21
|
radarGrid: RadarGridProps;
|
|
21
22
|
overlayProps: ChartsOverlayProps;
|
|
22
23
|
legendProps: ChartsLegendSlotExtension;
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.useRadarChartProps = void 0;
|
|
9
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
-
const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight"];
|
|
10
|
+
const _excluded = ["apiRef", "series", "radar", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "hideLegend", "divisions", "shape", "stripeColor", "highlight", "showToolbar"];
|
|
11
11
|
/**
|
|
12
12
|
* A helper function that extracts RadarChartProps from the input props
|
|
13
13
|
* and returns an object with props for the children components of RadarChart.
|
|
@@ -17,6 +17,7 @@ const _excluded = ["series", "radar", "width", "height", "margin", "colors", "sx
|
|
|
17
17
|
*/
|
|
18
18
|
const useRadarChartProps = props => {
|
|
19
19
|
const {
|
|
20
|
+
apiRef,
|
|
20
21
|
series,
|
|
21
22
|
radar,
|
|
22
23
|
width,
|
|
@@ -38,6 +39,7 @@ const useRadarChartProps = props => {
|
|
|
38
39
|
} = props,
|
|
39
40
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
40
41
|
const radarDataProviderProps = {
|
|
42
|
+
apiRef,
|
|
41
43
|
series,
|
|
42
44
|
radar,
|
|
43
45
|
highlight,
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -61,19 +61,11 @@ function Scatter(props) {
|
|
|
61
61
|
const scatterPoint = series.data[i];
|
|
62
62
|
const x = getXPosition(scatterPoint.x);
|
|
63
63
|
const y = getYPosition(scatterPoint.y);
|
|
64
|
-
const isInRange = instance.isPointInside(
|
|
65
|
-
x,
|
|
66
|
-
y
|
|
67
|
-
});
|
|
68
|
-
const pointCtx = {
|
|
69
|
-
type: 'scatter',
|
|
70
|
-
seriesId: series.id,
|
|
71
|
-
dataIndex: i
|
|
72
|
-
};
|
|
64
|
+
const isInRange = instance.isPointInside(x, y);
|
|
73
65
|
if (isInRange) {
|
|
74
66
|
const currentItem = {
|
|
75
|
-
seriesId:
|
|
76
|
-
dataIndex:
|
|
67
|
+
seriesId: series.id,
|
|
68
|
+
dataIndex: i
|
|
77
69
|
};
|
|
78
70
|
const isItemHighlighted = isHighlighted(currentItem);
|
|
79
71
|
temp.push({
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { ChartsToolbarSlotProps, ChartsToolbarSlots } from "../Toolbar/index.js";
|
|
4
|
+
import { ChartsSlots, ChartsSlotProps } from "../internals/material/index.js";
|
|
3
5
|
import { ScatterPlotProps, ScatterPlotSlotProps, ScatterPlotSlots } from "./ScatterPlot.js";
|
|
4
6
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
5
7
|
import { ChartsAxisProps } from "../ChartsAxis/index.js";
|
|
@@ -12,8 +14,8 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from "../models/axis.js";
|
|
|
12
14
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
13
15
|
import { UseChartVoronoiSignature } from "../internals/plugins/featurePlugins/useChartVoronoi/index.js";
|
|
14
16
|
import { ScatterChartPluginsSignatures } from "./ScatterChart.plugins.js";
|
|
15
|
-
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
|
|
16
|
-
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
|
|
17
|
+
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
18
|
+
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
17
19
|
export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', ScatterChartPluginsSignatures>, 'series' | 'plugins' | 'onItemClick'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
18
20
|
/**
|
|
19
21
|
* The series to display in the scatter chart.
|
|
@@ -39,6 +41,11 @@ export interface ScatterChartProps extends Omit<ChartContainerProps<'scatter', S
|
|
|
39
41
|
* If `true`, the legend is not rendered.
|
|
40
42
|
*/
|
|
41
43
|
hideLegend?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* If true, shows the default chart toolbar.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
showToolbar?: boolean;
|
|
42
49
|
/**
|
|
43
50
|
* Overridable component slots.
|
|
44
51
|
* @default {}
|
|
@@ -23,6 +23,7 @@ var _useChartContainerProps = require("../ChartContainer/useChartContainerProps"
|
|
|
23
23
|
var _ChartDataProvider = require("../ChartDataProvider");
|
|
24
24
|
var _ChartsSurface = require("../ChartsSurface");
|
|
25
25
|
var _ChartsWrapper = require("../internals/components/ChartsWrapper");
|
|
26
|
+
var _ChartsToolbar = require("../Toolbar/internals/ChartsToolbar");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
28
|
/**
|
|
28
29
|
* Demos:
|
|
@@ -55,19 +56,21 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
|
|
|
55
56
|
chartsSurfaceProps
|
|
56
57
|
} = (0, _useChartContainerProps.useChartContainerProps)(chartContainerProps, ref);
|
|
57
58
|
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
59
|
+
const Toolbar = props.slots?.toolbar ?? _ChartsToolbar.ChartsToolbar;
|
|
58
60
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
59
61
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsWrapper.ChartsWrapper, (0, _extends2.default)({}, chartsWrapperProps, {
|
|
60
|
-
children: [!props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
62
|
+
children: [props.showToolbar ? /*#__PURE__*/(0, _jsxRuntime.jsx)(Toolbar, {}) : null, !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
61
63
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
62
64
|
"data-drawing-container": true,
|
|
63
65
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, (0, _extends2.default)({}, scatterPlotProps))
|
|
64
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)),
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}))]
|
|
66
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps)), children]
|
|
67
|
+
})), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({
|
|
68
|
+
trigger: "item"
|
|
69
|
+
}, props.slotProps?.tooltip))]
|
|
68
70
|
}))
|
|
69
71
|
}));
|
|
70
72
|
});
|
|
73
|
+
if (process.env.NODE_ENV !== "production") ScatterChart.displayName = "ScatterChart";
|
|
71
74
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
72
75
|
// ----------------------------- Warning --------------------------------
|
|
73
76
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -181,6 +184,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
181
184
|
* An array of [[ScatterSeriesType]] objects.
|
|
182
185
|
*/
|
|
183
186
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
187
|
+
/**
|
|
188
|
+
* If true, shows the default chart toolbar.
|
|
189
|
+
* @default false
|
|
190
|
+
*/
|
|
191
|
+
showToolbar: _propTypes.default.bool,
|
|
184
192
|
/**
|
|
185
193
|
* If `true`, animations are skipped.
|
|
186
194
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _ScatterChart = require("./ScatterChart.plugins");
|
|
14
|
-
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
14
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
15
15
|
/**
|
|
16
16
|
* A helper function that extracts ScatterChartProps from the input props
|
|
17
17
|
* and returns an object with props for the children components of ScatterChart.
|
|
@@ -62,7 +62,9 @@ const useScatterChartProps = props => {
|
|
|
62
62
|
voronoiMaxRadius,
|
|
63
63
|
onItemClick: disableVoronoi ? undefined : onItemClick,
|
|
64
64
|
className,
|
|
65
|
-
plugins: _ScatterChart.SCATTER_CHART_PLUGINS
|
|
65
|
+
plugins: _ScatterChart.SCATTER_CHART_PLUGINS,
|
|
66
|
+
slots,
|
|
67
|
+
slotProps
|
|
66
68
|
});
|
|
67
69
|
const chartsAxisProps = {
|
|
68
70
|
slots,
|
|
@@ -13,7 +13,7 @@ import { BarPlotSlots, BarPlotSlotProps } from "../BarChart/BarPlot.js";
|
|
|
13
13
|
import { ChartMargin } from "../internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.js";
|
|
14
14
|
export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, Omit<BarPlotSlots, 'barLabel'>, ChartsTooltipSlots {}
|
|
15
15
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {}
|
|
16
|
-
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors'> {
|
|
16
|
+
export interface SparkLineChartProps extends Omit<ChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'rotationAxis' | 'margin' | 'plugins' | 'colors' | 'slots' | 'slotProps'> {
|
|
17
17
|
/**
|
|
18
18
|
* The xAxis configuration.
|
|
19
19
|
* Notice it is a single [[AxisConfig]] object, not an array of configuration.
|
|
@@ -15,7 +15,8 @@ var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
|
15
15
|
var _ChartsClipPath = require("../ChartsClipPath");
|
|
16
16
|
var _BarChart = require("../BarChart");
|
|
17
17
|
var _LineChart = require("../LineChart");
|
|
18
|
-
var
|
|
18
|
+
var _ChartDataProvider = require("../ChartDataProvider");
|
|
19
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
19
20
|
var _constants = require("../constants");
|
|
20
21
|
var _ChartsTooltip = require("../ChartsTooltip");
|
|
21
22
|
var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
@@ -78,8 +79,7 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
78
79
|
}
|
|
79
80
|
return typeof color === 'function' ? mode => [color(mode)] : [color];
|
|
80
81
|
}, [color]);
|
|
81
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
82
|
-
ref: ref,
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartDataProvider.ChartDataProvider, {
|
|
83
83
|
series: [(0, _extends2.default)({
|
|
84
84
|
type: plotType,
|
|
85
85
|
data,
|
|
@@ -92,7 +92,6 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
92
92
|
width: width,
|
|
93
93
|
height: height,
|
|
94
94
|
margin: margin,
|
|
95
|
-
className: className,
|
|
96
95
|
xAxis: [(0, _extends2.default)({
|
|
97
96
|
id: _constants.DEFAULT_X_AXIS_KEY,
|
|
98
97
|
scaleType: plotType === 'bar' ? 'band' : 'point',
|
|
@@ -109,34 +108,40 @@ const SparkLineChart = exports.SparkLineChart = /*#__PURE__*/React.forwardRef(fu
|
|
|
109
108
|
position: 'none'
|
|
110
109
|
})],
|
|
111
110
|
colors: colors,
|
|
112
|
-
sx: sx,
|
|
113
111
|
disableAxisListener: (!showTooltip || slotProps?.tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
114
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
122
|
-
skipAnimation: true,
|
|
123
|
-
slots: slots,
|
|
124
|
-
slotProps: slotProps
|
|
125
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
|
|
112
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({
|
|
113
|
+
className: className,
|
|
114
|
+
ref: ref,
|
|
115
|
+
sx: sx
|
|
116
|
+
}, other, {
|
|
117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
118
|
+
clipPath: `url(#${clipPathId})`,
|
|
119
|
+
children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
|
|
126
120
|
skipAnimation: true,
|
|
127
121
|
slots: slots,
|
|
128
122
|
slotProps: slotProps
|
|
123
|
+
}), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
124
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
|
|
125
|
+
skipAnimation: true,
|
|
126
|
+
slots: slots,
|
|
127
|
+
slotProps: slotProps
|
|
128
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
|
|
129
|
+
skipAnimation: true,
|
|
130
|
+
slots: slots,
|
|
131
|
+
slotProps: slotProps
|
|
132
|
+
})]
|
|
129
133
|
})]
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
})
|
|
138
|
-
})
|
|
134
|
+
}), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LineHighlightPlot, {
|
|
135
|
+
slots: slots,
|
|
136
|
+
slotProps: slotProps
|
|
137
|
+
}), disableClipping ? null : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
138
|
+
id: clipPathId,
|
|
139
|
+
offset: clipPathOffset
|
|
140
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), children]
|
|
141
|
+
})), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip))]
|
|
142
|
+
});
|
|
139
143
|
});
|
|
144
|
+
if (process.env.NODE_ENV !== "production") SparkLineChart.displayName = "SparkLineChart";
|
|
140
145
|
process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
141
146
|
// ----------------------------- Warning --------------------------------
|
|
142
147
|
// | These PropTypes are generated from the TypeScript type definitions |
|
package/Toolbar/Toolbar.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface ChartsToolbarProps extends React.ComponentProps<'div'> {
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
3
5
|
export declare function Toolbar({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
className,
|
|
7
|
+
...other
|
|
8
|
+
}: ChartsToolbarProps): React.JSX.Element;
|
|
9
|
+
export declare namespace Toolbar {
|
|
10
|
+
var propTypes: any;
|
|
11
|
+
}
|
package/Toolbar/Toolbar.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.Toolbar = Toolbar;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
13
|
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
|
+
var _chartToolbarClasses = require("./chartToolbarClasses");
|
|
10
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
const _excluded = ["className"];
|
|
11
18
|
const ToolbarRoot = (0, _styles.styled)('div', {
|
|
12
19
|
name: 'MuiChartsToolbar',
|
|
13
20
|
slot: 'Root'
|
|
@@ -25,10 +32,19 @@ const ToolbarRoot = (0, _styles.styled)('div', {
|
|
|
25
32
|
border: `1px solid ${(theme.vars || theme).palette.divider}`,
|
|
26
33
|
borderRadius: 4
|
|
27
34
|
}));
|
|
28
|
-
function Toolbar({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
function Toolbar(_ref) {
|
|
36
|
+
let {
|
|
37
|
+
className
|
|
38
|
+
} = _ref,
|
|
39
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ToolbarRoot, (0, _extends2.default)({
|
|
41
|
+
className: (0, _clsx.default)(_chartToolbarClasses.chartsToolbarClasses.root, className)
|
|
42
|
+
}, other));
|
|
43
|
+
}
|
|
44
|
+
process.env.NODE_ENV !== "production" ? Toolbar.propTypes = {
|
|
45
|
+
// ----------------------------- Warning --------------------------------
|
|
46
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
47
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
48
|
+
// ----------------------------------------------------------------------
|
|
49
|
+
className: _propTypes.default.string
|
|
50
|
+
} : void 0;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsToolbarProps } from "./Toolbar.js";
|
|
3
|
+
export interface ChartsToolbarSlots {
|
|
4
|
+
/**
|
|
5
|
+
* Custom component for the toolbar.
|
|
6
|
+
* @default ChartsToolbar
|
|
7
|
+
*/
|
|
8
|
+
toolbar?: React.ElementType<ChartsToolbarProps>;
|
|
9
|
+
}
|
|
10
|
+
export interface ChartsToolbarSlotProps {
|
|
11
|
+
/**
|
|
12
|
+
* Props for the toolbar component.
|
|
13
|
+
*/
|
|
14
|
+
toolbar?: Partial<ChartsToolbarProps>;
|
|
15
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
3
|
+
import { ChartsSlotProps } from "../internals/material/index.js";
|
|
4
|
+
export type ToolbarButtonProps = ChartsSlotProps['baseIconButton'] & {
|
|
5
|
+
/**
|
|
6
|
+
* A function to customize the rendering of the component.
|
|
7
|
+
*/
|
|
8
|
+
render?: RenderProp<ChartsSlotProps['baseIconButton']>;
|
|
9
|
+
};
|
|
4
10
|
declare const ToolbarButton: React.ForwardRefExoticComponent<Omit<ToolbarButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
5
11
|
export { ToolbarButton };
|
package/Toolbar/ToolbarButton.js
CHANGED
|
@@ -1,27 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.ToolbarButton = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
12
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var
|
|
13
|
+
var _useComponentRenderer = require("@mui/x-internals/useComponentRenderer");
|
|
14
|
+
var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
|
|
13
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
const _excluded = ["render"];
|
|
14
17
|
const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const {
|
|
19
|
+
render
|
|
20
|
+
} = props,
|
|
21
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
slots,
|
|
24
|
+
slotProps
|
|
25
|
+
} = (0, _ChartsSlotsContext.useChartsSlots)();
|
|
26
|
+
const element = (0, _useComponentRenderer.useComponentRenderer)(slots.baseIconButton, render, (0, _extends2.default)({}, slotProps?.baseIconButton, other, {
|
|
27
|
+
ref
|
|
28
|
+
}));
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
30
|
+
children: element
|
|
31
|
+
});
|
|
19
32
|
});
|
|
33
|
+
if (process.env.NODE_ENV !== "production") ToolbarButton.displayName = "ToolbarButton";
|
|
20
34
|
process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
21
35
|
// ----------------------------- Warning --------------------------------
|
|
22
36
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
23
37
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
24
38
|
// ----------------------------------------------------------------------
|
|
25
39
|
className: _propTypes.default.string,
|
|
40
|
+
disabled: _propTypes.default.bool,
|
|
41
|
+
/**
|
|
42
|
+
* A function to customize the rendering of the component.
|
|
43
|
+
*/
|
|
44
|
+
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
26
45
|
style: _propTypes.default.object
|
|
27
46
|
} : void 0;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.chartsToolbarClasses = void 0;
|
|
8
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
9
|
+
const chartsToolbarClasses = exports.chartsToolbarClasses = (0, _generateUtilityClasses.default)('MuiChartsToolbar', ['root']);
|
package/Toolbar/index.d.ts
CHANGED
package/Toolbar/index.js
CHANGED
|
@@ -24,4 +24,26 @@ Object.keys(_ToolbarButton).forEach(function (key) {
|
|
|
24
24
|
return _ToolbarButton[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
});
|
|
28
|
+
var _Toolbar2 = require("./Toolbar.types");
|
|
29
|
+
Object.keys(_Toolbar2).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _Toolbar2[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _Toolbar2[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var _chartToolbarClasses = require("./chartToolbarClasses");
|
|
40
|
+
Object.keys(_chartToolbarClasses).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _chartToolbarClasses[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _chartToolbarClasses[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
27
49
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChartsToolbar = ChartsToolbar;
|
|
7
|
+
/**
|
|
8
|
+
* The chart toolbar component.
|
|
9
|
+
*
|
|
10
|
+
* In the community package, this component is empty and does not render anything.
|
|
11
|
+
*/
|
|
12
|
+
function ChartsToolbar() {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
@@ -10,6 +10,4 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
* @ignore - internal component.
|
|
11
11
|
*/
|
|
12
12
|
const ChartContext = exports.ChartContext = /*#__PURE__*/React.createContext(null);
|
|
13
|
-
if (process.env.NODE_ENV !==
|
|
14
|
-
ChartContext.displayName = 'ChartContext';
|
|
15
|
-
}
|
|
13
|
+
if (process.env.NODE_ENV !== "production") ChartContext.displayName = "ChartContext";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
|
|
3
|
+
type SlotProps<T extends Record<keyof T, React.ComponentType<any>>> = { [key in keyof T]: React.ComponentProps<T[key]> };
|
|
4
|
+
export interface ChartsSlotsContextValue<T extends ChartsSlots & Record<keyof T, React.ComponentType<any>> = ChartsSlots> {
|
|
5
|
+
slots: T;
|
|
6
|
+
slotProps: Partial<SlotProps<T>>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ChartsSlotsContext: React.Context<ChartsSlotsContextValue<ChartsSlots> | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Get the slots and slotProps from the nearest `ChartDataProvider` or `ChartDataProviderPro`.
|
|
11
|
+
* @returns {ChartsSlotsContextValue} The slots and slotProps from the context.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useChartsSlots<T extends ChartsSlots & Record<keyof T, React.ComponentType<any>> = ChartsSlots>(): ChartsSlotsContextValue<T>;
|
|
14
|
+
interface ChartsSlotsProviderProps {
|
|
15
|
+
slots?: Partial<ChartsSlots>;
|
|
16
|
+
slotProps?: Partial<ChartsSlotProps>;
|
|
17
|
+
defaultSlots: ChartsSlots;
|
|
18
|
+
}
|
|
19
|
+
export declare function ChartsSlotsProvider(props: React.PropsWithChildren<ChartsSlotsProviderProps>): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.ChartsSlotsContext = void 0;
|
|
10
|
+
exports.ChartsSlotsProvider = ChartsSlotsProvider;
|
|
11
|
+
exports.useChartsSlots = useChartsSlots;
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
var React = _interopRequireWildcard(require("react"));
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
const ChartsSlotsContext = exports.ChartsSlotsContext = /*#__PURE__*/React.createContext(null);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get the slots and slotProps from the nearest `ChartDataProvider` or `ChartDataProviderPro`.
|
|
19
|
+
* @returns {ChartsSlotsContextValue} The slots and slotProps from the context.
|
|
20
|
+
*/
|
|
21
|
+
if (process.env.NODE_ENV !== "production") ChartsSlotsContext.displayName = "ChartsSlotsContext";
|
|
22
|
+
function useChartsSlots() {
|
|
23
|
+
const context = React.useContext(ChartsSlotsContext);
|
|
24
|
+
if (context == null) {
|
|
25
|
+
throw new Error(['MUI X Charts: Could not find the Charts Slots context.', 'It looks like you rendered your component outside of a ChartDataProvider.', 'This can also happen if you are bundling multiple versions of the library.'].join('\n'));
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
}
|
|
29
|
+
function ChartsSlotsProvider(props) {
|
|
30
|
+
const {
|
|
31
|
+
slots,
|
|
32
|
+
slotProps = {},
|
|
33
|
+
defaultSlots,
|
|
34
|
+
children
|
|
35
|
+
} = props;
|
|
36
|
+
const value = React.useMemo(() => ({
|
|
37
|
+
slots: (0, _extends2.default)({}, defaultSlots, slots),
|
|
38
|
+
slotProps
|
|
39
|
+
}), [defaultSlots, slots, slotProps]);
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsSlotsContext.Provider, {
|
|
41
|
+
value: value,
|
|
42
|
+
children: children
|
|
43
|
+
});
|
|
44
|
+
}
|
package/context/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { HighlightScope, FadeOptions, HighlightItemData, HighlightOptions } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
1
|
+
export type { HighlightScope, FadeOptions, HighlightItemData, HighlightOptions } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
2
|
+
export * from "./useChartApiContext.js";
|
package/context/index.js
CHANGED
|
@@ -2,4 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
+
});
|
|
6
|
+
var _useChartApiContext = require("./useChartApiContext");
|
|
7
|
+
Object.keys(_useChartApiContext).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _useChartApiContext[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _useChartApiContext[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
5
16
|
});
|