@mui/x-charts 9.7.0 β†’ 9.8.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 (54) hide show
  1. package/CHANGELOG.md +130 -1
  2. package/ChartsTooltip/ChartsTooltipContainer.js +14 -3
  3. package/ChartsTooltip/ChartsTooltipContainer.mjs +15 -4
  4. package/ChartsXAxis/ChartsGroupedXAxisTicks.js +3 -13
  5. package/ChartsXAxis/ChartsGroupedXAxisTicks.mjs +2 -12
  6. package/ChartsYAxis/ChartsGroupedYAxisTicks.js +4 -16
  7. package/ChartsYAxis/ChartsGroupedYAxisTicks.mjs +3 -13
  8. package/hooks/index.d.mts +2 -1
  9. package/hooks/index.d.ts +2 -1
  10. package/hooks/index.js +10 -2
  11. package/hooks/index.mjs +2 -1
  12. package/hooks/usePolarGeometry.d.mts +51 -0
  13. package/hooks/usePolarGeometry.d.ts +51 -0
  14. package/hooks/usePolarGeometry.js +47 -0
  15. package/hooks/usePolarGeometry.mjs +41 -0
  16. package/index.js +1 -1
  17. package/index.mjs +1 -1
  18. package/internals/animation/animation.d.mts +1 -1
  19. package/internals/animation/animation.d.ts +1 -1
  20. package/internals/commonNextFocusItem.d.mts +15 -5
  21. package/internals/commonNextFocusItem.d.ts +15 -5
  22. package/internals/commonNextFocusItem.js +6 -0
  23. package/internals/commonNextFocusItem.mjs +7 -0
  24. package/internals/createCommonKeyboardFocusHandler.d.mts +5 -1
  25. package/internals/createCommonKeyboardFocusHandler.d.ts +5 -1
  26. package/internals/getGroupingConfig.d.mts +6 -0
  27. package/internals/getGroupingConfig.d.ts +6 -0
  28. package/internals/getGroupingConfig.js +20 -0
  29. package/internals/getGroupingConfig.mjs +12 -0
  30. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.mts +1 -0
  31. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -0
  32. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.mts +1 -1
  33. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.ts +1 -1
  34. package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.mts +7 -1
  35. package/internals/plugins/corePlugins/useChartSeriesConfig/types/seriesConfig.types.d.ts +7 -1
  36. package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipItemPositionGetter.types.d.mts +18 -7
  37. package/internals/plugins/corePlugins/useChartSeriesConfig/types/tooltipItemPositionGetter.types.d.ts +18 -7
  38. package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.mts +1 -1
  39. package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
  40. package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.mts +1 -1
  41. package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
  42. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +1 -1
  43. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +1 -1
  44. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +3 -7
  45. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.mjs +3 -7
  46. package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.selectors.d.mts +1 -2
  47. package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.selectors.d.ts +1 -2
  48. package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.types.d.mts +9 -0
  49. package/internals/plugins/featurePlugins/useGeoProjection/useGeoProjection.types.d.ts +9 -0
  50. package/internals/shallowEqual.d.mts +1 -1
  51. package/internals/shallowEqual.d.ts +1 -1
  52. package/internals/shallowEqual.js +1 -1
  53. package/internals/shallowEqual.mjs +1 -1
  54. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,135 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.8.0
