@mui/x-date-pickers 8.0.0-alpha.6 → 8.0.0-alpha.8

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 (327) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +2 -4
  2. package/AdapterDateFns/AdapterDateFns.js +49 -47
  3. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -1
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +2 -4
  5. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
  6. package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts} +2 -2
  7. package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
  8. package/AdapterDateFnsJalaliV2/index.d.ts +1 -0
  9. package/AdapterDateFnsJalaliV2/index.js +1 -0
  10. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
  11. package/{AdapterDateFnsV3/AdapterDateFnsV3.d.ts → AdapterDateFnsV2/AdapterDateFnsV2.d.ts} +2 -2
  12. package/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
  13. package/AdapterDateFnsV2/index.d.ts +1 -0
  14. package/AdapterDateFnsV2/index.js +1 -0
  15. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
  16. package/AdapterDayjs/AdapterDayjs.d.ts +1 -1
  17. package/AdapterLuxon/AdapterLuxon.d.ts +1 -1
  18. package/AdapterMoment/AdapterMoment.d.ts +1 -1
  19. package/CHANGELOG.md +242 -1
  20. package/DateCalendar/DateCalendar.js +1 -1
  21. package/DateCalendar/PickersFadeTransitionGroup.d.ts +1 -1
  22. package/DateCalendar/PickersSlideTransition.d.ts +1 -1
  23. package/DateField/DateField.js +26 -31
  24. package/DateField/DateField.types.d.ts +6 -15
  25. package/DateField/useDateField.d.ts +1 -1
  26. package/DateField/useDateField.js +14 -11
  27. package/DatePicker/DatePicker.js +1 -1
  28. package/DatePicker/DatePicker.types.d.ts +5 -0
  29. package/DatePicker/DatePickerToolbar.d.ts +1 -2
  30. package/DatePicker/DatePickerToolbar.js +7 -11
  31. package/DatePicker/shared.d.ts +1 -1
  32. package/DateTimeField/DateTimeField.js +26 -31
  33. package/DateTimeField/DateTimeField.types.d.ts +6 -15
  34. package/DateTimeField/useDateTimeField.d.ts +1 -1
  35. package/DateTimeField/useDateTimeField.js +14 -11
  36. package/DateTimePicker/DateTimePicker.js +2 -2
  37. package/DateTimePicker/DateTimePickerTabs.js +2 -2
  38. package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
  39. package/DateTimePicker/DateTimePickerToolbar.js +36 -31
  40. package/DateTimePicker/shared.d.ts +1 -1
  41. package/DesktopDatePicker/DesktopDatePicker.js +9 -14
  42. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +5 -0
  43. package/DesktopDateTimePicker/DesktopDateTimePicker.js +14 -22
  44. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  45. package/DesktopTimePicker/DesktopTimePicker.js +4 -19
  46. package/MobileDatePicker/MobileDatePicker.js +2 -11
  47. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -11
  48. package/MobileTimePicker/MobileTimePicker.js +2 -11
  49. package/PickersActionBar/PickersActionBar.d.ts +6 -3
  50. package/PickersActionBar/PickersActionBar.js +6 -3
  51. package/PickersLayout/PickersLayout.js +1 -5
  52. package/PickersLayout/PickersLayout.types.d.ts +2 -3
  53. package/PickersLayout/usePickerLayout.js +12 -31
  54. package/PickersShortcuts/PickersShortcuts.d.ts +2 -5
  55. package/PickersShortcuts/PickersShortcuts.js +13 -10
  56. package/PickersShortcuts/index.d.ts +1 -1
  57. package/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  58. package/PickersTextField/PickersTextField.js +1 -1
  59. package/TimeField/TimeField.js +25 -30
  60. package/TimeField/TimeField.types.d.ts +6 -15
  61. package/TimeField/useTimeField.d.ts +1 -1
  62. package/TimeField/useTimeField.js +14 -11
  63. package/TimePicker/TimePicker.js +2 -2
  64. package/TimePicker/TimePickerToolbar.d.ts +1 -2
  65. package/TimePicker/TimePickerToolbar.js +20 -18
  66. package/TimePicker/shared.d.ts +1 -1
  67. package/hooks/index.d.ts +1 -0
  68. package/hooks/index.js +2 -1
  69. package/hooks/useIsValidValue.d.ts +7 -0
  70. package/hooks/useIsValidValue.js +11 -0
  71. package/hooks/useParsedFormat.d.ts +8 -6
  72. package/hooks/useParsedFormat.js +10 -12
  73. package/hooks/usePickerActionsContext.d.ts +3 -1
  74. package/hooks/usePickerActionsContext.js +0 -1
  75. package/hooks/usePickerContext.d.ts +5 -3
  76. package/hooks/usePickerContext.js +3 -2
  77. package/hooks/useSplitFieldProps.d.ts +12 -3
  78. package/hooks/useSplitFieldProps.js +8 -3
  79. package/index.d.ts +1 -0
  80. package/index.js +3 -2
  81. package/internals/components/PickerFieldUI.d.ts +132 -0
  82. package/internals/components/PickerFieldUI.js +306 -0
  83. package/internals/components/PickerProvider.d.ts +34 -12
  84. package/internals/components/PickerProvider.js +14 -4
  85. package/internals/components/PickersToolbar.d.ts +2 -3
  86. package/internals/components/PickersToolbar.js +1 -1
  87. package/internals/hooks/date-helpers-hooks.js +4 -3
  88. package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
  89. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -96
  90. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +10 -33
  91. package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  92. package/internals/hooks/useField/index.d.ts +2 -0
  93. package/internals/hooks/useField/index.js +2 -1
  94. package/internals/hooks/useField/useField.js +12 -4
  95. package/internals/hooks/useField/useField.types.d.ts +11 -4
  96. package/internals/hooks/useField/useField.utils.js +2 -2
  97. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +15 -0
  98. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
  99. package/internals/hooks/useField/useFieldState.js +2 -2
  100. package/internals/hooks/useField/useFieldV6TextField.js +2 -2
  101. package/internals/hooks/useField/useFieldV7TextField.js +3 -3
  102. package/internals/hooks/useFieldOwnerState.d.ts +1 -2
  103. package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
  104. package/internals/hooks/useMobilePicker/useMobilePicker.js +20 -51
  105. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +8 -16
  106. package/internals/hooks/useNullablePickerContext.d.ts +5 -0
  107. package/internals/hooks/useNullablePickerContext.js +10 -0
  108. package/internals/hooks/useOpenState.js +3 -2
  109. package/internals/hooks/usePicker/usePicker.d.ts +1 -2
  110. package/internals/hooks/usePicker/usePicker.js +0 -9
  111. package/internals/hooks/usePicker/usePicker.types.d.ts +7 -9
  112. package/internals/hooks/usePicker/usePickerProvider.d.ts +12 -6
  113. package/internals/hooks/usePicker/usePickerProvider.js +26 -4
  114. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  115. package/internals/hooks/usePicker/usePickerValue.js +62 -185
  116. package/internals/hooks/usePicker/usePickerValue.types.d.ts +52 -55
  117. package/internals/hooks/usePicker/usePickerViews.d.ts +27 -23
  118. package/internals/hooks/usePicker/usePickerViews.js +17 -11
  119. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  120. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -2
  121. package/internals/hooks/useUtils.d.ts +4 -3
  122. package/internals/hooks/useUtils.js +1 -1
  123. package/internals/index.d.ts +11 -6
  124. package/internals/index.js +6 -4
  125. package/internals/models/fields.d.ts +3 -16
  126. package/internals/models/index.d.ts +1 -0
  127. package/internals/models/index.js +2 -1
  128. package/internals/models/manager.d.ts +15 -0
  129. package/internals/models/manager.js +1 -0
  130. package/internals/models/props/basePickerProps.d.ts +2 -14
  131. package/internals/models/props/toolbar.d.ts +1 -5
  132. package/internals/utils/date-utils.js +1 -1
  133. package/internals/utils/valueManagers.js +4 -4
  134. package/locales/index.d.ts +1 -0
  135. package/locales/index.js +1 -0
  136. package/locales/nbNO.js +15 -19
  137. package/locales/utils/getPickersLocalization.d.ts +0 -7
  138. package/locales/utils/getPickersLocalization.js +0 -13
  139. package/locales/zhTW.d.ts +80 -0
  140. package/locales/zhTW.js +73 -0
  141. package/managers/index.d.ts +6 -0
  142. package/managers/index.js +3 -0
  143. package/managers/package.json +6 -0
  144. package/managers/useDateManager.d.ts +27 -0
  145. package/managers/useDateManager.js +55 -0
  146. package/managers/useDateTimeManager.d.ts +28 -0
  147. package/managers/useDateTimeManager.js +60 -0
  148. package/managers/useTimeManager.d.ts +28 -0
  149. package/managers/useTimeManager.js +51 -0
  150. package/models/adapters.d.ts +1 -1
  151. package/models/fields.d.ts +4 -4
  152. package/models/index.d.ts +1 -0
  153. package/models/index.js +1 -0
  154. package/models/manager.d.ts +87 -0
  155. package/models/manager.js +1 -0
  156. package/models/pickers.d.ts +7 -0
  157. package/modern/AdapterDateFns/AdapterDateFns.js +49 -47
  158. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
  159. package/modern/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
  160. package/modern/AdapterDateFnsJalaliV2/index.js +1 -0
  161. package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
  162. package/modern/AdapterDateFnsV2/index.js +1 -0
  163. package/modern/DateCalendar/DateCalendar.js +1 -1
  164. package/modern/DateField/DateField.js +26 -31
  165. package/modern/DateField/useDateField.js +14 -11
  166. package/modern/DatePicker/DatePicker.js +1 -1
  167. package/modern/DatePicker/DatePickerToolbar.js +7 -11
  168. package/modern/DateTimeField/DateTimeField.js +26 -31
  169. package/modern/DateTimeField/useDateTimeField.js +14 -11
  170. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  171. package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
  172. package/modern/DateTimePicker/DateTimePickerToolbar.js +36 -31
  173. package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -14
  174. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +14 -22
  175. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  176. package/modern/DesktopTimePicker/DesktopTimePicker.js +4 -19
  177. package/modern/MobileDatePicker/MobileDatePicker.js +2 -11
  178. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -11
  179. package/modern/MobileTimePicker/MobileTimePicker.js +2 -11
  180. package/modern/PickersActionBar/PickersActionBar.js +6 -3
  181. package/modern/PickersLayout/PickersLayout.js +1 -5
  182. package/modern/PickersLayout/usePickerLayout.js +12 -31
  183. package/modern/PickersShortcuts/PickersShortcuts.js +13 -10
  184. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  185. package/modern/PickersTextField/PickersTextField.js +1 -1
  186. package/modern/TimeField/TimeField.js +25 -30
  187. package/modern/TimeField/useTimeField.js +14 -11
  188. package/modern/TimePicker/TimePicker.js +2 -2
  189. package/modern/TimePicker/TimePickerToolbar.js +20 -18
  190. package/modern/hooks/index.js +2 -1
  191. package/modern/hooks/useIsValidValue.js +11 -0
  192. package/modern/hooks/useParsedFormat.js +10 -12
  193. package/modern/hooks/usePickerActionsContext.js +0 -1
  194. package/modern/hooks/usePickerContext.js +3 -2
  195. package/modern/hooks/useSplitFieldProps.js +8 -3
  196. package/modern/index.js +3 -2
  197. package/modern/internals/components/PickerFieldUI.js +306 -0
  198. package/modern/internals/components/PickerProvider.js +14 -4
  199. package/modern/internals/components/PickersToolbar.js +1 -1
  200. package/modern/internals/hooks/date-helpers-hooks.js +4 -3
  201. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -96
  202. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  203. package/modern/internals/hooks/useField/index.js +2 -1
  204. package/modern/internals/hooks/useField/useField.js +12 -4
  205. package/modern/internals/hooks/useField/useField.utils.js +2 -2
  206. package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
  207. package/modern/internals/hooks/useField/useFieldState.js +2 -2
  208. package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
  209. package/modern/internals/hooks/useField/useFieldV7TextField.js +3 -3
  210. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +20 -51
  211. package/modern/internals/hooks/useNullablePickerContext.js +10 -0
  212. package/modern/internals/hooks/useOpenState.js +3 -2
  213. package/modern/internals/hooks/usePicker/usePicker.js +0 -9
  214. package/modern/internals/hooks/usePicker/usePickerProvider.js +26 -4
  215. package/modern/internals/hooks/usePicker/usePickerValue.js +62 -185
  216. package/modern/internals/hooks/usePicker/usePickerViews.js +17 -11
  217. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  218. package/modern/internals/hooks/useUtils.js +1 -1
  219. package/modern/internals/index.js +6 -4
  220. package/modern/internals/models/index.js +2 -1
  221. package/modern/internals/models/manager.js +1 -0
  222. package/modern/internals/utils/date-utils.js +1 -1
  223. package/modern/internals/utils/valueManagers.js +4 -4
  224. package/modern/locales/index.js +1 -0
  225. package/modern/locales/nbNO.js +15 -19
  226. package/modern/locales/utils/getPickersLocalization.js +0 -13
  227. package/modern/locales/zhTW.js +73 -0
  228. package/modern/managers/index.js +3 -0
  229. package/modern/managers/useDateManager.js +55 -0
  230. package/modern/managers/useDateTimeManager.js +60 -0
  231. package/modern/managers/useTimeManager.js +51 -0
  232. package/modern/models/index.js +1 -0
  233. package/modern/models/manager.js +1 -0
  234. package/node/AdapterDateFns/AdapterDateFns.js +97 -97
  235. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +97 -96
  236. package/node/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +94 -101
  237. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  238. package/node/AdapterDateFnsV2/AdapterDateFnsV2.js +291 -0
  239. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  240. package/node/DateCalendar/DateCalendar.js +1 -1
  241. package/node/DateField/DateField.js +26 -31
  242. package/node/DateField/useDateField.js +13 -10
  243. package/node/DatePicker/DatePicker.js +1 -1
  244. package/node/DatePicker/DatePickerToolbar.js +7 -11
  245. package/node/DateTimeField/DateTimeField.js +26 -31
  246. package/node/DateTimeField/useDateTimeField.js +13 -10
  247. package/node/DateTimePicker/DateTimePicker.js +2 -2
  248. package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
  249. package/node/DateTimePicker/DateTimePickerToolbar.js +36 -31
  250. package/node/DesktopDatePicker/DesktopDatePicker.js +9 -14
  251. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +14 -22
  252. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  253. package/node/DesktopTimePicker/DesktopTimePicker.js +4 -19
  254. package/node/MobileDatePicker/MobileDatePicker.js +2 -11
  255. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -11
  256. package/node/MobileTimePicker/MobileTimePicker.js +2 -11
  257. package/node/PickersActionBar/PickersActionBar.js +8 -5
  258. package/node/PickersLayout/PickersLayout.js +1 -5
  259. package/node/PickersLayout/usePickerLayout.js +16 -35
  260. package/node/PickersShortcuts/PickersShortcuts.js +13 -10
  261. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  262. package/node/PickersTextField/PickersTextField.js +1 -1
  263. package/node/TimeField/TimeField.js +25 -30
  264. package/node/TimeField/useTimeField.js +13 -10
  265. package/node/TimePicker/TimePicker.js +2 -2
  266. package/node/TimePicker/TimePickerToolbar.js +20 -18
  267. package/node/hooks/index.js +8 -1
  268. package/node/hooks/useIsValidValue.js +18 -0
  269. package/node/hooks/useParsedFormat.js +10 -12
  270. package/node/hooks/usePickerContext.js +5 -4
  271. package/node/hooks/useSplitFieldProps.js +7 -2
  272. package/node/index.js +13 -1
  273. package/node/internals/components/PickerFieldUI.js +318 -0
  274. package/node/internals/components/PickerProvider.js +16 -6
  275. package/node/internals/components/PickersToolbar.js +1 -1
  276. package/node/internals/hooks/date-helpers-hooks.js +4 -3
  277. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +23 -98
  278. package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  279. package/node/internals/hooks/useField/index.js +8 -1
  280. package/node/internals/hooks/useField/useField.js +11 -3
  281. package/node/internals/hooks/useField/useField.utils.js +2 -2
  282. package/node/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +55 -0
  283. package/node/internals/hooks/useField/useFieldState.js +2 -2
  284. package/node/internals/hooks/useField/useFieldV6TextField.js +2 -2
  285. package/node/internals/hooks/useField/useFieldV7TextField.js +3 -3
  286. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +20 -51
  287. package/node/internals/hooks/useNullablePickerContext.js +16 -0
  288. package/node/internals/hooks/useOpenState.js +4 -2
  289. package/node/internals/hooks/usePicker/usePicker.js +0 -10
  290. package/node/internals/hooks/usePicker/usePickerProvider.js +26 -4
  291. package/node/internals/hooks/usePicker/usePickerValue.js +62 -185
  292. package/node/internals/hooks/usePicker/usePickerViews.js +17 -12
  293. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  294. package/node/internals/hooks/useUtils.js +1 -1
  295. package/node/internals/index.js +45 -19
  296. package/node/internals/models/index.js +11 -0
  297. package/node/internals/models/manager.js +5 -0
  298. package/node/internals/utils/date-utils.js +1 -1
  299. package/node/internals/utils/valueManagers.js +4 -4
  300. package/node/locales/index.js +11 -0
  301. package/node/locales/nbNO.js +15 -19
  302. package/node/locales/utils/getPickersLocalization.js +2 -16
  303. package/node/locales/zhTW.js +79 -0
  304. package/node/managers/index.js +26 -0
  305. package/node/managers/useDateManager.js +63 -0
  306. package/node/managers/useDateTimeManager.js +68 -0
  307. package/node/managers/useTimeManager.js +59 -0
  308. package/node/models/index.js +11 -0
  309. package/node/models/manager.js +5 -0
  310. package/package.json +3 -3
  311. package/themeAugmentation/props.d.ts +1 -1
  312. package/validation/extractValidationProps.d.ts +1 -1
  313. package/AdapterDateFnsJalaliV3/index.d.ts +0 -1
  314. package/AdapterDateFnsJalaliV3/index.js +0 -1
  315. package/AdapterDateFnsV3/index.d.ts +0 -1
  316. package/AdapterDateFnsV3/index.js +0 -1
  317. package/internals/hooks/defaultizedFieldProps.d.ts +0 -18
  318. package/internals/hooks/defaultizedFieldProps.js +0 -40
  319. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +0 -3
  320. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
  321. package/modern/AdapterDateFnsJalaliV3/index.js +0 -1
  322. package/modern/AdapterDateFnsV3/index.js +0 -1
  323. package/modern/internals/hooks/defaultizedFieldProps.js +0 -40
  324. package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
  325. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -299
  326. package/node/internals/hooks/defaultizedFieldProps.js +0 -50
  327. package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -52
