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

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 (294) 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 +2007 -230
  8. package/DateRangeCalendar/DateRangeCalendar.js +73 -46
  9. package/DateRangePicker/DateRangePicker.js +1 -4
  10. package/DateRangePicker/DateRangePicker.types.d.ts +6 -2
  11. package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
  12. package/DateRangePicker/DateRangePickerToolbar.js +33 -41
  13. package/DateRangePicker/shared.d.ts +4 -3
  14. package/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
  15. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +1 -2
  16. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +4 -5
  17. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +35 -33
  18. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
  19. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  20. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -5
  21. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +81 -109
  22. package/DateTimeRangePicker/shared.d.ts +6 -5
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
  24. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +7 -2
  25. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
  26. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +2 -3
  27. package/MobileDateRangePicker/MobileDateRangePicker.js +6 -8
  28. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +2 -2
  29. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -16
  30. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +2 -3
  31. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +9 -4
  32. package/MultiInputDateRangeField/MultiInputDateRangeField.js +15 -121
  33. package/MultiInputDateRangeField/index.d.ts +5 -3
  34. package/MultiInputDateRangeField/index.js +2 -2
  35. package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.d.ts +6 -0
  36. package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
  37. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +9 -4
  38. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +15 -121
  39. package/MultiInputDateTimeRangeField/index.d.ts +5 -3
  40. package/MultiInputDateTimeRangeField/index.js +2 -2
  41. package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.d.ts +6 -0
  42. package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
  43. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +9 -4
  44. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -122
  45. package/MultiInputTimeRangeField/index.d.ts +5 -3
  46. package/MultiInputTimeRangeField/index.js +2 -2
  47. package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.d.ts +6 -0
  48. package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
  49. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  50. package/README.md +8 -5
  51. package/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -33
  52. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +6 -16
  53. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  54. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
  55. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +23 -33
  56. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +6 -17
  57. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  58. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
  59. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +23 -33
  60. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +6 -17
  61. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  62. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
  63. package/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  64. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +2 -2
  65. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  66. package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  67. package/hooks/index.d.ts +2 -0
  68. package/hooks/index.js +2 -0
  69. package/hooks/package.json +6 -0
  70. package/hooks/useMultiInputRangeField/index.d.ts +1 -0
  71. package/hooks/useMultiInputRangeField/index.js +1 -0
  72. package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +53 -0
  73. package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
  74. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +17 -0
  75. package/{modern/internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
  76. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +17 -0
  77. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
  78. package/hooks/usePickerRangePositionContext.d.ts +7 -0
  79. package/hooks/usePickerRangePositionContext.js +15 -0
  80. package/index.d.ts +2 -0
  81. package/index.js +4 -2
  82. package/internals/hooks/models/index.d.ts +1 -1
  83. package/internals/hooks/models/useRangePicker.d.ts +8 -11
  84. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +68 -100
  85. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +8 -10
  86. package/internals/hooks/{useEnrichedRangePickerFieldProps.d.ts → useEnrichedRangePickerField.d.ts} +25 -16
  87. package/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +50 -63
  88. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +57 -80
  89. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -9
  90. package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
  91. package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  92. package/internals/hooks/useRangePosition.d.ts +4 -3
  93. package/internals/hooks/useRangePosition.js +1 -1
  94. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -1
  95. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +17 -30
  96. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -12
  97. package/internals/models/dateTimeRange.d.ts +1 -6
  98. package/internals/models/fields.d.ts +7 -11
  99. package/internals/models/index.d.ts +0 -1
  100. package/internals/models/index.js +0 -1
  101. package/internals/models/managers.d.ts +3 -0
  102. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.d.ts +3 -0
  103. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +136 -0
  104. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +72 -0
  105. package/internals/utils/createMultiInputRangeField/index.d.ts +3 -0
  106. package/internals/utils/createMultiInputRangeField/index.js +2 -0
  107. package/internals/utils/date-fields-utils.d.ts +6 -6
  108. package/internals/utils/date-range-manager.js +2 -1
  109. package/internals/utils/releaseInfo.js +1 -1
  110. package/internals/utils/valueManagers.d.ts +4 -3
  111. package/internals/utils/valueManagers.js +7 -7
  112. package/managers/index.d.ts +6 -0
  113. package/managers/index.js +3 -0
  114. package/managers/package.json +6 -0
  115. package/managers/useDateRangeManager.d.ts +15 -0
  116. package/managers/useDateRangeManager.js +33 -0
  117. package/managers/useDateTimeRangeManager.d.ts +15 -0
  118. package/managers/useDateTimeRangeManager.js +33 -0
  119. package/managers/useTimeRangeManager.d.ts +15 -0
  120. package/managers/useTimeRangeManager.js +31 -0
  121. package/models/fields.d.ts +7 -11
  122. package/models/index.d.ts +1 -2
  123. package/models/index.js +1 -2
  124. package/models/range.d.ts +0 -2
  125. package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  126. package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  127. package/modern/DateRangeCalendar/DateRangeCalendar.js +73 -46
  128. package/modern/DateRangePicker/DateRangePicker.js +1 -4
  129. package/modern/DateRangePicker/DateRangePickerToolbar.js +33 -41
  130. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
  131. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +35 -33
  132. package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  133. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +81 -109
  134. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
  135. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
  136. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +6 -8
  137. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -16
  138. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +15 -121
  139. package/modern/MultiInputDateRangeField/index.js +2 -2
  140. package/modern/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
  141. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +15 -121
  142. package/modern/MultiInputDateTimeRangeField/index.js +2 -2
  143. package/modern/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
  144. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -122
  145. package/modern/MultiInputTimeRangeField/index.js +2 -2
  146. package/modern/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
  147. package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  148. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -33
  149. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
  150. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +23 -33
  151. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
  152. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +23 -33
  153. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
  154. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  155. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  156. package/modern/hooks/index.js +2 -0
  157. package/modern/hooks/useMultiInputRangeField/index.js +1 -0
  158. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
  159. package/{internals/hooks/useMultiInputFieldSelectedSections.js → modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
  160. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
  161. package/modern/hooks/usePickerRangePositionContext.js +15 -0
  162. package/modern/index.js +4 -2
  163. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +68 -100
  164. package/modern/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +50 -63
  165. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +57 -80
  166. package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  167. package/modern/internals/hooks/useRangePosition.js +1 -1
  168. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +17 -30
  169. package/modern/internals/models/index.js +0 -1
  170. package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +136 -0
  171. package/modern/internals/utils/createMultiInputRangeField/index.js +2 -0
  172. package/modern/internals/utils/date-range-manager.js +2 -1
  173. package/modern/internals/utils/releaseInfo.js +1 -1
  174. package/modern/internals/utils/valueManagers.js +7 -7
  175. package/modern/managers/index.js +3 -0
  176. package/modern/managers/useDateRangeManager.js +33 -0
  177. package/modern/managers/useDateTimeRangeManager.js +33 -0
  178. package/modern/managers/useTimeRangeManager.js +31 -0
  179. package/modern/models/index.js +1 -2
  180. package/modern/validation/validateDateRange.js +8 -0
  181. package/modern/validation/validateDateTimeRange.js +4 -0
  182. package/modern/validation/validateTimeRange.js +8 -0
  183. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  184. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  185. package/node/DateRangeCalendar/DateRangeCalendar.js +72 -45
  186. package/node/DateRangePicker/DateRangePicker.js +1 -4
  187. package/node/DateRangePicker/DateRangePickerToolbar.js +31 -39
  188. package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
  189. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +33 -31
  190. package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  191. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +80 -108
  192. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
  193. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
  194. package/node/MobileDateRangePicker/MobileDateRangePicker.js +6 -8
  195. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -16
  196. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -124
  197. package/node/MultiInputDateRangeField/index.js +3 -9
  198. package/node/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +12 -0
  199. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -124
  200. package/node/MultiInputDateTimeRangeField/index.js +3 -9
  201. package/node/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +12 -0
  202. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +15 -125
  203. package/node/MultiInputTimeRangeField/index.js +3 -9
  204. package/node/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +12 -0
  205. package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  206. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +22 -32
  207. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  208. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +22 -32
  209. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  210. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +22 -32
  211. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  212. package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  213. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  214. package/node/hooks/index.js +19 -0
  215. package/node/hooks/useMultiInputRangeField/index.js +12 -0
  216. package/node/hooks/useMultiInputRangeField/useMultiInputRangeField.js +155 -0
  217. package/node/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +11 -10
  218. package/node/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +66 -0
  219. package/node/hooks/usePickerRangePositionContext.js +22 -0
  220. package/node/index.js +23 -1
  221. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +68 -100
  222. package/node/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +52 -65
  223. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +57 -80
  224. package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
  225. package/node/internals/hooks/useRangePosition.js +1 -1
  226. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +16 -29
  227. package/node/internals/models/index.js +0 -11
  228. package/node/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +143 -0
  229. package/node/internals/utils/createMultiInputRangeField/index.js +19 -0
  230. package/node/internals/utils/date-range-manager.js +2 -1
  231. package/node/internals/utils/releaseInfo.js +1 -1
  232. package/node/internals/utils/valueManagers.js +7 -7
  233. package/node/managers/index.js +26 -0
  234. package/node/managers/useDateRangeManager.js +40 -0
  235. package/node/managers/useDateTimeRangeManager.js +40 -0
  236. package/node/managers/useTimeRangeManager.js +38 -0
  237. package/node/models/index.js +0 -22
  238. package/node/validation/validateDateRange.js +8 -0
  239. package/node/validation/validateDateTimeRange.js +4 -0
  240. package/node/validation/validateTimeRange.js +8 -0
  241. package/package.json +6 -6
  242. package/themeAugmentation/overrides.d.ts +6 -4
  243. package/themeAugmentation/props.d.ts +2 -2
  244. package/validation/validateDateRange.d.ts +9 -1
  245. package/validation/validateDateRange.js +8 -0
  246. package/validation/validateDateTimeRange.d.ts +6 -2
  247. package/validation/validateDateTimeRange.js +4 -0
  248. package/validation/validateTimeRange.d.ts +9 -1
  249. package/validation/validateTimeRange.js +8 -0
  250. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +0 -53
  251. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +0 -54
  252. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +0 -54
  253. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +0 -21
  254. package/internals/hooks/useMultiInputRangeField/shared.d.ts +0 -1
  255. package/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  256. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +0 -3
  257. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
  258. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +0 -3
  259. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
  260. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +0 -11
  261. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +0 -3
  262. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
  263. package/internals/models/timeRange.d.ts +0 -6
  264. package/internals/models/timeRange.js +0 -1
  265. package/models/dateRange.d.ts +0 -7
  266. package/models/dateRange.js +0 -1
  267. package/models/multiInputRangeFieldClasses.d.ts +0 -7
  268. package/models/multiInputRangeFieldClasses.js +0 -1
  269. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  270. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  271. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  272. package/modern/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  273. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
  274. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
  275. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  276. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
  277. package/modern/internals/models/timeRange.js +0 -1
  278. package/modern/models/dateRange.js +0 -1
  279. package/modern/models/multiInputRangeFieldClasses.js +0 -1
  280. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -5
  281. package/node/internals/hooks/useMultiInputRangeField/shared.js +0 -16
  282. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -121
  283. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -121
  284. package/node/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -5
  285. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -121
  286. package/node/internals/models/timeRange.js +0 -5
  287. package/node/models/dateRange.js +0 -5
  288. package/node/models/multiInputRangeFieldClasses.js +0 -5
  289. /package/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
  290. /package/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
  291. /package/{MultiInputTimeRangeField/MultiInputTimeRangeField.types.js → modern/internals/models/managers.js} +0 -0
  292. /package/{internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js → modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
  293. /package/node/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
  294. /package/node/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
@@ -3,12 +3,12 @@ import Stack, { StackProps } from '@mui/material/Stack';
3
3
  import Typography, { TypographyProps } from '@mui/material/Typography';
4
4
  import { SlotComponentProps } from '@mui/utils';
5
5
  import { SlotComponentPropsFromProps } from '@mui/x-internals/types';
6
- import { FieldRef, PickerOwnerState } from '@mui/x-date-pickers/models';
6
+ import { FieldSelectedSections, FieldRef, PickerOwnerState, FieldOwnerState } from '@mui/x-date-pickers/models';
7
7
  import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
8
8
  import { PickersInputLocaleText } from '@mui/x-date-pickers/locales';
9
- import { UsePickerResponse, PickerVariant, DateOrTimeViewWithMeridiem, BaseSingleInputFieldProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
9
+ import { PickerVariant, DateOrTimeViewWithMeridiem, BaseSingleInputFieldProps, PickerRangeValue, PickerValue, PickerContextValue, PickerFieldPrivateContextValue } from '@mui/x-date-pickers/internals';
10
10
  import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
11
- import { RangeFieldSection, RangePosition, FieldType, UseDateRangeFieldProps, PickerRangeFieldSlotProps } from '../../models';
11
+ import { RangePosition, FieldType, PickerRangeFieldSlotProps } from '../../models';
12
12
  import { UseRangePositionResponse } from './useRangePosition';
13
13
  import { BaseMultiInputFieldProps } from '../models/fields';
14
14
  export interface RangePickerFieldSlots extends UseClearableFieldSlots {
@@ -31,31 +31,40 @@ export interface RangePickerFieldSlots extends UseClearableFieldSlots {
31
31
  textField?: React.ElementType;
32
32
  }
33
33
  export interface RangePickerFieldSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
34
- field?: SlotComponentPropsFromProps<PickerRangeFieldSlotProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
35
- fieldRoot?: SlotComponentProps<typeof Stack, {}, Record<string, any>>;
36
- fieldSeparator?: SlotComponentProps<typeof Typography, {}, Record<string, any>>;
37
- textField?: SlotComponentProps<typeof PickersTextField, {}, UseDateRangeFieldProps<TEnableAccessibleFieldDOMStructure> & {
34
+ field?: SlotComponentPropsFromProps<PickerRangeFieldSlotProps<TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
35
+ fieldRoot?: SlotComponentProps<typeof Stack, {}, FieldOwnerState>;
36
+ fieldSeparator?: SlotComponentProps<typeof Typography, {}, FieldOwnerState>;
37
+ textField?: SlotComponentProps<typeof PickersTextField, {}, FieldOwnerState & {
38
38
  position?: RangePosition;
39
39
  }>;
40
40
  }
41
- export type RangePickerPropsForFieldSlot<TIsSingleInput extends boolean, TEnableAccessibleFieldDOMStructure extends boolean, TError> = (TIsSingleInput extends true ? BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> : never) | (TIsSingleInput extends false ? BaseMultiInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> : never);
42
- export interface UseEnrichedRangePickerFieldPropsParams<TIsSingleInput extends boolean, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Pick<UsePickerResponse<PickerRangeValue, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
41
+ export type RangePickerPropsForFieldSlot<TIsSingleInput extends boolean> = (TIsSingleInput extends true ? BaseSingleInputFieldProps<PickerRangeValue> : never) | (TIsSingleInput extends false ? BaseMultiInputFieldProps : never);
42
+ export interface UseEnrichedRangePickerFieldPropsParams<TIsSingleInput extends boolean, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends UseRangePositionResponse {
43
+ contextValue: PickerContextValue<PickerRangeValue, TView, TError>;
44
+ fieldPrivateContextValue: PickerFieldPrivateContextValue;
43
45
  variant: PickerVariant;
44
46
  fieldType: FieldType;
45
47
  readOnly?: boolean;
46
48
  labelId?: string;
47
49
  disableOpenPicker?: boolean;
48
50
  onBlur?: () => void;
49
- label?: React.ReactNode;
50
51
  localeText: PickersInputLocaleText | undefined;
51
52
  pickerSlotProps: RangePickerFieldSlotProps<TEnableAccessibleFieldDOMStructure> | undefined;
52
53
  pickerSlots: RangePickerFieldSlots | undefined;
53
- fieldProps: RangePickerPropsForFieldSlot<TIsSingleInput, TEnableAccessibleFieldDOMStructure, TError>;
54
- anchorRef?: React.Ref<HTMLDivElement>;
54
+ fieldProps: RangePickerPropsForFieldSlot<TIsSingleInput>;
55
+ anchorRef?: React.Ref<HTMLElement>;
55
56
  currentView?: TView | null;
56
57
  initialView?: TView;
57
- onViewChange?: (view: TView) => void;
58
- startFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
59
- endFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
58
+ startFieldRef: React.RefObject<FieldRef<PickerValue> | null>;
59
+ endFieldRef: React.RefObject<FieldRef<PickerValue> | null>;
60
+ singleInputFieldRef: React.RefObject<FieldRef<PickerRangeValue> | null>;
60
61
  }
61
- export declare const useEnrichedRangePickerFieldProps: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError>(params: UseEnrichedRangePickerFieldPropsParams<boolean, TView, TEnableAccessibleFieldDOMStructure, TError>) => BaseMultiInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> | BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>;
62
+ export declare const useEnrichedRangePickerField: <TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError>(params: UseEnrichedRangePickerFieldPropsParams<boolean, TView, TEnableAccessibleFieldDOMStructure, TError>) => {
63
+ fieldProps: BaseMultiInputFieldProps;
64
+ fieldPrivateContextValue: {};
65
+ } | {
66
+ fieldProps: BaseSingleInputFieldProps<PickerRangeValue>;
67
+ fieldPrivateContextValue: {
68
+ onSelectedSectionsChange: (selectedSection: FieldSelectedSections) => void;
69
+ };
70
+ };
@@ -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
- actions,
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,34 +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
- actions.onOpen(event);
55
+ event.preventDefault();
56
+ contextValue.setOpen(true);
58
57
  }
59
58
  };
60
59
  const openRangeEndSelection = event => {
61
60
  event.stopPropagation();
62
- onRangePositionChange('end');
61
+ setRangePosition('end');
63
62
  if (!readOnly && !disableOpenPicker) {
64
- actions.onOpen(event);
63
+ event.preventDefault();
64
+ contextValue.setOpen(true);
65
65
  }
66
66
  };
67
67
  const handleFocusStart = () => {
68
- if (open) {
69
- onRangePositionChange('start');
68
+ if (contextValue.open) {
69
+ setRangePosition('start');
70
70
  if (previousRangePosition.current !== 'start' && initialView) {
71
- onViewChange?.(initialView);
71
+ contextValue.setView?.(initialView);
72
72
  }
73
73
  }
74
74
  };
75
75
  const handleFocusEnd = () => {
76
- if (open) {
77
- onRangePositionChange('end');
76
+ if (contextValue.open) {
77
+ setRangePosition('end');
78
78
  if (previousRangePosition.current !== 'end' && initialView) {
79
- onViewChange?.(initialView);
79
+ contextValue.setView?.(initialView);
80
80
  }
81
81
  }
82
82
  };
@@ -95,8 +95,8 @@ const useMultiInputFieldSlotProps = ({
95
95
  label: inLocaleText?.start ?? translations.start,
96
96
  onKeyDown: onSpaceOrEnter(openRangeStartSelection),
97
97
  onFocus: handleFocusStart,
98
- focused: open ? rangePosition === 'start' : undefined
99
- }, !readOnly && !fieldProps.disabled && {
98
+ focused: contextValue.open ? rangePosition === 'start' : undefined
99
+ }, !readOnly && !contextValue.disabled && {
100
100
  onClick: openRangeStartSelection
101
101
  }, variant === 'mobile' && {
102
102
  readOnly: true
@@ -111,8 +111,8 @@ const useMultiInputFieldSlotProps = ({
111
111
  label: inLocaleText?.end ?? translations.end,
112
112
  onKeyDown: onSpaceOrEnter(openRangeEndSelection),
113
113
  onFocus: handleFocusEnd,
114
- focused: open ? rangePosition === 'end' : undefined
115
- }, !readOnly && !fieldProps.disabled && {
114
+ focused: contextValue.open ? rangePosition === 'end' : undefined
115
+ }, !readOnly && !contextValue.disabled && {
116
116
  onClick: openRangeEndSelection
117
117
  }, variant === 'mobile' && {
118
118
  readOnly: true
@@ -143,96 +143,83 @@ const useMultiInputFieldSlotProps = ({
143
143
  slots,
144
144
  slotProps
145
145
  });
146
- return enrichedFieldProps;
146
+ return {
147
+ fieldProps: enrichedFieldProps,
148
+ fieldPrivateContextValue: {}
149
+ };
147
150
  };
148
151
  const useSingleInputFieldSlotProps = ({
152
+ contextValue,
153
+ fieldPrivateContextValue,
149
154
  variant,
150
- open,
151
- actions,
152
155
  readOnly,
153
156
  labelId,
154
157
  disableOpenPicker,
155
- label,
156
158
  onBlur,
157
159
  rangePosition,
158
- onRangePositionChange,
159
- startFieldRef,
160
- endFieldRef,
161
- pickerSlots,
162
- pickerSlotProps,
160
+ setRangePosition,
161
+ singleInputFieldRef,
163
162
  fieldProps,
164
- anchorRef,
165
163
  currentView
166
164
  }) => {
167
- const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, startFieldRef, endFieldRef);
165
+ const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, singleInputFieldRef);
168
166
  React.useEffect(() => {
169
- if (!open || !startFieldRef.current || variant === 'mobile') {
167
+ if (!contextValue.open || !singleInputFieldRef.current || variant === 'mobile') {
170
168
  return;
171
169
  }
172
- if (startFieldRef.current.isFieldFocused()) {
170
+ if (singleInputFieldRef.current.isFieldFocused()) {
173
171
  return;
174
172
  }
175
173
 
176
174
  // bring back focus to the field with the current view section selected
177
175
  if (currentView) {
178
- const sections = startFieldRef.current.getSections().map(section => section.type);
176
+ const sections = singleInputFieldRef.current.getSections().map(section => section.type);
179
177
  const newSelectedSection = rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView);
180
- startFieldRef.current?.focusField(newSelectedSection);
178
+ singleInputFieldRef.current?.focusField(newSelectedSection);
181
179
  }
182
- }, [rangePosition, open, currentView, startFieldRef, variant]);
180
+ }, [rangePosition, contextValue.open, currentView, singleInputFieldRef, variant]);
183
181
  const updateRangePosition = () => {
184
- if (!startFieldRef.current?.isFieldFocused()) {
182
+ if (!singleInputFieldRef.current?.isFieldFocused()) {
185
183
  return;
186
184
  }
187
- const sections = startFieldRef.current.getSections();
188
- const activeSectionIndex = startFieldRef.current?.getActiveSectionIndex();
185
+ const sections = singleInputFieldRef.current.getSections();
186
+ const activeSectionIndex = singleInputFieldRef.current?.getActiveSectionIndex();
189
187
  const domRangePosition = activeSectionIndex == null || activeSectionIndex < sections.length / 2 ? 'start' : 'end';
190
188
  if (domRangePosition != null && domRangePosition !== rangePosition) {
191
- onRangePositionChange(domRangePosition);
189
+ setRangePosition(domRangePosition);
192
190
  }
193
191
  };
194
192
  const handleSelectedSectionsChange = useEventCallback(selectedSection => {
195
193
  setTimeout(updateRangePosition);
196
- fieldProps.onSelectedSectionsChange?.(selectedSection);
194
+ fieldPrivateContextValue.onSelectedSectionsChange?.(selectedSection);
197
195
  });
198
196
  const openPicker = event => {
199
197
  event.stopPropagation();
200
198
  if (!readOnly && !disableOpenPicker) {
201
- actions.onOpen(event);
199
+ event.preventDefault();
200
+ contextValue.setOpen(true);
202
201
  }
203
202
  };
204
- const slots = _extends({}, fieldProps.slots, {
205
- textField: pickerSlots?.textField,
206
- clearButton: pickerSlots?.clearButton,
207
- clearIcon: pickerSlots?.clearIcon
208
- });
209
- const slotProps = _extends({}, fieldProps.slotProps, {
210
- textField: pickerSlotProps?.textField,
211
- clearButton: pickerSlotProps?.clearButton,
212
- clearIcon: pickerSlotProps?.clearIcon
213
- });
214
203
  const enrichedFieldProps = _extends({}, fieldProps, {
215
- slots,
216
- slotProps,
217
- label,
218
204
  unstableFieldRef: handleFieldRef,
219
205
  onKeyDown: onSpaceOrEnter(openPicker, fieldProps.onKeyDown),
220
- onSelectedSectionsChange: handleSelectedSectionsChange,
221
206
  onBlur,
222
- InputProps: _extends({
223
- ref: anchorRef
224
- }, fieldProps?.InputProps),
225
- focused: open ? true : undefined
207
+ focused: contextValue.open ? true : undefined
226
208
  }, labelId != null && {
227
209
  id: labelId
228
210
  }, variant === 'mobile' && {
229
211
  readOnly: true
230
- }, !readOnly && !fieldProps.disabled && {
212
+ }, !readOnly && !contextValue.disabled && {
231
213
  onClick: openPicker
232
214
  });
233
- return enrichedFieldProps;
215
+ return {
216
+ fieldProps: enrichedFieldProps,
217
+ fieldPrivateContextValue: {
218
+ onSelectedSectionsChange: handleSelectedSectionsChange
219
+ }
220
+ };
234
221
  };
235
- export const useEnrichedRangePickerFieldProps = params => {
222
+ export const useEnrichedRangePickerField = params => {
236
223
  /* eslint-disable react-hooks/rules-of-hooks */
237
224
  if (process.env.NODE_ENV !== 'production') {
238
225
  const fieldTypeRef = React.useRef(params.fieldType);
@@ -1,16 +1,18 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["props"];
3
+ const _excluded = ["props"],
4
+ _excluded2 = ["ownerState"];
4
5
  import * as React from 'react';
5
6
  import useSlotProps from '@mui/utils/useSlotProps';
6
7
  import { useLicenseVerifier } from '@mui/x-license';
7
8
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
- import { usePicker, PickersModalDialog, PickerProvider } from '@mui/x-date-pickers/internals';
9
+ import { usePicker, PickersModalDialog, PickerProvider, PickerFieldUIContextProvider } from '@mui/x-date-pickers/internals';
9
10
  import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
10
11
  import useId from '@mui/utils/useId';
11
- import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
12
+ import { useEnrichedRangePickerField } from "../useEnrichedRangePickerField.js";
12
13
  import { getReleaseInfo } from "../../utils/releaseInfo.js";
13
14
  import { useRangePosition } from "../useRangePosition.js";
15
+ import { PickerRangePositionContext } from "../../../hooks/usePickerRangePositionContext.js";
14
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
17
  const releaseInfo = getReleaseInfo();
16
18
  export const useMobileRangePicker = _ref => {
@@ -22,107 +24,70 @@ export const useMobileRangePicker = _ref => {
22
24
  const {
23
25
  slots,
24
26
  slotProps: innerSlotProps,
25
- className,
26
- sx,
27
- format,
28
- formatDensity,
29
- enableAccessibleFieldDOMStructure,
30
- selectedSections,
31
- onSelectedSectionsChange,
32
- timezone,
33
27
  label,
34
28
  inputRef,
35
- name,
36
29
  readOnly,
37
- disabled,
38
30
  disableOpenPicker,
39
31
  localeText
40
32
  } = props;
41
33
  const startFieldRef = React.useRef(null);
42
34
  const endFieldRef = React.useRef(null);
35
+ const singleInputFieldRef = React.useRef(null);
43
36
  const fieldType = slots.field.fieldType ?? 'multi-input';
44
- const {
45
- rangePosition,
46
- onRangePositionChange
47
- } = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
37
+ const rangePositionResponse = useRangePosition(props, fieldType === 'single-input' ? singleInputFieldRef : undefined);
48
38
  const labelId = useId();
49
39
  const contextTranslations = usePickerTranslations();
40
+ let fieldRef;
41
+ if (fieldType === 'single-input') {
42
+ fieldRef = singleInputFieldRef;
43
+ } else if (rangePositionResponse.rangePosition === 'start') {
44
+ fieldRef = startFieldRef;
45
+ } else {
46
+ fieldRef = endFieldRef;
47
+ }
50
48
  const {
51
- open,
52
- actions,
53
- layoutProps,
54
49
  providerProps,
55
50
  renderCurrentView,
56
- fieldProps: pickerFieldProps,
57
51
  ownerState
58
52
  } = usePicker(_extends({}, pickerParams, {
59
53
  props,
60
54
  variant: 'mobile',
61
55
  autoFocusView: true,
62
- fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
63
- localeText,
64
- additionalViewProps: {
65
- rangePosition,
66
- onRangePositionChange
67
- }
56
+ fieldRef,
57
+ localeText
68
58
  }));
69
- const Field = slots.field;
70
- const fieldProps = useSlotProps({
71
- elementType: Field,
72
- externalSlotProps: innerSlotProps?.field,
73
- additionalProps: _extends({
74
- // Internal props
75
- readOnly: readOnly ?? true,
76
- disabled,
77
- format,
78
- formatDensity,
79
- enableAccessibleFieldDOMStructure,
80
- selectedSections,
81
- onSelectedSectionsChange,
82
- timezone
83
- }, pickerFieldProps, {
84
- // onChange and value
85
59
 
86
- // Forwarded props
87
- className,
88
- sx
89
- }, fieldType === 'single-input' && !!inputRef && {
90
- inputRef
91
- }, fieldType === 'single-input' && {
92
- name
60
+ // Temporary hack to hide the opening button on the range pickers until we have migrate them to the new opening logic.
61
+ providerProps.contextValue.triggerStatus = 'hidden';
62
+ const Field = slots.field;
63
+ const _useSlotProps = useSlotProps({
64
+ elementType: Field,
65
+ externalSlotProps: innerSlotProps?.field,
66
+ additionalProps: {
67
+ // Internal props
68
+ readOnly: readOnly ?? true
69
+ },
70
+ ownerState
93
71
  }),
94
- ownerState
95
- });
72
+ fieldProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
96
73
  const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
97
- const enrichedFieldProps = useEnrichedRangePickerFieldProps({
74
+ const enrichedFieldResponse = useEnrichedRangePickerField(_extends({
98
75
  variant: 'mobile',
99
76
  fieldType,
100
- open,
101
- actions,
77
+ // These direct access to `providerProps` will go away once the range fields handle the picker opening
78
+ contextValue: providerProps.contextValue,
79
+ fieldPrivateContextValue: providerProps.fieldPrivateContextValue,
102
80
  readOnly,
103
81
  labelId,
104
82
  disableOpenPicker,
105
- label,
106
83
  localeText,
107
- rangePosition,
108
- onRangePositionChange,
109
84
  pickerSlots: slots,
110
85
  pickerSlotProps: innerSlotProps,
111
86
  fieldProps,
112
87
  startFieldRef,
113
- endFieldRef
114
- });
115
- const slotPropsForLayout = _extends({}, innerSlotProps, {
116
- tabs: _extends({}, innerSlotProps?.tabs, {
117
- rangePosition,
118
- onRangePositionChange
119
- }),
120
- toolbar: _extends({}, innerSlotProps?.toolbar, {
121
- titleId: labelId,
122
- rangePosition,
123
- onRangePositionChange
124
- })
125
- });
88
+ endFieldRef,
89
+ singleInputFieldRef
90
+ }, rangePositionResponse));
126
91
  const Layout = slots?.layout ?? PickersLayout;
127
92
  const finalLocaleText = _extends({}, contextTranslations, localeText);
128
93
  let labelledById = pickerParams.valueType === 'date-time' ? `${labelId}-start-toolbar ${labelId}-end-toolbar` : labelId;
@@ -141,21 +106,33 @@ export const useMobileRangePicker = _ref => {
141
106
  labelledById = labels.length > 0 ? labels.join(' ') : undefined;
142
107
  }
143
108
  const slotProps = _extends({}, innerSlotProps, {
109
+ toolbar: _extends({}, innerSlotProps?.toolbar, {
110
+ titleId: labelId
111
+ }),
144
112
  mobilePaper: _extends({
145
113
  'aria-labelledby': labelledById
146
114
  }, innerSlotProps?.mobilePaper)
147
115
  });
148
- const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
149
- children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
150
- open: open,
116
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
117
+ // This override will go away once the range fields handle the picker opening
118
+ fieldPrivateContextValue: _extends({}, providerProps.fieldPrivateContextValue, enrichedFieldResponse.fieldPrivateContextValue),
119
+ children: /*#__PURE__*/_jsx(PickerFieldUIContextProvider, {
151
120
  slots: slots,
152
121
  slotProps: slotProps,
153
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
154
- slots: slots,
155
- slotProps: slotPropsForLayout,
156
- children: renderCurrentView()
157
- }))
158
- }))]
122
+ inputRef: inputRef,
123
+ children: /*#__PURE__*/_jsxs(PickerRangePositionContext.Provider, {
124
+ value: rangePositionResponse,
125
+ children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldResponse.fieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, {
126
+ slots: slots,
127
+ slotProps: slotProps,
128
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
129
+ slots: slots,
130
+ slotProps: slotProps,
131
+ children: renderCurrentView()
132
+ }))
133
+ })]
134
+ })
135
+ })
159
136
  }));
