@mui/x-date-pickers 8.0.0-alpha.5 → 8.0.0-alpha.7

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 (305) 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 +206 -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/useDateField.d.ts +1 -1
  24. package/DateField/useDateField.js +13 -11
  25. package/DatePicker/DatePicker.js +1 -1
  26. package/DatePicker/DatePicker.types.d.ts +5 -0
  27. package/DatePicker/DatePickerToolbar.d.ts +1 -3
  28. package/DatePicker/DatePickerToolbar.js +10 -25
  29. package/DatePicker/shared.d.ts +1 -1
  30. package/DateTimeField/useDateTimeField.d.ts +1 -1
  31. package/DateTimeField/useDateTimeField.js +13 -11
  32. package/DateTimePicker/DateTimePicker.js +2 -2
  33. package/DateTimePicker/DateTimePicker.types.d.ts +2 -2
  34. package/DateTimePicker/DateTimePickerTabs.d.ts +2 -5
  35. package/DateTimePicker/DateTimePickerTabs.js +7 -14
  36. package/DateTimePicker/DateTimePickerToolbar.d.ts +12 -4
  37. package/DateTimePicker/DateTimePickerToolbar.js +42 -48
  38. package/DateTimePicker/shared.d.ts +3 -3
  39. package/DesktopDatePicker/DesktopDatePicker.js +9 -3
  40. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +7 -3
  41. package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  42. package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +2 -2
  43. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +1 -2
  44. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -15
  45. package/DesktopTimePicker/DesktopTimePicker.js +3 -7
  46. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  47. package/MobileDatePicker/MobileDatePicker.js +2 -2
  48. package/MobileDatePicker/MobileDatePicker.types.d.ts +2 -3
  49. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  50. package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +4 -4
  51. package/MobileTimePicker/MobileTimePicker.js +2 -2
  52. package/MobileTimePicker/MobileTimePicker.types.d.ts +4 -4
  53. package/PickersActionBar/PickersActionBar.d.ts +6 -7
  54. package/PickersActionBar/PickersActionBar.js +18 -16
  55. package/PickersLayout/PickersLayout.d.ts +2 -2
  56. package/PickersLayout/PickersLayout.js +1 -15
  57. package/PickersLayout/PickersLayout.types.d.ts +12 -15
  58. package/PickersLayout/usePickerLayout.d.ts +2 -2
  59. package/PickersLayout/usePickerLayout.js +13 -47
  60. package/PickersShortcuts/PickersShortcuts.d.ts +2 -5
  61. package/PickersShortcuts/PickersShortcuts.js +13 -10
  62. package/PickersShortcuts/index.d.ts +1 -1
  63. package/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  64. package/PickersTextField/PickersTextField.js +1 -1
  65. package/StaticDatePicker/StaticDatePicker.types.d.ts +2 -3
  66. package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +2 -2
  67. package/StaticTimePicker/StaticTimePicker.types.d.ts +2 -2
  68. package/TimeField/useTimeField.d.ts +1 -1
  69. package/TimeField/useTimeField.js +13 -11
  70. package/TimePicker/TimePicker.js +2 -2
  71. package/TimePicker/TimePicker.types.d.ts +2 -2
  72. package/TimePicker/TimePickerToolbar.d.ts +1 -2
  73. package/TimePicker/TimePickerToolbar.js +23 -35
  74. package/TimePicker/shared.d.ts +1 -1
  75. package/hooks/index.d.ts +2 -0
  76. package/hooks/index.js +3 -1
  77. package/hooks/useIsValidValue.d.ts +7 -0
  78. package/hooks/useIsValidValue.js +11 -0
  79. package/hooks/usePickerActionsContext.d.ts +7 -0
  80. package/hooks/usePickerActionsContext.js +15 -0
  81. package/hooks/usePickerContext.d.ts +3 -1
  82. package/hooks/usePickerContext.js +1 -2
  83. package/index.d.ts +1 -0
  84. package/index.js +3 -2
  85. package/internals/components/PickerProvider.d.ts +14 -8
  86. package/internals/components/PickerProvider.js +17 -6
  87. package/internals/components/PickersModalDialog.d.ts +1 -3
  88. package/internals/components/PickersModalDialog.js +9 -3
  89. package/internals/components/PickersPopper.d.ts +1 -3
  90. package/internals/components/PickersPopper.js +11 -6
  91. package/internals/components/PickersToolbar.d.ts +2 -3
  92. package/internals/components/PickersToolbar.js +1 -1
  93. package/internals/hooks/date-helpers-hooks.js +4 -3
  94. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
  95. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -7
  96. package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  97. package/internals/hooks/useField/index.d.ts +1 -1
  98. package/internals/hooks/useField/index.js +1 -1
  99. package/internals/hooks/useField/useField.d.ts +10 -1
  100. package/internals/hooks/useField/useField.js +17 -1
  101. package/internals/hooks/useField/useField.utils.js +2 -2
  102. package/internals/hooks/useField/useFieldState.js +2 -2
  103. package/internals/hooks/useField/useFieldV6TextField.js +2 -2
  104. package/internals/hooks/useMobilePicker/useMobilePicker.js +9 -10
  105. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -7
  106. package/internals/hooks/useOpenState.js +3 -2
  107. package/internals/hooks/usePicker/usePicker.d.ts +1 -1
  108. package/internals/hooks/usePicker/usePicker.js +0 -8
  109. package/internals/hooks/usePicker/usePicker.types.d.ts +6 -7
  110. package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -5
  111. package/internals/hooks/usePicker/usePickerProvider.js +8 -5
  112. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  113. package/internals/hooks/usePicker/usePickerValue.js +82 -217
  114. package/internals/hooks/usePicker/usePickerValue.types.d.ts +82 -67
  115. package/internals/hooks/usePicker/usePickerViews.d.ts +35 -20
  116. package/internals/hooks/usePicker/usePickerViews.js +22 -14
  117. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  118. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -6
  119. package/internals/hooks/useUtils.js +1 -1
  120. package/internals/index.d.ts +9 -7
  121. package/internals/index.js +5 -3
  122. package/internals/models/index.d.ts +1 -0
  123. package/internals/models/index.js +2 -1
  124. package/internals/models/manager.d.ts +12 -0
  125. package/internals/models/manager.js +1 -0
  126. package/internals/models/props/basePickerProps.d.ts +2 -2
  127. package/internals/models/props/tabs.d.ts +0 -13
  128. package/internals/models/props/toolbar.d.ts +1 -20
  129. package/internals/utils/date-utils.js +1 -1
  130. package/internals/utils/valueManagers.js +4 -4
  131. package/locales/index.d.ts +1 -0
  132. package/locales/index.js +1 -0
  133. package/locales/nbNO.js +15 -19
  134. package/locales/utils/getPickersLocalization.js +1 -1
  135. package/locales/zhTW.d.ts +80 -0
  136. package/locales/zhTW.js +73 -0
  137. package/managers/index.d.ts +6 -0
  138. package/managers/index.js +3 -0
  139. package/managers/package.json +6 -0
  140. package/managers/useDateManager.d.ts +27 -0
  141. package/managers/useDateManager.js +47 -0
  142. package/managers/useDateTimeManager.d.ts +28 -0
  143. package/managers/useDateTimeManager.js +52 -0
  144. package/managers/useTimeManager.d.ts +28 -0
  145. package/managers/useTimeManager.js +43 -0
  146. package/models/adapters.d.ts +1 -1
  147. package/models/index.d.ts +1 -0
  148. package/models/index.js +1 -0
  149. package/models/manager.d.ts +78 -0
  150. package/models/manager.js +1 -0
  151. package/models/pickers.d.ts +7 -0
  152. package/modern/AdapterDateFns/AdapterDateFns.js +49 -47
  153. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
  154. package/modern/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
  155. package/modern/AdapterDateFnsJalaliV2/index.js +1 -0
  156. package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
  157. package/modern/AdapterDateFnsV2/index.js +1 -0
  158. package/modern/DateCalendar/DateCalendar.js +1 -1
  159. package/modern/DateField/useDateField.js +13 -11
  160. package/modern/DatePicker/DatePicker.js +1 -1
  161. package/modern/DatePicker/DatePickerToolbar.js +10 -25
  162. package/modern/DateTimeField/useDateTimeField.js +13 -11
  163. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  164. package/modern/DateTimePicker/DateTimePickerTabs.js +7 -14
  165. package/modern/DateTimePicker/DateTimePickerToolbar.js +42 -48
  166. package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -3
  167. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  168. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -15
  169. package/modern/DesktopTimePicker/DesktopTimePicker.js +3 -7
  170. package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
  171. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  172. package/modern/MobileTimePicker/MobileTimePicker.js +2 -2
  173. package/modern/PickersActionBar/PickersActionBar.js +18 -16
  174. package/modern/PickersLayout/PickersLayout.js +1 -15
  175. package/modern/PickersLayout/usePickerLayout.js +13 -47
  176. package/modern/PickersShortcuts/PickersShortcuts.js +13 -10
  177. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  178. package/modern/PickersTextField/PickersTextField.js +1 -1
  179. package/modern/TimeField/useTimeField.js +13 -11
  180. package/modern/TimePicker/TimePicker.js +2 -2
  181. package/modern/TimePicker/TimePickerToolbar.js +23 -35
  182. package/modern/hooks/index.js +3 -1
  183. package/modern/hooks/useIsValidValue.js +11 -0
  184. package/modern/hooks/usePickerActionsContext.js +15 -0
  185. package/modern/hooks/usePickerContext.js +1 -2
  186. package/modern/index.js +3 -2
  187. package/modern/internals/components/PickerProvider.js +17 -6
  188. package/modern/internals/components/PickersModalDialog.js +9 -3
  189. package/modern/internals/components/PickersPopper.js +11 -6
  190. package/modern/internals/components/PickersToolbar.js +1 -1
  191. package/modern/internals/hooks/date-helpers-hooks.js +4 -3
  192. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
  193. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  194. package/modern/internals/hooks/useField/index.js +1 -1
  195. package/modern/internals/hooks/useField/useField.js +17 -1
  196. package/modern/internals/hooks/useField/useField.utils.js +2 -2
  197. package/modern/internals/hooks/useField/useFieldState.js +2 -2
  198. package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
  199. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +9 -10
  200. package/modern/internals/hooks/useOpenState.js +3 -2
  201. package/modern/internals/hooks/usePicker/usePicker.js +0 -8
  202. package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -5
  203. package/modern/internals/hooks/usePicker/usePickerValue.js +82 -217
  204. package/modern/internals/hooks/usePicker/usePickerViews.js +22 -14
  205. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  206. package/modern/internals/hooks/useUtils.js +1 -1
  207. package/modern/internals/index.js +5 -3
  208. package/modern/internals/models/index.js +2 -1
  209. package/modern/internals/models/manager.js +1 -0
  210. package/modern/internals/utils/date-utils.js +1 -1
  211. package/modern/internals/utils/valueManagers.js +4 -4
  212. package/modern/locales/index.js +1 -0
  213. package/modern/locales/nbNO.js +15 -19
  214. package/modern/locales/utils/getPickersLocalization.js +1 -1
  215. package/modern/locales/zhTW.js +73 -0
  216. package/modern/managers/index.js +3 -0
  217. package/modern/managers/useDateManager.js +47 -0
  218. package/modern/managers/useDateTimeManager.js +52 -0
  219. package/modern/managers/useTimeManager.js +43 -0
  220. package/modern/models/index.js +1 -0
  221. package/modern/models/manager.js +1 -0
  222. package/node/AdapterDateFns/AdapterDateFns.js +97 -97
  223. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +97 -96
  224. package/node/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +94 -101
  225. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  226. package/node/AdapterDateFnsV2/AdapterDateFnsV2.js +291 -0
  227. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  228. package/node/DateCalendar/DateCalendar.js +1 -1
  229. package/node/DateField/useDateField.js +12 -10
  230. package/node/DatePicker/DatePicker.js +1 -1
  231. package/node/DatePicker/DatePickerToolbar.js +10 -25
  232. package/node/DateTimeField/useDateTimeField.js +12 -10
  233. package/node/DateTimePicker/DateTimePicker.js +2 -2
  234. package/node/DateTimePicker/DateTimePickerTabs.js +7 -14
  235. package/node/DateTimePicker/DateTimePickerToolbar.js +43 -49
  236. package/node/DesktopDatePicker/DesktopDatePicker.js +9 -3
  237. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  238. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -15
  239. package/node/DesktopTimePicker/DesktopTimePicker.js +3 -7
  240. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  241. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  242. package/node/MobileTimePicker/MobileTimePicker.js +2 -2
  243. package/node/PickersActionBar/PickersActionBar.js +20 -18
  244. package/node/PickersLayout/PickersLayout.js +1 -15
  245. package/node/PickersLayout/usePickerLayout.js +17 -51
  246. package/node/PickersShortcuts/PickersShortcuts.js +13 -10
  247. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  248. package/node/PickersTextField/PickersTextField.js +1 -1
  249. package/node/TimeField/useTimeField.js +12 -10
  250. package/node/TimePicker/TimePicker.js +2 -2
  251. package/node/TimePicker/TimePickerToolbar.js +23 -35
  252. package/node/hooks/index.js +15 -1
  253. package/node/hooks/useIsValidValue.js +18 -0
  254. package/node/hooks/usePickerActionsContext.js +22 -0
  255. package/node/hooks/usePickerContext.js +1 -1
  256. package/node/index.js +13 -1
  257. package/node/internals/components/PickerProvider.js +18 -7
  258. package/node/internals/components/PickersModalDialog.js +9 -3
  259. package/node/internals/components/PickersPopper.js +11 -6
  260. package/node/internals/components/PickersToolbar.js +1 -1
  261. package/node/internals/hooks/date-helpers-hooks.js +4 -3
  262. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -12
  263. package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  264. package/node/internals/hooks/useField/index.js +6 -0
  265. package/node/internals/hooks/useField/useField.js +18 -1
  266. package/node/internals/hooks/useField/useField.utils.js +2 -2
  267. package/node/internals/hooks/useField/useFieldState.js +2 -2
  268. package/node/internals/hooks/useField/useFieldV6TextField.js +2 -2
  269. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +9 -10
  270. package/node/internals/hooks/useOpenState.js +4 -2
  271. package/node/internals/hooks/usePicker/usePicker.js +0 -9
  272. package/node/internals/hooks/usePicker/usePickerProvider.js +8 -5
  273. package/node/internals/hooks/usePicker/usePickerValue.js +82 -217
  274. package/node/internals/hooks/usePicker/usePickerViews.js +22 -15
  275. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  276. package/node/internals/hooks/useUtils.js +1 -1
  277. package/node/internals/index.js +28 -20
  278. package/node/internals/models/index.js +11 -0
  279. package/node/internals/models/manager.js +5 -0
  280. package/node/internals/utils/date-utils.js +1 -1
  281. package/node/internals/utils/valueManagers.js +4 -4
  282. package/node/locales/index.js +11 -0
  283. package/node/locales/nbNO.js +15 -19
  284. package/node/locales/utils/getPickersLocalization.js +1 -1
  285. package/node/locales/zhTW.js +79 -0
  286. package/node/managers/index.js +26 -0
  287. package/node/managers/useDateManager.js +55 -0
  288. package/node/managers/useDateTimeManager.js +60 -0
  289. package/node/managers/useTimeManager.js +51 -0
  290. package/node/models/index.js +11 -0
  291. package/node/models/manager.js +5 -0
  292. package/package.json +3 -3
  293. package/themeAugmentation/props.d.ts +2 -3
  294. package/validation/extractValidationProps.d.ts +1 -1
  295. package/AdapterDateFnsJalaliV3/index.d.ts +0 -1
  296. package/AdapterDateFnsJalaliV3/index.js +0 -1
  297. package/AdapterDateFnsV3/index.d.ts +0 -1
  298. package/AdapterDateFnsV3/index.js +0 -1
  299. package/internals/hooks/defaultizedFieldProps.d.ts +0 -18
  300. package/internals/hooks/defaultizedFieldProps.js +0 -40
  301. package/modern/AdapterDateFnsJalaliV3/index.js +0 -1
  302. package/modern/AdapterDateFnsV3/index.js +0 -1
  303. package/modern/internals/hooks/defaultizedFieldProps.js +0 -40
  304. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -299
  305. package/node/internals/hooks/defaultizedFieldProps.js +0 -50
