@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
package/esm/index.d.ts ADDED
@@ -0,0 +1,97 @@
1
+ /// <reference path="./AccordionList.d.tsx" />
2
+ /// <reference path="./ActionCards.d.tsx" />
3
+ /// <reference path="./Alert.d.tsx" />
4
+ /// <reference path="./ArticleCards.d.tsx" />
5
+ /// <reference path="./ArticleCarousel.d.tsx" />
6
+ /// <reference path="./ArticleMeta.d.tsx" />
7
+ /// <reference path="./assets.d.ts" />
8
+ /// <reference path="./Attention.d.tsx" />
9
+ /// <reference path="./BasicTable.d.tsx" />
10
+ /// <reference path="./BgBox.d.tsx" />
11
+ /// <reference path="./Bling.d.tsx" />
12
+ /// <reference path="./BlockBreak.d.tsx" />
13
+ /// <reference path="./BlockQuote.d.tsx" />
14
+ /// <reference path="./BreadCrumbs.d.tsx" />
15
+ /// <reference path="./ButtonBack.d.tsx" />
16
+ /// <reference path="./ButtonBar.d.tsx" />
17
+ /// <reference path="./ButtonPrimary.d.tsx" />
18
+ /// <reference path="./ButtonSecondary.d.tsx" />
19
+ /// <reference path="./ButtonTertiary.d.tsx" />
20
+ /// <reference path="./Carousel.d.tsx" />
21
+ /// <reference path="./CarouselStepper.d.tsx" />
22
+ /// <reference path="./CenterColumn.d.tsx" />
23
+ /// <reference path="./Checkbox.d.tsx" />
24
+ /// <reference path="./CheckboxButton.d.tsx" />
25
+ /// <reference path="./CheckboxButtonsGroup.d.tsx" />
26
+ /// <reference path="./CheckboxGroup.d.tsx" />
27
+ /// <reference path="./CityBlock.d.tsx" />
28
+ /// <reference path="./constants.d.ts" />
29
+ /// <reference path="./ContactBubble.d.tsx" />
30
+ /// <reference path="./ContentArticle.d.tsx" />
31
+ /// <reference path="./ContentImage.d.tsx" />
32
+ /// <reference path="./Datepicker.d.tsx" />
33
+ /// <reference path="./ExtraLinks.d.tsx" />
34
+ /// <reference path="./FeatureList.d.tsx" />
35
+ /// <reference path="./FieldGroup.d.tsx" />
36
+ /// <reference path="./FileInput.d.tsx" />
37
+ /// <reference path="./focus-visible.d.ts" />
38
+ /// <reference path="./Foonote.d.tsx" />
39
+ /// <reference path="./FooterBadges.d.tsx" />
40
+ /// <reference path="./FooterInfo.d.tsx" />
41
+ /// <reference path="./Footnote.d.tsx" />
42
+ /// <reference path="./Form.d.tsx" />
43
+ /// <reference path="./FormField.d.tsx" />
44
+ /// <reference path="./Gallery.d.tsx" />
45
+ /// <reference path="./GridBlocks.d.tsx" />
46
+ /// <reference path="./Heading.d.tsx" />
47
+ /// <reference path="./HeroBlock.d.tsx" />
48
+ /// <reference path="./IframeBlock.d.tsx" />
49
+ /// <reference path="./Illustration.d.tsx" />
50
+ /// <reference path="./ImageCards.d.tsx" />
51
+ /// <reference path="./InfoBlock.d.tsx" />
52
+ /// <reference path="./InfoHero.d.tsx" />
53
+ /// <reference path="./IslandBlock.d.tsx" />
54
+ /// <reference path="./IslandPageBlock.d.tsx" />
55
+ /// <reference path="./LabeledTextBlock.d.tsx" />
56
+ /// <reference path="./Layout.d.tsx" />
57
+ /// <reference path="./MainMenu.d.tsx" />
58
+ /// <reference path="./MiniMetrics.d.tsx" />
59
+ /// <reference path="./Modal.d.tsx" />
60
+ /// <reference path="./NameCard.d.tsx" />
61
+ /// <reference path="./NameCards.d.tsx" />
62
+ /// <reference path="./NewsHero.d.tsx" />
63
+ /// <reference path="./PageFilter.d.tsx" />
64
+ /// <reference path="./PageHeading.d.tsx" />
65
+ /// <reference path="./Picture.d.tsx" />
66
+ /// <reference path="./ProcessOverview.d.tsx" />
67
+ /// <reference path="./PullQuote.d.tsx" />
68
+ /// <reference path="./RadioButtonsGroup.d.tsx" />
69
+ /// <reference path="./RadioGroup.d.tsx" />
70
+ /// <reference path="./RelatedLinks.d.tsx" />
71
+ /// <reference path="./RowBlock.d.tsx" />
72
+ /// <reference path="./RowBlockColumn.d.tsx" />
73
+ /// <reference path="./SearchInput.d.tsx" />
74
+ /// <reference path="./SearchResults.d.tsx" />
75
+ /// <reference path="./SeenEffect.d.tsx" />
76
+ /// <reference path="./Selectbox.d.tsx" />
77
+ /// <reference path="./ShareButtons.d.tsx" />
78
+ /// <reference path="./Sharpie.d.tsx" />
79
+ /// <reference path="./SiteSearchAutocomplete.d.tsx" />
80
+ /// <reference path="./SiteSearchCurtain.d.tsx" />
81
+ /// <reference path="./SiteSearchInput.d.tsx" />
82
+ /// <reference path="./Skeleton.d.tsx" />
83
+ /// <reference path="./SubHeading.d.tsx" />
84
+ /// <reference path="./Tabs.d.tsx" />
85
+ /// <reference path="./TagPill.d.tsx" />
86
+ /// <reference path="./TextBlock.d.tsx" />
87
+ /// <reference path="./TextButton.d.tsx" />
88
+ /// <reference path="./TextInput.d.tsx" />
89
+ /// <reference path="./Tooltip.d.tsx" />
90
+ /// <reference path="./utils.d.ts" />
91
+ /// <reference path="./VerticalTabsTOC.d.tsx" />
92
+ /// <reference path="./VSpacer.d.tsx" />
93
+ /// <reference path="./WizardLayout.d.tsx" />
94
+ /// <reference path="./WizardLayoutClose.d.tsx" />
95
+ /// <reference path="./WizardStepper.d.tsx" />
96
+
97
+ export {};
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ type HannaUIStateProps = {
3
+ closeHamburgerMenu: () => void;
4
+ isHamburgerMenuOpen: boolean | undefined;
5
+ };
6
+ export declare const HannaUIState: import("react").Provider<HannaUIStateProps>;
7
+ export declare const useHannaUIState: () => HannaUIStateProps;
8
+ export {};
@@ -0,0 +1,7 @@
1
+ import { createContext, useContext } from 'react';
2
+ const _HannaUIContext = createContext({
3
+ closeHamburgerMenu: () => undefined,
4
+ isHamburgerMenuOpen: undefined,
5
+ });
6
+ export const HannaUIState = _HannaUIContext.Provider;
7
+ export const useHannaUIState = () => useContext(_HannaUIContext);
@@ -0,0 +1 @@
1
+ export { useIsBrowserSide, useIsServerSide } from '@hugsmidjan/react/hooks';
@@ -0,0 +1 @@
1
+ export { useIsBrowserSide, useIsServerSide } from '@hugsmidjan/react/hooks';
@@ -0,0 +1,4 @@
1
+ export type { LinkRenderer } from '../_abstract/_Link.js';
2
+ export { setLinkRenderer } from '../_abstract/_Link.js';
3
+ export type { SSRSupport } from '@hugsmidjan/react/hooks';
4
+ export { setDefaultSSR } from '@hugsmidjan/react/hooks';
@@ -0,0 +1,2 @@
1
+ export { setLinkRenderer } from '../_abstract/_Link.js';
2
+ export { setDefaultSSR } from '@hugsmidjan/react/hooks';
@@ -0,0 +1 @@
1
+ export declare const isPreact: true | undefined;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export const isPreact =
3
+ // imported from 'preact'
4
+ 'h' in React ||
5
+ // imported from 'preact/compat' (has all of `react-dom` bundled)
6
+ ('hydrate' in React && 'render' in React) ||
7
+ // `undefined` instead of `false` for nicer prop usage
8
+ undefined;
@@ -0,0 +1,27 @@
1
+ import { RefObject } from 'react';
2
+ export declare const DATA_ATTR_NAME = "is-seen";
3
+ export declare const getObserver: {
4
+ (target: Element, callback?: ((target: Element) => void) | undefined): (() => void) | undefined;
5
+ DATA_ATTR_NAME: string;
6
+ };
7
+ declare const effects: {
8
+ readonly fadein: 1;
9
+ readonly fadeup: 1;
10
+ readonly fadeleft: 1;
11
+ };
12
+ export type SeenEffectType = keyof typeof effects;
13
+ export type EffectProp = {
14
+ /** Should the component appear instantly, and not transition-in once seen */
15
+ effectType?: SeenEffectType | 'none';
16
+ };
17
+ /** Asserts that a prop value is a SeenEffectType and returns undefined otherwise */
18
+ export declare const ensureEffectType: (maybeType?: string) => SeenEffectType | undefined;
19
+ export declare const getEffectAttr: (maybeType?: string) => {
20
+ 'data-seen-effect': string | undefined;
21
+ };
22
+ export type SeenProp = {
23
+ /** Should the component appear instantly, and not transition-in once seen */
24
+ startSeen?: boolean;
25
+ };
26
+ export declare const useSeenEffect: <E extends Element = HTMLDivElement>(startSeen?: boolean, customRef?: RefObject<E> | undefined) => [RefObject<E> | undefined, true | undefined];
27
+ export {};
@@ -0,0 +1,75 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ export const DATA_ATTR_NAME = 'is-seen';
3
+ const STACKING_DELAY = 400; // ms
4
+ const dataAttr = 'data-' + DATA_ATTR_NAME;
5
+ const inTargetSourceOrder = (a, b) => a.target.compareDocumentPosition(b.target) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1;
6
+ const options = {
7
+ // root: window
8
+ rootMargin: '-100px 0px 0px 0px',
9
+ threshold: 0, // 0
10
+ };
11
+ let observer;
12
+ export const getObserver = (target, callback) => {
13
+ if (target.hasAttribute(dataAttr)) {
14
+ return;
15
+ }
16
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
17
+ if (!observer) {
18
+ observer = new IntersectionObserver((entries, observer) => entries
19
+ .filter((e) => e.isIntersecting)
20
+ .sort(inTargetSourceOrder)
21
+ .forEach(({ target }, i) => {
22
+ setTimeout(() => {
23
+ target.setAttribute(dataAttr, 'true');
24
+ callback && callback(target);
25
+ observer.unobserve(target);
26
+ }, STACKING_DELAY * i);
27
+ }), options);
28
+ }
29
+ if (target.matches('[' + dataAttr + '] *')) {
30
+ // opt out if target is contained by another "seen-effect" element
31
+ target.setAttribute(dataAttr, '');
32
+ return;
33
+ }
34
+ target.setAttribute(dataAttr, 'false');
35
+ observer.observe(target);
36
+ // return teardown/unmount effect
37
+ return () => observer.unobserve(target);
38
+ };
39
+ getObserver.DATA_ATTR_NAME = DATA_ATTR_NAME;
40
+ // ---------------------------------------------------------------------------
41
+ // ---------------------------------------------------------------------------
42
+ const effects = {
43
+ fadein: 1,
44
+ fadeup: 1,
45
+ fadeleft: 1,
46
+ };
47
+ /** Asserts that a prop value is a SeenEffectType and returns undefined otherwise */
48
+ export const ensureEffectType = (maybeType) => maybeType && maybeType in effects ? maybeType : undefined;
49
+ export const getEffectAttr = (maybeType) => ({
50
+ 'data-seen-effect': maybeType === 'none' ? undefined : ensureEffectType(maybeType) || '',
51
+ });
52
+ export const useSeenEffect = (
53
+ /** Should the component appear instantly, and not transition-in once seen */
54
+ startSeen,
55
+ /** Bring Your Own RefObject */
56
+ customRef) => {
57
+ const _startSeen = startSeen || undefined; // normalize
58
+ const [isSeen, setSeen] = useState(_startSeen);
59
+ const localRef = useRef(null);
60
+ const ref = customRef || localRef;
61
+ useEffect(() => {
62
+ setSeen(_startSeen);
63
+ const refElm = ref.current;
64
+ if (refElm) {
65
+ if (_startSeen) {
66
+ refElm.setAttribute(dataAttr, '');
67
+ }
68
+ else {
69
+ refElm.removeAttribute(dataAttr);
70
+ return getObserver(refElm, () => setSeen(true));
71
+ }
72
+ }
73
+ }, [_startSeen, ref]);
74
+ return [ref, isSeen];
75
+ };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Reports if value changed since last time the hook was called.
3
+ *
4
+ * Returns an `{ lastValue }` shaped object, when change is detected.
5
+ * Returns `undefined` otherwise
6
+ *
7
+ * Common usage is if you want an component which is effectively uncontrolled,
8
+ * but resets/changes its internal state whenever a certain prop value changes.
9
+ *
10
+ * ```tsx
11
+ * import { useDidChange } from './utils.js';
12
+ * // import { useDidChange } from '@reykjavik/hanna-react/utils';
13
+ *
14
+ * // inside your component/hook
15
+ * const [visible, setVisible] = useState(props.visible);
16
+ * if (useDidChange(props.visible)) {
17
+ * setVisible(props.visible);
18
+ * }
19
+ * ```
20
+ *
21
+ * Another use case might be to capture not only IF but HOW a prop value changed
22
+ * in a controlled component
23
+ *
24
+ * ```tsx
25
+ * const [trend, setTrend] = useState(null);
26
+ * const countChanged = useDidChange(props.count);
27
+ * if (countChanged) {
28
+ * setTrend(props.count > countChanged.lastValue ? 'increasing' : 'decreasing');
29
+ * }
30
+ * ```
31
+ *
32
+ * **NOTE:** This hook should be handled with care, as its overuse can easily lead
33
+ * to poorly structured and buggy component behavior.
34
+ */
35
+ export declare const useDidChange: <T>(value: T) => {
36
+ lastValue: T;
37
+ } | undefined;
@@ -0,0 +1,43 @@
1
+ import { useRef } from 'react';
2
+ /**
3
+ * Reports if value changed since last time the hook was called.
4
+ *
5
+ * Returns an `{ lastValue }` shaped object, when change is detected.
6
+ * Returns `undefined` otherwise
7
+ *
8
+ * Common usage is if you want an component which is effectively uncontrolled,
9
+ * but resets/changes its internal state whenever a certain prop value changes.
10
+ *
11
+ * ```tsx
12
+ * import { useDidChange } from './utils.js';
13
+ * // import { useDidChange } from '@reykjavik/hanna-react/utils';
14
+ *
15
+ * // inside your component/hook
16
+ * const [visible, setVisible] = useState(props.visible);
17
+ * if (useDidChange(props.visible)) {
18
+ * setVisible(props.visible);
19
+ * }
20
+ * ```
21
+ *
22
+ * Another use case might be to capture not only IF but HOW a prop value changed
23
+ * in a controlled component
24
+ *
25
+ * ```tsx
26
+ * const [trend, setTrend] = useState(null);
27
+ * const countChanged = useDidChange(props.count);
28
+ * if (countChanged) {
29
+ * setTrend(props.count > countChanged.lastValue ? 'increasing' : 'decreasing');
30
+ * }
31
+ * ```
32
+ *
33
+ * **NOTE:** This hook should be handled with care, as its overuse can easily lead
34
+ * to poorly structured and buggy component behavior.
35
+ */
36
+ export const useDidChange = (value) => {
37
+ const lastValueRef = useRef(value);
38
+ const lastValue = lastValueRef.current;
39
+ if (value !== lastValue) {
40
+ lastValueRef.current = value;
41
+ return { lastValue };
42
+ }
43
+ };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Pass a callback that gets called whenever the browser window
3
+ * resizes past one of the preconfigured "media-format" breakpoints.
4
+ *
5
+ * Exmple use:
6
+ *
7
+ * ```ts
8
+ * useFormatMonitor((media) => {
9
+ * if (media.is === 'phone') {
10
+ * // do something clever because the window
11
+ * // just became "phone" sized.
12
+ * }
13
+ * if (media.was === 'phone') {
14
+ * // do something clever because the window
15
+ * // just stopped being "phone" sized.
16
+ * }
17
+ * })
18
+ * ```
19
+ *
20
+ * The `media` argument has the following properties:
21
+ *
22
+ * ```ts
23
+ * // type Formats = 'phone' | 'phablet' | 'tablet' | 'netbook' | 'wide'
24
+ * media.is //: Format
25
+ * media.was //?: Format
26
+ * // Category/mode boolean flags
27
+ * // (Hamburger refers to the "mobile menu" mode)
28
+ * media.isTopmenu
29
+ * media.isHamburger
30
+ * media.wasTopmenu
31
+ * media.wasHamburger
32
+ * media.becameTopmenu
33
+ * media.becameHamburger
34
+ * media.leftTopmenu
35
+ * media.leftHamburger
36
+ * ```
37
+ */
38
+ export declare const useFormatMonitor: (callback: ((media: import("formatchange").BaseMedia & Record<"isHamburger" | "isTopmenu" | "wasHamburger" | "wasTopmenu" | "becameHamburger" | "becameTopmenu" | "leftHamburger" | "leftTopmenu", boolean>) => void) | undefined) => void;
@@ -0,0 +1,41 @@
1
+ import { getFormatMonitor } from '@reykjavik/hanna-utils';
2
+ import { makeFormatMonitorHook } from 'formatchange/react';
3
+ // ==================================================
4
+ /**
5
+ * Pass a callback that gets called whenever the browser window
6
+ * resizes past one of the preconfigured "media-format" breakpoints.
7
+ *
8
+ * Exmple use:
9
+ *
10
+ * ```ts
11
+ * useFormatMonitor((media) => {
12
+ * if (media.is === 'phone') {
13
+ * // do something clever because the window
14
+ * // just became "phone" sized.
15
+ * }
16
+ * if (media.was === 'phone') {
17
+ * // do something clever because the window
18
+ * // just stopped being "phone" sized.
19
+ * }
20
+ * })
21
+ * ```
22
+ *
23
+ * The `media` argument has the following properties:
24
+ *
25
+ * ```ts
26
+ * // type Formats = 'phone' | 'phablet' | 'tablet' | 'netbook' | 'wide'
27
+ * media.is //: Format
28
+ * media.was //?: Format
29
+ * // Category/mode boolean flags
30
+ * // (Hamburger refers to the "mobile menu" mode)
31
+ * media.isTopmenu
32
+ * media.isHamburger
33
+ * media.wasTopmenu
34
+ * media.wasHamburger
35
+ * media.becameTopmenu
36
+ * media.becameHamburger
37
+ * media.leftTopmenu
38
+ * media.leftHamburger
39
+ * ```
40
+ */
41
+ export const useFormatMonitor = makeFormatMonitorHook(getFormatMonitor);
@@ -0,0 +1,10 @@
1
+ type SVGMeta = {
2
+ imageSrc: string;
3
+ code: string;
4
+ };
5
+ /**
6
+ * Fetches a remote SVG image and returns its XML/source
7
+ * string for inlining, or further processing
8
+ */
9
+ export declare const useGetSVGtext: (imageSrc: string | undefined) => SVGMeta | undefined;
10
+ export {};
@@ -0,0 +1,23 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { getSVGtext } from '@reykjavik/hanna-utils';
3
+ /**
4
+ * Fetches a remote SVG image and returns its XML/source
5
+ * string for inlining, or further processing
6
+ */
7
+ export const useGetSVGtext = (imageSrc) => {
8
+ const [inlineSvg, setInlineSvg] = useState();
9
+ const srcRef = useRef(imageSrc);
10
+ useEffect(() => {
11
+ if (imageSrc) {
12
+ getSVGtext(imageSrc).then((code) => {
13
+ if (imageSrc === srcRef.current) {
14
+ setInlineSvg({ imageSrc, code });
15
+ }
16
+ });
17
+ }
18
+ srcRef.current = imageSrc;
19
+ setInlineSvg(undefined);
20
+ // eslint-disable-next-line react-hooks/exhaustive-deps
21
+ }, [imageSrc]);
22
+ return inlineSvg;
23
+ };
@@ -0,0 +1,8 @@
1
+ type MenuTogglingState = {
2
+ isMenuActive: true | undefined;
3
+ isMenuOpen: boolean;
4
+ toggleMenu: () => void;
5
+ closeMenu: () => void;
6
+ };
7
+ export declare const useMenuToggling: (doInitialize?: boolean) => MenuTogglingState;
8
+ export {};
@@ -0,0 +1,62 @@
1
+ import { useRef, useState } from 'react';
2
+ import { focusElement } from '@reykjavik/hanna-utils';
3
+ import { useFormatMonitor } from './useFormatMonitor.js';
4
+ const htmlClass = (className, add) => {
5
+ document.documentElement.classList[add ? 'add' : 'remove'](className);
6
+ };
7
+ const noop = () => undefined;
8
+ // ---------------------------------------------------------------------------
9
+ export const useMenuToggling = (doInitialize = true) => {
10
+ const [isMenuOpen, setIsMenuOpen] = useState(false);
11
+ const [isMenuActive, setIsMenuActive] = useState();
12
+ const _state = { isMenuOpen, isMenuActive };
13
+ const stateRef = useRef(_state);
14
+ stateRef.current = _state;
15
+ const _openMenu = () => {
16
+ if (!stateRef.current.isMenuOpen) {
17
+ setIsMenuOpen(true);
18
+ htmlClass('menu-is-open', true);
19
+ htmlClass('menu-is-closed', false);
20
+ focusElement('#pagenav');
21
+ }
22
+ };
23
+ const _closeMenu = () => {
24
+ if (stateRef.current.isMenuOpen) {
25
+ setIsMenuOpen(false);
26
+ htmlClass('menu-is-closed', true);
27
+ htmlClass('menu-is-open', false);
28
+ focusElement('.Layout__header__skiplink');
29
+ }
30
+ };
31
+ useFormatMonitor(doInitialize
32
+ ? (media) => {
33
+ if (media.becameHamburger) {
34
+ setIsMenuActive(true);
35
+ htmlClass('menu-is-active', true);
36
+ htmlClass('menu-is-closed', true);
37
+ }
38
+ if (media.leftHamburger) {
39
+ _closeMenu();
40
+ setIsMenuActive(undefined);
41
+ htmlClass('menu-is-active', false);
42
+ htmlClass('menu-is-closed', false);
43
+ }
44
+ }
45
+ : noop);
46
+ const { toggleMenu, closeMenu } = useRef(doInitialize
47
+ ? {
48
+ toggleMenu: () => {
49
+ if (stateRef.current.isMenuActive) {
50
+ stateRef.current.isMenuOpen ? _closeMenu() : _openMenu();
51
+ }
52
+ },
53
+ closeMenu: _closeMenu,
54
+ }
55
+ : { toggleMenu: noop, closeMenu: noop }).current;
56
+ return {
57
+ isMenuActive,
58
+ isMenuOpen,
59
+ toggleMenu,
60
+ closeMenu,
61
+ };
62
+ };
@@ -0,0 +1,137 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ type CtrlMode = 'controlled' | 'uncontrolled' | undefined;
3
+ type RetArray<R> = [value: R, setValue: Dispatch<SetStateAction<R>>, mode: CtrlMode];
4
+ type DefaultProp<N extends string> = `default${Capitalize<N>}`;
5
+ type PropPair<N extends string> = N | DefaultProp<N>;
6
+ type StrictKeys<P extends Record<string, unknown>, N extends string> = PropPair<N> extends keyof P ? P : {
7
+ [Key in PropPair<N>]: P[Key];
8
+ };
9
+ /**
10
+ * State hook to simplify dealing with a the complexities of supporting a mixture
11
+ * of "controlled" and "uncontrolled" component state.
12
+ *
13
+ * The returned value and dispatcher/setter function return the controlled
14
+ * `value`, but gracefully handle changes in defaultValue in uncontrolled mode,
15
+ * and handles (unexpected) "mode-changes" in a predictable manner.
16
+ *
17
+ * It assumes (by default) that the calling component has
18
+ * a pair of props following the naming convention `foo` and `defaultFoo` —
19
+ * similar to React's own `<input/>` and `<select/>` HTML components warn about
20
+ * their `value` and `defaultValue` props being misused.
21
+ *
22
+ * NOTE: This hook also exposes a slightly lower-level helper hook
23
+ * `useMixedControlState.raw(value, defaultValue)`, for cases where you don't
24
+ * have a neatly-shaped props object as described above, or you need to do
25
+ * some sort of pre-processing of either prop value.
26
+ *
27
+ * ```tsx
28
+ * import React, { FC, ReactNode } from 'react';
29
+ * import { useMixedControlState } from '@reykjavik/hanna-react/utils';
30
+ *
31
+ * type FooBarProps = {
32
+ * visible?: boolean;
33
+ * onChange?: (newVisible: boolean) => void;
34
+ * defaultVisible?: boolean;
35
+ * };
36
+ *
37
+ * export const FooBar: FC<FooBarProps> = (props) => {
38
+ * const [visible, setVisible] = useMixedControlState(props, 'visible', true);
39
+ *
40
+ * const handleToggle = () => {
41
+ * props.onChange?.(!visible);
42
+ * setVisible(!visible);
43
+ * };
44
+ * return (
45
+ * <div>
46
+ * <button onClick={handleToggle}>Toggle</button>
47
+ * <div hidden={!visible}>{props.children}</div>
48
+ * </div>
49
+ * );
50
+ * };
51
+ * ```
52
+ */
53
+ export declare function useMixedControlState<N extends string, P extends {
54
+ [x in PropPair<N>]?: unknown;
55
+ }, D extends Exclude<V, undefined>, V = P[DefaultProp<N>] | P[N]>(
56
+ /** The props object of your component */
57
+ props: StrictKeys<P, N>, // StrictKeys give nicer error messages to users.
58
+ /** Name of the prop for the controlled value */
59
+ name: N,
60
+ /**
61
+ * A last-resort default value to use instead of `undefined`. \
62
+ * **NOTE:** All post-factum changes/updates to this value are ignored!
63
+ */
64
+ emptyValue: D): RetArray<Exclude<V, undefined>>;
65
+ export declare function useMixedControlState<N extends string, P extends {
66
+ [x in PropPair<N>]?: unknown;
67
+ }, D extends Exclude<V, undefined>, V = P[DefaultProp<N>] | P[N]>(
68
+ /** The props object of your component */
69
+ props: StrictKeys<P, N>, // StrictKeys give nicer error messages to users.
70
+ /** Name of the prop for the controlled value */
71
+ name: N,
72
+ /**
73
+ * A last-resort default value to use instead of `undefined`. \
74
+ * **NOTE:** All post-factum changes/updates to this value are ignored!
75
+ */
76
+ emptyValue?: D): RetArray<V>;
77
+ export declare namespace useMixedControlState {
78
+ var $warningLogger: ((message: string) => void) | undefined;
79
+ var raw: typeof useRaw;
80
+ }
81
+ /**
82
+ * A slightly lower-level hook alternative to
83
+ * `useMixedControlState(props, name)`, for cases where you don't
84
+ * have a neatly-/conventionally-shaped props object, or if you need to do
85
+ * some sort of pre-processing of either prop value.
86
+ *
87
+ * ```tsx
88
+ * import { useMixedControlState } from '@reykjavik/hanna-react/utils';
89
+ *
90
+ * declare const props: { visible?: boolean; defaultVisible?: boolean };
91
+ *
92
+ * const [vislble, setVisible] = useMixedControlState.raw(
93
+ * props.vislble,
94
+ * props.defaultVisible,
95
+ * 'visible'
96
+ * );
97
+ * // has the same effect as this:
98
+ * const [visible, setVisible] = useMixedControlState(props, 'visible');
99
+ * ```
100
+ */
101
+ declare function useRaw<C, U, D extends Exclude<C | U, undefined>>(
102
+ /** Controlled value. */
103
+ value: C,
104
+ /** Default/initial value for uncontrolled use. */
105
+ defaultValue: U,
106
+ /**
107
+ * Prop name to display more meaningful warnings about when value
108
+ * and defaultValue are both defined, or if the component switches
109
+ * between modes mid-stream.
110
+ *
111
+ * If left undefined, the hook emits more generic/vague warnings
112
+ */
113
+ warningPropName: string | undefined,
114
+ /**
115
+ * A last-resort default value to use instead of `undefined`. \
116
+ * **NOTE:** All post-factum changes/updates to this value are ignored!
117
+ */
118
+ emptyValue: D): RetArray<Exclude<C | U, undefined>>;
119
+ declare function useRaw<C, U, D extends C | U>(
120
+ /** Controlled value. */
121
+ value: C,
122
+ /** Default/initial value for uncontrolled use. */
123
+ defaultValue: U,
124
+ /**
125
+ * Prop name to display more meaningful warnings about when value
126
+ * and defaultValue are both defined, or if the component switches
127
+ * between modes mid-stream.
128
+ *
129
+ * If left undefined, the hook emits more generic/vague warnings
130
+ */
131
+ warningPropName?: string,
132
+ /**
133
+ * A last-resort default value to use instead of `undefined`. \
134
+ * **NOTE:** All post-factum changes/updates to this value are ignored!
135
+ */
136
+ emptyValue?: D): RetArray<C | U>;
137
+ export {};