react-day-picker 9.6.7 → 9.7.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 (623) hide show
  1. package/README.md +9 -1
  2. package/dist/cjs/DayPicker.d.ts +4 -2
  3. package/dist/cjs/DayPicker.js +59 -8
  4. package/dist/cjs/DayPicker.js.map +1 -1
  5. package/dist/cjs/UI.d.ts +11 -23
  6. package/dist/cjs/UI.js +6 -8
  7. package/dist/cjs/UI.js.map +1 -1
  8. package/dist/cjs/classes/CalendarDay.d.ts +17 -14
  9. package/dist/cjs/classes/CalendarDay.js +9 -6
  10. package/dist/cjs/classes/CalendarDay.js.map +1 -1
  11. package/dist/cjs/classes/CalendarMonth.d.ts +8 -3
  12. package/dist/cjs/classes/CalendarMonth.js +6 -1
  13. package/dist/cjs/classes/CalendarMonth.js.map +1 -1
  14. package/dist/cjs/classes/CalendarWeek.d.ts +6 -2
  15. package/dist/cjs/classes/CalendarWeek.js +5 -1
  16. package/dist/cjs/classes/CalendarWeek.js.map +1 -1
  17. package/dist/cjs/classes/DateLib.d.ts +53 -52
  18. package/dist/cjs/classes/DateLib.js +26 -22
  19. package/dist/cjs/classes/DateLib.js.map +1 -1
  20. package/dist/cjs/components/Day.d.ts +4 -4
  21. package/dist/cjs/components/Day.js +4 -4
  22. package/dist/cjs/components/DayButton.d.ts +2 -2
  23. package/dist/cjs/components/DayButton.js +1 -1
  24. package/dist/cjs/components/Dropdown.d.ts +4 -6
  25. package/dist/cjs/components/Dropdown.js +1 -1
  26. package/dist/cjs/components/Dropdown.js.map +1 -1
  27. package/dist/cjs/components/DropdownNav.d.ts +1 -1
  28. package/dist/cjs/components/DropdownNav.js +1 -1
  29. package/dist/cjs/components/Footer.d.ts +1 -1
  30. package/dist/cjs/components/Footer.js +1 -1
  31. package/dist/cjs/components/Month.d.ts +3 -3
  32. package/dist/cjs/components/Month.js +1 -1
  33. package/dist/cjs/components/MonthCaption.d.ts +3 -3
  34. package/dist/cjs/components/MonthCaption.js +1 -1
  35. package/dist/cjs/components/MonthGrid.d.ts +1 -1
  36. package/dist/cjs/components/MonthGrid.js +1 -1
  37. package/dist/cjs/components/Months.d.ts +1 -1
  38. package/dist/cjs/components/Months.js +1 -1
  39. package/dist/cjs/components/MonthsDropdown.d.ts +1 -1
  40. package/dist/cjs/components/MonthsDropdown.js +1 -1
  41. package/dist/cjs/components/Nav.d.ts +5 -1
  42. package/dist/cjs/components/Nav.js +1 -1
  43. package/dist/cjs/components/Nav.js.map +1 -1
  44. package/dist/cjs/components/NextMonthButton.d.ts +1 -1
  45. package/dist/cjs/components/NextMonthButton.js +1 -1
  46. package/dist/cjs/components/Option.d.ts +1 -1
  47. package/dist/cjs/components/Option.js +1 -1
  48. package/dist/cjs/components/PreviousMonthButton.d.ts +1 -1
  49. package/dist/cjs/components/PreviousMonthButton.js +1 -1
  50. package/dist/cjs/components/Root.d.ts +2 -2
  51. package/dist/cjs/components/Root.js +1 -1
  52. package/dist/cjs/components/Select.d.ts +1 -1
  53. package/dist/cjs/components/Select.js +1 -1
  54. package/dist/cjs/components/Week.d.ts +2 -1
  55. package/dist/cjs/components/Week.js +1 -1
  56. package/dist/cjs/components/Week.js.map +1 -1
  57. package/dist/cjs/components/WeekNumber.d.ts +2 -2
  58. package/dist/cjs/components/WeekNumber.js +1 -1
  59. package/dist/cjs/components/WeekNumberHeader.d.ts +1 -1
  60. package/dist/cjs/components/WeekNumberHeader.js +1 -1
  61. package/dist/cjs/components/Weekday.d.ts +1 -1
  62. package/dist/cjs/components/Weekday.js +1 -1
  63. package/dist/cjs/components/Weekdays.d.ts +1 -1
  64. package/dist/cjs/components/Weekdays.js +1 -1
  65. package/dist/cjs/components/Weeks.d.ts +1 -1
  66. package/dist/cjs/components/Weeks.js +1 -1
  67. package/dist/cjs/components/YearsDropdown.d.ts +1 -1
  68. package/dist/cjs/components/YearsDropdown.js +1 -1
  69. package/dist/cjs/formatters/formatCaption.d.ts +7 -2
  70. package/dist/cjs/formatters/formatCaption.js +7 -2
  71. package/dist/cjs/formatters/formatCaption.js.map +1 -1
  72. package/dist/cjs/formatters/formatDay.d.ts +7 -2
  73. package/dist/cjs/formatters/formatDay.js +7 -2
  74. package/dist/cjs/formatters/formatDay.js.map +1 -1
  75. package/dist/cjs/formatters/formatMonthDropdown.d.ts +6 -2
  76. package/dist/cjs/formatters/formatMonthDropdown.js +6 -2
  77. package/dist/cjs/formatters/formatMonthDropdown.js.map +1 -1
  78. package/dist/cjs/formatters/formatWeekNumber.d.ts +7 -3
  79. package/dist/cjs/formatters/formatWeekNumber.js +10 -5
  80. package/dist/cjs/formatters/formatWeekNumber.js.map +1 -1
  81. package/dist/cjs/formatters/formatWeekNumberHeader.d.ts +3 -2
  82. package/dist/cjs/formatters/formatWeekNumberHeader.js +3 -2
  83. package/dist/cjs/formatters/formatWeekNumberHeader.js.map +1 -1
  84. package/dist/cjs/formatters/formatWeekdayName.d.ts +7 -2
  85. package/dist/cjs/formatters/formatWeekdayName.js +7 -2
  86. package/dist/cjs/formatters/formatWeekdayName.js.map +1 -1
  87. package/dist/cjs/formatters/formatYearDropdown.d.ts +5 -1
  88. package/dist/cjs/formatters/formatYearDropdown.js +5 -1
  89. package/dist/cjs/formatters/formatYearDropdown.js.map +1 -1
  90. package/dist/cjs/helpers/calculateFocusTarget.d.ts +14 -0
  91. package/dist/cjs/helpers/calculateFocusTarget.js +24 -1
  92. package/dist/cjs/helpers/calculateFocusTarget.js.map +1 -1
  93. package/dist/cjs/helpers/createGetModifiers.d.ts +16 -0
  94. package/dist/cjs/{useGetModifiers.js → helpers/createGetModifiers.js} +13 -7
  95. package/dist/cjs/helpers/createGetModifiers.js.map +1 -0
  96. package/dist/cjs/helpers/endOfBroadcastWeek.d.ts +7 -1
  97. package/dist/cjs/helpers/endOfBroadcastWeek.js +7 -1
  98. package/dist/cjs/helpers/endOfBroadcastWeek.js.map +1 -1
  99. package/dist/cjs/helpers/getBroadcastWeeksInMonth.d.ts +8 -1
  100. package/dist/cjs/helpers/getBroadcastWeeksInMonth.js +8 -1
  101. package/dist/cjs/helpers/getBroadcastWeeksInMonth.js.map +1 -1
  102. package/dist/cjs/helpers/getClassNamesForModifiers.d.ts +12 -0
  103. package/dist/cjs/helpers/getClassNamesForModifiers.js +12 -0
  104. package/dist/cjs/helpers/getClassNamesForModifiers.js.map +1 -1
  105. package/dist/cjs/helpers/getComponents.d.ts +10 -0
  106. package/dist/cjs/helpers/getComponents.js +10 -0
  107. package/dist/cjs/helpers/getComponents.js.map +1 -1
  108. package/dist/cjs/helpers/getDataAttributes.d.ts +9 -1
  109. package/dist/cjs/helpers/getDataAttributes.js +11 -2
  110. package/dist/cjs/helpers/getDataAttributes.js.map +1 -1
  111. package/dist/cjs/helpers/getDates.d.ts +12 -1
  112. package/dist/cjs/helpers/getDates.js +13 -2
  113. package/dist/cjs/helpers/getDates.js.map +1 -1
  114. package/dist/cjs/helpers/getDays.d.ts +4 -0
  115. package/dist/cjs/helpers/getDays.js +4 -1
  116. package/dist/cjs/helpers/getDays.js.map +1 -1
  117. package/dist/cjs/helpers/getDefaultClassNames.d.ts +5 -1
  118. package/dist/cjs/helpers/getDefaultClassNames.js +5 -1
  119. package/dist/cjs/helpers/getDefaultClassNames.js.map +1 -1
  120. package/dist/cjs/helpers/getDisplayMonths.d.ts +10 -0
  121. package/dist/cjs/helpers/getDisplayMonths.js +10 -0
  122. package/dist/cjs/helpers/getDisplayMonths.js.map +1 -1
  123. package/dist/cjs/helpers/getFocusableDate.d.ts +16 -1
  124. package/dist/cjs/helpers/getFocusableDate.js +17 -2
  125. package/dist/cjs/helpers/getFocusableDate.js.map +1 -1
  126. package/dist/cjs/helpers/getFormatters.d.ts +7 -1
  127. package/dist/cjs/helpers/getFormatters.js +7 -1
  128. package/dist/cjs/helpers/getFormatters.js.map +1 -1
  129. package/dist/cjs/helpers/getInitialMonth.d.ts +11 -1
  130. package/dist/cjs/helpers/getInitialMonth.js +14 -7
  131. package/dist/cjs/helpers/getInitialMonth.js.map +1 -1
  132. package/dist/cjs/helpers/getLabels.d.ts +6 -1
  133. package/dist/cjs/helpers/getLabels.js +6 -1
  134. package/dist/cjs/helpers/getLabels.js.map +1 -1
  135. package/dist/cjs/helpers/getMonthOptions.d.ts +15 -1
  136. package/dist/cjs/helpers/getMonthOptions.js +15 -1
  137. package/dist/cjs/helpers/getMonthOptions.js.map +1 -1
  138. package/dist/cjs/helpers/getMonths.d.ts +15 -8
  139. package/dist/cjs/helpers/getMonths.js +16 -9
  140. package/dist/cjs/helpers/getMonths.js.map +1 -1
  141. package/dist/cjs/helpers/getNavMonth.d.ts +7 -1
  142. package/dist/cjs/helpers/getNavMonth.js +7 -1
  143. package/dist/cjs/helpers/getNavMonth.js.map +1 -1
  144. package/dist/cjs/helpers/getNextFocus.d.ts +18 -3
  145. package/dist/cjs/helpers/getNextFocus.js +19 -5
  146. package/dist/cjs/helpers/getNextFocus.js.map +1 -1
  147. package/dist/cjs/helpers/getNextMonth.d.ts +13 -5
  148. package/dist/cjs/helpers/getNextMonth.js +13 -6
  149. package/dist/cjs/helpers/getNextMonth.js.map +1 -1
  150. package/dist/cjs/helpers/getPreviousMonth.d.ts +13 -5
  151. package/dist/cjs/helpers/getPreviousMonth.js +13 -5
  152. package/dist/cjs/helpers/getPreviousMonth.js.map +1 -1
  153. package/dist/cjs/helpers/getStyleForModifiers.d.ts +11 -0
  154. package/dist/cjs/helpers/getStyleForModifiers.js +11 -0
  155. package/dist/cjs/helpers/getStyleForModifiers.js.map +1 -1
  156. package/dist/cjs/helpers/getWeekdays.d.ts +9 -9
  157. package/dist/cjs/helpers/getWeekdays.js +9 -9
  158. package/dist/cjs/helpers/getWeekdays.js.map +1 -1
  159. package/dist/cjs/helpers/getWeeks.d.ts +6 -1
  160. package/dist/cjs/helpers/getWeeks.js +6 -1
  161. package/dist/cjs/helpers/getWeeks.js.map +1 -1
  162. package/dist/cjs/helpers/getYearOptions.d.ts +13 -1
  163. package/dist/cjs/helpers/getYearOptions.js +13 -1
  164. package/dist/cjs/helpers/getYearOptions.js.map +1 -1
  165. package/dist/cjs/helpers/startOfBroadcastWeek.d.ts +8 -1
  166. package/dist/cjs/helpers/startOfBroadcastWeek.js +8 -1
  167. package/dist/cjs/helpers/startOfBroadcastWeek.js.map +1 -1
  168. package/dist/cjs/helpers/useControlledValue.d.ts +10 -6
  169. package/dist/cjs/helpers/useControlledValue.js +10 -6
  170. package/dist/cjs/helpers/useControlledValue.js.map +1 -1
  171. package/dist/cjs/labels/labelDayButton.d.ts +9 -6
  172. package/dist/cjs/labels/labelDayButton.js +9 -6
  173. package/dist/cjs/labels/labelDayButton.js.map +1 -1
  174. package/dist/cjs/labels/labelGrid.d.ts +7 -3
  175. package/dist/cjs/labels/labelGrid.js +7 -3
  176. package/dist/cjs/labels/labelGrid.js.map +1 -1
  177. package/dist/cjs/labels/labelGridcell.d.ts +7 -4
  178. package/dist/cjs/labels/labelGridcell.js +7 -4
  179. package/dist/cjs/labels/labelGridcell.js.map +1 -1
  180. package/dist/cjs/labels/labelMonthDropdown.d.ts +3 -1
  181. package/dist/cjs/labels/labelMonthDropdown.js +3 -1
  182. package/dist/cjs/labels/labelMonthDropdown.js.map +1 -1
  183. package/dist/cjs/labels/labelNav.d.ts +2 -1
  184. package/dist/cjs/labels/labelNav.js +2 -1
  185. package/dist/cjs/labels/labelNav.js.map +1 -1
  186. package/dist/cjs/labels/labelNext.d.ts +5 -4
  187. package/dist/cjs/labels/labelNext.js +5 -4
  188. package/dist/cjs/labels/labelNext.js.map +1 -1
  189. package/dist/cjs/labels/labelPrevious.d.ts +5 -4
  190. package/dist/cjs/labels/labelPrevious.js +5 -4
  191. package/dist/cjs/labels/labelPrevious.js.map +1 -1
  192. package/dist/cjs/labels/labelWeekNumber.d.ts +4 -1
  193. package/dist/cjs/labels/labelWeekNumber.js +4 -1
  194. package/dist/cjs/labels/labelWeekNumber.js.map +1 -1
  195. package/dist/cjs/labels/labelWeekNumberHeader.d.ts +3 -1
  196. package/dist/cjs/labels/labelWeekNumberHeader.js +3 -1
  197. package/dist/cjs/labels/labelWeekNumberHeader.js.map +1 -1
  198. package/dist/cjs/labels/labelWeekday.d.ts +5 -1
  199. package/dist/cjs/labels/labelWeekday.js +5 -1
  200. package/dist/cjs/labels/labelWeekday.js.map +1 -1
  201. package/dist/cjs/labels/labelYearDropdown.d.ts +3 -1
  202. package/dist/cjs/labels/labelYearDropdown.js +3 -1
  203. package/dist/cjs/labels/labelYearDropdown.js.map +1 -1
  204. package/dist/cjs/persian.d.ts +15 -2
  205. package/dist/cjs/persian.js +15 -2
  206. package/dist/cjs/persian.js.map +1 -1
  207. package/dist/cjs/selection/useMulti.d.ts +9 -0
  208. package/dist/cjs/selection/useMulti.js +9 -0
  209. package/dist/cjs/selection/useMulti.js.map +1 -1
  210. package/dist/cjs/selection/useRange.d.ts +9 -0
  211. package/dist/cjs/selection/useRange.js +9 -0
  212. package/dist/cjs/selection/useRange.js.map +1 -1
  213. package/dist/cjs/selection/useSingle.d.ts +9 -0
  214. package/dist/cjs/selection/useSingle.js +9 -0
  215. package/dist/cjs/selection/useSingle.js.map +1 -1
  216. package/dist/cjs/types/deprecated.d.ts +8 -8
  217. package/dist/cjs/types/deprecated.js +1 -1
  218. package/dist/cjs/types/props.d.ts +57 -13
  219. package/dist/cjs/types/selection.d.ts +25 -0
  220. package/dist/cjs/types/shared.d.ts +29 -78
  221. package/dist/cjs/useAnimation.d.ts +11 -1
  222. package/dist/cjs/useAnimation.js +11 -1
  223. package/dist/cjs/useAnimation.js.map +1 -1
  224. package/dist/cjs/useCalendar.d.ts +9 -1
  225. package/dist/cjs/useCalendar.js +9 -1
  226. package/dist/cjs/useCalendar.js.map +1 -1
  227. package/dist/cjs/useDayPicker.d.ts +4 -6
  228. package/dist/cjs/useDayPicker.js +4 -6
  229. package/dist/cjs/useDayPicker.js.map +1 -1
  230. package/dist/cjs/useFocus.d.ts +14 -1
  231. package/dist/cjs/useFocus.js +14 -1
  232. package/dist/cjs/useFocus.js.map +1 -1
  233. package/dist/cjs/useSelection.d.ts +10 -0
  234. package/dist/cjs/useSelection.js +10 -0
  235. package/dist/cjs/useSelection.js.map +1 -1
  236. package/dist/cjs/utc.d.ts +6 -0
  237. package/dist/cjs/utc.js +6 -0
  238. package/dist/cjs/utc.js.map +1 -1
  239. package/dist/cjs/utils/addToRange.d.ts +10 -11
  240. package/dist/cjs/utils/addToRange.js +10 -11
  241. package/dist/cjs/utils/addToRange.js.map +1 -1
  242. package/dist/cjs/utils/dateMatchModifiers.d.ts +5 -15
  243. package/dist/cjs/utils/dateMatchModifiers.js +5 -15
  244. package/dist/cjs/utils/dateMatchModifiers.js.map +1 -1
  245. package/dist/cjs/utils/rangeContainsDayOfWeek.d.ts +7 -9
  246. package/dist/cjs/utils/rangeContainsDayOfWeek.js +7 -9
  247. package/dist/cjs/utils/rangeContainsDayOfWeek.js.map +1 -1
  248. package/dist/cjs/utils/rangeContainsModifiers.d.ts +5 -14
  249. package/dist/cjs/utils/rangeContainsModifiers.js +5 -14
  250. package/dist/cjs/utils/rangeContainsModifiers.js.map +1 -1
  251. package/dist/cjs/utils/rangeIncludesDate.d.ts +7 -4
  252. package/dist/cjs/utils/rangeIncludesDate.js +7 -4
  253. package/dist/cjs/utils/rangeIncludesDate.js.map +1 -1
  254. package/dist/cjs/utils/rangeOverlaps.d.ts +5 -1
  255. package/dist/cjs/utils/rangeOverlaps.js +5 -1
  256. package/dist/cjs/utils/rangeOverlaps.js.map +1 -1
  257. package/dist/cjs/utils/typeguards.d.ts +19 -6
  258. package/dist/cjs/utils/typeguards.js +19 -6
  259. package/dist/cjs/utils/typeguards.js.map +1 -1
  260. package/dist/esm/DayPicker.d.ts +4 -2
  261. package/dist/esm/DayPicker.js +59 -8
  262. package/dist/esm/DayPicker.js.map +1 -1
  263. package/dist/esm/UI.d.ts +11 -23
  264. package/dist/esm/UI.js +6 -8
  265. package/dist/esm/UI.js.map +1 -1
  266. package/dist/esm/classes/CalendarDay.d.ts +17 -14
  267. package/dist/esm/classes/CalendarDay.js +9 -6
  268. package/dist/esm/classes/CalendarDay.js.map +1 -1
  269. package/dist/esm/classes/CalendarMonth.d.ts +8 -3
  270. package/dist/esm/classes/CalendarMonth.js +6 -1
  271. package/dist/esm/classes/CalendarMonth.js.map +1 -1
  272. package/dist/esm/classes/CalendarWeek.d.ts +6 -2
  273. package/dist/esm/classes/CalendarWeek.js +5 -1
  274. package/dist/esm/classes/CalendarWeek.js.map +1 -1
  275. package/dist/esm/classes/DateLib.d.ts +53 -52
  276. package/dist/esm/classes/DateLib.js +26 -22
  277. package/dist/esm/classes/DateLib.js.map +1 -1
  278. package/dist/esm/components/Day.d.ts +4 -4
  279. package/dist/esm/components/Day.js +4 -4
  280. package/dist/esm/components/DayButton.d.ts +2 -2
  281. package/dist/esm/components/DayButton.js +1 -1
  282. package/dist/esm/components/Dropdown.d.ts +4 -6
  283. package/dist/esm/components/Dropdown.js +1 -1
  284. package/dist/esm/components/Dropdown.js.map +1 -1
  285. package/dist/esm/components/DropdownNav.d.ts +1 -1
  286. package/dist/esm/components/DropdownNav.js +1 -1
  287. package/dist/esm/components/Footer.d.ts +1 -1
  288. package/dist/esm/components/Footer.js +1 -1
  289. package/dist/esm/components/Month.d.ts +3 -3
  290. package/dist/esm/components/Month.js +1 -1
  291. package/dist/esm/components/MonthCaption.d.ts +3 -3
  292. package/dist/esm/components/MonthCaption.js +1 -1
  293. package/dist/esm/components/MonthGrid.d.ts +1 -1
  294. package/dist/esm/components/MonthGrid.js +1 -1
  295. package/dist/esm/components/Months.d.ts +1 -1
  296. package/dist/esm/components/Months.js +1 -1
  297. package/dist/esm/components/MonthsDropdown.d.ts +1 -1
  298. package/dist/esm/components/MonthsDropdown.js +1 -1
  299. package/dist/esm/components/Nav.d.ts +5 -1
  300. package/dist/esm/components/Nav.js +1 -1
  301. package/dist/esm/components/Nav.js.map +1 -1
  302. package/dist/esm/components/NextMonthButton.d.ts +1 -1
  303. package/dist/esm/components/NextMonthButton.js +1 -1
  304. package/dist/esm/components/Option.d.ts +1 -1
  305. package/dist/esm/components/Option.js +1 -1
  306. package/dist/esm/components/PreviousMonthButton.d.ts +1 -1
  307. package/dist/esm/components/PreviousMonthButton.js +1 -1
  308. package/dist/esm/components/Root.d.ts +2 -2
  309. package/dist/esm/components/Root.js +1 -1
  310. package/dist/esm/components/Select.d.ts +1 -1
  311. package/dist/esm/components/Select.js +1 -1
  312. package/dist/esm/components/Week.d.ts +2 -1
  313. package/dist/esm/components/Week.js +1 -1
  314. package/dist/esm/components/Week.js.map +1 -1
  315. package/dist/esm/components/WeekNumber.d.ts +2 -2
  316. package/dist/esm/components/WeekNumber.js +1 -1
  317. package/dist/esm/components/WeekNumberHeader.d.ts +1 -1
  318. package/dist/esm/components/WeekNumberHeader.js +1 -1
  319. package/dist/esm/components/Weekday.d.ts +1 -1
  320. package/dist/esm/components/Weekday.js +1 -1
  321. package/dist/esm/components/Weekdays.d.ts +1 -1
  322. package/dist/esm/components/Weekdays.js +1 -1
  323. package/dist/esm/components/Weeks.d.ts +1 -1
  324. package/dist/esm/components/Weeks.js +1 -1
  325. package/dist/esm/components/YearsDropdown.d.ts +1 -1
  326. package/dist/esm/components/YearsDropdown.js +1 -1
  327. package/dist/esm/formatters/formatCaption.d.ts +7 -2
  328. package/dist/esm/formatters/formatCaption.js +7 -2
  329. package/dist/esm/formatters/formatCaption.js.map +1 -1
  330. package/dist/esm/formatters/formatDay.d.ts +7 -2
  331. package/dist/esm/formatters/formatDay.js +7 -2
  332. package/dist/esm/formatters/formatDay.js.map +1 -1
  333. package/dist/esm/formatters/formatMonthDropdown.d.ts +6 -2
  334. package/dist/esm/formatters/formatMonthDropdown.js +6 -2
  335. package/dist/esm/formatters/formatMonthDropdown.js.map +1 -1
  336. package/dist/esm/formatters/formatWeekNumber.d.ts +7 -3
  337. package/dist/esm/formatters/formatWeekNumber.js +10 -5
  338. package/dist/esm/formatters/formatWeekNumber.js.map +1 -1
  339. package/dist/esm/formatters/formatWeekNumberHeader.d.ts +3 -2
  340. package/dist/esm/formatters/formatWeekNumberHeader.js +3 -2
  341. package/dist/esm/formatters/formatWeekNumberHeader.js.map +1 -1
  342. package/dist/esm/formatters/formatWeekdayName.d.ts +7 -2
  343. package/dist/esm/formatters/formatWeekdayName.js +7 -2
  344. package/dist/esm/formatters/formatWeekdayName.js.map +1 -1
  345. package/dist/esm/formatters/formatYearDropdown.d.ts +5 -1
  346. package/dist/esm/formatters/formatYearDropdown.js +5 -1
  347. package/dist/esm/formatters/formatYearDropdown.js.map +1 -1
  348. package/dist/esm/helpers/calculateFocusTarget.d.ts +14 -0
  349. package/dist/esm/helpers/calculateFocusTarget.js +24 -1
  350. package/dist/esm/helpers/calculateFocusTarget.js.map +1 -1
  351. package/dist/esm/helpers/createGetModifiers.d.ts +16 -0
  352. package/dist/esm/{useGetModifiers.js → helpers/createGetModifiers.js} +12 -6
  353. package/dist/esm/helpers/createGetModifiers.js.map +1 -0
  354. package/dist/esm/helpers/endOfBroadcastWeek.d.ts +7 -1
  355. package/dist/esm/helpers/endOfBroadcastWeek.js +7 -1
  356. package/dist/esm/helpers/endOfBroadcastWeek.js.map +1 -1
  357. package/dist/esm/helpers/getBroadcastWeeksInMonth.d.ts +8 -1
  358. package/dist/esm/helpers/getBroadcastWeeksInMonth.js +8 -1
  359. package/dist/esm/helpers/getBroadcastWeeksInMonth.js.map +1 -1
  360. package/dist/esm/helpers/getClassNamesForModifiers.d.ts +12 -0
  361. package/dist/esm/helpers/getClassNamesForModifiers.js +12 -0
  362. package/dist/esm/helpers/getClassNamesForModifiers.js.map +1 -1
  363. package/dist/esm/helpers/getComponents.d.ts +10 -0
  364. package/dist/esm/helpers/getComponents.js +10 -0
  365. package/dist/esm/helpers/getComponents.js.map +1 -1
  366. package/dist/esm/helpers/getDataAttributes.d.ts +9 -1
  367. package/dist/esm/helpers/getDataAttributes.js +11 -2
  368. package/dist/esm/helpers/getDataAttributes.js.map +1 -1
  369. package/dist/esm/helpers/getDates.d.ts +12 -1
  370. package/dist/esm/helpers/getDates.js +13 -2
  371. package/dist/esm/helpers/getDates.js.map +1 -1
  372. package/dist/esm/helpers/getDays.d.ts +4 -0
  373. package/dist/esm/helpers/getDays.js +4 -1
  374. package/dist/esm/helpers/getDays.js.map +1 -1
  375. package/dist/esm/helpers/getDefaultClassNames.d.ts +5 -1
  376. package/dist/esm/helpers/getDefaultClassNames.js +5 -1
  377. package/dist/esm/helpers/getDefaultClassNames.js.map +1 -1
  378. package/dist/esm/helpers/getDisplayMonths.d.ts +10 -0
  379. package/dist/esm/helpers/getDisplayMonths.js +10 -0
  380. package/dist/esm/helpers/getDisplayMonths.js.map +1 -1
  381. package/dist/esm/helpers/getFocusableDate.d.ts +16 -1
  382. package/dist/esm/helpers/getFocusableDate.js +17 -2
  383. package/dist/esm/helpers/getFocusableDate.js.map +1 -1
  384. package/dist/esm/helpers/getFormatters.d.ts +7 -1
  385. package/dist/esm/helpers/getFormatters.js +7 -1
  386. package/dist/esm/helpers/getFormatters.js.map +1 -1
  387. package/dist/esm/helpers/getInitialMonth.d.ts +11 -1
  388. package/dist/esm/helpers/getInitialMonth.js +14 -7
  389. package/dist/esm/helpers/getInitialMonth.js.map +1 -1
  390. package/dist/esm/helpers/getLabels.d.ts +6 -1
  391. package/dist/esm/helpers/getLabels.js +6 -1
  392. package/dist/esm/helpers/getLabels.js.map +1 -1
  393. package/dist/esm/helpers/getMonthOptions.d.ts +15 -1
  394. package/dist/esm/helpers/getMonthOptions.js +15 -1
  395. package/dist/esm/helpers/getMonthOptions.js.map +1 -1
  396. package/dist/esm/helpers/getMonths.d.ts +15 -8
  397. package/dist/esm/helpers/getMonths.js +16 -9
  398. package/dist/esm/helpers/getMonths.js.map +1 -1
  399. package/dist/esm/helpers/getNavMonth.d.ts +7 -1
  400. package/dist/esm/helpers/getNavMonth.js +7 -1
  401. package/dist/esm/helpers/getNavMonth.js.map +1 -1
  402. package/dist/esm/helpers/getNextFocus.d.ts +18 -3
  403. package/dist/esm/helpers/getNextFocus.js +19 -5
  404. package/dist/esm/helpers/getNextFocus.js.map +1 -1
  405. package/dist/esm/helpers/getNextMonth.d.ts +13 -5
  406. package/dist/esm/helpers/getNextMonth.js +13 -6
  407. package/dist/esm/helpers/getNextMonth.js.map +1 -1
  408. package/dist/esm/helpers/getPreviousMonth.d.ts +13 -5
  409. package/dist/esm/helpers/getPreviousMonth.js +13 -5
  410. package/dist/esm/helpers/getPreviousMonth.js.map +1 -1
  411. package/dist/esm/helpers/getStyleForModifiers.d.ts +11 -0
  412. package/dist/esm/helpers/getStyleForModifiers.js +11 -0
  413. package/dist/esm/helpers/getStyleForModifiers.js.map +1 -1
  414. package/dist/esm/helpers/getWeekdays.d.ts +9 -9
  415. package/dist/esm/helpers/getWeekdays.js +9 -9
  416. package/dist/esm/helpers/getWeekdays.js.map +1 -1
  417. package/dist/esm/helpers/getWeeks.d.ts +6 -1
  418. package/dist/esm/helpers/getWeeks.js +6 -1
  419. package/dist/esm/helpers/getWeeks.js.map +1 -1
  420. package/dist/esm/helpers/getYearOptions.d.ts +13 -1
  421. package/dist/esm/helpers/getYearOptions.js +13 -1
  422. package/dist/esm/helpers/getYearOptions.js.map +1 -1
  423. package/dist/esm/helpers/startOfBroadcastWeek.d.ts +8 -1
  424. package/dist/esm/helpers/startOfBroadcastWeek.js +8 -1
  425. package/dist/esm/helpers/startOfBroadcastWeek.js.map +1 -1
  426. package/dist/esm/helpers/useControlledValue.d.ts +10 -6
  427. package/dist/esm/helpers/useControlledValue.js +10 -6
  428. package/dist/esm/helpers/useControlledValue.js.map +1 -1
  429. package/dist/esm/labels/labelDayButton.d.ts +9 -6
  430. package/dist/esm/labels/labelDayButton.js +9 -6
  431. package/dist/esm/labels/labelDayButton.js.map +1 -1
  432. package/dist/esm/labels/labelGrid.d.ts +7 -3
  433. package/dist/esm/labels/labelGrid.js +7 -3
  434. package/dist/esm/labels/labelGrid.js.map +1 -1
  435. package/dist/esm/labels/labelGridcell.d.ts +7 -4
  436. package/dist/esm/labels/labelGridcell.js +7 -4
  437. package/dist/esm/labels/labelGridcell.js.map +1 -1
  438. package/dist/esm/labels/labelMonthDropdown.d.ts +3 -1
  439. package/dist/esm/labels/labelMonthDropdown.js +3 -1
  440. package/dist/esm/labels/labelMonthDropdown.js.map +1 -1
  441. package/dist/esm/labels/labelNav.d.ts +2 -1
  442. package/dist/esm/labels/labelNav.js +2 -1
  443. package/dist/esm/labels/labelNav.js.map +1 -1
  444. package/dist/esm/labels/labelNext.d.ts +5 -4
  445. package/dist/esm/labels/labelNext.js +5 -4
  446. package/dist/esm/labels/labelNext.js.map +1 -1
  447. package/dist/esm/labels/labelPrevious.d.ts +5 -4
  448. package/dist/esm/labels/labelPrevious.js +5 -4
  449. package/dist/esm/labels/labelPrevious.js.map +1 -1
  450. package/dist/esm/labels/labelWeekNumber.d.ts +4 -1
  451. package/dist/esm/labels/labelWeekNumber.js +4 -1
  452. package/dist/esm/labels/labelWeekNumber.js.map +1 -1
  453. package/dist/esm/labels/labelWeekNumberHeader.d.ts +3 -1
  454. package/dist/esm/labels/labelWeekNumberHeader.js +3 -1
  455. package/dist/esm/labels/labelWeekNumberHeader.js.map +1 -1
  456. package/dist/esm/labels/labelWeekday.d.ts +5 -1
  457. package/dist/esm/labels/labelWeekday.js +5 -1
  458. package/dist/esm/labels/labelWeekday.js.map +1 -1
  459. package/dist/esm/labels/labelYearDropdown.d.ts +3 -1
  460. package/dist/esm/labels/labelYearDropdown.js +3 -1
  461. package/dist/esm/labels/labelYearDropdown.js.map +1 -1
  462. package/dist/esm/persian.d.ts +15 -2
  463. package/dist/esm/persian.js +15 -2
  464. package/dist/esm/persian.js.map +1 -1
  465. package/dist/esm/selection/useMulti.d.ts +9 -0
  466. package/dist/esm/selection/useMulti.js +9 -0
  467. package/dist/esm/selection/useMulti.js.map +1 -1
  468. package/dist/esm/selection/useRange.d.ts +9 -0
  469. package/dist/esm/selection/useRange.js +9 -0
  470. package/dist/esm/selection/useRange.js.map +1 -1
  471. package/dist/esm/selection/useSingle.d.ts +9 -0
  472. package/dist/esm/selection/useSingle.js +9 -0
  473. package/dist/esm/selection/useSingle.js.map +1 -1
  474. package/dist/esm/types/deprecated.d.ts +8 -8
  475. package/dist/esm/types/deprecated.js +1 -1
  476. package/dist/esm/types/props.d.ts +57 -13
  477. package/dist/esm/types/selection.d.ts +25 -0
  478. package/dist/esm/types/shared.d.ts +29 -78
  479. package/dist/esm/useAnimation.d.ts +11 -1
  480. package/dist/esm/useAnimation.js +11 -1
  481. package/dist/esm/useAnimation.js.map +1 -1
  482. package/dist/esm/useCalendar.d.ts +9 -1
  483. package/dist/esm/useCalendar.js +9 -1
  484. package/dist/esm/useCalendar.js.map +1 -1
  485. package/dist/esm/useDayPicker.d.ts +4 -6
  486. package/dist/esm/useDayPicker.js +4 -6
  487. package/dist/esm/useDayPicker.js.map +1 -1
  488. package/dist/esm/useFocus.d.ts +14 -1
  489. package/dist/esm/useFocus.js +14 -1
  490. package/dist/esm/useFocus.js.map +1 -1
  491. package/dist/esm/useSelection.d.ts +10 -0
  492. package/dist/esm/useSelection.js +10 -0
  493. package/dist/esm/useSelection.js.map +1 -1
  494. package/dist/esm/utc.d.ts +6 -0
  495. package/dist/esm/utc.js +6 -0
  496. package/dist/esm/utc.js.map +1 -1
  497. package/dist/esm/utils/addToRange.d.ts +10 -11
  498. package/dist/esm/utils/addToRange.js +10 -11
  499. package/dist/esm/utils/addToRange.js.map +1 -1
  500. package/dist/esm/utils/dateMatchModifiers.d.ts +5 -15
  501. package/dist/esm/utils/dateMatchModifiers.js +5 -15
  502. package/dist/esm/utils/dateMatchModifiers.js.map +1 -1
  503. package/dist/esm/utils/rangeContainsDayOfWeek.d.ts +7 -9
  504. package/dist/esm/utils/rangeContainsDayOfWeek.js +7 -9
  505. package/dist/esm/utils/rangeContainsDayOfWeek.js.map +1 -1
  506. package/dist/esm/utils/rangeContainsModifiers.d.ts +5 -14
  507. package/dist/esm/utils/rangeContainsModifiers.js +5 -14
  508. package/dist/esm/utils/rangeContainsModifiers.js.map +1 -1
  509. package/dist/esm/utils/rangeIncludesDate.d.ts +7 -4
  510. package/dist/esm/utils/rangeIncludesDate.js +7 -4
  511. package/dist/esm/utils/rangeIncludesDate.js.map +1 -1
  512. package/dist/esm/utils/rangeOverlaps.d.ts +5 -1
  513. package/dist/esm/utils/rangeOverlaps.js +5 -1
  514. package/dist/esm/utils/rangeOverlaps.js.map +1 -1
  515. package/dist/esm/utils/typeguards.d.ts +19 -6
  516. package/dist/esm/utils/typeguards.js +19 -6
  517. package/dist/esm/utils/typeguards.js.map +1 -1
  518. package/package.json +1 -1
  519. package/src/DayPicker.test.tsx +34 -0
  520. package/src/DayPicker.tsx +105 -6
  521. package/src/UI.ts +11 -23
  522. package/src/classes/CalendarDay.ts +17 -14
  523. package/src/classes/CalendarMonth.ts +8 -3
  524. package/src/classes/CalendarWeek.ts +8 -2
  525. package/src/classes/DateLib.ts +65 -76
  526. package/src/components/Day.tsx +4 -4
  527. package/src/components/DayButton.tsx +2 -2
  528. package/src/components/Dropdown.tsx +4 -6
  529. package/src/components/DropdownNav.tsx +1 -1
  530. package/src/components/Footer.tsx +1 -1
  531. package/src/components/Month.tsx +3 -3
  532. package/src/components/MonthCaption.tsx +3 -3
  533. package/src/components/MonthGrid.tsx +1 -1
  534. package/src/components/Months.tsx +1 -1
  535. package/src/components/MonthsDropdown.tsx +1 -1
  536. package/src/components/Nav.tsx +5 -1
  537. package/src/components/NextMonthButton.tsx +1 -1
  538. package/src/components/Option.tsx +1 -1
  539. package/src/components/PreviousMonthButton.tsx +1 -1
  540. package/src/components/Root.tsx +2 -2
  541. package/src/components/Select.tsx +1 -1
  542. package/src/components/Week.tsx +2 -1
  543. package/src/components/WeekNumber.tsx +2 -2
  544. package/src/components/WeekNumberHeader.tsx +1 -1
  545. package/src/components/Weekday.tsx +1 -1
  546. package/src/components/Weekdays.tsx +1 -1
  547. package/src/components/Weeks.tsx +1 -1
  548. package/src/components/YearsDropdown.tsx +1 -1
  549. package/src/formatters/formatCaption.ts +7 -2
  550. package/src/formatters/formatDay.ts +7 -2
  551. package/src/formatters/formatMonthDropdown.ts +6 -2
  552. package/src/formatters/formatWeekNumber.test.ts +11 -0
  553. package/src/formatters/formatWeekNumber.ts +11 -5
  554. package/src/formatters/formatWeekNumberHeader.ts +3 -2
  555. package/src/formatters/formatWeekdayName.ts +7 -2
  556. package/src/formatters/formatYearDropdown.ts +5 -1
  557. package/src/helpers/calculateFocusTarget.ts +25 -2
  558. package/src/{useGetModifiers.test.tsx → helpers/createGetModifiers.test.ts} +7 -8
  559. package/src/{useGetModifiers.tsx → helpers/createGetModifiers.ts} +13 -7
  560. package/src/helpers/endOfBroadcastWeek.ts +7 -1
  561. package/src/helpers/getBroadcastWeeksInMonth.ts +8 -1
  562. package/src/helpers/getClassNamesForModifiers.ts +13 -1
  563. package/src/helpers/getComponents.ts +10 -0
  564. package/src/helpers/getDataAttributes.tsx +11 -2
  565. package/src/helpers/getDates.ts +13 -2
  566. package/src/helpers/getDays.ts +4 -1
  567. package/src/helpers/getDefaultClassNames.ts +5 -1
  568. package/src/helpers/getDisplayMonths.ts +11 -1
  569. package/src/helpers/getFocusableDate.ts +17 -2
  570. package/src/helpers/getFormatters.ts +7 -1
  571. package/src/helpers/getInitialMonth.ts +14 -9
  572. package/src/helpers/getLabels.ts +6 -1
  573. package/src/helpers/getMonthOptions.ts +15 -1
  574. package/src/helpers/getMonths.ts +16 -5
  575. package/src/helpers/getNavMonth.ts +7 -1
  576. package/src/helpers/getNextFocus.tsx +18 -2
  577. package/src/helpers/getNextMonth.ts +13 -6
  578. package/src/helpers/getPreviousMonth.ts +13 -5
  579. package/src/helpers/getStyleForModifiers.ts +12 -1
  580. package/src/helpers/getWeekdays.ts +8 -5
  581. package/src/helpers/getWeeks.ts +6 -1
  582. package/src/helpers/getYearOptions.ts +13 -1
  583. package/src/helpers/startOfBroadcastWeek.ts +8 -1
  584. package/src/helpers/useControlledValue.ts +10 -6
  585. package/src/labels/labelDayButton.ts +8 -4
  586. package/src/labels/labelGrid.ts +7 -3
  587. package/src/labels/labelGridcell.ts +6 -2
  588. package/src/labels/labelMonthDropdown.ts +3 -1
  589. package/src/labels/labelNav.ts +2 -1
  590. package/src/labels/labelNext.ts +5 -5
  591. package/src/labels/labelPrevious.ts +5 -5
  592. package/src/labels/labelWeekNumber.ts +4 -1
  593. package/src/labels/labelWeekNumberHeader.ts +3 -1
  594. package/src/labels/labelWeekday.ts +5 -1
  595. package/src/labels/labelYearDropdown.ts +3 -1
  596. package/src/persian.tsx +15 -2
  597. package/src/selection/useMulti.tsx +9 -0
  598. package/src/selection/useRange.tsx +9 -0
  599. package/src/selection/useSingle.tsx +9 -0
  600. package/src/style.css +29 -0
  601. package/src/style.module.css +29 -0
  602. package/src/types/deprecated.ts +8 -8
  603. package/src/types/props.ts +58 -13
  604. package/src/types/selection.ts +25 -0
  605. package/src/types/shared.ts +29 -78
  606. package/src/useAnimation.ts +11 -1
  607. package/src/useCalendar.ts +9 -1
  608. package/src/useDayPicker.ts +4 -6
  609. package/src/useFocus.ts +14 -1
  610. package/src/useSelection.ts +10 -0
  611. package/src/utc.tsx +6 -0
  612. package/src/utils/addToRange.ts +9 -7
  613. package/src/utils/dateMatchModifiers.ts +5 -15
  614. package/src/utils/rangeContainsDayOfWeek.ts +7 -9
  615. package/src/utils/rangeContainsModifiers.ts +5 -14
  616. package/src/utils/rangeIncludesDate.ts +6 -2
  617. package/src/utils/rangeOverlaps.ts +5 -1
  618. package/src/utils/typeguards.ts +19 -6
  619. package/dist/cjs/useGetModifiers.d.ts +0 -10
  620. package/dist/cjs/useGetModifiers.js.map +0 -1
  621. package/dist/esm/useGetModifiers.d.ts +0 -10
  622. package/dist/esm/useGetModifiers.js.map +0 -1
  623. /package/src/helpers/{getPossibleFocusDate.test.ts → getFocusableDate.test.ts} +0 -0
