@mui/x-charts 6.18.0 → 6.18.2

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 (182) hide show
  1. package/BarChart/BarChart.d.ts +7 -0
  2. package/BarChart/BarChart.js +41 -4
  3. package/CHANGELOG.md +116 -5
  4. package/ChartsAxis/ChartsAxis.js +5 -5
  5. package/ChartsAxis/axisClasses.d.ts +2 -2
  6. package/ChartsLegend/ChartsLegend.d.ts +1 -0
  7. package/ChartsLegend/ChartsLegend.js +1 -1
  8. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  9. package/ChartsLegend/chartsLegendClasses.js +2 -2
  10. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
  11. package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
  12. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
  13. package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
  14. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
  15. package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
  16. package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
  17. package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
  18. package/ChartsReferenceLine/common.d.ts +41 -0
  19. package/ChartsReferenceLine/common.js +27 -0
  20. package/ChartsReferenceLine/index.d.ts +2 -0
  21. package/ChartsReferenceLine/index.js +27 -0
  22. package/ChartsReferenceLine/package.json +6 -0
  23. package/ChartsSurface.d.ts +11 -0
  24. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
  25. package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  26. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +1 -1
  27. package/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  28. package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
  29. package/ChartsTooltip/ChartsTooltip.js +13 -5
  30. package/ChartsTooltip/ChartsTooltipTable.js +3 -3
  31. package/ChartsTooltip/chartsTooltipClasses.d.ts +21 -0
  32. package/ChartsTooltip/chartsTooltipClasses.js +12 -0
  33. package/ChartsTooltip/index.d.ts +1 -0
  34. package/ChartsTooltip/index.js +11 -0
  35. package/ChartsTooltip/utils.d.ts +1 -1
  36. package/ChartsTooltip/utils.js +2 -2
  37. package/ChartsXAxis/ChartsXAxis.js +9 -5
  38. package/ChartsYAxis/ChartsYAxis.js +9 -5
  39. package/LineChart/LineChart.d.ts +7 -0
  40. package/LineChart/LineChart.js +41 -4
  41. package/LineChart/LineHighlightPlot.js +1 -1
  42. package/LineChart/MarkPlot.js +2 -1
  43. package/PieChart/PieArc.d.ts +5 -2
  44. package/PieChart/PieArc.js +17 -2
  45. package/PieChart/PieArcLabel.d.ts +1 -1
  46. package/PieChart/PieArcLabel.js +5 -10
  47. package/PieChart/PieArcLabelPlot.js +2 -2
  48. package/PieChart/PieArcPlot.js +2 -2
  49. package/PieChart/PieChart.js +34 -4
  50. package/PieChart/index.d.ts +4 -2
  51. package/PieChart/index.js +37 -27
  52. package/ResponsiveChartContainer/index.d.ts +13 -3
  53. package/ScatterChart/ScatterChart.js +34 -4
  54. package/SparkLineChart/SparkLineChart.js +22 -0
  55. package/context/CartesianContextProvider.d.ts +21 -1
  56. package/context/CartesianContextProvider.js +11 -0
  57. package/context/DrawingProvider.d.ts +18 -0
  58. package/context/DrawingProvider.js +6 -0
  59. package/context/HighlightProvider.d.ts +17 -0
  60. package/context/InteractionProvider.d.ts +6 -0
  61. package/context/SeriesContextProvider.d.ts +5 -0
  62. package/esm/BarChart/BarChart.js +41 -4
  63. package/esm/ChartsAxis/ChartsAxis.js +6 -5
  64. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  65. package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
  66. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  67. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  68. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  69. package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  70. package/esm/ChartsReferenceLine/common.js +20 -0
  71. package/esm/ChartsReferenceLine/index.js +2 -0
  72. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  73. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  74. package/esm/ChartsTooltip/ChartsTooltip.js +15 -7
  75. package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -3
  76. package/esm/ChartsTooltip/chartsTooltipClasses.js +5 -0
  77. package/esm/ChartsTooltip/index.js +2 -1
  78. package/esm/ChartsTooltip/utils.js +1 -1
  79. package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
  80. package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
  81. package/esm/LineChart/LineChart.js +41 -4
  82. package/esm/LineChart/LineHighlightPlot.js +1 -1
  83. package/esm/LineChart/MarkPlot.js +2 -1
  84. package/esm/PieChart/PieArc.js +18 -2
  85. package/esm/PieChart/PieArcLabel.js +7 -11
  86. package/esm/PieChart/PieArcLabelPlot.js +1 -1
  87. package/esm/PieChart/PieArcPlot.js +1 -1
  88. package/esm/PieChart/PieChart.js +34 -4
  89. package/esm/PieChart/index.js +2 -2
  90. package/esm/ScatterChart/ScatterChart.js +34 -4
  91. package/esm/SparkLineChart/SparkLineChart.js +22 -0
  92. package/esm/context/CartesianContextProvider.js +11 -0
  93. package/esm/context/DrawingProvider.js +6 -0
  94. package/esm/index.js +1 -0
  95. package/esm/internals/geometry.js +2 -2
  96. package/hooks/useScale.d.ts +2 -2
  97. package/index.d.ts +1 -0
  98. package/index.js +12 -1
  99. package/internals/components/ChartsText.d.ts +1 -1
  100. package/internals/geometry.d.ts +2 -2
  101. package/internals/geometry.js +2 -2
  102. package/internals/isBandScale.d.ts +3 -1
  103. package/internals/utils.d.ts +5 -0
  104. package/legacy/BarChart/BarChart.js +41 -4
  105. package/legacy/ChartsAxis/ChartsAxis.js +6 -5
  106. package/legacy/ChartsLegend/ChartsLegend.js +2 -2
  107. package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
  108. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  109. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  110. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  111. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  112. package/legacy/ChartsReferenceLine/common.js +20 -0
  113. package/legacy/ChartsReferenceLine/index.js +2 -0
  114. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  115. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  116. package/legacy/ChartsTooltip/ChartsTooltip.js +20 -12
  117. package/legacy/ChartsTooltip/ChartsTooltipTable.js +3 -3
  118. package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
  119. package/legacy/ChartsTooltip/index.js +2 -1
  120. package/legacy/ChartsTooltip/utils.js +1 -1
  121. package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
  122. package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
  123. package/legacy/LineChart/LineChart.js +41 -4
  124. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  125. package/legacy/LineChart/MarkPlot.js +2 -1
  126. package/legacy/PieChart/PieArc.js +18 -2
  127. package/legacy/PieChart/PieArcLabel.js +7 -11
  128. package/legacy/PieChart/PieArcLabelPlot.js +1 -1
  129. package/legacy/PieChart/PieArcPlot.js +1 -1
  130. package/legacy/PieChart/PieChart.js +34 -4
  131. package/legacy/PieChart/index.js +2 -2
  132. package/legacy/ScatterChart/ScatterChart.js +34 -4
  133. package/legacy/SparkLineChart/SparkLineChart.js +22 -0
  134. package/legacy/context/CartesianContextProvider.js +11 -0
  135. package/legacy/context/DrawingProvider.js +6 -0
  136. package/legacy/index.js +2 -1
  137. package/legacy/internals/geometry.js +2 -2
  138. package/models/axis.d.ts +33 -13
  139. package/models/layout.d.ts +6 -0
  140. package/models/seriesType/common.d.ts +16 -0
  141. package/modern/BarChart/BarChart.js +41 -4
  142. package/modern/ChartsAxis/ChartsAxis.js +5 -5
  143. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  144. package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
  145. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  146. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
  147. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
  148. package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  149. package/modern/ChartsReferenceLine/common.js +20 -0
  150. package/modern/ChartsReferenceLine/index.js +2 -0
  151. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  152. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  153. package/modern/ChartsTooltip/ChartsTooltip.js +15 -7
  154. package/modern/ChartsTooltip/ChartsTooltipTable.js +3 -3
  155. package/modern/ChartsTooltip/chartsTooltipClasses.js +5 -0
  156. package/modern/ChartsTooltip/index.js +2 -1
  157. package/modern/ChartsTooltip/utils.js +1 -1
  158. package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
  159. package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
  160. package/modern/LineChart/LineChart.js +41 -4
  161. package/modern/LineChart/LineHighlightPlot.js +1 -1
  162. package/modern/LineChart/MarkPlot.js +2 -1
  163. package/modern/PieChart/PieArc.js +18 -2
  164. package/modern/PieChart/PieArcLabel.js +7 -11
  165. package/modern/PieChart/PieArcLabelPlot.js +1 -1
  166. package/modern/PieChart/PieArcPlot.js +1 -1
  167. package/modern/PieChart/PieChart.js +34 -4
  168. package/modern/PieChart/index.js +2 -2
  169. package/modern/ScatterChart/ScatterChart.js +34 -4
  170. package/modern/SparkLineChart/SparkLineChart.js +22 -0
  171. package/modern/context/CartesianContextProvider.js +11 -0
  172. package/modern/context/DrawingProvider.js +6 -0
  173. package/modern/index.js +2 -1
  174. package/modern/internals/geometry.js +2 -2
  175. package/package.json +1 -1
  176. package/themeAugmentation/components.d.ts +1 -0
  177. package/themeAugmentation/overrides.d.ts +2 -0
  178. package/ChartsTooltip/tooltipClasses.d.ts +0 -13
  179. package/ChartsTooltip/tooltipClasses.js +0 -12
  180. package/esm/ChartsTooltip/tooltipClasses.js +0 -5
  181. package/legacy/ChartsTooltip/tooltipClasses.js +0 -5
  182. package/modern/ChartsTooltip/tooltipClasses.js +0 -5
