@mui/x-charts 8.2.0 → 8.3.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 (134) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/ChartsClipPath/ChartsClipPath.d.ts +8 -0
  3. package/ChartsClipPath/ChartsClipPath.js +8 -0
  4. package/LineChart/AppearingMask.js +1 -2
  5. package/LineChart/CircleMarkElement.d.ts +10 -0
  6. package/LineChart/CircleMarkElement.js +5 -15
  7. package/LineChart/MarkElement.d.ts +10 -0
  8. package/LineChart/MarkElement.js +15 -15
  9. package/LineChart/MarkPlot.js +18 -2
  10. package/PieChart/PieArcLabel.js +3 -4
  11. package/SparkLineChart/SparkLineChart.d.ts +19 -0
  12. package/SparkLineChart/SparkLineChart.js +52 -15
  13. package/Toolbar/Toolbar.d.ts +5 -0
  14. package/Toolbar/Toolbar.js +34 -0
  15. package/Toolbar/ToolbarButton.d.ts +5 -0
  16. package/Toolbar/ToolbarButton.js +27 -0
  17. package/Toolbar/index.d.ts +2 -0
  18. package/Toolbar/index.js +27 -0
  19. package/esm/ChartsClipPath/ChartsClipPath.d.ts +8 -0
  20. package/esm/ChartsClipPath/ChartsClipPath.js +8 -0
  21. package/esm/LineChart/AppearingMask.js +1 -2
  22. package/esm/LineChart/CircleMarkElement.d.ts +10 -0
  23. package/esm/LineChart/CircleMarkElement.js +5 -15
  24. package/esm/LineChart/MarkElement.d.ts +10 -0
  25. package/esm/LineChart/MarkElement.js +15 -15
  26. package/esm/LineChart/MarkPlot.js +19 -3
  27. package/esm/PieChart/PieArcLabel.js +3 -4
  28. package/esm/SparkLineChart/SparkLineChart.d.ts +19 -0
  29. package/esm/SparkLineChart/SparkLineChart.js +52 -15
  30. package/esm/Toolbar/Toolbar.d.ts +5 -0
  31. package/esm/Toolbar/Toolbar.js +27 -0
  32. package/esm/Toolbar/ToolbarButton.d.ts +5 -0
  33. package/esm/Toolbar/ToolbarButton.js +20 -0
  34. package/esm/Toolbar/index.d.ts +2 -0
  35. package/esm/Toolbar/index.js +2 -0
  36. package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +10 -1
  37. package/esm/hooks/animation/useAnimatePieArcLabel.js +4 -4
  38. package/esm/index.d.ts +2 -1
  39. package/esm/index.js +3 -2
  40. package/esm/internals/constants.d.ts +4 -0
  41. package/esm/internals/constants.js +5 -0
  42. package/esm/internals/createSvgIcon.d.ts +3 -0
  43. package/esm/internals/createSvgIcon.js +2 -0
  44. package/esm/internals/index.d.ts +4 -1
  45. package/esm/internals/index.js +4 -1
  46. package/esm/internals/material/index.d.ts +4 -0
  47. package/esm/internals/material/index.js +7 -0
  48. package/esm/internals/plugins/corePlugins/corePlugins.d.ts +6 -4
  49. package/esm/internals/plugins/corePlugins/corePlugins.js +1 -1
  50. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +35 -0
  51. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +1 -1
  52. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +3 -4
  53. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +10 -2
  54. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +16 -4
  55. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +7 -2
  56. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +5 -4
  57. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +2 -1
  58. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +159 -0
  59. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +2 -1
  60. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +10 -0
  61. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +28 -13
  62. package/esm/internals/plugins/models/helpers.d.ts +0 -1
  63. package/esm/internals/plugins/models/plugin.d.ts +0 -30
  64. package/esm/internals/store/useCharts.d.ts +1 -1
  65. package/esm/internals/store/useCharts.js +11 -12
  66. package/esm/locales/enUS.d.ts +2 -0
  67. package/esm/locales/enUS.js +3 -1
  68. package/esm/locales/frFR.d.ts +2 -0
  69. package/esm/locales/frFR.js +2 -0
  70. package/esm/locales/utils/chartsLocaleTextApi.d.ts +8 -0
  71. package/esm/locales/utils/getChartsLocalization.d.ts +2 -0
  72. package/esm/models/axis.d.ts +10 -3
  73. package/esm/models/axis.js +4 -0
  74. package/esm/models/index.d.ts +2 -1
  75. package/esm/models/slots/chartsBaseSlotProps.d.ts +13 -0
  76. package/esm/models/slots/chartsBaseSlotProps.js +1 -0
  77. package/esm/models/slots/chartsBaseSlots.d.ts +5 -0
  78. package/esm/models/slots/chartsBaseSlots.js +1 -0
  79. package/esm/models/slots/chartsIconSlots.d.ts +1 -0
  80. package/esm/models/slots/chartsIconSlots.js +1 -0
  81. package/esm/models/slots/index.d.ts +3 -0
  82. package/esm/models/slots/index.js +3 -0
  83. package/hooks/animation/useAnimatePieArcLabel.d.ts +10 -1
  84. package/hooks/animation/useAnimatePieArcLabel.js +4 -4
  85. package/index.d.ts +2 -1
  86. package/index.js +12 -1
  87. package/internals/constants.d.ts +4 -0
  88. package/internals/constants.js +11 -0
  89. package/internals/createSvgIcon.d.ts +3 -0
  90. package/internals/createSvgIcon.js +8 -0
  91. package/internals/index.d.ts +4 -1
  92. package/internals/index.js +36 -0
  93. package/internals/material/index.d.ts +4 -0
  94. package/internals/material/index.js +14 -0
  95. package/internals/plugins/corePlugins/corePlugins.d.ts +6 -4
  96. package/internals/plugins/corePlugins/corePlugins.js +1 -1
  97. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +35 -0
  98. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +2 -2
  99. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +3 -4
  100. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +10 -2
  101. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +21 -9
  102. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +7 -2
  103. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +5 -4
  104. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +2 -1
  105. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +159 -0
  106. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +3 -2
  107. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +10 -0
  108. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +28 -13
  109. package/internals/plugins/models/helpers.d.ts +0 -1
  110. package/internals/plugins/models/plugin.d.ts +0 -30
  111. package/internals/store/useCharts.d.ts +1 -1
  112. package/internals/store/useCharts.js +11 -12
  113. package/locales/enUS.d.ts +2 -0
  114. package/locales/enUS.js +3 -1
  115. package/locales/frFR.d.ts +2 -0
  116. package/locales/frFR.js +2 -0
  117. package/locales/utils/chartsLocaleTextApi.d.ts +8 -0
  118. package/locales/utils/getChartsLocalization.d.ts +2 -0
  119. package/models/axis.d.ts +10 -3
  120. package/models/axis.js +4 -0
  121. package/models/index.d.ts +2 -1
  122. package/models/slots/chartsBaseSlotProps.d.ts +13 -0
  123. package/models/slots/chartsBaseSlotProps.js +5 -0
  124. package/models/slots/chartsBaseSlots.d.ts +5 -0
  125. package/models/slots/chartsBaseSlots.js +5 -0
  126. package/models/slots/chartsIconSlots.d.ts +1 -0
  127. package/models/slots/chartsIconSlots.js +5 -0
  128. package/models/slots/index.d.ts +3 -0
  129. package/models/slots/index.js +38 -0
  130. package/package.json +5 -5
  131. package/esm/internals/store/useChartModels.d.ts +0 -7
  132. package/esm/internals/store/useChartModels.js +0 -64
  133. package/internals/store/useChartModels.d.ts +0 -7
  134. package/internals/store/useChartModels.js +0 -73
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _chartsBaseSlots = require("./chartsBaseSlots");
7
+ Object.keys(_chartsBaseSlots).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _chartsBaseSlots[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _chartsBaseSlots[key];
14
+ }
15
+ });
16
+ });
17
+ var _chartsBaseSlotProps = require("./chartsBaseSlotProps");
18
+ Object.keys(_chartsBaseSlotProps).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _chartsBaseSlotProps[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _chartsBaseSlotProps[key];
25
+ }
26
+ });
27
+ });
28
+ var _chartsIconSlots = require("./chartsIconSlots");
29
+ Object.keys(_chartsIconSlots).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _chartsIconSlots[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _chartsIconSlots[key];
36
+ }
37
+ });
38
+ });
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "8.2.0",
4
- "description": "The community edition of the Charts components (MUI X).",
3
+ "version": "8.3.0",
5
4
  "author": "MUI Team",
