@mui/x-charts-pro 8.0.0-alpha.13 → 8.0.0-alpha.14

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 (162) hide show
  1. package/BarChartPro/BarChartPro.d.ts +2 -1
  2. package/CHANGELOG.md +131 -0
  3. package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
  4. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
  5. package/FunnelChart/FunnelChart.d.ts +37 -0
  6. package/FunnelChart/FunnelChart.js +218 -0
  7. package/FunnelChart/FunnelPlot.d.ts +16 -0
  8. package/FunnelChart/FunnelPlot.js +191 -0
  9. package/FunnelChart/FunnelSection.d.ts +15 -0
  10. package/FunnelChart/FunnelSection.js +62 -0
  11. package/FunnelChart/categoryAxis.types.d.ts +24 -0
  12. package/FunnelChart/categoryAxis.types.js +5 -0
  13. package/FunnelChart/funnel.types.d.ts +124 -0
  14. package/FunnelChart/funnel.types.js +5 -0
  15. package/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
  16. package/FunnelChart/funnelPlotSlots.types.js +5 -0
  17. package/FunnelChart/funnelSectionClasses.d.ts +13 -0
  18. package/FunnelChart/funnelSectionClasses.js +28 -0
  19. package/FunnelChart/funnelSlots.types.d.ts +19 -0
  20. package/FunnelChart/funnelSlots.types.js +5 -0
  21. package/FunnelChart/funnelStepCurve.d.ts +4 -0
  22. package/FunnelChart/funnelStepCurve.js +74 -0
  23. package/FunnelChart/index.d.ts +7 -0
  24. package/FunnelChart/index.js +59 -0
  25. package/FunnelChart/labelUtils.d.ts +42 -0
  26. package/FunnelChart/labelUtils.js +174 -0
  27. package/FunnelChart/seriesConfig/extremums.d.ts +3 -0
  28. package/FunnelChart/seriesConfig/extremums.js +50 -0
  29. package/FunnelChart/seriesConfig/getColor.d.ts +3 -0
  30. package/FunnelChart/seriesConfig/getColor.js +10 -0
  31. package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  32. package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +18 -0
  33. package/FunnelChart/seriesConfig/index.d.ts +2 -0
  34. package/FunnelChart/seriesConfig/index.js +22 -0
  35. package/FunnelChart/seriesConfig/legend.d.ts +3 -0
  36. package/FunnelChart/seriesConfig/legend.js +31 -0
  37. package/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
  38. package/FunnelChart/seriesConfig/seriesProcessor.js +96 -0
  39. package/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
  40. package/FunnelChart/seriesConfig/tooltip.js +36 -0
  41. package/FunnelChart/useFunnelChartProps.d.ts +30 -0
  42. package/FunnelChart/useFunnelChartProps.js +168 -0
  43. package/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  44. package/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +15 -0
  45. package/Heatmap/seriesConfig/index.js +3 -1
  46. package/LineChartPro/LineChartPro.d.ts +2 -1
  47. package/esm/BarChartPro/BarChartPro.d.ts +2 -1
  48. package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
  49. package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
  50. package/esm/FunnelChart/FunnelChart.d.ts +37 -0
  51. package/esm/FunnelChart/FunnelChart.js +212 -0
  52. package/esm/FunnelChart/FunnelPlot.d.ts +16 -0
  53. package/esm/FunnelChart/FunnelPlot.js +184 -0
  54. package/esm/FunnelChart/FunnelSection.d.ts +15 -0
  55. package/esm/FunnelChart/FunnelSection.js +56 -0
  56. package/esm/FunnelChart/categoryAxis.types.d.ts +24 -0
  57. package/esm/FunnelChart/categoryAxis.types.js +1 -0
  58. package/esm/FunnelChart/funnel.types.d.ts +124 -0
  59. package/esm/FunnelChart/funnel.types.js +1 -0
  60. package/esm/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
  61. package/esm/FunnelChart/funnelPlotSlots.types.js +1 -0
  62. package/esm/FunnelChart/funnelSectionClasses.d.ts +13 -0
  63. package/esm/FunnelChart/funnelSectionClasses.js +20 -0
  64. package/esm/FunnelChart/funnelSlots.types.d.ts +19 -0
  65. package/esm/FunnelChart/funnelSlots.types.js +1 -0
  66. package/esm/FunnelChart/funnelStepCurve.d.ts +4 -0
  67. package/esm/FunnelChart/funnelStepCurve.js +67 -0
  68. package/esm/FunnelChart/index.d.ts +7 -0
  69. package/esm/FunnelChart/index.js +5 -0
  70. package/esm/FunnelChart/labelUtils.d.ts +42 -0
  71. package/esm/FunnelChart/labelUtils.js +166 -0
  72. package/esm/FunnelChart/seriesConfig/extremums.d.ts +3 -0
  73. package/esm/FunnelChart/seriesConfig/extremums.js +42 -0
  74. package/esm/FunnelChart/seriesConfig/getColor.d.ts +3 -0
  75. package/esm/FunnelChart/seriesConfig/getColor.js +4 -0
  76. package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  77. package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
  78. package/esm/FunnelChart/seriesConfig/index.d.ts +2 -0
  79. package/esm/FunnelChart/seriesConfig/index.js +15 -0
  80. package/esm/FunnelChart/seriesConfig/legend.d.ts +3 -0
  81. package/esm/FunnelChart/seriesConfig/legend.js +25 -0
  82. package/esm/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
  83. package/esm/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
  84. package/esm/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
  85. package/esm/FunnelChart/seriesConfig/tooltip.js +29 -0
  86. package/esm/FunnelChart/useFunnelChartProps.d.ts +30 -0
  87. package/esm/FunnelChart/useFunnelChartProps.js +161 -0
  88. package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  89. package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
  90. package/esm/Heatmap/seriesConfig/index.js +3 -1
  91. package/esm/LineChartPro/LineChartPro.d.ts +2 -1
  92. package/esm/hooks/useFunnelSeries.d.ts +33 -0
  93. package/esm/hooks/useFunnelSeries.js +42 -0
  94. package/esm/index.d.ts +3 -1
  95. package/esm/index.js +4 -2
  96. package/esm/internals/plugins/allPlugins.d.ts +3 -3
  97. package/esm/internals/plugins/allPlugins.js +2 -2
  98. package/esm/internals/utils/releaseInfo.js +1 -1
  99. package/esm/typeOverloads/modules.d.ts +13 -2
  100. package/hooks/useFunnelSeries.d.ts +33 -0
  101. package/hooks/useFunnelSeries.js +48 -0
  102. package/index.d.ts +3 -1
  103. package/index.js +23 -1
  104. package/internals/plugins/allPlugins.d.ts +3 -3
  105. package/internals/plugins/allPlugins.js +1 -1
  106. package/internals/utils/releaseInfo.js +1 -1
  107. package/modern/BarChartPro/BarChartPro.d.ts +2 -1
  108. package/modern/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
  109. package/modern/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
  110. package/modern/FunnelChart/FunnelChart.d.ts +37 -0
  111. package/modern/FunnelChart/FunnelChart.js +212 -0
  112. package/modern/FunnelChart/FunnelPlot.d.ts +16 -0
  113. package/modern/FunnelChart/FunnelPlot.js +184 -0
  114. package/modern/FunnelChart/FunnelSection.d.ts +15 -0
  115. package/modern/FunnelChart/FunnelSection.js +56 -0
  116. package/modern/FunnelChart/categoryAxis.types.d.ts +24 -0
  117. package/modern/FunnelChart/categoryAxis.types.js +1 -0
  118. package/modern/FunnelChart/funnel.types.d.ts +124 -0
  119. package/modern/FunnelChart/funnel.types.js +1 -0
  120. package/modern/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
  121. package/modern/FunnelChart/funnelPlotSlots.types.js +1 -0
  122. package/modern/FunnelChart/funnelSectionClasses.d.ts +13 -0
  123. package/modern/FunnelChart/funnelSectionClasses.js +20 -0
  124. package/modern/FunnelChart/funnelSlots.types.d.ts +19 -0
  125. package/modern/FunnelChart/funnelSlots.types.js +1 -0
  126. package/modern/FunnelChart/funnelStepCurve.d.ts +4 -0
  127. package/modern/FunnelChart/funnelStepCurve.js +67 -0
  128. package/modern/FunnelChart/index.d.ts +7 -0
  129. package/modern/FunnelChart/index.js +5 -0
  130. package/modern/FunnelChart/labelUtils.d.ts +42 -0
  131. package/modern/FunnelChart/labelUtils.js +166 -0
  132. package/modern/FunnelChart/seriesConfig/extremums.d.ts +3 -0
  133. package/modern/FunnelChart/seriesConfig/extremums.js +42 -0
  134. package/modern/FunnelChart/seriesConfig/getColor.d.ts +3 -0
  135. package/modern/FunnelChart/seriesConfig/getColor.js +4 -0
  136. package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  137. package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
  138. package/modern/FunnelChart/seriesConfig/index.d.ts +2 -0
  139. package/modern/FunnelChart/seriesConfig/index.js +15 -0
  140. package/modern/FunnelChart/seriesConfig/legend.d.ts +3 -0
  141. package/modern/FunnelChart/seriesConfig/legend.js +25 -0
  142. package/modern/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
  143. package/modern/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
  144. package/modern/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
  145. package/modern/FunnelChart/seriesConfig/tooltip.js +29 -0
  146. package/modern/FunnelChart/useFunnelChartProps.d.ts +30 -0
  147. package/modern/FunnelChart/useFunnelChartProps.js +161 -0
  148. package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
  149. package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
  150. package/modern/Heatmap/seriesConfig/index.js +3 -1
  151. package/modern/LineChartPro/LineChartPro.d.ts +2 -1
  152. package/modern/hooks/useFunnelSeries.d.ts +33 -0
  153. package/modern/hooks/useFunnelSeries.js +42 -0
  154. package/modern/index.d.ts +3 -1
  155. package/modern/index.js +4 -2
  156. package/modern/internals/plugins/allPlugins.d.ts +3 -3
  157. package/modern/internals/plugins/allPlugins.js +2 -2
  158. package/modern/internals/utils/releaseInfo.js +1 -1
  159. package/modern/typeOverloads/modules.d.ts +13 -2
  160. package/package.json +4 -4
  161. package/tsconfig.build.tsbuildinfo +1 -1
  162. package/typeOverloads/modules.d.ts +13 -2
