@mui/x-charts 9.10.1 → 9.11.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 (177) hide show
  1. package/BarChart/BarChart.js +4 -2
  2. package/BarChart/BarChart.mjs +4 -2
  3. package/BarChart/BarPlot.d.mts +3 -3
  4. package/BarChart/BarPlot.d.ts +3 -3
  5. package/BarChart/BarPlot.js +1 -1
  6. package/BarChart/BarPlot.mjs +1 -1
  7. package/BarChart/BatchBarPlot/BatchBarPlot.d.mts +2 -2
  8. package/BarChart/BatchBarPlot/BatchBarPlot.d.ts +2 -2
  9. package/BarChart/IndividualBarPlot.d.mts +2 -2
  10. package/BarChart/IndividualBarPlot.d.ts +2 -2
  11. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +4 -4
  12. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +4 -4
  13. package/BarChart/useRegisterItemClickHandlers.d.mts +2 -1
  14. package/BarChart/useRegisterItemClickHandlers.d.ts +2 -1
  15. package/BarChart/useRegisterItemClickHandlers.js +8 -0
  16. package/BarChart/useRegisterItemClickHandlers.mjs +8 -1
  17. package/CHANGELOG.md +118 -0
  18. package/ChartsContainer/ChartsContainer.js +4 -2
  19. package/ChartsContainer/ChartsContainer.mjs +4 -2
  20. package/ChartsDataProvider/ChartsDataProvider.js +3 -1
  21. package/ChartsDataProvider/ChartsDataProvider.mjs +3 -1
  22. package/ChartsRadialDataProvider/ChartsRadialDataProvider.js +3 -1
  23. package/ChartsRadialDataProvider/ChartsRadialDataProvider.mjs +3 -1
  24. package/ChartsXAxis/useAxisTicksProps.d.mts +101 -101
  25. package/ChartsXAxis/useAxisTicksProps.d.ts +101 -101
  26. package/ChartsYAxis/useAxisTicksProps.d.mts +101 -101
  27. package/ChartsYAxis/useAxisTicksProps.d.ts +101 -101
  28. package/LineChart/AreaPlot.d.mts +3 -2
  29. package/LineChart/AreaPlot.d.ts +3 -2
  30. package/LineChart/AreaPlot.js +8 -2
  31. package/LineChart/AreaPlot.mjs +9 -3
  32. package/LineChart/LineChart.js +2 -1
  33. package/LineChart/LineChart.mjs +2 -1
  34. package/LineChart/LinePlot.d.mts +3 -2
  35. package/LineChart/LinePlot.d.ts +3 -2
  36. package/LineChart/LinePlot.js +2 -2
  37. package/LineChart/LinePlot.mjs +3 -3
  38. package/LineChart/MarkPlot.d.mts +5 -4
  39. package/LineChart/MarkPlot.d.ts +5 -4
  40. package/LineChart/MarkPlot.js +17 -8
  41. package/LineChart/MarkPlot.mjs +17 -8
  42. package/LineChart/useLineItemClickHandler.d.mts +25 -1
  43. package/LineChart/useLineItemClickHandler.d.ts +25 -1
  44. package/LineChart/useLineItemClickHandler.js +48 -1
  45. package/LineChart/useLineItemClickHandler.mjs +47 -1
  46. package/PieChart/PieArcPlot.d.mts +3 -2
  47. package/PieChart/PieArcPlot.d.ts +3 -2
  48. package/PieChart/PieArcPlot.js +16 -1
  49. package/PieChart/PieArcPlot.mjs +16 -1
  50. package/PieChart/PieChart.js +3 -1
  51. package/PieChart/PieChart.mjs +3 -1
  52. package/PieChart/PiePlot.js +1 -1
  53. package/PieChart/PiePlot.mjs +1 -1
  54. package/README.md +1 -11
  55. package/RadarChart/RadarAxis/RadarAxis.utils.d.mts +1 -1
  56. package/RadarChart/RadarAxis/RadarAxis.utils.d.ts +1 -1
  57. package/RadarChart/RadarChart.js +3 -1
  58. package/RadarChart/RadarChart.mjs +3 -1
  59. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +3 -1
  60. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.mjs +3 -1
  61. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +4 -1
  62. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.mjs +4 -1
  63. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.mts +5 -4
  64. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +5 -4
  65. package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.d.mts +15 -0
  66. package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.d.ts +15 -0
  67. package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.js +32 -0
  68. package/RadarChart/RadarSeriesPlot/useRegisterRadarItemActivation.mjs +26 -0
  69. package/RadarChart/useRadarChartProps.js +5 -1
  70. package/RadarChart/useRadarChartProps.mjs +5 -1
  71. package/ScatterChart/Scatter.d.mts +3 -2
  72. package/ScatterChart/Scatter.d.ts +3 -2
  73. package/ScatterChart/Scatter.js +10 -1
  74. package/ScatterChart/Scatter.mjs +10 -1
  75. package/ScatterChart/ScatterChart.js +1 -0
  76. package/ScatterChart/ScatterChart.mjs +1 -0
  77. package/ScatterChart/async/ScatterAsync.js +9 -0
  78. package/ScatterChart/async/ScatterAsync.mjs +9 -0
  79. package/SparkLineChart/SparkLineChart.js +2 -1
  80. package/SparkLineChart/SparkLineChart.mjs +2 -1
  81. package/Toolbar/ToolbarButton.js +1 -1
  82. package/Toolbar/ToolbarButton.mjs +1 -1
  83. package/hooks/useFocusedItem.d.mts +1 -1
  84. package/hooks/useFocusedItem.d.ts +1 -1
  85. package/hooks/useItemHighlightStateGetter.d.mts +1 -1
  86. package/hooks/useItemHighlightStateGetter.d.ts +1 -1
  87. package/index.js +1 -1
  88. package/index.mjs +1 -1
  89. package/internals/createCommonKeyboardFocusHandler.d.mts +2 -2
  90. package/internals/createCommonKeyboardFocusHandler.d.ts +2 -2
  91. package/internals/index.d.mts +1 -0
  92. package/internals/index.d.ts +1 -0
  93. package/internals/index.js +8 -0
  94. package/internals/index.mjs +1 -0
  95. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.mts +8 -1
  96. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +8 -1
  97. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +11 -3
  98. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +11 -3
  99. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.mts +1 -0
  100. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -0
  101. package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.d.mts +12 -0
  102. package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.d.ts +12 -0
  103. package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.js +5 -0
  104. package/internals/plugins/corePlugins/useChartSeriesConfig/types/getItemWithData.types.mjs +1 -0
  105. package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.d.mts +1 -0
  106. package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.d.ts +1 -0
  107. package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.js +11 -0
  108. package/internals/plugins/corePlugins/useChartSeriesConfig/types/index.mjs +1 -0
  109. package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.mts +6 -0
  110. package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.ts +6 -0
  111. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.d.mts +21 -0
  112. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.d.ts +21 -0
  113. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.js +46 -0
  114. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisClickPayload.mjs +40 -0
  115. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +13 -31
  116. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.mjs +13 -31
  117. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.mts +2 -2
  118. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -2
  119. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +11 -11
  120. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +11 -11
  121. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.mts +4 -4
  122. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
  123. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +19 -0
  124. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.mjs +19 -0
  125. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.mts +5 -3
  126. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.types.d.ts +5 -3
  127. package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.js +15 -0
  128. package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.mjs +14 -0
  129. package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.mts +5 -2
  130. package/internals/plugins/featurePlugins/useChartItemClick/useChartItemClick.types.d.ts +5 -2
  131. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.mts +2 -1
  132. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +2 -1
  133. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +10 -2
  134. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.mjs +2 -1
  135. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.d.mts +13 -0
  136. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.d.ts +13 -0
  137. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.js +39 -0
  138. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/itemActivation.mjs +32 -0
  139. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +47 -7
  140. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.mjs +47 -7
  141. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.mts +3 -0
  142. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +3 -0
  143. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +3 -1
  144. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.mjs +2 -0
  145. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.mts +39 -2
  146. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +39 -2
  147. package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.d.mts +27 -0
  148. package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.d.ts +27 -0
  149. package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.js +36 -0
  150. package/internals/plugins/featurePlugins/useChartPolarAxis/getPolarAxisClickPayload.mjs +30 -0
  151. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +19 -20
  152. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +19 -20
  153. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts +2 -2
  154. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +2 -2
  155. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +1 -1
  156. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -1
  157. package/internals/seriesSelectorOfType.d.mts +4 -4
  158. package/internals/seriesSelectorOfType.d.ts +4 -4
  159. package/internals/useRegisterItemActivation.d.mts +23 -0
  160. package/internals/useRegisterItemActivation.d.ts +23 -0
  161. package/internals/useRegisterItemActivation.js +53 -0
  162. package/internals/useRegisterItemActivation.mjs +46 -0
  163. package/models/axis.d.mts +1 -1
  164. package/models/axis.d.ts +1 -1
  165. package/models/events.d.mts +11 -0
  166. package/models/events.d.ts +11 -0
  167. package/models/events.js +5 -0
  168. package/models/events.mjs +1 -0
  169. package/models/index.d.mts +1 -0
  170. package/models/index.d.ts +1 -0
  171. package/moduleAugmentation/barChartBatchRendererOnItemClick.d.mts +3 -4
  172. package/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +3 -4
  173. package/moduleAugmentation/keyboardActivation.d.mts +7 -0
  174. package/moduleAugmentation/keyboardActivation.d.ts +7 -0
  175. package/moduleAugmentation/keyboardActivation.js +8 -0
  176. package/moduleAugmentation/keyboardActivation.mjs +2 -0
  177. package/package.json +18 -4
