@arc-ui/components 12.0.0-alpha.0 → 12.0.0-beta.4

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 (566) hide show
  1. package/dist/Alert/Alert.cjs.js +11 -15
  2. package/dist/Alert/Alert.esm.js +9 -13
  3. package/dist/Align/Align.cjs.js +6 -6
  4. package/dist/Align/Align.esm.js +2 -2
  5. package/dist/AppButton/AppButton.cjs.js +73 -0
  6. package/dist/AppButton/AppButton.esm.js +65 -0
  7. package/dist/AppButton/package.json +7 -0
  8. package/dist/Avatar/Avatar.cjs.js +18 -0
  9. package/dist/Avatar/Avatar.esm.js +10 -0
  10. package/dist/Avatar/package.json +7 -0
  11. package/dist/AvatarGroup/AvatarGroup.cjs.js +38 -0
  12. package/dist/AvatarGroup/AvatarGroup.esm.js +30 -0
  13. package/dist/AvatarGroup/package.json +7 -0
  14. package/dist/Badge/Badge.cjs.js +6 -21
  15. package/dist/Badge/Badge.esm.js +6 -21
  16. package/dist/Box/Box.cjs.js +6 -7
  17. package/dist/Box/Box.esm.js +3 -4
  18. package/dist/BrandLogo/BrandLogo.cjs.js +4 -4
  19. package/dist/BrandLogo/BrandLogo.esm.js +4 -4
  20. package/dist/Breadcrumbs/Breadcrumbs.cjs.js +7 -6
  21. package/dist/Breadcrumbs/Breadcrumbs.esm.js +7 -6
  22. package/dist/Button/Button.cjs.js +6 -6
  23. package/dist/Button/Button.esm.js +6 -6
  24. package/dist/ButtonV2/ButtonV2.cjs.js +16 -0
  25. package/dist/ButtonV2/ButtonV2.esm.js +8 -0
  26. package/dist/ButtonV2/package.json +7 -0
  27. package/dist/Calendar/Calendar.cjs.js +22 -0
  28. package/dist/Calendar/Calendar.esm.js +14 -0
  29. package/dist/Calendar/package.json +7 -0
  30. package/dist/Checkbox/Checkbox.cjs.js +9 -8
  31. package/dist/Checkbox/Checkbox.esm.js +9 -8
  32. package/dist/Columns/Columns.cjs.js +3 -3
  33. package/dist/Columns/Columns.esm.js +3 -3
  34. package/dist/DatePicker/DatePicker.cjs.js +40 -0
  35. package/dist/DatePicker/DatePicker.esm.js +27 -0
  36. package/dist/DatePicker/package.json +7 -0
  37. package/dist/Disclosure/Disclosure.cjs.js +15 -12
  38. package/dist/Disclosure/Disclosure.esm.js +12 -9
  39. package/dist/DisclosureMini/DisclosureMini.cjs.js +6 -6
  40. package/dist/DisclosureMini/DisclosureMini.esm.js +6 -6
  41. package/dist/Elevation/Elevation.cjs.js +5 -5
  42. package/dist/Elevation/Elevation.esm.js +1 -1
  43. package/dist/Filter/Filter.cjs.js +4 -3
  44. package/dist/Filter/Filter.esm.js +4 -3
  45. package/dist/FormControl/FormControl.cjs.js +8 -7
  46. package/dist/FormControl/FormControl.esm.js +8 -7
  47. package/dist/Grid/Grid.cjs.js +13 -0
  48. package/dist/Grid/Grid.esm.js +5 -0
  49. package/dist/Grid/package.json +7 -0
  50. package/dist/Group/Group.cjs.js +3 -3
  51. package/dist/Group/Group.esm.js +3 -3
  52. package/dist/Heading/Heading.cjs.js +4 -4
  53. package/dist/Heading/Heading.esm.js +4 -4
  54. package/dist/HeroButton/HeroButton.cjs.js +16 -0
  55. package/dist/HeroButton/HeroButton.esm.js +8 -0
  56. package/dist/HeroButton/package.json +7 -0
  57. package/dist/Hidden/Hidden.cjs.js +24 -0
  58. package/dist/Hidden/Hidden.esm.js +16 -0
  59. package/dist/Hidden/package.json +7 -0
  60. package/dist/Icon/Icon.cjs.js +4 -4
  61. package/dist/Icon/Icon.esm.js +4 -4
  62. package/dist/Image/Image.cjs.js +3 -3
  63. package/dist/Image/Image.esm.js +3 -3
  64. package/dist/ImpactCard/ImpactCard.cjs.js +44 -0
  65. package/dist/ImpactCard/ImpactCard.esm.js +36 -0
  66. package/dist/ImpactCard/package.json +7 -0
  67. package/dist/InformationCard/InformationCard.cjs.js +74 -0
  68. package/dist/InformationCard/InformationCard.esm.js +66 -0
  69. package/dist/InformationCard/package.json +7 -0
  70. package/dist/Link/Link.cjs.js +76 -0
  71. package/dist/Link/Link.esm.js +68 -0
  72. package/dist/Link/package.json +7 -0
  73. package/dist/Markup/Markup.cjs.js +6 -6
  74. package/dist/Markup/Markup.esm.js +2 -2
  75. package/dist/MediaCard/MediaCard.cjs.js +26 -0
  76. package/dist/MediaCard/MediaCard.esm.js +18 -0
  77. package/dist/MediaCard/package.json +7 -0
  78. package/dist/Modal/Modal.cjs.js +1478 -527
  79. package/dist/Modal/Modal.esm.js +1455 -523
  80. package/dist/Pagination/Pagination.cjs.js +14 -17
  81. package/dist/Pagination/Pagination.esm.js +7 -10
  82. package/dist/PaginationSimple/PaginationSimple.cjs.js +24 -27
  83. package/dist/PaginationSimple/PaginationSimple.esm.js +22 -25
  84. package/dist/Poster/Poster.cjs.js +5 -5
  85. package/dist/Poster/Poster.esm.js +5 -5
  86. package/dist/ProgressBar/ProgressBar.cjs.js +21 -18
  87. package/dist/ProgressBar/ProgressBar.esm.js +17 -14
  88. package/dist/ProgressStepper/ProgressStepper.cjs.js +6 -7
  89. package/dist/ProgressStepper/ProgressStepper.esm.js +6 -7
  90. package/dist/RadioGroup/RadioGroup.cjs.js +10 -8
  91. package/dist/RadioGroup/RadioGroup.esm.js +9 -8
  92. package/dist/Rule/Rule.cjs.js +14 -4
  93. package/dist/Rule/Rule.esm.js +15 -5
  94. package/dist/ScrollToTop/ScrollToTop.cjs.js +12 -11
  95. package/dist/ScrollToTop/ScrollToTop.esm.js +7 -6
  96. package/dist/Section/Section.cjs.js +2 -2
  97. package/dist/Section/Section.esm.js +2 -2
  98. package/dist/Select/Select.cjs.js +358 -931
  99. package/dist/Select/Select.esm.js +304 -858
  100. package/dist/SiteFooter/SiteFooter.cjs.js +10 -33
  101. package/dist/SiteFooter/SiteFooter.esm.js +10 -33
  102. package/dist/SiteHeaderV2/SiteHeaderV2.cjs.js +25 -0
  103. package/dist/SiteHeaderV2/SiteHeaderV2.esm.js +17 -0
  104. package/dist/SiteHeaderV2/package.json +7 -0
  105. package/dist/SkipLink/SkipLink.cjs.js +24 -0
  106. package/dist/SkipLink/SkipLink.esm.js +16 -0
  107. package/dist/SkipLink/package.json +7 -0
  108. package/dist/Surface/Surface.cjs.js +2 -2
  109. package/dist/Surface/Surface.esm.js +2 -2
  110. package/dist/Switch/Switch.cjs.js +28 -73
  111. package/dist/Switch/Switch.esm.js +16 -61
  112. package/dist/Tabs/Tabs.cjs.js +11 -10
  113. package/dist/Tabs/Tabs.esm.js +11 -10
  114. package/dist/Tag/Tag.cjs.js +9 -43
  115. package/dist/Tag/Tag.esm.js +8 -42
  116. package/dist/Text/Text.cjs.js +4 -4
  117. package/dist/Text/Text.esm.js +4 -4
  118. package/dist/TextArea/TextArea.cjs.js +66 -46
  119. package/dist/TextArea/TextArea.esm.js +64 -44
  120. package/dist/TextInput/TextInput.cjs.js +10 -9
  121. package/dist/TextInput/TextInput.esm.js +10 -9
  122. package/dist/Theme/Theme.cjs.js +15 -4
  123. package/dist/Theme/Theme.esm.js +15 -4
  124. package/dist/ThemeIcon/ThemeIcon.cjs.js +14 -0
  125. package/dist/ThemeIcon/ThemeIcon.esm.js +6 -0
  126. package/dist/ThemeIcon/package.json +7 -0
  127. package/dist/Toast/Toast.cjs.js +10 -9
  128. package/dist/Toast/Toast.esm.js +10 -9
  129. package/dist/Truncate/Truncate.cjs.js +3 -3
  130. package/dist/Truncate/Truncate.esm.js +1 -1
  131. package/dist/TypographyCard/TypographyCard.cjs.js +41 -0
  132. package/dist/TypographyCard/TypographyCard.esm.js +33 -0
  133. package/dist/TypographyCard/package.json +7 -0
  134. package/dist/UniversalHeader/UniversalHeader.cjs.js +3 -3
  135. package/dist/UniversalHeader/UniversalHeader.esm.js +3 -3
  136. package/dist/VerticalSpace/VerticalSpace.cjs.js +2 -2
  137. package/dist/VerticalSpace/VerticalSpace.esm.js +2 -2
  138. package/dist/VideoPlayer/VideoPlayer.cjs.js +3013 -0
  139. package/dist/VideoPlayer/VideoPlayer.esm.js +3005 -0
  140. package/dist/VideoPlayer/package.json +7 -0
  141. package/dist/Visible/Visible.cjs.js +24 -0
  142. package/dist/Visible/Visible.esm.js +16 -0
  143. package/dist/Visible/package.json +7 -0
  144. package/dist/VisuallyHidden/VisuallyHidden.cjs.js +1 -1
  145. package/dist/VisuallyHidden/VisuallyHidden.esm.js +1 -1
  146. package/dist/_shared/cjs/ArcIconEclipse.esm-ac777a76.js +28 -0
  147. package/dist/_shared/cjs/Avatar-fc0d9b8b.js +49 -0
  148. package/dist/_shared/cjs/{BrandLogo-aea340c8.js → BrandLogo-1d2ca2c7.js} +7 -7
  149. package/dist/_shared/cjs/{Breadcrumbs-f3385e2e.js → Breadcrumbs-7af0af2c.js} +16 -16
  150. package/dist/_shared/cjs/BtIconArrowRight.esm-5989f2ca.js +38 -0
  151. package/dist/_shared/cjs/BtIconChevronRightMid.esm-3e8d18a9.js +28 -0
  152. package/dist/_shared/cjs/BtIconPlayFill.esm-b8997cfc.js +30 -0
  153. package/dist/_shared/cjs/{Button-5c958ce9.js → Button-7d891a89.js} +12 -12
  154. package/dist/_shared/cjs/ButtonV2-b2db3f46.js +48 -0
  155. package/dist/_shared/cjs/Calendar-4a63f28d.js +1927 -0
  156. package/dist/_shared/cjs/CardFooter-5414bc4f.js +79 -0
  157. package/dist/_shared/cjs/{Checkbox-5f14bb0d.js → Checkbox-0e423653.js} +18 -14
  158. package/dist/_shared/cjs/{Columns-ae4f8cef.js → Columns-1224bdff.js} +9 -16
  159. package/dist/_shared/cjs/Combination-3a639f6d.js +2974 -0
  160. package/dist/_shared/cjs/ConditionalWrapper-be3b2625.js +14 -0
  161. package/dist/_shared/cjs/DatePicker-cd21e362.js +550 -0
  162. package/dist/_shared/cjs/{DisclosureMini-145105a4.js → DisclosureMini-c01ecce0.js} +12 -15
  163. package/dist/_shared/cjs/{Filter-1bde635c.js → Filter-3b897d92.js} +32 -24
  164. package/dist/_shared/cjs/{FormControl-30f2330f.js → FormControl-88d48f42.js} +32 -17
  165. package/dist/_shared/cjs/Grid-9e91fb3d.js +46 -0
  166. package/dist/_shared/cjs/{Group-0429741a.js → Group-3d5ea240.js} +9 -16
  167. package/dist/_shared/cjs/{Heading-27cba320.js → Heading-fb63844f.js} +7 -7
  168. package/dist/_shared/cjs/HeroButton-0586a7c4.js +126 -0
  169. package/dist/_shared/cjs/{Icon-a47b6c0a.js → Icon-0ec0c1fb.js} +12 -8
  170. package/dist/_shared/cjs/Image-e9a5a326.js +56 -0
  171. package/dist/_shared/cjs/MediaCard-4ccbb3ee.js +65 -0
  172. package/dist/_shared/cjs/{Poster-499b78da.js → Poster-b7242b37.js} +14 -14
  173. package/dist/_shared/cjs/Preview-0bf3f6e8.js +167 -0
  174. package/dist/_shared/cjs/ProgressStepper-fb8405c2.js +121 -0
  175. package/dist/_shared/cjs/RadioGroup-a4186267.js +85 -0
  176. package/dist/_shared/cjs/{Section-59804166.js → Section-ecfc659b.js} +5 -5
  177. package/dist/_shared/cjs/{SiteFooter-0638c27c.js → SiteFooter-e344da9f.js} +13 -12
  178. package/dist/_shared/cjs/SiteHeaderV2-cd793f59.js +689 -0
  179. package/dist/_shared/cjs/{Surface-038db6e1.js → Surface-8599dbe4.js} +23 -23
  180. package/dist/_shared/cjs/{Tabs-ade6d6b6.js → Tabs-75c34f43.js} +35 -39
  181. package/dist/_shared/cjs/Tag-452048f6.js +44 -0
  182. package/dist/_shared/cjs/{Text-606ca3a2.js → Text-1c1110a4.js} +7 -7
  183. package/dist/_shared/cjs/TextInput-762e2309.js +103 -0
  184. package/dist/_shared/cjs/{ThemeIcon-9534f091.js → ThemeIcon-ee814862.js} +8 -8
  185. package/dist/_shared/cjs/{Toast-6d4021d7.js → Toast-d06a89e0.js} +283 -44
  186. package/dist/_shared/cjs/UniversalHeader-f6d9c63a.js +29 -0
  187. package/dist/_shared/cjs/{VerticalSpace-dc53bb70.js → VerticalSpace-e128ec68.js} +5 -5
  188. package/dist/_shared/cjs/{VisuallyHidden-e2c8b291.js → VisuallyHidden-b0de4c7b.js} +1 -1
  189. package/dist/_shared/cjs/_commonjsHelpers-56412ec5.js +21 -0
  190. package/dist/_shared/cjs/{index-38d3848e.js → component-df82bc05.js} +154 -435
  191. package/dist/_shared/cjs/{debounce-123468fb.js → debounce-a74c28cf.js} +2 -2
  192. package/dist/_shared/cjs/index-039a9d35.js +23 -0
  193. package/dist/_shared/cjs/{index-23b4f49f.js → index-0c6319ec.js} +1 -1
  194. package/dist/_shared/cjs/index-28447df0.js +23 -0
  195. package/dist/_shared/cjs/index-3d629205.js +26 -0
  196. package/dist/_shared/cjs/{index.module-7d7228b3.js → index-3dd54df1.js} +47 -49
  197. package/dist/_shared/cjs/index-41b09e85.js +53 -0
  198. package/dist/_shared/cjs/{index-d75774a9.js → index-7aa7f96a.js} +1 -1
  199. package/dist/_shared/cjs/index-7e31a45b.js +2206 -0
  200. package/dist/_shared/cjs/index-996dec94.js +131 -0
  201. package/dist/_shared/cjs/index-dcfdd5da.js +11 -0
  202. package/dist/_shared/cjs/{filter-data-attrs-1c9a530c.js → index-df60851b.js} +17 -57
  203. package/dist/_shared/cjs/index.es-1299e41d.js +13 -0
  204. package/dist/_shared/cjs/{suffix-modifier-64dcd338.js → suffix-modifier-c8a34402.js} +2 -2
  205. package/dist/_shared/cjs/{index.es-77def0c9.js → use-media-query-d34c83b9.js} +0 -9
  206. package/dist/_shared/esm/ArcIconEclipse.esm-bb48b82a.js +22 -0
  207. package/dist/_shared/esm/Avatar-38cc0595.js +43 -0
  208. package/dist/_shared/esm/{BrandLogo-1af78f76.js → BrandLogo-7ed8aeda.js} +3 -3
  209. package/dist/_shared/esm/{Breadcrumbs-c4b65cff.js → Breadcrumbs-9078b68e.js} +8 -8
  210. package/dist/_shared/esm/BtIconArrowRight.esm-6a17d0ce.js +31 -0
  211. package/dist/_shared/esm/BtIconChevronRightMid.esm-4764708f.js +22 -0
  212. package/dist/_shared/esm/BtIconPlayFill.esm-05fc0344.js +24 -0
  213. package/dist/_shared/esm/{Button-c3348ed8.js → Button-dde2b46a.js} +6 -6
  214. package/dist/_shared/esm/ButtonV2-49cd0615.js +42 -0
  215. package/dist/_shared/esm/Calendar-4813cac2.js +1918 -0
  216. package/dist/_shared/esm/CardFooter-c79fb2db.js +73 -0
  217. package/dist/_shared/esm/{Checkbox-2a623386.js → Checkbox-0baca464.js} +14 -10
  218. package/dist/_shared/esm/{Columns-d96b7425.js → Columns-6a8f6fbb.js} +3 -10
  219. package/dist/_shared/esm/Combination-ae3a3f08.js +2942 -0
  220. package/dist/_shared/esm/ConditionalWrapper-59be8f35.js +8 -0
  221. package/dist/_shared/esm/DatePicker-fa18bb81.js +539 -0
  222. package/dist/_shared/esm/{DisclosureMini-bf95a9db.js → DisclosureMini-38f4c459.js} +8 -11
  223. package/dist/_shared/esm/{Filter-58a42358.js → Filter-49dcf5ce.js} +24 -16
  224. package/dist/_shared/esm/{FormControl-433228f5.js → FormControl-d873f7fa.js} +29 -14
  225. package/dist/_shared/esm/Grid-fb9fc522.js +40 -0
  226. package/dist/_shared/esm/{Group-73fdb896.js → Group-66196f07.js} +3 -10
  227. package/dist/_shared/esm/{Heading-d16e0e53.js → Heading-906c7c7c.js} +3 -3
  228. package/dist/_shared/esm/HeroButton-7ea692bf.js +120 -0
  229. package/dist/_shared/esm/{Icon-9ecaaeab.js → Icon-512f834f.js} +9 -5
  230. package/dist/_shared/esm/{Image-12fbd327.js → Image-57d08939.js} +15 -5
  231. package/dist/_shared/esm/MediaCard-f4758794.js +59 -0
  232. package/dist/_shared/esm/{Poster-699dc89b.js → Poster-e05a8b45.js} +6 -6
  233. package/dist/_shared/esm/Preview-43b2a75d.js +161 -0
  234. package/dist/_shared/esm/ProgressStepper-189ed0f9.js +115 -0
  235. package/dist/_shared/esm/RadioGroup-8ff17cbb.js +78 -0
  236. package/dist/_shared/esm/{Section-73781b56.js → Section-1acbc06a.js} +1 -1
  237. package/dist/_shared/esm/{SiteFooter-d21da7ab.js → SiteFooter-299646d9.js} +9 -8
  238. package/dist/_shared/esm/SiteHeaderV2-8208ddb7.js +683 -0
  239. package/dist/_shared/esm/{Surface-0ca6817d.js → Surface-71d21a9e.js} +17 -17
  240. package/dist/_shared/esm/{Tabs-39d24a7d.js → Tabs-21ac7dfe.js} +11 -15
  241. package/dist/_shared/esm/Tag-2513c185.js +38 -0
  242. package/dist/_shared/esm/{Text-14f586ac.js → Text-a46fb76b.js} +3 -3
  243. package/dist/_shared/esm/TextInput-94c7b1a4.js +96 -0
  244. package/dist/_shared/esm/{ThemeIcon-eab5a4d0.js → ThemeIcon-c2dc41a6.js} +3 -3
  245. package/dist/_shared/esm/{Toast-dce2d01e.js → Toast-de6ca2f3.js} +261 -23
  246. package/dist/_shared/esm/{UniversalHeader-b4c1577c.js → UniversalHeader-456ad60c.js} +8 -13
  247. package/dist/_shared/esm/{VerticalSpace-43cd9138.js → VerticalSpace-b07cd8e6.js} +1 -1
  248. package/dist/_shared/esm/{VisuallyHidden-b9eebf71.js → VisuallyHidden-06692fd3.js} +1 -1
  249. package/dist/_shared/esm/_commonjsHelpers-0109d574.js +18 -0
  250. package/dist/_shared/esm/{index-ffd720d0.js → component-d0a555cf.js} +144 -432
  251. package/dist/_shared/esm/{debounce-6fed6b84.js → debounce-c8e41002.js} +1 -1
  252. package/dist/_shared/esm/{filter-data-attrs-ea8f4ed4.js → index-288c66b5.js} +17 -55
  253. package/dist/_shared/esm/index-4e58de24.js +51 -0
  254. package/dist/_shared/esm/index-5113ed53.js +24 -0
  255. package/dist/_shared/esm/index-6028d797.js +21 -0
  256. package/dist/_shared/esm/index-605031ca.js +2197 -0
  257. package/dist/_shared/esm/index-69089474.js +21 -0
  258. package/dist/_shared/esm/{index-3147c5b0.js → index-7740883c.js} +1 -1
  259. package/dist/_shared/esm/index-a624de47.js +9 -0
  260. package/dist/_shared/esm/{index.module-50b2c98a.js → index-cace3545.js} +43 -45
  261. package/dist/_shared/esm/{index-65264b4e.js → index-f97466e9.js} +1 -1
  262. package/dist/_shared/esm/index-fa93ec97.js +129 -0
  263. package/dist/_shared/esm/index.es-28a91edf.js +9 -0
  264. package/dist/_shared/esm/{suffix-modifier-3d548e45.js → suffix-modifier-1ce05abe.js} +2 -2
  265. package/dist/_shared/esm/{index.es-00cb3bcb.js → use-media-query-d3622da8.js} +1 -8
  266. package/dist/index.es.js +18330 -38186
  267. package/dist/index.es.js.map +1 -1
  268. package/dist/index.js +18317 -38162
  269. package/dist/index.js.map +1 -1
  270. package/dist/styles.css +7 -38
  271. package/dist/types/components/Alert/Alert.d.ts +1 -1
  272. package/dist/types/components/AppButton/AppButton.d.ts +9 -0
  273. package/dist/types/components/AppButton/icons/AppStore.d.ts +2 -0
  274. package/dist/types/components/AppButton/icons/GooglePlay.d.ts +2 -0
  275. package/dist/types/components/AppButton/index.d.ts +1 -0
  276. package/dist/types/components/Avatar/Avatar.d.ts +14 -0
  277. package/dist/types/components/Avatar/components/AvatarContent/AvatarContent.d.ts +9 -0
  278. package/dist/types/components/Avatar/index.d.ts +1 -0
  279. package/dist/types/components/Avatar/types/avatar-icon-size.d.ts +1 -0
  280. package/dist/types/components/Avatar/types/avatar-image.d.ts +2 -0
  281. package/dist/types/components/Avatar/types/avatar-size.d.ts +1 -0
  282. package/dist/types/components/Avatar/types/avatar-text-size.d.ts +2 -0
  283. package/dist/types/components/AvatarGroup/AvatarGroup.d.ts +14 -0
  284. package/dist/types/components/AvatarGroup/index.d.ts +1 -0
  285. package/dist/types/components/AvatarGroup/types/group-avatar.d.ts +2 -0
  286. package/dist/types/components/AvatarGroup/utils/get-avatars.d.ts +2 -0
  287. package/dist/types/components/Badge/Badge.d.ts +1 -9
  288. package/dist/types/components/Button/Button.d.ts +1 -1
  289. package/dist/types/components/ButtonV2/ButtonV2.d.ts +79 -0
  290. package/dist/types/components/ButtonV2/index.d.ts +1 -0
  291. package/dist/types/components/Calendar/Calendar.d.ts +50 -0
  292. package/dist/types/components/Calendar/Calendar.provider.d.ts +21 -0
  293. package/dist/types/components/Calendar/components/CalendarDateSelect/CalendarDateSelect.d.ts +15 -0
  294. package/dist/types/components/Calendar/components/CalendarDateSelect/index.d.ts +1 -0
  295. package/dist/types/components/Calendar/components/CalendarDayGrid/CalendarDayGrid.d.ts +6 -0
  296. package/dist/types/components/Calendar/components/CalendarDayGrid/index.d.ts +1 -0
  297. package/dist/types/components/Calendar/components/CalendarDayNumber/CalendarDayNumber.d.ts +8 -0
  298. package/dist/types/components/Calendar/components/CalendarDayNumber/index.d.ts +1 -0
  299. package/dist/types/components/Calendar/components/CalendarDoubleMonthView/CalendarDoubleMonthView.d.ts +9 -0
  300. package/dist/types/components/Calendar/components/CalendarDoubleMonthView/index.d.ts +1 -0
  301. package/dist/types/components/Calendar/components/CalendarFooter/CalendarFooter.d.ts +6 -0
  302. package/dist/types/components/Calendar/components/CalendarFooter/index.d.ts +1 -0
  303. package/dist/types/components/Calendar/components/CalendarMonthView/CalendarMonthView.d.ts +9 -0
  304. package/dist/types/components/Calendar/components/CalendarMonthView/index.d.ts +1 -0
  305. package/dist/types/components/Calendar/components/CalendarMonthYearView/CalendarMonthYearView.d.ts +11 -0
  306. package/dist/types/components/Calendar/components/CalendarMonthYearView/index.d.ts +1 -0
  307. package/dist/types/components/Calendar/components/CalendarNavButton/CalendarNavButton.d.ts +10 -0
  308. package/dist/types/components/Calendar/components/CalendarNavButton/index.d.ts +1 -0
  309. package/dist/types/components/Calendar/components/CalendarWrapper/CalendarWrapper.d.ts +5 -0
  310. package/dist/types/components/Calendar/components/CalendarWrapper/index.d.ts +1 -0
  311. package/dist/types/components/Calendar/components/index.d.ts +6 -0
  312. package/dist/types/components/Calendar/constants/day-names.d.ts +5 -0
  313. package/dist/types/components/Calendar/constants/index.d.ts +1 -0
  314. package/dist/types/components/Calendar/helpers/contains-date.d.ts +1 -0
  315. package/dist/types/components/Calendar/helpers/contains-date.test.d.ts +1 -0
  316. package/dist/types/components/Calendar/helpers/date-without-time.d.ts +1 -0
  317. package/dist/types/components/Calendar/helpers/date-without-time.test.d.ts +1 -0
  318. package/dist/types/components/Calendar/helpers/get-calendar-type.d.ts +2 -0
  319. package/dist/types/components/Calendar/helpers/get-calendar-type.test.d.ts +1 -0
  320. package/dist/types/components/Calendar/helpers/get-dates-in-month.d.ts +1 -0
  321. package/dist/types/components/Calendar/helpers/get-dates-in-month.test.d.ts +1 -0
  322. package/dist/types/components/Calendar/helpers/get-double-month-display-range.d.ts +1 -0
  323. package/dist/types/components/Calendar/helpers/get-double-month-display-range.test.d.ts +1 -0
  324. package/dist/types/components/Calendar/helpers/get-focus-date.d.ts +5 -0
  325. package/dist/types/components/Calendar/helpers/get-focus-date.test.d.ts +1 -0
  326. package/dist/types/components/Calendar/helpers/get-highlighted-range.d.ts +6 -0
  327. package/dist/types/components/Calendar/helpers/get-highlighted-range.test.d.ts +1 -0
  328. package/dist/types/components/Calendar/helpers/get-keydown-date.d.ts +6 -0
  329. package/dist/types/components/Calendar/helpers/get-keydown-date.test.d.ts +1 -0
  330. package/dist/types/components/Calendar/helpers/index.d.ts +13 -0
  331. package/dist/types/components/Calendar/helpers/is-day.d.ts +2 -0
  332. package/dist/types/components/Calendar/helpers/is-day.test.d.ts +1 -0
  333. package/dist/types/components/Calendar/helpers/is-disabled-date.d.ts +1 -0
  334. package/dist/types/components/Calendar/helpers/is-disabled-date.test.d.ts +1 -0
  335. package/dist/types/components/Calendar/helpers/is-month-after-max-date.d.ts +1 -0
  336. package/dist/types/components/Calendar/helpers/is-month-after-max-date.test.d.ts +1 -0
  337. package/dist/types/components/Calendar/helpers/is-month-before-min-date.d.ts +1 -0
  338. package/dist/types/components/Calendar/helpers/is-month-before-min-date.test.d.ts +1 -0
  339. package/dist/types/components/Calendar/helpers/process-selected-range.d.ts +9 -0
  340. package/dist/types/components/Calendar/helpers/process-selected-range.test.d.ts +1 -0
  341. package/dist/types/components/Calendar/index.d.ts +2 -0
  342. package/dist/types/components/Calendar/state/handlers/calendar-keydown-handler.d.ts +3 -0
  343. package/dist/types/components/Calendar/state/handlers/day-grid-leave-handler.d.ts +3 -0
  344. package/dist/types/components/Calendar/state/handlers/day-number-select-handler.d.ts +3 -0
  345. package/dist/types/components/Calendar/state/handlers/default-handler.d.ts +2 -0
  346. package/dist/types/components/Calendar/state/handlers/dropdown-change-month-handler.d.ts +3 -0
  347. package/dist/types/components/Calendar/state/handlers/dropdown-change-year-handler.d.ts +3 -0
  348. package/dist/types/components/Calendar/state/handlers/highlight-range-handler.d.ts +3 -0
  349. package/dist/types/components/Calendar/state/handlers/index.d.ts +12 -0
  350. package/dist/types/components/Calendar/state/handlers/range-select-handler.d.ts +3 -0
  351. package/dist/types/components/Calendar/state/handlers/show-next-double-month-handler.d.ts +3 -0
  352. package/dist/types/components/Calendar/state/handlers/show-next-month-handler.d.ts +3 -0
  353. package/dist/types/components/Calendar/state/handlers/show-previous-double-month-handler.d.ts +3 -0
  354. package/dist/types/components/Calendar/state/handlers/show-previous-month-handler.d.ts +3 -0
  355. package/dist/types/components/Calendar/state/index.d.ts +2 -0
  356. package/dist/types/components/Calendar/state/reducer.d.ts +3 -0
  357. package/dist/types/components/Calendar/state/reducer.test.d.ts +1 -0
  358. package/dist/types/components/Calendar/state/types/actions.d.ts +81 -0
  359. package/dist/types/components/Calendar/state/types/state-handler.d.ts +3 -0
  360. package/dist/types/components/Calendar/state/types/state.d.ts +5 -0
  361. package/dist/types/components/Calendar/types/calendar-type.d.ts +1 -0
  362. package/dist/types/components/Calendar/types/date-select-value.d.ts +2 -0
  363. package/dist/types/components/Calendar/types/index.d.ts +6 -0
  364. package/dist/types/components/Calendar/types/key-names.d.ts +13 -0
  365. package/dist/types/components/Calendar/types/range-selection.d.ts +10 -0
  366. package/dist/types/components/Calendar/types/selection-type.d.ts +1 -0
  367. package/dist/types/components/Calendar/types/week-days.d.ts +18 -0
  368. package/dist/types/components/Checkbox/Checkbox.d.ts +7 -4
  369. package/dist/types/components/DatePicker/DatePicker.d.ts +20 -0
  370. package/dist/types/components/DatePicker/constants/date-format.d.ts +1 -0
  371. package/dist/types/components/DatePicker/constants/index.d.ts +1 -0
  372. package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.d.ts +1 -0
  373. package/dist/types/components/DatePicker/helpers/convert-date-string-to-date.test.d.ts +1 -0
  374. package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.d.ts +1 -0
  375. package/dist/types/components/DatePicker/helpers/convert-range-string-to-dates.test.d.ts +1 -0
  376. package/dist/types/components/DatePicker/helpers/format-date.d.ts +1 -0
  377. package/dist/types/components/DatePicker/helpers/format-date.test.d.ts +1 -0
  378. package/dist/types/components/DatePicker/helpers/index.d.ts +8 -0
  379. package/dist/types/components/DatePicker/helpers/is-date-valid.d.ts +1 -0
  380. package/dist/types/components/DatePicker/helpers/is-date-valid.test.d.ts +1 -0
  381. package/dist/types/components/DatePicker/helpers/is-disabled-date.d.ts +1 -0
  382. package/dist/types/components/DatePicker/helpers/is-disabled-date.test.d.ts +1 -0
  383. package/dist/types/components/DatePicker/helpers/is-range-valid.d.ts +1 -0
  384. package/dist/types/components/DatePicker/helpers/is-range-valid.test.d.ts +1 -0
  385. package/dist/types/components/DatePicker/helpers/parse-date-string.d.ts +5 -0
  386. package/dist/types/components/DatePicker/helpers/parse-date-string.test.d.ts +1 -0
  387. package/dist/types/components/DatePicker/helpers/parse-range-string.d.ts +14 -0
  388. package/dist/types/components/DatePicker/helpers/parse-range-string.test.d.ts +1 -0
  389. package/dist/types/components/DatePicker/index.d.ts +6 -0
  390. package/dist/types/components/Disclosure/Disclosure.d.ts +1 -2
  391. package/dist/types/components/DisclosureMini/DisclosureMini.d.ts +1 -2
  392. package/dist/types/components/Filter/Filter.d.ts +1 -1
  393. package/dist/types/components/Filter/FilterItems/FilterItems.d.ts +4 -0
  394. package/dist/types/components/FormControl/FormControl.d.ts +5 -1
  395. package/dist/types/components/Grid/Grid.constants.d.ts +1 -0
  396. package/dist/types/components/Grid/Grid.d.ts +28 -0
  397. package/dist/types/components/Grid/Grid.types.d.ts +10 -0
  398. package/dist/types/components/Grid/components/Col/Col.d.ts +10 -0
  399. package/dist/types/components/Grid/components/Col/index.d.ts +1 -0
  400. package/dist/types/components/Grid/components/Row/Row.d.ts +10 -0
  401. package/dist/types/components/Grid/components/Row/index.d.ts +1 -0
  402. package/dist/types/components/Grid/index.d.ts +2 -0
  403. package/dist/types/components/HeroButton/HeroButton.d.ts +66 -0
  404. package/dist/types/components/HeroButton/index.d.ts +1 -0
  405. package/dist/types/components/Hidden/Hidden.d.ts +11 -0
  406. package/dist/types/components/Hidden/index.d.ts +1 -0
  407. package/dist/types/components/Icon/Icon.d.ts +4 -0
  408. package/dist/types/components/Image/Image.d.ts +4 -0
  409. package/dist/types/components/ImpactCard/ImpactCard.d.ts +58 -0
  410. package/dist/types/components/ImpactCard/index.d.ts +1 -0
  411. package/dist/types/components/InformationCard/InformationCard.d.ts +62 -0
  412. package/dist/types/components/InformationCard/index.d.ts +1 -0
  413. package/dist/types/components/Link/Link.d.ts +52 -0
  414. package/dist/types/components/Link/index.d.ts +1 -0
  415. package/dist/types/components/MediaCard/MediaCard.d.ts +27 -28
  416. package/dist/types/components/MediaCard/types/index.d.ts +2 -0
  417. package/dist/types/components/MediaCard/types/media-card-image.d.ts +4 -0
  418. package/dist/types/components/MediaCard/types/media-card-video.d.ts +4 -0
  419. package/dist/types/components/Modal/Modal.d.ts +3 -3
  420. package/dist/types/components/Pagination/Pagination.d.ts +1 -1
  421. package/dist/types/components/PaginationSimple/PaginationSimple.d.ts +12 -4
  422. package/dist/types/components/Poster/Poster.d.ts +1 -1
  423. package/dist/types/components/ProgressBar/ProgressBar.d.ts +4 -0
  424. package/dist/types/components/ProgressStepper/ProgressStepper.d.ts +2 -2
  425. package/dist/types/components/ProgressStepper/ProgressStepperItem/ProgressStepperItem.d.ts +3 -7
  426. package/dist/types/components/ProgressStepper/ProgressStepperItem/icons/Complete.d.ts +2 -0
  427. package/dist/types/components/ProgressStepper/ProgressStepperItem/icons/Current.d.ts +2 -0
  428. package/dist/types/components/ProgressStepper/ProgressStepperItem/icons/Error.d.ts +2 -0
  429. package/dist/types/components/ProgressStepper/ProgressStepperItem/icons/Todo.d.ts +2 -0
  430. package/dist/types/components/ProgressStepper/ProgressStepperItem/icons/Warning.d.ts +2 -0
  431. package/dist/types/components/RadioGroup/RadioButton/RadioButton.d.ts +17 -23
  432. package/dist/types/components/RadioGroup/RadioButtonGroupInput/RadioButtonGroupInput.d.ts +36 -0
  433. package/dist/types/components/RadioGroup/RadioButtonGroupInput/index.d.ts +1 -0
  434. package/dist/types/components/RadioGroup/RadioGroup.d.ts +11 -3
  435. package/dist/types/components/RadioGroup/context.d.ts +1 -1
  436. package/dist/types/components/RadioGroup/index.d.ts +1 -0
  437. package/dist/types/components/Rule/Rule.d.ts +2 -1
  438. package/dist/types/components/Select/Select.d.ts +53 -0
  439. package/dist/types/components/SiteFooter/index.d.ts +0 -1
  440. package/dist/types/components/SiteHeaderV2/SiteHeaderV2.d.ts +82 -0
  441. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/BackButton/BackButton.d.ts +1 -0
  442. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/Column/Column.d.ts +1 -1
  443. package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/HorizontalPanel.d.ts +13 -0
  444. package/dist/types/components/SiteHeaderV2/components/HorizontalPanel/index.d.ts +1 -0
  445. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/ItemGroup/ItemGroup.d.ts +1 -0
  446. package/dist/types/components/SiteHeaderV2/components/ItemGroup/index.d.ts +1 -0
  447. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/NavItem/NavItem.d.ts +5 -6
  448. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/NavItem/NavItemWithSubNav.d.ts +13 -4
  449. package/dist/types/components/SiteHeaderV2/components/NavItem/index.d.ts +2 -0
  450. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/NodeItem/NodeItem.d.ts +1 -1
  451. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/Panel/Panel.d.ts +8 -2
  452. package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/SubNavItem/SubNavItem.d.ts +5 -7
  453. package/dist/types/components/SiteHeaderV2/components/SubNavItem/index.d.ts +1 -0
  454. package/dist/types/components/SiteHeaderV2/components/VerticalDivider/VerticalDivider.d.ts +2 -0
  455. package/dist/types/components/SiteHeaderV2/components/VerticalDivider/index.d.ts +1 -0
  456. package/dist/types/components/SiteHeaderV2/index.d.ts +1 -0
  457. package/dist/types/components/SkipLink/SkipLink.d.ts +12 -0
  458. package/dist/types/components/SkipLink/SkipLinkItem/SkipLinkItem.d.ts +16 -0
  459. package/dist/types/components/SkipLink/index.d.ts +1 -0
  460. package/dist/types/components/Surface/Surface.d.ts +3 -3
  461. package/dist/types/components/Switch/Switch.d.ts +2 -2
  462. package/dist/types/components/Tabs/Tabs.d.ts +1 -0
  463. package/dist/types/components/Tag/Tag.d.ts +5 -1
  464. package/dist/types/components/TextArea/TextArea.d.ts +17 -0
  465. package/dist/types/components/TextInput/TextInput.d.ts +46 -6
  466. package/dist/types/components/Theme/Theme.d.ts +11 -3
  467. package/dist/types/components/Theme/index.d.ts +1 -1
  468. package/dist/types/components/ThemeIcon/icon-names.d.ts +1 -1
  469. package/dist/types/components/Toast/Toast.d.ts +1 -1
  470. package/dist/types/components/TypographyCard/TypographyCard.d.ts +58 -0
  471. package/dist/types/components/TypographyCard/index.d.ts +1 -0
  472. package/dist/types/components/UniversalHeader/UniversalHeader.d.ts +4 -0
  473. package/dist/types/components/VideoPlayer/VideoPlayer.d.ts +18 -0
  474. package/dist/types/components/VideoPlayer/index.d.ts +1 -0
  475. package/dist/types/components/Visible/Visible.d.ts +11 -0
  476. package/dist/types/components/Visible/index.d.ts +1 -0
  477. package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +1 -1
  478. package/dist/types/components/index.d.ts +17 -5
  479. package/dist/types/helpers/get-theme-img.d.ts +6 -0
  480. package/dist/types/helpers/index.d.ts +1 -0
  481. package/dist/types/hooks/index.d.ts +2 -4
  482. package/dist/types/hooks/private/index.d.ts +5 -0
  483. package/dist/types/hooks/private/use-aria-describedby/index.d.ts +1 -0
  484. package/dist/types/hooks/private/use-interaction-mode/index.d.ts +1 -0
  485. package/dist/types/hooks/private/use-numeric-input/index.d.ts +1 -0
  486. package/dist/types/hooks/{use-numeric-input.d.ts → private/use-numeric-input/use-numeric-input.d.ts} +3 -3
  487. package/dist/types/hooks/private/use-pagination/index.d.ts +1 -0
  488. package/dist/types/hooks/private/use-theme-element/index.d.ts +1 -0
  489. package/dist/types/hooks/public/index.d.ts +1 -0
  490. package/dist/types/hooks/public/use-media-query/index.d.ts +1 -0
  491. package/dist/types/hooks/{use-media-query.d.ts → public/use-media-query/use-media-query.d.ts} +1 -1
  492. package/dist/types/index.d.ts +1 -0
  493. package/dist/types/private-components/CardFooter/CardFooter.d.ts +11 -0
  494. package/dist/types/private-components/CardFooter/index.d.ts +1 -0
  495. package/dist/types/private-components/CardHeading/CardHeading.d.ts +19 -0
  496. package/dist/types/private-components/CardHeading/index.d.ts +1 -0
  497. package/dist/types/private-components/ConditionalWrapper/ConditionalWrapper.d.ts +7 -0
  498. package/dist/types/private-components/ConditionalWrapper/index.d.ts +1 -0
  499. package/dist/types/private-components/index.d.ts +3 -0
  500. package/dist/types/styles.d.ts +22 -5
  501. package/dist/types/types/auto-complete-types.d.ts +1 -0
  502. package/dist/use-media-query/package.json +7 -0
  503. package/dist/use-media-query/use-media-query.cjs.js +10 -0
  504. package/dist/use-media-query/use-media-query.esm.js +2 -0
  505. package/package.json +53 -37
  506. package/dist/Base/Base.cjs.js +0 -11
  507. package/dist/Base/Base.esm.js +0 -3
  508. package/dist/Base/package.json +0 -7
  509. package/dist/Card/Card.cjs.js +0 -18
  510. package/dist/Card/Card.esm.js +0 -10
  511. package/dist/Card/package.json +0 -7
  512. package/dist/Clock/Clock.cjs.js +0 -43
  513. package/dist/Clock/Clock.esm.js +0 -34
  514. package/dist/Clock/package.json +0 -7
  515. package/dist/SiteHeader/SiteHeader.cjs.js +0 -22
  516. package/dist/SiteHeader/SiteHeader.esm.js +0 -13
  517. package/dist/SiteHeader/package.json +0 -7
  518. package/dist/_shared/cjs/Base-f5a86eed.js +0 -22
  519. package/dist/_shared/cjs/Card-eb1c20c1.js +0 -121
  520. package/dist/_shared/cjs/Image-e873b8fc.js +0 -46
  521. package/dist/_shared/cjs/ProgressStepper-74ee1eec.js +0 -88
  522. package/dist/_shared/cjs/RadioGroup-9bc96f6a.js +0 -69
  523. package/dist/_shared/cjs/SiteHeader.rehydrator-42c4a0e0.js +0 -670
  524. package/dist/_shared/cjs/TextInput-a5f72f6f.js +0 -81
  525. package/dist/_shared/cjs/UniversalHeader-5e43d320.js +0 -34
  526. package/dist/_shared/cjs/extends-8c5e4b48.js +0 -18
  527. package/dist/_shared/cjs/index-4aa11039.js +0 -490
  528. package/dist/_shared/cjs/index-4dd46cbe.js +0 -289
  529. package/dist/_shared/esm/Base-f200653c.js +0 -15
  530. package/dist/_shared/esm/Card-45e8e10a.js +0 -115
  531. package/dist/_shared/esm/ProgressStepper-5de34269.js +0 -82
  532. package/dist/_shared/esm/RadioGroup-002a32ba.js +0 -63
  533. package/dist/_shared/esm/SiteHeader.rehydrator-97900e11.js +0 -663
  534. package/dist/_shared/esm/TextInput-28f18769.js +0 -75
  535. package/dist/_shared/esm/extends-8cc61aad.js +0 -16
  536. package/dist/_shared/esm/index-4f8d3888.js +0 -280
  537. package/dist/_shared/esm/index-87a828b8.js +0 -479
  538. package/dist/types/components/Base/Base.d.ts +0 -16
  539. package/dist/types/components/Base/index.d.ts +0 -1
  540. package/dist/types/components/Card/Card.d.ts +0 -128
  541. package/dist/types/components/Card/index.d.ts +0 -1
  542. package/dist/types/components/Clock/Clock.d.ts +0 -12
  543. package/dist/types/components/Clock/Clock.rehydrator.d.ts +0 -2
  544. package/dist/types/components/Clock/index.d.ts +0 -2
  545. package/dist/types/components/MediaCard/MediaCard.stories-wip.d.ts +0 -15
  546. package/dist/types/components/SiteFooter/SiteFooter.rehydrator.d.ts +0 -2
  547. package/dist/types/components/SiteHeader/SiteHeader.d.ts +0 -75
  548. package/dist/types/components/SiteHeader/SiteHeader.rehydrator.d.ts +0 -8
  549. package/dist/types/components/SiteHeader/components/ItemGroup/ItemGroup.rehydrator.d.ts +0 -2
  550. package/dist/types/components/SiteHeader/components/ItemGroup/index.d.ts +0 -2
  551. package/dist/types/components/SiteHeader/components/NavItem/NavItem.rehydrator.d.ts +0 -2
  552. package/dist/types/components/SiteHeader/components/NavItem/NavItemWithSubNav.rehydrator.d.ts +0 -2
  553. package/dist/types/components/SiteHeader/components/NavItem/index.d.ts +0 -4
  554. package/dist/types/components/SiteHeader/components/SubNavItem/SubNavItem.rehydrator.d.ts +0 -2
  555. package/dist/types/components/SiteHeader/components/SubNavItem/index.d.ts +0 -2
  556. package/dist/types/components/SiteHeader/index.d.ts +0 -2
  557. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/BackButton/index.d.ts +0 -0
  558. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/Column/index.d.ts +0 -0
  559. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/Item/Item.d.ts +0 -0
  560. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/Item/index.d.ts +0 -0
  561. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/MenuButton/MenuButton.d.ts +0 -0
  562. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/MenuButton/index.d.ts +0 -0
  563. /package/dist/types/components/{SiteHeader → SiteHeaderV2}/components/Panel/index.d.ts +0 -0
  564. /package/dist/types/hooks/{use-aria-describedby.d.ts → private/use-aria-describedby/use-aria-describedby.d.ts} +0 -0
  565. /package/dist/types/hooks/{use-interaction-mode.d.ts → private/use-interaction-mode/use-interaction-mode.d.ts} +0 -0
  566. /package/dist/types/hooks/{use-pagination.d.ts → private/use-pagination/use-pagination.d.ts} +0 -0
