@reykjavik/hanna-react 0.10.99 → 0.10.101

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 (344) hide show
  1. package/AccordionList.d.ts +2 -2
  2. package/AccordionList.js +2 -2
  3. package/ActionCards.d.ts +2 -1
  4. package/ActionCards.js +1 -1
  5. package/Alert.d.ts +2 -2
  6. package/Alert.js +20 -12
  7. package/ArticleCards.d.ts +4 -1
  8. package/ArticleCards.js +1 -1
  9. package/ArticleCarousel/_ArticleCarouselCard.js +1 -2
  10. package/ArticleCarousel.d.ts +2 -2
  11. package/ArticleCarousel.js +1 -1
  12. package/ArticleMeta.d.ts +2 -1
  13. package/ArticleMeta.js +2 -2
  14. package/Attention.d.ts +2 -1
  15. package/Attention.js +4 -1
  16. package/BasicTable.d.ts +2 -1
  17. package/BgBox.d.ts +2 -1
  18. package/BgBox.js +4 -2
  19. package/Bling.d.ts +2 -1
  20. package/Bling.js +5 -3
  21. package/BlockBreak.js +1 -0
  22. package/BreadCrumbs.d.ts +2 -1
  23. package/BreadCrumbs.js +3 -2
  24. package/ButtonBack.js +2 -0
  25. package/ButtonBar.d.ts +4 -3
  26. package/ButtonBar.js +3 -3
  27. package/ButtonPrimary.js +2 -0
  28. package/ButtonSecondary.js +2 -0
  29. package/ButtonTertiary.js +2 -0
  30. package/CHANGELOG.md +14 -1
  31. package/CarouselStepper.d.ts +2 -1
  32. package/CenterColumn.d.ts +2 -1
  33. package/CenterColumn.js +4 -2
  34. package/CheckboxButton.d.ts +4 -2
  35. package/CheckboxButtonsGroup.js +2 -2
  36. package/CityBlock.d.ts +2 -1
  37. package/CityBlock.js +1 -1
  38. package/ContactBubble.d.ts +2 -2
  39. package/ContactBubble.js +5 -4
  40. package/ContentArticle.d.ts +2 -1
  41. package/ContentArticle.js +3 -2
  42. package/ContentImage.d.ts +2 -1
  43. package/ContentImage.js +4 -3
  44. package/Datepicker.js +6 -6
  45. package/ExtraLinks.d.ts +2 -1
  46. package/ExtraLinks.js +4 -2
  47. package/FeatureList.d.ts +2 -1
  48. package/FeatureList.js +3 -2
  49. package/FieldGroup.d.ts +2 -1
  50. package/FieldGroup.js +4 -2
  51. package/FileInput.d.ts +2 -2
  52. package/FileInput.js +10 -5
  53. package/Foonote.js +3 -4
  54. package/Footnote.d.ts +2 -1
  55. package/Footnote.js +2 -1
  56. package/Form.js +4 -5
  57. package/FormField.d.ts +25 -5
  58. package/FormField.js +32 -7
  59. package/Gallery/_GalleryItem.js +2 -2
  60. package/Gallery/_GalleryModalItem.js +1 -1
  61. package/Gallery.d.ts +2 -2
  62. package/Gallery.js +5 -4
  63. package/GridBlocks.d.ts +2 -5
  64. package/GridBlocks.js +3 -3
  65. package/Heading.d.ts +2 -1
  66. package/Heading.js +3 -3
  67. package/HeroBlock.d.ts +2 -1
  68. package/HeroBlock.js +4 -3
  69. package/IframeBlock.d.ts +9 -4
  70. package/IframeBlock.js +13 -12
  71. package/Illustration.d.ts +2 -1
  72. package/Illustration.js +1 -1
  73. package/ImageCards.d.ts +2 -1
  74. package/ImageCards.js +2 -2
  75. package/InfoBlock.d.ts +2 -1
  76. package/InfoBlock.js +3 -2
  77. package/InfoHero.d.ts +2 -1
  78. package/InfoHero.js +3 -3
  79. package/IslandBlock.d.ts +2 -1
  80. package/IslandBlock.js +2 -2
  81. package/IslandPageBlock.d.ts +2 -1
  82. package/IslandPageBlock.js +2 -2
  83. package/LabeledTextBlock.d.ts +2 -1
  84. package/LabeledTextBlock.js +2 -2
  85. package/Layout.d.ts +2 -2
  86. package/Layout.js +3 -3
  87. package/MainMenu.d.ts +2 -2
  88. package/MainMenu.js +4 -3
  89. package/MiniMetrics.d.ts +2 -1
  90. package/MiniMetrics.js +3 -2
  91. package/Modal.d.ts +2 -1
  92. package/Multiselect.d.ts +11 -6
  93. package/Multiselect.js +15 -11
  94. package/NameCard.d.ts +2 -1
  95. package/NameCard.js +10 -6
  96. package/NameCards.d.ts +3 -2
  97. package/NameCards.js +3 -2
  98. package/NewsHero.d.ts +2 -1
  99. package/NewsHero.js +3 -3
  100. package/PageFilter.d.ts +2 -1
  101. package/PageFilter.js +2 -2
  102. package/PageHeading.d.ts +2 -1
  103. package/PageHeading.js +2 -5
  104. package/Picture.d.ts +2 -1
  105. package/Picture.js +1 -5
  106. package/ProcessOverview.d.ts +2 -1
  107. package/ProcessOverview.js +2 -5
  108. package/RadioButtonsGroup.js +2 -2
  109. package/RadioGroup.js +1 -1
  110. package/ReadSpeakerPlayer.d.ts +1 -1
  111. package/ReadSpeakerPlayer.js +2 -2
  112. package/RelatedLinks.d.ts +2 -1
  113. package/RelatedLinks.js +3 -2
  114. package/RowBlock.d.ts +2 -1
  115. package/RowBlock.js +2 -2
  116. package/RowBlockColumn.d.ts +2 -1
  117. package/RowBlockColumn.js +3 -3
  118. package/SearchInput.d.ts +3 -9
  119. package/SearchInput.js +4 -5
  120. package/SearchResults/_SearchResultsItem.js +1 -1
  121. package/SearchResults.d.ts +2 -1
  122. package/SearchResults.js +2 -2
  123. package/SeenEffect.js +2 -0
  124. package/Selectbox.js +3 -4
  125. package/ShareButtons.d.ts +2 -2
  126. package/ShareButtons.js +5 -3
  127. package/Sharpie.d.ts +2 -1
  128. package/Sharpie.js +2 -2
  129. package/SiteSearchAutocomplete.d.ts +2 -1
  130. package/SiteSearchAutocomplete.js +4 -4
  131. package/SiteSearchCurtain.js +2 -0
  132. package/SiteSearchInput.d.ts +3 -6
  133. package/SiteSearchInput.js +4 -4
  134. package/Skeleton.d.ts +4 -1
  135. package/Skeleton.js +15 -18
  136. package/SubHeading.d.ts +2 -1
  137. package/SubHeading.js +3 -3
  138. package/Tabs.d.ts +2 -2
  139. package/Tabs.js +5 -5
  140. package/TagPill.js +2 -0
  141. package/TextBlock.d.ts +2 -1
  142. package/TextBlock.js +3 -3
  143. package/TextButton.js +2 -0
  144. package/TextInput.d.ts +2 -2
  145. package/TextInput.js +3 -4
  146. package/Tooltip.d.ts +2 -1
  147. package/Tooltip.js +28 -15
  148. package/VSpacer.d.ts +2 -1
  149. package/VSpacer.js +3 -7
  150. package/VerticalTabsTOC.d.ts +1 -1
  151. package/VerticalTabsTOC.js +1 -1
  152. package/WizardLayout.d.ts +2 -2
  153. package/WizardLayout.js +4 -3
  154. package/WizardLayoutClose.js +2 -0
  155. package/WizardStepper.d.ts +2 -1
  156. package/WizardStepper.js +2 -2
  157. package/_abstract/_AbstractCarousel.d.ts +2 -2
  158. package/_abstract/_AbstractCarousel.js +6 -3
  159. package/_abstract/_Block.d.ts +2 -1
  160. package/_abstract/_Block.js +3 -3
  161. package/_abstract/_Button.js +4 -1
  162. package/_abstract/_CardList.d.ts +3 -1
  163. package/_abstract/_CardList.js +6 -3
  164. package/_abstract/_Image.d.ts +6 -3
  165. package/_abstract/_Image.js +11 -4
  166. package/_abstract/_Quote.d.ts +2 -1
  167. package/_abstract/_Quote.js +3 -2
  168. package/_abstract/_TogglerGroup.js +1 -1
  169. package/_abstract/_TogglerGroupField.js +5 -5
  170. package/_abstract/_TogglerInput.d.ts +2 -2
  171. package/_abstract/_TogglerInput.js +4 -2
  172. package/esm/AccordionList.d.ts +2 -2
  173. package/esm/AccordionList.js +3 -3
  174. package/esm/ActionCards.d.ts +2 -1
  175. package/esm/ActionCards.js +1 -1
  176. package/esm/Alert.d.ts +2 -2
  177. package/esm/Alert.js +21 -13
  178. package/esm/ArticleCards.d.ts +4 -1
  179. package/esm/ArticleCards.js +1 -1
  180. package/esm/ArticleCarousel/_ArticleCarouselCard.js +1 -2
  181. package/esm/ArticleCarousel.d.ts +2 -2
  182. package/esm/ArticleCarousel.js +1 -1
  183. package/esm/ArticleMeta.d.ts +2 -1
  184. package/esm/ArticleMeta.js +2 -2
  185. package/esm/Attention.d.ts +2 -1
  186. package/esm/Attention.js +4 -1
  187. package/esm/BasicTable.d.ts +2 -1
  188. package/esm/BgBox.d.ts +2 -1
  189. package/esm/BgBox.js +4 -2
  190. package/esm/Bling.d.ts +2 -1
  191. package/esm/Bling.js +5 -3
  192. package/esm/BlockBreak.js +1 -0
  193. package/esm/BreadCrumbs.d.ts +2 -1
  194. package/esm/BreadCrumbs.js +3 -2
  195. package/esm/ButtonBack.js +2 -0
  196. package/esm/ButtonBar.d.ts +4 -3
  197. package/esm/ButtonBar.js +3 -3
  198. package/esm/ButtonPrimary.js +2 -0
  199. package/esm/ButtonSecondary.js +2 -0
  200. package/esm/ButtonTertiary.js +2 -0
  201. package/esm/CarouselStepper.d.ts +2 -1
  202. package/esm/CenterColumn.d.ts +2 -1
  203. package/esm/CenterColumn.js +4 -2
  204. package/esm/CheckboxButton.d.ts +4 -2
  205. package/esm/CheckboxButtonsGroup.js +2 -2
  206. package/esm/CityBlock.d.ts +2 -1
  207. package/esm/CityBlock.js +1 -1
  208. package/esm/ContactBubble.d.ts +2 -2
  209. package/esm/ContactBubble.js +5 -4
  210. package/esm/ContentArticle.d.ts +2 -1
  211. package/esm/ContentArticle.js +3 -2
  212. package/esm/ContentImage.d.ts +2 -1
  213. package/esm/ContentImage.js +4 -3
  214. package/esm/Datepicker.js +7 -7
  215. package/esm/ExtraLinks.d.ts +2 -1
  216. package/esm/ExtraLinks.js +4 -2
  217. package/esm/FeatureList.d.ts +2 -1
  218. package/esm/FeatureList.js +3 -2
  219. package/esm/FieldGroup.d.ts +2 -1
  220. package/esm/FieldGroup.js +4 -2
  221. package/esm/FileInput.d.ts +2 -2
  222. package/esm/FileInput.js +10 -5
  223. package/esm/Foonote.js +2 -2
  224. package/esm/Footnote.d.ts +2 -1
  225. package/esm/Footnote.js +2 -1
  226. package/esm/Form.js +5 -5
  227. package/esm/FormField.d.ts +25 -5
  228. package/esm/FormField.js +30 -6
  229. package/esm/Gallery/_GalleryItem.js +2 -2
  230. package/esm/Gallery/_GalleryModalItem.js +1 -1
  231. package/esm/Gallery.d.ts +2 -2
  232. package/esm/Gallery.js +6 -5
  233. package/esm/GridBlocks.d.ts +2 -5
  234. package/esm/GridBlocks.js +3 -3
  235. package/esm/Heading.d.ts +2 -1
  236. package/esm/Heading.js +3 -3
  237. package/esm/HeroBlock.d.ts +2 -1
  238. package/esm/HeroBlock.js +4 -3
  239. package/esm/IframeBlock.d.ts +9 -4
  240. package/esm/IframeBlock.js +13 -12
  241. package/esm/Illustration.d.ts +2 -1
  242. package/esm/Illustration.js +1 -1
  243. package/esm/ImageCards.d.ts +2 -1
  244. package/esm/ImageCards.js +2 -2
  245. package/esm/InfoBlock.d.ts +2 -1
  246. package/esm/InfoBlock.js +3 -2
  247. package/esm/InfoHero.d.ts +2 -1
  248. package/esm/InfoHero.js +3 -3
  249. package/esm/IslandBlock.d.ts +2 -1
  250. package/esm/IslandBlock.js +2 -2
  251. package/esm/IslandPageBlock.d.ts +2 -1
  252. package/esm/IslandPageBlock.js +2 -2
  253. package/esm/LabeledTextBlock.d.ts +2 -1
  254. package/esm/LabeledTextBlock.js +2 -2
  255. package/esm/Layout.d.ts +2 -2
  256. package/esm/Layout.js +3 -3
  257. package/esm/MainMenu.d.ts +2 -2
  258. package/esm/MainMenu.js +4 -3
  259. package/esm/MiniMetrics.d.ts +2 -1
  260. package/esm/MiniMetrics.js +3 -2
  261. package/esm/Modal.d.ts +2 -1
  262. package/esm/Multiselect.d.ts +11 -6
  263. package/esm/Multiselect.js +15 -11
  264. package/esm/NameCard.d.ts +2 -1
  265. package/esm/NameCard.js +10 -6
  266. package/esm/NameCards.d.ts +3 -2
  267. package/esm/NameCards.js +3 -2
  268. package/esm/NewsHero.d.ts +2 -1
  269. package/esm/NewsHero.js +3 -3
  270. package/esm/PageFilter.d.ts +2 -1
  271. package/esm/PageFilter.js +2 -2
  272. package/esm/PageHeading.d.ts +2 -1
  273. package/esm/PageHeading.js +2 -5
  274. package/esm/Picture.d.ts +2 -1
  275. package/esm/Picture.js +1 -5
  276. package/esm/ProcessOverview.d.ts +2 -1
  277. package/esm/ProcessOverview.js +2 -5
  278. package/esm/RadioButtonsGroup.js +2 -2
  279. package/esm/RadioGroup.js +1 -1
  280. package/esm/ReadSpeakerPlayer.d.ts +1 -1
  281. package/esm/ReadSpeakerPlayer.js +2 -2
  282. package/esm/RelatedLinks.d.ts +2 -1
  283. package/esm/RelatedLinks.js +3 -2
  284. package/esm/RowBlock.d.ts +2 -1
  285. package/esm/RowBlock.js +2 -2
  286. package/esm/RowBlockColumn.d.ts +2 -1
  287. package/esm/RowBlockColumn.js +3 -3
  288. package/esm/SearchInput.d.ts +3 -9
  289. package/esm/SearchInput.js +4 -5
  290. package/esm/SearchResults/_SearchResultsItem.js +1 -1
  291. package/esm/SearchResults.d.ts +2 -1
  292. package/esm/SearchResults.js +2 -2
  293. package/esm/SeenEffect.js +2 -0
  294. package/esm/Selectbox.js +3 -4
  295. package/esm/ShareButtons.d.ts +2 -2
  296. package/esm/ShareButtons.js +5 -3
  297. package/esm/Sharpie.d.ts +2 -1
  298. package/esm/Sharpie.js +2 -2
  299. package/esm/SiteSearchAutocomplete.d.ts +2 -1
  300. package/esm/SiteSearchAutocomplete.js +4 -4
  301. package/esm/SiteSearchCurtain.js +2 -0
  302. package/esm/SiteSearchInput.d.ts +3 -6
  303. package/esm/SiteSearchInput.js +4 -4
  304. package/esm/Skeleton.d.ts +4 -1
  305. package/esm/Skeleton.js +15 -18
  306. package/esm/SubHeading.d.ts +2 -1
  307. package/esm/SubHeading.js +3 -3
  308. package/esm/Tabs.d.ts +2 -2
  309. package/esm/Tabs.js +5 -5
  310. package/esm/TagPill.js +2 -0
  311. package/esm/TextBlock.d.ts +2 -1
  312. package/esm/TextBlock.js +3 -3
  313. package/esm/TextButton.js +2 -0
  314. package/esm/TextInput.d.ts +2 -2
  315. package/esm/TextInput.js +3 -4
  316. package/esm/Tooltip.d.ts +2 -1
  317. package/esm/Tooltip.js +28 -15
  318. package/esm/VSpacer.d.ts +2 -1
  319. package/esm/VSpacer.js +3 -7
  320. package/esm/VerticalTabsTOC.d.ts +1 -1
  321. package/esm/VerticalTabsTOC.js +1 -1
  322. package/esm/WizardLayout.d.ts +2 -2
  323. package/esm/WizardLayout.js +4 -3
  324. package/esm/WizardLayoutClose.js +2 -0
  325. package/esm/WizardStepper.d.ts +2 -1
  326. package/esm/WizardStepper.js +2 -2
  327. package/esm/_abstract/_AbstractCarousel.d.ts +2 -2
  328. package/esm/_abstract/_AbstractCarousel.js +6 -3
  329. package/esm/_abstract/_Block.d.ts +2 -1
  330. package/esm/_abstract/_Block.js +3 -3
  331. package/esm/_abstract/_Button.js +4 -1
  332. package/esm/_abstract/_CardList.d.ts +3 -1
  333. package/esm/_abstract/_CardList.js +6 -3
  334. package/esm/_abstract/_Image.d.ts +6 -3
  335. package/esm/_abstract/_Image.js +12 -5
  336. package/esm/_abstract/_Quote.d.ts +2 -1
  337. package/esm/_abstract/_Quote.js +3 -2
  338. package/esm/_abstract/_TogglerGroup.js +1 -1
  339. package/esm/_abstract/_TogglerGroupField.js +5 -5
  340. package/esm/_abstract/_TogglerInput.d.ts +2 -2
  341. package/esm/_abstract/_TogglerInput.js +4 -2
  342. package/esm/utils.d.ts +25 -2
  343. package/package.json +1 -1
  344. package/utils.d.ts +25 -2
