@mui/x-date-pickers 6.2.1 → 6.3.1

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 (616) 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 -3
  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 +24 -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 +25 -3
  40. package/DateTimeField/DateTimeField.types.d.ts +4 -11
  41. package/DateTimeField/useDateTimeField.js +4 -2
  42. package/DateTimePicker/DateTimePicker.js +1 -0
  43. package/DateTimePicker/shared.d.ts +6 -12
  44. package/DesktopDatePicker/DesktopDatePicker.js +1 -1
  45. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
  46. package/DesktopTimePicker/DesktopTimePicker.js +52 -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 +5 -67
  86. package/TimeField/TimeField.js +25 -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 +61 -35
  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 +12 -12
  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} +13 -3
  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/utils/{validation.d.ts → validation/extractValidationProps.d.ts} +1 -1
  143. package/internals/utils/{validation.js → validation/extractValidationProps.js} +1 -1
  144. package/internals/{hooks/validation/useDateValidation.d.ts → utils/validation/validateDate.d.ts} +2 -3
  145. package/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
  146. package/internals/{hooks/validation/useDateTimeValidation.d.ts → utils/validation/validateDateTime.d.ts} +3 -3
  147. package/{modern/internals/hooks/validation/useDateTimeValidation.js → internals/utils/validation/validateDateTime.js} +2 -2
  148. package/internals/{hooks/validation/useTimeValidation.d.ts → utils/validation/validateTime.d.ts} +2 -2
  149. package/{modern/internals/hooks/validation/useTimeValidation.js → internals/utils/validation/validateTime.js} +1 -1
  150. package/internals/utils/views.d.ts +3 -2
  151. package/legacy/AdapterDateFns/AdapterDateFns.js +606 -0
  152. package/legacy/AdapterDateFns/index.js +1 -165
  153. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +620 -0
  154. package/legacy/AdapterDateFnsJalali/index.js +1 -165
  155. package/legacy/AdapterDayjs/AdapterDayjs.js +146 -111
  156. package/legacy/AdapterLuxon/AdapterLuxon.js +524 -0
  157. package/legacy/AdapterLuxon/index.js +1 -127
  158. package/legacy/AdapterMoment/AdapterMoment.js +422 -0
  159. package/legacy/AdapterMoment/index.js +1 -115
  160. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +284 -0
  161. package/legacy/AdapterMomentHijri/index.js +1 -90
  162. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +291 -0
  163. package/legacy/AdapterMomentJalaali/index.js +1 -103
  164. package/legacy/DateCalendar/DayCalendar.js +1 -1
  165. package/legacy/DateCalendar/useCalendarState.js +1 -1
  166. package/legacy/DateCalendar/useIsDateDisabled.js +28 -0
  167. package/legacy/DateField/DateField.js +24 -3
  168. package/legacy/DateField/useDateField.js +4 -2
  169. package/legacy/DatePicker/DatePickerToolbar.js +1 -1
  170. package/legacy/DateTimeField/DateTimeField.js +25 -3
  171. package/legacy/DateTimeField/useDateTimeField.js +4 -2
  172. package/legacy/DateTimePicker/DateTimePicker.js +1 -0
  173. package/legacy/DesktopDatePicker/DesktopDatePicker.js +1 -1
  174. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
  175. package/legacy/DesktopTimePicker/DesktopTimePicker.js +53 -8
  176. package/legacy/DigitalClock/DigitalClock.js +419 -0
  177. package/legacy/DigitalClock/DigitalClock.types.js +1 -0
  178. package/legacy/DigitalClock/digitalClockClasses.js +6 -0
  179. package/legacy/DigitalClock/index.js +2 -0
  180. package/legacy/MobileDatePicker/MobileDatePicker.js +1 -1
  181. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -1
  182. package/legacy/MobileTimePicker/MobileTimePicker.js +2 -1
  183. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +508 -0
  184. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
  185. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  186. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +157 -0
  187. package/legacy/MultiSectionDigitalClock/index.js +3 -0
  188. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  189. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  190. package/legacy/PickersDay/PickersDay.js +3 -1
  191. package/legacy/PickersLayout/PickersLayout.js +2 -2
  192. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -1
  193. package/legacy/StaticTimePicker/StaticTimePicker.js +2 -1
  194. package/legacy/TimeClock/TimeClock.js +35 -12
  195. package/legacy/TimeField/TimeField.js +25 -3
  196. package/legacy/TimeField/useTimeField.js +4 -2
  197. package/legacy/TimePicker/TimePicker.js +25 -2
  198. package/legacy/TimePicker/TimePickerToolbar.js +2 -2
  199. package/legacy/index.js +4 -1
  200. package/legacy/internals/constants/dimensions.js +2 -1
  201. package/legacy/internals/demo/DemoContainer.js +4 -1
  202. package/legacy/internals/hooks/date-helpers-hooks.js +3 -3
  203. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  204. package/legacy/internals/hooks/useField/useField.js +11 -10
  205. package/legacy/internals/hooks/useField/useField.utils.js +59 -35
  206. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  207. package/legacy/internals/hooks/useField/useFieldState.js +6 -4
  208. package/legacy/internals/hooks/usePicker/usePickerValue.js +1 -1
  209. package/legacy/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  210. package/legacy/internals/hooks/useViews.js +30 -14
  211. package/legacy/internals/index.js +5 -5
  212. package/legacy/internals/models/index.js +2 -1
  213. package/legacy/internals/models/props/clock.js +1 -0
  214. package/legacy/internals/models/validation.js +1 -0
  215. package/legacy/internals/utils/time-utils.js +2 -1
  216. package/legacy/internals/utils/{validation.js → validation/extractValidationProps.js} +1 -1
  217. package/legacy/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -28
  218. package/legacy/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +2 -2
  219. package/legacy/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
  220. package/legacy/locales/beBY.js +5 -3
  221. package/legacy/locales/caES.js +6 -1
  222. package/legacy/locales/csCZ.js +6 -4
  223. package/legacy/locales/daDK.js +6 -2
  224. package/legacy/locales/deDE.js +6 -2
  225. package/legacy/locales/enUS.js +4 -0
  226. package/legacy/locales/esES.js +6 -1
  227. package/legacy/locales/faIR.js +11 -1
  228. package/legacy/locales/fiFI.js +6 -1
  229. package/legacy/locales/frFR.js +6 -1
  230. package/legacy/locales/heIL.js +6 -1
  231. package/legacy/locales/huHU.js +6 -2
  232. package/legacy/locales/index.js +1 -0
  233. package/legacy/locales/isIS.js +11 -1
  234. package/legacy/locales/itIT.js +6 -1
  235. package/legacy/locales/jaJP.js +6 -2
  236. package/legacy/locales/koKR.js +6 -1
  237. package/legacy/locales/kzKZ.js +6 -2
  238. package/legacy/locales/nbNO.js +11 -1
  239. package/legacy/locales/nlNL.js +11 -1
  240. package/legacy/locales/plPL.js +11 -1
  241. package/legacy/locales/ptBR.js +11 -1
  242. package/legacy/locales/ruRU.js +6 -2
  243. package/legacy/locales/svSE.js +11 -1
  244. package/legacy/locales/trTR.js +22 -7
  245. package/legacy/locales/ukUA.js +11 -1
  246. package/legacy/locales/urPK.js +11 -1
  247. package/legacy/locales/zhCN.js +44 -23
  248. package/legacy/models/common.js +1 -0
  249. package/legacy/models/index.js +2 -1
  250. package/legacy/tests/describeAdapters/describeAdapters.js +1 -3
  251. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  252. package/legacy/tests/describeGregorianAdapter/testCalculations.js +29 -26
  253. package/legacy/tests/describeGregorianAdapter/testLocalization.js +2 -2
  254. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  255. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  256. package/legacy/tests/describeHijriAdapter/index.js +1 -0
  257. package/legacy/tests/describeHijriAdapter/testCalculations.js +94 -0
  258. package/legacy/tests/describeHijriAdapter/testLocalization.js +12 -0
  259. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  260. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  261. package/legacy/tests/describeJalaliAdapter/index.js +1 -0
  262. package/legacy/tests/describeJalaliAdapter/testCalculations.js +82 -0
  263. package/legacy/tests/describeJalaliAdapter/testLocalization.js +12 -0
  264. package/legacy/tests/describePicker/describePicker.js +159 -0
  265. package/legacy/tests/describePicker/describePicker.types.js +1 -0
  266. package/legacy/tests/describePicker/index.js +1 -0
  267. package/legacy/tests/describeValidation/testTextFieldValidation.js +26 -0
  268. package/legacy/tests/describeValue/describeValue.js +1 -1
  269. package/legacy/tests/describeValue/testControlledUnControlled.js +8 -9
  270. package/legacy/tests/describeValue/testPickerActionBar.js +46 -13
  271. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  272. package/legacy/timeViewRenderers/index.js +1 -1
  273. package/legacy/timeViewRenderers/timeViewRenderers.js +132 -4
  274. package/locales/beBY.d.ts +4 -2
  275. package/locales/beBY.js +3 -3
  276. package/locales/caES.d.ts +4 -2
  277. package/locales/caES.js +4 -1
  278. package/locales/csCZ.d.ts +4 -2
  279. package/locales/csCZ.js +4 -4
  280. package/locales/daDK.d.ts +4 -2
  281. package/locales/daDK.js +4 -2
  282. package/locales/deDE.d.ts +4 -2
  283. package/locales/deDE.js +4 -2
  284. package/locales/enUS.d.ts +3 -2
  285. package/locales/enUS.js +2 -0
  286. package/locales/esES.d.ts +4 -2
  287. package/locales/esES.js +4 -1
  288. package/locales/faIR.d.ts +4 -2
  289. package/locales/faIR.js +9 -1
  290. package/locales/fiFI.d.ts +4 -2
  291. package/locales/fiFI.js +4 -1
  292. package/locales/frFR.d.ts +4 -2
  293. package/locales/frFR.js +4 -1
  294. package/locales/heIL.d.ts +4 -2
  295. package/locales/heIL.js +4 -1
  296. package/locales/huHU.d.ts +4 -2
  297. package/locales/huHU.js +4 -2
  298. package/locales/index.d.ts +1 -0
  299. package/locales/index.js +1 -0
  300. package/locales/isIS.d.ts +4 -2
  301. package/locales/isIS.js +9 -1
  302. package/locales/itIT.d.ts +4 -2
  303. package/locales/itIT.js +4 -1
  304. package/locales/jaJP.d.ts +4 -2
  305. package/locales/jaJP.js +4 -2
  306. package/locales/koKR.d.ts +4 -2
  307. package/locales/koKR.js +4 -1
  308. package/locales/kzKZ.d.ts +4 -2
  309. package/locales/kzKZ.js +4 -2
  310. package/locales/nbNO.d.ts +4 -2
  311. package/locales/nbNO.js +9 -1
  312. package/locales/nlNL.d.ts +8 -7
  313. package/locales/nlNL.js +9 -1
  314. package/locales/plPL.d.ts +4 -2
  315. package/locales/plPL.js +9 -1
  316. package/locales/ptBR.d.ts +4 -2
  317. package/locales/ptBR.js +9 -1
  318. package/locales/ruRU.d.ts +4 -2
  319. package/locales/ruRU.js +4 -2
  320. package/locales/svSE.d.ts +4 -2
  321. package/locales/svSE.js +9 -1
  322. package/locales/trTR.d.ts +4 -2
  323. package/locales/trTR.js +14 -7
  324. package/locales/ukUA.d.ts +4 -2
  325. package/locales/ukUA.js +9 -1
  326. package/locales/urPK.d.ts +4 -2
  327. package/locales/urPK.js +9 -1
  328. package/locales/utils/getPickersLocalization.d.ts +3 -2
  329. package/locales/utils/pickersLocaleTextApi.d.ts +5 -3
  330. package/locales/zhCN.d.ts +4 -2
  331. package/locales/zhCN.js +22 -23
  332. package/models/adapters.d.ts +7 -6
  333. package/models/common.d.ts +5 -0
  334. package/models/common.js +1 -0
  335. package/models/fields.d.ts +19 -2
  336. package/models/index.d.ts +1 -0
  337. package/models/index.js +2 -1
  338. package/modern/AdapterDateFns/AdapterDateFns.js +597 -0
  339. package/modern/AdapterDateFns/index.js +1 -149
  340. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +608 -0
  341. package/modern/AdapterDateFnsJalali/index.js +1 -148
  342. package/modern/AdapterDayjs/AdapterDayjs.js +146 -111
  343. package/modern/AdapterLuxon/AdapterLuxon.js +512 -0
  344. package/modern/AdapterLuxon/index.js +1 -111
  345. package/modern/AdapterMoment/AdapterMoment.js +416 -0
  346. package/modern/AdapterMoment/index.js +1 -99
  347. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +269 -0
  348. package/modern/AdapterMomentHijri/index.js +1 -74
  349. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +276 -0
  350. package/modern/AdapterMomentJalaali/index.js +1 -87
  351. package/modern/DateCalendar/DayCalendar.js +1 -1
  352. package/modern/DateCalendar/useCalendarState.js +1 -1
  353. package/modern/DateCalendar/useIsDateDisabled.js +27 -0
  354. package/modern/DateField/DateField.js +24 -3
  355. package/modern/DateField/useDateField.js +4 -2
  356. package/modern/DatePicker/DatePickerToolbar.js +1 -1
  357. package/modern/DateTimeField/DateTimeField.js +25 -3
  358. package/modern/DateTimeField/useDateTimeField.js +4 -2
  359. package/modern/DateTimePicker/DateTimePicker.js +1 -0
  360. package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
  361. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -1
  362. package/modern/DesktopTimePicker/DesktopTimePicker.js +51 -7
  363. package/modern/DigitalClock/DigitalClock.js +396 -0
  364. package/modern/DigitalClock/DigitalClock.types.js +1 -0
  365. package/modern/DigitalClock/digitalClockClasses.js +6 -0
  366. package/modern/DigitalClock/index.js +2 -0
  367. package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
  368. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -1
  369. package/modern/MobileTimePicker/MobileTimePicker.js +2 -1
  370. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +479 -0
  371. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +1 -0
  372. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +65 -0
  373. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +149 -0
  374. package/modern/MultiSectionDigitalClock/index.js +3 -0
  375. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +6 -0
  376. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +6 -0
  377. package/modern/PickersDay/PickersDay.js +4 -1
  378. package/modern/PickersLayout/PickersLayout.js +2 -2
  379. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -1
  380. package/modern/StaticTimePicker/StaticTimePicker.js +2 -1
  381. package/modern/TimeClock/TimeClock.js +35 -12
  382. package/modern/TimeField/TimeField.js +25 -3
  383. package/modern/TimeField/useTimeField.js +4 -2
  384. package/modern/TimePicker/TimePicker.js +25 -2
  385. package/modern/TimePicker/TimePickerToolbar.js +2 -2
  386. package/modern/index.js +4 -1
  387. package/modern/internals/constants/dimensions.js +2 -1
  388. package/modern/internals/demo/DemoContainer.js +4 -1
  389. package/modern/internals/hooks/date-helpers-hooks.js +3 -3
  390. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  391. package/modern/internals/hooks/useField/useField.js +12 -11
  392. package/modern/internals/hooks/useField/useField.utils.js +61 -35
  393. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +18 -10
  394. package/modern/internals/hooks/useField/useFieldState.js +4 -3
  395. package/modern/internals/hooks/usePicker/usePickerValue.js +1 -1
  396. package/modern/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  397. package/modern/internals/hooks/useViews.js +29 -13
  398. package/modern/internals/index.js +5 -5
  399. package/modern/internals/models/index.js +2 -1
  400. package/modern/internals/models/props/clock.js +1 -0
  401. package/modern/internals/models/validation.js +1 -0
  402. package/modern/internals/utils/time-utils.js +2 -1
  403. package/modern/internals/utils/{validation.js → validation/extractValidationProps.js} +1 -1
  404. package/modern/internals/{hooks/validation/useDateValidation.js → utils/validation/validateDate.js} +1 -27
  405. package/{internals/hooks/validation/useDateTimeValidation.js → modern/internals/utils/validation/validateDateTime.js} +2 -2
  406. package/{internals/hooks/validation/useTimeValidation.js → modern/internals/utils/validation/validateTime.js} +1 -1
  407. package/modern/locales/beBY.js +3 -3
  408. package/modern/locales/caES.js +4 -1
  409. package/modern/locales/csCZ.js +4 -4
  410. package/modern/locales/daDK.js +4 -2
  411. package/modern/locales/deDE.js +4 -2
  412. package/modern/locales/enUS.js +2 -0
  413. package/modern/locales/esES.js +4 -1
  414. package/modern/locales/faIR.js +9 -1
  415. package/modern/locales/fiFI.js +4 -1
  416. package/modern/locales/frFR.js +4 -1
  417. package/modern/locales/heIL.js +4 -1
  418. package/modern/locales/huHU.js +4 -2
  419. package/modern/locales/index.js +1 -0
  420. package/modern/locales/isIS.js +9 -1
  421. package/modern/locales/itIT.js +4 -1
  422. package/modern/locales/jaJP.js +4 -2
  423. package/modern/locales/koKR.js +4 -1
  424. package/modern/locales/kzKZ.js +4 -2
  425. package/modern/locales/nbNO.js +9 -1
  426. package/modern/locales/nlNL.js +9 -1
  427. package/modern/locales/plPL.js +9 -1
  428. package/modern/locales/ptBR.js +9 -1
  429. package/modern/locales/ruRU.js +4 -2
  430. package/modern/locales/svSE.js +9 -1
  431. package/modern/locales/trTR.js +14 -7
  432. package/modern/locales/ukUA.js +9 -1
  433. package/modern/locales/urPK.js +9 -1
  434. package/modern/locales/zhCN.js +22 -23
  435. package/modern/models/common.js +1 -0
  436. package/modern/models/index.js +2 -1
  437. package/modern/tests/describeAdapters/describeAdapters.js +1 -3
  438. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  439. package/modern/tests/describeGregorianAdapter/testCalculations.js +29 -26
  440. package/modern/tests/describeGregorianAdapter/testLocalization.js +2 -2
  441. package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  442. package/modern/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  443. package/modern/tests/describeHijriAdapter/index.js +1 -0
  444. package/modern/tests/describeHijriAdapter/testCalculations.js +91 -0
  445. package/modern/tests/describeHijriAdapter/testLocalization.js +13 -0
  446. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  447. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  448. package/modern/tests/describeJalaliAdapter/index.js +1 -0
  449. package/modern/tests/describeJalaliAdapter/testCalculations.js +83 -0
  450. package/modern/tests/describeJalaliAdapter/testLocalization.js +13 -0
  451. package/modern/tests/describePicker/describePicker.js +162 -0
  452. package/modern/tests/describePicker/describePicker.types.js +1 -0
  453. package/modern/tests/describePicker/index.js +1 -0
  454. package/modern/tests/describeValidation/testTextFieldValidation.js +27 -0
  455. package/modern/tests/describeValue/describeValue.js +1 -1
  456. package/modern/tests/describeValue/testControlledUnControlled.js +8 -9
  457. package/modern/tests/describeValue/testPickerActionBar.js +46 -13
  458. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  459. package/modern/timeViewRenderers/index.js +1 -1
  460. package/modern/timeViewRenderers/timeViewRenderers.js +130 -2
  461. package/node/AdapterDateFns/AdapterDateFns.js +607 -0
  462. package/node/AdapterDateFns/index.js +6 -152
  463. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +618 -0
  464. package/node/AdapterDateFnsJalali/index.js +6 -151
  465. package/node/AdapterDayjs/AdapterDayjs.js +146 -111
  466. package/node/AdapterLuxon/AdapterLuxon.js +521 -0
  467. package/node/AdapterLuxon/index.js +6 -114
  468. package/node/AdapterMoment/AdapterMoment.js +425 -0
  469. package/node/AdapterMoment/index.js +6 -102
  470. package/node/AdapterMomentHijri/AdapterMomentHijri.js +278 -0
  471. package/node/AdapterMomentHijri/index.js +6 -77
  472. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +285 -0
  473. package/node/AdapterMomentJalaali/index.js +6 -90
  474. package/node/DateCalendar/DayCalendar.js +2 -2
  475. package/node/DateCalendar/useCalendarState.js +2 -2
  476. package/node/{internals/hooks/validation/useDateValidation.js → DateCalendar/useIsDateDisabled.js} +4 -37
  477. package/node/DateField/DateField.js +24 -3
  478. package/node/DateField/useDateField.js +5 -3
  479. package/node/DatePicker/DatePickerToolbar.js +1 -1
  480. package/node/DateTimeField/DateTimeField.js +25 -3
  481. package/node/DateTimeField/useDateTimeField.js +5 -3
  482. package/node/DateTimePicker/DateTimePicker.js +1 -0
  483. package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
  484. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -2
  485. package/node/DesktopTimePicker/DesktopTimePicker.js +52 -8
  486. package/node/DigitalClock/DigitalClock.js +406 -0
  487. package/node/DigitalClock/digitalClockClasses.js +15 -0
  488. package/node/DigitalClock/index.js +25 -0
  489. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  490. package/node/MobileDateTimePicker/MobileDateTimePicker.js +3 -2
  491. package/node/MobileTimePicker/MobileTimePicker.js +3 -2
  492. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +489 -0
  493. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +5 -0
  494. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +73 -0
  495. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +159 -0
  496. package/node/MultiSectionDigitalClock/index.js +32 -0
  497. package/node/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +15 -0
  498. package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +15 -0
  499. package/node/PickersDay/PickersDay.js +4 -1
  500. package/node/PickersLayout/PickersLayout.js +2 -2
  501. package/node/StaticDateTimePicker/StaticDateTimePicker.js +3 -2
  502. package/node/StaticTimePicker/StaticTimePicker.js +3 -2
  503. package/node/TimeClock/TimeClock.js +35 -12
  504. package/node/TimeField/TimeField.js +25 -3
  505. package/node/TimeField/useTimeField.js +5 -3
  506. package/node/TimePicker/TimePicker.js +25 -2
  507. package/node/TimePicker/TimePickerToolbar.js +2 -2
  508. package/node/index.js +25 -1
  509. package/node/internals/constants/dimensions.js +4 -2
  510. package/node/internals/demo/DemoContainer.js +4 -1
  511. package/node/internals/hooks/date-helpers-hooks.js +3 -3
  512. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -1
  513. package/node/internals/hooks/useField/useField.js +12 -11
  514. package/node/internals/hooks/useField/useField.utils.js +64 -37
  515. package/node/internals/hooks/useField/useFieldCharacterEditing.js +17 -9
  516. package/node/internals/hooks/useField/useFieldState.js +4 -3
  517. package/node/internals/hooks/usePicker/usePickerValue.js +1 -1
  518. package/node/internals/hooks/{validation/useValidation.js → useValidation.js} +1 -1
  519. package/node/internals/hooks/useViews.js +29 -13
  520. package/node/internals/index.js +9 -9
  521. package/node/internals/models/index.js +11 -0
  522. package/node/internals/models/props/clock.js +5 -0
  523. package/node/internals/models/validation.js +5 -0
  524. package/node/internals/utils/time-utils.js +2 -1
  525. package/node/internals/utils/{validation.js → validation/extractValidationProps.js} +1 -1
  526. package/node/internals/utils/validation/validateDate.js +40 -0
  527. package/node/internals/{hooks/validation/useDateTimeValidation.js → utils/validation/validateDateTime.js} +4 -4
  528. package/node/internals/{hooks/validation/useTimeValidation.js → utils/validation/validateTime.js} +1 -1
  529. package/node/locales/beBY.js +3 -3
  530. package/node/locales/caES.js +4 -1
  531. package/node/locales/csCZ.js +4 -2
  532. package/node/locales/daDK.js +4 -1
  533. package/node/locales/deDE.js +4 -1
  534. package/node/locales/enUS.js +2 -0
  535. package/node/locales/esES.js +4 -1
  536. package/node/locales/faIR.js +9 -1
  537. package/node/locales/fiFI.js +4 -1
  538. package/node/locales/frFR.js +4 -1
  539. package/node/locales/heIL.js +4 -1
  540. package/node/locales/huHU.js +4 -1
  541. package/node/locales/index.js +11 -0
  542. package/node/locales/isIS.js +9 -1
  543. package/node/locales/itIT.js +4 -1
  544. package/node/locales/jaJP.js +4 -1
  545. package/node/locales/koKR.js +4 -1
  546. package/node/locales/kzKZ.js +4 -1
  547. package/node/locales/nbNO.js +9 -1
  548. package/node/locales/nlNL.js +9 -1
  549. package/node/locales/plPL.js +9 -1
  550. package/node/locales/ptBR.js +9 -1
  551. package/node/locales/ruRU.js +4 -1
  552. package/node/locales/svSE.js +9 -1
  553. package/node/locales/trTR.js +14 -7
  554. package/node/locales/ukUA.js +9 -1
  555. package/node/locales/urPK.js +9 -1
  556. package/node/locales/zhCN.js +22 -23
  557. package/node/models/common.js +5 -0
  558. package/node/models/index.js +11 -0
  559. package/node/tests/describeAdapters/describeAdapters.js +1 -3
  560. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  561. package/node/tests/describeGregorianAdapter/testCalculations.js +29 -26
  562. package/node/tests/describeGregorianAdapter/testLocalization.js +2 -2
  563. package/node/tests/describeHijriAdapter/describeHijriAdapter.js +31 -0
  564. package/node/tests/describeHijriAdapter/describeHijriAdapter.types.js +5 -0
  565. package/node/tests/describeHijriAdapter/index.js +12 -0
  566. package/node/tests/describeHijriAdapter/testCalculations.js +98 -0
  567. package/node/tests/describeHijriAdapter/testLocalization.js +20 -0
  568. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +33 -0
  569. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +5 -0
  570. package/node/tests/describeJalaliAdapter/index.js +12 -0
  571. package/node/tests/describeJalaliAdapter/testCalculations.js +90 -0
  572. package/node/tests/describeJalaliAdapter/testLocalization.js +20 -0
  573. package/node/tests/describePicker/describePicker.js +173 -0
  574. package/node/tests/describePicker/describePicker.types.js +5 -0
  575. package/node/tests/describePicker/index.js +12 -0
  576. package/node/tests/describeValidation/testTextFieldValidation.js +27 -0
  577. package/node/tests/describeValue/describeValue.js +1 -1
  578. package/node/tests/describeValue/testControlledUnControlled.js +8 -9
  579. package/node/tests/describeValue/testPickerActionBar.js +46 -13
  580. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  581. package/node/timeViewRenderers/index.js +12 -0
  582. package/node/timeViewRenderers/timeViewRenderers.js +134 -4
  583. package/package.json +3 -10
  584. package/tests/describeAdapters/describeAdapters.js +1 -3
  585. package/tests/describeGregorianAdapter/describeGregorianAdapter.js +3 -1
  586. package/tests/describeGregorianAdapter/testCalculations.js +29 -26
  587. package/tests/describeGregorianAdapter/testLocalization.js +2 -2
  588. package/tests/describeHijriAdapter/describeHijriAdapter.js +23 -0
  589. package/tests/describeHijriAdapter/describeHijriAdapter.types.js +1 -0
  590. package/tests/describeHijriAdapter/index.js +1 -0
  591. package/tests/describeHijriAdapter/testCalculations.js +91 -0
  592. package/tests/describeHijriAdapter/testLocalization.js +13 -0
  593. package/tests/describeJalaliAdapter/describeJalaliAdapter.js +25 -0
  594. package/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +1 -0
  595. package/tests/describeJalaliAdapter/index.js +1 -0
  596. package/tests/describeJalaliAdapter/testCalculations.js +83 -0
  597. package/tests/describeJalaliAdapter/testLocalization.js +13 -0
  598. package/tests/describePicker/describePicker.js +162 -0
  599. package/tests/describePicker/describePicker.types.js +1 -0
  600. package/tests/describePicker/index.js +1 -0
  601. package/tests/describeValidation/testTextFieldValidation.js +27 -0
  602. package/tests/describeValue/describeValue.js +1 -1
  603. package/tests/describeValue/testControlledUnControlled.js +8 -9
  604. package/tests/describeValue/testPickerActionBar.js +46 -13
  605. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -5
  606. package/themeAugmentation/components.d.ts +12 -0
  607. package/themeAugmentation/overrides.d.ts +8 -0
  608. package/themeAugmentation/props.d.ts +8 -0
  609. package/timeViewRenderers/index.d.ts +1 -1
  610. package/timeViewRenderers/index.js +1 -1
  611. package/timeViewRenderers/timeViewRenderers.d.ts +11 -4
  612. package/timeViewRenderers/timeViewRenderers.js +130 -2
  613. /package/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
  614. /package/{legacy/internals/hooks/validation/models.js → MultiSectionDigitalClock/MultiSectionDigitalClock.types.js} +0 -0
  615. /package/{modern/internals/hooks/validation/models.js → internals/models/props/clock.js} +0 -0
  616. /package/node/{internals/hooks/validation/models.js → DigitalClock/DigitalClock.types.js} +0 -0