@@ -0,0 +1,89 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ const createPoint = ({
3
+ main,
4
+ other,
5
+ inverse,
6
+ useBandWidth,
7
+ stackOffset
8
+ }) => inverse ? {
9
+ x: other,
10
+ y: main,
11
+ useBandWidth,
12
+ stackOffset
13
+ } : {
14
+ x: main,
15
+ y: other,
16
+ useBandWidth,
17
+ stackOffset
18
+ };
19
+ const seriesProcessor = params => {
20
+ const {
21
+ seriesOrder,
22
+ series
23
+ } = params;
24
+ const completedSeries = {};
25
+ const isHorizontal = seriesOrder.some(seriesId => series[seriesId].layout === 'horizontal');
26
+ seriesOrder.forEach(seriesId => {
27
+ const currentSeries = series[seriesId];
28
+ completedSeries[seriesId] = _extends({
29
+ labelMarkType: 'square',
30
+ layout: isHorizontal ? 'horizontal' : 'vertical',
31
+ valueFormatter: item => item == null ? '' : item.value.toLocaleString()
32
+ }, currentSeries, {
33
+ data: currentSeries.data.map((v, i) => _extends({
34
+ id: `${seriesId}-funnel-item-${v.id ?? i}`
35
+ }, v)),
36
+ dataPoints: []
37
+ });
38
+ const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
39
+ completedSeries[seriesId].dataPoints = completedSeries[seriesId].data.map((item, dataIndex, array) => {
40
+ // Main = main axis, Other = other axis
41
+ // For horizontal layout, main is y, other is x
42
+ // For vertical layout, main is x, other is y
43
+ const currentMaxMain = item.value;
44
+ const nextDataIndex = dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
45
+ const nextMaxMain = array[nextDataIndex].value ?? 0;
46
+ const nextMaxOther = 0;
47
+ const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
48
+ const stackOffset = stackOffsets[dataIndex];
49
+ return [
50
+ // Top right (vertical) or Top left (horizontal)
51
+ createPoint({
52
+ main: currentMaxMain,
53
+ other: currentMaxOther,
54
+ inverse: isHorizontal,
55
+ useBandWidth: false,
56
+ stackOffset
57
+ }),
58
+ // Bottom right (vertical) or Top right (horizontal)
59
+ createPoint({
60
+ main: nextMaxMain,
61
+ other: nextMaxOther,
62
+ inverse: isHorizontal,
63
+ useBandWidth: true,
64
+ stackOffset
65
+ }),
66
+ // Bottom left (vertical) or Bottom right (horizontal)
67
+ createPoint({
68
+ main: -nextMaxMain,
69
+ other: nextMaxOther,
70
+ inverse: isHorizontal,
71
+ useBandWidth: true,
72
+ stackOffset
73
+ }),
74
+ // Top left (vertical) or Bottom left (horizontal)
75
+ createPoint({
76
+ main: -currentMaxMain,
77
+ other: currentMaxOther,
78
+ inverse: isHorizontal,
79
+ useBandWidth: false,
80
+ stackOffset
81
+ })];
82
+ });
83
+ });
84
+ return {
85
+ seriesOrder,
86
+ series: completedSeries
87
+ };
88
+ };
89
+ export default seriesProcessor;
@@ -0,0 +1,3 @@
1
+ import { TooltipGetter } from '@mui/x-charts/internals';
2
+ declare const tooltipGetter: TooltipGetter<'funnel'>;
3
+ export default tooltipGetter;
@@ -0,0 +1,29 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import { getLabel } from '@mui/x-charts/internals';
3
+ const tooltipGetter = params => {
4
+ const {
5
+ series,
6
+ getColor,
7
+ identifier
8
+ } = params;
9
+ if (!identifier || identifier.dataIndex === undefined) {
10
+ return null;
11
+ }
12
+ const point = series.data[identifier.dataIndex];
13
+ const label = getLabel(point.label, 'tooltip');
14
+ const value = _extends({}, point, {
15
+ label
16
+ });
17
+ const formattedValue = series.valueFormatter(value, {
18
+ dataIndex: identifier.dataIndex
19
+ });
20
+ return {
21
+ identifier,
22
+ color: getColor(identifier.dataIndex),
23
+ label,
24
+ value,
25
+ formattedValue,
26
+ markType: point.labelMarkType ?? series.labelMarkType
27
+ };
28
+ };
29
+ export default tooltipGetter;
@@ -0,0 +1,30 @@
1
+ import { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
2
+ import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
3
+ import { ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
4
+ import { ChartsClipPathProps } from '@mui/x-charts/ChartsClipPath';
5
+ import { ChartsWrapperProps } from '@mui/x-charts/internals';
6
+ import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
7
+ import { FunnelPlotProps } from "./FunnelPlot.js";
8
+ import type { FunnelChartProps } from './FunnelChart';
9
+ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
10
+ /**
11
+ * A helper function that extracts FunnelChartProps from the input props
12
+ * and returns an object with props for the children components of FunnelChart.
13
+ *
14
+ * @param props The input props for FunnelChart
15
+ * @returns An object with props for the children components of FunnelChart
16
+ */
17
+ export declare const useFunnelChartProps: (props: FunnelChartProps) => {
18
+ chartContainerProps: ChartContainerProProps<"funnel">;
19
+ funnelPlotProps: FunnelPlotProps;
20
+ overlayProps: ChartsOverlayProps;
21
+ chartsAxisProps: ChartsAxisProps;
22
+ legendProps: ChartsLegendSlotExtension;
23
+ clipPathGroupProps: {
24
+ clipPath: string;
25
+ };
26
+ clipPathProps: ChartsClipPathProps;
27
+ chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
28
+ axisHighlightProps: ChartsAxisHighlightProps;
29
+ children: import("react").ReactNode;
30
+ };
@@ -0,0 +1,161 @@
1
+ 'use client';
2
+
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
+ import _extends from "@babel/runtime/helpers/esm/extends";
5
+ const _excluded = ["categoryAxis", "series", "width", "height", "margin", "colors", "sx", "children", "slots", "slotProps", "skipAnimation", "loading", "onItemClick", "highlightedItem", "onHighlightChange", "className", "hideLegend", "axisHighlight", "apiRef"];
6
+ import { DEFAULT_MARGINS, DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
7
+ import useId from '@mui/utils/useId';
8
+ import { defaultizeMargin } from '@mui/x-charts/internals';
9
+ import { warnOnce } from '@mui/x-internals/warning';
10
+ function getCategoryAxisConfig(categoryAxis, series, isHorizontal, direction) {
11
+ const maxSeriesLength = Math.max(...series.map(s => (s.data ?? []).length), 0);
12
+ const maxSeriesValue = Array.from({
13
+ length: maxSeriesLength
14
+ }, (_, index) => series.reduce((a, s) => a + (s.data?.[index]?.value ?? 0), 0));
15
+ if (process.env.NODE_ENV !== 'production') {
16
+ if ((categoryAxis?.position === 'left' || categoryAxis?.position === 'right') && isHorizontal || (categoryAxis?.position === 'top' || categoryAxis?.position === 'bottom') && !isHorizontal) {
17
+ warnOnce([`MUI X: the categoryAxis position is set to '${categoryAxis.position}' but the series layout is ${isHorizontal ? 'horizontal' : 'vertical'}.`, `Ensure that the categoryAxis position is set to '${isHorizontal ? 'top' : 'left'}' or '${isHorizontal ? 'bottom' : 'right'}' for ${isHorizontal ? 'horizontal' : 'vertical'} layout.\n`], 'warning');
18
+ }
19
+ }
20
+ const side = isHorizontal ? 'bottom' : 'left';
21
+ const categoryValues = _extends({
22
+ id: direction === 'x' ? DEFAULT_X_AXIS_KEY : DEFAULT_Y_AXIS_KEY
23
+ }, categoryAxis, categoryAxis?.size ? {
24
+ [isHorizontal ? 'height' : 'width']: categoryAxis.size
25
+ } : {}, {
26
+ position: categoryAxis?.position ?? (categoryAxis?.categories ? side : 'none')
27
+ });
28
+
29
+ // If the scaleType is not defined or is 'band', our job is simple.
30
+ if (!categoryAxis?.scaleType || categoryAxis.scaleType === 'band') {
31
+ return _extends({
32
+ scaleType: 'band',
33
+ categoryGapRatio: 0,
34
+ // Use the categories as the domain if they are defined.
35
+ data: categoryAxis?.categories ? categoryAxis.categories :
36
+ // Otherwise we just need random data to create the band scale.
37
+ Array.from({
38
+ length: maxSeriesLength
39
+ }, (_, index) => index),
40
+ tickLabelPlacement: 'middle'
41
+ }, categoryValues);
42
+ }
43
+
44
+ // If the scaleType is other than 'band', we have to do some magic.
45
+ // First we need to calculate the tick values additively and in reverse order.
46
+ const tickValues = [...maxSeriesValue.toReversed().map((_, i, arr) => arr.slice(0, i).reduce((a, value) => a + value, 0)),
47
+ // We add the total value of the series as the last tick value
48
+ maxSeriesValue.reduce((a, value) => a + value, 0)];
49
+ return _extends({
50
+ scaleType: categoryAxis.scaleType,
51
+ domainLimit: 'strict',
52
+ tickLabelPlacement: 'middle',
53
+ tickInterval: tickValues,
54
+ // No need to show the first tick label
55
+ tickLabelInterval: (_, i) => i !== 0,
56
+ // We trick the valueFormatter to show the category values.
57
+ // By using the index of the tickValues array we can get the category value.
58
+ valueFormatter: value => `${categoryAxis.categories?.toReversed()[tickValues.findIndex(v => v === value) - 1]}`
59
+ }, categoryValues);
60
+ }
61
+
62
+ /**
63
+ * A helper function that extracts FunnelChartProps from the input props
64
+ * and returns an object with props for the children components of FunnelChart.
65
+ *
66
+ * @param props The input props for FunnelChart
67
+ * @returns An object with props for the children components of FunnelChart
68
+ */
69
+ export const useFunnelChartProps = props => {
70
+ const {
71
+ categoryAxis,
72
+ series,
73
+ width,
74
+ height,
75
+ margin: marginProps,
76
+ colors,
77
+ sx,
78
+ children,
79
+ slots,
80
+ slotProps,
81
+ loading,
82
+ onItemClick,
83
+ highlightedItem,
84
+ onHighlightChange,
85
+ className,
86
+ axisHighlight,
87
+ apiRef
88
+ } = props,
89
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
90
+ const margin = defaultizeMargin(marginProps, DEFAULT_MARGINS);
91
+ const id = useId();
92
+ const clipPathId = `${id}-clip-path`;
93
+ const isHorizontal = series.some(s => s.layout === 'horizontal');
94
+ const valueAxisConfig = {
95
+ id: isHorizontal ? DEFAULT_Y_AXIS_KEY : DEFAULT_X_AXIS_KEY,
96
+ scaleType: 'linear',
97
+ domainLimit: 'strict',
98
+ position: 'none'
99
+ };
100
+ const xAxis = isHorizontal ? getCategoryAxisConfig(categoryAxis, series, isHorizontal, 'x') : valueAxisConfig;
101
+ const yAxis = isHorizontal ? valueAxisConfig : getCategoryAxisConfig(categoryAxis, series, isHorizontal, 'y');
102
+ const chartContainerProps = _extends({}, rest, {
103
+ series: series.map(s => _extends({
104
+ type: 'funnel',
105
+ layout: isHorizontal ? 'horizontal' : 'vertical'
106
+ }, s)),
107
+ width,
108
+ height,
109
+ margin,
110
+ colors,
111
+ xAxis: [xAxis],
112
+ yAxis: [yAxis],
113
+ sx,
114
+ highlightedItem,
115
+ onHighlightChange,
116
+ className,
117
+ apiRef
118
+ });
119
+ const funnelPlotProps = {
120
+ onItemClick,
121
+ slots,
122
+ slotProps
123
+ };
124
+ const overlayProps = {
125
+ slots,
126
+ slotProps,
127
+ loading
128
+ };
129
+ const chartsAxisProps = {
130
+ slots,
131
+ slotProps
132
+ };
133
+ const legendProps = {
134
+ slots,
135
+ slotProps
136
+ };
137
+ const clipPathGroupProps = {
138
+ clipPath: `url(#${clipPathId})`
139
+ };
140
+ const clipPathProps = {
141
+ id: clipPathId
142
+ };
143
+ const chartsWrapperProps = {
144
+ sx,
145
+ legendPosition: props.slotProps?.legend?.position,
146
+ legendDirection: props.slotProps?.legend?.direction
147
+ };
148
+ const axisHighlightProps = _extends({}, axisHighlight);
149
+ return {
150
+ chartContainerProps,
151
+ funnelPlotProps,
152
+ overlayProps,
153
+ chartsAxisProps,
154
+ legendProps,
155
+ clipPathGroupProps,
156
+ clipPathProps,
157
+ chartsWrapperProps,
158
+ axisHighlightProps,
159
+ children
160
+ };
161
+ };
@@ -0,0 +1,3 @@
1
+ import { GetSeriesWithDefaultValues } from '@mui/x-charts/internals';
2
+ declare const getSeriesWithDefaultValues: GetSeriesWithDefaultValues<'heatmap'>;
3
+ export default getSeriesWithDefaultValues;
@@ -0,0 +1,8 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
3
+ return _extends({
4
+ id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
5
+ color: colors[seriesIndex % colors.length]
6
+ }, seriesData);
7
+ };
8
+ export default getSeriesWithDefaultValues;
@@ -2,11 +2,13 @@ import { getBaseExtremum } from "./extremums.js";
2
2
  import seriesProcessor from "./seriesProcessor.js";
3
3
  import getColor from "./getColor.js";
4
4
  import tooltipGetter from "./tooltip.js";
5
+ import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
5
6
  export const seriesConfig = {
6
7
  seriesProcessor,
7
8
  colorProcessor: getColor,
8
9
  legendGetter: () => [],
9
10
  tooltipGetter,
10
11
  xExtremumGetter: getBaseExtremum,
11
- yExtremumGetter: getBaseExtremum
12
+ yExtremumGetter: getBaseExtremum,
13
+ getSeriesWithDefaultValues
12
14
  };
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { LineChartProps } from '@mui/x-charts/LineChart';
3
3
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
4
- export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line'>, 'series' | 'plugins' | 'seriesConfig'> {}
4
+ import { LineChartProPluginsSignatures } from "./LineChartPro.plugins.js";
5
+ export interface LineChartProProps extends Omit<LineChartProps, 'apiRef'>, Omit<ChartContainerProProps<'line', LineChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig'> {}
5
6
  /**
6
7
  * Demos:
7
8
  *
@@ -0,0 +1,33 @@
1
+ import { ProcessedSeries, SeriesId, ChartSeriesDefaultized } from '@mui/x-charts/internals';
2
+ export type UseFunnelSeriesReturnValue = ChartSeriesDefaultized<'funnel'>;
3
+ export type UseFunnelSeriesContextReturnValue = ProcessedSeries['funnel'];
4
+ /**
5
+ * Get access to the internal state of funnel series.
6
+ *
7
+ * @param {SeriesId} seriesId The id of the series to get.
8
+ * @returns {UseFunnelSeriesReturnValue} the funnel series
9
+ */
10
+ export declare function useFunnelSeries(seriesId: SeriesId): UseFunnelSeriesReturnValue | undefined;
11
+ /**
12
+ * Get access to the internal state of funnel series.
13
+ *
14
+ * When called without arguments, it returns all funnel series.
15
+ *
16
+ * @returns {UseFunnelSeriesReturnValue[]} the funnel series
17
+ */
18
+ export declare function useFunnelSeries(): UseFunnelSeriesReturnValue[];
19
+ /**
20
+ * Get access to the internal state of funnel series.
21
+ *
22
+ * @param {SeriesId[]} seriesIds The ids of the series to get. Order is preserved.
23
+ * @returns {UseFunnelSeriesReturnValue[]} the funnel series
24
+ */
25
+ export declare function useFunnelSeries(seriesIds: SeriesId[]): UseFunnelSeriesReturnValue[];
26
+ /**
27
+ * Get access to the internal state of funnel series.
28
+ * The returned object contains:
29
+ * - series: a mapping from ids to series attributes.
30
+ * - seriesOrder: the array of series ids.
31
+ * @returns the funnel series
32
+ */
33
+ export declare function useFunnelSeriesContext(): UseFunnelSeriesContextReturnValue;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+
3
+ import { createAllSeriesSelectorOfType, createSeriesSelectorsOfType } from '@mui/x-charts/internals';
4
+ const useSelectorSeries = createSeriesSelectorsOfType('funnel');
5
+ const useSelectorSeriesContext = createAllSeriesSelectorOfType('funnel');
6
+
7
+ /**
8
+ * Get access to the internal state of funnel series.
9
+ *
10
+ * @param {SeriesId} seriesId The id of the series to get.
11
+ * @returns {UseFunnelSeriesReturnValue} the funnel series
12
+ */
13
+
14
+ /**
15
+ * Get access to the internal state of funnel series.
16
+ *
17
+ * When called without arguments, it returns all funnel series.
18
+ *
19
+ * @returns {UseFunnelSeriesReturnValue[]} the funnel series
20
+ */
21
+
22
+ /**
23
+ * Get access to the internal state of funnel series.
24
+ *
25
+ * @param {SeriesId[]} seriesIds The ids of the series to get. Order is preserved.
26
+ * @returns {UseFunnelSeriesReturnValue[]} the funnel series
27
+ */
28
+
29
+ export function useFunnelSeries(seriesIds) {
30
+ return useSelectorSeries(seriesIds);
31
+ }
32
+
33
+ /**
34
+ * Get access to the internal state of funnel series.
35
+ * The returned object contains:
36
+ * - series: a mapping from ids to series attributes.
37
+ * - seriesOrder: the array of series ids.
38
+ * @returns the funnel series
39
+ */
40
+ export function useFunnelSeriesContext() {
41
+ return useSelectorSeriesContext();
42
+ }
package/modern/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export * from '@mui/x-charts/PieChart';
20
20
  export * from '@mui/x-charts/ScatterChart';
21
21
  export * from '@mui/x-charts/SparkLineChart';
22
22
  export * from '@mui/x-charts/Gauge';
23
+ export * from '@mui/x-charts/RadarChart';
23
24
  export * from '@mui/x-charts/ChartsSurface';
24
25
  export * from '@mui/x-charts/ChartDataProvider';
25
26
  export * from '@mui/x-charts/ChartsLabel';
@@ -29,4 +30,5 @@ export * from "./ChartContainerPro/index.js";
29
30
  export * from "./ChartDataProviderPro/index.js";
30
31
  export * from "./ScatterChartPro/index.js";
31
32
  export * from "./BarChartPro/index.js";
32
- export * from "./LineChartPro/index.js";
33
+ export * from "./LineChartPro/index.js";
34
+ export * from "./FunnelChart/index.js";
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts-pro v8.0.0-alpha.13
2
+ * @mui/x-charts-pro v8.0.0-alpha.14
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -29,6 +29,7 @@ export * from '@mui/x-charts/PieChart';
29
29
  export * from '@mui/x-charts/ScatterChart';
30
30
  export * from '@mui/x-charts/SparkLineChart';
31
31
  export * from '@mui/x-charts/Gauge';
32
+ export * from '@mui/x-charts/RadarChart';
32
33
  export * from '@mui/x-charts/ChartsSurface';
33
34
  export * from '@mui/x-charts/ChartDataProvider';
34
35
  export * from '@mui/x-charts/ChartsLabel';
@@ -40,4 +41,5 @@ export * from "./ChartContainerPro/index.js";
40
41
  export * from "./ChartDataProviderPro/index.js";
41
42
  export * from "./ScatterChartPro/index.js";
42
43
  export * from "./BarChartPro/index.js";
43
- export * from "./LineChartPro/index.js";
44
+ export * from "./LineChartPro/index.js";
45
+ export * from "./FunnelChart/index.js";
@@ -1,5 +1,5 @@
1
- import { ChartSeriesType, ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartZAxisSignature, UseChartHighlightSignature } from '@mui/x-charts/internals';
1
+ import { ChartSeriesType, ConvertSignaturesIntoPlugins, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartZAxisSignature, UseChartHighlightSignature, UseChartPolarAxisSignature } from '@mui/x-charts/internals';
2
2
  import { UseChartProZoomSignature } from "./useChartProZoom/index.js";
3
- export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature];
3
+ export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartProZoomSignature];
4
4
  export type AllPluginsType<TSeries extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<TSeries>>;