package/esm/Foonote.js CHANGED
@@ -1,7 +1,7 @@
1
- import _Footnote from './Footnote.js';
1
+ import { Footnote as _Footnote } from './Footnote.js';
2
2
  /** @deprecated (Will be removed in v0.11)
3
3
  *
4
4
  * This module file is a typo. import from `Footnote` instead
5
5
  */
6
6
  export const Footnote = _Footnote;
7
- export default Footnote;
7
+ export default Footnote; // eslint-disable-line deprecation/deprecation
package/esm/Footnote.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
+ import { WrapperElmProps } from './utils.js';
2
3
  export type FootnoteProps = {
3
4
  children: ReactNode;
4
- };
5
+ } & WrapperElmProps;
5
6
  export declare const Footnote: (props: FootnoteProps) => JSX.Element;
6
7
  export default Footnote;
package/esm/Footnote.js CHANGED
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
- export const Footnote = (props) => (React.createElement("div", { className: "Footnote" }, props.children));
2
+ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
3
+ export const Footnote = (props) => (React.createElement("div", Object.assign({}, props.wrapperProps, { className: modifiedClass('Footnote', null, (props.wrapperProps || {}).className) }), props.children));
3
4
  export default Footnote;
package/esm/Form.js CHANGED
@@ -1,10 +1,10 @@
1
+ import { __rest } from "tslib";
1
2
  import React from 'react';
