@mui/x-date-pickers-pro 6.14.0 → 6.16.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 (108) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/DateRangeCalendar/DateRangeCalendar.js +6 -2
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
  4. package/DateRangePicker/DateRangePicker.js +6 -2
  5. package/DateRangePicker/DateRangePickerToolbar.js +1 -0
  6. package/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
  7. package/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
  8. package/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
  9. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +1 -1
  10. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
  11. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +1 -1
  12. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +1 -1
  13. package/SingleInputDateRangeField/SingleInputDateRangeField.js +32 -4
  14. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +3 -3
  15. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +32 -4
  16. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +3 -3
  17. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +29 -4
  18. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +3 -3
  19. package/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
  20. package/index.js +1 -1
  21. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +3 -3
  22. package/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -3
  23. package/internals/hooks/useMultiInputRangeField/shared.d.ts +1 -0
  24. package/internals/hooks/useMultiInputRangeField/shared.js +9 -0
  25. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
  26. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
  27. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
  28. package/internals/models/dateRange.d.ts +3 -0
  29. package/internals/utils/releaseInfo.js +1 -1
  30. package/legacy/DateRangeCalendar/DateRangeCalendar.js +6 -2
  31. package/legacy/DateRangePicker/DateRangePicker.js +6 -2
  32. package/legacy/DateRangePicker/DateRangePickerToolbar.js +1 -0
  33. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
  34. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
  35. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
  36. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
  37. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +30 -3
  38. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +30 -3
  39. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +27 -3
  40. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
  41. package/legacy/index.js +1 -1
  42. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +14 -3
  43. package/legacy/internals/hooks/useMultiInputRangeField/shared.js +9 -0
  44. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
  45. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
  46. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
  47. package/legacy/internals/utils/releaseInfo.js +1 -1
  48. package/modern/DateRangeCalendar/DateRangeCalendar.js +6 -2
  49. package/modern/DateRangePicker/DateRangePicker.js +6 -2
  50. package/modern/DateRangePicker/DateRangePickerToolbar.js +1 -0
  51. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
  52. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
  53. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
  54. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
  55. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +32 -4
  56. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +32 -4
  57. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +29 -4
  58. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
  59. package/modern/index.js +1 -1
  60. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -3
  61. package/modern/internals/hooks/useMultiInputRangeField/shared.js +9 -0
  62. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
  63. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
  64. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
  65. package/modern/internals/utils/releaseInfo.js +1 -1
  66. package/node/DateRangeCalendar/DateRangeCalendar.js +6 -2
  67. package/node/DateRangePicker/DateRangePicker.js +6 -2
  68. package/node/DateRangePicker/DateRangePickerToolbar.js +1 -0
  69. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +6 -2
  70. package/node/MobileDateRangePicker/MobileDateRangePicker.js +6 -2
  71. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +3 -0
  72. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +3 -0
  73. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +32 -4
  74. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +32 -4
  75. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +29 -4
  76. package/node/StaticDateRangePicker/StaticDateRangePicker.js +6 -2
  77. package/node/index.js +1 -1
  78. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -3
  79. package/node/internals/hooks/useMultiInputRangeField/shared.js +16 -0
  80. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +5 -2
  81. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +5 -2
  82. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +5 -2
  83. package/node/internals/utils/releaseInfo.js +1 -1
  84. package/package.json +2 -2
  85. package/legacy/tests/describeRangeValidation/describeRangeValidation.js +0 -29
  86. package/legacy/tests/describeRangeValidation/describeRangeValidation.types.js +0 -1
  87. package/legacy/tests/describeRangeValidation/index.js +0 -1
  88. package/legacy/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -144
  89. package/legacy/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -291
  90. package/legacy/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -518
  91. package/modern/tests/describeRangeValidation/describeRangeValidation.js +0 -29
  92. package/modern/tests/describeRangeValidation/describeRangeValidation.types.js +0 -1
  93. package/modern/tests/describeRangeValidation/index.js +0 -1
  94. package/modern/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -145
  95. package/modern/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -285
  96. package/modern/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -520
  97. package/node/tests/describeRangeValidation/describeRangeValidation.js +0 -37
  98. package/node/tests/describeRangeValidation/describeRangeValidation.types.js +0 -5
  99. package/node/tests/describeRangeValidation/index.js +0 -12
  100. package/node/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -154
  101. package/node/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -294
  102. package/node/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -530
  103. package/tests/describeRangeValidation/describeRangeValidation.js +0 -29
  104. package/tests/describeRangeValidation/describeRangeValidation.types.js +0 -1
  105. package/tests/describeRangeValidation/index.js +0 -1
  106. package/tests/describeRangeValidation/testDayViewRangeValidation.js +0 -145
  107. package/tests/describeRangeValidation/testTextFieldKeyboardRangeValidation.js +0 -285
  108. package/tests/describeRangeValidation/testTextFieldRangeValidation.js +0 -520
