@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/Heading.js CHANGED
@@ -11,14 +11,14 @@ const sizes = {
11
11
  large: 'large',
12
12
  };
13
13
  const Heading = (props) => {
14
- const { size = 'normal', align, wide, children } = props;
14
+ const { size = 'normal', align, wide, children, wrapperProps } = props;
15
15
  const Tag = props.Tag || (props.forceH1 ? 'h1' : 'h2');
16
16
  const suppressWarning = process.env.NODE_ENV !== 'production' && Tag === 'h1' ? true : undefined;
17
- return (react_1.default.createElement(Tag, { "data-dev-forcedh1": suppressWarning, className: (0, classUtils_1.modifiedClass)('Heading', [
17
+ return (react_1.default.createElement(Tag, Object.assign({}, wrapperProps, { "data-dev-forcedh1": suppressWarning, className: (0, classUtils_1.modifiedClass)('Heading', [
18
18
  sizes[size],
19
19
  align === 'right' && 'align--' + align,
20
20
  !align && wide && 'wide',
21
- ]) }, children));
21
+ ]) }), children));
22
22
  };
23
23
  exports.Heading = Heading;
24
24
  exports.default = exports.Heading;
package/HeroBlock.d.ts CHANGED
@@ -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/HeroBlock.js CHANGED
@@ -3,19 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HeroBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
6
7
  const assets_1 = require("@reykjavik/hanna-utils/assets");
7
8
  const _Image_js_1 = require("./_abstract/_Image.js");
8
9
  const seenEffect_js_1 = require("./utils/seenEffect.js");
9
10
  const ButtonPrimary_js_1 = tslib_1.__importDefault(require("./ButtonPrimary.js"));
10
11
  const ButtonTertiary_js_1 = tslib_1.__importDefault(require("./ButtonTertiary.js"));
11
12
  const HeroBlock = (props) => {
12
- const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, } = props;
13
+ const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, wrapperProps, } = props;
13
14
  const hasButtons = Boolean(primaryButton || secondaryButton);
14
15
  const imgProps = illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image;
15
16
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
16
- return (react_1.default.createElement("div", { className: "HeroBlock", ref: ref },
17
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('HeroBlock', null, (wrapperProps || {}).className), ref: ref }),
17
18
  react_1.default.createElement("h1", { className: "HeroBlock__title" }, title),
18
- react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "HeroBlock__image" }, imgProps)),
19
+ react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "HeroBlock__image" }, imgProps)),
19
20
  react_1.default.createElement("div", { className: "HeroBlock__summary" }, summary),