@@ -8,15 +8,12 @@ import { refType } from '@mui/utils';
8
8
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
9
9
  import { TimeField } from "../TimeField/index.js";
10
10
  import { useTimePickerDefaultizedProps } from "../TimePicker/shared.js";
11
- import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
12
11
  import { useUtils } from "../internals/hooks/useUtils.js";
13
12
  import { extractValidationProps, validateTime } from "../validation/index.js";
14
- import { ClockIcon } from "../icons/index.js";
15
13
  import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
16
14
  import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "../timeViewRenderers/index.js";
17
15
  import { resolveTimeFormat } from "../internals/utils/time-utils.js";
18
16
  import { resolveTimeViewsResponse } from "../internals/utils/date-time-utils.js";
19
- import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
20
17
  /**
21
18
  * Demos:
22
19
  *
@@ -28,7 +25,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
28
25
  * - [DesktopTimePicker API](https://mui.com/x/api/date-pickers/desktop-time-picker/)
29
26
  */
30
27
  const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePicker(inProps, ref) {
31
- const translations = usePickerTranslations();
32
28
  const utils = useUtils();
33
29
 
34
30
  // Props with the default values common to all time pickers
@@ -46,7 +42,6 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
46
42
  meridiem: renderTimeView
47
43
  }, defaultizedProps.viewRenderers);
