@mui/x-date-pickers 6.14.0 → 6.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (432) hide show
  1. package/CHANGELOG.md +167 -0
  2. package/DateCalendar/DateCalendar.js +6 -2
  3. package/DateCalendar/DateCalendar.types.d.ts +1 -1
  4. package/DateCalendar/DayCalendar.d.ts +6 -5
  5. package/DateCalendar/DayCalendar.js +18 -6
  6. package/DateCalendar/dayCalendarClasses.d.ts +2 -0
  7. package/DateCalendar/dayCalendarClasses.js +1 -1
  8. package/DateField/DateField.js +32 -4
  9. package/DateField/DateField.types.d.ts +3 -2
  10. package/DatePicker/DatePicker.js +6 -2
  11. package/DateTimeField/DateTimeField.js +32 -4
  12. package/DateTimeField/DateTimeField.types.d.ts +3 -2
  13. package/DateTimePicker/DateTimePicker.js +6 -2
  14. package/DateTimePicker/DateTimePickerToolbar.js +1 -0
  15. package/DesktopDatePicker/DesktopDatePicker.js +6 -2
  16. package/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
  17. package/MobileDatePicker/MobileDatePicker.js +6 -2
  18. package/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
  19. package/StaticDatePicker/StaticDatePicker.js +6 -2
  20. package/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
  21. package/TimeField/TimeField.js +29 -4
  22. package/TimeField/TimeField.types.d.ts +3 -2
  23. package/TimePicker/TimePickerToolbar.js +1 -0
  24. package/hooks/index.d.ts +1 -0
  25. package/hooks/index.js +1 -0
  26. package/hooks/package.json +6 -0
  27. package/hooks/useClearableField.d.ts +25 -0
  28. package/hooks/useClearableField.js +79 -0
  29. package/icons/index.d.ts +6 -0
  30. package/icons/index.js +8 -1
  31. package/index.d.ts +1 -0
  32. package/index.js +3 -2
  33. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  34. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +3 -2
  35. package/internals/hooks/useField/index.d.ts +1 -1
  36. package/internals/hooks/useField/useField.js +24 -6
  37. package/internals/hooks/useField/useField.types.d.ts +31 -1
  38. package/internals/hooks/useField/useField.utils.js +8 -3
  39. package/internals/index.d.ts +1 -1
  40. package/internals/models/props/toolbar.d.ts +3 -0
  41. package/internals/models/validation.d.ts +3 -0
  42. package/internals/utils/date-utils.d.ts +1 -0
  43. package/internals/utils/date-utils.js +4 -0
  44. package/legacy/DateCalendar/DateCalendar.js +6 -2
  45. package/legacy/DateCalendar/DayCalendar.js +22 -9
  46. package/legacy/DateCalendar/dayCalendarClasses.js +1 -1
  47. package/legacy/DateField/DateField.js +30 -3
  48. package/legacy/DatePicker/DatePicker.js +6 -2
  49. package/legacy/DateTimeField/DateTimeField.js +30 -3
  50. package/legacy/DateTimePicker/DateTimePicker.js +6 -2
  51. package/legacy/DateTimePicker/DateTimePickerToolbar.js +1 -0
  52. package/legacy/DesktopDatePicker/DesktopDatePicker.js +6 -2
  53. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
  54. package/legacy/MobileDatePicker/MobileDatePicker.js +6 -2
  55. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
  56. package/legacy/StaticDatePicker/StaticDatePicker.js +6 -2
  57. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
  58. package/legacy/TimeField/TimeField.js +27 -3
  59. package/legacy/TimePicker/TimePickerToolbar.js +1 -0
  60. package/legacy/hooks/index.js +1 -0
  61. package/legacy/hooks/useClearableField.js +80 -0
  62. package/legacy/icons/index.js +8 -1
  63. package/legacy/index.js +3 -2
  64. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  65. package/legacy/internals/hooks/useField/useField.js +28 -7
  66. package/legacy/internals/hooks/useField/useField.utils.js +16 -8
  67. package/legacy/internals/utils/date-utils.js +6 -0
  68. package/legacy/locales/beBY.js +2 -0
  69. package/legacy/locales/caES.js +2 -0
  70. package/legacy/locales/csCZ.js +2 -0
  71. package/legacy/locales/daDK.js +2 -0
  72. package/legacy/locales/deDE.js +2 -0
  73. package/legacy/locales/elGR.js +2 -0
  74. package/legacy/locales/enUS.js +1 -0
  75. package/legacy/locales/esES.js +2 -0
  76. package/legacy/locales/faIR.js +2 -0
  77. package/legacy/locales/fiFI.js +27 -11
  78. package/legacy/locales/frFR.js +2 -0
  79. package/legacy/locales/heIL.js +2 -0
  80. package/legacy/locales/huHU.js +1 -0
  81. package/legacy/locales/isIS.js +2 -0
  82. package/legacy/locales/itIT.js +2 -0
  83. package/legacy/locales/jaJP.js +2 -0
  84. package/legacy/locales/koKR.js +2 -0
  85. package/legacy/locales/kzKZ.js +2 -0
  86. package/legacy/locales/nbNO.js +2 -0
  87. package/legacy/locales/nlNL.js +2 -0
  88. package/legacy/locales/plPL.js +2 -0
  89. package/legacy/locales/ptBR.js +2 -0
  90. package/legacy/locales/roRO.js +1 -0
  91. package/legacy/locales/ruRU.js +2 -0
  92. package/legacy/locales/skSK.js +2 -0
  93. package/legacy/locales/svSE.js +2 -0
  94. package/legacy/locales/trTR.js +2 -0
  95. package/legacy/locales/ukUA.js +2 -0
  96. package/legacy/locales/urPK.js +2 -0
  97. package/legacy/locales/viVN.js +2 -0
  98. package/legacy/locales/zhCN.js +2 -0
  99. package/legacy/locales/zhHK.js +2 -0
  100. package/locales/beBY.d.ts +1 -0
  101. package/locales/beBY.js +2 -0
  102. package/locales/caES.d.ts +1 -0
  103. package/locales/caES.js +2 -0
  104. package/locales/csCZ.d.ts +1 -0
  105. package/locales/csCZ.js +2 -0
  106. package/locales/daDK.d.ts +1 -0
  107. package/locales/daDK.js +2 -0
  108. package/locales/deDE.d.ts +1 -0
  109. package/locales/deDE.js +2 -0
  110. package/locales/elGR.d.ts +1 -0
  111. package/locales/elGR.js +2 -0
  112. package/locales/enUS.d.ts +1 -0
  113. package/locales/enUS.js +1 -0
  114. package/locales/esES.d.ts +1 -0
  115. package/locales/esES.js +2 -0
  116. package/locales/faIR.d.ts +1 -0
  117. package/locales/faIR.js +2 -0
  118. package/locales/fiFI.d.ts +1 -0
  119. package/locales/fiFI.js +11 -11
  120. package/locales/frFR.d.ts +1 -0
  121. package/locales/frFR.js +2 -0
  122. package/locales/heIL.d.ts +1 -0
  123. package/locales/heIL.js +2 -0
  124. package/locales/huHU.d.ts +1 -0
  125. package/locales/huHU.js +1 -0
  126. package/locales/isIS.d.ts +1 -0
  127. package/locales/isIS.js +2 -0
  128. package/locales/itIT.d.ts +1 -0
  129. package/locales/itIT.js +2 -0
  130. package/locales/jaJP.d.ts +1 -0
  131. package/locales/jaJP.js +2 -0
  132. package/locales/koKR.d.ts +1 -0
  133. package/locales/koKR.js +2 -0
  134. package/locales/kzKZ.d.ts +1 -0
  135. package/locales/kzKZ.js +2 -0
  136. package/locales/nbNO.d.ts +1 -0
  137. package/locales/nbNO.js +2 -0
  138. package/locales/nlNL.d.ts +1 -0
  139. package/locales/nlNL.js +2 -0
  140. package/locales/plPL.d.ts +1 -0
  141. package/locales/plPL.js +2 -0
  142. package/locales/ptBR.d.ts +1 -0
  143. package/locales/ptBR.js +2 -0
  144. package/locales/roRO.d.ts +1 -0
  145. package/locales/roRO.js +1 -0
  146. package/locales/ruRU.d.ts +1 -0
  147. package/locales/ruRU.js +2 -0
  148. package/locales/skSK.d.ts +1 -0
  149. package/locales/skSK.js +2 -0
  150. package/locales/svSE.d.ts +1 -0
  151. package/locales/svSE.js +2 -0
  152. package/locales/trTR.d.ts +1 -0
  153. package/locales/trTR.js +2 -0
  154. package/locales/ukUA.d.ts +1 -0
  155. package/locales/ukUA.js +2 -0
  156. package/locales/urPK.d.ts +1 -0
  157. package/locales/urPK.js +2 -0
  158. package/locales/utils/getPickersLocalization.d.ts +1 -0
  159. package/locales/utils/pickersLocaleTextApi.d.ts +1 -0
  160. package/locales/viVN.d.ts +1 -0
  161. package/locales/viVN.js +2 -0
  162. package/locales/zhCN.d.ts +1 -0
  163. package/locales/zhCN.js +2 -0
  164. package/locales/zhHK.d.ts +1 -0
  165. package/locales/zhHK.js +2 -0
  166. package/models/adapters.d.ts +1 -0
  167. package/models/fields.d.ts +2 -0
  168. package/modern/DateCalendar/DateCalendar.js +6 -2
  169. package/modern/DateCalendar/DayCalendar.js +25 -11
  170. package/modern/DateCalendar/dayCalendarClasses.js +1 -1
  171. package/modern/DateField/DateField.js +32 -4
  172. package/modern/DatePicker/DatePicker.js +6 -2
  173. package/modern/DateTimeField/DateTimeField.js +32 -4
  174. package/modern/DateTimePicker/DateTimePicker.js +6 -2
  175. package/modern/DateTimePicker/DateTimePickerToolbar.js +1 -0
  176. package/modern/DesktopDatePicker/DesktopDatePicker.js +6 -2
  177. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
  178. package/modern/MobileDatePicker/MobileDatePicker.js +6 -2
  179. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
  180. package/modern/StaticDatePicker/StaticDatePicker.js +6 -2
  181. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
  182. package/modern/TimeField/TimeField.js +29 -4
  183. package/modern/TimePicker/TimePickerToolbar.js +1 -0
  184. package/modern/hooks/index.js +1 -0
  185. package/modern/hooks/useClearableField.js +78 -0
  186. package/modern/icons/index.js +8 -1
  187. package/modern/index.js +3 -2
  188. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  189. package/modern/internals/hooks/useField/useField.js +23 -6
  190. package/modern/internals/hooks/useField/useField.utils.js +8 -3
  191. package/modern/internals/utils/date-utils.js +4 -0
  192. package/modern/locales/beBY.js +2 -0
  193. package/modern/locales/caES.js +2 -0
  194. package/modern/locales/csCZ.js +2 -0
  195. package/modern/locales/daDK.js +2 -0
  196. package/modern/locales/deDE.js +2 -0
  197. package/modern/locales/elGR.js +2 -0
  198. package/modern/locales/enUS.js +1 -0
  199. package/modern/locales/esES.js +2 -0
  200. package/modern/locales/faIR.js +2 -0
  201. package/modern/locales/fiFI.js +11 -11
  202. package/modern/locales/frFR.js +2 -0
  203. package/modern/locales/heIL.js +2 -0
  204. package/modern/locales/huHU.js +1 -0
  205. package/modern/locales/isIS.js +2 -0
  206. package/modern/locales/itIT.js +2 -0
  207. package/modern/locales/jaJP.js +2 -0
  208. package/modern/locales/koKR.js +2 -0
  209. package/modern/locales/kzKZ.js +2 -0
  210. package/modern/locales/nbNO.js +2 -0
  211. package/modern/locales/nlNL.js +2 -0
  212. package/modern/locales/plPL.js +2 -0
  213. package/modern/locales/ptBR.js +2 -0
  214. package/modern/locales/roRO.js +1 -0
  215. package/modern/locales/ruRU.js +2 -0
  216. package/modern/locales/skSK.js +2 -0
  217. package/modern/locales/svSE.js +2 -0
  218. package/modern/locales/trTR.js +2 -0
  219. package/modern/locales/ukUA.js +2 -0
  220. package/modern/locales/urPK.js +2 -0
  221. package/modern/locales/viVN.js +2 -0
  222. package/modern/locales/zhCN.js +2 -0
  223. package/modern/locales/zhHK.js +2 -0
  224. package/node/DateCalendar/DateCalendar.js +6 -2
  225. package/node/DateCalendar/DayCalendar.js +24 -10
  226. package/node/DateCalendar/dayCalendarClasses.js +1 -1
  227. package/node/DateField/DateField.js +32 -4
  228. package/node/DatePicker/DatePicker.js +6 -2
  229. package/node/DateTimeField/DateTimeField.js +32 -4
  230. package/node/DateTimePicker/DateTimePicker.js +6 -2
  231. package/node/DateTimePicker/DateTimePickerToolbar.js +1 -0
  232. package/node/DesktopDatePicker/DesktopDatePicker.js +6 -2
  233. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +6 -2
  234. package/node/MobileDatePicker/MobileDatePicker.js +6 -2
  235. package/node/MobileDateTimePicker/MobileDateTimePicker.js +6 -2
  236. package/node/StaticDatePicker/StaticDatePicker.js +6 -2
  237. package/node/StaticDateTimePicker/StaticDateTimePicker.js +6 -2
  238. package/node/TimeField/TimeField.js +29 -4
  239. package/node/TimePicker/TimePickerToolbar.js +1 -0
  240. package/node/hooks/index.js +12 -0
  241. package/node/hooks/useClearableField.js +87 -0
  242. package/node/icons/index.js +10 -2
  243. package/node/index.js +13 -1
  244. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +3 -1
  245. package/node/internals/hooks/useField/useField.js +23 -6
  246. package/node/internals/hooks/useField/useField.utils.js +8 -3
  247. package/node/internals/utils/date-utils.js +7 -2
  248. package/node/locales/beBY.js +2 -0
  249. package/node/locales/caES.js +2 -0
  250. package/node/locales/csCZ.js +2 -0
  251. package/node/locales/daDK.js +2 -0
  252. package/node/locales/deDE.js +2 -0
  253. package/node/locales/elGR.js +2 -0
  254. package/node/locales/enUS.js +1 -0
  255. package/node/locales/esES.js +2 -0
  256. package/node/locales/faIR.js +2 -0
  257. package/node/locales/fiFI.js +11 -11
  258. package/node/locales/frFR.js +2 -0
  259. package/node/locales/heIL.js +2 -0
  260. package/node/locales/huHU.js +1 -0
  261. package/node/locales/isIS.js +2 -0
  262. package/node/locales/itIT.js +2 -0
  263. package/node/locales/jaJP.js +2 -0
  264. package/node/locales/koKR.js +2 -0
  265. package/node/locales/kzKZ.js +2 -0
  266. package/node/locales/nbNO.js +2 -0
  267. package/node/locales/nlNL.js +2 -0
  268. package/node/locales/plPL.js +2 -0
  269. package/node/locales/ptBR.js +2 -0
  270. package/node/locales/roRO.js +1 -0
  271. package/node/locales/ruRU.js +2 -0
  272. package/node/locales/skSK.js +2 -0
  273. package/node/locales/svSE.js +2 -0
  274. package/node/locales/trTR.js +2 -0
  275. package/node/locales/ukUA.js +2 -0
  276. package/node/locales/urPK.js +2 -0
  277. package/node/locales/viVN.js +2 -0
  278. package/node/locales/zhCN.js +2 -0
  279. package/node/locales/zhHK.js +2 -0
  280. package/package.json +1 -1
  281. package/legacy/tests/describe.types.js +0 -1
  282. package/legacy/tests/describeAdapters/describeAdapters.js +0 -29
  283. package/legacy/tests/describeAdapters/index.js +0 -1
  284. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -32
  285. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -1
  286. package/legacy/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -2
  287. package/legacy/tests/describeGregorianAdapter/index.js +0 -2
  288. package/legacy/tests/describeGregorianAdapter/testCalculations.js +0 -707
  289. package/legacy/tests/describeGregorianAdapter/testFormat.js +0 -26
  290. package/legacy/tests/describeGregorianAdapter/testLocalization.js +0 -49
  291. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.js +0 -21
  292. package/legacy/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -1
  293. package/legacy/tests/describeHijriAdapter/index.js +0 -1
  294. package/legacy/tests/describeHijriAdapter/testCalculations.js +0 -167
  295. package/legacy/tests/describeHijriAdapter/testLocalization.js +0 -20
  296. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -21
  297. package/legacy/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -1
  298. package/legacy/tests/describeJalaliAdapter/index.js +0 -1
  299. package/legacy/tests/describeJalaliAdapter/testCalculations.js +0 -236
  300. package/legacy/tests/describeJalaliAdapter/testLocalization.js +0 -20
  301. package/legacy/tests/describePicker/describePicker.js +0 -159
  302. package/legacy/tests/describePicker/describePicker.types.js +0 -1
  303. package/legacy/tests/describePicker/index.js +0 -1
  304. package/legacy/tests/describeValidation/describeValidation.js +0 -31
  305. package/legacy/tests/describeValidation/describeValidation.types.js +0 -1
  306. package/legacy/tests/describeValidation/index.js +0 -1
  307. package/legacy/tests/describeValidation/testDayViewValidation.js +0 -281
  308. package/legacy/tests/describeValidation/testMinutesViewValidation.js +0 -194
  309. package/legacy/tests/describeValidation/testMonthViewValidation.js +0 -136
  310. package/legacy/tests/describeValidation/testTextFieldValidation.js +0 -463
  311. package/legacy/tests/describeValidation/testYearViewValidation.js +0 -95
  312. package/legacy/tests/describeValue/describeValue.js +0 -57
  313. package/legacy/tests/describeValue/describeValue.types.js +0 -1
  314. package/legacy/tests/describeValue/index.js +0 -1
  315. package/legacy/tests/describeValue/testControlledUnControlled.js +0 -237
  316. package/legacy/tests/describeValue/testPickerActionBar.js +0 -250
  317. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -362
  318. package/legacy/tests/describeValue/testShortcuts.js +0 -119
  319. package/modern/tests/describe.types.js +0 -1
  320. package/modern/tests/describeAdapters/describeAdapters.js +0 -29
  321. package/modern/tests/describeAdapters/index.js +0 -1
  322. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -29
  323. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -1
  324. package/modern/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -2
  325. package/modern/tests/describeGregorianAdapter/index.js +0 -2
  326. package/modern/tests/describeGregorianAdapter/testCalculations.js +0 -706
  327. package/modern/tests/describeGregorianAdapter/testFormat.js +0 -27
  328. package/modern/tests/describeGregorianAdapter/testLocalization.js +0 -50
  329. package/modern/tests/describeHijriAdapter/describeHijriAdapter.js +0 -21
  330. package/modern/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -1
  331. package/modern/tests/describeHijriAdapter/index.js +0 -1
  332. package/modern/tests/describeHijriAdapter/testCalculations.js +0 -164
  333. package/modern/tests/describeHijriAdapter/testLocalization.js +0 -21
  334. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -21
  335. package/modern/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -1
  336. package/modern/tests/describeJalaliAdapter/index.js +0 -1
  337. package/modern/tests/describeJalaliAdapter/testCalculations.js +0 -237
  338. package/modern/tests/describeJalaliAdapter/testLocalization.js +0 -21
  339. package/modern/tests/describePicker/describePicker.js +0 -162
  340. package/modern/tests/describePicker/describePicker.types.js +0 -1
  341. package/modern/tests/describePicker/index.js +0 -1
  342. package/modern/tests/describeValidation/describeValidation.js +0 -31
  343. package/modern/tests/describeValidation/describeValidation.types.js +0 -1
  344. package/modern/tests/describeValidation/index.js +0 -1
  345. package/modern/tests/describeValidation/testDayViewValidation.js +0 -280
  346. package/modern/tests/describeValidation/testMinutesViewValidation.js +0 -193
  347. package/modern/tests/describeValidation/testMonthViewValidation.js +0 -137
  348. package/modern/tests/describeValidation/testTextFieldValidation.js +0 -470
  349. package/modern/tests/describeValidation/testYearViewValidation.js +0 -94
  350. package/modern/tests/describeValue/describeValue.js +0 -59
  351. package/modern/tests/describeValue/describeValue.types.js +0 -1
  352. package/modern/tests/describeValue/index.js +0 -1
  353. package/modern/tests/describeValue/testControlledUnControlled.js +0 -239
  354. package/modern/tests/describeValue/testPickerActionBar.js +0 -254
  355. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -371
  356. package/modern/tests/describeValue/testShortcuts.js +0 -112
  357. package/node/tests/describe.types.js +0 -5
  358. package/node/tests/describeAdapters/describeAdapters.js +0 -37
  359. package/node/tests/describeAdapters/index.js +0 -12
  360. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -37
  361. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -5
  362. package/node/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -10
  363. package/node/tests/describeGregorianAdapter/index.js +0 -19
  364. package/node/tests/describeGregorianAdapter/testCalculations.js +0 -711
  365. package/node/tests/describeGregorianAdapter/testFormat.js +0 -34
  366. package/node/tests/describeGregorianAdapter/testLocalization.js +0 -57
  367. package/node/tests/describeHijriAdapter/describeHijriAdapter.js +0 -29
  368. package/node/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -5
  369. package/node/tests/describeHijriAdapter/index.js +0 -12
  370. package/node/tests/describeHijriAdapter/testCalculations.js +0 -171
  371. package/node/tests/describeHijriAdapter/testLocalization.js +0 -28
  372. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -29
  373. package/node/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -5
  374. package/node/tests/describeJalaliAdapter/index.js +0 -12
  375. package/node/tests/describeJalaliAdapter/testCalculations.js +0 -244
  376. package/node/tests/describeJalaliAdapter/testLocalization.js +0 -28
  377. package/node/tests/describePicker/describePicker.js +0 -173
  378. package/node/tests/describePicker/describePicker.types.js +0 -5
  379. package/node/tests/describePicker/index.js +0 -12
  380. package/node/tests/describeValidation/describeValidation.js +0 -39
  381. package/node/tests/describeValidation/describeValidation.types.js +0 -5
  382. package/node/tests/describeValidation/index.js +0 -12
  383. package/node/tests/describeValidation/testDayViewValidation.js +0 -290
  384. package/node/tests/describeValidation/testMinutesViewValidation.js +0 -203
  385. package/node/tests/describeValidation/testMonthViewValidation.js +0 -147
  386. package/node/tests/describeValidation/testTextFieldValidation.js +0 -480
  387. package/node/tests/describeValidation/testYearViewValidation.js +0 -104
  388. package/node/tests/describeValue/describeValue.js +0 -69
  389. package/node/tests/describeValue/describeValue.types.js +0 -5
  390. package/node/tests/describeValue/index.js +0 -12
  391. package/node/tests/describeValue/testControlledUnControlled.js +0 -248
  392. package/node/tests/describeValue/testPickerActionBar.js +0 -264
  393. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -381
  394. package/node/tests/describeValue/testShortcuts.js +0 -122
  395. package/tests/describe.types.js +0 -1
  396. package/tests/describeAdapters/describeAdapters.js +0 -29
  397. package/tests/describeAdapters/index.js +0 -1
  398. package/tests/describeGregorianAdapter/describeGregorianAdapter.js +0 -30
  399. package/tests/describeGregorianAdapter/describeGregorianAdapter.types.js +0 -1
  400. package/tests/describeGregorianAdapter/describeGregorianAdapter.utils.js +0 -2
  401. package/tests/describeGregorianAdapter/index.js +0 -2
  402. package/tests/describeGregorianAdapter/testCalculations.js +0 -706
  403. package/tests/describeGregorianAdapter/testFormat.js +0 -27
  404. package/tests/describeGregorianAdapter/testLocalization.js +0 -50
  405. package/tests/describeHijriAdapter/describeHijriAdapter.js +0 -21
  406. package/tests/describeHijriAdapter/describeHijriAdapter.types.js +0 -1
  407. package/tests/describeHijriAdapter/index.js +0 -1
  408. package/tests/describeHijriAdapter/testCalculations.js +0 -164
  409. package/tests/describeHijriAdapter/testLocalization.js +0 -21
  410. package/tests/describeJalaliAdapter/describeJalaliAdapter.js +0 -21
  411. package/tests/describeJalaliAdapter/describeJalaliAdapter.types.js +0 -1
  412. package/tests/describeJalaliAdapter/index.js +0 -1
  413. package/tests/describeJalaliAdapter/testCalculations.js +0 -237
  414. package/tests/describeJalaliAdapter/testLocalization.js +0 -21
  415. package/tests/describePicker/describePicker.js +0 -162
  416. package/tests/describePicker/describePicker.types.js +0 -1
  417. package/tests/describePicker/index.js +0 -1
  418. package/tests/describeValidation/describeValidation.js +0 -31
  419. package/tests/describeValidation/describeValidation.types.js +0 -1
  420. package/tests/describeValidation/index.js +0 -1
  421. package/tests/describeValidation/testDayViewValidation.js +0 -280
  422. package/tests/describeValidation/testMinutesViewValidation.js +0 -193
  423. package/tests/describeValidation/testMonthViewValidation.js +0 -137
  424. package/tests/describeValidation/testTextFieldValidation.js +0 -470
  425. package/tests/describeValidation/testYearViewValidation.js +0 -94
  426. package/tests/describeValue/describeValue.js +0 -59
  427. package/tests/describeValue/describeValue.types.js +0 -1
  428. package/tests/describeValue/index.js +0 -1
  429. package/tests/describeValue/testControlledUnControlled.js +0 -239
  430. package/tests/describeValue/testPickerActionBar.js +0 -254
  431. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +0 -371
  432. package/tests/describeValue/testShortcuts.js +0 -112