@@ -119,6 +119,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
119
119
  // | These PropTypes are generated from the TypeScript type definitions |
120
120
  // | To update them edit the TypeScript types and run "yarn proptypes" |
121
121
  // ----------------------------------------------------------------------
122
+ /**
123
+ * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
124
+ * The two properties accept the following values:
125
+ * - 'none': display nothing.
126
+ * - 'line': display a line at the current mouse position.
127
+ * - 'band': display a band at the current mouse position. Only available with band scale.
128
+ */
122
129
  axisHighlight: _propTypes.default.shape({
123
130
  x: _propTypes.default.oneOf(['band', 'line', 'none']),
124
131
  y: _propTypes.default.oneOf(['band', 'line', 'none'])
@@ -129,7 +136,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
129
136
  * @default xAxisIds[0] The id of the first provided axis
130
137
  */
131
138
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
132
- axisId: _propTypes.default.string.isRequired,
139
+ axisId: _propTypes.default.string,
133
140
  classes: _propTypes.default.object,
134
141
  disableLine: _propTypes.default.bool,
135
142
  disableTicks: _propTypes.default.bool,
@@ -156,13 +163,25 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
156
163
  * Color palette used to colorize multiple series.
157
164
  */
158
165
  colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
166
+ /**
167
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
168
+ */
159
169
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
160
170
  desc: _propTypes.default.string,
171
+ /**
172
+ * If `true`, the charts will not listen to the mouse move event.
173
+ * It might break interactive features, but will improve performance.
174
+ * @default false
175
+ */
161
176
  disableAxisListener: _propTypes.default.bool,
162
177
  /**
163
178
  * If `true`, render the line highlight item.
164
179
  */
165
180
  disableLineItemHighlight: _propTypes.default.bool,
181
+ /**
182
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
183
+ * @default undefined
184
+ */
166
185
  height: _propTypes.default.number,
167
186
  /**
168
187
  * Indicate which axis to display the left of the charts.
@@ -170,7 +189,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
170
189
  * @default yAxisIds[0] The id of the first provided axis
171
190
  */
172
191
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
173
- axisId: _propTypes.default.string.isRequired,
192
+ axisId: _propTypes.default.string,
174
193
  classes: _propTypes.default.object,
175
194
  disableLine: _propTypes.default.bool,
176
195
  disableTicks: _propTypes.default.bool,
@@ -205,6 +224,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
205
224
  slotProps: _propTypes.default.object,
206
225
  slots: _propTypes.default.object
207
226
  }),