48
44
  const ampmInClock = defaultizedProps.ampmInClock ?? true;
49
- const actionBarActions = shouldRenderTimeInASingleColumn ? [] : ['accept'];
50
45
  // Need to avoid adding the `meridiem` view when unexpected renderer is specified
51
46
  const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
52
47
  const views = !shouldHoursRendererContainMeridiemView ? resolvedViews.filter(view => view !== 'meridiem') : resolvedViews;
@@ -61,8 +56,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
61
56
  // Allows for easy view lifecycle management
62
57
  views: shouldRenderTimeInASingleColumn ? ['hours'] : views,
63
58
  slots: _extends({
64
- field: TimeField,
65
- openPickerIcon: ClockIcon
59
+ field: TimeField
66
60
  }, defaultizedProps.slots),
67
61
  slotProps: _extends({}, defaultizedProps.slotProps, {
68
62
  field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
@@ -71,10 +65,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
71
65
  toolbar: _extends({
72
66
  hidden: true,
73
67
  ampmInClock
74
- }, defaultizedProps.slotProps?.toolbar),
75
- actionBar: _extends({
76
- actions: actionBarActions
77
- }, defaultizedProps.slotProps?.actionBar)
68
+ }, defaultizedProps.slotProps?.toolbar)
78
69
  })
