@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,423 @@
1
+ import { getDefaultOptions } from './_lib/defaultOptions.js';
2
+ import { formatters } from './_lib/format/formatters.js';
3
+ import { longFormatters } from './_lib/format/longFormatters.js';
4
+ import { isProtectedWeekYearToken, isProtectedDayOfYearToken, warnOrThrowProtectedError } from './_lib/protectedTokens.js';
5
+ import { isValid } from './isValid.js';
6
+ import { toDate } from './toDate.js';
7
+ import { enUS } from './locale/en-US.js';
8
+
9
+ // This RegExp consists of three parts separated by `|`:
10
+ // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
11
+ // (one of the certain letters followed by `o`)
12
+ // - (\w)\1* matches any sequences of the same letter
13
+ // - '' matches two quote characters in a row
14
+ // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
15
+ // except a single quote symbol, which ends the sequence.
16
+ // Two quote characters do not end the sequence.
17
+ // If there is no matching single quote
18
+ // then the sequence will continue until the end of the string.
19
+ // - . matches any single character unmatched by previous parts of the RegExps
20
+ const formattingTokensRegExp =
21
+ /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
22
+
23
+ // This RegExp catches symbols escaped by quotes, and also
24
+ // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
25
+ const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
26
+
27
+ const escapedStringRegExp = /^'([^]*?)'?$/;
28
+ const doubleQuoteRegExp = /''/g;
29
+ const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
30
+
31
+ /**
32
+ * The {@link format} function options.
33
+ */
34
+
35
+ /**
36
+ * @name format
37
+ * @alias formatDate
38
+ * @category Common Helpers
39
+ * @summary Format the date.
40
+ *
41
+ * @description
42
+ * Return the formatted date string in the given format. The result may vary by locale.
43
+ *
44
+ * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
45
+ * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
46
+ *
47
+ * The characters wrapped between two single quotes characters (') are escaped.
48
+ * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
49
+ * (see the last example)
50
+ *
51
+ * Format of the string is based on Unicode Technical Standard #35:
52
+ * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
53
+ * with a few additions (see note 7 below the table).
54
+ *
55
+ * Accepted patterns:
56
+ * | Unit | Pattern | Result examples | Notes |
57
+ * |---------------------------------|---------|-----------------------------------|-------|
58
+ * | Era | G..GGG | AD, BC | |
59
+ * | | GGGG | Anno Domini, Before Christ | 2 |
60
+ * | | GGGGG | A, B | |
61
+ * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
62
+ * | | yo | 44th, 1st, 0th, 17th | 5,7 |
63
+ * | | yy | 44, 01, 00, 17 | 5 |
64
+ * | | yyy | 044, 001, 1900, 2017 | 5 |
65
+ * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
66
+ * | | yyyyy | ... | 3,5 |
67
+ * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
68
+ * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
69
+ * | | YY | 44, 01, 00, 17 | 5,8 |
70
+ * | | YYY | 044, 001, 1900, 2017 | 5 |
71
+ * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
72
+ * | | YYYYY | ... | 3,5 |
73
+ * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
74
+ * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
75
+ * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
76
+ * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
77
+ * | | RRRRR | ... | 3,5,7 |
78
+ * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
79
+ * | | uu | -43, 01, 1900, 2017 | 5 |
80
+ * | | uuu | -043, 001, 1900, 2017 | 5 |
81
+ * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
82
+ * | | uuuuu | ... | 3,5 |
83
+ * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
84
+ * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
85
+ * | | QQ | 01, 02, 03, 04 | |
86
+ * | | QQQ | Q1, Q2, Q3, Q4 | |
87
+ * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
88
+ * | | QQQQQ | 1, 2, 3, 4 | 4 |
89
+ * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
90
+ * | | qo | 1st, 2nd, 3rd, 4th | 7 |
91
+ * | | qq | 01, 02, 03, 04 | |
92
+ * | | qqq | Q1, Q2, Q3, Q4 | |
93
+ * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
94
+ * | | qqqqq | 1, 2, 3, 4 | 4 |
95
+ * | Month (formatting) | M | 1, 2, ..., 12 | |
96
+ * | | Mo | 1st, 2nd, ..., 12th | 7 |
97
+ * | | MM | 01, 02, ..., 12 | |
98
+ * | | MMM | Jan, Feb, ..., Dec | |
99
+ * | | MMMM | January, February, ..., December | 2 |
100
+ * | | MMMMM | J, F, ..., D | |
101
+ * | Month (stand-alone) | L | 1, 2, ..., 12 | |
102
+ * | | Lo | 1st, 2nd, ..., 12th | 7 |
103
+ * | | LL | 01, 02, ..., 12 | |
104
+ * | | LLL | Jan, Feb, ..., Dec | |
105
+ * | | LLLL | January, February, ..., December | 2 |
106
+ * | | LLLLL | J, F, ..., D | |
107
+ * | Local week of year | w | 1, 2, ..., 53 | |
108
+ * | | wo | 1st, 2nd, ..., 53th | 7 |
109
+ * | | ww | 01, 02, ..., 53 | |
110
+ * | ISO week of year | I | 1, 2, ..., 53 | 7 |
111
+ * | | Io | 1st, 2nd, ..., 53th | 7 |
112
+ * | | II | 01, 02, ..., 53 | 7 |
113
+ * | Day of month | d | 1, 2, ..., 31 | |
114
+ * | | do | 1st, 2nd, ..., 31st | 7 |
115
+ * | | dd | 01, 02, ..., 31 | |
116
+ * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
117
+ * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
118
+ * | | DD | 01, 02, ..., 365, 366 | 9 |
119
+ * | | DDD | 001, 002, ..., 365, 366 | |
120
+ * | | DDDD | ... | 3 |
121
+ * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
122
+ * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
123
+ * | | EEEEE | M, T, W, T, F, S, S | |
124
+ * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
125
+ * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
126
+ * | | io | 1st, 2nd, ..., 7th | 7 |
127
+ * | | ii | 01, 02, ..., 07 | 7 |
128
+ * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
129
+ * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
130
+ * | | iiiii | M, T, W, T, F, S, S | 7 |
131
+ * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
132
+ * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
133
+ * | | eo | 2nd, 3rd, ..., 1st | 7 |
134
+ * | | ee | 02, 03, ..., 01 | |
135
+ * | | eee | Mon, Tue, Wed, ..., Sun | |
136
+ * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
137
+ * | | eeeee | M, T, W, T, F, S, S | |
138
+ * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
139
+ * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
140
+ * | | co | 2nd, 3rd, ..., 1st | 7 |
141
+ * | | cc | 02, 03, ..., 01 | |
142
+ * | | ccc | Mon, Tue, Wed, ..., Sun | |
143
+ * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
144
+ * | | ccccc | M, T, W, T, F, S, S | |
145
+ * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
146
+ * | AM, PM | a..aa | AM, PM | |
147
+ * | | aaa | am, pm | |
148
+ * | | aaaa | a.m., p.m. | 2 |
149
+ * | | aaaaa | a, p | |
150
+ * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
151
+ * | | bbb | am, pm, noon, midnight | |
152
+ * | | bbbb | a.m., p.m., noon, midnight | 2 |
153
+ * | | bbbbb | a, p, n, mi | |
154
+ * | Flexible day period | B..BBB | at night, in the morning, ... | |
155
+ * | | BBBB | at night, in the morning, ... | 2 |
156
+ * | | BBBBB | at night, in the morning, ... | |
157
+ * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
158
+ * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
159
+ * | | hh | 01, 02, ..., 11, 12 | |
160
+ * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
161
+ * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
162
+ * | | HH | 00, 01, 02, ..., 23 | |
163
+ * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
164
+ * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
165
+ * | | KK | 01, 02, ..., 11, 00 | |
166
+ * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
167
+ * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
168
+ * | | kk | 24, 01, 02, ..., 23 | |
169
+ * | Minute | m | 0, 1, ..., 59 | |
170
+ * | | mo | 0th, 1st, ..., 59th | 7 |
171
+ * | | mm | 00, 01, ..., 59 | |
172
+ * | Second | s | 0, 1, ..., 59 | |
173
+ * | | so | 0th, 1st, ..., 59th | 7 |
174
+ * | | ss | 00, 01, ..., 59 | |
175
+ * | Fraction of second | S | 0, 1, ..., 9 | |
176
+ * | | SS | 00, 01, ..., 99 | |
177
+ * | | SSS | 000, 001, ..., 999 | |
178
+ * | | SSSS | ... | 3 |
179
+ * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
180
+ * | | XX | -0800, +0530, Z | |
181
+ * | | XXX | -08:00, +05:30, Z | |
182
+ * | | XXXX | -0800, +0530, Z, +123456 | 2 |
183
+ * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
184
+ * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
185
+ * | | xx | -0800, +0530, +0000 | |
186
+ * | | xxx | -08:00, +05:30, +00:00 | 2 |
187
+ * | | xxxx | -0800, +0530, +0000, +123456 | |
188
+ * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
189
+ * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
190
+ * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
191
+ * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
192
+ * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
193
+ * | Seconds timestamp | t | 512969520 | 7 |
194
+ * | | tt | ... | 3,7 |
195
+ * | Milliseconds timestamp | T | 512969520900 | 7 |
196
+ * | | TT | ... | 3,7 |
197
+ * | Long localized date | P | 04/29/1453 | 7 |
198
+ * | | PP | Apr 29, 1453 | 7 |
199
+ * | | PPP | April 29th, 1453 | 7 |
200
+ * | | PPPP | Friday, April 29th, 1453 | 2,7 |
201
+ * | Long localized time | p | 12:00 AM | 7 |
202
+ * | | pp | 12:00:00 AM | 7 |
203
+ * | | ppp | 12:00:00 AM GMT+2 | 7 |
204
+ * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
205
+ * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
206
+ * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
207
+ * | | PPPppp | April 29th, 1453 at ... | 7 |
208
+ * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
209
+ * Notes:
210
+ * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
211
+ * are the same as "stand-alone" units, but are different in some languages.
212
+ * "Formatting" units are declined according to the rules of the language
213
+ * in the context of a date. "Stand-alone" units are always nominative singular:
214
+ *
215
+ * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
216
+ *
217
+ * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
218
+ *
219
+ * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
220
+ * the single quote characters (see below).
221
+ * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
222
+ * the output will be the same as default pattern for this unit, usually
223
+ * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
224
+ * are marked with "2" in the last column of the table.
225
+ *
226
+ * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
227
+ *
228
+ * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
229
+ *
230
+ * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
231
+ *
232
+ * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
233
+ *
234
+ * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
235
+ *
236
+ * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
237
+ * The output will be padded with zeros to match the length of the pattern.
238
+ *
239
+ * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
240
+ *
241
+ * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
242
+ * These tokens represent the shortest form of the quarter.
243
+ *
244
+ * 5. The main difference between `y` and `u` patterns are B.C. years:
245
+ *
246
+ * | Year | `y` | `u` |
247
+ * |------|-----|-----|
248
+ * | AC 1 | 1 | 1 |
249
+ * | BC 1 | 1 | 0 |
250
+ * | BC 2 | 2 | -1 |
251
+ *
252
+ * Also `yy` always returns the last two digits of a year,
253
+ * while `uu` pads single digit years to 2 characters and returns other years unchanged:
254
+ *
255
+ * | Year | `yy` | `uu` |
256
+ * |------|------|------|
257
+ * | 1 | 01 | 01 |
258
+ * | 14 | 14 | 14 |
259
+ * | 376 | 76 | 376 |
260
+ * | 1453 | 53 | 1453 |
261
+ *
262
+ * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
263
+ * except local week-numbering years are dependent on `options.weekStartsOn`
264
+ * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
265
+ * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
266
+ *
267
+ * 6. Specific non-location timezones are currently unavailable in `date-fns`,
268
+ * so right now these tokens fall back to GMT timezones.
269
+ *
270
+ * 7. These patterns are not in the Unicode Technical Standard #35:
271
+ * - `i`: ISO day of week
272
+ * - `I`: ISO week of year
273
+ * - `R`: ISO week-numbering year
274
+ * - `t`: seconds timestamp
275
+ * - `T`: milliseconds timestamp
276
+ * - `o`: ordinal number modifier
277
+ * - `P`: long localized date
278
+ * - `p`: long localized time
279
+ *
280
+ * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
281
+ * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
282
+ *
283
+ * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
284
+ * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
285
+ *
286
+ * @param date - The original date
287
+ * @param format - The string of tokens
288
+ * @param options - An object with options
289
+ *
290
+ * @returns The formatted date string
291
+ *
292
+ * @throws `date` must not be Invalid Date
293
+ * @throws `options.locale` must contain `localize` property
294
+ * @throws `options.locale` must contain `formatLong` property
295
+ * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
296
+ * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
297
+ * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
298
+ * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
299
+ * @throws format string contains an unescaped latin alphabet character
300
+ *
301
+ * @example
302
+ * // Represent 11 February 2014 in middle-endian format:
303
+ * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
304
+ * //=> '02/11/2014'
305
+ *
306
+ * @example
307
+ * // Represent 2 July 2014 in Esperanto:
308
+ * import { eoLocale } from 'date-fns/locale/eo'
309
+ * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
310
+ * locale: eoLocale
311
+ * })
312
+ * //=> '2-a de julio 2014'
313
+ *
314
+ * @example
315
+ * // Escape string by single quote characters:
316
+ * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
317
+ * //=> "3 o'clock"
318
+ */
319
+ function format(date, formatStr, options) {
320
+ const defaultOptions = getDefaultOptions();
321
+ const locale = options?.locale ?? defaultOptions.locale ?? enUS;
322
+
323
+ const firstWeekContainsDate =
324
+ options?.firstWeekContainsDate ??
325
+ options?.locale?.options?.firstWeekContainsDate ??
326
+ defaultOptions.firstWeekContainsDate ??
327
+ defaultOptions.locale?.options?.firstWeekContainsDate ??
328
+ 1;
329
+
330
+ const weekStartsOn =
331
+ options?.weekStartsOn ??
332
+ options?.locale?.options?.weekStartsOn ??
333
+ defaultOptions.weekStartsOn ??
334
+ defaultOptions.locale?.options?.weekStartsOn ??
335
+ 0;
336
+
337
+ const originalDate = toDate(date, options?.in);
338
+
339
+ if (!isValid(originalDate)) {
340
+ throw new RangeError("Invalid time value");
341
+ }
342
+
343
+ let parts = formatStr
344
+ .match(longFormattingTokensRegExp)
345
+ .map((substring) => {
346
+ const firstCharacter = substring[0];
347
+ if (firstCharacter === "p" || firstCharacter === "P") {
348
+ const longFormatter = longFormatters[firstCharacter];
349
+ return longFormatter(substring, locale.formatLong);
350
+ }
351
+ return substring;
352
+ })
353
+ .join("")
354
+ .match(formattingTokensRegExp)
355
+ .map((substring) => {
356
+ // Replace two single quote characters with one single quote character
357
+ if (substring === "''") {
358
+ return { isToken: false, value: "'" };
359
+ }
360
+
361
+ const firstCharacter = substring[0];
362
+ if (firstCharacter === "'") {
363
+ return { isToken: false, value: cleanEscapedString(substring) };
364
+ }
365
+
366
+ if (formatters[firstCharacter]) {
367
+ return { isToken: true, value: substring };
368
+ }
369
+
370
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
371
+ throw new RangeError(
372
+ "Format string contains an unescaped latin alphabet character `" +
373
+ firstCharacter +
374
+ "`",
375
+ );
376
+ }
377
+
378
+ return { isToken: false, value: substring };
379
+ });
380
+
381
+ // invoke localize preprocessor (only for french locales at the moment)
382
+ if (locale.localize.preprocessor) {
383
+ parts = locale.localize.preprocessor(originalDate, parts);
384
+ }
385
+
386
+ const formatterOptions = {
387
+ firstWeekContainsDate,
388
+ weekStartsOn,
389
+ locale,
390
+ };
391
+
392
+ return parts
393
+ .map((part) => {
394
+ if (!part.isToken) return part.value;
395
+
396
+ const token = part.value;
397
+
398
+ if (
399
+ (!options?.useAdditionalWeekYearTokens &&
400
+ isProtectedWeekYearToken(token)) ||
401
+ (!options?.useAdditionalDayOfYearTokens &&
402
+ isProtectedDayOfYearToken(token))
403
+ ) {
404
+ warnOrThrowProtectedError(token, formatStr, String(date));
405
+ }
406
+
407
+ const formatter = formatters[token[0]];
408
+ return formatter(originalDate, token, locale.localize, formatterOptions);
409
+ })
410
+ .join("");
411
+ }
412
+
413
+ function cleanEscapedString(input) {
414
+ const matched = input.match(escapedStringRegExp);
415
+
416
+ if (!matched) {
417
+ return input;
418
+ }
419
+
420
+ return matched[1].replace(doubleQuoteRegExp, "'");
421
+ }
422
+
423
+ export { format as default, format, format as formatDate, formatters, longFormatters };
@@ -0,0 +1,34 @@
1
+ import { differenceInCalendarDays } from './differenceInCalendarDays.js';
2
+ import { startOfYear } from './startOfYear.js';
3
+ import { toDate } from './toDate.js';
4
+
5
+ /**
6
+ * The {@link getDayOfYear} function options.
7
+ */
8
+
9
+ /**
10
+ * @name getDayOfYear
11
+ * @category Day Helpers
12
+ * @summary Get the day of the year of the given date.
13
+ *
14
+ * @description
15
+ * Get the day of the year of the given date.
16
+ *
17
+ * @param date - The given date
18
+ * @param options - The options
19
+ *
20
+ * @returns The day of year
21
+ *
22
+ * @example
23
+ * // Which day of the year is 2 July 2014?
24
+ * const result = getDayOfYear(new Date(2014, 6, 2))
25
+ * //=> 183
26
+ */
27
+ function getDayOfYear(date, options) {
28
+ const _date = toDate(date, options?.in);
29
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
30
+ const dayOfYear = diff + 1;
31
+ return dayOfYear;
32
+ }
33
+
34
+ export { getDayOfYear as default, getDayOfYear };
@@ -0,0 +1,36 @@
1
+ import { constructFrom } from './constructFrom.js';
2
+ import { toDate } from './toDate.js';
3
+
4
+ /**
5
+ * The {@link getDaysInMonth} function options.
6
+ */
7
+
8
+ /**
9
+ * @name getDaysInMonth
10
+ * @category Month Helpers
11
+ * @summary Get the number of days in a month of the given date.
12
+ *
13
+ * @description
14
+ * Get the number of days in a month of the given date, considering the context if provided.
15
+ *
16
+ * @param date - The given date
17
+ * @param options - An object with options
18
+ *
19
+ * @returns The number of days in a month
20
+ *
21
+ * @example
22
+ * // How many days are in February 2000?
23
+ * const result = getDaysInMonth(new Date(2000, 1))
24
+ * //=> 29
25
+ */
26
+ function getDaysInMonth(date, options) {
27
+ const _date = toDate(date, options?.in);
28
+ const year = _date.getFullYear();
29
+ const monthIndex = _date.getMonth();
30
+ const lastDayOfMonth = constructFrom(_date, 0);
31
+ lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
32
+ lastDayOfMonth.setHours(0, 0, 0, 0);
33
+ return lastDayOfMonth.getDate();
34
+ }
35
+
36
+ export { getDaysInMonth as default, getDaysInMonth };
@@ -0,0 +1,31 @@
1
+ import { getDefaultOptions as getDefaultOptions$1 } from './_lib/defaultOptions.js';
2
+
3
+ /**
4
+ * @name getDefaultOptions
5
+ * @category Common Helpers
6
+ * @summary Get default options.
7
+ * @pure false
8
+ *
9
+ * @description
10
+ * Returns an object that contains defaults for
11
+ * `options.locale`, `options.weekStartsOn` and `options.firstWeekContainsDate`
12
+ * arguments for all functions.
13
+ *
14
+ * You can change these with [setDefaultOptions](https://date-fns.org/docs/setDefaultOptions).
15
+ *
16
+ * @returns The default options
17
+ *
18
+ * @example
19
+ * const result = getDefaultOptions()
20
+ * //=> {}
21
+ *
22
+ * @example
23
+ * setDefaultOptions({ weekStarsOn: 1, firstWeekContainsDate: 4 })
24
+ * const result = getDefaultOptions()
25
+ * //=> { weekStarsOn: 1, firstWeekContainsDate: 4 }
26
+ */
27
+ function getDefaultOptions() {
28
+ return Object.assign({}, getDefaultOptions$1());
29
+ }
30
+
31
+ export { getDefaultOptions as default, getDefaultOptions };
@@ -0,0 +1,33 @@
1
+ import { toDate } from './toDate.js';
2
+
3
+ /**
4
+ * The {@link getISODay} function options.
5
+ */
6
+
7
+ /**
8
+ * @name getISODay
9
+ * @category Weekday Helpers
10
+ * @summary Get the day of the ISO week of the given date.
11
+ *
12
+ * @description
13
+ * Get the day of the ISO week of the given date,
14
+ * which is 7 for Sunday, 1 for Monday etc.
15
+ *
16
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
17
+ *
18
+ * @param date - The given date
19
+ * @param options - An object with options
20
+ *
21
+ * @returns The day of ISO week
22
+ *
23
+ * @example
24
+ * // Which day of the ISO week is 26 February 2012?
25
+ * const result = getISODay(new Date(2012, 1, 26))
26
+ * //=> 7
27
+ */
28
+ function getISODay(date, options) {
29
+ const day = toDate(date, options?.in).getDay();
30
+ return day === 0 ? 7 : day;
31
+ }
32
+
33
+ export { getISODay as default, getISODay };
@@ -0,0 +1,40 @@
1
+ import { millisecondsInWeek } from './constants.js';
2
+ import { startOfISOWeek } from './startOfISOWeek.js';
3
+ import { startOfISOWeekYear } from './startOfISOWeekYear.js';
4
+ import { toDate } from './toDate.js';
5
+
6
+ /**
7
+ * The {@link getISOWeek} function options.
8
+ */
9
+
10
+ /**
11
+ * @name getISOWeek
12
+ * @category ISO Week Helpers
13
+ * @summary Get the ISO week of the given date.
14
+ *
15
+ * @description
16
+ * Get the ISO week of the given date.
17
+ *
18
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
19
+ *
20
+ * @param date - The given date
21
+ * @param options - The options
22
+ *
23
+ * @returns The ISO week
24
+ *
25
+ * @example
26
+ * // Which week of the ISO-week numbering year is 2 January 2005?
27
+ * const result = getISOWeek(new Date(2005, 0, 2))
28
+ * //=> 53
29
+ */
30
+ function getISOWeek(date, options) {
31
+ const _date = toDate(date, options?.in);
32
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
33
+
34
+ // Round the number of weeks to the nearest integer because the number of
35
+ // milliseconds in a week is not constant (e.g. it's different in the week of
36
+ // the daylight saving time clock shift).
37
+ return Math.round(diff / millisecondsInWeek) + 1;
38
+ }
39
+
40
+ export { getISOWeek as default, getISOWeek };
@@ -0,0 +1,52 @@
1
+ import { constructFrom } from './constructFrom.js';
2
+ import { startOfISOWeek } from './startOfISOWeek.js';
3
+ import { toDate } from './toDate.js';
4
+
5
+ /**
6
+ * The {@link getISOWeekYear} function options.
7
+ */
8
+
9
+ /**
10
+ * @name getISOWeekYear
11
+ * @category ISO Week-Numbering Year Helpers
12
+ * @summary Get the ISO week-numbering year of the given date.
13
+ *
14
+ * @description
15
+ * Get the ISO week-numbering year of the given date,
16
+ * which always starts 3 days before the year's first Thursday.
17
+ *
18
+ * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
19
+ *
20
+ * @param date - The given date
21
+ *
22
+ * @returns The ISO week-numbering year
23
+ *
24
+ * @example
25
+ * // Which ISO-week numbering year is 2 January 2005?
26
+ * const result = getISOWeekYear(new Date(2005, 0, 2))
27
+ * //=> 2004
28
+ */
29
+ function getISOWeekYear(date, options) {
30
+ const _date = toDate(date, options?.in);
31
+ const year = _date.getFullYear();
32
+
33
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
34
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
35
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
36
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
37
+
38
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
39
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
40
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
41
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
42
+
43
+ if (_date.getTime() >= startOfNextYear.getTime()) {
44
+ return year + 1;
45
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
46
+ return year;
47
+ } else {
48
+ return year - 1;
49
+ }
50
+ }
51
+
52
+ export { getISOWeekYear as default, getISOWeekYear };