@mui/x-charts 8.22.0 → 8.23.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 (238) hide show
  1. package/BarChart/BarElement.js +1 -1
  2. package/BarChart/BarLabel/BarLabel.types.d.ts +3 -3
  3. package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
  4. package/BarChart/BarLabel/BarLabelPlot.d.ts +9 -9
  5. package/BarChart/BarLabel/getBarLabel.d.ts +3 -3
  6. package/BarChart/FocusedBar.js +1 -1
  7. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
  8. package/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
  9. package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +23 -0
  10. package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -2
  11. package/BarChart/seriesConfig/index.js +3 -1
  12. package/CHANGELOG.md +202 -0
  13. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -3
  14. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -3
  15. package/ChartsBrushOverlay/ChartsBrushOverlay.js +6 -7
  16. package/ChartsSurface/ChartsSurface.js +7 -8
  17. package/ChartsTooltip/ChartsTooltipContainer.js +4 -5
  18. package/ChartsTooltip/useAxisTooltip.js +3 -4
  19. package/ChartsTooltip/useItemTooltip.js +2 -3
  20. package/ChartsWrapper/ChartsWrapper.js +2 -3
  21. package/LineChart/FocusedLineMark.js +1 -1
  22. package/LineChart/LineHighlightPlot.js +1 -2
  23. package/LineChart/MarkPlot.js +1 -2
  24. package/LineChart/seriesConfig/index.js +3 -1
  25. package/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  26. package/LineChart/seriesConfig/keyboardFocusHandler.js +23 -0
  27. package/LineChart/seriesConfig/seriesProcessor.js +2 -2
  28. package/PieChart/FocusedPieArc.d.ts +2 -0
  29. package/PieChart/FocusedPieArc.js +58 -0
  30. package/PieChart/PieArcPlot.js +3 -31
  31. package/PieChart/PieChart.js +2 -1
  32. package/PieChart/dataTransform/getModifiedArcProperties.d.ts +11 -0
  33. package/PieChart/dataTransform/getModifiedArcProperties.js +42 -0
  34. package/PieChart/dataTransform/useTransformData.js +16 -21
  35. package/PieChart/seriesConfig/index.js +3 -1
  36. package/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  37. package/PieChart/seriesConfig/keyboardFocusHandler.js +23 -0
  38. package/PieChart/seriesConfig/tooltipPosition.js +11 -20
  39. package/RadarChart/RadarAxis/useRadarAxis.js +1 -2
  40. package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +3 -4
  41. package/RadarChart/RadarGrid/useRadarGridData.js +1 -2
  42. package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -2
  43. package/ScatterChart/BatchScatter.js +4 -5
  44. package/ScatterChart/FocusedScatterMark.js +1 -1
  45. package/ScatterChart/Scatter.js +1 -2
  46. package/ScatterChart/seriesConfig/index.js +3 -1
  47. package/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  48. package/ScatterChart/seriesConfig/keyboardFocusHandler.js +23 -0
  49. package/esm/BarChart/BarElement.js +1 -1
  50. package/esm/BarChart/BarLabel/BarLabel.types.d.ts +3 -3
  51. package/esm/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
  52. package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +9 -9
  53. package/esm/BarChart/BarLabel/getBarLabel.d.ts +3 -3
  54. package/esm/BarChart/FocusedBar.js +1 -1
  55. package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +18 -1
  56. package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
  57. package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.js +17 -0
  58. package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +1 -1
  59. package/esm/BarChart/seriesConfig/index.js +3 -1
  60. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +2 -3
  61. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +2 -3
  62. package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +6 -7
  63. package/esm/ChartsSurface/ChartsSurface.js +7 -8
  64. package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -5
  65. package/esm/ChartsTooltip/useAxisTooltip.js +3 -4
  66. package/esm/ChartsTooltip/useItemTooltip.js +2 -3
  67. package/esm/ChartsWrapper/ChartsWrapper.js +2 -3
  68. package/esm/LineChart/FocusedLineMark.js +1 -1
  69. package/esm/LineChart/LineHighlightPlot.js +1 -2
  70. package/esm/LineChart/MarkPlot.js +1 -2
  71. package/esm/LineChart/seriesConfig/index.js +3 -1
  72. package/esm/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  73. package/esm/LineChart/seriesConfig/keyboardFocusHandler.js +17 -0
  74. package/esm/LineChart/seriesConfig/seriesProcessor.js +1 -1
  75. package/esm/PieChart/FocusedPieArc.d.ts +2 -0
  76. package/esm/PieChart/FocusedPieArc.js +51 -0
  77. package/esm/PieChart/PieArcPlot.js +5 -33
  78. package/esm/PieChart/PieChart.js +2 -1
  79. package/esm/PieChart/dataTransform/getModifiedArcProperties.d.ts +11 -0
  80. package/esm/PieChart/dataTransform/getModifiedArcProperties.js +36 -0
  81. package/esm/PieChart/dataTransform/useTransformData.js +16 -21
  82. package/esm/PieChart/seriesConfig/index.js +3 -1
  83. package/esm/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  84. package/esm/PieChart/seriesConfig/keyboardFocusHandler.js +17 -0
  85. package/esm/PieChart/seriesConfig/tooltipPosition.js +11 -20
  86. package/esm/RadarChart/RadarAxis/useRadarAxis.js +1 -2
  87. package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +3 -4
  88. package/esm/RadarChart/RadarGrid/useRadarGridData.js +1 -2
  89. package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -2
  90. package/esm/ScatterChart/BatchScatter.js +4 -5
  91. package/esm/ScatterChart/FocusedScatterMark.js +1 -1
  92. package/esm/ScatterChart/Scatter.js +1 -2
  93. package/esm/ScatterChart/seriesConfig/index.js +3 -1
  94. package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
  95. package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.js +17 -0
  96. package/esm/hooks/useAxis.js +8 -9
  97. package/esm/hooks/useAxisSystem.js +2 -3
  98. package/esm/hooks/useBrush.js +1 -2
  99. package/esm/hooks/useChartId.js +1 -2
  100. package/esm/hooks/useDataset.js +1 -2
  101. package/esm/hooks/useDrawingArea.js +1 -2
  102. package/esm/hooks/useFocusedItem.d.ts +1 -12
  103. package/esm/hooks/useFocusedItem.js +3 -11
  104. package/esm/hooks/useInteractionItemProps.d.ts +3 -2
  105. package/esm/hooks/useInteractionItemProps.js +13 -2
  106. package/esm/hooks/useIsItemFocused.d.ts +4 -3
  107. package/esm/hooks/useIsItemFocused.js +2 -3
  108. package/esm/hooks/useIsItemFocusedGetter.d.ts +3 -2
  109. package/esm/hooks/useIsItemFocusedGetter.js +2 -1
  110. package/esm/hooks/useItemHighlighted.js +2 -3
  111. package/esm/hooks/useItemHighlightedGetter.js +2 -3
  112. package/esm/hooks/useLegend.js +1 -2
  113. package/esm/hooks/usePieSeries.js +1 -2
  114. package/esm/hooks/useSeries.js +1 -2
  115. package/esm/hooks/useSkipAnimation.js +1 -2
  116. package/esm/hooks/useZAxis.js +1 -2
  117. package/esm/index.js +1 -1
  118. package/esm/internals/commonNextFocusItem.d.ts +14 -0
  119. package/esm/internals/commonNextFocusItem.js +84 -0
  120. package/esm/internals/index.d.ts +1 -2
  121. package/esm/internals/index.js +1 -2
  122. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -2
  123. package/esm/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +1 -2
  124. package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +1 -2
  125. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +5 -6
  126. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js +1 -2
  127. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +5 -6
  128. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +4 -1
  129. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
  130. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +1 -0
  131. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
  132. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +12 -105
  133. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
  134. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -15
  135. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
  136. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
  137. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +45 -0
  138. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
  139. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +40 -0
  140. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +6 -7
  141. package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -9
  142. package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +2 -2
  143. package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
  144. package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
  145. package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  146. package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
  147. package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
  148. package/esm/internals/seriesHasData.d.ts +4 -0
  149. package/esm/internals/seriesHasData.js +8 -0
  150. package/esm/internals/seriesSelectorOfType.js +2 -3
  151. package/esm/internals/stacking/index.d.ts +1 -0
  152. package/esm/internals/stacking/index.js +1 -0
  153. package/esm/internals/stacking/offset/index.d.ts +1 -0
  154. package/esm/internals/stacking/offset/index.js +1 -0
  155. package/esm/internals/stacking/offset/offsetDiverging.d.ts +8 -0
  156. package/esm/internals/stacking/offset/offsetDiverging.js +47 -0
  157. package/esm/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
  158. package/esm/internals/{stackSeries.js → stacking/stackSeries.js} +8 -6
  159. package/esm/models/seriesType/config.d.ts +0 -2
  160. package/esm/models/seriesType/index.d.ts +3 -1
  161. package/hooks/useAxis.js +8 -9
  162. package/hooks/useAxisSystem.js +2 -3
  163. package/hooks/useBrush.js +1 -2
  164. package/hooks/useChartId.js +1 -2
  165. package/hooks/useDataset.js +1 -2
  166. package/hooks/useDrawingArea.js +1 -2
  167. package/hooks/useFocusedItem.d.ts +1 -12
  168. package/hooks/useFocusedItem.js +1 -11
  169. package/hooks/useInteractionItemProps.d.ts +3 -2
  170. package/hooks/useInteractionItemProps.js +13 -2
  171. package/hooks/useIsItemFocused.d.ts +4 -3
  172. package/hooks/useIsItemFocused.js +2 -3
  173. package/hooks/useIsItemFocusedGetter.d.ts +3 -2
  174. package/hooks/useIsItemFocusedGetter.js +2 -1
  175. package/hooks/useItemHighlighted.js +2 -3
  176. package/hooks/useItemHighlightedGetter.js +2 -3
  177. package/hooks/useLegend.js +1 -2
  178. package/hooks/usePieSeries.js +1 -2
  179. package/hooks/useSeries.js +1 -2
  180. package/hooks/useSkipAnimation.js +1 -2
  181. package/hooks/useZAxis.js +1 -2
  182. package/index.js +1 -1
  183. package/internals/commonNextFocusItem.d.ts +14 -0
  184. package/internals/commonNextFocusItem.js +93 -0
  185. package/internals/index.d.ts +1 -2
  186. package/internals/index.js +4 -16
  187. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -2
  188. package/internals/plugins/corePlugins/useChartSeries/useColorProcessor.js +1 -2
  189. package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +1 -2
  190. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +5 -6
  191. package/internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js +1 -2
  192. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +5 -6
  193. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +4 -1
  194. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
  195. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +5 -0
  196. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
  197. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +11 -104
  198. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
  199. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -16
  200. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
  201. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
  202. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +51 -0
  203. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
  204. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +46 -0
  205. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +6 -7
  206. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -9
  207. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +1 -1
  208. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.types.d.ts +7 -6
  209. package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +2 -0
  210. package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  211. package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +4 -3
  212. package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +3 -2
  213. package/internals/seriesHasData.d.ts +4 -0
  214. package/internals/seriesHasData.js +14 -0
  215. package/internals/seriesSelectorOfType.js +2 -3
  216. package/internals/stacking/index.d.ts +1 -0
  217. package/internals/stacking/index.js +16 -0
  218. package/internals/stacking/offset/index.d.ts +1 -0
  219. package/internals/stacking/offset/index.js +16 -0
  220. package/internals/stacking/offset/offsetDiverging.d.ts +8 -0
  221. package/internals/stacking/offset/offsetDiverging.js +53 -0
  222. package/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
  223. package/internals/{stackSeries.js → stacking/stackSeries.js} +3 -1
  224. package/models/seriesType/config.d.ts +0 -2
  225. package/models/seriesType/index.d.ts +3 -1
  226. package/package.json +4 -4
  227. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
  228. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -4
  229. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
  230. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -92
  231. package/esm/internals/store/useSelector.d.ts +0 -2
  232. package/esm/internals/store/useSelector.js +0 -2
  233. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
  234. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -10
  235. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
  236. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -99
  237. package/internals/store/useSelector.d.ts +0 -2
  238. package/internals/store/useSelector.js +0 -8