227
+ /**
228
+ * The margin between the SVG and the drawing area.
229
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
230
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
231
+ * @default object Depends on the charts type.
232
+ */
208
233
  margin: _propTypes.default.shape({
209
234
  bottom: _propTypes.default.number,
210
235
  left: _propTypes.default.number,
@@ -217,7 +242,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
217
242
  * @default null
218
243
  */
219
244
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
220
- axisId: _propTypes.default.string.isRequired,
245
+ axisId: _propTypes.default.string,
221
246
  classes: _propTypes.default.object,
222
247
  disableLine: _propTypes.default.bool,
223
248
  disableTicks: _propTypes.default.bool,
@@ -287,7 +312,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
287
312
  * @default null
288
313
  */
289
314
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
290
- axisId: _propTypes.default.string.isRequired,
315
+ axisId: _propTypes.default.string,
291
316
  classes: _propTypes.default.object,
292
317
  disableLine: _propTypes.default.bool,
293
318
  disableTicks: _propTypes.default.bool,
@@ -314,7 +339,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
314
339
  x: _propTypes.default.number,
315
340
  y: _propTypes.default.number
316
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
+ */
317
346
  width: _propTypes.default.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
+ */
318
351
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
319
352
  axisId: _propTypes.default.string,
320
353
  classes: _propTypes.default.object,
@@ -345,6 +378,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
345
378
  tickSize: _propTypes.default.number,
346
379
  valueFormatter: _propTypes.default.func
347
380
  })),
