@reykjavik/hanna-react 0.10.83 → 0.10.85

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 (437) hide show
  1. package/AccordionList.d.ts +2 -2
  2. package/AccordionList.js +5 -5
  3. package/ActionCards.d.ts +2 -2
  4. package/ActionCards.js +4 -4
  5. package/Alert.d.ts +1 -1
  6. package/Alert.js +6 -6
  7. package/ArticleCards.d.ts +1 -1
  8. package/ArticleCards.js +2 -2
  9. package/ArticleCarousel/_ArticleCarouselCard.d.ts +2 -2
  10. package/ArticleCarousel/_ArticleCarouselCard.js +7 -7
  11. package/ArticleCarousel.d.ts +3 -3
  12. package/ArticleCarousel.js +3 -3
  13. package/ArticleMeta.js +2 -2
  14. package/BasicTable.d.ts +1 -1
  15. package/BasicTable.js +2 -2
  16. package/BgBox.d.ts +1 -1
  17. package/BgBox.js +3 -3
  18. package/Bling.js +2 -2
  19. package/BlockQuote.d.ts +1 -1
  20. package/BlockQuote.js +2 -2
  21. package/BreadCrumbs.js +2 -2
  22. package/ButtonBack.d.ts +1 -1
  23. package/ButtonBack.js +2 -2
  24. package/ButtonPrimary.d.ts +1 -1
  25. package/ButtonPrimary.js +2 -2
  26. package/ButtonSecondary.d.ts +1 -1
  27. package/ButtonSecondary.js +2 -2
  28. package/ButtonTertiary.d.ts +1 -1
  29. package/ButtonTertiary.js +2 -2
  30. package/CHANGELOG.md +13 -0
  31. package/Carousel.d.ts +2 -2
  32. package/Carousel.js +2 -2
  33. package/CenterColumn.d.ts +1 -1
  34. package/CenterColumn.js +2 -2
  35. package/Checkbox.d.ts +1 -1
  36. package/Checkbox.js +2 -2
  37. package/CheckboxButton.d.ts +1 -1
  38. package/CheckboxButton.js +2 -2
  39. package/CheckboxButtonsGroup.d.ts +1 -1
  40. package/CheckboxButtonsGroup.js +3 -3
  41. package/CheckboxGroup.d.ts +1 -1
  42. package/CheckboxGroup.js +3 -3
  43. package/CityBlock.d.ts +4 -4
  44. package/CityBlock.js +4 -4
  45. package/ContactBubble.d.ts +1 -1
  46. package/ContactBubble.js +6 -6
  47. package/ContentArticle.d.ts +4 -4
  48. package/ContentArticle.js +14 -14
  49. package/ContentImage.d.ts +1 -1
  50. package/ContentImage.js +2 -2
  51. package/Datepicker.d.ts +1 -1
  52. package/Datepicker.js +2 -2
  53. package/ExtraLinks.d.ts +2 -2
  54. package/ExtraLinks.js +6 -6
  55. package/FeatureList.d.ts +1 -1
  56. package/FeatureList.js +4 -4
  57. package/FileInput.d.ts +2 -2
  58. package/FileInput.js +4 -4
  59. package/Foonote.d.ts +1 -1
  60. package/Foonote.js +2 -2
  61. package/FooterBadges.js +2 -2
  62. package/Form.d.ts +1 -1
  63. package/FormField.d.ts +1 -1
  64. package/FormField.js +4 -4
  65. package/Gallery/_GalleryItem.d.ts +1 -1
  66. package/Gallery/_GalleryItem.js +7 -7
  67. package/Gallery/_GalleryModal.d.ts +1 -1
  68. package/Gallery/_GalleryModal.js +4 -4
  69. package/Gallery/_GalleryModalContext.d.ts +2 -2
  70. package/Gallery/_GalleryModalItem.d.ts +1 -1
  71. package/Gallery/_GalleryModalItem.js +2 -2
  72. package/Gallery.d.ts +4 -4
  73. package/Gallery.js +7 -7
  74. package/GridBlocks.d.ts +3 -3
  75. package/GridBlocks.js +8 -8
  76. package/Heading.d.ts +1 -1
  77. package/HeroBlock.d.ts +3 -3
  78. package/HeroBlock.js +8 -8
  79. package/Illustration.d.ts +1 -1
  80. package/Illustration.js +2 -2
  81. package/ImageCards.d.ts +2 -2
  82. package/ImageCards.js +4 -4
  83. package/InfoBlock.d.ts +1 -1
  84. package/InfoBlock.js +2 -2
  85. package/InfoHero.d.ts +3 -3
  86. package/InfoHero.js +10 -10
  87. package/IslandBlock.d.ts +4 -4
  88. package/IslandBlock.js +4 -4
  89. package/IslandPageBlock.d.ts +4 -4
  90. package/IslandPageBlock.js +4 -4
  91. package/LabeledTextBlock.d.ts +2 -2
  92. package/LabeledTextBlock.js +4 -4
  93. package/Layout.d.ts +1 -1
  94. package/Layout.js +13 -13
  95. package/MainMenu/_Auxiliary.d.ts +1 -1
  96. package/MainMenu/_Auxiliary.js +2 -2
  97. package/MainMenu/_PrimaryPanel.js +2 -2
  98. package/MainMenu.d.ts +3 -3
  99. package/MainMenu.js +15 -13
  100. package/MiniMetrics.d.ts +2 -2
  101. package/MiniMetrics.js +4 -4
  102. package/NameCard.js +4 -4
  103. package/NameCards.d.ts +1 -1
  104. package/NameCards.js +2 -2
  105. package/NewsHero.d.ts +2 -2
  106. package/NewsHero.js +7 -7
  107. package/PageFilter.d.ts +1 -1
  108. package/PageFilter.js +4 -4
  109. package/PageHeading.d.ts +1 -1
  110. package/PageHeading.js +2 -2
  111. package/Picture.d.ts +1 -1
  112. package/Picture.js +2 -2
  113. package/PullQuote.d.ts +1 -1
  114. package/PullQuote.js +2 -2
  115. package/RadioButtonsGroup.d.ts +1 -1
  116. package/RadioButtonsGroup.js +4 -4
  117. package/RadioGroup.d.ts +2 -2
  118. package/RadioGroup.js +4 -4
  119. package/RelatedLinks.js +2 -2
  120. package/RowBlock.d.ts +1 -1
  121. package/RowBlock.js +2 -2
  122. package/SearchInput.d.ts +1 -1
  123. package/SearchInput.js +2 -2
  124. package/SearchResults/_SearchResultsItem.js +4 -4
  125. package/SearchResults.d.ts +2 -2
  126. package/SearchResults.js +7 -7
  127. package/SeenEffect.d.ts +1 -1
  128. package/SeenEffect.js +3 -3
  129. package/Selectbox.d.ts +2 -2
  130. package/Selectbox.js +2 -2
  131. package/ShareButtons.d.ts +1 -1
  132. package/ShareButtons.js +2 -2
  133. package/SiteSearchAutocomplete.js +2 -2
  134. package/SiteSearchCurtain.js +2 -2
  135. package/SiteSearchInput.d.ts +2 -2
  136. package/SiteSearchInput.js +2 -2
  137. package/SubHeading.d.ts +2 -2
  138. package/SubHeading.js +2 -2
  139. package/Tabs.d.ts +2 -2
  140. package/Tabs.js +4 -4
  141. package/TagPill.d.ts +1 -1
  142. package/TagPill.js +3 -3
  143. package/TextBlock.d.ts +2 -2
  144. package/TextBlock.js +2 -2
  145. package/TextButton.d.ts +1 -1
  146. package/TextButton.js +2 -2
  147. package/TextInput.d.ts +1 -1
  148. package/TextInput.js +2 -2
  149. package/VerticalTabsTOC.d.ts +1 -1
  150. package/VerticalTabsTOC.js +2 -2
  151. package/WizardLayout.d.ts +1 -1
  152. package/WizardLayout.js +8 -8
  153. package/WizardLayoutClose.d.ts +1 -1
  154. package/WizardLayoutClose.js +2 -2
  155. package/_abstract/_AbstractCarousel.d.ts +2 -2
  156. package/_abstract/_AbstractCarousel.js +6 -6
  157. package/_abstract/_Blings.d.ts +1 -1
  158. package/_abstract/_Blings.js +2 -2
  159. package/_abstract/_Block.d.ts +3 -3
  160. package/_abstract/_Block.js +6 -6
  161. package/_abstract/_Button.js +2 -2
  162. package/_abstract/_CardList.d.ts +1 -1
  163. package/_abstract/_CardList.js +4 -4
  164. package/_abstract/_Image.js +2 -2
  165. package/_abstract/_Quote.js +2 -2
  166. package/_abstract/_TogglerGroup.d.ts +2 -2
  167. package/_abstract/_TogglerGroup.js +2 -2
  168. package/_abstract/_TogglerGroupField.d.ts +3 -3
  169. package/_abstract/_TogglerGroupField.js +4 -4
  170. package/assets.d.ts +2 -2
  171. package/esm/AccordionList.d.ts +25 -0
  172. package/esm/AccordionList.js +32 -0
  173. package/esm/ActionCards.d.ts +6 -0
  174. package/esm/ActionCards.js +9 -0
  175. package/esm/Alert.d.ts +48 -0
  176. package/esm/Alert.js +90 -0
  177. package/esm/ArticleCards.d.ts +8 -0
  178. package/esm/ArticleCards.js +4 -0
  179. package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +28 -0
  180. package/esm/ArticleCarousel/_ArticleCarouselCard.js +24 -0
  181. package/esm/ArticleCarousel.d.ts +12 -0
  182. package/esm/ArticleCarousel.js +8 -0
  183. package/esm/ArticleMeta.d.ts +10 -0
  184. package/esm/ArticleMeta.js +19 -0
  185. package/esm/Attention.d.ts +7 -0
  186. package/esm/Attention.js +4 -0
  187. package/esm/BasicTable.d.ts +14 -0
  188. package/esm/BasicTable.js +29 -0
  189. package/esm/BgBox.d.ts +8 -0
  190. package/esm/BgBox.js +9 -0
  191. package/esm/Bling.d.ts +81 -0
  192. package/esm/Bling.js +44 -0
  193. package/esm/BlockBreak.d.ts +2 -0
  194. package/esm/BlockBreak.js +6 -0
  195. package/esm/BlockQuote.d.ts +4 -0
  196. package/esm/BlockQuote.js +4 -0
  197. package/esm/BreadCrumbs.d.ts +11 -0
  198. package/esm/BreadCrumbs.js +28 -0
  199. package/esm/ButtonBack.d.ts +7 -0
  200. package/esm/ButtonBack.js +4 -0
  201. package/esm/ButtonBar.d.ts +17 -0
  202. package/esm/ButtonBar.js +15 -0
  203. package/esm/ButtonPrimary.d.ts +7 -0
  204. package/esm/ButtonPrimary.js +4 -0
  205. package/esm/ButtonSecondary.d.ts +7 -0
  206. package/esm/ButtonSecondary.js +4 -0
  207. package/esm/ButtonTertiary.d.ts +12 -0
  208. package/esm/ButtonTertiary.js +15 -0
  209. package/esm/Carousel.d.ts +4 -0
  210. package/esm/Carousel.js +4 -0
  211. package/esm/CarouselStepper.d.ts +4 -0
  212. package/esm/CarouselStepper.js +4 -0
  213. package/esm/CenterColumn.d.ts +7 -0
  214. package/esm/CenterColumn.js +7 -0
  215. package/esm/Checkbox.d.ts +4 -0
  216. package/esm/Checkbox.js +4 -0
  217. package/esm/CheckboxButton.d.ts +4 -0
  218. package/esm/CheckboxButton.js +4 -0
  219. package/esm/CheckboxButtonsGroup.d.ts +12 -0
  220. package/esm/CheckboxButtonsGroup.js +13 -0
  221. package/esm/CheckboxGroup.d.ts +10 -0
  222. package/esm/CheckboxGroup.js +7 -0
  223. package/esm/CityBlock.d.ts +21 -0
  224. package/esm/CityBlock.js +18 -0
  225. package/esm/ContactBubble.d.ts +58 -0
  226. package/esm/ContactBubble.js +152 -0
  227. package/esm/ContentArticle.d.ts +16 -0
  228. package/esm/ContentArticle.js +24 -0
  229. package/esm/ContentImage.d.ts +8 -0
  230. package/esm/ContentImage.js +18 -0
  231. package/esm/Datepicker.d.ts +40 -0
  232. package/esm/Datepicker.js +78 -0
  233. package/esm/ExtraLinks.d.ts +18 -0
  234. package/esm/ExtraLinks.js +24 -0
  235. package/esm/FeatureList.d.ts +12 -0
  236. package/esm/FeatureList.js +16 -0
  237. package/esm/FieldGroup.d.ts +10 -0
  238. package/esm/FieldGroup.js +9 -0
  239. package/esm/FileInput/_FileInput.utils.d.ts +36 -0
  240. package/esm/FileInput/_FileInput.utils.js +69 -0
  241. package/esm/FileInput/_FileInputFileList.d.ts +11 -0
  242. package/esm/FileInput/_FileInputFileList.js +19 -0
  243. package/esm/FileInput.d.ts +48 -0
  244. package/esm/FileInput.js +130 -0
  245. package/esm/Foonote.d.ts +12 -0
  246. package/esm/Foonote.js +7 -0
  247. package/esm/FooterBadges.d.ts +9 -0
  248. package/esm/FooterBadges.js +12 -0
  249. package/esm/FooterInfo.d.ts +20 -0
  250. package/esm/FooterInfo.js +12 -0
  251. package/esm/Footnote.d.ts +6 -0
  252. package/esm/Footnote.js +3 -0
  253. package/esm/Form.d.ts +7 -0
  254. package/esm/Form.js +10 -0
  255. package/esm/FormField.d.ts +65 -0
  256. package/esm/FormField.js +92 -0
  257. package/esm/Gallery/_GalleryItem.d.ts +7 -0
  258. package/esm/Gallery/_GalleryItem.js +19 -0
  259. package/esm/Gallery/_GalleryModal.d.ts +6 -0
  260. package/esm/Gallery/_GalleryModal.js +53 -0
  261. package/esm/Gallery/_GalleryModalContext.d.ts +9 -0
  262. package/esm/Gallery/_GalleryModalContext.js +2 -0
  263. package/esm/Gallery/_GalleryModalItem.d.ts +2 -0
  264. package/esm/Gallery/_GalleryModalItem.js +11 -0
  265. package/esm/Gallery.d.ts +17 -0
  266. package/esm/Gallery.js +27 -0
  267. package/esm/GridBlocks.d.ts +26 -0
  268. package/esm/GridBlocks.js +24 -0
  269. package/esm/Heading.d.ts +22 -0
  270. package/esm/Heading.js +19 -0
  271. package/esm/HeroBlock.d.ts +19 -0
  272. package/esm/HeroBlock.js +21 -0
  273. package/esm/IframeBlock.d.ts +28 -0
  274. package/esm/IframeBlock.js +26 -0
  275. package/esm/Illustration.d.ts +10 -0
  276. package/esm/Illustration.js +8 -0
  277. package/esm/ImageCards.d.ts +10 -0
  278. package/esm/ImageCards.js +12 -0
  279. package/esm/InfoBlock.d.ts +13 -0
  280. package/esm/InfoBlock.js +13 -0
  281. package/esm/InfoHero.d.ts +18 -0
  282. package/esm/InfoHero.js +83 -0
  283. package/esm/IslandBlock.d.ts +25 -0
  284. package/esm/IslandBlock.js +16 -0
  285. package/esm/IslandPageBlock.d.ts +24 -0
  286. package/esm/IslandPageBlock.js +16 -0
  287. package/esm/LabeledTextBlock.d.ts +11 -0
  288. package/esm/LabeledTextBlock.js +14 -0
  289. package/esm/Layout.d.ts +32 -0
  290. package/esm/Layout.js +56 -0
  291. package/esm/MainMenu/_Auxiliary.d.ts +6 -0
  292. package/esm/MainMenu/_Auxiliary.js +13 -0
  293. package/esm/MainMenu/_PrimaryPanel.d.ts +29 -0
  294. package/esm/MainMenu/_PrimaryPanel.js +22 -0
  295. package/esm/MainMenu.d.ts +62 -0
  296. package/esm/MainMenu.js +221 -0
  297. package/esm/MiniMetrics.d.ts +8 -0
  298. package/esm/MiniMetrics.js +12 -0
  299. package/esm/Modal.d.ts +8 -0
  300. package/esm/Modal.js +14 -0
  301. package/esm/NameCard.d.ts +64 -0
  302. package/esm/NameCard.js +82 -0
  303. package/esm/NameCards.d.ts +6 -0
  304. package/esm/NameCards.js +7 -0
  305. package/esm/NewsHero.d.ts +14 -0
  306. package/esm/NewsHero.js +86 -0
  307. package/esm/PageFilter.d.ts +16 -0
  308. package/esm/PageFilter.js +15 -0
  309. package/esm/PageHeading.d.ts +10 -0
  310. package/esm/PageHeading.js +12 -0
  311. package/esm/Picture.d.ts +7 -0
  312. package/esm/Picture.js +8 -0
  313. package/esm/ProcessOverview.d.ts +13 -0
  314. package/esm/ProcessOverview.js +17 -0
  315. package/esm/PullQuote.d.ts +4 -0
  316. package/esm/PullQuote.js +4 -0
  317. package/esm/RadioButtonsGroup.d.ts +12 -0
  318. package/esm/RadioButtonsGroup.js +14 -0
  319. package/esm/RadioGroup.d.ts +16 -0
  320. package/esm/RadioGroup.js +8 -0
  321. package/esm/RelatedLinks.d.ts +20 -0
  322. package/esm/RelatedLinks.js +26 -0
  323. package/esm/RowBlock.d.ts +12 -0
  324. package/esm/RowBlock.js +9 -0
  325. package/esm/RowBlockColumn.d.ts +8 -0
  326. package/esm/RowBlockColumn.js +11 -0
  327. package/esm/SearchInput.d.ts +18 -0
  328. package/esm/SearchInput.js +23 -0
  329. package/esm/SearchResults/_SearchResultsItem.d.ts +18 -0
  330. package/esm/SearchResults/_SearchResultsItem.js +14 -0
  331. package/esm/SearchResults.d.ts +37 -0
  332. package/esm/SearchResults.js +108 -0
  333. package/esm/SeenEffect.d.ts +4 -0
  334. package/esm/SeenEffect.js +9 -0
  335. package/esm/Selectbox.d.ts +11 -0
  336. package/esm/Selectbox.js +40 -0
  337. package/esm/ShareButtons.d.ts +9 -0
  338. package/esm/ShareButtons.js +56 -0
  339. package/esm/Sharpie.d.ts +23 -0
  340. package/esm/Sharpie.js +22 -0
  341. package/esm/SiteSearchAutocomplete.d.ts +40 -0
  342. package/esm/SiteSearchAutocomplete.js +48 -0
  343. package/esm/SiteSearchCurtain.d.ts +6 -0
  344. package/esm/SiteSearchCurtain.js +28 -0
  345. package/esm/SiteSearchInput.d.ts +24 -0
  346. package/esm/SiteSearchInput.js +30 -0
  347. package/esm/Skeleton.d.ts +25 -0
  348. package/esm/Skeleton.js +30 -0
  349. package/esm/SubHeading.d.ts +10 -0
  350. package/esm/SubHeading.js +13 -0
  351. package/esm/Tabs.d.ts +35 -0
  352. package/esm/Tabs.js +94 -0
  353. package/esm/TagPill.d.ts +25 -0
  354. package/esm/TagPill.js +34 -0
  355. package/esm/TextBlock.d.ts +15 -0
  356. package/esm/TextBlock.js +15 -0
  357. package/esm/TextButton.d.ts +9 -0
  358. package/esm/TextButton.js +9 -0
  359. package/esm/TextInput.d.ts +16 -0
  360. package/esm/TextInput.js +32 -0
  361. package/esm/Tooltip.d.ts +7 -0
  362. package/esm/Tooltip.js +58 -0
  363. package/esm/VSpacer.d.ts +22 -0
  364. package/esm/VSpacer.js +41 -0
  365. package/esm/VerticalTabsTOC.d.ts +14 -0
  366. package/esm/VerticalTabsTOC.js +68 -0
  367. package/esm/WizardLayout.d.ts +15 -0
  368. package/esm/WizardLayout.js +30 -0
  369. package/esm/WizardLayoutClose.d.ts +3 -0
  370. package/esm/WizardLayoutClose.js +4 -0
  371. package/esm/WizardStepper.d.ts +36 -0
  372. package/esm/WizardStepper.js +26 -0
  373. package/esm/_abstract/_AbstractCarousel.d.ts +29 -0
  374. package/esm/_abstract/_AbstractCarousel.js +108 -0
  375. package/esm/_abstract/_Blings.d.ts +11 -0
  376. package/esm/_abstract/_Blings.js +11 -0
  377. package/esm/_abstract/_Block.d.ts +21 -0
  378. package/esm/_abstract/_Block.js +23 -0
  379. package/esm/_abstract/_Button.d.ts +40 -0
  380. package/esm/_abstract/_Button.js +36 -0
  381. package/esm/_abstract/_CardList.d.ts +34 -0
  382. package/esm/_abstract/_CardList.js +37 -0
  383. package/esm/_abstract/_Image.d.ts +36 -0
  384. package/esm/_abstract/_Image.js +26 -0
  385. package/esm/_abstract/_Link.d.ts +60 -0
  386. package/esm/_abstract/_Link.js +64 -0
  387. package/esm/_abstract/_Quote.d.ts +11 -0
  388. package/esm/_abstract/_Quote.js +8 -0
  389. package/esm/_abstract/_TogglerGroup.d.ts +32 -0
  390. package/esm/_abstract/_TogglerGroup.js +28 -0
  391. package/esm/_abstract/_TogglerGroupField.d.ts +19 -0
  392. package/esm/_abstract/_TogglerGroupField.js +17 -0
  393. package/esm/_abstract/_TogglerInput.d.ts +23 -0
  394. package/esm/_abstract/_TogglerInput.js +23 -0
  395. package/esm/_abstract/breakOnNL.d.ts +1 -0
  396. package/esm/_abstract/breakOnNL.js +7 -0
  397. package/esm/assets.d.ts +42 -0
  398. package/esm/assets.js +58 -0
  399. package/esm/constants.d.ts +19 -0
  400. package/esm/constants.js +22 -0
  401. package/esm/focus-visible.d.ts +1 -0
  402. package/esm/focus-visible.js +3 -0
  403. package/esm/index.d.ts +97 -0
  404. package/esm/index.js +1 -0
  405. package/esm/package.json +1 -0
  406. package/esm/utils/HannaUIState.d.ts +8 -0
  407. package/esm/utils/HannaUIState.js +7 -0
  408. package/esm/utils/browserSide.d.ts +1 -0
  409. package/esm/utils/browserSide.js +1 -0
  410. package/esm/utils/config.d.ts +4 -0
  411. package/esm/utils/config.js +2 -0
  412. package/esm/utils/env.d.ts +1 -0
  413. package/esm/utils/env.js +8 -0
  414. package/esm/utils/seenEffect.d.ts +27 -0
  415. package/esm/utils/seenEffect.js +75 -0
  416. package/esm/utils/useDidChange.d.ts +37 -0
  417. package/esm/utils/useDidChange.js +43 -0
  418. package/esm/utils/useFormatMonitor.d.ts +38 -0
  419. package/esm/utils/useFormatMonitor.js +41 -0
  420. package/esm/utils/useGetSVGtext.d.ts +10 -0
  421. package/esm/utils/useGetSVGtext.js +23 -0
  422. package/esm/utils/useMenuToggling.d.ts +8 -0
  423. package/esm/utils/useMenuToggling.js +62 -0
  424. package/esm/utils/useMixedControlState.d.ts +137 -0
  425. package/esm/utils/useMixedControlState.js +101 -0
  426. package/esm/utils/useScrollbarWidthCSSVar.d.ts +17 -0
  427. package/esm/utils/useScrollbarWidthCSSVar.js +19 -0
  428. package/esm/utils.d.ts +8 -0
  429. package/esm/utils.js +8 -0
  430. package/package.json +390 -4
  431. package/utils/config.d.ts +2 -2
  432. package/utils/config.js +2 -2
  433. package/utils/useDidChange.d.ts +1 -1
  434. package/utils/useDidChange.js +1 -1
  435. package/utils/useMenuToggling.js +2 -2
  436. package/utils.d.ts +8 -8
  437. package/utils.js +8 -8