@@ -6,15 +6,7 @@ export declare const selectorChartsTooltipPointerItemIsDefined: (args_0: import(
6
6
  }) => boolean;
7
7
  export declare const selectorChartsTooltipItem: (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/useChartInteraction.types.js").UseChartInteractionState> & {
8
8
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
9
- }) => import("../../../../index.js").PieItemIdentifier | {
10
- type: "bar";
11
- seriesId: import("../../../index.js").SeriesId;
12
- dataIndex: number;
13
- } | {
14
- type: "scatter";
15
- seriesId: import("../../../index.js").SeriesId;
16
- dataIndex: number;
17
- } | import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
9
+ }) => import("../../../../index.js").PieItemIdentifier | import("../../../../index.js").LineItemIdentifier | import("../../../../index.js").BarItemIdentifier | import("../../../../index.js").ScatterItemIdentifier | import("../../../../index.js").RadarItemIdentifier | null;
18
10
  export declare const selectorChartsTooltipItemIsDefined: (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/useChartInteraction.types.js").UseChartInteractionState> & {
19
11
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
20
12
  }) => boolean;
@@ -16,7 +16,7 @@ const selectTooltip = state => state.tooltip;
16
16
  const selectorChartsTooltipPointerItem = exports.selectorChartsTooltipPointerItem = (0, _store.createSelector)(selectTooltip, tooltip => tooltip?.item ?? null);
