@reykjavik/hanna-react 0.10.57 → 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 (392) hide show
  1. package/AccordionList.js +3 -28
  2. package/ActionCards.d.ts +1 -1
  3. package/ActionCards.js +4 -6
  4. package/Alert.js +5 -30
  5. package/ArticleCards.d.ts +6 -0
  6. package/ArticleCards.js +7 -0
  7. package/ArticleCarousel/_ArticleCarouselCard.d.ts +1 -1
  8. package/ArticleCarousel/_ArticleCarouselCard.js +8 -10
  9. package/ArticleCarousel.js +3 -5
  10. package/ArticleMeta.d.ts +1 -0
  11. package/ArticleMeta.js +7 -28
  12. package/Attention.js +3 -5
  13. package/BasicTable.js +5 -7
  14. package/{esm/CenterColumn.d.ts → BgBox.d.ts} +4 -3
  15. package/BgBox.js +12 -0
  16. package/Bling.js +3 -5
  17. package/BlockBreak.js +2 -4
  18. package/BlockQuote.js +2 -4
  19. package/BreadCrumbs.js +4 -6
  20. package/ButtonBack.d.ts +1 -1
  21. package/ButtonBack.js +4 -6
  22. package/ButtonBar.js +3 -5
  23. package/ButtonPrimary.d.ts +1 -1
  24. package/ButtonPrimary.js +4 -6
  25. package/ButtonSecondary.d.ts +1 -1
  26. package/ButtonSecondary.js +4 -6
  27. package/ButtonTertiary.d.ts +1 -1
  28. package/ButtonTertiary.js +4 -6
  29. package/CHANGELOG.md +20 -1
  30. package/Carousel.js +3 -5
  31. package/CarouselStepper.js +3 -5
  32. package/CenterColumn.js +3 -5
  33. package/Checkbox.d.ts +1 -1
  34. package/Checkbox.js +4 -6
  35. package/CheckboxButtonsGroup.d.ts +1 -1
  36. package/CheckboxButtonsGroup.js +6 -8
  37. package/CheckboxGroup.d.ts +1 -1
  38. package/CheckboxGroup.js +5 -7
  39. package/CityBlock.d.ts +1 -1
  40. package/CityBlock.js +3 -5
  41. package/ContactBubble.js +6 -31
  42. package/ContentArticle.js +8 -10
  43. package/ContentImage.d.ts +1 -1
  44. package/ContentImage.js +4 -6
  45. package/Datepicker.js +6 -31
  46. package/ExtraLinks.d.ts +1 -1
  47. package/ExtraLinks.js +8 -21
  48. package/FeatureList.js +3 -5
  49. package/FieldGroup.js +3 -5
  50. package/FileInput.js +5 -41
  51. package/Foonote.js +2 -4
  52. package/FooterBadges.js +4 -6
  53. package/FooterInfo.js +3 -5
  54. package/Footnote.js +2 -4
  55. package/Form.js +3 -5
  56. package/FormField.js +3 -28
  57. package/Gallery/_GalleryItem.d.ts +1 -1
  58. package/Gallery/_GalleryItem.js +9 -45
  59. package/Gallery/_GalleryModal.js +6 -31
  60. package/Gallery/_GalleryModalContext.js +2 -4
  61. package/Gallery/_GalleryModalItem.js +5 -18
  62. package/Gallery.js +6 -31
  63. package/GridBlocks.d.ts +2 -2
  64. package/GridBlocks.js +8 -10
  65. package/Heading.d.ts +1 -1
  66. package/Heading.js +4 -6
  67. package/HeroBlock.d.ts +2 -2
  68. package/HeroBlock.js +6 -8
  69. package/IframeBlock.d.ts +5 -1
  70. package/IframeBlock.js +6 -8
  71. package/Illustration.d.ts +1 -1
  72. package/Illustration.js +4 -6
  73. package/ImageCards.d.ts +1 -1
  74. package/ImageCards.js +6 -19
  75. package/InfoBlock.js +2 -4
  76. package/InfoHero.d.ts +2 -2
  77. package/InfoHero.js +8 -10
  78. package/IslandBlock.d.ts +1 -1
  79. package/IslandBlock.js +3 -5
  80. package/IslandPageBlock.d.ts +1 -1
  81. package/IslandPageBlock.js +3 -5
  82. package/LabeledTextBlock.d.ts +1 -1
  83. package/LabeledTextBlock.js +4 -6
  84. package/Layout.js +9 -11
  85. package/MainMenu/_Auxiliary.js +4 -6
  86. package/MainMenu/_PrimaryPanel.js +5 -7
  87. package/MainMenu.js +7 -32
  88. package/MiniMetrics.d.ts +1 -1
  89. package/MiniMetrics.js +5 -7
  90. package/Modal.js +3 -5
  91. package/NameCard.js +6 -8
  92. package/NameCards.js +3 -5
  93. package/NewsHero.d.ts +1 -1
  94. package/NewsHero.js +7 -9
  95. package/PageFilter.js +4 -6
  96. package/PageHeading.js +3 -5
  97. package/Picture.d.ts +7 -0
  98. package/Picture.js +11 -0
  99. package/ProcessOverview.js +3 -5
  100. package/PullQuote.js +2 -4
  101. package/RadioButtonsGroup.d.ts +1 -1
  102. package/RadioButtonsGroup.js +6 -8
  103. package/RadioGroup.d.ts +2 -2
  104. package/RadioGroup.js +6 -8
  105. package/RelatedLinks.js +4 -6
  106. package/RowBlock.js +3 -5
  107. package/RowBlockColumn.js +3 -5
  108. package/SearchInput.js +5 -41
  109. package/SearchResults/_SearchResultsItem.js +6 -8
  110. package/SearchResults.js +7 -32
  111. package/SeenEffect.js +3 -16
  112. package/Selectbox.js +6 -42
  113. package/ShareButtons.js +4 -26
  114. package/Sharpie.js +3 -5
  115. package/SiteSearchAutocomplete.js +5 -41
  116. package/SiteSearchCurtain.js +3 -28
  117. package/SiteSearchInput.d.ts +1 -1
  118. package/SiteSearchInput.js +4 -40
  119. package/Skeleton.js +4 -6
  120. package/SubHeading.js +3 -5
  121. package/Tabs.js +3 -28
  122. package/TagPill.d.ts +1 -1
  123. package/TagPill.js +7 -20
  124. package/TextBlock.js +3 -5
  125. package/TextButton.d.ts +1 -1
  126. package/TextButton.js +4 -6
  127. package/TextInput.js +5 -41
  128. package/VSpacer.js +3 -5
  129. package/VerticalTabsTOC.js +3 -28
  130. package/WizardLayout.js +7 -9
  131. package/WizardLayoutClose.d.ts +1 -1
  132. package/WizardLayoutClose.js +4 -6
  133. package/WizardStepper.js +3 -5
  134. package/_abstract/_AbstractCarousel.js +7 -32
  135. package/_abstract/_Blings.js +3 -5
  136. package/_abstract/_Block.d.ts +2 -2
  137. package/_abstract/_Block.js +7 -9
  138. package/_abstract/{Button.d.ts → _Button.d.ts} +0 -0
  139. package/_abstract/{Button.js → _Button.js} +6 -19
  140. package/{esm/_abstract/CardList.d.ts → _abstract/_CardList.d.ts} +2 -1
  141. package/_abstract/{CardList.js → _CardList.js} +12 -12
  142. package/{esm/_abstract/Image.d.ts → _abstract/_Image.d.ts} +9 -5
  143. package/_abstract/{Image.js → _Image.js} +5 -7
  144. package/_abstract/{Link.d.ts → _Link.d.ts} +0 -0
  145. package/_abstract/{Link.js → _Link.js} +2 -4
  146. package/_abstract/_Quote.js +4 -6
  147. package/{esm/_abstract/TogglerGroup.d.ts → _abstract/_TogglerGroup.d.ts} +1 -1
  148. package/_abstract/{TogglerGroup.js → _TogglerGroup.js} +8 -8
  149. package/{esm/_abstract/TogglerGroupField.d.ts → _abstract/_TogglerGroupField.d.ts} +2 -2
  150. package/_abstract/_TogglerGroupField.js +14 -0
  151. package/_abstract/{TogglerInput.d.ts → _TogglerInput.d.ts} +0 -0
  152. package/_abstract/{TogglerInput.js → _TogglerInput.js} +4 -17
  153. package/_abstract/breakOnNL.js +2 -4
  154. package/package.json +6 -365
  155. package/utils/env.js +2 -4
  156. package/utils/seenEffect.d.ts +2 -2
  157. package/utils/seenEffect.js +1 -1
  158. package/utils/useScrollbarWidthCSSVar.js +2 -4
  159. package/utils.js +3 -16
  160. package/_abstract/CardList.d.ts +0 -29
  161. package/_abstract/Image.d.ts +0 -32
  162. package/_abstract/TogglerGroup.d.ts +0 -31
  163. package/_abstract/TogglerGroupField.d.ts +0 -17
  164. package/_abstract/TogglerGroupField.js +0 -27
  165. package/esm/AccordionList.d.ts +0 -17
  166. package/esm/AccordionList.js +0 -24
  167. package/esm/ActionCards.d.ts +0 -5
  168. package/esm/ActionCards.js +0 -9
  169. package/esm/Alert.d.ts +0 -49
  170. package/esm/Alert.js +0 -92
  171. package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +0 -27
  172. package/esm/ArticleCarousel/_ArticleCarouselCard.js +0 -24
  173. package/esm/ArticleCarousel.d.ts +0 -12
  174. package/esm/ArticleCarousel.js +0 -8
  175. package/esm/ArticleMeta.d.ts +0 -9
  176. package/esm/ArticleMeta.js +0 -18
  177. package/esm/Attention.d.ts +0 -7
  178. package/esm/Attention.js +0 -4
  179. package/esm/BasicTable.d.ts +0 -12
  180. package/esm/BasicTable.js +0 -29
  181. package/esm/Bling.d.ts +0 -81
  182. package/esm/Bling.js +0 -44
  183. package/esm/BlockBreak.d.ts +0 -2
  184. package/esm/BlockBreak.js +0 -6
  185. package/esm/BlockQuote.d.ts +0 -4
  186. package/esm/BlockQuote.js +0 -4
  187. package/esm/BreadCrumbs.d.ts +0 -11
  188. package/esm/BreadCrumbs.js +0 -28
  189. package/esm/ButtonBack.d.ts +0 -7
  190. package/esm/ButtonBack.js +0 -4
  191. package/esm/ButtonBar.d.ts +0 -16
  192. package/esm/ButtonBar.js +0 -14
  193. package/esm/ButtonPrimary.d.ts +0 -7
  194. package/esm/ButtonPrimary.js +0 -4
  195. package/esm/ButtonSecondary.d.ts +0 -7
  196. package/esm/ButtonSecondary.js +0 -4
  197. package/esm/ButtonTertiary.d.ts +0 -12
  198. package/esm/ButtonTertiary.js +0 -15
  199. package/esm/Carousel.d.ts +0 -4
  200. package/esm/Carousel.js +0 -4
  201. package/esm/CarouselStepper.d.ts +0 -4
  202. package/esm/CarouselStepper.js +0 -4
  203. package/esm/CenterColumn.js +0 -7
  204. package/esm/Checkbox.d.ts +0 -4
  205. package/esm/Checkbox.js +0 -4
  206. package/esm/CheckboxButtonsGroup.d.ts +0 -11
  207. package/esm/CheckboxButtonsGroup.js +0 -14
  208. package/esm/CheckboxGroup.d.ts +0 -9
  209. package/esm/CheckboxGroup.js +0 -7
  210. package/esm/CityBlock.d.ts +0 -23
  211. package/esm/CityBlock.js +0 -18
  212. package/esm/ContactBubble.d.ts +0 -58
  213. package/esm/ContactBubble.js +0 -148
  214. package/esm/ContentArticle.d.ts +0 -15
  215. package/esm/ContentArticle.js +0 -21
  216. package/esm/ContentImage.d.ts +0 -8
  217. package/esm/ContentImage.js +0 -18
  218. package/esm/Datepicker.d.ts +0 -39
  219. package/esm/Datepicker.js +0 -63
  220. package/esm/ExtraLinks.d.ts +0 -18
  221. package/esm/ExtraLinks.js +0 -34
  222. package/esm/FeatureList.d.ts +0 -12
  223. package/esm/FeatureList.js +0 -16
  224. package/esm/FieldGroup.d.ts +0 -9
  225. package/esm/FieldGroup.js +0 -9
  226. package/esm/FileInput.d.ts +0 -17
  227. package/esm/FileInput.js +0 -154
  228. package/esm/Foonote.d.ts +0 -12
  229. package/esm/Foonote.js +0 -7
  230. package/esm/FooterBadges.d.ts +0 -9
  231. package/esm/FooterBadges.js +0 -12
  232. package/esm/FooterInfo.d.ts +0 -18
  233. package/esm/FooterInfo.js +0 -9
  234. package/esm/Footnote.d.ts +0 -6
  235. package/esm/Footnote.js +0 -3
  236. package/esm/Form.d.ts +0 -7
  237. package/esm/Form.js +0 -10
  238. package/esm/FormField.d.ts +0 -65
  239. package/esm/FormField.js +0 -91
  240. package/esm/Gallery/_GalleryItem.d.ts +0 -8
  241. package/esm/Gallery/_GalleryItem.js +0 -30
  242. package/esm/Gallery/_GalleryModal.d.ts +0 -6
  243. package/esm/Gallery/_GalleryModal.js +0 -54
  244. package/esm/Gallery/_GalleryModalContext.d.ts +0 -9
  245. package/esm/Gallery/_GalleryModalContext.js +0 -3
  246. package/esm/Gallery/_GalleryModalItem.d.ts +0 -3
  247. package/esm/Gallery/_GalleryModalItem.js +0 -22
  248. package/esm/Gallery.d.ts +0 -17
  249. package/esm/Gallery.js +0 -27
  250. package/esm/GridBlocks.d.ts +0 -26
  251. package/esm/GridBlocks.js +0 -24
  252. package/esm/Heading.d.ts +0 -16
  253. package/esm/Heading.js +0 -17
  254. package/esm/HeroBlock.d.ts +0 -19
  255. package/esm/HeroBlock.js +0 -21
  256. package/esm/IframeBlock.d.ts +0 -23
  257. package/esm/IframeBlock.js +0 -26
  258. package/esm/Illustration.d.ts +0 -13
  259. package/esm/Illustration.js +0 -8
  260. package/esm/ImageCards.d.ts +0 -8
  261. package/esm/ImageCards.js +0 -22
  262. package/esm/InfoBlock.d.ts +0 -17
  263. package/esm/InfoBlock.js +0 -13
  264. package/esm/InfoHero.d.ts +0 -17
  265. package/esm/InfoHero.js +0 -82
  266. package/esm/IslandBlock.d.ts +0 -25
  267. package/esm/IslandBlock.js +0 -16
  268. package/esm/IslandPageBlock.d.ts +0 -24
  269. package/esm/IslandPageBlock.js +0 -16
  270. package/esm/LabeledTextBlock.d.ts +0 -11
  271. package/esm/LabeledTextBlock.js +0 -14
  272. package/esm/Layout.d.ts +0 -33
  273. package/esm/Layout.js +0 -52
  274. package/esm/MainMenu/_Auxiliary.d.ts +0 -6
  275. package/esm/MainMenu/_Auxiliary.js +0 -13
  276. package/esm/MainMenu/_PrimaryPanel.d.ts +0 -13
  277. package/esm/MainMenu/_PrimaryPanel.js +0 -22
  278. package/esm/MainMenu.d.ts +0 -48
  279. package/esm/MainMenu.js +0 -136
  280. package/esm/MiniMetrics.d.ts +0 -8
  281. package/esm/MiniMetrics.js +0 -12
  282. package/esm/Modal.d.ts +0 -10
  283. package/esm/Modal.js +0 -14
  284. package/esm/NameCard.d.ts +0 -64
  285. package/esm/NameCard.js +0 -82
  286. package/esm/NameCards.d.ts +0 -6
  287. package/esm/NameCards.js +0 -7
  288. package/esm/NewsHero.d.ts +0 -14
  289. package/esm/NewsHero.js +0 -86
  290. package/esm/PageFilter.d.ts +0 -17
  291. package/esm/PageFilter.js +0 -15
  292. package/esm/PageHeading.d.ts +0 -10
  293. package/esm/PageHeading.js +0 -12
  294. package/esm/ProcessOverview.d.ts +0 -13
  295. package/esm/ProcessOverview.js +0 -17
  296. package/esm/PullQuote.d.ts +0 -4
  297. package/esm/PullQuote.js +0 -4
  298. package/esm/RadioButtonsGroup.d.ts +0 -11
  299. package/esm/RadioButtonsGroup.js +0 -14
  300. package/esm/RadioGroup.d.ts +0 -13
  301. package/esm/RadioGroup.js +0 -7
  302. package/esm/RelatedLinks.d.ts +0 -20
  303. package/esm/RelatedLinks.js +0 -26
  304. package/esm/RowBlock.d.ts +0 -12
  305. package/esm/RowBlock.js +0 -9
  306. package/esm/RowBlockColumn.d.ts +0 -8
  307. package/esm/RowBlockColumn.js +0 -11
  308. package/esm/SearchInput.d.ts +0 -18
  309. package/esm/SearchInput.js +0 -33
  310. package/esm/SearchResults/_SearchResultsItem.d.ts +0 -18
  311. package/esm/SearchResults/_SearchResultsItem.js +0 -15
  312. package/esm/SearchResults.d.ts +0 -33
  313. package/esm/SearchResults.js +0 -109
  314. package/esm/SeenEffect.d.ts +0 -4
  315. package/esm/SeenEffect.js +0 -19
  316. package/esm/Selectbox.d.ts +0 -8
  317. package/esm/Selectbox.js +0 -46
  318. package/esm/ShareButtons.d.ts +0 -9
  319. package/esm/ShareButtons.js +0 -51
  320. package/esm/Sharpie.d.ts +0 -23
  321. package/esm/Sharpie.js +0 -22
  322. package/esm/SiteSearchAutocomplete.d.ts +0 -40
  323. package/esm/SiteSearchAutocomplete.js +0 -58
  324. package/esm/SiteSearchCurtain.d.ts +0 -6
  325. package/esm/SiteSearchCurtain.js +0 -33
  326. package/esm/SiteSearchInput.d.ts +0 -24
  327. package/esm/SiteSearchInput.js +0 -40
  328. package/esm/Skeleton.d.ts +0 -25
  329. package/esm/Skeleton.js +0 -30
  330. package/esm/SubHeading.d.ts +0 -10
  331. package/esm/SubHeading.js +0 -13
  332. package/esm/Tabs.d.ts +0 -35
  333. package/esm/Tabs.js +0 -94
  334. package/esm/TagPill.d.ts +0 -27
  335. package/esm/TagPill.js +0 -43
  336. package/esm/TextBlock.d.ts +0 -15
  337. package/esm/TextBlock.js +0 -15
  338. package/esm/TextButton.d.ts +0 -9
  339. package/esm/TextButton.js +0 -9
  340. package/esm/TextInput.d.ts +0 -16
  341. package/esm/TextInput.js +0 -35
  342. package/esm/VSpacer.d.ts +0 -24
  343. package/esm/VSpacer.js +0 -41
  344. package/esm/VerticalTabsTOC.d.ts +0 -14
  345. package/esm/VerticalTabsTOC.js +0 -68
  346. package/esm/WizardLayout.d.ts +0 -15
  347. package/esm/WizardLayout.js +0 -30
  348. package/esm/WizardLayoutClose.d.ts +0 -3
  349. package/esm/WizardLayoutClose.js +0 -4
  350. package/esm/WizardStepper.d.ts +0 -36
  351. package/esm/WizardStepper.js +0 -25
  352. package/esm/_abstract/Button.d.ts +0 -40
  353. package/esm/_abstract/Button.js +0 -47
  354. package/esm/_abstract/CardList.js +0 -36
  355. package/esm/_abstract/Image.js +0 -27
  356. package/esm/_abstract/Link.d.ts +0 -27
  357. package/esm/_abstract/Link.js +0 -24
  358. package/esm/_abstract/TogglerGroup.js +0 -29
  359. package/esm/_abstract/TogglerGroupField.js +0 -22
  360. package/esm/_abstract/TogglerInput.d.ts +0 -22
  361. package/esm/_abstract/TogglerInput.js +0 -33
  362. package/esm/_abstract/_AbstractCarousel.d.ts +0 -25
  363. package/esm/_abstract/_AbstractCarousel.js +0 -130
  364. package/esm/_abstract/_Blings.d.ts +0 -11
  365. package/esm/_abstract/_Blings.js +0 -12
  366. package/esm/_abstract/_Block.d.ts +0 -22
  367. package/esm/_abstract/_Block.js +0 -24
  368. package/esm/_abstract/_Quote.d.ts +0 -9
  369. package/esm/_abstract/_Quote.js +0 -8
  370. package/esm/_abstract/breakOnNL.d.ts +0 -2
  371. package/esm/_abstract/breakOnNL.js +0 -8
  372. package/esm/assets.d.ts +0 -42
  373. package/esm/assets.js +0 -56
  374. package/esm/constants.d.ts +0 -39
  375. package/esm/constants.js +0 -22
  376. package/esm/focus-visible.d.ts +0 -1
  377. package/esm/focus-visible.js +0 -1
  378. package/esm/package.json +0 -1
  379. package/esm/utils/env.d.ts +0 -1
  380. package/esm/utils/env.js +0 -8
  381. package/esm/utils/seenEffect.d.ts +0 -28
  382. package/esm/utils/seenEffect.js +0 -73
  383. package/esm/utils/useFormatMonitor.d.ts +0 -38
  384. package/esm/utils/useFormatMonitor.js +0 -41
  385. package/esm/utils/useGetSVGtext.d.ts +0 -6
  386. package/esm/utils/useGetSVGtext.js +0 -19
  387. package/esm/utils/useMenuToggling.d.ts +0 -8
  388. package/esm/utils/useMenuToggling.js +0 -62
  389. package/esm/utils/useScrollbarWidthCSSVar.d.ts +0 -1
  390. package/esm/utils/useScrollbarWidthCSSVar.js +0 -3
  391. package/esm/utils.d.ts +0 -2
  392. package/esm/utils.js +0 -2
