@mui/x-date-pickers-pro 6.5.0 → 6.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 (54) hide show
  1. package/CHANGELOG.md +150 -2
  2. package/DateRangePickerDay/DateRangePickerDay.d.ts +2 -2
  3. package/DateRangePickerDay/DateRangePickerDay.js +2 -2
  4. package/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -0
  5. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +6 -0
  6. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -0
  7. package/README.md +5 -5
  8. package/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  9. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +2 -2
  10. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  11. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  12. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  13. package/index.js +1 -1
  14. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -2
  15. package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +3 -3
  16. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -2
  17. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -2
  18. package/internal/models/dateRange.d.ts +1 -1
  19. package/internal/models/dateTimeRange.d.ts +1 -1
  20. package/internal/models/fields.d.ts +1 -1
  21. package/internal/models/timeRange.d.ts +1 -1
  22. package/internal/utils/releaseInfo.js +1 -1
  23. package/internal/utils/valueManagers.js +27 -3
  24. package/legacy/DateRangePickerDay/DateRangePickerDay.js +2 -2
  25. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -0
  26. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +6 -0
  27. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -0
  28. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  29. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  30. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  31. package/legacy/index.js +1 -1
  32. package/legacy/internal/utils/releaseInfo.js +1 -1
  33. package/legacy/internal/utils/valueManagers.js +29 -7
  34. package/modern/DateRangePickerDay/DateRangePickerDay.js +2 -2
  35. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -0
  36. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +6 -0
  37. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -0
  38. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  39. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  40. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  41. package/modern/index.js +1 -1
  42. package/modern/internal/utils/releaseInfo.js +1 -1
  43. package/modern/internal/utils/valueManagers.js +27 -3
  44. package/node/DateRangePickerDay/DateRangePickerDay.js +2 -2
  45. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -0
  46. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +6 -0
  47. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -0
  48. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  49. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  50. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  51. package/node/index.js +1 -1
  52. package/node/internal/utils/releaseInfo.js +1 -1
  53. package/node/internal/utils/valueManagers.js +26 -2
  54. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -3,6 +3,154 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.7.0
