@mui/x-date-pickers 6.2.0 → 6.3.0

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 (637) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +109 -0
  2. package/AdapterDateFns/AdapterDateFns.js +598 -0
  3. package/AdapterDateFns/index.d.ts +1 -13
  4. package/AdapterDateFns/index.js +1 -149
  5. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +109 -0
  6. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +610 -0
  7. package/AdapterDateFnsJalali/index.d.ts +1 -13
  8. package/AdapterDateFnsJalali/index.js +1 -149
  9. package/AdapterDayjs/AdapterDayjs.d.ts +53 -53
  10. package/AdapterDayjs/AdapterDayjs.js +146 -111
  11. package/AdapterLuxon/AdapterLuxon.d.ts +108 -0
  12. package/AdapterLuxon/AdapterLuxon.js +513 -0
  13. package/AdapterLuxon/index.d.ts +1 -14
  14. package/AdapterLuxon/index.js +1 -111
  15. package/AdapterMoment/AdapterMoment.d.ts +110 -0
  16. package/AdapterMoment/AdapterMoment.js +416 -0
  17. package/AdapterMoment/index.d.ts +1 -21
  18. package/AdapterMoment/index.js +1 -99
  19. package/AdapterMomentHijri/AdapterMomentHijri.d.ts +67 -0
  20. package/AdapterMomentHijri/AdapterMomentHijri.js +269 -0
  21. package/AdapterMomentHijri/index.d.ts +1 -18
  22. package/AdapterMomentHijri/index.js +1 -74
  23. package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +74 -0
  24. package/AdapterMomentJalaali/AdapterMomentJalaali.js +276 -0
  25. package/AdapterMomentJalaali/index.d.ts +1 -22
  26. package/AdapterMomentJalaali/index.js +1 -87
  27. package/CHANGELOG.md +118 -1
  28. package/DateCalendar/DateCalendar.types.d.ts +1 -1
  29. package/DateCalendar/DayCalendar.d.ts +1 -1
  30. package/DateCalendar/DayCalendar.js +1 -1
  31. package/DateCalendar/PickersCalendarHeader.d.ts +1 -1
  32. package/DateCalendar/useCalendarState.js +1 -1
  33. package/DateCalendar/useIsDateDisabled.d.ts +2 -0
  34. package/DateCalendar/useIsDateDisabled.js +27 -0
  35. package/DateField/DateField.js +20 -3
  36. package/DateField/DateField.types.d.ts +2 -2
  37. package/DateField/useDateField.js +4 -2
  38. package/DatePicker/DatePickerToolbar.js +1 -1
  39. package/DateTimeField/DateTimeField.js +21 -3
  40. package/DateTimeField/DateTimeField.types.d.ts +3 -2
  41. package/DateTimeField/useDateTimeField.js +4 -2
  42. package/DateTimePicker/DateTimePicker.js +1 -0
  43. package/DateTimePicker/shared.d.ts +6 -5
  44. package/DesktopDatePicker/DesktopDatePicker.js +2 -1
  45. package/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
  46. package/DesktopTimePicker/DesktopTimePicker.js +51 -8
  47. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +12 -4
  48. package/DigitalClock/DigitalClock.d.ts +7 -0
  49. package/DigitalClock/DigitalClock.js +397 -0
  50. package/DigitalClock/DigitalClock.types.d.ts +47 -0
  51. package/DigitalClock/digitalClockClasses.d.ts +11 -0
  52. package/DigitalClock/digitalClockClasses.js +6 -0
  53. package/DigitalClock/index.d.ts +4 -0
  54. package/DigitalClock/index.js +2 -0
  55. package/DigitalClock/package.json +6 -0
  56. package/LocalizationProvider/LocalizationProvider.d.ts +1 -1
  57. package/LocalizationProvider/LocalizationProvider.js +1 -1
  58. package/MobileDatePicker/MobileDatePicker.js +2 -1
  59. package/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
  60. package/MobileTimePicker/MobileTimePicker.js +3 -1
  61. package/MobileTimePicker/MobileTimePicker.types.d.ts +8 -7
  62. package/MonthCalendar/MonthCalendar.types.d.ts +1 -1
  63. package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +7 -0
  64. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
  65. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +57 -0
  66. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +22 -0
  67. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  68. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +28 -0
  69. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +151 -0
  70. package/MultiSectionDigitalClock/index.d.ts +7 -0
  71. package/MultiSectionDigitalClock/index.js +3 -0
  72. package/MultiSectionDigitalClock/multiSectionDigitalClockClasses.d.ts +7 -0
  73. package/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  74. package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.d.ts +9 -0
  75. package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  76. package/MultiSectionDigitalClock/package.json +6 -0
  77. package/PickersDay/PickersDay.js +4 -1
  78. package/PickersLayout/PickersLayout.d.ts +2 -2
  79. package/PickersLayout/PickersLayout.js +2 -2
  80. package/PickersLayout/PickersLayout.types.d.ts +7 -8
  81. package/PickersLayout/usePickerLayout.d.ts +2 -2
  82. package/README.md +0 -9
  83. package/StaticDatePicker/StaticDatePicker.js +1 -0
  84. package/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
  85. package/StaticTimePicker/StaticTimePicker.js +5 -3
  86. package/StaticTimePicker/StaticTimePicker.types.d.ts +1 -1
  87. package/TimeClock/TimeClock.js +35 -12
  88. package/TimeClock/TimeClock.types.d.ts +4 -67
  89. package/TimeField/TimeField.js +21 -3
  90. package/TimeField/TimeField.types.d.ts +3 -2
  91. package/TimeField/useTimeField.js +4 -2
  92. package/TimePicker/TimePicker.js +25 -2
  93. package/TimePicker/TimePicker.types.d.ts +4 -3
  94. package/TimePicker/TimePickerToolbar.d.ts +2 -2
  95. package/TimePicker/TimePickerToolbar.js +2 -2
  96. package/TimePicker/shared.d.ts +9 -7
  97. package/YearCalendar/YearCalendar.types.d.ts +1 -1
  98. package/dateViewRenderers/dateViewRenderers.d.ts +2 -2
  99. package/index.d.ts +2 -0
  100. package/index.js +4 -1
  101. package/internals/components/PickersToolbar.d.ts +3 -3
  102. package/internals/constants/dimensions.d.ts +1 -0
  103. package/internals/constants/dimensions.js +2 -1
  104. package/internals/demo/DemoContainer.js +4 -1
  105. package/internals/hooks/date-helpers-hooks.d.ts +3 -2
  106. package/internals/hooks/date-helpers-hooks.js +3 -3
  107. package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +2 -2
  108. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -15
  109. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -6
  110. package/internals/hooks/useField/useField.js +12 -11
  111. package/internals/hooks/useField/useField.types.d.ts +19 -5
  112. package/internals/hooks/useField/useField.utils.d.ts +9 -6
  113. package/internals/hooks/useField/useField.utils.js +60 -34
  114. package/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  115. package/internals/hooks/useField/useFieldState.js +5 -4
  116. package/internals/hooks/useIsLandscape.d.ts +2 -2
  117. package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +2 -2
  118. package/internals/hooks/useMobilePicker/useMobilePicker.js +10 -10
  119. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -6
  120. package/internals/hooks/usePicker/usePicker.d.ts +4 -3
  121. package/internals/hooks/usePicker/usePicker.js +2 -0
  122. package/internals/hooks/usePicker/usePicker.types.d.ts +6 -5
  123. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +5 -6
  124. package/internals/hooks/usePicker/usePickerValue.d.ts +2 -2
  125. package/internals/hooks/usePicker/usePickerValue.js +10 -12
  126. package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -3
  127. package/internals/hooks/usePicker/usePickerViews.d.ts +11 -11
  128. package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +2 -2
  129. package/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
  130. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -5
  131. package/internals/hooks/{validation/useValidation.d.ts → useValidation.d.ts} +1 -1
  132. package/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  133. package/internals/hooks/useViews.d.ts +8 -6
  134. package/internals/hooks/useViews.js +29 -13
  135. package/internals/index.d.ts +7 -7
  136. package/internals/index.js +5 -5
  137. package/internals/models/common.d.ts +3 -0
  138. package/internals/models/index.d.ts +1 -0
  139. package/internals/models/index.js +2 -1
  140. package/internals/models/props/basePickerProps.d.ts +3 -3
  141. package/internals/models/props/clock.d.ts +88 -0
  142. package/internals/models/props/tabs.d.ts +2 -2
  143. package/internals/models/props/toolbar.d.ts +3 -3
  144. package/internals/{hooks/validation/models.d.ts → models/validation.d.ts} +2 -5
  145. package/internals/models/validation.js +1 -0
  146. package/internals/utils/time-utils.d.ts +7 -7
  147. package/internals/utils/time-utils.js +2 -1
  148. package/internals/{hooks/validation/useDateValidation.d.ts → utils/validation/validateDate.d.ts} +2 -3
  149. package/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
  150. package/internals/{hooks/validation/useDateTimeValidation.d.ts → utils/validation/validateDateTime.d.ts} +3 -3
  151. package/{modern/internals/hooks/validation/useDateTimeValidation.js → internals/utils/validation/validateDateTime.js} +2 -2
  152. package/internals/{hooks/validation/useTimeValidation.d.ts → utils/validation/validateTime.d.ts} +2 -2
  153. package/{modern/internals/hooks/validation/useTimeValidation.js → internals/utils/validation/validateTime.js} +1 -1
  154. package/internals/utils/valueManagers.js +1 -1
  155. package/internals/utils/views.d.ts +3 -2
  156. package/legacy/AdapterDateFns/AdapterDateFns.js +606 -0
  157. package/legacy/AdapterDateFns/index.js +1 -165
  158. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +620 -0
  159. package/legacy/AdapterDateFnsJalali/index.js +1 -165
  160. package/legacy/AdapterDayjs/AdapterDayjs.js +146 -111
  161. package/legacy/AdapterLuxon/AdapterLuxon.js +524 -0
  162. package/legacy/AdapterLuxon/index.js +1 -127
  163. package/legacy/AdapterMoment/AdapterMoment.js +422 -0
  164. package/legacy/AdapterMoment/index.js +1 -115
  165. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +284 -0
  166. package/legacy/AdapterMomentHijri/index.js +1 -90
  167. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +291 -0
  168. package/legacy/AdapterMomentJalaali/index.js +1 -103
  169. package/legacy/DateCalendar/DayCalendar.js +1 -1
  170. package/legacy/DateCalendar/useCalendarState.js +1 -1
  171. package/legacy/DateCalendar/useIsDateDisabled.js +28 -0
  172. package/legacy/DateField/DateField.js +20 -3
  173. package/legacy/DateField/useDateField.js +4 -2
  174. package/legacy/DatePicker/DatePickerToolbar.js +1 -1
  175. package/legacy/DateTimeField/DateTimeField.js +21 -3
  176. package/legacy/DateTimeField/useDateTimeField.js +4 -2
  177. package/legacy/DateTimePicker/DateTimePicker.js +1 -0
  178. package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -1
  179. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
  180. package/legacy/DesktopTimePicker/DesktopTimePicker.js +52 -8
  181. package/legacy/DigitalClock/DigitalClock.js +419 -0
  182. package/legacy/DigitalClock/DigitalClock.types.js +1 -0
  183. package/legacy/DigitalClock/digitalClockClasses.js +6 -0
  184. package/legacy/DigitalClock/index.js +2 -0
  185. package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
  186. package/legacy/MobileDatePicker/MobileDatePicker.js +2 -1
  187. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
  188. package/legacy/MobileTimePicker/MobileTimePicker.js +3 -1
  189. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +508 -0
  190. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
  191. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  192. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +157 -0
  193. package/legacy/MultiSectionDigitalClock/index.js +3 -0
  194. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  195. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  196. package/legacy/PickersDay/PickersDay.js +3 -1
  197. package/legacy/PickersLayout/PickersLayout.js +2 -2
  198. package/legacy/StaticDatePicker/StaticDatePicker.js +1 -0
  199. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
  200. package/legacy/StaticTimePicker/StaticTimePicker.js +5 -3
  201. package/legacy/TimeClock/TimeClock.js +35 -12
  202. package/legacy/TimeField/TimeField.js +21 -3
  203. package/legacy/TimeField/useTimeField.js +4 -2
  204. package/legacy/TimePicker/TimePicker.js +25 -2
  205. package/legacy/TimePicker/TimePickerToolbar.js +2 -2
  206. package/legacy/index.js +4 -1
  207. package/legacy/internals/constants/dimensions.js +2 -1
  208. package/legacy/internals/demo/DemoContainer.js +4 -1
  209. package/legacy/internals/hooks/date-helpers-hooks.js +3 -3
  210. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +10 -11
  211. package/legacy/internals/hooks/useField/useField.js +11 -10
  212. package/legacy/internals/hooks/useField/useField.utils.js +58 -34
  213. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  214. package/legacy/internals/hooks/useField/useFieldState.js +7 -5
  215. package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +5 -6
  216. package/legacy/internals/hooks/usePicker/usePicker.js +2 -0
  217. package/legacy/internals/hooks/usePicker/usePickerValue.js +10 -14
  218. package/legacy/internals/hooks/useStaticPicker/useStaticPicker.js +7 -8
  219. package/legacy/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  220. package/legacy/internals/hooks/useViews.js +30 -14
  221. package/legacy/internals/index.js +5 -5
  222. package/legacy/internals/models/index.js +2 -1
  223. package/legacy/internals/models/props/clock.js +1 -0
  224. package/legacy/internals/models/validation.js +1 -0
  225. package/legacy/internals/utils/time-utils.js +2 -1
  226. package/legacy/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -28
  227. package/legacy/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +2 -2
  228. package/legacy/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
  229. package/legacy/internals/utils/valueManagers.js +2 -2
  230. package/legacy/locales/beBY.js +5 -3
  231. package/legacy/locales/caES.js +6 -1
  232. package/legacy/locales/csCZ.js +6 -4
  233. package/legacy/locales/daDK.js +6 -2
  234. package/legacy/locales/deDE.js +6 -2
  235. package/legacy/locales/enUS.js +4 -0
  236. package/legacy/locales/esES.js +6 -1
  237. package/legacy/locales/faIR.js +11 -1
  238. package/legacy/locales/fiFI.js +6 -1
  239. package/legacy/locales/frFR.js +6 -1
  240. package/legacy/locales/heIL.js +6 -1
  241. package/legacy/locales/huHU.js +6 -2
  242. package/legacy/locales/index.js +1 -0
  243. package/legacy/locales/isIS.js +11 -1
  244. package/legacy/locales/itIT.js +6 -1
  245. package/legacy/locales/jaJP.js +6 -2
  246. package/legacy/locales/koKR.js +6 -1
  247. package/legacy/locales/kzKZ.js +6 -2
  248. package/legacy/locales/nbNO.js +11 -1
  249. package/legacy/locales/nlNL.js +11 -1
  250. package/legacy/locales/plPL.js +11 -1
  251. package/legacy/locales/ptBR.js +11 -1
  252. package/legacy/locales/ruRU.js +6 -2
  253. package/legacy/locales/svSE.js +11 -1
  254. package/legacy/locales/trTR.js +22 -7
  255. package/legacy/locales/ukUA.js +11 -1
  256. package/legacy/locales/urPK.js +11 -1
  257. package/legacy/locales/zhCN.js +44 -23
  258. package/legacy/models/common.js +1 -0
  259. package/legacy/models/index.js +2 -1
  260. package/legacy/tests/describeAdapters/describeAdapters.js +1 -3
  261. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  262. package/legacy/tests/describeGregorianAdapter/testCalculations.js +29 -26
  263. package/legacy/tests/describeGregorianAdapter/testLocalization.js +2 -2
  264. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  265. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  266. package/legacy/tests/describeHijriAdapter/index.js +1 -0
  267. package/legacy/tests/describeHijriAdapter/testCalculations.js +94 -0
  268. package/legacy/tests/describeHijriAdapter/testLocalization.js +12 -0
  269. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  270. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  271. package/legacy/tests/describeJalaliAdapter/index.js +1 -0
  272. package/legacy/tests/describeJalaliAdapter/testCalculations.js +82 -0
  273. package/legacy/tests/describeJalaliAdapter/testLocalization.js +12 -0
  274. package/legacy/tests/describePicker/describePicker.js +159 -0
  275. package/legacy/tests/describePicker/describePicker.types.js +1 -0
  276. package/legacy/tests/describePicker/index.js +1 -0
  277. package/legacy/tests/describeValue/describeValue.js +1 -1
  278. package/legacy/tests/describeValue/testControlledUnControlled.js +8 -9
  279. package/legacy/tests/describeValue/testPickerActionBar.js +46 -13
  280. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  281. package/legacy/timeViewRenderers/index.js +1 -1
  282. package/legacy/timeViewRenderers/timeViewRenderers.js +132 -4
  283. package/locales/beBY.d.ts +4 -2
  284. package/locales/beBY.js +3 -3
  285. package/locales/caES.d.ts +4 -2
  286. package/locales/caES.js +4 -1
  287. package/locales/csCZ.d.ts +4 -2
  288. package/locales/csCZ.js +4 -4
  289. package/locales/daDK.d.ts +4 -2
  290. package/locales/daDK.js +4 -2
  291. package/locales/deDE.d.ts +4 -2
  292. package/locales/deDE.js +4 -2
  293. package/locales/enUS.d.ts +3 -2
  294. package/locales/enUS.js +2 -0
  295. package/locales/esES.d.ts +4 -2
  296. package/locales/esES.js +4 -1
  297. package/locales/faIR.d.ts +4 -2
  298. package/locales/faIR.js +9 -1
  299. package/locales/fiFI.d.ts +4 -2
  300. package/locales/fiFI.js +4 -1
  301. package/locales/frFR.d.ts +4 -2
  302. package/locales/frFR.js +4 -1
  303. package/locales/heIL.d.ts +4 -2
  304. package/locales/heIL.js +4 -1
  305. package/locales/huHU.d.ts +4 -2
  306. package/locales/huHU.js +4 -2
  307. package/locales/index.d.ts +1 -0
  308. package/locales/index.js +1 -0
  309. package/locales/isIS.d.ts +4 -2
  310. package/locales/isIS.js +9 -1
  311. package/locales/itIT.d.ts +4 -2
  312. package/locales/itIT.js +4 -1
  313. package/locales/jaJP.d.ts +4 -2
  314. package/locales/jaJP.js +4 -2
  315. package/locales/koKR.d.ts +4 -2
  316. package/locales/koKR.js +4 -1
  317. package/locales/kzKZ.d.ts +4 -2
  318. package/locales/kzKZ.js +4 -2
  319. package/locales/nbNO.d.ts +4 -2
  320. package/locales/nbNO.js +9 -1
  321. package/locales/nlNL.d.ts +8 -7
  322. package/locales/nlNL.js +9 -1
  323. package/locales/plPL.d.ts +4 -2
  324. package/locales/plPL.js +9 -1
  325. package/locales/ptBR.d.ts +4 -2
  326. package/locales/ptBR.js +9 -1
  327. package/locales/ruRU.d.ts +4 -2
  328. package/locales/ruRU.js +4 -2
  329. package/locales/svSE.d.ts +4 -2
  330. package/locales/svSE.js +9 -1
  331. package/locales/trTR.d.ts +4 -2
  332. package/locales/trTR.js +14 -7
  333. package/locales/ukUA.d.ts +4 -2
  334. package/locales/ukUA.js +9 -1
  335. package/locales/urPK.d.ts +4 -2
  336. package/locales/urPK.js +9 -1
  337. package/locales/utils/getPickersLocalization.d.ts +3 -2
  338. package/locales/utils/pickersLocaleTextApi.d.ts +5 -3
  339. package/locales/zhCN.d.ts +4 -2
  340. package/locales/zhCN.js +22 -23
  341. package/models/adapters.d.ts +7 -6
  342. package/models/common.d.ts +5 -0
  343. package/models/common.js +1 -0
  344. package/models/fields.d.ts +20 -2
  345. package/models/index.d.ts +1 -0
  346. package/models/index.js +2 -1
  347. package/modern/AdapterDateFns/AdapterDateFns.js +597 -0
  348. package/modern/AdapterDateFns/index.js +1 -149
  349. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +608 -0
  350. package/modern/AdapterDateFnsJalali/index.js +1 -148
  351. package/modern/AdapterDayjs/AdapterDayjs.js +146 -111
  352. package/modern/AdapterLuxon/AdapterLuxon.js +512 -0
  353. package/modern/AdapterLuxon/index.js +1 -111
  354. package/modern/AdapterMoment/AdapterMoment.js +416 -0
  355. package/modern/AdapterMoment/index.js +1 -99
  356. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +269 -0
  357. package/modern/AdapterMomentHijri/index.js +1 -74
  358. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +276 -0
  359. package/modern/AdapterMomentJalaali/index.js +1 -87
  360. package/modern/DateCalendar/DayCalendar.js +1 -1
  361. package/modern/DateCalendar/useCalendarState.js +1 -1
  362. package/modern/DateCalendar/useIsDateDisabled.js +27 -0
  363. package/modern/DateField/DateField.js +20 -3
  364. package/modern/DateField/useDateField.js +4 -2
  365. package/modern/DatePicker/DatePickerToolbar.js +1 -1
  366. package/modern/DateTimeField/DateTimeField.js +21 -3
  367. package/modern/DateTimeField/useDateTimeField.js +4 -2
  368. package/modern/DateTimePicker/DateTimePicker.js +1 -0
  369. package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -1
  370. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -1
  371. package/modern/DesktopTimePicker/DesktopTimePicker.js +50 -7
  372. package/modern/DigitalClock/DigitalClock.js +396 -0
  373. package/modern/DigitalClock/DigitalClock.types.js +1 -0
  374. package/modern/DigitalClock/digitalClockClasses.js +6 -0
  375. package/modern/DigitalClock/index.js +2 -0
  376. package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
  377. package/modern/MobileDatePicker/MobileDatePicker.js +2 -1
  378. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +3 -1
  379. package/modern/MobileTimePicker/MobileTimePicker.js +3 -1
  380. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
  381. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
  382. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  383. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +149 -0
  384. package/modern/MultiSectionDigitalClock/index.js +3 -0
  385. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  386. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  387. package/modern/PickersDay/PickersDay.js +4 -1
  388. package/modern/PickersLayout/PickersLayout.js +2 -2
  389. package/modern/StaticDatePicker/StaticDatePicker.js +1 -0
  390. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
  391. package/modern/StaticTimePicker/StaticTimePicker.js +5 -3
  392. package/modern/TimeClock/TimeClock.js +35 -12
  393. package/modern/TimeField/TimeField.js +21 -3
  394. package/modern/TimeField/useTimeField.js +4 -2
  395. package/modern/TimePicker/TimePicker.js +25 -2
  396. package/modern/TimePicker/TimePickerToolbar.js +2 -2
  397. package/modern/index.js +4 -1
  398. package/modern/internals/constants/dimensions.js +2 -1
  399. package/modern/internals/demo/DemoContainer.js +4 -1
  400. package/modern/internals/hooks/date-helpers-hooks.js +3 -3
  401. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -15
  402. package/modern/internals/hooks/useField/useField.js +12 -11
  403. package/modern/internals/hooks/useField/useField.utils.js +60 -34
  404. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  405. package/modern/internals/hooks/useField/useFieldState.js +5 -4
  406. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +10 -10
  407. package/modern/internals/hooks/usePicker/usePicker.js +2 -0
  408. package/modern/internals/hooks/usePicker/usePickerValue.js +10 -12
  409. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
  410. package/modern/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  411. package/modern/internals/hooks/useViews.js +29 -13
  412. package/modern/internals/index.js +5 -5
  413. package/modern/internals/models/index.js +2 -1
  414. package/modern/internals/models/props/clock.js +1 -0
  415. package/modern/internals/models/validation.js +1 -0
  416. package/modern/internals/utils/time-utils.js +2 -1
  417. package/modern/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
  418. package/{internals/hooks/validation/useDateTimeValidation.js → modern/internals/utils/validation/validateDateTime.js} +2 -2
  419. package/{internals/hooks/validation/useTimeValidation.js → modern/internals/utils/validation/validateTime.js} +1 -1
  420. package/modern/internals/utils/valueManagers.js +1 -1
  421. package/modern/locales/beBY.js +3 -3
  422. package/modern/locales/caES.js +4 -1
  423. package/modern/locales/csCZ.js +4 -4
  424. package/modern/locales/daDK.js +4 -2
  425. package/modern/locales/deDE.js +4 -2
  426. package/modern/locales/enUS.js +2 -0
  427. package/modern/locales/esES.js +4 -1
  428. package/modern/locales/faIR.js +9 -1
  429. package/modern/locales/fiFI.js +4 -1
  430. package/modern/locales/frFR.js +4 -1
  431. package/modern/locales/heIL.js +4 -1
  432. package/modern/locales/huHU.js +4 -2
  433. package/modern/locales/index.js +1 -0
  434. package/modern/locales/isIS.js +9 -1
  435. package/modern/locales/itIT.js +4 -1
  436. package/modern/locales/jaJP.js +4 -2
  437. package/modern/locales/koKR.js +4 -1
  438. package/modern/locales/kzKZ.js +4 -2
  439. package/modern/locales/nbNO.js +9 -1
  440. package/modern/locales/nlNL.js +9 -1
  441. package/modern/locales/plPL.js +9 -1
  442. package/modern/locales/ptBR.js +9 -1
  443. package/modern/locales/ruRU.js +4 -2
  444. package/modern/locales/svSE.js +9 -1
  445. package/modern/locales/trTR.js +14 -7
  446. package/modern/locales/ukUA.js +9 -1
  447. package/modern/locales/urPK.js +9 -1
  448. package/modern/locales/zhCN.js +22 -23
  449. package/modern/models/common.js +1 -0
  450. package/modern/models/index.js +2 -1
  451. package/modern/tests/describeAdapters/describeAdapters.js +1 -3
  452. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  453. package/modern/tests/describeGregorianAdapter/testCalculations.js +29 -26
  454. package/modern/tests/describeGregorianAdapter/testLocalization.js +2 -2
  455. package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  456. package/modern/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  457. package/modern/tests/describeHijriAdapter/index.js +1 -0
  458. package/modern/tests/describeHijriAdapter/testCalculations.js +91 -0
  459. package/modern/tests/describeHijriAdapter/testLocalization.js +13 -0
  460. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  461. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  462. package/modern/tests/describeJalaliAdapter/index.js +1 -0
  463. package/modern/tests/describeJalaliAdapter/testCalculations.js +83 -0
  464. package/modern/tests/describeJalaliAdapter/testLocalization.js +13 -0
  465. package/modern/tests/describePicker/describePicker.js +162 -0
  466. package/modern/tests/describePicker/describePicker.types.js +1 -0
  467. package/modern/tests/describePicker/index.js +1 -0
  468. package/modern/tests/describeValue/describeValue.js +1 -1
  469. package/modern/tests/describeValue/testControlledUnControlled.js +8 -9
  470. package/modern/tests/describeValue/testPickerActionBar.js +46 -13
  471. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  472. package/modern/timeViewRenderers/index.js +1 -1
  473. package/modern/timeViewRenderers/timeViewRenderers.js +130 -2
  474. package/node/AdapterDateFns/AdapterDateFns.js +607 -0
  475. package/node/AdapterDateFns/index.js +6 -152
  476. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +618 -0
  477. package/node/AdapterDateFnsJalali/index.js +6 -151
  478. package/node/AdapterDayjs/AdapterDayjs.js +146 -111
  479. package/node/AdapterLuxon/AdapterLuxon.js +521 -0
  480. package/node/AdapterLuxon/index.js +6 -114
  481. package/node/AdapterMoment/AdapterMoment.js +425 -0
  482. package/node/AdapterMoment/index.js +6 -102
  483. package/node/AdapterMomentHijri/AdapterMomentHijri.js +278 -0
  484. package/node/AdapterMomentHijri/index.js +6 -77
  485. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +285 -0
  486. package/node/AdapterMomentJalaali/index.js +6 -90
  487. package/node/DateCalendar/DayCalendar.js +2 -2
  488. package/node/DateCalendar/useCalendarState.js +2 -2
  489. package/node/{internals/hooks/validation/useDateValidation.js → DateCalendar/useIsDateDisabled.js} +4 -37
  490. package/node/DateField/DateField.js +20 -3
  491. package/node/DateField/useDateField.js +5 -3
  492. package/node/DatePicker/DatePickerToolbar.js +1 -1
  493. package/node/DateTimeField/DateTimeField.js +21 -3
  494. package/node/DateTimeField/useDateTimeField.js +5 -3
  495. package/node/DateTimePicker/DateTimePicker.js +1 -0
  496. package/node/DesktopDatePicker/DesktopDatePicker.js +3 -2
  497. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +4 -2
  498. package/node/DesktopTimePicker/DesktopTimePicker.js +51 -8
  499. package/node/DigitalClock/DigitalClock.js +406 -0
  500. package/node/DigitalClock/digitalClockClasses.js +15 -0
  501. package/node/DigitalClock/index.js +25 -0
  502. package/node/LocalizationProvider/LocalizationProvider.js +1 -1
  503. package/node/MobileDatePicker/MobileDatePicker.js +3 -2
  504. package/node/MobileDateTimePicker/MobileDateTimePicker.js +4 -2
  505. package/node/MobileTimePicker/MobileTimePicker.js +4 -2
  506. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +489 -0
  507. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +5 -0
  508. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +73 -0
  509. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +159 -0
  510. package/node/MultiSectionDigitalClock/index.js +32 -0
  511. package/node/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +15 -0
  512. package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +15 -0
  513. package/node/PickersDay/PickersDay.js +4 -1
  514. package/node/PickersLayout/PickersLayout.js +2 -2
  515. package/node/StaticDatePicker/StaticDatePicker.js +1 -0
  516. package/node/StaticDateTimePicker/StaticDateTimePicker.js +5 -3
  517. package/node/StaticTimePicker/StaticTimePicker.js +5 -3
  518. package/node/TimeClock/TimeClock.js +35 -12
  519. package/node/TimeField/TimeField.js +21 -3
  520. package/node/TimeField/useTimeField.js +5 -3
  521. package/node/TimePicker/TimePicker.js +25 -2
  522. package/node/TimePicker/TimePickerToolbar.js +2 -2
  523. package/node/index.js +25 -1
  524. package/node/internals/constants/dimensions.js +4 -2
  525. package/node/internals/demo/DemoContainer.js +4 -1
  526. package/node/internals/hooks/date-helpers-hooks.js +3 -3
  527. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -15
  528. package/node/internals/hooks/useField/useField.js +12 -11
  529. package/node/internals/hooks/useField/useField.utils.js +63 -36
  530. package/node/internals/hooks/useField/useFieldCharacterEditing.js +17 -9
  531. package/node/internals/hooks/useField/useFieldState.js +5 -4
  532. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +10 -10
  533. package/node/internals/hooks/usePicker/usePicker.js +2 -0
  534. package/node/internals/hooks/usePicker/usePickerValue.js +10 -12
  535. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +10 -10
  536. package/node/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  537. package/node/internals/hooks/useViews.js +29 -13
  538. package/node/internals/index.js +9 -9
  539. package/node/internals/models/index.js +11 -0
  540. package/node/internals/models/props/clock.js +5 -0
  541. package/node/internals/models/validation.js +5 -0
  542. package/node/internals/utils/time-utils.js +2 -1
  543. package/node/internals/utils/validation/validateDate.js +40 -0
  544. package/node/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +4 -4
  545. package/node/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
  546. package/node/internals/utils/valueManagers.js +1 -1
  547. package/node/locales/beBY.js +3 -3
  548. package/node/locales/caES.js +4 -1
  549. package/node/locales/csCZ.js +4 -2
  550. package/node/locales/daDK.js +4 -1
  551. package/node/locales/deDE.js +4 -1
  552. package/node/locales/enUS.js +2 -0
  553. package/node/locales/esES.js +4 -1
  554. package/node/locales/faIR.js +9 -1
  555. package/node/locales/fiFI.js +4 -1
  556. package/node/locales/frFR.js +4 -1
  557. package/node/locales/heIL.js +4 -1
  558. package/node/locales/huHU.js +4 -1
  559. package/node/locales/index.js +11 -0
  560. package/node/locales/isIS.js +9 -1
  561. package/node/locales/itIT.js +4 -1
  562. package/node/locales/jaJP.js +4 -1
  563. package/node/locales/koKR.js +4 -1
  564. package/node/locales/kzKZ.js +4 -1
  565. package/node/locales/nbNO.js +9 -1
  566. package/node/locales/nlNL.js +9 -1
  567. package/node/locales/plPL.js +9 -1
  568. package/node/locales/ptBR.js +9 -1
  569. package/node/locales/ruRU.js +4 -1
  570. package/node/locales/svSE.js +9 -1
  571. package/node/locales/trTR.js +14 -7
  572. package/node/locales/ukUA.js +9 -1
  573. package/node/locales/urPK.js +9 -1
  574. package/node/locales/zhCN.js +22 -23
  575. package/node/models/common.js +5 -0
  576. package/node/models/index.js +11 -0
  577. package/node/tests/describeAdapters/describeAdapters.js +1 -3
  578. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  579. package/node/tests/describeGregorianAdapter/testCalculations.js +29 -26
  580. package/node/tests/describeGregorianAdapter/testLocalization.js +2 -2
  581. package/node/tests/describeHijriAdapter/describeHijriAdapter.js +31 -0
  582. package/node/tests/describeHijriAdapter/describeHijriAdapter.types.js +5 -0
  583. package/node/tests/describeHijriAdapter/index.js +12 -0
  584. package/node/tests/describeHijriAdapter/testCalculations.js +98 -0
  585. package/node/tests/describeHijriAdapter/testLocalization.js +20 -0
  586. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +33 -0
  587. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +5 -0
  588. package/node/tests/describeJalaliAdapter/index.js +12 -0
  589. package/node/tests/describeJalaliAdapter/testCalculations.js +90 -0
  590. package/node/tests/describeJalaliAdapter/testLocalization.js +20 -0
  591. package/node/tests/describePicker/describePicker.js +173 -0
  592. package/node/tests/describePicker/describePicker.types.js +5 -0
  593. package/node/tests/describePicker/index.js +12 -0
  594. package/node/tests/describeValue/describeValue.js +1 -1
  595. package/node/tests/describeValue/testControlledUnControlled.js +8 -9
  596. package/node/tests/describeValue/testPickerActionBar.js +46 -13
  597. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  598. package/node/timeViewRenderers/index.js +12 -0
  599. package/node/timeViewRenderers/timeViewRenderers.js +134 -4
  600. package/package.json +3 -10
  601. package/tests/describeAdapters/describeAdapters.js +1 -3
  602. package/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  603. package/tests/describeGregorianAdapter/testCalculations.js +29 -26
  604. package/tests/describeGregorianAdapter/testLocalization.js +2 -2
  605. package/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  606. package/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  607. package/tests/describeHijriAdapter/index.js +1 -0
  608. package/tests/describeHijriAdapter/testCalculations.js +91 -0
  609. package/tests/describeHijriAdapter/testLocalization.js +13 -0
  610. package/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  611. package/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  612. package/tests/describeJalaliAdapter/index.js +1 -0
  613. package/tests/describeJalaliAdapter/testCalculations.js +83 -0
  614. package/tests/describeJalaliAdapter/testLocalization.js +13 -0
  615. package/tests/describePicker/describePicker.js +162 -0
  616. package/tests/describePicker/describePicker.types.js +1 -0
  617. package/tests/describePicker/index.js +1 -0
  618. package/tests/describeValue/describeValue.js +1 -1
  619. package/tests/describeValue/testControlledUnControlled.js +8 -9
  620. package/tests/describeValue/testPickerActionBar.js +46 -13
  621. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  622. package/themeAugmentation/components.d.ts +12 -0
  623. package/themeAugmentation/overrides.d.ts +8 -0
  624. package/themeAugmentation/props.d.ts +8 -0
  625. package/timeViewRenderers/index.d.ts +1 -1
  626. package/timeViewRenderers/index.js +1 -1
  627. package/timeViewRenderers/timeViewRenderers.d.ts +11 -4
  628. package/timeViewRenderers/timeViewRenderers.js +130 -2
  629. /package/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
  630. /package/{legacy/internals/hooks/validation/models.js → MultiSectionDigitalClock/MultiSectionDigitalClock.types.js} +0 -0
  631. /package/{modern/internals/hooks/validation/models.js → internals/models/props/clock.js} +0 -0
  632. /package/internals/utils/{validation.d.ts → validation/extractValidationProps.d.ts} +0 -0
  633. /package/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
  634. /package/legacy/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
  635. /package/modern/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
  636. /package/node/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
  637. /package/node/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
