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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.d.ts +1 -1
  2. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  3. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
  4. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.d.ts +1 -1
  5. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  6. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
  7. package/CHANGELOG.md +242 -1
  8. package/DateRangeCalendar/DateRangeCalendar.js +12 -10
  9. package/DateRangePicker/DateRangePicker.js +1 -1
  10. package/DateRangePicker/DateRangePicker.types.d.ts +5 -0
  11. package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
  12. package/DateRangePicker/DateRangePickerToolbar.js +27 -19
  13. package/DateRangePicker/shared.d.ts +1 -1
  14. package/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  15. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +3 -4
  16. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
  17. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
  18. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  19. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -3
  20. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +29 -31
  21. package/DateTimeRangePicker/shared.d.ts +2 -2
  22. package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +5 -0
  24. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  25. package/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  26. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  27. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +9 -4
  28. package/MultiInputDateRangeField/MultiInputDateRangeField.js +12 -116
  29. package/MultiInputDateRangeField/index.d.ts +5 -3
  30. package/MultiInputDateRangeField/index.js +2 -2
  31. package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.d.ts +6 -0
  32. package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
  33. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +9 -4
  34. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +12 -116
  35. package/MultiInputDateTimeRangeField/index.d.ts +5 -3
  36. package/MultiInputDateTimeRangeField/index.js +2 -2
  37. package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.d.ts +6 -0
  38. package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
  39. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +9 -4
  40. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -117
  41. package/MultiInputTimeRangeField/index.d.ts +5 -3
  42. package/MultiInputTimeRangeField/index.js +2 -2
  43. package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.d.ts +6 -0
  44. package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
  45. package/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -30
  46. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +6 -17
  47. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  48. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
  49. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +20 -30
  50. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +6 -18
  51. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  52. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
  53. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +20 -30
  54. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +6 -18
  55. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  56. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
  57. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  58. package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  59. package/hooks/index.d.ts +2 -0
  60. package/hooks/index.js +2 -0
  61. package/hooks/package.json +6 -0
  62. package/hooks/useMultiInputRangeField/index.d.ts +1 -0
  63. package/hooks/useMultiInputRangeField/index.js +1 -0
  64. package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +53 -0
  65. package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
  66. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +17 -0
  67. package/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
  68. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +17 -0
  69. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
  70. package/hooks/usePickerRangePositionContext.d.ts +7 -0
  71. package/hooks/usePickerRangePositionContext.js +15 -0
  72. package/index.d.ts +2 -0
  73. package/index.js +4 -2
  74. package/internals/hooks/models/index.d.ts +1 -1
  75. package/internals/hooks/models/useRangePicker.d.ts +6 -8
  76. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +40 -67
  77. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -5
  78. package/internals/hooks/{useEnrichedRangePickerFieldProps.d.ts → useEnrichedRangePickerField.d.ts} +18 -9
  79. package/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +39 -52
  80. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +33 -56
  81. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -5
  82. package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
  83. package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  84. package/internals/hooks/useRangePosition.d.ts +2 -2
  85. package/internals/hooks/useRangePosition.js +1 -1
  86. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  87. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +2 -2
  88. package/internals/models/dateTimeRange.d.ts +1 -6
  89. package/internals/models/fields.d.ts +1 -2
  90. package/internals/models/index.d.ts +0 -1
  91. package/internals/models/index.js +0 -1
  92. package/internals/models/managers.d.ts +3 -0
  93. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.d.ts +3 -0
  94. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +133 -0
  95. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +72 -0
  96. package/internals/utils/createMultiInputRangeField/index.d.ts +3 -0
  97. package/internals/utils/createMultiInputRangeField/index.js +2 -0
  98. package/internals/utils/date-range-manager.js +2 -1
  99. package/internals/utils/releaseInfo.js +1 -1
  100. package/internals/utils/valueManagers.js +7 -7
  101. package/managers/index.d.ts +6 -0
  102. package/managers/index.js +3 -0
  103. package/managers/package.json +6 -0
  104. package/managers/useDateRangeManager.d.ts +15 -0
  105. package/managers/useDateRangeManager.js +33 -0
  106. package/managers/useDateTimeRangeManager.d.ts +15 -0
  107. package/managers/useDateTimeRangeManager.js +33 -0
  108. package/managers/useTimeRangeManager.d.ts +15 -0
  109. package/managers/useTimeRangeManager.js +31 -0
  110. package/models/fields.d.ts +1 -2
  111. package/models/index.d.ts +0 -2
  112. package/models/index.js +0 -2
  113. package/models/range.d.ts +0 -1
  114. package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  115. package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  116. package/modern/DateRangeCalendar/DateRangeCalendar.js +12 -10
  117. package/modern/DateRangePicker/DateRangePicker.js +1 -1
  118. package/modern/DateRangePicker/DateRangePickerToolbar.js +27 -19
  119. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  120. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
  121. package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  122. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +29 -31
  123. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  124. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  125. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  126. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  127. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +12 -116
  128. package/modern/MultiInputDateRangeField/index.js +2 -2
  129. package/modern/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
  130. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +12 -116
  131. package/modern/MultiInputDateTimeRangeField/index.js +2 -2
  132. package/modern/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
  133. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +13 -117
  134. package/modern/MultiInputTimeRangeField/index.js +2 -2
  135. package/modern/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
  136. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +20 -30
  137. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
  138. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +20 -30
  139. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
  140. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +20 -30
  141. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
  142. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  143. package/modern/hooks/index.js +2 -0
  144. package/modern/hooks/useMultiInputRangeField/index.js +1 -0
  145. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
  146. package/modern/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
  147. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
  148. package/modern/hooks/usePickerRangePositionContext.js +15 -0
  149. package/modern/index.js +4 -2
  150. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +40 -67
  151. package/modern/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +39 -52
  152. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +33 -56
  153. package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  154. package/modern/internals/hooks/useRangePosition.js +1 -1
  155. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  156. package/modern/internals/models/index.js +0 -1
  157. package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +133 -0
  158. package/modern/internals/utils/createMultiInputRangeField/index.js +2 -0
  159. package/modern/internals/utils/date-range-manager.js +2 -1
  160. package/modern/internals/utils/releaseInfo.js +1 -1
  161. package/modern/internals/utils/valueManagers.js +7 -7
  162. package/modern/managers/index.js +3 -0
  163. package/modern/managers/useDateRangeManager.js +33 -0
  164. package/modern/managers/useDateTimeRangeManager.js +33 -0
  165. package/modern/managers/useTimeRangeManager.js +31 -0
  166. package/modern/models/index.js +0 -2
  167. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  168. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  169. package/node/DateRangeCalendar/DateRangeCalendar.js +12 -10
  170. package/node/DateRangePicker/DateRangePicker.js +1 -1
  171. package/node/DateRangePicker/DateRangePickerToolbar.js +26 -18
  172. package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -2
  173. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +10 -9
  174. package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  175. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +29 -31
  176. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -3
  177. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +17 -14
  178. package/node/MobileDateRangePicker/MobileDateRangePicker.js +2 -2
  179. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -8
  180. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +11 -119
  181. package/node/MultiInputDateRangeField/index.js +3 -9
  182. package/node/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +12 -0
  183. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +11 -119
  184. package/node/MultiInputDateTimeRangeField/index.js +3 -9
  185. package/node/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +12 -0
  186. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +12 -120
  187. package/node/MultiInputTimeRangeField/index.js +3 -9
  188. package/node/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +12 -0
  189. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +19 -29
  190. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  191. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +19 -29
  192. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  193. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +19 -29
  194. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  195. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  196. package/node/hooks/index.js +19 -0
  197. package/node/hooks/useMultiInputRangeField/index.js +12 -0
  198. package/node/hooks/useMultiInputRangeField/useMultiInputRangeField.js +155 -0
  199. package/node/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +11 -10
  200. package/node/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +66 -0
  201. package/node/hooks/usePickerRangePositionContext.js +22 -0
  202. package/node/index.js +23 -1
  203. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +39 -66
  204. package/node/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +41 -54
  205. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +32 -55
  206. package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
  207. package/node/internals/hooks/useRangePosition.js +1 -1
  208. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +14 -24
  209. package/node/internals/models/index.js +0 -11
  210. package/node/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +140 -0
  211. package/node/internals/utils/createMultiInputRangeField/index.js +19 -0
  212. package/node/internals/utils/date-range-manager.js +2 -1
  213. package/node/internals/utils/releaseInfo.js +1 -1
  214. package/node/internals/utils/valueManagers.js +7 -7
  215. package/node/managers/index.js +26 -0
  216. package/node/managers/useDateRangeManager.js +40 -0
  217. package/node/managers/useDateTimeRangeManager.js +40 -0
  218. package/node/managers/useTimeRangeManager.js +38 -0
  219. package/node/models/index.js +0 -22
  220. package/package.json +5 -5
  221. package/themeAugmentation/overrides.d.ts +6 -4
  222. package/themeAugmentation/props.d.ts +2 -2
  223. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +0 -55
  224. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +0 -56
  225. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +0 -56
  226. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +0 -20
  227. package/internals/hooks/useMultiInputRangeField/shared.d.ts +0 -1
  228. package/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  229. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +0 -3
  230. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
  231. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +0 -3
  232. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
  233. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +0 -11
  234. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +0 -3
  235. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
  236. package/internals/models/timeRange.d.ts +0 -6
  237. package/internals/models/timeRange.js +0 -1
  238. package/models/dateRange.d.ts +0 -7
  239. package/models/dateRange.js +0 -1
  240. package/models/multiInputRangeFieldClasses.d.ts +0 -7
  241. package/models/multiInputRangeFieldClasses.js +0 -1
  242. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  243. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  244. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  245. package/modern/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  246. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
  247. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
  248. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  249. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
  250. package/modern/internals/models/timeRange.js +0 -1
  251. package/modern/models/dateRange.js +0 -1
  252. package/modern/models/multiInputRangeFieldClasses.js +0 -1
  253. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -5
  254. package/node/internals/hooks/useMultiInputRangeField/shared.js +0 -16
  255. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -121
  256. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -121
  257. package/node/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -5
  258. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -121
  259. package/node/internals/models/timeRange.js +0 -5
  260. package/node/models/dateRange.js +0 -5
  261. package/node/models/multiInputRangeFieldClasses.js +0 -5
  262. /package/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
  263. /package/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
  264. /package/{MultiInputTimeRangeField/MultiInputTimeRangeField.types.js → modern/internals/models/managers.js} +0 -0
  265. /package/{internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js → modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
  266. /package/node/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
  267. /package/node/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
@@ -5,10 +5,11 @@ import * as React from 'react';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
6
  import { useLicenseVerifier } from '@mui/x-license';
7
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
- import { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper, PickerProvider } from '@mui/x-date-pickers/internals';
9
- import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
8
+ import { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper, PickerProvider, PickerFieldUIContextProvider } from '@mui/x-date-pickers/internals';
9
+ import { useEnrichedRangePickerField } from "../useEnrichedRangePickerField.js";
10
10
  import { getReleaseInfo } from "../../utils/releaseInfo.js";
11
11
  import { useRangePosition } from "../useRangePosition.js";
12
+ import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
12
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
14
  const releaseInfo = getReleaseInfo();
14
15
  export const useDesktopRangePicker = _ref => {
@@ -22,60 +23,46 @@ export const useDesktopRangePicker = _ref => {
22
23
  slotProps,
23
24
  className,
24
25
  sx,
25
- format,
26
- formatDensity,
27
- enableAccessibleFieldDOMStructure,
28
- selectedSections,
29
- onSelectedSectionsChange,
30
- timezone,
31
26
  label,
32
27
  inputRef,
33
28
  name,
34
29
  readOnly,
35
- disabled,
36
30
  autoFocus,
37
31
  disableOpenPicker,
38
32
  localeText,
39
33
  reduceAnimations
40
34
  } = props;
41
35
  const fieldContainerRef = React.useRef(null);
42
- const anchorRef = React.useRef(null);
43
36
  const popperRef = React.useRef(null);
44
37
  const startFieldRef = React.useRef(null);
45
38
  const endFieldRef = React.useRef(null);
46
39
  const singleInputFieldRef = React.useRef(null);
47
40
  const initialView = React.useRef(props.openTo ?? null);
48
41
  const fieldType = slots.field.fieldType ?? 'multi-input';
49
- const {
50
- rangePosition,
51
- onRangePositionChange
52
- } = useRangePosition(props, fieldType === 'single-input' ? singleInputFieldRef : undefined);
42
+ const rangePositionResponse = useRangePosition(props, fieldType === 'single-input' ? singleInputFieldRef : undefined);
53
43
  let fieldRef;
54
44
  if (fieldType === 'single-input') {
55
45
  fieldRef = singleInputFieldRef;
56
- } else if (rangePosition === 'start') {
46
+ } else if (rangePositionResponse.rangePosition === 'start') {
57
47
  fieldRef = startFieldRef;
58
48
  } else {
59
49
  fieldRef = endFieldRef;
60
50
  }
61
51
  const {
62
- layoutProps,
63
52
  providerProps,
64
53
  renderCurrentView,
65
54
  shouldRestoreFocus,
66
- fieldProps: pickerFieldProps,
67
55
  ownerState
68
56
  } = usePicker(_extends({}, pickerParams, {
69
57
  props,
70
58
  variant: 'desktop',
71
59
  autoFocusView: false,
72
60
  fieldRef,
73
- localeText,
74
- additionalViewProps: {
75
- rangePosition,
76
- onRangePositionChange
77
- }
61
+ localeText
78
62
  }));
63
+
64
+ // Temporary hack to hide the opening button on the range pickers until we have migrate them to the new opening logic.
65
+ providerProps.contextValue.triggerStatus = 'hidden';
79
66
  React.useEffect(() => {
80
67
  if (providerProps.contextValue.view) {
81
68
  initialView.current = providerProps.contextValue.view;
@@ -99,17 +86,7 @@ export const useDesktopRangePicker = _ref => {
99
86
  additionalProps: _extends({
100
87
  // Internal props
101
88
  readOnly,
102
- disabled,
103
- format,
104
- formatDensity,
105
- enableAccessibleFieldDOMStructure,
106
- selectedSections,
107
- onSelectedSectionsChange,
108
- timezone,
109
- autoFocus: autoFocus && !props.open
110
- }, pickerFieldProps, {
111
- // onChange and value
112
-
89
+ autoFocus: autoFocus && !props.open,
113
90
  // Forwarded props
114
91
  className,
115
92
  sx,
@@ -121,58 +98,54 @@ export const useDesktopRangePicker = _ref => {
121
98
  }),
122
99
  ownerState
123
100
  });
124
- const enrichedFieldProps = useEnrichedRangePickerFieldProps({
101
+ const enrichedFieldResponse = useEnrichedRangePickerField(_extends({
125
102
  variant: 'desktop',
126
103
  fieldType,
127
104
  // These direct access to `providerProps` will go away once the range fields handle the picker opening
128
- open: providerProps.contextValue.open,
129
- setOpen: providerProps.contextValue.setOpen,
105
+ contextValue: providerProps.contextValue,
106
+ fieldPrivateContextValue: providerProps.fieldPrivateContextValue,
130
107
  readOnly,
131
108
  disableOpenPicker,
132
109
  label,
133
110
  localeText,
134
111
  onBlur: handleBlur,
135
- rangePosition,
136
- onRangePositionChange,
137
112
  pickerSlotProps: slotProps,
138
113
  pickerSlots: slots,
139
114
  fieldProps,
140
- anchorRef,
115
+ anchorRef: providerProps.contextValue.triggerRef,
141
116
  startFieldRef,
142
117
  endFieldRef,
143
118
  singleInputFieldRef,
144
119
  currentView: providerProps.contextValue.view !== props.openTo ? providerProps.contextValue.view : undefined,
145
- initialView: initialView.current ?? undefined,
146
- onViewChange: providerProps.contextValue.onViewChange
147
- });
148
- const slotPropsForLayout = _extends({}, slotProps, {
149
- tabs: _extends({}, slotProps?.tabs, {
150
- rangePosition,
151
- onRangePositionChange
152
- }),
153
- toolbar: _extends({}, slotProps?.toolbar, {
154
- rangePosition,
155
- onRangePositionChange
156
- })
157
- });
120
+ initialView: initialView.current ?? undefined
121
+ }, rangePositionResponse));
158
122
  const Layout = slots?.layout ?? PickersLayout;
159
- const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
160
- children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersPopper, {
161
- role: "tooltip",
162
- placement: "bottom-start",
163
- containerRef: popperRef,
164
- anchorEl: anchorRef.current,
165
- onBlur: handleBlur,
123
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
124
+ // This override will go away once the range fields handle the picker opening
125
+ fieldPrivateContextValue: _extends({}, providerProps.fieldPrivateContextValue, enrichedFieldResponse.fieldPrivateContextValue),
126
+ children: /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
166
127
  slots: slots,
167
128
  slotProps: slotProps,
168
- shouldRestoreFocus: shouldRestoreFocus,
169
- reduceAnimations: reduceAnimations,
170
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
171
- slots: slots,
172
- slotProps: slotPropsForLayout,
173
- children: renderCurrentView()
174
- }))
175
- })]
129
+ children: /*#__PURE__*/_jsxs(PickerRangePositionContext.Provider, {
130
+ value: rangePositionResponse,
131
+ children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldResponse.fieldProps)), /*#__PURE__*/_jsx(PickersPopper, {
132
+ role: "tooltip",
133
+ placement: "bottom-start",
134
+ containerRef: popperRef,
135
+ anchorEl: providerProps.contextValue.triggerRef.current,
136
+ onBlur: handleBlur,
137
+ slots: slots,
138
+ slotProps: slotProps,
139
+ shouldRestoreFocus: shouldRestoreFocus,
140
+ reduceAnimations: reduceAnimations,
141
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
142
+ slots: slots,
143
+ slotProps: slotProps,
144
+ children: renderCurrentView()
145
+ }))
146
+ })]
147
+ })
148
+ })
176
149
  }));