@@ -0,0 +1,48 @@
1
+ import { FileListProps } from './FileInput/_FileInputFileList.js';
2
+ import { FormFieldWrappingProps } from './FormField.js';
3
+ export type FileInputProps = {
4
+ /**
5
+ * Flags if the input should accept multiple, or just a single file at a time.
6
+ *
7
+ * Default: `true`
8
+ */
9
+ multiple?: boolean;
10
+ /**
11
+ * Accepted file mime type(s).
12
+ *
13
+ * Default: no restrictions.
14
+ */
15
+ accept?: string | Array<string>;
16
+ dropzoneText: string | JSX.Element;
17
+ removeFileText?: string;
18
+ lang?: string;
19
+ showFileSize?: boolean;
20
+ showImagePreviews?: boolean;
21
+ FileList?: false | ((props: FileListProps) => JSX.Element | null);
22
+ onFilesUpdated?: (
23
+ /** Updated, full list of Files. */
24
+ files: Array<File>,
25
+ /** Information about which Files were added or removed during with this update.
26
+ *
27
+ * NOTE: When a diff contains both added and deleted files, this indicates a
28
+ * name-conflict occurred — i.e. one of the added files has a name that
29
+ * existed in the old file list.
30
+ * In such cases the deletion is more implicit than explicit, and depending
31
+ * on the circumstances, you MIGHT wish to either warn the user, rename
32
+ * one of the files, instead of overwriting/deleting the older file, etc.
33
+ */
34
+ diff: {
35
+ deleted?: Array<File>;
36
+ added?: Array<File>;
37
+ }) => void;
38
+ onFilesRejected?: (rejectedFiles: Array<File>) => void;
39
+ name?: string;
40
+ value?: ReadonlyArray<File>;
41
+ /** @deprecated Use props `multiple`, `accept` instead (Will be removed in v0.11) */
42
+ dropzoneProps?: {
43
+ accept?: string;
44
+ multiple?: boolean;
45
+ };
46
+ } & FormFieldWrappingProps;
47
+ export declare const FileInput: (props: FileInputProps) => JSX.Element;
48
+ export default FileInput;
@@ -0,0 +1,130 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import { useDropzone } from 'react-dropzone'; // https://react-dropzone.js.org/#!/Dropzone
4
+ import { useDomid } from '@hugsmidjan/react/hooks';
5
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
6
+ import { DEFAULT_LANG } from '@reykjavik/hanna-utils/i18n';
7
+ import { addPreview, formatBytes, getFileListUpdate, releasePreview, } from './FileInput/_FileInput.utils';
8
+ import { DefaultFileList } from './FileInput/_FileInputFileList.js';
9
+ import FormField from './FormField.js';
10
+ const defaultRemoveFileText = {
11
+ is: 'Fjarlægja',
12
+ en: 'Remove',
13
+ pl: 'Usuń',
14
+ };
15
+ const defaultOnFilesRejected = (rejectedFiles) => {
16
+ window.alert('Error:\n' +
17
+ rejectedFiles
18
+ .map((elm) => {
19
+ return elm.name;
20
+ })
21
+ .join(', '));
22
+ };
23
+ const arrayToFileList = (arr) => {
24
+ const fileList = new DataTransfer();
25
+ arr.forEach((item) => {
26
+ fileList.items.add(item);
27
+ });
28
+ return fileList.files;
29
+ };
30
+ export const FileInput = (props) => {
31
+ const { className, id, label, hideLabel, dropzoneProps = { multiple: true }, multiple = dropzoneProps.multiple, accept, dropzoneText, lang = DEFAULT_LANG, removeFileText = defaultRemoveFileText[lang] || defaultRemoveFileText[DEFAULT_LANG], assistText, disabled, invalid, errorMessage, required, reqText, FileList = DefaultFileList, onFilesUpdated = () => undefined, onFilesRejected, showFileSize, showImagePreviews, value = [] } = props, inputElementProps = __rest(props, ["className", "id", "label", "hideLabel", "dropzoneProps", "multiple", "accept", "dropzoneText", "lang", "removeFileText", "assistText", "disabled", "invalid", "errorMessage", "required", "reqText", "FileList", "onFilesUpdated", "onFilesRejected", "showFileSize", "showImagePreviews", "value"]);
32
+ const domid = useDomid(id);
33
+ const fileInputWrapper = useRef(null);
34
+ const fileInput = useRef(null);
35
+ const files = value;
36
+ const [isHover, setIsHover] = useState(false);
37
+ const { getRootProps, getInputProps, isDragReject, inputRef } = useDropzone({
38
+ onDrop: (acceptedFiles) => {
39
+ acceptedFiles = acceptedFiles.map((file) => {
40
+ addPreview(file);
41
+ return file;
42
+ });
43
+ // eslint-disable-next-line @typescript-eslint/no-use-before-define
44
+ addFiles(acceptedFiles);
45
+ setIsHover(false);
46
+ },
47
+ onDropRejected: onFilesRejected || defaultOnFilesRejected,
48
+ onDragEnter: () => {
49
+ // 'dragLeave' always fires right after 'dragEnter', use 'dragOver' instead
50
+ // console.log('enter');
51
+ // setIsHover(true);
52
+ },
53
+ onDragLeave: () => {
54
+ // console.log('leave');
55
+ setIsHover(false);
56
+ },
57
+ onDragOver: () => {
58
+ // TODO: add error icon? 'isDragReject' gives unstable results
59
+ // console.log(isDragReject);
60
+ setIsHover(true);
61
+ },
62
+ multiple,
63
+ accept,
64
+ });
65
+ // Synchronoyusly add previews on incoming files
66
+ // (NOTE: `addPreview` ignores files that already have preview.)
67
+ files.forEach(addPreview);
68
+ useEffect(() => {
69
+ if (fileInput.current) {
70
+ fileInput.current.files = arrayToFileList(files);
71
+ }
72
+ return () => {
73
+ // Make sure to revoke the data uris on unmount to avoid memory leaks
74
+ files.forEach(releasePreview);
75
+ };
76
+ }, [files]);
77
+ const removeFile = (removeTarget) => {
78
+ const deleted = [];
79
+ const targetName = typeof removeTarget !== 'string' ? removeTarget.name : removeTarget;
80
+ const fileList = files.filter((file) => {
81
+ if (file.name !== targetName) {
82
+ return true;
83
+ }
84
+ deleted.push(file);
85
+ releasePreview(file);
86
+ return false;
87
+ });
88
+ if (fileInput.current) {
89
+ fileInput.current.files = arrayToFileList(fileList);
90
+ }
91
+ onFilesUpdated(fileList, { deleted });
92
+ };
93
+ const addFiles = (added) => {
94
+ const { fileList, diff } = getFileListUpdate(files, added, !multiple);
95
+ if (fileInput.current) {
96
+ fileInput.current.files = arrayToFileList(fileList);
97
+ }
98
+ if (inputRef.current) {
99
+ // Empty on every add
100
+ inputRef.current.files = arrayToFileList([]);
101
+ }
102
+ onFilesUpdated(fileList, diff);
103
+ };
104
+ return (React.createElement(FormField, { className: getBemClass('FileInput', [multiple && 'multi'], className), label: label, id: domid + '-fake', LabelTag: "h4", assistText: assistText, hideLabel: hideLabel, disabled: disabled, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, renderInput: (className, inputProps /* , addFocusProps */) => {
105
+ return (React.createElement("div", { className: className.control, ref: fileInputWrapper },
106
+ // Explicitly skip rendering of input element if no
107
+ // name prop is provided. This is implicitly what the
108
+ // browser does on form submit.
109
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name
110
+ // In such cases we assume the application controls the upload/submit
111
+ // behavior separately outside of this component.
112
+ inputElementProps.name ? (React.createElement("input", { className: "FileInput__input", name: inputElementProps.name, id: domid, ref: fileInput, type: "file", style: { display: 'none' }, multiple: multiple || undefined, required: inputProps.required })) : null,
113
+ React.createElement("input", Object.assign({
114
+ // fake input exclusively used to capture clicks and file drops.
115
+ // it's contents are wiped on every "add" action.
116
+ className: "FileInput__input--fake" }, getInputProps(), { tabIndex: undefined, style: undefined, multiple: multiple || undefined }, inputProps, { required: undefined })),
117
+ ' ',
118
+ React.createElement("div", Object.assign({ className: getBemClass('FileInput__dropzone', [isHover && 'highlight']) }, getRootProps({ isDragReject }), { tabIndex: undefined }),
119
+ React.createElement("p", { className: "FileInput__droptext" }, dropzoneText)),
120
+ FileList && (React.createElement(FileList, Object.assign({}, {
121
+ files,
122
+ showFileSize,
123
+ showImagePreviews,
124
+ removeFileText,
125
+ removeFile,
126
+ formatBytes,
127
+ })))));
128
+ } }));
129
+ };
130
+ export default FileInput;
@@ -0,0 +1,12 @@
1
+ import { FootnoteProps as _FootnoteProps } from './Footnote.js';
2
+ /** @deprecated (Will be removed in v0.11)
3
+ *
4
+ * This module file is a typo. import from `Footnote` instead
5
+ */
6
+ export type FootnoteProps = _FootnoteProps;
7
+ /** @deprecated (Will be removed in v0.11)
8
+ *
9
+ * This module file is a typo. import from `Footnote` instead
10
+ */
11
+ export declare const Footnote: (props: _FootnoteProps) => JSX.Element;
12
+ export default Footnote;
package/esm/Foonote.js ADDED
@@ -0,0 +1,7 @@
1
+ import _Footnote from './Footnote.js';
2
+ /** @deprecated (Will be removed in v0.11)
3
+ *
4
+ * This module file is a typo. import from `Footnote` instead
5
+ */
6
+ export const Footnote = _Footnote;
7
+ export default Footnote;
@@ -0,0 +1,9 @@
1
+ export type FooterBadgesProps = {
2
+ badges: Array<{
3
+ altText: string;
4
+ src: string;
5
+ href?: string;
6
+ }>;
7
+ };
8
+ export declare const FooterBadges: (props: FooterBadgesProps) => JSX.Element | null;
9
+ export default FooterBadges;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Link } from './_abstract/_Link.js';
3
+ export const FooterBadges = (props) => {
4
+ if (!props.badges.length) {
5
+ return null;
6
+ }
7
+ return (React.createElement("ul", { className: "FooterBadges" }, props.badges.map(({ altText, src, href }, i) => (React.createElement("li", { key: i, className: "FooterBadges__badge" }, href ? (React.createElement(Link, { href: href },
8
+ ' ',
9
+ React.createElement("img", { src: src, alt: altText }),
10
+ ' ')) : (React.createElement("img", { src: src, alt: altText })))))));
11
+ };
12
+ export default FooterBadges;
@@ -0,0 +1,20 @@
1
+ import { BemPropsModifier } from '@hugsmidjan/react/types';
2
+ export type FooterInfoGroup = {
3
+ title: string;
4
+ modifier?: string;
5
+ main?: boolean;
6
+ /** @deprecated (Will be removed in v0.11) */
7
+ role?: JSX.IntrinsicElements['div']['role'];
8
+ } & BemPropsModifier & ({
9
+ content: JSX.Element;
10
+ html?: undefined;
11
+ } | {
12
+ html: string;
13
+ content?: undefined;
14
+ });
15
+ export type FooterInfoBoxes = Array<FooterInfoGroup>;
16
+ export type FooterInfoProps = {
17
+ boxes: FooterInfoBoxes;
18
+ };
19
+ export declare const FooterInfo: (props: FooterInfoProps) => JSX.Element;
20
+ export default FooterInfo;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
+ export const FooterInfo = (props) => {
4
+ const { boxes } = props;
5
+ return (React.createElement("div", { className: "FooterInfo" }, boxes.map((group, i) => (React.createElement("div", { className: getBemClass('FooterInfo__group', [
6
+ group.main && 'main',
7
+ group.modifier,
8
+ ]), key: i },
9
+ React.createElement("h3", { className: "FooterInfo__grouptitle" }, group.title),
10
+ group.content ? (React.createElement("div", { className: getBemClass('FooterInfo__groupcontent', group.modifier) }, group.content)) : (React.createElement("div", { className: getBemClass('FooterInfo__groupcontent', group.modifier), dangerouslySetInnerHTML: { __html: group.html } })))))));
11
+ };
12
+ export default FooterInfo;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export type FootnoteProps = {
3
+ children: ReactNode;
4
+ };
5
+ export declare const Footnote: (props: FootnoteProps) => JSX.Element;
6
+ export default Footnote;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export const Footnote = (props) => (React.createElement("div", { className: "Footnote" }, props.children));
3
+ export default Footnote;
package/esm/Form.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { ComponentLayoutProps } from './constants.js';
3
+ export type FormProps = ComponentLayoutProps & React.FormHTMLAttributes<HTMLFormElement> & {
4
+ children: ReactNode;
5
+ };
6
+ export declare const Form: (props: FormProps) => JSX.Element;
7
+ export default Form;
package/esm/Form.js ADDED
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
+ export const Form = (props) => {
4
+ const { children, align, wide } = props;
5
+ return (React.createElement("form", Object.assign({}, props, { className: getBemClass('Form', [
6
+ align === 'right' && 'align--' + align,
7
+ !align && wide && 'wide',
8
+ ]) }), children));
9
+ };
10
+ export default Form;
@@ -0,0 +1,65 @@
1
+ import { RefObject } from 'react';
2
+ import { SSRSupport } from './utils.js';
3
+ type InputClassNames = {
4
+ /** Basic/raw FormField BEM name */
5
+ bem: string;
6
+ /** Standard name for "<input/>"-styled controls */
7
+ input: string;
8
+ /** Standard name for radio/checkbox group conotrols */
9
+ options: string;
10
+ /** Generic name for unstyled/free-form controls. */
11
+ control: string;
12
+ };
13
+ export type FormFieldInputProps = {
14
+ id?: string;
15
+ required?: boolean;
16
+ readOnly?: boolean;
17
+ disabled?: boolean;
18
+ 'aria-invalid'?: boolean | 'true' | 'false';
19
+ 'aria-labelledby'?: string;
20
+ 'aria-describedby'?: string;
21
+ };
22
+ type FocusEvents = {
23
+ onFocus?: (e: any) => void;
24
+ onBlur?: (e: any) => void;
25
+ };
26
+ type FocusPropMaker = <P extends FocusEvents>(ownProps?: P) => P & Required<FocusEvents>;
27
+ export type FormFieldWrappingProps = {
28
+ /** Container className - alongside "FormField" */
29
+ className?: string;
30
+ label: string | JSX.Element;
31
+ assistText?: string | JSX.Element;
32
+ hideLabel?: boolean;
33
+ disabled?: boolean;
34
+ readOnly?: boolean;
35
+ invalid?: boolean;
36
+ errorMessage?: string | JSX.Element;
37
+ required?: boolean;
38
+ /** Hidden label prefix text to indicate that the field is required.
39
+ *
40
+ * If your field is required but should not say so in its label
41
+ * then set this prop to `false`
42
+ *
43
+ * Default: `"Þarf að fylla út"`
44
+ * */
45
+ reqText?: string | false;
46
+ /** Optional pre-determinted id="" for the __input */
47
+ id?: string;
48
+ /** Ref object pointing to the outermost `.FormField` element */
49
+ wrapperRef?: RefObject<HTMLElement>;
50
+ ssr?: SSRSupport;
51
+ };
52
+ export type FormFieldGroupWrappingProps = FormFieldWrappingProps & {
53
+ LabelTag?: 'h3' | 'h4' | 'h5';
54
+ };
55
+ export type FormFieldProps = FormFieldGroupWrappingProps & {
56
+ /** Container className - alongside "FormField" */
57
+ className: string;
58
+ small?: boolean;
59
+ group?: boolean;
60
+ empty?: boolean;
61
+ filled?: boolean;
62
+ renderInput(className: InputClassNames, inputProps: FormFieldInputProps, addFocusProps: FocusPropMaker, isBrowser?: boolean): JSX.Element;
63
+ };
64
+ export declare const FormField: (props: FormFieldProps) => JSX.Element;
65
+ export default FormField;
@@ -0,0 +1,92 @@
1
+ import React, { useCallback, useState } from 'react';
2
+ import { useDomid } from '@hugsmidjan/react/hooks';
3
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
+ import { isPreact } from './utils/env.js';
5
+ import { useIsBrowserSide } from './utils.js';
6
+ const inputClassNames = {
7
+ bem: 'FormField',
8
+ input: 'FormField__input',
9
+ options: 'FormField__options',
10
+ control: 'FormField__control',
11
+ };
12
+ // ---------------------------------------------------------------------------
13
+ // eslint-disable-next-line complexity
14
+ export const FormField = (props) => {
15
+ const { className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // i18n
16
+ renderInput, id, ssr, } = props;
17
+ const isBrowser = useIsBrowserSide(ssr);
18
+ const isInvalid = invalid || !!errorMessage || undefined;
19
+ const domid = useDomid(id);
20
+ const [focused, setFocused] = useState(false);
21
+ // @ts-expect-error (Duck knows why this errors?!)
22
+ const addFocusProps = useCallback((ownProps) => {
23
+ const { onFocus, onBlur } = ownProps || {};
24
+ const focusHandler = (e) => {
25
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
26
+ setFocused(true);
27
+ }
28
+ onFocus && onFocus(e);
29
+ };
30
+ const blurHandler = (e) => {
31
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
32
+ setFocused(false);
33
+ }
34
+ onBlur && onBlur(e);
35
+ };
36
+ const focusProps = Object.assign(Object.assign({}, ownProps), { onFocus: focusHandler, onBlur: blurHandler });
37
+ if (isPreact) {
38
+ const focusinHandler = (e) => {
39
+ e.currentTarget !== e.target && focusHandler(e);
40
+ };
41
+ const focusoutHandler = (e) => {
42
+ e.currentTarget !== e.target && blurHandler(e);
43
+ };
44
+ // @ts-expect-error (Sneak this in as Preact does not bubble `FocusEvent`s)
45
+ focusProps.onfocusin = focusinHandler;
46
+ // @ts-expect-error (Sneak this in as Preact does not bubble `FocusEvent`s)
47
+ focusProps.onfocusout = focusoutHandler;
48
+ }
49
+ return focusProps;
50
+ }, []);
51
+ const errorId = errorMessage ? 'error:' + domid : undefined;
52
+ const assistTextId = assistText ? 'assist:' + domid : undefined;
53
+ const labelId = LabelTag ? 'label:' + domid : undefined;
54
+ const reqStar = required && reqText !== false && (React.createElement("abbr", { className: "FormField__label__reqstar",
55
+ // TODO: add mo-better i18n thinking
56
+ title: (reqText || 'Þarf að fylla út') + ': ' }, "*"));
57
+ const inputProps = {
58
+ id: domid,
59
+ disabled: disabled,
60
+ required: required,
61
+ readOnly: readOnly,
62
+ 'aria-invalid': isInvalid,
63
+ 'aria-describedby': assistTextId && errorId ? assistTextId + ' ' + errorId : assistTextId || errorId,
64
+ 'aria-labelledby': labelId, // undefined if normalLabel
65
+ };
66
+ return (React.createElement("div", { className: getBemClass('FormField', [
67
+ small && 'small',
68
+ hideLabel && 'nolabel',
69
+ isInvalid && 'invalid',
70
+ disabled && 'disabled',
71
+ readOnly && 'readonly',
72
+ isBrowser && empty && 'empty',
73
+ isBrowser && filled && 'filled',
74
+ isBrowser && focused && 'focused',
75
+ ], className), ref: props.wrapperRef },
76
+ LabelTag ? (React.createElement(LabelTag, { className: "FormField__label", id: labelId },
77
+ ' ',
78
+ reqStar,
79
+ " ",
80
+ label,
81
+ ' ')) : (React.createElement("label", { className: "FormField__label", htmlFor: domid },
82
+ ' ',
83
+ reqStar,
84
+ " ",
85
+ label,
86
+ ' ')),
87
+ ' ',
88
+ renderInput(inputClassNames, inputProps, addFocusProps, isBrowser),
89
+ assistText && (React.createElement("div", { id: assistTextId, className: "FormField__assist" }, assistText)),
90
+ errorMessage && (React.createElement("div", { id: errorId, className: "FormField__error" }, errorMessage))));
91
+ };
92
+ export default FormField;
@@ -0,0 +1,7 @@
1
+ import { ImageProps } from '../_abstract/_Image.js';
2
+ export type GalleryItemProps = {
3
+ caption?: string;
4
+ description?: string;
5
+ largeImageSrc?: string;
6
+ } & ImageProps;
7
+ export declare const GalleryItem: (props: GalleryItemProps) => JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useContext } from 'react';
3
+ import { Button } from '../_abstract/_Button.js';
4
+ import { Image } from '../_abstract/_Image.js';
5
+ import { GalleryModalContext } from './_GalleryModalContext.js';
6
+ export const GalleryItem = (props) => {
7
+ const { caption, description, largeImageSrc } = props, image = __rest(props, ["caption", "description", "largeImageSrc"]);
8
+ const { setCurrentImage } = useContext(GalleryModalContext);
9
+ return (React.createElement("figure", { className: "GalleryItem" },
10
+ React.createElement("figcaption", { className: "GalleryItem__caption" }, caption),
11
+ largeImageSrc ? (React.createElement(Button, { bem: "GalleryItem__button", href: largeImageSrc, onClick: (e) => {
12
+ e.preventDefault();
13
+ setCurrentImage(Object.assign(Object.assign({}, image), { caption, description, largeImageSrc }));
14
+ } },
15
+ ' ',
16
+ React.createElement(Image, Object.assign({ className: "GalleryItem__image" }, image)),
17
+ ' ')) : (React.createElement(Image, Object.assign({ className: "GalleryItem__image" }, image))),
18
+ description && React.createElement("div", { className: "GalleryItem__description" }, description)));
19
+ };
@@ -0,0 +1,6 @@
1
+ import { GalleryI18n } from '../Gallery.js';
2
+ type GalleryModalProps = {
3
+ texts: Readonly<GalleryI18n>;
4
+ };
5
+ export declare const GalleryModal: (props: GalleryModalProps) => JSX.Element | null;
6
+ export {};
@@ -0,0 +1,53 @@
1
+ import React, { useContext, useEffect, useState } from 'react';
2
+ import { CSSTransition } from 'react-transition-group';
3
+ import { objectClean, objectIsSame } from '@hugsmidjan/qj/object';
4
+ import CarouselPaging from '@hugsmidjan/react/CarouselPaging';
5
+ import Modal from '@hugsmidjan/react/Modal';
6
+ import { GalleryModalContext } from './_GalleryModalContext.js';
7
+ import { GalleryModalItem } from './_GalleryModalItem.js';
8
+ export const GalleryModal = (props) => {
9
+ const { texts } = props;
10
+ const { currentImage, items, setCurrentImage } = useContext(GalleryModalContext);
11
+ const [image, setImage] = useState(currentImage);
12
+ const [animated, setAnimated] = useState(false);
13
+ const updateImage = (index) => {
14
+ setAnimated(!animated);
15
+ setTimeout(() => {
16
+ setCurrentImage(items[index]);
17
+ }, 200);
18
+ };
19
+ useEffect(() => {
20
+ if (image !== currentImage) {
21
+ const imgSource = (currentImage === null || currentImage === void 0 ? void 0 : currentImage.largeImageSrc) || (currentImage === null || currentImage === void 0 ? void 0 : currentImage.src);
22
+ if (imgSource) {
23
+ const imageToLoad = new window.Image();
24
+ imageToLoad.src = imgSource;
25
+ imageToLoad.onload = () => {
26
+ setImage(currentImage);
27
+ };
28
+ }
29
+ else {
30
+ setImage(undefined);
31
+ }
32
+ }
33
+ }, [image, currentImage]);
34
+ if (!image) {
35
+ return null;
36
+ }
37
+ const imageIndex = items.findIndex((item) =>
38
+ // FIXME: This if weirdly inefficient. Either memoize,
39
+ // or do a simpler single-property comparison.
40
+ objectIsSame(objectClean(image), objectClean(item)));
41
+ return (React.createElement(Modal, { open: true, onClosed: () => {
42
+ setCurrentImage(undefined);
43
+ }, startOpen: false, bem: "GalleryModal", texts: { closeButton: texts.modalCloseLabel } },
44
+ React.createElement(React.Fragment, null,
45
+ React.createElement(CSSTransition, { in: animated, timeout: 200, onEntered: () => {
46
+ setAnimated(!animated);
47
+ }, classNames: "GalleryModalItem--" },
48
+ React.createElement(GalleryModalItem, Object.assign({}, image))),
49
+ React.createElement(CarouselPaging, { bem: "GalleryModalPager", itemCount: items.length, current: imageIndex, setCurrent: updateImage, texts: {
50
+ next: texts.modalNextLabel,
51
+ prev: texts.modalPrevLabel,
52
+ } }))));
53
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { GalleryProps } from '../Gallery.js';
3
+ import { GalleryItemProps } from './_GalleryItem.js';
4
+ type ModalContextProps = {
5
+ setCurrentImage: (item: GalleryItemProps | undefined) => void;
6
+ currentImage: GalleryItemProps | undefined;
7
+ } & GalleryProps;
8
+ export declare const GalleryModalContext: import("react").Context<ModalContextProps>;
9
+ export {};
@@ -0,0 +1,2 @@
1
+ import { createContext } from 'react';
2
+ export const GalleryModalContext = createContext({});
@@ -0,0 +1,2 @@
1
+ import { GalleryItemProps } from './_GalleryItem.js';
2
+ export declare const GalleryModalItem: (props: GalleryItemProps) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import { Image } from '../_abstract/_Image.js';
4
+ export const GalleryModalItem = (props) => {
5
+ const { caption, description } = props, image = __rest(props, ["caption", "description"]);
6
+ return (React.createElement("div", { className: "GalleryModalItem" },
7
+ (caption || description) && (React.createElement("div", { className: "GalleryModalItem__text" },
8
+ React.createElement("div", { className: "GalleryModalItem__caption" }, caption),
9
+ React.createElement("div", { className: "GalleryModalItem__description" }, description))),
10
+ React.createElement(Image, { className: "GalleryModalItem__image", src: image.largeImageSrc || image.src })));
11
+ };
@@ -0,0 +1,17 @@
1
+ import { GalleryItemProps } from './Gallery/_GalleryItem.js';
2
+ import { SeenProp } from './utils/seenEffect.js';
3
+ import { SSRSupport } from './utils.js';
4
+ export type { GalleryItemProps } from './Gallery/_GalleryItem.js';
5
+ export type GalleryI18n = {
6
+ modalNextLabel: string;
7
+ modalPrevLabel: string;
8
+ modalCloseLabel: string;
9
+ };
10
+ export type GalleryProps = {
11
+ items: Array<GalleryItemProps>;
12
+ texts?: GalleryI18n;
13
+ lang?: string;
14
+ ssr?: SSRSupport;
15
+ } & SeenProp;
16
+ export declare const Gallery: (props: GalleryProps) => JSX.Element;
17
+ export default Gallery;
package/esm/Gallery.js ADDED
@@ -0,0 +1,27 @@
1
+ import React, { useState } from 'react';
2
+ import { getTexts } from '@reykjavik/hanna-utils/i18n';
3
+ import { AbstractCarousel } from './_abstract/_AbstractCarousel.js';
4
+ import { GalleryItem } from './Gallery/_GalleryItem.js';
5
+ import { GalleryModal } from './Gallery/_GalleryModal.js';
6
+ import { GalleryModalContext } from './Gallery/_GalleryModalContext.js';
7
+ const defaultTexts = {
8
+ en: {
9
+ modalNextLabel: 'Next image',
10
+ modalPrevLabel: 'Previous image',
11
+ modalCloseLabel: 'Back to article',
12
+ },
13
+ is: {
14
+ modalNextLabel: 'Næsta mynd',
15
+ modalPrevLabel: 'Fyrri mynd',
16
+ modalCloseLabel: 'Til baka í grein',
17
+ },
18
+ };
19
+ export const Gallery = (props) => {
20
+ const { items, ssr, startSeen } = props;
21
+ const texts = getTexts(props, defaultTexts);
22
+ const [modalImage, setModalImage] = useState(undefined);
23
+ return (React.createElement(GalleryModalContext.Provider, { value: { items, setCurrentImage: setModalImage, currentImage: modalImage } },
24
+ React.createElement(AbstractCarousel, { bem: "Gallery", items: items, Component: GalleryItem, ssr: ssr, startSeen: startSeen }),
25
+ React.createElement(GalleryModal, Object.assign({}, modalImage, { texts: texts }))));
26
+ };
27
+ export default Gallery;
@@ -0,0 +1,26 @@
1
+ import { Efnistakn } from '@reykjavik/hanna-utils/assets';
2
+ import { ButtonProps } from './_abstract/_Button.js';
3
+ import { ImageProps } from './_abstract/_Image.js';
4
+ import { SeenProp } from './utils/seenEffect.js';
5
+ export type GridBlockItem = {
6
+ title: string;
7
+ summary: string | JSX.Element;
8
+ icon?: Efnistakn;
9
+ image?: ImageProps;
10
+ } & ({
11
+ href?: string;
12
+ links: Array<ButtonProps>;
13
+ } | {
14
+ href: string;
15
+ links?: Array<ButtonProps>;
16
+ });
17
+ export type GridBlocksProps = {
18
+ blocks: Array<GridBlockItem>;
19
+ twocol?: boolean;
20
+ } & SeenProp;
21
+ export type GridBlocksProp1s = {
22
+ blocks: Array<GridBlockItem>;
23
+ twocol?: boolean;
24
+ };
25
+ export declare const GridBlocks: (props: GridBlocksProps) => JSX.Element;
26
+ export default GridBlocks;