@mui/x-date-pickers 7.22.3 → 8.0.0-alpha.1

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 (514) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +1 -1
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +3 -3
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -1
  4. package/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts +1 -1
  5. package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +1 -1
  6. package/AdapterDayjs/AdapterDayjs.d.ts +2 -2
  7. package/AdapterLuxon/AdapterLuxon.d.ts +2 -2
  8. package/AdapterMoment/AdapterMoment.d.ts +2 -2
  9. package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -2
  10. package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -2
  11. package/CHANGELOG.md +348 -12
  12. package/DateCalendar/DateCalendar.d.ts +1 -2
  13. package/DateCalendar/DateCalendar.js +21 -22
  14. package/DateCalendar/DateCalendar.types.d.ts +21 -31
  15. package/DateCalendar/DayCalendar.d.ts +25 -24
  16. package/DateCalendar/DayCalendar.js +13 -10
  17. package/DateCalendar/index.d.ts +1 -0
  18. package/DateCalendar/useCalendarState.d.ts +16 -16
  19. package/DateCalendar/useIsDateDisabled.d.ts +2 -2
  20. package/DateField/DateField.d.ts +1 -2
  21. package/DateField/DateField.js +8 -10
  22. package/DateField/DateField.types.d.ts +8 -9
  23. package/DateField/index.d.ts +1 -1
  24. package/DateField/useDateField.d.ts +1 -2
  25. package/DatePicker/DatePicker.d.ts +1 -2
  26. package/DatePicker/DatePicker.js +15 -14
  27. package/DatePicker/DatePicker.types.d.ts +10 -11
  28. package/DatePicker/DatePickerToolbar.d.ts +2 -2
  29. package/DatePicker/DatePickerToolbar.js +2 -4
  30. package/DatePicker/shared.d.ts +11 -11
  31. package/DateTimeField/DateTimeField.d.ts +1 -2
  32. package/DateTimeField/DateTimeField.js +9 -12
  33. package/DateTimeField/DateTimeField.types.d.ts +9 -14
  34. package/DateTimeField/index.d.ts +1 -1
  35. package/DateTimeField/useDateTimeField.d.ts +1 -2
  36. package/DateTimePicker/DateTimePicker.d.ts +1 -2
  37. package/DateTimePicker/DateTimePicker.js +16 -16
  38. package/DateTimePicker/DateTimePicker.types.d.ts +10 -13
  39. package/DateTimePicker/DateTimePickerTabs.d.ts +1 -2
  40. package/DateTimePicker/DateTimePickerTabs.js +2 -2
  41. package/DateTimePicker/DateTimePickerToolbar.d.ts +5 -5
  42. package/DateTimePicker/DateTimePickerToolbar.js +8 -7
  43. package/DateTimePicker/shared.d.ts +12 -12
  44. package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -2
  45. package/DesktopDatePicker/DesktopDatePicker.js +17 -16
  46. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +7 -7
  47. package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -2
  48. package/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
  49. package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
  50. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -2
  51. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
  52. package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -2
  53. package/DesktopTimePicker/DesktopTimePicker.js +11 -6
  54. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
  55. package/DigitalClock/DigitalClock.d.ts +1 -2
  56. package/DigitalClock/DigitalClock.js +8 -6
  57. package/DigitalClock/DigitalClock.types.d.ts +4 -4
  58. package/LocalizationProvider/LocalizationProvider.d.ts +12 -12
  59. package/MobileDatePicker/MobileDatePicker.d.ts +1 -2
  60. package/MobileDatePicker/MobileDatePicker.js +17 -16
  61. package/MobileDatePicker/MobileDatePicker.types.d.ts +7 -7
  62. package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -2
  63. package/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
  64. package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +7 -7
  65. package/MobileTimePicker/MobileTimePicker.d.ts +2 -2
  66. package/MobileTimePicker/MobileTimePicker.js +11 -6
  67. package/MobileTimePicker/MobileTimePicker.types.d.ts +7 -7
  68. package/MonthCalendar/MonthCalendar.d.ts +3 -4
  69. package/MonthCalendar/MonthCalendar.js +18 -14
  70. package/MonthCalendar/MonthCalendar.types.d.ts +14 -15
  71. package/MonthCalendar/PickersMonth.js +17 -13
  72. package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +1 -2
  73. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
  74. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +3 -4
  75. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +9 -9
  76. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +2 -3
  77. package/PickersActionBar/PickersActionBar.js +2 -2
  78. package/PickersCalendarHeader/PickersCalendarHeader.d.ts +1 -2
  79. package/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
  80. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +9 -9
  81. package/PickersDay/PickersDay.d.ts +8 -8
  82. package/PickersLayout/PickersLayout.d.ts +2 -3
  83. package/PickersLayout/PickersLayout.js +0 -2
  84. package/PickersLayout/PickersLayout.types.d.ts +16 -19
  85. package/PickersLayout/index.d.ts +1 -1
  86. package/PickersLayout/usePickerLayout.d.ts +1 -2
  87. package/PickersLayout/usePickerLayout.js +18 -23
  88. package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
  89. package/PickersTextField/PickersTextField.js +2 -2
  90. package/README.md +4 -4
  91. package/StaticDatePicker/StaticDatePicker.d.ts +1 -2
  92. package/StaticDatePicker/StaticDatePicker.js +14 -13
  93. package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
  94. package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -2
  95. package/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
  96. package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
  97. package/StaticTimePicker/StaticTimePicker.d.ts +1 -2
  98. package/StaticTimePicker/StaticTimePicker.js +8 -3
  99. package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
  100. package/TimeClock/Clock.d.ts +4 -5
  101. package/TimeClock/Clock.js +4 -3
  102. package/TimeClock/ClockNumbers.d.ts +5 -5
  103. package/TimeClock/TimeClock.d.ts +1 -2
  104. package/TimeClock/TimeClock.js +8 -6
  105. package/TimeClock/TimeClock.types.d.ts +4 -4
  106. package/TimeField/TimeField.d.ts +1 -2
  107. package/TimeField/TimeField.js +6 -6
  108. package/TimeField/TimeField.types.d.ts +9 -14
  109. package/TimeField/index.d.ts +1 -1
  110. package/TimeField/useTimeField.d.ts +1 -2
  111. package/TimePicker/TimePicker.d.ts +1 -2
  112. package/TimePicker/TimePicker.js +9 -4
  113. package/TimePicker/TimePicker.types.d.ts +10 -13
  114. package/TimePicker/TimePickerToolbar.d.ts +2 -2
  115. package/TimePicker/TimePickerToolbar.js +8 -7
  116. package/TimePicker/shared.d.ts +10 -10
  117. package/YearCalendar/PickersYear.js +17 -13
  118. package/YearCalendar/YearCalendar.d.ts +1 -2
  119. package/YearCalendar/YearCalendar.js +18 -14
  120. package/YearCalendar/YearCalendar.types.d.ts +14 -15
  121. package/dateViewRenderers/dateViewRenderers.d.ts +3 -3
  122. package/hooks/index.d.ts +2 -2
  123. package/hooks/index.js +2 -2
  124. package/hooks/useClearableField.js +4 -3
  125. package/hooks/useParsedFormat.d.ts +2 -3
  126. package/hooks/useParsedFormat.js +2 -2
  127. package/hooks/usePickerContext.d.ts +4 -0
  128. package/hooks/usePickerContext.js +15 -0
  129. package/hooks/usePickerTranslations.d.ts +1 -0
  130. package/{modern/hooks/usePickersTranslations.js → hooks/usePickerTranslations.js} +1 -1
  131. package/hooks/useSplitFieldProps.d.ts +3 -3
  132. package/index.js +1 -1
  133. package/internals/components/PickerProvider.d.ts +67 -0
  134. package/internals/components/PickerProvider.js +40 -0
  135. package/internals/hooks/date-helpers-hooks.d.ts +6 -6
  136. package/internals/hooks/defaultizedFieldProps.d.ts +7 -8
  137. package/internals/hooks/useClockReferenceDate.d.ts +5 -5
  138. package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -2
  139. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
  140. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +15 -15
  141. package/internals/hooks/useField/buildSectionsFromFormat.d.ts +5 -5
  142. package/internals/hooks/useField/useField.d.ts +3 -3
  143. package/internals/hooks/useField/useField.js +1 -1
  144. package/internals/hooks/useField/useField.types.d.ts +40 -50
  145. package/internals/hooks/useField/useField.utils.d.ts +15 -15
  146. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +4 -4
  147. package/internals/hooks/useField/useFieldState.d.ts +4 -4
  148. package/internals/hooks/useField/useFieldState.js +4 -3
  149. package/internals/hooks/useField/useFieldV7TextField.js +4 -3
  150. package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -2
  151. package/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
  152. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
  153. package/internals/hooks/usePicker/usePicker.d.ts +2 -2
  154. package/internals/hooks/usePicker/usePicker.js +15 -10
  155. package/internals/hooks/usePicker/usePicker.types.d.ts +9 -7
  156. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +6 -8
  157. package/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
  158. package/internals/hooks/usePicker/usePickerProvider.d.ts +26 -0
  159. package/internals/hooks/usePicker/usePickerProvider.js +77 -0
  160. package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
  161. package/internals/hooks/usePicker/usePickerValue.js +7 -10
  162. package/internals/hooks/usePicker/usePickerValue.types.d.ts +38 -39
  163. package/internals/hooks/usePicker/usePickerViews.d.ts +7 -11
  164. package/internals/hooks/usePicker/usePickerViews.js +1 -0
  165. package/internals/hooks/usePickerPrivateContext.d.ts +4 -0
  166. package/internals/hooks/usePickerPrivateContext.js +9 -0
  167. package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +1 -2
  168. package/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
  169. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
  170. package/internals/hooks/useUtils.d.ts +7 -7
  171. package/internals/hooks/useValueWithTimezone.d.ts +19 -15
  172. package/internals/hooks/useValueWithTimezone.js +13 -1
  173. package/internals/hooks/useViews.d.ts +3 -3
  174. package/internals/hooks/useViews.js +1 -1
  175. package/internals/index.d.ts +7 -5
  176. package/internals/index.js +2 -1
  177. package/internals/models/common.d.ts +2 -1
  178. package/internals/models/fields.d.ts +32 -7
  179. package/internals/models/formProps.d.ts +14 -0
  180. package/internals/models/helpers.d.ts +0 -4
  181. package/internals/models/index.d.ts +2 -0
  182. package/internals/models/index.js +3 -1
  183. package/internals/models/props/basePickerProps.d.ts +5 -6
  184. package/internals/models/props/{clock.d.ts → time.d.ts} +10 -17
  185. package/internals/models/props/toolbar.d.ts +0 -2
  186. package/internals/models/validation.d.ts +21 -25
  187. package/internals/models/value.d.ts +3 -0
  188. package/internals/models/value.js +1 -0
  189. package/internals/utils/date-time-utils.d.ts +7 -7
  190. package/internals/utils/date-utils.d.ts +17 -17
  191. package/internals/utils/getDefaultReferenceDate.d.ts +10 -10
  192. package/internals/utils/time-utils.d.ts +5 -5
  193. package/internals/utils/valueManagers.d.ts +3 -3
  194. package/locales/beBY.d.ts +3 -3
  195. package/locales/beBY.js +3 -3
  196. package/locales/bgBG.d.ts +3 -3
  197. package/locales/bgBG.js +3 -3
  198. package/locales/caES.d.ts +3 -3
  199. package/locales/caES.js +3 -3
  200. package/locales/csCZ.d.ts +3 -3
  201. package/locales/csCZ.js +3 -3
  202. package/locales/daDK.d.ts +3 -3
  203. package/locales/daDK.js +3 -3
  204. package/locales/deDE.d.ts +3 -3
  205. package/locales/deDE.js +3 -3
  206. package/locales/elGR.d.ts +3 -3
  207. package/locales/elGR.js +12 -13
  208. package/locales/enUS.d.ts +4 -4
  209. package/locales/enUS.js +3 -3
  210. package/locales/esES.d.ts +3 -3
  211. package/locales/esES.js +3 -3
  212. package/locales/eu.d.ts +3 -3
  213. package/locales/eu.js +3 -3
  214. package/locales/faIR.d.ts +3 -3
  215. package/locales/faIR.js +3 -3
  216. package/locales/fiFI.d.ts +3 -3
  217. package/locales/fiFI.js +3 -3
  218. package/locales/frFR.d.ts +3 -3
  219. package/locales/frFR.js +3 -3
  220. package/locales/heIL.d.ts +3 -3
  221. package/locales/heIL.js +3 -3
  222. package/locales/hrHR.d.ts +3 -3
  223. package/locales/hrHR.js +3 -3
  224. package/locales/huHU.d.ts +3 -3
  225. package/locales/huHU.js +3 -3
  226. package/locales/isIS.d.ts +3 -3
  227. package/locales/isIS.js +3 -3
  228. package/locales/itIT.d.ts +3 -3
  229. package/locales/itIT.js +3 -3
  230. package/locales/jaJP.d.ts +3 -3
  231. package/locales/jaJP.js +3 -3
  232. package/locales/koKR.d.ts +3 -3
  233. package/locales/koKR.js +3 -3
  234. package/locales/kzKZ.d.ts +3 -3
  235. package/locales/kzKZ.js +3 -3
  236. package/locales/mk.d.ts +3 -3
  237. package/locales/mk.js +3 -3
  238. package/locales/nbNO.d.ts +3 -3
  239. package/locales/nbNO.js +3 -3
  240. package/locales/nlNL.d.ts +3 -3
  241. package/locales/nlNL.js +3 -3
  242. package/locales/nnNO.d.ts +3 -3
  243. package/locales/nnNO.js +3 -3
  244. package/locales/plPL.d.ts +3 -3
  245. package/locales/plPL.js +3 -3
  246. package/locales/ptBR.d.ts +3 -3
  247. package/locales/ptBR.js +5 -3
  248. package/locales/ptPT.d.ts +3 -3
  249. package/locales/ptPT.js +3 -3
  250. package/locales/roRO.d.ts +3 -3
  251. package/locales/roRO.js +3 -3
  252. package/locales/ruRU.d.ts +3 -3
  253. package/locales/ruRU.js +3 -3
  254. package/locales/skSK.d.ts +3 -3
  255. package/locales/skSK.js +3 -3
  256. package/locales/svSE.d.ts +3 -3
  257. package/locales/svSE.js +3 -3
  258. package/locales/trTR.d.ts +3 -3
  259. package/locales/trTR.js +3 -3
  260. package/locales/ukUA.d.ts +3 -3
  261. package/locales/ukUA.js +3 -3
  262. package/locales/urPK.d.ts +3 -3
  263. package/locales/urPK.js +3 -3
  264. package/locales/utils/getPickersLocalization.d.ts +9 -9
  265. package/locales/utils/getPickersLocalization.js +1 -1
  266. package/locales/utils/pickersLocaleTextApi.d.ts +12 -36
  267. package/locales/viVN.d.ts +3 -3
  268. package/locales/viVN.js +3 -3
  269. package/locales/zhCN.d.ts +3 -3
  270. package/locales/zhCN.js +3 -3
  271. package/locales/zhHK.d.ts +3 -3
  272. package/locales/zhHK.js +3 -3
  273. package/models/adapters.d.ts +151 -202
  274. package/models/common.d.ts +1 -0
  275. package/models/fields.d.ts +9 -42
  276. package/models/pickers.d.ts +28 -6
  277. package/modern/DateCalendar/DateCalendar.js +21 -22
  278. package/modern/DateCalendar/DayCalendar.js +13 -10
  279. package/modern/DateField/DateField.js +8 -10
  280. package/modern/DatePicker/DatePicker.js +15 -14
  281. package/modern/DatePicker/DatePickerToolbar.js +2 -4
  282. package/modern/DateTimeField/DateTimeField.js +9 -12
  283. package/modern/DateTimePicker/DateTimePicker.js +16 -16
  284. package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
  285. package/modern/DateTimePicker/DateTimePickerToolbar.js +8 -7
  286. package/modern/DesktopDatePicker/DesktopDatePicker.js +17 -16
  287. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
  288. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
  289. package/modern/DesktopTimePicker/DesktopTimePicker.js +11 -6
  290. package/modern/DigitalClock/DigitalClock.js +8 -6
  291. package/modern/MobileDatePicker/MobileDatePicker.js +17 -16
  292. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
  293. package/modern/MobileTimePicker/MobileTimePicker.js +11 -6
  294. package/modern/MonthCalendar/MonthCalendar.js +18 -14
  295. package/modern/MonthCalendar/PickersMonth.js +17 -13
  296. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
  297. package/modern/PickersActionBar/PickersActionBar.js +2 -2
  298. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
  299. package/modern/PickersLayout/PickersLayout.js +0 -2
  300. package/modern/PickersLayout/usePickerLayout.js +18 -23
  301. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
  302. package/modern/PickersTextField/PickersTextField.js +2 -2
  303. package/modern/StaticDatePicker/StaticDatePicker.js +14 -13
  304. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
  305. package/modern/StaticTimePicker/StaticTimePicker.js +8 -3
  306. package/modern/TimeClock/Clock.js +4 -3
  307. package/modern/TimeClock/TimeClock.js +8 -6
  308. package/modern/TimeField/TimeField.js +6 -6
  309. package/modern/TimePicker/TimePicker.js +9 -4
  310. package/modern/TimePicker/TimePickerToolbar.js +8 -7
  311. package/modern/YearCalendar/PickersYear.js +17 -13
  312. package/modern/YearCalendar/YearCalendar.js +18 -14
  313. package/modern/hooks/index.js +2 -2
  314. package/modern/hooks/useClearableField.js +4 -3
  315. package/modern/hooks/useParsedFormat.js +2 -2
  316. package/modern/hooks/usePickerContext.js +15 -0
  317. package/{hooks/usePickersTranslations.js → modern/hooks/usePickerTranslations.js} +1 -1
  318. package/modern/index.js +1 -1
  319. package/modern/internals/components/PickerProvider.js +40 -0
  320. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
  321. package/modern/internals/hooks/useField/useField.js +1 -1
  322. package/modern/internals/hooks/useField/useFieldState.js +4 -3
  323. package/modern/internals/hooks/useField/useFieldV7TextField.js +4 -3
  324. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
  325. package/modern/internals/hooks/usePicker/usePicker.js +15 -10
  326. package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
  327. package/modern/internals/hooks/usePicker/usePickerProvider.js +77 -0
  328. package/modern/internals/hooks/usePicker/usePickerValue.js +7 -10
  329. package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
  330. package/modern/internals/hooks/usePickerPrivateContext.js +9 -0
  331. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
  332. package/modern/internals/hooks/useValueWithTimezone.js +13 -1
  333. package/modern/internals/hooks/useViews.js +1 -1
  334. package/modern/internals/index.js +2 -1
  335. package/modern/internals/models/formProps.js +1 -0
  336. package/modern/internals/models/index.js +3 -1
  337. package/modern/internals/models/props/time.js +1 -0
  338. package/modern/internals/models/value.js +1 -0
  339. package/modern/locales/beBY.js +3 -3
  340. package/modern/locales/bgBG.js +3 -3
  341. package/modern/locales/caES.js +3 -3
  342. package/modern/locales/csCZ.js +3 -3
  343. package/modern/locales/daDK.js +3 -3
  344. package/modern/locales/deDE.js +3 -3
  345. package/modern/locales/elGR.js +12 -13
  346. package/modern/locales/enUS.js +3 -3
  347. package/modern/locales/esES.js +3 -3
  348. package/modern/locales/eu.js +3 -3
  349. package/modern/locales/faIR.js +3 -3
  350. package/modern/locales/fiFI.js +3 -3
  351. package/modern/locales/frFR.js +3 -3
  352. package/modern/locales/heIL.js +3 -3
  353. package/modern/locales/hrHR.js +3 -3
  354. package/modern/locales/huHU.js +3 -3
  355. package/modern/locales/isIS.js +3 -3
  356. package/modern/locales/itIT.js +3 -3
  357. package/modern/locales/jaJP.js +3 -3
  358. package/modern/locales/koKR.js +3 -3
  359. package/modern/locales/kzKZ.js +3 -3
  360. package/modern/locales/mk.js +3 -3
  361. package/modern/locales/nbNO.js +3 -3
  362. package/modern/locales/nlNL.js +3 -3
  363. package/modern/locales/nnNO.js +3 -3
  364. package/modern/locales/plPL.js +3 -3
  365. package/modern/locales/ptBR.js +5 -3
  366. package/modern/locales/ptPT.js +3 -3
  367. package/modern/locales/roRO.js +3 -3
  368. package/modern/locales/ruRU.js +3 -3
  369. package/modern/locales/skSK.js +3 -3
  370. package/modern/locales/svSE.js +3 -3
  371. package/modern/locales/trTR.js +3 -3
  372. package/modern/locales/ukUA.js +3 -3
  373. package/modern/locales/urPK.js +3 -3
  374. package/modern/locales/utils/getPickersLocalization.js +1 -1
  375. package/modern/locales/viVN.js +3 -3
  376. package/modern/locales/zhCN.js +3 -3
  377. package/modern/locales/zhHK.js +3 -3
  378. package/modern/validation/useValidation.js +2 -3
  379. package/modern/validation/validateDate.js +5 -0
  380. package/modern/validation/validateDateTime.js +5 -0
  381. package/modern/validation/validateTime.js +5 -0
  382. package/node/DateCalendar/DateCalendar.js +21 -22
  383. package/node/DateCalendar/DayCalendar.js +13 -10
  384. package/node/DateField/DateField.js +8 -10
  385. package/node/DatePicker/DatePicker.js +15 -14
  386. package/node/DatePicker/DatePickerToolbar.js +2 -4
  387. package/node/DateTimeField/DateTimeField.js +9 -12
  388. package/node/DateTimePicker/DateTimePicker.js +16 -16
  389. package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
  390. package/node/DateTimePicker/DateTimePickerToolbar.js +8 -7
  391. package/node/DesktopDatePicker/DesktopDatePicker.js +17 -16
  392. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +18 -18
  393. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +0 -2
  394. package/node/DesktopTimePicker/DesktopTimePicker.js +11 -6
  395. package/node/DigitalClock/DigitalClock.js +8 -6
  396. package/node/MobileDatePicker/MobileDatePicker.js +17 -16
  397. package/node/MobileDateTimePicker/MobileDateTimePicker.js +18 -18
  398. package/node/MobileTimePicker/MobileTimePicker.js +11 -6
  399. package/node/MonthCalendar/MonthCalendar.js +18 -14
  400. package/node/MonthCalendar/PickersMonth.js +17 -13
  401. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +8 -6
  402. package/node/PickersActionBar/PickersActionBar.js +2 -2
  403. package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -2
  404. package/node/PickersLayout/PickersLayout.js +0 -2
  405. package/node/PickersLayout/usePickerLayout.js +18 -23
  406. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
  407. package/node/PickersTextField/PickersTextField.js +2 -2
  408. package/node/StaticDatePicker/StaticDatePicker.js +14 -13
  409. package/node/StaticDateTimePicker/StaticDateTimePicker.js +15 -15
  410. package/node/StaticTimePicker/StaticTimePicker.js +8 -3
  411. package/node/TimeClock/Clock.js +4 -3
  412. package/node/TimeClock/TimeClock.js +8 -6
  413. package/node/TimeField/TimeField.js +6 -6
  414. package/node/TimePicker/TimePicker.js +9 -4
  415. package/node/TimePicker/TimePickerToolbar.js +8 -7
  416. package/node/YearCalendar/PickersYear.js +17 -13
  417. package/node/YearCalendar/YearCalendar.js +18 -14
  418. package/node/hooks/index.js +6 -6
  419. package/node/hooks/useClearableField.js +4 -3
  420. package/node/hooks/useParsedFormat.js +2 -2
  421. package/node/hooks/usePickerContext.js +21 -0
  422. package/node/hooks/usePickerTranslations.js +10 -0
  423. package/node/index.js +1 -1
  424. package/node/internals/components/PickerProvider.js +48 -0
  425. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +22 -18
  426. package/node/internals/hooks/useField/useField.js +1 -1
  427. package/node/internals/hooks/useField/useFieldState.js +4 -3
  428. package/node/internals/hooks/useField/useFieldV7TextField.js +4 -3
  429. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +24 -19
  430. package/node/internals/hooks/usePicker/usePicker.js +15 -10
  431. package/node/internals/hooks/usePicker/usePickerLayoutProps.js +2 -5
  432. package/node/internals/hooks/usePicker/usePickerProvider.js +87 -0
  433. package/node/internals/hooks/usePicker/usePickerValue.js +6 -10
  434. package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
  435. package/node/internals/hooks/usePickerPrivateContext.js +15 -0
  436. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +6 -5
  437. package/node/internals/hooks/useValueWithTimezone.js +13 -1
  438. package/node/internals/hooks/useViews.js +3 -3
  439. package/node/internals/index.js +14 -7
  440. package/node/internals/models/index.js +22 -0
  441. package/node/internals/models/props/time.js +5 -0
  442. package/node/internals/models/value.js +5 -0
  443. package/node/locales/beBY.js +3 -3
  444. package/node/locales/bgBG.js +3 -3
  445. package/node/locales/caES.js +3 -3
  446. package/node/locales/csCZ.js +3 -3
  447. package/node/locales/daDK.js +3 -3
  448. package/node/locales/deDE.js +3 -3
  449. package/node/locales/elGR.js +12 -13
  450. package/node/locales/enUS.js +3 -3
  451. package/node/locales/esES.js +3 -3
  452. package/node/locales/eu.js +3 -3
  453. package/node/locales/faIR.js +3 -3
  454. package/node/locales/fiFI.js +3 -3
  455. package/node/locales/frFR.js +3 -3
  456. package/node/locales/heIL.js +3 -3
  457. package/node/locales/hrHR.js +3 -3
  458. package/node/locales/huHU.js +3 -3
  459. package/node/locales/isIS.js +3 -3
  460. package/node/locales/itIT.js +3 -3
  461. package/node/locales/jaJP.js +3 -3
  462. package/node/locales/koKR.js +3 -3
  463. package/node/locales/kzKZ.js +3 -3
  464. package/node/locales/mk.js +3 -3
  465. package/node/locales/nbNO.js +3 -3
  466. package/node/locales/nlNL.js +3 -3
  467. package/node/locales/nnNO.js +3 -3
  468. package/node/locales/plPL.js +3 -3
  469. package/node/locales/ptBR.js +5 -3
  470. package/node/locales/ptPT.js +3 -3
  471. package/node/locales/roRO.js +3 -3
  472. package/node/locales/ruRU.js +3 -3
  473. package/node/locales/skSK.js +3 -3
  474. package/node/locales/svSE.js +3 -3
  475. package/node/locales/trTR.js +3 -3
  476. package/node/locales/ukUA.js +3 -3
  477. package/node/locales/urPK.js +3 -3
  478. package/node/locales/utils/getPickersLocalization.js +1 -1
  479. package/node/locales/viVN.js +3 -3
  480. package/node/locales/zhCN.js +3 -3
  481. package/node/locales/zhHK.js +3 -3
  482. package/node/validation/useValidation.js +2 -3
  483. package/node/validation/validateDate.js +4 -0
  484. package/node/validation/validateDateTime.js +4 -0
  485. package/node/validation/validateTime.js +4 -0
  486. package/package.json +5 -5
  487. package/themeAugmentation/props.d.ts +28 -28
  488. package/timeViewRenderers/timeViewRenderers.d.ts +6 -6
  489. package/validation/extractValidationProps.d.ts +4 -4
  490. package/validation/useValidation.d.ts +9 -10
  491. package/validation/useValidation.js +2 -3
  492. package/validation/validateDate.d.ts +7 -2
  493. package/validation/validateDate.js +5 -0
  494. package/validation/validateDateTime.d.ts +10 -4
  495. package/validation/validateDateTime.js +5 -0
  496. package/validation/validateTime.d.ts +7 -2
  497. package/validation/validateTime.js +5 -0
  498. package/hooks/usePickersContext.d.ts +0 -4
  499. package/hooks/usePickersContext.js +0 -15
  500. package/hooks/usePickersTranslations.d.ts +0 -2
  501. package/internals/components/PickersProvider.d.ts +0 -34
  502. package/internals/components/PickersProvider.js +0 -26
  503. package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -9
  504. package/internals/hooks/usePicker/usePickerOwnerState.js +0 -13
  505. package/modern/hooks/usePickersContext.js +0 -15
  506. package/modern/internals/components/PickersProvider.js +0 -26
  507. package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -13
  508. package/node/hooks/usePickersContext.js +0 -21
  509. package/node/hooks/usePickersTranslations.js +0 -10
  510. package/node/internals/components/PickersProvider.js +0 -34
  511. package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -20
  512. /package/internals/models/{props/clock.js → formProps.js} +0 -0
  513. /package/{modern/internals/models/props/clock.js → internals/models/props/time.js} +0 -0
  514. /package/node/internals/models/{props/clock.js → formProps.js} +0 -0