20
21
  hasButtons && (react_1.default.createElement("div", { className: "HeroBlock__buttons" },
21
22
  primaryButton && react_1.default.createElement(ButtonPrimary_js_1.default, Object.assign({}, primaryButton)),
package/IframeBlock.d.ts CHANGED
@@ -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:
package/IframeBlock.js CHANGED
@@ -14,18 +14,19 @@ const iframe_resizer_react_1 = tslib_1.__importDefault(require("iframe-resizer-r
14
14
  * ```
15
15
  */
16
16
  const IframeBlock = (props) => {
17
- const { title, src, framed, compact, scrolling, height = 'auto', align, checkOrigin = false, } = props;
18
- const className = (0, classUtils_1.modifiedClass)('IframeBlock', [
19
- framed && 'framed',
20
- compact && 'compact',
21
- align === 'right' && 'align--' + align,
22
- ]);
23
- return height === 'auto' ? (react_1.default.createElement(iframe_resizer_react_1.default, { className: className, title: title, src: src, checkOrigin: checkOrigin })) : (react_1.default.createElement("iframe", { className: className, title: title, src: src,
24
- // hidden tiger: pass negative height to disable iframe-resizer but not set height explicitly
25
- // (Silly hack, don't rely on this)
26
- height: height < 0 ? undefined : height,
27
- // allow undefined to suppress scrolling attribute
28
- scrolling: scrolling === true ? 'yes' : scrolling === false ? 'no' : scrolling }));
17
+ const { title, src, framed, compact, align } = props;
18
+ const className = (0, classUtils_1.modifiedClass)('IframeBlock', [framed && 'framed', compact && 'compact', align === 'right' && 'align--' + align], (props.wrapperProps || {}).className);
19
+ if (typeof props.height === 'number') {
20
+ const { wrapperProps, scrolling, height } = props;
21
+ return (react_1.default.createElement("iframe", Object.assign({}, wrapperProps, { className: className, title: title, src: src,
22
+ // hidden tiger: pass negative height to disable iframe-resizer but not set height explicitly
23
+ // (Silly hack, don't rely on this)
24
+ height: height < 0 ? undefined : height,
25
+ // allow undefined to suppress scrolling attribute
26
+ scrolling: scrolling === true ? 'yes' : scrolling === false ? 'no' : scrolling })));
27
+ }
28
+ const { wrapperProps, checkOrigin = false } = props;
29
+ return (react_1.default.createElement(iframe_resizer_react_1.default, Object.assign({}, wrapperProps, { className: className, title: title, src: src, checkOrigin: checkOrigin })));
29
30
  };
30
31
  exports.IframeBlock = IframeBlock;
31
32
  exports.default = exports.IframeBlock;
package/Illustration.d.ts CHANGED
@@ -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;
package/Illustration.js CHANGED
@@ -7,7 +7,7 @@ const assets_1 = require("@reykjavik/hanna-utils/assets");
7
7
  const _Image_js_1 = require("./_abstract/_Image.js");
8
8
  const Illustration = (props) => {
9
9
  const imgProps = props.type ? { src: (0, assets_1.getIllustrationUrl)(props.type) } : props.image;
10
- return react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "Illustration" }, imgProps));
10
+ return react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "Illustration" }, imgProps, { wrapperProps: props.wrapperProps }));
11
11
  };
12
12
  exports.Illustration = Illustration;
13
13
  exports.default = exports.Illustration;
package/ImageCards.d.ts CHANGED
@@ -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/ImageCards.js CHANGED
@@ -7,9 +7,9 @@ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
7
  const _CardList_js_1 = require("./_abstract/_CardList.js");
8
8
  const seenEffect_js_1 = require("./utils/seenEffect.js");
9
9
  const ImageCards = (props) => {
10
- const { background, startSeen } = props, cardListProps = tslib_1.__rest(props, ["background", "startSeen"]);
10
+ const { background, startSeen, wrapperProps } = props, cardListProps = tslib_1.__rest(props, ["background", "startSeen", "wrapperProps"]);
11
11
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
12
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('ImageCards', background && 'background'), ref: ref },
12
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('ImageCards', background && 'background', (wrapperProps || {}).className), ref: ref }),
13
13
  react_1.default.createElement(_CardList_js_1.CardList, Object.assign({}, cardListProps, { bemPrefix: "ImageCards", imgPlaceholder: props.imgPlaceholder || true }))));
14
14
  };
15
15
  exports.ImageCards = ImageCards;
package/InfoBlock.d.ts CHANGED
@@ -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/InfoBlock.js CHANGED
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InfoBlock = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
6
7
  const seenEffect_js_1 = require("./utils/seenEffect.js");
7
8
  const InfoBlock = (props) => {
8
- const { title, subtitle, items, startSeen } = props;
9
+ const { title, subtitle, items, startSeen, wrapperProps } = props;
9
10
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
10
- return (react_1.default.createElement("div", { className: "InfoBlock", ref: ref },
11
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoBlock', null, (wrapperProps || {}).className), ref: ref }),
11
12
  react_1.default.createElement("h2", { className: "InfoBlock__title" }, title),
12
13
  subtitle && react_1.default.createElement("div", { className: "InfoBlock__subtitle" }, subtitle),
13
14
  react_1.default.createElement("ul", { className: "InfoBlock__items" }, items.map((item, i) => (react_1.default.createElement("li", { key: i, className: "InfoBlock__item" }, item)))),
package/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/InfoHero.js CHANGED
@@ -68,12 +68,12 @@ const blingOptions = {
68
68
  ],
69
69
  };
70
70
  const InfoHero = (props) => {
71
- const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, } = props;
71
+ const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, wrapperProps, } = props;
72
72
  const showButtons = Boolean(buttons.length);
73
73
  const alignment = align && constants_js_1.aligns[align] ? align : 'right';
74
74
  const blings = (blingType && blingOptions[blingType]) ||
75
75
  blingOptions.waves; // default to `waves`
76
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('InfoHero', 'align--' + alignment) },
76
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('InfoHero', 'align--' + alignment, (wrapperProps || {}).className) }),
77
77
  react_1.default.createElement("div", { className: "InfoHero__content" },
78
78
  react_1.default.createElement("h1", { className: "InfoHero__title" }, title),
79
79
  titleBlurb && react_1.default.createElement("div", { className: "InfoHero__titleblurb" }, titleBlurb),
@@ -81,7 +81,7 @@ const InfoHero = (props) => {
81
81
  blurb && react_1.default.createElement("div", { className: "InfoHero__blurb" }, blurb),
82
82
  showButtons && (react_1.default.createElement("div", { className: "InfoHero__buttons" }, buttons.map((buttonProps, i) => (react_1.default.createElement(ButtonTertiary_js_1.default, Object.assign({ key: i }, buttonProps)))))),
83
83
  footer && react_1.default.createElement("div", { className: "InfoHero__footer" }, footer)),
84
- react_1.default.createElement(_Image_js_1.Image, Object.assign({ className: "InfoHero__image", altText: title }, image, { placeholder: true })),
84
+ react_1.default.createElement(_Image_js_1.Image, Object.assign({ bem: "InfoHero__image", altText: title }, image, { placeholder: true })),
85
85
  react_1.default.createElement(_Blings_js_1.Blings, { blings: blings, mirror: alignment === 'right' })));
86
86
  };
87
87
  exports.InfoHero = InfoHero;
package/IslandBlock.d.ts CHANGED
@@ -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;
package/IslandBlock.js CHANGED
@@ -7,7 +7,7 @@ const assets_1 = require("@reykjavik/hanna-utils/assets");
7
7
  const _Block_js_1 = require("./_abstract/_Block.js");
8
8
  const constants_js_1 = require("./constants.js");
9
9
  const IslandBlock = (props) => {
10
- const { align, content, shapes, image, startSeen } = props;
10
+ const { align, content, shapes, image, startSeen, wrapperProps } = props;
11
11
  const alignment = align && constants_js_1.aligns[align] ? align : 'right';
12
12
  const blockProps = Array.isArray(content)
13
13
  ? { content }
@@ -15,7 +15,7 @@ const IslandBlock = (props) => {
15
15
  content,
16
16
  image: shapes ? { src: (0, assets_1.getFormheimurUrl)(shapes), inline: true } : image || {},
17
17
  };
18
- return (react_1.default.createElement(_Block_js_1.Block, Object.assign({ bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
18
+ return (react_1.default.createElement(_Block_js_1.Block, Object.assign({ wrapperProps: wrapperProps, bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
19
19
  };
20
20
  exports.IslandBlock = IslandBlock;
21
21
  exports.default = exports.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;
@@ -12,10 +12,10 @@ const backgrounds = {
12
12
  secondary: 'secondary',
13
13
  };
14
14
  const IslandPageBlock = (props) => {
15
- const { title, summary, buttons, illustration, image, align, background, startSeen } = props;
15
+ const { title, summary, buttons, illustration, image, align, background, startSeen, wrapperProps, } = props;
16
16
  const alignment = align && constants_js_1.aligns[align] ? align : 'right';
17
17
  const bg = backgrounds[background || 'none'];
18
- return (react_1.default.createElement(_Block_js_1.Block, { bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image || {}, startSeen: startSeen }));
18
+ return (react_1.default.createElement(_Block_js_1.Block, { wrapperProps: wrapperProps, bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: (0, assets_1.getIllustrationUrl)(illustration) } : image || {}, startSeen: startSeen }));
19
19
  };
20
20
  exports.IslandPageBlock = IslandPageBlock;
21
21
  exports.default = exports.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;
@@ -7,9 +7,9 @@ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
7
7
  const seenEffect_js_1 = require("./utils/seenEffect.js");
8
8
  const ButtonTertiary_js_1 = tslib_1.__importDefault(require("./ButtonTertiary.js"));
9
9
  const LabeledTextBlock = (props) => {
10
- const { label, summary, wide, buttons = [], startSeen } = props;
10
+ const { label, summary, wide, buttons = [], startSeen, wrapperProps } = props;
11
11
  const [ref] = (0, seenEffect_js_1.useSeenEffect)(startSeen);
12
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('LabeledTextBlock', wide && 'wide'), ref: ref },
12
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('LabeledTextBlock', wide && 'wide', (wrapperProps || {}).className), ref: ref }),
13
13
  react_1.default.createElement("h2", { className: "LabeledTextBlock__label" }, label),
14
14
  react_1.default.createElement("div", { className: "LabeledTextBlock__summary" },
15
15
  summary,
package/Layout.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { HannaColorTheme } from '@reykjavik/hanna-css';
3
3
  import { EitherObj } from '@reykjavik/hanna-utils';
4
4
  import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
5
5
  import { BemModifierProps } from './utils/types.js';
6
- import { SSRSupportProps } from './utils.js';
6
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
7
7
  export type LayoutI18n = {
8
8
  lang?: string;
9
9
  skipLinkLabel: string;
@@ -20,7 +20,7 @@ type LayoutProps = {
20
20
  siteName?: string;
21
21
  texts?: LayoutI18n;
22
22
  lang?: string;
23
- } & SSRSupportProps & BemModifierProps & EitherObj<{
23
+ } & SSRSupportProps & WrapperElmProps & BemModifierProps & EitherObj<{
24
24
  mainChildren: ReactNode;
25
25
  }, {
26
26
  children: ReactNode;
package/Layout.js CHANGED
@@ -31,16 +31,16 @@ exports.defaultLayoutTexts = {
31
31
  };
32
32
  const Layout = (props) => {
33
33
  (0, utils_js_1.useScrollbarWidthCSSVar)();
34
- const { ssr, globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName = '', logoLink = '/', } = props;
34
+ const { ssr, globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName = '', logoLink = '/', wrapperProps, } = props;
35
35
  const { isMenuActive, uiState, closeMenu, toggleMenu } = (0, utils_js_1.useMenuToggling)(ssr !== 'ssr-only');
36
36
  const txt = (0, i18n_1.getTexts)(props, exports.defaultLayoutTexts);
37
- return (react_1.default.createElement("div", { className: (0, classUtils_1.modifiedClass)('Layout', props.modifier), "data-color-theme": colorTheme },
37
+ return (react_1.default.createElement("div", Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('Layout', props.modifier, (wrapperProps || {}).className), "data-color-theme": colorTheme }),
38
38
  globalAlerts && (react_1.default.createElement("div", { className: "Layout__alerts", role: "alert" }, globalAlerts)),
39
39
  react_1.default.createElement("div", { className: "Layout__content" },
40
40
  react_1.default.createElement("div", { className: "Layout__header", role: "banner" },
41
41
  react_1.default.createElement(_Link_js_1.Link, { className: "Layout__header__logo", href: logoLink },
42
42
  ' ',
43
- react_1.default.createElement(_Image_js_1.Image, { className: undefined, inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
43
+ react_1.default.createElement(_Image_js_1.Image, { bem: undefined, inline: true, src: (0, assets_1.getAssetUrl)('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
44
44
  ' ',
45
45
  siteName,
46
46
  ' '),
package/MainMenu.d.ts CHANGED
@@ -3,7 +3,7 @@ import { Cleanup } from '@reykjavik/hanna-utils';
3
3
  import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
4
4
  import { AuxilaryPanelIllustration, AuxiliaryPanelProps } from './MainMenu/_Auxiliary.js';
5
5
  import { MegaMenuItem, MegaMenuPanel, PrimaryPanelI18n } from './MainMenu/_PrimaryPanel.js';
6
- import { SSRSupportProps } from './utils.js';
6
+ import { SSRSupportProps, WrapperElmProps } from './utils.js';
7
7
  export type MainMenuI18n = Cleanup<{
8
8
  lang?: string;
9
9
  homeLabel?: string;
@@ -63,6 +63,6 @@ export type MainMenuProps = {
63
63
  activePanelId?: string;
64
64
  texts?: MainMenuI18n;
65
65
  lang?: string;
66
- } & SSRSupportProps;
66
+ } & SSRSupportProps & WrapperElmProps<null, 'aria-label'>;
67
67
  export declare const MainMenu: (props: MainMenuProps) => JSX.Element | null;
68
68
  export default MainMenu;
package/MainMenu.js CHANGED
@@ -89,12 +89,13 @@ const normalizeMenuItems = (itemsProp, megaPanels, homeLink, texts) => {
89
89
  // ---------------------------------------------------------------------------
90
90
  const emptyPanelList = [];
91
91
  const MainMenu = (props) => {
92
- const { megaPanels = emptyPanelList, onItemClick, ssr, auxiliaryPanel } = props;
92
+ const { megaPanels = emptyPanelList, onItemClick, ssr, auxiliaryPanel, wrapperProps = {}, } = props;
93
93
  const texts = (0, i18n_1.getTexts)(props, exports.defaultMainMenuTexts);
94
94
  const title = props.title || texts.title;
95
95
  const { closeHamburgerMenu } = (0, HannaUIState_js_1.useHannaUIState)();
96
96
  const isBrowser = (0, utils_js_1.useIsBrowserSide)(ssr);
97
- const menuElmRef = (0, react_1.useRef)(null);
97
+ const _menuElmRef = (0, react_1.useRef)(null);
98
+ const menuElmRef = wrapperProps.ref || _menuElmRef;
98
99
  const pressedLinkRef = (0, react_1.useRef)(null);
99
100
  const activePanelRef = (0, react_1.useRef)(null);
100
101
  const [activePanel, _setActivePanel] = (0, react_1.useState)(() => isBrowser && findActivePanel(megaPanels, props.activePanelId));
@@ -184,7 +185,7 @@ const MainMenu = (props) => {
184
185
  closeHamburgerMenu();
185
186
  }
186
187
  };
187
- return (react_1.default.createElement("nav", { className: "MainMenu", "aria-label": title, "data-sprinkled": isBrowser, ref: menuElmRef },
188
+ return (react_1.default.createElement("nav", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('MainMenu', null, wrapperProps.className), "aria-label": title, "data-sprinkled": isBrowser, ref: menuElmRef }),
188
189
  react_1.default.createElement("h2", { className: "MainMenu__title" }, title),
189
190
  react_1.default.createElement("ul", { className: "MainMenu__items" }, menuItems.map((item, i) => {
190
191
  if (item === '---') {
package/MiniMetrics.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { ButtonProps } from './_abstract/_Button.js';
2
2
  import { SeenProp } from './utils/seenEffect.js';
3
+ import { WrapperElmProps } from './utils.js';
3
4
  export type MiniMetricsProps = {
4
5
  text: string;
5
6
  moreButton: ButtonProps;
6
- } & SeenProp;
7
+ } & WrapperElmProps & SeenProp;
7
8
  export declare const MiniMetrics: (props: MiniMetricsProps) => JSX.Element;
8
9
  export default MiniMetrics;
package/MiniMetrics.js CHANGED
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MiniMetrics = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
+ const classUtils_1 = require("@hugsmidjan/qj/classUtils");
6
7
  const _Button_js_1 = require("./_abstract/_Button.js");
7
8
  const SeenEffect_js_1 = tslib_1.__importDefault(require("./SeenEffect.js"));
8
9
  const MiniMetrics = (props) => {
9
- const { text, moreButton, startSeen } = props;
10
- return (react_1.default.createElement(SeenEffect_js_1.default, { className: "MiniMetrics", startSeen: startSeen },
10
+ const { text, moreButton, startSeen, wrapperProps } = props;
11
+ return (react_1.default.createElement(SeenEffect_js_1.default, Object.assign({}, wrapperProps, { className: (0, classUtils_1.modifiedClass)('MiniMetrics', null, (wrapperProps || {}).className), startSeen: startSeen }),
11
12
  react_1.default.createElement("strong", { className: "MiniMetrics__text" }, text),
12
13
  " ",
13
14
  '\n',
package/Modal.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ModalProps as _ModalProps } from '@hugsmidjan/react/Modal';
3
+ import { MissingWrapperElmProps } from './utils.js';
3
4
  export type ModalProps = Omit<_ModalProps, 'bem' | 'bodyWrap' | 'modifier'> & {
4
5
  modifier?: 'w6' | 'w8' | 'w10';
5
6
  bling?: ReactElement;
6
- };
7
+ } & MissingWrapperElmProps;
7
8
  export declare const Modal: (props: ModalProps) => JSX.Element;
8
9
  export default Modal;
package/Multiselect.d.ts CHANGED
@@ -28,14 +28,18 @@ export type MultiselectProps = TogglerGroupFieldProps<string> & {
28
28
  * even when the total options are fewer than
29
29
  * `Multiselect.meta.summaryLimit`.
30
30
  *
31
- * NOTE: Using this option is generally not recommended.
31
+ * NOTE: Using this option is generally not recommended,
32
+ * because the search UI (i.e. the on-screen keyboard), takes up a lot of
33
+ * space on mobile devices.
32
34
  */
33
35
  forceSummary?: boolean;
34
36
  /**
35
37
  * Force the options to be searchable, even when they're
36
38
  * fewer than `Multiselect.meta.searchableLimit`.
37
39
  *
38
- * NOTE: Using this option is generally not recommended.
40
+ * NOTE: Using this option is generally not recommended,
41
+ * because the summary takes up valuable space when there are only a few
42
+ * items.
39
43
  */
40
44
  forceSearchable?: boolean;
41
45
  texts?: MultiselectI18n;
@@ -49,16 +53,17 @@ export declare const Multiselect: {
49
53
  /**
50
54
  * The item-count where the list becomes searchable.
51
55
  *
52
- * (The search UI, including the on-screen keyboard, takes up a lot of space
56
+ * (The search UI (on-screen keyboard), takes up a lot of space
53
57
  * on mobile devices, so there's a balance that we want to strike.)
54
58
  */
55
- searchableLimit: number;
59
+ readonly searchableLimit: number;
56
60
  /**
57
61
  * The item-count above which we display a summary of "current" values
58
62
  * at the top of the drop-down list.
59
63
  *
60
- * (This summary just gets in the way with ultra short option lists.)
64
+ * (The summary is pointless and takes up valuable space,
65
+ * when there are only a few items.)
61
66
  */
62
- summaryLimit: number;
67
+ readonly summaryLimit: number;
63
68
  };
64
69
  };
package/Multiselect.js CHANGED
@@ -11,14 +11,14 @@ const i18n_1 = require("@reykjavik/hanna-utils/i18n");
11
11
  const _FocusTrap_js_1 = require("./_abstract/_FocusTrap.js");
12
12
  const _Multiselect_search_js_1 = require("./Multiselect/_Multiselect.search.js");
13
13
  const Checkbox_js_1 = tslib_1.__importDefault(require("./Checkbox.js"));
14
- const FormField_js_1 = tslib_1.__importDefault(require("./FormField.js"));
14
+ const FormField_js_1 = tslib_1.__importStar(require("./FormField.js"));
15
15
  const TagPill_js_1 = tslib_1.__importDefault(require("./TagPill.js"));
16
16
  const utils_js_1 = require("./utils.js");
17
17
  const metaData = {
18
18
  /**
19
19
  * The item-count where the list becomes searchable.
20
20
  *
21
- * (The search UI, including the on-screen keyboard, takes up a lot of space
21
+ * (The search UI (on-screen keyboard), takes up a lot of space
22
22
  * on mobile devices, so there's a balance that we want to strike.)
23
23
  */
24
24
  searchableLimit: 20,
@@ -26,10 +26,14 @@ const metaData = {
26
26
  * The item-count above which we display a summary of "current" values
27
27
  * at the top of the drop-down list.
28
28
  *
29
- * (This summary just gets in the way with ultra short option lists.)
29
+ * (The summary is pointless and takes up valuable space,
30
+ * when there are only a few items.)
30
31
  */
32
+ // NOTE: First we tried 10, which felt way too low, now we're trying 20.
33
+ // Maybe the "sweet-spot" is closer to 15 ? — We'll see.
31
34
  summaryLimit: 20,
32
35
  };
36
+ // Extract the values up front, to prevent runtime changes of these values.
33
37
  const { searchableLimit, summaryLimit } = metaData;
34
38
  const defaultTexts = {
35
39
  pl: {
@@ -65,7 +69,7 @@ const Multiselect = (props) => {
65
69
  const placeholderText = !values.length ? props.placeholder : undefined;
66
70
  const texts = (0, i18n_1.getTexts)(props, defaultTexts);
67
71
  const inputRef = (0, react_1.useRef)(null);
68
- const wrapperRef = (0, react_1.useRef)(null);
72
+ const inputWrapperRef = (0, react_1.useRef)(null);
69
73
  const [activeItemIndex, setActiveItemIndex] = (0, react_1.useState)(-1);
70
74
  const [searchQuery, setSearchQuery] = (0, react_1.useState)('');
71
75
  const [isOpen, setIsOpen] = (0, react_1.useState)(false);
@@ -73,14 +77,14 @@ const Multiselect = (props) => {
73
77
  setIsOpen((isOpen) => {
74
78
  newIsOpen = typeof newIsOpen === 'boolean' ? newIsOpen : !isOpen;
75
79
  if (!newIsOpen) {
76
- wrapperRef.current.querySelector('.Multiselect__choices').scrollTo(0, 0);
80
+ inputWrapperRef.current.querySelector('.Multiselect__choices').scrollTo(0, 0);
77
81
  setSearchQuery('');
78
82
  setActiveItemIndex(-1);
79
83
  }
80
84
  return newIsOpen;
81
85
  });
82
86
  };
83
- (0, hooks_1.useOnClickOutside)(wrapperRef, () => toggleOpen(false));
87
+ (0, hooks_1.useOnClickOutside)(inputWrapperRef, () => toggleOpen(false));
84
88
  const options = (0, react_1.useMemo)(() => _options.map((item) => (typeof item === 'string' ? { value: item } : item)), [_options]);
85
89
  const isSearchable = props.forceSearchable || options.length >= searchableLimit;
86
90
  /*
@@ -168,7 +172,7 @@ const Multiselect = (props) => {
168
172
  }, [activeItemIndex, filteredOptions, isOpen, handleCheckboxSelection, inputRef]);
169
173
  // Auto-close the dropdown when focus has left the building
170
174
  (0, react_1.useEffect)(() => {
171
- const wrapperDiv = wrapperRef.current;
175
+ const wrapperDiv = inputWrapperRef.current;
172
176
  if (!wrapperDiv) {
173
177
  return;
174
178
  }
@@ -186,14 +190,14 @@ const Multiselect = (props) => {
186
190
  }, []);
187
191
  (0, react_1.useEffect)(() => {
188
192
  var _a, _b;
189
- (_b = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.Multiselect__option')[activeItemIndex]) === null || _b === void 0 ? void 0 : _b.scrollIntoView({
193
+ (_b = (_a = inputWrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.Multiselect__option')[activeItemIndex]) === null || _b === void 0 ? void 0 : _b.scrollIntoView({
190
194
  behavior: 'smooth',
191
195
  block: 'nearest',
192
196
  });
193
197
  }, [activeItemIndex]);
194
- return (react_1.default.createElement(FormField_js_1.default, { className: (0, classUtils_1.modifiedClass)('Multiselect', props.nowrap && 'nowrap', props.className), ssr: props.ssr, group: "inputlike", label: props.label, LabelTag: props.LabelTag, hideLabel: props.hideLabel, small: props.small, filled: filled, empty: empty, disabled: disabled, invalid: props.invalid, errorMessage: props.errorMessage, assistText: props.assistText, readOnly: readOnly, required: props.required, reqText: props.reqText, id: props.id, renderInput: (className, inputProps, addFocusProps, isBrowser) => {
198
+ return (react_1.default.createElement(FormField_js_1.default, Object.assign({ extraClassName: (0, classUtils_1.modifiedClass)('Multiselect', props.nowrap && 'nowrap'), group: "inputlike", filled: filled, empty: empty }, (0, FormField_js_1.getFormFieldWrapperProps)(props), { renderInput: (className, inputProps, addFocusProps, isBrowser) => {
195
199
  const { id } = inputProps;
196
- return (react_1.default.createElement("div", Object.assign({ className: (0, classUtils_1.modifiedClass)('Multiselect__input', [isOpen && 'open'], className.input) }, addFocusProps(), { "data-sprinkled": isBrowser, ref: wrapperRef }),
200
+ return (react_1.default.createElement("div", Object.assign({ className: (0, classUtils_1.modifiedClass)('Multiselect__input', [isOpen && 'open'], className.input) }, addFocusProps(), { "data-sprinkled": isBrowser, ref: inputWrapperRef }),
197
201
  !isBrowser ? null : isSearchable ? (react_1.default.createElement("input", { className: "Multiselect__search", id: `toggler:${id}`, "aria-label": texts.search, "aria-controls": (0, domid_1.default)(), "data-expanded": isOpen || undefined, onChange: handleInputChange, onKeyDown: handleInputKeyDown, onClick: () => toggleOpen(), value: searchQuery,
198
202
  // onFocus={handleInputFocus}
199
203
  placeholder: placeholderText, disabled: disabled, ref: inputRef })) : (react_1.default.createElement("button", { className: "Multiselect__toggler", id: `toggler:${id}`, type: "button", "aria-label": texts.buttonShow, "aria-controls": (0, domid_1.default)(), "aria-expanded": isOpen, onClick: () => toggleOpen(), disabled: disabled,
@@ -229,7 +233,7 @@ const Multiselect = (props) => {
229
233
  } })));
230
234
  })) : searchQuery ? (react_1.default.createElement("li", { className: "Multiselect__noresults" }, texts.noneFoundMsg)) : undefined,
231
235
  react_1.default.createElement(_FocusTrap_js_1.FocusTrap, { Tag: "li" })))));
232
- } }));
236
+ } })));
233
237
  };
234
238
  exports.Multiselect = Multiselect;
235
239
  /** Configuration constants for the Multiselect components */