@@ -2,13 +2,14 @@
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 = ["onAccept", "onClear", "onCancel", "onSetToday", "actions"];
5
+ const _excluded = ["actions"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import { styled } from '@mui/material/styles';
9
9
  import Button from '@mui/material/Button';
10
10
  import DialogActions from '@mui/material/DialogActions';
11
11
  import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
12
+ import { usePickerActionsContext } from "../hooks/index.js";
12
13
  import { jsx as _jsx } from "react/jsx-runtime";
13
14
  const PickersActionBarRoot = styled(DialogActions, {
14
15
  name: 'MuiPickersLayout',
@@ -26,16 +27,18 @@ const PickersActionBarRoot = styled(DialogActions, {
26
27
  *
27
28
  * - [PickersActionBar API](https://mui.com/x/api/date-pickers/pickers-action-bar/)
28
29
  */
29
- function PickersActionBar(props) {
30
+ function PickersActionBarComponent(props) {
30
31
  const {
31
- onAccept,
32
- onClear,
33
- onCancel,
34
- onSetToday,
35
32
  actions
36
33
  } = props,
37
34
  other = _objectWithoutPropertiesLoose(props, _excluded);
38
35
  const translations = usePickerTranslations();
36
+ const {
37
+ clearValue,
38
+ setValueToToday,
39
+ acceptValueChanges,
40
+ cancelValueChanges
41
+ } = usePickerActionsContext();
39
42
  if (actions == null || actions.length === 0) {
40
43
  return null;
41
44
  }
@@ -43,22 +46,22 @@ function PickersActionBar(props) {
43
46
  switch (actionType) {
44
47
  case 'clear':
45
48
  return /*#__PURE__*/_jsx(Button, {
46
- onClick: onClear,
49
+ onClick: clearValue,
47
50
  children: translations.clearButtonLabel
48
51
  }, actionType);
49
52
  case 'cancel':
50
53
  return /*#__PURE__*/_jsx(Button, {
51
- onClick: onCancel,
54
+ onClick: cancelValueChanges,
52
55
  children: translations.cancelButtonLabel
53
56
  }, actionType);
54
57
  case 'accept':
55
58
  return /*#__PURE__*/_jsx(Button, {
56
- onClick: onAccept,
59
+ onClick: acceptValueChanges,
57
60
  children: translations.okButtonLabel
58
61
  }, actionType);
59
62
  case 'today':
60
63
  return /*#__PURE__*/_jsx(Button, {
61
- onClick: onSetToday,
64
+ onClick: setValueToToday,
62
65
  children: translations.todayButtonLabel
63
66
  }, actionType);
64
67
  default:
@@ -69,7 +72,7 @@ function PickersActionBar(props) {
69
72
  children: buttons
70
73
  }));
71
74
  }
72
- process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = {
75
+ process.env.NODE_ENV !== "production" ? PickersActionBarComponent.propTypes = {
73
76
  // ----------------------------- Warning --------------------------------
74
77
  // | These PropTypes are generated from the TypeScript type definitions |
75
78
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
@@ -77,7 +80,9 @@ process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = {
77
80
  /**
78
81
  * Ordered array of actions to display.
79
82
  * If empty, does not display that action bar.
80
- * @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
81
86
  */
82
87
  actions: PropTypes.arrayOf(PropTypes.oneOf(['accept', 'cancel', 'clear', 'today']).isRequired),
83
88
  /**
@@ -85,13 +90,10 @@ process.env.NODE_ENV !== "production" ? PickersActionBar.propTypes = {
85
90
  * @default false
86
91
  */
87
92
  disableSpacing: PropTypes.bool,
88
- onAccept: PropTypes.func.isRequired,
89
- onCancel: PropTypes.func.isRequired,
90
- onClear: PropTypes.func.isRequired,
91
- onSetToday: PropTypes.func.isRequired,
92
93
  /**
93
94
  * The system prop that allows defining system overrides as well as additional CSS styles.
94
95
  */
95
96
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
96
97
  } : void 0;
98
+ const PickersActionBar = /*#__PURE__*/React.memo(PickersActionBarComponent);
97
99
  export { PickersActionBar };
@@ -1,13 +1,13 @@
1
1
  import * as React from 'react';
2
2
  import { PickerLayoutOwnerState, PickersLayoutProps } from './PickersLayout.types';
3
- import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../internals/models';
3
+ import { PickerValidValue } from '../internals/models';
4
4
  export declare const PickersLayoutRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
5
5
  ownerState: PickerLayoutOwnerState;
6
6
  }, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
7
7
  export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
8
8
  ownerState: PickerLayoutOwnerState;
9
9
  }, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
10
- type PickersLayoutComponent = (<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
10
+ type PickersLayoutComponent = (<TValue extends PickerValidValue>(props: PickersLayoutProps<TValue> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
11
11
  propTypes?: any;
12
12
  };
13
13
  /**
@@ -150,17 +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
- onAccept: PropTypes.func.isRequired,
155
- onCancel: PropTypes.func.isRequired,
156
- onChange: PropTypes.func.isRequired,
157
- onClear: PropTypes.func.isRequired,
158
- onClose: PropTypes.func.isRequired,
159
- onDismiss: PropTypes.func.isRequired,
160
- onOpen: PropTypes.func.isRequired,
161
- onSelectShortcut: PropTypes.func.isRequired,
162
- onSetToday: PropTypes.func.isRequired,
163
- onViewChange: PropTypes.func.isRequired,
164
153
  /**
165
154
  * The props used for each component slot.
166
155
  * @default {}
@@ -174,9 +163,6 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
174
163
  /**
175
164
  * The system prop that allows defining system overrides as well as additional CSS styles.
176
165
  */
177
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
178
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
179
- view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
180
- views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
166
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
181
167
  } : void 0;
182
168
  export { PickersLayout };
@@ -3,16 +3,13 @@ import { SxProps, Theme } from '@mui/material/styles';
3
3
  import { SlotComponentProps } from '@mui/utils';
4
4
  import { PickersActionBar, PickersActionBarProps } from '../PickersActionBar';
5
5
  import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
6
- import { BaseTabsProps, ExportedBaseTabsProps } from '../internals/models/props/tabs';
6
+ import { ExportedBaseTabsProps } from '../internals/models/props/tabs';
7
7
  import { PickersLayoutClasses } from './pickersLayoutClasses';
8
- import { DateOrTimeViewWithMeridiem } from '../internals/models/common';
9
8
  import { PickersShortcutsProps } from '../PickersShortcuts';
10
9
  import { ExportedPickersShortcutProps, PickersShortcuts } from '../PickersShortcuts/PickersShortcuts';
11
10
  import { PickerOwnerState } from '../models';
12
11
  import { PickerValidValue } from '../internals/models';
13
- import { UsePickerViewsLayoutResponse } from '../internals/hooks/usePicker/usePickerViews';
14
- import { UsePickerValueLayoutResponse } from '../internals/hooks/usePicker/usePickerValue.types';
15
- export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
12
+ export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue> {
16
13
  /**
17
14
  * Custom component for the action bar, it is placed below the picker views.
18
15
  * @default PickersActionBar
@@ -27,7 +24,7 @@ export interface ExportedPickersLayoutSlots<TValue extends PickerValidValue, TVi
27
24
  * Custom component for wrapping the layout.
28
25
  * It wraps the toolbar, views, action bar, and shortcuts.
29
26
  */
30
- layout?: React.JSXElementConstructor<PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>>;
27
+ layout?: React.JSXElementConstructor<PickersLayoutProps<TValue> & React.RefAttributes<HTMLDivElement>>;
31
28
  }
32
29
  export interface PickerLayoutOwnerState extends PickerOwnerState {
33
30
  /**
@@ -37,7 +34,7 @@ export interface PickerLayoutOwnerState extends PickerOwnerState {
37
34
  */
38
35
  layoutDirection: 'ltr' | 'rtl';
39
36
  }
40
- export interface ExportedPickersLayoutSlotProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
37
+ export interface ExportedPickersLayoutSlotProps<TValue extends PickerValidValue> {
41
38
  /**
42
39
  * Props passed down to the action bar component.
43
40
  */
@@ -49,20 +46,20 @@ export interface ExportedPickersLayoutSlotProps<TValue extends PickerValidValue,
49
46
  /**
50
47
  * Props passed down to the layoutRoot component.
51
48
  */
52
- layout?: Partial<PickersLayoutProps<TValue, TView>>;
49
+ layout?: Partial<PickersLayoutProps<TValue>>;
53
50
  }
54
- export interface PickersLayoutSlots<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<TValue, TView> {
51
+ export interface PickersLayoutSlots<TValue extends PickerValidValue> extends ExportedPickersLayoutSlots<TValue> {
55
52
  /**
56
53
  * Tabs enabling toggling between views.
57
54
  */
58
- tabs?: React.ElementType<BaseTabsProps<TView>>;
55
+ tabs?: React.ElementType<{}>;
59
56
  /**
60
57
  * Custom component for the toolbar.
61
58
  * It is placed above the picker views.
62
59
  */
63
- toolbar?: React.JSXElementConstructor<BaseToolbarProps<TValue, TView>>;
60
+ toolbar?: React.JSXElementConstructor<BaseToolbarProps>;
64
61
  }
65
- export interface PickersLayoutSlotProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<TValue, TView> {
62
+ export interface PickersLayoutSlotProps<TValue extends PickerValidValue> extends ExportedPickersLayoutSlotProps<TValue> {
66
63
  /**
67
64
  * Props passed down to the tabs component.
68
65
  */
@@ -72,7 +69,7 @@ export interface PickersLayoutSlotProps<TValue extends PickerValidValue, TView e
72
69
  */
73
70
  toolbar?: ExportedBaseToolbarProps;
74
71
  }
75
- export interface PickersLayoutProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends UsePickerViewsLayoutResponse<TView>, UsePickerValueLayoutResponse<TValue> {
72
+ export interface PickersLayoutProps<TValue extends PickerValidValue> {
76
73
  className?: string;
77
74
  children?: React.ReactNode;
78
75
  /**
@@ -87,12 +84,12 @@ export interface PickersLayoutProps<TValue extends PickerValidValue, TView exten
87
84
  * Overridable component slots.
88
85
  * @default {}
89
86
  */
90
- slots?: PickersLayoutSlots<TValue, TView>;
87
+ slots?: PickersLayoutSlots<TValue>;
91
88
  /**
92
89
  * The props used for each component slot.
93
90
  * @default {}
94
91
  */
95
- slotProps?: PickersLayoutSlotProps<TValue, TView>;
92
+ slotProps?: PickersLayoutSlotProps<TValue>;
96
93
  }
97
94
  export interface SubComponents<TValue extends PickerValidValue> {
98
95
  toolbar: React.ReactElement<ExportedBaseToolbarProps> | null;
@@ -1,7 +1,7 @@
1
1
  import { PickerLayoutOwnerState, PickersLayoutProps, SubComponents } from './PickersLayout.types';
2
- import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../internals/models';
2
+ import { PickerValidValue } from '../internals/models';
3
3
  interface UsePickerLayoutResponse<TValue extends PickerValidValue> extends SubComponents<TValue> {
4
4
  ownerState: PickerLayoutOwnerState;
5
5
  }
6
- declare const usePickerLayout: <TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView>) => UsePickerLayoutResponse<TValue>;
6
+ declare const usePickerLayout: <TValue extends PickerValidValue>(props: PickersLayoutProps<TValue>) => UsePickerLayoutResponse<TValue>;
7
7
  export default usePickerLayout;
@@ -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,30 +36,14 @@ const usePickerLayout = props => {
34
36
  ownerState: pickerOwnerState
35
37
  } = usePickerPrivateContext();
36
38
  const {
37
- variant,
38
- orientation
39
+ view
39
40
  } = usePickerContext();
40
41
  const isRtl = useRtl();
41
42
  const {
42
- onAccept,
43
- onClear,
44
- onCancel,
45
- onSetToday,
46
- view,
47
- views,
48
- onViewChange,
49
- value,
50
- onChange,
51
- onSelectShortcut,
52
- isValid,
53
43
  children,
54
44
  slots,
55
45
  slotProps,
56
46
  classes: classesProp
57
- // TODO: Remove this "as" hack. It get introduced to mark `value` prop in PickersLayoutProps as not required.
58
- // The true type should be
59
- // - For pickers value: PickerValidDate | null
60
- // - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
61
47
  } = props;
62
48
  const ownerState = React.useMemo(() => _extends({}, pickerOwnerState, {
63
49
  layoutDirection: isRtl ? 'rtl' : 'ltr'
@@ -66,19 +52,16 @@ const usePickerLayout = props => {
66
52
 
67
53
  // Action bar
68
54
  const ActionBar = slots?.actionBar ?? PickersActionBar;
69
- const actionBarProps = useSlotProps({
70
- elementType: ActionBar,
71
- externalSlotProps: slotProps?.actionBar,
72
- additionalProps: {
73
- onAccept,
74
- onClear,
75
- onCancel,
76
- onSetToday,
77
- actions: variant === 'desktop' ? [] : ['cancel', 'accept']
78
- },
79
- className: classes.actionBar,
80
- ownerState
81
- });
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);
82
65
  const actionBar = /*#__PURE__*/_jsx(ActionBar, _extends({}, actionBarProps));
83
66
 
84
67
  // Toolbar
@@ -86,15 +69,6 @@ const usePickerLayout = props => {
86
69
  const toolbarProps = useSlotProps({
87
70
  elementType: Toolbar,
88
71
  externalSlotProps: slotProps?.toolbar,
89
- additionalProps: {
90
- isLandscape: orientation === 'landscape',
91
- // Will be removed in a follow up PR?
92
- onChange,
93
- value,
94
- view,
95
- onViewChange,
96
- views
97
- },
98
72
  className: classes.toolbar,
99
73
  ownerState
100
74
  });
@@ -106,8 +80,6 @@ const usePickerLayout = props => {
106
80
  // Tabs
107
81
  const Tabs = slots?.tabs;
108
82
  const tabs = view && Tabs ? /*#__PURE__*/_jsx(Tabs, _extends({
109
- view: view,
110
- onViewChange: onViewChange,
111
83
  className: classes.tabs
112
84
  }, slotProps?.tabs)) : null;
113
85
 
@@ -116,12 +88,6 @@ const usePickerLayout = props => {
116
88
  const shortcutsProps = useSlotProps({
117
89
  elementType: Shortcuts,
118
90
  externalSlotProps: slotProps?.shortcuts,
119
- additionalProps: {
120
- isValid,
121
- isLandscape: orientation === 'landscape',
122
- // Will be removed in a follow up PR?
123
- onChange: onSelectShortcut
124
- },
125
91
  className: classes.shortcuts,
126
92
  ownerState
127
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,10 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { BaseDatePickerProps, BaseDatePickerSlots, BaseDatePickerSlotProps } from '../DatePicker/shared';
3
3
  import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
4
- import { DateView } from '../models';
5
- export interface StaticDatePickerSlots extends BaseDatePickerSlots, UseStaticPickerSlots<DateView> {
4
+ export interface StaticDatePickerSlots extends BaseDatePickerSlots, UseStaticPickerSlots {
6
5
  }
7
- export interface StaticDatePickerSlotProps extends BaseDatePickerSlotProps, UseStaticPickerSlotProps<DateView> {
6
+ export interface StaticDatePickerSlotProps extends BaseDatePickerSlotProps, UseStaticPickerSlotProps {
8
7
  }
9
8
  export interface StaticDatePickerProps extends BaseDatePickerProps, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
10
9
  /**
@@ -2,9 +2,9 @@ import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { BaseDateTimePickerProps, BaseDateTimePickerSlots, BaseDateTimePickerSlotProps } from '../DateTimePicker/shared';
3
3
  import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
4
4
  import { DateOrTimeView } from '../models';
5
- export interface StaticDateTimePickerSlots extends BaseDateTimePickerSlots, UseStaticPickerSlots<DateOrTimeView> {
5
+ export interface StaticDateTimePickerSlots extends BaseDateTimePickerSlots, UseStaticPickerSlots {
6
6
  }
7
- export interface StaticDateTimePickerSlotProps extends BaseDateTimePickerSlotProps, UseStaticPickerSlotProps<DateOrTimeView> {
7
+ export interface StaticDateTimePickerSlotProps extends BaseDateTimePickerSlotProps, UseStaticPickerSlotProps {
8
8
  }
9
9
  export interface StaticDateTimePickerProps extends BaseDateTimePickerProps<DateOrTimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
10
10
  /**
@@ -2,9 +2,9 @@ import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { BaseTimePickerProps, BaseTimePickerSlots, BaseTimePickerSlotProps } from '../TimePicker/shared';
3
3
  import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from '../internals/hooks/useStaticPicker';
4
4
  import { TimeView } from '../models';
5
- export interface StaticTimePickerSlots extends BaseTimePickerSlots, UseStaticPickerSlots<TimeView> {
5
+ export interface StaticTimePickerSlots extends BaseTimePickerSlots, UseStaticPickerSlots {
6
6
  }
7
- export interface StaticTimePickerSlotProps extends BaseTimePickerSlotProps, UseStaticPickerSlotProps<TimeView> {
7
+ export interface StaticTimePickerSlotProps extends BaseTimePickerSlotProps, UseStaticPickerSlotProps {
8
8
  }
9
9
  export interface StaticTimePickerProps extends BaseTimePickerProps<TimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
10
10
  /**
@@ -1,2 +1,2 @@
1
1
  import { UseTimeFieldProps } from './TimeField.types';
2
- export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>, keyof import("../internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, "disabled" | "format" | "onChange" | "onError" | "defaultValue" | "value" | "readOnly" | "ampm" | "timezone" | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "enableAccessibleFieldDOMStructure" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "dateSeparator">>;
2
+ export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "onChange" | "onError" | "format" | "ampm" | "timezone" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
@@ -1,22 +1,24 @@
1
1
  'use client';
2
2
 
3
- import { singleItemFieldValueManager, singleItemValueManager } from "../internals/utils/valueManagers.js";
4
- import { useField } from "../internals/hooks/useField/index.js";
5
- import { validateTime } from "../validation/index.js";
3
+ import { useField, useFieldInternalPropsWithDefaults } from "../internals/hooks/useField/index.js";
6
4
  import { useSplitFieldProps } from "../hooks/index.js";
7
- import { useDefaultizedTimeField } from "../internals/hooks/defaultizedFieldProps.js";
8
- export const useTimeField = inProps => {
9
- const props = useDefaultizedTimeField(inProps);
5
+ import { useTimeManager } from "../managers/index.js";
6
+ export const useTimeField = props => {
7
+ const manager = useTimeManager(props);
10
8
  const {
11
9
  forwardedProps,
12
10
  internalProps
13
11
  } = useSplitFieldProps(props, 'time');
12
+ const internalPropsWithDefaults = useFieldInternalPropsWithDefaults({
13
+ manager,
14
+ internalProps
15
+ });
14
16
  return useField({
15
17
  forwardedProps,
16
- internalProps,
17
- valueManager: singleItemValueManager,
18
- fieldValueManager: singleItemFieldValueManager,
19
- validator: validateTime,
20
- valueType: 'time'
18
+ internalProps: internalPropsWithDefaults,
19
+ valueManager: manager.internal_valueManager,
20
+ fieldValueManager: manager.internal_fieldValueManager,
21
+ validator: manager.validator,
22
+ valueType: manager.valueType
21
23
  });
22
24
  };
@@ -69,8 +69,8 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
69
69
  autoFocus: PropTypes.bool,
70
70
  className: PropTypes.string,
71
71
  /**
72
- * If `true`, the popover or modal will close after submitting the full date.
73
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
72
+ * If `true`, the Picker will close after submitting the full date.
73
+ * @default false
74
74
  */
75
75
  closeOnSelect: PropTypes.bool,
76
76
  /**
@@ -3,9 +3,9 @@ import { BaseSingleInputFieldProps, PickerValue, TimeViewWithMeridiem } from '..
3
3
  import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from '../MobileTimePicker';
4
4
  import { TimeValidationError } from '../models';
5
5
  import { ValidateTimeProps } from '../validation/validateTime';
6
- export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots<TimeViewWithMeridiem> {
6
+ export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots {
7
7
  }
8
- export interface TimePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopTimePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileTimePickerSlotProps<TimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure> {
8
+ export interface TimePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopTimePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileTimePickerSlotProps<TEnableAccessibleFieldDOMStructure> {
9
9
  }
10
10
  export interface TimePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopTimePickerProps<TEnableAccessibleFieldDOMStructure>, Omit<MobileTimePickerProps<TimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure>, 'views'> {
11
11
  /**
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
3
3
  import { TimePickerToolbarClasses } from './timePickerToolbarClasses';
4
- import { PickerValue, TimeViewWithMeridiem } from '../internals/models';
5
- export interface TimePickerToolbarProps extends BaseToolbarProps<PickerValue, TimeViewWithMeridiem>, ExportedTimePickerToolbarProps {
4
+ export interface TimePickerToolbarProps extends BaseToolbarProps, ExportedTimePickerToolbarProps {
6
5
  ampm?: boolean;
7
6
  ampmInClock?: boolean;
8
7
  }