@mui/x-charts 8.19.0 → 8.20.0

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 (50) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/ChartsGrid/ChartsHorizontalGrid.js +5 -1
  3. package/ChartsGrid/ChartsVerticalGrid.js +5 -1
  4. package/ChartsTooltip/ChartsTooltipContainer.js +1 -1
  5. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +2 -2
  6. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +2 -2
  7. package/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.d.ts +7 -0
  8. package/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.js +26 -0
  9. package/esm/ChartsGrid/ChartsHorizontalGrid.js +5 -1
  10. package/esm/ChartsGrid/ChartsVerticalGrid.js +5 -1
  11. package/esm/ChartsTooltip/ChartsTooltipContainer.js +1 -1
  12. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +1 -1
  13. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +1 -1
  14. package/esm/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.d.ts +7 -0
  15. package/esm/RadarChart/RadarSeriesPlot/useInteractionAllItemProps.js +18 -0
  16. package/esm/hooks/useInteractionItemProps.d.ts +0 -5
  17. package/esm/hooks/useInteractionItemProps.js +0 -11
  18. package/esm/hooks/useTicks.js +12 -3
  19. package/esm/index.js +1 -1
  20. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +16 -10
  21. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.js +20 -12
  22. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +5 -7
  23. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +11 -4
  24. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +13 -4
  25. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -2
  26. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +16 -12
  27. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -5
  28. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +4 -0
  29. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +1 -1
  30. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +1 -1
  31. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +15 -10
  32. package/esm/internals/seriesSelectorOfType.d.ts +1 -1
  33. package/hooks/useInteractionItemProps.d.ts +0 -5
  34. package/hooks/useInteractionItemProps.js +1 -13
  35. package/hooks/useTicks.js +12 -3
  36. package/index.js +1 -1
  37. package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +16 -10
  38. package/internals/plugins/corePlugins/useChartSeries/processSeries.js +23 -14
  39. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +4 -6
  40. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +11 -4
  41. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +13 -4
  42. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -2
  43. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +16 -12
  44. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -5
  45. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.types.d.ts +4 -0
  46. package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.d.ts +1 -1
  47. package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +1 -1
  48. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +15 -10
  49. package/internals/seriesSelectorOfType.d.ts +1 -1
  50. package/package.json +3 -3
@@ -9,12 +9,12 @@ var _createIsHighlighted = require("./createIsHighlighted");
9
9
  var _createIsFaded = require("./createIsFaded");
10
10
  var _highlightStates = require("./highlightStates");
11
11
  var _useChartKeyboardNavigation = require("../useChartKeyboardNavigation");
12
+ var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
12
13
  const selectHighlight = state => state.highlight;
