@mui/x-date-pickers 9.11.0 → 9.12.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,170 @@
1
1
  # Changelog
2
2
 
3
+ ## 9.12.0
4
+
5
+ _Aug 21, 2026_
6
+
7
+ We'd like to extend a big thank you to the 12 contributors who made this release possible. Here are some highlights ✨:
8
+
9
+ - 🧮 Support [Formulas](https://mui.com/x/react-data-grid/formulas/) on the Data Grid: cells in opted-in columns can hold spreadsheet-like formulas (`=SUM(RANGE(…))`, `=price * quantity`) evaluated by a built-in engine, with a formula editor and [Formula Bar](https://mui.com/x/react-data-grid/components/formula-bar/), autocomplete, reference highlighting, optional A1 notation, fill-handle reference adjustment, custom functions, and live formula Excel export
10
+ - ♿️ Improve the accessibility of Data Grid cells and picker day cells
11
+ - 🗓️ Enable multi-resource event creation and editing in the Scheduler
12
+ - 🐞 Bugfixes
13
+ - 📚 Documentation improvements
14
+
15
+ Special thanks go out to these community members for their valuable contributions:
16
+ @Anexus5919, @mustafajw07
17
+
18
+ The following team members contributed to this release:
19
+ @brijeshb42, @flaviendelangle, @JCQuintas, @LukasTy, @MBilalShafi, @michelengelen, @noraleonte, @rita-codes, @romgrk, @silviuaavram
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@9.12.0`
24
+
25
+ - [DataGrid] Expose `apiRef` on `GridCallbackDetails` for selector access in callbacks (#22973) @michelengelen
26
+ - [DataGrid] Fix header height not updating when `headerFilters` or `columnGroupingModel` change (#23059) @MBilalShafi
27
+ - [DataGrid] Fix unhandled rejection when unmounting mid-autosize (#23319) @JCQuintas
28
+ - [DataGrid] Label the blank `singleSelect` filter option (#23294) @JCQuintas
29
+ - [DataGrid] Stop sending incomplete filter items to the data source (#23303) @JCQuintas
30
+ - [DataGrid] Support the `rowheader` attribute for grid cells (#23340) @silviuaavram
31
+
32
+ #### `@mui/x-data-grid-pro@9.12.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
33
+
34
+ Same changes as in `@mui/x-data-grid@9.12.0`, plus:
35
+
36
+ - [DataGridPro] Honor `hasNextPage` in infinite lazy loading (#23048) @MBilalShafi
37
+
38
+ #### `@mui/x-data-grid-premium@9.12.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
39
+
40
+ Same changes as in `@mui/x-data-grid-pro@9.12.0`, plus:
41
+
42
+ - [DataGridPremium] Formula support (#22807) @MBilalShafi
43
+
44
+ ### Date and Time Pickers
45
+
46
+ #### `@mui/x-date-pickers@9.12.0`
47
+
48
+ - [fields] Keep the selected section on blank space clicks (#23318) @LukasTy
49
+ - [pickers] Associate the day cells with their week day column header (#23339) @LukasTy
50
+ - [pickers] Keep the `gridcell` role and the column index on filler cells (#23326) @Anexus5919
51
+
52
+ #### `@mui/x-date-pickers-pro@9.12.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
53
+
54
+ Same changes as in `@mui/x-date-pickers@9.12.0`, plus:
55
+
56
+ - [DateRangeCalendar] Round the range highlight at the month grid edges (#23297) @JCQuintas
57
+ - [DateRangePicker] Keep the range highlight opaque for disabled days (#23317) @JCQuintas
58
+
59
+ ### Charts
60
+
61
+ #### `@mui/x-charts@9.12.0`
62
+
63
+ - [charts] Add a demo for label on grid row (#23333) @noraleonte
64
+ - [charts] Fix React 18 `propTypes` warnings and stray-pointer test flakiness (#23384) @LukasTy
65
+ - [charts] Focus the clicked item for keyboard navigation (#23247) @JCQuintas
66
+
67
+ #### `@mui/x-charts-pro@9.12.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-charts@9.12.0`.
70
+
71
+ #### `@mui/x-charts-premium@9.12.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
72
+
73
+ Same changes as in `@mui/x-charts-pro@9.12.0`, plus:
74
+
75
+ - [charts-premium] Add `onItemClick` to the radial charts (#23253) @JCQuintas
76
+
77
+ ### Tree View
78
+
79
+ #### `@mui/x-tree-view@9.12.0`
80
+
81
+ Internal changes.
82
+
83
+ #### `@mui/x-tree-view-pro@9.12.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
84
+
85
+ Same changes as in `@mui/x-tree-view@9.12.0`.
86
+
87
+ ### Scheduler
88
+
89
+ #### `@mui/x-scheduler@9.0.0-beta.10`
90
+
91
+ - [scheduler] Add `onEventEditingStart` to let consumers open their own edit UI (#23361) @rita-codes
92
+ - [scheduler] Fix keyboard and focus issues around the "+N more" popover (#23312) @rita-codes
93
+ - [scheduler] Honor `viewConfig` hour limits in the compact day and week views (#23316) @rita-codes
94
+ - [scheduler] Share timeline event layout data (#23366) @flaviendelangle
95
+ - [scheduler] enable multi-resource event creation and editing (#23313) @mustafajw07
96
+
97
+ #### `@mui/x-scheduler-premium@9.0.0-beta.10` [![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.10`, plus:
100
+
101
+ - [scheduler-premium] Allow to control the min and max hour in the Event Timeline (#23212) @rita-codes
102
+ - [scheduler-premium] Dependencies - Create, select and delete via terminals (#23200) @rita-codes
103
+
104
+ ### Codemod
105
+
106
+ #### `@mui/x-codemod@9.12.0`
107
+
108
+ Internal changes.
109
+
110
+ ### Docs
111
+
112
+ - [docs][charts] Document line mark size customization (#23370) @JCQuintas
113
+ - [docs] Add recipe for constraining the `make-child` drop action by item type (#22940) @michelengelen
114
+ - [docs] Redirect the renamed Event Timeline views page (#23324) @brijeshb42
115
+ - [docs] Remove unused `adapter-dependencies.json` (#23328) @LukasTy
116
+
117
+ ### Core
118
+
119
+ - [code-infra] Add release skill (#23308) @brijeshb42
120
+ - [code-infra] Fix changelog categorization of docs and `DateRangeCalendar` tags (#23385) @JCQuintas
121
+ - [code-infra] Sync mui-release skill (#23330) @brijeshb42
122
+
123
+ ### Miscellaneous
124
+
125
+ - [core] Declare the missing `react-dom` peer dependencies (#23381) @LukasTy
126
+ - [test] Fix act warnings in the data source filter tests (#23360) @JCQuintas
127
+ - [virtualizer] Add inverse-sticky layout (#23053) @romgrk
128
+
129
+ ## 9.11.1
130
+
131
+ _Aug 6, 2026_
132
+
133
+ We'd like to extend a big thank you to the 2 contributors who made this release possible. Here are some highlights ✨:
134
+
135
+ - 🐛 Fix the empty `@mui/x-charts-vendor` package published in v9.11.0
136
+
137
+ The following team members contributed to this release:
138
+ @JCQuintas, @rita-codes
139
+
140
+ ### Charts
141
+
142
+ #### `@mui/x-charts@9.11.1`
143
+
144
+ - [charts] Fix empty `@mui/x-charts-vendor` published package (#23310) @JCQuintas
145
+
146
+ #### `@mui/x-charts-pro@9.11.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
147
+
148
+ Same changes as in `@mui/x-charts@9.11.1`.
149
+
150
+ #### `@mui/x-charts-premium@9.11.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
151
+
152
+ Same changes as in `@mui/x-charts-pro@9.11.1`.
153
+
154
+ #### `@mui/x-charts-vendor@9.11.1`
155
+
156
+ - [charts] Fix empty `@mui/x-charts-vendor` published package (#23310) @JCQuintas
157
+
158
+ ### Scheduler
159
+
160
+ #### `@mui/x-scheduler@9.0.0-beta.9`
161
+
162
+ - [scheduler] Show the range validation errors on the End date and End time fields (#23291) @rita-codes
163
+
164
+ #### `@mui/x-scheduler-premium@9.0.0-beta.9` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
165
+
166
+ Same changes as in `@mui/x-scheduler@9.0.0-beta.9`.
167
+
3
168
  ## 9.11.0
4
169
 
5
170
  _Aug 6, 2026_
@@ -262,6 +262,8 @@ function DayCalendar(inProps) {
262
262
  const now = (0, _useUtils.useNow)(timezone);
263
263
  const classes = useUtilityClasses(classesProp);
264
264
  const isRtl = (0, _RtlProvider.useRtl)();
265
+ // The week number is a `rowheader`, so it takes the first column of the grid.
266
+ const columnIndexOffset = displayWeekNumber ? 1 : 0;
265
267
  const isDateDisabled = (0, _useIsDateDisabled.useIsDateDisabled)({
266
268
  shouldDisableDate,
267
269
  shouldDisableMonth,
@@ -384,19 +386,24 @@ function DayCalendar(inProps) {
384
386
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickerCalendarDayRoot, {
385
387
  role: "grid",
386
388
  "aria-labelledby": gridLabelId,
389
+ "aria-colcount": columnIndexOffset + 7,
390
+ "aria-rowcount": weeksToDisplay.length + 1,
387
391
  className: classes.root,
388
392
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(PickerCalendarDayHeader, {
389
393
  role: "row",
394
+ "aria-rowindex": 1,
390
395
  className: classes.header,
391
396
  children: [displayWeekNumber && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerCalendarWeekNumberLabel, {
392
397
  variant: "caption",
393
398
  role: "columnheader",
399
+ "aria-colindex": 1,
394
400
  "aria-label": translations.calendarWeekNumberHeaderLabel,
395
401
  className: classes.weekNumberLabel,
396
402
  children: translations.calendarWeekNumberHeaderText
397
403
  }), (0, _dateUtils.getWeekdays)(adapter, now).map((weekday, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerCalendarWeekDayLabel, {
398
404
  variant: "caption",
399
405
  role: "columnheader",
406
+ "aria-colindex": columnIndexOffset + i + 1,
400
407
  "aria-label": adapter.format(weekday, 'weekday'),
401
408
  className: classes.weekDayLabel,
402
409
  children: dayOfWeekFormatter(weekday)
@@ -419,13 +426,13 @@ function DayCalendar(inProps) {
419
426
  children: weeksToDisplay.map((week, index) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(PickerCalendarWeek, {
420
427
  role: "row",
421
428
  className: classes.weekContainer
422
- // fix issue of announcing row 1 as row 2
423
- // caused by week day labels row
429
+ // The week day labels row is the first row of the grid.
424
430
  ,
425
- "aria-rowindex": index + 1,
431
+ "aria-rowindex": index + 2,
426
432
  children: [displayWeekNumber && /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerCalendarWeekNumber, {
427
433
  className: classes.weekNumber,
428
434
  role: "rowheader",
435
+ "aria-colindex": 1,
429
436
  "aria-label": translations.calendarWeekNumberAriaLabelText(adapter.getWeekNumber(week[0])),
430
437
  children: translations.calendarWeekNumberText(adapter.getWeekNumber(week[0]))
431
438
  }), week.map((day, dayIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(WrappedDay, {
@@ -439,10 +446,8 @@ function DayCalendar(inProps) {
439
446
  onBlur: handleBlur,
440
447
  onDaySelect: handleDaySelect,
441
448
  isDateDisabled: isDateDisabled,
442
- currentMonthNumber: currentMonthNumber
443
- // fix issue of announcing column 1 as column 2 when `displayWeekNumber` is enabled
444
- ,
445
- "aria-colindex": dayIndex + 1
449
+ currentMonthNumber: currentMonthNumber,
450
+ "aria-colindex": columnIndexOffset + dayIndex + 1
446
451
  }, day.toString()))]
447
452
  }, `week-${week[0]}`))
448
453
  })
@@ -255,6 +255,8 @@ export function DayCalendar(inProps) {
255
255
  const now = useNow(timezone);
256
256
  const classes = useUtilityClasses(classesProp);
257
257
  const isRtl = useRtl();
258
+ // The week number is a `rowheader`, so it takes the first column of the grid.
259
+ const columnIndexOffset = displayWeekNumber ? 1 : 0;
258
260
  const isDateDisabled = useIsDateDisabled({
259
261
  shouldDisableDate,
260
262
  shouldDisableMonth,
@@ -377,19 +379,24 @@ export function DayCalendar(inProps) {
377
379
  return /*#__PURE__*/_jsxs(PickerCalendarDayRoot, {
378
380
  role: "grid",
379
381
  "aria-labelledby": gridLabelId,
382
+ "aria-colcount": columnIndexOffset + 7,
383
+ "aria-rowcount": weeksToDisplay.length + 1,
380
384
  className: classes.root,
381
385
  children: [/*#__PURE__*/_jsxs(PickerCalendarDayHeader, {
382
386
  role: "row",
387
+ "aria-rowindex": 1,
383
388
  className: classes.header,
384
389
  children: [displayWeekNumber && /*#__PURE__*/_jsx(PickerCalendarWeekNumberLabel, {
385
390
  variant: "caption",
386
391
  role: "columnheader",
392
+ "aria-colindex": 1,
387
393
  "aria-label": translations.calendarWeekNumberHeaderLabel,
388
394
  className: classes.weekNumberLabel,
389
395
  children: translations.calendarWeekNumberHeaderText
390
396
  }), getWeekdays(adapter, now).map((weekday, i) => /*#__PURE__*/_jsx(PickerCalendarWeekDayLabel, {
391
397
  variant: "caption",
392
398
  role: "columnheader",
399
+ "aria-colindex": columnIndexOffset + i + 1,
393
400
  "aria-label": adapter.format(weekday, 'weekday'),
394
401
  className: classes.weekDayLabel,
395
402
  children: dayOfWeekFormatter(weekday)
@@ -412,13 +419,13 @@ export function DayCalendar(inProps) {
412
419
  children: weeksToDisplay.map((week, index) => /*#__PURE__*/_jsxs(PickerCalendarWeek, {
413
420
  role: "row",
414
421
  className: classes.weekContainer
415
- // fix issue of announcing row 1 as row 2
416
- // caused by week day labels row
422
+ // The week day labels row is the first row of the grid.
417
423
  ,
418
- "aria-rowindex": index + 1,
424
+ "aria-rowindex": index + 2,
419
425
  children: [displayWeekNumber && /*#__PURE__*/_jsx(PickerCalendarWeekNumber, {
420
426
  className: classes.weekNumber,
421
427
  role: "rowheader",
428
+ "aria-colindex": 1,
422
429
  "aria-label": translations.calendarWeekNumberAriaLabelText(adapter.getWeekNumber(week[0])),
423
430
  children: translations.calendarWeekNumberText(adapter.getWeekNumber(week[0]))
424
431
  }), week.map((day, dayIndex) => /*#__PURE__*/_jsx(WrappedDay, {
@@ -432,10 +439,8 @@ export function DayCalendar(inProps) {
432
439
  onBlur: handleBlur,
433
440
  onDaySelect: handleDaySelect,
434
441
  isDateDisabled: isDateDisabled,
435
- currentMonthNumber: currentMonthNumber
436
- // fix issue of announcing column 1 as column 2 when `displayWeekNumber` is enabled
437
- ,
438
- "aria-colindex": dayIndex + 1
442
+ currentMonthNumber: currentMonthNumber,
443
+ "aria-colindex": columnIndexOffset + dayIndex + 1
439
444
  }, day.toString()))]
440
445
  }, `week-${week[0]}`))
441
446
  })
@@ -115,7 +115,9 @@ function PickersSlideTransition(inProps) {
115
115
  const classes = useUtilityClasses(classesProp, ownerState);
116
116
  const theme = (0, _styles.useTheme)();
117
117
  if (reduceAnimations) {
118
+ // `role="none"` keeps the day rows owned by the calendar grid.
118
119
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
120
+ role: "none",
119
121
  className: (0, _clsx.default)(classes.root, className),
120
122
  children: children
121
123
  });
@@ -107,7 +107,9 @@ export function PickersSlideTransition(inProps) {
107
107
  const classes = useUtilityClasses(classesProp, ownerState);
108
108
  const theme = useTheme();
109
109
  if (reduceAnimations) {
110
+ // `role="none"` keeps the day rows owned by the calendar grid.
110
111
  return /*#__PURE__*/_jsx("div", {
112
+ role: "none",
111
113
  className: clsx(classes.root, className),
112
114
  children: children
113
115
  });
@@ -91,6 +91,16 @@ const PickerDayRoot = (0, _styles.styled)(_ButtonBase.default, {
91
91
  }
92
92
  }
93
93
  }, {
94
+ props: {
95
+ isDayOutsideMonth: true
96
+ },
97
+ style: {
98
+ color: (theme.vars || theme).palette.text.secondary
99
+ }
100
+ },
101
+ // Must come after `isDayOutsideMonth` so that a disabled day outside the current month
102
+ // uses the disabled text color.
103
+ {
94
104
  props: {
95
105
  isDayDisabled: true
96
106
  },
@@ -107,13 +117,6 @@ const PickerDayRoot = (0, _styles.styled)(_ButtonBase.default, {
107
117
  opacity: 0,
108
118
  pointerEvents: 'none'
109
119
  }
110
- }, {
111
- props: {
112
- isDayOutsideMonth: true
113
- },
114
- style: {
115
- color: (theme.vars || theme).palette.text.secondary
116
- }
117
120
  }, {
118
121
  props: {
119
122
  isDayCurrent: true,
@@ -205,6 +208,7 @@ const PickerDayRaw = /*#__PURE__*/React.forwardRef(function PickerDay(inProps, f
205
208
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(PickerDayRoot, {
206
209
  ref: handleRef,
207
210
  role: other.role,
211
+ "aria-colindex": other['aria-colindex'],
208
212
  ownerState: ownerState,
209
213
  className: (0, _clsx.default)(classes.root, className),
210
214
  as: "div"
@@ -84,6 +84,16 @@ const PickerDayRoot = styled(ButtonBase, {
84
84
  }
85
85
  }
86
86
  }, {
87
+ props: {
88
+ isDayOutsideMonth: true
89
+ },
90
+ style: {
91
+ color: (theme.vars || theme).palette.text.secondary
92
+ }
93
+ },
94
+ // Must come after `isDayOutsideMonth` so that a disabled day outside the current month
95
+ // uses the disabled text color.
96
+ {
87
97
  props: {
88
98
  isDayDisabled: true
89
99
  },
@@ -100,13 +110,6 @@ const PickerDayRoot = styled(ButtonBase, {
100
110
  opacity: 0,
101
111
  pointerEvents: 'none'
102
112
  }
103
- }, {
104
- props: {
105
- isDayOutsideMonth: true
106
- },
107
- style: {
108
- color: (theme.vars || theme).palette.text.secondary
109
- }
110
113
  }, {
111
114
  props: {
112
115
  isDayCurrent: true,
@@ -198,6 +201,7 @@ const PickerDayRaw = /*#__PURE__*/React.forwardRef(function PickerDay(inProps, f
198
201
  return /*#__PURE__*/_jsx(PickerDayRoot, {
199
202
  ref: handleRef,
200
203
  role: other.role,
204
+ "aria-colindex": other['aria-colindex'],
201
205
  ownerState: ownerState,
202
206
  className: clsx(classes.root, className),
203
207
  as: "div"
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v9.11.0
2
+ * @mui/x-date-pickers v9.12.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-date-pickers v9.11.0
2
+ * @mui/x-date-pickers v9.12.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -208,18 +208,32 @@ function useFieldRootProps(parameters) {
208
208
  return;
209
209
  }
210
210
  const target = event.target;
211
- // `sectionListRoot` is the sections container (a descendant of the
212
- // InputBase root that owns this handler). The guard rejects clicks on
213
- // sibling adornments (open / clear buttons, etc.) which have their own
214
- // behavior and must not get intercepted here.
215
211
  const sectionListRoot = domGetters.getRoot();
216
- if (!sectionListRoot.contains(target)) {
212
+ const isInsideSectionList = sectionListRoot.contains(target);
213
+ // Only the field root is ours outside the sections container: it is the
214
+ // target of a padding click. The adornments keep their own behavior.
215
+ if (!isInsideSectionList && target !== event.currentTarget) {
217
216
  return;
218
217
  }
218
+ const sectionElement = isInsideSectionList ? target.closest('[data-sectionindex]') : null;
219
+
220
+ // Blank space is the field padding and the area past the sections. Mimic
221
+ // the native date input: first section on entry, keep it afterwards.
222
+ // `preventDefault` is what keeps it, by stopping both the browser blur and
223
+ // Chromium's focus delegation.
224
+ const isBlankSpaceClick = sectionElement == null && (!isInsideSectionList || isPointOutsideSections(sectionListRoot, event.clientX));
225
+ if (isBlankSpaceClick) {
226
+ event.preventDefault();
227
+ if (!focused) {
228
+ setFocused(true);
229
+ setSelectedSections(sectionOrder.startIndex);
230
+ }
231
+ return;
232
+ }
233
+
219
234
  // Prefer the visually-containing section (matches Chromium's
220
235
  // delegation + section container `onClick`), fall back to the
221
- // closest-by-distance section for padding / past-last-section clicks.
222
- const sectionElement = target.closest('[data-sectionindex]');
236
+ // closest-by-distance section for clicks on the container padding.
223
237
  const parsedIndex = sectionElement ? Number(sectionElement.dataset.sectionindex) : findClosestSectionIndexToPoint(sectionListRoot, event.clientX);
224
238
  // `Number(undefined) === NaN` and `NaN == null === false`, so guard
225
239
  // explicitly here even though `data-sectionindex` is set by
@@ -313,6 +327,32 @@ function useFieldRootProps(parameters) {
313
327
  };
314
328
  }
315
329
 
330
+ /**
331
+ * Slop on each side of the sections, so a click that just misses the outermost
332
+ * one still selects it. Under half a digit at the default font size.
333
+ */
334
+ const BLANK_SPACE_TOLERANCE = 4;
335
+
336
+ /**
337
+ * Returns `true` when `clientX` sits past the sections on either side.
338
+ * Horizontal only: a click in the container's vertical padding still belongs to
339
+ * the section above or below it.
340
+ */
341
+ function isPointOutsideSections(root, clientX) {
342
+ const sections = root.querySelectorAll('[data-sectionindex]');
343
+ if (sections.length === 0) {
344
+ return false;
345
+ }
346
+ let left = Infinity;
347
+ let right = -Infinity;
348
+ for (let i = 0; i < sections.length; i += 1) {
349
+ const rect = sections[i].getBoundingClientRect();
350
+ left = Math.min(left, rect.left);
351
+ right = Math.max(right, rect.right);
352
+ }
353
+ return clientX < left - BLANK_SPACE_TOLERANCE || clientX > right + BLANK_SPACE_TOLERANCE;
354
+ }
355
+
316
356
  /**
317
357
  * Returns the index of the section whose horizontal center is closest to `clientX`.
318
358
  * Returns `null` if the field renders no `[role="spinbutton"]` descendants
@@ -202,18 +202,32 @@ export function useFieldRootProps(parameters) {
202
202
  return;
203
203
  }
204
204
  const target = event.target;
205
- // `sectionListRoot` is the sections container (a descendant of the
206
- // InputBase root that owns this handler). The guard rejects clicks on
207
- // sibling adornments (open / clear buttons, etc.) which have their own
208
- // behavior and must not get intercepted here.
209
205
  const sectionListRoot = domGetters.getRoot();
210
- if (!sectionListRoot.contains(target)) {
206
+ const isInsideSectionList = sectionListRoot.contains(target);
207
+ // Only the field root is ours outside the sections container: it is the
208
+ // target of a padding click. The adornments keep their own behavior.
209
+ if (!isInsideSectionList && target !== event.currentTarget) {
211
210
  return;
212
211
  }
212
+ const sectionElement = isInsideSectionList ? target.closest('[data-sectionindex]') : null;
213
+
214
+ // Blank space is the field padding and the area past the sections. Mimic
215
+ // the native date input: first section on entry, keep it afterwards.
216
+ // `preventDefault` is what keeps it, by stopping both the browser blur and
217
+ // Chromium's focus delegation.
218
+ const isBlankSpaceClick = sectionElement == null && (!isInsideSectionList || isPointOutsideSections(sectionListRoot, event.clientX));
219
+ if (isBlankSpaceClick) {
220
+ event.preventDefault();
221
+ if (!focused) {
222
+ setFocused(true);
223
+ setSelectedSections(sectionOrder.startIndex);
224
+ }
225
+ return;
226
+ }
227
+
213
228
  // Prefer the visually-containing section (matches Chromium's
214
229
  // delegation + section container `onClick`), fall back to the
215
- // closest-by-distance section for padding / past-last-section clicks.
216
- const sectionElement = target.closest('[data-sectionindex]');
230
+ // closest-by-distance section for clicks on the container padding.
217
231
  const parsedIndex = sectionElement ? Number(sectionElement.dataset.sectionindex) : findClosestSectionIndexToPoint(sectionListRoot, event.clientX);
218
232
  // `Number(undefined) === NaN` and `NaN == null === false`, so guard
219
233
  // explicitly here even though `data-sectionindex` is set by
@@ -307,6 +321,32 @@ export function useFieldRootProps(parameters) {
307
321
  };
308
322
  }
309
323
 
324
+ /**
325
+ * Slop on each side of the sections, so a click that just misses the outermost
326
+ * one still selects it. Under half a digit at the default font size.
327
+ */
328
+ const BLANK_SPACE_TOLERANCE = 4;
329
+
330
+ /**
331
+ * Returns `true` when `clientX` sits past the sections on either side.
332
+ * Horizontal only: a click in the container's vertical padding still belongs to
333
+ * the section above or below it.
334
+ */
335
+ function isPointOutsideSections(root, clientX) {
336
+ const sections = root.querySelectorAll('[data-sectionindex]');
337
+ if (sections.length === 0) {
338
+ return false;
339
+ }
340
+ let left = Infinity;
341
+ let right = -Infinity;
342
+ for (let i = 0; i < sections.length; i += 1) {
343
+ const rect = sections[i].getBoundingClientRect();
344
+ left = Math.min(left, rect.left);
345
+ right = Math.max(right, rect.right);
346
+ }
347
+ return clientX < left - BLANK_SPACE_TOLERANCE || clientX > right + BLANK_SPACE_TOLERANCE;
348
+ }
349
+
310
350
  /**
311
351
  * Returns the index of the section whose horizontal center is closest to `clientX`.
312
352
  * Returns `null` if the field renders no `[role="spinbutton"]` descendants
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Returns the private context passed by the Picker wrapping the current component.
3
3
  */
4
- export declare const usePickerPrivateContext: () => import("../components/PickerProvider.mjs").PickerPrivateContextValue;
4
+ export declare const usePickerPrivateContext: () => import("../index.mjs").PickerPrivateContextValue;
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Returns the private context passed by the Picker wrapping the current component.
3
3
  */
4
- export declare const usePickerPrivateContext: () => import("../components/PickerProvider.js").PickerPrivateContextValue;
4
+ export declare const usePickerPrivateContext: () => import("../index.js").PickerPrivateContextValue;
@@ -2,8 +2,8 @@ export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersA
2
2
  export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from "./components/PickersArrowSwitcher/index.mjs";
3
3
  export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.mjs";
4
4
  export type { ExportedPickerFieldUIProps, PickerFieldUISlots, PickerFieldUISlotProps, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from "./components/PickerFieldUI.mjs";
5
- export { PickerProvider } from "./components/PickerProvider.mjs";
6
- export type { PickerContextValue } from "./components/PickerProvider.mjs";
5
+ export { PickerProvider, PickerPrivateContext } from "./components/PickerProvider.mjs";
6
+ export type { PickerContextValue, PickerPrivateContextValue } from "./components/PickerProvider.mjs";
7
7
  export { PickersModalDialog } from "./components/PickersModalDialog.mjs";
8
8
  export type { PickersModalDialogSlots, PickersModalDialogSlotProps } from "./components/PickersModalDialog.mjs";
9
9
  export { PickerPopper } from "./components/PickerPopper/PickerPopper.mjs";
@@ -2,8 +2,8 @@ export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersA
2
2
  export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from "./components/PickersArrowSwitcher/index.js";
3
3
  export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.js";
4
4
  export type { ExportedPickerFieldUIProps, PickerFieldUISlots, PickerFieldUISlotProps, PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from "./components/PickerFieldUI.js";
5
- export { PickerProvider } from "./components/PickerProvider.js";
6
- export type { PickerContextValue } from "./components/PickerProvider.js";
5
+ export { PickerProvider, PickerPrivateContext } from "./components/PickerProvider.js";
6
+ export type { PickerContextValue, PickerPrivateContextValue } from "./components/PickerProvider.js";
7
7
  export { PickersModalDialog } from "./components/PickersModalDialog.js";
8
8
  export type { PickersModalDialogSlots, PickersModalDialogSlotProps } from "./components/PickersModalDialog.js";
9
9
  export { PickerPopper } from "./components/PickerPopper/PickerPopper.js";
@@ -75,6 +75,12 @@ Object.defineProperty(exports, "PickerPopper", {
75
75
  return _PickerPopper.PickerPopper;
76
76
  }
77
77
  });
78
+ Object.defineProperty(exports, "PickerPrivateContext", {
79
+ enumerable: true,
80
+ get: function () {
81
+ return _PickerProvider.PickerPrivateContext;
82
+ }
83
+ });
78
84
  Object.defineProperty(exports, "PickerProvider", {
79
85
  enumerable: true,
80
86
  get: function () {
@@ -1,6 +1,6 @@
1
1
  export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.mjs";
2
2
  export { PickerFieldUI, PickerFieldUIContextProvider, cleanFieldResponse, useFieldTextFieldProps, PickerFieldUIContext, mergeSlotProps } from "./components/PickerFieldUI.mjs";
3
- export { PickerProvider } from "./components/PickerProvider.mjs";
3
+ export { PickerProvider, PickerPrivateContext } from "./components/PickerProvider.mjs";
4
4
  export { PickersModalDialog } from "./components/PickersModalDialog.mjs";
5
5
  export { PickerPopper } from "./components/PickerPopper/PickerPopper.mjs";
6
6
  export { pickerPopperClasses } from "./components/PickerPopper/pickerPopperClasses.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers",
3
- "version": "9.11.0",
3
+ "version": "9.12.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The community edition of the MUI X Date and Time Picker components.",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "clsx": "^2.1.1",
40
40
  "prop-types": "^15.8.1",
41
41
  "react-transition-group": "^4.4.5",
42
- "@mui/x-internals": "^9.11.0"
42
+ "@mui/x-internals": "^9.12.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",