79
70
  });
80
71
  const {
@@ -83,12 +74,6 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
83
74
  props,
84
75
  valueManager: singleItemValueManager,
85
76
  valueType: 'time',
86
- getOpenDialogAriaText: buildGetOpenDialogAriaText({
87
- utils,
88
- formatKey: 'fullTime',
89
- contextTranslation: translations.openTimePickerDialogue,
90
- propsTranslation: props.localeText?.openTimePickerDialogue
91
- }),
92
77
  validator: validateTime
93
78
  });
94
79
  return renderPicker();
@@ -117,8 +102,8 @@ DesktopTimePicker.propTypes = {
117
102
  autoFocus: PropTypes.bool,
118
103
  className: PropTypes.string,
119
104
  /**
120
- * If `true`, the popover or modal will close after submitting the full date.
121
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
105
+ * If `true`, the Picker will close after submitting the full date.
106
+ * @default false
122
107
  */
123
108
  closeOnSelect: PropTypes.bool,
124
109
  /**
@@ -7,14 +7,12 @@ import resolveComponentProps from '@mui/utils/resolveComponentProps';
7
7
  import { refType } from '@mui/utils';
8
8
  import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
9
9
  import { useDatePickerDefaultizedProps } from "../DatePicker/shared.js";
10
- import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
11
10
  import { useUtils } from "../internals/hooks/useUtils.js";
12
11
  import { extractValidationProps, validateDate } from "../validation/index.js";
13
12
  import { DateField } from "../DateField/index.js";
14
13
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
15
14
  import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
16
15
  import { resolveDateFormat } from "../internals/utils/date-utils.js";
17
- import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
18
16
  /**
19
17
  * Demos:
20
18
  *
@@ -26,7 +24,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
26
24
  * - [MobileDatePicker API](https://mui.com/x/api/date-pickers/mobile-date-picker/)
27
25
  */
28
26
  const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker(inProps, ref) {
29
- const translations = usePickerTranslations();
30
27
  const utils = useUtils();
31
28
 
32
29
  // Props with the default values common to all date pickers
@@ -59,12 +56,6 @@ const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker
59
56
  props,
60
57
  valueManager: singleItemValueManager,
61
58
  valueType: 'date',
62
- getOpenDialogAriaText: buildGetOpenDialogAriaText({
63
- utils,
64
- formatKey: 'fullDate',
65
- contextTranslation: translations.openDatePickerDialogue,
66
- propsTranslation: props.localeText?.openDatePickerDialogue
67
- }),
68
59
  validator: validateDate
69
60
  });
