@mui/x-date-pickers 6.0.4 → 6.2.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 (315) hide show
  1. package/AdapterDateFns/index.d.ts +1 -1
  2. package/AdapterDateFnsJalali/index.d.ts +1 -1
  3. package/AdapterDayjs/AdapterDayjs.d.ts +114 -0
  4. package/AdapterDayjs/AdapterDayjs.js +387 -0
  5. package/AdapterDayjs/index.d.ts +1 -29
  6. package/AdapterDayjs/index.js +1 -102
  7. package/AdapterLuxon/index.d.ts +2 -2
  8. package/AdapterLuxon/index.js +1 -1
  9. package/AdapterMoment/index.d.ts +1 -1
  10. package/AdapterMomentHijri/index.d.ts +1 -1
  11. package/AdapterMomentJalaali/index.d.ts +1 -1
  12. package/CHANGELOG.md +110 -0
  13. package/DateCalendar/DateCalendar.js +0 -2
  14. package/DateCalendar/DateCalendar.types.d.ts +1 -1
  15. package/DateCalendar/DayCalendar.d.ts +1 -1
  16. package/DateCalendar/PickersCalendarHeader.d.ts +0 -12
  17. package/DateCalendar/PickersCalendarHeader.js +7 -9
  18. package/DateCalendar/PickersSlideTransition.js +1 -0
  19. package/DateCalendar/useCalendarState.d.ts +1 -1
  20. package/DateField/DateField.js +14 -2
  21. package/DateField/useDateField.js +3 -1
  22. package/DatePicker/DatePicker.js +6 -0
  23. package/DatePicker/shared.d.ts +2 -2
  24. package/DateTimeField/DateTimeField.js +14 -2
  25. package/DateTimeField/useDateTimeField.js +3 -1
  26. package/DateTimePicker/DateTimePicker.js +6 -0
  27. package/DateTimePicker/shared.js +3 -1
  28. package/DesktopDatePicker/DesktopDatePicker.js +6 -0
  29. package/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
  30. package/DesktopTimePicker/DesktopTimePicker.js +6 -0
  31. package/LocalizationProvider/LocalizationProvider.d.ts +2 -3
  32. package/MobileDatePicker/MobileDatePicker.js +6 -0
  33. package/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
  34. package/MobileTimePicker/MobileTimePicker.js +6 -0
  35. package/MonthCalendar/PickersMonth.js +1 -0
  36. package/README.md +3 -2
  37. package/TimeClock/ClockNumbers.d.ts +1 -1
  38. package/TimeClock/TimeClock.js +5 -4
  39. package/TimeClock/TimeClock.types.d.ts +1 -1
  40. package/TimeField/TimeField.js +14 -2
  41. package/TimeField/useTimeField.js +3 -1
  42. package/TimePicker/TimePicker.js +6 -0
  43. package/YearCalendar/PickersYear.js +1 -0
  44. package/index.js +1 -1
  45. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -12
  46. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +0 -12
  47. package/internals/components/PickersModalDialog.d.ts +1 -13
  48. package/internals/components/PickersModalDialog.js +7 -9
  49. package/internals/components/PickersPopper.d.ts +1 -3
  50. package/internals/components/PickersPopper.js +2 -7
  51. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
  52. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -3
  53. package/internals/hooks/useField/useField.js +2 -2
  54. package/internals/hooks/useField/useField.types.d.ts +9 -11
  55. package/internals/hooks/useField/useField.utils.d.ts +2 -3
  56. package/internals/hooks/useField/useField.utils.js +19 -5
  57. package/internals/hooks/useField/useFieldCharacterEditing.js +23 -0
  58. package/internals/hooks/useField/useFieldState.js +3 -2
  59. package/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
  60. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -3
  61. package/internals/hooks/usePicker/index.d.ts +1 -1
  62. package/internals/hooks/usePicker/usePicker.types.d.ts +1 -1
  63. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +1 -1
  64. package/internals/hooks/usePicker/usePickerLayoutProps.js +6 -0
  65. package/internals/hooks/usePicker/usePickerValue.d.ts +3 -173
  66. package/internals/hooks/usePicker/usePickerValue.js +199 -144
  67. package/internals/hooks/usePicker/usePickerValue.types.d.ts +233 -0
  68. package/internals/hooks/usePicker/usePickerValue.types.js +1 -0
  69. package/internals/hooks/usePicker/usePickerViews.d.ts +1 -1
  70. package/internals/hooks/usePicker/usePickerViews.js +13 -0
  71. package/internals/hooks/useUtils.d.ts +1 -1
  72. package/internals/index.d.ts +1 -2
  73. package/internals/models/index.d.ts +0 -1
  74. package/internals/models/index.js +1 -2
  75. package/internals/models/props/basePickerProps.d.ts +6 -0
  76. package/internals/utils/date-utils.d.ts +1 -1
  77. package/internals/utils/time-utils.d.ts +1 -2
  78. package/internals/utils/valueManagers.d.ts +1 -1
  79. package/internals/utils/valueManagers.js +2 -2
  80. package/legacy/AdapterDayjs/AdapterDayjs.js +403 -0
  81. package/legacy/AdapterDayjs/index.js +1 -119
  82. package/legacy/AdapterLuxon/index.js +1 -1
  83. package/legacy/DateCalendar/DateCalendar.js +0 -2
  84. package/legacy/DateCalendar/PickersCalendarHeader.js +8 -10
  85. package/legacy/DateField/DateField.js +13 -1
  86. package/legacy/DateField/useDateField.js +3 -1
  87. package/legacy/DatePicker/DatePicker.js +6 -0
  88. package/legacy/DateTimeField/DateTimeField.js +13 -1
  89. package/legacy/DateTimeField/useDateTimeField.js +3 -1
  90. package/legacy/DateTimePicker/DateTimePicker.js +6 -0
  91. package/legacy/DateTimePicker/shared.js +3 -1
  92. package/legacy/DesktopDatePicker/DesktopDatePicker.js +6 -0
  93. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
  94. package/legacy/DesktopTimePicker/DesktopTimePicker.js +6 -0
  95. package/legacy/MobileDatePicker/MobileDatePicker.js +6 -0
  96. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
  97. package/legacy/MobileTimePicker/MobileTimePicker.js +6 -0
  98. package/legacy/TimeClock/TimeClock.js +5 -4
  99. package/legacy/TimeField/TimeField.js +13 -1
  100. package/legacy/TimeField/useTimeField.js +3 -1
  101. package/legacy/TimePicker/TimePicker.js +6 -0
  102. package/legacy/index.js +1 -1
  103. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -12
  104. package/legacy/internals/components/PickersModalDialog.js +7 -9
  105. package/legacy/internals/components/PickersPopper.js +2 -7
  106. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
  107. package/legacy/internals/hooks/useField/useField.js +2 -2
  108. package/legacy/internals/hooks/useField/useField.utils.js +27 -10
  109. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +23 -0
  110. package/legacy/internals/hooks/useField/useFieldState.js +5 -3
  111. package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
  112. package/legacy/internals/hooks/usePicker/usePickerLayoutProps.js +6 -0
  113. package/legacy/internals/hooks/usePicker/usePickerValue.js +196 -146
  114. package/legacy/internals/hooks/usePicker/usePickerValue.types.js +1 -0
  115. package/legacy/internals/hooks/usePicker/usePickerViews.js +13 -0
  116. package/legacy/internals/models/index.js +1 -2
  117. package/legacy/internals/utils/valueManagers.js +3 -3
  118. package/legacy/locales/caES.js +88 -0
  119. package/legacy/locales/esES.js +34 -17
  120. package/legacy/locales/heIL.js +33 -16
  121. package/legacy/locales/index.js +1 -0
  122. package/legacy/locales/jaJP.js +3 -1
  123. package/legacy/locales/kzKZ.js +88 -0
  124. package/legacy/locales/nlNL.js +25 -11
  125. package/legacy/locales/ptBR.js +33 -16
  126. package/legacy/models/adapters.js +1 -0
  127. package/legacy/models/index.js +2 -1
  128. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
  129. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
  130. package/legacy/tests/describeGregorianAdapter/index.js +1 -0
  131. package/legacy/tests/describeGregorianAdapter/testCalculations.js +273 -0
  132. package/legacy/tests/describeGregorianAdapter/testFormat.js +26 -0
  133. package/legacy/tests/describeGregorianAdapter/testLocalization.js +15 -0
  134. package/legacy/tests/describeValidation/describeValidation.js +2 -1
  135. package/legacy/tests/describeValidation/testMinutesViewValidation.js +201 -0
  136. package/legacy/tests/describeValue/testPickerActionBar.js +52 -3
  137. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
  138. package/locales/beBY.d.ts +3 -3
  139. package/locales/caES.d.ts +51 -0
  140. package/locales/caES.js +54 -0
  141. package/locales/csCZ.d.ts +3 -3
  142. package/locales/daDK.d.ts +3 -3
  143. package/locales/deDE.d.ts +3 -3
  144. package/locales/enUS.d.ts +3 -3
  145. package/locales/esES.d.ts +3 -3
  146. package/locales/esES.js +14 -17
  147. package/locales/faIR.d.ts +3 -3
  148. package/locales/fiFI.d.ts +3 -3
  149. package/locales/frFR.d.ts +3 -3
  150. package/locales/heIL.d.ts +3 -3
  151. package/locales/heIL.js +13 -16
  152. package/locales/huHU.d.ts +3 -3
  153. package/locales/index.d.ts +1 -0
  154. package/locales/index.js +1 -0
  155. package/locales/isIS.d.ts +3 -3
  156. package/locales/itIT.d.ts +3 -3
  157. package/locales/jaJP.d.ts +3 -3
  158. package/locales/jaJP.js +1 -1
  159. package/locales/koKR.d.ts +3 -3
  160. package/locales/kzKZ.d.ts +51 -0
  161. package/locales/kzKZ.js +56 -0
  162. package/locales/nbNO.d.ts +3 -3
  163. package/locales/nlNL.d.ts +3 -3
  164. package/locales/nlNL.js +9 -11
  165. package/locales/plPL.d.ts +3 -3
  166. package/locales/ptBR.d.ts +3 -3
  167. package/locales/ptBR.js +13 -16
  168. package/locales/ruRU.d.ts +3 -3
  169. package/locales/svSE.d.ts +3 -3
  170. package/locales/trTR.d.ts +3 -3
  171. package/locales/ukUA.d.ts +3 -3
  172. package/locales/urPK.d.ts +3 -3
  173. package/locales/utils/getPickersLocalization.d.ts +3 -3
  174. package/locales/utils/pickersLocaleTextApi.d.ts +1 -2
  175. package/locales/zhCN.d.ts +3 -3
  176. package/models/adapters.d.ts +568 -0
  177. package/models/adapters.js +1 -0
  178. package/models/index.d.ts +1 -0
  179. package/models/index.js +2 -1
  180. package/modern/AdapterDayjs/AdapterDayjs.js +386 -0
  181. package/modern/AdapterDayjs/index.js +1 -101
  182. package/modern/AdapterLuxon/index.js +1 -1
  183. package/modern/DateCalendar/DateCalendar.js +0 -2
  184. package/modern/DateCalendar/PickersCalendarHeader.js +6 -8
  185. package/modern/DateCalendar/PickersSlideTransition.js +1 -0
  186. package/modern/DateField/DateField.js +14 -2
  187. package/modern/DateField/useDateField.js +3 -1
  188. package/modern/DatePicker/DatePicker.js +6 -0
  189. package/modern/DateTimeField/DateTimeField.js +14 -2
  190. package/modern/DateTimeField/useDateTimeField.js +3 -1
  191. package/modern/DateTimePicker/DateTimePicker.js +6 -0
  192. package/modern/DateTimePicker/shared.js +3 -1
  193. package/modern/DesktopDatePicker/DesktopDatePicker.js +6 -0
  194. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
  195. package/modern/DesktopTimePicker/DesktopTimePicker.js +6 -0
  196. package/modern/MobileDatePicker/MobileDatePicker.js +6 -0
  197. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
  198. package/modern/MobileTimePicker/MobileTimePicker.js +6 -0
  199. package/modern/MonthCalendar/PickersMonth.js +1 -0
  200. package/modern/TimeClock/TimeClock.js +5 -4
  201. package/modern/TimeField/TimeField.js +14 -2
  202. package/modern/TimeField/useTimeField.js +3 -1
  203. package/modern/TimePicker/TimePicker.js +6 -0
  204. package/modern/YearCalendar/PickersYear.js +1 -0
  205. package/modern/index.js +1 -1
  206. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +9 -11
  207. package/modern/internals/components/PickersModalDialog.js +6 -8
  208. package/modern/internals/components/PickersPopper.js +2 -7
  209. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
  210. package/modern/internals/hooks/useField/useField.js +2 -2
  211. package/modern/internals/hooks/useField/useField.utils.js +19 -5
  212. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +23 -0
  213. package/modern/internals/hooks/useField/useFieldState.js +3 -2
  214. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
  215. package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +6 -0
  216. package/modern/internals/hooks/usePicker/usePickerValue.js +199 -144
  217. package/modern/internals/hooks/usePicker/usePickerValue.types.js +1 -0
  218. package/modern/internals/hooks/usePicker/usePickerViews.js +13 -0
  219. package/modern/internals/models/index.js +1 -2
  220. package/modern/internals/utils/valueManagers.js +2 -2
  221. package/modern/locales/caES.js +54 -0
  222. package/modern/locales/esES.js +14 -17
  223. package/modern/locales/heIL.js +13 -16
  224. package/modern/locales/index.js +1 -0
  225. package/modern/locales/jaJP.js +1 -1
  226. package/modern/locales/kzKZ.js +56 -0
  227. package/modern/locales/nlNL.js +9 -11
  228. package/modern/locales/ptBR.js +13 -16
  229. package/modern/models/adapters.js +1 -0
  230. package/modern/models/index.js +2 -1
  231. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
  232. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
  233. package/modern/tests/describeGregorianAdapter/index.js +1 -0
  234. package/modern/tests/describeGregorianAdapter/testCalculations.js +272 -0
  235. package/modern/tests/describeGregorianAdapter/testFormat.js +27 -0
  236. package/modern/tests/describeGregorianAdapter/testLocalization.js +16 -0
  237. package/modern/tests/describeValidation/describeValidation.js +2 -1
  238. package/modern/tests/describeValidation/testMinutesViewValidation.js +200 -0
  239. package/modern/tests/describeValue/testPickerActionBar.js +52 -3
  240. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
  241. package/node/AdapterDayjs/AdapterDayjs.js +395 -0
  242. package/node/AdapterDayjs/index.js +6 -104
  243. package/node/AdapterLuxon/index.js +1 -1
  244. package/node/AdapterMomentHijri/index.js +2 -0
  245. package/node/DateCalendar/DateCalendar.js +0 -2
  246. package/node/DateCalendar/PickersCalendarHeader.js +5 -9
  247. package/node/DateCalendar/PickersSlideTransition.js +1 -0
  248. package/node/DateField/DateField.js +14 -2
  249. package/node/DateField/useDateField.js +3 -1
  250. package/node/DatePicker/DatePicker.js +6 -0
  251. package/node/DateTimeField/DateTimeField.js +14 -2
  252. package/node/DateTimeField/useDateTimeField.js +3 -1
  253. package/node/DateTimePicker/DateTimePicker.js +6 -0
  254. package/node/DateTimePicker/shared.js +3 -1
  255. package/node/DesktopDatePicker/DesktopDatePicker.js +6 -0
  256. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -0
  257. package/node/DesktopTimePicker/DesktopTimePicker.js +6 -0
  258. package/node/MobileDatePicker/MobileDatePicker.js +6 -0
  259. package/node/MobileDateTimePicker/MobileDateTimePicker.js +6 -0
  260. package/node/MobileTimePicker/MobileTimePicker.js +6 -0
  261. package/node/MonthCalendar/PickersMonth.js +1 -0
  262. package/node/TimeClock/TimeClock.js +5 -4
  263. package/node/TimeField/TimeField.js +14 -2
  264. package/node/TimeField/useTimeField.js +3 -1
  265. package/node/TimePicker/TimePicker.js +6 -0
  266. package/node/YearCalendar/PickersYear.js +1 -0
  267. package/node/index.js +1 -1
  268. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +9 -11
  269. package/node/internals/components/PickersModalDialog.js +6 -8
  270. package/node/internals/components/PickersPopper.js +2 -7
  271. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
  272. package/node/internals/hooks/useField/useField.js +2 -2
  273. package/node/internals/hooks/useField/useField.utils.js +19 -5
  274. package/node/internals/hooks/useField/useFieldCharacterEditing.js +22 -0
  275. package/node/internals/hooks/useField/useFieldState.js +3 -2
  276. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
  277. package/node/internals/hooks/usePicker/usePickerLayoutProps.js +5 -0
  278. package/node/internals/hooks/usePicker/usePickerValue.js +199 -144
  279. package/node/internals/hooks/usePicker/usePickerValue.types.js +5 -0
  280. package/node/internals/hooks/usePicker/usePickerViews.js +12 -0
  281. package/node/internals/models/index.js +0 -11
  282. package/node/internals/utils/valueManagers.js +2 -2
  283. package/node/locales/caES.js +61 -0
  284. package/node/locales/csCZ.js +0 -1
  285. package/node/locales/esES.js +14 -17
  286. package/node/locales/heIL.js +13 -16
  287. package/node/locales/index.js +11 -0
  288. package/node/locales/jaJP.js +1 -1
  289. package/node/locales/kzKZ.js +62 -0
  290. package/node/locales/nlNL.js +9 -11
  291. package/node/locales/ptBR.js +13 -16
  292. package/node/models/adapters.js +5 -0
  293. package/node/models/index.js +11 -0
  294. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +29 -0
  295. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +5 -0
  296. package/node/tests/describeGregorianAdapter/index.js +18 -0
  297. package/node/tests/describeGregorianAdapter/testCalculations.js +279 -0
  298. package/node/tests/describeGregorianAdapter/testFormat.js +34 -0
  299. package/node/tests/describeGregorianAdapter/testLocalization.js +23 -0
  300. package/node/tests/describeValidation/describeValidation.js +2 -1
  301. package/node/tests/describeValidation/testMinutesViewValidation.js +210 -0
  302. package/node/tests/describeValue/testPickerActionBar.js +52 -3
  303. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
  304. package/package.json +11 -11
  305. package/tests/describeGregorianAdapter/describeGregorianAdapter.js +20 -0
  306. package/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +1 -0
  307. package/tests/describeGregorianAdapter/index.js +1 -0
  308. package/tests/describeGregorianAdapter/testCalculations.js +272 -0
  309. package/tests/describeGregorianAdapter/testFormat.js +27 -0
  310. package/tests/describeGregorianAdapter/testLocalization.js +16 -0
  311. package/tests/describeValidation/describeValidation.js +2 -1
  312. package/tests/describeValidation/testMinutesViewValidation.js +200 -0
  313. package/tests/describeValue/testPickerActionBar.js +52 -3
  314. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +6 -6
  315. package/internals/models/muiPickersAdapter.d.ts +0 -26
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["components", "componentsProps", "slots", "slotProps"],
3
+ const _excluded = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
5
  _excluded3 = ["ref", "onPaste", "inputMode", "readOnly"];
