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

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 (291) 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 +1903 -231
  8. package/DateRangeCalendar/DateRangeCalendar.js +15 -13
  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 +4 -8
  28. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +2 -2
  29. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -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/README.md +8 -5
  50. package/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -33
  51. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +6 -16
  52. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
  53. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
  54. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +23 -33
  55. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +6 -17
  56. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
  57. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
  58. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +23 -33
  59. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +6 -17
  60. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
  61. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
  62. package/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  63. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +2 -2
  64. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
  65. package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  66. package/hooks/index.d.ts +2 -0
  67. package/hooks/index.js +2 -0
  68. package/hooks/package.json +6 -0
  69. package/hooks/useMultiInputRangeField/index.d.ts +1 -0
  70. package/hooks/useMultiInputRangeField/index.js +1 -0
  71. package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +53 -0
  72. package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
  73. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +17 -0
  74. package/{modern/internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
  75. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +17 -0
  76. package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
  77. package/hooks/usePickerRangePositionContext.d.ts +7 -0
  78. package/hooks/usePickerRangePositionContext.js +15 -0
  79. package/index.d.ts +2 -0
  80. package/index.js +4 -2
  81. package/internals/hooks/models/index.d.ts +1 -1
  82. package/internals/hooks/models/useRangePicker.d.ts +8 -11
  83. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +68 -100
  84. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +8 -10
  85. package/internals/hooks/{useEnrichedRangePickerFieldProps.d.ts → useEnrichedRangePickerField.d.ts} +25 -16
  86. package/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +50 -63
  87. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +57 -80
  88. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -9
  89. package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
  90. package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  91. package/internals/hooks/useRangePosition.d.ts +4 -3
  92. package/internals/hooks/useRangePosition.js +1 -1
  93. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -1
  94. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +17 -30
  95. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -12
  96. package/internals/models/dateTimeRange.d.ts +1 -6
  97. package/internals/models/fields.d.ts +7 -11
  98. package/internals/models/index.d.ts +0 -1
  99. package/internals/models/index.js +0 -1
  100. package/internals/models/managers.d.ts +3 -0
  101. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.d.ts +3 -0
  102. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +136 -0
  103. package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +72 -0
  104. package/internals/utils/createMultiInputRangeField/index.d.ts +3 -0
  105. package/internals/utils/createMultiInputRangeField/index.js +2 -0
  106. package/internals/utils/date-fields-utils.d.ts +6 -6
  107. package/internals/utils/date-range-manager.js +2 -1
  108. package/internals/utils/releaseInfo.js +1 -1
  109. package/internals/utils/valueManagers.d.ts +4 -3
  110. package/internals/utils/valueManagers.js +7 -7
  111. package/managers/index.d.ts +6 -0
  112. package/managers/index.js +3 -0
  113. package/managers/package.json +6 -0
  114. package/managers/useDateRangeManager.d.ts +15 -0
  115. package/managers/useDateRangeManager.js +33 -0
  116. package/managers/useDateTimeRangeManager.d.ts +15 -0
  117. package/managers/useDateTimeRangeManager.js +33 -0
  118. package/managers/useTimeRangeManager.d.ts +15 -0
  119. package/managers/useTimeRangeManager.js +31 -0
  120. package/models/fields.d.ts +7 -11
  121. package/models/index.d.ts +1 -2
  122. package/models/index.js +1 -2
  123. package/models/range.d.ts +0 -2
  124. package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  125. package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  126. package/modern/DateRangeCalendar/DateRangeCalendar.js +15 -13
  127. package/modern/DateRangePicker/DateRangePicker.js +1 -4
  128. package/modern/DateRangePicker/DateRangePickerToolbar.js +33 -41
  129. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
  130. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +35 -33
  131. package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  132. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +81 -109
  133. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
  134. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
  135. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +4 -8
  136. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -16
  137. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +15 -121
  138. package/modern/MultiInputDateRangeField/index.js +2 -2
  139. package/modern/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
  140. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +15 -121
  141. package/modern/MultiInputDateTimeRangeField/index.js +2 -2
  142. package/modern/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
  143. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -122
  144. package/modern/MultiInputTimeRangeField/index.js +2 -2
  145. package/modern/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
  146. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -33
  147. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
  148. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +23 -33
  149. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
  150. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +23 -33
  151. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
  152. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  153. package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  154. package/modern/hooks/index.js +2 -0
  155. package/modern/hooks/useMultiInputRangeField/index.js +1 -0
  156. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
  157. package/{internals/hooks/useMultiInputFieldSelectedSections.js → modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
  158. package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
  159. package/modern/hooks/usePickerRangePositionContext.js +15 -0
  160. package/modern/index.js +4 -2
  161. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +68 -100
  162. package/modern/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +50 -63
  163. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +57 -80
  164. package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
  165. package/modern/internals/hooks/useRangePosition.js +1 -1
  166. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +17 -30
  167. package/modern/internals/models/index.js +0 -1
  168. package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +136 -0
  169. package/modern/internals/utils/createMultiInputRangeField/index.js +2 -0
  170. package/modern/internals/utils/date-range-manager.js +2 -1
  171. package/modern/internals/utils/releaseInfo.js +1 -1
  172. package/modern/internals/utils/valueManagers.js +7 -7
  173. package/modern/managers/index.js +3 -0
  174. package/modern/managers/useDateRangeManager.js +33 -0
  175. package/modern/managers/useDateTimeRangeManager.js +33 -0
  176. package/modern/managers/useTimeRangeManager.js +31 -0
  177. package/modern/models/index.js +1 -2
  178. package/modern/validation/validateDateRange.js +8 -0
  179. package/modern/validation/validateDateTimeRange.js +4 -0
  180. package/modern/validation/validateTimeRange.js +8 -0
  181. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  182. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  183. package/node/DateRangeCalendar/DateRangeCalendar.js +14 -12
  184. package/node/DateRangePicker/DateRangePicker.js +1 -4
  185. package/node/DateRangePicker/DateRangePickerToolbar.js +31 -39
  186. package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
  187. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +33 -31
  188. package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
  189. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +80 -108
  190. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
  191. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
  192. package/node/MobileDateRangePicker/MobileDateRangePicker.js +4 -8
  193. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -16
  194. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -124
  195. package/node/MultiInputDateRangeField/index.js +3 -9
  196. package/node/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +12 -0
  197. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -124
  198. package/node/MultiInputDateTimeRangeField/index.js +3 -9
  199. package/node/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +12 -0
  200. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +15 -125
  201. package/node/MultiInputTimeRangeField/index.js +3 -9
  202. package/node/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +12 -0
  203. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +22 -32
  204. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
  205. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +22 -32
  206. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
  207. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +22 -32
  208. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
  209. package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
  210. package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
  211. package/node/hooks/index.js +19 -0
  212. package/node/hooks/useMultiInputRangeField/index.js +12 -0
  213. package/node/hooks/useMultiInputRangeField/useMultiInputRangeField.js +155 -0
  214. package/node/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +11 -10
  215. package/node/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +66 -0
  216. package/node/hooks/usePickerRangePositionContext.js +22 -0
  217. package/node/index.js +23 -1
  218. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +68 -100
  219. package/node/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +52 -65
  220. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +57 -80
  221. package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
  222. package/node/internals/hooks/useRangePosition.js +1 -1
  223. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +16 -29
  224. package/node/internals/models/index.js +0 -11
  225. package/node/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +143 -0
  226. package/node/internals/utils/createMultiInputRangeField/index.js +19 -0
  227. package/node/internals/utils/date-range-manager.js +2 -1
  228. package/node/internals/utils/releaseInfo.js +1 -1
  229. package/node/internals/utils/valueManagers.js +7 -7
  230. package/node/managers/index.js +26 -0
  231. package/node/managers/useDateRangeManager.js +40 -0
  232. package/node/managers/useDateTimeRangeManager.js +40 -0
  233. package/node/managers/useTimeRangeManager.js +38 -0
  234. package/node/models/index.js +0 -22
  235. package/node/validation/validateDateRange.js +8 -0
  236. package/node/validation/validateDateTimeRange.js +4 -0
  237. package/node/validation/validateTimeRange.js +8 -0
  238. package/package.json +6 -6
  239. package/themeAugmentation/overrides.d.ts +6 -4
  240. package/themeAugmentation/props.d.ts +2 -2
  241. package/validation/validateDateRange.d.ts +9 -1
  242. package/validation/validateDateRange.js +8 -0
  243. package/validation/validateDateTimeRange.d.ts +6 -2
  244. package/validation/validateDateTimeRange.js +4 -0
  245. package/validation/validateTimeRange.d.ts +9 -1
  246. package/validation/validateTimeRange.js +8 -0
  247. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +0 -53
  248. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +0 -54
  249. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +0 -54
  250. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +0 -21
  251. package/internals/hooks/useMultiInputRangeField/shared.d.ts +0 -1
  252. package/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  253. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +0 -3
  254. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
  255. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +0 -3
  256. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
  257. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +0 -11
  258. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +0 -3
  259. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
  260. package/internals/models/timeRange.d.ts +0 -6
  261. package/internals/models/timeRange.js +0 -1
  262. package/models/dateRange.d.ts +0 -7
  263. package/models/dateRange.js +0 -1
  264. package/models/multiInputRangeFieldClasses.d.ts +0 -7
  265. package/models/multiInputRangeFieldClasses.js +0 -1
  266. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  267. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  268. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  269. package/modern/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  270. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -113
  271. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -113
  272. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  273. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -113
  274. package/modern/internals/models/timeRange.js +0 -1
  275. package/modern/models/dateRange.js +0 -1
  276. package/modern/models/multiInputRangeFieldClasses.js +0 -1
  277. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -5
  278. package/node/internals/hooks/useMultiInputRangeField/shared.js +0 -16
  279. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -121
  280. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -121
  281. package/node/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -5
  282. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -121
  283. package/node/internals/models/timeRange.js +0 -5
  284. package/node/models/dateRange.js +0 -5
  285. package/node/models/multiInputRangeFieldClasses.js +0 -5
  286. /package/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
  287. /package/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
  288. /package/{MultiInputTimeRangeField/MultiInputTimeRangeField.types.js → modern/internals/models/managers.js} +0 -0
  289. /package/{internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js → modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
  290. /package/node/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
  291. /package/node/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
@@ -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
  };
@@ -1,12 +1,13 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["props", "ref"];
3
+ const _excluded = ["props"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { styled } from '@mui/material/styles';
7
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
- import { usePicker, DIALOG_WIDTH, PickerProvider } from '@mui/x-date-pickers/internals';
8
+ import { usePicker, DIALOG_WIDTH, PickerProvider, mergeSx } 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
@@ -22,25 +23,18 @@ const PickerStaticLayout = styled(PickersLayout)(({
22
23
  */
23
24
  export const useStaticRangePicker = _ref => {
24
25
  let {
25
- props,
26
- ref
26
+ props
27
27
  } = _ref,
28
28
  pickerParams = _objectWithoutPropertiesLoose(_ref, _excluded);
29
29
  const {
30
30
  localeText,
31
31
  slots,
32
32
  slotProps,
33
- className,
34
- sx,
35
33
  displayStaticWrapperAs,
36
34
  autoFocus
37
35
  } = props;
36
+ const rangePositionResponse = useRangePosition(props);
38
37
  const {
39
- rangePosition,
40
- onRangePositionChange
41
- } = useRangePosition(props);
42
- const {
43
- layoutProps,
44
38
  providerProps,
45
39
  renderCurrentView
46
40
  } = usePicker(_extends({}, pickerParams, {
@@ -48,29 +42,22 @@ export const useStaticRangePicker = _ref => {
48
42
  autoFocusView: autoFocus ?? false,
49
43
  fieldRef: undefined,
50
44
  localeText,
51
- additionalViewProps: {
52
- rangePosition,
53
- onRangePositionChange
54
- },
55
45
  variant: displayStaticWrapperAs
56
46
  }));
57
47
  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()
48
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerRangePositionContext.Provider, {
49
+ value: rangePositionResponse,
50
+ children: /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
51
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
52
+ slots: slots,
53
+ slotProps: slotProps,
54
+ sx: mergeSx(providerProps.contextValue.rootSx, slotProps?.layout?.sx),
55
+ className: clsx(providerProps.contextValue.rootClassName, slotProps?.layout?.className),
56
+ ref: providerProps.contextValue.rootRef,
57
+ children: renderCurrentView()
58
+ }))
72
59
  }))
73
- }));
60
+ });
74
61
  return {
75
62
  renderPicker
76
63
  };