381
+ /**
382
+ * The configuration of the y-axes.
383
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
384
+ */
348
385
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
349
386
  axisId: _propTypes.default.string,
350
387
  classes: _propTypes.default.object,
@@ -81,7 +81,7 @@ function LineHighlightPlot(props) {
81
81
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
82
82
  }
83
83
  const x = xScale(xData[highlightedIndex]);
84
- const y = yScale(stackedData[highlightedIndex][1]);
84
+ const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
85
85
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
86
86
  id: seriesId,
87
87
  color: series[seriesId].color,
@@ -134,7 +134,8 @@ function MarkPlot(props) {
134
134
  shape: "circle",
135
135
  color: series[seriesId].color,
136
136
  x: x,
137
- y: y,
137
+ y: y // Don't knwo why TS don't get from the filter that y can't be null
138
+ ,
138
139
  highlightScope: series[seriesId].highlightScope
139
140
  }, slotProps?.mark), `${seriesId}-${index}`);
140
141
  });
@@ -30,5 +30,8 @@ export type PieArcProps = PieArcOwnerState & React.ComponentPropsWithoutRef<'pat
30
30
  highlightScope?: Partial<HighlightScope>;
31
31
  onClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>) => void;
32
32
  };
33
- export default function PieArc(props: PieArcProps): React.JSX.Element;
34
- export {};
33
+ declare function PieArc(props: PieArcProps): React.JSX.Element;
34
+ declare namespace PieArc {
35
+ var propTypes: any;
36
+ }
37
+ export { PieArc };
@@ -4,12 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = PieArc;
7
+ exports.PieArc = PieArc;
8
8
  exports.getPieArcUtilityClass = getPieArcUtilityClass;
9
9
  exports.pieArcClasses = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
14
  var _d3Shape = require("d3-shape");
14
15
  var _web = require("@react-spring/web");
15
16
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
@@ -93,4 +94,18 @@ function PieArc(props) {
93
94
  seriesId: id,
94
95
  dataIndex
95
96
  })));
96
- }
97
+ }
98
+ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
99
+ // ----------------------------- Warning --------------------------------
100
+ // | These PropTypes are generated from the TypeScript type definitions |
101
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
102
+ // ----------------------------------------------------------------------
103
+ classes: _propTypes.default.object,
104
+ dataIndex: _propTypes.default.number.isRequired,
105
+ highlightScope: _propTypes.default.shape({
106
+ faded: _propTypes.default.oneOf(['global', 'none', 'series']),
107
+ highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
108
+ }),
109
+ isFaded: _propTypes.default.bool.isRequired,
110
+ isHighlighted: _propTypes.default.bool.isRequired
111
+ } : void 0;
@@ -32,4 +32,4 @@ declare function PieArcLabel(props: PieArcLabelProps): React.JSX.Element;
32
32
  declare namespace PieArcLabel {
33
33
  var propTypes: any;
34
34
  }