@@ -5,9 +5,9 @@ import { UsePickerParams } from '../usePicker';
5
5
  import { UsePickerViewsProps } from '../usePicker/usePickerViews';
6
6
  import { FieldSection, PickerValidDate } from '../../../models';
7
7
  import { DateOrTimeViewWithMeridiem } from '../../models';
8
- export interface UseStaticPickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<TDate | null, TDate, TView> {
8
+ export interface UseStaticPickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerValidDate | null, TView> {
9
9
  }
10
- export interface UseStaticPickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<TDate | null, TDate, TView> {
10
+ export interface UseStaticPickerSlotProps<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<PickerValidDate | null, TView> {
11
11
  }
12
12
  export interface StaticOnlyPickerProps {
13
13
  /**
@@ -27,19 +27,19 @@ export interface StaticOnlyPickerProps {
27
27
  */
28
28
  onClose?: () => void;
29
29
  }
30
- export interface UseStaticPickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TDate | null, TDate, TView, any, any>> extends BasePickerProps<TDate | null, TDate, TView, TError, TExternalProps, {}>, StaticOnlyPickerProps {
30
+ export interface UseStaticPickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<PickerValidDate | null, TView, any, any>> extends BasePickerProps<PickerValidDate | null, TView, TError, TExternalProps, {}>, StaticOnlyPickerProps {
31
31
  /**
32
32
  * Overridable component slots.
33
33
  * @default {}
34
34
  */
35
- slots?: UseStaticPickerSlots<TDate, TView>;
35
+ slots?: UseStaticPickerSlots<TView>;
36
36
  /**
37
37
  * The props used for each component slot.
38
38
  * @default {}
39
39
  */
40
- slotProps?: UseStaticPickerSlotProps<TDate, TView>;
40
+ slotProps?: UseStaticPickerSlotProps<TView>;
41
41
  }
42
- export interface UseStaticPickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
42
+ export interface UseStaticPickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerValidDate | null, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
43
43
  props: TExternalProps;
44
44
  /**
45
45
  * Ref to pass to the root element
@@ -1,12 +1,12 @@
1
1
  import { MuiPickersAdapterContextValue } from '../../LocalizationProvider/LocalizationProvider';
2
2
  import { PickersLocaleText } from '../../locales/utils/pickersLocaleTextApi';
3
3
  import { PickersTimezone, PickerValidDate } from '../../models';
4
- export declare const useLocalizationContext: <TDate extends PickerValidDate>() => Omit<MuiPickersAdapterContextValue<TDate>, "localeText"> & {
5
- localeText: PickersLocaleText<TDate>;
4
+ export declare const useLocalizationContext: () => Omit<MuiPickersAdapterContextValue, "localeText"> & {
5
+ localeText: PickersLocaleText;
6
6
  };
7
- export declare const useUtils: <TDate extends PickerValidDate>() => import("@mui/x-date-pickers/models").MuiPickersAdapter<TDate, any>;
8
- export declare const useDefaultDates: <TDate extends PickerValidDate>() => {
9
- minDate: TDate;
10
- maxDate: TDate;
7
+ export declare const useUtils: () => import("@mui/x-date-pickers/models").MuiPickersAdapter<any>;
8
+ export declare const useDefaultDates: () => {
9
+ minDate: PickerValidDate;
10
+ maxDate: PickerValidDate;
11
11
  };
12
- export declare const useNow: <TDate extends PickerValidDate>(timezone: PickersTimezone) => TDate;
12
+ export declare const useNow: (timezone: PickersTimezone) => PickerValidDate;
@@ -5,13 +5,7 @@ import { PickersTimezone, PickerValidDate } from '../../models';
5
5
  * - The value returned by `onChange` always have the timezone of `props.value` or `props.defaultValue` if defined
6
6
  * - The value rendered is always the one from `props.timezone` if defined
7
7
  */
8
- export declare const useValueWithTimezone: <TDate extends PickerValidDate, TValue, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, onChange, valueManager, }: {
9
- timezone: PickersTimezone | undefined;
10
- value: TValue | undefined;
11
- defaultValue: TValue | undefined;
12
- onChange: TChange | undefined;
13
- valueManager: PickerValueManager<TValue, TDate, any>;
14
- }) => {
8
+ export declare const useValueWithTimezone: <TValue, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange, valueManager, }: UseValueWithTimezoneParameters<TValue, TChange>) => {
15
9
  value: TValue;
16
10
  handleValueChange: TChange;
17
11
  timezone: string;
@@ -19,15 +13,25 @@ export declare const useValueWithTimezone: <TDate extends PickerValidDate, TValu
19
13
  /**
20
14
  * Wrapper around `useControlled` and `useValueWithTimezone`
21
15
  */
22
- export declare const useControlledValueWithTimezone: <TDate extends PickerValidDate, TValue, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, onChange: onChangeProp, valueManager, }: {
23
- name: string;
24
- timezone: PickersTimezone | undefined;
25
- value: TValue | undefined;
26
- defaultValue: TValue | undefined;
27
- onChange: TChange | undefined;
28
- valueManager: PickerValueManager<TValue, TDate, any>;
29
- }) => {
16
+ export declare const useControlledValueWithTimezone: <TValue, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange: onChangeProp, valueManager, }: UseControlledValueWithTimezoneParameters<TValue, TChange>) => {
30
17
  value: TValue;
31
18
  handleValueChange: TChange;
32
19
  timezone: string;
33
20
  };
