@reykjavik/hanna-react 0.10.59 → 0.10.60

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 (355) hide show
  1. package/AccordionList.js +3 -28
  2. package/ActionCards.js +2 -4
  3. package/Alert.js +4 -29
  4. package/ArticleCards.js +2 -4
  5. package/ArticleCarousel/_ArticleCarouselCard.js +4 -6
  6. package/ArticleCarousel.js +3 -5
  7. package/ArticleMeta.js +3 -28
  8. package/Attention.js +3 -5
  9. package/BasicTable.js +5 -7
  10. package/BgBox.js +3 -5
  11. package/Bling.js +3 -5
  12. package/BlockBreak.js +2 -4
  13. package/BlockQuote.js +2 -4
  14. package/BreadCrumbs.js +2 -4
  15. package/ButtonBack.js +3 -5
  16. package/ButtonBar.js +3 -5
  17. package/ButtonPrimary.js +3 -5
  18. package/ButtonSecondary.js +3 -5
  19. package/ButtonTertiary.js +3 -5
  20. package/CHANGELOG.md +8 -0
  21. package/Carousel.js +3 -5
  22. package/CarouselStepper.js +3 -5
  23. package/CenterColumn.js +3 -5
  24. package/Checkbox.js +3 -5
  25. package/CheckboxButtonsGroup.js +4 -6
  26. package/CheckboxGroup.js +4 -6
  27. package/CityBlock.js +3 -5
  28. package/ContactBubble.js +4 -29
  29. package/ContentArticle.js +8 -10
  30. package/ContentImage.js +3 -5
  31. package/Datepicker.js +6 -31
  32. package/ExtraLinks.js +4 -17
  33. package/FeatureList.js +3 -5
  34. package/FieldGroup.js +3 -5
  35. package/FileInput.js +5 -41
  36. package/Foonote.js +2 -4
  37. package/FooterBadges.js +2 -4
  38. package/FooterInfo.js +3 -5
  39. package/Footnote.js +2 -4
  40. package/Form.js +3 -5
  41. package/FormField.js +3 -28
  42. package/Gallery/_GalleryItem.js +6 -42
  43. package/Gallery/_GalleryModal.js +6 -31
  44. package/Gallery/_GalleryModalContext.js +2 -4
  45. package/Gallery/_GalleryModalItem.js +4 -17
  46. package/Gallery.js +6 -31
  47. package/GridBlocks.js +5 -7
  48. package/Heading.js +3 -5
  49. package/HeroBlock.js +5 -7
  50. package/IframeBlock.d.ts +5 -1
  51. package/IframeBlock.js +6 -8
  52. package/Illustration.js +3 -5
  53. package/ImageCards.js +4 -17
  54. package/InfoBlock.js +2 -4
  55. package/InfoHero.js +7 -9
  56. package/IslandBlock.js +3 -5
  57. package/IslandPageBlock.js +3 -5
  58. package/LabeledTextBlock.js +4 -6
  59. package/Layout.js +4 -6
  60. package/MainMenu/_Auxiliary.js +2 -4
  61. package/MainMenu/_PrimaryPanel.js +3 -5
  62. package/MainMenu.js +5 -30
  63. package/MiniMetrics.js +4 -6
  64. package/Modal.js +3 -5
  65. package/NameCard.js +5 -7
  66. package/NameCards.js +3 -5
  67. package/NewsHero.js +6 -8
  68. package/PageFilter.js +4 -6
  69. package/PageHeading.js +3 -5
  70. package/Picture.js +4 -6
  71. package/ProcessOverview.js +3 -5
  72. package/PullQuote.js +2 -4
  73. package/RadioButtonsGroup.js +4 -6
  74. package/RadioGroup.js +4 -6
  75. package/RelatedLinks.js +2 -4
  76. package/RowBlock.js +3 -5
  77. package/RowBlockColumn.js +3 -5
  78. package/SearchInput.js +5 -41
  79. package/SearchResults/_SearchResultsItem.js +3 -5
  80. package/SearchResults.js +7 -32
  81. package/SeenEffect.js +3 -16
  82. package/Selectbox.js +6 -42
  83. package/ShareButtons.js +2 -24
  84. package/Sharpie.js +3 -5
  85. package/SiteSearchAutocomplete.js +5 -41
  86. package/SiteSearchCurtain.js +3 -28
  87. package/SiteSearchInput.d.ts +1 -1
  88. package/SiteSearchInput.js +4 -40
  89. package/Skeleton.js +4 -6
  90. package/SubHeading.js +3 -5
  91. package/Tabs.js +3 -28
  92. package/TagPill.js +5 -18
  93. package/TextBlock.js +3 -5
  94. package/TextButton.js +3 -5
  95. package/TextInput.js +5 -41
  96. package/VSpacer.js +3 -5
  97. package/VerticalTabsTOC.js +3 -28
  98. package/WizardLayout.js +3 -5
  99. package/WizardLayoutClose.js +3 -5
  100. package/WizardStepper.js +3 -5
  101. package/_abstract/_AbstractCarousel.js +7 -32
  102. package/_abstract/_Blings.js +3 -5
  103. package/_abstract/_Block.js +5 -7
  104. package/_abstract/_Button.js +4 -17
  105. package/_abstract/_CardList.js +4 -6
  106. package/_abstract/_Image.js +3 -5
  107. package/_abstract/_Link.js +2 -4
  108. package/_abstract/_Quote.js +2 -4
  109. package/_abstract/_TogglerGroup.js +8 -8
  110. package/_abstract/_TogglerGroupField.js +6 -19
  111. package/_abstract/_TogglerInput.js +4 -17
  112. package/_abstract/breakOnNL.js +2 -4
  113. package/package.json +4 -378
  114. package/utils/env.js +2 -4
  115. package/utils/useScrollbarWidthCSSVar.js +2 -4
  116. package/utils.js +3 -16
  117. package/esm/AccordionList.d.ts +0 -17
  118. package/esm/AccordionList.js +0 -24
  119. package/esm/ActionCards.d.ts +0 -5
  120. package/esm/ActionCards.js +0 -9
  121. package/esm/Alert.d.ts +0 -49
  122. package/esm/Alert.js +0 -92
  123. package/esm/ArticleCards.d.ts +0 -6
  124. package/esm/ArticleCards.js +0 -4
  125. package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +0 -27
  126. package/esm/ArticleCarousel/_ArticleCarouselCard.js +0 -24
  127. package/esm/ArticleCarousel.d.ts +0 -12
  128. package/esm/ArticleCarousel.js +0 -8
  129. package/esm/ArticleMeta.d.ts +0 -10
  130. package/esm/ArticleMeta.js +0 -19
  131. package/esm/Attention.d.ts +0 -7
  132. package/esm/Attention.js +0 -4
  133. package/esm/BasicTable.d.ts +0 -12
  134. package/esm/BasicTable.js +0 -29
  135. package/esm/BgBox.d.ts +0 -8
  136. package/esm/BgBox.js +0 -9
  137. package/esm/Bling.d.ts +0 -81
  138. package/esm/Bling.js +0 -44
  139. package/esm/BlockBreak.d.ts +0 -2
  140. package/esm/BlockBreak.js +0 -6
  141. package/esm/BlockQuote.d.ts +0 -4
  142. package/esm/BlockQuote.js +0 -4
  143. package/esm/BreadCrumbs.d.ts +0 -11
  144. package/esm/BreadCrumbs.js +0 -28
  145. package/esm/ButtonBack.d.ts +0 -7
  146. package/esm/ButtonBack.js +0 -4
  147. package/esm/ButtonBar.d.ts +0 -16
  148. package/esm/ButtonBar.js +0 -14
  149. package/esm/ButtonPrimary.d.ts +0 -7
  150. package/esm/ButtonPrimary.js +0 -4
  151. package/esm/ButtonSecondary.d.ts +0 -7
  152. package/esm/ButtonSecondary.js +0 -4
  153. package/esm/ButtonTertiary.d.ts +0 -12
  154. package/esm/ButtonTertiary.js +0 -15
  155. package/esm/Carousel.d.ts +0 -4
  156. package/esm/Carousel.js +0 -4
  157. package/esm/CarouselStepper.d.ts +0 -4
  158. package/esm/CarouselStepper.js +0 -4
  159. package/esm/CenterColumn.d.ts +0 -7
  160. package/esm/CenterColumn.js +0 -7
  161. package/esm/Checkbox.d.ts +0 -4
  162. package/esm/Checkbox.js +0 -4
  163. package/esm/CheckboxButtonsGroup.d.ts +0 -11
  164. package/esm/CheckboxButtonsGroup.js +0 -14
  165. package/esm/CheckboxGroup.d.ts +0 -9
  166. package/esm/CheckboxGroup.js +0 -7
  167. package/esm/CityBlock.d.ts +0 -23
  168. package/esm/CityBlock.js +0 -18
  169. package/esm/ContactBubble.d.ts +0 -58
  170. package/esm/ContactBubble.js +0 -148
  171. package/esm/ContentArticle.d.ts +0 -15
  172. package/esm/ContentArticle.js +0 -21
  173. package/esm/ContentImage.d.ts +0 -8
  174. package/esm/ContentImage.js +0 -18
  175. package/esm/Datepicker.d.ts +0 -39
  176. package/esm/Datepicker.js +0 -63
  177. package/esm/ExtraLinks.d.ts +0 -18
  178. package/esm/ExtraLinks.js +0 -34
  179. package/esm/FeatureList.d.ts +0 -12
  180. package/esm/FeatureList.js +0 -16
  181. package/esm/FieldGroup.d.ts +0 -9
  182. package/esm/FieldGroup.js +0 -9
  183. package/esm/FileInput.d.ts +0 -17
  184. package/esm/FileInput.js +0 -154
  185. package/esm/Foonote.d.ts +0 -12
  186. package/esm/Foonote.js +0 -7
  187. package/esm/FooterBadges.d.ts +0 -9
  188. package/esm/FooterBadges.js +0 -12
  189. package/esm/FooterInfo.d.ts +0 -18
  190. package/esm/FooterInfo.js +0 -9
  191. package/esm/Footnote.d.ts +0 -6
  192. package/esm/Footnote.js +0 -3
  193. package/esm/Form.d.ts +0 -7
  194. package/esm/Form.js +0 -10
  195. package/esm/FormField.d.ts +0 -65
  196. package/esm/FormField.js +0 -91
  197. package/esm/Gallery/_GalleryItem.d.ts +0 -8
  198. package/esm/Gallery/_GalleryItem.js +0 -30
  199. package/esm/Gallery/_GalleryModal.d.ts +0 -6
  200. package/esm/Gallery/_GalleryModal.js +0 -54
  201. package/esm/Gallery/_GalleryModalContext.d.ts +0 -9
  202. package/esm/Gallery/_GalleryModalContext.js +0 -3
  203. package/esm/Gallery/_GalleryModalItem.d.ts +0 -3
  204. package/esm/Gallery/_GalleryModalItem.js +0 -22
  205. package/esm/Gallery.d.ts +0 -17
  206. package/esm/Gallery.js +0 -27
  207. package/esm/GridBlocks.d.ts +0 -26
  208. package/esm/GridBlocks.js +0 -24
  209. package/esm/Heading.d.ts +0 -16
  210. package/esm/Heading.js +0 -17
  211. package/esm/HeroBlock.d.ts +0 -19
  212. package/esm/HeroBlock.js +0 -21
  213. package/esm/IframeBlock.d.ts +0 -23
  214. package/esm/IframeBlock.js +0 -26
  215. package/esm/Illustration.d.ts +0 -13
  216. package/esm/Illustration.js +0 -8
  217. package/esm/ImageCards.d.ts +0 -8
  218. package/esm/ImageCards.js +0 -22
  219. package/esm/InfoBlock.d.ts +0 -17
  220. package/esm/InfoBlock.js +0 -13
  221. package/esm/InfoHero.d.ts +0 -17
  222. package/esm/InfoHero.js +0 -82
  223. package/esm/IslandBlock.d.ts +0 -25
  224. package/esm/IslandBlock.js +0 -16
  225. package/esm/IslandPageBlock.d.ts +0 -24
  226. package/esm/IslandPageBlock.js +0 -16
  227. package/esm/LabeledTextBlock.d.ts +0 -11
  228. package/esm/LabeledTextBlock.js +0 -14
  229. package/esm/Layout.d.ts +0 -33
  230. package/esm/Layout.js +0 -52
  231. package/esm/MainMenu/_Auxiliary.d.ts +0 -6
  232. package/esm/MainMenu/_Auxiliary.js +0 -13
  233. package/esm/MainMenu/_PrimaryPanel.d.ts +0 -13
  234. package/esm/MainMenu/_PrimaryPanel.js +0 -22
  235. package/esm/MainMenu.d.ts +0 -48
  236. package/esm/MainMenu.js +0 -136
  237. package/esm/MiniMetrics.d.ts +0 -8
  238. package/esm/MiniMetrics.js +0 -12
  239. package/esm/Modal.d.ts +0 -10
  240. package/esm/Modal.js +0 -14
  241. package/esm/NameCard.d.ts +0 -64
  242. package/esm/NameCard.js +0 -82
  243. package/esm/NameCards.d.ts +0 -6
  244. package/esm/NameCards.js +0 -7
  245. package/esm/NewsHero.d.ts +0 -14
  246. package/esm/NewsHero.js +0 -86
  247. package/esm/PageFilter.d.ts +0 -17
  248. package/esm/PageFilter.js +0 -15
  249. package/esm/PageHeading.d.ts +0 -10
  250. package/esm/PageHeading.js +0 -12
  251. package/esm/Picture.d.ts +0 -7
  252. package/esm/Picture.js +0 -8
  253. package/esm/ProcessOverview.d.ts +0 -13
  254. package/esm/ProcessOverview.js +0 -17
  255. package/esm/PullQuote.d.ts +0 -4
  256. package/esm/PullQuote.js +0 -4
  257. package/esm/RadioButtonsGroup.d.ts +0 -11
  258. package/esm/RadioButtonsGroup.js +0 -14
  259. package/esm/RadioGroup.d.ts +0 -13
  260. package/esm/RadioGroup.js +0 -7
  261. package/esm/RelatedLinks.d.ts +0 -20
  262. package/esm/RelatedLinks.js +0 -26
  263. package/esm/RowBlock.d.ts +0 -12
  264. package/esm/RowBlock.js +0 -9
  265. package/esm/RowBlockColumn.d.ts +0 -8
  266. package/esm/RowBlockColumn.js +0 -11
  267. package/esm/SearchInput.d.ts +0 -18
  268. package/esm/SearchInput.js +0 -33
  269. package/esm/SearchResults/_SearchResultsItem.d.ts +0 -18
  270. package/esm/SearchResults/_SearchResultsItem.js +0 -15
  271. package/esm/SearchResults.d.ts +0 -33
  272. package/esm/SearchResults.js +0 -109
  273. package/esm/SeenEffect.d.ts +0 -4
  274. package/esm/SeenEffect.js +0 -19
  275. package/esm/Selectbox.d.ts +0 -8
  276. package/esm/Selectbox.js +0 -46
  277. package/esm/ShareButtons.d.ts +0 -9
  278. package/esm/ShareButtons.js +0 -51
  279. package/esm/Sharpie.d.ts +0 -23
  280. package/esm/Sharpie.js +0 -22
  281. package/esm/SiteSearchAutocomplete.d.ts +0 -40
  282. package/esm/SiteSearchAutocomplete.js +0 -58
  283. package/esm/SiteSearchCurtain.d.ts +0 -6
  284. package/esm/SiteSearchCurtain.js +0 -33
  285. package/esm/SiteSearchInput.d.ts +0 -24
  286. package/esm/SiteSearchInput.js +0 -40
  287. package/esm/Skeleton.d.ts +0 -25
  288. package/esm/Skeleton.js +0 -30
  289. package/esm/SubHeading.d.ts +0 -10
  290. package/esm/SubHeading.js +0 -13
  291. package/esm/Tabs.d.ts +0 -35
  292. package/esm/Tabs.js +0 -94
  293. package/esm/TagPill.d.ts +0 -27
  294. package/esm/TagPill.js +0 -43
  295. package/esm/TextBlock.d.ts +0 -15
  296. package/esm/TextBlock.js +0 -15
  297. package/esm/TextButton.d.ts +0 -9
  298. package/esm/TextButton.js +0 -9
  299. package/esm/TextInput.d.ts +0 -16
  300. package/esm/TextInput.js +0 -35
  301. package/esm/VSpacer.d.ts +0 -24
  302. package/esm/VSpacer.js +0 -41
  303. package/esm/VerticalTabsTOC.d.ts +0 -14
  304. package/esm/VerticalTabsTOC.js +0 -68
  305. package/esm/WizardLayout.d.ts +0 -15
  306. package/esm/WizardLayout.js +0 -30
  307. package/esm/WizardLayoutClose.d.ts +0 -3
  308. package/esm/WizardLayoutClose.js +0 -4
  309. package/esm/WizardStepper.d.ts +0 -36
  310. package/esm/WizardStepper.js +0 -25
  311. package/esm/_abstract/_AbstractCarousel.d.ts +0 -25
  312. package/esm/_abstract/_AbstractCarousel.js +0 -130
  313. package/esm/_abstract/_Blings.d.ts +0 -11
  314. package/esm/_abstract/_Blings.js +0 -12
  315. package/esm/_abstract/_Block.d.ts +0 -22
  316. package/esm/_abstract/_Block.js +0 -24
  317. package/esm/_abstract/_Button.d.ts +0 -40
  318. package/esm/_abstract/_Button.js +0 -47
  319. package/esm/_abstract/_CardList.d.ts +0 -30
  320. package/esm/_abstract/_CardList.js +0 -38
  321. package/esm/_abstract/_Image.d.ts +0 -36
  322. package/esm/_abstract/_Image.js +0 -27
  323. package/esm/_abstract/_Link.d.ts +0 -27
  324. package/esm/_abstract/_Link.js +0 -24
  325. package/esm/_abstract/_Quote.d.ts +0 -9
  326. package/esm/_abstract/_Quote.js +0 -8
  327. package/esm/_abstract/_TogglerGroup.d.ts +0 -31
  328. package/esm/_abstract/_TogglerGroup.js +0 -29
  329. package/esm/_abstract/_TogglerGroupField.d.ts +0 -17
  330. package/esm/_abstract/_TogglerGroupField.js +0 -22
  331. package/esm/_abstract/_TogglerInput.d.ts +0 -22
  332. package/esm/_abstract/_TogglerInput.js +0 -33
  333. package/esm/_abstract/breakOnNL.d.ts +0 -2
  334. package/esm/_abstract/breakOnNL.js +0 -8
  335. package/esm/assets.d.ts +0 -42
  336. package/esm/assets.js +0 -56
  337. package/esm/constants.d.ts +0 -39
  338. package/esm/constants.js +0 -22
  339. package/esm/focus-visible.d.ts +0 -1
  340. package/esm/focus-visible.js +0 -1
  341. package/esm/package.json +0 -1
  342. package/esm/utils/env.d.ts +0 -1
  343. package/esm/utils/env.js +0 -8
  344. package/esm/utils/seenEffect.d.ts +0 -28
  345. package/esm/utils/seenEffect.js +0 -73
  346. package/esm/utils/useFormatMonitor.d.ts +0 -38
  347. package/esm/utils/useFormatMonitor.js +0 -41
  348. package/esm/utils/useGetSVGtext.d.ts +0 -6
  349. package/esm/utils/useGetSVGtext.js +0 -19
  350. package/esm/utils/useMenuToggling.d.ts +0 -8
  351. package/esm/utils/useMenuToggling.js +0 -62
  352. package/esm/utils/useScrollbarWidthCSSVar.d.ts +0 -1
  353. package/esm/utils/useScrollbarWidthCSSVar.js +0 -3
  354. package/esm/utils.d.ts +0 -2
  355. package/esm/utils.js +0 -2
