@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
package/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
@@ -242,6 +242,17 @@ Object.keys(_Gauge).forEach(function (key) {
242
242
  }
243
243
  });
244
244
  });
245
+ var _RadarChart = require("@mui/x-charts/RadarChart");
246
+ Object.keys(_RadarChart).forEach(function (key) {
247
+ if (key === "default" || key === "__esModule") return;
248
+ if (key in exports && exports[key] === _RadarChart[key]) return;
249
+ Object.defineProperty(exports, key, {
250
+ enumerable: true,
251
+ get: function () {
252
+ return _RadarChart[key];
253
+ }
254
+ });
255
+ });
245
256
  var _ChartsSurface = require("@mui/x-charts/ChartsSurface");
246
257
  Object.keys(_ChartsSurface).forEach(function (key) {
247
258
  if (key === "default" || key === "__esModule") return;
@@ -351,4 +362,15 @@ Object.keys(_LineChartPro).forEach(function (key) {
351
362
  return _LineChartPro[key];
352
363
  }
353
364
  });
365
+ });
366
+ var _FunnelChart = require("./FunnelChart");
367
+ Object.keys(_FunnelChart).forEach(function (key) {
368
+ if (key === "default" || key === "__esModule") return;
369
+ if (key in exports && exports[key] === _FunnelChart[key]) return;
370
+ Object.defineProperty(exports, key, {
371
+ enumerable: true,
372
+ get: function () {
373
+ return _FunnelChart[key];
374
+ }
375
+ });
354
376
  });
@@ -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>>)[];
@@ -8,4 +8,4 @@ var _internals = require("@mui/x-charts/internals");
8
8
  var _useChartProZoom = require("./useChartProZoom");
9
9
  // This file should be removed after creating all plugins in favor of a file per chart type.
10
10
 
11
- const ALL_PLUGINS = exports.ALL_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProZoom.useChartProZoom];
11
+ const ALL_PLUGINS = exports.ALL_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartPolarAxis, _internals.useChartInteraction, _internals.useChartHighlight, _useChartProZoom.useChartProZoom];
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.getReleaseInfo = void 0;
8
8
  var _ponyfillGlobal = _interopRequireDefault(require("@mui/utils/ponyfillGlobal"));