35
- export default PieArcLabel;
35
+ export { PieArcLabel };
@@ -4,15 +4,15 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = PieArcLabel;
7
+ exports.PieArcLabel = PieArcLabel;
8
8
  exports.getPieArcLabelUtilityClass = getPieArcLabelUtilityClass;
9
9
  exports.pieArcLabelClasses = void 0;
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
14
  var _web = require("@react-spring/web");
14
15
  var _d3Shape = require("d3-shape");
15
- var _propTypes = _interopRequireDefault(require("prop-types"));
16
16
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
17
17
  var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
18
18
  var _styles = require("@mui/material/styles");
@@ -109,12 +109,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
109
109
  // | To update them edit the TypeScript types and run "yarn proptypes" |
110
110
  // ----------------------------------------------------------------------
111
111
  classes: _propTypes.default.object,
112
- cornerRadius: _propTypes.default.number,
113
- dataIndex: _propTypes.default.number.isRequired,
114
- highlightScope: _propTypes.default.shape({
115
- faded: _propTypes.default.oneOf(['global', 'none', 'series']),
116
- highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
117
- }),
118
- innerRadius: _propTypes.default.number,
119
- outerRadius: _propTypes.default.number.isRequired
112
+ formattedArcLabel: _propTypes.default.string,
113
+ isFaded: _propTypes.default.bool.isRequired,
114
+ isHighlighted: _propTypes.default.bool.isRequired
120
115
  } : void 0;
@@ -11,7 +11,7 @@ var React = _interopRequireWildcard(require("react"));
11
11
  var _web = require("@react-spring/web");
12
12
  var _transition = require("./dataTransform/transition");
13
13
  var _useTransformData = require("./dataTransform/useTransformData");
14
- var _PieArcLabel = _interopRequireDefault(require("./PieArcLabel"));
14
+ var _PieArcLabel = require("./PieArcLabel");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
16
16
  const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
17
17
  _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
