@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.4

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 (265) hide show
  1. package/BarChart/BarChart.d.ts +21 -5
  2. package/BarChart/BarChart.js +27 -7
  3. package/CHANGELOG.md +298 -23
  4. package/ChartsGrid/ChartsGrid.d.ts +30 -0
  5. package/ChartsGrid/ChartsGrid.js +128 -0
  6. package/ChartsGrid/chartsGridClasses.d.ts +13 -0
  7. package/ChartsGrid/chartsGridClasses.js +14 -0
  8. package/ChartsGrid/index.d.ts +2 -0
  9. package/ChartsGrid/index.js +27 -0
  10. package/ChartsGrid/package.json +6 -0
  11. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  12. package/ChartsSurface.js +6 -4
  13. package/ChartsTooltip/utils.js +1 -1
  14. package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
  15. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
  16. package/ChartsXAxis/ChartsXAxis.js +3 -3
  17. package/ChartsYAxis/ChartsYAxis.js +3 -3
  18. package/Gauge/Gauge.d.ts +13 -0
  19. package/Gauge/Gauge.js +154 -0
  20. package/Gauge/GaugeContainer.d.ts +17 -0
  21. package/Gauge/GaugeContainer.js +214 -0
  22. package/Gauge/GaugeProvider.d.ts +117 -0
  23. package/Gauge/GaugeProvider.js +99 -0
  24. package/Gauge/GaugeReferenceArc.d.ts +2 -0
  25. package/Gauge/GaugeReferenceArc.js +44 -0
  26. package/Gauge/GaugeValueArc.d.ts +2 -0
  27. package/Gauge/GaugeValueArc.js +51 -0
  28. package/Gauge/GaugeValueText.d.ts +15 -0
  29. package/Gauge/GaugeValueText.js +77 -0
  30. package/Gauge/gaugeClasses.d.ts +14 -0
  31. package/Gauge/gaugeClasses.js +15 -0
  32. package/Gauge/index.d.ts +7 -0
  33. package/Gauge/index.js +87 -0
  34. package/Gauge/package.json +6 -0
  35. package/Gauge/utils.d.ts +19 -0
  36. package/Gauge/utils.js +75 -0
  37. package/LineChart/LineChart.d.ts +24 -5
  38. package/LineChart/LineChart.js +31 -7
  39. package/PieChart/PieArc.d.ts +4 -4
  40. package/PieChart/PieArc.js +9 -9
  41. package/PieChart/PieArcLabelPlot.js +13 -13
  42. package/PieChart/PieChart.d.ts +22 -0
  43. package/PieChart/PieChart.js +22 -2
  44. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
  45. package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  46. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
  47. package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
  48. package/ScatterChart/ScatterChart.d.ts +18 -0
  49. package/ScatterChart/ScatterChart.js +25 -3
  50. package/SparkLineChart/SparkLineChart.js +0 -2
  51. package/context/CartesianContextProvider.d.ts +0 -8
  52. package/context/CartesianContextProvider.js +4 -89
  53. package/context/DrawingProvider.d.ts +2 -11
  54. package/context/DrawingProvider.js +10 -35
  55. package/context/HighlightProvider.js +3 -0
  56. package/context/InteractionProvider.js +3 -0
  57. package/context/SeriesContextProvider.js +3 -0
  58. package/context/index.d.ts +0 -2
  59. package/context/index.js +1 -15
  60. package/esm/BarChart/BarChart.js +27 -7
  61. package/esm/ChartsGrid/ChartsGrid.js +121 -0
  62. package/esm/ChartsGrid/chartsGridClasses.js +6 -0
  63. package/esm/ChartsGrid/index.js +2 -0
  64. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  65. package/esm/ChartsSurface.js +6 -4
  66. package/esm/ChartsTooltip/utils.js +2 -2
  67. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  68. package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
  69. package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
  70. package/esm/Gauge/Gauge.js +147 -0
  71. package/esm/Gauge/GaugeContainer.js +209 -0
  72. package/esm/Gauge/GaugeProvider.js +88 -0
  73. package/esm/Gauge/GaugeReferenceArc.js +35 -0
  74. package/esm/Gauge/GaugeValueArc.js +42 -0
  75. package/esm/Gauge/GaugeValueText.js +69 -0
  76. package/esm/Gauge/gaugeClasses.js +7 -0
  77. package/esm/Gauge/index.js +7 -0
  78. package/esm/Gauge/utils.js +68 -0
  79. package/esm/LineChart/LineChart.js +31 -7
  80. package/esm/PieChart/PieArc.js +9 -9
  81. package/esm/PieChart/PieArcLabelPlot.js +13 -13
  82. package/esm/PieChart/PieChart.js +22 -2
  83. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  84. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  85. package/esm/ScatterChart/ScatterChart.js +25 -3
  86. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  87. package/esm/context/CartesianContextProvider.js +3 -88
  88. package/esm/context/DrawingProvider.js +10 -36
  89. package/esm/context/HighlightProvider.js +3 -0
  90. package/esm/context/InteractionProvider.js +3 -0
  91. package/esm/context/SeriesContextProvider.js +3 -0
  92. package/esm/context/index.js +1 -2
  93. package/esm/hooks/useAxisEvents.js +2 -2
  94. package/esm/hooks/useTicks.js +2 -3
  95. package/esm/index.js +2 -0
  96. package/hooks/useAxisEvents.js +1 -1
  97. package/hooks/useTicks.d.ts +2 -3
  98. package/hooks/useTicks.js +2 -3
  99. package/index.d.ts +2 -0
  100. package/index.js +23 -1
  101. package/modern/BarChart/BarChart.js +27 -7
  102. package/modern/ChartsGrid/ChartsGrid.js +121 -0
  103. package/modern/ChartsGrid/chartsGridClasses.js +6 -0
  104. package/modern/ChartsGrid/index.js +2 -0
  105. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  106. package/modern/ChartsSurface.js +6 -4
  107. package/modern/ChartsTooltip/utils.js +2 -2
  108. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  109. package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
  110. package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
  111. package/modern/Gauge/Gauge.js +147 -0
  112. package/modern/Gauge/GaugeContainer.js +206 -0
  113. package/modern/Gauge/GaugeProvider.js +88 -0
  114. package/modern/Gauge/GaugeReferenceArc.js +35 -0
  115. package/modern/Gauge/GaugeValueArc.js +42 -0
  116. package/modern/Gauge/GaugeValueText.js +69 -0
  117. package/modern/Gauge/gaugeClasses.js +7 -0
  118. package/modern/Gauge/index.js +7 -0
  119. package/modern/Gauge/utils.js +68 -0
  120. package/modern/LineChart/LineChart.js +31 -7
  121. package/modern/PieChart/PieArc.js +9 -9
  122. package/modern/PieChart/PieArcLabelPlot.js +13 -13
  123. package/modern/PieChart/PieChart.js +22 -2
  124. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  125. package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  126. package/modern/ScatterChart/ScatterChart.js +25 -3
  127. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  128. package/modern/context/CartesianContextProvider.js +3 -88
  129. package/modern/context/DrawingProvider.js +10 -36
  130. package/modern/context/HighlightProvider.js +3 -0
  131. package/modern/context/InteractionProvider.js +3 -0
  132. package/modern/context/SeriesContextProvider.js +3 -0
  133. package/modern/context/index.js +1 -2
  134. package/modern/hooks/useAxisEvents.js +2 -2
  135. package/modern/hooks/useTicks.js +2 -3
  136. package/modern/index.js +3 -1
  137. package/package.json +4 -4
  138. package/legacy/BarChart/BarChart.js +0 -418
  139. package/legacy/BarChart/BarElement.js +0 -119
  140. package/legacy/BarChart/BarPlot.js +0 -232
  141. package/legacy/BarChart/extremums.js +0 -45
  142. package/legacy/BarChart/formatter.js +0 -78
  143. package/legacy/BarChart/index.js +0 -3
  144. package/legacy/BarChart/legend.js +0 -15
  145. package/legacy/ChartContainer/ChartContainer.js +0 -189
  146. package/legacy/ChartContainer/index.js +0 -1
  147. package/legacy/ChartsAxis/ChartsAxis.js +0 -215
  148. package/legacy/ChartsAxis/axisClasses.js +0 -5
  149. package/legacy/ChartsAxis/index.js +0 -2
  150. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
  151. package/legacy/ChartsAxisHighlight/index.js +0 -1
  152. package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
  153. package/legacy/ChartsClipPath/index.js +0 -1
  154. package/legacy/ChartsLegend/ChartsLegend.js +0 -100
  155. package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
  156. package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
  157. package/legacy/ChartsLegend/index.js +0 -4
  158. package/legacy/ChartsLegend/utils.js +0 -15
  159. package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
  160. package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
  161. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
  162. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
  163. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
  164. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
  165. package/legacy/ChartsReferenceLine/common.js +0 -19
  166. package/legacy/ChartsReferenceLine/index.js +0 -2
  167. package/legacy/ChartsSurface.js +0 -76
  168. package/legacy/ChartsText/ChartsText.js +0 -95
  169. package/legacy/ChartsText/index.js +0 -1
  170. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
  171. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
  172. package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
  173. package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
  174. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
  175. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
  176. package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
  177. package/legacy/ChartsTooltip/index.js +0 -6
  178. package/legacy/ChartsTooltip/utils.js +0 -103
  179. package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
  180. package/legacy/ChartsVoronoiHandler/index.js +0 -1
  181. package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
  182. package/legacy/ChartsXAxis/index.js +0 -1
  183. package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
  184. package/legacy/ChartsYAxis/index.js +0 -1
  185. package/legacy/LineChart/AnimatedArea.js +0 -102
  186. package/legacy/LineChart/AnimatedLine.js +0 -104
  187. package/legacy/LineChart/AreaElement.js +0 -112
  188. package/legacy/LineChart/AreaPlot.js +0 -149
  189. package/legacy/LineChart/LineChart.js +0 -426
  190. package/legacy/LineChart/LineElement.js +0 -112
  191. package/legacy/LineChart/LineHighlightElement.js +0 -79
  192. package/legacy/LineChart/LineHighlightPlot.js +0 -97
  193. package/legacy/LineChart/LinePlot.js +0 -144
  194. package/legacy/LineChart/MarkElement.js +0 -153
  195. package/legacy/LineChart/MarkPlot.js +0 -178
  196. package/legacy/LineChart/extremums.js +0 -54
  197. package/legacy/LineChart/formatter.js +0 -82
  198. package/legacy/LineChart/index.js +0 -11
  199. package/legacy/LineChart/legend.js +0 -15
  200. package/legacy/PieChart/PieArc.js +0 -103
  201. package/legacy/PieChart/PieArcLabel.js +0 -112
  202. package/legacy/PieChart/PieArcLabelPlot.js +0 -193
  203. package/legacy/PieChart/PieArcPlot.js +0 -180
  204. package/legacy/PieChart/PieChart.js +0 -382
  205. package/legacy/PieChart/PiePlot.js +0 -137
  206. package/legacy/PieChart/dataTransform/transition.js +0 -149
  207. package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
  208. package/legacy/PieChart/formatter.js +0 -55
  209. package/legacy/PieChart/index.js +0 -6
  210. package/legacy/PieChart/legend.js +0 -16
  211. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -255
  212. package/legacy/ResponsiveChartContainer/index.js +0 -1
  213. package/legacy/ScatterChart/Scatter.js +0 -110
  214. package/legacy/ScatterChart/ScatterChart.js +0 -370
  215. package/legacy/ScatterChart/ScatterPlot.js +0 -80
  216. package/legacy/ScatterChart/extremums.js +0 -39
  217. package/legacy/ScatterChart/formatter.js +0 -12
  218. package/legacy/ScatterChart/index.js +0 -3
  219. package/legacy/ScatterChart/legend.js +0 -15
  220. package/legacy/SparkLineChart/SparkLineChart.js +0 -266
  221. package/legacy/SparkLineChart/index.js +0 -1
  222. package/legacy/colorPalettes/colorPalettes.js +0 -15
  223. package/legacy/colorPalettes/index.js +0 -1
  224. package/legacy/constants.js +0 -8
  225. package/legacy/context/CartesianContextProvider.js +0 -327
  226. package/legacy/context/DrawingProvider.js +0 -74
  227. package/legacy/context/HighlightProvider.js +0 -56
  228. package/legacy/context/InteractionProvider.js +0 -81
  229. package/legacy/context/SeriesContextProvider.js +0 -74
  230. package/legacy/context/index.js +0 -2
  231. package/legacy/hooks/index.js +0 -2
  232. package/legacy/hooks/useAxisEvents.js +0 -120
  233. package/legacy/hooks/useChartDimensions.js +0 -18
  234. package/legacy/hooks/useDrawingArea.js +0 -21
  235. package/legacy/hooks/useInteractionItemProps.js +0 -71
  236. package/legacy/hooks/useMounted.js +0 -21
  237. package/legacy/hooks/useReducedMotion.js +0 -27
  238. package/legacy/hooks/useScale.js +0 -33
  239. package/legacy/hooks/useTicks.js +0 -66
  240. package/legacy/index.js +0 -31
  241. package/legacy/internals/components/AxisSharedComponents.js +0 -25
  242. package/legacy/internals/defaultizeColor.js +0 -17
  243. package/legacy/internals/defaultizeValueFormatter.js +0 -12
  244. package/legacy/internals/domUtils.js +0 -121
  245. package/legacy/internals/geometry.js +0 -37
  246. package/legacy/internals/getCurve.js +0 -39
  247. package/legacy/internals/getScale.js +0 -17
  248. package/legacy/internals/getWordsByLines.js +0 -15
  249. package/legacy/internals/isBandScale.js +0 -3
  250. package/legacy/internals/stackSeries.js +0 -92
  251. package/legacy/internals/useAnimatedPath.js +0 -32
  252. package/legacy/internals/utils.js +0 -52
  253. package/legacy/models/axis.js +0 -6
  254. package/legacy/models/helpers.js +0 -1
  255. package/legacy/models/index.js +0 -4
  256. package/legacy/models/layout.js +0 -1
  257. package/legacy/models/seriesType/bar.js +0 -1
  258. package/legacy/models/seriesType/common.js +0 -1
  259. package/legacy/models/seriesType/config.js +0 -1
  260. package/legacy/models/seriesType/index.js +0 -5
  261. package/legacy/models/seriesType/line.js +0 -1
  262. package/legacy/models/seriesType/pie.js +0 -1
  263. package/legacy/models/seriesType/scatter.js +0 -1
  264. package/legacy/models/stacking.js +0 -1
  265. package/legacy/themeAugmentation/index.js +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.0.0-beta.2",