13
- const selectSeries = state => state.series;
14
- const selectorChartsHighlightScopePerSeriesId = exports.selectorChartsHighlightScopePerSeriesId = (0, _store.createSelector)(selectSeries, series => {
14
+ const selectorChartsHighlightScopePerSeriesId = exports.selectorChartsHighlightScopePerSeriesId = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, processedSeries => {
15
15
  const map = new Map();
16
- Object.keys(series.processedSeries).forEach(seriesType => {
17
- const seriesData = series.processedSeries[seriesType];
16
+ Object.keys(processedSeries).forEach(seriesType => {
17
+ const seriesData = processedSeries[seriesType];
18
18
  seriesData?.seriesOrder?.forEach(seriesId => {
19
19
  const seriesItem = seriesData?.series[seriesId];
20
20
  map.set(seriesId, seriesItem?.highlightScope);
@@ -23,7 +23,7 @@ const selectorChartsHighlightScopePerSeriesId = exports.selectorChartsHighlightS
23
23
  return map;
24
24
  });
25
25
  const selectorChartsHighlightedItem = exports.selectorChartsHighlightedItem = (0, _store.createSelectorMemoized)(selectHighlight, _useChartKeyboardNavigation.selectorChartsKeyboardItem, function selectorChartsHighlightedItem(highlight, keyboardItem) {
26
- return highlight.lastUpdate === 'pointer' ? highlight.item : keyboardItem;
26
+ return highlight.isControlled || highlight.lastUpdate === 'pointer' ? highlight.item : keyboardItem;
27
27
  });
28
28
  const selectorChartsHighlightScope = exports.selectorChartsHighlightScope = (0, _store.createSelector)(selectorChartsHighlightScopePerSeriesId, selectorChartsHighlightedItem, function selectorChartsHighlightScope(seriesIdToHighlightScope, highlightedItem) {
29
29
  if (!highlightedItem) {
@@ -56,6 +56,10 @@ export interface UseChartHighlightParameters {
56
56
  export type UseChartHighlightDefaultizedParameters = DefaultizedProps<UseChartHighlightParameters, 'highlightedItem'>;
57
57
  export interface UseChartHighlightState {
58
58
  highlight: {
59
+ /**
60
+ * Indicates if the highlighted item is controlled.
61
+ */
62
+ isControlled: boolean;
59
63
  /**
60
64
  * The item currently highlighted.
61
65
  */
@@ -6,7 +6,7 @@ export declare const selectorChartsTooltipItemIsDefined: (args_0: import("../../
6
6
  }) => boolean;
7
7
  export declare const selectorChartsTooltipItemPosition: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartInteraction.types.js").UseChartInteractionState> & {
8
8
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
9
- }) => {
9
+ }, placement?: "bottom" | "left" | "right" | "top" | undefined) => {
10
10
  x: number;
11
11
  y: number;
12
12
  } | null;
@@ -13,7 +13,7 @@ var _useChartDimensions = require("../../corePlugins/useChartDimensions/useChart
13
13
  var _isCartesian = require("../../../isCartesian");
14
14
  const selectorChartsTooltipItem = exports.selectorChartsTooltipItem = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, _useChartInteraction.selectorChartsInteractionItem, _useChartKeyboardNavigation.selectorChartsKeyboardItem, (lastInteraction, interactionItem, keyboardItem) => lastInteraction === 'keyboard' ? keyboardItem : interactionItem ?? null);
15
15
  const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, _useChartInteraction.selectorChartsInteractionItemIsDefined, _useChartKeyboardNavigation.selectorChartsKeyboardItemIsDefined, (lastInteraction, interactionItemIsDefined, keyboardItemIsDefined) => lastInteraction === 'keyboard' ? keyboardItemIsDefined : interactionItemIsDefined);
16
- const selectorChartsTooltipItemPosition = exports.selectorChartsTooltipItemPosition = (0, _store.createSelector)(selectorChartsTooltipItem, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartSeries.selectorChartSeriesProcessed, (_, placement) => placement, function selectorChartsTooltipItemPosition(identifier, drawingArea, seriesConfig, {
16
+ const selectorChartsTooltipItemPosition = exports.selectorChartsTooltipItemPosition = (0, _store.createSelector)(selectorChartsTooltipItem, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartSeries.selectorChartSeriesProcessed, function selectorChartsTooltipItemPosition(identifier, drawingArea, seriesConfig, {
17
17
  axis: xAxis,
18
18
  axisIds: xAxisIds
19
19
  }, {
@@ -12,22 +12,24 @@ var React = _interopRequireWildcard(require("react"));
12
12
  var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
13
13
  var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
14
14
  var _useChartKeyboardNavigation = require("./useChartKeyboardNavigation.helpers");
15
+ var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
15
16
  function getNextIndexFocusedItem(state) {
17
+ const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
16
18
  let {
17
19
  type,
18
20
  seriesId
19
21
  } = state.keyboardNavigation.item ?? {};
20
22
  if (type === undefined ||
21
23
  // @ts-ignore sankey is not in MIT version
22
- type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(state.series.processedSeries, type, seriesId)) {
23
- const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(state.series.processedSeries, type, seriesId);
24
+ type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(processedSeries, type, seriesId)) {
25
+ const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(processedSeries, type, seriesId);
24
26
  if (nextSeries === null) {
25
27
  return null;
26
28
  }
27
29
  type = nextSeries.type;
28
30
  seriesId = nextSeries.seriesId;
29
31
  }
30
- const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
32
+ const dataLength = processedSeries[type].series[seriesId].data.length;
31
33
  return {
32
34
  type,
33
35
  seriesId,
@@ -35,21 +37,22 @@ function getNextIndexFocusedItem(state) {
35
37
  };
36
38
  }
37
39
  function getPreviousIndexFocusedItem(state) {
40
+ const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
38
41
  let {
39
42
  type,
40
43
  seriesId
41
44
  } = state.keyboardNavigation.item ?? {};
42
45
  if (type === undefined ||
43
46
  // @ts-ignore sankey is not in MIT version
44
- type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(state.series.processedSeries, type, seriesId)) {
45
- const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(state.series.processedSeries, type, seriesId);
47
+ type === 'sankey' || seriesId === undefined || !(0, _useChartKeyboardNavigation.seriesHasData)(processedSeries, type, seriesId)) {
48
+ const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(processedSeries, type, seriesId);
46
49
  if (previousSeries === null) {
47
50
  return null;
48
51
  }
49
52
  type = previousSeries.type;
50
53
  seriesId = previousSeries.seriesId;
51
54
  }
52
- const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
55
+ const dataLength = processedSeries[type].series[seriesId].data.length;
53
56
  return {
54
57
  type,
55
58
  seriesId,
@@ -57,17 +60,18 @@ function getPreviousIndexFocusedItem(state) {
57
60
  };
58
61
  }
59
62
  function getNextSeriesFocusedItem(state) {
63
+ const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
60
64
  let {
61
65
  type,
62
66
  seriesId
63
67
  } = state.keyboardNavigation.item ?? {};
64
- const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(state.series.processedSeries, type, seriesId);
68
+ const nextSeries = (0, _useChartKeyboardNavigation.getNextSeriesWithData)(processedSeries, type, seriesId);
65
69
  if (nextSeries === null) {
66
70
  return null; // No series to move the focus to.
67
71
  }
68
72
  type = nextSeries.type;
69
73
  seriesId = nextSeries.seriesId;
70
- const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
74
+ const dataLength = processedSeries[type].series[seriesId].data.length;
71
75
  return {
72
76
  type,
73
77
  seriesId,
@@ -75,17 +79,18 @@ function getNextSeriesFocusedItem(state) {
75
79
  };
76
80
  }
77
81
  function getPreviousSeriesFocusedItem(state) {
82
+ const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
78
83
  let {
79
84
  type,
80
85
  seriesId
81
86
  } = state.keyboardNavigation.item ?? {};
82
- const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(state.series.processedSeries, type, seriesId);
87
+ const previousSeries = (0, _useChartKeyboardNavigation.getPreviousSeriesWithData)(processedSeries, type, seriesId);
83
88
  if (previousSeries === null) {
84
89
  return null; // No series to move the focus to.
85
90
  }
86
91
  type = previousSeries.type;
87
92
  seriesId = previousSeries.seriesId;
88
- const dataLength = state.series.processedSeries[type].series[seriesId].data.length;
93
+ const dataLength = processedSeries[type].series[seriesId].data.length;
89
94
  return {
90
95
  type,
91
96
  seriesId,
@@ -15,6 +15,6 @@ export declare const selectorAllSeriesOfType: (args_0: import("./plugins/corePlu
15
15
  } | undefined;
16
16
  export declare const selectorSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./index.js").UseChartInteractionListenerState & Partial<{}> & {
17
17
  cacheKey: import("./index.js").ChartStateCacheKey;
18
- }, seriesType: keyof ChartsSeriesConfig, ids?: SeriesId | SeriesId[] | undefined) => import("../index.js").DefaultizedLineSeriesType | import("../index.js").DefaultizedBarSeriesType | import("../index.js").DefaultizedRadarSeriesType | import("../index.js").DefaultizedScatterSeriesType | import("../index.js").DefaultizedPieSeriesType | (import("../index.js").DefaultizedLineSeriesType | import("../index.js").DefaultizedBarSeriesType | import("../index.js").DefaultizedRadarSeriesType | import("../index.js").DefaultizedScatterSeriesType | import("../index.js").DefaultizedPieSeriesType | undefined)[] | undefined;
18
+ }, seriesType: keyof ChartsSeriesConfig, ids?: SeriesId | SeriesId[] | undefined) => import("../index.js").DefaultizedRadarSeriesType | import("../index.js").DefaultizedLineSeriesType | import("../index.js").DefaultizedBarSeriesType | import("../index.js").DefaultizedScatterSeriesType | import("../index.js").DefaultizedPieSeriesType | (import("../index.js").DefaultizedRadarSeriesType | import("../index.js").DefaultizedLineSeriesType | import("../index.js").DefaultizedBarSeriesType | import("../index.js").DefaultizedScatterSeriesType | import("../index.js").DefaultizedPieSeriesType | undefined)[] | undefined;
19
19
  export declare const useAllSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T) => ProcessedSeries[T];
20
20
  export declare const useSeriesOfType: <T extends keyof ChartsSeriesConfig>(seriesType: T, seriesId?: SeriesId | SeriesId[]) => ChartSeriesDefaultized<T> | ChartSeriesDefaultized<T>[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "8.19.0",
3
+ "version": "8.20.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The community edition of MUI X Charts components.",
6
6
  "license": "MIT",
@@ -35,9 +35,9 @@
35
35
  "prop-types": "^15.8.1",
36
36
  "reselect": "^5.1.1",
37
37
  "use-sync-external-store": "^1.6.0",
38
- "@mui/x-charts-vendor": "8.19.0",
38
+ "@mui/x-internals": "8.19.0",
39
39
  "@mui/x-internal-gestures": "0.3.6",
40
- "@mui/x-internals": "8.19.0"
40
+ "@mui/x-charts-vendor": "8.19.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "@emotion/react": "^11.9.0",