@mui/x-date-pickers 6.2.1 → 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 (612) 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 +70 -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 +1 -1
  45. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
  46. package/DesktopTimePicker/DesktopTimePicker.js +50 -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/MobileDatePicker/MobileDatePicker.js +1 -1
  57. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -1
  58. package/MobileTimePicker/MobileTimePicker.js +2 -1
  59. package/MobileTimePicker/MobileTimePicker.types.d.ts +8 -7
  60. package/MonthCalendar/MonthCalendar.types.d.ts +1 -1
  61. package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +7 -0
  62. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
  63. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +57 -0
  64. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +22 -0
  65. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  66. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +28 -0
  67. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +151 -0
  68. package/MultiSectionDigitalClock/index.d.ts +7 -0
  69. package/MultiSectionDigitalClock/index.js +3 -0
  70. package/MultiSectionDigitalClock/multiSectionDigitalClockClasses.d.ts +7 -0
  71. package/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  72. package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.d.ts +9 -0
  73. package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  74. package/MultiSectionDigitalClock/package.json +6 -0
  75. package/PickersDay/PickersDay.js +4 -1
  76. package/PickersLayout/PickersLayout.d.ts +2 -2
  77. package/PickersLayout/PickersLayout.js +2 -2
  78. package/PickersLayout/PickersLayout.types.d.ts +7 -8
  79. package/PickersLayout/usePickerLayout.d.ts +2 -2
  80. package/README.md +0 -9
  81. package/StaticDateTimePicker/StaticDateTimePicker.js +2 -1
  82. package/StaticTimePicker/StaticTimePicker.js +2 -1
  83. package/StaticTimePicker/StaticTimePicker.types.d.ts +1 -1
  84. package/TimeClock/TimeClock.js +35 -12
  85. package/TimeClock/TimeClock.types.d.ts +4 -67
  86. package/TimeField/TimeField.js +21 -3
  87. package/TimeField/TimeField.types.d.ts +3 -2
  88. package/TimeField/useTimeField.js +4 -2
  89. package/TimePicker/TimePicker.js +25 -2
  90. package/TimePicker/TimePicker.types.d.ts +4 -3
  91. package/TimePicker/TimePickerToolbar.d.ts +2 -2
  92. package/TimePicker/TimePickerToolbar.js +2 -2
  93. package/TimePicker/shared.d.ts +9 -7
  94. package/YearCalendar/YearCalendar.types.d.ts +1 -1
  95. package/dateViewRenderers/dateViewRenderers.d.ts +2 -2
  96. package/index.d.ts +2 -0
  97. package/index.js +4 -1
  98. package/internals/components/PickersToolbar.d.ts +3 -3
  99. package/internals/constants/dimensions.d.ts +1 -0
  100. package/internals/constants/dimensions.js +2 -1
  101. package/internals/demo/DemoContainer.js +4 -1
  102. package/internals/hooks/date-helpers-hooks.d.ts +3 -2
  103. package/internals/hooks/date-helpers-hooks.js +3 -3
  104. package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +2 -2
  105. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  106. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +7 -6
  107. package/internals/hooks/useField/useField.js +12 -11
  108. package/internals/hooks/useField/useField.types.d.ts +19 -4
  109. package/internals/hooks/useField/useField.utils.d.ts +8 -5
  110. package/internals/hooks/useField/useField.utils.js +60 -34
  111. package/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  112. package/internals/hooks/useField/useFieldState.js +4 -3
  113. package/internals/hooks/useIsLandscape.d.ts +2 -2
  114. package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +2 -2
  115. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -6
  116. package/internals/hooks/usePicker/usePicker.d.ts +4 -3
  117. package/internals/hooks/usePicker/usePicker.types.d.ts +6 -5
  118. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +5 -6
  119. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  120. package/internals/hooks/usePicker/usePickerValue.js +1 -1
  121. package/internals/hooks/usePicker/usePickerValue.types.d.ts +1 -1
  122. package/internals/hooks/usePicker/usePickerViews.d.ts +11 -11
  123. package/internals/hooks/useStaticPicker/useStaticPicker.d.ts +2 -2
  124. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +6 -5
  125. package/internals/hooks/{validation/useValidation.d.ts → useValidation.d.ts} +1 -1
  126. package/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  127. package/internals/hooks/useViews.d.ts +8 -6
  128. package/internals/hooks/useViews.js +29 -13
  129. package/internals/index.d.ts +7 -7
  130. package/internals/index.js +5 -5
  131. package/internals/models/common.d.ts +3 -0
  132. package/internals/models/index.d.ts +1 -0
  133. package/internals/models/index.js +2 -1
  134. package/internals/models/props/basePickerProps.d.ts +3 -3
  135. package/internals/models/props/clock.d.ts +88 -0
  136. package/internals/models/props/tabs.d.ts +2 -2
  137. package/internals/models/props/toolbar.d.ts +3 -3
  138. package/internals/{hooks/validation/models.d.ts → models/validation.d.ts} +2 -5
  139. package/internals/models/validation.js +1 -0
  140. package/internals/utils/time-utils.d.ts +7 -7
  141. package/internals/utils/time-utils.js +2 -1
  142. package/internals/{hooks/validation/useDateValidation.d.ts → utils/validation/validateDate.d.ts} +2 -3
  143. package/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
  144. package/internals/{hooks/validation/useDateTimeValidation.d.ts → utils/validation/validateDateTime.d.ts} +3 -3
  145. package/{modern/internals/hooks/validation/useDateTimeValidation.js → internals/utils/validation/validateDateTime.js} +2 -2
  146. package/internals/{hooks/validation/useTimeValidation.d.ts → utils/validation/validateTime.d.ts} +2 -2
  147. package/{modern/internals/hooks/validation/useTimeValidation.js → internals/utils/validation/validateTime.js} +1 -1
  148. package/internals/utils/views.d.ts +3 -2
  149. package/legacy/AdapterDateFns/AdapterDateFns.js +606 -0
  150. package/legacy/AdapterDateFns/index.js +1 -165
  151. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +620 -0
  152. package/legacy/AdapterDateFnsJalali/index.js +1 -165
  153. package/legacy/AdapterDayjs/AdapterDayjs.js +146 -111
  154. package/legacy/AdapterLuxon/AdapterLuxon.js +524 -0
  155. package/legacy/AdapterLuxon/index.js +1 -127
  156. package/legacy/AdapterMoment/AdapterMoment.js +422 -0
  157. package/legacy/AdapterMoment/index.js +1 -115
  158. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +284 -0
  159. package/legacy/AdapterMomentHijri/index.js +1 -90
  160. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +291 -0
  161. package/legacy/AdapterMomentJalaali/index.js +1 -103
  162. package/legacy/DateCalendar/DayCalendar.js +1 -1
  163. package/legacy/DateCalendar/useCalendarState.js +1 -1
  164. package/legacy/DateCalendar/useIsDateDisabled.js +28 -0
  165. package/legacy/DateField/DateField.js +20 -3
  166. package/legacy/DateField/useDateField.js +4 -2
  167. package/legacy/DatePicker/DatePickerToolbar.js +1 -1
  168. package/legacy/DateTimeField/DateTimeField.js +21 -3
  169. package/legacy/DateTimeField/useDateTimeField.js +4 -2
  170. package/legacy/DateTimePicker/DateTimePicker.js +1 -0
  171. package/legacy/DesktopDatePicker/DesktopDatePicker.js +1 -1
  172. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
  173. package/legacy/DesktopTimePicker/DesktopTimePicker.js +51 -8
  174. package/legacy/DigitalClock/DigitalClock.js +419 -0
  175. package/legacy/DigitalClock/DigitalClock.types.js +1 -0
  176. package/legacy/DigitalClock/digitalClockClasses.js +6 -0
  177. package/legacy/DigitalClock/index.js +2 -0
  178. package/legacy/MobileDatePicker/MobileDatePicker.js +1 -1
  179. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -1
  180. package/legacy/MobileTimePicker/MobileTimePicker.js +2 -1
  181. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +508 -0
  182. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
  183. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  184. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +157 -0
  185. package/legacy/MultiSectionDigitalClock/index.js +3 -0
  186. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  187. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  188. package/legacy/PickersDay/PickersDay.js +3 -1
  189. package/legacy/PickersLayout/PickersLayout.js +2 -2
  190. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -1
  191. package/legacy/StaticTimePicker/StaticTimePicker.js +2 -1
  192. package/legacy/TimeClock/TimeClock.js +35 -12
  193. package/legacy/TimeField/TimeField.js +21 -3
  194. package/legacy/TimeField/useTimeField.js +4 -2
  195. package/legacy/TimePicker/TimePicker.js +25 -2
  196. package/legacy/TimePicker/TimePickerToolbar.js +2 -2
  197. package/legacy/index.js +4 -1
  198. package/legacy/internals/constants/dimensions.js +2 -1
  199. package/legacy/internals/demo/DemoContainer.js +4 -1
  200. package/legacy/internals/hooks/date-helpers-hooks.js +3 -3
  201. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  202. package/legacy/internals/hooks/useField/useField.js +11 -10
  203. package/legacy/internals/hooks/useField/useField.utils.js +58 -34
  204. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  205. package/legacy/internals/hooks/useField/useFieldState.js +6 -4
  206. package/legacy/internals/hooks/usePicker/usePickerValue.js +1 -1
  207. package/legacy/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  208. package/legacy/internals/hooks/useViews.js +30 -14
  209. package/legacy/internals/index.js +5 -5
  210. package/legacy/internals/models/index.js +2 -1
  211. package/legacy/internals/models/props/clock.js +1 -0
  212. package/legacy/internals/models/validation.js +1 -0
  213. package/legacy/internals/utils/time-utils.js +2 -1
  214. package/legacy/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -28
  215. package/legacy/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +2 -2
  216. package/legacy/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
  217. package/legacy/locales/beBY.js +5 -3
  218. package/legacy/locales/caES.js +6 -1
  219. package/legacy/locales/csCZ.js +6 -4
  220. package/legacy/locales/daDK.js +6 -2
  221. package/legacy/locales/deDE.js +6 -2
  222. package/legacy/locales/enUS.js +4 -0
  223. package/legacy/locales/esES.js +6 -1
  224. package/legacy/locales/faIR.js +11 -1
  225. package/legacy/locales/fiFI.js +6 -1
  226. package/legacy/locales/frFR.js +6 -1
  227. package/legacy/locales/heIL.js +6 -1
  228. package/legacy/locales/huHU.js +6 -2
  229. package/legacy/locales/index.js +1 -0
  230. package/legacy/locales/isIS.js +11 -1
  231. package/legacy/locales/itIT.js +6 -1
  232. package/legacy/locales/jaJP.js +6 -2
  233. package/legacy/locales/koKR.js +6 -1
  234. package/legacy/locales/kzKZ.js +6 -2
  235. package/legacy/locales/nbNO.js +11 -1
  236. package/legacy/locales/nlNL.js +11 -1
  237. package/legacy/locales/plPL.js +11 -1
  238. package/legacy/locales/ptBR.js +11 -1
  239. package/legacy/locales/ruRU.js +6 -2
  240. package/legacy/locales/svSE.js +11 -1
  241. package/legacy/locales/trTR.js +22 -7
  242. package/legacy/locales/ukUA.js +11 -1
  243. package/legacy/locales/urPK.js +11 -1
  244. package/legacy/locales/zhCN.js +44 -23
  245. package/legacy/models/common.js +1 -0
  246. package/legacy/models/index.js +2 -1
  247. package/legacy/tests/describeAdapters/describeAdapters.js +1 -3
  248. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  249. package/legacy/tests/describeGregorianAdapter/testCalculations.js +29 -26
  250. package/legacy/tests/describeGregorianAdapter/testLocalization.js +2 -2
  251. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  252. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  253. package/legacy/tests/describeHijriAdapter/index.js +1 -0
  254. package/legacy/tests/describeHijriAdapter/testCalculations.js +94 -0
  255. package/legacy/tests/describeHijriAdapter/testLocalization.js +12 -0
  256. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  257. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  258. package/legacy/tests/describeJalaliAdapter/index.js +1 -0
  259. package/legacy/tests/describeJalaliAdapter/testCalculations.js +82 -0
  260. package/legacy/tests/describeJalaliAdapter/testLocalization.js +12 -0
  261. package/legacy/tests/describePicker/describePicker.js +159 -0
  262. package/legacy/tests/describePicker/describePicker.types.js +1 -0
  263. package/legacy/tests/describePicker/index.js +1 -0
  264. package/legacy/tests/describeValue/describeValue.js +1 -1
  265. package/legacy/tests/describeValue/testControlledUnControlled.js +8 -9
  266. package/legacy/tests/describeValue/testPickerActionBar.js +46 -13
  267. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  268. package/legacy/timeViewRenderers/index.js +1 -1
  269. package/legacy/timeViewRenderers/timeViewRenderers.js +132 -4
  270. package/locales/beBY.d.ts +4 -2
  271. package/locales/beBY.js +3 -3
  272. package/locales/caES.d.ts +4 -2
  273. package/locales/caES.js +4 -1
  274. package/locales/csCZ.d.ts +4 -2
  275. package/locales/csCZ.js +4 -4
  276. package/locales/daDK.d.ts +4 -2
  277. package/locales/daDK.js +4 -2
  278. package/locales/deDE.d.ts +4 -2
  279. package/locales/deDE.js +4 -2
  280. package/locales/enUS.d.ts +3 -2
  281. package/locales/enUS.js +2 -0
  282. package/locales/esES.d.ts +4 -2
  283. package/locales/esES.js +4 -1
  284. package/locales/faIR.d.ts +4 -2
  285. package/locales/faIR.js +9 -1
  286. package/locales/fiFI.d.ts +4 -2
  287. package/locales/fiFI.js +4 -1
  288. package/locales/frFR.d.ts +4 -2
  289. package/locales/frFR.js +4 -1
  290. package/locales/heIL.d.ts +4 -2
  291. package/locales/heIL.js +4 -1
  292. package/locales/huHU.d.ts +4 -2
  293. package/locales/huHU.js +4 -2
  294. package/locales/index.d.ts +1 -0
  295. package/locales/index.js +1 -0
  296. package/locales/isIS.d.ts +4 -2
  297. package/locales/isIS.js +9 -1
  298. package/locales/itIT.d.ts +4 -2
  299. package/locales/itIT.js +4 -1
  300. package/locales/jaJP.d.ts +4 -2
  301. package/locales/jaJP.js +4 -2
  302. package/locales/koKR.d.ts +4 -2
  303. package/locales/koKR.js +4 -1
  304. package/locales/kzKZ.d.ts +4 -2
  305. package/locales/kzKZ.js +4 -2
  306. package/locales/nbNO.d.ts +4 -2
  307. package/locales/nbNO.js +9 -1
  308. package/locales/nlNL.d.ts +8 -7
  309. package/locales/nlNL.js +9 -1
  310. package/locales/plPL.d.ts +4 -2
  311. package/locales/plPL.js +9 -1
  312. package/locales/ptBR.d.ts +4 -2
  313. package/locales/ptBR.js +9 -1
  314. package/locales/ruRU.d.ts +4 -2
  315. package/locales/ruRU.js +4 -2
  316. package/locales/svSE.d.ts +4 -2
  317. package/locales/svSE.js +9 -1
  318. package/locales/trTR.d.ts +4 -2
  319. package/locales/trTR.js +14 -7
  320. package/locales/ukUA.d.ts +4 -2
  321. package/locales/ukUA.js +9 -1
  322. package/locales/urPK.d.ts +4 -2
  323. package/locales/urPK.js +9 -1
  324. package/locales/utils/getPickersLocalization.d.ts +3 -2
  325. package/locales/utils/pickersLocaleTextApi.d.ts +5 -3
  326. package/locales/zhCN.d.ts +4 -2
  327. package/locales/zhCN.js +22 -23
  328. package/models/adapters.d.ts +7 -6
  329. package/models/common.d.ts +5 -0
  330. package/models/common.js +1 -0
  331. package/models/fields.d.ts +19 -2
  332. package/models/index.d.ts +1 -0
  333. package/models/index.js +2 -1
  334. package/modern/AdapterDateFns/AdapterDateFns.js +597 -0
  335. package/modern/AdapterDateFns/index.js +1 -149
  336. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +608 -0
  337. package/modern/AdapterDateFnsJalali/index.js +1 -148
  338. package/modern/AdapterDayjs/AdapterDayjs.js +146 -111
  339. package/modern/AdapterLuxon/AdapterLuxon.js +512 -0
  340. package/modern/AdapterLuxon/index.js +1 -111
  341. package/modern/AdapterMoment/AdapterMoment.js +416 -0
  342. package/modern/AdapterMoment/index.js +1 -99
  343. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +269 -0
  344. package/modern/AdapterMomentHijri/index.js +1 -74
  345. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +276 -0
  346. package/modern/AdapterMomentJalaali/index.js +1 -87
  347. package/modern/DateCalendar/DayCalendar.js +1 -1
  348. package/modern/DateCalendar/useCalendarState.js +1 -1
  349. package/modern/DateCalendar/useIsDateDisabled.js +27 -0
  350. package/modern/DateField/DateField.js +20 -3
  351. package/modern/DateField/useDateField.js +4 -2
  352. package/modern/DatePicker/DatePickerToolbar.js +1 -1
  353. package/modern/DateTimeField/DateTimeField.js +21 -3
  354. package/modern/DateTimeField/useDateTimeField.js +4 -2
  355. package/modern/DateTimePicker/DateTimePicker.js +1 -0
  356. package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
  357. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
  358. package/modern/DesktopTimePicker/DesktopTimePicker.js +49 -7
  359. package/modern/DigitalClock/DigitalClock.js +396 -0
  360. package/modern/DigitalClock/DigitalClock.types.js +1 -0
  361. package/modern/DigitalClock/digitalClockClasses.js +6 -0
  362. package/modern/DigitalClock/index.js +2 -0
  363. package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
  364. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -1
  365. package/modern/MobileTimePicker/MobileTimePicker.js +2 -1
  366. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
  367. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
  368. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  369. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +149 -0
  370. package/modern/MultiSectionDigitalClock/index.js +3 -0
  371. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  372. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  373. package/modern/PickersDay/PickersDay.js +4 -1
  374. package/modern/PickersLayout/PickersLayout.js +2 -2
  375. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -1
  376. package/modern/StaticTimePicker/StaticTimePicker.js +2 -1
  377. package/modern/TimeClock/TimeClock.js +35 -12
  378. package/modern/TimeField/TimeField.js +21 -3
  379. package/modern/TimeField/useTimeField.js +4 -2
  380. package/modern/TimePicker/TimePicker.js +25 -2
  381. package/modern/TimePicker/TimePickerToolbar.js +2 -2
  382. package/modern/index.js +4 -1
  383. package/modern/internals/constants/dimensions.js +2 -1
  384. package/modern/internals/demo/DemoContainer.js +4 -1
  385. package/modern/internals/hooks/date-helpers-hooks.js +3 -3
  386. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  387. package/modern/internals/hooks/useField/useField.js +12 -11
  388. package/modern/internals/hooks/useField/useField.utils.js +60 -34
  389. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  390. package/modern/internals/hooks/useField/useFieldState.js +4 -3
  391. package/modern/internals/hooks/usePicker/usePickerValue.js +1 -1
  392. package/modern/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  393. package/modern/internals/hooks/useViews.js +29 -13
  394. package/modern/internals/index.js +5 -5
  395. package/modern/internals/models/index.js +2 -1
  396. package/modern/internals/models/props/clock.js +1 -0
  397. package/modern/internals/models/validation.js +1 -0
  398. package/modern/internals/utils/time-utils.js +2 -1
  399. package/modern/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
  400. package/{internals/hooks/validation/useDateTimeValidation.js → modern/internals/utils/validation/validateDateTime.js} +2 -2
  401. package/{internals/hooks/validation/useTimeValidation.js → modern/internals/utils/validation/validateTime.js} +1 -1
  402. package/modern/locales/beBY.js +3 -3
  403. package/modern/locales/caES.js +4 -1
  404. package/modern/locales/csCZ.js +4 -4
  405. package/modern/locales/daDK.js +4 -2
  406. package/modern/locales/deDE.js +4 -2
  407. package/modern/locales/enUS.js +2 -0
  408. package/modern/locales/esES.js +4 -1
  409. package/modern/locales/faIR.js +9 -1
  410. package/modern/locales/fiFI.js +4 -1
  411. package/modern/locales/frFR.js +4 -1
  412. package/modern/locales/heIL.js +4 -1
  413. package/modern/locales/huHU.js +4 -2
  414. package/modern/locales/index.js +1 -0
  415. package/modern/locales/isIS.js +9 -1
  416. package/modern/locales/itIT.js +4 -1
  417. package/modern/locales/jaJP.js +4 -2
  418. package/modern/locales/koKR.js +4 -1
  419. package/modern/locales/kzKZ.js +4 -2
  420. package/modern/locales/nbNO.js +9 -1
  421. package/modern/locales/nlNL.js +9 -1
  422. package/modern/locales/plPL.js +9 -1
  423. package/modern/locales/ptBR.js +9 -1
  424. package/modern/locales/ruRU.js +4 -2
  425. package/modern/locales/svSE.js +9 -1
  426. package/modern/locales/trTR.js +14 -7
  427. package/modern/locales/ukUA.js +9 -1
  428. package/modern/locales/urPK.js +9 -1
  429. package/modern/locales/zhCN.js +22 -23
  430. package/modern/models/common.js +1 -0
  431. package/modern/models/index.js +2 -1
  432. package/modern/tests/describeAdapters/describeAdapters.js +1 -3
  433. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  434. package/modern/tests/describeGregorianAdapter/testCalculations.js +29 -26
  435. package/modern/tests/describeGregorianAdapter/testLocalization.js +2 -2
  436. package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  437. package/modern/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  438. package/modern/tests/describeHijriAdapter/index.js +1 -0
  439. package/modern/tests/describeHijriAdapter/testCalculations.js +91 -0
  440. package/modern/tests/describeHijriAdapter/testLocalization.js +13 -0
  441. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  442. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  443. package/modern/tests/describeJalaliAdapter/index.js +1 -0
  444. package/modern/tests/describeJalaliAdapter/testCalculations.js +83 -0
  445. package/modern/tests/describeJalaliAdapter/testLocalization.js +13 -0
  446. package/modern/tests/describePicker/describePicker.js +162 -0
  447. package/modern/tests/describePicker/describePicker.types.js +1 -0
  448. package/modern/tests/describePicker/index.js +1 -0
  449. package/modern/tests/describeValue/describeValue.js +1 -1
  450. package/modern/tests/describeValue/testControlledUnControlled.js +8 -9
  451. package/modern/tests/describeValue/testPickerActionBar.js +46 -13
  452. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  453. package/modern/timeViewRenderers/index.js +1 -1
  454. package/modern/timeViewRenderers/timeViewRenderers.js +130 -2
  455. package/node/AdapterDateFns/AdapterDateFns.js +607 -0
  456. package/node/AdapterDateFns/index.js +6 -152
  457. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +618 -0
  458. package/node/AdapterDateFnsJalali/index.js +6 -151
  459. package/node/AdapterDayjs/AdapterDayjs.js +146 -111
  460. package/node/AdapterLuxon/AdapterLuxon.js +521 -0
  461. package/node/AdapterLuxon/index.js +6 -114
  462. package/node/AdapterMoment/AdapterMoment.js +425 -0
  463. package/node/AdapterMoment/index.js +6 -102
  464. package/node/AdapterMomentHijri/AdapterMomentHijri.js +278 -0
  465. package/node/AdapterMomentHijri/index.js +6 -77
  466. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +285 -0
  467. package/node/AdapterMomentJalaali/index.js +6 -90
  468. package/node/DateCalendar/DayCalendar.js +2 -2
  469. package/node/DateCalendar/useCalendarState.js +2 -2
  470. package/node/{internals/hooks/validation/useDateValidation.js → DateCalendar/useIsDateDisabled.js} +4 -37
  471. package/node/DateField/DateField.js +20 -3
  472. package/node/DateField/useDateField.js +5 -3
  473. package/node/DatePicker/DatePickerToolbar.js +1 -1
  474. package/node/DateTimeField/DateTimeField.js +21 -3
  475. package/node/DateTimeField/useDateTimeField.js +5 -3
  476. package/node/DateTimePicker/DateTimePicker.js +1 -0
  477. package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
  478. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -2
  479. package/node/DesktopTimePicker/DesktopTimePicker.js +50 -8
  480. package/node/DigitalClock/DigitalClock.js +406 -0
  481. package/node/DigitalClock/digitalClockClasses.js +15 -0
  482. package/node/DigitalClock/index.js +25 -0
  483. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  484. package/node/MobileDateTimePicker/MobileDateTimePicker.js +3 -2
  485. package/node/MobileTimePicker/MobileTimePicker.js +3 -2
  486. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +489 -0
  487. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +5 -0
  488. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +73 -0
  489. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +159 -0
  490. package/node/MultiSectionDigitalClock/index.js +32 -0
  491. package/node/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +15 -0
  492. package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +15 -0
  493. package/node/PickersDay/PickersDay.js +4 -1
  494. package/node/PickersLayout/PickersLayout.js +2 -2
  495. package/node/StaticDateTimePicker/StaticDateTimePicker.js +3 -2
  496. package/node/StaticTimePicker/StaticTimePicker.js +3 -2
  497. package/node/TimeClock/TimeClock.js +35 -12
  498. package/node/TimeField/TimeField.js +21 -3
  499. package/node/TimeField/useTimeField.js +5 -3
  500. package/node/TimePicker/TimePicker.js +25 -2
  501. package/node/TimePicker/TimePickerToolbar.js +2 -2
  502. package/node/index.js +25 -1
  503. package/node/internals/constants/dimensions.js +4 -2
  504. package/node/internals/demo/DemoContainer.js +4 -1
  505. package/node/internals/hooks/date-helpers-hooks.js +3 -3
  506. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  507. package/node/internals/hooks/useField/useField.js +12 -11
  508. package/node/internals/hooks/useField/useField.utils.js +63 -36
  509. package/node/internals/hooks/useField/useFieldCharacterEditing.js +17 -9
  510. package/node/internals/hooks/useField/useFieldState.js +4 -3
  511. package/node/internals/hooks/usePicker/usePickerValue.js +1 -1
  512. package/node/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  513. package/node/internals/hooks/useViews.js +29 -13
  514. package/node/internals/index.js +9 -9
  515. package/node/internals/models/index.js +11 -0
  516. package/node/internals/models/props/clock.js +5 -0
  517. package/node/internals/models/validation.js +5 -0
  518. package/node/internals/utils/time-utils.js +2 -1
  519. package/node/internals/utils/validation/validateDate.js +40 -0
  520. package/node/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +4 -4
  521. package/node/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
  522. package/node/locales/beBY.js +3 -3
  523. package/node/locales/caES.js +4 -1
  524. package/node/locales/csCZ.js +4 -2
  525. package/node/locales/daDK.js +4 -1
  526. package/node/locales/deDE.js +4 -1
  527. package/node/locales/enUS.js +2 -0
  528. package/node/locales/esES.js +4 -1
  529. package/node/locales/faIR.js +9 -1
  530. package/node/locales/fiFI.js +4 -1
  531. package/node/locales/frFR.js +4 -1
  532. package/node/locales/heIL.js +4 -1
  533. package/node/locales/huHU.js +4 -1
  534. package/node/locales/index.js +11 -0
  535. package/node/locales/isIS.js +9 -1
  536. package/node/locales/itIT.js +4 -1
  537. package/node/locales/jaJP.js +4 -1
  538. package/node/locales/koKR.js +4 -1
  539. package/node/locales/kzKZ.js +4 -1
  540. package/node/locales/nbNO.js +9 -1
  541. package/node/locales/nlNL.js +9 -1
  542. package/node/locales/plPL.js +9 -1
  543. package/node/locales/ptBR.js +9 -1
  544. package/node/locales/ruRU.js +4 -1
  545. package/node/locales/svSE.js +9 -1
  546. package/node/locales/trTR.js +14 -7
  547. package/node/locales/ukUA.js +9 -1
  548. package/node/locales/urPK.js +9 -1
  549. package/node/locales/zhCN.js +22 -23
  550. package/node/models/common.js +5 -0
  551. package/node/models/index.js +11 -0
  552. package/node/tests/describeAdapters/describeAdapters.js +1 -3
  553. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  554. package/node/tests/describeGregorianAdapter/testCalculations.js +29 -26
  555. package/node/tests/describeGregorianAdapter/testLocalization.js +2 -2
  556. package/node/tests/describeHijriAdapter/describeHijriAdapter.js +31 -0
  557. package/node/tests/describeHijriAdapter/describeHijriAdapter.types.js +5 -0
  558. package/node/tests/describeHijriAdapter/index.js +12 -0
  559. package/node/tests/describeHijriAdapter/testCalculations.js +98 -0
  560. package/node/tests/describeHijriAdapter/testLocalization.js +20 -0
  561. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +33 -0
  562. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +5 -0
  563. package/node/tests/describeJalaliAdapter/index.js +12 -0
  564. package/node/tests/describeJalaliAdapter/testCalculations.js +90 -0
  565. package/node/tests/describeJalaliAdapter/testLocalization.js +20 -0
  566. package/node/tests/describePicker/describePicker.js +173 -0
  567. package/node/tests/describePicker/describePicker.types.js +5 -0
  568. package/node/tests/describePicker/index.js +12 -0
  569. package/node/tests/describeValue/describeValue.js +1 -1
  570. package/node/tests/describeValue/testControlledUnControlled.js +8 -9
  571. package/node/tests/describeValue/testPickerActionBar.js +46 -13
  572. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  573. package/node/timeViewRenderers/index.js +12 -0
  574. package/node/timeViewRenderers/timeViewRenderers.js +134 -4
  575. package/package.json +3 -10
  576. package/tests/describeAdapters/describeAdapters.js +1 -3
  577. package/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  578. package/tests/describeGregorianAdapter/testCalculations.js +29 -26
  579. package/tests/describeGregorianAdapter/testLocalization.js +2 -2
  580. package/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  581. package/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  582. package/tests/describeHijriAdapter/index.js +1 -0
  583. package/tests/describeHijriAdapter/testCalculations.js +91 -0
  584. package/tests/describeHijriAdapter/testLocalization.js +13 -0
  585. package/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  586. package/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  587. package/tests/describeJalaliAdapter/index.js +1 -0
  588. package/tests/describeJalaliAdapter/testCalculations.js +83 -0
  589. package/tests/describeJalaliAdapter/testLocalization.js +13 -0
  590. package/tests/describePicker/describePicker.js +162 -0
  591. package/tests/describePicker/describePicker.types.js +1 -0
  592. package/tests/describePicker/index.js +1 -0
  593. package/tests/describeValue/describeValue.js +1 -1
  594. package/tests/describeValue/testControlledUnControlled.js +8 -9
  595. package/tests/describeValue/testPickerActionBar.js +46 -13
  596. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  597. package/themeAugmentation/components.d.ts +12 -0
  598. package/themeAugmentation/overrides.d.ts +8 -0
  599. package/themeAugmentation/props.d.ts +8 -0
  600. package/timeViewRenderers/index.d.ts +1 -1
  601. package/timeViewRenderers/index.js +1 -1
  602. package/timeViewRenderers/timeViewRenderers.d.ts +11 -4
  603. package/timeViewRenderers/timeViewRenderers.js +130 -2
  604. /package/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
  605. /package/{legacy/internals/hooks/validation/models.js → MultiSectionDigitalClock/MultiSectionDigitalClock.types.js} +0 -0
  606. /package/{modern/internals/hooks/validation/models.js → internals/models/props/clock.js} +0 -0
  607. /package/internals/utils/{validation.d.ts → validation/extractValidationProps.d.ts} +0 -0
  608. /package/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
  609. /package/legacy/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
  610. /package/modern/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
  611. /package/node/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
  612. /package/node/internals/utils/{validation.js → validation/extractValidationProps.js} +0 -0
