@mui/x-charts 6.0.0-alpha.14 → 6.0.0-alpha.16

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 (199) hide show
  1. package/BarChart/BarChart.d.ts +16 -2
  2. package/BarChart/BarChart.js +49 -11
  3. package/BarChart/BarElement.d.ts +1318 -3
  4. package/BarChart/BarElement.js +10 -8
  5. package/BarChart/BarPlot.d.ts +17 -1
  6. package/BarChart/BarPlot.js +152 -66
  7. package/CHANGELOG.md +169 -0
  8. package/ChartContainer/index.js +5 -2
  9. package/ChartsAxis/ChartsAxis.js +18 -2
  10. package/ChartsAxis/axisClasses.d.ts +1 -1
  11. package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
  12. package/ChartsClipPath/ChartsClipPath.js +2 -2
  13. package/ChartsLegend/ChartsLegend.d.ts +44 -24
  14. package/ChartsLegend/ChartsLegend.js +191 -145
  15. package/ChartsLegend/utils.d.ts +1 -6
  16. package/ChartsSurface.js +5 -13
  17. package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
  18. package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  19. package/ChartsTooltip/ChartsTooltip.js +2 -2
  20. package/ChartsTooltip/utils.js +2 -2
  21. package/ChartsXAxis/ChartsXAxis.js +151 -40
  22. package/ChartsYAxis/ChartsYAxis.js +76 -33
  23. package/LineChart/AreaElement.d.ts +10 -0
  24. package/LineChart/AreaElement.js +12 -2
  25. package/LineChart/AreaPlot.d.ts +11 -0
  26. package/LineChart/AreaPlot.js +13 -2
  27. package/LineChart/LineChart.d.ts +13 -0
  28. package/LineChart/LineChart.js +40 -10
  29. package/LineChart/LineElement.d.ts +10 -0
  30. package/LineChart/LineElement.js +12 -2
  31. package/LineChart/LineHighlightElement.d.ts +10 -0
  32. package/LineChart/LineHighlightElement.js +12 -2
  33. package/LineChart/LineHighlightPlot.d.ts +10 -0
  34. package/LineChart/LineHighlightPlot.js +12 -2
  35. package/LineChart/LinePlot.d.ts +10 -0
  36. package/LineChart/LinePlot.js +12 -2
  37. package/LineChart/MarkElement.d.ts +10 -0
  38. package/LineChart/MarkElement.js +12 -2
  39. package/LineChart/MarkPlot.d.ts +10 -0
  40. package/LineChart/MarkPlot.js +12 -2
  41. package/PieChart/PieArc.js +2 -2
  42. package/PieChart/PieArcLabel.js +2 -2
  43. package/PieChart/PieChart.d.ts +13 -0
  44. package/PieChart/PieChart.js +41 -10
  45. package/PieChart/PiePlot.d.ts +10 -0
  46. package/PieChart/PiePlot.js +12 -2
  47. package/ResponsiveChartContainer/index.js +4 -4
  48. package/ScatterChart/Scatter.d.ts +10 -0
  49. package/ScatterChart/Scatter.js +12 -2
  50. package/ScatterChart/ScatterChart.d.ts +13 -0
  51. package/ScatterChart/ScatterChart.js +40 -10
  52. package/ScatterChart/ScatterPlot.d.ts +10 -0
  53. package/ScatterChart/ScatterPlot.js +12 -2
  54. package/SparkLineChart/SparkLineChart.d.ts +9 -0
  55. package/SparkLineChart/SparkLineChart.js +16 -2
  56. package/constants.js +1 -1
  57. package/context/CartesianContextProvider.js +20 -12
  58. package/context/DrawingProvider.d.ts +2 -0
  59. package/context/DrawingProvider.js +4 -2
  60. package/context/HighlightProvider.js +2 -2
  61. package/context/InteractionProvider.js +2 -2
  62. package/context/SeriesContextProvider.js +2 -2
  63. package/esm/BarChart/BarChart.js +47 -9
  64. package/esm/BarChart/BarElement.js +7 -4
  65. package/esm/BarChart/BarPlot.js +152 -67
  66. package/esm/ChartContainer/index.js +3 -0
  67. package/esm/ChartsAxis/ChartsAxis.js +16 -0
  68. package/esm/ChartsLegend/ChartsLegend.js +188 -142
  69. package/esm/ChartsSurface.js +3 -11
  70. package/esm/ChartsXAxis/ChartsXAxis.js +148 -37
  71. package/esm/ChartsYAxis/ChartsYAxis.js +73 -30
  72. package/esm/LineChart/AreaElement.js +10 -0
  73. package/esm/LineChart/AreaPlot.js +11 -0
  74. package/esm/LineChart/LineChart.js +38 -8
  75. package/esm/LineChart/LineElement.js +10 -0
  76. package/esm/LineChart/LineHighlightElement.js +10 -0
  77. package/esm/LineChart/LineHighlightPlot.js +10 -0
  78. package/esm/LineChart/LinePlot.js +10 -0
  79. package/esm/LineChart/MarkElement.js +10 -0
  80. package/esm/LineChart/MarkPlot.js +10 -0
  81. package/esm/PieChart/PieChart.js +39 -8
  82. package/esm/PieChart/PiePlot.js +10 -0
  83. package/esm/ResponsiveChartContainer/index.js +2 -2
  84. package/esm/ScatterChart/Scatter.js +10 -0
  85. package/esm/ScatterChart/ScatterChart.js +38 -8
  86. package/esm/ScatterChart/ScatterPlot.js +10 -0
  87. package/esm/SparkLineChart/SparkLineChart.js +14 -0
  88. package/esm/constants.js +1 -1
  89. package/esm/context/CartesianContextProvider.js +19 -11
  90. package/esm/context/DrawingProvider.js +2 -0
  91. package/esm/hooks/useChartDimensions.js +2 -0
  92. package/esm/hooks/useMounted.js +16 -0
  93. package/esm/hooks/useReducedMotion.js +27 -0
  94. package/esm/hooks/useTicks.js +15 -9
  95. package/esm/internals/components/AxisSharedComponents.js +15 -70
  96. package/esm/internals/components/ChartsText.js +75 -0
  97. package/esm/internals/domUtils.js +113 -0
  98. package/esm/internals/geometry.js +36 -0
  99. package/hooks/useAxisEvents.js +2 -2
  100. package/hooks/useChartDimensions.d.ts +2 -0
  101. package/hooks/useChartDimensions.js +4 -2
  102. package/hooks/useDrawingArea.js +2 -2
  103. package/hooks/useInteractionItemProps.js +2 -2
  104. package/hooks/useMounted.d.ts +1 -0
  105. package/hooks/useMounted.js +25 -0
  106. package/hooks/useReducedMotion.d.ts +8 -0
  107. package/hooks/useReducedMotion.js +33 -0
  108. package/hooks/useScale.d.ts +2 -2
  109. package/hooks/useScale.js +2 -2
  110. package/hooks/useTicks.d.ts +19 -11
  111. package/hooks/useTicks.js +18 -12
  112. package/index.js +1 -1
  113. package/internals/components/AxisSharedComponents.d.ts +0 -4
  114. package/internals/components/AxisSharedComponents.js +16 -71
  115. package/internals/components/ChartsText.d.ts +35 -0
  116. package/internals/components/ChartsText.js +85 -0
  117. package/internals/defaultizeColor.d.ts +1 -1
  118. package/internals/domUtils.d.ts +13 -0
  119. package/internals/domUtils.js +122 -0
  120. package/internals/geometry.d.ts +9 -0
  121. package/internals/geometry.js +42 -0
  122. package/legacy/BarChart/BarChart.js +47 -9
  123. package/legacy/BarChart/BarElement.js +6 -3
  124. package/legacy/BarChart/BarPlot.js +151 -63
  125. package/legacy/ChartContainer/index.js +3 -0
  126. package/legacy/ChartsAxis/ChartsAxis.js +16 -0
  127. package/legacy/ChartsLegend/ChartsLegend.js +203 -140
  128. package/legacy/ChartsSurface.js +2 -11
  129. package/legacy/ChartsXAxis/ChartsXAxis.js +152 -39
  130. package/legacy/ChartsYAxis/ChartsYAxis.js +73 -30
  131. package/legacy/LineChart/AreaElement.js +10 -0
  132. package/legacy/LineChart/AreaPlot.js +11 -0
  133. package/legacy/LineChart/LineChart.js +38 -8
  134. package/legacy/LineChart/LineElement.js +10 -0
  135. package/legacy/LineChart/LineHighlightElement.js +10 -0
  136. package/legacy/LineChart/LineHighlightPlot.js +10 -0
  137. package/legacy/LineChart/LinePlot.js +10 -0
  138. package/legacy/LineChart/MarkElement.js +10 -0
  139. package/legacy/LineChart/MarkPlot.js +10 -0
  140. package/legacy/PieChart/PieChart.js +39 -8
  141. package/legacy/PieChart/PiePlot.js +10 -0
  142. package/legacy/ResponsiveChartContainer/index.js +2 -2
  143. package/legacy/ScatterChart/Scatter.js +10 -0
  144. package/legacy/ScatterChart/ScatterChart.js +38 -8
  145. package/legacy/ScatterChart/ScatterPlot.js +10 -0
  146. package/legacy/SparkLineChart/SparkLineChart.js +14 -0
  147. package/legacy/constants.js +1 -1
  148. package/legacy/context/CartesianContextProvider.js +19 -11
  149. package/legacy/context/DrawingProvider.js +2 -0
  150. package/legacy/hooks/useChartDimensions.js +2 -0
  151. package/legacy/hooks/useMounted.js +21 -0
  152. package/legacy/hooks/useReducedMotion.js +27 -0
  153. package/legacy/hooks/useTicks.js +16 -9
  154. package/legacy/index.js +1 -1
  155. package/legacy/internals/components/AxisSharedComponents.js +9 -63
  156. package/legacy/internals/components/ChartsText.js +77 -0
  157. package/legacy/internals/domUtils.js +121 -0
  158. package/legacy/internals/geometry.js +37 -0
  159. package/models/axis.d.ts +25 -7
  160. package/models/layout.d.ts +7 -6
  161. package/models/seriesType/line.d.ts +2 -2
  162. package/modern/BarChart/BarChart.js +47 -9
  163. package/modern/BarChart/BarElement.js +7 -4
  164. package/modern/BarChart/BarPlot.js +149 -65
  165. package/modern/ChartContainer/index.js +3 -0
  166. package/modern/ChartsAxis/ChartsAxis.js +16 -0
  167. package/modern/ChartsLegend/ChartsLegend.js +188 -142
  168. package/modern/ChartsSurface.js +3 -11
  169. package/modern/ChartsXAxis/ChartsXAxis.js +148 -37
  170. package/modern/ChartsYAxis/ChartsYAxis.js +73 -30
  171. package/modern/LineChart/AreaElement.js +10 -0
  172. package/modern/LineChart/AreaPlot.js +11 -0
  173. package/modern/LineChart/LineChart.js +38 -8
  174. package/modern/LineChart/LineElement.js +10 -0
  175. package/modern/LineChart/LineHighlightElement.js +10 -0
  176. package/modern/LineChart/LineHighlightPlot.js +10 -0
  177. package/modern/LineChart/LinePlot.js +10 -0
  178. package/modern/LineChart/MarkElement.js +10 -0
  179. package/modern/LineChart/MarkPlot.js +10 -0
  180. package/modern/PieChart/PieChart.js +39 -8
  181. package/modern/PieChart/PiePlot.js +10 -0
  182. package/modern/ResponsiveChartContainer/index.js +2 -2
  183. package/modern/ScatterChart/Scatter.js +10 -0
  184. package/modern/ScatterChart/ScatterChart.js +38 -8
  185. package/modern/ScatterChart/ScatterPlot.js +10 -0
  186. package/modern/SparkLineChart/SparkLineChart.js +14 -0
  187. package/modern/constants.js +1 -1
  188. package/modern/context/CartesianContextProvider.js +19 -11
  189. package/modern/context/DrawingProvider.js +2 -0
  190. package/modern/hooks/useChartDimensions.js +2 -0
  191. package/modern/hooks/useMounted.js +16 -0
  192. package/modern/hooks/useReducedMotion.js +27 -0
  193. package/modern/hooks/useTicks.js +15 -9
  194. package/modern/index.js +1 -1
  195. package/modern/internals/components/AxisSharedComponents.js +15 -70
  196. package/modern/internals/components/ChartsText.js +75 -0
  197. package/modern/internals/domUtils.js +113 -0
  198. package/modern/internals/geometry.js +36 -0
  199. package/package.json +5 -3
