@mui/x-date-pickers 8.0.0-beta.0 → 8.0.0-beta.2

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 (237) hide show
  1. package/CHANGELOG.md +171 -0
  2. package/DateCalendar/DateCalendar.js +4 -8
  3. package/DateCalendar/DayCalendar.d.ts +3 -7
  4. package/DateCalendar/DayCalendar.js +18 -10
  5. package/DateCalendar/index.d.ts +0 -1
  6. package/DateField/useDateField.d.ts +1 -1
  7. package/DateField/useDateField.js +2 -16
  8. package/DatePicker/DatePicker.js +1 -0
  9. package/DatePicker/shared.js +3 -9
  10. package/DateTimeField/useDateTimeField.d.ts +1 -1
  11. package/DateTimeField/useDateTimeField.js +2 -16
  12. package/DateTimePicker/DateTimePicker.js +1 -0
  13. package/DateTimePicker/shared.js +3 -13
  14. package/DesktopDatePicker/DesktopDatePicker.js +1 -0
  15. package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -0
  16. package/DesktopTimePicker/DesktopTimePicker.js +1 -0
  17. package/MobileDatePicker/MobileDatePicker.js +1 -0
  18. package/MobileDateTimePicker/MobileDateTimePicker.js +1 -0
  19. package/MobileTimePicker/MobileTimePicker.js +1 -0
  20. package/MonthCalendar/MonthCalendar.js +4 -9
  21. package/PickersDay/PickersDay.d.ts +1 -72
  22. package/PickersDay/PickersDay.js +30 -28
  23. package/PickersDay/PickersDay.types.d.ts +114 -0
  24. package/PickersDay/PickersDay.types.js +5 -0
  25. package/PickersDay/index.d.ts +1 -1
  26. package/PickersDay/usePickerDayOwnerState.d.ts +14 -0
  27. package/PickersDay/usePickerDayOwnerState.js +40 -0
  28. package/PickersSectionList/PickersSectionList.d.ts +1 -1
  29. package/PickersSectionList/PickersSectionList.types.d.ts +2 -6
  30. package/TimeField/useTimeField.d.ts +1 -1
  31. package/TimeField/useTimeField.js +2 -16
  32. package/TimePicker/TimePicker.js +1 -0
  33. package/TimePicker/shared.js +3 -3
  34. package/YearCalendar/YearCalendar.js +4 -10
  35. package/esm/DateCalendar/DateCalendar.js +6 -10
  36. package/esm/DateCalendar/DayCalendar.d.ts +3 -7
  37. package/esm/DateCalendar/DayCalendar.js +18 -10
  38. package/esm/DateCalendar/index.d.ts +0 -1
  39. package/esm/DateField/useDateField.d.ts +1 -1
  40. package/esm/DateField/useDateField.js +3 -17
  41. package/esm/DatePicker/DatePicker.js +1 -0
  42. package/esm/DatePicker/shared.js +3 -9
  43. package/esm/DateTimeField/useDateTimeField.d.ts +1 -1
  44. package/esm/DateTimeField/useDateTimeField.js +3 -17
  45. package/esm/DateTimePicker/DateTimePicker.js +1 -0
  46. package/esm/DateTimePicker/shared.js +4 -14
  47. package/esm/DesktopDatePicker/DesktopDatePicker.js +1 -0
  48. package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -0
  49. package/esm/DesktopTimePicker/DesktopTimePicker.js +1 -0
  50. package/esm/MobileDatePicker/MobileDatePicker.js +1 -0
  51. package/esm/MobileDateTimePicker/MobileDateTimePicker.js +1 -0
  52. package/esm/MobileTimePicker/MobileTimePicker.js +1 -0
  53. package/esm/MonthCalendar/MonthCalendar.js +6 -11
  54. package/esm/PickersDay/PickersDay.d.ts +1 -72
  55. package/esm/PickersDay/PickersDay.js +30 -28
  56. package/esm/PickersDay/PickersDay.types.d.ts +114 -0
  57. package/esm/PickersDay/PickersDay.types.js +1 -0
  58. package/esm/PickersDay/index.d.ts +1 -1
  59. package/esm/PickersDay/usePickerDayOwnerState.d.ts +14 -0
  60. package/esm/PickersDay/usePickerDayOwnerState.js +32 -0
  61. package/esm/PickersSectionList/PickersSectionList.d.ts +1 -1
  62. package/esm/PickersSectionList/PickersSectionList.types.d.ts +2 -6
  63. package/esm/TimeField/useTimeField.d.ts +1 -1
  64. package/esm/TimeField/useTimeField.js +3 -17
  65. package/esm/TimePicker/TimePicker.js +1 -0
  66. package/esm/TimePicker/shared.js +3 -3
  67. package/esm/YearCalendar/YearCalendar.js +5 -11
  68. package/esm/hooks/useSplitFieldProps.d.ts +1 -1
  69. package/esm/index.js +1 -1
  70. package/esm/internals/components/PickerFieldUI.d.ts +5 -5
  71. package/esm/internals/hooks/useField/buildSectionsFromFormat.d.ts +2 -2
  72. package/esm/internals/hooks/useField/buildSectionsFromFormat.js +9 -9
  73. package/esm/internals/hooks/useField/index.d.ts +1 -1
  74. package/esm/internals/hooks/useField/syncSelectionToDOM.d.ts +9 -0
  75. package/esm/internals/hooks/useField/syncSelectionToDOM.js +50 -0
  76. package/esm/internals/hooks/useField/useField.d.ts +2 -4
  77. package/esm/internals/hooks/useField/useField.js +5 -229
  78. package/esm/internals/hooks/useField/useField.types.d.ts +55 -68
  79. package/esm/internals/hooks/useField/useField.utils.d.ts +3 -8
  80. package/esm/internals/hooks/useField/useField.utils.js +7 -149
  81. package/esm/internals/hooks/useField/useFieldCharacterEditing.d.ts +19 -26
  82. package/esm/internals/hooks/useField/useFieldCharacterEditing.js +42 -60
  83. package/esm/internals/hooks/useField/useFieldHiddenInputProps.d.ts +20 -0
  84. package/esm/internals/hooks/useField/useFieldHiddenInputProps.js +31 -0
  85. package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +8 -10
  86. package/esm/internals/hooks/useField/useFieldRootHandleKeyDown.d.ts +16 -0
  87. package/esm/internals/hooks/useField/useFieldRootHandleKeyDown.js +205 -0
  88. package/esm/internals/hooks/useField/useFieldRootProps.d.ts +32 -0
  89. package/esm/internals/hooks/useField/useFieldRootProps.js +150 -0
  90. package/esm/internals/hooks/useField/useFieldSectionContainerProps.d.ts +15 -0
  91. package/esm/internals/hooks/useField/useFieldSectionContainerProps.js +29 -0
  92. package/esm/internals/hooks/useField/useFieldSectionContentProps.d.ts +23 -0
  93. package/esm/internals/hooks/useField/useFieldSectionContentProps.js +226 -0
  94. package/esm/internals/hooks/useField/useFieldState.d.ts +23 -13
  95. package/esm/internals/hooks/useField/useFieldState.js +103 -30
  96. package/esm/internals/hooks/useField/useFieldV6TextField.d.ts +3 -3
  97. package/esm/internals/hooks/useField/useFieldV6TextField.js +202 -135
  98. package/esm/internals/hooks/useField/useFieldV7TextField.d.ts +3 -2
  99. package/esm/internals/hooks/useField/useFieldV7TextField.js +200 -367
  100. package/esm/internals/hooks/usePicker/usePicker.types.d.ts +1 -0
  101. package/esm/internals/index.d.ts +6 -5
  102. package/esm/internals/index.js +4 -3
  103. package/esm/locales/deDE.js +2 -3
  104. package/esm/managers/useDateManager.d.ts +4 -13
  105. package/esm/managers/useDateManager.js +21 -31
  106. package/esm/managers/useDateTimeManager.d.ts +4 -13
  107. package/esm/managers/useDateTimeManager.js +26 -36
  108. package/esm/managers/useTimeManager.d.ts +4 -13
  109. package/esm/managers/useTimeManager.js +17 -27
  110. package/esm/models/fields.d.ts +2 -2
  111. package/esm/models/manager.d.ts +6 -10
  112. package/esm/validation/validateDate.js +3 -4
  113. package/hooks/useSplitFieldProps.d.ts +1 -1
  114. package/index.js +1 -1
  115. package/internals/components/PickerFieldUI.d.ts +5 -5
  116. package/internals/hooks/useField/buildSectionsFromFormat.d.ts +2 -2
  117. package/internals/hooks/useField/buildSectionsFromFormat.js +9 -9
  118. package/internals/hooks/useField/index.d.ts +1 -1
  119. package/internals/hooks/useField/syncSelectionToDOM.d.ts +9 -0
  120. package/internals/hooks/useField/syncSelectionToDOM.js +56 -0
  121. package/internals/hooks/useField/useField.d.ts +2 -4
  122. package/internals/hooks/useField/useField.js +5 -231
  123. package/internals/hooks/useField/useField.types.d.ts +55 -68
  124. package/internals/hooks/useField/useField.utils.d.ts +3 -8
  125. package/internals/hooks/useField/useField.utils.js +9 -154
  126. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +19 -26
  127. package/internals/hooks/useField/useFieldCharacterEditing.js +41 -59
  128. package/internals/hooks/useField/useFieldHiddenInputProps.d.ts +20 -0
  129. package/internals/hooks/useField/useFieldHiddenInputProps.js +39 -0
  130. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +8 -10
  131. package/internals/hooks/useField/useFieldRootHandleKeyDown.d.ts +16 -0
  132. package/internals/hooks/useField/useFieldRootHandleKeyDown.js +211 -0
  133. package/internals/hooks/useField/useFieldRootProps.d.ts +32 -0
  134. package/internals/hooks/useField/useFieldRootProps.js +156 -0
  135. package/internals/hooks/useField/useFieldSectionContainerProps.d.ts +15 -0
  136. package/internals/hooks/useField/useFieldSectionContainerProps.js +37 -0
  137. package/internals/hooks/useField/useFieldSectionContentProps.d.ts +23 -0
  138. package/internals/hooks/useField/useFieldSectionContentProps.js +234 -0
  139. package/internals/hooks/useField/useFieldState.d.ts +23 -13
  140. package/internals/hooks/useField/useFieldState.js +102 -29
  141. package/internals/hooks/useField/useFieldV6TextField.d.ts +3 -3
  142. package/internals/hooks/useField/useFieldV6TextField.js +202 -135
  143. package/internals/hooks/useField/useFieldV7TextField.d.ts +3 -2
  144. package/internals/hooks/useField/useFieldV7TextField.js +200 -367
  145. package/internals/hooks/usePicker/usePicker.types.d.ts +1 -0
  146. package/internals/index.d.ts +6 -5
  147. package/internals/index.js +25 -18
  148. package/locales/deDE.js +2 -3
  149. package/managers/useDateManager.d.ts +4 -13
  150. package/managers/useDateManager.js +21 -31
  151. package/managers/useDateTimeManager.d.ts +4 -13
  152. package/managers/useDateTimeManager.js +26 -36
  153. package/managers/useTimeManager.d.ts +4 -13
  154. package/managers/useTimeManager.js +18 -28
  155. package/models/fields.d.ts +2 -2
  156. package/models/manager.d.ts +6 -10
  157. package/modern/DateCalendar/DateCalendar.js +6 -10
  158. package/modern/DateCalendar/DayCalendar.d.ts +3 -7
  159. package/modern/DateCalendar/DayCalendar.js +18 -10
  160. package/modern/DateCalendar/index.d.ts +0 -1
  161. package/modern/DateField/useDateField.d.ts +1 -1
  162. package/modern/DateField/useDateField.js +3 -17
  163. package/modern/DatePicker/DatePicker.js +1 -0
  164. package/modern/DatePicker/shared.js +3 -9
  165. package/modern/DateTimeField/useDateTimeField.d.ts +1 -1
  166. package/modern/DateTimeField/useDateTimeField.js +3 -17
  167. package/modern/DateTimePicker/DateTimePicker.js +1 -0
  168. package/modern/DateTimePicker/shared.js +4 -14
  169. package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -0
  170. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -0
  171. package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -0
  172. package/modern/MobileDatePicker/MobileDatePicker.js +1 -0
  173. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -0
  174. package/modern/MobileTimePicker/MobileTimePicker.js +1 -0
  175. package/modern/MonthCalendar/MonthCalendar.js +6 -11
  176. package/modern/PickersDay/PickersDay.d.ts +1 -72
  177. package/modern/PickersDay/PickersDay.js +30 -28
  178. package/modern/PickersDay/PickersDay.types.d.ts +114 -0
  179. package/modern/PickersDay/PickersDay.types.js +1 -0
  180. package/modern/PickersDay/index.d.ts +1 -1
  181. package/modern/PickersDay/usePickerDayOwnerState.d.ts +14 -0
  182. package/modern/PickersDay/usePickerDayOwnerState.js +32 -0
  183. package/modern/PickersSectionList/PickersSectionList.d.ts +1 -1
  184. package/modern/PickersSectionList/PickersSectionList.types.d.ts +2 -6
  185. package/modern/TimeField/useTimeField.d.ts +1 -1
  186. package/modern/TimeField/useTimeField.js +3 -17
  187. package/modern/TimePicker/TimePicker.js +1 -0
  188. package/modern/TimePicker/shared.js +3 -3
  189. package/modern/YearCalendar/YearCalendar.js +5 -11
  190. package/modern/hooks/useSplitFieldProps.d.ts +1 -1
  191. package/modern/index.js +1 -1
  192. package/modern/internals/components/PickerFieldUI.d.ts +5 -5
  193. package/modern/internals/hooks/useField/buildSectionsFromFormat.d.ts +2 -2
  194. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +9 -9
  195. package/modern/internals/hooks/useField/index.d.ts +1 -1
  196. package/modern/internals/hooks/useField/syncSelectionToDOM.d.ts +9 -0
  197. package/modern/internals/hooks/useField/syncSelectionToDOM.js +50 -0
  198. package/modern/internals/hooks/useField/useField.d.ts +2 -4
  199. package/modern/internals/hooks/useField/useField.js +5 -229
  200. package/modern/internals/hooks/useField/useField.types.d.ts +55 -68
  201. package/modern/internals/hooks/useField/useField.utils.d.ts +3 -8
  202. package/modern/internals/hooks/useField/useField.utils.js +7 -149
  203. package/modern/internals/hooks/useField/useFieldCharacterEditing.d.ts +19 -26
  204. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +42 -60
  205. package/modern/internals/hooks/useField/useFieldHiddenInputProps.d.ts +20 -0
  206. package/modern/internals/hooks/useField/useFieldHiddenInputProps.js +31 -0
  207. package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +8 -10
  208. package/modern/internals/hooks/useField/useFieldRootHandleKeyDown.d.ts +16 -0
  209. package/modern/internals/hooks/useField/useFieldRootHandleKeyDown.js +205 -0
  210. package/modern/internals/hooks/useField/useFieldRootProps.d.ts +32 -0
  211. package/modern/internals/hooks/useField/useFieldRootProps.js +150 -0
  212. package/modern/internals/hooks/useField/useFieldSectionContainerProps.d.ts +15 -0
  213. package/modern/internals/hooks/useField/useFieldSectionContainerProps.js +29 -0
  214. package/modern/internals/hooks/useField/useFieldSectionContentProps.d.ts +23 -0
  215. package/modern/internals/hooks/useField/useFieldSectionContentProps.js +226 -0
  216. package/modern/internals/hooks/useField/useFieldState.d.ts +23 -13
  217. package/modern/internals/hooks/useField/useFieldState.js +103 -30
  218. package/modern/internals/hooks/useField/useFieldV6TextField.d.ts +3 -3
  219. package/modern/internals/hooks/useField/useFieldV6TextField.js +202 -135
  220. package/modern/internals/hooks/useField/useFieldV7TextField.d.ts +3 -2
  221. package/modern/internals/hooks/useField/useFieldV7TextField.js +200 -367
  222. package/modern/internals/hooks/usePicker/usePicker.types.d.ts +1 -0
  223. package/modern/internals/index.d.ts +6 -5
  224. package/modern/internals/index.js +4 -3
  225. package/modern/locales/deDE.js +2 -3
  226. package/modern/managers/useDateManager.d.ts +4 -13
  227. package/modern/managers/useDateManager.js +21 -31
  228. package/modern/managers/useDateTimeManager.d.ts +4 -13
  229. package/modern/managers/useDateTimeManager.js +26 -36
  230. package/modern/managers/useTimeManager.d.ts +4 -13
  231. package/modern/managers/useTimeManager.js +17 -27
  232. package/modern/models/fields.d.ts +2 -2
  233. package/modern/models/manager.d.ts +6 -10
  234. package/modern/validation/validateDate.js +3 -4
  235. package/package.json +2 -2
  236. package/tsconfig.build.tsbuildinfo +1 -1
  237. package/validation/validateDate.js +3 -4
