@mui/x-date-pickers 8.6.0 → 8.7.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 (40) hide show
  1. package/CHANGELOG.md +104 -1
  2. package/PickersTextField/PickersInputBase/PickersInputBase.js +1 -0
  3. package/esm/PickersTextField/PickersInputBase/PickersInputBase.js +2 -0
  4. package/esm/index.js +1 -1
  5. package/esm/internals/components/PickerFieldUI.js +2 -0
  6. package/esm/internals/components/PickerPopper/PickerPopper.js +2 -0
  7. package/esm/internals/components/PickerProvider.js +2 -0
  8. package/esm/internals/hooks/useClockReferenceDate.js +2 -2
  9. package/esm/internals/hooks/useControlledValue.d.ts +2 -2
  10. package/esm/internals/hooks/useControlledValue.js +1 -1
  11. package/esm/internals/hooks/useField/useField.types.d.ts +2 -2
  12. package/esm/internals/hooks/useField/useFieldState.js +2 -0
  13. package/esm/internals/hooks/useField/useFieldV6TextField.js +2 -0
  14. package/esm/internals/hooks/useField/useFieldV7TextField.js +2 -0
  15. package/esm/internals/hooks/useNullableFieldPrivateContext.js +2 -0
  16. package/esm/internals/hooks/usePicker/hooks/useOrientation.js +2 -0
  17. package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +2 -0
  18. package/esm/internals/hooks/usePicker/usePicker.js +2 -0
  19. package/esm/internals/hooks/usePicker/usePicker.types.d.ts +3 -3
  20. package/esm/internals/hooks/useViews.js +2 -0
  21. package/esm/internals/models/manager.d.ts +3 -3
  22. package/index.js +1 -1
  23. package/internals/components/PickerFieldUI.js +1 -0
  24. package/internals/components/PickerPopper/PickerPopper.js +1 -0
  25. package/internals/components/PickerProvider.js +1 -0
  26. package/internals/hooks/useClockReferenceDate.js +2 -2
  27. package/internals/hooks/useControlledValue.d.ts +2 -2
  28. package/internals/hooks/useControlledValue.js +1 -1
  29. package/internals/hooks/useField/useField.types.d.ts +2 -2
  30. package/internals/hooks/useField/useFieldState.js +1 -0
  31. package/internals/hooks/useField/useFieldV6TextField.js +1 -0
  32. package/internals/hooks/useField/useFieldV7TextField.js +1 -0
  33. package/internals/hooks/useNullableFieldPrivateContext.js +1 -0
  34. package/internals/hooks/usePicker/hooks/useOrientation.js +1 -0
  35. package/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +1 -0
  36. package/internals/hooks/usePicker/usePicker.js +1 -0
  37. package/internals/hooks/usePicker/usePicker.types.d.ts +3 -3
  38. package/internals/hooks/useViews.js +1 -0
  39. package/internals/models/manager.d.ts +3 -3
  40. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,109 @@
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.7.0
9
+
10
+ _Jul 4, 2025_
11
+
12
+ We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 📊 Add `useChartProApiRef` for easier access to the API
15
+ - 📆 Support different start and end `referenceDate` props on range components
16
+ - 📚 Documentation improvements
17
+ - 🐞 Bugfixes
18
+ - 🌎 Improve Greek (el-GR) translations on the Charts
19
+ - 🌎 Improve Danish (da-DK) locale on the Data Grid
20
+
21
+ Special thanks go out to the community members for their valuable contributions:
22
+ @ShahrazH, @vadimkuragkovskiy, @whythecode
23
+
24
+ The following are all team members who have contributed to this release:
25
+ @alexfauquette, @brijeshb42, @mapache-salvaje, @arminmeh, @bernardobelchior, @bharatkashyap, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @michelengelen, @rita-codes
26
+
27
+ ### Data Grid
28
+
29
+ #### `@mui/x-data-grid@8.7.0`
30
+
31
+ - [DataGrid] Fix column state restore with controlled column visibility model (#18567) @arminmeh
32
+ - [DataGrid] Fix styling virtualized column headers (#18603) @KenanYusuf
33
+ - [l10n] Improve Danish (da-DK) locale (#18537) @ShahrazH
34
+
35
+ #### `@mui/x-data-grid-pro@8.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
36
+
37
+ Same changes as in `@mui/x-data-grid@8.7.0`.
38
+
39
+ #### `@mui/x-data-grid-premium@8.7.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
40
+
41
+ Same changes as in `@mui/x-data-grid-pro@8.7.0`.
42
+
43
+ ### Date and Time Pickers
44
+
45
+ #### `@mui/x-date-pickers@8.7.0`
46
+
47
+ - [pickers] Support different `start` and `end` `referenceDate` props on range components (#18549) @LukasTy
48
+
49
+ #### `@mui/x-date-pickers-pro@8.7.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@8.7.0`.
52
+
53
+ ### Charts
54
+
55
+ #### `@mui/x-charts@8.7.0`
56
+
57
+ - [charts] Export `ChartsReferenceLineProps` (#18598) @bernardobelchior
58
+ - [charts] Extract bar and line plot logic into reusable hooks (#18541) @bernardobelchior
59
+ - [charts] Extract plot logic into separate files for reuse (#18522) @bernardobelchior
60
+ - [charts] Profile charts benchmarks using chromium (#18528) @bernardobelchior
61
+ - [l10n] Add Greek (el-GR) locale to charts (#18548) @whythecode
62
+
63
+ #### `@mui/x-charts-pro@8.7.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@8.7.0`, plus:
66
+
67
+ - [charts-pro] Add `useChartProApiRef` for easier refs (#18013) @JCQuintas
68
+ - [charts-pro] Add tests and classes to zoom slider (#18660) @JCQuintas
69
+ - [charts-pro] Fix geometry not handling gestures in specific scenarios (#18651) @JCQuintas
70
+ - [charts-pro] Rename `useChartApiContext` to `useChartProApiContext` (#18565) @JCQuintas
71
+ - [charts-pro] Zoom pointer improvements (#17480) @JCQuintas
72
+
73
+ ### Tree View
74
+
75
+ #### `@mui/x-tree-view@8.7.0`
76
+
77
+ Internal changes.
78
+
79
+ #### `@mui/x-tree-view-pro@8.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
80
+
81
+ Same changes as in `@mui/x-tree-view@8.7.0`, plus:
82
+
83
+ - [tree view pro] Add missing `dataSource` JSDoc (#18650) @LukasTy
84
+
85
+ ### Docs
86
+
87
+ - [docs] Add MCP stub (#18204) @bharatkashyap
88
+ - [docs] Fix AI Assistant proxy rewrite prefix (#18661) @arminmeh
89
+ - [docs] Improve test README.MD (#18634) @LukasTy
90
+ - [docs] Provide workaround for pie chart composition (#18600) @alexfauquette
91
+ - [docs][charts] Add donut chart as a special case of a pie chart (#18652) @bernardobelchior
92
+ - [docs][charts] Centralize country and continent data (#18604) @bernardobelchior
93
+ - [docs][data grid] Audit and revise the Pro row docs (#17926) @mapache-salvaje
94
+ - [docs][pickers] Add mention of theme augmentation in relevant migration section (#18608) @LukasTy
95
+
96
+ ### Core
97
+
98
+ - [core] Avoid stringifying `document` object (#18657) @vadimkuragkovskiy
99
+
100
+ ### Miscellaneous
101
+
102
+ - [code-infra] Bump code-infra version and fix breaking changes (#18653) @brijeshb42
103
+ - [code-infra] Ensure `material-ui/disallow-react-api-in-server-components` ESLint rule is applied (#18570) @LukasTy
104
+ - [code-infra] Migrate to flat eslint config (#18562) @brijeshb42
105
+ - [code-infra] Refactor eslint config (#18643) @LukasTy
106
+ - [infra] Add renovatebot rule for latest infra packages (#18609) @Janpot
107
+ - [infra] Move pushArgos script to code-infra (#18667) @Janpot
108
+ - [infra] Updates release script to fetch latest major version from upstream (#18552) @michelengelen
109
+ - [release] Add missing contributor to changelog (#18561) @bernardobelchior
110
+
8
111
  ## 8.6.0
9
112
 
10
113
  _Jun 27, 2025_
@@ -19,7 +122,7 @@ We'd like to extend a big thank you to the 12 contributors who made this release
19
122
  - 🌎 Improve German (de-DE) locale
20
123
 
21
124
  Special thanks go out to the community members for their valuable contributions:
22
- @ShahrazH, @vadimka123
125
+ @omalyutin, @ShahrazH, @vadimka123
23
126
 
24
127
  The following are all team members who have contributed to this release:
25
128
  @arminmeh, @bernardobelchior, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @noraleonte, @rita-codes, @sai6855
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
4
  import _extends from "@babel/runtime/helpers/esm/extends";
3
5
  const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur", "classes", "ownerState"];
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.6.0
2
+ * @mui/x-date-pickers v8.7.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
5
  const _excluded = ["enableAccessibleFieldDOMStructure"],
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
5
  const _excluded = ["PaperComponent", "ownerState", "children", "paperSlotProps", "paperClasses", "onPaperClick", "onPaperTouchStart"];
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  import { LocalizationProvider } from "../../LocalizationProvider/index.js";
3
5
  import { IsValidValueContext } from "../../hooks/useIsValidValue.js";
@@ -18,8 +18,8 @@ export const useClockReferenceDate = ({
18
18
  timezone,
19
19
  getTodayDate: () => getTodayDate(adapter, timezone, 'date')
20
20
  }),
21
- // We only want to compute the reference date on mount.
22
- [] // eslint-disable-line react-hooks/exhaustive-deps
21
+ // We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
22
+ [referenceDateProp, timezone] // eslint-disable-line react-hooks/exhaustive-deps
23
23
  );
24
24
  return value ?? referenceDate;
25
25
  };
@@ -1,4 +1,4 @@
1
- import type { PickerValueManager } from "../models/index.js";
1
+ import type { PickerRangeValue, PickerValueManager } from "../models/index.js";
2
2
  import { PickersTimezone, PickerValidDate } from "../../models/index.js";
3
3
  import { PickerValidValue } from "../models/index.js";
4
4
  /**
@@ -28,7 +28,7 @@ interface UseValueWithTimezoneParameters<TValue extends PickerValidValue, TChang
28
28
  * It does not need to have its default value.
29
29
  * This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
30
30
  */
31
- referenceDate: PickerValidDate | undefined;
31
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
32
32
  onChange: TChange | undefined;
33
33
  valueManager: PickerValueManager<TValue, any>;
34
34
  }
@@ -39,7 +39,7 @@ export const useControlledValue = ({
39
39
  return inputTimezone;
40
40
  }
41
41
  if (referenceDate) {
42
- return adapter.getTimezone(referenceDate);
42
+ return adapter.getTimezone(Array.isArray(referenceDate) ? referenceDate[0] : referenceDate);
43
43
  }
44
44
  return 'default';
45
45
  }, [timezoneProp, inputTimezone, referenceDate, adapter]);
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, PickerValidDate, FieldRef, OnErrorProps, InferFieldSection, PickerManager, PickerValueType } from "../../../models/index.js";
3
3
  import { InternalPropNames } from "../../../hooks/useSplitFieldProps.js";
4
4
  import type { PickersSectionElement, PickersSectionListRef } from "../../../PickersSectionList/index.js";
5
- import { FormProps, InferNonNullablePickerValue, PickerValidValue } from "../../models/index.js";
5
+ import { FormProps, InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "../../models/index.js";
6
6
  export interface UseFieldParameters<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError, TValidationProps extends {}, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
7
7
  manager: PickerManager<TValue, TEnableAccessibleFieldDOMStructure, TError, TValidationProps, any>;
8
8
  props: TProps;
@@ -23,7 +23,7 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
23
23
  * For example, on time fields it will be used to determine the date to set.
24
24
  * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
25
25
  */
26
- referenceDate?: PickerValidDate;
26
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
27
27
  /**
28
28
  * Callback fired when the value changes.
29
29
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import * as React from 'react';
3
5
  import useControlled from '@mui/utils/useControlled';
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import * as React from 'react';
3
5
  import { useRtl } from '@mui/system/RtlProvider';
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import * as React from 'react';
3
5
  import useForkRef from '@mui/utils/useForkRef';
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  export const PickerFieldPrivateContext = /*#__PURE__*/React.createContext(null);
3
5
  if (process.env.NODE_ENV !== "production") PickerFieldPrivateContext.displayName = "PickerFieldPrivateContext";
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import * as React from 'react';
2
4
  import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
3
5
  import { arrayIncludes } from "../../../utils/utils.js";
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import * as React from 'react';
3
5
  import { warnOnce } from '@mui/x-internals/warning';
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
5
  const _excluded = ["className", "sx"];
@@ -1,7 +1,7 @@
1
1
  import { SxProps } from '@mui/system';
2
2
  import { Theme } from '@mui/material/styles';
3
3
  import { InferError, OnErrorProps, PickerChangeHandlerContext, PickerOwnerState, PickerValidDate, PickerValueType, TimezoneProps } from "../../../models/index.js";
4
- import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
4
+ import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerRangeValue, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
5
5
  import { Validator } from "../../../validation/index.js";
6
6
  import { UseViewsOptions } from "../useViews.js";
7
7
  import { PickerProviderProps } from "../../components/PickerProvider.js";
@@ -48,7 +48,7 @@ export interface UsePickerBaseProps<TValue extends PickerValidValue, TView exten
48
48
  * The date used to generate the new value when both `value` and `defaultValue` are empty.
49
49
  * @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
50
50
  */
51
- referenceDate?: PickerValidDate;
51
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
52
52
  /**
53
53
  * Force rendering in particular orientation.
54
54
  */
@@ -108,7 +108,7 @@ export interface UsePickerNonStaticProps extends Omit<PickerFieldPrivateContextV
108
108
  name?: string;
109
109
  }
110
110
  export interface UsePickerProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerProps<TValue, TView, TError, any>> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps>, UsePickerNonStaticProps {
111
- referenceDate?: PickerValidDate;
111
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
112
112
  className?: string;
113
113
  sx?: SxProps<Theme>;
114
114
  }
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import * as React from 'react';
3
5
  import useEventCallback from '@mui/utils/useEventCallback';
@@ -1,6 +1,6 @@
1
1
  import type { MuiPickersAdapter, PickerManager, PickersTimezone, PickerValidDate, PickerValueType } from "../../models/index.js";
2
2
  import type { GetDefaultReferenceDateProps } from "../utils/getDefaultReferenceDate.js";
3
- import { InferNonNullablePickerValue, PickerValidValue } from "./value.js";
3
+ import { InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "./value.js";
4
4
  import type { UseFieldInternalProps } from "../hooks/useField/index.js";
5
5
  export type PickerAnyManager = PickerManager<any, any, any, any, any>;
6
6
  type PickerManagerProperties<TManager extends PickerAnyManager> = TManager extends PickerManager<infer TValue, infer TEnableAccessibleFieldDOMStructure, infer TError, infer TValidationProps, infer TFieldInternalProps> ? {
@@ -43,7 +43,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
43
43
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
44
44
  * Method returning the reference value to use when mounting the component.
45
45
  * @param {object} params The params of the method.
46
- * @param {PickerValidDate | undefined} params.referenceDate The referenceDate provided by the user.
46
+ * @param {PickerValidDate | PickerValidDate[] | undefined} params.referenceDate The referenceDate provided by the user.
47
47
  * @param {TValue} params.value The value provided by the user.
48
48
  * @param {GetDefaultReferenceDateProps} params.props The validation props needed to compute the reference value.
49
49
  * @param {MuiPickersAdapter} params.adapter The Picker date adapter instance.
@@ -53,7 +53,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
53
53
  * @returns {TValue} The reference value to use for non-provided dates.
54
54
  */
55
55
  getInitialReferenceValue: (params: {
56
- referenceDate: PickerValidDate | undefined;
56
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
57
57
  value: TValue;
58
58
  props: GetDefaultReferenceDateProps;
59
59
  adapter: MuiPickersAdapter;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.6.0
2
+ * @mui/x-date-pickers v8.7.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
@@ -25,8 +25,8 @@ const useClockReferenceDate = ({
25
25
  timezone,
26
26
  getTodayDate: () => (0, _dateUtils.getTodayDate)(adapter, timezone, 'date')
27
27
  }),
28
- // We only want to compute the reference date on mount.
29
- [] // eslint-disable-line react-hooks/exhaustive-deps
28
+ // We want the `referenceDate` to update on prop and `timezone` change (https://github.com/mui/mui-x/issues/10804)
29
+ [referenceDateProp, timezone] // eslint-disable-line react-hooks/exhaustive-deps
30
30
  );
31
31
  return value ?? referenceDate;
32
32
  };
@@ -1,4 +1,4 @@
1
- import type { PickerValueManager } from "../models/index.js";
1
+ import type { PickerRangeValue, PickerValueManager } from "../models/index.js";
2
2
  import { PickersTimezone, PickerValidDate } from "../../models/index.js";
3
3
  import { PickerValidValue } from "../models/index.js";
4
4
  /**
@@ -28,7 +28,7 @@ interface UseValueWithTimezoneParameters<TValue extends PickerValidValue, TChang
28
28
  * It does not need to have its default value.
29
29
  * This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
30
30
  */
31
- referenceDate: PickerValidDate | undefined;
31
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
32
32
  onChange: TChange | undefined;
33
33
  valueManager: PickerValueManager<TValue, any>;
34
34
  }
@@ -46,7 +46,7 @@ const useControlledValue = ({
46
46
  return inputTimezone;
47
47
  }
48
48
  if (referenceDate) {
49
- return adapter.getTimezone(referenceDate);
49
+ return adapter.getTimezone(Array.isArray(referenceDate) ? referenceDate[0] : referenceDate);
50
50
  }
51
51
  return 'default';
52
52
  }, [timezoneProp, inputTimezone, referenceDate, adapter]);
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, PickerValidDate, FieldRef, OnErrorProps, InferFieldSection, PickerManager, PickerValueType } from "../../../models/index.js";
3
3
  import { InternalPropNames } from "../../../hooks/useSplitFieldProps.js";
4
4
  import type { PickersSectionElement, PickersSectionListRef } from "../../../PickersSectionList/index.js";
5
- import { FormProps, InferNonNullablePickerValue, PickerValidValue } from "../../models/index.js";
5
+ import { FormProps, InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "../../models/index.js";
6
6
  export interface UseFieldParameters<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError, TValidationProps extends {}, TProps extends UseFieldProps<TEnableAccessibleFieldDOMStructure>> {
7
7
  manager: PickerManager<TValue, TEnableAccessibleFieldDOMStructure, TError, TValidationProps, any>;
8
8
  props: TProps;
@@ -23,7 +23,7 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
23
23
  * For example, on time fields it will be used to determine the date to set.
24
24
  * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
25
25
  */
26
- referenceDate?: PickerValidDate;
26
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
27
27
  /**
28
28
  * Callback fired when the value changes.
29
29
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
@@ -1,7 +1,7 @@
1
1
  import { SxProps } from '@mui/system';
2
2
  import { Theme } from '@mui/material/styles';
3
3
  import { InferError, OnErrorProps, PickerChangeHandlerContext, PickerOwnerState, PickerValidDate, PickerValueType, TimezoneProps } from "../../../models/index.js";
4
- import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
4
+ import { DateOrTimeViewWithMeridiem, FormProps, PickerOrientation, PickerRangeValue, PickerValidValue, PickerValueManager, PickerVariant } from "../../models/index.js";
5
5
  import { Validator } from "../../../validation/index.js";
6
6
  import { UseViewsOptions } from "../useViews.js";
7
7
  import { PickerProviderProps } from "../../components/PickerProvider.js";
@@ -48,7 +48,7 @@ export interface UsePickerBaseProps<TValue extends PickerValidValue, TView exten
48
48
  * The date used to generate the new value when both `value` and `defaultValue` are empty.
49
49
  * @default The closest valid date-time using the validation props, except callbacks like `shouldDisable<...>`.
50
50
  */
51
- referenceDate?: PickerValidDate;
51
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
52
52
  /**
53
53
  * Force rendering in particular orientation.
54
54
  */
@@ -108,7 +108,7 @@ export interface UsePickerNonStaticProps extends Omit<PickerFieldPrivateContextV
108
108
  name?: string;
109
109
  }
110
110
  export interface UsePickerProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerProps<TValue, TView, TError, any>> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps>, UsePickerNonStaticProps {
111
- referenceDate?: PickerValidDate;
111
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
112
112
  className?: string;
113
113
  sx?: SxProps<Theme>;
114
114
  }
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ 'use client';
2
3
 
3
4
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
@@ -1,6 +1,6 @@
1
1
  import type { MuiPickersAdapter, PickerManager, PickersTimezone, PickerValidDate, PickerValueType } from "../../models/index.js";
2
2
  import type { GetDefaultReferenceDateProps } from "../utils/getDefaultReferenceDate.js";
3
- import { InferNonNullablePickerValue, PickerValidValue } from "./value.js";
3
+ import { InferNonNullablePickerValue, PickerRangeValue, PickerValidValue } from "./value.js";
4
4
  import type { UseFieldInternalProps } from "../hooks/useField/index.js";
5
5
  export type PickerAnyManager = PickerManager<any, any, any, any, any>;
6
6
  type PickerManagerProperties<TManager extends PickerAnyManager> = TManager extends PickerManager<infer TValue, infer TEnableAccessibleFieldDOMStructure, infer TError, infer TValidationProps, infer TFieldInternalProps> ? {
@@ -43,7 +43,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
43
43
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
44
44
  * Method returning the reference value to use when mounting the component.
45
45
  * @param {object} params The params of the method.
46
- * @param {PickerValidDate | undefined} params.referenceDate The referenceDate provided by the user.
46
+ * @param {PickerValidDate | PickerValidDate[] | undefined} params.referenceDate The referenceDate provided by the user.
47
47
  * @param {TValue} params.value The value provided by the user.
48
48
  * @param {GetDefaultReferenceDateProps} params.props The validation props needed to compute the reference value.
49
49
  * @param {MuiPickersAdapter} params.adapter The Picker date adapter instance.
@@ -53,7 +53,7 @@ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
53
53
  * @returns {TValue} The reference value to use for non-provided dates.
54
54
  */
55
55
  getInitialReferenceValue: (params: {
56
- referenceDate: PickerValidDate | undefined;
56
+ referenceDate?: TValue extends PickerRangeValue ? TValue | PickerValidDate : PickerValidDate;
57
57
  value: TValue;
58
58
  props: GetDefaultReferenceDateProps;
59
59
  adapter: MuiPickersAdapter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The community edition of the MUI X Date and Time Picker components.",
6
6
  "main": "./index.js",
@@ -41,7 +41,7 @@
41
41
  "clsx": "^2.1.1",
42
42
  "prop-types": "^15.8.1",
43
43
  "react-transition-group": "^4.4.5",
44
- "@mui/x-internals": "8.6.0"
44
+ "@mui/x-internals": "8.7.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@emotion/react": "^11.9.0",