5
- export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>>)[];
5
+ export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>>)[];
@@ -1,5 +1,5 @@
1
1
  // This file should be removed after creating all plugins in favor of a file per chart type.
2
2
 
3
- import { useChartCartesianAxis, useChartInteraction, useChartZAxis, useChartHighlight } from '@mui/x-charts/internals';
3
+ import { useChartCartesianAxis, useChartInteraction, useChartZAxis, useChartHighlight, useChartPolarAxis } from '@mui/x-charts/internals';
4
4
  import { useChartProZoom } from "./useChartProZoom/index.js";
5
- export const ALL_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartProZoom];
5
+ export const ALL_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartPolarAxis, useChartInteraction, useChartHighlight, useChartProZoom];
@@ -1,6 +1,6 @@
1
1
  import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTc0MDY5NzIwMDAwMA==";
3
+ const releaseInfo = "MTc0MTMwMjAwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -1,6 +1,7 @@
1
- import { DefaultizedProps } from '@mui/x-internals/types';
1
+ import { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
2
2
  import { AxisId, ZoomOptions } from '@mui/x-charts/internals';
3
3
  import { HeatmapItemIdentifier, HeatmapSeriesType, DefaultizedHeatmapSeriesType, HeatmapValueType } from "../models/seriesType/heatmap.js";
4
+ import { DefaultizedFunnelSeriesType, FunnelItemIdentifier, FunnelSeriesType, FunnelValueType } from "../FunnelChart/funnel.types.js";
4
5
  declare module '@mui/x-charts/internals' {
5
6
  interface ChartsSeriesConfig {
6
7
  heatmap: {
@@ -9,7 +10,17 @@ declare module '@mui/x-charts/internals' {
9
10
  seriesProp: HeatmapSeriesType;
10
11
  itemIdentifier: HeatmapItemIdentifier;
11
12
  valueType: HeatmapValueType;
12
- cartesian: true;
13
+ axisType: 'cartesian';
14
+ };
15
+ funnel: {
16
+ seriesInput: Omit<DefaultizedProps<FunnelSeriesType, 'id'>, 'data'> & {
17
+ data: MakeRequired<FunnelValueType, 'color'>[];
18
+ };
19
+ series: DefaultizedFunnelSeriesType;
20
+ seriesProp: FunnelSeriesType;
21
+ itemIdentifier: FunnelItemIdentifier;
22
+ valueType: MakeRequired<FunnelValueType, 'id' | 'color'>;
23
+ axisType: 'cartesian';
13
24
  };
14
25
  }
15
26
  interface DefaultizedZoomOptions extends Required<ZoomOptions> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts-pro",
3
- "version": "8.0.0-alpha.13",
3
+ "version": "8.0.0-alpha.14",
4
4
  "description": "The Pro plan edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -35,10 +35,10 @@
35
35
  "@react-spring/web": "^9.7.5",
36
36
  "clsx": "^2.1.1",
37
37
  "prop-types": "^15.8.1",
38
- "@mui/x-charts": "8.0.0-alpha.13",
39
- "@mui/x-charts-vendor": "8.0.0-alpha.13",
40
38
  "@mui/x-internals": "8.0.0-alpha.13",
41
- "@mui/x-license": "8.0.0-alpha.13"
39
+ "@mui/x-license": "8.0.0-alpha.14",
40
+ "@mui/x-charts": "8.0.0-alpha.14",
41
+ "@mui/x-charts-vendor": "8.0.0-alpha.13"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.9.0",