@mui/x-date-pickers 8.0.0-alpha.6 → 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 (281) 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 +127 -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 -2
  28. package/DatePicker/DatePickerToolbar.js +7 -11
  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/DateTimePickerTabs.js +2 -2
  34. package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
  35. package/DateTimePicker/DateTimePickerToolbar.js +36 -31
  36. package/DateTimePicker/shared.d.ts +1 -1
  37. package/DesktopDatePicker/DesktopDatePicker.js +9 -3
  38. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +5 -0
  39. package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  40. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  41. package/DesktopTimePicker/DesktopTimePicker.js +3 -7
  42. package/MobileDatePicker/MobileDatePicker.js +2 -2
  43. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  44. package/MobileTimePicker/MobileTimePicker.js +2 -2
  45. package/PickersActionBar/PickersActionBar.d.ts +6 -3
  46. package/PickersActionBar/PickersActionBar.js +6 -3
  47. package/PickersLayout/PickersLayout.js +1 -5
  48. package/PickersLayout/PickersLayout.types.d.ts +2 -3
  49. package/PickersLayout/usePickerLayout.js +12 -31
  50. package/PickersShortcuts/PickersShortcuts.d.ts +2 -5
  51. package/PickersShortcuts/PickersShortcuts.js +13 -10
  52. package/PickersShortcuts/index.d.ts +1 -1
  53. package/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  54. package/PickersTextField/PickersTextField.js +1 -1
  55. package/TimeField/useTimeField.d.ts +1 -1
  56. package/TimeField/useTimeField.js +13 -11
  57. package/TimePicker/TimePicker.js +2 -2
  58. package/TimePicker/TimePickerToolbar.d.ts +1 -2
  59. package/TimePicker/TimePickerToolbar.js +20 -18
  60. package/TimePicker/shared.d.ts +1 -1
  61. package/hooks/index.d.ts +1 -0
  62. package/hooks/index.js +2 -1
  63. package/hooks/useIsValidValue.d.ts +7 -0
  64. package/hooks/useIsValidValue.js +11 -0
  65. package/hooks/usePickerActionsContext.d.ts +3 -1
  66. package/hooks/usePickerActionsContext.js +0 -1
  67. package/hooks/usePickerContext.d.ts +2 -2
  68. package/hooks/usePickerContext.js +1 -1
  69. package/index.d.ts +1 -0
  70. package/index.js +3 -2
  71. package/internals/components/PickerProvider.d.ts +11 -10
  72. package/internals/components/PickerProvider.js +8 -3
  73. package/internals/components/PickersToolbar.d.ts +2 -3
  74. package/internals/components/PickersToolbar.js +1 -1
  75. package/internals/hooks/date-helpers-hooks.js +4 -3
  76. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -3
  77. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
  78. package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  79. package/internals/hooks/useField/index.d.ts +1 -1
  80. package/internals/hooks/useField/index.js +1 -1
  81. package/internals/hooks/useField/useField.d.ts +10 -1
  82. package/internals/hooks/useField/useField.js +17 -1
  83. package/internals/hooks/useField/useField.utils.js +2 -2
  84. package/internals/hooks/useField/useFieldState.js +2 -2
  85. package/internals/hooks/useField/useFieldV6TextField.js +2 -2
  86. package/internals/hooks/useMobilePicker/useMobilePicker.js +1 -3
  87. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -2
  88. package/internals/hooks/useOpenState.js +3 -2
  89. package/internals/hooks/usePicker/usePicker.d.ts +1 -1
  90. package/internals/hooks/usePicker/usePicker.js +0 -6
  91. package/internals/hooks/usePicker/usePicker.types.d.ts +5 -6
  92. package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -5
  93. package/internals/hooks/usePicker/usePickerProvider.js +4 -2
  94. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  95. package/internals/hooks/usePicker/usePickerValue.js +67 -184
  96. package/internals/hooks/usePicker/usePickerValue.types.d.ts +48 -54
  97. package/internals/hooks/usePicker/usePickerViews.d.ts +27 -23
  98. package/internals/hooks/usePicker/usePickerViews.js +17 -11
  99. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  100. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -2
  101. package/internals/hooks/useUtils.js +1 -1
  102. package/internals/index.d.ts +5 -3
  103. package/internals/index.js +5 -3
  104. package/internals/models/index.d.ts +1 -0
  105. package/internals/models/index.js +2 -1
  106. package/internals/models/manager.d.ts +12 -0
  107. package/internals/models/manager.js +1 -0
  108. package/internals/models/props/basePickerProps.d.ts +2 -2
  109. package/internals/models/props/toolbar.d.ts +1 -5
  110. package/internals/utils/date-utils.js +1 -1
  111. package/internals/utils/valueManagers.js +4 -4
  112. package/locales/index.d.ts +1 -0
  113. package/locales/index.js +1 -0
  114. package/locales/nbNO.js +15 -19
  115. package/locales/utils/getPickersLocalization.js +1 -1
  116. package/locales/zhTW.d.ts +80 -0
  117. package/locales/zhTW.js +73 -0
  118. package/managers/index.d.ts +6 -0
  119. package/managers/index.js +3 -0
  120. package/managers/package.json +6 -0
  121. package/managers/useDateManager.d.ts +27 -0
  122. package/managers/useDateManager.js +47 -0
  123. package/managers/useDateTimeManager.d.ts +28 -0
  124. package/managers/useDateTimeManager.js +52 -0
  125. package/managers/useTimeManager.d.ts +28 -0
  126. package/managers/useTimeManager.js +43 -0
  127. package/models/adapters.d.ts +1 -1
  128. package/models/index.d.ts +1 -0
  129. package/models/index.js +1 -0
  130. package/models/manager.d.ts +78 -0
  131. package/models/manager.js +1 -0
  132. package/models/pickers.d.ts +7 -0
  133. package/modern/AdapterDateFns/AdapterDateFns.js +49 -47
  134. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
  135. package/modern/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
  136. package/modern/AdapterDateFnsJalaliV2/index.js +1 -0
  137. package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
  138. package/modern/AdapterDateFnsV2/index.js +1 -0
  139. package/modern/DateCalendar/DateCalendar.js +1 -1
  140. package/modern/DateField/useDateField.js +13 -11
  141. package/modern/DatePicker/DatePicker.js +1 -1
  142. package/modern/DatePicker/DatePickerToolbar.js +7 -11
  143. package/modern/DateTimeField/useDateTimeField.js +13 -11
  144. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  145. package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
  146. package/modern/DateTimePicker/DateTimePickerToolbar.js +36 -31
  147. package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -3
  148. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  149. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  150. package/modern/DesktopTimePicker/DesktopTimePicker.js +3 -7
  151. package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
  152. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  153. package/modern/MobileTimePicker/MobileTimePicker.js +2 -2
  154. package/modern/PickersActionBar/PickersActionBar.js +6 -3
  155. package/modern/PickersLayout/PickersLayout.js +1 -5
  156. package/modern/PickersLayout/usePickerLayout.js +12 -31
  157. package/modern/PickersShortcuts/PickersShortcuts.js +13 -10
  158. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  159. package/modern/PickersTextField/PickersTextField.js +1 -1
  160. package/modern/TimeField/useTimeField.js +13 -11
  161. package/modern/TimePicker/TimePicker.js +2 -2
  162. package/modern/TimePicker/TimePickerToolbar.js +20 -18
  163. package/modern/hooks/index.js +2 -1
  164. package/modern/hooks/useIsValidValue.js +11 -0
  165. package/modern/hooks/usePickerActionsContext.js +0 -1
  166. package/modern/hooks/usePickerContext.js +1 -1
  167. package/modern/index.js +3 -2
  168. package/modern/internals/components/PickerProvider.js +8 -3
  169. package/modern/internals/components/PickersToolbar.js +1 -1
  170. package/modern/internals/hooks/date-helpers-hooks.js +4 -3
  171. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -3
  172. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  173. package/modern/internals/hooks/useField/index.js +1 -1
  174. package/modern/internals/hooks/useField/useField.js +17 -1
  175. package/modern/internals/hooks/useField/useField.utils.js +2 -2
  176. package/modern/internals/hooks/useField/useFieldState.js +2 -2
  177. package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
  178. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +1 -3
  179. package/modern/internals/hooks/useOpenState.js +3 -2
  180. package/modern/internals/hooks/usePicker/usePicker.js +0 -6
  181. package/modern/internals/hooks/usePicker/usePickerProvider.js +4 -2
  182. package/modern/internals/hooks/usePicker/usePickerValue.js +67 -184
  183. package/modern/internals/hooks/usePicker/usePickerViews.js +17 -11
  184. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  185. package/modern/internals/hooks/useUtils.js +1 -1
  186. package/modern/internals/index.js +5 -3
  187. package/modern/internals/models/index.js +2 -1
  188. package/modern/internals/models/manager.js +1 -0
  189. package/modern/internals/utils/date-utils.js +1 -1
  190. package/modern/internals/utils/valueManagers.js +4 -4
  191. package/modern/locales/index.js +1 -0
  192. package/modern/locales/nbNO.js +15 -19
  193. package/modern/locales/utils/getPickersLocalization.js +1 -1
  194. package/modern/locales/zhTW.js +73 -0
  195. package/modern/managers/index.js +3 -0
  196. package/modern/managers/useDateManager.js +47 -0
  197. package/modern/managers/useDateTimeManager.js +52 -0
  198. package/modern/managers/useTimeManager.js +43 -0
  199. package/modern/models/index.js +1 -0
  200. package/modern/models/manager.js +1 -0
  201. package/node/AdapterDateFns/AdapterDateFns.js +97 -97
  202. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +97 -96
  203. package/node/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +94 -101
  204. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  205. package/node/AdapterDateFnsV2/AdapterDateFnsV2.js +291 -0
  206. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  207. package/node/DateCalendar/DateCalendar.js +1 -1
  208. package/node/DateField/useDateField.js +12 -10
  209. package/node/DatePicker/DatePicker.js +1 -1
  210. package/node/DatePicker/DatePickerToolbar.js +7 -11
  211. package/node/DateTimeField/useDateTimeField.js +12 -10
  212. package/node/DateTimePicker/DateTimePicker.js +2 -2
  213. package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
  214. package/node/DateTimePicker/DateTimePickerToolbar.js +36 -31
  215. package/node/DesktopDatePicker/DesktopDatePicker.js +9 -3
  216. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  217. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  218. package/node/DesktopTimePicker/DesktopTimePicker.js +3 -7
  219. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  220. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  221. package/node/MobileTimePicker/MobileTimePicker.js +2 -2
  222. package/node/PickersActionBar/PickersActionBar.js +8 -5
  223. package/node/PickersLayout/PickersLayout.js +1 -5
  224. package/node/PickersLayout/usePickerLayout.js +16 -35
  225. package/node/PickersShortcuts/PickersShortcuts.js +13 -10
  226. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  227. package/node/PickersTextField/PickersTextField.js +1 -1
  228. package/node/TimeField/useTimeField.js +12 -10
  229. package/node/TimePicker/TimePicker.js +2 -2
  230. package/node/TimePicker/TimePickerToolbar.js +20 -18
  231. package/node/hooks/index.js +8 -1
  232. package/node/hooks/useIsValidValue.js +18 -0
  233. package/node/hooks/usePickerContext.js +1 -1
  234. package/node/index.js +13 -1
  235. package/node/internals/components/PickerProvider.js +8 -3
  236. package/node/internals/components/PickersToolbar.js +1 -1
  237. package/node/internals/hooks/date-helpers-hooks.js +4 -3
  238. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -3
  239. package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  240. package/node/internals/hooks/useField/index.js +6 -0
  241. package/node/internals/hooks/useField/useField.js +18 -1
  242. package/node/internals/hooks/useField/useField.utils.js +2 -2
  243. package/node/internals/hooks/useField/useFieldState.js +2 -2
  244. package/node/internals/hooks/useField/useFieldV6TextField.js +2 -2
  245. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +1 -3
  246. package/node/internals/hooks/useOpenState.js +4 -2
  247. package/node/internals/hooks/usePicker/usePicker.js +0 -7
  248. package/node/internals/hooks/usePicker/usePickerProvider.js +4 -2
  249. package/node/internals/hooks/usePicker/usePickerValue.js +67 -184
  250. package/node/internals/hooks/usePicker/usePickerViews.js +17 -12
  251. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  252. package/node/internals/hooks/useUtils.js +1 -1
  253. package/node/internals/index.js +26 -18
  254. package/node/internals/models/index.js +11 -0
  255. package/node/internals/models/manager.js +5 -0
  256. package/node/internals/utils/date-utils.js +1 -1
  257. package/node/internals/utils/valueManagers.js +4 -4
  258. package/node/locales/index.js +11 -0
  259. package/node/locales/nbNO.js +15 -19
  260. package/node/locales/utils/getPickersLocalization.js +1 -1
  261. package/node/locales/zhTW.js +79 -0
  262. package/node/managers/index.js +26 -0
  263. package/node/managers/useDateManager.js +55 -0
  264. package/node/managers/useDateTimeManager.js +60 -0
  265. package/node/managers/useTimeManager.js +51 -0
  266. package/node/models/index.js +11 -0
  267. package/node/models/manager.js +5 -0
  268. package/package.json +3 -3
  269. package/themeAugmentation/props.d.ts +1 -1
  270. package/validation/extractValidationProps.d.ts +1 -1
  271. package/AdapterDateFnsJalaliV3/index.d.ts +0 -1
  272. package/AdapterDateFnsJalaliV3/index.js +0 -1
  273. package/AdapterDateFnsV3/index.d.ts +0 -1
  274. package/AdapterDateFnsV3/index.js +0 -1
  275. package/internals/hooks/defaultizedFieldProps.d.ts +0 -18
  276. package/internals/hooks/defaultizedFieldProps.js +0 -40
  277. package/modern/AdapterDateFnsJalaliV3/index.js +0 -1
  278. package/modern/AdapterDateFnsV3/index.js +0 -1
  279. package/modern/internals/hooks/defaultizedFieldProps.js +0 -40
  280. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -299
  281. package/node/internals/hooks/defaultizedFieldProps.js +0 -50
