@mui/x-charts-pro 8.27.5 → 8.28.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 (86) hide show
  1. package/BarChartPro/BarChartPro.js +2 -2
  2. package/CHANGELOG.md +155 -0
  3. package/ChartsDataProviderPro/ChartsDataProviderPro.js +1 -1
  4. package/FunnelChart/FunnelPlot.js +8 -3
  5. package/FunnelChart/FunnelSection.js +7 -3
  6. package/FunnelChart/FunnelSectionLabel.d.ts +6 -0
  7. package/FunnelChart/FunnelSectionLabel.js +18 -5
  8. package/FunnelChart/funnelClasses.d.ts +29 -0
  9. package/FunnelChart/funnelClasses.js +29 -0
  10. package/FunnelChart/funnelSectionClasses.d.ts +13 -0
  11. package/FunnelChart/funnelSectionClasses.js +19 -0
  12. package/FunnelChart/index.d.ts +2 -0
  13. package/FunnelChart/index.js +8 -0
  14. package/Heatmap/Heatmap.js +2 -2
  15. package/Heatmap/HeatmapCell.d.ts +34 -0
  16. package/Heatmap/HeatmapCell.js +64 -0
  17. package/Heatmap/HeatmapItem.d.ts +1 -8
  18. package/Heatmap/HeatmapItem.js +4 -19
  19. package/Heatmap/heatmapClasses.d.ts +6 -1
  20. package/Heatmap/heatmapClasses.js +18 -3
  21. package/Heatmap/index.d.ts +4 -2
  22. package/Heatmap/index.js +17 -13
  23. package/Heatmap/shouldRegisterPointerInteractionsGlobally.js +1 -1
  24. package/LineChartPro/LineChartPro.js +2 -2
  25. package/SankeyChart/SankeyLinkElement.js +4 -2
  26. package/SankeyChart/SankeyLinkLabel.js +3 -0
  27. package/SankeyChart/SankeyNodeElement.d.ts +1 -1
  28. package/SankeyChart/SankeyNodeElement.js +5 -3
  29. package/SankeyChart/SankeyNodeLabel.js +3 -0
  30. package/SankeyChart/SankeyPlot.js +2 -2
  31. package/SankeyChart/index.d.ts +2 -1
  32. package/SankeyChart/index.js +7 -0
  33. package/SankeyChart/sankeyClasses.d.ts +27 -6
  34. package/SankeyChart/sankeyClasses.js +27 -8
  35. package/ScatterChartPro/ScatterChartPro.js +2 -2
  36. package/esm/BarChartPro/BarChartPro.js +2 -2
  37. package/esm/ChartsDataProviderPro/ChartsDataProviderPro.js +1 -1
  38. package/esm/FunnelChart/FunnelPlot.js +8 -3
  39. package/esm/FunnelChart/FunnelSection.js +9 -5
  40. package/esm/FunnelChart/FunnelSectionLabel.d.ts +6 -0
  41. package/esm/FunnelChart/FunnelSectionLabel.js +20 -7
  42. package/esm/FunnelChart/funnelClasses.d.ts +29 -0
  43. package/esm/FunnelChart/funnelClasses.js +19 -0
  44. package/esm/FunnelChart/funnelSectionClasses.d.ts +13 -0
  45. package/esm/FunnelChart/funnelSectionClasses.js +20 -0
  46. package/esm/FunnelChart/index.d.ts +2 -0
  47. package/esm/FunnelChart/index.js +1 -0
  48. package/esm/Heatmap/Heatmap.js +2 -2
  49. package/esm/Heatmap/HeatmapCell.d.ts +34 -0
  50. package/esm/Heatmap/HeatmapCell.js +58 -0
  51. package/esm/Heatmap/HeatmapItem.d.ts +1 -8
  52. package/esm/Heatmap/HeatmapItem.js +4 -19
  53. package/esm/Heatmap/heatmapClasses.d.ts +6 -1
  54. package/esm/Heatmap/heatmapClasses.js +16 -2
  55. package/esm/Heatmap/index.d.ts +4 -2
  56. package/esm/Heatmap/index.js +2 -1
  57. package/esm/Heatmap/shouldRegisterPointerInteractionsGlobally.js +1 -1
  58. package/esm/LineChartPro/LineChartPro.js +2 -2
  59. package/esm/SankeyChart/SankeyLinkElement.js +4 -2
  60. package/esm/SankeyChart/SankeyLinkLabel.js +3 -0
  61. package/esm/SankeyChart/SankeyNodeElement.d.ts +1 -1
  62. package/esm/SankeyChart/SankeyNodeElement.js +5 -3
  63. package/esm/SankeyChart/SankeyNodeLabel.js +3 -0
  64. package/esm/SankeyChart/SankeyPlot.js +2 -2
  65. package/esm/SankeyChart/index.d.ts +2 -1
  66. package/esm/SankeyChart/index.js +1 -1
  67. package/esm/SankeyChart/sankeyClasses.d.ts +27 -6
  68. package/esm/SankeyChart/sankeyClasses.js +25 -6
  69. package/esm/ScatterChartPro/ScatterChartPro.js +2 -2
  70. package/esm/index.js +1 -1
  71. package/esm/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +1 -1
  72. package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +13 -0
  73. package/esm/themeAugmentation/components.d.ts +19 -1
  74. package/esm/themeAugmentation/overrides.d.ts +5 -2
  75. package/esm/themeAugmentation/props.d.ts +8 -0
  76. package/index.js +1 -1
  77. package/internals/plugins/useChartProZoom/ZoomInteractionConfig.types.d.ts +1 -1
  78. package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnBrush.js +13 -0
  79. package/package.json +2 -2
  80. package/themeAugmentation/components.d.ts +19 -1
  81. package/themeAugmentation/overrides.d.ts +5 -2
  82. package/themeAugmentation/props.d.ts +8 -0
  83. package/Heatmap/internals/HeatmapCell.d.ts +0 -21
  84. package/Heatmap/internals/HeatmapCell.js +0 -18
  85. package/esm/Heatmap/internals/HeatmapCell.d.ts +0 -21
  86. package/esm/Heatmap/internals/HeatmapCell.js +0 -12