@@ -0,0 +1,269 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ /* eslint-disable class-methods-use-this */
3
+ import defaultHMoment from 'moment-hijri';
4
+ import { AdapterMoment } from '../AdapterMoment';
5
+ // From https://momentjs.com/docs/#/displaying/format/
6
+ const formatTokenMap = {
7
+ // Year
8
+ iY: {
9
+ sectionType: 'year',
10
+ contentType: 'letter'
11
+ },
12
+ iYY: {
13
+ sectionType: 'year',
14
+ contentType: 'letter'
15
+ },
16
+ iYYYY: {
17
+ sectionType: 'year',
18
+ contentType: 'letter'
19
+ },
20
+ // Month
21
+ iM: 'month',
22
+ iMM: 'month',
23
+ iMMM: {
24
+ sectionType: 'month',
25
+ contentType: 'letter'
26
+ },
27
+ iMMMM: {
28
+ sectionType: 'month',
29
+ contentType: 'letter'
30
+ },
31
+ // Day of the month
32
+ iD: {
33
+ sectionType: 'day',
34
+ contentType: 'digit',
35
+ maxLength: 2
36
+ },
37
+ iDD: 'day',
38
+ // Meridiem
39
+ A: 'meridiem',
40
+ a: 'meridiem',
41
+ // Hours
42
+ H: {
43
+ sectionType: 'hours',
44
+ contentType: 'digit',
45
+ maxLength: 2
46
+ },
47
+ HH: 'hours',
48
+ h: {
49
+ sectionType: 'hours',
50
+ contentType: 'digit',
51
+ maxLength: 2
52
+ },
53
+ hh: 'hours',
54
+ // Minutes
55
+ m: {
56
+ sectionType: 'minutes',
57
+ contentType: 'digit',
58
+ maxLength: 2
59
+ },
60
+ mm: 'minutes',
61
+ // Seconds
62
+ s: {
63
+ sectionType: 'seconds',
64
+ contentType: 'digit',
65
+ maxLength: 2
66
+ },
67
+ ss: 'seconds'
68
+ };
69
+ const defaultFormats = {
70
+ dayOfMonth: 'iD',
71
+ fullDate: 'iYYYY, iMMMM Do',
72
+ fullDateWithWeekday: 'iYYYY, iMMMM Do, dddd',
73
+ fullDateTime: 'iYYYY, iMMMM Do, hh:mm A',
74
+ fullDateTime12h: 'iD iMMMM hh:mm A',
75
+ fullDateTime24h: 'iD iMMMM HH:mm',
76
+ fullTime: 'LT',
77
+ fullTime12h: 'hh:mm A',
78
+ fullTime24h: 'HH:mm',
79
+ hours12h: 'hh',
80
+ hours24h: 'HH',
81
+ keyboardDate: 'iYYYY/iMM/iDD',
82
+ keyboardDateTime: 'iYYYY/iMM/iDD LT',
83
+ keyboardDateTime12h: 'iYYYY/iMM/iDD hh:mm A',
84
+ keyboardDateTime24h: 'iYYYY/iMM/iDD HH:mm',
85
+ minutes: 'mm',
86
+ month: 'iMMMM',
87
+ monthAndDate: 'iD iMMMM',
88
+ monthAndYear: 'iMMMM iYYYY',
89
+ monthShort: 'iMMM',
90
+ weekday: 'dddd',
91
+ weekdayShort: 'ddd',
92
+ normalDate: 'dddd, iD iMMM',
93
+ normalDateWithWeekday: 'DD iMMMM',
94
+ seconds: 'ss',
95
+ shortDate: 'iD iMMM',
96
+ year: 'iYYYY'
97
+ };
98
+ const NUMBER_SYMBOL_MAP = {
99
+ '1': '١',
100
+ '2': '٢',
101
+ '3': '٣',
102
+ '4': '٤',
103
+ '5': '٥',
104
+ '6': '٦',
105
+ '7': '٧',
106
+ '8': '٨',
107
+ '9': '٩',
108
+ '0': '٠'
109
+ };
110
+
111
+ /**
112
+ * Based on `@date-io/hijri`
113
+ *
114
+ * MIT License
115
+ *
116
+ * Copyright (c) 2017 Dmitriy Kovalenko
117
+ *
118
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
119
+ * of this software and associated documentation files (the "Software"), to deal
120
+ * in the Software without restriction, including without limitation the rights
121
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
122
+ * copies of the Software, and to permit persons to whom the Software is
123
+ * furnished to do so, subject to the following conditions:
124
+ *
125
+ * The above copyright notice and this permission notice shall be included in all
126
+ * copies or substantial portions of the Software.
127
+ *
128
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
129
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
130
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
131
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
132
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
133
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
134
+ * SOFTWARE.
135
+ */
136
+ export class AdapterMomentHijri extends AdapterMoment {
137
+ constructor({
138
+ formats,
139
+ instance
140
+ } = {}) {
141
+ super({
142
+ locale: 'ar-SA',
143
+ instance
144
+ });
145
+ this.isMUIAdapter = true;
146
+ this.formatTokenMap = formatTokenMap;
147
+ this.escapedCharacters = {
148
+ start: '[',
149
+ end: ']'
150
+ };
151
+ this.toIMoment = value => {
152
+ return this.moment(value ? value.clone() : undefined).locale('ar-SA');
153
+ };
154
+ this.date = value => {
155
+ if (value === null) {
156
+ return null;
157
+ }
158
+ return this.moment(value).locale('ar-SA');
159
+ };
160
+ this.parse = (value, format) => {
161
+ if (value === '') {
162
+ return null;
163
+ }
164
+ return this.moment(value, format, true).locale('ar-SA');
165
+ };
166
+ this.getFormatHelperText = format => {
167
+ return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
168
+ };
169
+ this.formatNumber = numberToFormat => {
170
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
171
+ };
172
+ this.isEqual = (value, comparing) => {
173
+ if (value === null && comparing === null) {
174
+ return true;
175
+ }
176
+ return this.moment(value).isSame(comparing);
177
+ };
178
+ this.startOfYear = value => {
179
+ return value.clone().startOf('iYear');
180
+ };
181
+ this.startOfMonth = value => {
182
+ return value.clone().startOf('iMonth');
183
+ };
184
+ this.endOfYear = value => {
185
+ return value.clone().endOf('iYear');
186
+ };
187
+ this.endOfMonth = value => {
188
+ return value.clone().endOf('iMonth');
189
+ };
190
+ this.addYears = (value, amount) => {
191
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'iYear') : value.clone().add(amount, 'iYear');
192
+ };
193
+ this.addMonths = (value, amount) => {
194
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'iMonth') : value.clone().add(amount, 'iMonth');
195
+ };
196
+ this.getYear = value => {
197
+ return value.iYear();
198
+ };
199
+ this.getMonth = value => {
200
+ return value.iMonth();
201
+ };
202
+ this.getDate = value => {
203
+ return value.iDate();
204
+ };
205
+ this.setYear = (value, year) => {
206
+ return value.clone().iYear(year);
207
+ };
208
+ this.setMonth = (value, month) => {
209
+ return value.clone().iMonth(month);
210
+ };
211
+ this.setDate = (value, date) => {
212
+ return value.clone().iDate(date);
213
+ };
214
+ this.getNextMonth = value => {
215
+ return value.clone().add(1, 'iMonth');
216
+ };
217
+ this.getPreviousMonth = value => {
218
+ return value.clone().subtract(1, 'iMonth');
219
+ };
220
+ this.getWeekdays = () => {
221
+ return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
222
+ return this.toIMoment().weekday(dayOfWeek).format('dd');
223
+ });
224
+ };
225
+ this.getWeekArray = value => {
226
+ const start = value.clone().startOf('iMonth').startOf('week');
227
+ const end = value.clone().endOf('iMonth').endOf('week');
228
+ let count = 0;
229
+ let current = start;
230
+ const nestedWeeks = [];
231
+ while (current.isBefore(end)) {
232
+ const weekNumber = Math.floor(count / 7);
233
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
234
+ nestedWeeks[weekNumber].push(current);
235
+ current = current.clone().add(1, 'day');
236
+ count += 1;
237
+ }
238
+ return nestedWeeks;
239
+ };
240
+ this.getWeekNumber = value => {
241
+ return value.iWeek();
242
+ };
243
+ this.getYearRange = (start, end) => {
244
+ // moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
245
+ // We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
246
+ if (start.isBefore('1937-03-14')) {
247
+ throw new Error('min date must be on or after 1356-01-01 H (1937-03-14)');
248
+ }
249
+ if (end.isAfter('2076-11-26')) {
250
+ throw new Error('max date must be on or before 1499-12-29 H (2076-11-26)');
251
+ }
252
+ const startDate = this.moment(start).startOf('iYear');
253
+ const endDate = this.moment(end).endOf('iYear');
254
+ const years = [];
255
+ let current = startDate;
256
+ while (current.isBefore(endDate)) {
257
+ years.push(current);
258
+ current = current.clone().add(1, 'iYear');
259
+ }
260
+ return years;
261
+ };
262
+ this.getMeridiemText = ampm => {
263
+ return ampm === 'am' ? this.toIMoment().hours(2).format('A') : this.toIMoment().hours(14).format('A');
264
+ };
265
+ this.moment = instance || defaultHMoment;
266
+ this.locale = 'ar-SA';
267
+ this.formats = _extends({}, defaultFormats, formats);
268
+ }
269
+ }
@@ -1,74 +1 @@
1
- /* eslint-disable class-methods-use-this */
2
- import BaseAdapterMomentHijri from '@date-io/hijri';
3
- // @ts-ignore
4
-
5
- // From https://momentjs.com/docs/#/displaying/format/
6
- const formatTokenMap = {
7
- // Year
8
- iY: 'year',
9
- iYY: 'year',
10
- iYYYY: 'year',
11
- // Month
12
- iM: 'month',
13
- iMM: 'month',
14
- iMMM: {
15
- sectionType: 'month',
16
- contentType: 'letter'
17
- },
18
- iMMMM: {
19
- sectionType: 'month',
20
- contentType: 'letter'
21
- },
22
- // Day of the month
23
- iD: 'day',
24
- iDD: 'day',
25
- // Meridiem
26
- A: 'meridiem',
27
- a: 'meridiem',
28
- // Hours
29
- H: 'hours',
30
- HH: 'hours',
31
- h: 'hours',
32
- hh: 'hours',
33
- k: 'hours',
34
- kk: 'hours',
35
- // Minutes
36
- m: 'minutes',
37
- mm: 'minutes',
38
- // Seconds
39
- s: 'seconds',
40
- ss: 'seconds'
41
- };
42
- export class AdapterMomentHijri extends BaseAdapterMomentHijri {
43
- constructor(...args) {
44
- super(...args);
45
- this.isMUIAdapter = true;
46
- this.formatTokenMap = formatTokenMap;
47
- this.escapedCharacters = {
48
- start: '[',
49
- end: ']'
50
- };
51
- /**
52
- * The current getFormatHelperText method uses an outdated format parsing logic.
53
- * We should use this one in the future to support all localized formats.
54
- */
55
- this.expandFormat = format => {
56
- // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
57
- const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
58
- return format.match(localFormattingTokens).map(token => {
59
- const firstCharacter = token[0];
60
- if (firstCharacter === 'L' || firstCharacter === ';') {
61
- return this.moment.localeData(this.getCurrentLocaleCode()).longDateFormat(token);
62
- }
63
- return token;
64
- }).join('').replace('dd', 'iDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632
65
- };
66
- // Redefined here just to show how it can be written using expandFormat
67
- this.getFormatHelperText = format => {
68
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
69
- };
70
- this.getWeekNumber = date => {
71
- return date.iWeek();
72
- };
73
- }
74
- }
1
+ export { AdapterMomentHijri } from './AdapterMomentHijri';
@@ -0,0 +1,276 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ /* eslint-disable class-methods-use-this */
3
+ import defaultJMoment from 'moment-jalaali';
4
+ import { AdapterMoment } from '../AdapterMoment';
5
+ // From https://momentjs.com/docs/#/displaying/format/
6
+ const formatTokenMap = {
7
+ // Year
8
+ jYY: 'year',
9
+ jYYYY: {
10
+ sectionType: 'year',
11
+ contentType: 'digit',
12
+ maxLength: 4
13
+ },
14
+ // Month
15
+ jM: {
16
+ sectionType: 'month',
17
+ contentType: 'digit',
18
+ maxLength: 2
19
+ },
20
+ jMM: 'month',
21
+ jMMM: {
22
+ sectionType: 'month',
23
+ contentType: 'letter'
24
+ },
25
+ jMMMM: {
26
+ sectionType: 'month',
27
+ contentType: 'letter'
28
+ },
29
+ // Day of the month
30
+ jD: {
31
+ sectionType: 'day',
32
+ contentType: 'digit',
33
+ maxLength: 2
34
+ },
35
+ jDD: 'day',
36
+ // Meridiem
37
+ A: 'meridiem',
38
+ a: 'meridiem',
39
+ // Hours
40
+ H: {
41
+ sectionType: 'hours',
42
+ contentType: 'digit',
43
+ maxLength: 2
44
+ },
45
+ HH: 'hours',
46
+ h: {
47
+ sectionType: 'hours',
48
+ contentType: 'digit',
49
+ maxLength: 2
50
+ },
51
+ hh: 'hours',
52
+ // Minutes
53
+ m: {
54
+ sectionType: 'minutes',
55
+ contentType: 'digit',
56
+ maxLength: 2
57
+ },
58
+ mm: 'minutes',
59
+ // Seconds
60
+ s: {
61
+ sectionType: 'seconds',
62
+ contentType: 'digit',
63
+ maxLength: 2
64
+ },
65
+ ss: 'seconds'
66
+ };
67
+ const defaultFormats = {
68
+ dayOfMonth: 'jD',
69
+ fullDate: 'jYYYY, jMMMM Do',
70
+ fullDateWithWeekday: 'dddd Do jMMMM jYYYY',
71
+ fullDateTime: 'jYYYY, jMMMM Do, hh:mm A',
72
+ fullDateTime12h: 'jD jMMMM hh:mm A',
73
+ fullDateTime24h: 'jD jMMMM HH:mm',
74
+ fullTime: 'LT',
75
+ fullTime12h: 'hh:mm A',
76
+ fullTime24h: 'HH:mm',
77
+ hours12h: 'hh',
78
+ hours24h: 'HH',
79
+ keyboardDate: 'jYYYY/jMM/jDD',
80
+ keyboardDateTime: 'jYYYY/jMM/jDD LT',
81
+ keyboardDateTime12h: 'jYYYY/jMM/jDD hh:mm A',
82
+ keyboardDateTime24h: 'jYYYY/jMM/jDD HH:mm',
83
+ minutes: 'mm',
84
+ month: 'jMMMM',
85
+ monthAndDate: 'jD jMMMM',
86
+ monthAndYear: 'jMMMM jYYYY',
87
+ monthShort: 'jMMM',
88
+ weekday: 'dddd',
89
+ weekdayShort: 'ddd',
90
+ normalDate: 'dddd, jD jMMM',
91
+ normalDateWithWeekday: 'DD MMMM',
92
+ seconds: 'ss',
93
+ shortDate: 'jD jMMM',
94
+ year: 'jYYYY'
95
+ };
96
+ const NUMBER_SYMBOL_MAP = {
97
+ '1': '۱',
98
+ '2': '۲',
99
+ '3': '۳',
100
+ '4': '۴',
101
+ '5': '۵',
102
+ '6': '۶',
103
+ '7': '۷',
104
+ '8': '۸',
105
+ '9': '۹',
106
+ '0': '۰'
107
+ };
108
+
109
+ /**
110
+ * Based on `@date-io/jalaali`
111
+ *
112
+ * MIT License
113
+ *
114
+ * Copyright (c) 2017 Dmitriy Kovalenko
115
+ *
116
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
117
+ * of this software and associated documentation files (the "Software"), to deal
118
+ * in the Software without restriction, including without limitation the rights
119
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
120
+ * copies of the Software, and to permit persons to whom the Software is
121
+ * furnished to do so, subject to the following conditions:
122
+ *
123
+ * The above copyright notice and this permission notice shall be included in all
124
+ * copies or substantial portions of the Software.
125
+ *
126
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
127
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
128
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
129
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
130
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
131
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
132
+ * SOFTWARE.
133
+ */
134
+ export class AdapterMomentJalaali extends AdapterMoment {
135
+ constructor({
136
+ formats,
137
+ instance
138
+ } = {}) {
139
+ super({
140
+ locale: 'fa',
141
+ instance
142
+ });
143
+ this.isMUIAdapter = true;
144
+ this.lib = 'moment-jalaali';
145
+ this.moment = void 0;
146
+ this.locale = void 0;
147
+ this.formats = void 0;
148
+ this.formatTokenMap = formatTokenMap;
149
+ this.escapedCharacters = {
150
+ start: '[',
151
+ end: ']'
152
+ };
153
+ this.toJMoment = value => {
154
+ return this.moment(value ? value.clone() : undefined).locale('fa');
155
+ };
156
+ this.date = value => {
157
+ if (value === null) {
158
+ return null;
159
+ }
160
+ return this.moment(value).locale('fa');
161
+ };
162
+ this.parse = (value, format) => {
163
+ if (value === '') {
164
+ return null;
165
+ }
166
+ return this.moment(value, format, true).locale('fa');
167
+ };
168
+ this.getFormatHelperText = format => {
169
+ return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
170
+ };
171
+ this.isValid = value => {
172
+ // We can't to `this.moment(value)` because moment-jalaali looses the invalidity information when creating a new moment object from an existing one
173
+ if (!this.moment.isMoment(value)) {
174
+ return false;
175
+ }
176
+ return value.isValid();
177
+ };
178
+ this.formatNumber = numberToFormat => {
179
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
180
+ };
181
+ this.isEqual = (value, comparing) => {
182
+ if (value === null && comparing === null) {
183
+ return true;
184
+ }
185
+ return this.moment(value).isSame(comparing);
186
+ };
187
+ this.isAfterYear = (value, comparing) => {
188
+ return value.jYear() > comparing.jYear();
189
+ };
190
+ this.isBeforeYear = (value, comparing) => {
191
+ return value.jYear() < comparing.jYear();
192
+ };
193
+ this.startOfYear = value => {
194
+ return value.clone().startOf('jYear');
195
+ };
196
+ this.startOfMonth = value => {
197
+ return value.clone().startOf('jMonth');
198
+ };
199
+ this.endOfYear = value => {
200
+ return value.clone().endOf('jYear');
201
+ };
202
+ this.endOfMonth = value => {
203
+ return value.clone().endOf('jMonth');
204
+ };
205
+ this.addYears = (value, amount) => {
206
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'jYear') : value.clone().add(amount, 'jYear');
207
+ };
208
+ this.addMonths = (value, amount) => {
209
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'jMonth') : value.clone().add(amount, 'jMonth');
210
+ };
211
+ this.getYear = value => {
212
+ return value.jYear();
213
+ };
214
+ this.getMonth = value => {
215
+ return value.jMonth();
216
+ };
217
+ this.getDate = value => {
218
+ return value.jDate();
219
+ };
220
+ this.setYear = (value, year) => {
221
+ return value.clone().jYear(year);
222
+ };
223
+ this.setMonth = (value, month) => {
224
+ return value.clone().jMonth(month);
225
+ };
226
+ this.setDate = (value, date) => {
227
+ return value.clone().jDate(date);
228
+ };
229
+ this.getNextMonth = value => {
230
+ return value.clone().add(1, 'jMonth');
231
+ };
232
+ this.getPreviousMonth = value => {
233
+ return value.clone().subtract(1, 'jMonth');
234
+ };
235
+ this.getWeekdays = () => {
236
+ return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
237
+ return this.toJMoment().weekday(dayOfWeek).format('dd');
238
+ });
239
+ };
240
+ this.getWeekArray = value => {
241
+ const start = value.clone().startOf('jMonth').startOf('week');
242
+ const end = value.clone().endOf('jMonth').endOf('week');
243
+ let count = 0;
244
+ let current = start;
245
+ const nestedWeeks = [];
246
+ while (current.isBefore(end)) {
247
+ const weekNumber = Math.floor(count / 7);
248
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
249
+ nestedWeeks[weekNumber].push(current);
250
+ current = current.clone().add(1, 'day');
251
+ count += 1;
252
+ }
253
+ return nestedWeeks;
254
+ };
255
+ this.getWeekNumber = value => {
256
+ return value.jWeek();
257
+ };
258
+ this.getYearRange = (start, end) => {
259
+ const startDate = this.moment(start).startOf('jYear');
260
+ const endDate = this.moment(end).endOf('jYear');
261
+ const years = [];
262
+ let current = startDate;
263
+ while (current.isBefore(endDate)) {
264
+ years.push(current);
265
+ current = current.clone().add(1, 'jYear');
266
+ }
267
+ return years;
268
+ };
269
+ this.getMeridiemText = ampm => {
270
+ return ampm === 'am' ? this.toJMoment().hours(2).format('A') : this.toJMoment().hours(14).format('A');
271
+ };
272
+ this.moment = instance || defaultJMoment;
273
+ this.locale = 'fa';
274
+ this.formats = _extends({}, defaultFormats, formats);
275
+ }
276
+ }
@@ -1,87 +1 @@
1
- /* eslint-disable class-methods-use-this */
2
- import BaseAdapterMomentJalaali from '@date-io/jalaali';
3
- // From https://momentjs.com/docs/#/displaying/format/
4
- const formatTokenMap = {
5
- // Year
6
- jYY: 'year',
7
- jYYYY: 'year',
8
- // Month
9
- jM: 'month',
10
- jMM: 'month',
11
- jMMM: {
12
- sectionType: 'month',
13
- contentType: 'letter'
14
- },
15
- jMMMM: {
16
- sectionType: 'month',
17
- contentType: 'letter'
18
- },
19
- // Day of the month
20
- jD: 'day',
21
- jDD: 'day',
22
- // Meridiem
23
- A: 'meridiem',
24
- a: 'meridiem',
25
- // Hours
26
- H: 'hours',
27
- HH: 'hours',
28
- h: 'hours',
29
- hh: 'hours',
30
- k: 'hours',
31
- kk: 'hours',
32
- // Minutes
33
- m: 'minutes',
34
- mm: 'minutes',
35
- // Seconds
36
- s: 'seconds',
37
- ss: 'seconds'
38
- };
39
- export class AdapterMomentJalaali extends BaseAdapterMomentJalaali {
40
- constructor(...args) {
41
- super(...args);
42
- this.isMUIAdapter = true;
43
- this.formatTokenMap = formatTokenMap;
44
- this.escapedCharacters = {
45
- start: '[',
46
- end: ']'
47
- };
48
- /**
49
- * The current getFormatHelperText method uses an outdated format parsing logic.
50
- * We should use this one in the future to support all localized formats.
51
- */
52
- this.expandFormat = format => {
53
- // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
54
- const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
55
- return format.match(localFormattingTokens).map(token => {
56
- const firstCharacter = token[0];
57
- if (firstCharacter === 'L' || firstCharacter === ';') {
58
- return this.moment.localeData(this.getCurrentLocaleCode()).longDateFormat(token);
59
- }
60
- return token;
61
- }).join('').replace('dd', 'jDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632;
62
- };
63
- // Redefined here just to show how it can be written using expandFormat
64
- this.getFormatHelperText = format => {
65
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
66
- };
67
- this.getWeekNumber = date => {
68
- return date.jWeek();
69
- };
70
- this.addYears = (date, count) => {
71
- return count < 0 ? date.clone().subtract(Math.abs(count), 'jYear') : date.clone().add(count, 'jYear');
72
- };
73
- this.addMonths = (date, count) => {
74
- return count < 0 ? date.clone().subtract(Math.abs(count), 'jMonth') : date.clone().add(count, 'jMonth');
75
- };
76
- this.setMonth = (date, month) => {
77
- return date.clone().jMonth(month);
78
- };
79
- this.isValid = value => {
80
- // We can't to `this.moment(value)` because moment-jalaali looses the invalidity information when creating a new moment object from an existing one
81
- if (!this.moment.isMoment(value)) {
82
- return false;
83
- }
84
- return value.isValid(value);
85
- };
86
- }
87
- }
1
+ export { AdapterMomentJalaali } from './AdapterMomentJalaali';