@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
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.selectorChartsInteractionTooltipRotationAxes = exports.selectorChartsInteractionTooltipRadiusAxes = exports.selectorChartsInteractionRotationAxisValues = exports.selectorChartsInteractionRotationAxisValue = exports.selectorChartsInteractionRotationAxisIndexes = exports.selectorChartsInteractionRotationAxisIndex = exports.selectorChartsInteractionPolarAxisTooltip = void 0;
7
+ var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
7
8
  var _selectors = require("../../utils/selectors");
8
9
  var _useChartInteraction = require("../useChartInteraction/useChartInteraction.selectors");
9
10
  var _coordinateTransformation = require("./coordinateTransformation");
@@ -68,6 +69,13 @@ const selectorChartsInteractionTooltipRotationAxes = exports.selectorChartsInter
68
69
  axisId,
69
70
  dataIndex
70
71
  }) => axes.axis[axisId].triggerTooltip && dataIndex >= 0);
72
+ }, {
73
+ memoizeOptions: {
74
+ // Keep the same reference if array content is the same.
75
+ // If possible, avoid this pattern by creating selectors that
76
+ // uses string/number as arguments.
77
+ resultEqualityCheck: _isDeepEqual.isDeepEqual
78
+ }
71
79
  });
72
80
 
73
81
  /**
@@ -25,6 +25,10 @@ export interface ChartPluginOptions<TSignature extends ChartAnyPluginSignature>
25
25
  * Reference to the main svg element.
26
26
  */
27
27
  svgRef: React.RefObject<SVGSVGElement | null>;
28
+ /**
29
+ * Reference to the chart root element.
30
+ */
31
+ chartRootRef: React.RefObject<HTMLDivElement | null>;
28
32
  /**
29
33
  * All the plugins that are used in the chart.
30
34
  */
@@ -20,6 +20,7 @@ export declare function useCharts<TSeriesType extends ChartSeriesType, TSignatur
20
20
  publicAPI: ChartPublicAPI<TSignatures>;
21
21
  instance: ChartInstance<TSignatures>;
22
22
  svgRef: React.RefObject<SVGSVGElement | null>;
23
+ chartRootRef: React.RefObject<HTMLDivElement | null>;
23
24
  };
24
25
  };
25
26
  export declare function useChartApiInitialization<T>(inputApiRef: React.RefObject<T | undefined> | undefined): T;
@@ -36,6 +36,7 @@ function useCharts(inPlugins, props, seriesConfig) {
36
36
  const instanceRef = React.useRef({});
37
37
  const instance = instanceRef.current;
38
38
  const publicAPI = useChartApiInitialization(props.apiRef);
39
+ const innerChartRootRef = React.useRef(null);
39
40
  const innerSvgRef = React.useRef(null);
40
41
  const storeRef = React.useRef(null);
41
42
  if (storeRef.current == null) {
@@ -60,6 +61,7 @@ function useCharts(inPlugins, props, seriesConfig) {
60
61
  plugins: plugins,
61
62
  store: storeRef.current,
62
63
  svgRef: innerSvgRef,
64
+ chartRootRef: innerChartRootRef,
63
65
  seriesConfig,
64
66
  models
65
67
  });
@@ -75,7 +77,8 @@ function useCharts(inPlugins, props, seriesConfig) {
75
77
  store: storeRef.current,
76
78
  publicAPI,
77
79
  instance,
78
- svgRef: innerSvgRef
80
+ svgRef: innerSvgRef,
81
+ chartRootRef: innerChartRootRef
79
82
  }), [instance, publicAPI]);
