@mui/x-date-pickers-pro 6.4.0 → 6.6.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 (89) hide show
  1. package/CHANGELOG.md +134 -2
  2. package/DateRangeCalendar/DateRangeCalendar.js +20 -5
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +5 -0
  4. package/DateRangePicker/DateRangePicker.js +5 -0
  5. package/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -0
  6. package/MobileDateRangePicker/MobileDateRangePicker.js +5 -0
  7. package/MultiInputDateRangeField/MultiInputDateRangeField.js +23 -39
  8. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +20 -54
  9. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +20 -44
  10. package/README.md +5 -5
  11. package/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  12. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +2 -2
  13. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  14. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +9 -43
  15. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  16. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  17. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +9 -53
  18. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  19. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  20. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +9 -45
  21. package/StaticDateRangePicker/StaticDateRangePicker.js +5 -0
  22. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  23. package/dateRangeViewRenderers/dateRangeViewRenderers.js +2 -0
  24. package/index.js +1 -1
  25. package/internal/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -2
  26. package/internal/hooks/useEnrichedRangePickerFieldProps.d.ts +3 -3
  27. package/internal/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -2
  28. package/internal/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -2
  29. package/internal/models/dateRange.d.ts +1 -1
  30. package/internal/models/dateTimeRange.d.ts +1 -1
  31. package/internal/models/fields.d.ts +1 -1
  32. package/internal/models/timeRange.d.ts +1 -1
  33. package/internal/utils/releaseInfo.js +1 -1
  34. package/internal/utils/valueManagers.js +27 -3
  35. package/legacy/DateRangeCalendar/DateRangeCalendar.js +18 -4
  36. package/legacy/DateRangePicker/DateRangePicker.js +5 -0
  37. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -0
  38. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +5 -0
  39. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +26 -43
  40. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +24 -59
  41. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +24 -49
  42. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  43. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +8 -41
  44. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  45. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +8 -53
  46. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  47. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +8 -43
  48. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +5 -0
  49. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +2 -0
  50. package/legacy/index.js +1 -1
  51. package/legacy/internal/utils/releaseInfo.js +1 -1
  52. package/legacy/internal/utils/valueManagers.js +29 -7
  53. package/modern/DateRangeCalendar/DateRangeCalendar.js +20 -5
  54. package/modern/DateRangePicker/DateRangePicker.js +5 -0
  55. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -0
  56. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +5 -0
  57. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +23 -39
  58. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +20 -54
  59. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +20 -44
  60. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  61. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +9 -43
  62. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  63. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +9 -53
  64. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  65. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +9 -45
  66. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +5 -0
  67. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +2 -0
  68. package/modern/index.js +1 -1
  69. package/modern/internal/utils/releaseInfo.js +1 -1
  70. package/modern/internal/utils/valueManagers.js +27 -3
  71. package/node/DateRangeCalendar/DateRangeCalendar.js +19 -4
  72. package/node/DateRangePicker/DateRangePicker.js +5 -0
  73. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +5 -0
  74. package/node/MobileDateRangePicker/MobileDateRangePicker.js +5 -0
  75. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -38
  76. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +19 -53
  77. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +19 -43
  78. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -0
  79. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +8 -42
  80. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +6 -0
  81. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +8 -52
  82. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -0
  83. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +8 -44
  84. package/node/StaticDateRangePicker/StaticDateRangePicker.js +5 -0
  85. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +2 -0
  86. package/node/index.js +1 -1
  87. package/node/internal/utils/releaseInfo.js +1 -1
  88. package/node/internal/utils/valueManagers.js +26 -2
  89. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -3,6 +3,138 @@
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.6.0
7
+
8
+ _Jun 1, 2023_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 New date time picking UI on [`DesktopDateTimePicker`](https://mui.com/x/react-date-pickers/date-time-picker/)
13
+
14
+ <img src="https://user-images.githubusercontent.com/4941090/242533399-2b106390-8158-4aba-9ca4-b621c6310977.gif" width="628" />
15
+
16
+ - 🚀 Performance improvements
17
+ - 🐞 Bugfixes
18
+ - 📚 Documentation improvements
19
+ - 🌍 Improve Dutch (nl-NL) and French (fr-FR) locales on the data grid
20
+ - 🌍 Add Vietnamese (vi-VN) locale on the pickers
21
+
22
+ ### `@mui/x-data-grid@v6.6.0` / `@mui/x-data-grid-pro@v6.6.0` / `@mui/x-data-grid-premium@v6.6.0`
23
+
24
+ #### Changes
25
+
26
+ - [DataGrid] Support data attributes (#8845) @romgrk
27
+ - [DataGrid] Avoid allocations in `hydrateRowsMeta` (#9121) @romgrk
28
+ - [DataGrid] Fix filter input select accessibility (#9018) @Jul13nT
29
+ - [DataGrid] Fix accessibility issues in panels and toolbar buttons (#8862) @romgrk
30
+ - [DataGrid] Fix `onCellEditStop` not invoked (#8857) @romgrk
31
+ - [DataGridPro] Fix auto-scroll when reordering columns (#8856) @m4theushw
32
+ - [DataGridPro] Fix row ID type casting in detail panels lookup (#8976) @minchaej
33
+ - [DataGridPro] Emit `columnWidthChange` event on `touchEnd` of column resize (#8669) @MBilalShafi
34
+ - [DataGridPro] Do not apply filters on `rowExpansionChange` (#8671) @cherniavskii
35
+ - [DataGridPro] Prevent click event on sorting after a resize (#9117) @romgrk
36
+ - [DataGridPremium] Improve Excel export interface (#9128) @TiagoPortfolio
37
+ - [l10n] Improve Dutch (nl-NL) locale (#9043) @thedutchruben
38
+ - [l10n] Improve French (fr-FR) locale (#9109) @Jul13nT
39
+
40
+ ### `@mui/x-date-pickers@v6.6.0` / `@mui/x-date-pickers-pro@v6.6.0`
41
+
42
+ #### Changes
43
+
44
+ - [fields] Allow to explicitly define the reference value and improve its default value (#9019) @flaviendelangle
45
+ - [l10n] Add Vietnamese (vi-VN) locale (#9099) @nhannt201
46
+ - [pickers] Add `DigitalClock` to `DesktopDateTimePicker` (#8946) @LukasTy
47
+ - [pickers] Add support for timezones on the adapters (#9068) @flaviendelangle
48
+ - [pickers] Fix `MonthCalendar` and `YearCalendar` disabled validation (#9149) @LukasTy
49
+ - [pickers] Fix bug when fields have a unique section (#9110) @alexfauquette
50
+ - [pickers] Fix focus jumping on Safari (#9072) @LukasTy
51
+ - [pickers] Use the locale start of the week in `getWeekArray` (#9176) @flaviendelangle
52
+
53
+ ### Docs
54
+
55
+ - [docs] Add single input range picker demo (#9159) @LukasTy
56
+ - [docs] Align `DateCalendar` demo views with labels (#9152) @LukasTy
57
+ - [docs] Clarify the peer dependency with React (#9067) @oliviertassinari
58
+ - [docs] Fix Norwegian locale typo (#9168) @LukasTy
59
+ - [docs] Fix column menu item demo (#9071) @MBilalShafi
60
+ - [docs] Improve localization table progress bars (#9033) @noraleonte
61
+ - [docs] Smooth performance animation (#8986) @oliviertassinari
62
+ - [docs] Use responsive time and date time pickers and the views sections (#9127) @flaviendelangle
63
+ - [docs] Reduce layout shift in grid demo (#9132) @oliviertassinari
64
+ - [docs] Fix tree data children lazy-loading demo (#8840) @yaredtsy
65
+ - [docs] Improve filtering docs discoverability (#9074) @MBilalShafi
66
+
67
+ ### Core
68
+
69
+ - [core] Allow string literals as keys in `localesText` (#9045) @MBilalShafi
70
+ - [core] Fix `randomInt` producing values exceeding `max` value (#9086) @cherniavskii
71
+ - [core] Fix flaky test on `dateWithTimezone` adapter test (#9129) @flaviendelangle
72
+ - [core] Lock `@types/node` on v18 (#9107) @LukasTy
73
+ - [core] Remove `cross-fetch` dependency (#9108) @LukasTy
74
+ - [core] Remove `createDetectElementResize()` replaced with `ResizeObserver` (#9015) @oliviertassinari
75
+ - [core] Upgrade monorepo (#9027) @m4theushw
76
+ - [core] Upgrade monorepo (#9106) @LukasTy
77
+ - [charts] Fix proptypes (#9125) @LukasTy
78
+ - [charts] Generate the charts proptypes (#9010) @alexfauquette
79
+ - [charts] Manage series stacking (#8888) @alexfauquette
80
+ - [license] List side effects in the license package (#9092) @cherniavskii
81
+
82
+ ## v6.5.0
83
+
84
+ _May 19, 2023_
85
+
86
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
87
+
88
+ - 💫 Introduce filtering on column headers for `DataGridPro` and `DataGridPremium`:
89
+
90
+ https://github.com/mui/mui-x/assets/12609561/c4c2bfec-59cf-4cab-932d-dc1983081de9
91
+
92
+ See [the documentation](https://mui.com/x/react-data-grid/filtering/#header-filters) for more information
93
+
94
+ - 🌍 Improve Hebrew (he-IL) and Czech (cs-CZ) locales
95
+ - 📝 Support for editing on pinned rows
96
+ - 🚀 Performance improvements
97
+ - 🐞 Bugfixes
98
+ - 📚 Documentation improvements
99
+
100
+ ### `@mui/x-data-grid@6.5.0` / `@mui/x-data-grid-pro@6.5.0` / `@mui/x-data-grid-premium@6.5.0`
101
+
102
+ #### Changes
103
+
104
+ - [DataGrid] Fix grid size calculation when `.MuiDataGrid-main` has border (#8882) @cherniavskii
105
+ - [DataGridPro] Filtering on Column Header (#7760) @MBilalShafi
106
+ - [DataGridPro] Improve `treeData` and `rowGrouping` performance (#8990) @MBilalShafi
107
+ - [DataGridPro] Support pinned rows editing (#8921) @cherniavskii
108
+ - [l10n] Improve Hebrew (he-IL) locale (#8943) @Itzik-Tech
109
+ - [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
110
+ - [l10n] Improve Czech (cs-CZ) locale (#8956) @davidzemancz
111
+
112
+ ### `@mui/x-date-pickers@6.5.0` / `@mui/x-date-pickers-pro@6.5.0`
113
+
114
+ #### Changes
115
+
116
+ - [fields] Select the first section instead of last when clicking right of content (#9005) @noraleonte
117
+ - [fields] Refactor prop drilling in fields (#8660) @flaviendelangle
118
+ - [pickers] Allow to render the months before `currentMonth` instead of the one after (#8592) @flaviendelangle
119
+ - [pickers] Fix view management when `openTo` or `views` is modified (#8997) @alexfauquette
120
+ - [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
121
+
122
+ ### Docs
123
+
124
+ - [docs] Clarify what Controlled / Uncontrolled means (#8926) @flaviendelangle
125
+ - [docs] Fix docs using wrong service worker (#9030) @cherniavskii
126
+ - [docs] Remove prop-types from JS demos (#9008) @flaviendelangle
127
+
128
+ ### Core
129
+
130
+ - [core] Add assertion about checkbox rerenders (#8974) @oliviertassinari
131
+ - [core] Allow selecting a section by type in field tests (#9009) @flaviendelangle
132
+ - [core] Fix `yarn.lock` (#8988) @flaviendelangle
133
+ - [core] Fix flacky adapter test (#8995) @flaviendelangle
134
+ - [charts] Clean the axis rendering (#8948) @alexfauquette
135
+ - [DataGrid] Memoize root props for better performance (#8942) @romgrk
136
+ - [test] Skip flaky unit tests in JSDOM (#8994) @cherniavskii
137
+
6
138
  ## v6.4.0
7
139
 
8
140
  _May 12, 2023_
@@ -46,7 +178,7 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
46
178
 
47
179
  ### Docs
48
180
 
49
- - [docs] Fix date pickers typo in the docs (#8939) @richbustos
181
+ - [docs] Fix date pickers typo in the docs (#8939) @richbustos
50
182
  - [docs] Fix master detail demo (#8894) @m4theushw
51
183
  - [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
52
184
  - [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
@@ -4384,7 +4516,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
4384
4516
 
4385
4517
  - 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
4386
4518
 
4387
- - 🔎 **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).
4519
+ - 🔎 **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/).
4388
4520
 
4389
4521
  <img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
4390
4522
 
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "defaultValue", "onChange", "className", "disableFuture", "disablePast", "minDate", "maxDate", "shouldDisableDate", "reduceAnimations", "onMonthChange", "defaultCalendarMonth", "rangePosition", "defaultRangePosition", "onRangePositionChange", "calendars", "components", "componentsProps", "slots", "slotProps", "loading", "renderLoading", "disableHighlightToday", "readOnly", "disabled", "showDaysOutsideCurrentMonth", "dayOfWeekFormatter", "disableAutoMonthSwitching", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber"],
3
+ const _excluded = ["value", "defaultValue", "onChange", "className", "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", "autoFocus", "fixedWeekNumber", "disableDragEditing", "displayWeekNumber"],
4
4
  _excluded2 = ["isDragging", "rangeDragDay", "draggingDatePosition"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -12,7 +12,7 @@ import { resolveComponentProps } from '@mui/base/utils';
12
12
  import { styled, useThemeProps } from '@mui/material/styles';
13
13
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
14
14
  import { Watermark } from '@mui/x-license-pro';
15
- import { applyDefaultDate, DAY_MARGIN, DayCalendar, defaultReduceAnimations, PickersArrowSwitcher, PickersCalendarHeader, useCalendarState, useDefaultDates, useLocaleText, useNextMonthDisabled, usePreviousMonthDisabled, useUtils, useNow, uncapitalizeObjectKeys, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '@mui/x-date-pickers/internals';
15
+ import { applyDefaultDate, DAY_MARGIN, DayCalendar, defaultReduceAnimations, PickersArrowSwitcher, PickersCalendarHeader, useCalendarState, useDefaultDates, useLocaleText, useNextMonthDisabled, usePreviousMonthDisabled, useUtils, useNow, uncapitalizeObjectKeys, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, buildWarning } from '@mui/x-date-pickers/internals';
16
16
  import { getReleaseInfo } from '../internal/utils/releaseInfo';
17
17
  import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from './dateRangeCalendarClasses';
18
18
  import { isEndOfRange, isRangeValid, isStartOfRange, isWithinRange } from '../internal/utils/date-utils';
@@ -51,6 +51,7 @@ const DateRangeCalendarArrowSwitcher = styled(PickersArrowSwitcher)({
51
51
  });
52
52
  const DAY_RANGE_SIZE = 40;
53
53
  const weeksContainerHeight = (DAY_RANGE_SIZE + DAY_MARGIN * 2) * 6;
54
+ const warnInvalidCurrentMonthCalendarPosition = buildWarning(['The `currentMonthCalendarPosition` prop must be an integer between `1` and the amount of calendars rendered.', 'For example if you have 2 calendars rendered, it should be equal to either 1 or 2.']);
54
55
  const DayCalendarForRange = styled(DayCalendar)(({
55
56
  theme
56
57
  }) => ({
@@ -132,6 +133,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
132
133
  defaultRangePosition: inDefaultRangePosition,
133
134
  onRangePositionChange: inOnRangePositionChange,
134
135
  calendars,
136
+ currentMonthCalendarPosition = 1,
135
137
  components,
136
138
  componentsProps,
137
139
  slots: innerSlots,
@@ -361,9 +363,17 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
361
363
  const calendarMonths = React.useMemo(() => Array.from({
362
364
  length: calendars
363
365
  }).map((_, index) => index), [calendars]);
364
- const visibleMonths = React.useMemo(() => Array.from({
365
- length: calendars
366
- }).map((_, index) => utils.setMonth(calendarState.currentMonth, utils.getMonth(calendarState.currentMonth) + index)), [utils, calendarState.currentMonth, calendars]);
366
+ const visibleMonths = React.useMemo(() => {
367
+ if (process.env.NODE_ENV !== 'production') {
368
+ if (currentMonthCalendarPosition > calendars || currentMonthCalendarPosition < 1) {
369
+ warnInvalidCurrentMonthCalendarPosition();
370
+ }
371
+ }
372
+ const firstMonth = utils.addMonths(calendarState.currentMonth, 1 - currentMonthCalendarPosition);
373
+ return Array.from({
374
+ length: calendars
375
+ }).map((_, index) => utils.addMonths(firstMonth, index));
376
+ }, [utils, calendarState.currentMonth, calendars, currentMonthCalendarPosition]);
367
377
  const focusedMonth = React.useMemo(() => {
368
378
  var _visibleMonths$find;
369
379
  if (!autoFocus) {
@@ -477,6 +487,11 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
477
487
  * @deprecated Please use `slotProps`.
478
488
  */
479
489
  componentsProps: PropTypes.object,
490
+ /**
491
+ * Position the current month is rendered in.
492
+ * @default 1
493
+ */
494
+ currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
480
495
  /**
481
496
  * Formats the day of week displayed in the calendar header.
482
497
  * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
@@ -58,6 +58,11 @@ export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalend
58
58
  * @default 2
59
59
  */
60
60
  calendars?: 1 | 2 | 3;
61
+ /**
62
+ * Position the current month is rendered in.
63
+ * @default 1
64
+ */
65
+ currentMonthCalendarPosition?: 1 | 2 | 3;
61
66
  /**
62
67
  * If `true`, editing dates by dragging is disabled.
63
68
  * @default false
@@ -69,6 +69,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
69
69
  * @deprecated Please use `slotProps`.
70
70
  */
71
71
  componentsProps: PropTypes.object,
72
+ /**
73
+ * Position the current month is rendered in.
74
+ * @default 1
75
+ */
76
+ currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
72
77
  /**
73
78
  * Formats the day of week displayed in the calendar header.
74
79
  * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
@@ -84,6 +84,11 @@ DesktopDateRangePicker.propTypes = {
84
84
  * @deprecated Please use `slotProps`.
85
85
  */
86
86
  componentsProps: PropTypes.object,
87
+ /**
88
+ * Position the current month is rendered in.
89
+ * @default 1
90
+ */
91
+ currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
87
92
  /**
88
93
  * Formats the day of week displayed in the calendar header.
89
94
  * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
@@ -87,6 +87,11 @@ MobileDateRangePicker.propTypes = {
87
87
  * @deprecated Please use `slotProps`.
88
88
  */
89
89
  componentsProps: PropTypes.object,
90
+ /**
91
+ * Position the current month is rendered in.
92
+ * @default 1
93
+ */
94
+ currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
90
95
  /**
91
96
  * Formats the day of week displayed in the calendar header.
92
97
  * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "autoFocus"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "disabled", "autoFocus", "unstableStartFieldRef", "unstableEndFieldRef"],
4
4
  _excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
5
5
  _excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
6
6
  import * as React from 'react';
@@ -10,7 +10,7 @@ import MuiTextField from '@mui/material/TextField';
10
10
  import Typography from '@mui/material/Typography';
11
11
  import { styled, useThemeProps } from '@mui/material/styles';
12
12
  import { useSlotProps } from '@mui/base/utils';
13
- import { uncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
13
+ import { splitFieldInternalAndForwardedProps, uncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
14
14
  import { useMultiInputDateRangeField } from '../internal/hooks/useMultiInputRangeField/useMultiInputDateRangeField';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -40,30 +40,21 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
40
40
  props: inProps,
41
41
  name: 'MuiMultiInputDateRangeField'
42
42
  });
43
+ const {
44
+ internalProps: dateFieldInternalProps,
45
+ forwardedProps
46
+ } = splitFieldInternalAndForwardedProps(themeProps, 'date');
43
47
  const {
44
48
  slots: innerSlots,
45
49
  slotProps: innerSlotProps,
46
50
  components,
47
51
  componentsProps,
48
- value,
49
- defaultValue,
50
- format,
51
- formatDensity,
52
- shouldRespectLeadingZeros,
53
- onChange,
54
- readOnly,
55
52
  disabled,
56
- onError,
57
- shouldDisableDate,
58
- minDate,
59
- maxDate,
60
- disableFuture,
61
- disablePast,
62
- selectedSections,
63
- onSelectedSectionsChange,
64
- autoFocus
65
- } = themeProps,
66
- other = _objectWithoutPropertiesLoose(themeProps, _excluded);
53
+ autoFocus,
54
+ unstableStartFieldRef,
55
+ unstableEndFieldRef
56
+ } = forwardedProps,
57
+ otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
67
58
  const slots = innerSlots != null ? innerSlots : uncapitalizeObjectKeys(components);
68
59
  const slotProps = innerSlotProps != null ? innerSlotProps : componentsProps;
69
60
  const ownerState = themeProps;
@@ -71,7 +62,7 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
71
62
  const rootProps = useSlotProps({
72
63
  elementType: Root,
73
64
  externalSlotProps: slotProps == null ? void 0 : slotProps.root,
74
- externalForwardedProps: other,
65
+ externalForwardedProps: otherForwardedProps,
75
66
  additionalProps: {
76
67
  ref
77
68
  },
@@ -102,26 +93,13 @@ const MultiInputDateRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
102
93
  ownerState
103
94
  });
104
95
  const _useMultiInputDateRan = useMultiInputDateRangeField({
105
- sharedProps: {
106
- value,
107
- defaultValue,
108
- format,
109
- formatDensity,
110
- shouldRespectLeadingZeros,
111
- onChange,
112
- readOnly,
113
- disabled,
114
- onError,
115
- shouldDisableDate,
116
- minDate,
117
- maxDate,
118
- disableFuture,
119
- disablePast,
120
- selectedSections,
121
- onSelectedSectionsChange
122
- },
96
+ sharedProps: _extends({}, dateFieldInternalProps, {
97
+ disabled
98
+ }),
123
99
  startTextFieldProps,
124
100
  endTextFieldProps,
101
+ unstableStartFieldRef,
102
+ unstableEndFieldRef,
125
103
  startInputRef: startTextFieldProps.inputRef,
126
104
  endInputRef: endTextFieldProps.inputRef
127
105
  }),
@@ -261,6 +239,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
261
239
  * @default false
262
240
  */
263
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,
264
248
  /**
265
249
  * The currently selected sections.
266
250
  * This prop accept four formats:
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "shouldDisableDate", "minDate", "maxDate", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "disabled", "autoFocus", "unstableStartFieldRef", "unstableEndFieldRef"],
4
4
  _excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
5
5
  _excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
6
6
  import * as React from 'react';
@@ -10,7 +10,7 @@ import MuiTextField from '@mui/material/TextField';
10
10
  import Typography from '@mui/material/Typography';
11
11
  import { styled, useThemeProps } from '@mui/material/styles';
12
12
  import { useSlotProps } from '@mui/base/utils';
13
- import { uncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
13
+ import { splitFieldInternalAndForwardedProps, uncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
14
14
  import { useMultiInputDateTimeRangeField } from '../internal/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -40,39 +40,21 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
40
40
  props: inProps,
41
41
  name: 'MuiMultiInputDateTimeRangeField'
42
42
  });
43
+ const {
44
+ internalProps: dateTimeFieldInternalProps,
45
+ forwardedProps
46
+ } = splitFieldInternalAndForwardedProps(themeProps, 'date-time');
43
47
  const {
44
48
  slots: innerSlots,
45
49
  slotProps: innerSlotProps,
46
50
  components,
47
51
  componentsProps,
48
- value,
49
- defaultValue,
50
- format,
51
- formatDensity,
52
- shouldRespectLeadingZeros,
53
- onChange,
54
- readOnly,
55
52
  disabled,
56
- onError,
57
- shouldDisableDate,
58
- minDate,
59
- maxDate,
60
- minTime,
61
- maxTime,
62
- minDateTime,
63
- maxDateTime,
64
- minutesStep,
65
- shouldDisableClock,
66
- shouldDisableTime,
67
- disableFuture,
68
- disablePast,
69
- selectedSections,
70
- onSelectedSectionsChange,
53
+ autoFocus,
71
54
  unstableStartFieldRef,
72
- unstableEndFieldRef,
73
- autoFocus
74
- } = themeProps,
75
- other = _objectWithoutPropertiesLoose(themeProps, _excluded);
55
+ unstableEndFieldRef
56
+ } = forwardedProps,
57
+ otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
76
58
  const slots = innerSlots != null ? innerSlots : uncapitalizeObjectKeys(components);
77
59
  const slotProps = innerSlotProps != null ? innerSlotProps : componentsProps;
78
60
  const ownerState = themeProps;
@@ -80,7 +62,7 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
80
62
  const rootProps = useSlotProps({
81
63
  elementType: Root,
82
64
  externalSlotProps: slotProps == null ? void 0 : slotProps.root,
83
- externalForwardedProps: other,
65
+ externalForwardedProps: otherForwardedProps,
84
66
  additionalProps: {
85
67
  ref
86
68
  },
@@ -111,31 +93,9 @@ const MultiInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Mult
111
93
  ownerState
112
94
  });
113
95
  const _useMultiInputDateTim = useMultiInputDateTimeRangeField({
114
- sharedProps: {
115
- value,
116
- defaultValue,
117
- format,
118
- formatDensity,
119
- shouldRespectLeadingZeros,
120
- onChange,
121
- readOnly,
122
- disabled,
123
- onError,
124
- shouldDisableDate,
125
- minDate,
126
- maxDate,
127
- minTime,
128
- maxTime,
129
- minDateTime,
130
- maxDateTime,
131
- minutesStep,
132
- shouldDisableClock,
133
- shouldDisableTime,
134
- disableFuture,
135
- disablePast,
136
- selectedSections,
137
- onSelectedSectionsChange
138
- },
96
+ sharedProps: _extends({}, dateTimeFieldInternalProps, {
97
+ disabled
98
+ }),
139
99
  startTextFieldProps,
140
100
  endTextFieldProps,
141
101
  startInputRef: startTextFieldProps.inputRef,
@@ -312,6 +272,12 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
312
272
  * @default false
313
273
  */
314
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,
315
281
  /**
316
282
  * The currently selected sections.
317
283
  * This prop accept four formats:
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps", "value", "defaultValue", "format", "formatDensity", "shouldRespectLeadingZeros", "onChange", "readOnly", "disabled", "onError", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableFuture", "disablePast", "selectedSections", "onSelectedSectionsChange", "unstableStartFieldRef", "unstableEndFieldRef", "autoFocus"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "disabled", "autoFocus", "unstableStartFieldRef", "unstableEndFieldRef"],
4
4
  _excluded2 = ["onKeyDown", "ref", "readOnly", "inputMode"],
5
5
  _excluded3 = ["onKeyDown", "ref", "readOnly", "inputMode"];
6
6
  import * as React from 'react';
@@ -10,7 +10,7 @@ import MuiTextField from '@mui/material/TextField';
10
10
  import Typography from '@mui/material/Typography';
11
11
  import { styled, useThemeProps } from '@mui/material/styles';
12
12
  import { useSlotProps } from '@mui/base/utils';
13
- import { uncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
13
+ import { splitFieldInternalAndForwardedProps, uncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
14
14
  import { useMultiInputTimeRangeField } from '../internal/hooks/useMultiInputRangeField/useMultiInputTimeRangeField';
15
15
  import { jsx as _jsx } from "react/jsx-runtime";
16
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -40,34 +40,21 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
40
40
  props: inProps,
41
41
  name: 'MuiMultiInputTimeRangeField'
42
42
  });
43
+ const {
44
+ internalProps: timeFieldInternalProps,
45
+ forwardedProps
46
+ } = splitFieldInternalAndForwardedProps(themeProps, 'time');
43
47
  const {
44
48
  slots: innerSlots,
45
49
  slotProps: innerSlotProps,
46
50
  components,
47
51
  componentsProps,
48
- value,
49
- defaultValue,
50
- format,
51
- formatDensity,
52
- shouldRespectLeadingZeros,
53
- onChange,
54
- readOnly,
55
52
  disabled,
56
- onError,
57
- minTime,
58
- maxTime,
59
- minutesStep,
60
- shouldDisableClock,
61
- shouldDisableTime,
62
- disableFuture,
63
- disablePast,
64
- selectedSections,
65
- onSelectedSectionsChange,
53
+ autoFocus,
66
54
  unstableStartFieldRef,
67
- unstableEndFieldRef,
68
- autoFocus
69
- } = themeProps,
70
- other = _objectWithoutPropertiesLoose(themeProps, _excluded);
55
+ unstableEndFieldRef
56
+ } = forwardedProps,
57
+ otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
71
58
  const slots = innerSlots != null ? innerSlots : uncapitalizeObjectKeys(components);
72
59
  const slotProps = innerSlotProps != null ? innerSlotProps : componentsProps;
73
60
  const ownerState = themeProps;
@@ -75,7 +62,7 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
75
62
  const rootProps = useSlotProps({
76
63
  elementType: Root,
77
64
  externalSlotProps: slotProps == null ? void 0 : slotProps.root,
78
- externalForwardedProps: other,
65
+ externalForwardedProps: otherForwardedProps,
79
66
  additionalProps: {
80
67
  ref
81
68
  },
@@ -106,26 +93,9 @@ const MultiInputTimeRangeField = /*#__PURE__*/React.forwardRef(function MultiInp
106
93
  ownerState
107
94
  });
108
95
  const _useMultiInputTimeRan = useMultiInputTimeRangeField({
109
- sharedProps: {
110
- value,
111
- defaultValue,
112
- format,
113
- formatDensity,
114
- shouldRespectLeadingZeros,
115
- onChange,
116
- readOnly,
117
- disabled,
118
- onError,
119
- minTime,
120
- maxTime,
121
- minutesStep,
122
- shouldDisableClock,
123
- shouldDisableTime,
124
- disableFuture,
125
- disablePast,
126
- selectedSections,
127
- onSelectedSectionsChange
128
- },
96
+ sharedProps: _extends({}, timeFieldInternalProps, {
97
+ disabled
98
+ }),
129
99
  startTextFieldProps,
130
100
  endTextFieldProps,
131
101
  startInputRef: startTextFieldProps.inputRef,
@@ -286,6 +256,12 @@ process.env.NODE_ENV !== "production" ? MultiInputTimeRangeField.propTypes = {
286
256
  * @default false
287
257
  */
288
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,
289
265
  /**
290
266
  * The currently selected sections.
291
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