@@ -2,25 +2,38 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["classes", "color", "onClick", "className", "label", "seriesId", "dataIndex"];
5
+ const _excluded = ["classes", "color", "onClick", "className", "label", "variant", "seriesId", "dataIndex"];
6
6
  import * as React from 'react';
7
- import { useTheme } from '@mui/material/styles';
7
+ import { styled, useTheme } from '@mui/material/styles';
8
8
  import { consumeSlots } from '@mui/x-charts/internals';
9
- import { useLabelUtilityClasses } from "./funnelSectionClasses.js";
9
+ import clsx from 'clsx';
10
+ import { useLabelUtilityClasses as useDeprecatedLabelUtilityClasses } from "./funnelSectionClasses.js";
11
+ import { useUtilityClasses } from "./funnelClasses.js";
10
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ export const FunnelSectionLabelText = styled('text', {
14
+ name: 'MuiFunnelChart',
15
+ slot: 'SectionLabel'
16
+ })(() => ({
17
+ transition: 'opacity 0.2s ease-in, fill 0.2s ease-in, fill-opacity 0.2s ease-in, filter 0.2s ease-in'
18
+ }));
19
+
11
20
  /**
12
21
  * @ignore - internal component.
13
22
  */
14
23
  const FunnelSectionLabel = consumeSlots('MuiFunnelSectionLabel', 'funnelSectionLabel', {
15
- classesResolver: useLabelUtilityClasses
24
+ classesResolver: useDeprecatedLabelUtilityClasses
16
25
  }, /*#__PURE__*/React.forwardRef(function FunnelSectionLabel(props, ref) {
17
26
  const {
18
27
  classes,
19
- label
28
+ label,
29
+ variant = 'filled'
20
30
  } = props,
21
31
  other = _objectWithoutPropertiesLoose(props, _excluded);
22
32
  const theme = useTheme();
23
- return /*#__PURE__*/_jsx("text", _extends({
33
+ const newClasses = useUtilityClasses({
34
+ variant
35
+ });
36
+ return /*#__PURE__*/_jsx(FunnelSectionLabelText, _extends({
24
37
  stroke: "none",
25
38
  pointerEvents: "none",
26
39
  fontFamily: theme.typography.body2.fontFamily,
@@ -32,7 +45,7 @@ const FunnelSectionLabel = consumeSlots('MuiFunnelSectionLabel', 'funnelSectionL
32
45
  fontStyle: theme.typography.body2.fontStyle,
33
46
  fontVariant: theme.typography.body2.fontVariant,
34
47
  fill: (theme.vars || theme)?.palette?.text?.primary,
35
- className: classes?.label,
48
+ className: clsx(newClasses.sectionLabel, classes?.label),
36
49
  x: label.x,
37
50
  y: label.y,
38
51
  textAnchor: label.textAnchor ?? 'middle',
@@ -0,0 +1,29 @@
1
+ import { type SeriesId } from '@mui/x-charts/internals';
2
+ export interface FunnelClasses {
3
+ /** Styles applied to the funnel plot element. */
4
+ root: string;
5
+ /** Styles applied to an individual funnel section element. */
6
+ section: string;
7
+ /** Styles applied to a funnel section element if `variant="filled"`. */
8
+ sectionFilled: string;
9
+ /** Styles applied to a funnel section element if `variant="outlined"`. */
10
+ sectionOutlined: string;
11
+ /** Styles applied to a funnel section label element. */
12
+ sectionLabel: string;
13
+ }
14
+ export type FunnelClassKey = keyof FunnelClasses;
15
+ export interface FunnelSectionOwnerState {
16
+ seriesId: SeriesId;
17
+ dataIndex: number;
18
+ color: string;
19
+ isFaded: boolean;
20
+ isHighlighted: boolean;
21
+ classes?: Partial<FunnelClasses>;
22
+ }
23
+ export declare function getFunnelUtilityClass(slot: string): string;
24
+ export declare const funnelClasses: FunnelClasses;
25
+ export interface UseUtilityClassesOptions {
26
+ variant?: 'filled' | 'outlined';
27
+ classes?: Partial<FunnelClasses>;
28
+ }
29
+ export declare const useUtilityClasses: (options?: UseUtilityClassesOptions) => Record<"section" | "sectionLabel" | "root", string>;
@@ -0,0 +1,19 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import composeClasses from '@mui/utils/composeClasses';
3
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
4
+ export function getFunnelUtilityClass(slot) {
5
+ return generateUtilityClass('MuiFunnelChart', slot);
6
+ }
7
+ export const funnelClasses = generateUtilityClasses('MuiFunnelChart', ['root', 'section', 'sectionFilled', 'sectionOutlined', 'sectionLabel', 'sectionLabelFilled', 'sectionLabelOutlined']);
8
+ export const useUtilityClasses = options => {
9
+ const {
10
+ variant,
11
+ classes
12
+ } = options ?? {};
13
+ const slots = {
14
+ root: ['root'],
15
+ section: ['section', variant === 'filled' && 'sectionFilled', variant === 'outlined' && 'sectionOutlined'],
16
+ sectionLabel: ['sectionLabel', variant === 'filled' && 'sectionLabelFilled', variant === 'outlined' && 'sectionLabelOutlined']
17
+ };
18
+ return composeClasses(slots, getFunnelUtilityClass, classes);
19
+ };
@@ -1,5 +1,8 @@
1
1
  import type { FunnelSectionProps } from "./FunnelSection.js";
2
2
  import type { FunnelSectionLabelProps } from "./FunnelSectionLabel.js";
3
+ /**
4
+ * @deprecated Use `FunnelClasses` from `funnelClasses` instead.
5
+ */
3
6
  export interface FunnelSectionClasses {
4
7
  /** Styles applied to the root element. */
5
8
  root: string;
@@ -16,9 +19,19 @@ export interface FunnelSectionClasses {
16
19
  /**
17
20
  * Styles applied to the root element for a specified series.
18
21
  * Needs to be suffixed with the series ID: `.${funnelSectionClasses.series}-${seriesId}`.
22
+ * @deprecated Use `[data-series]` selector instead.
19
23
  */
20
24
  series: string;
21
25
  }
26
+ /**
27
+ * @deprecated Use `useUtilityClasses` from `funnelClasses` instead.
28
+ */
22
29
  export declare const useUtilityClasses: (props: FunnelSectionProps) => Record<"label" | "filled" | "outlined" | "highlighted" | "faded" | "root", string>;
30
+ /**
31
+ * @deprecated Use `useUtilityClasses` from `funnelClasses` instead.
32
+ */
23
33
  export declare const useLabelUtilityClasses: (props: FunnelSectionLabelProps) => Record<"label", string>;
34
+ /**
35
+ * @deprecated Use `funnelClasses` from `funnelClasses` instead.
36
+ */
24
37
  export declare const funnelSectionClasses: FunnelSectionClasses;
@@ -1,9 +1,21 @@
1
1
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
2
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
3
  import composeClasses from '@mui/utils/composeClasses';
4
+
5
+ /**
6
+ * @deprecated Use `FunnelClasses` from `funnelClasses` instead.
7
+ */
8
+
9
+ /**
10
+ * @deprecated Use `getFunnelUtilityClass` from `funnelClasses` instead.
11
+ */
4
12
  function getFunnelSectionUtilityClass(slot) {
5
13
  return generateUtilityClass('MuiFunnelSection', slot);
6
14
  }
15
+
16
+ /**
17
+ * @deprecated Use `useUtilityClasses` from `funnelClasses` instead.
18
+ */
7
19
  export const useUtilityClasses = props => {
8
20
  const {
9
21
  classes,
@@ -21,6 +33,10 @@ export const useUtilityClasses = props => {
21
33
  };
22
34
  return composeClasses(slots, getFunnelSectionUtilityClass, classes);
23
35
  };
36
+
37
+ /**
38
+ * @deprecated Use `useUtilityClasses` from `funnelClasses` instead.
39
+ */
24
40
  export const useLabelUtilityClasses = props => {
25
41
  const {
26
42
  classes,
@@ -32,4 +48,8 @@ export const useLabelUtilityClasses = props => {
32
48
  };
33
49
  return composeClasses(slots, getFunnelSectionUtilityClass, classes);
34
50
  };
51
+
52
+ /**
53
+ * @deprecated Use `funnelClasses` from `funnelClasses` instead.
54
+ */
35
55
  export const funnelSectionClasses = generateUtilityClasses('MuiFunnelSection', ['root', 'highlighted', 'faded', 'filled', 'outlined', 'label', 'series', 'data-index']);
@@ -13,5 +13,7 @@ export * from "./FunnelChart.plugins.js";
13
13
  export type { FunnelCurveType } from "./curves/index.js";
14
14
  export { funnelSectionClasses } from "./funnelSectionClasses.js";
15
15
  export type { FunnelSectionClasses } from "./funnelSectionClasses.js";
16
+ export { funnelClasses } from "./funnelClasses.js";
17
+ export type { FunnelClassKey, FunnelClasses } from "./funnelClasses.js";
16
18
  export { FunnelSection } from "./FunnelSection.js";
17
19
  export { FunnelSectionLabel } from "./FunnelSectionLabel.js";
@@ -12,5 +12,6 @@ export * from "./categoryAxis.types.js";
12
12
  export * from "./funnelSlots.types.js";
13
13
  export * from "./FunnelChart.plugins.js";
14
14
  export { funnelSectionClasses } from "./funnelSectionClasses.js";
15
+ export { funnelClasses } from "./funnelClasses.js";
15
16
  export { FunnelSection } from "./FunnelSection.js";
16
17
  export { FunnelSectionLabel } from "./FunnelSectionLabel.js";
@@ -562,8 +562,8 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
562
562
  requiredKeys: PropTypes.arrayOf(PropTypes.string),
563
563
  type: PropTypes.oneOf(['doubleTapReset']).isRequired
564
564
  }), PropTypes.shape({
565
- pointerMode: PropTypes.any,
566
- requiredKeys: PropTypes.array,
565
+ pointerMode: PropTypes.oneOf(['mouse', 'touch']),
566
+ requiredKeys: PropTypes.arrayOf(PropTypes.string),
567
567
  type: PropTypes.oneOf(['brush']).isRequired
568
568
  })]).isRequired)
569
569
  })
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import type { SeriesId } from "../models/index.js";
3
+ import type { HeatmapClasses } from "./heatmapClasses.js";
4
+ export interface HeatmapCellOwnerState {
5
+ seriesId: SeriesId;
6
+ dataIndex: number;
7
+ color: string;
8
+ value: number;
9
+ isFaded: boolean;
10
+ isHighlighted: boolean;
11
+ classes?: Partial<HeatmapClasses>;
12
+ }
13
+ /**
14
+ * @deprecated Use `HeatmapCellOwnerState` instead.
15
+ */
16
+ export type HeatmapItemOwnerState = HeatmapCellOwnerState;
17
+ export interface HeatmapCellProps extends React.ComponentPropsWithRef<'rect'> {
18
+ x: number;
19
+ y: number;
20
+ width: number;
21
+ height: number;
22
+ ownerState: HeatmapCellOwnerState;
23
+ }
24
+ /**
25
+ * Demos:
26
+ *
27
+ * - [Heatmap](https://mui.com/x/react-charts/heatmap/)
28
+ *
29
+ * API:
30
+ *
31
+ * - [HeatmapCell API](https://mui.com/x/api/charts/heatmap-cell/)
32
+ */
33
+ declare const HeatmapCell: React.ForwardRefExoticComponent<Omit<HeatmapCellProps, "ref"> & React.RefAttributes<SVGRectElement>>;
34
+ export { HeatmapCell };
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { styled } from '@mui/material/styles';
7
+
8
+ /**
9
+ * @deprecated Use `HeatmapCellOwnerState` instead.
10
+ */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const HeatmapCellRoot = styled('rect', {
13
+ name: 'MuiHeatmap',
14
+ slot: 'Cell',
15
+ overridesResolver: (_, styles) => styles.cell
16
+ })(({
17
+ ownerState
18
+ }) => ({
19
+ filter: ownerState.isHighlighted && 'saturate(120%)' || ownerState.isFaded && 'saturate(80%)' || undefined,
20
+ fill: ownerState.color,
21
+ shapeRendering: 'crispEdges'
22
+ }));
23
+
24
+ /**
25
+ * Demos:
26
+ *
27
+ * - [Heatmap](https://mui.com/x/react-charts/heatmap/)
28
+ *
29
+ * API:
30
+ *
31
+ * - [HeatmapCell API](https://mui.com/x/api/charts/heatmap-cell/)
32
+ */
33
+ const HeatmapCell = /*#__PURE__*/React.forwardRef(function HeatmapCell(props, ref) {
34
+ return /*#__PURE__*/_jsx(HeatmapCellRoot, _extends({
35
+ ref: ref
36
+ }, props));
37
+ });
38
+ if (process.env.NODE_ENV !== "production") HeatmapCell.displayName = "HeatmapCell";
39
+ process.env.NODE_ENV !== "production" ? HeatmapCell.propTypes = {
40
+ // ----------------------------- Warning --------------------------------
41
+ // | These PropTypes are generated from the TypeScript type definitions |
42
+ // | To update them edit the TypeScript types and run "pnpm proptypes" |
43
+ // ----------------------------------------------------------------------
44
+ height: PropTypes.number.isRequired,
45
+ ownerState: PropTypes.shape({
46
+ classes: PropTypes.object,
47
+ color: PropTypes.string.isRequired,
48
+ dataIndex: PropTypes.number.isRequired,
49
+ isFaded: PropTypes.bool.isRequired,
50
+ isHighlighted: PropTypes.bool.isRequired,
51
+ seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
52
+ value: PropTypes.number.isRequired
53
+ }).isRequired,
54
+ width: PropTypes.number.isRequired,
55
+ x: PropTypes.number.isRequired,
56
+ y: PropTypes.number.isRequired
57
+ } : void 0;
58
+ export { HeatmapCell };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type SeriesId } from '@mui/x-charts/internals';
3
- import { type HeatmapItemOwnerState } from "./internals/HeatmapCell.js";
3
+ import { type HeatmapCellProps } from "./HeatmapCell.js";
4
4
  export interface HeatmapItemSlots {
5
5
  /**
6
6
  * The component that renders the heatmap cell.
@@ -33,13 +33,6 @@ export interface HeatmapItemProps {
33
33
  */
34
34
  slots?: HeatmapItemSlots;
35
35
  }
36
- export interface HeatmapCellProps extends React.ComponentPropsWithRef<'rect'> {
37
- x: number;
38
- y: number;
39
- width: number;
40
- height: number;
41
- ownerState: HeatmapItemOwnerState;
42
- }
43
36
  /**
44
37
  * @ignore - internal component.
45
38
  */
@@ -4,25 +4,11 @@ const _excluded = ["seriesId", "dataIndex", "color", "value", "isHighlighted", "
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import useSlotProps from '@mui/utils/useSlotProps';
7
- import composeClasses from '@mui/utils/composeClasses';
8
7
  import { useInteractionItemProps } from '@mui/x-charts/internals';
9
- import { getHeatmapUtilityClass } from "./heatmapClasses.js";
10
- import { HeatmapCell } from "./internals/HeatmapCell.js";
8
+ import { useUtilityClasses } from "./heatmapClasses.js";
9
+ import { HeatmapCell } from "./HeatmapCell.js";
11
10
  import { shouldRegisterPointerInteractionsGlobally } from "./shouldRegisterPointerInteractionsGlobally.js";
12
11
  import { jsx as _jsx } from "react/jsx-runtime";
13
- const useUtilityClasses = ownerState => {
14
- const {
15
- classes,
16
- seriesId,
17
- isFaded,
18
- isHighlighted
19
- } = ownerState;
20
- const slots = {
21
- cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
22
- };
23
- return composeClasses(slots, getHeatmapUtilityClass, classes);
24
- };
25
-
26
12
  /**
27
13
  * @ignore - internal component.
28
14
  */
@@ -51,9 +37,9 @@ function HeatmapItem(props) {
51
37
  seriesId,
52
38
  dataIndex,
53
39
  color,
54
- value,
55
40
  isFaded,
56
- isHighlighted
41
+ isHighlighted,
42
+ value
57
43
  };
58
44
  const classes = useUtilityClasses(ownerState);
59
45
  const Cell = slots?.cell ?? HeatmapCell;
@@ -73,7 +59,6 @@ process.env.NODE_ENV !== "production" ? HeatmapItem.propTypes = {
73
59
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
74
60
  // ----------------------------------------------------------------------
75
61
  color: PropTypes.string.isRequired,
76
- dataIndex: PropTypes.number.isRequired,
77
62
  height: PropTypes.number.isRequired,
78
63
  seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
79
64
  /**
@@ -1,4 +1,7 @@
1
+ import type { HeatmapCellOwnerState } from "./HeatmapCell.js";
1
2
  export interface HeatmapClasses {
3
+ /** Styles applied to the heatmap plot root element. */
4
+ root: string;
2
5
  /** Styles applied to the heatmap cells. */
3
6
  cell: string;
4
7
  /** Styles applied to the cell element if highlighted. */
@@ -8,9 +11,11 @@ export interface HeatmapClasses {
8
11
  /**
9
12
  * Styles applied to the root element for a specified series.
10
13
  * Needs to be suffixed with the series ID: `.${heatmapClasses.series}-${seriesId}`.
14
+ * @deprecated Use `[data-series="${seriesId}"]` selector instead.
11
15
  */
12
16
  series: string;
13
17
  }
14
18
  export type HeatmapClassKey = keyof HeatmapClasses;
15
19
  export declare function getHeatmapUtilityClass(slot: string): string;
16
- export declare const heatmapClasses: HeatmapClasses;
20
+ export declare const heatmapClasses: HeatmapClasses;
21
+ export declare const useUtilityClasses: (ownerState: HeatmapCellOwnerState) => Record<"cell" | "root", string>;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
+ import composeClasses from '@mui/utils/composeClasses';
3
4
  import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
4
5
  export function getHeatmapUtilityClass(slot) {
5
6
  // Those should be common to all charts
@@ -8,7 +9,20 @@ export function getHeatmapUtilityClass(slot) {
8
9
  }
9
10
  return generateUtilityClass('MuiHeatmap', slot);
10
11
  }
11
- export const heatmapClasses = _extends({}, generateUtilityClasses('MuiHeatmap', ['cell', 'series']), {
12
+ export const heatmapClasses = _extends({}, generateUtilityClasses('MuiHeatmap', ['root', 'cell', 'series']), {
12
13
  highlighted: 'Charts-highlighted',
13
14
  faded: 'Charts-faded'
14
- });
15
+ });
16
+ export const useUtilityClasses = ownerState => {
17
+ const {
18
+ classes,
19
+ seriesId,
20
+ isFaded,
21
+ isHighlighted
22
+ } = ownerState;
23
+ const slots = {
24
+ root: ['root'],
25
+ cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
26
+ };
27
+ return composeClasses(slots, getHeatmapUtilityClass, classes);
28
+ };
@@ -2,7 +2,9 @@ export { Heatmap } from "./Heatmap.js";
2
2
  export type { HeatmapSeries, HeatmapProps } from "./Heatmap.js";
3
3
  export { HeatmapPlot } from "./HeatmapPlot.js";
4
4
  export * from "./FocusedHeatmapCell.js";
5
- export type { HeatmapCellProps } from "./internals/HeatmapCell.js";
5
+ export { HeatmapCell } from "./HeatmapCell.js";
6
+ export type { HeatmapCellProps, HeatmapCellOwnerState } from "./HeatmapCell.js";
6
7
  export * from "./HeatmapTooltip/index.js";
7
8
  export * from "./Heatmap.plugins.js";
8
- export * from "./heatmapClasses.js";
9
+ export { heatmapClasses } from "./heatmapClasses.js";
10
+ export type { HeatmapClasses, HeatmapClassKey } from "./heatmapClasses.js";
@@ -1,6 +1,7 @@
1
1
  export { Heatmap } from "./Heatmap.js";
2
2
  export { HeatmapPlot } from "./HeatmapPlot.js";
3
3
  export * from "./FocusedHeatmapCell.js";
4
+ export { HeatmapCell } from "./HeatmapCell.js";
4
5
  export * from "./HeatmapTooltip/index.js";
5
6
  export * from "./Heatmap.plugins.js";
6
- export * from "./heatmapClasses.js";
7
+ export { heatmapClasses } from "./heatmapClasses.js";
@@ -1,4 +1,4 @@
1
- import { HeatmapCell } from "./internals/HeatmapCell.js";
1
+ import { HeatmapCell } from "./HeatmapCell.js";
2
2
 
3
3
  /* Global pointer interactions should be registered when we're using the default HeatmapCell.
4
4
  * We only want to return false when a custom slot is being used to avoid breaking changes.
@@ -1581,8 +1581,8 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
1581
1581
  requiredKeys: PropTypes.arrayOf(PropTypes.string),
1582
1582
  type: PropTypes.oneOf(['doubleTapReset']).isRequired
1583
1583
  }), PropTypes.shape({
1584
- pointerMode: PropTypes.any,
1585
- requiredKeys: PropTypes.array,
1584
+ pointerMode: PropTypes.oneOf(['mouse', 'touch']),
1585
+ requiredKeys: PropTypes.arrayOf(PropTypes.string),
1586
1586
  type: PropTypes.oneOf(['brush']).isRequired
1587
1587
  })]).isRequired)
1588
1588
  })
@@ -4,8 +4,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import useEventCallback from '@mui/utils/useEventCallback';
6
6
  import { useInteractionItemProps, useStore } from '@mui/x-charts/internals';
7
- import { selectorIsLinkHighlighted } from "./plugins/index.js";
8
- import { selectorIsSankeyItemFaded } from "./plugins/useSankeyHighlight.selectors.js";
7
+ import { selectorIsLinkHighlighted, selectorIsSankeyItemFaded } from "./plugins/useSankeyHighlight.selectors.js";
8
+ import { useUtilityClasses } from "./sankeyClasses.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  /**
11
11
  * @ignore - internal component.
@@ -31,6 +31,7 @@ export const SankeyLinkElement = /*#__PURE__*/React.forwardRef(function SankeyLi
31
31
 
32
32
  // Add interaction props for tooltips
33
33
  const interactionProps = useInteractionItemProps(identifier);
34
+ const classes = useUtilityClasses();
34
35
  const handleClick = useEventCallback(event => {
35
36
  onClick?.(event, identifier);
36
37
  });
@@ -45,6 +46,7 @@ export const SankeyLinkElement = /*#__PURE__*/React.forwardRef(function SankeyLi
45
46
  }
46
47
  return /*#__PURE__*/_jsx("path", _extends({
47
48
  ref: ref,
49
+ className: classes.link,
48
50
  d: link.path,
49
51
  fill: link.color,
50
52
  opacity: finalOpacity,
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import { useTheme } from '@mui/material/styles';
5
5
  import { useSankeySeries } from "../hooks/useSankeySeries.js";
6
+ import { useUtilityClasses } from "./sankeyClasses.js";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  const getLinkMidpoint = link => {
8
9
  if (link.y0 === undefined || link.y1 === undefined) {
@@ -32,6 +33,7 @@ export const SankeyLinkLabel = /*#__PURE__*/React.forwardRef(function SankeyLink
32
33
  } = props;
33
34
  const theme = useTheme();
34
35
  const series = useSankeySeries()[0];
36
+ const classes = useUtilityClasses();
35
37
  if (!link.path || link.y0 === undefined || link.y1 === undefined) {
36
38
  return null; // No path defined or invalid coordinates, nothing to render
37
39
  }
@@ -46,6 +48,7 @@ export const SankeyLinkLabel = /*#__PURE__*/React.forwardRef(function SankeyLink
46
48
  }) : link.value;
47
49
  return /*#__PURE__*/_jsx("text", {
48
50
  ref: ref,
51
+ className: classes.linkLabel,
49
52
  x: midpoint.x,
50
53
  y: midpoint.y,
51
54
  textAnchor: "middle",
@@ -20,4 +20,4 @@ export interface SankeyNodeElementProps {
20
20
  /**
21
21
  * @ignore - internal component.
22
22
  */
23
- export declare const SankeyNodeElement: React.ForwardRefExoticComponent<SankeyNodeElementProps & React.RefAttributes<SVGGElement>>;
23
+ export declare const SankeyNodeElement: React.ForwardRefExoticComponent<SankeyNodeElementProps & React.RefAttributes<SVGRectElement>>;
@@ -4,8 +4,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import useEventCallback from '@mui/utils/useEventCallback';
6
6
  import { useInteractionItemProps, useStore } from '@mui/x-charts/internals';
7
- import { selectorIsNodeHighlighted } from "./plugins/index.js";
8
- import { selectorIsSankeyItemFaded } from "./plugins/useSankeyHighlight.selectors.js";
7
+ import { selectorIsNodeHighlighted, selectorIsSankeyItemFaded } from "./plugins/useSankeyHighlight.selectors.js";
8
+ import { useUtilityClasses } from "./sankeyClasses.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  /**
11
11
  * @ignore - internal component.
@@ -35,6 +35,7 @@ export const SankeyNodeElement = /*#__PURE__*/React.forwardRef(function SankeyNo
35
35
 
36
36
  // Add interaction props for tooltips
37
37
  const interactionProps = useInteractionItemProps(identifier);
38
+ const classes = useUtilityClasses();
38
39
  const handleClick = useEventCallback(event => {
39
40
  onClick?.(event, identifier);
40
41
  });
@@ -58,7 +59,8 @@ export const SankeyNodeElement = /*#__PURE__*/React.forwardRef(function SankeyNo
58
59
  cursor: onClick ? 'pointer' : 'default',
59
60
  stroke: "none",
60
61
  "data-highlighted": isHighlighted || undefined,
61
- "data-faded": isFaded || undefined
62
+ "data-faded": isFaded || undefined,
63
+ className: classes.node
62
64
  }, interactionProps))
63
65
  });
64
66
  });
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import { useTheme } from '@mui/material/styles';
5
5
  import { useSankeyNodeHighlightState } from "./sankeyHighlightHooks.js";
6
+ import { useUtilityClasses } from "./sankeyClasses.js";
6
7
  import { jsx as _jsx } from "react/jsx-runtime";
7
8
  /**
8
9
  * @ignore - internal component.
@@ -23,6 +24,7 @@ export const SankeyNodeLabel = /*#__PURE__*/React.forwardRef(function SankeyNode
23
24
  : x0 - 6; // Left side for other columns
24
25
 
25
26
  const labelAnchor = isRightSide ? 'start' : 'end';
27
+ const classes = useUtilityClasses();
26
28
  const highlightState = useSankeyNodeHighlightState(node.id);
27
29
  let opacity = 1;
28
30
  if (highlightState === 'faded') {
@@ -35,6 +37,7 @@ export const SankeyNodeLabel = /*#__PURE__*/React.forwardRef(function SankeyNode
35
37
  }
36
38
  return /*#__PURE__*/_jsx("text", {
37
39
  ref: ref,
40
+ className: classes.nodeLabel,
38
41
  x: labelX,
39
42
  y: (y0 + y1) / 2,
40
43
  textAnchor: labelAnchor,
@@ -11,8 +11,8 @@ import { SankeyNodeLabelPlot } from "./SankeyNodeLabelPlot.js";
11
11
  import { SankeyLinkLabelPlot } from "./SankeyLinkLabelPlot.js";
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  const SankeyPlotRoot = styled('g', {
14
- slot: 'internal',
15
- shouldForwardProp: undefined
14
+ name: 'MuiSankeyPlot',
15
+ slot: 'Root'
16
16
  })({});
17
17
 
18
18
  /**
@@ -12,6 +12,7 @@ export * from "./sankey.types.js";
12
12
  export * from "./sankeySlots.types.js";
13
13
  export * from "./sankeyHighlightHooks.js";
14
14
  export * from "../hooks/useSankeySeries.js";
15
- export { type SankeyPlotClasses, sankeyPlotClasses } from "./sankeyClasses.js";
15
+ export { type SankeyPlotClasses, sankeyPlotClasses, sankeyClasses } from "./sankeyClasses.js";
16
+ export type { SankeyClassKey, SankeyClasses } from "./sankeyClasses.js";
16
17
  export { SankeyTooltip, SankeyTooltipContent } from "./SankeyTooltip/index.js";
17
18
  export type { SankeyTooltipProps } from "./SankeyTooltip/index.js";
@@ -11,5 +11,5 @@ export * from "./sankey.types.js";
11
11
  export * from "./sankeySlots.types.js";
12
12
  export * from "./sankeyHighlightHooks.js";
13
13
  export * from "../hooks/useSankeySeries.js";
14
- export { sankeyPlotClasses } from "./sankeyClasses.js";
14
+ export { sankeyPlotClasses, sankeyClasses } from "./sankeyClasses.js";
15
15
  export { SankeyTooltip, SankeyTooltipContent } from "./SankeyTooltip/index.js";
@@ -1,4 +1,4 @@
1
- export interface SankeyPlotClasses {
1
+ export interface SankeyClasses {
2
2
  /** Styles applied to the root element. */
3
3
  root: string;
4
4
  /** Styles applied to the nodes container. */
@@ -9,9 +9,30 @@ export interface SankeyPlotClasses {
9
9
  links: string;
10
10
  /** Styles applied to the link label container. */
11
11
  linkLabels: string;
12
+ /** Styles applied to an individual node element. */
13
+ node: string;
14
+ /** Styles applied to an individual link element. */
15
+ link: string;
16
+ /** Styles applied to an individual node label element. */
17
+ nodeLabel: string;
18
+ /** Styles applied to an individual link label element. */
19
+ linkLabel: string;
12
20
  }
13
- export declare function getSankeyPlotUtilityClass(slot: string): string;
14
- export declare const sankeyPlotClasses: SankeyPlotClasses;
15
- export declare const useUtilityClasses: (ownerState: {
16
- classes?: Partial<SankeyPlotClasses>;
17
- }) => Record<"nodes" | "links" | "root" | "nodeLabels" | "linkLabels", string>;
21
+ export type SankeyClassKey = keyof SankeyClasses;
22
+ /**
23
+ * @deprecated Use `SankeyClasses` instead.
24
+ */
25
+ export type SankeyPlotClasses = SankeyClasses;
26
+ export declare function getSankeyUtilityClass(slot: string): string;
27
+ /**
28
+ * @deprecated Use `getSankeyUtilityClass` instead.
29
+ */
30
+ export declare const getSankeyPlotUtilityClass: typeof getSankeyUtilityClass;
31
+ export declare const sankeyClasses: SankeyClasses;
32
+ /**
33
+ * @deprecated Use `sankeyClasses` instead.
34
+ */
35
+ export declare const sankeyPlotClasses: SankeyClasses;
36
+ export declare const useUtilityClasses: (options?: {
37
+ classes?: Partial<SankeyClasses>;
38
+ }) => Record<"nodes" | "links" | "node" | "link" | "root" | "nodeLabels" | "linkLabels" | "nodeLabel" | "linkLabel", string>;