@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,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps"];
3
+ const _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style"];
4
4
  import * as React from 'react';
5
5
  import composeClasses from '@mui/utils/composeClasses';
6
6
  import { useSlotProps } from '@mui/base/utils';
@@ -8,13 +8,14 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
8
8
  import { styled } from '@mui/material/styles';
9
9
  import { color as d3Color } from 'd3-color';
10
10
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
11
+ import { animated } from '@react-spring/web';
11
12
  import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
12
13
  import { InteractionContext } from '../context/InteractionProvider';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  export function getBarElementUtilityClass(slot) {
15
16
  return generateUtilityClass('MuiBarElement', slot);
16
17
  }
17
- export const lineElementClasses = generateUtilityClasses('MuiBarElement', ['root']);
18
+ export const barElementClasses = generateUtilityClasses('MuiBarElement', ['root']);
18
19
  const useUtilityClasses = ownerState => {
19
20
  const {
20
21
  classes,
@@ -25,7 +26,7 @@ const useUtilityClasses = ownerState => {
25
26
  };
26
27
  return composeClasses(slots, getBarElementUtilityClass, classes);
27
28
  };
28
- export const BarElementPath = styled('rect', {
29
+ export const BarElementPath = styled(animated.rect, {
29
30
  name: 'MuiBarElement',
30
31
  slot: 'Root',
31
32
  overridesResolver: (_, styles) => styles.root
@@ -46,7 +47,8 @@ export function BarElement(props) {
46
47
  color,
47
48
  highlightScope,
48
49
  slots,
49
- slotProps
50
+ slotProps,
51
+ style
50
52
  } = props,
51
53
  other = _objectWithoutPropertiesLoose(props, _excluded);
52
54
  const getInteractionItemProps = useInteractionItemProps(highlightScope);
@@ -81,6 +83,7 @@ export function BarElement(props) {
81
83
  seriesId: id,
82
84
  dataIndex
83
85
  }), {
86
+ style,
84
87
  className: classes.root
85
88
  }),
86
89
  ownerState
@@ -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,13 @@ function getBandSize({
34
36
  offset
35
37
  };
36
38
  }
37
- function BarPlot(props) {
38
- const seriesData = React.useContext(SeriesContext).bar;
39
+ const useCompletedData = () => {
40
+ const seriesData = React.useContext(SeriesContext).bar ?? {
41
+ series: {},
42
+ stackingGroups: [],
43
+ seriesOrder: []
44
+ };
39
45
  const axisData = React.useContext(CartesianContext);
40
- if (seriesData === undefined) {
41
- return null;
42
- }
43
46
  const {
44
47
  series,
45
48
  stackingGroups
@@ -52,66 +55,142 @@ function BarPlot(props) {
52
55
  } = axisData;
53
56
  const defaultXAxisId = xAxisIds[0];
54
57
  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
- const xAxisKey = series[seriesId].xAxisKey ?? defaultXAxisId;
61
- const yAxisKey = series[seriesId].yAxisKey ?? defaultYAxisId;
62
- const xAxisConfig = xAxis[xAxisKey];
63
- const yAxisConfig = yAxis[yAxisKey];
64
- const verticalLayout = series[seriesId].layout === 'vertical';
65
- let baseScaleConfig;
66
- if (verticalLayout) {
67
- if (!isBandScaleConfig(xAxisConfig)) {
68
- throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
69
- }
70
- if (xAxis[xAxisKey].data === undefined) {
71
- throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
72
- }
73
- baseScaleConfig = xAxisConfig;
74
- } else {
75
- if (!isBandScaleConfig(yAxisConfig)) {
76
- throw new Error(`Axis with id "${yAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
77
- }
78
- if (yAxis[yAxisKey].data === undefined) {
79
- throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
80
- }
81
- baseScaleConfig = yAxisConfig;
58
+ const data = stackingGroups.flatMap(({
59
+ ids: groupIds
60
+ }, groupIndex) => {
61
+ return groupIds.flatMap(seriesId => {
62
+ const xAxisKey = series[seriesId].xAxisKey ?? defaultXAxisId;
63
+ const yAxisKey = series[seriesId].yAxisKey ?? defaultYAxisId;
64
+ const xAxisConfig = xAxis[xAxisKey];
65
+ const yAxisConfig = yAxis[yAxisKey];
66
+ const verticalLayout = series[seriesId].layout === 'vertical';
67
+ let baseScaleConfig;
68
+ if (verticalLayout) {
69
+ if (!isBandScaleConfig(xAxisConfig)) {
70
+ throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
71
+ }
72
+ if (xAxis[xAxisKey].data === undefined) {
73
+ throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
74
+ }
75
+ baseScaleConfig = xAxisConfig;
76
+ } else {
77
+ if (!isBandScaleConfig(yAxisConfig)) {
78
+ throw new Error(`Axis with id "${yAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
82
79
  }
83
- const xScale = xAxisConfig.scale;
84
- const yScale = yAxisConfig.scale;
85
- const bandWidth = baseScaleConfig.scale.bandwidth();
86
- const {
87
- barWidth,
88
- offset
89
- } = getBandSize({
90
- bandWidth,
91
- numberOfGroups: stackingGroups.length,
92
- gapRatio: baseScaleConfig.barGapRatio
93
- });
94
- const barOffset = groupIndex * (barWidth + offset);
95
- const {
96
- stackedData,
97
- color
98
- } = series[seriesId];
99
- return stackedData.map((values, dataIndex) => {
100
- const baseline = Math.min(...values);
101
- const value = Math.max(...values);
102
- return /*#__PURE__*/_jsx(BarElement, _extends({
103
- id: seriesId,
104
- dataIndex: dataIndex,
105
- x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset : xScale(baseline),
106
- y: verticalLayout ? yScale(value) : yScale(yAxis[yAxisKey].data?.[dataIndex]) + barOffset,
107
- height: verticalLayout ? Math.abs(yScale(baseline) - yScale(value)) : barWidth,
108
- width: verticalLayout ? barWidth : Math.abs(xScale(baseline) - xScale(value)),
109
- color: color,
110
- highlightScope: series[seriesId].highlightScope
111
- }, props), `${seriesId}-${dataIndex}`);
112
- });
80
+ if (yAxis[yAxisKey].data === undefined) {
81
+ throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
82
+ }
83
+ baseScaleConfig = yAxisConfig;
84
+ }
85
+ const xScale = xAxisConfig.scale;
86
+ const yScale = yAxisConfig.scale;
87
+ const bandWidth = baseScaleConfig.scale.bandwidth();
88
+ const {
89
+ barWidth,
90
+ offset
91
+ } = getBandSize({
92
+ bandWidth,
93
+ numberOfGroups: stackingGroups.length,
94
+ gapRatio: baseScaleConfig.barGapRatio
95
+ });
96
+ const barOffset = groupIndex * (barWidth + offset);
97
+ const {
98
+ stackedData,
99
+ color
100
+ } = series[seriesId];
101
+ return stackedData.map((values, dataIndex) => {
102
+ const bottom = Math.min(...values);
103
+ const top = Math.max(...values);
104
+ return {
105
+ bottom,
106
+ top,
107
+ seriesId,
108
+ dataIndex,
109
+ layout: series[seriesId].layout,
110
+ x: verticalLayout ? xScale(xAxis[xAxisKey].data?.[dataIndex]) + barOffset : xScale(bottom),
111
+ y: verticalLayout ? yScale(top) : yScale(yAxis[yAxisKey].data?.[dataIndex]) + barOffset,
112
+ xOrigin: xScale(0),
113
+ yOrigin: yScale(0),
114
+ height: verticalLayout ? Math.abs(yScale(bottom) - yScale(top)) : barWidth,
115
+ width: verticalLayout ? barWidth : Math.abs(xScale(bottom) - xScale(top)),
116
+ color,
117
+ highlightScope: series[seriesId].highlightScope
118
+ };
113
119
  });
114
- })
120
+ });
121
+ });
122
+ return data;
123
+ };
124
+ const getOutStyle = ({
125
+ layout,
126
+ yOrigin,
127
+ x,
128
+ width,
129
+ y,
130
+ xOrigin,
131
+ height
132
+ }) => _extends({}, layout === 'vertical' ? {
133
+ y: yOrigin,
134
+ x,
135
+ height: 0,
136
+ width
137
+ } : {
138
+ y,
139
+ x: xOrigin,
140
+ height,
141
+ width: 0
142
+ });
143
+ const getInStyle = ({
144
+ x,
145
+ width,
146
+ y,
147
+ height
148
+ }) => ({
149
+ y,
150
+ x,
151
+ height,
152
+ width
153
+ });
154
+
155
+ /**
156
+ * Demos:
157
+ *
158
+ * - [Bars](https://mui.com/x/react-charts/bars/)
159
+ * - [Bar demonstration](https://mui.com/x/react-charts/bar-demo/)
160
+ * - [Stacking](https://mui.com/x/react-charts/stacking/)
161
+ *
162
+ * API:
163
+ *
164
+ * - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
165
+ */
166
+ function BarPlot(props) {
167
+ const completedData = useCompletedData();
168
+ const {
169
+ skipAnimation
170
+ } = props,
171
+ other = _objectWithoutPropertiesLoose(props, _excluded);
172
+ const transition = useTransition(completedData, {
173
+ keys: bar => `${bar.seriesId}-${bar.dataIndex}`,
174
+ from: getOutStyle,
175
+ leave: getOutStyle,
176
+ enter: getInStyle,
177
+ update: getInStyle,
178
+ immediate: skipAnimation
179
+ });
180
+ return /*#__PURE__*/_jsx(React.Fragment, {
181
+ children: transition((style, {
182
+ seriesId,
183
+ dataIndex,
184
+ color,
185
+ highlightScope
186
+ }) => /*#__PURE__*/_jsx(BarElement, _extends({
187
+ id: seriesId,
188
+ dataIndex: dataIndex,
189
+ highlightScope: highlightScope,
190
+ color: color
191
+ }, other, {
192
+ style: style
193
+ })))
115
194
  });
116
195
  }
117
196
  process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
@@ -119,6 +198,11 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
119
198
  // | These PropTypes are generated from the TypeScript type definitions |
120
199
  // | To update them edit the TypeScript types and run "yarn proptypes" |
121
200
  // ----------------------------------------------------------------------
201
+ /**
202
+ * If `true`, animations are skiped.
203
+ * @default false
204
+ */
205
+ skipAnimation: PropTypes.bool,
122
206
  /**
123
207
  * The props used for each component slot.
124
208
  * @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,