21
+ interface UseValueWithTimezoneParameters<TValue, TChange extends (...params: any[]) => void> {
22
+ timezone: PickersTimezone | undefined;
23
+ value: TValue | undefined;
24
+ defaultValue: TValue | undefined;
25
+ /**
26
+ * The reference date as passed to `props.referenceDate`.
27
+ * It does not need to have its default value.
28
+ * This is only used to determine the timezone to use when `props.value` and `props.defaultValue` are not defined.
29
+ */
30
+ referenceDate: PickerValidDate | undefined;
31
+ onChange: TChange | undefined;
32
+ valueManager: PickerValueManager<TValue, any>;
33
+ }
34
+ interface UseControlledValueWithTimezoneParameters<TValue, TChange extends (...params: any[]) => void> extends UseValueWithTimezoneParameters<TValue, TChange> {
35
+ name: string;
36
+ }
37
+ export {};
@@ -11,6 +11,7 @@ export const useValueWithTimezone = ({
11
11
  timezone: timezoneProp,
12
12
  value: valueProp,
13
13
  defaultValue,
14
+ referenceDate,
14
15
  onChange,
15
16
  valueManager
16
17
  }) => {
@@ -24,7 +25,16 @@ export const useValueWithTimezone = ({
24
25
  }
25
26
  return valueManager.setTimezone(utils, inputTimezone, newValue);
26
27
  });
