@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.
Files changed (148) hide show
  1. package/BarChart/BarChart.js +4 -0
  2. package/BarChart/BarPlot.js +1 -2
  3. package/CHANGELOG.md +106 -0
  4. package/ChartContainer/ChartContainer.d.ts +1 -0
  5. package/ChartContainer/ChartContainer.js +4 -0
  6. package/ChartContainer/useChartContainerProps.js +4 -2
  7. package/ChartDataProvider/ChartDataProvider.d.ts +2 -1
  8. package/ChartDataProvider/ChartDataProvider.js +10 -1
  9. package/ChartDataProvider/useChartDataProviderProps.d.ts +3 -1
  10. package/ChartDataProvider/useChartDataProviderProps.js +3 -1
  11. package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +1 -2
  12. package/ChartsGrid/styledComponents.js +1 -2
  13. package/ChartsLabel/ChartsLabelGradient.js +1 -2
  14. package/ChartsLabel/ChartsLabelMark.js +1 -2
  15. package/ChartsLegend/ChartsLegend.js +1 -2
  16. package/ChartsLegend/ContinuousColorLegend.js +1 -2
  17. package/ChartsLegend/PiecewiseColorLegend.js +1 -2
  18. package/ChartsLocalizationProvider/ChartsLocalizationProvider.d.ts +27 -0
  19. package/ChartsLocalizationProvider/ChartsLocalizationProvider.js +73 -0
  20. package/ChartsLocalizationProvider/index.d.ts +2 -0
  21. package/ChartsLocalizationProvider/index.js +12 -0
  22. package/ChartsOverlay/ChartsLoadingOverlay.js +5 -1
  23. package/ChartsOverlay/ChartsNoDataOverlay.js +5 -1
  24. package/ChartsOverlay/ChartsOverlay.d.ts +2 -0
  25. package/ChartsTooltip/ChartsTooltipContainer.js +11 -10
  26. package/ChartsTooltip/ChartsTooltipTable.js +3 -5
  27. package/ChartsTooltip/utils.d.ts +1 -1
  28. package/ChartsTooltip/utils.js +0 -1
  29. package/ChartsXAxis/ChartsXAxis.js +1 -2
  30. package/ChartsYAxis/ChartsYAxis.js +1 -2
  31. package/Gauge/GaugeReferenceArc.js +1 -2
  32. package/Gauge/GaugeValueArc.js +1 -2
  33. package/LineChart/AreaPlot.js +1 -2
  34. package/LineChart/LineChart.js +4 -0
  35. package/LineChart/LinePlot.js +1 -2
  36. package/LineChart/MarkElement.js +1 -2
  37. package/PieChart/PieArc.js +1 -1
  38. package/PieChart/PieArcLabel.js +1 -2
  39. package/PieChart/PieChart.js +4 -0
  40. package/RadarChart/RadarChart.js +4 -0
  41. package/RadarChart/RadarDataProvider/RadarDataProvider.js +4 -0
  42. package/ScatterChart/ScatterChart.js +4 -0
  43. package/SparkLineChart/SparkLineChart.js +4 -0
  44. package/context/ChartProvider/ChartProvider.types.d.ts +4 -0
  45. package/esm/BarChart/BarChart.js +4 -0
  46. package/esm/BarChart/BarPlot.js +1 -2
  47. package/esm/ChartContainer/ChartContainer.d.ts +1 -0
  48. package/esm/ChartContainer/ChartContainer.js +4 -0
  49. package/esm/ChartContainer/useChartContainerProps.js +4 -2
  50. package/esm/ChartDataProvider/ChartDataProvider.d.ts +2 -1
  51. package/esm/ChartDataProvider/ChartDataProvider.js +10 -1
  52. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +3 -1
  53. package/esm/ChartDataProvider/useChartDataProviderProps.js +3 -1
  54. package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.js +1 -2
  55. package/esm/ChartsGrid/styledComponents.js +1 -2
  56. package/esm/ChartsLabel/ChartsLabelGradient.js +1 -2
  57. package/esm/ChartsLabel/ChartsLabelMark.js +1 -2
  58. package/esm/ChartsLegend/ChartsLegend.js +1 -2
  59. package/esm/ChartsLegend/ContinuousColorLegend.js +1 -2
  60. package/esm/ChartsLegend/PiecewiseColorLegend.js +1 -2
  61. package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.d.ts +27 -0
  62. package/esm/ChartsLocalizationProvider/ChartsLocalizationProvider.js +66 -0
  63. package/esm/ChartsLocalizationProvider/index.d.ts +2 -0
  64. package/esm/ChartsLocalizationProvider/index.js +1 -0
  65. package/esm/ChartsOverlay/ChartsLoadingOverlay.js +5 -1
  66. package/esm/ChartsOverlay/ChartsNoDataOverlay.js +5 -1
  67. package/esm/ChartsOverlay/ChartsOverlay.d.ts +2 -0
  68. package/esm/ChartsTooltip/ChartsTooltipContainer.js +11 -10
  69. package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -5
  70. package/esm/ChartsTooltip/utils.d.ts +1 -1
  71. package/esm/ChartsTooltip/utils.js +0 -1
  72. package/esm/ChartsXAxis/ChartsXAxis.js +1 -2
  73. package/esm/ChartsYAxis/ChartsYAxis.js +1 -2
  74. package/esm/Gauge/GaugeReferenceArc.js +1 -2
  75. package/esm/Gauge/GaugeValueArc.js +1 -2
  76. package/esm/LineChart/AreaPlot.js +1 -2
  77. package/esm/LineChart/LineChart.js +4 -0
  78. package/esm/LineChart/LinePlot.js +1 -2
  79. package/esm/LineChart/MarkElement.js +1 -2
  80. package/esm/PieChart/PieArc.js +1 -1
  81. package/esm/PieChart/PieArcLabel.js +1 -2
  82. package/esm/PieChart/PieChart.js +4 -0
  83. package/esm/RadarChart/RadarChart.js +4 -0
  84. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +4 -0
  85. package/esm/ScatterChart/ScatterChart.js +4 -0
  86. package/esm/SparkLineChart/SparkLineChart.js +4 -0
  87. package/esm/context/ChartProvider/ChartProvider.types.d.ts +4 -0
  88. package/esm/hooks/index.d.ts +3 -1
  89. package/esm/hooks/index.js +3 -1
  90. package/esm/hooks/useChartRootRef.d.ts +6 -0
  91. package/esm/hooks/useChartRootRef.js +12 -0
  92. package/esm/hooks/useChartsLocalization.d.ts +1 -0
  93. package/esm/hooks/useChartsLocalization.js +9 -0
  94. package/esm/index.d.ts +1 -0
  95. package/esm/index.js +2 -1
  96. package/esm/internals/components/AxisSharedComponents.js +1 -2
  97. package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +4 -2
  98. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +0 -1
  99. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +3 -3
  100. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +15 -0
  101. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3 -3
  102. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +8 -0
  103. package/esm/internals/plugins/models/plugin.d.ts +4 -0
  104. package/esm/internals/store/useCharts.d.ts +1 -0
  105. package/esm/internals/store/useCharts.js +4 -1
  106. package/esm/locales/enUS.d.ts +15 -0
  107. package/esm/locales/enUS.js +11 -0
  108. package/esm/locales/frFR.d.ts +14 -0
  109. package/esm/locales/frFR.js +7 -0
  110. package/esm/locales/index.d.ts +3 -0
  111. package/esm/locales/index.js +3 -0
  112. package/esm/locales/utils/chartsLocaleTextApi.d.ts +11 -0
  113. package/esm/locales/utils/chartsLocaleTextApi.js +1 -0
  114. package/esm/locales/utils/getChartsLocalization.d.ts +18 -0
  115. package/esm/locales/utils/getChartsLocalization.js +17 -0
  116. package/esm/themeAugmentation/components.d.ts +3 -0
  117. package/esm/themeAugmentation/props.d.ts +2 -0
  118. package/hooks/index.d.ts +3 -1
  119. package/hooks/index.js +24 -0
  120. package/hooks/useChartRootRef.d.ts +6 -0
  121. package/hooks/useChartRootRef.js +16 -0
  122. package/hooks/useChartsLocalization.d.ts +1 -0
  123. package/hooks/useChartsLocalization.js +17 -0
  124. package/index.d.ts +1 -0
  125. package/index.js +12 -1
  126. package/internals/components/AxisSharedComponents.js +1 -2
  127. package/internals/components/ChartsWrapper/ChartsWrapper.js +4 -2
  128. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +0 -1
  129. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +3 -3
  130. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +15 -0
  131. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3 -3
  132. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +8 -0
  133. package/internals/plugins/models/plugin.d.ts +4 -0
  134. package/internals/store/useCharts.d.ts +1 -0
  135. package/internals/store/useCharts.js +4 -1
  136. package/locales/enUS.d.ts +15 -0
  137. package/locales/enUS.js +16 -0
  138. package/locales/frFR.d.ts +14 -0
  139. package/locales/frFR.js +13 -0
  140. package/locales/index.d.ts +3 -0
  141. package/locales/index.js +27 -0
  142. package/locales/utils/chartsLocaleTextApi.d.ts +11 -0
  143. package/locales/utils/chartsLocaleTextApi.js +5 -0
  144. package/locales/utils/getChartsLocalization.d.ts +18 -0
  145. package/locales/utils/getChartsLocalization.js +25 -0
  146. package/package.json +1 -2
  147. package/themeAugmentation/components.d.ts +3 -0
  148. package/themeAugmentation/props.d.ts +2 -0