7
+
8
+ _Jun 9, 2023_
9
+
10
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Improve the default `format` prop value on the pickers.
13
+
14
+ Here are a few examples:
15
+
16
+ ```tsx
17
+ <TimePicker views={['hours', 'minutes', 'seconds']} ampm />
18
+ // Format before v6.7.0: `hh:mm aa`
19
+ // Format after v6.7.0: `hh:mm:ss aa`
20
+
21
+ <DatePicker views={['year']} />
22
+ // Format before v6.7.0: `MM/DD/YYYY`
23
+ // Format after v6.7.0: `YYYY`
24
+
25
+ <DateTimePicker views={['day', 'hours', 'minutes']} ampm />
26
+ // Format before v6.7.0: `MM/DD/YYYY hh:mm aa`
27
+ // Format after v6.7.0: `DD hh:mm aa`
28
+ ```
29
+
30
+ - 🌍 Add Romanian (ro-RO) locale on the pickers
31
+ - 🌍 Improve German (de-DE) locale on the pickers
32
+ - 🌍 Improve Czech (cs-CZ), German (de-DE) and Turkish (tr-TR) locales on the data grid
33
+ - 🚀 Performance improvements
34
+ - 🐞 Bugfixes
35
+ - 📚 Documentation improvements
36
+
37
+ ### `@mui/x-data-grid@v6.7.0` / `@mui/x-data-grid-pro@v6.7.0` / `@mui/x-data-grid-premium@v6.7.0`
38
+
39
+ #### Changes
40
+
41
+ - [DataGrid] Allow overflowing grid root element (#9179) @cherniavskii
42
+ - [DataGrid] Fix module augmentation error when using `@mui/lab` (#9235) @cherniavskii
43
+ - [DataGrid] Fix row with ids matching `Object` prototype (#9265) @romgrk
44
+ - [DataGrid] Fix `sortModel` and `filterModel` resetting when columns change (#9239) @alexgonch
45
+ - [DataGrid] Improve grouping performance for large datasets (#9200) @romgrk
46
+ - [DataGrid] Increase threshold to trigger memory leak warning (#9263) @m4theushw
47
+ - [DataGrid] Update data grid migration guide to include updated type (#9272) @MBilalShafi
48
+ - [DataGridPro] Improve header filter menu visuals (#9181) @MBilalShafi
49
+ - [DataGridPremium] Remove last line break on clipboard paste (#9163) @cherniavskii
50
+ - [l10n] Improve Czech (cs-CZ) locale (#9266) @MartinSkarpa
51
+ - [l10n] Improve German (de-DE) locale (#9259) @ximex
52
+ - [l10n] Improve Turkish (tr-TR) locale (#9237) @MCErtan
53
+
54
+ ### `@mui/x-date-pickers@v6.7.0` / `@mui/x-date-pickers-pro@v6.7.0`
55
+
56
+ #### Changes
57
+
58
+ - [l10n] Add Romanian (ro-RO) locale (#9257) @ximex
59
+ - [l10n] Improve German (de-DE) locale (#9258) @ximex
60
+ - [pickers] Apply dynamic default format depending on views for all desktop and mobile pickers (#9126) @flaviendelangle
61
+ - [pickers] Update `DateRangePickerDay` props JSDoc (#9191) @stevus
62
+
63
+ ### Docs
64
+
65
+ - [docs] Fix missing props on the `GridFilterPanel` API page (#9180) @cherniavskii
66
+ - [docs] Fix overview page typo (#9230) @LukasTy
67
+ - [docs] Fix version redirect (#9273) @alexfauquette
68
+
69
+ ### Core
70
+
71
+ - [core] Temporarily remove the Argos upload on the regression testing (#9267) @flaviendelangle
72
+ - [charts] Add clip-path to avoid charts overflow (#9012) @alexfauquette
73
+ - [charts] Add style customization on bar (#8935) @alexfauquette
74
+ - [charts] Enforce axis `min`/`max` over the `nice()` method (#9189) @alexfauquette
75
+ - [charts] Improve axis label and ticks label alignements (#9190) @alexfauquette
76
+ - [charts] Simplify the switch between responsive and fix dimensions (#9151) @alexfauquette
77
+
78
+ ## 6.6.0
79
+
80
+ _Jun 1, 2023_
81
+
82
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
83
+
84
+ - 🚀 New date time picking UI on [`DesktopDateTimePicker`](https://mui.com/x/react-date-pickers/date-time-picker/)
85
+
86
+ <img src="https://user-images.githubusercontent.com/4941090/242533399-2b106390-8158-4aba-9ca4-b621c6310977.gif" width="628" />
87
+
88
+ - 🚀 Performance improvements
89
+ - 🐞 Bugfixes
90
+ - 📚 Documentation improvements
91
+ - 🌍 Improve Dutch (nl-NL) and French (fr-FR) locales on the data grid
92
+ - 🌍 Add Vietnamese (vi-VN) locale on the pickers
93
+
94
+ ### `@mui/x-data-grid@v6.6.0` / `@mui/x-data-grid-pro@v6.6.0` / `@mui/x-data-grid-premium@v6.6.0`
95
+
96
+ #### Changes
97
+
98
+ - [DataGrid] Support data attributes (#8845) @romgrk
99
+ - [DataGrid] Avoid allocations in `hydrateRowsMeta` (#9121) @romgrk
100
+ - [DataGrid] Fix filter input select accessibility (#9018) @Jul13nT
101
+ - [DataGrid] Fix accessibility issues in panels and toolbar buttons (#8862) @romgrk
102
+ - [DataGrid] Fix `onCellEditStop` not invoked (#8857) @romgrk
103
+ - [DataGridPro] Fix auto-scroll when reordering columns (#8856) @m4theushw
104
+ - [DataGridPro] Fix row ID type casting in detail panels lookup (#8976) @minchaej
105
+ - [DataGridPro] Emit `columnWidthChange` event on `touchEnd` of column resize (#8669) @MBilalShafi
106
+ - [DataGridPro] Do not apply filters on `rowExpansionChange` (#8671) @cherniavskii
107
+ - [DataGridPro] Prevent click event on sorting after a resize (#9117) @romgrk
108
+ - [DataGridPremium] Improve Excel export interface (#9128) @TiagoPortfolio
109
+ - [l10n] Improve Dutch (nl-NL) locale (#9043) @thedutchruben
110
+ - [l10n] Improve French (fr-FR) locale (#9109) @Jul13nT
111
+
112
+ ### `@mui/x-date-pickers@v6.6.0` / `@mui/x-date-pickers-pro@v6.6.0`
113
+
114
+ #### Changes
115
+
116
+ - [fields] Allow to explicitly define the reference value and improve its default value (#9019) @flaviendelangle
117
+ - [l10n] Add Vietnamese (vi-VN) locale (#9099) @nhannt201
118
+ - [pickers] Add `DigitalClock` to `DesktopDateTimePicker` (#8946) @LukasTy
119
+ - [pickers] Add support for timezones on the adapters (#9068) @flaviendelangle
120
+ - [pickers] Fix `MonthCalendar` and `YearCalendar` disabled validation (#9149) @LukasTy
121
+ - [pickers] Fix bug when fields have a unique section (#9110) @alexfauquette
122
+ - [pickers] Fix focus jumping on Safari (#9072) @LukasTy
123
+ - [pickers] Use the locale start of the week in `getWeekArray` (#9176) @flaviendelangle
124
+
125
+ ### Docs
126
+
127
+ - [docs] Add single input range picker demo (#9159) @LukasTy
128
+ - [docs] Align `DateCalendar` demo views with labels (#9152) @LukasTy
129
+ - [docs] Clarify the peer dependency with React (#9067) @oliviertassinari
130
+ - [docs] Fix Norwegian locale typo (#9168) @LukasTy
131
+ - [docs] Fix column menu item demo (#9071) @MBilalShafi
132
+ - [docs] Improve localization table progress bars (#9033) @noraleonte
133
+ - [docs] Smooth performance animation (#8986) @oliviertassinari
134
+ - [docs] Use responsive time and date time pickers and the views sections (#9127) @flaviendelangle
135
+ - [docs] Reduce layout shift in grid demo (#9132) @oliviertassinari
136
+ - [docs] Fix tree data children lazy-loading demo (#8840) @yaredtsy
137
+ - [docs] Improve filtering docs discoverability (#9074) @MBilalShafi
138
+
139
+ ### Core
140
+
141
+ - [core] Allow string literals as keys in `localesText` (#9045) @MBilalShafi
142
+ - [core] Fix `randomInt` producing values exceeding `max` value (#9086) @cherniavskii
143
+ - [core] Fix flaky test on `dateWithTimezone` adapter test (#9129) @flaviendelangle
144
+ - [core] Lock `@types/node` on v18 (#9107) @LukasTy
145
+ - [core] Remove `cross-fetch` dependency (#9108) @LukasTy
146
+ - [core] Remove `createDetectElementResize()` replaced with `ResizeObserver` (#9015) @oliviertassinari
147
+ - [core] Upgrade monorepo (#9027) @m4theushw
148
+ - [core] Upgrade monorepo (#9106) @LukasTy
149
+ - [charts] Fix proptypes (#9125) @LukasTy
150
+ - [charts] Generate the charts proptypes (#9010) @alexfauquette
151
+ - [charts] Manage series stacking (#8888) @alexfauquette
152
+ - [license] List side effects in the license package (#9092) @cherniavskii
153
+
6
154
  ## v6.5.0
7
155
 
8
156
  _May 19, 2023_
@@ -102,7 +250,7 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
102
250
 
103
251
  ### Docs
104
252
 
105
- - [docs] Fix date pickers typo in the docs (#8939) @richbustos
253
+ - [docs] Fix date pickers typo in the docs (#8939) @richbustos
106
254
  - [docs] Fix master detail demo (#8894) @m4theushw
107
255
  - [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
108
256
  - [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
@@ -4440,7 +4588,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
4440
4588
 
4441
4589
  - 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
4442
4590
 
4443
- - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/#quick-filter).
4591
+ - 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/quick-filter/).
4444
4592
 
4445
4593
  <img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
4446
4594
 
@@ -19,11 +19,11 @@ export interface DateRangePickerDayProps<TDate> extends Omit<PickersDayProps<TDa
19
19
  */
20
20
  isPreviewing: boolean;
21
21
  /**
22
- * Set to `true` if the `day` is the start of a previewing date range.
22
+ * Set to `true` if the `day` is the end of a previewing date range.
23
23
  */
24
24
  isEndOfPreviewing: boolean;
25
25
  /**
26
- * Set to `true` if the `day` is the end of a previewing date range.
26
+ * Set to `true` if the `day` is the start of a previewing date range.
27
27
  */
28
28
  isStartOfPreviewing: boolean;
29
29
  /**
@@ -290,7 +290,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
290
290
  */
291
291
  isEndOfHighlighting: PropTypes.bool.isRequired,
292
292
  /**
293
- * Set to `true` if the `day` is the start of a previewing date range.
293
+ * Set to `true` if the `day` is the end of a previewing date range.
294
294
  */
295
295
  isEndOfPreviewing: PropTypes.bool.isRequired,
296
296
  /**
@@ -316,7 +316,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
316
316
  */
317
317
  isStartOfHighlighting: PropTypes.bool.isRequired,
318
318
  /**
319
- * Set to `true` if the `day` is the end of a previewing date range.
319
+ * Set to `true` if the `day` is the start of a previewing date range.
320
320
  */
321
321
  isStartOfPreviewing: PropTypes.bool.isRequired,
322
322
  /**
@@ -239,6 +239,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
239
239
  * @default false
240
240
  */
241
241
  readOnly: PropTypes.bool,
242
+ /**
243
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
244
+ * For example, on time fields it will be used to determine the date to set.
245
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
246
+ */
247
+ referenceDate: PropTypes.any,
242
248
  /**
243
249
  * The currently selected sections.
244
250
  * This prop accept four formats:
@@ -272,6 +272,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
272
272
  * @default false
273
273
  */
274
274
  readOnly: PropTypes.bool,
275
+ /**
276
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
277
+ * For example, on time fields it will be used to determine the date to set.
278
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
279
+ */
280
+ referenceDate: PropTypes.any,
275
281
  /**
276
282
  * The currently selected sections.
277
283
  * This prop accept four formats:
@@ -256,6 +256,12 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
256
256
  * @default false
257
257
  */
258
258
  readOnly: PropTypes.bool,
259
+ /**
260
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
261
+ * For example, on time fields it will be used to determine the date to set.
262
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
263
+ */
264
+ referenceDate: PropTypes.any,
259
265
  /**
260
266
  * The currently selected sections.
261
267
  * This prop accept four formats:
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # @mui/x-date-pickers-pro
2
2
 
3
3
  This package is the commercial edition of the date and time picker components.
4
- It's part of MUI X, an open core extension of MUI, with advanced components.
4
+ It's part of MUI X, an open-core extension of MUI, with advanced components.
5
5
 
6
6
  ## Installation
7
7
 
@@ -12,7 +12,7 @@ npm install @mui/x-date-pickers-pro
12
12
  ```
13
13
 
14
14
  Then install the date library of your choice (if not already installed).
15
- We currently support 4 different date-libraries:
15
+ We currently support 4 different date libraries:
16
16
 
17
17
  - [date-fns](https://date-fns.org/)
18
18
  - [Day.js](https://day.js.org/)
@@ -37,12 +37,12 @@ This component has the following peer dependencies that you will need to install
37
37
  "@mui/base": "^5.0.0-alpha.87",
38
38
  "@mui/material": "^5.8.6",
39
39
  "@mui/system": "^5.8.0",
40
- "react": "^17.0.2 || ^18.0.0",
41
- "react-dom": "^17.0.2 || ^18.0.0"
40
+ "react": "^17.0.0 || ^18.0.0",
41
+ "react-dom": "^17.0.0 || ^18.0.0"
42
42
  },
43
43
  ```
44
44
 
45
- After installation completed, you have to set the `dateAdapter` prop of the `LocalizationProvider` accordingly.
45
+ After completing the installation, you have to set the `dateAdapter` prop of the `LocalizationProvider` accordingly.
46
46
  The supported adapters are exported from `@mui/x-date-pickers-pro`.
47
47
 
48
48
  ```js
@@ -230,6 +230,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
230
230
  * @default false
231
231
  */
232
232
  readOnly: PropTypes.bool,
233
+ /**
234
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
235
+ * For example, on time fields it will be used to determine the date to set.
236
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
237
+ */
238
+ referenceDate: PropTypes.any,
233
239
  /**
234
240
  * If `true`, the label is displayed as required and the `input` element is required.
235
241
  * @default false
@@ -11,7 +11,7 @@ export interface UseSingleInputDateRangeFieldProps<TDate> extends UseDateRangeFi
11
11
  }
12
12
  export type UseSingleInputDateRangeFieldDefaultizedProps<TDate, AdditionalProps extends {}> = UseDateRangeFieldDefaultizedProps<TDate> & AdditionalProps;
13
13
  export type UseSingleInputDateRangeFieldComponentProps<TDate, TChildProps extends {}> = Omit<TChildProps, keyof UseSingleInputDateRangeFieldProps<TDate>> & UseSingleInputDateRangeFieldProps<TDate>;
14
- export interface SingleInputDateRangeFieldProps<TDate> extends UseSingleInputDateRangeFieldComponentProps<TDate, FieldsTextFieldProps> {
14
+ export type SingleInputDateRangeFieldProps<TDate, TChildProps extends {} = FieldsTextFieldProps> = UseSingleInputDateRangeFieldComponentProps<TDate, TChildProps> & {
15
15
  /**
16
16
  * Overridable components.
17
17
  * @default {}
@@ -34,7 +34,7 @@ export interface SingleInputDateRangeFieldProps<TDate> extends UseSingleInputDat
34
34
  * @default {}
35
35
  */
36
36
  slotProps?: SingleInputDateRangeFieldSlotsComponentsProps<TDate>;
37
- }
37
+ };
38
38
  export type SingleInputDateRangeFieldOwnerState<TDate> = SingleInputDateRangeFieldProps<TDate>;
39
39
  export interface SingleInputDateRangeFieldSlotsComponent {
40
40
  /**
@@ -263,6 +263,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
263
263
  * @default false
264
264
  */
265
265
  readOnly: PropTypes.bool,
266
+ /**
267
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
268
+ * For example, on time fields it will be used to determine the date to set.
269
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
270
+ */
271
+ referenceDate: PropTypes.any,
266
272
  /**
267
273
  * If `true`, the label is displayed as required and the `input` element is required.
268
274
  * @default false
@@ -247,6 +247,12 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
247
247
  * @default false
248
248
  */
249
249
  readOnly: PropTypes.bool,
250
+ /**
251
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
252
+ * For example, on time fields it will be used to determine the date to set.
253
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
254
+ */
255
+ referenceDate: PropTypes.any,
250
256
  /**
251
257
  * If `true`, the label is displayed as required and the `input` element is required.
252
258
  * @default false
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
3
3
  import { DateRangeCalendarProps } from '../DateRangeCalendar';
4
4
  export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends DateRangeCalendarProps<TDate> {
@@ -10,4 +10,4 @@ export interface DateRangeViewRendererProps<TDate, TView extends DateOrTimeViewW
10
10
  * We don't pass all the props down to `DateRangeCalendar`,
11
11
  * because otherwise some unwanted props would be passed to the HTML element.
12
12
  */
13
- export declare const renderDateRangeViewCalendar: <TDate extends unknown>({ value, defaultValue, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, reduceAnimations, onMonthChange, defaultCalendarMonth, rangePosition, defaultRangePosition, onRangePositionChange, calendars, currentMonthCalendarPosition, components, componentsProps, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, disableAutoMonthSwitching, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, }: DateRangeViewRendererProps<TDate, any>) => JSX.Element;
13
+ export declare const renderDateRangeViewCalendar: <TDate extends unknown>({ value, defaultValue, onChange, className, classes, disableFuture, disablePast, minDate, maxDate, shouldDisableDate, reduceAnimations, onMonthChange, defaultCalendarMonth, rangePosition, defaultRangePosition, onRangePositionChange, calendars, currentMonthCalendarPosition, components, componentsProps, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, disableAutoMonthSwitching, sx, autoFocus, fixedWeekNumber, disableDragEditing, displayWeekNumber, }: DateRangeViewRendererProps<TDate, any>) => React.JSX.Element;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v6.5.0
2
+ * @mui/x-date-pickers-pro v6.7.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
3
3
  import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
4
4
  export declare const useDesktopRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TExternalProps>) => {
5
- renderPicker: () => JSX.Element;
5
+ renderPicker: () => React.JSX.Element;
6
6
  };
@@ -30,14 +30,14 @@ export interface RangePickerFieldSlotsComponent {
30
30
  TextField?: React.ElementType<TextFieldProps>;
31
31
  }
32
32
  export interface RangePickerFieldSlotsComponentsProps<TDate> {
33
- field?: SlotComponentProps<React.ElementType<BaseMultiInputFieldProps<DateRange<TDate>, RangeFieldSection, unknown>>, {}, UsePickerProps<DateRange<TDate>, any, RangeFieldSection, any, any, any>>;
33
+ field?: SlotComponentProps<React.ElementType<BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, unknown>>, {}, UsePickerProps<DateRange<TDate>, any, RangeFieldSection, any, any, any>>;
34
34
  fieldRoot?: SlotComponentProps<typeof Stack, {}, Record<string, any>>;
35
35
  fieldSeparator?: SlotComponentProps<typeof Typography, {}, Record<string, any>>;
36
36
  textField?: SlotComponentProps<typeof TextField, {}, UseDateRangeFieldProps<TDate> & {
37
37
  position?: RangePosition;
38
38
  }>;
39
39
  }
40
- export interface UseEnrichedRangePickerFieldPropsParams<TDate, TView extends DateOrTimeViewWithMeridiem, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, RangeFieldSection, TError> = BaseFieldProps<DateRange<TDate>, RangeFieldSection, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
40
+ export interface UseEnrichedRangePickerFieldPropsParams<TDate, TView extends DateOrTimeViewWithMeridiem, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> = BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
41
41
  wrapperVariant: WrapperVariant;
42
42
  fieldType: 'single-input' | 'multi-input';
43
43
  readOnly?: boolean;
@@ -51,4 +51,4 @@ export interface UseEnrichedRangePickerFieldPropsParams<TDate, TView extends Dat
51
51
  pickerSlots: UncapitalizeObjectKeys<RangePickerFieldSlotsComponent> | undefined;
52
52
  fieldProps: FieldProps;
53
53
  }
54
- export declare const useEnrichedRangePickerFieldProps: <TDate, TView extends DateOrTimeViewWithMeridiem, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TError, BaseFieldProps<DateRange<TDate>, RangeFieldSection, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, RangeFieldSection, TError> | BaseSingleInputFieldProps<DateRange<TDate>, RangeFieldSection, TError>;
54
+ export declare const useEnrichedRangePickerFieldProps: <TDate, TView extends DateOrTimeViewWithMeridiem, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TError, BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> | BaseSingleInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
3
3
  import { UseMobileRangePickerParams, UseMobileRangePickerProps } from './useMobileRangePicker.types';
4
4
  export declare const useMobileRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TExternalProps>) => {
5
- renderPicker: () => JSX.Element;
5
+ renderPicker: () => React.JSX.Element;
6
6
  };
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals/models';
3
3
  import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStaticRangePicker.types';
4
4
  /**
@@ -6,5 +6,5 @@ import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStat
6
6
  * - StaticDateRangePicker
7
7
  */
8
8
  export declare const useStaticRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ref, ...pickerParams }: UseStaticRangePickerParams<TDate, TView, TExternalProps>) => {
9
- renderPicker: () => JSX.Element;
9
+ renderPicker: () => React.JSX.Element;
10
10
  };
@@ -25,6 +25,6 @@ export interface BaseRangeProps {
25
25
  */
26
26
  disabled?: boolean;
27
27
  }
28
- export interface UseDateRangeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, RangeFieldSection, DateRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate>, BaseRangeProps {
28
+ export interface UseDateRangeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, DateRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate>, BaseRangeProps {
29
29
  }
30
30
  export type UseDateRangeFieldDefaultizedProps<TDate> = DefaultizedProps<UseDateRangeFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format'>;
@@ -3,7 +3,7 @@ import { BaseRangeProps, DayRangeValidationProps } from './dateRange';
3
3
  import { DateRange } from './range';
4
4
  import { DateTimeRangeValidationError } from '../../models';
5
5
  import { RangeFieldSection } from './fields';
6
- export interface UseDateTimeRangeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, RangeFieldSection, DateTimeRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate>, BaseRangeProps {
6
+ export interface UseDateTimeRangeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, DateTimeRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate>, BaseRangeProps {
7
7
  /**
8
8
  * 12h/24h view for hour selection clock.
9
9
  * @default `utils.is12HourCycleInCurrentLocale()`
@@ -28,7 +28,7 @@ export interface MultiInputFieldSlotRootProps {
28
28
  * Props the multi input field can receive when used inside a picker.
29
29
  * Only contains what the MUI component are passing to the field, not what users can pass using the `props.slotProps.field`.
30
30
  */
31
- export interface BaseMultiInputFieldProps<TValue, TSection extends FieldSection, TError> extends BaseFieldProps<TValue, TSection, TError> {
31
+ export interface BaseMultiInputFieldProps<TValue, TDate, TSection extends FieldSection, TError> extends BaseFieldProps<TValue, TDate, TSection, TError> {
32
32
  slots?: {
33
33
  root?: React.ElementType;
34
34
  separator?: React.ElementType;
@@ -3,7 +3,7 @@ import { DateRange } from './range';
3
3
  import { TimeRangeValidationError } from '../../models';
4
4
  import { BaseRangeProps } from './dateRange';
5
5
  import { RangeFieldSection } from './fields';
6
- export interface UseTimeRangeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, RangeFieldSection, TimeRangeValidationError>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps, BaseRangeProps {
6
+ export interface UseTimeRangeFieldProps<TDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TimeRangeValidationError>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps, BaseRangeProps {
7
7
  /**
8
8
  * 12h/24h view for hour selection clock.
9
9
  * @default `utils.is12HourCycleInCurrentLocale()`
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY4NDQ0MzYwMDAwMA==";
3
+ const releaseInfo = "MTY4NjI2MTYwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -1,14 +1,38 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual } from '@mui/x-date-pickers/internals';
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["value", "referenceDate"];
4
+ import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual, getTodayDate, getDefaultReferenceDate } from '@mui/x-date-pickers/internals';
3
5
  import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
4
6
  export const rangeValueManager = {
5
7
  emptyValue: [null, null],
6
- getTodayValue: (utils, valueType) => valueType === 'date' ? [utils.startOfDay(utils.date()), utils.startOfDay(utils.date())] : [utils.date(), utils.date()],
8
+ getTodayValue: (utils, valueType) => [getTodayDate(utils, valueType), getTodayDate(utils, valueType)],
9
+ getInitialReferenceValue: _ref => {
10
+ let {
11
+ value,
12
+ referenceDate: referenceDateProp
13
+ } = _ref,
14
+ params = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+ const shouldKeepStartDate = value[0] != null && params.utils.isValid(value[0]);
16
+ const shouldKeepEndDate = value[1] != null && params.utils.isValid(value[1]);
17
+ if (shouldKeepStartDate && shouldKeepEndDate) {
18
+ return value;
19
+ }
20
+ const referenceDate = referenceDateProp != null ? referenceDateProp : getDefaultReferenceDate(params);
21
+ return [shouldKeepStartDate ? value[0] : referenceDate, shouldKeepEndDate ? value[1] : referenceDate];
22
+ },
7
23
  cleanValue: (utils, value) => value.map(date => replaceInvalidDateByNull(utils, date)),
8
24
  areValuesEqual: (utils, a, b) => areDatesEqual(utils, a[0], b[0]) && areDatesEqual(utils, a[1], b[1]),
9
25
  isSameError: (a, b) => b !== null && a[1] === b[1] && a[0] === b[0],
10
26
  hasError: error => error[0] != null || error[1] != null,
11
- defaultErrorState: [null, null]
27
+ defaultErrorState: [null, null],
28
+ getTimezone: (utils, value) => {
29
+ const timezoneStart = value[0] == null ? null : utils.getTimezone(value[0]);
30
+ const timezoneEnd = value[1] == null ? null : utils.getTimezone(value[1]);
31
+ if (timezoneStart != null && timezoneEnd != null && timezoneStart !== timezoneEnd) {
32
+ throw new Error('MUI: The timezone of the start and the end date should be the same');
33
+ }
34
+ return timezoneStart != null ? timezoneStart : timezoneEnd;
35
+ }
12
36
  };
13
37
  export const rangeFieldValueManager = {
14
38
  updateReferenceValue: (utils, value, prevReferenceValue) => {
@@ -268,7 +268,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
268
268
  */
269
269
  isEndOfHighlighting: PropTypes.bool.isRequired,
270
270
  /**
271
- * Set to `true` if the `day` is the start of a previewing date range.
271
+ * Set to `true` if the `day` is the end of a previewing date range.
272
272
  */
273
273
  isEndOfPreviewing: PropTypes.bool.isRequired,
274
274
  /**
@@ -294,7 +294,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
294
294
  */
295
295
  isStartOfHighlighting: PropTypes.bool.isRequired,
296
296
  /**
297
- * Set to `true` if the `day` is the end of a previewing date range.
297
+ * Set to `true` if the `day` is the start of a previewing date range.
298
298
  */
299
299
  isStartOfPreviewing: PropTypes.bool.isRequired,
300
300
  /**
@@ -238,6 +238,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
238
238
  * @default false
239
239
  */
240
240
  readOnly: PropTypes.bool,
241
+ /**
242
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
243
+ * For example, on time fields it will be used to determine the date to set.
244
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
245
+ */
246
+ referenceDate: PropTypes.any,
241
247
  /**
242
248
  * The currently selected sections.
243
249
  * This prop accept four formats:
@@ -271,6 +271,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
271
271
  * @default false
272
272
  */
273
273
  readOnly: PropTypes.bool,
274
+ /**
275
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
276
+ * For example, on time fields it will be used to determine the date to set.
277
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
278
+ */
279
+ referenceDate: PropTypes.any,
274
280
  /**
275
281
  * The currently selected sections.
276
282
  * This prop accept four formats:
@@ -255,6 +255,12 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
255
255
  * @default false
256
256
  */
257
257
  readOnly: PropTypes.bool,
258
+ /**
259
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
260
+ * For example, on time fields it will be used to determine the date to set.
261
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
262
+ */
263
+ referenceDate: PropTypes.any,
258
264
  /**
259
265
  * The currently selected sections.
260
266
  * This prop accept four formats:
@@ -224,6 +224,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
224
224
  * @default false
225
225
  */
226
226
  readOnly: PropTypes.bool,
227
+ /**
228
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
229
+ * For example, on time fields it will be used to determine the date to set.
230
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
231
+ */
232
+ referenceDate: PropTypes.any,
227
233
  /**
228
234
  * If `true`, the label is displayed as required and the `input` element is required.
229
235
  * @default false
@@ -257,6 +257,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
257
257
  * @default false
258
258
  */
259
259
  readOnly: PropTypes.bool,
260
+ /**
261
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
262
+ * For example, on time fields it will be used to determine the date to set.
263
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
264
+ */
265
+ referenceDate: PropTypes.any,
260
266
  /**
261
267
  * If `true`, the label is displayed as required and the `input` element is required.
262
268
  * @default false
@@ -241,6 +241,12 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
241
241
  * @default false
242
242
  */
243
243
  readOnly: PropTypes.bool,
244
+ /**
245
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
246
+ * For example, on time fields it will be used to determine the date to set.
247
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
248
+ */
249
+ referenceDate: PropTypes.any,
244
250
  /**
245
251
  * If `true`, the label is displayed as required and the `input` element is required.
246
252
  * @default false
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v6.5.0
2
+ * @mui/x-date-pickers-pro v6.7.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY4NDQ0MzYwMDAwMA==";
3
+ var releaseInfo = "MTY4NjI2MTYwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -1,12 +1,26 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual } from '@mui/x-date-pickers/internals';
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
+ var _excluded = ["value", "referenceDate"];
6
+ import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual, getTodayDate, getDefaultReferenceDate } from '@mui/x-date-pickers/internals';
5
7
  import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
6
8
  export var rangeValueManager = {
7
9
  emptyValue: [null, null],
8
10
  getTodayValue: function getTodayValue(utils, valueType) {
9
- return valueType === 'date' ? [utils.startOfDay(utils.date()), utils.startOfDay(utils.date())] : [utils.date(), utils.date()];
11
+ return [getTodayDate(utils, valueType), getTodayDate(utils, valueType)];
12
+ },
13
+ getInitialReferenceValue: function getInitialReferenceValue(_ref) {
14
+ var value = _ref.value,
15
+ referenceDateProp = _ref.referenceDate,
16
+ params = _objectWithoutProperties(_ref, _excluded);
17
+ var shouldKeepStartDate = value[0] != null && params.utils.isValid(value[0]);
18
+ var shouldKeepEndDate = value[1] != null && params.utils.isValid(value[1]);
19
+ if (shouldKeepStartDate && shouldKeepEndDate) {
20
+ return value;
21
+ }
22
+ var referenceDate = referenceDateProp != null ? referenceDateProp : getDefaultReferenceDate(params);
23
+ return [shouldKeepStartDate ? value[0] : referenceDate, shouldKeepEndDate ? value[1] : referenceDate];
10
24
  },
11
25
  cleanValue: function cleanValue(utils, value) {
12
26
  return value.map(function (date) {
@@ -22,7 +36,15 @@ export var rangeValueManager = {
22
36
  hasError: function hasError(error) {
23
37
  return error[0] != null || error[1] != null;
24
38
  },
25
- defaultErrorState: [null, null]
39
+ defaultErrorState: [null, null],
40
+ getTimezone: function getTimezone(utils, value) {
41
+ var timezoneStart = value[0] == null ? null : utils.getTimezone(value[0]);
42
+ var timezoneEnd = value[1] == null ? null : utils.getTimezone(value[1]);
43
+ if (timezoneStart != null && timezoneEnd != null && timezoneStart !== timezoneEnd) {
44
+ throw new Error('MUI: The timezone of the start and the end date should be the same');
45
+ }
46
+ return timezoneStart != null ? timezoneStart : timezoneEnd;
47
+ }
26
48
  };
27
49
  export var rangeFieldValueManager = {
28
50
  updateReferenceValue: function updateReferenceValue(utils, value, prevReferenceValue) {
@@ -39,10 +61,10 @@ export var rangeFieldValueManager = {
39
61
  }
40
62
  return [prevReferenceValue[1], value[1]];
41
63
  },
42
- getSectionsFromValue: function getSectionsFromValue(utils, _ref, fallbackSections, isRTL, getSectionsFromDate) {
43
- var _ref2 = _slicedToArray(_ref, 2),
44
- start = _ref2[0],
45
- end = _ref2[1];
64
+ getSectionsFromValue: function getSectionsFromValue(utils, _ref2, fallbackSections, isRTL, getSectionsFromDate) {
65
+ var _ref3 = _slicedToArray(_ref2, 2),
66
+ start = _ref3[0],
67
+ end = _ref3[1];
46
68
  var separatedFallbackSections = fallbackSections == null ? {
47
69
  startDate: null,
48
70
  endDate: null
@@ -290,7 +290,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
290
290
  */
291
291
  isEndOfHighlighting: PropTypes.bool.isRequired,
292
292
  /**
293
- * Set to `true` if the `day` is the start of a previewing date range.
293
+ * Set to `true` if the `day` is the end of a previewing date range.
294
294
  */
295
295
  isEndOfPreviewing: PropTypes.bool.isRequired,
296
296
  /**
@@ -316,7 +316,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
316
316
  */
317
317
  isStartOfHighlighting: PropTypes.bool.isRequired,
318
318
  /**
319
- * Set to `true` if the `day` is the end of a previewing date range.
319
+ * Set to `true` if the `day` is the start of a previewing date range.
320
320
  */
321
321
  isStartOfPreviewing: PropTypes.bool.isRequired,
322
322
  /**
@@ -235,6 +235,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
235
235
  * @default false
236
236
  */
237
237
  readOnly: PropTypes.bool,
238
+ /**
239
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
240
+ * For example, on time fields it will be used to determine the date to set.
241
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
242
+ */
243
+ referenceDate: PropTypes.any,
238
244
  /**
239
245
  * The currently selected sections.
240
246
  * This prop accept four formats:
@@ -268,6 +268,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
268
268
  * @default false
269
269
  */
270
270
  readOnly: PropTypes.bool,
271
+ /**
272
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
273
+ * For example, on time fields it will be used to determine the date to set.
274
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
275
+ */
276
+ referenceDate: PropTypes.any,
271
277
  /**
272
278
  * The currently selected sections.
273
279
  * This prop accept four formats:
@@ -252,6 +252,12 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
252
252
  * @default false
253
253
  */
254
254
  readOnly: PropTypes.bool,
255
+ /**
256
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
257
+ * For example, on time fields it will be used to determine the date to set.
258
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
259
+ */
260
+ referenceDate: PropTypes.any,
255
261
  /**
256
262
  * The currently selected sections.
257
263
  * This prop accept four formats:
@@ -229,6 +229,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
229
229
  * @default false
230
230
  */
231
231
  readOnly: PropTypes.bool,
232
+ /**
233
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
234
+ * For example, on time fields it will be used to determine the date to set.
235
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
236
+ */
237
+ referenceDate: PropTypes.any,
232
238
  /**
233
239
  * If `true`, the label is displayed as required and the `input` element is required.
234
240
  * @default false
@@ -262,6 +262,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
262
262
  * @default false
263
263
  */
264
264
  readOnly: PropTypes.bool,
265
+ /**
266
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
267
+ * For example, on time fields it will be used to determine the date to set.
268
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
269
+ */
270
+ referenceDate: PropTypes.any,
265
271
  /**
266
272
  * If `true`, the label is displayed as required and the `input` element is required.
267
273
  * @default false
@@ -246,6 +246,12 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
246
246
  * @default false
247
247
  */
248
248
  readOnly: PropTypes.bool,
249
+ /**
250
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
251
+ * For example, on time fields it will be used to determine the date to set.
252
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
253
+ */
254
+ referenceDate: PropTypes.any,
249
255
  /**
250
256
  * If `true`, the label is displayed as required and the `input` element is required.
251
257
  * @default false
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v6.5.0
2
+ * @mui/x-date-pickers-pro v6.7.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY4NDQ0MzYwMDAwMA==";
3
+ const releaseInfo = "MTY4NjI2MTYwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -1,14 +1,38 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual } from '@mui/x-date-pickers/internals';
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["value", "referenceDate"];
4
+ import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual, getTodayDate, getDefaultReferenceDate } from '@mui/x-date-pickers/internals';
3
5
  import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
4
6
  export const rangeValueManager = {
5
7
  emptyValue: [null, null],
6
- getTodayValue: (utils, valueType) => valueType === 'date' ? [utils.startOfDay(utils.date()), utils.startOfDay(utils.date())] : [utils.date(), utils.date()],
8
+ getTodayValue: (utils, valueType) => [getTodayDate(utils, valueType), getTodayDate(utils, valueType)],
9
+ getInitialReferenceValue: _ref => {
10
+ let {
11
+ value,
12
+ referenceDate: referenceDateProp
13
+ } = _ref,
14
+ params = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+ const shouldKeepStartDate = value[0] != null && params.utils.isValid(value[0]);
16
+ const shouldKeepEndDate = value[1] != null && params.utils.isValid(value[1]);
17
+ if (shouldKeepStartDate && shouldKeepEndDate) {
18
+ return value;
19
+ }
20
+ const referenceDate = referenceDateProp ?? getDefaultReferenceDate(params);
21
+ return [shouldKeepStartDate ? value[0] : referenceDate, shouldKeepEndDate ? value[1] : referenceDate];
22
+ },
7
23
  cleanValue: (utils, value) => value.map(date => replaceInvalidDateByNull(utils, date)),
8
24
  areValuesEqual: (utils, a, b) => areDatesEqual(utils, a[0], b[0]) && areDatesEqual(utils, a[1], b[1]),
9
25
  isSameError: (a, b) => b !== null && a[1] === b[1] && a[0] === b[0],
10
26
  hasError: error => error[0] != null || error[1] != null,
11
- defaultErrorState: [null, null]
27
+ defaultErrorState: [null, null],
28
+ getTimezone: (utils, value) => {
29
+ const timezoneStart = value[0] == null ? null : utils.getTimezone(value[0]);
30
+ const timezoneEnd = value[1] == null ? null : utils.getTimezone(value[1]);
31
+ if (timezoneStart != null && timezoneEnd != null && timezoneStart !== timezoneEnd) {
32
+ throw new Error('MUI: The timezone of the start and the end date should be the same');
33
+ }
34
+ return timezoneStart ?? timezoneEnd;
35
+ }
12
36
  };
13
37
  export const rangeFieldValueManager = {
14
38
  updateReferenceValue: (utils, value, prevReferenceValue) => {
@@ -299,7 +299,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
299
299
  */
300
300
  isEndOfHighlighting: _propTypes.default.bool.isRequired,
301
301
  /**
302
- * Set to `true` if the `day` is the start of a previewing date range.
302
+ * Set to `true` if the `day` is the end of a previewing date range.
303
303
  */
304
304
  isEndOfPreviewing: _propTypes.default.bool.isRequired,
305
305
  /**
@@ -325,7 +325,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerDayRaw.propTypes = {
325
325
  */
326
326
  isStartOfHighlighting: _propTypes.default.bool.isRequired,
327
327
  /**
328
- * Set to `true` if the `day` is the end of a previewing date range.
328
+ * Set to `true` if the `day` is the start of a previewing date range.
329
329
  */
330
330
  isStartOfPreviewing: _propTypes.default.bool.isRequired,
331
331
  /**
@@ -244,6 +244,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
244
244
  * @default false
245
245
  */
246
246
  readOnly: _propTypes.default.bool,
247
+ /**
248
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
249
+ * For example, on time fields it will be used to determine the date to set.
250
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
251
+ */
252
+ referenceDate: _propTypes.default.any,
247
253
  /**
248
254
  * The currently selected sections.
249
255
  * This prop accept four formats:
@@ -277,6 +277,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
277
277
  * @default false
278
278
  */
279
279
  readOnly: _propTypes.default.bool,
280
+ /**
281
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
282
+ * For example, on time fields it will be used to determine the date to set.
283
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
284
+ */
285
+ referenceDate: _propTypes.default.any,
280
286
  /**
281
287
  * The currently selected sections.
282
288
  * This prop accept four formats:
@@ -261,6 +261,12 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
261
261
  * @default false
262
262
  */
263
263
  readOnly: _propTypes.default.bool,
264
+ /**
265
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
266
+ * For example, on time fields it will be used to determine the date to set.
267
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
268
+ */
269
+ referenceDate: _propTypes.default.any,
264
270
  /**
265
271
  * The currently selected sections.
266
272
  * This prop accept four formats:
@@ -239,6 +239,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
239
239
  * @default false
240
240
  */
241
241
  readOnly: _propTypes.default.bool,
242
+ /**
243
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
244
+ * For example, on time fields it will be used to determine the date to set.
245
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
246
+ */
247
+ referenceDate: _propTypes.default.any,
242
248
  /**
243
249
  * If `true`, the label is displayed as required and the `input` element is required.
244
250
  * @default false
@@ -272,6 +272,12 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
272
272
  * @default false
273
273
  */
274
274
  readOnly: _propTypes.default.bool,
275
+ /**
276
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
277
+ * For example, on time fields it will be used to determine the date to set.
278
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
279
+ */
280
+ referenceDate: _propTypes.default.any,
275
281
  /**
276
282
  * If `true`, the label is displayed as required and the `input` element is required.
277
283
  * @default false
@@ -256,6 +256,12 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
256
256
  * @default false
257
257
  */
258
258
  readOnly: _propTypes.default.bool,
259
+ /**
260
+ * The date used to generate a part of the date-time that is not present in the format when both `value` and `defaultValue` are not present.
261
+ * For example, on time fields it will be used to determine the date to set.
262
+ * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
263
+ */
264
+ referenceDate: _propTypes.default.any,
259
265
  /**
260
266
  * If `true`, the label is displayed as required and the `input` element is required.
261
267
  * @default false
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v6.5.0
2
+ * @mui/x-date-pickers-pro v6.7.0
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getReleaseInfo = void 0;
7
7
  var _utils = require("@mui/utils");
8
8
  const getReleaseInfo = () => {
9
- const releaseInfo = "MTY4NDQ0MzYwMDAwMA==";
9
+ const releaseInfo = "MTY4NjI2MTYwMDAwMA==";
10
10
  if (process.env.NODE_ENV !== 'production') {
11
11
  // A simple hack to set the value in the test environment (has no build step).
12
12
  // eslint-disable-next-line no-useless-concat
@@ -6,16 +6,40 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.rangeValueManager = exports.rangeFieldValueManager = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
10
  var _internals = require("@mui/x-date-pickers/internals");
10
11
  var _dateFieldsUtils = require("./date-fields-utils");
12
+ const _excluded = ["value", "referenceDate"];
11
13
  const rangeValueManager = {
12
14
  emptyValue: [null, null],
13
- getTodayValue: (utils, valueType) => valueType === 'date' ? [utils.startOfDay(utils.date()), utils.startOfDay(utils.date())] : [utils.date(), utils.date()],
15
+ getTodayValue: (utils, valueType) => [(0, _internals.getTodayDate)(utils, valueType), (0, _internals.getTodayDate)(utils, valueType)],
16
+ getInitialReferenceValue: _ref => {
17
+ let {
18
+ value,
19
+ referenceDate: referenceDateProp
20
+ } = _ref,
21
+ params = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
22
+ const shouldKeepStartDate = value[0] != null && params.utils.isValid(value[0]);
23
+ const shouldKeepEndDate = value[1] != null && params.utils.isValid(value[1]);
24
+ if (shouldKeepStartDate && shouldKeepEndDate) {
25
+ return value;
26
+ }
27
+ const referenceDate = referenceDateProp ?? (0, _internals.getDefaultReferenceDate)(params);
28
+ return [shouldKeepStartDate ? value[0] : referenceDate, shouldKeepEndDate ? value[1] : referenceDate];
29
+ },
14
30
  cleanValue: (utils, value) => value.map(date => (0, _internals.replaceInvalidDateByNull)(utils, date)),
15
31
  areValuesEqual: (utils, a, b) => (0, _internals.areDatesEqual)(utils, a[0], b[0]) && (0, _internals.areDatesEqual)(utils, a[1], b[1]),
16
32
  isSameError: (a, b) => b !== null && a[1] === b[1] && a[0] === b[0],
17
33
  hasError: error => error[0] != null || error[1] != null,
18
- defaultErrorState: [null, null]
34
+ defaultErrorState: [null, null],
35
+ getTimezone: (utils, value) => {
36
+ const timezoneStart = value[0] == null ? null : utils.getTimezone(value[0]);
37
+ const timezoneEnd = value[1] == null ? null : utils.getTimezone(value[1]);
38
+ if (timezoneStart != null && timezoneEnd != null && timezoneStart !== timezoneEnd) {
39
+ throw new Error('MUI: The timezone of the start and the end date should be the same');
40
+ }
41
+ return timezoneStart ?? timezoneEnd;
42
+ }
19
43
  };
20
44
  exports.rangeValueManager = rangeValueManager;
21
45
  const rangeFieldValueManager = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-date-pickers-pro",
3
- "version": "6.5.0",
3
+ "version": "6.7.0",
4
4
  "description": "The commercial edition of the date picker components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.21.0",
34
- "@mui/utils": "^5.12.3",
35
- "@mui/x-date-pickers": "6.5.0",
36
- "@mui/x-license-pro": "6.0.4",
34
+ "@mui/utils": "^5.13.1",
35
+ "@mui/x-date-pickers": "6.7.0",
36
+ "@mui/x-license-pro": "6.6.0",
37
37
  "clsx": "^1.2.1",
38
38
  "prop-types": "^15.8.1",
39
39
  "react-transition-group": "^4.4.5"
@@ -51,8 +51,8 @@
51
51
  "moment": "^2.29.4",
52
52
  "moment-hijri": "^2.1.2",
53
53
  "moment-jalaali": "^0.7.4 || ^0.8.0 || ^0.9.0 || ^0.10.0",
54
- "react": "^17.0.2 || ^18.0.0",
55
- "react-dom": "^17.0.2 || ^18.0.0"
54
+ "react": "^17.0.0 || ^18.0.0",
55
+ "react-dom": "^17.0.0 || ^18.0.0"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "@emotion/react": {