17
17
  const selectorChartsTooltipPointerItemIsDefined = exports.selectorChartsTooltipPointerItemIsDefined = (0, _store.createSelector)(selectorChartsTooltipPointerItem, item => item !== null);
18
18
  const selectorChartsTooltipItem = exports.selectorChartsTooltipItem = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, selectorChartsTooltipPointerItem, _useChartKeyboardNavigation.selectorChartsKeyboardItem, (lastInteraction, pointerItem, keyboardItem) => lastInteraction === 'keyboard' ? keyboardItem : pointerItem ?? null);
19
- const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, selectorChartsTooltipPointerItemIsDefined, _useChartKeyboardNavigation.selectorChartsKeyboardItemIsDefined, (lastInteraction, pointerItemIsDefined, keyboardItemIsDefined) => lastInteraction === 'keyboard' ? keyboardItemIsDefined : pointerItemIsDefined);
19
+ const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, selectorChartsTooltipPointerItemIsDefined, _useChartKeyboardNavigation.selectorChartsHasFocusedItem, (lastInteraction, pointerItemIsDefined, keyboardItemIsDefined) => lastInteraction === 'keyboard' ? keyboardItemIsDefined : pointerItemIsDefined);
20
20
  const selectorChartsTooltipAxisConfig = (0, _store.createSelectorMemoized)(selectorChartsTooltipItem, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartPolarAxis.selectorChartRotationAxis, _useChartPolarAxis.selectorChartRadiusAxis, _useChartSeries.selectorChartSeriesProcessed, function selectorChartsTooltipAxisConfig(identifier, {
21
21
  axis: xAxis,
22
22
  axisIds: xAxisIds
@@ -1,26 +1,27 @@
1
1
  import type { ChartPluginSignature } from "../../models/index.js";
2
- import type { ChartItemIdentifier, ChartSeriesType } from "../../../../models/seriesType/config.js";
2
+ import type { SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
3
+ import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
3
4
  export interface UseChartTooltipInstance {
4
5
  /**
5
6
  * Setter for the item the user is pointing at.
6
- * @param {ChartItemIdentifier} newItem The identifier of the item.
7
+ * @param {SeriesItemIdentifier} newItem The identifier of the item.
7
8
  */
8
- setTooltipItem: (newItem: ChartItemIdentifier<ChartSeriesType>) => void;
9
+ setTooltipItem: (newItem: SeriesItemIdentifier<ChartSeriesType>) => void;
9
10
  /**
10
11
  * Remove the item the user was pointing at.
11
12
  * - If `itemToRemove` is provided, it removes the item only if it matches the current one.
12
13
  * Otherwise it assumes the item got already updated and does nothing.
13
14
  * - If `itemToRemove` is not provided, it removes the current item unconditionally.
14
- * @param {ChartItemIdentifier} itemToRemove The identifier of the item.
15
+ * @param {SeriesItemIdentifier} itemToRemove The identifier of the item.
15
16
  */
16
- removeTooltipItem: (itemToRemove?: ChartItemIdentifier<ChartSeriesType>) => void;
17
+ removeTooltipItem: (itemToRemove?: SeriesItemIdentifier<ChartSeriesType>) => void;
17
18
  }
18
19
  export interface UseChartTooltipState {
19
20
  tooltip: {
20
21
  /**
21
22
  * The item currently under the pointer.
22
23
  */
23
- item: null | ChartItemIdentifier<ChartSeriesType>;
24
+ item: null | SeriesItemIdentifier<ChartSeriesType>;
24
25
  };
25
26
  }
26
27
  export type UseChartTooltipSignature = ChartPluginSignature<{
@@ -8,6 +8,7 @@ import { type PolarExtremumGetter } from "./polarExtremumGetter.types.js";
8
8
  import { type GetSeriesWithDefaultValues } from "./getSeriesWithDefaultValues.types.js";
9
9
  import { type TooltipItemPositionGetter } from "./tooltipItemPositionGetter.types.js";
10
10
  import { type SeriesLayoutGetter } from "./seriesLayout.types.js";
11
+ import { type KeyboardFocusHandler } from "../../featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js";
11
12
  export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
12
13
  seriesProcessor: SeriesProcessor<TSeriesType>;
13
14
  /**
@@ -19,6 +20,7 @@ export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
19
20
  tooltipGetter: TooltipGetter<TSeriesType>;
20
21
  tooltipItemPositionGetter?: TooltipItemPositionGetter<TSeriesType>;
21
22
  getSeriesWithDefaultValues: GetSeriesWithDefaultValues<TSeriesType>;
23
+ keyboardFocusHandler?: KeyboardFocusHandler<TSeriesType>;
22
24
  } & (TSeriesType extends CartesianChartSeriesType ? {
23
25
  xExtremumGetter: CartesianExtremumGetter<TSeriesType>;
24
26
  yExtremumGetter: CartesianExtremumGetter<TSeriesType>;
@@ -1,6 +1,6 @@
1
1
  import type { ChartSeriesDefaultized, ChartSeriesType, ChartsSeriesConfig, DatasetType } from "../../../../models/seriesType/config.js";
2
2
  import type { SeriesId } from "../../../../models/seriesType/common.js";
3
- import type { StackingGroupsType } from "../../../stackSeries.js";
3
+ import type { StackingGroupsType } from "../../../stacking/index.js";
4
4
  export type SeriesProcessorParams<TSeriesType extends ChartSeriesType> = {
5
5
  series: Record<SeriesId, ChartsSeriesConfig[TSeriesType]['seriesInput']>;
6
6
  seriesOrder: SeriesId[];
@@ -1,4 +1,5 @@
1
- import type { ChartItemIdentifier, ChartSeriesDefaultized, ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
1
+ import type { SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
2
+ import type { ChartSeriesDefaultized, ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
2
3
  import { type SeriesId } from "../../../../models/seriesType/common.js";
3
4
  import { type AxisId, type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type PolarAxisDefaultized, type ComputedXAxis, type ComputedYAxis } from "../../../../models/axis.js";
4
5
  import { type ChartsLabelMarkProps } from "../../../../ChartsLabel/ChartsLabelMark.js";
@@ -7,7 +8,7 @@ export interface ItemTooltip<T extends ChartSeriesType> {
7
8
  /**
8
9
  * An object that identifies the item to display.
9
10
  */
10
- identifier: ChartItemIdentifier<T>;
11
+ identifier: SeriesItemIdentifier<T>;
11
12
  /**
12
13
  * The color associated with the item.
13
14
  */
@@ -59,7 +60,7 @@ export type TooltipGetter<TSeriesType extends ChartSeriesType> = (params: {
59
60
  series: ChartSeriesDefaultized<TSeriesType>;
60
61
  axesConfig: TooltipGetterAxesConfig;
61
62
  getColor: ColorGetter<TSeriesType>;
62
- identifier: ChartItemIdentifier<TSeriesType> | null;
63
+ identifier: SeriesItemIdentifier<TSeriesType> | null;
63
64
  }) => (TSeriesType extends 'radar' ? ItemTooltipWithMultipleValues<TSeriesType> : ItemTooltip<TSeriesType>) | null;
64
65
  /**
65
66
  * If `axisId` is set to undefined, the default axis will be used.
@@ -1,4 +1,5 @@
1
- import type { ChartItemIdentifier, ChartSeriesType } from "../../../../models/seriesType/config.js";
1
+ import type { SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
2
+ import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
2
3
  import { type ChartsRotationAxisProps, type ChartsRadiusAxisProps, type ComputedXAxis, type ComputedYAxis } from "../../../../models/axis.js";
3
4
  import { type ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
4
5
  import { type ProcessedSeries, type SeriesLayout } from "../../corePlugins/useChartSeries/index.js";
@@ -13,7 +14,7 @@ export type TooltipItemPositionGetter<TSeriesType extends ChartSeriesType> = (pa
13
14
  series: ProcessedSeries<TSeriesType>;
14
15
  axesConfig: TooltipPositionGetterAxesConfig;
15
16
  drawingArea: ChartDrawingArea;
16
- identifier: ChartItemIdentifier<TSeriesType> | null;
17
+ identifier: SeriesItemIdentifier<TSeriesType> | null;
17
18
  seriesLayout: SeriesLayout<TSeriesType>;
18
19
  /**
19
20
  * The preferred placement of the tooltip related to the element.
@@ -0,0 +1,4 @@
1
+ import type { SeriesId } from "../models/seriesType/common.js";
2
+ import type { ChartSeriesType, ChartsSeriesConfig } from "../models/seriesType/config.js";
3
+ import type { ProcessedSeries } from "./plugins/corePlugins/useChartSeries/index.js";
4
+ export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.seriesHasData = seriesHasData;
7
+ function seriesHasData(series, type, seriesId) {
8
+ // @ts-ignore sankey is not in MIT version
9
+ if (type === 'sankey') {
10
+ return false;
11
+ }
12
+ const data = series[type]?.series[seriesId]?.data;
13
+ return data != null && data.length > 0;
14
+ }
@@ -8,7 +8,6 @@ var _warning = require("@mui/x-internals/warning");
8
8
  var _store = require("@mui/x-internals/store");
9
9
  var _useChartSeries = require("./plugins/corePlugins/useChartSeries/useChartSeries.selectors");
10
10
  var _useStore = require("./store/useStore");
11
- var _useSelector = require("./store/useSelector");
12
11
  const selectorAllSeriesOfType = exports.selectorAllSeriesOfType = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, (processedSeries, seriesType) => processedSeries[seriesType]);
13
12
  const selectorSeriesOfType = exports.selectorSeriesOfType = (0, _store.createSelectorMemoized)(_useChartSeries.selectorChartSeriesProcessed, (processedSeries, seriesType, ids) => {
14
13
  if (ids === undefined || Array.isArray(ids) && ids.length === 0) {
@@ -36,11 +35,11 @@ const selectorSeriesOfType = exports.selectorSeriesOfType = (0, _store.createSel
36
35
  });
37
36
  const useAllSeriesOfType = seriesType => {
38
37
  const store = (0, _useStore.useStore)();
39
- return (0, _useSelector.useSelector)(store, selectorAllSeriesOfType, seriesType);
38
+ return store.use(selectorAllSeriesOfType, seriesType);
40
39
  };
41
40
  exports.useAllSeriesOfType = useAllSeriesOfType;
42
41
  const useSeriesOfType = (seriesType, seriesId) => {
43
42
  const store = (0, _useStore.useStore)();
44
- return (0, _useSelector.useSelector)(store, selectorSeriesOfType, seriesType, seriesId);
43
+ return store.use(selectorSeriesOfType, seriesType, seriesId);
45
44
  };
46
45
  exports.useSeriesOfType = useSeriesOfType;
@@ -0,0 +1 @@
1
+ export * from "./stackSeries.js";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _stackSeries = require("./stackSeries");
7
+ Object.keys(_stackSeries).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _stackSeries[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _stackSeries[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1 @@
1
+ export * from "./offsetDiverging.js";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _offsetDiverging = require("./offsetDiverging");
7
+ Object.keys(_offsetDiverging).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _offsetDiverging[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _offsetDiverging[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,8 @@
1
+ import type { Series } from '@mui/x-charts-vendor/d3-shape';
2
+ /**
3
+ * Positive values are stacked above zero, while negative values are stacked below zero.
4
+ *
5
+ * @param series A series generated by a stack generator.
6
+ * @param order An array of numeric indexes representing the stack order.
7
+ */
8
+ export declare function offsetDiverging(series: Series<any, any>[], order: Iterable<number>): void;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.offsetDiverging = offsetDiverging;
7
+ // Adapted from D3.js's offsetDiverging function https://github.com/d3/d3-shape/blob/main/src/offset/diverging.js
8
+ // Hidden series (with all zero values) affect the stacking in a different way in our implementation compared to the D3 behavior.
9
+ // The D3 stacking keep those values at the 0 "line", which creates issues when animating between hidden and visible states.
10
+ // In our modification, we stack them on top/below already stacked items according to the sign of their original value.
11
+ // A hidden negative value will be placed below all the already stacked negative values
12
+
13
+ /**
14
+ * Positive values are stacked above zero, while negative values are stacked below zero.
15
+ *
16
+ * @param series A series generated by a stack generator.
17
+ * @param order An array of numeric indexes representing the stack order.
18
+ */
19
+ function offsetDiverging(series, order) {
20
+ if (series.length === 0) {
21
+ return;
22
+ }
23
+ const seriesCount = series.length;
24
+ const numericOrder = order;
25
+ const pointCount = series[numericOrder[0]].length;
26
+ for (let pointIndex = 0; pointIndex < pointCount; pointIndex += 1) {
27
+ let positiveSum = 0;
28
+ let negativeSum = 0;
29
+ for (let seriesIndex = 0; seriesIndex < seriesCount; seriesIndex += 1) {
30
+ const currentSeries = series[numericOrder[seriesIndex]];
31
+ const dataPoint = currentSeries[pointIndex];
32
+ const difference = dataPoint[1] - dataPoint[0];
33
+ if (difference > 0) {
34
+ dataPoint[0] = positiveSum;
35
+ positiveSum += difference;
36
+ dataPoint[1] = positiveSum;
37
+ } else if (difference < 0) {
38
+ dataPoint[1] = negativeSum;
39
+ negativeSum += difference;
40
+ dataPoint[0] = negativeSum;
41
+ } else if (dataPoint.data[currentSeries.key] > 0) {
42
+ dataPoint[0] = positiveSum;
43
+ dataPoint[1] = positiveSum;
44
+ } else if (dataPoint.data[currentSeries.key] < 0) {
45
+ dataPoint[1] = negativeSum;
46
+ dataPoint[0] = negativeSum;
47
+ } else {
48
+ dataPoint[0] = 0;
49
+ dataPoint[1] = 0;
50
+ }
51
+ }
52
+ }
53
+ }
@@ -1,6 +1,6 @@
1
- import { stackOrderAppearance as d3StackOrderAppearance, stackOrderAscending as d3StackOrderAscending, stackOrderDescending as d3StackOrderDescending, stackOrderInsideOut as d3StackOrderInsideOut, stackOrderNone as d3StackOrderNone, stackOrderReverse as d3StackOrderReverse, stackOffsetExpand as d3StackOffsetExpand, stackOffsetDiverging as d3StackOffsetDiverging, stackOffsetNone as d3StackOffsetNone, stackOffsetSilhouette as d3StackOffsetSilhouette, stackOffsetWiggle as d3StackOffsetWiggle, type Series } from '@mui/x-charts-vendor/d3-shape';
2
- import type { StackOffsetType, StackOrderType } from "../models/stacking.js";
3
- import { type SeriesId, type StackableSeriesType } from "../models/seriesType/common.js";
1
+ import { stackOrderNone as d3StackOrderNone, stackOrderReverse as d3StackOrderReverse, stackOrderAppearance as d3OrderAppearance, stackOrderAscending as d3OrderAscending, stackOrderDescending as d3OrderDescending, stackOrderInsideOut as d3OrderInsideOut, stackOffsetExpand as d3StackOffsetExpand, stackOffsetNone as d3StackOffsetNone, stackOffsetSilhouette as d3StackOffsetSilhouette, stackOffsetWiggle as d3StackOffsetWiggle, type Series } from '@mui/x-charts-vendor/d3-shape';
2
+ import type { StackOffsetType, StackOrderType } from "../../models/stacking.js";
3
+ import { type SeriesId, type StackableSeriesType } from "../../models/seriesType/common.js";
4
4
  type FormatterParams<T> = {
5
5
  series: Record<SeriesId, T>;
6
6
  seriesOrder: SeriesId[];
@@ -18,19 +18,19 @@ export declare const StackOrder: {
18
18
  /**
19
19
  * Series order such that the earliest series (according to the maximum value) is at the bottom.
20
20
  * */
21
- appearance: typeof d3StackOrderAppearance;
21
+ appearance: typeof d3OrderAppearance;
22
22
  /**
23
23
  * Series order such that the smallest series (according to the sum of values) is at the bottom.
24
24
  * */
25
- ascending: typeof d3StackOrderAscending;
25
+ ascending: typeof d3OrderAscending;
26
26
  /**
27
27
  * Series order such that the largest series (according to the sum of values) is at the bottom.
28
28
  */
29
- descending: typeof d3StackOrderDescending;
29
+ descending: typeof d3OrderDescending;
30
30
  /**
31
31
  * Series order such that the earliest series (according to the maximum value) are on the inside and the later series are on the outside. This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Byron & Wattenberg for more information.
32
32
  */
33
- insideOut: typeof d3StackOrderInsideOut;
33
+ insideOut: typeof d3OrderInsideOut;
34
34
  /**
35
35
  * Given series order [0, 1, … n - 1] where n is the number of elements in series. Thus, the stack order is given by the key accessor.
36
36
  */
@@ -48,7 +48,7 @@ export declare const StackOffset: {
48
48
  /**
49
49
  * Positive values are stacked above zero, negative values are stacked below zero, and zero values are stacked at zero.
50
50
  * */
51
- diverging: typeof d3StackOffsetDiverging;
51
+ diverging: (series: Series<any, any>, order: Iterable<number>) => void;
52
52
  /**
53
53
  * Applies a zero baseline.
54
54
  * */
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getStackingGroups = exports.StackOrder = exports.StackOffset = void 0;
7
7
  var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
8
+ var _offset = require("./offset");
8
9
  const StackOrder = exports.StackOrder = {
9
10
  /**
10
11
  * Series order such that the earliest series (according to the maximum value) is at the bottom.
@@ -39,7 +40,8 @@ const StackOffset = exports.StackOffset = {
39
40
  /**
40
41
  * Positive values are stacked above zero, negative values are stacked below zero, and zero values are stacked at zero.
41
42
  * */
42
- diverging: _d3Shape.stackOffsetDiverging,
43
+ // @ts-expect-error, d3 types are wrong, our custom function implements the correct signature
44
+ diverging: _offset.offsetDiverging,
43
45
  /**
44
46
  * Applies a zero baseline.
45
47
  * */
@@ -90,8 +90,6 @@ export type ChartSeriesDefaultized<T extends ChartSeriesType> = ChartsSeriesConf
90
90
  stackedData: [number, number][];
91
91
  } : ChartsSeriesConfig[T]['series'];
92
92
  export type ChartSeriesLayout<T extends ChartSeriesType> = ChartsSeriesConfig[T] extends any ? ChartsSeriesConfig[T]['seriesLayout'] : never;
93
- export type ChartItemIdentifier<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
94
- export type ChartItemIdentifierWithData<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
95
93
  export type DatasetElementType<T> = {
96
94
  [key: string]: T;
97
95
  };
@@ -1,4 +1,5 @@
1
- import { type BarSeriesType, type DefaultizedBarSeriesType } from "./bar.js";
1
+ import type { DefaultizedProps } from '@mui/x-internals/types';
2
+ import type { BarSeriesType, DefaultizedBarSeriesType } from "./bar.js";
2
3
  import { type CartesianChartSeriesType, type ChartSeriesType, type ChartsSeriesConfig, type StackableChartSeriesType } from "./config.js";
3
4
  type AllSeriesType<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['seriesProp'];
4
5
  /**
@@ -19,6 +20,7 @@ type DefaultizedCartesianSeriesType = DefaultizedSeriesType<CartesianChartSeries
19
20
  type StackableSeriesType = DefaultizedSeriesType<StackableChartSeriesType>;
20
21
  export type SeriesItemIdentifier<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
21
22
  export type SeriesItemIdentifierWithData<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
23
+ export type FocusedItemIdentifier<T extends ChartSeriesType = ChartSeriesType> = T extends 'line' ? DefaultizedProps<ChartsSeriesConfig[T]['itemIdentifier'], 'dataIndex'> : ChartsSeriesConfig[T]['itemIdentifier'];
22
24
  export { type SeriesId } from "./common.js";
23
25
  export * from "./line.js";
24
26
  export * from "./bar.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "8.22.0",
3
+ "version": "8.23.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The community edition of MUI X Charts components.",
6
6
  "license": "MIT",
@@ -34,9 +34,9 @@
34
34
  "prop-types": "^15.8.1",
35
35
  "reselect": "^5.1.1",
36
36
  "use-sync-external-store": "^1.6.0",
37
- "@mui/x-charts-vendor": "8.22.0",
38
- "@mui/x-internals": "8.22.0",
39
- "@mui/x-internal-gestures": "0.3.6"
37
+ "@mui/x-charts-vendor": "8.23.0",
38
+ "@mui/x-internals": "8.23.0",
39
+ "@mui/x-internal-gestures": "0.4.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.9.0",
@@ -1,3 +0,0 @@
1
- import { type ChartSeriesType } from "../../../../models/seriesType/config.js";
2
- import { type FocusableSeriesTypes } from "./useChartKeyboardNavigation.types.js";
3
- export declare function isFocusableSeriesType(type: ChartSeriesType): type is FocusableSeriesTypes;
@@ -1,4 +0,0 @@
1
- const FOCUSABLE_SERIES_TYPES = new Set(['bar', 'line', 'scatter', 'pie']);
2
- export function isFocusableSeriesType(type) {
3
- return FOCUSABLE_SERIES_TYPES.has(type);
4
- }
@@ -1,21 +0,0 @@
1
- import { type ChartSeriesType, type ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
2
- import { type SeriesId } from "../../../../models/seriesType/common.js";
3
- import { type ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
4
- import { type FocusableSeriesTypes } from "./useChartKeyboardNavigation.types.js";
5
- /**
6
- * Returns the next series type and id that contains some data.
7
- * Returns `null` if no other series have data.
8
- */
9
- export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: FocusableSeriesTypes, seriesId?: SeriesId): {
10
- type: FocusableSeriesTypes;
11
- seriesId: SeriesId;
12
- } | null;
13
- /**
14
- * Returns the previous series type and id that contains some data.
15
- * Returns `null` if no other series have data.
16
- */
17
- export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: FocusableSeriesTypes, seriesId?: SeriesId): {
18
- type: FocusableSeriesTypes;
19
- seriesId: SeriesId;
20
- } | null;
21
- export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean | undefined;
@@ -1,92 +0,0 @@
1
- import { isFocusableSeriesType } from "./isFocusableSeriesType.js";
2
-
3
- /**
4
- * Returns the next series type and id that contains some data.
5
- * Returns `null` if no other series have data.
6
- */
7
- export function getNextSeriesWithData(series, type, seriesId) {
8
- const seriesType = Object.keys(series);
9
- const startingTypeIndex = type !== undefined && series[type] ? seriesType.indexOf(type) : 0;
10
- const currentSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : -1;
11
- const typesAvailable = seriesType.filter(isFocusableSeriesType);
12
-
13
- // Loop over all series types starting with the current seriesType
14
- for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
15
- const typeIndex = (startingTypeIndex + typeGap) % typesAvailable.length;
16
- const seriesOfType = series[typesAvailable[typeIndex]];
17
-
18
- // Edge case for the current series type: we don't loop on previous series of the same type.
19
- const startingSeriesIndex = typeGap === 0 ? currentSeriesIndex + 1 : 0;
20
- for (let seriesIndex = startingSeriesIndex; seriesIndex < seriesOfType.seriesOrder.length; seriesIndex += 1) {
21
- if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
22
- return {
23
- type: typesAvailable[typeIndex],
24
- seriesId: seriesOfType.seriesOrder[seriesIndex]
25
- };
26
- }
27
- }
28
- }
29
-
30
- // End looping on the initial type up to the initial series (excluded)
31
- const typeIndex = startingTypeIndex;
32
- const seriesOfType = series[typesAvailable[typeIndex]];
33
- const endingSeriesIndex = currentSeriesIndex;
34
- for (let seriesIndex = 0; seriesIndex < endingSeriesIndex; seriesIndex += 1) {
35
- if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
36
- return {
37
- type: typesAvailable[typeIndex],
38
- seriesId: seriesOfType.seriesOrder[seriesIndex]
39
- };
40
- }
41
- }
42
- return null;
43
- }
44
-
45
- /**
46
- * Returns the previous series type and id that contains some data.
47
- * Returns `null` if no other series have data.
48
- */
49
- export function getPreviousSeriesWithData(series, type, seriesId) {
50
- const seriesType = Object.keys(series);
51
- const startingTypeIndex = type !== undefined && series[type] ? seriesType.indexOf(type) : 0;
52
- const startingSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : 1;
53
- const typesAvailable = seriesType.filter(isFocusableSeriesType);
54
-
55
- // Loop over all series types starting with the current seriesType
56
- for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
57
- const typeIndex = (typesAvailable.length + startingTypeIndex - typeGap) % typesAvailable.length;
58
- const seriesOfType = series[typesAvailable[typeIndex]];
59
- const maxGap = typeGap === 0 ? startingSeriesIndex + 1 : seriesOfType.seriesOrder.length;
60
- for (let seriesGap = 1; seriesGap < maxGap; seriesGap += 1) {
61
- const seriesIndex = (seriesOfType.seriesOrder.length + startingSeriesIndex - seriesGap) % seriesOfType.seriesOrder.length;
62
- if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
63
- return {
64
- type: typesAvailable[typeIndex],
65
- seriesId: seriesOfType.seriesOrder[seriesIndex]
66
- };
67
- }
68
- }
69
- }
70
-
71
- // End looping on the initial type down to the initial series (excluded)
72
- const typeIndex = startingTypeIndex;
73
- const seriesOfType = series[typesAvailable[typeIndex]];
74
- const availableSeriesIds = seriesOfType.seriesOrder;
75
- for (let seriesIndex = availableSeriesIds.length - 1; seriesIndex > startingSeriesIndex; seriesIndex -= 1) {
76
- if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
77
- return {
78
- type: typesAvailable[typeIndex],
79
- seriesId: seriesOfType.seriesOrder[seriesIndex]
80
- };
81
- }
82
- }
83
- return null;
84
- }
85
- export function seriesHasData(series, type, seriesId) {
86
- // @ts-ignore snakey is not in MIT version
87
- if (type === 'sankey') {
88
- return false;
89
- }
90
- const data = series[type]?.series[seriesId]?.data;
91
- return data && data.length > 0;
92
- }
@@ -1,2 +0,0 @@
1
- import { useStore as useInternalStore } from '@mui/x-internals/store';
2
- export declare const useSelector: typeof useInternalStore;
@@ -1,2 +0,0 @@
1
- import { useStore as useInternalStore } from '@mui/x-internals/store';
2
- export const useSelector = useInternalStore;
@@ -1,3 +0,0 @@
1
- import { type ChartSeriesType } from "../../../../models/seriesType/config.js";
2
- import { type FocusableSeriesTypes } from "./useChartKeyboardNavigation.types.js";
3
- export declare function isFocusableSeriesType(type: ChartSeriesType): type is FocusableSeriesTypes;
@@ -1,10 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isFocusableSeriesType = isFocusableSeriesType;
7
- const FOCUSABLE_SERIES_TYPES = new Set(['bar', 'line', 'scatter', 'pie']);
8
- function isFocusableSeriesType(type) {
9
- return FOCUSABLE_SERIES_TYPES.has(type);
10
- }
@@ -1,21 +0,0 @@
1
- import { type ChartSeriesType, type ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
2
- import { type SeriesId } from "../../../../models/seriesType/common.js";
3
- import { type ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
4
- import { type FocusableSeriesTypes } from "./useChartKeyboardNavigation.types.js";
5
- /**
6
- * Returns the next series type and id that contains some data.
7
- * Returns `null` if no other series have data.
8
- */
9
- export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: FocusableSeriesTypes, seriesId?: SeriesId): {
10
- type: FocusableSeriesTypes;
11
- seriesId: SeriesId;
12
- } | null;
13
- /**
14
- * Returns the previous series type and id that contains some data.
15
- * Returns `null` if no other series have data.
16
- */
17
- export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: FocusableSeriesTypes, seriesId?: SeriesId): {
18
- type: FocusableSeriesTypes;
19
- seriesId: SeriesId;
20
- } | null;
21
- export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean | undefined;