160
137
  return {
161
138
  renderPicker
@@ -1,24 +1,22 @@
1
1
  import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
- import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
3
- export interface UseMobileRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TView>, PickersModalDialogSlots {
2
+ import { RangeOnlyPickerProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
3
+ export interface UseMobileRangePickerSlots extends UseRangePickerSlots, PickersModalDialogSlots {
4
4
  }
5
- export interface UseMobileRangePickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {
5
+ export interface UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {
6
6
  }
7
7
  export interface MobileRangeOnlyPickerProps extends RangeOnlyPickerProps {
8
8
  }
9
- export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, TView, any, any>> extends UseRangePickerProps<TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
9
+ export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, TView, any>> extends UseRangePickerProps<TView, TError, TExternalProps> {
10
10
  /**
11
11
  * Overridable component slots.
12
12
  * @default {}
13
13
  */
14
- slots: UseMobileRangePickerSlots<TView>;
14
+ slots: UseMobileRangePickerSlots;
15
15
  /**
16
16
  * The props used for each component slot.
17
17
  * @default {}
18
18
  */
19
- slotProps?: UseMobileRangePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>;
19
+ slotProps?: UseMobileRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
20
20
  }
21
- export interface MobileRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
22
- }
23
- export interface UseMobileRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
21
+ export interface UseMobileRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TView, TExternalProps> {
24
22
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns information about the range position of the picker that wraps the current component.
3
+ * If no picker wraps the current component, returns `null`.
4
+ */
5
+ export declare function useNullablePickerRangePositionContext(): import("./useRangePosition").UseRangePositionResponse | null;
@@ -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
+ }
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { FieldRef } from '@mui/x-date-pickers/models';
3
- import { RangePosition, RangeFieldSection } from '../../models';
3
+ import { PickerRangeValue } from '@mui/x-date-pickers/internals';
4
+ import { RangePosition } from '../../models';
4
5
  export interface UseRangePositionProps {
5
6
  /**
6
7
  * The position in the currently edited date range.
@@ -21,6 +22,6 @@ export interface UseRangePositionProps {
21
22
  }
22
23
  export interface UseRangePositionResponse {
23
24
  rangePosition: RangePosition;
24
- onRangePositionChange: (newPosition: RangePosition) => void;
25
+ setRangePosition: (newPosition: RangePosition) => void;
25
26
  }
26
- export declare const useRangePosition: (props: UseRangePositionProps, singleInputFieldRef?: React.RefObject<FieldRef<RangeFieldSection>>) => UseRangePositionResponse;
27
+ export declare const useRangePosition: (props: UseRangePositionProps, singleInputFieldRef?: React.RefObject<FieldRef<PickerRangeValue> | null>) => UseRangePositionResponse;
@@ -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
  };
@@ -5,6 +5,6 @@ import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStat
5
5
  * Hook managing all the range static pickers:
6
6
  * - StaticDateRangePicker
7
7
  */
8
- export declare const useStaticRangePicker: <TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>>({ props, ref, ...pickerParams }: UseStaticRangePickerParams<TView, TExternalProps>) => {
8
+ export declare const useStaticRangePicker: <TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>>({ props, ...pickerParams }: UseStaticRangePickerParams<TView, TExternalProps>) => {
9
9
  renderPicker: () => React.JSX.Element;
10
10
  };