@coopdigital/react 0.49.1 → 0.51.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 (299) hide show
  1. package/dist/components/Button/Button.js +2 -2
  2. package/dist/components/Button/index.js +5 -0
  3. package/dist/components/Card/Card.js +4 -4
  4. package/dist/components/Checkbox/Checkbox.d.ts +7 -1
  5. package/dist/components/Checkbox/Checkbox.js +4 -0
  6. package/dist/components/DatePicker/DatePicker.d.ts +61 -0
  7. package/dist/components/DatePicker/DatePicker.js +135 -0
  8. package/dist/components/DatePicker/datepicker-utils.d.ts +68 -0
  9. package/dist/components/DatePicker/datepicker-utils.js +215 -0
  10. package/dist/components/DatePicker/index.d.ts +4 -0
  11. package/dist/components/Field/Field.js +29 -26
  12. package/dist/components/Field/index.js +6 -0
  13. package/dist/components/Pill/Pill.js +2 -2
  14. package/dist/components/Popover/Popover.d.ts +74 -0
  15. package/dist/components/Popover/Popover.js +75 -0
  16. package/dist/components/Popover/index.d.ts +4 -0
  17. package/dist/components/Popover/index.js +5 -0
  18. package/dist/components/Radio/Radio.d.ts +7 -1
  19. package/dist/components/Radio/Radio.js +4 -0
  20. package/dist/components/Searchbox/Searchbox.js +4 -3
  21. package/dist/components/Select/Select.d.ts +3 -0
  22. package/dist/components/Select/Select.js +4 -1
  23. package/dist/components/Signpost/Signpost.js +2 -2
  24. package/dist/components/Tag/Tag.js +2 -2
  25. package/dist/components/TextInput/TextInput.d.ts +6 -1
  26. package/dist/components/TextInput/TextInput.js +3 -0
  27. package/dist/components/Textarea/Textarea.d.ts +8 -5
  28. package/dist/components/Textarea/Textarea.js +5 -4
  29. package/dist/hooks/useSlots.js +3 -3
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +2 -0
  32. package/dist/node_modules/@date-fns/tz/date/index.js +83 -0
  33. package/dist/node_modules/@date-fns/tz/date/mini.js +235 -0
  34. package/dist/node_modules/@date-fns/tz/tzName/index.js +39 -0
  35. package/dist/node_modules/@date-fns/tz/tzOffset/index.js +44 -0
  36. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +814 -0
  37. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +751 -0
  38. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +350 -0
  39. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +161 -0
  40. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +137 -0
  41. package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
  42. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
  43. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
  44. package/dist/node_modules/@radix-ui/react-context/dist/index.js +63 -0
  45. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +213 -0
  46. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +31 -0
  47. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +209 -0
  48. package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
  49. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +303 -0
  50. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +285 -0
  51. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +19 -0
  52. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +132 -0
  53. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +43 -0
  54. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +89 -0
  55. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
  56. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +70 -0
  57. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
  58. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
  59. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
  60. package/dist/node_modules/aria-hidden/dist/es2015/index.js +137 -0
  61. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
  62. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  63. package/dist/node_modules/date-fns/_lib/format/formatters.js +775 -0
  64. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +94 -0
  65. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +66 -0
  66. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +31 -0
  67. package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  68. package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
  69. package/dist/node_modules/date-fns/_lib/protectedTokens.js +25 -0
  70. package/dist/node_modules/date-fns/addDays.js +41 -0
  71. package/dist/node_modules/date-fns/addMonths.js +75 -0
  72. package/dist/node_modules/date-fns/addWeeks.js +33 -0
  73. package/dist/node_modules/date-fns/addYears.js +33 -0
  74. package/dist/node_modules/date-fns/constants.js +67 -0
  75. package/dist/node_modules/date-fns/constructFrom.js +49 -0
  76. package/dist/node_modules/date-fns/differenceInCalendarDays.js +62 -0
  77. package/dist/node_modules/date-fns/differenceInCalendarMonths.js +42 -0
  78. package/dist/node_modules/date-fns/eachMonthOfInterval.js +65 -0
  79. package/dist/node_modules/date-fns/eachYearOfInterval.js +65 -0
  80. package/dist/node_modules/date-fns/endOfISOWeek.js +35 -0
  81. package/dist/node_modules/date-fns/endOfMonth.js +37 -0
  82. package/dist/node_modules/date-fns/endOfWeek.js +53 -0
  83. package/dist/node_modules/date-fns/endOfYear.js +37 -0
  84. package/dist/node_modules/date-fns/format.js +423 -0
  85. package/dist/node_modules/date-fns/getDayOfYear.js +34 -0
  86. package/dist/node_modules/date-fns/getDaysInMonth.js +36 -0
  87. package/dist/node_modules/date-fns/getDefaultOptions.js +31 -0
  88. package/dist/node_modules/date-fns/getISODay.js +33 -0
  89. package/dist/node_modules/date-fns/getISOWeek.js +40 -0
  90. package/dist/node_modules/date-fns/getISOWeekYear.js +52 -0
  91. package/dist/node_modules/date-fns/getMonth.js +29 -0
  92. package/dist/node_modules/date-fns/getWeek.js +54 -0
  93. package/dist/node_modules/date-fns/getWeekYear.js +75 -0
  94. package/dist/node_modules/date-fns/getYear.js +29 -0
  95. package/dist/node_modules/date-fns/isAfter.js +25 -0
  96. package/dist/node_modules/date-fns/isBefore.js +25 -0
  97. package/dist/node_modules/date-fns/isDate.js +41 -0
  98. package/dist/node_modules/date-fns/isSameDay.js +46 -0
  99. package/dist/node_modules/date-fns/isSameMonth.js +43 -0
  100. package/dist/node_modules/date-fns/isSameYear.js +35 -0
  101. package/dist/node_modules/date-fns/isValid.js +39 -0
  102. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +10 -0
  103. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +64 -0
  104. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +59 -0
  105. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +22 -0
  106. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +103 -0
  107. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +41 -0
  108. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +13 -0
  109. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +189 -0
  110. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +134 -0
  111. package/dist/node_modules/date-fns/locale/en-US.js +28 -0
  112. package/dist/node_modules/date-fns/max.js +49 -0
  113. package/dist/node_modules/date-fns/min.js +49 -0
  114. package/dist/node_modules/date-fns/parse/_lib/Parser.js +27 -0
  115. package/dist/node_modules/date-fns/parse/_lib/Setter.js +59 -0
  116. package/dist/node_modules/date-fns/parse/_lib/constants.js +33 -0
  117. package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js +55 -0
  118. package/dist/node_modules/date-fns/parse/_lib/parsers/AMPMParser.js +55 -0
  119. package/dist/node_modules/date-fns/parse/_lib/parsers/DateParser.js +59 -0
  120. package/dist/node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js +57 -0
  121. package/dist/node_modules/date-fns/parse/_lib/parsers/DayParser.js +64 -0
  122. package/dist/node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js +56 -0
  123. package/dist/node_modules/date-fns/parse/_lib/parsers/EraParser.js +41 -0
  124. package/dist/node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js +24 -0
  125. package/dist/node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js +21 -0
  126. package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js +36 -0
  127. package/dist/node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js +31 -0
  128. package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js +32 -0
  129. package/dist/node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js +38 -0
  130. package/dist/node_modules/date-fns/parse/_lib/parsers/ISODayParser.js +118 -0
  131. package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js +47 -0
  132. package/dist/node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js +47 -0
  133. package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js +48 -0
  134. package/dist/node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js +44 -0
  135. package/dist/node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js +96 -0
  136. package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js +47 -0
  137. package/dist/node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js +76 -0
  138. package/dist/node_modules/date-fns/parse/_lib/parsers/MinuteParser.js +31 -0
  139. package/dist/node_modules/date-fns/parse/_lib/parsers/MonthParser.js +86 -0
  140. package/dist/node_modules/date-fns/parse/_lib/parsers/QuarterParser.js +83 -0
  141. package/dist/node_modules/date-fns/parse/_lib/parsers/SecondParser.js +31 -0
  142. package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js +97 -0
  143. package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js +86 -0
  144. package/dist/node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js +83 -0
  145. package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js +19 -0
  146. package/dist/node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js +19 -0
  147. package/dist/node_modules/date-fns/parse/_lib/parsers/YearParser.js +62 -0
  148. package/dist/node_modules/date-fns/parse/_lib/parsers.js +110 -0
  149. package/dist/node_modules/date-fns/parse/_lib/utils.js +135 -0
  150. package/dist/node_modules/date-fns/parse.js +497 -0
  151. package/dist/node_modules/date-fns/setDay.js +59 -0
  152. package/dist/node_modules/date-fns/setISODay.js +40 -0
  153. package/dist/node_modules/date-fns/setISOWeek.js +39 -0
  154. package/dist/node_modules/date-fns/setMonth.js +46 -0
  155. package/dist/node_modules/date-fns/setWeek.js +53 -0
  156. package/dist/node_modules/date-fns/setYear.js +40 -0
  157. package/dist/node_modules/date-fns/startOfDay.js +35 -0
  158. package/dist/node_modules/date-fns/startOfISOWeek.js +35 -0
  159. package/dist/node_modules/date-fns/startOfISOWeekYear.js +42 -0
  160. package/dist/node_modules/date-fns/startOfMonth.js +37 -0
  161. package/dist/node_modules/date-fns/startOfWeek.js +53 -0
  162. package/dist/node_modules/date-fns/startOfWeekYear.js +64 -0
  163. package/dist/node_modules/date-fns/startOfYear.js +36 -0
  164. package/dist/node_modules/date-fns/toDate.js +46 -0
  165. package/dist/node_modules/date-fns/transpose.js +52 -0
  166. package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
  167. package/dist/node_modules/react-day-picker/dist/esm/DayPicker.js +320 -0
  168. package/dist/node_modules/react-day-picker/dist/esm/UI.js +122 -0
  169. package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js +33 -0
  170. package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js +14 -0
  171. package/dist/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js +13 -0
  172. package/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js +604 -0
  173. package/dist/node_modules/react-day-picker/dist/esm/components/Button.js +13 -0
  174. package/dist/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js +13 -0
  175. package/dist/node_modules/react-day-picker/dist/esm/components/Chevron.js +20 -0
  176. package/dist/node_modules/react-day-picker/dist/esm/components/Day.js +18 -0
  177. package/dist/node_modules/react-day-picker/dist/esm/components/DayButton.js +19 -0
  178. package/dist/node_modules/react-day-picker/dist/esm/components/Dropdown.js +21 -0
  179. package/dist/node_modules/react-day-picker/dist/esm/components/DropdownNav.js +13 -0
  180. package/dist/node_modules/react-day-picker/dist/esm/components/Footer.js +13 -0
  181. package/dist/node_modules/react-day-picker/dist/esm/components/Month.js +15 -0
  182. package/dist/node_modules/react-day-picker/dist/esm/components/MonthCaption.js +14 -0
  183. package/dist/node_modules/react-day-picker/dist/esm/components/MonthGrid.js +13 -0
  184. package/dist/node_modules/react-day-picker/dist/esm/components/Months.js +13 -0
  185. package/dist/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js +15 -0
  186. package/dist/node_modules/react-day-picker/dist/esm/components/Nav.js +31 -0
  187. package/dist/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js +15 -0
  188. package/dist/node_modules/react-day-picker/dist/esm/components/Option.js +13 -0
  189. package/dist/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js +15 -0
  190. package/dist/node_modules/react-day-picker/dist/esm/components/Root.js +14 -0
  191. package/dist/node_modules/react-day-picker/dist/esm/components/Select.js +13 -0
  192. package/dist/node_modules/react-day-picker/dist/esm/components/Week.js +14 -0
  193. package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumber.js +14 -0
  194. package/dist/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js +13 -0
  195. package/dist/node_modules/react-day-picker/dist/esm/components/Weekday.js +13 -0
  196. package/dist/node_modules/react-day-picker/dist/esm/components/Weekdays.js +14 -0
  197. package/dist/node_modules/react-day-picker/dist/esm/components/Weeks.js +13 -0
  198. package/dist/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js +15 -0
  199. package/dist/node_modules/react-day-picker/dist/esm/components/custom-components.js +26 -0
  200. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js +26 -0
  201. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatDay.js +19 -0
  202. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js +18 -0
  203. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js +21 -0
  204. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js +13 -0
  205. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js +19 -0
  206. package/dist/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js +23 -0
  207. package/dist/node_modules/react-day-picker/dist/esm/formatters/index.js +7 -0
  208. package/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js +73 -0
  209. package/dist/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js +95 -0
  210. package/dist/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js +22 -0
  211. package/dist/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js +28 -0
  212. package/dist/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js +33 -0
  213. package/dist/node_modules/react-day-picker/dist/esm/helpers/getComponents.js +20 -0
  214. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js +27 -0
  215. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDates.js +59 -0
  216. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDays.js +19 -0
  217. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js +33 -0
  218. package/dist/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js +24 -0
  219. package/dist/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js +46 -0
  220. package/dist/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js +24 -0
  221. package/dist/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js +27 -0
  222. package/dist/node_modules/react-day-picker/dist/esm/helpers/getLabels.js +53 -0
  223. package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js +33 -0
  224. package/dist/node_modules/react-day-picker/dist/esm/helpers/getMonths.js +69 -0
  225. package/dist/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js +51 -0
  226. package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js +40 -0
  227. package/dist/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js +36 -0
  228. package/dist/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js +37 -0
  229. package/dist/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js +27 -0
  230. package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js +26 -0
  231. package/dist/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js +14 -0
  232. package/dist/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js +36 -0
  233. package/dist/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js +27 -0
  234. package/dist/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js +31 -0
  235. package/dist/node_modules/react-day-picker/dist/esm/labels/index.js +11 -0
  236. package/dist/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js +32 -0
  237. package/dist/node_modules/react-day-picker/dist/esm/labels/labelGrid.js +25 -0
  238. package/dist/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js +22 -0
  239. package/dist/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js +14 -0
  240. package/dist/node_modules/react-day-picker/dist/esm/labels/labelNav.js +13 -0
  241. package/dist/node_modules/react-day-picker/dist/esm/labels/labelNext.js +16 -0
  242. package/dist/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js +15 -0
  243. package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js +15 -0
  244. package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js +14 -0
  245. package/dist/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js +18 -0
  246. package/dist/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js +14 -0
  247. package/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js +67 -0
  248. package/dist/node_modules/react-day-picker/dist/esm/selection/useMulti.js +57 -0
  249. package/dist/node_modules/react-day-picker/dist/esm/selection/useRange.js +45 -0
  250. package/dist/node_modules/react-day-picker/dist/esm/selection/useSingle.js +44 -0
  251. package/dist/node_modules/react-day-picker/dist/esm/useAnimation.js +174 -0
  252. package/dist/node_modules/react-day-picker/dist/esm/useCalendar.js +113 -0
  253. package/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js +25 -0
  254. package/dist/node_modules/react-day-picker/dist/esm/useFocus.js +56 -0
  255. package/dist/node_modules/react-day-picker/dist/esm/useSelection.js +31 -0
  256. package/dist/node_modules/react-day-picker/dist/esm/utils/addToRange.js +95 -0
  257. package/dist/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js +57 -0
  258. package/dist/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js +62 -0
  259. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js +30 -0
  260. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js +74 -0
  261. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js +35 -0
  262. package/dist/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js +21 -0
  263. package/dist/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js +16 -0
  264. package/dist/node_modules/react-day-picker/dist/esm/utils/typeguards.js +66 -0
  265. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
  266. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +167 -0
  267. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
  268. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
  269. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +110 -0
  270. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  271. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  272. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
  273. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
  274. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
  275. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
  276. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
  277. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
  278. package/dist/node_modules/tslib/tslib.es6.js +56 -0
  279. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
  280. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
  281. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
  282. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
  283. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
  284. package/dist/types/index.d.ts +10 -0
  285. package/package.json +11 -7
  286. package/src/components/Checkbox/Checkbox.tsx +6 -1
  287. package/src/components/DatePicker/DatePicker.tsx +372 -0
  288. package/src/components/DatePicker/datepicker-utils.ts +269 -0
  289. package/src/components/DatePicker/index.ts +5 -0
  290. package/src/components/Field/Field.tsx +30 -28
  291. package/src/components/Popover/Popover.tsx +198 -0
  292. package/src/components/Popover/index.ts +5 -0
  293. package/src/components/Radio/Radio.tsx +6 -1
  294. package/src/components/Searchbox/Searchbox.tsx +4 -1
  295. package/src/components/Select/Select.tsx +7 -2
  296. package/src/components/TextInput/TextInput.tsx +5 -1
  297. package/src/components/Textarea/Textarea.tsx +9 -13
  298. package/src/index.ts +2 -0
  299. package/src/types/index.ts +15 -0