package/CHANGELOG.md CHANGED
@@ -3,6 +3,173 @@
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.16.0
7
+
8
+ _Sep 29, 2023_
9
+
10
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add a clearable behavior to all the single input pickers and fields (#9095) @noraleonte
13
+
14
+ The pickers and fields now have an out-of-the box implementation for clearing the field value. You can see the documentation for this behavior on the [Date Picker documentation](https://mui.com/x/react-date-pickers/date-picker/#clearing-the-value).
15
+
16
+ <img width="380" alt="Clearable behavior" src="https://github.com/mui/mui-x/assets/72460825/e4a66169-83b5-4579-b9f6-6e15bb528411">
17
+
18
+ - 💫 Add Date Picker customization playground (#9581) @noraleonte
19
+
20
+ You can play around with style customization options on the [Date Picker documentation](https://mui.com/x/react-date-pickers/date-picker/#customization).
21
+
22
+ We are thrilled to hear your feedback about this functionality!
23
+
24
+ - 🚀 Fix header filters menu auto closing on render (#10483) @MBilalShafi
25
+ - 🎯 Fix column headers scroll when theme scoping is used (#10437) @cherniavskii
26
+ - 🌍 Improve Russian (ru-RU) locale on the data grid
27
+ - 🐞 Bugfixes
28
+ - 📚 Documentation improvements
29
+
30
+ ### Data Grid
31
+
32
+ #### `@mui/x-data-grid@6.16.0`
33
+
34
+ - [DataGrid] Fix column headers scroll when theme scoping is used (#10437) @cherniavskii
35
+ - [DataGrid] Rename `global` to `globalScope` due to Jest issue (#10470) @romgrk
36
+ - [l10n] Improve Russian (ru-RU) locale (#10464 and #10407) @NKodos
37
+
38
+ #### `@mui/x-data-grid-pro@6.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
39
+
40
+ Same changes as in `@mui/x-data-grid@6.16.0`, plus:
41
+
42
+ - [DataGridPro] Fix header filters menu auto closing on render (#10483) @MBilalShafi
43
+
44
+ #### `@mui/x-data-grid-premium@6.16.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
45
+
46
+ Same changes as in `@mui/x-data-grid-pro@6.16.0`.
47
+
48
+ ### Date Pickers
49
+
50
+ #### `@mui/x-date-pickers@6.16.0`
51
+
52
+ - [pickers] Add warning to `shouldDisableDate` validation (#10502) @michelengelen
53
+ - [pickers] Implement `clearable` field behavior (#9095) @noraleonte
54
+ - [pickers] Refactor `dayOfWeekFormatter` (#10345) @michelengelen
55
+
56
+ #### `@mui/x-date-pickers-pro@6.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
57
+
58
+ Same changes as in `@mui/x-date-pickers@6.16.0`.
59
+
60
+ ### Charts / `@mui/x-charts@6.0.0-alpha.13`
61
+
62
+ - [charts] Share upfront future Pro features (#10465) @oliviertassinari
63
+
64
+ ### Tree View / `@mui/x-tree-view@6.0.0-beta.0`
65
+
66
+ - [TreeView] Do not try to focus a collapsed node when re-focusing the TreeView (#10422) @flaviendelangle
67
+ - [TreeView] Fix the typing of the `Multiple` generic (#10478) @flaviendelangle
68
+
69
+ ### Docs
70
+
71
+ - [docs] Correct the typo in data grid api docs (#10477) @MBilalShafi
72
+ - [docs] Add customization playground (#9581) @noraleonte
73
+ - [docs] Fix Tree View product ID (#10428) @oliviertassinari
74
+ - [docs] Fix demo crashing when all rows are deleted (#10438) @cherniavskii
75
+ - [docs] Fix mobile scrollbar column resize (#10455) @oliviertassinari
76
+ - [docs] Fix usage of `GridRenderCellParams` interface (#10435) @cherniavskii
77
+
78
+ ### Core
79
+
80
+ - [core] Fix typo in header data grid quick filter @oliviertassinari
81
+ - [core] Group D3 renovate PRs (#10480) @flaviendelangle
82
+ - [core] Link the priority support page (#10495) @michelengelen
83
+ - [core] Move the pickers describes to the test utils folder (#10490) @flaviendelangle
84
+ - [core] Priority Support casing normalization @oliviertassinari
85
+ - [core] Remove automated DataGrid performance tests (#10414) @romgrk
86
+ - [core] Sync `prism-okaidia.css` with docs-infra @oliviertassinari
87
+ - [core] Update issue actions & templates (#10375) @romgrk
88
+ - [core] Update release guide (#10468) @DanailH
89
+
90
+ ## 6.15.0
91
+
92
+ _Sep 22, 2023_
93
+
94
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
95
+
96
+ - 🚀 Implement columns auto-sizing (#10180) @romgrk
97
+ - 🎁 Add support for `getRowsToExport` option to print export on the data grid (#10084) @zreecespieces
98
+ - 🌍 Improve Finnish (fi-FI) locale
99
+ - 🐞 Bugfixes
100
+ - 📚 Documentation improvements
101
+
102
+ ### Data Grid
103
+
104
+ #### `@mui/x-data-grid@6.15.0`
105
+
106
+ - [DataGrid] Add support for `getRowsToExport` option to print export (#10084) @zreecespieces
107
+ - [DataGrid] Fix dev warning about `InputLabelProps` (#10413) @romgrk
108
+ - [DataGrid] Refactor `GridMenu` prop `onClickAway` to `onClose` (#10411) @romgrk
109
+ - [DataGrid] Restore focus after `GridMenu` closes (#10412) @romgrk
110
+ - [DataGrid] Fix typing of `GridActionsCellItem` (#10344) @romgrk
111
+ - [DataGrid] Hide `eval` from bundlers (#10329) @romgrk
112
+ - [DataGrid] Add `border: 0` to unmounted focused cell to avoid layout shifts in that row (#10318) @lauri865
113
+
114
+ #### `@mui/x-data-grid-pro@6.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
115
+
116
+ Same changes as in `@mui/x-data-grid@6.15.0`, plus:
117
+
118
+ - [DataGridPro] Implement columns auto-sizing (#10180) @romgrk
119
+ - [DataGridPro] Fix keyboard navigation issue in header filters (#10358) @MBilalShafi
120
+ - [DataGridPro] Add missing row hover styles (#10252) @cherniavskii
121
+ - [DataGridPro] Make default filter items have stable references in header filters (#10338) @MBilalShafi
122
+
123
+ #### `@mui/x-data-grid-premium@6.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
124
+
125
+ Same changes as in `@mui/x-data-grid-pro@6.15.0`.
126
+
127
+ ### Date Pickers
128
+
129
+ #### `@mui/x-date-pickers@6.15.0`
130
+
131
+ - [pickers] Support tokens without spaces (#10185) @alexfauquette
132
+ - [l10n] Improve Finnish (fi-FI) locale (#10346) @samijouppila
133
+
134
+ #### `@mui/x-date-pickers-pro@6.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
135
+
136
+ Same changes as in `@mui/x-date-pickers@6.15.0`.
137
+
138
+ ### Charts / `@mui/x-charts@6.0.0-alpha.12`
139
+
140
+ - [charts] Fix sparkline scale and rendering (#10402) @alexfauquette
141
+ - [charts] Remove components from `@mui/material` (#10115) @alexfauquette
142
+
143
+ ### Tree View / `@mui/x-tree-view@6.0.0-alpha.4`
144
+
145
+ - [TreeView] Split features into plugins to prepare for Pro version (#10123) @flaviendelangle
146
+
147
+ ### Docs
148
+
149
+ - [docs] Add charts documentation pages to complete pricing table (#10394) @alexfauquette
150
+ - [docs] Add missing MIT packages on the Licensing page (#10348) @flaviendelangle
151
+ - [docs] Clearer component pattern @oliviertassinari
152
+ - [docs] Easier to understand demo (#10370) @oliviertassinari
153
+ - [docs] Fix `301` to Material UI @oliviertassinari
154
+ - [docs] Improve the column visibility section (#10327) @MBilalShafi
155
+ - [docs] Improve the documentation section `rowIdentifier` (#10326) @MBilalShafi
156
+ - [docs] Improve pickers localization documentation (#10202) @flaviendelangle
157
+ - [docs] Polish typescript ref usage (#10359) @oliviertassinari
158
+ - [docs] Improve charts tooltip wording (#10406) @alexfauquette
159
+
160
+ ### Core
161
+
162
+ - [core] Cleanup GitHub issues template (#10372) @romgrk
163
+ - [core] Fix Circle CI OOM (#10385) @romgrk
164
+ - [core] Improve sleep test helper @oliviertassinari
165
+ - [core] Remove unwanted prefixes @oliviertassinari
166
+ - [core] Remove duplicate label @oliviertassinari
167
+ - [core] Simplify source @oliviertassinari
168
+ - [core] Upgrade monorepo (#10425) @cherniavskii
169
+ - [core] Upgrade monorepo to have the new typescript-to-proptype (#10224) @flaviendelangle
170
+ - [test] Do not use deprecated adapter methods (#10416) @flaviendelangle
171
+ - [test] Name test suites according to sentence case (#10429) @alexfauquette
172
+
6
173
  ## 6.14.0
7
174
 
8
175
  _Sep 14, 2023_
@@ -509,9 +509,10 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
509
509
  currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
510
510
  /**
511
511
  * Formats the day of week displayed in the calendar header.
512
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
512
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
513
+ * @param {TDate} date The date of the day of week provided by the adapter.
513
514
  * @returns {string} The name to display.
514
- * @default (day) => day.charAt(0).toUpperCase()
515
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
515
516
  */
516
517
  dayOfWeekFormatter: PropTypes.func,
517
518
  /**
@@ -629,6 +630,9 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
629
630
  renderLoading: PropTypes.func,
630
631
  /**
631
632
  * Disable specific date.
633
+ *
634
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
635
+ *
632
636
  * @template TDate
633
637
  * @param {TDate} day The date to test.
634
638
  * @param {string} position The date to test, 'start' or 'end'.
@@ -24,7 +24,7 @@ export interface DateRangeCalendarSlotsComponentsProps<TDate> extends PickersArr
24
24
  selected: boolean;
25
25
  }>;
26
26
  }
27
- export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalendarProps, BaseDateValidationProps<TDate>, DayRangeValidationProps<TDate>, TimezoneProps, Pick<ExportedUseViewsOptions<'day'>, 'autoFocus'> {
27
+ export interface ExportedDateRangeCalendarProps<TDate> extends ExportedDayCalendarProps<TDate>, BaseDateValidationProps<TDate>, DayRangeValidationProps<TDate>, TimezoneProps, Pick<ExportedUseViewsOptions<'day'>, 'autoFocus'> {
28
28
  /**
29
29
  * If `true`, after selecting `start` date calendar will not automatically switch to the month of `end` date.
30
30
  * @default false
@@ -77,9 +77,10 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
77
77
  currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
78
78
  /**
79
79
  * Formats the day of week displayed in the calendar header.
80
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
80
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
81
+ * @param {TDate} date The date of the day of week provided by the adapter.
81
82
  * @returns {string} The name to display.
82
- * @default (day) => day.charAt(0).toUpperCase()
83
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
83
84
  */
84
85
  dayOfWeekFormatter: PropTypes.func,
85
86
  /**
@@ -280,6 +281,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
280
281
  })]),
281
282
  /**
282
283
  * Disable specific date.
284
+ *
285
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
286
+ *
283
287
  * @template TDate
284
288
  * @param {TDate} day The date to test.
285
289
  * @param {string} position The date to test, 'start' or 'end'.
@@ -96,6 +96,7 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
96
96
  onRangePositionChange: PropTypes.func.isRequired,
97
97
  rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
98
98
  readOnly: PropTypes.bool,
99
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
99
100
  titleId: PropTypes.string,
100
101
  /**
101
102
  * Toolbar date format.
@@ -92,9 +92,10 @@ DesktopDateRangePicker.propTypes = {
92
92
  currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
93
93
  /**
94
94
  * Formats the day of week displayed in the calendar header.
95
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
95
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
96
+ * @param {TDate} date The date of the day of week provided by the adapter.
96
97
  * @returns {string} The name to display.
97
- * @default (day) => day.charAt(0).toUpperCase()
98
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
98
99
  */
99
100
  dayOfWeekFormatter: PropTypes.func,
100
101
  /**
@@ -289,6 +290,9 @@ DesktopDateRangePicker.propTypes = {
289
290
  })]),
290
291
  /**
291
292
  * Disable specific date.
293
+ *
294
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
295
+ *
292
296
  * @template TDate
293
297
  * @param {TDate} day The date to test.
294
298
  * @param {string} position The date to test, 'start' or 'end'.
@@ -92,9 +92,10 @@ MobileDateRangePicker.propTypes = {
92
92
  currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
93
93
  /**
94
94
  * Formats the day of week displayed in the calendar header.
95
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
95
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
96
+ * @param {TDate} date The date of the day of week provided by the adapter.
96
97
  * @returns {string} The name to display.
97
- * @default (day) => day.charAt(0).toUpperCase()
98
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
98
99
  */
99
100
  dayOfWeekFormatter: PropTypes.func,
100
101
  /**
@@ -289,6 +290,9 @@ MobileDateRangePicker.propTypes = {
289
290
  })]),
290
291
  /**
291
292
  * Disable specific date.
293
+ *
294
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
295
+ *
292
296
  * @template TDate
293
297
  * @param {TDate} day The date to test.
294
298
  * @param {string} position The date to test, 'start' or 'end'.
@@ -283,6 +283,9 @@ process.env.NODE_ENV !== "production" ? MultiInputDateRangeField.propTypes = {
283
283
  })]),
284
284
  /**
285
285
  * Disable specific date.
286
+ *
287
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
288
+ *
286
289
  * @template TDate
287
290
  * @param {TDate} day The date to test.
288
291
  * @param {string} position The date to test, 'start' or 'end'.
@@ -11,7 +11,7 @@ import { UseMultiInputRangeFieldParams } from '../internals/hooks/useMultiInputR
11
11
  import { RangeFieldSection } from '../internals/models/fields';
12
12
  import { MultiInputRangeFieldClasses } from '../models';
13
13
  export type UseMultiInputDateRangeFieldParams<TDate, TTextFieldSlotProps extends {}> = UseMultiInputRangeFieldParams<UseMultiInputDateRangeFieldProps<TDate>, TTextFieldSlotProps>;
14
- export interface UseMultiInputDateRangeFieldProps<TDate> extends Omit<UseDateRangeFieldProps<TDate>, 'unstableFieldRef'> {
14
+ export interface UseMultiInputDateRangeFieldProps<TDate> extends Omit<UseDateRangeFieldProps<TDate>, 'unstableFieldRef' | 'clearable' | 'onClear'> {
15
15
  unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
16
16
  unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
17
17
  }
@@ -324,6 +324,9 @@ process.env.NODE_ENV !== "production" ? MultiInputDateTimeRangeField.propTypes =
324
324
  shouldDisableClock: PropTypes.func,
325
325
  /**
326
326
  * Disable specific date.
327
+ *
328
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
329
+ *
327
330
  * @template TDate
328
331
  * @param {TDate} day The date to test.
329
332
  * @param {string} position The date to test, 'start' or 'end'.
@@ -11,7 +11,7 @@ import { RangeFieldSection } from '../internals/models/fields';
11
11
  import { UseMultiInputRangeFieldParams } from '../internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types';
12
12
  import { MultiInputRangeFieldClasses } from '../models';
13
13
  export type UseMultiInputDateTimeRangeFieldParams<TDate, TTextFieldSlotProps extends {}> = UseMultiInputRangeFieldParams<UseMultiInputDateTimeRangeFieldProps<TDate>, TTextFieldSlotProps>;
14
- export interface UseMultiInputDateTimeRangeFieldProps<TDate> extends Omit<UseDateTimeRangeFieldProps<TDate>, 'unstableFieldRef'> {
14
+ export interface UseMultiInputDateTimeRangeFieldProps<TDate> extends Omit<UseDateTimeRangeFieldProps<TDate>, 'unstableFieldRef' | 'clearable' | 'onClear'> {
15
15
  unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
16
16
  unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
17
17
  }
@@ -11,7 +11,7 @@ import { UseMultiInputRangeFieldParams } from '../internals/hooks/useMultiInputR
11
11
  import { RangeFieldSection } from '../internals/models/fields';
12
12
  import { MultiInputRangeFieldClasses } from '../models';
13
13
  export type UseMultiInputTimeRangeFieldParams<TDate, TTextFieldSlotProps extends {}> = UseMultiInputRangeFieldParams<UseMultiInputTimeRangeFieldProps<TDate>, TTextFieldSlotProps>;
14
- export interface UseMultiInputTimeRangeFieldProps<TDate> extends Omit<UseTimeRangeFieldProps<TDate>, 'unstableFieldRef'> {
14
+ export interface UseMultiInputTimeRangeFieldProps<TDate> extends Omit<UseTimeRangeFieldProps<TDate>, 'unstableFieldRef' | 'clearable' | 'onClear'> {
15
15
  unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
16
16
  unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
17
17
  }
@@ -2,12 +2,13 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
- _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
5
+ _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
9
9
  import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
+ import { useClearableField } from '@mui/x-date-pickers/hooks';
11
12
  import { refType } from '@mui/utils';
12
13
  import { useSingleInputDateRangeField } from './useSingleInputDateRangeField';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -51,13 +52,28 @@ const SingleInputDateRangeField = /*#__PURE__*/React.forwardRef(function SingleI
51
52
  onPaste,
52
53
  onKeyDown,
53
54
  inputMode,
54
- readOnly
55
+ readOnly,
56
+ clearable,
57
+ onClear
55
58
  } = _useSingleInputDateRa,
56
59
  fieldProps = _objectWithoutPropertiesLoose(_useSingleInputDateRa, _excluded3);
60
+ const {
61
+ InputProps: ProcessedInputProps,
62
+ fieldProps: processedFieldProps
63
+ } = useClearableField({
64
+ onClear,
65
+ clearable,
66
+ fieldProps,
67
+ InputProps: fieldProps.InputProps,
68
+ slots,
69
+ slotProps,
70
+ components,
71
+ componentsProps
72
+ });
57
73
  return /*#__PURE__*/_jsx(TextField, _extends({
58
74
  ref: ref
59
- }, fieldProps, {
60
- InputProps: _extends({}, fieldProps.InputProps, {
75
+ }, processedFieldProps, {
76
+ InputProps: _extends({}, ProcessedInputProps, {
61
77
  readOnly
62
78
  }),
63
79
  inputProps: _extends({}, fieldProps.inputProps, {
@@ -80,6 +96,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
80
96
  */
81
97
  autoFocus: PropTypes.bool,
82
98
  className: PropTypes.string,
99
+ /**
100
+ * If `true`, a clear button will be shown in the field allowing value clearing.
101
+ * @default false
102
+ */
103
+ clearable: PropTypes.bool,
83
104
  /**
84
105
  * The color of the component.
85
106
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -208,6 +229,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
208
229
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
209
230
  */
210
231
  onChange: PropTypes.func,
232
+ /**
233
+ * Callback fired when the clear button is clicked.
234
+ */
235
+ onClear: PropTypes.func,
211
236
  /**
212
237
  * Callback fired when the error associated to the current value changes.
213
238
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -254,6 +279,9 @@ process.env.NODE_ENV !== "production" ? SingleInputDateRangeField.propTypes = {
254
279
  })]),
255
280
  /**
256
281
  * Disable specific date.
282
+ *
283
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
284
+ *
257
285
  * @template TDate
258
286
  * @param {TDate} day The date to test.
259
287
  * @param {string} position The date to test, 'start' or 'end'.
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import TextField from '@mui/material/TextField';
4
- import { FieldsTextFieldProps, UncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
4
+ import { FieldsTextFieldProps, UncapitalizeObjectKeys, FieldSlotsComponents, FieldSlotsComponentsProps } from '@mui/x-date-pickers/internals';
5
5
  import { UseDateRangeFieldDefaultizedProps, UseDateRangeFieldProps } from '../internals/models';
6
6
  export interface UseSingleInputDateRangeFieldParams<TDate, TChildProps extends {}> {
7
7
  props: UseSingleInputDateRangeFieldComponentProps<TDate, TChildProps>;
@@ -36,7 +36,7 @@ export type SingleInputDateRangeFieldProps<TDate, TChildProps extends {} = Field
36
36
  slotProps?: SingleInputDateRangeFieldSlotsComponentsProps<TDate>;
37
37
  };
38
38
  export type SingleInputDateRangeFieldOwnerState<TDate> = SingleInputDateRangeFieldProps<TDate>;
39
- export interface SingleInputDateRangeFieldSlotsComponent {
39
+ export interface SingleInputDateRangeFieldSlotsComponent extends FieldSlotsComponents {
40
40
  /**
41
41
  * Form control with an input to render the value.
42
42
  * Receives the same props as `@mui/material/TextField`.
@@ -44,6 +44,6 @@ export interface SingleInputDateRangeFieldSlotsComponent {
44
44
  */
45
45
  TextField?: React.ElementType;
46
46
  }
47
- export interface SingleInputDateRangeFieldSlotsComponentsProps<TDate> {
47
+ export interface SingleInputDateRangeFieldSlotsComponentsProps<TDate> extends FieldSlotsComponentsProps {
48
48
  textField?: SlotComponentProps<typeof TextField, {}, SingleInputDateRangeFieldOwnerState<TDate>>;
49
49
  }
@@ -2,12 +2,13 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
- _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
5
+ _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
9
9
  import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
+ import { useClearableField } from '@mui/x-date-pickers/hooks';
11
12
  import { refType } from '@mui/utils';
12
13
  import { useSingleInputDateTimeRangeField } from './useSingleInputDateTimeRangeField';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -51,13 +52,28 @@ const SingleInputDateTimeRangeField = /*#__PURE__*/React.forwardRef(function Sin
51
52
  onPaste,
52
53
  onKeyDown,
53
54
  inputMode,
54
- readOnly
55
+ readOnly,
56
+ clearable,
57
+ onClear
55
58
  } = _useSingleInputDateTi,
56
59
  fieldProps = _objectWithoutPropertiesLoose(_useSingleInputDateTi, _excluded3);
60
+ const {
61
+ InputProps: ProcessedInputProps,
62
+ fieldProps: processedFieldProps
63
+ } = useClearableField({
64
+ onClear,
65
+ clearable,
66
+ fieldProps,
67
+ InputProps: fieldProps.InputProps,
68
+ slots,
69
+ slotProps,
70
+ components,
71
+ componentsProps
72
+ });
57
73
  return /*#__PURE__*/_jsx(TextField, _extends({
58
74
  ref: ref
59
- }, fieldProps, {
60
- InputProps: _extends({}, fieldProps.InputProps, {
75
+ }, processedFieldProps, {
76
+ InputProps: _extends({}, ProcessedInputProps, {
61
77
  readOnly
62
78
  }),
63
79
  inputProps: _extends({}, fieldProps.inputProps, {
@@ -85,6 +101,11 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
85
101
  */
86
102
  autoFocus: PropTypes.bool,
87
103
  className: PropTypes.string,
104
+ /**
105
+ * If `true`, a clear button will be shown in the field allowing value clearing.
106
+ * @default false
107
+ */
108
+ clearable: PropTypes.bool,
88
109
  /**
89
110
  * The color of the component.
90
111
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -241,6 +262,10 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
241
262
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
242
263
  */
243
264
  onChange: PropTypes.func,
265
+ /**
266
+ * Callback fired when the clear button is clicked.
267
+ */
268
+ onClear: PropTypes.func,
244
269
  /**
245
270
  * Callback fired when the error associated to the current value changes.
246
271
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -295,6 +320,9 @@ process.env.NODE_ENV !== "production" ? SingleInputDateTimeRangeField.propTypes
295
320
  shouldDisableClock: PropTypes.func,
296
321
  /**
297
322
  * Disable specific date.
323
+ *
324
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
325
+ *
298
326
  * @template TDate
299
327
  * @param {TDate} day The date to test.
300
328
  * @param {string} position The date to test, 'start' or 'end'.
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import TextField from '@mui/material/TextField';
4
4
  import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals/models/fields';
5
- import { UncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
5
+ import { UncapitalizeObjectKeys, FieldSlotsComponents, FieldSlotsComponentsProps } from '@mui/x-date-pickers/internals';
6
6
  import { UseDateTimeRangeFieldDefaultizedProps, UseDateTimeRangeFieldProps } from '../internals/models';
7
7
  export interface UseSingleInputDateTimeRangeFieldParams<TDate, TChildProps extends {}> {
8
8
  props: UseSingleInputDateTimeRangeFieldComponentProps<TDate, TChildProps>;
@@ -37,7 +37,7 @@ export interface SingleInputDateTimeRangeFieldProps<TDate> extends UseSingleInpu
37
37
  slotProps?: SingleInputDateTimeRangeFieldSlotsComponentsProps<TDate>;
38
38
  }
39
39
  export type SingleInputDateTimeRangeFieldOwnerState<TDate> = SingleInputDateTimeRangeFieldProps<TDate>;
40
- export interface SingleInputDateTimeRangeFieldSlotsComponent {
40
+ export interface SingleInputDateTimeRangeFieldSlotsComponent extends FieldSlotsComponents {
41
41
  /**
42
42
  * Form control with an input to render the value.
43
43
  * Receives the same props as `@mui/material/TextField`.
@@ -45,6 +45,6 @@ export interface SingleInputDateTimeRangeFieldSlotsComponent {
45
45
  */
46
46
  TextField?: React.ElementType;
47
47
  }
48
- export interface SingleInputDateTimeRangeFieldSlotsComponentsProps<TDate> {
48
+ export interface SingleInputDateTimeRangeFieldSlotsComponentsProps<TDate> extends FieldSlotsComponentsProps {
49
49
  textField?: SlotComponentProps<typeof TextField, {}, SingleInputDateTimeRangeFieldOwnerState<TDate>>;
50
50
  }
@@ -2,9 +2,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
- _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
5
+ _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
+ import { useClearableField } from '@mui/x-date-pickers/hooks';
8
9
  import MuiTextField from '@mui/material/TextField';
9
10
  import { useThemeProps } from '@mui/material/styles';
10
11
  import { useSlotProps } from '@mui/base/utils';
@@ -51,13 +52,28 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
51
52
  onPaste,
52
53
  onKeyDown,
53
54
  inputMode,
54
- readOnly
55
+ readOnly,
56
+ clearable,
57
+ onClear
55
58
  } = _useSingleInputTimeRa,
56
59
  fieldProps = _objectWithoutPropertiesLoose(_useSingleInputTimeRa, _excluded3);
60
+ const {
61
+ InputProps: ProcessedInputProps,
62
+ fieldProps: processedFieldProps
63
+ } = useClearableField({
64
+ onClear,
65
+ clearable,
66
+ fieldProps,
67
+ InputProps: fieldProps.InputProps,
68
+ slots,
69
+ slotProps,
70
+ components,
71
+ componentsProps
72
+ });
57
73
  return /*#__PURE__*/_jsx(TextField, _extends({
58
74
  ref: ref
59
- }, fieldProps, {
60
- InputProps: _extends({}, fieldProps.InputProps, {
75
+ }, processedFieldProps, {
76
+ InputProps: _extends({}, ProcessedInputProps, {
61
77
  readOnly
62
78
  }),
63
79
  inputProps: _extends({}, fieldProps.inputProps, {
@@ -85,6 +101,11 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
85
101
  */
86
102
  autoFocus: PropTypes.bool,
87
103
  className: PropTypes.string,
104
+ /**
105
+ * If `true`, a clear button will be shown in the field allowing value clearing.
106
+ * @default false
107
+ */
108
+ clearable: PropTypes.bool,
88
109
  /**
89
110
  * The color of the component.
90
111
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -225,6 +246,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
225
246
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
226
247
  */
227
248
  onChange: PropTypes.func,
249
+ /**
250
+ * Callback fired when the clear button is clicked.
251
+ */
252
+ onClear: PropTypes.func,
228
253
  /**
229
254
  * Callback fired when the error associated to the current value changes.
230
255
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import TextField from '@mui/material/TextField';
4
4
  import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals/models/fields';
5
- import { UncapitalizeObjectKeys } from '@mui/x-date-pickers/internals';
5
+ import { UncapitalizeObjectKeys, FieldSlotsComponents, FieldSlotsComponentsProps } from '@mui/x-date-pickers/internals';
6
6
  import { UseTimeRangeFieldDefaultizedProps, UseTimeRangeFieldProps } from '../internals/models';
7
7
  export interface UseSingleInputTimeRangeFieldParams<TDate, TChildProps extends {}> {
8
8
  props: UseSingleInputTimeRangeFieldComponentProps<TDate, TChildProps>;
@@ -37,7 +37,7 @@ export interface SingleInputTimeRangeFieldProps<TDate> extends UseSingleInputTim
37
37
  slotProps?: SingleInputTimeRangeFieldSlotsComponentsProps<TDate>;
38
38
  }
39
39
  export type SingleInputTimeRangeFieldOwnerState<TDate> = SingleInputTimeRangeFieldProps<TDate>;
40
- export interface SingleInputTimeRangeFieldSlotsComponent {
40
+ export interface SingleInputTimeRangeFieldSlotsComponent extends FieldSlotsComponents {
41
41
  /**
42
42
  * Form control with an input to render the value.
43
43
  * Receives the same props as `@mui/material/TextField`.
@@ -45,6 +45,6 @@ export interface SingleInputTimeRangeFieldSlotsComponent {
45
45
  */
46
46
  TextField?: React.ElementType;
47
47
  }
48
- export interface SingleInputTimeRangeFieldSlotsComponentsProps<TDate> {
48
+ export interface SingleInputTimeRangeFieldSlotsComponentsProps<TDate> extends FieldSlotsComponentsProps {
49
49
  textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldOwnerState<TDate>>;
50
50
  }