@arc-ui/components 12.0.0-beta.5 → 12.0.0-beta.6

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 (339) hide show
  1. package/dist/Alert/Alert.cjs.js +9 -10
  2. package/dist/Alert/Alert.esm.js +4 -5
  3. package/dist/Alert/styles.css +1 -0
  4. package/dist/Align/Align.cjs.js +7 -8
  5. package/dist/Align/Align.esm.js +1 -2
  6. package/dist/Align/styles.css +1 -0
  7. package/dist/AppButton/AppButton.cjs.js +4 -3
  8. package/dist/AppButton/AppButton.esm.js +4 -3
  9. package/dist/AppButton/styles.css +1 -0
  10. package/dist/Avatar/Avatar.cjs.js +7 -8
  11. package/dist/Avatar/Avatar.esm.js +7 -8
  12. package/dist/Avatar/styles.css +1 -0
  13. package/dist/AvatarGroup/AvatarGroup.cjs.js +14 -15
  14. package/dist/AvatarGroup/AvatarGroup.esm.js +7 -8
  15. package/dist/AvatarGroup/styles.css +1 -0
  16. package/dist/Badge/Badge.cjs.js +4 -5
  17. package/dist/Badge/Badge.esm.js +1 -2
  18. package/dist/Badge/styles.css +1 -0
  19. package/dist/Box/Box.cjs.js +6 -6
  20. package/dist/Box/Box.esm.js +2 -2
  21. package/dist/Box/styles.css +1 -0
  22. package/dist/BrandLogo/BrandLogo.cjs.js +3 -4
  23. package/dist/BrandLogo/BrandLogo.esm.js +3 -4
  24. package/dist/BrandLogo/styles.css +1 -0
  25. package/dist/Breadcrumbs/Breadcrumbs.cjs.js +4 -5
  26. package/dist/Breadcrumbs/Breadcrumbs.esm.js +4 -5
  27. package/dist/Breadcrumbs/styles.css +1 -0
  28. package/dist/Button/Button.cjs.js +5 -6
  29. package/dist/Button/Button.esm.js +5 -6
  30. package/dist/Button/styles.css +1 -0
  31. package/dist/ButtonV2/ButtonV2.cjs.js +4 -5
  32. package/dist/ButtonV2/ButtonV2.esm.js +4 -5
  33. package/dist/ButtonV2/styles.css +1 -0
  34. package/dist/Calendar/Calendar.cjs.js +9 -10
  35. package/dist/Calendar/Calendar.esm.js +9 -10
  36. package/dist/Calendar/styles.css +1 -0
  37. package/dist/CardFooter/CardFooter.cjs.js +17 -0
  38. package/dist/CardFooter/CardFooter.esm.js +9 -0
  39. package/dist/CardFooter/package.json +7 -0
  40. package/dist/CardFooter/styles.css +1 -0
  41. package/dist/CardHeading/CardHeading.cjs.js +14 -0
  42. package/dist/CardHeading/CardHeading.esm.js +6 -0
  43. package/dist/CardHeading/package.json +7 -0
  44. package/dist/CardHeading/styles.css +1 -0
  45. package/dist/Checkbox/Checkbox.cjs.js +8 -9
  46. package/dist/Checkbox/Checkbox.esm.js +8 -9
  47. package/dist/Checkbox/styles.css +1 -0
  48. package/dist/Columns/Columns.cjs.js +2 -3
  49. package/dist/Columns/Columns.esm.js +2 -3
  50. package/dist/Columns/styles.css +1 -0
  51. package/dist/ConditionalWrapper/ConditionalWrapper.cjs.js +10 -0
  52. package/dist/ConditionalWrapper/ConditionalWrapper.esm.js +2 -0
  53. package/dist/ConditionalWrapper/package.json +7 -0
  54. package/dist/DatePicker/DatePicker.cjs.js +18 -22
  55. package/dist/DatePicker/DatePicker.esm.js +18 -22
  56. package/dist/DatePicker/styles.css +1 -0
  57. package/dist/Disclosure/Disclosure.cjs.js +8 -9
  58. package/dist/Disclosure/Disclosure.esm.js +4 -5
  59. package/dist/Disclosure/styles.css +1 -0
  60. package/dist/DisclosureMini/DisclosureMini.cjs.js +5 -6
  61. package/dist/DisclosureMini/DisclosureMini.esm.js +5 -6
  62. package/dist/DisclosureMini/styles.css +1 -0
  63. package/dist/Elevation/Elevation.cjs.js +5 -5
  64. package/dist/Elevation/Elevation.esm.js +1 -1
  65. package/dist/Elevation/styles.css +1 -0
  66. package/dist/Filter/Filter.cjs.js +4 -4
  67. package/dist/Filter/Filter.esm.js +4 -4
  68. package/dist/Filter/styles.css +1 -0
  69. package/dist/FormControl/FormControl.cjs.js +7 -8
  70. package/dist/FormControl/FormControl.esm.js +7 -8
  71. package/dist/FormControl/styles.css +1 -0
  72. package/dist/Grid/Grid.cjs.js +2 -3
  73. package/dist/Grid/Grid.esm.js +2 -3
  74. package/dist/Grid/styles.css +1 -0
  75. package/dist/Group/Group.cjs.js +3 -3
  76. package/dist/Group/Group.esm.js +3 -3
  77. package/dist/Group/styles.css +1 -0
  78. package/dist/Heading/Heading.cjs.js +3 -4
  79. package/dist/Heading/Heading.esm.js +3 -4
  80. package/dist/Heading/styles.css +1 -0
  81. package/dist/HeroButton/HeroButton.cjs.js +4 -5
  82. package/dist/HeroButton/HeroButton.esm.js +4 -5
  83. package/dist/HeroButton/styles.css +1 -0
  84. package/dist/Hidden/Hidden.cjs.js +5 -5
  85. package/dist/Hidden/Hidden.esm.js +1 -1
  86. package/dist/Hidden/styles.css +1 -0
  87. package/dist/Icon/Icon.cjs.js +3 -4
  88. package/dist/Icon/Icon.esm.js +3 -4
  89. package/dist/Icon/styles.css +1 -0
  90. package/dist/Image/Image.cjs.js +2 -3
  91. package/dist/Image/Image.esm.js +2 -3
  92. package/dist/Image/styles.css +1 -0
  93. package/dist/ImpactCard/ImpactCard.cjs.js +15 -15
  94. package/dist/ImpactCard/ImpactCard.esm.js +9 -9
  95. package/dist/ImpactCard/styles.css +1 -0
  96. package/dist/InformationCard/InformationCard.cjs.js +25 -25
  97. package/dist/InformationCard/InformationCard.esm.js +13 -13
  98. package/dist/InformationCard/styles.css +1 -0
  99. package/dist/Link/Link.cjs.js +11 -12
  100. package/dist/Link/Link.esm.js +4 -5
  101. package/dist/Link/styles.css +1 -0
  102. package/dist/Markup/Markup.cjs.js +6 -6
  103. package/dist/Markup/Markup.esm.js +2 -2
  104. package/dist/Markup/styles.css +1 -0
  105. package/dist/MediaCard/MediaCard.cjs.js +14 -14
  106. package/dist/MediaCard/MediaCard.esm.js +14 -14
  107. package/dist/MediaCard/styles.css +1 -0
  108. package/dist/Modal/Modal.cjs.js +43 -1200
  109. package/dist/Modal/Modal.esm.js +12 -1168
  110. package/dist/Modal/styles.css +1 -0
  111. package/dist/Pagination/Pagination.cjs.js +12 -13
  112. package/dist/Pagination/Pagination.esm.js +3 -4
  113. package/dist/Pagination/styles.css +1 -0
  114. package/dist/PaginationSimple/PaginationSimple.cjs.js +9 -10
  115. package/dist/PaginationSimple/PaginationSimple.esm.js +3 -4
  116. package/dist/PaginationSimple/styles.css +1 -0
  117. package/dist/Poster/Poster.cjs.js +4 -5
  118. package/dist/Poster/Poster.esm.js +4 -5
  119. package/dist/Poster/styles.css +1 -0
  120. package/dist/ProgressBar/ProgressBar.cjs.js +12 -13
  121. package/dist/ProgressBar/ProgressBar.esm.js +6 -7
  122. package/dist/ProgressBar/styles.css +1 -0
  123. package/dist/ProgressStepper/ProgressStepper.cjs.js +5 -6
  124. package/dist/ProgressStepper/ProgressStepper.esm.js +5 -6
  125. package/dist/ProgressStepper/styles.css +1 -0
  126. package/dist/RadioGroup/RadioGroup.cjs.js +8 -9
  127. package/dist/RadioGroup/RadioGroup.esm.js +8 -9
  128. package/dist/RadioGroup/styles.css +1 -0
  129. package/dist/Rule/Rule.cjs.js +5 -5
  130. package/dist/Rule/Rule.esm.js +2 -2
  131. package/dist/Rule/styles.css +1 -0
  132. package/dist/ScrollToTop/ScrollToTop.cjs.js +8 -9
  133. package/dist/ScrollToTop/ScrollToTop.esm.js +3 -4
  134. package/dist/ScrollToTop/styles.css +1 -0
  135. package/dist/Section/Section.cjs.js +2 -2
  136. package/dist/Section/Section.esm.js +2 -2
  137. package/dist/Section/styles.css +1 -0
  138. package/dist/Select/Select.cjs.js +1165 -91
  139. package/dist/Select/Select.esm.js +1076 -21
  140. package/dist/Select/styles.css +1 -0
  141. package/dist/SiteFooter/SiteFooter.cjs.js +7 -8
  142. package/dist/SiteFooter/SiteFooter.esm.js +7 -8
  143. package/dist/SiteFooter/styles.css +1 -0
  144. package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +10 -12
  145. package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +10 -12
  146. package/dist/SiteHeaderV2/styles.css +1 -0
  147. package/dist/SkipLink/SkipLink.cjs.js +4 -4
  148. package/dist/SkipLink/SkipLink.esm.js +3 -3
  149. package/dist/SkipLink/styles.css +1 -0
  150. package/dist/Surface/Surface.cjs.js +2 -2
  151. package/dist/Surface/Surface.esm.js +2 -2
  152. package/dist/Surface/styles.css +1 -0
  153. package/dist/Switch/Switch.cjs.js +16 -18
  154. package/dist/Switch/Switch.esm.js +12 -14
  155. package/dist/Switch/styles.css +1 -0
  156. package/dist/Tabs/Tabs.cjs.js +9 -11
  157. package/dist/Tabs/Tabs.esm.js +9 -11
  158. package/dist/Tabs/styles.css +1 -0
  159. package/dist/Tag/Tag.cjs.js +5 -6
  160. package/dist/Tag/Tag.esm.js +5 -6
  161. package/dist/Tag/styles.css +1 -0
  162. package/dist/Text/Text.cjs.js +3 -4
  163. package/dist/Text/Text.esm.js +3 -4
  164. package/dist/Text/styles.css +1 -0
  165. package/dist/TextArea/TextArea.cjs.js +55 -56
  166. package/dist/TextArea/TextArea.esm.js +51 -52
  167. package/dist/TextArea/styles.css +1 -0
  168. package/dist/TextInput/TextInput.cjs.js +9 -10
  169. package/dist/TextInput/TextInput.esm.js +9 -10
  170. package/dist/TextInput/styles.css +1 -0
  171. package/dist/Theme/Theme.cjs.js +5 -5
  172. package/dist/Theme/Theme.esm.js +1 -1
  173. package/dist/Theme/styles.css +1 -0
  174. package/dist/ThemeIcon/ThemeIcon.cjs.js +3 -4
  175. package/dist/ThemeIcon/ThemeIcon.esm.js +3 -4
  176. package/dist/ThemeIcon/styles.css +1 -0
  177. package/dist/Toast/Toast.cjs.js +8 -10
  178. package/dist/Toast/Toast.esm.js +8 -10
  179. package/dist/Toast/styles.css +1 -0
  180. package/dist/Truncate/Truncate.cjs.js +3 -3
  181. package/dist/Truncate/Truncate.esm.js +1 -1
  182. package/dist/Truncate/styles.css +1 -0
  183. package/dist/TypographyCard/TypographyCard.cjs.js +13 -13
  184. package/dist/TypographyCard/TypographyCard.esm.js +8 -8
  185. package/dist/TypographyCard/styles.css +1 -0
  186. package/dist/UniversalHeader/UniversalHeader.cjs.js +3 -3
  187. package/dist/UniversalHeader/UniversalHeader.esm.js +3 -3
  188. package/dist/UniversalHeader/styles.css +1 -0
  189. package/dist/VerticalSpace/VerticalSpace.cjs.js +2 -2
  190. package/dist/VerticalSpace/VerticalSpace.esm.js +2 -2
  191. package/dist/VerticalSpace/styles.css +1 -0
  192. package/dist/VideoPlayer/VideoPlayer.cjs.js +11 -12
  193. package/dist/VideoPlayer/VideoPlayer.esm.js +8 -9
  194. package/dist/VideoPlayer/styles.css +1 -0
  195. package/dist/Visible/Visible.cjs.js +5 -5
  196. package/dist/Visible/Visible.esm.js +1 -1
  197. package/dist/Visible/styles.css +1 -0
  198. package/dist/VisuallyHidden/VisuallyHidden.cjs.js +2 -1
  199. package/dist/VisuallyHidden/VisuallyHidden.esm.js +2 -1
  200. package/dist/VisuallyHidden/styles.css +1 -0
  201. package/dist/_shared/cjs/{Avatar-fc0d9b8b.js → Avatar-9277512a.js} +11 -12
  202. package/dist/_shared/cjs/{BrandLogo-1d2ca2c7.js → BrandLogo-ce65cd74.js} +7 -8
  203. package/dist/_shared/cjs/{Breadcrumbs-7af0af2c.js → Breadcrumbs-c7821aa9.js} +12 -12
  204. package/dist/_shared/cjs/{BtIconArrowRight.esm-5989f2ca.js → BtIconArrowRight.esm-6053bb79.js} +0 -8
  205. package/dist/_shared/cjs/{Button-7d891a89.js → Button-ea665c9c.js} +12 -13
  206. package/dist/_shared/cjs/{ButtonV2-b2db3f46.js → ButtonV2-373877da.js} +11 -11
  207. package/dist/_shared/cjs/{Calendar-649cc139.js → Calendar-e5184158.js} +912 -912
  208. package/dist/_shared/cjs/{CardFooter-5414bc4f.js → CardFooter-a1bb3ded.js} +3 -3
  209. package/dist/_shared/cjs/CardHeading-3ddcf774.js +16 -0
  210. package/dist/_shared/cjs/{Checkbox-0e423653.js → Checkbox-850dcf99.js} +11 -11
  211. package/dist/_shared/cjs/{Columns-1224bdff.js → Columns-5c6bab74.js} +9 -10
  212. package/dist/_shared/cjs/Combination-854a36ce.js +1203 -0
  213. package/dist/_shared/cjs/DatePicker-2bf10a10.js +956 -0
  214. package/dist/_shared/cjs/{DisclosureMini-c01ecce0.js → DisclosureMini-c730c24d.js} +10 -10
  215. package/dist/_shared/cjs/{Filter-3b897d92.js → Filter-c42eee70.js} +14 -14
  216. package/dist/_shared/cjs/{FormControl-88d48f42.js → FormControl-5c963e6e.js} +12 -12
  217. package/dist/_shared/cjs/{Grid-9e91fb3d.js → Grid-69ed0e5c.js} +10 -11
  218. package/dist/_shared/cjs/{Group-3d5ea240.js → Group-5233a907.js} +9 -9
  219. package/dist/_shared/cjs/{Heading-fb63844f.js → Heading-14378b72.js} +7 -8
  220. package/dist/_shared/cjs/{HeroButton-0586a7c4.js → HeroButton-db7d03d6.js} +11 -11
  221. package/dist/_shared/cjs/{Icon-0ec0c1fb.js → Icon-7f1e8a19.js} +8 -9
  222. package/dist/_shared/cjs/{Image-e9a5a326.js → Image-c8969ad9.js} +9 -10
  223. package/dist/_shared/cjs/{MediaCard-8f41b411.js → MediaCard-4ff9f5c0.js} +18 -18
  224. package/dist/_shared/cjs/{Poster-b7242b37.js → Poster-8fba5492.js} +13 -14
  225. package/dist/_shared/cjs/{ProgressStepper-fb8405c2.js → ProgressStepper-aaff6b51.js} +13 -13
  226. package/dist/_shared/cjs/{RadioGroup-a4186267.js → RadioGroup-6142dceb.js} +14 -14
  227. package/dist/_shared/cjs/{Section-ecfc659b.js → Section-46646353.js} +5 -5
  228. package/dist/_shared/cjs/{SiteFooter-7c4072b5.js → SiteFooter-cfe7163f.js} +11 -11
  229. package/dist/_shared/cjs/{SiteHeaderV2-94687999.js → SiteHeaderV2-043d976a.js} +63 -65
  230. package/dist/_shared/cjs/Surface-7500f314.js +174 -0
  231. package/dist/_shared/cjs/{Tabs-75c34f43.js → Tabs-bd1f208d.js} +24 -25
  232. package/dist/_shared/cjs/{Tag-452048f6.js → Tag-4eb2ed9e.js} +8 -8
  233. package/dist/_shared/cjs/{Text-1c1110a4.js → Text-284a7314.js} +7 -8
  234. package/dist/_shared/cjs/{TextInput-762e2309.js → TextInput-bcc3f86c.js} +12 -12
  235. package/dist/_shared/cjs/{ThemeIcon-ee814862.js → ThemeIcon-c3dc056d.js} +8 -9
  236. package/dist/_shared/cjs/{Toast-d06a89e0.js → Toast-69020185.js} +16 -17
  237. package/dist/_shared/cjs/{UniversalHeader-f6d9c63a.js → UniversalHeader-07be88fd.js} +6 -6
  238. package/dist/_shared/cjs/{VerticalSpace-e128ec68.js → VerticalSpace-973deefe.js} +5 -5
  239. package/dist/_shared/cjs/{VisuallyHidden-b0de4c7b.js → VisuallyHidden-25393f58.js} +3 -2
  240. package/dist/_shared/cjs/{component-df82bc05.js → component-4e71e3d3.js} +4 -4
  241. package/dist/_shared/cjs/{Combination-3a639f6d.js → floating-ui.react-dom-08b8b87c.js} +37 -1103
  242. package/dist/_shared/cjs/{index-7aa7f96a.js → index-568bc1da.js} +8 -1
  243. package/dist/_shared/cjs/{index-0c6319ec.js → index-677557a4.js} +1 -1
  244. package/dist/_shared/cjs/{index-3d629205.js → index-6cbaf5e0.js} +19 -1
  245. package/dist/_shared/cjs/{index-41b09e85.js → index-c137700a.js} +20 -1
  246. package/dist/_shared/cjs/{index-996dec94.js → index-dbab0ad6.js} +1 -1
  247. package/dist/_shared/cjs/{index.es-16759329.js → index.es-ba095ee5.js} +1 -1
  248. package/dist/_shared/cjs/{index-df60851b.js → index.es-c26e8978.js} +20 -6
  249. package/dist/_shared/esm/{Avatar-38cc0595.js → Avatar-b5ac0a89.js} +5 -6
  250. package/dist/_shared/esm/{BrandLogo-7ed8aeda.js → BrandLogo-fb863b5b.js} +2 -3
  251. package/dist/_shared/esm/{Breadcrumbs-9078b68e.js → Breadcrumbs-01ebed9b.js} +8 -8
  252. package/dist/_shared/esm/BtIconArrowRight.esm-93da96bb.js +24 -0
  253. package/dist/_shared/esm/{Button-dde2b46a.js → Button-1491784f.js} +4 -5
  254. package/dist/_shared/esm/{ButtonV2-49cd0615.js → ButtonV2-f9019e00.js} +3 -3
  255. package/dist/_shared/esm/{Calendar-60591442.js → Calendar-5c2fb044.js} +889 -889
  256. package/dist/_shared/esm/{CardFooter-c79fb2db.js → CardFooter-e4380cda.js} +3 -3
  257. package/dist/_shared/esm/CardHeading-4223432d.js +10 -0
  258. package/dist/_shared/esm/{Checkbox-0baca464.js → Checkbox-97def257.js} +5 -5
  259. package/dist/_shared/esm/{Columns-6a8f6fbb.js → Columns-9aa5df4a.js} +1 -2
  260. package/dist/_shared/esm/Combination-2af75870.js +1163 -0
  261. package/dist/_shared/esm/DatePicker-2d891441.js +927 -0
  262. package/dist/_shared/esm/{DisclosureMini-38f4c459.js → DisclosureMini-6292f721.js} +4 -4
  263. package/dist/_shared/esm/{Filter-49dcf5ce.js → Filter-71e06965.js} +11 -11
  264. package/dist/_shared/esm/{FormControl-d873f7fa.js → FormControl-e0acdf7a.js} +5 -5
  265. package/dist/_shared/esm/{Grid-fb9fc522.js → Grid-727d05d6.js} +1 -2
  266. package/dist/_shared/esm/{Group-66196f07.js → Group-b1b14ab4.js} +2 -2
  267. package/dist/_shared/esm/{Heading-906c7c7c.js → Heading-0dfbdb24.js} +2 -3
  268. package/dist/_shared/esm/{HeroButton-7ea692bf.js → HeroButton-bb983125.js} +3 -3
  269. package/dist/_shared/esm/{Icon-512f834f.js → Icon-428e8061.js} +2 -3
  270. package/dist/_shared/esm/{Image-57d08939.js → Image-c1dc10b5.js} +1 -2
  271. package/dist/_shared/esm/{MediaCard-c12d89ea.js → MediaCard-d83b5561.js} +10 -10
  272. package/dist/_shared/esm/{Poster-e05a8b45.js → Poster-ac72059a.js} +4 -5
  273. package/dist/_shared/esm/{ProgressStepper-189ed0f9.js → ProgressStepper-e3e7b392.js} +4 -4
  274. package/dist/_shared/esm/{RadioGroup-8ff17cbb.js → RadioGroup-0d337240.js} +7 -7
  275. package/dist/_shared/esm/{Section-1acbc06a.js → Section-c1dc6e37.js} +1 -1
  276. package/dist/_shared/esm/{SiteFooter-b65497e8.js → SiteFooter-7e924fb4.js} +6 -6
  277. package/dist/_shared/esm/{SiteHeaderV2-784b3bf8.js → SiteHeaderV2-94b9a407.js} +9 -11
  278. package/dist/_shared/esm/Surface-c425e5e6.js +164 -0
  279. package/dist/_shared/esm/{Tabs-21ac7dfe.js → Tabs-028cee5d.js} +10 -11
  280. package/dist/_shared/esm/{Tag-2513c185.js → Tag-1ae027ee.js} +4 -4
  281. package/dist/_shared/esm/{Text-a46fb76b.js → Text-96d8a35f.js} +2 -3
  282. package/dist/_shared/esm/{TextInput-94c7b1a4.js → TextInput-8e3b81bf.js} +5 -5
  283. package/dist/_shared/esm/{ThemeIcon-c2dc41a6.js → ThemeIcon-9fac63d0.js} +2 -3
  284. package/dist/_shared/esm/{Toast-de6ca2f3.js → Toast-ebe2cd97.js} +6 -7
  285. package/dist/_shared/esm/{UniversalHeader-456ad60c.js → UniversalHeader-22ff848b.js} +3 -3
  286. package/dist/_shared/esm/{VerticalSpace-b07cd8e6.js → VerticalSpace-6a3533db.js} +1 -1
  287. package/dist/_shared/esm/VisuallyHidden-cf45ac18.js +12 -0
  288. package/dist/_shared/esm/{component-d0a555cf.js → component-3e60a45e.js} +1 -1
  289. package/dist/_shared/esm/{Combination-ae3a3f08.js → floating-ui.react-dom-1bb71aae.js} +15 -1079
  290. package/dist/_shared/esm/{index-cace3545.js → index-3a2c1ceb.js} +25 -25
  291. package/dist/_shared/esm/{index-f97466e9.js → index-61497bd9.js} +1 -1
  292. package/dist/_shared/esm/{index-605031ca.js → index-ce6dee84.js} +53 -53
  293. package/dist/_shared/esm/{index-4e58de24.js → index-cf208294.js} +21 -3
  294. package/dist/_shared/esm/{index-fa93ec97.js → index-d083425f.js} +1 -1
  295. package/dist/_shared/esm/index-f6cc48d2.js +41 -0
  296. package/dist/_shared/esm/{index-7740883c.js → index-fb8b9df7.js} +9 -2
  297. package/dist/_shared/esm/{index-288c66b5.js → index.es-5496ec12.js} +20 -6
  298. package/dist/_shared/esm/{index.es-1b6d33c2.js → index.es-974af4a2.js} +1 -1
  299. package/dist/index.es.js +8433 -7929
  300. package/dist/index.es.js.map +1 -1
  301. package/dist/index.js +8417 -7913
  302. package/dist/index.js.map +1 -1
  303. package/dist/styles.css +3 -3
  304. package/dist/types/components/CardHeading/index.d.ts +1 -0
  305. package/dist/types/components/ImpactCard/ImpactCard.d.ts +2 -2
  306. package/dist/types/components/MediaCard/MediaCard.d.ts +1 -1
  307. package/dist/types/components/Switch/Switch.d.ts +4 -0
  308. package/dist/types/components/TypographyCard/TypographyCard.d.ts +2 -2
  309. package/dist/types/helpers/index.d.ts +0 -2
  310. package/dist/types/styles.d.ts +3 -3
  311. package/package.json +17 -12
  312. package/dist/_shared/cjs/DatePicker-2417e55b.js +0 -550
  313. package/dist/_shared/cjs/Surface-8599dbe4.js +0 -57
  314. package/dist/_shared/cjs/index-039a9d35.js +0 -23
  315. package/dist/_shared/cjs/index-28447df0.js +0 -23
  316. package/dist/_shared/cjs/index-dcfdd5da.js +0 -11
  317. package/dist/_shared/cjs/suffix-modifier-c8a34402.js +0 -19
  318. package/dist/_shared/esm/BtIconArrowRight.esm-6a17d0ce.js +0 -31
  319. package/dist/_shared/esm/DatePicker-c7bb178e.js +0 -539
  320. package/dist/_shared/esm/Surface-71d21a9e.js +0 -48
  321. package/dist/_shared/esm/VisuallyHidden-06692fd3.js +0 -11
  322. package/dist/_shared/esm/index-5113ed53.js +0 -24
  323. package/dist/_shared/esm/index-6028d797.js +0 -21
  324. package/dist/_shared/esm/index-69089474.js +0 -21
  325. package/dist/_shared/esm/index-a624de47.js +0 -9
  326. package/dist/_shared/esm/suffix-modifier-1ce05abe.js +0 -17
  327. package/dist/types/helpers/filter-data-attrs.d.ts +0 -1
  328. package/dist/types/helpers/suffix-modifier.d.ts +0 -9
  329. package/dist/types/private-components/CardHeading/index.d.ts +0 -1
  330. package/dist/types/private-components/index.d.ts +0 -3
  331. package/dist/_shared/cjs/{ConditionalWrapper-be3b2625.js → ConditionalWrapper-bf944594.js} +0 -0
  332. package/dist/_shared/cjs/{index-7e31a45b.js → index-28fbfd5b.js} +52 -52
  333. package/dist/_shared/cjs/{index-3dd54df1.js → index-6f33b8c0.js} +23 -23
  334. /package/dist/_shared/esm/{ConditionalWrapper-59be8f35.js → ConditionalWrapper-b85979de.js} +0 -0
  335. /package/dist/types/{private-components → components}/CardFooter/CardFooter.d.ts +0 -0
  336. /package/dist/types/{private-components → components}/CardFooter/index.d.ts +0 -0
  337. /package/dist/types/{private-components → components}/CardHeading/CardHeading.d.ts +0 -0
  338. /package/dist/types/{private-components → components}/ConditionalWrapper/ConditionalWrapper.d.ts +0 -0
  339. /package/dist/types/{private-components → components}/ConditionalWrapper/index.d.ts +0 -0