2
3
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
4
+ // NOTE: As this component already accepts all `<form/>` props directly,
5
+ // it makes little sense to add support for `wrapperProps` on top.
3
6
  export const Form = (props) => {
4
- const { children, align, wide } = props;
5
- return (React.createElement("form", Object.assign({}, props, { className: modifiedClass('Form', [
6
- align === 'right' && 'align--' + align,
7
- !align && wide && 'wide',
8
- ]) }), children));
7
+ const { children, align, wide, className } = props, formProps = __rest(props, ["children", "align", "wide", "className"]);
8
+ return (React.createElement("form", Object.assign({}, formProps, { className: modifiedClass('Form', [align === 'right' && 'align--' + align, !align && wide && 'wide'], className) }), children));
9
9
  };
10
10
  export default Form;
@@ -1,5 +1,7 @@
1
1
  import { RefObject } from 'react';
2
- import { SSRSupportProps } from './utils.js';
2
+ import { RequireExplicitUndefined } from '@reykjavik/hanna-utils';
3
+ import { TogglerGroupFieldProps } from './_abstract/_TogglerGroupField.js';
4
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
3
5
  type InputClassNames = {
4
6
  /** Basic/raw FormField BEM name */
5
7
  bem: string;
@@ -49,9 +51,13 @@ export type FormFieldWrappingProps = {
49
51
  reqText?: string | false;
50
52
  /** Optional pre-determinted id="" for the __input */
51
53
  id?: string;
52
- /** Ref object pointing to the outermost `.FormField` element */
54
+ /**
55
+ * @deprecated Use `*Props.wrapperProps.ref` instead (Will be removed in v0.11)
56
+ *
57
+ * Ref object pointing to the outermost `.FormField` element
58
+ */
53
59
  wrapperRef?: RefObject<HTMLElement>;
54
- } & SSRSupportProps;
60
+ } & WrapperElmProps & SSRSupportProps;
55
61
  /**
56
62
  * Mixin base props type for components using `FormField` to contain
57
63
  * more complex multi-element, grouped choices, that require a Heading
@@ -61,8 +67,12 @@ export type FormFieldGroupWrappingProps = FormFieldWrappingProps & {
61
67
  LabelTag?: 'h3' | 'h4' | 'h5';
62
68
  };
63
69
  type FormFieldProps = FormFieldGroupWrappingProps & {
64
- /** Container className - alongside "FormField" */
65
- className: string;
70
+ /** Container className - alongside "FormField" and `props.className`/
71
+ * `props.wrapperProps.className`. \
72
+ * Ideal to use if your wrapping compoent accepts its own `className`
73
+ * prop, so you don't have to merge/join them yourself.
74
+ */
75
+ extraClassName?: string;
66
76
  small?: boolean;
