@reykjavik/hanna-react 0.10.59 → 0.10.62

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 (359) hide show
  1. package/AccordionList.js +3 -28
  2. package/ActionCards.js +2 -4
  3. package/Alert.js +7 -32
  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 +24 -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.d.ts +16 -1
  36. package/FileInput.js +24 -61
  37. package/Foonote.js +2 -4
  38. package/FooterBadges.js +2 -4
  39. package/FooterInfo.js +3 -5
  40. package/Footnote.js +2 -4
  41. package/Form.js +3 -5
  42. package/FormField.js +3 -28
  43. package/Gallery/_GalleryItem.js +6 -42
  44. package/Gallery/_GalleryModal.js +6 -31
  45. package/Gallery/_GalleryModalContext.js +2 -4
  46. package/Gallery/_GalleryModalItem.js +4 -17
  47. package/Gallery.js +6 -31
  48. package/GridBlocks.js +5 -7
  49. package/Heading.js +3 -5
  50. package/HeroBlock.js +5 -7
  51. package/IframeBlock.d.ts +5 -1
  52. package/IframeBlock.js +6 -8
  53. package/Illustration.js +3 -5
  54. package/ImageCards.js +4 -17
  55. package/InfoBlock.js +2 -4
  56. package/InfoHero.js +7 -9
  57. package/IslandBlock.js +3 -5
  58. package/IslandPageBlock.js +3 -5
  59. package/LabeledTextBlock.js +4 -6
  60. package/Layout.js +4 -6
  61. package/MainMenu/_Auxiliary.js +2 -4
  62. package/MainMenu/_PrimaryPanel.js +3 -5
  63. package/MainMenu.js +5 -30
  64. package/MiniMetrics.js +4 -6
  65. package/Modal.js +3 -5
  66. package/NameCard.js +5 -7
  67. package/NameCards.js +3 -5
  68. package/NewsHero.js +6 -8
  69. package/PageFilter.js +4 -6
  70. package/PageHeading.js +3 -5
  71. package/Picture.js +4 -6
  72. package/ProcessOverview.js +3 -5
  73. package/PullQuote.js +2 -4
  74. package/RadioButtonsGroup.js +4 -6
  75. package/RadioGroup.js +4 -6
  76. package/RelatedLinks.js +2 -4
  77. package/RowBlock.js +3 -5
  78. package/RowBlockColumn.js +3 -5
  79. package/SearchInput.js +5 -41
  80. package/SearchResults/_SearchResultsItem.js +3 -5
  81. package/SearchResults.js +7 -32
  82. package/SeenEffect.js +3 -16
  83. package/Selectbox.js +6 -42
  84. package/ShareButtons.js +2 -24
  85. package/Sharpie.js +3 -5
  86. package/SiteSearchAutocomplete.js +5 -41
  87. package/SiteSearchCurtain.js +3 -28
  88. package/SiteSearchInput.d.ts +1 -1
  89. package/SiteSearchInput.js +4 -40
  90. package/Skeleton.js +4 -6
  91. package/SubHeading.js +3 -5
  92. package/Tabs.js +3 -28
  93. package/TagPill.js +5 -18
  94. package/TextBlock.js +3 -5
  95. package/TextButton.js +3 -5
  96. package/TextInput.js +5 -41
  97. package/VSpacer.js +3 -5
  98. package/VerticalTabsTOC.js +3 -28
  99. package/WizardLayout.js +3 -5
  100. package/WizardLayoutClose.js +3 -5
  101. package/WizardStepper.js +3 -5
  102. package/_abstract/_AbstractCarousel.js +45 -95
  103. package/_abstract/_Blings.js +3 -5
  104. package/_abstract/_Block.js +5 -7
  105. package/_abstract/_Button.js +4 -17
  106. package/_abstract/_CardList.js +4 -6
  107. package/_abstract/_Image.js +3 -5
  108. package/_abstract/_Link.js +2 -4
  109. package/_abstract/_Quote.js +2 -4
  110. package/_abstract/_TogglerGroup.js +8 -8
  111. package/_abstract/_TogglerGroupField.js +6 -19
  112. package/_abstract/_TogglerInput.js +4 -17
  113. package/_abstract/breakOnNL.js +2 -4
  114. package/assets.d.ts +1 -1
  115. package/package.json +4 -378
  116. package/utils/env.js +2 -4
  117. package/utils/seenEffect.d.ts +3 -4
  118. package/utils/seenEffect.js +20 -19
  119. package/utils/useScrollbarWidthCSSVar.js +2 -4
  120. package/utils.js +3 -16
  121. package/esm/AccordionList.d.ts +0 -17
  122. package/esm/AccordionList.js +0 -24
  123. package/esm/ActionCards.d.ts +0 -5
  124. package/esm/ActionCards.js +0 -9
  125. package/esm/Alert.d.ts +0 -49
  126. package/esm/Alert.js +0 -92
  127. package/esm/ArticleCards.d.ts +0 -6
  128. package/esm/ArticleCards.js +0 -4
  129. package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +0 -27
  130. package/esm/ArticleCarousel/_ArticleCarouselCard.js +0 -24
  131. package/esm/ArticleCarousel.d.ts +0 -12
  132. package/esm/ArticleCarousel.js +0 -8
  133. package/esm/ArticleMeta.d.ts +0 -10
  134. package/esm/ArticleMeta.js +0 -19
  135. package/esm/Attention.d.ts +0 -7
  136. package/esm/Attention.js +0 -4
  137. package/esm/BasicTable.d.ts +0 -12
  138. package/esm/BasicTable.js +0 -29
  139. package/esm/BgBox.d.ts +0 -8
  140. package/esm/BgBox.js +0 -9
  141. package/esm/Bling.d.ts +0 -81
  142. package/esm/Bling.js +0 -44
  143. package/esm/BlockBreak.d.ts +0 -2
  144. package/esm/BlockBreak.js +0 -6
  145. package/esm/BlockQuote.d.ts +0 -4
  146. package/esm/BlockQuote.js +0 -4
  147. package/esm/BreadCrumbs.d.ts +0 -11
  148. package/esm/BreadCrumbs.js +0 -28
  149. package/esm/ButtonBack.d.ts +0 -7
  150. package/esm/ButtonBack.js +0 -4
  151. package/esm/ButtonBar.d.ts +0 -16
  152. package/esm/ButtonBar.js +0 -14
  153. package/esm/ButtonPrimary.d.ts +0 -7
  154. package/esm/ButtonPrimary.js +0 -4
  155. package/esm/ButtonSecondary.d.ts +0 -7
  156. package/esm/ButtonSecondary.js +0 -4
  157. package/esm/ButtonTertiary.d.ts +0 -12
  158. package/esm/ButtonTertiary.js +0 -15
  159. package/esm/Carousel.d.ts +0 -4
  160. package/esm/Carousel.js +0 -4
  161. package/esm/CarouselStepper.d.ts +0 -4
  162. package/esm/CarouselStepper.js +0 -4
  163. package/esm/CenterColumn.d.ts +0 -7
  164. package/esm/CenterColumn.js +0 -7
  165. package/esm/Checkbox.d.ts +0 -4
  166. package/esm/Checkbox.js +0 -4
  167. package/esm/CheckboxButtonsGroup.d.ts +0 -11
  168. package/esm/CheckboxButtonsGroup.js +0 -14
  169. package/esm/CheckboxGroup.d.ts +0 -9
  170. package/esm/CheckboxGroup.js +0 -7
  171. package/esm/CityBlock.d.ts +0 -23
  172. package/esm/CityBlock.js +0 -18
  173. package/esm/ContactBubble.d.ts +0 -58
  174. package/esm/ContactBubble.js +0 -148
  175. package/esm/ContentArticle.d.ts +0 -15
  176. package/esm/ContentArticle.js +0 -21
  177. package/esm/ContentImage.d.ts +0 -8
  178. package/esm/ContentImage.js +0 -18
  179. package/esm/Datepicker.d.ts +0 -39
  180. package/esm/Datepicker.js +0 -63
  181. package/esm/ExtraLinks.d.ts +0 -18
  182. package/esm/ExtraLinks.js +0 -34
  183. package/esm/FeatureList.d.ts +0 -12
  184. package/esm/FeatureList.js +0 -16
  185. package/esm/FieldGroup.d.ts +0 -9
  186. package/esm/FieldGroup.js +0 -9
  187. package/esm/FileInput.d.ts +0 -17
  188. package/esm/FileInput.js +0 -154
  189. package/esm/Foonote.d.ts +0 -12
  190. package/esm/Foonote.js +0 -7
  191. package/esm/FooterBadges.d.ts +0 -9
  192. package/esm/FooterBadges.js +0 -12
  193. package/esm/FooterInfo.d.ts +0 -18
  194. package/esm/FooterInfo.js +0 -9
  195. package/esm/Footnote.d.ts +0 -6
  196. package/esm/Footnote.js +0 -3
  197. package/esm/Form.d.ts +0 -7
  198. package/esm/Form.js +0 -10
  199. package/esm/FormField.d.ts +0 -65
  200. package/esm/FormField.js +0 -91
  201. package/esm/Gallery/_GalleryItem.d.ts +0 -8
  202. package/esm/Gallery/_GalleryItem.js +0 -30
  203. package/esm/Gallery/_GalleryModal.d.ts +0 -6
  204. package/esm/Gallery/_GalleryModal.js +0 -54
  205. package/esm/Gallery/_GalleryModalContext.d.ts +0 -9
  206. package/esm/Gallery/_GalleryModalContext.js +0 -3
  207. package/esm/Gallery/_GalleryModalItem.d.ts +0 -3
  208. package/esm/Gallery/_GalleryModalItem.js +0 -22
  209. package/esm/Gallery.d.ts +0 -17
  210. package/esm/Gallery.js +0 -27
  211. package/esm/GridBlocks.d.ts +0 -26
  212. package/esm/GridBlocks.js +0 -24
  213. package/esm/Heading.d.ts +0 -16
  214. package/esm/Heading.js +0 -17
  215. package/esm/HeroBlock.d.ts +0 -19
  216. package/esm/HeroBlock.js +0 -21
  217. package/esm/IframeBlock.d.ts +0 -23
  218. package/esm/IframeBlock.js +0 -26
  219. package/esm/Illustration.d.ts +0 -13
  220. package/esm/Illustration.js +0 -8
  221. package/esm/ImageCards.d.ts +0 -8
  222. package/esm/ImageCards.js +0 -22
  223. package/esm/InfoBlock.d.ts +0 -17
  224. package/esm/InfoBlock.js +0 -13
  225. package/esm/InfoHero.d.ts +0 -17
  226. package/esm/InfoHero.js +0 -82
  227. package/esm/IslandBlock.d.ts +0 -25
  228. package/esm/IslandBlock.js +0 -16
  229. package/esm/IslandPageBlock.d.ts +0 -24
  230. package/esm/IslandPageBlock.js +0 -16
  231. package/esm/LabeledTextBlock.d.ts +0 -11
  232. package/esm/LabeledTextBlock.js +0 -14
  233. package/esm/Layout.d.ts +0 -33
  234. package/esm/Layout.js +0 -52
  235. package/esm/MainMenu/_Auxiliary.d.ts +0 -6
  236. package/esm/MainMenu/_Auxiliary.js +0 -13
  237. package/esm/MainMenu/_PrimaryPanel.d.ts +0 -13
  238. package/esm/MainMenu/_PrimaryPanel.js +0 -22
  239. package/esm/MainMenu.d.ts +0 -48
  240. package/esm/MainMenu.js +0 -136
  241. package/esm/MiniMetrics.d.ts +0 -8
  242. package/esm/MiniMetrics.js +0 -12
  243. package/esm/Modal.d.ts +0 -10
  244. package/esm/Modal.js +0 -14
  245. package/esm/NameCard.d.ts +0 -64
  246. package/esm/NameCard.js +0 -82
  247. package/esm/NameCards.d.ts +0 -6
  248. package/esm/NameCards.js +0 -7
  249. package/esm/NewsHero.d.ts +0 -14
  250. package/esm/NewsHero.js +0 -86
  251. package/esm/PageFilter.d.ts +0 -17
  252. package/esm/PageFilter.js +0 -15
  253. package/esm/PageHeading.d.ts +0 -10
  254. package/esm/PageHeading.js +0 -12
  255. package/esm/Picture.d.ts +0 -7
  256. package/esm/Picture.js +0 -8
  257. package/esm/ProcessOverview.d.ts +0 -13
  258. package/esm/ProcessOverview.js +0 -17
  259. package/esm/PullQuote.d.ts +0 -4
  260. package/esm/PullQuote.js +0 -4
  261. package/esm/RadioButtonsGroup.d.ts +0 -11
  262. package/esm/RadioButtonsGroup.js +0 -14
  263. package/esm/RadioGroup.d.ts +0 -13
  264. package/esm/RadioGroup.js +0 -7
  265. package/esm/RelatedLinks.d.ts +0 -20
  266. package/esm/RelatedLinks.js +0 -26
  267. package/esm/RowBlock.d.ts +0 -12
  268. package/esm/RowBlock.js +0 -9
  269. package/esm/RowBlockColumn.d.ts +0 -8
  270. package/esm/RowBlockColumn.js +0 -11
  271. package/esm/SearchInput.d.ts +0 -18
  272. package/esm/SearchInput.js +0 -33
  273. package/esm/SearchResults/_SearchResultsItem.d.ts +0 -18
  274. package/esm/SearchResults/_SearchResultsItem.js +0 -15
  275. package/esm/SearchResults.d.ts +0 -33
  276. package/esm/SearchResults.js +0 -109
  277. package/esm/SeenEffect.d.ts +0 -4
  278. package/esm/SeenEffect.js +0 -19
  279. package/esm/Selectbox.d.ts +0 -8
  280. package/esm/Selectbox.js +0 -46
  281. package/esm/ShareButtons.d.ts +0 -9
  282. package/esm/ShareButtons.js +0 -51
  283. package/esm/Sharpie.d.ts +0 -23
  284. package/esm/Sharpie.js +0 -22
  285. package/esm/SiteSearchAutocomplete.d.ts +0 -40
  286. package/esm/SiteSearchAutocomplete.js +0 -58
  287. package/esm/SiteSearchCurtain.d.ts +0 -6
  288. package/esm/SiteSearchCurtain.js +0 -33
  289. package/esm/SiteSearchInput.d.ts +0 -24
  290. package/esm/SiteSearchInput.js +0 -40
  291. package/esm/Skeleton.d.ts +0 -25
  292. package/esm/Skeleton.js +0 -30
  293. package/esm/SubHeading.d.ts +0 -10
  294. package/esm/SubHeading.js +0 -13
  295. package/esm/Tabs.d.ts +0 -35
  296. package/esm/Tabs.js +0 -94
  297. package/esm/TagPill.d.ts +0 -27
  298. package/esm/TagPill.js +0 -43
  299. package/esm/TextBlock.d.ts +0 -15
  300. package/esm/TextBlock.js +0 -15
  301. package/esm/TextButton.d.ts +0 -9
  302. package/esm/TextButton.js +0 -9
  303. package/esm/TextInput.d.ts +0 -16
  304. package/esm/TextInput.js +0 -35
  305. package/esm/VSpacer.d.ts +0 -24
  306. package/esm/VSpacer.js +0 -41
  307. package/esm/VerticalTabsTOC.d.ts +0 -14
  308. package/esm/VerticalTabsTOC.js +0 -68
  309. package/esm/WizardLayout.d.ts +0 -15
  310. package/esm/WizardLayout.js +0 -30
  311. package/esm/WizardLayoutClose.d.ts +0 -3
  312. package/esm/WizardLayoutClose.js +0 -4
  313. package/esm/WizardStepper.d.ts +0 -36
  314. package/esm/WizardStepper.js +0 -25
  315. package/esm/_abstract/_AbstractCarousel.d.ts +0 -25
  316. package/esm/_abstract/_AbstractCarousel.js +0 -130
  317. package/esm/_abstract/_Blings.d.ts +0 -11
  318. package/esm/_abstract/_Blings.js +0 -12
  319. package/esm/_abstract/_Block.d.ts +0 -22
  320. package/esm/_abstract/_Block.js +0 -24
  321. package/esm/_abstract/_Button.d.ts +0 -40
  322. package/esm/_abstract/_Button.js +0 -47
  323. package/esm/_abstract/_CardList.d.ts +0 -30
  324. package/esm/_abstract/_CardList.js +0 -38
  325. package/esm/_abstract/_Image.d.ts +0 -36
  326. package/esm/_abstract/_Image.js +0 -27
  327. package/esm/_abstract/_Link.d.ts +0 -27
  328. package/esm/_abstract/_Link.js +0 -24
  329. package/esm/_abstract/_Quote.d.ts +0 -9
  330. package/esm/_abstract/_Quote.js +0 -8
  331. package/esm/_abstract/_TogglerGroup.d.ts +0 -31
  332. package/esm/_abstract/_TogglerGroup.js +0 -29
  333. package/esm/_abstract/_TogglerGroupField.d.ts +0 -17
  334. package/esm/_abstract/_TogglerGroupField.js +0 -22
  335. package/esm/_abstract/_TogglerInput.d.ts +0 -22
  336. package/esm/_abstract/_TogglerInput.js +0 -33
  337. package/esm/_abstract/breakOnNL.d.ts +0 -2
  338. package/esm/_abstract/breakOnNL.js +0 -8
  339. package/esm/assets.d.ts +0 -42
  340. package/esm/assets.js +0 -56
  341. package/esm/constants.d.ts +0 -39
  342. package/esm/constants.js +0 -22
  343. package/esm/focus-visible.d.ts +0 -1
  344. package/esm/focus-visible.js +0 -1
  345. package/esm/package.json +0 -1
  346. package/esm/utils/env.d.ts +0 -1
  347. package/esm/utils/env.js +0 -8
  348. package/esm/utils/seenEffect.d.ts +0 -28
  349. package/esm/utils/seenEffect.js +0 -73
  350. package/esm/utils/useFormatMonitor.d.ts +0 -38
  351. package/esm/utils/useFormatMonitor.js +0 -41
  352. package/esm/utils/useGetSVGtext.d.ts +0 -6
  353. package/esm/utils/useGetSVGtext.js +0 -19
  354. package/esm/utils/useMenuToggling.d.ts +0 -8
  355. package/esm/utils/useMenuToggling.js +0 -62
  356. package/esm/utils/useScrollbarWidthCSSVar.d.ts +0 -1
  357. package/esm/utils/useScrollbarWidthCSSVar.js +0 -3
  358. package/esm/utils.d.ts +0 -2
  359. package/esm/utils.js +0 -2