@@ -149,6 +149,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes /* remove-proptyp
149
149
  * Options to enable features planned for the next major.
150
150
  */
151
151
  experimentalFeatures: _propTypes.default.shape({
152
+ keyboardActivation: _propTypes.default.bool,
152
153
  progressiveRendering: _propTypes.default.bool
153
154
  }),
154
155
  /**
@@ -142,6 +142,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes /* remove-proptyp
142
142
  * Options to enable features planned for the next major.
143
143
  */
144
144
  experimentalFeatures: PropTypes.shape({
145
+ keyboardActivation: PropTypes.bool,
145
146
  progressiveRendering: PropTypes.bool
146
147
  }),
147
148
  /**
@@ -15,6 +15,7 @@ var _useStore = require("../../internals/store/useStore");
15
15
  var _useProgressiveRendering = require("../../internals/plugins/featurePlugins/useProgressiveRendering");
16
16
  var _useChartCartesianAxis = require("../../internals/plugins/featurePlugins/useChartCartesianAxis");
17
17
  var _scatterRenderData = require("./scatterRenderData.selectors");
18
+ var _useRegisterItemActivation = require("../../internals/useRegisterItemActivation");
18
19
  var _jsxRuntime = require("react/jsx-runtime");
19
20
  /** Per-series points sampled while interacting; the rest fills in on settle. */const INTERACTION_POINT_BUDGET = 2000;