67
77
  group?: boolean | 'inputlike';
68
78
  empty?: boolean;
@@ -71,3 +81,13 @@ type FormFieldProps = FormFieldGroupWrappingProps & {
71
81
  };
72
82
  export declare const FormField: (props: FormFieldProps) => JSX.Element;
73
83
  export default FormField;
84
+ export declare const getFormFieldWrapperProps: (props: (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps, keyof FormFieldGroupWrappingProps>) & {
85
+ small?: boolean;
86
+ }) => RequireExplicitUndefined<FormFieldGroupWrappingProps> & {
87
+ small: boolean | undefined;
88
+ };
89
+ export declare const groupFormFieldWrapperProps: <T extends (FormFieldGroupWrappingProps | Pick<TogglerGroupFieldProps<"default">, "label" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "errorMessage" | "reqText" | "assistText" | "hideLabel" | "wrapperRef" | "LabelTag">) & {
90
+ small?: boolean | undefined;
91
+ }>(props: T) => Omit<T, "label" | "small" | "className" | "id" | "wrapperProps" | "disabled" | "ssr" | "invalid" | "readOnly" | "required" | "errorMessage" | "reqText" | "assistText" | "hideLabel" | "wrapperRef" | "LabelTag"> & {
92
+ fieldWrapperProps: ReturnType<typeof getFormFieldWrapperProps>;
93
+ };
package/esm/FormField.js CHANGED
@@ -1,6 +1,7 @@
1
+ import { __rest } from "tslib";
1
2
  import React, { useCallback, useState } from 'react';
2
- import { useDomid } from '@hugsmidjan/react/hooks';
3
3
  import { modifiedClass } from '@hugsmidjan/qj/classUtils';
4
+ import { useDomid } from '@hugsmidjan/react/hooks';
4
5
  import { isPreact } from './utils/env.js';
5
6
  import { useIsBrowserSide } from './utils.js';
