@mui/x-date-pickers-pro 7.0.0-beta.1 → 7.0.0-beta.4

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 (293) hide show
  1. package/CHANGELOG.md +437 -4
  2. package/DateRangeCalendar/DateRangeCalendar.d.ts +2 -1
  3. package/DateRangeCalendar/DateRangeCalendar.js +9 -7
  4. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +10 -7
  5. package/DateRangeCalendar/useDragRange.d.ts +4 -4
  6. package/DateRangePicker/DateRangePicker.d.ts +2 -1
  7. package/DateRangePicker/DateRangePicker.js +14 -14
  8. package/DateRangePicker/DateRangePicker.types.d.ts +5 -4
  9. package/DateRangePicker/DateRangePickerToolbar.d.ts +6 -2
  10. package/DateRangePicker/DateRangePickerToolbar.js +7 -1
  11. package/DateRangePicker/shared.d.ts +6 -5
  12. package/DateRangePickerDay/DateRangePickerDay.d.ts +3 -2
  13. package/DateRangePickerDay/DateRangePickerDay.js +2 -2
  14. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -1
  15. package/DateTimeRangePicker/DateTimeRangePicker.js +20 -21
  16. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +5 -4
  17. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  18. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +3 -2
  19. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +6 -2
  20. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -1
  21. package/DateTimeRangePicker/shared.d.ts +6 -5
  22. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +2 -1
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.js +14 -14
  24. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +5 -4
  25. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +2 -1
  26. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -21
  27. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +5 -4
  28. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +2 -1
  29. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +2 -1
  30. package/MobileDateRangePicker/MobileDateRangePicker.js +14 -14
  31. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +5 -4
  32. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +2 -1
  33. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -21
  34. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +5 -4
  35. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +2 -1
  36. package/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -24
  37. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +12 -14
  38. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +2 -1
  39. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +26 -28
  40. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +13 -16
  41. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +2 -1
  42. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +22 -24
  43. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +13 -16
  44. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +3 -2
  45. package/SingleInputDateRangeField/SingleInputDateRangeField.js +17 -15
  46. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -13
  47. package/SingleInputDateRangeField/index.d.ts +1 -1
  48. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +3 -3
  49. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
  50. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +3 -2
  51. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -19
  52. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -14
  53. package/SingleInputDateTimeRangeField/index.d.ts +1 -1
  54. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +3 -3
  55. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
  56. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +3 -2
  57. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +16 -14
  58. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -14
  59. package/SingleInputTimeRangeField/index.d.ts +1 -1
  60. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +3 -3
  61. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
  62. package/StaticDateRangePicker/StaticDateRangePicker.d.ts +2 -1
  63. package/StaticDateRangePicker/StaticDateRangePicker.js +5 -6
  64. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +4 -3
  65. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +3 -2
  66. package/index.d.ts +7 -2
  67. package/index.js +8 -2
  68. package/internals/hooks/models/useRangePicker.d.ts +8 -7
  69. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -1
  70. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +17 -8
  71. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +7 -6
  72. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
  73. package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
  74. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -1
  75. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  76. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -6
  77. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
  78. package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
  79. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +2 -1
  80. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  81. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +3 -3
  82. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  83. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
  84. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +3 -3
  85. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  86. package/internals/hooks/useRangePosition.d.ts +2 -4
  87. package/internals/hooks/useRangePosition.js +3 -6
  88. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
  89. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  90. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -6
  91. package/internals/models/dateRange.d.ts +5 -16
  92. package/internals/models/dateTimeRange.d.ts +5 -6
  93. package/internals/models/index.d.ts +0 -1
  94. package/internals/models/index.js +0 -1
  95. package/internals/models/timeRange.d.ts +4 -6
  96. package/internals/utils/date-fields-utils.d.ts +1 -5
  97. package/internals/utils/date-range-manager.d.ts +5 -5
  98. package/internals/utils/date-utils.d.ts +5 -5
  99. package/internals/utils/releaseInfo.js +1 -1
  100. package/internals/utils/validation/validateDateRange.d.ts +2 -2
  101. package/internals/utils/validation/validateDateTimeRange.d.ts +2 -2
  102. package/internals/utils/valueManagers.d.ts +3 -3
  103. package/internals/utils/valueManagers.js +11 -6
  104. package/models/fields.d.ts +69 -0
  105. package/models/index.d.ts +1 -0
  106. package/models/index.js +1 -0
  107. package/models/range.d.ts +3 -2
  108. package/modern/DateRangeCalendar/DateRangeCalendar.js +9 -7
  109. package/modern/DateRangePicker/DateRangePicker.js +14 -14
  110. package/modern/DateRangePicker/DateRangePickerToolbar.js +7 -1
  111. package/modern/DateRangePickerDay/DateRangePickerDay.js +2 -2
  112. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +20 -21
  113. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  114. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -1
  115. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +14 -14
  116. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -21
  117. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +14 -14
  118. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -21
  119. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -24
  120. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +26 -28
  121. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +22 -24
  122. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +17 -15
  123. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
  124. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -19
  125. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
  126. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +16 -14
  127. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
  128. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +5 -6
  129. package/modern/index.js +8 -2
  130. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +17 -8
  131. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
  132. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  133. package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
  134. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  135. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
  136. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
  137. package/modern/internals/hooks/useRangePosition.js +3 -6
  138. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  139. package/modern/internals/models/index.js +0 -1
  140. package/modern/internals/utils/releaseInfo.js +1 -1
  141. package/modern/internals/utils/valueManagers.js +11 -6
  142. package/modern/models/index.js +1 -0
  143. package/node/DateRangeCalendar/DateRangeCalendar.js +10 -8
  144. package/node/DateRangePicker/DateRangePicker.js +14 -14
  145. package/node/DateRangePicker/DateRangePickerToolbar.js +7 -1
  146. package/node/DateRangePickerDay/DateRangePickerDay.js +3 -3
  147. package/node/DateTimeRangePicker/DateTimeRangePicker.js +20 -21
  148. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  149. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -1
  150. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +14 -14
  151. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -21
  152. package/node/MobileDateRangePicker/MobileDateRangePicker.js +14 -14
  153. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +22 -23
  154. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -24
  155. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +26 -28
  156. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +22 -24
  157. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +17 -15
  158. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
  159. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +24 -22
  160. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
  161. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +16 -14
  162. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
  163. package/node/StaticDateRangePicker/StaticDateRangePicker.js +5 -6
  164. package/node/index.js +18 -9
  165. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +18 -9
  166. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
  167. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +19 -10
  168. package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
  169. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
  170. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  171. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  172. package/node/internals/hooks/useRangePosition.js +3 -8
  173. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  174. package/node/internals/models/index.js +0 -11
  175. package/node/internals/utils/releaseInfo.js +1 -1
  176. package/node/internals/utils/valueManagers.js +10 -5
  177. package/node/models/index.js +11 -0
  178. package/package.json +6 -6
  179. package/themeAugmentation/props.d.ts +17 -17
  180. package/internals/models/fields.d.ts +0 -49
  181. package/legacy/AdapterDateFns/index.js +0 -1
  182. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  183. package/legacy/AdapterDateFnsV3/index.js +0 -1
  184. package/legacy/AdapterDayjs/index.js +0 -1
  185. package/legacy/AdapterLuxon/index.js +0 -1
  186. package/legacy/AdapterMoment/index.js +0 -1
  187. package/legacy/AdapterMomentHijri/index.js +0 -1
  188. package/legacy/AdapterMomentJalaali/index.js +0 -1
  189. package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
  190. package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
  191. package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
  192. package/legacy/DateRangeCalendar/index.js +0 -2
  193. package/legacy/DateRangeCalendar/useDragRange.js +0 -258
  194. package/legacy/DateRangePicker/DateRangePicker.js +0 -334
  195. package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
  196. package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
  197. package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
  198. package/legacy/DateRangePicker/index.js +0 -3
  199. package/legacy/DateRangePicker/shared.js +0 -33
  200. package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
  201. package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
  202. package/legacy/DateRangePickerDay/index.js +0 -2
  203. package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
  204. package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
  205. package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
  206. package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
  207. package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
  208. package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
  209. package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
  210. package/legacy/DateTimeRangePicker/index.js +0 -5
  211. package/legacy/DateTimeRangePicker/shared.js +0 -54
  212. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
  213. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
  214. package/legacy/DesktopDateRangePicker/index.js +0 -1
  215. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
  216. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
  217. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
  218. package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
  219. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
  220. package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
  221. package/legacy/MobileDateRangePicker/index.js +0 -1
  222. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
  223. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
  224. package/legacy/MobileDateTimeRangePicker/index.js +0 -1
  225. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
  226. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  227. package/legacy/MultiInputDateRangeField/index.js +0 -2
  228. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
  229. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  230. package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
  231. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
  232. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  233. package/legacy/MultiInputTimeRangeField/index.js +0 -2
  234. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
  235. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
  236. package/legacy/SingleInputDateRangeField/index.js +0 -2
  237. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
  238. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
  239. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
  240. package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
  241. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
  242. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
  243. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
  244. package/legacy/SingleInputTimeRangeField/index.js +0 -2
  245. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
  246. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
  247. package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
  248. package/legacy/StaticDateRangePicker/index.js +0 -1
  249. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
  250. package/legacy/dateRangeViewRenderers/index.js +0 -1
  251. package/legacy/index.js +0 -33
  252. package/legacy/internals/constants/dimensions.js +0 -5
  253. package/legacy/internals/hooks/models/index.js +0 -1
  254. package/legacy/internals/hooks/models/useRangePicker.js +0 -1
  255. package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
  256. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
  257. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
  258. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
  259. package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
  260. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
  261. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
  262. package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  263. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
  264. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
  265. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  266. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
  267. package/legacy/internals/hooks/useRangePosition.js +0 -39
  268. package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
  269. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
  270. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
  271. package/legacy/internals/models/dateRange.js +0 -1
  272. package/legacy/internals/models/dateTimeRange.js +0 -1
  273. package/legacy/internals/models/index.js +0 -5
  274. package/legacy/internals/models/rangePickerProps.js +0 -1
  275. package/legacy/internals/models/timeRange.js +0 -1
  276. package/legacy/internals/utils/date-fields-utils.js +0 -26
  277. package/legacy/internals/utils/date-range-manager.js +0 -65
  278. package/legacy/internals/utils/date-utils.js +0 -12
  279. package/legacy/internals/utils/releaseInfo.js +0 -13
  280. package/legacy/internals/utils/validation/validateDateRange.js +0 -45
  281. package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
  282. package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
  283. package/legacy/internals/utils/valueManagers.js +0 -135
  284. package/legacy/locales/index.js +0 -1
  285. package/legacy/models/index.js +0 -3
  286. package/legacy/models/multiInputRangeFieldClasses.js +0 -1
  287. package/legacy/models/range.js +0 -1
  288. package/legacy/models/validation.js +0 -1
  289. package/legacy/themeAugmentation/index.js +0 -4
  290. package/modern/internals/models/fields.js +0 -1
  291. /package/{internals/models → models}/fields.js +0 -0
  292. /package/{legacy/internals → modern}/models/fields.js +0 -0
  293. /package/node/{internals/models → models}/fields.js +0 -0