27
- const timezoneToRender = timezoneProp ?? inputTimezone ?? 'default';
28
+ let timezoneToRender;
29
+ if (timezoneProp) {
30
+ timezoneToRender = timezoneProp;
31
+ } else if (inputTimezone) {
32
+ timezoneToRender = inputTimezone;
33
+ } else if (referenceDate) {
34
+ timezoneToRender = utils.getTimezone(referenceDate);
35
+ } else {
36
+ timezoneToRender = 'default';
37
+ }
28
38
  const valueWithTimezoneToRender = React.useMemo(() => valueManager.setTimezone(utils, timezoneToRender, inputValue), [valueManager, utils, timezoneToRender, inputValue]);
29
39
  const handleValueChange = useEventCallback((newValue, ...otherParams) => {
30
40
  const newValueWithInputTimezone = setInputTimezone(newValue);
@@ -45,6 +55,7 @@ export const useControlledValueWithTimezone = ({
45
55
  timezone: timezoneProp,
46
56
  value: valueProp,
47
57
  defaultValue,
58
+ referenceDate,
48
59
  onChange: onChangeProp,
49
60
  valueManager
50
61
  }) => {
@@ -62,6 +73,7 @@ export const useControlledValueWithTimezone = ({
62
73
  timezone: timezoneProp,
63
74
  value: valueWithInputTimezone,
64
75
  defaultValue: undefined,
76
+ referenceDate,
65
77
  onChange,
66
78
  valueManager
67
79
  });
@@ -1,8 +1,8 @@
1
+ import { MakeOptional } from '@mui/x-internals/types';
1
2
  import type { PickerSelectionState } from './usePicker';
2
- import { MakeOptional } from '../models/helpers';
3
3
  import { DateOrTimeViewWithMeridiem } from '../models';
4
4
  import { PickerValidDate } from '../../models';
5
- export type PickerOnChangeFn<TDate extends PickerValidDate> = (date: TDate | null, selectionState?: PickerSelectionState) => void;
5
+ export type PickerOnChangeFn = (date: PickerValidDate | null, selectionState?: PickerSelectionState) => void;
6
6
  export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> {
7
7
  /**
8
8
  * Callback fired when the value changes.
@@ -54,7 +54,7 @@ export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridie
54
54
  */
55
55
  onFocusedViewChange?: (view: TView, hasFocus: boolean) => void;
56
56
  }
57
- export interface ExportedUseViewsOptions<TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<any, TView>, 'onChange' | 'openTo' | 'views'> {
57
+ export interface ExportedUseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<TValue, TView>, 'onChange' | 'openTo' | 'views'> {
58
58
  }
59
59
  interface UseViewsResponse<TValue, TView extends DateOrTimeViewWithMeridiem> {
60
60
  view: TView;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import useEventCallback from '@mui/utils/useEventCallback';
3
- import { unstable_useControlled as useControlled } from '@mui/utils';
3
+ import useControlled from '@mui/utils/useControlled';
4
4
  let warnedOnceNotValidView = false;
5
5
  export function useViews({
6
6
  onChange,
@@ -1,6 +1,6 @@
1
1
  export { PickersArrowSwitcher } from './components/PickersArrowSwitcher/PickersArrowSwitcher';
2
2
  export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, } from './components/PickersArrowSwitcher';
3
- export { PickersProvider } from './components/PickersProvider';
3
+ export { PickerProvider } from './components/PickerProvider';
4
4
  export { PickersModalDialog } from './components/PickersModalDialog';
5
5
  export type { PickersModalDialogSlots, PickersModalDialogSlotProps, } from './components/PickersModalDialog';
6
6
  export { PickersPopper } from './components/PickersPopper';
@@ -31,20 +31,22 @@ export { usePicker } from './hooks/usePicker';
31
31
  export type { UsePickerResponse, UsePickerParams, UsePickerProps, UsePickerValueFieldResponse, PickerViewsRendererProps, } from './hooks/usePicker';
32
32
  export type { UsePickerValueNonStaticProps, PickerValueManager, PickerSelectionState, } from './hooks/usePicker/usePickerValue.types';
33
33
  export type { UsePickerViewsNonStaticProps, PickerViewRendererLookup, PickerViewRenderer, UsePickerViewsProps, } from './hooks/usePicker/usePickerViews';
34
+ export { usePickerPrivateContext } from './hooks/usePickerPrivateContext';
34
35
  export { useStaticPicker } from './hooks/useStaticPicker';
35
36
  export type { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps, } from './hooks/useStaticPicker';
36
37
  export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hooks/useUtils';
37
38
  export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews';
38
39
  export { useViews } from './hooks/useViews';
39
40
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
40
- export type { BaseFieldProps } from './models/fields';
41
+ export type { BaseSingleInputFieldProps } from './models/fields';
41
42
  export type { BasePickerProps, BasePickerInputProps, BaseNonStaticPickerProps, } from './models/props/basePickerProps';
42
- export type { BaseClockProps, DesktopOnlyTimePickerProps } from './models/props/clock';
43
+ export type { BaseClockProps, DesktopOnlyTimePickerProps, AmPmProps } from './models/props/time';
43
44
  export type { BaseTabsProps, ExportedBaseTabsProps } from './models/props/tabs';
44
45
  export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/toolbar';
45
- export type { DefaultizedProps, MakeOptional, SlotComponentPropsFromProps } from './models/helpers';
46
- export type { WrapperVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem, } from './models/common';
46
+ export type { FormProps } from './models/formProps';
47
+ export type { PickerVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem, } from './models/common';
47
48
  export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
49
+ export type { PickerRangeValue } from './models/value';
48
50
  export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
49
51
  export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
50
52
  export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
@@ -1,5 +1,5 @@
1
1
  export { PickersArrowSwitcher } from "./components/PickersArrowSwitcher/PickersArrowSwitcher.js";
2
- export { PickersProvider } from "./components/PickersProvider.js";
2
+ export { PickerProvider } from "./components/PickerProvider.js";
3
3
  export { PickersModalDialog } from "./components/PickersModalDialog.js";
4
4
  export { PickersPopper } from "./components/PickersPopper.js";
5
5
  export { PickersToolbar } from "./components/PickersToolbar.js";
@@ -13,6 +13,7 @@ export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js
13
13
  export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
14
14
  export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
15
15
  export { usePicker } from "./hooks/usePicker/index.js";
16
+ export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
16
17
  export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
17
18
  export { useLocalizationContext, useDefaultDates, useUtils, useNow } from "./hooks/useUtils.js";
18
19
  export { useViews } from "./hooks/useViews.js";
@@ -1,4 +1,5 @@
1
1
  import { DateView, TimeView } from '../../models/views';
2
- export type WrapperVariant = 'mobile' | 'desktop' | null;
2
+ export type PickerOrientation = 'portrait' | 'landscape';
3
+ export type PickerVariant = 'mobile' | 'desktop' | null;
3
4
  export type TimeViewWithMeridiem = TimeView | 'meridiem';
4
5
  export type DateOrTimeViewWithMeridiem = DateView | TimeViewWithMeridiem;
@@ -1,10 +1,35 @@
1
- import * as React from 'react';
1
+ import { SxProps } from '@mui/material/styles';
2
+ import { MakeRequired } from '@mui/x-internals/types';
3
+ import type { ExportedUseClearableFieldProps, UseClearableFieldSlotProps, UseClearableFieldSlots } from '../../hooks/useClearableField';
4
+ import type { FieldSection, PickerOwnerState } from '../../models';
2
5
  import type { UseFieldInternalProps } from '../hooks/useField';
3
- import { FieldSection, PickerValidDate } from '../../models';
4
- import type { ExportedUseClearableFieldProps } from '../../hooks/useClearableField';
5
- export interface BaseFieldProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Omit<UseFieldInternalProps<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'format'>, ExportedUseClearableFieldProps {
6
- className?: string;
7
- format?: string;
8
- disabled?: boolean;
6
+ export interface BaseForwardedSingleInputFieldProps extends ExportedUseClearableFieldProps {
7
+ className: string | undefined;
8
+ sx: SxProps<any> | undefined;
9
+ label: React.ReactNode | undefined;
10
+ name: string | undefined;
11
+ id?: string;
12
+ focused?: boolean;
13
+ onKeyDown?: React.KeyboardEventHandler;
14
+ onBlur?: React.FocusEventHandler;
9
15
  ref?: React.Ref<HTMLDivElement>;
16
+ inputRef?: React.Ref<HTMLInputElement>;
17
+ InputProps?: {
18
+ ref?: React.Ref<any>;
19
+ endAdornment?: React.ReactNode;
20
+ startAdornment?: React.ReactNode;
21
+ };
22
+ inputProps?: {
23
+ 'aria-label'?: string;
24
+ };
25
+ slots?: UseClearableFieldSlots;
26
+ slotProps?: UseClearableFieldSlotProps & {
27
+ textField?: {};
28
+ };
29
+ ownerState: PickerOwnerState;
10
30
  }
31
+ /**
32
+ * Props the single input field can receive when used inside a picker.
33
+ * Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
34
+ */
35
+ export type BaseSingleInputFieldProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> = MakeRequired<Pick<UseFieldInternalProps<TValue, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'value' | 'onChange' | 'unstableFieldRef' | 'autoFocus'>, 'format' | 'value' | 'onChange' | 'timezone'> & BaseForwardedSingleInputFieldProps;
@@ -0,0 +1,14 @@
1
+ export interface FormProps {
2
+ /**
3
+ * If `true`, the component is disabled.
4
+ * When disabled, the value cannot be changed and no interaction is possible.
5
+ * @default false
6
+ */
7
+ disabled?: boolean;
8
+ /**
9
+ * If `true`, the component is read-only.
10
+ * When read-only, the value cannot be changed but the user can interact with the interface.
11
+ * @default false
12
+ */
13
+ readOnly?: boolean;
14
+ }
@@ -4,7 +4,3 @@
4
4
  * `style`.
5
5
  */
6
6
  export type ExtendMui<C, Removals extends keyof C = never> = Omit<C, 'classes' | 'theme' | Removals>;
7
- export type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
8
- export type MakeRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
9
- export type DefaultizedProps<P extends {}, RequiredProps extends keyof P, AdditionalProps extends {} = {}> = Omit<P, RequiredProps | keyof AdditionalProps> & Required<Pick<P, RequiredProps>> & AdditionalProps;
10
- export type SlotComponentPropsFromProps<TProps extends {}, TOverrides extends {}, TOwnerState extends {}> = (Partial<TProps> & TOverrides) | ((ownerState: TOwnerState) => Partial<TProps> & TOverrides);
@@ -1,2 +1,4 @@
1
1
  export * from './fields';
2
2
  export * from './common';
3
+ export * from './value';
4
+ export * from './formProps';
@@ -1,2 +1,4 @@
1
1
  export * from "./fields.js";
2
- export * from "./common.js";
2
+ export * from "./common.js";
3
+ export * from "./value.js";
4
+ export * from "./formProps.js";
@@ -1,17 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { Theme } from '@mui/material/styles';
3
3
  import { SxProps } from '@mui/system';
4
+ import { MakeOptional } from '@mui/x-internals/types';
4
5
  import { UsePickerBaseProps } from '../../hooks/usePicker';
5
6
  import { PickersInputComponentLocaleText } from '../../../locales/utils/pickersLocaleTextApi';
6
7
  import type { UsePickerViewsProps } from '../../hooks/usePicker/usePickerViews';
7
- import { MakeOptional } from '../helpers';
8
8
  import { DateOrTimeViewWithMeridiem } from '../common';
9
9
  import { UseFieldInternalProps } from '../../hooks/useField';
10
- import { PickerValidDate } from '../../../models';
11
10
  /**
12
11
  * Props common to all pickers after applying the default props on each picker.
13
12
  */
14
- export interface BasePickerProps<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TDate, TView, any, any>, TAdditionalProps extends {}> extends UsePickerBaseProps<TValue, TDate, TView, TError, TExternalProps, TAdditionalProps> {
13
+ export interface BasePickerProps<TValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps, TAdditionalProps> {
15
14
  className?: string;
16
15
  /**
17
16
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -21,18 +20,18 @@ export interface BasePickerProps<TValue, TDate extends PickerValidDate, TView ex
21
20
  * Locale for components texts.
22
21
  * Allows overriding texts coming from `LocalizationProvider` and `theme`.
23
22
  */
24
- localeText?: PickersInputComponentLocaleText<TDate>;
23
+ localeText?: PickersInputComponentLocaleText;
25
24
  }
26
25
  /**
27
26
  * Props common to all pickers before applying the default props on each picker.
28
27
  */
29
- export interface BasePickerInputProps<TValue, TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError> extends Omit<MakeOptional<BasePickerProps<TValue, TDate, TView, TError, any, any>, 'openTo' | 'views'>, 'viewRenderers'> {
28
+ export interface BasePickerInputProps<TValue, TView extends DateOrTimeViewWithMeridiem, TError> extends Omit<MakeOptional<BasePickerProps<TValue, TView, TError, any, any>, 'openTo' | 'views'>, 'viewRenderers'> {
30
29
  }
31
30
  /**
32
31
  * Props common to all non-static pickers.
33
32
  * These props are handled by the headless wrappers.
34
33
  */
35
- export interface BaseNonStaticPickerProps extends Pick<UseFieldInternalProps<any, any, any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {
34
+ export interface BaseNonStaticPickerProps extends Pick<UseFieldInternalProps<any, any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {
36
35
  /**
37
36
  * Format of the date when rendered in the input(s).
38
37
  * Defaults to localized format based on the used `views`.
@@ -1,18 +1,21 @@
1
1
  import { SxProps, Theme } from '@mui/material/styles';
2
- import { BaseTimeValidationProps, TimeValidationProps } from '../validation';
3
2
  import { PickerValidDate, TimeStepOptions, TimezoneProps } from '../../../models';
4
3
  import type { ExportedDigitalClockProps } from '../../../DigitalClock/DigitalClock.types';
5
4
  import type { ExportedMultiSectionDigitalClockProps } from '../../../MultiSectionDigitalClock/MultiSectionDigitalClock.types';
6
5
  import type { ExportedUseViewsOptions } from '../../hooks/useViews';
7
6
  import { TimeViewWithMeridiem } from '../common';
8
- export interface ExportedBaseClockProps<TDate extends PickerValidDate> extends TimeValidationProps<TDate>, BaseTimeValidationProps, TimezoneProps {
7
+ import { ExportedValidateTimeProps } from '../../../validation/validateTime';
8
+ import { FormProps } from '../formProps';
9
+ export interface AmPmProps {
9
10
  /**
10
11
  * 12h/24h view for hour selection clock.
11
12
  * @default utils.is12HourCycleInCurrentLocale()
12
13
  */
13
14
  ampm?: boolean;
14
15
  }
15
- export interface BaseClockProps<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem> extends ExportedUseViewsOptions<TView>, ExportedBaseClockProps<TDate> {
16
+ export interface ExportedBaseClockProps extends ExportedValidateTimeProps, TimezoneProps, AmPmProps {
17
+ }
18
+ export interface BaseClockProps<TView extends TimeViewWithMeridiem> extends ExportedUseViewsOptions<PickerValidDate | null, TView>, ExportedBaseClockProps, FormProps {
16
19
  className?: string;
17
20
  /**
18
21
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -22,29 +25,19 @@ export interface BaseClockProps<TDate extends PickerValidDate, TView extends Tim
22
25
  * The selected value.
23
26
  * Used when the component is controlled.
24
27
  */
25
- value?: TDate | null;
28
+ value?: PickerValidDate | null;
26
29
  /**
27
30
  * The default selected value.
28
31
  * Used when the component is not controlled.
29
32
  */
30
- defaultValue?: TDate | null;
31
- /**
32
- * If `true`, the picker views and text field are disabled.
33
- * @default false
34
- */
35
- disabled?: boolean;
36
- /**
37
- * If `true`, the picker views and text field are read-only.
38
- * @default false
39
- */
40
- readOnly?: boolean;
33
+ defaultValue?: PickerValidDate | null;
41
34
  /**
42
35
  * The date used to generate the new value when both `value` and `defaultValue` are empty.
43
36
  * @default The closest valid time using the validation props, except callbacks such as `shouldDisableTime`.
44
37
  */
45
- referenceDate?: TDate;
38
+ referenceDate?: PickerValidDate;
46
39
  }
47
- export interface DesktopOnlyTimePickerProps<TDate extends PickerValidDate> extends Omit<ExportedDigitalClockProps<TDate>, 'timeStep'>, Omit<ExportedMultiSectionDigitalClockProps<TDate>, 'timeSteps'> {
40
+ export interface DesktopOnlyTimePickerProps extends Omit<ExportedDigitalClockProps, 'timeStep'>, Omit<ExportedMultiSectionDigitalClockProps, 'timeSteps'> {
48
41
  /**
49
42
  * Amount of time options below or at which the single column time renderer is used.
50
43
  * @default 24
@@ -20,8 +20,6 @@ export interface BaseToolbarProps<TValue, TView extends DateOrTimeViewWithMeridi
20
20
  * Available views.
21
21
  */
22
22
  views: readonly TView[];
23
- disabled?: boolean;
24
- readOnly?: boolean;
25
23
  titleId?: string;
26
24
  }
27
25
  export interface ExportedBaseToolbarProps {
@@ -1,4 +1,4 @@
1
- import { PickerValidDate, TimeView } from '../../models';
1
+ import type { PickerValidDate, TimeView } from '../../models';
2
2
  interface FutureAndPastValidationProps {
3
3
  /**
4
4
  * If `true`, disable values before the current date for date components, time for time components and both for date time components.
@@ -20,17 +20,17 @@ export interface BaseTimeValidationProps extends FutureAndPastValidationProps {
20
20
  /**
21
21
  * Props used to validate a time value.
22
22
  */
23
- export interface TimeValidationProps<TDate extends PickerValidDate> {
23
+ export interface TimeValidationProps {
24
24
  /**
25
25
  * Minimal selectable time.
26
26
  * The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
27
27
  */
28
- minTime?: TDate;
28
+ minTime?: PickerValidDate;
29
29
  /**
30
30
  * Maximal selectable time.
31
31
  * The date part of the object will be ignored unless `props.disableIgnoringDatePartForTimeValidation === true`.
32
32
  */
33
- maxTime?: TDate;
33
+ maxTime?: PickerValidDate;
34
34
  /**
35
35
  * Step over minutes.
36
36
  * @default 1
@@ -38,12 +38,11 @@ export interface TimeValidationProps<TDate extends PickerValidDate> {
38
38
  minutesStep?: number;
39
39
  /**
40
40
  * Disable specific time.
41
- * @template TDate
42
- * @param {TDate} value The value to check.
41
+ * @param {PickerValidDate} value The value to check.
43
42
  * @param {TimeView} view The clock type of the timeValue.
44
43
  * @returns {boolean} If `true` the time will be disabled.
45
44
  */
46
- shouldDisableTime?: (value: TDate, view: TimeView) => boolean;
45
+ shouldDisableTime?: (value: PickerValidDate, view: TimeView) => boolean;
47
46
  /**
48
47
  * Do not ignore date part when validating min/max time.
49
48
  * @default false
@@ -54,68 +53,65 @@ export interface TimeValidationProps<TDate extends PickerValidDate> {
54
53
  * Validation props common to all the date views.
55
54
  * All these props have a default value when used inside a field / picker / calendar.
56
55
  */
57
- export interface BaseDateValidationProps<TDate extends PickerValidDate> extends FutureAndPastValidationProps {
56
+ export interface BaseDateValidationProps extends FutureAndPastValidationProps {
58
57
  /**
59
58
  * Maximal selectable date.
60
59
  * @default 2099-12-31
61
60
  */
62
- maxDate?: TDate;
61
+ maxDate?: PickerValidDate;
63
62
  /**
64
63
  * Minimal selectable date.
65
64
  * @default 1900-01-01
66
65
  */
67
- minDate?: TDate;
66
+ minDate?: PickerValidDate;
68
67
  }
69
68
  /**
70
69
  * Props used to validate a date value (validates day + month + year).
71
70
  */
72
- export interface DayValidationProps<TDate extends PickerValidDate> {
71
+ export interface DayValidationProps {
73
72
  /**
74
73
  * Disable specific date.
75
74
  *
76
75
  * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
77
76
  *
78
- * @template TDate
79
- * @param {TDate} day The date to test.
77
+ * @param {PickerValidDate} day The date to test.
80
78
  * @returns {boolean} If `true` the date will be disabled.
81
79
  */
82
- shouldDisableDate?: (day: TDate) => boolean;
80
+ shouldDisableDate?: (day: PickerValidDate) => boolean;
83
81
  }
84
82
  /**
85
83
  * Props used to validate a month value
86
84
  */
87
- export interface MonthValidationProps<TDate extends PickerValidDate> {
85
+ export interface MonthValidationProps {
88
86
  /**
89
87
  * Disable specific month.
90
- * @template TDate
91
- * @param {TDate} month The month to test.
88
+ * @param {PickerValidDate} month The month to test.
92
89
  * @returns {boolean} If `true`, the month will be disabled.
93
90
  */
94
- shouldDisableMonth?: (month: TDate) => boolean;
91
+ shouldDisableMonth?: (month: PickerValidDate) => boolean;
95
92
  }
96
93
  /**
97
94
  * Props used to validate a year value
98
95
  */
99
- export interface YearValidationProps<TDate extends PickerValidDate> {
96
+ export interface YearValidationProps {
100
97
  /**
101
98
  * Disable specific year.
102
- * @template TDate
103
- * @param {TDate} year The year to test.
99
+ * @param {PickerValidDate} year The year to test.
104
100
  * @returns {boolean} If `true`, the year will be disabled.
105
101
  */
106
- shouldDisableYear?: (year: TDate) => boolean;
102
+ shouldDisableYear?: (year: PickerValidDate) => boolean;
107
103
  }
108
104
  /**
109
105
  * Props used to validate a date time value.
110
106
  */
111
- export interface DateTimeValidationProps<TDate extends PickerValidDate> {
107
+ export interface DateTimeValidationProps {
112
108
  /**
113
109
  * Minimal selectable moment of time with binding to date, to set min time in each day use `minTime`.
114
110
  */
115
- minDateTime?: TDate;
111
+ minDateTime?: PickerValidDate;
116
112
  /**
117
113
  * Maximal selectable moment of time with binding to date, to set max time in each day use `maxTime`.
118
114
  */
119
- maxDateTime?: TDate;
115
+ maxDateTime?: PickerValidDate;
120
116
  }
121
117
  export {};
@@ -0,0 +1,3 @@
1
+ import { PickerValidDate } from '../../models/pickers';
2
+ export type PickerValue = PickerValidDate | null;
3
+ export type PickerRangeValue = [PickerValidDate | null, PickerValidDate | null];
@@ -0,0 +1 @@
1
+ export {};
@@ -1,17 +1,17 @@
1
- import { DateOrTimeView, MuiPickersAdapter, PickerValidDate } from '../../models';
1
+ import { DefaultizedProps } from '@mui/x-internals/types';
2
+ import { DateOrTimeView, MuiPickersAdapter } from '../../models';
2
3
  import { DateOrTimeViewWithMeridiem } from '../models';
3
- import { DesktopOnlyTimePickerProps } from '../models/props/clock';
4
- import { DefaultizedProps } from '../models/helpers';
5
- export declare const resolveDateTimeFormat: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, { views, format, ...other }: {
4
+ import { DesktopOnlyTimePickerProps } from '../models/props/time';
5
+ export declare const resolveDateTimeFormat: (utils: MuiPickersAdapter, { views, format, ...other }: {
6
6
  format?: string;
7
7
  views: readonly DateOrTimeViewWithMeridiem[];
8
8
  ampm: boolean;
9
9
  }, ignoreDateResolving?: boolean) => string;
10
- interface DefaultizedTimeViewsProps<TDate extends PickerValidDate, TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps<TDate>, 'ampm'> {
10
+ interface DefaultizedTimeViewsProps<TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps, 'ampm'> {
11
11
  views: readonly TView[];
12
12
  }
13
- interface DefaultizedTimeViewsResponse<TDate extends PickerValidDate, TView = DateOrTimeViewWithMeridiem> extends Required<Pick<DefaultizedTimeViewsProps<TDate, TView>, 'thresholdToRenderTimeInASingleColumn' | 'timeSteps' | 'views'>> {
13
+ interface DefaultizedTimeViewsResponse<TView = DateOrTimeViewWithMeridiem> extends Required<Pick<DefaultizedTimeViewsProps<TView>, 'thresholdToRenderTimeInASingleColumn' | 'timeSteps' | 'views'>> {
14
14
  shouldRenderTimeInASingleColumn: boolean;
15
15
  }
16
- export declare function resolveTimeViewsResponse<TDate extends PickerValidDate, InTView extends DateOrTimeView = DateOrTimeView, OutTView extends DateOrTimeViewWithMeridiem = DateOrTimeViewWithMeridiem>({ thresholdToRenderTimeInASingleColumn: inThreshold, ampm, timeSteps: inTimeSteps, views, }: DefaultizedTimeViewsProps<TDate, InTView>): DefaultizedTimeViewsResponse<TDate, OutTView>;
16
+ export declare function resolveTimeViewsResponse<InTView extends DateOrTimeView = DateOrTimeView, OutTView extends DateOrTimeViewWithMeridiem = DateOrTimeViewWithMeridiem>({ thresholdToRenderTimeInASingleColumn: inThreshold, ampm, timeSteps: inTimeSteps, views, }: DefaultizedTimeViewsProps<InTView>): DefaultizedTimeViewsResponse<OutTView>;
17
17
  export {};