@@ -1,55 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ var index_es = require('./index.es-c26e8978.js');
3
4
  var React = require('react');
4
- var index = require('./index-7e31a45b.js');
5
- var index_es = require('./index.es-16759329.js');
5
+ var index = require('./index-28fbfd5b.js');
6
+ var index_es$1 = require('./index.es-ba095ee5.js');
6
7
  var useMediaQuery = require('./use-media-query-d34c83b9.js');
7
- var index$1 = require('./index-df60851b.js');
8
- var index$2 = require('./index-9947ac13.js');
9
- var Text = require('./Text-1c1110a4.js');
10
- var VisuallyHidden = require('./VisuallyHidden-b0de4c7b.js');
11
- var Surface = require('./Surface-8599dbe4.js');
12
- var Heading = require('./Heading-fb63844f.js');
8
+ var index$1 = require('./index-9947ac13.js');
9
+ var Text = require('./Text-284a7314.js');
10
+ var VisuallyHidden = require('./VisuallyHidden-25393f58.js');
11
+ var Surface = require('./Surface-7500f314.js');
12
+ var Heading = require('./Heading-14378b72.js');
13
13
  var BtIconChevronRightMid_esm = require('./BtIconChevronRightMid.esm-3e8d18a9.js');
14
- var Icon = require('./Icon-0ec0c1fb.js');
14
+ var Icon = require('./Icon-7f1e8a19.js');
15
15
 
16
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
17
17
 
18
18
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
19
 