@@ -68,7 +68,7 @@ function PieArcLabelPlot(props) {
68
68
  if (data.length === 0) {
69
69
  return null;
70
70
  }
71
- const ArcLabel = slots?.pieArcLabel ?? _PieArcLabel.default;
71
+ const ArcLabel = slots?.pieArcLabel ?? _PieArcLabel.PieArcLabel;
72
72
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
73
73
  children: transition((_ref, item) => {
74
74
  let {
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
9
9
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _web = require("@react-spring/web");
12
- var _PieArc = _interopRequireDefault(require("./PieArc"));
12
+ var _PieArc = require("./PieArc");
13
13
  var _transition = require("./dataTransform/transition");
14
14
  var _useTransformData = require("./dataTransform/useTransformData");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
@@ -53,7 +53,7 @@ function PieArcPlot(props) {
53
53
  if (data.length === 0) {
54
54
  return null;
55
55
  }
56
- const Arc = slots?.pieArc ?? _PieArc.default;
56
+ const Arc = slots?.pieArc ?? _PieArc.PieArc;
57
57
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", (0, _extends2.default)({}, other, {
58
58
  children: transition((_ref, item, _, index) => {
59
59
  let {
@@ -119,7 +119,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
119
119
  * @default xAxisIds[0] The id of the first provided axis
120
120
  */
121
121
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
122
- axisId: _propTypes.default.string.isRequired,
122
+ axisId: _propTypes.default.string,
123
123
  classes: _propTypes.default.object,
124
124
  disableLine: _propTypes.default.bool,
125
125
  disableTicks: _propTypes.default.bool,
@@ -146,9 +146,21 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
146
146
  * Color palette used to colorize multiple series.
147
147
  */
148
148
  colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
149
+ /**
150
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
151
+ */
149
152
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
150
153
  desc: _propTypes.default.string,
154
+ /**
155
+ * If `true`, the charts will not listen to the mouse move event.
156
+ * It might break interactive features, but will improve performance.
157
+ * @default false
158
+ */
151
159
  disableAxisListener: _propTypes.default.bool,
160
+ /**
161
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
162
+ * @default undefined
163
+ */
152
164
  height: _propTypes.default.number,
153
165
  /**
154
166
  * Indicate which axis to display the left of the charts.
@@ -156,7 +168,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
156
168
  * @default yAxisIds[0] The id of the first provided axis
157
169
  */
158
170
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
159
- axisId: _propTypes.default.string.isRequired,
171
+ axisId: _propTypes.default.string,
160
172
  classes: _propTypes.default.object,
161
173
  disableLine: _propTypes.default.bool,
162
174
  disableTicks: _propTypes.default.bool,
@@ -191,6 +203,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
191
203
  slotProps: _propTypes.default.object,
192
204
  slots: _propTypes.default.object
193
205
  }),
206
+ /**
207
+ * The margin between the SVG and the drawing area.
208
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
209
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
210
+ * @default object Depends on the charts type.
211
+ */
194
212
  margin: _propTypes.default.shape({
195
213
  bottom: _propTypes.default.number,
196
214
  left: _propTypes.default.number,
@@ -204,7 +222,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
204
222
  * @default null
205
223
  */
206
224
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
207
- axisId: _propTypes.default.string.isRequired,
225
+ axisId: _propTypes.default.string,
208
226
  classes: _propTypes.default.object,
209
227
  disableLine: _propTypes.default.bool,
210
228
  disableTicks: _propTypes.default.bool,
@@ -295,7 +313,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
295
313
  * @default null
296
314
  */
297
315
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
298
- axisId: _propTypes.default.string.isRequired,
316
+ axisId: _propTypes.default.string,
299
317
  classes: _propTypes.default.object,
300
318
  disableLine: _propTypes.default.bool,
301
319
  disableTicks: _propTypes.default.bool,
@@ -322,7 +340,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
322
340
  x: _propTypes.default.number,
323
341
  y: _propTypes.default.number
324
342
  }),
343
+ /**
344
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
345
+ * @default undefined
346
+ */
325
347
  width: _propTypes.default.number,
348
+ /**
349
+ * The configuration of the x-axes.
350
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
351
+ */
326
352
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
327
353
  axisId: _propTypes.default.string,
328
354
  classes: _propTypes.default.object,
@@ -353,6 +379,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
353
379
  tickSize: _propTypes.default.number,
354
380
  valueFormatter: _propTypes.default.func
355
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
+ */
356
386
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
357
387
  axisId: _propTypes.default.string,
358
388
  classes: _propTypes.default.object,
@@ -1,4 +1,6 @@
1
1
  export { PiePlot } from './PiePlot';
2
2
  export { PieChart } from './PieChart';
3
- export * from './PieArc';
4
- export * from './PieArcLabel';
3
+ export { PieArcLabel, getPieArcLabelUtilityClass, pieArcLabelClasses } from './PieArcLabel';
4
+ export type { PieArcLabelClassKey, PieArcLabelClasses, PieArcLabelProps } from './PieArcLabel';
5
+ export { PieArc, getPieArcUtilityClass, pieArcClasses } from './PieArc';
6
+ export type { PieArcClassKey, PieArcClasses, PieArcProps } from './PieArc';
package/PieChart/index.js CHANGED
@@ -3,10 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _exportNames = {
7
- PiePlot: true,
8
- PieChart: true
9
- };
6
+ Object.defineProperty(exports, "PieArc", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _PieArc.PieArc;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "PieArcLabel", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _PieArcLabel.PieArcLabel;
16
+ }
17
+ });
10
18
  Object.defineProperty(exports, "PieChart", {
11
19
  enumerable: true,
12
20
  get: function () {
@@ -19,29 +27,31 @@ Object.defineProperty(exports, "PiePlot", {
19
27
  return _PiePlot.PiePlot;
20
28
  }
21
29
  });
30
+ Object.defineProperty(exports, "getPieArcLabelUtilityClass", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _PieArcLabel.getPieArcLabelUtilityClass;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "getPieArcUtilityClass", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _PieArc.getPieArcUtilityClass;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "pieArcClasses", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _PieArc.pieArcClasses;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "pieArcLabelClasses", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _PieArcLabel.pieArcLabelClasses;
52
+ }
53
+ });
22
54
  var _PiePlot = require("./PiePlot");
23
55
  var _PieChart = require("./PieChart");
24
- var _PieArc = require("./PieArc");
25
- Object.keys(_PieArc).forEach(function (key) {
26
- if (key === "default" || key === "__esModule") return;
27
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
- if (key in exports && exports[key] === _PieArc[key]) return;
29
- Object.defineProperty(exports, key, {
30
- enumerable: true,
31
- get: function () {
32
- return _PieArc[key];
33
- }
34
- });
35
- });
36
56
  var _PieArcLabel = require("./PieArcLabel");
37
- Object.keys(_PieArcLabel).forEach(function (key) {
38
- if (key === "default" || key === "__esModule") return;
39
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
40
- if (key in exports && exports[key] === _PieArcLabel[key]) return;
41
- Object.defineProperty(exports, key, {
42
- enumerable: true,
43
- get: function () {
44
- return _PieArcLabel[key];
45
- }
46
- });
47
- });
57
+ var _PieArc = require("./PieArc");
@@ -1,5 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { ChartContainerProps } from '../ChartContainer';
3
- import { MakeOptional } from '../models/helpers';
4
- export type ResponsiveChartContainerProps = MakeOptional<ChartContainerProps, 'width' | 'height'>;
5
- export declare const ResponsiveChartContainer: React.ForwardRefExoticComponent<Omit<ChartContainerProps, "height" | "width"> & Partial<Pick<ChartContainerProps, "height" | "width">> & React.RefAttributes<unknown>>;
3
+ export interface ResponsiveChartContainerProps extends Omit<ChartContainerProps, 'width' | 'height'> {
4
+ /**
5
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
6
+ * @default undefined
7
+ */
8
+ width?: number;
9
+ /**
10
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
11
+ * @default undefined
12
+ */
13
+ height?: number;
14
+ }
15
+ export declare const ResponsiveChartContainer: React.ForwardRefExoticComponent<ResponsiveChartContainerProps & React.RefAttributes<unknown>>;
@@ -96,7 +96,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
96
96
  * @default xAxisIds[0] The id of the first provided axis
97
97
  */
98
98
  bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
99
- axisId: _propTypes.default.string.isRequired,
99
+ axisId: _propTypes.default.string,
100
100
  classes: _propTypes.default.object,
101
101
  disableLine: _propTypes.default.bool,
102
102
  disableTicks: _propTypes.default.bool,
@@ -123,9 +123,21 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
123
123
  * Color palette used to colorize multiple series.
124
124
  */
125
125
  colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
126
+ /**
127
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
128
+ */
126
129
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
127
130
  desc: _propTypes.default.string,
131
+ /**
132
+ * If `true`, the charts will not listen to the mouse move event.
133
+ * It might break interactive features, but will improve performance.
134
+ * @default false
135
+ */
128
136
  disableAxisListener: _propTypes.default.bool,
137
+ /**
138
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
139
+ * @default undefined
140
+ */
129
141
  height: _propTypes.default.number,
130
142
  /**
131
143
  * Indicate which axis to display the left of the charts.
@@ -133,7 +145,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
133
145
  * @default yAxisIds[0] The id of the first provided axis
134
146
  */
135
147
  leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
136
- axisId: _propTypes.default.string.isRequired,
148
+ axisId: _propTypes.default.string,
137
149
  classes: _propTypes.default.object,
138
150
  disableLine: _propTypes.default.bool,
139
151
  disableTicks: _propTypes.default.bool,
@@ -168,6 +180,12 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
168
180
  slotProps: _propTypes.default.object,
169
181
  slots: _propTypes.default.object
170
182
  }),
183
+ /**
184
+ * The margin between the SVG and the drawing area.
185
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
186
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
187
+ * @default object Depends on the charts type.
188
+ */
171
189
  margin: _propTypes.default.shape({
172
190
  bottom: _propTypes.default.number,
173
191
  left: _propTypes.default.number,
@@ -180,7 +198,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
180
198
  * @default null
181
199
  */
182
200
  rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
183
- axisId: _propTypes.default.string.isRequired,
201
+ axisId: _propTypes.default.string,
184
202
  classes: _propTypes.default.object,
185
203
  disableLine: _propTypes.default.bool,
186
204
  disableTicks: _propTypes.default.bool,
@@ -246,7 +264,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
246
264
  * @default null
247
265
  */
248
266
  topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
249
- axisId: _propTypes.default.string.isRequired,
267
+ axisId: _propTypes.default.string,
250
268
  classes: _propTypes.default.object,
251
269
  disableLine: _propTypes.default.bool,
252
270
  disableTicks: _propTypes.default.bool,
@@ -273,7 +291,15 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
273
291
  x: _propTypes.default.number,
274
292
  y: _propTypes.default.number
275
293
  }),
294
+ /**
295
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
296
+ * @default undefined
297
+ */
276
298
  width: _propTypes.default.number,
299
+ /**
300
+ * The configuration of the x-axes.
301
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
302
+ */
277
303
  xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
278
304
  axisId: _propTypes.default.string,
279
305
  classes: _propTypes.default.object,
@@ -304,6 +330,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
304
330
  tickSize: _propTypes.default.number,
305
331
  valueFormatter: _propTypes.default.func
306
332
  })),