@@ -1,31 +1,25 @@
1
- import * as React from 'react';
2
1
  import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
3
2
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
4
- import { RangeFieldSection } from '../../../models';
5
3
  import { UseRangePositionProps } from '../useRangePosition';
6
- export interface UseStaticRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerRangeValue, TView> {
4
+ export interface UseStaticRangePickerSlots extends ExportedPickersLayoutSlots<PickerRangeValue> {
7
5
  }
8
- export interface UseStaticRangePickerSlotProps<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<PickerRangeValue, TView> {
6
+ export interface UseStaticRangePickerSlotProps extends ExportedPickersLayoutSlotProps<PickerRangeValue> {
9
7
  toolbar?: ExportedBaseToolbarProps;
10
8
  }
11
9
  export interface StaticRangeOnlyPickerProps extends StaticOnlyPickerProps, UseRangePositionProps {
12
10
  }
13
- export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends BasePickerProps<PickerRangeValue, TView, TError, TExternalProps, {}>, StaticRangeOnlyPickerProps {
11
+ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends BasePickerProps<PickerRangeValue, TView, TError, TExternalProps>, StaticRangeOnlyPickerProps {
14
12
  /**
15
13
  * Overridable components.
16
14
  * @default {}
17
15
  */
18
- slots?: UseStaticRangePickerSlots<TView>;
16
+ slots?: UseStaticRangePickerSlots;
19
17
  /**
20
18
  * The props used for each component slot.
21
19
  * @default {}
22
20
  */
23
- slotProps?: UseStaticRangePickerSlotProps<TView>;
21
+ slotProps?: UseStaticRangePickerSlotProps;
24
22
  }
25
- export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, RangeFieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
23
+ export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'ref'> {
26
24
  props: TExternalProps;
27
- /**
28
- * Ref to pass to the root element
29
- */
30
- ref: React.Ref<HTMLDivElement> | undefined;
31
25
  }
@@ -1,8 +1,3 @@
1
- import { MakeOptional } from '@mui/x-internals/types';
2
- import { UseFieldInternalProps, DateOrTimeViewWithMeridiem, AmPmProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
3
- import { DateTimeRangeValidationError, RangeFieldSection, RangeFieldSeparatorProps } from '../../models';
4
- import { ExportedValidateDateTimeRangeProps } from '../../validation/validateDateTimeRange';
5
- export interface UseDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateTimeRangeProps, AmPmProps {
6
- }
1
+ import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
7
2
  export type DateTimeRangePickerView = Exclude<DateOrTimeViewWithMeridiem, 'month' | 'year'>;
8
3
  export type DateTimeRangePickerViewExternal = Exclude<DateTimeRangePickerView, 'meridiem'>;
@@ -1,26 +1,22 @@
1
- import { SxProps } from '@mui/material/styles';
2
1
  import { SlotComponentProps } from '@mui/utils';
3
- import { MakeRequired } from '@mui/x-internals/types';
4
- import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
5
- import { FieldSection } from '@mui/x-date-pickers/models';
2
+ import { PickerRangeValue, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
3
+ import { FieldOwnerState } from '@mui/x-date-pickers/models';
6
4
  import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
7
- import type { MultiInputFieldRefs, MultiInputFieldSlotRootProps, RangeFieldSeparatorProps, RangePosition } from '../../models';
5
+ import type { MultiInputFieldRefs, MultiInputFieldSlotRootProps, RangePosition } from '../../models';
8
6
  /**
9
7
  * Props the multi input field can receive when used inside a picker.
10
8
  * Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
11
9
  */
12
- export interface BaseMultiInputFieldProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends MakeRequired<Pick<UseFieldInternalProps<TValue, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'autoFocus' | 'value' | 'onChange'>, 'format' | 'value' | 'onChange' | 'timezone'>, RangeFieldSeparatorProps, MultiInputFieldRefs {
13
- className: string | undefined;
14
- sx: SxProps<any> | undefined;
10
+ export interface BaseMultiInputFieldProps extends Pick<UseFieldInternalProps<PickerRangeValue, boolean, unknown>, 'readOnly' | 'autoFocus'>, MultiInputFieldRefs {
15
11
  slots?: {
16
12
  root?: React.ElementType;
17
13
  separator?: React.ElementType;
18
14
  textField?: React.ElementType;
19
15
  };
20
16
  slotProps?: {
21
- root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, Record<string, any>>;
22
- textField?: SlotComponentProps<typeof PickersTextField, {}, {
17
+ root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, FieldOwnerState>;
18
+ textField?: SlotComponentProps<typeof PickersTextField, {}, FieldOwnerState & {
23
19
  position?: RangePosition;
24
- } & Record<string, any>>;
20
+ }>;
25
21
  };
26
22
  }
@@ -1,4 +1,3 @@
1
1
  export * from './dateRange';
2
2
  export * from './dateTimeRange';
3
- export * from './timeRange';
4
3
  export * from './rangePickerProps';
@@ -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";
@@ -0,0 +1,3 @@
1
+ import { PickerRangeValue } from '@mui/x-date-pickers/internals';
2
+ import { PickerManager } from '@mui/x-date-pickers/models';
3
+ export type PickerAnyRangeManager = PickerManager<PickerRangeValue, any, any, any, any>;
@@ -0,0 +1,3 @@
1
+ import { CreateMultiInputRangeFieldParameters, CreateMultiInputRangeFieldReturnValue } from './createMultiInputRangeField.types';
2
+ import { PickerAnyRangeManager } from '../../models/managers';
3
+ export declare function createMultiInputRangeField<TManager extends PickerAnyRangeManager>({ useManager, name, getUtilityClass, }: CreateMultiInputRangeFieldParameters<TManager>): CreateMultiInputRangeFieldReturnValue<TManager>;
@@ -0,0 +1,136 @@
1
+ 'use client';
2
+
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
+ import _extends from "@babel/runtime/helpers/esm/extends";
5
+ const _excluded = ["slots", "slotProps", "className", "classes"];
6
+ import * as React from 'react';
7
+ import clsx from 'clsx';
8
+ import Stack from '@mui/material/Stack';
9
+ import MuiTextField from '@mui/material/TextField';
10
+ import Typography from '@mui/material/Typography';
11
+ import { styled, useThemeProps } from '@mui/material/styles';
12
+ import composeClasses from '@mui/utils/composeClasses';
13
+ import useSlotProps from '@mui/utils/useSlotProps';
14
+ import useForkRef from '@mui/utils/useForkRef';
15
+ import { cleanFieldResponse, useFieldOwnerState, useNullablePickerContext } from '@mui/x-date-pickers/internals';
16
+ import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
17
+ import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
18
+ import { useMultiInputRangeField } from "../../../hooks/useMultiInputRangeField/index.js";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
+ export function createMultiInputRangeField({
21
+ useManager,
22
+ name,
23
+ getUtilityClass
24
+ }) {
25
+ const useUtilityClasses = classes => {
26
+ const slots = {
27
+ root: ['root'],
28
+ separator: ['separator']
29
+ };
30
+ return composeClasses(slots, getUtilityClass, classes);
31
+ };
32
+ const MultiInputRangeFieldRoot = styled(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/_jsx(Stack, _extends({
33
+ ref: ref,
34
+ spacing: 2,
35
+ direction: "row",
36
+ alignItems: "center"
37
+ }, props))), {
38
+ name,
39
+ slot: 'Root',
40
+ overridesResolver: (props, styles) => styles.root
41
+ })({});
42
+ const MultiInputRangeFieldSeparator = styled(Typography, {
43
+ name,
44
+ slot: 'Separator',
45
+ overridesResolver: (props, styles) => styles.separator
46
+ })({
47
+ lineHeight: '1.4375em' // 23px
48
+ });
49
+ const MultiInputRangeField = /*#__PURE__*/React.forwardRef(function MultiInputRangeField(props, ref) {
50
+ const themeProps = useThemeProps({
51
+ props,
52
+ // eslint-disable-next-line material-ui/mui-name-matches-component-name
53
+ name
54
+ });
55
+ const manager = useManager({
56
+ enableAccessibleFieldDOMStructure: props.enableAccessibleFieldDOMStructure,
57
+ dateSeparator: props.dateSeparator
58
+ });
59
+ const {
60
+ internalProps,
61
+ forwardedProps
62
+ } = useSplitFieldProps(themeProps, manager.valueType);
63
+ const {
64
+ slots,
65
+ slotProps,
66
+ className,
67
+ classes: classesProp
68
+ } = forwardedProps,
69
+ otherForwardedProps = _objectWithoutPropertiesLoose(forwardedProps, _excluded);
70
+ const classes = useUtilityClasses(classesProp);
71
+ const ownerState = useFieldOwnerState(internalProps);
72
+ const pickerContext = useNullablePickerContext();
73
+ const handleRef = useForkRef(ref, pickerContext?.rootRef);
74
+ const Root = slots?.root ?? MultiInputRangeFieldRoot;
75
+ const rootProps = useSlotProps({
76
+ elementType: Root,
77
+ externalSlotProps: slotProps?.root,
78
+ externalForwardedProps: otherForwardedProps,
79
+ additionalProps: {
80
+ ref: handleRef
81
+ },
82
+ ownerState,
83
+ className: clsx(className, classes.root)
84
+ });
85
+ const startTextFieldProps = useSlotProps({
86
+ elementType: PickersTextField,
87
+ externalSlotProps: slotProps?.textField,
88
+ ownerState: _extends({}, ownerState, {
89
+ position: 'start'
90
+ })
91
+ });
92
+ const endTextFieldProps = useSlotProps({
93
+ elementType: PickersTextField,
94
+ externalSlotProps: slotProps?.textField,
95
+ ownerState: _extends({}, ownerState, {
96
+ position: 'end'
97
+ })
98
+ });
99
+ const {
100
+ startDate,
101
+ endDate,
102
+ enableAccessibleFieldDOMStructure
103
+ } = useMultiInputRangeField({
104
+ manager,
105
+ internalProps,
106
+ startForwardedProps: startTextFieldProps,
107
+ endForwardedProps: endTextFieldProps
108
+ });
109
+ const Separator = slots?.separator ?? MultiInputRangeFieldSeparator;
110
+ const separatorProps = useSlotProps({
111
+ elementType: Separator,
112
+ externalSlotProps: slotProps?.separator,
113
+ additionalProps: {
114
+ children: internalProps.dateSeparator ?? '–'
115
+ },
116
+ ownerState,
117
+ className: classes.separator
118
+ });
119
+ const {
120
+ textFieldProps: startDateProps
121
+ } = cleanFieldResponse(startDate);
122
+ const {
123
+ textFieldProps: endDateProps
124
+ } = cleanFieldResponse(endDate);
125
+ const TextField = slots?.textField ?? (enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
126
+ return /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, {
127
+ children: [/*#__PURE__*/_jsx(TextField, _extends({
128
+ fullWidth: true
129
+ }, startDateProps)), /*#__PURE__*/_jsx(Separator, _extends({}, separatorProps)), /*#__PURE__*/_jsx(TextField, _extends({
130
+ fullWidth: true
131
+ }, endDateProps))]
132
+ }));
133
+ });
134
+ MultiInputRangeField.fieldType = 'multi-input';
135
+ return MultiInputRangeField;
136
+ }