@@ -0,0 +1,95 @@
1
+ import { DayFlag } from '../UI.js';
2
+ import { dateMatchModifiers } from '../utils/dateMatchModifiers.js';
3
+
4
+ /**
5
+ * Creates a function to retrieve the modifiers for a given day.
6
+ *
7
+ * This function calculates both internal and custom modifiers for each day
8
+ * based on the provided calendar days and DayPicker props.
9
+ *
10
+ * @private
11
+ * @param days The array of `CalendarDay` objects to process.
12
+ * @param props The DayPicker props, including modifiers and configuration
13
+ * options.
14
+ * @param dateLib The date library to use for date manipulation.
15
+ * @returns A function that retrieves the modifiers for a given `CalendarDay`.
16
+ */
17
+ function createGetModifiers(days, props, navStart, navEnd, dateLib) {
18
+ const { disabled, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today(), } = props;
19
+ const { isSameDay, isSameMonth, startOfMonth, isBefore, endOfMonth, isAfter, } = dateLib;
20
+ const computedNavStart = navStart && startOfMonth(navStart);
21
+ const computedNavEnd = navEnd && endOfMonth(navEnd);
22
+ const internalModifiersMap = {
23
+ [DayFlag.focused]: [],
24
+ [DayFlag.outside]: [],
25
+ [DayFlag.disabled]: [],
26
+ [DayFlag.hidden]: [],
27
+ [DayFlag.today]: [],
28
+ };
29
+ const customModifiersMap = {};
30
+ for (const day of days) {
31
+ const { date, displayMonth } = day;
32
+ const isOutside = Boolean(displayMonth && !isSameMonth(date, displayMonth));
33
+ const isBeforeNavStart = Boolean(computedNavStart && isBefore(date, computedNavStart));
34
+ const isAfterNavEnd = Boolean(computedNavEnd && isAfter(date, computedNavEnd));
35
+ const isDisabled = Boolean(disabled && dateMatchModifiers(date, disabled, dateLib));
36
+ const isHidden = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) ||
37
+ isBeforeNavStart ||
38
+ isAfterNavEnd ||
39
+ // Broadcast calendar will show outside days as default
40
+ (!broadcastCalendar && !showOutsideDays && isOutside) ||
41
+ (broadcastCalendar && showOutsideDays === false && isOutside);
42
+ const isToday = isSameDay(date, today);
43
+ if (isOutside)
44
+ internalModifiersMap.outside.push(day);
45
+ if (isDisabled)
46
+ internalModifiersMap.disabled.push(day);
47
+ if (isHidden)
48
+ internalModifiersMap.hidden.push(day);
49
+ if (isToday)
50
+ internalModifiersMap.today.push(day);
51
+ // Add custom modifiers
52
+ if (modifiers) {
53
+ Object.keys(modifiers).forEach((name) => {
54
+ const modifierValue = modifiers?.[name];
55
+ const isMatch = modifierValue
56
+ ? dateMatchModifiers(date, modifierValue, dateLib)
57
+ : false;
58
+ if (!isMatch)
59
+ return;
60
+ if (customModifiersMap[name]) {
61
+ customModifiersMap[name].push(day);
62
+ }
63
+ else {
64
+ customModifiersMap[name] = [day];
65
+ }
66
+ });
67
+ }
68
+ }
69
+ return (day) => {
70
+ // Initialize all the modifiers to false
71
+ const dayFlags = {
72
+ [DayFlag.focused]: false,
73
+ [DayFlag.disabled]: false,
74
+ [DayFlag.hidden]: false,
75
+ [DayFlag.outside]: false,
76
+ [DayFlag.today]: false,
77
+ };
78
+ const customModifiers = {};
79
+ // Find the modifiers for the given day
80
+ for (const name in internalModifiersMap) {
81
+ const days = internalModifiersMap[name];
82
+ dayFlags[name] = days.some((d) => d === day);
83
+ }
84
+ for (const name in customModifiersMap) {
85
+ customModifiers[name] = customModifiersMap[name].some((d) => d === day);
86
+ }
87
+ return {
88
+ ...dayFlags,
89
+ // custom modifiers should override all the previous ones
90
+ ...customModifiers,
91
+ };
92
+ };
93
+ }
94
+
95
+ export { createGetModifiers };
@@ -0,0 +1,22 @@
1
+ import { getBroadcastWeeksInMonth } from './getBroadcastWeeksInMonth.js';
2
+ import { startOfBroadcastWeek } from './startOfBroadcastWeek.js';
3
+
4
+ /**
5
+ * Returns the end date of the week in the broadcast calendar.
6
+ *
7
+ * The broadcast week ends on the last day of the last broadcast week for the
8
+ * given date.
9
+ *
10
+ * @since 9.4.0
11
+ * @param date The date for which to calculate the end of the broadcast week.
12
+ * @param dateLib The date library to use for date manipulation.
13
+ * @returns The end date of the broadcast week.
14
+ */
15
+ function endOfBroadcastWeek(date, dateLib) {
16
+ const startDate = startOfBroadcastWeek(date, dateLib);
17
+ const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib);
18
+ const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1);
19
+ return endDate;
20
+ }
21
+
22
+ export { endOfBroadcastWeek };
@@ -0,0 +1,28 @@
1
+ const FIVE_WEEKS = 5;
2
+ const FOUR_WEEKS = 4;
3
+ /**
4
+ * Returns the number of weeks to display in the broadcast calendar for a given
5
+ * month.
6
+ *
7
+ * The broadcast calendar may have either 4 or 5 weeks in a month, depending on
8
+ * the start and end dates of the broadcast weeks.
9
+ *
10
+ * @since 9.4.0
11
+ * @param month The month for which to calculate the number of weeks.
12
+ * @param dateLib The date library to use for date manipulation.
13
+ * @returns The number of weeks in the broadcast calendar (4 or 5).
14
+ */
15
+ function getBroadcastWeeksInMonth(month, dateLib) {
16
+ // Get the first day of the month
17
+ const firstDayOfMonth = dateLib.startOfMonth(month);
18
+ // Get the day of the week for the first day of the month (1-7, where 1 is Monday)
19
+ const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7;
20
+ const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1);
21
+ const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1);
22
+ const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek)
23
+ ? FIVE_WEEKS
24
+ : FOUR_WEEKS;
25
+ return numberOfWeeks;
26
+ }
27
+
28
+ export { getBroadcastWeeksInMonth };
@@ -0,0 +1,33 @@
1
+ import { DayFlag, SelectionState, UI } from '../UI.js';
2
+
3
+ /**
4
+ * Returns the class names for a day based on its modifiers.
5
+ *
6
+ * This function combines the base class name for the day with any class names
7
+ * associated with active modifiers.
8
+ *
9
+ * @param modifiers The modifiers applied to the day.
10
+ * @param classNames The base class names for the calendar elements.
11
+ * @param modifiersClassNames The class names associated with specific
12
+ * modifiers.
13
+ * @returns An array of class names for the day.
14
+ */
15
+ function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) {
16
+ const modifierClassNames = Object.entries(modifiers)
17
+ .filter(([, active]) => active === true)
18
+ .reduce((previousValue, [key]) => {
19
+ if (modifiersClassNames[key]) {
20
+ previousValue.push(modifiersClassNames[key]);
21
+ }
22
+ else if (classNames[DayFlag[key]]) {
23
+ previousValue.push(classNames[DayFlag[key]]);
24
+ }
25
+ else if (classNames[SelectionState[key]]) {
26
+ previousValue.push(classNames[SelectionState[key]]);
27
+ }
28
+ return previousValue;
29
+ }, [classNames[UI.Day]]);
30
+ return modifierClassNames;
31
+ }
32
+
33
+ export { getClassNamesForModifiers };
@@ -0,0 +1,20 @@
1
+ import * as customComponents from '../components/custom-components.js';
2
+
3
+ /**
4
+ * Merges custom components from the props with the default components.
5
+ *
6
+ * This function ensures that any custom components provided in the props
7
+ * override the default components.
8
+ *
9
+ * @param customComponents The custom components provided in the DayPicker
10
+ * props.
11
+ * @returns An object containing the merged components.
12
+ */
13
+ function getComponents(customComponents$1) {
14
+ return {
15
+ ...customComponents,
16
+ ...customComponents$1,
17
+ };
18
+ }
19
+
20
+ export { getComponents };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Extracts `data-` attributes from the DayPicker props.
3
+ *
4
+ * This function collects all `data-` attributes from the props and adds
5
+ * additional attributes based on the DayPicker configuration.
6
+ *
7
+ * @param props The DayPicker props.
8
+ * @returns An object containing the `data-` attributes.
9
+ */
10
+ function getDataAttributes(props) {
11
+ const dataAttributes = {
12
+ "data-mode": props.mode ?? undefined,
13
+ "data-required": "required" in props ? props.required : undefined,
14
+ "data-multiple-months": (props.numberOfMonths && props.numberOfMonths > 1) || undefined,
15
+ "data-week-numbers": props.showWeekNumber || undefined,
16
+ "data-broadcast-calendar": props.broadcastCalendar || undefined,
17
+ "data-nav-layout": props.navLayout || undefined,
18
+ };
19
+ Object.entries(props).forEach(([key, val]) => {
20
+ if (key.startsWith("data-")) {
21
+ dataAttributes[key] = val;
22
+ }
23
+ });
24
+ return dataAttributes;
25
+ }
26
+
27
+ export { getDataAttributes };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Returns all the dates to display in the calendar.
3
+ *
4
+ * This function calculates the range of dates to display based on the provided
5
+ * display months, constraints, and calendar configuration.
6
+ *
7
+ * @param displayMonths The months to display in the calendar.
8
+ * @param maxDate The maximum date to include in the range.
9
+ * @param props The DayPicker props, including calendar configuration options.
10
+ * @param dateLib The date library to use for date manipulation.
11
+ * @returns An array of dates to display in the calendar.
12
+ */
13
+ function getDates(displayMonths, maxDate, props, dateLib) {
14
+ const firstMonth = displayMonths[0];
15
+ const lastMonth = displayMonths[displayMonths.length - 1];
16
+ const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {};
17
+ const { addDays, differenceInCalendarDays, differenceInCalendarMonths, endOfBroadcastWeek, endOfISOWeek, endOfMonth, endOfWeek, isAfter, startOfBroadcastWeek, startOfISOWeek, startOfWeek, } = dateLib;
18
+ const startWeekFirstDate = broadcastCalendar
19
+ ? startOfBroadcastWeek(firstMonth, dateLib)
20
+ : ISOWeek
21
+ ? startOfISOWeek(firstMonth)
22
+ : startOfWeek(firstMonth);
23
+ const displayMonthsWeekEnd = broadcastCalendar
24
+ ? endOfBroadcastWeek(lastMonth)
25
+ : ISOWeek
26
+ ? endOfISOWeek(endOfMonth(lastMonth))
27
+ : endOfWeek(endOfMonth(lastMonth));
28
+ // If maxDate is set, clamp the grid to the end of that week.
29
+ const constraintWeekEnd = maxDate &&
30
+ (broadcastCalendar
31
+ ? endOfBroadcastWeek(maxDate)
32
+ : ISOWeek
33
+ ? endOfISOWeek(maxDate)
34
+ : endOfWeek(maxDate));
35
+ // Pick the earliest week end between the displayed months and the constraint.
36
+ const gridEndDate = constraintWeekEnd && isAfter(displayMonthsWeekEnd, constraintWeekEnd)
37
+ ? constraintWeekEnd
38
+ : displayMonthsWeekEnd;
39
+ const nOfDays = differenceInCalendarDays(gridEndDate, startWeekFirstDate);
40
+ const nOfMonths = differenceInCalendarMonths(lastMonth, firstMonth) + 1;
41
+ const dates = [];
42
+ for (let i = 0; i <= nOfDays; i++) {
43
+ const date = addDays(startWeekFirstDate, i);
44
+ dates.push(date);
45
+ }
46
+ // If fixed weeks is enabled, add the extra dates to the array
47
+ const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42;
48
+ const extraDates = nrOfDaysWithFixedWeeks * nOfMonths;
49
+ if (fixedWeeks && dates.length < extraDates) {
50
+ const daysToAdd = extraDates - dates.length;
51
+ for (let i = 0; i < daysToAdd; i++) {
52
+ const date = addDays(dates[dates.length - 1], 1);
53
+ dates.push(date);
54
+ }
55
+ }
56
+ return dates;
57
+ }
58
+
59
+ export { getDates };
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Returns all the days belonging to the calendar by merging the days in the
3
+ * weeks for each month.
4
+ *
5
+ * @param calendarMonths The array of calendar months.
6
+ * @returns An array of `CalendarDay` objects representing all the days in the
7
+ * calendar.
8
+ */
9
+ function getDays(calendarMonths) {
10
+ const initialDays = [];
11
+ return calendarMonths.reduce((days, month) => {
12
+ const weekDays = month.weeks.reduce((weekDays, week) => {
13
+ return weekDays.concat(week.days.slice());
14
+ }, initialDays.slice());
15
+ return days.concat(weekDays.slice());
16
+ }, initialDays.slice());
17
+ }
18
+
19
+ export { getDays };
@@ -0,0 +1,33 @@
1
+ import { UI, DayFlag, SelectionState, Animation } from '../UI.js';
2
+
3
+ /**
4
+ * Returns the default class names for the UI elements.
5
+ *
6
+ * This function generates a mapping of default class names for various UI
7
+ * elements, day flags, selection states, and animations.
8
+ *
9
+ * @returns An object containing the default class names.
10
+ * @group Utilities
11
+ */
12
+ function getDefaultClassNames() {
13
+ const classNames = {};
14
+ for (const key in UI) {
15
+ classNames[UI[key]] =
16
+ `rdp-${UI[key]}`;
17
+ }
18
+ for (const key in DayFlag) {
19
+ classNames[DayFlag[key]] =
20
+ `rdp-${DayFlag[key]}`;
21
+ }
22
+ for (const key in SelectionState) {
23
+ classNames[SelectionState[key]] =
24
+ `rdp-${SelectionState[key]}`;
25
+ }
26
+ for (const key in Animation) {
27
+ classNames[Animation[key]] =
28
+ `rdp-${Animation[key]}`;
29
+ }
30
+ return classNames;
31
+ }
32
+
33
+ export { getDefaultClassNames };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Returns the months to display in the calendar.
3
+ *
4
+ * @param firstDisplayedMonth The first month currently displayed in the
5
+ * calendar.
6
+ * @param calendarEndMonth The latest month the user can navigate to.
7
+ * @param props The DayPicker props, including `numberOfMonths`.
8
+ * @param dateLib The date library to use for date manipulation.
9
+ * @returns An array of dates representing the months to display.
10
+ */
11
+ function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) {
12
+ const { numberOfMonths = 1 } = props;
13
+ const months = [];
14
+ for (let i = 0; i < numberOfMonths; i++) {
15
+ const month = dateLib.addMonths(firstDisplayedMonth, i);
16
+ if (calendarEndMonth && month > calendarEndMonth) {
17
+ break;
18
+ }
19
+ months.push(month);
20
+ }
21
+ return months;
22
+ }
23
+
24
+ export { getDisplayMonths };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Calculates the next date that should be focused in the calendar.
3
+ *
4
+ * This function determines the next focusable date based on the movement
5
+ * direction, constraints, and calendar configuration.
6
+ *
7
+ * @param moveBy The unit of movement (e.g., "day", "week").
8
+ * @param moveDir The direction of movement ("before" or "after").
9
+ * @param refDate The reference date from which to calculate the next focusable
10
+ * date.
11
+ * @param navStart The earliest date the user can navigate to.
12
+ * @param navEnd The latest date the user can navigate to.
13
+ * @param props The DayPicker props, including calendar configuration options.
14
+ * @param dateLib The date library to use for date manipulation.
15
+ * @returns The next focusable date.
16
+ */
17
+ function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) {
18
+ const { ISOWeek, broadcastCalendar } = props;
19
+ const { addDays, addMonths, addWeeks, addYears, endOfBroadcastWeek, endOfISOWeek, endOfWeek, max, min, startOfBroadcastWeek, startOfISOWeek, startOfWeek, } = dateLib;
20
+ const moveFns = {
21
+ day: addDays,
22
+ week: addWeeks,
23
+ month: addMonths,
24
+ year: addYears,
25
+ startOfWeek: (date) => broadcastCalendar
26
+ ? startOfBroadcastWeek(date, dateLib)
27
+ : ISOWeek
28
+ ? startOfISOWeek(date)
29
+ : startOfWeek(date),
30
+ endOfWeek: (date) => broadcastCalendar
31
+ ? endOfBroadcastWeek(date)
32
+ : ISOWeek
33
+ ? endOfISOWeek(date)
34
+ : endOfWeek(date),
35
+ };
36
+ let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1);
37
+ if (moveDir === "before" && navStart) {
38
+ focusableDate = max([navStart, focusableDate]);
39
+ }
40
+ else if (moveDir === "after" && navEnd) {
41
+ focusableDate = min([navEnd, focusableDate]);
42
+ }
43
+ return focusableDate;
44
+ }
45
+
46
+ export { getFocusableDate };
@@ -0,0 +1,24 @@
1
+ import * as index from '../formatters/index.js';
2
+
3
+ /**
4
+ * Merges custom formatters from the props with the default formatters.
5
+ *
6
+ * @param customFormatters The custom formatters provided in the DayPicker
7
+ * props.
8
+ * @returns The merged formatters object.
9
+ */
10
+ function getFormatters(customFormatters) {
11
+ if (customFormatters?.formatMonthCaption && !customFormatters.formatCaption) {
12
+ customFormatters.formatCaption = customFormatters.formatMonthCaption;
13
+ }
14
+ if (customFormatters?.formatYearCaption &&
15
+ !customFormatters.formatYearDropdown) {
16
+ customFormatters.formatYearDropdown = customFormatters.formatYearCaption;
17
+ }
18
+ return {
19
+ ...index,
20
+ ...customFormatters,
21
+ };
22
+ }
23
+
24
+ export { getFormatters };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Determines the initial month to display in the calendar based on the provided
3
+ * props.
4
+ *
5
+ * This function calculates the starting month, considering constraints such as
6
+ * `startMonth`, `endMonth`, and the number of months to display.
7
+ *
8
+ * @param props The DayPicker props, including navigation and date constraints.
9
+ * @param dateLib The date library to use for date manipulation.
10
+ * @returns The initial month to display.
11
+ */
12
+ function getInitialMonth(props, navStart, navEnd, dateLib) {
13
+ const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1, } = props;
14
+ let initialMonth = month || defaultMonth || today;
15
+ const { differenceInCalendarMonths, addMonths, startOfMonth } = dateLib;
16
+ if (navEnd &&
17
+ differenceInCalendarMonths(navEnd, initialMonth) < numberOfMonths - 1) {
18
+ const offset = -1 * (numberOfMonths - 1);
19
+ initialMonth = addMonths(navEnd, offset);
20
+ }
21
+ if (navStart && differenceInCalendarMonths(initialMonth, navStart) < 0) {
22
+ initialMonth = navStart;
23
+ }
24
+ return startOfMonth(initialMonth);
25
+ }
26
+
27
+ export { getInitialMonth };
@@ -0,0 +1,53 @@
1
+ import * as index from '../labels/index.js';
2
+ import { labelWeekday } from '../labels/labelWeekday.js';
3
+ import { labelWeekNumberHeader } from '../labels/labelWeekNumberHeader.js';
4
+ import { labelNav } from '../labels/labelNav.js';
5
+ import { labelGridcell } from '../labels/labelGridcell.js';
6
+ import { labelGrid } from '../labels/labelGrid.js';
7
+ import { labelYearDropdown } from '../labels/labelYearDropdown.js';
8
+ import { labelWeekNumber } from '../labels/labelWeekNumber.js';
9
+ import { labelPrevious } from '../labels/labelPrevious.js';
10
+ import { labelNext } from '../labels/labelNext.js';
11
+ import { labelMonthDropdown } from '../labels/labelMonthDropdown.js';
12
+ import { labelDayButton } from '../labels/labelDayButton.js';
13
+
14
+ const resolveLabel = (defaultLabel, customLabel, localeLabel) => {
15
+ if (customLabel)
16
+ return customLabel;
17
+ if (localeLabel) {
18
+ return (typeof localeLabel === "function"
19
+ ? localeLabel
20
+ : (..._args) => localeLabel);
21
+ }
22
+ return defaultLabel;
23
+ };
24
+ /**
25
+ * Merges custom labels from the props with the default labels.
26
+ *
27
+ * When available, uses the locale-provided translation for `labelNext`.
28
+ *
29
+ * @param customLabels The custom labels provided in the DayPicker props.
30
+ * @param options Options from the date library, used to resolve locale
31
+ * translations.
32
+ * @returns The merged labels object with locale-aware defaults.
33
+ */
34
+ function getLabels(customLabels, options) {
35
+ const localeLabels = options.locale?.labels ?? {};
36
+ return {
37
+ ...index,
38
+ ...(customLabels ?? {}),
39
+ labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton),
40
+ labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown),
41
+ labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext),
42
+ labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious),
43
+ labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber),
44
+ labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown),
45
+ labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid),
46
+ labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell),
47
+ labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav),
48
+ labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader),
49
+ labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday),
50
+ };
51
+ }
52
+
53
+ export { getLabels };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Returns the months to show in the dropdown.
3
+ *
4
+ * This function generates a list of months for the current year, formatted
5
+ * using the provided formatter, and determines whether each month should be
6
+ * disabled based on the navigation range.
7
+ *
8
+ * @param displayMonth The currently displayed month.
9
+ * @param navStart The start date for navigation.
10
+ * @param navEnd The end date for navigation.
11
+ * @param formatters The formatters to use for formatting the month labels.
12
+ * @param dateLib The date library to use for date manipulation.
13
+ * @returns An array of dropdown options representing the months, or `undefined`
14
+ * if no months are available.
15
+ */
16
+ function getMonthOptions(displayMonth, navStart, navEnd, formatters, dateLib) {
17
+ const { startOfMonth, startOfYear, endOfYear, eachMonthOfInterval, getMonth, } = dateLib;
18
+ const months = eachMonthOfInterval({
19
+ start: startOfYear(displayMonth),
20
+ end: endOfYear(displayMonth),
21
+ });
22
+ const options = months.map((month) => {
23
+ const label = formatters.formatMonthDropdown(month, dateLib);
24
+ const value = getMonth(month);
25
+ const disabled = (navStart && month < startOfMonth(navStart)) ||
26
+ (navEnd && month > startOfMonth(navEnd)) ||
27
+ false;
28
+ return { value, label, disabled };
29
+ });
30
+ return options;
31
+ }
32
+
33
+ export { getMonthOptions };
@@ -0,0 +1,69 @@
1
+ import { CalendarDay } from '../classes/CalendarDay.js';
2
+ import { CalendarWeek } from '../classes/CalendarWeek.js';
3
+ import { CalendarMonth } from '../classes/CalendarMonth.js';
4
+
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
+ */
19
+ function getMonths(displayMonths, dates, props, dateLib) {
20
+ const { addDays, endOfBroadcastWeek, endOfISOWeek, endOfMonth, endOfWeek, getISOWeek, getWeek, startOfBroadcastWeek, startOfISOWeek, startOfWeek, } = dateLib;
21
+ const dayPickerMonths = displayMonths.reduce((months, month) => {
22
+ const firstDateOfFirstWeek = props.broadcastCalendar
23
+ ? startOfBroadcastWeek(month, dateLib)
24
+ : props.ISOWeek
25
+ ? startOfISOWeek(month)
26
+ : startOfWeek(month);
27
+ const lastDateOfLastWeek = props.broadcastCalendar
28
+ ? endOfBroadcastWeek(month)
29
+ : props.ISOWeek
30
+ ? endOfISOWeek(endOfMonth(month))
31
+ : endOfWeek(endOfMonth(month));
32
+ /** The dates to display in the month. */
33
+ const monthDates = dates.filter((date) => {
34
+ return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek;
35
+ });
36
+ const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42;
37
+ if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) {
38
+ const extraDates = dates.filter((date) => {
39
+ const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length;
40
+ return (date > lastDateOfLastWeek &&
41
+ date <= addDays(lastDateOfLastWeek, daysToAdd));
42
+ });
43
+ monthDates.push(...extraDates);
44
+ }
45
+ const weeks = monthDates.reduce((weeks, date) => {
46
+ const weekNumber = props.ISOWeek ? getISOWeek(date) : getWeek(date);
47
+ const week = weeks.find((week) => week.weekNumber === weekNumber);
48
+ const day = new CalendarDay(date, month, dateLib);
49
+ if (!week) {
50
+ weeks.push(new CalendarWeek(weekNumber, [day]));
51
+ }
52
+ else {
53
+ week.days.push(day);
54
+ }
55
+ return weeks;
56
+ }, []);
57
+ const dayPickerMonth = new CalendarMonth(month, weeks);
58
+ months.push(dayPickerMonth);
59
+ return months;
60
+ }, []);
61
+ if (!props.reverseMonths) {
62
+ return dayPickerMonths;
63
+ }
64
+ else {
65
+ return dayPickerMonths.reverse();
66
+ }
67
+ }
68
+
69
+ export { getMonths };