@@ -1,68 +0,0 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
2
- import { setFrag } from '@hugsmidjan/qj/frag';
3
- import { useDomid } from '@hugsmidjan/react/hooks';
4
- import Tabs from './Tabs';
5
- const getId = (url) => (url && decodeURIComponent(url.split('#')[1] || '')) || '';
6
- const getItemId = (item) => getId(item && item.href);
7
- const mapToItemsById = (items, domid) => {
8
- const updatedItems = items.map((item) => {
9
- return Object.assign(Object.assign({}, item), { 'aria-controls': item['aria-controls'] || domid });
10
- });
11
- const itemsById = {};
12
- updatedItems.forEach((topItem, activeIdx) => {
13
- const subItems = topItem.items;
14
- if (!subItems) {
15
- const itemId = getItemId(topItem);
16
- itemsById[itemId] = { activeIdx };
17
- return;
18
- }
19
- subItems.forEach((subItem, idx) => {
20
- itemsById[getItemId(subItem)] = {
21
- activeIdx,
22
- subTabs: {
23
- activeIdx: idx,
24
- 'aria-label': topItem.longLabel || topItem.label,
25
- id: topItem['aria-controls'],
26
- tabs: subItems,
27
- onSetActive: (_, item) => {
28
- const newId = getItemId(item);
29
- setFrag(newId);
30
- },
31
- },
32
- };
33
- if (idx === 0) {
34
- topItem.href = topItem.href || '#' + getItemId(subItem);
35
- }
36
- });
37
- });
38
- return { itemsById, updatedItems };
39
- };
40
- const VerticalTabsTOC = (props) => {
41
- const { onItemSelect, items } = props;
42
- const _domid = useDomid();
43
- const domid = props.id || _domid;
44
- const { itemsById, updatedItems } = useMemo(() => mapToItemsById(items, domid), [items, domid]);
45
- const [state, setState] = useState(() => {
46
- const initialId = typeof location !== 'undefined' ? getId(location.hash) : '';
47
- return itemsById[initialId] || itemsById[getItemId(updatedItems[0])] || {};
48
- });
49
- useEffect(() => {
50
- const handleHash = () => {
51
- const newId = getId(location.href);
52
- const newState = itemsById[newId];
53
- if (newState) {
54
- setState(newState);
55
- onItemSelect(newId);
56
- }
57
- };
58
- window.addEventListener('hashchange', handleHash);
59
- return () => window.removeEventListener('hashchange', handleHash);
60
- }, [itemsById, onItemSelect]);
61
- return (React.createElement(Tabs, { id: domid, vertical: true, "aria-label": props['aria-label'], onSetActive: (_, item) => {
62
- var _a;
63
- const itemId = getItemId(item);
64
- const newId = itemId || getItemId((_a = itemsById[itemId].subTabs) === null || _a === void 0 ? void 0 : _a.tabs[0]);
65
- setFrag(newId);
66
- }, tabs: updatedItems, role: "tablist", activeIdx: state.activeIdx, subTabs: state.subTabs }));
67
- };
68
- export default VerticalTabsTOC;
@@ -1,15 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { SSRSupport } from '@hugsmidjan/react/hooks';
3
- import { HannaColorTheme } from '@reykjavik/hanna-css';
4
- declare type WizardLayoutProps = {
5
- wizardStepper?: ReactNode;
6
- wizardFooter?: ReactNode;
7
- colorTheme?: HannaColorTheme;
8
- siteName?: string;
9
- logoLink?: string;
10
- globalAlerts?: ReactNode;
11
- ssr?: SSRSupport;
12
- children?: ReactNode;
13
- };
14
- declare const WizardLayout: (props: WizardLayoutProps) => JSX.Element;
15
- export default WizardLayout;
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import { useIsBrowserSide } from '@hugsmidjan/react/hooks';
3
- import { getAssetUrl } from '@reykjavik/hanna-utils/assets';
4
- import Image from './_abstract/_Image';
5
- import { Link } from './_abstract/_Link';
6
- import { useScrollbarWidthCSSVar } from './utils/useScrollbarWidthCSSVar';
7
- const WizardLayout = (props) => {
8
- useScrollbarWidthCSSVar();
9
- const {
10
- // ssr,
11
- wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = 'Reykjavík', globalAlerts, } = props;
12
- const isBrowser = useIsBrowserSide( /* ssr */);
13
- return (React.createElement("div", { className: "WizardLayout", "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
14
- globalAlerts && (React.createElement("div", { className: "WizardLayout__alerts", role: "alert" }, globalAlerts)),
15
- React.createElement("div", { className: "WizardLayout__content" },
16
- React.createElement("div", { className: "WizardLayout__header", role: "banner" },
17
- React.createElement(Link, { className: "WizardLayout__header__logo", href: logoLink },
18
- ' ',
19
- React.createElement(Image, { className: undefined, inline: true, src: getAssetUrl('reykjavik-logo.svg') }),
20
- ' ',
21
- siteName,
22
- ' '),
23
- ' '),
24
- React.createElement("div", { className: "WizardLayout__wrap" },
25
- wizardStepper && (React.createElement("div", { className: "WizardLayout__stepper", role: "navigation" }, wizardStepper)),
26
- React.createElement("div", { className: "WizardLayout__main", role: "main" }, children),
27
- React.createElement("div", { className: "WizardLayout__deco WizardLayout__deco--geometry" })),
28
- React.createElement("div", { className: "WizardLayout__footer", role: "complementary" }, wizardFooter))));
29
- };
30
- export default WizardLayout;
@@ -1,3 +0,0 @@
1
- import { ButtonProps } from './_abstract/_Button';
2
- declare const WizardLayoutClose: (props: ButtonProps) => JSX.Element;
3
- export default WizardLayoutClose;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import Button from './_abstract/_Button';
3
- const WizardLayoutClose = (props) => (React.createElement(Button, Object.assign({ bem: "WizardLayoutClose" }, props)));
4
- export default WizardLayoutClose;
@@ -1,36 +0,0 @@
1
- export declare type WizardStepperStep = {
2
- label: string;
3
- /**
4
- * Should the step be clickable?
5
- *
6
- * * `true` = The items becomes clickable as allowed by the `activeStep`,
7
- * `disableBacktrack` and `allowForwardSkip` props.
8
- * * `false | undefined` = Never clickable, regardless of `activeStep`.
9
- * * `"always"` = Always clickable regardless of `activeStep` or other props.
10
- */
11
- clickable?: boolean | 'always';
12
- /**
13
- * Flags the item as having a non-default done state
14
- *
15
- * * `undefined` = automatically set "done" on items before `activeStep`
16
- * * `true` = Always flag as "done", regardless of `activeStep`
17
- * * `false` = Never flag as "done", regardless of `activeStep`
18
- */
19
- done?: boolean;
20
- /**
21
- * Flags the step as not part of the numbering scheme
22
- */
23
- neutral?: boolean;
24
- };
25
- export declare type WizardStepperProps = {
26
- steps: ReadonlyArray<WizardStepperStep>;
27
- /** Zero-based index of the active (current) step */
28
- activeStep?: number;
29
- /** By default, clickable "done" steps remain clickable */
30
- disableBacktrack?: boolean;
31
- /** By default, clickable steps after the active step are not immediately clickable */
32
- allowForwardSkip?: boolean;
33
- onClick: (clickedIndex: number) => void;
34
- };
35
- declare const WizardStepper: (props: WizardStepperProps) => JSX.Element;
36
- export default WizardStepper;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- const WizardStepper = (props) => {
4
- const { steps, activeStep = -1, allowForwardSkip, disableBacktrack, onClick } = props;
5
- return (React.createElement("div", { className: getBemClass('WizardStepper', activeStep === -1 && 'preview') }, steps.map((step, i) => {
6
- const { label, clickable, done, neutral } = step;
7
- const stepClass = getBemClass('WizardStepper__step', [
8
- (done || (done == null && i < activeStep)) && 'done',
9
- neutral && 'neutral',
10
- ]);
11
- const isClickable = clickable === 'always' ||
12
- (clickable &&
13
- (activeStep === i ||
14
- (i > activeStep && allowForwardSkip) ||
15
- (i < activeStep && !disableBacktrack)));
16
- const ariaCurrent = activeStep === i ? 'step' : undefined;
17
- return (React.createElement(React.Fragment, { key: i },
18
- isClickable ? (React.createElement("button", { type: "button", className: stepClass, onClick: () => onClick(i), "aria-current": ariaCurrent }, label)) : (React.createElement("span", { className: stepClass, "aria-current": ariaCurrent },
19
- ' ',
20
- label,
21
- ' ')),
22
- ' '));
23
- })));
24
- };
25
- export default WizardStepper;
@@ -1,25 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import { SSRSupport } from '@hugsmidjan/react/hooks';
3
- import { BemProps } from '@hugsmidjan/react/types';
4
- import { SeenProp } from '../utils/seenEffect';
5
- export declare type CarouselProps<I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}> = {
6
- className?: string;
7
- ssr?: SSRSupport;
8
- /** @deprecated Ingored because never used (Will be removed in v0.11) */
9
- scrollRight?: boolean;
10
- } & ({
11
- children?: never;
12
- items: Array<I>;
13
- Component: (props: P extends undefined ? I : I & P) => ReactElement | null;
14
- ComponentProps?: P;
15
- } | {
16
- children: Array<ReactElement>;
17
- items?: never;
18
- Component?: never;
19
- ComponentProps?: never;
20
- }) & SeenProp;
21
- declare type AbstractCarouselProps<I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}> = CarouselProps<I, P> & BemProps & {
22
- title?: string;
23
- };
24
- declare const AbstractCarousel: <I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}>(props: AbstractCarouselProps<I, P>) => JSX.Element | null;
25
- export default AbstractCarousel;
@@ -1,130 +0,0 @@
1
- import React, { useEffect, useRef, useState, } from 'react';
2
- import A from '@hugsmidjan/qj/A';
3
- import focusElm from '@hugsmidjan/qj/focusElm';
4
- import throttle from '@hugsmidjan/qj/throttle';
5
- import { useIsBrowserSide } from '@hugsmidjan/react/hooks';
6
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
7
- import { notNully } from '@reykjavik/hanna-utils';
8
- import CarouselStepper from '../CarouselStepper';
9
- import { useSeenEffect } from '../utils/seenEffect';
10
- const WHEEL_AMPLIFIER = 3;
11
- const WHEEL_HIJACK_TIMEOUT_MS = 667;
12
- const scrollXBy = (elm, deltaX) => {
13
- const left = elm.scrollLeft + deltaX;
14
- elm.scrollTo(left, elm.scrollTop);
15
- // NOTE 1: using elm.scrollTo({ left, behavior: 'smooth' }); seems to be too much
16
- // as `behavior: 'smooth'` starts some weird interactions with the browser's
17
- // `scroll-snap-type` behavior.
18
- //
19
- // NOTE 2: Both Chrome and Safari tend to snap hard to the nearest list item
20
- // while Firefox is more smooth. Haven't found a way around that.
21
- };
22
- const exitWheelHijack = (elm) => () => {
23
- elm.style.scrollSnapType = '';
24
- const lastElmOffset = elm.lastElementChild
25
- ? elm.lastElementChild.offsetLeft
26
- : 0;
27
- // trigger one last scroll event, to make sure the element's
28
- // `style.scrollSnapType`'s behavior kicks in.
29
- // Otherwise the list may stay stuck in an over-scrolled state —
30
- // off to the right.
31
- scrollXBy(elm, Math.min(0, lastElmOffset - elm.scrollLeft));
32
- };
33
- const handleMouseWheel = (e) => {
34
- const elm = e.currentTarget;
35
- if (e.deltaX || elm.$hasXDeltaed) {
36
- elm.$hasXDeltaed = true;
37
- exitWheelHijack(elm);
38
- return;
39
- }
40
- if (e.deltaY && !e.deltaX) {
41
- if (e.deltaY < 0) {
42
- // Stop scroll-capture when list is at left-edge
43
- if (elm.scrollLeft < 50) {
44
- return;
45
- }
46
- }
47
- else {
48
- // Stop scroll-capture when list is beyond left edge of last list item
49
- if (elm.scrollLeft >
50
- (elm.lastElementChild ? elm.lastElementChild.offsetLeft : 0)) {
51
- exitWheelHijack(elm);
52
- return;
53
- }
54
- }
55
- e.preventDefault();
56
- e.stopImmediatePropagation();
57
- // Disable `scroll-snap-style` because otherwise
58
- // small-scale elm.scrollTo() calls have no effect
59
- elm.style.scrollSnapType = 'initial';
60
- scrollXBy(elm, e.deltaY * WHEEL_AMPLIFIER);
61
- clearTimeout(elm.$timeout);
62
- elm.$timeout = setTimeout(exitWheelHijack(elm), WHEEL_HIJACK_TIMEOUT_MS);
63
- }
64
- };
65
- const handleMouseLeave = (e) => {
66
- const elm = e.currentTarget;
67
- exitWheelHijack(elm);
68
- elm.$hasXDeltaed = undefined;
69
- };
70
- const AbstractCarousel = (props) => {
71
- const { title, items = [], Component, ComponentProps, bem = 'Carousel', modifier, ssr, startSeen, } = props;
72
- const children = props.children && props.children.filter(notNully);
73
- const [leftOffset, setLeftOffset] = useState();
74
- const itemCount = (children || items).length;
75
- const listRef = useRef(null);
76
- const [activeItem, setActiveItem] = useState(0);
77
- const isBrowser = useIsBrowserSide(ssr);
78
- // update on activeItem state change
79
- useEffect(() => {
80
- const listElm = listRef.current;
81
- if (!listElm) {
82
- return;
83
- }
84
- const calcLeftOffset = () => {
85
- var _a;
86
- setLeftOffset((_a = listElm.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().left);
87
- scrollXBy(listElm, 0);
88
- };
89
- const calcActiveItem = throttle(() => {
90
- const { scrollLeft, children } = listElm;
91
- // using Array#find as forEachUntil
92
- A(children).find((item, i) => {
93
- if (scrollLeft <= item.offsetLeft + item.offsetWidth / 2) {
94
- setActiveItem(i);
95
- return true;
96
- }
97
- });
98
- }, 300, true);
99
- calcLeftOffset();
100
- listElm.addEventListener('wheel', handleMouseWheel);
101
- listElm.addEventListener('scroll', calcActiveItem, { passive: true });
102
- window.addEventListener('resize', calcLeftOffset, { passive: true });
103
- return () => {
104
- listElm.removeEventListener('wheel', handleMouseWheel);
105
- listElm.removeEventListener('scroll', calcActiveItem);
106
- window.removeEventListener('resize', calcLeftOffset);
107
- };
108
- }, []);
109
- const scrollToItem = (newActive) => {
110
- setActiveItem(newActive);
111
- const listElm = listRef.current;
112
- const newItem = listElm.children[newActive];
113
- listElm.scrollTo(newItem ? newItem.offsetLeft : 0, 0);
114
- setTimeout(() => focusElm(newItem), 500);
115
- };
116
- const [outerRef] = useSeenEffect(startSeen);
117
- if (!itemCount) {
118
- return null;
119
- }
120
- return (React.createElement("div", { className: getBemClass(bem, modifier, props.className), ref: outerRef, "data-sprinkled": isBrowser },
121
- title && React.createElement("h2", { className: bem + '__title' }, title),
122
- React.createElement("div", { className: bem + '__itemlist', style: leftOffset
123
- ? { '--Carousel--leftOffset': `${leftOffset}px` }
124
- : undefined, "data-scroll-snapping": leftOffset ? 'true' : undefined, onMouseLeave: handleMouseLeave, ref: listRef }, children ||
125
- items.map((item, i) => (
126
- // @ts-expect-error (Can't be arsed...)
127
- React.createElement(Component, Object.assign({ key: i }, ComponentProps, item))))),
128
- isBrowser && (React.createElement(CarouselStepper, { itemCount: itemCount, setCurrent: scrollToItem, current: activeItem }))));
129
- };
130
- export default AbstractCarousel;
@@ -1,11 +0,0 @@
1
- import { BlingType } from '@reykjavik/hanna-utils/assets';
2
- import { BlingProps } from '../Bling';
3
- export declare type BlingComboProps = Array<Omit<BlingProps, 'type' | 'blingUrl'> & {
4
- type: BlingType;
5
- }>;
6
- declare type BlingsProps = {
7
- blings: BlingComboProps;
8
- mirror?: boolean;
9
- };
10
- declare const Blings: (props: BlingsProps) => JSX.Element;
11
- export default Blings;
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import Bling from '../Bling';
3
- const inverseAlignments = {
4
- left: 'right',
5
- 'left-ish': 'right-ish',
6
- 'left-center': 'right-center',
7
- 'right-center': 'left-center',
8
- 'right-ish': 'left-ish',
9
- right: 'left',
10
- };
11
- const Blings = (props) => (React.createElement(React.Fragment, null, props.blings.map(({ type, align, vertical, color, overlay, parent }, i) => (React.createElement(Bling, { key: type + '-' + i, type: type, align: props.mirror ? inverseAlignments[align || 'left'] : align, vertical: vertical, color: color, overlay: overlay, parent: parent })))));
12
- export default Blings;
@@ -1,22 +0,0 @@
1
- import { BemPropsModifier } from '@hugsmidjan/react/types';
2
- import { SeenProp } from '../utils/seenEffect';
3
- import { ButtonProps } from './_Button';
4
- import { ImageProps } from './_Image';
5
- export declare type BlockItem = {
6
- title: string;
7
- summary?: string | JSX.Element;
8
- buttons?: Array<ButtonProps>;
9
- };
10
- export declare type ContentImageBlock = {
11
- content: BlockItem;
12
- image: ImageProps;
13
- } & SeenProp;
14
- export declare type ContentBlock = {
15
- content: Array<BlockItem>;
16
- image?: undefined;
17
- } & SeenProp;
18
- export declare type BlockProps = BemPropsModifier & (ContentBlock | ContentImageBlock);
19
- declare const Block: (props: BlockProps & {
20
- bem: string;
21
- }) => JSX.Element;
22
- export default Block;
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { useSeenEffect } from '../utils/seenEffect';
4
- import Button from './_Button';
5
- import Image from './_Image';
6
- const Block = (props) => {
7
- const { image, modifier, bem, content, startSeen } = props;
8
- const [ref] = useSeenEffect(startSeen);
9
- const contentItems = Array.isArray(content) ? content : [content];
10
- return (React.createElement("div", { className: getBemClass(bem, modifier), ref: ref },
11
- contentItems.map(({ title, summary, buttons = [] }, i) => {
12
- const hasSummary = summary && (typeof summary !== 'string' || !!summary.trim());
13
- return (React.createElement("div", { key: i, className: `${bem}__content` },
14
- React.createElement("h2", { className: `${bem}__title` }, title),
15
- hasSummary && React.createElement("div", { className: `${bem}__summary` }, summary),
16
- buttons.length > 0 && (React.createElement("div", { className: `${bem}__buttons` },
17
- ' ',
18
- buttons.map((buttonProps, i) => (React.createElement(React.Fragment, null,
19
- React.createElement(Button, Object.assign({ bem: `${bem}__button`, key: i }, buttonProps)),
20
- ' ')))))));
21
- }),
22
- image && React.createElement(Image, Object.assign({ className: `${bem}__image` }, image))));
23
- };
24
- export default Block;
@@ -1,40 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { BemProps, BemPropsModifier } from '@hugsmidjan/react/types';
3
- declare type ButtonElmProps = {
4
- href?: never;
5
- } & BemPropsModifier & Omit<JSX.IntrinsicElements['button'], 'className' | 'style'>;
6
- declare type AnchorElmProps = {
7
- href: string;
8
- type?: never;
9
- name?: never;
10
- value?: never;
11
- } & BemPropsModifier & Omit<JSX.IntrinsicElements['a'], 'className' | 'style'>;
12
- export declare type ButtonProps = {
13
- /** Label takes preference over `children` */
14
- label?: string | JSX.Element;
15
- } & (ButtonElmProps | AnchorElmProps);
16
- declare const sizes: {
17
- readonly normal: "";
18
- readonly small: "small";
19
- readonly wide: "wide";
20
- };
21
- declare type ButtonSize = keyof typeof sizes;
22
- declare const variants: {
23
- readonly normal: "";
24
- readonly destructive: "destructive";
25
- };
26
- declare type ButtonVariant = keyof typeof variants;
27
- declare type NavigationFlag = 'none' | 'go-back' | 'go-forward';
28
- declare type ButtonIcon = 'edit';
29
- export declare type ButtonVariantProps = {
30
- size?: ButtonSize;
31
- variant?: ButtonVariant;
32
- icon?: ButtonIcon | NavigationFlag;
33
- /** @deprecated (Will be removed in v0.11) */
34
- small?: boolean;
35
- };
36
- declare type _ButtonProps = ButtonProps & ButtonVariantProps & BemProps & {
37
- children?: ReactNode;
38
- };
39
- declare const Button: (props: _ButtonProps) => JSX.Element;
40
- export default Button;
@@ -1,47 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React from 'react';
13
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
14
- import { Link } from './_Link';
15
- // ---------------------------------------------------------------------------
16
- const sizes = {
17
- normal: '',
18
- small: 'small',
19
- wide: 'wide',
20
- };
21
- // ---------------------------------------------------------------------------
22
- const variants = {
23
- normal: '',
24
- destructive: 'destructive',
25
- };
26
- const navigationFlags = {
27
- none: '',
28
- 'go-back': 'go--back',
29
- 'go-forward': 'go--forward',
30
- };
31
- const icons = {
32
- // TODO: insert icons
33
- edit: 'edit',
34
- };
35
- const Button = (props) => {
36
- const { bem, small, size = 'normal', modifier, children, variant = 'normal', icon = 'none', label = children } = props, buttonProps = __rest(props, ["bem", "small", "size", "modifier", "children", "variant", "icon", "label"]);
37
- const className = bem &&
38
- getBemClass(bem, [modifier, variants[variant], sizes[size], navigationFlags[icon]]);
39
- const iconProp = icons[icon] && { 'data-icon': icons[icon] };
40
- if (buttonProps.href != null) {
41
- return (React.createElement(Link, Object.assign({ className: className }, buttonProps, { style: undefined }, iconProp), label));
42
- }
43
- else {
44
- return (React.createElement("button", Object.assign({ className: className, type: "button" }, buttonProps, { style: undefined }, iconProp), label));
45
- }
46
- };
47
- export default Button;
@@ -1,30 +0,0 @@
1
- import { ReactElement, ReactNode } from 'react';
2
- import { ImageProps } from './_Image';
3
- declare type BaseCardProps = {
4
- title: string;
5
- href: string;
6
- imgPlaceholder?: boolean;
7
- };
8
- export declare type ImageCardProps = BaseCardProps & {
9
- meta?: string;
10
- image?: ImageProps;
11
- };
12
- export declare type TextCardProps = BaseCardProps & {
13
- summary?: string;
14
- };
15
- export declare type CardListProps<T> = {
16
- cards: Array<T>;
17
- title?: string | undefined;
18
- summaryElement?: ReactElement;
19
- titleTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'p';
20
- imgPlaceholder?: boolean | string;
21
- };
22
- export declare type ImageCardListProps = CardListProps<ImageCardProps>;
23
- export declare type TextCardListProps = CardListProps<TextCardProps>;
24
- declare type _CardListProps = CardListProps<BaseCardProps> & {
25
- bemPrefix: string;
26
- children?: ReactNode;
27
- standalone?: boolean;
28
- };
29
- export declare const CardList: (props: _CardListProps) => JSX.Element;
30
- export {};
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import Button from './_Button';
3
- import Image from './_Image';
4
- const Card = (props) => {
5
- const { bem, href, title, imgPlaceholder } = props;
6
- const cardClass = `${bem}__card`;
7
- const image = 'image' in props && props.image;
8
- const meta = 'meta' in props && props.meta;
9
- const summary = 'summary' in props && props.summary;
10
- return (React.createElement(React.Fragment, null,
11
- React.createElement(Button, { bem: cardClass, href: href },
12
- ' ',
13
- React.createElement(Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder })),
14
- React.createElement("span", { className: `${cardClass}__title` }, title),
15
- ' ',
16
- meta && React.createElement("span", { className: `${cardClass}__meta` }, meta),
17
- ' ',
18
- summary && React.createElement("span", { className: `${cardClass}__summary` }, summary),
19
- ' '),
20
- ' '));
21
- };
22
- export const CardList = (props) => {
23
- const { bemPrefix, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
24
- const TitleTag = titleTag;
25
- const fallbackImageUrl = (imgPlaceholder !== true && imgPlaceholder) || undefined;
26
- const fallbackImageStyle = fallbackImageUrl
27
- ? {
28
- ['--' + bemPrefix + '--fallback']: `url("${fallbackImageUrl}")`,
29
- }
30
- : undefined;
31
- return (React.createElement(React.Fragment, null,
32
- summaryElement ? (React.createElement("div", { className: bemPrefix + '__summary' },
33
- title && React.createElement(TitleTag, { className: bemPrefix + '__title' }, title),
34
- summaryElement)) : (title && React.createElement(TitleTag, { className: bemPrefix + '__title' }, title)),
35
- React.createElement("ul", { className: bemPrefix + (props.standalone ? '' : '__list'), style: fallbackImageStyle }, cards.map((card, i) => (React.createElement("li", { key: i, className: bemPrefix + '__item' },
36
- React.createElement(Card, Object.assign({}, card, { bem: bemPrefix, imgPlaceholder: !!imgPlaceholder })))))),
37
- children));
38
- };
@@ -1,36 +0,0 @@
1
- export declare type Source = {
2
- srcset: string;
3
- media: string;
4
- };
5
- export declare type ImagePropsLinked = {
6
- altText?: string;
7
- sources?: Array<Source>;
8
- /** The default image source to (lazy) load */
9
- src?: string;
10
- /** Eagerly-loaded placeholder/thunbnail to use until a `sources` item has been picked. */
11
- preloadSrc?: string;
12
- inline?: false;
13
- focalPoint?: string;
14
- };
15
- export declare type ImagePropsInlinedSvg = {
16
- altText?: string;
17
- /** Should the image be fetched and inlined as <svg/> */
18
- inline: true;
19
- src: string;
20
- sources?: undefined;
21
- preloadSrc?: undefined;
22
- focalPoint?: undefined;
23
- };
24
- export declare type ImageProps = ImagePropsLinked | ImagePropsInlinedSvg;
25
- declare type _ImageProps = {
26
- /** container className */
27
- className: string | undefined;
28
- /** Controls if the container is rendered when image is missing/undefined.
29
- * (With a `--missing` className modifier added.)
30
- *
31
- * Accepts a function that defines a default content for the container.
32
- */
33
- placeholder?: boolean | (() => JSX.Element);
34
- };
35
- declare const Image: (props: ImageProps & _ImageProps) => JSX.Element | null;
36
- export default Image;
@@ -1,27 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { useGetSVGtext } from '../utils/useGetSVGtext';
4
- // eslint-disable-next-line complexity
5
- const Image = (props) => {
6
- const { src, altText = '', sources = [], preloadSrc, className, inline, placeholder, focalPoint, } = props;
7
- const _src = (sources.length && preloadSrc) || src;
8
- const imageSrc = _src || (sources[0] != null ? sources[0].srcset.split(' ')[0] : undefined);
9
- const imgLoading = preloadSrc ? 'eager' : 'lazy';
10
- const inlineSvg = useGetSVGtext(inline ? imageSrc : undefined);
11
- if (!imageSrc) {
12
- return placeholder ? (React.createElement("span", { className: className && getBemClass(className, 'missing') }, placeholder !== true && placeholder())) : null;
13
- }
14
- if (inline && inlineSvg) {
15
- const __html = inlineSvg.imageSrc === imageSrc ? inlineSvg.code : '';
16
- return React.createElement("span", { className: className, dangerouslySetInnerHTML: { __html } });
17
- }
18
- return (React.createElement("picture", { className: className, style: focalPoint ? { '--focalPoint': focalPoint } : undefined },
19
- ' ',
20
- sources.map((source, i) => (React.createElement(React.Fragment, null,
21
- React.createElement("source", { key: i, srcSet: source.srcset, media: source.media }),
22
- ' '))),
23
- ' ',
24
- React.createElement("img", { src: imageSrc, alt: altText, loading: imgLoading }),
25
- ' '));
26
- };
27
- export default Image;