3
+ "version": "7.0.0-beta.4",
4
4
  "description": "The community edition of the charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.23.9",
32
- "@mui/base": "^5.0.0-beta.34",
33
- "@mui/system": "^5.15.7",
34
- "@mui/utils": "^5.15.7",
32
+ "@mui/base": "^5.0.0-beta.36",
33
+ "@mui/system": "^5.15.9",
34
+ "@mui/utils": "^5.15.9",
35
35
  "@react-spring/rafz": "^9.7.3",
36
36
  "@react-spring/web": "^9.7.3",
37
37
  "clsx": "^2.1.0",
@@ -1,418 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
- import * as React from 'react';
4
- import useId from '@mui/utils/useId';
5
- import PropTypes from 'prop-types';
6
- import { BarPlot } from './BarPlot';
7
- import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
8
- import { ChartsAxis } from '../ChartsAxis';
9
- import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
10
- import { ChartsTooltip } from '../ChartsTooltip';
11
- import { ChartsLegend } from '../ChartsLegend';
12
- import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
13
- import { ChartsClipPath } from '../ChartsClipPath';
14
- import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { jsxs as _jsxs } from "react/jsx-runtime";
17
- /**
18
- * Demos:
19
- *
20
- * - [Bars](https://mui.com/x/react-charts/bars/)
21
- * - [Bar demonstration](https://mui.com/x/react-charts/bar-demo/)
22
- * - [Stacking](https://mui.com/x/react-charts/stacking/)
23
- *
24
- * API:
25
- *
26
- * - [BarChart API](https://mui.com/x/api/charts/bar-chart/)
27
- */
28
- var BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
29
- var xAxis = props.xAxis,
30
- yAxis = props.yAxis,
31
- series = props.series,
32
- width = props.width,
33
- height = props.height,
34
- margin = props.margin,
35
- colors = props.colors,
36
- dataset = props.dataset,
37
- sx = props.sx,
38
- layout = props.layout,
39
- tooltip = props.tooltip,
40
- axisHighlight = props.axisHighlight,
41
- legend = props.legend,
42
- topAxis = props.topAxis,
43
- leftAxis = props.leftAxis,
44
- rightAxis = props.rightAxis,
45
- bottomAxis = props.bottomAxis,
46
- skipAnimation = props.skipAnimation,
47
- onItemClick = props.onItemClick,
48
- onAxisClick = props.onAxisClick,
49
- children = props.children,
50
- slots = props.slots,
51
- slotProps = props.slotProps;
52
- var id = useId();
53
- var clipPathId = "".concat(id, "-clip-path");
54
- var hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(function (item) {
55
- return item.layout === 'horizontal';
56
- });
57
- var defaultAxisConfig = {
58
- scaleType: 'band',
59
- data: Array.from({
60
- length: Math.max.apply(Math, _toConsumableArray(series.map(function (s) {
61
- var _ref, _s$data;
62
- return ((_ref = (_s$data = s.data) != null ? _s$data : dataset) != null ? _ref : []).length;
63
- })))
64
- }, function (_, index) {
65
- return index;
66
- })
67
- };
68
- var defaultizedAxisHighlight = _extends({}, hasHorizontalSeries ? {
69
- y: 'band'
70
- } : {
71
- x: 'band'
72
- }, axisHighlight);
73
- return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
74
- ref: ref,
75
- series: series.map(function (s) {
76
- return _extends({
77
- type: 'bar'
78
- }, s, {
79
- layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
80
- });
81
- }),
82
- width: width,
83
- height: height,
84
- margin: margin,
85
- xAxis: xAxis != null ? xAxis : hasHorizontalSeries ? undefined : [_extends({
86
- id: DEFAULT_X_AXIS_KEY
87
- }, defaultAxisConfig)],
88
- yAxis: yAxis != null ? yAxis : hasHorizontalSeries ? [_extends({
89
- id: DEFAULT_Y_AXIS_KEY
90
- }, defaultAxisConfig)] : undefined,
91
- colors: colors,
92
- dataset: dataset,
93
- sx: sx,
94
- disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
95
- children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
96
- onAxisClick: onAxisClick
97
- }), /*#__PURE__*/_jsx("g", {
98
- clipPath: "url(#".concat(clipPathId, ")"),
99
- children: /*#__PURE__*/_jsx(BarPlot, {
100
- slots: slots,
101
- slotProps: slotProps,
102
- skipAnimation: skipAnimation,
103
- onItemClick: onItemClick
104
- })
105
- }), /*#__PURE__*/_jsx(ChartsAxis, {
106
- topAxis: topAxis,
107
- leftAxis: leftAxis,
108
- rightAxis: rightAxis,
109
- bottomAxis: bottomAxis,
110
- slots: slots,
111
- slotProps: slotProps
112
- }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
113
- slots: slots,
114
- slotProps: slotProps
115
- })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
116
- slots: slots,
117
- slotProps: slotProps
118
- })), /*#__PURE__*/_jsx(ChartsClipPath, {
119
- id: clipPathId
120
- }), children]
121
- });
122
- });
123
- process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
124
- // ----------------------------- Warning --------------------------------
125
- // | These PropTypes are generated from the TypeScript type definitions |
126
- // | To update them edit the TypeScript types and run "yarn proptypes" |
127
- // ----------------------------------------------------------------------
128
- /**
129
- * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
130
- * The two properties accept the following values:
131
- * - 'none': display nothing.
132
- * - 'line': display a line at the current mouse position.
133
- * - 'band': display a band at the current mouse position. Only available with band scale.
134
- */
135
- axisHighlight: PropTypes.shape({
136
- x: PropTypes.oneOf(['band', 'line', 'none']),
137
- y: PropTypes.oneOf(['band', 'line', 'none'])
138
- }),
139
- /**
140
- * Indicate which axis to display the bottom of the charts.
141
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
142
- * @default xAxisIds[0] The id of the first provided axis
143
- */
144
- bottomAxis: PropTypes.oneOfType([PropTypes.shape({
145
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
146
- classes: PropTypes.object,
147
- disableLine: PropTypes.bool,
148
- disableTicks: PropTypes.bool,
149
- fill: PropTypes.string,
150
- label: PropTypes.string,
151
- labelFontSize: PropTypes.number,
152
- labelStyle: PropTypes.object,
153
- position: PropTypes.oneOf(['bottom', 'top']),
154
- slotProps: PropTypes.object,
155
- slots: PropTypes.object,
156
- stroke: PropTypes.string,
157
- tickFontSize: PropTypes.number,
158
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
159
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
160
- tickLabelStyle: PropTypes.object,
161
- tickMaxStep: PropTypes.number,
162
- tickMinStep: PropTypes.number,
163
- tickNumber: PropTypes.number,
164
- tickSize: PropTypes.number
165
- }), PropTypes.string]),
166
- children: PropTypes.node,
167
- className: PropTypes.string,
168
- /**
169
- * Color palette used to colorize multiple series.
170
- * @default blueberryTwilightPalette
171
- */
172
- colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
173
- /**
174
- * An array of objects that can be used to populate series and axes data using their `dataKey` property.
175
- */
176
- dataset: PropTypes.arrayOf(PropTypes.object),
177
- desc: PropTypes.string,
178
- /**
179
- * If `true`, the charts will not listen to the mouse move event.
180
- * It might break interactive features, but will improve performance.
181
- * @default false
182
- */
183
- disableAxisListener: PropTypes.bool,
184
- /**
185
- * The height of the chart in px. If not defined, it takes the height of the parent element.
186
- * @default undefined
187
- */
188
- height: PropTypes.number,
189
- layout: PropTypes.oneOf(['horizontal', 'vertical']),
190
- /**
191
- * Indicate which axis to display the left of the charts.
192
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
193
- * @default yAxisIds[0] The id of the first provided axis
194
- */
195
- leftAxis: PropTypes.oneOfType([PropTypes.shape({
196
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
197
- classes: PropTypes.object,
198
- disableLine: PropTypes.bool,
199
- disableTicks: PropTypes.bool,
200
- fill: PropTypes.string,
201
- label: PropTypes.string,
202
- labelFontSize: PropTypes.number,
203
- labelStyle: PropTypes.object,
204
- position: PropTypes.oneOf(['left', 'right']),
205
- slotProps: PropTypes.object,
206
- slots: PropTypes.object,
207
- stroke: PropTypes.string,
208
- tickFontSize: PropTypes.number,
209
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
210
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
211
- tickLabelStyle: PropTypes.object,
212
- tickMaxStep: PropTypes.number,
213
- tickMinStep: PropTypes.number,
214
- tickNumber: PropTypes.number,
215
- tickSize: PropTypes.number
216
- }), PropTypes.string]),
217
- /**
218
- * @deprecated Consider using `slotProps.legend` instead.
219
- */
220
- legend: PropTypes.shape({
221
- classes: PropTypes.object,
222
- direction: PropTypes.oneOf(['column', 'row']),
223
- hidden: PropTypes.bool,
224
- position: PropTypes.shape({
225
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
226
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
227
- }),
228
- slotProps: PropTypes.object,
229
- slots: PropTypes.object
230
- }),
231
- /**
232
- * The margin between the SVG and the drawing area.
233
- * It's used for leaving some space for extra information such as the x- and y-axis or legend.
234
- * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
235
- * @default object Depends on the charts type.
236
- */
237
- margin: PropTypes.shape({
238
- bottom: PropTypes.number,
239
- left: PropTypes.number,
240
- right: PropTypes.number,
241
- top: PropTypes.number
242
- }),
243
- /**
244
- * The function called for onClick events.
245
- * The second argument contains information about all line/bar elements at the current mouse position.
246
- * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
247
- * @param {null | AxisData} data The data about the clicked axis and items associated with it.
248
- */
249
- onAxisClick: PropTypes.func,
250
- /**
251
- * Callback fired when a bar item is clicked.
252
- * @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
253
- * @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
254
- */
255
- onItemClick: PropTypes.func,
256
- /**
257
- * Indicate which axis to display the right of the charts.
258
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
259
- * @default null
260
- */
261
- rightAxis: PropTypes.oneOfType([PropTypes.shape({
262
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
263
- classes: PropTypes.object,
264
- disableLine: PropTypes.bool,
265
- disableTicks: PropTypes.bool,
266
- fill: PropTypes.string,
267
- label: PropTypes.string,
268
- labelFontSize: PropTypes.number,
269
- labelStyle: PropTypes.object,
270
- position: PropTypes.oneOf(['left', 'right']),
271
- slotProps: PropTypes.object,
272
- slots: PropTypes.object,
273
- stroke: PropTypes.string,
274
- tickFontSize: PropTypes.number,
275
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
276
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
277
- tickLabelStyle: PropTypes.object,
278
- tickMaxStep: PropTypes.number,
279
- tickMinStep: PropTypes.number,
280
- tickNumber: PropTypes.number,
281
- tickSize: PropTypes.number
282
- }), PropTypes.string]),
283
- series: PropTypes.arrayOf(PropTypes.object).isRequired,
284
- /**
285
- * If `true`, animations are skipped.
286
- * @default false
287
- */
288
- skipAnimation: PropTypes.bool,
289
- /**
290
- * The props used for each component slot.
291
- * @default {}
292
- */
293
- slotProps: PropTypes.object,
294
- /**
295
- * Overridable component slots.
296
- * @default {}
297
- */
298
- slots: PropTypes.object,
299
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
300
- title: PropTypes.string,
301
- tooltip: PropTypes.shape({
302
- axisContent: PropTypes.elementType,
303
- classes: PropTypes.object,
304
- itemContent: PropTypes.elementType,
305
- slotProps: PropTypes.object,
306
- slots: PropTypes.object,
307
- trigger: PropTypes.oneOf(['axis', 'item', 'none'])
308
- }),
309
- /**
310
- * Indicate which axis to display the top of the charts.
311
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
312
- * @default null
313
- */
314
- topAxis: PropTypes.oneOfType([PropTypes.shape({
315
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
316
- classes: PropTypes.object,
317
- disableLine: PropTypes.bool,
318
- disableTicks: PropTypes.bool,
319
- fill: PropTypes.string,
320
- label: PropTypes.string,
321
- labelFontSize: PropTypes.number,
322
- labelStyle: PropTypes.object,
323
- position: PropTypes.oneOf(['bottom', 'top']),
324
- slotProps: PropTypes.object,
325
- slots: PropTypes.object,
326
- stroke: PropTypes.string,
327
- tickFontSize: PropTypes.number,
328
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
329
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
330
- tickLabelStyle: PropTypes.object,
331
- tickMaxStep: PropTypes.number,
332
- tickMinStep: PropTypes.number,
333
- tickNumber: PropTypes.number,
334
- tickSize: PropTypes.number
335
- }), PropTypes.string]),
336
- viewBox: PropTypes.shape({
337
- height: PropTypes.number,
338
- width: PropTypes.number,
339
- x: PropTypes.number,
340
- y: PropTypes.number
341
- }),
342
- /**
343
- * The width of the chart in px. If not defined, it takes the width of the parent element.
344
- * @default undefined
345
- */
346
- width: PropTypes.number,
347
- /**
348
- * The configuration of the x-axes.
349
- * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
350
- */
351
- xAxis: PropTypes.arrayOf(PropTypes.shape({
352
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
353
- classes: PropTypes.object,
354
- data: PropTypes.array,
355
- dataKey: PropTypes.string,
356
- disableLine: PropTypes.bool,
357
- disableTicks: PropTypes.bool,
358
- fill: PropTypes.string,
359
- hideTooltip: PropTypes.bool,
360
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
361
- label: PropTypes.string,
362
- labelFontSize: PropTypes.number,
363
- labelStyle: PropTypes.object,
364
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
365
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
366
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
367
- reverse: PropTypes.bool,
368
- scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
369
- slotProps: PropTypes.object,
370
- slots: PropTypes.object,
371
- stroke: PropTypes.string,
372
- tickFontSize: PropTypes.number,
373
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
374
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
375
- tickLabelStyle: PropTypes.object,
376
- tickMaxStep: PropTypes.number,
377
- tickMinStep: PropTypes.number,
378
- tickNumber: PropTypes.number,
379
- tickSize: PropTypes.number,
380
- valueFormatter: PropTypes.func
381
- })),
382
- /**
383
- * The configuration of the y-axes.
384
- * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
385
- */
386
- yAxis: PropTypes.arrayOf(PropTypes.shape({
387
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
388
- classes: PropTypes.object,
389
- data: PropTypes.array,
390
- dataKey: PropTypes.string,
391
- disableLine: PropTypes.bool,
392
- disableTicks: PropTypes.bool,
393
- fill: PropTypes.string,
394
- hideTooltip: PropTypes.bool,
395
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
396
- label: PropTypes.string,
397
- labelFontSize: PropTypes.number,
398
- labelStyle: PropTypes.object,
399
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
400
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
401
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
402
- reverse: PropTypes.bool,
403
- scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
404
- slotProps: PropTypes.object,
405
- slots: PropTypes.object,
406
- stroke: PropTypes.string,
407
- tickFontSize: PropTypes.number,
408
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
409
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
410
- tickLabelStyle: PropTypes.object,
411
- tickMaxStep: PropTypes.number,
412
- tickMinStep: PropTypes.number,
413
- tickNumber: PropTypes.number,
414
- tickSize: PropTypes.number,
415
- valueFormatter: PropTypes.func
416
- }))
417
- } : void 0;
418
- export { BarChart };
@@ -1,119 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style", "onClick"];
4
- import * as React from 'react';
5
- import PropTypes from 'prop-types';
6
- import composeClasses from '@mui/utils/composeClasses';
7
- import { useSlotProps } from '@mui/base/utils';
8
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
9
- import { styled } from '@mui/material/styles';
10
- import { color as d3Color } from 'd3-color';
11
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
12
- import { animated } from '@react-spring/web';
13
- import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
14
- import { InteractionContext } from '../context/InteractionProvider';
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- export function getBarElementUtilityClass(slot) {
17
- return generateUtilityClass('MuiBarElement', slot);
18
- }
19
- export var barElementClasses = generateUtilityClasses('MuiBarElement', ['root']);
20
- var useUtilityClasses = function useUtilityClasses(ownerState) {
21
- var classes = ownerState.classes,
22
- id = ownerState.id;
23
- var slots = {
24
- root: ['root', "series-".concat(id)]
25
- };
26
- return composeClasses(slots, getBarElementUtilityClass, classes);
27
- };
28
- export var BarElementPath = styled(animated.rect, {
29
- name: 'MuiBarElement',
30
- slot: 'Root',
31
- overridesResolver: function overridesResolver(_, styles) {
32
- return styles.root;
33
- }
34
- })(function (_ref) {
35
- var ownerState = _ref.ownerState;
36
- return {
37
- stroke: 'none',
38
- shapeRendering: 'crispEdges',
39
- fill: ownerState.isHighlighted ? d3Color(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
40
- transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
41
- opacity: ownerState.isFaded && 0.3 || 1
42
- };
43
- });
44
- function BarElement(props) {
45
- var _slots$bar;
46
- var id = props.id,
47
- dataIndex = props.dataIndex,
48
- innerClasses = props.classes,
49
- color = props.color,
50
- highlightScope = props.highlightScope,
51
- slots = props.slots,
52
- slotProps = props.slotProps,
53
- style = props.style,
54
- onClick = props.onClick,
55
- other = _objectWithoutProperties(props, _excluded);
56
- var getInteractionItemProps = useInteractionItemProps(highlightScope);
57
- var _React$useContext = React.useContext(InteractionContext),
58
- item = _React$useContext.item;
59
- var isHighlighted = getIsHighlighted(item, {
60
- type: 'bar',
61
- seriesId: id,
62
- dataIndex: dataIndex
63
- }, highlightScope);
64
- var isFaded = !isHighlighted && getIsFaded(item, {
65
- type: 'bar',
66
- seriesId: id,
67
- dataIndex: dataIndex
68
- }, highlightScope);
69
- var ownerState = {
70
- id: id,
71
- dataIndex: dataIndex,
72
- classes: innerClasses,
73
- color: color,
74
- isFaded: isFaded,
75
- isHighlighted: isHighlighted
76
- };
77
- var classes = useUtilityClasses(ownerState);
78
- var Bar = (_slots$bar = slots == null ? void 0 : slots.bar) != null ? _slots$bar : BarElementPath;
79
- var barProps = useSlotProps({
80
- elementType: Bar,
81
- externalSlotProps: slotProps == null ? void 0 : slotProps.bar,
82
- additionalProps: _extends({}, other, getInteractionItemProps({
83
- type: 'bar',
84
- seriesId: id,
85
- dataIndex: dataIndex
86
- }), {
87
- style: style,
88
- className: classes.root,
89
- onClick: onClick,
90
- cursor: onClick ? 'pointer' : 'unset'
91
- }),
92
- ownerState: ownerState
93
- });
94
- return /*#__PURE__*/_jsx(Bar, _extends({}, barProps));
95
- }
96
- process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
97
- // ----------------------------- Warning --------------------------------
98
- // | These PropTypes are generated from the TypeScript type definitions |
99
- // | To update them edit the TypeScript types and run "yarn proptypes" |
100
- // ----------------------------------------------------------------------
101
- classes: PropTypes.object,
102
- dataIndex: PropTypes.number.isRequired,
103
- highlightScope: PropTypes.shape({
104
- faded: PropTypes.oneOf(['global', 'none', 'series']),
105
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
106
- }),
107
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
108
- /**
109
- * The props used for each component slot.
110
- * @default {}
111
- */
112
- slotProps: PropTypes.object,
113
- /**
114
- * Overridable component slots.
115
- * @default {}
116
- */
117
- slots: PropTypes.object
118
- } : void 0;
119
- export { BarElement };