9
9
  const getReleaseInfo = () => {
10
- const releaseInfo = "MTc0MDY5NzIwMDAwMA==";
10
+ const releaseInfo = "MTc0MTMwMjAwMDAwMA==";
11
11
  if (process.env.NODE_ENV !== 'production') {
12
12
  // A simple hack to set the value in the test environment (has no build step).
13
13
  // eslint-disable-next-line no-useless-concat
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { BarChartProps } from '@mui/x-charts/BarChart';
3
3
  import { ChartContainerProProps } from "../ChartContainerPro/index.js";
4
- export interface BarChartProProps extends Omit<BarChartProps, 'apiRef'>, Omit<ChartContainerProProps<'bar'>, 'series' | 'plugins' | 'seriesConfig'> {}
4
+ import { BarChartProPluginsSignatures } from "./BarChartPro.plugins.js";
5
+ export interface BarChartProProps extends Omit<BarChartProps, 'apiRef'>, Omit<ChartContainerProProps<'bar', BarChartProPluginsSignatures>, 'series' | 'plugins' | 'seriesConfig'> {}
5
6
  /**
6
7
  * Demos:
7
8
  *
@@ -6,4 +6,4 @@ import { AllPluginSignatures } from "../internals/plugins/allPlugins.js";
6
6
  export type UseChartContainerProPropsReturnValue<TSeries extends ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[]> = Pick<UseChartContainerPropsReturnValue<TSeries, TSignatures>, 'chartsSurfaceProps' | 'children'> & {
7
7
  chartDataProviderProProps: ChartDataProviderProps<TSeries, TSignatures>;
8
8
  };
9
- export declare const useChartContainerProProps: <TSeries extends ChartSeriesType = keyof import("@mui/x-charts/internals").ChartsSeriesConfig, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartContainerProProps<TSeries, TSignatures>, ref: React.Ref<SVGSVGElement>) => UseChartContainerProPropsReturnValue<TSeries, TSignatures>;
9
+ export declare const useChartContainerProProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartContainerProProps<TSeries, TSignatures>, ref: React.Ref<SVGSVGElement>) => UseChartContainerProPropsReturnValue<TSeries, TSignatures>;
@@ -1,7 +1,7 @@
1
1
  import { ChartAnyPluginSignature, ChartSeriesType } from '@mui/x-charts/internals';
2
2
  import type { ChartDataProviderProProps } from './ChartDataProviderPro';
3
3
  import type { AllPluginSignatures } from '../internals/plugins/allPlugins';
4
- export declare const useChartDataProviderProProps: <TSeries extends ChartSeriesType = keyof import("@mui/x-charts/internals").ChartsSeriesConfig, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartDataProviderProProps<TSeries, TSignatures>) => {
4
+ export declare const useChartDataProviderProProps: <TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>>(props: ChartDataProviderProProps<TSeries, TSignatures>) => {
5
5
  children: import("react").ReactNode;
6
6
  animationProviderProps: Omit<import("@mui/x-charts/internals").AnimationProviderProps, "children">;
7
7
  chartProviderProps: Omit<import("@mui/x-charts/internals").ChartProviderProps<TSeries, TSignatures>, "children">;
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ import { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
3
+ import { MakeOptional } from '@mui/x-internals/types';
4
+ import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
5
+ import { FunnelPlotProps } from "./FunnelPlot.js";
6
+ import { FunnelSeriesType } from "./funnel.types.js";
7
+ import { ChartContainerProProps } from "../ChartContainerPro/index.js";
8
+ import { FunnelChartSlotExtension } from "./funnelSlots.types.js";
9
+ import { CategoryAxis } from "./categoryAxis.types.js";
10
+ export interface FunnelChartProps extends Omit<ChartContainerProProps<'funnel'>, 'series' | 'plugins' | 'zAxis' | 'zoom' | 'onZoomChange' | 'dataset' | 'yAxis' | 'xAxis' | 'rotationAxis' | 'radiusAxis'>, Omit<FunnelPlotProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, FunnelChartSlotExtension {
11
+ /**
12
+ * The series to display in the funnel chart.
13
+ * An array of [[FunnelSeriesType]] objects.
14
+ */
15
+ series: Readonly<MakeOptional<FunnelSeriesType, 'type'>[]>;
16
+ /**
17
+ * The configuration of the category axis.
18
+ *
19
+ * @default { position: 'none' }
20
+ */
21
+ categoryAxis?: CategoryAxis;
22
+ /**
23
+ * If `true`, the legend is not rendered.
24
+ * @default false
25
+ */
26
+ hideLegend?: boolean;
27
+ /**
28
+ * The configuration of axes highlight.
29
+ * Default is set to 'band' in the bar direction.
30
+ * Depends on `layout` prop.
31
+ * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
32
+ *
33
+ */
34
+ axisHighlight?: ChartsAxisHighlightProps;
35
+ }
36
+ declare const FunnelChart: React.ForwardRefExoticComponent<FunnelChartProps & React.RefAttributes<SVGSVGElement>>;
37
+ export { FunnelChart };
@@ -0,0 +1,212 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import { useThemeProps } from '@mui/material/styles';
6
+ import PropTypes from 'prop-types';
7
+ import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
8
+ import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
9
+ import { ChartsWrapper } from '@mui/x-charts/internals';
10
+ import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
11
+ import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
12
+ import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
13
+ import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
14
+ import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
15
+ import { FunnelPlot } from "./FunnelPlot.js";
16
+ import { useFunnelChartProps } from "./useFunnelChartProps.js";
17
+ import { seriesConfig as funnelSeriesConfig } from "./seriesConfig/index.js";
18
+ import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
19
+ import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
20
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
+ const seriesConfig = {
22
+ funnel: funnelSeriesConfig
23
+ };
24
+ const FunnelChart = /*#__PURE__*/React.forwardRef(function FunnelChart(props, ref) {
25
+ const themedProps = useThemeProps({
26
+ props,
27
+ name: 'MuiFunnelChart'
28
+ });
29
+ const {
30
+ chartContainerProps,
31
+ funnelPlotProps,
32
+ overlayProps,
33
+ legendProps,
34
+ clipPathGroupProps,
35
+ chartsAxisProps,
36
+ clipPathProps,
37
+ chartsWrapperProps,
38
+ axisHighlightProps,
39
+ children
40
+ } = useFunnelChartProps(themedProps);
41
+ const {
42
+ chartDataProviderProProps,
43
+ chartsSurfaceProps
44
+ } = useChartContainerProProps(chartContainerProps, ref);
45
+ const Tooltip = themedProps.slots?.tooltip ?? ChartsTooltip;
46
+ return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
47
+ seriesConfig: seriesConfig,
48
+ children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
49
+ children: [!themedProps.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
50
+ children: [/*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
51
+ children: [/*#__PURE__*/_jsx(FunnelPlot, _extends({}, funnelPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
52
+ })), !themedProps.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, themedProps.slotProps?.tooltip, {
53
+ trigger: "item"
54
+ })), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
55
+ }))]
56
+ }))
57
+ }));
58
+ });
59
+ process.env.NODE_ENV !== "production" ? FunnelChart.propTypes = {
60
+ // ----------------------------- Warning --------------------------------
61
+ // | These PropTypes are generated from the TypeScript type definitions |
62
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
63
+ // ----------------------------------------------------------------------
64
+ apiRef: PropTypes.shape({
65
+ current: PropTypes.shape({
66
+ setZoomData: PropTypes.func.isRequired
67
+ })
68
+ }),
69
+ /**
70
+ * The configuration of axes highlight.
71
+ * Default is set to 'band' in the bar direction.
72
+ * Depends on `layout` prop.
73
+ * @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
74
+ */
75
+ axisHighlight: PropTypes.shape({
76
+ x: PropTypes.oneOf(['band', 'line', 'none']),
77
+ y: PropTypes.oneOf(['band', 'line', 'none'])
78
+ }),
79
+ /**
80
+ * The configuration of the category axis.
81
+ *
82
+ * @default { position: 'none' }
83
+ */
84
+ categoryAxis: PropTypes.shape({
85
+ categories: PropTypes.arrayOf(PropTypes.string),
86
+ disableLine: PropTypes.bool,
87
+ disableTicks: PropTypes.bool,
88
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
89
+ position: PropTypes.oneOf(['bottom', 'left', 'none', 'right', 'top']),
90
+ scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
91
+ size: PropTypes.number,
92
+ tickLabelStyle: PropTypes.object,
93
+ tickSize: PropTypes.number
94
+ }),
95
+ children: PropTypes.node,
96
+ className: PropTypes.string,
97
+ /**
98
+ * Color palette used to colorize multiple series.
99
+ * @default rainbowSurgePalette
100
+ */
101
+ colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
102
+ desc: PropTypes.string,
103
+ /**
104
+ * If `true`, the charts will not listen to the mouse move event.
105
+ * It might break interactive features, but will improve performance.
106
+ * @default false
107
+ */
108
+ disableAxisListener: PropTypes.bool,
109
+ /**
110
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
111
+ */
112
+ height: PropTypes.number,
113
+ /**
114
+ * If `true`, the legend is not rendered.
115
+ * @default false
116
+ */
117
+ hideLegend: PropTypes.bool,
118
+ /**
119
+ * The highlighted item.
120
+ * Used when the highlight is controlled.
121
+ */
122
+ highlightedItem: PropTypes.shape({
123
+ dataIndex: PropTypes.number,
124
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
125
+ }),
126
+ /**
127
+ * This prop is used to help implement the accessibility logic.
128
+ * If you don't provide this prop. It falls back to a randomly generated id.
129
+ */
130
+ id: PropTypes.string,
131
+ /**
132
+ * The list of zoom data related to each axis.
133
+ * Used to initialize the zoom in a specific configuration without controlling it.
134
+ */
135
+ initialZoom: PropTypes.arrayOf(PropTypes.shape({
136
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
137
+ end: PropTypes.number.isRequired,
138
+ start: PropTypes.number.isRequired
139
+ })),
140
+ /**
141
+ * If `true`, a loading overlay is displayed.
142
+ * @default false
143
+ */
144
+ loading: PropTypes.bool,
145
+ /**
146
+ * The margin between the SVG and the drawing area.
147
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
148
+ *
149
+ * Accepts a `number` to be used on all sides or an object with the optional properties: `top`, `bottom`, `left`, and `right`.
150
+ */
151
+ margin: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
152
+ bottom: PropTypes.number,
153
+ left: PropTypes.number,
154
+ right: PropTypes.number,
155
+ top: PropTypes.number
156
+ })]),
157
+ /**
158
+ * The function called for onClick events.
159
+ * The second argument contains information about all line/bar elements at the current mouse position.
160
+ * @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
161
+ * @param {null | AxisData} data The data about the clicked axis and items associated with it.
162
+ */
163
+ onAxisClick: PropTypes.func,
164
+ /**
165
+ * The callback fired when the highlighted item changes.
166
+ *
167
+ * @param {HighlightItemData | null} highlightedItem The newly highlighted item.
168
+ */
169
+ onHighlightChange: PropTypes.func,
170
+ /**
171
+ * Callback fired when a funnel item is clicked.
172
+ * @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
173
+ * @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
174
+ */
175
+ onItemClick: PropTypes.func,
176
+ /**
177
+ * The series to display in the funnel chart.
178
+ * An array of [[FunnelSeriesType]] objects.
179
+ */
180
+ series: PropTypes.arrayOf(PropTypes.object).isRequired,
181
+ /**
182
+ * If `true`, animations are skipped.
183
+ * If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
184
+ */
185
+ skipAnimation: PropTypes.bool,
186
+ /**
187
+ * The props used for each component slot.
188
+ * @default {}
189
+ */
190
+ slotProps: PropTypes.object,
191
+ /**
192
+ * Overridable component slots.
193
+ * @default {}
194
+ */
195
+ slots: PropTypes.object,
196
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
197
+ theme: PropTypes.oneOf(['dark', 'light']),
198
+ title: PropTypes.string,
199
+ /**
200
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
201
+ */
202
+ width: PropTypes.number,
203
+ /**
204
+ * The list of zoom data related to each axis.
205
+ */
206
+ zoomData: PropTypes.arrayOf(PropTypes.shape({
207
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
208
+ end: PropTypes.number.isRequired,
209
+ start: PropTypes.number.isRequired
210
+ }))
211
+ } : void 0;
212
+ export { FunnelChart };
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { FunnelItemIdentifier } from "./funnel.types.js";
3
+ import { FunnelPlotSlotExtension } from "./funnelPlotSlots.types.js";
4
+ export interface FunnelPlotProps extends FunnelPlotSlotExtension {
5
+ /**
6
+ * Callback fired when a funnel item is clicked.
7
+ * @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
8
+ * @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
9
+ */
10
+ onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, funnelItemIdentifier: FunnelItemIdentifier) => void;
11
+ }
12
+ declare function FunnelPlot(props: FunnelPlotProps): React.JSX.Element;
13
+ declare namespace FunnelPlot {
14
+ var propTypes: any;
15
+ }
16
+ export { FunnelPlot };
@@ -0,0 +1,184 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["onItemClick"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
7
+ import { getCurveFactory, cartesianSeriesTypes } from '@mui/x-charts/internals';
8
+ import { useXAxes, useYAxes } from '@mui/x-charts/hooks';
9
+ import { useTheme } from '@mui/material/styles';
10
+ import { FunnelSection } from "./FunnelSection.js";
11
+ import { alignLabel, positionLabel } from "./labelUtils.js";
12
+ import { funnelHorizontalStepCurve, funnelVerticalStepCurve } from "./funnelStepCurve.js";
13
+ import { useFunnelSeriesContext } from "../hooks/useFunnelSeries.js";
14
+ import { createElement as _createElement } from "react";
15
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
+ cartesianSeriesTypes.addType('funnel');
17
+ const getFunnelCurve = (curve, isHorizontal) => {
18
+ if (curve === 'step') {
19
+ return isHorizontal ? funnelHorizontalStepCurve : funnelVerticalStepCurve;
20
+ }
21
+ if (curve === 'bump') {
22
+ return isHorizontal ? getCurveFactory('bumpX') : getCurveFactory('bumpY');
23
+ }
24
+ return getCurveFactory(curve ?? 'linear');
25
+ };
26
+ const useAggregatedData = () => {
27
+ const seriesData = useFunnelSeriesContext();
28
+ const {
29
+ xAxis,
30
+ xAxisIds
31
+ } = useXAxes();
32
+ const {
33
+ yAxis,
34
+ yAxisIds
35
+ } = useYAxes();
36
+ const allData = React.useMemo(() => {
37
+ if (seriesData === undefined) {
38
+ return [];
39
+ }
40
+ const {
41
+ series,
42
+ seriesOrder
43
+ } = seriesData;
44
+ const defaultXAxisId = xAxisIds[0];
45
+ const defaultYAxisId = yAxisIds[0];
46
+ const isHorizontal = Object.values(series).some(s => s.layout === 'horizontal');
47
+ const result = seriesOrder.map(seriesId => {
48
+ const currentSeries = series[seriesId];
49
+ const xAxisId = currentSeries.xAxisId ?? defaultXAxisId;
50
+ const yAxisId = currentSeries.yAxisId ?? defaultYAxisId;
51
+ const valueFormatter = currentSeries.valueFormatter;
52
+ const baseScaleConfig = isHorizontal ? xAxis[xAxisId] : yAxis[yAxisId];
53
+ const isXAxisBand = xAxis[xAxisId].scaleType === 'band';
54
+ const isYAxisBand = yAxis[yAxisId].scaleType === 'band';
55
+ const bandWidth = (isXAxisBand || isYAxisBand) && baseScaleConfig.scale?.bandwidth() || 0;
56
+ const xScale = xAxis[xAxisId].scale;
57
+ const yScale = yAxis[yAxisId].scale;
58
+ const curve = getFunnelCurve(currentSeries.curve, isHorizontal);
59
+ const xPosition = (value, bandIndex, stackOffset, useBand) => {
60
+ if (isXAxisBand) {
61
+ const position = xScale(bandIndex);
62
+ return useBand ? position + bandWidth : position;
63
+ }
64
+ return xScale(isHorizontal ? value + (stackOffset || 0) : value);
65
+ };
66
+ const yPosition = (value, bandIndex, stackOffset, useBand) => {
67
+ if (isYAxisBand) {
68
+ const position = yScale(bandIndex);
69
+ return useBand ? position + bandWidth : position;
70
+ }
71
+ return yScale(isHorizontal ? value : value + (stackOffset || 0));
72
+ };
73
+ return currentSeries.dataPoints.map((values, dataIndex) => {
74
+ const color = currentSeries.data[dataIndex].color;
75
+ const id = `${seriesId}-${dataIndex}`;
76
+ const sectionLabel = typeof currentSeries.sectionLabel === 'function' ? currentSeries.sectionLabel({
77
+ dataIndex,
78
+ seriesId,
79
+ value: currentSeries.data[dataIndex].value
80
+ }) : currentSeries.sectionLabel;
81
+ const line = d3Line().x(d => xPosition(d.x, baseScaleConfig.data?.[dataIndex], d.stackOffset, d.useBandWidth)).y(d => yPosition(d.y, baseScaleConfig.data?.[dataIndex], d.stackOffset, d.useBandWidth)).curve(curve);
82
+ return {
83
+ d: line(values),
84
+ color,
85
+ id,
86
+ seriesId,
87
+ dataIndex,
88
+ label: sectionLabel !== false && _extends({}, positionLabel(_extends({}, sectionLabel, {
89
+ xPosition,
90
+ yPosition,
91
+ isHorizontal,
92
+ values,
93
+ dataIndex,
94
+ baseScaleData: baseScaleConfig.data ?? []
95
+ })), alignLabel(sectionLabel ?? {}), {
96
+ value: valueFormatter ? valueFormatter(currentSeries.data[dataIndex], {
97
+ dataIndex
98
+ }) : currentSeries.data[dataIndex].value?.toLocaleString()
99
+ })
100
+ };
101
+ });
102
+ });
103
+ return result.flat();
104
+ }, [seriesData, xAxis, xAxisIds, yAxis, yAxisIds]);
105
+ return allData;
106
+ };
107
+ function FunnelPlot(props) {
108
+ const {
109
+ onItemClick
110
+ } = props,
111
+ other = _objectWithoutPropertiesLoose(props, _excluded);
112
+ const theme = useTheme();
113
+ const data = useAggregatedData();
114
+ return /*#__PURE__*/_jsxs(React.Fragment, {
115
+ children: [data.map(({
116
+ d,
117
+ color,
118
+ id,
119
+ seriesId,
120
+ dataIndex
121
+ }) => /*#__PURE__*/_createElement(FunnelSection, _extends({}, other, {
122
+ d: d,
123
+ color: color,
124
+ key: id,
125
+ dataIndex: dataIndex,
126
+ seriesId: seriesId,
127
+ onClick: onItemClick && (event => {
128
+ onItemClick(event, {
129
+ type: 'funnel',
130
+ seriesId,
131
+ dataIndex
132
+ });
133
+ })
134
+ }))), data.map(({
135
+ id,
136
+ label
137
+ }) => {
138
+ if (!label) {
139
+ return null;
140
+ }
141
+ return /*#__PURE__*/_jsx("text", {
142
+ x: label.x,
143
+ y: label.y,
144
+ textAnchor: label.textAnchor,
145
+ dominantBaseline: label.dominantBaseline,
146
+ stroke: "none",
147
+ pointerEvents: "none",
148
+ fontFamily: theme.typography.body2.fontFamily,
149
+ fontSize: theme.typography.body2.fontSize,
150
+ fontSizeAdjust: theme.typography.body2.fontSizeAdjust,
151
+ fontWeight: theme.typography.body2.fontWeight,
152
+ letterSpacing: theme.typography.body2.letterSpacing,
153
+ fontStretch: theme.typography.body2.fontStretch,
154
+ fontStyle: theme.typography.body2.fontStyle,
155
+ fontVariant: theme.typography.body2.fontVariant,
156
+ fill: (theme.vars || theme)?.palette?.text?.primary,
157
+ children: label.value
158
+ }, id);
159
+ })]
160
+ });
161
+ }
162
+ process.env.NODE_ENV !== "production" ? FunnelPlot.propTypes = {
163
+ // ----------------------------- Warning --------------------------------
164
+ // | These PropTypes are generated from the TypeScript type definitions |
165
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
166
+ // ----------------------------------------------------------------------
167
+ /**
168
+ * Callback fired when a funnel item is clicked.
169
+ * @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
170
+ * @param {FunnelItemIdentifier} funnelItemIdentifier The funnel item identifier.
171
+ */
172
+ onItemClick: PropTypes.func,
173
+ /**
174
+ * The props used for each component slot.
175
+ * @default {}
176
+ */
177
+ slotProps: PropTypes.object,
178
+ /**
179
+ * Overridable component slots.
180
+ * @default {}
181
+ */
182
+ slots: PropTypes.object
183
+ } : void 0;
184
+ export { FunnelPlot };
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { SeriesId } from '@mui/x-charts/internals';
3
+ import { FunnelSectionClasses } from "./funnelSectionClasses.js";
4
+ export interface FunnelSectionProps extends Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> {
5
+ seriesId: SeriesId;
6
+ dataIndex: number;
7
+ color: string;
8
+ classes?: Partial<FunnelSectionClasses>;
9
+ }
10
+ export declare const FunnelSectionPath: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, React.SVGProps<SVGPathElement>, {}>;
11
+ /**
12
+ * @ignore - internal component.
13
+ */
14
+ declare const FunnelSection: React.ForwardRefExoticComponent<FunnelSectionProps & React.RefAttributes<{}>>;
15
+ export { FunnelSection };
@@ -0,0 +1,56 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
+ const _excluded = ["seriesId", "dataIndex", "classes", "color", "onClick", "className"];
6
+ import * as React from 'react';
7
+ import { styled } from '@mui/material/styles';
8
+ import { useInteractionItemProps, consumeSlots } from '@mui/x-charts/internals';
9
+ import { useItemHighlighted } from '@mui/x-charts/hooks';
10
+ import clsx from 'clsx';
11
+ import { useUtilityClasses } from "./funnelSectionClasses.js";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export const FunnelSectionPath = styled('path')(() => ({
14
+ transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
15
+ }));
16
+
17
+ /**
18
+ * @ignore - internal component.
19
+ */
20
+ const FunnelSection = consumeSlots('MuiFunnelSection', 'funnelSection', {
21
+ classesResolver: useUtilityClasses
22
+ }, function FunnelSection(props, ref) {
23
+ const {
24
+ seriesId,
25
+ dataIndex,
26
+ classes,
27
+ color,
28
+ onClick,
29
+ className
30
+ } = props,
31
+ other = _objectWithoutPropertiesLoose(props, _excluded);
32
+ const getInteractionItemProps = useInteractionItemProps();
33
+ const {
34
+ isFaded,
35
+ isHighlighted
36
+ } = useItemHighlighted({
37
+ seriesId,
38
+ dataIndex
39
+ });
40
+ return /*#__PURE__*/_jsx(FunnelSectionPath, _extends({}, getInteractionItemProps({
41
+ type: 'funnel',
42
+ seriesId,
43
+ dataIndex
44
+ }), {
45
+ filter: isHighlighted ? 'brightness(120%)' : undefined,
46
+ opacity: isFaded ? 0.3 : 1,
47
+ fill: color,
48
+ stroke: "none",
49
+ cursor: onClick ? 'pointer' : 'unset',
50
+ onClick: onClick,
51
+ className: clsx(classes?.root, className, isHighlighted && classes?.highlighted, isFaded && classes?.faded)
52
+ }, other, {
53
+ ref: ref
54
+ }));
55
+ });
56
+ export { FunnelSection };
@@ -0,0 +1,24 @@
1
+ import { AxisConfig, ScaleName } from '@mui/x-charts/models';
2
+ import { MakeOptional } from '@mui/x-internals/types';
3
+ export type CategoryAxis = {
4
+ /**
5
+ * The categories to be displayed on the axis.
6
+ * The order of the categories is the order in which they are displayed.
7
+ */
8
+ categories?: string[];
9
+ /**
10
+ * The position of the axis.
11
+ * - 'left' - The axis is positioned on the left side of the chart.
12
+ * - 'right' - The axis is positioned on the right side of the chart.
13
+ * - 'top' - The axis is positioned on the top side of the chart.
14
+ * - 'bottom' - The axis is positioned on the bottom side of the chart.
15
+ * - 'none' - The axis is not displayed.
16
+ */
17
+ position?: 'left' | 'right' | 'top' | 'bottom' | 'none';
18
+ /**
19
+ * The size of the axis.
20
+ * - If the axis is horizontal, the size is the height of the axis.
21
+ * - If the axis is vertical, the size is the width of the axis.
22
+ */
23
+ size?: number;
24
+ } & MakeOptional<Pick<AxisConfig<ScaleName, any>, 'disableLine' | 'disableTicks' | 'scaleType' | 'tickLabelStyle' | 'tickSize' | 'id'>, 'id'>;
@@ -0,0 +1 @@
1
+ export {};