333
+ /**
334
+ * The configuration of the y-axes.
335
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
336
+ */
307
337
  yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
308
338
  axisId: _propTypes.default.string,
309
339
  classes: _propTypes.default.object,
@@ -137,10 +137,28 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
137
137
  * Data to plot.
138
138
  */
139
139
  data: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
140
+ /**
141
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
142
+ */
140
143
  dataset: _propTypes.default.arrayOf(_propTypes.default.object),
141
144
  desc: _propTypes.default.string,
145
+ /**
146
+ * If `true`, the charts will not listen to the mouse move event.
147
+ * It might break interactive features, but will improve performance.
148
+ * @default false
149
+ */
142
150
  disableAxisListener: _propTypes.default.bool,
151
+ /**
152
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
153
+ * @default undefined
154
+ */
143
155
  height: _propTypes.default.number,
156
+ /**
157
+ * The margin between the SVG and the drawing area.
158
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
159
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
160
+ * @default object Depends on the charts type.
161
+ */
144
162
  margin: _propTypes.default.shape({
145
163
  bottom: _propTypes.default.number,
146
164
  left: _propTypes.default.number,
@@ -196,6 +214,10 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
196
214
  x: _propTypes.default.number,
197
215
  y: _propTypes.default.number
198
216
  }),
217
+ /**
218
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
219
+ * @default undefined
220
+ */
199
221
  width: _propTypes.default.number,