@@ -1,144 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["props"];
4
- import * as React from 'react';
5
- import { useSlotProps } from '@mui/base/utils';
6
- import { useLicenseVerifier } from '@mui/x-license-pro';
7
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
8
- import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
9
- import { usePicker, PickersModalDialog, useLocaleText } from '@mui/x-date-pickers/internals';
10
- import useId from '@mui/utils/useId';
11
- import { useEnrichedRangePickerFieldProps } from '../useEnrichedRangePickerFieldProps';
12
- import { getReleaseInfo } from '../../utils/releaseInfo';
13
- import { useRangePosition } from '../useRangePosition';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
- var releaseInfo = getReleaseInfo();
17
- export var useMobileRangePicker = function useMobileRangePicker(_ref) {
18
- var _fieldType, _innerSlotProps$toolb, _innerSlotProps$toolb2, _slots$layout;
19
- var props = _ref.props,
20
- pickerParams = _objectWithoutProperties(_ref, _excluded);
21
- useLicenseVerifier('x-date-pickers-pro', releaseInfo);
22
- var slots = props.slots,
23
- innerSlotProps = props.slotProps,
24
- className = props.className,
25
- sx = props.sx,
26
- format = props.format,
27
- formatDensity = props.formatDensity,
28
- timezone = props.timezone,
29
- label = props.label,
30
- inputRef = props.inputRef,
31
- name = props.name,
32
- readOnly = props.readOnly,
33
- disabled = props.disabled,
34
- disableOpenPicker = props.disableOpenPicker,
35
- localeText = props.localeText;
36
- var _useRangePosition = useRangePosition(props),
37
- rangePosition = _useRangePosition.rangePosition,
38
- onRangePositionChange = _useRangePosition.onRangePositionChange,
39
- singleInputFieldRef = _useRangePosition.singleInputFieldRef;
40
- var labelId = useId();
41
- var contextLocaleText = useLocaleText();
42
- var _usePicker = usePicker(_extends({}, pickerParams, {
43
- props: props,
44
- wrapperVariant: 'mobile',
45
- autoFocusView: true,
46
- additionalViewProps: {
47
- rangePosition: rangePosition,
48
- onRangePositionChange: onRangePositionChange
49
- }
50
- })),
51
- open = _usePicker.open,
52
- actions = _usePicker.actions,
53
- layoutProps = _usePicker.layoutProps,
54
- renderCurrentView = _usePicker.renderCurrentView,
55
- pickerFieldProps = _usePicker.fieldProps;
56
- var Field = slots.field;
57
- var fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
58
- var fieldProps = useSlotProps({
59
- elementType: Field,
60
- externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
61
- additionalProps: _extends({}, pickerFieldProps, {
62
- readOnly: readOnly != null ? readOnly : true,
63
- disabled: disabled,
64
- className: className,
65
- sx: sx,
66
- format: format,
67
- formatDensity: formatDensity,
68
- timezone: timezone
69
- }, fieldType === 'single-input' && {
70
- inputRef: inputRef,
71
- name: name
72
- }),
73
- ownerState: props
74
- });
75
- var isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null || (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
76
- var enrichedFieldProps = useEnrichedRangePickerFieldProps({
77
- wrapperVariant: 'mobile',
78
- fieldType: fieldType,
79
- open: open,
80
- actions: actions,
81
- readOnly: readOnly,
82
- labelId: labelId,
83
- disableOpenPicker: disableOpenPicker,
84
- label: label,
85
- localeText: localeText,
86
- rangePosition: rangePosition,
87
- onRangePositionChange: onRangePositionChange,
88
- singleInputFieldRef: singleInputFieldRef,
89
- pickerSlots: slots,
90
- pickerSlotProps: innerSlotProps,
91
- fieldProps: fieldProps
92
- });
93
- var slotPropsForLayout = _extends({}, innerSlotProps, {
94
- tabs: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.tabs, {
95
- rangePosition: rangePosition,
96
- onRangePositionChange: onRangePositionChange
97
- }),
98
- toolbar: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.toolbar, {
99
- titleId: labelId,
100
- rangePosition: rangePosition,
101
- onRangePositionChange: onRangePositionChange
102
- })
103
- });
104
- var Layout = (_slots$layout = slots == null ? void 0 : slots.layout) != null ? _slots$layout : PickersLayout;
105
- var finalLocaleText = _extends({}, contextLocaleText, localeText);
106
- var labelledById = labelId;
107
- if (isToolbarHidden) {
108
- var labels = [];
109
- if (fieldType === 'multi-input') {
110
- if (finalLocaleText.start) {
111
- labels.push("".concat(labelId, "-start-label"));
112
- }
113
- if (finalLocaleText.end) {
114
- labels.push("".concat(labelId, "-end-label"));
115
- }
116
- } else if (label != null) {
117
- labels.push("".concat(labelId, "-label"));
118
- }
119
- labelledById = labels.length > 0 ? labels.join(' ') : undefined;
120
- }
121
- var slotProps = _extends({}, innerSlotProps, {
122
- mobilePaper: _extends({
123
- 'aria-labelledby': labelledById
124
- }, innerSlotProps == null ? void 0 : innerSlotProps.mobilePaper)
125
- });
126
- var renderPicker = function renderPicker() {
127
- return /*#__PURE__*/_jsxs(LocalizationProvider, {
128
- localeText: localeText,
129
- children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
130
- open: open,
131
- slots: slots,
132
- slotProps: slotProps,
133
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
134
- slots: slots,
135
- slotProps: slotPropsForLayout,
136
- children: renderCurrentView()
137
- }))
138
- }))]
139
- });
140
- };
141
- return {
142
- renderPicker: renderPicker
143
- };
144
- };
@@ -1,9 +0,0 @@
1
- /* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
2
- export var excludeProps = function excludeProps(props, excludedProps) {
3
- return Object.keys(props).reduce(function (acc, key) {
4
- if (!excludedProps.includes(key)) {
5
- acc[key] = props[key];
6
- }
7
- return acc;
8
- }, {});
9
- };
@@ -1,102 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import useEventCallback from '@mui/utils/useEventCallback';
3
- import { unstable_useDateField as useDateField } from '@mui/x-date-pickers/DateField';
4
- import { useLocalizationContext, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
5
- import { useDefaultizedDateRangeFieldProps } from '../../../SingleInputDateRangeField/useSingleInputDateRangeField';
6
- import { validateDateRange } from '../../utils/validation/validateDateRange';
7
- import { rangeValueManager } from '../../utils/valueManagers';
8
- import { excludeProps } from './shared';
9
- export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_ref) {
10
- var inSharedProps = _ref.sharedProps,
11
- startTextFieldProps = _ref.startTextFieldProps,
12
- unstableStartFieldRef = _ref.unstableStartFieldRef,
13
- endTextFieldProps = _ref.endTextFieldProps,
14
- unstableEndFieldRef = _ref.unstableEndFieldRef;
15
- var sharedProps = useDefaultizedDateRangeFieldProps(inSharedProps);
16
- var adapter = useLocalizationContext();
17
- var valueProp = sharedProps.value,
18
- defaultValue = sharedProps.defaultValue,
19
- format = sharedProps.format,
20
- formatDensity = sharedProps.formatDensity,
21
- shouldRespectLeadingZeros = sharedProps.shouldRespectLeadingZeros,
22
- onChange = sharedProps.onChange,
23
- disabled = sharedProps.disabled,
24
- readOnly = sharedProps.readOnly,
25
- selectedSections = sharedProps.selectedSections,
26
- onSelectedSectionsChange = sharedProps.onSelectedSectionsChange,
27
- timezoneProp = sharedProps.timezone;
28
- var _useControlledValueWi = useControlledValueWithTimezone({
29
- name: 'useMultiInputDateRangeField',
30
- timezone: timezoneProp,
31
- value: valueProp,
32
- defaultValue: defaultValue,
33
- onChange: onChange,
34
- valueManager: rangeValueManager
35
- }),
36
- value = _useControlledValueWi.value,
37
- handleValueChange = _useControlledValueWi.handleValueChange,
38
- timezone = _useControlledValueWi.timezone;
39
-
40
- // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
41
- var buildChangeHandler = function buildChangeHandler(index) {
42
- return function (newDate, rawContext) {
43
- var newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
44
- var context = _extends({}, rawContext, {
45
- validationError: validateDateRange({
46
- adapter: adapter,
47
- value: newDateRange,
48
- props: _extends({}, sharedProps, {
49
- timezone: timezone
50
- })
51
- })
52
- });
53
- handleValueChange(newDateRange, context);
54
- };
55
- };
56
- var handleStartDateChange = useEventCallback(buildChangeHandler(0));
57
- var handleEndDateChange = useEventCallback(buildChangeHandler(1));
58
- var validationError = useValidation(_extends({}, sharedProps, {
59
- value: value,
60
- timezone: timezone
61
- }), validateDateRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
62
- var startFieldProps = _extends({
63
- error: !!validationError[0]
64
- }, startTextFieldProps, {
65
- disabled: disabled,
66
- readOnly: readOnly,
67
- format: format,
68
- formatDensity: formatDensity,
69
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
70
- timezone: timezone,
71
- unstableFieldRef: unstableStartFieldRef,
72
- value: valueProp === undefined ? undefined : valueProp[0],
73
- defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
74
- onChange: handleStartDateChange,
75
- selectedSections: selectedSections,
76
- onSelectedSectionsChange: onSelectedSectionsChange
77
- });
78
- var endFieldProps = _extends({
79
- error: !!validationError[1]
80
- }, endTextFieldProps, {
81
- format: format,
82
- formatDensity: formatDensity,
83
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
84
- disabled: disabled,
85
- readOnly: readOnly,
86
- timezone: timezone,
87
- unstableFieldRef: unstableEndFieldRef,
88
- value: valueProp === undefined ? undefined : valueProp[1],
89
- defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
90
- onChange: handleEndDateChange,
91
- selectedSections: selectedSections,
92
- onSelectedSectionsChange: onSelectedSectionsChange
93
- });
94
- var startDateResponse = useDateField(startFieldProps);
95
- var endDateResponse = useDateField(endFieldProps);
96
-
97
- /* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
98
- return {
99
- startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
100
- endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
101
- };
102
- };
@@ -1,115 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import useEventCallback from '@mui/utils/useEventCallback';
3
- import { unstable_useDateTimeField as useDateTimeField } from '@mui/x-date-pickers/DateTimeField';
4
- import { applyDefaultDate, useDefaultDates, useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
5
- import { validateDateTimeRange } from '../../utils/validation/validateDateTimeRange';
6
- import { rangeValueManager } from '../../utils/valueManagers';
7
- import { excludeProps } from './shared';
8
- export var useDefaultizedDateTimeRangeFieldProps = function useDefaultizedDateTimeRangeFieldProps(props) {
9
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
10
- var utils = useUtils();
11
- var defaultDates = useDefaultDates();
12
- var ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
13
- var defaultFormat = ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h;
14
- return _extends({}, props, {
15
- disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
16
- disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
17
- format: (_props$format = props.format) != null ? _props$format : defaultFormat,
18
- minDate: applyDefaultDate(utils, (_props$minDateTime = props.minDateTime) != null ? _props$minDateTime : props.minDate, defaultDates.minDate),
19
- maxDate: applyDefaultDate(utils, (_props$maxDateTime = props.maxDateTime) != null ? _props$maxDateTime : props.maxDate, defaultDates.maxDate),
20
- minTime: (_props$minDateTime2 = props.minDateTime) != null ? _props$minDateTime2 : props.minTime,
21
- maxTime: (_props$maxDateTime2 = props.maxDateTime) != null ? _props$maxDateTime2 : props.maxTime,
22
- disableIgnoringDatePartForTimeValidation: Boolean(props.minDateTime || props.maxDateTime)
23
- });
24
- };
25
- export var useMultiInputDateTimeRangeField = function useMultiInputDateTimeRangeField(_ref) {
26
- var inSharedProps = _ref.sharedProps,
27
- startTextFieldProps = _ref.startTextFieldProps,
28
- unstableStartFieldRef = _ref.unstableStartFieldRef,
29
- endTextFieldProps = _ref.endTextFieldProps,
30
- unstableEndFieldRef = _ref.unstableEndFieldRef;
31
- var sharedProps = useDefaultizedDateTimeRangeFieldProps(inSharedProps);
32
- var adapter = useLocalizationContext();
33
- var valueProp = sharedProps.value,
34
- defaultValue = sharedProps.defaultValue,
35
- format = sharedProps.format,
36
- shouldRespectLeadingZeros = sharedProps.shouldRespectLeadingZeros,
37
- timezoneProp = sharedProps.timezone,
38
- onChange = sharedProps.onChange,
39
- disabled = sharedProps.disabled,
40
- readOnly = sharedProps.readOnly,
41
- selectedSections = sharedProps.selectedSections,
42
- onSelectedSectionsChange = sharedProps.onSelectedSectionsChange;
43
- var _useControlledValueWi = useControlledValueWithTimezone({
44
- name: 'useMultiInputDateRangeField',
45
- timezone: timezoneProp,
46
- value: valueProp,
47
- defaultValue: defaultValue,
48
- onChange: onChange,
49
- valueManager: rangeValueManager
50
- }),
51
- value = _useControlledValueWi.value,
52
- handleValueChange = _useControlledValueWi.handleValueChange,
53
- timezone = _useControlledValueWi.timezone;
54
-
55
- // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
56
- var buildChangeHandler = function buildChangeHandler(index) {
57
- return function (newDate, rawContext) {
58
- var newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
59
- var context = _extends({}, rawContext, {
60
- validationError: validateDateTimeRange({
61
- adapter: adapter,
62
- value: newDateRange,
63
- props: _extends({}, sharedProps, {
64
- timezone: timezone
65
- })
66
- })
67
- });
68
- handleValueChange(newDateRange, context);
69
- };
70
- };
71
- var handleStartDateChange = useEventCallback(buildChangeHandler(0));
72
- var handleEndDateChange = useEventCallback(buildChangeHandler(1));
73
- var validationError = useValidation(_extends({}, sharedProps, {
74
- value: value,
75
- timezone: timezone
76
- }), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
77
- var startFieldProps = _extends({
78
- error: !!validationError[0]
79
- }, startTextFieldProps, {
80
- format: format,
81
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
82
- disabled: disabled,
83
- readOnly: readOnly,
84
- timezone: timezone,
85
- unstableFieldRef: unstableStartFieldRef,
86
- value: valueProp === undefined ? undefined : valueProp[0],
87
- defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
88
- onChange: handleStartDateChange,
89
- selectedSections: selectedSections,
90
- onSelectedSectionsChange: onSelectedSectionsChange
91
- });
92
- var endFieldProps = _extends({
93
- error: !!validationError[1]
94
- }, endTextFieldProps, {
95
- format: format,
96
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
97
- disabled: disabled,
98
- readOnly: readOnly,
99
- timezone: timezone,
100
- unstableFieldRef: unstableEndFieldRef,
101
- value: valueProp === undefined ? undefined : valueProp[1],
102
- defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
103
- onChange: handleEndDateChange,
104
- selectedSections: selectedSections,
105
- onSelectedSectionsChange: onSelectedSectionsChange
106
- });
107
- var startDateResponse = useDateTimeField(startFieldProps);
108
- var endDateResponse = useDateTimeField(endFieldProps);
109
-
110
- /* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
111
- return {
112
- startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
113
- endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
114
- };
115
- };
@@ -1,109 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import useEventCallback from '@mui/utils/useEventCallback';
3
- import { unstable_useTimeField as useTimeField } from '@mui/x-date-pickers/TimeField';
4
- import { useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
5
- import { validateTimeRange } from '../../utils/validation/validateTimeRange';
6
- import { rangeValueManager } from '../../utils/valueManagers';
7
- import { excludeProps } from './shared';
8
- export var useDefaultizedTimeRangeFieldProps = function useDefaultizedTimeRangeFieldProps(props) {
9
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
10
- var utils = useUtils();
11
- var ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
12
- var defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
13
- return _extends({}, props, {
14
- disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
15
- disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
16
- format: (_props$format = props.format) != null ? _props$format : defaultFormat
17
- });
18
- };
19
- export var useMultiInputTimeRangeField = function useMultiInputTimeRangeField(_ref) {
20
- var inSharedProps = _ref.sharedProps,
21
- startTextFieldProps = _ref.startTextFieldProps,
22
- unstableStartFieldRef = _ref.unstableStartFieldRef,
23
- endTextFieldProps = _ref.endTextFieldProps,
24
- unstableEndFieldRef = _ref.unstableEndFieldRef;
25
- var sharedProps = useDefaultizedTimeRangeFieldProps(inSharedProps);
26
- var adapter = useLocalizationContext();
27
- var valueProp = sharedProps.value,
28
- defaultValue = sharedProps.defaultValue,
29
- format = sharedProps.format,
30
- shouldRespectLeadingZeros = sharedProps.shouldRespectLeadingZeros,
31
- timezoneProp = sharedProps.timezone,
32
- onChange = sharedProps.onChange,
33
- disabled = sharedProps.disabled,
34
- readOnly = sharedProps.readOnly,
35
- selectedSections = sharedProps.selectedSections,
36
- onSelectedSectionsChange = sharedProps.onSelectedSectionsChange;
37
- var _useControlledValueWi = useControlledValueWithTimezone({
38
- name: 'useMultiInputDateRangeField',
39
- timezone: timezoneProp,
40
- value: valueProp,
41
- defaultValue: defaultValue,
42
- onChange: onChange,
43
- valueManager: rangeValueManager
44
- }),
45
- value = _useControlledValueWi.value,
46
- handleValueChange = _useControlledValueWi.handleValueChange,
47
- timezone = _useControlledValueWi.timezone;
48
-
49
- // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
50
- var buildChangeHandler = function buildChangeHandler(index) {
51
- return function (newDate, rawContext) {
52
- var newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
53
- var context = _extends({}, rawContext, {
54
- validationError: validateTimeRange({
55
- adapter: adapter,
56
- value: newDateRange,
57
- props: _extends({}, sharedProps, {
58
- timezone: timezone
59
- })
60
- })
61
- });
62
- handleValueChange(newDateRange, context);
63
- };
64
- };
65
- var handleStartDateChange = useEventCallback(buildChangeHandler(0));
66
- var handleEndDateChange = useEventCallback(buildChangeHandler(1));
67
- var validationError = useValidation(_extends({}, sharedProps, {
68
- value: value,
69
- timezone: timezone
70
- }), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
71
- var startFieldProps = _extends({
72
- error: !!validationError[0]
73
- }, startTextFieldProps, {
74
- format: format,
75
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
76
- disabled: disabled,
77
- readOnly: readOnly,
78
- timezone: timezone,
79
- unstableFieldRef: unstableStartFieldRef,
80
- value: valueProp === undefined ? undefined : valueProp[0],
81
- defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
82
- onChange: handleStartDateChange,
83
- selectedSections: selectedSections,
84
- onSelectedSectionsChange: onSelectedSectionsChange
85
- });
86
- var endFieldProps = _extends({
87
- error: !!validationError[1]
88
- }, endTextFieldProps, {
89
- format: format,
90
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
91
- disabled: disabled,
92
- readOnly: readOnly,
93
- timezone: timezone,
94
- unstableFieldRef: unstableEndFieldRef,
95
- value: valueProp === undefined ? undefined : valueProp[1],
96
- defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
97
- onChange: handleEndDateChange,
98
- selectedSections: selectedSections,
99
- onSelectedSectionsChange: onSelectedSectionsChange
100
- });
101
- var startDateResponse = useTimeField(startFieldProps);
102
- var endDateResponse = useTimeField(endFieldProps);
103
-
104
- /* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
105
- return {
106
- startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
107
- endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
108
- };
109
- };
@@ -1,39 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import * as React from 'react';
3
- import useControlled from '@mui/utils/useControlled';
4
- import useEventCallback from '@mui/utils/useEventCallback';
5
- export var useRangePosition = function useRangePosition(props) {
6
- var _props$defaultRangePo;
7
- var singleInputFieldRef = React.useRef();
8
- var _useControlled = useControlled({
9
- name: 'useRangePosition',
10
- state: 'rangePosition',
11
- controlled: props.rangePosition,
12
- default: (_props$defaultRangePo = props.defaultRangePosition) != null ? _props$defaultRangePo : 'start'
13
- }),
14
- _useControlled2 = _slicedToArray(_useControlled, 2),
15
- rangePosition = _useControlled2[0],
16
- setRangePosition = _useControlled2[1];
17
-
18
- // When using a single input field,
19
- // we want to select the 1st section of the edited date when updating the range position.
20
- var syncRangePositionWithSingleInputField = function syncRangePositionWithSingleInputField(newRangePosition) {
21
- if (singleInputFieldRef.current == null) {
22
- return;
23
- }
24
- var sections = singleInputFieldRef.current.getSections();
25
- var targetActiveSectionIndex = newRangePosition === 'start' ? 0 : sections.length / 2;
26
- singleInputFieldRef.current.setSelectedSections(targetActiveSectionIndex);
27
- };
28
- var handleRangePositionChange = useEventCallback(function (newRangePosition) {
29
- var _props$onRangePositio;
30
- setRangePosition(newRangePosition);
31
- (_props$onRangePositio = props.onRangePositionChange) == null || _props$onRangePositio.call(props, newRangePosition);
32
- syncRangePositionWithSingleInputField(newRangePosition);
33
- });
34
- return {
35
- rangePosition: rangePosition,
36
- onRangePositionChange: handleRangePositionChange,
37
- singleInputFieldRef: singleInputFieldRef
38
- };
39
- };
@@ -1 +0,0 @@
1
- export { useStaticRangePicker } from './useStaticRangePicker';
@@ -1,76 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["props", "ref"];
5
- import * as React from 'react';
6
- import clsx from 'clsx';
7
- import { styled } from '@mui/material/styles';
8
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
9
- import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
10
- import { usePicker, DIALOG_WIDTH } from '@mui/x-date-pickers/internals';
11
- import { useRangePosition } from '../useRangePosition';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- var PickerStaticLayout = styled(PickersLayout)(function (_ref) {
14
- var theme = _ref.theme;
15
- return {
16
- overflow: 'hidden',
17
- minWidth: DIALOG_WIDTH,
18
- backgroundColor: (theme.vars || theme).palette.background.paper
19
- };
20
- });
21
-
22
- /**
23
- * Hook managing all the range static pickers:
24
- * - StaticDateRangePicker
25
- */
26
- export var useStaticRangePicker = function useStaticRangePicker(_ref2) {
27
- var _slots$layout;
28
- var props = _ref2.props,
29
- ref = _ref2.ref,
30
- pickerParams = _objectWithoutProperties(_ref2, _excluded);
31
- var localeText = props.localeText,
32
- slots = props.slots,
33
- slotProps = props.slotProps,
34
- className = props.className,
35
- sx = props.sx,
36
- displayStaticWrapperAs = props.displayStaticWrapperAs,
37
- autoFocus = props.autoFocus;
38
- var _useRangePosition = useRangePosition(props),
39
- rangePosition = _useRangePosition.rangePosition,
40
- onRangePositionChange = _useRangePosition.onRangePositionChange;
41
- var _usePicker = usePicker(_extends({}, pickerParams, {
42
- props: props,
43
- autoFocusView: autoFocus != null ? autoFocus : false,
44
- additionalViewProps: {
45
- rangePosition: rangePosition,
46
- onRangePositionChange: onRangePositionChange
47
- },
48
- wrapperVariant: displayStaticWrapperAs
49
- })),
50
- layoutProps = _usePicker.layoutProps,
51
- renderCurrentView = _usePicker.renderCurrentView;
52
- var Layout = (_slots$layout = slots == null ? void 0 : slots.layout) != null ? _slots$layout : PickerStaticLayout;
53
- var slotPropsForLayout = _extends({}, slotProps, {
54
- toolbar: _extends({}, slotProps == null ? void 0 : slotProps.toolbar, {
55
- rangePosition: rangePosition,
56
- onRangePositionChange: onRangePositionChange
57
- })
58
- });
59
- var renderPicker = function renderPicker() {
60
- var _slotProps$layout, _slotProps$layout2, _slotProps$layout3;
61
- return /*#__PURE__*/_jsx(LocalizationProvider, {
62
- localeText: localeText,
63
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
64
- slots: slots,
65
- slotProps: slotPropsForLayout,
66
- sx: [].concat(_toConsumableArray(Array.isArray(sx) ? sx : [sx]), _toConsumableArray(Array.isArray(slotProps == null || (_slotProps$layout = slotProps.layout) == null ? void 0 : _slotProps$layout.sx) ? slotProps.layout.sx : [slotProps == null || (_slotProps$layout2 = slotProps.layout) == null ? void 0 : _slotProps$layout2.sx])),
67
- className: clsx(className, slotProps == null || (_slotProps$layout3 = slotProps.layout) == null ? void 0 : _slotProps$layout3.className),
68
- ref: ref,
69
- children: renderCurrentView()
70
- }))
71
- });
72
- };
73
- return {
74
- renderPicker: renderPicker
75
- };
76
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export * from './dateRange';
2
- export * from './dateTimeRange';
3
- export * from './timeRange';
4
- export * from './fields';
5
- export * from './rangePickerProps';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- export var splitDateRangeSections = function splitDateRangeSections(sections) {
3
- var startDateSections = [];
4
- var endDateSections = [];
5
- sections.forEach(function (section) {
6
- if (section.dateName === 'start') {
7
- startDateSections.push(section);
8
- } else {
9
- endDateSections.push(section);
10
- }
11
- });
12
- return {
13
- startDate: startDateSections,
14
- endDate: endDateSections
15
- };
16
- };
17
- export var removeLastSeparator = function removeLastSeparator(dateSections) {
18
- return dateSections.map(function (section, sectionIndex) {
19
- if (sectionIndex === dateSections.length - 1) {
20
- return _extends({}, section, {
21
- separator: null
22
- });
23
- }
24
- return section;
25
- });
26
- };