@@ -27,7 +27,12 @@ import { isInternalTimeView } from "../internals/utils/time-utils.js";
27
27
  import { isDatePickerView } from "../internals/utils/date-utils.js";
28
28
  import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
29
29
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
30
- const rendererInterceptor = function rendererInterceptor(inViewRenderers, popperView, rendererProps) {
30
+ const rendererInterceptor = function RendererInterceptor(props) {
31
+ const {
32
+ viewRenderers,
33
+ popperView,
34
+ rendererProps
35
+ } = props;
31
36
  const {
32
37
  openTo,
33
38
  focusedView,
@@ -46,8 +51,10 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
46
51
  }]
47
52
  });
48
53
  const isTimeViewActive = isInternalTimeView(popperView);
54
+ const dateView = isTimeViewActive ? 'day' : popperView;
55
+ const timeView = isTimeViewActive ? popperView : 'hours';
49
56
  return /*#__PURE__*/_jsxs(React.Fragment, {
50
- children: [inViewRenderers[!isTimeViewActive ? popperView : 'day']?.(_extends({}, rendererProps, {
57
+ children: [viewRenderers[dateView]?.(_extends({}, rendererProps, {
51
58
  view: !isTimeViewActive ? popperView : 'day',
52
59
  focusedView: focusedView && isDatePickerView(focusedView) ? focusedView : null,
53
60
  views: rendererProps.views.filter(isDatePickerView),
@@ -60,7 +67,7 @@ const rendererInterceptor = function rendererInterceptor(inViewRenderers, popper
60
67
  sx: {
61
68
  gridColumn: 2
62
69
  }
63
- }), inViewRenderers[isTimeViewActive ? popperView : 'hours']?.(_extends({}, finalProps, {
70
+ }), viewRenderers[timeView]?.(_extends({}, finalProps, {
64
71
  view: isTimeViewActive ? popperView : 'hours',
65
72
  focusedView: focusedView && isInternalTimeView(focusedView) ? focusedView : null,
66
73
  openTo: isInternalTimeView(openTo) ? openTo : 'hours',
@@ -108,7 +115,6 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
108
115
  // Need to avoid adding the `meridiem` view when unexpected renderer is specified
109
116
  const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
110
117
  const views = !shouldHoursRendererContainMeridiemView ? resolvedViews.filter(view => view !== 'meridiem') : resolvedViews;
111
- const actionBarActions = shouldRenderTimeInASingleColumn ? [] : ['accept'];
112
118
 
113
119
  // Props with the default values specific to the desktop variant
114
120
  const props = _extends({}, defaultizedProps, {
@@ -135,10 +141,7 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
135
141
  }, defaultizedProps.slotProps?.toolbar),
136
142
  tabs: _extends({
137
143
  hidden: true
138
- }, defaultizedProps.slotProps?.tabs),
139
- actionBar: ownerState => _extends({
140
- actions: actionBarActions
141
- }, resolveComponentProps(defaultizedProps.slotProps?.actionBar, ownerState))
144
+ }, defaultizedProps.slotProps?.tabs)
142
145
  })
143
146
  });
144
147
  const {
@@ -182,8 +185,8 @@ DesktopDateTimePicker.propTypes = {
182
185
  autoFocus: PropTypes.bool,
183
186
  className: PropTypes.string,
184
187
  /**
185
- * If `true`, the popover or modal will close after submitting the full date.
186
- * @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
188
+ * If `true`, the Picker will close after submitting the full date.
189
+ * @default false
187
190
  */
188
191
  closeOnSelect: PropTypes.bool,
189
192
  /**
@@ -65,9 +65,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
65
65
  */
66
66
  classes: PropTypes.object,
67
67
  className: PropTypes.string,
68
- isValid: PropTypes.func.isRequired,
69
- onChange: PropTypes.func.isRequired,
70
- onSelectShortcut: PropTypes.func.isRequired,
71
68
  /**
72
69
  * The props used for each component slot.
73
70
  * @default {}
@@ -81,7 +78,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
81
78
  /**
82
79
  * The system prop that allows defining system overrides as well as additional CSS styles.
83
80
  */
84
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
85
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object])
81
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
86
82
  } : void 0;
87
83
  export { DesktopDateTimePickerLayout };
@@ -46,7 +46,6 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
46
46
  meridiem: renderTimeView
47
47
  }, defaultizedProps.viewRenderers);
48
48
  const ampmInClock = defaultizedProps.ampmInClock ?? true;
49
- const actionBarActions = shouldRenderTimeInASingleColumn ? [] : ['accept'];
50
49
  // Need to avoid adding the `meridiem` view when unexpected renderer is specified
51
50
  const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
52
51
  const views = !shouldHoursRendererContainMeridiemView ? resolvedViews.filter(view => view !== 'meridiem') : resolvedViews;
@@ -71,10 +70,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
71
70
  toolbar: _extends({
72
71
  hidden: true,
73
72
  ampmInClock
74
- }, defaultizedProps.slotProps?.toolbar),
75
- actionBar: _extends({
76
- actions: actionBarActions
77
- }, defaultizedProps.slotProps?.actionBar)
73
+ }, defaultizedProps.slotProps?.toolbar)
78
74
  })