@@ -1,20 +0,0 @@
1
- declare const types: {
2
- readonly external: 1;
3
- readonly document: 1;
4
- readonly pdf: 1;
5
- readonly link: 0;
6
- };
7
- export declare type RelatedLinkType = keyof typeof types;
8
- export declare type RelatedLinkItem = {
9
- href: string;
10
- label: string;
11
- target?: string;
12
- type?: RelatedLinkType;
13
- };
14
- export declare type RelatedLinksProps = {
15
- title?: string;
16
- titleTag?: 'h2' | 'h3' | 'h4' | 'h5';
17
- links: Array<RelatedLinkItem>;
18
- };
19
- declare const RelatedLinks: (props: RelatedLinksProps) => JSX.Element | null;
20
- export default RelatedLinks;
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { Link } from './_abstract/Link';
3
- const types = {
4
- external: 1,
5
- document: 1,
6
- pdf: 1,
7
- link: 0,
8
- };
9
- const RelatedLinks = (props) => {
10
- const { title, links } = props;
11
- if (links.length === 0) {
12
- return null;
13
- }
14
- const TitleTag = props.titleTag || 'h3';
15
- return (React.createElement("div", { className: "RelatedLinks" },
16
- title && React.createElement(TitleTag, { className: "RelatedLinks__title" }, title),
17
- React.createElement("ul", { className: "RelatedLinks__list" }, links.map(({ href, label, type, target }, i) => {
18
- type = type && types[type] ? type : undefined;
19
- return (React.createElement("li", { key: i, className: "RelatedLinks__item" },
20
- React.createElement(Link, { className: "RelatedLinks__link", href: href, "data-type": type, target: target },
21
- ' ',
22
- label,
23
- ' ')));
24
- }))));
25
- };
26
- export default RelatedLinks;
package/esm/RowBlock.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { BemPropsModifier } from '@hugsmidjan/react/types';
3
- import { SeenProp } from './utils/seenEffect';
4
- export declare type RowBlockProps = {
5
- /** Float the first RowBlockColumn to the right on larger screens. */
6
- right?: boolean;
7
- /** Custom **additional** class-name */
8
- className?: string;
9
- children: ReactNode;
10
- } & BemPropsModifier & SeenProp;
11
- declare const RowBlock: (props: RowBlockProps) => JSX.Element;
12
- export default RowBlock;
package/esm/RowBlock.js DELETED
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- import { useSeenEffect } from './utils/seenEffect';
4
- const RowBlock = (props) => {
5
- const { right, modifier, className, children, startSeen } = props;
6
- const [ref] = useSeenEffect(startSeen);
7
- return (React.createElement("div", { className: getBemClass('RowBlock', [modifier, right && 'align--right'], className), ref: ref }, children));
8
- };
9
- export default RowBlock;
@@ -1,8 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare type RowBlockColumnProps = {
3
- background?: boolean | 'primary';
4
- narrow?: boolean;
5
- children: ReactNode;
6
- };
7
- declare const RowBlockColumn: (props: RowBlockColumnProps) => JSX.Element;
8
- export default RowBlockColumn;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- const RowBlockColumn = (props) => {
4
- const { background, narrow, children } = props;
5
- return (React.createElement("div", { className: getBemClass('RowBlockColumn', [
6
- narrow && 'narrow',
7
- background && 'background',
8
- background === 'primary' && 'background--primary',
9
- ]) }, children));
10
- };
11
- export default RowBlockColumn;
@@ -1,18 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { FormFieldWrappingProps } from './FormField';
3
- declare type InputElmProps = JSX.IntrinsicElements['input'];
4
- declare type BaseProps<Type extends {
5
- type?: string;
6
- }, InputProps extends object> = {
7
- small?: boolean;
8
- children?: undefined;
9
- onButtonClick?: () => void;
10
- buttonText?: string;
11
- inputRef?: RefObject<HTMLInputElement>;
12
- buttonRef?: RefObject<HTMLButtonElement>;
13
- } & Type & FormFieldWrappingProps & InputProps;
14
- export declare type SearchInputProps = BaseProps<{
15
- type?: 'text';
16
- }, InputElmProps>;
17
- declare const SearchInput: (props: SearchInputProps) => JSX.Element;
18
- export default SearchInput;
@@ -1,33 +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, { useState } from 'react';
13
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
14
- import FormField from './FormField';
15
- const SearchInput = (props) => {
16
- var _a;
17
- const { className, label, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, onChange, small, onButtonClick, buttonText = 'Leita', ssr } = props, inputElementProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "onChange", "small", "onButtonClick", "buttonText", "ssr"]);
18
- const { value, defaultValue, placeholder } = inputElementProps;
19
- const [hasValue, setHasValue] = useState(undefined);
20
- const filled = !!((_a = value !== null && value !== void 0 ? value : hasValue) !== null && _a !== void 0 ? _a : !!defaultValue);
21
- const empty = !filled && !placeholder;
22
- const _onChange = value != null
23
- ? onChange
24
- : (e) => {
25
- setHasValue(!!e.target.value);
26
- onChange && onChange(e);
27
- };
28
- return (React.createElement(FormField, { className: getBemClass('SearchInput', [], className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
29
- React.createElement("input", Object.assign({ className: "SearchInput__input", onChange: _onChange }, inputProps, inputElementProps, { ref: props.inputRef })),
30
- ' ',
31
- onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef }, buttonText)))) }));
32
- };
33
- export default SearchInput;
@@ -1,18 +0,0 @@
1
- declare type MetaValue = string | (() => JSX.Element | string | number);
2
- export declare type SearchResultsItemProps = {
3
- /** Plain text title */
4
- title: string;
5
- /** Simple HTML-encoded summary (excluding any layout) */
6
- summary: string;
7
- href: string;
8
- meta?: MetaValue | ReadonlyArray<MetaValue>;
9
- /**
10
- * URL to the image to display with the result item.
11
- * Should ideally be approximately 600-700px wide
12
- */
13
- image?: string;
14
- /** Should this search-result item be displayed as a "major"/"main" result at the top */
15
- highlight?: boolean;
16
- };
17
- declare const SearchResultsItem: (props: SearchResultsItemProps) => JSX.Element;
18
- export default SearchResultsItem;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import Image from '../_abstract/Image';
3
- import { Link } from '../_abstract/Link';
4
- const SearchResultsItem = (props) => {
5
- const { highlight, title, summary, href, meta, image } = props;
6
- const bem = highlight ? 'SearchResultsHighlightItem' : 'SearchResultsItem';
7
- const metaArr = (Array.isArray(meta) ? meta : [meta]);
8
- return (React.createElement("li", { className: bem },
9
- React.createElement(Link, { className: bem + '__link', href: href },
10
- React.createElement("h3", { className: bem + '__title' }, title),
11
- metaArr.length > 0 && (React.createElement("span", { className: bem + '__meta' }, metaArr.map((item, i) => typeof item === 'function' ? item() : item && React.createElement("span", { key: i }, item)))),
12
- highlight && image && React.createElement(Image, { className: bem + '__image', src: image }),
13
- React.createElement("div", { className: bem + '__summary', dangerouslySetInnerHTML: { __html: summary } }))));
14
- };
15
- export default SearchResultsItem;
@@ -1,33 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { SearchResultsItemProps } from './SearchResults/_SearchResultsItem';
3
- export declare type SearchReesultI18n = {
4
- lang: string;
5
- loadQueryTitle: string;
6
- resultsTitle: string;
7
- noResultsTitle: string;
8
- loadMore: string;
9
- };
10
- export declare type SearchStatus = 'loadingquery' | 'loadingfilter' | 'error' | 'results' | 'loadingmore';
11
- export declare type SearchResultsFilter = {
12
- label: string;
13
- count?: number;
14
- };
15
- export type { SearchResultsItemProps } from './SearchResults/_SearchResultsItem';
16
- export declare type SearchResultsProps = {
17
- totalHits?: number;
18
- hits?: number;
19
- query?: string;
20
- items?: Array<SearchResultsItemProps>;
21
- filters?: Array<SearchResultsFilter>;
22
- activeFilterIdx?: number;
23
- setFilter?: (activeTab: number) => void;
24
- status: SearchStatus;
25
- errorText?: string | ReactNode;
26
- pageSize: number;
27
- pages?: number;
28
- loadMore?: () => void;
29
- texts?: SearchReesultI18n;
30
- lang?: string;
31
- };
32
- declare const SearchResults: (props: SearchResultsProps) => JSX.Element;
33
- export default SearchResults;
@@ -1,109 +0,0 @@
1
- import React, { useEffect, useMemo, useRef } from 'react';
2
- import { useInView } from 'react-intersection-observer';
3
- import { prettyNum } from '@hugsmidjan/qj/prettyNum';
4
- import range from '@hugsmidjan/qj/range';
5
- import { useDomid } from '@hugsmidjan/react/hooks';
6
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
7
- import { DEFAULT_LANG, getTexts } from '@reykjavik/hanna-utils/i18n';
8
- import SearchResultsItem from './SearchResults/_SearchResultsItem';
9
- import Alert from './Alert';
10
- import Tabs from './Tabs';
11
- const renderDefaultErrorText = () => (React.createElement(React.Fragment, null,
12
- "\u00DAps, \u00FEa\u00F0 hefur komi\u00F0 upp villa. M\u00E1 bj\u00F3\u00F0a \u00FE\u00E9r a\u00F0 pr\u00F3fa aftur a\u00F0 leita?",
13
- React.createElement("br", null),
14
- "Ef ekkert l\u00E1t er \u00E1 villunni \u00FE\u00E1 kunnum vi\u00F0 a\u00F0 meta a\u00F0 \u00FE\u00FA l\u00E1tir okkur vita."));
15
- const defaultTexts = {
16
- en: {
17
- lang: 'en',
18
- loadQueryTitle: 'Loading results...',
19
- resultsTitle: 'results found for',
20
- noResultsTitle: 'No results were found for',
21
- loadMore: 'Load more',
22
- // loadingMore: 'Loading...',
23
- },
24
- is: {
25
- lang: 'is',
26
- loadQueryTitle: 'Sæki niðurstöður...',
27
- resultsTitle: 'leitarniðurstöður fyrir',
28
- noResultsTitle: 'Engar leitarniðurstöður fundust fyrir',
29
- loadMore: 'Sækja fleiri',
30
- // loadingMore: 'Sæki fleiri...',
31
- },
32
- };
33
- const SearchResults_Tabs = (props) => {
34
- const { domid, filters, activeIdx, setFilter, lang } = props;
35
- const tabs = useMemo(() => (filters || []).map(({ label, count }) => ({
36
- label,
37
- badge: prettyNum(count, { lang }),
38
- })), [filters, lang]);
39
- return tabs.length ? (React.createElement(Tabs, { role: "tablist", "aria-controls": domid, tabs: tabs, activeIdx: activeIdx || 0, onSetActive: (i) => setFilter && setFilter(i) })) : null;
40
- };
41
- const LoadingScaffold = (props) => props.count ? (React.createElement("ol", { className: "SearchResults__list SearchResults__list--loading" }, range(1, props.count).map((item, i) => (React.createElement(SearchResultsItem, { key: i, title: "...", summary: "", href: "" }))))) : null;
42
- // ===========================================================================
43
- const NUM_AUTOLOADS = 2;
44
- const SearchResults__loadmore = (props) => {
45
- const { status, hits, numItems, loadMore, pageSize, texts } = props;
46
- const { lang } = texts;
47
- const moreCount = (hits || 0) - (numItems || 0);
48
- const autoLoadCount = useRef(0);
49
- const skip = !loadMore || autoLoadCount.current >= NUM_AUTOLOADS;
50
- const [refFn, theEndIsNigh] = useInView({
51
- rootMargin: '150px 0px 0px 0px',
52
- skip, // disable after two clicks
53
- });
54
- useEffect(() => {
55
- if (theEndIsNigh && loadMore) {
56
- autoLoadCount.current = autoLoadCount.current + 1;
57
- loadMore();
58
- }
59
- }, [theEndIsNigh, loadMore]);
60
- const moreAvailable = status === 'results' && moreCount && loadMore;
61
- return status === 'loadingmore' ? (React.createElement(LoadingScaffold, { count: Math.min(pageSize, moreCount) })) : moreAvailable ? (React.createElement("button", { ref: refFn, className: "SearchResults__loadmore", type: "button", onClick: loadMore },
62
- texts.loadMore,
63
- ' ',
64
- React.createElement("span", { className: "SearchResults__loadmore__count" },
65
- "(",
66
- prettyNum(moreCount, { lang }),
67
- ")"))) : null;
68
- };
69
- // ===========================================================================
70
- const renderTitle = (props, texts) => {
71
- const { status, totalHits, query } = props;
72
- const lang = texts.lang || props.lang || DEFAULT_LANG;
73
- return (React.createElement("h2", { className: "SearchResults__title" },
74
- status === 'loadingquery'
75
- ? texts.loadQueryTitle
76
- : totalHits
77
- ? prettyNum(totalHits, { lang: lang }) +
78
- ' ' +
79
- texts.resultsTitle
80
- : texts.noResultsTitle,
81
- React.createElement("span", { className: "SearchResults__query" }, query)));
82
- };
83
- // ---------------------------------------------------------------------------
84
- const renderResults = (props) => {
85
- const { status, pageSize, items, hits } = props;
86
- if (status === 'loadingquery' || status === 'loadingfilter') {
87
- return React.createElement(LoadingScaffold, { count: Math.min(pageSize, hits || 999) });
88
- }
89
- return items && items.length ? (React.createElement("ol", { className: "SearchResults__list" }, items.map((item, i) => (React.createElement(SearchResultsItem, Object.assign({ key: i }, item)))))) : null;
90
- };
91
- // ---------------------------------------------------------------------------
92
- const renderLoadMore = (props, texts) => {
93
- const { hits, items, status, pageSize, loadMore } = props;
94
- return (React.createElement(SearchResults__loadmore, { hits: hits, numItems: items && items.length, status: status, pageSize: pageSize, loadMore: loadMore, texts: texts }));
95
- };
96
- // TODO: add plural translation thingy for result string
97
- const SearchResults = (props) => {
98
- const { filters, activeFilterIdx, setFilter, status, errorText } = props;
99
- const texts = getTexts(props, defaultTexts);
100
- const domid = useDomid();
101
- return (React.createElement("div", { className: getBemClass('SearchResults', status !== 'results' && status) },
102
- renderTitle(props, texts),
103
- React.createElement(SearchResults_Tabs, { domid: domid, filters: filters, activeIdx: activeFilterIdx, setFilter: setFilter, lang: texts.lang }),
104
- React.createElement("div", { className: "SearchResults__results", id: domid },
105
- renderResults(props),
106
- status === 'error' && (React.createElement(Alert, { type: "error" }, errorText || renderDefaultErrorText())),
107
- renderLoadMore(props, texts))));
108
- };
109
- export default SearchResults;
@@ -1,4 +0,0 @@
1
- import { EffectProp, SeenProp } from './utils/seenEffect';
2
- export declare type SeenEffectProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & SeenProp & EffectProp;
3
- declare const SeenEffect: (props: SeenEffectProps) => JSX.Element;
4
- export default SeenEffect;
package/esm/SeenEffect.js DELETED
@@ -1,19 +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 { getEffectAttr, useSeenEffect } from './utils/seenEffect';
14
- const SeenEffect = (props) => {
15
- const { effectType, startSeen } = props, divProps = __rest(props, ["effectType", "startSeen"]);
16
- const [ref] = useSeenEffect(startSeen);
17
- return React.createElement("div", Object.assign({}, divProps, { ref: ref }, getEffectAttr(effectType)));
18
- };
19
- export default SeenEffect;
@@ -1,8 +0,0 @@
1
- import { SelectboxProps as _SelectboxProps } from '@hugsmidjan/react/Selectbox';
2
- import { FormFieldWrappingProps } from './FormField';
3
- export declare type SelectboxProps = FormFieldWrappingProps & Omit<_SelectboxProps, 'bem'> & {
4
- small?: boolean;
5
- };
6
- export type { SelectboxOptions } from '@hugsmidjan/react/Selectbox';
7
- declare const Selectbox: (props: SelectboxProps) => JSX.Element;
8
- export default Selectbox;
package/esm/Selectbox.js DELETED
@@ -1,46 +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, { useEffect, useRef, useState } from 'react';
13
- import _Selectbox from '@hugsmidjan/react/Selectbox';
14
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
15
- import FormField from './FormField';
16
- const getValue = (opt) => {
17
- const val = typeof opt === 'object' ? opt.value : opt;
18
- return typeof val === 'number' ? String(val) : val;
19
- };
20
- const Selectbox = (props) => {
21
- var _a;
22
- const { className, label, assistText, hideLabel, disabled, readOnly, reqText, invalid, errorMessage, required, id, ssr, onChange, small } = props, selectProps = __rest(props, ["className", "label", "assistText", "hideLabel", "disabled", "readOnly", "reqText", "invalid", "errorMessage", "required", "id", "ssr", "onChange", "small"]);
23
- const { value, defaultValue, placeholder, options } = selectProps;
24
- const _selectRef = useRef(null);
25
- const selectRef = selectProps.selectRef || _selectRef;
26
- const getInitialValue = () => { var _a; return (_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : getValue(options[0]); };
27
- const [isFilled, setIsFilled] = useState(() => !!getInitialValue());
28
- const [isEmpty, setIsEmpty] = useState(() => !getInitialValue() && !placeholder);
29
- useEffect(() => {
30
- var _a;
31
- const selectElm = selectRef.current;
32
- if (selectElm) {
33
- setIsFilled(!!selectElm.value);
34
- setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
35
- }
36
- }, [(_a = selectRef.current) === null || _a === void 0 ? void 0 : _a.value]);
37
- const _onChange = (e) => {
38
- var _a;
39
- const selectElm = e.currentTarget;
40
- setIsFilled(!!selectElm.value);
41
- setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
42
- onChange && onChange(e);
43
- };
44
- return (React.createElement(FormField, { className: getBemClass('Selectbox', null, className), ssr: ssr, small: small, label: label, empty: isEmpty, filled: isFilled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement(_Selectbox, Object.assign({ bem: className.input, ssr: ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) }));
45
- };
46
- export default Selectbox;
@@ -1,9 +0,0 @@
1
- import { SSRSupport } from '@hugsmidjan/react/hooks';
2
- import { ShareButtonI18n, ShareButtonPlatforms } from '@reykjavik/hanna-utils/shareButtonsUtils';
3
- export declare type ShareButtonsProps = {
4
- ssr?: SSRSupport;
5
- children?: undefined;
6
- texts?: Readonly<ShareButtonI18n>;
7
- } & Partial<Record<ShareButtonPlatforms, boolean>>;
8
- declare const ShareButtons: (props: ShareButtonsProps) => JSX.Element | null;
9
- export default ShareButtons;
@@ -1,51 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { getDocMeta, getShareButtonLabel, i18n, openInPopup, shareButtonTypes, } from '@reykjavik/hanna-utils/shareButtonsUtils';
3
- import { Link } from './_abstract/Link';
4
- const generateTypeList = (facebook, twitter, linkedin, email) => {
5
- const listStr = ((facebook ? 'facebook,' : '') +
6
- (twitter ? 'twitter,' : '') +
7
- (linkedin ? 'linkedin,' : '') +
8
- (email ? 'email,' : '')).slice(0, -1);
9
- return (listStr !== 'facebook,twitter' && listStr) || undefined;
10
- };
11
- // FIXME: see other FIXME below for details
12
- // TODO: Also figure out if/why the truthyness of document.location would be in doubt here
13
- const docLoc = typeof document !== 'undefined' ? document.location : { href: undefined };
14
- const ShareButtons__item = (props) => {
15
- const { label, type, href } = props;
16
- const buttonText = getShareButtonLabel(type, label);
17
- const popup = type !== 'email';
18
- return (React.createElement("li", { className: "ShareButtons__item" },
19
- React.createElement(Link, { className: 'ShareButtons__link ShareButtons__link--' + type, href: href, title: buttonText, rel: "noopener noreferrer", target: popup ? '_blank' : undefined, onClick: popup ? openInPopup : undefined }, buttonText)));
20
- };
21
- const ShareButtons = (props) => {
22
- const { texts, ssr, facebook = true, twitter = true, linkedin, email, } = props;
23
- const [docMeta, setDocMeta] = useState();
24
- const href = docLoc.href; // assign to local variable to silence `react-hooks/exhaustive-deps`
25
- useEffect(() => {
26
- // FIXME: Drop dependency on _loc.href and set up proper
27
- // location/route monitoring event handler, with unsubscribe on unmount
28
- const { emailSubject } = texts || {};
29
- setDocMeta(getDocMeta({ emailSubject }));
30
- }, [texts, href]);
31
- if (!facebook && !twitter && !linkedin && !email) {
32
- // no place to share
33
- return null;
34
- }
35
- const txt = texts || (docMeta && i18n[docMeta.lang]) || {};
36
- const { label, buttonLabel } = txt;
37
- if (!docMeta || ssr === 'ssr-only') {
38
- // Generate SSR markup for hanna-sprinkles to pick up on.
39
- return (React.createElement("div", { className: "ShareButtons", "data-button-types": generateTypeList(facebook, twitter, linkedin, email), "data-label": label, "data-buttonlabel": buttonLabel, "data-emailsubject": txt.emailSubject || undefined }));
40
- }
41
- const showTypes = {
42
- facebook,
43
- twitter,
44
- linkedin,
45
- email,
46
- };
47
- return (React.createElement("div", { className: "ShareButtons", "aria-label": label, "data-sprinkled": "true" },
48
- label && React.createElement("strong", { className: "ShareButtons__label" }, label),
49
- React.createElement("ul", { className: "ShareButtons__list" }, shareButtonTypes.map((type) => showTypes[type] && (React.createElement(ShareButtons__item, { key: type, type: type, label: buttonLabel || '', href: docMeta.hrefs[type] }))))));
50
- };
51
- export default ShareButtons;
package/esm/Sharpie.d.ts DELETED
@@ -1,23 +0,0 @@
1
- import { ReactNode } from 'react';
2
- declare const colors: {
3
- green: number;
4
- red: number;
5
- };
6
- declare type SharpieColor = keyof typeof colors;
7
- declare const tags: {
8
- span: number;
9
- strong: number;
10
- em: number;
11
- b: number;
12
- i: number;
13
- u: number;
14
- s: number;
15
- };
16
- declare type SharpieTag = keyof typeof tags;
17
- export declare type SharpieProps = {
18
- color: SharpieColor;
19
- tag?: SharpieTag;
20
- children: ReactNode;
21
- };
22
- declare const Sharpie: (props: SharpieProps) => JSX.Element;
23
- export default Sharpie;
package/esm/Sharpie.js DELETED
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- import getBemClass from '@hugsmidjan/react/utils/getBemClass';
3
- const colors = {
4
- green: 1,
5
- red: 1,
6
- };
7
- const tags = {
8
- span: 1,
9
- strong: 1,
10
- em: 1,
11
- b: 1,
12
- i: 1,
13
- u: 1,
14
- s: 1,
15
- };
16
- const Sharpie = (props) => {
17
- const { color, tag, children } = props;
18
- const colorModifier = colors[color] ? color : 'green';
19
- const Tag = tag && tags[tag] ? tag : 'span';
20
- return React.createElement(Tag, { className: getBemClass('Sharpie', colorModifier) }, children);
21
- };
22
- export default Sharpie;
@@ -1,40 +0,0 @@
1
- import React from 'react';
2
- import Autosuggest, { RenderSuggestion } from 'react-autosuggest';
3
- import { BemProps } from '@hugsmidjan/react/types';
4
- import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
5
- export declare type SiteSearchACI18n = {
6
- lang?: string;
7
- /** Label for the autocomplete's combobox container div */
8
- label: string;
9
- /** Label for the text input */
10
- inputLabel: string;
11
- /** Placeholder text for the text input */
12
- placeholder?: string;
13
- /** Label for the suggestions item list container */
14
- suggestionsLabel: string;
15
- };
16
- export declare const defaultSiteSearchACTexts: DefaultTexts<SiteSearchACI18n>;
17
- export declare type SiteSearchAutocompleteProps<T> = {
18
- suggestions: Array<T>;
19
- renderSuggestion: RenderSuggestion<T>;
20
- setSuggestions: (suggestions: Array<T>) => void;
21
- getSuggestionValue: (suggestion: T) => string;
22
- onSuggestionsFetchRequested: (request: Autosuggest.SuggestionsFetchRequestedParams) => void;
23
- onSuggestionSelected?: (event: React.FormEvent<HTMLElement>, data: Autosuggest.SuggestionSelectedEventData<T>) => void;
24
- onSuggestionHighlighted?: (params: {
25
- suggestion: T;
26
- }) => void;
27
- /** Triggered when user hits ENTER key with the focus inside the input field */
28
- onSubmit?: (value: string) => void;
29
- /** Custom action to perform when the user clicks the search button
30
- *
31
- * Defaults to `onSubmit`
32
- */
33
- onButtonClick?: (value: string) => void;
34
- lang?: string;
35
- texts?: SiteSearchACI18n;
36
- /** @deprecated Use `text` prop instead (will be removed in v0.11) */
37
- label?: string;
38
- } & BemProps;
39
- declare const SiteSearchAutocomplete: <T>(props: SiteSearchAutocompleteProps<T>) => JSX.Element;
40
- export default SiteSearchAutocomplete;
@@ -1,58 +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, { createRef, useState } from 'react';
13
- import Autosuggest from 'react-autosuggest';
14
- import { getTexts } from '@reykjavik/hanna-utils/i18n';
15
- import SiteSearchInput from './SiteSearchInput';
16
- export const defaultSiteSearchACTexts = {
17
- is: {
18
- lang: 'is',
19
- label: 'Leit á vefnum',
20
- inputLabel: 'Leitarorð',
21
- placeholder: 'Sláðu inn leitarorð',
22
- suggestionsLabel: 'Tillögur',
23
- },
24
- en: {
25
- lang: 'en',
26
- label: 'Site search',
27
- inputLabel: 'Search terms',
28
- placeholder: 'Enter search terms',
29
- suggestionsLabel: 'Suggestions',
30
- },
31
- };
32
- const SiteSearchAutocomplete = (props) => {
33
- const { suggestions, setSuggestions, renderSuggestion, getSuggestionValue, onSuggestionsFetchRequested, onSuggestionSelected, onSuggestionHighlighted, onSubmit, onButtonClick = onSubmit, bem = 'SiteSearchAutocomplete', } = props;
34
- const [value, setValue] = useState('');
35
- const inputRef = createRef();
36
- const txt = getTexts(props, defaultSiteSearchACTexts);
37
- return (React.createElement(Autosuggest, { theme: {
38
- container: bem,
39
- containerOpen: bem + '--open',
40
- suggestionsContainer: bem + '__container',
41
- suggestionsContainerOpen: bem + '__container--open',
42
- suggestionsList: bem + '__list',
43
- suggestion: bem + '__item',
44
- suggestionHighlighted: bem + '__item--highlighted',
45
- }, focusInputOnSuggestionClick: true, suggestions: suggestions, onSuggestionsClearRequested: () => setSuggestions([]), onSuggestionsFetchRequested: onSuggestionsFetchRequested, getSuggestionValue: getSuggestionValue, onSuggestionSelected: onSuggestionSelected, onSuggestionHighlighted: onSuggestionHighlighted, renderSuggestion: renderSuggestion, containerProps: { 'aria-label': txt.label }, renderSuggestionsContainer: ({ containerProps, children }) => (React.createElement("div", Object.assign({}, containerProps, { "aria-label": txt.suggestionsLabel }), children)), inputProps: {
46
- ref: inputRef,
47
- value: value,
48
- onChange: (_, { newValue }) => {
49
- setValue(newValue);
50
- },
51
- }, renderInputComponent: (inputProps) => {
52
- /* prettier-ignore */
53
- const { className, type, disabled, readOnly, required, children } = inputProps, //eslint-disable-line @typescript-eslint/no-unused-vars
54
- siteSearchProps = __rest(inputProps, ["className", "type", "disabled", "readOnly", "required", "children"]);
55
- return (React.createElement(SiteSearchInput, Object.assign({}, siteSearchProps, { label: props.label || txt.inputLabel, placeholder: txt.placeholder, onSubmit: onSubmit && (() => onSubmit(value)), onButtonClick: onButtonClick && (() => onButtonClick(value)) })));
56
- } }));
57
- };
58
- export default SiteSearchAutocomplete;
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- export declare type SiteSearchCurtain = {
3
- children: ReactNode;
4
- };
5
- declare const SiteSearchCurtain: (props: SiteSearchCurtain) => JSX.Element;
6
- export default SiteSearchCurtain;