70
61
  return renderPicker();
@@ -83,8 +74,8 @@ MobileDatePicker.propTypes = {
83
74
  autoFocus: PropTypes.bool,
84
75
  className: PropTypes.string,
85
76
  /**
86
- * If `true`, the popover or modal will close after submitting the full date.
87
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
77
+ * If `true`, the Picker will close after submitting the full date.
78
+ * @default false
88
79
  */
89
80
  closeOnSelect: PropTypes.bool,
90
81
  /**
@@ -8,14 +8,12 @@ import { refType } from '@mui/utils';
8
8
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
9
9
  import { DateTimeField } from "../DateTimeField/index.js";
10
10
  import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
11
- import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
12
11
  import { useUtils } from "../internals/hooks/useUtils.js";
13
12
  import { extractValidationProps, validateDateTime } from "../validation/index.js";
14
13
  import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
15
14
  import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
16
15
  import { renderTimeViewClock } from "../timeViewRenderers/index.js";
17
16
  import { resolveDateTimeFormat } from "../internals/utils/date-time-utils.js";
18
- import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
19
17
  /**
20
18
  * Demos:
21
19
  *
@@ -27,7 +25,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
27
25
  * - [MobileDateTimePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-picker/)
28
26
  */
29
27
  const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(inProps, ref) {
30
- const translations = usePickerTranslations();
31
28
  const utils = useUtils();
32
29
 
33
30
  // Props with the default values common to all date time pickers
@@ -69,12 +66,6 @@ const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTi
69
66
  props,
70
67
  valueManager: singleItemValueManager,
71
68
  valueType: 'date-time',
72
- getOpenDialogAriaText: buildGetOpenDialogAriaText({
73
- utils,
74
- formatKey: 'fullDate',
75
- contextTranslation: translations.openDatePickerDialogue,
76
- propsTranslation: props.localeText?.openDatePickerDialogue
77
- }),
78
69
  validator: validateDateTime
79
70
  });
80
71
  return renderPicker();
@@ -103,8 +94,8 @@ MobileDateTimePicker.propTypes = {
103
94
  autoFocus: PropTypes.bool,
104
95
  className: PropTypes.string,
105
96
  /**
106
- * If `true`, the popover or modal will close after submitting the full date.
107
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
97
+ * If `true`, the Picker will close after submitting the full date.
98
+ * @default false
108
99
  */
109
100
  closeOnSelect: PropTypes.bool,
110
101
  /**
@@ -8,13 +8,11 @@ import { refType } from '@mui/utils';
8
8
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
9
9
  import { TimeField } from "../TimeField/index.js";
10
10
  import { useTimePickerDefaultizedProps } from "../TimePicker/shared.js";
11
- import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
12
11
  import { useUtils } from "../internals/hooks/useUtils.js";
13
12
  import { extractValidationProps, validateTime } from "../validation/index.js";
14
13
  import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
15
14
  import { renderTimeViewClock } from "../timeViewRenderers/index.js";
16
15
  import { resolveTimeFormat } from "../internals/utils/time-utils.js";
17
- import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
18
16
  /**
19
17
  * Demos:
20
18
  *
@@ -26,7 +24,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
26
24
  * - [MobileTimePicker API](https://mui.com/x/api/date-pickers/mobile-time-picker/)
27
25
  */
28
26
  const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker(inProps, ref) {
29
- const translations = usePickerTranslations();
30
27
  const utils = useUtils();
31
28
 
32
29
  // Props with the default values common to all time pickers
@@ -62,12 +59,6 @@ const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker
62
59
  props,
63
60
  valueManager: singleItemValueManager,
64
61
  valueType: 'time',
65
- getOpenDialogAriaText: buildGetOpenDialogAriaText({
66
- utils,
67
- formatKey: 'fullTime',
68
- contextTranslation: translations.openTimePickerDialogue,
69
- propsTranslation: props.localeText?.openTimePickerDialogue
70
- }),
71
62
  validator: validateTime
72
63
  });
73
64
  return renderPicker();
@@ -96,8 +87,8 @@ MobileTimePicker.propTypes = {
96
87
  autoFocus: PropTypes.bool,
97
88
  className: PropTypes.string,
98
89
  /**
99
- * If `true`, the popover or modal will close after submitting the full date.
100
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
90
+ * If `true`, the Picker will close after submitting the full date.
91
+ * @default false
101
92
  */
102
93
  closeOnSelect: PropTypes.bool,
103
94
  /**
@@ -5,7 +5,9 @@ export interface PickersActionBarProps extends DialogActionsProps {
5
5
  /**
6
6
  * Ordered array of actions to display.
7
7
  * If empty, does not display that action bar.
8
- * @default `['cancel', 'accept']` for mobile and `[]` for desktop
8
+ * @default
9
+ * - `[]` for Desktop Date Picker and Desktop Date Range Picker
10
+ * - `['cancel', 'accept']` for all other Pickers
9
11
  */
10
12
  actions?: PickersActionBarAction[];
11
13
  }