@@ -0,0 +1,1918 @@
1
+ import React__default, { createContext, forwardRef, useContext, useCallback, useRef, useState, useReducer, useEffect } from 'react';
2
+ import { r as requiredArgs, t as toDate, a as toInteger, g as getDefaultOptions, _ as _typeof, f as format } from './index-605031ca.js';
3
+ import { S as SemSizeBreakpointsM } from './index.es-28a91edf.js';
4
+ import { u as useMediaQuery } from './use-media-query-d3622da8.js';
5
+ import { b as __spreadArray, a as __assign } from './index-288c66b5.js';
6
+ import { c as classNames } from './index-2e73c2e9.js';
7
+ import { T as Text } from './Text-a46fb76b.js';
8
+ import { V as VisuallyHidden } from './VisuallyHidden-06692fd3.js';
9
+ import { S as Surface } from './Surface-71d21a9e.js';
10
+ import { H as Heading } from './Heading-906c7c7c.js';
11
+ import { B as BtIconChevronRightMid } from './BtIconChevronRightMid.esm-4764708f.js';
12
+ import { I as Icon } from './Icon-512f834f.js';
13
+
14
+ /**
15
+ * @name addDays
16
+ * @category Day Helpers
17
+ * @summary Add the specified number of days to the given date.
18
+ *
19
+ * @description
20
+ * Add the specified number of days to the given date.
21
+ *
22
+ * @param {Date|Number} date - the date to be changed
23
+ * @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`.
24
+ * @returns {Date} - the new date with the days added
25
+ * @throws {TypeError} - 2 arguments required
26
+ *
27
+ * @example
28
+ * // Add 10 days to 1 September 2014:
29
+ * const result = addDays(new Date(2014, 8, 1), 10)
30
+ * //=> Thu Sep 11 2014 00:00:00
31
+ */
32
+ function addDays(dirtyDate, dirtyAmount) {
33
+ requiredArgs(2, arguments);
34
+ var date = toDate(dirtyDate);
35
+ var amount = toInteger(dirtyAmount);
36
+ if (isNaN(amount)) {
37
+ return new Date(NaN);
38
+ }
39
+ if (!amount) {
40
+ // If 0 days, no-op to avoid changing times in the hour before end of DST
41
+ return date;
42
+ }
43
+ date.setDate(date.getDate() + amount);
44
+ return date;
45
+ }
46
+
47
+ /**
48
+ * @name addMonths
49
+ * @category Month Helpers
50
+ * @summary Add the specified number of months to the given date.
51
+ *
52
+ * @description
53
+ * Add the specified number of months to the given date.
54
+ *
55
+ * @param {Date|Number} date - the date to be changed
56
+ * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
57
+ * @returns {Date} the new date with the months added
58
+ * @throws {TypeError} 2 arguments required
59
+ *
60
+ * @example
61
+ * // Add 5 months to 1 September 2014:
62
+ * const result = addMonths(new Date(2014, 8, 1), 5)
63
+ * //=> Sun Feb 01 2015 00:00:00
64
+ */
65
+ function addMonths(dirtyDate, dirtyAmount) {
66
+ requiredArgs(2, arguments);
67
+ var date = toDate(dirtyDate);
68
+ var amount = toInteger(dirtyAmount);
69
+ if (isNaN(amount)) {
70
+ return new Date(NaN);
71
+ }
72
+ if (!amount) {
73
+ // If 0 months, no-op to avoid changing times in the hour before end of DST
74
+ return date;
75
+ }
76
+ var dayOfMonth = date.getDate();
77
+
78
+ // The JS Date object supports date math by accepting out-of-bounds values for
79
+ // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
80
+ // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
81
+ // want except that dates will wrap around the end of a month, meaning that
82
+ // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
83
+ // we'll default to the end of the desired month by adding 1 to the desired
84
+ // month and using a date of 0 to back up one day to the end of the desired
85
+ // month.
86
+ var endOfDesiredMonth = new Date(date.getTime());
87
+ endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
88
+ var daysInMonth = endOfDesiredMonth.getDate();
89
+ if (dayOfMonth >= daysInMonth) {
90
+ // If we're already at the end of the month, then this is the correct date
91
+ // and we're done.
92
+ return endOfDesiredMonth;
93
+ } else {
94
+ // Otherwise, we now know that setting the original day-of-month value won't
95
+ // cause an overflow, so set the desired day-of-month. Note that we can't
96
+ // just set the date of `endOfDesiredMonth` because that object may have had
97
+ // its time changed in the unusual case where where a DST transition was on
98
+ // the last day of the month and its local time was in the hour skipped or
99
+ // repeated next to a DST transition. So we use `date` instead which is
100
+ // guaranteed to still have the original time.
101
+ date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
102
+ return date;
103
+ }
104
+ }
105
+
106
+ /**
107
+ * @name startOfWeek
108
+ * @category Week Helpers
109
+ * @summary Return the start of a week for the given date.
110
+ *
111
+ * @description
112
+ * Return the start of a week for the given date.
113
+ * The result will be in the local timezone.
114
+ *
115
+ * @param {Date|Number} date - the original date
116
+ * @param {Object} [options] - an object with options.
117
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
118
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
119
+ * @returns {Date} the start of a week
120
+ * @throws {TypeError} 1 argument required
121
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
122
+ *
123
+ * @example
124
+ * // The start of a week for 2 September 2014 11:55:00:
125
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
126
+ * //=> Sun Aug 31 2014 00:00:00
127
+ *
128
+ * @example
129
+ * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
130
+ * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
131
+ * //=> Mon Sep 01 2014 00:00:00
132
+ */
133
+ function startOfWeek(dirtyDate, options) {
134
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
135
+ requiredArgs(1, arguments);
136
+ var defaultOptions = getDefaultOptions();
137
+ var weekStartsOn = 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);
138
+
139
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
140
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
141
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
142
+ }
143
+ var date = toDate(dirtyDate);
144
+ var day = date.getDay();
145
+ var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
146
+ date.setDate(date.getDate() - diff);
147
+ date.setHours(0, 0, 0, 0);
148
+ return date;
149
+ }
150
+
151
+ /**
152
+ * @name addWeeks
153
+ * @category Week Helpers
154
+ * @summary Add the specified number of weeks to the given date.
155
+ *
156
+ * @description
157
+ * Add the specified number of week to the given date.
158
+ *
159
+ * @param {Date|Number} date - the date to be changed
160
+ * @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`.
161
+ * @returns {Date} the new date with the weeks added
162
+ * @throws {TypeError} 2 arguments required
163
+ *
164
+ * @example
165
+ * // Add 4 weeks to 1 September 2014:
166
+ * const result = addWeeks(new Date(2014, 8, 1), 4)
167
+ * //=> Mon Sep 29 2014 00:00:00
168
+ */
169
+ function addWeeks(dirtyDate, dirtyAmount) {
170
+ requiredArgs(2, arguments);
171
+ var amount = toInteger(dirtyAmount);
172
+ var days = amount * 7;
173
+ return addDays(dirtyDate, days);
174
+ }
175
+
176
+ /**
177
+ * @name addYears
178
+ * @category Year Helpers
179
+ * @summary Add the specified number of years to the given date.
180
+ *
181
+ * @description
182
+ * Add the specified number of years to the given date.
183
+ *
184
+ * @param {Date|Number} date - the date to be changed
185
+ * @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`.
186
+ * @returns {Date} the new date with the years added
187
+ * @throws {TypeError} 2 arguments required
188
+ *
189
+ * @example
190
+ * // Add 5 years to 1 September 2014:
191
+ * const result = addYears(new Date(2014, 8, 1), 5)
192
+ * //=> Sun Sep 01 2019 00:00:00
193
+ */
194
+ function addYears(dirtyDate, dirtyAmount) {
195
+ requiredArgs(2, arguments);
196
+ var amount = toInteger(dirtyAmount);
197
+ return addMonths(dirtyDate, amount * 12);
198
+ }
199
+
200
+ /**
201
+ * @name compareAsc
202
+ * @category Common Helpers
203
+ * @summary Compare the two dates and return -1, 0 or 1.
204
+ *
205
+ * @description
206
+ * Compare the two dates and return 1 if the first date is after the second,
207
+ * -1 if the first date is before the second or 0 if dates are equal.
208
+ *
209
+ * @param {Date|Number} dateLeft - the first date to compare
210
+ * @param {Date|Number} dateRight - the second date to compare
211
+ * @returns {Number} the result of the comparison
212
+ * @throws {TypeError} 2 arguments required
213
+ *
214
+ * @example
215
+ * // Compare 11 February 1987 and 10 July 1989:
216
+ * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
217
+ * //=> -1
218
+ *
219
+ * @example
220
+ * // Sort the array of dates:
221
+ * const result = [
222
+ * new Date(1995, 6, 2),
223
+ * new Date(1987, 1, 11),
224
+ * new Date(1989, 6, 10)
225
+ * ].sort(compareAsc)
226
+ * //=> [
227
+ * // Wed Feb 11 1987 00:00:00,
228
+ * // Mon Jul 10 1989 00:00:00,
229
+ * // Sun Jul 02 1995 00:00:00
230
+ * // ]
231
+ */
232
+ function compareAsc(dirtyDateLeft, dirtyDateRight) {
233
+ requiredArgs(2, arguments);
234
+ var dateLeft = toDate(dirtyDateLeft);
235
+ var dateRight = toDate(dirtyDateRight);
236
+ var diff = dateLeft.getTime() - dateRight.getTime();
237
+ if (diff < 0) {
238
+ return -1;
239
+ } else if (diff > 0) {
240
+ return 1;
241
+ // Return 0 if diff is 0; return NaN if diff is NaN
242
+ } else {
243
+ return diff;
244
+ }
245
+ }
246
+
247
+ /**
248
+ * @name endOfDay
249
+ * @category Day Helpers
250
+ * @summary Return the end of a day for the given date.
251
+ *
252
+ * @description
253
+ * Return the end of a day for the given date.
254
+ * The result will be in the local timezone.
255
+ *
256
+ * @param {Date|Number} date - the original date
257
+ * @returns {Date} the end of a day
258
+ * @throws {TypeError} 1 argument required
259
+ *
260
+ * @example
261
+ * // The end of a day for 2 September 2014 11:55:00:
262
+ * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
263
+ * //=> Tue Sep 02 2014 23:59:59.999
264
+ */
265
+ function endOfDay(dirtyDate) {
266
+ requiredArgs(1, arguments);
267
+ var date = toDate(dirtyDate);
268
+ date.setHours(23, 59, 59, 999);
269
+ return date;
270
+ }
271
+
272
+ /**
273
+ * @name endOfMonth
274
+ * @category Month Helpers
275
+ * @summary Return the end of a month for the given date.
276
+ *
277
+ * @description
278
+ * Return the end of a month for the given date.
279
+ * The result will be in the local timezone.
280
+ *
281
+ * @param {Date|Number} date - the original date
282
+ * @returns {Date} the end of a month
283
+ * @throws {TypeError} 1 argument required
284
+ *
285
+ * @example
286
+ * // The end of a month for 2 September 2014 11:55:00:
287
+ * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
288
+ * //=> Tue Sep 30 2014 23:59:59.999
289
+ */
290
+ function endOfMonth(dirtyDate) {
291
+ requiredArgs(1, arguments);
292
+ var date = toDate(dirtyDate);
293
+ var month = date.getMonth();
294
+ date.setFullYear(date.getFullYear(), month + 1, 0);
295
+ date.setHours(23, 59, 59, 999);
296
+ return date;
297
+ }
298
+
299
+ /**
300
+ * @name isLastDayOfMonth
301
+ * @category Month Helpers
302
+ * @summary Is the given date the last day of a month?
303
+ *
304
+ * @description
305
+ * Is the given date the last day of a month?
306
+ *
307
+ * @param {Date|Number} date - the date to check
308
+ * @returns {Boolean} the date is the last day of a month
309
+ * @throws {TypeError} 1 argument required
310
+ *
311
+ * @example
312
+ * // Is 28 February 2014 the last day of a month?
313
+ * const result = isLastDayOfMonth(new Date(2014, 1, 28))
314
+ * //=> true
315
+ */
316
+ function isLastDayOfMonth(dirtyDate) {
317
+ requiredArgs(1, arguments);
318
+ var date = toDate(dirtyDate);
319
+ return endOfDay(date).getTime() === endOfMonth(date).getTime();
320
+ }
321
+
322
+ /**
323
+ * @name eachDayOfInterval
324
+ * @category Interval Helpers
325
+ * @summary Return the array of dates within the specified time interval.
326
+ *
327
+ * @description
328
+ * Return the array of dates within the specified time interval.
329
+ *
330
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
331
+ * @param {Object} [options] - an object with options.
332
+ * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
333
+ * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
334
+ * @throws {TypeError} 1 argument required
335
+ * @throws {RangeError} `options.step` must be a number greater than 1
336
+ * @throws {RangeError} The start of an interval cannot be after its end
337
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
338
+ *
339
+ * @example
340
+ * // Each day between 6 October 2014 and 10 October 2014:
341
+ * const result = eachDayOfInterval({
342
+ * start: new Date(2014, 9, 6),
343
+ * end: new Date(2014, 9, 10)
344
+ * })
345
+ * //=> [
346
+ * // Mon Oct 06 2014 00:00:00,
347
+ * // Tue Oct 07 2014 00:00:00,
348
+ * // Wed Oct 08 2014 00:00:00,
349
+ * // Thu Oct 09 2014 00:00:00,
350
+ * // Fri Oct 10 2014 00:00:00
351
+ * // ]
352
+ */
353
+ function eachDayOfInterval(dirtyInterval, options) {
354
+ var _options$step;
355
+ requiredArgs(1, arguments);
356
+ var interval = dirtyInterval || {};
357
+ var startDate = toDate(interval.start);
358
+ var endDate = toDate(interval.end);
359
+ var endTime = endDate.getTime();
360
+
361
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
362
+ if (!(startDate.getTime() <= endTime)) {
363
+ throw new RangeError('Invalid interval');
364
+ }
365
+ var dates = [];
366
+ var currentDate = startDate;
367
+ currentDate.setHours(0, 0, 0, 0);
368
+ var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
369
+ if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
370
+ while (currentDate.getTime() <= endTime) {
371
+ dates.push(toDate(currentDate));
372
+ currentDate.setDate(currentDate.getDate() + step);
373
+ currentDate.setHours(0, 0, 0, 0);
374
+ }
375
+ return dates;
376
+ }
377
+
378
+ /**
379
+ * @name eachWeekOfInterval
380
+ * @category Interval Helpers
381
+ * @summary Return the array of weeks within the specified time interval.
382
+ *
383
+ * @description
384
+ * Return the array of weeks within the specified time interval.
385
+ *
386
+ * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
387
+ * @param {Object} [options] - an object with options.
388
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
389
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
390
+ * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end
391
+ * @throws {TypeError} 1 argument required
392
+ * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6
393
+ * @throws {RangeError} The start of an interval cannot be after its end
394
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
395
+ *
396
+ * @example
397
+ * // Each week within interval 6 October 2014 - 23 November 2014:
398
+ * const result = eachWeekOfInterval({
399
+ * start: new Date(2014, 9, 6),
400
+ * end: new Date(2014, 10, 23)
401
+ * })
402
+ * //=> [
403
+ * // Sun Oct 05 2014 00:00:00,
404
+ * // Sun Oct 12 2014 00:00:00,
405
+ * // Sun Oct 19 2014 00:00:00,
406
+ * // Sun Oct 26 2014 00:00:00,
407
+ * // Sun Nov 02 2014 00:00:00,
408
+ * // Sun Nov 09 2014 00:00:00,
409
+ * // Sun Nov 16 2014 00:00:00,
410
+ * // Sun Nov 23 2014 00:00:00
411
+ * // ]
412
+ */
413
+ function eachWeekOfInterval(dirtyInterval, options) {
414
+ requiredArgs(1, arguments);
415
+ var interval = dirtyInterval || {};
416
+ var startDate = toDate(interval.start);
417
+ var endDate = toDate(interval.end);
418
+ var endTime = endDate.getTime();
419
+
420
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
421
+ if (!(startDate.getTime() <= endTime)) {
422
+ throw new RangeError('Invalid interval');
423
+ }
424
+ var startDateWeek = startOfWeek(startDate, options);
425
+ var endDateWeek = startOfWeek(endDate, options);
426
+
427
+ // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet
428
+ startDateWeek.setHours(15);
429
+ endDateWeek.setHours(15);
430
+ endTime = endDateWeek.getTime();
431
+ var weeks = [];
432
+ var currentWeek = startDateWeek;
433
+ while (currentWeek.getTime() <= endTime) {
434
+ currentWeek.setHours(0);
435
+ weeks.push(toDate(currentWeek));
436
+ currentWeek = addWeeks(currentWeek, 1);
437
+ currentWeek.setHours(15);
438
+ }
439
+ return weeks;
440
+ }
441
+
442
+ /**
443
+ * @name startOfMonth
444
+ * @category Month Helpers
445
+ * @summary Return the start of a month for the given date.
446
+ *
447
+ * @description
448
+ * Return the start of a month for the given date.
449
+ * The result will be in the local timezone.
450
+ *
451
+ * @param {Date|Number} date - the original date
452
+ * @returns {Date} the start of a month
453
+ * @throws {TypeError} 1 argument required
454
+ *
455
+ * @example
456
+ * // The start of a month for 2 September 2014 11:55:00:
457
+ * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
458
+ * //=> Mon Sep 01 2014 00:00:00
459
+ */
460
+ function startOfMonth(dirtyDate) {
461
+ requiredArgs(1, arguments);
462
+ var date = toDate(dirtyDate);
463
+ date.setDate(1);
464
+ date.setHours(0, 0, 0, 0);
465
+ return date;
466
+ }
467
+
468
+ /**
469
+ * @name endOfWeek
470
+ * @category Week Helpers
471
+ * @summary Return the end of a week for the given date.
472
+ *
473
+ * @description
474
+ * Return the end of a week for the given date.
475
+ * The result will be in the local timezone.
476
+ *
477
+ * @param {Date|Number} date - the original date
478
+ * @param {Object} [options] - an object with options.
479
+ * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
480
+ * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
481
+ * @returns {Date} the end of a week
482
+ * @throws {TypeError} 1 argument required
483
+ * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
484
+ *
485
+ * @example
486
+ * // The end of a week for 2 September 2014 11:55:00:
487
+ * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
488
+ * //=> Sat Sep 06 2014 23:59:59.999
489
+ *
490
+ * @example
491
+ * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
492
+ * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
493
+ * //=> Sun Sep 07 2014 23:59:59.999
494
+ */
495
+ function endOfWeek(dirtyDate, options) {
496
+ var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
497
+ requiredArgs(1, arguments);
498
+ var defaultOptions = getDefaultOptions();
499
+ var weekStartsOn = 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);
500
+
501
+ // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
502
+ if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
503
+ throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
504
+ }
505
+ var date = toDate(dirtyDate);
506
+ var day = date.getDay();
507
+ var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
508
+ date.setDate(date.getDate() + diff);
509
+ date.setHours(23, 59, 59, 999);
510
+ return date;
511
+ }
512
+
513
+ /**
514
+ * @name getDate
515
+ * @category Day Helpers
516
+ * @summary Get the day of the month of the given date.
517
+ *
518
+ * @description
519
+ * Get the day of the month of the given date.
520
+ *
521
+ * @param {Date|Number} date - the given date
522
+ * @returns {Number} the day of month
523
+ * @throws {TypeError} 1 argument required
524
+ *
525
+ * @example
526
+ * // Which day of the month is 29 February 2012?
527
+ * const result = getDate(new Date(2012, 1, 29))
528
+ * //=> 29
529
+ */
530
+ function getDate(dirtyDate) {
531
+ requiredArgs(1, arguments);
532
+ var date = toDate(dirtyDate);
533
+ var dayOfMonth = date.getDate();
534
+ return dayOfMonth;
535
+ }
536
+
537
+ /**
538
+ * @name getDay
539
+ * @category Weekday Helpers
540
+ * @summary Get the day of the week of the given date.
541
+ *
542
+ * @description
543
+ * Get the day of the week of the given date.
544
+ *
545
+ * @param {Date|Number} date - the given date
546
+ * @returns {0|1|2|3|4|5|6} the day of week, 0 represents Sunday
547
+ * @throws {TypeError} 1 argument required
548
+ *
549
+ * @example
550
+ * // Which day of the week is 29 February 2012?
551
+ * const result = getDay(new Date(2012, 1, 29))
552
+ * //=> 3
553
+ */
554
+ function getDay(dirtyDate) {
555
+ requiredArgs(1, arguments);
556
+ var date = toDate(dirtyDate);
557
+ var day = date.getDay();
558
+ return day;
559
+ }
560
+
561
+ /**
562
+ * @name getDaysInMonth
563
+ * @category Month Helpers
564
+ * @summary Get the number of days in a month of the given date.
565
+ *
566
+ * @description
567
+ * Get the number of days in a month of the given date.
568
+ *
569
+ * @param {Date|Number} date - the given date
570
+ * @returns {Number} the number of days in a month
571
+ * @throws {TypeError} 1 argument required
572
+ *
573
+ * @example
574
+ * // How many days are in February 2000?
575
+ * const result = getDaysInMonth(new Date(2000, 1))
576
+ * //=> 29
577
+ */
578
+ function getDaysInMonth(dirtyDate) {
579
+ requiredArgs(1, arguments);
580
+ var date = toDate(dirtyDate);
581
+ var year = date.getFullYear();
582
+ var monthIndex = date.getMonth();
583
+ var lastDayOfMonth = new Date(0);
584
+ lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
585
+ lastDayOfMonth.setHours(0, 0, 0, 0);
586
+ return lastDayOfMonth.getDate();
587
+ }
588
+
589
+ /**
590
+ * @name getMonth
591
+ * @category Month Helpers
592
+ * @summary Get the month of the given date.
593
+ *
594
+ * @description
595
+ * Get the month of the given date.
596
+ *
597
+ * @param {Date|Number} date - the given date
598
+ * @returns {Number} the month
599
+ * @throws {TypeError} 1 argument required
600
+ *
601
+ * @example
602
+ * // Which month is 29 February 2012?
603
+ * const result = getMonth(new Date(2012, 1, 29))
604
+ * //=> 1
605
+ */
606
+ function getMonth(dirtyDate) {
607
+ requiredArgs(1, arguments);
608
+ var date = toDate(dirtyDate);
609
+ var month = date.getMonth();
610
+ return month;
611
+ }
612
+
613
+ /**
614
+ * @name getYear
615
+ * @category Year Helpers
616
+ * @summary Get the year of the given date.
617
+ *
618
+ * @description
619
+ * Get the year of the given date.
620
+ *
621
+ * @param {Date|Number} date - the given date
622
+ * @returns {Number} the year
623
+ * @throws {TypeError} 1 argument required
624
+ *
625
+ * @example
626
+ * // Which year is 2 July 2014?
627
+ * const result = getYear(new Date(2014, 6, 2))
628
+ * //=> 2014
629
+ */
630
+ function getYear(dirtyDate) {
631
+ requiredArgs(1, arguments);
632
+ return toDate(dirtyDate).getFullYear();
633
+ }
634
+
635
+ /**
636
+ * @name isAfter
637
+ * @category Common Helpers
638
+ * @summary Is the first date after the second one?
639
+ *
640
+ * @description
641
+ * Is the first date after the second one?
642
+ *
643
+ * @param {Date|Number} date - the date that should be after the other one to return true
644
+ * @param {Date|Number} dateToCompare - the date to compare with
645
+ * @returns {Boolean} the first date is after the second date
646
+ * @throws {TypeError} 2 arguments required
647
+ *
648
+ * @example
649
+ * // Is 10 July 1989 after 11 February 1987?
650
+ * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
651
+ * //=> true
652
+ */
653
+ function isAfter(dirtyDate, dirtyDateToCompare) {
654
+ requiredArgs(2, arguments);
655
+ var date = toDate(dirtyDate);
656
+ var dateToCompare = toDate(dirtyDateToCompare);
657
+ return date.getTime() > dateToCompare.getTime();
658
+ }
659
+
660
+ /**
661
+ * @name isBefore
662
+ * @category Common Helpers
663
+ * @summary Is the first date before the second one?
664
+ *
665
+ * @description
666
+ * Is the first date before the second one?
667
+ *
668
+ * @param {Date|Number} date - the date that should be before the other one to return true
669
+ * @param {Date|Number} dateToCompare - the date to compare with
670
+ * @returns {Boolean} the first date is before the second date
671
+ * @throws {TypeError} 2 arguments required
672
+ *
673
+ * @example
674
+ * // Is 10 July 1989 before 11 February 1987?
675
+ * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
676
+ * //=> false
677
+ */
678
+ function isBefore(dirtyDate, dirtyDateToCompare) {
679
+ requiredArgs(2, arguments);
680
+ var date = toDate(dirtyDate);
681
+ var dateToCompare = toDate(dirtyDateToCompare);
682
+ return date.getTime() < dateToCompare.getTime();
683
+ }
684
+
685
+ /**
686
+ * @name isEqual
687
+ * @category Common Helpers
688
+ * @summary Are the given dates equal?
689
+ *
690
+ * @description
691
+ * Are the given dates equal?
692
+ *
693
+ * @param {Date|Number} dateLeft - the first date to compare
694
+ * @param {Date|Number} dateRight - the second date to compare
695
+ * @returns {Boolean} the dates are equal
696
+ * @throws {TypeError} 2 arguments required
697
+ *
698
+ * @example
699
+ * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
700
+ * const result = isEqual(
701
+ * new Date(2014, 6, 2, 6, 30, 45, 0),
702
+ * new Date(2014, 6, 2, 6, 30, 45, 500)
703
+ * )
704
+ * //=> false
705
+ */
706
+ function isEqual(dirtyLeftDate, dirtyRightDate) {
707
+ requiredArgs(2, arguments);
708
+ var dateLeft = toDate(dirtyLeftDate);
709
+ var dateRight = toDate(dirtyRightDate);
710
+ return dateLeft.getTime() === dateRight.getTime();
711
+ }
712
+
713
+ /**
714
+ * @name isFirstDayOfMonth
715
+ * @category Month Helpers
716
+ * @summary Is the given date the first day of a month?
717
+ *
718
+ * @description
719
+ * Is the given date the first day of a month?
720
+ *
721
+ * @param {Date|Number} date - the date to check
722
+ * @returns {Boolean} the date is the first day of a month
723
+ * @throws {TypeError} 1 argument required
724
+ *
725
+ * @example
726
+ * // Is 1 September 2014 the first day of a month?
727
+ * const result = isFirstDayOfMonth(new Date(2014, 8, 1))
728
+ * //=> true
729
+ */
730
+ function isFirstDayOfMonth(dirtyDate) {
731
+ requiredArgs(1, arguments);
732
+ return toDate(dirtyDate).getDate() === 1;
733
+ }
734
+
735
+ /**
736
+ * @name isSameMonth
737
+ * @category Month Helpers
738
+ * @summary Are the given dates in the same month (and year)?
739
+ *
740
+ * @description
741
+ * Are the given dates in the same month (and year)?
742
+ *
743
+ * @param {Date|Number} dateLeft - the first date to check
744
+ * @param {Date|Number} dateRight - the second date to check
745
+ * @returns {Boolean} the dates are in the same month (and year)
746
+ * @throws {TypeError} 2 arguments required
747
+ *
748
+ * @example
749
+ * // Are 2 September 2014 and 25 September 2014 in the same month?
750
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
751
+ * //=> true
752
+ *
753
+ * @example
754
+ * // Are 2 September 2014 and 25 September 2015 in the same month?
755
+ * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
756
+ * //=> false
757
+ */
758
+ function isSameMonth(dirtyDateLeft, dirtyDateRight) {
759
+ requiredArgs(2, arguments);
760
+ var dateLeft = toDate(dirtyDateLeft);
761
+ var dateRight = toDate(dirtyDateRight);
762
+ return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();
763
+ }
764
+
765
+ /**
766
+ * @name isWithinInterval
767
+ * @category Interval Helpers
768
+ * @summary Is the given date within the interval?
769
+ *
770
+ * @description
771
+ * Is the given date within the interval? (Including start and end.)
772
+ *
773
+ * @param {Date|Number} date - the date to check
774
+ * @param {Interval} interval - the interval to check
775
+ * @returns {Boolean} the date is within the interval
776
+ * @throws {TypeError} 2 arguments required
777
+ * @throws {RangeError} The start of an interval cannot be after its end
778
+ * @throws {RangeError} Date in interval cannot be `Invalid Date`
779
+ *
780
+ * @example
781
+ * // For the date within the interval:
782
+ * isWithinInterval(new Date(2014, 0, 3), {
783
+ * start: new Date(2014, 0, 1),
784
+ * end: new Date(2014, 0, 7)
785
+ * })
786
+ * //=> true
787
+ *
788
+ * @example
789
+ * // For the date outside of the interval:
790
+ * isWithinInterval(new Date(2014, 0, 10), {
791
+ * start: new Date(2014, 0, 1),
792
+ * end: new Date(2014, 0, 7)
793
+ * })
794
+ * //=> false
795
+ *
796
+ * @example
797
+ * // For date equal to interval start:
798
+ * isWithinInterval(date, { start, end: date }) // => true
799
+ *
800
+ * @example
801
+ * // For date equal to interval end:
802
+ * isWithinInterval(date, { start: date, end }) // => true
803
+ */
804
+ function isWithinInterval(dirtyDate, interval) {
805
+ requiredArgs(2, arguments);
806
+ var time = toDate(dirtyDate).getTime();
807
+ var startTime = toDate(interval.start).getTime();
808
+ var endTime = toDate(interval.end).getTime();
809
+
810
+ // Throw an exception if start date is after end date or if any date is `Invalid Date`
811
+ if (!(startTime <= endTime)) {
812
+ throw new RangeError('Invalid interval');
813
+ }
814
+ return time >= startTime && time <= endTime;
815
+ }
816
+
817
+ /**
818
+ * @name subDays
819
+ * @category Day Helpers
820
+ * @summary Subtract the specified number of days from the given date.
821
+ *
822
+ * @description
823
+ * Subtract the specified number of days from the given date.
824
+ *
825
+ * @param {Date|Number} date - the date to be changed
826
+ * @param {Number} amount - the amount of days to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
827
+ * @returns {Date} the new date with the days subtracted
828
+ * @throws {TypeError} 2 arguments required
829
+ *
830
+ * @example
831
+ * // Subtract 10 days from 1 September 2014:
832
+ * const result = subDays(new Date(2014, 8, 1), 10)
833
+ * //=> Fri Aug 22 2014 00:00:00
834
+ */
835
+ function subDays(dirtyDate, dirtyAmount) {
836
+ requiredArgs(2, arguments);
837
+ var amount = toInteger(dirtyAmount);
838
+ return addDays(dirtyDate, -amount);
839
+ }
840
+
841
+ /**
842
+ * @name setMonth
843
+ * @category Month Helpers
844
+ * @summary Set the month to the given date.
845
+ *
846
+ * @description
847
+ * Set the month to the given date.
848
+ *
849
+ * @param {Date|Number} date - the date to be changed
850
+ * @param {Number} month - the month of the new date
851
+ * @returns {Date} the new date with the month set
852
+ * @throws {TypeError} 2 arguments required
853
+ *
854
+ * @example
855
+ * // Set February to 1 September 2014:
856
+ * const result = setMonth(new Date(2014, 8, 1), 1)
857
+ * //=> Sat Feb 01 2014 00:00:00
858
+ */
859
+ function setMonth(dirtyDate, dirtyMonth) {
860
+ requiredArgs(2, arguments);
861
+ var date = toDate(dirtyDate);
862
+ var month = toInteger(dirtyMonth);
863
+ var year = date.getFullYear();
864
+ var day = date.getDate();
865
+ var dateWithDesiredMonth = new Date(0);
866
+ dateWithDesiredMonth.setFullYear(year, month, 15);
867
+ dateWithDesiredMonth.setHours(0, 0, 0, 0);
868
+ var daysInMonth = getDaysInMonth(dateWithDesiredMonth);
869
+ // Set the last day of the new month
870
+ // if the original date was the last day of the longer month
871
+ date.setMonth(month, Math.min(day, daysInMonth));
872
+ return date;
873
+ }
874
+
875
+ /**
876
+ * @name set
877
+ * @category Common Helpers
878
+ * @summary Set date values to a given date.
879
+ *
880
+ * @description
881
+ * Set date values to a given date.
882
+ *
883
+ * Sets time values to date from object `values`.
884
+ * A value is not set if it is undefined or null or doesn't exist in `values`.
885
+ *
886
+ * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
887
+ * to use native `Date#setX` methods. If you use this function, you may not want to include the
888
+ * other `setX` functions that date-fns provides if you are concerned about the bundle size.
889
+ *
890
+ * @param {Date|Number} date - the date to be changed
891
+ * @param {Object} values - an object with options
892
+ * @param {Number} [values.year] - the number of years to be set
893
+ * @param {Number} [values.month] - the number of months to be set
894
+ * @param {Number} [values.date] - the number of days to be set
895
+ * @param {Number} [values.hours] - the number of hours to be set
896
+ * @param {Number} [values.minutes] - the number of minutes to be set
897
+ * @param {Number} [values.seconds] - the number of seconds to be set
898
+ * @param {Number} [values.milliseconds] - the number of milliseconds to be set
899
+ * @returns {Date} the new date with options set
900
+ * @throws {TypeError} 2 arguments required
901
+ * @throws {RangeError} `values` must be an object
902
+ *
903
+ * @example
904
+ * // Transform 1 September 2014 into 20 October 2015 in a single line:
905
+ * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
906
+ * //=> Tue Oct 20 2015 00:00:00
907
+ *
908
+ * @example
909
+ * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
910
+ * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
911
+ * //=> Mon Sep 01 2014 12:23:45
912
+ */
913
+ function set(dirtyDate, values) {
914
+ requiredArgs(2, arguments);
915
+ if (_typeof(values) !== 'object' || values === null) {
916
+ throw new RangeError('values parameter must be an object');
917
+ }
918
+ var date = toDate(dirtyDate);
919
+
920
+ // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
921
+ if (isNaN(date.getTime())) {
922
+ return new Date(NaN);
923
+ }
924
+ if (values.year != null) {
925
+ date.setFullYear(values.year);
926
+ }
927
+ if (values.month != null) {
928
+ date = setMonth(date, values.month);
929
+ }
930
+ if (values.date != null) {
931
+ date.setDate(toInteger(values.date));
932
+ }
933
+ if (values.hours != null) {
934
+ date.setHours(toInteger(values.hours));
935
+ }
936
+ if (values.minutes != null) {
937
+ date.setMinutes(toInteger(values.minutes));
938
+ }
939
+ if (values.seconds != null) {
940
+ date.setSeconds(toInteger(values.seconds));
941
+ }
942
+ if (values.milliseconds != null) {
943
+ date.setMilliseconds(toInteger(values.milliseconds));
944
+ }
945
+ return date;
946
+ }
947
+
948
+ /**
949
+ * @name setYear
950
+ * @category Year Helpers
951
+ * @summary Set the year to the given date.
952
+ *
953
+ * @description
954
+ * Set the year to the given date.
955
+ *
956
+ * @param {Date|Number} date - the date to be changed
957
+ * @param {Number} year - the year of the new date
958
+ * @returns {Date} the new date with the year set
959
+ * @throws {TypeError} 2 arguments required
960
+ *
961
+ * @example
962
+ * // Set year 2013 to 1 September 2014:
963
+ * const result = setYear(new Date(2014, 8, 1), 2013)
964
+ * //=> Sun Sep 01 2013 00:00:00
965
+ */
966
+ function setYear(dirtyDate, dirtyYear) {
967
+ requiredArgs(2, arguments);
968
+ var date = toDate(dirtyDate);
969
+ var year = toInteger(dirtyYear);
970
+
971
+ // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
972
+ if (isNaN(date.getTime())) {
973
+ return new Date(NaN);
974
+ }
975
+ date.setFullYear(year);
976
+ return date;
977
+ }
978
+
979
+ /**
980
+ * @name subMonths
981
+ * @category Month Helpers
982
+ * @summary Subtract the specified number of months from the given date.
983
+ *
984
+ * @description
985
+ * Subtract the specified number of months from the given date.
986
+ *
987
+ * @param {Date|Number} date - the date to be changed
988
+ * @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`.
989
+ * @returns {Date} the new date with the months subtracted
990
+ * @throws {TypeError} 2 arguments required
991
+ *
992
+ * @example
993
+ * // Subtract 5 months from 1 February 2015:
994
+ * const result = subMonths(new Date(2015, 1, 1), 5)
995
+ * //=> Mon Sep 01 2014 00:00:00
996
+ */
997
+ function subMonths(dirtyDate, dirtyAmount) {
998
+ requiredArgs(2, arguments);
999
+ var amount = toInteger(dirtyAmount);
1000
+ return addMonths(dirtyDate, -amount);
1001
+ }
1002
+
1003
+ /**
1004
+ * @name subWeeks
1005
+ * @category Week Helpers
1006
+ * @summary Subtract the specified number of weeks from the given date.
1007
+ *
1008
+ * @description
1009
+ * Subtract the specified number of weeks from the given date.
1010
+ *
1011
+ * @param {Date|Number} date - the date to be changed
1012
+ * @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`.
1013
+ * @returns {Date} the new date with the weeks subtracted
1014
+ * @throws {TypeError} 2 arguments required
1015
+ *
1016
+ * @example
1017
+ * // Subtract 4 weeks from 1 September 2014:
1018
+ * const result = subWeeks(new Date(2014, 8, 1), 4)
1019
+ * //=> Mon Aug 04 2014 00:00:00
1020
+ */
1021
+ function subWeeks(dirtyDate, dirtyAmount) {
1022
+ requiredArgs(2, arguments);
1023
+ var amount = toInteger(dirtyAmount);
1024
+ return addWeeks(dirtyDate, -amount);
1025
+ }
1026
+
1027
+ /**
1028
+ * @name subYears
1029
+ * @category Year Helpers
1030
+ * @summary Subtract the specified number of years from the given date.
1031
+ *
1032
+ * @description
1033
+ * Subtract the specified number of years from the given date.
1034
+ *
1035
+ * @param {Date|Number} date - the date to be changed
1036
+ * @param {Number} amount - the amount of years to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
1037
+ * @returns {Date} the new date with the years subtracted
1038
+ * @throws {TypeError} 2 arguments required
1039
+ *
1040
+ * @example
1041
+ * // Subtract 5 years from 1 September 2014:
1042
+ * const result = subYears(new Date(2014, 8, 1), 5)
1043
+ * //=> Tue Sep 01 2009 00:00:00
1044
+ */
1045
+ function subYears(dirtyDate, dirtyAmount) {
1046
+ requiredArgs(2, arguments);
1047
+ var amount = toInteger(dirtyAmount);
1048
+ return addYears(dirtyDate, -amount);
1049
+ }
1050
+
1051
+ var containsDate = function (dates, compareDate) {
1052
+ return dates.map(function (date) { return date.getTime(); }).includes(compareDate.getTime());
1053
+ };
1054
+
1055
+ var dateWithoutTime = function (date) {
1056
+ return set(new Date(date), {
1057
+ hours: 0,
1058
+ minutes: 0,
1059
+ milliseconds: 0,
1060
+ seconds: 0
1061
+ });
1062
+ };
1063
+
1064
+ var getDatesInMonth = function (date) {
1065
+ var dateYear = getYear(date);
1066
+ var dateMonth = getMonth(date);
1067
+ return Array.from({ length: getDaysInMonth(date) }, function (_, i) {
1068
+ return dateWithoutTime(new Date(dateYear, dateMonth, i + 1));
1069
+ });
1070
+ };
1071
+
1072
+ var WeekDaysAbbr;
1073
+ (function (WeekDaysAbbr) {
1074
+ WeekDaysAbbr["MON"] = "Mon";
1075
+ WeekDaysAbbr["TUE"] = "Tue";
1076
+ WeekDaysAbbr["WED"] = "Wed";
1077
+ WeekDaysAbbr["THUR"] = "Thur";
1078
+ WeekDaysAbbr["FRI"] = "Fri";
1079
+ WeekDaysAbbr["SAT"] = "Sat";
1080
+ WeekDaysAbbr["SUN"] = "Sun";
1081
+ })(WeekDaysAbbr || (WeekDaysAbbr = {}));
1082
+ var WeekDays;
1083
+ (function (WeekDays) {
1084
+ WeekDays["MONDAY"] = "Monday";
1085
+ WeekDays["TUESDAY"] = "Tuesday";
1086
+ WeekDays["WEDNESDAY"] = "Wednesday";
1087
+ WeekDays["THURSDAY"] = "Thursday";
1088
+ WeekDays["FRIDAY"] = "Friday";
1089
+ WeekDays["SATURDAY"] = "Saturday";
1090
+ WeekDays["SUNDAY"] = "Sunday";
1091
+ })(WeekDays || (WeekDays = {}));
1092
+
1093
+ var isDay = function (date, day) {
1094
+ var _a;
1095
+ var dayMap = (_a = {},
1096
+ _a[WeekDays.MONDAY] = 1,
1097
+ _a[WeekDays.TUESDAY] = 2,
1098
+ _a[WeekDays.WEDNESDAY] = 3,
1099
+ _a[WeekDays.THURSDAY] = 4,
1100
+ _a[WeekDays.FRIDAY] = 5,
1101
+ _a[WeekDays.SATURDAY] = 6,
1102
+ _a[WeekDays.SUNDAY] = 0,
1103
+ _a);
1104
+ return getDay(date) === dayMap[day];
1105
+ };
1106
+
1107
+ var isDisabledDate = function (date, disabledDates, minDate, maxDate) {
1108
+ return ((minDate && isBefore(date, minDate)) ||
1109
+ (maxDate && isAfter(date, maxDate)) ||
1110
+ (disabledDates && containsDate(disabledDates, date)));
1111
+ };
1112
+
1113
+ var isMonthBeforeMinDate = function (month, minDate) {
1114
+ return getDatesInMonth(month).every(function (date) {
1115
+ return isBefore(date, minDate);
1116
+ });
1117
+ };
1118
+
1119
+ var isMonthAfterMaxDate = function (date, maxDate) {
1120
+ return getDatesInMonth(date).every(function (date) {
1121
+ return isAfter(date, maxDate);
1122
+ });
1123
+ };
1124
+
1125
+ var processSelectedRange = function (_a) {
1126
+ var range = _a.range, value = _a.value, disabledDates = _a.disabledDates;
1127
+ var exisitingRange = range.filter(function (date) { return Boolean(date); });
1128
+ var newRange = __spreadArray(__spreadArray([], (exisitingRange.length === 2 ? [] : exisitingRange), true), [
1129
+ value,
1130
+ ], false).sort(compareAsc);
1131
+ var isSelectionComplete = newRange.length === 2;
1132
+ var allDaysInRange = isSelectionComplete
1133
+ ? eachDayOfInterval({
1134
+ start: newRange[0],
1135
+ end: newRange[1]
1136
+ })
1137
+ : [];
1138
+ var rangeOnChangeValue = {
1139
+ dates: allDaysInRange.map(function (date) { return ({
1140
+ value: date,
1141
+ disabled: disabledDates ? containsDate(disabledDates, date) : false
1142
+ }); }),
1143
+ selectedDate: value,
1144
+ start: newRange[0],
1145
+ end: newRange[1],
1146
+ isSelectionComplete: isSelectionComplete
1147
+ };
1148
+ return {
1149
+ rangeValue: newRange,
1150
+ rangeOnChangeValue: rangeOnChangeValue
1151
+ };
1152
+ };
1153
+
1154
+ var getCalendarType = function (type, isDesktop) {
1155
+ if (type === "double" && !isDesktop) {
1156
+ return "month";
1157
+ }
1158
+ if (type === "double" && isDesktop) {
1159
+ return "double";
1160
+ }
1161
+ return type;
1162
+ };
1163
+
1164
+ var getDoubleMonthDisplayRange = function (date) {
1165
+ var firstMonth = getMonth(date) % 2 !== 0 ? subMonths(date, 1) : date;
1166
+ var secondMonth = addMonths(firstMonth, 1);
1167
+ return [firstMonth, secondMonth];
1168
+ };
1169
+
1170
+ var getFocusDate = function (_a) {
1171
+ var minDate = _a.minDate, maxDate = _a.maxDate, date = _a.date;
1172
+ var isFocusDateBeforeMinDate = minDate && isBefore(date, minDate);
1173
+ var isFocusDateAfterMaxDate = maxDate && isAfter(date, maxDate);
1174
+ if (isFocusDateBeforeMinDate) {
1175
+ return minDate;
1176
+ }
1177
+ if (isFocusDateAfterMaxDate) {
1178
+ return maxDate;
1179
+ }
1180
+ return date;
1181
+ };
1182
+
1183
+ var getHighlightRange = function (_a) {
1184
+ var date = _a.date, minDate = _a.minDate, maxDate = _a.maxDate, range = _a.range;
1185
+ var existingRange = range.filter(function (date) { return Boolean(date); });
1186
+ if (existingRange.filter(function (date) { return Boolean(date); }).length === 1) {
1187
+ var isDateBeforeMinDate = minDate && isBefore(date, minDate);
1188
+ var isDateAfterMaxDate = maxDate && isAfter(date, maxDate);
1189
+ if (isDateBeforeMinDate) {
1190
+ return [minDate, existingRange[0]].sort(compareAsc);
1191
+ }
1192
+ if (isDateAfterMaxDate) {
1193
+ return [maxDate, existingRange[0]].sort(compareAsc);
1194
+ }
1195
+ return [date, existingRange[0]].sort(compareAsc);
1196
+ }
1197
+ return existingRange;
1198
+ };
1199
+
1200
+ var KeyNames;
1201
+ (function (KeyNames) {
1202
+ KeyNames["ArrowUp"] = "ArrowUp";
1203
+ KeyNames["ArrowDown"] = "ArrowDown";
1204
+ KeyNames["ArrowLeft"] = "ArrowLeft";
1205
+ KeyNames["ArrowRight"] = "ArrowRight";
1206
+ KeyNames["Home"] = "Home";
1207
+ KeyNames["End"] = "End";
1208
+ KeyNames["PageUp"] = "PageUp";
1209
+ KeyNames["PageDown"] = "PageDown";
1210
+ KeyNames["Tab"] = "Tab";
1211
+ KeyNames["Enter"] = "Enter";
1212
+ KeyNames["Space"] = " ";
1213
+ })(KeyNames || (KeyNames = {}));
1214
+
1215
+ var getKeyDownDate = function (_a) {
1216
+ var key = _a.key, shiftKey = _a.shiftKey, focusDate = _a.focusDate;
1217
+ switch (key) {
1218
+ case KeyNames.ArrowDown:
1219
+ return addWeeks(focusDate, 1);
1220
+ case KeyNames.ArrowLeft:
1221
+ return subDays(focusDate, 1);
1222
+ case KeyNames.ArrowRight:
1223
+ return addDays(focusDate, 1);
1224
+ case KeyNames.ArrowUp:
1225
+ return subWeeks(focusDate, 1);
1226
+ case KeyNames.Home:
1227
+ return dateWithoutTime(startOfWeek(focusDate, { weekStartsOn: 1 }));
1228
+ case KeyNames.End:
1229
+ return dateWithoutTime(endOfWeek(focusDate, { weekStartsOn: 1 }));
1230
+ case KeyNames.PageUp:
1231
+ return shiftKey ? subYears(focusDate, 1) : subMonths(focusDate, 1);
1232
+ case KeyNames.PageDown:
1233
+ return shiftKey ? addYears(focusDate, 1) : addMonths(focusDate, 1);
1234
+ default:
1235
+ return focusDate;
1236
+ }
1237
+ };
1238
+
1239
+ var ArcCalendarContext = createContext(null);
1240
+
1241
+ var CalendarDayNumber = forwardRef(function (_a, autoFocusRef) {
1242
+ var date = _a.date, shouldRender = _a.shouldRender, isFocusWithinDayGrid = _a.isFocusWithinDayGrid;
1243
+ var context = useContext(ArcCalendarContext);
1244
+ var isFocusDate = context && isEqual(date, context.focusDate);
1245
+ var tableCellRef = useCallback(function (el) {
1246
+ if (el && isFocusDate && isFocusWithinDayGrid) {
1247
+ el.focus();
1248
+ }
1249
+ }, [isFocusDate, isFocusWithinDayGrid]);
1250
+ if (!context) {
1251
+ return null;
1252
+ }
1253
+ var handleRefs = function (el) {
1254
+ tableCellRef(el);
1255
+ if (autoFocusRef && typeof autoFocusRef === "function") {
1256
+ autoFocusRef(el);
1257
+ }
1258
+ };
1259
+ var disabledDates = context.disabledDates, selectedDate = context.selectedDate, selectionType = context.selectionType, selectedRange = context.selectedRange, highlightedRange = context.highlightedRange, todayDate = context.todayDate, onDayNumberClick = context.onDayNumberClick, onDayNumberHover = context.onDayNumberHover, minDate = context.minDate, maxDate = context.maxDate;
1260
+ var highlightedRangeStart = highlightedRange[0];
1261
+ var highlightedRangeEnd = highlightedRange[1];
1262
+ var isSelectedDate = selectionType === "single"
1263
+ ? isEqual(date, selectedDate)
1264
+ : selectedRange.length &&
1265
+ containsDate(selectedRange.filter(function (date) { return Boolean(date); }), date);
1266
+ var isTodayDate = isEqual(date, todayDate);
1267
+ var dateIsWithinHighlightedRange = selectionType === "range" &&
1268
+ highlightedRange.length === 2 &&
1269
+ !isAfter(date, highlightedRangeEnd) &&
1270
+ !isBefore(date, highlightedRangeStart);
1271
+ var isRoundedLeft = selectionType === "range" &&
1272
+ (isDay(date, WeekDays.MONDAY) ||
1273
+ isFirstDayOfMonth(date) ||
1274
+ isEqual(date, highlightedRangeStart));
1275
+ var isRoundedRight = selectionType === "range" &&
1276
+ (isDay(date, WeekDays.SUNDAY) ||
1277
+ isLastDayOfMonth(date) ||
1278
+ isEqual(date, highlightedRangeEnd));
1279
+ var conditionalClasses = {
1280
+ "arc-CalendarDayNumber--selected": isSelectedDate,
1281
+ "arc-CalendarDayNumber--todayDate": isTodayDate,
1282
+ "arc-CalendarDayNumber--hightlightedRange": dateIsWithinHighlightedRange,
1283
+ "arc-CalendarDayNumber--hightlightedRangeRoundedLeft": isRoundedLeft,
1284
+ "arc-CalendarDayNumber--hightlightedRangeRoundedRight": isRoundedRight
1285
+ };
1286
+ var isAriaSelected = isSelectedDate ||
1287
+ (dateIsWithinHighlightedRange && selectedRange.length === 2);
1288
+ var tableCellProps = {
1289
+ className: classNames("arc-CalendarDayNumber", conditionalClasses),
1290
+ tabIndex: isFocusDate && shouldRender ? 0 : -1,
1291
+ "aria-current": isTodayDate ? "date" : undefined,
1292
+ "aria-selected": isAriaSelected,
1293
+ "aria-disabled": isDisabledDate(date, disabledDates, minDate, maxDate),
1294
+ onClick: onDayNumberClick(date),
1295
+ onMouseEnter: onDayNumberHover(date)
1296
+ };
1297
+ return (React__default.createElement("td", __assign({ ref: handleRefs, "data-date": date.getTime() }, (shouldRender ? tableCellProps : {})), shouldRender && (React__default.createElement(React__default.Fragment, null,
1298
+ React__default.createElement(VisuallyHidden, null, format(date, "MMMM do, yyyy")),
1299
+ React__default.createElement("div", { className: "arc-CalendarDayNumber-buttonOuter" },
1300
+ React__default.createElement("div", { className: "arc-CalendarDayNumber-buttonInner" },
1301
+ React__default.createElement(Text, { size: "s" },
1302
+ React__default.createElement("span", { "aria-hidden": true }, getDate(date)))))))));
1303
+ });
1304
+
1305
+ const BtIconChevronDownMid = (props) =>
1306
+ /*#__PURE__*/ React__default.createElement(
1307
+ "svg",
1308
+ Object.assign(
1309
+ {
1310
+ viewBox: "0 0 32 32",
1311
+ fill: "none",
1312
+ xmlns: "http://www.w3.org/2000/svg",
1313
+ },
1314
+ props,
1315
+ ),
1316
+ /*#__PURE__*/ React__default.createElement("path", {
1317
+ fillRule: "evenodd",
1318
+ clipRule: "evenodd",
1319
+ d: "M16.0001 18.0909L21.7041 12.3935C21.9566 12.1415 22.2987 12 22.6554 12C23.0121 12 23.3543 12.1415 23.6068 12.3935C23.7316 12.5181 23.8306 12.6661 23.8982 12.829C23.9657 12.9919 24.0005 13.1665 24.0005 13.3429C24.0005 13.5192 23.9657 13.6938 23.8982 13.8567C23.8306 14.0196 23.7316 14.1676 23.6068 14.2922L16.9508 20.9402C16.6983 21.1918 16.3565 21.3331 16.0001 21.3331C15.6437 21.3331 15.3018 21.1918 15.0494 20.9402L8.39342 14.2922C8.26861 14.1676 8.16959 14.0196 8.10202 13.8567C8.03446 13.6938 7.99969 13.5192 7.99969 13.3429C7.99969 13.1665 8.03446 12.9919 8.10202 12.829C8.16959 12.6661 8.26861 12.5181 8.39342 12.3935C8.6459 12.1415 8.98804 12 9.34475 12C9.70147 12 10.0436 12.1415 10.2961 12.3935L16.0001 18.0909Z",
1320
+ fill: "currentColor",
1321
+ }),
1322
+ );
1323
+
1324
+ var CalendarDateSelect = function (_a) {
1325
+ var ariaLabel = _a.ariaLabel, onChange = _a.onChange, name = _a.name, value = _a.value, displayValue = _a.displayValue, options = _a.options;
1326
+ return (React__default.createElement("div", { className: "arc-CalendarDateSelect-wrapper" },
1327
+ React__default.createElement("select", { "aria-label": ariaLabel, onChange: onChange, className: "arc-CalendarDateSelect", value: value, name: name }, options.map(function (_a) {
1328
+ var text = _a.text, value = _a.value;
1329
+ return (React__default.createElement("option", { className: "arc-CalendarDateSelect-option", key: "arc-calendar-year-select-".concat(value), value: value }, text));
1330
+ })),
1331
+ React__default.createElement("div", { "aria-hidden": true, className: "arc-CalendarDateSelect-label" },
1332
+ React__default.createElement(Heading, { size: "s" }, displayValue || value),
1333
+ React__default.createElement("div", { className: "arc-CalendarDateSelect-icon" },
1334
+ React__default.createElement(Icon, { size: 24, icon: BtIconChevronDownMid })))));
1335
+ };
1336
+
1337
+ var DAY_NAMES = [
1338
+ {
1339
+ value: WeekDays.MONDAY,
1340
+ displayValue: WeekDaysAbbr.MON
1341
+ },
1342
+ {
1343
+ value: WeekDays.TUESDAY,
1344
+ displayValue: WeekDaysAbbr.TUE
1345
+ },
1346
+ {
1347
+ value: WeekDays.WEDNESDAY,
1348
+ displayValue: WeekDaysAbbr.WED
1349
+ },
1350
+ {
1351
+ value: WeekDays.THURSDAY,
1352
+ displayValue: WeekDaysAbbr.THUR
1353
+ },
1354
+ {
1355
+ value: WeekDays.FRIDAY,
1356
+ displayValue: WeekDaysAbbr.FRI
1357
+ },
1358
+ {
1359
+ value: WeekDays.SATURDAY,
1360
+ displayValue: WeekDaysAbbr.SAT
1361
+ },
1362
+ {
1363
+ value: WeekDays.SUNDAY,
1364
+ displayValue: WeekDaysAbbr.SUN
1365
+ },
1366
+ ];
1367
+
1368
+ var CalendarDayGrid = function (_a) {
1369
+ var displayRange = _a.displayRange;
1370
+ var hasAutoFocused = useRef(false);
1371
+ var dayNumberGridRef = useRef(null);
1372
+ var context = useContext(ArcCalendarContext);
1373
+ var autoFocusRef = useCallback(function (el) {
1374
+ if (el &&
1375
+ el.tabIndex === 0 &&
1376
+ (context === null || context === void 0 ? void 0 : context.autoFocusOnMount) &&
1377
+ !hasAutoFocused.current) {
1378
+ el.focus();
1379
+ }
1380
+ if (document.activeElement === el) {
1381
+ hasAutoFocused.current = true;
1382
+ }
1383
+ }, [context === null || context === void 0 ? void 0 : context.autoFocusOnMount]);
1384
+ if (!context) {
1385
+ return null;
1386
+ }
1387
+ var onKeyboardNavigate = context.onKeyboardNavigate, onDayNumberClick = context.onDayNumberClick, onDayGridLeave = context.onDayGridLeave;
1388
+ var isFocusWithinDayGrid = Boolean(dayNumberGridRef &&
1389
+ dayNumberGridRef.current &&
1390
+ dayNumberGridRef.current.contains(document.activeElement));
1391
+ var handleKeyDown = function (e) {
1392
+ var key = e.key;
1393
+ var newDate = e.target.getAttribute("data-date");
1394
+ if (key === KeyNames.Tab) {
1395
+ return;
1396
+ }
1397
+ if (Object.values(KeyNames).includes(key)) {
1398
+ e.preventDefault();
1399
+ }
1400
+ if ([KeyNames.Space, KeyNames.Enter].includes(key) && newDate) {
1401
+ onDayNumberClick(dateWithoutTime(new Date(parseInt(newDate))))();
1402
+ }
1403
+ else {
1404
+ onKeyboardNavigate(e.key, e.shiftKey);
1405
+ }
1406
+ };
1407
+ var getWeeksInMonth = function (month) {
1408
+ return eachWeekOfInterval({ start: startOfMonth(month), end: endOfMonth(month) }, { weekStartsOn: 1 }).map(function (week) { return eachDayOfInterval({ start: week, end: addDays(week, 6) }); });
1409
+ };
1410
+ return (React__default.createElement("div", { ref: dayNumberGridRef, onMouseLeave: onDayGridLeave, className: classNames("arc-CalendarDayGrid", {
1411
+ "arc-CalendarDayGrid--dual": displayRange.length > 1
1412
+ }) }, displayRange.map(function (month) { return (React__default.createElement("div", { key: month.getTime(), className: "arc-CalendarDayGrid-month" },
1413
+ React__default.createElement("table", { className: "arc-CalendarDayGrid-table" },
1414
+ React__default.createElement("thead", null,
1415
+ React__default.createElement("tr", null, DAY_NAMES.map(function (dayName) { return (React__default.createElement("th", { key: "".concat(month.getTime(), "-").concat(dayName.displayValue) },
1416
+ React__default.createElement(Text, { key: dayName.displayValue, size: "s" },
1417
+ React__default.createElement("b", { "aria-hidden": true }, dayName.displayValue)),
1418
+ React__default.createElement(VisuallyHidden, null, dayName.value))); }))),
1419
+ React__default.createElement("tbody", { onKeyDown: handleKeyDown }, getWeeksInMonth(month).map(function (week, i) { return (React__default.createElement("tr", { key: "".concat(month.getTime(), "-week-").concat(i) }, week.map(function (day) { return (React__default.createElement(CalendarDayNumber, { ref: autoFocusRef, shouldRender: isSameMonth(month, day), key: day.getTime(), date: day, isFocusWithinDayGrid: isFocusWithinDayGrid })); }))); }))))); })));
1420
+ };
1421
+
1422
+ const BtIconChevronLeftMid = (props) =>
1423
+ /*#__PURE__*/ React__default.createElement(
1424
+ "svg",
1425
+ Object.assign(
1426
+ {
1427
+ viewBox: "0 0 16 16",
1428
+ fill: "none",
1429
+ xmlns: "http://www.w3.org/2000/svg",
1430
+ },
1431
+ props,
1432
+ ),
1433
+ /*#__PURE__*/ React__default.createElement("path", {
1434
+ fillRule: "evenodd",
1435
+ clipRule: "evenodd",
1436
+ d: "M7.62107 8.00023L10.4697 10.8522C10.5957 10.9785 10.6665 11.1495 10.6665 11.3279C10.6665 11.5063 10.5957 11.6773 10.4697 11.8036C10.4074 11.866 10.3335 11.9155 10.252 11.9493C10.1706 11.983 10.0833 12.0004 9.99507 12.0004C9.9069 12.0004 9.81959 11.983 9.73814 11.9493C9.65669 11.9155 9.5827 11.866 9.52041 11.8036L6.19641 8.47556C6.07061 8.34935 5.99998 8.17842 5.99998 8.00023C5.99998 7.82203 6.07061 7.6511 6.19641 7.52489L9.52041 4.19689C9.5827 4.13449 9.65669 4.08498 9.73814 4.0512C9.81959 4.01741 9.9069 4.00003 9.99507 4.00003C10.0832 4.00003 10.1706 4.01741 10.252 4.0512C10.3335 4.08498 10.4074 4.13449 10.4697 4.19689C10.5957 4.32313 10.6665 4.4942 10.6665 4.67256C10.6665 4.85092 10.5957 5.02199 10.4697 5.14823L7.62107 8.00023Z",
1437
+ fill: "currentColor",
1438
+ }),
1439
+ );
1440
+
1441
+ var CalendarNavButton = function (_a) {
1442
+ var isDisabled = _a.isDisabled, onClick = _a.onClick, direction = _a.direction, ariaLabel = _a.ariaLabel;
1443
+ var icons = {
1444
+ previous: BtIconChevronLeftMid,
1445
+ next: BtIconChevronRightMid
1446
+ };
1447
+ return (React__default.createElement("button", { "aria-label": ariaLabel, disabled: isDisabled, onClick: onClick, type: "button", className: classNames("arc-CalendarNavButton", {
1448
+ "arc-CalendarNavButton--previous": direction === "previous",
1449
+ "arc-CalendarNavButton--next": direction === "next"
1450
+ }) },
1451
+ React__default.createElement(Icon, { size: 32, icon: icons[direction] })));
1452
+ };
1453
+
1454
+ var CalendarDoubleMonthView = function (_a) {
1455
+ var isPreviousMonthDisabled = _a.isPreviousMonthDisabled, isNextMonthDisabled = _a.isNextMonthDisabled, onNextMonthClick = _a.onNextMonthClick, onPreviousMonthClick = _a.onPreviousMonthClick;
1456
+ var context = useContext(ArcCalendarContext);
1457
+ if (!context) {
1458
+ return null;
1459
+ }
1460
+ var displayDate = context.displayDate;
1461
+ var displayRange = getDoubleMonthDisplayRange(displayDate);
1462
+ var getAriaLabel = function (date) {
1463
+ var months = getDoubleMonthDisplayRange(date);
1464
+ return "show ".concat(format(months[0], "MMMM yyyy"), " to ").concat(format(months[1], "MMMM yyyy"));
1465
+ };
1466
+ return (React__default.createElement(React__default.Fragment, null,
1467
+ React__default.createElement(VisuallyHidden, null,
1468
+ React__default.createElement(Heading, { level: "2" },
1469
+ React__default.createElement("span", { "aria-live": "polite" },
1470
+ "showing ",
1471
+ format(displayRange[0], "MMMM yyyy"),
1472
+ " to",
1473
+ " ",
1474
+ format(displayRange[1], "MMMM yyyy")))),
1475
+ React__default.createElement("div", { className: "arc-CalendarDoubleMonthView-header" },
1476
+ React__default.createElement("div", { className: "arc-CalendarDoubleMonthView-headerMonth" },
1477
+ React__default.createElement("div", { className: "arc-CalendarDoubleMonthView-headerMonthItem" },
1478
+ React__default.createElement(CalendarNavButton, { ariaLabel: getAriaLabel(subMonths(displayDate, 2)), direction: "previous", isDisabled: isPreviousMonthDisabled, onClick: onPreviousMonthClick })),
1479
+ React__default.createElement("div", { "aria-hidden": true, className: "arc-CalendarDoubleMonthView-headerMonthItem" },
1480
+ React__default.createElement(Heading, { level: "2", size: "s" }, format(displayRange[0], "MMM yyyy")))),
1481
+ React__default.createElement("div", { className: "arc-CalendarDoubleMonthView-headerMonth" },
1482
+ React__default.createElement("div", { "aria-hidden": true, className: "arc-CalendarDoubleMonthView-headerMonthItem" },
1483
+ React__default.createElement(Heading, { level: "2", size: "s" }, format(displayRange[1], "MMM yyyy"))),
1484
+ React__default.createElement("div", { className: "arc-CalendarDoubleMonthView-headerMonthItem" },
1485
+ React__default.createElement(CalendarNavButton, { ariaLabel: getAriaLabel(addMonths(displayDate, 2)), direction: "next", isDisabled: isNextMonthDisabled, onClick: onNextMonthClick })))),
1486
+ React__default.createElement(CalendarDayGrid, { displayRange: displayRange })));
1487
+ };
1488
+
1489
+ var CalendarMonthView = function (_a) {
1490
+ var isPreviousMonthDisabled = _a.isPreviousMonthDisabled, isNextMonthDisabled = _a.isNextMonthDisabled, onNextMonthClick = _a.onNextMonthClick, onPreviousMonthClick = _a.onPreviousMonthClick;
1491
+ var context = useContext(ArcCalendarContext);
1492
+ if (!context) {
1493
+ return null;
1494
+ }
1495
+ var displayDate = context.displayDate;
1496
+ return (React__default.createElement(React__default.Fragment, null,
1497
+ React__default.createElement("div", { className: "arc-CalendarMonthView-header" },
1498
+ React__default.createElement(CalendarNavButton, { ariaLabel: "Show ".concat(format(subMonths(displayDate, 1), "MMMM yyyy")), direction: "previous", isDisabled: isPreviousMonthDisabled, onClick: onPreviousMonthClick }),
1499
+ React__default.createElement("div", { className: "arc-CalendarMonthView-headingContainer" },
1500
+ React__default.createElement(VisuallyHidden, null,
1501
+ React__default.createElement(Heading, { level: "2" },
1502
+ React__default.createElement("span", { "aria-live": "polite" },
1503
+ "showing ",
1504
+ format(displayDate, "MMMM yyyy")))),
1505
+ React__default.createElement("div", { "aria-hidden": true },
1506
+ React__default.createElement(Heading, { size: "s", level: "2" }, format(displayDate, "MMM yyyy")))),
1507
+ React__default.createElement(CalendarNavButton, { direction: "next", ariaLabel: "Show ".concat(format(addMonths(displayDate, 1), "MMMM yyyy")), isDisabled: isNextMonthDisabled, onClick: onNextMonthClick })),
1508
+ React__default.createElement(CalendarDayGrid, { displayRange: [displayDate] })));
1509
+ };
1510
+
1511
+ var CalendarMonthYearView = function (_a) {
1512
+ var isPreviousMonthDisabled = _a.isPreviousMonthDisabled, isNextMonthDisabled = _a.isNextMonthDisabled, onMonthChange = _a.onMonthChange, onYearChange = _a.onYearChange, onNextMonthClick = _a.onNextMonthClick, onPreviousMonthClick = _a.onPreviousMonthClick;
1513
+ var context = useContext(ArcCalendarContext);
1514
+ if (!context) {
1515
+ return null;
1516
+ }
1517
+ var displayDate = context.displayDate, minDate = context.minDate, maxDate = context.maxDate;
1518
+ var monthOptions = Array.from({ length: 12 })
1519
+ .map(function (_, i) { return ({
1520
+ value: i,
1521
+ text: format(new Date(2023, i, 1), "MMMM")
1522
+ }); })
1523
+ .filter(function (_a) {
1524
+ var value = _a.value;
1525
+ var currentDateYear = getYear(displayDate);
1526
+ var date = dateWithoutTime(new Date(currentDateYear, value, 1));
1527
+ return ((!minDate || !isMonthBeforeMinDate(date, minDate)) &&
1528
+ (!maxDate || !isMonthAfterMaxDate(date, maxDate)));
1529
+ });
1530
+ var yearOptions = Array.from({ length: 21 }, function (_, i) {
1531
+ var value = getYear(displayDate) - 10 + i;
1532
+ return {
1533
+ value: value,
1534
+ text: value
1535
+ };
1536
+ }).filter(function (_a) {
1537
+ var value = _a.value;
1538
+ return ((minDate ? value >= getYear(minDate) : true) &&
1539
+ (maxDate ? value <= getYear(maxDate) : true));
1540
+ });
1541
+ return (React__default.createElement(React__default.Fragment, null,
1542
+ React__default.createElement("div", { className: "arc-CalendarMonthYearView-header" },
1543
+ React__default.createElement(VisuallyHidden, null,
1544
+ React__default.createElement(Heading, { level: "2" },
1545
+ React__default.createElement("span", { "aria-live": "polite" },
1546
+ "showing ",
1547
+ format(displayDate, "MMMM yyyy")))),
1548
+ React__default.createElement("div", { className: "arc-CalendarMonthYearView-selectWrapper" },
1549
+ React__default.createElement("div", null,
1550
+ React__default.createElement(CalendarDateSelect, { options: monthOptions, ariaLabel: "month", onChange: function (e) { return onMonthChange(parseInt(e.target.value)); }, name: "arc-CalendarMonthYearView-monthSelect", displayValue: format(displayDate, "MMM"), value: "".concat(getMonth(displayDate)) })),
1551
+ React__default.createElement("div", { className: "arc-CalendarMonthYearView-yearSelectContainer" },
1552
+ React__default.createElement(CalendarDateSelect, { options: yearOptions, ariaLabel: "year", onChange: function (e) { return onYearChange(parseInt(e.target.value)); }, name: "arc-CalendarMonthYearView-yearSelect", value: getYear(displayDate) }))),
1553
+ React__default.createElement("div", { className: "arc-CalendarMonthYearView-navButtonContainer" },
1554
+ React__default.createElement(CalendarNavButton, { direction: "previous", ariaLabel: "Show ".concat(format(subMonths(displayDate, 1), "MMMM yyyy")), isDisabled: isPreviousMonthDisabled, onClick: onPreviousMonthClick }),
1555
+ React__default.createElement(CalendarNavButton, { direction: "next", ariaLabel: "Show ".concat(format(addMonths(displayDate, 1), "MMMM yyyy")), isDisabled: isNextMonthDisabled, onClick: onNextMonthClick }))),
1556
+ React__default.createElement(CalendarDayGrid, { displayRange: [displayDate] })));
1557
+ };
1558
+
1559
+ var showPreviousMonthHandler = function (payload, state) {
1560
+ return __assign(__assign({}, state), { focusDate: getFocusDate({
1561
+ date: subMonths(state.focusDate, 1),
1562
+ minDate: payload.minDate
1563
+ }), displayDate: subMonths(state.displayDate, 1) });
1564
+ };
1565
+
1566
+ var showNextMonthHandler = function (payload, state) {
1567
+ return __assign(__assign({}, state), { focusDate: getFocusDate({
1568
+ date: addMonths(state.focusDate, 1),
1569
+ maxDate: payload.maxDate
1570
+ }), displayDate: addMonths(state.displayDate, 1) });
1571
+ };
1572
+
1573
+ var showPreviousDoubleMonthHandler = function (payload, state) {
1574
+ return __assign(__assign({}, state), { focusDate: getFocusDate({
1575
+ date: subMonths(state.focusDate, 2),
1576
+ minDate: payload.minDate
1577
+ }), displayDate: subMonths(state.displayDate, 2) });
1578
+ };
1579
+
1580
+ var showNextDoubleMonthHandler = function (payload, state) {
1581
+ return __assign(__assign({}, state), { focusDate: getFocusDate({
1582
+ date: addMonths(state.focusDate, 2),
1583
+ maxDate: payload.maxDate
1584
+ }), displayDate: addMonths(state.displayDate, 2) });
1585
+ };
1586
+
1587
+ var rangeSelectHandler = function (payload, state) {
1588
+ return __assign(__assign({}, state), { focusDate: payload.date, highlightedRange: payload.range });
1589
+ };
1590
+
1591
+ var highlightRangeHandler = function (payload, state) {
1592
+ return __assign(__assign({}, state), { highlightedRange: getHighlightRange({
1593
+ date: payload.date,
1594
+ range: payload.range,
1595
+ minDate: payload.minDate,
1596
+ maxDate: payload.maxDate
1597
+ }) });
1598
+ };
1599
+
1600
+ var dayNumberSelectHandler = function (payload, state) {
1601
+ return __assign(__assign({}, state), { focusDate: payload });
1602
+ };
1603
+
1604
+ var dayGridLeaveHandler = function (payload, state) {
1605
+ if (payload.selectionType === "range" &&
1606
+ payload.range.filter(function (date) { return Boolean(date); }).length === 1) {
1607
+ return __assign(__assign({}, state), { highlightedRange: [] });
1608
+ }
1609
+ return __assign({}, state);
1610
+ };
1611
+
1612
+ var dropDownChangeYearHandler = function (payload, state) {
1613
+ var year = payload.year, minDate = payload.minDate, maxDate = payload.maxDate;
1614
+ var yearsToAdd = year - getYear(state.displayDate);
1615
+ var newDisplayDate = addYears(state.displayDate, yearsToAdd);
1616
+ var focusDate = getFocusDate({
1617
+ date: addYears(state.focusDate, yearsToAdd),
1618
+ minDate: payload.minDate,
1619
+ maxDate: payload.maxDate
1620
+ });
1621
+ if (minDate && isBefore(newDisplayDate, minDate)) {
1622
+ return __assign(__assign({}, state), { focusDate: focusDate, displayDate: minDate });
1623
+ }
1624
+ if (maxDate && isAfter(newDisplayDate, maxDate)) {
1625
+ return __assign(__assign({}, state), { focusDate: focusDate, displayDate: maxDate });
1626
+ }
1627
+ return __assign(__assign({}, state), { focusDate: focusDate, displayDate: newDisplayDate });
1628
+ };
1629
+
1630
+ var dropDownChangeMonthHandler = function (payload, state) {
1631
+ return __assign(__assign({}, state), { focusDate: getFocusDate({
1632
+ date: setMonth(state.focusDate, payload.month),
1633
+ minDate: payload.minDate,
1634
+ maxDate: payload.maxDate
1635
+ }), displayDate: setMonth(state.displayDate, payload.month) });
1636
+ };
1637
+
1638
+ var calendarKeydownHandler = function (payload, state) {
1639
+ var displayDate = state.displayDate, focusDate = state.focusDate, highlightedRange = state.highlightedRange;
1640
+ var minDate = payload.minDate, maxDate = payload.maxDate, calendarType = payload.calendarType, key = payload.key, shiftKey = payload.shiftKey, range = payload.range, selectionType = payload.selectionType;
1641
+ var isNavigatingByYear = shiftKey && [KeyNames.PageUp, KeyNames.PageDown].includes(key);
1642
+ var keyDownDate = getKeyDownDate({
1643
+ focusDate: focusDate,
1644
+ key: key,
1645
+ shiftKey: shiftKey
1646
+ });
1647
+ var newFocusDate = getFocusDate({
1648
+ minDate: minDate,
1649
+ maxDate: maxDate,
1650
+ date: keyDownDate
1651
+ });
1652
+ var newHighlightedRange = selectionType === "range"
1653
+ ? getHighlightRange({
1654
+ date: keyDownDate,
1655
+ range: range,
1656
+ minDate: minDate,
1657
+ maxDate: maxDate
1658
+ })
1659
+ : highlightedRange;
1660
+ var focusDateIsMinOrMax = (maxDate && isEqual(newFocusDate, maxDate)) ||
1661
+ (minDate && isEqual(newFocusDate, minDate));
1662
+ var _a = getDoubleMonthDisplayRange(displayDate), doubleMonthFirstMonth = _a[0], doubleMonthSecondMonth = _a[1];
1663
+ var doubleMonthVisibleRange = {
1664
+ start: startOfMonth(doubleMonthFirstMonth),
1665
+ end: endOfMonth(doubleMonthSecondMonth)
1666
+ };
1667
+ var singleMonthVisibleRange = {
1668
+ start: startOfMonth(displayDate),
1669
+ end: endOfMonth(displayDate)
1670
+ };
1671
+ var isNewFocusDateVisible = isWithinInterval(newFocusDate, calendarType === "double"
1672
+ ? doubleMonthVisibleRange
1673
+ : singleMonthVisibleRange);
1674
+ var commonState = __assign(__assign({}, state), { focusDate: newFocusDate, highlightedRange: newHighlightedRange });
1675
+ if (!isNewFocusDateVisible &&
1676
+ !focusDateIsMinOrMax &&
1677
+ isNavigatingByYear &&
1678
+ calendarType === "double") {
1679
+ return __assign(__assign({}, commonState), { displayDate: setYear(displayDate, getYear(newFocusDate)) });
1680
+ }
1681
+ if (!isNewFocusDateVisible) {
1682
+ return __assign(__assign({}, commonState), { displayDate: startOfMonth(newFocusDate) });
1683
+ }
1684
+ return commonState;
1685
+ };
1686
+
1687
+ var defaultHandler = function (state) {
1688
+ return __assign({}, state);
1689
+ };
1690
+
1691
+ var reducer = function (state, action) {
1692
+ switch (action.type) {
1693
+ case "DAY_NUMBER_SELECT":
1694
+ return dayNumberSelectHandler(action.payload, state);
1695
+ case "RANGE_SELECT":
1696
+ return rangeSelectHandler(action.payload, state);
1697
+ case "HIGHLIGHT_RANGE":
1698
+ return highlightRangeHandler(action.payload, state);
1699
+ case "DAY_GRID_LEAVE":
1700
+ return dayGridLeaveHandler(action.payload, state);
1701
+ case "SHOW_PREVIOUS_MONTH":
1702
+ return showPreviousMonthHandler(action.payload, state);
1703
+ case "SHOW_NEXT_MONTH":
1704
+ return showNextMonthHandler(action.payload, state);
1705
+ case "SHOW_PREVIOUS_DOUBLE_MONTH":
1706
+ return showPreviousDoubleMonthHandler(action.payload, state);
1707
+ case "SHOW_NEXT_DOUBLE_MONTH":
1708
+ return showNextDoubleMonthHandler(action.payload, state);
1709
+ case "DROPDOWN_CHANGE_YEAR":
1710
+ return dropDownChangeYearHandler(action.payload, state);
1711
+ case "DROPDOWN_CHANGE_MONTH":
1712
+ return dropDownChangeMonthHandler(action.payload, state);
1713
+ case "CALENDAR_KEYDOWN":
1714
+ return calendarKeydownHandler(action.payload, state);
1715
+ default:
1716
+ return defaultHandler(state);
1717
+ }
1718
+ };
1719
+
1720
+ var CalendarFooter = function (_a) {
1721
+ var onCancelClick = _a.onCancelClick;
1722
+ return (React__default.createElement("div", { className: "arc-CalendarFooter" },
1723
+ React__default.createElement("button", { type: "button", className: "arc-CalendarFooter-button", onClick: onCancelClick }, "Cancel")));
1724
+ };
1725
+
1726
+ var CalendarWrapper = function (_a) {
1727
+ var children = _a.children;
1728
+ return (React__default.createElement("div", { className: "arc-CalendarWrapper" },
1729
+ React__default.createElement(Surface, { background: "light-white" },
1730
+ React__default.createElement("div", { className: "arc-CalendarWrapper-inner" }, children))));
1731
+ };
1732
+
1733
+ /** Use `Calendar` to clearly present available dates and allowing users to choose a way to enter information. */
1734
+ var Calendar = function (_a) {
1735
+ 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;
1736
+ var todayDate = dateWithoutTime(new Date());
1737
+ var selectedDate = dateWithoutTime(rawSelectedDate);
1738
+ var selectedRange = rawSelectedRange
1739
+ .filter(function (rangeDate) { return Boolean(rangeDate); })
1740
+ .map(function (rangeDate) { return dateWithoutTime(rangeDate); });
1741
+ var _g = useState(false), isClientLoaded = _g[0], setIsClientLoaded = _g[1];
1742
+ var _h = useReducer(reducer, {
1743
+ displayDate: selectionType === "single"
1744
+ ? startOfMonth(selectedDate)
1745
+ : startOfMonth(selectedRange[0] || todayDate),
1746
+ focusDate: selectionType === "single"
1747
+ ? selectedDate
1748
+ : selectedRange[0] || todayDate,
1749
+ highlightedRange: selectedRange
1750
+ }), _j = _h[0], displayDate = _j.displayDate, focusDate = _j.focusDate, highlightedRange = _j.highlightedRange, dispatch = _h[1];
1751
+ var isMinWidthArcBreakpointM = useMediaQuery("(min-width: ".concat(SemSizeBreakpointsM, ")"));
1752
+ useEffect(function () {
1753
+ setIsClientLoaded(true);
1754
+ }, []);
1755
+ var disabledDates = rawDisabledDates === null || rawDisabledDates === void 0 ? void 0 : rawDisabledDates.map(function (date) { return dateWithoutTime(date); });
1756
+ var minDate = rawMinDate && dateWithoutTime(rawMinDate);
1757
+ var maxDate = rawMaxDate && dateWithoutTime(rawMaxDate);
1758
+ var calendarType = getCalendarType(type, isMinWidthArcBreakpointM);
1759
+ var doubleMonthDisplayRange = getDoubleMonthDisplayRange(displayDate);
1760
+ var isPreviousMonthDisabled = minDate
1761
+ ? isMonthBeforeMinDate(subMonths(displayDate, 1), minDate)
1762
+ : false;
1763
+ var isNextMonthDisabled = maxDate
1764
+ ? isMonthAfterMaxDate(addMonths(displayDate, 1), maxDate)
1765
+ : false;
1766
+ var isDoubleMonthPreviousDisabled = minDate
1767
+ ? isMonthBeforeMinDate(subMonths(doubleMonthDisplayRange[0], 1), minDate)
1768
+ : false;
1769
+ var isDoubleMonthNextDisabled = maxDate
1770
+ ? isMonthAfterMaxDate(addMonths(doubleMonthDisplayRange[1], 1), maxDate)
1771
+ : false;
1772
+ var setDateRange = function (value) {
1773
+ var _a = processSelectedRange({
1774
+ value: value,
1775
+ range: selectedRange,
1776
+ disabledDates: disabledDates
1777
+ }), rangeOnChangeValue = _a.rangeOnChangeValue, rangeValue = _a.rangeValue;
1778
+ dispatch({
1779
+ type: "RANGE_SELECT",
1780
+ payload: {
1781
+ date: value,
1782
+ range: rangeValue
1783
+ }
1784
+ });
1785
+ onRangeSelect && onRangeSelect(rangeOnChangeValue);
1786
+ };
1787
+ var setNewDate = function (value) {
1788
+ dispatch({
1789
+ type: "DAY_NUMBER_SELECT",
1790
+ payload: value
1791
+ });
1792
+ onDateSelect && onDateSelect(value);
1793
+ };
1794
+ var onDayNumberHover = function (date) { return function () {
1795
+ selectionType === "range" &&
1796
+ dispatch({
1797
+ type: "HIGHLIGHT_RANGE",
1798
+ payload: {
1799
+ date: date,
1800
+ minDate: minDate,
1801
+ maxDate: maxDate,
1802
+ range: selectedRange
1803
+ }
1804
+ });
1805
+ }; };
1806
+ var handleDateSelection = function (date) {
1807
+ var isDisabled = isDisabledDate(date, disabledDates, minDate, maxDate);
1808
+ if (isDisabled)
1809
+ return;
1810
+ selectionType === "single" ? setNewDate(date) : setDateRange(date);
1811
+ };
1812
+ var onDayNumberClick = function (date) { return function () {
1813
+ handleDateSelection(date);
1814
+ }; };
1815
+ var onCancelButtonClick = function () {
1816
+ onCancelClick && onCancelClick();
1817
+ };
1818
+ var onDayGridLeave = function () {
1819
+ dispatch({
1820
+ type: "DAY_GRID_LEAVE",
1821
+ payload: {
1822
+ selectionType: selectionType,
1823
+ range: selectedRange
1824
+ }
1825
+ });
1826
+ };
1827
+ var onPreviousMonthClick = function () {
1828
+ dispatch({
1829
+ type: "SHOW_PREVIOUS_MONTH",
1830
+ payload: {
1831
+ minDate: minDate
1832
+ }
1833
+ });
1834
+ };
1835
+ var onNextMonthClick = function () {
1836
+ dispatch({
1837
+ type: "SHOW_NEXT_MONTH",
1838
+ payload: {
1839
+ maxDate: maxDate
1840
+ }
1841
+ });
1842
+ };
1843
+ var onDoubleViewPreviousClick = function () {
1844
+ dispatch({
1845
+ type: "SHOW_PREVIOUS_DOUBLE_MONTH",
1846
+ payload: {
1847
+ minDate: minDate
1848
+ }
1849
+ });
1850
+ };
1851
+ var onDoubleViewNextClick = function () {
1852
+ dispatch({
1853
+ type: "SHOW_NEXT_DOUBLE_MONTH",
1854
+ payload: {
1855
+ maxDate: maxDate
1856
+ }
1857
+ });
1858
+ };
1859
+ var onYearChange = function (year) {
1860
+ dispatch({
1861
+ type: "DROPDOWN_CHANGE_YEAR",
1862
+ payload: {
1863
+ year: year,
1864
+ minDate: minDate,
1865
+ maxDate: maxDate
1866
+ }
1867
+ });
1868
+ };
1869
+ var onMonthChange = function (month) {
1870
+ dispatch({
1871
+ type: "DROPDOWN_CHANGE_MONTH",
1872
+ payload: {
1873
+ month: month,
1874
+ minDate: minDate,
1875
+ maxDate: maxDate
1876
+ }
1877
+ });
1878
+ };
1879
+ var onKeyboardNavigate = function (key, shiftKey) {
1880
+ dispatch({
1881
+ type: "CALENDAR_KEYDOWN",
1882
+ payload: {
1883
+ minDate: minDate,
1884
+ maxDate: maxDate,
1885
+ selectionType: selectionType,
1886
+ calendarType: calendarType,
1887
+ key: key,
1888
+ shiftKey: shiftKey,
1889
+ range: selectedRange
1890
+ }
1891
+ });
1892
+ };
1893
+ return (React__default.createElement(ArcCalendarContext.Provider, { value: {
1894
+ minDate: minDate,
1895
+ maxDate: maxDate,
1896
+ focusDate: focusDate,
1897
+ todayDate: todayDate,
1898
+ displayDate: displayDate,
1899
+ onDayGridLeave: onDayGridLeave,
1900
+ disabledDates: disabledDates,
1901
+ selectedDate: selectedDate,
1902
+ selectionType: selectionType,
1903
+ selectedRange: selectedRange,
1904
+ highlightedRange: highlightedRange,
1905
+ onDayNumberClick: onDayNumberClick,
1906
+ onDayNumberHover: onDayNumberHover,
1907
+ onKeyboardNavigate: onKeyboardNavigate,
1908
+ autoFocusOnMount: autoFocusOnMount
1909
+ } },
1910
+ React__default.createElement("div", { style: { display: isClientLoaded ? "block" : "none" } },
1911
+ React__default.createElement(CalendarWrapper, null,
1912
+ calendarType === "year" && (React__default.createElement(CalendarMonthYearView, { isPreviousMonthDisabled: isPreviousMonthDisabled, isNextMonthDisabled: isNextMonthDisabled, onPreviousMonthClick: onPreviousMonthClick, onNextMonthClick: onNextMonthClick, onMonthChange: onMonthChange, onYearChange: onYearChange })),
1913
+ calendarType === "month" && (React__default.createElement(CalendarMonthView, { isPreviousMonthDisabled: isPreviousMonthDisabled, isNextMonthDisabled: isNextMonthDisabled, onPreviousMonthClick: onPreviousMonthClick, onNextMonthClick: onNextMonthClick })),
1914
+ calendarType === "double" && (React__default.createElement(CalendarDoubleMonthView, { isPreviousMonthDisabled: isDoubleMonthPreviousDisabled, isNextMonthDisabled: isDoubleMonthNextDisabled, onPreviousMonthClick: onDoubleViewPreviousClick, onNextMonthClick: onDoubleViewNextClick })),
1915
+ onCancelClick && (React__default.createElement(CalendarFooter, { onCancelClick: onCancelButtonClick }))))));
1916
+ };
1917
+
1918
+ export { Calendar as C, isAfter as a, compareAsc as c, isBefore as i };