package/CHANGELOG.md CHANGED
@@ -3,6 +3,173 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.16.0
7
+
8
+ _Sep 29, 2023_
9
+
10
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add a clearable behavior to all the single input pickers and fields (#9095) @noraleonte
13
+
14
+ The pickers and fields now have an out-of-the box implementation for clearing the field value. You can see the documentation for this behavior on the [Date Picker documentation](https://mui.com/x/react-date-pickers/date-picker/#clearing-the-value).
15
+
16
+ <img width="380" alt="Clearable behavior" src="https://github.com/mui/mui-x/assets/72460825/e4a66169-83b5-4579-b9f6-6e15bb528411">
17
+
18
+ - 💫 Add Date Picker customization playground (#9581) @noraleonte
19
+
20
+ You can play around with style customization options on the [Date Picker documentation](https://mui.com/x/react-date-pickers/date-picker/#customization).
21
+
22
+ We are thrilled to hear your feedback about this functionality!
23
+
24
+ - 🚀 Fix header filters menu auto closing on render (#10483) @MBilalShafi
25
+ - 🎯 Fix column headers scroll when theme scoping is used (#10437) @cherniavskii
26
+ - 🌍 Improve Russian (ru-RU) locale on the data grid
27
+ - 🐞 Bugfixes
28
+ - 📚 Documentation improvements
29
+
30
+ ### Data Grid
31
+
32
+ #### `@mui/x-data-grid@6.16.0`
33
+
34
+ - [DataGrid] Fix column headers scroll when theme scoping is used (#10437) @cherniavskii
35
+ - [DataGrid] Rename `global` to `globalScope` due to Jest issue (#10470) @romgrk
36
+ - [l10n] Improve Russian (ru-RU) locale (#10464 and #10407) @NKodos
37
+
38
+ #### `@mui/x-data-grid-pro@6.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
39
+
40
+ Same changes as in `@mui/x-data-grid@6.16.0`, plus:
41
+
42
+ - [DataGridPro] Fix header filters menu auto closing on render (#10483) @MBilalShafi
43
+
44
+ #### `@mui/x-data-grid-premium@6.16.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
45
+
46
+ Same changes as in `@mui/x-data-grid-pro@6.16.0`.
47
+
48
+ ### Date Pickers
49
+
50
+ #### `@mui/x-date-pickers@6.16.0`
51
+
52
+ - [pickers] Add warning to `shouldDisableDate` validation (#10502) @michelengelen
53
+ - [pickers] Implement `clearable` field behavior (#9095) @noraleonte
54
+ - [pickers] Refactor `dayOfWeekFormatter` (#10345) @michelengelen
55
+
56
+ #### `@mui/x-date-pickers-pro@6.16.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
57
+
58
+ Same changes as in `@mui/x-date-pickers@6.16.0`.
59
+
60
+ ### Charts / `@mui/x-charts@6.0.0-alpha.13`
61
+
62
+ - [charts] Share upfront future Pro features (#10465) @oliviertassinari
63
+
64
+ ### Tree View / `@mui/x-tree-view@6.0.0-beta.0`
65
+
66
+ - [TreeView] Do not try to focus a collapsed node when re-focusing the TreeView (#10422) @flaviendelangle
67
+ - [TreeView] Fix the typing of the `Multiple` generic (#10478) @flaviendelangle
68
+
69
+ ### Docs
70
+
71
+ - [docs] Correct the typo in data grid api docs (#10477) @MBilalShafi
72
+ - [docs] Add customization playground (#9581) @noraleonte
73
+ - [docs] Fix Tree View product ID (#10428) @oliviertassinari
74
+ - [docs] Fix demo crashing when all rows are deleted (#10438) @cherniavskii
75
+ - [docs] Fix mobile scrollbar column resize (#10455) @oliviertassinari
76
+ - [docs] Fix usage of `GridRenderCellParams` interface (#10435) @cherniavskii
77
+
78
+ ### Core
79
+
80
+ - [core] Fix typo in header data grid quick filter @oliviertassinari
81
+ - [core] Group D3 renovate PRs (#10480) @flaviendelangle
82
+ - [core] Link the priority support page (#10495) @michelengelen
83
+ - [core] Move the pickers describes to the test utils folder (#10490) @flaviendelangle
84
+ - [core] Priority Support casing normalization @oliviertassinari
85
+ - [core] Remove automated DataGrid performance tests (#10414) @romgrk
86
+ - [core] Sync `prism-okaidia.css` with docs-infra @oliviertassinari
87
+ - [core] Update issue actions & templates (#10375) @romgrk
88
+ - [core] Update release guide (#10468) @DanailH
89
+
90
+ ## 6.15.0
91
+
92
+ _Sep 22, 2023_
93
+
94
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
95
+
96
+ - 🚀 Implement columns auto-sizing (#10180) @romgrk
97
+ - 🎁 Add support for `getRowsToExport` option to print export on the data grid (#10084) @zreecespieces
98
+ - 🌍 Improve Finnish (fi-FI) locale
99
+ - 🐞 Bugfixes
100
+ - 📚 Documentation improvements
101
+
102
+ ### Data Grid
103
+
104
+ #### `@mui/x-data-grid@6.15.0`
105
+
106
+ - [DataGrid] Add support for `getRowsToExport` option to print export (#10084) @zreecespieces
107
+ - [DataGrid] Fix dev warning about `InputLabelProps` (#10413) @romgrk
108
+ - [DataGrid] Refactor `GridMenu` prop `onClickAway` to `onClose` (#10411) @romgrk
109
+ - [DataGrid] Restore focus after `GridMenu` closes (#10412) @romgrk
110
+ - [DataGrid] Fix typing of `GridActionsCellItem` (#10344) @romgrk
111
+ - [DataGrid] Hide `eval` from bundlers (#10329) @romgrk
112
+ - [DataGrid] Add `border: 0` to unmounted focused cell to avoid layout shifts in that row (#10318) @lauri865
113
+
114
+ #### `@mui/x-data-grid-pro@6.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
115
+
116
+ Same changes as in `@mui/x-data-grid@6.15.0`, plus:
117
+
118
+ - [DataGridPro] Implement columns auto-sizing (#10180) @romgrk
119
+ - [DataGridPro] Fix keyboard navigation issue in header filters (#10358) @MBilalShafi
120
+ - [DataGridPro] Add missing row hover styles (#10252) @cherniavskii
121
+ - [DataGridPro] Make default filter items have stable references in header filters (#10338) @MBilalShafi
122
+
123
+ #### `@mui/x-data-grid-premium@6.15.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
124
+
125
+ Same changes as in `@mui/x-data-grid-pro@6.15.0`.
126
+
127
+ ### Date Pickers
128
+
129
+ #### `@mui/x-date-pickers@6.15.0`
130
+
131
+ - [pickers] Support tokens without spaces (#10185) @alexfauquette
132
+ - [l10n] Improve Finnish (fi-FI) locale (#10346) @samijouppila
133
+
134
+ #### `@mui/x-date-pickers-pro@6.15.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
135
+
136
+ Same changes as in `@mui/x-date-pickers@6.15.0`.
137
+
138
+ ### Charts / `@mui/x-charts@6.0.0-alpha.12`
139
+
140
+ - [charts] Fix sparkline scale and rendering (#10402) @alexfauquette
141
+ - [charts] Remove components from `@mui/material` (#10115) @alexfauquette
142
+
143
+ ### Tree View / `@mui/x-tree-view@6.0.0-alpha.4`
144
+
145
+ - [TreeView] Split features into plugins to prepare for Pro version (#10123) @flaviendelangle
146
+
147
+ ### Docs
148
+
149
+ - [docs] Add charts documentation pages to complete pricing table (#10394) @alexfauquette
150
+ - [docs] Add missing MIT packages on the Licensing page (#10348) @flaviendelangle
151
+ - [docs] Clearer component pattern @oliviertassinari
152
+ - [docs] Easier to understand demo (#10370) @oliviertassinari
153
+ - [docs] Fix `301` to Material UI @oliviertassinari
154
+ - [docs] Improve the column visibility section (#10327) @MBilalShafi
155
+ - [docs] Improve the documentation section `rowIdentifier` (#10326) @MBilalShafi
156
+ - [docs] Improve pickers localization documentation (#10202) @flaviendelangle
157
+ - [docs] Polish typescript ref usage (#10359) @oliviertassinari
158
+ - [docs] Improve charts tooltip wording (#10406) @alexfauquette
159
+
160
+ ### Core
161
+
162
+ - [core] Cleanup GitHub issues template (#10372) @romgrk
163
+ - [core] Fix Circle CI OOM (#10385) @romgrk
164
+ - [core] Improve sleep test helper @oliviertassinari
165
+ - [core] Remove unwanted prefixes @oliviertassinari
166
+ - [core] Remove duplicate label @oliviertassinari
167
+ - [core] Simplify source @oliviertassinari
168
+ - [core] Upgrade monorepo (#10425) @cherniavskii
169
+ - [core] Upgrade monorepo to have the new typescript-to-proptype (#10224) @flaviendelangle
170
+ - [test] Do not use deprecated adapter methods (#10416) @flaviendelangle
171
+ - [test] Name test suites according to sentence case (#10429) @alexfauquette
172
+
6
173
  ## 6.14.0
7
174
 
8
175
  _Sep 14, 2023_
@@ -375,9 +375,10 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
375
375
  componentsProps: PropTypes.object,
376
376
  /**
377
377
  * Formats the day of week displayed in the calendar header.
378
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
378
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
379
+ * @param {TDate} date The date of the day of week provided by the adapter.
379
380
  * @returns {string} The name to display.
380
- * @default (day) => day.charAt(0).toUpperCase()
381
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
381
382
  */
382
383
  dayOfWeekFormatter: PropTypes.func,
383
384
  /**
@@ -503,6 +504,9 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
503
504
  renderLoading: PropTypes.func,
504
505
  /**
505
506
  * Disable specific date.
507
+ *
508
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
509
+ *
506
510
  * @template TDate
507
511
  * @param {TDate} day The date to test.
508
512
  * @returns {boolean} If `true` the date will be disabled.
@@ -24,7 +24,7 @@ export interface DateCalendarSlotsComponent<TDate> extends PickersCalendarHeader
24
24
  export interface DateCalendarSlotsComponentsProps<TDate> extends PickersCalendarHeaderSlotsComponentsProps<TDate>, DayCalendarSlotsComponentsProps<TDate> {
25
25
  calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, DateCalendarProps<TDate>>;
26
26
  }
27
- export interface ExportedDateCalendarProps<TDate> extends ExportedDayCalendarProps, ExportedMonthCalendarProps, ExportedYearCalendarProps, BaseDateValidationProps<TDate>, DayValidationProps<TDate>, YearValidationProps<TDate>, MonthValidationProps<TDate>, TimezoneProps {
27
+ export interface ExportedDateCalendarProps<TDate> extends ExportedDayCalendarProps<TDate>, ExportedMonthCalendarProps, ExportedYearCalendarProps, BaseDateValidationProps<TDate>, DayValidationProps<TDate>, YearValidationProps<TDate>, MonthValidationProps<TDate>, TimezoneProps {
28
28
  /**
29
29
  * Default calendar month displayed when `value` and `defaultValue` are empty.
30
30
  */
@@ -22,7 +22,7 @@ export interface DayCalendarSlotsComponentsProps<TDate> {
22
22
  selected: boolean;
23
23
  }>;
24
24
  }
25
- export interface ExportedDayCalendarProps extends ExportedPickersDayProps {
25
+ export interface ExportedDayCalendarProps<TDate> extends ExportedPickersDayProps {
26
26
  /**
27
27
  * If `true`, calls `renderLoading` instead of rendering the day calendar.
28
28
  * Can be used to preload information and show it in calendar.
@@ -37,11 +37,12 @@ export interface ExportedDayCalendarProps extends ExportedPickersDayProps {
37
37
  renderLoading?: () => React.ReactNode;
38
38
  /**
39
39
  * Formats the day of week displayed in the calendar header.
40
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
40
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
41
+ * @param {TDate} date The date of the day of week provided by the adapter.
41
42
  * @returns {string} The name to display.
42
- * @default (day) => day.charAt(0).toUpperCase()
43
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
43
44
  */
44
- dayOfWeekFormatter?: (day: string) => string;
45
+ dayOfWeekFormatter?: (day: string, date: TDate) => string;
45
46
  /**
46
47
  * If `true`, the week number will be display in the calendar.
47
48
  */
@@ -53,7 +54,7 @@ export interface ExportedDayCalendarProps extends ExportedPickersDayProps {
53
54
  */
54
55
  fixedWeekNumber?: number;
55
56
  }
56
- export interface DayCalendarProps<TDate> extends ExportedDayCalendarProps, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, Required<BaseDateValidationProps<TDate>>, DefaultizedProps<TimezoneProps, 'timezone'>, SlotsAndSlotProps<DayCalendarSlotsComponent<TDate>, DayCalendarSlotsComponentsProps<TDate>> {
57
+ export interface DayCalendarProps<TDate> extends ExportedDayCalendarProps<TDate>, DayValidationProps<TDate>, MonthValidationProps<TDate>, YearValidationProps<TDate>, Required<BaseDateValidationProps<TDate>>, DefaultizedProps<TimezoneProps, 'timezone'>, SlotsAndSlotProps<DayCalendarSlotsComponent<TDate>, DayCalendarSlotsComponentsProps<TDate>> {
57
58
  autoFocus?: boolean;
58
59
  className?: string;
59
60
  currentMonth: TDate;
@@ -14,7 +14,7 @@ import { useUtils, useNow, useLocaleText } from '../internals/hooks/useUtils';
14
14
  import { DAY_SIZE, DAY_MARGIN } from '../internals/constants/dimensions';
15
15
  import { PickersSlideTransition } from './PickersSlideTransition';
16
16
  import { useIsDateDisabled } from './useIsDateDisabled';
17
- import { findClosestEnabledDate } from '../internals/utils/date-utils';
17
+ import { findClosestEnabledDate, getWeekdays } from '../internals/utils/date-utils';
18
18
  import { getDayCalendarUtilityClass } from './dayCalendarClasses';
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -23,6 +23,7 @@ const useUtilityClasses = ownerState => {
23
23
  classes
24
24
  } = ownerState;
25
25
  const slots = {
26
+ root: ['root'],
26
27
  header: ['header'],
27
28
  weekDayLabel: ['weekDayLabel'],
28
29
  loadingContainer: ['loadingContainer'],
@@ -34,8 +35,12 @@ const useUtilityClasses = ownerState => {
34
35
  };
35
36
  return composeClasses(slots, getDayCalendarUtilityClass, classes);
36
37
  };
37
- const defaultDayOfWeekFormatter = day => day.charAt(0).toUpperCase();
38
38
  const weeksContainerHeight = (DAY_SIZE + DAY_MARGIN * 2) * 6;
39
+ const PickersCalendarDayRoot = styled('div', {
40
+ name: 'MuiDayCalendar',
41
+ slot: 'Root',
42
+ overridesResolver: (_, styles) => styles.root
43
+ })({});
39
44
  const PickersCalendarDayHeader = styled('div', {
40
45
  name: 'MuiDayCalendar',
41
46
  slot: 'Header',
@@ -236,7 +241,7 @@ export function DayCalendar(inProps) {
236
241
  shouldDisableDate,
237
242
  shouldDisableMonth,
238
243
  shouldDisableYear,
239
- dayOfWeekFormatter = defaultDayOfWeekFormatter,
244
+ dayOfWeekFormatter: dayOfWeekFormatterFromProps,
240
245
  hasFocus,
241
246
  onFocusedViewChange,
242
247
  gridLabelId,
@@ -250,6 +255,9 @@ export function DayCalendar(inProps) {
250
255
  const classes = useUtilityClasses(props);
251
256
  const theme = useTheme();
252
257
  const isRTL = theme.direction === 'rtl';
258
+
259
+ // before we could define this outside of the component scope, but now we need utils, which is only defined here
260
+ const dayOfWeekFormatter = dayOfWeekFormatterFromProps || ((_day, date) => utils.format(date, 'weekdayShort').charAt(0).toUpperCase());
253
261
  const isDateDisabled = useIsDateDisabled({
254
262
  shouldDisableDate,
255
263
  shouldDisableMonth,
@@ -391,9 +399,10 @@ export function DayCalendar(inProps) {
391
399
  }
392
400
  return toDisplay;
393
401
  }, [currentMonth, fixedWeekNumber, utils, timezone]);
394
- return /*#__PURE__*/_jsxs("div", {
402
+ return /*#__PURE__*/_jsxs(PickersCalendarDayRoot, {
395
403
  role: "grid",
396
404
  "aria-labelledby": gridLabelId,
405
+ className: classes.root,
397
406
  children: [/*#__PURE__*/_jsxs(PickersCalendarDayHeader, {
398
407
  role: "row",
399
408
  className: classes.header,
@@ -403,14 +412,17 @@ export function DayCalendar(inProps) {
403
412
  "aria-label": localeText.calendarWeekNumberHeaderLabel,
404
413
  className: classes.weekNumberLabel,
405
414
  children: localeText.calendarWeekNumberHeaderText
406
- }), utils.getWeekdays().map((day, i) => {
415
+ }), getWeekdays(utils, now).map((weekday, i) => {
407
416
  var _dayOfWeekFormatter;
417
+ // regression-prevention:
418
+ // since 'weekdayShort' now always returns an abbreviated form we slice the first 2 letters from it.
419
+ const day = utils.format(weekday, 'weekdayShort').slice(0, 2);
408
420
  return /*#__PURE__*/_jsx(PickersCalendarWeekDayLabel, {
409
421
  variant: "caption",
410
422
  role: "columnheader",
411
423
  "aria-label": utils.format(utils.addDays(startOfCurrentWeek, i), 'weekday'),
412
424
  className: classes.weekDayLabel,
413
- children: (_dayOfWeekFormatter = dayOfWeekFormatter == null ? void 0 : dayOfWeekFormatter(day)) != null ? _dayOfWeekFormatter : day
425
+ children: (_dayOfWeekFormatter = dayOfWeekFormatter == null ? void 0 : dayOfWeekFormatter(day, weekday)) != null ? _dayOfWeekFormatter : day
414
426
  }, day + i.toString());
415
427
  })]
416
428
  }), loading ? /*#__PURE__*/_jsx(PickersCalendarLoadingContainer, {
@@ -1,4 +1,6 @@
1
1
  export interface DayCalendarClasses {
2
+ /** Styles applied to the root element. */
3
+ root: string;
2
4
  /** Styles applied to the header element. */
3
5
  header: string;
4
6
  /** Styles applied to the week day label element. */
@@ -1,3 +1,3 @@
1
1
  import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
2
  export const getDayCalendarUtilityClass = slot => generateUtilityClass('MuiDayCalendar', slot);
3
- export const dayPickerClasses = generateUtilityClasses('MuiDayCalendar', ['header', 'weekDayLabel', 'loadingContainer', 'slideTransition', 'monthContainer', 'weekContainer', 'weekNumberLabel', 'weekNumber']);
3
+ export const dayPickerClasses = generateUtilityClasses('MuiDayCalendar', ['root', 'header', 'weekDayLabel', 'loadingContainer', 'slideTransition', 'monthContainer', 'weekContainer', 'weekNumberLabel', 'weekNumber']);
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
- _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
5
+ _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
@@ -10,6 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
11
  import { refType } from '@mui/utils';
12
12
  import { useDateField } from './useDateField';
13
+ import { useClearableField } from '../hooks';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref) {
15
16
  var _ref, _slots$textField, _slotProps$textField;
@@ -51,13 +52,28 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref)
51
52
  onPaste,
52
53
  onKeyDown,
53
54
  inputMode,
54
- readOnly
55
+ readOnly,
56
+ clearable,
57
+ onClear
55
58
  } = _useDateField,
56
59
  fieldProps = _objectWithoutPropertiesLoose(_useDateField, _excluded3);
60
+ const {
61
+ InputProps: ProcessedInputProps,
62
+ fieldProps: processedFieldProps
63
+ } = useClearableField({
64
+ onClear,
65
+ clearable,
66
+ fieldProps,
67
+ InputProps: fieldProps.InputProps,
68
+ slots,
69
+ slotProps,
70
+ components,
71
+ componentsProps
72
+ });
57
73
  return /*#__PURE__*/_jsx(TextField, _extends({
58
74
  ref: ref
59
- }, fieldProps, {
60
- InputProps: _extends({}, fieldProps.InputProps, {
75
+ }, processedFieldProps, {
76
+ InputProps: _extends({}, ProcessedInputProps, {
61
77
  readOnly
62
78
  }),
63
79
  inputProps: _extends({}, fieldProps.inputProps, {
@@ -79,6 +95,11 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
79
95
  */
80
96
  autoFocus: PropTypes.bool,
81
97
  className: PropTypes.string,
98
+ /**
99
+ * If `true`, a clear button will be shown in the field allowing value clearing.
100
+ * @default false
101
+ */
102
+ clearable: PropTypes.bool,
82
103
  /**
83
104
  * The color of the component.
84
105
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -207,6 +228,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
207
228
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
208
229
  */
209
230
  onChange: PropTypes.func,
231
+ /**
232
+ * Callback fired when the clear button is clicked.
233
+ */
234
+ onClear: PropTypes.func,
210
235
  /**
211
236
  * Callback fired when the error associated to the current value changes.
212
237
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -253,6 +278,9 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
253
278
  })]),
254
279
  /**
255
280
  * Disable specific date.
281
+ *
282
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
283
+ *
256
284
  * @template TDate
257
285
  * @param {TDate} day The date to test.
258
286
  * @returns {boolean} If `true` the date will be disabled.
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import TextField from '@mui/material/TextField';
4
+ import { FieldSlotsComponents, FieldSlotsComponentsProps } from '../internals';
4
5
  import { DateValidationError, FieldSection } from '../models';
5
6
  import { UseFieldInternalProps } from '../internals/hooks/useField';
6
7
  import { DefaultizedProps, MakeOptional } from '../internals/models/helpers';
@@ -18,7 +19,7 @@ export type UseDateFieldComponentProps<TDate, TChildProps extends {}> = Omit<TCh
18
19
  export interface DateFieldProps<TDate> extends UseDateFieldComponentProps<TDate, FieldsTextFieldProps>, SlotsAndSlotProps<DateFieldSlotsComponent, DateFieldSlotsComponentsProps<TDate>> {
19
20
  }
20
21
  export type DateFieldOwnerState<TDate> = DateFieldProps<TDate>;
21
- export interface DateFieldSlotsComponent {
22
+ export interface DateFieldSlotsComponent extends FieldSlotsComponents {
22
23
  /**
23
24
  * Form control with an input to render the value.
24
25
  * Receives the same props as `@mui/material/TextField`.
@@ -26,6 +27,6 @@ export interface DateFieldSlotsComponent {
26
27
  */
27
28
  TextField?: React.ElementType;
28
29
  }
29
- export interface DateFieldSlotsComponentsProps<TDate> {
30
+ export interface DateFieldSlotsComponentsProps<TDate> extends FieldSlotsComponentsProps {
30
31
  textField?: SlotComponentProps<typeof TextField, {}, DateFieldOwnerState<TDate>>;
31
32
  }
@@ -68,9 +68,10 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
68
68
  componentsProps: PropTypes.object,
69
69
  /**
70
70
  * Formats the day of week displayed in the calendar header.
71
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
71
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
72
+ * @param {TDate} date The date of the day of week provided by the adapter.
72
73
  * @returns {string} The name to display.
73
- * @default (day) => day.charAt(0).toUpperCase()
74
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
74
75
  */
75
76
  dayOfWeekFormatter: PropTypes.func,
76
77
  /**
@@ -270,6 +271,9 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
270
271
  })]),
271
272
  /**
272
273
  * Disable specific date.
274
+ *
275
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
276
+ *
273
277
  * @template TDate
274
278
  * @param {TDate} day The date to test.
275
279
  * @returns {boolean} If `true` the date will be disabled.
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["components", "componentsProps", "slots", "slotProps", "InputProps", "inputProps"],
4
4
  _excluded2 = ["inputRef"],
5
- _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly"];
5
+ _excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
8
8
  import MuiTextField from '@mui/material/TextField';
@@ -10,6 +10,7 @@ import { useThemeProps } from '@mui/material/styles';
10
10
  import { useSlotProps } from '@mui/base/utils';
11
11
  import { refType } from '@mui/utils';
12
12
  import { useDateTimeField } from './useDateTimeField';
13
+ import { useClearableField } from '../hooks';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps, ref) {
15
16
  var _ref, _slots$textField, _slotProps$textField;
@@ -51,13 +52,28 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
51
52
  onPaste,
52
53
  onKeyDown,
53
54
  inputMode,
54
- readOnly
55
+ readOnly,
56
+ clearable,
57
+ onClear
55
58
  } = _useDateTimeField,
56
59
  fieldProps = _objectWithoutPropertiesLoose(_useDateTimeField, _excluded3);
60
+ const {
61
+ InputProps: ProcessedInputProps,
62
+ fieldProps: processedFieldProps
63
+ } = useClearableField({
64
+ onClear,
65
+ clearable,
66
+ fieldProps,
67
+ InputProps: fieldProps.InputProps,
68
+ slots,
69
+ slotProps,
70
+ components,
71
+ componentsProps
72
+ });
57
73
  return /*#__PURE__*/_jsx(TextField, _extends({
58
74
  ref: ref
59
- }, fieldProps, {
60
- InputProps: _extends({}, fieldProps.InputProps, {
75
+ }, processedFieldProps, {
76
+ InputProps: _extends({}, ProcessedInputProps, {
61
77
  readOnly
62
78
  }),
63
79
  inputProps: _extends({}, fieldProps.inputProps, {
@@ -84,6 +100,11 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
84
100
  */
85
101
  autoFocus: PropTypes.bool,
86
102
  className: PropTypes.string,
103
+ /**
104
+ * If `true`, a clear button will be shown in the field allowing value clearing.
105
+ * @default false
106
+ */
107
+ clearable: PropTypes.bool,
87
108
  /**
88
109
  * The color of the component.
89
110
  * It supports both default and custom theme colors, which can be added as shown in the
@@ -240,6 +261,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
240
261
  * @param {FieldChangeHandlerContext<TError>} context The context containing the validation result of the current value.
241
262
  */
242
263
  onChange: PropTypes.func,
264
+ /**
265
+ * Callback fired when the clear button is clicked.
266
+ */
267
+ onClear: PropTypes.func,
243
268
  /**
244
269
  * Callback fired when the error associated to the current value changes.
245
270
  * @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
@@ -294,6 +319,9 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
294
319
  shouldDisableClock: PropTypes.func,
295
320
  /**
296
321
  * Disable specific date.
322
+ *
323
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
324
+ *
297
325
  * @template TDate
298
326
  * @param {TDate} day The date to test.
299
327
  * @returns {boolean} If `true` the date will be disabled.
@@ -7,6 +7,7 @@ import { DefaultizedProps, MakeOptional } from '../internals/models/helpers';
7
7
  import { BaseDateValidationProps, BaseTimeValidationProps, DateTimeValidationProps, DayValidationProps, MonthValidationProps, TimeValidationProps, YearValidationProps } from '../internals/models/validation';
8
8
  import { FieldsTextFieldProps } from '../internals/models/fields';
9
9
  import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
10
+ import { FieldSlotsComponents, FieldSlotsComponentsProps } from '../internals';
10
11
  export interface UseDateTimeFieldParams<TDate, TChildProps extends {}> {
11
12
  props: UseDateTimeFieldComponentProps<TDate, TChildProps>;
12
13
  inputRef?: React.Ref<HTMLInputElement>;
@@ -45,7 +46,7 @@ export interface DateTimeFieldProps<TDate> extends UseDateTimeFieldComponentProp
45
46
  slotProps?: DateTimeFieldSlotsComponentsProps<TDate>;
46
47
  }
47
48
  export type DateTimeFieldOwnerState<TDate> = DateTimeFieldProps<TDate>;
48
- export interface DateTimeFieldSlotsComponent {
49
+ export interface DateTimeFieldSlotsComponent extends FieldSlotsComponents {
49
50
  /**
50
51
  * Form control with an input to render the value.
51
52
  * Receives the same props as `@mui/material/TextField`.
@@ -53,6 +54,6 @@ export interface DateTimeFieldSlotsComponent {
53
54
  */
54
55
  TextField?: React.ElementType;
55
56
  }
56
- export interface DateTimeFieldSlotsComponentsProps<TDate> {
57
+ export interface DateTimeFieldSlotsComponentsProps<TDate> extends FieldSlotsComponentsProps {
57
58
  textField?: SlotComponentProps<typeof TextField, {}, DateTimeFieldOwnerState<TDate>>;
58
59
  }
@@ -78,9 +78,10 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
78
78
  componentsProps: PropTypes.object,
79
79
  /**
80
80
  * Formats the day of week displayed in the calendar header.
81
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
81
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
82
+ * @param {TDate} date The date of the day of week provided by the adapter.
82
83
  * @returns {string} The name to display.
83
- * @default (day) => day.charAt(0).toUpperCase()
84
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
84
85
  */
85
86
  dayOfWeekFormatter: PropTypes.func,
86
87
  /**
@@ -316,6 +317,9 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
316
317
  shouldDisableClock: PropTypes.func,
317
318
  /**
318
319
  * Disable specific date.
320
+ *
321
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
322
+ *
319
323
  * @template TDate
320
324
  * @param {TDate} day The date to test.
321
325
  * @returns {boolean} If `true` the date will be disabled.
@@ -316,6 +316,7 @@ process.env.NODE_ENV !== "production" ? DateTimePickerToolbar.propTypes = {
316
316
  */
317
317
  onViewChange: PropTypes.func.isRequired,
318
318
  readOnly: PropTypes.bool,
319
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
319
320
  titleId: PropTypes.string,
320
321
  /**
321
322
  * Toolbar date format.
@@ -92,9 +92,10 @@ DesktopDatePicker.propTypes = {
92
92
  componentsProps: PropTypes.object,
93
93
  /**
94
94
  * Formats the day of week displayed in the calendar header.
95
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
95
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
96
+ * @param {TDate} date The date of the day of week provided by the adapter.
96
97
  * @returns {string} The name to display.
97
- * @default (day) => day.charAt(0).toUpperCase()
98
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
98
99
  */
99
100
  dayOfWeekFormatter: PropTypes.func,
100
101
  /**
@@ -288,6 +289,9 @@ DesktopDatePicker.propTypes = {
288
289
  })]),
289
290
  /**
290
291
  * Disable specific date.
292
+ *
293
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
294
+ *
291
295
  * @template TDate
292
296
  * @param {TDate} day The date to test.
293
297
  * @returns {boolean} If `true` the date will be disabled.
@@ -138,9 +138,10 @@ DesktopDateTimePicker.propTypes = {
138
138
  componentsProps: PropTypes.object,
139
139
  /**
140
140
  * Formats the day of week displayed in the calendar header.
141
- * @param {string} day The day of week provided by the adapter's method `getWeekdays`.
141
+ * @param {string} day The day of week provided by the adapter. Deprecated, will be removed in v7: Use `date` instead.
142
+ * @param {TDate} date The date of the day of week provided by the adapter.
142
143
  * @returns {string} The name to display.
143
- * @default (day) => day.charAt(0).toUpperCase()
144
+ * @default (_day: string, date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
144
145
  */
145
146
  dayOfWeekFormatter: PropTypes.func,
146
147
  /**
@@ -370,6 +371,9 @@ DesktopDateTimePicker.propTypes = {
370
371
  shouldDisableClock: PropTypes.func,
371
372
  /**
372
373
  * Disable specific date.
374
+ *
375
+ * Warning: This function can be called multiple times (e.g. when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
376
+ *
373
377
  * @template TDate
374
378
  * @param {TDate} day The date to test.
375
379
  * @returns {boolean} If `true` the date will be disabled.