@@ -1,17 +0,0 @@
1
- import { SSRSupport } from '@hugsmidjan/react/hooks';
2
- import { SeenProp } from './utils/seenEffect';
3
- declare type AccordionListItemProps = {
4
- title: string | JSX.Element;
5
- content: string | JSX.Element | undefined;
6
- id?: string;
7
- disabled?: boolean;
8
- };
9
- export declare type AccordionListProps = {
10
- items: Array<AccordionListItemProps>;
11
- ssr?: SSRSupport;
12
- wide?: boolean;
13
- /** Index of those items that should start open */
14
- defaultOpen?: Array<number>;
15
- } & SeenProp;
16
- declare const AccordionList: (props: AccordionListProps) => JSX.Element;
17
- export default AccordionList;
@@ -1,24 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { useDomid, useIsBrowserSide } from '@hugsmidjan/react/hooks';
3
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
- import { useSeenEffect } from './utils/seenEffect';
5
- const AccordionListItem = (props) => {
6
- const { title, content, id, disabled = false, defaultOpen, ssr } = props;
7
- const [open, setOpen] = useState(defaultOpen);
8
- useEffect(() => setOpen(defaultOpen), [defaultOpen]);
9
- const domid = useDomid();
10
- const isBrowser = useIsBrowserSide(ssr);
11
- const itemDisabled = (isBrowser && disabled) || !content;
12
- return (React.createElement("div", { className: getBemClass('AccordionList__item', [itemDisabled && 'disabled']), id: id, "data-start-open": defaultOpen || undefined, "data-sprinkled": isBrowser },
13
- React.createElement("h3", { className: "AccordionList__title" }, isBrowser ? (React.createElement("button", { type: "button", className: "AccordionList__button", "aria-controls": domid, "aria-expanded": open || undefined, onClick: () => {
14
- setOpen(!open);
15
- }, disabled: itemDisabled }, title)) : (title)),
16
- React.createElement("div", { id: isBrowser && domid, className: "AccordionList__content", hidden: isBrowser && (!open || itemDisabled) }, content)));
17
- };
18
- // ---------------------------------------------------------------------------
19
- const AccordionList = (props) => {
20
- const { items, ssr, wide, defaultOpen, startSeen } = props;
21
- const [ref] = useSeenEffect(startSeen);
22
- return (React.createElement("div", { className: getBemClass('AccordionList', [wide && 'wide']), ref: ref }, items.map((item, i) => (React.createElement(AccordionListItem, Object.assign({ key: i }, item, { ssr: ssr, defaultOpen: defaultOpen && defaultOpen.includes(i) }))))));
23
- };
24
- export default AccordionList;
@@ -1,5 +0,0 @@
1
- import { TextCardListProps } from './_abstract/_CardList';
2
- import { SeenProp } from './utils/seenEffect';
3
- export declare type ActionCardsProps = TextCardListProps & SeenProp;
4
- declare const ActionCards: (props: ActionCardsProps) => JSX.Element;
5
- export default ActionCards;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { CardList } from './_abstract/_CardList';
3
- import { useSeenEffect } from './utils/seenEffect';
4
- const ActionCards = (props) => {
5
- const [ref] = useSeenEffect(props.startSeen);
6
- return (React.createElement("div", { className: "ActionCards", ref: ref },
7
- React.createElement(CardList, Object.assign({}, props, { bemPrefix: "ActionCards" }))));
8
- };
9
- export default ActionCards;
package/esm/Alert.d.ts DELETED
@@ -1,49 +0,0 @@
1
- import { MouseEvent, ReactNode } from 'react';
2
- import { SSRSupport } from '@hugsmidjan/react/hooks';
3
- import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
4
- export declare type AlertI18n = {
5
- closeLabel: string;
6
- closeLabelLong?: string;
7
- };
8
- export declare const defaultAlertTexts: DefaultTexts<AlertI18n>;
9
- export declare const alertTypes: {
10
- info: number;
11
- success: number;
12
- warning: number;
13
- error: number;
14
- critical: number;
15
- };
16
- declare type AlertType = keyof typeof alertTypes;
17
- export declare type AlertProps = {
18
- type: AlertType;
19
- closable?: boolean;
20
- children?: ReactNode;
21
- childrenHTML?: string;
22
- /** server-side anchor href */
23
- closeUrl?: string;
24
- texts?: AlertI18n;
25
- lang?: string;
26
- ssr?: SSRSupport;
27
- } & ({
28
- /** Seconds until the Alert auto-closes.
29
- *
30
- * Mosueover and keyboard focus resets the timer.
31
- */
32
- autoClose: number;
33
- /** Return `false` to prevent the alert from closing. */
34
- onClose?: () => void | boolean;
35
- /** Callback that fires when the alert has closed/transitoned out */
36
- onClosed: () => void;
37
- } | {
38
- autoClose?: never;
39
- /**
40
- * @deprecated This signature with the `event` argument will be removed in hanna-react v0.9
41
- *
42
- * Return `false` to prevent the alert from closing
43
- */
44
- onClose?(event: MouseEvent): void | boolean;
45
- /** Callback that fires after the alert has closed/transitoned out */
46
- onClosed?(): void;
47
- });
48
- declare const Alert: (props: AlertProps) => JSX.Element;
49
- export default Alert;
package/esm/Alert.js DELETED
@@ -1,92 +0,0 @@
1
- import React, { useCallback, useEffect, useRef, useState, } from 'react';
2
- import { useIsBrowserSide, useOnMount } from '@hugsmidjan/react/hooks';
3
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
4
- import { getTexts } from '@reykjavik/hanna-utils/i18n';
5
- import Button from './_abstract/_Button';
6
- import { isPreact } from './utils/env';
7
- // FIXME: Eventually import from @reykjavik/hanna-styles/constants
8
- const AlertCloseTransitionDuration = 400;
9
- const useAutoClosing = (autoClose) => {
10
- const [temp, setTemp] = useState(0);
11
- if (!autoClose) {
12
- return { autoClosing: false };
13
- }
14
- const thaw = () => setTemp((temp) => temp + 1);
15
- const freeze = () => setTemp((temp) => temp - 1);
16
- return {
17
- autoClosing: temp === 0,
18
- autoClosingProps: Object.assign({ onMouseEnter: freeze, onMouseLeave: thaw, onFocus: freeze, onBlur: thaw }, (isPreact
19
- ? {
20
- onfocusin: (e) => e.currentTarget !== e.target && freeze(),
21
- onfocusout: (e) => e.currentTarget !== e.target && thaw(),
22
- }
23
- : undefined)),
24
- };
25
- };
26
- export const defaultAlertTexts = {
27
- en: { closeLabel: 'Hide' },
28
- is: { closeLabel: 'Fela' },
29
- };
30
- export const alertTypes = {
31
- info: 1,
32
- success: 1,
33
- warning: 1,
34
- error: 1,
35
- critical: 1,
36
- };
37
- const Alert = (props) => {
38
- const { type, childrenHTML, children, onClose, closeUrl, closable = !!(onClose || closeUrl != null), ssr, onClosed, } = props;
39
- const autoClose = props.autoClose && props.autoClose > 0 ? props.autoClose : 0;
40
- const closing = useRef();
41
- const [open, setOpen] = useState(!!ssr);
42
- const isBrowser = useIsBrowserSide(ssr);
43
- const showCloseButton = closable && (isBrowser || closeUrl != null);
44
- const { closeLabel, closeLabelLong } = getTexts(props, defaultAlertTexts);
45
- useOnMount(() => {
46
- setOpen(true);
47
- });
48
- const closeAlert = useCallback((event) => {
49
- const ret = onClose &&
50
- // @ts-expect-error (@deprecated `event` parameter will be removed in v0.9)
51
- onClose(event);
52
- if (ret !== false) {
53
- setOpen(false);
54
- if (closing.current) {
55
- clearTimeout(closing.current);
56
- closing.current = undefined;
57
- }
58
- closing.current = setTimeout(() => {
59
- onClosed && onClosed();
60
- }, AlertCloseTransitionDuration);
61
- }
62
- }, [onClose, onClosed]);
63
- const { autoClosing, autoClosingProps } = useAutoClosing(autoClose);
64
- useEffect(() => {
65
- if (autoClosing) {
66
- let autoCloseTimeout;
67
- autoCloseTimeout = setTimeout(() => {
68
- closeAlert();
69
- }, autoClose * 1000);
70
- return () => {
71
- if (autoCloseTimeout) {
72
- clearTimeout(autoCloseTimeout);
73
- autoCloseTimeout = undefined;
74
- }
75
- if (closing.current) {
76
- clearTimeout(closing.current);
77
- closing.current = undefined;
78
- }
79
- };
80
- }
81
- }, [closeAlert, autoClosing, autoClose]);
82
- return (React.createElement("div", Object.assign({ className: getBemClass('Alert', [
83
- !!alertTypes[type] && type,
84
- closable && 'closable',
85
- ]), role: "alert", hidden: !open || undefined }, autoClosingProps),
86
- childrenHTML ? (React.createElement("div", { dangerouslySetInnerHTML: { __html: childrenHTML } })) : (children),
87
- ' ',
88
- showCloseButton && (React.createElement(Button, Object.assign({ bem: "Alert__close" }, (closeUrl != null ? { href: closeUrl } : { type: 'button' }), { onClick: (e) => {
89
- closeAlert(e);
90
- }, "aria-label": closeLabelLong, title: closeLabelLong || closeLabel }), closeLabel))));
91
- };
92
- export default Alert;
@@ -1,6 +0,0 @@
1
- import type { Resolve } from '@reykjavik/hanna-utils';
2
- import { ImageCardListProps, ImageCardProps } from './_abstract/_CardList';
3
- export declare type ArticleCardProps = ImageCardProps;
4
- export declare type ArticleCardsProps = Resolve<Pick<ImageCardListProps, 'cards' | 'imgPlaceholder'>>;
5
- declare const ArticleCards: (props: ArticleCardsProps) => JSX.Element;
6
- export default ArticleCards;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { CardList } from './_abstract/_CardList';
3
- const ArticleCards = (props) => (React.createElement(CardList, { bemPrefix: "ArticleCards", standalone: true, cards: props.cards, imgPlaceholder: props.imgPlaceholder || true }));
4
- export default ArticleCards;
@@ -1,27 +0,0 @@
1
- import { HannaColorTheme } from '@reykjavik/hanna-css';
2
- import { Illustration } from '@reykjavik/hanna-utils/assets';
3
- import { ImageProps } from '../_abstract/_Image';
4
- import { ColorFamily } from '../constants';
5
- export declare type ArticleCarouselImageProps = ImageProps & {
6
- photo?: boolean;
7
- };
8
- export declare type ArticleCarouselCardProps = {
9
- date?: string;
10
- title: string;
11
- summary: string;
12
- href: string;
13
- color?: ColorFamily;
14
- /** NOTE: if both `color` and `theme` are specified
15
- * then `color` takes precedence.
16
- */
17
- theme?: HannaColorTheme;
18
- } & ({
19
- illustration: Illustration;
20
- image?: undefined;
21
- } | {
22
- illustration?: undefined;
23
- image: ArticleCarouselImageProps | undefined;
24
- });
25
- export declare const ArticleCarouselCard: (props: ArticleCarouselCardProps & {
26
- moreLabel?: string;
27
- }) => JSX.Element;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';
4
- import Image from '../_abstract/_Image';
5
- import { Link } from '../_abstract/_Link';
6
- import { colorFamilies, themeOptions } from '../constants';
7
- export const ArticleCarouselCard = (props) => {
8
- const { date, title, summary, href, moreLabel, color, theme, illustration, image } = props;
9
- const photo = image === null || image === void 0 ? void 0 : image.photo;
10
- const imageProps = illustration ? { src: getIllustrationUrl(illustration) } : image;
11
- return (React.createElement("div", { className: "ArticleCarouselCard", "data-color": color && colorFamilies[color], "data-color-theme": !color ? theme && themeOptions[theme] : undefined },
12
- React.createElement(Link, { className: "ArticleCarouselCard__link", href: href },
13
- ' ',
14
- React.createElement(Image, Object.assign({ placeholder: true, className: getBemClass('ArticleCarouselCard__illustration', photo && 'photo') }, imageProps)),
15
- React.createElement("h3", { className: "ArticleCarouselCard__title" }, title),
16
- ' '),
17
- ' ',
18
- date && React.createElement("span", { className: "ArticleCarouselCard__date" }, date),
19
- React.createElement("div", { className: "ArticleCarouselCard__summary" }, summary),
20
- moreLabel && (React.createElement(Link, { className: "ArticleCarouselCard__morelink", href: href, "aria-label": title },
21
- ' ',
22
- moreLabel,
23
- ' '))));
24
- };
@@ -1,12 +0,0 @@
1
- import { SSRSupport } from '@hugsmidjan/react/hooks';
2
- import { ArticleCarouselCardProps, ArticleCarouselImageProps } from './ArticleCarousel/_ArticleCarouselCard';
3
- import { SeenProp } from './utils/seenEffect';
4
- export declare type ArticleCarouselProps = {
5
- items: Array<ArticleCarouselCardProps>;
6
- title?: string;
7
- moreLabel?: string;
8
- ssr?: SSRSupport;
9
- } & SeenProp;
10
- export type { ArticleCarouselCardProps, ArticleCarouselImageProps };
11
- declare const ArticleCarousel: (props: ArticleCarouselProps) => JSX.Element;
12
- export default ArticleCarousel;
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import AbstractCarousel from './_abstract/_AbstractCarousel';
3
- import { ArticleCarouselCard, } from './ArticleCarousel/_ArticleCarouselCard';
4
- const ArticleCarousel = (props) => {
5
- const { title, items, moreLabel, ssr, startSeen } = props;
6
- return (React.createElement(AbstractCarousel, { bem: "ArticleCarousel", title: title, items: items, Component: ArticleCarouselCard, ComponentProps: { moreLabel }, ssr: ssr, startSeen: startSeen }));
7
- };
8
- export default ArticleCarousel;
@@ -1,10 +0,0 @@
1
- export declare type ArticleMetaItem = {
2
- label: string;
3
- href?: string;
4
- };
5
- export declare type ArticleMetaProps = {
6
- items: Array<ArticleMetaItem>;
7
- small?: boolean;
8
- };
9
- declare const ArticleMeta: (props: ArticleMetaProps) => JSX.Element | null;
10
- export default ArticleMeta;
@@ -1,19 +0,0 @@
1
- import React, { Fragment } from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { Link } from './_abstract/_Link';
4
- const ArticleMeta = (props) => {
5
- const { items, small } = props;
6
- if (items.length === 0) {
7
- return null;
8
- }
9
- return (React.createElement("div", { className: getBemClass('ArticleMeta', small && 'small') }, items.map(({ label, href }, i) => (React.createElement(Fragment, { key: i },
10
- href == null ? (React.createElement("span", { className: "ArticleMeta__item" },
11
- " ",
12
- label,
13
- " ")) : (React.createElement(Link, { className: "ArticleMeta__item", href: href },
14
- ' ',
15
- label,
16
- ' ')),
17
- ' ')))));
18
- };
19
- export default ArticleMeta;
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare type AttentionProps = {
3
- small?: boolean;
4
- children: ReactNode;
5
- };
6
- declare const Attention: (props: AttentionProps) => JSX.Element;
7
- export default Attention;
package/esm/Attention.js DELETED
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- const Attention = (props) => (React.createElement("div", { className: getBemClass('Attention', props.small && 'small') }, props.children));
4
- export default Attention;
@@ -1,12 +0,0 @@
1
- import { TableProps } from '@hugsmidjan/react/Table';
2
- import { SeenProp } from './utils/seenEffect';
3
- declare type BasicTableProps = {
4
- compact?: boolean;
5
- type?: 'text' | 'number';
6
- children?: undefined;
7
- modifier?: string;
8
- fullWidth?: boolean;
9
- align?: 'right';
10
- } & SeenProp & Omit<TableProps, 'className' | 'children'>;
11
- declare const BasicTable: (props: BasicTableProps) => JSX.Element;
12
- export default BasicTable;
package/esm/BasicTable.js DELETED
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import Table from '@hugsmidjan/react/Table';
3
- import TableWrapper from '@hugsmidjan/react/TableWrapper';
4
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
5
- import { useSeenEffect } from './utils/seenEffect';
6
- const BasicTable = (props) => {
7
- const { cols, caption, thead, tfoot, align, fullWidth, startSeen } = props;
8
- const tbodyProps = props.tbodies
9
- ? { tbodies: props.tbodies }
10
- : { tbody: props.tbody || [] };
11
- const modifier = props.modifier;
12
- const [ref] = useSeenEffect(startSeen);
13
- return (React.createElement(TableWrapper, { modifier: [
14
- 'BasicTable',
15
- modifier && 'BasicTable--' + modifier,
16
- fullWidth && 'BasicTable--fullwidth',
17
- align === 'right' && !fullWidth && 'BasicTable--align--' + align,
18
- ], wrapperRef: ref },
19
- React.createElement(Table, Object.assign({ className: getBemClass('BasicTable', [
20
- props.compact && 'compact',
21
- modifier && modifier,
22
- ]) }, {
23
- cols,
24
- caption,
25
- thead,
26
- tfoot,
27
- }, tbodyProps))));
28
- };
29
- export default BasicTable;
package/esm/BgBox.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { EffectProp, SeenProp } from './utils/seenEffect';
3
- export declare type BgBoxProps = {
4
- className?: string;
5
- children: ReactNode;
6
- } & SeenProp & EffectProp;
7
- declare const BgBox: (props: BgBoxProps) => JSX.Element;
8
- export default BgBox;
package/esm/BgBox.js DELETED
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { getEffectAttr, useSeenEffect } from './utils/seenEffect';
4
- const BgBox = (props) => {
5
- const { className, children, effectType, startSeen } = props;
6
- const [ref] = useSeenEffect(startSeen);
7
- return (React.createElement("div", Object.assign({ className: getBemClass('BgBox', undefined, className), ref: ref }, getEffectAttr(effectType)), children));
8
- };
9
- export default BgBox;
package/esm/Bling.d.ts DELETED
@@ -1,81 +0,0 @@
1
- import { BlingType } from '@reykjavik/hanna-utils/assets';
2
- declare const colors: {
3
- tertiary: boolean;
4
- secondary: boolean;
5
- primary: boolean;
6
- };
7
- export declare type BlingColor = keyof typeof colors;
8
- declare const aligns: {
9
- left: boolean;
10
- 'left-ish': boolean;
11
- 'left-center': boolean;
12
- 'right-center': boolean;
13
- 'right-ish': boolean;
14
- right: boolean;
15
- };
16
- export declare type BlingAlignment = keyof typeof aligns;
17
- declare const valigns: {
18
- up: boolean;
19
- 'up-ish': boolean;
20
- center: boolean;
21
- 'down-ish': boolean;
22
- down: boolean;
23
- };
24
- export declare type BlingVAlignment = keyof typeof valigns;
25
- declare const parentOffset: {
26
- top: boolean;
27
- 'top-ish': boolean;
28
- center: boolean;
29
- 'bottom-ish': boolean;
30
- bottom: boolean;
31
- };
32
- export declare type BlingParentOffset = keyof typeof parentOffset;
33
- export declare type BlingProps = {
34
- /**
35
- * Horizontal alignment relative to the bling container's
36
- * full width
37
- *
38
- * NOTE: Blings should always be placed in a layout context
39
- * where they can stretch to a full (12 columns) width
40
- */
41
- align?: BlingAlignment;
42
- /**
43
- * Vertical shift along the vertical insertion point
44
- *
45
- * Defult: `center`
46
- */
47
- vertical?: BlingVAlignment;
48
- /**
49
- * Vertical positioning of the insertion point within
50
- * the Bling's offset parent element.
51
- *
52
- * Default is the natural layout flow position of the
53
- * Bling element (no vertical re-positioning)
54
- */
55
- parent?: BlingParentOffset;
56
- /**
57
- * Theme color (combo) for the elelment
58
- *
59
- * Default: `tertiary`
60
- */
61
- color?: BlingColor;
62
- /**
63
- * Gives the Bling a positive `z-index` value.
64
- *
65
- * By default Blings layer themselves *underneath* other page content.
66
- */
67
- overlay?: boolean;
68
- /** Additional className (use sparingly) */
69
- className?: string;
70
- } & ({
71
- /** The name of the Bling shape to display */
72
- type: BlingType;
73
- /** Not allowed when `type` is set */
74
- blingUrl?: undefined;
75
- } | {
76
- type?: undefined;
77
- /** Custom SVG URL to load (use sparingly) */
78
- blingUrl: string;
79
- });
80
- declare const Bling: (props: BlingProps) => JSX.Element;
81
- export default Bling;
package/esm/Bling.js DELETED
@@ -1,44 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { getBlingUrl } from '@reykjavik/hanna-utils/assets';
4
- import { useGetSVGtext } from './utils/useGetSVGtext';
5
- const colors = {
6
- tertiary: true,
7
- secondary: true,
8
- primary: true,
9
- };
10
- const aligns = {
11
- left: true,
12
- 'left-ish': true,
13
- 'left-center': true,
14
- 'right-center': true,
15
- 'right-ish': true,
16
- right: true,
17
- };
18
- const valigns = {
19
- up: true,
20
- 'up-ish': true,
21
- center: true,
22
- 'down-ish': true,
23
- down: true,
24
- };
25
- const parentOffset = {
26
- top: true,
27
- 'top-ish': true,
28
- center: true,
29
- 'bottom-ish': true,
30
- bottom: true,
31
- };
32
- const Bling = (props) => {
33
- const { align, vertical, color, overlay, type, blingUrl, parent, className } = props;
34
- const imageUrl = type ? getBlingUrl(type) : blingUrl;
35
- const inlineSvg = useGetSVGtext(imageUrl);
36
- return (React.createElement("div", { className: getBemClass('Bling', [
37
- 'align--' + (align && align in aligns ? align : 'left'),
38
- vertical && vertical in valigns && 'vertical--' + vertical,
39
- color && color in colors && 'color--' + color,
40
- parent && parent in parentOffset && 'parent--' + parent,
41
- overlay && 'overlay',
42
- ], className), "data-bling-type": type, "data-bling-image": !type ? blingUrl : undefined, dangerouslySetInnerHTML: inlineSvg && { __html: inlineSvg.code } }));
43
- };
44
- export default Bling;
@@ -1,2 +0,0 @@
1
- declare const BlockBreak: () => JSX.Element;
2
- export default BlockBreak;
package/esm/BlockBreak.js DELETED
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- /*
3
- TODO: Add story
4
- */
5
- const BlockBreak = () => React.createElement("div", { className: "BlockBreak" });
6
- export default BlockBreak;
@@ -1,4 +0,0 @@
1
- import { QuoteProps } from './_abstract/_Quote';
2
- export declare type BlockQuoteProps = QuoteProps;
3
- declare const BlockQuote: (props: BlockQuoteProps) => JSX.Element;
4
- export default BlockQuote;
package/esm/BlockQuote.js DELETED
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { _Quote } from './_abstract/_Quote';
3
- const BlockQuote = (props) => React.createElement(_Quote, Object.assign({ bem: "BlockQuote" }, props));
4
- export default BlockQuote;
@@ -1,11 +0,0 @@
1
- export declare type BreadCrumb = {
2
- href?: string;
3
- label: string;
4
- };
5
- export declare type BreadCrumbTrail = Array<BreadCrumb>;
6
- export declare type BreadCrumbsProps = {
7
- title: string;
8
- trail: BreadCrumbTrail;
9
- };
10
- declare const BreadCrumbs: (props: BreadCrumbsProps) => JSX.Element | null;
11
- export default BreadCrumbs;
@@ -1,28 +0,0 @@
1
- import React from 'react';
2
- import { Link } from './_abstract/_Link';
3
- const BreadCrumbs__item = (props) => {
4
- const { link, current } = props;
5
- return link.href != null ? (React.createElement(Link, { className: "BreadCrumbs__item", href: link.href, "aria-current": current || undefined }, link.label)) : (React.createElement("span", { className: "BreadCrumbs__item", "aria-current": current || undefined }, link.label));
6
- };
7
- const BreadCrumbs = (props) => {
8
- const { title, trail } = props;
9
- if (trail.length === 0) {
10
- return null;
11
- }
12
- const ancestors = trail.slice(0, -1);
13
- const current = trail[trail.length - 1];
14
- return (React.createElement("nav", { className: "BreadCrumbs", "aria-label": title },
15
- React.createElement("span", { className: "BreadCrumbs__title" },
16
- title,
17
- ":"),
18
- ' ',
19
- ancestors.map((link, i) => {
20
- return (React.createElement(React.Fragment, { key: i },
21
- React.createElement(BreadCrumbs__item, { link: link }),
22
- ' ',
23
- React.createElement("span", { className: "BreadCrumbs__separator", "aria-label": "" }, ">"),
24
- ' '));
25
- }),
26
- React.createElement(BreadCrumbs__item, { link: current, current: true })));
27
- };
28
- export default BreadCrumbs;
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { ButtonProps } from './_abstract/_Button';
3
- export declare type ButtonBackProps = ButtonProps;
4
- declare const ButtonBack: (props: ButtonBackProps & {
5
- children?: ReactNode;
6
- }) => JSX.Element;
7
- export default ButtonBack;
package/esm/ButtonBack.js DELETED
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import Button from './_abstract/_Button';
3
- const ButtonBack = (props) => (React.createElement(Button, Object.assign({ bem: "ButtonBack" }, props)));
4
- export default ButtonBack;
@@ -1,16 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare type ButtonBarProps = {
3
- align?: 'right';
4
- children: ReactNode;
5
- };
6
- export declare const ButtonBar: {
7
- (props: ButtonBarProps): JSX.Element;
8
- Split(): JSX.Element;
9
- };
10
- /**
11
- * @deprecated Prefer using `ButtonBar.Split` instead.
12
- *
13
- * (This export token is only to aid discovery.)
14
- */
15
- export declare const ButtonBar__split: () => JSX.Element;
16
- export default ButtonBar;
package/esm/ButtonBar.js DELETED
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- export const ButtonBar = (props) => {
4
- const { align, children } = props;
5
- return (React.createElement("div", { className: getBemClass('ButtonBar', align === 'right' && 'align--right') }, children));
6
- };
7
- ButtonBar.Split = () => React.createElement("span", { className: "ButtonBar__split" });
8
- /**
9
- * @deprecated Prefer using `ButtonBar.Split` instead.
10
- *
11
- * (This export token is only to aid discovery.)
12
- */
13
- export const ButtonBar__split = ButtonBar.Split;
14
- export default ButtonBar;