20
21
 
@@ -57,6 +58,14 @@ function ScatterAsync(props) {
57
58
  // `count` (total points) is constant across zoom/pan, so the sampled set is
58
59
  // stable while panning.
59
60
  const interactionStep = getInteractionStep(count, nBatches, INTERACTION_POINT_BUDGET);
61
+ (0, _useRegisterItemActivation.useRegisterItemActivation)({
62
+ type: 'scatter',
63
+ seriesId: series.id
64
+ }, onItemClick && ((event, item) => onItemClick(event, {
65
+ type: 'scatter',
66
+ seriesId: series.id,
67
+ dataIndex: item.dataIndex
68
+ })));
60
69
  const batches = [];
61
70
  for (let b = 0; b < mountedBatches; b += 1) {
62
71
  batches.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterAsyncBatch.ScatterAsyncBatch, {
@@ -7,6 +7,7 @@ import { useStore } from "../../internals/store/useStore.mjs";
7
7
  import { selectorProgressiveBatchSize, selectorProgressiveSeriesRevealedBatches } from "../../internals/plugins/featurePlugins/useProgressiveRendering/index.mjs";
8
8
  import { selectorChartZoomIsInteracting } from "../../internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs";
9
9
  import { selectorScatterSeriesRenderData } from "./scatterRenderData.selectors.mjs";
10
+ import { useRegisterItemActivation } from "../../internals/useRegisterItemActivation.mjs";
10
11
 
11
12
  /** Per-series points sampled while interacting; the rest fills in on settle. */
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -51,6 +52,14 @@ function ScatterAsync(props) {
51
52
  // `count` (total points) is constant across zoom/pan, so the sampled set is
52
53
  // stable while panning.
53
54
  const interactionStep = getInteractionStep(count, nBatches, INTERACTION_POINT_BUDGET);
55
+ useRegisterItemActivation({
56
+ type: 'scatter',
57
+ seriesId: series.id
58
+ }, onItemClick && ((event, item) => onItemClick(event, {
59
+ type: 'scatter',
60
+ seriesId: series.id,
61
+ dataIndex: item.dataIndex
62
+ })));
54
63
  const batches = [];
55
64
  for (let b = 0; b < mountedBatches; b += 1) {
56
65
  batches.push(/*#__PURE__*/_jsx(ScatterAsyncBatch, {
@@ -256,6 +256,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
256
256
  */
257
257
  experimentalFeatures: _propTypes.default.shape({
258
258
  enablePositionBasedPointerInteraction: _propTypes.default.bool,
259
+ keyboardActivation: _propTypes.default.bool,
259
260
  progressiveRendering: _propTypes.default.bool
260
261
  }),
261
262
  /**
@@ -478,7 +479,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
478
479
  /**
479
480
  * Callback fired when clicking close to an item.
480
481
  * This is only available for scatter plot for now.
481
- * @param {MouseEvent} event Mouse event caught at the svg level
482
+ * @param {ChartsActivationEvent} event Event caught at the svg level
482
483
  * @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
483
484
  */
484
485
  onItemClick: _propTypes.default.func,
@@ -249,6 +249,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
249
249
  */
250
250
  experimentalFeatures: PropTypes.shape({
251
251
  enablePositionBasedPointerInteraction: PropTypes.bool,
252
+ keyboardActivation: PropTypes.bool,
252
253
  progressiveRendering: PropTypes.bool
253
254
  }),
254
255
  /**
@@ -471,7 +472,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes /* remove-propt
471
472
  /**
472
473
  * Callback fired when clicking close to an item.
473
474
  * This is only available for scatter plot for now.
474
- * @param {MouseEvent} event Mouse event caught at the svg level
475
+ * @param {ChartsActivationEvent} event Event caught at the svg level
475
476
  * @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
476
477
  */
477
478
  onItemClick: PropTypes.func,
@@ -16,7 +16,7 @@ var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
16
16
  var _ToolbarContext = require("@mui/x-internals/ToolbarContext");
17
17
  var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
- const _excluded = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
19
+ const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
20
20
  _excluded2 = ["tabIndex"];
21
21
  const ToolbarButton = exports.ToolbarButton = /*#__PURE__*/React.forwardRef(function ToolbarButton(props, ref) {
22
22
  const {
@@ -2,7 +2,7 @@
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 = ["render", "onKeyDown", "onFocus", "disabled", "aria-disabled"],
5
+ const _excluded = ["render", "onKeyDown", "onFocus", "onBlur", "disabled", "aria-disabled"],
6
6
  _excluded2 = ["tabIndex"];
7
7
  import PropTypes from 'prop-types';
8
8
  import * as React from 'react';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Get the focused item from keyboard navigation.
3
3
  */
4
- export declare function useFocusedItem(): import("../index.mjs").FocusedItemIdentifier<keyof import("../internals/index.mjs").ChartsSeriesConfig> | null;
4
+ export declare function useFocusedItem(): import("@mui/x-charts/models").FocusedItemIdentifier<keyof import("../internals/index.mjs").ChartsSeriesConfig> | null;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Get the focused item from keyboard navigation.
3
3
  */
4
- export declare function useFocusedItem(): import("../index.js").FocusedItemIdentifier<keyof import("../internals/index.js").ChartsSeriesConfig> | null;
4
+ export declare function useFocusedItem(): import("@mui/x-charts/models").FocusedItemIdentifier<keyof import("../internals/index.js").ChartsSeriesConfig> | null;
@@ -6,4 +6,4 @@ import type { ChartSeriesType } from "../models/seriesType/config.mjs";
6
6
  *
7
7
  * @returns {(item: HighlightItemIdentifierWithType | null) => HighlightState} callback to get the highlight state of an item.
8
8
  */
9
- export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("../index.mjs").HighlightItemIdentifierWithType<import("../internals/index.mjs").ComposableChartSeriesType<keyof import("../internals/index.mjs").ChartsSeriesConfig>> | null) => import("./useItemHighlightState.mjs").HighlightState;
9
+ export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("@mui/x-charts/models").HighlightItemIdentifierWithType<import("../internals/index.mjs").ComposableChartSeriesType<keyof import("../internals/index.mjs").ChartsSeriesConfig>> | null) => import("./useItemHighlightState.mjs").HighlightState;
@@ -6,4 +6,4 @@ import type { ChartSeriesType } from "../models/seriesType/config.js";
6
6
  *
7
7
  * @returns {(item: HighlightItemIdentifierWithType | null) => HighlightState} callback to get the highlight state of an item.
8
8
  */
9
- export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("../index.js").HighlightItemIdentifierWithType<import("../internals/index.js").ComposableChartSeriesType<keyof import("../internals/index.js").ChartsSeriesConfig>> | null) => import("./useItemHighlightState.js").HighlightState;
9
+ export declare function useItemHighlightStateGetter<SeriesType extends ChartSeriesType>(): (item: import("@mui/x-charts/models").HighlightItemIdentifierWithType<import("../internals/index.js").ComposableChartSeriesType<keyof import("../internals/index.js").ChartsSeriesConfig>> | null) => import("./useItemHighlightState.js").HighlightState;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v9.10.1
2
+ * @mui/x-charts v9.11.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v9.10.1
2
+ * @mui/x-charts v9.11.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -4,7 +4,7 @@ import type { ChartSeriesType } from "../models/seriesType/config.mjs";
4
4
  */
5
5
  export declare function createCommonKeyboardFocusHandler<SeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, TInputSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = SeriesType>(outSeriesTypes: Set<SeriesType>, allowCycles?: boolean, useCurrentSeriesMaxLength?: boolean): (event: KeyboardEvent) => ((currentItem: {
6
6
  type: Exclude<ChartSeriesType, 'sankey' | 'heatmap'>;
7
- seriesId: import("../index.mjs").SeriesId;
7
+ seriesId: import("@mui/x-charts/models").SeriesId;
8
8
  dataIndex?: number;
9
9
  } | null, state: {
10
10
  series: {
@@ -14,6 +14,6 @@ export declare function createCommonKeyboardFocusHandler<SeriesType extends Excl
14
14
  };
15
15
  }) => {
16
16
  type: SeriesType;
17
- seriesId: import("../index.mjs").SeriesId;
17
+ seriesId: import("@mui/x-charts/models").SeriesId;
18
18
  dataIndex: number;
19
19
  } | null) | null;
@@ -4,7 +4,7 @@ import type { ChartSeriesType } from "../models/seriesType/config.js";
4
4
  */
5
5
  export declare function createCommonKeyboardFocusHandler<SeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'>, TInputSeriesType extends Exclude<ChartSeriesType, 'sankey' | 'heatmap'> = SeriesType>(outSeriesTypes: Set<SeriesType>, allowCycles?: boolean, useCurrentSeriesMaxLength?: boolean): (event: KeyboardEvent) => ((currentItem: {
6
6
  type: Exclude<ChartSeriesType, 'sankey' | 'heatmap'>;
7
- seriesId: import("../index.js").SeriesId;
7
+ seriesId: import("@mui/x-charts/models").SeriesId;
8
8
  dataIndex?: number;
9
9
  } | null, state: {
10
10
  series: {
@@ -14,6 +14,6 @@ export declare function createCommonKeyboardFocusHandler<SeriesType extends Excl
14
14
  };
15
15
  }) => {
16
16
  type: SeriesType;
17
- seriesId: import("../index.js").SeriesId;
17
+ seriesId: import("@mui/x-charts/models").SeriesId;
18
18
  dataIndex: number;
19
19
  } | null) | null;
@@ -76,6 +76,7 @@ export * from "./scaleGuards.mjs";
76
76
  export * from "./findMinMax.mjs";
77
77
  export * from "./commonNextFocusItem.mjs";
78
78
  export { createCommonKeyboardFocusHandler } from "./createCommonKeyboardFocusHandler.mjs";
79
+ export { useRegisterItemActivation } from "./useRegisterItemActivation.mjs";
79
80
  export { getSeriesColorFn } from "./getSeriesColorFn.mjs";
80
81
  export { resolveColorProcessor } from "./resolveColorProcessor.mjs";
81
82
  export { processLineLikeSeries } from "./processLineLikeSeries.mjs";
@@ -76,6 +76,7 @@ export * from "./scaleGuards.js";
76
76
  export * from "./findMinMax.js";
77
77
  export * from "./commonNextFocusItem.js";
78
78
  export { createCommonKeyboardFocusHandler } from "./createCommonKeyboardFocusHandler.js";
79
+ export { useRegisterItemActivation } from "./useRegisterItemActivation.js";
79
80
  export { getSeriesColorFn } from "./getSeriesColorFn.js";
80
81
  export { resolveColorProcessor } from "./resolveColorProcessor.js";
81
82
  export { processLineLikeSeries } from "./processLineLikeSeries.js";
@@ -23,6 +23,7 @@ var _exportNames = {
23
23
  getCartesianAxisIndex: true,
24
24
  getRotationAxisIndex: true,
25
25
  createCommonKeyboardFocusHandler: true,
26
+ useRegisterItemActivation: true,
26
27
  getSeriesColorFn: true,
27
28
  resolveColorProcessor: true,
28
29
  processLineLikeSeries: true,
@@ -186,6 +187,12 @@ Object.defineProperty(exports, "useRadarChartProps", {
186
187
  return _useRadarChartProps.useRadarChartProps;
187
188
  }
188
189
  });
190
+ Object.defineProperty(exports, "useRegisterItemActivation", {
191
+ enumerable: true,
192
+ get: function () {
193
+ return _useRegisterItemActivation.useRegisterItemActivation;
194
+ }
195
+ });
189
196
  Object.defineProperty(exports, "useRegisterPointerInteractions", {
190
197
  enumerable: true,
191
198
  get: function () {
@@ -953,6 +960,7 @@ Object.keys(_commonNextFocusItem).forEach(function (key) {
953
960
  });
954
961
  });
955
962
  var _createCommonKeyboardFocusHandler = require("./createCommonKeyboardFocusHandler");
963
+ var _useRegisterItemActivation = require("./useRegisterItemActivation");
956
964
  var _getSeriesColorFn = require("./getSeriesColorFn");
957
965
  var _resolveColorProcessor = require("./resolveColorProcessor");
958
966
  var _processLineLikeSeries = require("./processLineLikeSeries");
@@ -84,6 +84,7 @@ export * from "./scaleGuards.mjs";
84
84
  export * from "./findMinMax.mjs";
85
85
  export * from "./commonNextFocusItem.mjs";
86
86
  export { createCommonKeyboardFocusHandler } from "./createCommonKeyboardFocusHandler.mjs";
87
+ export { useRegisterItemActivation } from "./useRegisterItemActivation.mjs";
87
88
  export { getSeriesColorFn } from "./getSeriesColorFn.mjs";
88
89
  export { resolveColorProcessor } from "./resolveColorProcessor.mjs";
89
90
  export { processLineLikeSeries } from "./processLineLikeSeries.mjs";
@@ -1,5 +1,12 @@
1
1
  import type { ChartPluginSignature } from "../../models/index.mjs";
2
2
  import type { ChartSeriesType } from "../../../../models/seriesType/config.mjs";
3
+ interface CommonExperimentalFeatures {
4
+ /**
5
+ * Enables activating the keyboard-focused item with <kbd>Enter</kbd> or <kbd>Space</kbd>,
6
+ * firing `onItemClick` and `onAxisClick` as a pointer click would.
7
+ */
8
+ keyboardActivation?: boolean;
9
+ }
3
10
  interface LineExperimentalFeatures {
4
11
  /**
5
12
  * Enables pointer-based interaction detection for line and area series.
@@ -27,7 +34,7 @@ interface ScatterExperimentalFeatures {
27
34
  */
28
35
  progressiveRendering?: boolean;
29
36
  }
30
- export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
37
+ export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = CommonExperimentalFeatures & ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
31
38
  export interface UseChartExperimentalFeaturesParameters<SeriesType extends ChartSeriesType = ChartSeriesType> {
32
39
  /**
33
40
  * Options to enable features planned for the next major.
@@ -1,5 +1,12 @@
1
1
  import type { ChartPluginSignature } from "../../models/index.js";
2
2
  import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
3
+ interface CommonExperimentalFeatures {
4
+ /**
5
+ * Enables activating the keyboard-focused item with <kbd>Enter</kbd> or <kbd>Space</kbd>,
6
+ * firing `onItemClick` and `onAxisClick` as a pointer click would.
7
+ */
8
+ keyboardActivation?: boolean;
9
+ }
3
10
  interface LineExperimentalFeatures {
4
11
  /**
5
12
  * Enables pointer-based interaction detection for line and area series.
@@ -27,7 +34,7 @@ interface ScatterExperimentalFeatures {
27
34
  */
28
35
  progressiveRendering?: boolean;
29
36
  }
30
- export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
37
+ export type ChartExperimentalFeatures<SeriesType extends ChartSeriesType = ChartSeriesType> = CommonExperimentalFeatures & ('line' extends SeriesType ? LineExperimentalFeatures : {}) & ('scatter' extends SeriesType ? ScatterExperimentalFeatures : {});
31
38
  export interface UseChartExperimentalFeaturesParameters<SeriesType extends ChartSeriesType = ChartSeriesType> {
32
39
  /**
33
40
  * Options to enable features planned for the next major.
@@ -32,7 +32,10 @@ const useChartInteractionListener = ({
32
32
  preventIf: ['pan', 'zoomPinch', 'zoomPan']
33
33
  }), new _core.TapGesture({
34
34
  name: 'tap',
35
- preventIf: ['pan', 'zoomPinch', 'zoomPan']
35
+ // `pan` is intentionally omitted: it has `threshold: 0`, so any pointer drift during a
36
+ // click activates it and would cancel the tap, discarding the click. The tap's own
37
+ // `maxDistance` already discriminates a click from a drag. See https://github.com/mui/mui-x/issues/20364
38
+ preventIf: ['zoomPinch', 'zoomPan']
36
39
  }), new _core.PressGesture({
37
40
  name: 'quickPress',
38
41
  duration: 50
@@ -51,8 +54,13 @@ const useChartInteractionListener = ({
51
54
  }
52
55
  gestureManager.registerElement(['pan', 'move', 'tap', 'quickPress', 'brush'], svg);
53
56
  return () => {
54
- // Cleanup gesture manager
55
- gestureManager.unregisterAllGestures(svg);
57
+ // Cleanup gesture manager. `destroy()` unregisters every element's gestures like
58
+ // `unregisterAllGestures()` does, and is additionally the only path that removes the
59
+ // document/window listeners owned by the internal PointerManager and KeyboardManager.
60
+ gestureManager.destroy();
61
+ // The manager is unusable once destroyed, so drop it and let the next mount build a
62
+ // fresh one. Reusing a destroyed manager loses its gesture templates.
63
+ gestureManagerRef.current = null;
56
64
  };
57
65
  }, [chartsLayerContainerRef, gestureManagerRef]);
58
66
  const addInteractionListener = React.useCallback((interaction, callback, options) => {
@@ -26,7 +26,10 @@ export const useChartInteractionListener = ({
26
26
  preventIf: ['pan', 'zoomPinch', 'zoomPan']
27
27
  }), new TapGesture({
28
28
  name: 'tap',
29
- preventIf: ['pan', 'zoomPinch', 'zoomPan']
29
+ // `pan` is intentionally omitted: it has `threshold: 0`, so any pointer drift during a
30
+ // click activates it and would cancel the tap, discarding the click. The tap's own
31
+ // `maxDistance` already discriminates a click from a drag. See https://github.com/mui/mui-x/issues/20364
32
+ preventIf: ['zoomPinch', 'zoomPan']
30
33
  }), new PressGesture({
31
34
  name: 'quickPress',
32
35
  duration: 50
@@ -45,8 +48,13 @@ export const useChartInteractionListener = ({
45
48
  }
46
49
  gestureManager.registerElement(['pan', 'move', 'tap', 'quickPress', 'brush'], svg);
47
50
  return () => {
48
- // Cleanup gesture manager
49
- gestureManager.unregisterAllGestures(svg);
51
+ // Cleanup gesture manager. `destroy()` unregisters every element's gestures like
52
+ // `unregisterAllGestures()` does, and is additionally the only path that removes the
53
+ // document/window listeners owned by the internal PointerManager and KeyboardManager.
54
+ gestureManager.destroy();
55
+ // The manager is unusable once destroyed, so drop it and let the next mount build a
56
+ // fresh one. Reusing a destroyed manager loses its gesture templates.
57
+ gestureManagerRef.current = null;
50
58
  };
51
59
  }, [chartsLayerContainerRef, gestureManagerRef]);
52
60
  const addInteractionListener = React.useCallback((interaction, callback, options) => {
@@ -38,6 +38,7 @@ export declare const selectorChartSeriesConfigGetter: (args_0: import("../useCha
38
38
  identifierSerializer: import("../useChartSeriesConfig/index.mjs").IdentifierSerializer<"pie">;
39
39
  identifierCleaner: import("../useChartSeriesConfig/index.mjs").IdentifierCleaner<"pie">;
40
40
  getItemAtPosition?: import("../useChartSeriesConfig/index.mjs").GetItemAtPosition<"pie"> | undefined;
41
+ getItemWithData?: import("../useChartSeriesConfig/index.mjs").GetItemWithData<"pie"> | undefined;
41
42
  sampler?: import("../../../index.mjs").SamplingStrategy<"pie", unknown> | undefined;
42
43
  descriptionGetter: import("../useChartSeriesConfig/index.mjs").DescriptionGetter<"pie">;
43
44
  isHighlightedCreator: import("../../featurePlugins/useChartHighlight/highlightCreator.types.mjs").HighlightCreator<"pie">;
@@ -38,6 +38,7 @@ export declare const selectorChartSeriesConfigGetter: (args_0: import("../useCha
38
38
  identifierSerializer: import("../useChartSeriesConfig/index.js").IdentifierSerializer<"pie">;
39
39
  identifierCleaner: import("../useChartSeriesConfig/index.js").IdentifierCleaner<"pie">;
40
40
  getItemAtPosition?: import("../useChartSeriesConfig/index.js").GetItemAtPosition<"pie"> | undefined;
41
+ getItemWithData?: import("../useChartSeriesConfig/index.js").GetItemWithData<"pie"> | undefined;
41
42
  sampler?: import("../../../index.js").SamplingStrategy<"pie", unknown> | undefined;
42
43
  descriptionGetter: import("../useChartSeriesConfig/index.js").DescriptionGetter<"pie">;
43
44
  isHighlightedCreator: import("../../featurePlugins/useChartHighlight/highlightCreator.types.js").HighlightCreator<"pie">;
@@ -0,0 +1,12 @@
1
+ import type { SeriesItemIdentifierWithType, FocusedItemIdentifier } from "../../../../../models/seriesType/index.mjs";
2
+ import type { ChartState } from "../../../models/chart.mjs";
3
+ import type { ChartSeriesType } from "../../../../../models/seriesType/config.mjs";
4
+ import type { ChartSeriesTypeRequiredPlugins } from "./seriesConfig.types.mjs";
5
+ /**
6
+ * Completes an item identifier with the data a pointer click would provide, so keyboard activation
7
+ * emits the same payload as `getItemAtPosition`.
8
+ * @param {ChartState} state The chart state.
9
+ * @param {FocusedItemIdentifier<SeriesType>} identifier The identifier to complete.
10
+ * @returns {SeriesItemIdentifierWithType<SeriesType>} The identifier with its click data.
11
+ */
12
+ export type GetItemWithData<SeriesType extends ChartSeriesType> = (state: ChartState<ChartSeriesTypeRequiredPlugins<SeriesType>>, identifier: FocusedItemIdentifier<SeriesType>) => SeriesItemIdentifierWithType<SeriesType>;
@@ -0,0 +1,12 @@
1
+ import type { SeriesItemIdentifierWithType, FocusedItemIdentifier } from "../../../../../models/seriesType/index.js";
2
+ import type { ChartState } from "../../../models/chart.js";
3
+ import type { ChartSeriesType } from "../../../../../models/seriesType/config.js";
4
+ import type { ChartSeriesTypeRequiredPlugins } from "./seriesConfig.types.js";
5
+ /**
6
+ * Completes an item identifier with the data a pointer click would provide, so keyboard activation
7
+ * emits the same payload as `getItemAtPosition`.
8
+ * @param {ChartState} state The chart state.
9
+ * @param {FocusedItemIdentifier<SeriesType>} identifier The identifier to complete.
10
+ * @returns {SeriesItemIdentifierWithType<SeriesType>} The identifier with its click data.
11
+ */
12
+ export type GetItemWithData<SeriesType extends ChartSeriesType> = (state: ChartState<ChartSeriesTypeRequiredPlugins<SeriesType>>, identifier: FocusedItemIdentifier<SeriesType>) => SeriesItemIdentifierWithType<SeriesType>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -11,5 +11,6 @@ export * from "./getSeriesWithDefaultValues.types.mjs";
11
11
  export * from "./identifierSerializer.types.mjs";
12
12
  export * from "./identifierCleaner.types.mjs";
13
13
  export * from "./getItemAtPosition.types.mjs";
14
+ export * from "./getItemWithData.types.mjs";
14
15
  export * from "./descriptionGetter.types.mjs";
15
16
  export * from "./TooltipContent.types.mjs";
@@ -11,5 +11,6 @@ export * from "./getSeriesWithDefaultValues.types.js";
11
11
  export * from "./identifierSerializer.types.js";
12
12
  export * from "./identifierCleaner.types.js";
13
13
  export * from "./getItemAtPosition.types.js";
14
+ export * from "./getItemWithData.types.js";
14
15
  export * from "./descriptionGetter.types.js";
15
16
  export * from "./TooltipContent.types.js";
@@ -146,6 +146,17 @@ Object.keys(_getItemAtPosition).forEach(function (key) {
146
146
  }
147
147
  });
148
148
  });
149
+ var _getItemWithData = require("./getItemWithData.types");
150
+ Object.keys(_getItemWithData).forEach(function (key) {
151
+ if (key === "default" || key === "__esModule") return;
152
+ if (key in exports && exports[key] === _getItemWithData[key]) return;
153
+ Object.defineProperty(exports, key, {
154
+ enumerable: true,
155
+ get: function () {
156
+ return _getItemWithData[key];
157
+ }
158
+ });
159
+ });
149
160
  var _descriptionGetter = require("./descriptionGetter.types");
150
161
  Object.keys(_descriptionGetter).forEach(function (key) {
151
162
  if (key === "default" || key === "__esModule") return;
@@ -11,5 +11,6 @@ export * from "./getSeriesWithDefaultValues.types.mjs";
11
11
  export * from "./identifierSerializer.types.mjs";
12
12
  export * from "./identifierCleaner.types.mjs";
13
13
  export * from "./getItemAtPosition.types.mjs";
14
+ export * from "./getItemWithData.types.mjs";
14
15
  export * from "./descriptionGetter.types.mjs";
15
16
  export * from "./TooltipContent.types.mjs";
@@ -13,6 +13,7 @@ import type { KeyboardFocusHandler } from "../../../featurePlugins/useChartKeybo
13
13
  import type { IdentifierSerializer } from "./identifierSerializer.types.mjs";
14
14
  import type { IdentifierCleaner } from "./identifierCleaner.types.mjs";
15
15
  import type { GetItemAtPosition } from "./getItemAtPosition.types.mjs";
16
+ import type { GetItemWithData } from "./getItemWithData.types.mjs";
16
17
  import type { DescriptionGetter } from "./descriptionGetter.types.mjs";
17
18
  import type { UseChartCartesianAxisSignature } from "../../../featurePlugins/useChartCartesianAxis/index.mjs";
18
19
  import type { UseChartPolarAxisSignature } from "../../../featurePlugins/useChartPolarAxis/index.mjs";
@@ -56,6 +57,11 @@ export type ChartSeriesTypeConfig<SeriesType extends ChartSeriesType> = {
56
57
  */
57
58
  identifierCleaner: IdentifierCleaner<SeriesType>;
58
59
  getItemAtPosition?: GetItemAtPosition<SeriesType>;
60
+ /**
61
+ * Completes a focused item identifier with the data a pointer click provides.
62
+ * Used by keyboard activation to emit the same payload as a click.
63
+ */
64
+ getItemWithData?: GetItemWithData<SeriesType>;
59
65
  /**
60
66
  * Optional sampling strategy used to render large datasets. When set and sampling is enabled,
61
67
  * the series is reduced to a zoom-appropriate level of detail before rendering.
@@ -13,6 +13,7 @@ import type { KeyboardFocusHandler } from "../../../featurePlugins/useChartKeybo
13
13
  import type { IdentifierSerializer } from "./identifierSerializer.types.js";
14
14
  import type { IdentifierCleaner } from "./identifierCleaner.types.js";
15
15
  import type { GetItemAtPosition } from "./getItemAtPosition.types.js";
16
+ import type { GetItemWithData } from "./getItemWithData.types.js";
16
17
  import type { DescriptionGetter } from "./descriptionGetter.types.js";
17
18
  import type { UseChartCartesianAxisSignature } from "../../../featurePlugins/useChartCartesianAxis/index.js";
18
19
  import type { UseChartPolarAxisSignature } from "../../../featurePlugins/useChartPolarAxis/index.js";
@@ -56,6 +57,11 @@ export type ChartSeriesTypeConfig<SeriesType extends ChartSeriesType> = {
56
57
  */
57
58
  identifierCleaner: IdentifierCleaner<SeriesType>;
58
59
  getItemAtPosition?: GetItemAtPosition<SeriesType>;
60
+ /**
61
+ * Completes a focused item identifier with the data a pointer click provides.
62
+ * Used by keyboard activation to emit the same payload as a click.
63
+ */
64
+ getItemWithData?: GetItemWithData<SeriesType>;
59
65
  /**
60
66
  * Optional sampling strategy used to render large datasets. When set and sampling is enabled,
61
67
  * the series is reduced to a zoom-appropriate level of detail before rendering.
@@ -0,0 +1,21 @@
1
+ import type { AxisId, ChartsAxisData, ChartsAxisProps } from "../../../../models/axis.mjs";
2
+ import type { ProcessedSeries } from "../../corePlugins/useChartSeries/index.mjs";
3
+ import type { ChartSeriesType } from "../../../../models/seriesType/config.mjs";
4
+ import type { ComputeResult } from "./computeAxisValue.mjs";
5
+ /**
6
+ * Builds the `onAxisClick` payload for a data index on a given axis.
7
+ * Returns `null` when the axis has no value at this index.
8
+ */
9
+ export declare function getAxisClickPayload({
10
+ axisId,
11
+ dataIndex,
12
+ isXAxis,
13
+ axes,
14
+ processedSeries
15
+ }: {
16
+ axisId: AxisId;
17
+ dataIndex: number;
18
+ isXAxis: boolean;
19
+ axes: ComputeResult<ChartsAxisProps>['axis'];
20
+ processedSeries: ProcessedSeries<ChartSeriesType>;
21
+ }): ChartsAxisData | null;
@@ -0,0 +1,21 @@
1
+ import type { AxisId, ChartsAxisData, ChartsAxisProps } from "../../../../models/axis.js";
2
+ import type { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
3
+ import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
4
+ import type { ComputeResult } from "./computeAxisValue.js";
5
+ /**
6
+ * Builds the `onAxisClick` payload for a data index on a given axis.
7
+ * Returns `null` when the axis has no value at this index.
8
+ */
9
+ export declare function getAxisClickPayload({
10
+ axisId,
11
+ dataIndex,
12
+ isXAxis,
13
+ axes,
14
+ processedSeries
15
+ }: {
16
+ axisId: AxisId;
17
+ dataIndex: number;
18
+ isXAxis: boolean;
19
+ axes: ComputeResult<ChartsAxisProps>['axis'];
20
+ processedSeries: ProcessedSeries<ChartSeriesType>;
21
+ }): ChartsAxisData | null;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getAxisClickPayload = getAxisClickPayload;
7
+ const AXIS_CLICK_SERIES_TYPES = new Set(['bar', 'rangeBar', 'line']);
8
+ /**
9
+ * Builds the `onAxisClick` payload for a data index on a given axis.
10
+ * Returns `null` when the axis has no value at this index.
11
+ */
12
+ function getAxisClickPayload({
13
+ axisId,
14
+ dataIndex,
15
+ isXAxis,
16
+ axes,
17
+ processedSeries
18
+ }) {
19
+ const axisValue = axes[axisId]?.data?.[dataIndex];
20
+ if (axisValue === undefined) {
21
+ return null;
22
+ }
23
+ const seriesValues = {};
24
+ Object.keys(processedSeries).filter(seriesType => AXIS_CLICK_SERIES_TYPES.has(seriesType)).forEach(seriesType => {
25
+ // @ts-ignore
26
+ const seriesTypeConfig = processedSeries[seriesType];
27
+ seriesTypeConfig?.seriesOrder.forEach(seriesId => {
28
+ const seriesItem = seriesTypeConfig.series[seriesId];
29
+ const providedXAxisId = seriesItem.xAxisId;
30
+ const providedYAxisId = seriesItem.yAxisId;
31
+ const axisKey = isXAxis ? providedXAxisId : providedYAxisId;
32
+ if (axisKey === undefined || axisKey === axisId) {
33
+ // @ts-ignore This is safe because users need to opt in to use range bar series.
34
+ // In that case, they should import the module augmentation from `x-charts-pro/moduleAugmentation/rangeBarOnClick`
35
+ // Which adds the proper type to the series data.
36
+ // TODO(v10): Remove this ts-ignore when we can make the breaking change to ChartsAxisData.
37
+ seriesValues[seriesId] = seriesItem.data[dataIndex];
38
+ }
39
+ });
40
+ });
41
+ return {
42
+ dataIndex,
43
+ axisValue,
44
+ seriesValues
45
+ };
46
+ }