6
6
  import * as React from 'react';
@@ -19,7 +19,9 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
19
19
  components,
20
20
  componentsProps,
21
21
  slots,
22
- slotProps
22
+ slotProps,
23
+ InputProps,
24
+ inputProps
23
25
  } = themeProps,
24
26
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
25
27
  const ownerState = themeProps;
@@ -34,6 +36,10 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
34
36
  inputRef: externalInputRef
35
37
  } = _useSlotProps,
36
38
  textFieldProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
39
+
40
+ // TODO: Remove when mui/material-ui#35088 will be merged
41
+ textFieldProps.inputProps = _extends({}, textFieldProps.inputProps, inputProps);
42
+ textFieldProps.InputProps = _extends({}, textFieldProps.InputProps, InputProps);
37
43
  const _useDateTimeField = useDateTimeField({
38
44
  props: textFieldProps,
39
45
  inputRef: externalInputRef
@@ -123,6 +129,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
123
129
  * Format of the date when rendered in the input(s).
124
130
  */
125
131
  format: PropTypes.string,
132
+ /**
133
+ * Density of the format when rendered in the input.
134
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
135
+ * @default "dense"
136
+ */
137
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
126
138
  /**
127
139
  * Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
128
140
  */
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
3
+ const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "shouldDisableDate", "shouldDisableMonth", "shouldDisableYear", "minDate", "maxDate", "disableFuture", "disablePast", "minTime", "maxTime", "minDateTime", "maxDateTime", "minutesStep", "disableIgnoringDatePartForTimeValidation", "shouldDisableClock", "shouldDisableTime", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
4
4
  import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
5
5
  import { useField } from '../internals/hooks/useField';
6
6
  import { validateDateTime } from '../internals/hooks/validation/useDateTimeValidation';
@@ -31,6 +31,7 @@ export const useDateTimeField = ({
31
31
  value,
32
32
  defaultValue,
33
33
  format,
34
+ formatDensity,
34
35
  onChange,
35
36
  readOnly,
36
37
  onError,
@@ -60,6 +61,7 @@ export const useDateTimeField = ({
60
61
  value,
61
62
  defaultValue,
62
63
  format,
64
+ formatDensity,
63
65
  onChange,
64
66
  readOnly,
65
67
  onError,
@@ -142,6 +142,12 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
142
142
  * Defaults to localized format based on the used `views`.
143
143
  */
144
144
  format: PropTypes.string,
145
+ /**
146
+ * Density of the format when rendered in the input.
147
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
148
+ * @default "dense"
149
+ */
150
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
145
151
  /**
146
152
  * Pass a ref to the `input` element.
147
153
  */
@@ -35,7 +35,9 @@ export function useDateTimePickerDefaultizedProps(props, name) {
35
35
  localeText,
36
36
  orientation: themeProps.orientation ?? 'portrait',
37
37
  // TODO: Remove from public API
38
- disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime),
38
+ disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
39
+ // allow time clock to correctly check time validity: https://github.com/mui/mui-x/issues/8520
40
+ themeProps.disablePast || themeProps.disableFuture),
39
41
  disableFuture: themeProps.disableFuture ?? false,
40
42
  disablePast: themeProps.disablePast ?? false,
41
43
  minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
@@ -139,6 +139,12 @@ DesktopDatePicker.propTypes = {
139
139
  * Defaults to localized format based on the used `views`.
140
140
  */
141
141
  format: PropTypes.string,
142
+ /**
143
+ * Density of the format when rendered in the input.
144
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
145
+ * @default "dense"
146
+ */
147
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
142
148
  /**
143
149
  * Pass a ref to the `input` element.
144
150
  */
@@ -162,6 +162,12 @@ DesktopDateTimePicker.propTypes = {
162
162
  * Defaults to localized format based on the used `views`.
163
163
  */
164
164
  format: PropTypes.string,
165
+ /**
166
+ * Density of the format when rendered in the input.
167
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
168
+ * @default "dense"
169
+ */
170
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
165
171
  /**
166
172
  * Pass a ref to the `input` element.
167
173
  */
@@ -128,6 +128,12 @@ DesktopTimePicker.propTypes = {
128
128
  * Defaults to localized format based on the used `views`.
129
129
  */
130
130
  format: PropTypes.string,
131
+ /**
132
+ * Density of the format when rendered in the input.
133
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
134
+ * @default "dense"
135
+ */
136
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
131
137
  /**
132
138
  * Pass a ref to the `input` element.
133
139
  */
@@ -136,6 +136,12 @@ MobileDatePicker.propTypes = {
136
136
  * Defaults to localized format based on the used `views`.
137
137
  */
138
138
  format: PropTypes.string,
139
+ /**
140
+ * Density of the format when rendered in the input.
141
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
142
+ * @default "dense"
143
+ */
144
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
139
145
  /**
140
146
  * Pass a ref to the `input` element.
141
147
  */
@@ -160,6 +160,12 @@ MobileDateTimePicker.propTypes = {
160
160
  * Defaults to localized format based on the used `views`.
161
161
  */
162
162
  format: PropTypes.string,
163
+ /**
164
+ * Density of the format when rendered in the input.
165
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
166
+ * @default "dense"
167
+ */
168
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
163
169
  /**
164
170
  * Pass a ref to the `input` element.
165
171
  */
@@ -127,6 +127,12 @@ MobileTimePicker.propTypes = {
127
127
  * Defaults to localized format based on the used `views`.
128
128
  */
129
129
  format: PropTypes.string,
130
+ /**
131
+ * Density of the format when rendered in the input.
132
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
133
+ * @default "dense"
134
+ */
135
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
130
136
  /**
131
137
  * Pass a ref to the `input` element.
132
138
  */
@@ -92,6 +92,7 @@ export const PickersMonth = /*#__PURE__*/React.memo(function PickersMonth(inProp
92
92
  onFocus,
93
93
  onBlur,
94
94
  'aria-current': ariaCurrent
95
+ // We don't want to forward this prop to the root element
95
96
  } = props,
96
97
  other = _objectWithoutPropertiesLoose(props, _excluded);
97
98
  const ref = React.useRef(null);
@@ -16,6 +16,7 @@ import { PickerViewRoot } from '../internals/components/PickerViewRoot';
16
16
  import { getTimeClockUtilityClass } from './timeClockClasses';
17
17
  import { Clock } from './Clock';
18
18
  import { getHourNumbers, getMinutesNumbers } from './ClockNumbers';
19
+ import { uncapitalizeObjectKeys } from '../internals/utils/slots-migration';
19
20
  import { jsx as _jsx } from "react/jsx-runtime";
20
21
  import { jsxs as _jsxs } from "react/jsx-runtime";
21
22
  const useUtilityClasses = ownerState => {
@@ -66,8 +67,8 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
66
67
  autoFocus,
67
68
  components,
68
69
  componentsProps,
69
- slots,
70
- slotProps,
70
+ slots: innerSlots,
71
+ slotProps: innerSlotProps,
71
72
  value: valueProp,
72
73
  disableIgnoringDatePartForTimeValidation = false,
73
74
  maxTime,
@@ -89,6 +90,8 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
89
90
  readOnly
90
91
  } = props,
91
92
  other = _objectWithoutPropertiesLoose(props, _excluded);
93
+ const slots = innerSlots ?? uncapitalizeObjectKeys(components);
94
+ const slotProps = innerSlotProps ?? componentsProps;
92
95
  const [value, setValue] = useControlled({
93
96
  name: 'DateCalendar',
94
97
  state: 'value',
@@ -282,8 +285,6 @@ export const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProp
282
285
  readOnly: readOnly
283
286
  }, viewProps)), showViewSwitcher && /*#__PURE__*/_jsx(TimeClockArrowSwitcher, {
284
287
  className: classes.arrowSwitcher,
285
- components: components,
286
- componentsProps: componentsProps,
287
288
  slots: slots,
288
289
  slotProps: slotProps,
289
290
  onGoToPrevious: () => setView(previousView),
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["slots", "slotProps", "components", "componentsProps"],
3
+ const _excluded = ["slots", "slotProps", "components", "componentsProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
5
  _excluded3 = ["ref", "onPaste", "inputMode", "readOnly"];
6
6
  import * as React from 'react';
@@ -19,7 +19,9 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref)
19
19
  slots,
20
20
  slotProps,
21
21
  components,
22
- componentsProps
22
+ componentsProps,
23
+ InputProps,
24
+ inputProps
23
25
  } = themeProps,
24
26
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
25
27
  const ownerState = themeProps;
@@ -34,6 +36,10 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref)
34
36
  inputRef: externalInputRef
35
37
  } = _useSlotProps,
36
38
  textFieldProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
39
+
40
+ // TODO: Remove when mui/material-ui#35088 will be merged
41
+ textFieldProps.inputProps = _extends({}, textFieldProps.inputProps, inputProps);
42
+ textFieldProps.InputProps = _extends({}, textFieldProps.InputProps, InputProps);
37
43
  const _useTimeField = useTimeField({
38
44
  props: textFieldProps,
39
45
  inputRef: externalInputRef
@@ -123,6 +129,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
123
129
  * Format of the date when rendered in the input(s).
124
130
  */
125
131
  format: PropTypes.string,
132
+ /**
133
+ * Density of the format when rendered in the input.
134
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
135
+ * @default "dense"
136
+ */
137
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
126
138
  /**
127
139
  * Props applied to the [`FormHelperText`](/material-ui/api/form-helper-text/) element.
128
140
  */
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["value", "defaultValue", "format", "onChange", "readOnly", "onError", "disableFuture", "disablePast", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
3
+ const _excluded = ["value", "defaultValue", "format", "formatDensity", "onChange", "readOnly", "onError", "disableFuture", "disablePast", "minTime", "maxTime", "minutesStep", "shouldDisableClock", "shouldDisableTime", "disableIgnoringDatePartForTimeValidation", "selectedSections", "onSelectedSectionsChange", "ampm", "unstableFieldRef"];
4
4
  import { singleItemFieldValueManager, singleItemValueManager } from '../internals/utils/valueManagers';
5
5
  import { useField } from '../internals/hooks/useField';
6
6
  import { validateTime } from '../internals/hooks/validation/useTimeValidation';
@@ -24,6 +24,7 @@ export const useTimeField = ({
24
24
  value,
25
25
  defaultValue,
26
26
  format,
27
+ formatDensity,
27
28
  onChange,
28
29
  readOnly,
29
30
  onError,
@@ -48,6 +49,7 @@ export const useTimeField = ({
48
49
  value,
49
50
  defaultValue,
50
51
  format,
52
+ formatDensity,
51
53
  onChange,
52
54
  readOnly,
53
55
  onError,
@@ -116,6 +116,12 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
116
116
  * Defaults to localized format based on the used `views`.
117
117
  */
118
118
  format: PropTypes.string,
119
+ /**
120
+ * Density of the format when rendered in the input.
121
+ * Setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character.
122
+ * @default "dense"
123
+ */
124
+ formatDensity: PropTypes.oneOf(['dense', 'spacious']),
119
125
  /**
120
126
  * Pass a ref to the `input` element.
121
127
  */
@@ -94,6 +94,7 @@ export const PickersYear = /*#__PURE__*/React.memo(function PickersYear(inProps)
94
94
  onFocus,
95
95
  onBlur,
96
96
  'aria-current': ariaCurrent
97
+ // We don't want to forward this prop to the root element
97
98
  } = props,
98
99
  other = _objectWithoutPropertiesLoose(props, _excluded);
99
100
  const ref = React.useRef(null);
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.0.4
2
+ * @mui/x-date-pickers v6.2.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["children", "className", "components", "componentsProps", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel"],
3
+ const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel"],
4
4
  _excluded2 = ["ownerState"],
5
5
  _excluded3 = ["ownerState"];
6
6
  import * as React from 'react';
@@ -60,8 +60,6 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
60
60
  const {
61
61
  children,
62
62
  className,
63
- components,
64
- componentsProps,
65
63
  slots,
66
64
  slotProps,
67
65
  isNextDisabled,
@@ -89,10 +87,10 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
89
87
  label: previousLabel
90
88
  };
91
89
  const [leftProps, rightProps] = isRTL ? [nextProps, previousProps] : [previousProps, nextProps];
92
- const PreviousIconButton = slots?.previousIconButton ?? components?.PreviousIconButton ?? PickersArrowSwitcherButton;
90
+ const PreviousIconButton = slots?.previousIconButton ?? PickersArrowSwitcherButton;
93
91
  const previousIconButtonProps = useSlotProps({
94
92
  elementType: PreviousIconButton,
95
- externalSlotProps: slotProps?.previousIconButton ?? componentsProps?.previousIconButton,
93
+ externalSlotProps: slotProps?.previousIconButton,
96
94
  additionalProps: {
97
95
  size: 'medium',
98
96
  title: leftProps.label,
@@ -106,10 +104,10 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
106
104
  }),
107
105
  className: classes.button
108
106
  });
109
- const NextIconButton = slots?.nextIconButton ?? components?.NextIconButton ?? PickersArrowSwitcherButton;
107
+ const NextIconButton = slots?.nextIconButton ?? PickersArrowSwitcherButton;
110
108
  const nextIconButtonProps = useSlotProps({
111
109
  elementType: NextIconButton,
112
- externalSlotProps: slotProps?.nextIconButton ?? componentsProps?.nextIconButton,
110
+ externalSlotProps: slotProps?.nextIconButton,
113
111
  additionalProps: {
114
112
  size: 'medium',
115
113
  title: rightProps.label,
@@ -123,22 +121,22 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
123
121
  }),
124
122
  className: classes.button
125
123
  });
126
- const LeftArrowIcon = slots?.leftArrowIcon ?? components?.LeftArrowIcon ?? ArrowLeft;
124
+ const LeftArrowIcon = slots?.leftArrowIcon ?? ArrowLeft;
127
125
  // The spread is here to avoid this bug mui/material-ui#34056
128
126
  const _useSlotProps = useSlotProps({
129
127
  elementType: LeftArrowIcon,
130
- externalSlotProps: slotProps?.leftArrowIcon ?? componentsProps?.leftArrowIcon,
128
+ externalSlotProps: slotProps?.leftArrowIcon,
131
129
  additionalProps: {
132
130
  fontSize: 'inherit'
133
131
  },
134
132
  ownerState: undefined
135
133
  }),
136
134
  leftArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
137
- const RightArrowIcon = slots?.rightArrowIcon ?? components?.RightArrowIcon ?? ArrowRight;
135
+ const RightArrowIcon = slots?.rightArrowIcon ?? ArrowRight;
138
136
  // The spread is here to avoid this bug mui/material-ui#34056
139
137
  const _useSlotProps2 = useSlotProps({
140
138
  elementType: RightArrowIcon,
141
- externalSlotProps: slotProps?.rightArrowIcon ?? componentsProps?.rightArrowIcon,
139
+ externalSlotProps: slotProps?.rightArrowIcon,
142
140
  additionalProps: {
143
141
  fontSize: 'inherit'
144
142
  },
@@ -25,21 +25,19 @@ export function PickersModalDialog(props) {
25
25
  children,
26
26
  onDismiss,
27
27
  open,
28
- components,
29
- componentsProps,
30
28
  slots,
31
29
  slotProps
32
30
  } = props;
33
- const Dialog = slots?.dialog ?? components?.Dialog ?? PickersModalDialogRoot;
34
- const Transition = slots?.mobileTransition ?? components?.MobileTransition ?? Fade;
31
+ const Dialog = slots?.dialog ?? PickersModalDialogRoot;
32
+ const Transition = slots?.mobileTransition ?? Fade;
35
33
  return /*#__PURE__*/_jsx(Dialog, _extends({
36
34
  open: open,
37
35
  onClose: onDismiss
38
- }, componentsProps?.dialog, {
36
+ }, slotProps?.dialog, {
39
37
  TransitionComponent: Transition,
40
- TransitionProps: slotProps?.mobileTransition ?? componentsProps?.mobileTransition,
41
- PaperComponent: slots?.mobilePaper ?? components?.MobilePaper,
42
- PaperProps: slotProps?.mobilePaper ?? componentsProps?.mobilePaper,
38
+ TransitionProps: slotProps?.mobileTransition,
39
+ PaperComponent: slots?.mobilePaper,
40
+ PaperProps: slotProps?.mobilePaper,
43
41
  children: /*#__PURE__*/_jsx(PickersModalDialogContent, {
44
42
  children: children
45
43
  })
@@ -9,7 +9,6 @@ import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEven
9
9
  import { styled, useThemeProps } from '@mui/material/styles';
10
10
  import { getPickersPopperUtilityClass } from './pickersPopperClasses';
11
11
  import { getActiveElement } from '../utils/utils';
12
- import { uncapitalizeObjectKeys } from '../utils/slots-migration';
13
12
  import { jsx as _jsx } from "react/jsx-runtime";
14
13
  const useUtilityClasses = ownerState => {
15
14
  const {
@@ -172,13 +171,9 @@ export function PickersPopper(inProps) {
172
171
  open,
173
172
  role,
174
173
  placement,
175
- components,
176
- componentsProps,
177
- slots: innerSlots,
178
- slotProps: innerSlotProps
174
+ slots,
175
+ slotProps
179
176
  } = props;
180
- const slots = innerSlots ?? uncapitalizeObjectKeys(components);
181
- const slotProps = innerSlotProps ?? componentsProps;
182
177
  React.useEffect(() => {
183
178
  function handleKeyDown(nativeEvent) {
184
179
  // IE11, Edge (prior to using Blink?) use 'Esc'
@@ -33,6 +33,7 @@ export const useDesktopPicker = ({
33
33
  className,
34
34
  sx,
35
35
  format,
36
+ formatDensity,
36
37
  label,
37
38
  inputRef,
38
39
  readOnly,
@@ -98,6 +99,7 @@ export const useDesktopPicker = ({
98
99
  className,
99
100
  sx,
100
101
  format,
102
+ formatDensity,
101
103
  label,
102
104
  autoFocus: autoFocus && !props.open
103
105
  }),
@@ -302,8 +302,8 @@ export const useField = params => {
302
302
  if (error !== undefined) {
303
303
  return error;
304
304
  }
305
- return fieldValueManager.hasError(validationError);
306
- }, [fieldValueManager, validationError, error]);
305
+ return valueManager.hasError(validationError);
306
+ }, [valueManager, validationError, error]);
307
307
  React.useEffect(() => {
308
308
  // Select the right section when focused on mount (`autoFocus = true` on the input)
309
309
  if (inputRef.current && inputRef.current === document.activeElement) {
@@ -309,7 +309,7 @@ const getEscapedPartsFromFormat = (utils, format) => {
309
309
  }
310
310
  return escapedParts;
311
311
  };
312
- export const splitFormatIntoSections = (utils, localeText, format, date) => {
312
+ export const splitFormatIntoSections = (utils, localeText, format, date, formatDensity) => {
313
313
  let startSeparator = '';
314
314
  const sections = [];
315
315
  const commitToken = token => {
@@ -380,8 +380,8 @@ export const splitFormatIntoSections = (utils, localeText, format, date) => {
380
380
  if (cleanedSeparator !== null && cleanedSeparator.includes(' ')) {
381
381
  cleanedSeparator = `\u2069${cleanedSeparator}\u2066`;
382
382
  }
383
- if (cleanedSeparator === '/') {
384
- cleanedSeparator = ' / ';
383
+ if (formatDensity === 'spacious' && ['/', '.', '-'].includes(cleanedSeparator)) {
384
+ cleanedSeparator = ` ${cleanedSeparator} `;
385
385
  }
386
386
  return cleanedSeparator;
387
387
  };
@@ -586,7 +586,19 @@ const transferDateSectionValue = (utils, section, dateToTransferFrom, dateToTran
586
586
  }
587
587
  }
588
588
  };
589
- export const mergeDateIntoReferenceDate = (utils, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) => sections.reduce((mergedDate, section) => {
589
+ const reliableSectionModificationOrder = {
590
+ year: 1,
591
+ month: 2,
592
+ day: 3,
593
+ weekDay: 4,
594
+ hours: 5,
595
+ minutes: 6,
596
+ seconds: 7,
597
+ meridiem: 8
598
+ };
599
+ export const mergeDateIntoReferenceDate = (utils, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
600
+ // cloning sections before sort to avoid mutating it
601
+ [...sections].sort((a, b) => reliableSectionModificationOrder[a.type] - reliableSectionModificationOrder[b.type]).reduce((mergedDate, section) => {
590
602
  if (!shouldLimitToEditedSections || section.modified) {
591
603
  return transferDateSectionValue(utils, section, dateToTransferFrom, mergedDate);
592
604
  }
@@ -666,7 +678,9 @@ export const getSectionOrder = (sections, isRTL) => {
666
678
  while (RTLIndex >= 0) {
667
679
  groupedSectionsEnd = sections.findIndex(
668
680
  // eslint-disable-next-line @typescript-eslint/no-loop-func
669
- (section, index) => index >= groupedSectionsStart && section.endSeparator?.includes(' '));
681
+ (section, index) => index >= groupedSectionsStart && section.endSeparator?.includes(' ') &&
682
+ // Special case where the spaces were not there in the initial input
683
+ section.endSeparator !== ' / ');
670
684
  if (groupedSectionsEnd === -1) {
671
685
  groupedSectionsEnd = sections.length - 1;
672
686
  }
@@ -3,6 +3,29 @@ import * as React from 'react';
3
3
  import useEventCallback from '@mui/utils/useEventCallback';
4
4
  import { useUtils } from '../useUtils';
5
5
  import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions } from './useField.utils';
6
+
7
+ /**
8
+ * The letter editing and the numeric editing each define a `CharacterEditingApplier`.
9
+ * This function decides what the new section value should be and if the focus should switch to the next section.
10
+ *
11
+ * If it returns `null`, then the section value is not updated and the focus does not move.
12
+ */
13
+
14
+ /**
15
+ * Function called by `applyQuery` which decides:
16
+ * - what is the new section value ?
17
+ * - should the query used to get this value be stored for the next key press ?
18
+ *
19
+ * If it returns `{ sectionValue: string; shouldGoToNextSection: boolean }`,
20
+ * Then we store the query and update the section with the new value.
21
+ *
22
+ * If it returns `{ saveQuery: true` },
23
+ * Then we store the query and don't update the section.
24
+ *
25
+ * If it returns `{ saveQuery: false },
26
+ * Then we do nothing.
27
+ */
28
+
6
29
  const QUERY_LIFE_DURATION_MS = 5000;
7
30
  const isQueryResponseWithoutValue = response => response.saveQuery != null;
8
31
 
@@ -21,6 +21,7 @@ export const useFieldState = params => {
21
21
  defaultValue,
22
22
  onChange,
23
23
  format,
24
+ formatDensity = 'dense',
24
25
  selectedSections: selectedSectionsProp,
25
26
  onSelectedSectionsChange
26
27
  }
@@ -28,7 +29,7 @@ export const useFieldState = params => {
28
29
  const firstDefaultValue = React.useRef(defaultValue);
29
30
  const valueFromTheOutside = valueProp ?? firstDefaultValue.current ?? valueManager.emptyValue;
30
31
  const sectionsValueBoundaries = React.useMemo(() => getSectionsBoundaries(utils), [utils]);
31
- const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, isRTL, date => splitFormatIntoSections(utils, localeText, format, date)), [fieldValueManager, format, localeText, isRTL, utils]);
32
+ const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, isRTL, date => splitFormatIntoSections(utils, localeText, format, date, formatDensity)), [fieldValueManager, format, localeText, isRTL, utils, formatDensity]);
32
33
  const placeholder = React.useMemo(() => fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, isRTL]);
33
34
  const [state, setState] = React.useState(() => {
34
35
  const sections = getSectionsFromValue(valueFromTheOutside);
@@ -152,7 +153,7 @@ export const useFieldState = params => {
152
153
  if (date == null || !utils.isValid(date)) {
153
154
  return null;
154
155
  }
155
- const sections = splitFormatIntoSections(utils, localeText, format, date);
156
+ const sections = splitFormatIntoSections(utils, localeText, format, date, formatDensity);
156
157
  return mergeDateIntoReferenceDate(utils, date, sections, referenceDate, false);
157
158
  };
158
159
  const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
@@ -29,6 +29,7 @@ export const useMobilePicker = ({
29
29
  className,
30
30
  sx,
31
31
  format,
32
+ formatDensity,
32
33
  label,
33
34
  inputRef,
34
35
  readOnly,
@@ -69,6 +70,7 @@ export const useMobilePicker = ({
69
70
  className,
70
71
  sx,
71
72
  format,
73
+ formatDensity,
72
74
  label
73
75
  }),
74
76
  ownerState: props
@@ -1,5 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { useIsLandscape } from '../useIsLandscape';
3
+
4
+ /**
5
+ * Props used to create the layout of the views.
6
+ * Those props are exposed on all the pickers.
7
+ */
8
+
3
9
  /**
4
10
  * Prepare the props for the view layout (managed by `PickersLayout`)
5
11
  */