80
83
  return {
81
84
  contextValue
@@ -0,0 +1,15 @@
1
+ import { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
2
+ export declare const enUSLocaleText: ChartsLocaleText;
3
+ export declare const DEFAULT_LOCALE: ChartsLocaleText;
4
+ export declare const enUS: {
5
+ components: {
6
+ MuiChartsLocalizationProvider: {
7
+ defaultProps: {
8
+ localeText: {
9
+ loading?: string | undefined;
10
+ noData?: string | undefined;
11
+ };
12
+ };
13
+ };
14
+ };
15
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.enUSLocaleText = exports.enUS = exports.DEFAULT_LOCALE = void 0;
7
+ var _getChartsLocalization = require("./utils/getChartsLocalization");
8
+ // This object is not Partial<ChartsLocaleText> because it is the default values
9
+
10
+ const enUSLocaleText = exports.enUSLocaleText = {
11
+ // Overlay
12
+ loading: 'Loading data…',
13
+ noData: 'No data to display'
14
+ };
15
+ const DEFAULT_LOCALE = exports.DEFAULT_LOCALE = enUSLocaleText;
16
+ const enUS = exports.enUS = (0, _getChartsLocalization.getChartsLocalization)(enUSLocaleText);
@@ -0,0 +1,14 @@
1
+ import { ChartsLocaleText } from "./utils/chartsLocaleTextApi.js";
2
+ export declare const frFRLocalText: Partial<ChartsLocaleText>;
3
+ export declare const frFR: {
4
+ components: {
5
+ MuiChartsLocalizationProvider: {
6
+ defaultProps: {
7
+ localeText: {
8
+ loading?: string | undefined;
9
+ noData?: string | undefined;
10
+ };
11
+ };
12
+ };
13
+ };
14
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.frFRLocalText = exports.frFR = void 0;
7
+ var _getChartsLocalization = require("./utils/getChartsLocalization");
8
+ const frFRLocalText = exports.frFRLocalText = {
9
+ // Overlay
10
+ loading: 'Chargement…',
11
+ noData: 'Pas de données'
12
+ };
13
+ const frFR = exports.frFR = (0, _getChartsLocalization.getChartsLocalization)(frFRLocalText);
@@ -0,0 +1,3 @@
1
+ export type { ChartsLocaleText } from './utils/chartsLocaleTextApi';
2
+ export * from "./enUS.js";
3
+ export * from "./frFR.js";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _enUS = require("./enUS");
7
+ Object.keys(_enUS).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _enUS[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _enUS[key];
14
+ }
15
+ });
16
+ });
17
+ var _frFR = require("./frFR");
18
+ Object.keys(_frFR).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _frFR[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _frFR[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,11 @@
1
+ export interface ChartsLocaleText {
2
+ /**
3
+ * Title displayed in the overlay if `loading` is `true`.
4
+ */
5
+ loading: string;
6
+ /**
7
+ * Title displayed in the overlay if there is no data to display.
8
+ */
9
+ noData: string;
10
+ }
11
+ export type ChartsTranslationKeys = keyof ChartsLocaleText;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,18 @@
1
+ import { ChartsLocaleText } from "./chartsLocaleTextApi.js";
2
+ /**
3
+ * Helper to pass translation to all charts thanks to the MUI theme.
4
+ * @param chartsTranslations The translation object.
5
+ * @returns an object to pass the translation by using the MUI theme default props
6
+ */
7
+ export declare const getChartsLocalization: (chartsTranslations: Partial<ChartsLocaleText>) => {
8
+ components: {
9
+ MuiChartsLocalizationProvider: {
10
+ defaultProps: {
11
+ localeText: {
12
+ loading?: string | undefined;
13
+ noData?: string | undefined;
14
+ };
15
+ };
16
+ };
17
+ };
18
+ };
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getChartsLocalization = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ /**
10
+ * Helper to pass translation to all charts thanks to the MUI theme.
11
+ * @param chartsTranslations The translation object.
12
+ * @returns an object to pass the translation by using the MUI theme default props
13
+ */
14
+ const getChartsLocalization = chartsTranslations => {
15
+ return {
16
+ components: {
17
+ MuiChartsLocalizationProvider: {
18
+ defaultProps: {
19
+ localeText: (0, _extends2.default)({}, chartsTranslations)
20
+ }
21
+ }
22
+ }
23
+ };
24
+ };
25
+ exports.getChartsLocalization = getChartsLocalization;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "description": "The community edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -34,7 +34,6 @@
34
34
  "bezier-easing": "^2.1.0",
35
35
  "clsx": "^2.1.1",
36
36
  "prop-types": "^15.8.1",
37
- "react-is": "^18.3.1 || ^19.0.0",
38
37
  "reselect": "^5.1.1",
39
38
  "use-sync-external-store": "^1.5.0",
40
39
  "@mui/x-charts-vendor": "8.0.0",
@@ -22,6 +22,9 @@ export interface ChartsComponents<Theme = unknown> {
22
22
  defaultProps?: ComponentsProps['MuiChartsLegend'];
23
23
  styleOverrides?: ComponentsOverrides<Theme>['MuiChartsLegend'];
24
24
  };
25
+ MuiChartsLocalizationProvider?: {
26
+ defaultProps?: ComponentsProps['MuiChartsLocalizationProvider'];
27
+ };
25
28
  MuiChartsTooltip?: {
26
29
  defaultProps?: ComponentsProps['MuiChartsTooltip'];
27
30
  styleOverrides?: ComponentsOverrides<Theme>['MuiChartsTooltip'];
@@ -8,11 +8,13 @@ import { LineChartProps } from "../LineChart/LineChart.js";
8
8
  import { ScatterChartProps } from "../ScatterChart/ScatterChart.js";
9
9
  import { PieChartProps } from "../PieChart/PieChart.js";
10
10
  import { ChartsXAxisProps, ChartsYAxisProps } from "../models/axis.js";
11
+ import { ChartsLocalizationProviderProps } from "../ChartsLocalizationProvider/index.js";
11
12
  export interface ChartsComponentsPropsList {
12
13
  MuiChartsXAxis: ChartsXAxisProps;
13
14
  MuiChartsYAxis: ChartsYAxisProps;
14
15
  MuiChartsGrid: ChartsGridProps;
15
16
  MuiChartsLegend: ChartsLegendProps;
17
+ MuiChartsLocalizationProvider: ChartsLocalizationProviderProps;
16
18
  MuiChartsTooltip: ChartsTooltipProps;
17
19
  MuiChartsSurface: ChartsSurfaceProps;
18
20