@@ -1,11 +1,14 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
1
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["skipAnimation"];
2
4
  import * as React from 'react';
3
5
  import PropTypes from 'prop-types';
6
+ import { useTransition } from '@react-spring/web';
4
7
  import { SeriesContext } from '../context/SeriesContextProvider';
5
8
  import { CartesianContext } from '../context/CartesianContextProvider';
6
9
  import { BarElement } from './BarElement';
7
10
  import { isBandScaleConfig } from '../models/axis';
8
-
11
+ import { jsx as _jsx } from "react/jsx-runtime";
9
12
  /**
10
13
  * Solution of the equations
11
14
  * W = barWidth * N + offset * (N-1)
@@ -15,7 +18,6 @@ import { isBandScaleConfig } from '../models/axis';
15
18
  * @param gapRatio The ratio of the gap between bars over the bar width.
16
19
  * @returns The bar width and the offset between bars.
17
20
  */
18
- import { jsx as _jsx } from "react/jsx-runtime";
19
21
  function getBandSize({
20
22
  bandWidth: W,
21
23
  numberOfGroups: N,
@@ -34,12 +36,14 @@ function getBandSize({
34
36
  offset
35
37
  };
36
38
  }
37
- function BarPlot(props) {
38
- const seriesData = React.useContext(SeriesContext).bar;
39
+ const useCompletedData = () => {
40
+ var _React$useContext$bar;
41
+ const seriesData = (_React$useContext$bar = React.useContext(SeriesContext).bar) != null ? _React$useContext$bar : {
42
+ series: {},
43
+ stackingGroups: [],
44
+ seriesOrder: []
45
+ };
39
46
  const axisData = React.useContext(CartesianContext);
40
- if (seriesData === undefined) {
41
- return null;
42
- }
43
47
  const {
44
48
  series,
45
49
  stackingGroups
@@ -52,68 +56,144 @@ function BarPlot(props) {
52
56
  } = axisData;
53
57
  const defaultXAxisId = xAxisIds[0];
54
58
  const defaultYAxisId = yAxisIds[0];
55
- return /*#__PURE__*/_jsx(React.Fragment, {
56
- children: stackingGroups.flatMap(({
57
- ids: groupIds
58
- }, groupIndex) => {
59
- return groupIds.flatMap(seriesId => {
60
- var _series$seriesId$xAxi, _series$seriesId$yAxi;
61
- const xAxisKey = (_series$seriesId$xAxi = series[seriesId].xAxisKey) != null ? _series$seriesId$xAxi : defaultXAxisId;
62
- const yAxisKey = (_series$seriesId$yAxi = series[seriesId].yAxisKey) != null ? _series$seriesId$yAxi : defaultYAxisId;
63
- const xAxisConfig = xAxis[xAxisKey];
64
- const yAxisConfig = yAxis[yAxisKey];
65
- const verticalLayout = series[seriesId].layout === 'vertical';
66
- let baseScaleConfig;
67
- if (verticalLayout) {
68
- if (!isBandScaleConfig(xAxisConfig)) {
69
- throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
70
- }
71
- if (xAxis[xAxisKey].data === undefined) {
72
- throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
73
- }
74
- baseScaleConfig = xAxisConfig;
75
- } else {
76
- if (!isBandScaleConfig(yAxisConfig)) {
77
- throw new Error(`Axis with id "${yAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
78
- }
79
- if (yAxis[yAxisKey].data === undefined) {
80
- throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
81
- }
82
- baseScaleConfig = yAxisConfig;
59
+ const data = stackingGroups.flatMap(({
60
+ ids: groupIds
61
+ }, groupIndex) => {
62
+ return groupIds.flatMap(seriesId => {
63
+ var _series$seriesId$xAxi, _series$seriesId$yAxi;
64
+ const xAxisKey = (_series$seriesId$xAxi = series[seriesId].xAxisKey) != null ? _series$seriesId$xAxi : defaultXAxisId;
65
+ const yAxisKey = (_series$seriesId$yAxi = series[seriesId].yAxisKey) != null ? _series$seriesId$yAxi : defaultYAxisId;
66
+ const xAxisConfig = xAxis[xAxisKey];
67
+ const yAxisConfig = yAxis[yAxisKey];
68
+ const verticalLayout = series[seriesId].layout === 'vertical';
69
+ let baseScaleConfig;
70
+ if (verticalLayout) {
71
+ if (!isBandScaleConfig(xAxisConfig)) {
72
+ throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
73
+ }
74
+ if (xAxis[xAxisKey].data === undefined) {
75
+ throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
76
+ }
77
+ baseScaleConfig = xAxisConfig;
78
+ } else {
79
+ if (!isBandScaleConfig(yAxisConfig)) {
80
+ throw new Error(`Axis with id "${yAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
83
81
  }
84
- const xScale = xAxisConfig.scale;
85
- const yScale = yAxisConfig.scale;
86
- const bandWidth = baseScaleConfig.scale.bandwidth();
87
- const {
88
- barWidth,
89
- offset
90
- } = getBandSize({
91
- bandWidth,
92
- numberOfGroups: stackingGroups.length,
93
- gapRatio: baseScaleConfig.barGapRatio
94
- });
95
- const barOffset = groupIndex * (barWidth + offset);
96
- const {
97
- stackedData,
98
- color
99
- } = series[seriesId];
100
- return stackedData.map((values, dataIndex) => {
101
- var _xAxis$xAxisKey$data, _yAxis$yAxisKey$data;
102
- const baseline = Math.min(...values);
103
- const value = Math.max(...values);
104
- return /*#__PURE__*/_jsx(BarElement, _extends({
105
- id: seriesId,
106
- dataIndex: dataIndex,
107
- x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset : xScale(baseline),
108
- y: verticalLayout ? yScale(value) : yScale((_yAxis$yAxisKey$data = yAxis[yAxisKey].data) == null ? void 0 : _yAxis$yAxisKey$data[dataIndex]) + barOffset,
109
- height: verticalLayout ? Math.abs(yScale(baseline) - yScale(value)) : barWidth,
110
- width: verticalLayout ? barWidth : Math.abs(xScale(baseline) - xScale(value)),
111
- color: color,
112
- highlightScope: series[seriesId].highlightScope
113
- }, props), `${seriesId}-${dataIndex}`);
114
- });
82
+ if (yAxis[yAxisKey].data === undefined) {
83
+ throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
84
+ }
85
+ baseScaleConfig = yAxisConfig;
86
+ }
87
+ const xScale = xAxisConfig.scale;
88
+ const yScale = yAxisConfig.scale;
89
+ const bandWidth = baseScaleConfig.scale.bandwidth();
90
+ const {
91
+ barWidth,
92
+ offset
93
+ } = getBandSize({
94
+ bandWidth,
95
+ numberOfGroups: stackingGroups.length,
96
+ gapRatio: baseScaleConfig.barGapRatio
97
+ });
98
+ const barOffset = groupIndex * (barWidth + offset);
99
+ const {
100
+ stackedData,
101
+ color
102
+ } = series[seriesId];
103
+ return stackedData.map((values, dataIndex) => {
104
+ var _xAxis$xAxisKey$data, _yAxis$yAxisKey$data;
105
+ const bottom = Math.min(...values);
106
+ const top = Math.max(...values);
107
+ return {
108
+ bottom,
109
+ top,
110
+ seriesId,
111
+ dataIndex,
112
+ layout: series[seriesId].layout,
113
+ x: verticalLayout ? xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + barOffset : xScale(bottom),
114
+ y: verticalLayout ? yScale(top) : yScale((_yAxis$yAxisKey$data = yAxis[yAxisKey].data) == null ? void 0 : _yAxis$yAxisKey$data[dataIndex]) + barOffset,
115
+ xOrigin: xScale(0),
116
+ yOrigin: yScale(0),
117
+ height: verticalLayout ? Math.abs(yScale(bottom) - yScale(top)) : barWidth,
118
+ width: verticalLayout ? barWidth : Math.abs(xScale(bottom) - xScale(top)),
119
+ color,
120
+ highlightScope: series[seriesId].highlightScope
121
+ };
115
122
  });
116
- })
123
+ });
124
+ });
125
+ return data;
126
+ };
127
+ const getOutStyle = ({
128
+ layout,
129
+ yOrigin,
130
+ x,
131
+ width,
132
+ y,
133
+ xOrigin,
134
+ height
135
+ }) => _extends({}, layout === 'vertical' ? {
136
+ y: yOrigin,
137
+ x,
138
+ height: 0,
139
+ width
140
+ } : {
141
+ y,
142
+ x: xOrigin,
143
+ height,
144
+ width: 0
145
+ });
146
+ const getInStyle = ({
147
+ x,
148
+ width,
149
+ y,
150
+ height
151
+ }) => ({
152
+ y,
153
+ x,
154
+ height,
155
+ width
156
+ });
157
+
158
+ /**
159
+ * Demos:
160
+ *
161
+ * - [Bars](https://mui.com/x/react-charts/bars/)
162
+ * - [Bar demonstration](https://mui.com/x/react-charts/bar-demo/)
163
+ * - [Stacking](https://mui.com/x/react-charts/stacking/)
164
+ *
165
+ * API:
166
+ *
167
+ * - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
168
+ */
169
+ function BarPlot(props) {
170
+ const completedData = useCompletedData();
171
+ const {
172
+ skipAnimation
173
+ } = props,
174
+ other = _objectWithoutPropertiesLoose(props, _excluded);
175
+ const transition = useTransition(completedData, {
176
+ keys: bar => `${bar.seriesId}-${bar.dataIndex}`,
177
+ from: getOutStyle,
178
+ leave: getOutStyle,
179
+ enter: getInStyle,
180
+ update: getInStyle,
181
+ immediate: skipAnimation
182
+ });
183
+ return /*#__PURE__*/_jsx(React.Fragment, {
184
+ children: transition((style, {
185
+ seriesId,
186
+ dataIndex,
187
+ color,
188
+ highlightScope
189
+ }) => /*#__PURE__*/_jsx(BarElement, _extends({
190
+ id: seriesId,
191
+ dataIndex: dataIndex,
192
+ highlightScope: highlightScope,
193
+ color: color
194
+ }, other, {
195
+ style: style
196
+ })))
117
197
  });
118
198
  }
119
199
  process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
@@ -121,6 +201,11 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
121
201
  // | These PropTypes are generated from the TypeScript type definitions |
122
202
  // | To update them edit the TypeScript types and run "yarn proptypes" |
123
203
  // ----------------------------------------------------------------------
204
+ /**
205
+ * If `true`, animations are skiped.
206
+ * @default false
207
+ */
208
+ skipAnimation: PropTypes.bool,
124
209
  /**
125
210
  * The props used for each component slot.
126
211
  * @default {}
@@ -3,6 +3,7 @@ import useForkRef from '@mui/utils/useForkRef';
3
3
  import { DrawingProvider } from '../context/DrawingProvider';
4
4
  import { SeriesContextProvider } from '../context/SeriesContextProvider';
5
5
  import { InteractionProvider } from '../context/InteractionProvider';
6
+ import { useReducedMotion } from '../hooks/useReducedMotion';
6
7
  import { ChartsSurface } from '../ChartsSurface';
7
8
  import { CartesianContextProvider } from '../context/CartesianContextProvider';
8
9
  import { HighlightProvider } from '../context/HighlightProvider';
@@ -25,6 +26,8 @@ export const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContai
25
26
  } = props;
26
27
  const svgRef = React.useRef(null);
27
28
  const handleRef = useForkRef(ref, svgRef);
29
+ useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
30
+
28
31
  return /*#__PURE__*/_jsx(DrawingProvider, {
29
32
  width: width,
30
33
  height: height,
@@ -97,11 +97,15 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
97
97
  fill: PropTypes.string,
98
98
  label: PropTypes.string,
99
99
  labelFontSize: PropTypes.number,
100
+ labelStyle: PropTypes.object,
100
101
  position: PropTypes.oneOf(['bottom', 'top']),
101
102
  slotProps: PropTypes.object,
102
103
  slots: PropTypes.object,
103
104
  stroke: PropTypes.string,
104
105
  tickFontSize: PropTypes.number,
106
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
107
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
108
+ tickLabelStyle: PropTypes.object,
105
109
  tickMaxStep: PropTypes.number,
106
110
  tickMinStep: PropTypes.number,
107
111
  tickNumber: PropTypes.number,
@@ -120,11 +124,15 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
120
124
  fill: PropTypes.string,
121
125
  label: PropTypes.string,
122
126
  labelFontSize: PropTypes.number,
127
+ labelStyle: PropTypes.object,
123
128
  position: PropTypes.oneOf(['left', 'right']),
124
129
  slotProps: PropTypes.object,
125
130
  slots: PropTypes.object,
126
131
  stroke: PropTypes.string,
127
132
  tickFontSize: PropTypes.number,
133
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
134
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
135
+ tickLabelStyle: PropTypes.object,
128
136
  tickMaxStep: PropTypes.number,
129
137
  tickMinStep: PropTypes.number,
130
138
  tickNumber: PropTypes.number,
@@ -143,11 +151,15 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
143
151
  fill: PropTypes.string,
144
152
  label: PropTypes.string,
145
153
  labelFontSize: PropTypes.number,
154
+ labelStyle: PropTypes.object,
146
155
  position: PropTypes.oneOf(['left', 'right']),
147
156
  slotProps: PropTypes.object,
148
157
  slots: PropTypes.object,
149
158
  stroke: PropTypes.string,
150
159
  tickFontSize: PropTypes.number,
160
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
161
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
162
+ tickLabelStyle: PropTypes.object,
151
163
  tickMaxStep: PropTypes.number,
152
164
  tickMinStep: PropTypes.number,
153
165
  tickNumber: PropTypes.number,
@@ -176,11 +188,15 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
176
188
  fill: PropTypes.string,
177
189
  label: PropTypes.string,
178
190
  labelFontSize: PropTypes.number,
191
+ labelStyle: PropTypes.object,
179
192
  position: PropTypes.oneOf(['bottom', 'top']),
180
193
  slotProps: PropTypes.object,
181
194
  slots: PropTypes.object,
182
195
  stroke: PropTypes.string,
183
196
  tickFontSize: PropTypes.number,
197
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
198
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
199
+ tickLabelStyle: PropTypes.object,
184
200
  tickMaxStep: PropTypes.number,
185
201
  tickMinStep: PropTypes.number,
186
202
  tickNumber: PropTypes.number,