6
7
  const inputClassNames = {
@@ -12,8 +13,8 @@ const inputClassNames = {
12
13
  // ---------------------------------------------------------------------------
13
14
  // eslint-disable-next-line complexity
14
15
  export const FormField = (props) => {
15
- const { className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // i18n
16
- renderInput, id, ssr, } = props;
16
+ const { extraClassName, className, small, group, LabelTag = group ? 'h4' : undefined, label, assistText, hideLabel, empty, filled, readOnly, disabled, invalid, errorMessage, required, reqText, // TODO: i18n
17
+ renderInput, id, ssr, wrapperProps, } = props;
17
18
  const isBrowser = useIsBrowserSide(ssr);
18
19
  const isInvalid = invalid || !!errorMessage || undefined;
19
20
  const domid = useDomid(id);
@@ -52,7 +53,7 @@ export const FormField = (props) => {
52
53
  const assistTextId = assistText ? `assist:${domid}` : undefined;
53
54
  const labelId = LabelTag ? `label:${domid}` : undefined;
54
55
  const reqStar = required && reqText !== false && (React.createElement("abbr", { className: "FormField__label__reqstar",
55
- // TODO: add mo-better i18n thinking
56
+ // FIXME: add mo-better i18n thinking
56
57
  title: `${reqText || 'Þarf að fylla út'}: ` }, "*"));
57
58
  const inputProps = {
58
59
  id: domid,
@@ -63,7 +64,7 @@ export const FormField = (props) => {
63
64
  'aria-describedby': assistTextId && errorId ? assistTextId + ' ' + errorId : assistTextId || errorId,
64
65
  'aria-labelledby': labelId, // undefined if normalLabel
65
66
  };
66
- return (React.createElement("div", { className: modifiedClass('FormField', [
67
+ return (React.createElement("div", Object.assign({ ref: props.wrapperRef }, wrapperProps, { className: modifiedClass('FormField', [
67
68
  small && 'small',
68
69
  hideLabel && 'nolabel',
69
70
  isInvalid && 'invalid',
@@ -72,7 +73,10 @@ export const FormField = (props) => {
72
73
  isBrowser && empty && 'empty',
73
74
  isBrowser && filled && 'filled',
74
75
  isBrowser && focused && 'focused',
75
- ], className), ref: props.wrapperRef },
76
+ ],
77
+ // Prefer `className` over `wrapperProps.className`
78
+ (className || (wrapperProps || {}).className || '') +
79
+ (extraClassName ? ` ${extraClassName}` : '')) }),
76
80
  LabelTag ? (React.createElement(LabelTag, { className: "FormField__label", "data-inputlabel": group === 'inputlike' || undefined, id: labelId },
77
81
  ' ',
78
82
  reqStar,
@@ -90,3 +94,23 @@ export const FormField = (props) => {
90
94
  errorMessage && (React.createElement("div", { id: errorId, className: "FormField__error" }, errorMessage))));
91
95
  };
92
96
  export default FormField;
97
+ // ---------------------------------------------------------------------------
98
+ export const getFormFieldWrapperProps = (props) => {
99
+ /* prettier-ignore */
100
+ const { wrapperProps, label, hideLabel, LabelTag, required, reqText, disabled, readOnly, assistText, invalid, errorMessage, id, small, ssr, className, wrapperRef, // eslint-disable-line deprecation/deprecation
101
+ } = props;
102
+ /* prettier-ignore */
103
+ return {
104
+ wrapperProps, label, LabelTag, hideLabel, required, reqText,
105
+ disabled: disabled === true,
106
+ readOnly, assistText, invalid, errorMessage, id,
107
+ small, ssr, className,
108
+ wrapperRef,
109
+ };
110
+ };
111
+ export const groupFormFieldWrapperProps = (props) => {
112
+ /* prettier-ignore */
113
+ const { wrapperProps, label, hideLabel, LabelTag, required, reqText, disabled, readOnly, assistText, invalid, errorMessage, id, small, ssr, className, wrapperRef } = props, // eslint-disable-line deprecation/deprecation
114
+ rest = __rest(props, ["wrapperProps", "label", "hideLabel", "LabelTag", "required", "reqText", "disabled", "readOnly", "assistText", "invalid", "errorMessage", "id", "small", "ssr", "className", "wrapperRef"]);
115
+ return Object.assign({ fieldWrapperProps: getFormFieldWrapperProps(props) }, rest);
116
+ };
@@ -13,7 +13,7 @@ export const GalleryItem = (props) => {
13
13
  setCurrentImage(Object.assign(Object.assign({}, image), { caption, description, largeImageSrc }));
14
14
  } },
15
15
  ' ',
16
- React.createElement(Image, Object.assign({ className: "GalleryItem__image" }, image)),
17
- ' ')) : (React.createElement(Image, Object.assign({ className: "GalleryItem__image" }, image))),
16
+ React.createElement(Image, Object.assign({ bem: "GalleryItem__image" }, image)),
17
+ ' ')) : (React.createElement(Image, Object.assign({ bem: "GalleryItem__image" }, image))),
18
18
  description && React.createElement("div", { className: "GalleryItem__description" }, description)));
19
19
  };
@@ -7,5 +7,5 @@ export const GalleryModalItem = (props) => {
7
7
  (caption || description) && (React.createElement("div", { className: "GalleryModalItem__text" },
8
8
  React.createElement("div", { className: "GalleryModalItem__caption" }, caption),
9
9
  React.createElement("div", { className: "GalleryModalItem__description" }, description))),
10
- React.createElement(Image, { className: "GalleryModalItem__image", src: image.largeImageSrc || image.src })));
10
+ React.createElement(Image, { bem: "GalleryModalItem__image", src: image.largeImageSrc || image.src })));
11
11
  };
package/esm/Gallery.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { GalleryItemProps } from './Gallery/_GalleryItem.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
- import { SSRSupportProps } from './utils.js';
3
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
4
4
  export type { GalleryItemProps } from './Gallery/_GalleryItem.js';
5
5
  export type GalleryI18n = {
6
6
  modalNextLabel: string;
@@ -11,6 +11,6 @@ export type GalleryProps = {
11
11
  items: Array<GalleryItemProps>;
12
12
  texts?: GalleryI18n;
13
13
  lang?: string;
14
- } & SSRSupportProps & SeenProp;
14
+ } & SSRSupportProps & WrapperElmProps & SeenProp;
15
15
  export declare const Gallery: (props: GalleryProps) => JSX.Element;
16
16
  export default Gallery;
package/esm/Gallery.js CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react';
1
+ import React, { useMemo, useState } from 'react';
2
2
  import { getTexts } from '@reykjavik/hanna-utils/i18n';
3
3
  import { AbstractCarousel } from './_abstract/_AbstractCarousel.js';
4
4
  import { GalleryItem } from './Gallery/_GalleryItem.js';