20
- /**
21
- * @name addDays
22
- * @category Day Helpers
23
- * @summary Add the specified number of days to the given date.
24
- *
25
- * @description
26
- * Add the specified number of days to the given date.
27
- *
28
- * @param {Date|Number} date - the date to be changed
29
- * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
30
- * @returns {Date} - the new date with the days added
31
- * @throws {TypeError} - 2 arguments required
32
- *
33
- * @example
34
- * // Add 10 days to 1 September 2014:
35
- * const result = addDays(new Date(2014, 8, 1), 10)
36
- * //=> Thu Sep 11 2014 00:00:00
37
- */
38
- function addDays(dirtyDate, dirtyAmount) {
39
- index.requiredArgs(2, arguments);
40
- var date = index.toDate(dirtyDate);
41
- var amount = index.toInteger(dirtyAmount);
42
- if (isNaN(amount)) {
43
- return new Date(NaN);
44
- }
45
- if (!amount) {
46
- // If 0 days, no-op to avoid changing times in the hour before end of DST
47
- return date;
48
- }
49
- date.setDate(date.getDate() + amount);
50
- return date;
51
- }
52
-
53
20
  /**
54
21
  * @name addMonths
55
22
  * @category Month Helpers
@@ -110,532 +77,339 @@ function addMonths(dirtyDate, dirtyAmount) {
110
77
  }
111
78
 
112
79
  /**
113
- * @name startOfWeek
114
- * @category Week Helpers
115
- * @summary Return the start of a week for the given date.
116
- *
117
- * @description
118
- * Return the start of a week for the given date.
119
- * The result will be in the local timezone.
120
- *
121
- * @param {Date|Number} date - the original date
122
- * @param {Object} [options] - an object with options.
123
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
124
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
125
- * @returns {Date} the start of a week
126
- * @throws {TypeError} 1 argument required
127
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
128
- *
129
- * @example
130
- * // The start of a week for 2 September 2014 11:55:00:
131
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
132
- * //=> Sun Aug 31 2014 00:00:00
133
- *
134
- * @example
135
- * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
136
- * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
137
- * //=> Mon Sep 01 2014 00:00:00
138
- */
139
- function startOfWeek(dirtyDate, options) {
140
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
141
- index.requiredArgs(1, arguments);
142
- var defaultOptions = index.getDefaultOptions();
143
- var weekStartsOn = index.toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
144
-
145
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
146
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
147
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
148
- }
149
- var date = index.toDate(dirtyDate);
150
- var day = date.getDay();
151
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
152
- date.setDate(date.getDate() - diff);
153
- date.setHours(0, 0, 0, 0);
154
- return date;
155
- }
156
-
157
- /**
158
- * @name addWeeks
159
- * @category Week Helpers
160
- * @summary Add the specified number of weeks to the given date.
80
+ * @name subMonths
81
+ * @category Month Helpers
82
+ * @summary Subtract the specified number of months from the given date.
161
83
  *
162
84
  * @description
163
- * Add the specified number of week to the given date.
85
+ * Subtract the specified number of months from the given date.
164
86
  *
165
87
  * @param {Date|Number} date - the date to be changed
166
- * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
167
- * @returns {Date} the new date with the weeks added
88
+ * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
89
+ * @returns {Date} the new date with the months subtracted
168
90
  * @throws {TypeError} 2 arguments required
169
91
  *
170
92
  * @example
171
- * // Add 4 weeks to 1 September 2014:
172
- * const result = addWeeks(new Date(2014, 8, 1), 4)
173
- * //=> Mon Sep 29 2014 00:00:00
93
+ * // Subtract 5 months from 1 February 2015:
94
+ * const result = subMonths(new Date(2015, 1, 1), 5)
95
+ * //=> Mon Sep 01 2014 00:00:00
174
96
  */