200
222
  /**
201
223
  * The xAxis configuration.
@@ -4,8 +4,19 @@ import { DEFAULT_X_AXIS_KEY } from '../constants';
4
4
  import { DatasetType } from '../models/seriesType/config';
5
5
  import { MakeOptional } from '../models/helpers';
6
6
  export type CartesianContextProviderProps = {
7
+ /**
8
+ * The configuration of the x-axes.
9
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
10
+ */
7
11
  xAxis?: MakeOptional<AxisConfig, 'id'>[];
12
+ /**
13
+ * The configuration of the y-axes.
14
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
15
+ */
8
16
  yAxis?: MakeOptional<AxisConfig, 'id'>[];
17
+ /**
18
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
19
+ */
9
20
  dataset?: DatasetType;
10
21
  children: React.ReactNode;
11
22
  };
@@ -14,15 +25,24 @@ type DefaultizedAxisConfig = {
14
25
  };
15
26
  export declare const CartesianContext: React.Context<{
16
27
  /**
17
- * Mapping from axis key to scaling function
28
+ * Mapping from x-axis key to scaling configuration.
18
29
  */
19
30
  xAxis: {
20
31
  DEFAULT_X_AXIS_KEY: AxisDefaultized;
21
32
  } & DefaultizedAxisConfig;
33
+ /**
34
+ * Mapping from y-axis key to scaling configuration.
35
+ */
22
36
  yAxis: {
23
37
  DEFAULT_X_AXIS_KEY: AxisDefaultized;
24
38
  } & DefaultizedAxisConfig;
39
+ /**
40
+ * The x-axes IDs sorted by order they got provided.
41
+ */
25
42
  xAxisIds: string[];
43
+ /**
44
+ * The y-axes IDs sorted by order they got provided.
45
+ */
26
46
  yAxisIds: string[];
27
47
  }>;
28
48
  /**