@mui/x-date-pickers 8.11.1 → 8.11.3

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
@@ -5,6 +5,187 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.11.3
9
+
10
+ _Sep 16, 2025_
11
+
12
+ We'd like to extend a big thank you to the 11 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🐞 Bugfixes
15
+ - 📚 Documentation improvements
16
+
17
+ Special thanks go out to the community members for their valuable contributions:
18
+ @sai6855
19
+
20
+ The following are all team members who have contributed to this release:
21
+ @alexfauquette, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @LukasTy, @rita-codes, @siriwatknp
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@8.11.3`
26
+
27
+ - [DataGrid] Fix numeric font size not being applied (#19552) @cherniavskii
28
+ - [DataGrid] Improve `operator` types to display literal values (#19529) @siriwatknp
29
+
30
+ #### `@mui/x-data-grid-pro@8.11.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
31
+
32
+ Same changes as in `@mui/x-data-grid@8.11.3`.
33
+
34
+ #### `@mui/x-data-grid-premium@8.11.3` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link "Premium plan")
35
+
36
+ Same changes as in `@mui/x-data-grid-pro@8.11.3`.
37
+
38
+ ### Date and Time Pickers
39
+
40
+ #### `@mui/x-date-pickers@8.11.3`
41
+
42
+ - [pickers] Refactor `slots` and `slotProps` propagation strategy (#18867) @LukasTy
43
+
44
+ #### `@mui/x-date-pickers-pro@8.11.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
45
+
46
+ Same changes as in `@mui/x-date-pickers@8.11.3`.
47
+
48
+ ### Charts
49
+
50
+ #### `@mui/x-charts@8.11.3`
51
+
52
+ - [charts] Add `inline-` piecewise legend options (#19382) @JCQuintas
53
+ - [charts] Add bar gradient example (#19174) @bernardobelchior
54
+ - [charts] Ignore empty tick labels in label overlap computation (#19547) @alexfauquette
55
+ - [charts] Rename `isBandScale` to `isDiscreteScale` (#19514) @bernardobelchior
56
+ - [charts] Fix legend position affecting toolbar's position (#19257) @sai6855
57
+
58
+ #### `@mui/x-charts-pro@8.11.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
59
+
60
+ Same changes as in `@mui/x-charts@8.11.3`, plus:
61
+
62
+ - [charts-pro] Add chart title and caption to export demo (#19524) @bernardobelchior
63
+
64
+ ### Tree View
65
+
66
+ #### `@mui/x-tree-view@8.11.3`
67
+
68
+ - [tree view] Stop looping through all items to publish the `removeItem` event (#19500) @flaviendelangle
69
+ - [tree view] Support flat DOM structure (#19350) @flaviendelangle
70
+ - [tree view] Update cursor styles for disabled TreeItem (#19548) @sai6855
71
+
72
+ #### `@mui/x-tree-view-pro@8.11.3` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link "Pro plan")
73
+
74
+ Same changes as in `@mui/x-tree-view@8.11.3`.
75
+
76
+ ### Codemod
77
+
78
+ #### `@mui/x-codemod@8.11.3`
79
+
80
+ Internal changes.
81
+
82
+ ### Docs
83
+
84
+ - [docs] Add styling row group recipe (#19349) @siriwatknp
85
+ - [docs] Group demos data into the dataset folder (#19549) @alexfauquette
86
+ - [docs] Add `shiny` bar chart example at the top (#19416) @JCQuintas
87
+
88
+ ### Core
89
+
90
+ - [code-infra] Axios update (#19577) @Janpot
91
+ - [code-infra] Remove usage of copy-files command from code-infra (#19518) @brijeshb42
92
+ - [internal] Fix naming to match convention @oliviertassinari
93
+
94
+ ## 8.11.2
95
+
96
+ _Sep 10, 2025_
97
+
98
+ We'd like to extend a big thank you to the 13 contributors who made this release possible. Here are some highlights ✨:
99
+
100
+ - 🐞 Bugfixes
101
+ - 📚 Documentation improvements
102
+
103
+ Special thanks go out to the community members for their valuable contributions:
104
+ @ludvigeriksson, @sai6855
105
+
106
+ The following are all team members who have contributed to this release:
107
+ @alexfauquette, @bernardobelchior, @brijeshb42, @flaviendelangle, @Janpot, @LukasTy, @MBilalShafi, @noraleonte, @rita-codes, @romgrk, @siriwatknp
108
+
109
+ ### Data Grid
110
+
111
+ #### `@mui/x-data-grid@8.11.2`
112
+
113
+ - [DataGrid] Allow opting out of the exclude row selection model (#19423) @MBilalShafi
114
+ - [DataGrid] Fix column dropdown menu text alignment for the "Unpin" menu item (#19462) @MBilalShafi
115
+ - [DataGrid] Fix indeterminate state for "Select all" checkbox with exclude model (#19466) @MBilalShafi
116
+ - [DataGrid] Fix styled API arguments error (#19460) @MBilalShafi
117
+ - [DataGrid] Fix `stringify()` for theme objects (#19427) @romgrk
118
+
119
+ #### `@mui/x-data-grid-pro@8.11.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
120
+
121
+ Same changes as in `@mui/x-data-grid@8.11.2`.
122
+
123
+ #### `@mui/x-data-grid-premium@8.11.2` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
124
+
125
+ Same changes as in `@mui/x-data-grid-pro@8.11.2`, plus:
126
+
127
+ - [DataGridPremium] Fallback to the regular reorder method for plain data (#19467) @MBilalShafi
128
+ - [DataGridPremium] Fix showing `0` as total aggregation value when aggregation position is set to `null` for row groups (#19515) @cherniavskii
129
+
130
+ ### Date and Time Pickers
131
+
132
+ #### `@mui/x-date-pickers@8.11.2`
133
+
134
+ - [pickers] Gracefully handle `textField.slotProps` (#18980) @LukasTy
135
+ - [pickers] Improve hour and minute placement in Date Time Picker (#19227) @MBilalShafi
136
+ - [pickers] Use `calendarState.currentMonth` in Month Calendar when available (#19073) @LukasTy
137
+ - [pickers] Improve invalid value pasting into a section (#19357) @sai6855
138
+ - [fields] Remove redundant `id` and `aria-labelledby` attributes from spinbuttons (#19523) @LukasTy
139
+
140
+ #### `@mui/x-date-pickers-pro@8.11.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
141
+
142
+ Same changes as in `@mui/x-date-pickers@8.11.2`.
143
+
144
+ ### Charts
145
+
146
+ #### `@mui/x-charts@8.11.2`
147
+
148
+ - [charts] Fix highlight regression (#19486) @alexfauquette
149
+ - [charts] Improve code reuse in `ChartsXAxis` and `ChartsYAxis` (#19198) @bernardobelchior
150
+ - [charts] Simplify params in `getRange` and `createDateFormatter` (#19517) @bernardobelchior
151
+ - [charts] Handle domain edge cases with `filterMode: 'discard'` (#19199) @bernardobelchior
152
+ - [l10n] Add Swedish (sv-SE) locale (#19489) @ludvigeriksson
153
+
154
+ #### `@mui/x-charts-pro@8.11.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
155
+
156
+ Same changes as in `@mui/x-charts@8.11.2`.
157
+
158
+ ### Tree View
159
+
160
+ #### `@mui/x-tree-view@8.11.2`
161
+
162
+ - [TreeView] Do not mutate `props.items` in the `getItemTree()` method (#19483) @flaviendelangle
163
+ - [TreeView] Expose a new hook to apply selection propagation on the selected items (#19402) @flaviendelangle
164
+
165
+ #### `@mui/x-tree-view-pro@8.11.2` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
166
+
167
+ Same changes as in `@mui/x-tree-view@8.11.2`.
168
+
169
+ ### Codemod
170
+
171
+ #### `@mui/x-codemod@8.11.2`
172
+
173
+ Internal changes.
174
+
175
+ ### Docs
176
+
177
+ - [docs] Add recipe for save and manage filters from the panel (#19361) @siriwatknp
178
+
179
+ ### Core
180
+
181
+ - [code-infra] Remove log when restarting dev server (#19490) @bernardobelchior
182
+ - [code-infra] Store test results in CI (#19507) @Janpot
183
+
184
+ ### Miscellaneous
185
+
186
+ - [infra] Set nodejs versions of various CIs to 22.18 (#19503) @brijeshb42
187
+ - [test] Split infinitive @romgrk
188
+
8
189
  ## 8.11.1
9
190
 
10
191
  _Sep 4, 2025_
@@ -337,6 +337,7 @@ const DateCalendar = exports.DateCalendar = /*#__PURE__*/React.forwardRef(functi
337
337
  yearsPerRow: yearsPerRow,
338
338
  referenceDate: referenceDate
339
339
  })), view === 'month' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MonthCalendar.MonthCalendar, (0, _extends2.default)({}, baseDateValidationProps, commonViewProps, {
340
+ currentMonth: calendarState.currentMonth,
340
341
  hasFocus: hasFocus,
341
342
  className: className,
342
343
  value: value,
@@ -43,11 +43,14 @@ const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function Dat
43
43
  externalForwardedProps: other
44
44
  });
45
45
  const fieldResponse = (0, _useDateField.useDateField)(textFieldProps);
46
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUIContextProvider, {
47
47
  slots: slots,
48
48
  slotProps: slotProps,
49
- fieldResponse: fieldResponse,
50
- defaultOpenPickerIcon: _icons.CalendarIcon
49
+ inputRef: other.inputRef,
50
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
51
+ fieldResponse: fieldResponse,
52
+ defaultOpenPickerIcon: _icons.CalendarIcon
53
+ })
51
54
  });
52
55
  });
53
56
  if (process.env.NODE_ENV !== "production") DateField.displayName = "DateField";
@@ -43,11 +43,14 @@ const DateTimeField = exports.DateTimeField = /*#__PURE__*/React.forwardRef(func
43
43
  externalForwardedProps: other
44
44
  });
45
45
  const fieldResponse = (0, _useDateTimeField.useDateTimeField)(textFieldProps);
46
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUIContextProvider, {
47
47
  slots: slots,
48
48
  slotProps: slotProps,
49
- fieldResponse: fieldResponse,
50
- defaultOpenPickerIcon: _icons.CalendarIcon
49
+ inputRef: other.inputRef,
50
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
51
+ fieldResponse: fieldResponse,
52
+ defaultOpenPickerIcon: _icons.CalendarIcon
53
+ })
51
54
  });
52
55
  });
53
56
  if (process.env.NODE_ENV !== "production") DateTimeField.displayName = "DateTimeField";
@@ -31,7 +31,7 @@ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateConte
31
31
  var _useDateManager = require("../managers/useDateManager");
32
32
  var _usePickerAdapter = require("../hooks/usePickerAdapter");
33
33
  var _jsxRuntime = require("react/jsx-runtime");
34
- const _excluded = ["autoFocus", "className", "classes", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
34
+ const _excluded = ["autoFocus", "className", "currentMonth", "classes", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
35
35
  const useUtilityClasses = classes => {
36
36
  const slots = {
37
37
  root: ['root']
@@ -48,6 +48,7 @@ function useMonthCalendarDefaultizedProps(props, name) {
48
48
  monthsPerRow: themeProps.monthsPerRow ?? 3
49
49
  });
50
50
  }
51
+ const isSameMonth = (monthA, monthB, yearA, yearB, adapter) => Boolean(monthA === monthB && yearB && adapter.isSameYear(yearA, yearB));
51
52
  const MonthCalendarRoot = (0, _styles.styled)('div', {
52
53
  name: 'MuiMonthCalendar',
53
54
  slot: 'Root',
@@ -91,6 +92,7 @@ const MonthCalendar = exports.MonthCalendar = /*#__PURE__*/React.forwardRef(func
91
92
  const {
92
93
  autoFocus,
93
94
  className,
95
+ currentMonth,
94
96
  classes: classesProp,
95
97
  value: valueProp,
96
98
  defaultValue,
@@ -181,11 +183,12 @@ const MonthCalendar = exports.MonthCalendar = /*#__PURE__*/React.forwardRef(func
181
183
  if (readOnly) {
182
184
  return;
183
185
  }
184
- const newDate = adapter.setMonth(value ?? referenceDate, month);
186
+ const currentValue = value && currentMonth && !adapter.isSameYear(value, currentMonth) ? adapter.setYear(value, adapter.getYear(currentMonth)) : value;
187
+ const newDate = adapter.setMonth(currentValue ?? referenceDate, month);
185
188
  handleValueChange(newDate);
186
189
  });
187
190
  const focusMonth = (0, _useEventCallback.default)(month => {
188
- if (!isMonthDisabled(adapter.setMonth(value ?? referenceDate, month))) {
191
+ if (!isMonthDisabled(adapter.setMonth(value ?? currentMonth ?? referenceDate, month))) {
189
192
  setFocusedMonth(month);
190
193
  changeHasFocus(true);
191
194
  if (onMonthFocus) {
@@ -236,11 +239,11 @@ const MonthCalendar = exports.MonthCalendar = /*#__PURE__*/React.forwardRef(func
236
239
  "aria-labelledby": gridLabelId,
237
240
  monthsPerRow: monthsPerRow
238
241
  }, other, {
239
- children: (0, _dateUtils.getMonthsInYear)(adapter, value ?? referenceDate).map(month => {
242
+ children: (0, _dateUtils.getMonthsInYear)(adapter, currentMonth ?? value ?? referenceDate).map(month => {
240
243
  const monthNumber = adapter.getMonth(month);
241
244
  const monthText = adapter.format(month, 'monthShort');
242
245
  const monthLabel = adapter.format(month, 'month');
243
- const isSelected = monthNumber === selectedMonth;
246
+ const isSelected = isSameMonth(monthNumber, selectedMonth, month, value, adapter);
244
247
  const isDisabled = disabled || isMonthDisabled(month);
245
248
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MonthCalendarButton.MonthCalendarButton, {
246
249
  selected: isSelected,
@@ -252,7 +255,7 @@ const MonthCalendar = exports.MonthCalendar = /*#__PURE__*/React.forwardRef(func
252
255
  tabIndex: monthNumber === focusedMonth && !isDisabled ? 0 : -1,
253
256
  onFocus: handleMonthFocus,
254
257
  onBlur: handleMonthBlur,
255
- "aria-current": todayMonth === monthNumber ? 'date' : undefined,
258
+ "aria-current": isSameMonth(monthNumber, todayMonth, month, now, adapter) ? 'date' : undefined,
256
259
  "aria-label": monthLabel,
257
260
  slots: slots,
258
261
  slotProps: slotProps,
@@ -274,6 +277,7 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
274
277
  */
275
278
  classes: _propTypes.default.object,
276
279
  className: _propTypes.default.string,
280
+ currentMonth: _propTypes.default.object,
277
281
  /**
278
282
  * The default selected value.
279
283
  * Used when the component is not controlled.
@@ -32,6 +32,7 @@ export interface ExportedMonthCalendarProps {
32
32
  export interface MonthCalendarProps extends ExportedMonthCalendarProps, MonthValidationProps, BaseDateValidationProps, TimezoneProps, FormProps {
33
33
  autoFocus?: boolean;
34
34
  className?: string;
35
+ currentMonth?: PickerValidDate;
35
36
  /**
36
37
  * Override or extend the styles applied to the component.
37
38
  */
@@ -55,12 +55,6 @@ const MultiSectionDigitalClockSectionRoot = (0, _styles.styled)(_MenuList.defaul
55
55
  '&:not(:first-of-type)': {
56
56
  borderLeft: `1px solid ${(theme.vars || theme).palette.divider}`
57
57
  },
58
- '&::after': {
59
- display: 'block',
60
- content: '""',
61
- // subtracting the height of one item, extra margin and borders to make sure the max height is correct
62
- height: 'calc(100% - 40px - 6px)'
63
- },
64
58
  variants: [{
65
59
  props: {
66
60
  hasDigitalClockAlreadyBeenRendered: true
@@ -145,9 +139,21 @@ const MultiSectionDigitalClockSection = exports.MultiSectionDigitalClockSection
145
139
  }
146
140
  previousActive.current = activeItem;
147
141
  const offsetTop = activeItem.offsetTop;
142
+ const itemHeight = activeItem.offsetHeight;
143
+ const containerHeight = containerRef.current.clientHeight;
144
+ const scrollableHeight = containerRef.current.scrollHeight;
145
+
146
+ // Calculate the ideal centered position
147
+ const centeredPosition = offsetTop - containerHeight / 2 + itemHeight / 2;
148
+
149
+ // Calculate the maximum scroll position that would show content at the bottom
150
+ const maxScrollTop = scrollableHeight - containerHeight;
151
+
152
+ // If centering would create empty space at the bottom, align the last items to the bottom instead
153
+ const scrollPosition = Math.min(centeredPosition, maxScrollTop);
148
154
 
149
- // Subtracting the 4px of extra margin intended for the first visible section item
150
- containerRef.current.scrollTop = offsetTop - 4;
155
+ // Ensure we don't scroll past the top
156
+ containerRef.current.scrollTop = Math.max(0, scrollPosition);
151
157
  });
152
158
  const focusedOptionIndex = items.findIndex(item => item.isFocused(item.value));
153
159
  const handleKeyDown = event => {
@@ -43,11 +43,14 @@ const TimeField = exports.TimeField = /*#__PURE__*/React.forwardRef(function Tim
43
43
  externalForwardedProps: other
44
44
  });
45
45
  const fieldResponse = (0, _useTimeField.useTimeField)(textFieldProps);
46
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUIContextProvider, {
47
47
  slots: slots,
48
48
  slotProps: slotProps,
49
- fieldResponse: fieldResponse,
50
- defaultOpenPickerIcon: _icons.ClockIcon
49
+ inputRef: other.inputRef,
50
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PickerFieldUI.PickerFieldUI, {
51
+ fieldResponse: fieldResponse,
52
+ defaultOpenPickerIcon: _icons.ClockIcon
53
+ })
51
54
  });
52
55
  });
53
56
  if (process.env.NODE_ENV !== "production") TimeField.displayName = "TimeField";
@@ -330,6 +330,7 @@ export const DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(
330
330
  yearsPerRow: yearsPerRow,
331
331
  referenceDate: referenceDate
332
332
  })), view === 'month' && /*#__PURE__*/_jsx(MonthCalendar, _extends({}, baseDateValidationProps, commonViewProps, {
333
+ currentMonth: calendarState.currentMonth,
333
334
  hasFocus: hasFocus,
334
335
  className: className,
335
336
  value: value,
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
7
7
  import { useThemeProps } from '@mui/material/styles';
8
8
  import refType from '@mui/utils/refType';
9
9
  import { useDateField } from "./useDateField.js";
10
- import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
10
+ import { PickerFieldUI, PickerFieldUIContextProvider, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
11
11
  import { CalendarIcon } from "../icons/index.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  /**
@@ -36,11 +36,14 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
36
36
  externalForwardedProps: other
37
37
  });
38
38
  const fieldResponse = useDateField(textFieldProps);
39
- return /*#__PURE__*/_jsx(PickerFieldUI, {
39
+ return /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
40
40
  slots: slots,
41
41
  slotProps: slotProps,
42
- fieldResponse: fieldResponse,
43
- defaultOpenPickerIcon: CalendarIcon
42
+ inputRef: other.inputRef,
43
+ children: /*#__PURE__*/_jsx(PickerFieldUI, {
44
+ fieldResponse: fieldResponse,
45
+ defaultOpenPickerIcon: CalendarIcon
46
+ })
44
47
  });
45
48
  });
46
49
  if (process.env.NODE_ENV !== "production") DateField.displayName = "DateField";
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
7
7
  import { useThemeProps } from '@mui/material/styles';
8
8
  import refType from '@mui/utils/refType';
9
9
  import { useDateTimeField } from "./useDateTimeField.js";
10
- import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
10
+ import { PickerFieldUI, PickerFieldUIContextProvider, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
11
11
  import { CalendarIcon } from "../icons/index.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  /**
@@ -36,11 +36,14 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
36
36
  externalForwardedProps: other
37
37
  });
38
38
  const fieldResponse = useDateTimeField(textFieldProps);
39
- return /*#__PURE__*/_jsx(PickerFieldUI, {
39
+ return /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
40
40
  slots: slots,
41
41
  slotProps: slotProps,
42
- fieldResponse: fieldResponse,
43
- defaultOpenPickerIcon: CalendarIcon
42
+ inputRef: other.inputRef,
43
+ children: /*#__PURE__*/_jsx(PickerFieldUI, {
44
+ fieldResponse: fieldResponse,
45
+ defaultOpenPickerIcon: CalendarIcon
46
+ })
44
47
  });
45
48
  });
46
49
  if (process.env.NODE_ENV !== "production") DateTimeField.displayName = "DateTimeField";
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
- const _excluded = ["autoFocus", "className", "classes", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
5
+ const _excluded = ["autoFocus", "className", "currentMonth", "classes", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone", "gridLabelId", "slots", "slotProps"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import clsx from 'clsx';
@@ -40,6 +40,7 @@ export function useMonthCalendarDefaultizedProps(props, name) {
40
40
  monthsPerRow: themeProps.monthsPerRow ?? 3
41
41
  });
42
42
  }
43
+ const isSameMonth = (monthA, monthB, yearA, yearB, adapter) => Boolean(monthA === monthB && yearB && adapter.isSameYear(yearA, yearB));
43
44
  const MonthCalendarRoot = styled('div', {
44
45
  name: 'MuiMonthCalendar',
45
46
  slot: 'Root',
@@ -83,6 +84,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
83
84
  const {
84
85
  autoFocus,
85
86
  className,
87
+ currentMonth,
86
88
  classes: classesProp,
87
89
  value: valueProp,
88
90
  defaultValue,
@@ -173,11 +175,12 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
173
175
  if (readOnly) {
174
176
  return;
175
177
  }
176
- const newDate = adapter.setMonth(value ?? referenceDate, month);
178
+ const currentValue = value && currentMonth && !adapter.isSameYear(value, currentMonth) ? adapter.setYear(value, adapter.getYear(currentMonth)) : value;
179
+ const newDate = adapter.setMonth(currentValue ?? referenceDate, month);
177
180
  handleValueChange(newDate);
178
181
  });
179
182
  const focusMonth = useEventCallback(month => {
180
- if (!isMonthDisabled(adapter.setMonth(value ?? referenceDate, month))) {
183
+ if (!isMonthDisabled(adapter.setMonth(value ?? currentMonth ?? referenceDate, month))) {
181
184
  setFocusedMonth(month);
182
185
  changeHasFocus(true);
183
186
  if (onMonthFocus) {
@@ -228,11 +231,11 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
228
231
  "aria-labelledby": gridLabelId,
229
232
  monthsPerRow: monthsPerRow
230
233
  }, other, {
231
- children: getMonthsInYear(adapter, value ?? referenceDate).map(month => {
234
+ children: getMonthsInYear(adapter, currentMonth ?? value ?? referenceDate).map(month => {
232
235
  const monthNumber = adapter.getMonth(month);
233
236
  const monthText = adapter.format(month, 'monthShort');
234
237
  const monthLabel = adapter.format(month, 'month');
235
- const isSelected = monthNumber === selectedMonth;
238
+ const isSelected = isSameMonth(monthNumber, selectedMonth, month, value, adapter);
236
239
  const isDisabled = disabled || isMonthDisabled(month);
237
240
  return /*#__PURE__*/_jsx(MonthCalendarButton, {
238
241
  selected: isSelected,
@@ -244,7 +247,7 @@ export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalenda
244
247
  tabIndex: monthNumber === focusedMonth && !isDisabled ? 0 : -1,
245
248
  onFocus: handleMonthFocus,
246
249
  onBlur: handleMonthBlur,
247
- "aria-current": todayMonth === monthNumber ? 'date' : undefined,
250
+ "aria-current": isSameMonth(monthNumber, todayMonth, month, now, adapter) ? 'date' : undefined,
248
251
  "aria-label": monthLabel,
249
252
  slots: slots,
250
253
  slotProps: slotProps,
@@ -266,6 +269,7 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
266
269
  */
267
270
  classes: PropTypes.object,
268
271
  className: PropTypes.string,
272
+ currentMonth: PropTypes.object,
269
273
  /**
270
274
  * The default selected value.
271
275
  * Used when the component is not controlled.
@@ -32,6 +32,7 @@ export interface ExportedMonthCalendarProps {
32
32
  export interface MonthCalendarProps extends ExportedMonthCalendarProps, MonthValidationProps, BaseDateValidationProps, TimezoneProps, FormProps {
33
33
  autoFocus?: boolean;
34
34
  className?: string;
35
+ currentMonth?: PickerValidDate;
35
36
  /**
36
37
  * Override or extend the styles applied to the component.
37
38
  */
@@ -48,12 +48,6 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
48
48
  '&:not(:first-of-type)': {
49
49
  borderLeft: `1px solid ${(theme.vars || theme).palette.divider}`
50
50
  },
51
- '&::after': {
52
- display: 'block',
53
- content: '""',
54
- // subtracting the height of one item, extra margin and borders to make sure the max height is correct
55
- height: 'calc(100% - 40px - 6px)'
56
- },
57
51
  variants: [{
58
52
  props: {
59
53
  hasDigitalClockAlreadyBeenRendered: true
@@ -138,9 +132,21 @@ export const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(fun
138
132
  }
139
133
  previousActive.current = activeItem;
140
134
  const offsetTop = activeItem.offsetTop;
135
+ const itemHeight = activeItem.offsetHeight;
136
+ const containerHeight = containerRef.current.clientHeight;
137
+ const scrollableHeight = containerRef.current.scrollHeight;
138
+
139
+ // Calculate the ideal centered position
140
+ const centeredPosition = offsetTop - containerHeight / 2 + itemHeight / 2;
141
+
142
+ // Calculate the maximum scroll position that would show content at the bottom
143
+ const maxScrollTop = scrollableHeight - containerHeight;
144
+
145
+ // If centering would create empty space at the bottom, align the last items to the bottom instead
146
+ const scrollPosition = Math.min(centeredPosition, maxScrollTop);
141
147
 
142
- // Subtracting the 4px of extra margin intended for the first visible section item
143
- containerRef.current.scrollTop = offsetTop - 4;
148
+ // Ensure we don't scroll past the top
149
+ containerRef.current.scrollTop = Math.max(0, scrollPosition);
144
150
  });
145
151
  const focusedOptionIndex = items.findIndex(item => item.isFocused(item.value));
146
152
  const handleKeyDown = event => {
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
7
7
  import { useThemeProps } from '@mui/material/styles';
8
8
  import refType from '@mui/utils/refType';
9
9
  import { useTimeField } from "./useTimeField.js";
10
- import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
10
+ import { PickerFieldUI, PickerFieldUIContextProvider, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
11
11
  import { ClockIcon } from "../icons/index.js";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  /**
@@ -36,11 +36,14 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
36
36
  externalForwardedProps: other
37
37
  });
38
38
  const fieldResponse = useTimeField(textFieldProps);
39
- return /*#__PURE__*/_jsx(PickerFieldUI, {
39
+ return /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
40
40
  slots: slots,
41
41
  slotProps: slotProps,
42
- fieldResponse: fieldResponse,
43
- defaultOpenPickerIcon: ClockIcon
42
+ inputRef: other.inputRef,
43
+ children: /*#__PURE__*/_jsx(PickerFieldUI, {
44
+ fieldResponse: fieldResponse,
45
+ defaultOpenPickerIcon: ClockIcon
46
+ })
44
47
  });
45
48
  });
46
49
  if (process.env.NODE_ENV !== "production") TimeField.displayName = "TimeField";
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.11.1
2
+ * @mui/x-date-pickers v8.11.3
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -47,16 +47,6 @@ export interface ExportedPickerFieldUIProps {
47
47
  openPickerButtonPosition?: 'start' | 'end';
48
48
  }
49
49
  export interface PickerFieldUIProps<TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
50
- /**
51
- * Overridable component slots.
52
- * @default {}
53
- */
54
- slots?: PickerFieldUISlots;
55
- /**
56
- * The props used for each component slot.
57
- * @default {}
58
- */
59
- slotProps?: PickerFieldUISlotProps;
60
50
  /**
61
51
  * Object returned by the `useField` hook or one of its wrapper (for example `useDateField`).
62
52
  */