@@ -159,18 +159,6 @@ Object.defineProperty(exports, "getActiveElement", {
159
159
  return _utils.getActiveElement;
160
160
  }
161
161
  });
162
- Object.defineProperty(exports, "getDateFieldInternalPropsDefaults", {
163
- enumerable: true,
164
- get: function () {
165
- return _useDateManager.getDateFieldInternalPropsDefaults;
166
- }
167
- });
168
- Object.defineProperty(exports, "getDateTimeFieldInternalPropsDefaults", {
169
- enumerable: true,
170
- get: function () {
171
- return _useDateTimeManager.getDateTimeFieldInternalPropsDefaults;
172
- }
173
- });
174
162
  Object.defineProperty(exports, "getDefaultReferenceDate", {
175
163
  enumerable: true,
176
164
  get: function () {
@@ -183,12 +171,6 @@ Object.defineProperty(exports, "getMeridiem", {
183
171
  return _timeUtils.getMeridiem;
184
172
  }
185
173
  });
186
- Object.defineProperty(exports, "getTimeFieldInternalPropsDefaults", {
187
- enumerable: true,
188
- get: function () {
189
- return _useTimeManager.getTimeFieldInternalPropsDefaults;
190
- }
191
- });
192
174
  Object.defineProperty(exports, "getTodayDate", {
193
175
  enumerable: true,
194
176
  get: function () {
@@ -285,6 +267,24 @@ Object.defineProperty(exports, "resolveTimeViewsResponse", {
285
267
  return _dateTimeUtils.resolveTimeViewsResponse;
286
268
  }
287
269
  });
270
+ Object.defineProperty(exports, "useApplyDefaultValuesToDateTimeValidationProps", {
271
+ enumerable: true,
272
+ get: function () {
273
+ return _useDateTimeManager.useApplyDefaultValuesToDateTimeValidationProps;
274
+ }
275
+ });
276
+ Object.defineProperty(exports, "useApplyDefaultValuesToDateValidationProps", {
277
+ enumerable: true,
278
+ get: function () {
279
+ return _useDateManager.useApplyDefaultValuesToDateValidationProps;
280
+ }
281
+ });
282
+ Object.defineProperty(exports, "useApplyDefaultValuesToTimeValidationProps", {
283
+ enumerable: true,
284
+ get: function () {
285
+ return _useTimeManager.useApplyDefaultValuesToTimeValidationProps;
286
+ }
287
+ });
288
288
  Object.defineProperty(exports, "useCalendarState", {
289
289
  enumerable: true,
290
290
  get: function () {
@@ -363,6 +363,12 @@ Object.defineProperty(exports, "usePicker", {
363
363
  return _usePicker.usePicker;
364
364
  }
365
365
  });
366
+ Object.defineProperty(exports, "usePickerDayOwnerState", {
367
+ enumerable: true,
368
+ get: function () {
369
+ return _usePickerDayOwnerState.usePickerDayOwnerState;
370
+ }
371
+ });
366
372
  Object.defineProperty(exports, "usePickerPrivateContext", {
367
373
  enumerable: true,
368
374
  get: function () {
@@ -440,6 +446,7 @@ var _views = require("./utils/views");
440
446
  var _DayCalendar = require("../DateCalendar/DayCalendar");
441
447
  var _useCalendarState = require("../DateCalendar/useCalendarState");
442
448
  var _DateTimePickerToolbar = require("../DateTimePicker/DateTimePickerToolbar");
449
+ var _usePickerDayOwnerState = require("../PickersDay/usePickerDayOwnerState");
443
450
  var _useDateManager = require("../managers/useDateManager");
444
451
  var _useTimeManager = require("../managers/useTimeManager");
445
452
  var _useDateTimeManager = require("../managers/useDateTimeManager");
package/locales/deDE.js CHANGED
@@ -37,8 +37,7 @@ const deDEPickers = {
37
37
  dateTimePickerToolbarTitle: 'Datum & Uhrzeit auswählen',
38
38
  timePickerToolbarTitle: 'Uhrzeit auswählen',
39
39
  dateRangePickerToolbarTitle: 'Datumsbereich auswählen',
40
- // timeRangePickerToolbarTitle: 'Select time range',
41
-
40
+ timeRangePickerToolbarTitle: 'Zeitspanne auswählen',
42
41
  // Clock labels
43
42
  clockLabelText: (view, formattedTime) => `${timeViews[view] ?? view} auswählen. ${!formattedTime ? 'Keine Uhrzeit ausgewählt' : `Gewählte Uhrzeit ist ${formattedTime}`}`,
44
43
  hoursClockNumberText: hours => `${hours} ${timeViews.hours}`,
@@ -54,7 +53,7 @@ const deDEPickers = {
54
53
  // Open Picker labels
55
54
  openDatePickerDialogue: formattedDate => formattedDate ? `Datum auswählen, gewähltes Datum ist ${formattedDate}` : 'Datum auswählen',
56
55
  openTimePickerDialogue: formattedTime => formattedTime ? `Uhrzeit auswählen, gewählte Uhrzeit ist ${formattedTime}` : 'Uhrzeit auswählen',
57
- // openRangePickerDialogue: formattedRange => formattedRange ? `Choose range, selected range is ${formattedRange}` : 'Choose range',
56
+ openRangePickerDialogue: formattedRange => formattedRange ? `Zeitspanne auswählen, die aktuell ausgewählte Zeitspanne ist ${formattedRange}` : 'Zeitspanne auswählen',
58
57
  fieldClearLabel: 'Wert leeren',
59
58
  // Table labels
60
59
  timeTableLabel: 'Uhrzeit auswählen',
@@ -1,23 +1,14 @@
1
1
  import type { MakeOptional } from '@mui/x-internals/types';
2
2
  import { PickerManager, DateValidationError } from "../models/index.js";
3
3
  import { UseFieldInternalProps } from "../internals/hooks/useField/index.js";
4
- import { MuiPickersAdapterContextValue } from "../LocalizationProvider/LocalizationProvider.js";
5
- import { ExportedValidateDateProps, ValidateDatePropsToDefault, ValidateDateProps } from "../validation/validateDate.js";
6
- import { PickerManagerFieldInternalPropsWithDefaults, PickerValue } from "../internals/models/index.js";
4
+ import { ExportedValidateDateProps, ValidateDateProps } from "../validation/validateDate.js";
5
+ import { PickerValue } from "../internals/models/index.js";
7
6
  export declare function useDateManager<TEnableAccessibleFieldDOMStructure extends boolean = true>(parameters?: UseDateManagerParameters<TEnableAccessibleFieldDOMStructure>): UseDateManagerReturnValue<TEnableAccessibleFieldDOMStructure>;
8
- /**
9
- * Private utility function to get the default internal props for the fields with date editing.
10
- * Is used by the `useDateManager` and `useDateRangeManager` hooks.
11
- */
12
- export declare function getDateFieldInternalPropsDefaults(parameters: GetDateFieldInternalPropsDefaultsParameters): GetDateFieldInternalPropsDefaultsReturnValue;
7
+ type SharedDateAndDateRangeValidationProps = 'disablePast' | 'disableFuture' | 'minDate' | 'maxDate';
8
+ export declare function useApplyDefaultValuesToDateValidationProps(props: Pick<ExportedValidateDateProps, SharedDateAndDateRangeValidationProps>): Pick<ValidateDateProps, SharedDateAndDateRangeValidationProps>;
13
9
  export interface UseDateManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> {
14
10
  enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
15
11
  }
16
12
  export type UseDateManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerValue, TEnableAccessibleFieldDOMStructure, DateValidationError, ValidateDateProps, DateManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>>;
17
13
  export interface DateManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateValidationError>, 'format'>, ExportedValidateDateProps {}
18
- type DateManagerFieldPropsToDefault = 'format' | ValidateDatePropsToDefault;
19
- interface GetDateFieldInternalPropsDefaultsParameters extends Pick<MuiPickersAdapterContextValue, 'defaultDates' | 'utils'> {
20
- internalProps: Pick<DateManagerFieldInternalProps<true>, DateManagerFieldPropsToDefault>;
21
- }
22
- interface GetDateFieldInternalPropsDefaultsReturnValue extends Pick<PickerManagerFieldInternalPropsWithDefaults<UseDateManagerReturnValue<true>>, DateManagerFieldPropsToDefault> {}
23
14
  export {};
@@ -6,7 +6,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- exports.getDateFieldInternalPropsDefaults = getDateFieldInternalPropsDefaults;
9
+ exports.useApplyDefaultValuesToDateValidationProps = useApplyDefaultValuesToDateValidationProps;
10
10
  exports.useDateManager = useDateManager;
11
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
12
  var React = _interopRequireWildcard(require("react"));
@@ -25,42 +25,32 @@ function useDateManager(parameters = {}) {
25
25
  internal_valueManager: _valueManagers.singleItemValueManager,
26
26
  internal_fieldValueManager: _valueManagers.singleItemFieldValueManager,
27
27
  internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
28
- internal_applyDefaultsToFieldInternalProps: ({
29
- internalProps,
30
- utils,
31
- defaultDates
32
- }) => (0, _extends2.default)({}, internalProps, getDateFieldInternalPropsDefaults({
33
- defaultDates,
34
- utils,
35
- internalProps
36
- })),
28
+ internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToDateFieldInternalProps,
37
29
  internal_useOpenPickerButtonAriaLabel: useOpenPickerButtonAriaLabel
38
30
  }), [enableAccessibleFieldDOMStructure]);
39
31
  }
40
- function useOpenPickerButtonAriaLabel() {
32
+ function useOpenPickerButtonAriaLabel(value) {
41
33
  const utils = (0, _useUtils.useUtils)();
42
34
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
43
- return React.useCallback(value => {
35
+ return React.useMemo(() => {
44
36
  const formattedValue = utils.isValid(value) ? utils.format(value, 'fullDate') : null;
45
37
  return translations.openDatePickerDialogue(formattedValue);
46
- }, [translations, utils]);
38
+ }, [value, translations, utils]);
47
39
  }
48
-
49
- /**
50
- * Private utility function to get the default internal props for the fields with date editing.
51
- * Is used by the `useDateManager` and `useDateRangeManager` hooks.
52
- */
53
- function getDateFieldInternalPropsDefaults(parameters) {
54
- const {
55
- defaultDates,
56
- utils,
57
- internalProps
58
- } = parameters;
59
- return {
60
- format: internalProps.format ?? utils.formats.keyboardDate,
61
- disablePast: internalProps.disablePast ?? false,
62
- disableFuture: internalProps.disableFuture ?? false,
63
- minDate: (0, _dateUtils.applyDefaultDate)(utils, internalProps.minDate, defaultDates.minDate),
64
- maxDate: (0, _dateUtils.applyDefaultDate)(utils, internalProps.maxDate, defaultDates.maxDate)
65
- };
40
+ function useApplyDefaultValuesToDateFieldInternalProps(internalProps) {
41
+ const utils = (0, _useUtils.useUtils)();
42
+ const validationProps = useApplyDefaultValuesToDateValidationProps(internalProps);
43
+ return React.useMemo(() => (0, _extends2.default)({}, internalProps, validationProps, {
44
+ format: internalProps.format ?? utils.formats.keyboardDate
45
+ }), [internalProps, validationProps, utils]);
46
+ }
47
+ function useApplyDefaultValuesToDateValidationProps(props) {
48
+ const utils = (0, _useUtils.useUtils)();
49
+ const defaultDates = (0, _useUtils.useDefaultDates)();
50
+ return React.useMemo(() => ({
51
+ disablePast: props.disablePast ?? false,
52
+ disableFuture: props.disableFuture ?? false,
53
+ minDate: (0, _dateUtils.applyDefaultDate)(utils, props.minDate, defaultDates.minDate),
54
+ maxDate: (0, _dateUtils.applyDefaultDate)(utils, props.maxDate, defaultDates.maxDate)
55
+ }), [props.minDate, props.maxDate, props.disableFuture, props.disablePast, utils, defaultDates]);
66
56
  }
@@ -1,24 +1,15 @@
1
1
  import type { MakeOptional } from '@mui/x-internals/types';
2
2
  import { PickerManager, DateTimeValidationError } from "../models/index.js";
3
3
  import { UseFieldInternalProps } from "../internals/hooks/useField/index.js";
4
- import { MuiPickersAdapterContextValue } from "../LocalizationProvider/LocalizationProvider.js";
5
4
  import { AmPmProps } from "../internals/models/props/time.js";
6
- import { ExportedValidateDateTimeProps, ValidateDateTimeProps, ValidateDateTimePropsToDefault } from "../validation/validateDateTime.js";
7
- import { PickerManagerFieldInternalPropsWithDefaults, PickerValue } from "../internals/models/index.js";
5
+ import { ExportedValidateDateTimeProps, ValidateDateTimeProps } from "../validation/validateDateTime.js";
6
+ import { PickerValue } from "../internals/models/index.js";
8
7
  export declare function useDateTimeManager<TEnableAccessibleFieldDOMStructure extends boolean = true>(parameters?: UseDateTimeManagerParameters<TEnableAccessibleFieldDOMStructure>): UseDateTimeManagerReturnValue<TEnableAccessibleFieldDOMStructure>;
9
- /**
10
- * Private utility function to get the default internal props for the field with date time editing.
11
- * Is used by the `useDateTimeManager` and `useDateTimeRangeManager` hooks.
12
- */
13
- export declare function getDateTimeFieldInternalPropsDefaults(parameters: GetDateTimeFieldInternalPropsDefaultsParameters): GetDateTimeFieldInternalPropsDefaultsReturnValue;
8
+ type SharedDateTimeAndDateTimeRangeValidationProps = 'disablePast' | 'disableFuture' | 'minTime' | 'maxTime' | 'minDate' | 'maxDate';
9
+ export declare function useApplyDefaultValuesToDateTimeValidationProps(props: Pick<ExportedValidateDateTimeProps, SharedDateTimeAndDateTimeRangeValidationProps | 'minDateTime' | 'maxDateTime'>): Pick<ValidateDateTimeProps, SharedDateTimeAndDateTimeRangeValidationProps>;
14
10
  export interface UseDateTimeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> {
15
11
  enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
16
12
  }
17
13
  export type UseDateTimeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError, ValidateDateTimeProps, DateTimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>>;
18
14
  export interface DateTimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError>, 'format'>, ExportedValidateDateTimeProps, AmPmProps {}
19
- type DateTimeManagerFieldPropsToDefault = 'format' | 'minTime' | 'maxTime' | ValidateDateTimePropsToDefault;
20
- interface GetDateTimeFieldInternalPropsDefaultsParameters extends Pick<MuiPickersAdapterContextValue, 'defaultDates' | 'utils'> {
21
- internalProps: Pick<DateTimeManagerFieldInternalProps<true>, DateTimeManagerFieldPropsToDefault | 'minDateTime' | 'maxDateTime' | 'ampm'>;
22
- }
23
- interface GetDateTimeFieldInternalPropsDefaultsReturnValue extends Pick<PickerManagerFieldInternalPropsWithDefaults<UseDateTimeManagerReturnValue<true>>, DateTimeManagerFieldPropsToDefault | 'disableIgnoringDatePartForTimeValidation'> {}
24
15
  export {};
@@ -6,7 +6,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- exports.getDateTimeFieldInternalPropsDefaults = getDateTimeFieldInternalPropsDefaults;
9
+ exports.useApplyDefaultValuesToDateTimeValidationProps = useApplyDefaultValuesToDateTimeValidationProps;
10
10
  exports.useDateTimeManager = useDateTimeManager;
11
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
12
  var React = _interopRequireWildcard(require("react"));
@@ -25,47 +25,37 @@ function useDateTimeManager(parameters = {}) {
25
25
  internal_valueManager: _valueManagers.singleItemValueManager,
26
26
  internal_fieldValueManager: _valueManagers.singleItemFieldValueManager,
27
27
  internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
28
- internal_applyDefaultsToFieldInternalProps: ({
29
- internalProps,
30
- utils,
31
- defaultDates
32
- }) => (0, _extends2.default)({}, internalProps, getDateTimeFieldInternalPropsDefaults({
33
- internalProps,
34
- utils,
35
- defaultDates
36
- })),
28
+ internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToDateTimeFieldInternalProps,
37
29
  internal_useOpenPickerButtonAriaLabel: useOpenPickerButtonAriaLabel
38
30
  }), [enableAccessibleFieldDOMStructure]);
39
31
  }
40
- function useOpenPickerButtonAriaLabel() {
32
+ function useOpenPickerButtonAriaLabel(value) {
41
33
  const utils = (0, _useUtils.useUtils)();
42
34
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
43
- return React.useCallback(value => {
35
+ return React.useMemo(() => {
44
36
  const formattedValue = utils.isValid(value) ? utils.format(value, 'fullDate') : null;
45
37
  return translations.openDatePickerDialogue(formattedValue);
46
- }, [translations, utils]);
38
+ }, [value, translations, utils]);
47
39
  }
48
-
49
- /**
50
- * Private utility function to get the default internal props for the field with date time editing.
51
- * Is used by the `useDateTimeManager` and `useDateTimeRangeManager` hooks.
52
- */
53
- function getDateTimeFieldInternalPropsDefaults(parameters) {
54
- const {
55
- defaultDates,
56
- utils,
57
- internalProps
58
- } = parameters;
59
- const ampm = internalProps.ampm ?? utils.is12HourCycleInCurrentLocale();
60
- const defaultFormat = ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h;
61
- return {
62
- disablePast: internalProps.disablePast ?? false,
63
- disableFuture: internalProps.disableFuture ?? false,
64
- format: internalProps.format ?? defaultFormat,
65
- disableIgnoringDatePartForTimeValidation: Boolean(internalProps.minDateTime || internalProps.maxDateTime),
66
- minDate: (0, _dateUtils.applyDefaultDate)(utils, internalProps.minDateTime ?? internalProps.minDate, defaultDates.minDate),
67
- maxDate: (0, _dateUtils.applyDefaultDate)(utils, internalProps.maxDateTime ?? internalProps.maxDate, defaultDates.maxDate),
68
- minTime: internalProps.minDateTime ?? internalProps.minTime,
69
- maxTime: internalProps.maxDateTime ?? internalProps.maxTime
70
- };
40
+ function useApplyDefaultValuesToDateTimeFieldInternalProps(internalProps) {
41
+ const utils = (0, _useUtils.useUtils)();
42
+ const validationProps = useApplyDefaultValuesToDateTimeValidationProps(internalProps);
43
+ const ampm = React.useMemo(() => internalProps.ampm ?? utils.is12HourCycleInCurrentLocale(), [internalProps.ampm, utils]);
44
+ return React.useMemo(() => (0, _extends2.default)({}, internalProps, validationProps, {
45
+ format: internalProps.format ?? (ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h)
46
+ }), [internalProps, validationProps, ampm, utils]);
47
+ }
48
+ function useApplyDefaultValuesToDateTimeValidationProps(props) {
49
+ const utils = (0, _useUtils.useUtils)();
50
+ const defaultDates = (0, _useUtils.useDefaultDates)();
51
+ return React.useMemo(() => ({
52
+ disablePast: props.disablePast ?? false,
53
+ disableFuture: props.disableFuture ?? false,
54
+ // TODO: Explore if we can remove it from the public API
55
+ disableIgnoringDatePartForTimeValidation: !!props.minDateTime || !!props.maxDateTime || !!props.disableFuture || !!props.disablePast,
56
+ minDate: (0, _dateUtils.applyDefaultDate)(utils, props.minDateTime ?? props.minDate, defaultDates.minDate),
57
+ maxDate: (0, _dateUtils.applyDefaultDate)(utils, props.maxDateTime ?? props.maxDate, defaultDates.maxDate),
58
+ minTime: props.minDateTime ?? props.minTime,
59
+ maxTime: props.maxDateTime ?? props.maxTime
60
+ }), [props.minDateTime, props.maxDateTime, props.minTime, props.maxTime, props.minDate, props.maxDate, props.disableFuture, props.disablePast, utils, defaultDates]);
71
61
  }
@@ -1,24 +1,15 @@
1
1
  import type { MakeOptional } from '@mui/x-internals/types';
2
2
  import { PickerManager, TimeValidationError } from "../models/index.js";
3
3
  import { UseFieldInternalProps } from "../internals/hooks/useField/index.js";
4
- import { MuiPickersAdapterContextValue } from "../LocalizationProvider/LocalizationProvider.js";
5
4
  import { AmPmProps } from "../internals/models/props/time.js";
6
- import { ExportedValidateTimeProps, ValidateTimeProps, ValidateTimePropsToDefault } from "../validation/validateTime.js";
7
- import { PickerManagerFieldInternalPropsWithDefaults, PickerValue } from "../internals/models/index.js";
5
+ import { ExportedValidateTimeProps, ValidateTimeProps } from "../validation/validateTime.js";
6
+ import { PickerValue } from "../internals/models/index.js";
8
7
  export declare function useTimeManager<TEnableAccessibleFieldDOMStructure extends boolean = true>(parameters?: UseTimeManagerParameters<TEnableAccessibleFieldDOMStructure>): UseTimeManagerReturnValue<TEnableAccessibleFieldDOMStructure>;
9
- /**
10
- * Private utility function to get the default internal props for the fields with time editing.
11
- * Is used by the `useTimeManager` and `useTimeRangeManager` hooks.
12
- */
13
- export declare function getTimeFieldInternalPropsDefaults(parameters: GetTimeFieldInternalPropsDefaultsParameters): GetTimeFieldInternalPropsDefaultsReturnValue;
8
+ type SharedTimeAndTimeRangeValidationProps = 'disablePast' | 'disableFuture';
9
+ export declare function useApplyDefaultValuesToTimeValidationProps(props: Pick<ExportedValidateTimeProps, SharedTimeAndTimeRangeValidationProps>): Pick<ValidateTimeProps, SharedTimeAndTimeRangeValidationProps>;
14
10
  export interface UseTimeManagerParameters<TEnableAccessibleFieldDOMStructure extends boolean> extends AmPmProps {
15
11
  enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
16
12
  }
17
13
  export type UseTimeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError, ValidateTimeProps, TimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>>;
18
14
  export interface TimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, AmPmProps {}
19
- type TimeManagerFieldPropsToDefault = 'format' | ValidateTimePropsToDefault;
20
- interface GetTimeFieldInternalPropsDefaultsParameters extends Pick<MuiPickersAdapterContextValue, 'utils'> {
21
- internalProps: Pick<TimeManagerFieldInternalProps<true>, TimeManagerFieldPropsToDefault | 'ampm'>;
22
- }
23
- interface GetTimeFieldInternalPropsDefaultsReturnValue extends Pick<PickerManagerFieldInternalPropsWithDefaults<UseTimeManagerReturnValue<true>>, TimeManagerFieldPropsToDefault> {}
24
15
  export {};
@@ -6,7 +6,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
6
6
  Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
- exports.getTimeFieldInternalPropsDefaults = getTimeFieldInternalPropsDefaults;
9
+ exports.useApplyDefaultValuesToTimeValidationProps = useApplyDefaultValuesToTimeValidationProps;
10
10
  exports.useTimeManager = useTimeManager;
11
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
12
  var React = _interopRequireWildcard(require("react"));
@@ -25,42 +25,32 @@ function useTimeManager(parameters = {}) {
25
25
  internal_valueManager: _valueManagers.singleItemValueManager,
26
26
  internal_fieldValueManager: _valueManagers.singleItemFieldValueManager,
27
27
  internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
28
- internal_applyDefaultsToFieldInternalProps: ({
29
- internalProps,
30
- utils
31
- }) => (0, _extends2.default)({}, internalProps, getTimeFieldInternalPropsDefaults({
32
- utils,
33
- internalProps
34
- })),
28
+ internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToTimeFieldInternalProps,
35
29
  internal_useOpenPickerButtonAriaLabel: createUseOpenPickerButtonAriaLabel(ampm)
36
30
  }), [ampm, enableAccessibleFieldDOMStructure]);
37
31
  }
38
32
  function createUseOpenPickerButtonAriaLabel(ampm) {
39
- return function useOpenPickerButtonAriaLabel() {
33
+ return function useOpenPickerButtonAriaLabel(value) {
40
34
  const utils = (0, _useUtils.useUtils)();
41
35
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
42
- return React.useCallback(value => {
36
+ return React.useMemo(() => {
43
37
  const formatKey = ampm ?? utils.is12HourCycleInCurrentLocale() ? 'fullTime12h' : 'fullTime24h';
44
38
  const formattedValue = utils.isValid(value) ? utils.format(value, formatKey) : null;
45
39
  return translations.openTimePickerDialogue(formattedValue);
46
- }, [translations, utils]);
40
+ }, [value, translations, utils]);
47
41
  };
48
42
  }
49
-
50
- /**
51
- * Private utility function to get the default internal props for the fields with time editing.
52
- * Is used by the `useTimeManager` and `useTimeRangeManager` hooks.
53
- */
54
- function getTimeFieldInternalPropsDefaults(parameters) {
55
- const {
56
- utils,
57
- internalProps
58
- } = parameters;
59
- const ampm = internalProps.ampm ?? utils.is12HourCycleInCurrentLocale();
60
- const defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
61
- return {
62
- disablePast: internalProps.disablePast ?? false,
63
- disableFuture: internalProps.disableFuture ?? false,
64
- format: internalProps.format ?? defaultFormat
65
- };
43
+ function useApplyDefaultValuesToTimeFieldInternalProps(internalProps) {
44
+ const utils = (0, _useUtils.useUtils)();
45
+ const validationProps = useApplyDefaultValuesToTimeValidationProps(internalProps);
46
+ const ampm = React.useMemo(() => internalProps.ampm ?? utils.is12HourCycleInCurrentLocale(), [internalProps.ampm, utils]);
47
+ return React.useMemo(() => (0, _extends2.default)({}, internalProps, validationProps, {
48
+ format: internalProps.format ?? (ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h)
49
+ }), [internalProps, validationProps, ampm, utils]);
50
+ }
51
+ function useApplyDefaultValuesToTimeValidationProps(props) {
52
+ return React.useMemo(() => ({
53
+ disablePast: props.disablePast ?? false,
54
+ disableFuture: props.disableFuture ?? false
55
+ }), [props.disablePast, props.disableFuture]);
66
56
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { TextFieldProps } from '@mui/material/TextField';
3
3
  import type { ExportedPickersSectionListProps } from '../PickersSectionList';
4
- import type { UseFieldInternalProps, UseFieldResponse } from '../internals/hooks/useField';
4
+ import type { UseFieldInternalProps, UseFieldReturnValue } from '../internals/hooks/useField';
5
5
  import type { PickersTextFieldProps } from '../PickersTextField';
6
6
  import { BaseSingleInputFieldProps, FieldRangeSection, PickerRangeValue, PickerValidValue } from "../internals/models/index.js";
7
7
  import { PickerOwnerState } from "./pickers.js";
@@ -131,7 +131,7 @@ export type PickerFieldSlotProps<TValue extends PickerValidValue, TEnableAccessi
131
131
  * Props the text field receives when used inside a single input Picker.
132
132
  * Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` and `props.slotProps.textField`.
133
133
  */
134
- export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = Omit<UseFieldResponse<TEnableAccessibleFieldDOMStructure, BaseSingleInputFieldProps>, 'slots' | 'slotProps' | 'clearable' | 'onClear' | 'openPickerButtonPosition' | 'clearButtonPosition' | 'openPickerAriaLabel'>;
134
+ export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = Omit<UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, BaseSingleInputFieldProps>, 'slots' | 'slotProps' | 'clearable' | 'onClear' | 'openPickerButtonPosition' | 'clearButtonPosition' | 'openPickerAriaLabel'>;
135
135
  /**
136
136
  * Props the built-in text field component can receive.
137
137
  */
@@ -1,5 +1,4 @@
1
1
  import type { FieldValueManager, UseFieldInternalProps } from '../internals/hooks/useField';
2
- import type { UseLocalizationContextReturnValue } from '../internals/hooks/useUtils';
3
2
  import type { PickerValidValue, PickerValueManager } from '../internals/models';
4
3
  import type { Validator } from '../validation';
5
4
  import type { PickerValueType } from './common';
@@ -66,17 +65,14 @@ export interface PickerManager<TValue extends PickerValidValue, TEnableAccessibl
66
65
  * - a default format to display the value in the field
67
66
  * - some default validation props that are needed to validate the value (e.g: minDate, maxDate)
68
67
  * This property is not part of the public API and should not be used directly.
69
- * @param {ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps>} parameters The parameters to apply the defaults.
68
+ * @param {TFieldInternalProps<TFieldInternalProps>} internalProps The field internal props to apply the defaults to.
70
69
  * @returns {TFieldInternalPropsWithDefaults} The field internal props with the defaults applied.
71
70
  */
72
- internal_applyDefaultsToFieldInternalProps: (parameters: ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps>) => UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, TError> & TValidationProps;
71
+ internal_useApplyDefaultValuesToFieldInternalProps: (internalProps: TFieldInternalProps) => UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, TError> & TValidationProps;
73
72
  /**
74
73
  * Returns a hook that creates the aria-label to apply on the button that opens the Picker.
75
- * @returns {(value: TValue) => string} The method to create the aria-label to apply on the button that opens the Picker.
74
+ * @param {TValue} value The value of the Picker.
75
+ * @returns {string} The aria-label to apply on the button that opens the Picker.
76
76
  */
77
- internal_useOpenPickerButtonAriaLabel: () => (value: TValue) => string;
78
- }
79
- interface ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps extends {}> extends UseLocalizationContextReturnValue {
80
- internalProps: TFieldInternalProps;
81
- }
82
- export {};
77
+ internal_useOpenPickerButtonAriaLabel: (value: TValue) => string;
78
+ }
@@ -10,14 +10,14 @@ import useSlotProps from '@mui/utils/useSlotProps';
10
10
  import { styled, useThemeProps } from '@mui/material/styles';
11
11
  import { unstable_composeClasses as composeClasses, unstable_useId as useId, unstable_useEventCallback as useEventCallback } from '@mui/utils';
12
12
  import { useCalendarState } from "./useCalendarState.js";
13
- import { useDefaultDates, useUtils } from "../internals/hooks/useUtils.js";
13
+ import { useUtils } from "../internals/hooks/useUtils.js";
14
14
  import { PickersFadeTransitionGroup } from "./PickersFadeTransitionGroup.js";
15
15
  import { DayCalendar } from "./DayCalendar.js";
16
16
  import { MonthCalendar } from "../MonthCalendar/index.js";
17
17
  import { YearCalendar } from "../YearCalendar/index.js";
18
18
  import { useViews } from "../internals/hooks/useViews.js";
19
19
  import { PickersCalendarHeader } from "../PickersCalendarHeader/index.js";
20
- import { findClosestEnabledDate, applyDefaultDate, mergeDateAndTime } from "../internals/utils/date-utils.js";
20
+ import { findClosestEnabledDate, mergeDateAndTime } from "../internals/utils/date-utils.js";
21
21
  import { PickerViewRoot } from "../internals/components/PickerViewRoot/index.js";
22
22
  import { useReduceAnimations } from "../internals/hooks/useReduceAnimations.js";
23
23
  import { getDateCalendarUtilityClass } from "./dateCalendarClasses.js";
@@ -25,6 +25,7 @@ import { useControlledValue } from "../internals/hooks/useControlledValue.js";
25
25
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
26
26
  import { VIEW_HEIGHT } from "../internals/constants/dimensions.js";
27
27
  import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
28
+ import { useApplyDefaultValuesToDateValidationProps } from "../managers/useDateManager.js";
28
29
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
30
  const useUtilityClasses = classes => {
30
31
  const slots = {
@@ -34,25 +35,20 @@ const useUtilityClasses = classes => {
34
35
  return composeClasses(slots, getDateCalendarUtilityClass, classes);
35
36
  };
36
37
  function useDateCalendarDefaultizedProps(props, name) {
37
- const utils = useUtils();
38
- const defaultDates = useDefaultDates();
39
38
  const themeProps = useThemeProps({
40
39
  props,
41
40
  name
42
41
  });
43
42
  const reduceAnimations = useReduceAnimations(themeProps.reduceAnimations);
44
- return _extends({}, themeProps, {
43
+ const validationProps = useApplyDefaultValuesToDateValidationProps(themeProps);
44
+ return _extends({}, themeProps, validationProps, {
45
45
  loading: themeProps.loading ?? false,
46
- disablePast: themeProps.disablePast ?? false,
47
- disableFuture: themeProps.disableFuture ?? false,
48
46
  openTo: themeProps.openTo ?? 'day',
49
47
  views: themeProps.views ?? ['year', 'day'],
50
48
  reduceAnimations,
51
49
  renderLoading: themeProps.renderLoading ?? (() => /*#__PURE__*/_jsx("span", {
52
50
  children: "..."
53
- })),
54
- minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
55
- maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
51
+ }))
56
52
  });
57
53
  }
58
54
  const DateCalendarRoot = styled(PickerViewRoot, {
@@ -1,11 +1,12 @@
1
1
  import * as React from 'react';
2
2
  import { DefaultizedProps, SlotComponentPropsFromProps } from '@mui/x-internals/types';
3
- import { PickersDayProps, ExportedPickersDayProps } from "../PickersDay/PickersDay.js";
3
+ import { PickerDayOwnerState, PickersDayProps } from "../PickersDay/index.js";
4
+ import { ExportedPickersDayProps } from "../PickersDay/PickersDay.types.js";
4
5
  import { PickerOnChangeFn } from "../internals/hooks/useViews.js";
5
6
  import { SlideDirection, SlideTransitionProps } from "./PickersSlideTransition.js";
6
7
  import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from "../internals/models/validation.js";
7
8
  import { DayCalendarClasses } from "./dayCalendarClasses.js";
8
- import { PickerOwnerState, PickerValidDate, TimezoneProps } from "../models/index.js";
9
+ import { PickerValidDate, TimezoneProps } from "../models/index.js";
9
10
  import { FormProps } from "../internals/models/formProps.js";
10
11
  export interface DayCalendarSlots {
11
12
  /**
@@ -18,11 +19,6 @@ export interface DayCalendarSlots {
18
19
  export interface DayCalendarSlotProps {
19
20
  day?: SlotComponentPropsFromProps<PickersDayProps, {}, PickerDayOwnerState>;
20
21
  }
21
- export interface PickerDayOwnerState extends PickerOwnerState {
22
- isDaySelected: boolean;
23
- isDayDisabled: boolean;
24
- day: PickerValidDate;
25
- }
26
22
  export interface ExportedDayCalendarProps extends ExportedPickersDayProps {
27
23
  /**
28
24
  * If `true`, calls `renderLoading` instead of rendering the day calendar.
@@ -12,7 +12,7 @@ import { useRtl } from '@mui/system/RtlProvider';
12
12
  import { styled, useThemeProps } from '@mui/material/styles';
13
13
  import composeClasses from '@mui/utils/composeClasses';
14
14
  import clsx from 'clsx';
15
- import { PickersDay } from "../PickersDay/PickersDay.js";
15
+ import { PickersDay } from "../PickersDay/index.js";
16
16
  import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
17
17
  import { useUtils, useNow } from "../internals/hooks/useUtils.js";
18
18
  import { DAY_SIZE, DAY_MARGIN } from "../internals/constants/dimensions.js";
@@ -20,7 +20,7 @@ import { PickersSlideTransition } from "./PickersSlideTransition.js";
20
20
  import { useIsDateDisabled } from "./useIsDateDisabled.js";
21
21
  import { findClosestEnabledDate, getWeekdays } from "../internals/utils/date-utils.js";
22
22
  import { getDayCalendarUtilityClass } from "./dayCalendarClasses.js";
23
- import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
23
+ import { usePickerDayOwnerState } from "../PickersDay/usePickerDayOwnerState.js";
24
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
25
25
  const useUtilityClasses = classes => {
26
26
  const slots = {
@@ -81,7 +81,7 @@ const PickersCalendarWeekNumberLabel = styled(Typography, {
81
81
  display: 'flex',
82
82
  justifyContent: 'center',
83
83
  alignItems: 'center',
84
- color: theme.palette.text.disabled
84
+ color: (theme.vars || theme).palette.text.disabled
85
85
  }));
86
86
  const PickersCalendarWeekNumber = styled(Typography, {
87
87
  name: 'MuiDayCalendar',
@@ -94,7 +94,7 @@ const PickersCalendarWeekNumber = styled(Typography, {
94
94
  height: DAY_SIZE,
95
95
  padding: 0,
96
96
  margin: `0 ${DAY_MARGIN}px`,
97
- color: theme.palette.text.disabled,
97
+ color: (theme.vars || theme).palette.text.disabled,
98
98
  fontSize: '0.75rem',
99
99
  alignItems: 'center',
100
100
  justifyContent: 'center',
@@ -155,14 +155,23 @@ function WrappedDay(_ref) {
155
155
  } = parentProps;
156
156
  const utils = useUtils();
157
157
  const now = useNow(timezone);
158
- const {
159
- ownerState
160
- } = usePickerPrivateContext();
161
158
  const isFocusableDay = focusedDay != null && utils.isSameDay(day, focusedDay);
162
159
  const isFocusedDay = isViewFocused && isFocusableDay;
163
160
  const isSelected = selectedDays.some(selectedDay => utils.isSameDay(selectedDay, day));
164
161
  const isToday = utils.isSameDay(day, now);
165
162
  const isDisabled = React.useMemo(() => disabled || isDateDisabled(day), [disabled, isDateDisabled, day]);
163
+ const isOutsideCurrentMonth = React.useMemo(() => utils.getMonth(day) !== currentMonthNumber, [utils, day, currentMonthNumber]);
164
+ const ownerState = usePickerDayOwnerState({
165
+ day,
166
+ selected: isSelected,
167
+ disabled: isDisabled,
168
+ today: isToday,
169
+ outsideCurrentMonth: isOutsideCurrentMonth,
170
+ disableMargin: undefined,
171
+ // This prop can only be defined using slotProps.day so the ownerState for useSlotProps cannot have its value.
172
+ disableHighlightToday,
173
+ showDaysOutsideCurrentMonth
174
+ });
166
175
  const Day = slots?.day ?? PickersDay;
167
176
  // We don't want to pass to ownerState down, to avoid re-rendering all the day whenever a prop changes.
168
177
  const _useSlotProps = useSlotProps({
@@ -183,7 +192,6 @@ function WrappedDay(_ref) {
183
192
  })
184
193
  }),
185
194
  dayProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
186
- const outsideCurrentMonth = React.useMemo(() => utils.getMonth(day) !== currentMonthNumber, [utils, day, currentMonthNumber]);
187
195
  const isFirstVisibleCell = React.useMemo(() => {
188
196
  const startOfMonth = utils.startOfMonth(utils.setMonth(day, currentMonthNumber));
189
197
  if (!showDaysOutsideCurrentMonth) {
@@ -201,9 +209,9 @@ function WrappedDay(_ref) {
201
209
  return /*#__PURE__*/_jsx(Day, _extends({}, dayProps, {
202
210
  day: day,
203
211
  disabled: isDisabled,
204
- autoFocus: !outsideCurrentMonth && isFocusedDay,
212
+ autoFocus: !isOutsideCurrentMonth && isFocusedDay,
205
213
  today: isToday,
206
- outsideCurrentMonth: outsideCurrentMonth,
214
+ outsideCurrentMonth: isOutsideCurrentMonth,
207
215
  isFirstVisibleCell: isFirstVisibleCell,
208
216
  isLastVisibleCell: isLastVisibleCell,
209
217
  selected: isSelected,