@@ -19,9 +19,10 @@ const defaultTexts = {
19
19
  export const Gallery = (props) => {
20
20
  const { items, ssr, startSeen } = props;
21
21
  const texts = getTexts(props, defaultTexts);
22
- const [modalImage, setModalImage] = useState(undefined);
23
- return (React.createElement(GalleryModalContext.Provider, { value: { items, setCurrentImage: setModalImage, currentImage: modalImage } },
24
- React.createElement(AbstractCarousel, { bem: "Gallery", items: items, Component: GalleryItem, ssr: ssr, startSeen: startSeen }),
25
- React.createElement(GalleryModal, Object.assign({}, modalImage, { texts: texts }))));
22
+ const [currentImage, setCurrentImage] = useState(undefined);
23
+ const galleryState = useMemo(() => ({ items, setCurrentImage, currentImage }), [items, currentImage]);
24
+ return (React.createElement(GalleryModalContext.Provider, { value: galleryState },
25
+ React.createElement(AbstractCarousel, { bem: "Gallery", items: items, Component: GalleryItem, ssr: ssr, startSeen: startSeen, wrapperProps: props.wrapperProps }),
26
+ React.createElement(GalleryModal, Object.assign({}, currentImage, { texts: texts }))));
26
27
  };
27
28
  export default Gallery;
@@ -2,6 +2,7 @@ import { Efnistakn } from '@reykjavik/hanna-utils/assets';
2
2
  import { ButtonProps } from './_abstract/_Button.js';
3
3
  import { ImageProps } from './_abstract/_Image.js';
4
4
  import { SeenProp } from './utils/seenEffect.js';
5
+ import { WrapperElmProps } from './utils.js';
5
6
  export type GridBlockItem = {
6
7
  title: string;
7
8
  summary: string | JSX.Element;
@@ -17,10 +18,6 @@ export type GridBlockItem = {
17
18
  export type GridBlocksProps = {
18
19
  blocks: Array<GridBlockItem>;
19
20
  twocol?: boolean;
20
- } & SeenProp;
21
- export type GridBlocksProp1s = {
22
- blocks: Array<GridBlockItem>;
23
- twocol?: boolean;
24
- };
21
+ } & WrapperElmProps & SeenProp;
25
22
  export declare const GridBlocks: (props: GridBlocksProps) => JSX.Element;
26
23
  export default GridBlocks;
package/esm/GridBlocks.js CHANGED
@@ -6,12 +6,12 @@ import { Link } from './_abstract/_Link.js';
6
6
  import { useSeenEffect } from './utils/seenEffect.js';
7
7
  import ButtonTertiary from './ButtonTertiary.js';
8
8
  export const GridBlocks = (props) => {
9
- const { blocks, twocol, startSeen } = props;
9
+ const { blocks, twocol, startSeen, wrapperProps } = props;
10
10
  const [ref] = useSeenEffect(startSeen);
11
- return (React.createElement("div", { className: modifiedClass('GridBlocks', [twocol && 'twocol']), ref: ref }, blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
11
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('GridBlocks', [twocol && 'twocol'], (wrapperProps || {}).className), ref: ref }), blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
12
12
  const imageProps = icon ? { src: getEfnistaknUrl(icon) } : image;
13
13
  return (React.createElement("div", { key: i, className: "GridBlocks__item" },
14
- imageProps && React.createElement(Image, Object.assign({ className: "GridBlocks__illustration" }, imageProps)),
14
+ imageProps && React.createElement(Image, Object.assign({ bem: "GridBlocks__illustration" }, imageProps)),
15
15
  React.createElement("div", { className: "GridBlocks__textwrap" },
16
16
  React.createElement("h3", { className: "GridBlocks__item__title" }, href != null ? (React.createElement(Link, { className: "GridBlocks__item__titlelink", href: href }, title)) : (title)),
17
17
  React.createElement("div", { className: "GridBlocks__item__summary" }, summary),
package/esm/Heading.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ComponentLayoutProps } from './constants.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  declare const sizes: {
4
5
  readonly small: "small";
5
6
  /** Default value */
@@ -17,6 +18,6 @@ export type HeadingProps = {
17
18
  * This prop is ignore if the `Tag` prop is defined.
18
19
  */
19
20
  forceH1?: boolean;
20
- } & ComponentLayoutProps;
21
+ } & ComponentLayoutProps & WrapperElmProps;
21
22
  export declare const Heading: (props: HeadingProps) => JSX.Element;
22
23
  export default Heading;
package/esm/Heading.js CHANGED
@@ -7,13 +7,13 @@ const sizes = {
7
7
  large: 'large',
8
8
  };
9
9
  export const Heading = (props) => {
10
- const { size = 'normal', align, wide, children } = props;
10
+ const { size = 'normal', align, wide, children, wrapperProps } = props;
11
11
  const Tag = props.Tag || (props.forceH1 ? 'h1' : 'h2');
12
12
  const suppressWarning = process.env.NODE_ENV !== 'production' && Tag === 'h1' ? true : undefined;
13
- return (React.createElement(Tag, { "data-dev-forcedh1": suppressWarning, className: modifiedClass('Heading', [
13
+ return (React.createElement(Tag, Object.assign({}, wrapperProps, { "data-dev-forcedh1": suppressWarning, className: modifiedClass('Heading', [
14
14
  sizes[size],
15
15
  align === 'right' && 'align--' + align,
16
16
  !align && wide && 'wide',
17
- ]) }, children));
17
+ ]) }), children));
18
18
  };
19
19
  export default Heading;
@@ -2,6 +2,7 @@ import { Illustration } from '@reykjavik/hanna-utils/assets';
2
2
  import { ButtonProps } from './_abstract/_Button.js';
3
3
  import { ImageProps } from './_abstract/_Image.js';
4
4
  import { SeenProp } from './utils/seenEffect.js';
5
+ import { WrapperElmProps } from './utils.js';
5
6
  type HeroBlockImageProps = {
6
7
  illustration: Illustration;
7
8
  image?: undefined;
@@ -14,6 +15,6 @@ export type HeroBlockProps = {
14
15
  summary: string | JSX.Element;
15
16
  primaryButton?: ButtonProps;
16
17
  secondaryButton?: ButtonProps;
17
- } & HeroBlockImageProps & SeenProp;
18
+ } & HeroBlockImageProps & WrapperElmProps & SeenProp;
18
19
  export declare const HeroBlock: (props: HeroBlockProps) => JSX.Element;
19
20
  export default HeroBlock;
package/esm/HeroBlock.js CHANGED
@@ -1,17 +1,18 @@
1
1
  import React from 'react';
2
+ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
2
3
  import { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';
3
4
  import { Image } from './_abstract/_Image.js';
4
5
  import { useSeenEffect } from './utils/seenEffect.js';
5
6
  import ButtonPrimary from './ButtonPrimary.js';
6
7
  import ButtonTertiary from './ButtonTertiary.js';
7
8
  export const HeroBlock = (props) => {
8
- const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, } = props;
9
+ const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, wrapperProps, } = props;
9
10
  const hasButtons = Boolean(primaryButton || secondaryButton);
10
11
  const imgProps = illustration ? { src: getIllustrationUrl(illustration) } : image;
11
12
  const [ref] = useSeenEffect(startSeen);
12
- return (React.createElement("div", { className: "HeroBlock", ref: ref },
13
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('HeroBlock', null, (wrapperProps || {}).className), ref: ref }),
13
14
  React.createElement("h1", { className: "HeroBlock__title" }, title),
14
- React.createElement(Image, Object.assign({ className: "HeroBlock__image" }, imgProps)),
15
+ React.createElement(Image, Object.assign({ bem: "HeroBlock__image" }, imgProps)),
15
16
  React.createElement("div", { className: "HeroBlock__summary" }, summary),
16
17
  hasButtons && (React.createElement("div", { className: "HeroBlock__buttons" },
17
18
  primaryButton && React.createElement(ButtonPrimary, Object.assign({}, primaryButton)),
@@ -1,5 +1,7 @@
1
1
  import { EitherObj } from '@reykjavik/hanna-utils';
2
- import { type ResizerOptions } from 'iframe-resizer-react';
2
+ import { IframeResizerProps, ResizerOptions } from 'iframe-resizer-react';
3
+ import { HTMLProps } from './utils.js';
4
+ type ForbiddenWrapperProps = 'scrolling' | 'height' | 'title' | 'src';
3
5
  export type IframeBlockProps = {
4
6
  src: string;
5
7
  /** Accessible title attribute for the iframe (similar to alt="" on images) */
@@ -8,13 +10,16 @@ export type IframeBlockProps = {
8
10
  compact?: boolean;
9
11
  align?: 'right';
10
12
  } & EitherObj<{
13
+ /** Fixed height, no auto-resizing of the iframe */
14
+ height: number;
15
+ scrolling?: boolean | 'no' | 'yes';
16
+ wrapperProps?: HTMLProps<'iframe', ForbiddenWrapperProps>;
17
+ }, {
11
18
  /** Default: `'auto'` ... which initializes "iframe-resizer" script */
12
19
  height?: 'auto';
13
20
  /** Default: `false` ... Set to `true` for same-site only, or provide array of allowed domain-names */
14
21
  checkOrigin?: ResizerOptions['checkOrigin'];
15
- }, {
16
- height: number;
17
- scrolling?: boolean | 'no' | 'yes';
22
+ wrapperProps?: Omit<IframeResizerProps, ForbiddenWrapperProps>;
18
23
  }>;
19
24
  /**
20
25
  * When `height` is undefined or "auto", then Add the following code-snipped to the iframed page:
@@ -10,17 +10,18 @@ import IframeResizer from 'iframe-resizer-react';
10
10
  * ```
11
11
  */
12
12
  export const IframeBlock = (props) => {
13
- const { title, src, framed, compact, scrolling, height = 'auto', align, checkOrigin = false, } = props;
14
- const className = modifiedClass('IframeBlock', [
15
- framed && 'framed',
16
- compact && 'compact',
17
- align === 'right' && 'align--' + align,
18
- ]);
19
- return height === 'auto' ? (React.createElement(IframeResizer, { className: className, title: title, src: src, checkOrigin: checkOrigin })) : (React.createElement("iframe", { className: className, title: title, src: src,
20
- // hidden tiger: pass negative height to disable iframe-resizer but not set height explicitly
21
- // (Silly hack, don't rely on this)
22
- height: height < 0 ? undefined : height,
23
- // allow undefined to suppress scrolling attribute
24
- scrolling: scrolling === true ? 'yes' : scrolling === false ? 'no' : scrolling }));
13
+ const { title, src, framed, compact, align } = props;
14
+ const className = modifiedClass('IframeBlock', [framed && 'framed', compact && 'compact', align === 'right' && 'align--' + align], (props.wrapperProps || {}).className);
15
+ if (typeof props.height === 'number') {
16
+ const { wrapperProps, scrolling, height } = props;
17
+ return (React.createElement("iframe", Object.assign({}, wrapperProps, { className: className, title: title, src: src,
18
+ // hidden tiger: pass negative height to disable iframe-resizer but not set height explicitly
19
+ // (Silly hack, don't rely on this)
20
+ height: height < 0 ? undefined : height,
21
+ // allow undefined to suppress scrolling attribute
22
+ scrolling: scrolling === true ? 'yes' : scrolling === false ? 'no' : scrolling })));
23
+ }
24
+ const { wrapperProps, checkOrigin = false } = props;
25
+ return (React.createElement(IframeResizer, Object.assign({}, wrapperProps, { className: className, title: title, src: src, checkOrigin: checkOrigin })));
25
26
  };
26
27
  export default IframeBlock;
@@ -1,10 +1,11 @@
1
1
  import { EitherObj } from '@reykjavik/hanna-utils';
2
2
  import { Illustration as IllustrationName } from '@reykjavik/hanna-utils/assets';
3
3
  import { ImageProps } from './_abstract/_Image.js';
4
+ import { WrapperElmProps } from './utils.js';
4
5
  type IllustrationProps = EitherObj<{
5
6
  type: IllustrationName;
6
7
  }, {
7
8
  image: ImageProps;
8
- }>;
9
+ }> & WrapperElmProps;
9
10
  export declare const Illustration: (props: IllustrationProps) => JSX.Element;
10
11
  export default Illustration;
@@ -3,6 +3,6 @@ import { getIllustrationUrl, } from '@reykjavik/hanna-utils/assets';
3
3
  import { Image } from './_abstract/_Image.js';
4
4
  export const Illustration = (props) => {
5
5
  const imgProps = props.type ? { src: getIllustrationUrl(props.type) } : props.image;
6
- return React.createElement(Image, Object.assign({ className: "Illustration" }, imgProps));
6
+ return React.createElement(Image, Object.assign({ bem: "Illustration" }, imgProps, { wrapperProps: props.wrapperProps }));
7
7
  };
8
8
  export default Illustration;
@@ -1,10 +1,11 @@
1
1
  import { CardListSummaryProps, ImageCardListProps, ImageCardProps as _ImageCardProps } from './_abstract/_CardList.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  export type ImageCardsItemProps = _ImageCardProps;
4
5
  /** @deprecated Use `ImageCardsItemProps` instead. (Will be removed in v0.11) */
5
6
  export type ImageCardProps = ImageCardsItemProps;
6
7
  export type ImageCardsProps = ImageCardListProps & CardListSummaryProps & {
7
8
  background?: boolean;
8
- } & SeenProp;
9
+ } & WrapperElmProps & SeenProp;
9
10
  export declare const ImageCards: (props: ImageCardsProps) => JSX.Element;
10
11
  export default ImageCards;
package/esm/ImageCards.js CHANGED
@@ -4,9 +4,9 @@ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
4
4
  import { CardList, } from './_abstract/_CardList.js';
5
5
  import { useSeenEffect } from './utils/seenEffect.js';
6
6
  export const ImageCards = (props) => {
7
- const { background, startSeen } = props, cardListProps = __rest(props, ["background", "startSeen"]);
7
+ const { background, startSeen, wrapperProps } = props, cardListProps = __rest(props, ["background", "startSeen", "wrapperProps"]);
8
8
  const [ref] = useSeenEffect(startSeen);
9
- return (React.createElement("div", { className: modifiedClass('ImageCards', background && 'background'), ref: ref },
9
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('ImageCards', background && 'background', (wrapperProps || {}).className), ref: ref }),
10
10
  React.createElement(CardList, Object.assign({}, cardListProps, { bemPrefix: "ImageCards", imgPlaceholder: props.imgPlaceholder || true }))));
11
11
  };
12
12
  export default ImageCards;
@@ -1,5 +1,6 @@
1
1
  import { EitherObj } from '@reykjavik/hanna-utils';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  export type InfoBlockProps = {
4
5
  title: string;
5
6
  subtitle?: string | JSX.Element;
@@ -8,6 +9,6 @@ export type InfoBlockProps = {
8
9
  attention?: string | JSX.Element;
9
10
  }, {
10
11
  extraInfo?: string | JSX.Element;
11
- }> & SeenProp;
12
+ }> & WrapperElmProps & SeenProp;
12
13
  export declare const InfoBlock: (props: InfoBlockProps) => JSX.Element;
13
14
  export default InfoBlock;
package/esm/InfoBlock.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
+ import { modifiedClass } from '@hugsmidjan/qj/classUtils';
2
3
  import { useSeenEffect } from './utils/seenEffect.js';
3
4
  export const InfoBlock = (props) => {
4
- const { title, subtitle, items, startSeen } = props;
5
+ const { title, subtitle, items, startSeen, wrapperProps } = props;
5
6
  const [ref] = useSeenEffect(startSeen);
6
- return (React.createElement("div", { className: "InfoBlock", ref: ref },
7
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('InfoBlock', null, (wrapperProps || {}).className), ref: ref }),
7
8
  React.createElement("h2", { className: "InfoBlock__title" }, title),
8
9
  subtitle && React.createElement("div", { className: "InfoBlock__subtitle" }, subtitle),
9
10
  React.createElement("ul", { className: "InfoBlock__items" }, items.map((item, i) => (React.createElement("li", { key: i, className: "InfoBlock__item" }, item)))),
package/esm/InfoHero.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ButtonProps } from './_abstract/_Button.js';
2
2
  import { ImageProps } from './_abstract/_Image.js';
3
3
  import { Alignment } from './constants.js';
4
+ import { WrapperElmProps } from './utils.js';
4
5
  type BlingOptions = 'waves' | 'sunny-waves' | 'triangles' | 'circles';
5
6
  export type InfoHeroProps = {
6
7
  title: string;
@@ -13,6 +14,6 @@ export type InfoHeroProps = {
13
14
  align?: Alignment;
14
15
  image?: ImageProps;
15
16
  blingType?: BlingOptions;
16
- };
17
+ } & WrapperElmProps;
17
18
  export declare const InfoHero: (props: InfoHeroProps) => JSX.Element;
18
19
  export default InfoHero;
package/esm/InfoHero.js CHANGED
@@ -64,12 +64,12 @@ const blingOptions = {
64
64
  ],
65
65
  };
66
66
  export const InfoHero = (props) => {
67
- const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, } = props;
67
+ const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, wrapperProps, } = props;
68
68
  const showButtons = Boolean(buttons.length);
69
69
  const alignment = align && aligns[align] ? align : 'right';
70
70
  const blings = (blingType && blingOptions[blingType]) ||
71
71
  blingOptions.waves; // default to `waves`
72
- return (React.createElement("div", { className: modifiedClass('InfoHero', 'align--' + alignment) },
72
+ return (React.createElement("div", Object.assign({}, wrapperProps, { className: modifiedClass('InfoHero', 'align--' + alignment, (wrapperProps || {}).className) }),
73
73
  React.createElement("div", { className: "InfoHero__content" },
74
74
  React.createElement("h1", { className: "InfoHero__title" }, title),
75
75
  titleBlurb && React.createElement("div", { className: "InfoHero__titleblurb" }, titleBlurb),
@@ -77,7 +77,7 @@ export const InfoHero = (props) => {
77
77
  blurb && React.createElement("div", { className: "InfoHero__blurb" }, blurb),
78
78
  showButtons && (React.createElement("div", { className: "InfoHero__buttons" }, buttons.map((buttonProps, i) => (React.createElement(ButtonTertiary, Object.assign({ key: i }, buttonProps)))))),
79
79
  footer && React.createElement("div", { className: "InfoHero__footer" }, footer)),
80
- React.createElement(Image, Object.assign({ className: "InfoHero__image", altText: title }, image, { placeholder: true })),
80
+ React.createElement(Image, Object.assign({ bem: "InfoHero__image", altText: title }, image, { placeholder: true })),
81
81
  React.createElement(Blings, { blings: blings, mirror: alignment === 'right' })));
82
82
  };
83
83
  export default InfoHero;
@@ -3,6 +3,7 @@ import { BlockItem } from './_abstract/_Block.js';
3
3
  import { ImageProps } from './_abstract/_Image.js';
4
4
  import { SeenProp } from './utils/seenEffect.js';
5
5
  import { Alignment } from './constants.js';
6
+ import { WrapperElmProps } from './utils.js';
6
7
  type IslandBaseBlockProps = {
7
8
  align?: Alignment;
8
9
  };
@@ -20,6 +21,6 @@ type IslandContentBlocks = {
20
21
  shapes?: undefined;
21
22
  image?: undefined;
22
23
  };
23
- export type IslandBlockProps = IslandBaseBlockProps & (IslandContentBlocks | IslandImageBlock) & SeenProp;
24
+ export type IslandBlockProps = IslandBaseBlockProps & (IslandContentBlocks | IslandImageBlock) & WrapperElmProps & SeenProp;
24
25
  export declare const IslandBlock: (props: IslandBlockProps) => JSX.Element;
25
26
  export default IslandBlock;
@@ -3,7 +3,7 @@ import { getFormheimurUrl } from '@reykjavik/hanna-utils/assets';
3
3
  import { Block } from './_abstract/_Block.js';
4
4
  import { aligns } from './constants.js';
5
5
  export const IslandBlock = (props) => {
6
- const { align, content, shapes, image, startSeen } = props;
6
+ const { align, content, shapes, image, startSeen, wrapperProps } = props;
7
7
  const alignment = align && aligns[align] ? align : 'right';
8
8
  const blockProps = Array.isArray(content)
9
9
  ? { content }
@@ -11,6 +11,6 @@ export const IslandBlock = (props) => {
11
11
  content,
12
12
  image: shapes ? { src: getFormheimurUrl(shapes), inline: true } : image || {},
13
13
  };
14
- return (React.createElement(Block, Object.assign({ bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
14
+ return (React.createElement(Block, Object.assign({ wrapperProps: wrapperProps, bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
15
15
  };
16
16
  export default IslandBlock;
@@ -3,6 +3,7 @@ import { BlockItem } from './_abstract/_Block.js';
3
3
  import { ImageProps } from './_abstract/_Image.js';
4
4
  import { SeenProp } from './utils/seenEffect.js';
5
5
  import { Alignment } from './constants.js';
6
+ import { WrapperElmProps } from './utils.js';
6
7
  declare const backgrounds: {
7
8
  none: undefined;
8
9
  gray: string;
@@ -19,6 +20,6 @@ type IslandPageImageProps = {
19
20
  export type IslandPageBlockProps = BlockItem & IslandPageImageProps & {
20
21
  align?: Alignment;
21
22
  background?: Background;
22
- } & SeenProp;
23
+ } & WrapperElmProps & SeenProp;
23
24
  export declare const IslandPageBlock: (props: IslandPageBlockProps) => JSX.Element;
24
25
  export default IslandPageBlock;
@@ -8,9 +8,9 @@ const backgrounds = {
8
8
  secondary: 'secondary',
9
9
  };
10
10
  export const IslandPageBlock = (props) => {
11
- const { title, summary, buttons, illustration, image, align, background, startSeen } = props;
11
+ const { title, summary, buttons, illustration, image, align, background, startSeen, wrapperProps, } = props;
12
12
  const alignment = align && aligns[align] ? align : 'right';
13
13
  const bg = backgrounds[background || 'none'];
14
- return (React.createElement(Block, { bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: getIllustrationUrl(illustration) } : image || {}, startSeen: startSeen }));
14
+ return (React.createElement(Block, { wrapperProps: wrapperProps, bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: getIllustrationUrl(illustration) } : image || {}, startSeen: startSeen }));
15
15
  };
16
16
  export default IslandPageBlock;
@@ -1,11 +1,12 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ButtonProps } from './_abstract/_Button.js';
3
3
  import { SeenProp } from './utils/seenEffect.js';
4
+ import { WrapperElmProps } from './utils.js';
4
5
  export type LabeledTextBlockProps = {
5
6
  label: string;
6
7
  summary: string | ReactElement;
7
8
  wide?: boolean;
8
9
  buttons?: Array<ButtonProps>;
9
- } & SeenProp;
10
+ } & WrapperElmProps & SeenProp;
10
11
  export declare const LabeledTextBlock: (props: LabeledTextBlockProps) => JSX.Element;
11
12
  export default LabeledTextBlock;