@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,278 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AdapterMomentHijri = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _momentHijri = _interopRequireDefault(require("moment-hijri"));
10
+ var _AdapterMoment = require("../AdapterMoment");
11
+ /* eslint-disable class-methods-use-this */
12
+
13
+ // From https://momentjs.com/docs/#/displaying/format/
14
+ const formatTokenMap = {
15
+ // Year
16
+ iY: {
17
+ sectionType: 'year',
18
+ contentType: 'letter'
19
+ },
20
+ iYY: {
21
+ sectionType: 'year',
22
+ contentType: 'letter'
23
+ },
24
+ iYYYY: {
25
+ sectionType: 'year',
26
+ contentType: 'letter'
27
+ },
28
+ // Month
29
+ iM: 'month',
30
+ iMM: 'month',
31
+ iMMM: {
32
+ sectionType: 'month',
33
+ contentType: 'letter'
34
+ },
35
+ iMMMM: {
36
+ sectionType: 'month',
37
+ contentType: 'letter'
38
+ },
39
+ // Day of the month
40
+ iD: {
41
+ sectionType: 'day',
42
+ contentType: 'digit',
43
+ maxLength: 2
44
+ },
45
+ iDD: 'day',
46
+ // Meridiem
47
+ A: 'meridiem',
48
+ a: 'meridiem',
49
+ // Hours
50
+ H: {
51
+ sectionType: 'hours',
52
+ contentType: 'digit',
53
+ maxLength: 2
54
+ },
55
+ HH: 'hours',
56
+ h: {
57
+ sectionType: 'hours',
58
+ contentType: 'digit',
59
+ maxLength: 2
60
+ },
61
+ hh: 'hours',
62
+ // Minutes
63
+ m: {
64
+ sectionType: 'minutes',
65
+ contentType: 'digit',
66
+ maxLength: 2
67
+ },
68
+ mm: 'minutes',
69
+ // Seconds
70
+ s: {
71
+ sectionType: 'seconds',
72
+ contentType: 'digit',
73
+ maxLength: 2
74
+ },
75
+ ss: 'seconds'
76
+ };
77
+ const defaultFormats = {
78
+ dayOfMonth: 'iD',
79
+ fullDate: 'iYYYY, iMMMM Do',
80
+ fullDateWithWeekday: 'iYYYY, iMMMM Do, dddd',
81
+ fullDateTime: 'iYYYY, iMMMM Do, hh:mm A',
82
+ fullDateTime12h: 'iD iMMMM hh:mm A',
83
+ fullDateTime24h: 'iD iMMMM HH:mm',
84
+ fullTime: 'LT',
85
+ fullTime12h: 'hh:mm A',
86
+ fullTime24h: 'HH:mm',
87
+ hours12h: 'hh',
88
+ hours24h: 'HH',
89
+ keyboardDate: 'iYYYY/iMM/iDD',
90
+ keyboardDateTime: 'iYYYY/iMM/iDD LT',
91
+ keyboardDateTime12h: 'iYYYY/iMM/iDD hh:mm A',
92
+ keyboardDateTime24h: 'iYYYY/iMM/iDD HH:mm',
93
+ minutes: 'mm',
94
+ month: 'iMMMM',
95
+ monthAndDate: 'iD iMMMM',
96
+ monthAndYear: 'iMMMM iYYYY',
97
+ monthShort: 'iMMM',
98
+ weekday: 'dddd',
99
+ weekdayShort: 'ddd',
100
+ normalDate: 'dddd, iD iMMM',
101
+ normalDateWithWeekday: 'DD iMMMM',
102
+ seconds: 'ss',
103
+ shortDate: 'iD iMMM',
104
+ year: 'iYYYY'
105
+ };
106
+ const NUMBER_SYMBOL_MAP = {
107
+ '1': '١',
108
+ '2': '٢',
109
+ '3': '٣',
110
+ '4': '٤',
111
+ '5': '٥',
112
+ '6': '٦',
113
+ '7': '٧',
114
+ '8': '٨',
115
+ '9': '٩',
116
+ '0': '٠'
117
+ };
118
+
119
+ /**
120
+ * Based on `@date-io/hijri`
121
+ *
122
+ * MIT License
123
+ *
124
+ * Copyright (c) 2017 Dmitriy Kovalenko
125
+ *
126
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
127
+ * of this software and associated documentation files (the "Software"), to deal
128
+ * in the Software without restriction, including without limitation the rights
129
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
130
+ * copies of the Software, and to permit persons to whom the Software is
131
+ * furnished to do so, subject to the following conditions:
132
+ *
133
+ * The above copyright notice and this permission notice shall be included in all
134
+ * copies or substantial portions of the Software.
135
+ *
136
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
137
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
138
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
139
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
140
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
141
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
142
+ * SOFTWARE.
143
+ */
144
+ class AdapterMomentHijri extends _AdapterMoment.AdapterMoment {
145
+ constructor({
146
+ formats,
147
+ instance
148
+ } = {}) {
149
+ super({
150
+ locale: 'ar-SA',
151
+ instance
152
+ });
153
+ this.isMUIAdapter = true;
154
+ this.formatTokenMap = formatTokenMap;
155
+ this.escapedCharacters = {
156
+ start: '[',
157
+ end: ']'
158
+ };
159
+ this.toIMoment = value => {
160
+ return this.moment(value ? value.clone() : undefined).locale('ar-SA');
161
+ };
162
+ this.date = value => {
163
+ if (value === null) {
164
+ return null;
165
+ }
166
+ return this.moment(value).locale('ar-SA');
167
+ };
168
+ this.parse = (value, format) => {
169
+ if (value === '') {
170
+ return null;
171
+ }
172
+ return this.moment(value, format, true).locale('ar-SA');
173
+ };
174
+ this.getFormatHelperText = format => {
175
+ return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
176
+ };
177
+ this.formatNumber = numberToFormat => {
178
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
179
+ };
180
+ this.isEqual = (value, comparing) => {
181
+ if (value === null && comparing === null) {
182
+ return true;
183
+ }
184
+ return this.moment(value).isSame(comparing);
185
+ };
186
+ this.startOfYear = value => {
187
+ return value.clone().startOf('iYear');
188
+ };
189
+ this.startOfMonth = value => {
190
+ return value.clone().startOf('iMonth');
191
+ };
192
+ this.endOfYear = value => {
193
+ return value.clone().endOf('iYear');
194
+ };
195
+ this.endOfMonth = value => {
196
+ return value.clone().endOf('iMonth');
197
+ };
198
+ this.addYears = (value, amount) => {
199
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'iYear') : value.clone().add(amount, 'iYear');
200
+ };
201
+ this.addMonths = (value, amount) => {
202
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'iMonth') : value.clone().add(amount, 'iMonth');
203
+ };
204
+ this.getYear = value => {
205
+ return value.iYear();
206
+ };
207
+ this.getMonth = value => {
208
+ return value.iMonth();
209
+ };
210
+ this.getDate = value => {
211
+ return value.iDate();
212
+ };
213
+ this.setYear = (value, year) => {
214
+ return value.clone().iYear(year);
215
+ };
216
+ this.setMonth = (value, month) => {
217
+ return value.clone().iMonth(month);
218
+ };
219
+ this.setDate = (value, date) => {
220
+ return value.clone().iDate(date);
221
+ };
222
+ this.getNextMonth = value => {
223
+ return value.clone().add(1, 'iMonth');
224
+ };
225
+ this.getPreviousMonth = value => {
226
+ return value.clone().subtract(1, 'iMonth');
227
+ };
228
+ this.getWeekdays = () => {
229
+ return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
230
+ return this.toIMoment().weekday(dayOfWeek).format('dd');
231
+ });
232
+ };
233
+ this.getWeekArray = value => {
234
+ const start = value.clone().startOf('iMonth').startOf('week');
235
+ const end = value.clone().endOf('iMonth').endOf('week');
236
+ let count = 0;
237
+ let current = start;
238
+ const nestedWeeks = [];
239
+ while (current.isBefore(end)) {
240
+ const weekNumber = Math.floor(count / 7);
241
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
242
+ nestedWeeks[weekNumber].push(current);
243
+ current = current.clone().add(1, 'day');
244
+ count += 1;
245
+ }
246
+ return nestedWeeks;
247
+ };
248
+ this.getWeekNumber = value => {
249
+ return value.iWeek();
250
+ };
251
+ this.getYearRange = (start, end) => {
252
+ // moment-hijri only supports dates between 1356-01-01 H and 1499-12-29 H
253
+ // We need to throw if outside min/max bounds, otherwise the while loop below will be infinite.
254
+ if (start.isBefore('1937-03-14')) {
255
+ throw new Error('min date must be on or after 1356-01-01 H (1937-03-14)');
256
+ }
257
+ if (end.isAfter('2076-11-26')) {
258
+ throw new Error('max date must be on or before 1499-12-29 H (2076-11-26)');
259
+ }
260
+ const startDate = this.moment(start).startOf('iYear');
261
+ const endDate = this.moment(end).endOf('iYear');
262
+ const years = [];
263
+ let current = startDate;
264
+ while (current.isBefore(endDate)) {
265
+ years.push(current);
266
+ current = current.clone().add(1, 'iYear');
267
+ }
268
+ return years;
269
+ };
270
+ this.getMeridiemText = ampm => {
271
+ return ampm === 'am' ? this.toIMoment().hours(2).format('A') : this.toIMoment().hours(14).format('A');
272
+ };
273
+ this.moment = instance || _momentHijri.default;
274
+ this.locale = 'ar-SA';
275
+ this.formats = (0, _extends2.default)({}, defaultFormats, formats);
276
+ }
277
+ }
278
+ exports.AdapterMomentHijri = AdapterMomentHijri;
@@ -1,83 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.AdapterMomentHijri = void 0;
8
- var _hijri = _interopRequireDefault(require("@date-io/hijri"));
9
- /* eslint-disable class-methods-use-this */
10
-
11
- // @ts-ignore
12
-
13
- // From https://momentjs.com/docs/#/displaying/format/
14
- const formatTokenMap = {
15
- // Year
16
- iY: 'year',
17
- iYY: 'year',
18
- iYYYY: 'year',
19
- // Month
20
- iM: 'month',
21
- iMM: 'month',
22
- iMMM: {
23
- sectionType: 'month',
24
- contentType: 'letter'
25
- },
26
- iMMMM: {
27
- sectionType: 'month',
28
- contentType: 'letter'
29
- },
30
- // Day of the month
31
- iD: 'day',
32
- iDD: 'day',
33
- // Meridiem
34
- A: 'meridiem',
35
- a: 'meridiem',
36
- // Hours
37
- H: 'hours',
38
- HH: 'hours',
39
- h: 'hours',
40
- hh: 'hours',
41
- k: 'hours',
42
- kk: 'hours',
43
- // Minutes
44
- m: 'minutes',
45
- mm: 'minutes',
46
- // Seconds
47
- s: 'seconds',
48
- ss: 'seconds'
49
- };
50
- class AdapterMomentHijri extends _hijri.default {
51
- constructor(...args) {
52
- super(...args);
53
- this.isMUIAdapter = true;
54
- this.formatTokenMap = formatTokenMap;
55
- this.escapedCharacters = {
56
- start: '[',
57
- end: ']'
58
- };
59
- /**
60
- * The current getFormatHelperText method uses an outdated format parsing logic.
61
- * We should use this one in the future to support all localized formats.
62
- */
63
- this.expandFormat = format => {
64
- // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
65
- const localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
66
- return format.match(localFormattingTokens).map(token => {
67
- const firstCharacter = token[0];
68
- if (firstCharacter === 'L' || firstCharacter === ';') {
69
- return this.moment.localeData(this.getCurrentLocaleCode()).longDateFormat(token);
70
- }
71
- return token;
72
- }).join('').replace('dd', 'iDD'); // Fix for https://github.com/dmtrKovalenko/date-io/pull/632
73
- };
74
- // Redefined here just to show how it can be written using expandFormat
75
- this.getFormatHelperText = format => {
76
- return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('iY', 'Y').replace('iM', 'M').replace('iD', 'D').toLocaleLowerCase();
77
- };
78
- this.getWeekNumber = date => {
79
- return date.iWeek();
80
- };
6
+ Object.defineProperty(exports, "AdapterMomentHijri", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _AdapterMomentHijri.AdapterMomentHijri;
81
10
  }
82
- }
83
- exports.AdapterMomentHijri = AdapterMomentHijri;
11
+ });
12
+ var _AdapterMomentHijri = require("./AdapterMomentHijri");
@@ -0,0 +1,285 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.AdapterMomentJalaali = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _momentJalaali = _interopRequireDefault(require("moment-jalaali"));
10
+ var _AdapterMoment = require("../AdapterMoment");
11
+ /* eslint-disable class-methods-use-this */
12
+
13
+ // From https://momentjs.com/docs/#/displaying/format/
14
+ const formatTokenMap = {
15
+ // Year
16
+ jYY: 'year',
17
+ jYYYY: {
18
+ sectionType: 'year',
19
+ contentType: 'digit',
20
+ maxLength: 4
21
+ },
22
+ // Month
23
+ jM: {
24
+ sectionType: 'month',
25
+ contentType: 'digit',
26
+ maxLength: 2
27
+ },
28
+ jMM: 'month',
29
+ jMMM: {
30
+ sectionType: 'month',
31
+ contentType: 'letter'
32
+ },
33
+ jMMMM: {
34
+ sectionType: 'month',
35
+ contentType: 'letter'
36
+ },
37
+ // Day of the month
38
+ jD: {
39
+ sectionType: 'day',
40
+ contentType: 'digit',
41
+ maxLength: 2
42
+ },
43
+ jDD: 'day',
44
+ // Meridiem
45
+ A: 'meridiem',
46
+ a: 'meridiem',
47
+ // Hours
48
+ H: {
49
+ sectionType: 'hours',
50
+ contentType: 'digit',
51
+ maxLength: 2
52
+ },
53
+ HH: 'hours',
54
+ h: {
55
+ sectionType: 'hours',
56
+ contentType: 'digit',
57
+ maxLength: 2
58
+ },
59
+ hh: 'hours',
60
+ // Minutes
61
+ m: {
62
+ sectionType: 'minutes',
63
+ contentType: 'digit',
64
+ maxLength: 2
65
+ },
66
+ mm: 'minutes',
67
+ // Seconds
68
+ s: {
69
+ sectionType: 'seconds',
70
+ contentType: 'digit',
71
+ maxLength: 2
72
+ },
73
+ ss: 'seconds'
74
+ };
75
+ const defaultFormats = {
76
+ dayOfMonth: 'jD',
77
+ fullDate: 'jYYYY, jMMMM Do',
78
+ fullDateWithWeekday: 'dddd Do jMMMM jYYYY',
79
+ fullDateTime: 'jYYYY, jMMMM Do, hh:mm A',
80
+ fullDateTime12h: 'jD jMMMM hh:mm A',
81
+ fullDateTime24h: 'jD jMMMM HH:mm',
82
+ fullTime: 'LT',
83
+ fullTime12h: 'hh:mm A',
84
+ fullTime24h: 'HH:mm',
85
+ hours12h: 'hh',
86
+ hours24h: 'HH',
87
+ keyboardDate: 'jYYYY/jMM/jDD',
88
+ keyboardDateTime: 'jYYYY/jMM/jDD LT',
89
+ keyboardDateTime12h: 'jYYYY/jMM/jDD hh:mm A',
90
+ keyboardDateTime24h: 'jYYYY/jMM/jDD HH:mm',
91
+ minutes: 'mm',
92
+ month: 'jMMMM',
93
+ monthAndDate: 'jD jMMMM',
94
+ monthAndYear: 'jMMMM jYYYY',
95
+ monthShort: 'jMMM',
96
+ weekday: 'dddd',
97
+ weekdayShort: 'ddd',
98
+ normalDate: 'dddd, jD jMMM',
99
+ normalDateWithWeekday: 'DD MMMM',
100
+ seconds: 'ss',
101
+ shortDate: 'jD jMMM',
102
+ year: 'jYYYY'
103
+ };
104
+ const NUMBER_SYMBOL_MAP = {
105
+ '1': '۱',
106
+ '2': '۲',
107
+ '3': '۳',
108
+ '4': '۴',
109
+ '5': '۵',
110
+ '6': '۶',
111
+ '7': '۷',
112
+ '8': '۸',
113
+ '9': '۹',
114
+ '0': '۰'
115
+ };
116
+
117
+ /**
118
+ * Based on `@date-io/jalaali`
119
+ *
120
+ * MIT License
121
+ *
122
+ * Copyright (c) 2017 Dmitriy Kovalenko
123
+ *
124
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
125
+ * of this software and associated documentation files (the "Software"), to deal
126
+ * in the Software without restriction, including without limitation the rights
127
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
128
+ * copies of the Software, and to permit persons to whom the Software is
129
+ * furnished to do so, subject to the following conditions:
130
+ *
131
+ * The above copyright notice and this permission notice shall be included in all
132
+ * copies or substantial portions of the Software.
133
+ *
134
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
136
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
137
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
138
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
139
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
140
+ * SOFTWARE.
141
+ */
142
+ class AdapterMomentJalaali extends _AdapterMoment.AdapterMoment {
143
+ constructor({
144
+ formats,
145
+ instance
146
+ } = {}) {
147
+ super({
148
+ locale: 'fa',
149
+ instance
150
+ });
151
+ this.isMUIAdapter = true;
152
+ this.lib = 'moment-jalaali';
153
+ this.moment = void 0;
154
+ this.locale = void 0;
155
+ this.formats = void 0;
156
+ this.formatTokenMap = formatTokenMap;
157
+ this.escapedCharacters = {
158
+ start: '[',
159
+ end: ']'
160
+ };
161
+ this.toJMoment = value => {
162
+ return this.moment(value ? value.clone() : undefined).locale('fa');
163
+ };
164
+ this.date = value => {
165
+ if (value === null) {
166
+ return null;
167
+ }
168
+ return this.moment(value).locale('fa');
169
+ };
170
+ this.parse = (value, format) => {
171
+ if (value === '') {
172
+ return null;
173
+ }
174
+ return this.moment(value, format, true).locale('fa');
175
+ };
176
+ this.getFormatHelperText = format => {
177
+ return this.expandFormat(format).replace(/a/gi, '(a|p)m').replace('jY', 'Y').replace('jM', 'M').replace('jD', 'D').toLocaleLowerCase();
178
+ };
179
+ this.isValid = value => {
180
+ // We can't to `this.moment(value)` because moment-jalaali looses the invalidity information when creating a new moment object from an existing one
181
+ if (!this.moment.isMoment(value)) {
182
+ return false;
183
+ }
184
+ return value.isValid();
185
+ };
186
+ this.formatNumber = numberToFormat => {
187
+ return numberToFormat.replace(/\d/g, match => NUMBER_SYMBOL_MAP[match]).replace(/,/g, '،');
188
+ };
189
+ this.isEqual = (value, comparing) => {
190
+ if (value === null && comparing === null) {
191
+ return true;
192
+ }
193
+ return this.moment(value).isSame(comparing);
194
+ };
195
+ this.isAfterYear = (value, comparing) => {
196
+ return value.jYear() > comparing.jYear();
197
+ };
198
+ this.isBeforeYear = (value, comparing) => {
199
+ return value.jYear() < comparing.jYear();
200
+ };
201
+ this.startOfYear = value => {
202
+ return value.clone().startOf('jYear');
203
+ };
204
+ this.startOfMonth = value => {
205
+ return value.clone().startOf('jMonth');
206
+ };
207
+ this.endOfYear = value => {
208
+ return value.clone().endOf('jYear');
209
+ };
210
+ this.endOfMonth = value => {
211
+ return value.clone().endOf('jMonth');
212
+ };
213
+ this.addYears = (value, amount) => {
214
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'jYear') : value.clone().add(amount, 'jYear');
215
+ };
216
+ this.addMonths = (value, amount) => {
217
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'jMonth') : value.clone().add(amount, 'jMonth');
218
+ };
219
+ this.getYear = value => {
220
+ return value.jYear();
221
+ };
222
+ this.getMonth = value => {
223
+ return value.jMonth();
224
+ };
225
+ this.getDate = value => {
226
+ return value.jDate();
227
+ };
228
+ this.setYear = (value, year) => {
229
+ return value.clone().jYear(year);
230
+ };
231
+ this.setMonth = (value, month) => {
232
+ return value.clone().jMonth(month);
233
+ };
234
+ this.setDate = (value, date) => {
235
+ return value.clone().jDate(date);
236
+ };
237
+ this.getNextMonth = value => {
238
+ return value.clone().add(1, 'jMonth');
239
+ };
240
+ this.getPreviousMonth = value => {
241
+ return value.clone().subtract(1, 'jMonth');
242
+ };
243
+ this.getWeekdays = () => {
244
+ return [0, 1, 2, 3, 4, 5, 6].map(dayOfWeek => {
245
+ return this.toJMoment().weekday(dayOfWeek).format('dd');
246
+ });
247
+ };
248
+ this.getWeekArray = value => {
249
+ const start = value.clone().startOf('jMonth').startOf('week');
250
+ const end = value.clone().endOf('jMonth').endOf('week');
251
+ let count = 0;
252
+ let current = start;
253
+ const nestedWeeks = [];
254
+ while (current.isBefore(end)) {
255
+ const weekNumber = Math.floor(count / 7);
256
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
257
+ nestedWeeks[weekNumber].push(current);
258
+ current = current.clone().add(1, 'day');
259
+ count += 1;
260
+ }
261
+ return nestedWeeks;
262
+ };
263
+ this.getWeekNumber = value => {
264
+ return value.jWeek();
265
+ };
266
+ this.getYearRange = (start, end) => {
267
+ const startDate = this.moment(start).startOf('jYear');
268
+ const endDate = this.moment(end).endOf('jYear');
269
+ const years = [];
270
+ let current = startDate;
271
+ while (current.isBefore(endDate)) {
272
+ years.push(current);
273
+ current = current.clone().add(1, 'jYear');
274
+ }
275
+ return years;
276
+ };
277
+ this.getMeridiemText = ampm => {
278
+ return ampm === 'am' ? this.toJMoment().hours(2).format('A') : this.toJMoment().hours(14).format('A');
279
+ };
280
+ this.moment = instance || _momentJalaali.default;
281
+ this.locale = 'fa';
282
+ this.formats = (0, _extends2.default)({}, defaultFormats, formats);
283
+ }
284
+ }
285
+ exports.AdapterMomentJalaali = AdapterMomentJalaali;