@@ -1,5 +1,5 @@
1
- import { validateDate } from './useDateValidation';
2
- import { validateTime } from './useTimeValidation';
1
+ import { validateDate } from './validateDate';
2
+ import { validateTime } from './validateTime';
3
3
  export const validateDateTime = ({
4
4
  props,
5
5
  value,
@@ -1,5 +1,5 @@
1
- import { Validator } from './useValidation';
2
- import { BaseTimeValidationProps, TimeValidationProps } from './models';
1
+ import { Validator } from '../../hooks/useValidation';
2
+ import { BaseTimeValidationProps, TimeValidationProps } from '../../models/validation';
3
3
  import { TimeValidationError } from '../../../models';
4
4
  export interface TimeComponentValidationProps<TDate> extends Required<BaseTimeValidationProps>, TimeValidationProps<TDate> {
5
5
  }
@@ -1,4 +1,4 @@
1
- import { createIsAfterIgnoreDatePart } from '../../utils/time-utils';
1
+ import { createIsAfterIgnoreDatePart } from '../time-utils';
2
2
  export const validateTime = ({
3
3
  adapter,
4
4
  value,
@@ -2,7 +2,7 @@ import { areDatesEqual, replaceInvalidDateByNull } from './date-utils';
2
2
  import { addPositionPropertiesToSections, createDateStrForInputFromSections } from '../hooks/useField/useField.utils';
3
3
  export const singleItemValueManager = {
4
4
  emptyValue: null,
5
- getTodayValue: utils => utils.date(),
5
+ getTodayValue: (utils, valueType) => valueType === 'date' ? utils.startOfDay(utils.date()) : utils.date(),
6
6
  cleanValue: replaceInvalidDateByNull,
7
7
  areValuesEqual: areDatesEqual,
8
8
  isSameError: (a, b) => a === b,
@@ -1,7 +1,8 @@
1
- import { DateOrTimeView, DateView } from '../../models';
1
+ import { DateView } from '../../models';
2
+ import { DateOrTimeViewWithMeridiem } from '../models';
2
3
  export declare const isYearOnlyView: (views: readonly DateView[]) => views is readonly "year"[];
3
4
  export declare const isYearAndMonthViews: (views: readonly DateView[]) => views is readonly ("month" | "year")[];
4
- export declare const applyDefaultViewProps: <TView extends DateOrTimeView>({ openTo, defaultOpenTo, views, defaultViews, }: {
5
+ export declare const applyDefaultViewProps: <TView extends DateOrTimeViewWithMeridiem>({ openTo, defaultOpenTo, views, defaultViews, }: {
5
6
  openTo: TView | undefined;
6
7
  defaultOpenTo: TView;
7
8
  views: readonly TView[] | undefined;
@@ -0,0 +1,606 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
+ /* eslint-disable class-methods-use-this */
6
+ import addDays from 'date-fns/addDays';
7
+ import addSeconds from 'date-fns/addSeconds';
8
+ import addMinutes from 'date-fns/addMinutes';
9
+ import addHours from 'date-fns/addHours';
10
+ import addWeeks from 'date-fns/addWeeks';
11
+ import addMonths from 'date-fns/addMonths';
12
+ import addYears from 'date-fns/addYears';
13
+ import differenceInYears from 'date-fns/differenceInYears';
14
+ import differenceInQuarters from 'date-fns/differenceInQuarters';
15
+ import differenceInMonths from 'date-fns/differenceInMonths';
16
+ import differenceInWeeks from 'date-fns/differenceInWeeks';
17
+ import differenceInDays from 'date-fns/differenceInDays';
18
+ import differenceInHours from 'date-fns/differenceInHours';
19
+ import differenceInMinutes from 'date-fns/differenceInMinutes';
20
+ import differenceInSeconds from 'date-fns/differenceInSeconds';
21
+ import differenceInMilliseconds from 'date-fns/differenceInMilliseconds';
22
+ import eachDayOfInterval from 'date-fns/eachDayOfInterval';
23
+ import endOfDay from 'date-fns/endOfDay';
24
+ import endOfWeek from 'date-fns/endOfWeek';
25
+ import endOfYear from 'date-fns/endOfYear';
26
+ import dateFnsFormat from 'date-fns/format';
27
+ import getDate from 'date-fns/getDate';
28
+ import getDay from 'date-fns/getDay';
29
+ import getDaysInMonth from 'date-fns/getDaysInMonth';
30
+ import getHours from 'date-fns/getHours';
31
+ import getMinutes from 'date-fns/getMinutes';
32
+ import getMonth from 'date-fns/getMonth';
33
+ import getSeconds from 'date-fns/getSeconds';
34
+ import getWeek from 'date-fns/getWeek';
35
+ import getYear from 'date-fns/getYear';
36
+ import isAfter from 'date-fns/isAfter';
37
+ import isBefore from 'date-fns/isBefore';
38
+ import isEqual from 'date-fns/isEqual';
39
+ import isSameDay from 'date-fns/isSameDay';
40
+ import isSameYear from 'date-fns/isSameYear';
41
+ import isSameMonth from 'date-fns/isSameMonth';
42
+ import isSameHour from 'date-fns/isSameHour';
43
+ import isValid from 'date-fns/isValid';
44
+ import dateFnsParse from 'date-fns/parse';
45
+ import setDate from 'date-fns/setDate';
46
+ import setHours from 'date-fns/setHours';
47
+ import setMinutes from 'date-fns/setMinutes';
48
+ import setMonth from 'date-fns/setMonth';
49
+ import setSeconds from 'date-fns/setSeconds';
50
+ import setYear from 'date-fns/setYear';
51
+ import startOfDay from 'date-fns/startOfDay';
52
+ import startOfMonth from 'date-fns/startOfMonth';
53
+ import endOfMonth from 'date-fns/endOfMonth';
54
+ import startOfWeek from 'date-fns/startOfWeek';
55
+ import startOfYear from 'date-fns/startOfYear';
56
+ import parseISO from 'date-fns/parseISO';
57
+ import formatISO from 'date-fns/formatISO';
58
+ import isWithinInterval from 'date-fns/isWithinInterval';
59
+ import defaultLocale from 'date-fns/locale/en-US';
60
+ // @ts-ignore
61
+ import longFormatters from 'date-fns/_lib/format/longFormatters';
62
+ var formatTokenMap = {
63
+ // Year
64
+ y: {
65
+ sectionType: 'year',
66
+ contentType: 'digit',
67
+ maxLength: 4
68
+ },
69
+ yy: 'year',
70
+ yyy: {
71
+ sectionType: 'year',
72
+ contentType: 'digit',
73
+ maxLength: 4
74
+ },
75
+ yyyy: 'year',
76
+ // Month
77
+ M: {
78
+ sectionType: 'month',
79
+ contentType: 'digit',
80
+ maxLength: 2
81
+ },
82
+ MM: 'month',
83
+ MMMM: {
84
+ sectionType: 'month',
85
+ contentType: 'letter'
86
+ },
87
+ MMM: {
88
+ sectionType: 'month',
89
+ contentType: 'letter'
90
+ },
91
+ L: {
92
+ sectionType: 'month',
93
+ contentType: 'digit',
94
+ maxLength: 2
95
+ },
96
+ LL: 'month',
97
+ LLL: {
98
+ sectionType: 'month',
99
+ contentType: 'letter'
100
+ },
101
+ LLLL: {
102
+ sectionType: 'month',
103
+ contentType: 'letter'
104
+ },
105
+ // Day of the month
106
+ d: {
107
+ sectionType: 'day',
108
+ contentType: 'digit',
109
+ maxLength: 2
110
+ },
111
+ dd: 'day',
112
+ do: {
113
+ sectionType: 'day',
114
+ contentType: 'digit-with-letter'
115
+ },
116
+ // Day of the week
117
+ E: {
118
+ sectionType: 'weekDay',
119
+ contentType: 'letter'
120
+ },
121
+ EE: {
122
+ sectionType: 'weekDay',
123
+ contentType: 'letter'
124
+ },
125
+ EEE: {
126
+ sectionType: 'weekDay',
127
+ contentType: 'letter'
128
+ },
129
+ EEEE: {
130
+ sectionType: 'weekDay',
131
+ contentType: 'letter'
132
+ },
133
+ EEEEE: {
134
+ sectionType: 'weekDay',
135
+ contentType: 'letter'
136
+ },
137
+ i: {
138
+ sectionType: 'weekDay',
139
+ contentType: 'digit',
140
+ maxLength: 1
141
+ },
142
+ ii: 'weekDay',
143
+ iii: {
144
+ sectionType: 'weekDay',
145
+ contentType: 'letter'
146
+ },
147
+ iiii: {
148
+ sectionType: 'weekDay',
149
+ contentType: 'letter'
150
+ },
151
+ e: {
152
+ sectionType: 'weekDay',
153
+ contentType: 'digit',
154
+ maxLength: 1
155
+ },
156
+ ee: 'weekDay',
157
+ eee: {
158
+ sectionType: 'weekDay',
159
+ contentType: 'letter'
160
+ },
161
+ eeee: {
162
+ sectionType: 'weekDay',
163
+ contentType: 'letter'
164
+ },
165
+ eeeee: {
166
+ sectionType: 'weekDay',
167
+ contentType: 'letter'
168
+ },
169
+ eeeeee: {
170
+ sectionType: 'weekDay',
171
+ contentType: 'letter'
172
+ },
173
+ c: {
174
+ sectionType: 'weekDay',
175
+ contentType: 'digit',
176
+ maxLength: 1
177
+ },
178
+ cc: 'weekDay',
179
+ ccc: {
180
+ sectionType: 'weekDay',
181
+ contentType: 'letter'
182
+ },
183
+ cccc: {
184
+ sectionType: 'weekDay',
185
+ contentType: 'letter'
186
+ },
187
+ ccccc: {
188
+ sectionType: 'weekDay',
189
+ contentType: 'letter'
190
+ },
191
+ cccccc: {
192
+ sectionType: 'weekDay',
193
+ contentType: 'letter'
194
+ },
195
+ // Meridiem
196
+ a: 'meridiem',
197
+ aa: 'meridiem',
198
+ aaa: 'meridiem',
199
+ // Hours
200
+ H: {
201
+ sectionType: 'hours',
202
+ contentType: 'digit',
203
+ maxLength: 2
204
+ },
205
+ HH: 'hours',
206
+ h: {
207
+ sectionType: 'hours',
208
+ contentType: 'digit',
209
+ maxLength: 2
210
+ },
211
+ hh: 'hours',
212
+ // Minutes
213
+ m: {
214
+ sectionType: 'minutes',
215
+ contentType: 'digit',
216
+ maxLength: 2
217
+ },
218
+ mm: 'minutes',
219
+ // Seconds
220
+ s: {
221
+ sectionType: 'seconds',
222
+ contentType: 'digit',
223
+ maxLength: 2
224
+ },
225
+ ss: 'seconds'
226
+ };
227
+ var defaultFormats = {
228
+ dayOfMonth: 'd',
229
+ fullDate: 'PP',
230
+ fullDateWithWeekday: 'PPPP',
231
+ fullDateTime: 'PP p',
232
+ fullDateTime12h: 'PP hh:mm aa',
233
+ fullDateTime24h: 'PP HH:mm',
234
+ fullTime: 'p',
235
+ fullTime12h: 'hh:mm aa',
236
+ fullTime24h: 'HH:mm',
237
+ hours12h: 'hh',
238
+ hours24h: 'HH',
239
+ keyboardDate: 'P',
240
+ keyboardDateTime: 'P p',
241
+ keyboardDateTime12h: 'P hh:mm aa',
242
+ keyboardDateTime24h: 'P HH:mm',
243
+ minutes: 'mm',
244
+ month: 'LLLL',
245
+ monthAndDate: 'MMMM d',
246
+ monthAndYear: 'LLLL yyyy',
247
+ monthShort: 'MMM',
248
+ weekday: 'EEEE',
249
+ weekdayShort: 'EEE',
250
+ normalDate: 'd MMMM',
251
+ normalDateWithWeekday: 'EEE, MMM d',
252
+ seconds: 'ss',
253
+ shortDate: 'MMM d',
254
+ year: 'yyyy'
255
+ };
256
+
257
+ /**
258
+ * Based on `@date-io/date-fns`
259
+ *
260
+ * MIT License
261
+ *
262
+ * Copyright (c) 2017 Dmitriy Kovalenko
263
+ *
264
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
265
+ * of this software and associated documentation files (the "Software"), to deal
266
+ * in the Software without restriction, including without limitation the rights
267
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
268
+ * copies of the Software, and to permit persons to whom the Software is
269
+ * furnished to do so, subject to the following conditions:
270
+ *
271
+ * The above copyright notice and this permission notice shall be included in all
272
+ * copies or substantial portions of the Software.
273
+ *
274
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
275
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
276
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
277
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
278
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
279
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
280
+ * SOFTWARE.
281
+ */
282
+ export var AdapterDateFns = /*#__PURE__*/_createClass(function AdapterDateFns() {
283
+ var _this = this;
284
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
285
+ _locale = _ref.locale,
286
+ formats = _ref.formats;
287
+ _classCallCheck(this, AdapterDateFns);
288
+ this.isMUIAdapter = true;
289
+ this.lib = 'date-fns';
290
+ this.locale = void 0;
291
+ this.formats = void 0;
292
+ this.formatTokenMap = formatTokenMap;
293
+ this.escapedCharacters = {
294
+ start: "'",
295
+ end: "'"
296
+ };
297
+ this.date = function (value) {
298
+ if (typeof value === 'undefined') {
299
+ return new Date();
300
+ }
301
+ if (value === null) {
302
+ return null;
303
+ }
304
+ return new Date(value);
305
+ };
306
+ this.toJsDate = function (value) {
307
+ return value;
308
+ };
309
+ this.parseISO = function (isoString) {
310
+ return parseISO(isoString);
311
+ };
312
+ this.toISO = function (value) {
313
+ return formatISO(value, {
314
+ format: 'extended'
315
+ });
316
+ };
317
+ this.parse = function (value, format) {
318
+ if (value === '') {
319
+ return null;
320
+ }
321
+ return dateFnsParse(value, format, new Date(), {
322
+ locale: _this.locale
323
+ });
324
+ };
325
+ this.getCurrentLocaleCode = function () {
326
+ var _this$locale;
327
+ return ((_this$locale = _this.locale) == null ? void 0 : _this$locale.code) || 'en-US';
328
+ };
329
+ // Note: date-fns input types are more lenient than this adapter, so we need to expose our more
330
+ // strict signature and delegate to the more lenient signature. Otherwise, we have downstream type errors upon usage.
331
+ this.is12HourCycleInCurrentLocale = function () {
332
+ if (_this.locale) {
333
+ return /a/.test(_this.locale.formatLong.time());
334
+ }
335
+
336
+ // By default, date-fns is using en-US locale with am/pm enabled
337
+ return true;
338
+ };
339
+ this.expandFormat = function (format) {
340
+ var longFormatRegexp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
341
+
342
+ // @see https://github.com/date-fns/date-fns/blob/master/src/format/index.js#L31
343
+ return format.match(longFormatRegexp).map(function (token) {
344
+ var firstCharacter = token[0];
345
+ if (firstCharacter === 'p' || firstCharacter === 'P') {
346
+ var longFormatter = longFormatters[firstCharacter];
347
+ var locale = _this.locale || defaultLocale;
348
+ return longFormatter(token, locale.formatLong, {});
349
+ }
350
+ return token;
351
+ }).join('');
352
+ };
353
+ this.getFormatHelperText = function (format) {
354
+ return _this.expandFormat(format).replace(/(aaa|aa|a)/g, '(a|p)m').toLocaleLowerCase();
355
+ };
356
+ this.isNull = function (value) {
357
+ return value === null;
358
+ };
359
+ this.isValid = function (value) {
360
+ return isValid(_this.date(value));
361
+ };
362
+ this.format = function (value, formatKey) {
363
+ return _this.formatByString(value, _this.formats[formatKey]);
364
+ };
365
+ this.formatByString = function (value, formatString) {
366
+ return dateFnsFormat(value, formatString, {
367
+ locale: _this.locale
368
+ });
369
+ };
370
+ this.formatNumber = function (numberToFormat) {
371
+ return numberToFormat;
372
+ };
373
+ this.getDiff = function (value, comparing, unit) {
374
+ switch (unit) {
375
+ case 'years':
376
+ return differenceInYears(value, _this.date(comparing));
377
+ case 'quarters':
378
+ return differenceInQuarters(value, _this.date(comparing));
379
+ case 'months':
380
+ return differenceInMonths(value, _this.date(comparing));
381
+ case 'weeks':
382
+ return differenceInWeeks(value, _this.date(comparing));
383
+ case 'days':
384
+ return differenceInDays(value, _this.date(comparing));
385
+ case 'hours':
386
+ return differenceInHours(value, _this.date(comparing));
387
+ case 'minutes':
388
+ return differenceInMinutes(value, _this.date(comparing));
389
+ case 'seconds':
390
+ return differenceInSeconds(value, _this.date(comparing));
391
+ default:
392
+ {
393
+ return differenceInMilliseconds(value, _this.date(comparing));
394
+ }
395
+ }
396
+ };
397
+ this.isEqual = function (value, comparing) {
398
+ if (value === null && comparing === null) {
399
+ return true;
400
+ }
401
+ return isEqual(value, comparing);
402
+ };
403
+ this.isSameYear = function (value, comparing) {
404
+ return isSameYear(value, comparing);
405
+ };
406
+ this.isSameMonth = function (value, comparing) {
407
+ return isSameMonth(value, comparing);
408
+ };
409
+ this.isSameDay = function (value, comparing) {
410
+ return isSameDay(value, comparing);
411
+ };
412
+ this.isSameHour = function (value, comparing) {
413
+ return isSameHour(value, comparing);
414
+ };
415
+ this.isAfter = function (value, comparing) {
416
+ return isAfter(value, comparing);
417
+ };
418
+ this.isAfterYear = function (value, comparing) {
419
+ return isAfter(value, endOfYear(comparing));
420
+ };
421
+ this.isAfterDay = function (value, comparing) {
422
+ return isAfter(value, endOfDay(comparing));
423
+ };
424
+ this.isBefore = function (value, comparing) {
425
+ return isBefore(value, comparing);
426
+ };
427
+ this.isBeforeYear = function (value, comparing) {
428
+ return isBefore(value, startOfYear(comparing));
429
+ };
430
+ this.isBeforeDay = function (value, comparing) {
431
+ return isBefore(value, startOfDay(comparing));
432
+ };
433
+ this.isWithinRange = function (value, _ref2) {
434
+ var _ref3 = _slicedToArray(_ref2, 2),
435
+ start = _ref3[0],
436
+ end = _ref3[1];
437
+ return isWithinInterval(value, {
438
+ start: start,
439
+ end: end
440
+ });
441
+ };
442
+ this.startOfYear = function (value) {
443
+ return startOfYear(value);
444
+ };
445
+ this.startOfMonth = function (value) {
446
+ return startOfMonth(value);
447
+ };
448
+ this.startOfWeek = function (value) {
449
+ return startOfWeek(value, {
450
+ locale: _this.locale
451
+ });
452
+ };
453
+ this.startOfDay = function (value) {
454
+ return startOfDay(value);
455
+ };
456
+ this.endOfYear = function (value) {
457
+ return endOfYear(value);
458
+ };
459
+ this.endOfMonth = function (value) {
460
+ return endOfMonth(value);
461
+ };
462
+ this.endOfWeek = function (value) {
463
+ return endOfWeek(value, {
464
+ locale: _this.locale
465
+ });
466
+ };
467
+ this.endOfDay = function (value) {
468
+ return endOfDay(value);
469
+ };
470
+ this.addYears = function (value, amount) {
471
+ return addYears(value, amount);
472
+ };
473
+ this.addMonths = function (value, amount) {
474
+ return addMonths(value, amount);
475
+ };
476
+ this.addWeeks = function (value, amount) {
477
+ return addWeeks(value, amount);
478
+ };
479
+ this.addDays = function (value, amount) {
480
+ return addDays(value, amount);
481
+ };
482
+ this.addHours = function (value, amount) {
483
+ return addHours(value, amount);
484
+ };
485
+ this.addMinutes = function (value, amount) {
486
+ return addMinutes(value, amount);
487
+ };
488
+ this.addSeconds = function (value, amount) {
489
+ return addSeconds(value, amount);
490
+ };
491
+ this.getYear = function (value) {
492
+ return getYear(value);
493
+ };
494
+ this.getMonth = function (value) {
495
+ return getMonth(value);
496
+ };
497
+ this.getDate = function (value) {
498
+ return getDate(value);
499
+ };
500
+ this.getHours = function (value) {
501
+ return getHours(value);
502
+ };
503
+ this.getMinutes = function (value) {
504
+ return getMinutes(value);
505
+ };
506
+ this.getSeconds = function (value) {
507
+ return getSeconds(value);
508
+ };
509
+ this.setYear = function (value, year) {
510
+ return setYear(value, year);
511
+ };
512
+ this.setMonth = function (value, month) {
513
+ return setMonth(value, month);
514
+ };
515
+ this.setDate = function (value, date) {
516
+ return setDate(value, date);
517
+ };
518
+ this.setHours = function (value, hours) {
519
+ return setHours(value, hours);
520
+ };
521
+ this.setMinutes = function (value, minutes) {
522
+ return setMinutes(value, minutes);
523
+ };
524
+ this.setSeconds = function (value, seconds) {
525
+ return setSeconds(value, seconds);
526
+ };
527
+ this.getDaysInMonth = function (value) {
528
+ return getDaysInMonth(value);
529
+ };
530
+ this.getNextMonth = function (value) {
531
+ return addMonths(value, 1);
532
+ };
533
+ this.getPreviousMonth = function (value) {
534
+ return addMonths(value, -1);
535
+ };
536
+ this.getMonthArray = function (value) {
537
+ var firstMonth = startOfYear(value);
538
+ var monthArray = [firstMonth];
539
+ while (monthArray.length < 12) {
540
+ var prevMonth = monthArray[monthArray.length - 1];
541
+ monthArray.push(_this.getNextMonth(prevMonth));
542
+ }
543
+ return monthArray;
544
+ };
545
+ this.mergeDateAndTime = function (dateParam, timeParam) {
546
+ return _this.setSeconds(_this.setMinutes(_this.setHours(dateParam, _this.getHours(timeParam)), _this.getMinutes(timeParam)), _this.getSeconds(timeParam));
547
+ };
548
+ this.getWeekdays = function () {
549
+ var now = new Date();
550
+ return eachDayOfInterval({
551
+ start: startOfWeek(now, {
552
+ locale: _this.locale
553
+ }),
554
+ end: endOfWeek(now, {
555
+ locale: _this.locale
556
+ })
557
+ }).map(function (day) {
558
+ return _this.formatByString(day, 'EEEEEE');
559
+ });
560
+ };
561
+ this.getWeekArray = function (value) {
562
+ var start = startOfWeek(startOfMonth(value), {
563
+ locale: _this.locale
564
+ });
565
+ var end = endOfWeek(endOfMonth(value), {
566
+ locale: _this.locale
567
+ });
568
+ var count = 0;
569
+ var current = start;
570
+ var nestedWeeks = [];
571
+ var lastDay = null;
572
+ while (isBefore(current, end)) {
573
+ var weekNumber = Math.floor(count / 7);
574
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
575
+ var day = getDay(current);
576
+ if (lastDay !== day) {
577
+ lastDay = day;
578
+ nestedWeeks[weekNumber].push(current);
579
+ count += 1;
580
+ }
581
+ current = addDays(current, 1);
582
+ }
583
+ return nestedWeeks;
584
+ };
585
+ this.getWeekNumber = function (value) {
586
+ return getWeek(value, {
587
+ locale: _this.locale
588
+ });
589
+ };
590
+ this.getYearRange = function (start, end) {
591
+ var startDate = startOfYear(start);
592
+ var endDate = endOfYear(end);
593
+ var years = [];
594
+ var current = startDate;
595
+ while (isBefore(current, endDate)) {
596
+ years.push(current);
597
+ current = addYears(current, 1);
598
+ }
599
+ return years;
600
+ };
601
+ this.getMeridiemText = function (ampm) {
602
+ return ampm === 'am' ? 'AM' : 'PM';
603
+ };
604
+ this.locale = _locale;
605
+ this.formats = _extends({}, defaultFormats, formats);
606
+ });