@mui/x-charts 8.4.0 → 8.5.1
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 +7 -1
- package/BarChart/BarLabel/BarLabel.d.ts +1 -1
- package/BarChart/seriesConfig/seriesProcessor.js +1 -1
- package/BarChart/useBarChartProps.js +1 -1
- package/CHANGELOG.md +215 -0
- package/ChartContainer/ChartContainer.d.ts +21 -2
- package/ChartContainer/ChartContainer.js +16 -0
- 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/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/ChartsGrid/styledComponents.d.ts +2 -2
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +21 -16
- package/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
- package/ChartsTooltip/utils.d.ts +6 -0
- package/ChartsTooltip/utils.js +19 -1
- package/LineChart/LineChart.d.ts +9 -2
- package/LineChart/LineChart.js +7 -1
- package/LineChart/useLineChartProps.js +1 -1
- package/PieChart/PieChart.d.ts +10 -3
- package/PieChart/PieChart.js +12 -11
- package/RadarChart/RadarChart.d.ts +21 -3
- package/RadarChart/RadarChart.js +16 -2
- 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/ScatterChart.d.ts +9 -2
- package/ScatterChart/ScatterChart.js +7 -1
- package/ScatterChart/useScatterChartProps.js +4 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/Toolbar/Toolbar.d.ts +11 -4
- package/Toolbar/Toolbar.js +38 -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 +39 -7
- 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/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 +7 -1
- package/esm/BarChart/BarLabel/BarLabel.d.ts +1 -1
- package/esm/BarChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/BarChart/useBarChartProps.js +1 -1
- package/esm/ChartContainer/ChartContainer.d.ts +21 -2
- package/esm/ChartContainer/ChartContainer.js +16 -0
- 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/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/esm/ChartsGrid/styledComponents.d.ts +2 -2
- package/esm/ChartsReferenceLine/common.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +22 -17
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
- package/esm/ChartsTooltip/utils.d.ts +6 -0
- package/esm/ChartsTooltip/utils.js +16 -1
- package/esm/LineChart/LineChart.d.ts +9 -2
- package/esm/LineChart/LineChart.js +7 -1
- package/esm/LineChart/useLineChartProps.js +1 -1
- package/esm/PieChart/PieChart.d.ts +10 -3
- package/esm/PieChart/PieChart.js +12 -11
- package/esm/RadarChart/RadarChart.d.ts +21 -3
- package/esm/RadarChart/RadarChart.js +16 -2
- 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/ScatterChart.d.ts +9 -2
- package/esm/ScatterChart/ScatterChart.js +7 -1
- package/esm/ScatterChart/useScatterChartProps.js +4 -2
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/Toolbar/Toolbar.d.ts +11 -4
- package/esm/Toolbar/Toolbar.js +36 -6
- 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 +39 -6
- 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/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/index.js +1 -1
- package/esm/internals/components/AxisSharedComponents.d.ts +1 -1
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
- package/esm/internals/constants.d.ts +10 -1
- package/esm/internals/constants.js +10 -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 +6 -1
- package/esm/internals/index.js +6 -1
- package/esm/internals/invertScale.d.ts +2 -0
- package/esm/internals/invertScale.js +8 -0
- package/esm/internals/material/index.d.ts +2 -0
- package/esm/internals/material/index.js +2 -0
- package/esm/internals/plugins/allPlugins.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -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/locales/index.d.ts +3 -1
- package/esm/locales/index.js +2 -0
- package/esm/locales/ptBR.d.ts +16 -0
- package/esm/locales/ptBR.js +9 -0
- package/esm/locales/ptPT.d.ts +16 -0
- package/esm/locales/ptPT.js +9 -0
- package/esm/models/axis.d.ts +2 -1
- package/esm/models/index.d.ts +2 -2
- package/esm/models/index.js +1 -0
- package/esm/models/seriesType/bar.d.ts +2 -2
- package/esm/models/slots/chartsBaseSlotProps.d.ts +7 -0
- package/esm/models/slots/chartsBaseSlots.d.ts +2 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +1 -1
- package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
- package/internals/constants.d.ts +10 -1
- package/internals/constants.js +11 -2
- 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 +6 -1
- package/internals/index.js +68 -8
- package/internals/invertScale.d.ts +2 -0
- package/internals/invertScale.js +14 -0
- package/internals/material/index.d.ts +2 -0
- package/internals/material/index.js +2 -0
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +10 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -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/locales/index.d.ts +3 -1
- package/locales/index.js +22 -0
- package/locales/ptBR.d.ts +16 -0
- package/locales/ptBR.js +15 -0
- package/locales/ptPT.d.ts +16 -0
- package/locales/ptPT.js +15 -0
- package/models/axis.d.ts +2 -1
- package/models/index.d.ts +2 -2
- package/models/index.js +11 -0
- package/models/seriesType/bar.d.ts +2 -2
- package/models/slots/chartsBaseSlotProps.d.ts +7 -0
- package/models/slots/chartsBaseSlots.d.ts +2 -1
- package/package.json +5 -5
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { PieChartPluginSignatures } from "../PieChart/PieChart.plugins.js";
|
|
3
|
+
import { BarChartPluginsSignatures } from "../BarChart/BarChart.plugins.js";
|
|
4
|
+
import { ScatterChartPluginsSignatures } from "../ScatterChart/ScatterChart.plugins.js";
|
|
5
|
+
import { LineChartPluginsSignatures } from "../LineChart/LineChart.plugins.js";
|
|
2
6
|
import { ChartSeriesType } from "../models/seriesType/config.js";
|
|
3
7
|
import { ChartDataProviderProps } from "../ChartDataProvider/index.js";
|
|
4
8
|
import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
5
|
-
import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
9
|
+
import { AllPluginSignatures, DefaultPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
10
|
import { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
11
|
+
import { ChartPublicAPI } from "../internals/plugins/models/index.js";
|
|
7
12
|
export type ChartContainerProps<SeriesType extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<SeriesType>> = Omit<ChartDataProviderProps<SeriesType, TSignatures>, 'children'> & ChartsSurfaceProps;
|
|
8
|
-
|
|
13
|
+
type PluginsPerSeriesType = {
|
|
14
|
+
line: LineChartPluginsSignatures;
|
|
15
|
+
scatter: ScatterChartPluginsSignatures;
|
|
16
|
+
bar: BarChartPluginsSignatures;
|
|
17
|
+
pie: PieChartPluginSignatures;
|
|
18
|
+
composition: DefaultPluginSignatures;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The API of the chart `apiRef` object.
|
|
22
|
+
* The chart type can be passed as the first generic parameter to narrow down the API to the specific chart type.
|
|
23
|
+
* @example ChartApi<'bar'>
|
|
24
|
+
* If the chart is being created using composition, the `composition` value can be used.
|
|
25
|
+
* @example ChartApi<'composition'>
|
|
26
|
+
*/
|
|
27
|
+
export type ChartApi<TSeries extends keyof PluginsPerSeriesType | undefined = undefined, TSignatures extends readonly ChartAnyPluginSignature[] = (TSeries extends keyof PluginsPerSeriesType ? PluginsPerSeriesType[TSeries] : AllPluginSignatures)> = ChartPublicAPI<TSignatures>;
|
|
9
28
|
/**
|
|
10
29
|
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
11
30
|
*
|
|
@@ -6,6 +6,14 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { ChartDataProvider } from "../ChartDataProvider/index.js";
|
|
7
7
|
import { useChartContainerProps } from "./useChartContainerProps.js";
|
|
8
8
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The API of the chart `apiRef` object.
|
|
12
|
+
* The chart type can be passed as the first generic parameter to narrow down the API to the specific chart type.
|
|
13
|
+
* @example ChartApi<'bar'>
|
|
14
|
+
* If the chart is being created using composition, the `composition` value can be used.
|
|
15
|
+
* @example ChartApi<'composition'>
|
|
16
|
+
*/
|
|
9
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
18
|
/**
|
|
11
19
|
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
@@ -586,6 +594,14 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
586
594
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
587
595
|
*/
|
|
588
596
|
skipAnimation: PropTypes.bool,
|
|
597
|
+
/**
|
|
598
|
+
* The props for the slots.
|
|
599
|
+
*/
|
|
600
|
+
slotProps: PropTypes.object,
|
|
601
|
+
/**
|
|
602
|
+
* Slots to customize charts' components.
|
|
603
|
+
*/
|
|
604
|
+
slots: PropTypes.object,
|
|
589
605
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
590
606
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
591
607
|
title: PropTypes.string,
|
|
@@ -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 = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText"];
|
|
5
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps"];
|
|
6
6
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
7
7
|
export const useChartContainerProps = (props, ref) => {
|
|
8
8
|
const _ref = props,
|
|
@@ -32,7 +32,9 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
32
32
|
skipAnimation,
|
|
33
33
|
seriesConfig,
|
|
34
34
|
plugins,
|
|
35
|
-
localeText
|
|
35
|
+
localeText,
|
|
36
|
+
slots,
|
|
37
|
+
slotProps
|
|
36
38
|
} = _ref,
|
|
37
39
|
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
38
40
|
const chartsSurfaceProps = _extends({
|
|
@@ -63,7 +65,9 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
63
65
|
height,
|
|
64
66
|
localeText,
|
|
65
67
|
seriesConfig,
|
|
66
|
-
plugins: plugins ?? DEFAULT_PLUGINS
|
|
68
|
+
plugins: plugins ?? DEFAULT_PLUGINS,
|
|
69
|
+
slots,
|
|
70
|
+
slotProps
|
|
67
71
|
};
|
|
68
72
|
return {
|
|
69
73
|
chartDataProviderProps,
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
|
|
2
3
|
import { ChartProviderProps } from "../context/ChartProvider/index.js";
|
|
3
4
|
import { ChartSeriesType } from "../models/seriesType/config.js";
|
|
4
5
|
import { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
5
6
|
import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
7
|
import { ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
|
|
7
|
-
export type ChartDataProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>> = React.PropsWithChildren<ChartProviderProps<TSeries, TSignatures>['pluginParams'] & Pick<ChartProviderProps<TSeries, TSignatures>, 'seriesConfig' | 'plugins'>> & ChartsLocalizationProviderProps
|
|
8
|
+
export type ChartDataProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>> = React.PropsWithChildren<ChartProviderProps<TSeries, TSignatures>['pluginParams'] & Pick<ChartProviderProps<TSeries, TSignatures>, 'seriesConfig' | 'plugins'>> & ChartsLocalizationProviderProps & {
|
|
9
|
+
/**
|
|
10
|
+
* Slots to customize charts' components.
|
|
11
|
+
*/
|
|
12
|
+
slots?: Partial<ChartsSlots>;
|
|
13
|
+
/**
|
|
14
|
+
* The props for the slots.
|
|
15
|
+
*/
|
|
16
|
+
slotProps?: Partial<ChartsSlotProps>;
|
|
17
|
+
};
|
|
8
18
|
/**
|
|
9
19
|
* Orchestrates the data providers for the chart components and hooks.
|
|
10
20
|
*
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { defaultSlotsMaterial } from "../internals/material/index.js";
|
|
7
|
+
import { ChartsSlotsProvider } from "../context/ChartsSlotsContext.js";
|
|
6
8
|
import { useChartDataProviderProps } from "./useChartDataProviderProps.js";
|
|
7
9
|
import { ChartProvider } from "../context/ChartProvider/index.js";
|
|
8
10
|
import { ChartsLocalizationProvider } from "../ChartsLocalizationProvider/index.js";
|
|
@@ -38,12 +40,19 @@ function ChartDataProvider(props) {
|
|
|
38
40
|
const {
|
|
39
41
|
children,
|
|
40
42
|
localeText,
|
|
41
|
-
chartProviderProps
|
|
43
|
+
chartProviderProps,
|
|
44
|
+
slots,
|
|
45
|
+
slotProps
|
|
42
46
|
} = useChartDataProviderProps(props);
|
|
43
47
|
return /*#__PURE__*/_jsx(ChartProvider, _extends({}, chartProviderProps, {
|
|
44
48
|
children: /*#__PURE__*/_jsx(ChartsLocalizationProvider, {
|
|
45
49
|
localeText: localeText,
|
|
46
|
-
children:
|
|
50
|
+
children: /*#__PURE__*/_jsx(ChartsSlotsProvider, {
|
|
51
|
+
slots: slots,
|
|
52
|
+
slotProps: slotProps,
|
|
53
|
+
defaultSlots: defaultSlotsMaterial,
|
|
54
|
+
children: children
|
|
55
|
+
})
|
|
47
56
|
})
|
|
48
57
|
}));
|
|
49
58
|
}
|
|
@@ -100,6 +109,14 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
|
100
109
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
101
110
|
*/
|
|
102
111
|
skipAnimation: PropTypes.bool,
|
|
112
|
+
/**
|
|
113
|
+
* The props for the slots.
|
|
114
|
+
*/
|
|
115
|
+
slotProps: PropTypes.object,
|
|
116
|
+
/**
|
|
117
|
+
* Slots to customize charts' components.
|
|
118
|
+
*/
|
|
119
|
+
slots: PropTypes.object,
|
|
103
120
|
theme: PropTypes.oneOf(['dark', 'light']),
|
|
104
121
|
/**
|
|
105
122
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -8,4 +8,6 @@ export declare const useChartDataProviderProps: <TSeries extends ChartSeriesType
|
|
|
8
8
|
children: import("react").ReactNode;
|
|
9
9
|
localeText: Partial<import("../locales/index.js").ChartsLocaleText> | undefined;
|
|
10
10
|
chartProviderProps: ChartProviderProps<TSeries, TSignatures>;
|
|
11
|
+
slots: Partial<import("../internals/index.js").ChartsSlots> | undefined;
|
|
12
|
+
slotProps: Partial<import("../internals/index.js").ChartsSlotProps> | undefined;
|
|
11
13
|
};
|
|
@@ -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 = ["children", "localeText", "plugins", "seriesConfig"];
|
|
5
|
+
const _excluded = ["children", "localeText", "plugins", "seriesConfig", "slots", "slotProps"];
|
|
6
6
|
import { useTheme } from '@mui/material/styles';
|
|
7
7
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
8
8
|
export const useChartDataProviderProps = props => {
|
|
@@ -10,7 +10,9 @@ export const useChartDataProviderProps = props => {
|
|
|
10
10
|
children,
|
|
11
11
|
localeText,
|
|
12
12
|
plugins = DEFAULT_PLUGINS,
|
|
13
|
-
seriesConfig
|
|
13
|
+
seriesConfig,
|
|
14
|
+
slots,
|
|
15
|
+
slotProps
|
|
14
16
|
} = props,
|
|
15
17
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
16
18
|
const theme = useTheme();
|
|
@@ -24,6 +26,8 @@ export const useChartDataProviderProps = props => {
|
|
|
24
26
|
return {
|
|
25
27
|
children,
|
|
26
28
|
localeText,
|
|
27
|
-
chartProviderProps
|
|
29
|
+
chartProviderProps,
|
|
30
|
+
slots,
|
|
31
|
+
slotProps
|
|
28
32
|
};
|
|
29
33
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChartsAxisHighlightType } from "./ChartsAxisHighlight.types.js";
|
|
2
|
-
export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
2
|
+
export declare const ChartsAxisHighlightPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
3
3
|
ownerState: {
|
|
4
4
|
axisHighlight: ChartsAxisHighlightType;
|
|
5
5
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const GridRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
2
|
-
export declare const GridLine: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").SVGLineElementAttributes<SVGLineElement>, keyof import("react").SVGLineElementAttributes<SVGLineElement>>, {}>;
|
|
1
|
+
export declare const GridRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
2
|
+
export declare const GridLine: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGLineElementAttributes<SVGLineElement>, keyof import("react").SVGLineElementAttributes<SVGLineElement>>, {}>;
|
|
@@ -38,4 +38,4 @@ export type CommonChartsReferenceLineProps = {
|
|
|
38
38
|
*/
|
|
39
39
|
classes?: Partial<ChartsReferenceLineClasses>;
|
|
40
40
|
};
|
|
41
|
-
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
|
|
41
|
+
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
|
|
@@ -25,7 +25,7 @@ function ChartsTooltip(props) {
|
|
|
25
25
|
} = props;
|
|
26
26
|
const classes = useUtilityClasses(propClasses);
|
|
27
27
|
return /*#__PURE__*/_jsx(ChartsTooltipContainer, _extends({}, props, {
|
|
28
|
-
classes:
|
|
28
|
+
classes: propClasses,
|
|
29
29
|
children: trigger === 'axis' ? /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
|
|
30
30
|
classes: classes
|
|
31
31
|
}) : /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
|
|
@@ -11,7 +11,8 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
11
11
|
import Popper from '@mui/material/Popper';
|
|
12
12
|
import NoSsr from '@mui/material/NoSsr';
|
|
13
13
|
import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
14
|
-
import { usePointerType } from "./utils.js";
|
|
14
|
+
import { useIsFineMainPointer, usePointerType } from "./utils.js";
|
|
15
|
+
import { useUtilityClasses } from "./chartsTooltipClasses.js";
|
|
15
16
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
16
17
|
import { useStore } from "../internals/store/useStore.js";
|
|
17
18
|
import { selectorChartsInteractionItemIsDefined } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
@@ -46,12 +47,14 @@ function ChartsTooltipContainer(inProps) {
|
|
|
46
47
|
});
|
|
47
48
|
const {
|
|
48
49
|
trigger = 'axis',
|
|
49
|
-
classes,
|
|
50
|
+
classes: propClasses,
|
|
50
51
|
children
|
|
51
52
|
} = props,
|
|
52
53
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
54
|
+
const classes = useUtilityClasses(propClasses);
|
|
53
55
|
const svgRef = useSvgRef();
|
|
54
56
|
const pointerType = usePointerType();
|
|
57
|
+
const isFineMainPointer = useIsFineMainPointer();
|
|
55
58
|
const popperRef = React.useRef(null);
|
|
56
59
|
const positionRef = useLazyRef(() => ({
|
|
57
60
|
x: 0,
|
|
@@ -60,14 +63,12 @@ function ChartsTooltipContainer(inProps) {
|
|
|
60
63
|
const axisSystem = useAxisSystem();
|
|
61
64
|
const store = useStore();
|
|
62
65
|
const isOpen = useSelector(store, trigger === 'axis' ? axisSystem === 'polar' && selectorChartsInteractionPolarAxisTooltip || axisSystem === 'cartesian' && selectorChartsInteractionAxisTooltip || noAxis : selectorChartsInteractionItemIsDefined);
|
|
63
|
-
const popperOpen = pointerType !== null && isOpen; // tooltipHasData;
|
|
64
|
-
|
|
65
66
|
React.useEffect(() => {
|
|
66
67
|
const element = svgRef.current;
|
|
67
68
|
if (element === null) {
|
|
68
69
|
return () => {};
|
|
69
70
|
}
|
|
70
|
-
const
|
|
71
|
+
const handlePointerEvent = event => {
|
|
71
72
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
72
73
|
positionRef.current = {
|
|
73
74
|
x: event.clientX,
|
|
@@ -75,9 +76,11 @@ function ChartsTooltipContainer(inProps) {
|
|
|
75
76
|
};
|
|
76
77
|
popperRef.current?.update();
|
|
77
78
|
};
|
|
78
|
-
element.addEventListener('
|
|
79
|
+
element.addEventListener('pointerdown', handlePointerEvent);
|
|
80
|
+
element.addEventListener('pointermove', handlePointerEvent);
|
|
79
81
|
return () => {
|
|
80
|
-
element.removeEventListener('
|
|
82
|
+
element.removeEventListener('pointerdown', handlePointerEvent);
|
|
83
|
+
element.removeEventListener('pointermove', handlePointerEvent);
|
|
81
84
|
};
|
|
82
85
|
}, [svgRef, positionRef]);
|
|
83
86
|
const anchorEl = React.useMemo(() => ({
|
|
@@ -93,32 +96,34 @@ function ChartsTooltipContainer(inProps) {
|
|
|
93
96
|
toJSON: () => ''
|
|
94
97
|
})
|
|
95
98
|
}), [positionRef]);
|
|
99
|
+
const isMouse = pointerType?.pointerType === 'mouse' || isFineMainPointer;
|
|
100
|
+
const isTouch = pointerType?.pointerType === 'touch' || !isFineMainPointer;
|
|
96
101
|
const modifiers = React.useMemo(() => [{
|
|
97
102
|
name: 'offset',
|
|
98
103
|
options: {
|
|
99
104
|
offset: () => {
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
return [0, 8];
|
|
105
|
+
if (isTouch) {
|
|
106
|
+
return [0, 64];
|
|
103
107
|
}
|
|
104
|
-
|
|
108
|
+
// The popper offset: [skidding, distance]
|
|
109
|
+
return [0, 8];
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
|
-
}, ...(
|
|
108
|
-
: [{
|
|
112
|
+
}, ...(!isMouse ? [{
|
|
109
113
|
name: 'flip',
|
|
110
114
|
options: {
|
|
111
115
|
fallbackPlacements: ['top-end', 'top-start', 'bottom-end', 'bottom']
|
|
112
116
|
}
|
|
113
|
-
}]
|
|
117
|
+
}] : []) // Keep default behavior
|
|
118
|
+
], [isMouse, isTouch]);
|
|
114
119
|
if (trigger === 'none') {
|
|
115
120
|
return null;
|
|
116
121
|
}
|
|
117
122
|
return /*#__PURE__*/_jsx(NoSsr, {
|
|
118
|
-
children:
|
|
123
|
+
children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({
|
|
119
124
|
className: classes?.root,
|
|
120
|
-
open:
|
|
121
|
-
placement:
|
|
125
|
+
open: isOpen,
|
|
126
|
+
placement: isMouse ? 'right-start' : 'top',
|
|
122
127
|
popperRef: popperRef,
|
|
123
128
|
anchorEl: anchorEl,
|
|
124
129
|
modifiers: modifiers
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @ignore - internal component.
|
|
3
3
|
*/
|
|
4
|
-
export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const ChartsTooltipPaper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
5
5
|
/**
|
|
6
6
|
* @ignore - internal component.
|
|
7
7
|
*/
|
|
8
|
-
export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
|
|
8
|
+
export declare const ChartsTooltipTable: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, keyof import("react").ClassAttributes<HTMLTableElement> | keyof import("react").TableHTMLAttributes<HTMLTableElement>>, {}>;
|
|
9
9
|
/**
|
|
10
10
|
* @ignore - internal component.
|
|
11
11
|
*/
|
|
12
|
-
export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
|
|
12
|
+
export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, keyof import("react").ClassAttributes<HTMLTableRowElement> | keyof import("react").HTMLAttributes<HTMLTableRowElement>>, {}>;
|
|
13
13
|
/**
|
|
14
14
|
* @ignore - internal component.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "
|
|
16
|
+
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
17
17
|
component?: React.ElementType;
|
|
18
18
|
}, {}, {}>;
|
|
@@ -13,4 +13,10 @@ type PointerType = Pick<MousePosition, 'pointerType'>;
|
|
|
13
13
|
export declare function usePointerType(): null | PointerType;
|
|
14
14
|
export type TriggerOptions = 'item' | 'axis' | 'none';
|
|
15
15
|
export declare function utcFormatter(v: string | number | Date): string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if the main pointer is fine (e.g. mouse).
|
|
18
|
+
* This is useful for determining how to position tooltips or other UI elements based on the type of input device.
|
|
19
|
+
* @returns true if the main pointer is fine, false otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export declare const useIsFineMainPointer: () => boolean;
|
|
16
22
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
4
5
|
import { useSvgRef } from "../hooks/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* @deprecated We recommend using vanilla JS to let popper track mouse position.
|
|
@@ -80,4 +81,18 @@ export function utcFormatter(v) {
|
|
|
80
81
|
return v.toUTCString();
|
|
81
82
|
}
|
|
82
83
|
return v.toLocaleString();
|
|
83
|
-
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Taken from @mui/x-date-time-pickers
|
|
87
|
+
const mainPointerFineMediaQuery = '@media (pointer: fine)';
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns true if the main pointer is fine (e.g. mouse).
|
|
91
|
+
* This is useful for determining how to position tooltips or other UI elements based on the type of input device.
|
|
92
|
+
* @returns true if the main pointer is fine, false otherwise.
|
|
93
|
+
*/
|
|
94
|
+
export const useIsFineMainPointer = () => {
|
|
95
|
+
return useMediaQuery(mainPointerFineMediaQuery, {
|
|
96
|
+
defaultMatches: true
|
|
97
|
+
});
|
|
98
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
import { ChartsSlots, ChartsSlotProps } from "../internals/material/index.js";
|
|
3
4
|
import { AreaPlotProps, AreaPlotSlotProps, AreaPlotSlots } from "./AreaPlot.js";
|
|
4
5
|
import { LinePlotProps, LinePlotSlotProps, LinePlotSlots } from "./LinePlot.js";
|
|
5
6
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
@@ -14,8 +15,9 @@ import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from "./LineHighli
|
|
|
14
15
|
import { ChartsGridProps } from "../ChartsGrid/index.js";
|
|
15
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
16
17
|
import { LineChartPluginsSignatures } from "./LineChart.plugins.js";
|
|
17
|
-
|
|
18
|
-
export interface
|
|
18
|
+
import { ChartsToolbarSlots, ChartsToolbarSlotProps } from "../Toolbar/index.js";
|
|
19
|
+
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
20
|
+
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
19
21
|
export interface LineChartProps extends Omit<ChartContainerProps<'line', LineChartPluginsSignatures>, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'> {
|
|
20
22
|
/**
|
|
21
23
|
* The series to display in the line chart.
|
|
@@ -67,6 +69,11 @@ export interface LineChartProps extends Omit<ChartContainerProps<'line', LineCha
|
|
|
67
69
|
* @default false
|
|
68
70
|
*/
|
|
69
71
|
skipAnimation?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* If true, shows the default chart toolbar.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
showToolbar?: boolean;
|
|
70
77
|
}
|
|
71
78
|
/**
|
|
72
79
|
* Demos:
|
|
@@ -57,9 +57,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
57
57
|
chartsSurfaceProps
|
|
58
58
|
} = useChartContainerProps(chartContainerProps, ref);
|
|
59
59
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
60
|
+
const Toolbar = props.slots?.toolbar;
|
|
60
61
|
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProps, {
|
|
61
62
|
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
62
|
-
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
63
|
+
children: [props.showToolbar && Toolbar ? /*#__PURE__*/_jsx(Toolbar, _extends({}, props.slotProps?.toolbar)) : null, !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
63
64
|
children: [/*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
64
65
|
children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
65
66
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
@@ -189,6 +190,11 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
189
190
|
* An array of [[LineSeriesType]] objects.
|
|
190
191
|
*/
|
|
191
192
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
193
|
+
/**
|
|
194
|
+
* If true, shows the default chart toolbar.
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
showToolbar: PropTypes.bool,
|
|
192
198
|
/**
|
|
193
199
|
* If `true`, animations are skipped.
|
|
194
200
|
* @default false
|
|
@@ -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 = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -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 { ChartsSlotProps, ChartsSlots } from "../internals/material/index.js";
|
|
3
5
|
import { ChartContainerProps } from "../ChartContainer/index.js";
|
|
4
6
|
import { PieSeriesType } from "../models/seriesType/index.js";
|
|
5
7
|
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from "../ChartsTooltip/ChartTooltip.types.js";
|
|
@@ -8,9 +10,9 @@ import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from "./PiePlot.js";
|
|
|
8
10
|
import { PieValueType } from "../models/seriesType/pie.js";
|
|
9
11
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from "../ChartsOverlay/index.js";
|
|
10
12
|
import { PieChartPluginSignatures } from "./PieChart.plugins.js";
|
|
11
|
-
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {}
|
|
12
|
-
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {}
|
|
13
|
-
export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
13
|
+
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots, ChartsToolbarSlots, Partial<ChartsSlots> {}
|
|
14
|
+
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps, ChartsToolbarSlotProps, Partial<ChartsSlotProps> {}
|
|
15
|
+
export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartPluginSignatures>, 'series' | 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
14
16
|
/**
|
|
15
17
|
* The series to display in the pie chart.
|
|
16
18
|
* An array of [[PieSeriesType]] objects.
|
|
@@ -24,6 +26,11 @@ export interface PieChartProps extends Omit<ChartContainerProps<'pie', PieChartP
|
|
|
24
26
|
* Callback fired when a pie arc is clicked.
|
|
25
27
|
*/
|
|
26
28
|
onItemClick?: PiePlotProps['onItemClick'];
|
|
29
|
+
/**
|
|
30
|
+
* If true, shows the default chart toolbar.
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
showToolbar?: boolean;
|
|
27
34
|
/**
|
|
28
35
|
* Overridable component slots.
|
|
29
36
|
* @default {}
|