79
75
  });
80
76
  const {
@@ -117,8 +113,8 @@ DesktopTimePicker.propTypes = {
117
113
  autoFocus: PropTypes.bool,
118
114
  className: PropTypes.string,
119
115
  /**
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).
116
+ * If `true`, the Picker will close after submitting the full date.
117
+ * @default false
122
118
  */
123
119
  closeOnSelect: PropTypes.bool,
124
120
  /**
@@ -83,8 +83,8 @@ MobileDatePicker.propTypes = {
83
83
  autoFocus: PropTypes.bool,
84
84
  className: PropTypes.string,
85
85
  /**
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).
86
+ * If `true`, the Picker will close after submitting the full date.
87
+ * @default false
88
88
  */
89
89
  closeOnSelect: PropTypes.bool,
90
90
  /**
@@ -103,8 +103,8 @@ MobileDateTimePicker.propTypes = {
103
103
  autoFocus: PropTypes.bool,
104
104
  className: PropTypes.string,
105
105
  /**
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).
106
+ * If `true`, the Picker will close after submitting the full date.
107
+ * @default false
108
108
  */
109
109
  closeOnSelect: PropTypes.bool,
110
110
  /**
@@ -96,8 +96,8 @@ MobileTimePicker.propTypes = {
96
96
  autoFocus: PropTypes.bool,
97
97
  className: PropTypes.string,
98
98
  /**
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).
99
+ * If `true`, the Picker will close after submitting the full date.
100
+ * @default false
101
101
  */
102
102
  closeOnSelect: PropTypes.bool,
103
103
  /**
@@ -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 };
@@ -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
  });
@@ -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`.
@@ -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,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
  /**
@@ -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 = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "className", "classes"];
5
+ const _excluded = ["ampm", "ampmInClock", "className", "classes"];
6
6
  import * as React from 'react';
7
7
  import clsx from 'clsx';
8
8
  import PropTypes from 'prop-types';
@@ -122,9 +122,6 @@ function TimePickerToolbar(inProps) {
122
122
  const {
123
123
  ampm,
124
124
  ampmInClock,
125
- value,
126
- isLandscape,
127
- onChange,
128
125
  className,
129
126
  classes: classesProp
130
127
  } = props,
@@ -134,18 +131,27 @@ function TimePickerToolbar(inProps) {
134
131
  const ownerState = useToolbarOwnerState();
135
132
  const classes = useUtilityClasses(classesProp, ownerState);
136
133
  const {
134
+ value,
135
+ setValue,
137
136
  disabled,
138
137
  readOnly,
139
138
  view,
140
- onViewChange,
139
+ setView,
141
140
  views
142
141
  } = usePickerContext();
143
142
  const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
144
143
  const {
145
144
  meridiemMode,
146
145
  handleMeridiemChange
147
- } = useMeridiemMode(value, ampm, onChange);
148
- const formatHours = time => ampm ? utils.format(time, 'hours12h') : utils.format(time, 'hours24h');
146
+ } = useMeridiemMode(value, ampm, newValue => setValue(newValue, {
147
+ changeImportance: 'set'
148
+ }));
149
+ const formatSection = format => {
150
+ if (!utils.isValid(value)) {
151
+ return '--';
152
+ }
153
+ return utils.format(value, format);
154
+ };
149
155
  const separator = /*#__PURE__*/_jsx(TimePickerToolbarSeparator, {
150
156
  tabIndex: -1,
151
157
  value: ":",
@@ -156,7 +162,6 @@ function TimePickerToolbar(inProps) {
156
162
  return /*#__PURE__*/_jsxs(TimePickerToolbarRoot, _extends({
157
163
  landscapeDirection: "row",
158
164
  toolbarTitle: translations.timePickerToolbarTitle,
159
- isLandscape: isLandscape,
160
165
  ownerState: ownerState,
161
166
  className: clsx(classes.root, className)
162
167
  }, other, {
@@ -166,20 +171,20 @@ function TimePickerToolbar(inProps) {
166
171
  children: [arrayIncludes(views, 'hours') && /*#__PURE__*/_jsx(PickersToolbarButton, {
167
172
  tabIndex: -1,
168
173
  variant: "h3",
169
- onClick: () => onViewChange('hours'),
174
+ onClick: () => setView('hours'),
170
175
  selected: view === 'hours',
171
- value: value ? formatHours(value) : '--'
176
+ value: formatSection(ampm ? 'hours12h' : 'hours24h')
172
177
  }), arrayIncludes(views, ['hours', 'minutes']) && separator, arrayIncludes(views, 'minutes') && /*#__PURE__*/_jsx(PickersToolbarButton, {
173
178
  tabIndex: -1,
174
179
  variant: "h3",
175
- onClick: () => onViewChange('minutes'),
180
+ onClick: () => setView('minutes'),
176
181
  selected: view === 'minutes',
177
- value: value ? utils.format(value, 'minutes') : '--'
182
+ value: formatSection('minutes')
178
183
  }), arrayIncludes(views, ['minutes', 'seconds']) && separator, arrayIncludes(views, 'seconds') && /*#__PURE__*/_jsx(PickersToolbarButton, {
179
184
  variant: "h3",
180
- onClick: () => onViewChange('seconds'),
185
+ onClick: () => setView('seconds'),
181
186
  selected: view === 'seconds',
182
- value: value ? utils.format(value, 'seconds') : '--'
187
+ value: formatSection('seconds')
183
188
  })]
184
189
  }), showAmPmControl && /*#__PURE__*/_jsxs(TimePickerToolbarAmPmSelection, {
185
190
  className: classes.ampmSelection,
@@ -221,8 +226,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
221
226
  * @default `true` for Desktop, `false` for Mobile.
222
227
  */
223
228
  hidden: PropTypes.bool,
224
- isLandscape: PropTypes.bool.isRequired,
225
- onChange: PropTypes.func.isRequired,
226
229
  /**
227
230
  * The system prop that allows defining system overrides as well as additional CSS styles.
228
231
  */
@@ -236,7 +239,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
236
239
  * Toolbar value placeholder—it is displayed when the value is empty.
237
240
  * @default "––"
238
241
  */
239
- toolbarPlaceholder: PropTypes.node,
240
- value: PropTypes.object
242
+ toolbarPlaceholder: PropTypes.node
241
243
  } : void 0;
242
244
  export { TimePickerToolbar };
@@ -3,4 +3,5 @@ export { usePickerTranslations } from "./usePickerTranslations.js";
3
3
  export { useSplitFieldProps } from "./useSplitFieldProps.js";
4
4
  export { useParsedFormat } from "./useParsedFormat.js";
5
5
  export { usePickerContext } from "./usePickerContext.js";
6
- export { usePickerActionsContext } from "./usePickerActionsContext.js";
6
+ export { usePickerActionsContext } from "./usePickerActionsContext.js";
7
+ export { useIsValidValue } from "./useIsValidValue.js";
@@ -0,0 +1,11 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ export const IsValidValueContext = /*#__PURE__*/React.createContext(() => true);
5
+
6
+ /**
7
+ * Returns a function to check if a value is valid according to the validation props passed to the parent picker.
8
+ */
9
+ export function useIsValidValue() {
10
+ return React.useContext(IsValidValueContext);
11
+ }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import { PickerActionsContext } from "../internals/components/PickerProvider.js";
5
-
6
5
  /**
7
6
  * Returns a subset of the context passed by the picker wrapping the current component.
8
7
  * It only contains the actions and never causes a re-render of the component using it.
@@ -8,7 +8,7 @@ import { PickerContext } from "../internals/components/PickerProvider.js";
8
8
  export const usePickerContext = () => {
9
9
  const value = React.useContext(PickerContext);
10
10
  if (value == null) {
11
- throw new Error(['MUI X: The `usePickerContext` can only be called in fields that are used as a slot of a picker component'].join('\n'));
11
+ throw new Error('MUI X: The `usePickerContext` hook can only be called inside the context of a picker component');
12
12
  }
13
13
  return value;
14
14
  };
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.0.0-alpha.6
2
+ * @mui/x-date-pickers v8.0.0-alpha.7
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -57,4 +57,5 @@ export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from "./internals/utils/utils.js";
57
57
  export * from "./models/index.js";
58
58
  export * from "./icons/index.js";
59
59
  export * from "./hooks/index.js";
60
- export * from "./validation/index.js";
60
+ export * from "./validation/index.js";
61
+ export * from "./managers/index.js";
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { LocalizationProvider } from "../../LocalizationProvider/index.js";
3
+ import { IsValidValueContext } from "../../hooks/useIsValidValue.js";
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  export const PickerContext = /*#__PURE__*/React.createContext(null);
5
6
  export const PickerActionsContext = /*#__PURE__*/React.createContext(null);
@@ -27,6 +28,7 @@ export function PickerProvider(props) {
27
28
  contextValue,
28
29
  actionsContextValue,
29
30
  privateContextValue,
31
+ isValidContextValue,
30
32
  localeText,
31
33
  children
32
34
  } = props;
@@ -36,9 +38,12 @@ export function PickerProvider(props) {
36
38
  value: actionsContextValue,
37
39
  children: /*#__PURE__*/_jsx(PickerPrivateContext.Provider, {
38
40
  value: privateContextValue,
39
- children: /*#__PURE__*/_jsx(LocalizationProvider, {
40
- localeText: localeText,
41
- children: children
41
+ children: /*#__PURE__*/_jsx(IsValidValueContext.Provider, {
42
+ value: isValidContextValue,
43
+ children: /*#__PURE__*/_jsx(LocalizationProvider, {
44
+ localeText: localeText,
45
+ children: children
46
+ })
42
47
  })
43
48
  })
44
49
  })
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "className", "classes", "toolbarTitle", "hidden", "titleId", "isLandscape", "classes", "landscapeDirection"];
3
+ const _excluded = ["children", "className", "classes", "toolbarTitle", "hidden", "titleId", "classes", "landscapeDirection"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import Typography from '@mui/material/Typography';