@@ -19,8 +21,9 @@ export interface PickersActionBarProps extends DialogActionsProps {
19
21
  *
20
22
  * - [PickersActionBar API](https://mui.com/x/api/date-pickers/pickers-action-bar/)
21
23
  */
22
- declare function PickersActionBar(props: PickersActionBarProps): React.JSX.Element | null;
23
- declare namespace PickersActionBar {
24
+ declare function PickersActionBarComponent(props: PickersActionBarProps): React.JSX.Element | null;
25
+ declare namespace PickersActionBarComponent {
24
26
  var propTypes: any;
25
27
  }
28
+ declare const PickersActionBar: React.MemoExoticComponent<typeof PickersActionBarComponent>;
26
29
  export { PickersActionBar };
@@ -27,7 +27,7 @@ const PickersActionBarRoot = styled(DialogActions, {
27
27
  *
28
28
  * - [PickersActionBar API](https://mui.com/x/api/date-pickers/pickers-action-bar/)
29
29
  */
30
- function PickersActionBar(props) {
30
+ function PickersActionBarComponent(props) {
31
31
  const {
32
32
  actions
33
33
  } = props,
@@ -72,7 +72,7 @@ function PickersActionBar(props) {
72
72
  children: buttons
73
73
  }));
74
74
  }
75
- process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = {
75
+ process.env.NODE_ENV !== "production" ? PickersActionBarComponent.propTypes = {
76
76
  // ----------------------------- Warning --------------------------------
77
77
  // | These PropTypes are generated from the TypeScript type definitions |
78
78
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
@@ -80,7 +80,9 @@ process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = {
80
80
  /**
81
81
  * Ordered array of actions to display.
82
82
  * If empty, does not display that action bar.
83
- * @default `['cancel', 'accept']` for mobile and `[]` for desktop
83
+ * @default
84
+ * - `[]` for Desktop Date Picker and Desktop Date Range Picker
85
+ * - `['cancel', 'accept']` for all other Pickers
84
86
  */
85
87
  actions: PropTypes.arrayOf(PropTypes.oneOf(['accept', 'cancel', 'clear', 'today']).isRequired),
86
88
  /**
@@ -93,4 +95,5 @@ process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = {
93
95
  */
94
96
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
95
97
  } : void 0;
98
+ const PickersActionBar = /*#__PURE__*/React.memo(PickersActionBarComponent);
96
99
  export { PickersActionBar };
@@ -150,9 +150,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
150
150
  */
151
151
  classes: PropTypes.object,
152
152
  className: PropTypes.string,
153
- isValid: PropTypes.func.isRequired,
154
- onChange: PropTypes.func.isRequired,
155
- onSelectShortcut: PropTypes.func.isRequired,
156
153
  /**
157
154
  * The props used for each component slot.
158
155
  * @default {}
@@ -166,7 +163,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
166
163
  /**
167
164
  * The system prop that allows defining system overrides as well as additional CSS styles.
168
165
  */
169
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
170
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object])
166
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
171
167
  } : void 0;
172
168
  export { PickersLayout };
@@ -9,7 +9,6 @@ import { PickersShortcutsProps } from '../PickersShortcuts';
9
9
  import { ExportedPickersShortcutProps, PickersShortcuts } from '../PickersShortcuts/PickersShortcuts';
10
10
  import { PickerOwnerState } from '../models';
11
11
  import { PickerValidValue } from '../internals/models';
12
- import { UsePickerValueLayoutResponse } from '../internals/hooks/usePicker/usePickerValue.types';
13
12
  export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue> {
14
13
  /**
15
14
  * Custom component for the action bar, it is placed below the picker views.
@@ -58,7 +57,7 @@ export interface PickersLayoutSlots<TValue extends PickerValidValue> extends Exp
58
57
  * Custom component for the toolbar.
59
58
  * It is placed above the picker views.
60
59
  */
61
- toolbar?: React.JSXElementConstructor<BaseToolbarProps<TValue>>;
60
+ toolbar?: React.JSXElementConstructor<BaseToolbarProps>;
62
61
  }
63
62
  export interface PickersLayoutSlotProps<TValue extends PickerValidValue> extends ExportedPickersLayoutSlotProps<TValue> {
64
63
  /**
@@ -70,7 +69,7 @@ export interface PickersLayoutSlotProps<TValue extends PickerValidValue> extends
70
69
  */
71
70
  toolbar?: ExportedBaseToolbarProps;
72
71
  }
73
- export interface PickersLayoutProps<TValue extends PickerValidValue> extends UsePickerValueLayoutResponse<TValue> {
72
+ export interface PickersLayoutProps<TValue extends PickerValidValue> {
74
73
  className?: string;
75
74
  children?: React.ReactNode;
76
75
  /**
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
 
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
4
  import _extends from "@babel/runtime/helpers/esm/extends";
5
+ const _excluded = ["ownerState"];
4
6
  import * as React from 'react';
5
7
  import useSlotProps from '@mui/utils/useSlotProps';
6
8
  import composeClasses from '@mui/utils/composeClasses';
@@ -34,24 +36,14 @@ const usePickerLayout = props => {
34
36
  ownerState: pickerOwnerState
35
37
  } = usePickerPrivateContext();
36
38
  const {
37
- variant,
38
- orientation,
39
39
  view
40
40
  } = usePickerContext();
41
41
  const isRtl = useRtl();
42
42
  const {
43
- value,
44
- onChange,
45
- onSelectShortcut,
46
- isValid,
47
43
  children,
48
44
  slots,
49
45
  slotProps,
50
46
  classes: classesProp
51
- // TODO: Remove this "as" hack. It get introduced to mark `value` prop in PickersLayoutProps as not required.
52
- // The true type should be
53
- // - For pickers value: PickerValidDate | null
54
- // - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
55
47
  } = props;
56
48
  const ownerState = React.useMemo(() => _extends({}, pickerOwnerState, {
57
49
  layoutDirection: isRtl ? 'rtl' : 'ltr'
@@ -60,15 +52,16 @@ const usePickerLayout = props => {
60
52
 
61
53
  // Action bar
62
54
  const ActionBar = slots?.actionBar ?? PickersActionBar;
63
- const actionBarProps = useSlotProps({
64
- elementType: ActionBar,
65
- externalSlotProps: slotProps?.actionBar,
66
- additionalProps: {
67
- actions: variant === 'desktop' ? [] : ['cancel', 'accept']
68
- },
69
- className: classes.actionBar,
70
- ownerState
71
- });
55
+ const _useSlotProps = useSlotProps({
56
+ elementType: ActionBar,
57
+ externalSlotProps: slotProps?.actionBar,
58
+ additionalProps: {
59
+ actions: ['cancel', 'accept']
60
+ },
61
+ className: classes.actionBar,
62
+ ownerState
63
+ }),
64
+ actionBarProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
72
65
  const actionBar = /*#__PURE__*/_jsx(ActionBar, _extends({}, actionBarProps));
73
66
 
74
67
  // Toolbar
@@ -76,12 +69,6 @@ const usePickerLayout = props => {
76
69
  const toolbarProps = useSlotProps({
77
70
  elementType: Toolbar,
78
71
  externalSlotProps: slotProps?.toolbar,
79
- additionalProps: {
80
- isLandscape: orientation === 'landscape',
81
- // Will be removed in a follow up PR?
82
- onChange,
83
- value
84
- },
85
72
  className: classes.toolbar,
86
73
  ownerState
87
74
  });
@@ -101,12 +88,6 @@ const usePickerLayout = props => {
101
88
  const shortcutsProps = useSlotProps({
102
89
  elementType: Shortcuts,
103
90
  externalSlotProps: slotProps?.shortcuts,
104
- additionalProps: {
105
- isValid,
106
- isLandscape: orientation === 'landscape',
107
- // Will be removed in a follow up PR?
108
- onChange: onSelectShortcut
109
- },
110
91
  className: classes.shortcuts,
111
92
  ownerState
112
93
  });
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { ListProps } from '@mui/material/List';
3
3
  import { PickerValidValue } from '../internals/models';
4
+ import { PickerChangeImportance } from '../models/pickers';
4
5
  interface PickersShortcutsItemGetValueParams<TValue extends PickerValidValue> {
5
6
  isValid: (value: TValue) => boolean;
6
7
  }
@@ -14,7 +15,6 @@ export interface PickersShortcutsItem<TValue extends PickerValidValue> {
14
15
  id?: string;
15
16
  }
16
17
  export type PickersShortcutsItemContext = Omit<PickersShortcutsItem<PickerValidValue>, 'getValue'>;
17
- export type PickerShortcutChangeImportance = 'set' | 'accept';
18
18
  export interface ExportedPickersShortcutProps<TValue extends PickerValidValue> extends Omit<ListProps, 'onChange'> {
19
19
  /**
20
20
  * Ordered array of shortcuts to display.
@@ -28,12 +28,9 @@ export interface ExportedPickersShortcutProps<TValue extends PickerValidValue> e
28
28
  * - "set": fires `onChange` but do not fire `onAccept` and does not close the picker.
29
29
  * @default "accept"
30
30
  */
31
- changeImportance?: PickerShortcutChangeImportance;
31
+ changeImportance?: PickerChangeImportance;
32
32
  }
33
33
  export interface PickersShortcutsProps<TValue extends PickerValidValue> extends ExportedPickersShortcutProps<TValue> {
34
- isLandscape: boolean;
35
- onChange: (newValue: TValue, changeImportance: PickerShortcutChangeImportance, shortcut: PickersShortcutsItemContext) => void;
36
- isValid: (value: TValue) => boolean;
37
34
  }
38
35
  /**
39
36
  * Demos:
@@ -2,7 +2,7 @@
2
2
 
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
- const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"],
5
+ const _excluded = ["items", "changeImportance"],
6
6
  _excluded2 = ["getValue"];
7
7
  import * as React from 'react';
8
8
  import { styled } from '@mui/material/styles';
@@ -11,6 +11,7 @@ import List from '@mui/material/List';
11
11
  import ListItem from '@mui/material/ListItem';
12
12
  import Chip from '@mui/material/Chip';
13
13
  import { VIEW_HEIGHT } from "../internals/constants/dimensions.js";
14
+ import { useIsValidValue, usePickerActionsContext } from "../hooks/index.js";
14
15
  import { jsx as _jsx } from "react/jsx-runtime";
15
16
  const PickersShortcutsRoot = styled(List, {
16
17
  name: 'MuiPickersLayout',
@@ -30,11 +31,13 @@ const PickersShortcutsRoot = styled(List, {
30
31
  function PickersShortcuts(props) {
31
32
  const {
32
33
  items,
33
- changeImportance = 'accept',
34
- onChange,
35
- isValid
34
+ changeImportance = 'accept'
36
35
  } = props,
37
36
  other = _objectWithoutPropertiesLoose(props, _excluded);
37
+ const {
38
+ setValue
39
+ } = usePickerActionsContext();
40
+ const isValidValue = useIsValidValue();
38
41
  if (items == null || items.length === 0) {
39
42
  return null;
40
43
  }
@@ -44,14 +47,17 @@ function PickersShortcuts(props) {
44
47
  } = _ref,
45
48
  item = _objectWithoutPropertiesLoose(_ref, _excluded2);
46
49
  const newValue = getValue({
47
- isValid
50
+ isValid: isValidValue
48
51
  });
49
52
  return _extends({}, item, {
50
53
  label: item.label,
51
54
  onClick: () => {
52
- onChange(newValue, changeImportance, item);
55
+ setValue(newValue, {
56
+ changeImportance,
57
+ shortcut: item
58
+ });
53
59
  },
54
- disabled: !isValid(newValue)
60
+ disabled: !isValidValue(newValue)
55
61
  });
56
62
  });
57
63
  return /*#__PURE__*/_jsx(PickersShortcutsRoot, _extends({
@@ -95,8 +101,6 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
95
101
  * @default false
96
102
  */
97
103
  disablePadding: PropTypes.bool,
98
- isLandscape: PropTypes.bool.isRequired,
99
- isValid: PropTypes.func.isRequired,
100
104
  /**
101
105
  * Ordered array of shortcuts to display.
102
106
  * If empty, does not display the shortcuts.
@@ -107,7 +111,6 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
107
111
  id: PropTypes.string,
108
112
  label: PropTypes.string.isRequired
109
113
  })),
110
- onChange: PropTypes.func.isRequired,
111
114
  style: PropTypes.object,
112
115
  /**
113
116
  * The content of the subheader, normally `ListSubheader`.
@@ -1,2 +1,2 @@
1
1
  export { PickersShortcuts } from './PickersShortcuts';
2
- export type { PickersShortcutsProps, PickersShortcutsItem, PickersShortcutsItemContext, PickerShortcutChangeImportance, } from './PickersShortcuts';
2
+ export type { PickersShortcutsProps, PickersShortcutsItem, PickersShortcutsItemContext, } from './PickersShortcuts';
@@ -213,6 +213,9 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
213
213
  muiFormControl.onFocus?.(event);
214
214
  onFocus?.(event);
215
215
  };
216
+ const handleHiddenInputFocus = event => {
217
+ handleInputFocus(event);
218
+ };
216
219
  const handleInputBlur = event => {
217
220
  muiFormControl.onBlur?.(event);
218
221
  onBlur?.(event);
@@ -288,6 +291,10 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
288
291
  readOnly: readOnly,
289
292
  required: muiFormControl.required,
290
293
  disabled: muiFormControl.disabled
294
+ // Hidden input element cannot be focused, trigger the root focus instead
295
+ // This allows to maintain the ability to do `inputRef.current.focus()` to focus the field
296
+ ,
297
+ onFocus: handleHiddenInputFocus
291
298
  }, inputProps, {
292
299
  ref: handleInputRef
293
300
  }))]
@@ -125,7 +125,7 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
125
125
  required: required,
126
126
  ownerState: ownerState
127
127
  }, other, {
128
- children: [/*#__PURE__*/_jsx(InputLabel, _extends({
128
+ children: [label != null && label !== '' && /*#__PURE__*/_jsx(InputLabel, _extends({
129
129
  htmlFor: id,
130
130
  id: inputLabelId
131
131
  }, InputLabelProps, {
@@ -1,19 +1,14 @@
1
1
  'use client';
2
2
 
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
3
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
4
  const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
6
5
  import * as React from 'react';
7
6
  import PropTypes from 'prop-types';
8
- import MuiTextField from '@mui/material/TextField';
9
7
  import { useThemeProps } from '@mui/material/styles';
10
- import useSlotProps from '@mui/utils/useSlotProps';
11
8
  import { refType } from '@mui/utils';
12
9
  import { useTimeField } from "./useTimeField.js";
13
- import { useClearableField } from "../hooks/index.js";
14
- import { PickersTextField } from "../PickersTextField/index.js";
15
- import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
16
- import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
10
+ import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
11
+ import { ClockIcon } from "../icons/index.js";
17
12
  import { jsx as _jsx } from "react/jsx-runtime";
18
13
  /**
19
14
  * Demos:
@@ -32,33 +27,21 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
32
27
  });
33
28
  const {
34
29
  slots,
35
- slotProps,
36
- InputProps,
37
- inputProps
30
+ slotProps
38
31
  } = themeProps,
39
32
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
40
- const ownerState = useFieldOwnerState(themeProps);
41
- const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
42
- const textFieldProps = useSlotProps({
43
- elementType: TextField,
44
- externalSlotProps: slotProps?.textField,
45
- externalForwardedProps: other,
46
- ownerState,
47
- additionalProps: {
48
- ref: inRef
49
- }
33
+ const textFieldProps = useFieldTextFieldProps({
34
+ slotProps,
35
+ ref: inRef,
36
+ externalForwardedProps: other
50
37
  });
51
-
52
- // TODO: Remove when mui/material-ui#35088 will be merged
53
- textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
54
- textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
55
38
  const fieldResponse = useTimeField(textFieldProps);
56
- const convertedFieldResponse = convertFieldResponseIntoMuiTextFieldProps(fieldResponse);
57
- const processedFieldProps = useClearableField(_extends({}, convertedFieldResponse, {
58
- slots,
59
- slotProps
60
- }));
61
- return /*#__PURE__*/_jsx(TextField, _extends({}, processedFieldProps));
39
+ return /*#__PURE__*/_jsx(PickerFieldUI, {
40
+ slots: slots,
41
+ slotProps: slotProps,
42
+ fieldResponse: fieldResponse,
43
+ defaultOpenPickerIcon: ClockIcon
44
+ });
62
45
  });
63
46
  process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
64
47
  // ----------------------------- Warning --------------------------------
@@ -81,6 +64,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
81
64
  * @default false
82
65
  */
83
66
  clearable: PropTypes.bool,
67
+ /**
68
+ * The position at which the clear button is placed.
69
+ * If the field is not clearable, the button is not rendered.
70
+ * @default 'end'
71
+ */
72
+ clearButtonPosition: PropTypes.oneOf(['end', 'start']),
84
73
  /**
85
74
  * The color of the component.
86
75
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -234,6 +223,12 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
234
223
  * @param {FieldSelectedSections} newValue The new selected sections.
235
224
  */
236
225
  onSelectedSectionsChange: PropTypes.func,
226
+ /**
227
+ * The position at which the opening button is placed.
228
+ * If there is no picker to open, the button is not rendered
229
+ * @default 'end'
230
+ */
231
+ openPickerButtonPosition: PropTypes.oneOf(['end', 'start']),
237
232
  /**
238
233
  * If `true`, the component is read-only.
239
234
  * When read-only, the value cannot be changed but the user can interact with the interface.