@reykjavik/hanna-react 0.10.84 → 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 +7 -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 +389 -3
  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,40 @@
1
+ import React from 'react';
2
+ import Autosuggest, { RenderSuggestion } from 'react-autosuggest';
3
+ import { BemProps } from '@hugsmidjan/react/types';
4
+ import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
5
+ export type SiteSearchACI18n = {
6
+ lang?: string;
7
+ /** Label for the autocomplete's combobox container div */
8
+ label: string;
9
+ /** Label for the text input */
10
+ inputLabel: string;
11
+ /** Placeholder text for the text input */
12
+ placeholder?: string;
13
+ /** Label for the suggestions item list container */
14
+ suggestionsLabel: string;
15
+ };
16
+ export declare const defaultSiteSearchACTexts: DefaultTexts<SiteSearchACI18n>;
17
+ export type SiteSearchAutocompleteProps<T> = {
18
+ suggestions: Array<T>;
19
+ renderSuggestion?: RenderSuggestion<T>;
20
+ setSuggestions: (suggestions: Array<T>) => void;
21
+ getSuggestionValue: (suggestion: T) => string;
22
+ onSuggestionsFetchRequested: (request: Autosuggest.SuggestionsFetchRequestedParams) => void;
23
+ onSuggestionSelected?: (event: React.FormEvent<HTMLElement>, data: Autosuggest.SuggestionSelectedEventData<T>) => void;
24
+ onSuggestionHighlighted?: (params: {
25
+ suggestion: T;
26
+ }) => void;
27
+ /** Triggered when user hits ENTER key with the focus inside the input field */
28
+ onSubmit?: (value: string) => void;
29
+ /** Custom action to perform when the user clicks the search button
30
+ *
31
+ * Defaults to `onSubmit`
32
+ */
33
+ onButtonClick?: (value: string) => void;
34
+ lang?: string;
35
+ texts?: SiteSearchACI18n;
36
+ /** @deprecated Use `text` prop instead (will be removed in v0.11) */
37
+ label?: string;
38
+ } & BemProps;
39
+ export declare const SiteSearchAutocomplete: <T>(props: SiteSearchAutocompleteProps<T>) => JSX.Element;
40
+ export default SiteSearchAutocomplete;
@@ -0,0 +1,48 @@
1
+ import { __rest } from "tslib";
2
+ import React, { createRef, useState } from 'react';
3
+ import Autosuggest from 'react-autosuggest';
4
+ import { getTexts } from '@reykjavik/hanna-utils/i18n';
5
+ import SiteSearchInput from './SiteSearchInput.js';
6
+ export const defaultSiteSearchACTexts = {
7
+ is: {
8
+ lang: 'is',
9
+ label: 'Leit á vefnum',
10
+ inputLabel: 'Leitarorð',
11
+ placeholder: 'Sláðu inn leitarorð',
12
+ suggestionsLabel: 'Tillögur',
13
+ },
14
+ en: {
15
+ lang: 'en',
16
+ label: 'Site search',
17
+ inputLabel: 'Search terms',
18
+ placeholder: 'Enter search terms',
19
+ suggestionsLabel: 'Suggestions',
20
+ },
21
+ };
22
+ export const SiteSearchAutocomplete = (props) => {
23
+ const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', } = props;
24
+ const [value, setValue] = useState('');
25
+ const inputRef = createRef();
26
+ const txt = getTexts(props, defaultSiteSearchACTexts);
27
+ return (React.createElement(Autosuggest, { theme: {
28
+ container: bem,
29
+ containerOpen: bem + '--open',
30
+ suggestionsContainer: bem + '__container',
31
+ suggestionsContainerOpen: bem + '__container--open',
32
+ suggestionsList: bem + '__list',
33
+ suggestion: bem + '__item',
34
+ suggestionHighlighted: bem + '__item--highlighted',
35
+ }, focusInputOnSuggestionClick: true, suggestions: suggestions, onSuggestionsClearRequested: () => setSuggestions([]), onSuggestionsFetchRequested: onSuggestionsFetchRequested, getSuggestionValue: getSuggestionValue, onSuggestionSelected: onSuggestionSelected, onSuggestionHighlighted: onSuggestionHighlighted, renderSuggestion: renderSuggestion || ((s) => String(s)), containerProps: { 'aria-label': txt.label }, renderSuggestionsContainer: ({ containerProps, children }) => (React.createElement("div", Object.assign({}, containerProps, { "aria-label": suggestions.length ? txt.suggestionsLabel : undefined }), children)), inputProps: {
36
+ ref: inputRef,
37
+ value: value,
38
+ onChange: (_, { newValue }) => {
39
+ setValue(newValue);
40
+ },
41
+ }, renderInputComponent: (inputProps) => {
42
+ /* prettier-ignore */
43
+ const { className, type, disabled, readOnly, required, children } = inputProps, //eslint-disable-line @typescript-eslint/no-unused-vars
44
+ siteSearchProps = __rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
45
+ return (React.createElement(SiteSearchInput, Object.assign({}, siteSearchProps, { label: props.label || txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
46
+ } }));
47
+ };
48
+ export default SiteSearchAutocomplete;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export type SiteSearchCurtainProps = {
3
+ children: ReactNode;
4
+ };
5
+ export declare const SiteSearchCurtain: (props: SiteSearchCurtainProps) => JSX.Element;
6
+ export default SiteSearchCurtain;
@@ -0,0 +1,28 @@
1
+ import React, { useEffect } from 'react';
2
+ import { useLaggedState } from '@hugsmidjan/react/hooks';
3
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
+ import { isPreact } from './utils/env.js';
5
+ export const SiteSearchCurtain = (props) => {
6
+ const [focused, setFocused] = useLaggedState(false);
7
+ useEffect(() => {
8
+ const closeSearch = (e) => {
9
+ if (e.key === 'Escape') {
10
+ setFocused(false);
11
+ }
12
+ };
13
+ document.addEventListener('keyup', closeSearch);
14
+ return () => document.removeEventListener('keyup', closeSearch);
15
+ },
16
+ // eslint-disable-next-line react-hooks/exhaustive-deps
17
+ []);
18
+ const focusHandler = () => {
19
+ setFocused(true);
20
+ };
21
+ const blurHandler = (e) => {
22
+ if (!e.relatedTarget || !e.currentTarget.contains(e.relatedTarget)) {
23
+ setFocused(false, 100);
24
+ }
25
+ };
26
+ return (React.createElement("div", Object.assign({ className: getBemClass('SiteSearchCurtain', [focused && 'focused']), onFocus: focusHandler, onBlur: blurHandler }, (isPreact && { onfocusin: focusHandler, onfocusout: blurHandler })), props.children));
27
+ };
28
+ export default SiteSearchCurtain;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { FormFieldWrappingProps } from './FormField.js';
3
+ import { SSRSupport } from './utils.js';
4
+ type InputElmProps = Omit<JSX.IntrinsicElements['input'], 'className' | 'type' | 'disabled' | 'readOnly' | 'required' | 'onSubmit'>;
5
+ type WrappingProps = Pick<FormFieldWrappingProps, 'id' | 'label'>;
6
+ export type SiteSearchInputProps = {
7
+ /** Triggered when user hits ENTER key with the focus inside the input field
8
+ *
9
+ * Return `true` to **allow** the browser's default submit hehavior
10
+ */
11
+ onSubmit?: () => boolean | void;
12
+ /** Custom action to perform when the user clicks the search button
13
+ *
14
+ * Return `true` to **allow** the browser's default submit hehavior
15
+ *
16
+ * Defaults to `onSearch`
17
+ */
18
+ onButtonClick?: () => boolean | void;
19
+ buttonText?: string;
20
+ children?: never;
21
+ ssr?: SSRSupport;
22
+ } & WrappingProps & InputElmProps;
23
+ export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "value" | "pattern" | "ssr" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "size" | "src" | "multiple" | "alt" | "width" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
24
+ export default SiteSearchInput;
@@ -0,0 +1,30 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useState } from 'react';
3
+ import FormField from './FormField.js';
4
+ // ---------------------------------------------------------------------------
5
+ export const SiteSearchInput = React.forwardRef((props, ref) => {
6
+ var _a;
7
+ const { label, id, onChange, placeholder = typeof label === 'string' ? label : undefined, buttonText = 'Leita', onSubmit, onButtonClick = onSubmit, onKeyDown, ssr } = props, inputElementProps = __rest(props, ["label", "id", "onChange", "placeholder", "buttonText", "onSubmit", "onButtonClick", "onKeyDown", "ssr"]);
8
+ const { value, defaultValue } = inputElementProps;
9
+ const [hasValue, setHasValue] = useState(undefined);
10
+ const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
11
+ const empty = !filled && !placeholder;
12
+ const _onChange = value != null
13
+ ? onChange
14
+ : (e) => {
15
+ setHasValue(!!e.target.value);
16
+ onChange && onChange(e);
17
+ };
18
+ return (React.createElement(FormField, { className: "SiteSearchInput", ssr: ssr, label: label, empty: empty, filled: filled, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
19
+ React.createElement("input", Object.assign({ className: "SiteSearchInput__input", onChange: _onChange }, inputProps, { placeholder: placeholder, onKeyDown: onSubmit
20
+ ? (e) => {
21
+ if (e.key === 'Enter' && onSubmit() !== true) {
22
+ e.preventDefault();
23
+ }
24
+ onKeyDown && onKeyDown(e);
25
+ }
26
+ : onKeyDown }, inputElementProps, { ref: ref })),
27
+ ' ',
28
+ React.createElement("button", { className: "SiteSearchInput__button", type: "submit", onClick: onButtonClick && ((e) => !onButtonClick() && e.preventDefault()), title: buttonText }, buttonText))) }));
29
+ });
30
+ export default SiteSearchInput;
@@ -0,0 +1,25 @@
1
+ import { ReactElement } from 'react';
2
+ export type SkeletonProps = {
3
+ text?: boolean;
4
+ height?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
5
+ items?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
6
+ gap?: 1 | 2 | 3 | 4 | 5;
7
+ };
8
+ export declare const Skeleton: {
9
+ (props: SkeletonProps): JSX.Element;
10
+ /** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
11
+ block(height?: SkeletonProps['height']): SkeletonBlock;
12
+ /** Returns a single `<Skeleton text height={X}/>` element of branded type `SkeletonText` */
13
+ text(height?: SkeletonProps['height']): SkeletonText;
14
+ };
15
+ export default Skeleton;
16
+ declare const _SkeletonBlock__Brand: unique symbol;
17
+ /** The `<Skeleton height={X}/>` element returned by `Skeleton.block(X)` */
18
+ export type SkeletonBlock = ReactElement & {
19
+ [_SkeletonBlock__Brand]: true;
20
+ };
21
+ declare const _SkeletonText__Brand: unique symbol;
22
+ /** The `<Skeleton text height={X}/>` element returned by `Skeleton.text(X)` */
23
+ export type SkeletonText = ReactElement & {
24
+ [_SkeletonText__Brand]: true;
25
+ };
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import range from '@hugsmidjan/qj/range';
3
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
+ const makeRenderSkeleton = (props) => (key) => (React.createElement("span", { key: key, className: getBemClass('Skeleton', [
5
+ props.text && 'text',
6
+ props.height && 'height--' + props.height,
7
+ props.gap && 'gap--' + props.gap,
8
+ ]) }));
9
+ const minmax = (num = 0, max = 100, min = 1) => {
10
+ num = Math.min(Math.max(Math.round(num), min), max);
11
+ return num > min ? num : undefined;
12
+ };
13
+ export const Skeleton = (props) => {
14
+ const height = minmax(props.height, 40);
15
+ const renderSkeleton = makeRenderSkeleton({
16
+ height,
17
+ text: props.text,
18
+ gap: minmax(props.gap, 5, 0),
19
+ });
20
+ const items = minmax(props.items, 20) || 1;
21
+ if (items > 1) {
22
+ return React.createElement(React.Fragment, null, range(1, items).map(renderSkeleton));
23
+ }
24
+ return renderSkeleton();
25
+ };
26
+ export default Skeleton;
27
+ /** Returns a single `<Skeleton height={X}/>` element of branded type `SkeletonBlock` */
28
+ Skeleton.block = (height) => (React.createElement(Skeleton, { height: height }));
29
+ /** Returns a single `<Skeleton text height={X}/>` element of branded type `SkeletonText` */
30
+ Skeleton.text = (height) => (React.createElement(Skeleton, { text: true, height: height }));
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { SeenProp } from './utils/seenEffect.js';
3
+ import { ComponentLayoutProps } from './constants.js';
4
+ export type SubHeadingProps = {
5
+ Tag?: 'h2' | 'h3';
6
+ small?: boolean;
7
+ children: ReactNode;
8
+ } & ComponentLayoutProps & SeenProp;
9
+ export declare const SubHeading: (props: SubHeadingProps) => JSX.Element;
10
+ export default SubHeading;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
+ import { useSeenEffect } from './utils/seenEffect.js';
4
+ export const SubHeading = (props) => {
5
+ const { small, Tag = 'h2', children, align, wide, startSeen } = props;
6
+ const [ref] = useSeenEffect(startSeen);
7
+ return (React.createElement(Tag, { className: getBemClass('SubHeading', [
8
+ small && 'small',
9
+ align === 'right' && 'align--' + align,
10
+ !align && wide && 'wide',
11
+ ]), ref: ref }, children));
12
+ };
13
+ export default SubHeading;
package/esm/Tabs.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { SeenProp } from './utils/seenEffect.js';
2
+ import { SSRSupport } from './utils.js';
3
+ export type TabItemProps = {
4
+ label: string;
5
+ badge?: string | number;
6
+ longLabel?: string;
7
+ type?: 'button' | 'submit';
8
+ id?: string;
9
+ href?: string;
10
+ 'aria-controls'?: string;
11
+ onActivated?: () => void | false;
12
+ };
13
+ /** @deprecated Use `TabItemProps` instead (Will be removed in v0.11) */
14
+ export type TabProps = TabItemProps;
15
+ type BaseTabsProps<T extends TabItemProps = TabItemProps> = {
16
+ id?: string;
17
+ 'aria-label'?: string;
18
+ 'aria-labelledby'?: string;
19
+ tabs: Array<T>;
20
+ activeIdx?: number;
21
+ onSetActive?: (idx: number, tab: T) => void;
22
+ role?: 'tablist' | 'toc';
23
+ 'aria-controls'?: string;
24
+ activateOnFocus?: boolean;
25
+ ssr?: SSRSupport;
26
+ };
27
+ export type TabsProps<T extends TabItemProps = TabItemProps> = BaseTabsProps<T> & {
28
+ vertical?: boolean;
29
+ /** Optional <Tabs/> block connected to the currently active tab */
30
+ subTabs?: BaseTabsProps;
31
+ } & SeenProp;
32
+ /** @deprecated Use `TabsProps` instead (Will be removed in v0.11) */
33
+ export type TablistProps<T extends TabItemProps = TabItemProps> = TabsProps<T>;
34
+ export declare const Tabs: (props: TabsProps) => JSX.Element;
35
+ export default Tabs;
package/esm/Tabs.js ADDED
@@ -0,0 +1,94 @@
1
+ import React, { useState } from 'react';
2
+ import { getFrag } from '@hugsmidjan/qj/frag';
3
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
+ import { useSeenEffect } from './utils/seenEffect.js';
5
+ import { useIsBrowserSide } from './utils.js';
6
+ const navKeyEffects = {
7
+ ArrowUp: -1,
8
+ ArrowLeft: -1,
9
+ ArrowDown: 1,
10
+ ArrowRight: 1,
11
+ };
12
+ // eslint-disable-next-line complexity
13
+ const renderTab = (tabProps, index, listProps) => {
14
+ const { label, badge, href, type, longLabel } = tabProps;
15
+ const { activeIdx, activateTab, focusedIdx, setFocusedIdx, tabRole, listAriaControls, isBrowser, } = listProps;
16
+ const handleClick = isBrowser &&
17
+ ((e) => {
18
+ e.preventDefault();
19
+ activateTab(index);
20
+ e.currentTarget.focus();
21
+ });
22
+ const handleFocus = isBrowser && (() => setFocusedIdx(index));
23
+ const isActive = activeIdx === index || undefined;
24
+ const Tag = href && !tabRole ? 'a' : 'button';
25
+ const tagProps = Tag === 'button'
26
+ ? {
27
+ role: tabRole,
28
+ type: type || 'button',
29
+ // 'aria-selected': tabRole && isActive,
30
+ tabIndex: tabRole ? (focusedIdx === index ? 0 : -1) : undefined,
31
+ 'aria-controls': tabProps['aria-controls'] || (tabRole && getFrag(href)) || listAriaControls,
32
+ }
33
+ : { href };
34
+ return [
35
+ React.createElement(Tag, Object.assign({ key: index, className: "Tabs__tab", "data-active": isActive }, tagProps, { onClick: handleClick, onFocus: handleFocus, "aria-label": longLabel, title: longLabel }),
36
+ label,
37
+ " ",
38
+ badge != null && React.createElement("small", { className: "Tabs__tab__badge" },
39
+ "(",
40
+ badge,
41
+ ")")),
42
+ ' ',
43
+ ];
44
+ };
45
+ // NOTE: This isBrowser tablist behavior is based on
46
+ // https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-2/tabs.html
47
+ export const Tabs = (props) => {
48
+ var _a, _b;
49
+ const { tabs, role, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-controls': listAriaControls, id, activeIdx, onSetActive, activateOnFocus, ssr, startSeen, vertical, subTabs, } = props;
50
+ const isBrowser = useIsBrowserSide(ssr);
51
+ const [focusedIdx, setFocusedIdx] = useState(activeIdx || 0);
52
+ const tabRole = isBrowser && role === 'tablist' ? 'tab' : undefined;
53
+ const activateTab = (index) => {
54
+ const tab = tabs[index];
55
+ if (index === activeIdx || !tab) {
56
+ return;
57
+ }
58
+ const ret = tab.onActivated && tab.onActivated.call(null);
59
+ if (onSetActive && ret !== false) {
60
+ onSetActive(index, tab);
61
+ }
62
+ };
63
+ const handleKeydown = tabRole &&
64
+ ((e) => {
65
+ var _a;
66
+ const delta = navKeyEffects[e.key];
67
+ if (delta) {
68
+ // prevent scolling +
69
+ // prevent bubbling to parent Tabs container
70
+ e.stopPropagation();
71
+ let nextIdx = (focusedIdx || 0) + delta;
72
+ const maxIdx = tabs.length - 1;
73
+ nextIdx = nextIdx < 0 ? maxIdx : nextIdx > maxIdx ? 0 : nextIdx;
74
+ (_a = e.currentTarget.querySelectorAll('.Tabs__tab')[nextIdx]) === null || _a === void 0 ? void 0 : _a.focus();
75
+ activateOnFocus && activateTab(nextIdx);
76
+ }
77
+ });
78
+ const [ref] = useSeenEffect(startSeen);
79
+ const listProps = {
80
+ activeIdx,
81
+ activateTab,
82
+ focusedIdx,
83
+ setFocusedIdx,
84
+ tabRole,
85
+ listAriaControls,
86
+ isBrowser,
87
+ };
88
+ return (React.createElement("div", { className: getBemClass('Tabs', vertical && 'vertical'), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref },
89
+ tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)),
90
+ subTabs && (React.createElement(Tabs, Object.assign({}, subTabs, { role: 'role' in subTabs ? subTabs.role : role, activateOnFocus: (_a = subTabs.activateOnFocus) !== null && _a !== void 0 ? _a : activateOnFocus, ssr: (_b = subTabs.ssr) !== null && _b !== void 0 ? _b : ssr, startSeen: true,
91
+ // just to be sure
92
+ vertical: undefined, subTabs: undefined })))));
93
+ };
94
+ export default Tabs;
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { EitherObj } from '@reykjavik/hanna-utils';
3
+ import { ButtonProps } from './_abstract/_Button.js';
4
+ declare const colors: {
5
+ readonly normal: "";
6
+ readonly green: "color--green";
7
+ readonly yellow: "color--yellow";
8
+ readonly orange: "color--orange";
9
+ readonly red: "color--red";
10
+ };
11
+ export type TagPillColor = keyof typeof colors;
12
+ export type TagPillProps = ButtonProps & {
13
+ children?: ReactNode;
14
+ large?: boolean;
15
+ color?: TagPillColor;
16
+ } & EitherObj<{
17
+ removable?: false;
18
+ }, {
19
+ removable: true;
20
+ onRemove?: () => void;
21
+ removeLabel?: string;
22
+ removeLabelLong?: string;
23
+ }>;
24
+ export declare const TagPill: (props: TagPillProps) => JSX.Element;
25
+ export default TagPill;
package/esm/TagPill.js ADDED
@@ -0,0 +1,34 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
+ import { Button } from './_abstract/_Button.js';
5
+ const colors = {
6
+ normal: '',
7
+ green: 'color--green',
8
+ yellow: 'color--yellow',
9
+ orange: 'color--orange',
10
+ red: 'color--red',
11
+ };
12
+ export const TagPill = (props) => {
13
+ const { modifier, large, removable, onRemove, children, color = 'normal', label = children, removeLabel = 'x', removeLabelLong = removeLabel } = props, buttonProps = __rest(props, ["modifier", "large", "removable", "onRemove", "children", "color", "label", "removeLabel", "removeLabelLong"]);
14
+ const isStatic = !('href' in props || 'type' in props || props.onClick);
15
+ process.env.NODE_ENV !== 'production' &&
16
+ removable &&
17
+ isStatic &&
18
+ !onRemove &&
19
+ console.warn('Removable static (non-button) `TagPill`s ' +
20
+ 'must have an `onRemove` handler defined');
21
+ const modifiers = [modifier, large && 'large', colors[color]];
22
+ const removeBtn = removable && (React.createElement("button", { className: "TagPill__remove", onClick: onRemove && (() => onRemove()), "aria-label": removeLabelLong, type: "button" }, removeLabel));
23
+ return isStatic ? (React.createElement("span", Object.assign({ className: getBemClass('TagPill', modifiers) }, buttonProps),
24
+ label,
25
+ " ",
26
+ removeBtn)) : onRemove ? (React.createElement("span", { className: getBemClass('TagPill', modifiers) },
27
+ React.createElement(Button, Object.assign({ bem: "TagPill__button" }, buttonProps), label),
28
+ ' ',
29
+ removeBtn)) : (React.createElement(Button, Object.assign({ bem: "TagPill" }, buttonProps, { modifier: modifiers }),
30
+ label,
31
+ ' ',
32
+ removable && (React.createElement("span", { className: "TagPill__remove", "aria-label": removeLabelLong }, removeLabel))));
33
+ };
34
+ export default TagPill;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { SeenProp } from './utils/seenEffect.js';
3
+ import { ComponentLayoutProps } from './constants.js';
4
+ export type TextBlockProps = ComponentLayoutProps & {
5
+ /** Make H2 headings float to the left
6
+ *
7
+ * Overrides the `align` and `wide` prop and automatically sets `align` to `right`
8
+ */
9
+ labelled?: boolean;
10
+ /** Sets a smaller text-size */
11
+ small?: boolean;
12
+ children: ReactNode;
13
+ } & SeenProp;
14
+ export declare const TextBlock: (props: TextBlockProps) => JSX.Element;
15
+ export default TextBlock;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
+ import { useSeenEffect } from './utils/seenEffect.js';
4
+ export const TextBlock = (props) => {
5
+ const { children, align, labelled, wide, small, startSeen } = props;
6
+ const rightAligned = align === 'right' || labelled;
7
+ const [ref] = useSeenEffect(startSeen);
8
+ return (React.createElement("div", { className: getBemClass('TextBlock', [
9
+ labelled && 'labelled',
10
+ rightAligned && 'align--right',
11
+ wide && !rightAligned && 'wide',
12
+ small && !labelled && 'small',
13
+ ]), ref: ref }, children));
14
+ };
15
+ export default TextBlock;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ import { ButtonProps } from './_abstract/_Button.js';
3
+ export type TextButtonProps = ButtonProps & {
4
+ disabled?: never;
5
+ };
6
+ export declare const TextButton: (props: TextButtonProps & {
7
+ children?: ReactNode;
8
+ }) => JSX.Element;
9
+ export default TextButton;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { Button } from './_abstract/_Button.js';
3
+ export const TextButton = (props) => {
4
+ if ('disabled' in props) {
5
+ props = Object.assign(Object.assign({}, props), { disabled: undefined });
6
+ }
7
+ return React.createElement(Button, Object.assign({ bem: "TextButton" }, props));
8
+ };
9
+ export default TextButton;
@@ -0,0 +1,16 @@
1
+ import { RefObject } from 'react';
2
+ import { FormFieldWrappingProps } from './FormField.js';
3
+ type InputElmProps = JSX.IntrinsicElements['input'];
4
+ type TextareaElmProps = JSX.IntrinsicElements['textarea'];
5
+ export type TextInputProps = {
6
+ small?: boolean;
7
+ children?: never;
8
+ } & FormFieldWrappingProps & (({
9
+ type?: 'text' | 'email' | 'tel' | 'number' | 'date' | 'url' | 'password' | 'search';
10
+ inputRef?: RefObject<HTMLInputElement>;
11
+ } & InputElmProps) | ({
12
+ type: 'textarea';
13
+ inputRef?: RefObject<HTMLTextAreaElement>;
14
+ } & TextareaElmProps));
15
+ export declare const TextInput: (props: TextInputProps) => JSX.Element;
16
+ export default TextInput;
@@ -0,0 +1,32 @@
1
+ import { __rest } from "tslib";
2
+ import React, { useEffect, useRef, useState } from 'react';
3
+ import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
+ import FormField from './FormField.js';
5
+ export const TextInput = (props) => {
6
+ var _a;
7
+ const _inputRef = useRef(null);
8
+ const { className, label, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, onChange, small, type, ssr, inputRef = _inputRef } = props, inputElementProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "onChange", "small", "type", "ssr", "inputRef"]);
9
+ const { value, defaultValue, placeholder } = inputElementProps;
10
+ const [hasValue, setHasValue] = useState(undefined);
11
+ const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
12
+ const empty = !filled && !placeholder;
13
+ const multiline = type === 'textarea';
14
+ const modifiers = [multiline && 'multiline'];
15
+ const _onChange = value != null
16
+ ? onChange
17
+ : (e) => {
18
+ setHasValue(!!e.target.value);
19
+ onChange &&
20
+ onChange(
21
+ // TypeScript is silly sometimes.
22
+ e);
23
+ };
24
+ useEffect(() => {
25
+ var _a;
26
+ if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) {
27
+ setHasValue(true);
28
+ }
29
+ }, []);
30
+ return (React.createElement(FormField, { className: getBemClass('TextInput', modifiers, className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => multiline ? (React.createElement("textarea", Object.assign({ className: className.input, onChange: _onChange }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) : (React.createElement("input", Object.assign({ className: className.input, onChange: _onChange, type: type }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) }));
31
+ };
32
+ export default TextInput;
@@ -0,0 +1,7 @@
1
+ export type TooltipProps = {
2
+ label: string;
3
+ text: string | JSX.Element;
4
+ iconOnly?: boolean;
5
+ };
6
+ declare const ToolTip: (props: TooltipProps) => JSX.Element;
7
+ export default ToolTip;