@@ -0,0 +1,108 @@
1
+ import { DateTime } from 'luxon';
2
+ import { AdapterFormats, AdapterUnits, FieldFormatTokenMap, MuiPickersAdapter } from '../models';
3
+ interface AdapterLuxonOptions {
4
+ formats?: Partial<AdapterFormats>;
5
+ locale?: string;
6
+ }
7
+ /**
8
+ * Based on `@date-io/luxon`
9
+ *
10
+ * MIT License
11
+ *
12
+ * Copyright (c) 2017 Dmitriy Kovalenko
13
+ *
14
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ * of this software and associated documentation files (the "Software"), to deal
16
+ * in the Software without restriction, including without limitation the rights
17
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ * copies of the Software, and to permit persons to whom the Software is
19
+ * furnished to do so, subject to the following conditions:
20
+ *
21
+ * The above copyright notice and this permission notice shall be included in all
22
+ * copies or substantial portions of the Software.
23
+ *
24
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ * SOFTWARE.
31
+ */
32
+ export declare class AdapterLuxon implements MuiPickersAdapter<DateTime> {
33
+ isMUIAdapter: boolean;
34
+ lib: string;
35
+ locale: string;
36
+ formats: AdapterFormats;
37
+ escapedCharacters: {
38
+ start: string;
39
+ end: string;
40
+ };
41
+ formatTokenMap: FieldFormatTokenMap;
42
+ constructor({ locale, formats }?: AdapterLuxonOptions);
43
+ date: (value?: any) => DateTime | null;
44
+ toJsDate: (value: DateTime) => Date;
45
+ parseISO: (isoString: string) => DateTime;
46
+ toISO: (value: DateTime) => string;
47
+ parse: (value: string, formatString: string) => DateTime | null;
48
+ getCurrentLocaleCode: () => string;
49
+ is12HourCycleInCurrentLocale: () => boolean;
50
+ expandFormat: (format: string) => string;
51
+ getFormatHelperText: (format: string) => string;
52
+ isNull: (value: DateTime | null) => boolean;
53
+ isValid: (value: any) => boolean;
54
+ format: (value: DateTime, formatKey: keyof AdapterFormats) => string;
55
+ formatByString: (value: DateTime, format: string) => string;
56
+ formatNumber: (numberToFormat: string) => string;
57
+ getDiff: (value: DateTime, comparing: DateTime | string, unit?: AdapterUnits) => number;
58
+ isEqual: (value: any, comparing: any) => boolean;
59
+ isSameYear: (value: DateTime, comparing: DateTime) => boolean;
60
+ isSameMonth: (value: DateTime, comparing: DateTime) => boolean;
61
+ isSameDay: (value: DateTime, comparing: DateTime) => boolean;
62
+ isSameHour: (value: DateTime, comparing: DateTime) => boolean;
63
+ isAfter: (value: DateTime, comparing: DateTime) => boolean;
64
+ isAfterYear: (value: DateTime, comparing: DateTime) => boolean;
65
+ isAfterDay: (value: DateTime, comparing: DateTime) => boolean;
66
+ isBefore: (value: DateTime, comparing: DateTime) => boolean;
67
+ isBeforeYear: (value: DateTime, comparing: DateTime) => boolean;
68
+ isBeforeDay: (value: DateTime, comparing: DateTime) => boolean;
69
+ isWithinRange: (value: DateTime, [start, end]: [DateTime, DateTime]) => boolean;
70
+ startOfYear: (value: DateTime) => DateTime;
71
+ startOfMonth: (value: DateTime) => DateTime;
72
+ startOfWeek: (value: DateTime) => DateTime;
73
+ startOfDay: (value: DateTime) => DateTime;
74
+ endOfYear: (value: DateTime) => DateTime;
75
+ endOfMonth: (value: DateTime) => DateTime;
76
+ endOfWeek: (value: DateTime) => DateTime;
77
+ endOfDay: (value: DateTime) => DateTime;
78
+ addYears: (value: DateTime, amount: number) => DateTime;
79
+ addMonths: (value: DateTime, amount: number) => DateTime;
80
+ addWeeks: (value: DateTime, amount: number) => DateTime;
81
+ addDays: (value: DateTime, amount: number) => DateTime;
82
+ addHours: (value: DateTime, amount: number) => DateTime;
83
+ addMinutes: (value: DateTime, amount: number) => DateTime;
84
+ addSeconds: (value: DateTime, amount: number) => DateTime;
85
+ getYear: (value: DateTime) => number;
86
+ getMonth: (value: DateTime) => number;
87
+ getDate: (value: DateTime) => number;
88
+ getHours: (value: DateTime) => number;
89
+ getMinutes: (value: DateTime) => number;
90
+ getSeconds: (value: DateTime) => number;
91
+ setYear: (value: DateTime, year: number) => DateTime;
92
+ setMonth: (value: DateTime, month: number) => DateTime;
93
+ setDate: (value: DateTime, date: number) => DateTime;
94
+ setHours: (value: DateTime, hours: number) => DateTime;
95
+ setMinutes: (value: DateTime, minutes: number) => DateTime;
96
+ setSeconds: (value: DateTime, seconds: number) => DateTime;
97
+ getDaysInMonth: (value: DateTime) => import("luxon").PossibleDaysInMonth;
98
+ getNextMonth: (value: DateTime) => DateTime;
99
+ getPreviousMonth: (value: DateTime) => DateTime;
100
+ getMonthArray: (value: DateTime) => DateTime[];
101
+ mergeDateAndTime: (dateParam: DateTime, timeParam: DateTime) => DateTime;
102
+ getWeekdays: () => string[];
103
+ getWeekArray: (value: DateTime) => DateTime[][];
104
+ getWeekNumber: (value: DateTime) => number;
105
+ getYearRange: (start: DateTime, end: DateTime) => DateTime[];
106
+ getMeridiemText: (ampm: 'am' | 'pm') => string;
107
+ }
108
+ export {};
@@ -0,0 +1,513 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ /* eslint-disable class-methods-use-this */
3
+ import { DateTime, Info } from 'luxon';
4
+ const formatTokenMap = {
5
+ // Year
6
+ y: {
7
+ sectionType: 'year',
8
+ contentType: 'digit',
9
+ maxLength: 4
10
+ },
11
+ yy: 'year',
12
+ yyyy: 'year',
13
+ // Month
14
+ L: {
15
+ sectionType: 'month',
16
+ contentType: 'digit',
17
+ maxLength: 2
18
+ },
19
+ LL: 'month',
20
+ LLL: {
21
+ sectionType: 'month',
22
+ contentType: 'letter'
23
+ },
24
+ LLLL: {
25
+ sectionType: 'month',
26
+ contentType: 'letter'
27
+ },
28
+ M: {
29
+ sectionType: 'month',
30
+ contentType: 'digit',
31
+ maxLength: 2
32
+ },
33
+ MM: 'month',
34
+ MMM: {
35
+ sectionType: 'month',
36
+ contentType: 'letter'
37
+ },
38
+ MMMM: {
39
+ sectionType: 'month',
40
+ contentType: 'letter'
41
+ },
42
+ // Day of the month
43
+ d: {
44
+ sectionType: 'day',
45
+ contentType: 'digit',
46
+ maxLength: 2
47
+ },
48
+ dd: 'day',
49
+ // Day of the week
50
+ c: {
51
+ sectionType: 'weekDay',
52
+ contentType: 'digit',
53
+ maxLength: 1
54
+ },
55
+ ccc: {
56
+ sectionType: 'weekDay',
57
+ contentType: 'letter'
58
+ },
59
+ cccc: {
60
+ sectionType: 'weekDay',
61
+ contentType: 'letter'
62
+ },
63
+ E: {
64
+ sectionType: 'weekDay',
65
+ contentType: 'digit',
66
+ maxLength: 2
67
+ },
68
+ EEE: {
69
+ sectionType: 'weekDay',
70
+ contentType: 'letter'
71
+ },
72
+ EEEE: {
73
+ sectionType: 'weekDay',
74
+ contentType: 'letter'
75
+ },
76
+ // Meridiem
77
+ a: 'meridiem',
78
+ // Hours
79
+ H: {
80
+ sectionType: 'hours',
81
+ contentType: 'digit',
82
+ maxLength: 2
83
+ },
84
+ HH: 'hours',
85
+ h: {
86
+ sectionType: 'hours',
87
+ contentType: 'digit',
88
+ maxLength: 2
89
+ },
90
+ hh: 'hours',
91
+ // Minutes
92
+ m: {
93
+ sectionType: 'minutes',
94
+ contentType: 'digit',
95
+ maxLength: 2
96
+ },
97
+ mm: 'minutes',
98
+ // Seconds
99
+ s: {
100
+ sectionType: 'seconds',
101
+ contentType: 'digit',
102
+ maxLength: 2
103
+ },
104
+ ss: 'seconds'
105
+ };
106
+ const defaultFormats = {
107
+ dayOfMonth: 'd',
108
+ fullDate: 'DD',
109
+ fullDateWithWeekday: 'DDDD',
110
+ fullDateTime: 'ff',
111
+ fullDateTime12h: 'DD, hh:mm a',
112
+ fullDateTime24h: 'DD, T',
113
+ fullTime: 't',
114
+ fullTime12h: 'hh:mm a',
115
+ fullTime24h: 'HH:mm',
116
+ hours12h: 'hh',
117
+ hours24h: 'HH',
118
+ keyboardDate: 'D',
119
+ keyboardDateTime: 'D t',
120
+ keyboardDateTime12h: 'D hh:mm a',
121
+ keyboardDateTime24h: 'D T',
122
+ minutes: 'mm',
123
+ seconds: 'ss',
124
+ month: 'LLLL',
125
+ monthAndDate: 'MMMM d',
126
+ monthAndYear: 'LLLL yyyy',
127
+ monthShort: 'MMM',
128
+ weekday: 'cccc',
129
+ weekdayShort: 'ccc',
130
+ normalDate: 'd MMMM',
131
+ normalDateWithWeekday: 'EEE, MMM d',
132
+ shortDate: 'MMM d',
133
+ year: 'yyyy'
134
+ };
135
+
136
+ /**
137
+ * Based on `@date-io/luxon`
138
+ *
139
+ * MIT License
140
+ *
141
+ * Copyright (c) 2017 Dmitriy Kovalenko
142
+ *
143
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
144
+ * of this software and associated documentation files (the "Software"), to deal
145
+ * in the Software without restriction, including without limitation the rights
146
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
147
+ * copies of the Software, and to permit persons to whom the Software is
148
+ * furnished to do so, subject to the following conditions:
149
+ *
150
+ * The above copyright notice and this permission notice shall be included in all
151
+ * copies or substantial portions of the Software.
152
+ *
153
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
154
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
155
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
156
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
157
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
158
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
159
+ * SOFTWARE.
160
+ */
161
+ export class AdapterLuxon {
162
+ constructor({
163
+ locale,
164
+ formats
165
+ } = {}) {
166
+ this.isMUIAdapter = true;
167
+ this.lib = 'luxon';
168
+ this.locale = void 0;
169
+ this.formats = void 0;
170
+ this.escapedCharacters = {
171
+ start: "'",
172
+ end: "'"
173
+ };
174
+ this.formatTokenMap = formatTokenMap;
175
+ this.date = value => {
176
+ if (typeof value === 'undefined') {
177
+ return DateTime.local();
178
+ }
179
+ if (value === null) {
180
+ return null;
181
+ }
182
+ if (typeof value === 'string') {
183
+ // @ts-ignore
184
+ return DateTime.fromJSDate(new Date(value), {
185
+ locale: this.locale
186
+ });
187
+ }
188
+ if (DateTime.isDateTime(value)) {
189
+ return value;
190
+ }
191
+
192
+ // @ts-ignore
193
+ return DateTime.fromJSDate(value, {
194
+ locale: this.locale
195
+ });
196
+ };
197
+ this.toJsDate = value => {
198
+ return value.toJSDate();
199
+ };
200
+ this.parseISO = isoString => {
201
+ return DateTime.fromISO(isoString);
202
+ };
203
+ this.toISO = value => {
204
+ return value.toISO({
205
+ format: 'extended'
206
+ });
207
+ };
208
+ this.parse = (value, formatString) => {
209
+ if (value === '') {
210
+ return null;
211
+ }
212
+ return DateTime.fromFormat(value, formatString, {
213
+ locale: this.locale
214
+ });
215
+ };
216
+ this.getCurrentLocaleCode = () => {
217
+ return this.locale;
218
+ };
219
+ /* istanbul ignore next */
220
+ this.is12HourCycleInCurrentLocale = () => {
221
+ var _Intl$DateTimeFormat, _Intl$DateTimeFormat$;
222
+ if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {
223
+ return true; // Luxon defaults to en-US if Intl not found
224
+ }
225
+
226
+ return Boolean((_Intl$DateTimeFormat = new Intl.DateTimeFormat(this.locale, {
227
+ hour: 'numeric'
228
+ })) == null ? void 0 : (_Intl$DateTimeFormat$ = _Intl$DateTimeFormat.resolvedOptions()) == null ? void 0 : _Intl$DateTimeFormat$.hour12);
229
+ };
230
+ this.expandFormat = format => {
231
+ if (!DateTime.expandFormat) {
232
+ throw Error('Your luxon version does not support `expandFormat`. Consider upgrading it to v3.0.2');
233
+ }
234
+ // Extract escaped section to avoid extending them
235
+ const longFormatRegexp = /''|'(''|[^'])+('|$)|[^']*/g;
236
+ return format.match(longFormatRegexp).map(token => {
237
+ const firstCharacter = token[0];
238
+ if (firstCharacter === "'") {
239
+ return token;
240
+ }
241
+ return DateTime.expandFormat(token, {
242
+ locale: this.locale
243
+ });
244
+ }).join('')
245
+ // The returned format can contain `yyyyy` which means year between 4 and 6 digits.
246
+ // This value is supported by luxon parser but not luxon formatter.
247
+ // To avoid conflicts, we replace it by 4 digits which is enough for most use-cases.
248
+ .replace('yyyyy', 'yyyy');
249
+ };
250
+ this.getFormatHelperText = format => {
251
+ return this.expandFormat(format).replace(/(a)/g, '(a|p)m').toLocaleLowerCase();
252
+ };
253
+ this.isNull = value => {
254
+ return value === null;
255
+ };
256
+ this.isValid = value => {
257
+ if (DateTime.isDateTime(value)) {
258
+ return value.isValid;
259
+ }
260
+ if (value === null) {
261
+ return false;
262
+ }
263
+ return this.isValid(this.date(value));
264
+ };
265
+ this.format = (value, formatKey) => {
266
+ return this.formatByString(value, this.formats[formatKey]);
267
+ };
268
+ this.formatByString = (value, format) => {
269
+ return value.setLocale(this.locale).toFormat(format);
270
+ };
271
+ this.formatNumber = numberToFormat => {
272
+ return numberToFormat;
273
+ };
274
+ this.getDiff = (value, comparing, unit) => {
275
+ if (typeof comparing === 'string') {
276
+ comparing = DateTime.fromJSDate(new Date(comparing));
277
+ }
278
+ if (unit) {
279
+ return Math.floor(value.diff(comparing).as(unit));
280
+ }
281
+ return value.diff(comparing).as('millisecond');
282
+ };
283
+ this.isEqual = (value, comparing) => {
284
+ if (value === null && comparing === null) {
285
+ return true;
286
+ }
287
+
288
+ // Make sure that null will not be passed to this.date
289
+ if (value === null || comparing === null) {
290
+ return false;
291
+ }
292
+ return this.date(value).equals(this.date(comparing));
293
+ };
294
+ this.isSameYear = (value, comparing) => {
295
+ return value.hasSame(comparing, 'year');
296
+ };
297
+ this.isSameMonth = (value, comparing) => {
298
+ return value.hasSame(comparing, 'month');
299
+ };
300
+ this.isSameDay = (value, comparing) => {
301
+ return value.hasSame(comparing, 'day');
302
+ };
303
+ this.isSameHour = (value, comparing) => {
304
+ return value.hasSame(comparing, 'hour');
305
+ };
306
+ this.isAfter = (value, comparing) => {
307
+ return value > comparing;
308
+ };
309
+ this.isAfterYear = (value, comparing) => {
310
+ const diff = value.diff(comparing.endOf('year'), 'years').toObject();
311
+ return diff.years > 0;
312
+ };
313
+ this.isAfterDay = (value, comparing) => {
314
+ const diff = value.diff(comparing.endOf('day'), 'days').toObject();
315
+ return diff.days > 0;
316
+ };
317
+ this.isBefore = (value, comparing) => {
318
+ return value < comparing;
319
+ };
320
+ this.isBeforeYear = (value, comparing) => {
321
+ const diff = value.diff(comparing.startOf('year'), 'years').toObject();
322
+ return diff.years < 0;
323
+ };
324
+ this.isBeforeDay = (value, comparing) => {
325
+ const diff = value.diff(comparing.startOf('day'), 'days').toObject();
326
+ return diff.days < 0;
327
+ };
328
+ this.isWithinRange = (value, [start, end]) => {
329
+ return value.equals(start) || value.equals(end) || this.isAfter(value, start) && this.isBefore(value, end);
330
+ };
331
+ this.startOfYear = value => {
332
+ return value.startOf('year');
333
+ };
334
+ this.startOfMonth = value => {
335
+ return value.startOf('month');
336
+ };
337
+ this.startOfWeek = value => {
338
+ return value.startOf('week');
339
+ };
340
+ this.startOfDay = value => {
341
+ return value.startOf('day');
342
+ };
343
+ this.endOfYear = value => {
344
+ return value.endOf('year');
345
+ };
346
+ this.endOfMonth = value => {
347
+ return value.endOf('month');
348
+ };
349
+ this.endOfWeek = value => {
350
+ return value.endOf('week');
351
+ };
352
+ this.endOfDay = value => {
353
+ return value.endOf('day');
354
+ };
355
+ this.addYears = (value, amount) => {
356
+ return value.plus({
357
+ years: amount
358
+ });
359
+ };
360
+ this.addMonths = (value, amount) => {
361
+ return value.plus({
362
+ months: amount
363
+ });
364
+ };
365
+ this.addWeeks = (value, amount) => {
366
+ return value.plus({
367
+ weeks: amount
368
+ });
369
+ };
370
+ this.addDays = (value, amount) => {
371
+ return value.plus({
372
+ days: amount
373
+ });
374
+ };
375
+ this.addHours = (value, amount) => {
376
+ return value.plus({
377
+ hours: amount
378
+ });
379
+ };
380
+ this.addMinutes = (value, amount) => {
381
+ return value.plus({
382
+ minutes: amount
383
+ });
384
+ };
385
+ this.addSeconds = (value, amount) => {
386
+ return value.plus({
387
+ seconds: amount
388
+ });
389
+ };
390
+ this.getYear = value => {
391
+ return value.get('year');
392
+ };
393
+ this.getMonth = value => {
394
+ // See https://github.com/moment/luxon/blob/master/docs/moment.md#major-functional-differences
395
+ return value.get('month') - 1;
396
+ };
397
+ this.getDate = value => {
398
+ return value.get('day');
399
+ };
400
+ this.getHours = value => {
401
+ return value.get('hour');
402
+ };
403
+ this.getMinutes = value => {
404
+ return value.get('minute');
405
+ };
406
+ this.getSeconds = value => {
407
+ return value.get('second');
408
+ };
409
+ this.setYear = (value, year) => {
410
+ return value.set({
411
+ year
412
+ });
413
+ };
414
+ this.setMonth = (value, month) => {
415
+ return value.set({
416
+ month: month + 1
417
+ });
418
+ };
419
+ this.setDate = (value, date) => {
420
+ return value.set({
421
+ day: date
422
+ });
423
+ };
424
+ this.setHours = (value, hours) => {
425
+ return value.set({
426
+ hour: hours
427
+ });
428
+ };
429
+ this.setMinutes = (value, minutes) => {
430
+ return value.set({
431
+ minute: minutes
432
+ });
433
+ };
434
+ this.setSeconds = (value, seconds) => {
435
+ return value.set({
436
+ second: seconds
437
+ });
438
+ };
439
+ this.getDaysInMonth = value => {
440
+ return value.daysInMonth;
441
+ };
442
+ this.getNextMonth = value => {
443
+ return value.plus({
444
+ months: 1
445
+ });
446
+ };
447
+ this.getPreviousMonth = value => {
448
+ return value.minus({
449
+ months: 1
450
+ });
451
+ };
452
+ this.getMonthArray = value => {
453
+ const firstMonth = value.startOf('year');
454
+ const monthArray = [firstMonth];
455
+ while (monthArray.length < 12) {
456
+ const prevMonth = monthArray[monthArray.length - 1];
457
+ monthArray.push(this.getNextMonth(prevMonth));
458
+ }
459
+ return monthArray;
460
+ };
461
+ this.mergeDateAndTime = (dateParam, timeParam) => {
462
+ return dateParam.set({
463
+ second: timeParam.second,
464
+ hour: timeParam.hour,
465
+ minute: timeParam.minute
466
+ });
467
+ };
468
+ this.getWeekdays = () => {
469
+ return Info.weekdaysFormat('narrow', {
470
+ locale: this.locale
471
+ });
472
+ };
473
+ this.getWeekArray = value => {
474
+ const {
475
+ days
476
+ } = value.endOf('month').endOf('week').diff(value.startOf('month').startOf('week'), 'days').toObject();
477
+ const weeks = [];
478
+ new Array(Math.round(days)).fill(0).map((_, i) => i).map(day => value.startOf('month').startOf('week').plus({
479
+ days: day
480
+ })).forEach((v, i) => {
481
+ if (i === 0 || i % 7 === 0 && i > 6) {
482
+ weeks.push([v]);
483
+ return;
484
+ }
485
+ weeks[weeks.length - 1].push(v);
486
+ });
487
+ return weeks;
488
+ };
489
+ this.getWeekNumber = value => {
490
+ return value.weekNumber;
491
+ };
492
+ this.getYearRange = (start, end) => {
493
+ const startDate = start.startOf('year');
494
+ const endDate = end.endOf('year');
495
+ let current = startDate;
496
+ const years = [];
497
+ while (current < endDate) {
498
+ years.push(current);
499
+ current = current.plus({
500
+ year: 1
501
+ });
502
+ }
503
+ return years;
504
+ };
505
+ this.getMeridiemText = ampm => {
506
+ return Info.meridiems({
507
+ locale: this.locale
508
+ }).find(v => v.toLowerCase() === ampm.toLowerCase());
509
+ };
510
+ this.locale = locale || 'en-US';
511
+ this.formats = _extends({}, defaultFormats, formats);
512
+ }
513
+ }
@@ -1,14 +1 @@
1
- import { DateTime } from 'luxon';
2
- import BaseAdapterLuxon from '@date-io/luxon';
3
- import { FieldFormatTokenMap, MuiPickersAdapter } from '../models';
4
- export declare class AdapterLuxon extends BaseAdapterLuxon implements MuiPickersAdapter<DateTime> {
5
- isMUIAdapter: boolean;
6
- formatTokenMap: FieldFormatTokenMap;
7
- escapedCharacters: {
8
- start: string;
9
- end: string;
10
- };
11
- expandFormat: (format: string) => string;
12
- getFormatHelperText: (format: string) => string;
13
- getWeekNumber: (date: DateTime) => number;
14
- }
1
+ export { AdapterLuxon } from './AdapterLuxon';