@mui/x-charts 8.0.0 → 8.1.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.js +4 -0
- package/BarChart/BarPlot.js +1 -2
- package/CHANGELOG.md +106 -0
- package/ChartContainer/ChartContainer.d.ts +1 -0
- package/ChartContainer/ChartContainer.js +4 -0
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartDataProvider/ChartDataProvider.d.ts +2 -1
- package/ChartDataProvider/ChartDataProvider.js +10 -1
- package/ChartDataProvider/useChartDataProviderProps.d.ts +3 -1
- package/ChartDataProvider/useChartDataProviderProps.js +3 -1
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +1 -2
- package/ChartsGrid/styledComponents.js +1 -2
- package/ChartsLabel/ChartsLabelGradient.js +1 -2
- package/ChartsLabel/ChartsLabelMark.js +1 -2
- package/ChartsLegend/ChartsLegend.js +1 -2
- package/ChartsLegend/ContinuousColorLegend.js +1 -2
- package/ChartsLegend/PiecewiseColorLegend.js +1 -2
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.d.ts +27 -0
- package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +73 -0
- package/ChartsLocalizationProvider/index.d.ts +2 -0
- package/ChartsLocalizationProvider/index.js +12 -0
- package/ChartsOverlay/ChartsLoadingOverlay.js +5 -1
- package/ChartsOverlay/ChartsNoDataOverlay.js +5 -1
- package/ChartsOverlay/ChartsOverlay.d.ts +2 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +11 -10
- package/ChartsTooltip/ChartsTooltipTable.js +3 -5
- package/ChartsTooltip/utils.d.ts +1 -1
- package/ChartsTooltip/utils.js +0 -1
- package/ChartsXAxis/ChartsXAxis.js +1 -2
- package/ChartsYAxis/ChartsYAxis.js +1 -2
- package/Gauge/GaugeReferenceArc.js +1 -2
- package/Gauge/GaugeValueArc.js +1 -2
- package/LineChart/AreaPlot.js +1 -2
- package/LineChart/LineChart.js +4 -0
- package/LineChart/LinePlot.js +1 -2
- package/LineChart/MarkElement.js +1 -2
- package/PieChart/PieArc.js +1 -1
- package/PieChart/PieArcLabel.js +1 -2
- package/PieChart/PieChart.js +4 -0
- package/RadarChart/RadarChart.js +4 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +4 -0
- package/ScatterChart/ScatterChart.js +4 -0
- package/SparkLineChart/SparkLineChart.js +4 -0
- package/context/ChartProvider/ChartProvider.types.d.ts +4 -0
- package/esm/BarChart/BarChart.js +4 -0
- package/esm/BarChart/BarPlot.js +1 -2
- package/esm/ChartContainer/ChartContainer.d.ts +1 -0
- package/esm/ChartContainer/ChartContainer.js +4 -0
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +2 -1
- package/esm/ChartDataProvider/ChartDataProvider.js +10 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +3 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.js +3 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.js +1 -2
- package/esm/ChartsGrid/styledComponents.js +1 -2
- package/esm/ChartsLabel/ChartsLabelGradient.js +1 -2
- package/esm/ChartsLabel/ChartsLabelMark.js +1 -2
- package/esm/ChartsLegend/ChartsLegend.js +1 -2
- package/esm/ChartsLegend/ContinuousColorLegend.js +1 -2
- package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -2
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.d.ts +27 -0
- package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +66 -0
- package/esm/ChartsLocalizationProvider/index.d.ts +2 -0
- package/esm/ChartsLocalizationProvider/index.js +1 -0
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +5 -1
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +5 -1
- package/esm/ChartsOverlay/ChartsOverlay.d.ts +2 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +11 -10
- package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -5
- package/esm/ChartsTooltip/utils.d.ts +1 -1
- package/esm/ChartsTooltip/utils.js +0 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -2
- package/esm/Gauge/GaugeReferenceArc.js +1 -2
- package/esm/Gauge/GaugeValueArc.js +1 -2
- package/esm/LineChart/AreaPlot.js +1 -2
- package/esm/LineChart/LineChart.js +4 -0
- package/esm/LineChart/LinePlot.js +1 -2
- package/esm/LineChart/MarkElement.js +1 -2
- package/esm/PieChart/PieArc.js +1 -1
- package/esm/PieChart/PieArcLabel.js +1 -2
- package/esm/PieChart/PieChart.js +4 -0
- package/esm/RadarChart/RadarChart.js +4 -0
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +4 -0
- package/esm/ScatterChart/ScatterChart.js +4 -0
- package/esm/SparkLineChart/SparkLineChart.js +4 -0
- package/esm/context/ChartProvider/ChartProvider.types.d.ts +4 -0
- package/esm/hooks/index.d.ts +3 -1
- package/esm/hooks/index.js +3 -1
- package/esm/hooks/useChartRootRef.d.ts +6 -0
- package/esm/hooks/useChartRootRef.js +12 -0
- package/esm/hooks/useChartsLocalization.d.ts +1 -0
- package/esm/hooks/useChartsLocalization.js +9 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +2 -1
- package/esm/internals/components/AxisSharedComponents.js +1 -2
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +4 -2
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +0 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +3 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +15 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3 -3
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +8 -0
- package/esm/internals/plugins/models/plugin.d.ts +4 -0
- package/esm/internals/store/useCharts.d.ts +1 -0
- package/esm/internals/store/useCharts.js +4 -1
- package/esm/locales/enUS.d.ts +15 -0
- package/esm/locales/enUS.js +11 -0
- package/esm/locales/frFR.d.ts +14 -0
- package/esm/locales/frFR.js +7 -0
- package/esm/locales/index.d.ts +3 -0
- package/esm/locales/index.js +3 -0
- package/esm/locales/utils/chartsLocaleTextApi.d.ts +11 -0
- package/esm/locales/utils/chartsLocaleTextApi.js +1 -0
- package/esm/locales/utils/getChartsLocalization.d.ts +18 -0
- package/esm/locales/utils/getChartsLocalization.js +17 -0
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/props.d.ts +2 -0
- package/hooks/index.d.ts +3 -1
- package/hooks/index.js +24 -0
- package/hooks/useChartRootRef.d.ts +6 -0
- package/hooks/useChartRootRef.js +16 -0
- package/hooks/useChartsLocalization.d.ts +1 -0
- package/hooks/useChartsLocalization.js +17 -0
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/components/AxisSharedComponents.js +1 -2
- package/internals/components/ChartsWrapper/ChartsWrapper.js +4 -2
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +0 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +15 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +8 -0
- package/internals/plugins/models/plugin.d.ts +4 -0
- package/internals/store/useCharts.d.ts +1 -0
- package/internals/store/useCharts.js +4 -1
- package/locales/enUS.d.ts +15 -0
- package/locales/enUS.js +16 -0
- package/locales/frFR.d.ts +14 -0
- package/locales/frFR.js +13 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +27 -0
- package/locales/utils/chartsLocaleTextApi.d.ts +11 -0
- package/locales/utils/chartsLocaleTextApi.js +5 -0
- package/locales/utils/getChartsLocalization.d.ts +18 -0
- package/locales/utils/getChartsLocalization.js +25 -0
- package/package.json +1 -2
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
package/Gauge/GaugeValueArc.js
CHANGED
|
@@ -19,8 +19,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
const _excluded = ["cx", "cy", "startAngle", "endAngle", "cornerRadius", "innerRadius", "outerRadius", "skipAnimation"];
|
|
20
20
|
const StyledPath = (0, _styles.styled)('path', {
|
|
21
21
|
name: 'MuiGauge',
|
|
22
|
-
slot: 'ReferenceArc'
|
|
23
|
-
overridesResolver: (props, styles) => styles.referenceArc
|
|
22
|
+
slot: 'ReferenceArc'
|
|
24
23
|
})(({
|
|
25
24
|
theme
|
|
26
25
|
}) => ({
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -27,8 +27,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
27
27
|
const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
28
28
|
const AreaPlotRoot = (0, _styles.styled)('g', {
|
|
29
29
|
name: 'MuiAreaPlot',
|
|
30
|
-
slot: 'Root'
|
|
31
|
-
overridesResolver: (_, styles) => styles.root
|
|
30
|
+
slot: 'Root'
|
|
32
31
|
})({
|
|
33
32
|
[`& .${_AreaElement.areaElementClasses.root}`]: {
|
|
34
33
|
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
package/LineChart/LineChart.js
CHANGED
|
@@ -149,6 +149,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
149
149
|
* @default false
|
|
150
150
|
*/
|
|
151
151
|
loading: _propTypes.default.bool,
|
|
152
|
+
/**
|
|
153
|
+
* Localized text for chart components.
|
|
154
|
+
*/
|
|
155
|
+
localeText: _propTypes.default.object,
|
|
152
156
|
/**
|
|
153
157
|
* The margin between the SVG and the drawing area.
|
|
154
158
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -28,8 +28,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
29
29
|
const LinePlotRoot = (0, _styles.styled)('g', {
|
|
30
30
|
name: 'MuiAreaPlot',
|
|
31
|
-
slot: 'Root'
|
|
32
|
-
overridesResolver: (_, styles) => styles.root
|
|
31
|
+
slot: 'Root'
|
|
33
32
|
})({
|
|
34
33
|
[`& .${_LineElement.lineElementClasses.root}`]: {
|
|
35
34
|
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -25,8 +25,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
25
25
|
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation"];
|
|
26
26
|
const MarkElementPath = (0, _styles.styled)('path', {
|
|
27
27
|
name: 'MuiMarkElement',
|
|
28
|
-
slot: 'Root'
|
|
29
|
-
overridesResolver: (_, styles) => styles.root
|
|
28
|
+
slot: 'Root'
|
|
30
29
|
})(({
|
|
31
30
|
ownerState,
|
|
32
31
|
theme
|
package/PieChart/PieArc.js
CHANGED
|
@@ -42,7 +42,7 @@ const useUtilityClasses = ownerState => {
|
|
|
42
42
|
const PieArcRoot = (0, _styles.styled)('path', {
|
|
43
43
|
name: 'MuiPieArc',
|
|
44
44
|
slot: 'Root',
|
|
45
|
-
overridesResolver: (_, styles) => styles.arc
|
|
45
|
+
overridesResolver: (_, styles) => styles.arc // FIXME: Inconsistent naming with slot
|
|
46
46
|
})(({
|
|
47
47
|
theme
|
|
48
48
|
}) => ({
|
package/PieChart/PieArcLabel.js
CHANGED
package/PieChart/PieChart.js
CHANGED
|
@@ -155,6 +155,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
155
155
|
* @default false
|
|
156
156
|
*/
|
|
157
157
|
loading: _propTypes.default.bool,
|
|
158
|
+
/**
|
|
159
|
+
* Localized text for chart components.
|
|
160
|
+
*/
|
|
161
|
+
localeText: _propTypes.default.object,
|
|
158
162
|
/**
|
|
159
163
|
* The margin between the SVG and the drawing area.
|
|
160
164
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
package/RadarChart/RadarChart.js
CHANGED
|
@@ -106,6 +106,10 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
106
106
|
* @default false
|
|
107
107
|
*/
|
|
108
108
|
loading: _propTypes.default.bool,
|
|
109
|
+
/**
|
|
110
|
+
* Localized text for chart components.
|
|
111
|
+
*/
|
|
112
|
+
localeText: _propTypes.default.object,
|
|
109
113
|
/**
|
|
110
114
|
* The margin between the SVG and the drawing area.
|
|
111
115
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -141,6 +141,10 @@ process.env.NODE_ENV !== "production" ? RadarDataProvider.propTypes = {
|
|
|
141
141
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
142
142
|
*/
|
|
143
143
|
id: _propTypes.default.string,
|
|
144
|
+
/**
|
|
145
|
+
* Localized text for chart components.
|
|
146
|
+
*/
|
|
147
|
+
localeText: _propTypes.default.object,
|
|
144
148
|
/**
|
|
145
149
|
* The margin between the SVG and the drawing area.
|
|
146
150
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -141,6 +141,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
141
141
|
* @default false
|
|
142
142
|
*/
|
|
143
143
|
loading: _propTypes.default.bool,
|
|
144
|
+
/**
|
|
145
|
+
* Localized text for chart components.
|
|
146
|
+
*/
|
|
147
|
+
localeText: _propTypes.default.object,
|
|
144
148
|
/**
|
|
145
149
|
* The margin between the SVG and the drawing area.
|
|
146
150
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -184,6 +184,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
184
184
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
185
185
|
*/
|
|
186
186
|
id: _propTypes.default.string,
|
|
187
|
+
/**
|
|
188
|
+
* Localized text for chart components.
|
|
189
|
+
*/
|
|
190
|
+
localeText: _propTypes.default.object,
|
|
187
191
|
/**
|
|
188
192
|
* The margin between the SVG and the drawing area.
|
|
189
193
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -22,6 +22,10 @@ export type ChartContextValue<TSignatures extends readonly ChartAnyPluginSignatu
|
|
|
22
22
|
* The ref to the <svg />.
|
|
23
23
|
*/
|
|
24
24
|
svgRef: React.RefObject<SVGSVGElement | null>;
|
|
25
|
+
/**
|
|
26
|
+
* The ref to the chart root element.
|
|
27
|
+
*/
|
|
28
|
+
chartRootRef: React.RefObject<HTMLDivElement | null>;
|
|
25
29
|
};
|
|
26
30
|
export type ChartPluginParams<TSignatures extends readonly ChartAnyPluginSignature[]> = UseChartBaseProps<TSignatures> & MergeSignaturesProperty<[...ChartCorePluginSignatures, ...TSignatures], 'params'>;
|
|
27
31
|
export interface ChartProviderProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = []> {
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -148,6 +148,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
148
148
|
* @default false
|
|
149
149
|
*/
|
|
150
150
|
loading: PropTypes.bool,
|
|
151
|
+
/**
|
|
152
|
+
* Localized text for chart components.
|
|
153
|
+
*/
|
|
154
|
+
localeText: PropTypes.object,
|
|
151
155
|
/**
|
|
152
156
|
* The margin between the SVG and the drawing area.
|
|
153
157
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -159,8 +159,7 @@ const useAggregatedData = () => {
|
|
|
159
159
|
};
|
|
160
160
|
const BarPlotRoot = styled('g', {
|
|
161
161
|
name: 'MuiBarPlot',
|
|
162
|
-
slot: 'Root'
|
|
163
|
-
overridesResolver: (_, styles) => styles.root
|
|
162
|
+
slot: 'Root'
|
|
164
163
|
})({
|
|
165
164
|
[`& .${barElementClasses.root}`]: {
|
|
166
165
|
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
@@ -5,6 +5,7 @@ import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
|
5
5
|
import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
6
|
import { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
7
7
|
export type ChartContainerProps<SeriesType extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<SeriesType>> = Omit<ChartDataProviderProps<SeriesType, TSignatures>, 'children'> & ChartsSurfaceProps;
|
|
8
|
+
export type ChartApi = NonNullable<NonNullable<ChartContainerProps['apiRef']>['current']>;
|
|
8
9
|
/**
|
|
9
10
|
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
10
11
|
*
|
|
@@ -93,6 +93,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
93
93
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
94
94
|
*/
|
|
95
95
|
id: PropTypes.string,
|
|
96
|
+
/**
|
|
97
|
+
* Localized text for chart components.
|
|
98
|
+
*/
|
|
99
|
+
localeText: PropTypes.object,
|
|
96
100
|
/**
|
|
97
101
|
* The margin between the SVG and the drawing area.
|
|
98
102
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -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"];
|
|
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"];
|
|
6
6
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
7
7
|
export const useChartContainerProps = (props, ref) => {
|
|
8
8
|
const _ref = props,
|
|
@@ -31,7 +31,8 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
31
31
|
radiusAxis,
|
|
32
32
|
skipAnimation,
|
|
33
33
|
seriesConfig,
|
|
34
|
-
plugins
|
|
34
|
+
plugins,
|
|
35
|
+
localeText
|
|
35
36
|
} = _ref,
|
|
36
37
|
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
38
|
const chartsSurfaceProps = _extends({
|
|
@@ -60,6 +61,7 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
60
61
|
skipAnimation,
|
|
61
62
|
width,
|
|
62
63
|
height,
|
|
64
|
+
localeText,
|
|
63
65
|
seriesConfig,
|
|
64
66
|
plugins: plugins ?? DEFAULT_PLUGINS
|
|
65
67
|
};
|
|
@@ -3,7 +3,8 @@ import { ChartProviderProps } from "../context/ChartProvider/index.js";
|
|
|
3
3
|
import { ChartSeriesType } from "../models/seriesType/config.js";
|
|
4
4
|
import { ChartAnyPluginSignature } from "../internals/plugins/models/plugin.js";
|
|
5
5
|
import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
|
-
|
|
6
|
+
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;
|
|
7
8
|
/**
|
|
8
9
|
* Orchestrates the data providers for the chart components and hooks.
|
|
9
10
|
*
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useChartDataProviderProps } from "./useChartDataProviderProps.js";
|
|
7
7
|
import { ChartProvider } from "../context/ChartProvider/index.js";
|
|
8
|
+
import { ChartsLocalizationProvider } from "../ChartsLocalizationProvider/index.js";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
/**
|
|
10
11
|
* Orchestrates the data providers for the chart components and hooks.
|
|
@@ -36,10 +37,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
36
37
|
function ChartDataProvider(props) {
|
|
37
38
|
const {
|
|
38
39
|
children,
|
|
40
|
+
localeText,
|
|
39
41
|
chartProviderProps
|
|
40
42
|
} = useChartDataProviderProps(props);
|
|
41
43
|
return /*#__PURE__*/_jsx(ChartProvider, _extends({}, chartProviderProps, {
|
|
42
|
-
children:
|
|
44
|
+
children: /*#__PURE__*/_jsx(ChartsLocalizationProvider, {
|
|
45
|
+
localeText: localeText,
|
|
46
|
+
children: children
|
|
47
|
+
})
|
|
43
48
|
}));
|
|
44
49
|
}
|
|
45
50
|
process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
@@ -68,6 +73,10 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
|
68
73
|
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
69
74
|
*/
|
|
70
75
|
id: PropTypes.string,
|
|
76
|
+
/**
|
|
77
|
+
* Localized text for chart components.
|
|
78
|
+
*/
|
|
79
|
+
localeText: PropTypes.object,
|
|
71
80
|
/**
|
|
72
81
|
* The margin between the SVG and the drawing area.
|
|
73
82
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -3,7 +3,9 @@ import { ChartProviderProps } from "../context/ChartProvider/index.js";
|
|
|
3
3
|
import { ChartAnyPluginSignature } from "../internals/plugins/models/index.js";
|
|
4
4
|
import { ChartSeriesType } from "../models/seriesType/config.js";
|
|
5
5
|
import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
|
|
6
|
-
|
|
6
|
+
import { ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
|
|
7
|
+
export declare const useChartDataProviderProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartDataProviderProps<TSeries, TSignatures> & ChartsLocalizationProviderProps) => {
|
|
7
8
|
children: import("react").ReactNode;
|
|
9
|
+
localeText: Partial<import("../locales").ChartsLocaleText> | undefined;
|
|
8
10
|
chartProviderProps: ChartProviderProps<TSeries, TSignatures>;
|
|
9
11
|
};
|
|
@@ -2,12 +2,13 @@
|
|
|
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", "plugins", "seriesConfig"];
|
|
5
|
+
const _excluded = ["children", "localeText", "plugins", "seriesConfig"];
|
|
6
6
|
import { useTheme } from '@mui/material/styles';
|
|
7
7
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
8
8
|
export const useChartDataProviderProps = props => {
|
|
9
9
|
const {
|
|
10
10
|
children,
|
|
11
|
+
localeText,
|
|
11
12
|
plugins = DEFAULT_PLUGINS,
|
|
12
13
|
seriesConfig
|
|
13
14
|
} = props,
|
|
@@ -22,6 +23,7 @@ export const useChartDataProviderProps = props => {
|
|
|
22
23
|
};
|
|
23
24
|
return {
|
|
24
25
|
children,
|
|
26
|
+
localeText,
|
|
25
27
|
chartProviderProps
|
|
26
28
|
};
|
|
27
29
|
};
|
|
@@ -4,8 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
export const ChartsAxisHighlightPath = styled('path', {
|
|
6
6
|
name: 'MuiChartsAxisHighlight',
|
|
7
|
-
slot: 'Root'
|
|
8
|
-
overridesResolver: (_, styles) => styles.root
|
|
7
|
+
slot: 'Root'
|
|
9
8
|
})(({
|
|
10
9
|
theme
|
|
11
10
|
}) => ({
|
|
@@ -12,8 +12,7 @@ import { consumeThemeProps } from "../internals/consumeThemeProps.js";
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const Root = styled('div', {
|
|
14
14
|
name: 'MuiChartsLabelMark',
|
|
15
|
-
slot: 'Root'
|
|
16
|
-
overridesResolver: (props, styles) => styles.root
|
|
15
|
+
slot: 'Root'
|
|
17
16
|
})(() => {
|
|
18
17
|
return {
|
|
19
18
|
display: 'flex',
|
|
@@ -16,8 +16,7 @@ import { ChartsLabel } from "../ChartsLabel/ChartsLabel.js";
|
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const RootElement = styled('ul', {
|
|
18
18
|
name: 'MuiChartsLegend',
|
|
19
|
-
slot: 'Root'
|
|
20
|
-
overridesResolver: (props, styles) => styles.root
|
|
19
|
+
slot: 'Root'
|
|
21
20
|
})(({
|
|
22
21
|
ownerState,
|
|
23
22
|
theme
|
|
@@ -16,8 +16,7 @@ import { piecewiseColorDefaultLabelFormatter } from "./piecewiseColorDefaultLabe
|
|
|
16
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const RootElement = styled('ul', {
|
|
18
18
|
name: 'MuiPiecewiseColorLegend',
|
|
19
|
-
slot: 'Root'
|
|
20
|
-
overridesResolver: (props, styles) => styles.root
|
|
19
|
+
slot: 'Root'
|
|
21
20
|
})(({
|
|
22
21
|
theme,
|
|
23
22
|
ownerState
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ChartsLocaleText } from '../locales/utils/chartsLocaleTextApi';
|
|
3
|
+
export interface ChartsLocalizationContextValue {
|
|
4
|
+
localeText: ChartsLocaleText;
|
|
5
|
+
}
|
|
6
|
+
export declare const ChartsLocalizationContext: React.Context<ChartsLocalizationContextValue | null>;
|
|
7
|
+
export interface ChartsLocalizationProviderProps {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Localized text for chart components.
|
|
11
|
+
*/
|
|
12
|
+
localeText?: Partial<ChartsLocaleText>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Demos:
|
|
16
|
+
*
|
|
17
|
+
* - [localization](https://mui.com/x/react-charts/localization/)
|
|
18
|
+
*
|
|
19
|
+
* API:
|
|
20
|
+
*
|
|
21
|
+
* - [ChartsLocalizationProvider API](https://mui.com/x/api/charts/charts-localization-provider/)
|
|
22
|
+
*/
|
|
23
|
+
declare function ChartsLocalizationProvider(inProps: ChartsLocalizationProviderProps): React.JSX.Element;
|
|
24
|
+
declare namespace ChartsLocalizationProvider {
|
|
25
|
+
var propTypes: any;
|
|
26
|
+
}
|
|
27
|
+
export { ChartsLocalizationProvider };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["localeText"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { useThemeProps } from '@mui/material/styles';
|
|
9
|
+
import { DEFAULT_LOCALE } from "../locales/enUS.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
export const ChartsLocalizationContext = /*#__PURE__*/React.createContext(null);
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
ChartsLocalizationContext.displayName = 'ChartsLocalizationContext';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Demos:
|
|
17
|
+
*
|
|
18
|
+
* - [localization](https://mui.com/x/react-charts/localization/)
|
|
19
|
+
*
|
|
20
|
+
* API:
|
|
21
|
+
*
|
|
22
|
+
* - [ChartsLocalizationProvider API](https://mui.com/x/api/charts/charts-localization-provider/)
|
|
23
|
+
*/
|
|
24
|
+
function ChartsLocalizationProvider(inProps) {
|
|
25
|
+
const {
|
|
26
|
+
localeText: inLocaleText
|
|
27
|
+
} = inProps,
|
|
28
|
+
other = _objectWithoutPropertiesLoose(inProps, _excluded);
|
|
29
|
+
const {
|
|
30
|
+
localeText: parentLocaleText
|
|
31
|
+
} = React.useContext(ChartsLocalizationContext) ?? {
|
|
32
|
+
localeText: undefined
|
|
33
|
+
};
|
|
34
|
+
const props = useThemeProps({
|
|
35
|
+
// We don't want to pass the `localeText` prop to the theme, that way it will always return the theme value,
|
|
36
|
+
// We will then merge this theme value with our value manually
|
|
37
|
+
props: other,
|
|
38
|
+
name: 'MuiChartsLocalizationProvider'
|
|
39
|
+
});
|
|
40
|
+
const {
|
|
41
|
+
children,
|
|
42
|
+
localeText: themeLocaleText
|
|
43
|
+
} = props;
|
|
44
|
+
const localeText = React.useMemo(() => _extends({}, DEFAULT_LOCALE, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
|
|
45
|
+
const contextValue = React.useMemo(() => {
|
|
46
|
+
return {
|
|
47
|
+
localeText
|
|
48
|
+
};
|
|
49
|
+
}, [localeText]);
|
|
50
|
+
return /*#__PURE__*/_jsx(ChartsLocalizationContext.Provider, {
|
|
51
|
+
value: contextValue,
|
|
52
|
+
children: children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
process.env.NODE_ENV !== "production" ? ChartsLocalizationProvider.propTypes = {
|
|
56
|
+
// ----------------------------- Warning --------------------------------
|
|
57
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
58
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
59
|
+
// ----------------------------------------------------------------------
|
|
60
|
+
children: PropTypes.node,
|
|
61
|
+
/**
|
|
62
|
+
* Localized text for chart components.
|
|
63
|
+
*/
|
|
64
|
+
localeText: PropTypes.object
|
|
65
|
+
} : void 0;
|
|
66
|
+
export { ChartsLocalizationProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChartsLocalizationProvider } from "./ChartsLocalizationProvider.js";
|
|
@@ -6,6 +6,7 @@ const _excluded = ["message"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
8
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
9
|
+
import { useChartsLocalization } from "../hooks/useChartsLocalization.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const StyledText = styled('text')(({
|
|
11
12
|
theme
|
|
@@ -27,10 +28,13 @@ export function ChartsLoadingOverlay(props) {
|
|
|
27
28
|
height,
|
|
28
29
|
width
|
|
29
30
|
} = useDrawingArea();
|
|
31
|
+
const {
|
|
32
|
+
localeText
|
|
33
|
+
} = useChartsLocalization();
|
|
30
34
|
return /*#__PURE__*/_jsx(StyledText, _extends({
|
|
31
35
|
x: left + width / 2,
|
|
32
36
|
y: top + height / 2
|
|
33
37
|
}, other, {
|
|
34
|
-
children: message ??
|
|
38
|
+
children: message ?? localeText.loading
|
|
35
39
|
}));
|
|
36
40
|
}
|
|
@@ -6,6 +6,7 @@ const _excluded = ["message"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
8
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
9
|
+
import { useChartsLocalization } from "../hooks/useChartsLocalization.js";
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
11
|
const StyledText = styled('text')(({
|
|
11
12
|
theme
|
|
@@ -27,10 +28,13 @@ export function ChartsNoDataOverlay(props) {
|
|
|
27
28
|
height,
|
|
28
29
|
width
|
|
29
30
|
} = useDrawingArea();
|
|
31
|
+
const {
|
|
32
|
+
localeText
|
|
33
|
+
} = useChartsLocalization();
|
|
30
34
|
return /*#__PURE__*/_jsx(StyledText, _extends({
|
|
31
35
|
x: left + width / 2,
|
|
32
36
|
y: top + height / 2
|
|
33
37
|
}, other, {
|
|
34
|
-
children: message ??
|
|
38
|
+
children: message ?? localeText.noData
|
|
35
39
|
}));
|
|
36
40
|
}
|
|
@@ -5,6 +5,8 @@ export declare function useNoData(): boolean;
|
|
|
5
5
|
export type CommonOverlayProps = React.SVGAttributes<SVGTextElement> & {
|
|
6
6
|
/**
|
|
7
7
|
* The message displayed by the overlay.
|
|
8
|
+
* @deprecated The customization of the message should be done with the localization key `loading` and `noData`.
|
|
9
|
+
* @see See {@link https://mui.com/x/react-charts/localization/ localization docs} for more details.
|
|
8
10
|
*/
|
|
9
11
|
message?: string;
|
|
10
12
|
sx?: SxProps<Theme>;
|
|
@@ -22,8 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
22
22
|
const noAxis = () => false;
|
|
23
23
|
const ChartsTooltipRoot = styled(Popper, {
|
|
24
24
|
name: 'MuiChartsTooltip',
|
|
25
|
-
slot: 'Root'
|
|
26
|
-
overridesResolver: (_, styles) => styles.root
|
|
25
|
+
slot: 'Root'
|
|
27
26
|
})(({
|
|
28
27
|
theme
|
|
29
28
|
}) => ({
|
|
@@ -97,18 +96,20 @@ function ChartsTooltipContainer(inProps) {
|
|
|
97
96
|
const modifiers = React.useMemo(() => [{
|
|
98
97
|
name: 'offset',
|
|
99
98
|
options: {
|
|
100
|
-
offset: ({
|
|
101
|
-
placement
|
|
102
|
-
}) => {
|
|
99
|
+
offset: () => {
|
|
103
100
|
if (pointerType?.pointerType !== 'touch') {
|
|
104
|
-
return [0,
|
|
101
|
+
return [0, 8];
|
|
105
102
|
}
|
|
106
|
-
|
|
107
|
-
const placementOffset = isBottom ? 32 : 8;
|
|
108
|
-
return [0, pointerType.height + placementOffset];
|
|
103
|
+
return [0, 64];
|
|
109
104
|
}
|
|
110
105
|
}
|
|
111
|
-
}
|
|
106
|
+
}, ...(pointerType?.pointerType === 'mouse' ? [] // Keep default behavior
|
|
107
|
+
: [{
|
|
108
|
+
name: 'flip',
|
|
109
|
+
options: {
|
|
110
|
+
fallbackPlacements: ['top-end', 'top-start', 'bottom-end', 'bottom']
|
|
111
|
+
}
|
|
112
|
+
}])], [pointerType]);
|
|
112
113
|
if (trigger === 'none') {
|
|
113
114
|
return null;
|
|
114
115
|
}
|
|
@@ -8,7 +8,7 @@ import { chartsTooltipClasses } from "./chartsTooltipClasses.js";
|
|
|
8
8
|
export const ChartsTooltipPaper = styled('div', {
|
|
9
9
|
name: 'MuiChartsTooltip',
|
|
10
10
|
slot: 'Container',
|
|
11
|
-
overridesResolver: (props, styles) => styles.paper
|
|
11
|
+
overridesResolver: (props, styles) => styles.paper // FIXME: Inconsistent naming with slot
|
|
12
12
|
})(({
|
|
13
13
|
theme
|
|
14
14
|
}) => ({
|
|
@@ -23,8 +23,7 @@ export const ChartsTooltipPaper = styled('div', {
|
|
|
23
23
|
*/
|
|
24
24
|
export const ChartsTooltipTable = styled('table', {
|
|
25
25
|
name: 'MuiChartsTooltip',
|
|
26
|
-
slot: 'Table'
|
|
27
|
-
overridesResolver: (props, styles) => styles.table
|
|
26
|
+
slot: 'Table'
|
|
28
27
|
})(({
|
|
29
28
|
theme
|
|
30
29
|
}) => ({
|
|
@@ -50,8 +49,7 @@ export const ChartsTooltipTable = styled('table', {
|
|
|
50
49
|
*/
|
|
51
50
|
export const ChartsTooltipRow = styled('tr', {
|
|
52
51
|
name: 'MuiChartsTooltip',
|
|
53
|
-
slot: 'Row'
|
|
54
|
-
overridesResolver: (props, styles) => styles.row
|
|
52
|
+
slot: 'Row'
|
|
55
53
|
})(({
|
|
56
54
|
theme
|
|
57
55
|
}) => ({
|
|
@@ -9,7 +9,7 @@ export type UseMouseTrackerReturnValue = null | MousePosition;
|
|
|
9
9
|
* @deprecated We recommend using vanilla JS to let popper track mouse position.
|
|
10
10
|
*/
|
|
11
11
|
export declare function useMouseTracker(): UseMouseTrackerReturnValue;
|
|
12
|
-
type PointerType = Pick<MousePosition, '
|
|
12
|
+
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;
|
|
@@ -152,8 +152,7 @@ function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelSt
|
|
|
152
152
|
}
|
|
153
153
|
const XAxisRoot = styled(AxisRoot, {
|
|
154
154
|
name: 'MuiChartsXAxis',
|
|
155
|
-
slot: 'Root'
|
|
156
|
-
overridesResolver: (props, styles) => styles.root
|
|
155
|
+
slot: 'Root'
|
|
157
156
|
})({});
|
|
158
157
|
const defaultProps = {
|
|
159
158
|
disableLine: false,
|