175
- function addWeeks(dirtyDate, dirtyAmount) {
97
+ function subMonths(dirtyDate, dirtyAmount) {
176
98
  index.requiredArgs(2, arguments);
177
99
  var amount = index.toInteger(dirtyAmount);
178
- var days = amount * 7;
179
- return addDays(dirtyDate, days);
100
+ return addMonths(dirtyDate, -amount);
180
101
  }
181
102
 
182
103
  /**
183
- * @name addYears
184
- * @category Year Helpers
185
- * @summary Add the specified number of years to the given date.
104
+ * @name startOfMonth
105
+ * @category Month Helpers
106
+ * @summary Return the start of a month for the given date.
186
107
  *
187
108
  * @description
188
- * Add the specified number of years to the given date.
109
+ * Return the start of a month for the given date.
110
+ * The result will be in the local timezone.
189
111
  *
190
- * @param {Date|Number} date - the date to be changed
191
- * @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
192
- * @returns {Date} the new date with the years added
193
- * @throws {TypeError} 2 arguments required
112
+ * @param {Date|Number} date - the original date
113
+ * @returns {Date} the start of a month
114
+ * @throws {TypeError} 1 argument required
194
115
  *
195
116
  * @example
196
- * // Add 5 years to 1 September 2014:
197
- * const result = addYears(new Date(2014, 8, 1), 5)
198
- * //=> Sun Sep 01 2019 00:00:00
117
+ * // The start of a month for 2 September 2014 11:55:00:
118
+ * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
119
+ * //=> Mon Sep 01 2014 00:00:00
199
120
  */
200
- function addYears(dirtyDate, dirtyAmount) {
201
- index.requiredArgs(2, arguments);
202
- var amount = index.toInteger(dirtyAmount);
203
- return addMonths(dirtyDate, amount * 12);
121
+ function startOfMonth(dirtyDate) {
122
+ index.requiredArgs(1, arguments);
123
+ var date = index.toDate(dirtyDate);
124
+ date.setDate(1);
125
+ date.setHours(0, 0, 0, 0);
126
+ return date;
204
127
  }
205
128
 
129
+ var containsDate = function (dates, compareDate) {
130
+ return dates.map(function (date) { return date.getTime(); }).includes(compareDate.getTime());
131
+ };
132
+
206
133
  /**
207
- * @name compareAsc
208
- * @category Common Helpers
209
- * @summary Compare the two dates and return -1, 0 or 1.
134
+ * @name getMonth
135
+ * @category Month Helpers
136
+ * @summary Get the month of the given date.
210
137
  *
211
138
  * @description
212
- * Compare the two dates and return 1 if the first date is after the second,
213
- * -1 if the first date is before the second or 0 if dates are equal.
214
- *
215
- * @param {Date|Number} dateLeft - the first date to compare
216
- * @param {Date|Number} dateRight - the second date to compare
217
- * @returns {Number} the result of the comparison
218
- * @throws {TypeError} 2 arguments required
139
+ * Get the month of the given date.
219
140
  *
220
- * @example
221
- * // Compare 11 February 1987 and 10 July 1989:
222
- * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
223
- * //=> -1
141
+ * @param {Date|Number} date - the given date
142
+ * @returns {Number} the month
143
+ * @throws {TypeError} 1 argument required
224
144
  *
225
145
  * @example
226
- * // Sort the array of dates:
227
- * const result = [
228
- * new Date(1995, 6, 2),
229
- * new Date(1987, 1, 11),
230
- * new Date(1989, 6, 10)
231
- * ].sort(compareAsc)
232
- * //=> [
233
- * // Wed Feb 11 1987 00:00:00,
234
- * // Mon Jul 10 1989 00:00:00,
235
- * // Sun Jul 02 1995 00:00:00
236
- * // ]
146
+ * // Which month is 29 February 2012?
147
+ * const result = getMonth(new Date(2012, 1, 29))
148
+ * //=> 1
237
149
  */
238
- function compareAsc(dirtyDateLeft, dirtyDateRight) {
239
- index.requiredArgs(2, arguments);
240
- var dateLeft = index.toDate(dirtyDateLeft);
241
- var dateRight = index.toDate(dirtyDateRight);
242
- var diff = dateLeft.getTime() - dateRight.getTime();
243
- if (diff < 0) {
244
- return -1;
245
- } else if (diff > 0) {
246
- return 1;
247
- // Return 0 if diff is 0; return NaN if diff is NaN
248
- } else {
249
- return diff;
250
- }
150
+ function getMonth(dirtyDate) {
151
+ index.requiredArgs(1, arguments);
152
+ var date = index.toDate(dirtyDate);
153
+ var month = date.getMonth();
154
+ return month;
251
155
  }
252
156
 
253
157
  /**
254
- * @name endOfDay
255
- * @category Day Helpers
256
- * @summary Return the end of a day for the given date.
158
+ * @name getYear
159
+ * @category Year Helpers
160
+ * @summary Get the year of the given date.
257
161
  *
258
162
  * @description
259
- * Return the end of a day for the given date.
260
- * The result will be in the local timezone.
163
+ * Get the year of the given date.
261
164
  *
262
- * @param {Date|Number} date - the original date
263
- * @returns {Date} the end of a day
165
+ * @param {Date|Number} date - the given date
166
+ * @returns {Number} the year
264
167
  * @throws {TypeError} 1 argument required
265
168
  *
266
169
  * @example
267
- * // The end of a day for 2 September 2014 11:55:00:
268
- * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
269
- * //=> Tue Sep 02 2014 23:59:59.999
170
+ * // Which year is 2 July 2014?
171
+ * const result = getYear(new Date(2014, 6, 2))
172
+ * //=> 2014
270
173
  */
271
- function endOfDay(dirtyDate) {
174
+ function getYear(dirtyDate) {
272
175
  index.requiredArgs(1, arguments);
273
- var date = index.toDate(dirtyDate);
274
- date.setHours(23, 59, 59, 999);
275
- return date;
176
+ return index.toDate(dirtyDate).getFullYear();
276
177
  }
277
178
 
278
179
  /**
279
- * @name endOfMonth
180
+ * @name getDaysInMonth
280
181
  * @category Month Helpers
281
- * @summary Return the end of a month for the given date.
182
+ * @summary Get the number of days in a month of the given date.
282
183
  *
283
184
  * @description
284
- * Return the end of a month for the given date.
285
- * The result will be in the local timezone.
185
+ * Get the number of days in a month of the given date.
286
186
  *
287
- * @param {Date|Number} date - the original date
288
- * @returns {Date} the end of a month
187
+ * @param {Date|Number} date - the given date
188
+ * @returns {Number} the number of days in a month
289
189
  * @throws {TypeError} 1 argument required
290
190
  *
291
191
  * @example
292
- * // The end of a month for 2 September 2014 11:55:00:
293
- * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
294
- * //=> Tue Sep 30 2014 23:59:59.999
192
+ * // How many days are in February 2000?
193
+ * const result = getDaysInMonth(new Date(2000, 1))
194
+ * //=> 29
295
195
  */
296
- function endOfMonth(dirtyDate) {
196
+ function getDaysInMonth(dirtyDate) {
297
197
  index.requiredArgs(1, arguments);
298
198
  var date = index.toDate(dirtyDate);
299
- var month = date.getMonth();
300
- date.setFullYear(date.getFullYear(), month + 1, 0);
301
- date.setHours(23, 59, 59, 999);
302
- return date;
199
+ var year = date.getFullYear();
200
+ var monthIndex = date.getMonth();
201
+ var lastDayOfMonth = new Date(0);
202
+ lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
203
+ lastDayOfMonth.setHours(0, 0, 0, 0);
204
+ return lastDayOfMonth.getDate();
303
205
  }
304
206
 
305
207
  /**
306
- * @name isLastDayOfMonth
208
+ * @name setMonth
307
209
  * @category Month Helpers
308
- * @summary Is the given date the last day of a month?
210
+ * @summary Set the month to the given date.
309
211
  *
310
212
  * @description
311
- * Is the given date the last day of a month?
312
- *
313
- * @param {Date|Number} date - the date to check
314
- * @returns {Boolean} the date is the last day of a month
315
- * @throws {TypeError} 1 argument required
213
+ * Set the month to the given date.
316
214
  *
317
- * @example
318
- * // Is 28 February 2014 the last day of a month?
319
- * const result = isLastDayOfMonth(new Date(2014, 1, 28))
320
- * //=> true
215
+ * @param {Date|Number} date - the date to be changed
216
+ * @param {Number} month - the month of the new date
217
+ * @returns {Date} the new date with the month set
218
+ * @throws {TypeError} 2 arguments required
219
+ *
220
+ * @example
221
+ * // Set February to 1 September 2014:
222
+ * const result = setMonth(new Date(2014, 8, 1), 1)
223
+ * //=> Sat Feb 01 2014 00:00:00
321
224
  */
322
- function isLastDayOfMonth(dirtyDate) {
323
- index.requiredArgs(1, arguments);
225
+ function setMonth(dirtyDate, dirtyMonth) {
226
+ index.requiredArgs(2, arguments);
324
227
  var date = index.toDate(dirtyDate);
325
- return endOfDay(date).getTime() === endOfMonth(date).getTime();
228
+ var month = index.toInteger(dirtyMonth);
229
+ var year = date.getFullYear();
230
+ var day = date.getDate();
231
+ var dateWithDesiredMonth = new Date(0);
232
+ dateWithDesiredMonth.setFullYear(year, month, 15);
233
+ dateWithDesiredMonth.setHours(0, 0, 0, 0);
234
+ var daysInMonth = getDaysInMonth(dateWithDesiredMonth);
235
+ // Set the last day of the new month
236
+ // if the original date was the last day of the longer month
237
+ date.setMonth(month, Math.min(day, daysInMonth));
238
+ return date;
326
239
  }
327
240
 
328
241
  /**
329
- * @name eachDayOfInterval
330
- * @category Interval Helpers
331
- * @summary Return the array of dates within the specified time interval.
242
+ * @name set
243
+ * @category Common Helpers
244
+ * @summary Set date values to a given date.
332
245
  *
333
246
  * @description
334
- * Return the array of dates within the specified time interval.
247
+ * Set date values to a given date.
335
248
  *
336
- * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
337
- * @param {Object} [options] - an object with options.
338
- * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
339
- * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
340
- * @throws {TypeError} 1 argument required
341
- * @throws {RangeError} `options.step` must be a number greater than 1
342
- * @throws {RangeError} The start of an interval cannot be after its end
343
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
249
+ * Sets time values to date from object `values`.
250
+ * A value is not set if it is undefined or null or doesn't exist in `values`.
344
251
  *
345
- * @example
346
- * // Each day between 6 October 2014 and 10 October 2014:
347
- * const result = eachDayOfInterval({
348
- * start: new Date(2014, 9, 6),
349
- * end: new Date(2014, 9, 10)
350
- * })
351
- * //=> [
352
- * // Mon Oct 06 2014 00:00:00,
353
- * // Tue Oct 07 2014 00:00:00,
354
- * // Wed Oct 08 2014 00:00:00,
355
- * // Thu Oct 09 2014 00:00:00,
356
- * // Fri Oct 10 2014 00:00:00
357
- * // ]
358
- */
359
- function eachDayOfInterval(dirtyInterval, options) {
360
- var _options$step;
361
- index.requiredArgs(1, arguments);
362
- var interval = dirtyInterval || {};
363
- var startDate = index.toDate(interval.start);
364
- var endDate = index.toDate(interval.end);
365
- var endTime = endDate.getTime();
366
-
367
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
368
- if (!(startDate.getTime() <= endTime)) {
369
- throw new RangeError('Invalid interval');
370
- }
371
- var dates = [];
372
- var currentDate = startDate;
373
- currentDate.setHours(0, 0, 0, 0);
374
- var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
375
- if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
376
- while (currentDate.getTime() <= endTime) {
377
- dates.push(index.toDate(currentDate));
378
- currentDate.setDate(currentDate.getDate() + step);
379
- currentDate.setHours(0, 0, 0, 0);
380
- }
381
- return dates;
382
- }
383
-
384
- /**
385
- * @name eachWeekOfInterval
386
- * @category Interval Helpers
387
- * @summary Return the array of weeks within the specified time interval.
252
+ * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
253
+ * to use native `Date#setX` methods. If you use this function, you may not want to include the
254
+ * other `setX` functions that date-fns provides if you are concerned about the bundle size.
388
255
  *
389
- * @description
390
- * Return the array of weeks within the specified time interval.
256
+ * @param {Date|Number} date - the date to be changed
257
+ * @param {Object} values - an object with options
258
+ * @param {Number} [values.year] - the number of years to be set
259
+ * @param {Number} [values.month] - the number of months to be set
260
+ * @param {Number} [values.date] - the number of days to be set
261
+ * @param {Number} [values.hours] - the number of hours to be set
262
+ * @param {Number} [values.minutes] - the number of minutes to be set
263
+ * @param {Number} [values.seconds] - the number of seconds to be set
264
+ * @param {Number} [values.milliseconds] - the number of milliseconds to be set
265
+ * @returns {Date} the new date with options set
266
+ * @throws {TypeError} 2 arguments required
267
+ * @throws {RangeError} `values` must be an object
391
268
  *
392
- * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
393
- * @param {Object} [options] - an object with options.
394
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
395
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
396
- * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end
397
- * @throws {TypeError} 1 argument required
398
- * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6
399
- * @throws {RangeError} The start of an interval cannot be after its end
400
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
269
+ * @example
270
+ * // Transform 1 September 2014 into 20 October 2015 in a single line:
271
+ * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
272
+ * //=> Tue Oct 20 2015 00:00:00
401
273
  *
402
274
  * @example
403
- * // Each week within interval 6 October 2014 - 23 November 2014:
404
- * const result = eachWeekOfInterval({
405
- * start: new Date(2014, 9, 6),
406
- * end: new Date(2014, 10, 23)
407
- * })
408
- * //=> [
409
- * // Sun Oct 05 2014 00:00:00,
410
- * // Sun Oct 12 2014 00:00:00,
411
- * // Sun Oct 19 2014 00:00:00,
412
- * // Sun Oct 26 2014 00:00:00,
413
- * // Sun Nov 02 2014 00:00:00,
414
- * // Sun Nov 09 2014 00:00:00,
415
- * // Sun Nov 16 2014 00:00:00,
416
- * // Sun Nov 23 2014 00:00:00
417
- * // ]
275
+ * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
276
+ * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
277
+ * //=> Mon Sep 01 2014 12:23:45
418
278
  */
419
- function eachWeekOfInterval(dirtyInterval, options) {
420
- index.requiredArgs(1, arguments);
421
- var interval = dirtyInterval || {};
422
- var startDate = index.toDate(interval.start);
423
- var endDate = index.toDate(interval.end);
424
- var endTime = endDate.getTime();
425
-
426
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
427
- if (!(startDate.getTime() <= endTime)) {
428
- throw new RangeError('Invalid interval');
279
+ function set(dirtyDate, values) {
280
+ index.requiredArgs(2, arguments);
281
+ if (index._typeof(values) !== 'object' || values === null) {
282
+ throw new RangeError('values parameter must be an object');
429
283
  }
430
- var startDateWeek = startOfWeek(startDate, options);
431
- var endDateWeek = startOfWeek(endDate, options);
284
+ var date = index.toDate(dirtyDate);
432
285
 
433
- // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet
434
- startDateWeek.setHours(15);
435
- endDateWeek.setHours(15);
436
- endTime = endDateWeek.getTime();
437
- var weeks = [];
438
- var currentWeek = startDateWeek;
439
- while (currentWeek.getTime() <= endTime) {
440
- currentWeek.setHours(0);
441
- weeks.push(index.toDate(currentWeek));
442
- currentWeek = addWeeks(currentWeek, 1);
443
- currentWeek.setHours(15);
286
+ // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
287
+ if (isNaN(date.getTime())) {
288
+ return new Date(NaN);
444
289
  }
445
- return weeks;
290
+ if (values.year != null) {
291
+ date.setFullYear(values.year);
292
+ }
293
+ if (values.month != null) {
294
+ date = setMonth(date, values.month);
295
+ }
296
+ if (values.date != null) {
297
+ date.setDate(index.toInteger(values.date));
298
+ }
299
+ if (values.hours != null) {
300
+ date.setHours(index.toInteger(values.hours));
301
+ }
302
+ if (values.minutes != null) {
303
+ date.setMinutes(index.toInteger(values.minutes));
304
+ }
305
+ if (values.seconds != null) {
306
+ date.setSeconds(index.toInteger(values.seconds));
307
+ }
308
+ if (values.milliseconds != null) {
309
+ date.setMilliseconds(index.toInteger(values.milliseconds));
310
+ }
311
+ return date;
446
312
  }
447
313
 
314
+ var dateWithoutTime = function (date) {
315
+ return set(new Date(date), {
316
+ hours: 0,
317
+ minutes: 0,
318
+ milliseconds: 0,
319
+ seconds: 0
320
+ });
321
+ };
322
+
323
+ var getDatesInMonth = function (date) {
324
+ var dateYear = getYear(date);
325
+ var dateMonth = getMonth(date);
326
+ return Array.from({ length: getDaysInMonth(date) }, function (_, i) {
327
+ return dateWithoutTime(new Date(dateYear, dateMonth, i + 1));
328
+ });
329
+ };
330
+
448
331
  /**
449
- * @name startOfMonth
450
- * @category Month Helpers
451
- * @summary Return the start of a month for the given date.
332
+ * @name getDay
333
+ * @category Weekday Helpers
334
+ * @summary Get the day of the week of the given date.
452
335
  *
453
336
  * @description
454
- * Return the start of a month for the given date.
455
- * The result will be in the local timezone.
337
+ * Get the day of the week of the given date.
456
338
  *
457
- * @param {Date|Number} date - the original date
458
- * @returns {Date} the start of a month
339
+ * @param {Date|Number} date - the given date
340
+ * @returns {0|1|2|3|4|5|6} the day of week, 0 represents Sunday
459
341
  * @throws {TypeError} 1 argument required
460
342
  *
461
343
  * @example
462
- * // The start of a month for 2 September 2014 11:55:00:
463
- * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
464
- * //=> Mon Sep 01 2014 00:00:00
344
+ * // Which day of the week is 29 February 2012?
345
+ * const result = getDay(new Date(2012, 1, 29))
346
+ * //=> 3
465
347
  */
466
- function startOfMonth(dirtyDate) {
348
+ function getDay(dirtyDate) {
467
349
  index.requiredArgs(1, arguments);
468
350
  var date = index.toDate(dirtyDate);
469
- date.setDate(1);
470
- date.setHours(0, 0, 0, 0);
471
- return date;
351
+ var day = date.getDay();
352
+ return day;
472
353
  }
473
354
 
474
- /**
475
- * @name endOfWeek
476
- * @category Week Helpers
477
- * @summary Return the end of a week for the given date.
478
- *
479
- * @description
480
- * Return the end of a week for the given date.
481
- * The result will be in the local timezone.
482
- *
483
- * @param {Date|Number} date - the original date
484
- * @param {Object} [options] - an object with options.
485
- * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
486
- * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
487
- * @returns {Date} the end of a week
488
- * @throws {TypeError} 1 argument required
489
- * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
490
- *
491
- * @example
492
- * // The end of a week for 2 September 2014 11:55:00:
493
- * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
494
- * //=> Sat Sep 06 2014 23:59:59.999
495
- *
496
- * @example
497
- * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
498
- * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
499
- * //=> Sun Sep 07 2014 23:59:59.999
500
- */
501
- function endOfWeek(dirtyDate, options) {
502
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
503
- index.requiredArgs(1, arguments);
504
- var defaultOptions = index.getDefaultOptions();
505
- var weekStartsOn = index.toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
506
-
507
- // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
508
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
509
- throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
510
- }
511
- var date = index.toDate(dirtyDate);
512
- var day = date.getDay();
513
- var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
514
- date.setDate(date.getDate() + diff);
515
- date.setHours(23, 59, 59, 999);
516
- return date;
517
- }
518
-
519
- /**
520
- * @name getDate
521
- * @category Day Helpers
522
- * @summary Get the day of the month of the given date.
523
- *
524
- * @description
525
- * Get the day of the month of the given date.
526
- *
527
- * @param {Date|Number} date - the given date
528
- * @returns {Number} the day of month
529
- * @throws {TypeError} 1 argument required
530
- *
531
- * @example
532
- * // Which day of the month is 29 February 2012?
533
- * const result = getDate(new Date(2012, 1, 29))
534
- * //=> 29
535
- */
536
- function getDate(dirtyDate) {
537
- index.requiredArgs(1, arguments);
538
- var date = index.toDate(dirtyDate);
539
- var dayOfMonth = date.getDate();
540
- return dayOfMonth;
541
- }
542
-
543
- /**
544
- * @name getDay
545
- * @category Weekday Helpers
546
- * @summary Get the day of the week of the given date.
547
- *
548
- * @description
549
- * Get the day of the week of the given date.
550
- *
551
- * @param {Date|Number} date - the given date
552
- * @returns {0|1|2|3|4|5|6} the day of week, 0 represents Sunday
553
- * @throws {TypeError} 1 argument required
554
- *
555
- * @example
556
- * // Which day of the week is 29 February 2012?
557
- * const result = getDay(new Date(2012, 1, 29))
558
- * //=> 3
559
- */
560
- function getDay(dirtyDate) {
561
- index.requiredArgs(1, arguments);
562
- var date = index.toDate(dirtyDate);
563
- var day = date.getDay();
564
- return day;
565
- }
355
+ var WeekDaysAbbr;
356
+ (function (WeekDaysAbbr) {
357
+ WeekDaysAbbr["MON"] = "Mon";
358
+ WeekDaysAbbr["TUE"] = "Tue";
359
+ WeekDaysAbbr["WED"] = "Wed";
360
+ WeekDaysAbbr["THUR"] = "Thur";
361
+ WeekDaysAbbr["FRI"] = "Fri";
362
+ WeekDaysAbbr["SAT"] = "Sat";
363
+ WeekDaysAbbr["SUN"] = "Sun";
364
+ })(WeekDaysAbbr || (WeekDaysAbbr = {}));
365
+ var WeekDays;
366
+ (function (WeekDays) {
367
+ WeekDays["MONDAY"] = "Monday";
368
+ WeekDays["TUESDAY"] = "Tuesday";
369
+ WeekDays["WEDNESDAY"] = "Wednesday";
370
+ WeekDays["THURSDAY"] = "Thursday";
371
+ WeekDays["FRIDAY"] = "Friday";
372
+ WeekDays["SATURDAY"] = "Saturday";
373
+ WeekDays["SUNDAY"] = "Sunday";
374
+ })(WeekDays || (WeekDays = {}));
566
375
 
567
- /**
568
- * @name getDaysInMonth
569
- * @category Month Helpers
570
- * @summary Get the number of days in a month of the given date.
571
- *
572
- * @description
573
- * Get the number of days in a month of the given date.
574
- *
575
- * @param {Date|Number} date - the given date
576
- * @returns {Number} the number of days in a month
577
- * @throws {TypeError} 1 argument required
578
- *
579
- * @example
580
- * // How many days are in February 2000?
581
- * const result = getDaysInMonth(new Date(2000, 1))
582
- * //=> 29
583
- */
584
- function getDaysInMonth(dirtyDate) {
585
- index.requiredArgs(1, arguments);
586
- var date = index.toDate(dirtyDate);
587
- var year = date.getFullYear();
588
- var monthIndex = date.getMonth();
589
- var lastDayOfMonth = new Date(0);
590
- lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
591
- lastDayOfMonth.setHours(0, 0, 0, 0);
592
- return lastDayOfMonth.getDate();
593
- }
376
+ var isDay = function (date, day) {
377
+ var _a;
378
+ var dayMap = (_a = {},
379
+ _a[WeekDays.MONDAY] = 1,
380
+ _a[WeekDays.TUESDAY] = 2,
381
+ _a[WeekDays.WEDNESDAY] = 3,
382
+ _a[WeekDays.THURSDAY] = 4,
383
+ _a[WeekDays.FRIDAY] = 5,
384
+ _a[WeekDays.SATURDAY] = 6,
385
+ _a[WeekDays.SUNDAY] = 0,
386
+ _a);
387
+ return getDay(date) === dayMap[day];
388
+ };
594
389
 
595
390
  /**
596
- * @name getMonth
597
- * @category Month Helpers
598
- * @summary Get the month of the given date.
391
+ * @name isBefore
392
+ * @category Common Helpers
393
+ * @summary Is the first date before the second one?
599
394
  *
600
395
  * @description
601
- * Get the month of the given date.
396
+ * Is the first date before the second one?
602
397
  *
603
- * @param {Date|Number} date - the given date
604
- * @returns {Number} the month
605
- * @throws {TypeError} 1 argument required
398
+ * @param {Date|Number} date - the date that should be before the other one to return true
399
+ * @param {Date|Number} dateToCompare - the date to compare with
400
+ * @returns {Boolean} the first date is before the second date
401
+ * @throws {TypeError} 2 arguments required
606
402
  *
607
403
  * @example
608
- * // Which month is 29 February 2012?
609
- * const result = getMonth(new Date(2012, 1, 29))
610
- * //=> 1
404
+ * // Is 10 July 1989 before 11 February 1987?
405
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
406
+ * //=> false
611
407
  */
612
- function getMonth(dirtyDate) {
613
- index.requiredArgs(1, arguments);
408
+ function isBefore(dirtyDate, dirtyDateToCompare) {
409
+ index.requiredArgs(2, arguments);
614
410
  var date = index.toDate(dirtyDate);
615
- var month = date.getMonth();
616
- return month;
617
- }
618
-
619
- /**
620
- * @name getYear
621
- * @category Year Helpers
622
- * @summary Get the year of the given date.
623
- *
624
- * @description
625
- * Get the year of the given date.
626
- *
627
- * @param {Date|Number} date - the given date
628
- * @returns {Number} the year
629
- * @throws {TypeError} 1 argument required
630
- *
631
- * @example
632
- * // Which year is 2 July 2014?
633
- * const result = getYear(new Date(2014, 6, 2))
634
- * //=> 2014
635
- */
636
- function getYear(dirtyDate) {
637
- index.requiredArgs(1, arguments);
638
- return index.toDate(dirtyDate).getFullYear();
411
+ var dateToCompare = index.toDate(dirtyDateToCompare);
412
+ return date.getTime() < dateToCompare.getTime();
639
413
  }
640
414
 
641
415
  /**
@@ -663,161 +437,258 @@ function isAfter(dirtyDate, dirtyDateToCompare) {
663
437
  return date.getTime() > dateToCompare.getTime();
664
438
  }
665
439
 
440
+ var isDisabledDate = function (date, disabledDates, minDate, maxDate) {
441
+ return ((minDate && isBefore(date, minDate)) ||
442
+ (maxDate && isAfter(date, maxDate)) ||
443
+ (disabledDates && containsDate(disabledDates, date)));
444
+ };
445
+
446
+ var isMonthBeforeMinDate = function (month, minDate) {
447
+ return getDatesInMonth(month).every(function (date) {
448
+ return isBefore(date, minDate);
449
+ });
450
+ };
451
+
452
+ var isMonthAfterMaxDate = function (date, maxDate) {
453
+ return getDatesInMonth(date).every(function (date) {
454
+ return isAfter(date, maxDate);
455
+ });
456
+ };
457
+
666
458
  /**
667
- * @name isBefore
459
+ * @name compareAsc
668
460
  * @category Common Helpers
669
- * @summary Is the first date before the second one?
461
+ * @summary Compare the two dates and return -1, 0 or 1.
670
462
  *
671
463
  * @description
672
- * Is the first date before the second one?
464
+ * Compare the two dates and return 1 if the first date is after the second,
465
+ * -1 if the first date is before the second or 0 if dates are equal.
673
466
  *
674
- * @param {Date|Number} date - the date that should be before the other one to return true
675
- * @param {Date|Number} dateToCompare - the date to compare with
676
- * @returns {Boolean} the first date is before the second date
467
+ * @param {Date|Number} dateLeft - the first date to compare
468
+ * @param {Date|Number} dateRight - the second date to compare
469
+ * @returns {Number} the result of the comparison
677
470
  * @throws {TypeError} 2 arguments required
678
471
  *
679
472
  * @example
680
- * // Is 10 July 1989 before 11 February 1987?
681
- * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
682
- * //=> false
473
+ * // Compare 11 February 1987 and 10 July 1989:
474
+ * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
475
+ * //=> -1
476
+ *
477
+ * @example
478
+ * // Sort the array of dates:
479
+ * const result = [
480
+ * new Date(1995, 6, 2),
481
+ * new Date(1987, 1, 11),
482
+ * new Date(1989, 6, 10)
483
+ * ].sort(compareAsc)
484
+ * //=> [
485
+ * // Wed Feb 11 1987 00:00:00,
486
+ * // Mon Jul 10 1989 00:00:00,
487
+ * // Sun Jul 02 1995 00:00:00
488
+ * // ]
683
489
  */
684
- function isBefore(dirtyDate, dirtyDateToCompare) {
490
+ function compareAsc(dirtyDateLeft, dirtyDateRight) {
685
491
  index.requiredArgs(2, arguments);
686
- var date = index.toDate(dirtyDate);
687
- var dateToCompare = index.toDate(dirtyDateToCompare);
688
- return date.getTime() < dateToCompare.getTime();
492
+ var dateLeft = index.toDate(dirtyDateLeft);
493
+ var dateRight = index.toDate(dirtyDateRight);
494
+ var diff = dateLeft.getTime() - dateRight.getTime();
495
+ if (diff < 0) {
496
+ return -1;
497
+ } else if (diff > 0) {
498
+ return 1;
499
+ // Return 0 if diff is 0; return NaN if diff is NaN
500
+ } else {
501
+ return diff;
502
+ }
689
503
  }
690
504
 
691
505
  /**
692
- * @name isEqual
693
- * @category Common Helpers
694
- * @summary Are the given dates equal?
506
+ * @name eachDayOfInterval
507
+ * @category Interval Helpers
508
+ * @summary Return the array of dates within the specified time interval.
695
509
  *
696
510
  * @description
697
- * Are the given dates equal?
511
+ * Return the array of dates within the specified time interval.
698
512
  *
699
- * @param {Date|Number} dateLeft - the first date to compare
700
- * @param {Date|Number} dateRight - the second date to compare
701
- * @returns {Boolean} the dates are equal
702
- * @throws {TypeError} 2 arguments required
703
- *
704
- * @example
705
- * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
706
- * const result = isEqual(
707
- * new Date(2014, 6, 2, 6, 30, 45, 0),
708
- * new Date(2014, 6, 2, 6, 30, 45, 500)
709
- * )
710
- * //=> false
711
- */
712
- function isEqual(dirtyLeftDate, dirtyRightDate) {
713
- index.requiredArgs(2, arguments);
714
- var dateLeft = index.toDate(dirtyLeftDate);
715
- var dateRight = index.toDate(dirtyRightDate);
716
- return dateLeft.getTime() === dateRight.getTime();
717
- }
718
-
719
- /**
720
- * @name isFirstDayOfMonth
721
- * @category Month Helpers
722
- * @summary Is the given date the first day of a month?
723
- *
724
- * @description
725
- * Is the given date the first day of a month?
726
- *
727
- * @param {Date|Number} date - the date to check
728
- * @returns {Boolean} the date is the first day of a month
513
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
514
+ * @param {Object} [options] - an object with options.
515
+ * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
516
+ * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
729
517
  * @throws {TypeError} 1 argument required
518
+ * @throws {RangeError} `options.step` must be a number greater than 1
519
+ * @throws {RangeError} The start of an interval cannot be after its end
520
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
730
521
  *
731
522
  * @example
732
- * // Is 1 September 2014 the first day of a month?
733
- * const result = isFirstDayOfMonth(new Date(2014, 8, 1))
734
- * //=> true
523
+ * // Each day between 6 October 2014 and 10 October 2014:
524
+ * const result = eachDayOfInterval({
525
+ * start: new Date(2014, 9, 6),
526
+ * end: new Date(2014, 9, 10)
527
+ * })
528
+ * //=> [
529
+ * // Mon Oct 06 2014 00:00:00,
530
+ * // Tue Oct 07 2014 00:00:00,
531
+ * // Wed Oct 08 2014 00:00:00,
532
+ * // Thu Oct 09 2014 00:00:00,
533
+ * // Fri Oct 10 2014 00:00:00
534
+ * // ]
735
535
  */
736
- function isFirstDayOfMonth(dirtyDate) {
536
+ function eachDayOfInterval(dirtyInterval, options) {
537
+ var _options$step;
737
538
  index.requiredArgs(1, arguments);
738
- return index.toDate(dirtyDate).getDate() === 1;
539
+ var interval = dirtyInterval || {};
540
+ var startDate = index.toDate(interval.start);
541
+ var endDate = index.toDate(interval.end);
542
+ var endTime = endDate.getTime();
543
+
544
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
545
+ if (!(startDate.getTime() <= endTime)) {
546
+ throw new RangeError('Invalid interval');
547
+ }
548
+ var dates = [];
549
+ var currentDate = startDate;
550
+ currentDate.setHours(0, 0, 0, 0);
551
+ var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
552
+ if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
553
+ while (currentDate.getTime() <= endTime) {
554
+ dates.push(index.toDate(currentDate));
555
+ currentDate.setDate(currentDate.getDate() + step);
556
+ currentDate.setHours(0, 0, 0, 0);
557
+ }
558
+ return dates;
739
559
  }
740
560
 
561
+ var processSelectedRange = function (_a) {
562
+ var range = _a.range, value = _a.value, disabledDates = _a.disabledDates;
563
+ var exisitingRange = range.filter(function (date) { return Boolean(date); });
564
+ var newRange = index_es.__spreadArray(index_es.__spreadArray([], (exisitingRange.length === 2 ? [] : exisitingRange), true), [
565
+ value,
566
+ ], false).sort(compareAsc);
567
+ var isSelectionComplete = newRange.length === 2;
568
+ var allDaysInRange = isSelectionComplete
569
+ ? eachDayOfInterval({
570
+ start: newRange[0],
571
+ end: newRange[1]
572
+ })
573
+ : [];
574
+ var rangeOnChangeValue = {
575
+ dates: allDaysInRange.map(function (date) { return ({
576
+ value: date,
577
+ disabled: disabledDates ? containsDate(disabledDates, date) : false
578
+ }); }),
579
+ selectedDate: value,
580
+ start: newRange[0],
581
+ end: newRange[1],
582
+ isSelectionComplete: isSelectionComplete
583
+ };
584
+ return {
585
+ rangeValue: newRange,
586
+ rangeOnChangeValue: rangeOnChangeValue
587
+ };
588
+ };
589
+
590
+ var getCalendarType = function (type, isDesktop) {
591
+ if (type === "double" && !isDesktop) {
592
+ return "month";
593
+ }
594
+ if (type === "double" && isDesktop) {
595
+ return "double";
596
+ }
597
+ return type;
598
+ };
599
+
600
+ var getDoubleMonthDisplayRange = function (date) {
601
+ var firstMonth = getMonth(date) % 2 !== 0 ? subMonths(date, 1) : date;
602
+ var secondMonth = addMonths(firstMonth, 1);
603
+ return [firstMonth, secondMonth];
604
+ };
605
+
606
+ var getFocusDate = function (_a) {
607
+ var minDate = _a.minDate, maxDate = _a.maxDate, date = _a.date;
608
+ var isFocusDateBeforeMinDate = minDate && isBefore(date, minDate);
609
+ var isFocusDateAfterMaxDate = maxDate && isAfter(date, maxDate);
610
+ if (isFocusDateBeforeMinDate) {
611
+ return minDate;
612
+ }
613
+ if (isFocusDateAfterMaxDate) {
614
+ return maxDate;
615
+ }
616
+ return date;
617
+ };
618
+
619
+ var getHighlightRange = function (_a) {
620
+ var date = _a.date, minDate = _a.minDate, maxDate = _a.maxDate, range = _a.range;
621
+ var existingRange = range.filter(function (date) { return Boolean(date); });
622
+ if (existingRange.filter(function (date) { return Boolean(date); }).length === 1) {
623
+ var isDateBeforeMinDate = minDate && isBefore(date, minDate);
624
+ var isDateAfterMaxDate = maxDate && isAfter(date, maxDate);
625
+ if (isDateBeforeMinDate) {
626
+ return [minDate, existingRange[0]].sort(compareAsc);
627
+ }
628
+ if (isDateAfterMaxDate) {
629
+ return [maxDate, existingRange[0]].sort(compareAsc);
630
+ }
631
+ return [date, existingRange[0]].sort(compareAsc);
632
+ }
633
+ return existingRange;
634
+ };
635
+
741
636
  /**
742
- * @name isSameMonth
743
- * @category Month Helpers
744
- * @summary Are the given dates in the same month (and year)?
637
+ * @name addDays
638
+ * @category Day Helpers
639
+ * @summary Add the specified number of days to the given date.
745
640
  *
746
641
  * @description
747
- * Are the given dates in the same month (and year)?
748
- *
749
- * @param {Date|Number} dateLeft - the first date to check
750
- * @param {Date|Number} dateRight - the second date to check
751
- * @returns {Boolean} the dates are in the same month (and year)
752
- * @throws {TypeError} 2 arguments required
642
+ * Add the specified number of days to the given date.
753
643
  *
754
- * @example
755
- * // Are 2 September 2014 and 25 September 2014 in the same month?
756
- * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
757
- * //=> true
644
+ * @param {Date|Number} date - the date to be changed
645
+ * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
646
+ * @returns {Date} - the new date with the days added
647
+ * @throws {TypeError} - 2 arguments required
758
648
  *
759
649
  * @example
760
- * // Are 2 September 2014 and 25 September 2015 in the same month?
761
- * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
762
- * //=> false
650
+ * // Add 10 days to 1 September 2014:
651
+ * const result = addDays(new Date(2014, 8, 1), 10)
652
+ * //=> Thu Sep 11 2014 00:00:00
763
653
  */
764
- function isSameMonth(dirtyDateLeft, dirtyDateRight) {
654
+ function addDays(dirtyDate, dirtyAmount) {
765
655
  index.requiredArgs(2, arguments);
766
- var dateLeft = index.toDate(dirtyDateLeft);
767
- var dateRight = index.toDate(dirtyDateRight);
768
- return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();
656
+ var date = index.toDate(dirtyDate);
657
+ var amount = index.toInteger(dirtyAmount);
658
+ if (isNaN(amount)) {
659
+ return new Date(NaN);
660
+ }
661
+ if (!amount) {
662
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
663
+ return date;
664
+ }
665
+ date.setDate(date.getDate() + amount);
666
+ return date;
769
667
  }
770
668
 
771
669
  /**
772
- * @name isWithinInterval
773
- * @category Interval Helpers
774
- * @summary Is the given date within the interval?
670
+ * @name addWeeks
671
+ * @category Week Helpers
672
+ * @summary Add the specified number of weeks to the given date.
775
673
  *
776
674
  * @description
777
- * Is the given date within the interval? (Including start and end.)
675
+ * Add the specified number of week to the given date.
778
676
  *
779
- * @param {Date|Number} date - the date to check
780
- * @param {Interval} interval - the interval to check
781
- * @returns {Boolean} the date is within the interval
677
+ * @param {Date|Number} date - the date to be changed
678
+ * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
679
+ * @returns {Date} the new date with the weeks added
782
680
  * @throws {TypeError} 2 arguments required
783
- * @throws {RangeError} The start of an interval cannot be after its end
784
- * @throws {RangeError} Date in interval cannot be `Invalid Date`
785
- *
786
- * @example
787
- * // For the date within the interval:
788
- * isWithinInterval(new Date(2014, 0, 3), {
789
- * start: new Date(2014, 0, 1),
790
- * end: new Date(2014, 0, 7)
791
- * })
792
- * //=> true
793
- *
794
- * @example
795
- * // For the date outside of the interval:
796
- * isWithinInterval(new Date(2014, 0, 10), {
797
- * start: new Date(2014, 0, 1),
798
- * end: new Date(2014, 0, 7)
799
- * })
800
- * //=> false
801
- *
802
- * @example
803
- * // For date equal to interval start:
804
- * isWithinInterval(date, { start, end: date }) // => true
805
681
  *
806
682
  * @example
807
- * // For date equal to interval end:
808
- * isWithinInterval(date, { start: date, end }) // => true
683
+ * // Add 4 weeks to 1 September 2014:
684
+ * const result = addWeeks(new Date(2014, 8, 1), 4)
685
+ * //=> Mon Sep 29 2014 00:00:00
809
686
  */
810
- function isWithinInterval(dirtyDate, interval) {
687
+ function addWeeks(dirtyDate, dirtyAmount) {
811
688
  index.requiredArgs(2, arguments);
812
- var time = index.toDate(dirtyDate).getTime();
813
- var startTime = index.toDate(interval.start).getTime();
814
- var endTime = index.toDate(interval.end).getTime();
815
-
816
- // Throw an exception if start date is after end date or if any date is `Invalid Date`
817
- if (!(startTime <= endTime)) {
818
- throw new RangeError('Invalid interval');
819
- }
820
- return time >= startTime && time <= endTime;
689
+ var amount = index.toInteger(dirtyAmount);
690
+ var days = amount * 7;
691
+ return addDays(dirtyDate, days);
821
692
  }
822
693
 
823
694
  /**
@@ -845,189 +716,141 @@ function subDays(dirtyDate, dirtyAmount) {
845
716
  }
846
717
 
847
718
  /**
848
- * @name setMonth
849
- * @category Month Helpers
850
- * @summary Set the month to the given date.
719
+ * @name startOfWeek
720
+ * @category Week Helpers
721
+ * @summary Return the start of a week for the given date.
851
722
  *
852
723
  * @description
853
- * Set the month to the given date.
724
+ * Return the start of a week for the given date.
725
+ * The result will be in the local timezone.
854
726
  *
855
- * @param {Date|Number} date - the date to be changed
856
- * @param {Number} month - the month of the new date
857
- * @returns {Date} the new date with the month set
858
- * @throws {TypeError} 2 arguments required
859
- *
860
- * @example
861
- * // Set February to 1 September 2014:
862
- * const result = setMonth(new Date(2014, 8, 1), 1)
863
- * //=> Sat Feb 01 2014 00:00:00
864
- */
865
- function setMonth(dirtyDate, dirtyMonth) {
866
- index.requiredArgs(2, arguments);
867
- var date = index.toDate(dirtyDate);
868
- var month = index.toInteger(dirtyMonth);
869
- var year = date.getFullYear();
870
- var day = date.getDate();
871
- var dateWithDesiredMonth = new Date(0);
872
- dateWithDesiredMonth.setFullYear(year, month, 15);
873
- dateWithDesiredMonth.setHours(0, 0, 0, 0);
874
- var daysInMonth = getDaysInMonth(dateWithDesiredMonth);
875
- // Set the last day of the new month
876
- // if the original date was the last day of the longer month
877
- date.setMonth(month, Math.min(day, daysInMonth));
878
- return date;
879
- }
880
-
881
- /**
882
- * @name set
883
- * @category Common Helpers
884
- * @summary Set date values to a given date.
885
- *
886
- * @description
887
- * Set date values to a given date.
888
- *
889
- * Sets time values to date from object `values`.
890
- * A value is not set if it is undefined or null or doesn't exist in `values`.
891
- *
892
- * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
893
- * to use native `Date#setX` methods. If you use this function, you may not want to include the
894
- * other `setX` functions that date-fns provides if you are concerned about the bundle size.
895
- *
896
- * @param {Date|Number} date - the date to be changed
897
- * @param {Object} values - an object with options
898
- * @param {Number} [values.year] - the number of years to be set
899
- * @param {Number} [values.month] - the number of months to be set
900
- * @param {Number} [values.date] - the number of days to be set
901
- * @param {Number} [values.hours] - the number of hours to be set
902
- * @param {Number} [values.minutes] - the number of minutes to be set
903
- * @param {Number} [values.seconds] - the number of seconds to be set
904
- * @param {Number} [values.milliseconds] - the number of milliseconds to be set
905
- * @returns {Date} the new date with options set
906
- * @throws {TypeError} 2 arguments required
907
- * @throws {RangeError} `values` must be an object
727
+ * @param {Date|Number} date - the original date
728
+ * @param {Object} [options] - an object with options.
729
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
730
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
731
+ * @returns {Date} the start of a week
732
+ * @throws {TypeError} 1 argument required
733
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
908
734
  *
909
735
  * @example
910
- * // Transform 1 September 2014 into 20 October 2015 in a single line:
911
- * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
912
- * //=> Tue Oct 20 2015 00:00:00
736
+ * // The start of a week for 2 September 2014 11:55:00:
737
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
738
+ * //=> Sun Aug 31 2014 00:00:00
913
739
  *
914
740
  * @example
915
- * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
916
- * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
917
- * //=> Mon Sep 01 2014 12:23:45
741
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
742
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
743
+ * //=> Mon Sep 01 2014 00:00:00
918
744
  */
919
- function set(dirtyDate, values) {
920
- index.requiredArgs(2, arguments);
921
- if (index._typeof(values) !== 'object' || values === null) {
922
- throw new RangeError('values parameter must be an object');
923
- }
924
- var date = index.toDate(dirtyDate);
745
+ function startOfWeek(dirtyDate, options) {
746
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
747
+ index.requiredArgs(1, arguments);
748
+ var defaultOptions = index.getDefaultOptions();
749
+ var weekStartsOn = index.toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
925
750
 
926
- // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
927
- if (isNaN(date.getTime())) {
928
- return new Date(NaN);
929
- }
930
- if (values.year != null) {
931
- date.setFullYear(values.year);
932
- }
933
- if (values.month != null) {
934
- date = setMonth(date, values.month);
935
- }
936
- if (values.date != null) {
937
- date.setDate(index.toInteger(values.date));
938
- }
939
- if (values.hours != null) {
940
- date.setHours(index.toInteger(values.hours));
941
- }
942
- if (values.minutes != null) {
943
- date.setMinutes(index.toInteger(values.minutes));
944
- }
945
- if (values.seconds != null) {
946
- date.setSeconds(index.toInteger(values.seconds));
947
- }
948
- if (values.milliseconds != null) {
949
- date.setMilliseconds(index.toInteger(values.milliseconds));
751
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
752
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
753
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
950
754
  }
755
+ var date = index.toDate(dirtyDate);
756
+ var day = date.getDay();
757
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
758
+ date.setDate(date.getDate() - diff);
759
+ date.setHours(0, 0, 0, 0);
951
760
  return date;
952
761
  }
953
762
 
954
763
  /**
955
- * @name setYear
956
- * @category Year Helpers
957
- * @summary Set the year to the given date.
764
+ * @name endOfWeek
765
+ * @category Week Helpers
766
+ * @summary Return the end of a week for the given date.
958
767
  *
959
768
  * @description
960
- * Set the year to the given date.
769
+ * Return the end of a week for the given date.
770
+ * The result will be in the local timezone.
961
771
  *
962
- * @param {Date|Number} date - the date to be changed
963
- * @param {Number} year - the year of the new date
964
- * @returns {Date} the new date with the year set
965
- * @throws {TypeError} 2 arguments required
772
+ * @param {Date|Number} date - the original date
773
+ * @param {Object} [options] - an object with options.
774
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
775
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
776
+ * @returns {Date} the end of a week
777
+ * @throws {TypeError} 1 argument required
778
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
966
779
  *
967
780
  * @example
968
- * // Set year 2013 to 1 September 2014:
969
- * const result = setYear(new Date(2014, 8, 1), 2013)
970
- * //=> Sun Sep 01 2013 00:00:00
781
+ * // The end of a week for 2 September 2014 11:55:00:
782
+ * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
783
+ * //=> Sat Sep 06 2014 23:59:59.999
784
+ *
785
+ * @example
786
+ * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
787
+ * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
788
+ * //=> Sun Sep 07 2014 23:59:59.999
971
789
  */
972
- function setYear(dirtyDate, dirtyYear) {
973
- index.requiredArgs(2, arguments);
974
- var date = index.toDate(dirtyDate);
975
- var year = index.toInteger(dirtyYear);
790
+ function endOfWeek(dirtyDate, options) {
791
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
792
+ index.requiredArgs(1, arguments);
793
+ var defaultOptions = index.getDefaultOptions();
794
+ var weekStartsOn = index.toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
976
795
 
977
- // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
978
- if (isNaN(date.getTime())) {
979
- return new Date(NaN);
796
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
797
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
798
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
980
799
  }
981
- date.setFullYear(year);
800
+ var date = index.toDate(dirtyDate);
801
+ var day = date.getDay();
802
+ var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
803
+ date.setDate(date.getDate() + diff);
804
+ date.setHours(23, 59, 59, 999);
982
805
  return date;
983
806
  }
984
807
 
985
808
  /**
986
- * @name subMonths
987
- * @category Month Helpers
988
- * @summary Subtract the specified number of months from the given date.
809
+ * @name subWeeks
810
+ * @category Week Helpers
811
+ * @summary Subtract the specified number of weeks from the given date.
989
812
  *
990
813
  * @description
991
- * Subtract the specified number of months from the given date.
814
+ * Subtract the specified number of weeks from the given date.
992
815
  *
993
816
  * @param {Date|Number} date - the date to be changed
994
- * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
995
- * @returns {Date} the new date with the months subtracted
817
+ * @param {Number} amount - the amount of weeks to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
818
+ * @returns {Date} the new date with the weeks subtracted
996
819
  * @throws {TypeError} 2 arguments required
997
820
  *
998
821
  * @example
999
- * // Subtract 5 months from 1 February 2015:
1000
- * const result = subMonths(new Date(2015, 1, 1), 5)
1001
- * //=> Mon Sep 01 2014 00:00:00
822
+ * // Subtract 4 weeks from 1 September 2014:
823
+ * const result = subWeeks(new Date(2014, 8, 1), 4)
824
+ * //=> Mon Aug 04 2014 00:00:00
1002
825
  */
1003
- function subMonths(dirtyDate, dirtyAmount) {
826
+ function subWeeks(dirtyDate, dirtyAmount) {
1004
827
  index.requiredArgs(2, arguments);
1005
828
  var amount = index.toInteger(dirtyAmount);
1006
- return addMonths(dirtyDate, -amount);
829
+ return addWeeks(dirtyDate, -amount);
1007
830
  }
1008
831
 
1009
832
  /**
1010
- * @name subWeeks
1011
- * @category Week Helpers
1012
- * @summary Subtract the specified number of weeks from the given date.
833
+ * @name addYears
834
+ * @category Year Helpers
835
+ * @summary Add the specified number of years to the given date.
1013
836
  *
1014
837
  * @description
1015
- * Subtract the specified number of weeks from the given date.
838
+ * Add the specified number of years to the given date.
1016
839
  *
1017
840
  * @param {Date|Number} date - the date to be changed
1018
- * @param {Number} amount - the amount of weeks to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
1019
- * @returns {Date} the new date with the weeks subtracted
841
+ * @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
842
+ * @returns {Date} the new date with the years added
1020
843
  * @throws {TypeError} 2 arguments required
1021
844
  *
1022
845
  * @example
1023
- * // Subtract 4 weeks from 1 September 2014:
1024
- * const result = subWeeks(new Date(2014, 8, 1), 4)
1025
- * //=> Mon Aug 04 2014 00:00:00
846
+ * // Add 5 years to 1 September 2014:
847
+ * const result = addYears(new Date(2014, 8, 1), 5)
848
+ * //=> Sun Sep 01 2019 00:00:00
1026
849
  */
1027
- function subWeeks(dirtyDate, dirtyAmount) {
850
+ function addYears(dirtyDate, dirtyAmount) {
1028
851
  index.requiredArgs(2, arguments);
1029
852
  var amount = index.toInteger(dirtyAmount);
1030
- return addWeeks(dirtyDate, -amount);
853
+ return addMonths(dirtyDate, amount * 12);
1031
854
  }
1032
855
 
1033
856
  /**
@@ -1054,155 +877,6 @@ function subYears(dirtyDate, dirtyAmount) {
1054
877
  return addYears(dirtyDate, -amount);
1055
878
  }
1056
879
 
1057
- var containsDate = function (dates, compareDate) {
1058
- return dates.map(function (date) { return date.getTime(); }).includes(compareDate.getTime());
1059
- };
1060
-
1061
- var dateWithoutTime = function (date) {
1062
- return set(new Date(date), {
1063
- hours: 0,
1064
- minutes: 0,
1065
- milliseconds: 0,
1066
- seconds: 0
1067
- });
1068
- };
1069
-
1070
- var getDatesInMonth = function (date) {
1071
- var dateYear = getYear(date);
1072
- var dateMonth = getMonth(date);
1073
- return Array.from({ length: getDaysInMonth(date) }, function (_, i) {
1074
- return dateWithoutTime(new Date(dateYear, dateMonth, i + 1));
1075
- });
1076
- };
1077
-
1078
- var WeekDaysAbbr;
1079
- (function (WeekDaysAbbr) {
1080
- WeekDaysAbbr["MON"] = "Mon";
1081
- WeekDaysAbbr["TUE"] = "Tue";
1082
- WeekDaysAbbr["WED"] = "Wed";
1083
- WeekDaysAbbr["THUR"] = "Thur";
1084
- WeekDaysAbbr["FRI"] = "Fri";
1085
- WeekDaysAbbr["SAT"] = "Sat";
1086
- WeekDaysAbbr["SUN"] = "Sun";
1087
- })(WeekDaysAbbr || (WeekDaysAbbr = {}));
1088
- var WeekDays;
1089
- (function (WeekDays) {
1090
- WeekDays["MONDAY"] = "Monday";
1091
- WeekDays["TUESDAY"] = "Tuesday";
1092
- WeekDays["WEDNESDAY"] = "Wednesday";
1093
- WeekDays["THURSDAY"] = "Thursday";
1094
- WeekDays["FRIDAY"] = "Friday";
1095
- WeekDays["SATURDAY"] = "Saturday";
1096
- WeekDays["SUNDAY"] = "Sunday";
1097
- })(WeekDays || (WeekDays = {}));
1098
-
1099
- var isDay = function (date, day) {
1100
- var _a;
1101
- var dayMap = (_a = {},
1102
- _a[WeekDays.MONDAY] = 1,
1103
- _a[WeekDays.TUESDAY] = 2,
1104
- _a[WeekDays.WEDNESDAY] = 3,
1105
- _a[WeekDays.THURSDAY] = 4,
1106
- _a[WeekDays.FRIDAY] = 5,
1107
- _a[WeekDays.SATURDAY] = 6,
1108
- _a[WeekDays.SUNDAY] = 0,
1109
- _a);
1110
- return getDay(date) === dayMap[day];
1111
- };
1112
-
1113
- var isDisabledDate = function (date, disabledDates, minDate, maxDate) {
1114
- return ((minDate && isBefore(date, minDate)) ||
1115
- (maxDate && isAfter(date, maxDate)) ||
1116
- (disabledDates && containsDate(disabledDates, date)));
1117
- };
1118
-
1119
- var isMonthBeforeMinDate = function (month, minDate) {
1120
- return getDatesInMonth(month).every(function (date) {
1121
- return isBefore(date, minDate);
1122
- });
1123
- };
1124
-
1125
- var isMonthAfterMaxDate = function (date, maxDate) {
1126
- return getDatesInMonth(date).every(function (date) {
1127
- return isAfter(date, maxDate);
1128
- });
1129
- };
1130
-
1131
- var processSelectedRange = function (_a) {
1132
- var range = _a.range, value = _a.value, disabledDates = _a.disabledDates;
1133
- var exisitingRange = range.filter(function (date) { return Boolean(date); });
1134
- var newRange = index$1.__spreadArray(index$1.__spreadArray([], (exisitingRange.length === 2 ? [] : exisitingRange), true), [
1135
- value,
1136
- ], false).sort(compareAsc);
1137
- var isSelectionComplete = newRange.length === 2;
1138
- var allDaysInRange = isSelectionComplete
1139
- ? eachDayOfInterval({
1140
- start: newRange[0],
1141
- end: newRange[1]
1142
- })
1143
- : [];
1144
- var rangeOnChangeValue = {
1145
- dates: allDaysInRange.map(function (date) { return ({
1146
- value: date,
1147
- disabled: disabledDates ? containsDate(disabledDates, date) : false
1148
- }); }),
1149
- selectedDate: value,
1150
- start: newRange[0],
1151
- end: newRange[1],
1152
- isSelectionComplete: isSelectionComplete
1153
- };
1154
- return {
1155
- rangeValue: newRange,
1156
- rangeOnChangeValue: rangeOnChangeValue
1157
- };
1158
- };
1159
-
1160
- var getCalendarType = function (type, isDesktop) {
1161
- if (type === "double" && !isDesktop) {
1162
- return "month";
1163
- }
1164
- if (type === "double" && isDesktop) {
1165
- return "double";
1166
- }
1167
- return type;
1168
- };
1169
-
1170
- var getDoubleMonthDisplayRange = function (date) {
1171
- var firstMonth = getMonth(date) % 2 !== 0 ? subMonths(date, 1) : date;
1172
- var secondMonth = addMonths(firstMonth, 1);
1173
- return [firstMonth, secondMonth];
1174
- };
1175
-
1176
- var getFocusDate = function (_a) {
1177
- var minDate = _a.minDate, maxDate = _a.maxDate, date = _a.date;
1178
- var isFocusDateBeforeMinDate = minDate && isBefore(date, minDate);
1179
- var isFocusDateAfterMaxDate = maxDate && isAfter(date, maxDate);
1180
- if (isFocusDateBeforeMinDate) {
1181
- return minDate;
1182
- }
1183
- if (isFocusDateAfterMaxDate) {
1184
- return maxDate;
1185
- }
1186
- return date;
1187
- };
1188
-
1189
- var getHighlightRange = function (_a) {
1190
- var date = _a.date, minDate = _a.minDate, maxDate = _a.maxDate, range = _a.range;
1191
- var existingRange = range.filter(function (date) { return Boolean(date); });
1192
- if (existingRange.filter(function (date) { return Boolean(date); }).length === 1) {
1193
- var isDateBeforeMinDate = minDate && isBefore(date, minDate);
1194
- var isDateAfterMaxDate = maxDate && isAfter(date, maxDate);
1195
- if (isDateBeforeMinDate) {
1196
- return [minDate, existingRange[0]].sort(compareAsc);
1197
- }
1198
- if (isDateAfterMaxDate) {
1199
- return [maxDate, existingRange[0]].sort(compareAsc);
1200
- }
1201
- return [date, existingRange[0]].sort(compareAsc);
1202
- }
1203
- return existingRange;
1204
- };
1205
-
1206
880
  var KeyNames;
1207
881
  (function (KeyNames) {
1208
882
  KeyNames["ArrowUp"] = "ArrowUp";
@@ -1218,29 +892,178 @@ var KeyNames;
1218
892
  KeyNames["Space"] = " ";
1219
893
  })(KeyNames || (KeyNames = {}));
1220
894
 
1221
- var getKeyDownDate = function (_a) {
1222
- var key = _a.key, shiftKey = _a.shiftKey, focusDate = _a.focusDate;
1223
- switch (key) {
1224
- case KeyNames.ArrowDown:
1225
- return addWeeks(focusDate, 1);
1226
- case KeyNames.ArrowLeft:
1227
- return subDays(focusDate, 1);
1228
- case KeyNames.ArrowRight:
1229
- return addDays(focusDate, 1);
1230
- case KeyNames.ArrowUp:
1231
- return subWeeks(focusDate, 1);
1232
- case KeyNames.Home:
1233
- return dateWithoutTime(startOfWeek(focusDate, { weekStartsOn: 1 }));
1234
- case KeyNames.End:
1235
- return dateWithoutTime(endOfWeek(focusDate, { weekStartsOn: 1 }));
1236
- case KeyNames.PageUp:
1237
- return shiftKey ? subYears(focusDate, 1) : subMonths(focusDate, 1);
1238
- case KeyNames.PageDown:
1239
- return shiftKey ? addYears(focusDate, 1) : addMonths(focusDate, 1);
1240
- default:
1241
- return focusDate;
1242
- }
1243
- };
895
+ var getKeyDownDate = function (_a) {
896
+ var key = _a.key, shiftKey = _a.shiftKey, focusDate = _a.focusDate;
897
+ switch (key) {
898
+ case KeyNames.ArrowDown:
899
+ return addWeeks(focusDate, 1);
900
+ case KeyNames.ArrowLeft:
901
+ return subDays(focusDate, 1);
902
+ case KeyNames.ArrowRight:
903
+ return addDays(focusDate, 1);
904
+ case KeyNames.ArrowUp:
905
+ return subWeeks(focusDate, 1);
906
+ case KeyNames.Home:
907
+ return dateWithoutTime(startOfWeek(focusDate, { weekStartsOn: 1 }));
908
+ case KeyNames.End:
909
+ return dateWithoutTime(endOfWeek(focusDate, { weekStartsOn: 1 }));
910
+ case KeyNames.PageUp:
911
+ return shiftKey ? subYears(focusDate, 1) : subMonths(focusDate, 1);
912
+ case KeyNames.PageDown:
913
+ return shiftKey ? addYears(focusDate, 1) : addMonths(focusDate, 1);
914
+ default:
915
+ return focusDate;
916
+ }
917
+ };
918
+
919
+ /**
920
+ * @name endOfDay
921
+ * @category Day Helpers
922
+ * @summary Return the end of a day for the given date.
923
+ *
924
+ * @description
925
+ * Return the end of a day for the given date.
926
+ * The result will be in the local timezone.
927
+ *
928
+ * @param {Date|Number} date - the original date
929
+ * @returns {Date} the end of a day
930
+ * @throws {TypeError} 1 argument required
931
+ *
932
+ * @example
933
+ * // The end of a day for 2 September 2014 11:55:00:
934
+ * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
935
+ * //=> Tue Sep 02 2014 23:59:59.999
936
+ */
937
+ function endOfDay(dirtyDate) {
938
+ index.requiredArgs(1, arguments);
939
+ var date = index.toDate(dirtyDate);
940
+ date.setHours(23, 59, 59, 999);
941
+ return date;
942
+ }
943
+
944
+ /**
945
+ * @name endOfMonth
946
+ * @category Month Helpers
947
+ * @summary Return the end of a month for the given date.
948
+ *
949
+ * @description
950
+ * Return the end of a month for the given date.
951
+ * The result will be in the local timezone.
952
+ *
953
+ * @param {Date|Number} date - the original date
954
+ * @returns {Date} the end of a month
955
+ * @throws {TypeError} 1 argument required
956
+ *
957
+ * @example
958
+ * // The end of a month for 2 September 2014 11:55:00:
959
+ * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
960
+ * //=> Tue Sep 30 2014 23:59:59.999
961
+ */
962
+ function endOfMonth(dirtyDate) {
963
+ index.requiredArgs(1, arguments);
964
+ var date = index.toDate(dirtyDate);
965
+ var month = date.getMonth();
966
+ date.setFullYear(date.getFullYear(), month + 1, 0);
967
+ date.setHours(23, 59, 59, 999);
968
+ return date;
969
+ }
970
+
971
+ /**
972
+ * @name isLastDayOfMonth
973
+ * @category Month Helpers
974
+ * @summary Is the given date the last day of a month?
975
+ *
976
+ * @description
977
+ * Is the given date the last day of a month?
978
+ *
979
+ * @param {Date|Number} date - the date to check
980
+ * @returns {Boolean} the date is the last day of a month
981
+ * @throws {TypeError} 1 argument required
982
+ *
983
+ * @example
984
+ * // Is 28 February 2014 the last day of a month?
985
+ * const result = isLastDayOfMonth(new Date(2014, 1, 28))
986
+ * //=> true
987
+ */
988
+ function isLastDayOfMonth(dirtyDate) {
989
+ index.requiredArgs(1, arguments);
990
+ var date = index.toDate(dirtyDate);
991
+ return endOfDay(date).getTime() === endOfMonth(date).getTime();
992
+ }
993
+
994
+ /**
995
+ * @name isFirstDayOfMonth
996
+ * @category Month Helpers
997
+ * @summary Is the given date the first day of a month?
998
+ *
999
+ * @description
1000
+ * Is the given date the first day of a month?
1001
+ *
1002
+ * @param {Date|Number} date - the date to check
1003
+ * @returns {Boolean} the date is the first day of a month
1004
+ * @throws {TypeError} 1 argument required
1005
+ *
1006
+ * @example
1007
+ * // Is 1 September 2014 the first day of a month?
1008
+ * const result = isFirstDayOfMonth(new Date(2014, 8, 1))
1009
+ * //=> true
1010
+ */
1011
+ function isFirstDayOfMonth(dirtyDate) {
1012
+ index.requiredArgs(1, arguments);
1013
+ return index.toDate(dirtyDate).getDate() === 1;
1014
+ }
1015
+
1016
+ /**
1017
+ * @name getDate
1018
+ * @category Day Helpers
1019
+ * @summary Get the day of the month of the given date.
1020
+ *
1021
+ * @description
1022
+ * Get the day of the month of the given date.
1023
+ *
1024
+ * @param {Date|Number} date - the given date
1025
+ * @returns {Number} the day of month
1026
+ * @throws {TypeError} 1 argument required
1027
+ *
1028
+ * @example
1029
+ * // Which day of the month is 29 February 2012?
1030
+ * const result = getDate(new Date(2012, 1, 29))
1031
+ * //=> 29
1032
+ */
1033
+ function getDate(dirtyDate) {
1034
+ index.requiredArgs(1, arguments);
1035
+ var date = index.toDate(dirtyDate);
1036
+ var dayOfMonth = date.getDate();
1037
+ return dayOfMonth;
1038
+ }
1039
+
1040
+ /**
1041
+ * @name isEqual
1042
+ * @category Common Helpers
1043
+ * @summary Are the given dates equal?
1044
+ *
1045
+ * @description
1046
+ * Are the given dates equal?
1047
+ *
1048
+ * @param {Date|Number} dateLeft - the first date to compare
1049
+ * @param {Date|Number} dateRight - the second date to compare
1050
+ * @returns {Boolean} the dates are equal
1051
+ * @throws {TypeError} 2 arguments required
1052
+ *
1053
+ * @example
1054
+ * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
1055
+ * const result = isEqual(
1056
+ * new Date(2014, 6, 2, 6, 30, 45, 0),
1057
+ * new Date(2014, 6, 2, 6, 30, 45, 500)
1058
+ * )
1059
+ * //=> false
1060
+ */
1061
+ function isEqual(dirtyLeftDate, dirtyRightDate) {
1062
+ index.requiredArgs(2, arguments);
1063
+ var dateLeft = index.toDate(dirtyLeftDate);
1064
+ var dateRight = index.toDate(dirtyRightDate);
1065
+ return dateLeft.getTime() === dateRight.getTime();
1066
+ }
1244
1067
 
1245
1068
  var ArcCalendarContext = React.createContext(null);
1246
1069
 
@@ -1292,7 +1115,7 @@ var CalendarDayNumber = React.forwardRef(function (_a, autoFocusRef) {
1292
1115
  var isAriaSelected = isSelectedDate ||
1293
1116
  (dateIsWithinHighlightedRange && selectedRange.length === 2);
1294
1117
  var tableCellProps = {
1295
- className: index$2.classNames("arc-CalendarDayNumber", conditionalClasses),
1118
+ className: index$1.classNames("arc-CalendarDayNumber", conditionalClasses),
1296
1119
  tabIndex: isFocusDate && shouldRender ? 0 : -1,
1297
1120
  "aria-current": isTodayDate ? "date" : undefined,
1298
1121
  "aria-selected": isAriaSelected,
@@ -1300,7 +1123,7 @@ var CalendarDayNumber = React.forwardRef(function (_a, autoFocusRef) {
1300
1123
  onClick: onDayNumberClick(date),
1301
1124
  onMouseEnter: onDayNumberHover(date)
1302
1125
  };
1303
- return (React__default["default"].createElement("td", index$1.__assign({ ref: handleRefs, "data-date": date.getTime() }, (shouldRender ? tableCellProps : {})), shouldRender && (React__default["default"].createElement(React__default["default"].Fragment, null,
1126
+ return (React__default["default"].createElement("td", index_es.__assign({ ref: handleRefs, "data-date": date.getTime() }, (shouldRender ? tableCellProps : {})), shouldRender && (React__default["default"].createElement(React__default["default"].Fragment, null,
1304
1127
  React__default["default"].createElement(VisuallyHidden.VisuallyHidden, null, index.format(date, "MMMM do, yyyy")),
1305
1128
  React__default["default"].createElement("div", { className: "arc-CalendarDayNumber-buttonOuter" },
1306
1129
  React__default["default"].createElement("div", { className: "arc-CalendarDayNumber-buttonInner" },
@@ -1340,6 +1163,100 @@ var CalendarDateSelect = function (_a) {
1340
1163
  React__default["default"].createElement(Icon.Icon, { size: 24, icon: BtIconChevronDownMid })))));
1341
1164
  };
1342
1165
 
1166
+ /**
1167
+ * @name isSameMonth
1168
+ * @category Month Helpers
1169
+ * @summary Are the given dates in the same month (and year)?
1170
+ *
1171
+ * @description
1172
+ * Are the given dates in the same month (and year)?
1173
+ *
1174
+ * @param {Date|Number} dateLeft - the first date to check
1175
+ * @param {Date|Number} dateRight - the second date to check
1176
+ * @returns {Boolean} the dates are in the same month (and year)
1177
+ * @throws {TypeError} 2 arguments required
1178
+ *
1179
+ * @example
1180
+ * // Are 2 September 2014 and 25 September 2014 in the same month?
1181
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
1182
+ * //=> true
1183
+ *
1184
+ * @example
1185
+ * // Are 2 September 2014 and 25 September 2015 in the same month?
1186
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
1187
+ * //=> false
1188
+ */
1189
+ function isSameMonth(dirtyDateLeft, dirtyDateRight) {
1190
+ index.requiredArgs(2, arguments);
1191
+ var dateLeft = index.toDate(dirtyDateLeft);
1192
+ var dateRight = index.toDate(dirtyDateRight);
1193
+ return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();
1194
+ }
1195
+
1196
+ /**
1197
+ * @name eachWeekOfInterval
1198
+ * @category Interval Helpers
1199
+ * @summary Return the array of weeks within the specified time interval.
1200
+ *
1201
+ * @description
1202
+ * Return the array of weeks within the specified time interval.
1203
+ *
1204
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
1205
+ * @param {Object} [options] - an object with options.
1206
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
1207
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
1208
+ * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end
1209
+ * @throws {TypeError} 1 argument required
1210
+ * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6
1211
+ * @throws {RangeError} The start of an interval cannot be after its end
1212
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
1213
+ *
1214
+ * @example
1215
+ * // Each week within interval 6 October 2014 - 23 November 2014:
1216
+ * const result = eachWeekOfInterval({
1217
+ * start: new Date(2014, 9, 6),
1218
+ * end: new Date(2014, 10, 23)
1219
+ * })
1220
+ * //=> [
1221
+ * // Sun Oct 05 2014 00:00:00,
1222
+ * // Sun Oct 12 2014 00:00:00,
1223
+ * // Sun Oct 19 2014 00:00:00,
1224
+ * // Sun Oct 26 2014 00:00:00,
1225
+ * // Sun Nov 02 2014 00:00:00,
1226
+ * // Sun Nov 09 2014 00:00:00,
1227
+ * // Sun Nov 16 2014 00:00:00,
1228
+ * // Sun Nov 23 2014 00:00:00
1229
+ * // ]
1230
+ */
1231
+ function eachWeekOfInterval(dirtyInterval, options) {
1232
+ index.requiredArgs(1, arguments);
1233
+ var interval = dirtyInterval || {};
1234
+ var startDate = index.toDate(interval.start);
1235
+ var endDate = index.toDate(interval.end);
1236
+ var endTime = endDate.getTime();
1237
+
1238
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
1239
+ if (!(startDate.getTime() <= endTime)) {
1240
+ throw new RangeError('Invalid interval');
1241
+ }
1242
+ var startDateWeek = startOfWeek(startDate, options);
1243
+ var endDateWeek = startOfWeek(endDate, options);
1244
+
1245
+ // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet
1246
+ startDateWeek.setHours(15);
1247
+ endDateWeek.setHours(15);
1248
+ endTime = endDateWeek.getTime();
1249
+ var weeks = [];
1250
+ var currentWeek = startDateWeek;
1251
+ while (currentWeek.getTime() <= endTime) {
1252
+ currentWeek.setHours(0);
1253
+ weeks.push(index.toDate(currentWeek));
1254
+ currentWeek = addWeeks(currentWeek, 1);
1255
+ currentWeek.setHours(15);
1256
+ }
1257
+ return weeks;
1258
+ }
1259
+
1343
1260
  var DAY_NAMES = [
1344
1261
  {
1345
1262
  value: WeekDays.MONDAY,
@@ -1413,7 +1330,7 @@ var CalendarDayGrid = function (_a) {
1413
1330
  var getWeeksInMonth = function (month) {
1414
1331
  return eachWeekOfInterval({ start: startOfMonth(month), end: endOfMonth(month) }, { weekStartsOn: 1 }).map(function (week) { return eachDayOfInterval({ start: week, end: addDays(week, 6) }); });
1415
1332
  };
1416
- return (React__default["default"].createElement("div", { ref: dayNumberGridRef, onMouseLeave: onDayGridLeave, className: index$2.classNames("arc-CalendarDayGrid", {
1333
+ return (React__default["default"].createElement("div", { ref: dayNumberGridRef, onMouseLeave: onDayGridLeave, className: index$1.classNames("arc-CalendarDayGrid", {
1417
1334
  "arc-CalendarDayGrid--dual": displayRange.length > 1
1418
1335
  }) }, displayRange.map(function (month) { return (React__default["default"].createElement("div", { key: month.getTime(), className: "arc-CalendarDayGrid-month" },
1419
1336
  React__default["default"].createElement("table", { className: "arc-CalendarDayGrid-table" },
@@ -1450,7 +1367,7 @@ var CalendarNavButton = function (_a) {
1450
1367
  previous: BtIconChevronLeftMid,
1451
1368
  next: BtIconChevronRightMid_esm.BtIconChevronRightMid
1452
1369
  };
1453
- return (React__default["default"].createElement("button", { "aria-label": ariaLabel, disabled: isDisabled, onClick: onClick, type: "button", className: index$2.classNames("arc-CalendarNavButton", {
1370
+ return (React__default["default"].createElement("button", { "aria-label": ariaLabel, disabled: isDisabled, onClick: onClick, type: "button", className: index$1.classNames("arc-CalendarNavButton", {
1454
1371
  "arc-CalendarNavButton--previous": direction === "previous",
1455
1372
  "arc-CalendarNavButton--next": direction === "next"
1456
1373
  }) },
@@ -1563,39 +1480,39 @@ var CalendarMonthYearView = function (_a) {
1563
1480
  };
1564
1481
 
1565
1482
  var showPreviousMonthHandler = function (payload, state) {
1566
- return index$1.__assign(index$1.__assign({}, state), { focusDate: getFocusDate({
1483
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: getFocusDate({
1567
1484
  date: subMonths(state.focusDate, 1),
1568
1485
  minDate: payload.minDate
1569
1486
  }), displayDate: subMonths(state.displayDate, 1) });
1570
1487
  };
1571
1488
 
1572
1489
  var showNextMonthHandler = function (payload, state) {
1573
- return index$1.__assign(index$1.__assign({}, state), { focusDate: getFocusDate({
1490
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: getFocusDate({
1574
1491
  date: addMonths(state.focusDate, 1),
1575
1492
  maxDate: payload.maxDate
1576
1493
  }), displayDate: addMonths(state.displayDate, 1) });
1577
1494
  };
1578
1495
 
1579
1496
  var showPreviousDoubleMonthHandler = function (payload, state) {
1580
- return index$1.__assign(index$1.__assign({}, state), { focusDate: getFocusDate({
1497
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: getFocusDate({
1581
1498
  date: subMonths(state.focusDate, 2),
1582
1499
  minDate: payload.minDate
1583
1500
  }), displayDate: subMonths(state.displayDate, 2) });
1584
1501
  };
1585
1502
 
1586
1503
  var showNextDoubleMonthHandler = function (payload, state) {
1587
- return index$1.__assign(index$1.__assign({}, state), { focusDate: getFocusDate({
1504
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: getFocusDate({
1588
1505
  date: addMonths(state.focusDate, 2),
1589
1506
  maxDate: payload.maxDate
1590
1507
  }), displayDate: addMonths(state.displayDate, 2) });
1591
1508
  };
1592
1509
 
1593
1510
  var rangeSelectHandler = function (payload, state) {
1594
- return index$1.__assign(index$1.__assign({}, state), { focusDate: payload.date, highlightedRange: payload.range });
1511
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: payload.date, highlightedRange: payload.range });
1595
1512
  };
1596
1513
 
1597
1514
  var highlightRangeHandler = function (payload, state) {
1598
- return index$1.__assign(index$1.__assign({}, state), { highlightedRange: getHighlightRange({
1515
+ return index_es.__assign(index_es.__assign({}, state), { highlightedRange: getHighlightRange({
1599
1516
  date: payload.date,
1600
1517
  range: payload.range,
1601
1518
  minDate: payload.minDate,
@@ -1604,15 +1521,15 @@ var highlightRangeHandler = function (payload, state) {
1604
1521
  };
1605
1522
 
1606
1523
  var dayNumberSelectHandler = function (payload, state) {
1607
- return index$1.__assign(index$1.__assign({}, state), { focusDate: payload });
1524
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: payload });
1608
1525
  };
1609
1526
 
1610
1527
  var dayGridLeaveHandler = function (payload, state) {
1611
1528
  if (payload.selectionType === "range" &&
1612
1529
  payload.range.filter(function (date) { return Boolean(date); }).length === 1) {
1613
- return index$1.__assign(index$1.__assign({}, state), { highlightedRange: [] });
1530
+ return index_es.__assign(index_es.__assign({}, state), { highlightedRange: [] });
1614
1531
  }
1615
- return index$1.__assign({}, state);
1532
+ return index_es.__assign({}, state);
1616
1533
  };
1617
1534
 
1618
1535
  var dropDownChangeYearHandler = function (payload, state) {
@@ -1625,22 +1542,105 @@ var dropDownChangeYearHandler = function (payload, state) {
1625
1542
  maxDate: payload.maxDate
1626
1543
  });
1627
1544
  if (minDate && isBefore(newDisplayDate, minDate)) {
1628
- return index$1.__assign(index$1.__assign({}, state), { focusDate: focusDate, displayDate: minDate });
1545
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: focusDate, displayDate: minDate });
1629
1546
  }
1630
1547
  if (maxDate && isAfter(newDisplayDate, maxDate)) {
1631
- return index$1.__assign(index$1.__assign({}, state), { focusDate: focusDate, displayDate: maxDate });
1548
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: focusDate, displayDate: maxDate });
1632
1549
  }
1633
- return index$1.__assign(index$1.__assign({}, state), { focusDate: focusDate, displayDate: newDisplayDate });
1550
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: focusDate, displayDate: newDisplayDate });
1634
1551
  };
1635
1552
 
1636
1553
  var dropDownChangeMonthHandler = function (payload, state) {
1637
- return index$1.__assign(index$1.__assign({}, state), { focusDate: getFocusDate({
1554
+ return index_es.__assign(index_es.__assign({}, state), { focusDate: getFocusDate({
1638
1555
  date: setMonth(state.focusDate, payload.month),
1639
1556
  minDate: payload.minDate,
1640
1557
  maxDate: payload.maxDate
1641
1558
  }), displayDate: setMonth(state.displayDate, payload.month) });
1642
1559
  };
1643
1560
 
1561
+ /**
1562
+ * @name isWithinInterval
1563
+ * @category Interval Helpers
1564
+ * @summary Is the given date within the interval?
1565
+ *
1566
+ * @description
1567
+ * Is the given date within the interval? (Including start and end.)
1568
+ *
1569
+ * @param {Date|Number} date - the date to check
1570
+ * @param {Interval} interval - the interval to check
1571
+ * @returns {Boolean} the date is within the interval
1572
+ * @throws {TypeError} 2 arguments required
1573
+ * @throws {RangeError} The start of an interval cannot be after its end
1574
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
1575
+ *
1576
+ * @example
1577
+ * // For the date within the interval:
1578
+ * isWithinInterval(new Date(2014, 0, 3), {
1579
+ * start: new Date(2014, 0, 1),
1580
+ * end: new Date(2014, 0, 7)
1581
+ * })
1582
+ * //=> true
1583
+ *
1584
+ * @example
1585
+ * // For the date outside of the interval:
1586
+ * isWithinInterval(new Date(2014, 0, 10), {
1587
+ * start: new Date(2014, 0, 1),
1588
+ * end: new Date(2014, 0, 7)
1589
+ * })
1590
+ * //=> false
1591
+ *
1592
+ * @example
1593
+ * // For date equal to interval start:
1594
+ * isWithinInterval(date, { start, end: date }) // => true
1595
+ *
1596
+ * @example
1597
+ * // For date equal to interval end:
1598
+ * isWithinInterval(date, { start: date, end }) // => true
1599
+ */
1600
+ function isWithinInterval(dirtyDate, interval) {
1601
+ index.requiredArgs(2, arguments);
1602
+ var time = index.toDate(dirtyDate).getTime();
1603
+ var startTime = index.toDate(interval.start).getTime();
1604
+ var endTime = index.toDate(interval.end).getTime();
1605
+
1606
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
1607
+ if (!(startTime <= endTime)) {
1608
+ throw new RangeError('Invalid interval');
1609
+ }
1610
+ return time >= startTime && time <= endTime;
1611
+ }
1612
+
1613
+ /**
1614
+ * @name setYear
1615
+ * @category Year Helpers
1616
+ * @summary Set the year to the given date.
1617
+ *
1618
+ * @description
1619
+ * Set the year to the given date.
1620
+ *
1621
+ * @param {Date|Number} date - the date to be changed
1622
+ * @param {Number} year - the year of the new date
1623
+ * @returns {Date} the new date with the year set
1624
+ * @throws {TypeError} 2 arguments required
1625
+ *
1626
+ * @example
1627
+ * // Set year 2013 to 1 September 2014:
1628
+ * const result = setYear(new Date(2014, 8, 1), 2013)
1629
+ * //=> Sun Sep 01 2013 00:00:00
1630
+ */
1631
+ function setYear(dirtyDate, dirtyYear) {
1632
+ index.requiredArgs(2, arguments);
1633
+ var date = index.toDate(dirtyDate);
1634
+ var year = index.toInteger(dirtyYear);
1635
+
1636
+ // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
1637
+ if (isNaN(date.getTime())) {
1638
+ return new Date(NaN);
1639
+ }
1640
+ date.setFullYear(year);
1641
+ return date;
1642
+ }
1643
+
1644
1644
  var calendarKeydownHandler = function (payload, state) {
1645
1645
  var displayDate = state.displayDate, focusDate = state.focusDate, highlightedRange = state.highlightedRange;
1646
1646
  var minDate = payload.minDate, maxDate = payload.maxDate, calendarType = payload.calendarType, key = payload.key, shiftKey = payload.shiftKey, range = payload.range, selectionType = payload.selectionType;
@@ -1677,21 +1677,21 @@ var calendarKeydownHandler = function (payload, state) {
1677
1677
  var isNewFocusDateVisible = isWithinInterval(newFocusDate, calendarType === "double"
1678
1678
  ? doubleMonthVisibleRange
1679
1679
  : singleMonthVisibleRange);
1680
- var commonState = index$1.__assign(index$1.__assign({}, state), { focusDate: newFocusDate, highlightedRange: newHighlightedRange });
1680
+ var commonState = index_es.__assign(index_es.__assign({}, state), { focusDate: newFocusDate, highlightedRange: newHighlightedRange });
1681
1681
  if (!isNewFocusDateVisible &&
1682
1682
  !focusDateIsMinOrMax &&
1683
1683
  isNavigatingByYear &&
1684
1684
  calendarType === "double") {
1685
- return index$1.__assign(index$1.__assign({}, commonState), { displayDate: setYear(displayDate, getYear(newFocusDate)) });
1685
+ return index_es.__assign(index_es.__assign({}, commonState), { displayDate: setYear(displayDate, getYear(newFocusDate)) });
1686
1686
  }
1687
1687
  if (!isNewFocusDateVisible) {
1688
- return index$1.__assign(index$1.__assign({}, commonState), { displayDate: startOfMonth(newFocusDate) });
1688
+ return index_es.__assign(index_es.__assign({}, commonState), { displayDate: startOfMonth(newFocusDate) });
1689
1689
  }
1690
1690
  return commonState;
1691
1691
  };
1692
1692
 
1693
1693
  var defaultHandler = function (state) {
1694
- return index$1.__assign({}, state);
1694
+ return index_es.__assign({}, state);
1695
1695
  };
1696
1696
 
1697
1697
  var reducer = function (state, action) {
@@ -1738,7 +1738,7 @@ var CalendarWrapper = function (_a) {
1738
1738
 
1739
1739
  /** Use `Calendar` to clearly present available dates and allowing users to choose a way to enter information. */
1740
1740
  var Calendar = function (_a) {
1741
- var _b = _a.type, type = _b === void 0 ? "month" : _b, _c = _a.selectionType, selectionType = _c === void 0 ? "single" : _c, _d = _a.autoFocusOnMount, autoFocusOnMount = _d === void 0 ? false : _d, _e = _a.selectedRange, rawSelectedRange = _e === void 0 ? [] : _e, _f = _a.selectedDate, rawSelectedDate = _f === void 0 ? new Date() : _f, rawDisabledDates = _a.disabledDates, rawMinDate = _a.minDate, rawMaxDate = _a.maxDate, onCancelClick = _a.onCancelClick, onDateSelect = _a.onDateSelect, onRangeSelect = _a.onRangeSelect;
1741
+ var _b = _a.type, type = _b === void 0 ? "month" : _b, _c = _a.selectionType, selectionType = _c === void 0 ? "single" : _c, _d = _a.autoFocusOnMount, autoFocusOnMount = _d === void 0 ? false : _d, _e = _a.selectedRange, rawSelectedRange = _e === void 0 ? [] : _e, _f = _a.selectedDate, rawSelectedDate = _f === void 0 ? new Date() : _f, rawDisabledDates = _a.disabledDates, rawMinDate = _a.minDate, rawMaxDate = _a.maxDate, onCancelClick = _a.onCancelClick, onDateSelect = _a.onDateSelect, onRangeSelect = _a.onRangeSelect, props = index_es.__rest(_a, ["type", "selectionType", "autoFocusOnMount", "selectedRange", "selectedDate", "disabledDates", "minDate", "maxDate", "onCancelClick", "onDateSelect", "onRangeSelect"]);
1742
1742
  var todayDate = dateWithoutTime(new Date());
1743
1743
  var selectedDate = dateWithoutTime(rawSelectedDate);
1744
1744
  var selectedRange = rawSelectedRange
@@ -1754,7 +1754,7 @@ var Calendar = function (_a) {
1754
1754
  : selectedRange[0] || todayDate,
1755
1755
  highlightedRange: selectedRange
1756
1756
  }), _j = _h[0], displayDate = _j.displayDate, focusDate = _j.focusDate, highlightedRange = _j.highlightedRange, dispatch = _h[1];
1757
- var isMinWidthArcBreakpointM = useMediaQuery.useMediaQuery("(min-width: ".concat(index_es.SemSizeBreakpointsM, ")"));
1757
+ var isMinWidthArcBreakpointM = useMediaQuery.useMediaQuery("(min-width: ".concat(index_es$1.SemSizeBreakpointsM, ")"));
1758
1758
  React.useEffect(function () {
1759
1759
  setIsClientLoaded(true);
1760
1760
  }, []);
@@ -1896,7 +1896,7 @@ var Calendar = function (_a) {
1896
1896
  }
1897
1897
  });
1898
1898
  };
1899
- return (React__default["default"].createElement(ArcCalendarContext.Provider, { value: {
1899
+ return (React__default["default"].createElement(ArcCalendarContext.Provider, index_es.__assign({ value: {
1900
1900
  minDate: minDate,
1901
1901
  maxDate: maxDate,
1902
1902
  focusDate: focusDate,
@@ -1912,7 +1912,7 @@ var Calendar = function (_a) {
1912
1912
  onDayNumberHover: onDayNumberHover,
1913
1913
  onKeyboardNavigate: onKeyboardNavigate,
1914
1914
  autoFocusOnMount: autoFocusOnMount
1915
- } },
1915
+ } }, index_es.filterDataAttrs(props)),
1916
1916
  React__default["default"].createElement("div", { style: { display: isClientLoaded ? "block" : "none" } },
1917
1917
  React__default["default"].createElement(CalendarWrapper, null,
1918
1918
  calendarType === "year" && (React__default["default"].createElement(CalendarMonthYearView, { isPreviousMonthDisabled: isPreviousMonthDisabled, isNextMonthDisabled: isNextMonthDisabled, onPreviousMonthClick: onPreviousMonthClick, onNextMonthClick: onNextMonthClick, onMonthChange: onMonthChange, onYearChange: onYearChange })),