177
150
  return {
178
151
  renderPicker
@@ -8,15 +8,14 @@ import useForkRef from '@mui/utils/useForkRef';
8
8
  import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
9
9
  import { onSpaceOrEnter } from '@mui/x-date-pickers/internals';
10
10
  const useMultiInputFieldSlotProps = ({
11
+ contextValue,
11
12
  variant,
12
- open,
13
- setOpen,
14
13
  readOnly,
15
14
  labelId,
16
15
  disableOpenPicker,
17
16
  onBlur,
18
17
  rangePosition,
19
- onRangePositionChange,
18
+ setRangePosition,
20
19
  localeText: inLocaleText,
21
20
  pickerSlotProps,
22
21
  pickerSlots,
@@ -24,7 +23,6 @@ const useMultiInputFieldSlotProps = ({
24
23
  anchorRef,
25
24
  currentView,
26
25
  initialView,
27
- onViewChange,
28
26
  startFieldRef,
29
27
  endFieldRef
30
28
  }) => {
@@ -33,7 +31,7 @@ const useMultiInputFieldSlotProps = ({
33
31
  const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef);
34
32
  const previousRangePosition = React.useRef(rangePosition);
35
33
  React.useEffect(() => {
36
- if (!open || variant === 'mobile') {
34
+ if (!contextValue.open || variant === 'mobile') {
37
35
  return;
38
36
  }
39
37
  const currentFieldRef = rangePosition === 'start' ? startFieldRef : endFieldRef;
@@ -49,36 +47,36 @@ const useMultiInputFieldSlotProps = ({
49
47
  // use the current view or `0` when the range position has just been swapped
50
48
  previousRangePosition.current === rangePosition ? currentView : 0);
51
49
  previousRangePosition.current = rangePosition;
52
- }, [rangePosition, open, currentView, startFieldRef, endFieldRef, variant]);
50
+ }, [rangePosition, contextValue.open, currentView, startFieldRef, endFieldRef, variant]);
53
51
  const openRangeStartSelection = event => {
54
52
  event.stopPropagation();
55
- onRangePositionChange('start');
53
+ setRangePosition('start');
56
54
  if (!readOnly && !disableOpenPicker) {
57
55
  event.preventDefault();
58
- setOpen(true);
56
+ contextValue.setOpen(true);
59
57
  }
60
58
  };
61
59
  const openRangeEndSelection = event => {
62
60
  event.stopPropagation();
63
- onRangePositionChange('end');
61
+ setRangePosition('end');
64
62
  if (!readOnly && !disableOpenPicker) {
65
63
  event.preventDefault();
66
- setOpen(true);
64
+ contextValue.setOpen(true);
67
65
  }
68
66
  };
69
67
  const handleFocusStart = () => {
70
- if (open) {
71
- onRangePositionChange('start');
68
+ if (contextValue.open) {
69
+ setRangePosition('start');
72
70
  if (previousRangePosition.current !== 'start' && initialView) {
73
- onViewChange?.(initialView);
71
+ contextValue.setView?.(initialView);
74
72
  }
75
73
  }
76
74
  };
77
75
  const handleFocusEnd = () => {
78
- if (open) {
79
- onRangePositionChange('end');
76
+ if (contextValue.open) {
77
+ setRangePosition('end');
80
78
  if (previousRangePosition.current !== 'end' && initialView) {
81
- onViewChange?.(initialView);
79
+ contextValue.setView?.(initialView);
82
80
  }
83
81
  }
84
82
  };
@@ -97,8 +95,8 @@ const useMultiInputFieldSlotProps = ({
97
95
  label: inLocaleText?.start ?? translations.start,
98
96
  onKeyDown: onSpaceOrEnter(openRangeStartSelection),
99
97
  onFocus: handleFocusStart,
100
- focused: open ? rangePosition === 'start' : undefined
101
- }, !readOnly && !fieldProps.disabled && {
98
+ focused: contextValue.open ? rangePosition === 'start' : undefined
99
+ }, !readOnly && !contextValue.disabled && {
102
100
  onClick: openRangeStartSelection
103
101
  }, variant === 'mobile' && {
104
102
  readOnly: true
@@ -113,8 +111,8 @@ const useMultiInputFieldSlotProps = ({
113
111
  label: inLocaleText?.end ?? translations.end,
114
112
  onKeyDown: onSpaceOrEnter(openRangeEndSelection),
115
113
  onFocus: handleFocusEnd,
116
- focused: open ? rangePosition === 'end' : undefined
117
- }, !readOnly && !fieldProps.disabled && {
114
+ focused: contextValue.open ? rangePosition === 'end' : undefined
115
+ }, !readOnly && !contextValue.disabled && {
118
116
  onClick: openRangeEndSelection
119
117
  }, variant === 'mobile' && {
120
118
  readOnly: true
@@ -145,29 +143,29 @@ const useMultiInputFieldSlotProps = ({
145
143
  slots,
146
144
  slotProps
147
145
  });
148
- return enrichedFieldProps;
146
+ return {
147
+ fieldProps: enrichedFieldProps,
148
+ fieldPrivateContextValue: {}
149
+ };
149
150
  };
150
151
  const useSingleInputFieldSlotProps = ({
152
+ contextValue,
153
+ fieldPrivateContextValue,
151
154
  variant,
152
- open,
153
- setOpen,
154
155
  readOnly,
155
156
  labelId,
156
157
  disableOpenPicker,
157
158
  label,
158
159
  onBlur,
159
160
  rangePosition,
160
- onRangePositionChange,
161
+ setRangePosition,
161
162
  singleInputFieldRef,
162
- pickerSlots,
163
- pickerSlotProps,
164
163
  fieldProps,
165
- anchorRef,
166
164
  currentView
167
165
  }) => {
168
166
  const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, singleInputFieldRef);
169
167
  React.useEffect(() => {
170
- if (!open || !singleInputFieldRef.current || variant === 'mobile') {
168
+ if (!contextValue.open || !singleInputFieldRef.current || variant === 'mobile') {
171
169
  return;
172
170
  }
173
171
  if (singleInputFieldRef.current.isFieldFocused()) {
@@ -180,7 +178,7 @@ const useSingleInputFieldSlotProps = ({
180
178
  const newSelectedSection = rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView);
181
179
  singleInputFieldRef.current?.focusField(newSelectedSection);
182
180
  }
183
- }, [rangePosition, open, currentView, singleInputFieldRef, variant]);
181
+ }, [rangePosition, contextValue.open, currentView, singleInputFieldRef, variant]);
184
182
  const updateRangePosition = () => {
185
183
  if (!singleInputFieldRef.current?.isFieldFocused()) {
186
184
  return;
@@ -189,52 +187,41 @@ const useSingleInputFieldSlotProps = ({
189
187
  const activeSectionIndex = singleInputFieldRef.current?.getActiveSectionIndex();
190
188
  const domRangePosition = activeSectionIndex == null || activeSectionIndex < sections.length / 2 ? 'start' : 'end';
191
189
  if (domRangePosition != null && domRangePosition !== rangePosition) {
192
- onRangePositionChange(domRangePosition);
190
+ setRangePosition(domRangePosition);
193
191
  }
194
192
  };
195
193
  const handleSelectedSectionsChange = useEventCallback(selectedSection => {
196
194
  setTimeout(updateRangePosition);
197
- fieldProps.onSelectedSectionsChange?.(selectedSection);
195
+ fieldPrivateContextValue.onSelectedSectionsChange?.(selectedSection);
198
196
  });
199
197
  const openPicker = event => {
200
198
  event.stopPropagation();
201
199
  if (!readOnly && !disableOpenPicker) {
202
200
  event.preventDefault();
203
- setOpen(true);
201
+ contextValue.setOpen(true);
204
202
  }
205
203
  };
206
- const slots = _extends({}, fieldProps.slots, {
207
- textField: pickerSlots?.textField,
208
- clearButton: pickerSlots?.clearButton,
209
- clearIcon: pickerSlots?.clearIcon
210
- });
211
- const slotProps = _extends({}, fieldProps.slotProps, {
212
- textField: pickerSlotProps?.textField,
213
- clearButton: pickerSlotProps?.clearButton,
214
- clearIcon: pickerSlotProps?.clearIcon
215
- });
216
204
  const enrichedFieldProps = _extends({}, fieldProps, {
217
- slots,
218
- slotProps,
219
205
  label,
220
206
  unstableFieldRef: handleFieldRef,
221
207
  onKeyDown: onSpaceOrEnter(openPicker, fieldProps.onKeyDown),
222
- onSelectedSectionsChange: handleSelectedSectionsChange,
223
208
  onBlur,
224
- InputProps: _extends({
225
- ref: anchorRef
226
- }, fieldProps?.InputProps),
227
- focused: open ? true : undefined
209
+ focused: contextValue.open ? true : undefined
228
210
  }, labelId != null && {
229
211
  id: labelId
230
212
  }, variant === 'mobile' && {
231
213
  readOnly: true
232
- }, !readOnly && !fieldProps.disabled && {
214
+ }, !readOnly && !contextValue.disabled && {
233
215
  onClick: openPicker
234
216
  });
235
- return enrichedFieldProps;
217
+ return {
218
+ fieldProps: enrichedFieldProps,
219
+ fieldPrivateContextValue: {
220
+ onSelectedSectionsChange: handleSelectedSectionsChange
221
+ }
222
+ };
236
223
  };
237
- export const useEnrichedRangePickerFieldProps = params => {
224
+ export const useEnrichedRangePickerField = params => {
238
225
  /* eslint-disable react-hooks/rules-of-hooks */
239
226
  if (process.env.NODE_ENV !== 'production') {
240
227
  const fieldTypeRef = React.useRef(params.fieldType);
@@ -5,12 +5,13 @@ import * as React from 'react';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
6
  import { useLicenseVerifier } from '@mui/x-license';
7
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
- import { usePicker, PickersModalDialog, PickerProvider } from '@mui/x-date-pickers/internals';
8
+ import { usePicker, PickersModalDialog, PickerProvider, PickerFieldUIContextProvider } from '@mui/x-date-pickers/internals';
9
9
  import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
10
10
  import useId from '@mui/utils/useId';
11
- import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
11
+ import { useEnrichedRangePickerField } from "../useEnrichedRangePickerField.js";
12
12
  import { getReleaseInfo } from "../../utils/releaseInfo.js";
13
13
  import { useRangePosition } from "../useRangePosition.js";
14
+ import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const releaseInfo = getReleaseInfo();
16
17
  export const useMobileRangePicker = _ref => {
@@ -24,17 +25,10 @@ export const useMobileRangePicker = _ref => {
24
25
  slotProps: innerSlotProps,
25
26
  className,
26
27
  sx,
27
- format,
28
- formatDensity,
29
- enableAccessibleFieldDOMStructure,
30
- selectedSections,
31
- onSelectedSectionsChange,
32
- timezone,
33
28
  label,
34
29
  inputRef,
35
30
  name,
36
31
  readOnly,
37
- disabled,
38
32
  disableOpenPicker,
39
33
  localeText
40
34
  } = props;
@@ -42,37 +36,31 @@ export const useMobileRangePicker = _ref => {
42
36
  const endFieldRef = React.useRef(null);
43
37
  const singleInputFieldRef = React.useRef(null);
44
38
  const fieldType = slots.field.fieldType ?? 'multi-input';
45
- const {
46
- rangePosition,
47
- onRangePositionChange
48
- } = useRangePosition(props, fieldType === 'single-input' ? singleInputFieldRef : undefined);
39
+ const rangePositionResponse = useRangePosition(props, fieldType === 'single-input' ? singleInputFieldRef : undefined);
49
40
  const labelId = useId();
50
41
  const contextTranslations = usePickerTranslations();
51
42
  let fieldRef;
52
43
  if (fieldType === 'single-input') {
53
44
  fieldRef = singleInputFieldRef;
54
- } else if (rangePosition === 'start') {
45
+ } else if (rangePositionResponse.rangePosition === 'start') {
55
46
  fieldRef = startFieldRef;
56
47
  } else {
57
48
  fieldRef = endFieldRef;
58
49
  }
59
50
  const {
60
- layoutProps,
61
51
  providerProps,
62
52
  renderCurrentView,
63
- fieldProps: pickerFieldProps,
64
53
  ownerState
65
54
  } = usePicker(_extends({}, pickerParams, {
66
55
  props,
67
56
  variant: 'mobile',
68
57
  autoFocusView: true,
69
58
  fieldRef,
70
- localeText,
71
- additionalViewProps: {
72
- rangePosition,
73
- onRangePositionChange
74
- }
59
+ localeText
75
60
  }));
61
+
62
+ // Temporary hack to hide the opening button on the range pickers until we have migrate them to the new opening logic.
63
+ providerProps.contextValue.triggerStatus = 'hidden';
76
64
  const Field = slots.field;
77
65
  const fieldProps = useSlotProps({
78
66
  elementType: Field,
@@ -80,16 +68,6 @@ export const useMobileRangePicker = _ref => {
80
68
  additionalProps: _extends({
81
69
  // Internal props
82
70
  readOnly: readOnly ?? true,
83
- disabled,
84
- format,
85
- formatDensity,
86
- enableAccessibleFieldDOMStructure,
87
- selectedSections,
88
- onSelectedSectionsChange,
89
- timezone
90
- }, pickerFieldProps, {
91
- // onChange and value
92
-
93
71
  // Forwarded props
94
72
  className,
95
73
  sx
@@ -101,37 +79,24 @@ export const useMobileRangePicker = _ref => {
101
79
  ownerState
102
80
  });
103
81
  const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
104
- const enrichedFieldProps = useEnrichedRangePickerFieldProps({
82
+ const enrichedFieldResponse = useEnrichedRangePickerField(_extends({
105
83
  variant: 'mobile',
106
84
  fieldType,
107
85
  // These direct access to `providerProps` will go away once the range fields handle the picker opening
108
- open: providerProps.contextValue.open,
109
- setOpen: providerProps.contextValue.setOpen,
86
+ contextValue: providerProps.contextValue,
87
+ fieldPrivateContextValue: providerProps.fieldPrivateContextValue,
110
88
  readOnly,
111
89
  labelId,
112
90
  disableOpenPicker,
113
91
  label,
114
92
  localeText,
115
- rangePosition,
116
- onRangePositionChange,
117
93
  pickerSlots: slots,
118
94
  pickerSlotProps: innerSlotProps,
119
95
  fieldProps,
120
96
  startFieldRef,
121
97
  endFieldRef,
122
98
  singleInputFieldRef
123
- });
124
- const slotPropsForLayout = _extends({}, innerSlotProps, {
125
- tabs: _extends({}, innerSlotProps?.tabs, {
126
- rangePosition,
127
- onRangePositionChange
128
- }),
129
- toolbar: _extends({}, innerSlotProps?.toolbar, {
130
- titleId: labelId,
131
- rangePosition,
132
- onRangePositionChange
133
- })
134
- });
99
+ }, rangePositionResponse));
135
100
  const Layout = slots?.layout ?? PickersLayout;
136
101
  const finalLocaleText = _extends({}, contextTranslations, localeText);
137
102
  let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
@@ -150,20 +115,32 @@ export const useMobileRangePicker = _ref => {
150
115
  labelledById = labels.length > 0 ? labels.join(' ') : undefined;
151
116
  }
152
117
  const slotProps = _extends({}, innerSlotProps, {
118
+ toolbar: _extends({}, innerSlotProps?.toolbar, {
119
+ titleId: labelId
120
+ }),
153
121
  mobilePaper: _extends({
154
122
  'aria-labelledby': labelledById
155
123
  }, innerSlotProps?.mobilePaper)
156
124
  });
157
- const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
158
- children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, {
125
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
126
+ // This override will go away once the range fields handle the picker opening
127
+ fieldPrivateContextValue: _extends({}, providerProps.fieldPrivateContextValue, enrichedFieldResponse.fieldPrivateContextValue),
128
+ children: /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
159
129
  slots: slots,
160
130
  slotProps: slotProps,
161
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
162
- slots: slots,
163
- slotProps: slotPropsForLayout,
164
- children: renderCurrentView()
165
- }))
166
- })]
131
+ children: /*#__PURE__*/_jsxs(PickerRangePositionContext.Provider, {
132
+ value: rangePositionResponse,
133
+ children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldResponse.fieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, {
134
+ slots: slots,
135
+ slotProps: slotProps,
136
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
137
+ slots: slots,
138
+ slotProps: slotProps,
139
+ children: renderCurrentView()
140
+ }))
141
+ })]
142
+ })
143
+ })
167
144
  }));
168
145
  return {
169
146
  renderPicker
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { PickerRangePositionContext } from "../../hooks/usePickerRangePositionContext.js";
3
+
4
+ /**
5
+ * Returns information about the range position of the picker that wraps the current component.
6
+ * If no picker wraps the current component, returns `null`.
7
+ */
8
+ export function useNullablePickerRangePositionContext() {
9
+ return React.useContext(PickerRangePositionContext);
10
+ }
@@ -25,6 +25,6 @@ export const useRangePosition = (props, singleInputFieldRef) => {
25
25
  });
26
26
  return {
27
27
  rangePosition,
28
- onRangePositionChange: handleRangePositionChange
28
+ setRangePosition: handleRangePositionChange
29
29
  };
30
30
  };
@@ -7,6 +7,7 @@ import { styled } from '@mui/material/styles';
7
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
8
  import { usePicker, DIALOG_WIDTH, PickerProvider } from '@mui/x-date-pickers/internals';
9
9
  import { useRangePosition } from "../useRangePosition.js";
10
+ import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  const PickerStaticLayout = styled(PickersLayout)(({
12
13
  theme
@@ -35,12 +36,8 @@ export const useStaticRangePicker = _ref => {
35
36
  displayStaticWrapperAs,
36
37
  autoFocus
37
38
  } = props;
39
+ const rangePositionResponse = useRangePosition(props);
38
40
  const {
39
- rangePosition,
40
- onRangePositionChange
41
- } = useRangePosition(props);
42
- const {
43
- layoutProps,
44
41
  providerProps,
45
42
  renderCurrentView
46
43
  } = usePicker(_extends({}, pickerParams, {
@@ -48,29 +45,22 @@ export const useStaticRangePicker = _ref => {
48
45
  autoFocusView: autoFocus ?? false,
49
46
  fieldRef: undefined,
50
47
  localeText,
51
- additionalViewProps: {
52
- rangePosition,
53
- onRangePositionChange
54
- },
55
48
  variant: displayStaticWrapperAs
56
49
  }));
57
50
  const Layout = slots?.layout ?? PickerStaticLayout;
58
- const slotPropsForLayout = _extends({}, slotProps, {
59
- toolbar: _extends({}, slotProps?.toolbar, {
60
- rangePosition,
61
- onRangePositionChange
62
- })
63
- });
64
- const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
65
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
66
- slots: slots,
67
- slotProps: slotPropsForLayout,
68
- sx: [...(Array.isArray(sx) ? sx : [sx]), ...(Array.isArray(slotProps?.layout?.sx) ? slotProps.layout.sx : [slotProps?.layout?.sx])],
69
- className: clsx(className, slotProps?.layout?.className),
70
- ref: ref,
71
- children: renderCurrentView()
51
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerRangePositionContext.Provider, {
52
+ value: rangePositionResponse,
53
+ children: /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
54
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
55
+ slots: slots,
56
+ slotProps: slotProps,
57
+ sx: [...(Array.isArray(sx) ? sx : [sx]), ...(Array.isArray(slotProps?.layout?.sx) ? slotProps.layout.sx : [slotProps?.layout?.sx])],
58
+ className: clsx(className, slotProps?.layout?.className),
59
+ ref: ref,
60
+ children: renderCurrentView()
61
+ }))
72
62
  }))
73
- }));
63
+ });
74
64
  return {
75
65
  renderPicker
76
66
  };
@@ -1,4 +1,3 @@
1
1
  export * from "./dateRange.js";
2
2
  export * from "./dateTimeRange.js";
3
- export * from "./timeRange.js";
4
3
  export * from "./rangePickerProps.js";