@@ -155,6 +155,10 @@ process.env.NODE_ENV !== "production" ? BarChart.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.
@@ -165,8 +165,7 @@ const useAggregatedData = () => {
165
165
  };
166
166
  const BarPlotRoot = (0, _styles.styled)('g', {
167
167
  name: 'MuiBarPlot',
168
- slot: 'Root',
169
- overridesResolver: (_, styles) => styles.root
168
+ slot: 'Root'
170
169
  })({
171
170
  [`& .${_barElementClasses.barElementClasses.root}`]: {
172
171
  transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
package/CHANGELOG.md CHANGED
@@ -5,6 +5,112 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.1.0
9
+
10
+ _Apr 24, 2025_
11
+
12
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 📊 Add API to print a chart or export it as PDF: `apiRef.exportAsPrint`.
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ Special thanks go out to the community members for their valuable contributions:
19
+ @lhilgert9, @ArturAghakaryan, @sai6855.
20
+ Following are all team members who have contributed to this release:
21
+ @alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @JCQuintas, @joserodolfofreitas, @KenanYusuf, @LukasTy, @mapache-salvaje, @oliviertassinari, @romgrk.
22
+
23
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
24
+
25
+ ### Data Grid
26
+
27
+ #### `@mui/x-data-grid@8.1.0`
28
+
29
+ - [DataGrid] Allow row deselection with multiple rows selected (#17473) @arminmeh
30
+ - [DataGrid] Fix column title truncation on touch devices (#17375) @KenanYusuf
31
+ - [DataGrid] Remove internal usage of `material` prop (#17513) @KenanYusuf
32
+ - [DataGrid] Fix apiRef not being passed on onCellClick params (#17335) @sai6855
33
+ - [DataGrid] Add Armenian (hy-AM) locale (#17527) @ArturAghakaryan
34
+
35
+ #### `@mui/x-data-grid-pro@8.1.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
36
+
37
+ Same changes as in `@mui/x-data-grid@8.1.0`, plus:
38
+
39
+ - [DataGridPro] Fix locales.ts export (#17433) @lhilgert9
40
+ - [DataGridPro] Avoid proptypes warnings with header filters in React 17 (#17482) @cherniavskii
41
+ - [DataGridPro] Fix expandable rows detail content height updates (#17394) @arminmeh
42
+
43
+ #### `@mui/x-data-grid-premium@8.1.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
44
+
45
+ Same changes as in `@mui/x-data-grid-pro@8.1.0`.
46
+
47
+ ### Date and Time Pickers
48
+
49
+ #### `@mui/x-date-pickers@8.1.0`
50
+
51
+ - [pickers] Improve `PickersInputBase` owner state typing (#17478) @LukasTy
52
+
53
+ #### `@mui/x-date-pickers-pro@8.1.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
54
+
55
+ Same changes as in `@mui/x-date-pickers@8.1.0`.
56
+
57
+ ### Charts
58
+
59
+ - Add API to print a chart or export it as PDF: `apiRef.exportAsPrint`.
60
+
61
+ #### `@mui/x-charts@8.1.0`
62
+
63
+ - [charts] Add a localization provider (#17325) @alexfauquette
64
+ - [charts] Add codemod for replacing legend's hidden slot prop (#17392) @bernardobelchior
65
+ - [charts] Fix chart visual tests flakiness (#17469) @bernardobelchior
66
+ - [charts] Fix tooltip position (#17440) @alexfauquette
67
+ - [charts] Improve axis tooltip performances (#17398) @alexfauquette
68
+ - [charts] Move radar from under development to preview (#17418) @alexfauquette
69
+ - [charts] Advance time in charts regression tests (#17420) @bernardobelchior
70
+ - [charts] Fix charts visuals flakiness (#17472) @bernardobelchior
71
+ - [charts] Move `rafThrottle` on event handlers instead of setter (#17489) @bernardobelchior
72
+
73
+ #### `@mui/x-charts-pro@8.1.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
74
+
75
+ Same changes as in `@mui/x-charts@8.1.0`, plus:
76
+
77
+ - [charts-pro] Add export as PDF/print functionality (#17285) @bernardobelchior
78
+ - [charts-pro] Fix axis zoom being disabled when not specified in `initialZoom` (#17500) @bernardobelchior
79
+
80
+ ### Tree View
81
+
82
+ #### `@mui/x-tree-view@8.1.0`
83
+
84
+ Internal changes.
85
+
86
+ #### `@mui/x-tree-view-pro@8.1.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
87
+
88
+ Same changes as in `@mui/x-tree-view@8.1.0`.
89
+
90
+ ### Docs
91
+
92
+ - [docs] Fix AI Assistant Panel Trigger demo (#17426) @KenanYusuf
93
+ - [docs] Fix DataGrid's master-detail demo for one expanded detail panel at a time (#17471) @arminmeh
94
+ - [docs] Improve StackOverflow links (#17483) @oliviertassinari
95
+ - [docs] Refine charts demos (#17417) @alexfauquette
96
+ - [docs] Remove ad on paid docs pages (#17373) @oliviertassinari
97
+ - [docs] Serve migration guides in raw markdown format (#17210) @cherniavskii
98
+ - [docs] Fix heading structure (#17495) @oliviertassinari
99
+ - [docs] Revise the Row Grouping doc (#16217) @mapache-salvaje
100
+ - [docs] Fix ellipsis in the demo (#17476) @oliviertassinari
101
+ - [docs] Add docs information for Legend HTML (#17502) @alexfauquette
102
+ - [docs] Refine charts demos (#17417) @alexfauquette
103
+ - [tree view][docs] Copyedit the Tree View Overview page (#17498) @mapache-salvaje
104
+
105
+ ### Core
106
+
107
+ - [core] Bump `@types/node` (#17444) @LukasTy
108
+ - [core] Remove `react-is` dependency (#17470) @LukasTy
109
+ - [core] Remove redundant `overridesResolver` in `styled` components (#17466) @romgrk
110
+ - [core] Update support table (#17425) @joserodolfofreitas
111
+ - [code-infra] Ditch `@babel/node` (#17446) @LukasTy
112
+ - [code-infra] Further remove `clock=fake` from pickers (#17253) @JCQuintas
113
+
8
114
  ## 8.0.0
9
115
 
10
116
  _Apr 17, 2025_
@@ -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
  *
@@ -100,6 +100,10 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
100
100
  * If you don't provide this prop. It falls back to a randomly generated id.
101
101
  */
102
102
  id: _propTypes.default.string,
103
+ /**
104
+ * Localized text for chart components.
105
+ */
106
+ localeText: _propTypes.default.object,
103
107
  /**
104
108
  * The margin between the SVG and the drawing area.
105
109
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -9,7 +9,7 @@ exports.useChartContainerProps = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var _allPlugins = require("../internals/plugins/allPlugins");
12
- 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"];
12
+ 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"];
13
13
  const useChartContainerProps = (props, ref) => {
14
14
  const _ref = props,
15
15
  {
@@ -37,7 +37,8 @@ const useChartContainerProps = (props, ref) => {
37
37
  radiusAxis,
38
38
  skipAnimation,
39
39
  seriesConfig,
40
- plugins
40
+ plugins,
41
+ localeText
41
42
  } = _ref,
42
43
  other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
43
44
  const chartsSurfaceProps = (0, _extends2.default)({
@@ -66,6 +67,7 @@ const useChartContainerProps = (props, ref) => {
66
67
  skipAnimation,
67
68
  width,
68
69
  height,
70
+ localeText,
69
71
  seriesConfig,
70
72
  plugins: plugins ?? _allPlugins.DEFAULT_PLUGINS
71
73
  };
@@ -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
- 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'>>;
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
  *
@@ -12,6 +12,7 @@ var React = _interopRequireWildcard(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _useChartDataProviderProps = require("./useChartDataProviderProps");
14
14
  var _ChartProvider = require("../context/ChartProvider");
15
+ var _ChartsLocalizationProvider = require("../ChartsLocalizationProvider");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  /**
17
18
  * Orchestrates the data providers for the chart components and hooks.
@@ -43,10 +44,14 @@ var _jsxRuntime = require("react/jsx-runtime");
43
44
  function ChartDataProvider(props) {
44
45
  const {
45
46
  children,
47
+ localeText,
46
48
  chartProviderProps
47
49
  } = (0, _useChartDataProviderProps.useChartDataProviderProps)(props);
48
50
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartProvider.ChartProvider, (0, _extends2.default)({}, chartProviderProps, {
49
- children: children
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLocalizationProvider.ChartsLocalizationProvider, {
52
+ localeText: localeText,
53
+ children: children
54
+ })
50
55
  }));
51
56
  }
52
57
  process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
@@ -75,6 +80,10 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
75
80
  * If you don't provide this prop. It falls back to a randomly generated id.
76
81
  */
77
82
  id: _propTypes.default.string,
83
+ /**
84
+ * Localized text for chart components.
85
+ */
86
+ localeText: _propTypes.default.object,
78
87
  /**
79
88
  * The margin between the SVG and the drawing area.
80
89
  * 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
- export declare const useChartDataProviderProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartDataProviderProps<TSeries, TSignatures>) => {
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
  };
@@ -10,10 +10,11 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
11
  var _styles = require("@mui/material/styles");
12
12
  var _allPlugins = require("../internals/plugins/allPlugins");
13
- const _excluded = ["children", "plugins", "seriesConfig"];
13
+ const _excluded = ["children", "localeText", "plugins", "seriesConfig"];
14
14
  const useChartDataProviderProps = props => {
15
15
  const {
16
16
  children,
17
+ localeText,
17
18
  plugins = _allPlugins.DEFAULT_PLUGINS,
18
19
  seriesConfig
19
20
  } = props,
@@ -28,6 +29,7 @@ const useChartDataProviderProps = props => {
28
29
  };
29
30
  return {
30
31
  children,
32
+ localeText,
31
33
  chartProviderProps
32
34
  };
33
35
  };
@@ -10,8 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
10
10
  var _styles = require("@mui/material/styles");
11
11
  const ChartsAxisHighlightPath = exports.ChartsAxisHighlightPath = (0, _styles.styled)('path', {
12
12
  name: 'MuiChartsAxisHighlight',
13
- slot: 'Root',
14
- overridesResolver: (_, styles) => styles.root
13
+ slot: 'Root'
15
14
  })(({
16
15
  theme
17
16
  }) => ({
@@ -17,8 +17,7 @@ const GridRoot = exports.GridRoot = (0, _styles.styled)('g', {
17
17
  })({});
18
18
  const GridLine = exports.GridLine = (0, _styles.styled)('line', {
19
19
  name: 'MuiChartsGrid',
20
- slot: 'Line',
21
- overridesResolver: (props, styles) => styles.line
20
+ slot: 'Line'
22
21
  })(({
23
22
  theme
24
23
  }) => ({
@@ -27,8 +27,7 @@ const getRotation = (direction, reverse, rotate, isRtl) => {
27
27
  };
28
28
  const Root = (0, _styles.styled)('div', {
29
29
  name: 'MuiChartsLabelGradient',
30
- slot: 'Root',
31
- overridesResolver: (props, styles) => styles.root
30
+ slot: 'Root'
32
31
  })(({
33
32
  ownerState
34
33
  }) => {
@@ -19,8 +19,7 @@ var _jsxRuntime = require("react/jsx-runtime");
19
19
  const _excluded = ["type", "color", "className", "classes"];
20
20
  const Root = (0, _styles.styled)('div', {
21
21
  name: 'MuiChartsLabelMark',
22
- slot: 'Root',
23
- overridesResolver: (props, styles) => styles.root
22
+ slot: 'Root'
24
23
  })(() => {
25
24
  return {
26
25
  display: 'flex',
@@ -23,8 +23,7 @@ var _jsxRuntime = require("react/jsx-runtime");
23
23
  const _excluded = ["direction", "onItemClick", "className", "classes"];
24
24
  const RootElement = (0, _styles.styled)('ul', {
25
25
  name: 'MuiChartsLegend',
26
- slot: 'Root',
27
- overridesResolver: (props, styles) => styles.root
26
+ slot: 'Root'
28
27
  })(({
29
28
  ownerState,
30
29
  theme
@@ -59,8 +59,7 @@ const templateAreas = reverse => {
59
59
  };
60
60
  const RootElement = (0, _styles.styled)('ul', {
61
61
  name: 'MuiContinuousColorLegend',
62
- slot: 'Root',
63
- overridesResolver: (props, styles) => styles.root
62
+ slot: 'Root'
64
63
  })(({
65
64
  theme,
66
65
  ownerState
@@ -23,8 +23,7 @@ var _jsxRuntime = require("react/jsx-runtime");
23
23
  const _excluded = ["direction", "classes", "className", "markType", "labelPosition", "axisDirection", "axisId", "labelFormatter", "onItemClick"];
24
24
  const RootElement = (0, _styles.styled)('ul', {
25
25
  name: 'MuiPiecewiseColorLegend',
26
- slot: 'Root',
27
- overridesResolver: (props, styles) => styles.root
26
+ slot: 'Root'
28
27
  })(({
29
28
  theme,
30
29
  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,73 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.ChartsLocalizationContext = void 0;
10
+ exports.ChartsLocalizationProvider = ChartsLocalizationProvider;
11
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
13
+ var React = _interopRequireWildcard(require("react"));
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+ var _styles = require("@mui/material/styles");
16
+ var _enUS = require("../locales/enUS");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ const _excluded = ["localeText"];
19
+ const ChartsLocalizationContext = exports.ChartsLocalizationContext = /*#__PURE__*/React.createContext(null);
20
+ if (process.env.NODE_ENV !== 'production') {
21
+ ChartsLocalizationContext.displayName = 'ChartsLocalizationContext';
22
+ }
23
+ /**
24
+ * Demos:
25
+ *
26
+ * - [localization](https://mui.com/x/react-charts/localization/)
27
+ *
28
+ * API:
29
+ *
30
+ * - [ChartsLocalizationProvider API](https://mui.com/x/api/charts/charts-localization-provider/)
31
+ */
32
+ function ChartsLocalizationProvider(inProps) {
33
+ const {
34
+ localeText: inLocaleText
35
+ } = inProps,
36
+ other = (0, _objectWithoutPropertiesLoose2.default)(inProps, _excluded);
37
+ const {
38
+ localeText: parentLocaleText
39
+ } = React.useContext(ChartsLocalizationContext) ?? {
40
+ localeText: undefined
41
+ };
42
+ const props = (0, _styles.useThemeProps)({
43
+ // We don't want to pass the `localeText` prop to the theme, that way it will always return the theme value,
44
+ // We will then merge this theme value with our value manually
45
+ props: other,
46
+ name: 'MuiChartsLocalizationProvider'
47
+ });
48
+ const {
49
+ children,
50
+ localeText: themeLocaleText
51
+ } = props;
52
+ const localeText = React.useMemo(() => (0, _extends2.default)({}, _enUS.DEFAULT_LOCALE, themeLocaleText, parentLocaleText, inLocaleText), [themeLocaleText, parentLocaleText, inLocaleText]);
53
+ const contextValue = React.useMemo(() => {
54
+ return {
55
+ localeText
56
+ };
57
+ }, [localeText]);
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsLocalizationContext.Provider, {
59
+ value: contextValue,
60
+ children: children
61
+ });
62
+ }
63
+ process.env.NODE_ENV !== "production" ? ChartsLocalizationProvider.propTypes = {
64
+ // ----------------------------- Warning --------------------------------
65
+ // | These PropTypes are generated from the TypeScript type definitions |
66
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
67
+ // ----------------------------------------------------------------------
68
+ children: _propTypes.default.node,
69
+ /**
70
+ * Localized text for chart components.
71
+ */
72
+ localeText: _propTypes.default.object
73
+ } : void 0;
@@ -0,0 +1,2 @@
1
+ export { ChartsLocalizationProvider } from "./ChartsLocalizationProvider.js";
2
+ export type { ChartsLocalizationProviderProps } from './ChartsLocalizationProvider';
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ChartsLocalizationProvider", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ChartsLocalizationProvider.ChartsLocalizationProvider;
10
+ }
11
+ });
12
+ var _ChartsLocalizationProvider = require("./ChartsLocalizationProvider");
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _styles = require("@mui/material/styles");
14
14
  var _useDrawingArea = require("../hooks/useDrawingArea");
15
+ var _useChartsLocalization = require("../hooks/useChartsLocalization");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  const _excluded = ["message"];
17
18
  const StyledText = (0, _styles.styled)('text')(({
@@ -34,10 +35,13 @@ function ChartsLoadingOverlay(props) {
34
35
  height,
35
36
  width
36
37
  } = (0, _useDrawingArea.useDrawingArea)();
38
+ const {
39
+ localeText
40
+ } = (0, _useChartsLocalization.useChartsLocalization)();
37
41
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, (0, _extends2.default)({
38
42
  x: left + width / 2,
39
43
  y: top + height / 2
40
44
  }, other, {
41
- children: message ?? 'Loading data…'
45
+ children: message ?? localeText.loading
42
46
  }));
43
47
  }
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _styles = require("@mui/material/styles");
14
14
  var _useDrawingArea = require("../hooks/useDrawingArea");
15
+ var _useChartsLocalization = require("../hooks/useChartsLocalization");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  const _excluded = ["message"];
17
18
  const StyledText = (0, _styles.styled)('text')(({
@@ -34,10 +35,13 @@ function ChartsNoDataOverlay(props) {
34
35
  height,
35
36
  width
36
37
  } = (0, _useDrawingArea.useDrawingArea)();
38
+ const {
39
+ localeText
40
+ } = (0, _useChartsLocalization.useChartsLocalization)();
37
41
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledText, (0, _extends2.default)({
38
42
  x: left + width / 2,
39
43
  y: top + height / 2
40
44
  }, other, {
41
- children: message ?? 'No data to display'
45
+ children: message ?? localeText.noData
42
46
  }));
43
47
  }
@@ -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>;
@@ -29,8 +29,7 @@ const _excluded = ["trigger", "classes", "children"];
29
29
  const noAxis = () => false;
30
30
  const ChartsTooltipRoot = (0, _styles.styled)(_Popper.default, {
31
31
  name: 'MuiChartsTooltip',
32
- slot: 'Root',
33
- overridesResolver: (_, styles) => styles.root
32
+ slot: 'Root'
34
33
  })(({
35
34
  theme
36
35
  }) => ({
@@ -104,18 +103,20 @@ function ChartsTooltipContainer(inProps) {
104
103
  const modifiers = React.useMemo(() => [{
105
104
  name: 'offset',
106
105
  options: {
107
- offset: ({
108
- placement
109
- }) => {
106
+ offset: () => {
110
107
  if (pointerType?.pointerType !== 'touch') {
111
- return [0, 0];
108
+ return [0, 8];
112
109
  }
113
- const isBottom = placement.startsWith('bottom');
114
- const placementOffset = isBottom ? 32 : 8;
115
- return [0, pointerType.height + placementOffset];
110
+ return [0, 64];
116
111
  }
117
112
  }
118
- }], [pointerType]);
113
+ }, ...(pointerType?.pointerType === 'mouse' ? [] // Keep default behavior
114
+ : [{
115
+ name: 'flip',
116
+ options: {
117
+ fallbackPlacements: ['top-end', 'top-start', 'bottom-end', 'bottom']
118
+ }
119
+ }])], [pointerType]);
119
120
  if (trigger === 'none') {
120
121
  return null;
121
122
  }
@@ -14,7 +14,7 @@ var _chartsTooltipClasses = require("./chartsTooltipClasses");
14
14
  const ChartsTooltipPaper = exports.ChartsTooltipPaper = (0, _styles.styled)('div', {
15
15
  name: 'MuiChartsTooltip',
16
16
  slot: 'Container',
17
- overridesResolver: (props, styles) => styles.paper
17
+ overridesResolver: (props, styles) => styles.paper // FIXME: Inconsistent naming with slot
18
18
  })(({
19
19
  theme
20
20
  }) => ({
@@ -29,8 +29,7 @@ const ChartsTooltipPaper = exports.ChartsTooltipPaper = (0, _styles.styled)('div
29
29
  */
30
30
  const ChartsTooltipTable = exports.ChartsTooltipTable = (0, _styles.styled)('table', {
31
31
  name: 'MuiChartsTooltip',
32
- slot: 'Table',
33
- overridesResolver: (props, styles) => styles.table
32
+ slot: 'Table'
34
33
  })(({
35
34
  theme
36
35
  }) => ({
@@ -56,8 +55,7 @@ const ChartsTooltipTable = exports.ChartsTooltipTable = (0, _styles.styled)('tab
56
55
  */
57
56
  const ChartsTooltipRow = exports.ChartsTooltipRow = (0, _styles.styled)('tr', {
58
57
  name: 'MuiChartsTooltip',
59
- slot: 'Row',
60
- overridesResolver: (props, styles) => styles.row
58
+ slot: 'Row'
61
59
  })(({
62
60
  theme
63
61
  }) => ({
@@ -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, 'height' | 'pointerType'>;
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;
@@ -71,7 +71,6 @@ function usePointerType() {
71
71
  };
72
72
  const handleEnter = event => {
73
73
  setPointerType({
74
- height: event.height,
75
74
  pointerType: event.pointerType
76
75
  });
77
76
  };
@@ -159,8 +159,7 @@ function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelSt
159
159
  }
160
160
  const XAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
161
161
  name: 'MuiChartsXAxis',
162
- slot: 'Root',
163
- overridesResolver: (props, styles) => styles.root
162
+ slot: 'Root'
164
163
  })({});
165
164
  const defaultProps = {
166
165
  disableLine: false,
@@ -90,8 +90,7 @@ function shortenLabels(visibleLabels, drawingArea, maxWidth, isRtl, tickLabelSty
90
90
  }
91
91
  const YAxisRoot = (0, _styles.styled)(_AxisSharedComponents.AxisRoot, {
92
92
  name: 'MuiChartsYAxis',
93
- slot: 'Root',
94
- overridesResolver: (props, styles) => styles.root
93
+ slot: 'Root'
95
94
  })({});
96
95
  const defaultProps = {
97
96
  disableLine: false,
@@ -15,8 +15,7 @@ var _GaugeProvider = require("./GaugeProvider");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  const StyledPath = (0, _styles.styled)('path', {
17
17
  name: 'MuiGauge',
18
- slot: 'ReferenceArc',
19
- overridesResolver: (props, styles) => styles.referenceArc
18
+ slot: 'ReferenceArc'
20
19
  })(({
21
20
  theme
22
21
  }) => ({