5
+ "description": "The community edition of MUI X Charts components.",
6
6
  "main": "./index.js",
7
7
  "license": "MIT",
8
8
  "bugs": {
@@ -29,15 +29,15 @@
29
29
  "directory": "packages/x-charts"
30
30
  },
31
31
  "dependencies": {
32
- "@babel/runtime": "^7.27.0",
32
+ "@babel/runtime": "^7.27.1",
33
33
  "@mui/utils": "^7.0.2",
34
34
  "bezier-easing": "^2.1.0",
35
35
  "clsx": "^2.1.1",
36
36
  "prop-types": "^15.8.1",
37
37
  "reselect": "^5.1.1",
38
38
  "use-sync-external-store": "^1.5.0",
39
- "@mui/x-charts-vendor": "8.0.0",
40
- "@mui/x-internals": "8.2.0"
39
+ "@mui/x-charts-vendor": "8.3.0",
40
+ "@mui/x-internals": "8.3.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@emotion/react": "^11.9.0",
@@ -1,7 +0,0 @@
1
- import { ChartAnyPluginSignature, ConvertSignaturesIntoPlugins, MergeSignaturesProperty } from "../plugins/models/index.js";
2
- import { ChartCorePluginSignatures } from "../plugins/corePlugins/index.js";
3
- /**
4
- * Implements the same behavior as `useControlled` but for several models.
5
- * The controlled models are never stored in the state, and the state is only updated if the model is not controlled.
6
- */
7
- export declare const useChartModels: <TSignatures extends readonly ChartAnyPluginSignature[]>(plugins: ConvertSignaturesIntoPlugins<readonly [...ChartCorePluginSignatures, ...TSignatures]>, props: MergeSignaturesProperty<TSignatures, "defaultizedParams">) => MergeSignaturesProperty<TSignatures, "models">;
@@ -1,64 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- /**
4
- * Implements the same behavior as `useControlled` but for several models.
5
- * The controlled models are never stored in the state, and the state is only updated if the model is not controlled.
6
- */
7
- export const useChartModels = (plugins, props) => {
8
- const modelsRef = React.useRef({});
9
- const [modelsState, setModelsState] = React.useState(() => {
10
- const initialState = {};
11
- plugins.forEach(plugin => {
12
- if (plugin.models) {
13
- Object.entries(plugin.models).forEach(([modelName, modelInitializer]) => {
14
- modelsRef.current[modelName] = {
15
- isControlled: props[modelName] !== undefined,
16
- getDefaultValue: modelInitializer.getDefaultValue
17
- };
18
- initialState[modelName] = modelInitializer.getDefaultValue(props);
19
- });
20
- }
21
- });
22
- return initialState;
23
- });
24
- const models = Object.fromEntries(Object.entries(modelsRef.current).map(([modelName, model]) => {
25
- const value = props[modelName] ?? modelsState[modelName];
26
- return [modelName, {
27
- value,
28
- setControlledValue: newValue => {
29
- if (!model.isControlled) {
30
- setModelsState(prevState => _extends({}, prevState, {
31
- [modelName]: typeof newValue === 'function' ? newValue(value) : newValue
32
- }));
33
- }
34
- },
35
- isControlled: modelsRef.current[modelName].isControlled
36
- }];
37
- }));
38
-
39
- // We know that `modelsRef` do not vary across renders.
40
- if (process.env.NODE_ENV !== 'production') {
41
- Object.entries(modelsRef.current).forEach(([modelName, model]) => {
42
- const controlled = props[modelName];
43
- const newDefaultValue = model.getDefaultValue(props);
44
-
45
- /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps, react-compiler/react-compiler */
46
- React.useEffect(() => {
47
- if (model.isControlled !== (controlled !== undefined)) {
48
- console.error([`MUI X Charts: A component is changing the ${model.isControlled ? '' : 'un'}controlled ${modelName} state of Chart to be ${model.isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${modelName} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
49
- }
50
- }, [controlled]);
51
- const {
52
- current: defaultValue
53
- } = React.useRef(newDefaultValue);
54
- React.useEffect(() => {
55
- if (!model.isControlled && defaultValue !== newDefaultValue) {
56
- console.error([`MUI X Charts: A component is changing the default ${modelName} state of an uncontrolled Chart after being initialized. ` + `To suppress this warning opt to use a controlled Chart.`].join('\n'));
57
- }
58
- }, [JSON.stringify(newDefaultValue)]);
59
- });
60
- }
61
- /* eslint-enable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
62
-
63
- return models;
64
- };
@@ -1,7 +0,0 @@
1
- import { ChartAnyPluginSignature, ConvertSignaturesIntoPlugins, MergeSignaturesProperty } from "../plugins/models/index.js";
2
- import { ChartCorePluginSignatures } from "../plugins/corePlugins/index.js";
3
- /**
4
- * Implements the same behavior as `useControlled` but for several models.
5
- * The controlled models are never stored in the state, and the state is only updated if the model is not controlled.
6
- */
7
- export declare const useChartModels: <TSignatures extends readonly ChartAnyPluginSignature[]>(plugins: ConvertSignaturesIntoPlugins<readonly [...ChartCorePluginSignatures, ...TSignatures]>, props: MergeSignaturesProperty<TSignatures, "defaultizedParams">) => MergeSignaturesProperty<TSignatures, "models">;
@@ -1,73 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.useChartModels = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var React = _interopRequireWildcard(require("react"));
11
- /**
12
- * Implements the same behavior as `useControlled` but for several models.
13
- * The controlled models are never stored in the state, and the state is only updated if the model is not controlled.
14
- */
15
- const useChartModels = (plugins, props) => {
16
- const modelsRef = React.useRef({});
17
- const [modelsState, setModelsState] = React.useState(() => {
18
- const initialState = {};
19
- plugins.forEach(plugin => {
20
- if (plugin.models) {
21
- Object.entries(plugin.models).forEach(([modelName, modelInitializer]) => {
22
- modelsRef.current[modelName] = {
23
- isControlled: props[modelName] !== undefined,
24
- getDefaultValue: modelInitializer.getDefaultValue
25
- };
26
- initialState[modelName] = modelInitializer.getDefaultValue(props);
27
- });
28
- }
29
- });
30
- return initialState;
31
- });
32
- const models = Object.fromEntries(Object.entries(modelsRef.current).map(([modelName, model]) => {
33
- const value = props[modelName] ?? modelsState[modelName];
34
- return [modelName, {
35
- value,
36
- setControlledValue: newValue => {
37
- if (!model.isControlled) {
38
- setModelsState(prevState => (0, _extends2.default)({}, prevState, {
39
- [modelName]: typeof newValue === 'function' ? newValue(value) : newValue
40
- }));
41
- }
42
- },
43
- isControlled: modelsRef.current[modelName].isControlled
44
- }];
45
- }));
46
-
47
- // We know that `modelsRef` do not vary across renders.
48
- if (process.env.NODE_ENV !== 'production') {
49
- Object.entries(modelsRef.current).forEach(([modelName, model]) => {
50
- const controlled = props[modelName];
51
- const newDefaultValue = model.getDefaultValue(props);
52
-
53
- /* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps, react-compiler/react-compiler */
54
- React.useEffect(() => {
55
- if (model.isControlled !== (controlled !== undefined)) {
56
- console.error([`MUI X Charts: A component is changing the ${model.isControlled ? '' : 'un'}controlled ${modelName} state of Chart to be ${model.isControlled ? 'un' : ''}controlled.`, 'Elements should not switch from uncontrolled to controlled (or vice versa).', `Decide between using a controlled or uncontrolled ${modelName} ` + 'element for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
57
- }
58
- }, [controlled]);
59
- const {
60
- current: defaultValue
61
- } = React.useRef(newDefaultValue);
62
- React.useEffect(() => {
63
- if (!model.isControlled && defaultValue !== newDefaultValue) {
64
- console.error([`MUI X Charts: A component is changing the default ${modelName} state of an uncontrolled Chart after being initialized. ` + `To suppress this warning opt to use a controlled Chart.`].join('\n'));
65
- }
66
- }, [JSON.stringify(newDefaultValue)]);
67
- });
68
- }
69
- /* eslint-enable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */
70
-
71
- return models;
72
- };
73
- exports.useChartModels = useChartModels;