4
+
5
+ _Jul 2, 2026_
6
+
7
+ We'd like to extend a big thank you to the 18 contributors who made this release possible. Here are some highlights ✨:
8
+
9
+ - πŸ—ΊοΈ New [`MapImagePlot`](https://mui.com/x/react-charts/map/) for rendering raster base maps, with `onItemClick` support on map shapes (Premium)
10
+ - πŸ“Š New [`usePolarGeometry`](https://mui.com/x/react-charts/hooks/use-polar-geometry/) hook to build custom radial overlays
11
+ - 🐞 Bugfixes
12
+ - πŸ“š Documentation improvements
13
+
14
+ Special thanks go out to these community members for their valuable contributions:
15
+ @Anexus5919, @aromanio, @greymoth-jp, @mustafajw07, @timbuckley, @voidmatcha
16
+
17
+ The following team members contributed to this release:
18
+ @alexfauquette, @arminmeh, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @joserodolfofreitas, @LukasTy, @mapache-salvaje, @michelengelen, @rita-codes, @sai6855
19
+
20
+ ### Data Grid
21
+
22
+ #### `@mui/x-data-grid@9.8.0`
23
+
24
+ - [DataGrid] Prevent cell editing from resurrecting a deleted row (#22958) @Anexus5919
25
+ - [DataGrid] Avoid reading `type` of `undefined` in `gridRowUtils` (#21808) @timbuckley
26
+ - [DataGrid] Improved get started tutorial (#22911) @joserodolfofreitas
27
+ - [l10n] Improve Japanese (ja-JP) locale (#23001) @greymoth-jp
28
+
29
+ #### `@mui/x-data-grid-pro@9.8.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
30
+
31
+ Same changes as in `@mui/x-data-grid@9.8.0`.
32
+
33
+ #### `@mui/x-data-grid-premium@9.8.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
34
+
35
+ Same changes as in `@mui/x-data-grid-pro@9.8.0`, plus:
36
+
37
+ - [DataGridPremium] Escape `singleSelect` values in Excel export with `escapeFormulas` enabled (#22851) @Anexus5919
38
+
39
+ ### Date and Time Pickers
40
+
41
+ #### `@mui/x-date-pickers@9.8.0`
42
+
43
+ - [pickers] Fix localized digit crash (#22995) @alexfauquette
44
+ - [pickers] Flag the first and last visible day cell across year boundaries (#22981) @Anexus5919
45
+ - [pickers] Use calendar day tokens in `AdapterMomentHijri` and `AdapterMomentJalaali` formats (#22974) @Anexus5919
46
+ - [pickers] Use the Hijri day token in `AdapterMomentHijri` `normalDateWithWeekday` (#22972) @Anexus5919
47
+ - [l10n] Improve Romanian (ro-RO) locale (#22969) @aromanio
48
+
49
+ #### `@mui/x-date-pickers-pro@9.8.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-date-pickers@9.8.0`, plus:
52
+
53
+ - [DateRangeCalendar] Fix auto month-switch across the year boundary (#22987) @Anexus5919
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@9.8.0`
58
+
59
+ - [charts] Decouple `d3-geo` from the universal tooltip (#23011) @sai6855
60
+ - [charts] Deduplicate `getGroupingConfig` (#22889) @sai6855
61
+ - [charts] Expose `usePolarGeometry` hook for radial overlays (#22892) @mustafajw07
62
+
63
+ #### `@mui/x-charts-pro@9.8.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
64
+
65
+ Same changes as in `@mui/x-charts@9.8.0`.
66
+
67
+ #### `@mui/x-charts-premium@9.8.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
68
+
69
+ Same changes as in `@mui/x-charts-pro@9.8.0`, plus:
70
+
71
+ - [charts-premium] Add `onItemClick` support for the Map shapes (#22876) @sai6855
72
+ - [charts-premium] Replace `dataIndex` with `name` in map identifier (#22891) @sai6855
73
+ - [charts-premium] Share helper function (#23030) @alexfauquette
74
+ - [charts-premium] Extract shared WebGL utilities across bar/scatter/heatmap renderers (#22466) @sai6855
75
+ - [charts-premium] Add `MapImagePlot` for raster base maps (#22977) @JCQuintas
76
+
77
+ ### Tree View
78
+
79
+ #### `@mui/x-tree-view@9.8.0`
80
+
81
+ - [TreeView] Fix extra selection event when clicking a collapsed parent item (#22249) @michelengelen
82
+ - [TreeView] Enforce top-level type imports (#23034) @Janpot
83
+
84
+ #### `@mui/x-tree-view-pro@9.8.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
85
+
86
+ Same changes as in `@mui/x-tree-view@9.8.0`.
87
+
88
+ ### Scheduler
89
+
90
+ #### `@mui/x-scheduler@9.0.0-beta.4`
91
+
92
+ - [scheduler] Enforce top-level type imports (#22931) @Janpot
93
+ - [scheduler] Keep the occurrence date when editing only one recurring event (#23007) @Anexus5919
94
+ - [scheduler] Track bundle size of scheduler packages (#22682) @flaviendelangle
95
+ - [scheduler] Add `viewConfig` prop to limit displayed hours in the day and week views (#22929) @flaviendelangle
96
+
97
+ #### `@mui/x-scheduler-premium@9.0.0-beta.4` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
98
+
99
+ Same changes as in `@mui/x-scheduler@9.0.0-beta.4`, plus:
100
+
101
+ - [scheduler] Collapsible resources in the timeline (#22920) @rita-codes
102
+
103
+ ### Codemod
104
+
105
+ #### `@mui/x-codemod@9.8.0`
106
+
107
+ Internal changes.
108
+
109
+ ### Docs
110
+
111
+ - [docs] Add recipe for conditional master-detail panels (#22971) @michelengelen
112
+ - [docs] Add recipe for describing active filters in the toolbar (#22970) @michelengelen
113
+ - [docs] Add recipe for triggering clipboard copy from a button (#22967) @michelengelen
114
+ - [docs] Clarify that `fieldRef.current.focusField()` is the canonical way to focus a field (#22937) @michelengelen
115
+ - [docs][scheduler] Another copyediting pass across the Scheduler docs (#22619) @mapache-salvaje
116
+ - [docs][charts] Add map example for arbitrary GeoJSON shapes (#22976) @JCQuintas
117
+ - [docs][charts] Double point count in `ScatterAsyncRenderer` demo (#22906) @JCQuintas
118
+
119
+ ### Core
120
+
121
+ - [code-infra] Fix tracking branch bug in release script (#22956) @michelengelen
122
+ - [code-infra] Remove mark-duplicate workflow (#22994) @cherniavskii
123
+ - [code-infra] Revert `nanoid@3.3.15` `minimumReleaseAge` exemption (#22953) @LukasTy
124
+
125
+ ### Miscellaneous
126
+
127
+ - [internals] Fix `ERR_UNSUPPORTED_DIR_IMPORT` for `core-js-pure` in Node ESM (#22985) @michelengelen
128
+ - [internals] Harden `useDisposable` React internals read with safeReact (#22986) @rita-codes
129
+ - [internals] Replace core-js `DisposableStack` ponyfill with a minimal fallback (#23002) @sai6855
130
+ - [test] Assert the edited `dateTime` cell value in the e2e edit test (#22982) @voidmatcha
131
+ - [virtualizer] Remeasure scrollbars when layout changes (#22914) @arminmeh
132
+
3
133
  ## 9.7.0
4
134
 
5
135
  _Jun 25, 2026_
@@ -178,7 +308,6 @@ Same changes as in `@mui/x-charts-pro@9.6.0`, plus:
178
308
  - [charts-premium] Support maps tooltip positioned on items (#22648) @alexfauquette
179
309
  - [docs] Show how to export maps (#22837) @alexfauquette
180
310
 
181
-
182
311
  ### Tree View
183
312
 
184
313
  #### `@mui/x-tree-view@9.6.0`
@@ -25,6 +25,7 @@ var _warning = require("@mui/x-internals/warning");
25
25
  var _utils = require("./utils");
26
26
  var _chartsTooltipClasses = require("./chartsTooltipClasses");
27
27
  var _useStore = require("../internals/store/useStore");
28
+ var _useChartSeriesConfig = require("../internals/plugins/corePlugins/useChartSeriesConfig");
28
29
  var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
29
30
  var _useChartTooltip = require("../internals/plugins/featurePlugins/useChartTooltip");
30
31
  var _useChartCartesianTooltip = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianTooltip.selectors");
@@ -56,10 +57,13 @@ const defaultAnchorByTrigger = {
56
57
  axis: 'chart',
57
58
  none: 'pointer'
58
59
  };
59
- const getPositionSelectorByAnchor = anchor => {
60
+
61
+ // The axis and null selectors take a state the item selector's state is
62
+ // assignable to, so they all converge to `TooltipItemPositionSelector`.
63
+ const getPositionSelectorByAnchor = (anchor, selectorItemPosition) => {
60
64
  switch (anchor) {
61
65
  case 'node':
62
- return _useChartTooltip.selectorChartsTooltipItemPosition;
66
+ return selectorItemPosition;
63
67
  case 'chart':
64
68
  return _useChartCartesianTooltip.selectorChartsTooltipAxisPosition;
65
69
  default:
@@ -125,7 +129,14 @@ function ChartsTooltipContainer(inProps) {
125
129
  const lastInteraction = store.use(_useChartInteraction.selectorChartsLastInteraction);
126
130
  const pointerAnchorUnavailable = lastInteraction === 'keyboard' || pointerType === null;
127
131
  const computedAnchor = pointerAnchorUnavailable ? defaultAnchorByTrigger[trigger] : anchor;
128
- const itemPosition = store.use(getPositionSelectorByAnchor(computedAnchor), props.position);
132
+
133
+ // A series type can override how its item tooltip is positioned (e.g. map
134
+ // shapes position from the geo projection); otherwise the generic item
135
+ // selector is used.
136
+ const tooltipItem = store.use(_useChartTooltip.selectorChartsTooltipItem);
137
+ const seriesConfig = store.use(_useChartSeriesConfig.selectorChartSeriesConfig);
138
+ const selectorItemPosition = tooltipItem && seriesConfig[tooltipItem.type]?.selectorTooltipItemPosition || _useChartTooltip.selectorChartsTooltipItemPosition;
139
+ const itemPosition = store.use(getPositionSelectorByAnchor(computedAnchor, selectorItemPosition), props.position);
129
140
  const isTooltipNodeAnchored = itemPosition !== null;
130
141
  React.useEffect(() => {
131
142
  const svgElement = chartsLayerContainerRef.current;
@@ -18,8 +18,9 @@ import { warnOnce } from '@mui/x-internals/warning';
18
18
  import { useIsFineMainPointer } from "./utils.mjs";
19
19
  import { useUtilityClasses } from "./chartsTooltipClasses.mjs";
20
20
  import { useStore } from "../internals/store/useStore.mjs";
21
+ import { selectorChartSeriesConfig } from "../internals/plugins/corePlugins/useChartSeriesConfig/index.mjs";
21
22
  import { selectorChartsLastInteraction, selectorChartsPointerType } from "../internals/plugins/featurePlugins/useChartInteraction/index.mjs";
22
- import { selectorChartsTooltipItemIsDefined, selectorChartsTooltipItemPosition } from "../internals/plugins/featurePlugins/useChartTooltip/index.mjs";
23
+ import { selectorChartsTooltipItem, selectorChartsTooltipItemIsDefined, selectorChartsTooltipItemPosition } from "../internals/plugins/featurePlugins/useChartTooltip/index.mjs";
23
24
  import { selectorChartsInteractionAxisTooltip, selectorChartsTooltipAxisPosition } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianTooltip.selectors.mjs";
24
25
  import { selectorChartsInteractionPolarAxisTooltip } from "../internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.mjs";
25
26
  import { useAxisSystem } from "../hooks/useAxisSystem.mjs";
@@ -49,10 +50,13 @@ const defaultAnchorByTrigger = {
49
50
  axis: 'chart',
50
51
  none: 'pointer'
51
52
  };
52
- const getPositionSelectorByAnchor = anchor => {
53
+
54
+ // The axis and null selectors take a state the item selector's state is
55
+ // assignable to, so they all converge to `TooltipItemPositionSelector`.
56
+ const getPositionSelectorByAnchor = (anchor, selectorItemPosition) => {
53
57
  switch (anchor) {
54
58
  case 'node':
55
- return selectorChartsTooltipItemPosition;
59
+ return selectorItemPosition;
56
60
  case 'chart':
57
61
  return selectorChartsTooltipAxisPosition;
58
62
  default:
@@ -118,7 +122,14 @@ function ChartsTooltipContainer(inProps) {
118
122
  const lastInteraction = store.use(selectorChartsLastInteraction);
119
123
  const pointerAnchorUnavailable = lastInteraction === 'keyboard' || pointerType === null;
120
124
  const computedAnchor = pointerAnchorUnavailable ? defaultAnchorByTrigger[trigger] : anchor;
121
- const itemPosition = store.use(getPositionSelectorByAnchor(computedAnchor), props.position);
125
+
126
+ // A series type can override how its item tooltip is positioned (e.g. map
127
+ // shapes position from the geo projection); otherwise the generic item
128
+ // selector is used.
129
+ const tooltipItem = store.use(selectorChartsTooltipItem);
130
+ const seriesConfig = store.use(selectorChartSeriesConfig);
131
+ const selectorItemPosition = tooltipItem && seriesConfig[tooltipItem.type]?.selectorTooltipItemPosition || selectorChartsTooltipItemPosition;
132
+ const itemPosition = store.use(getPositionSelectorByAnchor(computedAnchor, selectorItemPosition), props.position);
122
133
  const isTooltipNodeAnchored = itemPosition !== null;
123
134
  React.useEffect(() => {
124
135
  const svgElement = chartsLayerContainerRef.current;
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.ChartsGroupedXAxisTicks = ChartsGroupedXAxisTicks;
10
- var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
11
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _scaleGuards = require("../internals/scaleGuards");
14
14
  var _useChartsContext = require("../context/ChartsProvider/useChartsContext");
@@ -17,18 +17,8 @@ var _useTicksGrouped = require("../hooks/useTicksGrouped");
17
17
  var _useAxisTicksProps = require("./useAxisTicksProps");
18
18
  var _useStore = require("../internals/store/useStore");
19
19
  var _useChartAxisAutoSize = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors");
20
+ var _getGroupingConfig = require("../internals/getGroupingConfig");
20
21
  var _jsxRuntime = require("react/jsx-runtime");
21
- const DEFAULT_GROUPING_CONFIG = {
22
- tickSize: 6
23
- };
24
- const getGroupingConfig = (groups, groupIndex, tickSize, computedGroupTickSizes) => {
25
- const config = groups[groupIndex] ?? {};
26
- const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
27
- const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
28
- return (0, _extends2.default)({}, DEFAULT_GROUPING_CONFIG, config, {
29
- tickSize: computedGroupTickSizes?.[groupIndex] ?? config.tickSize ?? calculatedTickSize
30
- });
31
- };
32
22
  /**
33
23
  * @ignore - internal component.
34
24
  */
@@ -87,7 +77,7 @@ function ChartsGroupedXAxisTicks(inProps) {
87
77
  const tickLabel = item.formattedValue;
88
78
  const ignoreTick = item.ignoreTick ?? false;
89
79
  const groupIndex = item.groupIndex ?? 0;
90
- const groupConfig = getGroupingConfig(groups, groupIndex, tickSize, computedGroupTickSizes);
80
+ const groupConfig = (0, _getGroupingConfig.getGroupingConfig)(groups, groupIndex, tickSize, computedGroupTickSizes);
91
81
  const tickYSize = positionSign * groupConfig.tickSize;
92
82
  const labelPositionY = positionSign * (groupConfig.tickSize + _utilities.TICK_LABEL_GAP);
93
83
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
4
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
5
5
  import * as React from 'react';
6
6
  import { isOrdinalScale } from "../internals/scaleGuards.mjs";
7
7
  import { useChartsContext } from "../context/ChartsProvider/useChartsContext.mjs";
@@ -10,18 +10,8 @@ import { useTicksGrouped } from "../hooks/useTicksGrouped.mjs";
10
10
  import { useAxisTicksProps } from "./useAxisTicksProps.mjs";
11
11
  import { useStore } from "../internals/store/useStore.mjs";
12
12
  import { selectorChartXAxisAutoSizeResults } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.mjs";
13
+ import { getGroupingConfig } from "../internals/getGroupingConfig.mjs";
13
14
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const DEFAULT_GROUPING_CONFIG = {
15
- tickSize: 6
16
- };
17
- const getGroupingConfig = (groups, groupIndex, tickSize, computedGroupTickSizes) => {
18
- const config = groups[groupIndex] ?? {};
19
- const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
20
- const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
21
- return _extends({}, DEFAULT_GROUPING_CONFIG, config, {
22
- tickSize: computedGroupTickSizes?.[groupIndex] ?? config.tickSize ?? calculatedTickSize
23
- });
24
- };
25
15
  /**
26
16
  * @ignore - internal component.
27
17
  */
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.ChartsGroupedYAxisTicks = ChartsGroupedYAxisTicks;
10
- var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
11
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
+ var _formatErrorMessage2 = _interopRequireDefault(require("@mui/x-internals/formatErrorMessage"));
12
12
  var React = _interopRequireWildcard(require("react"));
13
13
  var _scaleGuards = require("../internals/scaleGuards");
14
14
  var _useChartsContext = require("../context/ChartsProvider/useChartsContext");
@@ -17,23 +17,11 @@ var _useTicksGrouped = require("../hooks/useTicksGrouped");
17
17
  var _useAxisTicksProps = require("./useAxisTicksProps");
18
18
  var _useStore = require("../internals/store/useStore");
19
19
  var _useChartAxisAutoSize = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors");
20
+ var _getGroupingConfig = require("../internals/getGroupingConfig");
20
21
  var _jsxRuntime = require("react/jsx-runtime");
21
- const DEFAULT_GROUPING_CONFIG = {
22
- tickSize: 6
23
- };
24
- const getGroupingConfig = (groups, groupIndex, tickSize, computedGroupTickSizes) => {
25
- const config = groups[groupIndex] ?? {};
26
- const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
27
- const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
28
- return (0, _extends2.default)({}, DEFAULT_GROUPING_CONFIG, config, {
29
- tickSize: computedGroupTickSizes?.[groupIndex] ?? config.tickSize ?? calculatedTickSize
30
- });
31
- };
32
-
33
22
  /**
34
23
  * @ignore - internal component.
35
- */
36
- function ChartsGroupedYAxisTicks(inProps) {
24
+ */function ChartsGroupedYAxisTicks(inProps) {
37
25
  const {
38
26
  yScale,
39
27
  defaultizedProps,
@@ -88,7 +76,7 @@ function ChartsGroupedYAxisTicks(inProps) {
88
76
  const tickLabel = item.formattedValue;
89
77
  const ignoreTick = item.ignoreTick ?? false;
90
78
  const groupIndex = item.groupIndex ?? 0;
91
- const groupConfig = getGroupingConfig(groups, groupIndex, tickSize, computedGroupTickSizes);
79
+ const groupConfig = (0, _getGroupingConfig.getGroupingConfig)(groups, groupIndex, tickSize, computedGroupTickSizes);
92
80
  const tickXSize = positionSign * groupConfig.tickSize;
93
81
  const labelPositionX = positionSign * (groupConfig.tickSize + _utilities.TICK_LABEL_GAP);
94
82
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
4
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
5
5
  import * as React from 'react';
6
6
  import { isOrdinalScale } from "../internals/scaleGuards.mjs";
7
7
  import { useChartsContext } from "../context/ChartsProvider/useChartsContext.mjs";
@@ -10,22 +10,12 @@ import { useTicksGrouped } from "../hooks/useTicksGrouped.mjs";
10
10
  import { useAxisTicksProps } from "./useAxisTicksProps.mjs";
11
11
  import { useStore } from "../internals/store/useStore.mjs";
12
12
  import { selectorChartYAxisAutoSizeResults } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisAutoSize.selectors.mjs";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const DEFAULT_GROUPING_CONFIG = {
15
- tickSize: 6
16
- };
17
- const getGroupingConfig = (groups, groupIndex, tickSize, computedGroupTickSizes) => {
18
- const config = groups[groupIndex] ?? {};
19
- const defaultTickSize = tickSize ?? DEFAULT_GROUPING_CONFIG.tickSize;
20
- const calculatedTickSize = defaultTickSize * groupIndex * 2 + defaultTickSize;
21
- return _extends({}, DEFAULT_GROUPING_CONFIG, config, {
22
- tickSize: computedGroupTickSizes?.[groupIndex] ?? config.tickSize ?? calculatedTickSize
23
- });
24
- };
13
+ import { getGroupingConfig } from "../internals/getGroupingConfig.mjs";
25
14
 
26
15
  /**
27
16
  * @ignore - internal component.
28
17
  */
18
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
19
  function ChartsGroupedYAxisTicks(inProps) {
30
20
  const {
31
21
  yScale,
package/hooks/index.d.mts CHANGED
@@ -24,4 +24,5 @@ export * from "./useFocusedItem.mjs";
24
24
  export { useXAxisCoordinates, useYAxisCoordinates, type AxisCoordinates } from "./useAxisCoordinates.mjs";
25
25
  export * from "./useAxisTicks.mjs";
26
26
  export { type TickItem } from "./useTicks.mjs";
27
- export * from "./getValueToPositionMapper.mjs";
27
+ export * from "./getValueToPositionMapper.mjs";
28
+ export { usePolarGeometry } from "./usePolarGeometry.mjs";
package/hooks/index.d.ts CHANGED
@@ -24,4 +24,5 @@ export * from "./useFocusedItem.js";
24
24
  export { useXAxisCoordinates, useYAxisCoordinates, type AxisCoordinates } from "./useAxisCoordinates.js";
25
25
  export * from "./useAxisTicks.js";
26
26
  export { type TickItem } from "./useTicks.js";
27
- export * from "./getValueToPositionMapper.js";
27
+ export * from "./getValueToPositionMapper.js";
28
+ export { usePolarGeometry } from "./usePolarGeometry.js";
package/hooks/index.js CHANGED
@@ -9,7 +9,8 @@ var _exportNames = {
9
9
  useChartGradientId: true,
10
10
  useChartGradientIdObjectBound: true,
11
11
  useXAxisCoordinates: true,
12
- useYAxisCoordinates: true
12
+ useYAxisCoordinates: true,
13
+ usePolarGeometry: true
13
14
  };
14
15
  Object.defineProperty(exports, "useChartGradientId", {
15
16
  enumerable: true,
@@ -35,6 +36,12 @@ Object.defineProperty(exports, "usePieSeriesContext", {
35
36
  return _usePieSeries.usePieSeriesContext;
36
37
  }
37
38
  });
39
+ Object.defineProperty(exports, "usePolarGeometry", {
40
+ enumerable: true,
41
+ get: function () {
42
+ return _usePolarGeometry.usePolarGeometry;
43
+ }
44
+ });
38
45
  Object.defineProperty(exports, "useXAxisCoordinates", {
39
46
  enumerable: true,
40
47
  get: function () {
@@ -325,4 +332,5 @@ Object.keys(_getValueToPositionMapper).forEach(function (key) {
325
332
  return _getValueToPositionMapper[key];
326
333
  }
327
334
  });
328
- });
335
+ });
336
+ var _usePolarGeometry = require("./usePolarGeometry");
package/hooks/index.mjs CHANGED
@@ -23,4 +23,5 @@ export * from "./useBrush.mjs";
23
23
  export * from "./useFocusedItem.mjs";
24
24
  export { useXAxisCoordinates, useYAxisCoordinates } from "./useAxisCoordinates.mjs";
25
25
  export * from "./useAxisTicks.mjs";
26
- export * from "./getValueToPositionMapper.mjs";
26
+ export * from "./getValueToPositionMapper.mjs";
27
+ export { usePolarGeometry } from "./usePolarGeometry.mjs";
@@ -0,0 +1,51 @@
1
+ import type { AxisScaleConfig, ScaleName } from "../models/axis.mjs";
2
+ /**
3
+ * Provides access to the geometry of a polar chart.
4
+ *
5
+ * It can be used to position custom elements and convert between polar and Cartesian coordinates.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * const geo = usePolarGeometry();
10
+ *
11
+ * const [x, y] = geo.point(100, Math.PI / 2);
12
+ *
13
+ * return <circle cx={geo.cx + x} cy={geo.cy + y} r={4} />
14
+ * ```
15
+ *
16
+ * @returns The polar geometry helpers, or `null` if the chart scales are not ready.
17
+ */
18
+ export declare function usePolarGeometry<AngleScale extends ScaleName = ScaleName, RadiusScale extends ScaleName = ScaleName>(): PolarGeometry<AngleScale, RadiusScale> | null;
19
+ export interface PolarGeometry<AngleScale extends ScaleName = ScaleName, RadiusScale extends ScaleName = ScaleName> {
20
+ /**
21
+ * The X coordinate of the chart center within the SVG.
22
+ */
23
+ cx: number;
24
+ /**
25
+ * The Y coordinate of the chart center within the SVG.
26
+ */
27
+ cy: number;
28
+ /**
29
+ * The scale that maps rotation axis values to angles in radians.
30
+ */
31
+ angleScale: AxisScaleConfig[AngleScale]['scale'];
32
+ /**
33
+ * The scale that maps data values to radii (distance from the chart center).
34
+ */
35
+ radiusScale: AxisScaleConfig[RadiusScale]['scale'];
36
+ /**
37
+ * Converts polar coordinates to Cartesian offsets relative to the chart center.
38
+ * @param {number} radius - Distance from the center.
39
+ * @param {number} angle - Angle in radians, measured clockwise from the top (12 o'clock).
40
+ * @returns {[number, number]} `[x, y]` offset from `[cx, cy]`.
41
+ */
42
+ point: (radius: number, angle: number) => [number, number];
43
+ /**
44
+ * Converts Cartesian offsets (relative to the chart center) back to polar coordinates.
45
+ * The inverse of `point`.
46
+ * @param {number} x - Horizontal offset from `cx`.
47
+ * @param {number} y - Vertical offset from `cy`.
48
+ * @returns {[number, number]} `[radius, angle]` where angle is in radians within `[-Ο€, Ο€]`.
49
+ */
50
+ pointInverse: (x: number, y: number) => [number, number];
51
+ }
@@ -0,0 +1,51 @@
1
+ import type { AxisScaleConfig, ScaleName } from "../models/axis.js";
2
+ /**
3
+ * Provides access to the geometry of a polar chart.
4
+ *
5
+ * It can be used to position custom elements and convert between polar and Cartesian coordinates.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * const geo = usePolarGeometry();
10
+ *
11
+ * const [x, y] = geo.point(100, Math.PI / 2);
12
+ *
13
+ * return <circle cx={geo.cx + x} cy={geo.cy + y} r={4} />
14
+ * ```
15
+ *
16
+ * @returns The polar geometry helpers, or `null` if the chart scales are not ready.
17
+ */
18
+ export declare function usePolarGeometry<AngleScale extends ScaleName = ScaleName, RadiusScale extends ScaleName = ScaleName>(): PolarGeometry<AngleScale, RadiusScale> | null;
19
+ export interface PolarGeometry<AngleScale extends ScaleName = ScaleName, RadiusScale extends ScaleName = ScaleName> {
20
+ /**
21
+ * The X coordinate of the chart center within the SVG.
22
+ */
23
+ cx: number;
24
+ /**
25
+ * The Y coordinate of the chart center within the SVG.
26
+ */
27
+ cy: number;
28
+ /**
29
+ * The scale that maps rotation axis values to angles in radians.
30
+ */
31
+ angleScale: AxisScaleConfig[AngleScale]['scale'];
32
+ /**
33
+ * The scale that maps data values to radii (distance from the chart center).
34
+ */
35
+ radiusScale: AxisScaleConfig[RadiusScale]['scale'];
36
+ /**
37
+ * Converts polar coordinates to Cartesian offsets relative to the chart center.
38
+ * @param {number} radius - Distance from the center.
39
+ * @param {number} angle - Angle in radians, measured clockwise from the top (12 o'clock).
40
+ * @returns {[number, number]} `[x, y]` offset from `[cx, cy]`.
41
+ */
42
+ point: (radius: number, angle: number) => [number, number];
43
+ /**
44
+ * Converts Cartesian offsets (relative to the chart center) back to polar coordinates.
45
+ * The inverse of `point`.
46
+ * @param {number} x - Horizontal offset from `cx`.
47
+ * @param {number} y - Vertical offset from `cy`.
48
+ * @returns {[number, number]} `[radius, angle]` where angle is in radians within `[-Ο€, Ο€]`.
49
+ */
50
+ pointInverse: (x: number, y: number) => [number, number];
51
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePolarGeometry = usePolarGeometry;
7
+ var _useDrawingArea = require("./useDrawingArea");
8
+ var _useAxis = require("./useAxis");
9
+ /**
10
+ * Provides access to the geometry of a polar chart.
11
+ *
12
+ * It can be used to position custom elements and convert between polar and Cartesian coordinates.
13
+ *
14
+ * @example
15
+ * ```tsx
16
+ * const geo = usePolarGeometry();
17
+ *
18
+ * const [x, y] = geo.point(100, Math.PI / 2);
19
+ *
20
+ * return <circle cx={geo.cx + x} cy={geo.cy + y} r={4} />
21
+ * ```
22
+ *
23
+ * @returns The polar geometry helpers, or `null` if the chart scales are not ready.
24
+ */
25
+ function usePolarGeometry() {
26
+ const {
27
+ left,
28
+ top,
29
+ width,
30
+ height
31
+ } = (0, _useDrawingArea.useDrawingArea)();
32
+ const rotationAxis = (0, _useAxis.useRotationAxis)();
33
+ const radiusAxis = (0, _useAxis.useRadiusAxis)();
34
+ if (!rotationAxis || !radiusAxis) {
35
+ return null;
36
+ }
37
+ const angleScale = rotationAxis.scale;
38
+ const radiusScale = radiusAxis.scale;
39
+ return {
40
+ cx: left + width / 2,
41
+ cy: top + height / 2,
42
+ angleScale,
43
+ radiusScale,
44
+ point: (radius, angle) => [radius * Math.sin(angle), -radius * Math.cos(angle)],
45
+ pointInverse: (x, y) => [Math.sqrt(x * x + y * y), Math.atan2(x, -y)]
46
+ };
47
+ }
@@ -0,0 +1,41 @@
1
+ import { useDrawingArea } from "./useDrawingArea.mjs";
2
+ import { useRotationAxis, useRadiusAxis } from "./useAxis.mjs";
3
+ /**
4
+ * Provides access to the geometry of a polar chart.
5
+ *
6
+ * It can be used to position custom elements and convert between polar and Cartesian coordinates.
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const geo = usePolarGeometry();
11
+ *
12
+ * const [x, y] = geo.point(100, Math.PI / 2);
13
+ *
14
+ * return <circle cx={geo.cx + x} cy={geo.cy + y} r={4} />
15
+ * ```
16
+ *
17
+ * @returns The polar geometry helpers, or `null` if the chart scales are not ready.
18
+ */
19
+ export function usePolarGeometry() {
20
+ const {
21
+ left,
22
+ top,
23
+ width,
24
+ height
25
+ } = useDrawingArea();
26
+ const rotationAxis = useRotationAxis();
27
+ const radiusAxis = useRadiusAxis();
28
+ if (!rotationAxis || !radiusAxis) {
29
+ return null;
30
+ }
31
+ const angleScale = rotationAxis.scale;
32
+ const radiusScale = radiusAxis.scale;
33
+ return {
34
+ cx: left + width / 2,
35
+ cy: top + height / 2,
36
+ angleScale,
37
+ radiusScale,
38
+ point: (radius, angle) => [radius * Math.sin(angle), -radius * Math.cos(angle)],
39
+ pointInverse: (x, y) => [Math.sqrt(x * x + y * y), Math.atan2(x, -y)]
40
+ };
41
+ }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v9.7.0
2
+ * @mui/x-charts v9.8.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.7.0
2
+ * @mui/x-charts v9.8.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,3 +1,3 @@
1
1
  export declare const ANIMATION_DURATION_MS = 300;
2
2
  export declare const ANIMATION_TIMING_FUNCTION = "cubic-bezier(0.66, 0, 0.34, 1)";
3
- export declare const ANIMATION_TIMING_FUNCTION_JS: import("bezier-easing").EasingFunction;
3
+ export declare const ANIMATION_TIMING_FUNCTION_JS: (x: number) => number;
@@ -1,3 +1,3 @@
1
1
  export declare const ANIMATION_DURATION_MS = 300;
2
2
  export declare const ANIMATION_TIMING_FUNCTION = "cubic-bezier(0.66, 0, 0.34, 1)";
3
- export declare const ANIMATION_TIMING_FUNCTION_JS: import("bezier-easing").EasingFunction;
3
+ export declare const ANIMATION_TIMING_FUNCTION_JS: (x: number) => number;