@@ -1,7 +1,12 @@
1
1
  import * as defaultLabels from "../labels/index.js";
2
2
  import type { DayPickerProps, Labels } from "../types/index.js";
3
3
 
4
- /** Return the formatters from the props merged with the default formatters. */
4
+ /**
5
+ * Merges custom labels from the props with the default labels.
6
+ *
7
+ * @param customLabels The custom labels provided in the DayPicker props.
8
+ * @returns The merged labels object.
9
+ */
5
10
  export function getLabels(customLabels: DayPickerProps["labels"]): Labels {
6
11
  return {
7
12
  ...defaultLabels,
@@ -2,7 +2,21 @@ import { type DateLib } from "../classes/DateLib.js";
2
2
  import { DropdownOption } from "../components/Dropdown.js";
3
3
  import type { Formatters } from "../types/index.js";
4
4
 
5
- /** Return the months to show in the dropdown. */
5
+ /**
6
+ * Returns the months to show in the dropdown.
7
+ *
8
+ * This function generates a list of months for the current year, formatted
9
+ * using the provided formatter, and determines whether each month should be
10
+ * disabled based on the navigation range.
11
+ *
12
+ * @param displayMonth The currently displayed month.
13
+ * @param navStart The start date for navigation.
14
+ * @param navEnd The end date for navigation.
15
+ * @param formatters The formatters to use for formatting the month labels.
16
+ * @param dateLib The date library to use for date manipulation.
17
+ * @returns An array of dropdown options representing the months, or `undefined`
18
+ * if no months are available.
19
+ */
6
20
  export function getMonthOptions(
7
21
  displayMonth: Date,
8
22
  navStart: Date | undefined,
@@ -2,13 +2,23 @@ import type { DateLib } from "../classes/DateLib.js";
2
2
  import { CalendarWeek, CalendarDay, CalendarMonth } from "../classes/index.js";
3
3
  import type { DayPickerProps } from "../types/index.js";
4
4
 
5
- /** Return the months to display in the calendar. */
5
+ /**
6
+ * Returns the months to display in the calendar.
7
+ *
8
+ * This function generates `CalendarMonth` objects for each month to be
9
+ * displayed, including their weeks and days, based on the provided display
10
+ * months and dates.
11
+ *
12
+ * @param displayMonths The months (as dates) to display in the calendar.
13
+ * @param dates The dates to display in the calendar.
14
+ * @param props Options from the DayPicker props context.
15
+ * @param dateLib The date library to use for date manipulation.
16
+ * @returns An array of `CalendarMonth` objects representing the months to
17
+ * display.
18
+ */
6
19
  export function getMonths(
7
- /** The months (as dates) to display in the calendar. */
8
20
  displayMonths: Date[],
9
- /** The dates to display in the calendar. */
10
21
  dates: Date[],
11
- /** Options from the props context. */
12
22
  props: Pick<
13
23
  DayPickerProps,
14
24
  "broadcastCalendar" | "fixedWeeks" | "ISOWeek" | "reverseMonths"
@@ -27,6 +37,7 @@ export function getMonths(
27
37
  startOfISOWeek,
28
38
  startOfWeek
29
39
  } = dateLib;
40
+
30
41
  const dayPickerMonths = displayMonths.reduce<CalendarMonth[]>(
31
42
  (months, month) => {
32
43
  const firstDateOfFirstWeek = props.broadcastCalendar
@@ -36,7 +47,7 @@ export function getMonths(
36
47
  : startOfWeek(month);
37
48
 
38
49
  const lastDateOfLastWeek = props.broadcastCalendar
39
- ? endOfBroadcastWeek(month, dateLib)
50
+ ? endOfBroadcastWeek(month)
40
51
  : props.ISOWeek
41
52
  ? endOfISOWeek(endOfMonth(month))
42
53
  : endOfWeek(endOfMonth(month));
@@ -1,7 +1,13 @@
1
1
  import { type DateLib } from "../classes/DateLib.js";
2
2
  import type { DayPickerProps } from "../types/index.js";
3
3
 
4
- /** Return the start and end months for the calendar navigation. */
4
+ /**
5
+ * Returns the start and end months for calendar navigation.
6
+ *
7
+ * @param props The DayPicker props, including navigation and layout options.
8
+ * @param dateLib The date library to use for date manipulation.
9
+ * @returns A tuple containing the start and end months for navigation.
10
+ */
5
11
  export function getNavMonths(
6
12
  props: Pick<
7
13
  DayPickerProps,
@@ -9,10 +9,26 @@ import { dateMatchModifiers } from "../utils/dateMatchModifiers.js";
9
9
 
10
10
  import { getFocusableDate } from "./getFocusableDate.js";
11
11
 
12
+ /**
13
+ * Determines the next focusable day in the calendar.
14
+ *
15
+ * This function recursively calculates the next focusable day based on the
16
+ * movement direction and modifiers applied to the days.
17
+ *
18
+ * @param moveBy The unit of movement (e.g., "day", "week").
19
+ * @param moveDir The direction of movement ("before" or "after").
20
+ * @param refDay The currently focused day.
21
+ * @param calendarStartMonth The earliest month the user can navigate to.
22
+ * @param calendarEndMonth The latest month the user can navigate to.
23
+ * @param props The DayPicker props, including modifiers and configuration
24
+ * options.
25
+ * @param dateLib The date library to use for date manipulation.
26
+ * @param attempt The current recursion attempt (used to limit recursion depth).
27
+ * @returns The next focusable day, or `undefined` if no focusable day is found.
28
+ */
12
29
  export function getNextFocus(
13
30
  moveBy: MoveFocusBy,
14
31
  moveDir: MoveFocusDir,
15
- /** The date that is currently focused. */
16
32
  refDay: CalendarDay,
17
33
  calendarStartMonth: Date | undefined,
18
34
  calendarEndMonth: Date | undefined,
@@ -31,7 +47,7 @@ export function getNextFocus(
31
47
  const focusableDate = getFocusableDate(
32
48
  moveBy,
33
49
  moveDir,
34
- refDay.date, // should be refDay? or refDay.date?
50
+ refDay.date,
35
51
  calendarStartMonth,
36
52
  calendarEndMonth,
37
53
  props,
@@ -2,13 +2,21 @@ import type { DateLib } from "../classes/DateLib.js";
2
2
  import type { DayPickerProps } from "../types/index.js";
3
3
 
4
4
  /**
5
- * Return the next month the user can navigate to according to the given
6
- * options.
5
+ * Returns the next month the user can navigate to, based on the given options.
7
6
  *
8
- * Please note that the next month is not always the next calendar month:
7
+ * The next month is not always the next calendar month:
9
8
  *
10
- * - If after the `calendarEndMonth` range, is `undefined`;
11
- * - If the navigation is paged , is the number of months displayed ahead.
9
+ * - If it is after the `calendarEndMonth`, it returns `undefined`.
10
+ * - If paged navigation is enabled, it skips forward by the number of displayed
11
+ * months.
12
+ *
13
+ * @param firstDisplayedMonth The first month currently displayed in the
14
+ * calendar.
15
+ * @param calendarEndMonth The latest month the user can navigate to.
16
+ * @param options Navigation options, including `numberOfMonths` and
17
+ * `pagedNavigation`.
18
+ * @param dateLib The date library to use for date manipulation.
19
+ * @returns The next month, or `undefined` if navigation is not possible.
12
20
  */
13
21
  export function getNextMonth(
14
22
  firstDisplayedMonth: Date,
@@ -40,6 +48,5 @@ export function getNextMonth(
40
48
  return undefined;
41
49
  }
42
50
 
43
- // Jump forward as the number of months when paged navigation
44
51
  return addMonths(month, offset);
45
52
  }
@@ -2,14 +2,22 @@ import type { DateLib } from "../classes/DateLib.js";
2
2
  import type { DayPickerProps } from "../types/index.js";
3
3
 
4
4
  /**
5
- * Return the next previous the user can navigate to, according to the given
5
+ * Returns the previous month the user can navigate to, based on the given
6
6
  * options.
7
7
  *
8
- * Please note that the previous month is not always the previous calendar
9
- * month:
8
+ * The previous month is not always the previous calendar month:
10
9
  *
11
- * - If before the `calendarStartMonth` date, is `undefined`;
12
- * - If the navigation is paged, is the number of months displayed before.
10
+ * - If it is before the `calendarStartMonth`, it returns `undefined`.
11
+ * - If paged navigation is enabled, it skips back by the number of displayed
12
+ * months.
13
+ *
14
+ * @param firstDisplayedMonth The first month currently displayed in the
15
+ * calendar.
16
+ * @param calendarStartMonth The earliest month the user can navigate to.
17
+ * @param options Navigation options, including `numberOfMonths` and
18
+ * `pagedNavigation`.
19
+ * @param dateLib The date library to use for date manipulation.
20
+ * @returns The previous month, or `undefined` if navigation is not possible.
13
21
  */
14
22
  export function getPreviousMonth(
15
23
  firstDisplayedMonth: Date,
@@ -3,11 +3,22 @@ import type { CSSProperties } from "react";
3
3
  import { UI } from "../UI.js";
4
4
  import type { Modifiers, ModifiersStyles, Styles } from "../types/index.js";
5
5
 
6
+ /**
7
+ * Returns the computed style for a day based on its modifiers.
8
+ *
9
+ * This function merges the base styles for the day with any styles associated
10
+ * with active modifiers.
11
+ *
12
+ * @param dayModifiers The modifiers applied to the day.
13
+ * @param styles The base styles for the calendar elements.
14
+ * @param modifiersStyles The styles associated with specific modifiers.
15
+ * @returns The computed style for the day.
16
+ */
6
17
  export function getStyleForModifiers(
7
18
  dayModifiers: Modifiers,
8
19
  styles: Partial<Styles> = {},
9
20
  modifiersStyles: Partial<ModifiersStyles> = {}
10
- ) {
21
+ ): CSSProperties {
11
22
  let style: CSSProperties = { ...styles?.[UI.Day] };
12
23
  Object.entries(dayModifiers)
13
24
  .filter(([, active]) => active === true)
@@ -1,15 +1,18 @@
1
1
  import { DateLib } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * Generate a series of 7 days, starting from the week, to use for formatting
5
- * the weekday names (Monday, Tuesday, etc.).
4
+ * Generates a series of 7 days, starting from the beginning of the week, to use
5
+ * for formatting weekday names (e.g., Monday, Tuesday, etc.).
6
+ *
7
+ * @param dateLib The date library to use for date manipulation.
8
+ * @param ISOWeek Whether to use ISO week numbering (weeks start on Monday).
9
+ * @param broadcastCalendar Whether to use the broadcast calendar (weeks start
10
+ * on Monday, but may include adjustments for broadcast-specific rules).
11
+ * @returns An array of 7 dates representing the weekdays.
6
12
  */
7
13
  export function getWeekdays(
8
- /** The date library. */
9
14
  dateLib: DateLib,
10
- /** Use ISOWeek instead of locale/ */
11
15
  ISOWeek?: boolean | undefined,
12
- /** @since 9.4.0 */
13
16
  broadcastCalendar?: boolean | undefined
14
17
  ): Date[] {
15
18
  const today = dateLib.today();
@@ -1,6 +1,11 @@
1
1
  import type { CalendarMonth, CalendarWeek } from "../classes/index.js";
2
2
 
3
- /** Returns an array of calendar weeks from an array of calendar months. */
3
+ /**
4
+ * Returns an array of calendar weeks from an array of calendar months.
5
+ *
6
+ * @param months The array of calendar months.
7
+ * @returns An array of calendar weeks.
8
+ */
4
9
  export function getWeeks(months: CalendarMonth[]) {
5
10
  const initialWeeks: CalendarWeek[] = [];
6
11
  return months.reduce((weeks, month) => {
@@ -2,7 +2,19 @@ import type { DateLib } from "../classes/DateLib.js";
2
2
  import { DropdownOption } from "../components/Dropdown.js";
3
3
  import type { Formatters } from "../types/index.js";
4
4
 
5
- /** Return the years to show in the dropdown. */
5
+ /**
6
+ * Returns the years to display in the dropdown.
7
+ *
8
+ * This function generates a list of years between the navigation start and end
9
+ * dates, formatted using the provided formatter.
10
+ *
11
+ * @param navStart The start date for navigation.
12
+ * @param navEnd The end date for navigation.
13
+ * @param formatters The formatters to use for formatting the year labels.
14
+ * @param dateLib The date library to use for date manipulation.
15
+ * @returns An array of dropdown options representing the years, or `undefined`
16
+ * if `navStart` or `navEnd` is not provided.
17
+ */
6
18
  export function getYearOptions(
7
19
  navStart: Date | undefined,
8
20
  navEnd: Date | undefined,
@@ -1,9 +1,16 @@
1
1
  import type { DateLib } from "../classes/index.js";
2
2
 
3
3
  /**
4
- * Return the start date of the week in the broadcast calendar.
4
+ * Returns the start date of the week in the broadcast calendar.
5
+ *
6
+ * The broadcast week starts on Monday. If the first day of the month is not a
7
+ * Monday, this function calculates the previous Monday as the start of the
8
+ * broadcast week.
5
9
  *
6
10
  * @since 9.4.0
11
+ * @param date The date for which to calculate the start of the broadcast week.
12
+ * @param dateLib The date library to use for date manipulation.
13
+ * @returns The start date of the broadcast week.
7
14
  */
8
15
  export function startOfBroadcastWeek(date: Date, dateLib: DateLib): Date {
9
16
  const firstOfMonth = dateLib.startOfMonth(date);
@@ -5,6 +5,10 @@ export type DispatchStateAction<T> = React.Dispatch<React.SetStateAction<T>>;
5
5
  /**
6
6
  * A custom hook for managing both controlled and uncontrolled component states.
7
7
  *
8
+ * This hook allows a component to support both controlled and uncontrolled
9
+ * states by determining whether the `controlledValue` is provided. If it is
10
+ * undefined, the hook falls back to using the internal state.
11
+ *
8
12
  * @example
9
13
  * // Uncontrolled usage
10
14
  * const [value, setValue] = useControlledValue(0, undefined);
@@ -13,12 +17,12 @@ export type DispatchStateAction<T> = React.Dispatch<React.SetStateAction<T>>;
13
17
  * const [value, setValue] = useControlledValue(0, props.value);
14
18
  *
15
19
  * @template T - The type of the value.
16
- * @param {T} defaultValue - The initial value for the uncontrolled state.
17
- * @param {T | undefined} controlledValue - The value for the controlled state.
18
- * If undefined, the component will use the uncontrolled state.
19
- * @returns {[T, DispatchStateAction<T>]} - Returns a tuple where the first
20
- * element is the current value (either controlled or uncontrolled) and the
21
- * second element is a setter function to update the value.
20
+ * @param defaultValue The initial value for the uncontrolled state.
21
+ * @param controlledValue The value for the controlled state. If undefined, the
22
+ * component will use the uncontrolled state.
23
+ * @returns A tuple where the first element is the current value (either
24
+ * controlled or uncontrolled) and the second element is a setter function to
25
+ * update the value.
22
26
  */
23
27
  export function useControlledValue<T>(
24
28
  defaultValue: T,
@@ -2,18 +2,22 @@ import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
2
2
  import type { Modifiers } from "../types/index.js";
3
3
 
4
4
  /**
5
- * The ARIA label for the day button.
5
+ * Generates the ARIA label for a day button.
6
6
  *
7
- * Use the `modifiers` argument to add additional context to the label, e.g.
8
- * when a day is selected or is today.
7
+ * Use the `modifiers` argument to provide additional context for the label,
8
+ * such as indicating if the day is "today" or "selected."
9
9
  *
10
10
  * @defaultValue The formatted date.
11
+ * @param date - The date to format.
12
+ * @param modifiers - The modifiers providing context for the day.
13
+ * @param options - Optional configuration for the date formatting library.
14
+ * @param dateLib - An optional instance of the date formatting library.
15
+ * @returns The ARIA label for the day button.
11
16
  * @group Labels
12
17
  * @see https://daypicker.dev/docs/translation#aria-labels
13
18
  */
14
19
  export function labelDayButton(
15
20
  date: Date,
16
- /** The modifiers for the day. */
17
21
  modifiers: Modifiers,
18
22
  options?: DateLibOptions,
19
23
  dateLib?: DateLib
@@ -1,10 +1,14 @@
1
1
  import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * The ARIA label for the month grid, that will be announced when entering the
5
- * grid.
4
+ * Generates the ARIA label for the month grid, which is announced when entering
5
+ * the grid.
6
6
  *
7
- * @defaultValue `LLLL y` (e.g. "November 2022")
7
+ * @defaultValue `LLLL y` (e.g., "November 2022").
8
+ * @param date - The date representing the month.
9
+ * @param options - Optional configuration for the date formatting library.
10
+ * @param dateLib - An optional instance of the date formatting library.
11
+ * @returns The ARIA label for the month grid.
8
12
  * @group Labels
9
13
  * @see https://daypicker.dev/docs/translation#aria-labels
10
14
  */
@@ -2,14 +2,18 @@ import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
2
2
  import type { Modifiers } from "../types/index.js";
3
3
 
4
4
  /**
5
- * The label for the day gridcell when the calendar is not interactive.
5
+ * Generates the label for a day grid cell when the calendar is not interactive.
6
6
  *
7
+ * @param date - The date to format.
8
+ * @param modifiers - Optional modifiers providing context for the day.
9
+ * @param options - Optional configuration for the date formatting library.
10
+ * @param dateLib - An optional instance of the date formatting library.
11
+ * @returns The label for the day grid cell.
7
12
  * @group Labels
8
13
  * @see https://daypicker.dev/docs/translation#aria-labels
9
14
  */
10
15
  export function labelGridcell(
11
16
  date: Date,
12
- /** The modifiers for the day. */
13
17
  modifiers?: Modifiers,
14
18
  options?: DateLibOptions,
15
19
  dateLib?: DateLib
@@ -1,9 +1,11 @@
1
1
  import type { DateLibOptions } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * The ARIA label for the months dropdown.
4
+ * Generates the ARIA label for the months dropdown.
5
5
  *
6
6
  * @defaultValue `"Choose the Month"`
7
+ * @param options - Optional configuration for the date formatting library.
8
+ * @returns The ARIA label for the months dropdown.
7
9
  * @group Labels
8
10
  * @see https://daypicker.dev/docs/translation#aria-labels
9
11
  */
@@ -1,7 +1,8 @@
1
1
  /**
2
- * The ARIA label for the navigation toolbar.
2
+ * Generates the ARIA label for the navigation toolbar.
3
3
  *
4
4
  * @defaultValue `""`
5
+ * @returns The ARIA label for the navigation toolbar.
5
6
  * @group Labels
6
7
  * @see https://daypicker.dev/docs/translation#aria-labels
7
8
  */
@@ -1,13 +1,13 @@
1
1
  /**
2
- * The ARIA label for next month button.
2
+ * Generates the ARIA label for the "next month" button.
3
3
  *
4
4
  * @defaultValue `"Go to the Next Month"`
5
+ * @param month - The date representing the next month, or `undefined` if there
6
+ * is no next month.
7
+ * @returns The ARIA label for the "next month" button.
5
8
  * @group Labels
6
9
  * @see https://daypicker.dev/docs/translation#aria-labels
7
10
  */
8
- export function labelNext(
9
- /** `undefined` where there's no next month to navigate to. */
10
- month: Date | undefined
11
- ) {
11
+ export function labelNext(month: Date | undefined) {
12
12
  return "Go to the Next Month";
13
13
  }
@@ -1,13 +1,13 @@
1
1
  /**
2
- * The ARIA label for previous month button.
2
+ * Generates the ARIA label for the "previous month" button.
3
3
  *
4
4
  * @defaultValue `"Go to the Previous Month"`
5
+ * @param month - The date representing the previous month, or `undefined` if
6
+ * there is no previous month.
7
+ * @returns The ARIA label for the "previous month" button.
5
8
  * @group Labels
6
9
  * @see https://daypicker.dev/docs/translation#aria-labels
7
10
  */
8
- export function labelPrevious(
9
- /** Undefined where there's no previous month to navigate to. */
10
- month: Date | undefined
11
- ) {
11
+ export function labelPrevious(month: Date | undefined) {
12
12
  return "Go to the Previous Month";
13
13
  }
@@ -1,9 +1,12 @@
1
1
  import type { DateLibOptions } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * The ARIA label for the week number cell (the first cell in the row).
4
+ * Generates the ARIA label for the week number cell (the first cell in a row).
5
5
  *
6
6
  * @defaultValue `Week ${weekNumber}`
7
+ * @param weekNumber - The number of the week.
8
+ * @param options - Optional configuration for the date formatting library.
9
+ * @returns The ARIA label for the week number cell.
7
10
  * @group Labels
8
11
  * @see https://daypicker.dev/docs/translation#aria-labels
9
12
  */
@@ -1,9 +1,11 @@
1
1
  import type { DateLibOptions } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * The ARIA label for the week number header element.
4
+ * Generates the ARIA label for the week number header element.
5
5
  *
6
6
  * @defaultValue `"Week Number"`
7
+ * @param options - Optional configuration for the date formatting library.
8
+ * @returns The ARIA label for the week number header.
7
9
  * @group Labels
8
10
  * @see https://daypicker.dev/docs/translation#aria-labels
9
11
  */
@@ -1,9 +1,13 @@
1
1
  import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * The ARIA label for the Weekday column header.
4
+ * Generates the ARIA label for a weekday column header.
5
5
  *
6
6
  * @defaultValue `"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"`
7
+ * @param date - The date representing the weekday.
8
+ * @param options - Optional configuration for the date formatting library.
9
+ * @param dateLib - An optional instance of the date formatting library.
10
+ * @returns The ARIA label for the weekday column header.
7
11
  * @group Labels
8
12
  * @see https://daypicker.dev/docs/translation#aria-labels
9
13
  */
@@ -1,9 +1,11 @@
1
1
  import type { DateLibOptions } from "../classes/DateLib.js";
2
2
 
3
3
  /**
4
- * The ARIA label for the years dropdown.
4
+ * Generates the ARIA label for the years dropdown.
5
5
  *
6
6
  * @defaultValue `"Choose the Year"`
7
+ * @param options - Optional configuration for the date formatting library.
8
+ * @returns The ARIA label for the years dropdown.
7
9
  * @group Labels
8
10
  * @see https://daypicker.dev/docs/translation#aria-labels
9
11
  */
package/src/persian.tsx CHANGED
@@ -15,8 +15,16 @@ export const faIR = locales.faIR;
15
15
  export const enUS = locales.enUS;
16
16
 
17
17
  /**
18
- * Render the Persian Calendar.
18
+ * Renders the Persian calendar using the DayPicker component.
19
19
  *
20
+ * @defaultValue
21
+ * - `locale`: `faIR`
22
+ * - `dir`: `rtl`
23
+ * - `dateLib`: `jalaliDateLib` from `date-fns-jalali`
24
+ * - `numerals`: `arabext` (Eastern Arabic-Indic)
25
+ * @param props - The props for the Persian calendar, including locale, text
26
+ * direction, date library, and numeral system.
27
+ * @returns The Persian calendar component.
20
28
  * @see https://daypicker.dev/docs/localization#persian-calendar
21
29
  */
22
30
  export function DayPicker(
@@ -80,7 +88,12 @@ export function DayPicker(
80
88
  );
81
89
  }
82
90
 
83
- /** Returns the date library used in the calendar. */
91
+ /**
92
+ * Returns the date library used in the Persian calendar.
93
+ *
94
+ * @param options - Optional configuration for the date library.
95
+ * @returns The date library instance.
96
+ */
84
97
  export const getDateLib = (options?: DateLibOptions) => {
85
98
  return new DateLib(options, dateFnsJalali);
86
99
  };
@@ -9,6 +9,15 @@ import type {
9
9
  Selection
10
10
  } from "../types/index.js";
11
11
 
12
+ /**
13
+ * Hook to manage multiple-date selection in the DayPicker component.
14
+ *
15
+ * @template T - The type of DayPicker props.
16
+ * @param props - The DayPicker props.
17
+ * @param dateLib - The date utility library instance.
18
+ * @returns An object containing the selected dates, a function to select dates,
19
+ * and a function to check if a date is selected.
20
+ */
12
21
  export function useMulti<T extends DayPickerProps>(
13
22
  props: T,
14
23
  dateLib: DateLib
@@ -11,6 +11,15 @@ import type {
11
11
  import { addToRange, rangeContainsModifiers } from "../utils/index.js";
12
12
  import { rangeIncludesDate } from "../utils/rangeIncludesDate.js";
13
13
 
14
+ /**
15
+ * Hook to manage range selection in the DayPicker component.
16
+ *
17
+ * @template T - The type of DayPicker props.
18
+ * @param props - The DayPicker props.
19
+ * @param dateLib - The date utility library instance.
20
+ * @returns An object containing the selected range, a function to select a
21
+ * range, and a function to check if a date is within the range.
22
+ */
14
23
  export function useRange<T extends DayPickerProps>(
15
24
  props: T,
16
25
  dateLib: DateLib
@@ -17,6 +17,15 @@ export type UseSingle<T extends DayPickerProps> = {
17
17
  selected: SelectedValue<T>;
18
18
  };
19
19
 
20
+ /**
21
+ * Hook to manage single-date selection in the DayPicker component.
22
+ *
23
+ * @template T - The type of DayPicker props.
24
+ * @param props - The DayPicker props.
25
+ * @param dateLib - The date utility library instance.
26
+ * @returns An object containing the selected date, a function to select a date,
27
+ * and a function to check if a date is selected.
28
+ */
20
29
  export function useSingle<T extends DayPickerProps>(
21
30
  props: DayPickerProps,
22
31
  dateLib: DateLib
package/src/style.css CHANGED
@@ -198,6 +198,35 @@
198
198
  font-size: large;
199
199
  }
200
200
 
201
+ .rdp-root[data-nav-layout="around"] .rdp-month,
202
+ .rdp-root[data-nav-layout="after"] .rdp-month {
203
+ position: relative;
204
+ }
205
+
206
+ .rdp-root[data-nav-layout="around"] .rdp-month_caption {
207
+ justify-content: center;
208
+ margin-inline-start: var(--rdp-nav_button-width);
209
+ margin-inline-end: var(--rdp-nav_button-width);
210
+ position: relative;
211
+ }
212
+
213
+ .rdp-root[data-nav-layout="around"] .rdp-button_previous {
214
+ position: absolute;
215
+ inset-inline-start: 0;
216
+ top: 0;
217
+ height: var(--rdp-nav-height);
218
+ display: inline-flex;
219
+ }
220
+
221
+ .rdp-root[data-nav-layout="around"] .rdp-button_next {
222
+ position: absolute;
223
+ inset-inline-end: 0;
224
+ top: 0;
225
+ height: var(--rdp-nav-height);
226
+ display: inline-flex;
227
+ justify-content: center;
228
+ }
229
+
201
230
  .rdp-months {
202
231
  position: relative;
203
232
  display: flex;